zerocodejs 1.0.1-beta.3 → 1.0.1-beta.4

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.
@@ -334,30 +334,30 @@
334
334
  }
335
335
  })
336
336
  })()
337
- `}function Mo(t,e=!1){const n=t,o=t.querySelector("script[data-zcode-shadow-extension]");if(o)if(e){if(n.__zcmsEventListeners){const i=n.__zcmsEventListeners;i.forEach(function(s){s.forEach(function(l){t.removeEventListener(l.eventName,l.handler,!0)})}),i.clear()}o.remove(),n.__zcmsJQueryExtended&&delete n.__zcmsJQueryExtended,n.__zcmsNativeAPIExtended&&delete n.__zcmsNativeAPIExtended}else return;const r=document.createElement("script");r.setAttribute("data-zcode-shadow-extension","true"),r.textContent=lg(t),t.insertBefore(r,t.firstChild)}function cg(){if(typeof window>"u")return 20;try{let t=document.querySelector(".zcode-toolbar");if(!t){const n=document.querySelectorAll("zcode-cms, zcode-editor");for(const o of Array.from(n)){const r=o.shadowRoot;if(r){const i=r.querySelector(".zcode-toolbar");if(i){t=i;break}}}}if(!t)return 20;const e=t.getBoundingClientRect();return e.height>0?e.height:20}catch(t){return console.warn("Failed to get toolbar height:",t),20}}function ar(t,e=0){if(!(typeof window>"u"||!t))try{const n=t.getBoundingClientRect(),o=window.pageYOffset||document.documentElement.scrollTop,r=cg(),i=n.top+o-r-e;window.scrollTo({top:Math.max(0,i),behavior:"smooth"})}catch(n){console.warn("Failed to scroll to element:",n);try{const o=t.getBoundingClientRect(),r=window.pageYOffset||document.documentElement.scrollTop,i=o.top+r-20;window.scrollTo({top:Math.max(0,i),behavior:"smooth"})}catch(o){console.error("Scroll fallback also failed:",o)}}}const{entries:jc,setPrototypeOf:Uc,isFrozen:dg,getPrototypeOf:ug,getOwnPropertyDescriptor:fg}=Object;let{freeze:wt,seal:Ft,create:ia}=Object,{apply:sa,construct:aa}=typeof Reflect<"u"&&Reflect;wt||(wt=function(e){return e}),Ft||(Ft=function(e){return e}),sa||(sa=function(e,n){for(var o=arguments.length,r=new Array(o>2?o-2:0),i=2;i<o;i++)r[i-2]=arguments[i];return e.apply(n,r)}),aa||(aa=function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return new e(...o)});const ai=Nt(Array.prototype.forEach),pg=Nt(Array.prototype.lastIndexOf),Hc=Nt(Array.prototype.pop),lr=Nt(Array.prototype.push),hg=Nt(Array.prototype.splice),li=Nt(String.prototype.toLowerCase),la=Nt(String.prototype.toString),ca=Nt(String.prototype.match),cr=Nt(String.prototype.replace),mg=Nt(String.prototype.indexOf),gg=Nt(String.prototype.trim),tn=Nt(Object.prototype.hasOwnProperty),St=Nt(RegExp.prototype.test),dr=bg(TypeError);function Nt(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return sa(t,e,o)}}function bg(t){return function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return aa(t,n)}}function De(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:li;Uc&&Uc(t,null);let o=e.length;for(;o--;){let r=e[o];if(typeof r=="string"){const i=n(r);i!==r&&(dg(e)||(e[o]=i),r=i)}t[r]=!0}return t}function yg(t){for(let e=0;e<t.length;e++)tn(t,e)||(t[e]=null);return t}function cn(t){const e=ia(null);for(const[n,o]of jc(t))tn(t,n)&&(Array.isArray(o)?e[n]=yg(o):o&&typeof o=="object"&&o.constructor===Object?e[n]=cn(o):e[n]=o);return e}function ur(t,e){for(;t!==null;){const o=fg(t,e);if(o){if(o.get)return Nt(o.get);if(typeof o.value=="function")return Nt(o.value)}t=ug(t)}function n(){return null}return n}const Wc=wt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),da=wt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ua=wt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),xg=wt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),fa=wt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Eg=wt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Gc=wt(["#text"]),qc=wt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),pa=wt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Kc=wt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ci=wt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),kg=Ft(/\{\{[\w\W]*|[\w\W]*\}\}/gm),wg=Ft(/<%[\w\W]*|[\w\W]*%>/gm),Sg=Ft(/\$\{[\w\W]*/gm),Ng=Ft(/^data-[\-\w.\u00B7-\uFFFF]+$/),Cg=Ft(/^aria-[\-\w]+$/),Jc=Ft(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),vg=Ft(/^(?:\w+script|data):/i),Tg=Ft(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Xc=Ft(/^html$/i),zg=Ft(/^[a-z][.\w]*(-[.\w]+)+$/i);var Yc=Object.freeze({__proto__:null,ARIA_ATTR:Cg,ATTR_WHITESPACE:Tg,CUSTOM_ELEMENT:zg,DATA_ATTR:Ng,DOCTYPE_NAME:Xc,ERB_EXPR:wg,IS_ALLOWED_URI:Jc,IS_SCRIPT_OR_DATA:vg,MUSTACHE_EXPR:kg,TMPLIT_EXPR:Sg});const fr={element:1,text:3,progressingInstruction:7,comment:8,document:9},_g=function(){return typeof window>"u"?null:window},Ag=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let o=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(o=n.getAttribute(r));const i="dompurify"+(o?"#"+o:"");try{return e.createPolicy(i,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Qc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Zc(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_g();const e=xe=>Zc(xe);if(e.version="3.3.1",e.removed=[],!t||!t.document||t.document.nodeType!==fr.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const o=n,r=o.currentScript,{DocumentFragment:i,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:h}=t,m=c.prototype,b=ur(m,"cloneNode"),g=ur(m,"remove"),x=ur(m,"nextSibling"),v=ur(m,"childNodes"),w=ur(m,"parentNode");if(typeof s=="function"){const xe=n.createElement("template");xe.content&&xe.content.ownerDocument&&(n=xe.content.ownerDocument)}let T,M="";const{implementation:A,createNodeIterator:y,createDocumentFragment:E,getElementsByTagName:S}=n,{importNode:D}=o;let W=Qc();e.isSupported=typeof jc=="function"&&typeof w=="function"&&A&&A.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:z,ERB_EXPR:P,TMPLIT_EXPR:V,DATA_ATTR:j,ARIA_ATTR:L,IS_SCRIPT_OR_DATA:H,ATTR_WHITESPACE:Q,CUSTOM_ELEMENT:G}=Yc;let{IS_ALLOWED_URI:se}=Yc,Z=null;const X=De({},[...Wc,...da,...ua,...fa,...Gc]);let J=null;const K=De({},[...qc,...pa,...Kc,...ci]);let Y=Object.seal(ia(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ce=null,Ee=null;const _e=Object.seal(ia(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Le=!0,C=!0,N=!1,O=!0,k=!1,U=!0,te=!1,me=!1,ve=!1,Ve=!1,Ce=!1,_=!1,I=!0,q=!1;const fe="user-content-";let Ae=!0,Te=!1,we={},B=null;const ee=De({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Me=null;const $=De({},["audio","video","img","source","image","track"]);let F=null;const re=De({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),ae="http://www.w3.org/1998/Math/MathML",ke="http://www.w3.org/2000/svg",Fe="http://www.w3.org/1999/xhtml";let st=Fe,xn=!1,oi=null;const Tc=De({},[ae,ke,Fe],la);let Zo=De({},["mi","mo","mn","ms","mtext"]),er=De({},["annotation-xml"]);const zc=De({},["title","style","font","a","script"]);let Pn=null;const ri=["application/xhtml+xml","text/html"],Ln="text/html";let Ze=null,En=null;const Xs=n.createElement("form"),Ys=function(R){return R instanceof RegExp||R instanceof Function},tr=function(){let R=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(En&&En===R)){if((!R||typeof R!="object")&&(R={}),R=cn(R),Pn=ri.indexOf(R.PARSER_MEDIA_TYPE)===-1?Ln:R.PARSER_MEDIA_TYPE,Ze=Pn==="application/xhtml+xml"?la:li,Z=tn(R,"ALLOWED_TAGS")?De({},R.ALLOWED_TAGS,Ze):X,J=tn(R,"ALLOWED_ATTR")?De({},R.ALLOWED_ATTR,Ze):K,oi=tn(R,"ALLOWED_NAMESPACES")?De({},R.ALLOWED_NAMESPACES,la):Tc,F=tn(R,"ADD_URI_SAFE_ATTR")?De(cn(re),R.ADD_URI_SAFE_ATTR,Ze):re,Me=tn(R,"ADD_DATA_URI_TAGS")?De(cn($),R.ADD_DATA_URI_TAGS,Ze):$,B=tn(R,"FORBID_CONTENTS")?De({},R.FORBID_CONTENTS,Ze):ee,ce=tn(R,"FORBID_TAGS")?De({},R.FORBID_TAGS,Ze):cn({}),Ee=tn(R,"FORBID_ATTR")?De({},R.FORBID_ATTR,Ze):cn({}),we=tn(R,"USE_PROFILES")?R.USE_PROFILES:!1,Le=R.ALLOW_ARIA_ATTR!==!1,C=R.ALLOW_DATA_ATTR!==!1,N=R.ALLOW_UNKNOWN_PROTOCOLS||!1,O=R.ALLOW_SELF_CLOSE_IN_ATTR!==!1,k=R.SAFE_FOR_TEMPLATES||!1,U=R.SAFE_FOR_XML!==!1,te=R.WHOLE_DOCUMENT||!1,Ve=R.RETURN_DOM||!1,Ce=R.RETURN_DOM_FRAGMENT||!1,_=R.RETURN_TRUSTED_TYPE||!1,ve=R.FORCE_BODY||!1,I=R.SANITIZE_DOM!==!1,q=R.SANITIZE_NAMED_PROPS||!1,Ae=R.KEEP_CONTENT!==!1,Te=R.IN_PLACE||!1,se=R.ALLOWED_URI_REGEXP||Jc,st=R.NAMESPACE||Fe,Zo=R.MATHML_TEXT_INTEGRATION_POINTS||Zo,er=R.HTML_INTEGRATION_POINTS||er,Y=R.CUSTOM_ELEMENT_HANDLING||{},R.CUSTOM_ELEMENT_HANDLING&&Ys(R.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Y.tagNameCheck=R.CUSTOM_ELEMENT_HANDLING.tagNameCheck),R.CUSTOM_ELEMENT_HANDLING&&Ys(R.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Y.attributeNameCheck=R.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),R.CUSTOM_ELEMENT_HANDLING&&typeof R.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Y.allowCustomizedBuiltInElements=R.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),k&&(C=!1),Ce&&(Ve=!0),we&&(Z=De({},Gc),J=[],we.html===!0&&(De(Z,Wc),De(J,qc)),we.svg===!0&&(De(Z,da),De(J,pa),De(J,ci)),we.svgFilters===!0&&(De(Z,ua),De(J,pa),De(J,ci)),we.mathMl===!0&&(De(Z,fa),De(J,Kc),De(J,ci))),R.ADD_TAGS&&(typeof R.ADD_TAGS=="function"?_e.tagCheck=R.ADD_TAGS:(Z===X&&(Z=cn(Z)),De(Z,R.ADD_TAGS,Ze))),R.ADD_ATTR&&(typeof R.ADD_ATTR=="function"?_e.attributeCheck=R.ADD_ATTR:(J===K&&(J=cn(J)),De(J,R.ADD_ATTR,Ze))),R.ADD_URI_SAFE_ATTR&&De(F,R.ADD_URI_SAFE_ATTR,Ze),R.FORBID_CONTENTS&&(B===ee&&(B=cn(B)),De(B,R.FORBID_CONTENTS,Ze)),R.ADD_FORBID_CONTENTS&&(B===ee&&(B=cn(B)),De(B,R.ADD_FORBID_CONTENTS,Ze)),Ae&&(Z["#text"]=!0),te&&De(Z,["html","head","body"]),Z.table&&(De(Z,["tbody"]),delete ce.tbody),R.TRUSTED_TYPES_POLICY){if(typeof R.TRUSTED_TYPES_POLICY.createHTML!="function")throw dr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof R.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw dr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=R.TRUSTED_TYPES_POLICY,M=T.createHTML("")}else T===void 0&&(T=Ag(h,r)),T!==null&&typeof M=="string"&&(M=T.createHTML(""));wt&&wt(R),En=R}},Qs=De({},[...da,...ua,...xg]),Zs=De({},[...fa,...Eg]),ea=function(R){let ie=w(R);(!ie||!ie.tagName)&&(ie={namespaceURI:st,tagName:"template"});const ge=li(R.tagName),Xe=li(ie.tagName);return oi[R.namespaceURI]?R.namespaceURI===ke?ie.namespaceURI===Fe?ge==="svg":ie.namespaceURI===ae?ge==="svg"&&(Xe==="annotation-xml"||Zo[Xe]):!!Qs[ge]:R.namespaceURI===ae?ie.namespaceURI===Fe?ge==="math":ie.namespaceURI===ke?ge==="math"&&er[Xe]:!!Zs[ge]:R.namespaceURI===Fe?ie.namespaceURI===ke&&!er[Xe]||ie.namespaceURI===ae&&!Zo[Xe]?!1:!Zs[ge]&&(zc[ge]||!Qs[ge]):!!(Pn==="application/xhtml+xml"&&oi[R.namespaceURI]):!1},Zt=function(R){lr(e.removed,{element:R});try{w(R).removeChild(R)}catch{g(R)}},kn=function(R,ie){try{lr(e.removed,{attribute:ie.getAttributeNode(R),from:ie})}catch{lr(e.removed,{attribute:null,from:ie})}if(ie.removeAttribute(R),R==="is")if(Ve||Ce)try{Zt(ie)}catch{}else try{ie.setAttribute(R,"")}catch{}},ta=function(R){let ie=null,ge=null;if(ve)R="<remove></remove>"+R;else{const rt=ca(R,/^[\r\n\t ]+/);ge=rt&&rt[0]}Pn==="application/xhtml+xml"&&st===Fe&&(R='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+R+"</body></html>");const Xe=T?T.createHTML(R):R;if(st===Fe)try{ie=new p().parseFromString(Xe,Pn)}catch{}if(!ie||!ie.documentElement){ie=A.createDocument(st,"template",null);try{ie.documentElement.innerHTML=xn?M:Xe}catch{}}const kt=ie.body||ie.documentElement;return R&&ge&&kt.insertBefore(n.createTextNode(ge),kt.childNodes[0]||null),st===Fe?S.call(ie,te?"html":"body")[0]:te?ie.documentElement:kt},ii=function(R){return y.call(R.ownerDocument||R,R,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},le=function(R){return R instanceof f&&(typeof R.nodeName!="string"||typeof R.textContent!="string"||typeof R.removeChild!="function"||!(R.attributes instanceof u)||typeof R.removeAttribute!="function"||typeof R.setAttribute!="function"||typeof R.namespaceURI!="string"||typeof R.insertBefore!="function"||typeof R.hasChildNodes!="function")},de=function(R){return typeof l=="function"&&R instanceof l};function be(xe,R,ie){ai(xe,ge=>{ge.call(e,R,ie,En)})}const Ge=function(R){let ie=null;if(be(W.beforeSanitizeElements,R,null),le(R))return Zt(R),!0;const ge=Ze(R.nodeName);if(be(W.uponSanitizeElement,R,{tagName:ge,allowedTags:Z}),U&&R.hasChildNodes()&&!de(R.firstElementChild)&&St(/<[/\w!]/g,R.innerHTML)&&St(/<[/\w!]/g,R.textContent)||R.nodeType===fr.progressingInstruction||U&&R.nodeType===fr.comment&&St(/<[/\w]/g,R.data))return Zt(R),!0;if(!(_e.tagCheck instanceof Function&&_e.tagCheck(ge))&&(!Z[ge]||ce[ge])){if(!ce[ge]&&At(ge)&&(Y.tagNameCheck instanceof RegExp&&St(Y.tagNameCheck,ge)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(ge)))return!1;if(Ae&&!B[ge]){const Xe=w(R)||R.parentNode,kt=v(R)||R.childNodes;if(kt&&Xe){const rt=kt.length;for(let Lt=rt-1;Lt>=0;--Lt){const $n=b(kt[Lt],!0);$n.__removalCount=(R.__removalCount||0)+1,Xe.insertBefore($n,x(R))}}}return Zt(R),!0}return R instanceof c&&!ea(R)||(ge==="noscript"||ge==="noembed"||ge==="noframes")&&St(/<\/no(script|embed|frames)/i,R.innerHTML)?(Zt(R),!0):(k&&R.nodeType===fr.text&&(ie=R.textContent,ai([z,P,V],Xe=>{ie=cr(ie,Xe," ")}),R.textContent!==ie&&(lr(e.removed,{element:R.cloneNode()}),R.textContent=ie)),be(W.afterSanitizeElements,R,null),!1)},et=function(R,ie,ge){if(I&&(ie==="id"||ie==="name")&&(ge in n||ge in Xs))return!1;if(!(C&&!Ee[ie]&&St(j,ie))){if(!(Le&&St(L,ie))){if(!(_e.attributeCheck instanceof Function&&_e.attributeCheck(ie,R))){if(!J[ie]||Ee[ie]){if(!(At(R)&&(Y.tagNameCheck instanceof RegExp&&St(Y.tagNameCheck,R)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(R))&&(Y.attributeNameCheck instanceof RegExp&&St(Y.attributeNameCheck,ie)||Y.attributeNameCheck instanceof Function&&Y.attributeNameCheck(ie,R))||ie==="is"&&Y.allowCustomizedBuiltInElements&&(Y.tagNameCheck instanceof RegExp&&St(Y.tagNameCheck,ge)||Y.tagNameCheck instanceof Function&&Y.tagNameCheck(ge))))return!1}else if(!F[ie]){if(!St(se,cr(ge,Q,""))){if(!((ie==="src"||ie==="xlink:href"||ie==="href")&&R!=="script"&&mg(ge,"data:")===0&&Me[R])){if(!(N&&!St(H,cr(ge,Q,"")))){if(ge)return!1}}}}}}}return!0},At=function(R){return R!=="annotation-xml"&&ca(R,G)},Lm=function(R){be(W.beforeSanitizeAttributes,R,null);const{attributes:ie}=R;if(!ie||le(R))return;const ge={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:J,forceKeepAttr:void 0};let Xe=ie.length;for(;Xe--;){const kt=ie[Xe],{name:rt,namespaceURI:Lt,value:$n}=kt,nr=Ze(rt),_c=$n;let bt=rt==="value"?_c:gg(_c);if(ge.attrName=nr,ge.attrValue=bt,ge.keepAttr=!0,ge.forceKeepAttr=void 0,be(W.uponSanitizeAttribute,R,ge),bt=ge.attrValue,q&&(nr==="id"||nr==="name")&&(kn(rt,R),bt=fe+bt),U&&St(/((--!?|])>)|<\/(style|title|textarea)/i,bt)){kn(rt,R);continue}if(nr==="attributename"&&ca(bt,"href")){kn(rt,R);continue}if(ge.forceKeepAttr)continue;if(!ge.keepAttr){kn(rt,R);continue}if(!O&&St(/\/>/i,bt)){kn(rt,R);continue}k&&ai([z,P,V],Vm=>{bt=cr(bt,Vm," ")});const $m=Ze(R.nodeName);if(!et($m,nr,bt)){kn(rt,R);continue}if(T&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Lt)switch(h.getAttributeType($m,nr)){case"TrustedHTML":{bt=T.createHTML(bt);break}case"TrustedScriptURL":{bt=T.createScriptURL(bt);break}}if(bt!==_c)try{Lt?R.setAttributeNS(Lt,rt,bt):R.setAttribute(rt,bt),le(R)?Zt(R):Hc(e.removed)}catch{kn(rt,R)}}be(W.afterSanitizeAttributes,R,null)},bM=function xe(R){let ie=null;const ge=ii(R);for(be(W.beforeSanitizeShadowDOM,R,null);ie=ge.nextNode();)be(W.uponSanitizeShadowNode,ie,null),Ge(ie),Lm(ie),ie.content instanceof i&&xe(ie.content);be(W.afterSanitizeShadowDOM,R,null)};return e.sanitize=function(xe){let R=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},ie=null,ge=null,Xe=null,kt=null;if(xn=!xe,xn&&(xe="<!-->"),typeof xe!="string"&&!de(xe))if(typeof xe.toString=="function"){if(xe=xe.toString(),typeof xe!="string")throw dr("dirty is not a string, aborting")}else throw dr("toString is not a function");if(!e.isSupported)return xe;if(me||tr(R),e.removed=[],typeof xe=="string"&&(Te=!1),Te){if(xe.nodeName){const $n=Ze(xe.nodeName);if(!Z[$n]||ce[$n])throw dr("root node is forbidden and cannot be sanitized in-place")}}else if(xe instanceof l)ie=ta("<!---->"),ge=ie.ownerDocument.importNode(xe,!0),ge.nodeType===fr.element&&ge.nodeName==="BODY"||ge.nodeName==="HTML"?ie=ge:ie.appendChild(ge);else{if(!Ve&&!k&&!te&&xe.indexOf("<")===-1)return T&&_?T.createHTML(xe):xe;if(ie=ta(xe),!ie)return Ve?null:_?M:""}ie&&ve&&Zt(ie.firstChild);const rt=ii(Te?xe:ie);for(;Xe=rt.nextNode();)Ge(Xe),Lm(Xe),Xe.content instanceof i&&bM(Xe.content);if(Te)return xe;if(Ve){if(Ce)for(kt=E.call(ie.ownerDocument);ie.firstChild;)kt.appendChild(ie.firstChild);else kt=ie;return(J.shadowroot||J.shadowrootmode)&&(kt=D.call(o,kt,!0)),kt}let Lt=te?ie.outerHTML:ie.innerHTML;return te&&Z["!doctype"]&&ie.ownerDocument&&ie.ownerDocument.doctype&&ie.ownerDocument.doctype.name&&St(Xc,ie.ownerDocument.doctype.name)&&(Lt="<!DOCTYPE "+ie.ownerDocument.doctype.name+`>
338
- `+Lt),k&&ai([z,P,V],$n=>{Lt=cr(Lt,$n," ")}),T&&_?T.createHTML(Lt):Lt},e.setConfig=function(){let xe=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tr(xe),me=!0},e.clearConfig=function(){En=null,me=!1},e.isValidAttribute=function(xe,R,ie){En||tr({});const ge=Ze(xe),Xe=Ze(R);return et(ge,Xe,ie)},e.addHook=function(xe,R){typeof R=="function"&&lr(W[xe],R)},e.removeHook=function(xe,R){if(R!==void 0){const ie=pg(W[xe],R);return ie===-1?void 0:hg(W[xe],ie,1)[0]}return Hc(W[xe])},e.removeHooks=function(xe){W[xe]=[]},e.removeAllHooks=function(){W=Qc()},e}var Mg=Zc();function ed(t){return Mg.sanitize(t,{ALLOWED_TAGS:["p","br","strong","em","s","u","ul","ol","li","a","hr"],ALLOWED_ATTR:["href","target","rel"],ALLOW_DATA_ATTR:!1,FORBID_TAGS:["script","iframe","object","embed","form","input","button","style"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur"]})}function it(t){return typeof t!="string"?"":t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ct(t){if(!t||typeof t!="string")return"";const e=t.trim(),n=e.toLowerCase();return n.startsWith("javascript:")||n.startsWith("vbscript:")||n.startsWith("file:")?"":n.startsWith("data:")?n.startsWith("data:image/")?e:"":e}const pe={TEXT_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):([^}]+)\}/g,TEXT_FIELD:/\{\$(\w+):([^}]+)\}/g,RICH_TEXT_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):rich(?::[^}]+)?\}/g,RICH_TEXT_FIELD:/\{\$(\w+):(.+?):rich(?::[^}]+)?\}/g,TEXTAREA_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):textarea(?::[^}]+)?\}/g,TEXTAREA_FIELD:/\{\$(\w+):(.+?):textarea(?::[^}]+)?\}/g,IMAGE_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):image(?::[^}]+)?\}/g,IMAGE_FIELD:/\{\$(\w+):(.+?):image(?::[^}]+)?\}/g,SELECT_FIELD_WITH_GROUP:/\(\$(\w+)\.(\w+)@:([^)]+)\)/g,SELECT_FIELD:/\(\$(\w+)@:([^)]+)\)/g,RADIO_CHECKBOX_FIELD_WITH_GROUP:/\(\$(\w+)\.(\w+):([^)]+)\)/g,RADIO_FIELD:/\(\$(\w+):([^)]+)\)/g,BACKEND_DATA:/\{@([\w.[\]]+)\}/g};function Ig(t){const e={};for(const n of t){if(n==="required"){e.required=!0;continue}if(n==="readonly"){e.readonly=!0;continue}if(n==="disabled"){e.disabled=!0;continue}if(n.startsWith("max=")){const o=Number(n.slice(4));Number.isFinite(o)&&(e.maxLength=o)}}return e}function ze(t){const e=t.split(":"),n=[],o=r=>r==="required"||r==="readonly"||r==="disabled"||/^max=\d+$/.test(r);for(;e.length>0&&o(e[e.length-1]);)n.unshift(e.pop());return{defaultValue:e.join(":"),validation:Ig(n)}}function Fn(t){const e=[],n=new Set,o=ra(),s=new o().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template");if(!s)return e;const l=d=>{if(d.nodeType===Node.TEXT_NODE){const u=d.textContent||"",f=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(u.matchAll(f)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]){const U=k[1],te=k[2];if(!n.has(U)){const{defaultValue:me,validation:ve}=ze(k[3]);e.push({fieldName:U,groupName:te,type:"rich",defaultValue:me,optional:!0,...ve}),n.add(U)}}});const h=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(u.matchAll(h)).forEach(k=>{if(k&&k[1]&&k[2]){const U=k[1];if(!n.has(U)){const{defaultValue:te,validation:me}=ze(k[2]);e.push({fieldName:U,type:"rich",defaultValue:te,optional:!0,...me}),n.add(U)}}});const b=new RegExp(pe.RICH_TEXT_FIELD_WITH_GROUP.source,pe.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(b)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]){const U=k[1],te=k[2];if(!n.has(U)){const{defaultValue:me,validation:ve}=ze(k[3]);e.push({fieldName:U,groupName:te,type:"rich",defaultValue:me,...ve}),n.add(U)}}});const x=new RegExp(pe.RICH_TEXT_FIELD.source,pe.RICH_TEXT_FIELD.flags);Array.from(u.matchAll(x)).forEach(k=>{if(k&&k[1]&&k[2]){const U=k[1];if(!n.has(U)){const{defaultValue:te,validation:me}=ze(k[2]);e.push({fieldName:U,type:"rich",defaultValue:te,...me}),n.add(U)}}});const w=/\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/g;Array.from(u.matchAll(w)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"textarea",defaultValue:U,optional:!0,...te}),n.add(k[1])}});const M=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/g;Array.from(u.matchAll(M)).forEach(k=>{if(k&&k[1]&&k[2]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[2]);e.push({fieldName:k[1],type:"textarea",defaultValue:U,optional:!0,...te}),n.add(k[1])}});const y=new RegExp(pe.TEXTAREA_FIELD_WITH_GROUP.source,pe.TEXTAREA_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(y)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"textarea",defaultValue:U,...te}),n.add(k[1])}});const S=new RegExp(pe.TEXTAREA_FIELD.source,pe.TEXTAREA_FIELD.flags);Array.from(u.matchAll(S)).forEach(k=>{if(k&&k[1]&&k[2]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[2]);e.push({fieldName:k[1],type:"textarea",defaultValue:U,...te}),n.add(k[1])}});const W=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll(W)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"image",defaultValue:U,optional:!0,...te}),n.add(k[1])}});const P=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll(P)).forEach(k=>{if(k&&k[1]&&k[2]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[2]);e.push({fieldName:k[1],type:"image",defaultValue:U,optional:!0,...te}),n.add(k[1])}});const j=new RegExp(pe.IMAGE_FIELD_WITH_GROUP.source,pe.IMAGE_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(j)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"image",defaultValue:U,...te}),n.add(k[1])}});const H=new RegExp(pe.IMAGE_FIELD.source,pe.IMAGE_FIELD.flags);Array.from(u.matchAll(H)).forEach(k=>{if(k&&k[1]&&k[2]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[2]);e.push({fieldName:k[1],type:"image",defaultValue:U,...te}),n.add(k[1])}});const G=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(G)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"text",defaultValue:U,optional:!0,...te}),n.add(k[1])}});const Z=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(Z)).forEach(k=>{if(k&&k[0]&&!/:rich(?::[^}]*)?\}$/.test(k[0])&&!/:image(?::[^}]*)?\}$/.test(k[0])&&!/:textarea(?::[^}]*)?\}$/.test(k[0])&&!k[0].includes(".")&&k[1]&&k[2]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[2]);e.push({fieldName:k[1],type:"text",defaultValue:U,optional:!0,...te}),n.add(k[1])}});const J=new RegExp(pe.TEXT_FIELD_WITH_GROUP.source,pe.TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(J)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[3]);e.push({fieldName:k[1],groupName:k[2],type:"text",defaultValue:U,...te}),n.add(k[1])}});const Y=new RegExp(pe.TEXT_FIELD.source,pe.TEXT_FIELD.flags);Array.from(u.matchAll(Y)).forEach(k=>{if(k&&k[0]&&!/:rich(?::[^}]*)?\}$/.test(k[0])&&!/:image(?::[^}]*)?\}$/.test(k[0])&&!/:textarea(?::[^}]*)?\}$/.test(k[0])&&!k[0].includes(".")&&k[1]&&k[2]&&!n.has(k[1])){const{defaultValue:U,validation:te}=ze(k[2]);e.push({fieldName:k[1],type:"text",defaultValue:U,...te}),n.add(k[1])}});const Ee=new RegExp(pe.SELECT_FIELD_WITH_GROUP.source,pe.SELECT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(Ee)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const U=k[1],te=k[2],me=k[3];me.includes("|")?e.push({fieldName:U,groupName:te,type:"select",options:me.split("|")}):me.includes(",")&&e.push({fieldName:U,groupName:te,type:"select-multiple",options:me.split(",")}),n.add(U)}}),(u.match(pe.SELECT_FIELD)||[]).forEach(k=>{const U=k.match(/\(\$(\w+)@:([^)]+)\)/);if(U&&!n.has(U[1])){const te=U[1],me=U[2];me.includes("|")?e.push({fieldName:te,type:"select",options:me.split("|")}):me.includes(",")&&e.push({fieldName:te,type:"select-multiple",options:me.split(",")}),n.add(te)}});const C=new RegExp(pe.RADIO_CHECKBOX_FIELD_WITH_GROUP.source,pe.RADIO_CHECKBOX_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(C)).forEach(k=>{if(k&&k[1]&&k[2]&&k[3]&&!n.has(k[1])){const U=k[1],te=k[2],me=k[3];me.includes("|")?e.push({fieldName:U,groupName:te,type:"radio",options:me.split("|")}):me.includes(",")&&e.push({fieldName:U,groupName:te,type:"checkbox",options:me.split(",")}),n.add(U)}}),(u.match(pe.RADIO_FIELD)||[]).forEach(k=>{const U=k.match(/\(\$(\w+):([^)]+)\)/);if(U&&!n.has(U[1])){const te=U[1],me=U[2];me.includes("|")?e.push({fieldName:te,type:"radio",options:me.split("|")}):me.includes(",")&&e.push({fieldName:te,type:"checkbox",options:me.split(",")}),n.add(te)}});return}else if(d.nodeType===Node.ELEMENT_NODE){const u=d,f=u.getAttribute("z-if");f&&!n.has(f)&&(e.push({fieldName:f,type:"boolean",defaultValue:"true"}),n.add(f));const p=u.getAttribute("z-tag");if(p){const m=p.match(/^\$(\w+)(?::(.+))?$/);if(m){const b=m[1],g=m[2];if(!n.has(b)){const x=g?g.split("|").map(T=>T.trim()):void 0,v=u.tagName.toLowerCase();let w=v;x&&!x.includes(v)&&(typeof process<"u"&&process.env?.NODE_ENV==="development"&&console.warn(`[ZeroCode] z-tag="${p}": 現在のタグ名 "${v}" が選択肢に含まれていません。デフォルト値として "${x[0]}" を使用します。`),w=x[0]),e.push({fieldName:b,type:"tag",defaultValue:w,options:x,optional:!1}),n.add(b)}}}Array.from(u.attributes).forEach(m=>{const b=m.value,g=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(b.matchAll(g)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"rich",defaultValue:N,optional:!0,...O}),n.add(C[1])}});const v=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(b.matchAll(v)).forEach(C=>{if(C&&C[1]&&C[2]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[2]);e.push({fieldName:C[1],type:"rich",defaultValue:N,optional:!0,...O}),n.add(C[1])}});const T=new RegExp(pe.RICH_TEXT_FIELD_WITH_GROUP.source,pe.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(T)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"rich",defaultValue:N,...O}),n.add(C[1])}});const A=new RegExp(pe.RICH_TEXT_FIELD.source,pe.RICH_TEXT_FIELD.flags);Array.from(b.matchAll(A)).forEach(C=>{if(C&&C[1]&&C[2]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[2]);e.push({fieldName:C[1],type:"rich",defaultValue:N,...O}),n.add(C[1])}});const E=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(b.matchAll(E)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"image",defaultValue:N,optional:!0,...O}),n.add(C[1])}});const D=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(b.matchAll(D)).forEach(C=>{if(C&&C[1]&&C[2]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[2]);e.push({fieldName:C[1],type:"image",defaultValue:N,optional:!0,...O}),n.add(C[1])}});const z=new RegExp(pe.IMAGE_FIELD_WITH_GROUP.source,pe.IMAGE_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(z)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"image",defaultValue:N,...O}),n.add(C[1])}});const V=new RegExp(pe.IMAGE_FIELD.source,pe.IMAGE_FIELD.flags);Array.from(b.matchAll(V)).forEach(C=>{if(C&&C[1]&&C[2]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[2]);e.push({fieldName:C[1],type:"image",defaultValue:N,...O}),n.add(C[1])}});const L=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(b.matchAll(L)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"text",defaultValue:N,optional:!0,...O}),n.add(C[1])}});const Q=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(b.matchAll(Q)).forEach(C=>{if(C&&C[0]&&!/:rich(?::[^}]*)?\}$/.test(C[0])&&!/:image(?::[^}]*)?\}$/.test(C[0])&&!/:textarea(?::[^}]*)?\}$/.test(C[0])&&!C[0].includes(".")&&C[1]&&C[2]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[2]);e.push({fieldName:C[1],type:"text",defaultValue:N,optional:!0,...O}),n.add(C[1])}});const se=new RegExp(pe.TEXT_FIELD_WITH_GROUP.source,pe.TEXT_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(se)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[3]);e.push({fieldName:C[1],groupName:C[2],type:"text",defaultValue:N,...O}),n.add(C[1])}});const X=new RegExp(pe.TEXT_FIELD.source,pe.TEXT_FIELD.flags);Array.from(b.matchAll(X)).forEach(C=>{if(C&&C[0]&&!/:rich(?::[^}]*)?\}$/.test(C[0])&&!/:image(?::[^}]*)?\}$/.test(C[0])&&!/:textarea(?::[^}]*)?\}$/.test(C[0])&&!C[0].includes(".")&&C[1]&&C[2]&&!n.has(C[1])){const{defaultValue:N,validation:O}=ze(C[2]);e.push({fieldName:C[1],type:"text",defaultValue:N,...O}),n.add(C[1])}});const K=new RegExp(pe.SELECT_FIELD_WITH_GROUP.source,pe.SELECT_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(K)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const N=C[1],O=C[2],k=C[3];k.includes("|")?e.push({fieldName:N,groupName:O,type:"select",options:k.split("|")}):k.includes(",")&&e.push({fieldName:N,groupName:O,type:"select-multiple",options:k.split(",")}),n.add(N)}}),(b.match(pe.SELECT_FIELD)||[]).forEach(C=>{const N=C.match(/\(\$(\w+)@:([^)]+)\)/);if(N&&!n.has(N[1])){const O=N[1],k=N[2];k.includes("|")?e.push({fieldName:O,type:"select",options:k.split("|")}):k.includes(",")&&e.push({fieldName:O,type:"select-multiple",options:k.split(",")}),n.add(O)}});const Ee=new RegExp(pe.RADIO_CHECKBOX_FIELD_WITH_GROUP.source,pe.RADIO_CHECKBOX_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(Ee)).forEach(C=>{if(C&&C[1]&&C[2]&&C[3]&&!n.has(C[1])){const N=C[1],O=C[2],k=C[3];k.includes("|")?e.push({fieldName:N,groupName:O,type:"radio",options:k.split("|")}):k.includes(",")&&e.push({fieldName:N,groupName:O,type:"checkbox",options:k.split(",")}),n.add(N)}}),(b.match(pe.RADIO_FIELD)||[]).forEach(C=>{const N=C.match(/\(\$(\w+):([^)]+)\)/);if(N&&!n.has(N[1])){const O=N[1],k=N[2];k.includes("|")?e.push({fieldName:O,type:"radio",options:k.split("|")}):k.includes(",")&&e.push({fieldName:O,type:"checkbox",options:k.split(",")}),n.add(O)}})}),Array.from(d.childNodes).forEach(m=>l(m));return}else if(d.nodeType===Node.DOCUMENT_FRAGMENT_NODE){Array.from(d.childNodes).forEach(f=>l(f));return}};return Array.from(s.content.childNodes).forEach(d=>l(d)),e}function td(t,e){const n=ra(),i=new n().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template");if(!i||!i.content.firstElementChild)return console.warn("Failed to parse HTML:",t),t;const s=i.content.firstElementChild;return Object.entries(e).forEach(([l,c])=>{s.setAttribute(l,c)}),s.outerHTML}function di(t,e,n,o,r=[]){const i=[...n,...o,...r];if(t){const s=i.find(l=>l.id===t);if(s)return s.url}if(e){const s=i.find(l=>l.id===e);if(s)return console.warn(`Image not found: ${t}, using default: ${e}`),s.url}return console.warn(`Image not found: ${t}, default: ${e}`),""}function Og(t){return typeof t=="object"&&t!==null}function nd(t,e){if(!t||!e)return"";try{const n=[];let o="";for(let i=0;i<e.length;i++){const s=e[i];s==="["||s==="]"||s==="."?o&&(n.push(o),o=""):o+=s}o&&n.push(o);let r=t;for(let i=0;i<n.length;i++){const s=n[i];if(s.match(/^\d+$/)){const l=parseInt(s,10);if(Array.isArray(r)&&l>=0&&l<r.length)r=r[l];else return""}else if(Og(r)&&s in r)r=r[s];else return""}return r==null?"":String(r)}catch(n){return console.warn(`[ZeroCode] Failed to resolve backend data path: ${e}`,n),""}}function Dg(t,e){return!t||!e?t:t.replace(/\{(\w+)\}/g,(n,o)=>{const r=e[o];return r==null?n:String(r)})}function ui(t,e,n,o,r,i=!0,s=[],l=[],c=[],d){const u=ra(),f=new u,p=f.parseFromString(`<template>${t}</template>`,"text/html"),h=p.querySelector("template");if(!h||!h.content)return console.error("Failed to parse template HTML"),t;const m=y=>{if(y.nodeType===Node.TEXT_NODE){let E=y.textContent||"";d&&(E=E.replace(pe.BACKEND_DATA,(Z,X)=>nd(d,X)));let D=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(E),W=!1;if(D&&y.parentNode?W=!0:D=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(E),D&&y.parentNode){const Z=D[1],X=W?D[3]:D[2],{defaultValue:J}=ze(X),K=e[Z];if(typeof K=="boolean"){const N=y.parentNode,O=D.index||0,k=E.substring(0,O),U=E.substring(O+D[0].length);k&&N.insertBefore(p.createTextNode(k),y),U&&N.insertBefore(p.createTextNode(U),y),y.parentNode&&y.parentNode.removeChild(y);return}let Y=K===void 0?"":typeof K=="string"?K:String(K||J);i||(Y=ed(Y));const ce=y.parentNode,Ee=D.index||0,_e=E.substring(0,Ee),Le=E.substring(Ee+D[0].length);Y?Y.trim().startsWith("<p")||(Y=`<p>${Y}</p>`):Y="";const C=p.createElement("div");C.innerHTML=Y,_e&&ce.insertBefore(p.createTextNode(_e),y),Array.from(C.childNodes).forEach(N=>{ce.insertBefore(N.cloneNode(!0),y)}),Le&&ce.insertBefore(p.createTextNode(Le),y),y.parentNode&&y.parentNode.removeChild(y);return}let P=new RegExp(pe.RICH_TEXT_FIELD_WITH_GROUP.source,pe.RICH_TEXT_FIELD_WITH_GROUP.flags).exec(E),V=!1;if(P&&y.parentNode?V=!0:P=new RegExp(pe.RICH_TEXT_FIELD.source,pe.RICH_TEXT_FIELD.flags).exec(E),P&&y.parentNode){const Z=P[1],X=V?P[3]:P[2],J=e[Z];let K=J===void 0?"":typeof J=="string"?J:String(J||X);i||(K=ed(K));const Y=y.parentNode,ce=P.index||0,Ee=E.substring(0,ce),_e=E.substring(ce+P[0].length);K?K.trim().startsWith("<p")||(K=`<p>${K}</p>`):K="<p></p>";const Le=p.createElement("div");Le.innerHTML=K,Ee&&Y.insertBefore(p.createTextNode(Ee),y),Array.from(Le.childNodes).forEach(C=>{Y.insertBefore(C.cloneNode(!0),y)}),_e&&Y.insertBefore(p.createTextNode(_e),y),y.parentNode&&y.parentNode.removeChild(y);return}let L=/\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(E),H=!1;if(L&&y.parentNode?H=!0:L=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(E),L&&y.parentNode){const Z=L[1],X=H?L[3]:L[2],{defaultValue:J}=ze(X),K=e[Z],Y=K===void 0?"":String(K||J),ce=y.parentNode,Ee=L.index||0,_e=E.substring(0,Ee),Le=E.substring(Ee+L[0].length);_e&&ce.insertBefore(p.createTextNode(_e),y);const C=Y.split(`
339
- `);if(C.forEach((N,O)=>{N&&ce.insertBefore(p.createTextNode(N),y),O<C.length-1&&ce.insertBefore(p.createElement("br"),y)}),Le){const N=p.createTextNode(Le);ce.insertBefore(N,y),m(N)}y.parentNode&&y.parentNode.removeChild(y);return}let G=new RegExp(pe.TEXTAREA_FIELD_WITH_GROUP.source,pe.TEXTAREA_FIELD_WITH_GROUP.flags).exec(E),se=!1;if(G&&y.parentNode?se=!0:G=new RegExp(pe.TEXTAREA_FIELD.source,pe.TEXTAREA_FIELD.flags).exec(E),G&&y.parentNode){const Z=G[1],X=se?G[3]:G[2],J=e[Z]??X??"",K=String(J),Y=y.parentNode,ce=G.index||0,Ee=E.substring(0,ce),_e=E.substring(ce+G[0].length);Ee&&Y.insertBefore(p.createTextNode(Ee),y);const Le=K.split(`
340
- `);if(Le.forEach((C,N)=>{C&&Y.insertBefore(p.createTextNode(C),y),N<Le.length-1&&Y.insertBefore(p.createElement("br"),y)}),_e){const C=p.createTextNode(_e);Y.insertBefore(C,y),m(C)}y.parentNode&&y.parentNode.removeChild(y);return}E=E.replace(/\{\$(\w+)\?:([^}]+)\}/g,(Z,X,J)=>{if(/:textarea(?::[^}]*)?$/.test(Z))return Z;const K=e[X];if(K===void 0||typeof K=="boolean")return"";const{defaultValue:Y}=ze(J);return String(K||Y)}),E=E.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(Z,X,J,K)=>{if(/:textarea(?::[^}]*)?$/.test(Z))return Z;const Y=e[X];if(Y===void 0||typeof Y=="boolean")return"";const{defaultValue:ce}=ze(K);return String(Y||ce)}),E=E.replace(pe.TEXT_FIELD_WITH_GROUP,(Z,X,J,K)=>{const Y=e[X];if(Y===void 0)return"";const{defaultValue:ce}=ze(K);return String(Y||ce)}),E=E.replace(pe.TEXT_FIELD,(Z,X,J)=>{const K=e[X];if(K===void 0)return"";const{defaultValue:Y}=ze(J);return String(K||Y)}),y.textContent=E}else if(y.nodeType===Node.ELEMENT_NODE){const E=y,S=[];Array.from(E.attributes).forEach(D=>{const W=D.value;let z=D.value;const P=D.name.toLowerCase();if(P==="z-if"||P==="z-for"||P==="z-slot"||P==="z-empty"||P==="z-tag"||P.startsWith("data-zcode-"))return;const V=/^\{\$[\w.]+?\?:[^}]+\}(?::(rich|image|textarea))?$/.test(W.trim());d&&((P==="href"||P==="src"||P==="action")&&(z=Dg(z,d)),z=z.replace(pe.BACKEND_DATA,(j,L)=>{const H=nd(d,L);return P==="href"||P==="src"||P==="action"?Ct(H):it(H)})),z=z.replace(/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(j,L,H)=>{const Q=e[L];if(Q===void 0||typeof Q=="boolean")return"";const{defaultValue:G}=ze(H);return it(String(Q||G))}),z=z.replace(/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(j,L,H,Q)=>{const G=e[L];if(G===void 0||typeof G=="boolean")return"";const{defaultValue:se}=ze(Q);return it(String(G||se))}),z=z.replace(/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(j,L,H)=>{const Q=e[L];if(Q===void 0)return"";const{defaultValue:G}=ze(H),se=typeof Q=="string"?Q:String(Q||G),Z=di(se,G,s,l,c),X=typeof Z=="string"?Z:String(Z||G);return P==="href"||P==="src"?Ct(X):it(X)}),z=z.replace(/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(j,L,H,Q)=>{const G=e[L];if(G===void 0)return"";const{defaultValue:se}=ze(Q),Z=typeof G=="string"?G:String(G||se),X=di(Z,se,s,l,c),J=typeof X=="string"?X:String(X||se);return P==="href"||P==="src"?Ct(J):it(J)}),z=z.replace(pe.RICH_TEXT_FIELD_WITH_GROUP,(j,L,H,Q)=>{const G=e[L];return G===void 0?"":it(String(G||Q))}),z=z.replace(pe.RICH_TEXT_FIELD,(j,L,H)=>{const Q=e[L];return Q===void 0?"":it(String(Q||H))}),z=z.replace(pe.IMAGE_FIELD_WITH_GROUP,(j,L,H,Q)=>{const G=e[L];if(G===void 0)return"";const se=di(G||Q,Q,s,l,c);return P==="href"||P==="src"?Ct(se||Q):it(se||Q)}),z=z.replace(pe.IMAGE_FIELD,(j,L,H)=>{const Q=e[L];if(Q===void 0)return"";const G=di(Q||H,H,s,l,c);return P==="href"||P==="src"?Ct(G||H):it(G||H)}),z=z.replace(/\{\$(\w+)\?:([^}]+)\}/g,(j,L,H)=>{const Q=e[L];if(Q===void 0||typeof Q=="boolean")return"";const{defaultValue:G}=ze(H),se=String(Q||G);return P==="href"||P==="src"||P==="action"?Ct(se):it(se)}),z=z.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(j,L,H,Q)=>{const G=e[L];if(G===void 0||typeof G=="boolean")return"";const{defaultValue:se}=ze(Q),Z=String(G||se);return P==="href"||P==="src"||P==="action"?Ct(Z):it(Z)}),z=z.replace(pe.TEXT_FIELD_WITH_GROUP,(j,L,H,Q)=>{const G=e[L];if(G===void 0)return"";const{defaultValue:se}=ze(Q),Z=String(G||se);return P==="href"||P==="src"||P==="action"?Ct(Z):it(Z)}),z=z.replace(pe.TEXT_FIELD,(j,L,H)=>{const Q=e[L];if(Q===void 0)return"";const{defaultValue:G}=ze(H),se=String(Q||G);return P==="href"||P==="src"||P==="action"?Ct(se):it(se)}),V&&z.trim()===""?S.push(D.name):D.value=z}),S.forEach(D=>{E.removeAttribute(D)})}Array.from(y.childNodes).forEach(E=>m(E))};m(h.content);const b=y=>{if(y.nodeType===Node.TEXT_NODE){let E=y.textContent||"";E=E.replace(pe.SELECT_FIELD_WITH_GROUP,(S,D,W,z)=>{if(z.includes("|"))return e[D]||z.split("|")[0];if(z.includes(",")){const P=e[D],V=Array.isArray(P)?P:[],j=z.split(",");return V.filter(L=>typeof L=="string"&&j.includes(L)).join(" ")}return e[D]||z}),E=E.replace(pe.SELECT_FIELD,(S,D,W)=>{if(W.includes("|")){const P=e[D];return typeof P=="string"?P:W.split("|")[0]}else if(W.includes(",")){const P=e[D],V=Array.isArray(P)?P:[],j=W.split(",");return V.filter(L=>typeof L=="string"&&j.includes(L)).join(" ")}const z=e[D];return typeof z=="string"?z:W}),E=E.replace(pe.RADIO_CHECKBOX_FIELD_WITH_GROUP,(S,D,W,z)=>{if(z.includes("|")){const V=e[D];return typeof V=="string"?V:z.split("|")[0]}else if(z.includes(",")){const V=e[D],j=Array.isArray(V)?V:[],L=z.split(",");return j.filter(H=>typeof H=="string"&&L.includes(H)).join(" ")}const P=e[D];return typeof P=="string"?P:z}),E=E.replace(pe.RADIO_FIELD,(S,D,W)=>{if(W.includes("|")){const P=e[D];return typeof P=="string"?P:W.split("|")[0]}else if(W.includes(",")){const P=e[D],V=Array.isArray(P)?P:[],j=W.split(",");return V.filter(L=>typeof L=="string"&&j.includes(L)).join(" ")}const z=e[D];return typeof z=="string"?z:W}),y.textContent=E}else y.nodeType===Node.ELEMENT_NODE&&Array.from(y.attributes).forEach(S=>{let D=S.value;const W=S.name.toLowerCase();D=D.replace(pe.SELECT_FIELD_WITH_GROUP,(z,P,V,j)=>{let L;if(j.includes("|"))L=e[P]||j.split("|")[0];else if(j.includes(",")){const H=e[P],Q=Array.isArray(H)?H:[],G=j.split(",");L=Q.filter(se=>typeof se=="string"&&G.includes(se)).join(" ")}else{const H=e[P];L=typeof H=="string"?H:j}return W==="href"||W==="src"||W==="action"?Ct(String(L)):it(String(L))}),D=D.replace(pe.SELECT_FIELD,(z,P,V)=>{let j;if(V.includes("|"))j=e[P]||V.split("|")[0];else if(V.includes(",")){const L=e[P],H=Array.isArray(L)?L:[],Q=V.split(",");j=H.filter(G=>typeof G=="string"&&Q.includes(G)).join(" ")}else{const L=e[P];j=typeof L=="string"?L:V}return W==="href"||W==="src"||W==="action"?Ct(String(j)):it(String(j))}),D=D.replace(pe.RADIO_CHECKBOX_FIELD_WITH_GROUP,(z,P,V,j)=>{let L;if(j.includes("|"))L=e[P]||j.split("|")[0];else if(j.includes(",")){const H=e[P],Q=Array.isArray(H)?H:[],G=j.split(",");L=Q.filter(se=>typeof se=="string"&&G.includes(se)).join(" ")}else{const H=e[P];L=typeof H=="string"?H:j}return W==="href"||W==="src"||W==="action"?Ct(String(L)):it(String(L))}),D=D.replace(pe.RADIO_FIELD,(z,P,V)=>{let j;if(V.includes("|"))j=e[P]||V.split("|")[0];else if(V.includes(",")){const L=e[P],H=Array.isArray(L)?L:[],Q=V.split(",");j=H.filter(G=>typeof G=="string"&&Q.includes(G)).join(" ")}else{const L=e[P];j=typeof L=="string"?L:V}return W==="href"||W==="src"||W==="action"?Ct(String(j)):it(String(j))}),S.value=D});y.childNodes.forEach(E=>b(E))};b(h.content),h.content.querySelectorAll("[z-if]").forEach(y=>{const E=y.getAttribute("z-if");E?(e[E]!==void 0?e[E]:!0)?y.removeAttribute("z-if"):y.remove():y.removeAttribute("z-if")}),h.content.querySelectorAll("[z-tag]").forEach(y=>{const E=y.getAttribute("z-tag");if(E){const S=E.match(/^\$(\w+)(?::(.+))?$/);if(S){const D=S[1],W=e[D],z=typeof W=="string"?W:y.tagName.toLowerCase(),P=["h1","h2","h3","h4","h5","h6","div","p","span","li","ul","ol","section","article","aside","nav","header","footer","main","figure","figcaption","blockquote","pre","code","table","thead","tbody","tr","th","td"],V=typeof z=="string"?z.toLowerCase():z;if(typeof V=="string"&&P.includes(V)){const j=p.createElement(V);Array.from(y.attributes).forEach(L=>{L.name!=="z-tag"&&j.setAttribute(L.name,L.value)}),Array.from(y.childNodes).forEach(L=>{j.appendChild(L.cloneNode(!0))}),y.parentNode?.replaceChild(j,y)}}}}),h.content.querySelectorAll("[z-empty]").forEach(y=>{const E=y.getAttribute("z-empty");if(E){const S=E.match(/^\$(\w+)$/);if(S){const D=S[1],W=e[D];(P=>{if(P==null||P==="")return!0;if(typeof P=="string"){const V=P.trim();if(V===""||V==="<p></p>"||V==="<p> </p>"||/^<p>\s*<\/p>$/i.test(V)||/^<p>\s*<br\s*\/?>\s*<\/p>$/i.test(V))return!0}return!1})(W)?y.remove():y.removeAttribute("z-empty")}else y.removeAttribute("z-empty")}else y.removeAttribute("z-empty")});const w=()=>{Array.from(h.content.querySelectorAll("[z-for]")).forEach(E=>{const S=E.getAttribute("z-for");if(!S){E.removeAttribute("z-for");return}const D=S.match(/^(\w+)\s+in\s+(.+)$/);if(!D){console.warn(`[ZeroCode] Invalid z-for syntax: ${S}`),E.removeAttribute("z-for");return}const[,W,z]=D;if(!z.startsWith("{@")||!z.endsWith("}")){console.warn(`[ZeroCode] z-for only supports backend data: ${z}`),E.removeAttribute("z-for");return}const P=z.slice(2,-1);if(!d){E.remove();return}let V;try{const L=P.split(".");let H=d;for(const Q of L)if(H&&typeof H=="object"&&Q in H)H=H[Q];else{H=null;break}V=H}catch(L){console.warn(`[ZeroCode] Failed to resolve data source: ${P}`,L),E.remove();return}if(!Array.isArray(V)||V.length===0){E.remove();return}const j=document.createDocumentFragment();V.forEach(L=>{const H=E.cloneNode(!0);H.removeAttribute("z-for"),T(H,W,L,e,d),j.appendChild(H)}),E.parentNode&&E.parentNode.replaceChild(j,E)})},T=(y,E,S,D,W,z)=>{const P=j=>{if(j.nodeType===Node.TEXT_NODE){let L=j.textContent||"";const H=new RegExp(`\\{${E}\\.([\\w\\.\\[\\]]+)\\}`,"g");L=L.replace(H,(Q,G)=>{try{const se=G.split(/[.[\]]/).filter(X=>X);let Z=S;for(const X of se)if(X.match(/^\d+$/)){const J=parseInt(X,10);if(Array.isArray(Z)&&J>=0&&J<Z.length)Z=Z[J];else return""}else if(Z&&typeof Z=="object"&&X in Z)Z=Z[X];else return"";return Z==null?"":String(Z)}catch{return""}}),L=L.replace(new RegExp(`\\{${E}\\}`,"g"),()=>typeof S=="object"&&S!==null?JSON.stringify(S):String(S)),j.textContent=L}else if(j.nodeType===Node.ELEMENT_NODE){const L=j;Array.from(L.attributes).forEach(H=>{let Q=H.value;const G=new RegExp(`\\{${E}\\.([\\w\\.\\[\\]]+)\\}`,"g");Q=Q.replace(G,(se,Z)=>{try{const X=Z.split(/[.[\]]/).filter(Y=>Y);let J=S;for(const Y of X)if(Y.match(/^\d+$/)){const ce=parseInt(Y,10);if(Array.isArray(J)&&ce>=0&&ce<J.length)J=J[ce];else return""}else if(J&&typeof J=="object"&&Y in J)J=J[Y];else return"";const K=J==null?"":String(J);return H.name==="href"||H.name==="src"||H.name==="action"?Ct(K):it(K)}catch{return""}}),Q=Q.replace(new RegExp(`\\{${E}\\}`,"g"),()=>{const se=typeof S=="object"&&S!==null?JSON.stringify(S):String(S);return H.name==="href"||H.name==="src"||H.name==="action"?Ct(se):it(se)}),H.value=Q}),Array.from(L.childNodes).forEach(H=>P(H))}};Array.from(y.childNodes).forEach(j=>P(j));const V=y.innerHTML;if(V){const j=ui(V,D,n,o,r,i,s,l,c,W);y.innerHTML=j}};w();const M=y=>{y.forEach(E=>{const S=E.getAttribute("z-slot")||"default",D=e.slots?.[S];let W=[];if(Array.isArray(D)?W=D:D&&typeof D=="object"&&D.children&&(W=D.children||[]),W.length===0){E.removeAttribute("z-slot"),i?(E.setAttribute("data-zcode-empty-slot",S),E.setAttribute("data-zcode-slot-path",n?`${n}.slots.${S}`:`slots.${S}`),E.innerHTML=`<div class="zcode-empty-slot" data-zcode-empty-slot-content>
337
+ `}function Mo(t,e=!1){const n=t,o=t.querySelector("script[data-zcode-shadow-extension]");if(o)if(e){if(n.__zcmsEventListeners){const i=n.__zcmsEventListeners;i.forEach(function(s){s.forEach(function(l){t.removeEventListener(l.eventName,l.handler,!0)})}),i.clear()}o.remove(),n.__zcmsJQueryExtended&&delete n.__zcmsJQueryExtended,n.__zcmsNativeAPIExtended&&delete n.__zcmsNativeAPIExtended}else return;const r=document.createElement("script");r.setAttribute("data-zcode-shadow-extension","true"),r.textContent=lg(t),t.insertBefore(r,t.firstChild)}function cg(){if(typeof window>"u")return 20;try{let t=document.querySelector(".zcode-toolbar");if(!t){const n=document.querySelectorAll("zcode-cms, zcode-editor");for(const o of Array.from(n)){const r=o.shadowRoot;if(r){const i=r.querySelector(".zcode-toolbar");if(i){t=i;break}}}}if(!t)return 20;const e=t.getBoundingClientRect();return e.height>0?e.height:20}catch(t){return console.warn("Failed to get toolbar height:",t),20}}function ar(t,e=0){if(!(typeof window>"u"||!t))try{const n=t.getBoundingClientRect(),o=window.pageYOffset||document.documentElement.scrollTop,r=cg(),i=n.top+o-r-e;window.scrollTo({top:Math.max(0,i),behavior:"smooth"})}catch(n){console.warn("Failed to scroll to element:",n);try{const o=t.getBoundingClientRect(),r=window.pageYOffset||document.documentElement.scrollTop,i=o.top+r-20;window.scrollTo({top:Math.max(0,i),behavior:"smooth"})}catch(o){console.error("Scroll fallback also failed:",o)}}}const{entries:jc,setPrototypeOf:Uc,isFrozen:dg,getPrototypeOf:ug,getOwnPropertyDescriptor:fg}=Object;let{freeze:wt,seal:Ft,create:ia}=Object,{apply:sa,construct:aa}=typeof Reflect<"u"&&Reflect;wt||(wt=function(e){return e}),Ft||(Ft=function(e){return e}),sa||(sa=function(e,n){for(var o=arguments.length,r=new Array(o>2?o-2:0),i=2;i<o;i++)r[i-2]=arguments[i];return e.apply(n,r)}),aa||(aa=function(e){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return new e(...o)});const ai=Nt(Array.prototype.forEach),pg=Nt(Array.prototype.lastIndexOf),Hc=Nt(Array.prototype.pop),lr=Nt(Array.prototype.push),hg=Nt(Array.prototype.splice),li=Nt(String.prototype.toLowerCase),la=Nt(String.prototype.toString),ca=Nt(String.prototype.match),cr=Nt(String.prototype.replace),mg=Nt(String.prototype.indexOf),gg=Nt(String.prototype.trim),tn=Nt(Object.prototype.hasOwnProperty),St=Nt(RegExp.prototype.test),dr=bg(TypeError);function Nt(t){return function(e){e instanceof RegExp&&(e.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return sa(t,e,o)}}function bg(t){return function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return aa(t,n)}}function De(t,e){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:li;Uc&&Uc(t,null);let o=e.length;for(;o--;){let r=e[o];if(typeof r=="string"){const i=n(r);i!==r&&(dg(e)||(e[o]=i),r=i)}t[r]=!0}return t}function yg(t){for(let e=0;e<t.length;e++)tn(t,e)||(t[e]=null);return t}function cn(t){const e=ia(null);for(const[n,o]of jc(t))tn(t,n)&&(Array.isArray(o)?e[n]=yg(o):o&&typeof o=="object"&&o.constructor===Object?e[n]=cn(o):e[n]=o);return e}function ur(t,e){for(;t!==null;){const o=fg(t,e);if(o){if(o.get)return Nt(o.get);if(typeof o.value=="function")return Nt(o.value)}t=ug(t)}function n(){return null}return n}const Wc=wt(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),da=wt(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ua=wt(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),xg=wt(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),fa=wt(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Eg=wt(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Gc=wt(["#text"]),qc=wt(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),pa=wt(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),Kc=wt(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ci=wt(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),kg=Ft(/\{\{[\w\W]*|[\w\W]*\}\}/gm),wg=Ft(/<%[\w\W]*|[\w\W]*%>/gm),Sg=Ft(/\$\{[\w\W]*/gm),Ng=Ft(/^data-[\-\w.\u00B7-\uFFFF]+$/),Cg=Ft(/^aria-[\-\w]+$/),Jc=Ft(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),vg=Ft(/^(?:\w+script|data):/i),Tg=Ft(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Xc=Ft(/^html$/i),zg=Ft(/^[a-z][.\w]*(-[.\w]+)+$/i);var Yc=Object.freeze({__proto__:null,ARIA_ATTR:Cg,ATTR_WHITESPACE:Tg,CUSTOM_ELEMENT:zg,DATA_ATTR:Ng,DOCTYPE_NAME:Xc,ERB_EXPR:wg,IS_ALLOWED_URI:Jc,IS_SCRIPT_OR_DATA:vg,MUSTACHE_EXPR:kg,TMPLIT_EXPR:Sg});const fr={element:1,text:3,progressingInstruction:7,comment:8,document:9},_g=function(){return typeof window>"u"?null:window},Ag=function(e,n){if(typeof e!="object"||typeof e.createPolicy!="function")return null;let o=null;const r="data-tt-policy-suffix";n&&n.hasAttribute(r)&&(o=n.getAttribute(r));const i="dompurify"+(o?"#"+o:"");try{return e.createPolicy(i,{createHTML(s){return s},createScriptURL(s){return s}})}catch{return console.warn("TrustedTypes policy "+i+" could not be created."),null}},Qc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Zc(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:_g();const e=Ee=>Zc(Ee);if(e.version="3.3.1",e.removed=[],!t||!t.document||t.document.nodeType!==fr.document||!t.Element)return e.isSupported=!1,e;let{document:n}=t;const o=n,r=o.currentScript,{DocumentFragment:i,HTMLTemplateElement:s,Node:l,Element:c,NodeFilter:d,NamedNodeMap:u=t.NamedNodeMap||t.MozNamedAttrMap,HTMLFormElement:f,DOMParser:p,trustedTypes:h}=t,m=c.prototype,b=ur(m,"cloneNode"),g=ur(m,"remove"),x=ur(m,"nextSibling"),v=ur(m,"childNodes"),w=ur(m,"parentNode");if(typeof s=="function"){const Ee=n.createElement("template");Ee.content&&Ee.content.ownerDocument&&(n=Ee.content.ownerDocument)}let T,M="";const{implementation:A,createNodeIterator:y,createDocumentFragment:E,getElementsByTagName:k}=n,{importNode:O}=o;let G=Qc();e.isSupported=typeof jc=="function"&&typeof w=="function"&&A&&A.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:z,ERB_EXPR:R,TMPLIT_EXPR:W,DATA_ATTR:H,ARIA_ATTR:L,IS_SCRIPT_OR_DATA:j,ATTR_WHITESPACE:Z,CUSTOM_ELEMENT:K}=Yc;let{IS_ALLOWED_URI:ae}=Yc,ee=null;const X=De({},[...Wc,...da,...ua,...fa,...Gc]);let Y=null;const J=De({},[...qc,...pa,...Kc,...ci]);let Q=Object.seal(ia(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),de=null,ke=null;const Te=Object.seal(ia(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let $e=!0,N=!0,P=!1,V=!0,S=!1,C=!0,$=!1,te=!1,ge=!1,Re=!1,ve=!1,_=!1,I=!0,q=!1;const pe="user-content-";let Ae=!0,ze=!1,Se={},F=null;const ne=De({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let Me=null;const B=De({},["audio","video","img","source","image","track"]);let U=null;const ie=De({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),le="http://www.w3.org/1998/Math/MathML",we="http://www.w3.org/2000/svg",Fe="http://www.w3.org/1999/xhtml";let st=Fe,xn=!1,oi=null;const Tc=De({},[le,we,Fe],la);let Zo=De({},["mi","mo","mn","ms","mtext"]),er=De({},["annotation-xml"]);const zc=De({},["title","style","font","a","script"]);let Pn=null;const ri=["application/xhtml+xml","text/html"],Ln="text/html";let Ze=null,En=null;const Xs=n.createElement("form"),Ys=function(D){return D instanceof RegExp||D instanceof Function},tr=function(){let D=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(En&&En===D)){if((!D||typeof D!="object")&&(D={}),D=cn(D),Pn=ri.indexOf(D.PARSER_MEDIA_TYPE)===-1?Ln:D.PARSER_MEDIA_TYPE,Ze=Pn==="application/xhtml+xml"?la:li,ee=tn(D,"ALLOWED_TAGS")?De({},D.ALLOWED_TAGS,Ze):X,Y=tn(D,"ALLOWED_ATTR")?De({},D.ALLOWED_ATTR,Ze):J,oi=tn(D,"ALLOWED_NAMESPACES")?De({},D.ALLOWED_NAMESPACES,la):Tc,U=tn(D,"ADD_URI_SAFE_ATTR")?De(cn(ie),D.ADD_URI_SAFE_ATTR,Ze):ie,Me=tn(D,"ADD_DATA_URI_TAGS")?De(cn(B),D.ADD_DATA_URI_TAGS,Ze):B,F=tn(D,"FORBID_CONTENTS")?De({},D.FORBID_CONTENTS,Ze):ne,de=tn(D,"FORBID_TAGS")?De({},D.FORBID_TAGS,Ze):cn({}),ke=tn(D,"FORBID_ATTR")?De({},D.FORBID_ATTR,Ze):cn({}),Se=tn(D,"USE_PROFILES")?D.USE_PROFILES:!1,$e=D.ALLOW_ARIA_ATTR!==!1,N=D.ALLOW_DATA_ATTR!==!1,P=D.ALLOW_UNKNOWN_PROTOCOLS||!1,V=D.ALLOW_SELF_CLOSE_IN_ATTR!==!1,S=D.SAFE_FOR_TEMPLATES||!1,C=D.SAFE_FOR_XML!==!1,$=D.WHOLE_DOCUMENT||!1,Re=D.RETURN_DOM||!1,ve=D.RETURN_DOM_FRAGMENT||!1,_=D.RETURN_TRUSTED_TYPE||!1,ge=D.FORCE_BODY||!1,I=D.SANITIZE_DOM!==!1,q=D.SANITIZE_NAMED_PROPS||!1,Ae=D.KEEP_CONTENT!==!1,ze=D.IN_PLACE||!1,ae=D.ALLOWED_URI_REGEXP||Jc,st=D.NAMESPACE||Fe,Zo=D.MATHML_TEXT_INTEGRATION_POINTS||Zo,er=D.HTML_INTEGRATION_POINTS||er,Q=D.CUSTOM_ELEMENT_HANDLING||{},D.CUSTOM_ELEMENT_HANDLING&&Ys(D.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(Q.tagNameCheck=D.CUSTOM_ELEMENT_HANDLING.tagNameCheck),D.CUSTOM_ELEMENT_HANDLING&&Ys(D.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(Q.attributeNameCheck=D.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),D.CUSTOM_ELEMENT_HANDLING&&typeof D.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(Q.allowCustomizedBuiltInElements=D.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),S&&(N=!1),ve&&(Re=!0),Se&&(ee=De({},Gc),Y=[],Se.html===!0&&(De(ee,Wc),De(Y,qc)),Se.svg===!0&&(De(ee,da),De(Y,pa),De(Y,ci)),Se.svgFilters===!0&&(De(ee,ua),De(Y,pa),De(Y,ci)),Se.mathMl===!0&&(De(ee,fa),De(Y,Kc),De(Y,ci))),D.ADD_TAGS&&(typeof D.ADD_TAGS=="function"?Te.tagCheck=D.ADD_TAGS:(ee===X&&(ee=cn(ee)),De(ee,D.ADD_TAGS,Ze))),D.ADD_ATTR&&(typeof D.ADD_ATTR=="function"?Te.attributeCheck=D.ADD_ATTR:(Y===J&&(Y=cn(Y)),De(Y,D.ADD_ATTR,Ze))),D.ADD_URI_SAFE_ATTR&&De(U,D.ADD_URI_SAFE_ATTR,Ze),D.FORBID_CONTENTS&&(F===ne&&(F=cn(F)),De(F,D.FORBID_CONTENTS,Ze)),D.ADD_FORBID_CONTENTS&&(F===ne&&(F=cn(F)),De(F,D.ADD_FORBID_CONTENTS,Ze)),Ae&&(ee["#text"]=!0),$&&De(ee,["html","head","body"]),ee.table&&(De(ee,["tbody"]),delete de.tbody),D.TRUSTED_TYPES_POLICY){if(typeof D.TRUSTED_TYPES_POLICY.createHTML!="function")throw dr('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof D.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw dr('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');T=D.TRUSTED_TYPES_POLICY,M=T.createHTML("")}else T===void 0&&(T=Ag(h,r)),T!==null&&typeof M=="string"&&(M=T.createHTML(""));wt&&wt(D),En=D}},Qs=De({},[...da,...ua,...xg]),Zs=De({},[...fa,...Eg]),ea=function(D){let se=w(D);(!se||!se.tagName)&&(se={namespaceURI:st,tagName:"template"});const be=li(D.tagName),Xe=li(se.tagName);return oi[D.namespaceURI]?D.namespaceURI===we?se.namespaceURI===Fe?be==="svg":se.namespaceURI===le?be==="svg"&&(Xe==="annotation-xml"||Zo[Xe]):!!Qs[be]:D.namespaceURI===le?se.namespaceURI===Fe?be==="math":se.namespaceURI===we?be==="math"&&er[Xe]:!!Zs[be]:D.namespaceURI===Fe?se.namespaceURI===we&&!er[Xe]||se.namespaceURI===le&&!Zo[Xe]?!1:!Zs[be]&&(zc[be]||!Qs[be]):!!(Pn==="application/xhtml+xml"&&oi[D.namespaceURI]):!1},Zt=function(D){lr(e.removed,{element:D});try{w(D).removeChild(D)}catch{g(D)}},kn=function(D,se){try{lr(e.removed,{attribute:se.getAttributeNode(D),from:se})}catch{lr(e.removed,{attribute:null,from:se})}if(se.removeAttribute(D),D==="is")if(Re||ve)try{Zt(se)}catch{}else try{se.setAttribute(D,"")}catch{}},ta=function(D){let se=null,be=null;if(ge)D="<remove></remove>"+D;else{const rt=ca(D,/^[\r\n\t ]+/);be=rt&&rt[0]}Pn==="application/xhtml+xml"&&st===Fe&&(D='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+D+"</body></html>");const Xe=T?T.createHTML(D):D;if(st===Fe)try{se=new p().parseFromString(Xe,Pn)}catch{}if(!se||!se.documentElement){se=A.createDocument(st,"template",null);try{se.documentElement.innerHTML=xn?M:Xe}catch{}}const kt=se.body||se.documentElement;return D&&be&&kt.insertBefore(n.createTextNode(be),kt.childNodes[0]||null),st===Fe?k.call(se,$?"html":"body")[0]:$?se.documentElement:kt},ii=function(D){return y.call(D.ownerDocument||D,D,d.SHOW_ELEMENT|d.SHOW_COMMENT|d.SHOW_TEXT|d.SHOW_PROCESSING_INSTRUCTION|d.SHOW_CDATA_SECTION,null)},ce=function(D){return D instanceof f&&(typeof D.nodeName!="string"||typeof D.textContent!="string"||typeof D.removeChild!="function"||!(D.attributes instanceof u)||typeof D.removeAttribute!="function"||typeof D.setAttribute!="function"||typeof D.namespaceURI!="string"||typeof D.insertBefore!="function"||typeof D.hasChildNodes!="function")},ue=function(D){return typeof l=="function"&&D instanceof l};function ye(Ee,D,se){ai(Ee,be=>{be.call(e,D,se,En)})}const Ge=function(D){let se=null;if(ye(G.beforeSanitizeElements,D,null),ce(D))return Zt(D),!0;const be=Ze(D.nodeName);if(ye(G.uponSanitizeElement,D,{tagName:be,allowedTags:ee}),C&&D.hasChildNodes()&&!ue(D.firstElementChild)&&St(/<[/\w!]/g,D.innerHTML)&&St(/<[/\w!]/g,D.textContent)||D.nodeType===fr.progressingInstruction||C&&D.nodeType===fr.comment&&St(/<[/\w]/g,D.data))return Zt(D),!0;if(!(Te.tagCheck instanceof Function&&Te.tagCheck(be))&&(!ee[be]||de[be])){if(!de[be]&&At(be)&&(Q.tagNameCheck instanceof RegExp&&St(Q.tagNameCheck,be)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(be)))return!1;if(Ae&&!F[be]){const Xe=w(D)||D.parentNode,kt=v(D)||D.childNodes;if(kt&&Xe){const rt=kt.length;for(let Lt=rt-1;Lt>=0;--Lt){const $n=b(kt[Lt],!0);$n.__removalCount=(D.__removalCount||0)+1,Xe.insertBefore($n,x(D))}}}return Zt(D),!0}return D instanceof c&&!ea(D)||(be==="noscript"||be==="noembed"||be==="noframes")&&St(/<\/no(script|embed|frames)/i,D.innerHTML)?(Zt(D),!0):(S&&D.nodeType===fr.text&&(se=D.textContent,ai([z,R,W],Xe=>{se=cr(se,Xe," ")}),D.textContent!==se&&(lr(e.removed,{element:D.cloneNode()}),D.textContent=se)),ye(G.afterSanitizeElements,D,null),!1)},et=function(D,se,be){if(I&&(se==="id"||se==="name")&&(be in n||be in Xs))return!1;if(!(N&&!ke[se]&&St(H,se))){if(!($e&&St(L,se))){if(!(Te.attributeCheck instanceof Function&&Te.attributeCheck(se,D))){if(!Y[se]||ke[se]){if(!(At(D)&&(Q.tagNameCheck instanceof RegExp&&St(Q.tagNameCheck,D)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(D))&&(Q.attributeNameCheck instanceof RegExp&&St(Q.attributeNameCheck,se)||Q.attributeNameCheck instanceof Function&&Q.attributeNameCheck(se,D))||se==="is"&&Q.allowCustomizedBuiltInElements&&(Q.tagNameCheck instanceof RegExp&&St(Q.tagNameCheck,be)||Q.tagNameCheck instanceof Function&&Q.tagNameCheck(be))))return!1}else if(!U[se]){if(!St(ae,cr(be,Z,""))){if(!((se==="src"||se==="xlink:href"||se==="href")&&D!=="script"&&mg(be,"data:")===0&&Me[D])){if(!(P&&!St(j,cr(be,Z,"")))){if(be)return!1}}}}}}}return!0},At=function(D){return D!=="annotation-xml"&&ca(D,K)},Lm=function(D){ye(G.beforeSanitizeAttributes,D,null);const{attributes:se}=D;if(!se||ce(D))return;const be={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:Y,forceKeepAttr:void 0};let Xe=se.length;for(;Xe--;){const kt=se[Xe],{name:rt,namespaceURI:Lt,value:$n}=kt,nr=Ze(rt),_c=$n;let bt=rt==="value"?_c:gg(_c);if(be.attrName=nr,be.attrValue=bt,be.keepAttr=!0,be.forceKeepAttr=void 0,ye(G.uponSanitizeAttribute,D,be),bt=be.attrValue,q&&(nr==="id"||nr==="name")&&(kn(rt,D),bt=pe+bt),C&&St(/((--!?|])>)|<\/(style|title|textarea)/i,bt)){kn(rt,D);continue}if(nr==="attributename"&&ca(bt,"href")){kn(rt,D);continue}if(be.forceKeepAttr)continue;if(!be.keepAttr){kn(rt,D);continue}if(!V&&St(/\/>/i,bt)){kn(rt,D);continue}S&&ai([z,R,W],Vm=>{bt=cr(bt,Vm," ")});const $m=Ze(D.nodeName);if(!et($m,nr,bt)){kn(rt,D);continue}if(T&&typeof h=="object"&&typeof h.getAttributeType=="function"&&!Lt)switch(h.getAttributeType($m,nr)){case"TrustedHTML":{bt=T.createHTML(bt);break}case"TrustedScriptURL":{bt=T.createScriptURL(bt);break}}if(bt!==_c)try{Lt?D.setAttributeNS(Lt,rt,bt):D.setAttribute(rt,bt),ce(D)?Zt(D):Hc(e.removed)}catch{kn(rt,D)}}ye(G.afterSanitizeAttributes,D,null)},yM=function Ee(D){let se=null;const be=ii(D);for(ye(G.beforeSanitizeShadowDOM,D,null);se=be.nextNode();)ye(G.uponSanitizeShadowNode,se,null),Ge(se),Lm(se),se.content instanceof i&&Ee(se.content);ye(G.afterSanitizeShadowDOM,D,null)};return e.sanitize=function(Ee){let D=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},se=null,be=null,Xe=null,kt=null;if(xn=!Ee,xn&&(Ee="<!-->"),typeof Ee!="string"&&!ue(Ee))if(typeof Ee.toString=="function"){if(Ee=Ee.toString(),typeof Ee!="string")throw dr("dirty is not a string, aborting")}else throw dr("toString is not a function");if(!e.isSupported)return Ee;if(te||tr(D),e.removed=[],typeof Ee=="string"&&(ze=!1),ze){if(Ee.nodeName){const $n=Ze(Ee.nodeName);if(!ee[$n]||de[$n])throw dr("root node is forbidden and cannot be sanitized in-place")}}else if(Ee instanceof l)se=ta("<!---->"),be=se.ownerDocument.importNode(Ee,!0),be.nodeType===fr.element&&be.nodeName==="BODY"||be.nodeName==="HTML"?se=be:se.appendChild(be);else{if(!Re&&!S&&!$&&Ee.indexOf("<")===-1)return T&&_?T.createHTML(Ee):Ee;if(se=ta(Ee),!se)return Re?null:_?M:""}se&&ge&&Zt(se.firstChild);const rt=ii(ze?Ee:se);for(;Xe=rt.nextNode();)Ge(Xe),Lm(Xe),Xe.content instanceof i&&yM(Xe.content);if(ze)return Ee;if(Re){if(ve)for(kt=E.call(se.ownerDocument);se.firstChild;)kt.appendChild(se.firstChild);else kt=se;return(Y.shadowroot||Y.shadowrootmode)&&(kt=O.call(o,kt,!0)),kt}let Lt=$?se.outerHTML:se.innerHTML;return $&&ee["!doctype"]&&se.ownerDocument&&se.ownerDocument.doctype&&se.ownerDocument.doctype.name&&St(Xc,se.ownerDocument.doctype.name)&&(Lt="<!DOCTYPE "+se.ownerDocument.doctype.name+`>
338
+ `+Lt),S&&ai([z,R,W],$n=>{Lt=cr(Lt,$n," ")}),T&&_?T.createHTML(Lt):Lt},e.setConfig=function(){let Ee=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tr(Ee),te=!0},e.clearConfig=function(){En=null,te=!1},e.isValidAttribute=function(Ee,D,se){En||tr({});const be=Ze(Ee),Xe=Ze(D);return et(be,Xe,se)},e.addHook=function(Ee,D){typeof D=="function"&&lr(G[Ee],D)},e.removeHook=function(Ee,D){if(D!==void 0){const se=pg(G[Ee],D);return se===-1?void 0:hg(G[Ee],se,1)[0]}return Hc(G[Ee])},e.removeHooks=function(Ee){G[Ee]=[]},e.removeAllHooks=function(){G=Qc()},e}var Mg=Zc();function ed(t){return Mg.sanitize(t,{ALLOWED_TAGS:["p","br","strong","em","s","u","ul","ol","li","a","hr"],ALLOWED_ATTR:["href","target","rel"],ALLOW_DATA_ATTR:!1,FORBID_TAGS:["script","iframe","object","embed","form","input","button","style"],FORBID_ATTR:["onerror","onload","onclick","onmouseover","onfocus","onblur"]})}function it(t){return typeof t!="string"?"":t.replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#x27;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Ct(t){if(!t||typeof t!="string")return"";const e=t.trim(),n=e.toLowerCase();return n.startsWith("javascript:")||n.startsWith("vbscript:")||n.startsWith("file:")?"":n.startsWith("data:")?n.startsWith("data:image/")?e:"":e}const he={TEXT_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):([^}]+)\}/g,TEXT_FIELD:/\{\$(\w+):([^}]+)\}/g,RICH_TEXT_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):rich(?::[^}]+)?\}/g,RICH_TEXT_FIELD:/\{\$(\w+):(.+?):rich(?::[^}]+)?\}/g,TEXTAREA_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):textarea(?::[^}]+)?\}/g,TEXTAREA_FIELD:/\{\$(\w+):(.+?):textarea(?::[^}]+)?\}/g,IMAGE_FIELD_WITH_GROUP:/\{\$(\w+)\.(\w+):(.+?):image(?::[^}]+)?\}/g,IMAGE_FIELD:/\{\$(\w+):(.+?):image(?::[^}]+)?\}/g,SELECT_FIELD_WITH_GROUP:/\(\$(\w+)\.(\w+)@:([^)]+)\)/g,SELECT_FIELD:/\(\$(\w+)@:([^)]+)\)/g,RADIO_CHECKBOX_FIELD_WITH_GROUP:/\(\$(\w+)\.(\w+):([^)]+)\)/g,RADIO_FIELD:/\(\$(\w+):([^)]+)\)/g,BACKEND_DATA:/\{@([\w.[\]]+)\}/g};function Ig(t){const e={};for(const n of t){if(n==="required"){e.required=!0;continue}if(n==="readonly"){e.readonly=!0;continue}if(n==="disabled"){e.disabled=!0;continue}if(n.startsWith("max=")){const o=Number(n.slice(4));Number.isFinite(o)&&(e.maxLength=o)}}return e}function _e(t){const e=t.split(":"),n=[],o=r=>r==="required"||r==="readonly"||r==="disabled"||/^max=\d+$/.test(r);for(;e.length>0&&o(e[e.length-1]);)n.unshift(e.pop());return{defaultValue:e.join(":"),validation:Ig(n)}}function Fn(t){const e=[],n=new Set,o=ra(),s=new o().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template");if(!s)return e;const l=d=>{if(d.nodeType===Node.TEXT_NODE){const u=d.textContent||"",f=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(u.matchAll(f)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]){const C=S[1],$=S[2];if(!n.has(C)){const{defaultValue:te,validation:ge}=_e(S[3]);e.push({fieldName:C,groupName:$,type:"rich",defaultValue:te,optional:!0,...ge}),n.add(C)}}});const h=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(u.matchAll(h)).forEach(S=>{if(S&&S[1]&&S[2]){const C=S[1];if(!n.has(C)){const{defaultValue:$,validation:te}=_e(S[2]);e.push({fieldName:C,type:"rich",defaultValue:$,optional:!0,...te}),n.add(C)}}});const b=new RegExp(he.RICH_TEXT_FIELD_WITH_GROUP.source,he.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(b)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]){const C=S[1],$=S[2];if(!n.has(C)){const{defaultValue:te,validation:ge}=_e(S[3]);e.push({fieldName:C,groupName:$,type:"rich",defaultValue:te,...ge}),n.add(C)}}});const x=new RegExp(he.RICH_TEXT_FIELD.source,he.RICH_TEXT_FIELD.flags);Array.from(u.matchAll(x)).forEach(S=>{if(S&&S[1]&&S[2]){const C=S[1];if(!n.has(C)){const{defaultValue:$,validation:te}=_e(S[2]);e.push({fieldName:C,type:"rich",defaultValue:$,...te}),n.add(C)}}});const w=/\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/g;Array.from(u.matchAll(w)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"textarea",defaultValue:C,optional:!0,...$}),n.add(S[1])}});const M=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/g;Array.from(u.matchAll(M)).forEach(S=>{if(S&&S[1]&&S[2]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[2]);e.push({fieldName:S[1],type:"textarea",defaultValue:C,optional:!0,...$}),n.add(S[1])}});const y=new RegExp(he.TEXTAREA_FIELD_WITH_GROUP.source,he.TEXTAREA_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(y)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"textarea",defaultValue:C,...$}),n.add(S[1])}});const k=new RegExp(he.TEXTAREA_FIELD.source,he.TEXTAREA_FIELD.flags);Array.from(u.matchAll(k)).forEach(S=>{if(S&&S[1]&&S[2]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[2]);e.push({fieldName:S[1],type:"textarea",defaultValue:C,...$}),n.add(S[1])}});const G=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll(G)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"image",defaultValue:C,optional:!0,...$}),n.add(S[1])}});const R=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(u.matchAll(R)).forEach(S=>{if(S&&S[1]&&S[2]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[2]);e.push({fieldName:S[1],type:"image",defaultValue:C,optional:!0,...$}),n.add(S[1])}});const H=new RegExp(he.IMAGE_FIELD_WITH_GROUP.source,he.IMAGE_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(H)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"image",defaultValue:C,...$}),n.add(S[1])}});const j=new RegExp(he.IMAGE_FIELD.source,he.IMAGE_FIELD.flags);Array.from(u.matchAll(j)).forEach(S=>{if(S&&S[1]&&S[2]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[2]);e.push({fieldName:S[1],type:"image",defaultValue:C,...$}),n.add(S[1])}});const K=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(K)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"text",defaultValue:C,optional:!0,...$}),n.add(S[1])}});const ee=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(u.matchAll(ee)).forEach(S=>{if(S&&S[0]&&!/:rich(?::[^}]*)?\}$/.test(S[0])&&!/:image(?::[^}]*)?\}$/.test(S[0])&&!/:textarea(?::[^}]*)?\}$/.test(S[0])&&!S[0].includes(".")&&S[1]&&S[2]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[2]);e.push({fieldName:S[1],type:"text",defaultValue:C,optional:!0,...$}),n.add(S[1])}});const Y=new RegExp(he.TEXT_FIELD_WITH_GROUP.source,he.TEXT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(Y)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[3]);e.push({fieldName:S[1],groupName:S[2],type:"text",defaultValue:C,...$}),n.add(S[1])}});const Q=new RegExp(he.TEXT_FIELD.source,he.TEXT_FIELD.flags);Array.from(u.matchAll(Q)).forEach(S=>{if(S&&S[0]&&!/:rich(?::[^}]*)?\}$/.test(S[0])&&!/:image(?::[^}]*)?\}$/.test(S[0])&&!/:textarea(?::[^}]*)?\}$/.test(S[0])&&!S[0].includes(".")&&S[1]&&S[2]&&!n.has(S[1])){const{defaultValue:C,validation:$}=_e(S[2]);e.push({fieldName:S[1],type:"text",defaultValue:C,...$}),n.add(S[1])}});const ke=new RegExp(he.SELECT_FIELD_WITH_GROUP.source,he.SELECT_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(ke)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!n.has(S[1])){const C=S[1],$=S[2],te=S[3];te.includes("|")?e.push({fieldName:C,groupName:$,type:"select",options:te.split("|")}):te.includes(",")&&e.push({fieldName:C,groupName:$,type:"select-multiple",options:te.split(",")}),n.add(C)}}),(u.match(he.SELECT_FIELD)||[]).forEach(S=>{const C=S.match(/\(\$(\w+)@:([^)]+)\)/);if(C&&!n.has(C[1])){const $=C[1],te=C[2];te.includes("|")?e.push({fieldName:$,type:"select",options:te.split("|")}):te.includes(",")&&e.push({fieldName:$,type:"select-multiple",options:te.split(",")}),n.add($)}});const N=new RegExp(he.RADIO_CHECKBOX_FIELD_WITH_GROUP.source,he.RADIO_CHECKBOX_FIELD_WITH_GROUP.flags);Array.from(u.matchAll(N)).forEach(S=>{if(S&&S[1]&&S[2]&&S[3]&&!n.has(S[1])){const C=S[1],$=S[2],te=S[3];te.includes("|")?e.push({fieldName:C,groupName:$,type:"radio",options:te.split("|")}):te.includes(",")&&e.push({fieldName:C,groupName:$,type:"checkbox",options:te.split(",")}),n.add(C)}}),(u.match(he.RADIO_FIELD)||[]).forEach(S=>{const C=S.match(/\(\$(\w+):([^)]+)\)/);if(C&&!n.has(C[1])){const $=C[1],te=C[2];te.includes("|")?e.push({fieldName:$,type:"radio",options:te.split("|")}):te.includes(",")&&e.push({fieldName:$,type:"checkbox",options:te.split(",")}),n.add($)}});return}else if(d.nodeType===Node.ELEMENT_NODE){const u=d,f=u.getAttribute("z-if");f&&!n.has(f)&&(e.push({fieldName:f,type:"boolean",defaultValue:"true"}),n.add(f));const p=u.getAttribute("z-tag");if(p){const m=p.match(/^\$(\w+)(?::(.+))?$/);if(m){const b=m[1],g=m[2];if(!n.has(b)){const x=g?g.split("|").map(T=>T.trim()):void 0,v=u.tagName.toLowerCase();let w=v;x&&!x.includes(v)&&(typeof process<"u"&&process.env?.NODE_ENV==="development"&&console.warn(`[ZeroCode] z-tag="${p}": 現在のタグ名 "${v}" が選択肢に含まれていません。デフォルト値として "${x[0]}" を使用します。`),w=x[0]),e.push({fieldName:b,type:"tag",defaultValue:w,options:x,optional:!1}),n.add(b)}}}Array.from(u.attributes).forEach(m=>{const b=m.value,g=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(b.matchAll(g)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"rich",defaultValue:P,optional:!0,...V}),n.add(N[1])}});const v=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g;Array.from(b.matchAll(v)).forEach(N=>{if(N&&N[1]&&N[2]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[2]);e.push({fieldName:N[1],type:"rich",defaultValue:P,optional:!0,...V}),n.add(N[1])}});const T=new RegExp(he.RICH_TEXT_FIELD_WITH_GROUP.source,he.RICH_TEXT_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(T)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"rich",defaultValue:P,...V}),n.add(N[1])}});const A=new RegExp(he.RICH_TEXT_FIELD.source,he.RICH_TEXT_FIELD.flags);Array.from(b.matchAll(A)).forEach(N=>{if(N&&N[1]&&N[2]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[2]);e.push({fieldName:N[1],type:"rich",defaultValue:P,...V}),n.add(N[1])}});const E=/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(b.matchAll(E)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"image",defaultValue:P,optional:!0,...V}),n.add(N[1])}});const O=/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g;Array.from(b.matchAll(O)).forEach(N=>{if(N&&N[1]&&N[2]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[2]);e.push({fieldName:N[1],type:"image",defaultValue:P,optional:!0,...V}),n.add(N[1])}});const z=new RegExp(he.IMAGE_FIELD_WITH_GROUP.source,he.IMAGE_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(z)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"image",defaultValue:P,...V}),n.add(N[1])}});const W=new RegExp(he.IMAGE_FIELD.source,he.IMAGE_FIELD.flags);Array.from(b.matchAll(W)).forEach(N=>{if(N&&N[1]&&N[2]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[2]);e.push({fieldName:N[1],type:"image",defaultValue:P,...V}),n.add(N[1])}});const L=/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g;Array.from(b.matchAll(L)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"text",defaultValue:P,optional:!0,...V}),n.add(N[1])}});const Z=/\{\$(\w+)\?:([^}]+)\}/g;Array.from(b.matchAll(Z)).forEach(N=>{if(N&&N[0]&&!/:rich(?::[^}]*)?\}$/.test(N[0])&&!/:image(?::[^}]*)?\}$/.test(N[0])&&!/:textarea(?::[^}]*)?\}$/.test(N[0])&&!N[0].includes(".")&&N[1]&&N[2]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[2]);e.push({fieldName:N[1],type:"text",defaultValue:P,optional:!0,...V}),n.add(N[1])}});const ae=new RegExp(he.TEXT_FIELD_WITH_GROUP.source,he.TEXT_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(ae)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[3]);e.push({fieldName:N[1],groupName:N[2],type:"text",defaultValue:P,...V}),n.add(N[1])}});const X=new RegExp(he.TEXT_FIELD.source,he.TEXT_FIELD.flags);Array.from(b.matchAll(X)).forEach(N=>{if(N&&N[0]&&!/:rich(?::[^}]*)?\}$/.test(N[0])&&!/:image(?::[^}]*)?\}$/.test(N[0])&&!/:textarea(?::[^}]*)?\}$/.test(N[0])&&!N[0].includes(".")&&N[1]&&N[2]&&!n.has(N[1])){const{defaultValue:P,validation:V}=_e(N[2]);e.push({fieldName:N[1],type:"text",defaultValue:P,...V}),n.add(N[1])}});const J=new RegExp(he.SELECT_FIELD_WITH_GROUP.source,he.SELECT_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(J)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!n.has(N[1])){const P=N[1],V=N[2],S=N[3];S.includes("|")?e.push({fieldName:P,groupName:V,type:"select",options:S.split("|")}):S.includes(",")&&e.push({fieldName:P,groupName:V,type:"select-multiple",options:S.split(",")}),n.add(P)}}),(b.match(he.SELECT_FIELD)||[]).forEach(N=>{const P=N.match(/\(\$(\w+)@:([^)]+)\)/);if(P&&!n.has(P[1])){const V=P[1],S=P[2];S.includes("|")?e.push({fieldName:V,type:"select",options:S.split("|")}):S.includes(",")&&e.push({fieldName:V,type:"select-multiple",options:S.split(",")}),n.add(V)}});const ke=new RegExp(he.RADIO_CHECKBOX_FIELD_WITH_GROUP.source,he.RADIO_CHECKBOX_FIELD_WITH_GROUP.flags);Array.from(b.matchAll(ke)).forEach(N=>{if(N&&N[1]&&N[2]&&N[3]&&!n.has(N[1])){const P=N[1],V=N[2],S=N[3];S.includes("|")?e.push({fieldName:P,groupName:V,type:"radio",options:S.split("|")}):S.includes(",")&&e.push({fieldName:P,groupName:V,type:"checkbox",options:S.split(",")}),n.add(P)}}),(b.match(he.RADIO_FIELD)||[]).forEach(N=>{const P=N.match(/\(\$(\w+):([^)]+)\)/);if(P&&!n.has(P[1])){const V=P[1],S=P[2];S.includes("|")?e.push({fieldName:V,type:"radio",options:S.split("|")}):S.includes(",")&&e.push({fieldName:V,type:"checkbox",options:S.split(",")}),n.add(V)}})}),Array.from(d.childNodes).forEach(m=>l(m));return}else if(d.nodeType===Node.DOCUMENT_FRAGMENT_NODE){Array.from(d.childNodes).forEach(f=>l(f));return}};return Array.from(s.content.childNodes).forEach(d=>l(d)),e}function td(t,e){const n=ra(),i=new n().parseFromString(`<template>${t}</template>`,"text/html").querySelector("template");if(!i||!i.content.firstElementChild)return console.warn("Failed to parse HTML:",t),t;const s=i.content.firstElementChild;return Object.entries(e).forEach(([l,c])=>{s.setAttribute(l,c)}),s.outerHTML}function di(t,e,n,o,r=[]){const i=[...n,...o,...r];if(t){const s=i.find(l=>l.id===t);if(s)return s.url}if(e){const s=i.find(l=>l.id===e);if(s)return console.warn(`Image not found: ${t}, using default: ${e}`),s.url}return console.warn(`Image not found: ${t}, default: ${e}`),""}function Og(t){return typeof t=="object"&&t!==null}function nd(t,e){if(!t||!e)return"";try{const n=[];let o="";for(let i=0;i<e.length;i++){const s=e[i];s==="["||s==="]"||s==="."?o&&(n.push(o),o=""):o+=s}o&&n.push(o);let r=t;for(let i=0;i<n.length;i++){const s=n[i];if(s.match(/^\d+$/)){const l=parseInt(s,10);if(Array.isArray(r)&&l>=0&&l<r.length)r=r[l];else return""}else if(Og(r)&&s in r)r=r[s];else return""}return r==null?"":String(r)}catch(n){return console.warn(`[ZeroCode] Failed to resolve backend data path: ${e}`,n),""}}function Dg(t,e){return!t||!e?t:t.replace(/\{(\w+)\}/g,(n,o)=>{const r=e[o];return r==null?n:String(r)})}function ui(t,e,n,o,r,i=!0,s=[],l=[],c=[],d){const u=ra(),f=new u,p=f.parseFromString(`<template>${t}</template>`,"text/html"),h=p.querySelector("template");if(!h||!h.content)return console.error("Failed to parse template HTML"),t;const m=y=>{if(y.nodeType===Node.TEXT_NODE){let E=y.textContent||"";d&&(E=E.replace(he.BACKEND_DATA,(ee,X)=>nd(d,X)));let O=/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(E),G=!1;if(O&&y.parentNode?G=!0:O=/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/.exec(E),O&&y.parentNode){const ee=O[1],X=G?O[3]:O[2],{defaultValue:Y}=_e(X),J=e[ee];if(typeof J=="boolean"){const P=y.parentNode,V=O.index||0,S=E.substring(0,V),C=E.substring(V+O[0].length);S&&P.insertBefore(p.createTextNode(S),y),C&&P.insertBefore(p.createTextNode(C),y),y.parentNode&&y.parentNode.removeChild(y);return}let Q=J===void 0?"":typeof J=="string"?J:String(J||Y);i||(Q=ed(Q));const de=y.parentNode,ke=O.index||0,Te=E.substring(0,ke),$e=E.substring(ke+O[0].length);Q?Q.trim().startsWith("<p")||(Q=`<p>${Q}</p>`):Q="";const N=p.createElement("div");N.innerHTML=Q,Te&&de.insertBefore(p.createTextNode(Te),y),Array.from(N.childNodes).forEach(P=>{de.insertBefore(P.cloneNode(!0),y)}),$e&&de.insertBefore(p.createTextNode($e),y),y.parentNode&&y.parentNode.removeChild(y);return}let R=new RegExp(he.RICH_TEXT_FIELD_WITH_GROUP.source,he.RICH_TEXT_FIELD_WITH_GROUP.flags).exec(E),W=!1;if(R&&y.parentNode?W=!0:R=new RegExp(he.RICH_TEXT_FIELD.source,he.RICH_TEXT_FIELD.flags).exec(E),R&&y.parentNode){const ee=R[1],X=W?R[3]:R[2],Y=e[ee];let J=Y===void 0?"":typeof Y=="string"?Y:String(Y||X);i||(J=ed(J));const Q=y.parentNode,de=R.index||0,ke=E.substring(0,de),Te=E.substring(de+R[0].length);J?J.trim().startsWith("<p")||(J=`<p>${J}</p>`):J="<p></p>";const $e=p.createElement("div");$e.innerHTML=J,ke&&Q.insertBefore(p.createTextNode(ke),y),Array.from($e.childNodes).forEach(N=>{Q.insertBefore(N.cloneNode(!0),y)}),Te&&Q.insertBefore(p.createTextNode(Te),y),y.parentNode&&y.parentNode.removeChild(y);return}let L=/\{\$(\w+)\.(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(E),j=!1;if(L&&y.parentNode?j=!0:L=/\{\$(\w+)\?:(.+?):textarea(?::[^}]+)?\}/.exec(E),L&&y.parentNode){const ee=L[1],X=j?L[3]:L[2],{defaultValue:Y}=_e(X),J=e[ee],Q=J===void 0?"":String(J||Y),de=y.parentNode,ke=L.index||0,Te=E.substring(0,ke),$e=E.substring(ke+L[0].length);Te&&de.insertBefore(p.createTextNode(Te),y);const N=Q.split(`
339
+ `);if(N.forEach((P,V)=>{P&&de.insertBefore(p.createTextNode(P),y),V<N.length-1&&de.insertBefore(p.createElement("br"),y)}),$e){const P=p.createTextNode($e);de.insertBefore(P,y),m(P)}y.parentNode&&y.parentNode.removeChild(y);return}let K=new RegExp(he.TEXTAREA_FIELD_WITH_GROUP.source,he.TEXTAREA_FIELD_WITH_GROUP.flags).exec(E),ae=!1;if(K&&y.parentNode?ae=!0:K=new RegExp(he.TEXTAREA_FIELD.source,he.TEXTAREA_FIELD.flags).exec(E),K&&y.parentNode){const ee=K[1],X=ae?K[3]:K[2],Y=e[ee]??X??"",J=String(Y),Q=y.parentNode,de=K.index||0,ke=E.substring(0,de),Te=E.substring(de+K[0].length);ke&&Q.insertBefore(p.createTextNode(ke),y);const $e=J.split(`
340
+ `);if($e.forEach((N,P)=>{N&&Q.insertBefore(p.createTextNode(N),y),P<$e.length-1&&Q.insertBefore(p.createElement("br"),y)}),Te){const N=p.createTextNode(Te);Q.insertBefore(N,y),m(N)}y.parentNode&&y.parentNode.removeChild(y);return}E=E.replace(/\{\$(\w+)\?:([^}]+)\}/g,(ee,X,Y)=>{if(/:textarea(?::[^}]*)?$/.test(ee))return ee;const J=e[X];if(J===void 0||typeof J=="boolean")return"";const{defaultValue:Q}=_e(Y);return String(J||Q)}),E=E.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(ee,X,Y,J)=>{if(/:textarea(?::[^}]*)?$/.test(ee))return ee;const Q=e[X];if(Q===void 0||typeof Q=="boolean")return"";const{defaultValue:de}=_e(J);return String(Q||de)}),E=E.replace(he.TEXT_FIELD_WITH_GROUP,(ee,X,Y,J)=>{const Q=e[X];if(Q===void 0)return"";const{defaultValue:de}=_e(J);return String(Q||de)}),E=E.replace(he.TEXT_FIELD,(ee,X,Y)=>{const J=e[X];if(J===void 0)return"";const{defaultValue:Q}=_e(Y);return String(J||Q)}),y.textContent=E}else if(y.nodeType===Node.ELEMENT_NODE){const E=y,k=[];Array.from(E.attributes).forEach(O=>{const G=O.value;let z=O.value;const R=O.name.toLowerCase();if(R==="z-if"||R==="z-for"||R==="z-slot"||R==="z-empty"||R==="z-tag"||R.startsWith("data-zcode-"))return;const W=/^\{\$[\w.]+?\?:[^}]+\}(?::(rich|image|textarea))?$/.test(G.trim());d&&((R==="href"||R==="src"||R==="action")&&(z=Dg(z,d)),z=z.replace(he.BACKEND_DATA,(H,L)=>{const j=nd(d,L);return R==="href"||R==="src"||R==="action"?Ct(j):it(j)})),z=z.replace(/\{\$(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(H,L,j)=>{const Z=e[L];if(Z===void 0||typeof Z=="boolean")return"";const{defaultValue:K}=_e(j);return it(String(Z||K))}),z=z.replace(/\{\$(\w+)\.(\w+)\?:(.+?):rich(?::[^}]+)?\}/g,(H,L,j,Z)=>{const K=e[L];if(K===void 0||typeof K=="boolean")return"";const{defaultValue:ae}=_e(Z);return it(String(K||ae))}),z=z.replace(/\{\$(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(H,L,j)=>{const Z=e[L];if(Z===void 0)return"";const{defaultValue:K}=_e(j),ae=typeof Z=="string"?Z:String(Z||K),ee=di(ae,K,s,l,c),X=typeof ee=="string"?ee:String(ee||K);return R==="href"||R==="src"?Ct(X):it(X)}),z=z.replace(/\{\$(\w+)\.(\w+)\?:(.+?):image(?::[^}]+)?\}/g,(H,L,j,Z)=>{const K=e[L];if(K===void 0)return"";const{defaultValue:ae}=_e(Z),ee=typeof K=="string"?K:String(K||ae),X=di(ee,ae,s,l,c),Y=typeof X=="string"?X:String(X||ae);return R==="href"||R==="src"?Ct(Y):it(Y)}),z=z.replace(he.RICH_TEXT_FIELD_WITH_GROUP,(H,L,j,Z)=>{const K=e[L];return K===void 0?"":it(String(K||Z))}),z=z.replace(he.RICH_TEXT_FIELD,(H,L,j)=>{const Z=e[L];return Z===void 0?"":it(String(Z||j))}),z=z.replace(he.IMAGE_FIELD_WITH_GROUP,(H,L,j,Z)=>{const K=e[L];if(K===void 0)return"";const ae=di(K||Z,Z,s,l,c);return R==="href"||R==="src"?Ct(ae||Z):it(ae||Z)}),z=z.replace(he.IMAGE_FIELD,(H,L,j)=>{const Z=e[L];if(Z===void 0)return"";const K=di(Z||j,j,s,l,c);return R==="href"||R==="src"?Ct(K||j):it(K||j)}),z=z.replace(/\{\$(\w+)\?:([^}]+)\}/g,(H,L,j)=>{const Z=e[L];if(Z===void 0||typeof Z=="boolean")return"";const{defaultValue:K}=_e(j),ae=String(Z||K);return R==="href"||R==="src"||R==="action"?Ct(ae):it(ae)}),z=z.replace(/\{\$(\w+)\.(\w+)\?:([^}]+)\}/g,(H,L,j,Z)=>{const K=e[L];if(K===void 0||typeof K=="boolean")return"";const{defaultValue:ae}=_e(Z),ee=String(K||ae);return R==="href"||R==="src"||R==="action"?Ct(ee):it(ee)}),z=z.replace(he.TEXT_FIELD_WITH_GROUP,(H,L,j,Z)=>{const K=e[L];if(K===void 0)return"";const{defaultValue:ae}=_e(Z),ee=String(K||ae);return R==="href"||R==="src"||R==="action"?Ct(ee):it(ee)}),z=z.replace(he.TEXT_FIELD,(H,L,j)=>{const Z=e[L];if(Z===void 0)return"";const{defaultValue:K}=_e(j),ae=String(Z||K);return R==="href"||R==="src"||R==="action"?Ct(ae):it(ae)}),W&&z.trim()===""?k.push(O.name):O.value=z}),k.forEach(O=>{E.removeAttribute(O)})}Array.from(y.childNodes).forEach(E=>m(E))};m(h.content);const b=y=>{if(y.nodeType===Node.TEXT_NODE){let E=y.textContent||"";E=E.replace(he.SELECT_FIELD_WITH_GROUP,(k,O,G,z)=>{if(z.includes("|"))return e[O]||z.split("|")[0];if(z.includes(",")){const R=e[O],W=Array.isArray(R)?R:[],H=z.split(",");return W.filter(L=>typeof L=="string"&&H.includes(L)).join(" ")}return e[O]||z}),E=E.replace(he.SELECT_FIELD,(k,O,G)=>{if(G.includes("|")){const R=e[O];return typeof R=="string"?R:G.split("|")[0]}else if(G.includes(",")){const R=e[O],W=Array.isArray(R)?R:[],H=G.split(",");return W.filter(L=>typeof L=="string"&&H.includes(L)).join(" ")}const z=e[O];return typeof z=="string"?z:G}),E=E.replace(he.RADIO_CHECKBOX_FIELD_WITH_GROUP,(k,O,G,z)=>{if(z.includes("|")){const W=e[O];return typeof W=="string"?W:z.split("|")[0]}else if(z.includes(",")){const W=e[O],H=Array.isArray(W)?W:[],L=z.split(",");return H.filter(j=>typeof j=="string"&&L.includes(j)).join(" ")}const R=e[O];return typeof R=="string"?R:z}),E=E.replace(he.RADIO_FIELD,(k,O,G)=>{if(G.includes("|")){const R=e[O];return typeof R=="string"?R:G.split("|")[0]}else if(G.includes(",")){const R=e[O],W=Array.isArray(R)?R:[],H=G.split(",");return W.filter(L=>typeof L=="string"&&H.includes(L)).join(" ")}const z=e[O];return typeof z=="string"?z:G}),y.textContent=E}else y.nodeType===Node.ELEMENT_NODE&&Array.from(y.attributes).forEach(k=>{let O=k.value;const G=k.name.toLowerCase();O=O.replace(he.SELECT_FIELD_WITH_GROUP,(z,R,W,H)=>{let L;if(H.includes("|"))L=e[R]||H.split("|")[0];else if(H.includes(",")){const j=e[R],Z=Array.isArray(j)?j:[],K=H.split(",");L=Z.filter(ae=>typeof ae=="string"&&K.includes(ae)).join(" ")}else{const j=e[R];L=typeof j=="string"?j:H}return G==="href"||G==="src"||G==="action"?Ct(String(L)):it(String(L))}),O=O.replace(he.SELECT_FIELD,(z,R,W)=>{let H;if(W.includes("|"))H=e[R]||W.split("|")[0];else if(W.includes(",")){const L=e[R],j=Array.isArray(L)?L:[],Z=W.split(",");H=j.filter(K=>typeof K=="string"&&Z.includes(K)).join(" ")}else{const L=e[R];H=typeof L=="string"?L:W}return G==="href"||G==="src"||G==="action"?Ct(String(H)):it(String(H))}),O=O.replace(he.RADIO_CHECKBOX_FIELD_WITH_GROUP,(z,R,W,H)=>{let L;if(H.includes("|"))L=e[R]||H.split("|")[0];else if(H.includes(",")){const j=e[R],Z=Array.isArray(j)?j:[],K=H.split(",");L=Z.filter(ae=>typeof ae=="string"&&K.includes(ae)).join(" ")}else{const j=e[R];L=typeof j=="string"?j:H}return G==="href"||G==="src"||G==="action"?Ct(String(L)):it(String(L))}),O=O.replace(he.RADIO_FIELD,(z,R,W)=>{let H;if(W.includes("|"))H=e[R]||W.split("|")[0];else if(W.includes(",")){const L=e[R],j=Array.isArray(L)?L:[],Z=W.split(",");H=j.filter(K=>typeof K=="string"&&Z.includes(K)).join(" ")}else{const L=e[R];H=typeof L=="string"?L:W}return G==="href"||G==="src"||G==="action"?Ct(String(H)):it(String(H))}),k.value=O});y.childNodes.forEach(E=>b(E))};b(h.content),h.content.querySelectorAll("[z-if]").forEach(y=>{const E=y.getAttribute("z-if");E?(e[E]!==void 0?e[E]:!0)?y.removeAttribute("z-if"):y.remove():y.removeAttribute("z-if")}),h.content.querySelectorAll("[z-tag]").forEach(y=>{const E=y.getAttribute("z-tag");if(E){const k=E.match(/^\$(\w+)(?::(.+))?$/);if(k){const O=k[1],G=e[O],z=typeof G=="string"?G:y.tagName.toLowerCase(),R=["h1","h2","h3","h4","h5","h6","div","p","span","li","ul","ol","section","article","aside","nav","header","footer","main","figure","figcaption","blockquote","pre","code","table","thead","tbody","tr","th","td"],W=typeof z=="string"?z.toLowerCase():z;if(typeof W=="string"&&R.includes(W)){const H=p.createElement(W);Array.from(y.attributes).forEach(L=>{L.name!=="z-tag"&&H.setAttribute(L.name,L.value)}),Array.from(y.childNodes).forEach(L=>{H.appendChild(L.cloneNode(!0))}),y.parentNode?.replaceChild(H,y)}}}}),h.content.querySelectorAll("[z-empty]").forEach(y=>{const E=y.getAttribute("z-empty");if(E){const k=E.match(/^\$(\w+)$/);if(k){const O=k[1],G=e[O];(R=>{if(R==null||R==="")return!0;if(typeof R=="string"){const W=R.trim();if(W===""||W==="<p></p>"||W==="<p> </p>"||/^<p>\s*<\/p>$/i.test(W)||/^<p>\s*<br\s*\/?>\s*<\/p>$/i.test(W))return!0}return!1})(G)?y.remove():y.removeAttribute("z-empty")}else y.removeAttribute("z-empty")}else y.removeAttribute("z-empty")});const w=()=>{Array.from(h.content.querySelectorAll("[z-for]")).forEach(E=>{const k=E.getAttribute("z-for");if(!k){E.removeAttribute("z-for");return}const O=k.match(/^(\w+)\s+in\s+(.+)$/);if(!O){console.warn(`[ZeroCode] Invalid z-for syntax: ${k}`),E.removeAttribute("z-for");return}const[,G,z]=O;if(!z.startsWith("{@")||!z.endsWith("}")){console.warn(`[ZeroCode] z-for only supports backend data: ${z}`),E.removeAttribute("z-for");return}const R=z.slice(2,-1);if(!d){E.remove();return}let W;try{const L=R.split(".");let j=d;for(const Z of L)if(j&&typeof j=="object"&&Z in j)j=j[Z];else{j=null;break}W=j}catch(L){console.warn(`[ZeroCode] Failed to resolve data source: ${R}`,L),E.remove();return}if(!Array.isArray(W)||W.length===0){E.remove();return}const H=document.createDocumentFragment();W.forEach(L=>{const j=E.cloneNode(!0);j.removeAttribute("z-for"),T(j,G,L,e,d),H.appendChild(j)}),E.parentNode&&E.parentNode.replaceChild(H,E)})},T=(y,E,k,O,G,z)=>{const R=H=>{if(H.nodeType===Node.TEXT_NODE){let L=H.textContent||"";const j=new RegExp(`\\{${E}\\.([\\w\\.\\[\\]]+)\\}`,"g");L=L.replace(j,(Z,K)=>{try{const ae=K.split(/[.[\]]/).filter(X=>X);let ee=k;for(const X of ae)if(X.match(/^\d+$/)){const Y=parseInt(X,10);if(Array.isArray(ee)&&Y>=0&&Y<ee.length)ee=ee[Y];else return""}else if(ee&&typeof ee=="object"&&X in ee)ee=ee[X];else return"";return ee==null?"":String(ee)}catch{return""}}),L=L.replace(new RegExp(`\\{${E}\\}`,"g"),()=>typeof k=="object"&&k!==null?JSON.stringify(k):String(k)),H.textContent=L}else if(H.nodeType===Node.ELEMENT_NODE){const L=H;Array.from(L.attributes).forEach(j=>{let Z=j.value;const K=new RegExp(`\\{${E}\\.([\\w\\.\\[\\]]+)\\}`,"g");Z=Z.replace(K,(ae,ee)=>{try{const X=ee.split(/[.[\]]/).filter(Q=>Q);let Y=k;for(const Q of X)if(Q.match(/^\d+$/)){const de=parseInt(Q,10);if(Array.isArray(Y)&&de>=0&&de<Y.length)Y=Y[de];else return""}else if(Y&&typeof Y=="object"&&Q in Y)Y=Y[Q];else return"";const J=Y==null?"":String(Y);return j.name==="href"||j.name==="src"||j.name==="action"?Ct(J):it(J)}catch{return""}}),Z=Z.replace(new RegExp(`\\{${E}\\}`,"g"),()=>{const ae=typeof k=="object"&&k!==null?JSON.stringify(k):String(k);return j.name==="href"||j.name==="src"||j.name==="action"?Ct(ae):it(ae)}),j.value=Z}),Array.from(L.childNodes).forEach(j=>R(j))}};Array.from(y.childNodes).forEach(H=>R(H));const W=y.innerHTML;if(W){const H=ui(W,O,n,o,r,i,s,l,c,G);y.innerHTML=H}};w();const M=y=>{y.forEach(E=>{const k=E.getAttribute("z-slot")||"default",O=e.slots?.[k];let G=[];if(Array.isArray(O)?G=O:O&&typeof O=="object"&&O.children&&(G=O.children||[]),G.length===0){E.removeAttribute("z-slot"),i?(E.setAttribute("data-zcode-empty-slot",k),E.setAttribute("data-zcode-slot-path",n?`${n}.slots.${k}`:`slots.${k}`),E.innerHTML=`<div class="zcode-empty-slot" data-zcode-empty-slot-content>
341
341
  <button class="zcode-add-slot-btn" data-zcode-add-slot>+ パーツを追加</button>
342
- </div>`):E.innerHTML="";return}const z=W.map((j,L)=>{const H=n?`${n}.slots.${S}.${L}`:`slots.${S}.${L}`;return r(j,H)}).join("");E.removeAttribute("z-slot");const V=f.parseFromString(`<template>${z}</template>`,"text/html").querySelector("template");if(V&&V.content)for(E.innerHTML="";V.content.firstChild;)E.appendChild(V.content.firstChild);else E.innerHTML=z})},A=Array.from(h.content.querySelectorAll("[z-slot]"));return M(A),h.innerHTML}function dn(t,e){const n=t.split(".");let o=e;for(const r of n)if(o==null||typeof o!="object"||(/^\d+$/.test(r)?o=o[parseInt(r)]:o=o[r],o===void 0))return null;return o}function jn(){return`zcode-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function Rg(t){return t.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^\s*([a-zA-Z])/,e=>e.toUpperCase())}function Pg(t){return Rg(t)}function od(t){const e=t.split(".");if(e.length<=2&&e[0]==="page")return null;if(e.includes("slots")){let o=-1;for(let r=e.length-1;r>=0;r--)if(e[r]==="slots"){o=r;break}if(o!==-1&&o<e.length-1){const r=e[e.length-1];if(!isNaN(parseInt(r)))return e.slice(0,o).join(".")}}const n=e.slice(0,-1);return n.length===0?null:n.join(".")}function ha(t,e){const n=[...e.common,...e.individual,...e.special];for(const o of n){const r=o.parts.find(i=>i.id===t);if(r)return r}return null}function fi(t,e=!0){function n(i){return ha(i,t.parts)}function o(i,s="",l=new Set){if(l.has(s))return console.warn(`循環参照を検出しました: ${s}`),`<div class="zcode-error-message">循環参照が検出されました: ${s}</div>`;l.add(s);const c=i.part_id,d=n(c);if(!d)return`<div class="zcode-error-message">パーツが見つかりません: ${c}</div>`;const u=ui(d.body,i,s,n,(f,p)=>o(f,p,l),e,t.images.common,t.images.individual,t.images.special,t.backendData);return e?td(u,{"data-zcode-id":i.id,"data-zcode-path":s,"data-zcode-part":c}):u}return{fullPageHtml:a.computed(()=>t.page.map((i,s)=>o(i,`page.${s}`)).join("")),renderComponentToHtml:o,findPart:n}}const ma=a.defineComponent({__name:"ZeroCodePreview",props:{cmsData:{type:Object},allowDynamicContentInteraction:{type:Boolean}},setup(t,{expose:e}){const n=t,{fullPageHtml:o}=fi(n.cmsData,!1),r=a.ref(null),i=a.computed(()=>r.value?.previewArea||null);return e({previewArea:i}),(s,l)=>(a.openBlock(),a.createBlock(Fc,{ref_key:"previewAreaRef",ref:r,"cms-data":t.cmsData,"full-page-html":a.unref(o),"allow-dynamic-content-interaction":t.allowDynamicContentInteraction},null,8,["cms-data","full-page-html","allow-dynamic-content-interaction"]))}}),Lg={class:"zcode-toolbar"},$g=["title"],rd=a.defineComponent({__name:"Toolbar",props:{currentMode:{type:String},viewMode:{type:String},availableModes:{type:Array},allowDynamicContentInteraction:{type:Boolean}},emits:["switch-mode","switch-view-mode","open-settings","toggle-dynamic-content"],setup(t,{emit:e}){const n=t,o=e,r=i=>{n.viewMode==="preview"?(o("switch-view-mode","manage"),a.nextTick(()=>{o("switch-mode",i)})):o("switch-mode",i)};return(i,s)=>(a.openBlock(),a.createElementBlock("div",Lg,[a.createElementVNode("button",{class:a.normalizeClass([{active:t.viewMode==="preview"},"zcode-view-mode-btn zcode-view-mode-preview"]),onClick:s[0]||(s[0]=l=>i.$emit("switch-view-mode",t.viewMode==="preview"?"manage":"preview"))},[a.createVNode(a.unref(Qm),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.viewMode")),1)],2),!t.availableModes||t.availableModes.includes("edit")?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass([{active:t.currentMode==="edit"&&t.viewMode==="manage"},"zcode-mode-btn zcode-mode-edit"]),onClick:s[1]||(s[1]=l=>r("edit"))},[a.createVNode(a.unref(Pc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.editMode")),1)],2)):a.createCommentVNode("",!0),!t.availableModes||t.availableModes.includes("add")?(a.openBlock(),a.createElementBlock("button",{key:1,class:a.normalizeClass([{active:t.currentMode==="add"&&t.viewMode==="manage"},"zcode-mode-btn zcode-mode-add"]),onClick:s[2]||(s[2]=l=>r("add"))},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.addMode")),1)],2)):a.createCommentVNode("",!0),!t.availableModes||t.availableModes.includes("reorder")?(a.openBlock(),a.createElementBlock("button",{key:2,class:a.normalizeClass([{active:t.currentMode==="reorder"&&t.viewMode==="manage"},"zcode-mode-btn zcode-mode-reorder"]),onClick:s[3]||(s[3]=l=>r("reorder"))},[a.createVNode(a.unref(ir),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.reorderMode")),1)],2)):a.createCommentVNode("",!0),!t.availableModes||t.availableModes.includes("delete")?(a.openBlock(),a.createElementBlock("button",{key:3,class:a.normalizeClass([{active:t.currentMode==="delete"&&t.viewMode==="manage"},"zcode-mode-btn zcode-mode-delete"]),onClick:s[4]||(s[4]=l=>r("delete"))},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.deleteMode")),1)],2)):a.createCommentVNode("",!0),a.createElementVNode("button",{class:"zcode-settings-btn",title:i.$t("toolbar.settings"),onClick:s[5]||(s[5]=l=>i.$emit("open-settings"))},[a.createVNode(a.unref($c),{size:16})],8,$g)]))}});function un(t,e){typeof console<"u"&&(console.warn("[intlify] "+t),e&&console.warn(e.stack))}const id={};function sd(t){id[t]||(id[t]=!0,un(t))}const wn=typeof window<"u";let $t,fo;if(process.env.NODE_ENV!=="production"){const t=wn&&window.performance;t&&t.mark&&t.measure&&t.clearMarks&&t.clearMeasures&&($t=e=>{t.mark(e)},fo=(e,n,o)=>{t.measure(e,n,o),t.clearMarks(n),t.clearMarks(o)})}const Vg=/\{([0-9a-zA-Z]+)\}/g;function ga(t,...e){return e.length===1&&Re(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),t.replace(Vg,(n,o)=>e.hasOwnProperty(o)?e[o]:"")}const fn=(t,e=!1)=>e?Symbol.for(t):Symbol(t),Bg=(t,e,n)=>Fg({l:t,k:e,s:n}),Fg=t=>JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),at=t=>typeof t=="number"&&isFinite(t),jg=t=>ud(t)==="[object Date]",pi=t=>ud(t)==="[object RegExp]",hi=t=>$e(t)&&Object.keys(t).length===0,yt=Object.assign,Ug=Object.create,Be=(t=null)=>Ug(t);let ad;const pr=()=>ad||(ad=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:Be());function ld(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\//g,"&#x2F;").replace(/=/g,"&#x3D;")}function cd(t){return t.replace(/&(?![a-zA-Z0-9#]{2,6};)/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Hg(t){return t=t.replace(/(\w+)\s*=\s*"([^"]*)"/g,(o,r,i)=>`${r}="${cd(i)}"`),t=t.replace(/(\w+)\s*=\s*'([^']*)'/g,(o,r,i)=>`${r}='${cd(i)}'`),/\s*on\w+\s*=\s*["']?[^"'>]+["']?/gi.test(t)&&(process.env.NODE_ENV!=="production"&&un("Potentially dangerous event handlers detected in translation. Consider removing onclick, onerror, etc. from your translation messages."),t=t.replace(/(\s+)(on)(\w+\s*=)/gi,"$1&#111;n$3")),[/(\s+(?:href|src|action|formaction)\s*=\s*["']?)\s*javascript:/gi,/(style\s*=\s*["'][^"']*url\s*\(\s*)javascript:/gi].forEach(o=>{t=t.replace(o,"$1javascript&#58;")}),t}const Wg=Object.prototype.hasOwnProperty;function nn(t,e){return Wg.call(t,e)}const tt=Array.isArray,qe=t=>typeof t=="function",he=t=>typeof t=="string",Ke=t=>typeof t=="boolean",Re=t=>t!==null&&typeof t=="object",Gg=t=>Re(t)&&qe(t.then)&&qe(t.catch),dd=Object.prototype.toString,ud=t=>dd.call(t),$e=t=>{if(!Re(t))return!1;const e=Object.getPrototypeOf(t);return e===null||e.constructor===Object},qg=t=>t==null?"":tt(t)||$e(t)&&t.toString===dd?JSON.stringify(t,null,2):String(t);function Kg(t,e=""){return t.reduce((n,o,r)=>r===0?n+o:n+e+o,"")}const fd=2;function Jg(t,e=0,n=t.length){const o=t.split(/\r?\n/);let r=0;const i=[];for(let s=0;s<o.length;s++)if(r+=o[s].length+1,r>=e){for(let l=s-fd;l<=s+fd||n>r;l++){if(l<0||l>=o.length)continue;const c=l+1;i.push(`${c}${" ".repeat(3-String(c).length)}| ${o[l]}`);const d=o[l].length;if(l===s){const u=e-(r-d)+1,f=Math.max(1,n>r?d-u:n-e);i.push(" | "+" ".repeat(u)+"^".repeat(f))}else if(l>s){if(n>r){const u=Math.max(Math.min(n-r,d),1);i.push(" | "+"^".repeat(u))}r+=d+1}}break}return i.join(`
343
- `)}function mi(t){let e=t;return()=>++e}function pd(){const t=new Map;return{events:t,on(n,o){const r=t.get(n);r&&r.push(o)||t.set(n,[o])},off(n,o){const r=t.get(n);r&&r.splice(r.indexOf(o)>>>0,1)},emit(n,o){(t.get(n)||[]).slice().map(r=>r(o)),(t.get("*")||[]).slice().map(r=>r(n,o))}}}const gi=t=>!Re(t)||tt(t);function bi(t,e){if(gi(t)||gi(e))throw new Error("Invalid value");const n=[{src:t,des:e}];for(;n.length;){const{src:o,des:r}=n.pop();Object.keys(o).forEach(i=>{i!=="__proto__"&&(Re(o[i])&&!Re(r[i])&&(r[i]=Array.isArray(o[i])?[]:Be()),gi(r[i])||gi(o[i])?r[i]=o[i]:n.push({src:o[i],des:r[i]}))})}}function Xg(t,e,n){return{line:t,column:e,offset:n}}function yi(t,e,n){return{start:t,end:e}}const Yg=/\{([0-9a-zA-Z]+)\}/g;function hd(t,...e){return e.length===1&&Qg(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),t.replace(Yg,(n,o)=>e.hasOwnProperty(o)?e[o]:"")}const md=Object.assign,gd=t=>typeof t=="string",Qg=t=>t!==null&&typeof t=="object";function bd(t,e=""){return t.reduce((n,o,r)=>r===0?n+o:n+e+o,"")}const xi={USE_MODULO_SYNTAX:1,__EXTEND_POINT__:2},Zg={[xi.USE_MODULO_SYNTAX]:"Use modulo before '{{0}}'."};function eb(t,e,...n){const o=hd(Zg[t],...n||[]),r={message:String(o),code:t};return e&&(r.location=e),r}const Se={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16,__EXTEND_POINT__:17},tb={[Se.EXPECTED_TOKEN]:"Expected token: '{0}'",[Se.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[Se.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[Se.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[Se.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[Se.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[Se.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[Se.EMPTY_PLACEHOLDER]:"Empty placeholder",[Se.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[Se.INVALID_LINKED_FORMAT]:"Invalid linked format",[Se.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[Se.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[Se.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[Se.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[Se.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[Se.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function Io(t,e,n={}){const{domain:o,messages:r,args:i}=n,s=hd((r||tb)[t]||"",...i||[]),l=new SyntaxError(String(s));return l.code=t,e&&(l.location=e),l.domain=o,l}function nb(t){throw t}const ob=/<\/?[\w\s="/.':;#-\/]+>/,rb=t=>ob.test(t),Sn=" ",ib="\r",vt=`
344
- `,sb="\u2028",ab="\u2029";function lb(t){const e=t;let n=0,o=1,r=1,i=0;const s=y=>e[y]===ib&&e[y+1]===vt,l=y=>e[y]===vt,c=y=>e[y]===ab,d=y=>e[y]===sb,u=y=>s(y)||l(y)||c(y)||d(y),f=()=>n,p=()=>o,h=()=>r,m=()=>i,b=y=>s(y)||c(y)||d(y)?vt:e[y],g=()=>b(n),x=()=>b(n+i);function v(){return i=0,u(n)&&(o++,r=0),s(n)&&n++,n++,r++,e[n]}function w(){return s(n+i)&&i++,i++,e[n+i]}function T(){n=0,o=1,r=1,i=0}function M(y=0){i=y}function A(){const y=n+i;for(;y!==n;)v();i=0}return{index:f,line:p,column:h,peekOffset:m,charAt:b,currentChar:g,currentPeek:x,next:v,peek:w,reset:T,resetPeek:M,skipToPeek:A}}const Un=void 0,cb=".",yd="'",db="tokenizer";function ub(t,e={}){const n=e.location!==!1,o=lb(t),r=()=>o.index(),i=()=>Xg(o.line(),o.column(),o.index()),s=i(),l=r(),c={currentType:14,offset:l,startLoc:s,endLoc:s,lastType:14,lastOffset:l,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},d=()=>c,{onError:u}=e;function f(_,I,q,...fe){const Ae=d();if(I.column+=q,I.offset+=q,u){const Te=n?yi(Ae.startLoc,I):null,we=Io(_,Te,{domain:db,args:fe});u(we)}}function p(_,I,q){_.endLoc=i(),_.currentType=I;const fe={type:I};return n&&(fe.loc=yi(_.startLoc,_.endLoc)),q!=null&&(fe.value=q),fe}const h=_=>p(_,14);function m(_,I){return _.currentChar()===I?(_.next(),I):(f(Se.EXPECTED_TOKEN,i(),0,I),"")}function b(_){let I="";for(;_.currentPeek()===Sn||_.currentPeek()===vt;)I+=_.currentPeek(),_.peek();return I}function g(_){const I=b(_);return _.skipToPeek(),I}function x(_){if(_===Un)return!1;const I=_.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I===95}function v(_){if(_===Un)return!1;const I=_.charCodeAt(0);return I>=48&&I<=57}function w(_,I){const{currentType:q}=I;if(q!==2)return!1;b(_);const fe=x(_.currentPeek());return _.resetPeek(),fe}function T(_,I){const{currentType:q}=I;if(q!==2)return!1;b(_);const fe=_.currentPeek()==="-"?_.peek():_.currentPeek(),Ae=v(fe);return _.resetPeek(),Ae}function M(_,I){const{currentType:q}=I;if(q!==2)return!1;b(_);const fe=_.currentPeek()===yd;return _.resetPeek(),fe}function A(_,I){const{currentType:q}=I;if(q!==8)return!1;b(_);const fe=_.currentPeek()===".";return _.resetPeek(),fe}function y(_,I){const{currentType:q}=I;if(q!==9)return!1;b(_);const fe=x(_.currentPeek());return _.resetPeek(),fe}function E(_,I){const{currentType:q}=I;if(!(q===8||q===12))return!1;b(_);const fe=_.currentPeek()===":";return _.resetPeek(),fe}function S(_,I){const{currentType:q}=I;if(q!==10)return!1;const fe=()=>{const Te=_.currentPeek();return Te==="{"?x(_.peek()):Te==="@"||Te==="%"||Te==="|"||Te===":"||Te==="."||Te===Sn||!Te?!1:Te===vt?(_.peek(),fe()):z(_,!1)},Ae=fe();return _.resetPeek(),Ae}function D(_){b(_);const I=_.currentPeek()==="|";return _.resetPeek(),I}function W(_){const I=b(_),q=_.currentPeek()==="%"&&_.peek()==="{";return _.resetPeek(),{isModulo:q,hasSpace:I.length>0}}function z(_,I=!0){const q=(Ae=!1,Te="",we=!1)=>{const B=_.currentPeek();return B==="{"?Te==="%"?!1:Ae:B==="@"||!B?Te==="%"?!0:Ae:B==="%"?(_.peek(),q(Ae,"%",!0)):B==="|"?Te==="%"||we?!0:!(Te===Sn||Te===vt):B===Sn?(_.peek(),q(!0,Sn,we)):B===vt?(_.peek(),q(!0,vt,we)):!0},fe=q();return I&&_.resetPeek(),fe}function P(_,I){const q=_.currentChar();return q===Un?Un:I(q)?(_.next(),q):null}function V(_){const I=_.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36}function j(_){return P(_,V)}function L(_){const I=_.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36||I===45}function H(_){return P(_,L)}function Q(_){const I=_.charCodeAt(0);return I>=48&&I<=57}function G(_){return P(_,Q)}function se(_){const I=_.charCodeAt(0);return I>=48&&I<=57||I>=65&&I<=70||I>=97&&I<=102}function Z(_){return P(_,se)}function X(_){let I="",q="";for(;I=G(_);)q+=I;return q}function J(_){g(_);const I=_.currentChar();return I!=="%"&&f(Se.EXPECTED_TOKEN,i(),0,I),_.next(),"%"}function K(_){let I="";for(;;){const q=_.currentChar();if(q==="{"||q==="}"||q==="@"||q==="|"||!q)break;if(q==="%")if(z(_))I+=q,_.next();else break;else if(q===Sn||q===vt)if(z(_))I+=q,_.next();else{if(D(_))break;I+=q,_.next()}else I+=q,_.next()}return I}function Y(_){g(_);let I="",q="";for(;I=H(_);)q+=I;return _.currentChar()===Un&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),q}function ce(_){g(_);let I="";return _.currentChar()==="-"?(_.next(),I+=`-${X(_)}`):I+=X(_),_.currentChar()===Un&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),I}function Ee(_){return _!==yd&&_!==vt}function _e(_){g(_),m(_,"'");let I="",q="";for(;I=P(_,Ee);)I==="\\"?q+=Le(_):q+=I;const fe=_.currentChar();return fe===vt||fe===Un?(f(Se.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,i(),0),fe===vt&&(_.next(),m(_,"'")),q):(m(_,"'"),q)}function Le(_){const I=_.currentChar();switch(I){case"\\":case"'":return _.next(),`\\${I}`;case"u":return C(_,I,4);case"U":return C(_,I,6);default:return f(Se.UNKNOWN_ESCAPE_SEQUENCE,i(),0,I),""}}function C(_,I,q){m(_,I);let fe="";for(let Ae=0;Ae<q;Ae++){const Te=Z(_);if(!Te){f(Se.INVALID_UNICODE_ESCAPE_SEQUENCE,i(),0,`\\${I}${fe}${_.currentChar()}`);break}fe+=Te}return`\\${I}${fe}`}function N(_){return _!=="{"&&_!=="}"&&_!==Sn&&_!==vt}function O(_){g(_);let I="",q="";for(;I=P(_,N);)q+=I;return q}function k(_){let I="",q="";for(;I=j(_);)q+=I;return q}function U(_){const I=q=>{const fe=_.currentChar();return fe==="{"||fe==="%"||fe==="@"||fe==="|"||fe==="("||fe===")"||!fe||fe===Sn?q:(q+=fe,_.next(),I(q))};return I("")}function te(_){g(_);const I=m(_,"|");return g(_),I}function me(_,I){let q=null;switch(_.currentChar()){case"{":return I.braceNest>=1&&f(Se.NOT_ALLOW_NEST_PLACEHOLDER,i(),0),_.next(),q=p(I,2,"{"),g(_),I.braceNest++,q;case"}":return I.braceNest>0&&I.currentType===2&&f(Se.EMPTY_PLACEHOLDER,i(),0),_.next(),q=p(I,3,"}"),I.braceNest--,I.braceNest>0&&g(_),I.inLinked&&I.braceNest===0&&(I.inLinked=!1),q;case"@":return I.braceNest>0&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),q=ve(_,I)||h(I),I.braceNest=0,q;default:{let Ae=!0,Te=!0,we=!0;if(D(_))return I.braceNest>0&&f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),q=p(I,1,te(_)),I.braceNest=0,I.inLinked=!1,q;if(I.braceNest>0&&(I.currentType===5||I.currentType===6||I.currentType===7))return f(Se.UNTERMINATED_CLOSING_BRACE,i(),0),I.braceNest=0,Ve(_,I);if(Ae=w(_,I))return q=p(I,5,Y(_)),g(_),q;if(Te=T(_,I))return q=p(I,6,ce(_)),g(_),q;if(we=M(_,I))return q=p(I,7,_e(_)),g(_),q;if(!Ae&&!Te&&!we)return q=p(I,13,O(_)),f(Se.INVALID_TOKEN_IN_PLACEHOLDER,i(),0,q.value),g(_),q;break}}return q}function ve(_,I){const{currentType:q}=I;let fe=null;const Ae=_.currentChar();switch((q===8||q===9||q===12||q===10)&&(Ae===vt||Ae===Sn)&&f(Se.INVALID_LINKED_FORMAT,i(),0),Ae){case"@":return _.next(),fe=p(I,8,"@"),I.inLinked=!0,fe;case".":return g(_),_.next(),p(I,9,".");case":":return g(_),_.next(),p(I,10,":");default:return D(_)?(fe=p(I,1,te(_)),I.braceNest=0,I.inLinked=!1,fe):A(_,I)||E(_,I)?(g(_),ve(_,I)):y(_,I)?(g(_),p(I,12,k(_))):S(_,I)?(g(_),Ae==="{"?me(_,I)||fe:p(I,11,U(_))):(q===8&&f(Se.INVALID_LINKED_FORMAT,i(),0),I.braceNest=0,I.inLinked=!1,Ve(_,I))}}function Ve(_,I){let q={type:14};if(I.braceNest>0)return me(_,I)||h(I);if(I.inLinked)return ve(_,I)||h(I);switch(_.currentChar()){case"{":return me(_,I)||h(I);case"}":return f(Se.UNBALANCED_CLOSING_BRACE,i(),0),_.next(),p(I,3,"}");case"@":return ve(_,I)||h(I);default:{if(D(_))return q=p(I,1,te(_)),I.braceNest=0,I.inLinked=!1,q;const{isModulo:Ae,hasSpace:Te}=W(_);if(Ae)return Te?p(I,0,K(_)):p(I,4,J(_));if(z(_))return p(I,0,K(_));break}}return q}function Ce(){const{currentType:_,offset:I,startLoc:q,endLoc:fe}=c;return c.lastType=_,c.lastOffset=I,c.lastStartLoc=q,c.lastEndLoc=fe,c.offset=r(),c.startLoc=i(),o.currentChar()===Un?p(c,14):Ve(o,c)}return{nextToken:Ce,currentOffset:r,currentPosition:i,context:d}}const fb="parser",pb=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function hb(t,e,n){switch(t){case"\\\\":return"\\";case"\\'":return"'";default:{const o=parseInt(e||n,16);return o<=55295||o>=57344?String.fromCodePoint(o):"�"}}}function mb(t={}){const e=t.location!==!1,{onError:n,onWarn:o}=t;function r(w,T,M,A,...y){const E=w.currentPosition();if(E.offset+=A,E.column+=A,n){const S=e?yi(M,E):null,D=Io(T,S,{domain:fb,args:y});n(D)}}function i(w,T,M,A,...y){const E=w.currentPosition();if(E.offset+=A,E.column+=A,o){const S=e?yi(M,E):null;o(eb(T,S,y))}}function s(w,T,M){const A={type:w};return e&&(A.start=T,A.end=T,A.loc={start:M,end:M}),A}function l(w,T,M,A){e&&(w.end=T,w.loc&&(w.loc.end=M))}function c(w,T){const M=w.context(),A=s(3,M.offset,M.startLoc);return A.value=T,l(A,w.currentOffset(),w.currentPosition()),A}function d(w,T){const M=w.context(),{lastOffset:A,lastStartLoc:y}=M,E=s(5,A,y);return E.index=parseInt(T,10),w.nextToken(),l(E,w.currentOffset(),w.currentPosition()),E}function u(w,T,M){const A=w.context(),{lastOffset:y,lastStartLoc:E}=A,S=s(4,y,E);return S.key=T,M===!0&&(S.modulo=!0),w.nextToken(),l(S,w.currentOffset(),w.currentPosition()),S}function f(w,T){const M=w.context(),{lastOffset:A,lastStartLoc:y}=M,E=s(9,A,y);return E.value=T.replace(pb,hb),w.nextToken(),l(E,w.currentOffset(),w.currentPosition()),E}function p(w){const T=w.nextToken(),M=w.context(),{lastOffset:A,lastStartLoc:y}=M,E=s(8,A,y);return T.type!==12?(r(w,Se.UNEXPECTED_EMPTY_LINKED_MODIFIER,M.lastStartLoc,0),E.value="",l(E,A,y),{nextConsumeToken:T,node:E}):(T.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,M.lastStartLoc,0,on(T)),E.value=T.value||"",l(E,w.currentOffset(),w.currentPosition()),{node:E})}function h(w,T){const M=w.context(),A=s(7,M.offset,M.startLoc);return A.value=T,l(A,w.currentOffset(),w.currentPosition()),A}function m(w){const T=w.context(),M=s(6,T.offset,T.startLoc);let A=w.nextToken();if(A.type===9){const y=p(w);M.modifier=y.node,A=y.nextConsumeToken||w.nextToken()}switch(A.type!==10&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),A=w.nextToken(),A.type===2&&(A=w.nextToken()),A.type){case 11:A.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=h(w,A.value||"");break;case 5:A.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=u(w,A.value||"");break;case 6:A.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=d(w,A.value||"");break;case 7:A.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=f(w,A.value||"");break;default:{r(w,Se.UNEXPECTED_EMPTY_LINKED_KEY,T.lastStartLoc,0);const y=w.context(),E=s(7,y.offset,y.startLoc);return E.value="",l(E,y.offset,y.startLoc),M.key=E,l(M,y.offset,y.startLoc),{nextConsumeToken:A,node:M}}}return l(M,w.currentOffset(),w.currentPosition()),{node:M}}function b(w){const T=w.context(),M=T.currentType===1?w.currentOffset():T.offset,A=T.currentType===1?T.endLoc:T.startLoc,y=s(2,M,A);y.items=[];let E=null,S=null;do{const z=E||w.nextToken();switch(E=null,z.type){case 0:z.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(c(w,z.value||""));break;case 6:z.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(d(w,z.value||""));break;case 4:S=!0;break;case 5:z.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(u(w,z.value||"",!!S)),S&&(i(w,xi.USE_MODULO_SYNTAX,T.lastStartLoc,0,on(z)),S=null);break;case 7:z.value==null&&r(w,Se.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(f(w,z.value||""));break;case 8:{const P=m(w);y.items.push(P.node),E=P.nextConsumeToken||null;break}}}while(T.currentType!==14&&T.currentType!==1);const D=T.currentType===1?T.lastOffset:w.currentOffset(),W=T.currentType===1?T.lastEndLoc:w.currentPosition();return l(y,D,W),y}function g(w,T,M,A){const y=w.context();let E=A.items.length===0;const S=s(1,T,M);S.cases=[],S.cases.push(A);do{const D=b(w);E||(E=D.items.length===0),S.cases.push(D)}while(y.currentType!==14);return E&&r(w,Se.MUST_HAVE_MESSAGES_IN_PLURAL,M,0),l(S,w.currentOffset(),w.currentPosition()),S}function x(w){const T=w.context(),{offset:M,startLoc:A}=T,y=b(w);return T.currentType===14?y:g(w,M,A,y)}function v(w){const T=ub(w,md({},t)),M=T.context(),A=s(0,M.offset,M.startLoc);return e&&A.loc&&(A.loc.source=w),A.body=x(T),t.onCacheKey&&(A.cacheKey=t.onCacheKey(w)),M.currentType!==14&&r(T,Se.UNEXPECTED_LEXICAL_ANALYSIS,M.lastStartLoc,0,w[M.offset]||""),l(A,T.currentOffset(),T.currentPosition()),A}return{parse:v}}function on(t){if(t.type===14)return"EOF";const e=(t.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function gb(t,e={}){const n={ast:t,helpers:new Set};return{context:()=>n,helper:i=>(n.helpers.add(i),i)}}function xd(t,e){for(let n=0;n<t.length;n++)ba(t[n],e)}function ba(t,e){switch(t.type){case 1:xd(t.cases,e),e.helper("plural");break;case 2:xd(t.items,e);break;case 6:{ba(t.key,e),e.helper("linked"),e.helper("type");break}case 5:e.helper("interpolate"),e.helper("list");break;case 4:e.helper("interpolate"),e.helper("named");break}}function bb(t,e={}){const n=gb(t);n.helper("normalize"),t.body&&ba(t.body,n);const o=n.context();t.helpers=Array.from(o.helpers)}function yb(t){const e=t.body;return e.type===2?Ed(e):e.cases.forEach(n=>Ed(n)),t}function Ed(t){if(t.items.length===1){const e=t.items[0];(e.type===3||e.type===9)&&(t.static=e.value,delete e.value)}else{const e=[];for(let n=0;n<t.items.length;n++){const o=t.items[n];if(!(o.type===3||o.type===9)||o.value==null)break;e.push(o.value)}if(e.length===t.items.length){t.static=bd(e);for(let n=0;n<t.items.length;n++){const o=t.items[n];(o.type===3||o.type===9)&&delete o.value}}}}const xb="minifier";function Oo(t){switch(t.t=t.type,t.type){case 0:{const e=t;Oo(e.body),e.b=e.body,delete e.body;break}case 1:{const e=t,n=e.cases;for(let o=0;o<n.length;o++)Oo(n[o]);e.c=n,delete e.cases;break}case 2:{const e=t,n=e.items;for(let o=0;o<n.length;o++)Oo(n[o]);e.i=n,delete e.items,e.static&&(e.s=e.static,delete e.static);break}case 3:case 9:case 8:case 7:{const e=t;e.value&&(e.v=e.value,delete e.value);break}case 6:{const e=t;Oo(e.key),e.k=e.key,delete e.key,e.modifier&&(Oo(e.modifier),e.m=e.modifier,delete e.modifier);break}case 5:{const e=t;e.i=e.index,delete e.index;break}case 4:{const e=t;e.k=e.key,delete e.key;break}default:throw Io(Se.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:xb,args:[t.type]})}delete t.type}const Eb="parser";function kb(t,e){const{filename:n,breakLineCode:o,needIndent:r}=e,i=e.location!==!1,s={filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:r,indentLevel:0};i&&t.loc&&(s.source=t.loc.source);const l=()=>s;function c(b,g){s.code+=b}function d(b,g=!0){const x=g?o:"";c(r?x+" ".repeat(b):x)}function u(b=!0){const g=++s.indentLevel;b&&d(g)}function f(b=!0){const g=--s.indentLevel;b&&d(g)}function p(){d(s.indentLevel)}return{context:l,push:c,indent:u,deindent:f,newline:p,helper:b=>`_${b}`,needIndent:()=>s.needIndent}}function wb(t,e){const{helper:n}=t;t.push(`${n("linked")}(`),Do(t,e.key),e.modifier?(t.push(", "),Do(t,e.modifier),t.push(", _type")):t.push(", undefined, _type"),t.push(")")}function Sb(t,e){const{helper:n,needIndent:o}=t;t.push(`${n("normalize")}([`),t.indent(o());const r=e.items.length;for(let i=0;i<r&&(Do(t,e.items[i]),i!==r-1);i++)t.push(", ");t.deindent(o()),t.push("])")}function Nb(t,e){const{helper:n,needIndent:o}=t;if(e.cases.length>1){t.push(`${n("plural")}([`),t.indent(o());const r=e.cases.length;for(let i=0;i<r&&(Do(t,e.cases[i]),i!==r-1);i++)t.push(", ");t.deindent(o()),t.push("])")}}function Cb(t,e){e.body?Do(t,e.body):t.push("null")}function Do(t,e){const{helper:n}=t;switch(e.type){case 0:Cb(t,e);break;case 1:Nb(t,e);break;case 2:Sb(t,e);break;case 6:wb(t,e);break;case 8:t.push(JSON.stringify(e.value),e);break;case 7:t.push(JSON.stringify(e.value),e);break;case 5:t.push(`${n("interpolate")}(${n("list")}(${e.index}))`,e);break;case 4:t.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(e.key)}))`,e);break;case 9:t.push(JSON.stringify(e.value),e);break;case 3:t.push(JSON.stringify(e.value),e);break;default:throw Io(Se.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:Eb,args:[e.type]})}}const vb=(t,e={})=>{const n=gd(e.mode)?e.mode:"normal",o=gd(e.filename)?e.filename:"message.intl";e.sourceMap;const r=e.breakLineCode!=null?e.breakLineCode:n==="arrow"?";":`
345
- `,i=e.needIndent?e.needIndent:n!=="arrow",s=t.helpers||[],l=kb(t,{filename:o,breakLineCode:r,needIndent:i});l.push(n==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),l.indent(i),s.length>0&&(l.push(`const { ${bd(s.map(u=>`${u}: _${u}`),", ")} } = ctx`),l.newline()),l.push("return "),Do(l,t),l.deindent(i),l.push("}"),delete t.helpers;const{code:c,map:d}=l.context();return{ast:t,code:c,map:d?d.toJSON():void 0}};function Tb(t,e={}){const n=md({},e),o=!!n.jit,r=!!n.minify,i=n.optimize==null?!0:n.optimize,l=mb(n).parse(t);return o?(i&&yb(l),r&&Oo(l),{ast:l,code:""}):(bb(l,n),vb(l,n))}function zb(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(pr().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(pr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function jt(t){return Re(t)&&ya(t)===0&&(nn(t,"b")||nn(t,"body"))}const kd=["b","body"];function _b(t){return Hn(t,kd)}const wd=["c","cases"];function Ab(t){return Hn(t,wd,[])}const Sd=["s","static"];function Mb(t){return Hn(t,Sd)}const Nd=["i","items"];function Ib(t){return Hn(t,Nd,[])}const Cd=["t","type"];function ya(t){return Hn(t,Cd)}const vd=["v","value"];function Ei(t,e){const n=Hn(t,vd);if(n!=null)return n;throw hr(e)}const Td=["m","modifier"];function Ob(t){return Hn(t,Td)}const zd=["k","key"];function Db(t){const e=Hn(t,zd);if(e)return e;throw hr(6)}function Hn(t,e,n){for(let o=0;o<e.length;o++){const r=e[o];if(nn(t,r)&&t[r]!=null)return t[r]}return n}const _d=[...kd,...wd,...Sd,...Nd,...zd,...Td,...vd,...Cd];function hr(t){return new Error(`unhandled node type: ${t}`)}const Wn=[];Wn[0]={w:[0],i:[3,0],"[":[4],o:[7]},Wn[1]={w:[1],".":[2],"[":[4],o:[7]},Wn[2]={w:[2],i:[3,0],0:[3,0]},Wn[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},Wn[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},Wn[5]={"'":[4,0],o:8,l:[5,0]},Wn[6]={'"':[4,0],o:8,l:[6,0]};const Rb=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function Pb(t){return Rb.test(t)}function Lb(t){const e=t.charCodeAt(0),n=t.charCodeAt(t.length-1);return e===n&&(e===34||e===39)?t.slice(1,-1):t}function $b(t){if(t==null)return"o";switch(t.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return t;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function Vb(t){const e=t.trim();return t.charAt(0)==="0"&&isNaN(parseInt(t))?!1:Pb(e)?Lb(e):"*"+e}function Bb(t){const e=[];let n=-1,o=0,r=0,i,s,l,c,d,u,f;const p=[];p[0]=()=>{s===void 0?s=l:s+=l},p[1]=()=>{s!==void 0&&(e.push(s),s=void 0)},p[2]=()=>{p[0](),r++},p[3]=()=>{if(r>0)r--,o=4,p[0]();else{if(r=0,s===void 0||(s=Vb(s),s===!1))return!1;p[1]()}};function h(){const m=t[n+1];if(o===5&&m==="'"||o===6&&m==='"')return n++,l="\\"+m,p[0](),!0}for(;o!==null;)if(n++,i=t[n],!(i==="\\"&&h())){if(c=$b(i),f=Wn[o],d=f[c]||f.l||8,d===8||(o=d[0],d[1]!==void 0&&(u=p[d[1]],u&&(l=i,u()===!1))))return;if(o===7)return e}}const Ad=new Map;function Fb(t,e){return Re(t)?t[e]:null}function jb(t,e){if(!Re(t))return null;let n=Ad.get(e);if(n||(n=Bb(e),n&&Ad.set(e,n)),!n)return null;const o=n.length;let r=t,i=0;for(;i<o;){const s=n[i];if(_d.includes(s)&&jt(r))return null;const l=r[s];if(l===void 0||qe(r))return null;r=l,i++}return r}const Ub=t=>t,Hb=t=>"",Wb="text",Gb=t=>t.length===0?"":Kg(t),qb=qg;function Md(t,e){return t=Math.abs(t),e===2?t?t>1?1:0:1:t?Math.min(t,2):0}function Kb(t){const e=at(t.pluralIndex)?t.pluralIndex:-1;return t.named&&(at(t.named.count)||at(t.named.n))?at(t.named.count)?t.named.count:at(t.named.n)?t.named.n:e:e}function Jb(t,e){e.count||(e.count=t),e.n||(e.n=t)}function Xb(t={}){const e=t.locale,n=Kb(t),o=Re(t.pluralRules)&&he(e)&&qe(t.pluralRules[e])?t.pluralRules[e]:Md,r=Re(t.pluralRules)&&he(e)&&qe(t.pluralRules[e])?Md:void 0,i=x=>x[o(n,x.length,r)],s=t.list||[],l=x=>s[x],c=t.named||Be();at(t.pluralIndex)&&Jb(n,c);const d=x=>c[x];function u(x){const v=qe(t.messages)?t.messages(x):Re(t.messages)?t.messages[x]:!1;return v||(t.parent?t.parent.message(x):Hb)}const f=x=>t.modifiers?t.modifiers[x]:Ub,p=$e(t.processor)&&qe(t.processor.normalize)?t.processor.normalize:Gb,h=$e(t.processor)&&qe(t.processor.interpolate)?t.processor.interpolate:qb,m=$e(t.processor)&&he(t.processor.type)?t.processor.type:Wb,g={list:l,named:d,plural:i,linked:(x,...v)=>{const[w,T]=v;let M="text",A="";v.length===1?Re(w)?(A=w.modifier||A,M=w.type||M):he(w)&&(A=w||A):v.length===2&&(he(w)&&(A=w||A),he(T)&&(M=T||M));const y=u(x)(g),E=M==="vnode"&&tt(y)&&A?y[0]:y;return A?f(A)(E,M):E},message:u,type:m,interpolate:h,normalize:p,values:yt(Be(),s,c)};return g}let mr=null;function Yb(t){mr=t}function Qb(t,e,n){mr&&mr.emit("i18n:init",{timestamp:Date.now(),i18n:t,version:e,meta:n})}const Zb=ey("function:translate");function ey(t){return e=>mr&&mr.emit(t,e)}const Id=xi.__EXTEND_POINT__,po=mi(Id),Tt={NOT_FOUND_KEY:Id,FALLBACK_TO_TRANSLATE:po(),CANNOT_FORMAT_NUMBER:po(),FALLBACK_TO_NUMBER_FORMAT:po(),CANNOT_FORMAT_DATE:po(),FALLBACK_TO_DATE_FORMAT:po(),EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:po(),__EXTEND_POINT__:po()},ty={[Tt.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[Tt.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[Tt.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[Tt.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[Tt.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[Tt.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[Tt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]:"This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future."};function ho(t,...e){return ga(ty[t],...e)}const Od=Se.__EXTEND_POINT__,mo=mi(Od),lt={INVALID_ARGUMENT:Od,INVALID_DATE_ARGUMENT:mo(),INVALID_ISO_DATE_ARGUMENT:mo(),NOT_SUPPORT_NON_STRING_MESSAGE:mo(),NOT_SUPPORT_LOCALE_PROMISE_VALUE:mo(),NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:mo(),NOT_SUPPORT_LOCALE_TYPE:mo(),__EXTEND_POINT__:mo()};function pn(t){return Io(t,null,process.env.NODE_ENV!=="production"?{messages:ny}:void 0)}const ny={[lt.INVALID_ARGUMENT]:"Invalid arguments",[lt.INVALID_DATE_ARGUMENT]:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",[lt.INVALID_ISO_DATE_ARGUMENT]:"The argument provided is not a valid ISO date string",[lt.NOT_SUPPORT_NON_STRING_MESSAGE]:"Not support non-string message",[lt.NOT_SUPPORT_LOCALE_PROMISE_VALUE]:"cannot support promise value",[lt.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION]:"cannot support async function",[lt.NOT_SUPPORT_LOCALE_TYPE]:"cannot support locale type"};function xa(t,e){return e.locale!=null?Dd(e.locale):Dd(t.locale)}let Ea;function Dd(t){if(he(t))return t;if(qe(t)){if(t.resolvedOnce&&Ea!=null)return Ea;if(t.constructor.name==="Function"){const e=t();if(Gg(e))throw pn(lt.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Ea=e}else throw pn(lt.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw pn(lt.NOT_SUPPORT_LOCALE_TYPE)}function oy(t,e,n){return[...new Set([n,...tt(e)?e:Re(e)?Object.keys(e):he(e)?[e]:[n]])]}function Rd(t,e,n){const o=he(n)?n:wi,r=t;r.__localeChainCache||(r.__localeChainCache=new Map);let i=r.__localeChainCache.get(o);if(!i){i=[];let s=[n];for(;tt(s);)s=Pd(i,s,e);const l=tt(e)||!$e(e)?e:e.default?e.default:null;s=he(l)?[l]:l,tt(s)&&Pd(i,s,!1),r.__localeChainCache.set(o,i)}return i}function Pd(t,e,n){let o=!0;for(let r=0;r<e.length&&Ke(o);r++){const i=e[r];he(i)&&(o=ry(t,e[r],n))}return o}function ry(t,e,n){let o;const r=e.split("-");do{const i=r.join("-");o=iy(t,i,n),r.splice(-1,1)}while(r.length&&o===!0);return o}function iy(t,e,n){let o=!1;if(!t.includes(e)&&(o=!0,e)){o=e[e.length-1]!=="!";const r=e.replace(/!/g,"");t.push(r),(tt(n)||$e(n))&&n[r]&&(o=n[r])}return o}const sy="9.14.5",ki=-1,wi="en-US",Si="",Ld=t=>`${t.charAt(0).toLocaleUpperCase()}${t.substr(1)}`;function ay(){return{upper:(t,e)=>e==="text"&&he(t)?t.toUpperCase():e==="vnode"&&Re(t)&&"__v_isVNode"in t?t.children.toUpperCase():t,lower:(t,e)=>e==="text"&&he(t)?t.toLowerCase():e==="vnode"&&Re(t)&&"__v_isVNode"in t?t.children.toLowerCase():t,capitalize:(t,e)=>e==="text"&&he(t)?Ld(t):e==="vnode"&&Re(t)&&"__v_isVNode"in t?Ld(t.children):t}}let $d;function Vd(t){$d=t}let Bd;function ly(t){Bd=t}let Fd;function cy(t){Fd=t}let jd=null;const dy=t=>{jd=t},uy=()=>jd;let Ud=null;const Hd=t=>{Ud=t},fy=()=>Ud;let Wd=0;function py(t={}){const e=qe(t.onWarn)?t.onWarn:un,n=he(t.version)?t.version:sy,o=he(t.locale)||qe(t.locale)?t.locale:wi,r=qe(o)?wi:o,i=tt(t.fallbackLocale)||$e(t.fallbackLocale)||he(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:r,s=$e(t.messages)?t.messages:ka(r),l=$e(t.datetimeFormats)?t.datetimeFormats:ka(r),c=$e(t.numberFormats)?t.numberFormats:ka(r),d=yt(Be(),t.modifiers,ay()),u=t.pluralRules||Be(),f=qe(t.missing)?t.missing:null,p=Ke(t.missingWarn)||pi(t.missingWarn)?t.missingWarn:!0,h=Ke(t.fallbackWarn)||pi(t.fallbackWarn)?t.fallbackWarn:!0,m=!!t.fallbackFormat,b=!!t.unresolving,g=qe(t.postTranslation)?t.postTranslation:null,x=$e(t.processor)?t.processor:null,v=Ke(t.warnHtmlMessage)?t.warnHtmlMessage:!0,w=!!t.escapeParameter,T=qe(t.messageCompiler)?t.messageCompiler:$d;process.env.NODE_ENV!=="production"&&qe(t.messageCompiler)&&sd(ho(Tt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER));const M=qe(t.messageResolver)?t.messageResolver:Bd||Fb,A=qe(t.localeFallbacker)?t.localeFallbacker:Fd||oy,y=Re(t.fallbackContext)?t.fallbackContext:void 0,E=t,S=Re(E.__datetimeFormatters)?E.__datetimeFormatters:new Map,D=Re(E.__numberFormatters)?E.__numberFormatters:new Map,W=Re(E.__meta)?E.__meta:{};Wd++;const z={version:n,cid:Wd,locale:o,fallbackLocale:i,messages:s,modifiers:d,pluralRules:u,missing:f,missingWarn:p,fallbackWarn:h,fallbackFormat:m,unresolving:b,postTranslation:g,processor:x,warnHtmlMessage:v,escapeParameter:w,messageCompiler:T,messageResolver:M,localeFallbacker:A,fallbackContext:y,onWarn:e,__meta:W};return z.datetimeFormats=l,z.numberFormats=c,z.__datetimeFormatters=S,z.__numberFormatters=D,process.env.NODE_ENV!=="production"&&(z.__v_emitter=E.__v_emitter!=null?E.__v_emitter:void 0),process.env.NODE_ENV!=="production"&&Qb(z,n,W),z}const ka=t=>({[t]:Be()});function Ni(t,e){return t instanceof RegExp?t.test(e):t}function Gd(t,e){return t instanceof RegExp?t.test(e):t}function wa(t,e,n,o,r){const{missing:i,onWarn:s}=t;if(process.env.NODE_ENV!=="production"){const l=t.__v_emitter;l&&l.emit("missing",{locale:n,key:e,type:r,groupId:`${r}:${e}`})}if(i!==null){const l=i(t,n,e,r);return he(l)?l:e}else return process.env.NODE_ENV!=="production"&&Gd(o,e)&&s(ho(Tt.NOT_FOUND_KEY,{key:e,locale:n})),e}function gr(t,e,n){const o=t;o.__localeChainCache=new Map,t.localeFallbacker(t,n,e)}function qd(t,e){return t===e?!1:t.split("-")[0]===e.split("-")[0]}function hy(t,e){const n=e.indexOf(t);if(n===-1)return!1;for(let o=n+1;o<e.length;o++)if(qd(t,e[o]))return!0;return!1}function Sa(t){return n=>my(n,t)}function my(t,e){const n=_b(e);if(n==null)throw hr(0);if(ya(n)===1){const i=Ab(n);return t.plural(i.reduce((s,l)=>[...s,Kd(t,l)],[]))}else return Kd(t,n)}function Kd(t,e){const n=Mb(e);if(n!=null)return t.type==="text"?n:t.normalize([n]);{const o=Ib(e).reduce((r,i)=>[...r,Na(t,i)],[]);return t.normalize(o)}}function Na(t,e){const n=ya(e);switch(n){case 3:return Ei(e,n);case 9:return Ei(e,n);case 4:{const o=e;if(nn(o,"k")&&o.k)return t.interpolate(t.named(o.k));if(nn(o,"key")&&o.key)return t.interpolate(t.named(o.key));throw hr(n)}case 5:{const o=e;if(nn(o,"i")&&at(o.i))return t.interpolate(t.list(o.i));if(nn(o,"index")&&at(o.index))return t.interpolate(t.list(o.index));throw hr(n)}case 6:{const o=e,r=Ob(o),i=Db(o);return t.linked(Na(t,i),r?Na(t,r):void 0,t.type)}case 7:return Ei(e,n);case 8:return Ei(e,n);default:throw new Error(`unhandled node on format message part: ${n}`)}}const gy="Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.";function Jd(t,e){e&&rb(t)&&un(ga(gy,{source:t}))}const Xd=t=>t;let Ro=Be();function Yd(t){t.code===xi.USE_MODULO_SYNTAX&&un(`The use of named interpolation with modulo syntax is deprecated. It will be removed in v10.
342
+ </div>`):E.innerHTML="";return}const z=G.map((H,L)=>{const j=n?`${n}.slots.${k}.${L}`:`slots.${k}.${L}`;return r(H,j)}).join("");E.removeAttribute("z-slot");const W=f.parseFromString(`<template>${z}</template>`,"text/html").querySelector("template");if(W&&W.content)for(E.innerHTML="";W.content.firstChild;)E.appendChild(W.content.firstChild);else E.innerHTML=z})},A=Array.from(h.content.querySelectorAll("[z-slot]"));return M(A),h.innerHTML}function dn(t,e){const n=t.split(".");let o=e;for(const r of n)if(o==null||typeof o!="object"||(/^\d+$/.test(r)?o=o[parseInt(r)]:o=o[r],o===void 0))return null;return o}function jn(){return`zcode-${Date.now()}-${Math.random().toString(36).substr(2,9)}`}function Rg(t){return t.replace(/_/g," ").replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^\s*([a-zA-Z])/,e=>e.toUpperCase())}function Pg(t){return Rg(t)}function od(t){const e=t.split(".");if(e.length<=2&&e[0]==="page")return null;if(e.includes("slots")){let o=-1;for(let r=e.length-1;r>=0;r--)if(e[r]==="slots"){o=r;break}if(o!==-1&&o<e.length-1){const r=e[e.length-1];if(!isNaN(parseInt(r)))return e.slice(0,o).join(".")}}const n=e.slice(0,-1);return n.length===0?null:n.join(".")}function ha(t,e){const n=[...e.common,...e.individual,...e.special];for(const o of n){const r=o.parts.find(i=>i.id===t);if(r)return r}return null}function fi(t,e=!0){function n(i){return ha(i,t.parts)}function o(i,s="",l=new Set){if(l.has(s))return console.warn(`循環参照を検出しました: ${s}`),`<div class="zcode-error-message">循環参照が検出されました: ${s}</div>`;l.add(s);const c=i.part_id,d=n(c);if(!d)return`<div class="zcode-error-message">パーツが見つかりません: ${c}</div>`;const u=ui(d.body,i,s,n,(f,p)=>o(f,p,l),e,t.images.common,t.images.individual,t.images.special,t.backendData);return e?td(u,{"data-zcode-id":i.id,"data-zcode-path":s,"data-zcode-part":c}):u}return{fullPageHtml:a.computed(()=>t.page.map((i,s)=>o(i,`page.${s}`)).join("")),renderComponentToHtml:o,findPart:n}}const ma=a.defineComponent({__name:"ZeroCodePreview",props:{cmsData:{type:Object},allowDynamicContentInteraction:{type:Boolean}},setup(t,{expose:e}){const n=t,{fullPageHtml:o}=fi(n.cmsData,!1),r=a.ref(null),i=a.computed(()=>r.value?.previewArea||null);return e({previewArea:i}),(s,l)=>(a.openBlock(),a.createBlock(Fc,{ref_key:"previewAreaRef",ref:r,"cms-data":t.cmsData,"full-page-html":a.unref(o),"allow-dynamic-content-interaction":t.allowDynamicContentInteraction},null,8,["cms-data","full-page-html","allow-dynamic-content-interaction"]))}}),Lg={class:"zcode-toolbar"},$g=["title"],rd=a.defineComponent({__name:"Toolbar",props:{currentMode:{type:String},viewMode:{type:String},availableModes:{type:Array},allowDynamicContentInteraction:{type:Boolean}},emits:["switch-mode","switch-view-mode","open-settings","toggle-dynamic-content"],setup(t,{emit:e}){const n=t,o=e,r=i=>{n.viewMode==="preview"?(o("switch-view-mode","manage"),a.nextTick(()=>{o("switch-mode",i)})):o("switch-mode",i)};return(i,s)=>(a.openBlock(),a.createElementBlock("div",Lg,[a.createElementVNode("button",{class:a.normalizeClass([{active:t.viewMode==="preview"},"zcode-view-mode-btn zcode-view-mode-preview"]),onClick:s[0]||(s[0]=l=>i.$emit("switch-view-mode",t.viewMode==="preview"?"manage":"preview"))},[a.createVNode(a.unref(Qm),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.viewMode")),1)],2),!t.availableModes||t.availableModes.includes("edit")?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass([{active:t.currentMode==="edit"&&t.viewMode==="manage"},"zcode-mode-btn zcode-mode-edit"]),onClick:s[1]||(s[1]=l=>r("edit"))},[a.createVNode(a.unref(Pc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.editMode")),1)],2)):a.createCommentVNode("",!0),!t.availableModes||t.availableModes.includes("add")?(a.openBlock(),a.createElementBlock("button",{key:1,class:a.normalizeClass([{active:t.currentMode==="add"&&t.viewMode==="manage"},"zcode-mode-btn zcode-mode-add"]),onClick:s[2]||(s[2]=l=>r("add"))},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.addMode")),1)],2)):a.createCommentVNode("",!0),!t.availableModes||t.availableModes.includes("reorder")?(a.openBlock(),a.createElementBlock("button",{key:2,class:a.normalizeClass([{active:t.currentMode==="reorder"&&t.viewMode==="manage"},"zcode-mode-btn zcode-mode-reorder"]),onClick:s[3]||(s[3]=l=>r("reorder"))},[a.createVNode(a.unref(ir),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.reorderMode")),1)],2)):a.createCommentVNode("",!0),!t.availableModes||t.availableModes.includes("delete")?(a.openBlock(),a.createElementBlock("button",{key:3,class:a.normalizeClass([{active:t.currentMode==="delete"&&t.viewMode==="manage"},"zcode-mode-btn zcode-mode-delete"]),onClick:s[4]||(s[4]=l=>r("delete"))},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("toolbar.deleteMode")),1)],2)):a.createCommentVNode("",!0),a.createElementVNode("button",{class:"zcode-settings-btn",title:i.$t("toolbar.settings"),onClick:s[5]||(s[5]=l=>i.$emit("open-settings"))},[a.createVNode(a.unref($c),{size:16})],8,$g)]))}});function un(t,e){typeof console<"u"&&(console.warn("[intlify] "+t),e&&console.warn(e.stack))}const id={};function sd(t){id[t]||(id[t]=!0,un(t))}const wn=typeof window<"u";let $t,fo;if(process.env.NODE_ENV!=="production"){const t=wn&&window.performance;t&&t.mark&&t.measure&&t.clearMarks&&t.clearMeasures&&($t=e=>{t.mark(e)},fo=(e,n,o)=>{t.measure(e,n,o),t.clearMarks(n),t.clearMarks(o)})}const Vg=/\{([0-9a-zA-Z]+)\}/g;function ga(t,...e){return e.length===1&&Pe(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),t.replace(Vg,(n,o)=>e.hasOwnProperty(o)?e[o]:"")}const fn=(t,e=!1)=>e?Symbol.for(t):Symbol(t),Bg=(t,e,n)=>Fg({l:t,k:e,s:n}),Fg=t=>JSON.stringify(t).replace(/\u2028/g,"\\u2028").replace(/\u2029/g,"\\u2029").replace(/\u0027/g,"\\u0027"),at=t=>typeof t=="number"&&isFinite(t),jg=t=>ud(t)==="[object Date]",pi=t=>ud(t)==="[object RegExp]",hi=t=>Ve(t)&&Object.keys(t).length===0,yt=Object.assign,Ug=Object.create,Be=(t=null)=>Ug(t);let ad;const pr=()=>ad||(ad=typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:Be());function ld(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\//g,"&#x2F;").replace(/=/g,"&#x3D;")}function cd(t){return t.replace(/&(?![a-zA-Z0-9#]{2,6};)/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Hg(t){return t=t.replace(/(\w+)\s*=\s*"([^"]*)"/g,(o,r,i)=>`${r}="${cd(i)}"`),t=t.replace(/(\w+)\s*=\s*'([^']*)'/g,(o,r,i)=>`${r}='${cd(i)}'`),/\s*on\w+\s*=\s*["']?[^"'>]+["']?/gi.test(t)&&(process.env.NODE_ENV!=="production"&&un("Potentially dangerous event handlers detected in translation. Consider removing onclick, onerror, etc. from your translation messages."),t=t.replace(/(\s+)(on)(\w+\s*=)/gi,"$1&#111;n$3")),[/(\s+(?:href|src|action|formaction)\s*=\s*["']?)\s*javascript:/gi,/(style\s*=\s*["'][^"']*url\s*\(\s*)javascript:/gi].forEach(o=>{t=t.replace(o,"$1javascript&#58;")}),t}const Wg=Object.prototype.hasOwnProperty;function nn(t,e){return Wg.call(t,e)}const tt=Array.isArray,qe=t=>typeof t=="function",me=t=>typeof t=="string",Ke=t=>typeof t=="boolean",Pe=t=>t!==null&&typeof t=="object",Gg=t=>Pe(t)&&qe(t.then)&&qe(t.catch),dd=Object.prototype.toString,ud=t=>dd.call(t),Ve=t=>{if(!Pe(t))return!1;const e=Object.getPrototypeOf(t);return e===null||e.constructor===Object},qg=t=>t==null?"":tt(t)||Ve(t)&&t.toString===dd?JSON.stringify(t,null,2):String(t);function Kg(t,e=""){return t.reduce((n,o,r)=>r===0?n+o:n+e+o,"")}const fd=2;function Jg(t,e=0,n=t.length){const o=t.split(/\r?\n/);let r=0;const i=[];for(let s=0;s<o.length;s++)if(r+=o[s].length+1,r>=e){for(let l=s-fd;l<=s+fd||n>r;l++){if(l<0||l>=o.length)continue;const c=l+1;i.push(`${c}${" ".repeat(3-String(c).length)}| ${o[l]}`);const d=o[l].length;if(l===s){const u=e-(r-d)+1,f=Math.max(1,n>r?d-u:n-e);i.push(" | "+" ".repeat(u)+"^".repeat(f))}else if(l>s){if(n>r){const u=Math.max(Math.min(n-r,d),1);i.push(" | "+"^".repeat(u))}r+=d+1}}break}return i.join(`
343
+ `)}function mi(t){let e=t;return()=>++e}function pd(){const t=new Map;return{events:t,on(n,o){const r=t.get(n);r&&r.push(o)||t.set(n,[o])},off(n,o){const r=t.get(n);r&&r.splice(r.indexOf(o)>>>0,1)},emit(n,o){(t.get(n)||[]).slice().map(r=>r(o)),(t.get("*")||[]).slice().map(r=>r(n,o))}}}const gi=t=>!Pe(t)||tt(t);function bi(t,e){if(gi(t)||gi(e))throw new Error("Invalid value");const n=[{src:t,des:e}];for(;n.length;){const{src:o,des:r}=n.pop();Object.keys(o).forEach(i=>{i!=="__proto__"&&(Pe(o[i])&&!Pe(r[i])&&(r[i]=Array.isArray(o[i])?[]:Be()),gi(r[i])||gi(o[i])?r[i]=o[i]:n.push({src:o[i],des:r[i]}))})}}function Xg(t,e,n){return{line:t,column:e,offset:n}}function yi(t,e,n){return{start:t,end:e}}const Yg=/\{([0-9a-zA-Z]+)\}/g;function hd(t,...e){return e.length===1&&Qg(e[0])&&(e=e[0]),(!e||!e.hasOwnProperty)&&(e={}),t.replace(Yg,(n,o)=>e.hasOwnProperty(o)?e[o]:"")}const md=Object.assign,gd=t=>typeof t=="string",Qg=t=>t!==null&&typeof t=="object";function bd(t,e=""){return t.reduce((n,o,r)=>r===0?n+o:n+e+o,"")}const xi={USE_MODULO_SYNTAX:1,__EXTEND_POINT__:2},Zg={[xi.USE_MODULO_SYNTAX]:"Use modulo before '{{0}}'."};function eb(t,e,...n){const o=hd(Zg[t],...n||[]),r={message:String(o),code:t};return e&&(r.location=e),r}const Ne={EXPECTED_TOKEN:1,INVALID_TOKEN_IN_PLACEHOLDER:2,UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER:3,UNKNOWN_ESCAPE_SEQUENCE:4,INVALID_UNICODE_ESCAPE_SEQUENCE:5,UNBALANCED_CLOSING_BRACE:6,UNTERMINATED_CLOSING_BRACE:7,EMPTY_PLACEHOLDER:8,NOT_ALLOW_NEST_PLACEHOLDER:9,INVALID_LINKED_FORMAT:10,MUST_HAVE_MESSAGES_IN_PLURAL:11,UNEXPECTED_EMPTY_LINKED_MODIFIER:12,UNEXPECTED_EMPTY_LINKED_KEY:13,UNEXPECTED_LEXICAL_ANALYSIS:14,UNHANDLED_CODEGEN_NODE_TYPE:15,UNHANDLED_MINIFIER_NODE_TYPE:16,__EXTEND_POINT__:17},tb={[Ne.EXPECTED_TOKEN]:"Expected token: '{0}'",[Ne.INVALID_TOKEN_IN_PLACEHOLDER]:"Invalid token in placeholder: '{0}'",[Ne.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER]:"Unterminated single quote in placeholder",[Ne.UNKNOWN_ESCAPE_SEQUENCE]:"Unknown escape sequence: \\{0}",[Ne.INVALID_UNICODE_ESCAPE_SEQUENCE]:"Invalid unicode escape sequence: {0}",[Ne.UNBALANCED_CLOSING_BRACE]:"Unbalanced closing brace",[Ne.UNTERMINATED_CLOSING_BRACE]:"Unterminated closing brace",[Ne.EMPTY_PLACEHOLDER]:"Empty placeholder",[Ne.NOT_ALLOW_NEST_PLACEHOLDER]:"Not allowed nest placeholder",[Ne.INVALID_LINKED_FORMAT]:"Invalid linked format",[Ne.MUST_HAVE_MESSAGES_IN_PLURAL]:"Plural must have messages",[Ne.UNEXPECTED_EMPTY_LINKED_MODIFIER]:"Unexpected empty linked modifier",[Ne.UNEXPECTED_EMPTY_LINKED_KEY]:"Unexpected empty linked key",[Ne.UNEXPECTED_LEXICAL_ANALYSIS]:"Unexpected lexical analysis in token: '{0}'",[Ne.UNHANDLED_CODEGEN_NODE_TYPE]:"unhandled codegen node type: '{0}'",[Ne.UNHANDLED_MINIFIER_NODE_TYPE]:"unhandled mimifier node type: '{0}'"};function Io(t,e,n={}){const{domain:o,messages:r,args:i}=n,s=hd((r||tb)[t]||"",...i||[]),l=new SyntaxError(String(s));return l.code=t,e&&(l.location=e),l.domain=o,l}function nb(t){throw t}const ob=/<\/?[\w\s="/.':;#-\/]+>/,rb=t=>ob.test(t),Sn=" ",ib="\r",vt=`
344
+ `,sb="\u2028",ab="\u2029";function lb(t){const e=t;let n=0,o=1,r=1,i=0;const s=y=>e[y]===ib&&e[y+1]===vt,l=y=>e[y]===vt,c=y=>e[y]===ab,d=y=>e[y]===sb,u=y=>s(y)||l(y)||c(y)||d(y),f=()=>n,p=()=>o,h=()=>r,m=()=>i,b=y=>s(y)||c(y)||d(y)?vt:e[y],g=()=>b(n),x=()=>b(n+i);function v(){return i=0,u(n)&&(o++,r=0),s(n)&&n++,n++,r++,e[n]}function w(){return s(n+i)&&i++,i++,e[n+i]}function T(){n=0,o=1,r=1,i=0}function M(y=0){i=y}function A(){const y=n+i;for(;y!==n;)v();i=0}return{index:f,line:p,column:h,peekOffset:m,charAt:b,currentChar:g,currentPeek:x,next:v,peek:w,reset:T,resetPeek:M,skipToPeek:A}}const Un=void 0,cb=".",yd="'",db="tokenizer";function ub(t,e={}){const n=e.location!==!1,o=lb(t),r=()=>o.index(),i=()=>Xg(o.line(),o.column(),o.index()),s=i(),l=r(),c={currentType:14,offset:l,startLoc:s,endLoc:s,lastType:14,lastOffset:l,lastStartLoc:s,lastEndLoc:s,braceNest:0,inLinked:!1,text:""},d=()=>c,{onError:u}=e;function f(_,I,q,...pe){const Ae=d();if(I.column+=q,I.offset+=q,u){const ze=n?yi(Ae.startLoc,I):null,Se=Io(_,ze,{domain:db,args:pe});u(Se)}}function p(_,I,q){_.endLoc=i(),_.currentType=I;const pe={type:I};return n&&(pe.loc=yi(_.startLoc,_.endLoc)),q!=null&&(pe.value=q),pe}const h=_=>p(_,14);function m(_,I){return _.currentChar()===I?(_.next(),I):(f(Ne.EXPECTED_TOKEN,i(),0,I),"")}function b(_){let I="";for(;_.currentPeek()===Sn||_.currentPeek()===vt;)I+=_.currentPeek(),_.peek();return I}function g(_){const I=b(_);return _.skipToPeek(),I}function x(_){if(_===Un)return!1;const I=_.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I===95}function v(_){if(_===Un)return!1;const I=_.charCodeAt(0);return I>=48&&I<=57}function w(_,I){const{currentType:q}=I;if(q!==2)return!1;b(_);const pe=x(_.currentPeek());return _.resetPeek(),pe}function T(_,I){const{currentType:q}=I;if(q!==2)return!1;b(_);const pe=_.currentPeek()==="-"?_.peek():_.currentPeek(),Ae=v(pe);return _.resetPeek(),Ae}function M(_,I){const{currentType:q}=I;if(q!==2)return!1;b(_);const pe=_.currentPeek()===yd;return _.resetPeek(),pe}function A(_,I){const{currentType:q}=I;if(q!==8)return!1;b(_);const pe=_.currentPeek()===".";return _.resetPeek(),pe}function y(_,I){const{currentType:q}=I;if(q!==9)return!1;b(_);const pe=x(_.currentPeek());return _.resetPeek(),pe}function E(_,I){const{currentType:q}=I;if(!(q===8||q===12))return!1;b(_);const pe=_.currentPeek()===":";return _.resetPeek(),pe}function k(_,I){const{currentType:q}=I;if(q!==10)return!1;const pe=()=>{const ze=_.currentPeek();return ze==="{"?x(_.peek()):ze==="@"||ze==="%"||ze==="|"||ze===":"||ze==="."||ze===Sn||!ze?!1:ze===vt?(_.peek(),pe()):z(_,!1)},Ae=pe();return _.resetPeek(),Ae}function O(_){b(_);const I=_.currentPeek()==="|";return _.resetPeek(),I}function G(_){const I=b(_),q=_.currentPeek()==="%"&&_.peek()==="{";return _.resetPeek(),{isModulo:q,hasSpace:I.length>0}}function z(_,I=!0){const q=(Ae=!1,ze="",Se=!1)=>{const F=_.currentPeek();return F==="{"?ze==="%"?!1:Ae:F==="@"||!F?ze==="%"?!0:Ae:F==="%"?(_.peek(),q(Ae,"%",!0)):F==="|"?ze==="%"||Se?!0:!(ze===Sn||ze===vt):F===Sn?(_.peek(),q(!0,Sn,Se)):F===vt?(_.peek(),q(!0,vt,Se)):!0},pe=q();return I&&_.resetPeek(),pe}function R(_,I){const q=_.currentChar();return q===Un?Un:I(q)?(_.next(),q):null}function W(_){const I=_.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36}function H(_){return R(_,W)}function L(_){const I=_.charCodeAt(0);return I>=97&&I<=122||I>=65&&I<=90||I>=48&&I<=57||I===95||I===36||I===45}function j(_){return R(_,L)}function Z(_){const I=_.charCodeAt(0);return I>=48&&I<=57}function K(_){return R(_,Z)}function ae(_){const I=_.charCodeAt(0);return I>=48&&I<=57||I>=65&&I<=70||I>=97&&I<=102}function ee(_){return R(_,ae)}function X(_){let I="",q="";for(;I=K(_);)q+=I;return q}function Y(_){g(_);const I=_.currentChar();return I!=="%"&&f(Ne.EXPECTED_TOKEN,i(),0,I),_.next(),"%"}function J(_){let I="";for(;;){const q=_.currentChar();if(q==="{"||q==="}"||q==="@"||q==="|"||!q)break;if(q==="%")if(z(_))I+=q,_.next();else break;else if(q===Sn||q===vt)if(z(_))I+=q,_.next();else{if(O(_))break;I+=q,_.next()}else I+=q,_.next()}return I}function Q(_){g(_);let I="",q="";for(;I=j(_);)q+=I;return _.currentChar()===Un&&f(Ne.UNTERMINATED_CLOSING_BRACE,i(),0),q}function de(_){g(_);let I="";return _.currentChar()==="-"?(_.next(),I+=`-${X(_)}`):I+=X(_),_.currentChar()===Un&&f(Ne.UNTERMINATED_CLOSING_BRACE,i(),0),I}function ke(_){return _!==yd&&_!==vt}function Te(_){g(_),m(_,"'");let I="",q="";for(;I=R(_,ke);)I==="\\"?q+=$e(_):q+=I;const pe=_.currentChar();return pe===vt||pe===Un?(f(Ne.UNTERMINATED_SINGLE_QUOTE_IN_PLACEHOLDER,i(),0),pe===vt&&(_.next(),m(_,"'")),q):(m(_,"'"),q)}function $e(_){const I=_.currentChar();switch(I){case"\\":case"'":return _.next(),`\\${I}`;case"u":return N(_,I,4);case"U":return N(_,I,6);default:return f(Ne.UNKNOWN_ESCAPE_SEQUENCE,i(),0,I),""}}function N(_,I,q){m(_,I);let pe="";for(let Ae=0;Ae<q;Ae++){const ze=ee(_);if(!ze){f(Ne.INVALID_UNICODE_ESCAPE_SEQUENCE,i(),0,`\\${I}${pe}${_.currentChar()}`);break}pe+=ze}return`\\${I}${pe}`}function P(_){return _!=="{"&&_!=="}"&&_!==Sn&&_!==vt}function V(_){g(_);let I="",q="";for(;I=R(_,P);)q+=I;return q}function S(_){let I="",q="";for(;I=H(_);)q+=I;return q}function C(_){const I=q=>{const pe=_.currentChar();return pe==="{"||pe==="%"||pe==="@"||pe==="|"||pe==="("||pe===")"||!pe||pe===Sn?q:(q+=pe,_.next(),I(q))};return I("")}function $(_){g(_);const I=m(_,"|");return g(_),I}function te(_,I){let q=null;switch(_.currentChar()){case"{":return I.braceNest>=1&&f(Ne.NOT_ALLOW_NEST_PLACEHOLDER,i(),0),_.next(),q=p(I,2,"{"),g(_),I.braceNest++,q;case"}":return I.braceNest>0&&I.currentType===2&&f(Ne.EMPTY_PLACEHOLDER,i(),0),_.next(),q=p(I,3,"}"),I.braceNest--,I.braceNest>0&&g(_),I.inLinked&&I.braceNest===0&&(I.inLinked=!1),q;case"@":return I.braceNest>0&&f(Ne.UNTERMINATED_CLOSING_BRACE,i(),0),q=ge(_,I)||h(I),I.braceNest=0,q;default:{let Ae=!0,ze=!0,Se=!0;if(O(_))return I.braceNest>0&&f(Ne.UNTERMINATED_CLOSING_BRACE,i(),0),q=p(I,1,$(_)),I.braceNest=0,I.inLinked=!1,q;if(I.braceNest>0&&(I.currentType===5||I.currentType===6||I.currentType===7))return f(Ne.UNTERMINATED_CLOSING_BRACE,i(),0),I.braceNest=0,Re(_,I);if(Ae=w(_,I))return q=p(I,5,Q(_)),g(_),q;if(ze=T(_,I))return q=p(I,6,de(_)),g(_),q;if(Se=M(_,I))return q=p(I,7,Te(_)),g(_),q;if(!Ae&&!ze&&!Se)return q=p(I,13,V(_)),f(Ne.INVALID_TOKEN_IN_PLACEHOLDER,i(),0,q.value),g(_),q;break}}return q}function ge(_,I){const{currentType:q}=I;let pe=null;const Ae=_.currentChar();switch((q===8||q===9||q===12||q===10)&&(Ae===vt||Ae===Sn)&&f(Ne.INVALID_LINKED_FORMAT,i(),0),Ae){case"@":return _.next(),pe=p(I,8,"@"),I.inLinked=!0,pe;case".":return g(_),_.next(),p(I,9,".");case":":return g(_),_.next(),p(I,10,":");default:return O(_)?(pe=p(I,1,$(_)),I.braceNest=0,I.inLinked=!1,pe):A(_,I)||E(_,I)?(g(_),ge(_,I)):y(_,I)?(g(_),p(I,12,S(_))):k(_,I)?(g(_),Ae==="{"?te(_,I)||pe:p(I,11,C(_))):(q===8&&f(Ne.INVALID_LINKED_FORMAT,i(),0),I.braceNest=0,I.inLinked=!1,Re(_,I))}}function Re(_,I){let q={type:14};if(I.braceNest>0)return te(_,I)||h(I);if(I.inLinked)return ge(_,I)||h(I);switch(_.currentChar()){case"{":return te(_,I)||h(I);case"}":return f(Ne.UNBALANCED_CLOSING_BRACE,i(),0),_.next(),p(I,3,"}");case"@":return ge(_,I)||h(I);default:{if(O(_))return q=p(I,1,$(_)),I.braceNest=0,I.inLinked=!1,q;const{isModulo:Ae,hasSpace:ze}=G(_);if(Ae)return ze?p(I,0,J(_)):p(I,4,Y(_));if(z(_))return p(I,0,J(_));break}}return q}function ve(){const{currentType:_,offset:I,startLoc:q,endLoc:pe}=c;return c.lastType=_,c.lastOffset=I,c.lastStartLoc=q,c.lastEndLoc=pe,c.offset=r(),c.startLoc=i(),o.currentChar()===Un?p(c,14):Re(o,c)}return{nextToken:ve,currentOffset:r,currentPosition:i,context:d}}const fb="parser",pb=/(?:\\\\|\\'|\\u([0-9a-fA-F]{4})|\\U([0-9a-fA-F]{6}))/g;function hb(t,e,n){switch(t){case"\\\\":return"\\";case"\\'":return"'";default:{const o=parseInt(e||n,16);return o<=55295||o>=57344?String.fromCodePoint(o):"�"}}}function mb(t={}){const e=t.location!==!1,{onError:n,onWarn:o}=t;function r(w,T,M,A,...y){const E=w.currentPosition();if(E.offset+=A,E.column+=A,n){const k=e?yi(M,E):null,O=Io(T,k,{domain:fb,args:y});n(O)}}function i(w,T,M,A,...y){const E=w.currentPosition();if(E.offset+=A,E.column+=A,o){const k=e?yi(M,E):null;o(eb(T,k,y))}}function s(w,T,M){const A={type:w};return e&&(A.start=T,A.end=T,A.loc={start:M,end:M}),A}function l(w,T,M,A){e&&(w.end=T,w.loc&&(w.loc.end=M))}function c(w,T){const M=w.context(),A=s(3,M.offset,M.startLoc);return A.value=T,l(A,w.currentOffset(),w.currentPosition()),A}function d(w,T){const M=w.context(),{lastOffset:A,lastStartLoc:y}=M,E=s(5,A,y);return E.index=parseInt(T,10),w.nextToken(),l(E,w.currentOffset(),w.currentPosition()),E}function u(w,T,M){const A=w.context(),{lastOffset:y,lastStartLoc:E}=A,k=s(4,y,E);return k.key=T,M===!0&&(k.modulo=!0),w.nextToken(),l(k,w.currentOffset(),w.currentPosition()),k}function f(w,T){const M=w.context(),{lastOffset:A,lastStartLoc:y}=M,E=s(9,A,y);return E.value=T.replace(pb,hb),w.nextToken(),l(E,w.currentOffset(),w.currentPosition()),E}function p(w){const T=w.nextToken(),M=w.context(),{lastOffset:A,lastStartLoc:y}=M,E=s(8,A,y);return T.type!==12?(r(w,Ne.UNEXPECTED_EMPTY_LINKED_MODIFIER,M.lastStartLoc,0),E.value="",l(E,A,y),{nextConsumeToken:T,node:E}):(T.value==null&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,M.lastStartLoc,0,on(T)),E.value=T.value||"",l(E,w.currentOffset(),w.currentPosition()),{node:E})}function h(w,T){const M=w.context(),A=s(7,M.offset,M.startLoc);return A.value=T,l(A,w.currentOffset(),w.currentPosition()),A}function m(w){const T=w.context(),M=s(6,T.offset,T.startLoc);let A=w.nextToken();if(A.type===9){const y=p(w);M.modifier=y.node,A=y.nextConsumeToken||w.nextToken()}switch(A.type!==10&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),A=w.nextToken(),A.type===2&&(A=w.nextToken()),A.type){case 11:A.value==null&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=h(w,A.value||"");break;case 5:A.value==null&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=u(w,A.value||"");break;case 6:A.value==null&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=d(w,A.value||"");break;case 7:A.value==null&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(A)),M.key=f(w,A.value||"");break;default:{r(w,Ne.UNEXPECTED_EMPTY_LINKED_KEY,T.lastStartLoc,0);const y=w.context(),E=s(7,y.offset,y.startLoc);return E.value="",l(E,y.offset,y.startLoc),M.key=E,l(M,y.offset,y.startLoc),{nextConsumeToken:A,node:M}}}return l(M,w.currentOffset(),w.currentPosition()),{node:M}}function b(w){const T=w.context(),M=T.currentType===1?w.currentOffset():T.offset,A=T.currentType===1?T.endLoc:T.startLoc,y=s(2,M,A);y.items=[];let E=null,k=null;do{const z=E||w.nextToken();switch(E=null,z.type){case 0:z.value==null&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(c(w,z.value||""));break;case 6:z.value==null&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(d(w,z.value||""));break;case 4:k=!0;break;case 5:z.value==null&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(u(w,z.value||"",!!k)),k&&(i(w,xi.USE_MODULO_SYNTAX,T.lastStartLoc,0,on(z)),k=null);break;case 7:z.value==null&&r(w,Ne.UNEXPECTED_LEXICAL_ANALYSIS,T.lastStartLoc,0,on(z)),y.items.push(f(w,z.value||""));break;case 8:{const R=m(w);y.items.push(R.node),E=R.nextConsumeToken||null;break}}}while(T.currentType!==14&&T.currentType!==1);const O=T.currentType===1?T.lastOffset:w.currentOffset(),G=T.currentType===1?T.lastEndLoc:w.currentPosition();return l(y,O,G),y}function g(w,T,M,A){const y=w.context();let E=A.items.length===0;const k=s(1,T,M);k.cases=[],k.cases.push(A);do{const O=b(w);E||(E=O.items.length===0),k.cases.push(O)}while(y.currentType!==14);return E&&r(w,Ne.MUST_HAVE_MESSAGES_IN_PLURAL,M,0),l(k,w.currentOffset(),w.currentPosition()),k}function x(w){const T=w.context(),{offset:M,startLoc:A}=T,y=b(w);return T.currentType===14?y:g(w,M,A,y)}function v(w){const T=ub(w,md({},t)),M=T.context(),A=s(0,M.offset,M.startLoc);return e&&A.loc&&(A.loc.source=w),A.body=x(T),t.onCacheKey&&(A.cacheKey=t.onCacheKey(w)),M.currentType!==14&&r(T,Ne.UNEXPECTED_LEXICAL_ANALYSIS,M.lastStartLoc,0,w[M.offset]||""),l(A,T.currentOffset(),T.currentPosition()),A}return{parse:v}}function on(t){if(t.type===14)return"EOF";const e=(t.value||"").replace(/\r?\n/gu,"\\n");return e.length>10?e.slice(0,9)+"…":e}function gb(t,e={}){const n={ast:t,helpers:new Set};return{context:()=>n,helper:i=>(n.helpers.add(i),i)}}function xd(t,e){for(let n=0;n<t.length;n++)ba(t[n],e)}function ba(t,e){switch(t.type){case 1:xd(t.cases,e),e.helper("plural");break;case 2:xd(t.items,e);break;case 6:{ba(t.key,e),e.helper("linked"),e.helper("type");break}case 5:e.helper("interpolate"),e.helper("list");break;case 4:e.helper("interpolate"),e.helper("named");break}}function bb(t,e={}){const n=gb(t);n.helper("normalize"),t.body&&ba(t.body,n);const o=n.context();t.helpers=Array.from(o.helpers)}function yb(t){const e=t.body;return e.type===2?Ed(e):e.cases.forEach(n=>Ed(n)),t}function Ed(t){if(t.items.length===1){const e=t.items[0];(e.type===3||e.type===9)&&(t.static=e.value,delete e.value)}else{const e=[];for(let n=0;n<t.items.length;n++){const o=t.items[n];if(!(o.type===3||o.type===9)||o.value==null)break;e.push(o.value)}if(e.length===t.items.length){t.static=bd(e);for(let n=0;n<t.items.length;n++){const o=t.items[n];(o.type===3||o.type===9)&&delete o.value}}}}const xb="minifier";function Oo(t){switch(t.t=t.type,t.type){case 0:{const e=t;Oo(e.body),e.b=e.body,delete e.body;break}case 1:{const e=t,n=e.cases;for(let o=0;o<n.length;o++)Oo(n[o]);e.c=n,delete e.cases;break}case 2:{const e=t,n=e.items;for(let o=0;o<n.length;o++)Oo(n[o]);e.i=n,delete e.items,e.static&&(e.s=e.static,delete e.static);break}case 3:case 9:case 8:case 7:{const e=t;e.value&&(e.v=e.value,delete e.value);break}case 6:{const e=t;Oo(e.key),e.k=e.key,delete e.key,e.modifier&&(Oo(e.modifier),e.m=e.modifier,delete e.modifier);break}case 5:{const e=t;e.i=e.index,delete e.index;break}case 4:{const e=t;e.k=e.key,delete e.key;break}default:throw Io(Ne.UNHANDLED_MINIFIER_NODE_TYPE,null,{domain:xb,args:[t.type]})}delete t.type}const Eb="parser";function kb(t,e){const{filename:n,breakLineCode:o,needIndent:r}=e,i=e.location!==!1,s={filename:n,code:"",column:1,line:1,offset:0,map:void 0,breakLineCode:o,needIndent:r,indentLevel:0};i&&t.loc&&(s.source=t.loc.source);const l=()=>s;function c(b,g){s.code+=b}function d(b,g=!0){const x=g?o:"";c(r?x+" ".repeat(b):x)}function u(b=!0){const g=++s.indentLevel;b&&d(g)}function f(b=!0){const g=--s.indentLevel;b&&d(g)}function p(){d(s.indentLevel)}return{context:l,push:c,indent:u,deindent:f,newline:p,helper:b=>`_${b}`,needIndent:()=>s.needIndent}}function wb(t,e){const{helper:n}=t;t.push(`${n("linked")}(`),Do(t,e.key),e.modifier?(t.push(", "),Do(t,e.modifier),t.push(", _type")):t.push(", undefined, _type"),t.push(")")}function Sb(t,e){const{helper:n,needIndent:o}=t;t.push(`${n("normalize")}([`),t.indent(o());const r=e.items.length;for(let i=0;i<r&&(Do(t,e.items[i]),i!==r-1);i++)t.push(", ");t.deindent(o()),t.push("])")}function Nb(t,e){const{helper:n,needIndent:o}=t;if(e.cases.length>1){t.push(`${n("plural")}([`),t.indent(o());const r=e.cases.length;for(let i=0;i<r&&(Do(t,e.cases[i]),i!==r-1);i++)t.push(", ");t.deindent(o()),t.push("])")}}function Cb(t,e){e.body?Do(t,e.body):t.push("null")}function Do(t,e){const{helper:n}=t;switch(e.type){case 0:Cb(t,e);break;case 1:Nb(t,e);break;case 2:Sb(t,e);break;case 6:wb(t,e);break;case 8:t.push(JSON.stringify(e.value),e);break;case 7:t.push(JSON.stringify(e.value),e);break;case 5:t.push(`${n("interpolate")}(${n("list")}(${e.index}))`,e);break;case 4:t.push(`${n("interpolate")}(${n("named")}(${JSON.stringify(e.key)}))`,e);break;case 9:t.push(JSON.stringify(e.value),e);break;case 3:t.push(JSON.stringify(e.value),e);break;default:throw Io(Ne.UNHANDLED_CODEGEN_NODE_TYPE,null,{domain:Eb,args:[e.type]})}}const vb=(t,e={})=>{const n=gd(e.mode)?e.mode:"normal",o=gd(e.filename)?e.filename:"message.intl";e.sourceMap;const r=e.breakLineCode!=null?e.breakLineCode:n==="arrow"?";":`
345
+ `,i=e.needIndent?e.needIndent:n!=="arrow",s=t.helpers||[],l=kb(t,{filename:o,breakLineCode:r,needIndent:i});l.push(n==="normal"?"function __msg__ (ctx) {":"(ctx) => {"),l.indent(i),s.length>0&&(l.push(`const { ${bd(s.map(u=>`${u}: _${u}`),", ")} } = ctx`),l.newline()),l.push("return "),Do(l,t),l.deindent(i),l.push("}"),delete t.helpers;const{code:c,map:d}=l.context();return{ast:t,code:c,map:d?d.toJSON():void 0}};function Tb(t,e={}){const n=md({},e),o=!!n.jit,r=!!n.minify,i=n.optimize==null?!0:n.optimize,l=mb(n).parse(t);return o?(i&&yb(l),r&&Oo(l),{ast:l,code:""}):(bb(l,n),vb(l,n))}function zb(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(pr().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(pr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}function jt(t){return Pe(t)&&ya(t)===0&&(nn(t,"b")||nn(t,"body"))}const kd=["b","body"];function _b(t){return Hn(t,kd)}const wd=["c","cases"];function Ab(t){return Hn(t,wd,[])}const Sd=["s","static"];function Mb(t){return Hn(t,Sd)}const Nd=["i","items"];function Ib(t){return Hn(t,Nd,[])}const Cd=["t","type"];function ya(t){return Hn(t,Cd)}const vd=["v","value"];function Ei(t,e){const n=Hn(t,vd);if(n!=null)return n;throw hr(e)}const Td=["m","modifier"];function Ob(t){return Hn(t,Td)}const zd=["k","key"];function Db(t){const e=Hn(t,zd);if(e)return e;throw hr(6)}function Hn(t,e,n){for(let o=0;o<e.length;o++){const r=e[o];if(nn(t,r)&&t[r]!=null)return t[r]}return n}const _d=[...kd,...wd,...Sd,...Nd,...zd,...Td,...vd,...Cd];function hr(t){return new Error(`unhandled node type: ${t}`)}const Wn=[];Wn[0]={w:[0],i:[3,0],"[":[4],o:[7]},Wn[1]={w:[1],".":[2],"[":[4],o:[7]},Wn[2]={w:[2],i:[3,0],0:[3,0]},Wn[3]={i:[3,0],0:[3,0],w:[1,1],".":[2,1],"[":[4,1],o:[7,1]},Wn[4]={"'":[5,0],'"':[6,0],"[":[4,2],"]":[1,3],o:8,l:[4,0]},Wn[5]={"'":[4,0],o:8,l:[5,0]},Wn[6]={'"':[4,0],o:8,l:[6,0]};const Rb=/^\s?(?:true|false|-?[\d.]+|'[^']*'|"[^"]*")\s?$/;function Pb(t){return Rb.test(t)}function Lb(t){const e=t.charCodeAt(0),n=t.charCodeAt(t.length-1);return e===n&&(e===34||e===39)?t.slice(1,-1):t}function $b(t){if(t==null)return"o";switch(t.charCodeAt(0)){case 91:case 93:case 46:case 34:case 39:return t;case 95:case 36:case 45:return"i";case 9:case 10:case 13:case 160:case 65279:case 8232:case 8233:return"w"}return"i"}function Vb(t){const e=t.trim();return t.charAt(0)==="0"&&isNaN(parseInt(t))?!1:Pb(e)?Lb(e):"*"+e}function Bb(t){const e=[];let n=-1,o=0,r=0,i,s,l,c,d,u,f;const p=[];p[0]=()=>{s===void 0?s=l:s+=l},p[1]=()=>{s!==void 0&&(e.push(s),s=void 0)},p[2]=()=>{p[0](),r++},p[3]=()=>{if(r>0)r--,o=4,p[0]();else{if(r=0,s===void 0||(s=Vb(s),s===!1))return!1;p[1]()}};function h(){const m=t[n+1];if(o===5&&m==="'"||o===6&&m==='"')return n++,l="\\"+m,p[0](),!0}for(;o!==null;)if(n++,i=t[n],!(i==="\\"&&h())){if(c=$b(i),f=Wn[o],d=f[c]||f.l||8,d===8||(o=d[0],d[1]!==void 0&&(u=p[d[1]],u&&(l=i,u()===!1))))return;if(o===7)return e}}const Ad=new Map;function Fb(t,e){return Pe(t)?t[e]:null}function jb(t,e){if(!Pe(t))return null;let n=Ad.get(e);if(n||(n=Bb(e),n&&Ad.set(e,n)),!n)return null;const o=n.length;let r=t,i=0;for(;i<o;){const s=n[i];if(_d.includes(s)&&jt(r))return null;const l=r[s];if(l===void 0||qe(r))return null;r=l,i++}return r}const Ub=t=>t,Hb=t=>"",Wb="text",Gb=t=>t.length===0?"":Kg(t),qb=qg;function Md(t,e){return t=Math.abs(t),e===2?t?t>1?1:0:1:t?Math.min(t,2):0}function Kb(t){const e=at(t.pluralIndex)?t.pluralIndex:-1;return t.named&&(at(t.named.count)||at(t.named.n))?at(t.named.count)?t.named.count:at(t.named.n)?t.named.n:e:e}function Jb(t,e){e.count||(e.count=t),e.n||(e.n=t)}function Xb(t={}){const e=t.locale,n=Kb(t),o=Pe(t.pluralRules)&&me(e)&&qe(t.pluralRules[e])?t.pluralRules[e]:Md,r=Pe(t.pluralRules)&&me(e)&&qe(t.pluralRules[e])?Md:void 0,i=x=>x[o(n,x.length,r)],s=t.list||[],l=x=>s[x],c=t.named||Be();at(t.pluralIndex)&&Jb(n,c);const d=x=>c[x];function u(x){const v=qe(t.messages)?t.messages(x):Pe(t.messages)?t.messages[x]:!1;return v||(t.parent?t.parent.message(x):Hb)}const f=x=>t.modifiers?t.modifiers[x]:Ub,p=Ve(t.processor)&&qe(t.processor.normalize)?t.processor.normalize:Gb,h=Ve(t.processor)&&qe(t.processor.interpolate)?t.processor.interpolate:qb,m=Ve(t.processor)&&me(t.processor.type)?t.processor.type:Wb,g={list:l,named:d,plural:i,linked:(x,...v)=>{const[w,T]=v;let M="text",A="";v.length===1?Pe(w)?(A=w.modifier||A,M=w.type||M):me(w)&&(A=w||A):v.length===2&&(me(w)&&(A=w||A),me(T)&&(M=T||M));const y=u(x)(g),E=M==="vnode"&&tt(y)&&A?y[0]:y;return A?f(A)(E,M):E},message:u,type:m,interpolate:h,normalize:p,values:yt(Be(),s,c)};return g}let mr=null;function Yb(t){mr=t}function Qb(t,e,n){mr&&mr.emit("i18n:init",{timestamp:Date.now(),i18n:t,version:e,meta:n})}const Zb=ey("function:translate");function ey(t){return e=>mr&&mr.emit(t,e)}const Id=xi.__EXTEND_POINT__,po=mi(Id),Tt={NOT_FOUND_KEY:Id,FALLBACK_TO_TRANSLATE:po(),CANNOT_FORMAT_NUMBER:po(),FALLBACK_TO_NUMBER_FORMAT:po(),CANNOT_FORMAT_DATE:po(),FALLBACK_TO_DATE_FORMAT:po(),EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER:po(),__EXTEND_POINT__:po()},ty={[Tt.NOT_FOUND_KEY]:"Not found '{key}' key in '{locale}' locale messages.",[Tt.FALLBACK_TO_TRANSLATE]:"Fall back to translate '{key}' key with '{target}' locale.",[Tt.CANNOT_FORMAT_NUMBER]:"Cannot format a number value due to not supported Intl.NumberFormat.",[Tt.FALLBACK_TO_NUMBER_FORMAT]:"Fall back to number format '{key}' key with '{target}' locale.",[Tt.CANNOT_FORMAT_DATE]:"Cannot format a date value due to not supported Intl.DateTimeFormat.",[Tt.FALLBACK_TO_DATE_FORMAT]:"Fall back to datetime format '{key}' key with '{target}' locale.",[Tt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER]:"This project is using Custom Message Compiler, which is an experimental feature. It may receive breaking changes or be removed in the future."};function ho(t,...e){return ga(ty[t],...e)}const Od=Ne.__EXTEND_POINT__,mo=mi(Od),lt={INVALID_ARGUMENT:Od,INVALID_DATE_ARGUMENT:mo(),INVALID_ISO_DATE_ARGUMENT:mo(),NOT_SUPPORT_NON_STRING_MESSAGE:mo(),NOT_SUPPORT_LOCALE_PROMISE_VALUE:mo(),NOT_SUPPORT_LOCALE_ASYNC_FUNCTION:mo(),NOT_SUPPORT_LOCALE_TYPE:mo(),__EXTEND_POINT__:mo()};function pn(t){return Io(t,null,process.env.NODE_ENV!=="production"?{messages:ny}:void 0)}const ny={[lt.INVALID_ARGUMENT]:"Invalid arguments",[lt.INVALID_DATE_ARGUMENT]:"The date provided is an invalid Date object.Make sure your Date represents a valid date.",[lt.INVALID_ISO_DATE_ARGUMENT]:"The argument provided is not a valid ISO date string",[lt.NOT_SUPPORT_NON_STRING_MESSAGE]:"Not support non-string message",[lt.NOT_SUPPORT_LOCALE_PROMISE_VALUE]:"cannot support promise value",[lt.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION]:"cannot support async function",[lt.NOT_SUPPORT_LOCALE_TYPE]:"cannot support locale type"};function xa(t,e){return e.locale!=null?Dd(e.locale):Dd(t.locale)}let Ea;function Dd(t){if(me(t))return t;if(qe(t)){if(t.resolvedOnce&&Ea!=null)return Ea;if(t.constructor.name==="Function"){const e=t();if(Gg(e))throw pn(lt.NOT_SUPPORT_LOCALE_PROMISE_VALUE);return Ea=e}else throw pn(lt.NOT_SUPPORT_LOCALE_ASYNC_FUNCTION)}else throw pn(lt.NOT_SUPPORT_LOCALE_TYPE)}function oy(t,e,n){return[...new Set([n,...tt(e)?e:Pe(e)?Object.keys(e):me(e)?[e]:[n]])]}function Rd(t,e,n){const o=me(n)?n:wi,r=t;r.__localeChainCache||(r.__localeChainCache=new Map);let i=r.__localeChainCache.get(o);if(!i){i=[];let s=[n];for(;tt(s);)s=Pd(i,s,e);const l=tt(e)||!Ve(e)?e:e.default?e.default:null;s=me(l)?[l]:l,tt(s)&&Pd(i,s,!1),r.__localeChainCache.set(o,i)}return i}function Pd(t,e,n){let o=!0;for(let r=0;r<e.length&&Ke(o);r++){const i=e[r];me(i)&&(o=ry(t,e[r],n))}return o}function ry(t,e,n){let o;const r=e.split("-");do{const i=r.join("-");o=iy(t,i,n),r.splice(-1,1)}while(r.length&&o===!0);return o}function iy(t,e,n){let o=!1;if(!t.includes(e)&&(o=!0,e)){o=e[e.length-1]!=="!";const r=e.replace(/!/g,"");t.push(r),(tt(n)||Ve(n))&&n[r]&&(o=n[r])}return o}const sy="9.14.5",ki=-1,wi="en-US",Si="",Ld=t=>`${t.charAt(0).toLocaleUpperCase()}${t.substr(1)}`;function ay(){return{upper:(t,e)=>e==="text"&&me(t)?t.toUpperCase():e==="vnode"&&Pe(t)&&"__v_isVNode"in t?t.children.toUpperCase():t,lower:(t,e)=>e==="text"&&me(t)?t.toLowerCase():e==="vnode"&&Pe(t)&&"__v_isVNode"in t?t.children.toLowerCase():t,capitalize:(t,e)=>e==="text"&&me(t)?Ld(t):e==="vnode"&&Pe(t)&&"__v_isVNode"in t?Ld(t.children):t}}let $d;function Vd(t){$d=t}let Bd;function ly(t){Bd=t}let Fd;function cy(t){Fd=t}let jd=null;const dy=t=>{jd=t},uy=()=>jd;let Ud=null;const Hd=t=>{Ud=t},fy=()=>Ud;let Wd=0;function py(t={}){const e=qe(t.onWarn)?t.onWarn:un,n=me(t.version)?t.version:sy,o=me(t.locale)||qe(t.locale)?t.locale:wi,r=qe(o)?wi:o,i=tt(t.fallbackLocale)||Ve(t.fallbackLocale)||me(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:r,s=Ve(t.messages)?t.messages:ka(r),l=Ve(t.datetimeFormats)?t.datetimeFormats:ka(r),c=Ve(t.numberFormats)?t.numberFormats:ka(r),d=yt(Be(),t.modifiers,ay()),u=t.pluralRules||Be(),f=qe(t.missing)?t.missing:null,p=Ke(t.missingWarn)||pi(t.missingWarn)?t.missingWarn:!0,h=Ke(t.fallbackWarn)||pi(t.fallbackWarn)?t.fallbackWarn:!0,m=!!t.fallbackFormat,b=!!t.unresolving,g=qe(t.postTranslation)?t.postTranslation:null,x=Ve(t.processor)?t.processor:null,v=Ke(t.warnHtmlMessage)?t.warnHtmlMessage:!0,w=!!t.escapeParameter,T=qe(t.messageCompiler)?t.messageCompiler:$d;process.env.NODE_ENV!=="production"&&qe(t.messageCompiler)&&sd(ho(Tt.EXPERIMENTAL_CUSTOM_MESSAGE_COMPILER));const M=qe(t.messageResolver)?t.messageResolver:Bd||Fb,A=qe(t.localeFallbacker)?t.localeFallbacker:Fd||oy,y=Pe(t.fallbackContext)?t.fallbackContext:void 0,E=t,k=Pe(E.__datetimeFormatters)?E.__datetimeFormatters:new Map,O=Pe(E.__numberFormatters)?E.__numberFormatters:new Map,G=Pe(E.__meta)?E.__meta:{};Wd++;const z={version:n,cid:Wd,locale:o,fallbackLocale:i,messages:s,modifiers:d,pluralRules:u,missing:f,missingWarn:p,fallbackWarn:h,fallbackFormat:m,unresolving:b,postTranslation:g,processor:x,warnHtmlMessage:v,escapeParameter:w,messageCompiler:T,messageResolver:M,localeFallbacker:A,fallbackContext:y,onWarn:e,__meta:G};return z.datetimeFormats=l,z.numberFormats=c,z.__datetimeFormatters=k,z.__numberFormatters=O,process.env.NODE_ENV!=="production"&&(z.__v_emitter=E.__v_emitter!=null?E.__v_emitter:void 0),process.env.NODE_ENV!=="production"&&Qb(z,n,G),z}const ka=t=>({[t]:Be()});function Ni(t,e){return t instanceof RegExp?t.test(e):t}function Gd(t,e){return t instanceof RegExp?t.test(e):t}function wa(t,e,n,o,r){const{missing:i,onWarn:s}=t;if(process.env.NODE_ENV!=="production"){const l=t.__v_emitter;l&&l.emit("missing",{locale:n,key:e,type:r,groupId:`${r}:${e}`})}if(i!==null){const l=i(t,n,e,r);return me(l)?l:e}else return process.env.NODE_ENV!=="production"&&Gd(o,e)&&s(ho(Tt.NOT_FOUND_KEY,{key:e,locale:n})),e}function gr(t,e,n){const o=t;o.__localeChainCache=new Map,t.localeFallbacker(t,n,e)}function qd(t,e){return t===e?!1:t.split("-")[0]===e.split("-")[0]}function hy(t,e){const n=e.indexOf(t);if(n===-1)return!1;for(let o=n+1;o<e.length;o++)if(qd(t,e[o]))return!0;return!1}function Sa(t){return n=>my(n,t)}function my(t,e){const n=_b(e);if(n==null)throw hr(0);if(ya(n)===1){const i=Ab(n);return t.plural(i.reduce((s,l)=>[...s,Kd(t,l)],[]))}else return Kd(t,n)}function Kd(t,e){const n=Mb(e);if(n!=null)return t.type==="text"?n:t.normalize([n]);{const o=Ib(e).reduce((r,i)=>[...r,Na(t,i)],[]);return t.normalize(o)}}function Na(t,e){const n=ya(e);switch(n){case 3:return Ei(e,n);case 9:return Ei(e,n);case 4:{const o=e;if(nn(o,"k")&&o.k)return t.interpolate(t.named(o.k));if(nn(o,"key")&&o.key)return t.interpolate(t.named(o.key));throw hr(n)}case 5:{const o=e;if(nn(o,"i")&&at(o.i))return t.interpolate(t.list(o.i));if(nn(o,"index")&&at(o.index))return t.interpolate(t.list(o.index));throw hr(n)}case 6:{const o=e,r=Ob(o),i=Db(o);return t.linked(Na(t,i),r?Na(t,r):void 0,t.type)}case 7:return Ei(e,n);case 8:return Ei(e,n);default:throw new Error(`unhandled node on format message part: ${n}`)}}const gy="Detected HTML in '{source}' message. Recommend not using HTML messages to avoid XSS.";function Jd(t,e){e&&rb(t)&&un(ga(gy,{source:t}))}const Xd=t=>t;let Ro=Be();function Yd(t){t.code===xi.USE_MODULO_SYNTAX&&un(`The use of named interpolation with modulo syntax is deprecated. It will be removed in v10.
346
346
  reference: https://vue-i18n.intlify.dev/guide/essentials/syntax#rails-i18n-format
347
- (message compiler warning message: ${t.message})`)}function Qd(t,e={}){let n=!1;const o=e.onError||nb;return e.onError=r=>{n=!0,o(r)},{...Tb(t,e),detectError:n}}const by=(t,e)=>{if(!he(t))throw pn(lt.NOT_SUPPORT_NON_STRING_MESSAGE);process.env.NODE_ENV!=="production"&&(e.onWarn=Yd);{const n=Ke(e.warnHtmlMessage)?e.warnHtmlMessage:!0;process.env.NODE_ENV!=="production"&&Jd(t,n);const r=(e.onCacheKey||Xd)(t),i=Ro[r];if(i)return i;const{code:s,detectError:l}=Qd(t,e),c=new Function(`return ${s}`)();return l?c:Ro[r]=c}};function yy(t,e){if(process.env.NODE_ENV!=="production"&&(e.onWarn=Yd),__INTLIFY_JIT_COMPILATION__&&!__INTLIFY_DROP_MESSAGE_COMPILER__&&he(t)){const n=Ke(e.warnHtmlMessage)?e.warnHtmlMessage:!0;process.env.NODE_ENV!=="production"&&Jd(t,n);const r=(e.onCacheKey||Xd)(t),i=Ro[r];if(i)return i;const{ast:s,detectError:l}=Qd(t,{...e,location:process.env.NODE_ENV!=="production",jit:!0}),c=Sa(s);return l?c:Ro[r]=c}else{if(process.env.NODE_ENV!=="production"&&!jt(t))return un(`the message that is resolve with key '${e.key}' is not supported for jit compilation`),(()=>t);const n=t.cacheKey;if(n){const o=Ro[n];return o||(Ro[n]=Sa(t))}else return Sa(t)}}const Zd=()=>"",Ut=t=>qe(t);function eu(t,...e){const{fallbackFormat:n,postTranslation:o,unresolving:r,messageCompiler:i,fallbackLocale:s,messages:l}=t,[c,d]=Ca(...e),u=Ke(d.missingWarn)?d.missingWarn:t.missingWarn,f=Ke(d.fallbackWarn)?d.fallbackWarn:t.fallbackWarn,p=Ke(d.escapeParameter)?d.escapeParameter:t.escapeParameter,h=!!d.resolvedMessage,m=he(d.default)||Ke(d.default)?Ke(d.default)?i?c:()=>c:d.default:n?i?c:()=>c:"",b=n||m!=="",g=xa(t,d);p&&xy(d);let[x,v,w]=h?[c,g,l[g]||Be()]:tu(t,c,g,s,f,u),T=x,M=c;if(!h&&!(he(T)||jt(T)||Ut(T))&&b&&(T=m,M=T),!h&&(!(he(T)||jt(T)||Ut(T))||!he(v)))return r?ki:c;if(process.env.NODE_ENV!=="production"&&he(T)&&t.messageCompiler==null)return un(`The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return '${c}'.`),c;let A=!1;const y=()=>{A=!0},E=Ut(T)?T:nu(t,c,v,T,M,y);if(A)return T;const S=Sy(t,v,w,d),D=Xb(S),W=Ey(t,E,D);let z=o?o(W,c):W;if(p&&he(z)&&(z=Hg(z)),process.env.NODE_ENV!=="production"){const P={timestamp:Date.now(),key:he(c)?c:Ut(T)?T.key:"",locale:v||(Ut(T)?T.locale:""),format:he(T)?T:Ut(T)?T.source:"",message:z};P.meta=yt({},t.__meta,uy()||{}),Zb(P)}return z}function xy(t){tt(t.list)?t.list=t.list.map(e=>he(e)?ld(e):e):Re(t.named)&&Object.keys(t.named).forEach(e=>{he(t.named[e])&&(t.named[e]=ld(t.named[e]))})}function tu(t,e,n,o,r,i){const{messages:s,onWarn:l,messageResolver:c,localeFallbacker:d}=t,u=d(t,o,n);let f=Be(),p,h=null,m=n,b=null;const g="translate";for(let x=0;x<u.length;x++){if(p=b=u[x],process.env.NODE_ENV!=="production"&&n!==p&&!qd(n,p)&&Ni(r,e)&&l(ho(Tt.FALLBACK_TO_TRANSLATE,{key:e,target:p})),process.env.NODE_ENV!=="production"&&n!==p){const M=t.__v_emitter;M&&M.emit("fallback",{type:g,key:e,from:m,to:b,groupId:`${g}:${e}`})}f=s[p]||Be();let v=null,w,T;if(process.env.NODE_ENV!=="production"&&wn&&(v=window.performance.now(),w="intlify-message-resolve-start",T="intlify-message-resolve-end",$t&&$t(w)),(h=c(f,e))===null&&(h=f[e]),process.env.NODE_ENV!=="production"&&wn){const M=window.performance.now(),A=t.__v_emitter;A&&v&&h&&A.emit("message-resolve",{type:"message-resolve",key:e,message:h,time:M-v,groupId:`${g}:${e}`}),w&&T&&$t&&fo&&($t(T),fo("intlify message resolve",w,T))}if(he(h)||jt(h)||Ut(h))break;if(!hy(p,u)){const M=wa(t,e,p,i,g);M!==e&&(h=M)}m=b}return[h,p,f]}function nu(t,e,n,o,r,i){const{messageCompiler:s,warnHtmlMessage:l}=t;if(Ut(o)){const p=o;return p.locale=p.locale||n,p.key=p.key||e,p}if(s==null){const p=(()=>o);return p.locale=n,p.key=e,p}let c=null,d,u;process.env.NODE_ENV!=="production"&&wn&&(c=window.performance.now(),d="intlify-message-compilation-start",u="intlify-message-compilation-end",$t&&$t(d));const f=s(o,ky(t,n,r,o,l,i));if(process.env.NODE_ENV!=="production"&&wn){const p=window.performance.now(),h=t.__v_emitter;h&&c&&h.emit("message-compilation",{type:"message-compilation",message:o,time:p-c,groupId:`translate:${e}`}),d&&u&&$t&&fo&&($t(u),fo("intlify message compilation",d,u))}return f.locale=n,f.key=e,f.source=o,f}function Ey(t,e,n){let o=null,r,i;process.env.NODE_ENV!=="production"&&wn&&(o=window.performance.now(),r="intlify-message-evaluation-start",i="intlify-message-evaluation-end",$t&&$t(r));const s=e(n);if(process.env.NODE_ENV!=="production"&&wn){const l=window.performance.now(),c=t.__v_emitter;c&&o&&c.emit("message-evaluation",{type:"message-evaluation",value:s,time:l-o,groupId:`translate:${e.key}`}),r&&i&&$t&&fo&&($t(i),fo("intlify message evaluation",r,i))}return s}function Ca(...t){const[e,n,o]=t,r=Be();if(!he(e)&&!at(e)&&!Ut(e)&&!jt(e))throw pn(lt.INVALID_ARGUMENT);const i=at(e)?String(e):(Ut(e),e);return at(n)?r.plural=n:he(n)?r.default=n:$e(n)&&!hi(n)?r.named=n:tt(n)&&(r.list=n),at(o)?r.plural=o:he(o)?r.default=o:$e(o)&&yt(r,o),[i,r]}function ky(t,e,n,o,r,i){return{locale:e,key:n,warnHtmlMessage:r,onError:s=>{if(i&&i(s),process.env.NODE_ENV!=="production"){const l=wy(o),c=`Message compilation error: ${s.message}`,d=s.location&&l&&Jg(l,s.location.start.offset,s.location.end.offset),u=t.__v_emitter;u&&l&&u.emit("compile-error",{message:l,error:s.message,start:s.location&&s.location.start.offset,end:s.location&&s.location.end.offset,groupId:`translate:${n}`}),console.error(d?`${c}
348
- ${d}`:c)}else throw s},onCacheKey:s=>Bg(e,n,s)}}function wy(t){if(he(t))return t;if(t.loc&&t.loc.source)return t.loc.source}function Sy(t,e,n,o){const{modifiers:r,pluralRules:i,messageResolver:s,fallbackLocale:l,fallbackWarn:c,missingWarn:d,fallbackContext:u}=t,p={locale:e,modifiers:r,pluralRules:i,messages:h=>{let m=s(n,h);if(m==null&&u){const[,,b]=tu(u,h,e,l,c,d);m=s(b,h)}if(he(m)||jt(m)){let b=!1;const x=nu(t,h,e,m,h,()=>{b=!0});return b?Zd:x}else return Ut(m)?m:Zd}};return t.processor&&(p.processor=t.processor),o.list&&(p.list=o.list),o.named&&(p.named=o.named),at(o.plural)&&(p.pluralIndex=o.plural),p}const ou=typeof Intl<"u",ru={dateTimeFormat:ou&&typeof Intl.DateTimeFormat<"u",numberFormat:ou&&typeof Intl.NumberFormat<"u"};function iu(t,...e){const{datetimeFormats:n,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:s}=t,{__datetimeFormatters:l}=t;if(process.env.NODE_ENV!=="production"&&!ru.dateTimeFormat)return i(ho(Tt.CANNOT_FORMAT_DATE)),Si;const[c,d,u,f]=va(...e),p=Ke(u.missingWarn)?u.missingWarn:t.missingWarn,h=Ke(u.fallbackWarn)?u.fallbackWarn:t.fallbackWarn,m=!!u.part,b=xa(t,u),g=s(t,r,b);if(!he(c)||c==="")return new Intl.DateTimeFormat(b,f).format(d);let x={},v,w=null,T=b,M=null;const A="datetime format";for(let S=0;S<g.length;S++){if(v=M=g[S],process.env.NODE_ENV!=="production"&&b!==v&&Ni(h,c)&&i(ho(Tt.FALLBACK_TO_DATE_FORMAT,{key:c,target:v})),process.env.NODE_ENV!=="production"&&b!==v){const D=t.__v_emitter;D&&D.emit("fallback",{type:A,key:c,from:T,to:M,groupId:`${A}:${c}`})}if(x=n[v]||{},w=x[c],$e(w))break;wa(t,c,v,p,A),T=M}if(!$e(w)||!he(v))return o?ki:c;let y=`${v}__${c}`;hi(f)||(y=`${y}__${JSON.stringify(f)}`);let E=l.get(y);return E||(E=new Intl.DateTimeFormat(v,yt({},w,f)),l.set(y,E)),m?E.formatToParts(d):E.format(d)}const su=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function va(...t){const[e,n,o,r]=t,i=Be();let s=Be(),l;if(he(e)){const c=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!c)throw pn(lt.INVALID_ISO_DATE_ARGUMENT);const d=c[3]?c[3].trim().startsWith("T")?`${c[1].trim()}${c[3].trim()}`:`${c[1].trim()}T${c[3].trim()}`:c[1].trim();l=new Date(d);try{l.toISOString()}catch{throw pn(lt.INVALID_ISO_DATE_ARGUMENT)}}else if(jg(e)){if(isNaN(e.getTime()))throw pn(lt.INVALID_DATE_ARGUMENT);l=e}else if(at(e))l=e;else throw pn(lt.INVALID_ARGUMENT);return he(n)?i.key=n:$e(n)&&Object.keys(n).forEach(c=>{su.includes(c)?s[c]=n[c]:i[c]=n[c]}),he(o)?i.locale=o:$e(o)&&(s=o),$e(r)&&(s=r),[i.key||"",l,i,s]}function au(t,e,n){const o=t;for(const r in n){const i=`${e}__${r}`;o.__datetimeFormatters.has(i)&&o.__datetimeFormatters.delete(i)}}function lu(t,...e){const{numberFormats:n,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:s}=t,{__numberFormatters:l}=t;if(process.env.NODE_ENV!=="production"&&!ru.numberFormat)return i(ho(Tt.CANNOT_FORMAT_NUMBER)),Si;const[c,d,u,f]=Ta(...e),p=Ke(u.missingWarn)?u.missingWarn:t.missingWarn,h=Ke(u.fallbackWarn)?u.fallbackWarn:t.fallbackWarn,m=!!u.part,b=xa(t,u),g=s(t,r,b);if(!he(c)||c==="")return new Intl.NumberFormat(b,f).format(d);let x={},v,w=null,T=b,M=null;const A="number format";for(let S=0;S<g.length;S++){if(v=M=g[S],process.env.NODE_ENV!=="production"&&b!==v&&Ni(h,c)&&i(ho(Tt.FALLBACK_TO_NUMBER_FORMAT,{key:c,target:v})),process.env.NODE_ENV!=="production"&&b!==v){const D=t.__v_emitter;D&&D.emit("fallback",{type:A,key:c,from:T,to:M,groupId:`${A}:${c}`})}if(x=n[v]||{},w=x[c],$e(w))break;wa(t,c,v,p,A),T=M}if(!$e(w)||!he(v))return o?ki:c;let y=`${v}__${c}`;hi(f)||(y=`${y}__${JSON.stringify(f)}`);let E=l.get(y);return E||(E=new Intl.NumberFormat(v,yt({},w,f)),l.set(y,E)),m?E.formatToParts(d):E.format(d)}const cu=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function Ta(...t){const[e,n,o,r]=t,i=Be();let s=Be();if(!at(e))throw pn(lt.INVALID_ARGUMENT);const l=e;return he(n)?i.key=n:$e(n)&&Object.keys(n).forEach(c=>{cu.includes(c)?s[c]=n[c]:i[c]=n[c]}),he(o)?i.locale=o:$e(o)&&(s=o),$e(r)&&(s=r),[i.key||"",l,i,s]}function du(t,e,n){const o=t;for(const r in n){const i=`${e}__${r}`;o.__numberFormatters.has(i)&&o.__numberFormatters.delete(i)}}zb();function Ny(){return uu().__VUE_DEVTOOLS_GLOBAL_HOOK__}function uu(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const Cy=typeof Proxy=="function",vy="devtools-plugin:setup",Ty="plugin:settings:set";let Po,za;function zy(){var t;return Po!==void 0||(typeof window<"u"&&window.performance?(Po=!0,za=window.performance):typeof globalThis<"u"&&(!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance)?(Po=!0,za=globalThis.perf_hooks.performance):Po=!1),Po}function _y(){return zy()?za.now():Date.now()}class Ay{constructor(e,n){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=n;const o={};if(e.settings)for(const s in e.settings){const l=e.settings[s];o[s]=l.defaultValue}const r=`__vue-devtools-plugin-settings__${e.id}`;let i=Object.assign({},o);try{const s=localStorage.getItem(r),l=JSON.parse(s);Object.assign(i,l)}catch{}this.fallbacks={getSettings(){return i},setSettings(s){try{localStorage.setItem(r,JSON.stringify(s))}catch{}i=s},now(){return _y()}},n&&n.on(Ty,(s,l)=>{s===this.plugin.id&&this.fallbacks.setSettings(l)}),this.proxiedOn=new Proxy({},{get:(s,l)=>this.target?this.target.on[l]:(...c)=>{this.onQueue.push({method:l,args:c})}}),this.proxiedTarget=new Proxy({},{get:(s,l)=>this.target?this.target[l]:l==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(l)?(...c)=>(this.targetQueue.push({method:l,args:c,resolve:()=>{}}),this.fallbacks[l](...c)):(...c)=>new Promise(d=>{this.targetQueue.push({method:l,args:c,resolve:d})})})}async setRealTarget(e){this.target=e;for(const n of this.onQueue)this.target.on[n.method](...n.args);for(const n of this.targetQueue)n.resolve(await this.target[n.method](...n.args))}}function My(t,e){const n=t,o=uu(),r=Ny(),i=Cy&&n.enableEarlyProxy;if(r&&(o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!i))r.emit(vy,t,e);else{const s=i?new Ay(n,r):null;(o.__VUE_DEVTOOLS_PLUGINS__=o.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:n,setupFn:e,proxy:s}),s&&e(s.proxiedTarget)}}const Iy="9.14.5";function Oy(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(pr().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(pr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}const fu=Tt.__EXTEND_POINT__,Nn=mi(fu),Mt={FALLBACK_TO_ROOT:fu,NOT_SUPPORTED_PRESERVE:Nn(),NOT_SUPPORTED_FORMATTER:Nn(),NOT_SUPPORTED_PRESERVE_DIRECTIVE:Nn(),NOT_SUPPORTED_GET_CHOICE_INDEX:Nn(),COMPONENT_NAME_LEGACY_COMPATIBLE:Nn(),NOT_FOUND_PARENT_SCOPE:Nn(),IGNORE_OBJ_FLATTEN:Nn(),NOTICE_DROP_ALLOW_COMPOSITION:Nn(),NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG:Nn()},Dy={[Mt.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[Mt.NOT_SUPPORTED_PRESERVE]:"Not supported 'preserve'.",[Mt.NOT_SUPPORTED_FORMATTER]:"Not supported 'formatter'.",[Mt.NOT_SUPPORTED_PRESERVE_DIRECTIVE]:"Not supported 'preserveDirectiveContent'.",[Mt.NOT_SUPPORTED_GET_CHOICE_INDEX]:"Not supported 'getChoiceIndex'.",[Mt.COMPONENT_NAME_LEGACY_COMPATIBLE]:"Component name legacy compatible: '{name}' -> 'i18n'",[Mt.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[Mt.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value",[Mt.NOTICE_DROP_ALLOW_COMPOSITION]:"'allowComposition' option will be dropped in the next major version. For more information, please see 👉 https://tinyurl.com/2p97mcze",[Mt.NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG]:"'translateExistCompatible' option will be dropped in the next major version."};function Ci(t,...e){return ga(Dy[t],...e)}const pu=lt.__EXTEND_POINT__,It=mi(pu),Je={UNEXPECTED_RETURN_TYPE:pu,INVALID_ARGUMENT:It(),MUST_BE_CALL_SETUP_TOP:It(),NOT_INSTALLED:It(),NOT_AVAILABLE_IN_LEGACY_MODE:It(),REQUIRED_VALUE:It(),INVALID_VALUE:It(),CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:It(),NOT_INSTALLED_WITH_PROVIDE:It(),UNEXPECTED_ERROR:It(),NOT_COMPATIBLE_LEGACY_VUE_I18N:It(),BRIDGE_SUPPORT_VUE_2_ONLY:It(),MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION:It(),NOT_AVAILABLE_COMPOSITION_IN_LEGACY:It(),__EXTEND_POINT__:It()};function Cn(t,...e){return Io(t,null,process.env.NODE_ENV!=="production"?{messages:Ry,args:e}:void 0)}const Ry={[Je.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[Je.INVALID_ARGUMENT]:"Invalid argument",[Je.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[Je.NOT_INSTALLED]:"Need to install with `app.use` function",[Je.UNEXPECTED_ERROR]:"Unexpected error",[Je.NOT_AVAILABLE_IN_LEGACY_MODE]:"Not available in legacy mode",[Je.REQUIRED_VALUE]:"Required in value: {0}",[Je.INVALID_VALUE]:"Invalid value",[Je.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[Je.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[Je.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[Je.BRIDGE_SUPPORT_VUE_2_ONLY]:"vue-i18n-bridge support Vue 2.x only",[Je.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION]:"Must define ‘i18n’ option or custom block in Composition API with using local scope in Legacy API mode",[Je.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]:"Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly"},_a=fn("__translateVNode"),Aa=fn("__datetimeParts"),Ma=fn("__numberParts"),br=fn("__enableEmitter"),Ia=fn("__disableEmitter"),Py=fn("__setPluralRules"),Ly=fn("__injectWithOption"),Oa=fn("__dispose");function yr(t){if(!Re(t)||jt(t))return t;for(const e in t)if(nn(t,e))if(!e.includes("."))Re(t[e])&&yr(t[e]);else{const n=e.split("."),o=n.length-1;let r=t,i=!1;for(let s=0;s<o;s++){if(n[s]==="__proto__")throw new Error(`unsafe key: ${n[s]}`);if(n[s]in r||(r[n[s]]=Be()),!Re(r[n[s]])){process.env.NODE_ENV!=="production"&&un(Ci(Mt.IGNORE_OBJ_FLATTEN,{key:n[s]})),i=!0;break}r=r[n[s]]}if(i||(jt(r)?_d.includes(n[o])||delete t[e]:(r[n[o]]=t[e],delete t[e])),!jt(r)){const s=r[n[o]];Re(s)&&yr(s)}}return t}function hu(t,e){const{messages:n,__i18n:o,messageResolver:r,flatJson:i}=e,s=$e(n)?n:tt(o)?Be():{[t]:Be()};if(tt(o)&&o.forEach(l=>{if("locale"in l&&"resource"in l){const{locale:c,resource:d}=l;c?(s[c]=s[c]||Be(),bi(d,s[c])):bi(d,s)}else he(l)&&bi(JSON.parse(l),s)}),r==null&&i)for(const l in s)nn(s,l)&&yr(s[l]);return s}function mu(t){return t.type}function $y(t,e,n){let o=Re(e.messages)?e.messages:Be();"__i18nGlobal"in n&&(o=hu(t.locale.value,{messages:o,__i18n:n.__i18nGlobal}));const r=Object.keys(o);r.length&&r.forEach(i=>{t.mergeLocaleMessage(i,o[i])});{if(Re(e.datetimeFormats)){const i=Object.keys(e.datetimeFormats);i.length&&i.forEach(s=>{t.mergeDateTimeFormat(s,e.datetimeFormats[s])})}if(Re(e.numberFormats)){const i=Object.keys(e.numberFormats);i.length&&i.forEach(s=>{t.mergeNumberFormat(s,e.numberFormats[s])})}}}function gu(t){return a.createVNode(a.Text,null,t,0)}const bu="__INTLIFY_META__",yu=()=>[],Vy=()=>!1;let xu=0;function Eu(t){return((e,n,o,r)=>t(n,o,a.getCurrentInstance()||void 0,r))}const By=()=>{const t=a.getCurrentInstance();let e=null;return t&&(e=mu(t)[bu])?{[bu]:e}:null};function ku(t={},e){const{__root:n,__injectWithOption:o}=t,r=n===void 0,i=t.flatJson,s=wn?a.ref:a.shallowRef,l=!!t.translateExistCompatible;process.env.NODE_ENV!=="production"&&l&&sd(Ci(Mt.NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG));let c=Ke(t.inheritLocale)?t.inheritLocale:!0;const d=s(n&&c?n.locale.value:he(t.locale)?t.locale:wi),u=s(n&&c?n.fallbackLocale.value:he(t.fallbackLocale)||tt(t.fallbackLocale)||$e(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:d.value),f=s(hu(d.value,t)),p=s($e(t.datetimeFormats)?t.datetimeFormats:{[d.value]:{}}),h=s($e(t.numberFormats)?t.numberFormats:{[d.value]:{}});let m=n?n.missingWarn:Ke(t.missingWarn)||pi(t.missingWarn)?t.missingWarn:!0,b=n?n.fallbackWarn:Ke(t.fallbackWarn)||pi(t.fallbackWarn)?t.fallbackWarn:!0,g=n?n.fallbackRoot:Ke(t.fallbackRoot)?t.fallbackRoot:!0,x=!!t.fallbackFormat,v=qe(t.missing)?t.missing:null,w=qe(t.missing)?Eu(t.missing):null,T=qe(t.postTranslation)?t.postTranslation:null,M=n?n.warnHtmlMessage:Ke(t.warnHtmlMessage)?t.warnHtmlMessage:!0,A=!!t.escapeParameter;const y=n?n.modifiers:$e(t.modifiers)?t.modifiers:{};let E=t.pluralRules||n&&n.pluralRules,S;S=(()=>{r&&Hd(null);const B={version:Iy,locale:d.value,fallbackLocale:u.value,messages:f.value,modifiers:y,pluralRules:E,missing:w===null?void 0:w,missingWarn:m,fallbackWarn:b,fallbackFormat:x,unresolving:!0,postTranslation:T===null?void 0:T,warnHtmlMessage:M,escapeParameter:A,messageResolver:t.messageResolver,messageCompiler:t.messageCompiler,__meta:{framework:"vue"}};B.datetimeFormats=p.value,B.numberFormats=h.value,B.__datetimeFormatters=$e(S)?S.__datetimeFormatters:void 0,B.__numberFormatters=$e(S)?S.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(B.__v_emitter=$e(S)?S.__v_emitter:void 0);const ee=py(B);return r&&Hd(ee),ee})(),gr(S,d.value,u.value);function W(){return[d.value,u.value,f.value,p.value,h.value]}const z=a.computed({get:()=>d.value,set:B=>{d.value=B,S.locale=d.value}}),P=a.computed({get:()=>u.value,set:B=>{u.value=B,S.fallbackLocale=u.value,gr(S,d.value,B)}}),V=a.computed(()=>f.value),j=a.computed(()=>p.value),L=a.computed(()=>h.value);function H(){return qe(T)?T:null}function Q(B){T=B,S.postTranslation=B}function G(){return v}function se(B){B!==null&&(w=Eu(B)),v=B,S.missing=w}function Z(B,ee){return B!=="translate"||!ee.resolvedMessage}const X=(B,ee,Me,$,F,re)=>{W();let ae;try{process.env.NODE_ENV,r||(S.fallbackContext=n?fy():void 0),ae=B(S)}finally{process.env.NODE_ENV,r||(S.fallbackContext=void 0)}if(Me!=="translate exists"&&at(ae)&&ae===ki||Me==="translate exists"&&!ae){const[ke,Fe]=ee();if(process.env.NODE_ENV!=="production"&&n&&he(ke)&&Z(Me,Fe)&&(g&&(Ni(b,ke)||Gd(m,ke))&&un(Ci(Mt.FALLBACK_TO_ROOT,{key:ke,type:Me})),process.env.NODE_ENV!=="production")){const{__v_emitter:st}=S;st&&g&&st.emit("fallback",{type:Me,key:ke,to:"global",groupId:`${Me}:${ke}`})}return n&&g?$(n):F(ke)}else{if(re(ae))return ae;throw Cn(Je.UNEXPECTED_RETURN_TYPE)}};function J(...B){return X(ee=>Reflect.apply(eu,null,[ee,...B]),()=>Ca(...B),"translate",ee=>Reflect.apply(ee.t,ee,[...B]),ee=>ee,ee=>he(ee))}function K(...B){const[ee,Me,$]=B;if($&&!Re($))throw Cn(Je.INVALID_ARGUMENT);return J(ee,Me,yt({resolvedMessage:!0},$||{}))}function Y(...B){return X(ee=>Reflect.apply(iu,null,[ee,...B]),()=>va(...B),"datetime format",ee=>Reflect.apply(ee.d,ee,[...B]),()=>Si,ee=>he(ee))}function ce(...B){return X(ee=>Reflect.apply(lu,null,[ee,...B]),()=>Ta(...B),"number format",ee=>Reflect.apply(ee.n,ee,[...B]),()=>Si,ee=>he(ee))}function Ee(B){return B.map(ee=>he(ee)||at(ee)||Ke(ee)?gu(String(ee)):ee)}const Le={normalize:Ee,interpolate:B=>B,type:"vnode"};function C(...B){return X(ee=>{let Me;const $=ee;try{$.processor=Le,Me=Reflect.apply(eu,null,[$,...B])}finally{$.processor=null}return Me},()=>Ca(...B),"translate",ee=>ee[_a](...B),ee=>[gu(ee)],ee=>tt(ee))}function N(...B){return X(ee=>Reflect.apply(lu,null,[ee,...B]),()=>Ta(...B),"number format",ee=>ee[Ma](...B),yu,ee=>he(ee)||tt(ee))}function O(...B){return X(ee=>Reflect.apply(iu,null,[ee,...B]),()=>va(...B),"datetime format",ee=>ee[Aa](...B),yu,ee=>he(ee)||tt(ee))}function k(B){E=B,S.pluralRules=E}function U(B,ee){return X(()=>{if(!B)return!1;const Me=he(ee)?ee:d.value,$=ve(Me),F=S.messageResolver($,B);return l?F!=null:jt(F)||Ut(F)||he(F)},()=>[B],"translate exists",Me=>Reflect.apply(Me.te,Me,[B,ee]),Vy,Me=>Ke(Me))}function te(B){let ee=null;const Me=Rd(S,u.value,d.value);for(let $=0;$<Me.length;$++){const F=f.value[Me[$]]||{},re=S.messageResolver(F,B);if(re!=null){ee=re;break}}return ee}function me(B){const ee=te(B);return ee??(n?n.tm(B)||{}:{})}function ve(B){return f.value[B]||{}}function Ve(B,ee){if(i){const Me={[B]:ee};for(const $ in Me)nn(Me,$)&&yr(Me[$]);ee=Me[B]}f.value[B]=ee,S.messages=f.value}function Ce(B,ee){f.value[B]=f.value[B]||{};const Me={[B]:ee};if(i)for(const $ in Me)nn(Me,$)&&yr(Me[$]);ee=Me[B],bi(ee,f.value[B]),S.messages=f.value}function _(B){return p.value[B]||{}}function I(B,ee){p.value[B]=ee,S.datetimeFormats=p.value,au(S,B,ee)}function q(B,ee){p.value[B]=yt(p.value[B]||{},ee),S.datetimeFormats=p.value,au(S,B,ee)}function fe(B){return h.value[B]||{}}function Ae(B,ee){h.value[B]=ee,S.numberFormats=h.value,du(S,B,ee)}function Te(B,ee){h.value[B]=yt(h.value[B]||{},ee),S.numberFormats=h.value,du(S,B,ee)}xu++,n&&wn&&(a.watch(n.locale,B=>{c&&(d.value=B,S.locale=B,gr(S,d.value,u.value))}),a.watch(n.fallbackLocale,B=>{c&&(u.value=B,S.fallbackLocale=B,gr(S,d.value,u.value))}));const we={id:xu,locale:z,fallbackLocale:P,get inheritLocale(){return c},set inheritLocale(B){c=B,B&&n&&(d.value=n.locale.value,u.value=n.fallbackLocale.value,gr(S,d.value,u.value))},get availableLocales(){return Object.keys(f.value).sort()},messages:V,get modifiers(){return y},get pluralRules(){return E||{}},get isGlobal(){return r},get missingWarn(){return m},set missingWarn(B){m=B,S.missingWarn=m},get fallbackWarn(){return b},set fallbackWarn(B){b=B,S.fallbackWarn=b},get fallbackRoot(){return g},set fallbackRoot(B){g=B},get fallbackFormat(){return x},set fallbackFormat(B){x=B,S.fallbackFormat=x},get warnHtmlMessage(){return M},set warnHtmlMessage(B){M=B,S.warnHtmlMessage=B},get escapeParameter(){return A},set escapeParameter(B){A=B,S.escapeParameter=B},t:J,getLocaleMessage:ve,setLocaleMessage:Ve,mergeLocaleMessage:Ce,getPostTranslationHandler:H,setPostTranslationHandler:Q,getMissingHandler:G,setMissingHandler:se,[Py]:k};return we.datetimeFormats=j,we.numberFormats=L,we.rt=K,we.te=U,we.tm=me,we.d=Y,we.n=ce,we.getDateTimeFormat=_,we.setDateTimeFormat=I,we.mergeDateTimeFormat=q,we.getNumberFormat=fe,we.setNumberFormat=Ae,we.mergeNumberFormat=Te,we[Ly]=o,we[_a]=C,we[Aa]=O,we[Ma]=N,process.env.NODE_ENV!=="production"&&(we[br]=B=>{S.__v_emitter=B},we[Ia]=()=>{S.__v_emitter=void 0}),we}const Da={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:t=>t==="parent"||t==="global",default:"parent"},i18n:{type:Object}};function Fy({slots:t},e){return e.length===1&&e[0]==="default"?(t.default?t.default():[]).reduce((o,r)=>[...o,...r.type===a.Fragment?r.children:[r]],[]):e.reduce((n,o)=>{const r=t[o];return r&&(n[o]=r()),n},Be())}function wu(t){return a.Fragment}yt({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:t=>at(t)||!isNaN(t)}},Da);function jy(t){return tt(t)&&!he(t[0])}function Su(t,e,n,o){const{slots:r,attrs:i}=e;return()=>{const s={part:!0};let l=Be();t.locale&&(s.locale=t.locale),he(t.format)?s.key=t.format:Re(t.format)&&(he(t.format.key)&&(s.key=t.format.key),l=Object.keys(t.format).reduce((p,h)=>n.includes(h)?yt(Be(),p,{[h]:t.format[h]}):p,Be()));const c=o(t.value,s,l);let d=[s.key];tt(c)?d=c.map((p,h)=>{const m=r[p.type],b=m?m({[p.type]:p.value,index:h,parts:c}):[p.value];return jy(b)&&(b[0].key=`${p.type}-${h}`),b}):he(c)&&(d=[c]);const u=yt(Be(),i),f=he(t.tag)||Re(t.tag)?t.tag:wu();return a.h(f,u,d)}}yt({value:{type:Number,required:!0},format:{type:[String,Object]}},Da),yt({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},Da);const Ra={"vue-devtools-plugin-vue-i18n":"Vue I18n devtools","vue-i18n-resource-inspector":"I18n Resources","vue-i18n-timeline":"Vue I18n"},Uy={"vue-i18n-resource-inspector":"Search for scopes ..."},Hy={"vue-i18n-timeline":16764185},Nu="vue-i18n: composer properties";let Pa;async function Wy(t,e){return new Promise((n,o)=>{try{My({id:"vue-devtools-plugin-vue-i18n",label:Ra["vue-devtools-plugin-vue-i18n"],packageName:"vue-i18n",homepage:"https://vue-i18n.intlify.dev",logo:"https://vue-i18n.intlify.dev/vue-i18n-devtools-logo.png",componentStateTypes:[Nu],app:t},r=>{Pa=r,r.on.visitComponentTree(({componentInstance:s,treeNode:l})=>{Gy(s,l,e)}),r.on.inspectComponent(({componentInstance:s,instanceData:l})=>{s.vnode.el&&s.vnode.el.__VUE_I18N__&&l&&(e.mode==="legacy"?s.vnode.el.__VUE_I18N__!==e.global.__composer&&vu(l,s.vnode.el.__VUE_I18N__):vu(l,s.vnode.el.__VUE_I18N__))}),r.addInspector({id:"vue-i18n-resource-inspector",label:Ra["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:Uy["vue-i18n-resource-inspector"]}),r.on.getInspectorTree(s=>{s.app===t&&s.inspectorId==="vue-i18n-resource-inspector"&&Yy(s,e)});const i=new Map;r.on.getInspectorState(async s=>{if(s.app===t&&s.inspectorId==="vue-i18n-resource-inspector")if(r.unhighlightElement(),Zy(s,e),s.nodeId==="global"){if(!i.has(s.app)){const[l]=await r.getComponentInstances(s.app);i.set(s.app,l)}r.highlightElement(i.get(s.app))}else{const l=Qy(s.nodeId,e);l&&r.highlightElement(l)}}),r.on.editInspectorState(s=>{s.app===t&&s.inspectorId==="vue-i18n-resource-inspector"&&t1(s,e)}),r.addTimelineLayer({id:"vue-i18n-timeline",label:Ra["vue-i18n-timeline"],color:Hy["vue-i18n-timeline"]}),n(!0)})}catch(r){console.error(r),o(!1)}})}function Cu(t){return t.type.name||t.type.displayName||t.type.__file||"Anonymous"}function Gy(t,e,n){const o=n.mode==="composition"?n.global:n.global.__composer;if(t&&t.vnode.el&&t.vnode.el.__VUE_I18N__&&t.vnode.el.__VUE_I18N__!==o){const r={label:`i18n (${Cu(t)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(r)}}function vu(t,e){const n=Nu;t.state.push({type:n,key:"locale",editable:!0,value:e.locale.value}),t.state.push({type:n,key:"availableLocales",editable:!1,value:e.availableLocales}),t.state.push({type:n,key:"fallbackLocale",editable:!0,value:e.fallbackLocale.value}),t.state.push({type:n,key:"inheritLocale",editable:!0,value:e.inheritLocale}),t.state.push({type:n,key:"messages",editable:!1,value:La(e.messages.value)}),t.state.push({type:n,key:"datetimeFormats",editable:!1,value:e.datetimeFormats.value}),t.state.push({type:n,key:"numberFormats",editable:!1,value:e.numberFormats.value})}function La(t){const e={};return Object.keys(t).forEach(n=>{const o=t[n];qe(o)&&"source"in o?e[n]=Xy(o):jt(o)&&o.loc&&o.loc.source?e[n]=o.loc.source:Re(o)?e[n]=La(o):e[n]=o}),e}const qy={"<":"&lt;",">":"&gt;",'"':"&quot;","&":"&amp;"};function Ky(t){return t.replace(/[<>"&]/g,Jy)}function Jy(t){return qy[t]||t}function Xy(t){return{_custom:{type:"function",display:`<span>ƒ</span> ${t.source?`("${Ky(t.source)}")`:"(?)"}`}}}function Yy(t,e){t.rootNodes.push({id:"global",label:"Global Scope"});const n=e.mode==="composition"?e.global:e.global.__composer;for(const[o,r]of e.__instances){const i=e.mode==="composition"?r:r.__composer;n!==i&&t.rootNodes.push({id:i.id.toString(),label:`${Cu(o)} Scope`})}}function Qy(t,e){let n=null;if(t!=="global"){for(const[o,r]of e.__instances.entries())if(r.id.toString()===t){n=o;break}}return n}function Tu(t,e){if(t==="global")return e.mode==="composition"?e.global:e.global.__composer;{const n=Array.from(e.__instances.values()).find(o=>o.id.toString()===t);return n?e.mode==="composition"?n:n.__composer:null}}function Zy(t,e){const n=Tu(t.nodeId,e);return n&&(t.state=e1(n)),null}function e1(t){const e={},n="Locale related info",o=[{type:n,key:"locale",editable:!0,value:t.locale.value},{type:n,key:"fallbackLocale",editable:!0,value:t.fallbackLocale.value},{type:n,key:"availableLocales",editable:!1,value:t.availableLocales},{type:n,key:"inheritLocale",editable:!0,value:t.inheritLocale}];e[n]=o;const r="Locale messages info",i=[{type:r,key:"messages",editable:!1,value:La(t.messages.value)}];e[r]=i;{const s="Datetime formats info",l=[{type:s,key:"datetimeFormats",editable:!1,value:t.datetimeFormats.value}];e[s]=l;const c="Datetime formats info",d=[{type:c,key:"numberFormats",editable:!1,value:t.numberFormats.value}];e[c]=d}return e}function $a(t,e){if(Pa){let n;e&&"groupId"in e&&(n=e.groupId,delete e.groupId),Pa.addTimelineEvent({layerId:"vue-i18n-timeline",event:{title:t,groupId:n,time:Date.now(),meta:{},data:e||{},logType:t==="compile-error"?"error":t==="fallback"||t==="missing"?"warning":"default"}})}}function t1(t,e){const n=Tu(t.nodeId,e);if(n){const[o]=t.path;o==="locale"&&he(t.state.value)?n.locale.value=t.state.value:o==="fallbackLocale"&&(he(t.state.value)||tt(t.state.value)||Re(t.state.value))?n.fallbackLocale.value=t.state.value:o==="inheritLocale"&&Ke(t.state.value)&&(n.inheritLocale=t.state.value)}}const n1=fn("global-vue-i18n");function o1(t={},e){const n=Ke(t.globalInjection)?t.globalInjection:!0,o=!0,r=new Map,[i,s]=r1(t),l=fn(process.env.NODE_ENV!=="production"?"vue-i18n":"");process.env.NODE_ENV;function c(f){return r.get(f)||null}function d(f,p){r.set(f,p)}function u(f){r.delete(f)}{const f={get mode(){return"composition"},get allowComposition(){return o},async install(p,...h){if(process.env.NODE_ENV!=="production"&&(p.__VUE_I18N__=f),p.__VUE_I18N_SYMBOL__=l,p.provide(p.__VUE_I18N_SYMBOL__,f),$e(h[0])){const g=h[0];f.__composerExtend=g.__composerExtend,f.__vueI18nExtend=g.__vueI18nExtend}let m=null;n&&(m=f1(p,f.global));const b=p.unmount;if(p.unmount=()=>{m&&m(),f.dispose(),b()},process.env.NODE_ENV!=="production"){if(!await Wy(p,f))throw Cn(Je.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const x=pd();{const v=s;v[br]&&v[br](x)}x.on("*",$a)}},get global(){return s},dispose(){i.stop()},__instances:r,__getInstance:c,__setInstance:d,__deleteInstance:u};return f}}function rn(t={}){const e=a.getCurrentInstance();if(e==null)throw Cn(Je.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw Cn(Je.NOT_INSTALLED);const n=i1(e),o=a1(n),r=mu(e),i=s1(t,r);if(i==="global")return $y(o,t,r),o;if(i==="parent"){let c=l1(n,e,t.__useComponent);return c==null&&(process.env.NODE_ENV!=="production"&&un(Ci(Mt.NOT_FOUND_PARENT_SCOPE)),c=o),c}const s=n;let l=s.__getInstance(e);if(l==null){const c=yt({},t);"__i18n"in r&&(c.__i18n=r.__i18n),o&&(c.__root=o),l=ku(c),s.__composerExtend&&(l[Oa]=s.__composerExtend(l)),d1(s,e,l),s.__setInstance(e,l)}return l}function r1(t,e,n){const o=a.effectScope();{const r=o.run(()=>ku(t));if(r==null)throw Cn(Je.UNEXPECTED_ERROR);return[o,r]}}function i1(t){{const e=a.inject(t.isCE?n1:t.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw Cn(t.isCE?Je.NOT_INSTALLED_WITH_PROVIDE:Je.UNEXPECTED_ERROR);return e}}function s1(t,e){return hi(t)?"__i18n"in e?"local":"global":t.useScope?t.useScope:"local"}function a1(t){return t.mode==="composition"?t.global:t.global.__composer}function l1(t,e,n=!1){let o=null;const r=e.root;let i=c1(e,n);for(;i!=null;){const s=t;if(t.mode==="composition"&&(o=s.__getInstance(i)),o!=null||r===i)break;i=i.parent}return o}function c1(t,e=!1){return t==null?null:e&&t.vnode.ctx||t.parent}function d1(t,e,n){let o=null;a.onMounted(()=>{if(process.env.NODE_ENV!=="production"&&e.vnode.el){e.vnode.el.__VUE_I18N__=n,o=pd();const r=n;r[br]&&r[br](o),o.on("*",$a)}},e),a.onUnmounted(()=>{const r=n;process.env.NODE_ENV!=="production"&&e.vnode.el&&e.vnode.el.__VUE_I18N__&&(o&&o.off("*",$a),r[Ia]&&r[Ia](),delete e.vnode.el.__VUE_I18N__),t.__deleteInstance(e);const i=r[Oa];i&&(i(),delete r[Oa])},e)}const u1=["locale","fallbackLocale","availableLocales"],zu=["t","rt","d","n","tm","te"];function f1(t,e){const n=Object.create(null);return u1.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i)throw Cn(Je.UNEXPECTED_ERROR);const s=a.isRef(i.value)?{get(){return i.value.value},set(l){i.value.value=l}}:{get(){return i.get&&i.get()}};Object.defineProperty(n,r,s)}),t.config.globalProperties.$i18n=n,zu.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i||!i.value)throw Cn(Je.UNEXPECTED_ERROR);Object.defineProperty(t.config.globalProperties,`$${r}`,i)}),()=>{delete t.config.globalProperties.$i18n,zu.forEach(r=>{delete t.config.globalProperties[`$${r}`]})}}if(Oy(),__INTLIFY_JIT_COMPILATION__?Vd(yy):Vd(by),ly(jb),cy(Rd),process.env.NODE_ENV!=="production"){const t=pr();t.__INTLIFY__=!0,Yb(t.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const _u="zcode-user-settings";function Lo(){try{const t=localStorage.getItem(_u);return t?JSON.parse(t):{}}catch(t){return console.warn("[ZeroCode] Failed to load user settings:",t),{}}}function Va(t){try{const e=Lo(),n={locale:t.locale??e.locale,cms:t.cms?{...e.cms||{},...t.cms}:e.cms,dev:t.dev?{...e.dev||{},...t.dev}:e.dev};localStorage.setItem(_u,JSON.stringify(n))}catch(e){console.warn("[ZeroCode] Failed to save user settings:",e)}}function p1(t=null){const e=Lo();return e.locale!==void 0?e.locale:t}function Au(){return Lo().cms||{}}function vi(t){const e=Lo();Va({cms:{...e.cms,...t}})}function h1(t,e){return Au()[t]??e}function Mu(){return Lo().dev||{}}function Ba(t){const e=Lo();Va({dev:{...e.dev,...t}})}function m1(t,e){return Mu()[t]??e}const Iu="zcode-dont-show-css-warning-parts";function g1(){try{return sessionStorage.getItem(Iu)==="true"}catch{return!1}}function b1(t){try{sessionStorage.setItem(Iu,String(t))}catch(e){console.warn("[ZeroCode] Failed to save CSS warning setting:",e)}}const y1={class:"zcode-settings-panel-header"},x1={class:"zcode-settings-panel-header-title",role:"heading","aria-level":"3"},E1={class:"zcode-settings-panel-header-actions"},k1=["value","aria-label"],w1={value:"ja"},S1={value:"en"},N1={class:"zcode-settings-panel-content"},C1={key:0},v1={key:0,class:"zcode-setting-item"},T1={class:"zcode-setting-label"},z1=["checked"],_1=["title"],A1={key:0,class:"zcode-setting-description"},M1={key:1,class:"zcode-setting-item"},I1={class:"zcode-setting-label"},O1=["checked"],D1=["title"],R1={key:0,class:"zcode-setting-description"},P1={key:2,class:"zcode-setting-item"},L1={class:"zcode-setting-label"},$1=["checked"],V1=["title"],B1={key:0,class:"zcode-setting-description"},F1={key:3,class:"zcode-setting-item"},j1={class:"zcode-setting-label"},U1=["checked"],H1=["title"],W1={key:0,class:"zcode-setting-description"},G1={key:1,class:"zcode-setting-item"},q1={class:"zcode-setting-info"},Ou=a.defineComponent({__name:"SettingsPanel",props:{isOpen:{type:Boolean},viewMode:{type:String},mode:{type:String},allowDynamicContentInteraction:{type:Boolean},devRightPadding:{type:Boolean},enableContextMenu:{type:Boolean},showSaveConfirm:{type:Boolean}},emits:["close","toggle-dynamic-content","toggle-dev-padding","toggle-context-menu","toggle-save-confirm"],setup(t){const e=t,{locale:n}=rn(),o=a.computed(()=>n.value||"ja");function r(u){const p=u.target.value;n.value=p,Va({locale:p})}const i=a.ref(!1),s=a.ref(!1),l=a.ref(!1),c=a.ref(!1),d=a.computed(()=>e.devRightPadding!==void 0?e.devRightPadding:!1);return(u,f)=>t.isOpen?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-settings-panel-overlay",onClick:f[10]||(f[10]=a.withModifiers(p=>u.$emit("close"),["self"]))},[a.createElementVNode("div",{class:"zcode-settings-panel",onClick:f[9]||(f[9]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",y1,[a.createElementVNode("div",x1,a.toDisplayString(u.$t("settings.title")),1),a.createElementVNode("div",E1,[a.createElementVNode("select",{value:o.value,class:"zcode-language-select","aria-label":u.$t("settings.language.label"),onChange:r},[a.createElementVNode("option",w1,a.toDisplayString(u.$t("settings.language.ja")),1),a.createElementVNode("option",S1,a.toDisplayString(u.$t("settings.language.en")),1)],40,k1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":"$t('common.close')",onClick:f[0]||(f[0]=p=>u.$emit("close"))},[a.createVNode(a.unref(Qe),{size:18})])])]),a.createElementVNode("div",N1,[t.viewMode==="manage"?(a.openBlock(),a.createElementBlock("div",C1,[e.mode==="toolbar"||e.mode===void 0?(a.openBlock(),a.createElementBlock("div",v1,[a.createElementVNode("label",T1,[a.createElementVNode("input",{type:"checkbox",checked:e.allowDynamicContentInteraction??!1,class:"zcode-setting-checkbox",onChange:f[1]||(f[1]=p=>u.$emit("toggle-dynamic-content",p.target.checked))},null,40,z1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.enableDynamicContent")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[2]||(f[2]=a.withModifiers(p=>i.value=!i.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,_1)]),i.value?(a.openBlock(),a.createElementBlock("div",A1,a.toDisplayString(u.$t("settings.enableDynamicContentDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),e.mode==="toolbar"||e.mode===void 0?(a.openBlock(),a.createElementBlock("div",M1,[a.createElementVNode("label",I1,[a.createElementVNode("input",{type:"checkbox",checked:d.value,class:"zcode-setting-checkbox",onChange:f[3]||(f[3]=p=>u.$emit("toggle-dev-padding",p.target.checked))},null,40,O1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.devRightPadding")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[4]||(f[4]=a.withModifiers(p=>s.value=!s.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,D1)]),s.value?(a.openBlock(),a.createElementBlock("div",R1,a.toDisplayString(u.$t("settings.devRightPaddingDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),e.mode==="toolbar"||e.mode===void 0?(a.openBlock(),a.createElementBlock("div",P1,[a.createElementVNode("label",L1,[a.createElementVNode("input",{type:"checkbox",checked:e.enableContextMenu??!1,class:"zcode-setting-checkbox",onChange:f[5]||(f[5]=p=>u.$emit("toggle-context-menu",p.target.checked))},null,40,$1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.enableContextMenu")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[6]||(f[6]=a.withModifiers(p=>l.value=!l.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,V1)]),l.value?(a.openBlock(),a.createElementBlock("div",B1,a.toDisplayString(u.$t("settings.enableContextMenuDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),e.mode==="dev-tabs"?(a.openBlock(),a.createElementBlock("div",F1,[a.createElementVNode("label",j1,[a.createElementVNode("input",{type:"checkbox",checked:e.showSaveConfirm??!0,class:"zcode-setting-checkbox",onChange:f[7]||(f[7]=p=>u.$emit("toggle-save-confirm",p.target.checked))},null,40,U1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.showSaveConfirm")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[8]||(f[8]=a.withModifiers(p=>c.value=!c.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,H1)]),c.value?(a.openBlock(),a.createElementBlock("div",W1,a.toDisplayString(u.$t("settings.showSaveConfirmDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)])):(a.openBlock(),a.createElementBlock("div",G1,[a.createElementVNode("div",q1,a.toDisplayString(u.$t("settings.previewModeInfo")),1)]))])])])):a.createCommentVNode("",!0)}});function pt(t){this.content=t}pt.prototype={constructor:pt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var o=n&&n!=t?this.remove(n):this,r=o.find(t),i=o.content.slice();return r==-1?i.push(n||t,e):(i[r+1]=e,n&&(i[r]=n)),new pt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new pt(n)},addToStart:function(t,e){return new pt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new pt(n)},addBefore:function(t,e,n){var o=this.remove(e),r=o.content.slice(),i=o.find(t);return r.splice(i==-1?r.length:i,0,e,n),new pt(r)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=pt.from(t),t.size?new pt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=pt.from(t),t.size?new pt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=pt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},pt.from=function(t){if(t instanceof pt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new pt(e)};function Du(t,e,n){for(let o=0;;o++){if(o==t.childCount||o==e.childCount)return t.childCount==e.childCount?null:n;let r=t.child(o),i=e.child(o);if(r==i){n+=r.nodeSize;continue}if(!r.sameMarkup(i))return n;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)n++;return n}if(r.content.size||i.content.size){let s=Du(r.content,i.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function Ru(t,e,n,o){for(let r=t.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:n,b:o};let s=t.child(--r),l=e.child(--i),c=s.nodeSize;if(s==l){n-=c,o-=c;continue}if(!s.sameMarkup(l))return{a:n,b:o};if(s.isText&&s.text!=l.text){let d=0,u=Math.min(s.text.length,l.text.length);for(;d<u&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,n--,o--;return{a:n,b:o}}if(s.content.size||l.content.size){let d=Ru(s.content,l.content,n-1,o-1);if(d)return d}n-=c,o-=c}}class ne{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,n,o,r=0,i){for(let s=0,l=0;l<n;s++){let c=this.content[s],d=l+c.nodeSize;if(d>e&&o(c,r+l,i||null,s)!==!1&&c.content.size){let u=l+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,n-u),o,r+u)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,o,r){let i="",s=!0;return this.nodesBetween(e,n,(l,c)=>{let d=l.isText?l.text.slice(Math.max(e,c)-c,n-c):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=d},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(o)&&(r[r.length-1]=n.withText(n.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new ne(r,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let o=[],r=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],c=s+l.nodeSize;c>e&&((s<e||c>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),o.push(l),r+=l.nodeSize),s=c}return new ne(o,r)}cutByIndex(e,n){return e==n?ne.empty:e==0&&n==this.content.length?this:new ne(this.content.slice(e,n))}replaceChild(e,n){let o=this.content[e];if(o==n)return this;let r=this.content.slice(),i=this.size+n.nodeSize-o.nodeSize;return r[e]=n,new ne(r,i)}addToStart(e){return new ne([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new ne(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,o=0;n<this.content.length;n++){let r=this.content[n];e(r,o,n),o+=r.nodeSize}}findDiffStart(e,n=0){return Du(this,e,n)}findDiffEnd(e,n=this.size,o=e.size){return Ru(this,e,n,o)}findIndex(e){if(e==0)return Ti(0,e);if(e==this.size)return Ti(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,o=0;;n++){let r=this.child(n),i=o+r.nodeSize;if(i>=e)return i==e?Ti(n+1,i):Ti(n,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return ne.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new ne(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return ne.empty;let n,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(n||(n=e.slice(0,r)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new ne(n||e,o)}static from(e){if(!e)return ne.empty;if(e instanceof ne)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new ne([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}ne.empty=new ne([],0);const Fa={index:0,offset:0};function Ti(t,e){return Fa.index=t,Fa.offset=e,Fa}function zi(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let o=0;o<t.length;o++)if(!zi(t[o],e[o]))return!1}else{for(let o in t)if(!(o in e)||!zi(t[o],e[o]))return!1;for(let o in e)if(!(o in t))return!1}return!0}let je=class Ac{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,r)),n.push(this),o=!0),n&&n.push(i)}}return n||(n=e.slice()),o||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&zi(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[n.type];if(!o)throw new RangeError(`There is no mark type ${n.type} in this schema`);let r=o.create(n.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(n[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ac.none;if(e instanceof Ac)return[e];let n=e.slice();return n.sort((o,r)=>o.type.rank-r.type.rank),n}};je.none=[];class _i extends Error{}class ue{constructor(e,n,o){this.content=e,this.openStart=n,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let o=Lu(this.content,e+this.openStart,n);return o&&new ue(o,this.openStart,this.openEnd)}removeBetween(e,n){return new ue(Pu(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return ue.empty;let o=n.openStart||0,r=n.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ue(ne.fromJSON(e,n.content),o,r)}static maxOpen(e,n=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)r++;return new ue(e,o,r)}}ue.empty=new ue(ne.empty,0,0);function Pu(t,e,n){let{index:o,offset:r}=t.findIndex(e),i=t.maybeChild(o),{index:s,offset:l}=t.findIndex(n);if(r==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(o!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(o,i.copy(Pu(i.content,e-r-1,n-r-1)))}function Lu(t,e,n,o){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r);if(i==e||s.isText)return o&&!o.canReplace(r,r,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=Lu(s.content,e-i-1,n,s);return l&&t.replaceChild(r,s.copy(l))}function K1(t,e,n){if(n.openStart>t.depth)throw new _i("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new _i("Inconsistent open depths");return $u(t,e,n,0)}function $u(t,e,n,o){let r=t.index(o),i=t.node(o);if(r==e.index(o)&&o<t.depth-n.openStart){let s=$u(t,e,n,o+1);return i.copy(i.content.replaceChild(r,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==o&&e.depth==o){let s=t.parent,l=s.content;return bo(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=J1(n,t);return bo(i,Bu(t,s,l,e,o))}else return bo(i,Ai(t,e,o))}function Vu(t,e){if(!e.type.compatibleContent(t.type))throw new _i("Cannot join "+e.type.name+" onto "+t.type.name)}function ja(t,e,n){let o=t.node(n);return Vu(o,e.node(n)),o}function go(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function xr(t,e,n,o){let r=(e||t).node(n),i=0,s=e?e.index(n):r.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(go(t.nodeAfter,o),i++));for(let l=i;l<s;l++)go(r.child(l),o);e&&e.depth==n&&e.textOffset&&go(e.nodeBefore,o)}function bo(t,e){return t.type.checkContent(e),t.copy(e)}function Bu(t,e,n,o,r){let i=t.depth>r&&ja(t,e,r+1),s=o.depth>r&&ja(n,o,r+1),l=[];return xr(null,t,r,l),i&&s&&e.index(r)==n.index(r)?(Vu(i,s),go(bo(i,Bu(t,e,n,o,r+1)),l)):(i&&go(bo(i,Ai(t,e,r+1)),l),xr(e,n,r,l),s&&go(bo(s,Ai(n,o,r+1)),l)),xr(o,null,r,l),new ne(l)}function Ai(t,e,n){let o=[];if(xr(null,t,n,o),t.depth>n){let r=ja(t,e,n+1);go(bo(r,Ai(t,e,n+1)),o)}return xr(e,null,n,o),new ne(o)}function J1(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)r=e.node(i).copy(ne.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class Er{constructor(e,n,o){this.pos=e,this.path=n,this.parentOffset=o,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let o=this.pos-this.path[this.path.length-1],r=e.child(n);return o?e.child(n).cut(o):r}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let o=this.path[n*3],r=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)r+=o.child(i).nodeSize;return r}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return je.none;if(this.textOffset)return e.child(n).marks;let o=e.maybeChild(n-1),r=e.maybeChild(n);if(!o){let l=o;o=r,r=l}let i=o.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let o=n.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!r||!o[i].isInSet(r.marks))&&(o=o[i--].removeFromSet(o));return o}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!n||n(this.node(o))))return new Mi(this,e,o);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let o=[],r=0,i=n;for(let s=e;;){let{index:l,offset:c}=s.content.findIndex(i),d=i-c;if(o.push(s,l,r+c),!d||(s=s.child(l),s.isText))break;i=d-1,r+=c+1}return new Er(n,o,i)}static resolveCached(e,n){let o=Fu.get(e);if(o)for(let i=0;i<o.elts.length;i++){let s=o.elts[i];if(s.pos==n)return s}else Fu.set(e,o=new X1);let r=o.elts[o.i]=Er.resolve(e,n);return o.i=(o.i+1)%Y1,r}}class X1{constructor(){this.elts=[],this.i=0}}const Y1=12,Fu=new WeakMap;class Mi{constructor(e,n,o){this.$from=e,this.$to=n,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Q1=Object.create(null);let Gn=class Mc{constructor(e,n,o,r=je.none){this.type=e,this.attrs=n,this.marks=r,this.content=o||ne.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,o,r=0){this.content.nodesBetween(e,n,o,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,o,r){return this.content.textBetween(e,n,o,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,o){return this.type==e&&zi(this.attrs,n||e.defaultAttrs||Q1)&&je.sameSet(this.marks,o||je.none)}copy(e=null){return e==this.content?this:new Mc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Mc(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,o=!1){if(e==n)return ue.empty;let r=this.resolve(e),i=this.resolve(n),s=o?0:r.sharedDepth(n),l=r.start(s),d=r.node(s).content.cut(r.pos-l,i.pos-l);return new ue(d,r.depth-s,i.depth-s)}replace(e,n,o){return K1(this.resolve(e),this.resolve(n),o)}nodeAt(e){for(let n=this;;){let{index:o,offset:r}=n.content.findIndex(e);if(n=n.maybeChild(o),!n)return null;if(r==e||n.isText)return n;e-=r+1}}childAfter(e){let{index:n,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(n),index:n,offset:o};let r=this.content.child(n-1);return{node:r,index:n-1,offset:o-r.nodeSize}}resolve(e){return Er.resolveCached(this,e)}resolveNoCache(e){return Er.resolve(this,e)}rangeHasMark(e,n,o){let r=!1;return n>e&&this.nodesBetween(e,n,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),ju(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,o=ne.empty,r=0,i=o.childCount){let s=this.contentMatchAt(e).matchFragment(o,r,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let c=r;c<i;c++)if(!this.type.allowsMarks(o.child(c).marks))return!1;return!0}canReplaceWith(e,n,o,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(o),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=je.none;for(let n=0;n<this.marks.length;n++){let o=this.marks[n];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!je.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let o;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,o)}let r=ne.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};Gn.prototype.text=void 0;class Ii extends Gn{constructor(e,n,o,r){if(super(e,n,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ju(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ii(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ii(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function ju(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class yo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let o=new Z1(e,n);if(o.next==null)return yo.empty;let r=Uu(o);o.next&&o.err("Unexpected trailing text");let i=s0(i0(r));return a0(i,o),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,o=e.childCount){let r=this;for(let i=n;r&&i<o;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let o=0;o<e.next.length;o++)if(this.next[n].type==e.next[o].type)return!0;return!1}fillBefore(e,n=!1,o=0){let r=[this];function i(s,l){let c=s.matchFragment(e,o);if(c&&(!n||c.validEnd))return ne.from(l.map(d=>d.createAndFill()));for(let d=0;d<s.next.length;d++){let{type:u,next:f}=s.next[d];if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(f)==-1){r.push(f);let p=i(f,l.concat(u));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),i=r.match;if(i.matchType(e)){let s=[];for(let l=r;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:c}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!r.type||c.validEnd)&&(o.push({match:l.contentMatch,type:l,via:r}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(o){e.push(o);for(let r=0;r<o.next.length;r++)e.indexOf(o.next[r].next)==-1&&n(o.next[r].next)}return n(this),e.map((o,r)=>{let i=r+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)i+=(s?", ":"")+o.next[s].type.name+"->"+e.indexOf(o.next[s].next);return i}).join(`
349
- `)}}yo.empty=new yo(!0);class Z1{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Uu(t){let e=[];do e.push(e0(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function e0(t){let e=[];do e.push(t0(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function t0(t){let e=r0(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=n0(t,e);else break;return e}function Hu(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function n0(t,e){let n=Hu(t),o=n;return t.eat(",")&&(t.next!="}"?o=Hu(t):o=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:o,expr:e}}function o0(t,e){let n=t.nodeTypes,o=n[e];if(o)return[o];let r=[];for(let i in n){let s=n[i];s.isInGroup(e)&&r.push(s)}return r.length==0&&t.err("No node type or group '"+e+"' found"),r}function r0(t){if(t.eat("(")){let e=Uu(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=o0(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function i0(t){let e=[[]];return r(i(t,0),n()),e;function n(){return e.push([])-1}function o(s,l,c){let d={term:c,to:l};return e[s].push(d),d}function r(s,l){s.forEach(c=>c.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((c,d)=>c.concat(i(d,l)),[]);if(s.type=="seq")for(let c=0;;c++){let d=i(s.exprs[c],l);if(c==s.exprs.length-1)return d;r(d,l=n())}else if(s.type=="star"){let c=n();return o(l,c),r(i(s.expr,c),c),[o(c)]}else if(s.type=="plus"){let c=n();return r(i(s.expr,l),c),r(i(s.expr,c),c),[o(c)]}else{if(s.type=="opt")return[o(l)].concat(i(s.expr,l));if(s.type=="range"){let c=l;for(let d=0;d<s.min;d++){let u=n();r(i(s.expr,c),u),c=u}if(s.max==-1)r(i(s.expr,c),c);else for(let d=s.min;d<s.max;d++){let u=n();o(c,u),r(i(s.expr,c),u),c=u}return[o(c)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Wu(t,e){return e-t}function Gu(t,e){let n=[];return o(e),n.sort(Wu);function o(r){let i=t[r];if(i.length==1&&!i[0].term)return o(i[0].to);n.push(r);for(let s=0;s<i.length;s++){let{term:l,to:c}=i[s];!l&&n.indexOf(c)==-1&&o(c)}}}function s0(t){let e=Object.create(null);return n(Gu(t,0));function n(o){let r=[];o.forEach(s=>{t[s].forEach(({term:l,to:c})=>{if(!l)return;let d;for(let u=0;u<r.length;u++)r[u][0]==l&&(d=r[u][1]);Gu(t,c).forEach(u=>{d||r.push([l,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let i=e[o.join(",")]=new yo(o.indexOf(t.length-1)>-1);for(let s=0;s<r.length;s++){let l=r[s][1].sort(Wu);i.next.push({type:r[s][0],next:e[l.join(",")]||n(l)})}return i}}function a0(t,e){for(let n=0,o=[t];n<o.length;n++){let r=o[n],i=!r.validEnd,s=[];for(let l=0;l<r.next.length;l++){let{type:c,next:d}=r.next[l];s.push(c.name),i&&!(c.isText||c.hasRequiredAttrs())&&(i=!1),o.indexOf(d)==-1&&o.push(d)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function qu(t){let e=Object.create(null);for(let n in t){let o=t[n];if(!o.hasDefault)return null;e[n]=o.default}return e}function Ku(t,e){let n=Object.create(null);for(let o in t){let r=e&&e[o];if(r===void 0){let i=t[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}n[o]=r}return n}function Ju(t,e,n,o){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let r in t){let i=t[r];i.validate&&i.validate(e[r])}}function Xu(t,e){let n=Object.create(null);if(e)for(let o in e)n[o]=new c0(t,o,e[o]);return n}let Yu=class Bm{constructor(e,n,o){this.name=e,this.schema=n,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=Xu(e,o.attrs),this.defaultAttrs=qu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==yo.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:Ku(this.attrs,e)}create(e=null,n,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Gn(this,this.computeAttrs(e),ne.from(n),je.setFrom(o))}createChecked(e=null,n,o){return n=ne.from(n),this.checkContent(n),new Gn(this,this.computeAttrs(e),n,je.setFrom(o))}createAndFill(e=null,n,o){if(e=this.computeAttrs(e),n=ne.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let r=this.contentMatch.matchFragment(n),i=r&&r.fillBefore(ne.empty,!0);return i?new Gn(this,e,n.append(i),je.setFrom(o)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).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){Ju(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?n&&n.push(e[o]):n||(n=e.slice(0,o));return n?n.length?n:je.none:e}static compile(e,n){let o=Object.create(null);e.forEach((i,s)=>o[i]=new Bm(i,n,s));let r=n.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let i in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function l0(t,e,n){let o=n.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${t}, got ${i}`)}}class c0{constructor(e,n,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?l0(e,n,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class Oi{constructor(e,n,o,r){this.name=e,this.rank=n,this.schema=o,this.spec=r,this.attrs=Xu(e,r.attrs),this.excluded=null;let i=qu(this.attrs);this.instance=i?new je(this,i):null}create(e=null){return!e&&this.instance?this.instance:new je(this,Ku(this.attrs,e))}static compile(e,n){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new Oi(i,r++,n,s)),o}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Ju(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Qu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let r in e)n[r]=e[r];n.nodes=pt.from(e.nodes),n.marks=pt.from(e.marks||{}),this.nodes=Yu.compile(this.spec.nodes,this),this.marks=Oi.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=o[s]||(o[s]=yo.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?Zu(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:Zu(this,s.split(" "))}this.nodeFromJSON=r=>Gn.fromJSON(this,r),this.markFromJSON=r=>je.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Yu){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,o,r)}text(e,n){let o=this.nodes.text;return new Ii(o,o.defaultAttrs,e,je.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Zu(t,e){let n=[];for(let o=0;o<e.length;o++){let r=e[o],i=t.marks[r],s=i;if(i)n.push(i);else for(let l in t.marks){let c=t.marks[l];(r=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(r)>-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return n}function d0(t){return t.tag!=null}function u0(t){return t.style!=null}let kr=class Ic{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let o=this.matchedStyles=[];n.forEach(r=>{if(d0(r))this.tags.push(r);else if(u0(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let o=new of(this,n,!1);return o.addAll(e,je.none,n.from,n.to),o.finish()}parseSlice(e,n={}){let o=new of(this,n,!0);return o.addAll(e,je.none,n.from,n.to),ue.maxOpen(o.finish())}matchTag(e,n,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(h0(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let c=s.getAttrs(n);if(c===!1)continue;s.attrs=c||void 0}return s}}}static schemaRules(e){let n=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<i)break}n.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=rf(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=rf(s)),s.node||s.ignore||s.mark||(s.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ic(e,Ic.schemaRules(e)))}};const ef={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},f0={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},tf={ol:!0,ul:!0},wr=1,Ua=2,Sr=4;function nf(t,e,n){return e!=null?(e?wr:0)|(e==="full"?Ua:0):t&&t.whitespace=="pre"?wr|Ua:n&~Sr}class Di{constructor(e,n,o,r,i,s){this.type=e,this.attrs=n,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=je.none,this.match=i||(s&Sr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(ne.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&wr)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let n=ne.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(ne.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ef.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class of{constructor(e,n,o){this.parser=e,this.options=n,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=n.topNode,i,s=nf(null,n.preserveWhitespace,0)|(o?Sr:0);r?i=new Di(r.type,r.attrs,je.none,!0,n.topMatch||r.type.contentMatch,s):o?i=new Di(null,null,je.none,!0,null,s):i=new Di(e.schema.topNodeType,null,je.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let o=e.nodeValue,r=this.top,i=r.options&Ua?"full":this.localPreserveWS||(r.options&wr)>0,{schema:s}=this.parser;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)if(i==="full")o=o.replace(/\r\n?/g,`
347
+ (message compiler warning message: ${t.message})`)}function Qd(t,e={}){let n=!1;const o=e.onError||nb;return e.onError=r=>{n=!0,o(r)},{...Tb(t,e),detectError:n}}const by=(t,e)=>{if(!me(t))throw pn(lt.NOT_SUPPORT_NON_STRING_MESSAGE);process.env.NODE_ENV!=="production"&&(e.onWarn=Yd);{const n=Ke(e.warnHtmlMessage)?e.warnHtmlMessage:!0;process.env.NODE_ENV!=="production"&&Jd(t,n);const r=(e.onCacheKey||Xd)(t),i=Ro[r];if(i)return i;const{code:s,detectError:l}=Qd(t,e),c=new Function(`return ${s}`)();return l?c:Ro[r]=c}};function yy(t,e){if(process.env.NODE_ENV!=="production"&&(e.onWarn=Yd),__INTLIFY_JIT_COMPILATION__&&!__INTLIFY_DROP_MESSAGE_COMPILER__&&me(t)){const n=Ke(e.warnHtmlMessage)?e.warnHtmlMessage:!0;process.env.NODE_ENV!=="production"&&Jd(t,n);const r=(e.onCacheKey||Xd)(t),i=Ro[r];if(i)return i;const{ast:s,detectError:l}=Qd(t,{...e,location:process.env.NODE_ENV!=="production",jit:!0}),c=Sa(s);return l?c:Ro[r]=c}else{if(process.env.NODE_ENV!=="production"&&!jt(t))return un(`the message that is resolve with key '${e.key}' is not supported for jit compilation`),(()=>t);const n=t.cacheKey;if(n){const o=Ro[n];return o||(Ro[n]=Sa(t))}else return Sa(t)}}const Zd=()=>"",Ut=t=>qe(t);function eu(t,...e){const{fallbackFormat:n,postTranslation:o,unresolving:r,messageCompiler:i,fallbackLocale:s,messages:l}=t,[c,d]=Ca(...e),u=Ke(d.missingWarn)?d.missingWarn:t.missingWarn,f=Ke(d.fallbackWarn)?d.fallbackWarn:t.fallbackWarn,p=Ke(d.escapeParameter)?d.escapeParameter:t.escapeParameter,h=!!d.resolvedMessage,m=me(d.default)||Ke(d.default)?Ke(d.default)?i?c:()=>c:d.default:n?i?c:()=>c:"",b=n||m!=="",g=xa(t,d);p&&xy(d);let[x,v,w]=h?[c,g,l[g]||Be()]:tu(t,c,g,s,f,u),T=x,M=c;if(!h&&!(me(T)||jt(T)||Ut(T))&&b&&(T=m,M=T),!h&&(!(me(T)||jt(T)||Ut(T))||!me(v)))return r?ki:c;if(process.env.NODE_ENV!=="production"&&me(T)&&t.messageCompiler==null)return un(`The message format compilation is not supported in this build. Because message compiler isn't included. You need to pre-compilation all message format. So translate function return '${c}'.`),c;let A=!1;const y=()=>{A=!0},E=Ut(T)?T:nu(t,c,v,T,M,y);if(A)return T;const k=Sy(t,v,w,d),O=Xb(k),G=Ey(t,E,O);let z=o?o(G,c):G;if(p&&me(z)&&(z=Hg(z)),process.env.NODE_ENV!=="production"){const R={timestamp:Date.now(),key:me(c)?c:Ut(T)?T.key:"",locale:v||(Ut(T)?T.locale:""),format:me(T)?T:Ut(T)?T.source:"",message:z};R.meta=yt({},t.__meta,uy()||{}),Zb(R)}return z}function xy(t){tt(t.list)?t.list=t.list.map(e=>me(e)?ld(e):e):Pe(t.named)&&Object.keys(t.named).forEach(e=>{me(t.named[e])&&(t.named[e]=ld(t.named[e]))})}function tu(t,e,n,o,r,i){const{messages:s,onWarn:l,messageResolver:c,localeFallbacker:d}=t,u=d(t,o,n);let f=Be(),p,h=null,m=n,b=null;const g="translate";for(let x=0;x<u.length;x++){if(p=b=u[x],process.env.NODE_ENV!=="production"&&n!==p&&!qd(n,p)&&Ni(r,e)&&l(ho(Tt.FALLBACK_TO_TRANSLATE,{key:e,target:p})),process.env.NODE_ENV!=="production"&&n!==p){const M=t.__v_emitter;M&&M.emit("fallback",{type:g,key:e,from:m,to:b,groupId:`${g}:${e}`})}f=s[p]||Be();let v=null,w,T;if(process.env.NODE_ENV!=="production"&&wn&&(v=window.performance.now(),w="intlify-message-resolve-start",T="intlify-message-resolve-end",$t&&$t(w)),(h=c(f,e))===null&&(h=f[e]),process.env.NODE_ENV!=="production"&&wn){const M=window.performance.now(),A=t.__v_emitter;A&&v&&h&&A.emit("message-resolve",{type:"message-resolve",key:e,message:h,time:M-v,groupId:`${g}:${e}`}),w&&T&&$t&&fo&&($t(T),fo("intlify message resolve",w,T))}if(me(h)||jt(h)||Ut(h))break;if(!hy(p,u)){const M=wa(t,e,p,i,g);M!==e&&(h=M)}m=b}return[h,p,f]}function nu(t,e,n,o,r,i){const{messageCompiler:s,warnHtmlMessage:l}=t;if(Ut(o)){const p=o;return p.locale=p.locale||n,p.key=p.key||e,p}if(s==null){const p=(()=>o);return p.locale=n,p.key=e,p}let c=null,d,u;process.env.NODE_ENV!=="production"&&wn&&(c=window.performance.now(),d="intlify-message-compilation-start",u="intlify-message-compilation-end",$t&&$t(d));const f=s(o,ky(t,n,r,o,l,i));if(process.env.NODE_ENV!=="production"&&wn){const p=window.performance.now(),h=t.__v_emitter;h&&c&&h.emit("message-compilation",{type:"message-compilation",message:o,time:p-c,groupId:`translate:${e}`}),d&&u&&$t&&fo&&($t(u),fo("intlify message compilation",d,u))}return f.locale=n,f.key=e,f.source=o,f}function Ey(t,e,n){let o=null,r,i;process.env.NODE_ENV!=="production"&&wn&&(o=window.performance.now(),r="intlify-message-evaluation-start",i="intlify-message-evaluation-end",$t&&$t(r));const s=e(n);if(process.env.NODE_ENV!=="production"&&wn){const l=window.performance.now(),c=t.__v_emitter;c&&o&&c.emit("message-evaluation",{type:"message-evaluation",value:s,time:l-o,groupId:`translate:${e.key}`}),r&&i&&$t&&fo&&($t(i),fo("intlify message evaluation",r,i))}return s}function Ca(...t){const[e,n,o]=t,r=Be();if(!me(e)&&!at(e)&&!Ut(e)&&!jt(e))throw pn(lt.INVALID_ARGUMENT);const i=at(e)?String(e):(Ut(e),e);return at(n)?r.plural=n:me(n)?r.default=n:Ve(n)&&!hi(n)?r.named=n:tt(n)&&(r.list=n),at(o)?r.plural=o:me(o)?r.default=o:Ve(o)&&yt(r,o),[i,r]}function ky(t,e,n,o,r,i){return{locale:e,key:n,warnHtmlMessage:r,onError:s=>{if(i&&i(s),process.env.NODE_ENV!=="production"){const l=wy(o),c=`Message compilation error: ${s.message}`,d=s.location&&l&&Jg(l,s.location.start.offset,s.location.end.offset),u=t.__v_emitter;u&&l&&u.emit("compile-error",{message:l,error:s.message,start:s.location&&s.location.start.offset,end:s.location&&s.location.end.offset,groupId:`translate:${n}`}),console.error(d?`${c}
348
+ ${d}`:c)}else throw s},onCacheKey:s=>Bg(e,n,s)}}function wy(t){if(me(t))return t;if(t.loc&&t.loc.source)return t.loc.source}function Sy(t,e,n,o){const{modifiers:r,pluralRules:i,messageResolver:s,fallbackLocale:l,fallbackWarn:c,missingWarn:d,fallbackContext:u}=t,p={locale:e,modifiers:r,pluralRules:i,messages:h=>{let m=s(n,h);if(m==null&&u){const[,,b]=tu(u,h,e,l,c,d);m=s(b,h)}if(me(m)||jt(m)){let b=!1;const x=nu(t,h,e,m,h,()=>{b=!0});return b?Zd:x}else return Ut(m)?m:Zd}};return t.processor&&(p.processor=t.processor),o.list&&(p.list=o.list),o.named&&(p.named=o.named),at(o.plural)&&(p.pluralIndex=o.plural),p}const ou=typeof Intl<"u",ru={dateTimeFormat:ou&&typeof Intl.DateTimeFormat<"u",numberFormat:ou&&typeof Intl.NumberFormat<"u"};function iu(t,...e){const{datetimeFormats:n,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:s}=t,{__datetimeFormatters:l}=t;if(process.env.NODE_ENV!=="production"&&!ru.dateTimeFormat)return i(ho(Tt.CANNOT_FORMAT_DATE)),Si;const[c,d,u,f]=va(...e),p=Ke(u.missingWarn)?u.missingWarn:t.missingWarn,h=Ke(u.fallbackWarn)?u.fallbackWarn:t.fallbackWarn,m=!!u.part,b=xa(t,u),g=s(t,r,b);if(!me(c)||c==="")return new Intl.DateTimeFormat(b,f).format(d);let x={},v,w=null,T=b,M=null;const A="datetime format";for(let k=0;k<g.length;k++){if(v=M=g[k],process.env.NODE_ENV!=="production"&&b!==v&&Ni(h,c)&&i(ho(Tt.FALLBACK_TO_DATE_FORMAT,{key:c,target:v})),process.env.NODE_ENV!=="production"&&b!==v){const O=t.__v_emitter;O&&O.emit("fallback",{type:A,key:c,from:T,to:M,groupId:`${A}:${c}`})}if(x=n[v]||{},w=x[c],Ve(w))break;wa(t,c,v,p,A),T=M}if(!Ve(w)||!me(v))return o?ki:c;let y=`${v}__${c}`;hi(f)||(y=`${y}__${JSON.stringify(f)}`);let E=l.get(y);return E||(E=new Intl.DateTimeFormat(v,yt({},w,f)),l.set(y,E)),m?E.formatToParts(d):E.format(d)}const su=["localeMatcher","weekday","era","year","month","day","hour","minute","second","timeZoneName","formatMatcher","hour12","timeZone","dateStyle","timeStyle","calendar","dayPeriod","numberingSystem","hourCycle","fractionalSecondDigits"];function va(...t){const[e,n,o,r]=t,i=Be();let s=Be(),l;if(me(e)){const c=e.match(/(\d{4}-\d{2}-\d{2})(T|\s)?(.*)/);if(!c)throw pn(lt.INVALID_ISO_DATE_ARGUMENT);const d=c[3]?c[3].trim().startsWith("T")?`${c[1].trim()}${c[3].trim()}`:`${c[1].trim()}T${c[3].trim()}`:c[1].trim();l=new Date(d);try{l.toISOString()}catch{throw pn(lt.INVALID_ISO_DATE_ARGUMENT)}}else if(jg(e)){if(isNaN(e.getTime()))throw pn(lt.INVALID_DATE_ARGUMENT);l=e}else if(at(e))l=e;else throw pn(lt.INVALID_ARGUMENT);return me(n)?i.key=n:Ve(n)&&Object.keys(n).forEach(c=>{su.includes(c)?s[c]=n[c]:i[c]=n[c]}),me(o)?i.locale=o:Ve(o)&&(s=o),Ve(r)&&(s=r),[i.key||"",l,i,s]}function au(t,e,n){const o=t;for(const r in n){const i=`${e}__${r}`;o.__datetimeFormatters.has(i)&&o.__datetimeFormatters.delete(i)}}function lu(t,...e){const{numberFormats:n,unresolving:o,fallbackLocale:r,onWarn:i,localeFallbacker:s}=t,{__numberFormatters:l}=t;if(process.env.NODE_ENV!=="production"&&!ru.numberFormat)return i(ho(Tt.CANNOT_FORMAT_NUMBER)),Si;const[c,d,u,f]=Ta(...e),p=Ke(u.missingWarn)?u.missingWarn:t.missingWarn,h=Ke(u.fallbackWarn)?u.fallbackWarn:t.fallbackWarn,m=!!u.part,b=xa(t,u),g=s(t,r,b);if(!me(c)||c==="")return new Intl.NumberFormat(b,f).format(d);let x={},v,w=null,T=b,M=null;const A="number format";for(let k=0;k<g.length;k++){if(v=M=g[k],process.env.NODE_ENV!=="production"&&b!==v&&Ni(h,c)&&i(ho(Tt.FALLBACK_TO_NUMBER_FORMAT,{key:c,target:v})),process.env.NODE_ENV!=="production"&&b!==v){const O=t.__v_emitter;O&&O.emit("fallback",{type:A,key:c,from:T,to:M,groupId:`${A}:${c}`})}if(x=n[v]||{},w=x[c],Ve(w))break;wa(t,c,v,p,A),T=M}if(!Ve(w)||!me(v))return o?ki:c;let y=`${v}__${c}`;hi(f)||(y=`${y}__${JSON.stringify(f)}`);let E=l.get(y);return E||(E=new Intl.NumberFormat(v,yt({},w,f)),l.set(y,E)),m?E.formatToParts(d):E.format(d)}const cu=["localeMatcher","style","currency","currencyDisplay","currencySign","useGrouping","minimumIntegerDigits","minimumFractionDigits","maximumFractionDigits","minimumSignificantDigits","maximumSignificantDigits","compactDisplay","notation","signDisplay","unit","unitDisplay","roundingMode","roundingPriority","roundingIncrement","trailingZeroDisplay"];function Ta(...t){const[e,n,o,r]=t,i=Be();let s=Be();if(!at(e))throw pn(lt.INVALID_ARGUMENT);const l=e;return me(n)?i.key=n:Ve(n)&&Object.keys(n).forEach(c=>{cu.includes(c)?s[c]=n[c]:i[c]=n[c]}),me(o)?i.locale=o:Ve(o)&&(s=o),Ve(r)&&(s=r),[i.key||"",l,i,s]}function du(t,e,n){const o=t;for(const r in n){const i=`${e}__${r}`;o.__numberFormatters.has(i)&&o.__numberFormatters.delete(i)}}zb();function Ny(){return uu().__VUE_DEVTOOLS_GLOBAL_HOOK__}function uu(){return typeof navigator<"u"&&typeof window<"u"?window:typeof globalThis<"u"?globalThis:{}}const Cy=typeof Proxy=="function",vy="devtools-plugin:setup",Ty="plugin:settings:set";let Po,za;function zy(){var t;return Po!==void 0||(typeof window<"u"&&window.performance?(Po=!0,za=window.performance):typeof globalThis<"u"&&(!((t=globalThis.perf_hooks)===null||t===void 0)&&t.performance)?(Po=!0,za=globalThis.perf_hooks.performance):Po=!1),Po}function _y(){return zy()?za.now():Date.now()}class Ay{constructor(e,n){this.target=null,this.targetQueue=[],this.onQueue=[],this.plugin=e,this.hook=n;const o={};if(e.settings)for(const s in e.settings){const l=e.settings[s];o[s]=l.defaultValue}const r=`__vue-devtools-plugin-settings__${e.id}`;let i=Object.assign({},o);try{const s=localStorage.getItem(r),l=JSON.parse(s);Object.assign(i,l)}catch{}this.fallbacks={getSettings(){return i},setSettings(s){try{localStorage.setItem(r,JSON.stringify(s))}catch{}i=s},now(){return _y()}},n&&n.on(Ty,(s,l)=>{s===this.plugin.id&&this.fallbacks.setSettings(l)}),this.proxiedOn=new Proxy({},{get:(s,l)=>this.target?this.target.on[l]:(...c)=>{this.onQueue.push({method:l,args:c})}}),this.proxiedTarget=new Proxy({},{get:(s,l)=>this.target?this.target[l]:l==="on"?this.proxiedOn:Object.keys(this.fallbacks).includes(l)?(...c)=>(this.targetQueue.push({method:l,args:c,resolve:()=>{}}),this.fallbacks[l](...c)):(...c)=>new Promise(d=>{this.targetQueue.push({method:l,args:c,resolve:d})})})}async setRealTarget(e){this.target=e;for(const n of this.onQueue)this.target.on[n.method](...n.args);for(const n of this.targetQueue)n.resolve(await this.target[n.method](...n.args))}}function My(t,e){const n=t,o=uu(),r=Ny(),i=Cy&&n.enableEarlyProxy;if(r&&(o.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__||!i))r.emit(vy,t,e);else{const s=i?new Ay(n,r):null;(o.__VUE_DEVTOOLS_PLUGINS__=o.__VUE_DEVTOOLS_PLUGINS__||[]).push({pluginDescriptor:n,setupFn:e,proxy:s}),s&&e(s.proxiedTarget)}}const Iy="9.14.5";function Oy(){typeof __INTLIFY_JIT_COMPILATION__!="boolean"&&(pr().__INTLIFY_JIT_COMPILATION__=!1),typeof __INTLIFY_DROP_MESSAGE_COMPILER__!="boolean"&&(pr().__INTLIFY_DROP_MESSAGE_COMPILER__=!1)}const fu=Tt.__EXTEND_POINT__,Nn=mi(fu),Mt={FALLBACK_TO_ROOT:fu,NOT_SUPPORTED_PRESERVE:Nn(),NOT_SUPPORTED_FORMATTER:Nn(),NOT_SUPPORTED_PRESERVE_DIRECTIVE:Nn(),NOT_SUPPORTED_GET_CHOICE_INDEX:Nn(),COMPONENT_NAME_LEGACY_COMPATIBLE:Nn(),NOT_FOUND_PARENT_SCOPE:Nn(),IGNORE_OBJ_FLATTEN:Nn(),NOTICE_DROP_ALLOW_COMPOSITION:Nn(),NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG:Nn()},Dy={[Mt.FALLBACK_TO_ROOT]:"Fall back to {type} '{key}' with root locale.",[Mt.NOT_SUPPORTED_PRESERVE]:"Not supported 'preserve'.",[Mt.NOT_SUPPORTED_FORMATTER]:"Not supported 'formatter'.",[Mt.NOT_SUPPORTED_PRESERVE_DIRECTIVE]:"Not supported 'preserveDirectiveContent'.",[Mt.NOT_SUPPORTED_GET_CHOICE_INDEX]:"Not supported 'getChoiceIndex'.",[Mt.COMPONENT_NAME_LEGACY_COMPATIBLE]:"Component name legacy compatible: '{name}' -> 'i18n'",[Mt.NOT_FOUND_PARENT_SCOPE]:"Not found parent scope. use the global scope.",[Mt.IGNORE_OBJ_FLATTEN]:"Ignore object flatten: '{key}' key has an string value",[Mt.NOTICE_DROP_ALLOW_COMPOSITION]:"'allowComposition' option will be dropped in the next major version. For more information, please see 👉 https://tinyurl.com/2p97mcze",[Mt.NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG]:"'translateExistCompatible' option will be dropped in the next major version."};function Ci(t,...e){return ga(Dy[t],...e)}const pu=lt.__EXTEND_POINT__,It=mi(pu),Je={UNEXPECTED_RETURN_TYPE:pu,INVALID_ARGUMENT:It(),MUST_BE_CALL_SETUP_TOP:It(),NOT_INSTALLED:It(),NOT_AVAILABLE_IN_LEGACY_MODE:It(),REQUIRED_VALUE:It(),INVALID_VALUE:It(),CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN:It(),NOT_INSTALLED_WITH_PROVIDE:It(),UNEXPECTED_ERROR:It(),NOT_COMPATIBLE_LEGACY_VUE_I18N:It(),BRIDGE_SUPPORT_VUE_2_ONLY:It(),MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION:It(),NOT_AVAILABLE_COMPOSITION_IN_LEGACY:It(),__EXTEND_POINT__:It()};function Cn(t,...e){return Io(t,null,process.env.NODE_ENV!=="production"?{messages:Ry,args:e}:void 0)}const Ry={[Je.UNEXPECTED_RETURN_TYPE]:"Unexpected return type in composer",[Je.INVALID_ARGUMENT]:"Invalid argument",[Je.MUST_BE_CALL_SETUP_TOP]:"Must be called at the top of a `setup` function",[Je.NOT_INSTALLED]:"Need to install with `app.use` function",[Je.UNEXPECTED_ERROR]:"Unexpected error",[Je.NOT_AVAILABLE_IN_LEGACY_MODE]:"Not available in legacy mode",[Je.REQUIRED_VALUE]:"Required in value: {0}",[Je.INVALID_VALUE]:"Invalid value",[Je.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN]:"Cannot setup vue-devtools plugin",[Je.NOT_INSTALLED_WITH_PROVIDE]:"Need to install with `provide` function",[Je.NOT_COMPATIBLE_LEGACY_VUE_I18N]:"Not compatible legacy VueI18n.",[Je.BRIDGE_SUPPORT_VUE_2_ONLY]:"vue-i18n-bridge support Vue 2.x only",[Je.MUST_DEFINE_I18N_OPTION_IN_ALLOW_COMPOSITION]:"Must define ‘i18n’ option or custom block in Composition API with using local scope in Legacy API mode",[Je.NOT_AVAILABLE_COMPOSITION_IN_LEGACY]:"Not available Compostion API in Legacy API mode. Please make sure that the legacy API mode is working properly"},_a=fn("__translateVNode"),Aa=fn("__datetimeParts"),Ma=fn("__numberParts"),br=fn("__enableEmitter"),Ia=fn("__disableEmitter"),Py=fn("__setPluralRules"),Ly=fn("__injectWithOption"),Oa=fn("__dispose");function yr(t){if(!Pe(t)||jt(t))return t;for(const e in t)if(nn(t,e))if(!e.includes("."))Pe(t[e])&&yr(t[e]);else{const n=e.split("."),o=n.length-1;let r=t,i=!1;for(let s=0;s<o;s++){if(n[s]==="__proto__")throw new Error(`unsafe key: ${n[s]}`);if(n[s]in r||(r[n[s]]=Be()),!Pe(r[n[s]])){process.env.NODE_ENV!=="production"&&un(Ci(Mt.IGNORE_OBJ_FLATTEN,{key:n[s]})),i=!0;break}r=r[n[s]]}if(i||(jt(r)?_d.includes(n[o])||delete t[e]:(r[n[o]]=t[e],delete t[e])),!jt(r)){const s=r[n[o]];Pe(s)&&yr(s)}}return t}function hu(t,e){const{messages:n,__i18n:o,messageResolver:r,flatJson:i}=e,s=Ve(n)?n:tt(o)?Be():{[t]:Be()};if(tt(o)&&o.forEach(l=>{if("locale"in l&&"resource"in l){const{locale:c,resource:d}=l;c?(s[c]=s[c]||Be(),bi(d,s[c])):bi(d,s)}else me(l)&&bi(JSON.parse(l),s)}),r==null&&i)for(const l in s)nn(s,l)&&yr(s[l]);return s}function mu(t){return t.type}function $y(t,e,n){let o=Pe(e.messages)?e.messages:Be();"__i18nGlobal"in n&&(o=hu(t.locale.value,{messages:o,__i18n:n.__i18nGlobal}));const r=Object.keys(o);r.length&&r.forEach(i=>{t.mergeLocaleMessage(i,o[i])});{if(Pe(e.datetimeFormats)){const i=Object.keys(e.datetimeFormats);i.length&&i.forEach(s=>{t.mergeDateTimeFormat(s,e.datetimeFormats[s])})}if(Pe(e.numberFormats)){const i=Object.keys(e.numberFormats);i.length&&i.forEach(s=>{t.mergeNumberFormat(s,e.numberFormats[s])})}}}function gu(t){return a.createVNode(a.Text,null,t,0)}const bu="__INTLIFY_META__",yu=()=>[],Vy=()=>!1;let xu=0;function Eu(t){return((e,n,o,r)=>t(n,o,a.getCurrentInstance()||void 0,r))}const By=()=>{const t=a.getCurrentInstance();let e=null;return t&&(e=mu(t)[bu])?{[bu]:e}:null};function ku(t={},e){const{__root:n,__injectWithOption:o}=t,r=n===void 0,i=t.flatJson,s=wn?a.ref:a.shallowRef,l=!!t.translateExistCompatible;process.env.NODE_ENV!=="production"&&l&&sd(Ci(Mt.NOTICE_DROP_TRANSLATE_EXIST_COMPATIBLE_FLAG));let c=Ke(t.inheritLocale)?t.inheritLocale:!0;const d=s(n&&c?n.locale.value:me(t.locale)?t.locale:wi),u=s(n&&c?n.fallbackLocale.value:me(t.fallbackLocale)||tt(t.fallbackLocale)||Ve(t.fallbackLocale)||t.fallbackLocale===!1?t.fallbackLocale:d.value),f=s(hu(d.value,t)),p=s(Ve(t.datetimeFormats)?t.datetimeFormats:{[d.value]:{}}),h=s(Ve(t.numberFormats)?t.numberFormats:{[d.value]:{}});let m=n?n.missingWarn:Ke(t.missingWarn)||pi(t.missingWarn)?t.missingWarn:!0,b=n?n.fallbackWarn:Ke(t.fallbackWarn)||pi(t.fallbackWarn)?t.fallbackWarn:!0,g=n?n.fallbackRoot:Ke(t.fallbackRoot)?t.fallbackRoot:!0,x=!!t.fallbackFormat,v=qe(t.missing)?t.missing:null,w=qe(t.missing)?Eu(t.missing):null,T=qe(t.postTranslation)?t.postTranslation:null,M=n?n.warnHtmlMessage:Ke(t.warnHtmlMessage)?t.warnHtmlMessage:!0,A=!!t.escapeParameter;const y=n?n.modifiers:Ve(t.modifiers)?t.modifiers:{};let E=t.pluralRules||n&&n.pluralRules,k;k=(()=>{r&&Hd(null);const F={version:Iy,locale:d.value,fallbackLocale:u.value,messages:f.value,modifiers:y,pluralRules:E,missing:w===null?void 0:w,missingWarn:m,fallbackWarn:b,fallbackFormat:x,unresolving:!0,postTranslation:T===null?void 0:T,warnHtmlMessage:M,escapeParameter:A,messageResolver:t.messageResolver,messageCompiler:t.messageCompiler,__meta:{framework:"vue"}};F.datetimeFormats=p.value,F.numberFormats=h.value,F.__datetimeFormatters=Ve(k)?k.__datetimeFormatters:void 0,F.__numberFormatters=Ve(k)?k.__numberFormatters:void 0,process.env.NODE_ENV!=="production"&&(F.__v_emitter=Ve(k)?k.__v_emitter:void 0);const ne=py(F);return r&&Hd(ne),ne})(),gr(k,d.value,u.value);function G(){return[d.value,u.value,f.value,p.value,h.value]}const z=a.computed({get:()=>d.value,set:F=>{d.value=F,k.locale=d.value}}),R=a.computed({get:()=>u.value,set:F=>{u.value=F,k.fallbackLocale=u.value,gr(k,d.value,F)}}),W=a.computed(()=>f.value),H=a.computed(()=>p.value),L=a.computed(()=>h.value);function j(){return qe(T)?T:null}function Z(F){T=F,k.postTranslation=F}function K(){return v}function ae(F){F!==null&&(w=Eu(F)),v=F,k.missing=w}function ee(F,ne){return F!=="translate"||!ne.resolvedMessage}const X=(F,ne,Me,B,U,ie)=>{G();let le;try{process.env.NODE_ENV,r||(k.fallbackContext=n?fy():void 0),le=F(k)}finally{process.env.NODE_ENV,r||(k.fallbackContext=void 0)}if(Me!=="translate exists"&&at(le)&&le===ki||Me==="translate exists"&&!le){const[we,Fe]=ne();if(process.env.NODE_ENV!=="production"&&n&&me(we)&&ee(Me,Fe)&&(g&&(Ni(b,we)||Gd(m,we))&&un(Ci(Mt.FALLBACK_TO_ROOT,{key:we,type:Me})),process.env.NODE_ENV!=="production")){const{__v_emitter:st}=k;st&&g&&st.emit("fallback",{type:Me,key:we,to:"global",groupId:`${Me}:${we}`})}return n&&g?B(n):U(we)}else{if(ie(le))return le;throw Cn(Je.UNEXPECTED_RETURN_TYPE)}};function Y(...F){return X(ne=>Reflect.apply(eu,null,[ne,...F]),()=>Ca(...F),"translate",ne=>Reflect.apply(ne.t,ne,[...F]),ne=>ne,ne=>me(ne))}function J(...F){const[ne,Me,B]=F;if(B&&!Pe(B))throw Cn(Je.INVALID_ARGUMENT);return Y(ne,Me,yt({resolvedMessage:!0},B||{}))}function Q(...F){return X(ne=>Reflect.apply(iu,null,[ne,...F]),()=>va(...F),"datetime format",ne=>Reflect.apply(ne.d,ne,[...F]),()=>Si,ne=>me(ne))}function de(...F){return X(ne=>Reflect.apply(lu,null,[ne,...F]),()=>Ta(...F),"number format",ne=>Reflect.apply(ne.n,ne,[...F]),()=>Si,ne=>me(ne))}function ke(F){return F.map(ne=>me(ne)||at(ne)||Ke(ne)?gu(String(ne)):ne)}const $e={normalize:ke,interpolate:F=>F,type:"vnode"};function N(...F){return X(ne=>{let Me;const B=ne;try{B.processor=$e,Me=Reflect.apply(eu,null,[B,...F])}finally{B.processor=null}return Me},()=>Ca(...F),"translate",ne=>ne[_a](...F),ne=>[gu(ne)],ne=>tt(ne))}function P(...F){return X(ne=>Reflect.apply(lu,null,[ne,...F]),()=>Ta(...F),"number format",ne=>ne[Ma](...F),yu,ne=>me(ne)||tt(ne))}function V(...F){return X(ne=>Reflect.apply(iu,null,[ne,...F]),()=>va(...F),"datetime format",ne=>ne[Aa](...F),yu,ne=>me(ne)||tt(ne))}function S(F){E=F,k.pluralRules=E}function C(F,ne){return X(()=>{if(!F)return!1;const Me=me(ne)?ne:d.value,B=ge(Me),U=k.messageResolver(B,F);return l?U!=null:jt(U)||Ut(U)||me(U)},()=>[F],"translate exists",Me=>Reflect.apply(Me.te,Me,[F,ne]),Vy,Me=>Ke(Me))}function $(F){let ne=null;const Me=Rd(k,u.value,d.value);for(let B=0;B<Me.length;B++){const U=f.value[Me[B]]||{},ie=k.messageResolver(U,F);if(ie!=null){ne=ie;break}}return ne}function te(F){const ne=$(F);return ne??(n?n.tm(F)||{}:{})}function ge(F){return f.value[F]||{}}function Re(F,ne){if(i){const Me={[F]:ne};for(const B in Me)nn(Me,B)&&yr(Me[B]);ne=Me[F]}f.value[F]=ne,k.messages=f.value}function ve(F,ne){f.value[F]=f.value[F]||{};const Me={[F]:ne};if(i)for(const B in Me)nn(Me,B)&&yr(Me[B]);ne=Me[F],bi(ne,f.value[F]),k.messages=f.value}function _(F){return p.value[F]||{}}function I(F,ne){p.value[F]=ne,k.datetimeFormats=p.value,au(k,F,ne)}function q(F,ne){p.value[F]=yt(p.value[F]||{},ne),k.datetimeFormats=p.value,au(k,F,ne)}function pe(F){return h.value[F]||{}}function Ae(F,ne){h.value[F]=ne,k.numberFormats=h.value,du(k,F,ne)}function ze(F,ne){h.value[F]=yt(h.value[F]||{},ne),k.numberFormats=h.value,du(k,F,ne)}xu++,n&&wn&&(a.watch(n.locale,F=>{c&&(d.value=F,k.locale=F,gr(k,d.value,u.value))}),a.watch(n.fallbackLocale,F=>{c&&(u.value=F,k.fallbackLocale=F,gr(k,d.value,u.value))}));const Se={id:xu,locale:z,fallbackLocale:R,get inheritLocale(){return c},set inheritLocale(F){c=F,F&&n&&(d.value=n.locale.value,u.value=n.fallbackLocale.value,gr(k,d.value,u.value))},get availableLocales(){return Object.keys(f.value).sort()},messages:W,get modifiers(){return y},get pluralRules(){return E||{}},get isGlobal(){return r},get missingWarn(){return m},set missingWarn(F){m=F,k.missingWarn=m},get fallbackWarn(){return b},set fallbackWarn(F){b=F,k.fallbackWarn=b},get fallbackRoot(){return g},set fallbackRoot(F){g=F},get fallbackFormat(){return x},set fallbackFormat(F){x=F,k.fallbackFormat=x},get warnHtmlMessage(){return M},set warnHtmlMessage(F){M=F,k.warnHtmlMessage=F},get escapeParameter(){return A},set escapeParameter(F){A=F,k.escapeParameter=F},t:Y,getLocaleMessage:ge,setLocaleMessage:Re,mergeLocaleMessage:ve,getPostTranslationHandler:j,setPostTranslationHandler:Z,getMissingHandler:K,setMissingHandler:ae,[Py]:S};return Se.datetimeFormats=H,Se.numberFormats=L,Se.rt=J,Se.te=C,Se.tm=te,Se.d=Q,Se.n=de,Se.getDateTimeFormat=_,Se.setDateTimeFormat=I,Se.mergeDateTimeFormat=q,Se.getNumberFormat=pe,Se.setNumberFormat=Ae,Se.mergeNumberFormat=ze,Se[Ly]=o,Se[_a]=N,Se[Aa]=V,Se[Ma]=P,process.env.NODE_ENV!=="production"&&(Se[br]=F=>{k.__v_emitter=F},Se[Ia]=()=>{k.__v_emitter=void 0}),Se}const Da={tag:{type:[String,Object]},locale:{type:String},scope:{type:String,validator:t=>t==="parent"||t==="global",default:"parent"},i18n:{type:Object}};function Fy({slots:t},e){return e.length===1&&e[0]==="default"?(t.default?t.default():[]).reduce((o,r)=>[...o,...r.type===a.Fragment?r.children:[r]],[]):e.reduce((n,o)=>{const r=t[o];return r&&(n[o]=r()),n},Be())}function wu(t){return a.Fragment}yt({keypath:{type:String,required:!0},plural:{type:[Number,String],validator:t=>at(t)||!isNaN(t)}},Da);function jy(t){return tt(t)&&!me(t[0])}function Su(t,e,n,o){const{slots:r,attrs:i}=e;return()=>{const s={part:!0};let l=Be();t.locale&&(s.locale=t.locale),me(t.format)?s.key=t.format:Pe(t.format)&&(me(t.format.key)&&(s.key=t.format.key),l=Object.keys(t.format).reduce((p,h)=>n.includes(h)?yt(Be(),p,{[h]:t.format[h]}):p,Be()));const c=o(t.value,s,l);let d=[s.key];tt(c)?d=c.map((p,h)=>{const m=r[p.type],b=m?m({[p.type]:p.value,index:h,parts:c}):[p.value];return jy(b)&&(b[0].key=`${p.type}-${h}`),b}):me(c)&&(d=[c]);const u=yt(Be(),i),f=me(t.tag)||Pe(t.tag)?t.tag:wu();return a.h(f,u,d)}}yt({value:{type:Number,required:!0},format:{type:[String,Object]}},Da),yt({value:{type:[Number,Date],required:!0},format:{type:[String,Object]}},Da);const Ra={"vue-devtools-plugin-vue-i18n":"Vue I18n devtools","vue-i18n-resource-inspector":"I18n Resources","vue-i18n-timeline":"Vue I18n"},Uy={"vue-i18n-resource-inspector":"Search for scopes ..."},Hy={"vue-i18n-timeline":16764185},Nu="vue-i18n: composer properties";let Pa;async function Wy(t,e){return new Promise((n,o)=>{try{My({id:"vue-devtools-plugin-vue-i18n",label:Ra["vue-devtools-plugin-vue-i18n"],packageName:"vue-i18n",homepage:"https://vue-i18n.intlify.dev",logo:"https://vue-i18n.intlify.dev/vue-i18n-devtools-logo.png",componentStateTypes:[Nu],app:t},r=>{Pa=r,r.on.visitComponentTree(({componentInstance:s,treeNode:l})=>{Gy(s,l,e)}),r.on.inspectComponent(({componentInstance:s,instanceData:l})=>{s.vnode.el&&s.vnode.el.__VUE_I18N__&&l&&(e.mode==="legacy"?s.vnode.el.__VUE_I18N__!==e.global.__composer&&vu(l,s.vnode.el.__VUE_I18N__):vu(l,s.vnode.el.__VUE_I18N__))}),r.addInspector({id:"vue-i18n-resource-inspector",label:Ra["vue-i18n-resource-inspector"],icon:"language",treeFilterPlaceholder:Uy["vue-i18n-resource-inspector"]}),r.on.getInspectorTree(s=>{s.app===t&&s.inspectorId==="vue-i18n-resource-inspector"&&Yy(s,e)});const i=new Map;r.on.getInspectorState(async s=>{if(s.app===t&&s.inspectorId==="vue-i18n-resource-inspector")if(r.unhighlightElement(),Zy(s,e),s.nodeId==="global"){if(!i.has(s.app)){const[l]=await r.getComponentInstances(s.app);i.set(s.app,l)}r.highlightElement(i.get(s.app))}else{const l=Qy(s.nodeId,e);l&&r.highlightElement(l)}}),r.on.editInspectorState(s=>{s.app===t&&s.inspectorId==="vue-i18n-resource-inspector"&&t1(s,e)}),r.addTimelineLayer({id:"vue-i18n-timeline",label:Ra["vue-i18n-timeline"],color:Hy["vue-i18n-timeline"]}),n(!0)})}catch(r){console.error(r),o(!1)}})}function Cu(t){return t.type.name||t.type.displayName||t.type.__file||"Anonymous"}function Gy(t,e,n){const o=n.mode==="composition"?n.global:n.global.__composer;if(t&&t.vnode.el&&t.vnode.el.__VUE_I18N__&&t.vnode.el.__VUE_I18N__!==o){const r={label:`i18n (${Cu(t)} Scope)`,textColor:0,backgroundColor:16764185};e.tags.push(r)}}function vu(t,e){const n=Nu;t.state.push({type:n,key:"locale",editable:!0,value:e.locale.value}),t.state.push({type:n,key:"availableLocales",editable:!1,value:e.availableLocales}),t.state.push({type:n,key:"fallbackLocale",editable:!0,value:e.fallbackLocale.value}),t.state.push({type:n,key:"inheritLocale",editable:!0,value:e.inheritLocale}),t.state.push({type:n,key:"messages",editable:!1,value:La(e.messages.value)}),t.state.push({type:n,key:"datetimeFormats",editable:!1,value:e.datetimeFormats.value}),t.state.push({type:n,key:"numberFormats",editable:!1,value:e.numberFormats.value})}function La(t){const e={};return Object.keys(t).forEach(n=>{const o=t[n];qe(o)&&"source"in o?e[n]=Xy(o):jt(o)&&o.loc&&o.loc.source?e[n]=o.loc.source:Pe(o)?e[n]=La(o):e[n]=o}),e}const qy={"<":"&lt;",">":"&gt;",'"':"&quot;","&":"&amp;"};function Ky(t){return t.replace(/[<>"&]/g,Jy)}function Jy(t){return qy[t]||t}function Xy(t){return{_custom:{type:"function",display:`<span>ƒ</span> ${t.source?`("${Ky(t.source)}")`:"(?)"}`}}}function Yy(t,e){t.rootNodes.push({id:"global",label:"Global Scope"});const n=e.mode==="composition"?e.global:e.global.__composer;for(const[o,r]of e.__instances){const i=e.mode==="composition"?r:r.__composer;n!==i&&t.rootNodes.push({id:i.id.toString(),label:`${Cu(o)} Scope`})}}function Qy(t,e){let n=null;if(t!=="global"){for(const[o,r]of e.__instances.entries())if(r.id.toString()===t){n=o;break}}return n}function Tu(t,e){if(t==="global")return e.mode==="composition"?e.global:e.global.__composer;{const n=Array.from(e.__instances.values()).find(o=>o.id.toString()===t);return n?e.mode==="composition"?n:n.__composer:null}}function Zy(t,e){const n=Tu(t.nodeId,e);return n&&(t.state=e1(n)),null}function e1(t){const e={},n="Locale related info",o=[{type:n,key:"locale",editable:!0,value:t.locale.value},{type:n,key:"fallbackLocale",editable:!0,value:t.fallbackLocale.value},{type:n,key:"availableLocales",editable:!1,value:t.availableLocales},{type:n,key:"inheritLocale",editable:!0,value:t.inheritLocale}];e[n]=o;const r="Locale messages info",i=[{type:r,key:"messages",editable:!1,value:La(t.messages.value)}];e[r]=i;{const s="Datetime formats info",l=[{type:s,key:"datetimeFormats",editable:!1,value:t.datetimeFormats.value}];e[s]=l;const c="Datetime formats info",d=[{type:c,key:"numberFormats",editable:!1,value:t.numberFormats.value}];e[c]=d}return e}function $a(t,e){if(Pa){let n;e&&"groupId"in e&&(n=e.groupId,delete e.groupId),Pa.addTimelineEvent({layerId:"vue-i18n-timeline",event:{title:t,groupId:n,time:Date.now(),meta:{},data:e||{},logType:t==="compile-error"?"error":t==="fallback"||t==="missing"?"warning":"default"}})}}function t1(t,e){const n=Tu(t.nodeId,e);if(n){const[o]=t.path;o==="locale"&&me(t.state.value)?n.locale.value=t.state.value:o==="fallbackLocale"&&(me(t.state.value)||tt(t.state.value)||Pe(t.state.value))?n.fallbackLocale.value=t.state.value:o==="inheritLocale"&&Ke(t.state.value)&&(n.inheritLocale=t.state.value)}}const n1=fn("global-vue-i18n");function o1(t={},e){const n=Ke(t.globalInjection)?t.globalInjection:!0,o=!0,r=new Map,[i,s]=r1(t),l=fn(process.env.NODE_ENV!=="production"?"vue-i18n":"");process.env.NODE_ENV;function c(f){return r.get(f)||null}function d(f,p){r.set(f,p)}function u(f){r.delete(f)}{const f={get mode(){return"composition"},get allowComposition(){return o},async install(p,...h){if(process.env.NODE_ENV!=="production"&&(p.__VUE_I18N__=f),p.__VUE_I18N_SYMBOL__=l,p.provide(p.__VUE_I18N_SYMBOL__,f),Ve(h[0])){const g=h[0];f.__composerExtend=g.__composerExtend,f.__vueI18nExtend=g.__vueI18nExtend}let m=null;n&&(m=f1(p,f.global));const b=p.unmount;if(p.unmount=()=>{m&&m(),f.dispose(),b()},process.env.NODE_ENV!=="production"){if(!await Wy(p,f))throw Cn(Je.CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN);const x=pd();{const v=s;v[br]&&v[br](x)}x.on("*",$a)}},get global(){return s},dispose(){i.stop()},__instances:r,__getInstance:c,__setInstance:d,__deleteInstance:u};return f}}function rn(t={}){const e=a.getCurrentInstance();if(e==null)throw Cn(Je.MUST_BE_CALL_SETUP_TOP);if(!e.isCE&&e.appContext.app!=null&&!e.appContext.app.__VUE_I18N_SYMBOL__)throw Cn(Je.NOT_INSTALLED);const n=i1(e),o=a1(n),r=mu(e),i=s1(t,r);if(i==="global")return $y(o,t,r),o;if(i==="parent"){let c=l1(n,e,t.__useComponent);return c==null&&(process.env.NODE_ENV!=="production"&&un(Ci(Mt.NOT_FOUND_PARENT_SCOPE)),c=o),c}const s=n;let l=s.__getInstance(e);if(l==null){const c=yt({},t);"__i18n"in r&&(c.__i18n=r.__i18n),o&&(c.__root=o),l=ku(c),s.__composerExtend&&(l[Oa]=s.__composerExtend(l)),d1(s,e,l),s.__setInstance(e,l)}return l}function r1(t,e,n){const o=a.effectScope();{const r=o.run(()=>ku(t));if(r==null)throw Cn(Je.UNEXPECTED_ERROR);return[o,r]}}function i1(t){{const e=a.inject(t.isCE?n1:t.appContext.app.__VUE_I18N_SYMBOL__);if(!e)throw Cn(t.isCE?Je.NOT_INSTALLED_WITH_PROVIDE:Je.UNEXPECTED_ERROR);return e}}function s1(t,e){return hi(t)?"__i18n"in e?"local":"global":t.useScope?t.useScope:"local"}function a1(t){return t.mode==="composition"?t.global:t.global.__composer}function l1(t,e,n=!1){let o=null;const r=e.root;let i=c1(e,n);for(;i!=null;){const s=t;if(t.mode==="composition"&&(o=s.__getInstance(i)),o!=null||r===i)break;i=i.parent}return o}function c1(t,e=!1){return t==null?null:e&&t.vnode.ctx||t.parent}function d1(t,e,n){let o=null;a.onMounted(()=>{if(process.env.NODE_ENV!=="production"&&e.vnode.el){e.vnode.el.__VUE_I18N__=n,o=pd();const r=n;r[br]&&r[br](o),o.on("*",$a)}},e),a.onUnmounted(()=>{const r=n;process.env.NODE_ENV!=="production"&&e.vnode.el&&e.vnode.el.__VUE_I18N__&&(o&&o.off("*",$a),r[Ia]&&r[Ia](),delete e.vnode.el.__VUE_I18N__),t.__deleteInstance(e);const i=r[Oa];i&&(i(),delete r[Oa])},e)}const u1=["locale","fallbackLocale","availableLocales"],zu=["t","rt","d","n","tm","te"];function f1(t,e){const n=Object.create(null);return u1.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i)throw Cn(Je.UNEXPECTED_ERROR);const s=a.isRef(i.value)?{get(){return i.value.value},set(l){i.value.value=l}}:{get(){return i.get&&i.get()}};Object.defineProperty(n,r,s)}),t.config.globalProperties.$i18n=n,zu.forEach(r=>{const i=Object.getOwnPropertyDescriptor(e,r);if(!i||!i.value)throw Cn(Je.UNEXPECTED_ERROR);Object.defineProperty(t.config.globalProperties,`$${r}`,i)}),()=>{delete t.config.globalProperties.$i18n,zu.forEach(r=>{delete t.config.globalProperties[`$${r}`]})}}if(Oy(),__INTLIFY_JIT_COMPILATION__?Vd(yy):Vd(by),ly(jb),cy(Rd),process.env.NODE_ENV!=="production"){const t=pr();t.__INTLIFY__=!0,Yb(t.__INTLIFY_DEVTOOLS_GLOBAL_HOOK__)}process.env.NODE_ENV;const _u="zcode-user-settings";function Lo(){try{const t=localStorage.getItem(_u);return t?JSON.parse(t):{}}catch(t){return console.warn("[ZeroCode] Failed to load user settings:",t),{}}}function Va(t){try{const e=Lo(),n={locale:t.locale??e.locale,cms:t.cms?{...e.cms||{},...t.cms}:e.cms,dev:t.dev?{...e.dev||{},...t.dev}:e.dev};localStorage.setItem(_u,JSON.stringify(n))}catch(e){console.warn("[ZeroCode] Failed to save user settings:",e)}}function p1(t=null){const e=Lo();return e.locale!==void 0?e.locale:t}function Au(){return Lo().cms||{}}function vi(t){const e=Lo();Va({cms:{...e.cms,...t}})}function h1(t,e){return Au()[t]??e}function Mu(){return Lo().dev||{}}function Ba(t){const e=Lo();Va({dev:{...e.dev,...t}})}function m1(t,e){return Mu()[t]??e}const Iu="zcode-dont-show-css-warning-parts";function g1(){try{return sessionStorage.getItem(Iu)==="true"}catch{return!1}}function b1(t){try{sessionStorage.setItem(Iu,String(t))}catch(e){console.warn("[ZeroCode] Failed to save CSS warning setting:",e)}}const y1={class:"zcode-settings-panel-header"},x1={class:"zcode-settings-panel-header-title",role:"heading","aria-level":"3"},E1={class:"zcode-settings-panel-header-actions"},k1=["value","aria-label"],w1={value:"ja"},S1={value:"en"},N1={class:"zcode-settings-panel-content"},C1={key:0},v1={key:0,class:"zcode-setting-item"},T1={class:"zcode-setting-label"},z1=["checked"],_1=["title"],A1={key:0,class:"zcode-setting-description"},M1={key:1,class:"zcode-setting-item"},I1={class:"zcode-setting-label"},O1=["checked"],D1=["title"],R1={key:0,class:"zcode-setting-description"},P1={key:2,class:"zcode-setting-item"},L1={class:"zcode-setting-label"},$1=["checked"],V1=["title"],B1={key:0,class:"zcode-setting-description"},F1={key:3,class:"zcode-setting-item"},j1={class:"zcode-setting-label"},U1=["checked"],H1=["title"],W1={key:0,class:"zcode-setting-description"},G1={key:1,class:"zcode-setting-item"},q1={class:"zcode-setting-info"},Ou=a.defineComponent({__name:"SettingsPanel",props:{isOpen:{type:Boolean},viewMode:{type:String},mode:{type:String},allowDynamicContentInteraction:{type:Boolean},devRightPadding:{type:Boolean},enableContextMenu:{type:Boolean},showSaveConfirm:{type:Boolean}},emits:["close","toggle-dynamic-content","toggle-dev-padding","toggle-context-menu","toggle-save-confirm"],setup(t){const e=t,{locale:n}=rn(),o=a.computed(()=>n.value||"ja");function r(u){const p=u.target.value;n.value=p,Va({locale:p})}const i=a.ref(!1),s=a.ref(!1),l=a.ref(!1),c=a.ref(!1),d=a.computed(()=>e.devRightPadding!==void 0?e.devRightPadding:!1);return(u,f)=>t.isOpen?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-settings-panel-overlay",onClick:f[10]||(f[10]=a.withModifiers(p=>u.$emit("close"),["self"]))},[a.createElementVNode("div",{class:"zcode-settings-panel",onClick:f[9]||(f[9]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",y1,[a.createElementVNode("div",x1,a.toDisplayString(u.$t("settings.title")),1),a.createElementVNode("div",E1,[a.createElementVNode("select",{value:o.value,class:"zcode-language-select","aria-label":u.$t("settings.language.label"),onChange:r},[a.createElementVNode("option",w1,a.toDisplayString(u.$t("settings.language.ja")),1),a.createElementVNode("option",S1,a.toDisplayString(u.$t("settings.language.en")),1)],40,k1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":"$t('common.close')",onClick:f[0]||(f[0]=p=>u.$emit("close"))},[a.createVNode(a.unref(Qe),{size:18})])])]),a.createElementVNode("div",N1,[t.viewMode==="manage"?(a.openBlock(),a.createElementBlock("div",C1,[e.mode==="toolbar"||e.mode===void 0?(a.openBlock(),a.createElementBlock("div",v1,[a.createElementVNode("label",T1,[a.createElementVNode("input",{type:"checkbox",checked:e.allowDynamicContentInteraction??!1,class:"zcode-setting-checkbox",onChange:f[1]||(f[1]=p=>u.$emit("toggle-dynamic-content",p.target.checked))},null,40,z1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.enableDynamicContent")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[2]||(f[2]=a.withModifiers(p=>i.value=!i.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,_1)]),i.value?(a.openBlock(),a.createElementBlock("div",A1,a.toDisplayString(u.$t("settings.enableDynamicContentDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),e.mode==="toolbar"||e.mode===void 0?(a.openBlock(),a.createElementBlock("div",M1,[a.createElementVNode("label",I1,[a.createElementVNode("input",{type:"checkbox",checked:d.value,class:"zcode-setting-checkbox",onChange:f[3]||(f[3]=p=>u.$emit("toggle-dev-padding",p.target.checked))},null,40,O1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.devRightPadding")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[4]||(f[4]=a.withModifiers(p=>s.value=!s.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,D1)]),s.value?(a.openBlock(),a.createElementBlock("div",R1,a.toDisplayString(u.$t("settings.devRightPaddingDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),e.mode==="toolbar"||e.mode===void 0?(a.openBlock(),a.createElementBlock("div",P1,[a.createElementVNode("label",L1,[a.createElementVNode("input",{type:"checkbox",checked:e.enableContextMenu??!1,class:"zcode-setting-checkbox",onChange:f[5]||(f[5]=p=>u.$emit("toggle-context-menu",p.target.checked))},null,40,$1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.enableContextMenu")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[6]||(f[6]=a.withModifiers(p=>l.value=!l.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,V1)]),l.value?(a.openBlock(),a.createElementBlock("div",B1,a.toDisplayString(u.$t("settings.enableContextMenuDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),e.mode==="dev-tabs"?(a.openBlock(),a.createElementBlock("div",F1,[a.createElementVNode("label",j1,[a.createElementVNode("input",{type:"checkbox",checked:e.showSaveConfirm??!0,class:"zcode-setting-checkbox",onChange:f[7]||(f[7]=p=>u.$emit("toggle-save-confirm",p.target.checked))},null,40,U1),a.createElementVNode("span",null,a.toDisplayString(u.$t("settings.showSaveConfirm")),1),a.createElementVNode("button",{class:"zcode-info-btn",type:"button",title:u.$t("common.select"),onClick:f[8]||(f[8]=a.withModifiers(p=>c.value=!c.value,["stop"]))},[a.createVNode(a.unref(Vn),{size:16})],8,H1)]),c.value?(a.openBlock(),a.createElementBlock("div",W1,a.toDisplayString(u.$t("settings.showSaveConfirmDescription")),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)])):(a.openBlock(),a.createElementBlock("div",G1,[a.createElementVNode("div",q1,a.toDisplayString(u.$t("settings.previewModeInfo")),1)]))])])])):a.createCommentVNode("",!0)}});function pt(t){this.content=t}pt.prototype={constructor:pt,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var o=n&&n!=t?this.remove(n):this,r=o.find(t),i=o.content.slice();return r==-1?i.push(n||t,e):(i[r+1]=e,n&&(i[r]=n)),new pt(i)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new pt(n)},addToStart:function(t,e){return new pt([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new pt(n)},addBefore:function(t,e,n){var o=this.remove(e),r=o.content.slice(),i=o.find(t);return r.splice(i==-1?r.length:i,0,e,n),new pt(r)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=pt.from(t),t.size?new pt(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=pt.from(t),t.size?new pt(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=pt.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}},pt.from=function(t){if(t instanceof pt)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new pt(e)};function Du(t,e,n){for(let o=0;;o++){if(o==t.childCount||o==e.childCount)return t.childCount==e.childCount?null:n;let r=t.child(o),i=e.child(o);if(r==i){n+=r.nodeSize;continue}if(!r.sameMarkup(i))return n;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)n++;return n}if(r.content.size||i.content.size){let s=Du(r.content,i.content,n+1);if(s!=null)return s}n+=r.nodeSize}}function Ru(t,e,n,o){for(let r=t.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:n,b:o};let s=t.child(--r),l=e.child(--i),c=s.nodeSize;if(s==l){n-=c,o-=c;continue}if(!s.sameMarkup(l))return{a:n,b:o};if(s.isText&&s.text!=l.text){let d=0,u=Math.min(s.text.length,l.text.length);for(;d<u&&s.text[s.text.length-d-1]==l.text[l.text.length-d-1];)d++,n--,o--;return{a:n,b:o}}if(s.content.size||l.content.size){let d=Ru(s.content,l.content,n-1,o-1);if(d)return d}n-=c,o-=c}}class oe{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,n,o,r=0,i){for(let s=0,l=0;l<n;s++){let c=this.content[s],d=l+c.nodeSize;if(d>e&&o(c,r+l,i||null,s)!==!1&&c.content.size){let u=l+1;c.nodesBetween(Math.max(0,e-u),Math.min(c.content.size,n-u),o,r+u)}l=d}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,o,r){let i="",s=!0;return this.nodesBetween(e,n,(l,c)=>{let d=l.isText?l.text.slice(Math.max(e,c)-c,n-c):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&d||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=d},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(o)&&(r[r.length-1]=n.withText(n.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new oe(r,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let o=[],r=0;if(n>e)for(let i=0,s=0;s<n;i++){let l=this.content[i],c=s+l.nodeSize;c>e&&((s<e||c>n)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,n-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,n-s-1))),o.push(l),r+=l.nodeSize),s=c}return new oe(o,r)}cutByIndex(e,n){return e==n?oe.empty:e==0&&n==this.content.length?this:new oe(this.content.slice(e,n))}replaceChild(e,n){let o=this.content[e];if(o==n)return this;let r=this.content.slice(),i=this.size+n.nodeSize-o.nodeSize;return r[e]=n,new oe(r,i)}addToStart(e){return new oe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new oe(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,o=0;n<this.content.length;n++){let r=this.content[n];e(r,o,n),o+=r.nodeSize}}findDiffStart(e,n=0){return Du(this,e,n)}findDiffEnd(e,n=this.size,o=e.size){return Ru(this,e,n,o)}findIndex(e){if(e==0)return Ti(0,e);if(e==this.size)return Ti(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,o=0;;n++){let r=this.child(n),i=o+r.nodeSize;if(i>=e)return i==e?Ti(n+1,i):Ti(n,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return oe.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new oe(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return oe.empty;let n,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(n||(n=e.slice(0,r)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new oe(n||e,o)}static from(e){if(!e)return oe.empty;if(e instanceof oe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new oe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}oe.empty=new oe([],0);const Fa={index:0,offset:0};function Ti(t,e){return Fa.index=t,Fa.offset=e,Fa}function zi(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let o=0;o<t.length;o++)if(!zi(t[o],e[o]))return!1}else{for(let o in t)if(!(o in e)||!zi(t[o],e[o]))return!1;for(let o in e)if(!(o in t))return!1}return!0}let je=class Ac{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))n||(n=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(n||(n=e.slice(0,r)),n.push(this),o=!0),n&&n.push(i)}}return n||(n=e.slice()),o||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&zi(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[n.type];if(!o)throw new RangeError(`There is no mark type ${n.type} in this schema`);let r=o.create(n.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(n[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Ac.none;if(e instanceof Ac)return[e];let n=e.slice();return n.sort((o,r)=>o.type.rank-r.type.rank),n}};je.none=[];class _i extends Error{}class fe{constructor(e,n,o){this.content=e,this.openStart=n,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let o=Lu(this.content,e+this.openStart,n);return o&&new fe(o,this.openStart,this.openEnd)}removeBetween(e,n){return new fe(Pu(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return fe.empty;let o=n.openStart||0,r=n.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new fe(oe.fromJSON(e,n.content),o,r)}static maxOpen(e,n=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)r++;return new fe(e,o,r)}}fe.empty=new fe(oe.empty,0,0);function Pu(t,e,n){let{index:o,offset:r}=t.findIndex(e),i=t.maybeChild(o),{index:s,offset:l}=t.findIndex(n);if(r==e||i.isText){if(l!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(o!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(o,i.copy(Pu(i.content,e-r-1,n-r-1)))}function Lu(t,e,n,o){let{index:r,offset:i}=t.findIndex(e),s=t.maybeChild(r);if(i==e||s.isText)return o&&!o.canReplace(r,r,n)?null:t.cut(0,e).append(n).append(t.cut(e));let l=Lu(s.content,e-i-1,n,s);return l&&t.replaceChild(r,s.copy(l))}function K1(t,e,n){if(n.openStart>t.depth)throw new _i("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new _i("Inconsistent open depths");return $u(t,e,n,0)}function $u(t,e,n,o){let r=t.index(o),i=t.node(o);if(r==e.index(o)&&o<t.depth-n.openStart){let s=$u(t,e,n,o+1);return i.copy(i.content.replaceChild(r,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==o&&e.depth==o){let s=t.parent,l=s.content;return bo(s,l.cut(0,t.parentOffset).append(n.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=J1(n,t);return bo(i,Bu(t,s,l,e,o))}else return bo(i,Ai(t,e,o))}function Vu(t,e){if(!e.type.compatibleContent(t.type))throw new _i("Cannot join "+e.type.name+" onto "+t.type.name)}function ja(t,e,n){let o=t.node(n);return Vu(o,e.node(n)),o}function go(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function xr(t,e,n,o){let r=(e||t).node(n),i=0,s=e?e.index(n):r.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(go(t.nodeAfter,o),i++));for(let l=i;l<s;l++)go(r.child(l),o);e&&e.depth==n&&e.textOffset&&go(e.nodeBefore,o)}function bo(t,e){return t.type.checkContent(e),t.copy(e)}function Bu(t,e,n,o,r){let i=t.depth>r&&ja(t,e,r+1),s=o.depth>r&&ja(n,o,r+1),l=[];return xr(null,t,r,l),i&&s&&e.index(r)==n.index(r)?(Vu(i,s),go(bo(i,Bu(t,e,n,o,r+1)),l)):(i&&go(bo(i,Ai(t,e,r+1)),l),xr(e,n,r,l),s&&go(bo(s,Ai(n,o,r+1)),l)),xr(o,null,r,l),new oe(l)}function Ai(t,e,n){let o=[];if(xr(null,t,n,o),t.depth>n){let r=ja(t,e,n+1);go(bo(r,Ai(t,e,n+1)),o)}return xr(e,null,n,o),new oe(o)}function J1(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)r=e.node(i).copy(oe.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class Er{constructor(e,n,o){this.pos=e,this.path=n,this.parentOffset=o,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let o=this.pos-this.path[this.path.length-1],r=e.child(n);return o?e.child(n).cut(o):r}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let o=this.path[n*3],r=n==0?0:this.path[n*3-1]+1;for(let i=0;i<e;i++)r+=o.child(i).nodeSize;return r}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return je.none;if(this.textOffset)return e.child(n).marks;let o=e.maybeChild(n-1),r=e.maybeChild(n);if(!o){let l=o;o=r,r=l}let i=o.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let o=n.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!r||!o[i].isInSet(r.marks))&&(o=o[i--].removeFromSet(o));return o}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!n||n(this.node(o))))return new Mi(this,e,o);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let o=[],r=0,i=n;for(let s=e;;){let{index:l,offset:c}=s.content.findIndex(i),d=i-c;if(o.push(s,l,r+c),!d||(s=s.child(l),s.isText))break;i=d-1,r+=c+1}return new Er(n,o,i)}static resolveCached(e,n){let o=Fu.get(e);if(o)for(let i=0;i<o.elts.length;i++){let s=o.elts[i];if(s.pos==n)return s}else Fu.set(e,o=new X1);let r=o.elts[o.i]=Er.resolve(e,n);return o.i=(o.i+1)%Y1,r}}class X1{constructor(){this.elts=[],this.i=0}}const Y1=12,Fu=new WeakMap;class Mi{constructor(e,n,o){this.$from=e,this.$to=n,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const Q1=Object.create(null);let Gn=class Mc{constructor(e,n,o,r=je.none){this.type=e,this.attrs=n,this.marks=r,this.content=o||oe.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,o,r=0){this.content.nodesBetween(e,n,o,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,o,r){return this.content.textBetween(e,n,o,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,o){return this.type==e&&zi(this.attrs,n||e.defaultAttrs||Q1)&&je.sameSet(this.marks,o||je.none)}copy(e=null){return e==this.content?this:new Mc(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new Mc(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,o=!1){if(e==n)return fe.empty;let r=this.resolve(e),i=this.resolve(n),s=o?0:r.sharedDepth(n),l=r.start(s),d=r.node(s).content.cut(r.pos-l,i.pos-l);return new fe(d,r.depth-s,i.depth-s)}replace(e,n,o){return K1(this.resolve(e),this.resolve(n),o)}nodeAt(e){for(let n=this;;){let{index:o,offset:r}=n.content.findIndex(e);if(n=n.maybeChild(o),!n)return null;if(r==e||n.isText)return n;e-=r+1}}childAfter(e){let{index:n,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(n),index:n,offset:o};let r=this.content.child(n-1);return{node:r,index:n-1,offset:o-r.nodeSize}}resolve(e){return Er.resolveCached(this,e)}resolveNoCache(e){return Er.resolve(this,e)}rangeHasMark(e,n,o){let r=!1;return n>e&&this.nodesBetween(e,n,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),ju(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,o=oe.empty,r=0,i=o.childCount){let s=this.contentMatchAt(e).matchFragment(o,r,i),l=s&&s.matchFragment(this.content,n);if(!l||!l.validEnd)return!1;for(let c=r;c<i;c++)if(!this.type.allowsMarks(o.child(c).marks))return!1;return!0}canReplaceWith(e,n,o,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(o),s=i&&i.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=je.none;for(let n=0;n<this.marks.length;n++){let o=this.marks[n];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!je.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let o;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,o)}let r=oe.fromJSON(e,n.content),i=e.nodeType(n.type).create(n.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};Gn.prototype.text=void 0;class Ii extends Gn{constructor(e,n,o,r){if(super(e,n,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):ju(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Ii(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Ii(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function ju(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class yo{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let o=new Z1(e,n);if(o.next==null)return yo.empty;let r=Uu(o);o.next&&o.err("Unexpected trailing text");let i=s0(i0(r));return a0(i,o),i}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,o=e.childCount){let r=this;for(let i=n;r&&i<o;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let o=0;o<e.next.length;o++)if(this.next[n].type==e.next[o].type)return!0;return!1}fillBefore(e,n=!1,o=0){let r=[this];function i(s,l){let c=s.matchFragment(e,o);if(c&&(!n||c.validEnd))return oe.from(l.map(d=>d.createAndFill()));for(let d=0;d<s.next.length;d++){let{type:u,next:f}=s.next[d];if(!(u.isText||u.hasRequiredAttrs())&&r.indexOf(f)==-1){r.push(f);let p=i(f,l.concat(u));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),i=r.match;if(i.matchType(e)){let s=[];for(let l=r;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:c}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in n)&&(!r.type||c.validEnd)&&(o.push({match:l.contentMatch,type:l,via:r}),n[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(o){e.push(o);for(let r=0;r<o.next.length;r++)e.indexOf(o.next[r].next)==-1&&n(o.next[r].next)}return n(this),e.map((o,r)=>{let i=r+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)i+=(s?", ":"")+o.next[s].type.name+"->"+e.indexOf(o.next[s].next);return i}).join(`
349
+ `)}}yo.empty=new yo(!0);class Z1{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function Uu(t){let e=[];do e.push(e0(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function e0(t){let e=[];do e.push(t0(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function t0(t){let e=r0(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=n0(t,e);else break;return e}function Hu(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function n0(t,e){let n=Hu(t),o=n;return t.eat(",")&&(t.next!="}"?o=Hu(t):o=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:o,expr:e}}function o0(t,e){let n=t.nodeTypes,o=n[e];if(o)return[o];let r=[];for(let i in n){let s=n[i];s.isInGroup(e)&&r.push(s)}return r.length==0&&t.err("No node type or group '"+e+"' found"),r}function r0(t){if(t.eat("(")){let e=Uu(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=o0(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function i0(t){let e=[[]];return r(i(t,0),n()),e;function n(){return e.push([])-1}function o(s,l,c){let d={term:c,to:l};return e[s].push(d),d}function r(s,l){s.forEach(c=>c.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((c,d)=>c.concat(i(d,l)),[]);if(s.type=="seq")for(let c=0;;c++){let d=i(s.exprs[c],l);if(c==s.exprs.length-1)return d;r(d,l=n())}else if(s.type=="star"){let c=n();return o(l,c),r(i(s.expr,c),c),[o(c)]}else if(s.type=="plus"){let c=n();return r(i(s.expr,l),c),r(i(s.expr,c),c),[o(c)]}else{if(s.type=="opt")return[o(l)].concat(i(s.expr,l));if(s.type=="range"){let c=l;for(let d=0;d<s.min;d++){let u=n();r(i(s.expr,c),u),c=u}if(s.max==-1)r(i(s.expr,c),c);else for(let d=s.min;d<s.max;d++){let u=n();o(c,u),r(i(s.expr,c),u),c=u}return[o(c)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Wu(t,e){return e-t}function Gu(t,e){let n=[];return o(e),n.sort(Wu);function o(r){let i=t[r];if(i.length==1&&!i[0].term)return o(i[0].to);n.push(r);for(let s=0;s<i.length;s++){let{term:l,to:c}=i[s];!l&&n.indexOf(c)==-1&&o(c)}}}function s0(t){let e=Object.create(null);return n(Gu(t,0));function n(o){let r=[];o.forEach(s=>{t[s].forEach(({term:l,to:c})=>{if(!l)return;let d;for(let u=0;u<r.length;u++)r[u][0]==l&&(d=r[u][1]);Gu(t,c).forEach(u=>{d||r.push([l,d=[]]),d.indexOf(u)==-1&&d.push(u)})})});let i=e[o.join(",")]=new yo(o.indexOf(t.length-1)>-1);for(let s=0;s<r.length;s++){let l=r[s][1].sort(Wu);i.next.push({type:r[s][0],next:e[l.join(",")]||n(l)})}return i}}function a0(t,e){for(let n=0,o=[t];n<o.length;n++){let r=o[n],i=!r.validEnd,s=[];for(let l=0;l<r.next.length;l++){let{type:c,next:d}=r.next[l];s.push(c.name),i&&!(c.isText||c.hasRequiredAttrs())&&(i=!1),o.indexOf(d)==-1&&o.push(d)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function qu(t){let e=Object.create(null);for(let n in t){let o=t[n];if(!o.hasDefault)return null;e[n]=o.default}return e}function Ku(t,e){let n=Object.create(null);for(let o in t){let r=e&&e[o];if(r===void 0){let i=t[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}n[o]=r}return n}function Ju(t,e,n,o){for(let r in e)if(!(r in t))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let r in t){let i=t[r];i.validate&&i.validate(e[r])}}function Xu(t,e){let n=Object.create(null);if(e)for(let o in e)n[o]=new c0(t,o,e[o]);return n}let Yu=class Bm{constructor(e,n,o){this.name=e,this.schema=n,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=Xu(e,o.attrs),this.defaultAttrs=qu(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==yo.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:Ku(this.attrs,e)}create(e=null,n,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Gn(this,this.computeAttrs(e),oe.from(n),je.setFrom(o))}createChecked(e=null,n,o){return n=oe.from(n),this.checkContent(n),new Gn(this,this.computeAttrs(e),n,je.setFrom(o))}createAndFill(e=null,n,o){if(e=this.computeAttrs(e),n=oe.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let r=this.contentMatch.matchFragment(n),i=r&&r.fillBefore(oe.empty,!0);return i?new Gn(this,e,n.append(i),je.setFrom(o)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).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){Ju(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?n&&n.push(e[o]):n||(n=e.slice(0,o));return n?n.length?n:je.none:e}static compile(e,n){let o=Object.create(null);e.forEach((i,s)=>o[i]=new Bm(i,n,s));let r=n.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let i in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function l0(t,e,n){let o=n.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${t}, got ${i}`)}}class c0{constructor(e,n,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?l0(e,n,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class Oi{constructor(e,n,o,r){this.name=e,this.rank=n,this.schema=o,this.spec=r,this.attrs=Xu(e,r.attrs),this.excluded=null;let i=qu(this.attrs);this.instance=i?new je(this,i):null}create(e=null){return!e&&this.instance?this.instance:new je(this,Ku(this.attrs,e))}static compile(e,n){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new Oi(i,r++,n,s)),o}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){Ju(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Qu{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let r in e)n[r]=e[r];n.nodes=pt.from(e.nodes),n.marks=pt.from(e.marks||{}),this.nodes=Yu.compile(this.spec.nodes,this),this.marks=Oi.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=o[s]||(o[s]=yo.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?Zu(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:Zu(this,s.split(" "))}this.nodeFromJSON=r=>Gn.fromJSON(this,r),this.markFromJSON=r=>je.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Yu){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,o,r)}text(e,n){let o=this.nodes.text;return new Ii(o,o.defaultAttrs,e,je.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Zu(t,e){let n=[];for(let o=0;o<e.length;o++){let r=e[o],i=t.marks[r],s=i;if(i)n.push(i);else for(let l in t.marks){let c=t.marks[l];(r=="_"||c.spec.group&&c.spec.group.split(" ").indexOf(r)>-1)&&n.push(s=c)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return n}function d0(t){return t.tag!=null}function u0(t){return t.style!=null}let kr=class Ic{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let o=this.matchedStyles=[];n.forEach(r=>{if(d0(r))this.tags.push(r);else if(u0(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,n={}){let o=new of(this,n,!1);return o.addAll(e,je.none,n.from,n.to),o.finish()}parseSlice(e,n={}){let o=new of(this,n,!0);return o.addAll(e,je.none,n.from,n.to),fe.maxOpen(o.finish())}matchTag(e,n,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(h0(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||n.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,n,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=n))){if(s.getAttrs){let c=s.getAttrs(n);if(c===!1)continue;s.attrs=c||void 0}return s}}}static schemaRules(e){let n=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<n.length;s++){let l=n[s];if((l.priority==null?50:l.priority)<i)break}n.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=rf(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=rf(s)),s.node||s.ignore||s.mark||(s.node=r)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Ic(e,Ic.schemaRules(e)))}};const ef={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},f0={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},tf={ol:!0,ul:!0},wr=1,Ua=2,Sr=4;function nf(t,e,n){return e!=null?(e?wr:0)|(e==="full"?Ua:0):t&&t.whitespace=="pre"?wr|Ua:n&~Sr}class Di{constructor(e,n,o,r,i,s){this.type=e,this.attrs=n,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=je.none,this.match=i||(s&Sr?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(oe.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&wr)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let n=oe.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(oe.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ef.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class of{constructor(e,n,o){this.parser=e,this.options=n,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=n.topNode,i,s=nf(null,n.preserveWhitespace,0)|(o?Sr:0);r?i=new Di(r.type,r.attrs,je.none,!0,n.topMatch||r.type.contentMatch,s):o?i=new Di(null,null,je.none,!0,null,s):i=new Di(e.schema.topNodeType,null,je.none,!0,null,s),this.nodes=[i],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let o=e.nodeValue,r=this.top,i=r.options&Ua?"full":this.localPreserveWS||(r.options&wr)>0,{schema:s}=this.parser;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)if(i==="full")o=o.replace(/\r\n?/g,`
350
350
  `);else if(s.linebreakReplacement&&/[\r\n]/.test(o)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=o.split(/\r?\n|\r/);for(let c=0;c<l.length;c++)c&&this.insertNode(s.linebreakReplacement.create(),n,!0),l[c]&&this.insertNode(s.text(l[c]),n,!/\S/.test(l[c]));o=""}else o=o.replace(/\r?\n|\r/g," ");else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let l=r.content[r.content.length-1],c=e.previousSibling;(!l||c&&c.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(o=o.slice(1))}o&&this.insertNode(s.text(o),n,!/\S/.test(o)),this.findInText(e)}else this.findInside(e)}addElement(e,n,o){let r=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;tf.hasOwnProperty(s)&&this.parser.normalizeLists&&p0(e);let c=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(c?c.ignore:f0.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!c||c.skip||c.closeParent){c&&c.closeParent?this.open=Math.max(0,this.open-1):c&&c.skip.nodeType&&(e=c.skip);let d,u=this.needsBlock;if(ef.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),d=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let f=c&&c.skip?n:this.readStyles(e,n);f&&this.addAll(e,f),d&&this.sync(i),this.needsBlock=u}else{let d=this.readStyles(e,n);d&&this.addElementByRule(e,c,d,c.consuming===!1?l:void 0)}this.localPreserveWS=r}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
351
- `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.getPropertyValue(i);if(s)for(let l=void 0;;){let c=this.parser.matchStyle(i,s,this,l);if(!c)break;if(c.ignore)return null;if(c.clearMark?n=n.filter(d=>!c.clearMark(d)):n=n.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)l=c;else break}}return n}addElementByRule(e,n,o,r){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let c=this.enter(s,n.attrs||null,o,n.preserveWhitespace);c&&(i=!0,o=c)}else{let c=this.parser.schema.marks[n.mark];o=o.concat(c.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,o,!1));else{let c=e;typeof n.contentElement=="string"?c=e.querySelector(n.contentElement):typeof n.contentElement=="function"?c=n.contentElement(e):n.contentElement&&(c=n.contentElement),this.findAround(e,c,!0),this.addAll(c,o),this.findAround(e,c,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,o){let r,i;for(let s=this.open,l=0;s>=0;s--){let c=this.nodes[s],d=c.findWrapping(e);if(d&&(!r||r.length>d.length+l)&&(r=d,i=c,!d.length))break;if(c.solid){if(o)break;l+=2}}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)n=this.enterInner(r[s],null,n,!1);return n}insertNode(e,n,o){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let r=this.findPlace(e,n,o);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=je.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):sf(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,o,r){let i=this.findPlace(e.create(n),o,!1);return i&&(i=this.enterInner(e,n,o,!0,r)),i}enterInner(e,n,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=nf(e,i,s.options);s.options&Sr&&s.content.length==0&&(l|=Sr);let c=je.none;return o=o.filter(d=>(s.type?s.type.allowsMarkType(d.type):sf(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new Di(e,n,c,r,null,l)),this.open++,o}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=wr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let o=this.nodes[n].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==n&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,o){if(e!=n&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&n.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(l,c)=>{for(;l>=0;l--){let d=n[l];if(d==""){if(l==n.length-1||l==0)continue;for(;c>=i;c--)if(s(l-1,c))return!0;return!1}else{let u=c>0||c==0&&r?this.nodes[c].type:o&&c>=i?o.node(c-i).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;c--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let n in this.parser.schema.nodes){let o=this.parser.schema.nodes[n];if(o.isTextblock&&o.defaultAttrs)return o}}}function p0(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&tf.hasOwnProperty(o)&&n?(n.appendChild(e),e=n):o=="li"?n=e:o&&(n=null)}}function h0(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function rf(t){let e={};for(let n in t)e[n]=t[n];return e}function sf(t,e){let n=e.schema.nodes;for(let o in n){let r=n[o];if(!r.allowsMarkType(t))continue;let i=[],s=l=>{i.push(l);for(let c=0;c<l.edgeCount;c++){let{type:d,next:u}=l.edge(c);if(d==e||i.indexOf(u)<0&&s(u))return!0}};if(s(r.contentMatch))return!0}}class xo{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},o){o||(o=Ha(n).createDocumentFragment());let r=o,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,c=0;for(;l<i.length&&c<s.marks.length;){let d=s.marks[c];if(!this.marks[d.type.name]){c++;continue}if(!d.eq(i[l][0])||d.type.spec.spanning===!1)break;l++,c++}for(;l<i.length;)r=i.pop()[1];for(;c<s.marks.length;){let d=s.marks[c++],u=this.serializeMark(d,s.isInline,n);u&&(i.push([d,r]),r.appendChild(u.dom),r=u.contentDOM||u.dom)}}r.appendChild(this.serializeNodeInner(s,n))}),o}serializeNodeInner(e,n){let{dom:o,contentDOM:r}=Ri(Ha(n),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,r)}return o}serializeNode(e,n={}){let o=this.serializeNodeInner(e,n);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(o),o=i.dom)}return o}serializeMark(e,n,o={}){let r=this.marks[e.type.name];return r&&Ri(Ha(o),r(e,n),null,e.attrs)}static renderSpec(e,n,o=null,r){return Ri(e,n,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new xo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=af(e.nodes);return n.text||(n.text=o=>o.text),n}static marksFromSchema(e){return af(e.marks)}}function af(t){let e={};for(let n in t){let o=t[n].spec.toDOM;o&&(e[n]=o)}return e}function Ha(t){return t.document||window.document}const lf=new WeakMap;function m0(t){let e=lf.get(t);return e===void 0&&lf.set(t,e=g0(t)),e}function g0(t){let e=null;function n(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)n(o[r]);else for(let r in o)n(o[r])}return n(t),e}function Ri(t,e,n,o){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],i;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=m0(o))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=r.indexOf(" ");s>0&&(n=r.slice(0,s),r=r.slice(s+1));let l,c=n?t.createElementNS(n,r):t.createElement(r),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let f in d)if(d[f]!=null){let p=f.indexOf(" ");p>0?c.setAttributeNS(f.slice(0,p),f.slice(p+1),d[f]):f=="style"&&c.style?c.style.cssText=d[f]:c.setAttribute(f,d[f])}}for(let f=u;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:h,contentDOM:m}=Ri(t,p,n,o);if(c.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:c,contentDOM:l}}const cf=65535,df=Math.pow(2,16);function b0(t,e){return t+e*df}function uf(t){return t&cf}function y0(t){return(t-(t&cf))/df}const ff=1,pf=2,Pi=4,hf=8;class Wa{constructor(e,n,o){this.pos=e,this.delInfo=n,this.recover=o}get deleted(){return(this.delInfo&hf)>0}get deletedBefore(){return(this.delInfo&(ff|Pi))>0}get deletedAfter(){return(this.delInfo&(pf|Pi))>0}get deletedAcross(){return(this.delInfo&Pi)>0}}class Vt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Vt.empty)return Vt.empty}recover(e){let n=0,o=uf(e);if(!this.inverted)for(let r=0;r<o;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+n+y0(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>e)break;let d=this.ranges[l+i],u=this.ranges[l+s],f=c+d;if(e<=f){let p=d?e==c?-1:e==f?1:n:n,h=c+r+(p<0?0:u);if(o)return h;let m=e==(n<0?c:f)?null:b0(l/3,e-c),b=e==c?pf:e==f?ff:Pi;return(n<0?e!=c:e!=f)&&(b|=hf),new Wa(h,b,m)}r+=u-d}return o?e+r:new Wa(e+r,0,null)}touches(e,n){let o=0,r=uf(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?o:0);if(c>e)break;let d=this.ranges[l+i],u=c+d;if(e<=u&&l==r*3)return!0;o+=this.ranges[l+s]-d}return!1}forEach(e){let n=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],l=s-(this.inverted?i:0),c=s+(this.inverted?0:i),d=this.ranges[r+n],u=this.ranges[r+o];e(l,l+d,c,c+u),i+=u-d}}invert(){return new Vt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Vt.empty:new Vt(e<0?[0,-e,0]:[0,0,e])}}Vt.empty=new Vt([]);class Li{constructor(e,n,o=0,r=e?e.length:0){this.mirror=n,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Li(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,o=this._maps.length;n<e._maps.length;n++){let r=e.getMirror(n);this.appendMap(e._maps[n],r!=null&&r<n?o+r:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,o=this._maps.length+e._maps.length;n>=0;n--){let r=e.getMirror(n);this.appendMap(e._maps[n].invert(),r!=null&&r>n?o-r-1:void 0)}}invert(){let e=new Li;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,n);if(l.recover!=null){let c=this.getMirror(i);if(c!=null&&c>i&&c<this.to){i=c,e=this._maps[c].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return o?e:new Wa(e,r,null)}}const Ga=Object.create(null);class xt{getMap(){return Vt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=Ga[n.stepType];if(!o)throw new RangeError(`No step type ${n.stepType} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in Ga)throw new RangeError("Duplicate use of step JSON ID "+e);return Ga[e]=n,n.prototype.jsonID=e,n}}class nt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new nt(e,null)}static fail(e){return new nt(null,e)}static fromReplace(e,n,o,r){try{return nt.ok(e.replace(n,o,r))}catch(i){if(i instanceof _i)return nt.fail(i.message);throw i}}}function qa(t,e,n){let o=[];for(let r=0;r<t.childCount;r++){let i=t.child(r);i.content.size&&(i=i.copy(qa(i.content,e,i))),i.isInline&&(i=e(i,n,r)),o.push(i)}return ne.fromArray(o)}class qn extends xt{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new ue(qa(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),n.openStart,n.openEnd);return nt.fromReplace(e,this.from,this.to,i)}invert(){return new sn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new qn(n.pos,o.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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new qn(n.from,n.to,e.markFromJSON(n.mark))}}xt.jsonID("addMark",qn);class sn extends xt{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=new ue(qa(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return nt.fromReplace(e,this.from,this.to,o)}invert(){return new qn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new sn(n.pos,o.pos,this.mark)}merge(e){return e instanceof sn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new sn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new sn(n.from,n.to,e.markFromJSON(n.mark))}}xt.jsonID("removeMark",sn);class Kn extends xt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return nt.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return nt.fromReplace(e,this.pos,this.pos+1,new ue(ne.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let o=this.mark.addToSet(n.marks);if(o.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(o))return new Kn(this.pos,n.marks[r]);return new Kn(this.pos,this.mark)}}return new Eo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Kn(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Kn(n.pos,e.markFromJSON(n.mark))}}xt.jsonID("addNodeMark",Kn);class Eo extends xt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return nt.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return nt.fromReplace(e,this.pos,this.pos+1,new ue(ne.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Kn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Eo(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Eo(n.pos,e.markFromJSON(n.mark))}}xt.jsonID("removeNodeMark",Eo);class ct extends xt{constructor(e,n,o,r=!1){super(),this.from=e,this.to=n,this.slice=o,this.structure=r}apply(e){return this.structure&&Ka(e,this.from,this.to)?nt.fail("Structure replace would overwrite content"):nt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Vt([this.from,this.to-this.from,this.slice.size])}invert(e){return new ct(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deletedAcross&&o.deletedAcross?null:new ct(n.pos,Math.max(n.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ct)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?ue.empty:new ue(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ct(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ue.empty:new ue(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ct(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ct(n.from,n.to,ue.fromJSON(e,n.slice),!!n.structure)}}xt.jsonID("replace",ct);class dt extends xt{constructor(e,n,o,r,i,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Ka(e,this.from,this.gapFrom)||Ka(e,this.gapTo,this.to)))return nt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return nt.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,n.content);return o?nt.fromReplace(e,this.from,this.to,o):nt.fail("Content does not fit in gap")}getMap(){return new Vt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new dt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return n.deletedAcross&&o.deletedAcross||r<n.pos||i>o.pos?null:new dt(n.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new dt(n.from,n.to,n.gapFrom,n.gapTo,ue.fromJSON(e,n.slice),n.insert,!!n.structure)}}xt.jsonID("replaceAround",dt);function Ka(t,e,n){let o=t.resolve(e),r=n-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function x0(t,e,n,o){let r=[],i=[],s,l;t.doc.nodesBetween(e,n,(c,d,u)=>{if(!c.isInline)return;let f=c.marks;if(!o.isInSet(f)&&u.type.allowsMarkType(o.type)){let p=Math.max(d,e),h=Math.min(d+c.nodeSize,n),m=o.addToSet(f);for(let b=0;b<f.length;b++)f[b].isInSet(m)||(s&&s.to==p&&s.mark.eq(f[b])?s.to=h:r.push(s=new sn(p,h,f[b])));l&&l.to==p?l.to=h:i.push(l=new qn(p,h,o))}}),r.forEach(c=>t.step(c)),i.forEach(c=>t.step(c))}function E0(t,e,n,o){let r=[],i=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;i++;let c=null;if(o instanceof Oi){let d=s.marks,u;for(;u=o.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else o?o.isInSet(s.marks)&&(c=[o]):c=s.marks;if(c&&c.length){let d=Math.min(l+s.nodeSize,n);for(let u=0;u<c.length;u++){let f=c[u],p;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&f.eq(r[h].style)&&(p=m)}p?(p.to=d,p.step=i):r.push({style:f,from:Math.max(l,e),to:d,step:i})}}}),r.forEach(s=>t.step(new sn(s.from,s.to,s.style)))}function Ja(t,e,n,o=n.contentMatch,r=!0){let i=t.doc.nodeAt(e),s=[],l=e+1;for(let c=0;c<i.childCount;c++){let d=i.child(c),u=l+d.nodeSize,f=o.matchType(d.type);if(!f)s.push(new ct(l,u,ue.empty));else{o=f;for(let p=0;p<d.marks.length;p++)n.allowsMarkType(d.marks[p].type)||t.step(new sn(l,u,d.marks[p]));if(r&&d.isText&&n.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(d.text);)m||(m=new ue(ne.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),s.push(new ct(l+p.index,l+p.index+p[0].length,m))}}l=u}if(!o.validEnd){let c=o.fillBefore(ne.empty,!0);t.replace(l,l,new ue(c,0,0))}for(let c=s.length-1;c>=0;c--)t.step(s[c])}function k0(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function $o(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let o=t.depth,r=0,i=0;;--o){let s=t.$from.node(o),l=t.$from.index(o)+r,c=t.$to.indexAfter(o)-i;if(o<t.depth&&s.canReplace(l,c,n))return o;if(o==0||s.type.spec.isolating||!k0(s,l,c))break;l&&(r=1),c<s.childCount&&(i=1)}return null}function w0(t,e,n){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),c=s,d=l,u=ne.empty,f=0;for(let m=i,b=!1;m>n;m--)b||o.index(m)>0?(b=!0,u=ne.from(o.node(m).copy(u)),f++):c--;let p=ne.empty,h=0;for(let m=i,b=!1;m>n;m--)b||r.after(m+1)<r.end(m)?(b=!0,p=ne.from(r.node(m).copy(p)),h++):d++;t.step(new dt(c,d,s,l,new ue(u.append(p),f,h),u.size-f,!0))}function Xa(t,e,n=null,o=t){let r=S0(t,e),i=r&&N0(o,e);return i?r.map(mf).concat({type:e,attrs:n}).concat(i.map(mf)):null}function mf(t){return{type:t,attrs:null}}function S0(t,e){let{parent:n,startIndex:o,endIndex:r}=t,i=n.contentMatchAt(o).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(o,r,s)?i:null}function N0(t,e){let{parent:n,startIndex:o,endIndex:r}=t,i=n.child(o),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let c=(s.length?s[s.length-1]:e).contentMatch;for(let d=o;c&&d<r;d++)c=c.matchType(n.child(d).type);return!c||!c.validEnd?null:s}function C0(t,e,n){let o=ne.empty;for(let s=n.length-1;s>=0;s--){if(o.size){let l=n[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=ne.from(n[s].type.create(n[s].attrs,o))}let r=e.start,i=e.end;t.step(new dt(r,i,r,i,new ue(o,0,0),n.length,!0))}function v0(t,e,n,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let c=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,c)&&T0(t.doc,t.mapping.slice(i).map(l),o)){let d=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?d=!1:!h&&m&&(d=!0)}d===!1&&bf(t,s,l,i),Ja(t,t.mapping.slice(i).map(l,1),o,void 0,d===null);let u=t.mapping.slice(i),f=u.map(l,1),p=u.map(l+s.nodeSize,1);return t.step(new dt(f,p,f+1,p-1,new ue(ne.from(o.create(c,null,s.marks)),0,0),1,!0)),d===!0&&gf(t,s,l,i),!1}})}function gf(t,e,n,o){e.forEach((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let c=t.mapping.slice(o).map(n+1+i+s.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function bf(t,e,n,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=t.mapping.slice(o).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
352
- `))}})}function T0(t,e,n){let o=t.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,n)}function z0(t,e,n,o,r){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(o,null,r||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new dt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ue(ne.from(s),0,0),1,!0))}function vn(t,e,n=1,o){let r=t.resolve(e),i=r.depth-n,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let d=r.depth-1,u=n-2;d>i;d--,u--){let f=r.node(d),p=r.index(d);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),m=o&&o[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let b=o&&o[u]||f;if(!f.canReplace(p+1,f.childCount)||!b.type.validContent(h))return!1}let l=r.indexAfter(i),c=o&&o[0];return r.node(i).canReplaceWith(l,l,c?c.type:r.node(i+1).type)}function _0(t,e,n=1,o){let r=t.doc.resolve(e),i=ne.empty,s=ne.empty;for(let l=r.depth,c=r.depth-n,d=n-1;l>c;l--,d--){i=ne.from(r.node(l).copy(i));let u=o&&o[d];s=ne.from(u?u.type.create(u.attrs,s):r.node(l).copy(s))}t.step(new ct(e,e,new ue(i.append(s),n,n),!0))}function Jn(t,e){let n=t.resolve(e),o=n.index();return yf(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(o,o+1)}function A0(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:o}=t.type.schema;for(let r=0;r<e.childCount;r++){let i=e.child(r),s=i.type==o?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function yf(t,e){return!!(t&&e&&!t.isLeaf&&A0(t,e))}function $i(t,e,n=-1){let o=t.resolve(e);for(let r=o.depth;;r--){let i,s,l=o.index(r);if(r==o.depth?(i=o.nodeBefore,s=o.nodeAfter):n>0?(i=o.node(r+1),l++,s=o.node(r).maybeChild(l)):(i=o.node(r).maybeChild(l-1),s=o.node(r+1)),i&&!i.isTextblock&&yf(i,s)&&o.node(r).canReplace(l,l+1))return e;if(r==0)break;e=n<0?o.before(r):o.after(r)}}function M0(t,e,n){let o=null,{linebreakReplacement:r}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(r&&s.inlineContent){let u=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);u&&!f?o=!1:!u&&f&&(o=!0)}let l=t.steps.length;if(o===!1){let u=t.doc.resolve(e+n);bf(t,u.node(),u.before(),l)}s.inlineContent&&Ja(t,e+n-1,s,i.node().contentMatchAt(i.index()),o==null);let c=t.mapping.slice(l),d=c.map(e-n);if(t.step(new ct(d,c.map(e+n,-1),ue.empty,!0)),o===!0){let u=t.doc.resolve(d);gf(t,u.node(),u.before(),t.steps.length)}return t}function I0(t,e,n){let o=t.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),n))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,n))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,n))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function O0(t,e,n){let o=t.resolve(e);if(!n.content.size)return e;let r=n.content;for(let i=0;i<n.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=o.depth;s>=0;s--){let l=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,c=o.index(s)+(l>0?1:0),d=o.node(s),u=!1;if(i==1)u=d.canReplace(c,c,r);else{let f=d.contentMatchAt(c).findWrapping(r.firstChild.type);u=f&&d.canReplaceWith(c,c,f[0])}if(u)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function Vi(t,e,n=e,o=ue.empty){if(e==n&&!o.size)return null;let r=t.resolve(e),i=t.resolve(n);return xf(r,i,o)?new ct(e,n,o):new D0(r,i,o).fit()}function xf(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class D0{constructor(e,n,o){this.$from=e,this.$to=n,this.unplaced=o,this.frontier=[],this.placed=ne.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=ne.from(e.node(r).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(),n=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,l=r.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let c=new ue(i,s,l);return e>-1?new dt(o.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||o.pos!=this.$to.pos?new ct(o.pos,r.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=n.firstChild;if(n.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}n=i.content}for(let n=1;n<=2;n++)for(let o=n==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=Ya(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:d}=this.frontier[l],u,f=null;if(n==1&&(s?d.matchType(s.type)||(f=d.fillBefore(ne.from(s),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(n==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:u};if(i&&d.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Ya(e,n);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new ue(e,n+1,Math.max(o,r.size+n>=e.size-o?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Ya(e,n);if(r.childCount<=1&&n>0){let i=e.size-n<=n+r.size;this.unplaced=new ue(Nr(e,n-1,1),n-1,i?n-1:o)}else this.unplaced=new ue(Nr(e,n,1),n,o)}placeNodes({sliceDepth:e,frontierDepth:n,parent:o,inject:r,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let b=0;b<i.length;b++)this.openFrontierNode(i[b]);let s=this.unplaced,l=o?o.content:s.content,c=s.openStart-e,d=0,u=[],{match:f,type:p}=this.frontier[n];if(r){for(let b=0;b<r.childCount;b++)u.push(r.child(b));f=f.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;d<l.childCount;){let b=l.child(d),g=f.matchType(b.type);if(!g)break;d++,(d>1||c==0||b.content.size)&&(f=g,u.push(Ef(b.mark(p.allowedMarks(b.marks)),d==1?c:0,d==l.childCount?h:-1)))}let m=d==l.childCount;m||(h=-1),this.placed=Cr(this.placed,n,ne.from(u)),this.frontier[n].match=f,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let b=0,g=l;b<h;b++){let x=g.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),g=x.content}this.unplaced=m?e==0?ue.empty:new ue(Nr(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new ue(Nr(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Qa(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:o,type:r}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Qa(e,n,r,o,i);if(s){for(let l=n-1;l>=0;l--){let{match:c,type:d}=this.frontier[l],u=Qa(e,l,d,c,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Cr(this.placed,n.depth,n.fit)),e=n.move;for(let o=n.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,n=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Cr(this.placed,this.depth,ne.from(e.create(n,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(ne.empty,!0);n.childCount&&(this.placed=Cr(this.placed,this.frontier.length,n))}}function Nr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Nr(t.firstChild.content,e-1,n)))}function Cr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Cr(t.lastChild.content,e-1,n)))}function Ya(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Ef(t,e,n){if(e<=0)return t;let o=t.content;return e>1&&(o=o.replaceChild(0,Ef(o.firstChild,e-1,o.childCount==1?n-1:0))),e>0&&(o=t.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(ne.empty,!0)))),t.copy(o)}function Qa(t,e,n,o,r){let i=t.node(e),s=r?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!R0(n,i.content,s)?l:null}function R0(t,e,n){for(let o=n;o<e.childCount;o++)if(!t.allowsMarks(e.child(o).marks))return!0;return!1}function P0(t){return t.spec.defining||t.spec.definingForContent}function L0(t,e,n,o){if(!o.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),i=t.doc.resolve(n);if(xf(r,i,o))return t.step(new ct(e,n,o));let s=wf(r,i);s[s.length-1]==0&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let p=r.depth,h=r.pos-1;p>0;p--,h--){let m=r.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?l=p:r.before(p)==h&&s.splice(1,0,-p)}let c=s.indexOf(l),d=[],u=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(d.push(m),h==o.openStart)break;p=m.content}for(let p=u-1;p>=0;p--){let h=d[p],m=P0(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))u=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+u+1)%(o.openStart+1),m=d[h];if(m)for(let b=0;b<s.length;b++){let g=s[(b+c)%s.length],x=!0;g<0&&(x=!1,g=-g);let v=r.node(g-1),w=r.index(g-1);if(v.canReplaceWith(w,w,m.type,m.marks))return t.replace(r.before(g),x?i.after(g):n,new ue(kf(o.content,0,o.openStart,h),h,o.openEnd))}}let f=t.steps.length;for(let p=s.length-1;p>=0&&(t.replace(e,n,o),!(t.steps.length>f));p--){let h=s[p];h<0||(e=r.before(h),n=i.after(h))}}function kf(t,e,n,o,r){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(kf(i.content,e+1,n,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(ne.empty,!0))}return t}function $0(t,e,n,o){if(!o.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=I0(t.doc,e,o.type);r!=null&&(e=n=r)}t.replaceRange(e,n,new ue(ne.from(o),0,0))}function V0(t,e,n){let o=t.doc.resolve(e),r=t.doc.resolve(n),i=wf(o,r);for(let s=0;s<i.length;s++){let l=i[s],c=s==i.length-1;if(c&&l==0||o.node(l).type.contentMatch.validEnd)return t.delete(o.start(l),r.end(l));if(l>0&&(c||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return t.delete(o.before(l),r.after(l))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&n>o.end(s)&&r.end(s)-n!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return t.delete(o.before(s),n);t.delete(e,n)}function wf(t,e){let n=[],o=Math.min(t.depth,e.depth);for(let r=o;r>=0;r--){let i=t.start(r);if(i<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&n.push(r)}return n}class Vo extends xt{constructor(e,n,o){super(),this.pos=e,this.attr=n,this.value=o}apply(e){let n=e.nodeAt(this.pos);if(!n)return nt.fail("No node at attribute step's position");let o=Object.create(null);for(let i in n.attrs)o[i]=n.attrs[i];o[this.attr]=this.value;let r=n.type.create(o,null,n.marks);return nt.fromReplace(e,this.pos,this.pos+1,new ue(ne.from(r),0,n.isLeaf?0:1))}getMap(){return Vt.empty}invert(e){return new Vo(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Vo(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Vo(n.pos,n.attr,n.value)}}xt.jsonID("attr",Vo);class vr extends xt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let o=e.type.create(n,e.content,e.marks);return nt.ok(o)}getMap(){return Vt.empty}invert(e){return new vr(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new vr(n.attr,n.value)}}xt.jsonID("docAttr",vr);let Bo=class extends Error{};Bo=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},Bo.prototype=Object.create(Error.prototype),Bo.prototype.constructor=Bo,Bo.prototype.name="TransformError";class Sf{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Li}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Bo(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,o=ue.empty){let r=Vi(this.doc,e,n,o);return r&&this.step(r),this}replaceWith(e,n,o){return this.replace(e,n,new ue(ne.from(o),0,0))}delete(e,n){return this.replace(e,n,ue.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,o){return L0(this,e,n,o),this}replaceRangeWith(e,n,o){return $0(this,e,n,o),this}deleteRange(e,n){return V0(this,e,n),this}lift(e,n){return w0(this,e,n),this}join(e,n=1){return M0(this,e,n),this}wrap(e,n){return C0(this,e,n),this}setBlockType(e,n=e,o,r=null){return v0(this,e,n,o,r),this}setNodeMarkup(e,n,o=null,r){return z0(this,e,n,o,r),this}setNodeAttribute(e,n,o){return this.step(new Vo(e,n,o)),this}setDocAttribute(e,n){return this.step(new vr(e,n)),this}addNodeMark(e,n){return this.step(new Kn(e,n)),this}removeNodeMark(e,n){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(n instanceof je)n.isInSet(o.marks)&&this.step(new Eo(e,n));else{let r=o.marks,i,s=[];for(;i=n.isInSet(r);)s.push(new Eo(e,i)),r=i.removeFromSet(r);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,n=1,o){return _0(this,e,n,o),this}addMark(e,n,o){return x0(this,e,n,o),this}removeMark(e,n,o){return E0(this,e,n,o),this}clearIncompatible(e,n,o){return Ja(this,e,n,o),this}}const Za=Object.create(null);class Pe{constructor(e,n,o){this.$anchor=e,this.$head=n,this.ranges=o||[new B0(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=ue.empty){let o=n.content.lastChild,r=null;for(let l=0;l<n.openEnd;l++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:c,$to:d}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(c.pos),u.map(d.pos),l?ue.empty:n),l==0&&vf(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,n){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:l}=r[i],c=e.mapping.slice(o),d=c.map(s.pos),u=c.map(l.pos);i?e.deleteRange(d,u):(e.replaceRangeWith(d,u,n),vf(e,o,n.isInline?-1:1))}}static findFrom(e,n,o=!1){let r=e.parent.inlineContent?new Oe(e):Fo(e.node(0),e.parent,e.pos,e.index(),n,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=n<0?Fo(e.node(0),e.node(i),e.before(i+1),e.index(i),n,o):Fo(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,o);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Bt(e.node(0))}static atStart(e){return Fo(e,e,0,0,1)||new Bt(e)}static atEnd(e){return Fo(e,e,e.content.size,e.childCount,-1)||new Bt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Za[n.type];if(!o)throw new RangeError(`No selection type ${n.type} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in Za)throw new RangeError("Duplicate use of selection JSON ID "+e);return Za[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Oe.between(this.$anchor,this.$head).getBookmark()}}Pe.prototype.visible=!0;class B0{constructor(e,n){this.$from=e,this.$to=n}}let Nf=!1;function Cf(t){!Nf&&!t.parent.inlineContent&&(Nf=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Oe extends Pe{constructor(e,n=e){Cf(e),Cf(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let o=e.resolve(n.map(this.head));if(!o.parent.inlineContent)return Pe.near(o);let r=e.resolve(n.map(this.anchor));return new Oe(r.parent.inlineContent?r:o,o)}replace(e,n=ue.empty){if(super.replace(e,n),n==ue.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof Oe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Bi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Oe(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){let r=e.resolve(n);return new this(r,o==n?r:e.resolve(o))}static between(e,n,o){let r=e.pos-n.pos;if((!o||r)&&(o=r>=0?1:-1),!n.parent.inlineContent){let i=Pe.findFrom(n,o,!0)||Pe.findFrom(n,-o,!0);if(i)n=i.$head;else return Pe.near(n,o)}return e.parent.inlineContent||(r==0?e=n:(e=(Pe.findFrom(e,-o,!0)||Pe.findFrom(e,o,!0)).$anchor,e.pos<n.pos!=r<0&&(e=n))),new Oe(e,n)}}Pe.jsonID("text",Oe);class Bi{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Bi(e.map(this.anchor),e.map(this.head))}resolve(e){return Oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ne extends Pe{constructor(e){let n=e.nodeAfter,o=e.node(0).resolve(e.pos+n.nodeSize);super(e,o),this.node=n}map(e,n){let{deleted:o,pos:r}=n.mapResult(this.anchor),i=e.resolve(r);return o?Pe.near(i):new Ne(i)}content(){return new ue(ne.from(this.node),0,0)}eq(e){return e instanceof Ne&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new el(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ne(e.resolve(n.anchor))}static create(e,n){return new Ne(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ne.prototype.visible=!1,Pe.jsonID("node",Ne);class el{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:o}=e.mapResult(this.anchor);return n?new Bi(o,o):new el(o)}resolve(e){let n=e.resolve(this.anchor),o=n.nodeAfter;return o&&Ne.isSelectable(o)?new Ne(n):Pe.near(n)}}class Bt extends Pe{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ue.empty){if(n==ue.empty){e.delete(0,e.doc.content.size);let o=Pe.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Bt(e)}map(e){return new Bt(e)}eq(e){return e instanceof Bt}getBookmark(){return F0}}Pe.jsonID("all",Bt);const F0={map(){return this},resolve(t){return new Bt(t)}};function Fo(t,e,n,o,r,i=!1){if(e.inlineContent)return Oe.create(t,n);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let l=e.child(s);if(l.isAtom){if(!i&&Ne.isSelectable(l))return Ne.create(t,n-(r<0?l.nodeSize:0))}else{let c=Fo(t,l,n+r,r<0?l.childCount:0,r,i);if(c)return c}n+=l.nodeSize*r}return null}function vf(t,e,n){let o=t.steps.length-1;if(o<e)return;let r=t.steps[o];if(!(r instanceof ct||r instanceof dt))return;let i=t.mapping.maps[o],s;i.forEach((l,c,d,u)=>{s==null&&(s=u)}),t.setSelection(Pe.near(t.doc.resolve(s),n))}const Tf=1,Fi=2,zf=4;class j0 extends Sf{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|Tf)&~Fi,this.storedMarks=null,this}get selectionSet(){return(this.updated&Tf)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Fi,this}ensureMarks(e){return je.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&Fi)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Fi,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let o=this.selection;return n&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||je.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,o){let r=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(o==null&&(o=n),!e)return this.deleteRange(n,o);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=o==n?s.marks():s.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(n,o,r.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Pe.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=zf,this}get scrolledIntoView(){return(this.updated&zf)>0}}function _f(t,e){return!e||!t?t:t.bind(e)}class Tr{constructor(e,n,o){this.name=e,this.init=_f(n.init,o),this.apply=_f(n.apply,o)}}const U0=[new Tr("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Tr("selection",{init(t,e){return t.selection||Pe.atStart(e.doc)},apply(t){return t.selection}}),new Tr("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,o){return o.selection.$cursor?t.storedMarks:null}}),new Tr("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class tl{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=U0.slice(),n&&n.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new Tr(o.key,o.spec.state,o))})}}class jo{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let o=0;o<this.config.plugins.length;o++)if(o!=n){let r=this.config.plugins[o];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],o=this.applyInner(e),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let c=r?r[s].n:0,d=r?r[s].state:this,u=c<n.length&&l.spec.appendTransaction.call(l,c?n.slice(c):n,d,o);if(u&&o.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!r){r=[];for(let f=0;f<this.config.plugins.length;f++)r.push(f<s?{state:o,n:n.length}:{state:this,n:0})}n.push(u),o=o.applyInner(u),i=!0}r&&(r[s]={state:o,n:n.length})}}if(!i)return{state:o,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new jo(this.config),o=this.config.fields;for(let r=0;r<o.length;r++){let i=o[r];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new j0(this)}static create(e){let n=new tl(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new jo(n);for(let r=0;r<n.fields.length;r++)o[n.fields[r].name]=n.fields[r].init(e,o);return o}reconfigure(e){let n=new tl(this.schema,e.plugins),o=n.fields,r=new jo(n);for(let i=0;i<o.length;i++){let s=o[i].name;r[s]=this.hasOwnProperty(s)?this[s]:o[i].init(e,r)}return r}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[o],i=r.spec.state;i&&i.toJSON&&(n[o]=i.toJSON.call(r,this[r.key]))}return n}static fromJSON(e,n,o){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new tl(e.schema,e.plugins),i=new jo(r);return r.fields.forEach(s=>{if(s.name=="doc")i.doc=Gn.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=Pe.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let l in o){let c=o[l],d=c.spec.state;if(c.key==s.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[s.name]=d.fromJSON.call(c,e,n[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function Af(t,e,n){for(let o in t){let r=t[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=Af(r,e,{})),n[o]=r}return n}class Ot{constructor(e){this.spec=e,this.props={},e.props&&Af(e.props,this,this.props),this.key=e.key?e.key.key:Mf("plugin")}getState(e){return e[this.key]}}const nl=Object.create(null);function Mf(t){return t in nl?t+"$"+ ++nl[t]:(nl[t]=0,t+"$")}class an{constructor(e="key"){this.key=Mf(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ol=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function If(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Of=(t,e,n)=>{let o=If(t,n);if(!o)return!1;let r=rl(o);if(!r){let s=o.blockRange(),l=s&&$o(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(jf(t,r,e,-1))return!0;if(o.parent.content.size==0&&(Uo(i,"end")||Ne.isSelectable(i)))for(let s=o.depth;;s--){let l=Vi(t.doc,o.before(s),o.after(s),ue.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=t.tr.step(l);c.setSelection(Uo(i,"end")?Pe.findFrom(c.doc.resolve(c.mapping.map(r.pos,-1)),-1):Ne.create(c.doc,r.pos-i.nodeSize)),e(c.scrollIntoView())}return!0}if(s==1||o.node(s-1).childCount>1)break}return i.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0):!1},H0=(t,e,n)=>{let o=If(t,n);if(!o)return!1;let r=rl(o);return r?Df(t,r,e):!1},W0=(t,e,n)=>{let o=Pf(t,n);if(!o)return!1;let r=il(o);return r?Df(t,r,e):!1};function Df(t,e,n){let o=e.nodeBefore,r=o,i=e.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let u=r.lastChild;if(!u)return!1;r=u}let s=e.nodeAfter,l=s,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let d=Vi(t.doc,i,c,ue.empty);if(!d||d.from!=i||d instanceof ct&&d.slice.size>=c-i)return!1;if(n){let u=t.tr.step(d);u.setSelection(Oe.create(u.doc,i)),n(u.scrollIntoView())}return!0}function Uo(t,e,n=!1){for(let o=t;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(n&&o.childCount!=1)return!1}return!1}const Rf=(t,e,n)=>{let{$head:o,empty:r}=t.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):o.parentOffset>0)return!1;i=rl(o)}let s=i&&i.nodeBefore;return!s||!Ne.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Ne.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function rl(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Pf(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Lf=(t,e,n)=>{let o=Pf(t,n);if(!o)return!1;let r=il(o);if(!r)return!1;let i=r.nodeAfter;if(jf(t,r,e,1))return!0;if(o.parent.content.size==0&&(Uo(i,"start")||Ne.isSelectable(i))){let s=Vi(t.doc,o.before(),o.after(),ue.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(Uo(i,"start")?Pe.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):Ne.create(l.doc,l.mapping.map(r.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0):!1},$f=(t,e,n)=>{let{$head:o,empty:r}=t.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):o.parentOffset<o.parent.content.size)return!1;i=il(o)}let s=i&&i.nodeAfter;return!s||!Ne.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Ne.create(t.doc,i.pos)).scrollIntoView()),!0)};function il(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const G0=(t,e)=>{let n=t.selection,o=n instanceof Ne,r;if(o){if(n.node.isTextblock||!Jn(t.doc,n.from))return!1;r=n.from}else if(r=$i(t.doc,n.from,-1),r==null)return!1;if(e){let i=t.tr.join(r);o&&i.setSelection(Ne.create(i.doc,r-t.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},q0=(t,e)=>{let n=t.selection,o;if(n instanceof Ne){if(n.node.isTextblock||!Jn(t.doc,n.to))return!1;o=n.to}else if(o=$i(t.doc,n.to,1),o==null)return!1;return e&&e(t.tr.join(o).scrollIntoView()),!0},K0=(t,e)=>{let{$from:n,$to:o}=t.selection,r=n.blockRange(o),i=r&&$o(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},Vf=(t,e)=>{let{$head:n,$anchor:o}=t.selection;return!n.parent.type.spec.code||!n.sameParent(o)?!1:(e&&e(t.tr.insertText(`
353
- `).scrollIntoView()),!0)};function sl(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const J0=(t,e)=>{let{$head:n,$anchor:o}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(o))return!1;let r=n.node(-1),i=n.indexAfter(-1),s=sl(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(e){let l=n.after(),c=t.tr.replaceWith(l,l,s.createAndFill());c.setSelection(Pe.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},Bf=(t,e)=>{let n=t.selection,{$from:o,$to:r}=n;if(n instanceof Bt||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=sl(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,l=t.tr.insert(s,i.createAndFill());l.setSelection(Oe.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},Ff=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(vn(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let o=n.blockRange(),r=o&&$o(o);return r==null?!1:(e&&e(t.tr.lift(o,r).scrollIntoView()),!0)};function X0(t){return(e,n)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof Ne&&e.selection.node.isBlock)return!o.parentOffset||!vn(e.doc,o.pos)?!1:(n&&n(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let i=[],s,l,c=!1,d=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){c=o.end(h)==o.pos+(o.depth-h),d=o.start(h)==o.pos-(o.depth-h),l=sl(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),i.unshift(c&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof Oe||e.selection instanceof Bt)&&u.deleteSelection();let f=u.mapping.map(o.pos),p=vn(u.doc,f,i.length,i);if(p||(i[0]=l?{type:l}:null,p=vn(u.doc,f,i.length,i)),!p)return!1;if(u.split(f,i.length,i),!c&&d&&o.node(s).type!=l){let h=u.mapping.map(o.before(s)),m=u.doc.resolve(h);l&&o.node(s-1).canReplaceWith(m.index(),m.index()+1,l)&&u.setNodeMarkup(u.mapping.map(o.before(s)),l)}return n&&n(u.scrollIntoView()),!0}}const Y0=X0(),Q0=(t,e)=>{let{$from:n,to:o}=t.selection,r,i=n.sharedDepth(o);return i==0?!1:(r=n.before(i),e&&e(t.tr.setSelection(Ne.create(t.doc,r))),!0)};function Z0(t,e,n){let o=e.nodeBefore,r=e.nodeAfter,i=e.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(r.isTextblock||Jn(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function jf(t,e,n,o){let r=e.nodeBefore,i=e.nodeAfter,s,l,c=r.type.spec.isolating||i.type.spec.isolating;if(!c&&Z0(t,e,n))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(s=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,m=ne.empty;for(let x=s.length-1;x>=0;x--)m=ne.from(s[x].create(null,m));m=ne.from(r.copy(m));let b=t.tr.step(new dt(e.pos-1,h,e.pos,h,new ue(m,1,0),s.length,!0)),g=b.doc.resolve(h+2*s.length);g.nodeAfter&&g.nodeAfter.type==r.type&&Jn(b.doc,g.pos)&&b.join(g.pos),n(b.scrollIntoView())}return!0}let u=i.type.spec.isolating||o>0&&c?null:Pe.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),p=f&&$o(f);if(p!=null&&p>=e.depth)return n&&n(t.tr.lift(f,p).scrollIntoView()),!0;if(d&&Uo(i,"start",!0)&&Uo(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let b=i,g=1;for(;!b.isTextblock;b=b.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,b.content)){if(n){let x=ne.empty;for(let w=m.length-1;w>=0;w--)x=ne.from(m[w].copy(x));let v=t.tr.step(new dt(e.pos-m.length,e.pos+i.nodeSize,e.pos+g,e.pos+i.nodeSize-g,new ue(x,m.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function Uf(t){return function(e,n){let o=e.selection,r=t<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(n&&n(e.tr.setSelection(Oe.create(e.doc,t<0?r.start(i):r.end(i)))),!0):!1}}const ex=Uf(-1),tx=Uf(1);function nx(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i),l=s&&Xa(s,t,e);return l?(o&&o(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Hf(t,e=null){return function(n,o){let r=!1;for(let i=0;i<n.selection.ranges.length&&!r;i++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(c,d)=>{if(r)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)r=!0;else{let u=n.doc.resolve(d),f=u.index();r=u.parent.canReplaceWith(f,f+1,t)}})}if(!r)return!1;if(o){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[s];i.setBlockType(l,c,t,e)}o(i.scrollIntoView())}return!0}}function al(...t){return function(e,n,o){for(let r=0;r<t.length;r++)if(t[r](e,n,o))return!0;return!1}}al(ol,Of,Rf),al(ol,Lf,$f),al(Vf,Bf,Ff,Y0),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function ox(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i);if(!s)return!1;let l=o?n.tr:null;return rx(l,s,t,e)?(o&&o(l.scrollIntoView()),!0):!1}}function rx(t,e,n,o=null){let r=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=s.resolve(e.start-2);i=new Mi(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new Mi(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=Xa(i,n,o,e);return l?(t&&ix(t,e,l,r,n),!0):!1}function ix(t,e,n,o,r){let i=ne.empty;for(let u=n.length-1;u>=0;u--)i=ne.from(n[u].type.create(n[u].attrs,i));t.step(new dt(e.start-(o?2:0),e.end,e.start,e.end,new ue(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==r&&(s=u+1);let l=n.length-s,c=e.start+n.length-(o?2:0),d=e.parent;for(let u=e.startIndex,f=e.endIndex,p=!0;u<f;u++,p=!1)!p&&vn(t.doc,c,l)&&(t.split(c,l),c+=2*l),c+=d.child(u).nodeSize;return t}function sx(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,s=>s.childCount>0&&s.firstChild.type==t);return i?n?o.node(i.depth-1).type==t?ax(e,n,t,i):lx(e,n,i):!0:!1}}function ax(t,e,n,o){let r=t.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new dt(i-1,s,i,s,new ue(ne.from(n.create(null,o.parent.copy())),1,0),1,!0)),o=new Mi(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=$o(o);if(l==null)return!1;r.lift(o,l);let c=r.doc.resolve(r.mapping.map(i,-1)-1);return Jn(r.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&r.join(c.pos),e(r.scrollIntoView()),!0}function lx(t,e,n){let o=t.tr,r=n.parent;for(let h=n.end,m=n.endIndex-1,b=n.startIndex;m>b;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let i=o.doc.resolve(n.start),s=i.nodeAfter;if(o.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,c=n.endIndex==r.childCount,d=i.node(-1),u=i.index(-1);if(!d.canReplace(u+(l?0:1),u+1,s.content.append(c?ne.empty:ne.from(r))))return!1;let f=i.pos,p=f+s.nodeSize;return o.step(new dt(f-(l?1:0),p+(c?1:0),f+1,p-1,new ue((l?ne.empty:ne.from(r.copy(ne.empty))).append(c?ne.empty:ne.from(r.copy(ne.empty))),l?0:1,c?0:1),l?0:1)),e(o.scrollIntoView()),!0}function cx(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,d=>d.childCount>0&&d.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,c=l.child(s-1);if(c.type!=t)return!1;if(n){let d=c.lastChild&&c.lastChild.type==l.type,u=ne.from(d?t.create():null),f=new ue(ne.from(t.create(null,ne.from(l.type.create(null,u)))),d?3:1,0),p=i.start,h=i.end;n(e.tr.step(new dt(p-(d?3:1),h,p,h,f,1,!0)).scrollIntoView())}return!0}}const ht=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ho=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let ll=null;const Tn=function(t,e,n){let o=ll||(ll=document.createRange());return o.setEnd(t,n??t.nodeValue.length),o.setStart(t,e||0),o},dx=function(){ll=null},ko=function(t,e,n,o){return n&&(Wf(t,e,n,o,-1)||Wf(t,e,n,o,1))},ux=/^(img|br|input|textarea|hr)$/i;function Wf(t,e,n,o,r){for(var i;;){if(t==n&&e==o)return!0;if(e==(r<0?0:Ht(t))){let s=t.parentNode;if(!s||s.nodeType!=1||zr(t)||ux.test(t.nodeName)||t.contentEditable=="false")return!1;e=ht(t)+(r<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(r<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=r;else return!1;else t=s,e=r<0?Ht(t):0}else return!1}}function Ht(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function fx(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Ht(t)}else if(t.parentNode&&!zr(t))e=ht(t),t=t.parentNode;else return null}}function px(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!zr(t))e=ht(t)+1,t=t.parentNode;else return null}}function hx(t,e,n){for(let o=e==0,r=e==Ht(t);o||r;){if(t==n)return!0;let i=ht(t);if(t=t.parentNode,!t)return!1;o=o&&i==0,r=r&&i==Ht(t)}}function zr(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const ji=function(t){return t.focusNode&&ko(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function wo(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function mx(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function gx(t,e,n){if(t.caretPositionFromPoint)try{let o=t.caretPositionFromPoint(e,n);if(o)return{node:o.offsetNode,offset:Math.min(Ht(o.offsetNode),o.offset)}}catch{}if(t.caretRangeFromPoint){let o=t.caretRangeFromPoint(e,n);if(o)return{node:o.startContainer,offset:Math.min(Ht(o.startContainer),o.startOffset)}}}const hn=typeof navigator<"u"?navigator:null,Gf=typeof document<"u"?document:null,Xn=hn&&hn.userAgent||"",cl=/Edge\/(\d+)/.exec(Xn),qf=/MSIE \d/.exec(Xn),dl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Xn),Dt=!!(qf||dl||cl),Yn=qf?document.documentMode:dl?+dl[1]:cl?+cl[1]:0,Wt=!Dt&&/gecko\/(\d+)/i.test(Xn);Wt&&+(/Firefox\/(\d+)/.exec(Xn)||[0,0])[1];const ul=!Dt&&/Chrome\/(\d+)/.exec(Xn),ut=!!ul,Kf=ul?+ul[1]:0,mt=!Dt&&!!hn&&/Apple Computer/.test(hn.vendor),Wo=mt&&(/Mobile\/\w+/.test(Xn)||!!hn&&hn.maxTouchPoints>2),Gt=Wo||(hn?/Mac/.test(hn.platform):!1),Jf=hn?/Win/.test(hn.platform):!1,zn=/Android \d/.test(Xn),_r=!!Gf&&"webkitFontSmoothing"in Gf.documentElement.style,bx=_r?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function yx(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function _n(t,e){return typeof t=="number"?t:t[e]}function xx(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,o=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*o}}function Xf(t,e,n){let o=t.someProp("scrollThreshold")||0,r=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=Ho(s);continue}let l=s,c=l==i.body,d=c?yx(i):xx(l),u=0,f=0;if(e.top<d.top+_n(o,"top")?f=-(d.top-e.top+_n(r,"top")):e.bottom>d.bottom-_n(o,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+_n(r,"top")-d.top:e.bottom-d.bottom+_n(r,"bottom")),e.left<d.left+_n(o,"left")?u=-(d.left-e.left+_n(r,"left")):e.right>d.right-_n(o,"right")&&(u=e.right-d.right+_n(r,"right")),u||f)if(c)i.defaultView.scrollBy(u,f);else{let h=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),u&&(l.scrollLeft+=u);let b=l.scrollLeft-h,g=l.scrollTop-m;e={left:e.left-b,top:e.top-g,right:e.right-b,bottom:e.bottom-g}}let p=c?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:Ho(s)}}function Ex(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),o,r;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=t.root.elementFromPoint(i,s);if(!l||l==t.dom||!t.dom.contains(l))continue;let c=l.getBoundingClientRect();if(c.top>=n-20){o=l,r=c.top;break}}return{refDOM:o,refTop:r,stack:Yf(t.dom)}}function Yf(t){let e=[],n=t.ownerDocument;for(let o=t;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),t!=n);o=Ho(o));return e}function kx({refDOM:t,refTop:e,stack:n}){let o=t?t.getBoundingClientRect().top:0;Qf(n,o==0?0:o-e)}function Qf(t,e){for(let n=0;n<t.length;n++){let{dom:o,top:r,left:i}=t[n];o.scrollTop!=r+e&&(o.scrollTop=r+e),o.scrollLeft!=i&&(o.scrollLeft=i)}}let Go=null;function wx(t){if(t.setActive)return t.setActive();if(Go)return t.focus(Go);let e=Yf(t);t.focus(Go==null?{get preventScroll(){return Go={preventScroll:!0},!0}}:void 0),Go||(Go=!1,Qf(e,0))}function Zf(t,e){let n,o=2e8,r,i=0,s=e.top,l=e.top,c,d;for(let u=t.firstChild,f=0;u;u=u.nextSibling,f++){let p;if(u.nodeType==1)p=u.getClientRects();else if(u.nodeType==3)p=Tn(u).getClientRects();else continue;for(let h=0;h<p.length;h++){let m=p[h];if(m.top<=s&&m.bottom>=l){s=Math.max(m.bottom,s),l=Math.min(m.top,l);let b=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(b<o){n=u,o=b,r=b&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&b&&(i=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=u,d={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=f+1)}}return!n&&c&&(n=c,r=d,o=0),n&&n.nodeType==3?Sx(n,r):!n||o&&n.nodeType==1?{node:t,offset:i}:Zf(n,r)}function Sx(t,e){let n=t.nodeValue.length,o=document.createRange(),r;for(let i=0;i<n;i++){o.setEnd(t,i+1),o.setStart(t,i);let s=Qn(o,1);if(s.top!=s.bottom&&fl(e,s)){r={node:t,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return o.detach(),r||{node:t,offset:0}}function fl(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Nx(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Cx(t,e,n){let{node:o,offset:r}=Zf(e,n),i=-1;if(o.nodeType==1&&!o.firstChild){let s=o.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(o,r,i)}function vx(t,e,n,o){let r=-1;for(let i=e,s=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!0),c;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((c=l.dom.getBoundingClientRect()).width||c.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&c.left>o.left||c.top>o.top?r=l.posBefore:(!s&&c.right<o.left||c.bottom<o.top)&&(r=l.posAfter),s=!0),!l.contentDOM&&r<0&&!l.node.isText))return(l.node.isBlock?o.top<(c.top+c.bottom)/2:o.left<(c.left+c.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return r>-1?r:t.docView.posFromDOM(e,n,-1)}function ep(t,e,n){let o=t.childNodes.length;if(o&&n.top<n.bottom)for(let r=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-n.top)/(n.bottom-n.top))-2)),i=r;;){let s=t.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let c=0;c<l.length;c++){let d=l[c];if(fl(e,d))return ep(s,e,d)}}if((i=(i+1)%o)==r)break}return t}function Tx(t,e){let n=t.dom.ownerDocument,o,r=0,i=gx(n,e.left,e.top);i&&({node:o,offset:r}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let d=t.dom.getBoundingClientRect();if(!fl(e,d)||(s=ep(t.dom,e,d),!s))return null}if(mt)for(let d=s;o&&d;d=Ho(d))d.draggable&&(o=void 0);if(s=Nx(s,e),o){if(Wt&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let u=o.childNodes[r],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&r++}let d;_r&&r&&o.nodeType==1&&(d=o.childNodes[r-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&r--,o==t.dom&&r==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(r==0||o.nodeType!=1||o.childNodes[r-1].nodeName!="BR")&&(l=vx(t,o,r,e))}l==null&&(l=Cx(t,s,e));let c=t.docView.nearestDesc(s,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function tp(t){return t.top<t.bottom||t.left<t.right}function Qn(t,e){let n=t.getClientRects();if(n.length){let o=n[e<0?0:n.length-1];if(tp(o))return o}return Array.prototype.find.call(n,tp)||t.getBoundingClientRect()}const zx=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function np(t,e,n){let{node:o,offset:r,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=_r||Wt;if(o.nodeType==3)if(s&&(zx.test(o.nodeValue)||(n<0?!r:r==o.nodeValue.length))){let c=Qn(Tn(o,r,r),n);if(Wt&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let d=Qn(Tn(o,r-1,r-1),-1);if(d.top==c.top){let u=Qn(Tn(o,r,r+1),-1);if(u.top!=c.top)return Ar(u,u.left<d.left)}}return c}else{let c=r,d=r,u=n<0?1:-1;return n<0&&!r?(d++,u=-1):n>=0&&r==o.nodeValue.length?(c--,u=1):n<0?c--:d++,Ar(Qn(Tn(o,c,d),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(n<0||r==Ht(o))){let c=o.childNodes[r-1];if(c.nodeType==1)return pl(c.getBoundingClientRect(),!1)}if(i==null&&r<Ht(o)){let c=o.childNodes[r];if(c.nodeType==1)return pl(c.getBoundingClientRect(),!0)}return pl(o.getBoundingClientRect(),n>=0)}if(i==null&&r&&(n<0||r==Ht(o))){let c=o.childNodes[r-1],d=c.nodeType==3?Tn(c,Ht(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return Ar(Qn(d,1),!1)}if(i==null&&r<Ht(o)){let c=o.childNodes[r];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?Tn(c,0,s?0:1):c.nodeType==1?c:null:null;if(d)return Ar(Qn(d,-1),!0)}return Ar(Qn(o.nodeType==3?Tn(o):o,-n),n>=0)}function Ar(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function pl(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function op(t,e,n){let o=t.state,r=t.root.activeElement;o!=e&&t.updateState(e),r!=t.dom&&t.focus();try{return n()}finally{o!=e&&t.updateState(o),r!=t.dom&&r&&r.focus()}}function _x(t,e,n){let o=e.selection,r=n=="up"?o.$from:o.$to;return op(t,e,()=>{let{node:i}=t.docView.domFromPos(r.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=np(t,r.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let c;if(l.nodeType==1)c=l.getClientRects();else if(l.nodeType==3)c=Tn(l,0,l.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const Ax=/[\u0590-\u08ac]/;function Mx(t,e,n){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,s=r==o.parent.content.size,l=t.domSelection();return l?!Ax.test(o.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:s:op(t,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:u,anchorOffset:f}=t.domSelectionRange(),p=l.caretBidiLevel;l.modify("move",n,"character");let h=o.depth?t.docView.domAfterPos(o.before()):t.dom,{focusNode:m,focusOffset:b}=t.domSelectionRange(),g=m&&!h.contains(m.nodeType==1?m:m.parentNode)||c==m&&d==b;try{l.collapse(u,f),c&&(c!=u||d!=f)&&l.extend&&l.extend(c,d)}catch{}return p!=null&&(l.caretBidiLevel=p),g}):o.pos==o.start()||o.pos==o.end()}let rp=null,ip=null,sp=!1;function Ix(t,e,n){return rp==e&&ip==n?sp:(rp=e,ip=n,sp=n=="up"||n=="down"?_x(t,e,n):Mx(t,e,n))}const qt=0,ap=1,So=2,mn=3;class Mr{constructor(e,n,o,r){this.parent=e,this.children=n,this.dom=o,this.contentDOM=r,this.dirty=qt,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,o){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,o=this.posAtStart;;n++){let r=this.children[n];if(r==e)return o;o+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=n>ht(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!1;break}if(i.previousSibling)break}if(r==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!0;break}if(i.nextSibling)break}}return r??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let o=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),s;if(i&&(!n||i.node))if(o&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))o=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let o=n;o;o=o.parent)if(o==this)return n}posFromDOM(e,n,o){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,n,o)}return-1}descAt(e){for(let n=0,o=0;n<this.children.length;n++){let r=this.children[n],i=o+r.size;if(o==e&&i!=o){for(;!r.border&&r.children.length;)for(let s=0;s<r.children.length;s++){let l=r.children[s];if(l.size){r=l;break}}return r}if(e<i)return r.descAt(e-o-r.border);o=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,r=0;for(let i=0;o<this.children.length;o++){let s=this.children[o],l=i+s.size;if(l>e||s instanceof dp){r=e-i;break}i=l}if(r)return this.children[o].domFromPos(r-this.children[o].border,n);for(let i;o&&!(i=this.children[o-1]).size&&i instanceof lp&&i.side>=0;o--);if(n<=0){let i,s=!0;for(;i=o?this.children[o-1]:null,!(!i||i.dom.parentNode==this.contentDOM);o--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?ht(i.dom)+1:0}}else{let i,s=!0;for(;i=o<this.children.length?this.children[o]:null,!(!i||i.dom.parentNode==this.contentDOM);o++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?ht(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let s=o,l=0;;l++){let c=this.children[l],d=s+c.size;if(r==-1&&e<=d){let u=s+c.border;if(e>=u&&n<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,u);e=s;for(let f=l;f>0;f--){let p=this.children[f-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=ht(p.dom)+1;break}e-=p.size}r==-1&&(r=0)}if(r>-1&&(d>n||l==this.children.length-1)){n=d;for(let u=l+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=ht(f.dom);break}n+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=d}return{node:this.contentDOM,from:e,to:n,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:o}=this.domFromPos(e,0);if(n.nodeType!=1||o==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[o]}setSelection(e,n,o,r=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let h=0,m=0;h<this.children.length;h++){let b=this.children[h],g=m+b.size;if(i>m&&s<g)return b.setSelection(e-m-b.border,n-m-b.border,o,r);m=g}let l=this.domFromPos(e,e?-1:1),c=n==e?l:this.domFromPos(n,n?-1:1),d=o.root.getSelection(),u=o.domSelectionRange(),f=!1;if((Wt||mt)&&e==n){let{node:h,offset:m}=l;if(h.nodeType==3){if(f=!!(m&&h.nodeValue[m-1]==`
354
- `),f&&m==h.nodeValue.length)for(let b=h,g;b;b=b.parentNode){if(g=b.nextSibling){g.nodeName=="BR"&&(l=c={node:g.parentNode,offset:ht(g)+1});break}let x=b.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let b=h.childNodes[m-1];f=b&&(b.nodeName=="BR"||b.contentEditable=="false")}}if(Wt&&u.focusNode&&u.focusNode!=c.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(r=!0)}if(!(r||f&&mt)&&ko(l.node,l.offset,u.anchorNode,u.anchorOffset)&&ko(c.node,c.offset,u.focusNode,u.focusOffset))return;let p=!1;if((d.extend||e==n)&&!(f&&Wt)){d.collapse(l.node,l.offset);try{e!=n&&d.extend(c.node,c.offset),p=!0}catch{}}if(!p){if(e>n){let m=l;l=c,c=m}let h=document.createRange();h.setEnd(c.node,c.offset),h.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let o=0,r=0;r<this.children.length;r++){let i=this.children[r],s=o+i.size;if(o==s?e<=s&&n>=o:e<s&&n>o){let l=o+i.border,c=s-i.border;if(e>=l&&n<=c){this.dirty=e==o||n==s?So:ap,e==l&&n==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=mn:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?So:mn}o=s}this.dirty=So}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let o=e==1?So:ap;n.dirty<o&&(n.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class lp extends Mr{constructor(e,n,o,r){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(o,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==qt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Ox extends Mr{constructor(e,n,o,r){super(e,[],n,null),this.textDOM=o,this.text=r}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class No extends Mr{constructor(e,n,o,r,i){super(e,[],o,r),this.mark=n,this.spec=i}static create(e,n,o,r){let i=r.nodeViews[n.type.name],s=i&&i(n,r,o);return(!s||!s.dom)&&(s=xo.renderSpec(document,n.type.spec.toDOM(n,o),null,n.attrs)),new No(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&mn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=mn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=qt){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=qt}}slice(e,n,o){let r=No.create(this.parent,this.mark,!0,o),i=this.children,s=this.size;n<s&&(i=ml(i,n,s,o)),e>0&&(i=ml(i,0,e,o));for(let l=0;l<i.length;l++)i[l].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Zn extends Mr{constructor(e,n,o,r,i,s,l,c,d){super(e,[],i,s),this.node=n,this.outerDeco=o,this.innerDeco=r,this.nodeDOM=l}static create(e,n,o,r,i,s){let l=i.nodeViews[n.type.name],c,d=l&&l(n,i,()=>{if(!c)return s;if(c.parent)return c.parent.posBeforeChild(c)},o,r),u=d&&d.dom,f=d&&d.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=xo.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let p=u;return u=pp(u,o,n),d?c=new Dx(e,n,o,r,u,f||null,p,d,i,s+1):n.isText?new Ui(e,n,o,r,u,p,i):new Zn(e,n,o,r,u,f||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let o=this.children[n];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>ne.empty)}return e}matchesNode(e,n,o){return this.dirty==qt&&e.eq(this.node)&&Hi(n,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let o=this.node.inlineContent,r=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,c=new Px(this,s&&s.node,e);Vx(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?c.syncToMarks(d.spec.marks,o,e,u):d.type.side>=0&&!f&&c.syncToMarks(u==this.node.childCount?je.none:this.node.child(u).marks,o,e,u),c.placeWidget(d,e,r)},(d,u,f,p)=>{c.syncToMarks(d.marks,o,e,p);let h;c.findNodeMatch(d,u,f,p)||l&&e.state.selection.from>r&&e.state.selection.to<r+d.nodeSize&&(h=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(d,u,f,h,e)||c.updateNextNode(d,u,f,e,p,r)||c.addNode(d,u,f,e,r),r+=d.nodeSize}),c.syncToMarks([],o,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==So)&&(s&&this.protectLocalComposition(e,s),up(this.contentDOM,this.children,e),Wo&&Bx(this.dom))}localCompositionInfo(e,n){let{from:o,to:r}=e.state.selection;if(!(e.state.selection instanceof Oe)||o<n||r>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=Fx(this.node.content,s,o-n,r-n);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:o,text:r}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new Ox(this,i,n,r);e.input.compositionNodes.push(s),this.children=ml(this.children,o,o+r.length,e,s)}update(e,n,o,r){return this.dirty==mn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,o,r),!0)}updateInner(e,n,o,r){this.updateOuterDeco(n),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=qt}updateOuterDeco(e){if(Hi(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=fp(this.dom,this.nodeDOM,hl(this.outerDeco,this.node,n),hl(e,this.node,n)),this.dom!=o&&(o.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 cp(t,e,n,o,r){pp(o,e,t);let i=new Zn(void 0,t,e,n,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class Ui extends Zn{constructor(e,n,o,r,i,s,l){super(e,n,o,r,i,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,o,r){return this.dirty==mn||this.dirty!=qt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=qt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=qt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,o){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,o){let r=this.node.cut(e,n),i=document.createTextNode(r.text);return new Ui(this.parent,r,this.outerDeco,this.innerDeco,i,i,o)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=mn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class dp extends Mr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==qt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Dx extends Zn{constructor(e,n,o,r,i,s,l,c,d,u){super(e,n,o,r,i,s,l,d,u),this.spec=c}update(e,n,o,r){if(this.dirty==mn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,o);return i&&this.updateInner(e,n,o,r),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,o,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,o,r){this.spec.setSelection?this.spec.setSelection(e,n,o.root):super.setSelection(e,n,o,r)}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 up(t,e,n){let o=t.firstChild,r=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==t){for(;l!=o;)o=hp(o),r=!0;o=o.nextSibling}else r=!0,t.insertBefore(l,o);if(s instanceof No){let c=o?o.previousSibling:t.lastChild;up(s.contentDOM,s.children,n),o=c?c.nextSibling:t.firstChild}}for(;o;)o=hp(o),r=!0;r&&n.trackWrites==t&&(n.trackWrites=null)}const Ir=function(t){t&&(this.nodeName=t)};Ir.prototype=Object.create(null);const Co=[new Ir];function hl(t,e,n){if(t.length==0)return Co;let o=n?Co[0]:new Ir,r=[o];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&r.push(o=new Ir(s.nodeName));for(let l in s){let c=s[l];c!=null&&(n&&r.length==1&&r.push(o=new Ir(e.isInline?"span":"div")),l=="class"?o.class=(o.class?o.class+" ":"")+c:l=="style"?o.style=(o.style?o.style+";":"")+c:l!="nodeName"&&(o[l]=c))}}}return r}function fp(t,e,n,o){if(n==Co&&o==Co)return e;let r=e;for(let i=0;i<o.length;i++){let s=o[i],l=n[i];if(i){let c;l&&l.nodeName==s.nodeName&&r!=t&&(c=r.parentNode)&&c.nodeName.toLowerCase()==s.nodeName||(c=document.createElement(s.nodeName),c.pmIsDeco=!0,c.appendChild(r),l=Co[0]),r=c}Rx(r,l||Co[0],s)}return r}function Rx(t,e,n){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in n)&&t.removeAttribute(o);for(let o in n)o!="class"&&o!="style"&&o!="nodeName"&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){let o=e.class?e.class.split(" ").filter(Boolean):[],r=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.remove(o[i]);for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.add(r[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=o.exec(e.style);)t.style.removeProperty(r[1])}n.style&&(t.style.cssText+=n.style)}}function pp(t,e,n){return fp(t,t,Co,hl(e,n,t.nodeType!=1))}function Hi(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function hp(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Px{constructor(e,n,o){this.lock=n,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Lx(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let o=e;o<n;o++)this.top.children[o].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,o,r){let i=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;i<l&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=qt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let c=-1,d=this.top.children.length;r<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let u=this.index;u<d;u++){let f=this.top.children[u];if(f.matchesMark(e[s])&&!this.isLocked(f.dom)){c=u;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let u=No.create(this.top,e[s],n,o);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,o,r){let i=-1,s;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,o))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,c=Math.min(this.top.children.length,l+5);l<c;l++){let d=this.top.children[l];if(d.matchesNode(e,n,o)&&!this.preMatch.matched.has(d)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,o,r,i){let s=this.top.children[r];return s.dirty==mn&&s.dom==s.contentDOM&&(s.dirty=So),s.update(e,n,o,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==o)return r}return-1}e=n}}updateNextNode(e,n,o,r,i,s){for(let l=this.index;l<this.top.children.length;l++){let c=this.top.children[l];if(c instanceof Zn){let d=this.preMatch.matched.get(c);if(d!=null&&d!=i)return!1;let u=c.dom,f,p=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=mn&&Hi(n,c.outerDeco));if(!p&&c.update(e,n,o,r))return this.destroyBetween(this.index,l),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!p&&(f=this.recreateWrapper(c,e,n,o,r,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=So,f.updateChildren(r,s+1),f.dirty=qt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,o,r,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Hi(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=Zn.create(this.top,n,o,r,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let c of l.children)c.parent=l}return e.destroy(),l}addNode(e,n,o,r,i){let s=Zn.create(this.top,e,n,o,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,o){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let i=new lp(this.top,e,n,o);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof No;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Ui)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((mt||ut)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let r=new dp(this.top,[],o,null);n!=this.top?n.children.push(r):n.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Lx(t,e){let n=e,o=n.children.length,r=t.childCount,i=new Map,s=[];e:for(;r>0;){let l;for(;;)if(o){let d=n.children[o-1];if(d instanceof No)n=d,o=d.children.length;else{l=d,o--;break}}else{if(n==e)break e;o=n.parent.children.indexOf(n),n=n.parent}let c=l.node;if(c){if(c!=t.child(r-1))break;--r,i.set(l,r),s.push(l)}}return{index:r,matched:i,matches:s.reverse()}}function $x(t,e){return t.type.side-e.type.side}function Vx(t,e,n,o){let r=e.locals(t),i=0;if(r.length==0){for(let d=0;d<t.childCount;d++){let u=t.child(d);o(u,r,e.forChild(i,u),d),i+=u.nodeSize}return}let s=0,l=[],c=null;for(let d=0;;){let u,f;for(;s<r.length&&r[s].to==i;){let g=r[s++];g.widget&&(u?(f||(f=[u])).push(g):u=g)}if(u)if(f){f.sort($x);for(let g=0;g<f.length;g++)n(f[g],d,!!c)}else n(u,d,!!c);let p,h;if(c)h=-1,p=c,c=null;else if(d<t.childCount)h=d,p=t.child(d++);else break;for(let g=0;g<l.length;g++)l[g].to<=i&&l.splice(g--,1);for(;s<r.length&&r[s].from<=i&&r[s].to>i;)l.push(r[s++]);let m=i+p.nodeSize;if(p.isText){let g=m;s<r.length&&r[s].from<g&&(g=r[s].from);for(let x=0;x<l.length;x++)l[x].to<g&&(g=l[x].to);g<m&&(c=p.cut(g-i),p=p.cut(0,g-i),m=g,h=-1)}else for(;s<r.length&&r[s].to<m;)s++;let b=p.isInline&&!p.isLeaf?l.filter(g=>!g.inline):l.slice();o(p,b,e.forChild(i,p),h),i=m}}function Bx(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Fx(t,e,n,o){for(let r=0,i=0;r<t.childCount&&i<=o;){let s=t.child(r++),l=i;if(i+=s.nodeSize,!s.isText)continue;let c=s.text;for(;r<t.childCount;){let d=t.child(r++);if(i+=d.nodeSize,!d.isText)break;c+=d.text}if(i>=n){if(i>=o&&c.slice(o-e.length-l,o-l)==e)return o-e.length;let d=l<o?c.lastIndexOf(e,o-l-1):-1;if(d>=0&&d+e.length+l>=n)return l+d;if(n==o&&c.length>=o+e.length-l&&c.slice(o-l,o-l+e.length)==e)return o}}return-1}function ml(t,e,n,o,r){let i=[];for(let s=0,l=0;s<t.length;s++){let c=t[s],d=l,u=l+=c.size;d>=n||u<=e?i.push(c):(d<e&&i.push(c.slice(0,e-d,o)),r&&(i.push(r),r=void 0),u>n&&i.push(c.slice(n-d,c.size,o)))}return i}function gl(t,e=null){let n=t.domSelectionRange(),o=t.state.doc;if(!n.focusNode)return null;let r=t.docView.nearestDesc(n.focusNode),i=r&&r.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=o.resolve(s),c,d;if(ji(n)){for(c=s;r&&!r.node;)r=r.parent;let f=r.node;if(r&&f.isAtom&&Ne.isSelectable(f)&&r.parent&&!(f.isInline&&hx(n.focusNode,n.focusOffset,r.dom))){let p=r.posBefore;d=new Ne(s==p?l:o.resolve(p))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=s,p=s;for(let h=0;h<n.rangeCount;h++){let m=n.getRangeAt(h);f=Math.min(f,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),p=Math.max(p,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[c,s]=p==t.state.selection.anchor?[p,f]:[f,p],l=o.resolve(s)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=o.resolve(c);if(!d){let f=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;d=yl(t,u,l,f)}return d}function mp(t){return t.editable?t.hasFocus():wp(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function An(t,e=!1){let n=t.state.selection;if(xp(t,n),!!mp(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ut){let o=t.domSelectionRange(),r=t.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&ko(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Ux(t);else{let{anchor:o,head:r}=n,i,s;gp&&!(n instanceof Oe)&&(n.$from.parent.inlineContent||(i=bp(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=bp(t,n.to))),t.docView.setSelection(o,r,t,e),gp&&(i&&yp(i),s&&yp(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&jx(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const gp=mt||ut&&Kf<63;function bp(t,e){let{node:n,offset:o}=t.docView.domFromPos(e,0),r=o<n.childNodes.length?n.childNodes[o]:null,i=o?n.childNodes[o-1]:null;if(mt&&r&&r.contentEditable=="false")return bl(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return bl(r);if(i)return bl(i)}}function bl(t){return t.contentEditable="true",mt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function yp(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function jx(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),o=n.anchorNode,r=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=o||n.anchorOffset!=r)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!mp(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Ux(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,o=n.nodeName=="IMG";o?e.collapse(n.parentNode,ht(n)+1):e.collapse(n,0),!o&&!t.state.selection.visible&&Dt&&Yn<=11&&(n.disabled=!0,n.disabled=!1)}function xp(t,e){if(e instanceof Ne){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Ep(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Ep(t)}function Ep(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function yl(t,e,n,o){return t.someProp("createSelectionBetween",r=>r(t,e,n))||Oe.between(e,n,o)}function kp(t){return t.editable&&!t.hasFocus()?!1:wp(t)}function wp(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Hx(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ko(e.node,e.offset,n.anchorNode,n.anchorOffset)}function xl(t,e){let{$anchor:n,$head:o}=t.selection,r=e>0?n.max(o):n.min(o),i=r.parent.inlineContent?r.depth?t.doc.resolve(e>0?r.after():r.before()):null:r;return i&&Pe.findFrom(i,e)}function eo(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Sp(t,e,n){let o=t.state.selection;if(o instanceof Oe)if(n.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return eo(t,new Oe(o.$anchor,s))}else if(o.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let r=xl(t.state,e);return r&&r instanceof Ne?eo(t,r):!1}else if(!(Gt&&n.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?Ne.isSelectable(i)?eo(t,new Ne(e<0?t.state.doc.resolve(r.pos-i.nodeSize):r)):_r?eo(t,new Oe(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof Ne&&o.node.isInline)return eo(t,new Oe(e>0?o.$to:o.$from));{let r=xl(t.state,e);return r?eo(t,r):!1}}}function Wi(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Or(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function qo(t,e){return e<0?Wx(t):Gx(t)}function Wx(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r,i,s=!1;for(Wt&&n.nodeType==1&&o<Wi(n)&&Or(n.childNodes[o],-1)&&(s=!0);;)if(o>0){if(n.nodeType!=1)break;{let l=n.childNodes[o-1];if(Or(l,-1))r=n,i=--o;else if(l.nodeType==3)n=l,o=n.nodeValue.length;else break}}else{if(Np(n))break;{let l=n.previousSibling;for(;l&&Or(l,-1);)r=n.parentNode,i=ht(l),l=l.previousSibling;if(l)n=l,o=Wi(n);else{if(n=n.parentNode,n==t.dom)break;o=0}}}s?El(t,n,o):r&&El(t,r,i)}function Gx(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r=Wi(n),i,s;for(;;)if(o<r){if(n.nodeType!=1)break;let l=n.childNodes[o];if(Or(l,1))i=n,s=++o;else break}else{if(Np(n))break;{let l=n.nextSibling;for(;l&&Or(l,1);)i=l.parentNode,s=ht(l)+1,l=l.nextSibling;if(l)n=l,o=0,r=Wi(n);else{if(n=n.parentNode,n==t.dom)break;o=r=0}}}i&&El(t,i,s)}function Np(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function qx(t,e){for(;t&&e==t.childNodes.length&&!zr(t);)e=ht(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Kx(t,e){for(;t&&!e&&!zr(t);)e=ht(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function El(t,e,n){if(e.nodeType!=3){let i,s;(s=qx(e,n))?(e=s,n=0):(i=Kx(e,n))&&(e=i,n=i.nodeValue.length)}let o=t.domSelection();if(!o)return;if(ji(o)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),o.removeAllRanges(),o.addRange(i)}else o.extend&&o.extend(e,n);t.domObserver.setCurSelection();let{state:r}=t;setTimeout(()=>{t.state==r&&An(t)},50)}function Cp(t,e){let n=t.state.doc.resolve(e);if(!(ut||Jf)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function vp(t,e,n){let o=t.state.selection;if(o instanceof Oe&&!o.empty||n.indexOf("s")>-1||Gt&&n.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=xl(t.state,e);if(s&&s instanceof Ne)return eo(t,s)}if(!r.parent.inlineContent){let s=e<0?r:i,l=o instanceof Bt?Pe.near(s,e):Pe.findFrom(s,e);return l?eo(t,l):!1}return!1}function Tp(t,e){if(!(t.state.selection instanceof Oe))return!0;let{$head:n,$anchor:o,empty:r}=t.state.selection;if(!n.sameParent(o))return!0;if(!r)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function zp(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Jx(t){if(!mt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;zp(t,o,"true"),setTimeout(()=>zp(t,o,"false"),20)}return!1}function Xx(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Yx(t,e){let n=e.keyCode,o=Xx(e);if(n==8||Gt&&n==72&&o=="c")return Tp(t,-1)||qo(t,-1);if(n==46&&!e.shiftKey||Gt&&n==68&&o=="c")return Tp(t,1)||qo(t,1);if(n==13||n==27)return!0;if(n==37||Gt&&n==66&&o=="c"){let r=n==37?Cp(t,t.state.selection.from)=="ltr"?-1:1:-1;return Sp(t,r,o)||qo(t,r)}else if(n==39||Gt&&n==70&&o=="c"){let r=n==39?Cp(t,t.state.selection.from)=="ltr"?1:-1:1;return Sp(t,r,o)||qo(t,r)}else{if(n==38||Gt&&n==80&&o=="c")return vp(t,-1,o)||qo(t,-1);if(n==40||Gt&&n==78&&o=="c")return Jx(t)||vp(t,1,o)||qo(t,1);if(o==(Gt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function kl(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:o,openStart:r,openEnd:i}=e;for(;r>1&&i>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,i--;let h=o.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),o=h.content}let s=t.someProp("clipboardSerializer")||xo.fromSchema(t.state.schema),l=Pp(),c=l.createElement("div");c.appendChild(s.serializeFragment(o,{document:l}));let d=c.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=Dp[d.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=l.createElement(u[h]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),f++}d=c.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${r} ${i}${f?` -${f}`:""} ${JSON.stringify(n)}`);let p=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
351
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.getPropertyValue(i);if(s)for(let l=void 0;;){let c=this.parser.matchStyle(i,s,this,l);if(!c)break;if(c.ignore)return null;if(c.clearMark?n=n.filter(d=>!c.clearMark(d)):n=n.concat(this.parser.schema.marks[c.mark].create(c.attrs)),c.consuming===!1)l=c;else break}}return n}addElementByRule(e,n,o,r){let i,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let c=this.enter(s,n.attrs||null,o,n.preserveWhitespace);c&&(i=!0,o=c)}else{let c=this.parser.schema.marks[n.mark];o=o.concat(c.create(n.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(c=>this.insertNode(c,o,!1));else{let c=e;typeof n.contentElement=="string"?c=e.querySelector(n.contentElement):typeof n.contentElement=="function"?c=n.contentElement(e):n.contentElement&&(c=n.contentElement),this.findAround(e,c,!0),this.addAll(c,o),this.findAround(e,c,!1)}i&&this.sync(l)&&this.open--}addAll(e,n,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,n);this.findAtPoint(e,i)}findPlace(e,n,o){let r,i;for(let s=this.open,l=0;s>=0;s--){let c=this.nodes[s],d=c.findWrapping(e);if(d&&(!r||r.length>d.length+l)&&(r=d,i=c,!d.length))break;if(c.solid){if(o)break;l+=2}}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)n=this.enterInner(r[s],null,n,!1);return n}insertNode(e,n,o){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let r=this.findPlace(e,n,o);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=je.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):sf(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,n,o,r){let i=this.findPlace(e.create(n),o,!1);return i&&(i=this.enterInner(e,n,o,!0,r)),i}enterInner(e,n,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=nf(e,i,s.options);s.options&Sr&&s.content.length==0&&(l|=Sr);let c=je.none;return o=o.filter(d=>(s.type?s.type.allowsMarkType(d.type):sf(d.type,e))?(c=d.addToSet(c),!1):!0),this.nodes.push(new Di(e,n,c,r,null,l)),this.open++,o}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=wr)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let o=this.nodes[n].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==n&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,o){if(e!=n&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&n.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(l,c)=>{for(;l>=0;l--){let d=n[l];if(d==""){if(l==n.length-1||l==0)continue;for(;c>=i;c--)if(s(l-1,c))return!0;return!1}else{let u=c>0||c==0&&r?this.nodes[c].type:o&&c>=i?o.node(c-i).type:null;if(!u||u.name!=d&&!u.isInGroup(d))return!1;c--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let n in this.parser.schema.nodes){let o=this.parser.schema.nodes[n];if(o.isTextblock&&o.defaultAttrs)return o}}}function p0(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&tf.hasOwnProperty(o)&&n?(n.appendChild(e),e=n):o=="li"?n=e:o&&(n=null)}}function h0(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function rf(t){let e={};for(let n in t)e[n]=t[n];return e}function sf(t,e){let n=e.schema.nodes;for(let o in n){let r=n[o];if(!r.allowsMarkType(t))continue;let i=[],s=l=>{i.push(l);for(let c=0;c<l.edgeCount;c++){let{type:d,next:u}=l.edge(c);if(d==e||i.indexOf(u)<0&&s(u))return!0}};if(s(r.contentMatch))return!0}}class xo{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},o){o||(o=Ha(n).createDocumentFragment());let r=o,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,c=0;for(;l<i.length&&c<s.marks.length;){let d=s.marks[c];if(!this.marks[d.type.name]){c++;continue}if(!d.eq(i[l][0])||d.type.spec.spanning===!1)break;l++,c++}for(;l<i.length;)r=i.pop()[1];for(;c<s.marks.length;){let d=s.marks[c++],u=this.serializeMark(d,s.isInline,n);u&&(i.push([d,r]),r.appendChild(u.dom),r=u.contentDOM||u.dom)}}r.appendChild(this.serializeNodeInner(s,n))}),o}serializeNodeInner(e,n){let{dom:o,contentDOM:r}=Ri(Ha(n),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,r)}return o}serializeNode(e,n={}){let o=this.serializeNodeInner(e,n);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(o),o=i.dom)}return o}serializeMark(e,n,o={}){let r=this.marks[e.type.name];return r&&Ri(Ha(o),r(e,n),null,e.attrs)}static renderSpec(e,n,o=null,r){return Ri(e,n,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new xo(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=af(e.nodes);return n.text||(n.text=o=>o.text),n}static marksFromSchema(e){return af(e.marks)}}function af(t){let e={};for(let n in t){let o=t[n].spec.toDOM;o&&(e[n]=o)}return e}function Ha(t){return t.document||window.document}const lf=new WeakMap;function m0(t){let e=lf.get(t);return e===void 0&&lf.set(t,e=g0(t)),e}function g0(t){let e=null;function n(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)n(o[r]);else for(let r in o)n(o[r])}return n(t),e}function Ri(t,e,n,o){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],i;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=m0(o))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=r.indexOf(" ");s>0&&(n=r.slice(0,s),r=r.slice(s+1));let l,c=n?t.createElementNS(n,r):t.createElement(r),d=e[1],u=1;if(d&&typeof d=="object"&&d.nodeType==null&&!Array.isArray(d)){u=2;for(let f in d)if(d[f]!=null){let p=f.indexOf(" ");p>0?c.setAttributeNS(f.slice(0,p),f.slice(p+1),d[f]):f=="style"&&c.style?c.style.cssText=d[f]:c.setAttribute(f,d[f])}}for(let f=u;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>u)throw new RangeError("Content hole must be the only child of its parent node");return{dom:c,contentDOM:c}}else{let{dom:h,contentDOM:m}=Ri(t,p,n,o);if(c.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:c,contentDOM:l}}const cf=65535,df=Math.pow(2,16);function b0(t,e){return t+e*df}function uf(t){return t&cf}function y0(t){return(t-(t&cf))/df}const ff=1,pf=2,Pi=4,hf=8;class Wa{constructor(e,n,o){this.pos=e,this.delInfo=n,this.recover=o}get deleted(){return(this.delInfo&hf)>0}get deletedBefore(){return(this.delInfo&(ff|Pi))>0}get deletedAfter(){return(this.delInfo&(pf|Pi))>0}get deletedAcross(){return(this.delInfo&Pi)>0}}class Vt{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Vt.empty)return Vt.empty}recover(e){let n=0,o=uf(e);if(!this.inverted)for(let r=0;r<o;r++)n+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+n+y0(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?r:0);if(c>e)break;let d=this.ranges[l+i],u=this.ranges[l+s],f=c+d;if(e<=f){let p=d?e==c?-1:e==f?1:n:n,h=c+r+(p<0?0:u);if(o)return h;let m=e==(n<0?c:f)?null:b0(l/3,e-c),b=e==c?pf:e==f?ff:Pi;return(n<0?e!=c:e!=f)&&(b|=hf),new Wa(h,b,m)}r+=u-d}return o?e+r:new Wa(e+r,0,null)}touches(e,n){let o=0,r=uf(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let c=this.ranges[l]-(this.inverted?o:0);if(c>e)break;let d=this.ranges[l+i],u=c+d;if(e<=u&&l==r*3)return!0;o+=this.ranges[l+s]-d}return!1}forEach(e){let n=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],l=s-(this.inverted?i:0),c=s+(this.inverted?0:i),d=this.ranges[r+n],u=this.ranges[r+o];e(l,l+d,c,c+u),i+=u-d}}invert(){return new Vt(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Vt.empty:new Vt(e<0?[0,-e,0]:[0,0,e])}}Vt.empty=new Vt([]);class Li{constructor(e,n,o=0,r=e?e.length:0){this.mirror=n,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new Li(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,o=this._maps.length;n<e._maps.length;n++){let r=e.getMirror(n);this.appendMap(e._maps[n],r!=null&&r<n?o+r:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,o=this._maps.length+e._maps.length;n>=0;n--){let r=e.getMirror(n);this.appendMap(e._maps[n].invert(),r!=null&&r>n?o-r-1:void 0)}}invert(){let e=new Li;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,n);if(l.recover!=null){let c=this.getMirror(i);if(c!=null&&c>i&&c<this.to){i=c,e=this._maps[c].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return o?e:new Wa(e,r,null)}}const Ga=Object.create(null);class xt{getMap(){return Vt.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=Ga[n.stepType];if(!o)throw new RangeError(`No step type ${n.stepType} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in Ga)throw new RangeError("Duplicate use of step JSON ID "+e);return Ga[e]=n,n.prototype.jsonID=e,n}}class nt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new nt(e,null)}static fail(e){return new nt(null,e)}static fromReplace(e,n,o,r){try{return nt.ok(e.replace(n,o,r))}catch(i){if(i instanceof _i)return nt.fail(i.message);throw i}}}function qa(t,e,n){let o=[];for(let r=0;r<t.childCount;r++){let i=t.child(r);i.content.size&&(i=i.copy(qa(i.content,e,i))),i.isInline&&(i=e(i,n,r)),o.push(i)}return oe.fromArray(o)}class qn extends xt{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new fe(qa(n.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),n.openStart,n.openEnd);return nt.fromReplace(e,this.from,this.to,i)}invert(){return new sn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new qn(n.pos,o.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,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new qn(n.from,n.to,e.markFromJSON(n.mark))}}xt.jsonID("addMark",qn);class sn extends xt{constructor(e,n,o){super(),this.from=e,this.to=n,this.mark=o}apply(e){let n=e.slice(this.from,this.to),o=new fe(qa(n.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),n.openStart,n.openEnd);return nt.fromReplace(e,this.from,this.to,o)}invert(){return new qn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deleted&&o.deleted||n.pos>=o.pos?null:new sn(n.pos,o.pos,this.mark)}merge(e){return e instanceof sn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new sn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new sn(n.from,n.to,e.markFromJSON(n.mark))}}xt.jsonID("removeMark",sn);class Kn extends xt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return nt.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return nt.fromReplace(e,this.pos,this.pos+1,new fe(oe.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let o=this.mark.addToSet(n.marks);if(o.length==n.marks.length){for(let r=0;r<n.marks.length;r++)if(!n.marks[r].isInSet(o))return new Kn(this.pos,n.marks[r]);return new Kn(this.pos,this.mark)}}return new Eo(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Kn(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Kn(n.pos,e.markFromJSON(n.mark))}}xt.jsonID("addNodeMark",Kn);class Eo extends xt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return nt.fail("No node at mark step's position");let o=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return nt.fromReplace(e,this.pos,this.pos+1,new fe(oe.from(o),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Kn(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Eo(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Eo(n.pos,e.markFromJSON(n.mark))}}xt.jsonID("removeNodeMark",Eo);class ct extends xt{constructor(e,n,o,r=!1){super(),this.from=e,this.to=n,this.slice=o,this.structure=r}apply(e){return this.structure&&Ka(e,this.from,this.to)?nt.fail("Structure replace would overwrite content"):nt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Vt([this.from,this.to-this.from,this.slice.size])}invert(e){return new ct(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return n.deletedAcross&&o.deletedAcross?null:new ct(n.pos,Math.max(n.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof ct)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?fe.empty:new fe(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new ct(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?fe.empty:new fe(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new ct(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new ct(n.from,n.to,fe.fromJSON(e,n.slice),!!n.structure)}}xt.jsonID("replace",ct);class dt extends xt{constructor(e,n,o,r,i,s,l=!1){super(),this.from=e,this.to=n,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Ka(e,this.from,this.gapFrom)||Ka(e,this.gapTo,this.to)))return nt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return nt.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,n.content);return o?nt.fromReplace(e,this.from,this.to,o):nt.fail("Content does not fit in gap")}getMap(){return new Vt([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new dt(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return n.deletedAcross&&o.deletedAcross||r<n.pos||i>o.pos?null:new dt(n.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new dt(n.from,n.to,n.gapFrom,n.gapTo,fe.fromJSON(e,n.slice),n.insert,!!n.structure)}}xt.jsonID("replaceAround",dt);function Ka(t,e,n){let o=t.resolve(e),r=n-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function x0(t,e,n,o){let r=[],i=[],s,l;t.doc.nodesBetween(e,n,(c,d,u)=>{if(!c.isInline)return;let f=c.marks;if(!o.isInSet(f)&&u.type.allowsMarkType(o.type)){let p=Math.max(d,e),h=Math.min(d+c.nodeSize,n),m=o.addToSet(f);for(let b=0;b<f.length;b++)f[b].isInSet(m)||(s&&s.to==p&&s.mark.eq(f[b])?s.to=h:r.push(s=new sn(p,h,f[b])));l&&l.to==p?l.to=h:i.push(l=new qn(p,h,o))}}),r.forEach(c=>t.step(c)),i.forEach(c=>t.step(c))}function E0(t,e,n,o){let r=[],i=0;t.doc.nodesBetween(e,n,(s,l)=>{if(!s.isInline)return;i++;let c=null;if(o instanceof Oi){let d=s.marks,u;for(;u=o.isInSet(d);)(c||(c=[])).push(u),d=u.removeFromSet(d)}else o?o.isInSet(s.marks)&&(c=[o]):c=s.marks;if(c&&c.length){let d=Math.min(l+s.nodeSize,n);for(let u=0;u<c.length;u++){let f=c[u],p;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&f.eq(r[h].style)&&(p=m)}p?(p.to=d,p.step=i):r.push({style:f,from:Math.max(l,e),to:d,step:i})}}}),r.forEach(s=>t.step(new sn(s.from,s.to,s.style)))}function Ja(t,e,n,o=n.contentMatch,r=!0){let i=t.doc.nodeAt(e),s=[],l=e+1;for(let c=0;c<i.childCount;c++){let d=i.child(c),u=l+d.nodeSize,f=o.matchType(d.type);if(!f)s.push(new ct(l,u,fe.empty));else{o=f;for(let p=0;p<d.marks.length;p++)n.allowsMarkType(d.marks[p].type)||t.step(new sn(l,u,d.marks[p]));if(r&&d.isText&&n.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(d.text);)m||(m=new fe(oe.from(n.schema.text(" ",n.allowedMarks(d.marks))),0,0)),s.push(new ct(l+p.index,l+p.index+p[0].length,m))}}l=u}if(!o.validEnd){let c=o.fillBefore(oe.empty,!0);t.replace(l,l,new fe(c,0,0))}for(let c=s.length-1;c>=0;c--)t.step(s[c])}function k0(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function $o(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let o=t.depth,r=0,i=0;;--o){let s=t.$from.node(o),l=t.$from.index(o)+r,c=t.$to.indexAfter(o)-i;if(o<t.depth&&s.canReplace(l,c,n))return o;if(o==0||s.type.spec.isolating||!k0(s,l,c))break;l&&(r=1),c<s.childCount&&(i=1)}return null}function w0(t,e,n){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),c=s,d=l,u=oe.empty,f=0;for(let m=i,b=!1;m>n;m--)b||o.index(m)>0?(b=!0,u=oe.from(o.node(m).copy(u)),f++):c--;let p=oe.empty,h=0;for(let m=i,b=!1;m>n;m--)b||r.after(m+1)<r.end(m)?(b=!0,p=oe.from(r.node(m).copy(p)),h++):d++;t.step(new dt(c,d,s,l,new fe(u.append(p),f,h),u.size-f,!0))}function Xa(t,e,n=null,o=t){let r=S0(t,e),i=r&&N0(o,e);return i?r.map(mf).concat({type:e,attrs:n}).concat(i.map(mf)):null}function mf(t){return{type:t,attrs:null}}function S0(t,e){let{parent:n,startIndex:o,endIndex:r}=t,i=n.contentMatchAt(o).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return n.canReplaceWith(o,r,s)?i:null}function N0(t,e){let{parent:n,startIndex:o,endIndex:r}=t,i=n.child(o),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let c=(s.length?s[s.length-1]:e).contentMatch;for(let d=o;c&&d<r;d++)c=c.matchType(n.child(d).type);return!c||!c.validEnd?null:s}function C0(t,e,n){let o=oe.empty;for(let s=n.length-1;s>=0;s--){if(o.size){let l=n[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=oe.from(n[s].type.create(n[s].attrs,o))}let r=e.start,i=e.end;t.step(new dt(r,i,r,i,new fe(o,0,0),n.length,!0))}function v0(t,e,n,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,l)=>{let c=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,c)&&T0(t.doc,t.mapping.slice(i).map(l),o)){let d=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?d=!1:!h&&m&&(d=!0)}d===!1&&bf(t,s,l,i),Ja(t,t.mapping.slice(i).map(l,1),o,void 0,d===null);let u=t.mapping.slice(i),f=u.map(l,1),p=u.map(l+s.nodeSize,1);return t.step(new dt(f,p,f+1,p-1,new fe(oe.from(o.create(c,null,s.marks)),0,0),1,!0)),d===!0&&gf(t,s,l,i),!1}})}function gf(t,e,n,o){e.forEach((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let c=t.mapping.slice(o).map(n+1+i+s.index);t.replaceWith(c,c+1,e.type.schema.linebreakReplacement.create())}}})}function bf(t,e,n,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=t.mapping.slice(o).map(n+1+i);t.replaceWith(s,s+1,e.type.schema.text(`
352
+ `))}})}function T0(t,e,n){let o=t.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,n)}function z0(t,e,n,o,r){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(o,null,r||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new dt(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new fe(oe.from(s),0,0),1,!0))}function vn(t,e,n=1,o){let r=t.resolve(e),i=r.depth-n,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let d=r.depth-1,u=n-2;d>i;d--,u--){let f=r.node(d),p=r.index(d);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),m=o&&o[u+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let b=o&&o[u]||f;if(!f.canReplace(p+1,f.childCount)||!b.type.validContent(h))return!1}let l=r.indexAfter(i),c=o&&o[0];return r.node(i).canReplaceWith(l,l,c?c.type:r.node(i+1).type)}function _0(t,e,n=1,o){let r=t.doc.resolve(e),i=oe.empty,s=oe.empty;for(let l=r.depth,c=r.depth-n,d=n-1;l>c;l--,d--){i=oe.from(r.node(l).copy(i));let u=o&&o[d];s=oe.from(u?u.type.create(u.attrs,s):r.node(l).copy(s))}t.step(new ct(e,e,new fe(i.append(s),n,n),!0))}function Jn(t,e){let n=t.resolve(e),o=n.index();return yf(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(o,o+1)}function A0(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:o}=t.type.schema;for(let r=0;r<e.childCount;r++){let i=e.child(r),s=i.type==o?t.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n||!t.type.allowsMarks(i.marks))return!1}return n.validEnd}function yf(t,e){return!!(t&&e&&!t.isLeaf&&A0(t,e))}function $i(t,e,n=-1){let o=t.resolve(e);for(let r=o.depth;;r--){let i,s,l=o.index(r);if(r==o.depth?(i=o.nodeBefore,s=o.nodeAfter):n>0?(i=o.node(r+1),l++,s=o.node(r).maybeChild(l)):(i=o.node(r).maybeChild(l-1),s=o.node(r+1)),i&&!i.isTextblock&&yf(i,s)&&o.node(r).canReplace(l,l+1))return e;if(r==0)break;e=n<0?o.before(r):o.after(r)}}function M0(t,e,n){let o=null,{linebreakReplacement:r}=t.doc.type.schema,i=t.doc.resolve(e-n),s=i.node().type;if(r&&s.inlineContent){let u=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);u&&!f?o=!1:!u&&f&&(o=!0)}let l=t.steps.length;if(o===!1){let u=t.doc.resolve(e+n);bf(t,u.node(),u.before(),l)}s.inlineContent&&Ja(t,e+n-1,s,i.node().contentMatchAt(i.index()),o==null);let c=t.mapping.slice(l),d=c.map(e-n);if(t.step(new ct(d,c.map(e+n,-1),fe.empty,!0)),o===!0){let u=t.doc.resolve(d);gf(t,u.node(),u.before(),t.steps.length)}return t}function I0(t,e,n){let o=t.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),n))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,n))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,n))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function O0(t,e,n){let o=t.resolve(e);if(!n.content.size)return e;let r=n.content;for(let i=0;i<n.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(n.openStart==0&&n.size?2:1);i++)for(let s=o.depth;s>=0;s--){let l=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,c=o.index(s)+(l>0?1:0),d=o.node(s),u=!1;if(i==1)u=d.canReplace(c,c,r);else{let f=d.contentMatchAt(c).findWrapping(r.firstChild.type);u=f&&d.canReplaceWith(c,c,f[0])}if(u)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function Vi(t,e,n=e,o=fe.empty){if(e==n&&!o.size)return null;let r=t.resolve(e),i=t.resolve(n);return xf(r,i,o)?new ct(e,n,o):new D0(r,i,o).fit()}function xf(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class D0{constructor(e,n,o){this.$from=e,this.$to=n,this.unplaced=o,this.frontier=[],this.placed=oe.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=oe.from(e.node(r).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(),n=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,l=r.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let c=new fe(i,s,l);return e>-1?new dt(o.pos,e,this.$to.pos,this.$to.end(),c,n):c.size||o.pos!=this.$to.pos?new ct(o.pos,r.pos,c):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=n.firstChild;if(n.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}n=i.content}for(let n=1;n<=2;n++)for(let o=n==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=Ya(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:c,match:d}=this.frontier[l],u,f=null;if(n==1&&(s?d.matchType(s.type)||(f=d.fillBefore(oe.from(s),!1)):i&&c.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(n==2&&s&&(u=d.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:u};if(i&&d.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Ya(e,n);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new fe(e,n+1,Math.max(o,r.size+n>=e.size-o?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:o}=this.unplaced,r=Ya(e,n);if(r.childCount<=1&&n>0){let i=e.size-n<=n+r.size;this.unplaced=new fe(Nr(e,n-1,1),n-1,i?n-1:o)}else this.unplaced=new fe(Nr(e,n,1),n,o)}placeNodes({sliceDepth:e,frontierDepth:n,parent:o,inject:r,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let b=0;b<i.length;b++)this.openFrontierNode(i[b]);let s=this.unplaced,l=o?o.content:s.content,c=s.openStart-e,d=0,u=[],{match:f,type:p}=this.frontier[n];if(r){for(let b=0;b<r.childCount;b++)u.push(r.child(b));f=f.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;d<l.childCount;){let b=l.child(d),g=f.matchType(b.type);if(!g)break;d++,(d>1||c==0||b.content.size)&&(f=g,u.push(Ef(b.mark(p.allowedMarks(b.marks)),d==1?c:0,d==l.childCount?h:-1)))}let m=d==l.childCount;m||(h=-1),this.placed=Cr(this.placed,n,oe.from(u)),this.frontier[n].match=f,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let b=0,g=l;b<h;b++){let x=g.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),g=x.content}this.unplaced=m?e==0?fe.empty:new fe(Nr(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new fe(Nr(s.content,e,d),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!Qa(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:o,type:r}=this.frontier[n],i=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),s=Qa(e,n,r,o,i);if(s){for(let l=n-1;l>=0;l--){let{match:c,type:d}=this.frontier[l],u=Qa(e,l,d,c,!0);if(!u||u.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Cr(this.placed,n.depth,n.fit)),e=n.move;for(let o=n.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,n=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Cr(this.placed,this.depth,oe.from(e.create(n,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(oe.empty,!0);n.childCount&&(this.placed=Cr(this.placed,this.frontier.length,n))}}function Nr(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Nr(t.firstChild.content,e-1,n)))}function Cr(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Cr(t.lastChild.content,e-1,n)))}function Ya(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function Ef(t,e,n){if(e<=0)return t;let o=t.content;return e>1&&(o=o.replaceChild(0,Ef(o.firstChild,e-1,o.childCount==1?n-1:0))),e>0&&(o=t.type.contentMatch.fillBefore(o).append(o),n<=0&&(o=o.append(t.type.contentMatch.matchFragment(o).fillBefore(oe.empty,!0)))),t.copy(o)}function Qa(t,e,n,o,r){let i=t.node(e),s=r?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!R0(n,i.content,s)?l:null}function R0(t,e,n){for(let o=n;o<e.childCount;o++)if(!t.allowsMarks(e.child(o).marks))return!0;return!1}function P0(t){return t.spec.defining||t.spec.definingForContent}function L0(t,e,n,o){if(!o.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),i=t.doc.resolve(n);if(xf(r,i,o))return t.step(new ct(e,n,o));let s=wf(r,i);s[s.length-1]==0&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let p=r.depth,h=r.pos-1;p>0;p--,h--){let m=r.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?l=p:r.before(p)==h&&s.splice(1,0,-p)}let c=s.indexOf(l),d=[],u=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(d.push(m),h==o.openStart)break;p=m.content}for(let p=u-1;p>=0;p--){let h=d[p],m=P0(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))u=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+u+1)%(o.openStart+1),m=d[h];if(m)for(let b=0;b<s.length;b++){let g=s[(b+c)%s.length],x=!0;g<0&&(x=!1,g=-g);let v=r.node(g-1),w=r.index(g-1);if(v.canReplaceWith(w,w,m.type,m.marks))return t.replace(r.before(g),x?i.after(g):n,new fe(kf(o.content,0,o.openStart,h),h,o.openEnd))}}let f=t.steps.length;for(let p=s.length-1;p>=0&&(t.replace(e,n,o),!(t.steps.length>f));p--){let h=s[p];h<0||(e=r.before(h),n=i.after(h))}}function kf(t,e,n,o,r){if(e<n){let i=t.firstChild;t=t.replaceChild(0,i.copy(kf(i.content,e+1,n,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(oe.empty,!0))}return t}function $0(t,e,n,o){if(!o.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let r=I0(t.doc,e,o.type);r!=null&&(e=n=r)}t.replaceRange(e,n,new fe(oe.from(o),0,0))}function V0(t,e,n){let o=t.doc.resolve(e),r=t.doc.resolve(n),i=wf(o,r);for(let s=0;s<i.length;s++){let l=i[s],c=s==i.length-1;if(c&&l==0||o.node(l).type.contentMatch.validEnd)return t.delete(o.start(l),r.end(l));if(l>0&&(c||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return t.delete(o.before(l),r.after(l))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&n>o.end(s)&&r.end(s)-n!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return t.delete(o.before(s),n);t.delete(e,n)}function wf(t,e){let n=[],o=Math.min(t.depth,e.depth);for(let r=o;r>=0;r--){let i=t.start(r);if(i<t.pos-(t.depth-r)||e.end(r)>e.pos+(e.depth-r)||t.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==t.depth&&r==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&n.push(r)}return n}class Vo extends xt{constructor(e,n,o){super(),this.pos=e,this.attr=n,this.value=o}apply(e){let n=e.nodeAt(this.pos);if(!n)return nt.fail("No node at attribute step's position");let o=Object.create(null);for(let i in n.attrs)o[i]=n.attrs[i];o[this.attr]=this.value;let r=n.type.create(o,null,n.marks);return nt.fromReplace(e,this.pos,this.pos+1,new fe(oe.from(r),0,n.isLeaf?0:1))}getMap(){return Vt.empty}invert(e){return new Vo(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Vo(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Vo(n.pos,n.attr,n.value)}}xt.jsonID("attr",Vo);class vr extends xt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let r in e.attrs)n[r]=e.attrs[r];n[this.attr]=this.value;let o=e.type.create(n,e.content,e.marks);return nt.ok(o)}getMap(){return Vt.empty}invert(e){return new vr(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new vr(n.attr,n.value)}}xt.jsonID("docAttr",vr);let Bo=class extends Error{};Bo=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},Bo.prototype=Object.create(Error.prototype),Bo.prototype.constructor=Bo,Bo.prototype.name="TransformError";class Sf{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Li}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new Bo(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,o=fe.empty){let r=Vi(this.doc,e,n,o);return r&&this.step(r),this}replaceWith(e,n,o){return this.replace(e,n,new fe(oe.from(o),0,0))}delete(e,n){return this.replace(e,n,fe.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,o){return L0(this,e,n,o),this}replaceRangeWith(e,n,o){return $0(this,e,n,o),this}deleteRange(e,n){return V0(this,e,n),this}lift(e,n){return w0(this,e,n),this}join(e,n=1){return M0(this,e,n),this}wrap(e,n){return C0(this,e,n),this}setBlockType(e,n=e,o,r=null){return v0(this,e,n,o,r),this}setNodeMarkup(e,n,o=null,r){return z0(this,e,n,o,r),this}setNodeAttribute(e,n,o){return this.step(new Vo(e,n,o)),this}setDocAttribute(e,n){return this.step(new vr(e,n)),this}addNodeMark(e,n){return this.step(new Kn(e,n)),this}removeNodeMark(e,n){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(n instanceof je)n.isInSet(o.marks)&&this.step(new Eo(e,n));else{let r=o.marks,i,s=[];for(;i=n.isInSet(r);)s.push(new Eo(e,i)),r=i.removeFromSet(r);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,n=1,o){return _0(this,e,n,o),this}addMark(e,n,o){return x0(this,e,n,o),this}removeMark(e,n,o){return E0(this,e,n,o),this}clearIncompatible(e,n,o){return Ja(this,e,n,o),this}}const Za=Object.create(null);class Le{constructor(e,n,o){this.$anchor=e,this.$head=n,this.ranges=o||[new B0(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=fe.empty){let o=n.content.lastChild,r=null;for(let l=0;l<n.openEnd;l++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:c,$to:d}=s[l],u=e.mapping.slice(i);e.replaceRange(u.map(c.pos),u.map(d.pos),l?fe.empty:n),l==0&&vf(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,n){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:l}=r[i],c=e.mapping.slice(o),d=c.map(s.pos),u=c.map(l.pos);i?e.deleteRange(d,u):(e.replaceRangeWith(d,u,n),vf(e,o,n.isInline?-1:1))}}static findFrom(e,n,o=!1){let r=e.parent.inlineContent?new Oe(e):Fo(e.node(0),e.parent,e.pos,e.index(),n,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=n<0?Fo(e.node(0),e.node(i),e.before(i+1),e.index(i),n,o):Fo(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,o);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Bt(e.node(0))}static atStart(e){return Fo(e,e,0,0,1)||new Bt(e)}static atEnd(e){return Fo(e,e,e.content.size,e.childCount,-1)||new Bt(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Za[n.type];if(!o)throw new RangeError(`No selection type ${n.type} defined`);return o.fromJSON(e,n)}static jsonID(e,n){if(e in Za)throw new RangeError("Duplicate use of selection JSON ID "+e);return Za[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Oe.between(this.$anchor,this.$head).getBookmark()}}Le.prototype.visible=!0;class B0{constructor(e,n){this.$from=e,this.$to=n}}let Nf=!1;function Cf(t){!Nf&&!t.parent.inlineContent&&(Nf=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Oe extends Le{constructor(e,n=e){Cf(e),Cf(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let o=e.resolve(n.map(this.head));if(!o.parent.inlineContent)return Le.near(o);let r=e.resolve(n.map(this.anchor));return new Oe(r.parent.inlineContent?r:o,o)}replace(e,n=fe.empty){if(super.replace(e,n),n==fe.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof Oe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Bi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Oe(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,o=n){let r=e.resolve(n);return new this(r,o==n?r:e.resolve(o))}static between(e,n,o){let r=e.pos-n.pos;if((!o||r)&&(o=r>=0?1:-1),!n.parent.inlineContent){let i=Le.findFrom(n,o,!0)||Le.findFrom(n,-o,!0);if(i)n=i.$head;else return Le.near(n,o)}return e.parent.inlineContent||(r==0?e=n:(e=(Le.findFrom(e,-o,!0)||Le.findFrom(e,o,!0)).$anchor,e.pos<n.pos!=r<0&&(e=n))),new Oe(e,n)}}Le.jsonID("text",Oe);class Bi{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Bi(e.map(this.anchor),e.map(this.head))}resolve(e){return Oe.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ce extends Le{constructor(e){let n=e.nodeAfter,o=e.node(0).resolve(e.pos+n.nodeSize);super(e,o),this.node=n}map(e,n){let{deleted:o,pos:r}=n.mapResult(this.anchor),i=e.resolve(r);return o?Le.near(i):new Ce(i)}content(){return new fe(oe.from(this.node),0,0)}eq(e){return e instanceof Ce&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new el(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ce(e.resolve(n.anchor))}static create(e,n){return new Ce(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ce.prototype.visible=!1,Le.jsonID("node",Ce);class el{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:o}=e.mapResult(this.anchor);return n?new Bi(o,o):new el(o)}resolve(e){let n=e.resolve(this.anchor),o=n.nodeAfter;return o&&Ce.isSelectable(o)?new Ce(n):Le.near(n)}}class Bt extends Le{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=fe.empty){if(n==fe.empty){e.delete(0,e.doc.content.size);let o=Le.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Bt(e)}map(e){return new Bt(e)}eq(e){return e instanceof Bt}getBookmark(){return F0}}Le.jsonID("all",Bt);const F0={map(){return this},resolve(t){return new Bt(t)}};function Fo(t,e,n,o,r,i=!1){if(e.inlineContent)return Oe.create(t,n);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let l=e.child(s);if(l.isAtom){if(!i&&Ce.isSelectable(l))return Ce.create(t,n-(r<0?l.nodeSize:0))}else{let c=Fo(t,l,n+r,r<0?l.childCount:0,r,i);if(c)return c}n+=l.nodeSize*r}return null}function vf(t,e,n){let o=t.steps.length-1;if(o<e)return;let r=t.steps[o];if(!(r instanceof ct||r instanceof dt))return;let i=t.mapping.maps[o],s;i.forEach((l,c,d,u)=>{s==null&&(s=u)}),t.setSelection(Le.near(t.doc.resolve(s),n))}const Tf=1,Fi=2,zf=4;class j0 extends Sf{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|Tf)&~Fi,this.storedMarks=null,this}get selectionSet(){return(this.updated&Tf)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Fi,this}ensureMarks(e){return je.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&Fi)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Fi,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let o=this.selection;return n&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||je.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,o){let r=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(o==null&&(o=n),!e)return this.deleteRange(n,o);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=o==n?s.marks():s.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(n,o,r.text(e,i)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(Le.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=zf,this}get scrolledIntoView(){return(this.updated&zf)>0}}function _f(t,e){return!e||!t?t:t.bind(e)}class Tr{constructor(e,n,o){this.name=e,this.init=_f(n.init,o),this.apply=_f(n.apply,o)}}const U0=[new Tr("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Tr("selection",{init(t,e){return t.selection||Le.atStart(e.doc)},apply(t){return t.selection}}),new Tr("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,o){return o.selection.$cursor?t.storedMarks:null}}),new Tr("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class tl{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=U0.slice(),n&&n.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new Tr(o.key,o.spec.state,o))})}}class jo{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let o=0;o<this.config.plugins.length;o++)if(o!=n){let r=this.config.plugins[o];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],o=this.applyInner(e),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let c=r?r[s].n:0,d=r?r[s].state:this,u=c<n.length&&l.spec.appendTransaction.call(l,c?n.slice(c):n,d,o);if(u&&o.filterTransaction(u,s)){if(u.setMeta("appendedTransaction",e),!r){r=[];for(let f=0;f<this.config.plugins.length;f++)r.push(f<s?{state:o,n:n.length}:{state:this,n:0})}n.push(u),o=o.applyInner(u),i=!0}r&&(r[s]={state:o,n:n.length})}}if(!i)return{state:o,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new jo(this.config),o=this.config.fields;for(let r=0;r<o.length;r++){let i=o[r];n[i.name]=i.apply(e,this[i.name],this,n)}return n}get tr(){return new j0(this)}static create(e){let n=new tl(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new jo(n);for(let r=0;r<n.fields.length;r++)o[n.fields[r].name]=n.fields[r].init(e,o);return o}reconfigure(e){let n=new tl(this.schema,e.plugins),o=n.fields,r=new jo(n);for(let i=0;i<o.length;i++){let s=o[i].name;r[s]=this.hasOwnProperty(s)?this[s]:o[i].init(e,r)}return r}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[o],i=r.spec.state;i&&i.toJSON&&(n[o]=i.toJSON.call(r,this[r.key]))}return n}static fromJSON(e,n,o){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new tl(e.schema,e.plugins),i=new jo(r);return r.fields.forEach(s=>{if(s.name=="doc")i.doc=Gn.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=Le.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let l in o){let c=o[l],d=c.spec.state;if(c.key==s.name&&d&&d.fromJSON&&Object.prototype.hasOwnProperty.call(n,l)){i[s.name]=d.fromJSON.call(c,e,n[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function Af(t,e,n){for(let o in t){let r=t[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=Af(r,e,{})),n[o]=r}return n}class Ot{constructor(e){this.spec=e,this.props={},e.props&&Af(e.props,this,this.props),this.key=e.key?e.key.key:Mf("plugin")}getState(e){return e[this.key]}}const nl=Object.create(null);function Mf(t){return t in nl?t+"$"+ ++nl[t]:(nl[t]=0,t+"$")}class an{constructor(e="key"){this.key=Mf(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const ol=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function If(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const Of=(t,e,n)=>{let o=If(t,n);if(!o)return!1;let r=rl(o);if(!r){let s=o.blockRange(),l=s&&$o(s);return l==null?!1:(e&&e(t.tr.lift(s,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(jf(t,r,e,-1))return!0;if(o.parent.content.size==0&&(Uo(i,"end")||Ce.isSelectable(i)))for(let s=o.depth;;s--){let l=Vi(t.doc,o.before(s),o.after(s),fe.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=t.tr.step(l);c.setSelection(Uo(i,"end")?Le.findFrom(c.doc.resolve(c.mapping.map(r.pos,-1)),-1):Ce.create(c.doc,r.pos-i.nodeSize)),e(c.scrollIntoView())}return!0}if(s==1||o.node(s-1).childCount>1)break}return i.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0):!1},H0=(t,e,n)=>{let o=If(t,n);if(!o)return!1;let r=rl(o);return r?Df(t,r,e):!1},W0=(t,e,n)=>{let o=Pf(t,n);if(!o)return!1;let r=il(o);return r?Df(t,r,e):!1};function Df(t,e,n){let o=e.nodeBefore,r=o,i=e.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let u=r.lastChild;if(!u)return!1;r=u}let s=e.nodeAfter,l=s,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let u=l.firstChild;if(!u)return!1;l=u}let d=Vi(t.doc,i,c,fe.empty);if(!d||d.from!=i||d instanceof ct&&d.slice.size>=c-i)return!1;if(n){let u=t.tr.step(d);u.setSelection(Oe.create(u.doc,i)),n(u.scrollIntoView())}return!0}function Uo(t,e,n=!1){for(let o=t;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(n&&o.childCount!=1)return!1}return!1}const Rf=(t,e,n)=>{let{$head:o,empty:r}=t.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):o.parentOffset>0)return!1;i=rl(o)}let s=i&&i.nodeBefore;return!s||!Ce.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Ce.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function rl(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function Pf(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const Lf=(t,e,n)=>{let o=Pf(t,n);if(!o)return!1;let r=il(o);if(!r)return!1;let i=r.nodeAfter;if(jf(t,r,e,1))return!0;if(o.parent.content.size==0&&(Uo(i,"start")||Ce.isSelectable(i))){let s=Vi(t.doc,o.before(),o.after(),fe.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=t.tr.step(s);l.setSelection(Uo(i,"start")?Le.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):Ce.create(l.doc,l.mapping.map(r.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&r.depth==o.depth-1?(e&&e(t.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0):!1},$f=(t,e,n)=>{let{$head:o,empty:r}=t.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):o.parentOffset<o.parent.content.size)return!1;i=il(o)}let s=i&&i.nodeAfter;return!s||!Ce.isSelectable(s)?!1:(e&&e(t.tr.setSelection(Ce.create(t.doc,i.pos)).scrollIntoView()),!0)};function il(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const G0=(t,e)=>{let n=t.selection,o=n instanceof Ce,r;if(o){if(n.node.isTextblock||!Jn(t.doc,n.from))return!1;r=n.from}else if(r=$i(t.doc,n.from,-1),r==null)return!1;if(e){let i=t.tr.join(r);o&&i.setSelection(Ce.create(i.doc,r-t.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},q0=(t,e)=>{let n=t.selection,o;if(n instanceof Ce){if(n.node.isTextblock||!Jn(t.doc,n.to))return!1;o=n.to}else if(o=$i(t.doc,n.to,1),o==null)return!1;return e&&e(t.tr.join(o).scrollIntoView()),!0},K0=(t,e)=>{let{$from:n,$to:o}=t.selection,r=n.blockRange(o),i=r&&$o(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)},Vf=(t,e)=>{let{$head:n,$anchor:o}=t.selection;return!n.parent.type.spec.code||!n.sameParent(o)?!1:(e&&e(t.tr.insertText(`
353
+ `).scrollIntoView()),!0)};function sl(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const J0=(t,e)=>{let{$head:n,$anchor:o}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(o))return!1;let r=n.node(-1),i=n.indexAfter(-1),s=sl(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(e){let l=n.after(),c=t.tr.replaceWith(l,l,s.createAndFill());c.setSelection(Le.near(c.doc.resolve(l),1)),e(c.scrollIntoView())}return!0},Bf=(t,e)=>{let n=t.selection,{$from:o,$to:r}=n;if(n instanceof Bt||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=sl(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,l=t.tr.insert(s,i.createAndFill());l.setSelection(Oe.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},Ff=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(vn(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let o=n.blockRange(),r=o&&$o(o);return r==null?!1:(e&&e(t.tr.lift(o,r).scrollIntoView()),!0)};function X0(t){return(e,n)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof Ce&&e.selection.node.isBlock)return!o.parentOffset||!vn(e.doc,o.pos)?!1:(n&&n(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let i=[],s,l,c=!1,d=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){c=o.end(h)==o.pos+(o.depth-h),d=o.start(h)==o.pos-(o.depth-h),l=sl(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),i.unshift(c&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let u=e.tr;(e.selection instanceof Oe||e.selection instanceof Bt)&&u.deleteSelection();let f=u.mapping.map(o.pos),p=vn(u.doc,f,i.length,i);if(p||(i[0]=l?{type:l}:null,p=vn(u.doc,f,i.length,i)),!p)return!1;if(u.split(f,i.length,i),!c&&d&&o.node(s).type!=l){let h=u.mapping.map(o.before(s)),m=u.doc.resolve(h);l&&o.node(s-1).canReplaceWith(m.index(),m.index()+1,l)&&u.setNodeMarkup(u.mapping.map(o.before(s)),l)}return n&&n(u.scrollIntoView()),!0}}const Y0=X0(),Q0=(t,e)=>{let{$from:n,to:o}=t.selection,r,i=n.sharedDepth(o);return i==0?!1:(r=n.before(i),e&&e(t.tr.setSelection(Ce.create(t.doc,r))),!0)};function Z0(t,e,n){let o=e.nodeBefore,r=e.nodeAfter,i=e.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(r.isTextblock||Jn(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function jf(t,e,n,o){let r=e.nodeBefore,i=e.nodeAfter,s,l,c=r.type.spec.isolating||i.type.spec.isolating;if(!c&&Z0(t,e,n))return!0;let d=!c&&e.parent.canReplace(e.index(),e.index()+1);if(d&&(s=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(n){let h=e.pos+i.nodeSize,m=oe.empty;for(let x=s.length-1;x>=0;x--)m=oe.from(s[x].create(null,m));m=oe.from(r.copy(m));let b=t.tr.step(new dt(e.pos-1,h,e.pos,h,new fe(m,1,0),s.length,!0)),g=b.doc.resolve(h+2*s.length);g.nodeAfter&&g.nodeAfter.type==r.type&&Jn(b.doc,g.pos)&&b.join(g.pos),n(b.scrollIntoView())}return!0}let u=i.type.spec.isolating||o>0&&c?null:Le.findFrom(e,1),f=u&&u.$from.blockRange(u.$to),p=f&&$o(f);if(p!=null&&p>=e.depth)return n&&n(t.tr.lift(f,p).scrollIntoView()),!0;if(d&&Uo(i,"start",!0)&&Uo(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let b=i,g=1;for(;!b.isTextblock;b=b.firstChild)g++;if(h.canReplace(h.childCount,h.childCount,b.content)){if(n){let x=oe.empty;for(let w=m.length-1;w>=0;w--)x=oe.from(m[w].copy(x));let v=t.tr.step(new dt(e.pos-m.length,e.pos+i.nodeSize,e.pos+g,e.pos+i.nodeSize-g,new fe(x,m.length,0),0,!0));n(v.scrollIntoView())}return!0}}return!1}function Uf(t){return function(e,n){let o=e.selection,r=t<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(n&&n(e.tr.setSelection(Oe.create(e.doc,t<0?r.start(i):r.end(i)))),!0):!1}}const ex=Uf(-1),tx=Uf(1);function nx(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i),l=s&&Xa(s,t,e);return l?(o&&o(n.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Hf(t,e=null){return function(n,o){let r=!1;for(let i=0;i<n.selection.ranges.length&&!r;i++){let{$from:{pos:s},$to:{pos:l}}=n.selection.ranges[i];n.doc.nodesBetween(s,l,(c,d)=>{if(r)return!1;if(!(!c.isTextblock||c.hasMarkup(t,e)))if(c.type==t)r=!0;else{let u=n.doc.resolve(d),f=u.index();r=u.parent.canReplaceWith(f,f+1,t)}})}if(!r)return!1;if(o){let i=n.tr;for(let s=0;s<n.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[s];i.setBlockType(l,c,t,e)}o(i.scrollIntoView())}return!0}}function al(...t){return function(e,n,o){for(let r=0;r<t.length;r++)if(t[r](e,n,o))return!0;return!1}}al(ol,Of,Rf),al(ol,Lf,$f),al(Vf,Bf,Ff,Y0),typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function ox(t,e=null){return function(n,o){let{$from:r,$to:i}=n.selection,s=r.blockRange(i);if(!s)return!1;let l=o?n.tr:null;return rx(l,s,t,e)?(o&&o(l.scrollIntoView()),!0):!1}}function rx(t,e,n,o=null){let r=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let c=s.resolve(e.start-2);i=new Mi(c,c,e.depth),e.endIndex<e.parent.childCount&&(e=new Mi(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=Xa(i,n,o,e);return l?(t&&ix(t,e,l,r,n),!0):!1}function ix(t,e,n,o,r){let i=oe.empty;for(let u=n.length-1;u>=0;u--)i=oe.from(n[u].type.create(n[u].attrs,i));t.step(new dt(e.start-(o?2:0),e.end,e.start,e.end,new fe(i,0,0),n.length,!0));let s=0;for(let u=0;u<n.length;u++)n[u].type==r&&(s=u+1);let l=n.length-s,c=e.start+n.length-(o?2:0),d=e.parent;for(let u=e.startIndex,f=e.endIndex,p=!0;u<f;u++,p=!1)!p&&vn(t.doc,c,l)&&(t.split(c,l),c+=2*l),c+=d.child(u).nodeSize;return t}function sx(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,s=>s.childCount>0&&s.firstChild.type==t);return i?n?o.node(i.depth-1).type==t?ax(e,n,t,i):lx(e,n,i):!0:!1}}function ax(t,e,n,o){let r=t.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new dt(i-1,s,i,s,new fe(oe.from(n.create(null,o.parent.copy())),1,0),1,!0)),o=new Mi(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=$o(o);if(l==null)return!1;r.lift(o,l);let c=r.doc.resolve(r.mapping.map(i,-1)-1);return Jn(r.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&r.join(c.pos),e(r.scrollIntoView()),!0}function lx(t,e,n){let o=t.tr,r=n.parent;for(let h=n.end,m=n.endIndex-1,b=n.startIndex;m>b;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let i=o.doc.resolve(n.start),s=i.nodeAfter;if(o.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=n.startIndex==0,c=n.endIndex==r.childCount,d=i.node(-1),u=i.index(-1);if(!d.canReplace(u+(l?0:1),u+1,s.content.append(c?oe.empty:oe.from(r))))return!1;let f=i.pos,p=f+s.nodeSize;return o.step(new dt(f-(l?1:0),p+(c?1:0),f+1,p-1,new fe((l?oe.empty:oe.from(r.copy(oe.empty))).append(c?oe.empty:oe.from(r.copy(oe.empty))),l?0:1,c?0:1),l?0:1)),e(o.scrollIntoView()),!0}function cx(t){return function(e,n){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,d=>d.childCount>0&&d.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,c=l.child(s-1);if(c.type!=t)return!1;if(n){let d=c.lastChild&&c.lastChild.type==l.type,u=oe.from(d?t.create():null),f=new fe(oe.from(t.create(null,oe.from(l.type.create(null,u)))),d?3:1,0),p=i.start,h=i.end;n(e.tr.step(new dt(p-(d?3:1),h,p,h,f,1,!0)).scrollIntoView())}return!0}}const ht=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Ho=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let ll=null;const Tn=function(t,e,n){let o=ll||(ll=document.createRange());return o.setEnd(t,n??t.nodeValue.length),o.setStart(t,e||0),o},dx=function(){ll=null},ko=function(t,e,n,o){return n&&(Wf(t,e,n,o,-1)||Wf(t,e,n,o,1))},ux=/^(img|br|input|textarea|hr)$/i;function Wf(t,e,n,o,r){for(var i;;){if(t==n&&e==o)return!0;if(e==(r<0?0:Ht(t))){let s=t.parentNode;if(!s||s.nodeType!=1||zr(t)||ux.test(t.nodeName)||t.contentEditable=="false")return!1;e=ht(t)+(r<0?0:1),t=s}else if(t.nodeType==1){let s=t.childNodes[e+(r<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=r;else return!1;else t=s,e=r<0?Ht(t):0}else return!1}}function Ht(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function fx(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=Ht(t)}else if(t.parentNode&&!zr(t))e=ht(t),t=t.parentNode;else return null}}function px(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!zr(t))e=ht(t)+1,t=t.parentNode;else return null}}function hx(t,e,n){for(let o=e==0,r=e==Ht(t);o||r;){if(t==n)return!0;let i=ht(t);if(t=t.parentNode,!t)return!1;o=o&&i==0,r=r&&i==Ht(t)}}function zr(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const ji=function(t){return t.focusNode&&ko(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function wo(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function mx(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function gx(t,e,n){if(t.caretPositionFromPoint)try{let o=t.caretPositionFromPoint(e,n);if(o)return{node:o.offsetNode,offset:Math.min(Ht(o.offsetNode),o.offset)}}catch{}if(t.caretRangeFromPoint){let o=t.caretRangeFromPoint(e,n);if(o)return{node:o.startContainer,offset:Math.min(Ht(o.startContainer),o.startOffset)}}}const hn=typeof navigator<"u"?navigator:null,Gf=typeof document<"u"?document:null,Xn=hn&&hn.userAgent||"",cl=/Edge\/(\d+)/.exec(Xn),qf=/MSIE \d/.exec(Xn),dl=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Xn),Dt=!!(qf||dl||cl),Yn=qf?document.documentMode:dl?+dl[1]:cl?+cl[1]:0,Wt=!Dt&&/gecko\/(\d+)/i.test(Xn);Wt&&+(/Firefox\/(\d+)/.exec(Xn)||[0,0])[1];const ul=!Dt&&/Chrome\/(\d+)/.exec(Xn),ut=!!ul,Kf=ul?+ul[1]:0,mt=!Dt&&!!hn&&/Apple Computer/.test(hn.vendor),Wo=mt&&(/Mobile\/\w+/.test(Xn)||!!hn&&hn.maxTouchPoints>2),Gt=Wo||(hn?/Mac/.test(hn.platform):!1),Jf=hn?/Win/.test(hn.platform):!1,zn=/Android \d/.test(Xn),_r=!!Gf&&"webkitFontSmoothing"in Gf.documentElement.style,bx=_r?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function yx(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function _n(t,e){return typeof t=="number"?t:t[e]}function xx(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,o=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*o}}function Xf(t,e,n){let o=t.someProp("scrollThreshold")||0,r=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;){if(s.nodeType!=1){s=Ho(s);continue}let l=s,c=l==i.body,d=c?yx(i):xx(l),u=0,f=0;if(e.top<d.top+_n(o,"top")?f=-(d.top-e.top+_n(r,"top")):e.bottom>d.bottom-_n(o,"bottom")&&(f=e.bottom-e.top>d.bottom-d.top?e.top+_n(r,"top")-d.top:e.bottom-d.bottom+_n(r,"bottom")),e.left<d.left+_n(o,"left")?u=-(d.left-e.left+_n(r,"left")):e.right>d.right-_n(o,"right")&&(u=e.right-d.right+_n(r,"right")),u||f)if(c)i.defaultView.scrollBy(u,f);else{let h=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),u&&(l.scrollLeft+=u);let b=l.scrollLeft-h,g=l.scrollTop-m;e={left:e.left-b,top:e.top-g,right:e.right-b,bottom:e.bottom-g}}let p=c?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:Ho(s)}}function Ex(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),o,r;for(let i=(e.left+e.right)/2,s=n+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=t.root.elementFromPoint(i,s);if(!l||l==t.dom||!t.dom.contains(l))continue;let c=l.getBoundingClientRect();if(c.top>=n-20){o=l,r=c.top;break}}return{refDOM:o,refTop:r,stack:Yf(t.dom)}}function Yf(t){let e=[],n=t.ownerDocument;for(let o=t;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),t!=n);o=Ho(o));return e}function kx({refDOM:t,refTop:e,stack:n}){let o=t?t.getBoundingClientRect().top:0;Qf(n,o==0?0:o-e)}function Qf(t,e){for(let n=0;n<t.length;n++){let{dom:o,top:r,left:i}=t[n];o.scrollTop!=r+e&&(o.scrollTop=r+e),o.scrollLeft!=i&&(o.scrollLeft=i)}}let Go=null;function wx(t){if(t.setActive)return t.setActive();if(Go)return t.focus(Go);let e=Yf(t);t.focus(Go==null?{get preventScroll(){return Go={preventScroll:!0},!0}}:void 0),Go||(Go=!1,Qf(e,0))}function Zf(t,e){let n,o=2e8,r,i=0,s=e.top,l=e.top,c,d;for(let u=t.firstChild,f=0;u;u=u.nextSibling,f++){let p;if(u.nodeType==1)p=u.getClientRects();else if(u.nodeType==3)p=Tn(u).getClientRects();else continue;for(let h=0;h<p.length;h++){let m=p[h];if(m.top<=s&&m.bottom>=l){s=Math.max(m.bottom,s),l=Math.min(m.top,l);let b=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(b<o){n=u,o=b,r=b&&n.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,u.nodeType==1&&b&&(i=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!c&&m.left<=e.left&&m.right>=e.left&&(c=u,d={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=f+1)}}return!n&&c&&(n=c,r=d,o=0),n&&n.nodeType==3?Sx(n,r):!n||o&&n.nodeType==1?{node:t,offset:i}:Zf(n,r)}function Sx(t,e){let n=t.nodeValue.length,o=document.createRange(),r;for(let i=0;i<n;i++){o.setEnd(t,i+1),o.setStart(t,i);let s=Qn(o,1);if(s.top!=s.bottom&&fl(e,s)){r={node:t,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return o.detach(),r||{node:t,offset:0}}function fl(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function Nx(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function Cx(t,e,n){let{node:o,offset:r}=Zf(e,n),i=-1;if(o.nodeType==1&&!o.firstChild){let s=o.getBoundingClientRect();i=s.left!=s.right&&n.left>(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(o,r,i)}function vx(t,e,n,o){let r=-1;for(let i=e,s=!1;i!=t.dom;){let l=t.docView.nearestDesc(i,!0),c;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((c=l.dom.getBoundingClientRect()).width||c.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&c.left>o.left||c.top>o.top?r=l.posBefore:(!s&&c.right<o.left||c.bottom<o.top)&&(r=l.posAfter),s=!0),!l.contentDOM&&r<0&&!l.node.isText))return(l.node.isBlock?o.top<(c.top+c.bottom)/2:o.left<(c.left+c.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return r>-1?r:t.docView.posFromDOM(e,n,-1)}function ep(t,e,n){let o=t.childNodes.length;if(o&&n.top<n.bottom)for(let r=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-n.top)/(n.bottom-n.top))-2)),i=r;;){let s=t.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let c=0;c<l.length;c++){let d=l[c];if(fl(e,d))return ep(s,e,d)}}if((i=(i+1)%o)==r)break}return t}function Tx(t,e){let n=t.dom.ownerDocument,o,r=0,i=gx(n,e.left,e.top);i&&({node:o,offset:r}=i);let s=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),l;if(!s||!t.dom.contains(s.nodeType!=1?s.parentNode:s)){let d=t.dom.getBoundingClientRect();if(!fl(e,d)||(s=ep(t.dom,e,d),!s))return null}if(mt)for(let d=s;o&&d;d=Ho(d))d.draggable&&(o=void 0);if(s=Nx(s,e),o){if(Wt&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let u=o.childNodes[r],f;u.nodeName=="IMG"&&(f=u.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&r++}let d;_r&&r&&o.nodeType==1&&(d=o.childNodes[r-1]).nodeType==1&&d.contentEditable=="false"&&d.getBoundingClientRect().top>=e.top&&r--,o==t.dom&&r==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?l=t.state.doc.content.size:(r==0||o.nodeType!=1||o.childNodes[r-1].nodeName!="BR")&&(l=vx(t,o,r,e))}l==null&&(l=Cx(t,s,e));let c=t.docView.nearestDesc(s,!0);return{pos:l,inside:c?c.posAtStart-c.border:-1}}function tp(t){return t.top<t.bottom||t.left<t.right}function Qn(t,e){let n=t.getClientRects();if(n.length){let o=n[e<0?0:n.length-1];if(tp(o))return o}return Array.prototype.find.call(n,tp)||t.getBoundingClientRect()}const zx=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function np(t,e,n){let{node:o,offset:r,atom:i}=t.docView.domFromPos(e,n<0?-1:1),s=_r||Wt;if(o.nodeType==3)if(s&&(zx.test(o.nodeValue)||(n<0?!r:r==o.nodeValue.length))){let c=Qn(Tn(o,r,r),n);if(Wt&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let d=Qn(Tn(o,r-1,r-1),-1);if(d.top==c.top){let u=Qn(Tn(o,r,r+1),-1);if(u.top!=c.top)return Ar(u,u.left<d.left)}}return c}else{let c=r,d=r,u=n<0?1:-1;return n<0&&!r?(d++,u=-1):n>=0&&r==o.nodeValue.length?(c--,u=1):n<0?c--:d++,Ar(Qn(Tn(o,c,d),u),u<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(n<0||r==Ht(o))){let c=o.childNodes[r-1];if(c.nodeType==1)return pl(c.getBoundingClientRect(),!1)}if(i==null&&r<Ht(o)){let c=o.childNodes[r];if(c.nodeType==1)return pl(c.getBoundingClientRect(),!0)}return pl(o.getBoundingClientRect(),n>=0)}if(i==null&&r&&(n<0||r==Ht(o))){let c=o.childNodes[r-1],d=c.nodeType==3?Tn(c,Ht(c)-(s?0:1)):c.nodeType==1&&(c.nodeName!="BR"||!c.nextSibling)?c:null;if(d)return Ar(Qn(d,1),!1)}if(i==null&&r<Ht(o)){let c=o.childNodes[r];for(;c.pmViewDesc&&c.pmViewDesc.ignoreForCoords;)c=c.nextSibling;let d=c?c.nodeType==3?Tn(c,0,s?0:1):c.nodeType==1?c:null:null;if(d)return Ar(Qn(d,-1),!0)}return Ar(Qn(o.nodeType==3?Tn(o):o,-n),n>=0)}function Ar(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function pl(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function op(t,e,n){let o=t.state,r=t.root.activeElement;o!=e&&t.updateState(e),r!=t.dom&&t.focus();try{return n()}finally{o!=e&&t.updateState(o),r!=t.dom&&r&&r.focus()}}function _x(t,e,n){let o=e.selection,r=n=="up"?o.$from:o.$to;return op(t,e,()=>{let{node:i}=t.docView.domFromPos(r.pos,n=="up"?-1:1);for(;;){let l=t.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=np(t,r.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let c;if(l.nodeType==1)c=l.getClientRects();else if(l.nodeType==3)c=Tn(l,0,l.nodeValue.length).getClientRects();else continue;for(let d=0;d<c.length;d++){let u=c[d];if(u.bottom>u.top+1&&(n=="up"?s.top-u.top>(u.bottom-s.top)*2:u.bottom-s.bottom>(s.bottom-u.top)*2))return!1}}return!0})}const Ax=/[\u0590-\u08ac]/;function Mx(t,e,n){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,s=r==o.parent.content.size,l=t.domSelection();return l?!Ax.test(o.parent.textContent)||!l.modify?n=="left"||n=="backward"?i:s:op(t,e,()=>{let{focusNode:c,focusOffset:d,anchorNode:u,anchorOffset:f}=t.domSelectionRange(),p=l.caretBidiLevel;l.modify("move",n,"character");let h=o.depth?t.docView.domAfterPos(o.before()):t.dom,{focusNode:m,focusOffset:b}=t.domSelectionRange(),g=m&&!h.contains(m.nodeType==1?m:m.parentNode)||c==m&&d==b;try{l.collapse(u,f),c&&(c!=u||d!=f)&&l.extend&&l.extend(c,d)}catch{}return p!=null&&(l.caretBidiLevel=p),g}):o.pos==o.start()||o.pos==o.end()}let rp=null,ip=null,sp=!1;function Ix(t,e,n){return rp==e&&ip==n?sp:(rp=e,ip=n,sp=n=="up"||n=="down"?_x(t,e,n):Mx(t,e,n))}const qt=0,ap=1,So=2,mn=3;class Mr{constructor(e,n,o,r){this.parent=e,this.children=n,this.dom=o,this.contentDOM=r,this.dirty=qt,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,o){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,o=this.posAtStart;;n++){let r=this.children[n];if(r==e)return o;o+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let i,s;if(e==this.contentDOM)i=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=n>ht(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!1;break}if(i.previousSibling)break}if(r==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!0;break}if(i.nextSibling)break}}return r??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let o=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),s;if(i&&(!n||i.node))if(o&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))o=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let o=n;o;o=o.parent)if(o==this)return n}posFromDOM(e,n,o){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,n,o)}return-1}descAt(e){for(let n=0,o=0;n<this.children.length;n++){let r=this.children[n],i=o+r.size;if(o==e&&i!=o){for(;!r.border&&r.children.length;)for(let s=0;s<r.children.length;s++){let l=r.children[s];if(l.size){r=l;break}}return r}if(e<i)return r.descAt(e-o-r.border);o=i}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,r=0;for(let i=0;o<this.children.length;o++){let s=this.children[o],l=i+s.size;if(l>e||s instanceof dp){r=e-i;break}i=l}if(r)return this.children[o].domFromPos(r-this.children[o].border,n);for(let i;o&&!(i=this.children[o-1]).size&&i instanceof lp&&i.side>=0;o--);if(n<=0){let i,s=!0;for(;i=o?this.children[o-1]:null,!(!i||i.dom.parentNode==this.contentDOM);o--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?ht(i.dom)+1:0}}else{let i,s=!0;for(;i=o<this.children.length?this.children[o]:null,!(!i||i.dom.parentNode==this.contentDOM);o++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,n):{node:this.contentDOM,offset:i?ht(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let s=o,l=0;;l++){let c=this.children[l],d=s+c.size;if(r==-1&&e<=d){let u=s+c.border;if(e>=u&&n<=d-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(e,n,u);e=s;for(let f=l;f>0;f--){let p=this.children[f-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=ht(p.dom)+1;break}e-=p.size}r==-1&&(r=0)}if(r>-1&&(d>n||l==this.children.length-1)){n=d;for(let u=l+1;u<this.children.length;u++){let f=this.children[u];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=ht(f.dom);break}n+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=d}return{node:this.contentDOM,from:e,to:n,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:o}=this.domFromPos(e,0);if(n.nodeType!=1||o==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[o]}setSelection(e,n,o,r=!1){let i=Math.min(e,n),s=Math.max(e,n);for(let h=0,m=0;h<this.children.length;h++){let b=this.children[h],g=m+b.size;if(i>m&&s<g)return b.setSelection(e-m-b.border,n-m-b.border,o,r);m=g}let l=this.domFromPos(e,e?-1:1),c=n==e?l:this.domFromPos(n,n?-1:1),d=o.root.getSelection(),u=o.domSelectionRange(),f=!1;if((Wt||mt)&&e==n){let{node:h,offset:m}=l;if(h.nodeType==3){if(f=!!(m&&h.nodeValue[m-1]==`
354
+ `),f&&m==h.nodeValue.length)for(let b=h,g;b;b=b.parentNode){if(g=b.nextSibling){g.nodeName=="BR"&&(l=c={node:g.parentNode,offset:ht(g)+1});break}let x=b.pmViewDesc;if(x&&x.node&&x.node.isBlock)break}}else{let b=h.childNodes[m-1];f=b&&(b.nodeName=="BR"||b.contentEditable=="false")}}if(Wt&&u.focusNode&&u.focusNode!=c.node&&u.focusNode.nodeType==1){let h=u.focusNode.childNodes[u.focusOffset];h&&h.contentEditable=="false"&&(r=!0)}if(!(r||f&&mt)&&ko(l.node,l.offset,u.anchorNode,u.anchorOffset)&&ko(c.node,c.offset,u.focusNode,u.focusOffset))return;let p=!1;if((d.extend||e==n)&&!(f&&Wt)){d.collapse(l.node,l.offset);try{e!=n&&d.extend(c.node,c.offset),p=!0}catch{}}if(!p){if(e>n){let m=l;l=c,c=m}let h=document.createRange();h.setEnd(c.node,c.offset),h.setStart(l.node,l.offset),d.removeAllRanges(),d.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let o=0,r=0;r<this.children.length;r++){let i=this.children[r],s=o+i.size;if(o==s?e<=s&&n>=o:e<s&&n>o){let l=o+i.border,c=s-i.border;if(e>=l&&n<=c){this.dirty=e==o||n==s?So:ap,e==l&&n==c&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=mn:i.markDirty(e-l,n-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?So:mn}o=s}this.dirty=So}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let o=e==1?So:ap;n.dirty<o&&(n.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class lp extends Mr{constructor(e,n,o,r){let i,s=n.type.toDOM;if(typeof s=="function"&&(s=s(o,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==qt&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class Ox extends Mr{constructor(e,n,o,r){super(e,[],n,null),this.textDOM=o,this.text=r}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class No extends Mr{constructor(e,n,o,r,i){super(e,[],o,r),this.mark=n,this.spec=i}static create(e,n,o,r){let i=r.nodeViews[n.type.name],s=i&&i(n,r,o);return(!s||!s.dom)&&(s=xo.renderSpec(document,n.type.spec.toDOM(n,o),null,n.attrs)),new No(e,n,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&mn||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=mn&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=qt){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=qt}}slice(e,n,o){let r=No.create(this.parent,this.mark,!0,o),i=this.children,s=this.size;n<s&&(i=ml(i,n,s,o)),e>0&&(i=ml(i,0,e,o));for(let l=0;l<i.length;l++)i[l].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Zn extends Mr{constructor(e,n,o,r,i,s,l,c,d){super(e,[],i,s),this.node=n,this.outerDeco=o,this.innerDeco=r,this.nodeDOM=l}static create(e,n,o,r,i,s){let l=i.nodeViews[n.type.name],c,d=l&&l(n,i,()=>{if(!c)return s;if(c.parent)return c.parent.posBeforeChild(c)},o,r),u=d&&d.dom,f=d&&d.contentDOM;if(n.isText){if(!u)u=document.createTextNode(n.text);else if(u.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else u||({dom:u,contentDOM:f}=xo.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&u.nodeName!="BR"&&(u.hasAttribute("contenteditable")||(u.contentEditable="false"),n.type.spec.draggable&&(u.draggable=!0));let p=u;return u=pp(u,o,n),d?c=new Dx(e,n,o,r,u,f||null,p,d,i,s+1):n.isText?new Ui(e,n,o,r,u,p,i):new Zn(e,n,o,r,u,f||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let o=this.children[n];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>oe.empty)}return e}matchesNode(e,n,o){return this.dirty==qt&&e.eq(this.node)&&Hi(n,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let o=this.node.inlineContent,r=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,c=new Px(this,s&&s.node,e);Vx(this.node,this.innerDeco,(d,u,f)=>{d.spec.marks?c.syncToMarks(d.spec.marks,o,e,u):d.type.side>=0&&!f&&c.syncToMarks(u==this.node.childCount?je.none:this.node.child(u).marks,o,e,u),c.placeWidget(d,e,r)},(d,u,f,p)=>{c.syncToMarks(d.marks,o,e,p);let h;c.findNodeMatch(d,u,f,p)||l&&e.state.selection.from>r&&e.state.selection.to<r+d.nodeSize&&(h=c.findIndexWithChild(i.node))>-1&&c.updateNodeAt(d,u,f,h,e)||c.updateNextNode(d,u,f,e,p,r)||c.addNode(d,u,f,e,r),r+=d.nodeSize}),c.syncToMarks([],o,e,0),this.node.isTextblock&&c.addTextblockHacks(),c.destroyRest(),(c.changed||this.dirty==So)&&(s&&this.protectLocalComposition(e,s),up(this.contentDOM,this.children,e),Wo&&Bx(this.dom))}localCompositionInfo(e,n){let{from:o,to:r}=e.state.selection;if(!(e.state.selection instanceof Oe)||o<n||r>n+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=Fx(this.node.content,s,o-n,r-n);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:o,text:r}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new Ox(this,i,n,r);e.input.compositionNodes.push(s),this.children=ml(this.children,o,o+r.length,e,s)}update(e,n,o,r){return this.dirty==mn||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,o,r),!0)}updateInner(e,n,o,r){this.updateOuterDeco(n),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=qt}updateOuterDeco(e){if(Hi(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=fp(this.dom,this.nodeDOM,hl(this.outerDeco,this.node,n),hl(e,this.node,n)),this.dom!=o&&(o.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 cp(t,e,n,o,r){pp(o,e,t);let i=new Zn(void 0,t,e,n,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class Ui extends Zn{constructor(e,n,o,r,i,s,l){super(e,n,o,r,i,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,o,r){return this.dirty==mn||this.dirty!=qt&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=qt||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=qt,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,o){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,o){let r=this.node.cut(e,n),i=document.createTextNode(r.text);return new Ui(this.parent,r,this.outerDeco,this.innerDeco,i,i,o)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=mn)}get domAtom(){return!1}isText(e){return this.node.text==e}}class dp extends Mr{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==qt&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class Dx extends Zn{constructor(e,n,o,r,i,s,l,c,d,u){super(e,n,o,r,i,s,l,d,u),this.spec=c}update(e,n,o,r){if(this.dirty==mn)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,n,o);return i&&this.updateInner(e,n,o,r),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,o,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,o,r){this.spec.setSelection?this.spec.setSelection(e,n,o.root):super.setSelection(e,n,o,r)}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 up(t,e,n){let o=t.firstChild,r=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==t){for(;l!=o;)o=hp(o),r=!0;o=o.nextSibling}else r=!0,t.insertBefore(l,o);if(s instanceof No){let c=o?o.previousSibling:t.lastChild;up(s.contentDOM,s.children,n),o=c?c.nextSibling:t.firstChild}}for(;o;)o=hp(o),r=!0;r&&n.trackWrites==t&&(n.trackWrites=null)}const Ir=function(t){t&&(this.nodeName=t)};Ir.prototype=Object.create(null);const Co=[new Ir];function hl(t,e,n){if(t.length==0)return Co;let o=n?Co[0]:new Ir,r=[o];for(let i=0;i<t.length;i++){let s=t[i].type.attrs;if(s){s.nodeName&&r.push(o=new Ir(s.nodeName));for(let l in s){let c=s[l];c!=null&&(n&&r.length==1&&r.push(o=new Ir(e.isInline?"span":"div")),l=="class"?o.class=(o.class?o.class+" ":"")+c:l=="style"?o.style=(o.style?o.style+";":"")+c:l!="nodeName"&&(o[l]=c))}}}return r}function fp(t,e,n,o){if(n==Co&&o==Co)return e;let r=e;for(let i=0;i<o.length;i++){let s=o[i],l=n[i];if(i){let c;l&&l.nodeName==s.nodeName&&r!=t&&(c=r.parentNode)&&c.nodeName.toLowerCase()==s.nodeName||(c=document.createElement(s.nodeName),c.pmIsDeco=!0,c.appendChild(r),l=Co[0]),r=c}Rx(r,l||Co[0],s)}return r}function Rx(t,e,n){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in n)&&t.removeAttribute(o);for(let o in n)o!="class"&&o!="style"&&o!="nodeName"&&n[o]!=e[o]&&t.setAttribute(o,n[o]);if(e.class!=n.class){let o=e.class?e.class.split(" ").filter(Boolean):[],r=n.class?n.class.split(" ").filter(Boolean):[];for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&t.classList.remove(o[i]);for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&t.classList.add(r[i]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=o.exec(e.style);)t.style.removeProperty(r[1])}n.style&&(t.style.cssText+=n.style)}}function pp(t,e,n){return fp(t,t,Co,hl(e,n,t.nodeType!=1))}function Hi(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function hp(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class Px{constructor(e,n,o){this.lock=n,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=Lx(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let o=e;o<n;o++)this.top.children[o].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,o,r){let i=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;i<l&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=qt,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let c=-1,d=this.top.children.length;r<this.preMatch.index&&(d=Math.min(this.index+3,d));for(let u=this.index;u<d;u++){let f=this.top.children[u];if(f.matchesMark(e[s])&&!this.isLocked(f.dom)){c=u;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let u=No.create(this.top,e[s],n,o);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,s++}}findNodeMatch(e,n,o,r){let i=-1,s;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,o))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,c=Math.min(this.top.children.length,l+5);l<c;l++){let d=this.top.children[l];if(d.matchesNode(e,n,o)&&!this.preMatch.matched.has(d)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,n,o,r,i){let s=this.top.children[r];return s.dirty==mn&&s.dom==s.contentDOM&&(s.dirty=So),s.update(e,n,o,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==o)return r}return-1}e=n}}updateNextNode(e,n,o,r,i,s){for(let l=this.index;l<this.top.children.length;l++){let c=this.top.children[l];if(c instanceof Zn){let d=this.preMatch.matched.get(c);if(d!=null&&d!=i)return!1;let u=c.dom,f,p=this.isLocked(u)&&!(e.isText&&c.node&&c.node.isText&&c.nodeDOM.nodeValue==e.text&&c.dirty!=mn&&Hi(n,c.outerDeco));if(!p&&c.update(e,n,o,r))return this.destroyBetween(this.index,l),c.dom!=u&&(this.changed=!0),this.index++,!0;if(!p&&(f=this.recreateWrapper(c,e,n,o,r,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=So,f.updateChildren(r,s+1),f.dirty=qt),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,o,r,i,s){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Hi(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=Zn.create(this.top,n,o,r,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let c of l.children)c.parent=l}return e.destroy(),l}addNode(e,n,o,r,i){let s=Zn.create(this.top,e,n,o,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,n,o){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let i=new lp(this.top,e,n,o);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof No;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof Ui)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((mt||ut)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let r=new dp(this.top,[],o,null);n!=this.top?n.children.push(r):n.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function Lx(t,e){let n=e,o=n.children.length,r=t.childCount,i=new Map,s=[];e:for(;r>0;){let l;for(;;)if(o){let d=n.children[o-1];if(d instanceof No)n=d,o=d.children.length;else{l=d,o--;break}}else{if(n==e)break e;o=n.parent.children.indexOf(n),n=n.parent}let c=l.node;if(c){if(c!=t.child(r-1))break;--r,i.set(l,r),s.push(l)}}return{index:r,matched:i,matches:s.reverse()}}function $x(t,e){return t.type.side-e.type.side}function Vx(t,e,n,o){let r=e.locals(t),i=0;if(r.length==0){for(let d=0;d<t.childCount;d++){let u=t.child(d);o(u,r,e.forChild(i,u),d),i+=u.nodeSize}return}let s=0,l=[],c=null;for(let d=0;;){let u,f;for(;s<r.length&&r[s].to==i;){let g=r[s++];g.widget&&(u?(f||(f=[u])).push(g):u=g)}if(u)if(f){f.sort($x);for(let g=0;g<f.length;g++)n(f[g],d,!!c)}else n(u,d,!!c);let p,h;if(c)h=-1,p=c,c=null;else if(d<t.childCount)h=d,p=t.child(d++);else break;for(let g=0;g<l.length;g++)l[g].to<=i&&l.splice(g--,1);for(;s<r.length&&r[s].from<=i&&r[s].to>i;)l.push(r[s++]);let m=i+p.nodeSize;if(p.isText){let g=m;s<r.length&&r[s].from<g&&(g=r[s].from);for(let x=0;x<l.length;x++)l[x].to<g&&(g=l[x].to);g<m&&(c=p.cut(g-i),p=p.cut(0,g-i),m=g,h=-1)}else for(;s<r.length&&r[s].to<m;)s++;let b=p.isInline&&!p.isLeaf?l.filter(g=>!g.inline):l.slice();o(p,b,e.forChild(i,p),h),i=m}}function Bx(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Fx(t,e,n,o){for(let r=0,i=0;r<t.childCount&&i<=o;){let s=t.child(r++),l=i;if(i+=s.nodeSize,!s.isText)continue;let c=s.text;for(;r<t.childCount;){let d=t.child(r++);if(i+=d.nodeSize,!d.isText)break;c+=d.text}if(i>=n){if(i>=o&&c.slice(o-e.length-l,o-l)==e)return o-e.length;let d=l<o?c.lastIndexOf(e,o-l-1):-1;if(d>=0&&d+e.length+l>=n)return l+d;if(n==o&&c.length>=o+e.length-l&&c.slice(o-l,o-l+e.length)==e)return o}}return-1}function ml(t,e,n,o,r){let i=[];for(let s=0,l=0;s<t.length;s++){let c=t[s],d=l,u=l+=c.size;d>=n||u<=e?i.push(c):(d<e&&i.push(c.slice(0,e-d,o)),r&&(i.push(r),r=void 0),u>n&&i.push(c.slice(n-d,c.size,o)))}return i}function gl(t,e=null){let n=t.domSelectionRange(),o=t.state.doc;if(!n.focusNode)return null;let r=t.docView.nearestDesc(n.focusNode),i=r&&r.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let l=o.resolve(s),c,d;if(ji(n)){for(c=s;r&&!r.node;)r=r.parent;let f=r.node;if(r&&f.isAtom&&Ce.isSelectable(f)&&r.parent&&!(f.isInline&&hx(n.focusNode,n.focusOffset,r.dom))){let p=r.posBefore;d=new Ce(s==p?l:o.resolve(p))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=s,p=s;for(let h=0;h<n.rangeCount;h++){let m=n.getRangeAt(h);f=Math.min(f,t.docView.posFromDOM(m.startContainer,m.startOffset,1)),p=Math.max(p,t.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[c,s]=p==t.state.selection.anchor?[p,f]:[f,p],l=o.resolve(s)}else c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null}let u=o.resolve(c);if(!d){let f=e=="pointer"||t.state.selection.head<l.pos&&!i?1:-1;d=yl(t,u,l,f)}return d}function mp(t){return t.editable?t.hasFocus():wp(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function An(t,e=!1){let n=t.state.selection;if(xp(t,n),!!mp(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&ut){let o=t.domSelectionRange(),r=t.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&ko(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)Ux(t);else{let{anchor:o,head:r}=n,i,s;gp&&!(n instanceof Oe)&&(n.$from.parent.inlineContent||(i=bp(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(s=bp(t,n.to))),t.docView.setSelection(o,r,t,e),gp&&(i&&yp(i),s&&yp(s)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&jx(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const gp=mt||ut&&Kf<63;function bp(t,e){let{node:n,offset:o}=t.docView.domFromPos(e,0),r=o<n.childNodes.length?n.childNodes[o]:null,i=o?n.childNodes[o-1]:null;if(mt&&r&&r.contentEditable=="false")return bl(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return bl(r);if(i)return bl(i)}}function bl(t){return t.contentEditable="true",mt&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function yp(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function jx(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),o=n.anchorNode,r=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=o||n.anchorOffset!=r)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!mp(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Ux(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,o=n.nodeName=="IMG";o?e.collapse(n.parentNode,ht(n)+1):e.collapse(n,0),!o&&!t.state.selection.visible&&Dt&&Yn<=11&&(n.disabled=!0,n.disabled=!1)}function xp(t,e){if(e instanceof Ce){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(Ep(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else Ep(t)}function Ep(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function yl(t,e,n,o){return t.someProp("createSelectionBetween",r=>r(t,e,n))||Oe.between(e,n,o)}function kp(t){return t.editable&&!t.hasFocus()?!1:wp(t)}function wp(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Hx(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return ko(e.node,e.offset,n.anchorNode,n.anchorOffset)}function xl(t,e){let{$anchor:n,$head:o}=t.selection,r=e>0?n.max(o):n.min(o),i=r.parent.inlineContent?r.depth?t.doc.resolve(e>0?r.after():r.before()):null:r;return i&&Le.findFrom(i,e)}function eo(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function Sp(t,e,n){let o=t.state.selection;if(o instanceof Oe)if(n.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return eo(t,new Oe(o.$anchor,s))}else if(o.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let r=xl(t.state,e);return r&&r instanceof Ce?eo(t,r):!1}else if(!(Gt&&n.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(s=t.docView.descAt(l))&&!s.contentDOM?Ce.isSelectable(i)?eo(t,new Ce(e<0?t.state.doc.resolve(r.pos-i.nodeSize):r)):_r?eo(t,new Oe(t.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof Ce&&o.node.isInline)return eo(t,new Oe(e>0?o.$to:o.$from));{let r=xl(t.state,e);return r?eo(t,r):!1}}}function Wi(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Or(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function qo(t,e){return e<0?Wx(t):Gx(t)}function Wx(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r,i,s=!1;for(Wt&&n.nodeType==1&&o<Wi(n)&&Or(n.childNodes[o],-1)&&(s=!0);;)if(o>0){if(n.nodeType!=1)break;{let l=n.childNodes[o-1];if(Or(l,-1))r=n,i=--o;else if(l.nodeType==3)n=l,o=n.nodeValue.length;else break}}else{if(Np(n))break;{let l=n.previousSibling;for(;l&&Or(l,-1);)r=n.parentNode,i=ht(l),l=l.previousSibling;if(l)n=l,o=Wi(n);else{if(n=n.parentNode,n==t.dom)break;o=0}}}s?El(t,n,o):r&&El(t,r,i)}function Gx(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let r=Wi(n),i,s;for(;;)if(o<r){if(n.nodeType!=1)break;let l=n.childNodes[o];if(Or(l,1))i=n,s=++o;else break}else{if(Np(n))break;{let l=n.nextSibling;for(;l&&Or(l,1);)i=l.parentNode,s=ht(l)+1,l=l.nextSibling;if(l)n=l,o=0,r=Wi(n);else{if(n=n.parentNode,n==t.dom)break;o=r=0}}}i&&El(t,i,s)}function Np(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function qx(t,e){for(;t&&e==t.childNodes.length&&!zr(t);)e=ht(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function Kx(t,e){for(;t&&!e&&!zr(t);)e=ht(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function El(t,e,n){if(e.nodeType!=3){let i,s;(s=qx(e,n))?(e=s,n=0):(i=Kx(e,n))&&(e=i,n=i.nodeValue.length)}let o=t.domSelection();if(!o)return;if(ji(o)){let i=document.createRange();i.setEnd(e,n),i.setStart(e,n),o.removeAllRanges(),o.addRange(i)}else o.extend&&o.extend(e,n);t.domObserver.setCurSelection();let{state:r}=t;setTimeout(()=>{t.state==r&&An(t)},50)}function Cp(t,e){let n=t.state.doc.resolve(e);if(!(ut||Jf)&&n.parent.inlineContent){let r=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(e<n.end()){let i=t.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function vp(t,e,n){let o=t.state.selection;if(o instanceof Oe&&!o.empty||n.indexOf("s")>-1||Gt&&n.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=xl(t.state,e);if(s&&s instanceof Ce)return eo(t,s)}if(!r.parent.inlineContent){let s=e<0?r:i,l=o instanceof Bt?Le.near(s,e):Le.findFrom(s,e);return l?eo(t,l):!1}return!1}function Tp(t,e){if(!(t.state.selection instanceof Oe))return!0;let{$head:n,$anchor:o,empty:r}=t.state.selection;if(!n.sameParent(o))return!0;if(!r)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function zp(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Jx(t){if(!mt||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;zp(t,o,"true"),setTimeout(()=>zp(t,o,"false"),20)}return!1}function Xx(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Yx(t,e){let n=e.keyCode,o=Xx(e);if(n==8||Gt&&n==72&&o=="c")return Tp(t,-1)||qo(t,-1);if(n==46&&!e.shiftKey||Gt&&n==68&&o=="c")return Tp(t,1)||qo(t,1);if(n==13||n==27)return!0;if(n==37||Gt&&n==66&&o=="c"){let r=n==37?Cp(t,t.state.selection.from)=="ltr"?-1:1:-1;return Sp(t,r,o)||qo(t,r)}else if(n==39||Gt&&n==70&&o=="c"){let r=n==39?Cp(t,t.state.selection.from)=="ltr"?1:-1:1;return Sp(t,r,o)||qo(t,r)}else{if(n==38||Gt&&n==80&&o=="c")return vp(t,-1,o)||qo(t,-1);if(n==40||Gt&&n==78&&o=="c")return Jx(t)||vp(t,1,o)||qo(t,1);if(o==(Gt?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function kl(t,e){t.someProp("transformCopied",h=>{e=h(e,t)});let n=[],{content:o,openStart:r,openEnd:i}=e;for(;r>1&&i>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,i--;let h=o.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),o=h.content}let s=t.someProp("clipboardSerializer")||xo.fromSchema(t.state.schema),l=Pp(),c=l.createElement("div");c.appendChild(s.serializeFragment(o,{document:l}));let d=c.firstChild,u,f=0;for(;d&&d.nodeType==1&&(u=Dp[d.nodeName.toLowerCase()]);){for(let h=u.length-1;h>=0;h--){let m=l.createElement(u[h]);for(;c.firstChild;)m.appendChild(c.firstChild);c.appendChild(m),f++}d=c.firstChild}d&&d.nodeType==1&&d.setAttribute("data-pm-slice",`${r} ${i}${f?` -${f}`:""} ${JSON.stringify(n)}`);let p=t.someProp("clipboardTextSerializer",h=>h(e,t))||e.content.textBetween(0,e.content.size,`
355
355
 
356
- `);return{dom:c,text:p,slice:e}}function _p(t,e,n,o,r){let i=r.parent.type.spec.code,s,l;if(!n&&!e)return null;let c=!!e&&(o||i||!n);if(c){if(t.someProp("transformPastedText",p=>{e=p(e,i||o,t)}),i)return l=new ue(ne.from(t.state.schema.text(e.replace(/\r\n?/g,`
357
- `))),0,0),t.someProp("transformPasted",p=>{l=p(l,t,!0)}),l;let f=t.someProp("clipboardTextParser",p=>p(e,r,o,t));if(f)l=f;else{let p=r.marks(),{schema:h}=t.state,m=xo.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(b=>{let g=s.appendChild(document.createElement("p"));b&&g.appendChild(m.serializeNode(h.text(b,p)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),s=tE(n),_r&&nE(s);let d=s&&s.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||kr.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||u),context:r,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!Qx.test(p.parentNode.nodeName)?{ignore:!0}:null}})),u)l=oE(Op(l,+u[1],+u[2]),u[4]);else if(l=ue.maxOpen(Zx(l.content,r),!0),l.openStart||l.openEnd){let f=0,p=0;for(let h=l.content.firstChild;f<l.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=l.content.lastChild;p<l.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);l=Op(l,f,p)}return t.someProp("transformPasted",f=>{l=f(l,t,c)}),l}const Qx=/^(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 Zx(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(l=>{if(!s)return;let c=r.findWrapping(l.type),d;if(!c)return s=null;if(d=s.length&&i.length&&Mp(c,i,l,s[s.length-1],0))s[s.length-1]=d;else{s.length&&(s[s.length-1]=Ip(s[s.length-1],i.length));let u=Ap(l,c);s.push(u),r=r.matchType(u.type),i=c}}),s)return ne.from(s)}return t}function Ap(t,e,n=0){for(let o=e.length-1;o>=n;o--)t=e[o].create(null,ne.from(t));return t}function Mp(t,e,n,o,r){if(r<t.length&&r<e.length&&t[r]==e[r]){let i=Mp(t,e,n,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==t.length-1?n.type:t[r+1]))return o.copy(o.content.append(ne.from(Ap(n,t,r+1))))}}function Ip(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Ip(t.lastChild,e-1)),o=t.contentMatchAt(t.childCount).fillBefore(ne.empty,!0);return t.copy(n.append(o))}function wl(t,e,n,o,r,i){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(i=0),r<o-1&&(l=wl(l,e,n,o,r+1,i)),r>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(ne.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function Op(t,e,n){return e<t.openStart&&(t=new ue(wl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ue(wl(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Dp={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Rp=null;function Pp(){return Rp||(Rp=document.implementation.createHTMLDocument("title"))}let Sl=null;function eE(t){let e=window.trustedTypes;return e?(Sl||(Sl=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Sl.createHTML(t)):t}function tE(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Pp().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t),r;if((r=o&&Dp[o[1].toLowerCase()])&&(t=r.map(i=>"<"+i+">").join("")+t+r.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=eE(t),r)for(let i=0;i<r.length;i++)n=n.querySelector(r[i])||n;return n}function nE(t){let e=t.querySelectorAll(ut?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let o=e[n];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),o)}}function oE(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return t}let{content:r,openStart:i,openEnd:s}=t;for(let l=o.length-2;l>=0;l-=2){let c=n.nodes[o[l]];if(!c||c.hasRequiredAttrs())break;r=ne.from(c.create(o[l+1],r)),i++,s++}return new ue(r,i,s)}const zt={},_t={},rE={touchstart:!0,touchmove:!0};class iE{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 sE(t){for(let e in zt){let n=zt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=o=>{lE(t,o)&&!Cl(t,o)&&(t.editable||!(o.type in _t))&&n(t,o)},rE[e]?{passive:!0}:void 0)}mt&&t.dom.addEventListener("input",()=>null),Nl(t)}function to(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function aE(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Nl(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=o=>Cl(t,o))})}function Cl(t,e){return t.someProp("handleDOMEvents",n=>{let o=n[e.type];return o?o(t,e)||e.defaultPrevented:!1})}function lE(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function cE(t,e){!Cl(t,e)&&zt[e.type]&&(t.editable||!(e.type in _t))&&zt[e.type](t,e)}_t.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!$p(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(zn&&ut&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Wo&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let o=Date.now();t.input.lastIOSEnter=o,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==o&&(t.someProp("handleKeyDown",r=>r(t,wo(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",o=>o(t,n))||Yx(t,n)?n.preventDefault():to(t,"key")},_t.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},_t.keypress=(t,e)=>{let n=e;if($p(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Gt&&n.metaKey)return;if(t.someProp("handleKeyPress",r=>r(t,n))){n.preventDefault();return}let o=t.state.selection;if(!(o instanceof Oe)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!t.someProp("handleTextInput",s=>s(t,o.$from.pos,o.$to.pos,r,i))&&t.dispatch(i()),n.preventDefault()}};function Gi(t){return{left:t.clientX,top:t.clientY}}function dE(t,e){let n=e.x-t.clientX,o=e.y-t.clientY;return n*n+o*o<100}function vl(t,e,n,o,r){if(o==-1)return!1;let i=t.state.doc.resolve(o);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,l=>s>i.depth?l(t,n,i.nodeAfter,i.before(s),r,!0):l(t,n,i.node(s),i.before(s),r,!1)))return!0;return!1}function Ko(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let o=t.state.tr.setSelection(e);o.setMeta("pointer",!0),t.dispatch(o)}function uE(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),o=n.nodeAfter;return o&&o.isAtom&&Ne.isSelectable(o)?(Ko(t,new Ne(n)),!0):!1}function fE(t,e){if(e==-1)return!1;let n=t.state.selection,o,r;n instanceof Ne&&(o=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(Ne.isSelectable(l)){o&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?r=i.before(n.$from.depth):r=i.before(s);break}}return r!=null?(Ko(t,Ne.create(t.state.doc,r)),!0):!1}function pE(t,e,n,o,r){return vl(t,"handleClickOn",e,n,o)||t.someProp("handleClick",i=>i(t,e,o))||(r?fE(t,n):uE(t,n))}function hE(t,e,n,o){return vl(t,"handleDoubleClickOn",e,n,o)||t.someProp("handleDoubleClick",r=>r(t,e,o))}function mE(t,e,n,o){return vl(t,"handleTripleClickOn",e,n,o)||t.someProp("handleTripleClick",r=>r(t,e,o))||gE(t,n,o)}function gE(t,e,n){if(n.button!=0)return!1;let o=t.state.doc;if(e==-1)return o.inlineContent?(Ko(t,Oe.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let s=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(s.inlineContent)Ko(t,Oe.create(o,l+1,l+1+s.content.size));else if(Ne.isSelectable(s))Ko(t,Ne.create(o,l));else continue;return!0}}function Tl(t){return qi(t)}const Lp=Gt?"metaKey":"ctrlKey";zt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let o=Tl(t),r=Date.now(),i="singleClick";r-t.input.lastClick.time<500&&dE(n,t.input.lastClick)&&!n[Lp]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=t.posAtCoords(Gi(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new bE(t,s,n,!!o)):(i=="doubleClick"?hE:mE)(t,s.pos,s.inside,n)?n.preventDefault():to(t,"pointer"))};class bE{constructor(e,n,o,r){this.view=e,this.pos=n,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[Lp],this.allowDefault=o.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const l=r?null:o.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:d}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||d instanceof Ne&&d.from<=s&&d.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Wt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),to(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>An(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Gi(e))),this.updateAllowDefault(e),this.allowDefault||!n?to(this.view,"pointer"):pE(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||mt&&this.mightDrag&&!this.mightDrag.node.isAtom||ut&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Ko(this.view,Pe.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):to(this.view,"pointer")}move(e){this.updateAllowDefault(e),to(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}zt.touchstart=t=>{t.input.lastTouch=Date.now(),Tl(t),to(t,"pointer")},zt.touchmove=t=>{t.input.lastTouch=Date.now(),to(t,"pointer")},zt.contextmenu=t=>Tl(t);function $p(t,e){return t.composing?!0:mt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const yE=zn?5e3:-1;_t.compositionstart=_t.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Oe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||ut&&Jf&&xE(t)))t.markCursor=t.state.storedMarks||n.marks(),qi(t,!0),t.markCursor=null;else if(qi(t,!e.selection.empty),Wt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let o=t.domSelectionRange();for(let r=o.focusNode,i=o.focusOffset;r&&r.nodeType==1&&i!=0;){let s=i<0?r.lastChild:r.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=t.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else r=s,i=-1}}t.input.composing=!0}Vp(t,yE)};function xE(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let o=e.childNodes[n];return o.nodeType==1&&o.contentEditable=="false"}_t.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Vp(t,20))};function Vp(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>qi(t),e))}function Bp(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=kE());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function EE(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=fx(e.focusNode,e.focusOffset),o=px(e.focusNode,e.focusOffset);if(n&&o&&n!=o){let r=o.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||o==i)return i;if(!r||!r.isText(o.nodeValue))return o;if(t.input.compositionNode==o){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return o}}return n||o}function kE(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function qi(t,e=!1){if(!(zn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Bp(t),e||t.docView&&t.docView.dirty){let n=gl(t),o=t.state.selection;return n&&!n.eq(o)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function wE(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Dr=Dt&&Yn<15||Wo&&bx<604;zt.copy=_t.cut=(t,e)=>{let n=e,o=t.state.selection,r=n.type=="cut";if(o.empty)return;let i=Dr?null:n.clipboardData,s=o.content(),{dom:l,text:c}=kl(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",c)):wE(t,l),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function SE(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function NE(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,o=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),o.parentNode&&o.parentNode.removeChild(o),n?Rr(t,o.value,null,r,e):Rr(t,o.textContent,o.innerHTML,r,e)},50)}function Rr(t,e,n,o,r){let i=_p(t,e,n,o,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,r,i||ue.empty)))return!0;if(!i)return!1;let s=SE(i),l=s?t.state.tr.replaceSelectionWith(s,o):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Fp(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}_t.paste=(t,e)=>{let n=e;if(t.composing&&!zn)return;let o=Dr?null:n.clipboardData,r=t.input.shiftKey&&t.input.lastKeyCode!=45;o&&Rr(t,Fp(o),o.getData("text/html"),r,n)?n.preventDefault():NE(t,n)};class jp{constructor(e,n,o){this.slice=e,this.move=n,this.node=o}}const CE=Gt?"altKey":"ctrlKey";function Up(t,e){let n=t.someProp("dragCopies",o=>!o(e));return n??!e[CE]}zt.dragstart=(t,e)=>{let n=e,o=t.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let r=t.state.selection,i=r.empty?null:t.posAtCoords(Gi(n)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof Ne?r.to-1:r.to))){if(o&&o.mightDrag)s=Ne.create(t.state.doc,o.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(s=Ne.create(t.state.doc,f.posBefore))}}let l=(s||t.state.selection).content(),{dom:c,text:d,slice:u}=kl(t,l);(!n.dataTransfer.files.length||!ut||Kf>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Dr?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Dr||n.dataTransfer.setData("text/plain",d),t.dragging=new jp(u,Up(t,n),s)},zt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},_t.dragover=_t.dragenter=(t,e)=>e.preventDefault(),_t.drop=(t,e)=>{try{vE(t,e,t.dragging)}finally{t.dragging=null}};function vE(t,e,n){if(!e.dataTransfer)return;let o=t.posAtCoords(Gi(e));if(!o)return;let r=t.state.doc.resolve(o.pos),i=n&&n.slice;i?t.someProp("transformPasted",h=>{i=h(i,t,!1)}):i=_p(t,Fp(e.dataTransfer),Dr?null:e.dataTransfer.getData("text/html"),!1,r);let s=!!(n&&Up(t,e));if(t.someProp("handleDrop",h=>h(t,e,i||ue.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?O0(t.state.doc,r.pos,i):r.pos;l==null&&(l=r.pos);let c=t.state.tr;if(s){let{node:h}=n;h?h.replace(c):c.deleteSelection()}let d=c.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=c.doc;if(u?c.replaceRangeWith(d,d,i.content.firstChild):c.replaceRange(d,d,i),c.doc.eq(f))return;let p=c.doc.resolve(d);if(u&&Ne.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new Ne(p));else{let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,b,g,x)=>h=x),c.setSelection(yl(t,p,c.doc.resolve(h)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}zt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&An(t)},20))},zt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},zt.beforeinput=(t,e)=>{if(ut&&zn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:o}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=o||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,wo(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in _t)zt[t]=_t[t];function Pr(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Ki{constructor(e,n){this.toDOM=e,this.spec=n||vo,this.side=this.spec.side||0}map(e,n,o,r){let{pos:i,deleted:s}=e.mapResult(n.from+r,this.side<0?-1:1);return s?null:new ln(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof Ki&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Pr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class no{constructor(e,n){this.attrs=e,this.spec=n||vo}map(e,n,o,r){let i=e.map(n.from+r,this.spec.inclusiveStart?-1:1)-o,s=e.map(n.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=s?null:new ln(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof no&&Pr(this.attrs,e.attrs)&&Pr(this.spec,e.spec)}static is(e){return e.type instanceof no}destroy(){}}class zl{constructor(e,n){this.attrs=e,this.spec=n||vo}map(e,n,o,r){let i=e.mapResult(n.from+r,1);if(i.deleted)return null;let s=e.mapResult(n.to+r,-1);return s.deleted||s.pos<=i.pos?null:new ln(i.pos-o,s.pos-o,this)}valid(e,n){let{index:o,offset:r}=e.content.findIndex(n.from),i;return r==n.from&&!(i=e.child(o)).isText&&r+i.nodeSize==n.to}eq(e){return this==e||e instanceof zl&&Pr(this.attrs,e.attrs)&&Pr(this.spec,e.spec)}destroy(){}}class ln{constructor(e,n,o){this.from=e,this.to=n,this.type=o}copy(e,n){return new ln(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,o){return this.type.map(e,this,n,o)}static widget(e,n,o){return new ln(e,e,new Ki(n,o))}static inline(e,n,o,r){return new ln(e,n,new no(o,r))}static node(e,n,o,r){return new ln(e,n,new zl(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof no}get widget(){return this.type instanceof Ki}}const Jo=[],vo={};class ft{constructor(e,n){this.local=e.length?e:Jo,this.children=n.length?n:Jo}static create(e,n){return n.length?Ji(n,e,0,vo):Et}find(e,n,o){let r=[];return this.findInner(e??0,n??1e9,r,0,o),r}findInner(e,n,o,r,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&o.push(l.copy(l.from+r,l.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,o,r+l,i)}}map(e,n,o){return this==Et||e.maps.length==0?this:this.mapInner(e,n,0,0,o||vo)}mapInner(e,n,o,r,i){let s;for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,o,r);c&&c.type.valid(n,c)?(s||(s=[])).push(c):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?TE(this.children,s||[],e,n,o,r,i):s?new ft(s.sort(To),Jo):Et}add(e,n){return n.length?this==Et?ft.create(e,n):this.addInner(e,n,0):this}addInner(e,n,o){let r,i=0;e.forEach((l,c)=>{let d=c+o,u;if(u=Wp(n,l,d)){for(r||(r=this.children.slice());i<r.length&&r[i]<c;)i+=3;r[i]==c?r[i+2]=r[i+2].addInner(l,u,d+1):r.splice(i,0,c,c+l.nodeSize,Ji(u,l,d+1,vo)),i+=3}});let s=Hp(i?Gp(n):n,-o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new ft(s.length?this.local.concat(s).sort(To):this.local,r||this.children)}remove(e){return e.length==0||this==Et?this:this.removeInner(e,0)}removeInner(e,n){let o=this.children,r=this.local;for(let i=0;i<o.length;i+=3){let s,l=o[i]+n,c=o[i+1]+n;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>l&&f.to<c&&(e[u]=null,(s||(s=[])).push(f));if(!s)continue;o==this.children&&(o=this.children.slice());let d=o[i+2].removeInner(s,l+1);d!=Et?o[i+2]=d:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<r.length;l++)r[l].eq(s,n)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new ft(r,o):Et}forChild(e,n){if(this==Et)return this;if(n.isLeaf)return ft.empty;let o,r;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let i=e+1,s=i+n.content.size;for(let l=0;l<this.local.length;l++){let c=this.local[l];if(c.from<s&&c.to>i&&c.type instanceof no){let d=Math.max(i,c.from)-i,u=Math.min(s,c.to)-i;d<u&&(r||(r=[])).push(c.copy(d,u))}}if(r){let l=new ft(r.sort(To),Jo);return o?new oo([l,o]):l}return o||Et}eq(e){if(this==e)return!0;if(!(e instanceof ft)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return _l(this.localsInner(e))}localsInner(e){if(this==Et)return Jo;if(e.inlineContent||!this.local.some(no.is))return this.local;let n=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof no||n.push(this.local[o]);return n}forEachSet(e){e(this)}}ft.empty=new ft([],[]),ft.removeOverlap=_l;const Et=ft.empty;class oo{constructor(e){this.members=e}map(e,n){const o=this.members.map(r=>r.map(e,n,vo));return oo.from(o)}forChild(e,n){if(n.isLeaf)return ft.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,n);i!=Et&&(i instanceof oo?o=o.concat(i.members):o.push(i))}return oo.from(o)}eq(e){if(!(e instanceof oo)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,o=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!n)n=i;else{o&&(n=n.slice(),o=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?_l(o?n:n.sort(To)):Jo}static from(e){switch(e.length){case 0:return Et;case 1:return e[0];default:return new oo(e.every(n=>n instanceof ft)?e:e.reduce((n,o)=>n.concat(o instanceof ft?o:o.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function TE(t,e,n,o,r,i,s){let l=t.slice();for(let d=0,u=i;d<n.maps.length;d++){let f=0;n.maps[d].forEach((p,h,m,b)=>{let g=b-m-(h-p);for(let x=0;x<l.length;x+=3){let v=l[x+1];if(v<0||p>v+u-f)continue;let w=l[x]+u-f;h>=w?l[x+1]=p<=w?-2:-1:p>=u&&g&&(l[x]+=g,l[x+1]+=g)}f+=g}),u=n.maps[d].map(u,-1)}let c=!1;for(let d=0;d<l.length;d+=3)if(l[d+1]<0){if(l[d+1]==-2){c=!0,l[d+1]=-1;continue}let u=n.map(t[d]+i),f=u-r;if(f<0||f>=o.content.size){c=!0;continue}let p=n.map(t[d+1]+i,-1),h=p-r,{index:m,offset:b}=o.content.findIndex(f),g=o.maybeChild(m);if(g&&b==f&&b+g.nodeSize==h){let x=l[d+2].mapInner(n,g,u+1,t[d]+i+1,s);x!=Et?(l[d]=f,l[d+1]=h,l[d+2]=x):(l[d+1]=-2,c=!0)}else c=!0}if(c){let d=zE(l,t,e,n,r,i,s),u=Ji(d,o,0,s);e=u.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,p=0;f<u.children.length;f+=3){let h=u.children[f];for(;p<l.length&&l[p]<h;)p+=3;l.splice(p,0,u.children[f],u.children[f+1],u.children[f+2])}}return new ft(e.sort(To),l)}function Hp(t,e){if(!e||!t.length)return t;let n=[];for(let o=0;o<t.length;o++){let r=t[o];n.push(new ln(r.from+e,r.to+e,r.type))}return n}function zE(t,e,n,o,r,i,s){function l(c,d){for(let u=0;u<c.local.length;u++){let f=c.local[u].map(o,r,d);f?n.push(f):s.onRemove&&s.onRemove(c.local[u].spec)}for(let u=0;u<c.children.length;u+=3)l(c.children[u+2],c.children[u]+d+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&l(t[c+2],e[c]+i+1);return n}function Wp(t,e,n){if(e.isLeaf)return null;let o=n+e.nodeSize,r=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<o&&((r||(r=[])).push(s),t[i]=null);return r}function Gp(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Ji(t,e,n,o){let r=[],i=!1;e.forEach((l,c)=>{let d=Wp(t,l,c+n);if(d){i=!0;let u=Ji(d,l,n+c+1,o);u!=Et&&r.push(c,c+l.nodeSize,u)}});let s=Hp(i?Gp(t):t,-n).sort(To);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(o.onRemove&&o.onRemove(s[l].spec),s.splice(l--,1));return s.length||r.length?new ft(s,r):Et}function To(t,e){return t.from-e.from||t.to-e.to}function _l(t){let e=t;for(let n=0;n<e.length-1;n++){let o=e[n];if(o.from!=o.to)for(let r=n+1;r<e.length;r++){let i=e[r];if(i.from==o.from){i.to!=o.to&&(e==t&&(e=t.slice()),e[r]=i.copy(i.from,o.to),qp(e,r+1,i.copy(o.to,i.to)));continue}else{i.from<o.to&&(e==t&&(e=t.slice()),e[n]=o.copy(o.from,i.from),qp(e,r,o.copy(i.from,o.to)));break}}}return e}function qp(t,e,n){for(;e<t.length&&To(n,t[e])>0;)e++;t.splice(e,0,n)}function Al(t){let e=[];return t.someProp("decorations",n=>{let o=n(t.state);o&&o!=Et&&e.push(o)}),t.cursorWrapper&&e.push(ft.create(t.state.doc,[t.cursorWrapper.deco])),oo.from(e)}const _E={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},AE=Dt&&Yn<=11;class ME{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 IE{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ME,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let r=0;r<o.length;r++)this.queue.push(o[r]);Dt&&Yn<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():mt&&e.composing&&o.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),AE&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.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,_E)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(kp(this.view)){if(this.suppressingSelectionUpdates)return An(this.view);if(Dt&&Yn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ko(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,o;for(let i=e.focusNode;i;i=Ho(i))n.add(i);for(let i=e.anchorNode;i;i=Ho(i))if(n.has(i)){o=i;break}let r=o&&this.view.docView.nearestDesc(o);if(r&&r.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let o=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&kp(e)&&!this.ignoreSelectionChange(o),i=-1,s=-1,l=!1,c=[];if(e.editable)for(let u=0;u<n.length;u++){let f=this.registerMutation(n[u],c);f&&(i=i<0?f.from:Math.min(f.from,i),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(l=!0))}if(Wt&&c.length){let u=c.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,p]=u;f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let p of u){let h=p.parentNode;h&&h.nodeName=="LI"&&(!f||RE(e,f)!=h)&&p.remove()}}}else if((ut||mt)&&c.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of c)if(u.nodeName=="BR"&&u.parentNode){let f=u.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&u.parentNode.removeChild(u)}}let d=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ji(o)&&(d=gl(e))&&d.eq(Pe.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,An(e),this.currentSelection.set(o),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,s),OE(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,PE(e,c)),this.handleDOMChange(i,s,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||An(e),this.currentSelection.set(o))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let f=e.addedNodes[u];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let r=e.previousSibling,i=e.nextSibling;if(Dt&&Yn<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:p}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(r=f),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(i=p)}let s=r&&r.parentNode==e.target?ht(r)+1:0,l=o.localPosFromDOM(e.target,s,-1),c=i&&i.parentNode==e.target?ht(i):e.target.childNodes.length,d=o.localPosFromDOM(e.target,c,1);return{from:l,to:d}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Kp=new WeakMap,Jp=!1;function OE(t){if(!Kp.has(t)&&(Kp.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Wt,Jp)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."),Jp=!0}}function Xp(t,e){let n=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return ko(s.node,s.offset,r,i)&&([n,o,r,i]=[r,i,n,o]),{anchorNode:n,anchorOffset:o,focusNode:r,focusOffset:i}}function DE(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return Xp(t,r)}let n;function o(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",o,!0),n?Xp(t,n):null}function RE(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let o=t.docView.nearestDesc(n,!0);if(o&&o.node.isBlock)return n}return null}function PE(t,e){var n;let{focusNode:o,focusOffset:r}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let c=l.firstChild;if(!c||c.nodeType!=1||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;l=c}l.insertBefore(i,l.firstChild),o==i&&t.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function LE(t,e,n){let{node:o,fromOffset:r,toOffset:i,from:s,to:l}=t.docView.parseRange(e,n),c=t.domSelectionRange(),d,u=c.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],ji(c)||d.push({node:c.focusNode,offset:c.focusOffset})),ut&&t.input.lastKeyCode===8)for(let g=i;g>r;g--){let x=o.childNodes[g-1],v=x.pmViewDesc;if(x.nodeName=="BR"&&!v){i=g;break}if(!v||v.size)break}let f=t.state.doc,p=t.someProp("domParser")||kr.fromSchema(t.state.schema),h=f.resolve(s),m=null,b=p.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:r,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:$E,context:h});if(d&&d[0].pos!=null){let g=d[0].pos,x=d[1]&&d[1].pos;x==null&&(x=g),m={anchor:g+s,head:x+s}}return{doc:b,sel:m,from:s,to:l}}function $E(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(mt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||mt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const VE=/^(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 BE(t,e,n,o,r){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let y=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,E=gl(t,y);if(E&&!t.state.selection.eq(E)){if(ut&&zn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",D=>D(t,wo(13,"Enter"))))return;let S=t.state.tr.setSelection(E);y=="pointer"?S.setMeta("pointer",!0):y=="key"&&S.scrollIntoView(),i&&S.setMeta("composition",i),t.dispatch(S)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let c=t.state.selection,d=LE(t,e,n),u=t.state.doc,f=u.slice(d.from,d.to),p,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(p=t.state.selection.to,h="end"):(p=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let m=UE(f.content,d.doc.content,d.from,p,h);if(m&&t.input.domChangeCount++,(Wo&&t.input.lastIOSEnter>Date.now()-225||zn)&&r.some(y=>y.nodeType==1&&!VE.test(y.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",y=>y(t,wo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(o&&c instanceof Oe&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let y=Yp(t,t.state.doc,d.sel);if(y&&!y.eq(t.state.selection)){let E=t.state.tr.setSelection(y);i&&E.setMeta("composition",i),t.dispatch(E)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof Oe&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=d.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=d.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),Dt&&Yn<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let b=d.doc.resolveNoCache(m.start-d.from),g=d.doc.resolveNoCache(m.endB-d.from),x=u.resolve(m.start),v=b.sameParent(g)&&b.parent.inlineContent&&x.end()>=m.endA;if((Wo&&t.input.lastIOSEnter>Date.now()-225&&(!v||r.some(y=>y.nodeName=="DIV"||y.nodeName=="P"))||!v&&b.pos<d.doc.content.size&&(!b.sameParent(g)||!b.parent.inlineContent)&&b.pos<g.pos&&!/\S/.test(d.doc.textBetween(b.pos,g.pos,"","")))&&t.someProp("handleKeyDown",y=>y(t,wo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&jE(u,m.start,m.endA,b,g)&&t.someProp("handleKeyDown",y=>y(t,wo(8,"Backspace")))){zn&&ut&&t.domObserver.suppressSelectionUpdates();return}ut&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),zn&&!v&&b.start()!=g.start()&&g.parentOffset==0&&b.depth==g.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,g=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{t.someProp("handleKeyDown",function(y){return y(t,wo(13,"Enter"))})},20));let w=m.start,T=m.endA,M=y=>{let E=y||t.state.tr.replace(w,T,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let S=Yp(t,E.doc,d.sel);S&&!(ut&&t.composing&&S.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(S.head==w||S.head==E.mapping.map(T)-1)||Dt&&S.empty&&S.head==w)&&E.setSelection(S)}return i&&E.setMeta("composition",i),E.scrollIntoView()},A;if(v)if(b.pos==g.pos){Dt&&Yn<=11&&b.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>An(t),20));let y=M(t.state.tr.delete(w,T)),E=u.resolve(m.start).marksAcross(u.resolve(m.endA));E&&y.ensureMarks(E),t.dispatch(y)}else if(m.endA==m.endB&&(A=FE(b.parent.content.cut(b.parentOffset,g.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start())))){let y=M(t.state.tr);A.type=="add"?y.addMark(w,T,A.mark):y.removeMark(w,T,A.mark),t.dispatch(y)}else if(b.parent.child(b.index()).isText&&b.index()==g.index()-(g.textOffset?0:1)){let y=b.parent.textBetween(b.parentOffset,g.parentOffset),E=()=>M(t.state.tr.insertText(y,w,T));t.someProp("handleTextInput",S=>S(t,w,T,y,E))||t.dispatch(E())}else t.dispatch(M());else t.dispatch(M())}function Yp(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:yl(t,e.resolve(n.anchor),e.resolve(n.head))}function FE(t,e){let n=t.firstChild.marks,o=e.firstChild.marks,r=n,i=o,s,l,c;for(let u=0;u<o.length;u++)r=o[u].removeFromSet(r);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(r.length==1&&i.length==0)l=r[0],s="add",c=u=>u.mark(l.addToSet(u.marks));else if(r.length==0&&i.length==1)l=i[0],s="remove",c=u=>u.mark(l.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(c(e.child(u)));if(ne.from(d).eq(t))return{mark:l,type:s}}function jE(t,e,n,o,r){if(n-e<=r.pos-o.pos||Ml(o,!0,!1)<r.pos)return!1;let i=t.resolve(e);if(!o.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(Ml(i,!0,!0));return!s.parent.isTextblock||s.pos>n||Ml(s,!0,!1)<n?!1:o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function Ml(t,e,n){let o=t.depth,r=e?t.end():t.pos;for(;o>0&&(e||t.indexAfter(o)==t.node(o).childCount);)o--,r++,e=!1;if(n){let i=t.node(o).maybeChild(t.indexAfter(o));for(;i&&!i.isLeaf;)i=i.firstChild,r++}return r}function UE(t,e,n,o,r){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(r=="end"){let c=Math.max(0,i-Math.min(s,l));o-=s+c-i}if(s<i&&t.size<e.size){let c=o<=i&&o>=s?i-o:0;i-=c,i&&i<e.size&&Qp(e.textBetween(i-1,i+1))&&(i+=c?1:-1),l=i+(l-s),s=i}else if(l<i){let c=o<=i&&o>=l?i-o:0;i-=c,i&&i<t.size&&Qp(t.textBetween(i-1,i+1))&&(i+=c?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function Qp(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Zp{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new iE,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(rh),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=nh(this),th(this),this.nodeViews=oh(this),this.docView=cp(this.state.doc,eh(this),Al(this),this.dom,this),this.domObserver=new IE(this,(o,r,i,s)=>BE(this,o,r,i,s)),this.domObserver.start(),sE(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Nl(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(rh),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let o in this._props)n[o]=this._props[o];n.state=this.state;for(let o in e)n[o]=e[o];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var o;let r=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(Bp(this),s=!0),this.state=e;let l=r.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=oh(this);WE(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Nl(this),this.editable=nh(this),th(this);let c=Al(this),d=eh(this),u=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,d,c);(f||!e.selection.eq(r.selection))&&(s=!0);let p=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Ex(this);if(s){this.domObserver.stop();let h=f&&(Dt||ut)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&HE(r.selection,e.selection);if(f){let m=ut?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=EE(this)),(i||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=cp(e.doc,d,c,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Hx(this))?An(this,h):(xp(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((o=this.dragging)===null||o===void 0)&&o.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():p&&kx(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Ne){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Xf(this,n.getBoundingClientRect(),e)}else Xf(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let o=this.directPlugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let o=this.state.plugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let o=this.pluginViews[n];o.update&&o.update(this,e)}}updateDraggedNode(e,n){let o=e.node,r=-1;if(this.state.doc.nodeAt(o.from)==o.node)r=o.from;else{let i=o.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==o.node&&(r=i)}this.dragging=new jp(e.slice,e.move,r<0?void 0:Ne.create(this.state.doc,r))}someProp(e,n){let o=this._props&&this._props[e],r;if(o!=null&&(r=n?n(o):o))return r;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(r=n?n(l):l))return r}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(r=n?n(l):l))return r}}hasFocus(){if(Dt){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&&wx(this.dom),An(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Tx(this,e)}coordsAtPos(e,n=1){return np(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,o=-1){let r=this.docView.posFromDOM(e,n,o);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,n){return Ix(this,n||this.state,e)}pasteHTML(e,n){return Rr(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Rr(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return kl(this,e)}destroy(){this.docView&&(aE(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Al(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,dx())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return cE(this,e)}domSelectionRange(){let e=this.domSelection();return e?mt&&this.root.nodeType===11&&mx(this.dom.ownerDocument)==this.dom&&DE(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Zp.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function eh(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let o in n)o=="class"?e.class+=" "+n[o]:o=="style"?e.style=(e.style?e.style+";":"")+n[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(n[o]))}),e.translate||(e.translate="no"),[ln.node(0,t.state.doc.content.size,e)]}function th(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:ln.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function nh(t){return!t.someProp("editable",e=>e(t.state)===!1)}function HE(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function oh(t){let e=Object.create(null);function n(o){for(let r in o)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=o[r])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function WE(t,e){let n=0,o=0;for(let r in t){if(t[r]!=e[r])return!0;n++}for(let r in e)o++;return n!=o}function rh(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var ro={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:"'"},Xi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},GE=typeof navigator<"u"&&/Mac/.test(navigator.platform),qE=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),gt=0;gt<10;gt++)ro[48+gt]=ro[96+gt]=String(gt);for(var gt=1;gt<=24;gt++)ro[gt+111]="F"+gt;for(var gt=65;gt<=90;gt++)ro[gt]=String.fromCharCode(gt+32),Xi[gt]=String.fromCharCode(gt);for(var Il in ro)Xi.hasOwnProperty(Il)||(Xi[Il]=ro[Il]);function KE(t){var e=GE&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||qE&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Xi:ro)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const JE=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),XE=typeof navigator<"u"&&/Win/.test(navigator.platform);function YE(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let o,r,i,s;for(let l=0;l<e.length-1;l++){let c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))JE?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+c)}return o&&(n="Alt-"+n),r&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function QE(t){let e=Object.create(null);for(let n in t)e[YE(n)]=t[n];return e}function Ol(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function ZE(t){return new Ot({props:{handleKeyDown:ek(t)}})}function ek(t){let e=QE(t);return function(n,o){let r=KE(o),i,s=e[Ol(r,o)];if(s&&s(n.state,n.dispatch,n))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[Ol(r,o,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(XE&&o.ctrlKey&&o.altKey)&&(i=ro[o.keyCode])&&i!=r){let l=e[Ol(i,o)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var tk=Object.defineProperty,Dl=(t,e)=>{for(var n in e)tk(t,n,{get:e[n],enumerable:!0})};function Yi(t){const{state:e,transaction:n}=t;let{selection:o}=n,{doc:r}=n,{storedMarks:i}=n;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 i},get selection(){return o},get doc(){return r},get tr(){return o=n.selection,r=n.doc,i=n.storedMarks,n}}}var Qi=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:o}=e,{tr:r}=n,i=this.buildProps(r);return Object.fromEntries(Object.entries(t).map(([s,l])=>[s,(...d)=>{const u=l(...d)(i);return!r.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(r),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:o,state:r}=this,{view:i}=o,s=[],l=!!t,c=t||r.tr,d=()=>(!l&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(c),s.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(n).map(([f,p])=>[f,(...m)=>{const b=this.buildProps(c,e),g=p(...m)(b);return s.push(g),u}])),run:d};return u}createCan(t){const{rawCommands:e,state:n}=this,o=!1,r=t||n.tr,i=this.buildProps(r,o);return{...Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...d)=>c(...d)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,o)}}buildProps(t,e=!0){const{rawCommands:n,editor:o,state:r}=this,{view:i}=o,s={tr:t,editor:o,view:i,state:Yi({state:r,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,c])=>[l,(...d)=>c(...d)(s)]))}};return s}},ih={};Dl(ih,{blur:()=>nk,clearContent:()=>ok,clearNodes:()=>rk,command:()=>ik,createParagraphNear:()=>sk,cut:()=>ak,deleteCurrentNode:()=>lk,deleteNode:()=>ck,deleteRange:()=>dk,deleteSelection:()=>uk,enter:()=>fk,exitCode:()=>pk,extendMarkRange:()=>hk,first:()=>mk,focus:()=>bk,forEach:()=>yk,insertContent:()=>xk,insertContentAt:()=>wk,joinBackward:()=>Ck,joinDown:()=>Nk,joinForward:()=>vk,joinItemBackward:()=>Tk,joinItemForward:()=>zk,joinTextblockBackward:()=>_k,joinTextblockForward:()=>Ak,joinUp:()=>Sk,keyboardShortcut:()=>Ik,lift:()=>Ok,liftEmptyBlock:()=>Dk,liftListItem:()=>Rk,newlineInCode:()=>Pk,resetAttributes:()=>Lk,scrollIntoView:()=>$k,selectAll:()=>Vk,selectNodeBackward:()=>Bk,selectNodeForward:()=>Fk,selectParentNode:()=>jk,selectTextblockEnd:()=>Uk,selectTextblockStart:()=>Hk,setContent:()=>Wk,setMark:()=>uw,setMeta:()=>fw,setNode:()=>pw,setNodeSelection:()=>hw,setTextDirection:()=>mw,setTextSelection:()=>gw,sinkListItem:()=>bw,splitBlock:()=>yw,splitListItem:()=>xw,toggleList:()=>Ew,toggleMark:()=>kw,toggleNode:()=>ww,toggleWrap:()=>Sw,undoInputRule:()=>Nw,unsetAllMarks:()=>Cw,unsetMark:()=>vw,unsetTextDirection:()=>Tw,updateAttributes:()=>zw,wrapIn:()=>_w,wrapInList:()=>Aw});var nk=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),ok=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),rk=()=>({state:t,tr:e,dispatch:n})=>{const{selection:o}=e,{ranges:r}=o;return n&&r.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(l,c)=>{if(l.type.isText)return;const{doc:d,mapping:u}=e,f=d.resolve(u.map(c)),p=d.resolve(u.map(c+l.nodeSize)),h=f.blockRange(p);if(!h)return;const m=$o(h);if(l.type.isTextblock){const{defaultType:b}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,b)}(m||m===0)&&e.lift(h,m)})}),!0},ik=t=>e=>t(e),sk=()=>({state:t,dispatch:e})=>Bf(t,e),ak=(t,e)=>({editor:n,tr:o})=>{const{state:r}=n,i=r.doc.slice(t.from,t.to);o.deleteRange(t.from,t.to);const s=o.mapping.map(e);return o.insert(s,i.content),o.setSelection(new Oe(o.doc.resolve(Math.max(s-1,0)))),!0},lk=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,o=n.$anchor.node();if(o.content.size>0)return!1;const r=t.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(e){const l=r.before(i),c=r.after(i);t.delete(l,c).scrollIntoView()}return!0}return!1};function ot(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var ck=t=>({tr:e,state:n,dispatch:o})=>{const r=ot(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r){if(o){const c=i.before(s),d=i.after(s);e.delete(c,d).scrollIntoView()}return!0}return!1},dk=t=>({tr:e,dispatch:n})=>{const{from:o,to:r}=t;return n&&e.delete(o,r),!0},uk=()=>({state:t,dispatch:e})=>ol(t,e),fk=()=>({commands:t})=>t.keyboardShortcut("Enter"),pk=()=>({state:t,dispatch:e})=>J0(t,e);function Rl(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Zi(t,e,n={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>n.strict?e[r]===t[r]:Rl(e[r])?e[r].test(t[r]):e[r]===t[r]):!0}function sh(t,e,n={}){return t.find(o=>o.type===e&&Zi(Object.fromEntries(Object.keys(n).map(r=>[r,o.attrs[r]])),n))}function ah(t,e,n={}){return!!sh(t,e,n)}function Pl(t,e,n){var o;if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===e)||(n=n||((o=r.node.marks[0])==null?void 0:o.attrs),!sh([...r.node.marks],e,n)))return;let s=r.index,l=t.start()+r.offset,c=s+1,d=l+r.node.nodeSize;for(;s>0&&ah([...t.parent.child(s-1).marks],e,n);)s-=1,l-=t.parent.child(s).nodeSize;for(;c<t.parent.childCount&&ah([...t.parent.child(c).marks],e,n);)d+=t.parent.child(c).nodeSize,c+=1;return{from:l,to:d}}function Mn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var hk=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const i=Mn(t,o.schema),{doc:s,selection:l}=n,{$from:c,from:d,to:u}=l;if(r){const f=Pl(c,i,e);if(f&&f.from<=d&&f.to>=u){const p=Oe.create(s,f.from,f.to);n.setSelection(p)}}return!0},mk=t=>e=>{const n=typeof t=="function"?t(e):t;for(let o=0;o<n.length;o+=1)if(n[o](e))return!0;return!1};function lh(t){return t instanceof Oe}function zo(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function ch(t,e=null){if(!e)return null;const n=Pe.atStart(t),o=Pe.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return o;const r=n.from,i=o.to;return e==="all"?Oe.create(t,zo(0,r,i),zo(t.content.size,r,i)):Oe.create(t,zo(e,r,i),zo(e,r,i))}function dh(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function es(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function gk(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var bk=(t=null,e={})=>({editor:n,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(es()||dh())&&o.dom.focus(),gk()&&!es()&&!dh()&&o.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(o.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(o.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!lh(n.state.selection))return s(),!0;const l=ch(r.doc,t)||n.state.selection,c=n.state.selection.eq(l);return i&&(c||r.setSelection(l),c&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},yk=(t,e)=>n=>t.every((o,r)=>e(o,{...n,index:r})),xk=(t,e)=>({tr:n,commands:o})=>o.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),uh=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const o=e[n];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?t.removeChild(o):o.nodeType===1&&uh(o)}return t};function ts(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return uh(n)}function Lr(t,e,n){if(t instanceof Gn||t instanceof ne)return t;n={slice:!0,parseOptions:{},...n};const o=typeof t=="object"&&t!==null,r=typeof t=="string";if(o)try{if(Array.isArray(t)&&t.length>0)return ne.fromArray(t.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),Lr("",e,n)}if(r){if(n.errorOnInvalidContent){let s=!1,l="";const c=new Qu({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=>(s=!0,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(n.slice?kr.fromSchema(c).parseSlice(ts(t),n.parseOptions):kr.fromSchema(c).parse(ts(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=kr.fromSchema(e);return n.slice?i.parseSlice(ts(t),n.parseOptions).content:i.parse(ts(t),n.parseOptions)}return Lr("",e,n)}function Ek(t,e,n){const o=t.steps.length-1;if(o<e)return;const r=t.steps[o];if(!(r instanceof ct||r instanceof dt))return;const i=t.mapping.maps[o];let s=0;i.forEach((l,c,d,u)=>{s===0&&(s=u)}),t.setSelection(Pe.near(t.doc.resolve(s),n))}var kk=t=>!("type"in t),wk=(t,e,n)=>({tr:o,dispatch:r,editor:i})=>{var s;if(r){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const c=g=>{i.emit("contentError",{editor:i,error:g,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Lr(e,i.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(g){c(g)}try{l=Lr(e,i.schema,{parseOptions:d,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(g){return c(g),!1}let{from:u,to:f}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},p=!0,h=!0;if((kk(l)?l:[l]).forEach(g=>{g.check(),p=p?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),u===f&&h){const{parent:g}=o.doc.resolve(u);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(u-=1,f+=1)}let b;if(p){if(Array.isArray(e))b=e.map(g=>g.text||"").join("");else if(e instanceof ne){let g="";e.forEach(x=>{x.text&&(g+=x.text)}),b=g}else typeof e=="object"&&e&&e.text?b=e.text:b=e;o.insertText(b,u,f)}else{b=l;const g=o.doc.resolve(u),x=g.node(),v=g.parentOffset===0,w=x.isText||x.isTextblock,T=x.content.size>0;v&&w&&T&&(u=Math.max(0,u-1)),o.replaceWith(u,f,b)}n.updateSelection&&Ek(o,o.steps.length-1,-1),n.applyInputRules&&o.setMeta("applyInputRules",{from:u,text:b}),n.applyPasteRules&&o.setMeta("applyPasteRules",{from:u,text:b})}return!0},Sk=()=>({state:t,dispatch:e})=>G0(t,e),Nk=()=>({state:t,dispatch:e})=>q0(t,e),Ck=()=>({state:t,dispatch:e})=>Of(t,e),vk=()=>({state:t,dispatch:e})=>Lf(t,e),Tk=()=>({state:t,dispatch:e,tr:n})=>{try{const o=$i(t.doc,t.selection.$from.pos,-1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},zk=()=>({state:t,dispatch:e,tr:n})=>{try{const o=$i(t.doc,t.selection.$from.pos,1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},_k=()=>({state:t,dispatch:e})=>H0(t,e),Ak=()=>({state:t,dispatch:e})=>W0(t,e);function fh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Mk(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let o,r,i,s;for(let l=0;l<e.length-1;l+=1){const c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))es()||fh()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return o&&(n=`Alt-${n}`),r&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var Ik=t=>({editor:e,view:n,tr:o,dispatch:r})=>{const i=Mk(t).split(/-(?!$)/),s=i.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{n.someProp("handleKeyDown",d=>d(n,l))});return c?.steps.forEach(d=>{const u=d.map(o.mapping);u&&r&&o.maybeStep(u)}),!0};function io(t,e,n={}){const{from:o,to:r,empty:i}=t.selection,s=e?ot(e,t.schema):null,l=[];t.doc.nodesBetween(o,r,(f,p)=>{if(f.isText)return;const h=Math.max(o,p),m=Math.min(r,p+f.nodeSize);l.push({node:f,from:h,to:m})});const c=r-o,d=l.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>Zi(f.node.attrs,n,{strict:!1}));return i?!!d.length:d.reduce((f,p)=>f+p.to-p.from,0)>=c}var Ok=(t,e={})=>({state:n,dispatch:o})=>{const r=ot(t,n.schema);return io(n,r,e)?K0(n,o):!1},Dk=()=>({state:t,dispatch:e})=>Ff(t,e),Rk=t=>({state:e,dispatch:n})=>{const o=ot(t,e.schema);return sx(o)(e,n)},Pk=()=>({state:t,dispatch:e})=>Vf(t,e);function ns(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ph(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((o,r)=>(n.includes(r)||(o[r]=t[r]),o),{})}var Lk=(t,e)=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const l=ns(typeof t=="string"?t:t.name,o.schema);if(!l)return!1;l==="node"&&(i=ot(t,o.schema)),l==="mark"&&(s=Mn(t,o.schema));let c=!1;return n.selection.ranges.forEach(d=>{o.doc.nodesBetween(d.$from.pos,d.$to.pos,(u,f)=>{i&&i===u.type&&(c=!0,r&&n.setNodeMarkup(f,void 0,ph(u.attrs,e))),s&&u.marks.length&&u.marks.forEach(p=>{s===p.type&&(c=!0,r&&n.addMark(f,f+u.nodeSize,s.create(ph(p.attrs,e))))})})}),c},$k=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Vk=()=>({tr:t,dispatch:e})=>{if(e){const n=new Bt(t.doc);t.setSelection(n)}return!0},Bk=()=>({state:t,dispatch:e})=>Rf(t,e),Fk=()=>({state:t,dispatch:e})=>$f(t,e),jk=()=>({state:t,dispatch:e})=>Q0(t,e),Uk=()=>({state:t,dispatch:e})=>tx(t,e),Hk=()=>({state:t,dispatch:e})=>ex(t,e);function Ll(t,e,n={},o={}){return Lr(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:o.errorOnInvalidContent})}var Wk=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:o={}}={})=>({editor:r,tr:i,dispatch:s,commands:l})=>{const{doc:c}=i;if(o.preserveWhitespace!=="full"){const d=Ll(t,r.schema,o,{errorOnInvalidContent:e??r.options.enableContentCheck});return s&&i.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:c.content.size},t,{parseOptions:o,errorOnInvalidContent:e??r.options.enableContentCheck})};function hh(t,e){const n=Mn(e,t.schema),{from:o,to:r,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(o,r,c=>{s.push(...c.marks)});const l=s.find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function mh(t,e){const n=new Sf(t);return e.forEach(o=>{o.steps.forEach(r=>{n.step(r)})}),n}function Gk(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function qk(t,e,n){const o=[];return t.nodesBetween(e.from,e.to,(r,i)=>{n(r)&&o.push({node:r,pos:i})}),o}function Kk(t,e){for(let n=t.depth;n>0;n-=1){const o=t.node(n);if(e(o))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:o}}}function rs(t){return e=>Kk(e.$from,t)}function ye(t,e,n){return t.config[e]===void 0&&t.parent?ye(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?ye(t.parent,e,n):null}):t.config[e]}function $l(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},o=ye(e,"addExtensions",n);return o?[e,...$l(o())]:e}).flat(10)}function Vl(t,e){const n=xo.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function gh(t){return typeof t=="function"}function Ue(t,e=void 0,...n){return gh(t)?e?t.bind(e)(...n):t(...n):t}function Jk(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Xo(t){const e=t.filter(r=>r.type==="extension"),n=t.filter(r=>r.type==="node"),o=t.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:o}}function bh(t){const e=[],{nodeExtensions:n,markExtensions:o}=Xo(t),r=[...n,...o],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage,extensions:r},c=ye(s,"addGlobalAttributes",l);if(!c)return;c().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([p,h])=>{e.push({type:f,name:p,attribute:{...i,...h}})})})})}),r.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},c=ye(s,"addAttributes",l);if(!c)return;const d=c();Object.entries(d).forEach(([u,f])=>{const p={...i,...f};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:s.name,name:u,attribute:p})})}),e}function Rt(...t){return t.filter(e=>!!e).reduce((e,n)=>{const o={...e};return Object.entries(n).forEach(([r,i])=>{if(!o[r]){o[r]=i;return}if(r==="class"){const l=i?String(i).split(" "):[],c=o[r]?o[r].split(" "):[],d=l.filter(u=>!c.includes(u));o[r]=[...c,...d].join(" ")}else if(r==="style"){const l=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],c=o[r]?o[r].split(";").map(u=>u.trim()).filter(Boolean):[],d=new Map;c.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),l.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),o[r]=Array.from(d.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else o[r]=i}),o},{})}function $r(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,o)=>Rt(n,o),{})}function Xk(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function yh(t,e){return"style"in t?t:{...t,getAttrs:n=>{const o=t.getAttrs?t.getAttrs(n):t.attrs;if(o===!1)return!1;const r=e.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(n):Xk(n.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...o,...r}}}}function xh(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Jk(n)?!1:n!=null))}function Eh(t){var e,n;const o={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(o.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(o.validate=t.attribute.validate),[t.name,o]}function Yk(t,e){var n;const o=bh(t),{nodeExtensions:r,markExtensions:i}=Xo(t),s=(n=r.find(d=>ye(d,"topNode")))==null?void 0:n.name,l=Object.fromEntries(r.map(d=>{const u=o.filter(x=>x.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=t.reduce((x,v)=>{const w=ye(v,"extendNodeSchema",f);return{...x,...w?w(d):{}}},{}),h=xh({...p,content:Ue(ye(d,"content",f)),marks:Ue(ye(d,"marks",f)),group:Ue(ye(d,"group",f)),inline:Ue(ye(d,"inline",f)),atom:Ue(ye(d,"atom",f)),selectable:Ue(ye(d,"selectable",f)),draggable:Ue(ye(d,"draggable",f)),code:Ue(ye(d,"code",f)),whitespace:Ue(ye(d,"whitespace",f)),linebreakReplacement:Ue(ye(d,"linebreakReplacement",f)),defining:Ue(ye(d,"defining",f)),isolating:Ue(ye(d,"isolating",f)),attrs:Object.fromEntries(u.map(Eh))}),m=Ue(ye(d,"parseHTML",f));m&&(h.parseDOM=m.map(x=>yh(x,u)));const b=ye(d,"renderHTML",f);b&&(h.toDOM=x=>b({node:x,HTMLAttributes:$r(x,u)}));const g=ye(d,"renderText",f);return g&&(h.toText=g),[d.name,h]})),c=Object.fromEntries(i.map(d=>{const u=o.filter(g=>g.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=t.reduce((g,x)=>{const v=ye(x,"extendMarkSchema",f);return{...g,...v?v(d):{}}},{}),h=xh({...p,inclusive:Ue(ye(d,"inclusive",f)),excludes:Ue(ye(d,"excludes",f)),group:Ue(ye(d,"group",f)),spanning:Ue(ye(d,"spanning",f)),code:Ue(ye(d,"code",f)),attrs:Object.fromEntries(u.map(Eh))}),m=Ue(ye(d,"parseHTML",f));m&&(h.parseDOM=m.map(g=>yh(g,u)));const b=ye(d,"renderHTML",f);return b&&(h.toDOM=g=>b({mark:g,HTMLAttributes:$r(g,u)})),[d.name,h]}));return new Qu({topNode:s,nodes:l,marks:c})}function Qk(t){const e=t.filter((n,o)=>t.indexOf(n)!==o);return Array.from(new Set(e))}function is(t){return t.sort((n,o)=>{const r=ye(n,"priority")||100,i=ye(o,"priority")||100;return r>i?-1:r<i?1:0})}function kh(t){const e=is($l(t)),n=Qk(e.map(o=>o.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),e}function wh(t,e,n){const{from:o,to:r}=e,{blockSeparator:i=`
356
+ `);return{dom:c,text:p,slice:e}}function _p(t,e,n,o,r){let i=r.parent.type.spec.code,s,l;if(!n&&!e)return null;let c=!!e&&(o||i||!n);if(c){if(t.someProp("transformPastedText",p=>{e=p(e,i||o,t)}),i)return l=new fe(oe.from(t.state.schema.text(e.replace(/\r\n?/g,`
357
+ `))),0,0),t.someProp("transformPasted",p=>{l=p(l,t,!0)}),l;let f=t.someProp("clipboardTextParser",p=>p(e,r,o,t));if(f)l=f;else{let p=r.marks(),{schema:h}=t.state,m=xo.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(b=>{let g=s.appendChild(document.createElement("p"));b&&g.appendChild(m.serializeNode(h.text(b,p)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),s=tE(n),_r&&nE(s);let d=s&&s.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let f=+u[3];f>0;f--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(l||(l=(t.someProp("clipboardParser")||t.someProp("domParser")||kr.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(c||u),context:r,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!Qx.test(p.parentNode.nodeName)?{ignore:!0}:null}})),u)l=oE(Op(l,+u[1],+u[2]),u[4]);else if(l=fe.maxOpen(Zx(l.content,r),!0),l.openStart||l.openEnd){let f=0,p=0;for(let h=l.content.firstChild;f<l.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=l.content.lastChild;p<l.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);l=Op(l,f,p)}return t.someProp("transformPasted",f=>{l=f(l,t,c)}),l}const Qx=/^(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 Zx(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(l=>{if(!s)return;let c=r.findWrapping(l.type),d;if(!c)return s=null;if(d=s.length&&i.length&&Mp(c,i,l,s[s.length-1],0))s[s.length-1]=d;else{s.length&&(s[s.length-1]=Ip(s[s.length-1],i.length));let u=Ap(l,c);s.push(u),r=r.matchType(u.type),i=c}}),s)return oe.from(s)}return t}function Ap(t,e,n=0){for(let o=e.length-1;o>=n;o--)t=e[o].create(null,oe.from(t));return t}function Mp(t,e,n,o,r){if(r<t.length&&r<e.length&&t[r]==e[r]){let i=Mp(t,e,n,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==t.length-1?n.type:t[r+1]))return o.copy(o.content.append(oe.from(Ap(n,t,r+1))))}}function Ip(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Ip(t.lastChild,e-1)),o=t.contentMatchAt(t.childCount).fillBefore(oe.empty,!0);return t.copy(n.append(o))}function wl(t,e,n,o,r,i){let s=e<0?t.firstChild:t.lastChild,l=s.content;return t.childCount>1&&(i=0),r<o-1&&(l=wl(l,e,n,o,r+1,i)),r>=n&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(oe.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(l))}function Op(t,e,n){return e<t.openStart&&(t=new fe(wl(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new fe(wl(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const Dp={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Rp=null;function Pp(){return Rp||(Rp=document.implementation.createHTMLDocument("title"))}let Sl=null;function eE(t){let e=window.trustedTypes;return e?(Sl||(Sl=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),Sl.createHTML(t)):t}function tE(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Pp().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(t),r;if((r=o&&Dp[o[1].toLowerCase()])&&(t=r.map(i=>"<"+i+">").join("")+t+r.map(i=>"</"+i+">").reverse().join("")),n.innerHTML=eE(t),r)for(let i=0;i<r.length;i++)n=n.querySelector(r[i])||n;return n}function nE(t){let e=t.querySelectorAll(ut?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let o=e[n];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),o)}}function oE(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return t}let{content:r,openStart:i,openEnd:s}=t;for(let l=o.length-2;l>=0;l-=2){let c=n.nodes[o[l]];if(!c||c.hasRequiredAttrs())break;r=oe.from(c.create(o[l+1],r)),i++,s++}return new fe(r,i,s)}const zt={},_t={},rE={touchstart:!0,touchmove:!0};class iE{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 sE(t){for(let e in zt){let n=zt[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=o=>{lE(t,o)&&!Cl(t,o)&&(t.editable||!(o.type in _t))&&n(t,o)},rE[e]?{passive:!0}:void 0)}mt&&t.dom.addEventListener("input",()=>null),Nl(t)}function to(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function aE(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function Nl(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=o=>Cl(t,o))})}function Cl(t,e){return t.someProp("handleDOMEvents",n=>{let o=n[e.type];return o?o(t,e)||e.defaultPrevented:!1})}function lE(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function cE(t,e){!Cl(t,e)&&zt[e.type]&&(t.editable||!(e.type in _t))&&zt[e.type](t,e)}_t.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!$p(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(zn&&ut&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Wo&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let o=Date.now();t.input.lastIOSEnter=o,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==o&&(t.someProp("handleKeyDown",r=>r(t,wo(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",o=>o(t,n))||Yx(t,n)?n.preventDefault():to(t,"key")},_t.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)},_t.keypress=(t,e)=>{let n=e;if($p(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Gt&&n.metaKey)return;if(t.someProp("handleKeyPress",r=>r(t,n))){n.preventDefault();return}let o=t.state.selection;if(!(o instanceof Oe)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(n.charCode),i=()=>t.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!t.someProp("handleTextInput",s=>s(t,o.$from.pos,o.$to.pos,r,i))&&t.dispatch(i()),n.preventDefault()}};function Gi(t){return{left:t.clientX,top:t.clientY}}function dE(t,e){let n=e.x-t.clientX,o=e.y-t.clientY;return n*n+o*o<100}function vl(t,e,n,o,r){if(o==-1)return!1;let i=t.state.doc.resolve(o);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,l=>s>i.depth?l(t,n,i.nodeAfter,i.before(s),r,!0):l(t,n,i.node(s),i.before(s),r,!1)))return!0;return!1}function Ko(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let o=t.state.tr.setSelection(e);o.setMeta("pointer",!0),t.dispatch(o)}function uE(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),o=n.nodeAfter;return o&&o.isAtom&&Ce.isSelectable(o)?(Ko(t,new Ce(n)),!0):!1}function fE(t,e){if(e==-1)return!1;let n=t.state.selection,o,r;n instanceof Ce&&(o=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(Ce.isSelectable(l)){o&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?r=i.before(n.$from.depth):r=i.before(s);break}}return r!=null?(Ko(t,Ce.create(t.state.doc,r)),!0):!1}function pE(t,e,n,o,r){return vl(t,"handleClickOn",e,n,o)||t.someProp("handleClick",i=>i(t,e,o))||(r?fE(t,n):uE(t,n))}function hE(t,e,n,o){return vl(t,"handleDoubleClickOn",e,n,o)||t.someProp("handleDoubleClick",r=>r(t,e,o))}function mE(t,e,n,o){return vl(t,"handleTripleClickOn",e,n,o)||t.someProp("handleTripleClick",r=>r(t,e,o))||gE(t,n,o)}function gE(t,e,n){if(n.button!=0)return!1;let o=t.state.doc;if(e==-1)return o.inlineContent?(Ko(t,Oe.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let s=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(s.inlineContent)Ko(t,Oe.create(o,l+1,l+1+s.content.size));else if(Ce.isSelectable(s))Ko(t,Ce.create(o,l));else continue;return!0}}function Tl(t){return qi(t)}const Lp=Gt?"metaKey":"ctrlKey";zt.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let o=Tl(t),r=Date.now(),i="singleClick";r-t.input.lastClick.time<500&&dE(n,t.input.lastClick)&&!n[Lp]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:r,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=t.posAtCoords(Gi(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new bE(t,s,n,!!o)):(i=="doubleClick"?hE:mE)(t,s.pos,s.inside,n)?n.preventDefault():to(t,"pointer"))};class bE{constructor(e,n,o,r){this.view=e,this.pos=n,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[Lp],this.allowDefault=o.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let u=e.state.doc.resolve(n.pos);i=u.parent,s=u.depth?u.before():0}const l=r?null:o.target,c=l?e.docView.nearestDesc(l,!0):null;this.target=c&&c.nodeDOM.nodeType==1?c.nodeDOM:null;let{selection:d}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||d instanceof Ce&&d.from<=s&&d.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Wt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),to(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>An(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Gi(e))),this.updateAllowDefault(e),this.allowDefault||!n?to(this.view,"pointer"):pE(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||mt&&this.mightDrag&&!this.mightDrag.node.isAtom||ut&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(Ko(this.view,Le.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):to(this.view,"pointer")}move(e){this.updateAllowDefault(e),to(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}zt.touchstart=t=>{t.input.lastTouch=Date.now(),Tl(t),to(t,"pointer")},zt.touchmove=t=>{t.input.lastTouch=Date.now(),to(t,"pointer")},zt.contextmenu=t=>Tl(t);function $p(t,e){return t.composing?!0:mt&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const yE=zn?5e3:-1;_t.compositionstart=_t.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Oe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||ut&&Jf&&xE(t)))t.markCursor=t.state.storedMarks||n.marks(),qi(t,!0),t.markCursor=null;else if(qi(t,!e.selection.empty),Wt&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let o=t.domSelectionRange();for(let r=o.focusNode,i=o.focusOffset;r&&r.nodeType==1&&i!=0;){let s=i<0?r.lastChild:r.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=t.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else r=s,i=-1}}t.input.composing=!0}Vp(t,yE)};function xE(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let o=e.childNodes[n];return o.nodeType==1&&o.contentEditable=="false"}_t.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.badSafariComposition?t.domObserver.forceFlush():t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,Vp(t,20))};function Vp(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>qi(t),e))}function Bp(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=kE());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function EE(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=fx(e.focusNode,e.focusOffset),o=px(e.focusNode,e.focusOffset);if(n&&o&&n!=o){let r=o.pmViewDesc,i=t.domObserver.lastChangedTextNode;if(n==i||o==i)return i;if(!r||!r.isText(o.nodeValue))return o;if(t.input.compositionNode==o){let s=n.pmViewDesc;if(!(!s||!s.isText(n.nodeValue)))return o}}return n||o}function kE(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function qi(t,e=!1){if(!(zn&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Bp(t),e||t.docView&&t.docView.dirty){let n=gl(t),o=t.state.selection;return n&&!n.eq(o)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function wE(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const Dr=Dt&&Yn<15||Wo&&bx<604;zt.copy=_t.cut=(t,e)=>{let n=e,o=t.state.selection,r=n.type=="cut";if(o.empty)return;let i=Dr?null:n.clipboardData,s=o.content(),{dom:l,text:c}=kl(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",c)):wE(t,l),r&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function SE(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function NE(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,o=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),o.parentNode&&o.parentNode.removeChild(o),n?Rr(t,o.value,null,r,e):Rr(t,o.textContent,o.innerHTML,r,e)},50)}function Rr(t,e,n,o,r){let i=_p(t,e,n,o,t.state.selection.$from);if(t.someProp("handlePaste",c=>c(t,r,i||fe.empty)))return!0;if(!i)return!1;let s=SE(i),l=s?t.state.tr.replaceSelectionWith(s,o):t.state.tr.replaceSelection(i);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Fp(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}_t.paste=(t,e)=>{let n=e;if(t.composing&&!zn)return;let o=Dr?null:n.clipboardData,r=t.input.shiftKey&&t.input.lastKeyCode!=45;o&&Rr(t,Fp(o),o.getData("text/html"),r,n)?n.preventDefault():NE(t,n)};class jp{constructor(e,n,o){this.slice=e,this.move=n,this.node=o}}const CE=Gt?"altKey":"ctrlKey";function Up(t,e){let n=t.someProp("dragCopies",o=>!o(e));return n??!e[CE]}zt.dragstart=(t,e)=>{let n=e,o=t.input.mouseDown;if(o&&o.done(),!n.dataTransfer)return;let r=t.state.selection,i=r.empty?null:t.posAtCoords(Gi(n)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof Ce?r.to-1:r.to))){if(o&&o.mightDrag)s=Ce.create(t.state.doc,o.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=t.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=t.docView&&(s=Ce.create(t.state.doc,f.posBefore))}}let l=(s||t.state.selection).content(),{dom:c,text:d,slice:u}=kl(t,l);(!n.dataTransfer.files.length||!ut||Kf>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Dr?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Dr||n.dataTransfer.setData("text/plain",d),t.dragging=new jp(u,Up(t,n),s)},zt.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)},_t.dragover=_t.dragenter=(t,e)=>e.preventDefault(),_t.drop=(t,e)=>{try{vE(t,e,t.dragging)}finally{t.dragging=null}};function vE(t,e,n){if(!e.dataTransfer)return;let o=t.posAtCoords(Gi(e));if(!o)return;let r=t.state.doc.resolve(o.pos),i=n&&n.slice;i?t.someProp("transformPasted",h=>{i=h(i,t,!1)}):i=_p(t,Fp(e.dataTransfer),Dr?null:e.dataTransfer.getData("text/html"),!1,r);let s=!!(n&&Up(t,e));if(t.someProp("handleDrop",h=>h(t,e,i||fe.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?O0(t.state.doc,r.pos,i):r.pos;l==null&&(l=r.pos);let c=t.state.tr;if(s){let{node:h}=n;h?h.replace(c):c.deleteSelection()}let d=c.mapping.map(l),u=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=c.doc;if(u?c.replaceRangeWith(d,d,i.content.firstChild):c.replaceRange(d,d,i),c.doc.eq(f))return;let p=c.doc.resolve(d);if(u&&Ce.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))c.setSelection(new Ce(p));else{let h=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((m,b,g,x)=>h=x),c.setSelection(yl(t,p,c.doc.resolve(h)))}t.focus(),t.dispatch(c.setMeta("uiEvent","drop"))}zt.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&An(t)},20))},zt.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},zt.beforeinput=(t,e)=>{if(ut&&zn&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:o}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=o||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,wo(8,"Backspace")))))return;let{$cursor:r}=t.state.selection;r&&r.pos>0&&t.dispatch(t.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let t in _t)zt[t]=_t[t];function Pr(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Ki{constructor(e,n){this.toDOM=e,this.spec=n||vo,this.side=this.spec.side||0}map(e,n,o,r){let{pos:i,deleted:s}=e.mapResult(n.from+r,this.side<0?-1:1);return s?null:new ln(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof Ki&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Pr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class no{constructor(e,n){this.attrs=e,this.spec=n||vo}map(e,n,o,r){let i=e.map(n.from+r,this.spec.inclusiveStart?-1:1)-o,s=e.map(n.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=s?null:new ln(i,s,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof no&&Pr(this.attrs,e.attrs)&&Pr(this.spec,e.spec)}static is(e){return e.type instanceof no}destroy(){}}class zl{constructor(e,n){this.attrs=e,this.spec=n||vo}map(e,n,o,r){let i=e.mapResult(n.from+r,1);if(i.deleted)return null;let s=e.mapResult(n.to+r,-1);return s.deleted||s.pos<=i.pos?null:new ln(i.pos-o,s.pos-o,this)}valid(e,n){let{index:o,offset:r}=e.content.findIndex(n.from),i;return r==n.from&&!(i=e.child(o)).isText&&r+i.nodeSize==n.to}eq(e){return this==e||e instanceof zl&&Pr(this.attrs,e.attrs)&&Pr(this.spec,e.spec)}destroy(){}}class ln{constructor(e,n,o){this.from=e,this.to=n,this.type=o}copy(e,n){return new ln(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,o){return this.type.map(e,this,n,o)}static widget(e,n,o){return new ln(e,e,new Ki(n,o))}static inline(e,n,o,r){return new ln(e,n,new no(o,r))}static node(e,n,o,r){return new ln(e,n,new zl(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof no}get widget(){return this.type instanceof Ki}}const Jo=[],vo={};class ft{constructor(e,n){this.local=e.length?e:Jo,this.children=n.length?n:Jo}static create(e,n){return n.length?Ji(n,e,0,vo):Et}find(e,n,o){let r=[];return this.findInner(e??0,n??1e9,r,0,o),r}findInner(e,n,o,r,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=n&&l.to>=e&&(!i||i(l.spec))&&o.push(l.copy(l.from+r,l.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<n&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,n-l,o,r+l,i)}}map(e,n,o){return this==Et||e.maps.length==0?this:this.mapInner(e,n,0,0,o||vo)}mapInner(e,n,o,r,i){let s;for(let l=0;l<this.local.length;l++){let c=this.local[l].map(e,o,r);c&&c.type.valid(n,c)?(s||(s=[])).push(c):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?TE(this.children,s||[],e,n,o,r,i):s?new ft(s.sort(To),Jo):Et}add(e,n){return n.length?this==Et?ft.create(e,n):this.addInner(e,n,0):this}addInner(e,n,o){let r,i=0;e.forEach((l,c)=>{let d=c+o,u;if(u=Wp(n,l,d)){for(r||(r=this.children.slice());i<r.length&&r[i]<c;)i+=3;r[i]==c?r[i+2]=r[i+2].addInner(l,u,d+1):r.splice(i,0,c,c+l.nodeSize,Ji(u,l,d+1,vo)),i+=3}});let s=Hp(i?Gp(n):n,-o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new ft(s.length?this.local.concat(s).sort(To):this.local,r||this.children)}remove(e){return e.length==0||this==Et?this:this.removeInner(e,0)}removeInner(e,n){let o=this.children,r=this.local;for(let i=0;i<o.length;i+=3){let s,l=o[i]+n,c=o[i+1]+n;for(let u=0,f;u<e.length;u++)(f=e[u])&&f.from>l&&f.to<c&&(e[u]=null,(s||(s=[])).push(f));if(!s)continue;o==this.children&&(o=this.children.slice());let d=o[i+2].removeInner(s,l+1);d!=Et?o[i+2]=d:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<r.length;l++)r[l].eq(s,n)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new ft(r,o):Et}forChild(e,n){if(this==Et)return this;if(n.isLeaf)return ft.empty;let o,r;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let i=e+1,s=i+n.content.size;for(let l=0;l<this.local.length;l++){let c=this.local[l];if(c.from<s&&c.to>i&&c.type instanceof no){let d=Math.max(i,c.from)-i,u=Math.min(s,c.to)-i;d<u&&(r||(r=[])).push(c.copy(d,u))}}if(r){let l=new ft(r.sort(To),Jo);return o?new oo([l,o]):l}return o||Et}eq(e){if(this==e)return!0;if(!(e instanceof ft)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return _l(this.localsInner(e))}localsInner(e){if(this==Et)return Jo;if(e.inlineContent||!this.local.some(no.is))return this.local;let n=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof no||n.push(this.local[o]);return n}forEachSet(e){e(this)}}ft.empty=new ft([],[]),ft.removeOverlap=_l;const Et=ft.empty;class oo{constructor(e){this.members=e}map(e,n){const o=this.members.map(r=>r.map(e,n,vo));return oo.from(o)}forChild(e,n){if(n.isLeaf)return ft.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,n);i!=Et&&(i instanceof oo?o=o.concat(i.members):o.push(i))}return oo.from(o)}eq(e){if(!(e instanceof oo)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,o=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!n)n=i;else{o&&(n=n.slice(),o=!1);for(let s=0;s<i.length;s++)n.push(i[s])}}return n?_l(o?n:n.sort(To)):Jo}static from(e){switch(e.length){case 0:return Et;case 1:return e[0];default:return new oo(e.every(n=>n instanceof ft)?e:e.reduce((n,o)=>n.concat(o instanceof ft?o:o.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function TE(t,e,n,o,r,i,s){let l=t.slice();for(let d=0,u=i;d<n.maps.length;d++){let f=0;n.maps[d].forEach((p,h,m,b)=>{let g=b-m-(h-p);for(let x=0;x<l.length;x+=3){let v=l[x+1];if(v<0||p>v+u-f)continue;let w=l[x]+u-f;h>=w?l[x+1]=p<=w?-2:-1:p>=u&&g&&(l[x]+=g,l[x+1]+=g)}f+=g}),u=n.maps[d].map(u,-1)}let c=!1;for(let d=0;d<l.length;d+=3)if(l[d+1]<0){if(l[d+1]==-2){c=!0,l[d+1]=-1;continue}let u=n.map(t[d]+i),f=u-r;if(f<0||f>=o.content.size){c=!0;continue}let p=n.map(t[d+1]+i,-1),h=p-r,{index:m,offset:b}=o.content.findIndex(f),g=o.maybeChild(m);if(g&&b==f&&b+g.nodeSize==h){let x=l[d+2].mapInner(n,g,u+1,t[d]+i+1,s);x!=Et?(l[d]=f,l[d+1]=h,l[d+2]=x):(l[d+1]=-2,c=!0)}else c=!0}if(c){let d=zE(l,t,e,n,r,i,s),u=Ji(d,o,0,s);e=u.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,p=0;f<u.children.length;f+=3){let h=u.children[f];for(;p<l.length&&l[p]<h;)p+=3;l.splice(p,0,u.children[f],u.children[f+1],u.children[f+2])}}return new ft(e.sort(To),l)}function Hp(t,e){if(!e||!t.length)return t;let n=[];for(let o=0;o<t.length;o++){let r=t[o];n.push(new ln(r.from+e,r.to+e,r.type))}return n}function zE(t,e,n,o,r,i,s){function l(c,d){for(let u=0;u<c.local.length;u++){let f=c.local[u].map(o,r,d);f?n.push(f):s.onRemove&&s.onRemove(c.local[u].spec)}for(let u=0;u<c.children.length;u+=3)l(c.children[u+2],c.children[u]+d+1)}for(let c=0;c<t.length;c+=3)t[c+1]==-1&&l(t[c+2],e[c]+i+1);return n}function Wp(t,e,n){if(e.isLeaf)return null;let o=n+e.nodeSize,r=null;for(let i=0,s;i<t.length;i++)(s=t[i])&&s.from>n&&s.to<o&&((r||(r=[])).push(s),t[i]=null);return r}function Gp(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Ji(t,e,n,o){let r=[],i=!1;e.forEach((l,c)=>{let d=Wp(t,l,c+n);if(d){i=!0;let u=Ji(d,l,n+c+1,o);u!=Et&&r.push(c,c+l.nodeSize,u)}});let s=Hp(i?Gp(t):t,-n).sort(To);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(o.onRemove&&o.onRemove(s[l].spec),s.splice(l--,1));return s.length||r.length?new ft(s,r):Et}function To(t,e){return t.from-e.from||t.to-e.to}function _l(t){let e=t;for(let n=0;n<e.length-1;n++){let o=e[n];if(o.from!=o.to)for(let r=n+1;r<e.length;r++){let i=e[r];if(i.from==o.from){i.to!=o.to&&(e==t&&(e=t.slice()),e[r]=i.copy(i.from,o.to),qp(e,r+1,i.copy(o.to,i.to)));continue}else{i.from<o.to&&(e==t&&(e=t.slice()),e[n]=o.copy(o.from,i.from),qp(e,r,o.copy(i.from,o.to)));break}}}return e}function qp(t,e,n){for(;e<t.length&&To(n,t[e])>0;)e++;t.splice(e,0,n)}function Al(t){let e=[];return t.someProp("decorations",n=>{let o=n(t.state);o&&o!=Et&&e.push(o)}),t.cursorWrapper&&e.push(ft.create(t.state.doc,[t.cursorWrapper.deco])),oo.from(e)}const _E={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},AE=Dt&&Yn<=11;class ME{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 IE{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new ME,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let r=0;r<o.length;r++)this.queue.push(o[r]);Dt&&Yn<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():mt&&e.composing&&o.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),AE&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.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,_E)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(kp(this.view)){if(this.suppressingSelectionUpdates)return An(this.view);if(Dt&&Yn<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&ko(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,o;for(let i=e.focusNode;i;i=Ho(i))n.add(i);for(let i=e.anchorNode;i;i=Ho(i))if(n.has(i)){o=i;break}let r=o&&this.view.docView.nearestDesc(o);if(r&&r.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let o=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&kp(e)&&!this.ignoreSelectionChange(o),i=-1,s=-1,l=!1,c=[];if(e.editable)for(let u=0;u<n.length;u++){let f=this.registerMutation(n[u],c);f&&(i=i<0?f.from:Math.min(f.from,i),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(l=!0))}if(Wt&&c.length){let u=c.filter(f=>f.nodeName=="BR");if(u.length==2){let[f,p]=u;f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let p of u){let h=p.parentNode;h&&h.nodeName=="LI"&&(!f||RE(e,f)!=h)&&p.remove()}}}else if((ut||mt)&&c.some(u=>u.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let u of c)if(u.nodeName=="BR"&&u.parentNode){let f=u.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&u.parentNode.removeChild(u)}}let d=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&ji(o)&&(d=gl(e))&&d.eq(Le.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,An(e),this.currentSelection.set(o),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,s),OE(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,PE(e,c)),this.handleDOMChange(i,s,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||An(e),this.currentSelection.set(o))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let u=0;u<e.addedNodes.length;u++){let f=e.addedNodes[u];n.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let r=e.previousSibling,i=e.nextSibling;if(Dt&&Yn<=11&&e.addedNodes.length)for(let u=0;u<e.addedNodes.length;u++){let{previousSibling:f,nextSibling:p}=e.addedNodes[u];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(r=f),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(i=p)}let s=r&&r.parentNode==e.target?ht(r)+1:0,l=o.localPosFromDOM(e.target,s,-1),c=i&&i.parentNode==e.target?ht(i):e.target.childNodes.length,d=o.localPosFromDOM(e.target,c,1);return{from:l,to:d}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let Kp=new WeakMap,Jp=!1;function OE(t){if(!Kp.has(t)&&(Kp.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=Wt,Jp)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."),Jp=!0}}function Xp(t,e){let n=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,s=t.domAtPos(t.state.selection.anchor);return ko(s.node,s.offset,r,i)&&([n,o,r,i]=[r,i,n,o]),{anchorNode:n,anchorOffset:o,focusNode:r,focusOffset:i}}function DE(t,e){if(e.getComposedRanges){let r=e.getComposedRanges(t.root)[0];if(r)return Xp(t,r)}let n;function o(r){r.preventDefault(),r.stopImmediatePropagation(),n=r.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",o,!0),n?Xp(t,n):null}function RE(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let o=t.docView.nearestDesc(n,!0);if(o&&o.node.isBlock)return n}return null}function PE(t,e){var n;let{focusNode:o,focusOffset:r}=t.domSelectionRange();for(let i of e)if(((n=i.parentNode)===null||n===void 0?void 0:n.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let c=l.firstChild;if(!c||c.nodeType!=1||c.contentEditable=="false"||/^(BR|IMG)$/.test(c.nodeName))break;l=c}l.insertBefore(i,l.firstChild),o==i&&t.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function LE(t,e,n){let{node:o,fromOffset:r,toOffset:i,from:s,to:l}=t.docView.parseRange(e,n),c=t.domSelectionRange(),d,u=c.anchorNode;if(u&&t.dom.contains(u.nodeType==1?u:u.parentNode)&&(d=[{node:u,offset:c.anchorOffset}],ji(c)||d.push({node:c.focusNode,offset:c.focusOffset})),ut&&t.input.lastKeyCode===8)for(let g=i;g>r;g--){let x=o.childNodes[g-1],v=x.pmViewDesc;if(x.nodeName=="BR"&&!v){i=g;break}if(!v||v.size)break}let f=t.state.doc,p=t.someProp("domParser")||kr.fromSchema(t.state.schema),h=f.resolve(s),m=null,b=p.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:r,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:d,ruleFromNode:$E,context:h});if(d&&d[0].pos!=null){let g=d[0].pos,x=d[1]&&d[1].pos;x==null&&(x=g),m={anchor:g+s,head:x+s}}return{doc:b,sel:m,from:s,to:l}}function $E(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(mt&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||mt&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const VE=/^(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 BE(t,e,n,o,r){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let y=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,E=gl(t,y);if(E&&!t.state.selection.eq(E)){if(ut&&zn&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",O=>O(t,wo(13,"Enter"))))return;let k=t.state.tr.setSelection(E);y=="pointer"?k.setMeta("pointer",!0):y=="key"&&k.scrollIntoView(),i&&k.setMeta("composition",i),t.dispatch(k)}return}let s=t.state.doc.resolve(e),l=s.sharedDepth(n);e=s.before(l+1),n=t.state.doc.resolve(n).after(l+1);let c=t.state.selection,d=LE(t,e,n),u=t.state.doc,f=u.slice(d.from,d.to),p,h;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(p=t.state.selection.to,h="end"):(p=t.state.selection.from,h="start"),t.input.lastKeyCode=null;let m=UE(f.content,d.doc.content,d.from,p,h);if(m&&t.input.domChangeCount++,(Wo&&t.input.lastIOSEnter>Date.now()-225||zn)&&r.some(y=>y.nodeType==1&&!VE.test(y.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",y=>y(t,wo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(o&&c instanceof Oe&&!c.empty&&c.$head.sameParent(c.$anchor)&&!t.composing&&!(d.sel&&d.sel.anchor!=d.sel.head))m={start:c.from,endA:c.to,endB:c.to};else{if(d.sel){let y=Yp(t,t.state.doc,d.sel);if(y&&!y.eq(t.state.selection)){let E=t.state.tr.setSelection(y);i&&E.setMeta("composition",i),t.dispatch(E)}}return}t.state.selection.from<t.state.selection.to&&m.start==m.endB&&t.state.selection instanceof Oe&&(m.start>t.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=d.from?m.start=t.state.selection.from:m.endA<t.state.selection.to&&m.endA>=t.state.selection.to-2&&t.state.selection.to<=d.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),Dt&&Yn<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>d.from&&d.doc.textBetween(m.start-d.from-1,m.start-d.from+1)=="  "&&(m.start--,m.endA--,m.endB--);let b=d.doc.resolveNoCache(m.start-d.from),g=d.doc.resolveNoCache(m.endB-d.from),x=u.resolve(m.start),v=b.sameParent(g)&&b.parent.inlineContent&&x.end()>=m.endA;if((Wo&&t.input.lastIOSEnter>Date.now()-225&&(!v||r.some(y=>y.nodeName=="DIV"||y.nodeName=="P"))||!v&&b.pos<d.doc.content.size&&(!b.sameParent(g)||!b.parent.inlineContent)&&b.pos<g.pos&&!/\S/.test(d.doc.textBetween(b.pos,g.pos,"","")))&&t.someProp("handleKeyDown",y=>y(t,wo(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&jE(u,m.start,m.endA,b,g)&&t.someProp("handleKeyDown",y=>y(t,wo(8,"Backspace")))){zn&&ut&&t.domObserver.suppressSelectionUpdates();return}ut&&m.endB==m.start&&(t.input.lastChromeDelete=Date.now()),zn&&!v&&b.start()!=g.start()&&g.parentOffset==0&&b.depth==g.depth&&d.sel&&d.sel.anchor==d.sel.head&&d.sel.head==m.endA&&(m.endB-=2,g=d.doc.resolveNoCache(m.endB-d.from),setTimeout(()=>{t.someProp("handleKeyDown",function(y){return y(t,wo(13,"Enter"))})},20));let w=m.start,T=m.endA,M=y=>{let E=y||t.state.tr.replace(w,T,d.doc.slice(m.start-d.from,m.endB-d.from));if(d.sel){let k=Yp(t,E.doc,d.sel);k&&!(ut&&t.composing&&k.empty&&(m.start!=m.endB||t.input.lastChromeDelete<Date.now()-100)&&(k.head==w||k.head==E.mapping.map(T)-1)||Dt&&k.empty&&k.head==w)&&E.setSelection(k)}return i&&E.setMeta("composition",i),E.scrollIntoView()},A;if(v)if(b.pos==g.pos){Dt&&Yn<=11&&b.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>An(t),20));let y=M(t.state.tr.delete(w,T)),E=u.resolve(m.start).marksAcross(u.resolve(m.endA));E&&y.ensureMarks(E),t.dispatch(y)}else if(m.endA==m.endB&&(A=FE(b.parent.content.cut(b.parentOffset,g.parentOffset),x.parent.content.cut(x.parentOffset,m.endA-x.start())))){let y=M(t.state.tr);A.type=="add"?y.addMark(w,T,A.mark):y.removeMark(w,T,A.mark),t.dispatch(y)}else if(b.parent.child(b.index()).isText&&b.index()==g.index()-(g.textOffset?0:1)){let y=b.parent.textBetween(b.parentOffset,g.parentOffset),E=()=>M(t.state.tr.insertText(y,w,T));t.someProp("handleTextInput",k=>k(t,w,T,y,E))||t.dispatch(E())}else t.dispatch(M());else t.dispatch(M())}function Yp(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:yl(t,e.resolve(n.anchor),e.resolve(n.head))}function FE(t,e){let n=t.firstChild.marks,o=e.firstChild.marks,r=n,i=o,s,l,c;for(let u=0;u<o.length;u++)r=o[u].removeFromSet(r);for(let u=0;u<n.length;u++)i=n[u].removeFromSet(i);if(r.length==1&&i.length==0)l=r[0],s="add",c=u=>u.mark(l.addToSet(u.marks));else if(r.length==0&&i.length==1)l=i[0],s="remove",c=u=>u.mark(l.removeFromSet(u.marks));else return null;let d=[];for(let u=0;u<e.childCount;u++)d.push(c(e.child(u)));if(oe.from(d).eq(t))return{mark:l,type:s}}function jE(t,e,n,o,r){if(n-e<=r.pos-o.pos||Ml(o,!0,!1)<r.pos)return!1;let i=t.resolve(e);if(!o.parent.isTextblock){let l=i.nodeAfter;return l!=null&&n==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=t.resolve(Ml(i,!0,!0));return!s.parent.isTextblock||s.pos>n||Ml(s,!0,!1)<n?!1:o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function Ml(t,e,n){let o=t.depth,r=e?t.end():t.pos;for(;o>0&&(e||t.indexAfter(o)==t.node(o).childCount);)o--,r++,e=!1;if(n){let i=t.node(o).maybeChild(t.indexAfter(o));for(;i&&!i.isLeaf;)i=i.firstChild,r++}return r}function UE(t,e,n,o,r){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:l}=t.findDiffEnd(e,n+t.size,n+e.size);if(r=="end"){let c=Math.max(0,i-Math.min(s,l));o-=s+c-i}if(s<i&&t.size<e.size){let c=o<=i&&o>=s?i-o:0;i-=c,i&&i<e.size&&Qp(e.textBetween(i-1,i+1))&&(i+=c?1:-1),l=i+(l-s),s=i}else if(l<i){let c=o<=i&&o>=l?i-o:0;i-=c,i&&i<t.size&&Qp(t.textBetween(i-1,i+1))&&(i+=c?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function Qp(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Zp{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new iE,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(rh),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=nh(this),th(this),this.nodeViews=oh(this),this.docView=cp(this.state.doc,eh(this),Al(this),this.dom,this),this.domObserver=new IE(this,(o,r,i,s)=>BE(this,o,r,i,s)),this.domObserver.start(),sE(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Nl(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(rh),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let o in this._props)n[o]=this._props[o];n.state=this.state;for(let o in e)n[o]=e[o];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var o;let r=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(Bp(this),s=!0),this.state=e;let l=r.plugins!=e.plugins||this._props.plugins!=n.plugins;if(l||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=oh(this);WE(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||n.handleDOMEvents!=this._props.handleDOMEvents)&&Nl(this),this.editable=nh(this),th(this);let c=Al(this),d=eh(this),u=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,d,c);(f||!e.selection.eq(r.selection))&&(s=!0);let p=u=="preserve"&&s&&this.dom.style.overflowAnchor==null&&Ex(this);if(s){this.domObserver.stop();let h=f&&(Dt||ut)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&HE(r.selection,e.selection);if(f){let m=ut?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=EE(this)),(i||!this.docView.update(e.doc,d,c,this))&&(this.docView.updateOuterDeco(d),this.docView.destroy(),this.docView=cp(e.doc,d,c,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Hx(this))?An(this,h):(xp(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((o=this.dragging)===null||o===void 0)&&o.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),u=="reset"?this.dom.scrollTop=0:u=="to selection"?this.scrollToSelection():p&&kx(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Ce){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&Xf(this,n.getBoundingClientRect(),e)}else Xf(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let o=this.directPlugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let o=this.state.plugins[n];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let o=this.pluginViews[n];o.update&&o.update(this,e)}}updateDraggedNode(e,n){let o=e.node,r=-1;if(this.state.doc.nodeAt(o.from)==o.node)r=o.from;else{let i=o.from+(this.state.doc.content.size-n.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==o.node&&(r=i)}this.dragging=new jp(e.slice,e.move,r<0?void 0:Ce.create(this.state.doc,r))}someProp(e,n){let o=this._props&&this._props[e],r;if(o!=null&&(r=n?n(o):o))return r;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(r=n?n(l):l))return r}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(r=n?n(l):l))return r}}hasFocus(){if(Dt){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&&wx(this.dom),An(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return Tx(this,e)}coordsAtPos(e,n=1){return np(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,o=-1){let r=this.docView.posFromDOM(e,n,o);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,n){return Ix(this,n||this.state,e)}pasteHTML(e,n){return Rr(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return Rr(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return kl(this,e)}destroy(){this.docView&&(aE(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Al(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,dx())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return cE(this,e)}domSelectionRange(){let e=this.domSelection();return e?mt&&this.root.nodeType===11&&mx(this.dom.ownerDocument)==this.dom&&DE(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Zp.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function eh(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let o in n)o=="class"?e.class+=" "+n[o]:o=="style"?e.style=(e.style?e.style+";":"")+n[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(n[o]))}),e.translate||(e.translate="no"),[ln.node(0,t.state.doc.content.size,e)]}function th(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:ln.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function nh(t){return!t.someProp("editable",e=>e(t.state)===!1)}function HE(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function oh(t){let e=Object.create(null);function n(o){for(let r in o)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=o[r])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function WE(t,e){let n=0,o=0;for(let r in t){if(t[r]!=e[r])return!0;n++}for(let r in e)o++;return n!=o}function rh(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}for(var ro={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:"'"},Xi={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},GE=typeof navigator<"u"&&/Mac/.test(navigator.platform),qE=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),gt=0;gt<10;gt++)ro[48+gt]=ro[96+gt]=String(gt);for(var gt=1;gt<=24;gt++)ro[gt+111]="F"+gt;for(var gt=65;gt<=90;gt++)ro[gt]=String.fromCharCode(gt+32),Xi[gt]=String.fromCharCode(gt);for(var Il in ro)Xi.hasOwnProperty(Il)||(Xi[Il]=ro[Il]);function KE(t){var e=GE&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||qE&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Xi:ro)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const JE=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),XE=typeof navigator<"u"&&/Win/.test(navigator.platform);function YE(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let o,r,i,s;for(let l=0;l<e.length-1;l++){let c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))JE?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+c)}return o&&(n="Alt-"+n),r&&(n="Ctrl-"+n),s&&(n="Meta-"+n),i&&(n="Shift-"+n),n}function QE(t){let e=Object.create(null);for(let n in t)e[YE(n)]=t[n];return e}function Ol(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function ZE(t){return new Ot({props:{handleKeyDown:ek(t)}})}function ek(t){let e=QE(t);return function(n,o){let r=KE(o),i,s=e[Ol(r,o)];if(s&&s(n.state,n.dispatch,n))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[Ol(r,o,!1)];if(l&&l(n.state,n.dispatch,n))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(XE&&o.ctrlKey&&o.altKey)&&(i=ro[o.keyCode])&&i!=r){let l=e[Ol(i,o)];if(l&&l(n.state,n.dispatch,n))return!0}}return!1}}var tk=Object.defineProperty,Dl=(t,e)=>{for(var n in e)tk(t,n,{get:e[n],enumerable:!0})};function Yi(t){const{state:e,transaction:n}=t;let{selection:o}=n,{doc:r}=n,{storedMarks:i}=n;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 i},get selection(){return o},get doc(){return r},get tr(){return o=n.selection,r=n.doc,i=n.storedMarks,n}}}var Qi=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:o}=e,{tr:r}=n,i=this.buildProps(r);return Object.fromEntries(Object.entries(t).map(([s,l])=>[s,(...d)=>{const u=l(...d)(i);return!r.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(r),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:o,state:r}=this,{view:i}=o,s=[],l=!!t,c=t||r.tr,d=()=>(!l&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(c),s.every(f=>f===!0)),u={...Object.fromEntries(Object.entries(n).map(([f,p])=>[f,(...m)=>{const b=this.buildProps(c,e),g=p(...m)(b);return s.push(g),u}])),run:d};return u}createCan(t){const{rawCommands:e,state:n}=this,o=!1,r=t||n.tr,i=this.buildProps(r,o);return{...Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...d)=>c(...d)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,o)}}buildProps(t,e=!0){const{rawCommands:n,editor:o,state:r}=this,{view:i}=o,s={tr:t,editor:o,view:i,state:Yi({state:r,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([l,c])=>[l,(...d)=>c(...d)(s)]))}};return s}},ih={};Dl(ih,{blur:()=>nk,clearContent:()=>ok,clearNodes:()=>rk,command:()=>ik,createParagraphNear:()=>sk,cut:()=>ak,deleteCurrentNode:()=>lk,deleteNode:()=>ck,deleteRange:()=>dk,deleteSelection:()=>uk,enter:()=>fk,exitCode:()=>pk,extendMarkRange:()=>hk,first:()=>mk,focus:()=>bk,forEach:()=>yk,insertContent:()=>xk,insertContentAt:()=>wk,joinBackward:()=>Ck,joinDown:()=>Nk,joinForward:()=>vk,joinItemBackward:()=>Tk,joinItemForward:()=>zk,joinTextblockBackward:()=>_k,joinTextblockForward:()=>Ak,joinUp:()=>Sk,keyboardShortcut:()=>Ik,lift:()=>Ok,liftEmptyBlock:()=>Dk,liftListItem:()=>Rk,newlineInCode:()=>Pk,resetAttributes:()=>Lk,scrollIntoView:()=>$k,selectAll:()=>Vk,selectNodeBackward:()=>Bk,selectNodeForward:()=>Fk,selectParentNode:()=>jk,selectTextblockEnd:()=>Uk,selectTextblockStart:()=>Hk,setContent:()=>Wk,setMark:()=>uw,setMeta:()=>fw,setNode:()=>pw,setNodeSelection:()=>hw,setTextDirection:()=>mw,setTextSelection:()=>gw,sinkListItem:()=>bw,splitBlock:()=>yw,splitListItem:()=>xw,toggleList:()=>Ew,toggleMark:()=>kw,toggleNode:()=>ww,toggleWrap:()=>Sw,undoInputRule:()=>Nw,unsetAllMarks:()=>Cw,unsetMark:()=>vw,unsetTextDirection:()=>Tw,updateAttributes:()=>zw,wrapIn:()=>_w,wrapInList:()=>Aw});var nk=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),ok=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),rk=()=>({state:t,tr:e,dispatch:n})=>{const{selection:o}=e,{ranges:r}=o;return n&&r.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(l,c)=>{if(l.type.isText)return;const{doc:d,mapping:u}=e,f=d.resolve(u.map(c)),p=d.resolve(u.map(c+l.nodeSize)),h=f.blockRange(p);if(!h)return;const m=$o(h);if(l.type.isTextblock){const{defaultType:b}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,b)}(m||m===0)&&e.lift(h,m)})}),!0},ik=t=>e=>t(e),sk=()=>({state:t,dispatch:e})=>Bf(t,e),ak=(t,e)=>({editor:n,tr:o})=>{const{state:r}=n,i=r.doc.slice(t.from,t.to);o.deleteRange(t.from,t.to);const s=o.mapping.map(e);return o.insert(s,i.content),o.setSelection(new Oe(o.doc.resolve(Math.max(s-1,0)))),!0},lk=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,o=n.$anchor.node();if(o.content.size>0)return!1;const r=t.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(e){const l=r.before(i),c=r.after(i);t.delete(l,c).scrollIntoView()}return!0}return!1};function ot(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var ck=t=>({tr:e,state:n,dispatch:o})=>{const r=ot(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r){if(o){const c=i.before(s),d=i.after(s);e.delete(c,d).scrollIntoView()}return!0}return!1},dk=t=>({tr:e,dispatch:n})=>{const{from:o,to:r}=t;return n&&e.delete(o,r),!0},uk=()=>({state:t,dispatch:e})=>ol(t,e),fk=()=>({commands:t})=>t.keyboardShortcut("Enter"),pk=()=>({state:t,dispatch:e})=>J0(t,e);function Rl(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Zi(t,e,n={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>n.strict?e[r]===t[r]:Rl(e[r])?e[r].test(t[r]):e[r]===t[r]):!0}function sh(t,e,n={}){return t.find(o=>o.type===e&&Zi(Object.fromEntries(Object.keys(n).map(r=>[r,o.attrs[r]])),n))}function ah(t,e,n={}){return!!sh(t,e,n)}function Pl(t,e,n){var o;if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===e))&&(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===e)||(n=n||((o=r.node.marks[0])==null?void 0:o.attrs),!sh([...r.node.marks],e,n)))return;let s=r.index,l=t.start()+r.offset,c=s+1,d=l+r.node.nodeSize;for(;s>0&&ah([...t.parent.child(s-1).marks],e,n);)s-=1,l-=t.parent.child(s).nodeSize;for(;c<t.parent.childCount&&ah([...t.parent.child(c).marks],e,n);)d+=t.parent.child(c).nodeSize,c+=1;return{from:l,to:d}}function Mn(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var hk=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const i=Mn(t,o.schema),{doc:s,selection:l}=n,{$from:c,from:d,to:u}=l;if(r){const f=Pl(c,i,e);if(f&&f.from<=d&&f.to>=u){const p=Oe.create(s,f.from,f.to);n.setSelection(p)}}return!0},mk=t=>e=>{const n=typeof t=="function"?t(e):t;for(let o=0;o<n.length;o+=1)if(n[o](e))return!0;return!1};function lh(t){return t instanceof Oe}function zo(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function ch(t,e=null){if(!e)return null;const n=Le.atStart(t),o=Le.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return o;const r=n.from,i=o.to;return e==="all"?Oe.create(t,zo(0,r,i),zo(t.content.size,r,i)):Oe.create(t,zo(e,r,i),zo(e,r,i))}function dh(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function es(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function gk(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var bk=(t=null,e={})=>({editor:n,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(es()||dh())&&o.dom.focus(),gk()&&!es()&&!dh()&&o.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(o.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(o.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!lh(n.state.selection))return s(),!0;const l=ch(r.doc,t)||n.state.selection,c=n.state.selection.eq(l);return i&&(c||r.setSelection(l),c&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},yk=(t,e)=>n=>t.every((o,r)=>e(o,{...n,index:r})),xk=(t,e)=>({tr:n,commands:o})=>o.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),uh=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const o=e[n];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?t.removeChild(o):o.nodeType===1&&uh(o)}return t};function ts(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return uh(n)}function Lr(t,e,n){if(t instanceof Gn||t instanceof oe)return t;n={slice:!0,parseOptions:{},...n};const o=typeof t=="object"&&t!==null,r=typeof t=="string";if(o)try{if(Array.isArray(t)&&t.length>0)return oe.fromArray(t.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(t);return n.errorOnInvalidContent&&s.check(),s}catch(i){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",i),Lr("",e,n)}if(r){if(n.errorOnInvalidContent){let s=!1,l="";const c=new Qu({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=>(s=!0,l=typeof d=="string"?d:d.outerHTML,null)}]}})});if(n.slice?kr.fromSchema(c).parseSlice(ts(t),n.parseOptions):kr.fromSchema(c).parse(ts(t),n.parseOptions),n.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=kr.fromSchema(e);return n.slice?i.parseSlice(ts(t),n.parseOptions).content:i.parse(ts(t),n.parseOptions)}return Lr("",e,n)}function Ek(t,e,n){const o=t.steps.length-1;if(o<e)return;const r=t.steps[o];if(!(r instanceof ct||r instanceof dt))return;const i=t.mapping.maps[o];let s=0;i.forEach((l,c,d,u)=>{s===0&&(s=u)}),t.setSelection(Le.near(t.doc.resolve(s),n))}var kk=t=>!("type"in t),wk=(t,e,n)=>({tr:o,dispatch:r,editor:i})=>{var s;if(r){n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let l;const c=g=>{i.emit("contentError",{editor:i,error:g,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},d={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Lr(e,i.schema,{parseOptions:d,errorOnInvalidContent:!0})}catch(g){c(g)}try{l=Lr(e,i.schema,{parseOptions:d,errorOnInvalidContent:(s=n.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(g){return c(g),!1}let{from:u,to:f}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},p=!0,h=!0;if((kk(l)?l:[l]).forEach(g=>{g.check(),p=p?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),u===f&&h){const{parent:g}=o.doc.resolve(u);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(u-=1,f+=1)}let b;if(p){if(Array.isArray(e))b=e.map(g=>g.text||"").join("");else if(e instanceof oe){let g="";e.forEach(x=>{x.text&&(g+=x.text)}),b=g}else typeof e=="object"&&e&&e.text?b=e.text:b=e;o.insertText(b,u,f)}else{b=l;const g=o.doc.resolve(u),x=g.node(),v=g.parentOffset===0,w=x.isText||x.isTextblock,T=x.content.size>0;v&&w&&T&&(u=Math.max(0,u-1)),o.replaceWith(u,f,b)}n.updateSelection&&Ek(o,o.steps.length-1,-1),n.applyInputRules&&o.setMeta("applyInputRules",{from:u,text:b}),n.applyPasteRules&&o.setMeta("applyPasteRules",{from:u,text:b})}return!0},Sk=()=>({state:t,dispatch:e})=>G0(t,e),Nk=()=>({state:t,dispatch:e})=>q0(t,e),Ck=()=>({state:t,dispatch:e})=>Of(t,e),vk=()=>({state:t,dispatch:e})=>Lf(t,e),Tk=()=>({state:t,dispatch:e,tr:n})=>{try{const o=$i(t.doc,t.selection.$from.pos,-1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},zk=()=>({state:t,dispatch:e,tr:n})=>{try{const o=$i(t.doc,t.selection.$from.pos,1);return o==null?!1:(n.join(o,2),e&&e(n),!0)}catch{return!1}},_k=()=>({state:t,dispatch:e})=>H0(t,e),Ak=()=>({state:t,dispatch:e})=>W0(t,e);function fh(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function Mk(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let o,r,i,s;for(let l=0;l<e.length-1;l+=1){const c=e[l];if(/^(cmd|meta|m)$/i.test(c))s=!0;else if(/^a(lt)?$/i.test(c))o=!0;else if(/^(c|ctrl|control)$/i.test(c))r=!0;else if(/^s(hift)?$/i.test(c))i=!0;else if(/^mod$/i.test(c))es()||fh()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${c}`)}return o&&(n=`Alt-${n}`),r&&(n=`Ctrl-${n}`),s&&(n=`Meta-${n}`),i&&(n=`Shift-${n}`),n}var Ik=t=>({editor:e,view:n,tr:o,dispatch:r})=>{const i=Mk(t).split(/-(?!$)/),s=i.find(d=>!["Alt","Ctrl","Meta","Shift"].includes(d)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{n.someProp("handleKeyDown",d=>d(n,l))});return c?.steps.forEach(d=>{const u=d.map(o.mapping);u&&r&&o.maybeStep(u)}),!0};function io(t,e,n={}){const{from:o,to:r,empty:i}=t.selection,s=e?ot(e,t.schema):null,l=[];t.doc.nodesBetween(o,r,(f,p)=>{if(f.isText)return;const h=Math.max(o,p),m=Math.min(r,p+f.nodeSize);l.push({node:f,from:h,to:m})});const c=r-o,d=l.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>Zi(f.node.attrs,n,{strict:!1}));return i?!!d.length:d.reduce((f,p)=>f+p.to-p.from,0)>=c}var Ok=(t,e={})=>({state:n,dispatch:o})=>{const r=ot(t,n.schema);return io(n,r,e)?K0(n,o):!1},Dk=()=>({state:t,dispatch:e})=>Ff(t,e),Rk=t=>({state:e,dispatch:n})=>{const o=ot(t,e.schema);return sx(o)(e,n)},Pk=()=>({state:t,dispatch:e})=>Vf(t,e);function ns(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function ph(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((o,r)=>(n.includes(r)||(o[r]=t[r]),o),{})}var Lk=(t,e)=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const l=ns(typeof t=="string"?t:t.name,o.schema);if(!l)return!1;l==="node"&&(i=ot(t,o.schema)),l==="mark"&&(s=Mn(t,o.schema));let c=!1;return n.selection.ranges.forEach(d=>{o.doc.nodesBetween(d.$from.pos,d.$to.pos,(u,f)=>{i&&i===u.type&&(c=!0,r&&n.setNodeMarkup(f,void 0,ph(u.attrs,e))),s&&u.marks.length&&u.marks.forEach(p=>{s===p.type&&(c=!0,r&&n.addMark(f,f+u.nodeSize,s.create(ph(p.attrs,e))))})})}),c},$k=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Vk=()=>({tr:t,dispatch:e})=>{if(e){const n=new Bt(t.doc);t.setSelection(n)}return!0},Bk=()=>({state:t,dispatch:e})=>Rf(t,e),Fk=()=>({state:t,dispatch:e})=>$f(t,e),jk=()=>({state:t,dispatch:e})=>Q0(t,e),Uk=()=>({state:t,dispatch:e})=>tx(t,e),Hk=()=>({state:t,dispatch:e})=>ex(t,e);function Ll(t,e,n={},o={}){return Lr(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:o.errorOnInvalidContent})}var Wk=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:o={}}={})=>({editor:r,tr:i,dispatch:s,commands:l})=>{const{doc:c}=i;if(o.preserveWhitespace!=="full"){const d=Ll(t,r.schema,o,{errorOnInvalidContent:e??r.options.enableContentCheck});return s&&i.replaceWith(0,c.content.size,d).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),l.insertContentAt({from:0,to:c.content.size},t,{parseOptions:o,errorOnInvalidContent:e??r.options.enableContentCheck})};function hh(t,e){const n=Mn(e,t.schema),{from:o,to:r,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(o,r,c=>{s.push(...c.marks)});const l=s.find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function mh(t,e){const n=new Sf(t);return e.forEach(o=>{o.steps.forEach(r=>{n.step(r)})}),n}function Gk(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function qk(t,e,n){const o=[];return t.nodesBetween(e.from,e.to,(r,i)=>{n(r)&&o.push({node:r,pos:i})}),o}function Kk(t,e){for(let n=t.depth;n>0;n-=1){const o=t.node(n);if(e(o))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:o}}}function rs(t){return e=>Kk(e.$from,t)}function xe(t,e,n){return t.config[e]===void 0&&t.parent?xe(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?xe(t.parent,e,n):null}):t.config[e]}function $l(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},o=xe(e,"addExtensions",n);return o?[e,...$l(o())]:e}).flat(10)}function Vl(t,e){const n=xo.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function gh(t){return typeof t=="function"}function Ue(t,e=void 0,...n){return gh(t)?e?t.bind(e)(...n):t(...n):t}function Jk(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Xo(t){const e=t.filter(r=>r.type==="extension"),n=t.filter(r=>r.type==="node"),o=t.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:o}}function bh(t){const e=[],{nodeExtensions:n,markExtensions:o}=Xo(t),r=[...n,...o],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage,extensions:r},c=xe(s,"addGlobalAttributes",l);if(!c)return;c().forEach(u=>{u.types.forEach(f=>{Object.entries(u.attributes).forEach(([p,h])=>{e.push({type:f,name:p,attribute:{...i,...h}})})})})}),r.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},c=xe(s,"addAttributes",l);if(!c)return;const d=c();Object.entries(d).forEach(([u,f])=>{const p={...i,...f};typeof p?.default=="function"&&(p.default=p.default()),p?.isRequired&&p?.default===void 0&&delete p.default,e.push({type:s.name,name:u,attribute:p})})}),e}function Rt(...t){return t.filter(e=>!!e).reduce((e,n)=>{const o={...e};return Object.entries(n).forEach(([r,i])=>{if(!o[r]){o[r]=i;return}if(r==="class"){const l=i?String(i).split(" "):[],c=o[r]?o[r].split(" "):[],d=l.filter(u=>!c.includes(u));o[r]=[...c,...d].join(" ")}else if(r==="style"){const l=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],c=o[r]?o[r].split(";").map(u=>u.trim()).filter(Boolean):[],d=new Map;c.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),l.forEach(u=>{const[f,p]=u.split(":").map(h=>h.trim());d.set(f,p)}),o[r]=Array.from(d.entries()).map(([u,f])=>`${u}: ${f}`).join("; ")}else o[r]=i}),o},{})}function $r(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,o)=>Rt(n,o),{})}function Xk(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function yh(t,e){return"style"in t?t:{...t,getAttrs:n=>{const o=t.getAttrs?t.getAttrs(n):t.attrs;if(o===!1)return!1;const r=e.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(n):Xk(n.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...o,...r}}}}function xh(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&Jk(n)?!1:n!=null))}function Eh(t){var e,n;const o={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(o.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(o.validate=t.attribute.validate),[t.name,o]}function Yk(t,e){var n;const o=bh(t),{nodeExtensions:r,markExtensions:i}=Xo(t),s=(n=r.find(d=>xe(d,"topNode")))==null?void 0:n.name,l=Object.fromEntries(r.map(d=>{const u=o.filter(x=>x.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=t.reduce((x,v)=>{const w=xe(v,"extendNodeSchema",f);return{...x,...w?w(d):{}}},{}),h=xh({...p,content:Ue(xe(d,"content",f)),marks:Ue(xe(d,"marks",f)),group:Ue(xe(d,"group",f)),inline:Ue(xe(d,"inline",f)),atom:Ue(xe(d,"atom",f)),selectable:Ue(xe(d,"selectable",f)),draggable:Ue(xe(d,"draggable",f)),code:Ue(xe(d,"code",f)),whitespace:Ue(xe(d,"whitespace",f)),linebreakReplacement:Ue(xe(d,"linebreakReplacement",f)),defining:Ue(xe(d,"defining",f)),isolating:Ue(xe(d,"isolating",f)),attrs:Object.fromEntries(u.map(Eh))}),m=Ue(xe(d,"parseHTML",f));m&&(h.parseDOM=m.map(x=>yh(x,u)));const b=xe(d,"renderHTML",f);b&&(h.toDOM=x=>b({node:x,HTMLAttributes:$r(x,u)}));const g=xe(d,"renderText",f);return g&&(h.toText=g),[d.name,h]})),c=Object.fromEntries(i.map(d=>{const u=o.filter(g=>g.type===d.name),f={name:d.name,options:d.options,storage:d.storage,editor:e},p=t.reduce((g,x)=>{const v=xe(x,"extendMarkSchema",f);return{...g,...v?v(d):{}}},{}),h=xh({...p,inclusive:Ue(xe(d,"inclusive",f)),excludes:Ue(xe(d,"excludes",f)),group:Ue(xe(d,"group",f)),spanning:Ue(xe(d,"spanning",f)),code:Ue(xe(d,"code",f)),attrs:Object.fromEntries(u.map(Eh))}),m=Ue(xe(d,"parseHTML",f));m&&(h.parseDOM=m.map(g=>yh(g,u)));const b=xe(d,"renderHTML",f);return b&&(h.toDOM=g=>b({mark:g,HTMLAttributes:$r(g,u)})),[d.name,h]}));return new Qu({topNode:s,nodes:l,marks:c})}function Qk(t){const e=t.filter((n,o)=>t.indexOf(n)!==o);return Array.from(new Set(e))}function is(t){return t.sort((n,o)=>{const r=xe(n,"priority")||100,i=xe(o,"priority")||100;return r>i?-1:r<i?1:0})}function kh(t){const e=is($l(t)),n=Qk(e.map(o=>o.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),e}function wh(t,e,n){const{from:o,to:r}=e,{blockSeparator:i=`
358
358
 
359
- `,textSerializers:s={}}=n||{};let l="";return t.nodesBetween(o,r,(c,d,u,f)=>{var p;c.isBlock&&d>o&&(l+=i);const h=s?.[c.type.name];if(h)return u&&(l+=h({node:c,pos:d,parent:u,index:f,range:e})),!1;c.isText&&(l+=(p=c?.text)==null?void 0:p.slice(Math.max(o,d)-d,r-d))}),l}function Zk(t,e){const n={from:0,to:t.content.size};return wh(t,n,e)}function Sh(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function ew(t,e){const n=ot(e,t.schema),{from:o,to:r}=t.selection,i=[];t.doc.nodesBetween(o,r,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function Nh(t,e){const n=ns(typeof e=="string"?e:e.name,t.schema);return n==="node"?ew(t,e):n==="mark"?hh(t,e):{}}function tw(t,e=JSON.stringify){const n={};return t.filter(o=>{const r=e(o);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function nw(t){const e=tw(t);return e.length===1?e:e.filter((n,o)=>!e.filter((i,s)=>s!==o).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function Ch(t){const{mapping:e,steps:n}=t,o=[];return e.maps.forEach((r,i)=>{const s=[];if(r.ranges.length)r.forEach((l,c)=>{s.push({from:l,to:c})});else{const{from:l,to:c}=n[i];if(l===void 0||c===void 0)return;s.push({from:l,to:c})}s.forEach(({from:l,to:c})=>{const d=e.slice(i).map(l,-1),u=e.slice(i).map(c),f=e.invert().map(d,-1),p=e.invert().map(u);o.push({oldRange:{from:f,to:p},newRange:{from:d,to:u}})})}),nw(o)}function Bl(t,e,n){const o=[];return t===e?n.resolve(t).marks().forEach(r=>{const i=n.resolve(t),s=Pl(i,r.type);s&&o.push({mark:r,...s})}):n.nodesBetween(t,e,(r,i)=>{!r||r?.nodeSize===void 0||o.push(...r.marks.map(s=>({from:i,to:i+r.nodeSize,mark:s})))}),o}var ow=(t,e,n,o=20)=>{const r=t.doc.resolve(n);let i=o,s=null;for(;i>0&&s===null;){const l=r.node(i);l?.type.name===e?s=l:i-=1}return[s,i]};function ss(t,e){return e.nodes[t]||e.marks[t]||null}function as(t,e,n){return Object.fromEntries(Object.entries(n).filter(([o])=>{const r=t.find(i=>i.type===e&&i.name===o);return r?r.attribute.keepOnSplit:!1}))}var rw=(t,e=500)=>{let n="";const o=t.parentOffset;return t.parent.nodesBetween(Math.max(0,o-e),o,(r,i,s,l)=>{var c,d;const u=((d=(c=r.type.spec).toText)==null?void 0:d.call(c,{node:r,pos:i,parent:s,index:l}))||r.textContent||"%leaf%";n+=r.isAtom&&!r.isText?u:u.slice(0,Math.max(0,o-i))}),n};function Fl(t,e,n={}){const{empty:o,ranges:r}=t.selection,i=e?Mn(e,t.schema):null;if(o)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>i?i.name===f.type.name:!0).find(f=>Zi(f.attrs,n,{strict:!1}));let s=0;const l=[];if(r.forEach(({$from:f,$to:p})=>{const h=f.pos,m=p.pos;t.doc.nodesBetween(h,m,(b,g)=>{if(!b.isText&&!b.marks.length)return;const x=Math.max(h,g),v=Math.min(m,g+b.nodeSize),w=v-x;s+=w,l.push(...b.marks.map(T=>({mark:T,from:x,to:v})))})}),s===0)return!1;const c=l.filter(f=>i?i.name===f.mark.type.name:!0).filter(f=>Zi(f.mark.attrs,n,{strict:!1})).reduce((f,p)=>f+p.to-p.from,0),d=l.filter(f=>i?f.mark.type!==i&&f.mark.type.excludes(i):!0).reduce((f,p)=>f+p.to-p.from,0);return(c>0?c+d:c)>=s}function iw(t,e,n={}){if(!e)return io(t,null,n)||Fl(t,null,n);const o=ns(e,t.schema);return o==="node"?io(t,e,n):o==="mark"?Fl(t,e,n):!1}var sw=(t,e)=>{const{$from:n,$to:o,$anchor:r}=t.selection;if(e){const i=rs(l=>l.type.name===e)(t.selection);if(!i)return!1;const s=t.doc.resolve(i.pos+1);return r.pos+1===s.end()}return!(o.parentOffset<o.parent.nodeSize-2||n.pos!==o.pos)},aw=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function vh(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Th(t,e){const{nodeExtensions:n}=Xo(e),o=n.find(s=>s.name===t);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=Ue(ye(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function jl(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var o;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((o=t.text)!=null?o:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let r=!0;return t.content.forEach(i=>{r!==!1&&(jl(i,{ignoreWhitespace:n,checkChildren:e})||(r=!1))}),r}return!1}var zh=class Fm{constructor(e){this.position=e}static fromJSON(e){return new Fm(e.position)}toJSON(){return{position:this.position}}};function lw(t,e){const n=e.mapping.mapResult(t.position);return{position:new zh(n.pos),mapResult:n}}function cw(t){return new zh(t)}function dw(t,e,n){var o;const{selection:r}=e;let i=null;if(lh(r)&&(i=r.$cursor),i){const l=(o=t.storedMarks)!=null?o:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(d=>d.type.excludes(n)))}const{ranges:s}=r;return s.some(({$from:l,$to:c})=>{let d=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,c.pos,(u,f,p)=>{if(d)return!1;if(u.isInline){const h=!p||p.type.allowsMarkType(n),m=!!n.isInSet(u.marks)||!u.marks.some(b=>b.type.excludes(n));d=h&&m}return!d}),d})}var uw=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const{selection:i}=n,{empty:s,ranges:l}=i,c=Mn(t,o.schema);if(r)if(s){const d=hh(o,c);n.addStoredMark(c.create({...d,...e}))}else l.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;o.doc.nodesBetween(u,f,(p,h)=>{const m=Math.max(h,u),b=Math.min(h+p.nodeSize,f);p.marks.find(x=>x.type===c)?p.marks.forEach(x=>{c===x.type&&n.addMark(m,b,c.create({...x.attrs,...e}))}):n.addMark(m,b,c.create(e))})});return dw(o,n,c)},fw=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),pw=(t,e={})=>({state:n,dispatch:o,chain:r})=>{const i=ot(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:l})=>Hf(i,{...s,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Hf(i,{...s,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},hw=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,r=zo(t,0,o.content.size),i=Ne.create(o,r);e.setSelection(i)}return!0},mw=(t,e)=>({tr:n,state:o,dispatch:r})=>{const{selection:i}=o;let s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=i.from,l=i.to),r&&n.doc.nodesBetween(s,l,(c,d)=>{c.isText||n.setNodeMarkup(d,void 0,{...c.attrs,dir:t})}),!0},gw=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,{from:r,to:i}=typeof t=="number"?{from:t,to:t}:t,s=Oe.atStart(o).from,l=Oe.atEnd(o).to,c=zo(r,s,l),d=zo(i,s,l),u=Oe.create(o,c,d);e.setSelection(u)}return!0},bw=t=>({state:e,dispatch:n})=>{const o=ot(t,e.schema);return cx(o)(e,n)};function _h(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const o=n.filter(r=>e?.includes(r.type.name));t.tr.ensureMarks(o)}}var yw=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:l,$to:c}=i,d=r.extensionManager.attributes,u=as(d,l.node().type.name,l.node().attrs);if(i instanceof Ne&&i.node.isBlock)return!l.parentOffset||!vn(s,l.pos)?!1:(o&&(t&&_h(n,r.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=c.parentOffset===c.parent.content.size,p=l.depth===0?void 0:Gk(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:u}]:void 0,m=vn(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&vn(e.doc,e.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:u}]:void 0),o){if(m&&(i instanceof Oe&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),p&&!f&&!l.parentOffset&&l.parent.type!==p)){const b=e.mapping.map(l.before()),g=e.doc.resolve(b);l.node(-1).canReplaceWith(g.index(),g.index()+1,p)&&e.setNodeMarkup(e.mapping.map(l.before()),p)}t&&_h(n,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},xw=(t,e={})=>({tr:n,state:o,dispatch:r,editor:i})=>{var s;const l=ot(t,o.schema),{$from:c,$to:d}=o.selection,u=o.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const f=c.node(-1);if(f.type!==l)return!1;const p=i.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(r){let x=ne.empty;const v=c.index(-1)?1:c.index(-2)?2:3;for(let E=c.depth-v;E>=c.depth-3;E-=1)x=ne.from(c.node(E).copy(x));const w=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,T={...as(p,c.node().type.name,c.node().attrs),...e},M=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(T))||void 0;x=x.append(ne.from(l.createAndFill(null,M)||void 0));const A=c.before(c.depth-(v-1));n.replace(A,c.after(-w),new ue(x,4-v,0));let y=-1;n.doc.nodesBetween(A,n.doc.content.size,(E,S)=>{if(y>-1)return!1;E.isTextblock&&E.content.size===0&&(y=S+1)}),y>-1&&n.setSelection(Oe.near(n.doc.resolve(y))),n.scrollIntoView()}return!0}const h=d.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...as(p,f.type.name,f.attrs),...e},b={...as(p,c.node().type.name,c.node().attrs),...e};n.delete(c.pos,d.pos);const g=h?[{type:l,attrs:m},{type:h,attrs:b}]:[{type:l,attrs:m}];if(!vn(n.doc,c.pos,2))return!1;if(r){const{selection:x,storedMarks:v}=o,{splittableMarks:w}=i.extensionManager,T=v||x.$to.parentOffset&&x.$from.marks();if(n.split(c.pos,2,g).scrollIntoView(),!T||!r)return!0;const M=T.filter(A=>w.includes(A.type.name));n.ensureMarks(M)}return!0},Ul=(t,e)=>{const n=rs(s=>s.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===r?.type&&Jn(t.doc,n.pos)&&t.join(n.pos),!0},Hl=(t,e)=>{const n=rs(s=>s.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(n.start).after(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===r?.type&&Jn(t.doc,o)&&t.join(o),!0},Ew=(t,e,n,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:c,commands:d,can:u})=>{const{extensions:f,splittableMarks:p}=r.extensionManager,h=ot(t,s.schema),m=ot(e,s.schema),{selection:b,storedMarks:g}=s,{$from:x,$to:v}=b,w=x.blockRange(v),T=g||b.$to.parentOffset&&b.$from.marks();if(!w)return!1;const M=rs(A=>Th(A.type.name,f))(b);if(w.depth>=1&&M&&w.depth-M.depth<=1){if(M.node.type===h)return d.liftListItem(m);if(Th(M.node.type.name,f)&&h.validContent(M.node.content)&&l)return c().command(()=>(i.setNodeMarkup(M.pos,h),!0)).command(()=>Ul(i,h)).command(()=>Hl(i,h)).run()}return!n||!T||!l?c().command(()=>u().wrapInList(h,o)?!0:d.clearNodes()).wrapInList(h,o).command(()=>Ul(i,h)).command(()=>Hl(i,h)).run():c().command(()=>{const A=u().wrapInList(h,o),y=T.filter(E=>p.includes(E.type.name));return i.ensureMarks(y),A?!0:d.clearNodes()}).wrapInList(h,o).command(()=>Ul(i,h)).command(()=>Hl(i,h)).run()},kw=(t,e={},n={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=n,s=Mn(t,o.schema);return Fl(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},ww=(t,e,n={})=>({state:o,commands:r})=>{const i=ot(t,o.schema),s=ot(e,o.schema),l=io(o,i,n);let c;return o.selection.$anchor.sameParent(o.selection.$head)&&(c=o.selection.$anchor.parent.attrs),l?r.setNode(s,c):r.setNode(i,{...c,...n})},Sw=(t,e={})=>({state:n,commands:o})=>{const r=ot(t,n.schema);return io(n,r,e)?o.lift(r):o.wrapIn(r,e)},Nw=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let o=0;o<n.length;o+=1){const r=n[o];let i;if(r.spec.isInputRules&&(i=r.getState(t))){if(e){const s=t.tr,l=i.transform;for(let c=l.steps.length-1;c>=0;c-=1)s.step(l.steps[c].invert(l.docs[c]));if(i.text){const c=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,c))}else s.delete(i.from,i.to)}return!0}}return!1},Cw=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:o,ranges:r}=n;return o||e&&r.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},vw=(t,e={})=>({tr:n,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=n,c=Mn(t,o.schema),{$from:d,empty:u,ranges:f}=l;if(!r)return!0;if(u&&s){let{from:p,to:h}=l;const m=(i=d.marks().find(g=>g.type===c))==null?void 0:i.attrs,b=Pl(d,c,m);b&&(p=b.from,h=b.to),n.removeMark(p,h,c)}else f.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,c)});return n.removeStoredMark(c),!0},Tw=t=>({tr:e,state:n,dispatch:o})=>{const{selection:r}=n;let i,s;return typeof t=="number"?(i=t,s=t):t&&"from"in t&&"to"in t?(i=t.from,s=t.to):(i=r.from,s=r.to),o&&e.doc.nodesBetween(i,s,(l,c)=>{if(l.isText)return;const d={...l.attrs};delete d.dir,e.setNodeMarkup(c,void 0,d)}),!0},zw=(t,e={})=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const l=ns(typeof t=="string"?t:t.name,o.schema);if(!l)return!1;l==="node"&&(i=ot(t,o.schema)),l==="mark"&&(s=Mn(t,o.schema));let c=!1;return n.selection.ranges.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;let p,h,m,b;n.selection.empty?o.doc.nodesBetween(u,f,(g,x)=>{i&&i===g.type&&(c=!0,m=Math.max(x,u),b=Math.min(x+g.nodeSize,f),p=x,h=g)}):o.doc.nodesBetween(u,f,(g,x)=>{x<u&&i&&i===g.type&&(c=!0,m=Math.max(x,u),b=Math.min(x+g.nodeSize,f),p=x,h=g),x>=u&&x<=f&&(i&&i===g.type&&(c=!0,r&&n.setNodeMarkup(x,void 0,{...g.attrs,...e})),s&&g.marks.length&&g.marks.forEach(v=>{if(s===v.type&&(c=!0,r)){const w=Math.max(x,u),T=Math.min(x+g.nodeSize,f);n.addMark(w,T,s.create({...v.attrs,...e}))}}))}),h&&(p!==void 0&&r&&n.setNodeMarkup(p,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(g=>{s===g.type&&r&&n.addMark(m,b,s.create({...g.attrs,...e}))}))}),c},_w=(t,e={})=>({state:n,dispatch:o})=>{const r=ot(t,n.schema);return nx(r,e)(n,o)},Aw=(t,e={})=>({state:n,dispatch:o})=>{const r=ot(t,n.schema);return ox(r,e)(n,o)},Mw=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(o=>o.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(o=>o!==e):delete this.callbacks[t]),this}once(t,e){const n=(...o)=>{this.off(t,n),e.apply(this,o)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Ah=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},Iw=(t,e)=>{if(Rl(e))return e.exec(t);const n=e(t);if(!n)return null;const o=[n.text];return o.index=n.index,o.input=t,o.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(n.replaceWith)),o};function ls(t){var e;const{editor:n,from:o,to:r,text:i,rules:s,plugin:l}=t,{view:c}=n;if(c.composing)return!1;const d=c.state.doc.resolve(o);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let u=!1;const f=rw(d)+i;return s.forEach(p=>{if(u)return;const h=Iw(f,p.find);if(!h)return;const m=c.state.tr,b=Yi({state:c.state,transaction:m}),g={from:o-(h[0].length-i.length),to:r},{commands:x,chain:v,can:w}=new Qi({editor:n,state:b});p.handler({state:b,range:g,match:h,commands:x,chain:v,can:w})===null||!m.steps.length||(p.undoable&&m.setMeta(l,{transform:m,from:o,to:r,text:i}),c.dispatch(m),u=!0)}),u}function Ow(t){const{editor:e,rules:n}=t,o=new Ot({state:{init(){return null},apply(r,i,s){const l=r.getMeta(o);if(l)return l;const c=r.getMeta("applyInputRules");return c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=Vl(ne.from(u),s.schema);const{from:f}=c,p=f+u.length;ls({editor:e,from:f,to:p,text:u,rules:n,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,s,l){return ls({editor:e,from:i,to:s,text:l,rules:n,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&ls({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:o})}),!1)},handleKeyDown(r,i){if(i.key!=="Enter")return!1;const{$cursor:s}=r.state.selection;return s?ls({editor:e,from:s.pos,to:s.pos,text:`
360
- `,rules:n,plugin:o}):!1}},isInputRules:!0});return o}function Dw(t){return Object.prototype.toString.call(t).slice(8,-1)}function cs(t){return Dw(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Mh(t,e){const n={...t};return cs(t)&&cs(e)&&Object.keys(e).forEach(o=>{cs(e[o])&&cs(t[o])?n[o]=Mh(t[o],e[o]):n[o]=e[o]}),n}var Wl=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...Ue(ye(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Ue(ye(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>Mh(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Vr=class jm extends Wl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new jm(n)}static handleExit({editor:e,mark:n}){const{tr:o}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const s=r.marks();if(!!!s.find(d=>d?.type.name===n.name))return!1;const c=s.find(d=>d?.type.name===n.name);return c&&o.removeStoredMark(c),o.insertText(" ",r.pos),e.view.dispatch(o),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Rw(t){return typeof t=="number"}var Pw=class{constructor(t){this.find=t.find,this.handler=t.handler}},Lw=(t,e,n)=>{if(Rl(e))return[...t.matchAll(e)];const o=e(t,n);return o?o.map(r=>{const i=[r.text];return i.index=r.index,i.input=t,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function $w(t){const{editor:e,state:n,from:o,to:r,rule:i,pasteEvent:s,dropEvent:l}=t,{commands:c,chain:d,can:u}=new Qi({editor:e,state:n}),f=[];return n.doc.nodesBetween(o,r,(h,m)=>{var b,g,x,v,w;if((g=(b=h.type)==null?void 0:b.spec)!=null&&g.code||!(h.isText||h.isTextblock||h.isInline))return;const T=(w=(v=(x=h.content)==null?void 0:x.size)!=null?v:h.nodeSize)!=null?w:0,M=Math.max(o,m),A=Math.min(r,m+T);if(M>=A)return;const y=h.isText?h.text||"":h.textBetween(M-m,A-m,void 0,"");Lw(y,i.find,s).forEach(S=>{if(S.index===void 0)return;const D=M+S.index+1,W=D+S[0].length,z={from:n.tr.mapping.map(D),to:n.tr.mapping.map(W)},P=i.handler({state:n,range:z,match:S,commands:c,chain:d,can:u,pasteEvent:s,dropEvent:l});f.push(P)})}),f.every(h=>h!==null)}var ds=null,Vw=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function Bw(t){const{editor:e,rules:n}=t;let o=null,r=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const c=({state:u,from:f,to:p,rule:h,pasteEvt:m})=>{const b=u.tr,g=Yi({state:u,transaction:b});if(!(!$w({editor:e,state:g,from:Math.max(f-1,0),to:p.b-1,rule:h,pasteEvent:m,dropEvent:l})||!b.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,b}};return n.map(u=>new Ot({view(f){const p=m=>{var b;o=(b=f.dom.parentElement)!=null&&b.contains(m.target)?f.dom.parentElement:null,o&&(ds=e)},h=()=>{ds&&(ds=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(f,p)=>{if(i=o===f.dom.parentElement,l=p,!i){const h=ds;h?.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,p)=>{var h;const m=(h=p.clipboardData)==null?void 0:h.getData("text/html");return s=p,r=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(f,p,h)=>{const m=f[0],b=m.getMeta("uiEvent")==="paste"&&!r,g=m.getMeta("uiEvent")==="drop"&&!i,x=m.getMeta("applyPasteRules"),v=!!x;if(!b&&!g&&!v)return;if(v){let{text:M}=x;typeof M=="string"?M=M:M=Vl(ne.from(M),h.schema);const{from:A}=x,y=A+M.length,E=Vw(M);return c({rule:u,state:h,from:A,to:{b:y},pasteEvt:E})}const w=p.doc.content.findDiffStart(h.doc.content),T=p.doc.content.findDiffEnd(h.doc.content);if(!(!Rw(w)||!T||w===T.b))return c({rule:u,state:h,from:w,to:T,pasteEvt:s})}}))}var us=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=kh(t),this.schema=Yk(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ss(e.name,this.schema)},o=ye(e,"addCommands",n);return o?{...t,...o()}:t},{})}get plugins(){const{editor:t}=this;return is([...this.extensions].reverse()).flatMap(o=>{const r={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:t,type:ss(o.name,this.schema)},i=[],s=ye(o,"addKeyboardShortcuts",r);let l={};if(o.type==="mark"&&ye(o,"exitable",r)&&(l.ArrowRight=()=>Vr.handleExit({editor:t,mark:o})),s){const p=Object.fromEntries(Object.entries(s()).map(([h,m])=>[h,()=>m({editor:t})]));l={...l,...p}}const c=ZE(l);i.push(c);const d=ye(o,"addInputRules",r);if(vh(o,t.options.enableInputRules)&&d){const p=d();if(p&&p.length){const h=Ow({editor:t,rules:p}),m=Array.isArray(h)?h:[h];i.push(...m)}}const u=ye(o,"addPasteRules",r);if(vh(o,t.options.enablePasteRules)&&u){const p=u();if(p&&p.length){const h=Bw({editor:t,rules:p});i.push(...h)}}const f=ye(o,"addProseMirrorPlugins",r);if(f){const p=f();i.push(...p)}return i})}get attributes(){return bh(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Xo(this.extensions);return Object.fromEntries(e.filter(n=>!!ye(n,"addNodeView")).map(n=>{const o=this.attributes.filter(c=>c.type===n.name),r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ot(n.name,this.schema)},i=ye(n,"addNodeView",r);if(!i)return[];const s=i();if(!s)return[];const l=(c,d,u,f,p)=>{const h=$r(c,o);return s({node:c,view:d,getPos:u,decorations:f,innerDecorations:p,editor:t,extension:n,HTMLAttributes:h})};return[n.name,l]}))}dispatchTransaction(t){const{editor:e}=this;return is([...this.extensions].reverse()).reduceRight((o,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:ss(r.name,this.schema)},s=ye(r,"dispatchTransaction",i);return s?l=>{s.call(i,{transaction:l,next:o})}:o},t)}get markViews(){const{editor:t}=this,{markExtensions:e}=Xo(this.extensions);return Object.fromEntries(e.filter(n=>!!ye(n,"addMarkView")).map(n=>{const o=this.attributes.filter(l=>l.type===n.name),r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Mn(n.name,this.schema)},i=ye(n,"addMarkView",r);if(!i)return[];const s=(l,c,d)=>{const u=$r(l,o);return i()({mark:l,view:c,inline:d,editor:t,extension:n,HTMLAttributes:u,updateAttributes:f=>{Qw(l,t,f)}})};return[n.name,s]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const o={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ss(e.name,this.schema)};e.type==="mark"&&((n=Ue(ye(e,"keepOnSplit",o)))==null||n)&&this.splittableMarks.push(e.name);const r=ye(e,"onBeforeCreate",o),i=ye(e,"onCreate",o),s=ye(e,"onUpdate",o),l=ye(e,"onSelectionUpdate",o),c=ye(e,"onTransaction",o),d=ye(e,"onFocus",o),u=ye(e,"onBlur",o),f=ye(e,"onDestroy",o);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}};us.resolve=kh,us.sort=is,us.flatten=$l;var Fw={};Dl(Fw,{ClipboardTextSerializer:()=>Ih,Commands:()=>Oh,Delete:()=>Dh,Drop:()=>Rh,Editable:()=>Ph,FocusEvents:()=>$h,Keymap:()=>Vh,Paste:()=>Bh,Tabindex:()=>Fh,TextDirection:()=>jh,focusEventsPluginKey:()=>Lh});var Kt=class Um extends Wl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new Um(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Ih=Kt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ot({key:new an("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:o,selection:r}=e,{ranges:i}=r,s=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),c=Sh(n);return wh(o,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),Oh=Kt.create({name:"commands",addCommands(){return{...ih}}}),Dh=Kt.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,o,r;const i=()=>{var s,l,c,d;if((d=(c=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:c.call(l,t))!=null?d:t.getMeta("y-sync$"))return;const u=mh(t.before,[t,...e]);Ch(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(m,b)=>{const g=b+m.nodeSize-2,x=h.oldRange.from<=b&&g<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:b,to:g,newFrom:u.mapping.map(b),newTo:u.mapping.map(g),deletedRange:h.oldRange,newRange:h.newRange,partial:!x,editor:this.editor,transaction:t,combinedTransform:u})})});const p=u.mapping;u.steps.forEach((h,m)=>{var b,g;if(h instanceof sn){const x=p.slice(m).map(h.from,-1),v=p.slice(m).map(h.to),w=p.invert().map(x,-1),T=p.invert().map(v),M=(b=u.doc.nodeAt(x-1))==null?void 0:b.marks.some(y=>y.eq(h.mark)),A=(g=u.doc.nodeAt(v))==null?void 0:g.marks.some(y=>y.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:w,to:T},newRange:{from:x,to:v},partial:!!(A||M),editor:this.editor,transaction:t,combinedTransform:u})}})};(r=(o=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:o.async)==null||r?setTimeout(i,0):i()}}),Rh=Kt.create({name:"drop",addProseMirrorPlugins(){return[new Ot({key:new an("tiptapDrop"),props:{handleDrop:(t,e,n,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:o})}}})]}}),Ph=Kt.create({name:"editable",addProseMirrorPlugins(){return[new Ot({key:new an("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Lh=new an("focusEvents"),$h=Kt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ot({key:Lh,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const o=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,n)=>{t.isFocused=!1;const o=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),Vh=Kt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:c,doc:d}=l,{empty:u,$anchor:f}=c,{pos:p,parent:h}=f,m=f.parent.isTextblock&&p>0?l.doc.resolve(p-1):f,b=m.parent.type.spec.isolating,g=f.pos-f.parentOffset,x=b&&m.parent.childCount===1?g===f.pos:Pe.atStart(d).from===p;return!u||!h.type.isTextblock||h.textContent.length||!x||x&&f.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),o={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...o},i={...o,"Ctrl-h":t,"Alt-Backspace":t,"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 es()||fh()?i:r},addProseMirrorPlugins(){return[new Ot({key:new an("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(b=>b.getMeta("composition")))return;const o=t.some(b=>b.docChanged)&&!e.doc.eq(n.doc),r=t.some(b=>b.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:s,to:l}=e.selection,c=Pe.atStart(e.doc).from,d=Pe.atEnd(e.doc).to;if(i||!(s===c&&l===d)||!jl(n.doc))return;const p=n.tr,h=Yi({state:n,transaction:p}),{commands:m}=new Qi({editor:this.editor,state:h});if(m.clearNodes(),!!p.steps.length)return p}})]}}),Bh=Kt.create({name:"paste",addProseMirrorPlugins(){return[new Ot({key:new an("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Fh=Kt.create({name:"tabindex",addProseMirrorPlugins(){return[new Ot({key:new an("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),jh=Kt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Xo(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ot({key:new an("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),jw=class or{constructor(e,n,o=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=o,this.resolvedPos=e,this.editor=n,this.currentNode=r}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 n=this.from,o=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}n=this.from+1,o=this.to-1}this.editor.commands.insertContentAt({from:n,to:o},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),n=this.resolvedPos.doc.resolve(e);return new or(n,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 or(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 or(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,o)=>{const r=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+o+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(s);if(!r&&l.depth<=this.depth)return;const c=new or(l,this.editor,r,r?n:null);r&&(c.actualDepth=this.depth+1),e.push(new or(l,this.editor,r,r?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let o=null,r=this.parent;for(;r&&!o;){if(r.node.type.name===e)if(Object.keys(n).length>0){const i=r.node.attrs,s=Object.keys(n);for(let l=0;l<s.length;l+=1){const c=s[l];if(i[c]!==n[c])break}}else o=r;r=r.parent}return o}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},o=!1){let r=[];if(!this.children||this.children.length===0)return r;const i=Object.keys(n);return this.children.forEach(s=>{o&&r.length>0||(s.node.type.name===e&&i.every(c=>n[c]===s.node.attrs[c])&&r.push(s),!(o&&r.length>0)&&(r=r.concat(s.querySelectorAll(e,n,o))))}),r}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},Uw=`.ProseMirror {
359
+ `,textSerializers:s={}}=n||{};let l="";return t.nodesBetween(o,r,(c,d,u,f)=>{var p;c.isBlock&&d>o&&(l+=i);const h=s?.[c.type.name];if(h)return u&&(l+=h({node:c,pos:d,parent:u,index:f,range:e})),!1;c.isText&&(l+=(p=c?.text)==null?void 0:p.slice(Math.max(o,d)-d,r-d))}),l}function Zk(t,e){const n={from:0,to:t.content.size};return wh(t,n,e)}function Sh(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function ew(t,e){const n=ot(e,t.schema),{from:o,to:r}=t.selection,i=[];t.doc.nodesBetween(o,r,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function Nh(t,e){const n=ns(typeof e=="string"?e:e.name,t.schema);return n==="node"?ew(t,e):n==="mark"?hh(t,e):{}}function tw(t,e=JSON.stringify){const n={};return t.filter(o=>{const r=e(o);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function nw(t){const e=tw(t);return e.length===1?e:e.filter((n,o)=>!e.filter((i,s)=>s!==o).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function Ch(t){const{mapping:e,steps:n}=t,o=[];return e.maps.forEach((r,i)=>{const s=[];if(r.ranges.length)r.forEach((l,c)=>{s.push({from:l,to:c})});else{const{from:l,to:c}=n[i];if(l===void 0||c===void 0)return;s.push({from:l,to:c})}s.forEach(({from:l,to:c})=>{const d=e.slice(i).map(l,-1),u=e.slice(i).map(c),f=e.invert().map(d,-1),p=e.invert().map(u);o.push({oldRange:{from:f,to:p},newRange:{from:d,to:u}})})}),nw(o)}function Bl(t,e,n){const o=[];return t===e?n.resolve(t).marks().forEach(r=>{const i=n.resolve(t),s=Pl(i,r.type);s&&o.push({mark:r,...s})}):n.nodesBetween(t,e,(r,i)=>{!r||r?.nodeSize===void 0||o.push(...r.marks.map(s=>({from:i,to:i+r.nodeSize,mark:s})))}),o}var ow=(t,e,n,o=20)=>{const r=t.doc.resolve(n);let i=o,s=null;for(;i>0&&s===null;){const l=r.node(i);l?.type.name===e?s=l:i-=1}return[s,i]};function ss(t,e){return e.nodes[t]||e.marks[t]||null}function as(t,e,n){return Object.fromEntries(Object.entries(n).filter(([o])=>{const r=t.find(i=>i.type===e&&i.name===o);return r?r.attribute.keepOnSplit:!1}))}var rw=(t,e=500)=>{let n="";const o=t.parentOffset;return t.parent.nodesBetween(Math.max(0,o-e),o,(r,i,s,l)=>{var c,d;const u=((d=(c=r.type.spec).toText)==null?void 0:d.call(c,{node:r,pos:i,parent:s,index:l}))||r.textContent||"%leaf%";n+=r.isAtom&&!r.isText?u:u.slice(0,Math.max(0,o-i))}),n};function Fl(t,e,n={}){const{empty:o,ranges:r}=t.selection,i=e?Mn(e,t.schema):null;if(o)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>i?i.name===f.type.name:!0).find(f=>Zi(f.attrs,n,{strict:!1}));let s=0;const l=[];if(r.forEach(({$from:f,$to:p})=>{const h=f.pos,m=p.pos;t.doc.nodesBetween(h,m,(b,g)=>{if(!b.isText&&!b.marks.length)return;const x=Math.max(h,g),v=Math.min(m,g+b.nodeSize),w=v-x;s+=w,l.push(...b.marks.map(T=>({mark:T,from:x,to:v})))})}),s===0)return!1;const c=l.filter(f=>i?i.name===f.mark.type.name:!0).filter(f=>Zi(f.mark.attrs,n,{strict:!1})).reduce((f,p)=>f+p.to-p.from,0),d=l.filter(f=>i?f.mark.type!==i&&f.mark.type.excludes(i):!0).reduce((f,p)=>f+p.to-p.from,0);return(c>0?c+d:c)>=s}function iw(t,e,n={}){if(!e)return io(t,null,n)||Fl(t,null,n);const o=ns(e,t.schema);return o==="node"?io(t,e,n):o==="mark"?Fl(t,e,n):!1}var sw=(t,e)=>{const{$from:n,$to:o,$anchor:r}=t.selection;if(e){const i=rs(l=>l.type.name===e)(t.selection);if(!i)return!1;const s=t.doc.resolve(i.pos+1);return r.pos+1===s.end()}return!(o.parentOffset<o.parent.nodeSize-2||n.pos!==o.pos)},aw=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function vh(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function Th(t,e){const{nodeExtensions:n}=Xo(e),o=n.find(s=>s.name===t);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=Ue(xe(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function jl(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var o;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((o=t.text)!=null?o:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let r=!0;return t.content.forEach(i=>{r!==!1&&(jl(i,{ignoreWhitespace:n,checkChildren:e})||(r=!1))}),r}return!1}var zh=class Fm{constructor(e){this.position=e}static fromJSON(e){return new Fm(e.position)}toJSON(){return{position:this.position}}};function lw(t,e){const n=e.mapping.mapResult(t.position);return{position:new zh(n.pos),mapResult:n}}function cw(t){return new zh(t)}function dw(t,e,n){var o;const{selection:r}=e;let i=null;if(lh(r)&&(i=r.$cursor),i){const l=(o=t.storedMarks)!=null?o:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(l)||!l.some(d=>d.type.excludes(n)))}const{ranges:s}=r;return s.some(({$from:l,$to:c})=>{let d=l.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(l.pos,c.pos,(u,f,p)=>{if(d)return!1;if(u.isInline){const h=!p||p.type.allowsMarkType(n),m=!!n.isInSet(u.marks)||!u.marks.some(b=>b.type.excludes(n));d=h&&m}return!d}),d})}var uw=(t,e={})=>({tr:n,state:o,dispatch:r})=>{const{selection:i}=n,{empty:s,ranges:l}=i,c=Mn(t,o.schema);if(r)if(s){const d=hh(o,c);n.addStoredMark(c.create({...d,...e}))}else l.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;o.doc.nodesBetween(u,f,(p,h)=>{const m=Math.max(h,u),b=Math.min(h+p.nodeSize,f);p.marks.find(x=>x.type===c)?p.marks.forEach(x=>{c===x.type&&n.addMark(m,b,c.create({...x.attrs,...e}))}):n.addMark(m,b,c.create(e))})});return dw(o,n,c)},fw=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),pw=(t,e={})=>({state:n,dispatch:o,chain:r})=>{const i=ot(t,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:l})=>Hf(i,{...s,...e})(n)?!0:l.clearNodes()).command(({state:l})=>Hf(i,{...s,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},hw=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,r=zo(t,0,o.content.size),i=Ce.create(o,r);e.setSelection(i)}return!0},mw=(t,e)=>({tr:n,state:o,dispatch:r})=>{const{selection:i}=o;let s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=i.from,l=i.to),r&&n.doc.nodesBetween(s,l,(c,d)=>{c.isText||n.setNodeMarkup(d,void 0,{...c.attrs,dir:t})}),!0},gw=t=>({tr:e,dispatch:n})=>{if(n){const{doc:o}=e,{from:r,to:i}=typeof t=="number"?{from:t,to:t}:t,s=Oe.atStart(o).from,l=Oe.atEnd(o).to,c=zo(r,s,l),d=zo(i,s,l),u=Oe.create(o,c,d);e.setSelection(u)}return!0},bw=t=>({state:e,dispatch:n})=>{const o=ot(t,e.schema);return cx(o)(e,n)};function _h(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const o=n.filter(r=>e?.includes(r.type.name));t.tr.ensureMarks(o)}}var yw=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:l,$to:c}=i,d=r.extensionManager.attributes,u=as(d,l.node().type.name,l.node().attrs);if(i instanceof Ce&&i.node.isBlock)return!l.parentOffset||!vn(s,l.pos)?!1:(o&&(t&&_h(n,r.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=c.parentOffset===c.parent.content.size,p=l.depth===0?void 0:Gk(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:u}]:void 0,m=vn(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&vn(e.doc,e.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:u}]:void 0),o){if(m&&(i instanceof Oe&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),p&&!f&&!l.parentOffset&&l.parent.type!==p)){const b=e.mapping.map(l.before()),g=e.doc.resolve(b);l.node(-1).canReplaceWith(g.index(),g.index()+1,p)&&e.setNodeMarkup(e.mapping.map(l.before()),p)}t&&_h(n,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},xw=(t,e={})=>({tr:n,state:o,dispatch:r,editor:i})=>{var s;const l=ot(t,o.schema),{$from:c,$to:d}=o.selection,u=o.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const f=c.node(-1);if(f.type!==l)return!1;const p=i.extensionManager.attributes;if(c.parent.content.size===0&&c.node(-1).childCount===c.indexAfter(-1)){if(c.depth===2||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(r){let x=oe.empty;const v=c.index(-1)?1:c.index(-2)?2:3;for(let E=c.depth-v;E>=c.depth-3;E-=1)x=oe.from(c.node(E).copy(x));const w=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,T={...as(p,c.node().type.name,c.node().attrs),...e},M=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(T))||void 0;x=x.append(oe.from(l.createAndFill(null,M)||void 0));const A=c.before(c.depth-(v-1));n.replace(A,c.after(-w),new fe(x,4-v,0));let y=-1;n.doc.nodesBetween(A,n.doc.content.size,(E,k)=>{if(y>-1)return!1;E.isTextblock&&E.content.size===0&&(y=k+1)}),y>-1&&n.setSelection(Oe.near(n.doc.resolve(y))),n.scrollIntoView()}return!0}const h=d.pos===c.end()?f.contentMatchAt(0).defaultType:null,m={...as(p,f.type.name,f.attrs),...e},b={...as(p,c.node().type.name,c.node().attrs),...e};n.delete(c.pos,d.pos);const g=h?[{type:l,attrs:m},{type:h,attrs:b}]:[{type:l,attrs:m}];if(!vn(n.doc,c.pos,2))return!1;if(r){const{selection:x,storedMarks:v}=o,{splittableMarks:w}=i.extensionManager,T=v||x.$to.parentOffset&&x.$from.marks();if(n.split(c.pos,2,g).scrollIntoView(),!T||!r)return!0;const M=T.filter(A=>w.includes(A.type.name));n.ensureMarks(M)}return!0},Ul=(t,e)=>{const n=rs(s=>s.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===r?.type&&Jn(t.doc,n.pos)&&t.join(n.pos),!0},Hl=(t,e)=>{const n=rs(s=>s.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(n.start).after(n.depth);if(o===void 0)return!0;const r=t.doc.nodeAt(o);return n.node.type===r?.type&&Jn(t.doc,o)&&t.join(o),!0},Ew=(t,e,n,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:c,commands:d,can:u})=>{const{extensions:f,splittableMarks:p}=r.extensionManager,h=ot(t,s.schema),m=ot(e,s.schema),{selection:b,storedMarks:g}=s,{$from:x,$to:v}=b,w=x.blockRange(v),T=g||b.$to.parentOffset&&b.$from.marks();if(!w)return!1;const M=rs(A=>Th(A.type.name,f))(b);if(w.depth>=1&&M&&w.depth-M.depth<=1){if(M.node.type===h)return d.liftListItem(m);if(Th(M.node.type.name,f)&&h.validContent(M.node.content)&&l)return c().command(()=>(i.setNodeMarkup(M.pos,h),!0)).command(()=>Ul(i,h)).command(()=>Hl(i,h)).run()}return!n||!T||!l?c().command(()=>u().wrapInList(h,o)?!0:d.clearNodes()).wrapInList(h,o).command(()=>Ul(i,h)).command(()=>Hl(i,h)).run():c().command(()=>{const A=u().wrapInList(h,o),y=T.filter(E=>p.includes(E.type.name));return i.ensureMarks(y),A?!0:d.clearNodes()}).wrapInList(h,o).command(()=>Ul(i,h)).command(()=>Hl(i,h)).run()},kw=(t,e={},n={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=n,s=Mn(t,o.schema);return Fl(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},ww=(t,e,n={})=>({state:o,commands:r})=>{const i=ot(t,o.schema),s=ot(e,o.schema),l=io(o,i,n);let c;return o.selection.$anchor.sameParent(o.selection.$head)&&(c=o.selection.$anchor.parent.attrs),l?r.setNode(s,c):r.setNode(i,{...c,...n})},Sw=(t,e={})=>({state:n,commands:o})=>{const r=ot(t,n.schema);return io(n,r,e)?o.lift(r):o.wrapIn(r,e)},Nw=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let o=0;o<n.length;o+=1){const r=n[o];let i;if(r.spec.isInputRules&&(i=r.getState(t))){if(e){const s=t.tr,l=i.transform;for(let c=l.steps.length-1;c>=0;c-=1)s.step(l.steps[c].invert(l.docs[c]));if(i.text){const c=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,c))}else s.delete(i.from,i.to)}return!0}}return!1},Cw=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:o,ranges:r}=n;return o||e&&r.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},vw=(t,e={})=>({tr:n,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=n,c=Mn(t,o.schema),{$from:d,empty:u,ranges:f}=l;if(!r)return!0;if(u&&s){let{from:p,to:h}=l;const m=(i=d.marks().find(g=>g.type===c))==null?void 0:i.attrs,b=Pl(d,c,m);b&&(p=b.from,h=b.to),n.removeMark(p,h,c)}else f.forEach(p=>{n.removeMark(p.$from.pos,p.$to.pos,c)});return n.removeStoredMark(c),!0},Tw=t=>({tr:e,state:n,dispatch:o})=>{const{selection:r}=n;let i,s;return typeof t=="number"?(i=t,s=t):t&&"from"in t&&"to"in t?(i=t.from,s=t.to):(i=r.from,s=r.to),o&&e.doc.nodesBetween(i,s,(l,c)=>{if(l.isText)return;const d={...l.attrs};delete d.dir,e.setNodeMarkup(c,void 0,d)}),!0},zw=(t,e={})=>({tr:n,state:o,dispatch:r})=>{let i=null,s=null;const l=ns(typeof t=="string"?t:t.name,o.schema);if(!l)return!1;l==="node"&&(i=ot(t,o.schema)),l==="mark"&&(s=Mn(t,o.schema));let c=!1;return n.selection.ranges.forEach(d=>{const u=d.$from.pos,f=d.$to.pos;let p,h,m,b;n.selection.empty?o.doc.nodesBetween(u,f,(g,x)=>{i&&i===g.type&&(c=!0,m=Math.max(x,u),b=Math.min(x+g.nodeSize,f),p=x,h=g)}):o.doc.nodesBetween(u,f,(g,x)=>{x<u&&i&&i===g.type&&(c=!0,m=Math.max(x,u),b=Math.min(x+g.nodeSize,f),p=x,h=g),x>=u&&x<=f&&(i&&i===g.type&&(c=!0,r&&n.setNodeMarkup(x,void 0,{...g.attrs,...e})),s&&g.marks.length&&g.marks.forEach(v=>{if(s===v.type&&(c=!0,r)){const w=Math.max(x,u),T=Math.min(x+g.nodeSize,f);n.addMark(w,T,s.create({...v.attrs,...e}))}}))}),h&&(p!==void 0&&r&&n.setNodeMarkup(p,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(g=>{s===g.type&&r&&n.addMark(m,b,s.create({...g.attrs,...e}))}))}),c},_w=(t,e={})=>({state:n,dispatch:o})=>{const r=ot(t,n.schema);return nx(r,e)(n,o)},Aw=(t,e={})=>({state:n,dispatch:o})=>{const r=ot(t,n.schema);return ox(r,e)(n,o)},Mw=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(o=>o.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(o=>o!==e):delete this.callbacks[t]),this}once(t,e){const n=(...o)=>{this.off(t,n),e.apply(this,o)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Ah=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},Iw=(t,e)=>{if(Rl(e))return e.exec(t);const n=e(t);if(!n)return null;const o=[n.text];return o.index=n.index,o.input=t,o.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(n.replaceWith)),o};function ls(t){var e;const{editor:n,from:o,to:r,text:i,rules:s,plugin:l}=t,{view:c}=n;if(c.composing)return!1;const d=c.state.doc.resolve(o);if(d.parent.type.spec.code||(e=d.nodeBefore||d.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let u=!1;const f=rw(d)+i;return s.forEach(p=>{if(u)return;const h=Iw(f,p.find);if(!h)return;const m=c.state.tr,b=Yi({state:c.state,transaction:m}),g={from:o-(h[0].length-i.length),to:r},{commands:x,chain:v,can:w}=new Qi({editor:n,state:b});p.handler({state:b,range:g,match:h,commands:x,chain:v,can:w})===null||!m.steps.length||(p.undoable&&m.setMeta(l,{transform:m,from:o,to:r,text:i}),c.dispatch(m),u=!0)}),u}function Ow(t){const{editor:e,rules:n}=t,o=new Ot({state:{init(){return null},apply(r,i,s){const l=r.getMeta(o);if(l)return l;const c=r.getMeta("applyInputRules");return c&&setTimeout(()=>{let{text:u}=c;typeof u=="string"?u=u:u=Vl(oe.from(u),s.schema);const{from:f}=c,p=f+u.length;ls({editor:e,from:f,to:p,text:u,rules:n,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,s,l){return ls({editor:e,from:i,to:s,text:l,rules:n,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&ls({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:o})}),!1)},handleKeyDown(r,i){if(i.key!=="Enter")return!1;const{$cursor:s}=r.state.selection;return s?ls({editor:e,from:s.pos,to:s.pos,text:`
360
+ `,rules:n,plugin:o}):!1}},isInputRules:!0});return o}function Dw(t){return Object.prototype.toString.call(t).slice(8,-1)}function cs(t){return Dw(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Mh(t,e){const n={...t};return cs(t)&&cs(e)&&Object.keys(e).forEach(o=>{cs(e[o])&&cs(t[o])?n[o]=Mh(t[o],e[o]):n[o]=e[o]}),n}var Wl=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...Ue(xe(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Ue(xe(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>Mh(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},Vr=class jm extends Wl{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new jm(n)}static handleExit({editor:e,mark:n}){const{tr:o}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const s=r.marks();if(!!!s.find(d=>d?.type.name===n.name))return!1;const c=s.find(d=>d?.type.name===n.name);return c&&o.removeStoredMark(c),o.insertText(" ",r.pos),e.view.dispatch(o),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function Rw(t){return typeof t=="number"}var Pw=class{constructor(t){this.find=t.find,this.handler=t.handler}},Lw=(t,e,n)=>{if(Rl(e))return[...t.matchAll(e)];const o=e(t,n);return o?o.map(r=>{const i=[r.text];return i.index=r.index,i.input=t,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function $w(t){const{editor:e,state:n,from:o,to:r,rule:i,pasteEvent:s,dropEvent:l}=t,{commands:c,chain:d,can:u}=new Qi({editor:e,state:n}),f=[];return n.doc.nodesBetween(o,r,(h,m)=>{var b,g,x,v,w;if((g=(b=h.type)==null?void 0:b.spec)!=null&&g.code||!(h.isText||h.isTextblock||h.isInline))return;const T=(w=(v=(x=h.content)==null?void 0:x.size)!=null?v:h.nodeSize)!=null?w:0,M=Math.max(o,m),A=Math.min(r,m+T);if(M>=A)return;const y=h.isText?h.text||"":h.textBetween(M-m,A-m,void 0,"");Lw(y,i.find,s).forEach(k=>{if(k.index===void 0)return;const O=M+k.index+1,G=O+k[0].length,z={from:n.tr.mapping.map(O),to:n.tr.mapping.map(G)},R=i.handler({state:n,range:z,match:k,commands:c,chain:d,can:u,pasteEvent:s,dropEvent:l});f.push(R)})}),f.every(h=>h!==null)}var ds=null,Vw=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function Bw(t){const{editor:e,rules:n}=t;let o=null,r=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const c=({state:u,from:f,to:p,rule:h,pasteEvt:m})=>{const b=u.tr,g=Yi({state:u,transaction:b});if(!(!$w({editor:e,state:g,from:Math.max(f-1,0),to:p.b-1,rule:h,pasteEvent:m,dropEvent:l})||!b.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,b}};return n.map(u=>new Ot({view(f){const p=m=>{var b;o=(b=f.dom.parentElement)!=null&&b.contains(m.target)?f.dom.parentElement:null,o&&(ds=e)},h=()=>{ds&&(ds=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(f,p)=>{if(i=o===f.dom.parentElement,l=p,!i){const h=ds;h?.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,p)=>{var h;const m=(h=p.clipboardData)==null?void 0:h.getData("text/html");return s=p,r=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(f,p,h)=>{const m=f[0],b=m.getMeta("uiEvent")==="paste"&&!r,g=m.getMeta("uiEvent")==="drop"&&!i,x=m.getMeta("applyPasteRules"),v=!!x;if(!b&&!g&&!v)return;if(v){let{text:M}=x;typeof M=="string"?M=M:M=Vl(oe.from(M),h.schema);const{from:A}=x,y=A+M.length,E=Vw(M);return c({rule:u,state:h,from:A,to:{b:y},pasteEvt:E})}const w=p.doc.content.findDiffStart(h.doc.content),T=p.doc.content.findDiffEnd(h.doc.content);if(!(!Rw(w)||!T||w===T.b))return c({rule:u,state:h,from:w,to:T,pasteEvt:s})}}))}var us=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=kh(t),this.schema=Yk(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ss(e.name,this.schema)},o=xe(e,"addCommands",n);return o?{...t,...o()}:t},{})}get plugins(){const{editor:t}=this;return is([...this.extensions].reverse()).flatMap(o=>{const r={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:t,type:ss(o.name,this.schema)},i=[],s=xe(o,"addKeyboardShortcuts",r);let l={};if(o.type==="mark"&&xe(o,"exitable",r)&&(l.ArrowRight=()=>Vr.handleExit({editor:t,mark:o})),s){const p=Object.fromEntries(Object.entries(s()).map(([h,m])=>[h,()=>m({editor:t})]));l={...l,...p}}const c=ZE(l);i.push(c);const d=xe(o,"addInputRules",r);if(vh(o,t.options.enableInputRules)&&d){const p=d();if(p&&p.length){const h=Ow({editor:t,rules:p}),m=Array.isArray(h)?h:[h];i.push(...m)}}const u=xe(o,"addPasteRules",r);if(vh(o,t.options.enablePasteRules)&&u){const p=u();if(p&&p.length){const h=Bw({editor:t,rules:p});i.push(...h)}}const f=xe(o,"addProseMirrorPlugins",r);if(f){const p=f();i.push(...p)}return i})}get attributes(){return bh(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Xo(this.extensions);return Object.fromEntries(e.filter(n=>!!xe(n,"addNodeView")).map(n=>{const o=this.attributes.filter(c=>c.type===n.name),r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:ot(n.name,this.schema)},i=xe(n,"addNodeView",r);if(!i)return[];const s=i();if(!s)return[];const l=(c,d,u,f,p)=>{const h=$r(c,o);return s({node:c,view:d,getPos:u,decorations:f,innerDecorations:p,editor:t,extension:n,HTMLAttributes:h})};return[n.name,l]}))}dispatchTransaction(t){const{editor:e}=this;return is([...this.extensions].reverse()).reduceRight((o,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:ss(r.name,this.schema)},s=xe(r,"dispatchTransaction",i);return s?l=>{s.call(i,{transaction:l,next:o})}:o},t)}get markViews(){const{editor:t}=this,{markExtensions:e}=Xo(this.extensions);return Object.fromEntries(e.filter(n=>!!xe(n,"addMarkView")).map(n=>{const o=this.attributes.filter(l=>l.type===n.name),r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Mn(n.name,this.schema)},i=xe(n,"addMarkView",r);if(!i)return[];const s=(l,c,d)=>{const u=$r(l,o);return i()({mark:l,view:c,inline:d,editor:t,extension:n,HTMLAttributes:u,updateAttributes:f=>{Qw(l,t,f)}})};return[n.name,s]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const o={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:ss(e.name,this.schema)};e.type==="mark"&&((n=Ue(xe(e,"keepOnSplit",o)))==null||n)&&this.splittableMarks.push(e.name);const r=xe(e,"onBeforeCreate",o),i=xe(e,"onCreate",o),s=xe(e,"onUpdate",o),l=xe(e,"onSelectionUpdate",o),c=xe(e,"onTransaction",o),d=xe(e,"onFocus",o),u=xe(e,"onBlur",o),f=xe(e,"onDestroy",o);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),c&&this.editor.on("transaction",c),d&&this.editor.on("focus",d),u&&this.editor.on("blur",u),f&&this.editor.on("destroy",f)})}};us.resolve=kh,us.sort=is,us.flatten=$l;var Fw={};Dl(Fw,{ClipboardTextSerializer:()=>Ih,Commands:()=>Oh,Delete:()=>Dh,Drop:()=>Rh,Editable:()=>Ph,FocusEvents:()=>$h,Keymap:()=>Vh,Paste:()=>Bh,Tabindex:()=>Fh,TextDirection:()=>jh,focusEventsPluginKey:()=>Lh});var Kt=class Um extends Wl{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new Um(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},Ih=Kt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ot({key:new an("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:o,selection:r}=e,{ranges:i}=r,s=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),c=Sh(n);return wh(o,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),Oh=Kt.create({name:"commands",addCommands(){return{...ih}}}),Dh=Kt.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,o,r;const i=()=>{var s,l,c,d;if((d=(c=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:c.call(l,t))!=null?d:t.getMeta("y-sync$"))return;const u=mh(t.before,[t,...e]);Ch(u).forEach(h=>{u.mapping.mapResult(h.oldRange.from).deletedAfter&&u.mapping.mapResult(h.oldRange.to).deletedBefore&&u.before.nodesBetween(h.oldRange.from,h.oldRange.to,(m,b)=>{const g=b+m.nodeSize-2,x=h.oldRange.from<=b&&g<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:b,to:g,newFrom:u.mapping.map(b),newTo:u.mapping.map(g),deletedRange:h.oldRange,newRange:h.newRange,partial:!x,editor:this.editor,transaction:t,combinedTransform:u})})});const p=u.mapping;u.steps.forEach((h,m)=>{var b,g;if(h instanceof sn){const x=p.slice(m).map(h.from,-1),v=p.slice(m).map(h.to),w=p.invert().map(x,-1),T=p.invert().map(v),M=(b=u.doc.nodeAt(x-1))==null?void 0:b.marks.some(y=>y.eq(h.mark)),A=(g=u.doc.nodeAt(v))==null?void 0:g.marks.some(y=>y.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:w,to:T},newRange:{from:x,to:v},partial:!!(A||M),editor:this.editor,transaction:t,combinedTransform:u})}})};(r=(o=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:o.async)==null||r?setTimeout(i,0):i()}}),Rh=Kt.create({name:"drop",addProseMirrorPlugins(){return[new Ot({key:new an("tiptapDrop"),props:{handleDrop:(t,e,n,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:o})}}})]}}),Ph=Kt.create({name:"editable",addProseMirrorPlugins(){return[new Ot({key:new an("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Lh=new an("focusEvents"),$h=Kt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ot({key:Lh,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const o=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,n)=>{t.isFocused=!1;const o=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),Vh=Kt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:c,doc:d}=l,{empty:u,$anchor:f}=c,{pos:p,parent:h}=f,m=f.parent.isTextblock&&p>0?l.doc.resolve(p-1):f,b=m.parent.type.spec.isolating,g=f.pos-f.parentOffset,x=b&&m.parent.childCount===1?g===f.pos:Le.atStart(d).from===p;return!u||!h.type.isTextblock||h.textContent.length||!x||x&&f.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),o={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...o},i={...o,"Ctrl-h":t,"Alt-Backspace":t,"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 es()||fh()?i:r},addProseMirrorPlugins(){return[new Ot({key:new an("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(b=>b.getMeta("composition")))return;const o=t.some(b=>b.docChanged)&&!e.doc.eq(n.doc),r=t.some(b=>b.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:s,to:l}=e.selection,c=Le.atStart(e.doc).from,d=Le.atEnd(e.doc).to;if(i||!(s===c&&l===d)||!jl(n.doc))return;const p=n.tr,h=Yi({state:n,transaction:p}),{commands:m}=new Qi({editor:this.editor,state:h});if(m.clearNodes(),!!p.steps.length)return p}})]}}),Bh=Kt.create({name:"paste",addProseMirrorPlugins(){return[new Ot({key:new an("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Fh=Kt.create({name:"tabindex",addProseMirrorPlugins(){return[new Ot({key:new an("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),jh=Kt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Xo(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ot({key:new an("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),jw=class or{constructor(e,n,o=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=o,this.resolvedPos=e,this.editor=n,this.currentNode=r}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 n=this.from,o=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}n=this.from+1,o=this.to-1}this.editor.commands.insertContentAt({from:n,to:o},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),n=this.resolvedPos.doc.resolve(e);return new or(n,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 or(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 or(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,o)=>{const r=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=this.pos+o+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(s);if(!r&&l.depth<=this.depth)return;const c=new or(l,this.editor,r,r?n:null);r&&(c.actualDepth=this.depth+1),e.push(new or(l,this.editor,r,r?n:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let o=null,r=this.parent;for(;r&&!o;){if(r.node.type.name===e)if(Object.keys(n).length>0){const i=r.node.attrs,s=Object.keys(n);for(let l=0;l<s.length;l+=1){const c=s[l];if(i[c]!==n[c])break}}else o=r;r=r.parent}return o}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},o=!1){let r=[];if(!this.children||this.children.length===0)return r;const i=Object.keys(n);return this.children.forEach(s=>{o&&r.length>0||(s.node.type.name===e&&i.every(c=>n[c]===s.node.attrs[c])&&r.push(s),!(o&&r.length>0)&&(r=r.concat(s.querySelectorAll(e,n,o))))}),r}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},Uw=`.ProseMirror {
361
361
  position: relative;
362
362
  }
363
363
 
@@ -429,7 +429,7 @@ img.ProseMirror-separator {
429
429
  display: block;
430
430
  }`;function Hw(t,e,n){const o=document.querySelector("style[data-tiptap-style]");if(o!==null)return o;const r=document.createElement("style");return e&&r.setAttribute("nonce",e),r.setAttribute("data-tiptap-style",""),r.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(r),r}var Ww=class extends Mw{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!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:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:lw,createMappablePosition:cw},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:r,slice:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const n=this.createDoc(),o=ch(n,this.options.autofocus);this.editorState=jo.create({doc:n,schema:this.schema,selection:o||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?.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=Hw(Uw,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,n=!0){this.setOptions({editable:e}),n&&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,n)=>{if(this.editorView)return this.editorView[n];if(n==="state")return this.editorState;if(n in e)return Reflect.get(e,n);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${n}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,n){const o=gh(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const n=this.state.plugins;let o=n;if([].concat(e).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;o=o.filter(l=>!l.key.startsWith(s))}),n.length===o.length)return;const r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}createExtensionManager(){var e,n;const r=[...this.options.enableCoreExtensions?[Ph,Ih.configure({blockSeparator:(n=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:n.blockSeparator}),Oh,$h,Vh,Fh,Rh,Bh,Dh,jh.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new us(r,this)}createCommandManager(){this.commandManager=new Qi({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Ll(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(n){if(!(n instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(n.message))throw n;this.emit("contentError",{editor:this,error:n,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(o=>o.name!=="collaboration"),this.createExtensionManager()}}),e=Ll(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:n,enableExtensionDispatchTransaction:o}=this.options,r=n.dispatchTransaction||this.dispatchTransaction.bind(this),i=o?this.extensionManager.dispatchTransaction(r):r;this.editorView=new Zp(e,{...n,attributes:{role:"textbox",...n?.attributes},dispatchTransaction:i,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();const l=this.view.dom;l.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 n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(u=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(u)});return}const{state:n,transactions:o}=this.state.applyTransaction(e),r=!this.state.selection.eq(n.selection),i=o.includes(e),s=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:n}),!i)return;this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:o.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const l=o.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),c=l?.getMeta("focus"),d=l?.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:l}),d&&this.emit("blur",{editor:this,event:d.event,transaction:l}),!(e.getMeta("preventUpdate")||!o.some(u=>u.docChanged)||s.doc.eq(n.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:o.slice(1)})}getAttributes(e){return Nh(this.state,e)}isActive(e,n){const o=typeof e=="string"?e:null,r=typeof e=="string"?n:e;return iw(this.state,o,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Vl(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:n=`
431
431
 
432
- `,textSerializers:o={}}=e||{};return Zk(this.state.doc,{blockSeparator:n,textSerializers:{...Sh(this.schema),...o}})}get isEmpty(){return jl(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,n;return(n=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?n:!0}$node(e,n){var o;return((o=this.$doc)==null?void 0:o.querySelector(e,n))||null}$nodes(e,n){var o;return((o=this.$doc)==null?void 0:o.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new jw(n,this)}get $doc(){return this.$pos(0)}};function Br(t){return new Ah({find:t.find,handler:({state:e,range:n,match:o})=>{const r=Ue(t.getAttributes,void 0,o);if(r===!1||r===null)return null;const{tr:i}=e,s=o[o.length-1],l=o[0];if(s){const c=l.search(/\S/),d=n.from+l.indexOf(s),u=d+s.length;if(Bl(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(b=>b===t.type&&b!==h.mark.type)).filter(h=>h.to>d).length)return null;u<n.to&&i.delete(u,n.to),d>n.from&&i.delete(n.from+c,d);const p=n.from+c+s.length;i.addMark(n.from+c,p,t.type.create(r||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function Fr(t){return new Ah({find:t.find,handler:({state:e,range:n,match:o,chain:r})=>{const i=Ue(t.getAttributes,void 0,o)||{},s=e.tr.delete(n.from,n.to),c=s.doc.resolve(n.from).blockRange(),d=c&&Xa(c,t.type,i);if(!d)return null;if(s.wrap(c,d),t.keepMarks&&t.editor){const{selection:f,storedMarks:p}=e,{splittableMarks:h}=t.editor.extensionManager,m=p||f.$to.parentOffset&&f.$from.marks();if(m){const b=m.filter(g=>h.includes(g.type.name));s.ensureMarks(b)}}if(t.keepAttributes){const f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(f,i).run()}const u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&Jn(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(o,u))&&s.join(n.from-1)},undoable:t.undoable})}var Gw={};Dl(Gw,{createAtomBlockMarkdownSpec:()=>qw,createBlockMarkdownSpec:()=>Kw,createInlineMarkdownSpec:()=>Yw,parseAttributes:()=>Gl,parseIndentedBlocks:()=>Kl,renderNestedMarkdownContent:()=>Jl,serializeAttributes:()=>ql});function Gl(t){if(!t?.trim())return{};const e={},n=[],o=t.replace(/["']([^"']*)["']/g,d=>(n.push(d),`__QUOTED_${n.length-1}__`)),r=o.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(r){const d=r.map(u=>u.trim().slice(1));e.class=d.join(" ")}const i=o.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(o.matchAll(s)).forEach(([,d,u])=>{var f;const p=parseInt(((f=u.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),h=n[p];h&&(e[d]=h.slice(1,-1))});const c=o.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return c&&c.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function ql(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(o=>e.push(`.${o}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,o])=>{n==="class"||n==="id"||(o===!0?e.push(n):o!==!1&&o!=null&&e.push(`${n}="${String(o)}"`))}),e.join(" ")}function qw(t){const{nodeName:e,name:n,parseAttributes:o=Gl,serializeAttributes:r=ql,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=t,c=n||e,d=u=>{if(!l)return u;const f={};return l.forEach(p=>{p in u&&(f[p]=u[p])}),f};return{parseMarkdown:(u,f)=>{const p={...i,...u.attributes};return f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(u){var f;const p=new RegExp(`^:::${c}(?:\\s|$)`,"m"),h=(f=u.match(p))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(u,f,p){const h=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=u.match(h);if(!m)return;const b=m[1]||"",g=o(b);if(!s.find(v=>!(v in g)))return{type:e,raw:m[0],attributes:g}}},renderMarkdown:u=>{const f=d(u.attrs||{}),p=r(f),h=p?` {${p}}`:"";return`:::${c}${h} :::`}}}function Kw(t){const{nodeName:e,name:n,getContent:o,parseAttributes:r=Gl,serializeAttributes:i=ql,defaultAttributes:s={},content:l="block",allowedAttributes:c}=t,d=n||e,u=f=>{if(!c)return f;const p={};return c.forEach(h=>{h in f&&(p[h]=f[h])}),p};return{parseMarkdown:(f,p)=>{let h;if(o){const b=o(f);h=typeof b=="string"?[{type:"text",text:b}]:b}else l==="block"?h=p.parseChildren(f.tokens||[]):h=p.parseInline(f.tokens||[]);const m={...s,...f.attributes};return p.createNode(e,m,h)},markdownTokenizer:{name:e,level:"block",start(f){var p;const h=new RegExp(`^:::${d}`,"m"),m=(p=f.match(h))==null?void 0:p.index;return m!==void 0?m:-1},tokenize(f,p,h){var m;const b=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=f.match(b);if(!g)return;const[x,v=""]=g,w=r(v);let T=1;const M=x.length;let A="";const y=/^:::([\w-]*)(\s.*)?/gm,E=f.slice(M);for(y.lastIndex=0;;){const S=y.exec(E);if(S===null)break;const D=S.index,W=S[1];if(!((m=S[2])!=null&&m.endsWith(":::"))){if(W)T+=1;else if(T-=1,T===0){const z=E.slice(0,D);A=z.trim();const P=f.slice(0,M+D+S[0].length);let V=[];if(A)if(l==="block")for(V=h.blockTokens(z),V.forEach(j=>{j.text&&(!j.tokens||j.tokens.length===0)&&(j.tokens=h.inlineTokens(j.text))});V.length>0;){const j=V[V.length-1];if(j.type==="paragraph"&&(!j.text||j.text.trim()===""))V.pop();else break}else V=h.inlineTokens(A);return{type:e,raw:P,attributes:w,content:A,tokens:V}}}}}},renderMarkdown:(f,p)=>{const h=u(f.attrs||{}),m=i(h),b=m?` {${m}}`:"",g=p.renderChildren(f.content||[],`
432
+ `,textSerializers:o={}}=e||{};return Zk(this.state.doc,{blockSeparator:n,textSerializers:{...Sh(this.schema),...o}})}get isEmpty(){return jl(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,n;return(n=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?n:!0}$node(e,n){var o;return((o=this.$doc)==null?void 0:o.querySelector(e,n))||null}$nodes(e,n){var o;return((o=this.$doc)==null?void 0:o.querySelectorAll(e,n))||null}$pos(e){const n=this.state.doc.resolve(e);return new jw(n,this)}get $doc(){return this.$pos(0)}};function Br(t){return new Ah({find:t.find,handler:({state:e,range:n,match:o})=>{const r=Ue(t.getAttributes,void 0,o);if(r===!1||r===null)return null;const{tr:i}=e,s=o[o.length-1],l=o[0];if(s){const c=l.search(/\S/),d=n.from+l.indexOf(s),u=d+s.length;if(Bl(n.from,n.to,e.doc).filter(h=>h.mark.type.excluded.find(b=>b===t.type&&b!==h.mark.type)).filter(h=>h.to>d).length)return null;u<n.to&&i.delete(u,n.to),d>n.from&&i.delete(n.from+c,d);const p=n.from+c+s.length;i.addMark(n.from+c,p,t.type.create(r||{})),i.removeStoredMark(t.type)}},undoable:t.undoable})}function Fr(t){return new Ah({find:t.find,handler:({state:e,range:n,match:o,chain:r})=>{const i=Ue(t.getAttributes,void 0,o)||{},s=e.tr.delete(n.from,n.to),c=s.doc.resolve(n.from).blockRange(),d=c&&Xa(c,t.type,i);if(!d)return null;if(s.wrap(c,d),t.keepMarks&&t.editor){const{selection:f,storedMarks:p}=e,{splittableMarks:h}=t.editor.extensionManager,m=p||f.$to.parentOffset&&f.$from.marks();if(m){const b=m.filter(g=>h.includes(g.type.name));s.ensureMarks(b)}}if(t.keepAttributes){const f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(f,i).run()}const u=s.doc.resolve(n.from-1).nodeBefore;u&&u.type===t.type&&Jn(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(o,u))&&s.join(n.from-1)},undoable:t.undoable})}var Gw={};Dl(Gw,{createAtomBlockMarkdownSpec:()=>qw,createBlockMarkdownSpec:()=>Kw,createInlineMarkdownSpec:()=>Yw,parseAttributes:()=>Gl,parseIndentedBlocks:()=>Kl,renderNestedMarkdownContent:()=>Jl,serializeAttributes:()=>ql});function Gl(t){if(!t?.trim())return{};const e={},n=[],o=t.replace(/["']([^"']*)["']/g,d=>(n.push(d),`__QUOTED_${n.length-1}__`)),r=o.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(r){const d=r.map(u=>u.trim().slice(1));e.class=d.join(" ")}const i=o.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(o.matchAll(s)).forEach(([,d,u])=>{var f;const p=parseInt(((f=u.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),h=n[p];h&&(e[d]=h.slice(1,-1))});const c=o.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return c&&c.split(/\s+/).filter(Boolean).forEach(u=>{u.match(/^[a-zA-Z][\w-]*$/)&&(e[u]=!0)}),e}function ql(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(o=>e.push(`.${o}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,o])=>{n==="class"||n==="id"||(o===!0?e.push(n):o!==!1&&o!=null&&e.push(`${n}="${String(o)}"`))}),e.join(" ")}function qw(t){const{nodeName:e,name:n,parseAttributes:o=Gl,serializeAttributes:r=ql,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=t,c=n||e,d=u=>{if(!l)return u;const f={};return l.forEach(p=>{p in u&&(f[p]=u[p])}),f};return{parseMarkdown:(u,f)=>{const p={...i,...u.attributes};return f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(u){var f;const p=new RegExp(`^:::${c}(?:\\s|$)`,"m"),h=(f=u.match(p))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(u,f,p){const h=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=u.match(h);if(!m)return;const b=m[1]||"",g=o(b);if(!s.find(v=>!(v in g)))return{type:e,raw:m[0],attributes:g}}},renderMarkdown:u=>{const f=d(u.attrs||{}),p=r(f),h=p?` {${p}}`:"";return`:::${c}${h} :::`}}}function Kw(t){const{nodeName:e,name:n,getContent:o,parseAttributes:r=Gl,serializeAttributes:i=ql,defaultAttributes:s={},content:l="block",allowedAttributes:c}=t,d=n||e,u=f=>{if(!c)return f;const p={};return c.forEach(h=>{h in f&&(p[h]=f[h])}),p};return{parseMarkdown:(f,p)=>{let h;if(o){const b=o(f);h=typeof b=="string"?[{type:"text",text:b}]:b}else l==="block"?h=p.parseChildren(f.tokens||[]):h=p.parseInline(f.tokens||[]);const m={...s,...f.attributes};return p.createNode(e,m,h)},markdownTokenizer:{name:e,level:"block",start(f){var p;const h=new RegExp(`^:::${d}`,"m"),m=(p=f.match(h))==null?void 0:p.index;return m!==void 0?m:-1},tokenize(f,p,h){var m;const b=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=f.match(b);if(!g)return;const[x,v=""]=g,w=r(v);let T=1;const M=x.length;let A="";const y=/^:::([\w-]*)(\s.*)?/gm,E=f.slice(M);for(y.lastIndex=0;;){const k=y.exec(E);if(k===null)break;const O=k.index,G=k[1];if(!((m=k[2])!=null&&m.endsWith(":::"))){if(G)T+=1;else if(T-=1,T===0){const z=E.slice(0,O);A=z.trim();const R=f.slice(0,M+O+k[0].length);let W=[];if(A)if(l==="block")for(W=h.blockTokens(z),W.forEach(H=>{H.text&&(!H.tokens||H.tokens.length===0)&&(H.tokens=h.inlineTokens(H.text))});W.length>0;){const H=W[W.length-1];if(H.type==="paragraph"&&(!H.text||H.text.trim()===""))W.pop();else break}else W=h.inlineTokens(A);return{type:e,raw:R,attributes:w,content:A,tokens:W}}}}}},renderMarkdown:(f,p)=>{const h=u(f.attrs||{}),m=i(h),b=m?` {${m}}`:"",g=p.renderChildren(f.content||[],`
433
433
 
434
434
  `);return`:::${d}${b}
435
435
 
@@ -438,7 +438,7 @@ ${g}
438
438
  :::`}}}function Jw(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let o=n.exec(t);for(;o!==null;){const[,r,i,s]=o;e[r]=i||s,o=n.exec(t)}return e}function Xw(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function Yw(t){const{nodeName:e,name:n,getContent:o,parseAttributes:r=Jw,serializeAttributes:i=Xw,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:c}=t,d=n||e,u=p=>{if(!c)return p;const h={};return c.forEach(m=>{const b=typeof m=="string"?m:m.name,g=typeof m=="string"?void 0:m.skipIfDefault;if(b in p){const x=p[b];if(g!==void 0&&x===g)return;h[b]=x}}),h},f=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,h)=>{const m={...s,...p.attributes};if(l)return h.createNode(e,m);const b=o?o(p):p.content||"";return b?h.createNode(e,m,[h.createTextNode(b)]):h.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(p){const h=l?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=p.match(h),b=m?.index;return b!==void 0?b:-1},tokenize(p,h,m){const b=l?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),g=p.match(b);if(!g)return;let x="",v="";if(l){const[,T]=g;v=T}else{const[,T,M]=g;v=T,x=M||""}const w=r(v.trim());return{type:e,raw:g[0],content:x.trim(),attributes:w}}},renderMarkdown:p=>{let h="";o?h=o(p):p.content&&p.content.length>0&&(h=p.content.filter(x=>x.type==="text").map(x=>x.text).join(""));const m=u(p.attrs||{}),b=i(m),g=b?` ${b}`:"";return l?`[${d}${g}]`:`[${d}${g}]${h}[/${d}]`}}}function Kl(t,e,n){var o,r,i,s;const l=t.split(`
439
439
  `),c=[];let d="",u=0;const f=e.baseIndentSize||2;for(;u<l.length;){const p=l[u],h=p.match(e.itemPattern);if(!h){if(c.length>0)break;if(p.trim()===""){u+=1,d=`${d}${p}
440
440
  `;continue}else return}const m=e.extractItemData(h),{indentLevel:b,mainContent:g}=m;d=`${d}${p}
441
- `;const x=[g];for(u+=1;u<l.length;){const M=l[u];if(M.trim()===""){const y=l.slice(u+1).findIndex(D=>D.trim()!=="");if(y===-1)break;if((((r=(o=l[u+1+y].match(/^(\s*)/))==null?void 0:o[1])==null?void 0:r.length)||0)>b){x.push(M),d=`${d}${M}
441
+ `;const x=[g];for(u+=1;u<l.length;){const M=l[u];if(M.trim()===""){const y=l.slice(u+1).findIndex(O=>O.trim()!=="");if(y===-1)break;if((((r=(o=l[u+1+y].match(/^(\s*)/))==null?void 0:o[1])==null?void 0:r.length)||0)>b){x.push(M),d=`${d}${M}
442
442
  `,u+=1;continue}else break}if((((s=(i=M.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:s.length)||0)>b)x.push(M),d=`${d}${M}
443
443
  `,u+=1;else break}let v;const w=x.slice(1);if(w.length>0){const M=w.map(A=>A.slice(b+f)).join(`
444
444
  `);M.trim()&&(e.customNestedParser?v=e.customNestedParser(M):v=n.blockTokens(M))}const T=e.createToken(m,v);c.push(T)}if(c.length!==0)return{items:c,raw:d}}function Jl(t,e,n,o){if(!t||!Array.isArray(t.content))return"";const r=typeof n=="function"?n(o):n,[i,...s]=t.content,l=e.renderChildren([i]),c=[`${r}${l}`];return s&&s.length>0&&s.forEach(d=>{const u=e.renderChildren([d]);if(u){const f=u.split(`
@@ -459,20 +459,20 @@ ${h.slice(d+2)}`,f+=1;else break}e.push({indent:d,number:parseInt(l,10),content:
459
459
  `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(OS,this.editor.getAttributes(nm)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Fr({find:om,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Fr({find:om,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(nm)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),DS=/^\s*(\[([( |x])?\])\s$/,RS=In.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:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",Rt(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const o=e.parseChildren(t.nestedTokens);n.push(...o)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const r=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return Jl(t,e,r)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:o})=>{const r=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),c=document.createElement("div"),d=f=>{var p,h;l.ariaLabel=((h=(p=this.options.a11y)==null?void 0:p.checkboxLabel)==null?void 0:h.call(p,f,l.checked))||`Task item checkbox for ${f.textContent||"empty task item"}`};d(t),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",f=>f.preventDefault()),l.addEventListener("change",f=>{if(!o.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:p}=f.target;o.isEditable&&typeof n=="function"&&o.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const m=n();if(typeof m!="number")return!1;const b=h.doc.nodeAt(m);return h.setNodeMarkup(m,void 0,{...b?.attrs,checked:p}),!0}).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,p)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{r.setAttribute(f,p)}),r.dataset.checked=t.attrs.checked,l.checked=t.attrs.checked,i.append(l,s),r.append(i,c),Object.entries(e).forEach(([f,p])=>{r.setAttribute(f,p)});let u=new Set(Object.keys(e));return{dom:r,contentDOM:c,update:f=>{if(f.type!==this.type)return!1;r.dataset.checked=f.attrs.checked,l.checked=f.attrs.checked,d(f);const p=o.extensionManager.attributes,h=$r(f,p),m=new Set(Object.keys(h)),b=this.options.HTMLAttributes;return u.forEach(g=>{m.has(g)||(g in b?r.setAttribute(g,b[g]):r.removeAttribute(g))}),Object.entries(h).forEach(([g,x])=>{x==null?g in b?r.setAttribute(g,b[g]):r.removeAttribute(g):r.setAttribute(g,x)}),u=m,!0}}}},addInputRules(){return[Fr({find:DS,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),PS=In.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:t}){return["ul",Rt(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
460
460
  `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const o=i=>{const s=Kl(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,c)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:n.inlineTokens(l.mainContent),nestedTokens:c}),customNestedParser:o},n);return s?[{type:"taskList",raw:s.raw,items:s.items}]:n.blockTokens(i)},r=Kl(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:n.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:o},n);if(r)return{type:"taskList",raw:r.raw,items:r.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Kt.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(qh.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(Kh.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(_S.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(rm.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(RS.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push(PS.configure(this.options.taskList)),t}});var LS=qh,$S=rm,VS=Kh,BS=In.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",Rt(this.options.HTMLAttributes,t)]},renderText(){return`
461
461
  `},renderMarkdown:()=>`
462
- `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:o})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:r,storedMarks:i}=n;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=o.extensionManager,c=i||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:u})=>{if(u&&c&&s){const f=c.filter(p=>l.includes(p.type.name));d.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),FS=BS;const jS="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",US="ελ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",Zl="numeric",ec="ascii",tc="alpha",Ur="asciinumeric",Hr="alphanumeric",nc="domain",im="emoji",HS="scheme",WS="slashscheme",oc="whitespace";function GS(t,e){return t in e||(e[t]=[]),e[t]}function _o(t,e,n){e[Zl]&&(e[Ur]=!0,e[Hr]=!0),e[ec]&&(e[Ur]=!0,e[tc]=!0),e[Ur]&&(e[Hr]=!0),e[tc]&&(e[Hr]=!0),e[Hr]&&(e[nc]=!0),e[im]&&(e[nc]=!0);for(const o in e){const r=GS(o,n);r.indexOf(t)<0&&r.push(t)}}function qS(t,e){const n={};for(const o in e)e[o].indexOf(t)>=0&&(n[o]=!0);return n}function Pt(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Pt.groups={},Pt.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let o=0;o<e.jr.length;o++){const r=e.jr[o][0],i=e.jr[o][1];if(i&&r.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,o){for(let r=0;r<t.length;r++)this.tt(t[r],e,n,o)},tr(t,e,n,o){o=o||Pt.groups;let r;return e&&e.j?r=e:(r=new Pt(e),n&&o&&_o(e,n,o)),this.jr.push([t,r]),r},ts(t,e,n,o){let r=this;const i=t.length;if(!i)return r;for(let s=0;s<i-1;s++)r=r.tt(t[s]);return r.tt(t[i-1],e,n,o)},tt(t,e,n,o){o=o||Pt.groups;const r=this;if(e&&e.j)return r.j[t]=e,e;const i=e;let s,l=r.go(t);if(l?(s=new Pt,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new Pt,i){if(o)if(s.t&&typeof s.t=="string"){const c=Object.assign(qS(s.t,o),n);_o(i,c,o)}else n&&_o(i,n,o);s.t=i}return r.j[t]=s,s}};const Ie=(t,e,n,o,r)=>t.ta(e,n,o,r),Ye=(t,e,n,o,r)=>t.tr(e,n,o,r),sm=(t,e,n,o,r)=>t.ts(e,n,o,r),oe=(t,e,n,o,r)=>t.tt(e,n,o,r),On="WORD",rc="UWORD",am="ASCIINUMERICAL",lm="ALPHANUMERICAL",Wr="LOCALHOST",ic="TLD",sc="UTLD",fs="SCHEME",Qo="SLASH_SCHEME",ac="NUM",lc="WS",cc="NL",Gr="OPENBRACE",qr="CLOSEBRACE",ps="OPENBRACKET",hs="CLOSEBRACKET",ms="OPENPAREN",gs="CLOSEPAREN",bs="OPENANGLEBRACKET",ys="CLOSEANGLEBRACKET",xs="FULLWIDTHLEFTPAREN",Es="FULLWIDTHRIGHTPAREN",ks="LEFTCORNERBRACKET",ws="RIGHTCORNERBRACKET",Ss="LEFTWHITECORNERBRACKET",Ns="RIGHTWHITECORNERBRACKET",Cs="FULLWIDTHLESSTHAN",vs="FULLWIDTHGREATERTHAN",Ts="AMPERSAND",zs="APOSTROPHE",_s="ASTERISK",so="AT",As="BACKSLASH",Ms="BACKTICK",Is="CARET",ao="COLON",dc="COMMA",Os="DOLLAR",gn="DOT",Ds="EQUALS",uc="EXCLAMATION",Jt="HYPHEN",Kr="PERCENT",Rs="PIPE",Ps="PLUS",Ls="POUND",Jr="QUERY",fc="QUOTE",cm="FULLWIDTHMIDDLEDOT",pc="SEMI",bn="SLASH",Xr="TILDE",$s="UNDERSCORE",dm="EMOJI",Vs="SYM";var um=Object.freeze({__proto__:null,ALPHANUMERICAL:lm,AMPERSAND:Ts,APOSTROPHE:zs,ASCIINUMERICAL:am,ASTERISK:_s,AT:so,BACKSLASH:As,BACKTICK:Ms,CARET:Is,CLOSEANGLEBRACKET:ys,CLOSEBRACE:qr,CLOSEBRACKET:hs,CLOSEPAREN:gs,COLON:ao,COMMA:dc,DOLLAR:Os,DOT:gn,EMOJI:dm,EQUALS:Ds,EXCLAMATION:uc,FULLWIDTHGREATERTHAN:vs,FULLWIDTHLEFTPAREN:xs,FULLWIDTHLESSTHAN:Cs,FULLWIDTHMIDDLEDOT:cm,FULLWIDTHRIGHTPAREN:Es,HYPHEN:Jt,LEFTCORNERBRACKET:ks,LEFTWHITECORNERBRACKET:Ss,LOCALHOST:Wr,NL:cc,NUM:ac,OPENANGLEBRACKET:bs,OPENBRACE:Gr,OPENBRACKET:ps,OPENPAREN:ms,PERCENT:Kr,PIPE:Rs,PLUS:Ps,POUND:Ls,QUERY:Jr,QUOTE:fc,RIGHTCORNERBRACKET:ws,RIGHTWHITECORNERBRACKET:Ns,SCHEME:fs,SEMI:pc,SLASH:bn,SLASH_SCHEME:Qo,SYM:Vs,TILDE:Xr,TLD:ic,UNDERSCORE:$s,UTLD:sc,UWORD:rc,WORD:On,WS:lc});const Dn=/[a-z]/,Yr=new RegExp("\\p{L}","u"),hc=new RegExp("\\p{Emoji}","u"),Rn=/\d/,mc=/\s/,fm="\r",gc=`
463
- `,KS="️",JS="‍",bc="";let Bs=null,Fs=null;function XS(t=[]){const e={};Pt.groups=e;const n=new Pt;Bs==null&&(Bs=hm(jS)),Fs==null&&(Fs=hm(US)),oe(n,"'",zs),oe(n,"{",Gr),oe(n,"}",qr),oe(n,"[",ps),oe(n,"]",hs),oe(n,"(",ms),oe(n,")",gs),oe(n,"<",bs),oe(n,">",ys),oe(n,"(",xs),oe(n,")",Es),oe(n,"「",ks),oe(n,"」",ws),oe(n,"『",Ss),oe(n,"』",Ns),oe(n,"<",Cs),oe(n,">",vs),oe(n,"&",Ts),oe(n,"*",_s),oe(n,"@",so),oe(n,"`",Ms),oe(n,"^",Is),oe(n,":",ao),oe(n,",",dc),oe(n,"$",Os),oe(n,".",gn),oe(n,"=",Ds),oe(n,"!",uc),oe(n,"-",Jt),oe(n,"%",Kr),oe(n,"|",Rs),oe(n,"+",Ps),oe(n,"#",Ls),oe(n,"?",Jr),oe(n,'"',fc),oe(n,"/",bn),oe(n,";",pc),oe(n,"~",Xr),oe(n,"_",$s),oe(n,"\\",As),oe(n,"・",cm);const o=Ye(n,Rn,ac,{[Zl]:!0});Ye(o,Rn,o);const r=Ye(o,Dn,am,{[Ur]:!0}),i=Ye(o,Yr,lm,{[Hr]:!0}),s=Ye(n,Dn,On,{[ec]:!0});Ye(s,Rn,r),Ye(s,Dn,s),Ye(r,Rn,r),Ye(r,Dn,r);const l=Ye(n,Yr,rc,{[tc]:!0});Ye(l,Dn),Ye(l,Rn,i),Ye(l,Yr,l),Ye(i,Rn,i),Ye(i,Dn),Ye(i,Yr,i);const c=oe(n,gc,cc,{[oc]:!0}),d=oe(n,fm,lc,{[oc]:!0}),u=Ye(n,mc,lc,{[oc]:!0});oe(n,bc,u),oe(d,gc,c),oe(d,bc,u),Ye(d,mc,u),oe(u,fm),oe(u,gc),Ye(u,mc,u),oe(u,bc,u);const f=Ye(n,hc,dm,{[im]:!0});oe(f,"#"),Ye(f,hc,f),oe(f,KS,f);const p=oe(f,JS);oe(p,"#"),Ye(p,hc,f);const h=[[Dn,s],[Rn,r]],m=[[Dn,null],[Yr,l],[Rn,i]];for(let b=0;b<Bs.length;b++)lo(n,Bs[b],ic,On,h);for(let b=0;b<Fs.length;b++)lo(n,Fs[b],sc,rc,m);_o(ic,{tld:!0,ascii:!0},e),_o(sc,{utld:!0,alpha:!0},e),lo(n,"file",fs,On,h),lo(n,"mailto",fs,On,h),lo(n,"http",Qo,On,h),lo(n,"https",Qo,On,h),lo(n,"ftp",Qo,On,h),lo(n,"ftps",Qo,On,h),_o(fs,{scheme:!0,ascii:!0},e),_o(Qo,{slashscheme:!0,ascii:!0},e),t=t.sort((b,g)=>b[0]>g[0]?1:-1);for(let b=0;b<t.length;b++){const g=t[b][0],v=t[b][1]?{[HS]:!0}:{[WS]:!0};g.indexOf("-")>=0?v[nc]=!0:Dn.test(g)?Rn.test(g)?v[Ur]=!0:v[ec]=!0:v[Zl]=!0,sm(n,g,g,v)}return sm(n,"localhost",Wr,{ascii:!0}),n.jd=new Pt(Vs),{start:n,tokens:Object.assign({groups:e},um)}}function pm(t,e){const n=YS(e.replace(/[A-Z]/g,l=>l.toLowerCase())),o=n.length,r=[];let i=0,s=0;for(;s<o;){let l=t,c=null,d=0,u=null,f=-1,p=-1;for(;s<o&&(c=l.go(n[s]));)l=c,l.accepts()?(f=0,p=0,u=l):f>=0&&(f+=n[s].length,p++),d+=n[s].length,i+=n[s].length,s++;i-=f,s-=p,d-=f,r.push({t:u.t,v:e.slice(i-d,i),s:i-d,e:i})}return r}function YS(t){const e=[],n=t.length;let o=0;for(;o<n;){let r=t.charCodeAt(o),i,s=r<55296||r>56319||o+1===n||(i=t.charCodeAt(o+1))<56320||i>57343?t[o]:t.slice(o,o+2);e.push(s),o+=s.length}return e}function lo(t,e,n,o,r){let i;const s=e.length;for(let l=0;l<s-1;l++){const c=e[l];t.j[c]?i=t.j[c]:(i=new Pt(o),i.jr=r.slice(),t.j[c]=i),t=i}return i=new Pt(n),i.jr=r.slice(),t.j[e[s-1]]=i,i}function hm(t){const e=[],n=[];let o=0,r="0123456789";for(;o<t.length;){let i=0;for(;r.indexOf(t[o+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(o,o+i),10);s>0;s--)n.pop();o+=i}else n.push(t[o]),o++}return e}const Qr={defaultProtocol:"http",events:null,format:mm,formatHref:mm,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function yc(t,e=null){let n=Object.assign({},Qr);t&&(n=Object.assign(n,t instanceof yc?t.o:t));const o=n.ignoreTags,r=[];for(let i=0;i<o.length;i++)r.push(o[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=r}yc.prototype={o:Qr,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const o=e!=null;let r=this.o[t];return r&&(typeof r=="object"?(r=n.t in r?r[n.t]:Qr[t],typeof r=="function"&&o&&(r=r(e,n))):typeof r=="function"&&o&&(r=r(e,n.t,n)),r)},getObj(t,e,n){let o=this.o[t];return typeof o=="function"&&e!=null&&(o=o(e,n.t,n)),o},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function mm(t){return t}function gm(t,e){this.t="token",this.v=t,this.tk=e}gm.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),o=t.get("format",e,this);return n&&o.length>n?o.substring(0,n)+"…":o},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Qr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),o=t.get("formatHref",n,this),r=t.get("tagName",n,e),i=this.toFormattedString(t),s={},l=t.get("className",n,e),c=t.get("target",n,e),d=t.get("rel",n,e),u=t.getObj("attributes",n,e),f=t.getObj("events",n,e);return s.href=o,l&&(s.class=l),c&&(s.target=c),d&&(s.rel=d),u&&Object.assign(s,u),{tagName:r,attributes:s,content:i,eventListeners:f}}};function js(t,e){class n extends gm{constructor(r,i){super(r,i),this.t=t}}for(const o in e)n.prototype[o]=e[o];return n.t=t,n}const bm=js("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ym=js("text"),QS=js("nl"),Us=js("url",{isLink:!0,toHref(t=Qr.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Wr&&t[1].t===ao}}),Xt=t=>new Pt(t);function ZS({groups:t}){const e=t.domain.concat([Ts,_s,so,As,Ms,Is,Os,Ds,Jt,ac,Kr,Rs,Ps,Ls,bn,Vs,Xr,$s]),n=[zs,ao,dc,gn,uc,Kr,Jr,fc,pc,bs,ys,Gr,qr,hs,ps,ms,gs,xs,Es,ks,ws,Ss,Ns,Cs,vs],o=[Ts,zs,_s,As,Ms,Is,Os,Ds,Jt,Gr,qr,Kr,Rs,Ps,Ls,Jr,bn,Vs,Xr,$s],r=Xt(),i=oe(r,Xr);Ie(i,o,i),Ie(i,t.domain,i);const s=Xt(),l=Xt(),c=Xt();Ie(r,t.domain,s),Ie(r,t.scheme,l),Ie(r,t.slashscheme,c),Ie(s,o,i),Ie(s,t.domain,s);const d=oe(s,so);oe(i,so,d),oe(l,so,d),oe(c,so,d);const u=oe(i,gn);Ie(u,o,i),Ie(u,t.domain,i);const f=Xt();Ie(d,t.domain,f),Ie(f,t.domain,f);const p=oe(f,gn);Ie(p,t.domain,f);const h=Xt(bm);Ie(p,t.tld,h),Ie(p,t.utld,h),oe(d,Wr,h);const m=oe(f,Jt);oe(m,Jt,m),Ie(m,t.domain,f),Ie(h,t.domain,f),oe(h,gn,p),oe(h,Jt,m);const b=oe(h,ao);Ie(b,t.numeric,bm);const g=oe(s,Jt),x=oe(s,gn);oe(g,Jt,g),Ie(g,t.domain,s),Ie(x,o,i),Ie(x,t.domain,s);const v=Xt(Us);Ie(x,t.tld,v),Ie(x,t.utld,v),Ie(v,t.domain,s),Ie(v,o,i),oe(v,gn,x),oe(v,Jt,g),oe(v,so,d);const w=oe(v,ao),T=Xt(Us);Ie(w,t.numeric,T);const M=Xt(Us),A=Xt();Ie(M,e,M),Ie(M,n,A),Ie(A,e,M),Ie(A,n,A),oe(v,bn,M),oe(T,bn,M);const y=oe(l,ao),E=oe(c,ao),S=oe(E,bn),D=oe(S,bn);Ie(l,t.domain,s),oe(l,gn,x),oe(l,Jt,g),Ie(c,t.domain,s),oe(c,gn,x),oe(c,Jt,g),Ie(y,t.domain,M),oe(y,bn,M),oe(y,Jr,M),Ie(D,t.domain,M),Ie(D,e,M),oe(D,bn,M);const W=[[Gr,qr],[ps,hs],[ms,gs],[bs,ys],[xs,Es],[ks,ws],[Ss,Ns],[Cs,vs]];for(let z=0;z<W.length;z++){const[P,V]=W[z],j=oe(M,P);oe(A,P,j),oe(j,V,M);const L=Xt(Us);Ie(j,e,L);const H=Xt();Ie(j,n),Ie(L,e,L),Ie(L,n,H),Ie(H,e,L),Ie(H,n,H),oe(L,V,M),oe(H,V,M)}return oe(r,Wr,v),oe(r,cc,QS),{start:r,tokens:um}}function eN(t,e,n){let o=n.length,r=0,i=[],s=[];for(;r<o;){let l=t,c=null,d=null,u=0,f=null,p=-1;for(;r<o&&!(c=l.go(n[r].t));)s.push(n[r++]);for(;r<o&&(d=c||l.go(n[r].t));)c=null,l=d,l.accepts()?(p=0,f=l):p>=0&&p++,r++,u++;if(p<0)r-=u,r<o&&(s.push(n[r]),r++);else{s.length>0&&(i.push(xc(ym,e,s)),s=[]),r-=p,u-=p;const h=f.t,m=n.slice(r-u,r);i.push(xc(h,e,m))}}return s.length>0&&i.push(xc(ym,e,s)),i}function xc(t,e,n){const o=n[0].s,r=n[n.length-1].e,i=e.slice(o,r);return new t(i,n)}const tN=typeof console<"u"&&console&&console.warn||(()=>{}),nN="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",We={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function oN(){return Pt.groups={},We.scanner=null,We.parser=null,We.tokenQueue=[],We.pluginQueue=[],We.customSchemes=[],We.initialized=!1,We}function xm(t,e=!1){if(We.initialized&&tN(`linkifyjs: already initialized - will not register custom scheme "${t}" ${nN}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
462
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:o})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:r,storedMarks:i}=n;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=o.extensionManager,c=i||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:d,dispatch:u})=>{if(u&&c&&s){const f=c.filter(p=>l.includes(p.type.name));d.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),FS=BS;const jS="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",US="ελ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",Zl="numeric",ec="ascii",tc="alpha",Ur="asciinumeric",Hr="alphanumeric",nc="domain",im="emoji",HS="scheme",WS="slashscheme",oc="whitespace";function GS(t,e){return t in e||(e[t]=[]),e[t]}function _o(t,e,n){e[Zl]&&(e[Ur]=!0,e[Hr]=!0),e[ec]&&(e[Ur]=!0,e[tc]=!0),e[Ur]&&(e[Hr]=!0),e[tc]&&(e[Hr]=!0),e[Hr]&&(e[nc]=!0),e[im]&&(e[nc]=!0);for(const o in e){const r=GS(o,n);r.indexOf(t)<0&&r.push(t)}}function qS(t,e){const n={};for(const o in e)e[o].indexOf(t)>=0&&(n[o]=!0);return n}function Pt(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Pt.groups={},Pt.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let o=0;o<e.jr.length;o++){const r=e.jr[o][0],i=e.jr[o][1];if(i&&r.test(t))return i}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,o){for(let r=0;r<t.length;r++)this.tt(t[r],e,n,o)},tr(t,e,n,o){o=o||Pt.groups;let r;return e&&e.j?r=e:(r=new Pt(e),n&&o&&_o(e,n,o)),this.jr.push([t,r]),r},ts(t,e,n,o){let r=this;const i=t.length;if(!i)return r;for(let s=0;s<i-1;s++)r=r.tt(t[s]);return r.tt(t[i-1],e,n,o)},tt(t,e,n,o){o=o||Pt.groups;const r=this;if(e&&e.j)return r.j[t]=e,e;const i=e;let s,l=r.go(t);if(l?(s=new Pt,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new Pt,i){if(o)if(s.t&&typeof s.t=="string"){const c=Object.assign(qS(s.t,o),n);_o(i,c,o)}else n&&_o(i,n,o);s.t=i}return r.j[t]=s,s}};const Ie=(t,e,n,o,r)=>t.ta(e,n,o,r),Ye=(t,e,n,o,r)=>t.tr(e,n,o,r),sm=(t,e,n,o,r)=>t.ts(e,n,o,r),re=(t,e,n,o,r)=>t.tt(e,n,o,r),On="WORD",rc="UWORD",am="ASCIINUMERICAL",lm="ALPHANUMERICAL",Wr="LOCALHOST",ic="TLD",sc="UTLD",fs="SCHEME",Qo="SLASH_SCHEME",ac="NUM",lc="WS",cc="NL",Gr="OPENBRACE",qr="CLOSEBRACE",ps="OPENBRACKET",hs="CLOSEBRACKET",ms="OPENPAREN",gs="CLOSEPAREN",bs="OPENANGLEBRACKET",ys="CLOSEANGLEBRACKET",xs="FULLWIDTHLEFTPAREN",Es="FULLWIDTHRIGHTPAREN",ks="LEFTCORNERBRACKET",ws="RIGHTCORNERBRACKET",Ss="LEFTWHITECORNERBRACKET",Ns="RIGHTWHITECORNERBRACKET",Cs="FULLWIDTHLESSTHAN",vs="FULLWIDTHGREATERTHAN",Ts="AMPERSAND",zs="APOSTROPHE",_s="ASTERISK",so="AT",As="BACKSLASH",Ms="BACKTICK",Is="CARET",ao="COLON",dc="COMMA",Os="DOLLAR",gn="DOT",Ds="EQUALS",uc="EXCLAMATION",Jt="HYPHEN",Kr="PERCENT",Rs="PIPE",Ps="PLUS",Ls="POUND",Jr="QUERY",fc="QUOTE",cm="FULLWIDTHMIDDLEDOT",pc="SEMI",bn="SLASH",Xr="TILDE",$s="UNDERSCORE",dm="EMOJI",Vs="SYM";var um=Object.freeze({__proto__:null,ALPHANUMERICAL:lm,AMPERSAND:Ts,APOSTROPHE:zs,ASCIINUMERICAL:am,ASTERISK:_s,AT:so,BACKSLASH:As,BACKTICK:Ms,CARET:Is,CLOSEANGLEBRACKET:ys,CLOSEBRACE:qr,CLOSEBRACKET:hs,CLOSEPAREN:gs,COLON:ao,COMMA:dc,DOLLAR:Os,DOT:gn,EMOJI:dm,EQUALS:Ds,EXCLAMATION:uc,FULLWIDTHGREATERTHAN:vs,FULLWIDTHLEFTPAREN:xs,FULLWIDTHLESSTHAN:Cs,FULLWIDTHMIDDLEDOT:cm,FULLWIDTHRIGHTPAREN:Es,HYPHEN:Jt,LEFTCORNERBRACKET:ks,LEFTWHITECORNERBRACKET:Ss,LOCALHOST:Wr,NL:cc,NUM:ac,OPENANGLEBRACKET:bs,OPENBRACE:Gr,OPENBRACKET:ps,OPENPAREN:ms,PERCENT:Kr,PIPE:Rs,PLUS:Ps,POUND:Ls,QUERY:Jr,QUOTE:fc,RIGHTCORNERBRACKET:ws,RIGHTWHITECORNERBRACKET:Ns,SCHEME:fs,SEMI:pc,SLASH:bn,SLASH_SCHEME:Qo,SYM:Vs,TILDE:Xr,TLD:ic,UNDERSCORE:$s,UTLD:sc,UWORD:rc,WORD:On,WS:lc});const Dn=/[a-z]/,Yr=new RegExp("\\p{L}","u"),hc=new RegExp("\\p{Emoji}","u"),Rn=/\d/,mc=/\s/,fm="\r",gc=`
463
+ `,KS="️",JS="‍",bc="";let Bs=null,Fs=null;function XS(t=[]){const e={};Pt.groups=e;const n=new Pt;Bs==null&&(Bs=hm(jS)),Fs==null&&(Fs=hm(US)),re(n,"'",zs),re(n,"{",Gr),re(n,"}",qr),re(n,"[",ps),re(n,"]",hs),re(n,"(",ms),re(n,")",gs),re(n,"<",bs),re(n,">",ys),re(n,"(",xs),re(n,")",Es),re(n,"「",ks),re(n,"」",ws),re(n,"『",Ss),re(n,"』",Ns),re(n,"<",Cs),re(n,">",vs),re(n,"&",Ts),re(n,"*",_s),re(n,"@",so),re(n,"`",Ms),re(n,"^",Is),re(n,":",ao),re(n,",",dc),re(n,"$",Os),re(n,".",gn),re(n,"=",Ds),re(n,"!",uc),re(n,"-",Jt),re(n,"%",Kr),re(n,"|",Rs),re(n,"+",Ps),re(n,"#",Ls),re(n,"?",Jr),re(n,'"',fc),re(n,"/",bn),re(n,";",pc),re(n,"~",Xr),re(n,"_",$s),re(n,"\\",As),re(n,"・",cm);const o=Ye(n,Rn,ac,{[Zl]:!0});Ye(o,Rn,o);const r=Ye(o,Dn,am,{[Ur]:!0}),i=Ye(o,Yr,lm,{[Hr]:!0}),s=Ye(n,Dn,On,{[ec]:!0});Ye(s,Rn,r),Ye(s,Dn,s),Ye(r,Rn,r),Ye(r,Dn,r);const l=Ye(n,Yr,rc,{[tc]:!0});Ye(l,Dn),Ye(l,Rn,i),Ye(l,Yr,l),Ye(i,Rn,i),Ye(i,Dn),Ye(i,Yr,i);const c=re(n,gc,cc,{[oc]:!0}),d=re(n,fm,lc,{[oc]:!0}),u=Ye(n,mc,lc,{[oc]:!0});re(n,bc,u),re(d,gc,c),re(d,bc,u),Ye(d,mc,u),re(u,fm),re(u,gc),Ye(u,mc,u),re(u,bc,u);const f=Ye(n,hc,dm,{[im]:!0});re(f,"#"),Ye(f,hc,f),re(f,KS,f);const p=re(f,JS);re(p,"#"),Ye(p,hc,f);const h=[[Dn,s],[Rn,r]],m=[[Dn,null],[Yr,l],[Rn,i]];for(let b=0;b<Bs.length;b++)lo(n,Bs[b],ic,On,h);for(let b=0;b<Fs.length;b++)lo(n,Fs[b],sc,rc,m);_o(ic,{tld:!0,ascii:!0},e),_o(sc,{utld:!0,alpha:!0},e),lo(n,"file",fs,On,h),lo(n,"mailto",fs,On,h),lo(n,"http",Qo,On,h),lo(n,"https",Qo,On,h),lo(n,"ftp",Qo,On,h),lo(n,"ftps",Qo,On,h),_o(fs,{scheme:!0,ascii:!0},e),_o(Qo,{slashscheme:!0,ascii:!0},e),t=t.sort((b,g)=>b[0]>g[0]?1:-1);for(let b=0;b<t.length;b++){const g=t[b][0],v=t[b][1]?{[HS]:!0}:{[WS]:!0};g.indexOf("-")>=0?v[nc]=!0:Dn.test(g)?Rn.test(g)?v[Ur]=!0:v[ec]=!0:v[Zl]=!0,sm(n,g,g,v)}return sm(n,"localhost",Wr,{ascii:!0}),n.jd=new Pt(Vs),{start:n,tokens:Object.assign({groups:e},um)}}function pm(t,e){const n=YS(e.replace(/[A-Z]/g,l=>l.toLowerCase())),o=n.length,r=[];let i=0,s=0;for(;s<o;){let l=t,c=null,d=0,u=null,f=-1,p=-1;for(;s<o&&(c=l.go(n[s]));)l=c,l.accepts()?(f=0,p=0,u=l):f>=0&&(f+=n[s].length,p++),d+=n[s].length,i+=n[s].length,s++;i-=f,s-=p,d-=f,r.push({t:u.t,v:e.slice(i-d,i),s:i-d,e:i})}return r}function YS(t){const e=[],n=t.length;let o=0;for(;o<n;){let r=t.charCodeAt(o),i,s=r<55296||r>56319||o+1===n||(i=t.charCodeAt(o+1))<56320||i>57343?t[o]:t.slice(o,o+2);e.push(s),o+=s.length}return e}function lo(t,e,n,o,r){let i;const s=e.length;for(let l=0;l<s-1;l++){const c=e[l];t.j[c]?i=t.j[c]:(i=new Pt(o),i.jr=r.slice(),t.j[c]=i),t=i}return i=new Pt(n),i.jr=r.slice(),t.j[e[s-1]]=i,i}function hm(t){const e=[],n=[];let o=0,r="0123456789";for(;o<t.length;){let i=0;for(;r.indexOf(t[o+i])>=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(o,o+i),10);s>0;s--)n.pop();o+=i}else n.push(t[o]),o++}return e}const Qr={defaultProtocol:"http",events:null,format:mm,formatHref:mm,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function yc(t,e=null){let n=Object.assign({},Qr);t&&(n=Object.assign(n,t instanceof yc?t.o:t));const o=n.ignoreTags,r=[];for(let i=0;i<o.length;i++)r.push(o[i].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=r}yc.prototype={o:Qr,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const o=e!=null;let r=this.o[t];return r&&(typeof r=="object"?(r=n.t in r?r[n.t]:Qr[t],typeof r=="function"&&o&&(r=r(e,n))):typeof r=="function"&&o&&(r=r(e,n.t,n)),r)},getObj(t,e,n){let o=this.o[t];return typeof o=="function"&&e!=null&&(o=o(e,n.t,n)),o},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function mm(t){return t}function gm(t,e){this.t="token",this.v=t,this.tk=e}gm.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),o=t.get("format",e,this);return n&&o.length>n?o.substring(0,n)+"…":o},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=Qr.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),o=t.get("formatHref",n,this),r=t.get("tagName",n,e),i=this.toFormattedString(t),s={},l=t.get("className",n,e),c=t.get("target",n,e),d=t.get("rel",n,e),u=t.getObj("attributes",n,e),f=t.getObj("events",n,e);return s.href=o,l&&(s.class=l),c&&(s.target=c),d&&(s.rel=d),u&&Object.assign(s,u),{tagName:r,attributes:s,content:i,eventListeners:f}}};function js(t,e){class n extends gm{constructor(r,i){super(r,i),this.t=t}}for(const o in e)n.prototype[o]=e[o];return n.t=t,n}const bm=js("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ym=js("text"),QS=js("nl"),Us=js("url",{isLink:!0,toHref(t=Qr.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Wr&&t[1].t===ao}}),Xt=t=>new Pt(t);function ZS({groups:t}){const e=t.domain.concat([Ts,_s,so,As,Ms,Is,Os,Ds,Jt,ac,Kr,Rs,Ps,Ls,bn,Vs,Xr,$s]),n=[zs,ao,dc,gn,uc,Kr,Jr,fc,pc,bs,ys,Gr,qr,hs,ps,ms,gs,xs,Es,ks,ws,Ss,Ns,Cs,vs],o=[Ts,zs,_s,As,Ms,Is,Os,Ds,Jt,Gr,qr,Kr,Rs,Ps,Ls,Jr,bn,Vs,Xr,$s],r=Xt(),i=re(r,Xr);Ie(i,o,i),Ie(i,t.domain,i);const s=Xt(),l=Xt(),c=Xt();Ie(r,t.domain,s),Ie(r,t.scheme,l),Ie(r,t.slashscheme,c),Ie(s,o,i),Ie(s,t.domain,s);const d=re(s,so);re(i,so,d),re(l,so,d),re(c,so,d);const u=re(i,gn);Ie(u,o,i),Ie(u,t.domain,i);const f=Xt();Ie(d,t.domain,f),Ie(f,t.domain,f);const p=re(f,gn);Ie(p,t.domain,f);const h=Xt(bm);Ie(p,t.tld,h),Ie(p,t.utld,h),re(d,Wr,h);const m=re(f,Jt);re(m,Jt,m),Ie(m,t.domain,f),Ie(h,t.domain,f),re(h,gn,p),re(h,Jt,m);const b=re(h,ao);Ie(b,t.numeric,bm);const g=re(s,Jt),x=re(s,gn);re(g,Jt,g),Ie(g,t.domain,s),Ie(x,o,i),Ie(x,t.domain,s);const v=Xt(Us);Ie(x,t.tld,v),Ie(x,t.utld,v),Ie(v,t.domain,s),Ie(v,o,i),re(v,gn,x),re(v,Jt,g),re(v,so,d);const w=re(v,ao),T=Xt(Us);Ie(w,t.numeric,T);const M=Xt(Us),A=Xt();Ie(M,e,M),Ie(M,n,A),Ie(A,e,M),Ie(A,n,A),re(v,bn,M),re(T,bn,M);const y=re(l,ao),E=re(c,ao),k=re(E,bn),O=re(k,bn);Ie(l,t.domain,s),re(l,gn,x),re(l,Jt,g),Ie(c,t.domain,s),re(c,gn,x),re(c,Jt,g),Ie(y,t.domain,M),re(y,bn,M),re(y,Jr,M),Ie(O,t.domain,M),Ie(O,e,M),re(O,bn,M);const G=[[Gr,qr],[ps,hs],[ms,gs],[bs,ys],[xs,Es],[ks,ws],[Ss,Ns],[Cs,vs]];for(let z=0;z<G.length;z++){const[R,W]=G[z],H=re(M,R);re(A,R,H),re(H,W,M);const L=Xt(Us);Ie(H,e,L);const j=Xt();Ie(H,n),Ie(L,e,L),Ie(L,n,j),Ie(j,e,L),Ie(j,n,j),re(L,W,M),re(j,W,M)}return re(r,Wr,v),re(r,cc,QS),{start:r,tokens:um}}function eN(t,e,n){let o=n.length,r=0,i=[],s=[];for(;r<o;){let l=t,c=null,d=null,u=0,f=null,p=-1;for(;r<o&&!(c=l.go(n[r].t));)s.push(n[r++]);for(;r<o&&(d=c||l.go(n[r].t));)c=null,l=d,l.accepts()?(p=0,f=l):p>=0&&p++,r++,u++;if(p<0)r-=u,r<o&&(s.push(n[r]),r++);else{s.length>0&&(i.push(xc(ym,e,s)),s=[]),r-=p,u-=p;const h=f.t,m=n.slice(r-u,r);i.push(xc(h,e,m))}}return s.length>0&&i.push(xc(ym,e,s)),i}function xc(t,e,n){const o=n[0].s,r=n[n.length-1].e,i=e.slice(o,r);return new t(i,n)}const tN=typeof console<"u"&&console&&console.warn||(()=>{}),nN="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",We={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function oN(){return Pt.groups={},We.scanner=null,We.parser=null,We.tokenQueue=[],We.pluginQueue=[],We.customSchemes=[],We.initialized=!1,We}function xm(t,e=!1){if(We.initialized&&tN(`linkifyjs: already initialized - will not register custom scheme "${t}" ${nN}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
464
464
  1. Must only contain digits, lowercase ASCII letters or "-"
465
465
  2. Cannot start or end with "-"
466
- 3. "-" cannot repeat`);We.customSchemes.push([t,e])}function rN(){We.scanner=XS(We.customSchemes);for(let t=0;t<We.tokenQueue.length;t++)We.tokenQueue[t][1]({scanner:We.scanner});We.parser=ZS(We.scanner.tokens);for(let t=0;t<We.pluginQueue.length;t++)We.pluginQueue[t][1]({scanner:We.scanner,parser:We.parser});return We.initialized=!0,We}function Ec(t){return We.initialized||rN(),eN(We.parser.start,t,pm(We.scanner.start,t))}Ec.scan=pm;function Em(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const o=new yc(n),r=Ec(t),i=[];for(let s=0;s<r.length;s++){const l=r[s];l.isLink&&(!e||l.t===e)&&o.check(l)&&i.push(l.toFormattedObject(o))}return i}var kc="[\0-   ᠎ -\u2029  ]",iN=new RegExp(kc),sN=new RegExp(`${kc}$`),aN=new RegExp(kc,"g");function lN(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function cN(t){return new Ot({key:new an("autolink"),appendTransaction:(e,n,o)=>{const r=e.some(d=>d.docChanged)&&!n.doc.eq(o.doc),i=e.some(d=>d.getMeta("preventAutolink"));if(!r||i)return;const{tr:s}=o,l=mh(n.doc,[...e]);if(Ch(l).forEach(({newRange:d})=>{const u=qk(o.doc,d,h=>h.isTextblock);let f,p;if(u.length>1)f=u[0],p=o.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const h=o.doc.textBetween(d.from,d.to," "," ");if(!sN.test(h))return;f=u[0],p=o.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&p){const h=p.split(iN).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],b=f.pos+p.lastIndexOf(m);if(!m)return!1;const g=Ec(m).map(x=>x.toObject(t.defaultProtocol));if(!lN(g))return!1;g.filter(x=>x.isLink).map(x=>({...x,from:b+x.start+1,to:b+x.end+1})).filter(x=>o.schema.marks.code?!o.doc.rangeHasMark(x.from,x.to,o.schema.marks.code):!0).filter(x=>t.validate(x.value)).filter(x=>t.shouldAutoLink(x.value)).forEach(x=>{Bl(x.from,x.to,o.doc).some(v=>v.mark.type===t.type)||s.addMark(x.from,x.to,t.type.create({href:x.href}))})}}),!!s.steps.length)return s}})}function dN(t){return new Ot({key:new an("handleClickLink"),props:{handleClick:(e,n,o)=>{var r,i;if(o.button!==0||!e.editable)return!1;let s=!1;if(t.enableClickSelection&&(s=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){let l=null;if(o.target instanceof HTMLAnchorElement)l=o.target;else{let f=o.target;const p=[];for(;f.nodeName!=="DIV";)p.push(f),f=f.parentNode;l=p.find(h=>h.nodeName==="A")}if(!l)return s;const c=Nh(e.state,t.type.name),d=(r=l?.href)!=null?r:c.href,u=(i=l?.target)!=null?i:c.target;l&&d&&(window.open(d,u),s=!0)}return s}}})}function uN(t){return new Ot({key:new an("handlePasteLink"),props:{handlePaste:(e,n,o)=>{const{shouldAutoLink:r}=t,{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let c="";o.content.forEach(u=>{c+=u.textContent});const d=Em(c,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===c);return!c||!d||r!==void 0&&!r(d.value)?!1:t.editor.commands.setMark(t.type,{href:d.href})}}})}function Ao(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(o=>{const r=typeof o=="string"?o:o.scheme;r&&n.push(r)}),!t||t.replace(aN,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var fN=Vr.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(t=>{if(typeof t=="string"){xm(t);return}xm(t.scheme,t.optionalSlashes)})},onDestroy(){oN()},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:(t,e)=>!!Ao(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const r=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Ao(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Ao(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Rt(this.options.HTMLAttributes,t),0]:["a",Rt(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n;const o=((n=t.attrs)==null?void 0:n.href)||"";return`[${e.renderChildren(t)}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:o=>!!Ao(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:o=>!!Ao(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Yo({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:o}=this.options,r=Em(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Ao(s,n),protocols:n,defaultProtocol:o}));r.length&&r.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(cN({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!Ao(r,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(dN({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(uN({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),pN=fN;const hN={class:"zcode-rich-text-editor"},mN={key:0,class:"zcode-rich-text-toolbar"},gN=a.defineComponent({__name:"RichTextEditor",props:{modelValue:{type:String},placeholder:{type:String}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,o=e,r=tS({extensions:[oS,iS,aS,pS,xS,SS,LS,$S,VS,FS,pN.configure({openOnClick:!1,HTMLAttributes:{class:"zcode-link"}})],content:n.modelValue||"",editorProps:{attributes:{class:"zcode-tiptap-editor","data-placeholder":n.placeholder||"テキストを入力..."}},onUpdate:({editor:s})=>{const l=s.getHTML();o("update:modelValue",l)}});a.watch(()=>n.modelValue,s=>{r.value&&r.value.getHTML()!==s&&r.value.commands.setContent(s||"")});const i=()=>{if(!r.value)return;const s=r.value.getAttributes("link").href,l=window.prompt("URLを入力してください",s);if(l!==null){if(l===""){r.value.chain().focus().extendMarkRange("link").unsetLink().run();return}r.value.chain().focus().extendMarkRange("link").setLink({href:l}).run()}};return a.onUnmounted(()=>{r.value&&r.value.destroy()}),(s,l)=>(a.openBlock(),a.createElementBlock("div",hN,[a.unref(r)?(a.openBlock(),a.createElementBlock("div",mN,[a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("bold")},"zcode-toolbar-btn"]),title:"太字",onClick:l[0]||(l[0]=c=>a.unref(r).chain().focus().toggleBold().run())},[a.createVNode(a.unref(Jm),{size:16})],2),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("italic")},"zcode-toolbar-btn"]),title:"斜体",onClick:l[1]||(l[1]=c=>a.unref(r).chain().focus().toggleItalic().run())},[a.createVNode(a.unref(Zm),{size:16})],2),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("strike")},"zcode-toolbar-btn"]),title:"取り消し線",onClick:l[2]||(l[2]=c=>a.unref(r).chain().focus().toggleStrike().run())},[a.createVNode(a.unref(rg),{size:16})],2),l[5]||(l[5]=a.createElementVNode("div",{class:"zcode-toolbar-divider"},null,-1)),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("bulletList")},"zcode-toolbar-btn"]),title:"箇条書き",onClick:l[3]||(l[3]=c=>a.unref(r).chain().focus().toggleBulletList().run())},[a.createVNode(a.unref(ng),{size:16})],2),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("orderedList")},"zcode-toolbar-btn"]),title:"番号付きリスト",onClick:l[4]||(l[4]=c=>a.unref(r).chain().focus().toggleOrderedList().run())},[a.createVNode(a.unref(tg),{size:16})],2),l[6]||(l[6]=a.createElementVNode("div",{class:"zcode-toolbar-divider"},null,-1)),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("link")},"zcode-toolbar-btn"]),title:"リンク",onClick:i},[a.createVNode(a.unref(eg),{size:16})],2)])):a.createCommentVNode("",!0),a.createVNode(a.unref(eS),{editor:a.unref(r),class:"zcode-rich-text-editor-content"},null,8,["editor"])]))}}),bN={class:"zcode-image-modal-header"},yN={class:"zcode-image-modal-header-title",role:"heading","aria-level":"3"},xN=["aria-label"],EN={key:0,class:"zcode-image-current"},kN={class:"zcode-image-current-title",role:"heading","aria-level":"4"},wN={class:"zcode-image-current-item"},SN=["src","alt"],NN={class:"zcode-image-current-name"},CN={class:"zcode-image-tabs"},vN={class:"zcode-image-grid"},TN=["onClick"],zN=["src","alt"],_N={class:"zcode-image-name"},AN={class:"zcode-image-add"},MN={class:"zcode-image-modal-actions"},IN=a.defineComponent({__name:"ImageSelectModal",props:{isOpen:{type:Boolean},imagesCommon:{type:Array},imagesIndividual:{type:Array},imagesSpecial:{type:Array},currentValue:{type:String}},emits:["update:model-value","add-image","delete-image","close"],setup(t,{emit:e}){const{t:n}=rn(),o=t,r=e,i=a.ref("common"),s=a.ref(null),l=a.ref(o.currentValue||null),c=a.computed(()=>i.value==="common"?o.imagesCommon:i.value==="individual"?o.imagesIndividual:o.imagesSpecial),d=()=>o.currentValue&&[...o.imagesCommon,...o.imagesIndividual,...o.imagesSpecial].find(g=>g.id===o.currentValue)||null,u=b=>{l.value=b.id},f=()=>{l.value&&(r("update:model-value",l.value),m())},p=()=>{l.value&&confirm(n("imagesManager.deleteImageFromModalConfirm"))&&(r("delete-image",l.value),l.value=null)},h=b=>{const x=b.target.files?.[0];if(!x)return;const v=new FileReader;v.onload=w=>{const T=w.target?.result,M={id:`img-${Date.now()}`,name:x.name,url:T,mimeType:x.type,needsUpload:!0},A=i.value==="common"?"common":i.value==="individual"?"individual":"special";r("add-image",M,A),l.value=M.id},v.readAsDataURL(x)},m=()=>{r("close")};return(b,g)=>t.isOpen?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:a.withModifiers(m,["self"])},[a.createElementVNode("div",{class:"zcode-image-modal-content",onClick:g[4]||(g[4]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",bN,[a.createElementVNode("div",yN,a.toDisplayString(b.$t("imagesManager.selectImage")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":b.$t("common.close"),onClick:m},[a.createVNode(a.unref(Qe),{size:18})],8,xN)]),t.currentValue&&d()?(a.openBlock(),a.createElementBlock("div",EN,[a.createElementVNode("div",kN,a.toDisplayString(b.$t("imagesManager.currentlySelected")),1),a.createElementVNode("div",wN,[a.createElementVNode("img",{src:d()?.url,alt:d()?.name||"",class:"zcode-image-current-item-img"},null,8,SN),a.createElementVNode("div",NN,a.toDisplayString(d()?.name),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",CN,[a.createElementVNode("button",{class:a.normalizeClass([{active:i.value==="common"},"zcode-image-tab"]),onClick:g[0]||(g[0]=x=>i.value="common")},a.toDisplayString(b.$t("dataViewer.common")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:i.value==="individual"},"zcode-image-tab"]),onClick:g[1]||(g[1]=x=>i.value="individual")},a.toDisplayString(b.$t("dataViewer.individual")),3),t.imagesSpecial.length>0?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass([{active:i.value==="special"},"zcode-image-tab"]),onClick:g[2]||(g[2]=x=>i.value="special")},a.toDisplayString(b.$t("dataViewer.special")),3)):a.createCommentVNode("",!0)]),a.createElementVNode("div",vN,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(c.value,x=>(a.openBlock(),a.createElementBlock("div",{key:x.id,class:a.normalizeClass([{selected:l.value===x.id},"zcode-image-item"]),onClick:v=>u(x)},[a.createElementVNode("img",{src:x.url,alt:x.name,class:"zcode-image-item-img"},null,8,zN),a.createElementVNode("div",_N,a.toDisplayString(x.name),1)],10,TN))),128))]),a.createElementVNode("div",AN,[a.createElementVNode("input",{ref_key:"fileInput",ref:s,type:"file",accept:"image/*",style:{display:"none"},onChange:h},null,544),a.createElementVNode("button",{class:"zcode-image-add-btn",onClick:g[3]||(g[3]=x=>s.value?.click())},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(b.$t("imagesManager.addImage")),1)])]),a.createElementVNode("div",MN,[l.value?(a.openBlock(),a.createElementBlock("button",{key:0,class:"zcode-btn-primary zcode-image-modal-actions-btn",onClick:f},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString(b.$t("imagesManager.select")),1)])):a.createCommentVNode("",!0),l.value?(a.openBlock(),a.createElementBlock("button",{key:1,class:"zcode-btn-danger zcode-image-modal-actions-btn",onClick:p},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(b.$t("common.delete")),1)])):a.createCommentVNode("",!0)])])])):a.createCommentVNode("",!0)}}),ON={class:"zcode-edit-panel-header"},DN={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},RN=["aria-label"],PN={key:0,class:"zcode-parent-selector"},LN={key:1,class:"zcode-group-tabs"},$N=["onClick"],VN={key:2,class:"zcode-field-editor"},BN={class:"zcode-field-item-title",role:"heading","aria-level":"4"},FN={key:0,class:"zcode-text-editor"},jN=["value","placeholder","maxlength","readonly","disabled","onInput"],UN={key:0,class:"zcode-field-error-message"},HN={key:1,class:"zcode-field-counter"},WN={key:1,class:"zcode-text-editor"},GN=["value","placeholder","maxlength","readonly","disabled","onInput"],qN={key:0,class:"zcode-field-error-message"},KN={key:1,class:"zcode-field-counter"},JN={key:2,class:"zcode-rich-text-editor-wrapper"},XN={key:0,class:"zcode-field-error-message"},YN={key:3,class:"zcode-radio-editor"},QN={class:"zcode-radio-group"},ZN=["onUpdate:modelValue","name","value","onChange"],eC={class:"zcode-radio-item-label"},tC={key:4,class:"zcode-checkbox-editor"},nC={class:"zcode-checkbox-group"},oC=["onUpdate:modelValue","value","onChange"],rC={class:"zcode-checkbox-item-label"},iC={key:5,class:"zcode-select-editor"},sC=["onUpdate:modelValue","onChange"],aC=["value"],lC={key:6,class:"zcode-select-editor"},cC=["onUpdate:modelValue","size","onChange"],dC=["value"],uC={key:7,class:"zcode-tag-editor"},fC=["onUpdate:modelValue","onChange"],pC=["value"],hC={class:"zcode-tag-preview"},mC={key:8,class:"zcode-boolean-editor"},gC={class:"zcode-checkbox-item"},bC=["onUpdate:modelValue","onChange"],yC={class:"zcode-checkbox-item-label"},xC={key:9,class:"zcode-image-editor"},EC={class:"zcode-image-editor-buttons"},kC=["onClick"],wC=["title","onClick"],SC={key:0,class:"zcode-image-preview"},NC=["src","alt"],CC={key:3,class:"zcode-edit-fields"},vC={class:"zcode-edit-fields-text"},TC={class:"zcode-edit-fields-text"},zC=a.defineComponent({__name:"EditPanel",props:{editingComponent:{type:[Object,null]},editingAvailableFields:{type:Array},fieldErrors:{type:Object},currentMode:{type:String},canSelectParent:{type:Boolean},imagesCommon:{type:Array},imagesIndividual:{type:Array},imagesSpecial:{type:Array}},emits:["close","select-parent","save-field","add-image","delete-image"],setup(t,{emit:e}){const n=t,o=a.ref("all"),r=a.computed(()=>{const y=new Map;return n.editingAvailableFields.forEach(E=>{const S=E.groupName||"other";y.set(S,(y.get(S)||0)+1)}),Array.from(y.entries()).map(([E,S])=>({name:E,count:S}))}),i=a.computed(()=>r.value.length>1),s=a.computed(()=>!i.value||o.value==="all"?n.editingAvailableFields:n.editingAvailableFields.filter(y=>(y.groupName||"other")===o.value));a.watch(()=>i.value,y=>{y?o.value="all":o.value=void 0},{immediate:!0}),a.watch(()=>n.editingAvailableFields,()=>{if(i.value){if(o.value==="all")return;r.value.some(E=>E.name===o.value)||(o.value="all")}},{deep:!0});const l=e,c=a.ref({});function d(y){const E=y.label||y.fieldName,S=y.currentValue,D=y.type==="rich"&&typeof S=="string"&&S.trim()==="<p></p>"?"":S??"";return y.required&&(D===""||D===void 0||D===null)?`${E}は必須です`:typeof y.maxLength=="number"&&y.maxLength>0&&String(D).length>y.maxLength?`${E}は${y.maxLength}文字以内で入力してください`:null}function u(y,E){E?c.value[y]=E:delete c.value[y]}function f(y){return c.value[y]||n.fieldErrors?.[y]||null}const p=a.ref(!1),h=a.ref(null),m=y=>{h.value=y,p.value=!0},b=()=>{p.value=!1,h.value=null},g=y=>{y.currentValue="",l("save-field",y)},x=y=>{h.value&&(h.value.currentValue=y||"",l("save-field",h.value))},v=(y,E)=>{l("add-image",y,E)},w=y=>{l("delete-image",y),h.value?.currentValue===y&&(h.value.currentValue="",l("save-field",h.value))},T=y=>y&&[...n.imagesCommon,...n.imagesIndividual,...n.imagesSpecial].find(D=>D.id===y)?.url||null,M=(y,E)=>{const S=E.target;y.currentValue=S.value,u(y.fieldName,d(y)),l("save-field",y)},A=(y,E)=>{y.optional&&E===""?y.currentValue=void 0:y.currentValue=E,u(y.fieldName,d(y)),l("save-field",y)};return(y,E)=>t.editingComponent&&t.currentMode==="edit"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-edit-panel",onClick:E[3]||(E[3]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",ON,[a.createElementVNode("div",DN,a.toDisplayString(y.$t("editPanel.editing",{type:t.editingComponent.type})),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":y.$t("common.close"),onClick:E[0]||(E[0]=S=>y.$emit("close"))},[a.createVNode(a.unref(Qe),{size:18})],8,RN)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",PN,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:E[1]||(E[1]=S=>y.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(y.$t("addPanel.selectParent")),1)])])):a.createCommentVNode("",!0),i.value?(a.openBlock(),a.createElementBlock("div",LN,[a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="all"},"zcode-group-tab"]),onClick:E[2]||(E[2]=S=>o.value="all")}," all ",2),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,S=>(a.openBlock(),a.createElementBlock("button",{key:S.name,class:a.normalizeClass([{active:o.value===S.name},"zcode-group-tab"]),onClick:D=>o.value=S.name},a.toDisplayString(S.name),11,$N))),128))])):a.createCommentVNode("",!0),s.value.length>0?(a.openBlock(),a.createElementBlock("div",VN,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.value,S=>(a.openBlock(),a.createElementBlock("div",{key:S.fieldName,class:"zcode-field-item"},[a.createElementVNode("div",BN,a.toDisplayString(S.label),1),S.type==="text"?(a.openBlock(),a.createElementBlock("div",FN,[a.createElementVNode("input",{type:"text",value:S.currentValue??"",placeholder:S.defaultValue,maxlength:S.maxLength,readonly:S.readonly,disabled:S.disabled,class:a.normalizeClass([{"zcode-field-error":f(S.fieldName)},"zcode-text-input"]),onInput:D=>M(S,D)},null,42,jN),f(S.fieldName)?(a.openBlock(),a.createElementBlock("div",UN,a.toDisplayString(f(S.fieldName)),1)):a.createCommentVNode("",!0),S.maxLength?(a.openBlock(),a.createElementBlock("div",HN,a.toDisplayString(String(S.currentValue??"").length)+" / "+a.toDisplayString(S.maxLength),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),S.type==="textarea"?(a.openBlock(),a.createElementBlock("div",WN,[a.createElementVNode("textarea",{value:S.currentValue??"",placeholder:S.defaultValue,maxlength:S.maxLength,readonly:S.readonly,disabled:S.disabled,class:a.normalizeClass([{"zcode-field-error":f(S.fieldName)},"zcode-textarea"]),rows:"4",onInput:D=>M(S,D)},null,42,GN),f(S.fieldName)?(a.openBlock(),a.createElementBlock("div",qN,a.toDisplayString(f(S.fieldName)),1)):a.createCommentVNode("",!0),S.maxLength?(a.openBlock(),a.createElementBlock("div",KN,a.toDisplayString(String(S.currentValue??"").length)+" / "+a.toDisplayString(S.maxLength),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),S.type==="rich"?(a.openBlock(),a.createElementBlock("div",JN,[a.createVNode(gN,{"model-value":S.currentValue??"",placeholder:S.defaultValue,"onUpdate:modelValue":D=>A(S,D)},null,8,["model-value","placeholder","onUpdate:modelValue"]),f(S.fieldName)?(a.openBlock(),a.createElementBlock("div",XN,a.toDisplayString(f(S.fieldName)),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),S.type==="radio"?(a.openBlock(),a.createElementBlock("div",YN,[a.createElementVNode("div",QN,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(S.options,D=>(a.openBlock(),a.createElementBlock("label",{key:D,class:"zcode-radio-item"},[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":W=>S.currentValue=W,type:"radio",name:S.fieldName,value:D,onChange:W=>y.$emit("save-field",S)},null,40,ZN),[[a.vModelRadio,S.currentValue]]),a.createElementVNode("span",eC,a.toDisplayString(D),1)]))),128))])])):a.createCommentVNode("",!0),S.type==="checkbox"?(a.openBlock(),a.createElementBlock("div",tC,[a.createElementVNode("div",nC,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(S.options,D=>(a.openBlock(),a.createElementBlock("label",{key:D,class:"zcode-checkbox-item"},[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":W=>S.currentValue=W,type:"checkbox",value:D,onChange:W=>y.$emit("save-field",S)},null,40,oC),[[a.vModelCheckbox,S.currentValue]]),a.createElementVNode("span",rC,a.toDisplayString(D),1)]))),128))])])):a.createCommentVNode("",!0),S.type==="select"?(a.openBlock(),a.createElementBlock("div",iC,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":D=>S.currentValue=D,class:"zcode-select",onChange:D=>y.$emit("save-field",S)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(S.options,D=>(a.openBlock(),a.createElementBlock("option",{key:D,value:D},a.toDisplayString(D),9,aC))),128))],40,sC),[[a.vModelSelect,S.currentValue]])])):a.createCommentVNode("",!0),S.type==="select-multiple"?(a.openBlock(),a.createElementBlock("div",lC,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":D=>S.currentValue=D,class:"zcode-select",multiple:"",size:Math.min(S.options?.length||3,5),onChange:D=>y.$emit("save-field",S)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(S.options,D=>(a.openBlock(),a.createElementBlock("option",{key:D,value:D},a.toDisplayString(D),9,dC))),128))],40,cC),[[a.vModelSelect,S.currentValue]])])):a.createCommentVNode("",!0),S.type==="tag"?(a.openBlock(),a.createElementBlock("div",uC,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":D=>S.currentValue=D,class:"zcode-select",onChange:D=>y.$emit("save-field",S)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(S.options,D=>(a.openBlock(),a.createElementBlock("option",{key:D,value:D},a.toDisplayString(D),9,pC))),128))],40,fC),[[a.vModelSelect,S.currentValue]]),a.createElementVNode("div",hC,[E[4]||(E[4]=a.createTextVNode(" 現在のタグ: ",-1)),a.createElementVNode("code",null,"<"+a.toDisplayString(S.currentValue)+">",1)])])):a.createCommentVNode("",!0),S.type==="boolean"?(a.openBlock(),a.createElementBlock("div",mC,[a.createElementVNode("label",gC,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":D=>S.currentValue=D,type:"checkbox",onChange:D=>y.$emit("save-field",S)},null,40,bC),[[a.vModelCheckbox,S.currentValue]]),a.createElementVNode("span",yC,a.toDisplayString(S.label)+"を表示",1)])])):a.createCommentVNode("",!0),S.type==="image"?(a.openBlock(),a.createElementBlock("div",xC,[a.createElementVNode("div",EC,[a.createElementVNode("button",{class:"zcode-image-select-btn",onClick:D=>m(S)},[a.createVNode(a.unref(Rc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(S.currentValue?y.$t("editPanel.replaceImage"):y.$t("editPanel.selectImage")),1)],8,kC),S.currentValue?(a.openBlock(),a.createElementBlock("button",{key:0,class:"zcode-image-clear-btn",title:y.$t("editPanel.clearImageTitle"),onClick:D=>g(S)},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(y.$t("editPanel.clearImage")),1)],8,wC)):a.createCommentVNode("",!0)]),T(S.currentValue)?(a.openBlock(),a.createElementBlock("div",SC,[a.createElementVNode("img",{src:T(S.currentValue)||"",alt:S.label,class:"zcode-image-preview-img"},null,8,NC)])):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)]))),128))])):!i.value||s.value.length===0?(a.openBlock(),a.createElementBlock("div",CC,[a.createElementVNode("div",vC,a.toDisplayString(y.$t("editPanel.id",{id:t.editingComponent.id})),1),a.createElementVNode("div",TC," Type: "+a.toDisplayString(t.editingComponent.type),1)])):a.createCommentVNode("",!0),a.createVNode(IN,{"is-open":p.value,"images-common":t.imagesCommon,"images-individual":t.imagesIndividual,"images-special":t.imagesSpecial,"current-value":h.value?.currentValue||void 0,"onUpdate:modelValue":x,onAddImage:v,onDeleteImage:w,onClose:b},null,8,["is-open","images-common","images-individual","images-special","current-value"])])):a.createCommentVNode("",!0)}}),_C={class:"zcode-delete-panel-header"},AC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},MC=["aria-label"],IC={key:0,class:"zcode-parent-selector"},OC={class:"zcode-delete-panel-content"},DC={class:"zcode-delete-warning"},RC={class:"zcode-delete-warning-text"},PC={class:"zcode-delete-actions"},LC=a.defineComponent({__name:"DeletePanel",props:{deleteConfirmComponent:{type:[Object,null]},currentMode:{type:String},canSelectParent:{type:Boolean}},emits:["confirm","cancel","select-parent"],setup(t){return(e,n)=>t.deleteConfirmComponent&&t.currentMode==="delete"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-delete-panel",onClick:n[4]||(n[4]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",_C,[a.createElementVNode("div",AC,a.toDisplayString(e.$t("deletePanel.title")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":e.$t("common.close"),onClick:n[0]||(n[0]=o=>e.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:18})],8,MC)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",IC,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:n[1]||(n[1]=o=>e.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("deletePanel.selectParent")),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",OC,[a.createElementVNode("div",DC,[a.createVNode(a.unref(Vc),{size:20,class:"zcode-delete-warning-icon"}),a.createElementVNode("div",RC,a.toDisplayString(e.$t("deletePanel.confirmMessage")),1)]),a.createElementVNode("div",PC,[a.createElementVNode("button",{class:"zcode-btn-danger",onClick:n[2]||(n[2]=o=>e.$emit("confirm"))},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("common.delete")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel",onClick:n[3]||(n[3]=o=>e.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("common.cancel")),1)])])])])):a.createCommentVNode("",!0)}}),$C={class:"zcode-reorder-panel-header"},VC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},BC=["aria-label"],FC={key:0,class:"zcode-parent-selector"},jC={class:"zcode-reorder-panel-content"},UC={class:"zcode-reorder-panel-content-text"},HC={class:"zcode-reorder-source"},WC=a.defineComponent({__name:"ReorderPanel",props:{reorderSourcePath:{type:String},currentMode:{type:String},canSelectParent:{type:Boolean}},emits:["cancel","select-parent"],setup(t){return(e,n)=>t.reorderSourcePath&&t.currentMode==="reorder"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-reorder-panel",onClick:n[2]||(n[2]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",$C,[a.createElementVNode("div",VC,a.toDisplayString(e.$t("reorderPanel.title")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":e.$t("common.close"),onClick:n[0]||(n[0]=o=>e.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:18})],8,BC)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",FC,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:n[1]||(n[1]=o=>e.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("reorderPanel.selectParent")),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",jC,[a.createElementVNode("div",UC,a.toDisplayString(e.$t("reorderPanel.instruction")),1),a.createElementVNode("div",HC,a.toDisplayString(e.$t("reorderPanel.source",{path:t.reorderSourcePath})),1)])])):a.createCommentVNode("",!0)}}),GC={class:"zcode-add-panel-header"},qC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},KC=["aria-label"],JC={key:0,class:"zcode-parent-selector"},XC={class:"zcode-part-category-tabs"},YC=["onClick"],QC={key:1,class:"zcode-type-tabs"},ZC=["onClick"],ev={class:"zcode-add-panel-content"},tv={class:"zcode-part-list"},nv={class:"zcode-part-type-section"},ov={class:"zcode-type-section-title",role:"heading","aria-level":"3"},rv={class:"zcode-type-section-description"},iv={key:0,class:"zcode-module-buttons"},sv={class:"zcode-module-preview-header"},av={class:"zcode-module-preview-label zcode-module-preview-label-header"},lv=["aria-label"],cv=["innerHTML"],dv={key:1,class:"zcode-empty-parts"},uv={class:"zcode-empty-parts-text"},fv={class:"zcode-type-section-title",role:"heading","aria-level":"3"},pv={key:0,class:"zcode-type-section-description"},hv={class:"zcode-module-buttons"},mv=["onClick"],gv={class:"zcode-module-preview-header"},bv={class:"zcode-module-preview-label zcode-module-preview-label-header"},yv=["aria-label","onClick"],xv=["innerHTML"],Ev={key:0,class:"zcode-empty-parts"},kv={class:"zcode-empty-parts-text"},wv={key:2,class:"zcode-insert-position"},Sv={class:"zcode-insert-header"},Nv={class:"zcode-keep-adding-label zcode-keep-adding-label-position"},Cv=["checked"],vv={class:"zcode-insert-buttons"},Tv={class:"zcode-preview-modal-header"},zv={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},_v=["innerHTML"],Av=a.defineComponent({__name:"AddPanel",props:{addTargetPath:{type:[String,null]},addPartCategory:{type:String},addTypeTab:{type:[String,null]},addSelectedPart:{type:[Object,null]},addSelectedType:{type:[Object,null]},clickedComponent:{type:[Object,null]},availablePartTypes:{type:Array},groupedPartsByType:{type:Array},canSelectParent:{type:Boolean},getPartPreviewHtml:{type:Function},getClickedComponentPreviewHtml:{type:Function},keepAdding:{type:Boolean},hasSpecialParts:{type:Boolean},config:{type:Object}},emits:["cancel","select-parent","category-tab-click","type-tab-click","select-part","confirm-add","update-keep-adding"],setup(t){const e=t,n=a.computed(()=>e.config?.categoryOrder||"common"),o=a.computed(()=>{const d=[];return n.value==="individual"?(d.push("individual","common"),e.hasSpecialParts&&d.push("special")):n.value==="special"?(e.hasSpecialParts&&d.push("special"),d.push("common","individual")):(d.push("common","individual"),e.hasSpecialParts&&d.push("special")),d}),r=a.ref(!1),i=a.ref(null);function s(d,u){i.value={type:d,part:u,isActiveParts:!1},r.value=!0}function l(){e.addSelectedType&&e.addSelectedPart&&(i.value={type:e.addSelectedType,part:e.addSelectedPart,isActiveParts:!0},r.value=!0)}function c(){r.value=!1,i.value=null}return(d,u)=>t.addTargetPath?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-add-panel",onClick:u[9]||(u[9]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",GC,[a.createElementVNode("div",qC,a.toDisplayString(d.$t("addPanel.title")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":d.$t("common.close"),onClick:u[0]||(u[0]=f=>d.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:18})],8,KC)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",JC,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:u[1]||(u[1]=f=>d.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(d.$t("addPanel.selectParent")),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",XC,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.value,f=>(a.openBlock(),a.createElementBlock("button",{key:f,class:a.normalizeClass([{active:t.addPartCategory===f&&t.addTypeTab!=="selected"},"zcode-category-tab"]),onClick:p=>d.$emit("category-tab-click",f)},a.toDisplayString(f==="common"?d.$t("addPanel.category.common"):f==="individual"?d.$t("addPanel.category.individual"):d.$t("dataViewer.special")),11,YC))),128)),a.createElementVNode("button",{class:a.normalizeClass([{active:t.addTypeTab==="selected"},"zcode-category-tab"]),onClick:u[2]||(u[2]=f=>d.$emit("type-tab-click","selected"))},a.toDisplayString(d.$t("addPanel.category.selected")),3)]),t.availablePartTypes.length>0&&t.addTypeTab!=="selected"?(a.openBlock(),a.createElementBlock("div",QC,[a.createElementVNode("button",{class:a.normalizeClass([{active:t.addTypeTab==="all"},"zcode-type-tab"]),onClick:u[3]||(u[3]=f=>d.$emit("type-tab-click","all"))}," all ",2),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.availablePartTypes,f=>(a.openBlock(),a.createElementBlock("button",{key:f,class:a.normalizeClass([{active:t.addTypeTab===f},"zcode-type-tab"]),onClick:p=>d.$emit("type-tab-click",f)},a.toDisplayString(f),11,ZC))),128))])):a.createCommentVNode("",!0),a.createElementVNode("div",ev,[a.createElementVNode("div",tv,[a.withDirectives(a.createElementVNode("div",nv,[a.createElementVNode("div",ov,a.toDisplayString(d.$t("addPanel.activeParts")),1),a.createElementVNode("div",rv,a.toDisplayString(d.$t("addPanel.activePartsDescription")),1),t.clickedComponent&&t.addSelectedPart&&t.addSelectedType?(a.openBlock(),a.createElementBlock("div",iv,[a.createElementVNode("div",{class:a.normalizeClass([{active:!0},"zcode-module-preview"])},[a.createElementVNode("div",sv,[a.createElementVNode("div",av,a.toDisplayString(d.$t("addPanel.activeParts")),1),a.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:u[4]||(u[4]=a.withModifiers(f=>l(),["stop"]))},[a.createVNode(a.unref(Bc),{size:14})],8,lv)]),a.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:t.getClickedComponentPreviewHtml()},null,8,cv)])])):(a.openBlock(),a.createElementBlock("div",dv,[a.createElementVNode("div",uv,a.toDisplayString(d.$t("addPanel.clickPartInPreview")),1)]))],512),[[a.vShow,t.addTypeTab==="selected"]]),a.withDirectives(a.createElementVNode("div",null,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.groupedPartsByType,f=>(a.openBlock(),a.createElementBlock("div",{key:f.type,class:"zcode-part-type-section"},[a.createElementVNode("div",fv,a.toDisplayString(f.type),1),f.description?(a.openBlock(),a.createElementBlock("div",pv,a.toDisplayString(f.description),1)):a.createCommentVNode("",!0),a.createElementVNode("div",hv,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(f.parts,p=>(a.openBlock(),a.createElementBlock("div",{key:p.title,class:a.normalizeClass([{active:t.addTypeTab==="selected"&&t.clickedComponent?.part_id===p.id&&t.clickedComponent?.id?!0:t.addTypeTab!=="selected"&&t.addSelectedPart?.id===p.id},"zcode-module-preview"]),onClick:h=>d.$emit("select-part",f.typeData,p)},[a.createElementVNode("div",gv,[a.createElementVNode("div",bv,a.toDisplayString(p.title),1),a.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:a.withModifiers(h=>s(f.typeData,p),["stop"])},[a.createVNode(a.unref(Bc),{size:14})],8,yv)]),a.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:t.getPartPreviewHtml(f.typeData,p)},null,8,xv)],10,mv))),128))])]))),128)),t.groupedPartsByType.length===0&&!t.addSelectedPart?(a.openBlock(),a.createElementBlock("div",Ev,[a.createElementVNode("div",kv,a.toDisplayString(d.$t("addPanel.noPartsAvailable")),1)])):a.createCommentVNode("",!0)],512),[[a.vShow,t.addTypeTab!=="selected"]])])]),t.addSelectedPart?(a.openBlock(),a.createElementBlock("div",wv,[a.createElementVNode("div",Sv,[u[10]||(u[10]=a.createElementVNode("div",{class:"zcode-insert-position-title",role:"heading","aria-level":"4"}," 追加位置を選択 ",-1)),a.createElementVNode("label",Nv,[a.createElementVNode("input",{type:"checkbox",checked:t.keepAdding,class:"zcode-keep-adding-checkbox",onChange:u[5]||(u[5]=f=>d.$emit("update-keep-adding",f.target.checked))},null,40,Cv),a.createElementVNode("span",null,a.toDisplayString(d.$t("addPanel.continueAdding")),1)])]),a.createElementVNode("div",vv,[a.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-before",onClick:u[6]||(u[6]=f=>d.$emit("confirm-add","before"))},a.toDisplayString(d.$t("addPanel.addBefore")),1),a.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-after",onClick:u[7]||(u[7]=f=>d.$emit("confirm-add","after"))},a.toDisplayString(d.$t("addPanel.addAfter")),1)])])):a.createCommentVNode("",!0),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[r.value&&i.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:c},[a.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:u[8]||(u[8]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",Tv,[a.createElementVNode("div",zv,a.toDisplayString(d.$t("common.preview"))+": "+a.toDisplayString(i.value.isActiveParts?d.$t("addPanel.activeParts"):i.value.part.title),1),a.createElementVNode("button",{class:"zcode-close-btn",onClick:c},[a.createVNode(a.unref(Qe),{size:18})])]),a.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:i.value.isActiveParts?t.getClickedComponentPreviewHtml():t.getPartPreviewHtml(i.value.type,i.value.part)},null,8,_v)])])):a.createCommentVNode("",!0)]))])):a.createCommentVNode("",!0)}}),Mv=a.defineComponent({__name:"ContextMenu",props:{isVisible:{type:Boolean},position:{type:Object},currentMode:{type:String}},emits:["select-mode","close"],setup(t,{emit:e}){const n=e;function o(i){n("select-mode",i),n("close")}function r(){n("close")}return(i,s)=>t.isVisible?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-context-menu",style:a.normalizeStyle({left:`${t.position.x}px`,top:`${t.position.y}px`}),onClick:s[4]||(s[4]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="edit"}]),onClick:s[0]||(s[0]=l=>o("edit"))},[a.createVNode(a.unref(Pc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.edit")),1)],2),a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="add"}]),onClick:s[1]||(s[1]=l=>o("add"))},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.add")),1)],2),a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="reorder"}]),onClick:s[2]||(s[2]=l=>o("reorder"))},[a.createVNode(a.unref(ir),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.reorder")),1)],2),a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="delete"}]),onClick:s[3]||(s[3]=l=>o("delete"))},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.delete")),1)],2),s[5]||(s[5]=a.createElementVNode("div",{class:"zcode-context-menu-divider"},null,-1)),a.createElementVNode("button",{class:"zcode-context-menu-item",onClick:r},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.close")),1)])],4)):a.createCommentVNode("",!0)}});function Iv(t){if(t.defaultValue!==void 0&&t.defaultValue!=="")switch(t.type){case"rich":return`<p>${t.defaultValue}</p>`;case"image":return t.defaultValue;default:return t.defaultValue}switch(t.type){case"text":case"textarea":return"";case"rich":return"<p></p>";case"radio":case"select":return t.options?.[0]||"";case"checkbox":case"select-multiple":return[];case"boolean":return!0;case"image":return"";default:return""}}function Ov(t,e){const n=ha(t.part_id,e);if(!n)return;Fn(n.body).forEach(r=>{r.optional||t[r.fieldName]===void 0&&(t[r.fieldName]=Iv(r))})}function Dv(t){function e(n){Ov(n,t.parts),n.slots&&Object.values(n.slots).forEach(o=>{(Array.isArray(o)?o:o?.children||[]).forEach(i=>{e(i)})})}t.page.forEach(n=>{e(n)})}function km(t){const e=a.reactive({page:[],css:{common:void 0,individual:void 0,special:void 0},parts:{common:[],individual:[],special:[]},images:{common:[],individual:[],special:[]},backendData:void 0});function n(){try{const i=t.page?JSON.parse(t.page):[],s=t.partsCommon?JSON.parse(t.partsCommon):[],l=t.partsIndividual?JSON.parse(t.partsIndividual):[],c=t.partsSpecial?JSON.parse(t.partsSpecial):[],d=t.imagesCommon?JSON.parse(t.imagesCommon):[],u=t.imagesIndividual?JSON.parse(t.imagesIndividual):[],f=t.imagesSpecial?JSON.parse(t.imagesSpecial):[],p=t.cssCommon!==void 0?t.cssCommon:void 0,h=t.cssIndividual!==void 0?t.cssIndividual:void 0,m=t.cssSpecial!==void 0?t.cssSpecial:void 0,b=t.backendData?JSON.parse(t.backendData):void 0;Object.assign(e,{page:i,css:{common:p,individual:h,special:m},parts:{common:s,individual:l,special:c},images:{common:d,individual:u,special:f},backendData:b}),Dv(e)}catch(i){console.error("Failed to parse props:",i)}}function o(i){if(!i)return e;const s=i.split(".");let l=e;for(const c of s)if(l==null||typeof l!="object"||(l=l[c],l===void 0))return;return l}function r(i,s){if(typeof i=="string"){const l=i.split(".");let c=e;for(let d=0;d<l.length-1;d++){const u=c[l[d]];if(u==null||typeof u!="object")return;c=u}c[l[l.length-1]]=s}else Object.assign(e,i)}return{cmsData:e,loadDataFromProps:n,getData:o,setData:r}}function Rv(){const t=a.ref("edit"),e=a.ref(!1);function n(o){t.value=o}return{currentMode:t,switchMode:n,allowDynamicContentInteraction:e}}function wm(t){const e=document.documentElement,o={edit:"--zcode-color-edit",add:"--zcode-color-add",reorder:"--zcode-color-reorder",delete:"--zcode-color-delete"}[t]||"--zcode-color-edit";return getComputedStyle(e).getPropertyValue(o).trim()||"#3b82f6"}function Yt(t,e){const n=wm(e);t.classList.remove("zcode-outline-active-edit","zcode-outline-active-add","zcode-outline-active-reorder","zcode-outline-active-delete"),t.classList.add(`zcode-outline-active-${e}`),t.style.outlineColor=n,t.style.outlineStyle="solid"}function Qt(t){t.style.outline="",t.style.outlineOffset="",t.classList.remove("zcode-outline-active-edit","zcode-outline-active-add","zcode-outline-active-reorder","zcode-outline-active-delete")}function wc(t,e){const n=wm(e);t.style.outline=`2px dashed ${n}`,t.style.outlineOffset="2px"}function yn(t){t.style.outline="",t.style.outlineOffset=""}function Pv(t,e){const n=a.ref(null),o=a.ref(-1),r=a.ref(""),i=a.ref([]);function s(u){const f=u.part_id,p=t.parts,h=[...p.common,...p.individual];let m=null;for(const g of h){const x=g.parts.find(v=>v.id===f);if(x){m=x;break}}return m?Fn(m.body).map(g=>{const x={fieldName:g.fieldName,groupName:g.groupName,label:Pg(g.fieldName),required:g.required,maxLength:g.maxLength,readonly:g.readonly,disabled:g.disabled};if(g.type==="text")return{...x,type:"text",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue};if(g.type==="textarea")return{...x,type:"textarea",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue||""};if(g.type==="rich")return{...x,type:"rich",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue||""};if(g.type==="radio")return{...x,type:"radio",options:g.options,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.options?.[0]};if(g.type==="boolean")return{...x,type:"boolean",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:!0};if(g.type==="image")return{...x,type:"image",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue||""};if(g.type==="select")return{...x,type:"select",options:g.options,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.options?.[0]};if(g.type==="select-multiple")return{...x,type:"select-multiple",options:g.options,optional:g.optional,currentValue:Array.isArray(u[g.fieldName])?u[g.fieldName]:[]};if(g.type==="tag"){const v=["h1","h2","h3","h4","h5","h6","div","p","span","li","ul","ol","section","article","aside","nav","header","footer","main","figure","figcaption","blockquote","pre","code","table","thead","tbody","tr","th","td"],w=g.options||v;return{...x,type:"tag",options:w,defaultValue:g.defaultValue||"div",currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.defaultValue||"div"}}else return{...x,type:"checkbox",options:g.options,optional:g.optional,currentValue:Array.isArray(u[g.fieldName])?u[g.fieldName]:[]}}):[]}function l(u,f){if(r.value===u){d();return}const p=u.split(".");let h=-1;if(p[0]==="page"&&p.length>=2&&(h=parseInt(p[1])),r.value&&e.value){const m=e.value.querySelector(`[data-zcode-path="${r.value}"]`);m&&Qt(m)}n.value=f,o.value=h,r.value=u,i.value=s(f),a.nextTick(()=>{if(e.value&&r.value===u){const m=e.value.querySelector(`[data-zcode-path="${u}"]`);m&&(Yt(m,"edit"),ar(m))}})}function c(u){if(n.value&&r.value){const f=dn(r.value,t);f&&(u.optional&&(u.currentValue===""||u.currentValue===null)?f[u.fieldName]=void 0:f[u.fieldName]=u.currentValue)}}function d(){if(r.value&&e.value){const u=e.value.querySelector(`[data-zcode-path="${r.value}"]`);u&&Qt(u)}n.value=null,r.value="",i.value=[]}return{editingComponent:n,editingComponentIndex:o,editingComponentPath:r,editingAvailableFields:i,handleEditClick:l,saveFieldEdit:c,closeEditPanel:d}}function Lv(t,e,n,o){const r=a.ref(null),i=a.ref(null),s=a.ref(null),l=a.ref(o?.categoryOrder==="individual"?"individual":o?.categoryOrder==="special"?"special":"common"),c=a.ref("all"),d=a.ref(null),u=a.ref(!1);function f(z){if(z.includes(".slots.")){const P=z.split(".");let V=-1;for(let j=P.length-1;j>=0;j--)if(P[j]==="slots"){V=j;break}if(V!==-1&&V+1<P.length)return P.slice(0,V+2).join(".")}return z}const p=a.computed(()=>{const z=t.parts,P=l.value==="common"?z.common:l.value==="individual"?z.individual:z.special;if(r.value&&r.value.includes(".slots.")){const j=[...z.common,...z.individual,...z.special],L=f(r.value);return b(L,j,P)}return[...new Set(P.map(j=>j.type))]});function h(z,P){const V=z.split(".");let j=-1;for(let J=V.length-1;J>=0;J--)if(V[J]==="slots"){j=J;break}if(j===-1)return null;const L=V.slice(0,j).join("."),H=V[j+1],Q=dn(L,t);if(!Q)return null;const G=Q.part_id;let se=null;for(const J of P)if(J.parts.some(K=>K.id===G)){se=J;break}if(!se)return null;const X=(se.parts.find(J=>J.id===G)||se.parts[0])?.slots?.[H];if(X){const J=X.allowedParts;if(J&&Array.isArray(J))return J}return null}const m=a.computed(()=>{const z=t.parts,P=l.value==="common"?z.common:l.value==="individual"?z.individual:z.special,V=p.value;let j=P.filter(G=>V.includes(G.type));c.value&&c.value!=="all"&&c.value!=="selected"&&(j=j.filter(G=>G.type===c.value));const L=[...z.common,...z.individual],H=r.value&&r.value.includes(".slots.")?h(f(r.value),L):null,Q=new Map;return j.forEach(G=>{Q.has(G.type)||Q.set(G.type,{type:G,parts:[]});const se=Q.get(G.type);H!==null?H.length>0&&G.parts.forEach(Z=>{H.includes(Z.id)&&se.parts.push(Z)}):G.parts.forEach(Z=>{Z.slotOnly||se.parts.push(Z)})}),Array.from(Q.values()).map(G=>({type:G.type.type,description:G.type.description,typeData:G.type,parts:G.parts}))});function b(z,P,V){const j=z.split(".");let L=-1;for(let K=j.length-1;K>=0;K--)if(j[K]==="slots"){L=K;break}if(L===-1)return[...new Set(V.map(K=>K.type))];const H=j.slice(0,L).join("."),Q=j[L+1],G=dn(H,t);if(!G)return[...new Set(V.map(K=>K.type))];const se=G.part_id;let Z=null,X=null;for(const K of P){const Y=K.parts.find(ce=>ce.id===se);if(Y){Z=K,X=Y;break}}if(!Z||!X)return[...new Set(V.map(K=>K.type))];const J=X?.slots?.[Q];if(J){const K=J.allowedParts;if(K&&Array.isArray(K)){const Y=new Set;P.forEach(Ee=>{Ee.parts.forEach(_e=>{K.includes(_e.id)&&Y.add(Ee.type)})});let ce=Array.from(Y);return ce=ce.filter(Ee=>V.some(_e=>_e.type===Ee)),ce}}return[...new Set(V.map(K=>K.type))]}function g(z,P=!1){if(r.value===z){D();return}if(r.value&&e.value){const ce=e.value.querySelector(`[data-zcode-path="${r.value}"]`);ce&&Qt(ce);const Ee=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);Ee&&Qt(Ee)}r.value=z,c.value="all",l.value="common",i.value=null,s.value=null;const V=dn(z,t);V&&V.part_id?d.value=V:d.value=null;const j=t.parts,L=j.common,H=j.individual,Q=j.special;let G=[],se=[];if(z.includes(".slots.")){const ce=[...L,...H,...Q],Ee=f(z);G=b(Ee,ce,L),se=b(Ee,ce,H)}else G=[...new Set(L.map(ce=>ce.type))],se=[...new Set(H.map(ce=>ce.type))];const Z=G.length>0,X=se.length>0,J=Q.length>0,K=o?.categoryOrder;let Y;K==="special"&&J?Y="special":K==="individual"&&X?Y="individual":K==="common"&&Z||Z?Y="common":X?Y="individual":J?Y="special":Y="common",l.value=Y,a.nextTick(()=>{if(e.value&&r.value===z){const ce=e.value.querySelector(`[data-zcode-path="${z}"]`);if(ce)Yt(ce,"add"),ar(ce);else{const Ee=f(z);if(Ee!==z){const _e=e.value.querySelector(`[data-zcode-slot-path="${Ee}"]`);_e&&(Yt(_e,"add"),ar(_e))}}}})}function x(z){l.value=z,c.value="all",i.value=null,s.value=null,u.value=!1}function v(z){if(c.value=z,z==="selected"&&d.value&&d.value.part_id){const P=t.parts,V=[...P.common,...P.individual,...P.special];for(const j of V){const L=j.parts.find(H=>H.id===d.value.part_id);if(L){i.value=j,s.value=L;break}}}else z!=="selected"&&(i.value=null,s.value=null);u.value=!1}function w(z,P){const V=M(z,P);return n(V,"")}function T(){return d.value?n(d.value,""):""}function M(z,P){const V=y(z,!1,new Set,P.id);return V.id="preview",V}function A(z,P){if(s.value?.id===P.id){i.value=null,s.value=null;return}i.value=z,s.value=P,c.value==="selected"&&(c.value="all"),u.value=!1}function y(z,P=!1,V=new Set,j){const L=j?z.parts.find(X=>X.id===j)||z.parts[0]:P&&s.value?s.value:z.parts[0];if(!L)throw new Error(`Part not found for type: ${z.type}`);const H=`${z.id}:${L.id}`;if(V.has(H)){const X=Fn(L.body),J={};return X.forEach(K=>{K.optional?J[K.fieldName]=void 0:K.type==="text"?J[K.fieldName]=K.defaultValue:K.type==="radio"?J[K.fieldName]=K.options?.[0]:K.type==="checkbox"?J[K.fieldName]=[]:K.type==="boolean"?J[K.fieldName]=!0:K.type==="rich"?J[K.fieldName]=K.defaultValue?`<p>${K.defaultValue}</p>`:"<p></p>":K.type==="image"&&(J[K.fieldName]=K.defaultValue||"")}),{id:jn(),part_id:L.id,...J}}V.add(H);const Q=Fn(L.body),G={};Q.forEach(X=>{X.optional?G[X.fieldName]=void 0:X.type==="text"?G[X.fieldName]=X.defaultValue:X.type==="radio"?G[X.fieldName]=X.options?.[0]:X.type==="checkbox"?G[X.fieldName]=[]:X.type==="boolean"?G[X.fieldName]=!0:X.type==="rich"?G[X.fieldName]=X.defaultValue?`<p>${X.defaultValue}</p>`:"<p></p>":X.type==="image"&&(G[X.fieldName]=X.defaultValue||"")});const se={id:jn(),part_id:L.id,...G},Z=L.slots;if(Z){const X={};Object.entries(Z).forEach(([J,K])=>{const Y=K.allowedParts;if(Y&&Y.length===1){const ce=Y[0],Ee=t.parts,_e=[...Ee.common,...Ee.individual,...Ee.special];let Le=null,C=null;for(const N of _e){const O=N.parts.find(k=>k.id===ce);if(O){Le=N,C=O;break}}if(Le&&C){const N=y(Le,!1,V,C.id);X[J]=[N]}else X[J]=[]}else X[J]=[]}),Object.keys(X).length>0&&(se.slots=X)}return se}function E(z){return y(z,!0)}function S(z){if(!i.value||!s.value||!r.value){console.error("Missing required values:",{addSelectedType:i.value,addSelectedPart:s.value,addTargetPath:r.value});return}let P;if(c.value==="selected"&&d.value){if(P=JSON.parse(JSON.stringify(d.value)),P.id=jn(),P.slots){const L=H=>{H.forEach(Q=>{Q.id=jn(),Q.slots&&Object.values(Q.slots).forEach(G=>{Array.isArray(G)?L(G):G&&typeof G=="object"&&G.children&&L(G.children||[])})})};Object.values(P.slots).forEach(H=>{Array.isArray(H)?L(H):H&&typeof H=="object"&&H.children&&L(H.children||[])})}}else P=E(i.value);const V=r.value,j=V.split(".");if(j[0]==="page"&&j.length===2){const L=parseInt(j[1]);z==="before"?(t.page.splice(L,0,P),u.value&&(r.value=`page.${L+1}`)):t.page.splice(L+1,0,P)}else if(j.includes("slots")){const L=f(V),H=L.split(".");let Q=-1;for(let Y=H.length-1;Y>=0;Y--)if(H[Y]==="slots"){Q=Y;break}if(Q===-1||Q>=H.length-1){console.error("Invalid slot path:",L);return}const G=H.slice(0,Q).join("."),se=H[Q+1],Z=V!==L?parseInt(j[j.length-1]):-1,X=dn(G,t);if(!X){console.error("Parent component not found:",G);return}X.slots||(X.slots={});const J=X.slots[se];let K=[];if(Array.isArray(J)?K=J:J&&typeof J=="object"&&J.children?(K=J.children||[],J.children||(J.children=[])):(X.slots[se]=[],K=X.slots[se]),Z===-1)K.push(P);else if(z==="before"){if(K.splice(Z,0,P),u.value){const Y=f(V);if(V!==Y){const ce=[...j];ce[ce.length-1]=String(Z+1),r.value=ce.join(".")}else{const Ee=[...Y.split(".")];Ee.push("0"),r.value=Ee.join(".")}}}else K.splice(Z+1,0,P);Array.isArray(X.slots[se])||(X.slots[se].children=K)}if(d.value||c.value==="selected"&&(c.value="all"),!u.value)D();else if(z==="before"&&e.value&&r.value){const L=e.value.querySelector(`[data-zcode-path="${V}"]`);L&&Qt(L),a.nextTick(()=>{if(e.value&&r.value){const H=e.value.querySelector(`[data-zcode-path="${r.value}"]`);H&&Yt(H,"add")}})}}function D(){if(r.value&&e.value){const z=e.value.querySelector(`[data-zcode-path="${r.value}"]`);z&&Qt(z);const P=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);P&&Qt(P)}r.value=null,i.value=null,s.value=null,d.value=null,l.value="common",c.value="all",u.value=!1}const W=a.computed(()=>t.parts.special.length>0);return{addTargetPath:r,addSelectedType:i,addSelectedPart:s,clickedComponent:d,addPartCategory:l,addTypeTab:c,keepAdding:u,availablePartTypes:p,groupedPartsByType:m,hasSpecialParts:W,handleAddClick:g,handleCategoryTabClick:x,handleTypeTabClick:v,selectPart:A,getPartPreviewHtml:w,getClickedComponentPreviewHtml:T,confirmAddPart:S,cancelAdd:D}}function $v(t,e,n,o){const r=a.ref(null),i=a.ref("");function s(f,p){if(i.value===f){u();return}if(i.value&&e.value){const h=e.value.querySelector(`[data-zcode-path="${i.value}"]`);h&&Qt(h)}r.value=p,i.value=f,o(()=>{if(e.value&&i.value===f){const h=e.value.querySelector(`[data-zcode-path="${f}"]`);h&&(Yt(h,"delete"),ar(h))}})}function l(){if(!i.value)return;const f=i.value,p=f.split(".");let h=null,m=null;if(p.length===2&&p[0]==="page"){const b=parseInt(p[1]);!isNaN(b)&&b>=0&&b<t.page.length&&(t.page.splice(b,1),t.page.length===0&&o(()=>{n("add")}))}else if(p.length>2&&p[0]==="page"){const b=parseInt(p[1]);if(isNaN(b)||b<0||b>=t.page.length){console.error("Invalid top-level index:",b),u();return}let g=t.page[b];const x=p.slice(2);x.length>=3&&x[0]==="slots"&&(m=x[1],h=`page.${b}`);for(let w=0;w<x.length-1;w++){if(!g||typeof g!="object"){console.error("Invalid path:",f),u();return}g=g[x[w]]}const v=x[x.length-1];if(g&&typeof g=="object")if(Array.isArray(g)){const w=parseInt(v);!isNaN(w)&&w>=0&&w<g.length?g.splice(w,1):console.error("Invalid array index:",v)}else v in g?delete g[v]:console.error("Field not found:",f);else console.error("Invalid current object:",f)}h&&m&&o(()=>{c(h,m)}),u()}function c(f,p){const h=dn(f,t);if(!h)return;const m=h.slots;if(!m||!Array.isArray(m[p]))return;const b=m[p];if(b.length===0){const g=h.part_id,x=t.parts,v=[...x.common,...x.individual];let w=null,T=null;for(const A of v){const y=A.parts.find(E=>E.id===g);if(y){w=A,T=y;break}}if(!w||!T)return;const M=T?.slots?.[p];if(M){const A=M.allowedParts;if(A&&A.length===1){const y=A[0];let E=null,S=null;for(const D of v){const W=D.parts.find(z=>z.id===y);if(W){E=D,S=W;break}}if(E&&S){const D=d(E,S.id);b.push(D)}}}}}function d(f,p){const h=p&&f.parts.find(v=>v.id===p)||f.parts[0];if(!h)throw new Error(`Part not found for type: ${f.type}`);const m=Fn(h.body),b={};m.forEach(v=>{v.optional?b[v.fieldName]=void 0:v.type==="text"?b[v.fieldName]=v.defaultValue:v.type==="radio"?b[v.fieldName]=v.options?.[0]:v.type==="checkbox"?b[v.fieldName]=[]:v.type==="boolean"?b[v.fieldName]=!0:v.type==="rich"?b[v.fieldName]=v.defaultValue?`<p>${v.defaultValue}</p>`:"<p></p>":v.type==="image"&&(b[v.fieldName]=v.defaultValue||"")});const g={id:jn(),part_id:h.id,...b},x=h.slots;if(x){const v={};Object.entries(x).forEach(([w,T])=>{const M=T.allowedParts;if(M&&M.length===1){const A=M[0],y=t.parts,E=[...y.common,...y.individual];let S=null,D=null;for(const W of E){const z=W.parts.find(P=>P.id===A);if(z){S=W,D=z;break}}if(S&&D){const W=d(S,D.id);v[w]=[W]}else v[w]=[]}else v[w]=[]}),Object.keys(v).length>0&&(g.slots=v)}return g}function u(){if(i.value&&e.value){const f=e.value.querySelector(`[data-zcode-path="${i.value}"]`);f&&Qt(f)}r.value=null,i.value=""}return{deleteConfirmComponent:r,deleteConfirmPath:i,handleDeleteClick:s,confirmDelete:l,cancelDelete:u}}function Vv(t,e){const n=a.ref("");function o(l,c){if(!l||!c)return!1;const d=l.split("."),u=c.split(".");if(d.length!==u.length||l===c)return!1;if(d.includes("slots")&&u.includes("slots")){let f=-1,p=-1;for(let x=d.length-1;x>=0;x--)if(d[x]==="slots"){f=x;break}for(let x=u.length-1;x>=0;x--)if(u[x]==="slots"){p=x;break}if(f===-1||p===-1)return!1;const h=d.slice(0,f).join("."),m=u.slice(0,p).join(".");if(h!==m)return!1;const b=d[f+1],g=u[p+1];return b===g}if(d.length>2){const f=d.slice(0,-1).join("."),p=u.slice(0,-1).join(".");if(f!==p)return!1}return!0}function r(l){if(!l)return;if(!n.value){const d=od(l);if(d&&e.value){const u=e.value.querySelector(`[data-zcode-path="${d}"]`);u&&yn(u)}if(n.value=l,e.value){const u=e.value.querySelector(`[data-zcode-path="${l}"]`);u&&(Yt(u,"reorder"),ar(u))}return}if(n.value===l){i();return}if(!o(n.value,l)){alert("この要素とは並べ替えできません。同じ階層の要素を選択してください。"),i();return}s(n.value,l)||alert("並べ替えに失敗しました。同じ階層の要素を選択してください。"),i()}function i(){if(n.value&&e.value){const l=e.value.querySelector(`[data-zcode-path="${n.value}"]`);l&&Qt(l)}n.value=""}function s(l,c){const d=l.split("."),u=c.split(".");if(d.length===2&&u.length===2&&d[0]==="page"&&u[0]==="page"){const f=parseInt(d[1]),p=parseInt(u[1]);if(!isNaN(f)&&!isNaN(p)&&f!==p){const h=[...t.page],[m]=h.splice(f,1);return h.splice(p,0,m),t.page=h,!0}return!1}else if(d.includes("slots")&&u.includes("slots")){let f=-1,p=-1;for(let y=d.length-1;y>=0;y--)if(d[y]==="slots"){f=y;break}for(let y=u.length-1;y>=0;y--)if(u[y]==="slots"){p=y;break}if(f===-1||p===-1)return!1;const h=d.slice(0,f).join("."),m=u.slice(0,p).join(".");if(h!==m)return!1;const b=d[f+1],g=u[p+1];if(b!==g)return!1;const x=parseInt(d[d.length-1]),v=parseInt(u[u.length-1]);if(isNaN(x)||isNaN(v)||x===v)return!1;const w=dn(h,t);if(!w||!w.slots||!w.slots[b])return!1;const T=w.slots[b];let M=[];if(Array.isArray(T))M=T;else if(T&&typeof T=="object"&&T.children)M=T.children||[];else return!1;const[A]=M.splice(x,1);return M.splice(v,0,A),!Array.isArray(T)&&typeof T=="object"&&T.children&&(T.children=M),!0}else if(d.length>2&&u.length>2){const f=d.slice(0,-1).join("."),p=u.slice(0,-1).join(".");if(f===p){const h=parseInt(d[d.length-1]),m=parseInt(u[u.length-1]);if(!isNaN(h)&&!isNaN(m)&&h!==m){const b=parseInt(d[1]);let g=t.page[b];for(let x=2;x<d.length-1;x++)g=g[d[x]];if(Array.isArray(g)){const[x]=g.splice(h,1);return g.splice(m,0,x),!0}}}}return!1}return{reorderSourcePath:n,handleReorderClick:r,canReorderWith:o,cancelReorder:i}}function Bv(t,e,n,o,r,i,s,l,c){const d=a.computed(()=>o.value?od(o.value):null),u=a.computed(()=>{if(!d.value)return!1;const p=dn(d.value,t);return p!=null});function f(){if(!d.value)return;const p=d.value;if(!e.value||!e.value.querySelector(`[data-zcode-path="${p}"]`))return;const m=dn(p,t);if(m){if(o.value&&e.value){const b=e.value.querySelector(`[data-zcode-path="${o.value}"]`);b&&yn(b)}switch(n.value){case"edit":r(p,m);break;case"add":i(p,!0);break;case"reorder":if(c.value){const b=e.value.querySelector(`[data-zcode-path="${c.value}"]`);b&&Qt(b),c.value=""}s(p);break;case"delete":l(p,m);break}}}return{parentPath:d,canSelectParent:u,selectParentElement:f}}function Fv(t,e,n,o,r,i,s,l,c,d,u,f,p,h){const m=new Map;function b(){if(!e.value)return;g();const x=e.value.querySelectorAll("[data-zcode-id]"),v=y=>{const E=y.target;if(!E)return;const S=E.closest("[data-zcode-add-slot]");if(!S)return;const D=S.closest("[data-zcode-slot-path]"),W=D?.getAttribute("data-zcode-slot-path");if(!W)return;y.preventDefault(),y.stopPropagation(),y.stopImmediatePropagation();const z=()=>{const P=e.value?.querySelector(`[data-zcode-slot-path="${W}"]`);P&&(yn(P),Yt(P,"add"))};if(D&&yn(D),n.value!=="add"){p("add"),a.nextTick(()=>{c(W),a.nextTick(()=>{z()})});return}z(),a.nextTick(()=>{c(W),a.nextTick(()=>{z()})})};let w=null;const T=y=>o.value===y||r.value===y||i.value===y||s.value===y,M=y=>{const S=y.target;if(!S)return;const D=S.closest("[data-zcode-slot-path]");if(!D){if(w){const z=w.getAttribute("data-zcode-slot-path")||"";(!z||!T(z))&&yn(w),w=null}return}if(w===D)return;if(w){const z=w.getAttribute("data-zcode-slot-path")||"";(!z||!T(z))&&yn(w)}w=D;const W=D.getAttribute("data-zcode-slot-path")||"";W&&!T(W)&&wc(D,n.value)},A=y=>{const E=y,S=E.target;if(!S)return;const D=E.relatedTarget,W=S.closest("[data-zcode-slot-path]");if(!W||D&&W.contains(D))return;const z=W.getAttribute("data-zcode-slot-path")||"";(!z||!T(z))&&yn(W),w===W&&(w=null)};e.value.addEventListener("click",v,!0),e.value.addEventListener("mouseover",M,!0),e.value.addEventListener("mouseout",A,!0),m.set(e.value,[{type:"click",listener:v,options:!0},{type:"mouseover",listener:M,options:!0},{type:"mouseout",listener:A,options:!0}]),x.forEach(y=>{const E=y,S=E.getAttribute("data-zcode-path");if(!S)return;const D=V=>{const j=V.target,H=j?.closest("[data-zcode-path]")?.getAttribute("data-zcode-path");if(H&&H!==S)return;j?.closest("a[href]")&&(h.value||V.preventDefault()),h.value||(V.stopPropagation(),V.stopImmediatePropagation());const G=dn(S,t);if(G)switch(yn(E),n.value){case"edit":l(S,G);break;case"add":c(S);break;case"reorder":if(i.value){const se=i.value.split("."),Z=S.split(".");if(se.length!==Z.length&&se.indexOf("rows")!==-1){const J=Z.indexOf("cells");if(J!==-1){let K=-1;for(let Y=J-1;Y>=0;Y--)if(Z[Y]==="slots"){K=Y;break}if(K!==-1){const Y=Z.slice(0,K).join(".");if(Y&&f(i.value,Y)){d(Y);return}}}}}d(S);break;case"delete":u(S,G);break}},W=V=>{if(o.value===V||r.value===V||i.value===V||s.value===V)return!0;if(V.includes(".slots.")){const L=V.split(".");let H=-1;for(let Q=L.length-1;Q>=0;Q--)if(L[Q]==="slots"){H=Q;break}if(H!==-1&&H+1<L.length){const Q=L.slice(0,H+2).join(".");return r.value===Q||o.value===Q||i.value===Q||s.value===Q}}return!1},z=()=>{W(S)||(n.value==="reorder"&&i.value?f(i.value,S)&&wc(E,n.value):wc(E,n.value)),n.value==="reorder"?E.style.cursor=i.value&&f(i.value,S)?"move":i.value?"not-allowed":"move":E.style.cursor="pointer"},P=()=>{W(S)||yn(E),E.style.cursor=""};E.addEventListener("click",D,!0),E.addEventListener("mouseenter",z),E.addEventListener("mouseleave",P),m.set(E,[{type:"click",listener:D,options:!0},{type:"mouseenter",listener:z},{type:"mouseleave",listener:P}])}),a.nextTick(()=>{a.nextTick(()=>{if(n.value==="edit"&&o.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${o.value}"]`);y&&Yt(y,"edit")}if(n.value==="add"&&r.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${r.value}"]`);if(y)Yt(y,"add");else{const E=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);E&&Yt(E,"add")}}if(n.value==="reorder"&&i.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${i.value}"]`);y&&Yt(y,"reorder")}if(n.value==="delete"&&s.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${s.value}"]`);y&&Yt(y,"delete")}})})}function g(){m.forEach((x,v)=>{x.forEach(({type:w,listener:T,options:M})=>{v.removeEventListener(w,T,M)})}),m.clear()}return{setupClickHandlers:b,cleanupEventListeners:g}}function jv(t,e,n,o,r,i,s,l,c,d,u,f,p){function h(m){t.value&&t.value.querySelectorAll("[data-zcode-path], [data-zcode-slot-path]").forEach(g=>{Qt(g),yn(g)}),e.value==="edit"&&o.value?(l.value=null,o.value=""):e.value==="add"&&r.value?(r.value=null,c.value=null,d.value=null,u.value="common",f.value=null):e.value==="reorder"&&i.value?i.value="":e.value==="delete"&&s.value&&p(),n(m)}return{switchMode:h}}function Uv(t,e,n){const o=a.ref(!1),r=a.ref({x:0,y:0});function i(p){!e.value||!t.value||!p.target.closest("[data-zcode-path]")||(p.preventDefault(),p.stopPropagation(),r.value={x:p.clientX,y:p.clientY},o.value=!0)}function s(p){n(p),o.value=!1}function l(){o.value=!1}function c(p){p.target.closest(".zcode-context-menu")||l()}function d(p){p.target.closest(".zcode-context-menu")||l()}function u(){!t.value||!e.value||(t.value.addEventListener("contextmenu",i),document.addEventListener("click",c),document.addEventListener("contextmenu",d))}function f(){t.value&&(t.value.removeEventListener("contextmenu",i),document.removeEventListener("click",c),document.removeEventListener("contextmenu",d))}return{isVisible:o,position:r,handleModeSelect:s,closeMenu:l,setupContextMenu:u,cleanupContextMenu:f}}function Hv(t){const e=t;if(!e||!e.page||!Array.isArray(e.page))return!1;for(const n of e.page)if(!n.id||!n.part_id)return!1;return!0}function Sc(t,e){const n=[],o=(r,i)=>{Object.keys(r).forEach(s=>{s.includes("image")&&r[s]===t&&n.push({path:i,component:r,fieldName:s})}),r.slots&&Object.entries(r.slots).forEach(([s,l])=>{Array.isArray(l)&&l.forEach((c,d)=>{o(c,`${i}.slots.${s}.${d}`)})})};return e.forEach((r,i)=>{o(r,`page.${i}`)}),n}const Wv={key:0,class:"zcode-save-banner zcode-save-banner--error",role:"alert"},Gv={class:"zcode-save-banner-text"},qv=["aria-label"],Kv={key:1,class:"zcode-save-controls-fixed"},Jv={class:"zcode-save-confirm-dialog"},Xv={class:"zcode-save-confirm-dialog-header"},Yv={class:"zcode-save-confirm-dialog-title"},Qv={class:"zcode-save-confirm-dialog-body"},Zv={class:"zcode-save-confirm-dialog-footer"},Hs=a.defineComponent({__name:"ZeroCodeCMS",props:{locale:{type:String},page:{type:String},cssCommon:{type:String},cssIndividual:{type:String},cssSpecial:{type:String},partsCommon:{type:String},partsIndividual:{type:String},partsSpecial:{type:String},imagesCommon:{type:String},imagesIndividual:{type:String},imagesSpecial:{type:String},config:{type:String},endpoints:{type:String},backendData:{type:String}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.ref("manage"),i=a.ref(!1),l=(le=>{if(!le)return{};try{return JSON.parse(le)}catch(de){return console.warn("[ZeroCodeCMS] Failed to parse config:",de),{}}})(o.config),c=(le,de,be)=>{const Ge=Au();return Ge[le]!==void 0?Ge[le]:be!==void 0?be:de},d=a.ref(c("devRightPadding",!1,l.cms?.devRightPadding)),u=a.ref(c("enableContextMenu",!1,l.cms?.enableContextMenu)),f=a.ref(c("showSaveConfirm",!0,l.cms?.showSaveConfirm)),p=a.computed(()=>d.value),h=a.ref(!1),{cmsData:m,loadDataFromProps:b,getData:g,setData:x}=km(o),{fullPageHtml:v,renderComponentToHtml:w}=fi(m,!0);function T(le){if(le!=="css")return le?g(le):g()}const M=a.ref(null),A=a.ref(null),y=a.computed(()=>A.value?.previewArea||null),{currentMode:E,switchMode:S,allowDynamicContentInteraction:D}=Rv(),W=c("allowDynamicContentInteraction",!1,l.cms?.allowDynamicContentInteraction),z=a.ref(W);D.value=W;let P=!1;a.watch(r,(le,de)=>{le==="preview"?(P=z.value,z.value=!0,D.value=!0,a.nextTick(()=>{st()})):de==="preview"&&(z.value=P,D.value=P,a.nextTick(()=>{st()})),Ln("view-mode-changed",{mode:le,previousMode:de})});const{editingComponent:V,editingComponentPath:j,editingAvailableFields:L,handleEditClick:H,saveFieldEdit:Q,closeEditPanel:G}=Pv(m,y),se=a.ref({}),Z=a.ref([]),X=a.ref({visible:!1,message:""});function J(le){if(le?.fieldName&&se.value[le.fieldName]){const de={...se.value};delete de[le.fieldName],se.value=de}Q(le)}const{addTargetPath:K,addSelectedType:Y,addSelectedPart:ce,clickedComponent:Ee,addPartCategory:_e,addTypeTab:Le,keepAdding:C,availablePartTypes:N,groupedPartsByType:O,hasSpecialParts:k,handleAddClick:U,handleCategoryTabClick:te,handleTypeTabClick:me,selectPart:ve,getPartPreviewHtml:Ve,getClickedComponentPreviewHtml:Ce,confirmAddPart:_,cancelAdd:I}=Lv(m,y,w,l),{reorderSourcePath:q,handleReorderClick:fe,canReorderWith:Ae,cancelReorder:Te}=Vv(m,y),{deleteConfirmComponent:we,deleteConfirmPath:B,handleDeleteClick:ee,confirmDelete:Me,cancelDelete:$}=$v(m,y,S,a.nextTick),{switchMode:F}=jv(y,E,S,j,K,q,B,V,Y,ce,_e,Le,$),re=a.computed(()=>E.value==="edit"&&j.value?j.value:E.value==="add"&&K.value?K.value:E.value==="reorder"&&q.value?q.value:E.value==="delete"&&B.value?B.value:null),{canSelectParent:ae,selectParentElement:ke}=Bv(m,y,E,re,H,U,fe,ee,q),Fe=a.computed(()=>!!(V.value||K.value||q.value||we.value)),st=()=>{if(y.value){const le=y.value.getRootNode();if(le instanceof ShadowRoot){let Ge=0;const et=()=>{Ge++;const At=le;if(typeof At.__zcmsSetAllowDynamicContentInteraction=="function"){At.__zcmsSetAllowDynamicContentInteraction(z.value);return}Ge<30&&setTimeout(et,50)};et()}}},{setupClickHandlers:xn,cleanupEventListeners:oi}=Fv(m,y,E,j,K,q,B,H,U,fe,ee,Ae,F,z),{isVisible:Tc,position:Zo,handleModeSelect:er,closeMenu:zc,setupContextMenu:Pn,cleanupContextMenu:ri}=Uv(y,u,F);function Ln(le,de){const be=En();if(be){const et=new CustomEvent(le,{detail:de,bubbles:!0,composed:!0});be.dispatchEvent(et);return}const Ge=new CustomEvent(le,{detail:de,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(Ge)}function Ze(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function En(){if(M.value){const de=M.value.getRootNode();if(de instanceof ShadowRoot&&de.host)return de.host;const be=M.value.closest?.("zcode-cms")||M.value.closest?.("zcode-editor");if(be)return be}const le=a.getCurrentInstance();if(le){const de=le.vnode.el;if(de instanceof HTMLElement){const be=de.getRootNode();if(be instanceof ShadowRoot&&be.host)return be.host;const Ge=de.closest?.("zcode-cms")||de.closest?.("zcode-editor");return Ge||null}if(de instanceof Node){const be=de.getRootNode();if(be instanceof ShadowRoot&&be.host)return be.host}}return null}function Xs(le){return typeof le=="object"&&le!==null}function Ys(le){return Array.isArray(le)?le.filter(de=>Xs(de)).map(de=>({path:typeof de.path=="string"?de.path:void 0,field:typeof de.field=="string"?de.field:void 0,message:typeof de.message=="string"?de.message:void 0,code:typeof de.code=="string"?de.code:void 0})):[]}function tr(le){if(!le){se.value={};return}const de={};for(const be of Z.value){const Ge=typeof be?.path=="string"?be.path:null,et=typeof be?.field=="string"?be.field:null,At=typeof be?.message=="string"?be.message:null;!et||!At||Ge&&Ge!==le||(de[et]=At)}se.value=de}const Qs=(le,de)=>{de==="common"?m.images.common.push(le):de==="individual"?m.images.individual.push(le):m.images.special.push(le)},Zs=le=>{Sc(le,m.page).forEach(et=>{Object.keys(et.component).forEach(At=>{At.includes("image")&&et.component[At]===le&&(et.component[At]="")})});const be=m.images.common.findIndex(et=>et.id===le);be!==-1&&m.images.common.splice(be,1);const Ge=m.images.individual.findIndex(et=>et.id===le);Ge!==-1&&m.images.individual.splice(Ge,1)};function ea(le){const de=le.detail;if(!Xs(de))return;const be=de;if(be.ok===!0){X.value.visible=!1,X.value.message="",Z.value=[],se.value={};return}if(be.ok!==!1)return;const Ge=Ys(be.errors);Z.value=Ge;const et=Ge.length,At=typeof Ge[0]?.message=="string"&&Ge[0].message?Ge[0].message:null;X.value.visible=!0,X.value.requestId=typeof be.requestId=="string"?be.requestId:void 0,X.value.target=typeof be.target=="string"?be.target:void 0,X.value.message=At?n("editor.saveFailedWithMessage",{count:et,message:At}):n("editor.saveFailedWithCount",{count:et}),tr(j.value||null)}a.onMounted(()=>{b(),a.nextTick(()=>{xn(),u.value&&Pn(),st(),Ln("zcode-dom-updated",{})});const le=En();le&&le.addEventListener("save-result",ea)}),a.onUnmounted(()=>{oi(),ri();const le=En();le&&le.removeEventListener("save-result",ea)}),a.watch(()=>j.value,le=>{tr(le||null)}),a.watch([()=>o.page,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial],()=>{b()}),a.watch(m,()=>{a.nextTick(()=>{xn(),Ln("zcode-dom-updated",{})})},{deep:!0}),a.watch([r,y],([le,de])=>{le==="manage"&&de?a.nextTick(()=>{xn(),u.value&&Pn(),st(),Ln("zcode-dom-updated",{})}):ri()}),a.watch(E,()=>{a.nextTick(()=>{Ln("zcode-dom-updated",{})})}),a.watch(d,le=>{vi({devRightPadding:le})}),a.watch(z,le=>{r.value==="manage"&&vi({allowDynamicContentInteraction:le}),D.value=le,a.nextTick(()=>{xn(),st(),Ln("zcode-dom-updated",{})})}),a.watch(u,le=>{vi({enableContextMenu:le}),le?a.nextTick(()=>{Pn()}):ri()}),a.watch(f,le=>{vi({showSaveConfirm:le})});function Zt(){if(!f.value){kn();return}h.value=!0}function kn(){const le=Ze();Ln("save-request",{requestId:le,source:"cms",targets:["page","images-common","images-individual"],timestamp:Date.now()})}function ta(){h.value=!1,kn()}function ii(){h.value=!1}return e({getData:T,setData:x,validateData:Hv,cmsData:m,currentMode:E,switchMode:F,allowDynamicContentInteraction:z,devRightPadding:d,devRightPaddingValue:p,settingsPanelOpen:i}),(le,de)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"containerRef",ref:M,class:a.normalizeClass(["zcode-cms-container",{"zcode-dev-padding":d.value&&Fe.value}])},[a.createVNode(rd,{"current-mode":a.unref(E),"view-mode":r.value,"allow-dynamic-content-interaction":z.value,onSwitchMode:a.unref(F),onSwitchViewMode:de[0]||(de[0]=be=>r.value=be),onOpenSettings:de[1]||(de[1]=be=>i.value=!0)},null,8,["current-mode","view-mode","allow-dynamic-content-interaction","onSwitchMode"]),X.value.visible?(a.openBlock(),a.createElementBlock("div",Wv,[a.createElementVNode("div",Gv,a.toDisplayString(X.value.message),1),a.createElementVNode("button",{class:"zcode-save-banner-close","aria-label":le.$t("common.close"),onClick:de[2]||(de[2]=be=>X.value.visible=!1)}," × ",8,qv)])):a.createCommentVNode("",!0),r.value==="manage"?(a.openBlock(),a.createElementBlock("div",Kv,[a.createElementVNode("button",{class:"zcode-save-btn",onClick:Zt},[a.createVNode(a.unref(Lc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(le.$t("common.save")),1)])])):a.createCommentVNode("",!0),r.value==="preview"?(a.openBlock(),a.createBlock(ma,{key:2,"cms-data":a.unref(m),"allow-dynamic-content-interaction":!0},null,8,["cms-data"])):a.createCommentVNode("",!0),r.value==="manage"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:3},[a.createVNode(Fc,{ref_key:"previewAreaRef",ref:A,"cms-data":a.unref(m),"full-page-html":a.unref(v),"on-add-click":a.unref(U),"allow-dynamic-content-interaction":z.value},null,8,["cms-data","full-page-html","on-add-click","allow-dynamic-content-interaction"]),a.createVNode(zC,{"editing-component":a.unref(V),"editing-available-fields":a.unref(L),"field-errors":se.value,"current-mode":a.unref(E),"can-select-parent":a.unref(ae),"images-common":a.unref(m).images.common,"images-individual":a.unref(m).images.individual,"images-special":a.unref(m).images.special,onClose:a.unref(G),onSelectParent:a.unref(ke),onSaveField:J,onAddImage:Qs,onDeleteImage:Zs},null,8,["editing-component","editing-available-fields","field-errors","current-mode","can-select-parent","images-common","images-individual","images-special","onClose","onSelectParent"]),a.createVNode(LC,{"delete-confirm-component":a.unref(we),"current-mode":a.unref(E),"can-select-parent":a.unref(ae),onConfirm:a.unref(Me),onCancel:a.unref($),onSelectParent:a.unref(ke)},null,8,["delete-confirm-component","current-mode","can-select-parent","onConfirm","onCancel","onSelectParent"]),a.createVNode(WC,{"reorder-source-path":a.unref(q),"current-mode":a.unref(E),"can-select-parent":a.unref(ae),onCancel:a.unref(Te),onSelectParent:a.unref(ke)},null,8,["reorder-source-path","current-mode","can-select-parent","onCancel","onSelectParent"]),a.createVNode(Av,{"add-target-path":a.unref(K),"add-part-category":a.unref(_e),"add-type-tab":a.unref(Le),"add-selected-part":a.unref(ce),"add-selected-type":a.unref(Y),"has-special-parts":a.unref(k),"clicked-component":a.unref(Ee),"available-part-types":a.unref(N),config:a.unref(l),"grouped-parts-by-type":a.unref(O),"can-select-parent":a.unref(ae),"get-part-preview-html":a.unref(Ve),"get-clicked-component-preview-html":a.unref(Ce),"keep-adding":a.unref(C),onCancel:a.unref(I),onSelectParent:a.unref(ke),onCategoryTabClick:a.unref(te),onTypeTabClick:a.unref(me),onSelectPart:a.unref(ve),onConfirmAdd:a.unref(_),onUpdateKeepAdding:de[3]||(de[3]=be=>C.value=be)},null,8,["add-target-path","add-part-category","add-type-tab","add-selected-part","add-selected-type","has-special-parts","clicked-component","available-part-types","config","grouped-parts-by-type","can-select-parent","get-part-preview-html","get-clicked-component-preview-html","keep-adding","onCancel","onSelectParent","onCategoryTabClick","onTypeTabClick","onSelectPart","onConfirmAdd"])],64)):a.createCommentVNode("",!0),a.createVNode(Ou,{"is-open":i.value,"view-mode":r.value,mode:"toolbar","allow-dynamic-content-interaction":z.value,"dev-right-padding":p.value,"enable-context-menu":u.value,"show-save-confirm":f.value,onClose:de[4]||(de[4]=be=>i.value=!1),onToggleDynamicContent:de[5]||(de[5]=be=>z.value=be),onToggleDevPadding:de[6]||(de[6]=be=>d.value=be),onToggleContextMenu:de[7]||(de[7]=be=>u.value=be),onToggleSaveConfirm:de[8]||(de[8]=be=>f.value=be)},null,8,["is-open","view-mode","allow-dynamic-content-interaction","dev-right-padding","enable-context-menu","show-save-confirm"]),a.createVNode(Mv,{"is-visible":a.unref(Tc),position:a.unref(Zo),"current-mode":a.unref(E),onSelectMode:a.unref(er),onClose:a.unref(zc)},null,8,["is-visible","position","current-mode","onSelectMode","onClose"]),h.value?(a.openBlock(),a.createElementBlock("div",{key:4,class:"zcode-save-confirm-dialog-overlay",onClick:a.withModifiers(ii,["self"])},[a.createElementVNode("div",Jv,[a.createElementVNode("div",Xv,[a.createElementVNode("div",Yv,a.toDisplayString(le.$t("saveConfirm.title")),1)]),a.createElementVNode("div",Qv,[a.createElementVNode("p",null,a.toDisplayString(le.$t("saveConfirm.simpleMessage")),1)]),a.createElementVNode("div",Zv,[a.createElementVNode("button",{class:"zcode-btn-secondary",onClick:ii},a.toDisplayString(le.$t("common.cancel")),1),a.createElementVNode("button",{class:"zcode-btn-primary",onClick:ta},a.toDisplayString(le.$t("saveConfirm.saveButton")),1)])])])):a.createCommentVNode("",!0)],2))}}),Sm=":root{--zcode-color-edit: #3b82f6;--zcode-color-add: #10b981;--zcode-color-reorder: #f59e0b;--zcode-color-delete: #ef4444;--zcode-color-edit-hover: #2563eb;--zcode-color-edit-bg: #eff6ff;--zcode-color-edit-bg-active: #dbeafe;--zcode-color-edit-border-hover: #93c5fd;--zcode-color-add-hover: #059669;--zcode-color-add-bg: #ecfdf5;--zcode-color-add-bg-active: #d1fae5;--zcode-color-add-border-hover: #6ee7b7;--zcode-color-reorder-bg: #fffbeb;--zcode-color-reorder-bg-active: #fef3c7;--zcode-color-reorder-border-hover: #fcd34d;--zcode-color-delete-hover: #dc2626;--zcode-color-delete-bg: #fef2f2;--zcode-color-delete-bg-active: #fee2e2;--zcode-color-delete-border-hover: #fca5a5}[class*=zcode-]{box-sizing:border-box}[class*=zcode-]:before,[class*=zcode-]:after{box-sizing:border-box}.zcode-empty-state{text-align:center;padding:60px 20px;color:#666}.zcode-empty-state-btn{margin-top:20px;padding:10px 20px;font-size:16px;background:#42b983;color:#fff;border:none;border-radius:4px;cursor:pointer;transition:background .2s}.zcode-empty-state-btn:hover{background:#359268}.zcode-edit-panel,.zcode-add-panel,.zcode-reorder-panel,.zcode-delete-panel{position:fixed;top:0;right:0;width:375px;height:100vh;background:#fff;box-shadow:-2px 0 8px #0000001a;overflow:hidden;display:flex;flex-direction:column;z-index:1002}.zcode-edit-panel-header,.zcode-add-panel-header,.zcode-reorder-panel-header,.zcode-delete-panel-header{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-shrink:0}.zcode-panel-header-title{margin:0;font-size:14px;font-weight:600;color:#1f2937}.zcode-edit-panel-header .zcode-panel-header-title{color:var(--zcode-color-edit)}.zcode-add-panel-header .zcode-panel-header-title{color:var(--zcode-color-add)}.zcode-reorder-panel-header .zcode-panel-header-title{color:var(--zcode-color-reorder)}.zcode-delete-panel-header .zcode-panel-header-title{color:var(--zcode-color-delete)}.zcode-close-btn{background:none;border:none;cursor:pointer;color:#6b7280;padding:4px 8px;line-height:1;display:flex;align-items:center;justify-content:center}.zcode-close-btn:hover{color:#1f2937}.zcode-edit-fields{padding:16px;font-size:14px;color:#6b7280;overflow-y:auto;flex:1}.zcode-add-panel-content{overflow-y:auto;flex:1}.zcode-edit-fields-text{margin:8px 0}.zcode-component-developer{border:1px dashed #ccc;padding:10px}.zcode-error-message{padding:20px;background:#fff3cd;border:1px solid #ffc107;border-radius:4px;color:#856404}.zcode-for-item{margin-bottom:10px}.zcode-field-editor{padding:16px;overflow-y:auto}.zcode-field-item-title{margin:0 0 15px;color:#2c3e50;font-size:16px;border-bottom:1px solid #eee;padding-bottom:8px}.zcode-field-editor-label{display:block;margin-bottom:8px;font-weight:500;color:#555}.zcode-text-editor{margin-bottom:20px}.zcode-text-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;transition:border-color .2s;box-sizing:border-box}.zcode-text-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-field-error{border-color:#ef4444!important;background-color:#fef2f2}.zcode-field-error-message{margin-top:6px;font-size:12px;color:#ef4444;line-height:1.4}.zcode-field-counter{margin-top:6px;font-size:12px;color:#6b7280;text-align:right}.zcode-text-input:disabled,.zcode-textarea:disabled{opacity:.7;cursor:not-allowed}.zcode-text-input[readonly],.zcode-textarea[readonly]{background-color:#f3f4f6;cursor:default}.zcode-radio-editor{margin-top:12px;margin-bottom:12px}.zcode-radio-group{display:flex;flex-direction:column;gap:6px}.zcode-radio-item{display:flex;align-items:center;gap:6px;cursor:pointer;margin-bottom:0;font-weight:400;color:inherit}.zcode-radio-item input[type=radio]{margin:0;cursor:pointer}.zcode-radio-item input[type=radio]:focus{outline:2px solid var(--zcode-color-edit);outline-offset:2px}.zcode-radio-item-label{font-size:14px;color:#4b5563}.zcode-checkbox-editor{margin-top:12px;margin-bottom:12px}.zcode-checkbox-item{display:flex;align-items:center;gap:6px;cursor:pointer;margin-bottom:0;font-weight:400;color:inherit}.zcode-checkbox-item input[type=checkbox]{margin:0;cursor:pointer}.zcode-checkbox-item input[type=checkbox]:focus{outline:2px solid var(--zcode-color-edit);outline-offset:2px}.zcode-checkbox-item-label{font-size:14px;color:#4b5563}.zcode-edit-actions{display:flex;gap:10px;margin-top:20px}.zcode-save-btn{flex:1;background:var(--zcode-color-edit);color:#fff;border:none;padding:10px 16px;border-radius:4px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-save-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-cancel-btn{flex:1;background:#f8f9fa;color:#6c757d;border:1px solid #dee2e6;padding:10px 16px;border-radius:4px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-cancel-btn:hover{background:#e9ecef}[data-zcode-id],[data-zcode-slot-path]{transition:outline .2s;cursor:pointer;position:relative}[data-zcode-id].zcode-outline-active-edit,[data-zcode-id].zcode-outline-active-add,[data-zcode-id].zcode-outline-active-reorder,[data-zcode-id].zcode-outline-active-delete,[data-zcode-slot-path].zcode-outline-active-edit,[data-zcode-slot-path].zcode-outline-active-add,[data-zcode-slot-path].zcode-outline-active-reorder,[data-zcode-slot-path].zcode-outline-active-delete{outline-style:solid;animation:zcode-outline-pulse-edit 1.5s ease-in-out infinite}[data-zcode-id].zcode-outline-active-edit{animation-name:zcode-outline-pulse-edit}[data-zcode-id].zcode-outline-active-add{animation-name:zcode-outline-pulse-add}[data-zcode-id].zcode-outline-active-reorder{animation-name:zcode-outline-pulse-reorder}[data-zcode-id].zcode-outline-active-delete{animation-name:zcode-outline-pulse-delete}[data-zcode-slot-path].zcode-outline-active-edit{animation-name:zcode-outline-pulse-edit}[data-zcode-slot-path].zcode-outline-active-add{animation-name:zcode-outline-pulse-add}[data-zcode-slot-path].zcode-outline-active-reorder{animation-name:zcode-outline-pulse-reorder}[data-zcode-slot-path].zcode-outline-active-delete{animation-name:zcode-outline-pulse-delete}@keyframes zcode-outline-pulse-edit{0%{outline-width:4px;outline-offset:2px;outline-color:#3cd7f6}25%{outline-width:4px;outline-offset:2px;outline-color:#3c83f6}50%{outline-width:4px;outline-offset:2px;outline-color:#493cf6}75%{outline-width:4px;outline-offset:2px;outline-color:#3c83f6}to{outline-width:4px;outline-offset:2px;outline-color:#3cd7f6}}@keyframes zcode-outline-pulse-add{0%{outline-width:4px;outline-offset:2px;outline-color:#0fb82b}25%{outline-width:4px;outline-offset:2px;outline-color:#0fb880}50%{outline-width:4px;outline-offset:2px;outline-color:#0f9cb8}75%{outline-width:4px;outline-offset:2px;outline-color:#0fb880}to{outline-width:4px;outline-offset:2px;outline-color:#0fb82b}}@keyframes zcode-outline-pulse-reorder{0%{outline-width:4px;outline-offset:2px;outline-color:#f5800a}25%{outline-width:4px;outline-offset:2px;outline-color:#f59f0a}50%{outline-width:4px;outline-offset:2px;outline-color:#f5be0a}75%{outline-width:4px;outline-offset:2px;outline-color:#f59f0a}to{outline-width:4px;outline-offset:2px;outline-color:#f5800a}}@keyframes zcode-outline-pulse-delete{0%{outline-width:4px;outline-offset:2px;outline-color:#ef437c}25%{outline-width:4px;outline-offset:2px;outline-color:#ef4343}50%{outline-width:4px;outline-offset:2px;outline-color:#ef7c43}75%{outline-width:4px;outline-offset:2px;outline-color:#ef4343}to{outline-width:4px;outline-offset:2px;outline-color:#ef437c}}.zcode-view-mode-toggle{display:flex;gap:8px}.zcode-view-mode-btn{display:flex;align-items:center;gap:6px;padding:8px 16px;border:1px solid #e5e7eb;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s;font-size:14px;font-weight:500}.zcode-dev-header{display:flex;align-items:center;justify-content:flex-start;padding:8px 16px;background:#f9fafb;border-bottom:1px solid #e5e7eb}.zcode-toolbar{position:sticky;top:0;display:flex;align-items:center;gap:8px;width:fit-content;background:#fffc;margin-bottom:10px;padding:8px 16px;border-radius:8px;box-shadow:0 2px 8px #0000001a;z-index:1001}.zcode-save-banner{position:sticky;top:54px;display:flex;align-items:flex-start;justify-content:space-between;gap:12px;width:min(720px,calc(100% - 32px));margin:0 0 10px;padding:10px 12px;border-radius:10px;border:1px solid transparent;z-index:1001;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.zcode-save-banner--error{border-color:#fecaca;background:#fef2f2e6;color:#991b1b}.zcode-save-banner-text{font-size:13px;line-height:1.4;word-break:break-word}.zcode-save-banner-close{flex:0 0 auto;width:28px;height:28px;border-radius:8px;border:1px solid rgba(0,0,0,.06);background:#fffc;color:inherit;cursor:pointer}.zcode-save-banner-close:hover{background:#fff}.zcode-toolbar-separator{width:1px;height:24px;background-color:#e5e7eb;margin:0 4px}.zcode-dynamic-content-toggle-label{display:flex;align-items:center;gap:6px;padding:4px 8px;border-radius:4px;cursor:pointer;font-size:14px;color:#374151;-webkit-user-select:none;user-select:none}.zcode-dynamic-content-toggle-label:hover{background-color:#f3f4f6}.zcode-dynamic-content-toggle-checkbox{margin:0;cursor:pointer}.zcode-dev-container .zcode-cms-container .zcode-toolbar{display:none}.zcode-template-tabs{display:inline-flex;gap:6px;margin-right:8px}.zcode-template-tab{padding:6px 10px;border:1px solid #d1d5db;border-radius:6px;background:#fff;font-size:12px;color:#374151;cursor:pointer}.zcode-template-tab.active{background:#111827;border-color:#111827;color:#fff;font-weight:600}.zcode-css-inline-note{flex-shrink:0;margin:0 0 12px;padding:10px 12px;border:1px solid #fde68a;background:#fffbeb;border-radius:8px;color:#92400e;font-size:12px;line-height:1.6}.zcode-part-editor-preview-tab{border:1px solid #e5e7eb;border-radius:8px;background:#fff;padding:16px;min-height:240px;cursor:pointer}.zcode-part-editor-preview-hint{margin-top:10px;font-size:12px;color:#6b7280}.zcode-part-editor-pane{border:1px solid #e5e7eb;border-radius:8px;background:#fff;overflow:hidden;display:flex;flex-direction:column;min-height:0;min-width:0;flex:1}.zcode-part-editor-pane-header{padding:10px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;align-items:center;justify-content:space-between;gap:10px}.zcode-part-editor-pane-header-actions{display:flex;align-items:center;gap:8px;min-width:0}.zcode-css-warning-compact{display:flex;align-items:center;gap:6px;padding:6px 10px;background:#fffbeb;border:1px solid #fde68a;border-radius:6px;font-size:12px;color:#92400e}.zcode-css-warning-compact-icon{flex-shrink:0;color:#f59e0b}.zcode-css-warning-compact-text{white-space:nowrap;font-weight:500}.zcode-part-editor-pane-body{flex:1;min-height:0;overflow:hidden;padding:12px;display:flex;flex-direction:column}.zcode-part-editor-slots-toggle{width:100%;border:1px solid #e5e7eb;border-radius:8px;background:#f9fafb;padding:10px 12px;display:flex;align-items:center;justify-content:space-between;cursor:pointer;font-size:13px;font-weight:600;color:#374151}.zcode-part-editor-slots-toggle:hover{background:#f3f4f6}.zcode-part-editor-slots-toggle-icon{display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;border-radius:999px;border:1px solid #d1d5db;background:#fff;color:#6b7280;font-size:16px;font-weight:400}.zcode-part-editor-slots-toggle-icon.open{transform:rotate(45deg)}.zcode-part-editor-slots-body{margin-top:10px}.zcode-part-editor-topbar{margin-bottom:16px}.zcode-part-editor-topfields{display:grid;grid-template-columns:1fr 1fr;gap:12px}.zcode-part-editor-slots-top{margin-top:12px}.zcode-part-editor-slots-bottom{margin-top:24px;padding-top:24px;border-top:1px solid #e5e7eb}.zcode-save-controls-fixed{position:fixed;bottom:20px;left:20px;display:flex;align-items:center;gap:8px;padding:12px 20px;background:#fffc;border-radius:8px;box-shadow:0 4px 12px #00000026;z-index:1000}.zcode-save-btn{display:flex;align-items:center;gap:6px;padding:8px 16px;border:1px solid var(--zcode-color-edit);border-radius:6px;background:var(--zcode-color-edit);color:#fff;font-size:14px;cursor:pointer;transition:all .2s}.zcode-save-btn:hover{background:var(--zcode-color-edit-hover);border-color:var(--zcode-color-edit-hover)}.zcode-mode-btn{padding:8px 16px;border:2px solid #ddd;border-radius:6px;background:#fff;cursor:pointer;font-weight:500;transition:all .2s;font-size:14px;display:flex;align-items:center;gap:6px}.zcode-mode-btn:hover{background:#f3f4f6}.zcode-mode-edit:hover{color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg);border-color:var(--zcode-color-edit-border-hover)}.zcode-mode-reorder:hover{color:var(--zcode-color-reorder);background:var(--zcode-color-reorder-bg);border-color:var(--zcode-color-reorder-border-hover)}.zcode-mode-add:hover{color:var(--zcode-color-add);background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-border-hover)}.zcode-mode-delete:hover{color:var(--zcode-color-delete);background:var(--zcode-color-delete-bg);border-color:var(--zcode-color-delete-border-hover)}.zcode-mode-btn.active{border-color:currentColor;font-weight:600}.zcode-mode-edit.active{color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg-active);border-color:var(--zcode-color-edit)}.zcode-mode-reorder.active{color:var(--zcode-color-reorder);background:var(--zcode-color-reorder-bg-active);border-color:var(--zcode-color-reorder)}.zcode-mode-add.active{color:var(--zcode-color-add);background:var(--zcode-color-add-bg-active);border-color:var(--zcode-color-add)}.zcode-mode-delete.active{color:var(--zcode-color-delete);background:var(--zcode-color-delete-bg-active);border-color:var(--zcode-color-delete)}.zcode-view-mode-btn{padding:8px 16px;border:2px solid #ddd;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s;font-size:14px;font-weight:500;display:flex;align-items:center;gap:6px}.zcode-view-mode-btn:hover{background:#f9fafb;border-color:#d1d5db;color:#374151}.zcode-view-mode-btn.active{background:#3b82f6;color:#fff;border-color:#3b82f6}.zcode-view-mode-btn.active:hover{background:#2563eb;border-color:#2563eb}.zcode-settings-btn{display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:2px solid #ddd;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s}.zcode-settings-btn:hover{background:#f9fafb;border-color:#d1d5db;color:#374151}.zcode-settings-panel-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000}.zcode-settings-panel{background:#fff;border-radius:8px;box-shadow:0 10px 25px #0003;width:90%;max-width:500px;max-height:80vh;overflow-y:auto}.zcode-settings-panel-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid #e5e7eb;gap:12px}.zcode-settings-panel-header-title{margin:0;font-size:18px;font-weight:600;color:#111827;flex:1}.zcode-settings-panel-header-actions{display:flex;align-items:center;gap:12px}.zcode-language-select{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;color:#374151;cursor:pointer;transition:border-color .2s}.zcode-language-select:hover{border-color:#9ca3af}.zcode-language-select:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.zcode-settings-panel-content{padding:20px}.zcode-setting-item{margin-bottom:24px}.zcode-setting-item:last-child{margin-bottom:0}.zcode-setting-label{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500;color:#374151;cursor:pointer;-webkit-user-select:none;user-select:none}.zcode-setting-checkbox{width:18px;height:18px;cursor:pointer}.zcode-info-btn{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;margin-left:auto;background:none;border:none;color:#6b7280;cursor:pointer;border-radius:4px;transition:color .2s}.zcode-info-btn:hover{color:#374151}.zcode-setting-description{margin:8px 0 0 26px;font-size:13px;color:#6b7280;line-height:1.5}.zcode-setting-info{margin:0;padding:12px;background:#f3f4f6;border-radius:6px;font-size:13px}.zcode-delete-panel-content{padding:16px;flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:16px}.zcode-delete-warning{display:flex;align-items:flex-start;gap:12px;padding:12px;background:var(--zcode-color-delete-bg);border:1px solid var(--zcode-color-delete-border-hover);border-radius:6px;color:var(--zcode-color-delete)}.zcode-delete-warning svg{flex-shrink:0;margin-top:2px}.zcode-delete-warning p{margin:0;font-size:14px;font-weight:500;line-height:1.5}.zcode-delete-actions{display:flex;gap:8px;margin-top:16px}.zcode-btn-danger{flex:1;padding:10px;background:var(--zcode-color-delete);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:600;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-danger:hover{background:var(--zcode-color-delete-hover)}.zcode-btn-cancel{flex:1;padding:10px;background:#e5e7eb;color:#374151;border:none;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-cancel:hover{background:#d1d5db}.zcode-parent-selector{padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-parent-select-btn{width:100%;padding:8px 12px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-parent-select-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-reorder-panel-content{padding:16px;flex:1;overflow-y:auto}.zcode-reorder-panel-content-text{margin:8px 0;color:#374151}.zcode-reorder-source{font-family:monospace;font-size:12px;color:#1f2937}.zcode-field-item{margin-bottom:20px}.zcode-field-item-title{margin:0 0 8px;font-size:14px;color:#374151;font-weight:600}.zcode-group-tabs{display:flex;gap:4px;padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;flex-shrink:0;-webkit-overflow-scrolling:touch}.zcode-group-tab{padding:6px 12px;font-size:13px;font-weight:500;color:#6b7280;background:#fff;border:1px solid #d1d5db;border-radius:4px;cursor:pointer;transition:all .2s;display:flex;align-items:center;gap:4px}.zcode-group-tab:hover{background:#f3f4f6;border-color:#9ca3af;color:#374151}.zcode-group-tab.active{background:var(--zcode-color-edit);border-color:var(--zcode-color-edit);color:#fff}.zcode-group-tab.active:hover{background:var(--zcode-color-edit-hover);border-color:var(--zcode-color-edit-hover)}@media(max-width:768px){.zcode-edit-panel,.zcode-add-panel,.zcode-reorder-panel,.zcode-delete-panel{width:100%;height:auto;position:fixed;inset:auto 0 0;border-radius:12px 12px 0 0;max-height:60vh;box-shadow:0 -4px 12px #00000026;z-index:1002;animation:zcode-slide-in-up .3s ease-out}@keyframes zcode-slide-in-up{0%{transform:translateY(100%)}to{transform:translateY(0)}}.zcode-insert-position{width:100%;right:0}.zcode-edit-actions{flex-direction:column;gap:12px}.zcode-edit-actions-btn{padding:10px 16px;font-size:14px}.zcode-toolbar{top:0;left:10px;right:10px;flex-wrap:nowrap;padding:6px 8px;gap:4px;overflow-x:auto;-webkit-overflow-scrolling:touch}.zcode-toolbar-btn{width:32px;height:32px;padding:0}.zcode-toolbar-btn-text{display:none}.zcode-view-mode-btn,.zcode-mode-btn{width:32px;height:32px;padding:0;justify-content:center}.zcode-view-mode-btn span,.zcode-mode-btn span{display:none}.zcode-settings-btn{width:36px;height:36px}.zcode-delete-dialog-content{width:95%;padding:16px}.zcode-save-controls-fixed{bottom:20px;left:20px;padding:0;background:transparent;box-shadow:none}.zcode-save-btn{width:48px;height:48px;padding:0;border-radius:50%;box-shadow:0 4px 12px #00000040;display:flex;align-items:center;justify-content:center;gap:0}.zcode-save-btn span{display:none}.zcode-save-btn svg{width:20px;height:20px}.zcode-edit-panel-header,.zcode-add-panel-header,.zcode-reorder-panel-header,.zcode-delete-panel-header{padding:10px 12px}.zcode-edit-fields{padding:12px}.zcode-field-item{margin-bottom:20px}.zcode-text-input,.zcode-textarea{padding:8px 12px}.zcode-textarea{min-height:100px}.zcode-btn,.zcode-btn-primary,.zcode-btn-danger,.zcode-btn-cancel{padding:10px}.zcode-group-tab,.zcode-image-select-btn,.zcode-image-clear-btn,.zcode-parent-select-btn{padding:8px 12px}}.zcode-part-category-tabs{display:flex;gap:4px;padding:8px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-shrink:0}.zcode-category-tab{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-size:13px;font-weight:500;color:#6b7280;transition:all .2s}.zcode-category-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-category-tab.active{background:var(--zcode-color-add);color:#fff;border-color:var(--zcode-color-add)}.zcode-type-tabs{display:flex;gap:4px;padding:8px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;flex-shrink:0;-webkit-overflow-scrolling:touch}.zcode-type-tab{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-size:12px;font-weight:500;color:#6b7280;transition:all .2s;white-space:nowrap}.zcode-type-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-type-tab.active{background:var(--zcode-color-add);color:#fff;border-color:var(--zcode-color-add)}.zcode-part-list{flex:1;overflow-y:auto;padding:12px}.zcode-part-type-section{margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #e5e7eb}.zcode-part-type-section:last-child{border-bottom:none;margin-bottom:0}.zcode-type-section-title{font-size:14px;font-weight:600;color:#1f2937;margin:0 0 6px}.zcode-type-section-description{font-size:12px;color:#6b7280;margin:0 0 8px;line-height:1.5}.zcode-module-buttons{display:grid;grid-template-columns:1fr;gap:6px}.zcode-empty-parts{text-align:center;padding:40px 20px;color:#9ca3af}.zcode-empty-parts-text{margin:0;font-size:14px}.zcode-module-preview{border:2px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;transition:all .2s;overflow:hidden;display:flex;flex-direction:column}.zcode-module-preview:hover{border-color:#9ca3af;box-shadow:0 4px 6px #0000001a}.zcode-module-preview.active{border-color:var(--zcode-color-add);box-shadow:0 0 0 3px #10b9811a}.zcode-module-preview-label{padding:6px 10px;background:#f9fafb;border-bottom:1px solid #e5e7eb;font-size:11px;font-weight:600;color:#374151;text-align:center}.zcode-module-preview.active .zcode-module-preview-label{background:var(--zcode-color-add);color:#fff}.zcode-module-preview-header{display:flex;align-items:center;justify-content:space-between;padding:0;background:#f9fafb;border-bottom:1px solid #e5e7eb}.zcode-module-preview-header .zcode-module-preview-label{flex:1;padding:4px 8px;background:transparent;border-bottom:none;text-align:left}.zcode-module-preview-icon-btn{border:none;background:transparent;padding:0 6px 0 0;cursor:pointer;color:#6b7280;display:flex;align-items:center;justify-content:center}.zcode-module-preview-icon-btn:hover{color:#111827}.zcode-module-preview.active .zcode-module-preview-header{background:var(--zcode-color-add)}.zcode-module-preview.active .zcode-module-preview-header .zcode-module-preview-label{color:#fff}.zcode-module-preview.active .zcode-module-preview-icon-btn{color:#ecfeff}.zcode-module-preview-content{padding:0;flex:1;overflow:hidden;overflow-y:hidden}.zcode-module-preview-content *{max-width:100%}.zcode-copy-notice{display:flex;align-items:center;gap:8px;padding:8px 12px;background:#f0f9ff;border:1px solid #bae6fd;border-radius:4px;margin-bottom:12px}.zcode-copy-notice-icon{flex-shrink:0;color:#0ea5e9}.zcode-copy-notice-text{margin:0;font-size:13px;color:#075985}.zcode-insert-position{padding:12px 20px;border-top:1px solid #e5e7eb;background:#fff}.zcode-insert-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;gap:16px}.zcode-insert-position-title{margin:0;font-size:14px;font-weight:600;color:#374151;flex-shrink:0}.zcode-keep-adding-label-position{margin-top:0;flex-shrink:0;white-space:nowrap}.zcode-keep-adding-label{display:flex;align-items:center;gap:6px;font-size:14px;cursor:pointer;-webkit-user-select:none;user-select:none}.zcode-keep-adding-checkbox{width:16px;height:16px;cursor:pointer}.zcode-insert-buttons{display:flex;gap:8px}.zcode-insert-btn{flex:1;padding:12px 16px;border:2px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-size:14px;font-weight:600;color:#374151;transition:all .2s}.zcode-insert-btn:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-insert-before{border-color:var(--zcode-color-add);color:var(--zcode-color-add)}.zcode-insert-before:hover{background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-hover)}.zcode-insert-after{border-color:var(--zcode-color-add);color:var(--zcode-color-add)}.zcode-insert-after:hover{background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-hover)}.zcode-empty-slot{padding:20px;text-align:center;border:2px dashed #d1d5db;border-radius:8px;background:#f9fafb}.zcode-add-slot-btn{padding:8px 16px;background:var(--zcode-color-add);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-add-slot-btn:hover{background:var(--zcode-color-add-hover)}.zcode-add-btn{padding:10px 20px;font-size:16px;background:var(--zcode-color-add);color:#fff;border:none;border-radius:6px;cursor:pointer;transition:background .2s;font-weight:500}.zcode-add-btn:hover{background:var(--zcode-color-add-hover)}@media(max-width:768px){.zcode-part-category-tabs,.zcode-type-tabs{padding:8px 12px}.zcode-part-list,.zcode-part-item{padding:12px}}.zcode-rich-text-editor{border:1px solid #d1d5db;border-radius:6px;overflow:hidden;background:#fff}.zcode-rich-text-toolbar{display:flex;align-items:center;gap:4px;padding:8px;border-bottom:1px solid #d1d5db;background:#f9fafb;flex-wrap:wrap}.zcode-toolbar-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid #d1d5db;border-radius:4px;background:#fff;cursor:pointer;font-size:14px;transition:all .2s;padding:0}.zcode-toolbar-btn:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-toolbar-btn.is-active{background:var(--zcode-color-edit);color:#fff;border-color:var(--zcode-color-edit)}.zcode-toolbar-divider{width:1px;height:24px;background:#d1d5db;margin:0 4px}.zcode-rich-text-editor-content{min-height:200px;max-height:400px;overflow-y:auto;padding:12px}.zcode-tiptap-editor{outline:none;white-space:pre-wrap}.zcode-tiptap-editor p.is-editor-empty:first-child:before{content:attr(data-placeholder);float:left;color:#9ca3af;pointer-events:none;height:0}.zcode-tiptap-editor p{margin:.5em 0}.zcode-tiptap-editor ul,.zcode-tiptap-editor ol{padding-left:1.5em;margin:.5em 0}.zcode-tiptap-editor ul{list-style-type:disc}.zcode-tiptap-editor ol{list-style-type:decimal}.zcode-rich-text-editor-content ul{list-style-type:disc}.zcode-rich-text-editor-content ol{list-style-type:decimal}.zcode-rich-text-editor-content ul,.zcode-rich-text-editor-content ol{padding-left:1.5em;margin:.5em 0}.zcode-tiptap-editor a.zcode-link{color:var(--zcode-color-edit);text-decoration:underline}.zcode-tiptap-editor strong{font-weight:600}.zcode-tiptap-editor em{font-style:italic}.zcode-tiptap-editor s{text-decoration:line-through}.zcode-image-editor{margin-bottom:16px}.zcode-image-editor-input{width:100%;margin-bottom:8px}.zcode-image-editor-buttons{display:flex;gap:8px;margin-bottom:12px}.zcode-image-select-btn{flex:1;padding:8px 16px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-image-select-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-image-clear-btn{flex:1;padding:8px 12px;background:#ef4444;color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-image-clear-btn:hover{background:#dc2626}.zcode-image-preview{margin-top:12px;border:1px solid #d1d5db;border-radius:6px;padding:8px;background:#f9fafb;display:flex;justify-content:center;align-items:center}.zcode-image-preview-img{max-width:100%;max-height:200px;object-fit:contain;border-radius:4px}.zcode-image-modal{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000;padding:20px}.zcode-image-modal-content{background:#fff;border-radius:12px;box-shadow:0 4px 16px #0003;max-width:800px;width:90%;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-image-modal-content[data-edit-mode]{max-width:500px;width:100%;border-radius:8px;box-shadow:0 10px 40px #0003}.zcode-image-modal-header{display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid #e5e7eb}.zcode-image-modal-header-title{margin:0;font-size:20px;font-weight:600;color:#1f2937}.zcode-image-current{padding:16px 24px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-image-current-title{margin:0 0 12px;font-size:14px;font-weight:600;color:#6b7280}.zcode-image-current-item{display:flex;align-items:center;gap:12px}.zcode-image-current-item-img{width:60px;height:60px;object-fit:cover;border-radius:6px;border:1px solid #d1d5db}.zcode-image-current-name{font-size:14px;color:#374151;font-weight:500}.zcode-image-tabs{display:flex;border-bottom:1px solid #e5e7eb;padding:0 24px}.zcode-image-tab{padding:12px 20px;background:none;border:none;border-bottom:2px solid transparent;cursor:pointer;font-size:14px;font-weight:500;color:#6b7280;transition:all .2s}.zcode-image-tab:hover{color:#1f2937;background:#f9fafb}.zcode-image-tab.active{color:var(--zcode-color-edit);border-bottom-color:var(--zcode-color-edit)}.zcode-image-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:16px;padding:24px;overflow-y:auto;flex:1}.zcode-image-name{padding:8px;font-size:12px;color:#374151;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.zcode-image-add{padding:16px 24px;border-top:1px solid #e5e7eb;background:#f9fafb}.zcode-image-add-btn{width:100%;padding:10px 16px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:8px}.zcode-image-add-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-image-modal-actions{display:flex;gap:8px;padding:16px 24px;border-top:1px solid #e5e7eb;background:#fff}.zcode-image-modal-actions-btn{flex:1}.zcode-dev-container{width:100%;min-height:100vh;display:flex;flex-direction:column;position:relative}.zcode-cms-container.zcode-dev-padding{padding-right:375px}@media(max-width:768px){.zcode-cms-container.zcode-dev-padding{padding-right:0;padding-bottom:60vh}.zcode-dev-header{flex-direction:column;align-items:stretch;padding:0;gap:8px;background:none;border-bottom:none;box-shadow:none}.zcode-dev-tab{border-bottom:1px solid #e5e7eb}}.zcode-dev-container>zcode-cms{display:block}.zcode-loading-message{padding:40px;text-align:center;color:#6b7280}.zcode-loading-message-text{margin:8px 0;font-size:14px}.zcode-dev-tabs{display:flex;gap:8px;padding:0;flex-shrink:0;width:100%;box-sizing:border-box;background:#f9fafb;justify-content:space-between}.zcode-dev-tab{padding:10px 20px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-weight:500;font-size:14px;transition:background .15s ease,border-color .15s ease,color .15s ease,box-shadow .15s ease;display:flex;align-items:center;gap:6px;color:#6b7280;flex:1 1 0;justify-content:center;text-align:center}.zcode-dev-settings-btn{flex:0 0 auto;padding:6px;min-width:32px;justify-content:center;border-radius:4px;font-size:12px}.zcode-dev-tab:hover{background:#f3f4f6;border-color:#9ca3af;box-shadow:0 1px 3px #0f172a14}.zcode-dev-tab.active{background:var(--zcode-color-edit);color:#fff;border-color:var(--zcode-color-edit);font-weight:600;box-shadow:0 2px 6px #2563eb40}@media(max-width:768px){.zcode-dev-tabs{display:grid;grid-template-columns:repeat(2,1fr);gap:6px;background:transparent}.zcode-dev-tab{width:auto;flex:none;justify-content:flex-start;text-align:left;padding:10px 12px;font-size:13px}.zcode-dev-tab.zcode-dev-settings-btn{display:none}}.zcode-dev-settings-btn-fixed{display:none}@media(max-width:768px){.zcode-dev-settings-btn-fixed{position:fixed;bottom:20px;right:20px;width:48px;height:48px;padding:0;border:2px solid #d1d5db;border-radius:50%;background:#fff;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 12px #00000040;z-index:1000;transition:all .2s ease}.zcode-dev-settings-btn-fixed:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-dev-settings-btn-fixed svg{width:20px;height:20px}}.zcode-parts-manager{width:100%;background:#fff}.zcode-parts-manager-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center}.zcode-parts-manager-header-title{margin:0;font-size:18px;color:#1f2937}.zcode-parts-category-tabs,.zcode-images-category-tabs{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-parts-category-tab-group,.zcode-images-category-tab-group{display:flex;gap:4px}.zcode-parts-manager-content{display:flex;flex-direction:column}.zcode-parts-list-header{padding:16px;border-bottom:1px solid #e5e7eb;display:flex;justify-content:space-between;align-items:center;background:#fff}.zcode-parts-list-header-title{margin:0;font-size:14px;font-weight:600;color:#1f2937}.zcode-parts-items{padding:16px}.zcode-part-item{padding:16px;border:1px solid #e5e7eb;border-radius:8px;cursor:pointer;transition:all .2s;background:#fff;height:100%;display:flex;flex-direction:column;position:relative}.zcode-part-item:hover{border-color:#d1d5db;box-shadow:0 2px 8px #0000001a}.zcode-part-item.zcode-reorder-source{border-color:var(--zcode-color-reorder);background:#f59e0b05;box-shadow:0 0 0 1px #f59e0b1a}.zcode-reorder-source-indicator{position:absolute;top:-10px;right:10px;background:var(--zcode-color-reorder);color:#fff;padding:2px 8px;border-radius:4px;font-size:11px;font-weight:600;z-index:10}.zcode-part-item-add{border:2px dashed #d1d5db;background:#f9fafb;display:flex;align-items:center;justify-content:center;min-height:120px;cursor:pointer}.zcode-part-item-add:hover{border-color:var(--zcode-color-add);background:var(--zcode-color-add-bg);transform:translateY(-2px)}.zcode-part-item-add-content{display:flex;flex-direction:column;align-items:center;gap:8px;color:#6b7280;font-size:14px;font-weight:500}.zcode-part-item-add:hover .zcode-part-item-add-content{color:var(--zcode-color-add)}.zcode-part-item-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.zcode-part-item-actions{display:flex;gap:4px;align-items:center}.zcode-action-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-action-btn:hover{background:#e5e7eb;color:#374151}.zcode-action-btn.active{background:var(--zcode-color-reorder);color:#fff}.zcode-action-btn.zcode-delete-btn:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-part-duplicate-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-part-duplicate-btn:hover{background:var(--zcode-color-add-bg);color:var(--zcode-color-add)}.zcode-part-type{font-weight:600;font-size:14px;color:#1f2937}.zcode-part-actions{display:flex;gap:4px}.zcode-part-edit-btn,.zcode-part-delete-btn,.zcode-module-delete-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-part-edit-btn:hover{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit)}.zcode-part-delete-btn:hover,.zcode-module-delete-btn:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-part-description{font-size:13px;color:#6b7280;margin-bottom:4px}.zcode-description-empty{color:#9ca3af;font-style:italic}.zcode-part-modules{font-size:12px;color:#9ca3af}.zcode-part-type-group{margin-bottom:24px}.zcode-part-type-title{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:16px;font-weight:600;color:#1f2937;margin:0 0 12px;padding-bottom:8px;border-bottom:2px solid #e5e7eb}.zcode-part-type-actions{display:flex;align-items:center;gap:4px}.zcode-part-type-edit-btn{padding:4px 8px;border:1px solid #e5e7eb;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;transition:all .2s}.zcode-part-type-edit-btn:hover{background:var(--zcode-color-edit-bg);border-color:var(--zcode-color-edit-border-hover);color:var(--zcode-color-edit)}.zcode-part-type-items{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px}.zcode-part-preview{margin-top:12px;padding:8px;border:1px solid #e5e7eb;border-radius:6px;background:#f9fafb;max-height:150px;overflow:hidden;flex:1;min-height:0}.zcode-part-preview-content{font-size:11px;line-height:1.4;pointer-events:none;transform:scale(.75);transform-origin:top left;width:133.33%}.zcode-required{color:#ef4444;margin-left:2px}.zcode-part-modal{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000;padding:20px}.zcode-part-modal-content{background:#fff;border-radius:8px;box-shadow:0 10px 40px #0003;width:100%;max-width:95vw;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-part-editor{display:flex;flex-direction:column;overflow:hidden;height:100%}.zcode-part-editor-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-part-editor-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-part-editor-form{flex:1;overflow-y:auto;padding:24px 24px 80px}.zcode-part-editor-main{display:grid;grid-template-columns:1fr 1fr;gap:24px;align-items:stretch;min-height:0}.zcode-part-editor-fields{display:flex;flex-direction:column;gap:16px}.zcode-part-editor-preview{border:1px solid #e5e7eb;border-radius:8px;padding:16px;background:#f9fafb;position:sticky;top:0;max-height:calc(90vh - 200px);display:flex;flex-direction:column}.zcode-part-editor-preview-title{margin:0 0 12px;font-size:14px;font-weight:600;color:#1f2937}.zcode-preview-module-selector{margin-bottom:12px}.zcode-select-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;cursor:pointer}.zcode-select-input:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-editing-preview-content{flex:1;overflow-y:auto;padding:12px;background:#fff;border-radius:6px;min-height:200px;transform:scale(.9);transform-origin:top left;width:111.11%}.zcode-preview-empty{flex:1;display:flex;align-items:center;justify-content:center;color:#9ca3af;font-size:14px}.zcode-preview-modal{position:fixed;inset:0;background:#000c;display:flex;align-items:center;justify-content:center;z-index:3000;padding:20px}.zcode-preview-modal-content{background:#fff;border-radius:8px;width:90%;max-width:1200px;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-preview-modal-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-preview-modal-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-preview-modal-body{padding:24px;overflow-y:auto;flex:1}.zcode-help-modal-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:10000;padding:20px}.zcode-help-modal{background:#fff;border-radius:8px;width:90%;max-width:800px;max-height:80vh;overflow:auto;box-shadow:0 20px 25px -5px #0000001a}.zcode-help-modal-header{display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid #e5e7eb;background:#f9fafb;position:sticky;top:0;z-index:1}.zcode-help-modal-header-title{margin:0;font-size:18px;font-weight:600;color:#1f2937;display:flex;align-items:center;gap:8px}.zcode-css-warning-modal-title-icon{color:#f59e0b;flex-shrink:0}.zcode-help-modal-body{padding:24px}.zcode-help-table{width:100%;border-collapse:collapse;margin-bottom:24px}.zcode-help-table-cell{padding:14px 16px;text-align:left;border-bottom:1px solid #e5e7eb;border-right:1px solid #e5e7eb;vertical-align:top}.zcode-help-table-cell:last-child{border-right:none}.zcode-help-table-header{background:#f9fafb;font-weight:600;color:#374151;font-size:13px;text-transform:uppercase;letter-spacing:.5px}.zcode-help-table-data{font-size:14px;color:#4b5563;line-height:1.6}.zcode-help-table-data:first-child{width:35%}.zcode-help-table-data:nth-child(2){width:30%}.zcode-help-table-data:nth-child(3){width:35%}.zcode-help-table-code{background:#f3f4f6;padding:3px 8px;border-radius:4px;font-size:13px;color:#dc2626;font-family:Courier New,Courier,monospace;white-space:nowrap;border:1px solid #e5e7eb}.zcode-help-table-row:hover{background:#fafafa}.zcode-help-section{background:#f9fafb;padding:12px 16px;border-radius:6px;border:1px solid #e5e7eb;margin-bottom:16px}.zcode-help-section:last-child{margin-bottom:0}.zcode-help-section-title{margin:0 0 8px;color:#374151;font-size:14px;font-weight:600}.zcode-help-section-list{margin:0;padding-left:0;list-style-position:inside}.zcode-help-section-item{margin-bottom:6px;color:#6b7280;font-size:13px;line-height:1.6}.zcode-help-section-item:last-child{margin-bottom:0}.zcode-help-section-code{background:#f3f4f6;padding:2px 6px;border-radius:3px;font-size:12px;color:#dc2626;font-family:Courier New,Courier,monospace;border:1px solid #e5e7eb}.zcode-slots-config{display:flex;flex-direction:column;gap:16px}.zcode-slot-config-item{border:1px solid #e5e7eb;border-radius:6px;padding:12px;background:#f9fafb}.zcode-slot-config-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #e5e7eb}.zcode-slot-config-header-title{font-size:14px;color:#1f2937}.zcode-slot-config-body{display:flex;flex-direction:column;gap:8px}.zcode-slot-config-body-label{font-size:12px;font-weight:600;color:#6b7280;margin-bottom:4px}.zcode-checkbox-group{display:flex;flex-direction:column;gap:6px}.zcode-checkbox-item{display:flex;align-items:center;gap:6px;cursor:pointer}.zcode-checkbox-item:hover{background-color:transparent}.zcode-checkbox{width:16px;height:16px;cursor:pointer;accent-color:var(--zcode-color-edit);flex-shrink:0}.zcode-checkbox-item span{font-size:13px;color:#374151;-webkit-user-select:none;user-select:none}.zcode-module-slots-config{margin-top:16px;padding-top:16px;border-top:1px solid #e5e7eb}.zcode-slot-add-section{margin-top:16px;padding:12px;border:1px dashed #d1d5db;border-radius:6px;background:#f9fafb}.zcode-slot-add-section-label{display:block;font-size:13px;font-weight:600;color:#374151;margin-bottom:8px}.zcode-slot-add-controls{display:flex;gap:8px;align-items:center}.zcode-select-input{flex:1;padding:8px 12px;border:1px solid #d1d5db;border-radius:4px;background:#fff;font-size:14px;color:#1f2937;cursor:pointer;transition:border-color .2s}.zcode-select-input:hover{border-color:#9ca3af}.zcode-select-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-select{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;color:#1f2937;cursor:pointer;transition:border-color .2s}.zcode-select:hover{border-color:#9ca3af}.zcode-select:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-select[multiple]{padding:4px;cursor:default}.zcode-select-option{padding:6px 8px;border-radius:4px;margin:2px 0}.zcode-select-option:checked{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit)}.zcode-tag-editor{display:flex;flex-direction:column;gap:8px}.zcode-tag-preview{font-size:12px;color:#6b7280;padding:4px 8px;background-color:#f3f4f6;border-radius:4px;font-family:Courier New,monospace}.zcode-tag-preview code{background-color:transparent;padding:0;color:#374151;font-weight:600}.zcode-slot-add-empty{margin-top:16px;padding:12px;text-align:center;color:#6b7280;font-size:13px;font-style:italic}.zcode-module-slots-config-label{font-size:13px;font-weight:600;color:#374151;margin-bottom:8px;display:block}.zcode-form-hint{font-size:12px;color:#6b7280;margin-top:4px;margin-bottom:12px;font-style:italic}.zcode-btn-small{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s;font-size:12px}.zcode-btn-small:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-module-item.active{border-color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg)}.zcode-module-delete-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-module-delete-btn:hover:not(:disabled){background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-module-delete-btn:disabled{opacity:.4;cursor:not-allowed}.zcode-module-actions{display:flex;gap:4px;align-items:center}.zcode-module-duplicate-btn,.zcode-module-copy-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-module-duplicate-btn:hover:not(:disabled),.zcode-module-copy-btn:hover:not(:disabled){background:var(--zcode-color-add-bg);color:var(--zcode-color-add)}.zcode-module-copy-btn:disabled{opacity:.4;cursor:not-allowed}.zcode-form-field{margin-bottom:16px}.zcode-form-field-label{display:block;font-size:14px;font-weight:500;color:#374151;margin-bottom:6px}.zcode-form-field-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px}.zcode-form-field-header>.zcode-form-field-label:first-child{margin-bottom:0}.zcode-form-field-actions{display:flex;align-items:center;gap:8px}.zcode-help-btn{display:flex;align-items:center;justify-content:center;padding:4px;background:transparent;border:none;color:#6b7280;cursor:pointer;border-radius:4px;transition:all .2s}.zcode-help-btn:hover{color:#374151;background:transparent}.zcode-checkbox-label{display:flex;align-items:center;gap:6px;cursor:pointer;-webkit-user-select:none;user-select:none;margin-bottom:0}.zcode-checkbox-label-inline{margin-bottom:0}.zcode-checkbox-input{width:16px;height:16px;cursor:pointer;margin:0}.zcode-checkbox-label span{font-size:13px;color:#6b7280;font-weight:400}.zcode-text-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;transition:border-color .2s}.zcode-text-input:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-monaco-editor{width:100%;flex:1;min-height:0;display:flex;flex-direction:column}.zcode-monaco-editor .monaco-editor-wrapper{flex:1;min-height:0;display:flex;flex-direction:column}.zcode-monaco-editor .monaco-editor-container{border:1px solid #d1d5db;border-radius:4px;flex:1;min-height:0;max-height:none!important}.zcode-textarea{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;font-family:monospace;resize:vertical;transition:border-color .2s}.zcode-textarea:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-modules-list{margin-bottom:12px}.zcode-module-item{padding:12px;border:1px solid #e5e7eb;border-radius:6px;margin-bottom:12px;background:#f9fafb;cursor:pointer;transition:all .2s}.zcode-module-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.zcode-module-title{font-weight:600;font-size:14px;color:#1f2937}.zcode-module-body{display:flex;flex-direction:column;gap:8px}.zcode-module-body-label{font-size:12px;font-weight:500;color:#6b7280}.zcode-part-editor-actions{display:flex;gap:8px;padding:16px 24px;border-top:1px solid #e5e7eb;background:#fff;flex-shrink:0}.zcode-part-editor-actions-btn{flex:1}.zcode-part-editor-actions-btn-primary,.zcode-btn-primary{padding:10px 20px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:600;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-parts-new-btn,.zcode-images-add-btn{padding:7px 12px;font-size:13px;border-radius:4px}.zcode-btn-primary:hover{background:var(--zcode-color-edit-hover)}.zcode-btn-secondary{padding:8px 16px;background:#f3f4f6;color:#374151;border:1px solid #d1d5db;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:all .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-secondary:hover{background:#e5e7eb;border-color:#9ca3af}.zcode-page-css-panel{width:100%;background:#fff;display:flex;flex-direction:column;height:100%;flex:1;min-height:0}.zcode-warning-banner{padding:16px;background:#fff3cd;border-bottom:1px solid #ffc107;display:flex;gap:12px}.zcode-warning-icon{font-size:20px;flex-shrink:0}.zcode-warning-content{flex:1}.zcode-warning-title{margin:0 0 8px;font-size:14px;font-weight:700;color:#856404}.zcode-warning-list{margin:0;padding-left:20px;font-size:13px;color:#856404;line-height:1.6}.zcode-warning-list li{margin-bottom:4px}.zcode-warning-list strong{font-weight:700}.zcode-warning-inline{padding:12px;background:#fff3cd;border:1px solid #ffc107;border-radius:6px;margin-bottom:16px;display:flex;gap:12px}.zcode-warning-inline .zcode-warning-icon{font-size:18px;flex-shrink:0}.zcode-warning-inline .zcode-warning-content{flex:1}.zcode-warning-inline .zcode-warning-title{margin:0 0 8px;font-size:13px;font-weight:700;color:#856404}.zcode-warning-inline .zcode-warning-text{font-size:12px;color:#856404;line-height:1.6}.zcode-warning-inline .zcode-warning-text ul{margin:0;padding-left:20px}.zcode-warning-inline .zcode-warning-text li{margin-bottom:4px}.zcode-css-warning-modal{max-width:500px}.zcode-css-warning-modal-footer{display:flex;flex-direction:column;justify-content:center;align-items:center;padding:16px 24px;border-top:1px solid #e5e7eb;background:#f9fafb}.zcode-css-warning-modal .zcode-warning-content{padding:0}.zcode-css-warning-modal .zcode-warning-list{margin:0;padding-left:20px;font-size:14px;color:#856404;line-height:1.8;list-style-type:disc;list-style-position:outside}.zcode-css-warning-modal .zcode-warning-list li{margin-bottom:8px;list-style-type:disc}.zcode-css-warning-modal .zcode-warning-list strong{font-weight:700;color:#92400e}.zcode-page-css-content{display:flex;flex:1;overflow:hidden}.zcode-page-css-parts-selector{width:280px;border-right:1px solid #e5e7eb;display:flex;flex-direction:column;overflow:hidden;background:#f9fafb}.zcode-search-box{padding:12px;border-bottom:1px solid #e5e7eb;background:#fff}.zcode-search-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff}.zcode-search-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-parts-list{flex:1;overflow-y:auto;padding:12px}.zcode-parts-section{margin-bottom:24px}.zcode-parts-section:last-child{margin-bottom:0}.zcode-parts-section-title{margin:0 0 8px;padding:8px 12px;font-size:12px;font-weight:700;color:#6b7280;text-transform:uppercase;letter-spacing:.05em;background:#fff;border-radius:4px}.zcode-part-item{padding:12px;border:1px solid #e5e7eb;border-radius:6px;cursor:pointer;transition:all .2s;background:#fff;margin-bottom:8px}.zcode-part-item:hover{border-color:#d1d5db;box-shadow:0 2px 4px #0000000d}.zcode-part-item-selected{border-color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg);box-shadow:0 0 0 2px #3b82f633}.zcode-part-item-title{font-size:14px;font-weight:600;color:#1f2937;margin-bottom:4px}.zcode-part-item-id{font-size:12px;color:#6b7280;font-family:monospace}.zcode-page-css-preview{flex:1;border-right:1px solid #e5e7eb;display:flex;flex-direction:column;overflow:hidden;background:#f9fafb}.zcode-preview-container{flex:1;overflow:auto;padding:24px}.zcode-preview-content{max-width:800px;margin:0 auto;background:#fff;padding:24px;border-radius:8px;box-shadow:0 2px 8px #0000001a}.zcode-preview-content [data-zcode-highlight=true]{outline:3px solid var(--zcode-color-edit);outline-offset:4px;background:var(--zcode-color-edit-bg)}.zcode-page-css-editor{width:100%;display:flex;flex-direction:column;overflow:hidden;background:#fff;flex:1;min-height:0}.zcode-page-css-editor .zcode-form-field{flex:1;display:flex;flex-direction:column;padding:16px;overflow:hidden}.zcode-page-css-editor .zcode-form-field label{margin-bottom:8px;font-size:14px;font-weight:600;color:#1f2937}.zcode-page-css-editor .monaco-editor-wrapper{flex:1;min-height:0}.zcode-page-css-editor .monaco-editor-container{height:100%;min-height:320px;max-height:none}.zcode-page-css-actions{padding:16px;border-top:1px solid #e5e7eb;display:flex;gap:8px;justify-content:flex-end;flex-shrink:0}.zcode-page-css-actions .zcode-btn-primary,.zcode-page-css-actions .zcode-btn-secondary{flex:1}.zcode-images-manager{width:100%;background:#fff}.zcode-images-manager-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center}.zcode-images-manager-header-title{margin:0;font-size:18px;color:#1f2937}.zcode-images-manager-content{display:flex;flex-direction:column}.zcode-images-grid{padding:16px;display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:16px;align-content:start}.zcode-image-item{position:relative;border:2px solid #e5e7eb;border-radius:8px;cursor:pointer;background:#f9fafb;display:flex;flex-direction:column;overflow:hidden}.zcode-image-item>img{width:100%;height:150px;object-fit:cover;display:block;flex-shrink:0}.zcode-image-item:hover{border-color:#d1d5db;box-shadow:0 2px 8px #0000001a}.zcode-image-item.zcode-reorder-source{border-color:var(--zcode-color-reorder);background:#f59e0b05;box-shadow:0 0 0 1px #f59e0b1a}.zcode-image-item.selected{border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f633}.zcode-image-item-clickable{cursor:pointer}.zcode-image-item-img{width:100%;height:150px;object-fit:cover;display:block}.zcode-image-item-overlay{position:absolute;inset:0;pointer-events:none}.zcode-image-item-actions{position:absolute;top:8px;right:8px;display:flex;gap:4px;opacity:0;pointer-events:auto}.zcode-image-item:hover .zcode-image-item-actions{opacity:1}.zcode-image-edit-btn,.zcode-image-delete-btn{padding:8px;border:none;border-radius:4px;background:#ffffffe6;color:#374151;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-image-edit-btn:hover{background:#fff;color:var(--zcode-color-edit)}.zcode-image-delete-btn:hover{background:#fff;color:var(--zcode-color-delete)}.zcode-image-item-name{padding:8px;font-size:12px;color:#374151;text-align:center;background:#fff;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:break-all;overflow-wrap:break-word;max-width:100%}.zcode-image-editor-panel{position:static;width:auto;height:auto;background:transparent;box-shadow:none;display:block;z-index:auto}.zcode-image-editor-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-image-editor-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-image-editor-form{flex:1;overflow-y:auto;padding:16px}.zcode-image-preview-large{margin-bottom:16px;border:1px solid #e5e7eb;border-radius:6px;padding:8px;background:#f9fafb;display:flex;justify-content:center;align-items:center}.zcode-image-preview-large-img{max-width:100%;max-height:200px;object-fit:contain;border-radius:4px}.zcode-image-editor-actions{display:flex;gap:8px;margin-top:16px;padding-top:16px;border-top:1px solid #e5e7eb}.zcode-image-editor-actions-btn{flex:1}@media(max-width:768px){.zcode-part-type-items{grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:12px}.zcode-part-modal{padding:10px}.zcode-part-modal-content{max-width:100%;max-height:95vh}.zcode-part-editor-main,.zcode-part-editor-topfields{grid-template-columns:1fr}.zcode-part-editor-preview{position:relative;max-height:400px}.zcode-images-grid{grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:12px}}.zcode-data-viewer{border-top:1px solid #e5e7eb;background:#fff;display:flex;flex-direction:column;min-height:200px;flex-shrink:0;height:100%;overflow:hidden}.zcode-data-viewer-header{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;padding:8px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-data-viewer-content-tabs{display:flex;gap:4px}.zcode-data-viewer-content-tab{padding:6px 12px;font-size:13px;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;font-weight:500;transition:all .2s}.zcode-data-viewer-content-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-data-viewer-content-tab.active{background:var(--zcode-color-edit);color:#fff;border-color:var(--zcode-color-edit)}.zcode-data-viewer-tabs{display:flex;gap:4px;align-items:center}.zcode-data-viewer-tab{padding:6px 12px;font-size:13px;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;font-weight:500;transition:all .2s}.zcode-data-viewer-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-data-viewer-tab.active{background:var(--zcode-color-add);color:#fff;border-color:var(--zcode-color-add)}.zcode-data-viewer-error{padding:12px 16px;background:#fee;color:#c33;border-bottom:1px solid #e5e7eb;font-size:13px}.zcode-data-viewer-content{flex:1;overflow:auto;position:relative}.zcode-data-viewer-display-wrapper{position:relative;width:100%;height:100%}.zcode-data-viewer-display{margin:0;padding:16px;font-family:Monaco,Menlo,Ubuntu Mono,monospace;font-size:13px;line-height:1.6;color:#f9fafb;background:#111827;white-space:pre;overflow-x:auto;border-top:1px solid #374151}.zcode-data-viewer-copy-btn{position:absolute;top:12px;right:12px;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid rgba(255,255,255,.2);border-radius:4px;background:#111827cc;color:#f9fafb;cursor:pointer;transition:all .2s;z-index:10}.zcode-data-viewer-copy-btn:hover{background:#111827f2;border-color:#ffffff4d;color:#fff}.zcode-data-viewer-copy-btn:active{transform:scale(.95)}.zcode-input-readonly,.zcode-textarea-readonly{display:none}.zcode-dev-container .zcode-input-readonly,.zcode-dev-container .zcode-textarea-readonly{display:block;background-color:#f3f4f6;color:#6b7280;border-color:#d1d5db;cursor:default;pointer-events:none}.zcode-context-menu{position:fixed;background:#fff;border:1px solid #e5e7eb;border-radius:6px;box-shadow:0 4px 12px #00000026;padding:4px;z-index:10000;min-width:160px}.zcode-context-menu-item{display:flex;align-items:center;gap:8px;width:100%;padding:8px 12px;border:none;background:transparent;text-align:left;cursor:pointer;border-radius:4px;font-size:14px;color:#374151;transition:background .2s}.zcode-context-menu-item:hover{background:#f3f4f6}.zcode-context-menu-item.active{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit);font-weight:500}.zcode-context-menu-divider{height:1px;background:#e5e7eb;margin:4px 0}.zcode-save-confirm-dialog-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:10000}.zcode-save-confirm-dialog{background:#fff;border-radius:8px;box-shadow:0 10px 25px #0003;max-width:500px;width:90%;max-height:80vh;display:flex;flex-direction:column}.zcode-save-confirm-dialog-header{padding:16px 20px;border-bottom:1px solid #e5e7eb}.zcode-save-confirm-dialog-title{font-size:18px;font-weight:600;color:#111827}.zcode-save-confirm-dialog-body{padding:20px;flex:1;overflow-y:auto}.zcode-save-confirm-dialog-body p{margin:0 0 12px;font-size:14px;color:#374151}.zcode-save-confirm-targets{list-style:none;padding:0;margin:12px 0}.zcode-save-confirm-targets li{padding:8px 12px;background:#f9fafb;border-radius:4px;margin-bottom:8px;font-size:14px;color:#374151}.zcode-save-confirm-targets li:last-child{margin-bottom:0}.zcode-save-confirm-dialog-footer{padding:16px 20px;border-top:1px solid #e5e7eb;display:flex;justify-content:flex-end;gap:12px}.zcode-btn-secondary{padding:8px 16px;background:#fff;border:1px solid #d1d5db;border-radius:6px;font-size:14px;cursor:pointer;color:#374151;transition:background-color .2s,border-color .2s}.zcode-btn-secondary:hover{background:#f9fafb;border-color:#9ca3af}.zcode-btn-primary{padding:8px 16px;background:#3b82f6;border:none;border-radius:6px;font-size:14px;cursor:pointer;color:#fff;transition:background-color .2s}.zcode-btn-primary:hover{background:#2563eb}@media(max-width:768px){.zcode-save-confirm-dialog{width:95%;max-height:90vh}.zcode-save-confirm-dialog-header{padding:12px 16px}.zcode-save-confirm-dialog-body{padding:16px}.zcode-save-confirm-dialog-footer{padding:12px 16px;flex-direction:column-reverse}.zcode-btn-secondary,.zcode-btn-primary{width:100%}}",eT={common:{close:"閉じる",save:"保存",cancel:"キャンセル",delete:"削除",edit:"編集",add:"追加",reorder:"並べ替え",preview:"プレビュー",settings:"設定",manage:"管理",view:"表示",confirm:"確定",clear:"クリア",select:"選択",replace:"差し替え",copy:"コピー",copied:"コピーしました"},toolbar:{editMode:"編集",addMode:"追加",reorderMode:"並べ替え",deleteMode:"削除",viewMode:"表示",settings:"設定"},settings:{title:"設定",language:{label:"言語",ja:"日本語",en:"English"},enableDynamicContent:"ページの動作を有効にする",enableDynamicContentDescription:"アコーディオン、タブ、モーダル、リンクなどの動的コンテンツの動作を有効にします。",devRightPadding:"編集パネル分の余白をつける",devRightPaddingDescription:"編集パネル表示時にコンテンツの右側に余白を追加します。",enableContextMenu:"右クリックメニューを有効にする",enableContextMenuDescription:"コンテンツ上で右クリックすると、編集・追加・並べ替え・削除のモードを切り替えるメニューが表示されます。",showSaveConfirm:"保存時の確認ダイアログを表示する",showSaveConfirmDescription:"保存ボタンをクリックした際に、保存対象を確認するダイアログを表示します。",previewModeInfo:"表示モードでは動的コンテンツ(アコーディオン、タブ、モーダル、リンクなど)は常に有効です。",noSettings:"設定項目はありません。"},addPanel:{title:"追加",selectParent:"親要素を選択",category:{common:"共通",individual:"個別",selected:"選択したパーツ"},typeAll:"all",activeParts:"active parts",activePartsDescription:"プレビューエリアでクリックしたパーツを、現在のデータを含む状態で追加できます。",clickPartInPreview:"プレビューエリアでパーツをクリックしてください",noPartsAvailable:"利用可能なパーツがありません",addBefore:"前に追加",addAfter:"後に追加",continueAdding:"パーツ追加を続ける"},editPanel:{title:"編集中",editing:"編集中: {type}",id:"ID: {id}",selectImage:"画像を選択",replaceImage:"差し替え",clearImage:"クリア",clearImageTitle:"画像をクリア",noFields:"編集可能なフィールドがありません"},deletePanel:{title:"削除確認",confirmMessage:"このパーツを削除しますか?",selectParent:"親要素を選択"},reorderPanel:{title:"並べ替え: 移動元を選択中",instruction:"移動先の要素をクリックしてください",source:"移動元: {path}",selectParent:"親要素を選択"},saveConfirm:{title:"保存の確認",message:"以下のデータを保存しますか?",simpleMessage:"保存しますか?",targets:{page:"ページデータ","parts-common":"パーツ(共通)","parts-individual":"パーツ(個別)","parts-special":"パーツ(特別)","parts-common-css":"CSS(共通)","parts-individual-css":"CSS(個別)","parts-special-css":"CSS(特別)","images-common":"画像(共通)","images-individual":"画像(個別)","images-special":"画像(特別)"},saveButton:"保存する"},partsManager:{createType:"新規タイプ作成",editType:"タイプ編集",typeName:"タイプ名",typeDescription:"説明",typeNamePlaceholder:"例: hero, features",typeDescriptionPlaceholder:"タイプの説明",editPart:"パーツ編集: {title}",partTitle:"タイトル",partDescription:"説明",partDescriptionPlaceholder:"パーツの説明",deletePartConfirm:`パーツ {number} を削除しますか?
466
+ 3. "-" cannot repeat`);We.customSchemes.push([t,e])}function rN(){We.scanner=XS(We.customSchemes);for(let t=0;t<We.tokenQueue.length;t++)We.tokenQueue[t][1]({scanner:We.scanner});We.parser=ZS(We.scanner.tokens);for(let t=0;t<We.pluginQueue.length;t++)We.pluginQueue[t][1]({scanner:We.scanner,parser:We.parser});return We.initialized=!0,We}function Ec(t){return We.initialized||rN(),eN(We.parser.start,t,pm(We.scanner.start,t))}Ec.scan=pm;function Em(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const o=new yc(n),r=Ec(t),i=[];for(let s=0;s<r.length;s++){const l=r[s];l.isLink&&(!e||l.t===e)&&o.check(l)&&i.push(l.toFormattedObject(o))}return i}var kc="[\0-   ᠎ -\u2029  ]",iN=new RegExp(kc),sN=new RegExp(`${kc}$`),aN=new RegExp(kc,"g");function lN(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function cN(t){return new Ot({key:new an("autolink"),appendTransaction:(e,n,o)=>{const r=e.some(d=>d.docChanged)&&!n.doc.eq(o.doc),i=e.some(d=>d.getMeta("preventAutolink"));if(!r||i)return;const{tr:s}=o,l=mh(n.doc,[...e]);if(Ch(l).forEach(({newRange:d})=>{const u=qk(o.doc,d,h=>h.isTextblock);let f,p;if(u.length>1)f=u[0],p=o.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(u.length){const h=o.doc.textBetween(d.from,d.to," "," ");if(!sN.test(h))return;f=u[0],p=o.doc.textBetween(f.pos,d.to,void 0," ")}if(f&&p){const h=p.split(iN).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],b=f.pos+p.lastIndexOf(m);if(!m)return!1;const g=Ec(m).map(x=>x.toObject(t.defaultProtocol));if(!lN(g))return!1;g.filter(x=>x.isLink).map(x=>({...x,from:b+x.start+1,to:b+x.end+1})).filter(x=>o.schema.marks.code?!o.doc.rangeHasMark(x.from,x.to,o.schema.marks.code):!0).filter(x=>t.validate(x.value)).filter(x=>t.shouldAutoLink(x.value)).forEach(x=>{Bl(x.from,x.to,o.doc).some(v=>v.mark.type===t.type)||s.addMark(x.from,x.to,t.type.create({href:x.href}))})}}),!!s.steps.length)return s}})}function dN(t){return new Ot({key:new an("handleClickLink"),props:{handleClick:(e,n,o)=>{var r,i;if(o.button!==0||!e.editable)return!1;let s=!1;if(t.enableClickSelection&&(s=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){let l=null;if(o.target instanceof HTMLAnchorElement)l=o.target;else{let f=o.target;const p=[];for(;f.nodeName!=="DIV";)p.push(f),f=f.parentNode;l=p.find(h=>h.nodeName==="A")}if(!l)return s;const c=Nh(e.state,t.type.name),d=(r=l?.href)!=null?r:c.href,u=(i=l?.target)!=null?i:c.target;l&&d&&(window.open(d,u),s=!0)}return s}}})}function uN(t){return new Ot({key:new an("handlePasteLink"),props:{handlePaste:(e,n,o)=>{const{shouldAutoLink:r}=t,{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let c="";o.content.forEach(u=>{c+=u.textContent});const d=Em(c,{defaultProtocol:t.defaultProtocol}).find(u=>u.isLink&&u.value===c);return!c||!d||r!==void 0&&!r(d.value)?!1:t.editor.commands.setMark(t.type,{href:d.href})}}})}function Ao(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(o=>{const r=typeof o=="string"?o:o.scheme;r&&n.push(r)}),!t||t.replace(aN,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var fN=Vr.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(t=>{if(typeof t=="string"){xm(t);return}xm(t.scheme,t.optionalSlashes)})},onDestroy(){oN()},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:(t,e)=>!!Ao(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const r=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Ao(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Ao(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Rt(this.options.HTMLAttributes,t),0]:["a",Rt(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n;const o=((n=t.attrs)==null?void 0:n.href)||"";return`[${e.renderChildren(t)}](${o})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:o=>!!Ao(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:o=>!!Ao(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Yo({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:o}=this.options,r=Em(t).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!Ao(s,n),protocols:n,defaultProtocol:o}));r.length&&r.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(cN({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!Ao(r,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(dN({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(uN({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),pN=fN;const hN={class:"zcode-rich-text-editor"},mN={key:0,class:"zcode-rich-text-toolbar"},gN=a.defineComponent({__name:"RichTextEditor",props:{modelValue:{type:String},placeholder:{type:String}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,o=e,r=tS({extensions:[oS,iS,aS,pS,xS,SS,LS,$S,VS,FS,pN.configure({openOnClick:!1,HTMLAttributes:{class:"zcode-link"}})],content:n.modelValue||"",editorProps:{attributes:{class:"zcode-tiptap-editor","data-placeholder":n.placeholder||"テキストを入力..."}},onUpdate:({editor:s})=>{const l=s.getHTML();o("update:modelValue",l)}});a.watch(()=>n.modelValue,s=>{r.value&&r.value.getHTML()!==s&&r.value.commands.setContent(s||"")});const i=()=>{if(!r.value)return;const s=r.value.getAttributes("link").href,l=window.prompt("URLを入力してください",s);if(l!==null){if(l===""){r.value.chain().focus().extendMarkRange("link").unsetLink().run();return}r.value.chain().focus().extendMarkRange("link").setLink({href:l}).run()}};return a.onUnmounted(()=>{r.value&&r.value.destroy()}),(s,l)=>(a.openBlock(),a.createElementBlock("div",hN,[a.unref(r)?(a.openBlock(),a.createElementBlock("div",mN,[a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("bold")},"zcode-toolbar-btn"]),title:"太字",onClick:l[0]||(l[0]=c=>a.unref(r).chain().focus().toggleBold().run())},[a.createVNode(a.unref(Jm),{size:16})],2),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("italic")},"zcode-toolbar-btn"]),title:"斜体",onClick:l[1]||(l[1]=c=>a.unref(r).chain().focus().toggleItalic().run())},[a.createVNode(a.unref(Zm),{size:16})],2),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("strike")},"zcode-toolbar-btn"]),title:"取り消し線",onClick:l[2]||(l[2]=c=>a.unref(r).chain().focus().toggleStrike().run())},[a.createVNode(a.unref(rg),{size:16})],2),l[5]||(l[5]=a.createElementVNode("div",{class:"zcode-toolbar-divider"},null,-1)),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("bulletList")},"zcode-toolbar-btn"]),title:"箇条書き",onClick:l[3]||(l[3]=c=>a.unref(r).chain().focus().toggleBulletList().run())},[a.createVNode(a.unref(ng),{size:16})],2),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("orderedList")},"zcode-toolbar-btn"]),title:"番号付きリスト",onClick:l[4]||(l[4]=c=>a.unref(r).chain().focus().toggleOrderedList().run())},[a.createVNode(a.unref(tg),{size:16})],2),l[6]||(l[6]=a.createElementVNode("div",{class:"zcode-toolbar-divider"},null,-1)),a.createElementVNode("button",{type:"button",class:a.normalizeClass([{"is-active":a.unref(r).isActive("link")},"zcode-toolbar-btn"]),title:"リンク",onClick:i},[a.createVNode(a.unref(eg),{size:16})],2)])):a.createCommentVNode("",!0),a.createVNode(a.unref(eS),{editor:a.unref(r),class:"zcode-rich-text-editor-content"},null,8,["editor"])]))}}),bN={class:"zcode-image-modal-header"},yN={class:"zcode-image-modal-header-title",role:"heading","aria-level":"3"},xN=["aria-label"],EN={key:0,class:"zcode-image-current"},kN={class:"zcode-image-current-title",role:"heading","aria-level":"4"},wN={class:"zcode-image-current-item"},SN=["src","alt"],NN={class:"zcode-image-current-name"},CN={class:"zcode-image-tabs"},vN={class:"zcode-image-grid"},TN=["onClick"],zN=["src","alt"],_N={class:"zcode-image-name"},AN={class:"zcode-image-add"},MN={class:"zcode-image-modal-actions"},IN=a.defineComponent({__name:"ImageSelectModal",props:{isOpen:{type:Boolean},imagesCommon:{type:Array},imagesIndividual:{type:Array},imagesSpecial:{type:Array},currentValue:{type:String}},emits:["update:model-value","add-image","delete-image","close"],setup(t,{emit:e}){const{t:n}=rn(),o=t,r=e,i=a.ref("common"),s=a.ref(null),l=a.ref(o.currentValue||null),c=a.computed(()=>i.value==="common"?o.imagesCommon:i.value==="individual"?o.imagesIndividual:o.imagesSpecial),d=()=>o.currentValue&&[...o.imagesCommon,...o.imagesIndividual,...o.imagesSpecial].find(g=>g.id===o.currentValue)||null,u=b=>{l.value=b.id},f=()=>{l.value&&(r("update:model-value",l.value),m())},p=()=>{l.value&&confirm(n("imagesManager.deleteImageFromModalConfirm"))&&(r("delete-image",l.value),l.value=null)},h=b=>{const x=b.target.files?.[0];if(!x)return;const v=new FileReader;v.onload=w=>{const T=w.target?.result,M={id:`img-${Date.now()}`,name:x.name,url:T,mimeType:x.type,needsUpload:!0},A=i.value==="common"?"common":i.value==="individual"?"individual":"special";r("add-image",M,A),l.value=M.id},v.readAsDataURL(x)},m=()=>{r("close")};return(b,g)=>t.isOpen?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:a.withModifiers(m,["self"])},[a.createElementVNode("div",{class:"zcode-image-modal-content",onClick:g[4]||(g[4]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",bN,[a.createElementVNode("div",yN,a.toDisplayString(b.$t("imagesManager.selectImage")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":b.$t("common.close"),onClick:m},[a.createVNode(a.unref(Qe),{size:18})],8,xN)]),t.currentValue&&d()?(a.openBlock(),a.createElementBlock("div",EN,[a.createElementVNode("div",kN,a.toDisplayString(b.$t("imagesManager.currentlySelected")),1),a.createElementVNode("div",wN,[a.createElementVNode("img",{src:d()?.url,alt:d()?.name||"",class:"zcode-image-current-item-img"},null,8,SN),a.createElementVNode("div",NN,a.toDisplayString(d()?.name),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",CN,[a.createElementVNode("button",{class:a.normalizeClass([{active:i.value==="common"},"zcode-image-tab"]),onClick:g[0]||(g[0]=x=>i.value="common")},a.toDisplayString(b.$t("dataViewer.common")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:i.value==="individual"},"zcode-image-tab"]),onClick:g[1]||(g[1]=x=>i.value="individual")},a.toDisplayString(b.$t("dataViewer.individual")),3),t.imagesSpecial.length>0?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass([{active:i.value==="special"},"zcode-image-tab"]),onClick:g[2]||(g[2]=x=>i.value="special")},a.toDisplayString(b.$t("dataViewer.special")),3)):a.createCommentVNode("",!0)]),a.createElementVNode("div",vN,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(c.value,x=>(a.openBlock(),a.createElementBlock("div",{key:x.id,class:a.normalizeClass([{selected:l.value===x.id},"zcode-image-item"]),onClick:v=>u(x)},[a.createElementVNode("img",{src:x.url,alt:x.name,class:"zcode-image-item-img"},null,8,zN),a.createElementVNode("div",_N,a.toDisplayString(x.name),1)],10,TN))),128))]),a.createElementVNode("div",AN,[a.createElementVNode("input",{ref_key:"fileInput",ref:s,type:"file",accept:"image/*",style:{display:"none"},onChange:h},null,544),a.createElementVNode("button",{class:"zcode-image-add-btn",onClick:g[3]||(g[3]=x=>s.value?.click())},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(b.$t("imagesManager.addImage")),1)])]),a.createElementVNode("div",MN,[l.value?(a.openBlock(),a.createElementBlock("button",{key:0,class:"zcode-btn-primary zcode-image-modal-actions-btn",onClick:f},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString(b.$t("imagesManager.select")),1)])):a.createCommentVNode("",!0),l.value?(a.openBlock(),a.createElementBlock("button",{key:1,class:"zcode-btn-danger zcode-image-modal-actions-btn",onClick:p},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(b.$t("common.delete")),1)])):a.createCommentVNode("",!0)])])])):a.createCommentVNode("",!0)}}),ON={class:"zcode-edit-panel-header"},DN={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},RN=["aria-label"],PN={key:0,class:"zcode-parent-selector"},LN={key:1,class:"zcode-group-tabs"},$N=["onClick"],VN={key:2,class:"zcode-field-editor"},BN={class:"zcode-field-item-title",role:"heading","aria-level":"4"},FN={key:0,class:"zcode-text-editor"},jN=["value","placeholder","maxlength","readonly","disabled","onInput"],UN={key:0,class:"zcode-field-error-message"},HN={key:1,class:"zcode-field-counter"},WN={key:1,class:"zcode-text-editor"},GN=["value","placeholder","maxlength","readonly","disabled","onInput"],qN={key:0,class:"zcode-field-error-message"},KN={key:1,class:"zcode-field-counter"},JN={key:2,class:"zcode-rich-text-editor-wrapper"},XN={key:0,class:"zcode-field-error-message"},YN={key:3,class:"zcode-radio-editor"},QN={class:"zcode-radio-group"},ZN=["onUpdate:modelValue","name","value","onChange"],eC={class:"zcode-radio-item-label"},tC={key:4,class:"zcode-checkbox-editor"},nC={class:"zcode-checkbox-group"},oC=["onUpdate:modelValue","value","onChange"],rC={class:"zcode-checkbox-item-label"},iC={key:5,class:"zcode-select-editor"},sC=["onUpdate:modelValue","onChange"],aC=["value"],lC={key:6,class:"zcode-select-editor"},cC=["onUpdate:modelValue","size","onChange"],dC=["value"],uC={key:7,class:"zcode-tag-editor"},fC=["onUpdate:modelValue","onChange"],pC=["value"],hC={class:"zcode-tag-preview"},mC={key:8,class:"zcode-boolean-editor"},gC={class:"zcode-checkbox-item"},bC=["onUpdate:modelValue","onChange"],yC={class:"zcode-checkbox-item-label"},xC={key:9,class:"zcode-image-editor"},EC={class:"zcode-image-editor-buttons"},kC=["onClick"],wC=["title","onClick"],SC={key:0,class:"zcode-image-preview"},NC=["src","alt"],CC={key:3,class:"zcode-edit-fields"},vC={class:"zcode-edit-fields-text"},TC={class:"zcode-edit-fields-text"},zC=a.defineComponent({__name:"EditPanel",props:{editingComponent:{type:[Object,null]},editingAvailableFields:{type:Array},fieldErrors:{type:Object},currentMode:{type:String},canSelectParent:{type:Boolean},imagesCommon:{type:Array},imagesIndividual:{type:Array},imagesSpecial:{type:Array}},emits:["close","select-parent","save-field","add-image","delete-image"],setup(t,{emit:e}){const n=t,o=a.ref("all"),r=a.computed(()=>{const y=new Map;return n.editingAvailableFields.forEach(E=>{const k=E.groupName||"other";y.set(k,(y.get(k)||0)+1)}),Array.from(y.entries()).map(([E,k])=>({name:E,count:k}))}),i=a.computed(()=>r.value.length>1),s=a.computed(()=>!i.value||o.value==="all"?n.editingAvailableFields:n.editingAvailableFields.filter(y=>(y.groupName||"other")===o.value));a.watch(()=>i.value,y=>{y?o.value="all":o.value=void 0},{immediate:!0}),a.watch(()=>n.editingAvailableFields,()=>{if(i.value){if(o.value==="all")return;r.value.some(E=>E.name===o.value)||(o.value="all")}},{deep:!0});const l=e,c=a.ref({});function d(y){const E=y.label||y.fieldName,k=y.currentValue,O=y.type==="rich"&&typeof k=="string"&&k.trim()==="<p></p>"?"":k??"";return y.required&&(O===""||O===void 0||O===null)?`${E}は必須です`:typeof y.maxLength=="number"&&y.maxLength>0&&String(O).length>y.maxLength?`${E}は${y.maxLength}文字以内で入力してください`:null}function u(y,E){E?c.value[y]=E:delete c.value[y]}function f(y){return c.value[y]||n.fieldErrors?.[y]||null}const p=a.ref(!1),h=a.ref(null),m=y=>{h.value=y,p.value=!0},b=()=>{p.value=!1,h.value=null},g=y=>{y.currentValue="",l("save-field",y)},x=y=>{h.value&&(h.value.currentValue=y||"",l("save-field",h.value))},v=(y,E)=>{l("add-image",y,E)},w=y=>{l("delete-image",y),h.value?.currentValue===y&&(h.value.currentValue="",l("save-field",h.value))},T=y=>y&&[...n.imagesCommon,...n.imagesIndividual,...n.imagesSpecial].find(O=>O.id===y)?.url||null,M=(y,E)=>{const k=E.target;y.currentValue=k.value,u(y.fieldName,d(y)),l("save-field",y)},A=(y,E)=>{y.optional&&E===""?y.currentValue=void 0:y.currentValue=E,u(y.fieldName,d(y)),l("save-field",y)};return(y,E)=>t.editingComponent&&t.currentMode==="edit"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-edit-panel",onClick:E[3]||(E[3]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",ON,[a.createElementVNode("div",DN,a.toDisplayString(y.$t("editPanel.editing",{type:t.editingComponent.type})),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":y.$t("common.close"),onClick:E[0]||(E[0]=k=>y.$emit("close"))},[a.createVNode(a.unref(Qe),{size:18})],8,RN)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",PN,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:E[1]||(E[1]=k=>y.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(y.$t("addPanel.selectParent")),1)])])):a.createCommentVNode("",!0),i.value?(a.openBlock(),a.createElementBlock("div",LN,[a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="all"},"zcode-group-tab"]),onClick:E[2]||(E[2]=k=>o.value="all")}," all ",2),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(r.value,k=>(a.openBlock(),a.createElementBlock("button",{key:k.name,class:a.normalizeClass([{active:o.value===k.name},"zcode-group-tab"]),onClick:O=>o.value=k.name},a.toDisplayString(k.name),11,$N))),128))])):a.createCommentVNode("",!0),s.value.length>0?(a.openBlock(),a.createElementBlock("div",VN,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(s.value,k=>(a.openBlock(),a.createElementBlock("div",{key:k.fieldName,class:"zcode-field-item"},[a.createElementVNode("div",BN,a.toDisplayString(k.label),1),k.type==="text"?(a.openBlock(),a.createElementBlock("div",FN,[a.createElementVNode("input",{type:"text",value:k.currentValue??"",placeholder:k.defaultValue,maxlength:k.maxLength,readonly:k.readonly,disabled:k.disabled,class:a.normalizeClass([{"zcode-field-error":f(k.fieldName)},"zcode-text-input"]),onInput:O=>M(k,O)},null,42,jN),f(k.fieldName)?(a.openBlock(),a.createElementBlock("div",UN,a.toDisplayString(f(k.fieldName)),1)):a.createCommentVNode("",!0),k.maxLength?(a.openBlock(),a.createElementBlock("div",HN,a.toDisplayString(String(k.currentValue??"").length)+" / "+a.toDisplayString(k.maxLength),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),k.type==="textarea"?(a.openBlock(),a.createElementBlock("div",WN,[a.createElementVNode("textarea",{value:k.currentValue??"",placeholder:k.defaultValue,maxlength:k.maxLength,readonly:k.readonly,disabled:k.disabled,class:a.normalizeClass([{"zcode-field-error":f(k.fieldName)},"zcode-textarea"]),rows:"4",onInput:O=>M(k,O)},null,42,GN),f(k.fieldName)?(a.openBlock(),a.createElementBlock("div",qN,a.toDisplayString(f(k.fieldName)),1)):a.createCommentVNode("",!0),k.maxLength?(a.openBlock(),a.createElementBlock("div",KN,a.toDisplayString(String(k.currentValue??"").length)+" / "+a.toDisplayString(k.maxLength),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),k.type==="rich"?(a.openBlock(),a.createElementBlock("div",JN,[a.createVNode(gN,{"model-value":k.currentValue??"",placeholder:k.defaultValue,"onUpdate:modelValue":O=>A(k,O)},null,8,["model-value","placeholder","onUpdate:modelValue"]),f(k.fieldName)?(a.openBlock(),a.createElementBlock("div",XN,a.toDisplayString(f(k.fieldName)),1)):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0),k.type==="radio"?(a.openBlock(),a.createElementBlock("div",YN,[a.createElementVNode("div",QN,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(k.options,O=>(a.openBlock(),a.createElementBlock("label",{key:O,class:"zcode-radio-item"},[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":G=>k.currentValue=G,type:"radio",name:k.fieldName,value:O,onChange:G=>y.$emit("save-field",k)},null,40,ZN),[[a.vModelRadio,k.currentValue]]),a.createElementVNode("span",eC,a.toDisplayString(O),1)]))),128))])])):a.createCommentVNode("",!0),k.type==="checkbox"?(a.openBlock(),a.createElementBlock("div",tC,[a.createElementVNode("div",nC,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(k.options,O=>(a.openBlock(),a.createElementBlock("label",{key:O,class:"zcode-checkbox-item"},[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":G=>k.currentValue=G,type:"checkbox",value:O,onChange:G=>y.$emit("save-field",k)},null,40,oC),[[a.vModelCheckbox,k.currentValue]]),a.createElementVNode("span",rC,a.toDisplayString(O),1)]))),128))])])):a.createCommentVNode("",!0),k.type==="select"?(a.openBlock(),a.createElementBlock("div",iC,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":O=>k.currentValue=O,class:"zcode-select",onChange:O=>y.$emit("save-field",k)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(k.options,O=>(a.openBlock(),a.createElementBlock("option",{key:O,value:O},a.toDisplayString(O),9,aC))),128))],40,sC),[[a.vModelSelect,k.currentValue]])])):a.createCommentVNode("",!0),k.type==="select-multiple"?(a.openBlock(),a.createElementBlock("div",lC,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":O=>k.currentValue=O,class:"zcode-select",multiple:"",size:Math.min(k.options?.length||3,5),onChange:O=>y.$emit("save-field",k)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(k.options,O=>(a.openBlock(),a.createElementBlock("option",{key:O,value:O},a.toDisplayString(O),9,dC))),128))],40,cC),[[a.vModelSelect,k.currentValue]])])):a.createCommentVNode("",!0),k.type==="tag"?(a.openBlock(),a.createElementBlock("div",uC,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":O=>k.currentValue=O,class:"zcode-select",onChange:O=>y.$emit("save-field",k)},[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(k.options,O=>(a.openBlock(),a.createElementBlock("option",{key:O,value:O},a.toDisplayString(O),9,pC))),128))],40,fC),[[a.vModelSelect,k.currentValue]]),a.createElementVNode("div",hC,[E[4]||(E[4]=a.createTextVNode(" 現在のタグ: ",-1)),a.createElementVNode("code",null,"<"+a.toDisplayString(k.currentValue)+">",1)])])):a.createCommentVNode("",!0),k.type==="boolean"?(a.openBlock(),a.createElementBlock("div",mC,[a.createElementVNode("label",gC,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":O=>k.currentValue=O,type:"checkbox",onChange:O=>y.$emit("save-field",k)},null,40,bC),[[a.vModelCheckbox,k.currentValue]]),a.createElementVNode("span",yC,a.toDisplayString(k.label)+"を表示",1)])])):a.createCommentVNode("",!0),k.type==="image"?(a.openBlock(),a.createElementBlock("div",xC,[a.createElementVNode("div",EC,[a.createElementVNode("button",{class:"zcode-image-select-btn",onClick:O=>m(k)},[a.createVNode(a.unref(Rc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(k.currentValue?y.$t("editPanel.replaceImage"):y.$t("editPanel.selectImage")),1)],8,kC),k.currentValue?(a.openBlock(),a.createElementBlock("button",{key:0,class:"zcode-image-clear-btn",title:y.$t("editPanel.clearImageTitle"),onClick:O=>g(k)},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(y.$t("editPanel.clearImage")),1)],8,wC)):a.createCommentVNode("",!0)]),T(k.currentValue)?(a.openBlock(),a.createElementBlock("div",SC,[a.createElementVNode("img",{src:T(k.currentValue)||"",alt:k.label,class:"zcode-image-preview-img"},null,8,NC)])):a.createCommentVNode("",!0)])):a.createCommentVNode("",!0)]))),128))])):!i.value||s.value.length===0?(a.openBlock(),a.createElementBlock("div",CC,[a.createElementVNode("div",vC,a.toDisplayString(y.$t("editPanel.id",{id:t.editingComponent.id})),1),a.createElementVNode("div",TC," Type: "+a.toDisplayString(t.editingComponent.type),1)])):a.createCommentVNode("",!0),a.createVNode(IN,{"is-open":p.value,"images-common":t.imagesCommon,"images-individual":t.imagesIndividual,"images-special":t.imagesSpecial,"current-value":h.value?.currentValue||void 0,"onUpdate:modelValue":x,onAddImage:v,onDeleteImage:w,onClose:b},null,8,["is-open","images-common","images-individual","images-special","current-value"])])):a.createCommentVNode("",!0)}}),_C={class:"zcode-delete-panel-header"},AC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},MC=["aria-label"],IC={key:0,class:"zcode-parent-selector"},OC={class:"zcode-delete-panel-content"},DC={class:"zcode-delete-warning"},RC={class:"zcode-delete-warning-text"},PC={class:"zcode-delete-actions"},LC=a.defineComponent({__name:"DeletePanel",props:{deleteConfirmComponent:{type:[Object,null]},currentMode:{type:String},canSelectParent:{type:Boolean}},emits:["confirm","cancel","select-parent"],setup(t){return(e,n)=>t.deleteConfirmComponent&&t.currentMode==="delete"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-delete-panel",onClick:n[4]||(n[4]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",_C,[a.createElementVNode("div",AC,a.toDisplayString(e.$t("deletePanel.title")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":e.$t("common.close"),onClick:n[0]||(n[0]=o=>e.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:18})],8,MC)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",IC,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:n[1]||(n[1]=o=>e.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("deletePanel.selectParent")),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",OC,[a.createElementVNode("div",DC,[a.createVNode(a.unref(Vc),{size:20,class:"zcode-delete-warning-icon"}),a.createElementVNode("div",RC,a.toDisplayString(e.$t("deletePanel.confirmMessage")),1)]),a.createElementVNode("div",PC,[a.createElementVNode("button",{class:"zcode-btn-danger",onClick:n[2]||(n[2]=o=>e.$emit("confirm"))},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("common.delete")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel",onClick:n[3]||(n[3]=o=>e.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("common.cancel")),1)])])])])):a.createCommentVNode("",!0)}}),$C={class:"zcode-reorder-panel-header"},VC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},BC=["aria-label"],FC={key:0,class:"zcode-parent-selector"},jC={class:"zcode-reorder-panel-content"},UC={class:"zcode-reorder-panel-content-text"},HC={class:"zcode-reorder-source"},WC=a.defineComponent({__name:"ReorderPanel",props:{reorderSourcePath:{type:String},currentMode:{type:String},canSelectParent:{type:Boolean}},emits:["cancel","select-parent"],setup(t){return(e,n)=>t.reorderSourcePath&&t.currentMode==="reorder"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-reorder-panel",onClick:n[2]||(n[2]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",$C,[a.createElementVNode("div",VC,a.toDisplayString(e.$t("reorderPanel.title")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":e.$t("common.close"),onClick:n[0]||(n[0]=o=>e.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:18})],8,BC)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",FC,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:n[1]||(n[1]=o=>e.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(e.$t("reorderPanel.selectParent")),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",jC,[a.createElementVNode("div",UC,a.toDisplayString(e.$t("reorderPanel.instruction")),1),a.createElementVNode("div",HC,a.toDisplayString(e.$t("reorderPanel.source",{path:t.reorderSourcePath})),1)])])):a.createCommentVNode("",!0)}}),GC={class:"zcode-add-panel-header"},qC={class:"zcode-panel-header-title",role:"heading","aria-level":"3"},KC=["aria-label"],JC={key:0,class:"zcode-parent-selector"},XC={class:"zcode-part-category-tabs"},YC=["onClick"],QC={key:1,class:"zcode-type-tabs"},ZC=["onClick"],ev={class:"zcode-add-panel-content"},tv={class:"zcode-part-list"},nv={class:"zcode-part-type-section"},ov={class:"zcode-type-section-title",role:"heading","aria-level":"3"},rv={class:"zcode-type-section-description"},iv={key:0,class:"zcode-module-buttons"},sv={class:"zcode-module-preview-header"},av={class:"zcode-module-preview-label zcode-module-preview-label-header"},lv=["aria-label"],cv=["innerHTML"],dv={key:1,class:"zcode-empty-parts"},uv={class:"zcode-empty-parts-text"},fv={class:"zcode-type-section-title",role:"heading","aria-level":"3"},pv={key:0,class:"zcode-type-section-description"},hv={class:"zcode-module-buttons"},mv=["onClick"],gv={class:"zcode-module-preview-header"},bv={class:"zcode-module-preview-label zcode-module-preview-label-header"},yv=["aria-label","onClick"],xv=["innerHTML"],Ev={key:0,class:"zcode-empty-parts"},kv={class:"zcode-empty-parts-text"},wv={key:2,class:"zcode-insert-position"},Sv={class:"zcode-insert-header"},Nv={class:"zcode-keep-adding-label zcode-keep-adding-label-position"},Cv=["checked"],vv={class:"zcode-insert-buttons"},Tv={class:"zcode-preview-modal-header"},zv={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},_v=["innerHTML"],Av=a.defineComponent({__name:"AddPanel",props:{addTargetPath:{type:[String,null]},addPartCategory:{type:String},addTypeTab:{type:[String,null]},addSelectedPart:{type:[Object,null]},addSelectedType:{type:[Object,null]},clickedComponent:{type:[Object,null]},availablePartTypes:{type:Array},groupedPartsByType:{type:Array},canSelectParent:{type:Boolean},getPartPreviewHtml:{type:Function},getClickedComponentPreviewHtml:{type:Function},keepAdding:{type:Boolean},hasSpecialParts:{type:Boolean},config:{type:Object}},emits:["cancel","select-parent","category-tab-click","type-tab-click","select-part","confirm-add","update-keep-adding"],setup(t){const e=t,n=a.computed(()=>e.config?.categoryOrder||"common"),o=a.computed(()=>{const d=[];return n.value==="individual"?(d.push("individual","common"),e.hasSpecialParts&&d.push("special")):n.value==="special"?(e.hasSpecialParts&&d.push("special"),d.push("common","individual")):(d.push("common","individual"),e.hasSpecialParts&&d.push("special")),d}),r=a.ref(!1),i=a.ref(null);function s(d,u){i.value={type:d,part:u,isActiveParts:!1},r.value=!0}function l(){e.addSelectedType&&e.addSelectedPart&&(i.value={type:e.addSelectedType,part:e.addSelectedPart,isActiveParts:!0},r.value=!0)}function c(){r.value=!1,i.value=null}return(d,u)=>t.addTargetPath?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-add-panel",onClick:u[9]||(u[9]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",GC,[a.createElementVNode("div",qC,a.toDisplayString(d.$t("addPanel.title")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":d.$t("common.close"),onClick:u[0]||(u[0]=f=>d.$emit("cancel"))},[a.createVNode(a.unref(Qe),{size:18})],8,KC)]),t.canSelectParent?(a.openBlock(),a.createElementBlock("div",JC,[a.createElementVNode("button",{class:"zcode-parent-select-btn",onClick:u[1]||(u[1]=f=>d.$emit("select-parent"))},[a.createVNode(a.unref(si),{size:16}),a.createElementVNode("span",null,a.toDisplayString(d.$t("addPanel.selectParent")),1)])])):a.createCommentVNode("",!0),a.createElementVNode("div",XC,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(o.value,f=>(a.openBlock(),a.createElementBlock("button",{key:f,class:a.normalizeClass([{active:t.addPartCategory===f&&t.addTypeTab!=="selected"},"zcode-category-tab"]),onClick:p=>d.$emit("category-tab-click",f)},a.toDisplayString(f==="common"?d.$t("addPanel.category.common"):f==="individual"?d.$t("addPanel.category.individual"):d.$t("dataViewer.special")),11,YC))),128)),a.createElementVNode("button",{class:a.normalizeClass([{active:t.addTypeTab==="selected"},"zcode-category-tab"]),onClick:u[2]||(u[2]=f=>d.$emit("type-tab-click","selected"))},a.toDisplayString(d.$t("addPanel.category.selected")),3)]),t.availablePartTypes.length>0&&t.addTypeTab!=="selected"?(a.openBlock(),a.createElementBlock("div",QC,[a.createElementVNode("button",{class:a.normalizeClass([{active:t.addTypeTab==="all"},"zcode-type-tab"]),onClick:u[3]||(u[3]=f=>d.$emit("type-tab-click","all"))}," all ",2),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.availablePartTypes,f=>(a.openBlock(),a.createElementBlock("button",{key:f,class:a.normalizeClass([{active:t.addTypeTab===f},"zcode-type-tab"]),onClick:p=>d.$emit("type-tab-click",f)},a.toDisplayString(f),11,ZC))),128))])):a.createCommentVNode("",!0),a.createElementVNode("div",ev,[a.createElementVNode("div",tv,[a.withDirectives(a.createElementVNode("div",nv,[a.createElementVNode("div",ov,a.toDisplayString(d.$t("addPanel.activeParts")),1),a.createElementVNode("div",rv,a.toDisplayString(d.$t("addPanel.activePartsDescription")),1),t.clickedComponent&&t.addSelectedPart&&t.addSelectedType?(a.openBlock(),a.createElementBlock("div",iv,[a.createElementVNode("div",{class:a.normalizeClass([{active:!0},"zcode-module-preview"])},[a.createElementVNode("div",sv,[a.createElementVNode("div",av,a.toDisplayString(d.$t("addPanel.activeParts")),1),a.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:u[4]||(u[4]=a.withModifiers(f=>l(),["stop"]))},[a.createVNode(a.unref(Bc),{size:14})],8,lv)]),a.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:t.getClickedComponentPreviewHtml()},null,8,cv)])])):(a.openBlock(),a.createElementBlock("div",dv,[a.createElementVNode("div",uv,a.toDisplayString(d.$t("addPanel.clickPartInPreview")),1)]))],512),[[a.vShow,t.addTypeTab==="selected"]]),a.withDirectives(a.createElementVNode("div",null,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(t.groupedPartsByType,f=>(a.openBlock(),a.createElementBlock("div",{key:f.type,class:"zcode-part-type-section"},[a.createElementVNode("div",fv,a.toDisplayString(f.type),1),f.description?(a.openBlock(),a.createElementBlock("div",pv,a.toDisplayString(f.description),1)):a.createCommentVNode("",!0),a.createElementVNode("div",hv,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(f.parts,p=>(a.openBlock(),a.createElementBlock("div",{key:p.title,class:a.normalizeClass([{active:t.addTypeTab==="selected"&&t.clickedComponent?.part_id===p.id&&t.clickedComponent?.id?!0:t.addTypeTab!=="selected"&&t.addSelectedPart?.id===p.id},"zcode-module-preview"]),onClick:h=>d.$emit("select-part",f.typeData,p)},[a.createElementVNode("div",gv,[a.createElementVNode("div",bv,a.toDisplayString(p.title),1),a.createElementVNode("button",{type:"button",class:"zcode-module-preview-icon-btn","aria-label":d.$t("common.preview"),onClick:a.withModifiers(h=>s(f.typeData,p),["stop"])},[a.createVNode(a.unref(Bc),{size:14})],8,yv)]),a.createElementVNode("div",{class:"zcode-module-preview-content",innerHTML:t.getPartPreviewHtml(f.typeData,p)},null,8,xv)],10,mv))),128))])]))),128)),t.groupedPartsByType.length===0&&!t.addSelectedPart?(a.openBlock(),a.createElementBlock("div",Ev,[a.createElementVNode("div",kv,a.toDisplayString(d.$t("addPanel.noPartsAvailable")),1)])):a.createCommentVNode("",!0)],512),[[a.vShow,t.addTypeTab!=="selected"]])])]),t.addSelectedPart?(a.openBlock(),a.createElementBlock("div",wv,[a.createElementVNode("div",Sv,[u[10]||(u[10]=a.createElementVNode("div",{class:"zcode-insert-position-title",role:"heading","aria-level":"4"}," 追加位置を選択 ",-1)),a.createElementVNode("label",Nv,[a.createElementVNode("input",{type:"checkbox",checked:t.keepAdding,class:"zcode-keep-adding-checkbox",onChange:u[5]||(u[5]=f=>d.$emit("update-keep-adding",f.target.checked))},null,40,Cv),a.createElementVNode("span",null,a.toDisplayString(d.$t("addPanel.continueAdding")),1)])]),a.createElementVNode("div",vv,[a.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-before",onClick:u[6]||(u[6]=f=>d.$emit("confirm-add","before"))},a.toDisplayString(d.$t("addPanel.addBefore")),1),a.createElementVNode("button",{class:"zcode-insert-btn zcode-insert-after",onClick:u[7]||(u[7]=f=>d.$emit("confirm-add","after"))},a.toDisplayString(d.$t("addPanel.addAfter")),1)])])):a.createCommentVNode("",!0),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[r.value&&i.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:c},[a.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:u[8]||(u[8]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",Tv,[a.createElementVNode("div",zv,a.toDisplayString(d.$t("common.preview"))+": "+a.toDisplayString(i.value.isActiveParts?d.$t("addPanel.activeParts"):i.value.part.title),1),a.createElementVNode("button",{class:"zcode-close-btn",onClick:c},[a.createVNode(a.unref(Qe),{size:18})])]),a.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:i.value.isActiveParts?t.getClickedComponentPreviewHtml():t.getPartPreviewHtml(i.value.type,i.value.part)},null,8,_v)])])):a.createCommentVNode("",!0)]))])):a.createCommentVNode("",!0)}}),Mv=a.defineComponent({__name:"ContextMenu",props:{isVisible:{type:Boolean},position:{type:Object},currentMode:{type:String}},emits:["select-mode","close"],setup(t,{emit:e}){const n=e;function o(i){n("select-mode",i),n("close")}function r(){n("close")}return(i,s)=>t.isVisible?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-context-menu",style:a.normalizeStyle({left:`${t.position.x}px`,top:`${t.position.y}px`}),onClick:s[4]||(s[4]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="edit"}]),onClick:s[0]||(s[0]=l=>o("edit"))},[a.createVNode(a.unref(Pc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.edit")),1)],2),a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="add"}]),onClick:s[1]||(s[1]=l=>o("add"))},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.add")),1)],2),a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="reorder"}]),onClick:s[2]||(s[2]=l=>o("reorder"))},[a.createVNode(a.unref(ir),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.reorder")),1)],2),a.createElementVNode("button",{class:a.normalizeClass(["zcode-context-menu-item",{active:t.currentMode==="delete"}]),onClick:s[3]||(s[3]=l=>o("delete"))},[a.createVNode(a.unref(Bn),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.delete")),1)],2),s[5]||(s[5]=a.createElementVNode("div",{class:"zcode-context-menu-divider"},null,-1)),a.createElementVNode("button",{class:"zcode-context-menu-item",onClick:r},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(i.$t("contextMenu.close")),1)])],4)):a.createCommentVNode("",!0)}});function Iv(t){if(t.defaultValue!==void 0&&t.defaultValue!=="")switch(t.type){case"rich":return`<p>${t.defaultValue}</p>`;case"image":return t.defaultValue;default:return t.defaultValue}switch(t.type){case"text":case"textarea":return"";case"rich":return"<p></p>";case"radio":case"select":return t.options?.[0]||"";case"checkbox":case"select-multiple":return[];case"boolean":return!0;case"image":return"";default:return""}}function Ov(t,e){const n=ha(t.part_id,e);if(!n)return;Fn(n.body).forEach(r=>{r.optional||t[r.fieldName]===void 0&&(t[r.fieldName]=Iv(r))})}function Dv(t){function e(n){Ov(n,t.parts),n.slots&&Object.values(n.slots).forEach(o=>{(Array.isArray(o)?o:o?.children||[]).forEach(i=>{e(i)})})}t.page.forEach(n=>{e(n)})}function km(t){const e=a.reactive({page:[],css:{common:void 0,individual:void 0,special:void 0},parts:{common:[],individual:[],special:[]},images:{common:[],individual:[],special:[]},backendData:void 0});function n(){try{const i=t.page?JSON.parse(t.page):[],s=t.partsCommon?JSON.parse(t.partsCommon):[],l=t.partsIndividual?JSON.parse(t.partsIndividual):[],c=t.partsSpecial?JSON.parse(t.partsSpecial):[],d=t.imagesCommon?JSON.parse(t.imagesCommon):[],u=t.imagesIndividual?JSON.parse(t.imagesIndividual):[],f=t.imagesSpecial?JSON.parse(t.imagesSpecial):[],p=t.cssCommon!==void 0?t.cssCommon:void 0,h=t.cssIndividual!==void 0?t.cssIndividual:void 0,m=t.cssSpecial!==void 0?t.cssSpecial:void 0,b=t.backendData?JSON.parse(t.backendData):void 0;Object.assign(e,{page:i,css:{common:p,individual:h,special:m},parts:{common:s,individual:l,special:c},images:{common:d,individual:u,special:f},backendData:b}),Dv(e)}catch(i){console.error("Failed to parse props:",i)}}function o(i){if(!i)return e;const s=i.split(".");let l=e;for(const c of s)if(l==null||typeof l!="object"||(l=l[c],l===void 0))return;return l}function r(i,s){if(typeof i=="string"){const l=i.split(".");let c=e;for(let d=0;d<l.length-1;d++){const u=c[l[d]];if(u==null||typeof u!="object")return;c=u}c[l[l.length-1]]=s}else Object.assign(e,i)}return{cmsData:e,loadDataFromProps:n,getData:o,setData:r}}function Rv(){const t=a.ref("edit"),e=a.ref(!1);function n(o){t.value=o}return{currentMode:t,switchMode:n,allowDynamicContentInteraction:e}}function wm(t){const e=document.documentElement,o={edit:"--zcode-color-edit",add:"--zcode-color-add",reorder:"--zcode-color-reorder",delete:"--zcode-color-delete"}[t]||"--zcode-color-edit";return getComputedStyle(e).getPropertyValue(o).trim()||"#3b82f6"}function Yt(t,e){const n=wm(e);t.classList.remove("zcode-outline-active-edit","zcode-outline-active-add","zcode-outline-active-reorder","zcode-outline-active-delete"),t.classList.add(`zcode-outline-active-${e}`),t.style.outlineColor=n,t.style.outlineStyle="solid"}function Qt(t){t.style.outline="",t.style.outlineOffset="",t.classList.remove("zcode-outline-active-edit","zcode-outline-active-add","zcode-outline-active-reorder","zcode-outline-active-delete")}function wc(t,e){const n=wm(e);t.style.outline=`2px dashed ${n}`,t.style.outlineOffset="2px"}function yn(t){t.style.outline="",t.style.outlineOffset=""}function Pv(t,e){const n=a.ref(null),o=a.ref(-1),r=a.ref(""),i=a.ref([]);function s(u){const f=u.part_id,p=t.parts,h=[...p.common,...p.individual];let m=null;for(const g of h){const x=g.parts.find(v=>v.id===f);if(x){m=x;break}}return m?Fn(m.body).map(g=>{const x={fieldName:g.fieldName,groupName:g.groupName,label:Pg(g.fieldName),required:g.required,maxLength:g.maxLength,readonly:g.readonly,disabled:g.disabled};if(g.type==="text")return{...x,type:"text",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue};if(g.type==="textarea")return{...x,type:"textarea",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue||""};if(g.type==="rich")return{...x,type:"rich",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue||""};if(g.type==="radio")return{...x,type:"radio",options:g.options,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.options?.[0]};if(g.type==="boolean")return{...x,type:"boolean",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:!0};if(g.type==="image")return{...x,type:"image",defaultValue:g.defaultValue,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.defaultValue||""};if(g.type==="select")return{...x,type:"select",options:g.options,optional:g.optional,currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.optional?void 0:g.options?.[0]};if(g.type==="select-multiple")return{...x,type:"select-multiple",options:g.options,optional:g.optional,currentValue:Array.isArray(u[g.fieldName])?u[g.fieldName]:[]};if(g.type==="tag"){const v=["h1","h2","h3","h4","h5","h6","div","p","span","li","ul","ol","section","article","aside","nav","header","footer","main","figure","figcaption","blockquote","pre","code","table","thead","tbody","tr","th","td"],w=g.options||v;return{...x,type:"tag",options:w,defaultValue:g.defaultValue||"div",currentValue:u[g.fieldName]!==void 0?u[g.fieldName]:g.defaultValue||"div"}}else return{...x,type:"checkbox",options:g.options,optional:g.optional,currentValue:Array.isArray(u[g.fieldName])?u[g.fieldName]:[]}}):[]}function l(u,f){if(r.value===u){d();return}const p=u.split(".");let h=-1;if(p[0]==="page"&&p.length>=2&&(h=parseInt(p[1])),r.value&&e.value){const m=e.value.querySelector(`[data-zcode-path="${r.value}"]`);m&&Qt(m)}n.value=f,o.value=h,r.value=u,i.value=s(f),a.nextTick(()=>{if(e.value&&r.value===u){const m=e.value.querySelector(`[data-zcode-path="${u}"]`);m&&(Yt(m,"edit"),ar(m))}})}function c(u){if(n.value&&r.value){const f=dn(r.value,t);f&&(u.optional&&(u.currentValue===""||u.currentValue===null)?f[u.fieldName]=void 0:f[u.fieldName]=u.currentValue)}}function d(){if(r.value&&e.value){const u=e.value.querySelector(`[data-zcode-path="${r.value}"]`);u&&Qt(u)}n.value=null,r.value="",i.value=[]}return{editingComponent:n,editingComponentIndex:o,editingComponentPath:r,editingAvailableFields:i,handleEditClick:l,saveFieldEdit:c,closeEditPanel:d}}function Lv(t,e,n,o){const r=a.ref(null),i=a.ref(null),s=a.ref(null),l=a.ref(o?.categoryOrder==="individual"?"individual":o?.categoryOrder==="special"?"special":"common"),c=a.ref("all"),d=a.ref(null),u=a.ref(!1);function f(z){if(z.includes(".slots.")){const R=z.split(".");let W=-1;for(let H=R.length-1;H>=0;H--)if(R[H]==="slots"){W=H;break}if(W!==-1&&W+1<R.length)return R.slice(0,W+2).join(".")}return z}const p=a.computed(()=>{const z=t.parts,R=l.value==="common"?z.common:l.value==="individual"?z.individual:z.special;if(r.value&&r.value.includes(".slots.")){const H=[...z.common,...z.individual,...z.special],L=f(r.value);return b(L,H,R)}return[...new Set(R.map(H=>H.type))]});function h(z,R){const W=z.split(".");let H=-1;for(let Y=W.length-1;Y>=0;Y--)if(W[Y]==="slots"){H=Y;break}if(H===-1)return null;const L=W.slice(0,H).join("."),j=W[H+1],Z=dn(L,t);if(!Z)return null;const K=Z.part_id;let ae=null;for(const Y of R)if(Y.parts.some(J=>J.id===K)){ae=Y;break}if(!ae)return null;const X=(ae.parts.find(Y=>Y.id===K)||ae.parts[0])?.slots?.[j];if(X){const Y=X.allowedParts;if(Y&&Array.isArray(Y))return Y}return null}const m=a.computed(()=>{const z=t.parts,R=l.value==="common"?z.common:l.value==="individual"?z.individual:z.special,W=p.value;let H=R.filter(K=>W.includes(K.type));c.value&&c.value!=="all"&&c.value!=="selected"&&(H=H.filter(K=>K.type===c.value));const L=[...z.common,...z.individual],j=r.value&&r.value.includes(".slots.")?h(f(r.value),L):null,Z=new Map;return H.forEach(K=>{Z.has(K.type)||Z.set(K.type,{type:K,parts:[]});const ae=Z.get(K.type);j!==null?j.length>0&&K.parts.forEach(ee=>{j.includes(ee.id)&&ae.parts.push(ee)}):K.parts.forEach(ee=>{ee.slotOnly||ae.parts.push(ee)})}),Array.from(Z.values()).map(K=>({type:K.type.type,description:K.type.description,typeData:K.type,parts:K.parts}))});function b(z,R,W){const H=z.split(".");let L=-1;for(let J=H.length-1;J>=0;J--)if(H[J]==="slots"){L=J;break}if(L===-1)return[...new Set(W.map(J=>J.type))];const j=H.slice(0,L).join("."),Z=H[L+1],K=dn(j,t);if(!K)return[...new Set(W.map(J=>J.type))];const ae=K.part_id;let ee=null,X=null;for(const J of R){const Q=J.parts.find(de=>de.id===ae);if(Q){ee=J,X=Q;break}}if(!ee||!X)return[...new Set(W.map(J=>J.type))];const Y=X?.slots?.[Z];if(Y){const J=Y.allowedParts;if(J&&Array.isArray(J)){const Q=new Set;R.forEach(ke=>{ke.parts.forEach(Te=>{J.includes(Te.id)&&Q.add(ke.type)})});let de=Array.from(Q);return de=de.filter(ke=>W.some(Te=>Te.type===ke)),de}}return[...new Set(W.map(J=>J.type))]}function g(z,R=!1){if(r.value===z){O();return}if(r.value&&e.value){const de=e.value.querySelector(`[data-zcode-path="${r.value}"]`);de&&Qt(de);const ke=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);ke&&Qt(ke)}r.value=z,c.value="all",l.value="common",i.value=null,s.value=null;const W=dn(z,t);W&&W.part_id?d.value=W:d.value=null;const H=t.parts,L=H.common,j=H.individual,Z=H.special;let K=[],ae=[];if(z.includes(".slots.")){const de=[...L,...j,...Z],ke=f(z);K=b(ke,de,L),ae=b(ke,de,j)}else K=[...new Set(L.map(de=>de.type))],ae=[...new Set(j.map(de=>de.type))];const ee=K.length>0,X=ae.length>0,Y=Z.length>0,J=o?.categoryOrder;let Q;J==="special"&&Y?Q="special":J==="individual"&&X?Q="individual":J==="common"&&ee||ee?Q="common":X?Q="individual":Y?Q="special":Q="common",l.value=Q,a.nextTick(()=>{if(e.value&&r.value===z){const de=e.value.querySelector(`[data-zcode-path="${z}"]`);if(de)Yt(de,"add"),ar(de);else{const ke=f(z);if(ke!==z){const Te=e.value.querySelector(`[data-zcode-slot-path="${ke}"]`);Te&&(Yt(Te,"add"),ar(Te))}}}})}function x(z){l.value=z,c.value="all",i.value=null,s.value=null,u.value=!1}function v(z){if(c.value=z,z==="selected"&&d.value&&d.value.part_id){const R=t.parts,W=[...R.common,...R.individual,...R.special];for(const H of W){const L=H.parts.find(j=>j.id===d.value.part_id);if(L){i.value=H,s.value=L;break}}}else z!=="selected"&&(i.value=null,s.value=null);u.value=!1}function w(z,R){const W=M(z,R);return n(W,"")}function T(){return d.value?n(d.value,""):""}function M(z,R){const W=y(z,!1,new Set,R.id);return W.id="preview",W}function A(z,R){if(s.value?.id===R.id){i.value=null,s.value=null;return}i.value=z,s.value=R,c.value==="selected"&&(c.value="all"),u.value=!1}function y(z,R=!1,W=new Set,H){const L=H?z.parts.find(X=>X.id===H)||z.parts[0]:R&&s.value?s.value:z.parts[0];if(!L)throw new Error(`Part not found for type: ${z.type}`);const j=`${z.id}:${L.id}`;if(W.has(j)){const X=Fn(L.body),Y={};return X.forEach(J=>{J.optional?Y[J.fieldName]=void 0:J.type==="text"?Y[J.fieldName]=J.defaultValue:J.type==="radio"?Y[J.fieldName]=J.options?.[0]:J.type==="checkbox"?Y[J.fieldName]=[]:J.type==="boolean"?Y[J.fieldName]=!0:J.type==="rich"?Y[J.fieldName]=J.defaultValue?`<p>${J.defaultValue}</p>`:"<p></p>":J.type==="image"&&(Y[J.fieldName]=J.defaultValue||"")}),{id:jn(),part_id:L.id,...Y}}W.add(j);const Z=Fn(L.body),K={};Z.forEach(X=>{X.optional?K[X.fieldName]=void 0:X.type==="text"?K[X.fieldName]=X.defaultValue:X.type==="radio"?K[X.fieldName]=X.options?.[0]:X.type==="checkbox"?K[X.fieldName]=[]:X.type==="boolean"?K[X.fieldName]=!0:X.type==="rich"?K[X.fieldName]=X.defaultValue?`<p>${X.defaultValue}</p>`:"<p></p>":X.type==="image"&&(K[X.fieldName]=X.defaultValue||"")});const ae={id:jn(),part_id:L.id,...K},ee=L.slots;if(ee){const X={};Object.entries(ee).forEach(([Y,J])=>{const Q=J.allowedParts;if(Q&&Q.length===1){const de=Q[0],ke=t.parts,Te=[...ke.common,...ke.individual,...ke.special];let $e=null,N=null;for(const P of Te){const V=P.parts.find(S=>S.id===de);if(V){$e=P,N=V;break}}if($e&&N){const P=y($e,!1,W,N.id);X[Y]=[P]}else X[Y]=[]}else X[Y]=[]}),Object.keys(X).length>0&&(ae.slots=X)}return ae}function E(z){return y(z,!0)}function k(z){if(!i.value||!s.value||!r.value){console.error("Missing required values:",{addSelectedType:i.value,addSelectedPart:s.value,addTargetPath:r.value});return}let R;if(c.value==="selected"&&d.value){if(R=JSON.parse(JSON.stringify(d.value)),R.id=jn(),R.slots){const L=j=>{j.forEach(Z=>{Z.id=jn(),Z.slots&&Object.values(Z.slots).forEach(K=>{Array.isArray(K)?L(K):K&&typeof K=="object"&&K.children&&L(K.children||[])})})};Object.values(R.slots).forEach(j=>{Array.isArray(j)?L(j):j&&typeof j=="object"&&j.children&&L(j.children||[])})}}else R=E(i.value);const W=r.value,H=W.split(".");if(H[0]==="page"&&H.length===2){const L=parseInt(H[1]);z==="before"?(t.page.splice(L,0,R),u.value&&(r.value=`page.${L+1}`)):t.page.splice(L+1,0,R)}else if(H.includes("slots")){const L=f(W),j=L.split(".");let Z=-1;for(let Q=j.length-1;Q>=0;Q--)if(j[Q]==="slots"){Z=Q;break}if(Z===-1||Z>=j.length-1){console.error("Invalid slot path:",L);return}const K=j.slice(0,Z).join("."),ae=j[Z+1],ee=W!==L?parseInt(H[H.length-1]):-1,X=dn(K,t);if(!X){console.error("Parent component not found:",K);return}X.slots||(X.slots={});const Y=X.slots[ae];let J=[];if(Array.isArray(Y)?J=Y:Y&&typeof Y=="object"&&Y.children?(J=Y.children||[],Y.children||(Y.children=[])):(X.slots[ae]=[],J=X.slots[ae]),ee===-1)J.push(R);else if(z==="before"){if(J.splice(ee,0,R),u.value){const Q=f(W);if(W!==Q){const de=[...H];de[de.length-1]=String(ee+1),r.value=de.join(".")}else{const ke=[...Q.split(".")];ke.push("0"),r.value=ke.join(".")}}}else J.splice(ee+1,0,R);Array.isArray(X.slots[ae])||(X.slots[ae].children=J)}if(d.value||c.value==="selected"&&(c.value="all"),!u.value)O();else if(z==="before"&&e.value&&r.value){const L=e.value.querySelector(`[data-zcode-path="${W}"]`);L&&Qt(L),a.nextTick(()=>{if(e.value&&r.value){const j=e.value.querySelector(`[data-zcode-path="${r.value}"]`);j&&Yt(j,"add")}})}}function O(){if(r.value&&e.value){const z=e.value.querySelector(`[data-zcode-path="${r.value}"]`);z&&Qt(z);const R=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);R&&Qt(R)}r.value=null,i.value=null,s.value=null,d.value=null,l.value="common",c.value="all",u.value=!1}const G=a.computed(()=>t.parts.special.length>0);return{addTargetPath:r,addSelectedType:i,addSelectedPart:s,clickedComponent:d,addPartCategory:l,addTypeTab:c,keepAdding:u,availablePartTypes:p,groupedPartsByType:m,hasSpecialParts:G,handleAddClick:g,handleCategoryTabClick:x,handleTypeTabClick:v,selectPart:A,getPartPreviewHtml:w,getClickedComponentPreviewHtml:T,confirmAddPart:k,cancelAdd:O}}function $v(t,e,n,o){const r=a.ref(null),i=a.ref("");function s(f,p){if(i.value===f){u();return}if(i.value&&e.value){const h=e.value.querySelector(`[data-zcode-path="${i.value}"]`);h&&Qt(h)}r.value=p,i.value=f,o(()=>{if(e.value&&i.value===f){const h=e.value.querySelector(`[data-zcode-path="${f}"]`);h&&(Yt(h,"delete"),ar(h))}})}function l(){if(!i.value)return;const f=i.value,p=f.split(".");let h=null,m=null;if(p.length===2&&p[0]==="page"){const b=parseInt(p[1]);!isNaN(b)&&b>=0&&b<t.page.length&&(t.page.splice(b,1),t.page.length===0&&o(()=>{n("add")}))}else if(p.length>2&&p[0]==="page"){const b=parseInt(p[1]);if(isNaN(b)||b<0||b>=t.page.length){console.error("Invalid top-level index:",b),u();return}let g=t.page[b];const x=p.slice(2);x.length>=3&&x[0]==="slots"&&(m=x[1],h=`page.${b}`);for(let w=0;w<x.length-1;w++){if(!g||typeof g!="object"){console.error("Invalid path:",f),u();return}g=g[x[w]]}const v=x[x.length-1];if(g&&typeof g=="object")if(Array.isArray(g)){const w=parseInt(v);!isNaN(w)&&w>=0&&w<g.length?g.splice(w,1):console.error("Invalid array index:",v)}else v in g?delete g[v]:console.error("Field not found:",f);else console.error("Invalid current object:",f)}h&&m&&o(()=>{c(h,m)}),u()}function c(f,p){const h=dn(f,t);if(!h)return;const m=h.slots;if(!m||!Array.isArray(m[p]))return;const b=m[p];if(b.length===0){const g=h.part_id,x=t.parts,v=[...x.common,...x.individual];let w=null,T=null;for(const A of v){const y=A.parts.find(E=>E.id===g);if(y){w=A,T=y;break}}if(!w||!T)return;const M=T?.slots?.[p];if(M){const A=M.allowedParts;if(A&&A.length===1){const y=A[0];let E=null,k=null;for(const O of v){const G=O.parts.find(z=>z.id===y);if(G){E=O,k=G;break}}if(E&&k){const O=d(E,k.id);b.push(O)}}}}}function d(f,p){const h=p&&f.parts.find(v=>v.id===p)||f.parts[0];if(!h)throw new Error(`Part not found for type: ${f.type}`);const m=Fn(h.body),b={};m.forEach(v=>{v.optional?b[v.fieldName]=void 0:v.type==="text"?b[v.fieldName]=v.defaultValue:v.type==="radio"?b[v.fieldName]=v.options?.[0]:v.type==="checkbox"?b[v.fieldName]=[]:v.type==="boolean"?b[v.fieldName]=!0:v.type==="rich"?b[v.fieldName]=v.defaultValue?`<p>${v.defaultValue}</p>`:"<p></p>":v.type==="image"&&(b[v.fieldName]=v.defaultValue||"")});const g={id:jn(),part_id:h.id,...b},x=h.slots;if(x){const v={};Object.entries(x).forEach(([w,T])=>{const M=T.allowedParts;if(M&&M.length===1){const A=M[0],y=t.parts,E=[...y.common,...y.individual];let k=null,O=null;for(const G of E){const z=G.parts.find(R=>R.id===A);if(z){k=G,O=z;break}}if(k&&O){const G=d(k,O.id);v[w]=[G]}else v[w]=[]}else v[w]=[]}),Object.keys(v).length>0&&(g.slots=v)}return g}function u(){if(i.value&&e.value){const f=e.value.querySelector(`[data-zcode-path="${i.value}"]`);f&&Qt(f)}r.value=null,i.value=""}return{deleteConfirmComponent:r,deleteConfirmPath:i,handleDeleteClick:s,confirmDelete:l,cancelDelete:u}}function Vv(t,e){const n=a.ref("");function o(l,c){if(!l||!c)return!1;const d=l.split("."),u=c.split(".");if(d.length!==u.length||l===c)return!1;if(d.includes("slots")&&u.includes("slots")){let f=-1,p=-1;for(let x=d.length-1;x>=0;x--)if(d[x]==="slots"){f=x;break}for(let x=u.length-1;x>=0;x--)if(u[x]==="slots"){p=x;break}if(f===-1||p===-1)return!1;const h=d.slice(0,f).join("."),m=u.slice(0,p).join(".");if(h!==m)return!1;const b=d[f+1],g=u[p+1];return b===g}if(d.length>2){const f=d.slice(0,-1).join("."),p=u.slice(0,-1).join(".");if(f!==p)return!1}return!0}function r(l){if(!l)return;if(!n.value){const d=od(l);if(d&&e.value){const u=e.value.querySelector(`[data-zcode-path="${d}"]`);u&&yn(u)}if(n.value=l,e.value){const u=e.value.querySelector(`[data-zcode-path="${l}"]`);u&&(Yt(u,"reorder"),ar(u))}return}if(n.value===l){i();return}if(!o(n.value,l)){alert("この要素とは並べ替えできません。同じ階層の要素を選択してください。"),i();return}s(n.value,l)||alert("並べ替えに失敗しました。同じ階層の要素を選択してください。"),i()}function i(){if(n.value&&e.value){const l=e.value.querySelector(`[data-zcode-path="${n.value}"]`);l&&Qt(l)}n.value=""}function s(l,c){const d=l.split("."),u=c.split(".");if(d.length===2&&u.length===2&&d[0]==="page"&&u[0]==="page"){const f=parseInt(d[1]),p=parseInt(u[1]);if(!isNaN(f)&&!isNaN(p)&&f!==p){const h=[...t.page],[m]=h.splice(f,1);return h.splice(p,0,m),t.page=h,!0}return!1}else if(d.includes("slots")&&u.includes("slots")){let f=-1,p=-1;for(let y=d.length-1;y>=0;y--)if(d[y]==="slots"){f=y;break}for(let y=u.length-1;y>=0;y--)if(u[y]==="slots"){p=y;break}if(f===-1||p===-1)return!1;const h=d.slice(0,f).join("."),m=u.slice(0,p).join(".");if(h!==m)return!1;const b=d[f+1],g=u[p+1];if(b!==g)return!1;const x=parseInt(d[d.length-1]),v=parseInt(u[u.length-1]);if(isNaN(x)||isNaN(v)||x===v)return!1;const w=dn(h,t);if(!w||!w.slots||!w.slots[b])return!1;const T=w.slots[b];let M=[];if(Array.isArray(T))M=T;else if(T&&typeof T=="object"&&T.children)M=T.children||[];else return!1;const[A]=M.splice(x,1);return M.splice(v,0,A),!Array.isArray(T)&&typeof T=="object"&&T.children&&(T.children=M),!0}else if(d.length>2&&u.length>2){const f=d.slice(0,-1).join("."),p=u.slice(0,-1).join(".");if(f===p){const h=parseInt(d[d.length-1]),m=parseInt(u[u.length-1]);if(!isNaN(h)&&!isNaN(m)&&h!==m){const b=parseInt(d[1]);let g=t.page[b];for(let x=2;x<d.length-1;x++)g=g[d[x]];if(Array.isArray(g)){const[x]=g.splice(h,1);return g.splice(m,0,x),!0}}}}return!1}return{reorderSourcePath:n,handleReorderClick:r,canReorderWith:o,cancelReorder:i}}function Bv(t,e,n,o,r,i,s,l,c){const d=a.computed(()=>o.value?od(o.value):null),u=a.computed(()=>{if(!d.value)return!1;const p=dn(d.value,t);return p!=null});function f(){if(!d.value)return;const p=d.value;if(!e.value||!e.value.querySelector(`[data-zcode-path="${p}"]`))return;const m=dn(p,t);if(m){if(o.value&&e.value){const b=e.value.querySelector(`[data-zcode-path="${o.value}"]`);b&&yn(b)}switch(n.value){case"edit":r(p,m);break;case"add":i(p,!0);break;case"reorder":if(c.value){const b=e.value.querySelector(`[data-zcode-path="${c.value}"]`);b&&Qt(b),c.value=""}s(p);break;case"delete":l(p,m);break}}}return{parentPath:d,canSelectParent:u,selectParentElement:f}}function Fv(t,e,n,o,r,i,s,l,c,d,u,f,p,h){const m=new Map;function b(){if(!e.value)return;g();const x=e.value.querySelectorAll("[data-zcode-id]"),v=y=>{const E=y.target;if(!E)return;const k=E.closest("[data-zcode-add-slot]");if(!k)return;const O=k.closest("[data-zcode-slot-path]"),G=O?.getAttribute("data-zcode-slot-path");if(!G)return;y.preventDefault(),y.stopPropagation(),y.stopImmediatePropagation();const z=()=>{const R=e.value?.querySelector(`[data-zcode-slot-path="${G}"]`);R&&(yn(R),Yt(R,"add"))};if(O&&yn(O),n.value!=="add"){p("add"),a.nextTick(()=>{c(G),a.nextTick(()=>{z()})});return}z(),a.nextTick(()=>{c(G),a.nextTick(()=>{z()})})};let w=null;const T=y=>o.value===y||r.value===y||i.value===y||s.value===y,M=y=>{const k=y.target;if(!k)return;const O=k.closest("[data-zcode-slot-path]");if(!O){if(w){const z=w.getAttribute("data-zcode-slot-path")||"";(!z||!T(z))&&yn(w),w=null}return}if(w===O)return;if(w){const z=w.getAttribute("data-zcode-slot-path")||"";(!z||!T(z))&&yn(w)}w=O;const G=O.getAttribute("data-zcode-slot-path")||"";G&&!T(G)&&wc(O,n.value)},A=y=>{const E=y,k=E.target;if(!k)return;const O=E.relatedTarget,G=k.closest("[data-zcode-slot-path]");if(!G||O&&G.contains(O))return;const z=G.getAttribute("data-zcode-slot-path")||"";(!z||!T(z))&&yn(G),w===G&&(w=null)};e.value.addEventListener("click",v,!0),e.value.addEventListener("mouseover",M,!0),e.value.addEventListener("mouseout",A,!0),m.set(e.value,[{type:"click",listener:v,options:!0},{type:"mouseover",listener:M,options:!0},{type:"mouseout",listener:A,options:!0}]),x.forEach(y=>{const E=y,k=E.getAttribute("data-zcode-path");if(!k)return;const O=W=>{const H=W.target,j=H?.closest("[data-zcode-path]")?.getAttribute("data-zcode-path");if(j&&j!==k)return;H?.closest("a[href]")&&(h.value||W.preventDefault()),h.value||(W.stopPropagation(),W.stopImmediatePropagation());const K=dn(k,t);if(K)switch(yn(E),n.value){case"edit":l(k,K);break;case"add":c(k);break;case"reorder":if(i.value){const ae=i.value.split("."),ee=k.split(".");if(ae.length!==ee.length&&ae.indexOf("rows")!==-1){const Y=ee.indexOf("cells");if(Y!==-1){let J=-1;for(let Q=Y-1;Q>=0;Q--)if(ee[Q]==="slots"){J=Q;break}if(J!==-1){const Q=ee.slice(0,J).join(".");if(Q&&f(i.value,Q)){d(Q);return}}}}}d(k);break;case"delete":u(k,K);break}},G=W=>{if(o.value===W||r.value===W||i.value===W||s.value===W)return!0;if(W.includes(".slots.")){const L=W.split(".");let j=-1;for(let Z=L.length-1;Z>=0;Z--)if(L[Z]==="slots"){j=Z;break}if(j!==-1&&j+1<L.length){const Z=L.slice(0,j+2).join(".");return r.value===Z||o.value===Z||i.value===Z||s.value===Z}}return!1},z=()=>{G(k)||(n.value==="reorder"&&i.value?f(i.value,k)&&wc(E,n.value):wc(E,n.value)),n.value==="reorder"?E.style.cursor=i.value&&f(i.value,k)?"move":i.value?"not-allowed":"move":E.style.cursor="pointer"},R=()=>{G(k)||yn(E),E.style.cursor=""};E.addEventListener("click",O,!0),E.addEventListener("mouseenter",z),E.addEventListener("mouseleave",R),m.set(E,[{type:"click",listener:O,options:!0},{type:"mouseenter",listener:z},{type:"mouseleave",listener:R}])}),a.nextTick(()=>{a.nextTick(()=>{if(n.value==="edit"&&o.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${o.value}"]`);y&&Yt(y,"edit")}if(n.value==="add"&&r.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${r.value}"]`);if(y)Yt(y,"add");else{const E=e.value.querySelector(`[data-zcode-slot-path="${r.value}"]`);E&&Yt(E,"add")}}if(n.value==="reorder"&&i.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${i.value}"]`);y&&Yt(y,"reorder")}if(n.value==="delete"&&s.value&&e.value){const y=e.value.querySelector(`[data-zcode-path="${s.value}"]`);y&&Yt(y,"delete")}})})}function g(){m.forEach((x,v)=>{x.forEach(({type:w,listener:T,options:M})=>{v.removeEventListener(w,T,M)})}),m.clear()}return{setupClickHandlers:b,cleanupEventListeners:g}}function jv(t,e,n,o,r,i,s,l,c,d,u,f,p){function h(m){t.value&&t.value.querySelectorAll("[data-zcode-path], [data-zcode-slot-path]").forEach(g=>{Qt(g),yn(g)}),e.value==="edit"&&o.value?(l.value=null,o.value=""):e.value==="add"&&r.value?(r.value=null,c.value=null,d.value=null,u.value="common",f.value=null):e.value==="reorder"&&i.value?i.value="":e.value==="delete"&&s.value&&p(),n(m)}return{switchMode:h}}function Uv(t,e,n){const o=a.ref(!1),r=a.ref({x:0,y:0});function i(p){!e.value||!t.value||!p.target.closest("[data-zcode-path]")||(p.preventDefault(),p.stopPropagation(),r.value={x:p.clientX,y:p.clientY},o.value=!0)}function s(p){n(p),o.value=!1}function l(){o.value=!1}function c(p){p.target.closest(".zcode-context-menu")||l()}function d(p){p.target.closest(".zcode-context-menu")||l()}function u(){!t.value||!e.value||(t.value.addEventListener("contextmenu",i),document.addEventListener("click",c),document.addEventListener("contextmenu",d))}function f(){t.value&&(t.value.removeEventListener("contextmenu",i),document.removeEventListener("click",c),document.removeEventListener("contextmenu",d))}return{isVisible:o,position:r,handleModeSelect:s,closeMenu:l,setupContextMenu:u,cleanupContextMenu:f}}function Hv(t){const e=t;if(!e||!e.page||!Array.isArray(e.page))return!1;for(const n of e.page)if(!n.id||!n.part_id)return!1;return!0}function Sc(t,e){const n=[],o=(r,i)=>{Object.keys(r).forEach(s=>{s.includes("image")&&r[s]===t&&n.push({path:i,component:r,fieldName:s})}),r.slots&&Object.entries(r.slots).forEach(([s,l])=>{Array.isArray(l)&&l.forEach((c,d)=>{o(c,`${i}.slots.${s}.${d}`)})})};return e.forEach((r,i)=>{o(r,`page.${i}`)}),n}const Wv={key:0,class:"zcode-save-banner zcode-save-banner--error",role:"alert"},Gv={class:"zcode-save-banner-text"},qv=["aria-label"],Kv={key:1,class:"zcode-save-controls-fixed"},Jv={class:"zcode-save-confirm-dialog"},Xv={class:"zcode-save-confirm-dialog-header"},Yv={class:"zcode-save-confirm-dialog-title"},Qv={class:"zcode-save-confirm-dialog-body"},Zv={class:"zcode-save-confirm-dialog-footer"},Hs=a.defineComponent({__name:"ZeroCodeCMS",props:{locale:{type:String},page:{type:String},cssCommon:{type:String},cssIndividual:{type:String},cssSpecial:{type:String},partsCommon:{type:String},partsIndividual:{type:String},partsSpecial:{type:String},imagesCommon:{type:String},imagesIndividual:{type:String},imagesSpecial:{type:String},config:{type:String},endpoints:{type:String},backendData:{type:String}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.ref("manage"),i=a.ref(!1),l=(ce=>{if(!ce)return{};try{return JSON.parse(ce)}catch(ue){return console.warn("[ZeroCodeCMS] Failed to parse config:",ue),{}}})(o.config),c=(ce,ue,ye)=>{const Ge=Au();return Ge[ce]!==void 0?Ge[ce]:ye!==void 0?ye:ue},d=a.ref(c("devRightPadding",!1,l.cms?.devRightPadding)),u=a.ref(c("enableContextMenu",!1,l.cms?.enableContextMenu)),f=a.ref(c("showSaveConfirm",!0,l.cms?.showSaveConfirm)),p=a.computed(()=>d.value),h=a.ref(!1),{cmsData:m,loadDataFromProps:b,getData:g,setData:x}=km(o),{fullPageHtml:v,renderComponentToHtml:w}=fi(m,!0);function T(ce){if(ce!=="css")return ce?g(ce):g()}const M=a.ref(null),A=a.ref(null),y=a.computed(()=>A.value?.previewArea||null),{currentMode:E,switchMode:k,allowDynamicContentInteraction:O}=Rv(),G=c("allowDynamicContentInteraction",!1,l.cms?.allowDynamicContentInteraction),z=a.ref(G);O.value=G;let R=!1;a.watch(r,(ce,ue)=>{ce==="preview"?(R=z.value,z.value=!0,O.value=!0,a.nextTick(()=>{st()})):ue==="preview"&&(z.value=R,O.value=R,a.nextTick(()=>{st()})),Ln("view-mode-changed",{mode:ce,previousMode:ue})});const{editingComponent:W,editingComponentPath:H,editingAvailableFields:L,handleEditClick:j,saveFieldEdit:Z,closeEditPanel:K}=Pv(m,y),ae=a.ref({}),ee=a.ref([]),X=a.ref({visible:!1,message:""});function Y(ce){if(ce?.fieldName&&ae.value[ce.fieldName]){const ue={...ae.value};delete ue[ce.fieldName],ae.value=ue}Z(ce)}const{addTargetPath:J,addSelectedType:Q,addSelectedPart:de,clickedComponent:ke,addPartCategory:Te,addTypeTab:$e,keepAdding:N,availablePartTypes:P,groupedPartsByType:V,hasSpecialParts:S,handleAddClick:C,handleCategoryTabClick:$,handleTypeTabClick:te,selectPart:ge,getPartPreviewHtml:Re,getClickedComponentPreviewHtml:ve,confirmAddPart:_,cancelAdd:I}=Lv(m,y,w,l),{reorderSourcePath:q,handleReorderClick:pe,canReorderWith:Ae,cancelReorder:ze}=Vv(m,y),{deleteConfirmComponent:Se,deleteConfirmPath:F,handleDeleteClick:ne,confirmDelete:Me,cancelDelete:B}=$v(m,y,k,a.nextTick),{switchMode:U}=jv(y,E,k,H,J,q,F,W,Q,de,Te,$e,B),ie=a.computed(()=>E.value==="edit"&&H.value?H.value:E.value==="add"&&J.value?J.value:E.value==="reorder"&&q.value?q.value:E.value==="delete"&&F.value?F.value:null),{canSelectParent:le,selectParentElement:we}=Bv(m,y,E,ie,j,C,pe,ne,q),Fe=a.computed(()=>!!(W.value||J.value||q.value||Se.value)),st=()=>{if(y.value){const ce=y.value.getRootNode();if(ce instanceof ShadowRoot){let Ge=0;const et=()=>{Ge++;const At=ce;if(typeof At.__zcmsSetAllowDynamicContentInteraction=="function"){At.__zcmsSetAllowDynamicContentInteraction(z.value);return}Ge<30&&setTimeout(et,50)};et()}}},{setupClickHandlers:xn,cleanupEventListeners:oi}=Fv(m,y,E,H,J,q,F,j,C,pe,ne,Ae,U,z),{isVisible:Tc,position:Zo,handleModeSelect:er,closeMenu:zc,setupContextMenu:Pn,cleanupContextMenu:ri}=Uv(y,u,U);function Ln(ce,ue){const ye=En();if(ye){const et=new CustomEvent(ce,{detail:ue,bubbles:!0,composed:!0});ye.dispatchEvent(et);return}const Ge=new CustomEvent(ce,{detail:ue,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(Ge)}function Ze(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function En(){if(M.value){const ue=M.value.getRootNode();if(ue instanceof ShadowRoot&&ue.host)return ue.host;const ye=M.value.closest?.("zcode-cms")||M.value.closest?.("zcode-editor");if(ye)return ye}const ce=a.getCurrentInstance();if(ce){const ue=ce.vnode.el;if(ue instanceof HTMLElement){const ye=ue.getRootNode();if(ye instanceof ShadowRoot&&ye.host)return ye.host;const Ge=ue.closest?.("zcode-cms")||ue.closest?.("zcode-editor");return Ge||null}if(ue instanceof Node){const ye=ue.getRootNode();if(ye instanceof ShadowRoot&&ye.host)return ye.host}}return null}function Xs(ce){return typeof ce=="object"&&ce!==null}function Ys(ce){return Array.isArray(ce)?ce.filter(ue=>Xs(ue)).map(ue=>({path:typeof ue.path=="string"?ue.path:void 0,field:typeof ue.field=="string"?ue.field:void 0,message:typeof ue.message=="string"?ue.message:void 0,code:typeof ue.code=="string"?ue.code:void 0})):[]}function tr(ce){if(!ce){ae.value={};return}const ue={};for(const ye of ee.value){const Ge=typeof ye?.path=="string"?ye.path:null,et=typeof ye?.field=="string"?ye.field:null,At=typeof ye?.message=="string"?ye.message:null;!et||!At||Ge&&Ge!==ce||(ue[et]=At)}ae.value=ue}const Qs=(ce,ue)=>{ue==="common"?m.images.common.push(ce):ue==="individual"?m.images.individual.push(ce):m.images.special.push(ce)},Zs=ce=>{Sc(ce,m.page).forEach(et=>{Object.keys(et.component).forEach(At=>{At.includes("image")&&et.component[At]===ce&&(et.component[At]="")})});const ye=m.images.common.findIndex(et=>et.id===ce);ye!==-1&&m.images.common.splice(ye,1);const Ge=m.images.individual.findIndex(et=>et.id===ce);Ge!==-1&&m.images.individual.splice(Ge,1)};function ea(ce){const ue=ce.detail;if(!Xs(ue))return;const ye=ue;if(ye.ok===!0){X.value.visible=!1,X.value.message="",ee.value=[],ae.value={};return}if(ye.ok!==!1)return;const Ge=Ys(ye.errors);ee.value=Ge;const et=Ge.length,At=typeof Ge[0]?.message=="string"&&Ge[0].message?Ge[0].message:null;X.value.visible=!0,X.value.requestId=typeof ye.requestId=="string"?ye.requestId:void 0,X.value.target=typeof ye.target=="string"?ye.target:void 0,X.value.message=At?n("editor.saveFailedWithMessage",{count:et,message:At}):n("editor.saveFailedWithCount",{count:et}),tr(H.value||null)}a.onMounted(()=>{b(),a.nextTick(()=>{xn(),u.value&&Pn(),st(),Ln("zcode-dom-updated",{})});const ce=En();ce&&ce.addEventListener("save-result",ea)}),a.onUnmounted(()=>{oi(),ri();const ce=En();ce&&ce.removeEventListener("save-result",ea)}),a.watch(()=>H.value,ce=>{tr(ce||null)}),a.watch([()=>o.page,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial],()=>{b()}),a.watch(m,()=>{a.nextTick(()=>{xn(),Ln("zcode-dom-updated",{})})},{deep:!0}),a.watch([r,y],([ce,ue])=>{ce==="manage"&&ue?a.nextTick(()=>{xn(),u.value&&Pn(),st(),Ln("zcode-dom-updated",{})}):ri()}),a.watch(E,()=>{a.nextTick(()=>{Ln("zcode-dom-updated",{})})}),a.watch(d,ce=>{vi({devRightPadding:ce})}),a.watch(z,ce=>{r.value==="manage"&&vi({allowDynamicContentInteraction:ce}),O.value=ce,a.nextTick(()=>{xn(),st(),Ln("zcode-dom-updated",{})})}),a.watch(u,ce=>{vi({enableContextMenu:ce}),ce?a.nextTick(()=>{Pn()}):ri()}),a.watch(f,ce=>{vi({showSaveConfirm:ce})});function Zt(){if(!f.value){kn();return}h.value=!0}function kn(){const ce=Ze();Ln("save-request",{requestId:ce,source:"cms",targets:["page","images-common","images-individual"],timestamp:Date.now()})}function ta(){h.value=!1,kn()}function ii(){h.value=!1}return e({getData:T,setData:x,validateData:Hv,cmsData:m,currentMode:E,switchMode:U,allowDynamicContentInteraction:z,devRightPadding:d,devRightPaddingValue:p,settingsPanelOpen:i}),(ce,ue)=>(a.openBlock(),a.createElementBlock("div",{ref_key:"containerRef",ref:M,class:a.normalizeClass(["zcode-cms-container",{"zcode-dev-padding":d.value&&Fe.value}])},[a.createVNode(rd,{"current-mode":a.unref(E),"view-mode":r.value,"allow-dynamic-content-interaction":z.value,onSwitchMode:a.unref(U),onSwitchViewMode:ue[0]||(ue[0]=ye=>r.value=ye),onOpenSettings:ue[1]||(ue[1]=ye=>i.value=!0)},null,8,["current-mode","view-mode","allow-dynamic-content-interaction","onSwitchMode"]),X.value.visible?(a.openBlock(),a.createElementBlock("div",Wv,[a.createElementVNode("div",Gv,a.toDisplayString(X.value.message),1),a.createElementVNode("button",{class:"zcode-save-banner-close","aria-label":ce.$t("common.close"),onClick:ue[2]||(ue[2]=ye=>X.value.visible=!1)}," × ",8,qv)])):a.createCommentVNode("",!0),r.value==="manage"?(a.openBlock(),a.createElementBlock("div",Kv,[a.createElementVNode("button",{class:"zcode-save-btn",onClick:Zt},[a.createVNode(a.unref(Lc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(ce.$t("common.save")),1)])])):a.createCommentVNode("",!0),r.value==="preview"?(a.openBlock(),a.createBlock(ma,{key:2,"cms-data":a.unref(m),"allow-dynamic-content-interaction":!0},null,8,["cms-data"])):a.createCommentVNode("",!0),r.value==="manage"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:3},[a.createVNode(Fc,{ref_key:"previewAreaRef",ref:A,"cms-data":a.unref(m),"full-page-html":a.unref(v),"on-add-click":a.unref(C),"allow-dynamic-content-interaction":z.value},null,8,["cms-data","full-page-html","on-add-click","allow-dynamic-content-interaction"]),a.createVNode(zC,{"editing-component":a.unref(W),"editing-available-fields":a.unref(L),"field-errors":ae.value,"current-mode":a.unref(E),"can-select-parent":a.unref(le),"images-common":a.unref(m).images.common,"images-individual":a.unref(m).images.individual,"images-special":a.unref(m).images.special,onClose:a.unref(K),onSelectParent:a.unref(we),onSaveField:Y,onAddImage:Qs,onDeleteImage:Zs},null,8,["editing-component","editing-available-fields","field-errors","current-mode","can-select-parent","images-common","images-individual","images-special","onClose","onSelectParent"]),a.createVNode(LC,{"delete-confirm-component":a.unref(Se),"current-mode":a.unref(E),"can-select-parent":a.unref(le),onConfirm:a.unref(Me),onCancel:a.unref(B),onSelectParent:a.unref(we)},null,8,["delete-confirm-component","current-mode","can-select-parent","onConfirm","onCancel","onSelectParent"]),a.createVNode(WC,{"reorder-source-path":a.unref(q),"current-mode":a.unref(E),"can-select-parent":a.unref(le),onCancel:a.unref(ze),onSelectParent:a.unref(we)},null,8,["reorder-source-path","current-mode","can-select-parent","onCancel","onSelectParent"]),a.createVNode(Av,{"add-target-path":a.unref(J),"add-part-category":a.unref(Te),"add-type-tab":a.unref($e),"add-selected-part":a.unref(de),"add-selected-type":a.unref(Q),"has-special-parts":a.unref(S),"clicked-component":a.unref(ke),"available-part-types":a.unref(P),config:a.unref(l),"grouped-parts-by-type":a.unref(V),"can-select-parent":a.unref(le),"get-part-preview-html":a.unref(Re),"get-clicked-component-preview-html":a.unref(ve),"keep-adding":a.unref(N),onCancel:a.unref(I),onSelectParent:a.unref(we),onCategoryTabClick:a.unref($),onTypeTabClick:a.unref(te),onSelectPart:a.unref(ge),onConfirmAdd:a.unref(_),onUpdateKeepAdding:ue[3]||(ue[3]=ye=>N.value=ye)},null,8,["add-target-path","add-part-category","add-type-tab","add-selected-part","add-selected-type","has-special-parts","clicked-component","available-part-types","config","grouped-parts-by-type","can-select-parent","get-part-preview-html","get-clicked-component-preview-html","keep-adding","onCancel","onSelectParent","onCategoryTabClick","onTypeTabClick","onSelectPart","onConfirmAdd"])],64)):a.createCommentVNode("",!0),a.createVNode(Ou,{"is-open":i.value,"view-mode":r.value,mode:"toolbar","allow-dynamic-content-interaction":z.value,"dev-right-padding":p.value,"enable-context-menu":u.value,"show-save-confirm":f.value,onClose:ue[4]||(ue[4]=ye=>i.value=!1),onToggleDynamicContent:ue[5]||(ue[5]=ye=>z.value=ye),onToggleDevPadding:ue[6]||(ue[6]=ye=>d.value=ye),onToggleContextMenu:ue[7]||(ue[7]=ye=>u.value=ye),onToggleSaveConfirm:ue[8]||(ue[8]=ye=>f.value=ye)},null,8,["is-open","view-mode","allow-dynamic-content-interaction","dev-right-padding","enable-context-menu","show-save-confirm"]),a.createVNode(Mv,{"is-visible":a.unref(Tc),position:a.unref(Zo),"current-mode":a.unref(E),onSelectMode:a.unref(er),onClose:a.unref(zc)},null,8,["is-visible","position","current-mode","onSelectMode","onClose"]),h.value?(a.openBlock(),a.createElementBlock("div",{key:4,class:"zcode-save-confirm-dialog-overlay",onClick:a.withModifiers(ii,["self"])},[a.createElementVNode("div",Jv,[a.createElementVNode("div",Xv,[a.createElementVNode("div",Yv,a.toDisplayString(ce.$t("saveConfirm.title")),1)]),a.createElementVNode("div",Qv,[a.createElementVNode("p",null,a.toDisplayString(ce.$t("saveConfirm.simpleMessage")),1)]),a.createElementVNode("div",Zv,[a.createElementVNode("button",{class:"zcode-btn-secondary",onClick:ii},a.toDisplayString(ce.$t("common.cancel")),1),a.createElementVNode("button",{class:"zcode-btn-primary",onClick:ta},a.toDisplayString(ce.$t("saveConfirm.saveButton")),1)])])])):a.createCommentVNode("",!0)],2))}}),Sm=":root{--zcode-color-edit: #3b82f6;--zcode-color-add: #10b981;--zcode-color-reorder: #f59e0b;--zcode-color-delete: #ef4444;--zcode-color-edit-hover: #2563eb;--zcode-color-edit-bg: #eff6ff;--zcode-color-edit-bg-active: #dbeafe;--zcode-color-edit-border-hover: #93c5fd;--zcode-color-add-hover: #059669;--zcode-color-add-bg: #ecfdf5;--zcode-color-add-bg-active: #d1fae5;--zcode-color-add-border-hover: #6ee7b7;--zcode-color-reorder-bg: #fffbeb;--zcode-color-reorder-bg-active: #fef3c7;--zcode-color-reorder-border-hover: #fcd34d;--zcode-color-delete-hover: #dc2626;--zcode-color-delete-bg: #fef2f2;--zcode-color-delete-bg-active: #fee2e2;--zcode-color-delete-border-hover: #fca5a5}[class*=zcode-]{box-sizing:border-box}[class*=zcode-]:before,[class*=zcode-]:after{box-sizing:border-box}.zcode-empty-state{text-align:center;padding:60px 20px;color:#666}.zcode-empty-state-btn{margin-top:20px;padding:10px 20px;font-size:16px;background:#42b983;color:#fff;border:none;border-radius:4px;cursor:pointer;transition:background .2s}.zcode-empty-state-btn:hover{background:#359268}.zcode-edit-panel,.zcode-add-panel,.zcode-reorder-panel,.zcode-delete-panel{position:fixed;top:0;right:0;width:375px;height:100vh;background:#fff;box-shadow:-2px 0 8px #0000001a;overflow:hidden;display:flex;flex-direction:column;z-index:1002}.zcode-edit-panel-header,.zcode-add-panel-header,.zcode-reorder-panel-header,.zcode-delete-panel-header{display:flex;justify-content:space-between;align-items:center;padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-shrink:0}.zcode-panel-header-title{margin:0;font-size:14px;font-weight:600;color:#1f2937}.zcode-edit-panel-header .zcode-panel-header-title{color:var(--zcode-color-edit)}.zcode-add-panel-header .zcode-panel-header-title{color:var(--zcode-color-add)}.zcode-reorder-panel-header .zcode-panel-header-title{color:var(--zcode-color-reorder)}.zcode-delete-panel-header .zcode-panel-header-title{color:var(--zcode-color-delete)}.zcode-close-btn{background:none;border:none;cursor:pointer;color:#6b7280;padding:4px 8px;line-height:1;display:flex;align-items:center;justify-content:center}.zcode-close-btn:hover{color:#1f2937}.zcode-edit-fields{padding:16px;font-size:14px;color:#6b7280;overflow-y:auto;flex:1}.zcode-add-panel-content{overflow-y:auto;flex:1}.zcode-edit-fields-text{margin:8px 0}.zcode-component-developer{border:1px dashed #ccc;padding:10px}.zcode-error-message{padding:20px;background:#fff3cd;border:1px solid #ffc107;border-radius:4px;color:#856404}.zcode-for-item{margin-bottom:10px}.zcode-field-editor{padding:16px;overflow-y:auto}.zcode-field-item-title{margin:0 0 15px;color:#2c3e50;font-size:16px;border-bottom:1px solid #eee;padding-bottom:8px}.zcode-field-editor-label{display:block;margin-bottom:8px;font-weight:500;color:#555}.zcode-text-editor{margin-bottom:20px}.zcode-text-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;transition:border-color .2s;box-sizing:border-box}.zcode-text-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-field-error{border-color:#ef4444!important;background-color:#fef2f2}.zcode-field-error-message{margin-top:6px;font-size:12px;color:#ef4444;line-height:1.4}.zcode-field-counter{margin-top:6px;font-size:12px;color:#6b7280;text-align:right}.zcode-text-input:disabled,.zcode-textarea:disabled{opacity:.7;cursor:not-allowed}.zcode-text-input[readonly],.zcode-textarea[readonly]{background-color:#f3f4f6;cursor:default}.zcode-radio-editor{margin-top:12px;margin-bottom:12px}.zcode-radio-group{display:flex;flex-direction:column;gap:6px}.zcode-radio-item{display:flex;align-items:center;gap:6px;cursor:pointer;margin-bottom:0;font-weight:400;color:inherit}.zcode-radio-item input[type=radio]{margin:0;cursor:pointer}.zcode-radio-item input[type=radio]:focus{outline:2px solid var(--zcode-color-edit);outline-offset:2px}.zcode-radio-item-label{font-size:14px;color:#4b5563}.zcode-checkbox-editor{margin-top:12px;margin-bottom:12px}.zcode-checkbox-item{display:flex;align-items:center;gap:6px;cursor:pointer;margin-bottom:0;font-weight:400;color:inherit}.zcode-checkbox-item input[type=checkbox]{margin:0;cursor:pointer}.zcode-checkbox-item input[type=checkbox]:focus{outline:2px solid var(--zcode-color-edit);outline-offset:2px}.zcode-checkbox-item-label{font-size:14px;color:#4b5563}.zcode-edit-actions{display:flex;gap:10px;margin-top:20px}.zcode-save-btn{flex:1;background:var(--zcode-color-edit);color:#fff;border:none;padding:10px 16px;border-radius:4px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-save-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-cancel-btn{flex:1;background:#f8f9fa;color:#6c757d;border:1px solid #dee2e6;padding:10px 16px;border-radius:4px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-cancel-btn:hover{background:#e9ecef}[data-zcode-id],[data-zcode-slot-path]{transition:outline .2s;cursor:pointer;position:relative}[data-zcode-id].zcode-outline-active-edit,[data-zcode-id].zcode-outline-active-add,[data-zcode-id].zcode-outline-active-reorder,[data-zcode-id].zcode-outline-active-delete,[data-zcode-slot-path].zcode-outline-active-edit,[data-zcode-slot-path].zcode-outline-active-add,[data-zcode-slot-path].zcode-outline-active-reorder,[data-zcode-slot-path].zcode-outline-active-delete{outline-style:solid;animation:zcode-outline-pulse-edit 1.5s ease-in-out infinite}[data-zcode-id].zcode-outline-active-edit{animation-name:zcode-outline-pulse-edit}[data-zcode-id].zcode-outline-active-add{animation-name:zcode-outline-pulse-add}[data-zcode-id].zcode-outline-active-reorder{animation-name:zcode-outline-pulse-reorder}[data-zcode-id].zcode-outline-active-delete{animation-name:zcode-outline-pulse-delete}[data-zcode-slot-path].zcode-outline-active-edit{animation-name:zcode-outline-pulse-edit}[data-zcode-slot-path].zcode-outline-active-add{animation-name:zcode-outline-pulse-add}[data-zcode-slot-path].zcode-outline-active-reorder{animation-name:zcode-outline-pulse-reorder}[data-zcode-slot-path].zcode-outline-active-delete{animation-name:zcode-outline-pulse-delete}@keyframes zcode-outline-pulse-edit{0%{outline-width:4px;outline-offset:2px;outline-color:#3cd7f6}25%{outline-width:4px;outline-offset:2px;outline-color:#3c83f6}50%{outline-width:4px;outline-offset:2px;outline-color:#493cf6}75%{outline-width:4px;outline-offset:2px;outline-color:#3c83f6}to{outline-width:4px;outline-offset:2px;outline-color:#3cd7f6}}@keyframes zcode-outline-pulse-add{0%{outline-width:4px;outline-offset:2px;outline-color:#0fb82b}25%{outline-width:4px;outline-offset:2px;outline-color:#0fb880}50%{outline-width:4px;outline-offset:2px;outline-color:#0f9cb8}75%{outline-width:4px;outline-offset:2px;outline-color:#0fb880}to{outline-width:4px;outline-offset:2px;outline-color:#0fb82b}}@keyframes zcode-outline-pulse-reorder{0%{outline-width:4px;outline-offset:2px;outline-color:#f5800a}25%{outline-width:4px;outline-offset:2px;outline-color:#f59f0a}50%{outline-width:4px;outline-offset:2px;outline-color:#f5be0a}75%{outline-width:4px;outline-offset:2px;outline-color:#f59f0a}to{outline-width:4px;outline-offset:2px;outline-color:#f5800a}}@keyframes zcode-outline-pulse-delete{0%{outline-width:4px;outline-offset:2px;outline-color:#ef437c}25%{outline-width:4px;outline-offset:2px;outline-color:#ef4343}50%{outline-width:4px;outline-offset:2px;outline-color:#ef7c43}75%{outline-width:4px;outline-offset:2px;outline-color:#ef4343}to{outline-width:4px;outline-offset:2px;outline-color:#ef437c}}.zcode-view-mode-toggle{display:flex;gap:8px}.zcode-view-mode-btn{display:flex;align-items:center;gap:6px;padding:8px 16px;border:1px solid #e5e7eb;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s;font-size:14px;font-weight:500}.zcode-dev-header{display:flex;align-items:center;justify-content:flex-start;padding:8px 16px;background:#f9fafb;border-bottom:1px solid #e5e7eb}.zcode-toolbar{position:sticky;top:0;display:flex;align-items:center;gap:8px;width:fit-content;background:#fffc;margin-bottom:10px;padding:8px 16px;border-radius:8px;box-shadow:0 2px 8px #0000001a;z-index:1001}.zcode-save-banner{position:sticky;top:54px;display:flex;align-items:flex-start;justify-content:space-between;gap:12px;width:min(720px,calc(100% - 32px));margin:0 0 10px;padding:10px 12px;border-radius:10px;border:1px solid transparent;z-index:1001;-webkit-backdrop-filter:blur(6px);backdrop-filter:blur(6px)}.zcode-save-banner--error{border-color:#fecaca;background:#fef2f2e6;color:#991b1b}.zcode-save-banner-text{font-size:13px;line-height:1.4;word-break:break-word}.zcode-save-banner-close{flex:0 0 auto;width:28px;height:28px;border-radius:8px;border:1px solid rgba(0,0,0,.06);background:#fffc;color:inherit;cursor:pointer}.zcode-save-banner-close:hover{background:#fff}.zcode-toolbar-separator{width:1px;height:24px;background-color:#e5e7eb;margin:0 4px}.zcode-dynamic-content-toggle-label{display:flex;align-items:center;gap:6px;padding:4px 8px;border-radius:4px;cursor:pointer;font-size:14px;color:#374151;-webkit-user-select:none;user-select:none}.zcode-dynamic-content-toggle-label:hover{background-color:#f3f4f6}.zcode-dynamic-content-toggle-checkbox{margin:0;cursor:pointer}.zcode-dev-container .zcode-cms-container .zcode-toolbar{display:none}.zcode-template-tabs{display:inline-flex;gap:6px;margin-right:8px}.zcode-template-tab{padding:6px 10px;border:1px solid #d1d5db;border-radius:6px;background:#fff;font-size:12px;color:#374151;cursor:pointer}.zcode-template-tab.active{background:#111827;border-color:#111827;color:#fff;font-weight:600}.zcode-css-inline-note{flex-shrink:0;margin:0 0 12px;padding:10px 12px;border:1px solid #fde68a;background:#fffbeb;border-radius:8px;color:#92400e;font-size:12px;line-height:1.6}.zcode-part-editor-preview-tab{border:1px solid #e5e7eb;border-radius:8px;background:#fff;padding:16px;min-height:240px;cursor:pointer}.zcode-part-editor-preview-hint{margin-top:10px;font-size:12px;color:#6b7280}.zcode-part-editor-pane{border:1px solid #e5e7eb;border-radius:8px;background:#fff;overflow:hidden;display:flex;flex-direction:column;min-height:0;min-width:0;flex:1}.zcode-part-editor-pane-header{padding:10px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;align-items:center;justify-content:space-between;gap:10px}.zcode-part-editor-pane-header-actions{display:flex;align-items:center;gap:8px;min-width:0}.zcode-css-warning-compact{display:flex;align-items:center;gap:6px;padding:6px 10px;background:#fffbeb;border:1px solid #fde68a;border-radius:6px;font-size:12px;color:#92400e}.zcode-css-warning-compact-icon{flex-shrink:0;color:#f59e0b}.zcode-css-warning-compact-text{white-space:nowrap;font-weight:500}.zcode-part-editor-pane-body{flex:1;min-height:0;overflow:hidden;padding:12px;display:flex;flex-direction:column}.zcode-part-editor-slots-toggle{width:100%;border:1px solid #e5e7eb;border-radius:8px;background:#f9fafb;padding:10px 12px;display:flex;align-items:center;justify-content:space-between;cursor:pointer;font-size:13px;font-weight:600;color:#374151}.zcode-part-editor-slots-toggle:hover{background:#f3f4f6}.zcode-part-editor-slots-toggle-icon{display:inline-flex;width:24px;height:24px;align-items:center;justify-content:center;border-radius:999px;border:1px solid #d1d5db;background:#fff;color:#6b7280;font-size:16px;font-weight:400}.zcode-part-editor-slots-toggle-icon.open{transform:rotate(45deg)}.zcode-part-editor-slots-body{margin-top:10px}.zcode-part-editor-topbar{margin-bottom:16px}.zcode-part-editor-topfields{display:grid;grid-template-columns:1fr 1fr;gap:12px}.zcode-part-editor-slots-top{margin-top:12px}.zcode-part-editor-slots-bottom{margin-top:24px;padding-top:24px;border-top:1px solid #e5e7eb}.zcode-save-controls-fixed{position:fixed;bottom:20px;left:20px;display:flex;align-items:center;gap:8px;padding:12px 20px;background:#fffc;border-radius:8px;box-shadow:0 4px 12px #00000026;z-index:1000}.zcode-save-btn{display:flex;align-items:center;gap:6px;padding:8px 16px;border:1px solid var(--zcode-color-edit);border-radius:6px;background:var(--zcode-color-edit);color:#fff;font-size:14px;cursor:pointer;transition:all .2s}.zcode-save-btn:hover{background:var(--zcode-color-edit-hover);border-color:var(--zcode-color-edit-hover)}.zcode-mode-btn{padding:8px 16px;border:2px solid #ddd;border-radius:6px;background:#fff;cursor:pointer;font-weight:500;transition:all .2s;font-size:14px;display:flex;align-items:center;gap:6px}.zcode-mode-btn:hover{background:#f3f4f6}.zcode-mode-edit:hover{color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg);border-color:var(--zcode-color-edit-border-hover)}.zcode-mode-reorder:hover{color:var(--zcode-color-reorder);background:var(--zcode-color-reorder-bg);border-color:var(--zcode-color-reorder-border-hover)}.zcode-mode-add:hover{color:var(--zcode-color-add);background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-border-hover)}.zcode-mode-delete:hover{color:var(--zcode-color-delete);background:var(--zcode-color-delete-bg);border-color:var(--zcode-color-delete-border-hover)}.zcode-mode-btn.active{border-color:currentColor;font-weight:600}.zcode-mode-edit.active{color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg-active);border-color:var(--zcode-color-edit)}.zcode-mode-reorder.active{color:var(--zcode-color-reorder);background:var(--zcode-color-reorder-bg-active);border-color:var(--zcode-color-reorder)}.zcode-mode-add.active{color:var(--zcode-color-add);background:var(--zcode-color-add-bg-active);border-color:var(--zcode-color-add)}.zcode-mode-delete.active{color:var(--zcode-color-delete);background:var(--zcode-color-delete-bg-active);border-color:var(--zcode-color-delete)}.zcode-view-mode-btn{padding:8px 16px;border:2px solid #ddd;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s;font-size:14px;font-weight:500;display:flex;align-items:center;gap:6px}.zcode-view-mode-btn:hover{background:#f9fafb;border-color:#d1d5db;color:#374151}.zcode-view-mode-btn.active{background:#3b82f6;color:#fff;border-color:#3b82f6}.zcode-view-mode-btn.active:hover{background:#2563eb;border-color:#2563eb}.zcode-settings-btn{display:flex;align-items:center;justify-content:center;width:36px;height:36px;padding:0;border:2px solid #ddd;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;transition:all .2s}.zcode-settings-btn:hover{background:#f9fafb;border-color:#d1d5db;color:#374151}.zcode-settings-panel-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000}.zcode-settings-panel{background:#fff;border-radius:8px;box-shadow:0 10px 25px #0003;width:90%;max-width:500px;max-height:80vh;overflow-y:auto}.zcode-settings-panel-header{display:flex;align-items:center;justify-content:space-between;padding:16px 20px;border-bottom:1px solid #e5e7eb;gap:12px}.zcode-settings-panel-header-title{margin:0;font-size:18px;font-weight:600;color:#111827;flex:1}.zcode-settings-panel-header-actions{display:flex;align-items:center;gap:12px}.zcode-language-select{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;color:#374151;cursor:pointer;transition:border-color .2s}.zcode-language-select:hover{border-color:#9ca3af}.zcode-language-select:focus{outline:none;border-color:#3b82f6;box-shadow:0 0 0 3px #3b82f61a}.zcode-settings-panel-content{padding:20px}.zcode-setting-item{margin-bottom:24px}.zcode-setting-item:last-child{margin-bottom:0}.zcode-setting-label{display:flex;align-items:center;gap:8px;font-size:14px;font-weight:500;color:#374151;cursor:pointer;-webkit-user-select:none;user-select:none}.zcode-setting-checkbox{width:18px;height:18px;cursor:pointer}.zcode-info-btn{display:flex;align-items:center;justify-content:center;width:24px;height:24px;padding:0;margin-left:auto;background:none;border:none;color:#6b7280;cursor:pointer;border-radius:4px;transition:color .2s}.zcode-info-btn:hover{color:#374151}.zcode-setting-description{margin:8px 0 0 26px;font-size:13px;color:#6b7280;line-height:1.5}.zcode-setting-info{margin:0;padding:12px;background:#f3f4f6;border-radius:6px;font-size:13px}.zcode-delete-panel-content{padding:16px;flex:1;overflow-y:auto;display:flex;flex-direction:column;gap:16px}.zcode-delete-warning{display:flex;align-items:flex-start;gap:12px;padding:12px;background:var(--zcode-color-delete-bg);border:1px solid var(--zcode-color-delete-border-hover);border-radius:6px;color:var(--zcode-color-delete)}.zcode-delete-warning svg{flex-shrink:0;margin-top:2px}.zcode-delete-warning p{margin:0;font-size:14px;font-weight:500;line-height:1.5}.zcode-delete-actions{display:flex;gap:8px;margin-top:16px}.zcode-btn-danger{flex:1;padding:10px;background:var(--zcode-color-delete);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:600;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-danger:hover{background:var(--zcode-color-delete-hover)}.zcode-btn-cancel{flex:1;padding:10px;background:#e5e7eb;color:#374151;border:none;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-cancel:hover{background:#d1d5db}.zcode-parent-selector{padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-parent-select-btn{width:100%;padding:8px 12px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-parent-select-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-reorder-panel-content{padding:16px;flex:1;overflow-y:auto}.zcode-reorder-panel-content-text{margin:8px 0;color:#374151}.zcode-reorder-source{font-family:monospace;font-size:12px;color:#1f2937}.zcode-field-item{margin-bottom:20px}.zcode-field-item-title{margin:0 0 8px;font-size:14px;color:#374151;font-weight:600}.zcode-group-tabs{display:flex;gap:4px;padding:12px 16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;flex-shrink:0;-webkit-overflow-scrolling:touch}.zcode-group-tab{padding:6px 12px;font-size:13px;font-weight:500;color:#6b7280;background:#fff;border:1px solid #d1d5db;border-radius:4px;cursor:pointer;transition:all .2s;display:flex;align-items:center;gap:4px}.zcode-group-tab:hover{background:#f3f4f6;border-color:#9ca3af;color:#374151}.zcode-group-tab.active{background:var(--zcode-color-edit);border-color:var(--zcode-color-edit);color:#fff}.zcode-group-tab.active:hover{background:var(--zcode-color-edit-hover);border-color:var(--zcode-color-edit-hover)}@media(max-width:768px){.zcode-edit-panel,.zcode-add-panel,.zcode-reorder-panel,.zcode-delete-panel{width:100%;height:auto;position:fixed;inset:auto 0 0;border-radius:12px 12px 0 0;max-height:60vh;box-shadow:0 -4px 12px #00000026;z-index:1002;animation:zcode-slide-in-up .3s ease-out}@keyframes zcode-slide-in-up{0%{transform:translateY(100%)}to{transform:translateY(0)}}.zcode-insert-position{width:100%;right:0}.zcode-edit-actions{flex-direction:column;gap:12px}.zcode-edit-actions-btn{padding:10px 16px;font-size:14px}.zcode-toolbar{top:0;left:10px;right:10px;flex-wrap:nowrap;padding:6px 8px;gap:4px;overflow-x:auto;-webkit-overflow-scrolling:touch}.zcode-toolbar-btn{width:32px;height:32px;padding:0}.zcode-toolbar-btn-text{display:none}.zcode-view-mode-btn,.zcode-mode-btn{width:32px;height:32px;padding:0;justify-content:center}.zcode-view-mode-btn span,.zcode-mode-btn span{display:none}.zcode-settings-btn{width:36px;height:36px}.zcode-delete-dialog-content{width:95%;padding:16px}.zcode-save-controls-fixed{bottom:20px;left:20px;padding:0;background:transparent;box-shadow:none}.zcode-save-btn{width:48px;height:48px;padding:0;border-radius:50%;box-shadow:0 4px 12px #00000040;display:flex;align-items:center;justify-content:center;gap:0}.zcode-save-btn span{display:none}.zcode-save-btn svg{width:20px;height:20px}.zcode-edit-panel-header,.zcode-add-panel-header,.zcode-reorder-panel-header,.zcode-delete-panel-header{padding:10px 12px}.zcode-edit-fields{padding:12px}.zcode-field-item{margin-bottom:20px}.zcode-text-input,.zcode-textarea,.zcode-select,select{font-size:16px;padding:8px 12px}.zcode-textarea{min-height:100px}.zcode-btn,.zcode-btn-primary,.zcode-btn-danger,.zcode-btn-cancel{padding:10px}.zcode-group-tab,.zcode-image-select-btn,.zcode-image-clear-btn,.zcode-parent-select-btn{padding:8px 12px}}.zcode-part-category-tabs{display:flex;gap:4px;padding:8px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-shrink:0}.zcode-category-tab{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-size:13px;font-weight:500;color:#6b7280;transition:all .2s}.zcode-category-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-category-tab.active{background:var(--zcode-color-add);color:#fff;border-color:var(--zcode-color-add)}.zcode-type-tabs{display:flex;gap:4px;padding:8px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb;flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;flex-shrink:0;-webkit-overflow-scrolling:touch}.zcode-type-tab{padding:6px 12px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-size:12px;font-weight:500;color:#6b7280;transition:all .2s;white-space:nowrap}.zcode-type-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-type-tab.active{background:var(--zcode-color-add);color:#fff;border-color:var(--zcode-color-add)}.zcode-part-list{flex:1;overflow-y:auto;padding:12px}.zcode-part-type-section{margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #e5e7eb}.zcode-part-type-section:last-child{border-bottom:none;margin-bottom:0}.zcode-type-section-title{font-size:14px;font-weight:600;color:#1f2937;margin:0 0 6px}.zcode-type-section-description{font-size:12px;color:#6b7280;margin:0 0 8px;line-height:1.5}.zcode-module-buttons{display:grid;grid-template-columns:1fr;gap:6px}.zcode-empty-parts{text-align:center;padding:40px 20px;color:#9ca3af}.zcode-empty-parts-text{margin:0;font-size:14px}.zcode-module-preview{border:2px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;transition:all .2s;overflow:hidden;display:flex;flex-direction:column}.zcode-module-preview:hover{border-color:#9ca3af;box-shadow:0 4px 6px #0000001a}.zcode-module-preview.active{border-color:var(--zcode-color-add);box-shadow:0 0 0 3px #10b9811a}.zcode-module-preview-label{padding:6px 10px;background:#f9fafb;border-bottom:1px solid #e5e7eb;font-size:11px;font-weight:600;color:#374151;text-align:center}.zcode-module-preview.active .zcode-module-preview-label{background:var(--zcode-color-add);color:#fff}.zcode-module-preview-header{display:flex;align-items:center;justify-content:space-between;padding:0;background:#f9fafb;border-bottom:1px solid #e5e7eb}.zcode-module-preview-header .zcode-module-preview-label{flex:1;padding:4px 8px;background:transparent;border-bottom:none;text-align:left}.zcode-module-preview-icon-btn{border:none;background:transparent;padding:0 6px 0 0;cursor:pointer;color:#6b7280;display:flex;align-items:center;justify-content:center}.zcode-module-preview-icon-btn:hover{color:#111827}.zcode-module-preview.active .zcode-module-preview-header{background:var(--zcode-color-add)}.zcode-module-preview.active .zcode-module-preview-header .zcode-module-preview-label{color:#fff}.zcode-module-preview.active .zcode-module-preview-icon-btn{color:#ecfeff}.zcode-module-preview-content{padding:0;flex:1;overflow:hidden;overflow-y:hidden}.zcode-module-preview-content *{max-width:100%}.zcode-copy-notice{display:flex;align-items:center;gap:8px;padding:8px 12px;background:#f0f9ff;border:1px solid #bae6fd;border-radius:4px;margin-bottom:12px}.zcode-copy-notice-icon{flex-shrink:0;color:#0ea5e9}.zcode-copy-notice-text{margin:0;font-size:13px;color:#075985}.zcode-insert-position{padding:12px 20px;border-top:1px solid #e5e7eb;background:#fff}.zcode-insert-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;gap:16px}.zcode-insert-position-title{margin:0;font-size:14px;font-weight:600;color:#374151;flex-shrink:0}.zcode-keep-adding-label-position{margin-top:0;flex-shrink:0;white-space:nowrap}.zcode-keep-adding-label{display:flex;align-items:center;gap:6px;font-size:14px;cursor:pointer;-webkit-user-select:none;user-select:none}.zcode-keep-adding-checkbox{width:16px;height:16px;cursor:pointer}.zcode-insert-buttons{display:flex;gap:8px}.zcode-insert-btn{flex:1;padding:12px 16px;border:2px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-size:14px;font-weight:600;color:#374151;transition:all .2s}.zcode-insert-btn:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-insert-before{border-color:var(--zcode-color-add);color:var(--zcode-color-add)}.zcode-insert-before:hover{background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-hover)}.zcode-insert-after{border-color:var(--zcode-color-add);color:var(--zcode-color-add)}.zcode-insert-after:hover{background:var(--zcode-color-add-bg);border-color:var(--zcode-color-add-hover)}.zcode-empty-slot{padding:20px;text-align:center;border:2px dashed #d1d5db;border-radius:8px;background:#f9fafb}.zcode-add-slot-btn{padding:8px 16px;background:var(--zcode-color-add);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s}.zcode-add-slot-btn:hover{background:var(--zcode-color-add-hover)}.zcode-add-btn{padding:10px 20px;font-size:16px;background:var(--zcode-color-add);color:#fff;border:none;border-radius:6px;cursor:pointer;transition:background .2s;font-weight:500}.zcode-add-btn:hover{background:var(--zcode-color-add-hover)}@media(max-width:768px){.zcode-part-category-tabs,.zcode-type-tabs{padding:8px 12px}.zcode-part-list,.zcode-part-item{padding:12px}}.zcode-rich-text-editor{border:1px solid #d1d5db;border-radius:6px;overflow:hidden;background:#fff}.zcode-rich-text-toolbar{display:flex;align-items:center;gap:4px;padding:8px;border-bottom:1px solid #d1d5db;background:#f9fafb;flex-wrap:wrap}.zcode-toolbar-btn{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid #d1d5db;border-radius:4px;background:#fff;cursor:pointer;font-size:14px;transition:all .2s;padding:0}.zcode-toolbar-btn:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-toolbar-btn.is-active{background:var(--zcode-color-edit);color:#fff;border-color:var(--zcode-color-edit)}.zcode-toolbar-divider{width:1px;height:24px;background:#d1d5db;margin:0 4px}.zcode-rich-text-editor-content{min-height:200px;max-height:400px;overflow-y:auto;padding:12px}.zcode-tiptap-editor{outline:none;white-space:pre-wrap}.zcode-tiptap-editor p.is-editor-empty:first-child:before{content:attr(data-placeholder);float:left;color:#9ca3af;pointer-events:none;height:0}.zcode-tiptap-editor p{margin:.5em 0}.zcode-tiptap-editor ul,.zcode-tiptap-editor ol{padding-left:1.5em;margin:.5em 0}.zcode-tiptap-editor ul{list-style-type:disc}.zcode-tiptap-editor ol{list-style-type:decimal}.zcode-rich-text-editor-content ul{list-style-type:disc}.zcode-rich-text-editor-content ol{list-style-type:decimal}.zcode-rich-text-editor-content ul,.zcode-rich-text-editor-content ol{padding-left:1.5em;margin:.5em 0}.zcode-tiptap-editor a.zcode-link{color:var(--zcode-color-edit);text-decoration:underline}.zcode-tiptap-editor strong{font-weight:600}.zcode-tiptap-editor em{font-style:italic}.zcode-tiptap-editor s{text-decoration:line-through}.zcode-image-editor{margin-bottom:16px}.zcode-image-editor-input{width:100%;margin-bottom:8px}.zcode-image-editor-buttons{display:flex;gap:8px;margin-bottom:12px}.zcode-image-select-btn{flex:1;padding:8px 16px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-image-select-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-image-clear-btn{flex:1;padding:8px 12px;background:#ef4444;color:#fff;border:none;border-radius:6px;cursor:pointer;font-size:14px;font-weight:500;transition:background .2s;white-space:nowrap;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-image-clear-btn:hover{background:#dc2626}.zcode-image-preview{margin-top:12px;border:1px solid #d1d5db;border-radius:6px;padding:8px;background:#f9fafb;display:flex;justify-content:center;align-items:center}.zcode-image-preview-img{max-width:100%;max-height:200px;object-fit:contain;border-radius:4px}.zcode-image-modal{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000;padding:20px}.zcode-image-modal-content{background:#fff;border-radius:12px;box-shadow:0 4px 16px #0003;max-width:800px;width:90%;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-image-modal-content[data-edit-mode]{max-width:500px;width:100%;border-radius:8px;box-shadow:0 10px 40px #0003}.zcode-image-modal-header{display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid #e5e7eb}.zcode-image-modal-header-title{margin:0;font-size:20px;font-weight:600;color:#1f2937}.zcode-image-current{padding:16px 24px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-image-current-title{margin:0 0 12px;font-size:14px;font-weight:600;color:#6b7280}.zcode-image-current-item{display:flex;align-items:center;gap:12px}.zcode-image-current-item-img{width:60px;height:60px;object-fit:cover;border-radius:6px;border:1px solid #d1d5db}.zcode-image-current-name{font-size:14px;color:#374151;font-weight:500}.zcode-image-tabs{display:flex;border-bottom:1px solid #e5e7eb;padding:0 24px}.zcode-image-tab{padding:12px 20px;background:none;border:none;border-bottom:2px solid transparent;cursor:pointer;font-size:14px;font-weight:500;color:#6b7280;transition:all .2s}.zcode-image-tab:hover{color:#1f2937;background:#f9fafb}.zcode-image-tab.active{color:var(--zcode-color-edit);border-bottom-color:var(--zcode-color-edit)}.zcode-image-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:16px;padding:24px;overflow-y:auto;flex:1}.zcode-image-name{padding:8px;font-size:12px;color:#374151;text-align:center;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;max-width:100%}.zcode-image-add{padding:16px 24px;border-top:1px solid #e5e7eb;background:#f9fafb}.zcode-image-add-btn{width:100%;padding:10px 16px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:8px}.zcode-image-add-btn:hover{background:var(--zcode-color-edit-hover)}.zcode-image-modal-actions{display:flex;gap:8px;padding:16px 24px;border-top:1px solid #e5e7eb;background:#fff}.zcode-image-modal-actions-btn{flex:1}.zcode-dev-container{width:100%;min-height:100vh;display:flex;flex-direction:column;position:relative}.zcode-cms-container.zcode-dev-padding{padding-right:375px}@media(max-width:768px){.zcode-cms-container.zcode-dev-padding{padding-right:0;padding-bottom:60vh}.zcode-dev-header{flex-direction:column;align-items:stretch;padding:0;gap:8px;background:none;border-bottom:none;box-shadow:none}.zcode-dev-tab{border-bottom:1px solid #e5e7eb}}.zcode-dev-container>zcode-cms{display:block}.zcode-loading-message{padding:40px;text-align:center;color:#6b7280}.zcode-loading-message-text{margin:8px 0;font-size:14px}.zcode-dev-tabs{display:flex;gap:8px;padding:0;flex-shrink:0;width:100%;box-sizing:border-box;background:#f9fafb;justify-content:space-between}.zcode-dev-tab{padding:10px 20px;border:1px solid #d1d5db;border-radius:6px;background:#fff;cursor:pointer;font-weight:500;font-size:14px;transition:background .15s ease,border-color .15s ease,color .15s ease,box-shadow .15s ease;display:flex;align-items:center;gap:6px;color:#6b7280;flex:1 1 0;justify-content:center;text-align:center}.zcode-dev-settings-btn{flex:0 0 auto;padding:6px;min-width:32px;justify-content:center;border-radius:4px;font-size:12px}.zcode-dev-tab:hover{background:#f3f4f6;border-color:#9ca3af;box-shadow:0 1px 3px #0f172a14}.zcode-dev-tab.active{background:var(--zcode-color-edit);color:#fff;border-color:var(--zcode-color-edit);font-weight:600;box-shadow:0 2px 6px #2563eb40}@media(max-width:768px){.zcode-dev-tabs{display:grid;grid-template-columns:repeat(2,1fr);gap:6px;background:transparent}.zcode-dev-tab{width:auto;flex:none;justify-content:flex-start;text-align:left;padding:10px 12px;font-size:13px}.zcode-dev-tab.zcode-dev-settings-btn{display:none}}.zcode-dev-settings-btn-fixed{display:none}@media(max-width:768px){.zcode-dev-settings-btn-fixed{position:fixed;bottom:20px;right:20px;width:48px;height:48px;padding:0;border:2px solid #d1d5db;border-radius:50%;background:#fff;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;box-shadow:0 4px 12px #00000040;z-index:1000;transition:all .2s ease}.zcode-dev-settings-btn-fixed:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-dev-settings-btn-fixed svg{width:20px;height:20px}}.zcode-parts-manager{width:100%;background:#fff}.zcode-parts-manager-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center}.zcode-parts-manager-header-title{margin:0;font-size:18px;color:#1f2937}.zcode-parts-category-tabs,.zcode-images-category-tabs{display:flex;align-items:center;justify-content:space-between;gap:8px;padding:6px 12px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-parts-add-wrapper,.zcode-images-add-wrapper{display:flex;align-items:center;flex-shrink:0}.zcode-parts-category-tab-group,.zcode-images-category-tab-group{display:flex;gap:4px}.zcode-parts-manager-content{display:flex;flex-direction:column}.zcode-parts-list-header{padding:16px;border-bottom:1px solid #e5e7eb;display:flex;justify-content:space-between;align-items:center;background:#fff}.zcode-parts-list-header-title{margin:0;font-size:14px;font-weight:600;color:#1f2937}.zcode-parts-items{padding:16px}.zcode-part-item{padding:16px;border:1px solid #e5e7eb;border-radius:8px;cursor:pointer;transition:all .2s;background:#fff;height:100%;display:flex;flex-direction:column;position:relative}.zcode-part-item:hover{border-color:#d1d5db;box-shadow:0 2px 8px #0000001a}.zcode-part-item.zcode-reorder-source{border-color:var(--zcode-color-reorder);background:#f59e0b05;box-shadow:0 0 0 1px #f59e0b1a}.zcode-reorder-source-indicator{position:absolute;top:-10px;right:10px;background:var(--zcode-color-reorder);color:#fff;padding:2px 8px;border-radius:4px;font-size:11px;font-weight:600;z-index:10}.zcode-part-item-add{border:2px dashed #d1d5db;background:#f9fafb;display:flex;align-items:center;justify-content:center;min-height:120px;cursor:pointer}.zcode-part-item-add:hover{border-color:var(--zcode-color-add);background:var(--zcode-color-add-bg);transform:translateY(-2px)}.zcode-part-item-add-content{display:flex;flex-direction:column;align-items:center;gap:8px;color:#6b7280;font-size:14px;font-weight:500}.zcode-part-item-add:hover .zcode-part-item-add-content{color:var(--zcode-color-add)}.zcode-part-item-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:8px}.zcode-part-item-actions{display:flex;gap:4px;align-items:center}.zcode-action-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-action-btn:hover{background:#e5e7eb;color:#374151}.zcode-action-btn.active{background:var(--zcode-color-reorder);color:#fff}.zcode-action-btn.zcode-delete-btn:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-part-duplicate-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-part-duplicate-btn:hover{background:var(--zcode-color-add-bg);color:var(--zcode-color-add)}.zcode-part-type{font-weight:600;font-size:14px;color:#1f2937}.zcode-part-actions{display:flex;gap:4px}.zcode-part-edit-btn,.zcode-part-delete-btn,.zcode-module-delete-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-part-edit-btn:hover{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit)}.zcode-part-delete-btn:hover,.zcode-module-delete-btn:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-part-description{font-size:13px;color:#6b7280;margin-bottom:4px}.zcode-description-empty{color:#9ca3af;font-style:italic}.zcode-part-modules{font-size:12px;color:#9ca3af}.zcode-part-type-group{margin-bottom:24px}.zcode-part-type-title{display:flex;align-items:center;justify-content:space-between;gap:8px;font-size:16px;font-weight:600;color:#1f2937;margin:0 0 12px;padding-bottom:8px;border-bottom:2px solid #e5e7eb}.zcode-part-type-actions{display:flex;align-items:center;gap:4px}.zcode-part-type-edit-btn{padding:4px 8px;border:1px solid #e5e7eb;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;transition:all .2s}.zcode-part-type-edit-btn:hover{background:var(--zcode-color-edit-bg);border-color:var(--zcode-color-edit-border-hover);color:var(--zcode-color-edit)}.zcode-part-type-items{display:grid;grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:16px}.zcode-part-preview{margin-top:12px;padding:8px;border:1px solid #e5e7eb;border-radius:6px;background:#f9fafb;max-height:150px;overflow:hidden;flex:1;min-height:0}.zcode-part-preview-content{font-size:11px;line-height:1.4;pointer-events:none;transform:scale(.75);transform-origin:top left;width:133.33%}.zcode-required{color:#ef4444;margin-left:2px}.zcode-part-modal{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:2000;padding:20px}.zcode-part-modal-content{background:#fff;border-radius:8px;box-shadow:0 10px 40px #0003;width:100%;max-width:95vw;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-part-editor{display:flex;flex-direction:column;overflow:hidden;height:100%}.zcode-part-editor-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-part-editor-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-part-editor-form{flex:1;overflow-y:auto;padding:24px 24px 80px}.zcode-part-editor-main{display:grid;grid-template-columns:1fr 1fr;gap:24px;align-items:stretch;min-height:0}.zcode-part-editor-fields{display:flex;flex-direction:column;gap:16px}.zcode-part-editor-preview{border:1px solid #e5e7eb;border-radius:8px;padding:16px;background:#f9fafb;position:sticky;top:0;max-height:calc(90vh - 200px);display:flex;flex-direction:column}.zcode-part-editor-preview-title{margin:0 0 12px;font-size:14px;font-weight:600;color:#1f2937}.zcode-preview-module-selector{margin-bottom:12px}.zcode-select-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;cursor:pointer}.zcode-select-input:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-editing-preview-content{flex:1;overflow-y:auto;padding:12px;background:#fff;border-radius:6px;min-height:200px;transform:scale(.9);transform-origin:top left;width:111.11%}.zcode-preview-empty{flex:1;display:flex;align-items:center;justify-content:center;color:#9ca3af;font-size:14px}.zcode-preview-modal{position:fixed;inset:0;background:#000c;display:flex;align-items:center;justify-content:center;z-index:3000;padding:20px}.zcode-preview-modal-content{background:#fff;border-radius:8px;width:90%;max-width:1200px;max-height:90vh;display:flex;flex-direction:column;overflow:hidden}.zcode-preview-modal-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-preview-modal-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-preview-modal-body{padding:24px;overflow-y:auto;flex:1}.zcode-help-modal-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:10000;padding:20px}.zcode-help-modal{background:#fff;border-radius:8px;width:90%;max-width:800px;max-height:80vh;overflow:auto;box-shadow:0 20px 25px -5px #0000001a}.zcode-help-modal-header{display:flex;justify-content:space-between;align-items:center;padding:20px 24px;border-bottom:1px solid #e5e7eb;background:#f9fafb;position:sticky;top:0;z-index:1}.zcode-help-modal-header-title{margin:0;font-size:18px;font-weight:600;color:#1f2937;display:flex;align-items:center;gap:8px}.zcode-css-warning-modal-title-icon{color:#f59e0b;flex-shrink:0}.zcode-help-modal-body{padding:24px}.zcode-help-table{width:100%;border-collapse:collapse;margin-bottom:24px}.zcode-help-table-cell{padding:14px 16px;text-align:left;border-bottom:1px solid #e5e7eb;border-right:1px solid #e5e7eb;vertical-align:top}.zcode-help-table-cell:last-child{border-right:none}.zcode-help-table-header{background:#f9fafb;font-weight:600;color:#374151;font-size:13px;text-transform:uppercase;letter-spacing:.5px}.zcode-help-table-data{font-size:14px;color:#4b5563;line-height:1.6}.zcode-help-table-data:first-child{width:35%}.zcode-help-table-data:nth-child(2){width:30%}.zcode-help-table-data:nth-child(3){width:35%}.zcode-help-table-code{background:#f3f4f6;padding:3px 8px;border-radius:4px;font-size:13px;color:#dc2626;font-family:Courier New,Courier,monospace;white-space:nowrap;border:1px solid #e5e7eb}.zcode-help-table-row:hover{background:#fafafa}.zcode-help-section{background:#f9fafb;padding:12px 16px;border-radius:6px;border:1px solid #e5e7eb;margin-bottom:16px}.zcode-help-section:last-child{margin-bottom:0}.zcode-help-section-title{margin:0 0 8px;color:#374151;font-size:14px;font-weight:600}.zcode-help-section-list{margin:0;padding-left:0;list-style-position:inside}.zcode-help-section-item{margin-bottom:6px;color:#6b7280;font-size:13px;line-height:1.6}.zcode-help-section-item:last-child{margin-bottom:0}.zcode-help-section-code{background:#f3f4f6;padding:2px 6px;border-radius:3px;font-size:12px;color:#dc2626;font-family:Courier New,Courier,monospace;border:1px solid #e5e7eb}.zcode-slots-config{display:flex;flex-direction:column;gap:16px}.zcode-slot-config-item{border:1px solid #e5e7eb;border-radius:6px;padding:12px;background:#f9fafb}.zcode-slot-config-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px;padding-bottom:8px;border-bottom:1px solid #e5e7eb}.zcode-slot-config-header-title{font-size:14px;color:#1f2937}.zcode-slot-config-body{display:flex;flex-direction:column;gap:8px}.zcode-slot-config-body-label{font-size:12px;font-weight:600;color:#6b7280;margin-bottom:4px}.zcode-checkbox-group{display:flex;flex-direction:column;gap:6px}.zcode-checkbox-item{display:flex;align-items:center;gap:6px;cursor:pointer}.zcode-checkbox-item:hover{background-color:transparent}.zcode-checkbox{width:16px;height:16px;cursor:pointer;accent-color:var(--zcode-color-edit);flex-shrink:0}.zcode-checkbox-item span{font-size:13px;color:#374151;-webkit-user-select:none;user-select:none}.zcode-module-slots-config{margin-top:16px;padding-top:16px;border-top:1px solid #e5e7eb}.zcode-slot-add-section{margin-top:16px;padding:12px;border:1px dashed #d1d5db;border-radius:6px;background:#f9fafb}.zcode-slot-add-section-label{display:block;font-size:13px;font-weight:600;color:#374151;margin-bottom:8px}.zcode-slot-add-controls{display:flex;gap:8px;align-items:center}.zcode-select-input{flex:1;padding:8px 12px;border:1px solid #d1d5db;border-radius:4px;background:#fff;font-size:14px;color:#1f2937;cursor:pointer;transition:border-color .2s}.zcode-select-input:hover{border-color:#9ca3af}.zcode-select-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-select{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff;color:#1f2937;cursor:pointer;transition:border-color .2s}.zcode-select:hover{border-color:#9ca3af}.zcode-select:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-select[multiple]{padding:4px;cursor:default}.zcode-select-option{padding:6px 8px;border-radius:4px;margin:2px 0}.zcode-select-option:checked{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit)}.zcode-tag-editor{display:flex;flex-direction:column;gap:8px}.zcode-tag-preview{font-size:12px;color:#6b7280;padding:4px 8px;background-color:#f3f4f6;border-radius:4px;font-family:Courier New,monospace}.zcode-tag-preview code{background-color:transparent;padding:0;color:#374151;font-weight:600}.zcode-slot-add-empty{margin-top:16px;padding:12px;text-align:center;color:#6b7280;font-size:13px;font-style:italic}.zcode-module-slots-config-label{font-size:13px;font-weight:600;color:#374151;margin-bottom:8px;display:block}.zcode-form-hint{font-size:12px;color:#6b7280;margin-top:4px;margin-bottom:12px;font-style:italic}.zcode-btn-small{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s;font-size:12px}.zcode-btn-small:hover{background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-module-item.active{border-color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg)}.zcode-module-delete-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-module-delete-btn:hover:not(:disabled){background:var(--zcode-color-delete-bg);color:var(--zcode-color-delete)}.zcode-module-delete-btn:disabled{opacity:.4;cursor:not-allowed}.zcode-module-actions{display:flex;gap:4px;align-items:center}.zcode-module-duplicate-btn,.zcode-module-copy-btn{padding:4px 8px;border:none;border-radius:4px;background:#f3f4f6;color:#6b7280;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-module-duplicate-btn:hover:not(:disabled),.zcode-module-copy-btn:hover:not(:disabled){background:var(--zcode-color-add-bg);color:var(--zcode-color-add)}.zcode-module-copy-btn:disabled{opacity:.4;cursor:not-allowed}.zcode-form-field{margin-bottom:16px}.zcode-form-field-label{display:block;font-size:14px;font-weight:500;color:#374151;margin-bottom:6px}.zcode-form-field-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:6px}.zcode-form-field-header>.zcode-form-field-label:first-child{margin-bottom:0}.zcode-form-field-actions{display:flex;align-items:center;gap:8px}.zcode-help-btn{display:flex;align-items:center;justify-content:center;padding:4px;background:transparent;border:none;color:#6b7280;cursor:pointer;border-radius:4px;transition:all .2s}.zcode-help-btn:hover{color:#374151;background:transparent}.zcode-checkbox-label{display:flex;align-items:center;gap:6px;cursor:pointer;-webkit-user-select:none;user-select:none;margin-bottom:0}.zcode-checkbox-label-inline{margin-bottom:0}.zcode-checkbox-input{width:16px;height:16px;cursor:pointer;margin:0}.zcode-checkbox-label span{font-size:13px;color:#6b7280;font-weight:400}.zcode-text-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;transition:border-color .2s}.zcode-text-input:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-monaco-editor{width:100%;flex:1;min-height:0;display:flex;flex-direction:column}.zcode-monaco-editor .monaco-editor-wrapper{flex:1;min-height:0;display:flex;flex-direction:column}.zcode-monaco-editor .monaco-editor-container{border:1px solid #d1d5db;border-radius:4px;flex:1;min-height:0;max-height:none!important}.zcode-textarea{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;font-family:monospace;resize:vertical;transition:border-color .2s}.zcode-textarea:focus{outline:none;border-color:var(--zcode-color-edit)}.zcode-modules-list{margin-bottom:12px}.zcode-module-item{padding:12px;border:1px solid #e5e7eb;border-radius:6px;margin-bottom:12px;background:#f9fafb;cursor:pointer;transition:all .2s}.zcode-module-header{display:flex;justify-content:space-between;align-items:center;margin-bottom:12px}.zcode-module-title{font-weight:600;font-size:14px;color:#1f2937}.zcode-module-body{display:flex;flex-direction:column;gap:8px}.zcode-module-body-label{font-size:12px;font-weight:500;color:#6b7280}.zcode-part-editor-actions{display:flex;gap:8px;padding:16px 24px;border-top:1px solid #e5e7eb;background:#fff;flex-shrink:0}.zcode-part-editor-actions-btn{flex:1}.zcode-part-editor-actions-btn-primary,.zcode-btn-primary{padding:10px 20px;background:var(--zcode-color-edit);color:#fff;border:none;border-radius:6px;cursor:pointer;font-weight:600;font-size:14px;transition:background .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-parts-new-btn{padding:7px 12px;font-size:13px;border-radius:4px;white-space:nowrap;flex-shrink:0}.zcode-images-add-btn{padding:7px 12px;font-size:13px;border-radius:4px}.zcode-btn-primary:hover{background:var(--zcode-color-edit-hover)}.zcode-btn-secondary{padding:8px 16px;background:#f3f4f6;color:#374151;border:1px solid #d1d5db;border-radius:6px;cursor:pointer;font-weight:500;font-size:14px;transition:all .2s;display:flex;align-items:center;justify-content:center;gap:6px}.zcode-btn-secondary:hover{background:#e5e7eb;border-color:#9ca3af}.zcode-page-css-panel{width:100%;background:#fff;display:flex;flex-direction:column;height:100%;flex:1;min-height:0}.zcode-warning-banner{padding:16px;background:#fff3cd;border-bottom:1px solid #ffc107;display:flex;gap:12px}.zcode-warning-icon{font-size:20px;flex-shrink:0}.zcode-warning-content{flex:1}.zcode-warning-title{margin:0 0 8px;font-size:14px;font-weight:700;color:#856404}.zcode-warning-list{margin:0;padding-left:20px;font-size:13px;color:#856404;line-height:1.6}.zcode-warning-list li{margin-bottom:4px}.zcode-warning-list strong{font-weight:700}.zcode-warning-inline{padding:12px;background:#fff3cd;border:1px solid #ffc107;border-radius:6px;margin-bottom:16px;display:flex;gap:12px}.zcode-warning-inline .zcode-warning-icon{font-size:18px;flex-shrink:0}.zcode-warning-inline .zcode-warning-content{flex:1}.zcode-warning-inline .zcode-warning-title{margin:0 0 8px;font-size:13px;font-weight:700;color:#856404}.zcode-warning-inline .zcode-warning-text{font-size:12px;color:#856404;line-height:1.6}.zcode-warning-inline .zcode-warning-text ul{margin:0;padding-left:20px}.zcode-warning-inline .zcode-warning-text li{margin-bottom:4px}.zcode-css-warning-modal{max-width:500px}.zcode-css-warning-modal-footer{display:flex;flex-direction:column;justify-content:center;align-items:center;padding:16px 24px;border-top:1px solid #e5e7eb;background:#f9fafb}.zcode-css-warning-modal .zcode-warning-content{padding:0}.zcode-css-warning-modal .zcode-warning-list{margin:0;padding-left:20px;font-size:14px;color:#856404;line-height:1.8;list-style-type:disc;list-style-position:outside}.zcode-css-warning-modal .zcode-warning-list li{margin-bottom:8px;list-style-type:disc}.zcode-css-warning-modal .zcode-warning-list strong{font-weight:700;color:#92400e}.zcode-page-css-content{display:flex;flex:1;overflow:hidden}.zcode-page-css-parts-selector{width:280px;border-right:1px solid #e5e7eb;display:flex;flex-direction:column;overflow:hidden;background:#f9fafb}.zcode-search-box{padding:12px;border-bottom:1px solid #e5e7eb;background:#fff}.zcode-search-input{width:100%;padding:8px 12px;border:1px solid #d1d5db;border-radius:6px;font-size:14px;background:#fff}.zcode-search-input:focus{outline:none;border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f61a}.zcode-parts-list{flex:1;overflow-y:auto;padding:12px}.zcode-parts-section{margin-bottom:24px}.zcode-parts-section:last-child{margin-bottom:0}.zcode-parts-section-title{margin:0 0 8px;padding:8px 12px;font-size:12px;font-weight:700;color:#6b7280;text-transform:uppercase;letter-spacing:.05em;background:#fff;border-radius:4px}.zcode-part-item{padding:12px;border:1px solid #e5e7eb;border-radius:6px;cursor:pointer;transition:all .2s;background:#fff;margin-bottom:8px}.zcode-part-item:hover{border-color:#d1d5db;box-shadow:0 2px 4px #0000000d}.zcode-part-item-selected{border-color:var(--zcode-color-edit);background:var(--zcode-color-edit-bg);box-shadow:0 0 0 2px #3b82f633}.zcode-part-item-title{font-size:14px;font-weight:600;color:#1f2937;margin-bottom:4px}.zcode-part-item-id{font-size:12px;color:#6b7280;font-family:monospace}.zcode-page-css-preview{flex:1;border-right:1px solid #e5e7eb;display:flex;flex-direction:column;overflow:hidden;background:#f9fafb}.zcode-preview-container{flex:1;overflow:auto;padding:24px}.zcode-preview-content{max-width:800px;margin:0 auto;background:#fff;padding:24px;border-radius:8px;box-shadow:0 2px 8px #0000001a}.zcode-preview-content [data-zcode-highlight=true]{outline:3px solid var(--zcode-color-edit);outline-offset:4px;background:var(--zcode-color-edit-bg)}.zcode-page-css-editor{width:100%;display:flex;flex-direction:column;overflow:hidden;background:#fff;flex:1;min-height:0}.zcode-page-css-editor .zcode-form-field{flex:1;display:flex;flex-direction:column;padding:16px;overflow:hidden}.zcode-page-css-editor .zcode-form-field label{margin-bottom:8px;font-size:14px;font-weight:600;color:#1f2937}.zcode-page-css-editor .monaco-editor-wrapper{flex:1;min-height:0}.zcode-page-css-editor .monaco-editor-container{height:100%;min-height:320px;max-height:none}.zcode-page-css-actions{padding:16px;border-top:1px solid #e5e7eb;display:flex;gap:8px;justify-content:flex-end;flex-shrink:0}.zcode-page-css-actions .zcode-btn-primary,.zcode-page-css-actions .zcode-btn-secondary{flex:1}.zcode-images-manager{width:100%;background:#fff}.zcode-images-manager-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center}.zcode-images-manager-header-title{margin:0;font-size:18px;color:#1f2937}.zcode-images-manager-content{display:flex;flex-direction:column}.zcode-images-grid{padding:16px;display:grid;grid-template-columns:repeat(auto-fill,minmax(150px,1fr));gap:16px;align-content:start}.zcode-image-item{position:relative;border:2px solid #e5e7eb;border-radius:8px;cursor:pointer;background:#f9fafb;display:flex;flex-direction:column;overflow:hidden}.zcode-image-item>img{width:100%;height:150px;object-fit:cover;display:block;flex-shrink:0}.zcode-image-item:hover{border-color:#d1d5db;box-shadow:0 2px 8px #0000001a}.zcode-image-item.zcode-reorder-source{border-color:var(--zcode-color-reorder);background:#f59e0b05;box-shadow:0 0 0 1px #f59e0b1a}.zcode-image-item.selected{border-color:var(--zcode-color-edit);box-shadow:0 0 0 3px #3b82f633}.zcode-image-item-clickable{cursor:pointer}.zcode-image-item-img{width:100%;height:150px;object-fit:cover;display:block}.zcode-image-item-overlay{position:absolute;inset:0;pointer-events:none}.zcode-image-item-actions{position:absolute;top:8px;right:8px;display:flex;gap:4px;opacity:0;pointer-events:auto}.zcode-image-item:hover .zcode-image-item-actions{opacity:1}.zcode-image-edit-btn,.zcode-image-delete-btn{padding:8px;border:none;border-radius:4px;background:#ffffffe6;color:#374151;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:all .2s}.zcode-image-edit-btn:hover{background:#fff;color:var(--zcode-color-edit)}.zcode-image-delete-btn:hover{background:#fff;color:var(--zcode-color-delete)}.zcode-image-item-name{padding:8px;font-size:12px;color:#374151;text-align:center;background:#fff;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;word-break:break-all;overflow-wrap:break-word;max-width:100%}.zcode-image-editor-panel{position:static;width:auto;height:auto;background:transparent;box-shadow:none;display:block;z-index:auto}.zcode-image-editor-header{padding:16px;border-bottom:1px solid #e5e7eb;background:#f9fafb;display:flex;justify-content:space-between;align-items:center;flex-shrink:0}.zcode-image-editor-header-title{margin:0;font-size:16px;color:#1f2937}.zcode-image-editor-form{flex:1;overflow-y:auto;padding:16px}.zcode-image-preview-large{margin-bottom:16px;border:1px solid #e5e7eb;border-radius:6px;padding:8px;background:#f9fafb;display:flex;justify-content:center;align-items:center}.zcode-image-preview-large-img{max-width:100%;max-height:200px;object-fit:contain;border-radius:4px}.zcode-image-editor-actions{display:flex;gap:8px;margin-top:16px;padding-top:16px;border-top:1px solid #e5e7eb}.zcode-image-editor-actions-btn{flex:1}@media(max-width:768px){.zcode-part-type-items{grid-template-columns:repeat(auto-fill,minmax(200px,1fr));gap:12px}.zcode-part-modal{padding:10px}.zcode-part-modal-content{max-width:100%;max-height:95vh}.zcode-part-editor-main,.zcode-part-editor-topfields{grid-template-columns:1fr}.zcode-part-editor-preview{position:relative;max-height:400px}.zcode-images-grid{grid-template-columns:repeat(auto-fill,minmax(120px,1fr));gap:12px}}.zcode-data-viewer{border-top:1px solid #e5e7eb;background:#fff;display:flex;flex-direction:column;min-height:200px;flex-shrink:0;height:100%;overflow:hidden}.zcode-data-viewer-header{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px;padding:8px;border-bottom:1px solid #e5e7eb;background:#f9fafb}.zcode-data-viewer-content-tabs{display:flex;gap:4px}.zcode-data-viewer-content-tab{padding:6px 12px;font-size:13px;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;font-weight:500;transition:all .2s}.zcode-data-viewer-content-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-data-viewer-content-tab.active{background:var(--zcode-color-edit);color:#fff;border-color:var(--zcode-color-edit)}.zcode-data-viewer-tabs{display:flex;gap:4px;align-items:center}.zcode-data-viewer-tab{padding:6px 12px;font-size:13px;border:1px solid #d1d5db;border-radius:6px;background:#fff;color:#6b7280;cursor:pointer;font-weight:500;transition:all .2s}.zcode-data-viewer-tab:hover{background:#f3f4f6;border-color:#9ca3af}.zcode-data-viewer-tab.active{background:var(--zcode-color-add);color:#fff;border-color:var(--zcode-color-add)}.zcode-data-viewer-error{padding:12px 16px;background:#fee;color:#c33;border-bottom:1px solid #e5e7eb;font-size:13px}.zcode-data-viewer-content{flex:1;overflow:auto;position:relative}.zcode-data-viewer-display-wrapper{position:relative;width:100%;height:100%}.zcode-data-viewer-display{margin:0;padding:16px;font-family:Monaco,Menlo,Ubuntu Mono,monospace;font-size:13px;line-height:1.6;color:#f9fafb;background:#111827;white-space:pre;overflow-x:auto;border-top:1px solid #374151}.zcode-data-viewer-copy-btn{position:absolute;top:12px;right:12px;display:flex;align-items:center;justify-content:center;width:32px;height:32px;border:1px solid rgba(255,255,255,.2);border-radius:4px;background:#111827cc;color:#f9fafb;cursor:pointer;transition:all .2s;z-index:10}.zcode-data-viewer-copy-btn:hover{background:#111827f2;border-color:#ffffff4d;color:#fff}.zcode-data-viewer-copy-btn:active{transform:scale(.95)}.zcode-input-readonly,.zcode-textarea-readonly{display:none}.zcode-dev-container .zcode-input-readonly,.zcode-dev-container .zcode-textarea-readonly{display:block;background-color:#f3f4f6;color:#6b7280;border-color:#d1d5db;cursor:default;pointer-events:none}.zcode-context-menu{position:fixed;background:#fff;border:1px solid #e5e7eb;border-radius:6px;box-shadow:0 4px 12px #00000026;padding:4px;z-index:10000;min-width:160px}.zcode-context-menu-item{display:flex;align-items:center;gap:8px;width:100%;padding:8px 12px;border:none;background:transparent;text-align:left;cursor:pointer;border-radius:4px;font-size:14px;color:#374151;transition:background .2s}.zcode-context-menu-item:hover{background:#f3f4f6}.zcode-context-menu-item.active{background:var(--zcode-color-edit-bg);color:var(--zcode-color-edit);font-weight:500}.zcode-context-menu-divider{height:1px;background:#e5e7eb;margin:4px 0}.zcode-save-confirm-dialog-overlay{position:fixed;inset:0;background:#00000080;display:flex;align-items:center;justify-content:center;z-index:10000}.zcode-save-confirm-dialog{background:#fff;border-radius:8px;box-shadow:0 10px 25px #0003;max-width:500px;width:90%;max-height:80vh;display:flex;flex-direction:column}.zcode-save-confirm-dialog-header{padding:16px 20px;border-bottom:1px solid #e5e7eb}.zcode-save-confirm-dialog-title{font-size:18px;font-weight:600;color:#111827}.zcode-save-confirm-dialog-body{padding:20px;flex:1;overflow-y:auto}.zcode-save-confirm-dialog-body p{margin:0 0 12px;font-size:14px;color:#374151}.zcode-save-confirm-targets{list-style:none;padding:0;margin:12px 0}.zcode-save-confirm-targets li{padding:8px 12px;background:#f9fafb;border-radius:4px;margin-bottom:8px;font-size:14px;color:#374151}.zcode-save-confirm-targets li:last-child{margin-bottom:0}.zcode-save-confirm-dialog-footer{padding:16px 20px;border-top:1px solid #e5e7eb;display:flex;justify-content:flex-end;gap:12px}.zcode-btn-secondary{padding:8px 16px;background:#fff;border:1px solid #d1d5db;border-radius:6px;font-size:14px;cursor:pointer;color:#374151;transition:background-color .2s,border-color .2s}.zcode-btn-secondary:hover{background:#f9fafb;border-color:#9ca3af}.zcode-btn-primary{padding:8px 16px;background:#3b82f6;border:none;border-radius:6px;font-size:14px;cursor:pointer;color:#fff;transition:background-color .2s}.zcode-btn-primary:hover{background:#2563eb}@media(max-width:768px){.zcode-save-confirm-dialog{width:95%;max-height:90vh}.zcode-save-confirm-dialog-header{padding:12px 16px}.zcode-save-confirm-dialog-body{padding:16px}.zcode-save-confirm-dialog-footer{padding:12px 16px;flex-direction:column-reverse}.zcode-btn-secondary,.zcode-btn-primary{width:100%}.zcode-text-input,.zcode-textarea,.zcode-select,select{font-size:16px}}",eT={common:{close:"閉じる",save:"保存",cancel:"キャンセル",delete:"削除",edit:"編集",add:"追加",reorder:"並べ替え",preview:"プレビュー",settings:"設定",manage:"管理",view:"表示",confirm:"確定",clear:"クリア",select:"選択",replace:"差し替え",copy:"コピー",copied:"コピーしました"},toolbar:{editMode:"編集",addMode:"追加",reorderMode:"並べ替え",deleteMode:"削除",viewMode:"表示",settings:"設定"},settings:{title:"設定",language:{label:"言語",ja:"日本語",en:"English"},enableDynamicContent:"ページの動作を有効にする",enableDynamicContentDescription:"アコーディオン、タブ、モーダル、リンクなどの動的コンテンツの動作を有効にします。",devRightPadding:"編集パネル分の余白をつける",devRightPaddingDescription:"編集パネル表示時にコンテンツの右側に余白を追加します。",enableContextMenu:"右クリックメニューを有効にする",enableContextMenuDescription:"コンテンツ上で右クリックすると、編集・追加・並べ替え・削除のモードを切り替えるメニューが表示されます。",showSaveConfirm:"保存時の確認ダイアログを表示する",showSaveConfirmDescription:"保存ボタンをクリックした際に、保存対象を確認するダイアログを表示します。",previewModeInfo:"表示モードでは動的コンテンツ(アコーディオン、タブ、モーダル、リンクなど)は常に有効です。",noSettings:"設定項目はありません。"},addPanel:{title:"追加",selectParent:"親要素を選択",category:{common:"共通",individual:"個別",selected:"選択したパーツ"},typeAll:"all",activeParts:"active parts",activePartsDescription:"プレビューエリアでクリックしたパーツを、現在のデータを含む状態で追加できます。",clickPartInPreview:"プレビューエリアでパーツをクリックしてください",noPartsAvailable:"利用可能なパーツがありません",addBefore:"前に追加",addAfter:"後に追加",continueAdding:"パーツ追加を続ける"},editPanel:{title:"編集中",editing:"編集中: {type}",id:"ID: {id}",selectImage:"画像を選択",replaceImage:"差し替え",clearImage:"クリア",clearImageTitle:"画像をクリア",noFields:"編集可能なフィールドがありません"},deletePanel:{title:"削除確認",confirmMessage:"このパーツを削除しますか?",selectParent:"親要素を選択"},reorderPanel:{title:"並べ替え: 移動元を選択中",instruction:"移動先の要素をクリックしてください",source:"移動元: {path}",selectParent:"親要素を選択"},saveConfirm:{title:"保存の確認",message:"以下のデータを保存しますか?",simpleMessage:"保存しますか?",targets:{page:"ページデータ","parts-common":"パーツ(共通)","parts-individual":"パーツ(個別)","parts-special":"パーツ(特別)","parts-common-css":"CSS(共通)","parts-individual-css":"CSS(個別)","parts-special-css":"CSS(特別)","images-common":"画像(共通)","images-individual":"画像(個別)","images-special":"画像(特別)"},saveButton:"保存する"},partsManager:{createType:"タイプ追加",editType:"タイプ編集",typeName:"タイプ名",typeDescription:"説明",typeNamePlaceholder:"例: hero, features",typeDescriptionPlaceholder:"タイプの説明",editPart:"パーツ編集: {title}",partTitle:"タイトル",partDescription:"説明",partDescriptionPlaceholder:"パーツの説明",deletePartConfirm:`パーツ {number} を削除しますか?
467
467
  (タイプには他のパーツが残ります)`,deleteTypeConfirm:"このタイプを削除しますか?",deleteTypeWithUsagesConfirm:"タイプ「{type}」は{count}箇所で使用されています。削除しますか?",deleteSlotConfirm:"スロット「{slotName}」を削除しますか?",selectImage:"画像選択",addPart:"パーツを追加",editTypeButton:"タイプ全体を編集",reorderType:"タイプを並べ替え",deleteTypeButton:"このタイプを削除(全パーツ含む)",editPartButton:"パーツを編集",reorderPart:"並べ替え",deletePartButton:"削除",source:"移動元",noDescription:"説明なし",partNumber:"パーツ {current} / {total}",allowedParts:"許可されるパーツ",searchParts:"パーツを検索...",addSlot:"スロットを追加",selectSlot:"スロットを選択...",defaultSlot:"デフォルトスロット",codeEdit:"コード編集",cssEditInfo:"CSS編集について",templateSuggestions:"予測変換",preview:"プレビュー:",cssEditWarning:"CSS編集について",cssEditWarningMessageCommon:"ここで編集したCSSは、すべてのページに適用される想定です。既存のCSSファイル(common.cssなど)がある場合、それらを上書きする可能性があります。",cssEditWarningMessageIndividual:"ここで編集したCSSは、ページタイプごとに適用される想定です。既存のCSSファイル(page.cssなど)がある場合、それらを上書きする可能性があります。",cssEditWarningMessageSpecial:"ここで編集したCSSは、動的ページごとに適用される想定です。既存のCSSファイル(shop111.cssなど)がある場合、それらを上書きする可能性があります。",understood:"了解しました",dontShowAgain:"次回から表示しない",templateHelp:{textField:"テキストフィールド",richText:"リッチテキスト",textarea:"複数行テキスト",image:"画像選択",radio:"ラジオボタン",checkbox:"チェックボックス",selectSingle:"セレクトボックス(単一選択)",selectMultiple:"セレクトボックス(複数選択)",conditional:"条件分岐(表示/非表示)",slot:"スロット(子要素挿入)",note:"補足",suggestionNote:"予測変換を有効にすると、<code>$</code>、<code>(</code>、<code>z</code>を入力時に自動補完が表示されます",fieldNameNote:"フィールド名は英数字とアンダースコアが使用できます",defaultValueNote:"デフォルト値は省略可能です(空文字になります)"},validationError:"エラー:",dangerousTagWarning:"<{tag}> タグが含まれています。",dangerousAttrWarning:"{attr} 属性が含まれています。",slotSettings:"スロット設定",slot:"スロット",templateHelpButton:"テンプレート記法のヘルプ",clickToEnlarge:"クリックで拡大"},imagesManager:{addImage:"画像追加",editImage:"画像編集",imageId:"画像ID",imageName:"画像名",altText:"Alt属性",deleteImageConfirm:"この画像を削除しますか?",deleteImageWithUsagesConfirm:"この画像は{count}箇所で使用されています。削除しますか?",deleteImageFromModalConfirm:"この画像を削除しますか?",addImageFailed:"画像の追加に失敗しました",selectImage:"画像を選択",currentlySelected:"現在選択中",select:"選択"},dataViewer:{page:"ページ",parts:"パーツ",images:"画像",common:"共通",individual:"個別",special:"特別",json:"JSON",html:"HTML",categoryInfo:{title:"カテゴリの役割について",common:{title:"共通",description:"サイト全体で共有されるパーツ・画像を想定しています。すべてのページで使用できる想定です。"},individual:{title:"個別",description:"ページタイプごとに共有されるパーツ・画像を想定しています。同じページタイプのすべてのページで使用できる想定です。"},special:{title:"特別",description:"動的ページ(例:店舗ごと、商品ごと)や特定の条件で使用されるパーツ・画像を想定しています。ルートモデルバインディングなどで動的に生成されるページで使用できる想定です。"}}},contextMenu:{edit:"編集",add:"追加",reorder:"並べ替え",delete:"削除",close:"閉じる"},editor:{pageManagement:"ページ管理",partsManagement:"パーツ管理",imagesManagement:"画像管理",dataViewer:"データビューアー",loading:"データを読み込み中..."}},tT={common:{close:"Close",save:"Save",cancel:"Cancel",delete:"Delete",edit:"Edit",add:"Add",reorder:"Reorder",preview:"Preview",settings:"Settings",manage:"Manage",view:"View",confirm:"Confirm",clear:"Clear",select:"Select",replace:"Replace",copy:"Copy",copied:"Copied"},toolbar:{editMode:"Edit",addMode:"Add",reorderMode:"Reorder",deleteMode:"Delete",viewMode:"View",settings:"Settings"},settings:{title:"Settings",language:{label:"Language",ja:"Japanese",en:"English"},enableDynamicContent:"Enable page interactions",enableDynamicContentDescription:"Enables interactions for dynamic content such as accordions, tabs, modals, and links.",devRightPadding:"Add padding for edit panel",devRightPaddingDescription:"Adds right padding to content when the edit panel is displayed.",enableContextMenu:"Enable right-click menu",enableContextMenuDescription:"Right-clicking on content displays a menu to switch between edit, add, reorder, and delete modes.",showSaveConfirm:"Show save confirmation dialog",showSaveConfirmDescription:"Displays a dialog to confirm save targets when clicking the save button.",previewModeInfo:"Dynamic content (accordions, tabs, modals, links, etc.) is always enabled in preview mode.",noSettings:"No settings available."},addPanel:{title:"Add",selectParent:"Select parent element",category:{common:"Common",individual:"Individual",selected:"Selected part"},typeAll:"all",activeParts:"active parts",activePartsDescription:"You can add the part clicked in the preview area with its current data included.",clickPartInPreview:"Please click a part in the preview area",noPartsAvailable:"No parts available",addBefore:"Add before",addAfter:"Add after",continueAdding:"Continue adding parts"},editPanel:{title:"Editing",editing:"Editing: {type}",id:"ID: {id}",selectImage:"Select image",replaceImage:"Replace",clearImage:"Clear",clearImageTitle:"Clear image",noFields:"No editable fields available"},deletePanel:{title:"Delete confirmation",confirmMessage:"Do you want to delete this part?",selectParent:"Select parent element"},reorderPanel:{title:"Reorder: Source selected",instruction:"Click the destination element",source:"Source: {path}",selectParent:"Select parent element"},saveConfirm:{title:"Save confirmation",message:"Do you want to save the following data?",simpleMessage:"Do you want to save?",targets:{page:"Page data","parts-common":"Parts (Common)","parts-individual":"Parts (Individual)","parts-special":"Parts (Special)","images-common":"Images (Common)","images-individual":"Images (Individual)","images-special":"Images (Special)","parts-common-css":"CSS (Common)","parts-individual-css":"CSS (Individual)","parts-special-css":"CSS (Special)"},saveButton:"Save"},partsManager:{createType:"Create new type",editType:"Edit type",typeName:"Type name",typeDescription:"Description",typeNamePlaceholder:"Example: hero, features",typeDescriptionPlaceholder:"Type description",editPart:"Edit part: {title}",partTitle:"Title",partDescription:"Description",partDescriptionPlaceholder:"Part description",deletePartConfirm:`Do you want to delete part {number}?
468
- (Other parts in the type will remain)`,deleteTypeConfirm:"Do you want to delete this type?",deleteTypeWithUsagesConfirm:'Type "{type}" is used in {count} places. Do you want to delete it?',deleteSlotConfirm:'Do you want to delete slot "{slotName}"?',selectImage:"Select image",addPart:"Add part",editTypeButton:"Edit type",reorderType:"Reorder type",deleteTypeButton:"Delete this type (all parts included)",editPartButton:"Edit part",reorderPart:"Reorder",deletePartButton:"Delete",source:"Source",noDescription:"No description",partNumber:"Part {current} / {total}",allowedParts:"Allowed parts",searchParts:"Search parts...",addSlot:"Add slot",selectSlot:"Select slot...",defaultSlot:"Default slot",codeEdit:"Code editor",cssEditInfo:"About CSS editing",templateSuggestions:"Template suggestions",preview:"Preview:",cssEditWarning:"About CSS editing",cssEditWarningMessageCommon:"CSS edited here is intended to apply to all pages. If existing CSS files (e.g., common.css) exist, they may be overwritten.",cssEditWarningMessageIndividual:"CSS edited here is intended to apply per page type. If existing CSS files (e.g., page.css) exist, they may be overwritten.",cssEditWarningMessageSpecial:"CSS edited here is intended to apply per dynamic page. If existing CSS files (e.g., shop111.css) exist, they may be overwritten.",dontShowAgain:"Don't show again",templateHelp:{textField:"Text field",richText:"Rich text",textarea:"Multi-line text",image:"Image selection",radio:"Radio button",checkbox:"Checkbox",selectSingle:"Select box (single)",selectMultiple:"Select box (multiple)",conditional:"Conditional (show/hide)",slot:"Slot (child insertion)",note:"Note",suggestionNote:"When template suggestions are enabled, autocomplete will appear when typing <code>$</code>, <code>(</code>, or <code>z</code>",fieldNameNote:"Field names can use alphanumeric characters and underscores",defaultValueNote:"Default values are optional (will be empty string if omitted)"},validationError:"Error:",dangerousTagWarning:"<{tag}> tag is included.",dangerousAttrWarning:"{attr} attribute is included.",slotSettings:"Slot settings",slot:"Slot",templateHelpTitle:"Template Syntax Help",clickToEnlarge:"Click to enlarge",understood:"Understood",syntax:"Syntax",description:"Description",example:"Example",templateHelpButton:"Template syntax help"},imagesManager:{addImage:"Add image",editImage:"Edit image",imageId:"Image ID",imageName:"Image name",altText:"Alt attribute",deleteImageConfirm:"Do you want to delete this image?",deleteImageWithUsagesConfirm:"This image is used in {count} places. Do you want to delete it?",deleteImageFromModalConfirm:"Do you want to delete this image?",addImageFailed:"Failed to add image",selectImage:"Select image",currentlySelected:"Currently selected",select:"Select"},dataViewer:{page:"Page",parts:"Parts",images:"Images",common:"Common",individual:"Individual",special:"Special",json:"JSON",html:"HTML",categoryInfo:{title:"About Category Roles",common:{title:"Common",description:"Intended for parts and images shared across the entire site. Assumed to be usable on all pages."},individual:{title:"Individual",description:"Intended for parts and images shared per page type. Assumed to be usable on all pages of the same page type."},special:{title:"Special",description:"Intended for parts and images used for dynamic pages (e.g., per store, per product) or under specific conditions. Assumed to be usable on pages dynamically generated with route model binding, etc."}}},contextMenu:{edit:"Edit",add:"Add",reorder:"Reorder",delete:"Delete",close:"Close"},editor:{pageManagement:"Page Management",partsManagement:"Parts Management",imagesManagement:"Images Management",dataViewer:"Data Viewer",loading:"Loading data...",saveFailed:"Save failed",saveFailedWithCount:"Save failed ({count} items)",saveFailedWithMessage:"Save failed ({count} items): {message}",noSaveTargets:"No save targets"}};function nT(t="ja"){return o1({locale:t,fallbackLocale:"ja",messages:{ja:eT,en:tT},globalInjection:!0})}const Nm={UNDEFINED_PROPERTIES:"Cannot read properties of undefined",APP_REFERENCE:"app"};function Cm(){if(typeof window>"u")return;const t=window;t.__zcodeI18nErrorHandlerSetup||(window.addEventListener("unhandledrejection",e=>{if(e.reason&&typeof e.reason=="object"&&"message"in e.reason){const n=String(e.reason.message);if(n.includes(Nm.UNDEFINED_PROPERTIES)&&n.includes(Nm.APP_REFERENCE)){e.preventDefault();return}}}),t.__zcodeI18nErrorHandlerSetup=!0)}function oT(){if(typeof window>"u")return;const t=window;t.__VUE_I18N_FULL_INSTALL__=!1,t.__INTLIFY_PROD_DEVTOOLS__=!1,t.__VUE_I18N_PROD_DEVTOOLS__=!1}function Ws(t,e="ja"){const n=p1(null);if(n)return n;const o=t.getAttribute("locale");return o==="ja"||o==="en"?o:e}function Gs(t,e){oT();const n=nT(e);try{t.use(n)}catch(o){console.warn("[ZeroCode] Failed to setup i18n:",o)}}Cm();class rT extends HTMLElement{app=null;componentInstance=null;_shadowRoot=null;constructor(){super()}connectedCallback(){if(this.app)return;this.getAttribute("use-shadow-dom")!=="false"?(this.setupShadowDOM(),window.addEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this))):(this.setupLightDOM(),window.addEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this)))}setupLightDOM(){const e=this.getAttribute("page")||"[]",n=this.getAttribute("css-common"),o=this.getAttribute("css-individual"),r=this.getAttribute("css-special"),i=this.getAttribute("parts-common")||"[]",s=this.getAttribute("parts-individual")||"[]",l=this.getAttribute("parts-special")||"[]",c=this.getAttribute("images-common")||"[]",d=this.getAttribute("images-individual")||"[]",u=this.getAttribute("images-special")||"[]",f=Array.from(this.querySelectorAll('[slot="script"]'));f.length>0&&(this.__savedScriptSlots=f.map(h=>({src:h.src,type:h.type,async:h.async,defer:h.defer,integrity:h.integrity,crossOrigin:h.crossOrigin})));const p=Ws(this);this.app=a.createApp(Hs,{locale:p,page:e,cssCommon:n,cssIndividual:o,cssSpecial:r,partsCommon:i,partsIndividual:s,partsSpecial:l,imagesCommon:c,imagesIndividual:d,imagesSpecial:u,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||""}),Gs(this.app,p),this.componentInstance=this.app.mount(this),this.injectLightDOMCSS()}setupShadowDOM(){const e=this.shadowRoot,n=!!e;e?(this._shadowRoot=e,this.clearScripts()):(this._shadowRoot=this.attachShadow({mode:"open"}),this.injectCSS());const o=this.getAttribute("page")||"[]",r=this.getAttribute("css-common"),i=this.getAttribute("css-individual"),s=this.getAttribute("css-special"),l=this.getAttribute("parts-common")||"[]",c=this.getAttribute("parts-individual")||"[]",d=this.getAttribute("parts-special")||"[]",u=this.getAttribute("images-common")||"[]",f=this.getAttribute("images-individual")||"[]",p=this.getAttribute("images-special")||"[]",h=Ws(this);this.app=a.createApp(Hs,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:s,partsCommon:l,partsIndividual:c,partsSpecial:d,imagesCommon:u,imagesIndividual:f,imagesSpecial:p,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||""}),Gs(this.app,h),this.componentInstance=this.app.mount(this._shadowRoot),requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(()=>{this.injectScript(n)},100)})})}injectCSS(){if(!this._shadowRoot)return;const e=document.createElement("style");e.textContent=Sm,this._shadowRoot.appendChild(e),this.querySelectorAll('[slot="css"]').forEach(o=>{const r=o.cloneNode(!0);r.removeAttribute("slot"),this._shadowRoot.appendChild(r),o.remove()})}injectLightDOMCSS(){this.querySelectorAll('[slot="css"]').forEach(n=>{const o=n.cloneNode(!0);o.removeAttribute("slot"),document.head.appendChild(o)})}clearScripts(){if(!this._shadowRoot)return;this._shadowRoot.querySelectorAll("script").forEach(n=>{n.remove()})}injectScript(e=!1){if(!this._shadowRoot)return;const n=this.querySelectorAll('[slot="script"]'),o=Array.from(n),r=[],i=[];o.forEach(c=>{const d=c;if(!d.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}d.src.includes("jquery")||d.src.includes("code.jquery.com")?r.push(d):i.push(d)});const s=c=>{let d=c.src;if(e)try{const f=new URL(c.src,window.location.href);f.searchParams.set("_t",Date.now().toString()),d=f.toString()}catch{d=c.src+(c.src.includes("?")?"&":"?")+"_t="+Date.now()}const u=document.createElement("script");return u.src=d,c.type&&(u.type=c.type),c.async&&(u.async=!0),c.defer&&(u.defer=!0),c.integrity&&(u.integrity=c.integrity),c.crossOrigin&&(u.crossOrigin=c.crossOrigin),u.onerror=f=>{console.error(`Failed to load script: ${c.src}`,f)},u},l=()=>{o.forEach(c=>{c.remove()})};if(r.length>0){let c=0;const d=r.length;r.forEach(u=>{const f=s(u);f.onload=()=>{c++,c===d&&(Mo(this._shadowRoot,e),setTimeout(()=>{i.forEach(p=>{this._shadowRoot.appendChild(s(p))}),l()},50))},this._shadowRoot.appendChild(f)})}else Mo(this._shadowRoot,e),i.forEach(c=>{this._shadowRoot.appendChild(s(c))}),l()}injectLightDOMScripts(){let e=[];if(this.__savedScriptSlots&&this.__savedScriptSlots.length>0)e=this.__savedScriptSlots.map(i=>{const s=document.createElement("script");return s.src=i.src,i.type&&(s.type=i.type),i.async&&(s.async=!0),i.defer&&(s.defer=!0),i.integrity&&(s.integrity=i.integrity),i.crossOrigin&&(s.crossOrigin=i.crossOrigin),s});else{const i=this.querySelectorAll('[slot="script"]');e=Array.from(i)}const n=[],o=[];e.forEach(i=>{const s=i;if(!s.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}s.src.includes("jquery")||s.src.includes("code.jquery.com")?n.push(s):o.push(s)});const r=i=>{const s=document.createElement("script");return s.src=i.src,i.type&&(s.type=i.type),i.async&&(s.async=!0),i.defer&&(s.defer=!0),i.integrity&&(s.integrity=i.integrity),i.crossOrigin&&(s.crossOrigin=i.crossOrigin),s.onerror=l=>{console.error(`Failed to load script: ${i.src}`,l)},s};if(n.length>0){let i=0;const s=n.length;n.forEach(l=>{const c=r(l);c.onload=()=>{i++,i===s&&requestAnimationFrame(()=>{o.forEach(d=>{document.body.appendChild(r(d))})})},document.body.appendChild(c)})}else o.forEach(i=>{document.body.appendChild(r(i))})}getData(e){return this.componentInstance&&this.componentInstance.getData?this.componentInstance.getData(e):null}setData(e,n){return this.componentInstance&&this.componentInstance.setData?this.componentInstance.setData(e,n):!1}get allowDynamicContentInteraction(){if(this.componentInstance){const e=this.componentInstance.allowDynamicContentInteraction;if(e!==void 0)return e&&typeof e=="object"&&"value"in e?e.value:e}return!0}set allowDynamicContentInteraction(e){if(this.componentInstance){const n=this.componentInstance.allowDynamicContentInteraction;n!==void 0&&(n&&typeof n=="object"&&"value"in n?n.value=e:this.componentInstance.allowDynamicContentInteraction=e)}}disconnectedCallback(){if(this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot){if(this._shadowRoot.__zecEventListeners){const e=this._shadowRoot.__zecEventListeners,n=this._shadowRoot;e.forEach(o=>{o.forEach(r=>{n.removeEventListener(r.eventName,r.handler,!0)})}),e.clear()}if(window.__zecShadowRoots){const e=window.__zecShadowRoots,n=this._shadowRoot;for(const[o,r]of e.entries())r===n&&e.delete(o)}}this._shadowRoot=null,window.removeEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this)),window.removeEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this))}handleDOMUpdated(){if(!this._shadowRoot||this.getAttribute("use-shadow-dom")!=="true")return;this._shadowRoot.__zecJQueryExtended&&delete this._shadowRoot.__zecJQueryExtended;const e=this._shadowRoot.querySelector("script[data-zec-shadow-extension]");e&&e.remove(),Mo(this._shadowRoot,!0)}handleLightDOMUpdated(){this.getAttribute("use-shadow-dom")!=="true"&&(this.__lightDOMScriptsLoaded||(this.injectLightDOMScripts(),this.__lightDOMScriptsLoaded=!0))}static get observedAttributes(){return["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data","use-shadow-dom"]}attributeChangedCallback(e,n,o){if(n!==o){if(e==="use-shadow-dom"){this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot&&(this._shadowRoot.innerHTML="",this._shadowRoot=null),this.connectedCallback();return}this.app&&(this.app.unmount(),this.app=null,this.componentInstance=null,this.connectedCallback())}}}customElements.get("zcode-cms")||customElements.define("zcode-cms",rT);function iT(t){const{t:e}=rn(),n=a.ref("common"),o=a.ref(null),r=a.ref(null),i=a.ref(null),s=a.ref(null),l=a.ref(!1),c=a.ref(null),d=a.ref(null),{renderComponentToHtml:u}=fi(t,!1),f=a.computed(()=>{const C=t.parts;return n.value==="common"?C.common:n.value==="individual"?C.individual:C.special}),p=a.computed(()=>{const C=f.value,N=new Map;return C.forEach(O=>{N.has(O.type)||N.set(O.type,[]),O.parts.forEach((k,U)=>{N.get(O.type).push({type:O,partIndex:U})})}),Array.from(N.entries()).map(([O,k])=>({type:O,parts:k.map(U=>({...U.type,_partIndex:U.partIndex,_displayPart:U.type.parts[U.partIndex]}))}))});function h(){const C=t.parts;return n.value==="common"?C.common:n.value==="individual"?C.individual:C.special}function m(C){return f.value.find(N=>N.type===C)||null}function b(C){return i.value&&i.value.partIndex===C&&i.value.part.slots||null}function g(C,N,O){if(i.value&&i.value.partIndex===C){const k=i.value.part;return k.slots||(k.slots={}),O(k.slots),!0}return!1}function x(C){const N={};return C.forEach(O=>{if(O.optional)N[O.fieldName]=void 0;else switch(O.type){case"text":N[O.fieldName]=O.defaultValue||"";break;case"radio":N[O.fieldName]=O.options?.[0]||"";break;case"checkbox":N[O.fieldName]=[];break;case"boolean":N[O.fieldName]=!0;break;case"rich":N[O.fieldName]=O.defaultValue?`<p>${O.defaultValue}</p>`:"<p></p>";break;case"image":N[O.fieldName]=O.defaultValue||"";break}}),N}function v(C){o.value=C,r.value=null,l.value=!1}function w(){r.value=a.reactive({id:jn(),type:"",description:"",parts:[{id:jn(),title:"part_1",description:"",body:"<div>{$content:コンテンツを入力}</div>"}]}),s.value="type",l.value=!0,o.value=null}function T(C){r.value=a.reactive(JSON.parse(JSON.stringify(C))),s.value="type",l.value=!1,o.value=C}function M(C,N){const O=C.parts[N];if(!O)return;const k=JSON.parse(JSON.stringify(O));k.slots||(k.slots={}),i.value={type:a.reactive(JSON.parse(JSON.stringify(C))),partIndex:N,part:a.reactive(k)},s.value="part"}async function A(C){const N=m(C.type);if(!N)return;const O=a.reactive(JSON.parse(JSON.stringify(N))),k={id:jn(),title:`part_${O.parts.length+1}`,description:"",body:"<div>{$content:コンテンツを入力}</div>"};O.parts.push(k);const U=O.parts.length-1;await a.nextTick(),i.value={type:O,partIndex:U,part:a.reactive(JSON.parse(JSON.stringify(k))),isNewPart:!0},s.value="part"}async function y(){if(!r.value)return;const C=Le(r.value);if(!C.valid){alert(e("partsManager.validationError")+`
469
- `+C.errors.join(`
470
- `));return}const N=JSON.parse(JSON.stringify(a.toRaw(r.value))),O=h();if(l.value)O.push(N);else{const k=O.findIndex(U=>U.id===r.value.id);k!==-1&&(O[k]=N)}await a.nextTick(),f.value,p.value,r.value=null,s.value=null,l.value=!1}function E(C){const N=[],O=C.toLowerCase(),k=["script","iframe","object","embed"],U=["onclick","onerror","onload","onmouseover","onfocus","onblur"];return k.forEach(te=>{O.includes(`<${te}`)&&N.push(e("partsManager.dangerousTagWarning",{tag:te}))}),U.forEach(te=>{O.includes(`${te}=`)&&N.push(e("partsManager.dangerousAttrWarning",{attr:te}))}),{hasWarning:N.length>0,messages:N}}async function S(){if(!i.value)return;const C=i.value.part.body||"",N=E(C);if(N.hasWarning&&!confirm(`テンプレートにセキュリティ上注意が必要な記述が含まれています。
468
+ (Other parts in the type will remain)`,deleteTypeConfirm:"Do you want to delete this type?",deleteTypeWithUsagesConfirm:'Type "{type}" is used in {count} places. Do you want to delete it?',deleteSlotConfirm:'Do you want to delete slot "{slotName}"?',selectImage:"Select image",addPart:"Add part",editTypeButton:"Edit type",reorderType:"Reorder type",deleteTypeButton:"Delete this type (all parts included)",editPartButton:"Edit part",reorderPart:"Reorder",deletePartButton:"Delete",source:"Source",noDescription:"No description",partNumber:"Part {current} / {total}",allowedParts:"Allowed parts",searchParts:"Search parts...",addSlot:"Add slot",selectSlot:"Select slot...",defaultSlot:"Default slot",codeEdit:"Code editor",cssEditInfo:"About CSS editing",templateSuggestions:"Template suggestions",preview:"Preview:",cssEditWarning:"About CSS editing",cssEditWarningMessageCommon:"CSS edited here is intended to apply to all pages. If existing CSS files (e.g., common.css) exist, they may be overwritten.",cssEditWarningMessageIndividual:"CSS edited here is intended to apply per page type. If existing CSS files (e.g., page.css) exist, they may be overwritten.",cssEditWarningMessageSpecial:"CSS edited here is intended to apply per dynamic page. If existing CSS files (e.g., shop111.css) exist, they may be overwritten.",dontShowAgain:"Don't show again",templateHelp:{textField:"Text field",richText:"Rich text",textarea:"Multi-line text",image:"Image selection",radio:"Radio button",checkbox:"Checkbox",selectSingle:"Select box (single)",selectMultiple:"Select box (multiple)",conditional:"Conditional (show/hide)",slot:"Slot (child insertion)",note:"Note",suggestionNote:"When template suggestions are enabled, autocomplete will appear when typing <code>$</code>, <code>(</code>, or <code>z</code>",fieldNameNote:"Field names can use alphanumeric characters and underscores",defaultValueNote:"Default values are optional (will be empty string if omitted)"},validationError:"Error:",dangerousTagWarning:"<{tag}> tag is included.",dangerousAttrWarning:"{attr} attribute is included.",slotSettings:"Slot settings",slot:"Slot",templateHelpTitle:"Template Syntax Help",clickToEnlarge:"Click to enlarge",understood:"Understood",syntax:"Syntax",description:"Description",example:"Example",templateHelpButton:"Template syntax help"},imagesManager:{addImage:"Add image",editImage:"Edit image",imageId:"Image ID",imageName:"Image name",altText:"Alt attribute",deleteImageConfirm:"Do you want to delete this image?",deleteImageWithUsagesConfirm:"This image is used in {count} places. Do you want to delete it?",deleteImageFromModalConfirm:"Do you want to delete this image?",addImageFailed:"Failed to add image",selectImage:"Select image",currentlySelected:"Currently selected",select:"Select"},dataViewer:{page:"Page",parts:"Parts",images:"Images",common:"Common",individual:"Individual",special:"Special",json:"JSON",html:"HTML",categoryInfo:{title:"About Category Roles",common:{title:"Common",description:"Intended for parts and images shared across the entire site. Assumed to be usable on all pages."},individual:{title:"Individual",description:"Intended for parts and images shared per page type. Assumed to be usable on all pages of the same page type."},special:{title:"Special",description:"Intended for parts and images used for dynamic pages (e.g., per store, per product) or under specific conditions. Assumed to be usable on pages dynamically generated with route model binding, etc."}}},contextMenu:{edit:"Edit",add:"Add",reorder:"Reorder",delete:"Delete",close:"Close"},editor:{pageManagement:"Page Management",partsManagement:"Parts Management",imagesManagement:"Images Management",dataViewer:"Data Viewer",loading:"Loading data...",saveFailed:"Save failed",saveFailedWithCount:"Save failed ({count} items)",saveFailedWithMessage:"Save failed ({count} items): {message}",noSaveTargets:"No save targets"}};function nT(t="ja"){return o1({locale:t,fallbackLocale:"ja",messages:{ja:eT,en:tT},globalInjection:!0})}const Nm={UNDEFINED_PROPERTIES:"Cannot read properties of undefined",APP_REFERENCE:"app"};function Cm(){if(typeof window>"u")return;const t=window;t.__zcodeI18nErrorHandlerSetup||(window.addEventListener("unhandledrejection",e=>{if(e.reason&&typeof e.reason=="object"&&"message"in e.reason){const n=String(e.reason.message);if(n.includes(Nm.UNDEFINED_PROPERTIES)&&n.includes(Nm.APP_REFERENCE)){e.preventDefault();return}}}),t.__zcodeI18nErrorHandlerSetup=!0)}function oT(){if(typeof window>"u")return;const t=window;t.__VUE_I18N_FULL_INSTALL__=!1,t.__INTLIFY_PROD_DEVTOOLS__=!1,t.__VUE_I18N_PROD_DEVTOOLS__=!1}function Ws(t,e="ja"){const n=p1(null);if(n)return n;const o=t.getAttribute("locale");return o==="ja"||o==="en"?o:e}function Gs(t,e){oT();const n=nT(e);try{t.use(n)}catch(o){console.warn("[ZeroCode] Failed to setup i18n:",o)}}Cm();class rT extends HTMLElement{app=null;componentInstance=null;_shadowRoot=null;constructor(){super()}connectedCallback(){if(this.app)return;this.getAttribute("use-shadow-dom")!=="false"?(this.setupShadowDOM(),window.addEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this))):(this.setupLightDOM(),window.addEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this)))}setupLightDOM(){const e=this.getAttribute("page")||"[]",n=this.getAttribute("css-common"),o=this.getAttribute("css-individual"),r=this.getAttribute("css-special"),i=this.getAttribute("parts-common")||"[]",s=this.getAttribute("parts-individual")||"[]",l=this.getAttribute("parts-special")||"[]",c=this.getAttribute("images-common")||"[]",d=this.getAttribute("images-individual")||"[]",u=this.getAttribute("images-special")||"[]",f=Array.from(this.querySelectorAll('[slot="script"]'));f.length>0&&(this.__savedScriptSlots=f.map(h=>({src:h.src,type:h.type,async:h.async,defer:h.defer,integrity:h.integrity,crossOrigin:h.crossOrigin})));const p=Ws(this);this.app=a.createApp(Hs,{locale:p,page:e,cssCommon:n,cssIndividual:o,cssSpecial:r,partsCommon:i,partsIndividual:s,partsSpecial:l,imagesCommon:c,imagesIndividual:d,imagesSpecial:u,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||""}),Gs(this.app,p),this.componentInstance=this.app.mount(this),this.injectLightDOMCSS()}setupShadowDOM(){const e=this.shadowRoot,n=!!e;e?(this._shadowRoot=e,this.clearScripts()):(this._shadowRoot=this.attachShadow({mode:"open"}),this.injectCSS());const o=this.getAttribute("page")||"[]",r=this.getAttribute("css-common"),i=this.getAttribute("css-individual"),s=this.getAttribute("css-special"),l=this.getAttribute("parts-common")||"[]",c=this.getAttribute("parts-individual")||"[]",d=this.getAttribute("parts-special")||"[]",u=this.getAttribute("images-common")||"[]",f=this.getAttribute("images-individual")||"[]",p=this.getAttribute("images-special")||"[]",h=Ws(this);this.app=a.createApp(Hs,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:s,partsCommon:l,partsIndividual:c,partsSpecial:d,imagesCommon:u,imagesIndividual:f,imagesSpecial:p,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||""}),Gs(this.app,h),this.componentInstance=this.app.mount(this._shadowRoot),requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(()=>{this.injectScript(n)},100)})})}injectCSS(){if(!this._shadowRoot)return;const e=document.createElement("style");e.textContent=Sm,this._shadowRoot.appendChild(e),this.querySelectorAll('[slot="css"]').forEach(o=>{const r=o.cloneNode(!0);r.removeAttribute("slot"),this._shadowRoot.appendChild(r),o.remove()})}injectLightDOMCSS(){this.querySelectorAll('[slot="css"]').forEach(n=>{const o=n.cloneNode(!0);o.removeAttribute("slot"),document.head.appendChild(o)})}clearScripts(){if(!this._shadowRoot)return;this._shadowRoot.querySelectorAll("script").forEach(n=>{n.remove()})}injectScript(e=!1){if(!this._shadowRoot)return;const n=this.querySelectorAll('[slot="script"]'),o=Array.from(n),r=[],i=[];o.forEach(c=>{const d=c;if(!d.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}d.src.includes("jquery")||d.src.includes("code.jquery.com")?r.push(d):i.push(d)});const s=c=>{let d=c.src;if(e)try{const f=new URL(c.src,window.location.href);f.searchParams.set("_t",Date.now().toString()),d=f.toString()}catch{d=c.src+(c.src.includes("?")?"&":"?")+"_t="+Date.now()}const u=document.createElement("script");return u.src=d,c.type&&(u.type=c.type),c.async&&(u.async=!0),c.defer&&(u.defer=!0),c.integrity&&(u.integrity=c.integrity),c.crossOrigin&&(u.crossOrigin=c.crossOrigin),u.onerror=f=>{console.error(`Failed to load script: ${c.src}`,f)},u},l=()=>{o.forEach(c=>{c.remove()})};if(r.length>0){let c=0;const d=r.length;r.forEach(u=>{const f=s(u);f.onload=()=>{c++,c===d&&(Mo(this._shadowRoot,e),setTimeout(()=>{i.forEach(p=>{this._shadowRoot.appendChild(s(p))}),l()},50))},this._shadowRoot.appendChild(f)})}else Mo(this._shadowRoot,e),i.forEach(c=>{this._shadowRoot.appendChild(s(c))}),l()}injectLightDOMScripts(){let e=[];if(this.__savedScriptSlots&&this.__savedScriptSlots.length>0)e=this.__savedScriptSlots.map(i=>{const s=document.createElement("script");return s.src=i.src,i.type&&(s.type=i.type),i.async&&(s.async=!0),i.defer&&(s.defer=!0),i.integrity&&(s.integrity=i.integrity),i.crossOrigin&&(s.crossOrigin=i.crossOrigin),s});else{const i=this.querySelectorAll('[slot="script"]');e=Array.from(i)}const n=[],o=[];e.forEach(i=>{const s=i;if(!s.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}s.src.includes("jquery")||s.src.includes("code.jquery.com")?n.push(s):o.push(s)});const r=i=>{const s=document.createElement("script");return s.src=i.src,i.type&&(s.type=i.type),i.async&&(s.async=!0),i.defer&&(s.defer=!0),i.integrity&&(s.integrity=i.integrity),i.crossOrigin&&(s.crossOrigin=i.crossOrigin),s.onerror=l=>{console.error(`Failed to load script: ${i.src}`,l)},s};if(n.length>0){let i=0;const s=n.length;n.forEach(l=>{const c=r(l);c.onload=()=>{i++,i===s&&requestAnimationFrame(()=>{o.forEach(d=>{document.body.appendChild(r(d))})})},document.body.appendChild(c)})}else o.forEach(i=>{document.body.appendChild(r(i))})}getData(e){return this.componentInstance&&this.componentInstance.getData?this.componentInstance.getData(e):null}setData(e,n){return this.componentInstance&&this.componentInstance.setData?this.componentInstance.setData(e,n):!1}get allowDynamicContentInteraction(){if(this.componentInstance){const e=this.componentInstance.allowDynamicContentInteraction;if(e!==void 0)return e&&typeof e=="object"&&"value"in e?e.value:e}return!0}set allowDynamicContentInteraction(e){if(this.componentInstance){const n=this.componentInstance.allowDynamicContentInteraction;n!==void 0&&(n&&typeof n=="object"&&"value"in n?n.value=e:this.componentInstance.allowDynamicContentInteraction=e)}}disconnectedCallback(){if(this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot){if(this._shadowRoot.__zecEventListeners){const e=this._shadowRoot.__zecEventListeners,n=this._shadowRoot;e.forEach(o=>{o.forEach(r=>{n.removeEventListener(r.eventName,r.handler,!0)})}),e.clear()}if(window.__zecShadowRoots){const e=window.__zecShadowRoots,n=this._shadowRoot;for(const[o,r]of e.entries())r===n&&e.delete(o)}}this._shadowRoot=null,window.removeEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this)),window.removeEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this))}handleDOMUpdated(){if(!this._shadowRoot||this.getAttribute("use-shadow-dom")!=="true")return;this._shadowRoot.__zecJQueryExtended&&delete this._shadowRoot.__zecJQueryExtended;const e=this._shadowRoot.querySelector("script[data-zec-shadow-extension]");e&&e.remove(),Mo(this._shadowRoot,!0)}handleLightDOMUpdated(){this.getAttribute("use-shadow-dom")!=="true"&&(this.__lightDOMScriptsLoaded||(this.injectLightDOMScripts(),this.__lightDOMScriptsLoaded=!0))}static get observedAttributes(){return["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data","use-shadow-dom"]}attributeChangedCallback(e,n,o){if(n!==o){if(e==="use-shadow-dom"){this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot&&(this._shadowRoot.innerHTML="",this._shadowRoot=null),this.connectedCallback();return}this.app&&(this.app.unmount(),this.app=null,this.componentInstance=null,this.connectedCallback())}}}customElements.get("zcode-cms")||customElements.define("zcode-cms",rT);function iT(t){const{t:e}=rn(),n=a.ref("common"),o=a.ref(null),r=a.ref(null),i=a.ref(null),s=a.ref(null),l=a.ref(!1),c=a.ref(null),d=a.ref(null),{renderComponentToHtml:u}=fi(t,!1),f=a.computed(()=>{const N=t.parts;return n.value==="common"?N.common:n.value==="individual"?N.individual:N.special}),p=a.computed(()=>{const N=f.value,P=new Map;return N.forEach(V=>{P.has(V.type)||P.set(V.type,[]),V.parts.forEach((S,C)=>{P.get(V.type).push({type:V,partIndex:C})})}),Array.from(P.entries()).map(([V,S])=>({type:V,parts:S.map(C=>({...C.type,_partIndex:C.partIndex,_displayPart:C.type.parts[C.partIndex]}))}))});function h(){const N=t.parts;return n.value==="common"?N.common:n.value==="individual"?N.individual:N.special}function m(N){return f.value.find(P=>P.type===N)||null}function b(N){return i.value&&i.value.partIndex===N&&i.value.part.slots||null}function g(N,P,V){if(i.value&&i.value.partIndex===N){const S=i.value.part;return S.slots||(S.slots={}),V(S.slots),!0}return!1}function x(N){const P={};return N.forEach(V=>{if(V.optional)P[V.fieldName]=void 0;else switch(V.type){case"text":P[V.fieldName]=V.defaultValue||"";break;case"radio":P[V.fieldName]=V.options?.[0]||"";break;case"checkbox":P[V.fieldName]=[];break;case"boolean":P[V.fieldName]=!0;break;case"rich":P[V.fieldName]=V.defaultValue?`<p>${V.defaultValue}</p>`:"<p></p>";break;case"image":P[V.fieldName]=V.defaultValue||"";break}}),P}function v(N){o.value=N,r.value=null,l.value=!1}function w(){r.value=a.reactive({id:jn(),type:"",description:"",parts:[{id:jn(),title:"part_1",description:"",body:"<div>{$content:コンテンツを入力}</div>"}]}),s.value="type",l.value=!0,o.value=null}function T(N){r.value=a.reactive(JSON.parse(JSON.stringify(N))),s.value="type",l.value=!1,o.value=N}function M(N,P){const V=N.parts[P];if(!V)return;const S=JSON.parse(JSON.stringify(V));S.slots||(S.slots={}),i.value={type:a.reactive(JSON.parse(JSON.stringify(N))),partIndex:P,part:a.reactive(S)},s.value="part"}async function A(N){const P=m(N.type);if(!P)return;const V=a.reactive(JSON.parse(JSON.stringify(P))),S={id:jn(),title:`part_${V.parts.length+1}`,description:"",body:"<div>{$content:コンテンツを入力}</div>"};V.parts.push(S);const C=V.parts.length-1;await a.nextTick(),i.value={type:V,partIndex:C,part:a.reactive(JSON.parse(JSON.stringify(S))),isNewPart:!0},s.value="part"}async function y(){if(!r.value)return;const N=$e(r.value);if(!N.valid){alert(e("partsManager.validationError")+`
469
+ `+N.errors.join(`
470
+ `));return}const P=JSON.parse(JSON.stringify(a.toRaw(r.value))),V=h();if(l.value)V.push(P);else{const S=V.findIndex(C=>C.id===r.value.id);S!==-1&&(V[S]=P)}await a.nextTick(),f.value,p.value,r.value=null,s.value=null,l.value=!1}function E(N){const P=[],V=N.toLowerCase(),S=["script","iframe","object","embed"],C=["onclick","onerror","onload","onmouseover","onfocus","onblur"];return S.forEach($=>{V.includes(`<${$}`)&&P.push(e("partsManager.dangerousTagWarning",{tag:$}))}),C.forEach($=>{V.includes(`${$}=`)&&P.push(e("partsManager.dangerousAttrWarning",{attr:$}))}),{hasWarning:P.length>0,messages:P}}async function k(){if(!i.value)return;const N=i.value.part.body||"",P=E(N);if(P.hasWarning&&!confirm(`テンプレートにセキュリティ上注意が必要な記述が含まれています。
471
471
 
472
- ${N.messages.join(`
472
+ ${P.messages.join(`
473
473
  `)}
474
474
 
475
- このまま保存しますか?`))return;const O=h(),k=O.findIndex(me=>me.id===i.value.type.id);if(k===-1)return;const U=O[k],te=JSON.parse(JSON.stringify(a.toRaw(i.value.part)));i.value.isNewPart?U.parts.push(te):U.parts[i.value.partIndex]=te,await a.nextTick(),f.value,p.value,i.value=null,s.value=null}function D(C){const N=f.value.find(O=>O.id===C.id);if(N){if(C._partIndex!==void 0&&C._partIndex!==null)if(N.parts.length>1)N.parts.splice(C._partIndex,1);else{const O=f.value.findIndex(k=>k.id===C.id);O!==-1&&f.value.splice(O,1)}else{const O=f.value.findIndex(k=>k.id===C.id);O!==-1&&f.value.splice(O,1)}o.value=null,r.value=null}}function W(C){const N=[],O=(k,U)=>{const te=k.part_id,me=t.parts,ve=[...me.common,...me.individual];for(const Ve of ve)if(Ve.parts.find(_=>_.id===te)&&Ve.type===C){N.push({path:U,component:k});break}k.slots&&Object.entries(k.slots).forEach(([Ve,Ce])=>{Array.isArray(Ce)&&Ce.forEach((_,I)=>{O(_,`${U}.slots.${Ve}.${I}`)})})};return t.page.forEach((k,U)=>{O(k,`page.${U}`)}),N}function z(C,N){const O=Fn(N.body),k=x(O),U={id:"preview",part_id:N.id,...k},te=new Set;te.add(`${C.id}:${N.id}`);const me=N.slots;if(me){const ve={};Object.entries(me).forEach(([Ve,Ce])=>{const _=Ce.allowedParts;if(_&&_.length>0){const I=_[_.length-1],q=t.parts,fe=[...q.common,...q.individual];let Ae=null,Te=null;for(const we of fe){const B=we.parts.find(ee=>ee.id===I);if(B){Ae=we,Te=B;break}}if(Ae&&Te){const we=P(Ae,Te.id,te);ve[Ve]=[we]}else ve[Ve]=[]}else ve[Ve]=[]}),Object.keys(ve).length>0&&(U.slots=ve)}return U}function P(C,N,O=new Set){const k=N&&C.parts.find(Ce=>Ce.id===N)||C.parts[0];if(!k)throw new Error(`Part not found for type: ${C.type}`);const U=`${C.id}:${k.id}`;if(O.has(U)){const Ce=Fn(k.body),_=x(Ce);return{id:"preview",part_id:k.id,..._}}O.add(U);const te=Fn(k.body),me=x(te),ve={id:"preview",part_id:k.id,...me},Ve=k.slots;if(Ve){const Ce={};Object.entries(Ve).forEach(([_,I])=>{const q=I.allowedParts;if(q&&q.length>0){const fe=q[q.length-1],Ae=t.parts,Te=[...Ae.common,...Ae.individual];let we=null,B=null;for(const ee of Te){const Me=ee.parts.find($=>$.id===fe);if(Me){we=ee,B=Me;break}}if(we&&B){const ee=P(we,B.id,O);Ce[_]=[ee]}else Ce[_]=[]}else Ce[_]=[]}),Object.keys(Ce).length>0&&(ve.slots=Ce)}return ve}function V(C,N){if(!N)return"";const O=z(C,N);return ui(N.body,O,"",k=>{const U=t.parts,te=[...U.common,...U.individual,...U.special];for(const me of te){const ve=me.parts.find(Ve=>Ve.id===k);if(ve)return ve}return null},(k,U)=>u(k,U),!1,t.images.common,t.images.individual,t.images.special)}function j(C){const N=[];try{const U=new DOMParser().parseFromString(`<template>${C}</template>`,"text/html").querySelector("template");if(!U)return N;U.content.querySelectorAll("[z-slot]").forEach(me=>{const ve=me.getAttribute("z-slot")||"default";N.includes(ve)||N.push(ve)})}catch(O){console.error("Failed to parse template:",O)}return N}function L(C){if(i.value&&i.value.partIndex===C){const N=i.value.part.body,O=j(N),k=Object.keys(i.value.part.slots||{});return O.filter(U=>!k.includes(U))}return[]}function H(C,N){let O=N||null;if(!O&&(O=prompt("スロット名を入力してください:"),!O?.trim()))return;g(C,O.trim(),U=>{if(U[O.trim()]){alert("このスロット名は既に存在します");return}U[O.trim()]={}})||alert("パーツが見つかりません")}function Q(C,N){b(C)?.[N]&&confirm(`スロット「${N}」を削除しますか?`)&&g(C,N,k=>{delete k[N]})}function G(C,N,O){g(C,N,U=>{U[N]&&(U[N].allowedParts=O)})||console.warn(`Failed to update allowed parts for slot ${N}`)}function se(C,N){if(!c.value){c.value={type:C.type,partIndex:N};return}if(c.value.type===C.type&&c.value.partIndex===N){J();return}const O=c.value,k={type:C.type,partIndex:N};if(!Z(O,k)){alert("同じタイプ内のパーツのみ並べ替えできます"),J();return}X(O,k),J()}function Z(C,N){return!(C.type!==N.type||C.partIndex===N.partIndex)}function X(C,N){const O=h(),k=O.findIndex(ve=>ve.type===C.type);if(k===-1)return;const te=O[k].parts,[me]=te.splice(C.partIndex,1);te.splice(N.partIndex,0,me)}function J(){c.value=null}function K(C){const N=h(),O=W(C);if(O.length>0){if(!confirm(`タイプ「${C}」は${O.length}箇所で使用されています。削除しますか?`))return}else if(!confirm(`タイプ「${C}」を削除しますか?`))return;for(let k=N.length-1;k>=0;k--)N[k].type===C&&N.splice(k,1)}function Y(C,N){if(C===N)return;const O=h(),k=new Map,U=[];O.forEach(Ce=>{k.has(Ce.type)||(k.set(Ce.type,[]),U.push(Ce.type)),k.get(Ce.type).push(Ce)});const te=U.map(Ce=>({type:Ce,types:k.get(Ce)})),me=te.findIndex(Ce=>Ce.type===C),ve=te.findIndex(Ce=>Ce.type===N);if(me===-1||ve===-1)return;const[Ve]=te.splice(me,1);te.splice(ve,0,Ve),O.splice(0,O.length),te.forEach(Ce=>{Ce.types.forEach(_=>O.push(_))})}function ce(C){if(!d.value){d.value=C;return}if(d.value===C){d.value=null;return}Y(d.value,C),d.value=null}function Ee(){r.value=null,s.value=null,l.value=!1}function _e(){i.value=null,s.value=null}function Le(C){const N=[];if(!C.type||C.type.trim()==="")N.push("タイプ名は必須です");else if(l.value){const O=t.parts;[...O.common,...O.individual].some(te=>te.type===C.type.trim())&&N.push(`タイプ「${C.type}」は既に存在します`)}return!C.parts||C.parts.length===0?N.push("最低1つのパーツが必要です"):C.parts.forEach((O,k)=>{(!O.title||O.title.trim()==="")&&N.push(`パーツ ${k+1} のタイトルは必須です`),(!O.body||O.body.trim()==="")&&N.push(`パーツ ${k+1} のテンプレートは必須です`)}),{valid:N.length===0,errors:N}}return{reorderSourcePart:c,handleReorderClick:se,canReorderParts:Z,cancelReorder:J,activeCategory:n,selectedType:o,editingType:r,editingPart:i,editingLevel:s,isCreatingNew:l,currentTypes:f,groupedPartsByType:p,selectType:v,startCreating:w,startEditingType:T,startEditingPart:M,addPartToType:A,saveType:y,savePart:S,deletePart:D,checkTypeUsage:W,cancelEditingType:Ee,cancelEditingPart:_e,getPartPreviewHtml:V,validateType:Le,addPartSlot:H,removePartSlot:Q,updatePartSlotAllowedParts:G,getAvailableSlotsForPart:L,extractSlotsFromTemplate:j,reorderSourceType:d,startReorderType:ce,deletePartType:K}}function vm(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=Array(e);n<e;n++)o[n]=t[n];return o}function sT(t){if(Array.isArray(t))return t}function aT(t,e,n){return(e=hT(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lT(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var o,r,i,s,l=[],c=!0,d=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(o=i.call(n)).done)&&(l.push(o.value),l.length!==e);c=!0);}catch(u){d=!0,r=u}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(d)throw r}}return l}}function cT(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
475
+ このまま保存しますか?`))return;const V=h(),S=V.findIndex(te=>te.id===i.value.type.id);if(S===-1)return;const C=V[S],$=JSON.parse(JSON.stringify(a.toRaw(i.value.part)));i.value.isNewPart?C.parts.push($):C.parts[i.value.partIndex]=$,await a.nextTick(),f.value,p.value,i.value=null,s.value=null}function O(N){const P=f.value.find(V=>V.id===N.id);if(P){if(N._partIndex!==void 0&&N._partIndex!==null)if(P.parts.length>1)P.parts.splice(N._partIndex,1);else{const V=f.value.findIndex(S=>S.id===N.id);V!==-1&&f.value.splice(V,1)}else{const V=f.value.findIndex(S=>S.id===N.id);V!==-1&&f.value.splice(V,1)}o.value=null,r.value=null}}function G(N){const P=[],V=(S,C)=>{const $=S.part_id,te=t.parts,ge=[...te.common,...te.individual];for(const Re of ge)if(Re.parts.find(_=>_.id===$)&&Re.type===N){P.push({path:C,component:S});break}S.slots&&Object.entries(S.slots).forEach(([Re,ve])=>{Array.isArray(ve)&&ve.forEach((_,I)=>{V(_,`${C}.slots.${Re}.${I}`)})})};return t.page.forEach((S,C)=>{V(S,`page.${C}`)}),P}function z(N,P){const V=Fn(P.body),S=x(V),C={id:"preview",part_id:P.id,...S},$=new Set;$.add(`${N.id}:${P.id}`);const te=P.slots;if(te){const ge={};Object.entries(te).forEach(([Re,ve])=>{const _=ve.allowedParts;if(_&&_.length>0){const I=_[_.length-1],q=t.parts,pe=[...q.common,...q.individual];let Ae=null,ze=null;for(const Se of pe){const F=Se.parts.find(ne=>ne.id===I);if(F){Ae=Se,ze=F;break}}if(Ae&&ze){const Se=R(Ae,ze.id,$);ge[Re]=[Se]}else ge[Re]=[]}else ge[Re]=[]}),Object.keys(ge).length>0&&(C.slots=ge)}return C}function R(N,P,V=new Set){const S=P&&N.parts.find(ve=>ve.id===P)||N.parts[0];if(!S)throw new Error(`Part not found for type: ${N.type}`);const C=`${N.id}:${S.id}`;if(V.has(C)){const ve=Fn(S.body),_=x(ve);return{id:"preview",part_id:S.id,..._}}V.add(C);const $=Fn(S.body),te=x($),ge={id:"preview",part_id:S.id,...te},Re=S.slots;if(Re){const ve={};Object.entries(Re).forEach(([_,I])=>{const q=I.allowedParts;if(q&&q.length>0){const pe=q[q.length-1],Ae=t.parts,ze=[...Ae.common,...Ae.individual];let Se=null,F=null;for(const ne of ze){const Me=ne.parts.find(B=>B.id===pe);if(Me){Se=ne,F=Me;break}}if(Se&&F){const ne=R(Se,F.id,V);ve[_]=[ne]}else ve[_]=[]}else ve[_]=[]}),Object.keys(ve).length>0&&(ge.slots=ve)}return ge}function W(N,P){if(!P)return"";const V=z(N,P);return ui(P.body,V,"",S=>{const C=t.parts,$=[...C.common,...C.individual,...C.special];for(const te of $){const ge=te.parts.find(Re=>Re.id===S);if(ge)return ge}return null},(S,C)=>u(S,C),!1,t.images.common,t.images.individual,t.images.special)}function H(N){const P=[];try{const C=new DOMParser().parseFromString(`<template>${N}</template>`,"text/html").querySelector("template");if(!C)return P;C.content.querySelectorAll("[z-slot]").forEach(te=>{const ge=te.getAttribute("z-slot")||"default";P.includes(ge)||P.push(ge)})}catch(V){console.error("Failed to parse template:",V)}return P}function L(N){if(i.value&&i.value.partIndex===N){const P=i.value.part.body,V=H(P),S=Object.keys(i.value.part.slots||{});return V.filter(C=>!S.includes(C))}return[]}function j(N,P){let V=P||null;if(!V&&(V=prompt("スロット名を入力してください:"),!V?.trim()))return;g(N,V.trim(),C=>{if(C[V.trim()]){alert("このスロット名は既に存在します");return}C[V.trim()]={}})||alert("パーツが見つかりません")}function Z(N,P){b(N)?.[P]&&confirm(`スロット「${P}」を削除しますか?`)&&g(N,P,S=>{delete S[P]})}function K(N,P,V){g(N,P,C=>{C[P]&&(C[P].allowedParts=V)})||console.warn(`Failed to update allowed parts for slot ${P}`)}function ae(N,P){if(!c.value){c.value={type:N.type,partIndex:P};return}if(c.value.type===N.type&&c.value.partIndex===P){Y();return}const V=c.value,S={type:N.type,partIndex:P};if(!ee(V,S)){alert("同じタイプ内のパーツのみ並べ替えできます"),Y();return}X(V,S),Y()}function ee(N,P){return!(N.type!==P.type||N.partIndex===P.partIndex)}function X(N,P){const V=h(),S=V.findIndex(ge=>ge.type===N.type);if(S===-1)return;const $=V[S].parts,[te]=$.splice(N.partIndex,1);$.splice(P.partIndex,0,te)}function Y(){c.value=null}function J(N){const P=h(),V=G(N);if(V.length>0){if(!confirm(`タイプ「${N}」は${V.length}箇所で使用されています。削除しますか?`))return}else if(!confirm(`タイプ「${N}」を削除しますか?`))return;for(let S=P.length-1;S>=0;S--)P[S].type===N&&P.splice(S,1)}function Q(N,P){if(N===P)return;const V=h(),S=new Map,C=[];V.forEach(ve=>{S.has(ve.type)||(S.set(ve.type,[]),C.push(ve.type)),S.get(ve.type).push(ve)});const $=C.map(ve=>({type:ve,types:S.get(ve)})),te=$.findIndex(ve=>ve.type===N),ge=$.findIndex(ve=>ve.type===P);if(te===-1||ge===-1)return;const[Re]=$.splice(te,1);$.splice(ge,0,Re),V.splice(0,V.length),$.forEach(ve=>{ve.types.forEach(_=>V.push(_))})}function de(N){if(!d.value){d.value=N;return}if(d.value===N){d.value=null;return}Q(d.value,N),d.value=null}function ke(){r.value=null,s.value=null,l.value=!1}function Te(){i.value=null,s.value=null}function $e(N){const P=[];if(!N.type||N.type.trim()==="")P.push("タイプ名は必須です");else if(l.value){const V=t.parts;[...V.common,...V.individual].some($=>$.type===N.type.trim())&&P.push(`タイプ「${N.type}」は既に存在します`)}return!N.parts||N.parts.length===0?P.push("最低1つのパーツが必要です"):N.parts.forEach((V,S)=>{(!V.title||V.title.trim()==="")&&P.push(`パーツ ${S+1} のタイトルは必須です`),(!V.body||V.body.trim()==="")&&P.push(`パーツ ${S+1} のテンプレートは必須です`)}),{valid:P.length===0,errors:P}}return{reorderSourcePart:c,handleReorderClick:ae,canReorderParts:ee,cancelReorder:Y,activeCategory:n,selectedType:o,editingType:r,editingPart:i,editingLevel:s,isCreatingNew:l,currentTypes:f,groupedPartsByType:p,selectType:v,startCreating:w,startEditingType:T,startEditingPart:M,addPartToType:A,saveType:y,savePart:k,deletePart:O,checkTypeUsage:G,cancelEditingType:ke,cancelEditingPart:Te,getPartPreviewHtml:W,validateType:$e,addPartSlot:j,removePartSlot:Z,updatePartSlotAllowedParts:K,getAvailableSlotsForPart:L,extractSlotsFromTemplate:H,reorderSourceType:d,startReorderType:de,deletePartType:J}}function vm(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,o=Array(e);n<e;n++)o[n]=t[n];return o}function sT(t){if(Array.isArray(t))return t}function aT(t,e,n){return(e=hT(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function lT(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var o,r,i,s,l=[],c=!0,d=!1;try{if(i=(n=n.call(t)).next,e!==0)for(;!(c=(o=i.call(n)).done)&&(l.push(o.value),l.length!==e);c=!0);}catch(u){d=!0,r=u}finally{try{if(!c&&n.return!=null&&(s=n.return(),Object(s)!==s))return}finally{if(d)throw r}}return l}}function cT(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
476
476
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Tm(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function zm(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Tm(Object(n),!0).forEach(function(o){aT(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Tm(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function dT(t,e){if(t==null)return{};var n,o,r=uT(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(o=0;o<i.length;o++)n=i[o],e.indexOf(n)===-1&&{}.propertyIsEnumerable.call(t,n)&&(r[n]=t[n])}return r}function uT(t,e){if(t==null)return{};var n={};for(var o in t)if({}.hasOwnProperty.call(t,o)){if(e.indexOf(o)!==-1)continue;n[o]=t[o]}return n}function fT(t,e){return sT(t)||lT(t,e)||mT(t,e)||cT()}function pT(t,e){if(typeof t!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var o=n.call(t,e);if(typeof o!="object")return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function hT(t){var e=pT(t,"string");return typeof e=="symbol"?e:e+""}function mT(t,e){if(t){if(typeof t=="string")return vm(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?vm(t,e):void 0}}function gT(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function _m(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter(function(r){return Object.getOwnPropertyDescriptor(t,r).enumerable})),n.push.apply(n,o)}return n}function Am(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?_m(Object(n),!0).forEach(function(o){gT(t,o,n[o])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):_m(Object(n)).forEach(function(o){Object.defineProperty(t,o,Object.getOwnPropertyDescriptor(n,o))})}return t}function bT(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];return function(o){return e.reduceRight(function(r,i){return i(r)},o)}}function Zr(t){return function e(){for(var n=this,o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return r.length>=t.length?t.apply(this,r):function(){for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];return e.apply(n,[].concat(r,l))}}}function qs(t){return{}.toString.call(t).includes("Object")}function yT(t){return!Object.keys(t).length}function ei(t){return typeof t=="function"}function xT(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function ET(t,e){return qs(e)||co("changeType"),Object.keys(e).some(function(n){return!xT(t,n)})&&co("changeField"),e}function kT(t){ei(t)||co("selectorType")}function wT(t){ei(t)||qs(t)||co("handlerType"),qs(t)&&Object.values(t).some(function(e){return!ei(e)})&&co("handlersType")}function ST(t){t||co("initialIsRequired"),qs(t)||co("initialType"),yT(t)&&co("initialContent")}function NT(t,e){throw new Error(t[e]||t.default)}var CT={initialIsRequired:"initial state is required",initialType:"initial state should be an object",initialContent:"initial state shouldn't be an empty object",handlerType:"handler should be an object or a function",handlersType:"all handlers should be a functions",selectorType:"selector should be a function",changeType:"provided value of changes should be an object",changeField:'it seams you want to change a field in the state which is not specified in the "initial" state',default:"an unknown error accured in `state-local` package"},co=Zr(NT)(CT),Ks={changes:ET,selector:kT,handler:wT,initial:ST};function vT(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ks.initial(t),Ks.handler(e);var n={current:t},o=Zr(_T)(n,e),r=Zr(zT)(n),i=Zr(Ks.changes)(t),s=Zr(TT)(n);function l(){var d=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(u){return u};return Ks.selector(d),d(n.current)}function c(d){bT(o,r,i,s)(d)}return[l,c]}function TT(t,e){return ei(e)?e(t.current):e}function zT(t,e){return t.current=Am(Am({},t.current),e),e}function _T(t,e,n){return ei(e)?e(t.current):Object.keys(n).forEach(function(o){var r;return(r=e[o])===null||r===void 0?void 0:r.call(e,t.current[o])}),n}var AT={create:vT},MT={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.55.1/min/vs"}};function IT(t){return function e(){for(var n=this,o=arguments.length,r=new Array(o),i=0;i<o;i++)r[i]=arguments[i];return r.length>=t.length?t.apply(this,r):function(){for(var s=arguments.length,l=new Array(s),c=0;c<s;c++)l[c]=arguments[c];return e.apply(n,[].concat(r,l))}}}function OT(t){return{}.toString.call(t).includes("Object")}function DT(t){return t||Im("configIsRequired"),OT(t)||Im("configType"),t.urls?(RT(),{paths:{vs:t.urls.monacoBase}}):t}function RT(){console.warn(Mm.deprecation)}function PT(t,e){throw new Error(t[e]||t.default)}var Mm={configIsRequired:"the configuration object is required",configType:"the configuration object should be an object",default:"an unknown error accured in `@monaco-editor/loader` package",deprecation:`Deprecation warning!
477
477
  You are using deprecated way of configuration.
478
478
 
@@ -482,9 +482,9 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
482
482
  monaco.config({ paths: { vs: '...' } })
483
483
 
484
484
  For more please check the link https://github.com/suren-atoyan/monaco-loader#config
485
- `},Im=IT(PT)(Mm),LT={config:DT},$T=function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return function(r){return n.reduceRight(function(i,s){return s(i)},r)}};function Om(t,e){return Object.keys(e).forEach(function(n){e[n]instanceof Object&&t[n]&&Object.assign(e[n],Om(t[n],e[n]))}),zm(zm({},t),e)}var VT={type:"cancelation",msg:"operation is manually canceled"};function Nc(t){var e=!1,n=new Promise(function(o,r){t.then(function(i){return e?r(VT):o(i)}),t.catch(r)});return n.cancel=function(){return e=!0},n}var BT=["monaco"],FT=AT.create({config:MT,isInitialized:!1,resolve:null,reject:null,monaco:null}),Dm=fT(FT,2),ti=Dm[0],Js=Dm[1];function jT(t){var e=LT.config(t),n=e.monaco,o=dT(e,BT);Js(function(r){return{config:Om(r.config,o),monaco:n}})}function UT(){var t=ti(function(e){var n=e.monaco,o=e.isInitialized,r=e.resolve;return{monaco:n,isInitialized:o,resolve:r}});if(!t.isInitialized){if(Js({isInitialized:!0}),t.monaco)return t.resolve(t.monaco),Nc(Cc);if(window.monaco&&window.monaco.editor)return Rm(window.monaco),t.resolve(window.monaco),Nc(Cc);$T(HT,GT)(qT)}return Nc(Cc)}function HT(t){return document.body.appendChild(t)}function WT(t){var e=document.createElement("script");return t&&(e.src=t),e}function GT(t){var e=ti(function(o){var r=o.config,i=o.reject;return{config:r,reject:i}}),n=WT("".concat(e.config.paths.vs,"/loader.js"));return n.onload=function(){return t()},n.onerror=e.reject,n}function qT(){var t=ti(function(n){var o=n.config,r=n.resolve,i=n.reject;return{config:o,resolve:r,reject:i}}),e=window.require;e.config(t.config),e(["vs/editor/editor.main"],function(n){var o=n.m||n;Rm(o),t.resolve(o)},function(n){t.reject(n)})}function Rm(t){ti().monaco||Js({monaco:t})}function KT(){return ti(function(t){var e=t.monaco;return e})}var Cc=new Promise(function(t,e){return Js({resolve:t,reject:e})}),JT={config:jT,init:UT,__getMonacoInstance:KT};const XT={class:"monaco-editor-wrapper"},YT={key:0,class:"monaco-editor-error"},Pm=((t,e)=>{const n=t.__vccOpts||t;for(const[o,r]of e)n[o]=r;return n})(a.defineComponent({__name:"MonacoEditor",props:{modelValue:{type:String},language:{type:String},theme:{type:String},readOnly:{type:Boolean},minimap:{type:Boolean},height:{type:String},autoHeight:{type:Boolean},maxHeight:{type:Number},enableSuggestions:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,o=e,r=a.ref(null),i=a.ref(null);let s=null,l=null,c=!1,d=[];function u(){const p=r.value;if(!p)return;const h=p.getRootNode();if(!(h instanceof ShadowRoot))return;const m=h;Array.from(document.head.querySelectorAll('style, link[rel="stylesheet"]')).filter(x=>{if(x.tagName==="LINK"){const w=x.href||"";return w.includes("monaco")||w.includes("/vs/")||w.includes("vs/")}const v=x.textContent||"";return v.includes(".monaco-editor")||v.includes(".monaco-editor-background")}).forEach(x=>{if(x.tagName==="LINK"){const w=x.href;if(!!m.querySelector(`link[rel="stylesheet"][href="${w}"]`))return}else{const w=x.getAttribute("data-name")||"";if(w&&!!m.querySelector(`style[data-name="${w}"]`))return}const v=x.cloneNode(!0);v.setAttribute("data-zcode-monaco-style","true"),m.appendChild(v),d.push(v)})}function f(){if(!(!s||!r.value||!l)&&n.autoHeight!==!1)try{const p=s.getOption(l.editor.EditorOption.lineHeight)||19;let b=(s.getModel()?.getLineCount()||1)*p+20;n.maxHeight!==void 0&&(b=Math.min(b,n.maxHeight)),r.value.style.height=`${b}px`,s.layout()}catch{r.value.style.height="200px"}}return a.onMounted(async()=>{if(r.value)try{l=await JT.init(),u(),l.languages.registerCompletionItemProvider("html",{provideCompletionItems:(h,m)=>{const b=h.getWordUntilPosition(m),g={startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:b.startColumn,endColumn:b.endColumn},x=h.getValueInRange({startLineNumber:m.lineNumber,startColumn:Math.max(1,m.column-10),endLineNumber:m.lineNumber,endColumn:m.column}),v=[];return(x.endsWith("$")||x.endsWith("{$"))&&v.push({label:"{$field:default}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:textarea}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:textarea}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストエリアフィールド: {$変数名:デフォルト値:textarea}",detail:"テンプレート記法 - テキストエリア",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:rich}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:rich}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"リッチテキストフィールド: {$変数名:デフォルト値:rich}",detail:"テンプレート記法 - リッチテキスト",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:image}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:image}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"画像フィールド: {$変数名:デフォルト値:image}",detail:"テンプレート記法 - 画像",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}}),(x.endsWith("(")||x.endsWith("$("))&&v.push({label:"($field:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"ラジオボタン: ($フィールド名:選択肢1|選択肢2)",detail:"テンプレート記法 - ラジオボタン",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"チェックボックス: ($フィールド名:選択肢1,選択肢2)",detail:"テンプレート記法 - チェックボックス",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field@:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(単一選択): ($フィールド名@:選択肢1|選択肢2)",detail:"テンプレート記法 - セレクトボックス",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field@:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(複数選択): ($フィールド名@:選択肢1,選択肢2)",detail:"テンプレート記法 - セレクトボックス(複数)",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}}),(x.endsWith("z-")||x.endsWith(" z-"))&&v.push({label:'z-if="show_xxx"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-if="show_${1:field}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"条件分岐: z-if属性(フィールドがtrueの場合に表示)",detail:"テンプレート記法 - 条件分岐",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-2,endColumn:m.column}},{label:'z-slot="slotName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-slot="${1:slotName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"スロット: z-slot属性(子コンポーネントを挿入する位置)",detail:"テンプレート記法 - スロット",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-2,endColumn:m.column}}),v.length===0&&v.push({label:"{$field:default}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:g},{label:"{$field:default:rich}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:rich}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"リッチテキストフィールド: {$変数名:デフォルト値:rich}",detail:"テンプレート記法 - リッチテキスト",range:g},{label:"{$field:default:image}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:image}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"画像フィールド: {$変数名:デフォルト値:image}",detail:"テンプレート記法 - 画像",range:g},{label:"($field:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"ラジオボタン: ($フィールド名:選択肢1|選択肢2)",detail:"テンプレート記法 - ラジオボタン",range:g},{label:"($field:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"チェックボックス: ($フィールド名:選択肢1,選択肢2)",detail:"テンプレート記法 - チェックボックス",range:g},{label:"($field@:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(単一選択): ($フィールド名@:選択肢1|選択肢2)",detail:"テンプレート記法 - セレクトボックス",range:g},{label:"($field@:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(複数選択): ($フィールド名@:選択肢1,選択肢2)",detail:"テンプレート記法 - セレクトボックス(複数)",range:g},{label:'z-if="show_xxx"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-if="show_${1:field}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"条件分岐: z-if属性(フィールドがtrueの場合に表示)",detail:"テンプレート記法 - 条件分岐",range:g},{label:'z-tag="$tagName:h1|h2|h3"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-tag="$${1:tagName}:${2:h1|h2|h3}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"タグ名を動的に変更(選択肢を指定可能)",detail:"テンプレート記法 - タグ名の動的変更",range:g},{label:'z-empty="$fieldName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-empty="$${1:fieldName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"オプショナルフィールドが空の場合、親要素を削除",detail:"テンプレート記法 - 条件分岐(空の場合削除)",range:g},{label:'z-slot="slotName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-slot="${1:slotName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"スロット: z-slot属性(子コンポーネントを挿入する位置)",detail:"テンプレート記法 - スロット",range:g}),{suggestions:v}},triggerCharacters:["$","(","z"]});const p=n.enableSuggestions!==!1;s=l.editor.create(r.value,{value:n.modelValue||"",language:n.language||"html",theme:n.theme||"vs-dark",readOnly:n.readOnly||!1,minimap:{enabled:n.minimap===!0},automaticLayout:!0,fontSize:14,tabSize:2,wordWrap:"off",scrollBeyondLastLine:!1,formatOnPaste:!0,formatOnType:!0,lineNumbers:"on",folding:!0,suggestOnTriggerCharacters:p,quickSuggestions:p?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:p,acceptSuggestionOnEnter:p?"on":"off",suggestSelection:"first",mouseWheelScrollSensitivity:1,fastScrollSensitivity:5,scrollbar:{alwaysConsumeMouseWheel:!1}}),s.onDidChangeModelContent(()=>{if(!c){const h=s.getValue();o("update:modelValue",h),f()}}),f()}catch(p){i.value=`Monaco Editorの読み込みに失敗しました: ${p}`,console.error("Monaco Editor error:",p)}}),a.watch(()=>n.modelValue,async p=>{s&&s.getValue()!==p&&(c=!0,await a.nextTick(),s.setValue(p||""),c=!1,f())}),a.watch(()=>n.enableSuggestions,p=>{if(s&&l){const h=p!==!1;s.updateOptions({suggestOnTriggerCharacters:h,quickSuggestions:h?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:h,acceptSuggestionOnEnter:h?"on":"off"})}}),a.onUnmounted(()=>{s&&(s.dispose(),s=null),d.forEach(p=>p.remove()),d=[]}),(p,h)=>(a.openBlock(),a.createElementBlock("div",XT,[a.createElementVNode("div",{ref_key:"editorContainer",ref:r,class:"monaco-editor-container"},null,512),i.value?(a.openBlock(),a.createElementBlock("div",YT,a.toDisplayString(i.value),1)):a.createCommentVNode("",!0)]))}}),[["styles",[".monaco-editor-wrapper{width:100%}.monaco-editor-container{width:100%;min-height:100px;max-height:400px;border:1px solid #d1d5db;border-radius:4px;overflow:hidden}.monaco-editor-error{padding:8px;background:#fee;color:#c33;border-radius:4px;margin-top:8px;font-size:12px}"]]]),QT={class:"zcode-parts-manager"},ZT={class:"zcode-parts-category-tabs"},ez={class:"zcode-parts-category-tab-group"},tz=["onClick"],nz=["title"],oz={class:"zcode-parts-manager-content"},rz={class:"zcode-parts-items"},iz={class:"zcode-part-type-title",role:"heading","aria-level":"5"},sz={class:"zcode-part-type-actions"},az=["title","onClick"],lz=["title","onClick"],cz=["title","onClick"],dz={class:"zcode-part-type-items"},uz=["onClick"],fz={key:0,class:"zcode-reorder-source-indicator"},pz={class:"zcode-part-item-header"},hz={class:"zcode-part-type"},mz={class:"zcode-part-item-actions"},gz=["title","onClick"],bz=["title","onClick"],yz=["title","onClick"],xz={class:"zcode-part-item-content"},Ez={class:"zcode-part-modules"},kz={key:0,class:"zcode-part-preview"},wz=["innerHTML"],Sz=["onClick"],Nz={class:"zcode-part-item-add-content"},Cz={class:"zcode-part-editor-header"},vz={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},Tz=["aria-label"],zz={class:"zcode-part-editor-form"},_z={class:"zcode-form-field"},Az=["placeholder"],Mz={class:"zcode-form-field"},Iz=["placeholder"],Oz={class:"zcode-part-editor-actions"},Dz={class:"zcode-part-editor-header"},Rz={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},Pz=["aria-label"],Lz={class:"zcode-part-editor-form"},$z={class:"zcode-part-editor-topbar"},Vz={class:"zcode-part-editor-topfields"},Bz={class:"zcode-form-field"},Fz={class:"zcode-form-field"},jz=["placeholder"],Uz={class:"zcode-part-editor-main"},Hz={class:"zcode-part-editor-pane zcode-part-editor-pane--code"},Wz={class:"zcode-part-editor-pane-header"},Gz=["aria-label"],qz=["aria-selected"],Kz=["aria-selected"],Jz={class:"zcode-part-editor-pane-header-actions"},Xz={key:0,class:"zcode-css-warning-compact"},Yz={class:"zcode-css-warning-compact-text"},Qz=["title"],Zz={key:1,class:"zcode-checkbox-label zcode-checkbox-label-inline"},e_=["title"],t_={class:"zcode-part-editor-pane-body"},n_={class:"zcode-part-editor-pane zcode-part-editor-pane--side"},o_={class:"zcode-part-editor-pane-body"},r_=["innerHTML"],i_={class:"zcode-part-editor-preview-hint"},s_={key:0,class:"zcode-part-editor-slots-bottom"},a_={class:"zcode-slots-config"},l_={class:"zcode-slot-config-header"},c_={class:"zcode-slot-config-title"},d_=["onClick"],u_={class:"zcode-slot-config-body"},f_={class:"zcode-checkbox-group"},p_=["onUpdate:modelValue","placeholder"],h_=["checked","onChange"],m_={key:0,class:"zcode-slot-add-section"},g_={class:"zcode-slot-add-controls"},b_={value:""},y_=["value"],x_=["disabled"],E_={class:"zcode-part-editor-actions"},k_={class:"zcode-preview-modal-header"},w_={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},S_=["innerHTML"],N_={class:"zcode-help-modal-header"},C_={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},v_=["aria-label"],T_={class:"zcode-help-modal-body"},z_={class:"zcode-warning-content"},__={class:"zcode-warning-text"},A_={class:"zcode-warning-list"},M_={class:"zcode-css-warning-modal-footer"},I_={class:"zcode-checkbox-label",style:{"margin-bottom":"12px"}},O_={class:"zcode-help-modal-header"},D_={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},R_=["aria-label"],P_={class:"zcode-help-modal-body"},L_={class:"zcode-help-section"},$_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},V_={class:"zcode-help-section-item"},B_={class:"zcode-help-section"},F_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},j_={class:"zcode-help-section-item"},U_={class:"zcode-help-section"},H_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},W_={class:"zcode-help-section-item"},G_={class:"zcode-help-modal-header"},q_={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},K_=["aria-label"],J_={class:"zcode-help-modal-body"},X_={class:"zcode-help-table"},Y_={class:"zcode-help-section"},Q_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},Z_={role:"list",class:"zcode-help-section-list"},eA=["innerHTML"],tA={role:"listitem",class:"zcode-help-section-item"},nA={role:"listitem",class:"zcode-help-section-item"},oA=a.defineComponent({__name:"PartsManagerPanel",props:{cmsData:{type:Object},config:{type:Object}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.ref(!1),i=a.ref(m1("enableTemplateSuggestions",!1)),s=a.ref(!1),l=a.ref(!1),c=a.ref(!1),d=a.ref(g1()),u=a.ref("html"),f=a.ref(""),p=a.ref(""),h={common:"zcode-css-style-parts-manager-preview-common",individual:"zcode-css-style-parts-manager-preview-individual",special:"zcode-css-style-parts-manager-preview-special"},m=new Map,b=a.computed(()=>D.value==="common"?o.cmsData.css?.common??"":D.value==="individual"?o.cmsData.css?.individual??"":o.cmsData.css?.special??"");function g($){["common","individual","special"].forEach(re=>{const ae=$[re];if(!ae||!ae.trim()){const Fe=m.get(re);Fe&&(Fe.remove(),m.delete(re));return}let ke=m.get(re);ke||(ke=document.createElement("style"),ke.id=h[re],ke.setAttribute("data-zcode-css","true"),ke.setAttribute("data-zcode-css-parts-preview","true"),ke.setAttribute("data-zcode-css-category",re),ke.parentNode||document.head.appendChild(ke),m.set(re,ke)),ke.textContent=ae})}function x(){m.forEach($=>{$.remove()}),m.clear()}function v(){s.value=!0}function w(){s.value=!1}function T(){(D.value==="common"||D.value==="individual"||D.value==="special")&&(l.value=!0)}function M(){l.value=!1,b1(d.value)}a.watch(i,$=>{Ba({enableTemplateSuggestions:$})});const A=a.computed(()=>o.config?.categoryOrder||"common"),y=a.computed(()=>{const $=[],F=o.cmsData.parts.special.length>0;return A.value==="individual"?($.push("individual","common"),F&&$.push("special")):A.value==="special"?(F&&$.push("special"),$.push("common","individual")):($.push("common","individual"),F&&$.push("special")),$}),{reorderSourcePart:E,handleReorderClick:S,activeCategory:D,editingType:W,editingPart:z,editingLevel:P,isCreatingNew:V,groupedPartsByType:j,startCreating:L,startEditingType:H,startEditingPart:Q,addPartToType:G,saveType:se,savePart:Z,deletePart:X,checkTypeUsage:J,cancelEditingType:K,cancelEditingPart:Y,getPartPreviewHtml:ce,addPartSlot:Ee,removePartSlot:_e,updatePartSlotAllowedParts:Le,getAvailableSlotsForPart:C,extractSlotsFromTemplate:N,reorderSourceType:O,startReorderType:k,deletePartType:U}=iT(o.cmsData);o.config?.categoryOrder==="individual"&&(D.value="individual");const te=a.computed(()=>(P?.value??P)==="part"&&!!z.value);a.watch(()=>te.value,$=>{if(!$){x();return}a.nextTick(()=>{const F=b.value;p.value=F,f.value=F,g({common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special})})},{immediate:!0}),a.watch(()=>D.value,()=>{te.value&&a.nextTick(()=>{const $=b.value;p.value=$,f.value=$})}),a.watch([()=>f.value,()=>te.value,()=>D.value],([$,F,re])=>{F&&a.nextTick(()=>{const ae={common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special};re==="common"?ae.common=$??"":re==="individual"?ae.individual=$??"":ae.special=$??"",g(ae)})});async function me(){await Z(),!z.value&&o.cmsData.css&&(D.value==="common"?o.cmsData.css.common=f.value:D.value==="individual"?o.cmsData.css.individual=f.value:o.cmsData.css.special=f.value,p.value=f.value)}function ve(){f.value=p.value,x(),r.value=!1,Y()}a.onBeforeUnmount(()=>{x()}),a.watch(()=>z.value,$=>{$&&(u.value="html")}),a.watch(()=>u.value,$=>{$==="css"&&te.value&&(D.value==="common"||D.value==="individual"||D.value==="special")&&!d.value&&a.nextTick(()=>{T()})}),e({activeCategory:D});async function Ve(){await se()}const Ce=a.computed(()=>z.value?C(z.value.partIndex):[]),_=a.computed(()=>{if(!z.value)return!1;const $=z.value.part.body,F=$?N($).length>0:!1,re=z.value.part.slots&&Object.keys(z.value.part.slots).length>0;return F||re}),I=a.ref(""),q=()=>{!I.value||!z.value||(Ee(z.value.partIndex,I.value),I.value="")};a.watch(()=>z.value?.part.body,()=>{I.value=""});const fe=a.computed(()=>{const $=[],F=o.cmsData.parts;return[...F.common,...F.individual,...F.special||[]].forEach(ae=>{ae.parts.forEach(ke=>{$.push({id:ke.id,title:ke.title,typeName:ae.type,description:ke.description})})}),$.sort((ae,ke)=>ae.typeName!==ke.typeName?ae.typeName.localeCompare(ke.typeName):ae.title.localeCompare(ke.title))}),Ae=a.ref({}),Te=$=>{const F=Ae.value[$]||"";if(!F)return fe.value;const re=F.toLowerCase();return fe.value.filter(ae=>ae.title.toLowerCase().includes(re)||ae.typeName.toLowerCase().includes(re))},we=$=>{if(!z.value)return[];const F=z.value.part.slots?.[$];return F?F.allowedParts||[]:[]},B=($,F,re)=>{if(!z.value)return;const ae=re.target.checked,Fe=z.value.part.slots?.[$]?.allowedParts||[];let st;ae?st=[...Fe,F]:st=Fe.filter(xn=>xn!==F),Le(z.value.partIndex,$,st)};function ee($,F){const re=["zcode-part-item"];return E.value&&E.value.type===$.type&&E.value.partIndex===F&&re.push("zcode-reorder-source"),re.join(" ")}function Me($){const F=$._partIndex,re=F!=null,ae=re&&F!==void 0?F+1:0,ke=$.parts.length;if(re&&ke>1){if(!confirm(n("partsManager.deletePartConfirm",{number:ae})))return}else{const Fe=J($.type);if(Fe.length>0){if(!confirm(n("partsManager.deleteTypeWithUsagesConfirm",{type:$.type,count:Fe.length})))return}else if(!confirm(n("partsManager.deleteTypeConfirm")))return}X($)}return($,F)=>(a.openBlock(),a.createElementBlock("div",QT,[a.createElementVNode("div",ZT,[a.createElementVNode("div",ez,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(y.value,re=>(a.openBlock(),a.createElementBlock("button",{key:re,class:a.normalizeClass([{active:a.unref(D)===re},"zcode-category-tab"]),onClick:ae=>D.value=re},a.toDisplayString(re==="common"?$.$t("dataViewer.common"):re==="individual"?$.$t("dataViewer.individual"):$.$t("dataViewer.special")),11,tz))),128)),a.createElementVNode("button",{class:"zcode-help-btn",title:$.$t("dataViewer.categoryInfo.title"),onClick:F[0]||(F[0]=re=>c.value=!0)},[a.createVNode(a.unref(Vn),{size:14})],8,nz)]),a.createElementVNode("button",{class:"zcode-btn-primary zcode-parts-new-btn",onClick:F[1]||(F[1]=(...re)=>a.unref(L)&&a.unref(L)(...re))},[a.createVNode(a.unref(uo),{size:14}),a.createElementVNode("span",null,a.toDisplayString($.$t("partsManager.createType")),1)])]),a.createElementVNode("div",oz,[a.createElementVNode("div",rz,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(j),re=>(a.openBlock(),a.createElementBlock("div",{key:re.type,class:"zcode-part-type-group"},[a.createElementVNode("div",iz,[a.createTextVNode(a.toDisplayString(re.type)+" ",1),a.createElementVNode("div",sz,[re.parts.length>0?(a.openBlock(),a.createElementBlock("button",{key:0,class:"zcode-part-type-edit-btn",title:$.$t("partsManager.editTypeButton"),onClick:a.withModifiers(ae=>a.unref(H)(re.parts[0]),["stop"])},[a.createVNode(a.unref(oa),{size:14})],8,az)):a.createCommentVNode("",!0),a.createElementVNode("button",{class:a.normalizeClass(["zcode-action-btn",{active:a.unref(O)===re.type}]),title:$.$t("partsManager.reorderType"),onClick:a.withModifiers(ae=>a.unref(k)(re.type),["stop"])},[a.createVNode(a.unref(ir),{size:14})],10,lz),a.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:$.$t("partsManager.deleteTypeButton"),onClick:a.withModifiers(ae=>a.unref(U)(re.type),["stop"])},[a.createVNode(a.unref(Bn),{size:14})],8,cz)])]),a.createElementVNode("div",dz,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(re.parts,(ae,ke)=>(a.openBlock(),a.createElementBlock("div",{key:`${re.type}-${ke}`,class:a.normalizeClass(ee(ae,ae._partIndex??0)),onClick:Fe=>a.unref(Q)(ae,ae._partIndex??0)},[a.unref(E)&&a.unref(E).type===ae.type&&a.unref(E).partIndex===(ae._partIndex??0)?(a.openBlock(),a.createElementBlock("div",fz,a.toDisplayString($.$t("partsManager.source")),1)):a.createCommentVNode("",!0),a.createElementVNode("div",pz,[a.createElementVNode("span",hz,a.toDisplayString(ae._displayPart?.title||ae.type),1),a.createElementVNode("div",mz,[a.createElementVNode("button",{class:"zcode-action-btn",title:$.$t("partsManager.editPartButton"),onClick:a.withModifiers(Fe=>a.unref(Q)(ae,ae._partIndex??0),["stop"])},[a.createVNode(a.unref(oa),{size:14})],8,gz),a.createElementVNode("button",{class:a.normalizeClass(["zcode-action-btn",{active:a.unref(E)?.type===ae.type&&a.unref(E)?.partIndex===(ae._partIndex??0)}]),title:$.$t("partsManager.reorderPart"),onClick:a.withModifiers(Fe=>a.unref(S)(ae,ae._partIndex??0),["stop"])},[a.createVNode(a.unref(ir),{size:14})],10,bz),a.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:$.$t("partsManager.deletePartButton"),onClick:a.withModifiers(Fe=>Me({...ae,_partIndex:ae._partIndex??0}),["stop"])},[a.createVNode(a.unref(Bn),{size:14})],8,yz)])]),a.createElementVNode("div",xz,[a.createElementVNode("div",{class:a.normalizeClass(["zcode-part-description",{"zcode-description-empty":!ae._displayPart?.description&&!ae.description}])},a.toDisplayString(ae._displayPart?.description||ae.description||$.$t("partsManager.noDescription")),3),a.createElementVNode("div",Ez,a.toDisplayString($.$t("partsManager.partNumber",{current:(ae._partIndex??0)+1,total:ae.parts.length})),1),ae._displayPart?(a.openBlock(),a.createElementBlock("div",kz,[a.createElementVNode("div",{class:"zcode-part-preview-content",innerHTML:a.unref(ce)(ae,ae._displayPart)},null,8,wz)])):a.createCommentVNode("",!0)])],10,uz))),128)),re.parts.length>0?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-part-item zcode-part-item-add",onClick:a.withModifiers(ae=>a.unref(G)(re.parts[0]),["stop"])},[a.createElementVNode("div",Nz,[a.createVNode(a.unref(uo),{size:20}),a.createElementVNode("span",null,a.toDisplayString($.$t("partsManager.addPart")),1)])],8,Sz)):a.createCommentVNode("",!0)])]))),128))]),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.unref(W)&&(a.unref(P)==="type"||a.unref(V))?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:F[7]||(F[7]=a.withModifiers((...re)=>a.unref(K)&&a.unref(K)(...re),["self"]))},[a.createElementVNode("div",{class:"zcode-part-modal-content",onClick:F[6]||(F[6]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",Cz,[a.createElementVNode("div",vz,a.toDisplayString(a.unref(V)?$.$t("partsManager.createType"):$.$t("partsManager.editType")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":$.$t("common.close"),onClick:F[2]||(F[2]=(...re)=>a.unref(K)&&a.unref(K)(...re))},[a.createVNode(a.unref(Qe),{size:18})],8,Tz)]),a.createElementVNode("div",zz,[a.createElementVNode("div",_z,[a.createElementVNode("label",null,[a.createTextVNode(a.toDisplayString($.$t("partsManager.typeName"))+" ",1),F[27]||(F[27]=a.createElementVNode("span",{class:"zcode-required"},"*",-1))]),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":F[3]||(F[3]=re=>a.unref(W).type=re),type:"text",placeholder:$.$t("partsManager.typeNamePlaceholder"),class:"zcode-text-input",required:""},null,8,Az),[[a.vModelText,a.unref(W).type]])]),a.createElementVNode("div",Mz,[a.createElementVNode("label",null,a.toDisplayString($.$t("partsManager.typeDescription")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":F[4]||(F[4]=re=>a.unref(W).description=re),type:"text",placeholder:$.$t("partsManager.typeDescriptionPlaceholder"),class:"zcode-text-input"},null,8,Iz),[[a.vModelText,a.unref(W).description]])])]),a.createElementVNode("div",Oz,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:Ve},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString($.$t("common.confirm")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:F[5]||(F[5]=(...re)=>a.unref(K)&&a.unref(K)(...re))},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString($.$t("common.cancel")),1)])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.unref(z)&&a.unref(P)==="part"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:a.withModifiers(ve,["self"])},[a.createElementVNode("div",{class:"zcode-part-modal-content",onClick:F[17]||(F[17]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",Dz,[a.createElementVNode("div",Rz,a.toDisplayString($.$t("partsManager.editPart",{title:a.unref(z).part.title})),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":$.$t("common.close"),onClick:ve},[a.createVNode(a.unref(Qe),{size:18})],8,Pz)]),a.createElementVNode("div",Lz,[a.createElementVNode("div",$z,[a.createElementVNode("div",Vz,[a.createElementVNode("div",Bz,[a.createElementVNode("label",null,[a.createTextVNode(a.toDisplayString($.$t("partsManager.partTitle"))+" ",1),F[28]||(F[28]=a.createElementVNode("span",{class:"zcode-required"},"*",-1))]),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":F[8]||(F[8]=re=>a.unref(z).part.title=re),type:"text",class:"zcode-text-input",required:""},null,512),[[a.vModelText,a.unref(z).part.title]])]),a.createElementVNode("div",Fz,[a.createElementVNode("label",null,a.toDisplayString($.$t("partsManager.partDescription")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":F[9]||(F[9]=re=>a.unref(z).part.description=re),type:"text",class:"zcode-text-input",placeholder:$.$t("partsManager.partDescriptionPlaceholder")},null,8,jz),[[a.vModelText,a.unref(z).part.description]])])])]),a.createElementVNode("div",Uz,[a.createElementVNode("div",Hz,[a.createElementVNode("div",Wz,[a.createElementVNode("div",{class:"zcode-template-tabs",role:"tablist","aria-label":$.$t("partsManager.codeEdit")},[a.createElementVNode("button",{type:"button",class:a.normalizeClass(["zcode-template-tab",{active:u.value==="html"}]),role:"tab","aria-selected":u.value==="html",onClick:F[10]||(F[10]=re=>u.value="html")}," HTML ",10,qz),a.createElementVNode("button",{type:"button",class:a.normalizeClass(["zcode-template-tab",{active:u.value==="css"}]),role:"tab","aria-selected":u.value==="css",onClick:F[11]||(F[11]=re=>u.value="css")}," CSS ",10,Kz)],8,Gz),a.createElementVNode("div",Jz,[u.value==="css"?(a.openBlock(),a.createElementBlock("div",Xz,[a.createVNode(a.unref(na),{size:14,class:"zcode-css-warning-compact-icon"}),a.createElementVNode("span",Yz,a.toDisplayString($.$t("partsManager.cssEditInfo")),1),a.createElementVNode("button",{class:"zcode-help-btn",type:"button",title:$.$t("partsManager.cssEditWarning"),onClick:T},[a.createVNode(a.unref(Vn),{size:14})],8,Qz)])):a.createCommentVNode("",!0),u.value==="html"?(a.openBlock(),a.createElementBlock("label",Zz,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":F[12]||(F[12]=re=>i.value=re),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[a.vModelCheckbox,i.value]]),a.createElementVNode("span",null,a.toDisplayString($.$t("partsManager.templateSuggestions")),1)])):a.createCommentVNode("",!0),u.value==="html"?(a.openBlock(),a.createElementBlock("button",{key:2,class:"zcode-help-btn",type:"button",title:$.$t("partsManager.templateHelpButton"),onClick:v},[a.createVNode(a.unref(Vn),{size:16})],8,e_)):a.createCommentVNode("",!0)])]),a.createElementVNode("div",t_,[u.value==="html"?(a.openBlock(),a.createBlock(Pm,{key:0,modelValue:a.unref(z).part.body,"onUpdate:modelValue":F[13]||(F[13]=re=>a.unref(z).part.body=re),language:"html",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":i.value,class:"zcode-monaco-editor"},null,8,["modelValue","enable-suggestions"])):(a.openBlock(),a.createBlock(Pm,{key:1,modelValue:f.value,"onUpdate:modelValue":F[14]||(F[14]=re=>f.value=re),language:"css",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":!0,class:"zcode-monaco-editor"},null,8,["modelValue"]))])]),a.createElementVNode("div",n_,[a.createElementVNode("div",o_,[a.createElementVNode("div",{class:"zcode-part-editor-preview-tab",onClick:F[15]||(F[15]=re=>r.value=!0),innerHTML:a.unref(ce)(a.unref(z).type,a.unref(z).part)},null,8,r_),a.createElementVNode("div",i_,a.toDisplayString($.$t("partsManager.clickToEnlarge")),1)])])]),_.value?(a.openBlock(),a.createElementBlock("div",s_,[a.createElementVNode("div",a_,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(z).part.slots||{},(re,ae)=>(a.openBlock(),a.createElementBlock("div",{key:`part-${a.unref(z).partIndex}-${ae}`,class:"zcode-slot-config-item"},[a.createElementVNode("div",l_,[a.createElementVNode("div",c_,a.toDisplayString($.$t("partsManager.slot"))+": "+a.toDisplayString(ae),1),a.createElementVNode("button",{class:"zcode-btn-small",onClick:ke=>a.unref(_e)(a.unref(z).partIndex,ae)},[a.createVNode(a.unref(Bn),{size:12})],8,d_)]),a.createElementVNode("div",u_,[a.createElementVNode("label",null,a.toDisplayString($.$t("partsManager.allowedParts")),1),a.createElementVNode("div",f_,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":ke=>Ae.value[ae]=ke,type:"text",placeholder:$.$t("partsManager.searchParts"),class:"zcode-text-input",style:{"margin-bottom":"8px"}},null,8,p_),[[a.vModelText,Ae.value[ae]]]),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(Te(ae),ke=>(a.openBlock(),a.createElementBlock("label",{key:`allowed-${ae}-${ke.typeName}-${ke.id}`,class:"zcode-checkbox-item"},[a.createElementVNode("input",{type:"checkbox",checked:we(ae).includes(ke.id),class:"zcode-checkbox",onChange:Fe=>B(ae,ke.id,Fe)},null,40,h_),a.createElementVNode("span",null,a.toDisplayString(ke.title)+" ("+a.toDisplayString(ke.typeName)+")",1)]))),128))])])]))),128)),Ce.value.length>0?(a.openBlock(),a.createElementBlock("div",m_,[a.createElementVNode("label",null,a.toDisplayString($.$t("partsManager.addSlot")),1),a.createElementVNode("div",g_,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":F[16]||(F[16]=re=>I.value=re),class:"zcode-select-input"},[a.createElementVNode("option",b_,a.toDisplayString($.$t("partsManager.selectSlot")),1),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(Ce.value,re=>(a.openBlock(),a.createElementBlock("option",{key:re,value:re},a.toDisplayString(re==="default"?$.$t("partsManager.defaultSlot"):re),9,y_))),128))],512),[[a.vModelSelect,I.value]]),a.createElementVNode("button",{disabled:!I.value,class:"zcode-btn-secondary",onClick:q},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString($.$t("common.add")),1)],8,x_)])])):a.createCommentVNode("",!0)])])):a.createCommentVNode("",!0)]),a.createElementVNode("div",E_,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:me},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString($.$t("common.confirm")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:ve},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString($.$t("common.cancel")),1)])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[r.value&&a.unref(z)?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:F[20]||(F[20]=re=>r.value=!1)},[a.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:F[19]||(F[19]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",k_,[a.createElementVNode("div",w_,a.toDisplayString($.$t("partsManager.preview"))+" "+a.toDisplayString(a.unref(z).part.title),1),a.createElementVNode("button",{class:"zcode-close-btn",onClick:F[18]||(F[18]=re=>r.value=!1)},[a.createVNode(a.unref(Qe),{size:18})])]),a.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:a.unref(ce)(a.unref(z).type,a.unref(z).part)},null,8,S_)])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[l.value&&(a.unref(D)==="common"||a.unref(D)==="individual"||a.unref(D)==="special")?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:a.withModifiers(M,["self"])},[a.createElementVNode("div",{class:"zcode-help-modal zcode-css-warning-modal",onClick:F[22]||(F[22]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",N_,[a.createElementVNode("div",C_,[a.createVNode(a.unref(Vc),{size:20,class:"zcode-css-warning-modal-title-icon"}),a.createElementVNode("span",null,a.toDisplayString($.$t("partsManager.cssEditWarning")),1)]),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":$.$t("common.close"),onClick:M},[a.createVNode(a.unref(Qe),{size:20})],8,v_)]),a.createElementVNode("div",T_,[a.createElementVNode("div",z_,[a.createElementVNode("div",__,[a.createElementVNode("ul",A_,[a.createElementVNode("li",null,[a.unref(D)==="common"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createTextVNode(a.toDisplayString($.$t("partsManager.cssEditWarningMessageCommon")),1)],64)):a.unref(D)==="individual"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createTextVNode(a.toDisplayString($.$t("partsManager.cssEditWarningMessageIndividual")),1)],64)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:2},[a.createTextVNode(a.toDisplayString($.$t("partsManager.cssEditWarningMessageSpecial")),1)],64))])])])])]),a.createElementVNode("div",M_,[a.createElementVNode("label",I_,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":F[21]||(F[21]=re=>d.value=re),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[a.vModelCheckbox,d.value]]),a.createElementVNode("span",null,a.toDisplayString($.$t("partsManager.dontShowAgain")),1)]),a.createElementVNode("button",{class:"zcode-btn-primary",onClick:M},a.toDisplayString($.$t("partsManager.understood")),1)])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[c.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:F[25]||(F[25]=a.withModifiers(re=>c.value=!1,["self"]))},[a.createElementVNode("div",{class:"zcode-help-modal",onClick:F[24]||(F[24]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",O_,[a.createElementVNode("div",D_,[a.createVNode(a.unref(na),{size:20,class:"zcode-css-warning-modal-title-icon"}),a.createElementVNode("span",null,a.toDisplayString($.$t("dataViewer.categoryInfo.title")),1)]),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":$.$t("common.close"),onClick:F[23]||(F[23]=re=>c.value=!1)},[a.createVNode(a.unref(Qe),{size:18})],8,R_)]),a.createElementVNode("div",P_,[a.createElementVNode("div",L_,[a.createElementVNode("div",$_,a.toDisplayString($.$t("dataViewer.categoryInfo.common.title")),1),a.createElementVNode("div",V_,a.toDisplayString($.$t("dataViewer.categoryInfo.common.description")),1)]),a.createElementVNode("div",B_,[a.createElementVNode("div",F_,a.toDisplayString($.$t("dataViewer.categoryInfo.individual.title")),1),a.createElementVNode("div",j_,a.toDisplayString($.$t("dataViewer.categoryInfo.individual.description")),1)]),a.createElementVNode("div",U_,[a.createElementVNode("div",H_,a.toDisplayString($.$t("dataViewer.categoryInfo.special.title")),1),a.createElementVNode("div",W_,a.toDisplayString($.$t("dataViewer.categoryInfo.special.description")),1)])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[s.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:w},[a.createElementVNode("div",{class:"zcode-help-modal",onClick:F[26]||(F[26]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",G_,[a.createElementVNode("div",q_,a.toDisplayString($.$t("partsManager.templateHelpTitle")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":$.$t("common.close"),onClick:w},[a.createVNode(a.unref(Qe),{size:20})],8,K_)]),a.createElementVNode("div",J_,[a.createElementVNode("table",X_,[a.createElementVNode("thead",null,[a.createElementVNode("tr",null,[a.createElementVNode("th",null,a.toDisplayString($.$t("partsManager.syntax")),1),a.createElementVNode("th",null,a.toDisplayString($.$t("partsManager.description")),1),a.createElementVNode("th",null,a.toDisplayString($.$t("partsManager.example")),1)])]),a.createElementVNode("tbody",null,[a.createElementVNode("tr",null,[F[29]||(F[29]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default}")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.textField")),1),F[30]||(F[30]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$title:タイトル}")],-1))]),a.createElementVNode("tr",null,[F[31]||(F[31]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default:rich}")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.richText")),1),F[32]||(F[32]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$content:本文:rich}")],-1))]),a.createElementVNode("tr",null,[F[33]||(F[33]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default:textarea}")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.textarea")),1),F[34]||(F[34]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$description:説明:textarea}")],-1))]),a.createElementVNode("tr",null,[F[35]||(F[35]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default:image}")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.image")),1),F[36]||(F[36]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$hero:default.jpg:image}")],-1))]),a.createElementVNode("tr",null,[F[37]||(F[37]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field:option1|option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.radio")),1),F[38]||(F[38]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($color:red|blue|green)")],-1))]),a.createElementVNode("tr",null,[F[39]||(F[39]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field:option1,option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.checkbox")),1),F[40]||(F[40]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($features:fast,secure)")],-1))]),a.createElementVNode("tr",null,[F[41]||(F[41]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field@:option1|option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.selectSingle")),1),F[42]||(F[42]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($size@:S|M|L)")],-1))]),a.createElementVNode("tr",null,[F[43]||(F[43]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field@:option1,option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.selectMultiple")),1),F[44]||(F[44]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($tags@:tag1,tag2,tag3)")],-1))]),a.createElementVNode("tr",null,[F[45]||(F[45]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'z-if="show_field"')],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.conditional")),1),F[46]||(F[46]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'<div z-if="show_content">...</div>')],-1))]),a.createElementVNode("tr",null,[F[47]||(F[47]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'z-slot="name"')],-1)),a.createElementVNode("td",null,a.toDisplayString($.$t("partsManager.templateHelp.slot")),1),F[48]||(F[48]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'<div z-slot="content"></div>')],-1))])])]),a.createElementVNode("div",Y_,[a.createElementVNode("div",Q_,a.toDisplayString($.$t("partsManager.templateHelp.note")),1),a.createElementVNode("div",Z_,[a.createElementVNode("div",{role:"listitem",class:"zcode-help-section-item",innerHTML:$.$t("partsManager.templateHelp.suggestionNote")},null,8,eA),a.createElementVNode("div",tA,a.toDisplayString($.$t("partsManager.templateHelp.fieldNameNote")),1),a.createElementVNode("div",nA,a.toDisplayString($.$t("partsManager.templateHelp.defaultValueNote")),1)])])])])])):a.createCommentVNode("",!0)]))])]))}});function rA(t){const e=a.ref("common"),n=a.ref(null),o=a.ref(null),r=a.ref(!1),i=a.ref(null),s=a.computed(()=>e.value==="common"?t.images.common:e.value==="individual"?t.images.individual:t.images.special);function l(x){n.value=x,o.value=null,r.value=!1}function c(x){return new Promise((v,w)=>{const T=new FileReader;T.onload=M=>{const A=M.target?.result,y={id:`img-${Date.now()}`,name:x.name,url:A,mimeType:x.type,needsUpload:!0};e.value==="common"?t.images.common.push(y):e.value==="individual"?t.images.individual.push(y):t.images.special.push(y),v(y)},T.onerror=w,T.readAsDataURL(x)})}function d(x){Sc(x,t.page).forEach(A=>{Object.keys(A.component).forEach(y=>{y.includes("image")&&A.component[y]===x&&(A.component[y]="")})});const w=t.images.common.findIndex(A=>A.id===x);w!==-1&&t.images.common.splice(w,1);const T=t.images.individual.findIndex(A=>A.id===x);T!==-1&&t.images.individual.splice(T,1);const M=t.images.special.findIndex(A=>A.id===x);M!==-1&&t.images.special.splice(M,1),n.value?.id===x&&(n.value=null)}function u(x){o.value={...x},r.value=!1,n.value=x}function f(){if(!o.value)return;let x;e.value==="common"?x=t.images.common:e.value==="individual"?x=t.images.individual:x=t.images.special;const v=x.findIndex(w=>w.id===o.value.id);v!==-1&&(x[v]=o.value),o.value=null,r.value=!1}function p(){o.value=null,r.value=!1}function h(x){return Sc(x,t.page)}function m(x){if(!i.value){i.value=x;return}if(i.value===x){g();return}b(i.value,x),g()}function b(x,v){let w;e.value==="common"?w=t.images.common:e.value==="individual"?w=t.images.individual:w=t.images.special;const T=w.findIndex(y=>y.id===x),M=w.findIndex(y=>y.id===v);if(T===-1||M===-1)return;const[A]=w.splice(T,1);w.splice(M,0,A)}function g(){i.value=null}return{reorderSourceImage:i,handleReorderClick:m,cancelReorder:g,activeCategory:e,selectedImage:n,editingImage:o,isCreatingNew:r,currentImages:s,selectImage:l,addImage:c,deleteImage:d,startEditing:u,saveImage:f,cancelEditing:p,checkImageUsage:h}}const iA={class:"zcode-images-manager"},sA={class:"zcode-images-category-tabs"},aA={class:"zcode-images-category-tab-group"},lA=["onClick"],cA=["title"],dA={class:"zcode-images-add-wrapper"},uA={class:"zcode-images-manager-content"},fA={class:"zcode-images-grid"},pA=["onClick"],hA={key:0,class:"zcode-reorder-source-indicator"},mA=["src","alt"],gA={class:"zcode-image-item-overlay"},bA={class:"zcode-image-item-actions"},yA=["title","onClick"],xA=["title","onClick"],EA={class:"zcode-image-item-name"},kA={class:"zcode-image-editor-header"},wA={class:"zcode-image-editor-header-title",role:"heading","aria-level":"4"},SA=["aria-label"],NA={class:"zcode-image-editor-form"},CA={class:"zcode-image-preview-large"},vA=["src","alt"],TA={class:"zcode-form-field"},zA={class:"zcode-form-field"},_A={class:"zcode-image-editor-actions"},AA={class:"zcode-help-modal-header"},MA={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},IA=["aria-label"],OA={class:"zcode-help-modal-body"},DA={class:"zcode-help-section"},RA={class:"zcode-help-section-title",role:"heading","aria-level":"4"},PA={class:"zcode-help-section-item"},LA={class:"zcode-help-section"},$A={class:"zcode-help-section-title",role:"heading","aria-level":"4"},VA={class:"zcode-help-section-item"},BA={class:"zcode-help-section"},FA={class:"zcode-help-section-title",role:"heading","aria-level":"4"},jA={class:"zcode-help-section-item"},UA=a.defineComponent({__name:"ImagesManagerPanel",props:{cmsData:{type:Object},config:{type:Object}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.ref(null),i=a.ref(!1),s=a.computed(()=>o.config?.categoryOrder||"common"),l=a.computed(()=>{const A=[],y=o.cmsData.images.special.length>0;return s.value==="individual"?(A.push("individual","common"),y&&A.push("special")):s.value==="special"?(y&&A.push("special"),A.push("common","individual")):(A.push("common","individual"),y&&A.push("special")),A}),{reorderSourceImage:c,handleReorderClick:d,activeCategory:u,editingImage:f,currentImages:p,addImage:h,deleteImage:m,startEditing:b,saveImage:g,cancelEditing:x,checkImageUsage:v}=rA(o.cmsData);o.config?.categoryOrder==="individual"?u.value="individual":o.config?.categoryOrder==="special"&&(u.value="special"),e({activeCategory:u});async function w(A){const y=A.target,E=y.files?.[0];if(E)try{await h(E),y&&(y.value="")}catch(S){console.error("画像追加エラー:",S),alert(n("imagesManager.addImageFailed"))}}function T(A){const y=["zcode-image-item"];return c.value===A.id&&y.push("zcode-reorder-source"),y.join(" ")}function M(A){const y=v(A.id);if(y.length>0){if(!confirm(n("imagesManager.deleteImageWithUsagesConfirm",{count:y.length})))return}else if(!confirm(n("imagesManager.deleteImageConfirm")))return;m(A.id)}return(A,y)=>(a.openBlock(),a.createElementBlock("div",iA,[a.createElementVNode("div",sA,[a.createElementVNode("div",aA,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(l.value,E=>(a.openBlock(),a.createElementBlock("button",{key:E,class:a.normalizeClass([{active:a.unref(u)===E},"zcode-category-tab"]),onClick:S=>u.value=E},a.toDisplayString(E==="common"?A.$t("dataViewer.common"):E==="individual"?A.$t("dataViewer.individual"):A.$t("dataViewer.special")),11,lA))),128)),a.createElementVNode("button",{class:"zcode-help-btn",title:A.$t("dataViewer.categoryInfo.title"),onClick:y[0]||(y[0]=E=>i.value=!0)},[a.createVNode(a.unref(Vn),{size:14})],8,cA)]),a.createElementVNode("div",dA,[a.createElementVNode("input",{ref_key:"fileInput",ref:r,type:"file",accept:"image/*",style:{display:"none"},onChange:w},null,544),a.createElementVNode("button",{class:"zcode-btn-primary zcode-images-add-btn",onClick:y[1]||(y[1]=E=>r.value?.click())},[a.createVNode(a.unref(uo),{size:14}),a.createElementVNode("span",null,a.toDisplayString(A.$t("imagesManager.addImage")),1)])])]),a.createElementVNode("div",uA,[a.createElementVNode("div",fA,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(p),E=>(a.openBlock(),a.createElementBlock("div",{key:E.id,class:a.normalizeClass(T(E)),onClick:S=>a.unref(b)(E)},[a.unref(c)===E.id?(a.openBlock(),a.createElementBlock("div",hA,a.toDisplayString(A.$t("partsManager.source")),1)):a.createCommentVNode("",!0),a.createElementVNode("img",{src:E.url,alt:E.name},null,8,mA),a.createElementVNode("div",gA,[a.createElementVNode("div",bA,[a.createElementVNode("button",{class:a.normalizeClass(["zcode-action-btn",{active:a.unref(c)===E.id}]),title:A.$t("partsManager.reorderPart"),onClick:a.withModifiers(S=>a.unref(d)(E.id),["stop"])},[a.createVNode(a.unref(ir),{size:16})],10,yA),a.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:A.$t("partsManager.deletePartButton"),onClick:a.withModifiers(S=>M(E),["stop"])},[a.createVNode(a.unref(Bn),{size:16})],8,xA)])]),a.createElementVNode("div",EA,a.toDisplayString(E.name),1)],10,pA))),128))])]),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.unref(f)?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:y[8]||(y[8]=a.withModifiers((...E)=>a.unref(x)&&a.unref(x)(...E),["self"]))},[a.createElementVNode("div",{class:"zcode-image-modal-content","data-edit-mode":"",onClick:y[7]||(y[7]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",kA,[a.createElementVNode("div",wA,a.toDisplayString(A.$t("imagesManager.editImage")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":A.$t("common.close"),onClick:y[2]||(y[2]=(...E)=>a.unref(x)&&a.unref(x)(...E))},[a.createVNode(a.unref(Qe),{size:18})],8,SA)]),a.createElementVNode("div",NA,[a.createElementVNode("div",CA,[a.createElementVNode("img",{src:a.unref(f).url,alt:a.unref(f).name,class:"zcode-image-preview-large-img"},null,8,vA)]),a.createElementVNode("div",TA,[a.createElementVNode("label",null,a.toDisplayString(A.$t("imagesManager.imageId")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":y[3]||(y[3]=E=>a.unref(f).id=E),type:"text",class:"zcode-text-input",disabled:""},null,512),[[a.vModelText,a.unref(f).id]])]),a.createElementVNode("div",zA,[a.createElementVNode("label",null,a.toDisplayString(A.$t("imagesManager.imageName")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":y[4]||(y[4]=E=>a.unref(f).name=E),type:"text",class:"zcode-text-input"},null,512),[[a.vModelText,a.unref(f).name]])]),a.createElementVNode("div",_A,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-image-editor-actions-btn",onClick:y[5]||(y[5]=(...E)=>a.unref(g)&&a.unref(g)(...E))},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString(A.$t("common.confirm")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel zcode-image-editor-actions-btn",onClick:y[6]||(y[6]=(...E)=>a.unref(x)&&a.unref(x)(...E))},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(A.$t("common.cancel")),1)])])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[i.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:y[11]||(y[11]=a.withModifiers(E=>i.value=!1,["self"]))},[a.createElementVNode("div",{class:"zcode-help-modal",onClick:y[10]||(y[10]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",AA,[a.createElementVNode("div",MA,[a.createVNode(a.unref(na),{size:20,class:"zcode-css-warning-modal-title-icon"}),a.createElementVNode("span",null,a.toDisplayString(A.$t("dataViewer.categoryInfo.title")),1)]),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":A.$t("common.close"),onClick:y[9]||(y[9]=E=>i.value=!1)},[a.createVNode(a.unref(Qe),{size:18})],8,IA)]),a.createElementVNode("div",OA,[a.createElementVNode("div",DA,[a.createElementVNode("div",RA,a.toDisplayString(A.$t("dataViewer.categoryInfo.common.title")),1),a.createElementVNode("div",PA,a.toDisplayString(A.$t("dataViewer.categoryInfo.common.description")),1)]),a.createElementVNode("div",LA,[a.createElementVNode("div",$A,a.toDisplayString(A.$t("dataViewer.categoryInfo.individual.title")),1),a.createElementVNode("div",VA,a.toDisplayString(A.$t("dataViewer.categoryInfo.individual.description")),1)]),a.createElementVNode("div",BA,[a.createElementVNode("div",FA,a.toDisplayString(A.$t("dataViewer.categoryInfo.special.title")),1),a.createElementVNode("div",jA,a.toDisplayString(A.$t("dataViewer.categoryInfo.special.description")),1)])])])])):a.createCommentVNode("",!0)]))]))}}),HA={class:"zcode-data-viewer"},WA={class:"zcode-data-viewer-header"},GA={class:"zcode-data-viewer-content-tabs"},qA={class:"zcode-data-viewer-tabs"},KA=["onClick"],JA={class:"zcode-data-viewer-content"},XA={class:"zcode-data-viewer-display-wrapper"},YA={class:"zcode-data-viewer-display"},QA=["title"],ZA=a.defineComponent({__name:"DataViewer",props:{cmsData:{type:Object},config:{type:Object}},setup(t,{expose:e}){const n=t,o=a.ref("page"),r=a.ref("json"),i=a.ref(!1),s=a.computed(()=>n.config?.categoryOrder||"common"),l=a.computed(()=>{const v=[],w=o.value==="parts"?n.cmsData.parts.special.length>0:n.cmsData.images.special.length>0;return s.value==="individual"?(v.push("individual","common"),w&&v.push("special")):s.value==="special"?(w&&v.push("special"),v.push("common","individual")):(v.push("common","individual"),w&&v.push("special")),v}),c=a.ref(n.config?.categoryOrder==="individual"?"individual":n.config?.categoryOrder==="special"?"special":"common"),{fullPageHtml:d}=fi(n.cmsData,!1),u=a.computed(()=>{switch(o.value){case"page":return n.cmsData.page;case"parts":return c.value==="common"?n.cmsData.parts.common:c.value==="individual"?n.cmsData.parts.individual:n.cmsData.parts.special;case"images":return c.value==="common"?n.cmsData.images.common:c.value==="individual"?n.cmsData.images.individual:n.cmsData.images.special;default:return null}}),f=a.ref("");let p="";function h(){try{const v=u.value,w=JSON.stringify(v,null,2);if(w===p)return;f.value=w,p=w}catch{f.value=String(u.value),p=f.value}}function m(v){let w=v.replace(/\\\\/g,"\0").replace(/\\u([0-9a-fA-F]{4})/g,(T,M)=>String.fromCharCode(parseInt(M,16))).replace(/\\n/g,`
485
+ `},Im=IT(PT)(Mm),LT={config:DT},$T=function(){for(var e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];return function(r){return n.reduceRight(function(i,s){return s(i)},r)}};function Om(t,e){return Object.keys(e).forEach(function(n){e[n]instanceof Object&&t[n]&&Object.assign(e[n],Om(t[n],e[n]))}),zm(zm({},t),e)}var VT={type:"cancelation",msg:"operation is manually canceled"};function Nc(t){var e=!1,n=new Promise(function(o,r){t.then(function(i){return e?r(VT):o(i)}),t.catch(r)});return n.cancel=function(){return e=!0},n}var BT=["monaco"],FT=AT.create({config:MT,isInitialized:!1,resolve:null,reject:null,monaco:null}),Dm=fT(FT,2),ti=Dm[0],Js=Dm[1];function jT(t){var e=LT.config(t),n=e.monaco,o=dT(e,BT);Js(function(r){return{config:Om(r.config,o),monaco:n}})}function UT(){var t=ti(function(e){var n=e.monaco,o=e.isInitialized,r=e.resolve;return{monaco:n,isInitialized:o,resolve:r}});if(!t.isInitialized){if(Js({isInitialized:!0}),t.monaco)return t.resolve(t.monaco),Nc(Cc);if(window.monaco&&window.monaco.editor)return Rm(window.monaco),t.resolve(window.monaco),Nc(Cc);$T(HT,GT)(qT)}return Nc(Cc)}function HT(t){return document.body.appendChild(t)}function WT(t){var e=document.createElement("script");return t&&(e.src=t),e}function GT(t){var e=ti(function(o){var r=o.config,i=o.reject;return{config:r,reject:i}}),n=WT("".concat(e.config.paths.vs,"/loader.js"));return n.onload=function(){return t()},n.onerror=e.reject,n}function qT(){var t=ti(function(n){var o=n.config,r=n.resolve,i=n.reject;return{config:o,resolve:r,reject:i}}),e=window.require;e.config(t.config),e(["vs/editor/editor.main"],function(n){var o=n.m||n;Rm(o),t.resolve(o)},function(n){t.reject(n)})}function Rm(t){ti().monaco||Js({monaco:t})}function KT(){return ti(function(t){var e=t.monaco;return e})}var Cc=new Promise(function(t,e){return Js({resolve:t,reject:e})}),JT={config:jT,init:UT,__getMonacoInstance:KT};const XT={class:"monaco-editor-wrapper"},YT={key:0,class:"monaco-editor-error"},Pm=((t,e)=>{const n=t.__vccOpts||t;for(const[o,r]of e)n[o]=r;return n})(a.defineComponent({__name:"MonacoEditor",props:{modelValue:{type:String},language:{type:String},theme:{type:String},readOnly:{type:Boolean},minimap:{type:Boolean},height:{type:String},autoHeight:{type:Boolean},maxHeight:{type:Number},enableSuggestions:{type:Boolean}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,o=e,r=a.ref(null),i=a.ref(null);let s=null,l=null,c=!1,d=[];function u(){const p=r.value;if(!p)return;const h=p.getRootNode();if(!(h instanceof ShadowRoot))return;const m=h;Array.from(document.head.querySelectorAll('style, link[rel="stylesheet"]')).filter(x=>{if(x.tagName==="LINK"){const w=x.href||"";return w.includes("monaco")||w.includes("/vs/")||w.includes("vs/")}const v=x.textContent||"";return v.includes(".monaco-editor")||v.includes(".monaco-editor-background")}).forEach(x=>{if(x.tagName==="LINK"){const w=x.href;if(!!m.querySelector(`link[rel="stylesheet"][href="${w}"]`))return}else{const w=x.getAttribute("data-name")||"";if(w&&!!m.querySelector(`style[data-name="${w}"]`))return}const v=x.cloneNode(!0);v.setAttribute("data-zcode-monaco-style","true"),m.appendChild(v),d.push(v)})}function f(){if(!(!s||!r.value||!l)&&n.autoHeight!==!1)try{const p=s.getOption(l.editor.EditorOption.lineHeight)||19;let b=(s.getModel()?.getLineCount()||1)*p+20;n.maxHeight!==void 0&&(b=Math.min(b,n.maxHeight)),r.value.style.height=`${b}px`,s.layout()}catch{r.value.style.height="200px"}}return a.onMounted(async()=>{if(r.value)try{l=await JT.init(),u(),l.languages.registerCompletionItemProvider("html",{provideCompletionItems:(h,m)=>{const b=h.getWordUntilPosition(m),g={startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:b.startColumn,endColumn:b.endColumn},x=h.getValueInRange({startLineNumber:m.lineNumber,startColumn:Math.max(1,m.column-10),endLineNumber:m.lineNumber,endColumn:m.column}),v=[];return(x.endsWith("$")||x.endsWith("{$"))&&v.push({label:"{$field:default}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:textarea}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:textarea}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストエリアフィールド: {$変数名:デフォルト値:textarea}",detail:"テンプレート記法 - テキストエリア",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:rich}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:rich}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"リッチテキストフィールド: {$変数名:デフォルト値:rich}",detail:"テンプレート記法 - リッチテキスト",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}},{label:"{$field:default:image}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:image}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"画像フィールド: {$変数名:デフォルト値:image}",detail:"テンプレート記法 - 画像",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("{$")?2:1),endColumn:m.column}}),(x.endsWith("(")||x.endsWith("$("))&&v.push({label:"($field:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"ラジオボタン: ($フィールド名:選択肢1|選択肢2)",detail:"テンプレート記法 - ラジオボタン",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"チェックボックス: ($フィールド名:選択肢1,選択肢2)",detail:"テンプレート記法 - チェックボックス",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field@:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(単一選択): ($フィールド名@:選択肢1|選択肢2)",detail:"テンプレート記法 - セレクトボックス",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}},{label:"($field@:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(複数選択): ($フィールド名@:選択肢1,選択肢2)",detail:"テンプレート記法 - セレクトボックス(複数)",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-(x.endsWith("$(")?2:1),endColumn:m.column}}),(x.endsWith("z-")||x.endsWith(" z-"))&&v.push({label:'z-if="show_xxx"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-if="show_${1:field}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"条件分岐: z-if属性(フィールドがtrueの場合に表示)",detail:"テンプレート記法 - 条件分岐",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-2,endColumn:m.column}},{label:'z-slot="slotName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-slot="${1:slotName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"スロット: z-slot属性(子コンポーネントを挿入する位置)",detail:"テンプレート記法 - スロット",range:{startLineNumber:m.lineNumber,endLineNumber:m.lineNumber,startColumn:m.column-2,endColumn:m.column}}),v.length===0&&v.push({label:"{$field:default}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"テキストフィールド: {$変数名:デフォルト値}",detail:"テンプレート記法 - テキスト",range:g},{label:"{$field:default:rich}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:rich}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"リッチテキストフィールド: {$変数名:デフォルト値:rich}",detail:"テンプレート記法 - リッチテキスト",range:g},{label:"{$field:default:image}",kind:l.languages.CompletionItemKind.Snippet,insertText:"{$${1:field}:${2:default}:image}",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"画像フィールド: {$変数名:デフォルト値:image}",detail:"テンプレート記法 - 画像",range:g},{label:"($field:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"ラジオボタン: ($フィールド名:選択肢1|選択肢2)",detail:"テンプレート記法 - ラジオボタン",range:g},{label:"($field:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"チェックボックス: ($フィールド名:選択肢1,選択肢2)",detail:"テンプレート記法 - チェックボックス",range:g},{label:"($field@:option1|option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1}|${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(単一選択): ($フィールド名@:選択肢1|選択肢2)",detail:"テンプレート記法 - セレクトボックス",range:g},{label:"($field@:option1,option2)",kind:l.languages.CompletionItemKind.Snippet,insertText:"($${1:field}@:${2:option1},${3:option2})",insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"セレクトボックス(複数選択): ($フィールド名@:選択肢1,選択肢2)",detail:"テンプレート記法 - セレクトボックス(複数)",range:g},{label:'z-if="show_xxx"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-if="show_${1:field}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"条件分岐: z-if属性(フィールドがtrueの場合に表示)",detail:"テンプレート記法 - 条件分岐",range:g},{label:'z-tag="$tagName:h1|h2|h3"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-tag="$${1:tagName}:${2:h1|h2|h3}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"タグ名を動的に変更(選択肢を指定可能)",detail:"テンプレート記法 - タグ名の動的変更",range:g},{label:'z-empty="$fieldName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-empty="$${1:fieldName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"オプショナルフィールドが空の場合、親要素を削除",detail:"テンプレート記法 - 条件分岐(空の場合削除)",range:g},{label:'z-slot="slotName"',kind:l.languages.CompletionItemKind.Snippet,insertText:'z-slot="${1:slotName}"',insertTextRules:l.languages.CompletionItemInsertTextRule.InsertAsSnippet,documentation:"スロット: z-slot属性(子コンポーネントを挿入する位置)",detail:"テンプレート記法 - スロット",range:g}),{suggestions:v}},triggerCharacters:["$","(","z"]});const p=n.enableSuggestions!==!1;s=l.editor.create(r.value,{value:n.modelValue||"",language:n.language||"html",theme:n.theme||"vs-dark",readOnly:n.readOnly||!1,minimap:{enabled:n.minimap===!0},automaticLayout:!0,fontSize:14,tabSize:2,wordWrap:"off",scrollBeyondLastLine:!1,formatOnPaste:!0,formatOnType:!0,lineNumbers:"on",folding:!0,suggestOnTriggerCharacters:p,quickSuggestions:p?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:p,acceptSuggestionOnEnter:p?"on":"off",suggestSelection:"first",mouseWheelScrollSensitivity:1,fastScrollSensitivity:5,scrollbar:{alwaysConsumeMouseWheel:!1}}),s.onDidChangeModelContent(()=>{if(!c){const h=s.getValue();o("update:modelValue",h),f()}}),f()}catch(p){i.value=`Monaco Editorの読み込みに失敗しました: ${p}`,console.error("Monaco Editor error:",p)}}),a.watch(()=>n.modelValue,async p=>{s&&s.getValue()!==p&&(c=!0,await a.nextTick(),s.setValue(p||""),c=!1,f())}),a.watch(()=>n.enableSuggestions,p=>{if(s&&l){const h=p!==!1;s.updateOptions({suggestOnTriggerCharacters:h,quickSuggestions:h?{other:!0,comments:!1,strings:!0}:!1,acceptSuggestionOnCommitCharacter:h,acceptSuggestionOnEnter:h?"on":"off"})}}),a.onUnmounted(()=>{s&&(s.dispose(),s=null),d.forEach(p=>p.remove()),d=[]}),(p,h)=>(a.openBlock(),a.createElementBlock("div",XT,[a.createElementVNode("div",{ref_key:"editorContainer",ref:r,class:"monaco-editor-container"},null,512),i.value?(a.openBlock(),a.createElementBlock("div",YT,a.toDisplayString(i.value),1)):a.createCommentVNode("",!0)]))}}),[["styles",[".monaco-editor-wrapper{width:100%}.monaco-editor-container{width:100%;min-height:100px;max-height:400px;border:1px solid #d1d5db;border-radius:4px;overflow:hidden}.monaco-editor-error{padding:8px;background:#fee;color:#c33;border-radius:4px;margin-top:8px;font-size:12px}"]]]),QT={class:"zcode-parts-manager"},ZT={class:"zcode-parts-category-tabs"},ez={class:"zcode-parts-category-tab-group"},tz=["onClick"],nz=["title"],oz={class:"zcode-parts-add-wrapper"},rz={class:"zcode-parts-manager-content"},iz={class:"zcode-parts-items"},sz={class:"zcode-part-type-title",role:"heading","aria-level":"5"},az={class:"zcode-part-type-actions"},lz=["title","onClick"],cz=["title","onClick"],dz=["title","onClick"],uz={class:"zcode-part-type-items"},fz=["onClick"],pz={key:0,class:"zcode-reorder-source-indicator"},hz={class:"zcode-part-item-header"},mz={class:"zcode-part-type"},gz={class:"zcode-part-item-actions"},bz=["title","onClick"],yz=["title","onClick"],xz=["title","onClick"],Ez={class:"zcode-part-item-content"},kz={class:"zcode-part-modules"},wz={key:0,class:"zcode-part-preview"},Sz=["innerHTML"],Nz=["onClick"],Cz={class:"zcode-part-item-add-content"},vz={class:"zcode-part-editor-header"},Tz={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},zz=["aria-label"],_z={class:"zcode-part-editor-form"},Az={class:"zcode-form-field"},Mz=["placeholder"],Iz={class:"zcode-form-field"},Oz=["placeholder"],Dz={class:"zcode-part-editor-actions"},Rz={class:"zcode-part-editor-header"},Pz={class:"zcode-part-editor-header-title",role:"heading","aria-level":"4"},Lz=["aria-label"],$z={class:"zcode-part-editor-form"},Vz={class:"zcode-part-editor-topbar"},Bz={class:"zcode-part-editor-topfields"},Fz={class:"zcode-form-field"},jz={class:"zcode-form-field"},Uz=["placeholder"],Hz={class:"zcode-part-editor-main"},Wz={class:"zcode-part-editor-pane zcode-part-editor-pane--code"},Gz={class:"zcode-part-editor-pane-header"},qz=["aria-label"],Kz=["aria-selected"],Jz=["aria-selected"],Xz={class:"zcode-part-editor-pane-header-actions"},Yz={key:0,class:"zcode-css-warning-compact"},Qz={class:"zcode-css-warning-compact-text"},Zz=["title"],e_={key:1,class:"zcode-checkbox-label zcode-checkbox-label-inline"},t_=["title"],n_={class:"zcode-part-editor-pane-body"},o_={class:"zcode-part-editor-pane zcode-part-editor-pane--side"},r_={class:"zcode-part-editor-pane-body"},i_=["innerHTML"],s_={class:"zcode-part-editor-preview-hint"},a_={key:0,class:"zcode-part-editor-slots-bottom"},l_={class:"zcode-slots-config"},c_={class:"zcode-slot-config-header"},d_={class:"zcode-slot-config-title"},u_=["onClick"],f_={class:"zcode-slot-config-body"},p_={class:"zcode-checkbox-group"},h_=["onUpdate:modelValue","placeholder"],m_=["checked","onChange"],g_={key:0,class:"zcode-slot-add-section"},b_={class:"zcode-slot-add-controls"},y_={value:""},x_=["value"],E_=["disabled"],k_={class:"zcode-part-editor-actions"},w_={class:"zcode-preview-modal-header"},S_={class:"zcode-preview-modal-header-title",role:"heading","aria-level":"4"},N_=["innerHTML"],C_={class:"zcode-help-modal-header"},v_={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},T_=["aria-label"],z_={class:"zcode-help-modal-body"},__={class:"zcode-warning-content"},A_={class:"zcode-warning-text"},M_={class:"zcode-warning-list"},I_={class:"zcode-css-warning-modal-footer"},O_={class:"zcode-checkbox-label",style:{"margin-bottom":"12px"}},D_={class:"zcode-help-modal-header"},R_={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},P_=["aria-label"],L_={class:"zcode-help-modal-body"},$_={class:"zcode-help-section"},V_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},B_={class:"zcode-help-section-item"},F_={class:"zcode-help-section"},j_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},U_={class:"zcode-help-section-item"},H_={class:"zcode-help-section"},W_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},G_={class:"zcode-help-section-item"},q_={class:"zcode-help-modal-header"},K_={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},J_=["aria-label"],X_={class:"zcode-help-modal-body"},Y_={class:"zcode-help-table"},Q_={class:"zcode-help-section"},Z_={class:"zcode-help-section-title",role:"heading","aria-level":"4"},eA={role:"list",class:"zcode-help-section-list"},tA=["innerHTML"],nA={role:"listitem",class:"zcode-help-section-item"},oA={role:"listitem",class:"zcode-help-section-item"},rA=a.defineComponent({__name:"PartsManagerPanel",props:{cmsData:{type:Object},config:{type:Object}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.ref(!1),i=a.ref(m1("enableTemplateSuggestions",!1)),s=a.ref(!1),l=a.ref(!1),c=a.ref(!1),d=a.ref(g1()),u=a.ref("html"),f=a.ref(""),p=a.ref(""),h={common:"zcode-css-style-parts-manager-preview-common",individual:"zcode-css-style-parts-manager-preview-individual",special:"zcode-css-style-parts-manager-preview-special"},m=new Map,b=a.computed(()=>O.value==="common"?o.cmsData.css?.common??"":O.value==="individual"?o.cmsData.css?.individual??"":o.cmsData.css?.special??"");function g(B){["common","individual","special"].forEach(ie=>{const le=B[ie];if(!le||!le.trim()){const Fe=m.get(ie);Fe&&(Fe.remove(),m.delete(ie));return}let we=m.get(ie);we||(we=document.createElement("style"),we.id=h[ie],we.setAttribute("data-zcode-css","true"),we.setAttribute("data-zcode-css-parts-preview","true"),we.setAttribute("data-zcode-css-category",ie),we.parentNode||document.head.appendChild(we),m.set(ie,we)),we.textContent=le})}function x(){m.forEach(B=>{B.remove()}),m.clear()}function v(){s.value=!0}function w(){s.value=!1}function T(){(O.value==="common"||O.value==="individual"||O.value==="special")&&(l.value=!0)}function M(){l.value=!1,b1(d.value)}a.watch(i,B=>{Ba({enableTemplateSuggestions:B})});const A=a.computed(()=>o.config?.categoryOrder||"common"),y=a.computed(()=>{const B=[],U=o.cmsData.parts.special.length>0;return A.value==="individual"?(B.push("individual","common"),U&&B.push("special")):A.value==="special"?(U&&B.push("special"),B.push("common","individual")):(B.push("common","individual"),U&&B.push("special")),B}),{reorderSourcePart:E,handleReorderClick:k,activeCategory:O,editingType:G,editingPart:z,editingLevel:R,isCreatingNew:W,groupedPartsByType:H,startCreating:L,startEditingType:j,startEditingPart:Z,addPartToType:K,saveType:ae,savePart:ee,deletePart:X,checkTypeUsage:Y,cancelEditingType:J,cancelEditingPart:Q,getPartPreviewHtml:de,addPartSlot:ke,removePartSlot:Te,updatePartSlotAllowedParts:$e,getAvailableSlotsForPart:N,extractSlotsFromTemplate:P,reorderSourceType:V,startReorderType:S,deletePartType:C}=iT(o.cmsData);o.config?.categoryOrder==="individual"&&(O.value="individual");const $=a.computed(()=>(R?.value??R)==="part"&&!!z.value);a.watch(()=>$.value,B=>{if(!B){x();return}a.nextTick(()=>{const U=b.value;p.value=U,f.value=U,g({common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special})})},{immediate:!0}),a.watch(()=>O.value,()=>{$.value&&a.nextTick(()=>{const B=b.value;p.value=B,f.value=B})}),a.watch([()=>f.value,()=>$.value,()=>O.value],([B,U,ie])=>{U&&a.nextTick(()=>{const le={common:o.cmsData.css?.common,individual:o.cmsData.css?.individual,special:o.cmsData.css?.special};ie==="common"?le.common=B??"":ie==="individual"?le.individual=B??"":le.special=B??"",g(le)})});async function te(){await ee(),!z.value&&o.cmsData.css&&(O.value==="common"?o.cmsData.css.common=f.value:O.value==="individual"?o.cmsData.css.individual=f.value:o.cmsData.css.special=f.value,p.value=f.value)}function ge(){f.value=p.value,x(),r.value=!1,Q()}a.onBeforeUnmount(()=>{x()}),a.watch(()=>z.value,B=>{B&&(u.value="html")}),a.watch(()=>u.value,B=>{B==="css"&&$.value&&(O.value==="common"||O.value==="individual"||O.value==="special")&&!d.value&&a.nextTick(()=>{T()})}),e({activeCategory:O});async function Re(){await ae()}const ve=a.computed(()=>z.value?N(z.value.partIndex):[]),_=a.computed(()=>{if(!z.value)return!1;const B=z.value.part.body,U=B?P(B).length>0:!1,ie=z.value.part.slots&&Object.keys(z.value.part.slots).length>0;return U||ie}),I=a.ref(""),q=()=>{!I.value||!z.value||(ke(z.value.partIndex,I.value),I.value="")};a.watch(()=>z.value?.part.body,()=>{I.value=""});const pe=a.computed(()=>{const B=[],U=o.cmsData.parts;return[...U.common,...U.individual,...U.special||[]].forEach(le=>{le.parts.forEach(we=>{B.push({id:we.id,title:we.title,typeName:le.type,description:we.description})})}),B.sort((le,we)=>le.typeName!==we.typeName?le.typeName.localeCompare(we.typeName):le.title.localeCompare(we.title))}),Ae=a.ref({}),ze=B=>{const U=Ae.value[B]||"";if(!U)return pe.value;const ie=U.toLowerCase();return pe.value.filter(le=>le.title.toLowerCase().includes(ie)||le.typeName.toLowerCase().includes(ie))},Se=B=>{if(!z.value)return[];const U=z.value.part.slots?.[B];return U?U.allowedParts||[]:[]},F=(B,U,ie)=>{if(!z.value)return;const le=ie.target.checked,Fe=z.value.part.slots?.[B]?.allowedParts||[];let st;le?st=[...Fe,U]:st=Fe.filter(xn=>xn!==U),$e(z.value.partIndex,B,st)};function ne(B,U){const ie=["zcode-part-item"];return E.value&&E.value.type===B.type&&E.value.partIndex===U&&ie.push("zcode-reorder-source"),ie.join(" ")}function Me(B){const U=B._partIndex,ie=U!=null,le=ie&&U!==void 0?U+1:0,we=B.parts.length;if(ie&&we>1){if(!confirm(n("partsManager.deletePartConfirm",{number:le})))return}else{const Fe=Y(B.type);if(Fe.length>0){if(!confirm(n("partsManager.deleteTypeWithUsagesConfirm",{type:B.type,count:Fe.length})))return}else if(!confirm(n("partsManager.deleteTypeConfirm")))return}X(B)}return(B,U)=>(a.openBlock(),a.createElementBlock("div",QT,[a.createElementVNode("div",ZT,[a.createElementVNode("div",ez,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(y.value,ie=>(a.openBlock(),a.createElementBlock("button",{key:ie,class:a.normalizeClass([{active:a.unref(O)===ie},"zcode-category-tab"]),onClick:le=>O.value=ie},a.toDisplayString(ie==="common"?B.$t("dataViewer.common"):ie==="individual"?B.$t("dataViewer.individual"):B.$t("dataViewer.special")),11,tz))),128)),a.createElementVNode("button",{class:"zcode-help-btn",title:B.$t("dataViewer.categoryInfo.title"),onClick:U[0]||(U[0]=ie=>c.value=!0)},[a.createVNode(a.unref(Vn),{size:14})],8,nz)]),a.createElementVNode("div",oz,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-parts-new-btn",onClick:U[1]||(U[1]=(...ie)=>a.unref(L)&&a.unref(L)(...ie))},[a.createVNode(a.unref(uo),{size:14}),a.createElementVNode("span",null,a.toDisplayString(B.$t("partsManager.createType")),1)])])]),a.createElementVNode("div",rz,[a.createElementVNode("div",iz,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(H),ie=>(a.openBlock(),a.createElementBlock("div",{key:ie.type,class:"zcode-part-type-group"},[a.createElementVNode("div",sz,[a.createTextVNode(a.toDisplayString(ie.type)+" ",1),a.createElementVNode("div",az,[ie.parts.length>0?(a.openBlock(),a.createElementBlock("button",{key:0,class:"zcode-part-type-edit-btn",title:B.$t("partsManager.editTypeButton"),onClick:a.withModifiers(le=>a.unref(j)(ie.parts[0]),["stop"])},[a.createVNode(a.unref(oa),{size:14})],8,lz)):a.createCommentVNode("",!0),a.createElementVNode("button",{class:a.normalizeClass(["zcode-action-btn",{active:a.unref(V)===ie.type}]),title:B.$t("partsManager.reorderType"),onClick:a.withModifiers(le=>a.unref(S)(ie.type),["stop"])},[a.createVNode(a.unref(ir),{size:14})],10,cz),a.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:B.$t("partsManager.deleteTypeButton"),onClick:a.withModifiers(le=>a.unref(C)(ie.type),["stop"])},[a.createVNode(a.unref(Bn),{size:14})],8,dz)])]),a.createElementVNode("div",uz,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(ie.parts,(le,we)=>(a.openBlock(),a.createElementBlock("div",{key:`${ie.type}-${we}`,class:a.normalizeClass(ne(le,le._partIndex??0)),onClick:Fe=>a.unref(Z)(le,le._partIndex??0)},[a.unref(E)&&a.unref(E).type===le.type&&a.unref(E).partIndex===(le._partIndex??0)?(a.openBlock(),a.createElementBlock("div",pz,a.toDisplayString(B.$t("partsManager.source")),1)):a.createCommentVNode("",!0),a.createElementVNode("div",hz,[a.createElementVNode("span",mz,a.toDisplayString(le._displayPart?.title||le.type),1),a.createElementVNode("div",gz,[a.createElementVNode("button",{class:"zcode-action-btn",title:B.$t("partsManager.editPartButton"),onClick:a.withModifiers(Fe=>a.unref(Z)(le,le._partIndex??0),["stop"])},[a.createVNode(a.unref(oa),{size:14})],8,bz),a.createElementVNode("button",{class:a.normalizeClass(["zcode-action-btn",{active:a.unref(E)?.type===le.type&&a.unref(E)?.partIndex===(le._partIndex??0)}]),title:B.$t("partsManager.reorderPart"),onClick:a.withModifiers(Fe=>a.unref(k)(le,le._partIndex??0),["stop"])},[a.createVNode(a.unref(ir),{size:14})],10,yz),a.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:B.$t("partsManager.deletePartButton"),onClick:a.withModifiers(Fe=>Me({...le,_partIndex:le._partIndex??0}),["stop"])},[a.createVNode(a.unref(Bn),{size:14})],8,xz)])]),a.createElementVNode("div",Ez,[a.createElementVNode("div",{class:a.normalizeClass(["zcode-part-description",{"zcode-description-empty":!le._displayPart?.description&&!le.description}])},a.toDisplayString(le._displayPart?.description||le.description||B.$t("partsManager.noDescription")),3),a.createElementVNode("div",kz,a.toDisplayString(B.$t("partsManager.partNumber",{current:(le._partIndex??0)+1,total:le.parts.length})),1),le._displayPart?(a.openBlock(),a.createElementBlock("div",wz,[a.createElementVNode("div",{class:"zcode-part-preview-content",innerHTML:a.unref(de)(le,le._displayPart)},null,8,Sz)])):a.createCommentVNode("",!0)])],10,fz))),128)),ie.parts.length>0?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-part-item zcode-part-item-add",onClick:a.withModifiers(le=>a.unref(K)(ie.parts[0]),["stop"])},[a.createElementVNode("div",Cz,[a.createVNode(a.unref(uo),{size:20}),a.createElementVNode("span",null,a.toDisplayString(B.$t("partsManager.addPart")),1)])],8,Nz)):a.createCommentVNode("",!0)])]))),128))]),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.unref(G)&&(a.unref(R)==="type"||a.unref(W))?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:U[7]||(U[7]=a.withModifiers((...ie)=>a.unref(J)&&a.unref(J)(...ie),["self"]))},[a.createElementVNode("div",{class:"zcode-part-modal-content",onClick:U[6]||(U[6]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",vz,[a.createElementVNode("div",Tz,a.toDisplayString(a.unref(W)?B.$t("partsManager.createType"):B.$t("partsManager.editType")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":B.$t("common.close"),onClick:U[2]||(U[2]=(...ie)=>a.unref(J)&&a.unref(J)(...ie))},[a.createVNode(a.unref(Qe),{size:18})],8,zz)]),a.createElementVNode("div",_z,[a.createElementVNode("div",Az,[a.createElementVNode("label",null,[a.createTextVNode(a.toDisplayString(B.$t("partsManager.typeName"))+" ",1),U[27]||(U[27]=a.createElementVNode("span",{class:"zcode-required"},"*",-1))]),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":U[3]||(U[3]=ie=>a.unref(G).type=ie),type:"text",placeholder:B.$t("partsManager.typeNamePlaceholder"),class:"zcode-text-input",required:""},null,8,Mz),[[a.vModelText,a.unref(G).type]])]),a.createElementVNode("div",Iz,[a.createElementVNode("label",null,a.toDisplayString(B.$t("partsManager.typeDescription")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":U[4]||(U[4]=ie=>a.unref(G).description=ie),type:"text",placeholder:B.$t("partsManager.typeDescriptionPlaceholder"),class:"zcode-text-input"},null,8,Oz),[[a.vModelText,a.unref(G).description]])])]),a.createElementVNode("div",Dz,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:Re},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString(B.$t("common.confirm")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:U[5]||(U[5]=(...ie)=>a.unref(J)&&a.unref(J)(...ie))},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(B.$t("common.cancel")),1)])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.unref(z)&&a.unref(R)==="part"?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-part-modal",onClick:a.withModifiers(ge,["self"])},[a.createElementVNode("div",{class:"zcode-part-modal-content",onClick:U[17]||(U[17]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",Rz,[a.createElementVNode("div",Pz,a.toDisplayString(B.$t("partsManager.editPart",{title:a.unref(z).part.title})),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":B.$t("common.close"),onClick:ge},[a.createVNode(a.unref(Qe),{size:18})],8,Lz)]),a.createElementVNode("div",$z,[a.createElementVNode("div",Vz,[a.createElementVNode("div",Bz,[a.createElementVNode("div",Fz,[a.createElementVNode("label",null,[a.createTextVNode(a.toDisplayString(B.$t("partsManager.partTitle"))+" ",1),U[28]||(U[28]=a.createElementVNode("span",{class:"zcode-required"},"*",-1))]),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":U[8]||(U[8]=ie=>a.unref(z).part.title=ie),type:"text",class:"zcode-text-input",required:""},null,512),[[a.vModelText,a.unref(z).part.title]])]),a.createElementVNode("div",jz,[a.createElementVNode("label",null,a.toDisplayString(B.$t("partsManager.partDescription")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":U[9]||(U[9]=ie=>a.unref(z).part.description=ie),type:"text",class:"zcode-text-input",placeholder:B.$t("partsManager.partDescriptionPlaceholder")},null,8,Uz),[[a.vModelText,a.unref(z).part.description]])])])]),a.createElementVNode("div",Hz,[a.createElementVNode("div",Wz,[a.createElementVNode("div",Gz,[a.createElementVNode("div",{class:"zcode-template-tabs",role:"tablist","aria-label":B.$t("partsManager.codeEdit")},[a.createElementVNode("button",{type:"button",class:a.normalizeClass(["zcode-template-tab",{active:u.value==="html"}]),role:"tab","aria-selected":u.value==="html",onClick:U[10]||(U[10]=ie=>u.value="html")}," HTML ",10,Kz),a.createElementVNode("button",{type:"button",class:a.normalizeClass(["zcode-template-tab",{active:u.value==="css"}]),role:"tab","aria-selected":u.value==="css",onClick:U[11]||(U[11]=ie=>u.value="css")}," CSS ",10,Jz)],8,qz),a.createElementVNode("div",Xz,[u.value==="css"?(a.openBlock(),a.createElementBlock("div",Yz,[a.createVNode(a.unref(na),{size:14,class:"zcode-css-warning-compact-icon"}),a.createElementVNode("span",Qz,a.toDisplayString(B.$t("partsManager.cssEditInfo")),1),a.createElementVNode("button",{class:"zcode-help-btn",type:"button",title:B.$t("partsManager.cssEditWarning"),onClick:T},[a.createVNode(a.unref(Vn),{size:14})],8,Zz)])):a.createCommentVNode("",!0),u.value==="html"?(a.openBlock(),a.createElementBlock("label",e_,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":U[12]||(U[12]=ie=>i.value=ie),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[a.vModelCheckbox,i.value]]),a.createElementVNode("span",null,a.toDisplayString(B.$t("partsManager.templateSuggestions")),1)])):a.createCommentVNode("",!0),u.value==="html"?(a.openBlock(),a.createElementBlock("button",{key:2,class:"zcode-help-btn",type:"button",title:B.$t("partsManager.templateHelpButton"),onClick:v},[a.createVNode(a.unref(Vn),{size:16})],8,t_)):a.createCommentVNode("",!0)])]),a.createElementVNode("div",n_,[u.value==="html"?(a.openBlock(),a.createBlock(Pm,{key:0,modelValue:a.unref(z).part.body,"onUpdate:modelValue":U[13]||(U[13]=ie=>a.unref(z).part.body=ie),language:"html",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":i.value,class:"zcode-monaco-editor"},null,8,["modelValue","enable-suggestions"])):(a.openBlock(),a.createBlock(Pm,{key:1,modelValue:f.value,"onUpdate:modelValue":U[14]||(U[14]=ie=>f.value=ie),language:"css",theme:"vs-dark",minimap:!1,"auto-height":!1,"enable-suggestions":!0,class:"zcode-monaco-editor"},null,8,["modelValue"]))])]),a.createElementVNode("div",o_,[a.createElementVNode("div",r_,[a.createElementVNode("div",{class:"zcode-part-editor-preview-tab",onClick:U[15]||(U[15]=ie=>r.value=!0),innerHTML:a.unref(de)(a.unref(z).type,a.unref(z).part)},null,8,i_),a.createElementVNode("div",s_,a.toDisplayString(B.$t("partsManager.clickToEnlarge")),1)])])]),_.value?(a.openBlock(),a.createElementBlock("div",a_,[a.createElementVNode("div",l_,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(z).part.slots||{},(ie,le)=>(a.openBlock(),a.createElementBlock("div",{key:`part-${a.unref(z).partIndex}-${le}`,class:"zcode-slot-config-item"},[a.createElementVNode("div",c_,[a.createElementVNode("div",d_,a.toDisplayString(B.$t("partsManager.slot"))+": "+a.toDisplayString(le),1),a.createElementVNode("button",{class:"zcode-btn-small",onClick:we=>a.unref(Te)(a.unref(z).partIndex,le)},[a.createVNode(a.unref(Bn),{size:12})],8,u_)]),a.createElementVNode("div",f_,[a.createElementVNode("label",null,a.toDisplayString(B.$t("partsManager.allowedParts")),1),a.createElementVNode("div",p_,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":we=>Ae.value[le]=we,type:"text",placeholder:B.$t("partsManager.searchParts"),class:"zcode-text-input",style:{"margin-bottom":"8px"}},null,8,h_),[[a.vModelText,Ae.value[le]]]),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(ze(le),we=>(a.openBlock(),a.createElementBlock("label",{key:`allowed-${le}-${we.typeName}-${we.id}`,class:"zcode-checkbox-item"},[a.createElementVNode("input",{type:"checkbox",checked:Se(le).includes(we.id),class:"zcode-checkbox",onChange:Fe=>F(le,we.id,Fe)},null,40,m_),a.createElementVNode("span",null,a.toDisplayString(we.title)+" ("+a.toDisplayString(we.typeName)+")",1)]))),128))])])]))),128)),ve.value.length>0?(a.openBlock(),a.createElementBlock("div",g_,[a.createElementVNode("label",null,a.toDisplayString(B.$t("partsManager.addSlot")),1),a.createElementVNode("div",b_,[a.withDirectives(a.createElementVNode("select",{"onUpdate:modelValue":U[16]||(U[16]=ie=>I.value=ie),class:"zcode-select-input"},[a.createElementVNode("option",y_,a.toDisplayString(B.$t("partsManager.selectSlot")),1),(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(ve.value,ie=>(a.openBlock(),a.createElementBlock("option",{key:ie,value:ie},a.toDisplayString(ie==="default"?B.$t("partsManager.defaultSlot"):ie),9,x_))),128))],512),[[a.vModelSelect,I.value]]),a.createElementVNode("button",{disabled:!I.value,class:"zcode-btn-secondary",onClick:q},[a.createVNode(a.unref(uo),{size:16}),a.createElementVNode("span",null,a.toDisplayString(B.$t("common.add")),1)],8,E_)])])):a.createCommentVNode("",!0)])])):a.createCommentVNode("",!0)]),a.createElementVNode("div",k_,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-part-editor-actions-btn zcode-part-editor-actions-btn-primary",onClick:te},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString(B.$t("common.confirm")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel zcode-part-editor-actions-btn",onClick:ge},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(B.$t("common.cancel")),1)])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[r.value&&a.unref(z)?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-preview-modal",onClick:U[20]||(U[20]=ie=>r.value=!1)},[a.createElementVNode("div",{class:"zcode-preview-modal-content",onClick:U[19]||(U[19]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",w_,[a.createElementVNode("div",S_,a.toDisplayString(B.$t("partsManager.preview"))+" "+a.toDisplayString(a.unref(z).part.title),1),a.createElementVNode("button",{class:"zcode-close-btn",onClick:U[18]||(U[18]=ie=>r.value=!1)},[a.createVNode(a.unref(Qe),{size:18})])]),a.createElementVNode("div",{class:"zcode-preview-modal-body",innerHTML:a.unref(de)(a.unref(z).type,a.unref(z).part)},null,8,N_)])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[l.value&&(a.unref(O)==="common"||a.unref(O)==="individual"||a.unref(O)==="special")?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:a.withModifiers(M,["self"])},[a.createElementVNode("div",{class:"zcode-help-modal zcode-css-warning-modal",onClick:U[22]||(U[22]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",C_,[a.createElementVNode("div",v_,[a.createVNode(a.unref(Vc),{size:20,class:"zcode-css-warning-modal-title-icon"}),a.createElementVNode("span",null,a.toDisplayString(B.$t("partsManager.cssEditWarning")),1)]),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":B.$t("common.close"),onClick:M},[a.createVNode(a.unref(Qe),{size:20})],8,T_)]),a.createElementVNode("div",z_,[a.createElementVNode("div",__,[a.createElementVNode("div",A_,[a.createElementVNode("ul",M_,[a.createElementVNode("li",null,[a.unref(O)==="common"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createTextVNode(a.toDisplayString(B.$t("partsManager.cssEditWarningMessageCommon")),1)],64)):a.unref(O)==="individual"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:1},[a.createTextVNode(a.toDisplayString(B.$t("partsManager.cssEditWarningMessageIndividual")),1)],64)):(a.openBlock(),a.createElementBlock(a.Fragment,{key:2},[a.createTextVNode(a.toDisplayString(B.$t("partsManager.cssEditWarningMessageSpecial")),1)],64))])])])])]),a.createElementVNode("div",I_,[a.createElementVNode("label",O_,[a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":U[21]||(U[21]=ie=>d.value=ie),type:"checkbox",class:"zcode-checkbox-input"},null,512),[[a.vModelCheckbox,d.value]]),a.createElementVNode("span",null,a.toDisplayString(B.$t("partsManager.dontShowAgain")),1)]),a.createElementVNode("button",{class:"zcode-btn-primary",onClick:M},a.toDisplayString(B.$t("partsManager.understood")),1)])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[c.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:U[25]||(U[25]=a.withModifiers(ie=>c.value=!1,["self"]))},[a.createElementVNode("div",{class:"zcode-help-modal",onClick:U[24]||(U[24]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",D_,[a.createElementVNode("div",R_,[a.createVNode(a.unref(na),{size:20,class:"zcode-css-warning-modal-title-icon"}),a.createElementVNode("span",null,a.toDisplayString(B.$t("dataViewer.categoryInfo.title")),1)]),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":B.$t("common.close"),onClick:U[23]||(U[23]=ie=>c.value=!1)},[a.createVNode(a.unref(Qe),{size:18})],8,P_)]),a.createElementVNode("div",L_,[a.createElementVNode("div",$_,[a.createElementVNode("div",V_,a.toDisplayString(B.$t("dataViewer.categoryInfo.common.title")),1),a.createElementVNode("div",B_,a.toDisplayString(B.$t("dataViewer.categoryInfo.common.description")),1)]),a.createElementVNode("div",F_,[a.createElementVNode("div",j_,a.toDisplayString(B.$t("dataViewer.categoryInfo.individual.title")),1),a.createElementVNode("div",U_,a.toDisplayString(B.$t("dataViewer.categoryInfo.individual.description")),1)]),a.createElementVNode("div",H_,[a.createElementVNode("div",W_,a.toDisplayString(B.$t("dataViewer.categoryInfo.special.title")),1),a.createElementVNode("div",G_,a.toDisplayString(B.$t("dataViewer.categoryInfo.special.description")),1)])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[s.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:w},[a.createElementVNode("div",{class:"zcode-help-modal",onClick:U[26]||(U[26]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",q_,[a.createElementVNode("div",K_,a.toDisplayString(B.$t("partsManager.templateHelpTitle")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":B.$t("common.close"),onClick:w},[a.createVNode(a.unref(Qe),{size:20})],8,J_)]),a.createElementVNode("div",X_,[a.createElementVNode("table",Y_,[a.createElementVNode("thead",null,[a.createElementVNode("tr",null,[a.createElementVNode("th",null,a.toDisplayString(B.$t("partsManager.syntax")),1),a.createElementVNode("th",null,a.toDisplayString(B.$t("partsManager.description")),1),a.createElementVNode("th",null,a.toDisplayString(B.$t("partsManager.example")),1)])]),a.createElementVNode("tbody",null,[a.createElementVNode("tr",null,[U[29]||(U[29]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default}")],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.textField")),1),U[30]||(U[30]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$title:タイトル}")],-1))]),a.createElementVNode("tr",null,[U[31]||(U[31]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default:rich}")],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.richText")),1),U[32]||(U[32]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$content:本文:rich}")],-1))]),a.createElementVNode("tr",null,[U[33]||(U[33]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default:textarea}")],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.textarea")),1),U[34]||(U[34]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$description:説明:textarea}")],-1))]),a.createElementVNode("tr",null,[U[35]||(U[35]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$field:default:image}")],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.image")),1),U[36]||(U[36]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"{$hero:default.jpg:image}")],-1))]),a.createElementVNode("tr",null,[U[37]||(U[37]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field:option1|option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.radio")),1),U[38]||(U[38]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($color:red|blue|green)")],-1))]),a.createElementVNode("tr",null,[U[39]||(U[39]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field:option1,option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.checkbox")),1),U[40]||(U[40]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($features:fast,secure)")],-1))]),a.createElementVNode("tr",null,[U[41]||(U[41]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field@:option1|option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.selectSingle")),1),U[42]||(U[42]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($size@:S|M|L)")],-1))]),a.createElementVNode("tr",null,[U[43]||(U[43]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($field@:option1,option2)")],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.selectMultiple")),1),U[44]||(U[44]=a.createElementVNode("td",null,[a.createElementVNode("code",null,"($tags@:tag1,tag2,tag3)")],-1))]),a.createElementVNode("tr",null,[U[45]||(U[45]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'z-if="show_field"')],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.conditional")),1),U[46]||(U[46]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'<div z-if="show_content">...</div>')],-1))]),a.createElementVNode("tr",null,[U[47]||(U[47]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'z-slot="name"')],-1)),a.createElementVNode("td",null,a.toDisplayString(B.$t("partsManager.templateHelp.slot")),1),U[48]||(U[48]=a.createElementVNode("td",null,[a.createElementVNode("code",null,'<div z-slot="content"></div>')],-1))])])]),a.createElementVNode("div",Q_,[a.createElementVNode("div",Z_,a.toDisplayString(B.$t("partsManager.templateHelp.note")),1),a.createElementVNode("div",eA,[a.createElementVNode("div",{role:"listitem",class:"zcode-help-section-item",innerHTML:B.$t("partsManager.templateHelp.suggestionNote")},null,8,tA),a.createElementVNode("div",nA,a.toDisplayString(B.$t("partsManager.templateHelp.fieldNameNote")),1),a.createElementVNode("div",oA,a.toDisplayString(B.$t("partsManager.templateHelp.defaultValueNote")),1)])])])])])):a.createCommentVNode("",!0)]))])]))}});function iA(t){const e=a.ref("common"),n=a.ref(null),o=a.ref(null),r=a.ref(!1),i=a.ref(null),s=a.computed(()=>e.value==="common"?t.images.common:e.value==="individual"?t.images.individual:t.images.special);function l(x){n.value=x,o.value=null,r.value=!1}function c(x){return new Promise((v,w)=>{const T=new FileReader;T.onload=M=>{const A=M.target?.result,y={id:`img-${Date.now()}`,name:x.name,url:A,mimeType:x.type,needsUpload:!0};e.value==="common"?t.images.common.push(y):e.value==="individual"?t.images.individual.push(y):t.images.special.push(y),v(y)},T.onerror=w,T.readAsDataURL(x)})}function d(x){Sc(x,t.page).forEach(A=>{Object.keys(A.component).forEach(y=>{y.includes("image")&&A.component[y]===x&&(A.component[y]="")})});const w=t.images.common.findIndex(A=>A.id===x);w!==-1&&t.images.common.splice(w,1);const T=t.images.individual.findIndex(A=>A.id===x);T!==-1&&t.images.individual.splice(T,1);const M=t.images.special.findIndex(A=>A.id===x);M!==-1&&t.images.special.splice(M,1),n.value?.id===x&&(n.value=null)}function u(x){o.value={...x},r.value=!1,n.value=x}function f(){if(!o.value)return;let x;e.value==="common"?x=t.images.common:e.value==="individual"?x=t.images.individual:x=t.images.special;const v=x.findIndex(w=>w.id===o.value.id);v!==-1&&(x[v]=o.value),o.value=null,r.value=!1}function p(){o.value=null,r.value=!1}function h(x){return Sc(x,t.page)}function m(x){if(!i.value){i.value=x;return}if(i.value===x){g();return}b(i.value,x),g()}function b(x,v){let w;e.value==="common"?w=t.images.common:e.value==="individual"?w=t.images.individual:w=t.images.special;const T=w.findIndex(y=>y.id===x),M=w.findIndex(y=>y.id===v);if(T===-1||M===-1)return;const[A]=w.splice(T,1);w.splice(M,0,A)}function g(){i.value=null}return{reorderSourceImage:i,handleReorderClick:m,cancelReorder:g,activeCategory:e,selectedImage:n,editingImage:o,isCreatingNew:r,currentImages:s,selectImage:l,addImage:c,deleteImage:d,startEditing:u,saveImage:f,cancelEditing:p,checkImageUsage:h}}const sA={class:"zcode-images-manager"},aA={class:"zcode-images-category-tabs"},lA={class:"zcode-images-category-tab-group"},cA=["onClick"],dA=["title"],uA={class:"zcode-images-add-wrapper"},fA={class:"zcode-images-manager-content"},pA={class:"zcode-images-grid"},hA=["onClick"],mA={key:0,class:"zcode-reorder-source-indicator"},gA=["src","alt"],bA={class:"zcode-image-item-overlay"},yA={class:"zcode-image-item-actions"},xA=["title","onClick"],EA=["title","onClick"],kA={class:"zcode-image-item-name"},wA={class:"zcode-image-editor-header"},SA={class:"zcode-image-editor-header-title",role:"heading","aria-level":"4"},NA=["aria-label"],CA={class:"zcode-image-editor-form"},vA={class:"zcode-image-preview-large"},TA=["src","alt"],zA={class:"zcode-form-field"},_A={class:"zcode-form-field"},AA={class:"zcode-image-editor-actions"},MA={class:"zcode-help-modal-header"},IA={class:"zcode-help-modal-header-title",role:"heading","aria-level":"3"},OA=["aria-label"],DA={class:"zcode-help-modal-body"},RA={class:"zcode-help-section"},PA={class:"zcode-help-section-title",role:"heading","aria-level":"4"},LA={class:"zcode-help-section-item"},$A={class:"zcode-help-section"},VA={class:"zcode-help-section-title",role:"heading","aria-level":"4"},BA={class:"zcode-help-section-item"},FA={class:"zcode-help-section"},jA={class:"zcode-help-section-title",role:"heading","aria-level":"4"},UA={class:"zcode-help-section-item"},HA=a.defineComponent({__name:"ImagesManagerPanel",props:{cmsData:{type:Object},config:{type:Object}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.ref(null),i=a.ref(!1),s=a.computed(()=>o.config?.categoryOrder||"common"),l=a.computed(()=>{const A=[],y=o.cmsData.images.special.length>0;return s.value==="individual"?(A.push("individual","common"),y&&A.push("special")):s.value==="special"?(y&&A.push("special"),A.push("common","individual")):(A.push("common","individual"),y&&A.push("special")),A}),{reorderSourceImage:c,handleReorderClick:d,activeCategory:u,editingImage:f,currentImages:p,addImage:h,deleteImage:m,startEditing:b,saveImage:g,cancelEditing:x,checkImageUsage:v}=iA(o.cmsData);o.config?.categoryOrder==="individual"?u.value="individual":o.config?.categoryOrder==="special"&&(u.value="special"),e({activeCategory:u});async function w(A){const y=A.target,E=y.files?.[0];if(E)try{await h(E),y&&(y.value="")}catch(k){console.error("画像追加エラー:",k),alert(n("imagesManager.addImageFailed"))}}function T(A){const y=["zcode-image-item"];return c.value===A.id&&y.push("zcode-reorder-source"),y.join(" ")}function M(A){const y=v(A.id);if(y.length>0){if(!confirm(n("imagesManager.deleteImageWithUsagesConfirm",{count:y.length})))return}else if(!confirm(n("imagesManager.deleteImageConfirm")))return;m(A.id)}return(A,y)=>(a.openBlock(),a.createElementBlock("div",sA,[a.createElementVNode("div",aA,[a.createElementVNode("div",lA,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(l.value,E=>(a.openBlock(),a.createElementBlock("button",{key:E,class:a.normalizeClass([{active:a.unref(u)===E},"zcode-category-tab"]),onClick:k=>u.value=E},a.toDisplayString(E==="common"?A.$t("dataViewer.common"):E==="individual"?A.$t("dataViewer.individual"):A.$t("dataViewer.special")),11,cA))),128)),a.createElementVNode("button",{class:"zcode-help-btn",title:A.$t("dataViewer.categoryInfo.title"),onClick:y[0]||(y[0]=E=>i.value=!0)},[a.createVNode(a.unref(Vn),{size:14})],8,dA)]),a.createElementVNode("div",uA,[a.createElementVNode("input",{ref_key:"fileInput",ref:r,type:"file",accept:"image/*",style:{display:"none"},onChange:w},null,544),a.createElementVNode("button",{class:"zcode-btn-primary zcode-images-add-btn",onClick:y[1]||(y[1]=E=>r.value?.click())},[a.createVNode(a.unref(uo),{size:14}),a.createElementVNode("span",null,a.toDisplayString(A.$t("imagesManager.addImage")),1)])])]),a.createElementVNode("div",fA,[a.createElementVNode("div",pA,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(a.unref(p),E=>(a.openBlock(),a.createElementBlock("div",{key:E.id,class:a.normalizeClass(T(E)),onClick:k=>a.unref(b)(E)},[a.unref(c)===E.id?(a.openBlock(),a.createElementBlock("div",mA,a.toDisplayString(A.$t("partsManager.source")),1)):a.createCommentVNode("",!0),a.createElementVNode("img",{src:E.url,alt:E.name},null,8,gA),a.createElementVNode("div",bA,[a.createElementVNode("div",yA,[a.createElementVNode("button",{class:a.normalizeClass(["zcode-action-btn",{active:a.unref(c)===E.id}]),title:A.$t("partsManager.reorderPart"),onClick:a.withModifiers(k=>a.unref(d)(E.id),["stop"])},[a.createVNode(a.unref(ir),{size:16})],10,xA),a.createElementVNode("button",{class:"zcode-action-btn zcode-delete-btn",title:A.$t("partsManager.deletePartButton"),onClick:a.withModifiers(k=>M(E),["stop"])},[a.createVNode(a.unref(Bn),{size:16})],8,EA)])]),a.createElementVNode("div",kA,a.toDisplayString(E.name),1)],10,hA))),128))])]),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[a.unref(f)?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-image-modal",onClick:y[8]||(y[8]=a.withModifiers((...E)=>a.unref(x)&&a.unref(x)(...E),["self"]))},[a.createElementVNode("div",{class:"zcode-image-modal-content","data-edit-mode":"",onClick:y[7]||(y[7]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",wA,[a.createElementVNode("div",SA,a.toDisplayString(A.$t("imagesManager.editImage")),1),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":A.$t("common.close"),onClick:y[2]||(y[2]=(...E)=>a.unref(x)&&a.unref(x)(...E))},[a.createVNode(a.unref(Qe),{size:18})],8,NA)]),a.createElementVNode("div",CA,[a.createElementVNode("div",vA,[a.createElementVNode("img",{src:a.unref(f).url,alt:a.unref(f).name,class:"zcode-image-preview-large-img"},null,8,TA)]),a.createElementVNode("div",zA,[a.createElementVNode("label",null,a.toDisplayString(A.$t("imagesManager.imageId")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":y[3]||(y[3]=E=>a.unref(f).id=E),type:"text",class:"zcode-text-input",disabled:""},null,512),[[a.vModelText,a.unref(f).id]])]),a.createElementVNode("div",_A,[a.createElementVNode("label",null,a.toDisplayString(A.$t("imagesManager.imageName")),1),a.withDirectives(a.createElementVNode("input",{"onUpdate:modelValue":y[4]||(y[4]=E=>a.unref(f).name=E),type:"text",class:"zcode-text-input"},null,512),[[a.vModelText,a.unref(f).name]])]),a.createElementVNode("div",AA,[a.createElementVNode("button",{class:"zcode-btn-primary zcode-image-editor-actions-btn",onClick:y[5]||(y[5]=(...E)=>a.unref(g)&&a.unref(g)(...E))},[a.createVNode(a.unref(sr),{size:16}),a.createElementVNode("span",null,a.toDisplayString(A.$t("common.confirm")),1)]),a.createElementVNode("button",{class:"zcode-btn-cancel zcode-image-editor-actions-btn",onClick:y[6]||(y[6]=(...E)=>a.unref(x)&&a.unref(x)(...E))},[a.createVNode(a.unref(Qe),{size:16}),a.createElementVNode("span",null,a.toDisplayString(A.$t("common.cancel")),1)])])])])])):a.createCommentVNode("",!0)])),(a.openBlock(),a.createBlock(a.Teleport,{to:"body"},[i.value?(a.openBlock(),a.createElementBlock("div",{key:0,class:"zcode-help-modal-overlay",onClick:y[11]||(y[11]=a.withModifiers(E=>i.value=!1,["self"]))},[a.createElementVNode("div",{class:"zcode-help-modal",onClick:y[10]||(y[10]=a.withModifiers(()=>{},["stop"]))},[a.createElementVNode("div",MA,[a.createElementVNode("div",IA,[a.createVNode(a.unref(na),{size:20,class:"zcode-css-warning-modal-title-icon"}),a.createElementVNode("span",null,a.toDisplayString(A.$t("dataViewer.categoryInfo.title")),1)]),a.createElementVNode("button",{class:"zcode-close-btn","aria-label":A.$t("common.close"),onClick:y[9]||(y[9]=E=>i.value=!1)},[a.createVNode(a.unref(Qe),{size:18})],8,OA)]),a.createElementVNode("div",DA,[a.createElementVNode("div",RA,[a.createElementVNode("div",PA,a.toDisplayString(A.$t("dataViewer.categoryInfo.common.title")),1),a.createElementVNode("div",LA,a.toDisplayString(A.$t("dataViewer.categoryInfo.common.description")),1)]),a.createElementVNode("div",$A,[a.createElementVNode("div",VA,a.toDisplayString(A.$t("dataViewer.categoryInfo.individual.title")),1),a.createElementVNode("div",BA,a.toDisplayString(A.$t("dataViewer.categoryInfo.individual.description")),1)]),a.createElementVNode("div",FA,[a.createElementVNode("div",jA,a.toDisplayString(A.$t("dataViewer.categoryInfo.special.title")),1),a.createElementVNode("div",UA,a.toDisplayString(A.$t("dataViewer.categoryInfo.special.description")),1)])])])])):a.createCommentVNode("",!0)]))]))}}),WA={class:"zcode-data-viewer"},GA={class:"zcode-data-viewer-header"},qA={class:"zcode-data-viewer-content-tabs"},KA={class:"zcode-data-viewer-tabs"},JA=["onClick"],XA={class:"zcode-data-viewer-content"},YA={class:"zcode-data-viewer-display-wrapper"},QA={class:"zcode-data-viewer-display"},ZA=["title"],eM=a.defineComponent({__name:"DataViewer",props:{cmsData:{type:Object},config:{type:Object}},setup(t,{expose:e}){const n=t,o=a.ref("page"),r=a.ref("json"),i=a.ref(!1),s=a.computed(()=>n.config?.categoryOrder||"common"),l=a.computed(()=>{const v=[],w=o.value==="parts"?n.cmsData.parts.special.length>0:n.cmsData.images.special.length>0;return s.value==="individual"?(v.push("individual","common"),w&&v.push("special")):s.value==="special"?(w&&v.push("special"),v.push("common","individual")):(v.push("common","individual"),w&&v.push("special")),v}),c=a.ref(n.config?.categoryOrder==="individual"?"individual":n.config?.categoryOrder==="special"?"special":"common"),{fullPageHtml:d}=fi(n.cmsData,!1),u=a.computed(()=>{switch(o.value){case"page":return n.cmsData.page;case"parts":return c.value==="common"?n.cmsData.parts.common:c.value==="individual"?n.cmsData.parts.individual:n.cmsData.parts.special;case"images":return c.value==="common"?n.cmsData.images.common:c.value==="individual"?n.cmsData.images.individual:n.cmsData.images.special;default:return null}}),f=a.ref("");let p="";function h(){try{const v=u.value,w=JSON.stringify(v,null,2);if(w===p)return;f.value=w,p=w}catch{f.value=String(u.value),p=f.value}}function m(v){let w=v.replace(/\\\\/g,"\0").replace(/\\u([0-9a-fA-F]{4})/g,(T,M)=>String.fromCharCode(parseInt(M,16))).replace(/\\n/g,`
486
486
  `).replace(/\\t/g," ").replace(/\\r/g,"\r").replace(/\\"/g,'"').replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\\//g,"/").replace(/\u0000/g,"\\");return w=w.replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&amp;/g,"&"),w}function b(v){if(!v)return"";const T=v.replace(/>\s+</g,"><").replace(/></g,`>
487
487
  <`).split(`
488
- `),M=[];let A=0;for(const y of T){const E=y.trim();if(!E)continue;const S=/^<\/[^>]+>/.test(E),D=/\/>$/.test(E)||/^<!/.test(E),W=/^<[^/!][^>]*>$/.test(E)&&!D;S&&(A=Math.max(A-1,0)),M.push(" ".repeat(A)+E),W&&A++}return M.join(`
489
- `)}const g=a.computed(()=>o.value==="page"&&r.value==="html"?b(d.value):m(f.value));a.watch(u,()=>{h()},{deep:!0,immediate:!1}),a.watch(()=>n.cmsData,()=>{h()},{deep:!0}),a.watch(()=>{switch(o.value){case"page":return n.cmsData.page;case"parts":return c.value==="common"?n.cmsData.parts.common:n.cmsData.parts.individual;case"images":return c.value==="common"?n.cmsData.images.common:n.cmsData.images.individual;default:return null}},()=>{h()},{deep:!0}),a.watch(c,()=>{h()}),a.watch(o,()=>{c.value=n.config?.categoryOrder==="individual"?"individual":"common",h()});const x=async()=>{const v=g.value;try{await navigator.clipboard.writeText(v),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(w){console.error("コピーに失敗しました:",w);const T=document.createElement("textarea");T.value=v,T.style.position="fixed",T.style.opacity="0",document.body.appendChild(T),T.select();try{document.execCommand("copy"),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(M){console.error("コピーに失敗しました:",M)}document.body.removeChild(T)}};return h(),e({internalActiveTab:o,activeCategory:c}),(v,w)=>(a.openBlock(),a.createElementBlock("div",HA,[a.createElementVNode("div",WA,[a.createElementVNode("div",GA,[a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="page"},"zcode-data-viewer-content-tab"]),onClick:w[0]||(w[0]=T=>o.value="page")},a.toDisplayString(v.$t("dataViewer.page")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="parts"},"zcode-data-viewer-content-tab"]),onClick:w[1]||(w[1]=T=>o.value="parts")},a.toDisplayString(v.$t("dataViewer.parts")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="images"},"zcode-data-viewer-content-tab"]),onClick:w[2]||(w[2]=T=>o.value="images")},a.toDisplayString(v.$t("dataViewer.images")),3)]),a.createElementVNode("div",qA,[o.value==="page"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createElementVNode("button",{class:a.normalizeClass([{active:r.value==="json"},"zcode-data-viewer-tab"]),onClick:w[3]||(w[3]=T=>r.value="json")},a.toDisplayString(v.$t("dataViewer.json")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:r.value==="html"},"zcode-data-viewer-tab"]),onClick:w[4]||(w[4]=T=>r.value="html")},a.toDisplayString(v.$t("dataViewer.html")),3)],64)):(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:1},a.renderList(l.value,T=>(a.openBlock(),a.createElementBlock("button",{key:T,class:a.normalizeClass([{active:c.value===T},"zcode-data-viewer-tab"]),onClick:M=>c.value=T},a.toDisplayString(T==="common"?v.$t("dataViewer.common"):T==="individual"?v.$t("dataViewer.individual"):v.$t("dataViewer.special")),11,KA))),128))])]),a.createElementVNode("div",JA,[a.createElementVNode("div",XA,[a.createElementVNode("pre",YA,a.toDisplayString(g.value),1),a.createElementVNode("button",{class:"zcode-data-viewer-copy-btn",title:i.value?v.$t("common.copied"):v.$t("common.copy"),onClick:x},[i.value?(a.openBlock(),a.createBlock(a.unref(sr),{key:0,size:18})):(a.openBlock(),a.createBlock(a.unref(Xm),{key:1,size:18}))],8,QA)])])]))}}),eM={class:"zcode-dev-container"},tM={class:"zcode-dev-header"},nM={class:"zcode-dev-tabs"},oM=["title"],rM={key:1,class:"zcode-loading-message"},iM={class:"zcode-loading-message-text"},sM={key:3,class:"zcode-loading-message"},aM={class:"zcode-loading-message-text"},lM={key:3,class:"zcode-save-controls-fixed"},cM={class:"zcode-save-confirm-dialog"},dM={class:"zcode-save-confirm-dialog-header"},uM={class:"zcode-save-confirm-dialog-title"},fM={class:"zcode-save-confirm-dialog-body"},pM={class:"zcode-save-confirm-targets"},hM={class:"zcode-save-confirm-dialog-footer"},vc=a.defineComponent({__name:"ZeroCodeEditor",props:{locale:{type:String},page:{type:String},cssCommon:{type:String},cssIndividual:{type:String},cssSpecial:{type:String},partsCommon:{type:String},partsIndividual:{type:String},partsSpecial:{type:String},imagesCommon:{type:String},imagesIndividual:{type:String},imagesSpecial:{type:String},config:{type:String},endpoints:{type:String},backendData:{type:String},enablePartsManager:{type:Boolean},enableImagesManager:{type:Boolean}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.computed(()=>o.enablePartsManager!==!1),i=a.computed(()=>o.enableImagesManager!==!1),s=a.ref("manage"),l=a.ref("edit"),c=a.ref(null),d=a.ref(null),u=a.ref(null),f=a.ref(null),p=a.ref(!1),h=a.ref(!1),m=a.ref([]),g=(N=>{if(!N)return{};try{return JSON.parse(N)}catch(O){return console.warn("[ZeroCodeEditor] Failed to parse config:",O),{}}})(o.config);function x(N){return typeof N=="object"&&N!==null}function v(N){return N==="common"||N==="individual"||N==="special"}function w(N){return N==="page"||N==="parts"||N==="images"}function T(N){if(x(N)&&"value"in N)return N.value}function M(N,O){if(x(N))return N[O]}function A(N){const O=M(N,"activeCategory");if(v(O))return O;const k=T(O);return v(k)?k:void 0}function y(N){const O=M(N,"internalActiveTab");if(w(O))return O;const k=T(O);return w(k)?k:void 0}function E(){const N=c.value;return!x(N)||!("cmsData"in N)||!("currentMode"in N)||!("switchMode"in N)||!("allowDynamicContentInteraction"in N)||!("settingsPanelOpen"in N)||!("setData"in N)?null:N}const S=(N,O,k)=>{const U=Mu();return U[N]!==void 0?U[N]:k!==void 0?k:O},D=a.ref(S("showDataViewer",!1,g.dev?.showDataViewer)),W=a.ref(S("showSaveConfirm",!0,g.dev?.showSaveConfirm)),{cmsData:z,loadDataFromProps:P}=km(o),V=a.computed(()=>{const N=s.value==="manage"?E():null;return N?N.cmsData:z}),j=a.computed(()=>E()?.currentMode?.value??"edit"),L=N=>{c.value?.switchMode&&c.value.switchMode(N)};function H(N){l.value=N,(N==="parts"||N==="images"||N==="data")&&(s.value="manage")}function Q(){const N=E();N&&(N.settingsPanelOpen.value=!0)}const G=a.computed(()=>{if(s.value==="preview")return!0;const N=E();return N?N.allowDynamicContentInteraction.value:h1("allowDynamicContentInteraction",!1)});function se(N){const O=V.value;if(!N)return O;const k=N.split(".");let U=O;for(const te of k)if(!x(U)||(U=U[te],U===void 0))return;return U}function Z(N,O){const k=E();return k?k.setData(N,O):!1}a.onMounted(()=>{P()}),a.watch([()=>o.page,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial],()=>{P()}),a.watch(D,N=>{Ba({showDataViewer:N})}),a.watch(W,N=>{Ba({showSaveConfirm:N})}),a.watch(s,(N,O)=>{J("view-mode-changed",{mode:N,previousMode:O})});function X(N){W.value=N}function J(N,O){const k=document.querySelector("zcode-editor");if(k){const te=new CustomEvent(N,{detail:O,bubbles:!0,composed:!0});k.dispatchEvent(te);return}const U=new CustomEvent(N,{detail:O,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(U)}function K(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Y(){if(!V.value)return[];let N;if(l.value==="edit")N="page";else if(l.value==="parts")if(!d.value)console.warn('[ZeroCode] partsManagerRefが設定されていません。デフォルトで"common"を使用します。'),N="parts-common";else{const k=A(d.value);k==null?(console.warn('[ZeroCode] parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="parts-common"):k==="common"?N="parts-common":k==="individual"?N="parts-individual":N="parts-special"}else if(l.value==="images")if(!u.value)console.warn('[ZeroCode] imagesManagerRefが設定されていません。デフォルトで"common"を使用します。'),N="images-common";else{const k=A(u.value);k==null?(console.warn('[ZeroCode] images activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="images-common"):k==="common"?N="images-common":k==="individual"?N="images-individual":N="images-special"}else if(l.value==="data")if(!f.value)console.warn('[ZeroCode] dataViewerRefが設定されていません。デフォルトで"page"を使用します。'),N="page";else{const k=y(f.value),U=A(f.value);if(k==null)console.warn('[ZeroCode] dataViewer internalActiveTabが取得できません。デフォルトで"page"を使用します。'),N="page";else if(k==="page")N="page";else if(k==="parts")U==null?(console.warn('[ZeroCode] dataViewer parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="parts-common"):U==="common"?N="parts-common":U==="individual"?N="parts-individual":N="parts-special";else if(k==="images")U==null?(console.warn('[ZeroCode] dataViewer images activeCategoryが取得できません。デフォルトで"common"を使用します。'),N="images-common"):U==="common"?N="images-common":U==="individual"?N="images-individual":N="images-special";else return console.warn(`[ZeroCode] dataViewer 不明なinternalActiveTab: ${k}`),[]}else return[];let O;return N==="page"?O=["page","images-common","images-individual"]:N==="parts-common"?O=[N,"parts-common-css"]:N==="parts-individual"?O=[N,"parts-individual-css"]:N==="parts-special"?O=[N,"parts-special-css"]:O=[N],O}function ce(){if(!W.value){Ee();return}const N=Y();if(N.length===0){console.warn(`[ZeroCode] ${n("editor.noSaveTargets")}`);return}m.value=N,h.value=!0}function Ee(){const N=Y();if(N.length===0){console.warn(`[ZeroCode] ${n("editor.noSaveTargets")}`);return}J("save-request",{requestId:K(),source:"editor",targets:N,timestamp:Date.now()})}function _e(){h.value=!1,Ee()}function Le(){h.value=!1,m.value=[]}function C(N){const{t:O}=rn();return{page:O("saveConfirm.targets.page"),"parts-common":O("saveConfirm.targets.parts-common"),"parts-individual":O("saveConfirm.targets.parts-individual"),"parts-special":O("saveConfirm.targets.parts-special"),"images-common":O("saveConfirm.targets.images-common"),"images-individual":O("saveConfirm.targets.images-individual"),"images-special":O("saveConfirm.targets.images-special"),"parts-common-css":O("saveConfirm.targets.parts-common-css"),"parts-individual-css":O("saveConfirm.targets.parts-individual-css"),"parts-special-css":O("saveConfirm.targets.parts-special-css")}[N]||N}return e({getData:se,setData:Z,allowDynamicContentInteraction:G}),(N,O)=>(a.openBlock(),a.createElementBlock("div",eM,[a.createElementVNode("div",tM,[a.createElementVNode("div",nM,[a.createElementVNode("button",{class:a.normalizeClass([{active:l.value==="edit"},"zcode-dev-tab"]),onClick:O[0]||(O[0]=k=>H("edit"))},[a.createVNode(a.unref(oa),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("editor.pageManagement")),1)],2),r.value?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass([{active:l.value==="parts"},"zcode-dev-tab"]),onClick:O[1]||(O[1]=k=>H("parts"))},[a.createVNode(a.unref(og),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("editor.partsManagement")),1)],2)):a.createCommentVNode("",!0),i.value?(a.openBlock(),a.createElementBlock("button",{key:1,class:a.normalizeClass([{active:l.value==="images"},"zcode-dev-tab"]),onClick:O[2]||(O[2]=k=>H("images"))},[a.createVNode(a.unref(Rc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("editor.imagesManagement")),1)],2)):a.createCommentVNode("",!0),a.createElementVNode("button",{class:a.normalizeClass([{active:l.value==="data"},"zcode-dev-tab"]),onClick:O[3]||(O[3]=k=>H("data"))},[a.createVNode(a.unref(Ym),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("editor.dataViewer")),1)],2),a.createElementVNode("button",{class:"zcode-dev-tab zcode-dev-settings-btn",title:N.$t("toolbar.settings"),onClick:O[4]||(O[4]=k=>p.value=!0)},[a.createVNode(a.unref($c),{size:16})],8,oM)])]),l.value==="edit"?(a.openBlock(),a.createBlock(rd,{key:0,"current-mode":j.value,"view-mode":s.value,"allow-dynamic-content-interaction":G.value,onSwitchMode:L,onSwitchViewMode:O[5]||(O[5]=k=>s.value=k),onOpenSettings:Q},null,8,["current-mode","view-mode","allow-dynamic-content-interaction"])):a.createCommentVNode("",!0),s.value==="preview"&&V.value?(a.openBlock(),a.createBlock(ma,{key:1,"cms-data":V.value,"allow-dynamic-content-interaction":G.value},null,8,["cms-data","allow-dynamic-content-interaction"])):a.createCommentVNode("",!0),s.value==="manage"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:2},[a.withDirectives(a.createVNode(Hs,{ref_key:"cmsRef",ref:c,locale:o.locale,page:o.page,"css-common":o.cssCommon,"css-individual":o.cssIndividual,"css-special":o.cssSpecial,"parts-common":o.partsCommon,"parts-individual":o.partsIndividual,"parts-special":o.partsSpecial,"images-common":o.imagesCommon,"images-individual":o.imagesIndividual,"images-special":o.imagesSpecial,config:o.config,endpoints:o.endpoints,"backend-data":o.backendData},null,8,["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data"]),[[a.vShow,l.value==="edit"]]),r.value&&l.value==="parts"&&V.value?(a.openBlock(),a.createBlock(oA,{key:0,ref_key:"partsManagerRef",ref:d,"cms-data":V.value,config:a.unref(g)},null,8,["cms-data","config"])):a.createCommentVNode("",!0),r.value&&l.value==="parts"&&!V.value?(a.openBlock(),a.createElementBlock("div",rM,[a.createElementVNode("div",iM,a.toDisplayString(N.$t("editor.loading")),1)])):a.createCommentVNode("",!0),i.value&&l.value==="images"&&V.value?(a.openBlock(),a.createBlock(UA,{key:2,ref_key:"imagesManagerRef",ref:u,"cms-data":V.value,config:a.unref(g)},null,8,["cms-data","config"])):a.createCommentVNode("",!0),i.value&&l.value==="images"&&!V.value?(a.openBlock(),a.createElementBlock("div",sM,[a.createElementVNode("div",aM,a.toDisplayString(N.$t("editor.loading")),1)])):a.createCommentVNode("",!0),a.withDirectives(a.createVNode(ZA,{ref_key:"dataViewerRef",ref:f,"cms-data":V.value,config:a.unref(g)},null,8,["cms-data","config"]),[[a.vShow,l.value==="data"&&V.value]])],64)):a.createCommentVNode("",!0),a.withDirectives(a.createVNode(Ou,{"is-open":p.value,"view-mode":s.value,mode:"dev-tabs","show-save-confirm":W.value,onClose:O[6]||(O[6]=k=>p.value=!1),onToggleSaveConfirm:X},null,8,["is-open","view-mode","show-save-confirm"]),[[a.vShow,p.value]]),s.value==="manage"?(a.openBlock(),a.createElementBlock("div",lM,[a.createElementVNode("button",{class:"zcode-save-btn",onClick:ce},[a.createVNode(a.unref(Lc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(N.$t("common.save")),1)])])):a.createCommentVNode("",!0),h.value?(a.openBlock(),a.createElementBlock("div",{key:4,class:"zcode-save-confirm-dialog-overlay",onClick:a.withModifiers(Le,["self"])},[a.createElementVNode("div",cM,[a.createElementVNode("div",dM,[a.createElementVNode("div",uM,a.toDisplayString(N.$t("saveConfirm.title")),1)]),a.createElementVNode("div",fM,[a.createElementVNode("p",null,a.toDisplayString(N.$t("saveConfirm.message")),1),a.createElementVNode("ul",pM,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(m.value,k=>(a.openBlock(),a.createElementBlock("li",{key:k},a.toDisplayString(C(k)),1))),128))])]),a.createElementVNode("div",hM,[a.createElementVNode("button",{class:"zcode-btn-secondary",onClick:Le},a.toDisplayString(N.$t("common.cancel")),1),a.createElementVNode("button",{class:"zcode-btn-primary",onClick:_e},a.toDisplayString(N.$t("saveConfirm.saveButton")),1)])])])):a.createCommentVNode("",!0)]))}});Cm();class mM extends HTMLElement{app=null;componentInstance=null;_shadowRoot=null;constructor(){super()}connectedCallback(){if(this.app)return;this.getAttribute("use-shadow-dom")!=="false"?(this.setupShadowDOM(),window.addEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this))):(this.setupLightDOM(),window.addEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this)))}setupLightDOM(){const e=this.getAttribute("page")||"[]",n=this.getAttribute("css-common"),o=this.getAttribute("css-individual"),r=this.getAttribute("css-special"),i=this.getAttribute("parts-common")||"[]",s=this.getAttribute("parts-individual")||"[]",l=this.getAttribute("parts-special")||"[]",c=this.getAttribute("images-common")||"[]",d=this.getAttribute("images-individual")||"[]",u=this.getAttribute("images-special")||"[]",f=Ws(this);this.app=a.createApp(vc,{locale:f,page:e,cssCommon:n,cssIndividual:o,cssSpecial:r,partsCommon:i,partsIndividual:s,partsSpecial:l,imagesCommon:c,imagesIndividual:d,imagesSpecial:u,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||"",enablePartsManager:this.getAttribute("enable-parts-manager")!=="false",enableImagesManager:this.getAttribute("enable-images-manager")!=="false"}),Gs(this.app,f),this.componentInstance=this.app.mount(this),this.injectLightDOMCSS()}setupShadowDOM(){const e=this.shadowRoot,n=!!e;e?(this._shadowRoot=e,this.clearScripts()):(this._shadowRoot=this.attachShadow({mode:"open"}),this.injectCSS());const o=this.getAttribute("page")||"[]",r=this.getAttribute("css-common"),i=this.getAttribute("css-individual"),s=this.getAttribute("css-special"),l=this.getAttribute("parts-common")||"[]",c=this.getAttribute("parts-individual")||"[]",d=this.getAttribute("parts-special")||"[]",u=this.getAttribute("images-common")||"[]",f=this.getAttribute("images-individual")||"[]",p=this.getAttribute("images-special")||"[]",h=Ws(this);this.app=a.createApp(vc,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:s,partsCommon:l,partsIndividual:c,partsSpecial:d,imagesCommon:u,imagesIndividual:f,imagesSpecial:p,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||"",enablePartsManager:this.getAttribute("enable-parts-manager")!=="false",enableImagesManager:this.getAttribute("enable-images-manager")!=="false"}),Gs(this.app,h),this.componentInstance=this.app.mount(this._shadowRoot),requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(()=>{this.injectScript(n)},100)})})}injectCSS(){if(!this._shadowRoot)return;const e=document.createElement("style");e.textContent=Sm,this._shadowRoot.appendChild(e),this.querySelectorAll('[slot="css"]').forEach(o=>{const r=o.cloneNode(!0);r.removeAttribute("slot"),this._shadowRoot.appendChild(r),o.remove()})}injectLightDOMCSS(){this.querySelectorAll('[slot="css"]').forEach(n=>{const o=n.cloneNode(!0);o.removeAttribute("slot"),document.head.appendChild(o)})}clearScripts(){if(!this._shadowRoot)return;this._shadowRoot.querySelectorAll("script").forEach(n=>{n.remove()})}injectScript(e=!1){if(!this._shadowRoot)return;const n=this.querySelectorAll('[slot="script"]'),o=Array.from(n),r=[],i=[];o.forEach(c=>{const d=c;if(!d.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}d.src.includes("jquery")||d.src.includes("code.jquery.com")?r.push(d):i.push(d)});const s=c=>{let d=c.src;if(e)try{const f=new URL(c.src,window.location.href);f.searchParams.set("_t",Date.now().toString()),d=f.toString()}catch{d=c.src+(c.src.includes("?")?"&":"?")+"_t="+Date.now()}const u=document.createElement("script");return u.src=d,c.type&&(u.type=c.type),c.async&&(u.async=!0),c.defer&&(u.defer=!0),c.integrity&&(u.integrity=c.integrity),c.crossOrigin&&(u.crossOrigin=c.crossOrigin),u.onerror=f=>{console.error(`Failed to load script: ${c.src}`,f)},u},l=()=>{o.forEach(c=>{c.remove()})};if(r.length>0){let c=0;const d=r.length;r.forEach(u=>{const f=s(u);f.onload=()=>{c++,c===d&&(Mo(this._shadowRoot,e),requestAnimationFrame(()=>{i.forEach(p=>{this._shadowRoot.appendChild(s(p))}),l()}))},this._shadowRoot.appendChild(f)})}else Mo(this._shadowRoot,e),i.forEach(c=>{this._shadowRoot.appendChild(s(c))}),l()}injectLightDOMScripts(){const e=this.querySelectorAll('[slot="script"]'),n=[],o=[];e.forEach(i=>{const s=i;if(!s.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}s.src.includes("jquery")||s.src.includes("code.jquery.com")?n.push(s):o.push(s)});const r=i=>{const s=document.createElement("script");return s.src=i.src,i.type&&(s.type=i.type),i.async&&(s.async=!0),i.defer&&(s.defer=!0),i.integrity&&(s.integrity=i.integrity),i.crossOrigin&&(s.crossOrigin=i.crossOrigin),s.onerror=l=>{console.error(`Failed to load script: ${i.src}`,l)},s};if(n.length>0){let i=0;const s=n.length;n.forEach(l=>{const c=r(l);c.onload=()=>{i++,i===s&&requestAnimationFrame(()=>{o.forEach(d=>{document.body.appendChild(r(d))})})},document.body.appendChild(c)})}else o.forEach(i=>{document.body.appendChild(r(i))})}getData(e){return this.componentInstance&&this.componentInstance.getData?this.componentInstance.getData(e):null}setData(e,n){return this.componentInstance&&this.componentInstance.setData?this.componentInstance.setData(e,n):!1}get allowDynamicContentInteraction(){if(this.componentInstance){const e=this.componentInstance.allowDynamicContentInteraction;if(e!==void 0)return e&&typeof e=="object"&&"value"in e?e.value:e}return!0}set allowDynamicContentInteraction(e){if(this.componentInstance){const n=this.componentInstance.allowDynamicContentInteraction;n!==void 0&&(n&&typeof n=="object"&&"value"in n?n.value=e:this.componentInstance.allowDynamicContentInteraction=e)}}disconnectedCallback(){if(this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot){if(this._shadowRoot.__zecEventListeners){const e=this._shadowRoot.__zecEventListeners,n=this._shadowRoot;e.forEach(o=>{o.forEach(r=>{n.removeEventListener(r.eventName,r.handler,!0)})}),e.clear()}if(window.__zecShadowRoots){const e=window.__zecShadowRoots,n=this._shadowRoot;for(const[o,r]of e.entries())r===n&&e.delete(o)}}this._shadowRoot=null,window.removeEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this)),window.removeEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this))}handleDOMUpdated(){if(!this._shadowRoot||this.getAttribute("use-shadow-dom")!=="true")return;this._shadowRoot.__zecJQueryExtended&&delete this._shadowRoot.__zecJQueryExtended;const e=this._shadowRoot.querySelector("script[data-zec-shadow-extension]");e&&e.remove(),Mo(this._shadowRoot,!0)}handleLightDOMUpdated(){this.getAttribute("use-shadow-dom")!=="true"&&(this.__lightDOMScriptsLoaded||(this.injectLightDOMScripts(),this.__lightDOMScriptsLoaded=!0))}static get observedAttributes(){return["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data","enable-parts-manager","enable-images-manager","use-shadow-dom"]}attributeChangedCallback(e,n,o){if(n!==o){if(e==="use-shadow-dom"){this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot&&(this._shadowRoot.innerHTML="",this._shadowRoot=null),this.connectedCallback();return}this.app&&(this.app.unmount(),this.app=null,this.componentInstance=null,this.connectedCallback())}}}customElements.get("zcode-editor")||customElements.define("zcode-editor",mM);class ni extends Error{constructor(e,n,o){super(o),this.code=e,this.path=n,this.name="RenderError"}}function gM(t,e={}){const{enableEditorAttributes:n=!1}=e,o=t.backendData;if(!t)throw new ni("PARSE_ERROR","","データが提供されていません");const r=t.parts||{common:[],individual:[],special:[]},i=t.images||{common:[],individual:[],special:[]},s=t.page||[];function l(d){return ha(d,r)}function c(d,u="",f=new Set){if(f.has(u))throw new ni("CIRCULAR_REFERENCE",u,`循環参照が検出されました: ${u}`);f.add(u);const p=d.part_id,h=l(p);if(!h)throw new ni("PART_NOT_FOUND",u,`パーツが見つかりません: ${p}`);const m=ui(h.body,d,u,l,(b,g)=>c(b,g,f),n,i.common,i.individual,i.special,o);return n?td(m,{"data-zcode-id":d.id,"data-zcode-path":u,"data-zcode-part":p}):m}return s.map((d,u)=>{try{return c(d,`page.${u}`)}catch(f){if(f instanceof ni)return`<div class="zcode-error-message" data-error-code="${f.code}">${f.message}</div>`;throw f}}).join("")}en.RenderError=ni,en.ZeroCodeCMS=Hs,en.ZeroCodeEditor=vc,en.ZeroCodePreview=ma,en.renderToHtml=gM,Object.defineProperty(en,Symbol.toStringTag,{value:"Module"})}));
488
+ `),M=[];let A=0;for(const y of T){const E=y.trim();if(!E)continue;const k=/^<\/[^>]+>/.test(E),O=/\/>$/.test(E)||/^<!/.test(E),G=/^<[^/!][^>]*>$/.test(E)&&!O;k&&(A=Math.max(A-1,0)),M.push(" ".repeat(A)+E),G&&A++}return M.join(`
489
+ `)}const g=a.computed(()=>o.value==="page"&&r.value==="html"?b(d.value):m(f.value));a.watch(u,()=>{h()},{deep:!0,immediate:!1}),a.watch(()=>n.cmsData,()=>{h()},{deep:!0}),a.watch(()=>{switch(o.value){case"page":return n.cmsData.page;case"parts":return c.value==="common"?n.cmsData.parts.common:n.cmsData.parts.individual;case"images":return c.value==="common"?n.cmsData.images.common:n.cmsData.images.individual;default:return null}},()=>{h()},{deep:!0}),a.watch(c,()=>{h()}),a.watch(o,()=>{c.value=n.config?.categoryOrder==="individual"?"individual":"common",h()});const x=async()=>{const v=g.value;try{await navigator.clipboard.writeText(v),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(w){console.error("コピーに失敗しました:",w);const T=document.createElement("textarea");T.value=v,T.style.position="fixed",T.style.opacity="0",document.body.appendChild(T),T.select();try{document.execCommand("copy"),i.value=!0,setTimeout(()=>{i.value=!1},2e3)}catch(M){console.error("コピーに失敗しました:",M)}document.body.removeChild(T)}};return h(),e({internalActiveTab:o,activeCategory:c}),(v,w)=>(a.openBlock(),a.createElementBlock("div",WA,[a.createElementVNode("div",GA,[a.createElementVNode("div",qA,[a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="page"},"zcode-data-viewer-content-tab"]),onClick:w[0]||(w[0]=T=>o.value="page")},a.toDisplayString(v.$t("dataViewer.page")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="parts"},"zcode-data-viewer-content-tab"]),onClick:w[1]||(w[1]=T=>o.value="parts")},a.toDisplayString(v.$t("dataViewer.parts")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:o.value==="images"},"zcode-data-viewer-content-tab"]),onClick:w[2]||(w[2]=T=>o.value="images")},a.toDisplayString(v.$t("dataViewer.images")),3)]),a.createElementVNode("div",KA,[o.value==="page"?(a.openBlock(),a.createElementBlock(a.Fragment,{key:0},[a.createElementVNode("button",{class:a.normalizeClass([{active:r.value==="json"},"zcode-data-viewer-tab"]),onClick:w[3]||(w[3]=T=>r.value="json")},a.toDisplayString(v.$t("dataViewer.json")),3),a.createElementVNode("button",{class:a.normalizeClass([{active:r.value==="html"},"zcode-data-viewer-tab"]),onClick:w[4]||(w[4]=T=>r.value="html")},a.toDisplayString(v.$t("dataViewer.html")),3)],64)):(a.openBlock(!0),a.createElementBlock(a.Fragment,{key:1},a.renderList(l.value,T=>(a.openBlock(),a.createElementBlock("button",{key:T,class:a.normalizeClass([{active:c.value===T},"zcode-data-viewer-tab"]),onClick:M=>c.value=T},a.toDisplayString(T==="common"?v.$t("dataViewer.common"):T==="individual"?v.$t("dataViewer.individual"):v.$t("dataViewer.special")),11,JA))),128))])]),a.createElementVNode("div",XA,[a.createElementVNode("div",YA,[a.createElementVNode("pre",QA,a.toDisplayString(g.value),1),a.createElementVNode("button",{class:"zcode-data-viewer-copy-btn",title:i.value?v.$t("common.copied"):v.$t("common.copy"),onClick:x},[i.value?(a.openBlock(),a.createBlock(a.unref(sr),{key:0,size:18})):(a.openBlock(),a.createBlock(a.unref(Xm),{key:1,size:18}))],8,ZA)])])]))}}),tM={class:"zcode-dev-container"},nM={class:"zcode-dev-header"},oM={class:"zcode-dev-tabs"},rM=["title"],iM={key:3,class:"zcode-loading-message"},sM={class:"zcode-loading-message-text"},aM={key:5,class:"zcode-loading-message"},lM={class:"zcode-loading-message-text"},cM={key:6,class:"zcode-save-controls-fixed"},dM={class:"zcode-save-confirm-dialog"},uM={class:"zcode-save-confirm-dialog-header"},fM={class:"zcode-save-confirm-dialog-title"},pM={class:"zcode-save-confirm-dialog-body"},hM={class:"zcode-save-confirm-targets"},mM={class:"zcode-save-confirm-dialog-footer"},vc=a.defineComponent({__name:"ZeroCodeEditor",props:{locale:{type:String},page:{type:String},cssCommon:{type:String},cssIndividual:{type:String},cssSpecial:{type:String},partsCommon:{type:String},partsIndividual:{type:String},partsSpecial:{type:String},imagesCommon:{type:String},imagesIndividual:{type:String},imagesSpecial:{type:String},config:{type:String},endpoints:{type:String},backendData:{type:String},enablePartsManager:{type:Boolean},enableImagesManager:{type:Boolean}},setup(t,{expose:e}){const{t:n}=rn(),o=t,r=a.computed(()=>o.enablePartsManager!==!1),i=a.computed(()=>o.enableImagesManager!==!1),s=a.ref("manage"),l=a.ref("edit"),c=a.ref(null),d=a.ref(null),u=a.ref(null),f=a.ref(null),p=a.ref(!1),h=a.ref(!1),m=a.ref([]),g=(C=>{if(!C)return{};try{return JSON.parse(C)}catch($){return console.warn("[ZeroCodeEditor] Failed to parse config:",$),{}}})(o.config);function x(C){return typeof C=="object"&&C!==null}function v(C){return C==="common"||C==="individual"||C==="special"}function w(C){return C==="page"||C==="parts"||C==="images"}function T(C){if(x(C)&&"value"in C)return C.value}function M(C){const $=T(C);if(typeof $=="boolean")return $;if(typeof C=="boolean")return C}function A(C){const $=T(C);if(typeof $=="string")return $;if(typeof C=="string")return C}function y(C,$){return x(C)&&"value"in C?(C.value=$,!0):!1}function E(C,$){if(x(C))return C[$]}function k(C){const $=E(C,"activeCategory");if(v($))return $;const te=T($);return v(te)?te:void 0}function O(C){const $=E(C,"internalActiveTab");if(w($))return $;const te=T($);return w(te)?te:void 0}function G(){const C=c.value;return!x(C)||!("cmsData"in C)||!("currentMode"in C)||!("switchMode"in C)||!("allowDynamicContentInteraction"in C)||!("settingsPanelOpen"in C)||!("setData"in C)?null:C}const z=(C,$,te)=>{const ge=Mu();return ge[C]!==void 0?ge[C]:te!==void 0?te:$},R=a.ref(z("showDataViewer",!1,g.dev?.showDataViewer)),W=a.ref(z("showSaveConfirm",!0,g.dev?.showSaveConfirm)),{cmsData:H,loadDataFromProps:L}=km(o),j=a.computed(()=>{const C=G();return C?C.cmsData:H}),Z=a.computed(()=>{const C=G();return(C?A(C.currentMode):void 0)??"edit"}),K=C=>{c.value?.switchMode&&c.value.switchMode(C)};function ae(C){l.value=C,(C==="parts"||C==="images"||C==="data")&&(s.value="manage")}function ee(){const C=G();C&&!y(C.settingsPanelOpen,!0)&&(C.settingsPanelOpen=!0)}const X=a.computed(()=>{if(s.value==="preview")return!0;const C=G();if(C){const $=M(C.allowDynamicContentInteraction);if($!==void 0)return $}return h1("allowDynamicContentInteraction",!1)});function Y(C){const $=j.value;if(!C)return $;const te=C.split(".");let ge=$;for(const Re of te)if(!x(ge)||(ge=ge[Re],ge===void 0))return;return ge}function J(C,$){const te=G();return te?te.setData(C,$):!1}a.onMounted(()=>{L()}),a.watch([()=>o.page,()=>o.partsCommon,()=>o.partsIndividual,()=>o.partsSpecial,()=>o.imagesCommon,()=>o.imagesIndividual,()=>o.imagesSpecial,()=>o.cssCommon,()=>o.cssIndividual,()=>o.cssSpecial],()=>{L()}),a.watch(R,C=>{Ba({showDataViewer:C})}),a.watch(W,C=>{Ba({showSaveConfirm:C})}),a.watch(s,(C,$)=>{de("view-mode-changed",{mode:C,previousMode:$})});function Q(C){W.value=C}function de(C,$){const te=document.querySelector("zcode-editor");if(te){const Re=new CustomEvent(C,{detail:$,bubbles:!0,composed:!0});te.dispatchEvent(Re);return}const ge=new CustomEvent(C,{detail:$,bubbles:!0,composed:!0});typeof window<"u"&&window.dispatchEvent(ge)}function ke(){return`req-${Date.now()}-${Math.random().toString(36).slice(2)}`}function Te(){if(!j.value)return[];let C;if(l.value==="edit")C="page";else if(l.value==="parts")if(!d.value)console.warn('[ZeroCode] partsManagerRefが設定されていません。デフォルトで"common"を使用します。'),C="parts-common";else{const te=k(d.value);te==null?(console.warn('[ZeroCode] parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),C="parts-common"):te==="common"?C="parts-common":te==="individual"?C="parts-individual":C="parts-special"}else if(l.value==="images")if(!u.value)console.warn('[ZeroCode] imagesManagerRefが設定されていません。デフォルトで"common"を使用します。'),C="images-common";else{const te=k(u.value);te==null?(console.warn('[ZeroCode] images activeCategoryが取得できません。デフォルトで"common"を使用します。'),C="images-common"):te==="common"?C="images-common":te==="individual"?C="images-individual":C="images-special"}else if(l.value==="data")if(!f.value)console.warn('[ZeroCode] dataViewerRefが設定されていません。デフォルトで"page"を使用します。'),C="page";else{const te=O(f.value),ge=k(f.value);if(te==null)console.warn('[ZeroCode] dataViewer internalActiveTabが取得できません。デフォルトで"page"を使用します。'),C="page";else if(te==="page")C="page";else if(te==="parts")ge==null?(console.warn('[ZeroCode] dataViewer parts activeCategoryが取得できません。デフォルトで"common"を使用します。'),C="parts-common"):ge==="common"?C="parts-common":ge==="individual"?C="parts-individual":C="parts-special";else if(te==="images")ge==null?(console.warn('[ZeroCode] dataViewer images activeCategoryが取得できません。デフォルトで"common"を使用します。'),C="images-common"):ge==="common"?C="images-common":ge==="individual"?C="images-individual":C="images-special";else return console.warn(`[ZeroCode] dataViewer 不明なinternalActiveTab: ${te}`),[]}else return[];let $;return C==="page"?$=["page","images-common","images-individual"]:C==="parts-common"?$=[C,"parts-common-css"]:C==="parts-individual"?$=[C,"parts-individual-css"]:C==="parts-special"?$=[C,"parts-special-css"]:$=[C],$}function $e(){if(!W.value){N();return}const C=Te();if(C.length===0){console.warn(`[ZeroCode] ${n("editor.noSaveTargets")}`);return}m.value=C,h.value=!0}function N(){const C=Te();if(C.length===0){console.warn(`[ZeroCode] ${n("editor.noSaveTargets")}`);return}de("save-request",{requestId:ke(),source:"editor",targets:C,timestamp:Date.now()})}function P(){h.value=!1,N()}function V(){h.value=!1,m.value=[]}function S(C){const{t:$}=rn();return{page:$("saveConfirm.targets.page"),"parts-common":$("saveConfirm.targets.parts-common"),"parts-individual":$("saveConfirm.targets.parts-individual"),"parts-special":$("saveConfirm.targets.parts-special"),"images-common":$("saveConfirm.targets.images-common"),"images-individual":$("saveConfirm.targets.images-individual"),"images-special":$("saveConfirm.targets.images-special"),"parts-common-css":$("saveConfirm.targets.parts-common-css"),"parts-individual-css":$("saveConfirm.targets.parts-individual-css"),"parts-special-css":$("saveConfirm.targets.parts-special-css")}[C]||C}return e({getData:Y,setData:J,allowDynamicContentInteraction:X}),(C,$)=>(a.openBlock(),a.createElementBlock("div",tM,[a.createElementVNode("div",nM,[a.createElementVNode("div",oM,[a.createElementVNode("button",{class:a.normalizeClass([{active:l.value==="edit"},"zcode-dev-tab"]),onClick:$[0]||($[0]=te=>ae("edit"))},[a.createVNode(a.unref(oa),{size:16}),a.createElementVNode("span",null,a.toDisplayString(C.$t("editor.pageManagement")),1)],2),r.value?(a.openBlock(),a.createElementBlock("button",{key:0,class:a.normalizeClass([{active:l.value==="parts"},"zcode-dev-tab"]),onClick:$[1]||($[1]=te=>ae("parts"))},[a.createVNode(a.unref(og),{size:16}),a.createElementVNode("span",null,a.toDisplayString(C.$t("editor.partsManagement")),1)],2)):a.createCommentVNode("",!0),i.value?(a.openBlock(),a.createElementBlock("button",{key:1,class:a.normalizeClass([{active:l.value==="images"},"zcode-dev-tab"]),onClick:$[2]||($[2]=te=>ae("images"))},[a.createVNode(a.unref(Rc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(C.$t("editor.imagesManagement")),1)],2)):a.createCommentVNode("",!0),a.createElementVNode("button",{class:a.normalizeClass([{active:l.value==="data"},"zcode-dev-tab"]),onClick:$[3]||($[3]=te=>ae("data"))},[a.createVNode(a.unref(Ym),{size:16}),a.createElementVNode("span",null,a.toDisplayString(C.$t("editor.dataViewer")),1)],2),a.createElementVNode("button",{class:"zcode-dev-tab zcode-dev-settings-btn",title:C.$t("toolbar.settings"),onClick:$[4]||($[4]=te=>p.value=!0)},[a.createVNode(a.unref($c),{size:16})],8,rM)])]),l.value==="edit"?(a.openBlock(),a.createBlock(rd,{key:0,"current-mode":Z.value,"view-mode":s.value,"allow-dynamic-content-interaction":X.value,onSwitchMode:K,onSwitchViewMode:$[5]||($[5]=te=>s.value=te),onOpenSettings:ee},null,8,["current-mode","view-mode","allow-dynamic-content-interaction"])):a.createCommentVNode("",!0),s.value==="preview"&&j.value?(a.openBlock(),a.createBlock(ma,{key:1,"cms-data":j.value,"allow-dynamic-content-interaction":X.value},null,8,["cms-data","allow-dynamic-content-interaction"])):a.createCommentVNode("",!0),a.withDirectives(a.createVNode(Hs,{ref_key:"cmsRef",ref:c,locale:o.locale,page:o.page,"css-common":o.cssCommon,"css-individual":o.cssIndividual,"css-special":o.cssSpecial,"parts-common":o.partsCommon,"parts-individual":o.partsIndividual,"parts-special":o.partsSpecial,"images-common":o.imagesCommon,"images-individual":o.imagesIndividual,"images-special":o.imagesSpecial,config:o.config,endpoints:o.endpoints,"backend-data":o.backendData},null,8,["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data"]),[[a.vShow,s.value==="manage"&&l.value==="edit"]]),s.value==="manage"&&r.value&&l.value==="parts"&&j.value?(a.openBlock(),a.createBlock(rA,{key:2,ref_key:"partsManagerRef",ref:d,"cms-data":j.value,config:a.unref(g)},null,8,["cms-data","config"])):a.createCommentVNode("",!0),s.value==="manage"&&r.value&&l.value==="parts"&&!j.value?(a.openBlock(),a.createElementBlock("div",iM,[a.createElementVNode("div",sM,a.toDisplayString(C.$t("editor.loading")),1)])):a.createCommentVNode("",!0),s.value==="manage"&&i.value&&l.value==="images"&&j.value?(a.openBlock(),a.createBlock(HA,{key:4,ref_key:"imagesManagerRef",ref:u,"cms-data":j.value,config:a.unref(g)},null,8,["cms-data","config"])):a.createCommentVNode("",!0),s.value==="manage"&&i.value&&l.value==="images"&&!j.value?(a.openBlock(),a.createElementBlock("div",aM,[a.createElementVNode("div",lM,a.toDisplayString(C.$t("editor.loading")),1)])):a.createCommentVNode("",!0),a.withDirectives(a.createVNode(eM,{ref_key:"dataViewerRef",ref:f,"cms-data":j.value,config:a.unref(g)},null,8,["cms-data","config"]),[[a.vShow,s.value==="manage"&&l.value==="data"&&j.value]]),a.withDirectives(a.createVNode(Ou,{"is-open":p.value,"view-mode":s.value,mode:"dev-tabs","show-save-confirm":W.value,onClose:$[6]||($[6]=te=>p.value=!1),onToggleSaveConfirm:Q},null,8,["is-open","view-mode","show-save-confirm"]),[[a.vShow,p.value]]),s.value==="manage"?(a.openBlock(),a.createElementBlock("div",cM,[a.createElementVNode("button",{class:"zcode-save-btn",onClick:$e},[a.createVNode(a.unref(Lc),{size:16}),a.createElementVNode("span",null,a.toDisplayString(C.$t("common.save")),1)])])):a.createCommentVNode("",!0),h.value?(a.openBlock(),a.createElementBlock("div",{key:7,class:"zcode-save-confirm-dialog-overlay",onClick:a.withModifiers(V,["self"])},[a.createElementVNode("div",dM,[a.createElementVNode("div",uM,[a.createElementVNode("div",fM,a.toDisplayString(C.$t("saveConfirm.title")),1)]),a.createElementVNode("div",pM,[a.createElementVNode("p",null,a.toDisplayString(C.$t("saveConfirm.message")),1),a.createElementVNode("ul",hM,[(a.openBlock(!0),a.createElementBlock(a.Fragment,null,a.renderList(m.value,te=>(a.openBlock(),a.createElementBlock("li",{key:te},a.toDisplayString(S(te)),1))),128))])]),a.createElementVNode("div",mM,[a.createElementVNode("button",{class:"zcode-btn-secondary",onClick:V},a.toDisplayString(C.$t("common.cancel")),1),a.createElementVNode("button",{class:"zcode-btn-primary",onClick:P},a.toDisplayString(C.$t("saveConfirm.saveButton")),1)])])])):a.createCommentVNode("",!0)]))}});Cm();class gM extends HTMLElement{app=null;componentInstance=null;_shadowRoot=null;constructor(){super()}connectedCallback(){if(this.app)return;this.getAttribute("use-shadow-dom")!=="false"?(this.setupShadowDOM(),window.addEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this))):(this.setupLightDOM(),window.addEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this)))}setupLightDOM(){const e=this.getAttribute("page")||"[]",n=this.getAttribute("css-common"),o=this.getAttribute("css-individual"),r=this.getAttribute("css-special"),i=this.getAttribute("parts-common")||"[]",s=this.getAttribute("parts-individual")||"[]",l=this.getAttribute("parts-special")||"[]",c=this.getAttribute("images-common")||"[]",d=this.getAttribute("images-individual")||"[]",u=this.getAttribute("images-special")||"[]",f=Ws(this);this.app=a.createApp(vc,{locale:f,page:e,cssCommon:n,cssIndividual:o,cssSpecial:r,partsCommon:i,partsIndividual:s,partsSpecial:l,imagesCommon:c,imagesIndividual:d,imagesSpecial:u,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||"",enablePartsManager:this.getAttribute("enable-parts-manager")!=="false",enableImagesManager:this.getAttribute("enable-images-manager")!=="false"}),Gs(this.app,f),this.componentInstance=this.app.mount(this),this.injectLightDOMCSS()}setupShadowDOM(){const e=this.shadowRoot,n=!!e;e?(this._shadowRoot=e,this.clearScripts()):(this._shadowRoot=this.attachShadow({mode:"open"}),this.injectCSS());const o=this.getAttribute("page")||"[]",r=this.getAttribute("css-common"),i=this.getAttribute("css-individual"),s=this.getAttribute("css-special"),l=this.getAttribute("parts-common")||"[]",c=this.getAttribute("parts-individual")||"[]",d=this.getAttribute("parts-special")||"[]",u=this.getAttribute("images-common")||"[]",f=this.getAttribute("images-individual")||"[]",p=this.getAttribute("images-special")||"[]",h=Ws(this);this.app=a.createApp(vc,{locale:h,page:o,cssCommon:r,cssIndividual:i,cssSpecial:s,partsCommon:l,partsIndividual:c,partsSpecial:d,imagesCommon:u,imagesIndividual:f,imagesSpecial:p,config:this.getAttribute("config")||"",endpoints:this.getAttribute("endpoints")||"",backendData:this.getAttribute("backend-data")||"",enablePartsManager:this.getAttribute("enable-parts-manager")!=="false",enableImagesManager:this.getAttribute("enable-images-manager")!=="false"}),Gs(this.app,h),this.componentInstance=this.app.mount(this._shadowRoot),requestAnimationFrame(()=>{requestAnimationFrame(()=>{setTimeout(()=>{this.injectScript(n)},100)})})}injectCSS(){if(!this._shadowRoot)return;const e=document.createElement("style");e.textContent=Sm,this._shadowRoot.appendChild(e),this.querySelectorAll('[slot="css"]').forEach(o=>{const r=o.cloneNode(!0);r.removeAttribute("slot"),this._shadowRoot.appendChild(r),o.remove()})}injectLightDOMCSS(){this.querySelectorAll('[slot="css"]').forEach(n=>{const o=n.cloneNode(!0);o.removeAttribute("slot"),document.head.appendChild(o)})}clearScripts(){if(!this._shadowRoot)return;this._shadowRoot.querySelectorAll("script").forEach(n=>{n.remove()})}injectScript(e=!1){if(!this._shadowRoot)return;const n=this.querySelectorAll('[slot="script"]'),o=Array.from(n),r=[],i=[];o.forEach(c=>{const d=c;if(!d.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}d.src.includes("jquery")||d.src.includes("code.jquery.com")?r.push(d):i.push(d)});const s=c=>{let d=c.src;if(e)try{const f=new URL(c.src,window.location.href);f.searchParams.set("_t",Date.now().toString()),d=f.toString()}catch{d=c.src+(c.src.includes("?")?"&":"?")+"_t="+Date.now()}const u=document.createElement("script");return u.src=d,c.type&&(u.type=c.type),c.async&&(u.async=!0),c.defer&&(u.defer=!0),c.integrity&&(u.integrity=c.integrity),c.crossOrigin&&(u.crossOrigin=c.crossOrigin),u.onerror=f=>{console.error(`Failed to load script: ${c.src}`,f)},u},l=()=>{o.forEach(c=>{c.remove()})};if(r.length>0){let c=0;const d=r.length;r.forEach(u=>{const f=s(u);f.onload=()=>{c++,c===d&&(Mo(this._shadowRoot,e),requestAnimationFrame(()=>{i.forEach(p=>{this._shadowRoot.appendChild(s(p))}),l()}))},this._shadowRoot.appendChild(f)})}else Mo(this._shadowRoot,e),i.forEach(c=>{this._shadowRoot.appendChild(s(c))}),l()}injectLightDOMScripts(){const e=this.querySelectorAll('[slot="script"]'),n=[],o=[];e.forEach(i=>{const s=i;if(!s.src){console.warn("Inline scripts are not allowed. Only external script files with src attribute are supported.");return}s.src.includes("jquery")||s.src.includes("code.jquery.com")?n.push(s):o.push(s)});const r=i=>{const s=document.createElement("script");return s.src=i.src,i.type&&(s.type=i.type),i.async&&(s.async=!0),i.defer&&(s.defer=!0),i.integrity&&(s.integrity=i.integrity),i.crossOrigin&&(s.crossOrigin=i.crossOrigin),s.onerror=l=>{console.error(`Failed to load script: ${i.src}`,l)},s};if(n.length>0){let i=0;const s=n.length;n.forEach(l=>{const c=r(l);c.onload=()=>{i++,i===s&&requestAnimationFrame(()=>{o.forEach(d=>{document.body.appendChild(r(d))})})},document.body.appendChild(c)})}else o.forEach(i=>{document.body.appendChild(r(i))})}getData(e){return this.componentInstance&&this.componentInstance.getData?this.componentInstance.getData(e):null}setData(e,n){return this.componentInstance&&this.componentInstance.setData?this.componentInstance.setData(e,n):!1}get allowDynamicContentInteraction(){if(this.componentInstance){const e=this.componentInstance.allowDynamicContentInteraction;if(e!==void 0)return e&&typeof e=="object"&&"value"in e?e.value:e}return!0}set allowDynamicContentInteraction(e){if(this.componentInstance){const n=this.componentInstance.allowDynamicContentInteraction;n!==void 0&&(n&&typeof n=="object"&&"value"in n?n.value=e:this.componentInstance.allowDynamicContentInteraction=e)}}disconnectedCallback(){if(this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot){if(this._shadowRoot.__zecEventListeners){const e=this._shadowRoot.__zecEventListeners,n=this._shadowRoot;e.forEach(o=>{o.forEach(r=>{n.removeEventListener(r.eventName,r.handler,!0)})}),e.clear()}if(window.__zecShadowRoots){const e=window.__zecShadowRoots,n=this._shadowRoot;for(const[o,r]of e.entries())r===n&&e.delete(o)}}this._shadowRoot=null,window.removeEventListener("zcode-dom-updated",this.handleDOMUpdated.bind(this)),window.removeEventListener("zcode-dom-updated",this.handleLightDOMUpdated.bind(this))}handleDOMUpdated(){if(!this._shadowRoot||this.getAttribute("use-shadow-dom")!=="true")return;this._shadowRoot.__zecJQueryExtended&&delete this._shadowRoot.__zecJQueryExtended;const e=this._shadowRoot.querySelector("script[data-zec-shadow-extension]");e&&e.remove(),Mo(this._shadowRoot,!0)}handleLightDOMUpdated(){this.getAttribute("use-shadow-dom")!=="true"&&(this.__lightDOMScriptsLoaded||(this.injectLightDOMScripts(),this.__lightDOMScriptsLoaded=!0))}static get observedAttributes(){return["locale","page","css-common","css-individual","css-special","parts-common","parts-individual","parts-special","images-common","images-individual","images-special","config","endpoints","backend-data","enable-parts-manager","enable-images-manager","use-shadow-dom"]}attributeChangedCallback(e,n,o){if(n!==o){if(e==="use-shadow-dom"){this.app&&(this.app.unmount(),this.app=null),this.componentInstance=null,this._shadowRoot&&(this._shadowRoot.innerHTML="",this._shadowRoot=null),this.connectedCallback();return}this.app&&(this.app.unmount(),this.app=null,this.componentInstance=null,this.connectedCallback())}}}customElements.get("zcode-editor")||customElements.define("zcode-editor",gM);class ni extends Error{constructor(e,n,o){super(o),this.code=e,this.path=n,this.name="RenderError"}}function bM(t,e={}){const{enableEditorAttributes:n=!1}=e,o=t.backendData;if(!t)throw new ni("PARSE_ERROR","","データが提供されていません");const r=t.parts||{common:[],individual:[],special:[]},i=t.images||{common:[],individual:[],special:[]},s=t.page||[];function l(d){return ha(d,r)}function c(d,u="",f=new Set){if(f.has(u))throw new ni("CIRCULAR_REFERENCE",u,`循環参照が検出されました: ${u}`);f.add(u);const p=d.part_id,h=l(p);if(!h)throw new ni("PART_NOT_FOUND",u,`パーツが見つかりません: ${p}`);const m=ui(h.body,d,u,l,(b,g)=>c(b,g,f),n,i.common,i.individual,i.special,o);return n?td(m,{"data-zcode-id":d.id,"data-zcode-path":u,"data-zcode-part":p}):m}return s.map((d,u)=>{try{return c(d,`page.${u}`)}catch(f){if(f instanceof ni)return`<div class="zcode-error-message" data-error-code="${f.code}">${f.message}</div>`;throw f}}).join("")}en.RenderError=ni,en.ZeroCodeCMS=Hs,en.ZeroCodeEditor=vc,en.ZeroCodePreview=ma,en.renderToHtml=bM,Object.defineProperty(en,Symbol.toStringTag,{value:"Module"})}));
490
490
  //# sourceMappingURL=zerocode.umd.js.map