vdc-editor 0.1.282 → 0.1.284

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.
@@ -132,7 +132,7 @@ __p += '`),xt&&(xe+=`' +
132
132
  function print() { __p += __j.call(arguments, '') }
133
133
  `:`;
134
134
  `)+xe+`return __p
135
- }`;var gt=U9(function(){return Mt(P,Ue+"return "+xe).apply(n,U)});if(gt.source=xe,K2(gt))throw gt;return gt}function aue(d){return It(d).toLowerCase()}function lue(d){return It(d).toUpperCase()}function uue(d,h,w){if(d=It(d),d&&(w||h===n))return ZS(d);if(!d||!(h=Br(h)))return d;var S=So(d),B=So(h),P=QS(S,B),U=NS(S,B)+1;return Vs(S,P,U).join("")}function cue(d,h,w){if(d=It(d),d&&(w||h===n))return d.slice(0,t_(d)+1);if(!d||!(h=Br(h)))return d;var S=So(d),B=NS(S,So(h))+1;return Vs(S,0,B).join("")}function due(d,h,w){if(d=It(d),d&&(w||h===n))return d.replace(Kv,"");if(!d||!(h=Br(h)))return d;var S=So(d),B=QS(S,So(h));return Vs(S,B).join("")}function fue(d,h){var w=M,S=$;if(nn(h)){var B="separator"in h?h.separator:B;w="length"in h?ft(h.length):w,S="omission"in h?Br(h.omission):S}d=It(d);var P=d.length;if(eu(d)){var U=So(d);P=U.length}if(w>=P)return d;var K=w-tu(S);if(K<1)return S;var Z=U?Vs(U,0,K).join(""):d.slice(0,K);if(B===n)return Z+S;if(U&&(K+=Z.length-K),G2(B)){if(d.slice(K).search(B)){var ve,ye=Z;for(B.global||(B=u2(B.source,It(yS.exec(B))+"g")),B.lastIndex=0;ve=B.exec(ye);)var xe=ve.index;Z=Z.slice(0,xe===n?K:xe)}}else if(d.indexOf(Br(B),K)!=K){var Re=Z.lastIndexOf(B);Re>-1&&(Z=Z.slice(0,Re))}return Z+S}function pue(d){return d=It(d),d&&An.test(d)?d.replace(fn,Ure):d}var hue=lu(function(d,h,w){return d+(w?" ":"")+h.toUpperCase()}),J2=W_("toUpperCase");function z9(d,h,w){return d=It(d),h=w?n:h,h===n?Vre(d)?qre(d):Are(d):d.match(h)||[]}var U9=bt(function(d,h){try{return Mr(d,n,h)}catch(w){return K2(w)?w:new it(w)}}),mue=Oi(function(d,h){return Nr(h,function(w){w=ei(w),Ai(d,w,j2(d[w],d))}),d});function gue(d){var h=d==null?0:d.length,w=Ye();return d=h?Qt(d,function(S){if(typeof S[1]!="function")throw new eo(a);return[w(S[0]),S[1]]}):[],bt(function(S){for(var B=-1;++B<h;){var P=d[B];if(Mr(P[0],this,S))return Mr(P[1],this,S)}})}function bue(d){return Uoe(no(d,p))}function Z2(d){return function(){return d}}function vue(d,h){return d==null||d!==d?h:d}var yue=q_(),wue=q_(!0);function br(d){return d}function Q2(d){return x_(typeof d=="function"?d:no(d,p))}function xue(d){return E_(no(d,p))}function Cue(d,h){return k_(d,no(h,p))}var Eue=bt(function(d,h){return function(w){return rd(w,d,h)}}),kue=bt(function(d,h){return function(w){return rd(d,w,h)}});function N2(d,h,w){var S=Mn(h),B=lm(h,S);w==null&&!(nn(h)&&(B.length||!S.length))&&(w=h,h=d,d=this,B=lm(h,Mn(h)));var P=!(nn(w)&&"chain"in w)||!!w.chain,U=Ii(d);return Nr(B,function(K){var Z=h[K];d[K]=Z,U&&(d.prototype[K]=function(){var ve=this.__chain__;if(P||ve){var ye=d(this.__wrapped__),xe=ye.__actions__=hr(this.__actions__);return xe.push({func:Z,args:arguments,thisArg:d}),ye.__chain__=ve,ye}return Z.apply(d,Bs([this.value()],arguments))})}),d}function Sue(){return Dn._===this&&(Dn._=Zre),this}function ey(){}function _ue(d){return d=ft(d),bt(function(h){return S_(h,d)})}var Tue=B2(Qt),Aue=B2(KS),Mue=B2(n2);function W9(d){return F2(d)?r2(ei(d)):iie(d)}function Oue(d){return function(h){return d==null?n:Ha(d,h)}}var Bue=G_(),Iue=G_(!0);function ty(){return[]}function ny(){return!1}function Rue(){return{}}function Lue(){return""}function Due(){return!0}function Pue(d,h){if(d=ft(d),d<1||d>H)return[];var w=X,S=Gn(d,X);h=Ye(h),d-=X;for(var B=s2(S,h);++w<d;)h(w);return B}function Vue(d){return lt(d)?Qt(d,ei):Ir(d)?[d]:hr(u9(It(d)))}function Fue(d){var h=++Yre;return It(d)+h}var $ue=hm(function(d,h){return d+h},0),Hue=I2("ceil"),zue=hm(function(d,h){return d/h},1),Uue=I2("floor");function Wue(d){return d&&d.length?am(d,br,b2):n}function jue(d,h){return d&&d.length?am(d,Ye(h,2),b2):n}function que(d){return YS(d,br)}function Kue(d,h){return YS(d,Ye(h,2))}function Gue(d){return d&&d.length?am(d,br,x2):n}function Xue(d,h){return d&&d.length?am(d,Ye(h,2),x2):n}var Yue=hm(function(d,h){return d*h},1),Jue=I2("round"),Zue=hm(function(d,h){return d-h},0);function Que(d){return d&&d.length?i2(d,br):0}function Nue(d,h){return d&&d.length?i2(d,Ye(h,2)):0}return I.after=xae,I.ary=w9,I.assign=lle,I.assignIn=L9,I.assignInWith=Tm,I.assignWith=ule,I.at=cle,I.before=x9,I.bind=j2,I.bindAll=mue,I.bindKey=C9,I.castArray=Rae,I.chain=b9,I.chunk=Uie,I.compact=Wie,I.concat=jie,I.cond=gue,I.conforms=bue,I.constant=Z2,I.countBy=Qse,I.create=dle,I.curry=E9,I.curryRight=k9,I.debounce=S9,I.defaults=fle,I.defaultsDeep=ple,I.defer=Cae,I.delay=Eae,I.difference=qie,I.differenceBy=Kie,I.differenceWith=Gie,I.drop=Xie,I.dropRight=Yie,I.dropRightWhile=Jie,I.dropWhile=Zie,I.fill=Qie,I.filter=eae,I.flatMap=rae,I.flatMapDeep=oae,I.flatMapDepth=iae,I.flatten=p9,I.flattenDeep=Nie,I.flattenDepth=ese,I.flip=kae,I.flow=yue,I.flowRight=wue,I.fromPairs=tse,I.functions=wle,I.functionsIn=xle,I.groupBy=sae,I.initial=rse,I.intersection=ose,I.intersectionBy=ise,I.intersectionWith=sse,I.invert=Ele,I.invertBy=kle,I.invokeMap=lae,I.iteratee=Q2,I.keyBy=uae,I.keys=Mn,I.keysIn=gr,I.map=xm,I.mapKeys=_le,I.mapValues=Tle,I.matches=xue,I.matchesProperty=Cue,I.memoize=Em,I.merge=Ale,I.mergeWith=D9,I.method=Eue,I.methodOf=kue,I.mixin=N2,I.negate=km,I.nthArg=_ue,I.omit=Mle,I.omitBy=Ole,I.once=Sae,I.orderBy=cae,I.over=Tue,I.overArgs=_ae,I.overEvery=Aue,I.overSome=Mue,I.partial=q2,I.partialRight=_9,I.partition=dae,I.pick=Ble,I.pickBy=P9,I.property=W9,I.propertyOf=Oue,I.pull=cse,I.pullAll=m9,I.pullAllBy=dse,I.pullAllWith=fse,I.pullAt=pse,I.range=Bue,I.rangeRight=Iue,I.rearg=Tae,I.reject=hae,I.remove=hse,I.rest=Aae,I.reverse=U2,I.sampleSize=gae,I.set=Rle,I.setWith=Lle,I.shuffle=bae,I.slice=mse,I.sortBy=wae,I.sortedUniq=Cse,I.sortedUniqBy=Ese,I.split=rue,I.spread=Mae,I.tail=kse,I.take=Sse,I.takeRight=_se,I.takeRightWhile=Tse,I.takeWhile=Ase,I.tap=Wse,I.throttle=Oae,I.thru=wm,I.toArray=B9,I.toPairs=V9,I.toPairsIn=F9,I.toPath=Vue,I.toPlainObject=R9,I.transform=Dle,I.unary=Bae,I.union=Mse,I.unionBy=Ose,I.unionWith=Bse,I.uniq=Ise,I.uniqBy=Rse,I.uniqWith=Lse,I.unset=Ple,I.unzip=W2,I.unzipWith=g9,I.update=Vle,I.updateWith=Fle,I.values=du,I.valuesIn=$le,I.without=Dse,I.words=z9,I.wrap=Iae,I.xor=Pse,I.xorBy=Vse,I.xorWith=Fse,I.zip=$se,I.zipObject=Hse,I.zipObjectDeep=zse,I.zipWith=Use,I.entries=V9,I.entriesIn=F9,I.extend=L9,I.extendWith=Tm,N2(I,I),I.add=$ue,I.attempt=U9,I.camelCase=Wle,I.capitalize=$9,I.ceil=Hue,I.clamp=Hle,I.clone=Lae,I.cloneDeep=Pae,I.cloneDeepWith=Vae,I.cloneWith=Dae,I.conformsTo=Fae,I.deburr=H9,I.defaultTo=vue,I.divide=zue,I.endsWith=jle,I.eq=To,I.escape=qle,I.escapeRegExp=Kle,I.every=Nse,I.find=tae,I.findIndex=d9,I.findKey=hle,I.findLast=nae,I.findLastIndex=f9,I.findLastKey=mle,I.floor=Uue,I.forEach=v9,I.forEachRight=y9,I.forIn=gle,I.forInRight=ble,I.forOwn=vle,I.forOwnRight=yle,I.get=X2,I.gt=$ae,I.gte=Hae,I.has=Cle,I.hasIn=Y2,I.head=h9,I.identity=br,I.includes=aae,I.indexOf=nse,I.inRange=zle,I.invoke=Sle,I.isArguments=Wa,I.isArray=lt,I.isArrayBuffer=zae,I.isArrayLike=mr,I.isArrayLikeObject=pn,I.isBoolean=Uae,I.isBuffer=Fs,I.isDate=Wae,I.isElement=jae,I.isEmpty=qae,I.isEqual=Kae,I.isEqualWith=Gae,I.isError=K2,I.isFinite=Xae,I.isFunction=Ii,I.isInteger=T9,I.isLength=Sm,I.isMap=A9,I.isMatch=Yae,I.isMatchWith=Jae,I.isNaN=Zae,I.isNative=Qae,I.isNil=ele,I.isNull=Nae,I.isNumber=M9,I.isObject=nn,I.isObjectLike=un,I.isPlainObject=ud,I.isRegExp=G2,I.isSafeInteger=tle,I.isSet=O9,I.isString=_m,I.isSymbol=Ir,I.isTypedArray=cu,I.isUndefined=nle,I.isWeakMap=rle,I.isWeakSet=ole,I.join=ase,I.kebabCase=Gle,I.last=oo,I.lastIndexOf=lse,I.lowerCase=Xle,I.lowerFirst=Yle,I.lt=ile,I.lte=sle,I.max=Wue,I.maxBy=jue,I.mean=que,I.meanBy=Kue,I.min=Gue,I.minBy=Xue,I.stubArray=ty,I.stubFalse=ny,I.stubObject=Rue,I.stubString=Lue,I.stubTrue=Due,I.multiply=Yue,I.nth=use,I.noConflict=Sue,I.noop=ey,I.now=Cm,I.pad=Jle,I.padEnd=Zle,I.padStart=Qle,I.parseInt=Nle,I.random=Ule,I.reduce=fae,I.reduceRight=pae,I.repeat=eue,I.replace=tue,I.result=Ile,I.round=Jue,I.runInContext=J,I.sample=mae,I.size=vae,I.snakeCase=nue,I.some=yae,I.sortedIndex=gse,I.sortedIndexBy=bse,I.sortedIndexOf=vse,I.sortedLastIndex=yse,I.sortedLastIndexBy=wse,I.sortedLastIndexOf=xse,I.startCase=oue,I.startsWith=iue,I.subtract=Zue,I.sum=Que,I.sumBy=Nue,I.template=sue,I.times=Pue,I.toFinite=Ri,I.toInteger=ft,I.toLength=I9,I.toLower=aue,I.toNumber=io,I.toSafeInteger=ale,I.toString=It,I.toUpper=lue,I.trim=uue,I.trimEnd=cue,I.trimStart=due,I.truncate=fue,I.unescape=pue,I.uniqueId=Fue,I.upperCase=hue,I.upperFirst=J2,I.each=v9,I.eachRight=y9,I.first=h9,N2(I,function(){var d={};return Qo(I,function(h,w){Rt.call(I.prototype,w)||(d[w]=h)}),d}(),{chain:!1}),I.VERSION=r,Nr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(d){I[d].placeholder=I}),Nr(["drop","take"],function(d,h){wt.prototype[d]=function(w){w=w===n?1:En(ft(w),0);var S=this.__filtered__&&!h?new wt(this):this.clone();return S.__filtered__?S.__takeCount__=Gn(w,S.__takeCount__):S.__views__.push({size:Gn(w,X),type:d+(S.__dir__<0?"Right":"")}),S},wt.prototype[d+"Right"]=function(w){return this.reverse()[d](w).reverse()}}),Nr(["filter","map","takeWhile"],function(d,h){var w=h+1,S=w==ee||w==F;wt.prototype[d]=function(B){var P=this.clone();return P.__iteratees__.push({iteratee:Ye(B,3),type:w}),P.__filtered__=P.__filtered__||S,P}}),Nr(["head","last"],function(d,h){var w="take"+(h?"Right":"");wt.prototype[d]=function(){return this[w](1).value()[0]}}),Nr(["initial","tail"],function(d,h){var w="drop"+(h?"":"Right");wt.prototype[d]=function(){return this.__filtered__?new wt(this):this[w](1)}}),wt.prototype.compact=function(){return this.filter(br)},wt.prototype.find=function(d){return this.filter(d).head()},wt.prototype.findLast=function(d){return this.reverse().find(d)},wt.prototype.invokeMap=bt(function(d,h){return typeof d=="function"?new wt(this):this.map(function(w){return rd(w,d,h)})}),wt.prototype.reject=function(d){return this.filter(km(Ye(d)))},wt.prototype.slice=function(d,h){d=ft(d);var w=this;return w.__filtered__&&(d>0||h<0)?new wt(w):(d<0?w=w.takeRight(-d):d&&(w=w.drop(d)),h!==n&&(h=ft(h),w=h<0?w.dropRight(-h):w.take(h-d)),w)},wt.prototype.takeRightWhile=function(d){return this.reverse().takeWhile(d).reverse()},wt.prototype.toArray=function(){return this.take(X)},Qo(wt.prototype,function(d,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),S=/^(?:head|last)$/.test(h),B=I[S?"take"+(h=="last"?"Right":""):h],P=S||/^find/.test(h);B&&(I.prototype[h]=function(){var U=this.__wrapped__,K=S?[1]:arguments,Z=U instanceof wt,ve=K[0],ye=Z||lt(U),xe=function(vt){var xt=B.apply(I,Bs([vt],K));return S&&Re?xt[0]:xt};ye&&w&&typeof ve=="function"&&ve.length!=1&&(Z=ye=!1);var Re=this.__chain__,Ue=!!this.__actions__.length,Ze=P&&!Re,gt=Z&&!Ue;if(!P&&ye){U=gt?U:new wt(this);var Qe=d.apply(U,K);return Qe.__actions__.push({func:wm,args:[xe],thisArg:n}),new to(Qe,Re)}return Ze&&gt?d.apply(this,K):(Qe=this.thru(xe),Ze?S?Qe.value()[0]:Qe.value():Qe)})}),Nr(["pop","push","shift","sort","splice","unshift"],function(d){var h=Kh[d],w=/^(?:push|sort|unshift)$/.test(d)?"tap":"thru",S=/^(?:pop|shift)$/.test(d);I.prototype[d]=function(){var B=arguments;if(S&&!this.__chain__){var P=this.value();return h.apply(lt(P)?P:[],B)}return this[w](function(U){return h.apply(lt(U)?U:[],B)})}}),Qo(wt.prototype,function(d,h){var w=I[h];if(w){var S=w.name+"";Rt.call(iu,S)||(iu[S]=[]),iu[S].push({name:h,func:w})}}),iu[pm(n,x).name]=[{name:"wrapper",func:n}],wt.prototype.clone=poe,wt.prototype.reverse=hoe,wt.prototype.value=moe,I.prototype.at=jse,I.prototype.chain=qse,I.prototype.commit=Kse,I.prototype.next=Gse,I.prototype.plant=Yse,I.prototype.reverse=Jse,I.prototype.toJSON=I.prototype.valueOf=I.prototype.value=Zse,I.prototype.first=I.prototype.head,Jc&&(I.prototype[Jc]=Xse),I},nu=Kre();Da?((Da.exports=nu)._=nu,Qv._=nu):Dn._=nu}).call(ml)}(uf,uf.exports);var kt=uf.exports;const rn=(t,e="px")=>{if(!t)return t;const n=d1(t)?String(t):t,r=parseFloat(n),i=n.match(/[a-zA-Z%]+$/),s=i?i[0]:e;return isNaN(r)?t:r+s};function iR(t,e,n){return t<e?e:t>n?n:t}const d1=t=>typeof t=="number",f1=t=>typeof t=="function";function p1(t,e){const{extensions:n=[]}=t.extensionManager??{};return!!n.find(i=>i.name===e)}function d6(t){return/\s/.test(t)}function f6(t,e){const n=[];let r=0;for(;r<t.length;){if(t.length-r<=e){n.push({text:t.substring(r),offset:r});break}let i=-1;for(let a=r+e;a>r;a--)if(d6(t[a])){i=a;break}let s;if(i>r)for(n.push({text:t.substring(r,i),offset:r}),s=i;s<t.length&&d6(t[s]);)s++;else s=r+e,n.push({text:t.substring(r,s),offset:r});r=s}return n.filter(i=>i.text.length>0)}const sR=t=>t?t.split(/\r?\n/).map(e=>`<p>${e.replace(/</g,"&lt;").replace(/>/g,"&gt;")}</p>`).join(""):"";function h1(t,e={}){const{removeNodes:n=[]}=e,r=t.getJSON();function i(f=[]){const p=[];for(const m of f){if(n.includes(m.type))continue;const g={...m};m.content&&(g.content=i(m.content)),p.push(g)}return p}const s={...r,content:i(r.content)},a=t.schema.nodeFromJSON(s),u=Pr.fromSchema(t.schema).serializeFragment(a.content),c=document.createElement("div");return c.appendChild(u),c.innerHTML}function cf(){const t=new c1;t.isNativeWebViewAvailable()&&t.sendToNative(s1.KEYBOARD_DISMISS)}let Ni=null;function aR(){if(Ni)return Ni;if(typeof document>"u")return null;const t=document.createElement("span");return t.style.position="absolute",t.style.left="-9999px",t.style.top="-9999px",t.style.whiteSpace="nowrap",t.style.visibility="hidden",document.body.appendChild(t),Ni=t,t}function df(t){var a;const e=o.ref(null),n=o.ref(null),r=()=>{const l=(t==null?void 0:t.minChars)??0;return typeof l=="number"?l:o.unref(l)??0},i=()=>{const l=(t==null?void 0:t.fontSize)??"";return typeof l=="string"?l:o.unref(l)??""};function s(){o.nextTick(()=>{const l=e.value;if(!l||typeof window>"u"||!(l instanceof Element))return;const u=aR();if(!u)return;const c=getComputedStyle(l);u.style.fontFamily=c.fontFamily||"",u.style.fontSize=i()||c.fontSize||"",u.style.fontWeight=c.fontWeight||"",u.style.letterSpacing=c.letterSpacing||"";const f=Math.max(1,r());u.textContent="가".repeat(f);const p=Math.ceil(u.getBoundingClientRect().width),m=k=>parseFloat(k)||0,g=m(c.paddingLeft),b=m(c.paddingRight),v=m(c.borderLeftWidth),y=m(c.borderRightWidth),x=g+b+v+y,E=l.offsetWidth-l.clientWidth-(v+y);n.value=p+x+E+4})}return o.onMounted(()=>{s(),typeof window<"u"&&window.addEventListener("resize",s)}),t!=null&&t.minChars&&typeof t.minChars.value<"u"&&o.watch(t.minChars,()=>{s()}),t!=null&&t.fontSize&&typeof t.fontSize.value<"u"&&o.watch(t.fontSize,()=>{s()}),(a=t==null?void 0:t.editor)==null||a.on("transaction",()=>{setTimeout(s,150)}),o.onBeforeUnmount(()=>{typeof window<"u"&&window.removeEventListener("resize",s),Ni&&Ni.parentNode&&(Ni.parentNode.removeChild(Ni),Ni=null)}),{contentInner:e,measuredMinWidth:n,measure:s}}const lR=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,uR=Lt.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",yt(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[u4({find:lR,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),cR=["src","alt"],dR={key:0,class:"image-resizer"},fR=["onMousedown","onTouchstart"],pR=o.defineComponent({__name:"ImageView",props:{...na,selected:{type:Boolean,required:!0}},setup(t){const e=t,n={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"},r=o.inject("isMobile",!1),i=o.ref({width:o6,height:o6}),s=o.ref({width:0,height:0}),a=o.ref(!1),l=o.ref({x:0,y:0,w:0,h:0,dir:""}),u=o.computed(()=>{const{src:C,alt:_,width:T,height:A,flipX:D,flipY:O}=e.node.attrs,M=[];D&&M.push("rotateX(180deg)"),O&&M.push("rotateY(180deg)");const $=M.join(" ");return{src:C||void 0,alt:_||void 0,style:{width:d1(T)?`${T}px`:T,height:d1(A)?`${A}px`:A,transform:$||"none"}}});o.computed(()=>({width:o.unref(u).style.width==="100%"?"100%":void 0}));const c=o.ref(null),f=new ResizeObserver(C=>{for(const _ of C){const{width:T,height:A}=_.contentRect;s.value={width:T,height:A},e.updateAttributes({originWidth:T,originHeight:A})}});function p(){const{editor:C,getPos:_}=e;C.commands.setNodeSelection(_())}const m=kt.throttle(()=>{const{editor:C}=e;i.value.width=parseInt(getComputedStyle(C.view.dom).width,10)},i6);function g(C,_){C.preventDefault(),C.stopPropagation();let T=0,A=0;const D=document.querySelector(".image-resizer");if(D&&(D.style.borderColor="#3b82f6"),"touches"in C&&C.touches.length>0)T=C.touches[0].clientX,A=C.touches[0].clientY;else if("clientX"in C)T=C.clientX,A=C.clientY;else return;const{width:O,height:M}=o.unref(s),$=O/M;let V=Number(e.node.attrs.width)||O,G=Number(e.node.attrs.height)||Math.round(V/$);const ee=o.unref(i).width;V=Math.min(V>ee?ee:V,ee),G=Math.round(V/$),Object.assign(l.value,{x:T,y:A,w:V,h:G,dir:_}),a.value=!0,y()}const b=kt.throttle(C=>{if(!o.unref(a))return;let _=0;if("touches"in C&&C.touches.length>0)_=C.touches[0].clientX;else if("clientX"in C)_=C.clientX;else return;const{x:T,w:A,dir:D}=o.unref(l),O=(_-T)*(/l/.test(D)?-1:1),M=iR(A+O,XI,o.unref(i).width);e.updateAttributes({width:M})},i6),v=C=>{C.preventDefault(),C.stopPropagation();const _=document.querySelector(".image-resizer");_&&(_.style.borderColor=""),o.unref(a)&&(a.value=!1,Object.assign(l.value,{x:0,y:0,w:0,h:0,dir:""}),x(),p())};function y(){document.addEventListener("mousemove",b,!0),document.addEventListener("mouseup",v,!0),document.addEventListener("touchmove",b,!0),document.addEventListener("touchend",v,!0)}function x(){document.removeEventListener("mousemove",b,!0),document.removeEventListener("mouseup",v,!0),document.removeEventListener("touchmove",b,!0),document.removeEventListener("touchend",v,!0)}const E=new ResizeObserver(m),k=o.computed(()=>{const{textAlign:C}=e.node.attrs;return{left:"margin-right: auto;",right:"margin-left: auto;",center:"margin-left: auto; margin-right: auto;"}[C]||""});return o.onMounted(()=>{c.value&&f.observe(c.value),E.observe(e.editor.view.dom)}),o.onBeforeUnmount(()=>{x(),f.disconnect(),E.disconnect()}),(C,_)=>(o.openBlock(),o.createBlock(o.unref(ta),{class:"node-image",style:o.normalizeStyle({"pointer-events":o.unref(r)&&t.selected?"none":"auto"})},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"image-view",style:o.normalizeStyle([{width:u.value.style.width,height:u.value.style.height},k.value])},[o.createElementVNode("div",{draggable:"true","data-drag-handle":"",class:o.normalizeClass([{"image-view__body--focused":t.selected,"image-view__body--resizing":a.value},"image-view__body"])},[o.createElementVNode("img",{ref_key:"imageRef",ref:c,src:u.value.src,alt:u.value.alt,class:"block w-full image-view__body__image",style:o.normalizeStyle([{transform:u.value.style.transform}]),onClick:p,onMousedown:_[0]||(_[0]=(...T)=>o.unref(cf)&&o.unref(cf)(...T))},null,44,cR),C.editor.view.editable?o.withDirectives((o.openBlock(),o.createElementBlock("div",dR,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Object.values(n),T=>(o.openBlock(),o.createElementBlock("span",{key:T,class:o.normalizeClass(o.unref(Se)(`image-resizer__handler--${T}`,"image-resizer__handler",o.unref(r)&&t.selected&&"pointer-events-auto")),onMousedown:A=>g(A,T),onTouchstart:o.withModifiers(A=>g(A,T),["prevent"])},null,42,fR))),128))],512)),[[o.vShow,t.selected||a.value]]):o.createCommentVNode("",!0)],2)],4)]),_:1},8,["style"]))}}),uo=(t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n},hR=uo(pR,[["__scopeId","data-v-db9342d0"]]),qu=uR.extend({group:"inline",inline:!0,defining:!0,isolating:!0,addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),flipX:{default:!1},flipY:{default:!1},originWidth:{default:null},originHeight:{default:null},textAlign:{default:"left",parseHTML:e=>e.style.textAlign||e.getAttribute("textAlign")||null,renderHTML:e=>({textAlign:e.textAlign})},width:{default:"100%",parseHTML:e=>{const n=e.style.width||e.getAttribute("width")||null;return n&&n.endsWith("%")?n:n==null?null:parseInt(n,10)},renderHTML:e=>({width:e.width})},height:{default:"auto",parseHTML:e=>{const n=e.style.height||e.getAttribute("height")||null;return n==null?null:parseInt(n,10)},renderHTML:e=>({height:e.height})},class:{default:"",parseHTML:e=>e.getAttribute("class")||"",renderHTML:e=>({class:e.class})},"data-memo":{default:"",parseHTML:e=>e.getAttribute("data-memo")||"",renderHTML:e=>({"data-memo":e["data-memo"]})}}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this)}},addNodeView(){return ra(hR)},addCommands(){var t;return{...(t=this.parent)==null?void 0:t.call(this),updateImage:e=>({commands:n,editor:r})=>n.updateAttributes(this.name,e)}},renderHTML({node:t,HTMLAttributes:e}){const{textAlign:n,flipX:r,flipY:i}=t.attrs,l=`${{left:"margin-right: auto;",right:"margin-left: auto;",center:"margin-left: auto; margin-right: auto;"}[n]||""} ${r||i?`transform: rotateX(${r?"180":"0"}deg) rotateY(${i?"180":"0"}deg);`:""}`;return["img",yt(this.options.HTMLAttributes,e,{style:l})]},parseHTML(){return[{tag:"img[src]"}]},addProseMirrorPlugins(){return[new nt({props:{handleTextInput(t){const{selection:e}=t.state;return e instanceof Ve&&e.node.type.name==="image"},handlePaste(t){const{selection:e}=t.state;return e instanceof Ve&&e.node.type.name==="image"}}})]}}),mR={key:0,class:"p-2.5 space-y-1.5"},gR=["innerHTML"],bR={key:1,class:"p-2.5 space-y-1.5"},vR=["innerHTML"],yR={key:2,class:"p-2.5 space-y-1.5"},wR=["innerHTML"],xR=uo(o.defineComponent({__name:"ArticleFullViewer",props:{extensions:{},mode:{},hideComment:{type:Boolean},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},comment:{},commentCuesheet:{},content:{},minChars:{},fontSize:{}},setup(t){const e=t,n=o.computed(()=>{var k;const E=((k=e.extensions)==null?void 0:k.filter(C=>C.name!=="spellchecker"))||[];return E.some(C=>C.name==="image")||E.push(qu.configure()),E}),r=o.computed(()=>oa(e.comment)),i=o.computed(()=>oa(e.commentCuesheet)),s=o.computed(()=>oa(e.content));function a(E){return u1(E).replace(/<script\b[\s\S]*?<\/script\s*>/gi,"")}const l=o.computed(()=>r.value?a(e.comment):""),u=o.computed(()=>i.value?a(e.commentCuesheet):""),c=o.computed(()=>s.value?a(e.content):""),f=o.ref(),p=o.ref(),m=o.ref();o.onBeforeUnmount(()=>{f.value&&f.value.destroy(),p.value&&p.value.destroy(),m.value&&m.value.destroy()});function g(E){return new Lo({extensions:n.value,content:E,editable:!1,parseOptions:{preserveWhitespace:"full"}})}r.value||(f.value=g(bn(e.comment,!0,e.mode))),i.value||(p.value=g(bn(e.commentCuesheet,!0,e.mode))),s.value||(m.value=g(bn(e.content,!0,e.mode)));function b(E,k){if(!E)return;const C=bn(k,!0,e.mode);kt.isEqual(E.getHTML(),C)||E.commands.setContent(C,!1,{preserveWhitespace:"full"})}o.watch(()=>e.comment,E=>{r.value||b(f.value,E)}),o.watch(()=>e.commentCuesheet,E=>{i.value||b(p.value,E)}),o.watch(()=>e.content,E=>{s.value||b(m.value,E)});const v=o.computed(()=>e.fontSize??""),{contentInner:y,measuredMinWidth:x}=df({minChars:e.minChars,fontSize:v});return(E,k)=>{var _,T,A;const C=AT;return o.openBlock(),o.createElementBlock("div",{ref_key:"contentInner",ref:y,style:o.normalizeStyle({minWidth:`${Number(o.unref(x))+23}px`}),class:"flex-1 border border-[#999] rounded-[3px] divide-y divide-[#999] divide-dashed overflow-y-auto"},[E.comment&&!E.hideComment?(o.openBlock(),o.createElementBlock("div",mR,[(_=E.fieldNameComment)!=null&&_.label?(o.openBlock(),o.createBlock(C,{key:0,label:E.fieldNameComment.label,"custom-class":E.fieldNameComment.customClass},null,8,["label","custom-class"])):o.createCommentVNode("",!0),o.unref(r)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(l)},null,8,gR)):(o.openBlock(),o.createBlock(o.unref(Qn),{key:2,editor:o.unref(f)},null,8,["editor"]))])):o.createCommentVNode("",!0),E.commentCuesheet&&!E.hideComment?(o.openBlock(),o.createElementBlock("div",bR,[(T=E.fieldNameCommentCuesheet)!=null&&T.label?(o.openBlock(),o.createBlock(C,{key:0,label:E.fieldNameCommentCuesheet.label,"custom-class":E.fieldNameCommentCuesheet.customClass},null,8,["label","custom-class"])):o.createCommentVNode("",!0),o.unref(i)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(u)},null,8,vR)):(o.openBlock(),o.createBlock(o.unref(Qn),{key:2,editor:o.unref(p)},null,8,["editor"]))])):o.createCommentVNode("",!0),E.content?(o.openBlock(),o.createElementBlock("div",yR,[(A=E.fieldNameContent)!=null&&A.label?(o.openBlock(),o.createBlock(C,{key:0,label:E.fieldNameContent.label,"custom-class":E.fieldNameContent.customClass},null,8,["label","custom-class"])):o.createCommentVNode("",!0),o.unref(s)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(c)},null,8,wR)):(o.openBlock(),o.createBlock(o.unref(Qn),{key:2,editor:o.unref(m)},null,8,["editor"]))])):o.createCommentVNode("",!0)],4)}}}),[["__scopeId","data-v-374d1603"]]),CR=["top","right","bottom","left"],es=Math.min,Cr=Math.max,ff=Math.round,pf=Math.floor,Fo=t=>({x:t,y:t}),ER={left:"right",right:"left",bottom:"top",top:"bottom"},kR={start:"end",end:"start"};function m1(t,e,n){return Cr(t,es(e,n))}function di(t,e){return typeof t=="function"?t(e):t}function fi(t){return t.split("-")[0]}function gl(t){return t.split("-")[1]}function g1(t){return t==="x"?"y":"x"}function b1(t){return t==="y"?"height":"width"}function ts(t){return["top","bottom"].includes(fi(t))?"y":"x"}function v1(t){return g1(ts(t))}function SR(t,e,n){n===void 0&&(n=!1);const r=gl(t),i=v1(t),s=b1(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(a=hf(a)),[a,hf(a)]}function _R(t){const e=hf(t);return[y1(t),e,y1(e)]}function y1(t){return t.replace(/start|end/g,e=>kR[e])}function TR(t,e,n){const r=["left","right"],i=["right","left"],s=["top","bottom"],a=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?s:a;default:return[]}}function AR(t,e,n,r){const i=gl(t);let s=TR(fi(t),n==="start",r);return i&&(s=s.map(a=>a+"-"+i),e&&(s=s.concat(s.map(y1)))),s}function hf(t){return t.replace(/left|right|bottom|top/g,e=>ER[e])}function MR(t){return{top:0,right:0,bottom:0,left:0,...t}}function p6(t){return typeof t!="number"?MR(t):{top:t,right:t,bottom:t,left:t}}function mf(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function h6(t,e,n){let{reference:r,floating:i}=t;const s=ts(e),a=v1(e),l=b1(a),u=fi(e),c=s==="y",f=r.x+r.width/2-i.width/2,p=r.y+r.height/2-i.height/2,m=r[l]/2-i[l]/2;let g;switch(u){case"top":g={x:f,y:r.y-i.height};break;case"bottom":g={x:f,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:p};break;case"left":g={x:r.x-i.width,y:p};break;default:g={x:r.x,y:r.y}}switch(gl(e)){case"start":g[a]-=m*(n&&c?-1:1);break;case"end":g[a]+=m*(n&&c?-1:1);break}return g}const OR=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:a}=n,l=s.filter(Boolean),u=await(a.isRTL==null?void 0:a.isRTL(e));let c=await a.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:p}=h6(c,r,u),m=r,g={},b=0;for(let v=0;v<l.length;v++){const{name:y,fn:x}=l[v],{x:E,y:k,data:C,reset:_}=await x({x:f,y:p,initialPlacement:r,placement:m,strategy:i,middlewareData:g,rects:c,platform:a,elements:{reference:t,floating:e}});f=E??f,p=k??p,g={...g,[y]:{...g[y],...C}},_&&b<=50&&(b++,typeof _=="object"&&(_.placement&&(m=_.placement),_.rects&&(c=_.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:i}):_.rects),{x:f,y:p}=h6(c,m,u)),v=-1)}return{x:f,y:p,placement:m,strategy:i,middlewareData:g}};async function Ku(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:a,elements:l,strategy:u}=t,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:p="floating",altBoundary:m=!1,padding:g=0}=di(e,t),b=p6(g),y=l[m?p==="floating"?"reference":"floating":p],x=mf(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:f,strategy:u})),E=p==="floating"?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),C=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},_=mf(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:E,offsetParent:k,strategy:u}):E);return{top:(x.top-_.top+b.top)/C.y,bottom:(_.bottom-x.bottom+b.bottom)/C.y,left:(x.left-_.left+b.left)/C.x,right:(_.right-x.right+b.right)/C.x}}const BR=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:a,elements:l,middlewareData:u}=e,{element:c,padding:f=0}=di(t,e)||{};if(c==null)return{};const p=p6(f),m={x:n,y:r},g=v1(i),b=b1(g),v=await a.getDimensions(c),y=g==="y",x=y?"top":"left",E=y?"bottom":"right",k=y?"clientHeight":"clientWidth",C=s.reference[b]+s.reference[g]-m[g]-s.floating[b],_=m[g]-s.reference[g],T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c));let A=T?T[k]:0;(!A||!await(a.isElement==null?void 0:a.isElement(T)))&&(A=l.floating[k]||s.floating[b]);const D=C/2-_/2,O=A/2-v[b]/2-1,M=es(p[x],O),$=es(p[E],O),V=M,G=A-v[b]-$,ee=A/2-v[b]/2+D,W=m1(V,ee,G),F=!u.arrow&&gl(i)!=null&&ee!==W&&s.reference[b]/2-(ee<V?M:$)-v[b]/2<0,R=F?ee<V?ee-V:ee-G:0;return{[g]:m[g]+R,data:{[g]:W,centerOffset:ee-W-R,...F&&{alignmentOffset:R}},reset:F}}}),IR=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:a,initialPlacement:l,platform:u,elements:c}=e,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:v=!0,...y}=di(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const x=fi(i),E=ts(l),k=fi(l)===l,C=await(u.isRTL==null?void 0:u.isRTL(c.floating)),_=m||(k||!v?[hf(l)]:_R(l)),T=b!=="none";!m&&T&&_.push(...AR(l,v,b,C));const A=[l,..._],D=await Ku(e,y),O=[];let M=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&O.push(D[x]),p){const ee=SR(i,a,C);O.push(D[ee[0]],D[ee[1]])}if(M=[...M,{placement:i,overflows:O}],!O.every(ee=>ee<=0)){var $,V;const ee=((($=s.flip)==null?void 0:$.index)||0)+1,W=A[ee];if(W)return{data:{index:ee,overflows:M},reset:{placement:W}};let F=(V=M.filter(R=>R.overflows[0]<=0).sort((R,H)=>R.overflows[1]-H.overflows[1])[0])==null?void 0:V.placement;if(!F)switch(g){case"bestFit":{var G;const R=(G=M.filter(H=>{if(T){const L=ts(H.placement);return L===E||L==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(L=>L>0).reduce((L,q)=>L+q,0)]).sort((H,L)=>H[1]-L[1])[0])==null?void 0:G[0];R&&(F=R);break}case"initialPlacement":F=l;break}if(i!==F)return{reset:{placement:F}}}return{}}}};function m6(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function g6(t){return CR.some(e=>t[e]>=0)}const RR=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=di(t,e);switch(r){case"referenceHidden":{const s=await Ku(e,{...i,elementContext:"reference"}),a=m6(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:g6(a)}}}case"escaped":{const s=await Ku(e,{...i,altBoundary:!0}),a=m6(s,n.floating);return{data:{escapedOffsets:a,escaped:g6(a)}}}default:return{}}}}};async function LR(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=fi(n),l=gl(n),u=ts(n)==="y",c=["left","top"].includes(a)?-1:1,f=s&&u?-1:1,p=di(e,t);let{mainAxis:m,crossAxis:g,alignmentAxis:b}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return l&&typeof b=="number"&&(g=l==="end"?b*-1:b),u?{x:g*f,y:m*c}:{x:m*c,y:g*f}}const DR=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:a,middlewareData:l}=e,u=await LR(e,t);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:s+u.y,data:{...u,placement:a}}}}},PR=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x,y:E}=y;return{x,y:E}}},...u}=di(t,e),c={x:n,y:r},f=await Ku(e,u),p=ts(fi(i)),m=g1(p);let g=c[m],b=c[p];if(s){const y=m==="y"?"top":"left",x=m==="y"?"bottom":"right",E=g+f[y],k=g-f[x];g=m1(E,g,k)}if(a){const y=p==="y"?"top":"left",x=p==="y"?"bottom":"right",E=b+f[y],k=b-f[x];b=m1(E,b,k)}const v=l.fn({...e,[m]:g,[p]:b});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[m]:s,[p]:a}}}}}},VR=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:a}=e,{offset:l=0,mainAxis:u=!0,crossAxis:c=!0}=di(t,e),f={x:n,y:r},p=ts(i),m=g1(p);let g=f[m],b=f[p];const v=di(l,e),y=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(u){const k=m==="y"?"height":"width",C=s.reference[m]-s.floating[k]+y.mainAxis,_=s.reference[m]+s.reference[k]-y.mainAxis;g<C?g=C:g>_&&(g=_)}if(c){var x,E;const k=m==="y"?"width":"height",C=["top","left"].includes(fi(i)),_=s.reference[p]-s.floating[k]+(C&&((x=a.offset)==null?void 0:x[p])||0)+(C?0:y.crossAxis),T=s.reference[p]+s.reference[k]+(C?0:((E=a.offset)==null?void 0:E[p])||0)-(C?y.crossAxis:0);b<_?b=_:b>T&&(b=T)}return{[m]:g,[p]:b}}}},FR=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:s,platform:a,elements:l}=e,{apply:u=()=>{},...c}=di(t,e),f=await Ku(e,c),p=fi(i),m=gl(i),g=ts(i)==="y",{width:b,height:v}=s.floating;let y,x;p==="top"||p==="bottom"?(y=p,x=m===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(x=p,y=m==="end"?"top":"bottom");const E=v-f.top-f.bottom,k=b-f.left-f.right,C=es(v-f[y],E),_=es(b-f[x],k),T=!e.middlewareData.shift;let A=C,D=_;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(D=k),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(A=E),T&&!m){const M=Cr(f.left,0),$=Cr(f.right,0),V=Cr(f.top,0),G=Cr(f.bottom,0);g?D=b-2*(M!==0||$!==0?M+$:Cr(f.left,f.right)):A=v-2*(V!==0||G!==0?V+G:Cr(f.top,f.bottom))}await u({...e,availableWidth:D,availableHeight:A});const O=await a.getDimensions(l.floating);return b!==O.width||v!==O.height?{reset:{rects:!0}}:{}}}};function gf(){return typeof window<"u"}function ia(t){return w1(t)?(t.nodeName||"").toLowerCase():"#document"}function Er(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function $o(t){var e;return(e=(w1(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function w1(t){return gf()?t instanceof Node||t instanceof Er(t).Node:!1}function co(t){return gf()?t instanceof Element||t instanceof Er(t).Element:!1}function Ho(t){return gf()?t instanceof HTMLElement||t instanceof Er(t).HTMLElement:!1}function b6(t){return!gf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Er(t).ShadowRoot}function Gu(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=fo(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function $R(t){return["table","td","th"].includes(ia(t))}function bf(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function x1(t){const e=C1(),n=co(t)?fo(t):t;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function HR(t){let e=ns(t);for(;Ho(e)&&!bl(e);){if(x1(e))return e;if(bf(e))return null;e=ns(e)}return null}function C1(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function bl(t){return["html","body","#document"].includes(ia(t))}function fo(t){return Er(t).getComputedStyle(t)}function vf(t){return co(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function ns(t){if(ia(t)==="html")return t;const e=t.assignedSlot||t.parentNode||b6(t)&&t.host||$o(t);return b6(e)?e.host:e}function v6(t){const e=ns(t);return bl(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ho(e)&&Gu(e)?e:v6(e)}function Xu(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=v6(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),a=Er(i);if(s){const l=E1(a);return e.concat(a,a.visualViewport||[],Gu(i)?i:[],l&&n?Xu(l):[])}return e.concat(i,Xu(i,[],n))}function E1(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function y6(t){const e=fo(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Ho(t),s=i?t.offsetWidth:n,a=i?t.offsetHeight:r,l=ff(n)!==s||ff(r)!==a;return l&&(n=s,r=a),{width:n,height:r,$:l}}function k1(t){return co(t)?t:t.contextElement}function vl(t){const e=k1(t);if(!Ho(e))return Fo(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=y6(e);let a=(s?ff(n.width):n.width)/r,l=(s?ff(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const zR=Fo(0);function w6(t){const e=Er(t);return!C1()||!e.visualViewport?zR:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function UR(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Er(t)?!1:e}function sa(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=k1(t);let a=Fo(1);e&&(r?co(r)&&(a=vl(r)):a=vl(t));const l=UR(s,n,r)?w6(s):Fo(0);let u=(i.left+l.x)/a.x,c=(i.top+l.y)/a.y,f=i.width/a.x,p=i.height/a.y;if(s){const m=Er(s),g=r&&co(r)?Er(r):r;let b=m,v=E1(b);for(;v&&r&&g!==b;){const y=vl(v),x=v.getBoundingClientRect(),E=fo(v),k=x.left+(v.clientLeft+parseFloat(E.paddingLeft))*y.x,C=x.top+(v.clientTop+parseFloat(E.paddingTop))*y.y;u*=y.x,c*=y.y,f*=y.x,p*=y.y,u+=k,c+=C,b=Er(v),v=E1(b)}}return mf({width:f,height:p,x:u,y:c})}function S1(t,e){const n=vf(t).scrollLeft;return e?e.left+n:sa($o(t)).left+n}function x6(t,e,n){n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=r.left+e.scrollLeft-(n?0:S1(t,r)),s=r.top+e.scrollTop;return{x:i,y:s}}function WR(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",a=$o(r),l=e?bf(e.floating):!1;if(r===a||l&&s)return n;let u={scrollLeft:0,scrollTop:0},c=Fo(1);const f=Fo(0),p=Ho(r);if((p||!p&&!s)&&((ia(r)!=="body"||Gu(a))&&(u=vf(r)),Ho(r))){const g=sa(r);c=vl(r),f.x=g.x+r.clientLeft,f.y=g.y+r.clientTop}const m=a&&!p&&!s?x6(a,u,!0):Fo(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-u.scrollLeft*c.x+f.x+m.x,y:n.y*c.y-u.scrollTop*c.y+f.y+m.y}}function jR(t){return Array.from(t.getClientRects())}function qR(t){const e=$o(t),n=vf(t),r=t.ownerDocument.body,i=Cr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Cr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+S1(t);const l=-n.scrollTop;return fo(r).direction==="rtl"&&(a+=Cr(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:a,y:l}}function KR(t,e){const n=Er(t),r=$o(t),i=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,l=0,u=0;if(i){s=i.width,a=i.height;const c=C1();(!c||c&&e==="fixed")&&(l=i.offsetLeft,u=i.offsetTop)}return{width:s,height:a,x:l,y:u}}function GR(t,e){const n=sa(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=Ho(t)?vl(t):Fo(1),a=t.clientWidth*s.x,l=t.clientHeight*s.y,u=i*s.x,c=r*s.y;return{width:a,height:l,x:u,y:c}}function C6(t,e,n){let r;if(e==="viewport")r=KR(t,n);else if(e==="document")r=qR($o(t));else if(co(e))r=GR(e,n);else{const i=w6(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return mf(r)}function E6(t,e){const n=ns(t);return n===e||!co(n)||bl(n)?!1:fo(n).position==="fixed"||E6(n,e)}function XR(t,e){const n=e.get(t);if(n)return n;let r=Xu(t,[],!1).filter(l=>co(l)&&ia(l)!=="body"),i=null;const s=fo(t).position==="fixed";let a=s?ns(t):t;for(;co(a)&&!bl(a);){const l=fo(a),u=x1(a);!u&&l.position==="fixed"&&(i=null),(s?!u&&!i:!u&&l.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Gu(a)&&!u&&E6(t,a))?r=r.filter(f=>f!==a):i=l,a=ns(a)}return e.set(t,r),r}function YR(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const a=[...n==="clippingAncestors"?bf(e)?[]:XR(e,this._c):[].concat(n),r],l=a[0],u=a.reduce((c,f)=>{const p=C6(e,f,i);return c.top=Cr(p.top,c.top),c.right=es(p.right,c.right),c.bottom=es(p.bottom,c.bottom),c.left=Cr(p.left,c.left),c},C6(e,l,i));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function JR(t){const{width:e,height:n}=y6(t);return{width:e,height:n}}function ZR(t,e,n){const r=Ho(e),i=$o(e),s=n==="fixed",a=sa(t,!0,s,e);let l={scrollLeft:0,scrollTop:0};const u=Fo(0);if(r||!r&&!s)if((ia(e)!=="body"||Gu(i))&&(l=vf(e)),r){const m=sa(e,!0,s,e);u.x=m.x+e.clientLeft,u.y=m.y+e.clientTop}else i&&(u.x=S1(i));const c=i&&!r&&!s?x6(i,l):Fo(0),f=a.left+l.scrollLeft-u.x-c.x,p=a.top+l.scrollTop-u.y-c.y;return{x:f,y:p,width:a.width,height:a.height}}function _1(t){return fo(t).position==="static"}function k6(t,e){if(!Ho(t)||fo(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return $o(t)===n&&(n=n.ownerDocument.body),n}function S6(t,e){const n=Er(t);if(bf(t))return n;if(!Ho(t)){let i=ns(t);for(;i&&!bl(i);){if(co(i)&&!_1(i))return i;i=ns(i)}return n}let r=k6(t,e);for(;r&&$R(r)&&_1(r);)r=k6(r,e);return r&&bl(r)&&_1(r)&&!x1(r)?n:r||HR(t)||n}const QR=async function(t){const e=this.getOffsetParent||S6,n=this.getDimensions,r=await n(t.floating);return{reference:ZR(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function NR(t){return fo(t).direction==="rtl"}const eL={convertOffsetParentRelativeRectToViewportRelativeRect:WR,getDocumentElement:$o,getClippingRect:YR,getOffsetParent:S6,getElementRects:QR,getClientRects:jR,getDimensions:JR,getScale:vl,isElement:co,isRTL:NR};function _6(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function tL(t,e){let n=null,r;const i=$o(t);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),s();const c=t.getBoundingClientRect(),{left:f,top:p,width:m,height:g}=c;if(l||e(),!m||!g)return;const b=pf(p),v=pf(i.clientWidth-(f+m)),y=pf(i.clientHeight-(p+g)),x=pf(f),k={rootMargin:-b+"px "+-v+"px "+-y+"px "+-x+"px",threshold:Cr(0,es(1,u))||1};let C=!0;function _(T){const A=T[0].intersectionRatio;if(A!==u){if(!C)return a();A?a(!1,A):r=setTimeout(()=>{a(!1,1e-7)},1e3)}A===1&&!_6(c,t.getBoundingClientRect())&&a(),C=!1}try{n=new IntersectionObserver(_,{...k,root:i.ownerDocument})}catch{n=new IntersectionObserver(_,k)}n.observe(t)}return a(!0),s}function nL(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,c=k1(t),f=i||s?[...c?Xu(c):[],...Xu(e)]:[];f.forEach(x=>{i&&x.addEventListener("scroll",n,{passive:!0}),s&&x.addEventListener("resize",n)});const p=c&&l?tL(c,n):null;let m=-1,g=null;a&&(g=new ResizeObserver(x=>{let[E]=x;E&&E.target===c&&g&&(g.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var k;(k=g)==null||k.observe(e)})),n()}),c&&!u&&g.observe(c),g.observe(e));let b,v=u?sa(t):null;u&&y();function y(){const x=sa(t);v&&!_6(v,x)&&n(),v=x,b=requestAnimationFrame(y)}return n(),()=>{var x;f.forEach(E=>{i&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),p==null||p(),(x=g)==null||x.disconnect(),g=null,u&&cancelAnimationFrame(b)}}const rL=DR,oL=PR,T6=IR,iL=FR,sL=RR,aL=BR,lL=VR,uL=(t,e,n)=>{const r=new Map,i={platform:eL,...n},s={...i.platform,_c:r};return OR(t,e,{...i,platform:s})};function cL(t){return t!=null&&typeof t=="object"&&"$el"in t}function T1(t){if(cL(t)){const e=t.$el;return w1(e)&&ia(e)==="#comment"?null:e}return t}function yl(t){return typeof t=="function"?t():o.unref(t)}function dL(t){return{name:"arrow",options:t,fn(e){const n=T1(yl(t.element));return n==null?{}:aL({element:n,padding:t.padding}).fn(e)}}}function A6(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function M6(t,e){const n=A6(t);return Math.round(e*n)/n}function fL(t,e,n){n===void 0&&(n={});const r=n.whileElementsMounted,i=o.computed(()=>{var A;return(A=yl(n.open))!=null?A:!0}),s=o.computed(()=>yl(n.middleware)),a=o.computed(()=>{var A;return(A=yl(n.placement))!=null?A:"bottom"}),l=o.computed(()=>{var A;return(A=yl(n.strategy))!=null?A:"absolute"}),u=o.computed(()=>{var A;return(A=yl(n.transform))!=null?A:!0}),c=o.computed(()=>T1(t.value)),f=o.computed(()=>T1(e.value)),p=o.ref(0),m=o.ref(0),g=o.ref(l.value),b=o.ref(a.value),v=o.shallowRef({}),y=o.ref(!1),x=o.computed(()=>{const A={position:g.value,left:"0",top:"0"};if(!f.value)return A;const D=M6(f.value,p.value),O=M6(f.value,m.value);return u.value?{...A,transform:"translate("+D+"px, "+O+"px)",...A6(f.value)>=1.5&&{willChange:"transform"}}:{position:g.value,left:D+"px",top:O+"px"}});let E;function k(){if(c.value==null||f.value==null)return;const A=i.value;uL(c.value,f.value,{middleware:s.value,placement:a.value,strategy:l.value}).then(D=>{p.value=D.x,m.value=D.y,g.value=D.strategy,b.value=D.placement,v.value=D.middlewareData,y.value=A!==!1})}function C(){typeof E=="function"&&(E(),E=void 0)}function _(){if(C(),r===void 0){k();return}if(c.value!=null&&f.value!=null){E=r(c.value,f.value,k);return}}function T(){i.value||(y.value=!1)}return o.watch([s,a,l,i],k,{flush:"sync"}),o.watch([c,f],_,{flush:"sync"}),o.watch(i,T,{flush:"sync"}),o.getCurrentScope()&&o.onScopeDispose(C),{x:o.shallowReadonly(p),y:o.shallowReadonly(m),strategy:o.shallowReadonly(g),placement:o.shallowReadonly(b),middlewareData:o.shallowReadonly(v),isPositioned:o.shallowReadonly(y),floatingStyles:x,update:k}}function Ht(t,e){const n=typeof t=="string"&&!e?`${t}Context`:e,r=Symbol(n);return[i=>{const s=o.inject(r,i);if(s||s===null)return s;throw new Error(`Injection \`${r.toString()}\` not found. Component must be used within ${Array.isArray(t)?`one of the following components: ${t.join(", ")}`:`\`${t}\``}`)},i=>(o.provide(r,i),i)]}function O6(t,e,n){const r=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&r.addEventListener(t,e,{once:!0}),r.dispatchEvent(i)}function A1(t,e=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY){return Math.min(n,Math.max(e,t))}function pL(t){return t==null}function hL(t,e){var n;const r=o.shallowRef();return o.watchEffect(()=>{r.value=t()},{...e,flush:(n=void 0)!=null?n:"sync"}),o.readonly(r)}function wl(t){return o.getCurrentScope()?(o.onScopeDispose(t),!0):!1}function mL(){const t=new Set,e=n=>{t.delete(n)};return{on:n=>{t.add(n);const r=()=>e(n);return wl(r),{off:r}},off:e,trigger:(...n)=>Promise.all(Array.from(t).map(r=>r(...n)))}}function gL(t){let e=!1,n;const r=o.effectScope(!0);return(...i)=>(e||(n=r.run(()=>t(...i)),e=!0),n)}function B6(t){let e=0,n,r;const i=()=>{e-=1,r&&e<=0&&(r.stop(),n=void 0,r=void 0)};return(...s)=>(e+=1,n||(r=o.effectScope(!0),n=r.run(()=>t(...s))),wl(i),n)}function zo(t){return typeof t=="function"?t():o.unref(t)}const pi=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const bL=t=>typeof t<"u",vL=Object.prototype.toString,yL=t=>vL.call(t)==="[object Object]",M1=()=>{},I6=wL();function wL(){var t,e;return pi&&((t=window==null?void 0:window.navigator)==null?void 0:t.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((e=window==null?void 0:window.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function xL(t,e){function n(...r){return new Promise((i,s)=>{Promise.resolve(t(()=>e.apply(this,r),{fn:e,thisArg:this,args:r})).then(i).catch(s)})}return n}function CL(t,e={}){let n,r,i=M1;const s=a=>{clearTimeout(a),i(),i=M1};return a=>{const l=zo(t),u=zo(e.maxWait);return n&&s(n),l<=0||u!==void 0&&u<=0?(r&&(s(r),r=null),Promise.resolve(a())):new Promise((c,f)=>{i=e.rejectOnCancel?f:c,u&&!r&&(r=setTimeout(()=>{n&&s(n),r=null,c(a())},u)),n=setTimeout(()=>{r&&s(r),r=null,c(a())},l)})}}function EL(t){return o.getCurrentInstance()}function R6(t,e=1e4){return o.customRef((n,r)=>{let i=zo(t),s;const a=()=>setTimeout(()=>{i=zo(t),r()},zo(e));return wl(()=>{clearTimeout(s)}),{get(){return n(),i},set(l){i=l,r(),clearTimeout(s),s=a()}}})}function L6(t,e=200,n={}){return xL(CL(e,n),t)}function kL(t,e){EL()&&o.onBeforeUnmount(t,e)}function D6(t,e,n={}){const{immediate:r=!0}=n,i=o.ref(!1);let s=null;function a(){s&&(clearTimeout(s),s=null)}function l(){i.value=!1,a()}function u(...c){a(),i.value=!0,s=setTimeout(()=>{i.value=!1,s=null,t(...c)},zo(e))}return r&&(i.value=!0,pi&&u()),wl(l),{isPending:o.readonly(i),start:u,stop:l}}function SL(t,e,n){const r=o.watch(t,(...i)=>(o.nextTick(()=>r()),e(...i)),n);return r}function po(t){var e;const n=zo(t);return(e=n==null?void 0:n.$el)!=null?e:n}const yf=pi?window:void 0;function xl(...t){let e,n,r,i;if(typeof t[0]=="string"||Array.isArray(t[0])?([n,r,i]=t,e=yf):[e,n,r,i]=t,!e)return M1;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const s=[],a=()=>{s.forEach(f=>f()),s.length=0},l=(f,p,m,g)=>(f.addEventListener(p,m,g),()=>f.removeEventListener(p,m,g)),u=o.watch(()=>[po(e),zo(i)],([f,p])=>{if(a(),!f)return;const m=yL(p)?{...p}:p;s.push(...n.flatMap(g=>r.map(b=>l(f,g,b,m))))},{immediate:!0,flush:"post"}),c=()=>{u(),a()};return wl(c),c}function _L(t){return typeof t=="function"?t:typeof t=="string"?e=>e.key===t:Array.isArray(t)?e=>t.includes(e.key):()=>!0}function TL(...t){let e,n,r={};t.length===3?(e=t[0],n=t[1],r=t[2]):t.length===2?typeof t[1]=="object"?(e=!0,n=t[0],r=t[1]):(e=t[0],n=t[1]):(e=!0,n=t[0]);const{target:i=yf,eventName:s="keydown",passive:a=!1,dedupe:l=!1}=r,u=_L(e);return xl(i,s,c=>{c.repeat&&zo(l)||u(c)&&n(c)},a)}function P6(){const t=o.ref(!1),e=o.getCurrentInstance();return e&&o.onMounted(()=>{t.value=!0},e),t}function AL(t){const e=P6();return o.computed(()=>(e.value,!!t()))}function ML(t){return JSON.parse(JSON.stringify(t))}function Cl(t,e,n={}){const{window:r=yf,...i}=n;let s;const a=AL(()=>r&&"ResizeObserver"in r),l=()=>{s&&(s.disconnect(),s=void 0)},u=o.computed(()=>Array.isArray(t)?t.map(p=>po(p)):[po(t)]),c=o.watch(u,p=>{if(l(),a.value&&r){s=new ResizeObserver(e);for(const m of p)m&&s.observe(m,i)}},{immediate:!0,flush:"post"}),f=()=>{l(),c()};return wl(f),{isSupported:a,stop:f}}function kr(t,e,n,r={}){var i,s,a;const{clone:l=!1,passive:u=!1,eventName:c,deep:f=!1,defaultValue:p,shouldEmit:m}=r,g=o.getCurrentInstance(),b=n||(g==null?void 0:g.emit)||((i=g==null?void 0:g.$emit)==null?void 0:i.bind(g))||((a=(s=g==null?void 0:g.proxy)==null?void 0:s.$emit)==null?void 0:a.bind(g==null?void 0:g.proxy));let v=c;e||(e="modelValue"),v=v||`update:${e.toString()}`;const y=k=>l?typeof l=="function"?l(k):ML(k):k,x=()=>bL(t[e])?y(t[e]):p,E=k=>{m?m(k)&&b(v,k):b(v,k)};if(u){const k=x(),C=o.ref(k);let _=!1;return o.watch(()=>t[e],T=>{_||(_=!0,C.value=y(T),o.nextTick(()=>_=!1))}),o.watch(C,T=>{!_&&(T!==t[e]||f)&&E(T)},{deep:f}),C}else return o.computed({get(){return x()},set(k){E(k)}})}function wf(t){return t?t.flatMap(e=>e.type===o.Fragment?wf(e.children):[e]):[]}function Un(){let t=document.activeElement;if(t==null)return null;for(;t!=null&&t.shadowRoot!=null&&t.shadowRoot.activeElement!=null;)t=t.shadowRoot.activeElement;return t}const OL=["INPUT","TEXTAREA"];function BL(t,e,n,r={}){if(!e||r.enableIgnoredElement&&OL.includes(e.nodeName))return null;const{arrowKeyOptions:i="both",attributeName:s="[data-radix-vue-collection-item]",itemsArray:a=[],loop:l=!0,dir:u="ltr",preventScroll:c=!0,focus:f=!1}=r,[p,m,g,b,v,y]=[t.key==="ArrowRight",t.key==="ArrowLeft",t.key==="ArrowUp",t.key==="ArrowDown",t.key==="Home",t.key==="End"],x=g||b,E=p||m;if(!v&&!y&&(!x&&!E||i==="vertical"&&E||i==="horizontal"&&x))return null;const k=n?Array.from(n.querySelectorAll(s)):a;if(!k.length)return null;c&&t.preventDefault();let C=null;return E||x?C=V6(k,e,{goForward:x?b:u==="ltr"?p:m,loop:l}):v?C=k.at(0)||null:y&&(C=k.at(-1)||null),f&&(C==null||C.focus()),C}function V6(t,e,n,r=t.length){if(--r===0)return null;const i=t.indexOf(e),s=n.goForward?i+1:i-1;if(!n.loop&&(s<0||s>=t.length))return null;const a=(s+t.length)%t.length,l=t[a];return l?l.hasAttribute("disabled")&&l.getAttribute("disabled")!=="false"?V6(t,l,n,r):l:null}function O1(t){if(t===null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.iterator in t?!1:Symbol.toStringTag in t?Object.prototype.toString.call(t)==="[object Module]":!0}function B1(t,e,n=".",r){if(!O1(e))return B1(t,{},n);const i=Object.assign({},e);for(const s in t){if(s==="__proto__"||s==="constructor")continue;const a=t[s];a!=null&&(Array.isArray(a)&&Array.isArray(i[s])?i[s]=[...a,...i[s]]:O1(a)&&O1(i[s])?i[s]=B1(a,i[s],(n?`${n}.`:"")+s.toString()):i[s]=a)}return i}function IL(t){return(...e)=>e.reduce((n,r)=>B1(n,r,""),{})}const RL=IL(),[xf,hce]=Ht("ConfigProvider");let LL="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",DL=(t=21)=>{let e="",n=t;for(;n--;)e+=LL[Math.random()*64|0];return e};const PL=B6(()=>{const t=o.ref(new Map),e=o.ref(),n=o.computed(()=>{for(const a of t.value.values())if(a)return!0;return!1}),r=xf({scrollBody:o.ref(!0)});let i=null;const s=()=>{document.body.style.paddingRight="",document.body.style.marginRight="",document.body.style.pointerEvents="",document.body.style.removeProperty("--scrollbar-width"),document.body.style.overflow=e.value??"",I6&&(i==null||i()),e.value=void 0};return o.watch(n,(a,l)=>{var u;if(!pi)return;if(!a){l&&s();return}e.value===void 0&&(e.value=document.body.style.overflow);const c=window.innerWidth-document.documentElement.clientWidth,f={padding:c,margin:0},p=(u=r.scrollBody)!=null&&u.value?typeof r.scrollBody.value=="object"?RL({padding:r.scrollBody.value.padding===!0?c:r.scrollBody.value.padding,margin:r.scrollBody.value.margin===!0?c:r.scrollBody.value.margin},f):f:{padding:0,margin:0};c>0&&(document.body.style.paddingRight=typeof p.padding=="number"?`${p.padding}px`:String(p.padding),document.body.style.marginRight=typeof p.margin=="number"?`${p.margin}px`:String(p.margin),document.body.style.setProperty("--scrollbar-width",`${c}px`),document.body.style.overflow="hidden"),I6&&(i=xl(document,"touchmove",m=>VL(m),{passive:!1})),o.nextTick(()=>{document.body.style.pointerEvents="none",document.body.style.overflow="hidden"})},{immediate:!0,flush:"sync"}),t});function Cf(t){const e=DL(6),n=PL();n.value.set(e,t??!1);const r=o.computed({get:()=>n.value.get(e)??!1,set:i=>n.value.set(e,i)});return kL(()=>{n.value.delete(e)}),r}function F6(t){const e=window.getComputedStyle(t);if(e.overflowX==="scroll"||e.overflowY==="scroll"||e.overflowX==="auto"&&t.clientWidth<t.scrollWidth||e.overflowY==="auto"&&t.clientHeight<t.scrollHeight)return!0;{const n=t.parentNode;return!(n instanceof Element)||n.tagName==="BODY"?!1:F6(n)}}function VL(t){const e=t||window.event,n=e.target;return n instanceof Element&&F6(n)?!1:e.touches.length>1?!0:(e.preventDefault&&e.cancelable&&e.preventDefault(),!1)}const FL="data-radix-vue-collection-item";function Yu(t,e=FL){const n=Symbol();return{createCollection:r=>{const i=o.ref([]);function s(){const a=po(r);return a?i.value=Array.from(a.querySelectorAll(`[${e}]:not([data-disabled])`)):i.value=[]}return o.onBeforeUpdate(()=>{i.value=[]}),o.onMounted(s),o.onUpdated(s),o.watch(()=>r==null?void 0:r.value,s,{immediate:!0}),o.provide(n,i),i},injectCollection:()=>o.inject(n,o.ref([]))}}function aa(t){const e=xf({dir:o.ref("ltr")});return o.computed(()=>{var n;return(t==null?void 0:t.value)||((n=e.dir)==null?void 0:n.value)||"ltr"})}function la(t){const e=o.getCurrentInstance(),n=e==null?void 0:e.type.emits,r={};return n!=null&&n.length||console.warn(`No emitted event found. Please check component: ${e==null?void 0:e.type.__name}`),n==null||n.forEach(i=>{r[o.toHandlerKey(o.camelize(i))]=(...s)=>t(i,...s)}),r}let I1=0;function R1(){o.watchEffect(t=>{if(!pi)return;const e=document.querySelectorAll("[data-radix-focus-guard]");document.body.insertAdjacentElement("afterbegin",e[0]??$6()),document.body.insertAdjacentElement("beforeend",e[1]??$6()),I1++,t(()=>{I1===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),I1--})})}function $6(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}function L1(t){return o.computed(()=>{var e;return zo(t)?!!((e=po(t))!=null&&e.closest("form")):!0})}function Nn(t){const e=o.getCurrentInstance(),n=Object.keys((e==null?void 0:e.type.props)??{}).reduce((i,s)=>{const a=(e==null?void 0:e.type.props[s]).default;return a!==void 0&&(i[s]=a),i},{}),r=o.toRef(t);return o.computed(()=>{const i={},s=(e==null?void 0:e.vnode.props)??{};return Object.keys(s).forEach(a=>{i[o.camelize(a)]=s[a]}),Object.keys({...n,...i}).reduce((a,l)=>(r.value[l]!==void 0&&(a[l]=r.value[l]),a),{})})}function Dt(t,e){const n=Nn(t),r=e?la(e):{};return o.computed(()=>({...n.value,...r}))}function De(){const t=o.getCurrentInstance(),e=o.ref(),n=o.computed(()=>{var a,l;return["#text","#comment"].includes((a=e.value)==null?void 0:a.$el.nodeName)?(l=e.value)==null?void 0:l.$el.nextElementSibling:po(e)}),r=Object.assign({},t.exposed),i={};for(const a in t.props)Object.defineProperty(i,a,{enumerable:!0,configurable:!0,get:()=>t.props[a]});if(Object.keys(r).length>0)for(const a in r)Object.defineProperty(i,a,{enumerable:!0,configurable:!0,get:()=>r[a]});Object.defineProperty(i,"$el",{enumerable:!0,configurable:!0,get:()=>t.vnode.el}),t.exposed=i;function s(a){e.value=a,a&&(Object.defineProperty(i,"$el",{enumerable:!0,configurable:!0,get:()=>a instanceof Element?a:a.$el}),t.exposed=i)}return{forwardRef:s,currentRef:e,currentElement:n}}function $L(t,e){const n=R6(!1,300),r=o.ref(null),i=mL();function s(){r.value=null,n.value=!1}function a(l,u){const c=l.currentTarget,f={x:l.clientX,y:l.clientY},p=HL(f,c.getBoundingClientRect()),m=zL(f,p),g=UL(u.getBoundingClientRect()),b=jL([...m,...g]);r.value=b,n.value=!0}return o.watchEffect(l=>{if(t.value&&e.value){const u=f=>a(f,e.value),c=f=>a(f,t.value);t.value.addEventListener("pointerleave",u),e.value.addEventListener("pointerleave",c),l(()=>{var f,p;(f=t.value)==null||f.removeEventListener("pointerleave",u),(p=e.value)==null||p.removeEventListener("pointerleave",c)})}}),o.watchEffect(l=>{var u;if(r.value){const c=f=>{var p,m;if(!r.value)return;const g=f.target,b={x:f.clientX,y:f.clientY},v=((p=t.value)==null?void 0:p.contains(g))||((m=e.value)==null?void 0:m.contains(g)),y=!WL(b,r.value),x=!!g.closest("[data-grace-area-trigger]");v?s():(y||x)&&(s(),i.trigger())};(u=t.value)==null||u.ownerDocument.addEventListener("pointermove",c),l(()=>{var f;return(f=t.value)==null?void 0:f.ownerDocument.removeEventListener("pointermove",c)})}}),{isPointerInTransit:n,onPointerExit:i.on}}function HL(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),s=Math.abs(e.left-t.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function zL(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function UL(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function WL(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,a=e.length-1;s<e.length;a=s++){const l=e[s].x,u=e[s].y,c=e[a].x,f=e[a].y;u>r!=f>r&&n<(c-l)*(r-u)/(f-u)+l&&(i=!i)}return i}function jL(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),qL(e)}function qL(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const i=t[r];for(;e.length>=2;){const s=e[e.length-1],a=e[e.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var KL=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},El=new WeakMap,Ef=new WeakMap,kf={},D1=0,H6=function(t){return t&&(t.host||H6(t.parentNode))},GL=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=H6(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},XL=function(t,e,n,r){var i=GL(e,Array.isArray(t)?t:[t]);kf[n]||(kf[n]=new WeakMap);var s=kf[n],a=[],l=new Set,u=new Set(i),c=function(p){!p||l.has(p)||(l.add(p),c(p.parentNode))};i.forEach(c);var f=function(p){!p||u.has(p)||Array.prototype.forEach.call(p.children,function(m){if(l.has(m))f(m);else try{var g=m.getAttribute(r),b=g!==null&&g!=="false",v=(El.get(m)||0)+1,y=(s.get(m)||0)+1;El.set(m,v),s.set(m,y),a.push(m),v===1&&b&&Ef.set(m,!0),y===1&&m.setAttribute(n,"true"),b||m.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",m,x)}})};return f(e),l.clear(),D1++,function(){a.forEach(function(p){var m=El.get(p)-1,g=s.get(p)-1;El.set(p,m),s.set(p,g),m||(Ef.has(p)||p.removeAttribute(r),Ef.delete(p)),g||p.removeAttribute(n)}),D1--,D1||(El=new WeakMap,El=new WeakMap,Ef=new WeakMap,kf={})}},YL=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=KL(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),XL(r,i,n,"aria-hidden")):function(){return null}};function Sf(t){let e;o.watch(()=>po(t),n=>{n?e=YL(n):e&&e()}),o.onUnmounted(()=>{e&&e()})}let JL=0;function Wr(t,e="radix"){const n=xf({useId:void 0});return ay.useId?`${e}-${ay.useId()}`:n.useId?`${e}-${n.useId()}`:`${e}-${++JL}`}function ZL(t){const e=o.ref(),n=o.computed(()=>{var i;return((i=e.value)==null?void 0:i.width)??0}),r=o.computed(()=>{var i;return((i=e.value)==null?void 0:i.height)??0});return o.onMounted(()=>{const i=po(t);if(i){e.value={width:i.offsetWidth,height:i.offsetHeight};const s=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const l=a[0];let u,c;if("borderBoxSize"in l){const f=l.borderBoxSize,p=Array.isArray(f)?f[0]:f;u=p.inlineSize,c=p.blockSize}else u=i.offsetWidth,c=i.offsetHeight;e.value={width:u,height:c}});return s.observe(i,{box:"border-box"}),()=>s.unobserve(i)}else e.value=void 0}),{width:n,height:r}}function z6(t,e){const n=o.ref(t);function r(i){return e[n.value][i]??n.value}return{state:n,dispatch:i=>{n.value=r(i)}}}const QL="data-item-text";function P1(t){const e=R6("",1e3);return{search:e,handleTypeaheadSearch:(n,r)=>{if(!(t!=null&&t.value)&&!r)return;e.value=e.value+n;const i=(t==null?void 0:t.value)??r,s=Un(),a=i.map(p=>{var m;return{ref:p,textValue:((m=(p.querySelector(`[${QL}]`)??p).textContent)==null?void 0:m.trim())??""}}),l=a.find(p=>p.ref===s),u=a.map(p=>p.textValue),c=eD(u,e.value,l==null?void 0:l.textValue),f=a.find(p=>p.textValue===c);return f&&f.ref.focus(),f==null?void 0:f.ref},resetTypeahead:()=>{e.value=""}}}function NL(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function eD(t,e,n){const r=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let s=NL(t,Math.max(i,0));r.length===1&&(s=s.filter(l=>l!==n));const a=s.find(l=>l.toLowerCase().startsWith(r.toLowerCase()));return a!==n?a:void 0}const V1=o.defineComponent({name:"PrimitiveSlot",inheritAttrs:!1,setup(t,{attrs:e,slots:n}){return()=>{var r,i;if(!n.default)return null;const s=wf(n.default()),a=s.findIndex(f=>f.type!==o.Comment);if(a===-1)return s;const l=s[a];(r=l.props)==null||delete r.ref;const u=l.props?o.mergeProps(e,l.props):e;e.class&&(i=l.props)!=null&&i.class&&delete l.props.class;const c=o.cloneVNode(l,u);for(const f in u)f.startsWith("on")&&(c.props||(c.props={}),c.props[f]=u[f]);return s.length===1?c:(s[a]=c,s)}}}),Je=o.defineComponent({name:"Primitive",inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:"div"}},setup(t,{attrs:e,slots:n}){const r=t.asChild?"template":t.as;return typeof r=="string"&&["area","img","input"].includes(r)?()=>o.h(r,e):r!=="template"?()=>o.h(t.as,e,{default:n.default}):()=>o.h(V1,e,{default:n.default})}});function U6(){const t=o.ref(),e=o.computed(()=>{var n,r;return["#text","#comment"].includes((n=t.value)==null?void 0:n.$el.nodeName)?(r=t.value)==null?void 0:r.$el.nextElementSibling:po(t)});return{primitiveElement:t,currentElement:e}}function tD(t,e){var n;const r=o.ref({}),i=o.ref("none"),s=o.ref(t),a=t.value?"mounted":"unmounted";let l;const u=((n=e.value)==null?void 0:n.ownerDocument.defaultView)??yf,{state:c,dispatch:f}=z6(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}}),p=y=>{var x;if(pi){const E=new CustomEvent(y,{bubbles:!1,cancelable:!1});(x=e.value)==null||x.dispatchEvent(E)}};o.watch(t,async(y,x)=>{var E;const k=x!==y;if(await o.nextTick(),k){const C=i.value,_=_f(e.value);y?(f("MOUNT"),p("enter"),_==="none"&&p("after-enter")):_==="none"||((E=r.value)==null?void 0:E.display)==="none"?(f("UNMOUNT"),p("leave"),p("after-leave")):x&&C!==_?(f("ANIMATION_OUT"),p("leave")):(f("UNMOUNT"),p("after-leave"))}},{immediate:!0});const m=y=>{const x=_f(e.value),E=x.includes(y.animationName),k=c.value==="mounted"?"enter":"leave";if(y.target===e.value&&E&&(p(`after-${k}`),f("ANIMATION_END"),!s.value)){const C=e.value.style.animationFillMode;e.value.style.animationFillMode="forwards",l=u==null?void 0:u.setTimeout(()=>{var _;((_=e.value)==null?void 0:_.style.animationFillMode)==="forwards"&&(e.value.style.animationFillMode=C)})}y.target===e.value&&x==="none"&&f("ANIMATION_END")},g=y=>{y.target===e.value&&(i.value=_f(e.value))},b=o.watch(e,(y,x)=>{y?(r.value=getComputedStyle(y),y.addEventListener("animationstart",g),y.addEventListener("animationcancel",m),y.addEventListener("animationend",m)):(f("ANIMATION_END"),l!==void 0&&(u==null||u.clearTimeout(l)),x==null||x.removeEventListener("animationstart",g),x==null||x.removeEventListener("animationcancel",m),x==null||x.removeEventListener("animationend",m))},{immediate:!0}),v=o.watch(c,()=>{const y=_f(e.value);i.value=c.value==="mounted"?y:"none"});return o.onUnmounted(()=>{b(),v()}),{isPresent:o.computed(()=>["mounted","unmountSuspended"].includes(c.value))}}function _f(t){return t&&getComputedStyle(t).animationName||"none"}const jr=o.defineComponent({name:"Presence",props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(t,{slots:e,expose:n}){var r;const{present:i,forceMount:s}=o.toRefs(t),a=o.ref(),{isPresent:l}=tD(i,a);n({present:l});let u=e.default({present:l});u=wf(u||[]);const c=o.getCurrentInstance();if(u&&(u==null?void 0:u.length)>1){const f=(r=c==null?void 0:c.parent)!=null&&r.type.name?`<${c.parent.type.name} />`:"component";throw new Error([`Detected an invalid children for \`${f}\` for \`Presence\` component.`,"","Note: Presence works similarly to `v-if` directly, but it waits for animation/transition to finished before unmounting. So it expect only one direct child of valid VNode type.","You can apply a few solutions:",["Provide a single child element so that `presence` directive attach correctly.","Ensure the first child is an actual element instead of a raw text node or comment node."].map(p=>` - ${p}`).join(`
135
+ }`;var gt=U9(function(){return Mt(P,Ue+"return "+xe).apply(n,U)});if(gt.source=xe,K2(gt))throw gt;return gt}function aue(d){return It(d).toLowerCase()}function lue(d){return It(d).toUpperCase()}function uue(d,h,w){if(d=It(d),d&&(w||h===n))return ZS(d);if(!d||!(h=Br(h)))return d;var S=So(d),B=So(h),P=QS(S,B),U=NS(S,B)+1;return Vs(S,P,U).join("")}function cue(d,h,w){if(d=It(d),d&&(w||h===n))return d.slice(0,t_(d)+1);if(!d||!(h=Br(h)))return d;var S=So(d),B=NS(S,So(h))+1;return Vs(S,0,B).join("")}function due(d,h,w){if(d=It(d),d&&(w||h===n))return d.replace(Kv,"");if(!d||!(h=Br(h)))return d;var S=So(d),B=QS(S,So(h));return Vs(S,B).join("")}function fue(d,h){var w=M,S=$;if(nn(h)){var B="separator"in h?h.separator:B;w="length"in h?ft(h.length):w,S="omission"in h?Br(h.omission):S}d=It(d);var P=d.length;if(eu(d)){var U=So(d);P=U.length}if(w>=P)return d;var K=w-tu(S);if(K<1)return S;var Z=U?Vs(U,0,K).join(""):d.slice(0,K);if(B===n)return Z+S;if(U&&(K+=Z.length-K),G2(B)){if(d.slice(K).search(B)){var ve,ye=Z;for(B.global||(B=u2(B.source,It(yS.exec(B))+"g")),B.lastIndex=0;ve=B.exec(ye);)var xe=ve.index;Z=Z.slice(0,xe===n?K:xe)}}else if(d.indexOf(Br(B),K)!=K){var Re=Z.lastIndexOf(B);Re>-1&&(Z=Z.slice(0,Re))}return Z+S}function pue(d){return d=It(d),d&&An.test(d)?d.replace(fn,Ure):d}var hue=lu(function(d,h,w){return d+(w?" ":"")+h.toUpperCase()}),J2=W_("toUpperCase");function z9(d,h,w){return d=It(d),h=w?n:h,h===n?Vre(d)?qre(d):Are(d):d.match(h)||[]}var U9=bt(function(d,h){try{return Mr(d,n,h)}catch(w){return K2(w)?w:new it(w)}}),mue=Oi(function(d,h){return Nr(h,function(w){w=ei(w),Ai(d,w,j2(d[w],d))}),d});function gue(d){var h=d==null?0:d.length,w=Ye();return d=h?Qt(d,function(S){if(typeof S[1]!="function")throw new eo(a);return[w(S[0]),S[1]]}):[],bt(function(S){for(var B=-1;++B<h;){var P=d[B];if(Mr(P[0],this,S))return Mr(P[1],this,S)}})}function bue(d){return Uoe(no(d,p))}function Z2(d){return function(){return d}}function vue(d,h){return d==null||d!==d?h:d}var yue=q_(),wue=q_(!0);function br(d){return d}function Q2(d){return x_(typeof d=="function"?d:no(d,p))}function xue(d){return E_(no(d,p))}function Cue(d,h){return k_(d,no(h,p))}var Eue=bt(function(d,h){return function(w){return rd(w,d,h)}}),kue=bt(function(d,h){return function(w){return rd(d,w,h)}});function N2(d,h,w){var S=Mn(h),B=lm(h,S);w==null&&!(nn(h)&&(B.length||!S.length))&&(w=h,h=d,d=this,B=lm(h,Mn(h)));var P=!(nn(w)&&"chain"in w)||!!w.chain,U=Ii(d);return Nr(B,function(K){var Z=h[K];d[K]=Z,U&&(d.prototype[K]=function(){var ve=this.__chain__;if(P||ve){var ye=d(this.__wrapped__),xe=ye.__actions__=hr(this.__actions__);return xe.push({func:Z,args:arguments,thisArg:d}),ye.__chain__=ve,ye}return Z.apply(d,Bs([this.value()],arguments))})}),d}function Sue(){return Dn._===this&&(Dn._=Zre),this}function ey(){}function _ue(d){return d=ft(d),bt(function(h){return S_(h,d)})}var Tue=B2(Qt),Aue=B2(KS),Mue=B2(n2);function W9(d){return F2(d)?r2(ei(d)):iie(d)}function Oue(d){return function(h){return d==null?n:Ha(d,h)}}var Bue=G_(),Iue=G_(!0);function ty(){return[]}function ny(){return!1}function Rue(){return{}}function Lue(){return""}function Due(){return!0}function Pue(d,h){if(d=ft(d),d<1||d>H)return[];var w=X,S=Gn(d,X);h=Ye(h),d-=X;for(var B=s2(S,h);++w<d;)h(w);return B}function Vue(d){return lt(d)?Qt(d,ei):Ir(d)?[d]:hr(u9(It(d)))}function Fue(d){var h=++Yre;return It(d)+h}var $ue=hm(function(d,h){return d+h},0),Hue=I2("ceil"),zue=hm(function(d,h){return d/h},1),Uue=I2("floor");function Wue(d){return d&&d.length?am(d,br,b2):n}function jue(d,h){return d&&d.length?am(d,Ye(h,2),b2):n}function que(d){return YS(d,br)}function Kue(d,h){return YS(d,Ye(h,2))}function Gue(d){return d&&d.length?am(d,br,x2):n}function Xue(d,h){return d&&d.length?am(d,Ye(h,2),x2):n}var Yue=hm(function(d,h){return d*h},1),Jue=I2("round"),Zue=hm(function(d,h){return d-h},0);function Que(d){return d&&d.length?i2(d,br):0}function Nue(d,h){return d&&d.length?i2(d,Ye(h,2)):0}return I.after=xae,I.ary=w9,I.assign=lle,I.assignIn=L9,I.assignInWith=Tm,I.assignWith=ule,I.at=cle,I.before=x9,I.bind=j2,I.bindAll=mue,I.bindKey=C9,I.castArray=Rae,I.chain=b9,I.chunk=Uie,I.compact=Wie,I.concat=jie,I.cond=gue,I.conforms=bue,I.constant=Z2,I.countBy=Qse,I.create=dle,I.curry=E9,I.curryRight=k9,I.debounce=S9,I.defaults=fle,I.defaultsDeep=ple,I.defer=Cae,I.delay=Eae,I.difference=qie,I.differenceBy=Kie,I.differenceWith=Gie,I.drop=Xie,I.dropRight=Yie,I.dropRightWhile=Jie,I.dropWhile=Zie,I.fill=Qie,I.filter=eae,I.flatMap=rae,I.flatMapDeep=oae,I.flatMapDepth=iae,I.flatten=p9,I.flattenDeep=Nie,I.flattenDepth=ese,I.flip=kae,I.flow=yue,I.flowRight=wue,I.fromPairs=tse,I.functions=wle,I.functionsIn=xle,I.groupBy=sae,I.initial=rse,I.intersection=ose,I.intersectionBy=ise,I.intersectionWith=sse,I.invert=Ele,I.invertBy=kle,I.invokeMap=lae,I.iteratee=Q2,I.keyBy=uae,I.keys=Mn,I.keysIn=gr,I.map=xm,I.mapKeys=_le,I.mapValues=Tle,I.matches=xue,I.matchesProperty=Cue,I.memoize=Em,I.merge=Ale,I.mergeWith=D9,I.method=Eue,I.methodOf=kue,I.mixin=N2,I.negate=km,I.nthArg=_ue,I.omit=Mle,I.omitBy=Ole,I.once=Sae,I.orderBy=cae,I.over=Tue,I.overArgs=_ae,I.overEvery=Aue,I.overSome=Mue,I.partial=q2,I.partialRight=_9,I.partition=dae,I.pick=Ble,I.pickBy=P9,I.property=W9,I.propertyOf=Oue,I.pull=cse,I.pullAll=m9,I.pullAllBy=dse,I.pullAllWith=fse,I.pullAt=pse,I.range=Bue,I.rangeRight=Iue,I.rearg=Tae,I.reject=hae,I.remove=hse,I.rest=Aae,I.reverse=U2,I.sampleSize=gae,I.set=Rle,I.setWith=Lle,I.shuffle=bae,I.slice=mse,I.sortBy=wae,I.sortedUniq=Cse,I.sortedUniqBy=Ese,I.split=rue,I.spread=Mae,I.tail=kse,I.take=Sse,I.takeRight=_se,I.takeRightWhile=Tse,I.takeWhile=Ase,I.tap=Wse,I.throttle=Oae,I.thru=wm,I.toArray=B9,I.toPairs=V9,I.toPairsIn=F9,I.toPath=Vue,I.toPlainObject=R9,I.transform=Dle,I.unary=Bae,I.union=Mse,I.unionBy=Ose,I.unionWith=Bse,I.uniq=Ise,I.uniqBy=Rse,I.uniqWith=Lse,I.unset=Ple,I.unzip=W2,I.unzipWith=g9,I.update=Vle,I.updateWith=Fle,I.values=du,I.valuesIn=$le,I.without=Dse,I.words=z9,I.wrap=Iae,I.xor=Pse,I.xorBy=Vse,I.xorWith=Fse,I.zip=$se,I.zipObject=Hse,I.zipObjectDeep=zse,I.zipWith=Use,I.entries=V9,I.entriesIn=F9,I.extend=L9,I.extendWith=Tm,N2(I,I),I.add=$ue,I.attempt=U9,I.camelCase=Wle,I.capitalize=$9,I.ceil=Hue,I.clamp=Hle,I.clone=Lae,I.cloneDeep=Pae,I.cloneDeepWith=Vae,I.cloneWith=Dae,I.conformsTo=Fae,I.deburr=H9,I.defaultTo=vue,I.divide=zue,I.endsWith=jle,I.eq=To,I.escape=qle,I.escapeRegExp=Kle,I.every=Nse,I.find=tae,I.findIndex=d9,I.findKey=hle,I.findLast=nae,I.findLastIndex=f9,I.findLastKey=mle,I.floor=Uue,I.forEach=v9,I.forEachRight=y9,I.forIn=gle,I.forInRight=ble,I.forOwn=vle,I.forOwnRight=yle,I.get=X2,I.gt=$ae,I.gte=Hae,I.has=Cle,I.hasIn=Y2,I.head=h9,I.identity=br,I.includes=aae,I.indexOf=nse,I.inRange=zle,I.invoke=Sle,I.isArguments=Wa,I.isArray=lt,I.isArrayBuffer=zae,I.isArrayLike=mr,I.isArrayLikeObject=pn,I.isBoolean=Uae,I.isBuffer=Fs,I.isDate=Wae,I.isElement=jae,I.isEmpty=qae,I.isEqual=Kae,I.isEqualWith=Gae,I.isError=K2,I.isFinite=Xae,I.isFunction=Ii,I.isInteger=T9,I.isLength=Sm,I.isMap=A9,I.isMatch=Yae,I.isMatchWith=Jae,I.isNaN=Zae,I.isNative=Qae,I.isNil=ele,I.isNull=Nae,I.isNumber=M9,I.isObject=nn,I.isObjectLike=un,I.isPlainObject=ud,I.isRegExp=G2,I.isSafeInteger=tle,I.isSet=O9,I.isString=_m,I.isSymbol=Ir,I.isTypedArray=cu,I.isUndefined=nle,I.isWeakMap=rle,I.isWeakSet=ole,I.join=ase,I.kebabCase=Gle,I.last=oo,I.lastIndexOf=lse,I.lowerCase=Xle,I.lowerFirst=Yle,I.lt=ile,I.lte=sle,I.max=Wue,I.maxBy=jue,I.mean=que,I.meanBy=Kue,I.min=Gue,I.minBy=Xue,I.stubArray=ty,I.stubFalse=ny,I.stubObject=Rue,I.stubString=Lue,I.stubTrue=Due,I.multiply=Yue,I.nth=use,I.noConflict=Sue,I.noop=ey,I.now=Cm,I.pad=Jle,I.padEnd=Zle,I.padStart=Qle,I.parseInt=Nle,I.random=Ule,I.reduce=fae,I.reduceRight=pae,I.repeat=eue,I.replace=tue,I.result=Ile,I.round=Jue,I.runInContext=J,I.sample=mae,I.size=vae,I.snakeCase=nue,I.some=yae,I.sortedIndex=gse,I.sortedIndexBy=bse,I.sortedIndexOf=vse,I.sortedLastIndex=yse,I.sortedLastIndexBy=wse,I.sortedLastIndexOf=xse,I.startCase=oue,I.startsWith=iue,I.subtract=Zue,I.sum=Que,I.sumBy=Nue,I.template=sue,I.times=Pue,I.toFinite=Ri,I.toInteger=ft,I.toLength=I9,I.toLower=aue,I.toNumber=io,I.toSafeInteger=ale,I.toString=It,I.toUpper=lue,I.trim=uue,I.trimEnd=cue,I.trimStart=due,I.truncate=fue,I.unescape=pue,I.uniqueId=Fue,I.upperCase=hue,I.upperFirst=J2,I.each=v9,I.eachRight=y9,I.first=h9,N2(I,function(){var d={};return Qo(I,function(h,w){Rt.call(I.prototype,w)||(d[w]=h)}),d}(),{chain:!1}),I.VERSION=r,Nr(["bind","bindKey","curry","curryRight","partial","partialRight"],function(d){I[d].placeholder=I}),Nr(["drop","take"],function(d,h){wt.prototype[d]=function(w){w=w===n?1:En(ft(w),0);var S=this.__filtered__&&!h?new wt(this):this.clone();return S.__filtered__?S.__takeCount__=Gn(w,S.__takeCount__):S.__views__.push({size:Gn(w,X),type:d+(S.__dir__<0?"Right":"")}),S},wt.prototype[d+"Right"]=function(w){return this.reverse()[d](w).reverse()}}),Nr(["filter","map","takeWhile"],function(d,h){var w=h+1,S=w==ee||w==F;wt.prototype[d]=function(B){var P=this.clone();return P.__iteratees__.push({iteratee:Ye(B,3),type:w}),P.__filtered__=P.__filtered__||S,P}}),Nr(["head","last"],function(d,h){var w="take"+(h?"Right":"");wt.prototype[d]=function(){return this[w](1).value()[0]}}),Nr(["initial","tail"],function(d,h){var w="drop"+(h?"":"Right");wt.prototype[d]=function(){return this.__filtered__?new wt(this):this[w](1)}}),wt.prototype.compact=function(){return this.filter(br)},wt.prototype.find=function(d){return this.filter(d).head()},wt.prototype.findLast=function(d){return this.reverse().find(d)},wt.prototype.invokeMap=bt(function(d,h){return typeof d=="function"?new wt(this):this.map(function(w){return rd(w,d,h)})}),wt.prototype.reject=function(d){return this.filter(km(Ye(d)))},wt.prototype.slice=function(d,h){d=ft(d);var w=this;return w.__filtered__&&(d>0||h<0)?new wt(w):(d<0?w=w.takeRight(-d):d&&(w=w.drop(d)),h!==n&&(h=ft(h),w=h<0?w.dropRight(-h):w.take(h-d)),w)},wt.prototype.takeRightWhile=function(d){return this.reverse().takeWhile(d).reverse()},wt.prototype.toArray=function(){return this.take(X)},Qo(wt.prototype,function(d,h){var w=/^(?:filter|find|map|reject)|While$/.test(h),S=/^(?:head|last)$/.test(h),B=I[S?"take"+(h=="last"?"Right":""):h],P=S||/^find/.test(h);B&&(I.prototype[h]=function(){var U=this.__wrapped__,K=S?[1]:arguments,Z=U instanceof wt,ve=K[0],ye=Z||lt(U),xe=function(vt){var xt=B.apply(I,Bs([vt],K));return S&&Re?xt[0]:xt};ye&&w&&typeof ve=="function"&&ve.length!=1&&(Z=ye=!1);var Re=this.__chain__,Ue=!!this.__actions__.length,Ze=P&&!Re,gt=Z&&!Ue;if(!P&&ye){U=gt?U:new wt(this);var Qe=d.apply(U,K);return Qe.__actions__.push({func:wm,args:[xe],thisArg:n}),new to(Qe,Re)}return Ze&&gt?d.apply(this,K):(Qe=this.thru(xe),Ze?S?Qe.value()[0]:Qe.value():Qe)})}),Nr(["pop","push","shift","sort","splice","unshift"],function(d){var h=Kh[d],w=/^(?:push|sort|unshift)$/.test(d)?"tap":"thru",S=/^(?:pop|shift)$/.test(d);I.prototype[d]=function(){var B=arguments;if(S&&!this.__chain__){var P=this.value();return h.apply(lt(P)?P:[],B)}return this[w](function(U){return h.apply(lt(U)?U:[],B)})}}),Qo(wt.prototype,function(d,h){var w=I[h];if(w){var S=w.name+"";Rt.call(iu,S)||(iu[S]=[]),iu[S].push({name:h,func:w})}}),iu[pm(n,x).name]=[{name:"wrapper",func:n}],wt.prototype.clone=poe,wt.prototype.reverse=hoe,wt.prototype.value=moe,I.prototype.at=jse,I.prototype.chain=qse,I.prototype.commit=Kse,I.prototype.next=Gse,I.prototype.plant=Yse,I.prototype.reverse=Jse,I.prototype.toJSON=I.prototype.valueOf=I.prototype.value=Zse,I.prototype.first=I.prototype.head,Jc&&(I.prototype[Jc]=Xse),I},nu=Kre();Da?((Da.exports=nu)._=nu,Qv._=nu):Dn._=nu}).call(ml)}(uf,uf.exports);var kt=uf.exports;const rn=(t,e="px")=>{if(!t)return t;const n=d1(t)?String(t):t,r=parseFloat(n),i=n.match(/[a-zA-Z%]+$/),s=i?i[0]:e;return isNaN(r)?t:r+s};function iR(t,e,n){return t<e?e:t>n?n:t}const d1=t=>typeof t=="number",f1=t=>typeof t=="function";function p1(t,e){const{extensions:n=[]}=t.extensionManager??{};return!!n.find(i=>i.name===e)}function d6(t){return/\s/.test(t)}function f6(t,e){const n=[];let r=0;for(;r<t.length;){if(t.length-r<=e){n.push({text:t.substring(r),offset:r});break}let i=-1;for(let a=r+e;a>r;a--)if(d6(t[a])){i=a;break}let s;if(i>r)for(n.push({text:t.substring(r,i),offset:r}),s=i;s<t.length&&d6(t[s]);)s++;else s=r+e,n.push({text:t.substring(r,s),offset:r});r=s}return n.filter(i=>i.text.length>0)}const sR=t=>t?t.split(/\r?\n/).map(e=>`<p>${e.replace(/</g,"&lt;").replace(/>/g,"&gt;")}</p>`).join(""):"";function h1(t,e={}){const{removeNodes:n=[]}=e,r=t.getJSON();function i(f=[]){const p=[];for(const m of f){if(n.includes(m.type))continue;const g={...m};m.content&&(g.content=i(m.content)),p.push(g)}return p}const s={...r,content:i(r.content)},a=t.schema.nodeFromJSON(s),u=Pr.fromSchema(t.schema).serializeFragment(a.content),c=document.createElement("div");return c.appendChild(u),c.innerHTML}function cf(){const t=new c1;t.isNativeWebViewAvailable()&&t.sendToNative(s1.KEYBOARD_DISMISS)}let Ni=null;function aR(){if(Ni)return Ni;if(typeof document>"u")return null;const t=document.createElement("span");return t.style.position="absolute",t.style.left="-9999px",t.style.top="-9999px",t.style.whiteSpace="nowrap",t.style.visibility="hidden",document.body.appendChild(t),Ni=t,t}function df(t){var a;const e=o.ref(null),n=o.ref(null),r=()=>{const l=(t==null?void 0:t.minChars)??0;return typeof l=="number"?l:o.unref(l)??0},i=()=>{const l=(t==null?void 0:t.fontSize)??"";return typeof l=="string"?l:o.unref(l)??""};function s(){o.nextTick(()=>{const l=e.value;if(!l||typeof window>"u"||!(l instanceof Element))return;const u=aR();if(!u)return;const c=getComputedStyle(l);u.style.fontFamily=c.fontFamily||"",u.style.fontSize=i()||c.fontSize||"",u.style.fontWeight=c.fontWeight||"",u.style.letterSpacing=c.letterSpacing||"";const f=Math.max(1,r());u.textContent="가".repeat(f);const p=Math.ceil(u.getBoundingClientRect().width),m=k=>parseFloat(k)||0,g=m(c.paddingLeft),b=m(c.paddingRight),v=m(c.borderLeftWidth),y=m(c.borderRightWidth),x=g+b+v+y,E=l.offsetWidth-l.clientWidth-(v+y);n.value=p+x+E+4})}return o.onMounted(()=>{s(),typeof window<"u"&&window.addEventListener("resize",s)}),t!=null&&t.minChars&&typeof t.minChars.value<"u"&&o.watch(t.minChars,()=>{s()}),t!=null&&t.fontSize&&typeof t.fontSize.value<"u"&&o.watch(t.fontSize,()=>{s()}),(a=t==null?void 0:t.editor)==null||a.on("transaction",()=>{setTimeout(s,150)}),o.onBeforeUnmount(()=>{typeof window<"u"&&window.removeEventListener("resize",s),Ni&&Ni.parentNode&&(Ni.parentNode.removeChild(Ni),Ni=null)}),{contentInner:e,measuredMinWidth:n,measure:s}}const lR=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,uR=Lt.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",yt(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[u4({find:lR,type:this.type,getAttributes:t=>{const[,,e,n,r]=t;return{src:n,alt:e,title:r}}})]}}),cR=["src","alt"],dR={key:0,class:"image-resizer"},fR=["onMousedown","onTouchstart"],pR=o.defineComponent({__name:"ImageView",props:{...na,selected:{type:Boolean,required:!0}},setup(t){const e=t,n={TOP_LEFT:"tl",TOP_RIGHT:"tr",BOTTOM_LEFT:"bl",BOTTOM_RIGHT:"br"},r=o.inject("isMobile",!1),i=o.ref({width:o6,height:o6}),s=o.ref({width:0,height:0}),a=o.ref(!1),l=o.ref({x:0,y:0,w:0,h:0,dir:""}),u=o.computed(()=>{const{src:C,alt:_,width:T,height:A,flipX:D,flipY:O}=e.node.attrs,M=[];D&&M.push("rotateX(180deg)"),O&&M.push("rotateY(180deg)");const $=M.join(" ");return{src:C||void 0,alt:_||void 0,style:{width:d1(T)?`${T}px`:T,height:d1(A)?`${A}px`:A,transform:$||"none"}}});o.computed(()=>({width:o.unref(u).style.width==="100%"?"100%":void 0}));const c=o.ref(null),f=new ResizeObserver(C=>{for(const _ of C){const{width:T,height:A}=_.contentRect;s.value={width:T,height:A},e.updateAttributes({originWidth:T,originHeight:A})}});function p(){const{editor:C,getPos:_}=e;C.commands.setNodeSelection(_())}const m=kt.throttle(()=>{const{editor:C}=e;i.value.width=parseInt(getComputedStyle(C.view.dom).width,10)},i6);function g(C,_){C.preventDefault(),C.stopPropagation();let T=0,A=0;const D=document.querySelector(".image-resizer");if(D&&(D.style.borderColor="#3b82f6"),"touches"in C&&C.touches.length>0)T=C.touches[0].clientX,A=C.touches[0].clientY;else if("clientX"in C)T=C.clientX,A=C.clientY;else return;const{width:O,height:M}=o.unref(s),$=O/M;let V=Number(e.node.attrs.width)||O,G=Number(e.node.attrs.height)||Math.round(V/$);const ee=o.unref(i).width;V=Math.min(V>ee?ee:V,ee),G=Math.round(V/$),Object.assign(l.value,{x:T,y:A,w:V,h:G,dir:_}),a.value=!0,y()}const b=kt.throttle(C=>{if(!o.unref(a))return;let _=0;if("touches"in C&&C.touches.length>0)_=C.touches[0].clientX;else if("clientX"in C)_=C.clientX;else return;const{x:T,w:A,dir:D}=o.unref(l),O=(_-T)*(/l/.test(D)?-1:1),M=iR(A+O,XI,o.unref(i).width);e.updateAttributes({width:M})},i6),v=C=>{C.preventDefault(),C.stopPropagation();const _=document.querySelector(".image-resizer");_&&(_.style.borderColor=""),o.unref(a)&&(a.value=!1,Object.assign(l.value,{x:0,y:0,w:0,h:0,dir:""}),x(),p())};function y(){document.addEventListener("mousemove",b,!0),document.addEventListener("mouseup",v,!0),document.addEventListener("touchmove",b,!0),document.addEventListener("touchend",v,!0)}function x(){document.removeEventListener("mousemove",b,!0),document.removeEventListener("mouseup",v,!0),document.removeEventListener("touchmove",b,!0),document.removeEventListener("touchend",v,!0)}const E=new ResizeObserver(m),k=o.computed(()=>{const{textAlign:C}=e.node.attrs;return{left:"margin-right: auto;",right:"margin-left: auto;",center:"margin-left: auto; margin-right: auto;"}[C]||""});return o.onMounted(()=>{c.value&&f.observe(c.value),E.observe(e.editor.view.dom)}),o.onBeforeUnmount(()=>{x(),f.disconnect(),E.disconnect()}),(C,_)=>(o.openBlock(),o.createBlock(o.unref(ta),{class:"node-image",style:o.normalizeStyle({"pointer-events":o.unref(r)&&t.selected?"none":"auto"})},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"image-view",style:o.normalizeStyle([{width:u.value.style.width,height:u.value.style.height},k.value])},[o.createElementVNode("div",{draggable:"true","data-drag-handle":"",class:o.normalizeClass([{"image-view__body--focused":t.selected,"image-view__body--resizing":a.value},"image-view__body"])},[o.createElementVNode("img",{ref_key:"imageRef",ref:c,src:u.value.src,alt:u.value.alt,class:"block w-full image-view__body__image",style:o.normalizeStyle([{transform:u.value.style.transform}]),onClick:p,onMousedown:_[0]||(_[0]=(...T)=>o.unref(cf)&&o.unref(cf)(...T))},null,44,cR),C.editor.view.editable?o.withDirectives((o.openBlock(),o.createElementBlock("div",dR,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(Object.values(n),T=>(o.openBlock(),o.createElementBlock("span",{key:T,class:o.normalizeClass(o.unref(Se)(`image-resizer__handler--${T}`,"image-resizer__handler",o.unref(r)&&t.selected&&"pointer-events-auto")),onMousedown:A=>g(A,T),onTouchstart:o.withModifiers(A=>g(A,T),["prevent"])},null,42,fR))),128))],512)),[[o.vShow,t.selected||a.value]]):o.createCommentVNode("",!0)],2)],4)]),_:1},8,["style"]))}}),uo=(t,e)=>{const n=t.__vccOpts||t;for(const[r,i]of e)n[r]=i;return n},hR=uo(pR,[["__scopeId","data-v-db9342d0"]]),qu=uR.extend({group:"block",defining:!0,isolating:!0,addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),src:{default:null,parseHTML:e=>{const n=e.tagName==="P"?e.querySelector("img"):e;return n==null?void 0:n.getAttribute("src")}},flipX:{default:!1},flipY:{default:!1},originWidth:{default:null},originHeight:{default:null},textAlign:{default:"left",parseHTML:e=>e.style.textAlign||e.getAttribute("textAlign")||null,renderHTML:e=>({textAlign:e.textAlign})},width:{default:"100%",parseHTML:e=>{const n=e.tagName==="P"?e.querySelector("img"):e,r=n&&(n.style.width||n.getAttribute("width"))||null;return r&&r.endsWith("%")?r:r==null?null:parseInt(r,10)},renderHTML:e=>({width:e.width})},height:{default:"auto",parseHTML:e=>{const n=e.style.height||e.getAttribute("height")||null;return n==null||n==="auto"?null:parseInt(n,10)},renderHTML:e=>({height:e.height})},class:{default:"",parseHTML:e=>e.getAttribute("class")||"",renderHTML:e=>({class:e.class})},"data-memo":{default:"",parseHTML:e=>e.getAttribute("data-memo")||"",renderHTML:e=>({"data-memo":e["data-memo"]})}}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this)}},addNodeView(){return ra(hR)},addCommands(){var t;return{...(t=this.parent)==null?void 0:t.call(this),updateImage:e=>({commands:n,editor:r})=>n.updateAttributes(this.name,e)}},renderHTML({node:t,HTMLAttributes:e}){const{textAlign:n,flipX:r,flipY:i}=t.attrs,l=`${{left:"margin-right: auto;",right:"margin-left: auto;",center:"margin-left: auto; margin-right: auto;"}[n]||""} ${r||i?`transform: rotateX(${r?"180":"0"}deg) rotateY(${i?"180":"0"}deg);`:""}`;return["img",yt(this.options.HTMLAttributes,e,{style:l})]},parseHTML(){return[{tag:"img[src]"},{tag:"p",priority:1001,getAttrs:t=>{var n,r;const e=t;return e.children.length===1&&((n=e.firstElementChild)==null?void 0:n.tagName)==="IMG"&&!!!((r=e.textContent)!=null&&r.trim())&&e.firstElementChild.hasAttribute("src")?null:!1}}]},addProseMirrorPlugins(){return[new nt({props:{handleTextInput(t){const{selection:e}=t.state;return e instanceof Ve&&e.node.type.name==="image"},handlePaste(t){const{selection:e}=t.state;return e instanceof Ve&&e.node.type.name==="image"}}})]}}),mR={key:0,class:"p-2.5 space-y-1.5"},gR=["innerHTML"],bR={key:1,class:"p-2.5 space-y-1.5"},vR=["innerHTML"],yR={key:2,class:"p-2.5 space-y-1.5"},wR=["innerHTML"],xR=uo(o.defineComponent({__name:"ArticleFullViewer",props:{extensions:{},mode:{},hideComment:{type:Boolean},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},comment:{},commentCuesheet:{},content:{},minChars:{},fontSize:{}},setup(t){const e=t,n=o.computed(()=>{var k;const E=((k=e.extensions)==null?void 0:k.filter(C=>C.name!=="spellchecker"))||[];return E.some(C=>C.name==="image")||E.push(qu.configure()),E}),r=o.computed(()=>oa(e.comment)),i=o.computed(()=>oa(e.commentCuesheet)),s=o.computed(()=>oa(e.content));function a(E){return u1(E).replace(/<script\b[\s\S]*?<\/script\s*>/gi,"")}const l=o.computed(()=>r.value?a(e.comment):""),u=o.computed(()=>i.value?a(e.commentCuesheet):""),c=o.computed(()=>s.value?a(e.content):""),f=o.ref(),p=o.ref(),m=o.ref();o.onBeforeUnmount(()=>{f.value&&f.value.destroy(),p.value&&p.value.destroy(),m.value&&m.value.destroy()});function g(E){return new Lo({extensions:n.value,content:E,editable:!1,parseOptions:{preserveWhitespace:"full"}})}r.value||(f.value=g(bn(e.comment,!0,e.mode))),i.value||(p.value=g(bn(e.commentCuesheet,!0,e.mode))),s.value||(m.value=g(bn(e.content,!0,e.mode)));function b(E,k){if(!E)return;const C=bn(k,!0,e.mode);kt.isEqual(E.getHTML(),C)||E.commands.setContent(C,!1,{preserveWhitespace:"full"})}o.watch(()=>e.comment,E=>{r.value||b(f.value,E)}),o.watch(()=>e.commentCuesheet,E=>{i.value||b(p.value,E)}),o.watch(()=>e.content,E=>{s.value||b(m.value,E)});const v=o.computed(()=>e.fontSize??""),{contentInner:y,measuredMinWidth:x}=df({minChars:e.minChars,fontSize:v});return(E,k)=>{var _,T,A;const C=AT;return o.openBlock(),o.createElementBlock("div",{ref_key:"contentInner",ref:y,style:o.normalizeStyle({minWidth:`${Number(o.unref(x))+23}px`}),class:"flex-1 border border-[#999] rounded-[3px] divide-y divide-[#999] divide-dashed overflow-y-auto"},[E.comment&&!E.hideComment?(o.openBlock(),o.createElementBlock("div",mR,[(_=E.fieldNameComment)!=null&&_.label?(o.openBlock(),o.createBlock(C,{key:0,label:E.fieldNameComment.label,"custom-class":E.fieldNameComment.customClass},null,8,["label","custom-class"])):o.createCommentVNode("",!0),o.unref(r)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(l)},null,8,gR)):(o.openBlock(),o.createBlock(o.unref(Qn),{key:2,editor:o.unref(f)},null,8,["editor"]))])):o.createCommentVNode("",!0),E.commentCuesheet&&!E.hideComment?(o.openBlock(),o.createElementBlock("div",bR,[(T=E.fieldNameCommentCuesheet)!=null&&T.label?(o.openBlock(),o.createBlock(C,{key:0,label:E.fieldNameCommentCuesheet.label,"custom-class":E.fieldNameCommentCuesheet.customClass},null,8,["label","custom-class"])):o.createCommentVNode("",!0),o.unref(i)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(u)},null,8,vR)):(o.openBlock(),o.createBlock(o.unref(Qn),{key:2,editor:o.unref(p)},null,8,["editor"]))])):o.createCommentVNode("",!0),E.content?(o.openBlock(),o.createElementBlock("div",yR,[(A=E.fieldNameContent)!=null&&A.label?(o.openBlock(),o.createBlock(C,{key:0,label:E.fieldNameContent.label,"custom-class":E.fieldNameContent.customClass},null,8,["label","custom-class"])):o.createCommentVNode("",!0),o.unref(s)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(c)},null,8,wR)):(o.openBlock(),o.createBlock(o.unref(Qn),{key:2,editor:o.unref(m)},null,8,["editor"]))])):o.createCommentVNode("",!0)],4)}}}),[["__scopeId","data-v-374d1603"]]),CR=["top","right","bottom","left"],es=Math.min,Cr=Math.max,ff=Math.round,pf=Math.floor,Fo=t=>({x:t,y:t}),ER={left:"right",right:"left",bottom:"top",top:"bottom"},kR={start:"end",end:"start"};function m1(t,e,n){return Cr(t,es(e,n))}function di(t,e){return typeof t=="function"?t(e):t}function fi(t){return t.split("-")[0]}function gl(t){return t.split("-")[1]}function g1(t){return t==="x"?"y":"x"}function b1(t){return t==="y"?"height":"width"}function ts(t){return["top","bottom"].includes(fi(t))?"y":"x"}function v1(t){return g1(ts(t))}function SR(t,e,n){n===void 0&&(n=!1);const r=gl(t),i=v1(t),s=b1(i);let a=i==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[s]>e.floating[s]&&(a=hf(a)),[a,hf(a)]}function _R(t){const e=hf(t);return[y1(t),e,y1(e)]}function y1(t){return t.replace(/start|end/g,e=>kR[e])}function TR(t,e,n){const r=["left","right"],i=["right","left"],s=["top","bottom"],a=["bottom","top"];switch(t){case"top":case"bottom":return n?e?i:r:e?r:i;case"left":case"right":return e?s:a;default:return[]}}function AR(t,e,n,r){const i=gl(t);let s=TR(fi(t),n==="start",r);return i&&(s=s.map(a=>a+"-"+i),e&&(s=s.concat(s.map(y1)))),s}function hf(t){return t.replace(/left|right|bottom|top/g,e=>ER[e])}function MR(t){return{top:0,right:0,bottom:0,left:0,...t}}function p6(t){return typeof t!="number"?MR(t):{top:t,right:t,bottom:t,left:t}}function mf(t){const{x:e,y:n,width:r,height:i}=t;return{width:r,height:i,top:n,left:e,right:e+r,bottom:n+i,x:e,y:n}}function h6(t,e,n){let{reference:r,floating:i}=t;const s=ts(e),a=v1(e),l=b1(a),u=fi(e),c=s==="y",f=r.x+r.width/2-i.width/2,p=r.y+r.height/2-i.height/2,m=r[l]/2-i[l]/2;let g;switch(u){case"top":g={x:f,y:r.y-i.height};break;case"bottom":g={x:f,y:r.y+r.height};break;case"right":g={x:r.x+r.width,y:p};break;case"left":g={x:r.x-i.width,y:p};break;default:g={x:r.x,y:r.y}}switch(gl(e)){case"start":g[a]-=m*(n&&c?-1:1);break;case"end":g[a]+=m*(n&&c?-1:1);break}return g}const OR=async(t,e,n)=>{const{placement:r="bottom",strategy:i="absolute",middleware:s=[],platform:a}=n,l=s.filter(Boolean),u=await(a.isRTL==null?void 0:a.isRTL(e));let c=await a.getElementRects({reference:t,floating:e,strategy:i}),{x:f,y:p}=h6(c,r,u),m=r,g={},b=0;for(let v=0;v<l.length;v++){const{name:y,fn:x}=l[v],{x:E,y:k,data:C,reset:_}=await x({x:f,y:p,initialPlacement:r,placement:m,strategy:i,middlewareData:g,rects:c,platform:a,elements:{reference:t,floating:e}});f=E??f,p=k??p,g={...g,[y]:{...g[y],...C}},_&&b<=50&&(b++,typeof _=="object"&&(_.placement&&(m=_.placement),_.rects&&(c=_.rects===!0?await a.getElementRects({reference:t,floating:e,strategy:i}):_.rects),{x:f,y:p}=h6(c,m,u)),v=-1)}return{x:f,y:p,placement:m,strategy:i,middlewareData:g}};async function Ku(t,e){var n;e===void 0&&(e={});const{x:r,y:i,platform:s,rects:a,elements:l,strategy:u}=t,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:p="floating",altBoundary:m=!1,padding:g=0}=di(e,t),b=p6(g),y=l[m?p==="floating"?"reference":"floating":p],x=mf(await s.getClippingRect({element:(n=await(s.isElement==null?void 0:s.isElement(y)))==null||n?y:y.contextElement||await(s.getDocumentElement==null?void 0:s.getDocumentElement(l.floating)),boundary:c,rootBoundary:f,strategy:u})),E=p==="floating"?{x:r,y:i,width:a.floating.width,height:a.floating.height}:a.reference,k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l.floating)),C=await(s.isElement==null?void 0:s.isElement(k))?await(s.getScale==null?void 0:s.getScale(k))||{x:1,y:1}:{x:1,y:1},_=mf(s.convertOffsetParentRelativeRectToViewportRelativeRect?await s.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:E,offsetParent:k,strategy:u}):E);return{top:(x.top-_.top+b.top)/C.y,bottom:(_.bottom-x.bottom+b.bottom)/C.y,left:(x.left-_.left+b.left)/C.x,right:(_.right-x.right+b.right)/C.x}}const BR=t=>({name:"arrow",options:t,async fn(e){const{x:n,y:r,placement:i,rects:s,platform:a,elements:l,middlewareData:u}=e,{element:c,padding:f=0}=di(t,e)||{};if(c==null)return{};const p=p6(f),m={x:n,y:r},g=v1(i),b=b1(g),v=await a.getDimensions(c),y=g==="y",x=y?"top":"left",E=y?"bottom":"right",k=y?"clientHeight":"clientWidth",C=s.reference[b]+s.reference[g]-m[g]-s.floating[b],_=m[g]-s.reference[g],T=await(a.getOffsetParent==null?void 0:a.getOffsetParent(c));let A=T?T[k]:0;(!A||!await(a.isElement==null?void 0:a.isElement(T)))&&(A=l.floating[k]||s.floating[b]);const D=C/2-_/2,O=A/2-v[b]/2-1,M=es(p[x],O),$=es(p[E],O),V=M,G=A-v[b]-$,ee=A/2-v[b]/2+D,W=m1(V,ee,G),F=!u.arrow&&gl(i)!=null&&ee!==W&&s.reference[b]/2-(ee<V?M:$)-v[b]/2<0,R=F?ee<V?ee-V:ee-G:0;return{[g]:m[g]+R,data:{[g]:W,centerOffset:ee-W-R,...F&&{alignmentOffset:R}},reset:F}}}),IR=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(e){var n,r;const{placement:i,middlewareData:s,rects:a,initialPlacement:l,platform:u,elements:c}=e,{mainAxis:f=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:g="bestFit",fallbackAxisSideDirection:b="none",flipAlignment:v=!0,...y}=di(t,e);if((n=s.arrow)!=null&&n.alignmentOffset)return{};const x=fi(i),E=ts(l),k=fi(l)===l,C=await(u.isRTL==null?void 0:u.isRTL(c.floating)),_=m||(k||!v?[hf(l)]:_R(l)),T=b!=="none";!m&&T&&_.push(...AR(l,v,b,C));const A=[l,..._],D=await Ku(e,y),O=[];let M=((r=s.flip)==null?void 0:r.overflows)||[];if(f&&O.push(D[x]),p){const ee=SR(i,a,C);O.push(D[ee[0]],D[ee[1]])}if(M=[...M,{placement:i,overflows:O}],!O.every(ee=>ee<=0)){var $,V;const ee=((($=s.flip)==null?void 0:$.index)||0)+1,W=A[ee];if(W)return{data:{index:ee,overflows:M},reset:{placement:W}};let F=(V=M.filter(R=>R.overflows[0]<=0).sort((R,H)=>R.overflows[1]-H.overflows[1])[0])==null?void 0:V.placement;if(!F)switch(g){case"bestFit":{var G;const R=(G=M.filter(H=>{if(T){const L=ts(H.placement);return L===E||L==="y"}return!0}).map(H=>[H.placement,H.overflows.filter(L=>L>0).reduce((L,q)=>L+q,0)]).sort((H,L)=>H[1]-L[1])[0])==null?void 0:G[0];R&&(F=R);break}case"initialPlacement":F=l;break}if(i!==F)return{reset:{placement:F}}}return{}}}};function m6(t,e){return{top:t.top-e.height,right:t.right-e.width,bottom:t.bottom-e.height,left:t.left-e.width}}function g6(t){return CR.some(e=>t[e]>=0)}const RR=function(t){return t===void 0&&(t={}),{name:"hide",options:t,async fn(e){const{rects:n}=e,{strategy:r="referenceHidden",...i}=di(t,e);switch(r){case"referenceHidden":{const s=await Ku(e,{...i,elementContext:"reference"}),a=m6(s,n.reference);return{data:{referenceHiddenOffsets:a,referenceHidden:g6(a)}}}case"escaped":{const s=await Ku(e,{...i,altBoundary:!0}),a=m6(s,n.floating);return{data:{escapedOffsets:a,escaped:g6(a)}}}default:return{}}}}};async function LR(t,e){const{placement:n,platform:r,elements:i}=t,s=await(r.isRTL==null?void 0:r.isRTL(i.floating)),a=fi(n),l=gl(n),u=ts(n)==="y",c=["left","top"].includes(a)?-1:1,f=s&&u?-1:1,p=di(e,t);let{mainAxis:m,crossAxis:g,alignmentAxis:b}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return l&&typeof b=="number"&&(g=l==="end"?b*-1:b),u?{x:g*f,y:m*c}:{x:m*c,y:g*f}}const DR=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(e){var n,r;const{x:i,y:s,placement:a,middlewareData:l}=e,u=await LR(e,t);return a===((n=l.offset)==null?void 0:n.placement)&&(r=l.arrow)!=null&&r.alignmentOffset?{}:{x:i+u.x,y:s+u.y,data:{...u,placement:a}}}}},PR=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(e){const{x:n,y:r,placement:i}=e,{mainAxis:s=!0,crossAxis:a=!1,limiter:l={fn:y=>{let{x,y:E}=y;return{x,y:E}}},...u}=di(t,e),c={x:n,y:r},f=await Ku(e,u),p=ts(fi(i)),m=g1(p);let g=c[m],b=c[p];if(s){const y=m==="y"?"top":"left",x=m==="y"?"bottom":"right",E=g+f[y],k=g-f[x];g=m1(E,g,k)}if(a){const y=p==="y"?"top":"left",x=p==="y"?"bottom":"right",E=b+f[y],k=b-f[x];b=m1(E,b,k)}const v=l.fn({...e,[m]:g,[p]:b});return{...v,data:{x:v.x-n,y:v.y-r,enabled:{[m]:s,[p]:a}}}}}},VR=function(t){return t===void 0&&(t={}),{options:t,fn(e){const{x:n,y:r,placement:i,rects:s,middlewareData:a}=e,{offset:l=0,mainAxis:u=!0,crossAxis:c=!0}=di(t,e),f={x:n,y:r},p=ts(i),m=g1(p);let g=f[m],b=f[p];const v=di(l,e),y=typeof v=="number"?{mainAxis:v,crossAxis:0}:{mainAxis:0,crossAxis:0,...v};if(u){const k=m==="y"?"height":"width",C=s.reference[m]-s.floating[k]+y.mainAxis,_=s.reference[m]+s.reference[k]-y.mainAxis;g<C?g=C:g>_&&(g=_)}if(c){var x,E;const k=m==="y"?"width":"height",C=["top","left"].includes(fi(i)),_=s.reference[p]-s.floating[k]+(C&&((x=a.offset)==null?void 0:x[p])||0)+(C?0:y.crossAxis),T=s.reference[p]+s.reference[k]+(C?0:((E=a.offset)==null?void 0:E[p])||0)-(C?y.crossAxis:0);b<_?b=_:b>T&&(b=T)}return{[m]:g,[p]:b}}}},FR=function(t){return t===void 0&&(t={}),{name:"size",options:t,async fn(e){var n,r;const{placement:i,rects:s,platform:a,elements:l}=e,{apply:u=()=>{},...c}=di(t,e),f=await Ku(e,c),p=fi(i),m=gl(i),g=ts(i)==="y",{width:b,height:v}=s.floating;let y,x;p==="top"||p==="bottom"?(y=p,x=m===(await(a.isRTL==null?void 0:a.isRTL(l.floating))?"start":"end")?"left":"right"):(x=p,y=m==="end"?"top":"bottom");const E=v-f.top-f.bottom,k=b-f.left-f.right,C=es(v-f[y],E),_=es(b-f[x],k),T=!e.middlewareData.shift;let A=C,D=_;if((n=e.middlewareData.shift)!=null&&n.enabled.x&&(D=k),(r=e.middlewareData.shift)!=null&&r.enabled.y&&(A=E),T&&!m){const M=Cr(f.left,0),$=Cr(f.right,0),V=Cr(f.top,0),G=Cr(f.bottom,0);g?D=b-2*(M!==0||$!==0?M+$:Cr(f.left,f.right)):A=v-2*(V!==0||G!==0?V+G:Cr(f.top,f.bottom))}await u({...e,availableWidth:D,availableHeight:A});const O=await a.getDimensions(l.floating);return b!==O.width||v!==O.height?{reset:{rects:!0}}:{}}}};function gf(){return typeof window<"u"}function ia(t){return w1(t)?(t.nodeName||"").toLowerCase():"#document"}function Er(t){var e;return(t==null||(e=t.ownerDocument)==null?void 0:e.defaultView)||window}function $o(t){var e;return(e=(w1(t)?t.ownerDocument:t.document)||window.document)==null?void 0:e.documentElement}function w1(t){return gf()?t instanceof Node||t instanceof Er(t).Node:!1}function co(t){return gf()?t instanceof Element||t instanceof Er(t).Element:!1}function Ho(t){return gf()?t instanceof HTMLElement||t instanceof Er(t).HTMLElement:!1}function b6(t){return!gf()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof Er(t).ShadowRoot}function Gu(t){const{overflow:e,overflowX:n,overflowY:r,display:i}=fo(t);return/auto|scroll|overlay|hidden|clip/.test(e+r+n)&&!["inline","contents"].includes(i)}function $R(t){return["table","td","th"].includes(ia(t))}function bf(t){return[":popover-open",":modal"].some(e=>{try{return t.matches(e)}catch{return!1}})}function x1(t){const e=C1(),n=co(t)?fo(t):t;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!e&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!e&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function HR(t){let e=ns(t);for(;Ho(e)&&!bl(e);){if(x1(e))return e;if(bf(e))return null;e=ns(e)}return null}function C1(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function bl(t){return["html","body","#document"].includes(ia(t))}function fo(t){return Er(t).getComputedStyle(t)}function vf(t){return co(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function ns(t){if(ia(t)==="html")return t;const e=t.assignedSlot||t.parentNode||b6(t)&&t.host||$o(t);return b6(e)?e.host:e}function v6(t){const e=ns(t);return bl(e)?t.ownerDocument?t.ownerDocument.body:t.body:Ho(e)&&Gu(e)?e:v6(e)}function Xu(t,e,n){var r;e===void 0&&(e=[]),n===void 0&&(n=!0);const i=v6(t),s=i===((r=t.ownerDocument)==null?void 0:r.body),a=Er(i);if(s){const l=E1(a);return e.concat(a,a.visualViewport||[],Gu(i)?i:[],l&&n?Xu(l):[])}return e.concat(i,Xu(i,[],n))}function E1(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function y6(t){const e=fo(t);let n=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const i=Ho(t),s=i?t.offsetWidth:n,a=i?t.offsetHeight:r,l=ff(n)!==s||ff(r)!==a;return l&&(n=s,r=a),{width:n,height:r,$:l}}function k1(t){return co(t)?t:t.contextElement}function vl(t){const e=k1(t);if(!Ho(e))return Fo(1);const n=e.getBoundingClientRect(),{width:r,height:i,$:s}=y6(e);let a=(s?ff(n.width):n.width)/r,l=(s?ff(n.height):n.height)/i;return(!a||!Number.isFinite(a))&&(a=1),(!l||!Number.isFinite(l))&&(l=1),{x:a,y:l}}const zR=Fo(0);function w6(t){const e=Er(t);return!C1()||!e.visualViewport?zR:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function UR(t,e,n){return e===void 0&&(e=!1),!n||e&&n!==Er(t)?!1:e}function sa(t,e,n,r){e===void 0&&(e=!1),n===void 0&&(n=!1);const i=t.getBoundingClientRect(),s=k1(t);let a=Fo(1);e&&(r?co(r)&&(a=vl(r)):a=vl(t));const l=UR(s,n,r)?w6(s):Fo(0);let u=(i.left+l.x)/a.x,c=(i.top+l.y)/a.y,f=i.width/a.x,p=i.height/a.y;if(s){const m=Er(s),g=r&&co(r)?Er(r):r;let b=m,v=E1(b);for(;v&&r&&g!==b;){const y=vl(v),x=v.getBoundingClientRect(),E=fo(v),k=x.left+(v.clientLeft+parseFloat(E.paddingLeft))*y.x,C=x.top+(v.clientTop+parseFloat(E.paddingTop))*y.y;u*=y.x,c*=y.y,f*=y.x,p*=y.y,u+=k,c+=C,b=Er(v),v=E1(b)}}return mf({width:f,height:p,x:u,y:c})}function S1(t,e){const n=vf(t).scrollLeft;return e?e.left+n:sa($o(t)).left+n}function x6(t,e,n){n===void 0&&(n=!1);const r=t.getBoundingClientRect(),i=r.left+e.scrollLeft-(n?0:S1(t,r)),s=r.top+e.scrollTop;return{x:i,y:s}}function WR(t){let{elements:e,rect:n,offsetParent:r,strategy:i}=t;const s=i==="fixed",a=$o(r),l=e?bf(e.floating):!1;if(r===a||l&&s)return n;let u={scrollLeft:0,scrollTop:0},c=Fo(1);const f=Fo(0),p=Ho(r);if((p||!p&&!s)&&((ia(r)!=="body"||Gu(a))&&(u=vf(r)),Ho(r))){const g=sa(r);c=vl(r),f.x=g.x+r.clientLeft,f.y=g.y+r.clientTop}const m=a&&!p&&!s?x6(a,u,!0):Fo(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-u.scrollLeft*c.x+f.x+m.x,y:n.y*c.y-u.scrollTop*c.y+f.y+m.y}}function jR(t){return Array.from(t.getClientRects())}function qR(t){const e=$o(t),n=vf(t),r=t.ownerDocument.body,i=Cr(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),s=Cr(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let a=-n.scrollLeft+S1(t);const l=-n.scrollTop;return fo(r).direction==="rtl"&&(a+=Cr(e.clientWidth,r.clientWidth)-i),{width:i,height:s,x:a,y:l}}function KR(t,e){const n=Er(t),r=$o(t),i=n.visualViewport;let s=r.clientWidth,a=r.clientHeight,l=0,u=0;if(i){s=i.width,a=i.height;const c=C1();(!c||c&&e==="fixed")&&(l=i.offsetLeft,u=i.offsetTop)}return{width:s,height:a,x:l,y:u}}function GR(t,e){const n=sa(t,!0,e==="fixed"),r=n.top+t.clientTop,i=n.left+t.clientLeft,s=Ho(t)?vl(t):Fo(1),a=t.clientWidth*s.x,l=t.clientHeight*s.y,u=i*s.x,c=r*s.y;return{width:a,height:l,x:u,y:c}}function C6(t,e,n){let r;if(e==="viewport")r=KR(t,n);else if(e==="document")r=qR($o(t));else if(co(e))r=GR(e,n);else{const i=w6(t);r={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return mf(r)}function E6(t,e){const n=ns(t);return n===e||!co(n)||bl(n)?!1:fo(n).position==="fixed"||E6(n,e)}function XR(t,e){const n=e.get(t);if(n)return n;let r=Xu(t,[],!1).filter(l=>co(l)&&ia(l)!=="body"),i=null;const s=fo(t).position==="fixed";let a=s?ns(t):t;for(;co(a)&&!bl(a);){const l=fo(a),u=x1(a);!u&&l.position==="fixed"&&(i=null),(s?!u&&!i:!u&&l.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Gu(a)&&!u&&E6(t,a))?r=r.filter(f=>f!==a):i=l,a=ns(a)}return e.set(t,r),r}function YR(t){let{element:e,boundary:n,rootBoundary:r,strategy:i}=t;const a=[...n==="clippingAncestors"?bf(e)?[]:XR(e,this._c):[].concat(n),r],l=a[0],u=a.reduce((c,f)=>{const p=C6(e,f,i);return c.top=Cr(p.top,c.top),c.right=es(p.right,c.right),c.bottom=es(p.bottom,c.bottom),c.left=Cr(p.left,c.left),c},C6(e,l,i));return{width:u.right-u.left,height:u.bottom-u.top,x:u.left,y:u.top}}function JR(t){const{width:e,height:n}=y6(t);return{width:e,height:n}}function ZR(t,e,n){const r=Ho(e),i=$o(e),s=n==="fixed",a=sa(t,!0,s,e);let l={scrollLeft:0,scrollTop:0};const u=Fo(0);if(r||!r&&!s)if((ia(e)!=="body"||Gu(i))&&(l=vf(e)),r){const m=sa(e,!0,s,e);u.x=m.x+e.clientLeft,u.y=m.y+e.clientTop}else i&&(u.x=S1(i));const c=i&&!r&&!s?x6(i,l):Fo(0),f=a.left+l.scrollLeft-u.x-c.x,p=a.top+l.scrollTop-u.y-c.y;return{x:f,y:p,width:a.width,height:a.height}}function _1(t){return fo(t).position==="static"}function k6(t,e){if(!Ho(t)||fo(t).position==="fixed")return null;if(e)return e(t);let n=t.offsetParent;return $o(t)===n&&(n=n.ownerDocument.body),n}function S6(t,e){const n=Er(t);if(bf(t))return n;if(!Ho(t)){let i=ns(t);for(;i&&!bl(i);){if(co(i)&&!_1(i))return i;i=ns(i)}return n}let r=k6(t,e);for(;r&&$R(r)&&_1(r);)r=k6(r,e);return r&&bl(r)&&_1(r)&&!x1(r)?n:r||HR(t)||n}const QR=async function(t){const e=this.getOffsetParent||S6,n=this.getDimensions,r=await n(t.floating);return{reference:ZR(t.reference,await e(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function NR(t){return fo(t).direction==="rtl"}const eL={convertOffsetParentRelativeRectToViewportRelativeRect:WR,getDocumentElement:$o,getClippingRect:YR,getOffsetParent:S6,getElementRects:QR,getClientRects:jR,getDimensions:JR,getScale:vl,isElement:co,isRTL:NR};function _6(t,e){return t.x===e.x&&t.y===e.y&&t.width===e.width&&t.height===e.height}function tL(t,e){let n=null,r;const i=$o(t);function s(){var l;clearTimeout(r),(l=n)==null||l.disconnect(),n=null}function a(l,u){l===void 0&&(l=!1),u===void 0&&(u=1),s();const c=t.getBoundingClientRect(),{left:f,top:p,width:m,height:g}=c;if(l||e(),!m||!g)return;const b=pf(p),v=pf(i.clientWidth-(f+m)),y=pf(i.clientHeight-(p+g)),x=pf(f),k={rootMargin:-b+"px "+-v+"px "+-y+"px "+-x+"px",threshold:Cr(0,es(1,u))||1};let C=!0;function _(T){const A=T[0].intersectionRatio;if(A!==u){if(!C)return a();A?a(!1,A):r=setTimeout(()=>{a(!1,1e-7)},1e3)}A===1&&!_6(c,t.getBoundingClientRect())&&a(),C=!1}try{n=new IntersectionObserver(_,{...k,root:i.ownerDocument})}catch{n=new IntersectionObserver(_,k)}n.observe(t)}return a(!0),s}function nL(t,e,n,r){r===void 0&&(r={});const{ancestorScroll:i=!0,ancestorResize:s=!0,elementResize:a=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:u=!1}=r,c=k1(t),f=i||s?[...c?Xu(c):[],...Xu(e)]:[];f.forEach(x=>{i&&x.addEventListener("scroll",n,{passive:!0}),s&&x.addEventListener("resize",n)});const p=c&&l?tL(c,n):null;let m=-1,g=null;a&&(g=new ResizeObserver(x=>{let[E]=x;E&&E.target===c&&g&&(g.unobserve(e),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var k;(k=g)==null||k.observe(e)})),n()}),c&&!u&&g.observe(c),g.observe(e));let b,v=u?sa(t):null;u&&y();function y(){const x=sa(t);v&&!_6(v,x)&&n(),v=x,b=requestAnimationFrame(y)}return n(),()=>{var x;f.forEach(E=>{i&&E.removeEventListener("scroll",n),s&&E.removeEventListener("resize",n)}),p==null||p(),(x=g)==null||x.disconnect(),g=null,u&&cancelAnimationFrame(b)}}const rL=DR,oL=PR,T6=IR,iL=FR,sL=RR,aL=BR,lL=VR,uL=(t,e,n)=>{const r=new Map,i={platform:eL,...n},s={...i.platform,_c:r};return OR(t,e,{...i,platform:s})};function cL(t){return t!=null&&typeof t=="object"&&"$el"in t}function T1(t){if(cL(t)){const e=t.$el;return w1(e)&&ia(e)==="#comment"?null:e}return t}function yl(t){return typeof t=="function"?t():o.unref(t)}function dL(t){return{name:"arrow",options:t,fn(e){const n=T1(yl(t.element));return n==null?{}:aL({element:n,padding:t.padding}).fn(e)}}}function A6(t){return typeof window>"u"?1:(t.ownerDocument.defaultView||window).devicePixelRatio||1}function M6(t,e){const n=A6(t);return Math.round(e*n)/n}function fL(t,e,n){n===void 0&&(n={});const r=n.whileElementsMounted,i=o.computed(()=>{var A;return(A=yl(n.open))!=null?A:!0}),s=o.computed(()=>yl(n.middleware)),a=o.computed(()=>{var A;return(A=yl(n.placement))!=null?A:"bottom"}),l=o.computed(()=>{var A;return(A=yl(n.strategy))!=null?A:"absolute"}),u=o.computed(()=>{var A;return(A=yl(n.transform))!=null?A:!0}),c=o.computed(()=>T1(t.value)),f=o.computed(()=>T1(e.value)),p=o.ref(0),m=o.ref(0),g=o.ref(l.value),b=o.ref(a.value),v=o.shallowRef({}),y=o.ref(!1),x=o.computed(()=>{const A={position:g.value,left:"0",top:"0"};if(!f.value)return A;const D=M6(f.value,p.value),O=M6(f.value,m.value);return u.value?{...A,transform:"translate("+D+"px, "+O+"px)",...A6(f.value)>=1.5&&{willChange:"transform"}}:{position:g.value,left:D+"px",top:O+"px"}});let E;function k(){if(c.value==null||f.value==null)return;const A=i.value;uL(c.value,f.value,{middleware:s.value,placement:a.value,strategy:l.value}).then(D=>{p.value=D.x,m.value=D.y,g.value=D.strategy,b.value=D.placement,v.value=D.middlewareData,y.value=A!==!1})}function C(){typeof E=="function"&&(E(),E=void 0)}function _(){if(C(),r===void 0){k();return}if(c.value!=null&&f.value!=null){E=r(c.value,f.value,k);return}}function T(){i.value||(y.value=!1)}return o.watch([s,a,l,i],k,{flush:"sync"}),o.watch([c,f],_,{flush:"sync"}),o.watch(i,T,{flush:"sync"}),o.getCurrentScope()&&o.onScopeDispose(C),{x:o.shallowReadonly(p),y:o.shallowReadonly(m),strategy:o.shallowReadonly(g),placement:o.shallowReadonly(b),middlewareData:o.shallowReadonly(v),isPositioned:o.shallowReadonly(y),floatingStyles:x,update:k}}function Ht(t,e){const n=typeof t=="string"&&!e?`${t}Context`:e,r=Symbol(n);return[i=>{const s=o.inject(r,i);if(s||s===null)return s;throw new Error(`Injection \`${r.toString()}\` not found. Component must be used within ${Array.isArray(t)?`one of the following components: ${t.join(", ")}`:`\`${t}\``}`)},i=>(o.provide(r,i),i)]}function O6(t,e,n){const r=n.originalEvent.target,i=new CustomEvent(t,{bubbles:!1,cancelable:!0,detail:n});e&&r.addEventListener(t,e,{once:!0}),r.dispatchEvent(i)}function A1(t,e=Number.NEGATIVE_INFINITY,n=Number.POSITIVE_INFINITY){return Math.min(n,Math.max(e,t))}function pL(t){return t==null}function hL(t,e){var n;const r=o.shallowRef();return o.watchEffect(()=>{r.value=t()},{...e,flush:(n=void 0)!=null?n:"sync"}),o.readonly(r)}function wl(t){return o.getCurrentScope()?(o.onScopeDispose(t),!0):!1}function mL(){const t=new Set,e=n=>{t.delete(n)};return{on:n=>{t.add(n);const r=()=>e(n);return wl(r),{off:r}},off:e,trigger:(...n)=>Promise.all(Array.from(t).map(r=>r(...n)))}}function gL(t){let e=!1,n;const r=o.effectScope(!0);return(...i)=>(e||(n=r.run(()=>t(...i)),e=!0),n)}function B6(t){let e=0,n,r;const i=()=>{e-=1,r&&e<=0&&(r.stop(),n=void 0,r=void 0)};return(...s)=>(e+=1,n||(r=o.effectScope(!0),n=r.run(()=>t(...s))),wl(i),n)}function zo(t){return typeof t=="function"?t():o.unref(t)}const pi=typeof window<"u"&&typeof document<"u";typeof WorkerGlobalScope<"u"&&globalThis instanceof WorkerGlobalScope;const bL=t=>typeof t<"u",vL=Object.prototype.toString,yL=t=>vL.call(t)==="[object Object]",M1=()=>{},I6=wL();function wL(){var t,e;return pi&&((t=window==null?void 0:window.navigator)==null?void 0:t.userAgent)&&(/iP(?:ad|hone|od)/.test(window.navigator.userAgent)||((e=window==null?void 0:window.navigator)==null?void 0:e.maxTouchPoints)>2&&/iPad|Macintosh/.test(window==null?void 0:window.navigator.userAgent))}function xL(t,e){function n(...r){return new Promise((i,s)=>{Promise.resolve(t(()=>e.apply(this,r),{fn:e,thisArg:this,args:r})).then(i).catch(s)})}return n}function CL(t,e={}){let n,r,i=M1;const s=a=>{clearTimeout(a),i(),i=M1};return a=>{const l=zo(t),u=zo(e.maxWait);return n&&s(n),l<=0||u!==void 0&&u<=0?(r&&(s(r),r=null),Promise.resolve(a())):new Promise((c,f)=>{i=e.rejectOnCancel?f:c,u&&!r&&(r=setTimeout(()=>{n&&s(n),r=null,c(a())},u)),n=setTimeout(()=>{r&&s(r),r=null,c(a())},l)})}}function EL(t){return o.getCurrentInstance()}function R6(t,e=1e4){return o.customRef((n,r)=>{let i=zo(t),s;const a=()=>setTimeout(()=>{i=zo(t),r()},zo(e));return wl(()=>{clearTimeout(s)}),{get(){return n(),i},set(l){i=l,r(),clearTimeout(s),s=a()}}})}function L6(t,e=200,n={}){return xL(CL(e,n),t)}function kL(t,e){EL()&&o.onBeforeUnmount(t,e)}function D6(t,e,n={}){const{immediate:r=!0}=n,i=o.ref(!1);let s=null;function a(){s&&(clearTimeout(s),s=null)}function l(){i.value=!1,a()}function u(...c){a(),i.value=!0,s=setTimeout(()=>{i.value=!1,s=null,t(...c)},zo(e))}return r&&(i.value=!0,pi&&u()),wl(l),{isPending:o.readonly(i),start:u,stop:l}}function SL(t,e,n){const r=o.watch(t,(...i)=>(o.nextTick(()=>r()),e(...i)),n);return r}function po(t){var e;const n=zo(t);return(e=n==null?void 0:n.$el)!=null?e:n}const yf=pi?window:void 0;function xl(...t){let e,n,r,i;if(typeof t[0]=="string"||Array.isArray(t[0])?([n,r,i]=t,e=yf):[e,n,r,i]=t,!e)return M1;Array.isArray(n)||(n=[n]),Array.isArray(r)||(r=[r]);const s=[],a=()=>{s.forEach(f=>f()),s.length=0},l=(f,p,m,g)=>(f.addEventListener(p,m,g),()=>f.removeEventListener(p,m,g)),u=o.watch(()=>[po(e),zo(i)],([f,p])=>{if(a(),!f)return;const m=yL(p)?{...p}:p;s.push(...n.flatMap(g=>r.map(b=>l(f,g,b,m))))},{immediate:!0,flush:"post"}),c=()=>{u(),a()};return wl(c),c}function _L(t){return typeof t=="function"?t:typeof t=="string"?e=>e.key===t:Array.isArray(t)?e=>t.includes(e.key):()=>!0}function TL(...t){let e,n,r={};t.length===3?(e=t[0],n=t[1],r=t[2]):t.length===2?typeof t[1]=="object"?(e=!0,n=t[0],r=t[1]):(e=t[0],n=t[1]):(e=!0,n=t[0]);const{target:i=yf,eventName:s="keydown",passive:a=!1,dedupe:l=!1}=r,u=_L(e);return xl(i,s,c=>{c.repeat&&zo(l)||u(c)&&n(c)},a)}function P6(){const t=o.ref(!1),e=o.getCurrentInstance();return e&&o.onMounted(()=>{t.value=!0},e),t}function AL(t){const e=P6();return o.computed(()=>(e.value,!!t()))}function ML(t){return JSON.parse(JSON.stringify(t))}function Cl(t,e,n={}){const{window:r=yf,...i}=n;let s;const a=AL(()=>r&&"ResizeObserver"in r),l=()=>{s&&(s.disconnect(),s=void 0)},u=o.computed(()=>Array.isArray(t)?t.map(p=>po(p)):[po(t)]),c=o.watch(u,p=>{if(l(),a.value&&r){s=new ResizeObserver(e);for(const m of p)m&&s.observe(m,i)}},{immediate:!0,flush:"post"}),f=()=>{l(),c()};return wl(f),{isSupported:a,stop:f}}function kr(t,e,n,r={}){var i,s,a;const{clone:l=!1,passive:u=!1,eventName:c,deep:f=!1,defaultValue:p,shouldEmit:m}=r,g=o.getCurrentInstance(),b=n||(g==null?void 0:g.emit)||((i=g==null?void 0:g.$emit)==null?void 0:i.bind(g))||((a=(s=g==null?void 0:g.proxy)==null?void 0:s.$emit)==null?void 0:a.bind(g==null?void 0:g.proxy));let v=c;e||(e="modelValue"),v=v||`update:${e.toString()}`;const y=k=>l?typeof l=="function"?l(k):ML(k):k,x=()=>bL(t[e])?y(t[e]):p,E=k=>{m?m(k)&&b(v,k):b(v,k)};if(u){const k=x(),C=o.ref(k);let _=!1;return o.watch(()=>t[e],T=>{_||(_=!0,C.value=y(T),o.nextTick(()=>_=!1))}),o.watch(C,T=>{!_&&(T!==t[e]||f)&&E(T)},{deep:f}),C}else return o.computed({get(){return x()},set(k){E(k)}})}function wf(t){return t?t.flatMap(e=>e.type===o.Fragment?wf(e.children):[e]):[]}function Un(){let t=document.activeElement;if(t==null)return null;for(;t!=null&&t.shadowRoot!=null&&t.shadowRoot.activeElement!=null;)t=t.shadowRoot.activeElement;return t}const OL=["INPUT","TEXTAREA"];function BL(t,e,n,r={}){if(!e||r.enableIgnoredElement&&OL.includes(e.nodeName))return null;const{arrowKeyOptions:i="both",attributeName:s="[data-radix-vue-collection-item]",itemsArray:a=[],loop:l=!0,dir:u="ltr",preventScroll:c=!0,focus:f=!1}=r,[p,m,g,b,v,y]=[t.key==="ArrowRight",t.key==="ArrowLeft",t.key==="ArrowUp",t.key==="ArrowDown",t.key==="Home",t.key==="End"],x=g||b,E=p||m;if(!v&&!y&&(!x&&!E||i==="vertical"&&E||i==="horizontal"&&x))return null;const k=n?Array.from(n.querySelectorAll(s)):a;if(!k.length)return null;c&&t.preventDefault();let C=null;return E||x?C=V6(k,e,{goForward:x?b:u==="ltr"?p:m,loop:l}):v?C=k.at(0)||null:y&&(C=k.at(-1)||null),f&&(C==null||C.focus()),C}function V6(t,e,n,r=t.length){if(--r===0)return null;const i=t.indexOf(e),s=n.goForward?i+1:i-1;if(!n.loop&&(s<0||s>=t.length))return null;const a=(s+t.length)%t.length,l=t[a];return l?l.hasAttribute("disabled")&&l.getAttribute("disabled")!=="false"?V6(t,l,n,r):l:null}function O1(t){if(t===null||typeof t!="object")return!1;const e=Object.getPrototypeOf(t);return e!==null&&e!==Object.prototype&&Object.getPrototypeOf(e)!==null||Symbol.iterator in t?!1:Symbol.toStringTag in t?Object.prototype.toString.call(t)==="[object Module]":!0}function B1(t,e,n=".",r){if(!O1(e))return B1(t,{},n);const i=Object.assign({},e);for(const s in t){if(s==="__proto__"||s==="constructor")continue;const a=t[s];a!=null&&(Array.isArray(a)&&Array.isArray(i[s])?i[s]=[...a,...i[s]]:O1(a)&&O1(i[s])?i[s]=B1(a,i[s],(n?`${n}.`:"")+s.toString()):i[s]=a)}return i}function IL(t){return(...e)=>e.reduce((n,r)=>B1(n,r,""),{})}const RL=IL(),[xf,hce]=Ht("ConfigProvider");let LL="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict",DL=(t=21)=>{let e="",n=t;for(;n--;)e+=LL[Math.random()*64|0];return e};const PL=B6(()=>{const t=o.ref(new Map),e=o.ref(),n=o.computed(()=>{for(const a of t.value.values())if(a)return!0;return!1}),r=xf({scrollBody:o.ref(!0)});let i=null;const s=()=>{document.body.style.paddingRight="",document.body.style.marginRight="",document.body.style.pointerEvents="",document.body.style.removeProperty("--scrollbar-width"),document.body.style.overflow=e.value??"",I6&&(i==null||i()),e.value=void 0};return o.watch(n,(a,l)=>{var u;if(!pi)return;if(!a){l&&s();return}e.value===void 0&&(e.value=document.body.style.overflow);const c=window.innerWidth-document.documentElement.clientWidth,f={padding:c,margin:0},p=(u=r.scrollBody)!=null&&u.value?typeof r.scrollBody.value=="object"?RL({padding:r.scrollBody.value.padding===!0?c:r.scrollBody.value.padding,margin:r.scrollBody.value.margin===!0?c:r.scrollBody.value.margin},f):f:{padding:0,margin:0};c>0&&(document.body.style.paddingRight=typeof p.padding=="number"?`${p.padding}px`:String(p.padding),document.body.style.marginRight=typeof p.margin=="number"?`${p.margin}px`:String(p.margin),document.body.style.setProperty("--scrollbar-width",`${c}px`),document.body.style.overflow="hidden"),I6&&(i=xl(document,"touchmove",m=>VL(m),{passive:!1})),o.nextTick(()=>{document.body.style.pointerEvents="none",document.body.style.overflow="hidden"})},{immediate:!0,flush:"sync"}),t});function Cf(t){const e=DL(6),n=PL();n.value.set(e,t??!1);const r=o.computed({get:()=>n.value.get(e)??!1,set:i=>n.value.set(e,i)});return kL(()=>{n.value.delete(e)}),r}function F6(t){const e=window.getComputedStyle(t);if(e.overflowX==="scroll"||e.overflowY==="scroll"||e.overflowX==="auto"&&t.clientWidth<t.scrollWidth||e.overflowY==="auto"&&t.clientHeight<t.scrollHeight)return!0;{const n=t.parentNode;return!(n instanceof Element)||n.tagName==="BODY"?!1:F6(n)}}function VL(t){const e=t||window.event,n=e.target;return n instanceof Element&&F6(n)?!1:e.touches.length>1?!0:(e.preventDefault&&e.cancelable&&e.preventDefault(),!1)}const FL="data-radix-vue-collection-item";function Yu(t,e=FL){const n=Symbol();return{createCollection:r=>{const i=o.ref([]);function s(){const a=po(r);return a?i.value=Array.from(a.querySelectorAll(`[${e}]:not([data-disabled])`)):i.value=[]}return o.onBeforeUpdate(()=>{i.value=[]}),o.onMounted(s),o.onUpdated(s),o.watch(()=>r==null?void 0:r.value,s,{immediate:!0}),o.provide(n,i),i},injectCollection:()=>o.inject(n,o.ref([]))}}function aa(t){const e=xf({dir:o.ref("ltr")});return o.computed(()=>{var n;return(t==null?void 0:t.value)||((n=e.dir)==null?void 0:n.value)||"ltr"})}function la(t){const e=o.getCurrentInstance(),n=e==null?void 0:e.type.emits,r={};return n!=null&&n.length||console.warn(`No emitted event found. Please check component: ${e==null?void 0:e.type.__name}`),n==null||n.forEach(i=>{r[o.toHandlerKey(o.camelize(i))]=(...s)=>t(i,...s)}),r}let I1=0;function R1(){o.watchEffect(t=>{if(!pi)return;const e=document.querySelectorAll("[data-radix-focus-guard]");document.body.insertAdjacentElement("afterbegin",e[0]??$6()),document.body.insertAdjacentElement("beforeend",e[1]??$6()),I1++,t(()=>{I1===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(n=>n.remove()),I1--})})}function $6(){const t=document.createElement("span");return t.setAttribute("data-radix-focus-guard",""),t.tabIndex=0,t.style.outline="none",t.style.opacity="0",t.style.position="fixed",t.style.pointerEvents="none",t}function L1(t){return o.computed(()=>{var e;return zo(t)?!!((e=po(t))!=null&&e.closest("form")):!0})}function Nn(t){const e=o.getCurrentInstance(),n=Object.keys((e==null?void 0:e.type.props)??{}).reduce((i,s)=>{const a=(e==null?void 0:e.type.props[s]).default;return a!==void 0&&(i[s]=a),i},{}),r=o.toRef(t);return o.computed(()=>{const i={},s=(e==null?void 0:e.vnode.props)??{};return Object.keys(s).forEach(a=>{i[o.camelize(a)]=s[a]}),Object.keys({...n,...i}).reduce((a,l)=>(r.value[l]!==void 0&&(a[l]=r.value[l]),a),{})})}function Dt(t,e){const n=Nn(t),r=e?la(e):{};return o.computed(()=>({...n.value,...r}))}function De(){const t=o.getCurrentInstance(),e=o.ref(),n=o.computed(()=>{var a,l;return["#text","#comment"].includes((a=e.value)==null?void 0:a.$el.nodeName)?(l=e.value)==null?void 0:l.$el.nextElementSibling:po(e)}),r=Object.assign({},t.exposed),i={};for(const a in t.props)Object.defineProperty(i,a,{enumerable:!0,configurable:!0,get:()=>t.props[a]});if(Object.keys(r).length>0)for(const a in r)Object.defineProperty(i,a,{enumerable:!0,configurable:!0,get:()=>r[a]});Object.defineProperty(i,"$el",{enumerable:!0,configurable:!0,get:()=>t.vnode.el}),t.exposed=i;function s(a){e.value=a,a&&(Object.defineProperty(i,"$el",{enumerable:!0,configurable:!0,get:()=>a instanceof Element?a:a.$el}),t.exposed=i)}return{forwardRef:s,currentRef:e,currentElement:n}}function $L(t,e){const n=R6(!1,300),r=o.ref(null),i=mL();function s(){r.value=null,n.value=!1}function a(l,u){const c=l.currentTarget,f={x:l.clientX,y:l.clientY},p=HL(f,c.getBoundingClientRect()),m=zL(f,p),g=UL(u.getBoundingClientRect()),b=jL([...m,...g]);r.value=b,n.value=!0}return o.watchEffect(l=>{if(t.value&&e.value){const u=f=>a(f,e.value),c=f=>a(f,t.value);t.value.addEventListener("pointerleave",u),e.value.addEventListener("pointerleave",c),l(()=>{var f,p;(f=t.value)==null||f.removeEventListener("pointerleave",u),(p=e.value)==null||p.removeEventListener("pointerleave",c)})}}),o.watchEffect(l=>{var u;if(r.value){const c=f=>{var p,m;if(!r.value)return;const g=f.target,b={x:f.clientX,y:f.clientY},v=((p=t.value)==null?void 0:p.contains(g))||((m=e.value)==null?void 0:m.contains(g)),y=!WL(b,r.value),x=!!g.closest("[data-grace-area-trigger]");v?s():(y||x)&&(s(),i.trigger())};(u=t.value)==null||u.ownerDocument.addEventListener("pointermove",c),l(()=>{var f;return(f=t.value)==null?void 0:f.ownerDocument.removeEventListener("pointermove",c)})}}),{isPointerInTransit:n,onPointerExit:i.on}}function HL(t,e){const n=Math.abs(e.top-t.y),r=Math.abs(e.bottom-t.y),i=Math.abs(e.right-t.x),s=Math.abs(e.left-t.x);switch(Math.min(n,r,i,s)){case s:return"left";case i:return"right";case n:return"top";case r:return"bottom";default:throw new Error("unreachable")}}function zL(t,e,n=5){const r=[];switch(e){case"top":r.push({x:t.x-n,y:t.y+n},{x:t.x+n,y:t.y+n});break;case"bottom":r.push({x:t.x-n,y:t.y-n},{x:t.x+n,y:t.y-n});break;case"left":r.push({x:t.x+n,y:t.y-n},{x:t.x+n,y:t.y+n});break;case"right":r.push({x:t.x-n,y:t.y-n},{x:t.x-n,y:t.y+n});break}return r}function UL(t){const{top:e,right:n,bottom:r,left:i}=t;return[{x:i,y:e},{x:n,y:e},{x:n,y:r},{x:i,y:r}]}function WL(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,a=e.length-1;s<e.length;a=s++){const l=e[s].x,u=e[s].y,c=e[a].x,f=e[a].y;u>r!=f>r&&n<(c-l)*(r-u)/(f-u)+l&&(i=!i)}return i}function jL(t){const e=t.slice();return e.sort((n,r)=>n.x<r.x?-1:n.x>r.x?1:n.y<r.y?-1:n.y>r.y?1:0),qL(e)}function qL(t){if(t.length<=1)return t.slice();const e=[];for(let r=0;r<t.length;r++){const i=t[r];for(;e.length>=2;){const s=e[e.length-1],a=e[e.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))e.pop();else break}e.push(i)}e.pop();const n=[];for(let r=t.length-1;r>=0;r--){const i=t[r];for(;n.length>=2;){const s=n[n.length-1],a=n[n.length-2];if((s.x-a.x)*(i.y-a.y)>=(s.y-a.y)*(i.x-a.x))n.pop();else break}n.push(i)}return n.pop(),e.length===1&&n.length===1&&e[0].x===n[0].x&&e[0].y===n[0].y?e:e.concat(n)}var KL=function(t){if(typeof document>"u")return null;var e=Array.isArray(t)?t[0]:t;return e.ownerDocument.body},El=new WeakMap,Ef=new WeakMap,kf={},D1=0,H6=function(t){return t&&(t.host||H6(t.parentNode))},GL=function(t,e){return e.map(function(n){if(t.contains(n))return n;var r=H6(n);return r&&t.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",t,". Doing nothing"),null)}).filter(function(n){return!!n})},XL=function(t,e,n,r){var i=GL(e,Array.isArray(t)?t:[t]);kf[n]||(kf[n]=new WeakMap);var s=kf[n],a=[],l=new Set,u=new Set(i),c=function(p){!p||l.has(p)||(l.add(p),c(p.parentNode))};i.forEach(c);var f=function(p){!p||u.has(p)||Array.prototype.forEach.call(p.children,function(m){if(l.has(m))f(m);else try{var g=m.getAttribute(r),b=g!==null&&g!=="false",v=(El.get(m)||0)+1,y=(s.get(m)||0)+1;El.set(m,v),s.set(m,y),a.push(m),v===1&&b&&Ef.set(m,!0),y===1&&m.setAttribute(n,"true"),b||m.setAttribute(r,"true")}catch(x){console.error("aria-hidden: cannot operate on ",m,x)}})};return f(e),l.clear(),D1++,function(){a.forEach(function(p){var m=El.get(p)-1,g=s.get(p)-1;El.set(p,m),s.set(p,g),m||(Ef.has(p)||p.removeAttribute(r),Ef.delete(p)),g||p.removeAttribute(n)}),D1--,D1||(El=new WeakMap,El=new WeakMap,Ef=new WeakMap,kf={})}},YL=function(t,e,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(t)?t:[t]),i=KL(t);return i?(r.push.apply(r,Array.from(i.querySelectorAll("[aria-live]"))),XL(r,i,n,"aria-hidden")):function(){return null}};function Sf(t){let e;o.watch(()=>po(t),n=>{n?e=YL(n):e&&e()}),o.onUnmounted(()=>{e&&e()})}let JL=0;function Wr(t,e="radix"){const n=xf({useId:void 0});return ay.useId?`${e}-${ay.useId()}`:n.useId?`${e}-${n.useId()}`:`${e}-${++JL}`}function ZL(t){const e=o.ref(),n=o.computed(()=>{var i;return((i=e.value)==null?void 0:i.width)??0}),r=o.computed(()=>{var i;return((i=e.value)==null?void 0:i.height)??0});return o.onMounted(()=>{const i=po(t);if(i){e.value={width:i.offsetWidth,height:i.offsetHeight};const s=new ResizeObserver(a=>{if(!Array.isArray(a)||!a.length)return;const l=a[0];let u,c;if("borderBoxSize"in l){const f=l.borderBoxSize,p=Array.isArray(f)?f[0]:f;u=p.inlineSize,c=p.blockSize}else u=i.offsetWidth,c=i.offsetHeight;e.value={width:u,height:c}});return s.observe(i,{box:"border-box"}),()=>s.unobserve(i)}else e.value=void 0}),{width:n,height:r}}function z6(t,e){const n=o.ref(t);function r(i){return e[n.value][i]??n.value}return{state:n,dispatch:i=>{n.value=r(i)}}}const QL="data-item-text";function P1(t){const e=R6("",1e3);return{search:e,handleTypeaheadSearch:(n,r)=>{if(!(t!=null&&t.value)&&!r)return;e.value=e.value+n;const i=(t==null?void 0:t.value)??r,s=Un(),a=i.map(p=>{var m;return{ref:p,textValue:((m=(p.querySelector(`[${QL}]`)??p).textContent)==null?void 0:m.trim())??""}}),l=a.find(p=>p.ref===s),u=a.map(p=>p.textValue),c=eD(u,e.value,l==null?void 0:l.textValue),f=a.find(p=>p.textValue===c);return f&&f.ref.focus(),f==null?void 0:f.ref},resetTypeahead:()=>{e.value=""}}}function NL(t,e){return t.map((n,r)=>t[(e+r)%t.length])}function eD(t,e,n){const r=e.length>1&&Array.from(e).every(l=>l===e[0])?e[0]:e,i=n?t.indexOf(n):-1;let s=NL(t,Math.max(i,0));r.length===1&&(s=s.filter(l=>l!==n));const a=s.find(l=>l.toLowerCase().startsWith(r.toLowerCase()));return a!==n?a:void 0}const V1=o.defineComponent({name:"PrimitiveSlot",inheritAttrs:!1,setup(t,{attrs:e,slots:n}){return()=>{var r,i;if(!n.default)return null;const s=wf(n.default()),a=s.findIndex(f=>f.type!==o.Comment);if(a===-1)return s;const l=s[a];(r=l.props)==null||delete r.ref;const u=l.props?o.mergeProps(e,l.props):e;e.class&&(i=l.props)!=null&&i.class&&delete l.props.class;const c=o.cloneVNode(l,u);for(const f in u)f.startsWith("on")&&(c.props||(c.props={}),c.props[f]=u[f]);return s.length===1?c:(s[a]=c,s)}}}),Je=o.defineComponent({name:"Primitive",inheritAttrs:!1,props:{asChild:{type:Boolean,default:!1},as:{type:[String,Object],default:"div"}},setup(t,{attrs:e,slots:n}){const r=t.asChild?"template":t.as;return typeof r=="string"&&["area","img","input"].includes(r)?()=>o.h(r,e):r!=="template"?()=>o.h(t.as,e,{default:n.default}):()=>o.h(V1,e,{default:n.default})}});function U6(){const t=o.ref(),e=o.computed(()=>{var n,r;return["#text","#comment"].includes((n=t.value)==null?void 0:n.$el.nodeName)?(r=t.value)==null?void 0:r.$el.nextElementSibling:po(t)});return{primitiveElement:t,currentElement:e}}function tD(t,e){var n;const r=o.ref({}),i=o.ref("none"),s=o.ref(t),a=t.value?"mounted":"unmounted";let l;const u=((n=e.value)==null?void 0:n.ownerDocument.defaultView)??yf,{state:c,dispatch:f}=z6(a,{mounted:{UNMOUNT:"unmounted",ANIMATION_OUT:"unmountSuspended"},unmountSuspended:{MOUNT:"mounted",ANIMATION_END:"unmounted"},unmounted:{MOUNT:"mounted"}}),p=y=>{var x;if(pi){const E=new CustomEvent(y,{bubbles:!1,cancelable:!1});(x=e.value)==null||x.dispatchEvent(E)}};o.watch(t,async(y,x)=>{var E;const k=x!==y;if(await o.nextTick(),k){const C=i.value,_=_f(e.value);y?(f("MOUNT"),p("enter"),_==="none"&&p("after-enter")):_==="none"||((E=r.value)==null?void 0:E.display)==="none"?(f("UNMOUNT"),p("leave"),p("after-leave")):x&&C!==_?(f("ANIMATION_OUT"),p("leave")):(f("UNMOUNT"),p("after-leave"))}},{immediate:!0});const m=y=>{const x=_f(e.value),E=x.includes(y.animationName),k=c.value==="mounted"?"enter":"leave";if(y.target===e.value&&E&&(p(`after-${k}`),f("ANIMATION_END"),!s.value)){const C=e.value.style.animationFillMode;e.value.style.animationFillMode="forwards",l=u==null?void 0:u.setTimeout(()=>{var _;((_=e.value)==null?void 0:_.style.animationFillMode)==="forwards"&&(e.value.style.animationFillMode=C)})}y.target===e.value&&x==="none"&&f("ANIMATION_END")},g=y=>{y.target===e.value&&(i.value=_f(e.value))},b=o.watch(e,(y,x)=>{y?(r.value=getComputedStyle(y),y.addEventListener("animationstart",g),y.addEventListener("animationcancel",m),y.addEventListener("animationend",m)):(f("ANIMATION_END"),l!==void 0&&(u==null||u.clearTimeout(l)),x==null||x.removeEventListener("animationstart",g),x==null||x.removeEventListener("animationcancel",m),x==null||x.removeEventListener("animationend",m))},{immediate:!0}),v=o.watch(c,()=>{const y=_f(e.value);i.value=c.value==="mounted"?y:"none"});return o.onUnmounted(()=>{b(),v()}),{isPresent:o.computed(()=>["mounted","unmountSuspended"].includes(c.value))}}function _f(t){return t&&getComputedStyle(t).animationName||"none"}const jr=o.defineComponent({name:"Presence",props:{present:{type:Boolean,required:!0},forceMount:{type:Boolean}},slots:{},setup(t,{slots:e,expose:n}){var r;const{present:i,forceMount:s}=o.toRefs(t),a=o.ref(),{isPresent:l}=tD(i,a);n({present:l});let u=e.default({present:l});u=wf(u||[]);const c=o.getCurrentInstance();if(u&&(u==null?void 0:u.length)>1){const f=(r=c==null?void 0:c.parent)!=null&&r.type.name?`<${c.parent.type.name} />`:"component";throw new Error([`Detected an invalid children for \`${f}\` for \`Presence\` component.`,"","Note: Presence works similarly to `v-if` directly, but it waits for animation/transition to finished before unmounting. So it expect only one direct child of valid VNode type.","You can apply a few solutions:",["Provide a single child element so that `presence` directive attach correctly.","Ensure the first child is an actual element instead of a raw text node or comment node."].map(p=>` - ${p}`).join(`
136
136
  `)].join(`
137
137
  `))}return()=>s.value||i.value||l.value?o.h(e.default({present:l})[0],{ref:f=>{const p=po(f);return typeof(p==null?void 0:p.hasAttribute)>"u"||(p!=null&&p.hasAttribute("data-radix-popper-content-wrapper")?a.value=p.firstElementChild:a.value=p),p}}):null}}),[Uo,nD]=Ht("DialogRoot"),rD=o.defineComponent({inheritAttrs:!1,__name:"DialogRoot",props:{open:{type:Boolean,default:void 0},defaultOpen:{type:Boolean,default:!1},modal:{type:Boolean,default:!0}},emits:["update:open"],setup(t,{emit:e}){const n=t,r=kr(n,"open",e,{defaultValue:n.defaultOpen,passive:n.open===void 0}),i=o.ref(),s=o.ref(),{modal:a}=o.toRefs(n);return nD({open:r,modal:a,openModal:()=>{r.value=!0},onOpenChange:l=>{r.value=l},onOpenToggle:()=>{r.value=!r.value},contentId:"",titleId:"",descriptionId:"",triggerElement:i,contentElement:s}),(l,u)=>o.renderSlot(l.$slots,"default",{open:o.unref(r)})}}),oD=o.defineComponent({__name:"DialogTrigger",props:{asChild:{type:Boolean},as:{default:"button"}},setup(t){const e=t,n=Uo(),{forwardRef:r,currentElement:i}=De();return n.contentId||(n.contentId=Wr(void 0,"radix-vue-dialog-content")),o.onMounted(()=>{n.triggerElement.value=i.value}),(s,a)=>(o.openBlock(),o.createBlock(o.unref(Je),o.mergeProps(e,{ref:o.unref(r),type:s.as==="button"?"button":void 0,"aria-haspopup":"dialog","aria-expanded":o.unref(n).open.value||!1,"aria-controls":o.unref(n).open.value?o.unref(n).contentId:void 0,"data-state":o.unref(n).open.value?"open":"closed",onClick:o.unref(n).onOpenToggle}),{default:o.withCtx(()=>[o.renderSlot(s.$slots,"default")]),_:3},16,["type","aria-expanded","aria-controls","data-state","onClick"]))}}),Ju=o.defineComponent({__name:"Teleport",props:{to:{default:"body"},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(t){const e=P6();return(n,r)=>o.unref(e)||n.forceMount?(o.openBlock(),o.createBlock(o.Teleport,{key:0,to:n.to,disabled:n.disabled},[o.renderSlot(n.$slots,"default")],8,["to","disabled"])):o.createCommentVNode("",!0)}}),F1=o.defineComponent({__name:"DialogPortal",props:{to:{},disabled:{type:Boolean},forceMount:{type:Boolean}},setup(t){const e=t;return(n,r)=>(o.openBlock(),o.createBlock(o.unref(Ju),o.normalizeProps(o.guardReactiveProps(e)),{default:o.withCtx(()=>[o.renderSlot(n.$slots,"default")]),_:3},16))}}),iD="dismissableLayer.pointerDownOutside",sD="dismissableLayer.focusOutside";function W6(t,e){const n=e.closest("[data-dismissable-layer]"),r=t.dataset.dismissableLayer===""?t:t.querySelector("[data-dismissable-layer]"),i=Array.from(t.ownerDocument.querySelectorAll("[data-dismissable-layer]"));return!!(n&&r===n||i.indexOf(r)<i.indexOf(n))}function aD(t,e){var n;const r=((n=e==null?void 0:e.value)==null?void 0:n.ownerDocument)??(globalThis==null?void 0:globalThis.document),i=o.ref(!1),s=o.ref(()=>{});return o.watchEffect(a=>{if(!pi)return;const l=async c=>{const f=c.target;if(e!=null&&e.value){if(W6(e.value,f)){i.value=!1;return}if(c.target&&!i.value){let p=function(){O6(iD,t,m)};const m={originalEvent:c};c.pointerType==="touch"?(r.removeEventListener("click",s.value),s.value=p,r.addEventListener("click",s.value,{once:!0})):p()}else r.removeEventListener("click",s.value);i.value=!1}},u=window.setTimeout(()=>{r.addEventListener("pointerdown",l)},0);a(()=>{window.clearTimeout(u),r.removeEventListener("pointerdown",l),r.removeEventListener("click",s.value)})}),{onPointerDownCapture:()=>i.value=!0}}function lD(t,e){var n;const r=((n=e==null?void 0:e.value)==null?void 0:n.ownerDocument)??(globalThis==null?void 0:globalThis.document),i=o.ref(!1);return o.watchEffect(s=>{if(!pi)return;const a=async l=>{e!=null&&e.value&&(await o.nextTick(),!(!e.value||W6(e.value,l.target))&&l.target&&!i.value&&O6(sD,t,{originalEvent:l}))};r.addEventListener("focusin",a),s(()=>r.removeEventListener("focusin",a))}),{onFocusCapture:()=>i.value=!0,onBlurCapture:()=>i.value=!1}}const hi=o.reactive({layersRoot:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),Zu=o.defineComponent({__name:"DismissableLayer",props:{disableOutsidePointerEvents:{type:Boolean,default:!1},asChild:{type:Boolean},as:{}},emits:["escapeKeyDown","pointerDownOutside","focusOutside","interactOutside","dismiss"],setup(t,{emit:e}){const n=t,r=e,{forwardRef:i,currentElement:s}=De(),a=o.computed(()=>{var b;return((b=s.value)==null?void 0:b.ownerDocument)??globalThis.document}),l=o.computed(()=>hi.layersRoot),u=o.computed(()=>s.value?Array.from(l.value).indexOf(s.value):-1),c=o.computed(()=>hi.layersWithOutsidePointerEventsDisabled.size>0),f=o.computed(()=>{const b=Array.from(l.value),[v]=[...hi.layersWithOutsidePointerEventsDisabled].slice(-1),y=b.indexOf(v);return u.value>=y}),p=aD(async b=>{const v=[...hi.branches].some(y=>y==null?void 0:y.contains(b.target));!f.value||v||(r("pointerDownOutside",b),r("interactOutside",b),await o.nextTick(),b.defaultPrevented||r("dismiss"))},s),m=lD(b=>{[...hi.branches].some(v=>v==null?void 0:v.contains(b.target))||(r("focusOutside",b),r("interactOutside",b),b.defaultPrevented||r("dismiss"))},s);TL("Escape",b=>{u.value===l.value.size-1&&(r("escapeKeyDown",b),b.defaultPrevented||r("dismiss"))});let g;return o.watchEffect(b=>{s.value&&(n.disableOutsidePointerEvents&&(hi.layersWithOutsidePointerEventsDisabled.size===0&&(g=a.value.body.style.pointerEvents,a.value.body.style.pointerEvents="none"),hi.layersWithOutsidePointerEventsDisabled.add(s.value)),l.value.add(s.value),b(()=>{n.disableOutsidePointerEvents&&hi.layersWithOutsidePointerEventsDisabled.size===1&&(a.value.body.style.pointerEvents=g)}))}),o.watchEffect(b=>{b(()=>{s.value&&(l.value.delete(s.value),hi.layersWithOutsidePointerEventsDisabled.delete(s.value))})}),(b,v)=>(o.openBlock(),o.createBlock(o.unref(Je),{ref:o.unref(i),"as-child":b.asChild,as:b.as,"data-dismissable-layer":"",style:o.normalizeStyle({pointerEvents:c.value?f.value?"auto":"none":void 0}),onFocusCapture:o.unref(m).onFocusCapture,onBlurCapture:o.unref(m).onBlurCapture,onPointerdownCapture:o.unref(p).onPointerDownCapture},{default:o.withCtx(()=>[o.renderSlot(b.$slots,"default")]),_:3},8,["as-child","as","style","onFocusCapture","onBlurCapture","onPointerdownCapture"]))}}),$1="focusScope.autoFocusOnMount",H1="focusScope.autoFocusOnUnmount",j6={bubbles:!1,cancelable:!0};function uD(t,{select:e=!1}={}){const n=Un();for(const r of t)if(rs(r,{select:e}),Un()!==n)return!0}function cD(t){const e=q6(t),n=K6(e,t),r=K6(e.reverse(),t);return[n,r]}function q6(t){const e=[],n=document.createTreeWalker(t,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const i=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||i?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)e.push(n.currentNode);return e}function K6(t,e){for(const n of t)if(!dD(n,{upTo:e}))return n}function dD(t,{upTo:e}){if(getComputedStyle(t).visibility==="hidden")return!0;for(;t;){if(e!==void 0&&t===e)return!1;if(getComputedStyle(t).display==="none")return!0;t=t.parentElement}return!1}function fD(t){return t instanceof HTMLInputElement&&"select"in t}function rs(t,{select:e=!1}={}){if(t&&t.focus){const n=Un();t.focus({preventScroll:!0}),t!==n&&fD(t)&&e&&t.select()}}const pD=gL(()=>o.ref([]));function hD(){const t=pD();return{add(e){const n=t.value[0];e!==n&&(n==null||n.pause()),t.value=G6(t.value,e),t.value.unshift(e)},remove(e){var n;t.value=G6(t.value,e),(n=t.value[0])==null||n.resume()}}}function G6(t,e){const n=[...t],r=n.indexOf(e);return r!==-1&&n.splice(r,1),n}function mD(t){return t.filter(e=>e.tagName!=="A")}const Tf=o.defineComponent({__name:"FocusScope",props:{loop:{type:Boolean,default:!1},trapped:{type:Boolean,default:!1},asChild:{type:Boolean},as:{}},emits:["mountAutoFocus","unmountAutoFocus"],setup(t,{emit:e}){const n=t,r=e,{currentRef:i,currentElement:s}=De(),a=o.ref(null),l=hD(),u=o.reactive({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}});o.watchEffect(f=>{if(!pi)return;const p=s.value;if(!n.trapped)return;function m(y){if(u.paused||!p)return;const x=y.target;p.contains(x)?a.value=x:rs(a.value,{select:!0})}function g(y){if(u.paused||!p)return;const x=y.relatedTarget;x!==null&&(p.contains(x)||rs(a.value,{select:!0}))}function b(y){p.contains(a.value)||rs(p)}document.addEventListener("focusin",m),document.addEventListener("focusout",g);const v=new MutationObserver(b);p&&v.observe(p,{childList:!0,subtree:!0}),f(()=>{document.removeEventListener("focusin",m),document.removeEventListener("focusout",g),v.disconnect()})}),o.watchEffect(async f=>{const p=s.value;if(await o.nextTick(),!p)return;l.add(u);const m=Un();if(!p.contains(m)){const g=new CustomEvent($1,j6);p.addEventListener($1,b=>r("mountAutoFocus",b)),p.dispatchEvent(g),g.defaultPrevented||(uD(mD(q6(p)),{select:!0}),Un()===m&&rs(p))}f(()=>{p.removeEventListener($1,v=>r("mountAutoFocus",v));const g=new CustomEvent(H1,j6),b=v=>{r("unmountAutoFocus",v)};p.addEventListener(H1,b),p.dispatchEvent(g),setTimeout(()=>{g.defaultPrevented||rs(m??document.body,{select:!0}),p.removeEventListener(H1,b),l.remove(u)},0)})});function c(f){if(!n.loop&&!n.trapped||u.paused)return;const p=f.key==="Tab"&&!f.altKey&&!f.ctrlKey&&!f.metaKey,m=Un();if(p&&m){const g=f.currentTarget,[b,v]=cD(g);b&&v?!f.shiftKey&&m===v?(f.preventDefault(),n.loop&&rs(b,{select:!0})):f.shiftKey&&m===b&&(f.preventDefault(),n.loop&&rs(v,{select:!0})):m===g&&f.preventDefault()}}return(f,p)=>(o.openBlock(),o.createBlock(o.unref(Je),{ref_key:"currentRef",ref:i,tabindex:"-1","as-child":f.asChild,as:f.as,onKeydown:c},{default:o.withCtx(()=>[o.renderSlot(f.$slots,"default")]),_:3},8,["as-child","as"]))}}),gD="menu.itemSelect",z1=["Enter"," "],bD=["ArrowDown","PageUp","Home"],X6=["ArrowUp","PageDown","End"],vD=[...bD,...X6];[...z1],[...z1];function Y6(t){return t?"open":"closed"}function Af(t){return t==="indeterminate"}function J6(t){return Af(t)?"indeterminate":t?"checked":"unchecked"}function U1(t){const e=Un();for(const n of t)if(n===e||(n.focus(),Un()!==e))return}function yD(t,e){const{x:n,y:r}=t;let i=!1;for(let s=0,a=e.length-1;s<e.length;a=s++){const l=e[s].x,u=e[s].y,c=e[a].x,f=e[a].y;u>r!=f>r&&n<(c-l)*(r-u)/(f-u)+l&&(i=!i)}return i}function wD(t,e){if(!e)return!1;const n={x:t.clientX,y:t.clientY};return yD(n,e)}function W1(t){return t.pointerType==="mouse"}const xD="DialogTitle",CD="DialogContent";function ED({titleName:t=xD,contentName:e=CD,componentLink:n="dialog.html#title",titleId:r,descriptionId:i,contentElement:s}){const a=`Warning: \`${e}\` requires a \`${t}\` for the component to be accessible for screen reader users.
138
138
 
@@ -342,7 +342,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),X=R,q=H),L===void 0&&(
342
342
  `}),O=getComputedStyle(b.value);k.font=O.font;const M=20,$=()=>Math.max(0,(v.value||0)-M);function V(F,R){let H=1,L=F.length,q=0;for(;H<=L;){const X=Math.floor((H+L)/2);k.measureText(F.slice(0,X)).width<=R?(q=X,H=X+1):L=X-1}return q}let G="";const ee=[];for(const F of D){if(F===`
343
343
  `){ee.push(G),G="";continue}if(G+=F,k.measureText(G).width>$())for(;k.measureText(G).width>$();){const R=V(G,$());R<=0?(ee.push(G.charAt(0)),G=G.slice(1)):(ee.push(G.slice(0,R)),G=G.slice(R))}}return ee.push(G),ee.map(F=>`<p>${F}</p>`).join("")}const _=o.computed(()=>{var O,M,$;const D=($=(M=(O=r.parentEditor)==null?void 0:O.storage.superText.superInputModal)==null?void 0:M.props)==null?void 0:$.guidelineLeftOffset;return s.value||!D?{}:{backgroundImage:"linear-gradient(to right, #d1d5db 1px, transparent 1px)",backgroundSize:"1px 100%",backgroundRepeat:"no-repeat",backgroundPosition:rn(D)}}),{isScrolling:T,handleScroll:A}=Xl();return e({insertSpecialCharater:m,isChecked:u,toggleSpellCheck:g,wrapText:C,editor:p}),(D,O)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"contentInner",ref:b,style:o.normalizeStyle([o.unref(x),o.unref(_)]),onScroll:O[0]||(O[0]=(...M)=>o.unref(A)&&o.unref(A)(...M)),class:o.normalizeClass(o.unref(Se)("h-40 overflow-y-auto border focus-within:border-ed-input-focus rounded-[3px] p-2.5 relative",D.isReadOnly&&"border-none",o.unref(s)&&"h-auto min-h-20 max-h-44 border-ed-gray rounded-md px-4 py-2.5",o.unref(s)&&!o.unref(T)&&"scrollbar-thumb-transparent"))},[o.createVNode(o.unref(Qn),{id:"editor-panel",editor:o.unref(p),class:o.normalizeClass(o.unref(Se)("vdc-editor relative h-full"))},null,8,["editor","class"])],38))}}),KJ={class:"sr-only"},GJ={class:"grid m-2.5 p-2.5 gap-y-2.5 rounded border border-gray-200"},XJ={class:"grid grid-cols-[60px,1fr] gap-x-2"},YJ={class:"flex items-center space-x-2 text-xs font-normal [&>input[type='checkbox']]:h-[20px] [&>input[type='checkbox']]:w-[20px] [&>input[type='checkbox']]:!border-ed-border [&>input[type='checkbox']]:shadow"},JJ=["checked"],ZJ={for:"spellcheck",class:"select-none whitespace-nowrap"},QJ={class:"flex gap-x-1"},NJ={class:"ml-auto"},eZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},tZ={class:"text-right text-sm p-2"},nZ={class:"grid grid-cols-[60px,1fr] gap-x-2"},ck=5,Wc=o.defineComponent({__name:"SuperInputDialog",props:{editor:{},open:{type:Boolean},superTextInit:{},superTextElementId:{}},emits:["close","save"],setup(t,{emit:e}){var F,R;const n=e,r=t,{t:i}=Tt(),s=o.ref(""),a=o.ref(""),l=o.ref(null),u=o.ref(!1),c=Ne.useLocalStorage("superInputModalPosition",null),f=o.reactive({x:0,y:0}),p=o.ref(!1),m={x:0,y:0},g=o.ref(!1),b=o.ref(!1),v=o.ref(!1),y=H=>{p.value=!0;const L=H.currentTarget.closest(".draggable-dialog").getBoundingClientRect();m.x=H.clientX-L.left,m.y=H.clientY-L.top,document.addEventListener("mousemove",x),document.addEventListener("mouseup",E)},x=H=>{p.value&&(f.x=H.clientX-m.x,f.y=H.clientY-m.y)},E=()=>{p.value=!1,c.value={x:f.x,y:f.y},document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",E)};o.watch(()=>r.open,async H=>{if(!H)return;b.value=!1,r.superTextInit&&(s.value=r.superTextInit,r.superTextElementId&&(a.value=r.superTextElementId)),await o.nextTick();const L=document.querySelector(".draggable-dialog");if(!L)return;L.getBoundingClientRect();const q=window.innerWidth,X=window.innerHeight;c.value&&c.value.x!==void 0&&c.value.y!==void 0?(f.x=c.value.x,f.y=c.value.y):(f.x=Math.max((q-L.offsetWidth)/2,0),f.y=Math.max((X-L.offsetHeight)/2,0))});const k=()=>{n("close"),s.value="",a.value="",u.value=!1},C=()=>{var L;if((L=l.value)==null?void 0:L.editor.commands.hasInvalidChar()){v.value=!0;return}s.value=l.value.wrapText(),a.value="",b.value?g.value=!0:n("close"),n("save",s.value),s.value=""},_=()=>{g.value=!1,n("close")},T=(R=(F=r.editor)==null?void 0:F.extensionManager.extensions.find(H=>H.name==="superText"))==null?void 0:R.options.specialCharModal,A=o.inject("fontFamily",""),D=o.computed(()=>{var H,L,q;return np(r.editor,uc)&&o.unref(A)?o.unref(A):(q=(L=(H=r.editor)==null?void 0:H.storage.superText.superInputModal)==null?void 0:L.props)==null?void 0:q.fontFamily}),O=Ne.useLocalStorage("recentSpecialChars",[]),M=H=>{if(!H)return;const L=(O.value??[]).filter(q=>q!==H);L.unshift(H),O.value=L.slice(0,ck)},$=H=>{var L;(L=l.value)==null||L.insertSpecialCharater(H)},V=(H,L)=>{var q;L&&((q=l.value)==null||q.insertSpecialCharater(H),M(H))},G=o.computed(()=>{var H;return(H=l.value)==null?void 0:H.isChecked}),ee=()=>{var H;(H=l.value)==null||H.toggleSpellCheck()};o.onUnmounted(()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",E)}),o.watch(s,H=>{!r.superTextElementId||r.superTextElementId===""||(b.value=H!==(r.superTextInit??""))});const W=o.computed(()=>{var H;return(H=l.value)==null?void 0:H.editor});return(H,L)=>{const q=dh,X=ch,le=uh,pe=lh,_e=lk,re=iv,be=Vc,Y=Pc,te=SX;return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(Y,{open:H.open},{default:o.withCtx(()=>[o.createVNode(o.unref(F1),null,{default:o.withCtx(()=>[o.createVNode(o.unref(j1),{class:"!pointer-events-none bg-black/30"}),o.createVNode(be,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none max-w-max","as-child":""},{default:o.withCtx(()=>{var ne,oe;return[o.createElementVNode("div",{class:"draggable-dialog fixed z-[70] pointer-events-auto",style:o.normalizeStyle({top:"0px",left:"0px",transform:`translate(${f.x}px, ${f.y}px)`,fontFamily:o.unref(D)})},[o.createVNode(le,{class:"bg-blue-500 text-white p-2.5 rounded-t-[5px] cursor-move",onMousedown:o.withModifiers(y,["prevent"])},{default:o.withCtx(()=>[o.createVNode(q,null,{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.superinput")),1)]),_:1}),o.createVNode(X,{class:"absolute right-3 top-3 text-white",onClick:k},{default:o.withCtx(()=>[o.createVNode(o.unref(kc),{class:"w-5 h-5"}),o.createElementVNode("span",KJ,o.toDisplayString(H.$t("editor.close")),1)]),_:1})]),_:1}),o.createVNode(pe),o.createElementVNode("div",GJ,[o.createElementVNode("div",XJ,[L[5]||(L[5]=o.createElementVNode("label",null," ",-1)),o.createElementVNode("div",{class:o.normalizeClass(o.unref(Se)("flex gap-x-6",o.unref(O).length===ck&&"gap-x-4"))},[o.createVNode(vn,{class:"text-[#65558F] bg-[#ECE6F0] hover:bg-[#ECE6F0]/90 shadow text-xs rounded font-normal h-[25px] px-3",onClick:L[0]||(L[0]=ce=>u.value=!0)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.insert.symbol")),1)]),_:1}),o.createElementVNode("div",YJ,[o.createElementVNode("input",{id:"spellcheck",type:"checkbox",class:"shrink-0",checked:o.unref(G),onChange:ee},null,40,JJ),o.createElementVNode("label",ZJ,o.toDisplayString(o.unref(i)("editor.menubar.menu.spellCheck")),1)]),o.createElementVNode("div",QJ,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(o.unref(O),ce=>(o.openBlock(),o.createBlock(vn,{key:ce,variant:"outline",size:"xs",class:"h-[25px] w-[25px] p-0",onClick:Ae=>$(ce)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(ce),1)]),_:2},1032,["onClick"]))),128))]),o.createElementVNode("div",NJ,[o.unref(W)?(o.openBlock(),o.createBlock(_e,{key:0,editor:o.unref(W),isEnableSpellCheckRealTime:(ne=o.unref(W))==null?void 0:ne.extensionStorage.spellchecker.spellchecker.proofreader.enabled,align:"left"},null,8,["editor","isEnableSpellCheckRealTime"])):o.createCommentVNode("",!0)])],2),u.value?(o.openBlock(),o.createBlock(o.resolveDynamicComponent((oe=o.unref(T))==null?void 0:oe.component),o.mergeProps({key:0,"custom-class":"!z-[70] !pointer-events-auto","font-family":o.unref(D)},o.unref(T).props,{onSelectedChar:V,onClose:L[1]||(L[1]=ce=>u.value=!1)}),null,16,["font-family"])):o.createCommentVNode("",!0)]),o.createElementVNode("div",eZ,[o.createElementVNode("label",tZ,o.toDisplayString(o.unref(i)("editor.detail")),1),o.createVNode(Ev,{ref_key:"simpleEditorRef",ref:l,modelValue:s.value,"onUpdate:modelValue":L[2]||(L[2]=ce=>s.value=ce),"parent-editor":H.editor,class:""},null,8,["modelValue","parent-editor"])]),o.createElementVNode("div",nZ,[L[6]||(L[6]=o.createElementVNode("label",{class:"text-right text-sm p-2"},"ID",-1)),o.createVNode(hs,{modelValue:a.value,"onUpdate:modelValue":L[3]||(L[3]=ce=>a.value=ce),class:"rounded-none","default-value":a.value,disabled:""},null,8,["modelValue","default-value"])])]),o.createVNode(re,{class:"sm:justify-center pb-3.5 pt-1"},{default:o.withCtx(()=>[o.createVNode(vn,{as:"button",variant:"default",class:"bg-blue-500 hover:bg-blue-500/90",onClick:C},{default:o.withCtx(()=>[o.createVNode(o.unref(cb),{class:"w-5 h-5 mr-2"}),o.createTextVNode(" "+o.toDisplayString(o.unref(i)("editor.check")),1)]),_:1}),o.createVNode(vn,{as:"button",variant:"destructive",onClick:k},{default:o.withCtx(()=>[o.createVNode(o.unref(kc),{class:"w-5 h-5 mr-2"}),o.createTextVNode(" "+o.toDisplayString(H.$t("editor.close")),1)]),_:1})]),_:1})],4)]}),_:1})]),_:1})]),_:1},8,["open"]),o.createVNode(te,{open:g.value,onClose:_},null,8,["open"]),o.createVNode(te,{title:"Information",message:"{ 과 } 는 입력이 제한된 문자열 입니다.",iconName:"MessageCircleWarning",confirmText:"Ok",open:v.value,onClose:L[4]||(L[4]=ne=>v.value=!1)},null,8,["open"])],64)}}}),kv=o.defineComponent({__name:"SelectContextMenu",props:{editor:{},mode:{},superTextStore:{},disabled:{type:Boolean},disableSuperInput:{type:Boolean}},setup(t,{expose:e}){const n=t,{t:r}=Tt(),i=o.ref(!1),s=o.reactive({from:0,to:0,text:""}),a=o.inject("isEditable",o.ref(!0)),l=o.inject("canEditSuper",o.ref(!0)),u=o.computed(()=>n.mode===Me.EDITOR||n.mode===Me.PLAIN_TEXT||!l.value||n.disableSuperInput);function c(){if(!n.editor)return"";const{from:E,to:k}=n.editor.state.selection,C=n.editor.state.doc.cut(E,k),T=Pr.fromSchema(n.editor.schema).serializeFragment(C.content),A=document.createElement("div");return A.appendChild(T),A.innerHTML}const f=()=>{const{view:E}=n.editor,{from:k,to:C}=E.state.selection,_=c();s.text=_,s.from=k,s.to=C},p=()=>i.value=!i.value,m=()=>{u.value||(i.value=!0,f())},g=()=>i.value=!1,b=E=>{const k=n==null?void 0:n.superTextStore.addMoreSuperText(E);n.editor&&n.editor.commands.insertContentAt(s.from,{type:"superText",attrs:{"data-id":k,"data-text":E}}),i.value=!1,requestAnimationFrame(()=>{n.editor.commands.setTextSelection(s.from+1),n.editor.view.focus()})},v=o.ref(!1),y=async E=>{var k,C;if(E){const _=await((C=(k=n.editor).hasClipboard)==null?void 0:C.call(k));v.value=!!_}},x=()=>{if(u.value||!n.editor)return;const{view:E,state:k}=n.editor,{from:C,to:_}=k.selection;s.from=C,s.to=_,s.text="",E.dom.blur(),i.value=!0};return e({toggleDialog:p,openDialog:m,closeDialog:g}),(E,k)=>{const C=Wc,_=ov,T=rv,A=nv,D=tv;return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(C,{open:i.value,editor:E.editor,"super-text-init":s.text,onClose:p,onSave:b},null,8,["open","editor","super-text-init"]),o.createVNode(D,{"onUpdate:open":y},{default:o.withCtx(()=>[o.createVNode(_,{as:"template",class:"relative",disabled:o.unref(u),onDblclick:o.withModifiers(x,["prevent","stop"])},{default:o.withCtx(()=>[o.renderSlot(E.$slots,"default")]),_:3},8,["disabled"]),o.createVNode(A,null,{default:o.withCtx(()=>[E.disableSuperInput?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(T,{key:0,onSelect:m},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r)("editor.inputSuper")),1)]),_:1})),o.unref(a)?(o.openBlock(),o.createBlock(T,{key:1,onSelect:k[0]||(k[0]=O=>{var M;return(M=E.editor)==null?void 0:M.commands.cutContent()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r)("editor.cut")),1)]),_:1})):o.createCommentVNode("",!0),o.unref(a)?(o.openBlock(),o.createBlock(T,{key:2,onSelect:k[1]||(k[1]=O=>{var M;return(M=E.editor)==null?void 0:M.commands.copyContent()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r)("editor.copy")),1)]),_:1})):o.createCommentVNode("",!0),o.unref(a)?(o.openBlock(),o.createBlock(T,{key:3,disabled:!v.value,onSelect:k[2]||(k[2]=O=>{var M;return(M=E.editor)==null?void 0:M.commands.pasteContent()})},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r)("editor.paste")),1)]),_:1},8,["disabled"])):o.createCommentVNode("",!0)]),_:1})]),_:3})],64)}}}),rZ={id:"editor-panel",class:"flex relative w-full h-full"},oZ=uo(o.defineComponent({__name:"PageNode",props:na,setup(t){const{state:e,page:n,superTextStore:r}=xn(),{size:i,pagination:s,margin:a}=n.value,l=o.ref(null),u=o.ref(t.node.attrs.viewSuperTextArea),c=o.computed(()=>u.value&&t.editor.storage.page.mode!=="editor"),f=o.computed(()=>t.editor.storage.page.mode===Me.REPORT),{width:p,height:m}=i,g=o.computed(()=>s?`calc(${m} - ${(a==null?void 0:a.top)??0} - ${(a==null?void 0:a.bottom)??0}`:"max-content"),b=Ne.useEventBus(fr.SUPER_VIEW_PAGE);return o.watch(()=>t.node.attrs,v=>{b.emit(v.pageNumber)},{immediate:!0}),(v,y)=>{var E,k,C,_;const x=kv;return o.openBlock(),o.createBlock(o.unref(ta),{id:v.node.attrs.id,ref_key:"containerRef",ref:l,"page-number":v.node.attrs.pageNumber,class:"overflow-hidden umo-page-node-view w-full border rounded-[3px] border-[#999999]",style:o.normalizeStyle({"--umo-page-margin-top":((E=o.unref(a))==null?void 0:E.top)??"0","--umo-page-margin-bottom":((k=o.unref(a))==null?void 0:k.bottom)??"0","--umo-page-margin-left":((C=o.unref(a))==null?void 0:C.left)??"0","--umo-page-margin-right":((_=o.unref(a))==null?void 0:_.right)??"0","--umo-page-width":o.unref(p),"--umo-page-height":o.unref(m),"--empty-node-left":"0px",left:100,"min-height":typeof o.unref(m)=="number"?`${o.unref(m)}px`:o.unref(m),height:f.value?typeof o.unref(m)=="number"?`${o.unref(m)}px`:o.unref(m):"auto"})},{default:o.withCtx(()=>[o.createElementVNode("div",rZ,[o.createVNode(x,{mode:c.value?o.unref(Me).REPORT:o.unref(Me).EDITOR,editor:v.editor,"super-text-store":o.unref(r)},{default:o.withCtx(()=>[o.createVNode(o.unref(e6),{class:"umo-page-node-content",style:o.normalizeStyle({height:g.value})},null,8,["style"])]),_:1},8,["mode","editor","super-text-store"])])]),_:1},8,["id","page-number","style"])}}}),[["__scopeId","data-v-7d55d7ea"]]);function dk(t,e){const n=t.storedMarks??(t.selection.$to.parentOffset&&t.selection.$from.marks());if(n){const r=n.filter(i=>e==null?void 0:e.includes(i.type.name));t.tr.ensureMarks(r)}}const iZ=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:s,doc:a}=e,{$from:l,$to:u}=s,c=i.extensionManager.attributes,f=kh(c,l.node().type.name,l.node().attrs);if(f.id=ev(),f.extend&&(f.extend=!1),s instanceof Ve&&s.node.isBlock)return!l.parentOffset||!yr(a,l.pos)?!1:(r&&(t&&dk(n,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;if(r){const p=u.parentOffset===u.parent.content.size;s instanceof Pe&&e.deleteSelection();const m=l.depth===0?void 0:e4(l.node(-1).contentMatchAt(l.indexAfter(-1)));let g=p&&m?[{type:m,attrs:f}]:void 0,b=yr(e.doc,e.mapping.map(l.pos),1,g);if(!g&&!b&&yr(e.doc,e.mapping.map(l.pos),1,m?[{type:m}]:void 0)&&(b=!0,g=m?[{type:m,attrs:f}]:void 0),b&&(g||(g=[{type:l.node().type,attrs:f}]),e.split(e.mapping.map(l.pos),1,g),m&&!p&&!l.parentOffset&&l.parent.type!==m)){const v=e.mapping.map(l.before()),y=e.doc.resolve(v);l.node(-1).canReplaceWith(y.index(),y.index()+1,m)&&e.setNodeMarkup(e.mapping.map(l.before()),m)}t&&dk(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return!0},sZ=t=>({tr:e,state:n,dispatch:r,editor:i})=>{var v;const s=yn(t,n.schema),{$from:a,$to:l}=n.selection,u=n.selection instanceof Ve?n.selection.node:null;if(u!=null&&u.isBlock||a.depth<2||!a.sameParent(l))return!1;const c=a.node(-1);if(c.type!==s)return!1;const f=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==s||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let y=ge.empty;const x=a.index(-1)?1:a.index(-2)?2:3;for(let A=a.depth-x;A>=a.depth-3;A-=1)y=ge.from(a.node(A).copy(y));const E=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k=kh(f,a.node().type.name,a.node().attrs),C=((v=s.contentMatch.defaultType)==null?void 0:v.createAndFill(k))??void 0;y=y.append(ge.from(s.createAndFill(null,C)??void 0));const _=a.before(a.depth-(x-1));e.replace(_,a.after(-E),new Te(y,4-x,0));let T=-1;e.doc.nodesBetween(_,e.doc.content.size,(A,D)=>{if(T>-1)return!1;A.isTextblock&&A.content.size===0&&(T=D+1)}),T>-1&&e.setSelection(Pe.near(e.doc.resolve(T))),e.scrollIntoView()}return!0}const p=l.pos===a.end()?c.contentMatchAt(0).defaultType:null,m=kh(f,c.type.name,c.attrs),g=kh(f,a.node().type.name,a.node().attrs);m.id=ev(),g.id=ev(),e.delete(a.pos,l.pos);const b=p?[{type:s,attrs:m},{type:p,attrs:g}]:[{type:s,attrs:m}];if(!yr(e.doc,a.pos,2))return!1;if(r){const{selection:y,storedMarks:x}=n,{splittableMarks:E}=i.extensionManager,k=x??(y.$to.parentOffset&&y.$from.marks());if(e.split(a.pos,2,b).scrollIntoView(),!k||!r)return!0;const C=k.filter(_=>E.includes(_.type.name));e.ensureMarks(C)}return!0},aZ=[Yf,Xf,Jf,_g,Zf,ds,Ag,Bl,Og,Ig,Mg,ma,Il,bi,Bg,Rg,Tg,Gr],lZ=Lt.create({priority:200,name:`${Gr}`,content:"block*",group:`${Gr}`,isolating:!0,selectable:!1,draggable:!1,isLeaf:!0,addOptions(){return{SystemAttributes:{},nodesComputed:{},View:ra(oZ),types:[],slots:{}}},addAttributes(){return{HTMLAttributes:{},id:{default:Xr(10)},pageNumber:{default:1},force:{default:!1},viewSuperTextArea:{default:!0},slots:{default:this.options.slots,renderHTML:()=>({})}}},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){return["div",{...yt(e),"data-type":this.name},0]},addCommands(){return{splitBlock:iZ,splitListItem:sZ,autoPaging:(t=!0)=>({tr:e,state:n,dispatch:r,editor:i})=>(r&&e.setMeta("runState",t),!0),setPageBreak:()=>({tr:t,state:e,dispatch:n,editor:r})=>(n&&t.setMeta("splitPage",!0),!0),togglePagePlugin:t=>({tr:e,dispatch:n})=>(e.setMeta("disablePage",t),n&&n(e),!0)}},addGlobalAttributes(){return[{types:aZ.concat(this.options.types||[]),attributes:{id:{default:null},extend:{default:!1}}}]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.first(({commands:r})=>[()=>r.undoInputRule(),()=>r.command(({tr:i})=>{const{selection:s,doc:a}=i,{empty:l,$anchor:u}=s,{pos:c,parent:f}=u,p=je.atStart(a).from===c;return!l||!p||!f.type.isTextblock||f.textContent.length?!1:r.clearNodes()}),()=>fk(r),()=>r.joinBackward(),()=>r.selectNodeBackward(),()=>r.command(({editor:i,tr:s})=>{const{selection:a,doc:l}=s,{$anchor:u}=a,{pos:c}=u;if(l.childCount===1)return!1;if(je.atEnd(l).from===c&&!u.parentOffset)return r.deleteNode(Gr);const f=li(p=>p.type.name===Gr)(a);if(f){if(!f.node.firstChild)return r.deleteNode(Gr);const p=f.node.firstChild.type;if(f.start+je.atStart(f.node).from===c){const g=Pe.create(l,f.start-2,f.start-2),b=li(v=>v.type.name===Gr)(g);if(b){const v=je.atEnd(b.node).from+b.start,y=Pe.create(l,v,v);if(p===b.node.lastChild.type){const{parent:x}=y.$anchor;return yX(x,i.schema)?s.setSelection(y):s.step(new gn(v,c,Te.empty)),!0}s.setSelection(y)}return!0}}return!1})]),Delete:()=>this.editor.commands.first(({commands:r})=>[()=>fk(r),()=>r.command(({tr:i})=>{const{selection:s,doc:a}=i,{$anchor:l}=s,u=l.node(),c=li(f=>f.type.name===Bl)(s);return c&&c.start+je.atStart(c.node).from===l.pos&&c.node.childCount===1&&u.content.size===0?!0:r.joinForward()}),()=>r.selectNodeForward(),()=>r.command(({tr:i})=>{const{selection:s,doc:a}=i,{$anchor:l}=s,{pos:u}=l;if(a.childCount===1)return!1;if(je.atEnd(a).from===u)return r.deleteNode(Gr);const c=li(f=>f.type.name===Gr)(s);if(c&&c.start+je.atEnd(c.node).from===u){const p=Pe.create(a,u+2,u+2),m=li(g=>g.type.name===Gr)(p);if(m){const g=je.atStart(m.node).from+m.start,b=Pe.create(a,g,g);if(li(y=>y.attrs.extend)(b))return i.step(new gn(u,g,Te.empty)),!0}}return!1})]),Tab:()=>this.editor.commands.first(({commands:r})=>[()=>!0]),"Mod-Enter":()=>this.editor.commands.setPageBreak()}},addNodeView(){return this.options.View}});function kh(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(s=>s.type===e&&s.name===r);return i?i.attribute.keepOnSplit:!1}))}const fk=t=>t.command(({tr:e})=>{const{selection:n,doc:r}=e,i=t4(r,{from:n.from,to:n.to},s=>s.type.name===Bl);for(const s of i){const a=s.pos+s.node.nodeSize;if(n.from<s.pos||n.to>a)return!0}return t.deleteSelection()}),uZ=et.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:t=>t.style.fontFamily,renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),cZ=["data-font"],dZ=o.defineComponent({__name:"FontFamilyMenuButton",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},shortcutKeys:{default:void 0},maxHeight:{default:void 0},tooltip:{default:""},items:{default:()=>[]},customClass:{default:""},showDefaultDivider:{type:Boolean,default:!1}},setup(t){const e=t,n=o.computed(()=>e.editor.extensionStorage["base-kit"].mode===Me.EDITOR),{t:r}=Tt(),i=[{label:r("editor.fontFamily.gulim"),value:"Gulim"},{label:r("editor.fontFamily.dotum"),value:"Dotum"},{label:r("editor.fontFamily.gungsuh"),value:"Gungsuh"}],s=o.inject("fontFamily"),a=o.computed(()=>{const p=e.editor.extensionManager.extensions.find(g=>g.name==="fontFamily").options;let m=[];return kt.isEmpty(p.fontFamilyList)?m=i:m=p.fontFamilyList.filter(g=>g.enabled!==!1).map(g=>({label:g.label,value:g.value})),[{label:r("editor.fontFamily.default"),value:r("editor.fontFamily.default")},...m]}),l=o.computed(()=>{const p={label:r("editor.fontFamily.default"),value:r("editor.fontFamily.default")};return n.value?L0(e.editor.state,"textStyle").fontFamily||p.value:s.value||p.value}),u=Ne.useEventBus("fontFamily");function c(p){p.value===l.value||p.value===r("editor.fontFamily.default")?(e.editor.chain().focus().unsetFontFamily().run(),s.value=null):(s.value=p.value,e.editor.chain().focus().setFontFamily(p.value).run(),u.emit()),e.editor.commands.setForceCloseBubble(!0)}e.editor.on("selectionUpdate",({editor:p})=>{p.state.selection.empty&&e.editor.commands.resetForceCloseBubble()});const f=o.computed(()=>{var m,g;const p=((m=a.value[0])==null?void 0:m.label)||r("editor.fontFamily.default");return((g=a.value.find(b=>b.value===l.value))==null?void 0:g.label)||p});return(p,m)=>(o.openBlock(),o.createBlock(ka,{disabled:p.disabled,tooltip:p.tooltip,title:f.value,btn_class:`min-w-20 ${p.customClass}`,class:"inside-toolbar"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(a.value,(g,b)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:b},[o.createVNode(o.unref($l),{checked:l.value===g.value,onClick:v=>c(g)},{default:o.withCtx(()=>[o.createElementVNode("span",{class:"ml-1 h-full","data-font":g.label,style:o.normalizeStyle({fontFamily:g.value??void 0})},o.toDisplayString(g.label),13,cZ)]),_:2},1032,["checked","onClick"]),g.label===o.unref(r)("editor.fontFamily.default")&&p.showDefaultDivider?(o.openBlock(),o.createBlock(o.unref(pb),{key:0})):o.createCommentVNode("",!0)],64))),128))]),_:1},8,["disabled","tooltip","title","btn_class"]))}}),pk=uZ.extend({name:"fontFamily",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["textStyle"],fontFamilyList:[],button({editor:e,extension:n,t:r}){return{component:dZ,componentProps:{editor:e,disabled:!e.can().setFontFamily(""),tooltip:r("editor.fontFamily.tooltip")}}}}},addGlobalAttributes(){return[{types:["paragraph","heading","textStyle"],attributes:{style:{default:null,parseHTML:t=>t.style.fontFamily||null,renderHTML:t=>t.style?{style:`font-family: ${t.style}`}:{}},fontFamily:{default:null,parseHTML:t=>t.style.fontFamily.replace(/['"]/g,""),renderHTML:t=>t.fontFamily?{style:`font-family: ${t.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:t=>({chain:e})=>e().setMark("textStyle",{fontFamily:t}).run(),unsetFontFamily:()=>({chain:t})=>t().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}},addStorage(){return{value:null}},onUpdate(){this.storage.value=this.editor.getAttributes("textStyle").fontFamily}}),fZ=et.create({name:"fontWeight",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["textStyle"]}},addGlobalAttributes(){return[{types:["paragraph","textStyle"],attributes:{fontWeight:{default:null,parseHTML:t=>t.style.fontWeight||null,renderHTML:t=>t.fontWeight?{style:`font-weight: ${t.fontWeight}`}:{}}}}]},addCommands(){return{setFontWeight:t=>({chain:e})=>e().setMark("textStyle",{fontWeight:t}).run(),unsetFontWeight:()=>({chain:t})=>t().setMark("textStyle",{fontWeight:null}).removeEmptyTextStyle().run()}},addStorage(){return{value:null}},onUpdate(){this.storage.value=this.editor.getAttributes("textStyle").fontWeight}}),pZ={class:"flex gap-2"},hZ=["disabled"],mZ=uo(o.defineComponent({__name:"FontSizeIncreaseDecrease",props:{editor:Object},setup(t){const e=o.inject("fontSize"),n=o.computed(()=>e.value?parseInt(e.value)===parseInt(l1[0])||parseInt(e.value)<parseInt(l1[0]):!1),r=Ne.useEventBus(fr.INCREASE_DECREASE_FONTSIZE),i=s=>{r.emit(s)};return(s,a)=>{const l=va,u=ba,c=ya;return o.openBlock(),o.createElementBlock("div",pZ,[o.createVNode(c,null,{default:o.withCtx(()=>[o.createVNode(u,{"delay-duration":0},{default:o.withCtx(()=>[o.createVNode(l,null,{default:o.withCtx(()=>[o.createElementVNode("button",{class:"btn",onClick:a[0]||(a[0]=f=>i(!0))},[o.createVNode(o.unref(Ot),{name:"Plus",class:"w-6 h-6"})])]),_:1}),o.createVNode(o.unref(ms),null,{default:o.withCtx(()=>a[2]||(a[2]=[o.createTextVNode(" 글꼴 크기 크게 ")])),_:1})]),_:1})]),_:1}),o.createVNode(c,null,{default:o.withCtx(()=>[o.createVNode(u,{"delay-duration":0},{default:o.withCtx(()=>[o.createVNode(l,null,{default:o.withCtx(()=>[o.createElementVNode("button",{class:"btn",onClick:a[1]||(a[1]=f=>i(!1)),disabled:o.unref(n)},[o.createVNode(o.unref(Ot),{name:"Minus",class:"w-6 h-6"})],8,hZ)]),_:1}),o.createVNode(o.unref(ms),null,{default:o.withCtx(()=>a[3]||(a[3]=[o.createTextVNode(" 글꼴 크기 작게 ")])),_:1})]),_:1})]),_:1})])}}}),[["__scopeId","data-v-250d04b3"]]),gZ=zn.create({name:"fontSizeIncreaseDecrease",addOptions(){return{defaultSize:"14px",button({editor:t}){return{component:mZ,componentProps:{editor:t}}}}},addAttributes(){return{size:{default:this.options.defaultSize,parseHTML:t=>t.style.fontSize||this.options.defaultSize,renderHTML:t=>t.size?{style:`font-size: ${t.size}`}:{}}}},addCommands(){return{setFontSizeIncreaseDecrease:t=>({commands:e})=>e.setMark("textStyle",{fontSize:t})}}}),Sv=et.create({name:"painter",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,extension:n,t:r})=>({component:Xe,componentProps:{action:()=>{e.commands.setPainter(e==null?void 0:e.state.selection.$head.marks())},icon:"PaintRoller",tooltip:r("editor.format")}})}},addCommands(){return{setPainter:t=>({view:{dispatch:e,state:{tr:n},dom:r}})=>{const a=`url("data:image/svg+xml;utf8,${encodeURIComponent('<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path fill="#000" d="M9 22v-6H4V7q0-1.65 1.175-2.825T8 3h12v13h-5v6zM6 10h12V5h-1v4h-2V5h-1v2h-2V5H8q-.825 0-1.412.588T6 7zm0 4h12v-2H6zm0 0v-2z"/></svg>')}"), auto`;return r.style.cursor=a,e(n.setMeta("painterAction",{type:"start",marks:t})),!0}}},addProseMirrorPlugins(){return[new nt({key:new Et("format-painter"),state:{init:()=>[],apply:(t,e)=>{const n=t.getMeta("painterAction");return n&&n.type==="start"?e=n.marks:n&&n.type==="end"&&(e=[]),e}},props:{handleDOMEvents:{mousedown(t,e){const n=this.getState(t.state);if(!n||n.length==0)return t.dom.style.cursor="",!1;const r=()=>{document.removeEventListener("mouseup",r);const{dispatch:i,state:{selection:s},dom:a}=t;let l=t.state.tr;a.style.cursor="",l=l.removeMark(s.from,s.to);for(const u of n)u.type.name!="link"&&(l=l.addMark(s.from,s.to,u));i(l.setMeta("painterAction",{type:"end"}))};return document.addEventListener("mouseup",r),!0}}}})]}}),_v=()=>Xr(10),hk=new Et("attrkey"),bZ=t=>new nt({key:hk,state:{init:()=>!1,apply:n=>n.getMeta("initSplit")},appendTransaction(n,r,i){const{tr:s}=i;let a=!1;const l=hk.getState(i);if(n.some(c=>c.getMeta("composition")))return null;if(l||n.some(c=>c.docChanged)){const c=[];i.doc.descendants((f,p,m,g)=>{const{attrs:b}=f,v=c.includes(b.id)?_v():b.id||_v();t.includes(f.type.name)&&(s.setNodeMarkup(p,void 0,{...b,id:v,"number-line":g+1}),a=!0),c.push(v)})}return a?s:null}}),mk=[Yf,Xf,Jf,_g,Zf,ds,Ag,Bl,Og,Ig,Mg,ma,Il,bi,Bg,Rg,Tg,Gr],vZ=et.create({name:"autoId",addGlobalAttributes(){return[{types:mk.concat(this.options.types||[]),attributes:{id:{default:_v()},extend:{default:!1},class:{default:null},"number-line":{default:null}}}]},addProseMirrorPlugins(){return[bZ(mk.concat(this.options.types||[]))]}}),yZ=["paragraph","heading","list_item","todo_item"];function wZ(t,e){const{selection:n,doc:r}=t;if(!n||!r||!(n instanceof Pe||n instanceof Fn))return t;const{from:i,to:s}=n,a=[],l=e&&e!==s6?e:null;return r.nodesBetween(i,s,(u,c)=>{const f=u.type;return yZ.includes(f.name)?((u.attrs.lineHeight||null)!==l&&a.push({node:u,pos:c,nodeType:f}),f.name!=="list_item"&&f.name!=="todo_item"):!0}),a.length&&a.forEach(u=>{const{node:c,pos:f,nodeType:p}=u;let{attrs:m}=c;m={...m,lineHeight:l},t=t.setNodeMarkup(f,p,m,c.marks)}),t}function xZ(t){return({state:e,dispatch:n})=>{const{selection:r}=e;let{tr:i}=e;return i=i.setSelection(r),i=wZ(i,t),i.docChanged?(n&&n(i),!0):!1}}const CZ=o.defineComponent({__name:"LineHeightDropdown",props:{editor:{},icon:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0}},setup(t){const{t:e}=Tt();function n(l){return parseFloat(l.replace("%",""))/100}const r=o.computed(()=>{const c=s.editor.extensionManager.extensions.find(f=>f.name==="lineHeight").options.lineHeights.map(f=>({label:n(f),value:f}));return c.unshift({label:o.unref(e)("editor.default"),value:"default"}),c}),i=o.ref("default"),s=t;function a(l){l==="default"?s.editor.chain().focus().unsetLineHeight().run():s.editor.chain().focus().setLineHeight(l).run(),i.value=l}return(l,u)=>(o.openBlock(),o.createBlock(ka,{icon:l.icon,tooltip:l.tooltip,disabled:l.disabled,class:"inside-toolbar"},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(c,f)=>(o.openBlock(),o.createBlock(o.unref($l),{key:f,checked:c.value===i.value,onClick:p=>a(c.value)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(c.label),1)]),_:2},1032,["checked","onClick"]))),128))]),_:1},8,["icon","tooltip","disabled"]))}}),gk=et.create({name:"lineHeight",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["paragraph","heading","list_item","todo_item"],lineHeights:["100%","115%","150%","200%","250%","300%"],defaultHeight:s6,button({editor:e,t:n}){return{component:CZ,componentProps:{editor:e,icon:"LineHeight",tooltip:n("editor.lineheight.tooltip")}}}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:t=>t.style.lineHeight||this.options.defaultHeight,renderHTML:t=>t.lineHeight===this.options.defaultHeight||!t.lineHeight?{}:{style:`line-height: ${t.lineHeight}`}}}}]},addCommands(){return{setLineHeight:t=>xZ(t),unsetLineHeight:()=>({commands:t})=>this.options.types.every(e=>t.resetAttributes(e,"lineHeight"))}}}),EZ=Lt.create({name:"column",content:"block+",isolating:!0,addAttributes(){return{position:{default:"",parseHTML:t=>t.getAttribute("data-position"),renderHTML:t=>({"data-position":t.position})}}},renderHTML({HTMLAttributes:t}){return["div",yt(t,{"data-type":"column"}),0]},parseHTML(){return[{tag:'div[data-type="column"]'}]}});var Ba=(t=>(t.SidebarLeft="sidebar-left",t.SidebarRight="sidebar-right",t.TwoColumn="two-column",t))(Ba||{});const Tv=Lt.create({name:"columns",group:"columns",content:"column+",defining:!0,isolating:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),layout:"two-column"}},addAttributes(){return{layout:{default:"two-column"}}},addCommands(){return{setColumns:()=>({commands:t})=>(t.insertContent('<div data-type="columns"><div data-type="column" data-position="left"><p></p></div><div data-type="column" data-position="right"><p></p></div></div>'),!0),setLayout:t=>({commands:e})=>e.updateAttributes("columns",{layout:t})}},renderHTML({HTMLAttributes:t}){return["div",{"data-type":"columns",class:`layout-${t.layout}`},0]},parseHTML(){return[{tag:'div[data-type="columns"]'}]},addExtensions(){return[EZ.configure(this.options.columnOptions)]}}),kZ={class:"flex gap-x-2 items-center"},SZ={class:"sr-only"},_Z={class:"flex justify-end gap-x-2.5 flex-1"},TZ=["disabled"],bk=uo(o.defineComponent({__name:"SuperInputDialogMoblie",props:{editor:{},open:{type:Boolean},superTextInit:{},superTextId:{},superTextElementId:{},isViewMode:{type:Boolean},title:{}},emits:["close","save","delete"],setup(t,{emit:e}){const n=e,r=t,{t:i}=Tt(),s=o.ref(""),a=o.ref(!1),l=o.ref(r.isViewMode??!1),u=o.ref(!1);o.watch(()=>r.isViewMode,g=>{l.value=g,g||(s.value="")});const c=o.computed(()=>{var b;if(!s.value)return!0;const g=document.createElement("div");return g.innerHTML=s.value,((b=g==null?void 0:g.textContent)==null?void 0:b.trim())===""});o.watch(()=>r.open,()=>{r.open&&r.superTextInit&&(s.value=r.superTextInit)});const f=()=>{n("close"),a.value=!1,l.value=!0,u.value=!1},p=()=>{n("save",s.value),s.value="",l.value=!0,u.value=!1},m=()=>{u.value=!0,l.value=!1};return(g,b)=>{const v=dh,y=ch,x=uh,E=lh,k=iv,C=Vc,_=Pc;return o.openBlock(),o.createBlock(_,{open:g.open},{default:o.withCtx(()=>[o.createVNode(C,{isOverlayTransparent:"",class:"p-2.5 gap-0 gap-y-2.5 border-none w-[calc(100%-40px)] !shadow-ed rounded-[5px]"},{default:o.withCtx(()=>[o.createVNode(x,{class:"text-left flex-row justify-between"},{default:o.withCtx(()=>[o.createVNode(v,{class:"text-base font-normal"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(g.title?g.title:o.unref(i)("editor.superinput")),1)]),_:1}),o.createElementVNode("div",kZ,[o.withDirectives(o.createElementVNode("button",{onClick:m},[o.createVNode(o.unref(Gg),{icon:"lucide:edit-2"})],512),[[o.vShow,l.value]]),o.createVNode(y,{class:"outline-none",onClick:f},{default:o.withCtx(()=>[o.createVNode(o.unref(kc),{class:"w-5 h-5"}),o.createElementVNode("span",SZ,o.toDisplayString(o.unref(i)("editor.close")),1)]),_:1})])]),_:1}),o.createVNode(E,{class:"hidden"}),o.createVNode(Ev,{isReadOnly:l.value,modelValue:s.value,"onUpdate:modelValue":b[0]||(b[0]=T=>s.value=T),"parent-editor":g.editor,"spellcheck-enabled":!1},null,8,["isReadOnly","modelValue","parent-editor"]),o.createVNode(k,{class:"flex-row justify-between"},{default:o.withCtx(()=>[o.withDirectives(o.createElementVNode("button",{onClick:b[1]||(b[1]=T=>n("delete"))},o.toDisplayString(o.unref(i)("editor.delete")),513),[[o.vShow,u.value]]),o.withDirectives(o.createElementVNode("div",_Z,[o.createElementVNode("button",{onClick:f},o.toDisplayString(o.unref(i)("editor.menubar.menu.cancel")),1),o.createElementVNode("button",{onClick:p,disabled:o.unref(c),class:o.normalizeClass({"cursor-not-allowed":o.unref(c)})},o.toDisplayString(o.unref(i)("editor.menubar.menu.save")),11,TZ)],512),[[o.vShow,u.value||!l.value]])]),_:1})]),_:1})]),_:1},8,["open"])}}}),[["__scopeId","data-v-2f4982a0"]]),AZ=["innerHTML"],MZ=["book-mark-node-id","page-id","page-number","book-mark-content","node-id","line-id"],OZ=o.defineComponent({__name:"ConfigPlan",props:na,setup(t){const e=t,n=o.ref(!1),r=o.ref(null),{selection:i,doc:s}=e.editor.state,a=o.inject("isMobile"),l=o.ref(!1),u=Ne.useEventBus(fr.RENDER_SUPER_TEXT),c=o.computed(()=>{var _,T;const x=s.resolve(i.from),E=x==null?void 0:x.node(-1),k=(_=E==null?void 0:E.attrs)==null?void 0:_.id,C=(T=E==null?void 0:E.attrs)==null?void 0:T.pageNumber;return{pageId:k,pageNumber:C}}),f=o.computed(()=>{const x=e.getPos(),E=e.editor.state.doc.resolve(x);for(let k=E.depth;k>0;k--){const C=E.node(k);if(C.type.name==="paragraph")return C}return null}),p=o.computed(()=>{var x;return((x=f.value)==null?void 0:x.attrs.id)||""});function m(x){e.updateAttributes({"data-text":x}),n.value=!1}function g(x){const E=e.node.attrs[rt.TEXT],k=e.node.attrs[rt.ID],_={lineId:x.target.querySelector(`[node-id="${k}"]`).getAttribute("line-id"),text:E};u.emit({action:"hover",payload:_})}function b(x){const E=e.node.attrs[rt.ID],C={lineId:x.target.querySelector(`[node-id="${E}"]`).getAttribute("line-id"),text:""};u.emit({action:"hover",payload:C})}function v(){const{getPos:x,node:E,editor:k}=e,C=x(),_=C+1;k.commands.deleteRange({from:C,to:_})}function y(){n.value=!0,a&&(l.value=!0)}return(x,E)=>{const k=vn,C=ov,_=rv,T=nv,A=tv,D=Wc;return o.openBlock(),o.createBlock(o.unref(ta),{as:"span",class:o.normalizeClass(["w-fit text-inherit super-text align-middle",{"!leading-[9px] [&_*]:!leading-[9px]":o.unref(a)}]),"data-drag-handle":"",draggable:"true",contenteditable:"false"},{default:o.withCtx(()=>[o.createVNode(A,null,{default:o.withCtx(()=>[o.createVNode(C,{as:"template",class:"relative"},{default:o.withCtx(()=>[o.createVNode(k,{variant:"ghost",class:"!p-0 !m-0 !h-fit font-normal !text-ed-blue",onClick:y,onMouseenter:g,onMouseleave:b},{default:o.withCtx(()=>[o.createVNode(o.unref(Ot),{name:"plan",class:o.normalizeClass({"w-[18px] h-auto pr-1":o.unref(a)})},null,8,["class"]),E[3]||(E[3]=o.createTextVNode(" [")),o.createElementVNode("span",{class:"[&_*]:inline",innerHTML:e.node.attrs[o.unref(rt).TEXT]},null,8,AZ),E[4]||(E[4]=o.createTextVNode("] ")),o.createElementVNode("div",{ref_key:"bookMarkRef",ref:r,"book-mark-node-id":e.node.attrs[o.unref(rt).ID],"page-id":c.value.pageId,"page-number":c.value.pageNumber,"book-mark-content":e.node.attrs[o.unref(rt).TEXT],"node-id":e.node.attrs[o.unref(rt).ID],"line-id":p.value},null,8,MZ)]),_:1})]),_:1}),o.createVNode(T,null,{default:o.withCtx(()=>[o.createVNode(_,{onSelect:E[0]||(E[0]=O=>n.value=!0)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(x.$t("editor.configPlan.edit")),1)]),_:1}),o.createVNode(_,{onSelect:v},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(x.$t("editor.configPlan.delete")),1)]),_:1})]),_:1})]),_:1}),o.unref(a)?(o.openBlock(),o.createBlock(bk,{key:1,title:x.$t("editor.configPlan"),open:n.value,"is-view-mode":l.value,editor:e.editor,"super-text-init":e.node.attrs[o.unref(rt).TEXT],"super-text-id":e.node.attrs[o.unref(rt).ID],onClose:E[2]||(E[2]=O=>n.value=!1),onSave:m,onDelete:v},null,8,["title","open","is-view-mode","editor","super-text-init","super-text-id"])):(o.openBlock(),o.createBlock(D,{key:0,open:n.value,editor:e.editor,"super-text-init":e.node.attrs[o.unref(rt).TEXT],"super-text-element-id":e.node.attrs[o.unref(rt).ELEMENT_ID],onClose:E[1]||(E[1]=O=>n.value=!1),onSave:m},null,8,["open","editor","super-text-init","super-text-element-id"]))]),_:1},8,["class"])}}}),vk=Lt.create({name:"configPlan",inline:!0,group:"inline",atom:!0,draggable:!0,addStorage(){return{isShowConfigPlanInput:!1}},addOptions(){return{specialCharModal:null,button:({editor:t,t:e,isMobile:n})=>[...n?[{component:Xe,componentProps:{action:()=>{t.commands.toggleConfigPlanInput()},isActive:()=>{},icon:"plan",title:e("editor.insertConfigPlan"),tooltip:e("editor.insertConfigPlan"),customClass:"whitespace-nowrap !bg-ed-blue !text-white !font-normal rounded-[3px] h-[26px] gap-x-1 ml-auto",customClassTooltip:"ml-auto"}}]:[]]}},addAttributes(){return{"data-id":{default:null},"data-text":{default:""},"data-position":{default:"0"}}},addCommands(){return{toggleConfigPlanInput:()=>({editor:t})=>t.storage.configPlan.isShowConfigPlanInput=!t.storage.configPlan.isShowConfigPlanInput}},parseHTML(){return[{tag:"button.config-plan"}]},renderHTML({HTMLAttributes:t}){return["button",yt(t,{class:"config-plan"})]},addNodeView(){return ra(OZ)},addProseMirrorPlugins(){return[new nt({appendTransaction(t,e,n){let r=n.tr,i=!1;return n.doc.descendants((s,a)=>{if(s.type.name==="configPlan"){const l=s.attrs["data-position"],u=String(a);l!==u&&(r=r.setNodeMarkup(a,void 0,{...s.attrs,"data-position":u}),i=!0)}}),i?r:null}})]}});var Av,Mv;if(typeof WeakMap<"u"){let t=new WeakMap;Av=e=>t.get(e),Mv=(e,n)=>(t.set(e,n),n)}else{const t=[];let n=0;Av=r=>{for(let i=0;i<t.length;i+=2)if(t[i]==r)return t[i+1]},Mv=(r,i)=>(n==10&&(n=0),t[n++]=r,t[n++]=i)}var ln=class{constructor(t,e,n,r){this.width=t,this.height=e,this.map=n,this.problems=r}findCell(t){for(let e=0;e<this.map.length;e++){const n=this.map[e];if(n!=t)continue;const r=e%this.width,i=e/this.width|0;let s=r+1,a=i+1;for(let l=1;s<this.width&&this.map[e+l]==n;l++)s++;for(let l=1;a<this.height&&this.map[e+this.width*l]==n;l++)a++;return{left:r,top:i,right:s,bottom:a}}throw new RangeError(`No cell with offset ${t} found`)}colCount(t){for(let e=0;e<this.map.length;e++)if(this.map[e]==t)return e%this.width;throw new RangeError(`No cell with offset ${t} found`)}nextCell(t,e,n){const{left:r,right:i,top:s,bottom:a}=this.findCell(t);return e=="horiz"?(n<0?r==0:i==this.width)?null:this.map[s*this.width+(n<0?r-1:i)]:(n<0?s==0:a==this.height)?null:this.map[r+this.width*(n<0?s-1:a)]}rectBetween(t,e){const{left:n,right:r,top:i,bottom:s}=this.findCell(t),{left:a,right:l,top:u,bottom:c}=this.findCell(e);return{left:Math.min(n,a),top:Math.min(i,u),right:Math.max(r,l),bottom:Math.max(s,c)}}cellsInRect(t){const e=[],n={};for(let r=t.top;r<t.bottom;r++)for(let i=t.left;i<t.right;i++){const s=r*this.width+i,a=this.map[s];n[a]||(n[a]=!0,!(i==t.left&&i&&this.map[s-1]==a||r==t.top&&r&&this.map[s-this.width]==a)&&e.push(a))}return e}positionAt(t,e,n){for(let r=0,i=0;;r++){const s=i+n.child(r).nodeSize;if(r==t){let a=e+t*this.width;const l=(t+1)*this.width;for(;a<l&&this.map[a]<i;)a++;return a==l?s-1:this.map[a]}i=s}}static get(t){return Av(t)||Mv(t,BZ(t))}};function BZ(t){if(t.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+t.type.name);const e=IZ(t),n=t.childCount,r=[];let i=0,s=null;const a=[];for(let c=0,f=e*n;c<f;c++)r[c]=0;for(let c=0,f=0;c<n;c++){const p=t.child(c);f++;for(let b=0;;b++){for(;i<r.length&&r[i]!=0;)i++;if(b==p.childCount)break;const v=p.child(b),{colspan:y,rowspan:x,colwidth:E}=v.attrs;for(let k=0;k<x;k++){if(k+c>=n){(s||(s=[])).push({type:"overlong_rowspan",pos:f,n:x-k});break}const C=i+k*e;for(let _=0;_<y;_++){r[C+_]==0?r[C+_]=f:(s||(s=[])).push({type:"collision",row:c,pos:f,n:y-_});const T=E&&E[_];if(T){const A=(C+_)%e*2,D=a[A];D==null||D!=T&&a[A+1]==1?(a[A]=T,a[A+1]=1):D==T&&a[A+1]++}}}i+=y,f+=v.nodeSize}const m=(c+1)*e;let g=0;for(;i<m;)r[i++]==0&&g++;g&&(s||(s=[])).push({type:"missing",row:c,n:g}),f++}(e===0||n===0)&&(s||(s=[])).push({type:"zero_sized"});const l=new ln(e,n,r,s);let u=!1;for(let c=0;!u&&c<a.length;c+=2)a[c]!=null&&a[c+1]<n&&(u=!0);return u&&RZ(l,a,t),l}function IZ(t){let e=-1,n=!1;for(let r=0;r<t.childCount;r++){const i=t.child(r);let s=0;if(n)for(let a=0;a<r;a++){const l=t.child(a);for(let u=0;u<l.childCount;u++){const c=l.child(u);a+c.attrs.rowspan>r&&(s+=c.attrs.colspan)}}for(let a=0;a<i.childCount;a++){const l=i.child(a);s+=l.attrs.colspan,l.attrs.rowspan>1&&(n=!0)}e==-1?e=s:e!=s&&(e=Math.max(e,s))}return e}function RZ(t,e,n){t.problems||(t.problems=[]);const r={};for(let i=0;i<t.map.length;i++){const s=t.map[i];if(r[s])continue;r[s]=!0;const a=n.nodeAt(s);if(!a)throw new RangeError(`No cell with offset ${s} found`);let l=null;const u=a.attrs;for(let c=0;c<u.colspan;c++){const f=(i+c)%t.width,p=e[f*2];p!=null&&(!u.colwidth||u.colwidth[c]!=p)&&((l||(l=LZ(u)))[c]=p)}l&&t.problems.unshift({type:"colwidth mismatch",pos:s,colwidth:l})}}function LZ(t){if(t.colwidth)return t.colwidth.slice();const e=[];for(let n=0;n<t.colspan;n++)e.push(0);return e}function Kn(t){let e=t.cached.tableNodeTypes;if(!e){e=t.cached.tableNodeTypes={};for(const n in t.nodes){const r=t.nodes[n],i=r.spec.tableRole;i&&(e[i]=r)}}return e}var _s=new Et("selectingCells");function Kl(t){for(let e=t.depth-1;e>0;e--)if(t.node(e).type.spec.tableRole=="row")return t.node(0).resolve(t.before(e+1));return null}function DZ(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if(n==="cell"||n==="header_cell")return t.node(e)}return null}function Eo(t){const e=t.selection.$head;for(let n=e.depth;n>0;n--)if(e.node(n).type.spec.tableRole=="row")return!0;return!1}function Sh(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const n=Kl(e.$head)||PZ(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function PZ(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const r=e.type.spec.tableRole;if(r=="cell"||r=="header_cell")return t.doc.resolve(n-e.nodeSize)}}function Ov(t){return t.parent.type.spec.tableRole=="row"&&!!t.nodeAfter}function VZ(t){return t.node(0).resolve(t.pos+t.nodeAfter.nodeSize)}function Bv(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function yk(t,e,n){const r=t.node(-1),i=ln.get(r),s=t.start(-1),a=i.nextCell(t.pos-s,e,n);return a==null?null:t.node(0).resolve(s+a)}function Ia(t,e,n=1){const r={...t,colspan:t.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(e,n),r.colwidth.some(i=>i>0)||(r.colwidth=null)),r}function wk(t,e,n=1){const r={...t,colspan:t.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let i=0;i<n;i++)r.colwidth.splice(e,0,0)}return r}function FZ(t,e,n){const r=Kn(e.type.schema).header_cell;for(let i=0;i<t.height;i++)if(e.nodeAt(t.map[n+i*t.width]).type!=r)return!1;return!0}var Wt=class Di extends je{constructor(e,n=e){const r=e.node(-1),i=ln.get(r),s=e.start(-1),a=i.rectBetween(e.pos-s,n.pos-s),l=e.node(0),u=i.cellsInRect(a).filter(f=>f!=n.pos-s);u.unshift(n.pos-s);const c=u.map(f=>{const p=r.nodeAt(f);if(!p)throw RangeError(`No cell with offset ${f} found`);const m=s+f+1;return new s3(l.resolve(m),l.resolve(m+p.content.size))});super(c[0].$from,c[0].$to,c),this.$anchorCell=e,this.$headCell=n}map(e,n){const r=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(Ov(r)&&Ov(i)&&Bv(r,i)){const s=this.$anchorCell.node(-1)!=r.node(-1);return s&&this.isRowSelection()?Di.rowSelection(r,i):s&&this.isColSelection()?Di.colSelection(r,i):new Di(r,i)}return Pe.between(r,i)}content(){const e=this.$anchorCell.node(-1),n=ln.get(e),r=this.$anchorCell.start(-1),i=n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r),s={},a=[];for(let u=i.top;u<i.bottom;u++){const c=[];for(let f=u*n.width+i.left,p=i.left;p<i.right;p++,f++){const m=n.map[f];if(s[m])continue;s[m]=!0;const g=n.findCell(m);let b=e.nodeAt(m);if(!b)throw RangeError(`No cell with offset ${m} found`);const v=i.left-g.left,y=g.right-i.right;if(v>0||y>0){let x=b.attrs;if(v>0&&(x=Ia(x,0,v)),y>0&&(x=Ia(x,x.colspan-y,y)),g.left<i.left){if(b=b.type.createAndFill(x),!b)throw RangeError(`Could not create cell with attrs ${JSON.stringify(x)}`)}else b=b.type.create(x,b.content)}if(g.top<i.top||g.bottom>i.bottom){const x={...b.attrs,rowspan:Math.min(g.bottom,i.bottom)-Math.max(g.top,i.top)};g.top<i.top?b=b.type.createAndFill(x):b=b.type.create(x,b.content)}c.push(b)}a.push(e.child(u).copy(ge.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:a;return new Te(ge.from(l),1,1)}replace(e,n=Te.empty){const r=e.steps.length,i=this.ranges;for(let a=0;a<i.length;a++){const{$from:l,$to:u}=i[a],c=e.mapping.slice(r);e.replace(c.map(l.pos),c.map(u.pos),a?Te.empty:n)}const s=je.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new Te(ge.from(n),0,0))}forEachCell(e){const n=this.$anchorCell.node(-1),r=ln.get(n),i=this.$anchorCell.start(-1),s=r.cellsInRect(r.rectBetween(this.$anchorCell.pos-i,this.$headCell.pos-i));for(let a=0;a<s.length;a++)e(n.nodeAt(s[a]),i+s[a])}isColSelection(){const e=this.$anchorCell.index(-1),n=this.$headCell.index(-1);if(Math.min(e,n)>0)return!1;const r=e+this.$anchorCell.nodeAfter.attrs.rowspan,i=n+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(r,i)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const r=e.node(-1),i=ln.get(r),s=e.start(-1),a=i.findCell(e.pos-s),l=i.findCell(n.pos-s),u=e.node(0);return a.top<=l.top?(a.top>0&&(e=u.resolve(s+i.map[a.left])),l.bottom<i.height&&(n=u.resolve(s+i.map[i.width*(i.height-1)+l.right-1]))):(l.top>0&&(n=u.resolve(s+i.map[l.left])),a.bottom<i.height&&(e=u.resolve(s+i.map[i.width*(i.height-1)+a.right-1]))),new Di(e,n)}isRowSelection(){const e=this.$anchorCell.node(-1),n=ln.get(e),r=this.$anchorCell.start(-1),i=n.colCount(this.$anchorCell.pos-r),s=n.colCount(this.$headCell.pos-r);if(Math.min(i,s)>0)return!1;const a=i+this.$anchorCell.nodeAfter.attrs.colspan,l=s+this.$headCell.nodeAfter.attrs.colspan;return Math.max(a,l)==n.width}eq(e){return e instanceof Di&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const r=e.node(-1),i=ln.get(r),s=e.start(-1),a=i.findCell(e.pos-s),l=i.findCell(n.pos-s),u=e.node(0);return a.left<=l.left?(a.left>0&&(e=u.resolve(s+i.map[a.top*i.width])),l.right<i.width&&(n=u.resolve(s+i.map[i.width*(l.top+1)-1]))):(l.left>0&&(n=u.resolve(s+i.map[l.top*i.width])),a.right<i.width&&(e=u.resolve(s+i.map[i.width*(a.top+1)-1]))),new Di(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Di(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Di(e.resolve(n),e.resolve(r))}getBookmark(){return new $Z(this.$anchorCell.pos,this.$headCell.pos)}};Wt.prototype.visible=!1,je.jsonID("cell",Wt);var $Z=class Y9{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Y9(e.map(this.anchor),e.map(this.head))}resolve(e){const n=e.resolve(this.anchor),r=e.resolve(this.head);return n.parent.type.spec.tableRole=="row"&&r.parent.type.spec.tableRole=="row"&&n.index()<n.parent.childCount&&r.index()<r.parent.childCount&&Bv(n,r)?new Wt(n,r):je.near(r,1)}};function HZ(t){if(!(t.selection instanceof Wt))return null;const e=[];return t.selection.forEachCell((n,r)=>{e.push(qt.node(r,r+n.nodeSize,{class:"selectedCell"}))}),ut.create(t.doc,e)}function zZ({$from:t,$to:e}){if(t.pos==e.pos||t.pos<e.pos-6)return!1;let n=t.pos,r=e.pos,i=t.depth;for(;i>=0&&!(t.after(i+1)<t.end(i));i--,n++);for(let s=e.depth;s>=0&&!(e.before(s+1)>e.start(s));s--,r--);return n==r&&/row|table/.test(t.node(i).type.spec.tableRole)}function UZ({$from:t,$to:e}){let n,r;for(let i=t.depth;i>0;i--){const s=t.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){n=s;break}}for(let i=e.depth;i>0;i--){const s=e.node(i);if(s.type.spec.tableRole==="cell"||s.type.spec.tableRole==="header_cell"){r=s;break}}return n!==r&&e.parentOffset===0}function WZ(t,e,n){const r=(e||t).selection,i=(e||t).doc;let s,a;if(r instanceof Ve&&(a=r.node.type.spec.tableRole)){if(a=="cell"||a=="header_cell")s=Wt.create(i,r.from);else if(a=="row"){const l=i.resolve(r.from+1);s=Wt.rowSelection(l,l)}else if(!n){const l=ln.get(r.node),u=r.from+1,c=u+l.map[l.width*l.height-1];s=Wt.create(i,u+1,c)}}else r instanceof Pe&&zZ(r)?s=Pe.create(i,r.from):r instanceof Pe&&UZ(r)&&(s=Pe.create(i,r.$from.start(),r.$from.end()));return s&&(e||(e=t.tr)).setSelection(s),e}var jZ=new Et("fix-tables");function xk(t,e,n,r){const i=t.childCount,s=e.childCount;e:for(let a=0,l=0;a<s;a++){const u=e.child(a);for(let c=l,f=Math.min(i,a+3);c<f;c++)if(t.child(c)==u){l=c+1,n+=u.nodeSize;continue e}r(u,n),l<i&&t.child(l).sameMarkup(u)?xk(t.child(l),u,n+1,r):u.nodesBetween(0,u.content.size,r,n+1),n+=u.nodeSize}}function Ck(t,e){let n;const r=(i,s)=>{i.type.spec.tableRole=="table"&&(n=qZ(t,i,s,n))};return e?e.doc!=t.doc&&xk(e.doc,t.doc,0,r):t.doc.descendants(r),n}function qZ(t,e,n,r){const i=ln.get(e);if(!i.problems)return r;r||(r=t.tr);const s=[];for(let u=0;u<i.height;u++)s.push(0);for(let u=0;u<i.problems.length;u++){const c=i.problems[u];if(c.type=="collision"){const f=e.nodeAt(c.pos);if(!f)continue;const p=f.attrs;for(let m=0;m<p.rowspan;m++)s[c.row+m]+=c.n;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,Ia(p,p.colspan-c.n,c.n))}else if(c.type=="missing")s[c.row]+=c.n;else if(c.type=="overlong_rowspan"){const f=e.nodeAt(c.pos);if(!f)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...f.attrs,rowspan:f.attrs.rowspan-c.n})}else if(c.type=="colwidth mismatch"){const f=e.nodeAt(c.pos);if(!f)continue;r.setNodeMarkup(r.mapping.map(n+1+c.pos),null,{...f.attrs,colwidth:c.colwidth})}else if(c.type=="zero_sized"){const f=r.mapping.map(n);r.delete(f,f+e.nodeSize)}}let a,l;for(let u=0;u<s.length;u++)s[u]&&(a==null&&(a=u),l=u);for(let u=0,c=n+1;u<i.height;u++){const f=e.child(u),p=c+f.nodeSize,m=s[u];if(m>0){let g="cell";f.firstChild&&(g=f.firstChild.type.spec.tableRole);const b=[];for(let y=0;y<m;y++){const x=Kn(t.schema)[g].createAndFill();x&&b.push(x)}const v=(u==0||a==u-1)&&l==u?c+1:p-1;r.insert(r.mapping.map(v),b)}c=p}return r.setMeta(jZ,{fixTables:!0})}function Jo(t){const e=t.selection,n=Sh(t),r=n.node(-1),i=n.start(-1),s=ln.get(r);return{...e instanceof Wt?s.rectBetween(e.$anchorCell.pos-i,e.$headCell.pos-i):s.findCell(n.pos-i),tableStart:i,map:s,table:r}}function Ek(t,{map:e,tableStart:n,table:r},i){let s=i>0?-1:0;FZ(e,r,i+s)&&(s=i==0||i==e.width?null:0);for(let a=0;a<e.height;a++){const l=a*e.width+i;if(i>0&&i<e.width&&e.map[l-1]==e.map[l]){const u=e.map[l],c=r.nodeAt(u);t.setNodeMarkup(t.mapping.map(n+u),null,wk(c.attrs,i-e.colCount(u))),a+=c.attrs.rowspan-1}else{const u=s==null?Kn(r.type.schema).cell:r.nodeAt(e.map[l+s]).type,c=e.positionAt(a,i,r);t.insert(t.mapping.map(n+c),u.createAndFill())}}return t}function KZ(t,e){if(!Eo(t))return!1;if(e){const n=Jo(t);e(Ek(t.tr,n,n.left))}return!0}function GZ(t,e){if(!Eo(t))return!1;if(e){const n=Jo(t);e(Ek(t.tr,n,n.right))}return!0}function XZ(t,{map:e,table:n,tableStart:r},i){const s=t.mapping.maps.length;for(let a=0;a<e.height;){const l=a*e.width+i,u=e.map[l],c=n.nodeAt(u),f=c.attrs;if(i>0&&e.map[l-1]==u||i<e.width-1&&e.map[l+1]==u)t.setNodeMarkup(t.mapping.slice(s).map(r+u),null,Ia(f,i-e.colCount(u)));else{const p=t.mapping.slice(s).map(r+u);t.delete(p,p+c.nodeSize)}a+=f.rowspan}}function YZ(t,e){if(!Eo(t))return!1;if(e){const n=Jo(t),r=t.tr;if(n.left==0&&n.right==n.map.width)return!1;for(let i=n.right-1;XZ(r,n,i),i!=n.left;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw RangeError("No table found");n.table=s,n.map=ln.get(s)}e(r)}return!0}function JZ(t,e,n){var r;const i=Kn(e.type.schema).header_cell;for(let s=0;s<t.width;s++)if(((r=e.nodeAt(t.map[s+n*t.width]))==null?void 0:r.type)!=i)return!1;return!0}function kk(t,{map:e,tableStart:n,table:r},i){var s;let a=n;for(let c=0;c<i;c++)a+=r.child(c).nodeSize;const l=[];let u=i>0?-1:0;JZ(e,r,i+u)&&(u=i==0||i==e.height?null:0);for(let c=0,f=e.width*i;c<e.width;c++,f++)if(i>0&&i<e.height&&e.map[f]==e.map[f-e.width]){const p=e.map[f],m=r.nodeAt(p).attrs;t.setNodeMarkup(n+p,null,{...m,rowspan:m.rowspan+1}),c+=m.colspan-1}else{const p=u==null?Kn(r.type.schema).cell:(s=r.nodeAt(e.map[f+u*e.width]))==null?void 0:s.type,m=p==null?void 0:p.createAndFill();m&&l.push(m)}return t.insert(a,Kn(r.type.schema).row.create(null,l)),t}function ZZ(t,e){if(!Eo(t))return!1;if(e){const n=Jo(t);e(kk(t.tr,n,n.top))}return!0}function QZ(t,e){if(!Eo(t))return!1;if(e){const n=Jo(t);e(kk(t.tr,n,n.bottom))}return!0}function NZ(t,{map:e,table:n,tableStart:r},i){let s=0;for(let c=0;c<i;c++)s+=n.child(c).nodeSize;const a=s+n.child(i).nodeSize,l=t.mapping.maps.length;t.delete(s+r,a+r);const u=new Set;for(let c=0,f=i*e.width;c<e.width;c++,f++){const p=e.map[f];if(!u.has(p)){if(u.add(p),i>0&&p==e.map[f-e.width]){const m=n.nodeAt(p).attrs;t.setNodeMarkup(t.mapping.slice(l).map(p+r),null,{...m,rowspan:m.rowspan-1}),c+=m.colspan-1}else if(i<e.height&&p==e.map[f+e.width]){const m=n.nodeAt(p),g=m.attrs,b=m.type.create({...g,rowspan:m.attrs.rowspan-1},m.content),v=e.positionAt(i+1,c,n);t.insert(t.mapping.slice(l).map(r+v),b),c+=g.colspan-1}}}}function eQ(t,e){if(!Eo(t))return!1;if(e){const n=Jo(t),r=t.tr;if(n.top==0&&n.bottom==n.map.height)return!1;for(let i=n.bottom-1;NZ(r,n,i),i!=n.top;i--){const s=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!s)throw RangeError("No table found");n.table=s,n.map=ln.get(n.table)}e(r)}return!0}function Sk(t){const e=t.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function tQ({width:t,height:e,map:n},r){let i=r.top*t+r.left,s=i,a=(r.bottom-1)*t+r.left,l=i+(r.right-r.left-1);for(let u=r.top;u<r.bottom;u++){if(r.left>0&&n[s]==n[s-1]||r.right<t&&n[l]==n[l+1])return!0;s+=t,l+=t}for(let u=r.left;u<r.right;u++){if(r.top>0&&n[i]==n[i-t]||r.bottom<e&&n[a]==n[a+t])return!0;i++,a++}return!1}function _k(t,e){const n=t.selection;if(!(n instanceof Wt)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Jo(t),{map:i}=r;if(tQ(i,r))return!1;if(e){const s=t.tr,a={};let l=ge.empty,u,c;for(let f=r.top;f<r.bottom;f++)for(let p=r.left;p<r.right;p++){const m=i.map[f*i.width+p],g=r.table.nodeAt(m);if(!(a[m]||!g))if(a[m]=!0,u==null)u=m,c=g;else{Sk(g)||(l=l.append(g.content));const b=s.mapping.map(m+r.tableStart);s.delete(b,b+g.nodeSize)}}if(u==null||c==null)return!0;if(s.setNodeMarkup(u+r.tableStart,null,{...wk(c.attrs,c.attrs.colspan,r.right-r.left-c.attrs.colspan),rowspan:r.bottom-r.top}),l.size){const f=u+1+c.content.size,p=Sk(c)?u+1:f;s.replaceWith(p+r.tableStart,f+r.tableStart,l)}s.setSelection(new Wt(s.doc.resolve(u+r.tableStart))),e(s)}return!0}function Tk(t,e){const n=Kn(t.schema);return nQ(({node:r})=>n[r.type.spec.tableRole])(t,e)}function nQ(t){return(e,n)=>{var r;const i=e.selection;let s,a;if(i instanceof Wt){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;s=i.$anchorCell.nodeAfter,a=i.$anchorCell.pos}else{if(s=DZ(i.$from),!s)return!1;a=(r=Kl(i.$from))==null?void 0:r.pos}if(s==null||a==null||s.attrs.colspan==1&&s.attrs.rowspan==1)return!1;if(n){let l=s.attrs;const u=[],c=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const f=Jo(e),p=e.tr;for(let g=0;g<f.right-f.left;g++)u.push(c?{...l,colwidth:c&&c[g]?[c[g]]:null}:l);let m;for(let g=f.top;g<f.bottom;g++){let b=f.map.positionAt(g,f.left,f.table);g==f.top&&(b+=s.nodeSize);for(let v=f.left,y=0;v<f.right;v++,y++)v==f.left&&g==f.top||p.insert(m=p.mapping.map(b+f.tableStart,1),t({node:s,row:g,col:v}).createAndFill(u[y]))}p.setNodeMarkup(a,t({node:s,row:f.top,col:f.left}),u[0]),i instanceof Wt&&p.setSelection(new Wt(p.doc.resolve(i.$anchorCell.pos),m?p.doc.resolve(m):void 0)),n(p)}return!0}}function rQ(t,e){return function(n,r){if(!Eo(n))return!1;const i=Sh(n);if(i.nodeAfter.attrs[t]===e)return!1;if(r){const s=n.tr;n.selection instanceof Wt?n.selection.forEachCell((a,l)=>{a.attrs[t]!==e&&s.setNodeMarkup(l,null,{...a.attrs,[t]:e})}):s.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),r(s)}return!0}}function oQ(t){return function(e,n){if(!Eo(e))return!1;if(n){const r=Kn(e.schema),i=Jo(e),s=e.tr,a=i.map.cellsInRect(t=="column"?{left:i.left,top:0,right:i.right,bottom:i.map.height}:t=="row"?{left:0,top:i.top,right:i.map.width,bottom:i.bottom}:i),l=a.map(u=>i.table.nodeAt(u));for(let u=0;u<a.length;u++)l[u].type==r.header_cell&&s.setNodeMarkup(i.tableStart+a[u],r.cell,l[u].attrs);if(s.steps.length==0)for(let u=0;u<a.length;u++)s.setNodeMarkup(i.tableStart+a[u],r.header_cell,l[u].attrs);n(s)}return!0}}function Ak(t,e,n){const r=e.map.cellsInRect({left:0,top:0,right:t=="row"?e.map.width:1,bottom:t=="column"?e.map.height:1});for(let i=0;i<r.length;i++){const s=e.table.nodeAt(r[i]);if(s&&s.type!==n.header_cell)return!1}return!0}function jc(t,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?oQ(t):function(n,r){if(!Eo(n))return!1;if(r){const i=Kn(n.schema),s=Jo(n),a=n.tr,l=Ak("row",s,i),u=Ak("column",s,i),f=(t==="column"?l:t==="row"?u:!1)?1:0,p=t=="column"?{left:0,top:f,right:1,bottom:s.map.height}:t=="row"?{left:f,top:0,right:s.map.width,bottom:1}:s,m=t=="column"?u?i.cell:i.header_cell:t=="row"?l?i.cell:i.header_cell:i.cell;s.map.cellsInRect(p).forEach(g=>{const b=g+s.tableStart,v=a.doc.nodeAt(b);v&&a.setNodeMarkup(b,m,v.attrs)}),r(a)}return!0}}jc("row",{useDeprecatedLogic:!0}),jc("column",{useDeprecatedLogic:!0});var iQ=jc("cell",{useDeprecatedLogic:!0});function sQ(t,e){if(e<0){const n=t.nodeBefore;if(n)return t.pos-n.nodeSize;for(let r=t.index(-1)-1,i=t.before();r>=0;r--){const s=t.node(-1).child(r),a=s.lastChild;if(a)return i-1-a.nodeSize;i-=s.nodeSize}}else{if(t.index()<t.parent.childCount-1)return t.pos+t.nodeAfter.nodeSize;const n=t.node(-1);for(let r=t.indexAfter(-1),i=t.after();r<n.childCount;r++){const s=n.child(r);if(s.childCount)return i+1;i+=s.nodeSize}}return null}function Mk(t){return function(e,n){if(!Eo(e))return!1;const r=sQ(Sh(e),t);if(r==null)return!1;if(n){const i=e.doc.resolve(r);n(e.tr.setSelection(Pe.between(i,VZ(i))).scrollIntoView())}return!0}}function aQ(t,e){const n=t.selection.$anchor;for(let r=n.depth;r>0;r--)if(n.node(r).type.spec.tableRole=="table")return e&&e(t.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}function _h(t,e){const n=t.selection;if(!(n instanceof Wt))return!1;if(e){const r=t.tr,i=Kn(t.schema).cell.createAndFill().content;n.forEachCell((s,a)=>{s.content.eq(i)||r.replace(r.mapping.map(a+1),r.mapping.map(a+s.nodeSize-1),new Te(i,0,0))}),r.docChanged&&e(r)}return!0}function lQ(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:r}=t;for(;e.childCount==1&&(n>0&&r>0||e.child(0).type.spec.tableRole=="table");)n--,r--,e=e.child(0).content;const i=e.child(0),s=i.type.spec.tableRole,a=i.type.schema,l=[];if(s=="row")for(let u=0;u<e.childCount;u++){let c=e.child(u).content;const f=u?0:Math.max(0,n-1),p=u<e.childCount-1?0:Math.max(0,r-1);(f||p)&&(c=Iv(Kn(a).row,new Te(c,f,p)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(n||r?Iv(Kn(a).row,new Te(e,n,r)).content:e);else return null;return uQ(a,l)}function uQ(t,e){const n=[];for(let i=0;i<e.length;i++){const s=e[i];for(let a=s.childCount-1;a>=0;a--){const{rowspan:l,colspan:u}=s.child(a).attrs;for(let c=i;c<i+l;c++)n[c]=(n[c]||0)+u}}let r=0;for(let i=0;i<n.length;i++)r=Math.max(r,n[i]);for(let i=0;i<n.length;i++)if(i>=e.length&&e.push(ge.empty),n[i]<r){const s=Kn(t).cell.createAndFill(),a=[];for(let l=n[i];l<r;l++)a.push(s);e[i]=e[i].append(ge.from(a))}return{height:e.length,width:r,rows:e}}function Iv(t,e){const n=t.createAndFill();return new Km(n).replace(0,n.content.size,e).doc}function cQ({width:t,height:e,rows:n},r,i){if(t!=r){const s=[],a=[];for(let l=0;l<n.length;l++){const u=n[l],c=[];for(let f=s[l]||0,p=0;f<r;p++){let m=u.child(p%u.childCount);f+m.attrs.colspan>r&&(m=m.type.createChecked(Ia(m.attrs,m.attrs.colspan,f+m.attrs.colspan-r),m.content)),c.push(m),f+=m.attrs.colspan;for(let g=1;g<m.attrs.rowspan;g++)s[l+g]=(s[l+g]||0)+m.attrs.colspan}a.push(ge.from(c))}n=a,t=r}if(e!=i){const s=[];for(let a=0,l=0;a<i;a++,l++){const u=[],c=n[l%e];for(let f=0;f<c.childCount;f++){let p=c.child(f);a+p.attrs.rowspan>i&&(p=p.type.create({...p.attrs,rowspan:Math.max(1,i-p.attrs.rowspan)},p.content)),u.push(p)}s.push(ge.from(u))}n=s,e=i}return{width:t,height:e,rows:n}}function dQ(t,e,n,r,i,s,a){const l=t.doc.type.schema,u=Kn(l);let c,f;if(i>e.width)for(let p=0,m=0;p<e.height;p++){const g=n.child(p);m+=g.nodeSize;const b=[];let v;g.lastChild==null||g.lastChild.type==u.cell?v=c||(c=u.cell.createAndFill()):v=f||(f=u.header_cell.createAndFill());for(let y=e.width;y<i;y++)b.push(v);t.insert(t.mapping.slice(a).map(m-1+r),b)}if(s>e.height){const p=[];for(let b=0,v=(e.height-1)*e.width;b<Math.max(e.width,i);b++){const y=b>=e.width?!1:n.nodeAt(e.map[v+b]).type==u.header_cell;p.push(y?f||(f=u.header_cell.createAndFill()):c||(c=u.cell.createAndFill()))}const m=u.row.create(null,ge.from(p)),g=[];for(let b=e.height;b<s;b++)g.push(m);t.insert(t.mapping.slice(a).map(r+n.nodeSize-2),g)}return!!(c||f)}function Ok(t,e,n,r,i,s,a,l){if(a==0||a==e.height)return!1;let u=!1;for(let c=i;c<s;c++){const f=a*e.width+c,p=e.map[f];if(e.map[f-e.width]==p){u=!0;const m=n.nodeAt(p),{top:g,left:b}=e.findCell(p);t.setNodeMarkup(t.mapping.slice(l).map(p+r),null,{...m.attrs,rowspan:a-g}),t.insert(t.mapping.slice(l).map(e.positionAt(a,b,n)),m.type.createAndFill({...m.attrs,rowspan:g+m.attrs.rowspan-a})),c+=m.attrs.colspan-1}}return u}function Bk(t,e,n,r,i,s,a,l){if(a==0||a==e.width)return!1;let u=!1;for(let c=i;c<s;c++){const f=c*e.width+a,p=e.map[f];if(e.map[f-1]==p){u=!0;const m=n.nodeAt(p),g=e.colCount(p),b=t.mapping.slice(l).map(p+r);t.setNodeMarkup(b,null,Ia(m.attrs,a-g,m.attrs.colspan-(a-g))),t.insert(b+m.nodeSize,m.type.createAndFill(Ia(m.attrs,0,a-g))),c+=m.attrs.rowspan-1}}return u}function Ik(t,e,n,r,i){let s=n?t.doc.nodeAt(n-1):t.doc;if(!s)throw new Error("No table found");let a=ln.get(s);const{top:l,left:u}=r,c=u+i.width,f=l+i.height,p=t.tr;let m=0;function g(){if(s=n?p.doc.nodeAt(n-1):p.doc,!s)throw new Error("No table found");a=ln.get(s),m=p.mapping.maps.length}dQ(p,a,s,n,c,f,m)&&g(),Ok(p,a,s,n,u,c,l,m)&&g(),Ok(p,a,s,n,u,c,f,m)&&g(),Bk(p,a,s,n,l,f,u,m)&&g(),Bk(p,a,s,n,l,f,c,m)&&g();for(let b=l;b<f;b++){const v=a.positionAt(b,u,s),y=a.positionAt(b,c,s);p.replace(p.mapping.slice(m).map(v+n),p.mapping.slice(m).map(y+n),new Te(i.rows[b-l],0,0))}g(),p.setSelection(new Wt(p.doc.resolve(n+a.positionAt(l,u,s)),p.doc.resolve(n+a.positionAt(f-1,c-1,s)))),e(p)}var fQ=E0({ArrowLeft:Ah("horiz",-1),ArrowRight:Ah("horiz",1),ArrowUp:Ah("vert",-1),ArrowDown:Ah("vert",1),"Shift-ArrowLeft":Mh("horiz",-1),"Shift-ArrowRight":Mh("horiz",1),"Shift-ArrowUp":Mh("vert",-1),"Shift-ArrowDown":Mh("vert",1),Backspace:_h,"Mod-Backspace":_h,Delete:_h,"Mod-Delete":_h});function Th(t,e,n){return n.eq(t.selection)?!1:(e&&e(t.tr.setSelection(n).scrollIntoView()),!0)}function Ah(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;if(s instanceof Wt)return Th(n,r,je.near(s.$headCell,e));if(t!="horiz"&&!s.empty)return!1;const a=Rk(i,t,e);if(a==null)return!1;if(t=="horiz")return Th(n,r,je.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(a),u=yk(l,t,e);let c;return u?c=je.near(u,1):e<0?c=je.near(n.doc.resolve(l.before(-1)),-1):c=je.near(n.doc.resolve(l.after(-1)),1),Th(n,r,c)}}}function Mh(t,e){return(n,r,i)=>{if(!i)return!1;const s=n.selection;let a;if(s instanceof Wt)a=s;else{const u=Rk(i,t,e);if(u==null)return!1;a=new Wt(n.doc.resolve(u))}const l=yk(a.$headCell,t,e);return l?Th(n,r,new Wt(a.$anchorCell,l)):!1}}function pQ(t,e){const n=t.state.doc,r=Kl(n.resolve(e));return r?(t.dispatch(t.state.tr.setSelection(new Wt(r))),!0):!1}function hQ(t,e,n){if(!Eo(t.state))return!1;let r=lQ(n);const i=t.state.selection;if(i instanceof Wt){r||(r={width:1,height:1,rows:[ge.from(Iv(Kn(t.state.schema).cell,n))]});const s=i.$anchorCell.node(-1),a=i.$anchorCell.start(-1),l=ln.get(s).rectBetween(i.$anchorCell.pos-a,i.$headCell.pos-a);return r=cQ(r,l.right-l.left,l.bottom-l.top),Ik(t.state,t.dispatch,a,l,r),!0}else if(r){const s=Sh(t.state),a=s.start(-1);return Ik(t.state,t.dispatch,a,ln.get(s.node(-1)).findCell(s.pos-a),r),!0}else return!1}function mQ(t,e){var n;if(e.ctrlKey||e.metaKey)return;const r=Lk(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof Wt)s(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&r&&(i=Kl(t.state.selection.$anchor))!=null&&((n=Rv(t,e))==null?void 0:n.pos)!=i.pos)s(i,e),e.preventDefault();else if(!r)return;function s(u,c){let f=Rv(t,c);const p=_s.getState(t.state)==null;if(!f||!Bv(u,f))if(p)f=u;else return;const m=new Wt(u,f);if(p||!t.state.selection.eq(m)){const g=t.state.tr.setSelection(m);p&&g.setMeta(_s,u.pos),t.dispatch(g)}}function a(){t.root.removeEventListener("mouseup",a),t.root.removeEventListener("dragstart",a),t.root.removeEventListener("mousemove",l),_s.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(_s,-1))}function l(u){const c=u,f=_s.getState(t.state);let p;if(f!=null)p=t.state.doc.resolve(f);else if(Lk(t,c.target)!=r&&(p=Rv(t,e),!p))return a();p&&s(p,c)}t.root.addEventListener("mouseup",a),t.root.addEventListener("dragstart",a),t.root.addEventListener("mousemove",l)}function Rk(t,e,n){if(!(t.state.selection instanceof Pe))return null;const{$head:r}=t.state.selection;for(let i=r.depth-1;i>=0;i--){const s=r.node(i);if((n<0?r.index(i):r.indexAfter(i))!=(n<0?0:s.childCount))return null;if(s.type.spec.tableRole=="cell"||s.type.spec.tableRole=="header_cell"){const l=r.before(i),u=e=="vert"?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(u)?l:null}}return null}function Lk(t,e){for(;e&&e!=t.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Rv(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Kl(t.state.doc.resolve(n.pos)):null}var gQ=class{constructor(e,n){this.node=e,this.defaultCellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${n}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Lv(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,Lv(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function Lv(t,e,n,r,i,s){var a;let l=0,u=!0,c=e.firstChild;const f=t.firstChild;if(f){for(let p=0,m=0;p<f.childCount;p++){const{colspan:g,colwidth:b}=f.child(p).attrs;for(let v=0;v<g;v++,m++){const y=i==m?s:b&&b[v],x=y?y+"px":"";if(l+=y||r,y||(u=!1),c)c.style.width!=x&&(c.style.width=x),c=c.nextSibling;else{const E=document.createElement("col");E.style.width=x,e.appendChild(E)}}}for(;c;){const p=c.nextSibling;(a=c.parentNode)==null||a.removeChild(c),c=p}u?(n.style.width=l+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=l+"px")}}var Ar=new Et("tableColumnResizing");function bQ({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=gQ,lastColumnResizable:i=!0}={}){const s=new nt({key:Ar,state:{init(a,l){var u,c;const f=(c=(u=s.spec)==null?void 0:u.props)==null?void 0:c.nodeViews,p=Kn(l.schema).table.name;return r&&f&&(f[p]=(m,g)=>new r(m,n,g)),new vQ(-1,!1)},apply(a,l){return l.apply(a)}},props:{attributes:a=>{const l=Ar.getState(a);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(a,l)=>{yQ(a,l,t,i)},mouseleave:a=>{wQ(a)},mousedown:(a,l)=>{xQ(a,l,e,n)}},decorations:a=>{const l=Ar.getState(a);if(l&&l.activeHandle>-1)return _Q(a,l.activeHandle)},nodeViews:{}}});return s}var vQ=class Mm{constructor(e,n){this.activeHandle=e,this.dragging=n}apply(e){const n=this,r=e.getMeta(Ar);if(r&&r.setHandle!=null)return new Mm(r.setHandle,!1);if(r&&r.setDragging!==void 0)return new Mm(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&e.docChanged){let i=e.mapping.map(n.activeHandle,-1);return Ov(e.doc.resolve(i))||(i=-1),new Mm(i,n.dragging)}return n}};function yQ(t,e,n,r){if(!t.editable)return;const i=Ar.getState(t.state);if(i&&!i.dragging){const s=EQ(e.target);let a=-1;if(s){const{left:l,right:u}=s.getBoundingClientRect();e.clientX-l<=n?a=Dk(t,e,"left",n):u-e.clientX<=n&&(a=Dk(t,e,"right",n))}if(a!=i.activeHandle){if(!r&&a!==-1){const l=t.state.doc.resolve(a),u=l.node(-1),c=ln.get(u),f=l.start(-1);if(c.colCount(l.pos-f)+l.nodeAfter.attrs.colspan-1==c.width-1)return}Vk(t,a)}}}function wQ(t){if(!t.editable)return;const e=Ar.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Vk(t,-1)}function xQ(t,e,n,r){var i;if(!t.editable)return!1;const s=(i=t.dom.ownerDocument.defaultView)!=null?i:window,a=Ar.getState(t.state);if(!a||a.activeHandle==-1||a.dragging)return!1;const l=t.state.doc.nodeAt(a.activeHandle),u=CQ(t,a.activeHandle,l.attrs);t.dispatch(t.state.tr.setMeta(Ar,{setDragging:{startX:e.clientX,startWidth:u}}));function c(p){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",f);const m=Ar.getState(t.state);m!=null&&m.dragging&&(kQ(t,m.activeHandle,Pk(m.dragging,p,n)),t.dispatch(t.state.tr.setMeta(Ar,{setDragging:null})))}function f(p){if(!p.which)return c(p);const m=Ar.getState(t.state);if(m&&m.dragging){const g=Pk(m.dragging,p,n);Fk(t,m.activeHandle,g,r)}}return Fk(t,a.activeHandle,u,r),s.addEventListener("mouseup",c),s.addEventListener("mousemove",f),e.preventDefault(),!0}function CQ(t,e,{colspan:n,colwidth:r}){const i=r&&r[r.length-1];if(i)return i;const s=t.domAtPos(e);let l=s.node.childNodes[s.offset].offsetWidth,u=n;if(r)for(let c=0;c<n;c++)r[c]&&(l-=r[c],u--);return l/u}function EQ(t){for(;t&&t.nodeName!="TD"&&t.nodeName!="TH";)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}function Dk(t,e,n,r){const i=n=="right"?-r:r,s=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!s)return-1;const{pos:a}=s,l=Kl(t.state.doc.resolve(a));if(!l)return-1;if(n=="right")return l.pos;const u=ln.get(l.node(-1)),c=l.start(-1),f=u.map.indexOf(l.pos-c);return f%u.width==0?-1:c+u.map[f-1]}function Pk(t,e,n){const r=e.clientX-t.startX;return Math.max(n,t.startWidth+r)}function Vk(t,e){t.dispatch(t.state.tr.setMeta(Ar,{setHandle:e}))}function kQ(t,e,n){const r=t.state.doc.resolve(e),i=r.node(-1),s=ln.get(i),a=r.start(-1),l=s.colCount(r.pos-a)+r.nodeAfter.attrs.colspan-1,u=t.state.tr;for(let c=0;c<s.height;c++){const f=c*s.width+l;if(c&&s.map[f]==s.map[f-s.width])continue;const p=s.map[f],m=i.nodeAt(p).attrs,g=m.colspan==1?0:l-s.colCount(p);if(m.colwidth&&m.colwidth[g]==n)continue;const b=m.colwidth?m.colwidth.slice():SQ(m.colspan);b[g]=n,u.setNodeMarkup(a+p,null,{...m,colwidth:b})}u.docChanged&&t.dispatch(u)}function Fk(t,e,n,r){const i=t.state.doc.resolve(e),s=i.node(-1),a=i.start(-1),l=ln.get(s).colCount(i.pos-a)+i.nodeAfter.attrs.colspan-1;let u=t.domAtPos(i.start(-1)).node;for(;u&&u.nodeName!="TABLE";)u=u.parentNode;u&&Lv(s,u.firstChild,u,r,l,n)}function SQ(t){return Array(t).fill(0)}function _Q(t,e){var n;const r=[],i=t.doc.resolve(e),s=i.node(-1);if(!s)return ut.empty;const a=ln.get(s),l=i.start(-1),u=a.colCount(i.pos-l)+i.nodeAfter.attrs.colspan-1;for(let c=0;c<a.height;c++){const f=u+c*a.width;if((u==a.width-1||a.map[f]!=a.map[f+1])&&(c==0||a.map[f]!=a.map[f-a.width])){const p=a.map[f],m=l+p+s.nodeAt(p).nodeSize-1,g=document.createElement("div");g.className="column-resize-handle",(n=Ar.getState(t))!=null&&n.dragging&&r.push(qt.node(l+p,l+p+s.nodeAt(p).nodeSize,{class:"column-resize-dragging"})),r.push(qt.widget(m,g))}}return ut.create(t.doc,r)}function TQ({allowTableNodeSelection:t=!1}={}){return new nt({key:_s,state:{init(){return null},apply(e,n){const r=e.getMeta(_s);if(r!=null)return r==-1?null:r;if(n==null||!e.docChanged)return n;const{deleted:i,pos:s}=e.mapping.mapResult(n);return i?null:s}},props:{decorations:HZ,handleDOMEvents:{mousedown:mQ},createSelectionBetween(e){return _s.getState(e.state)!=null?e.state.selection:null},handleTripleClick:pQ,handleKeyDown:fQ,handlePaste:hQ},appendTransaction(e,n,r){return WZ(r,Ck(r,n),t)}})}const AQ=(t,e,n)=>{if(!t.doc)return t;const r=t.doc.nodeAt(e);if(!r||n===r.attrs.backgroundColor)return t;const i={...r.attrs,backgroundColor:n};return t.setNodeMarkup(e,r.type,i,r.marks)},MQ=(t,e,n)=>{const{doc:r,selection:i}=t;return!r||!i||!(i instanceof Wt)||i.forEachCell((s,a)=>{t=AQ(t,a,n)}),t},$k=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:s}=r;return n=n.setSelection(s),n=MQ(n,e,t),n.docChanged?(i==null||i(n),!0):!1},OQ=et.create({name:"tableCellBackground",addOptions(){return{types:["tableCell"],HTMLAttributes:{}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{parseHTML:t=>t.style.backgroundColor||"",renderHTML:t=>!t.backgroundColor||t.backgroundColor===""?{}:{style:`background-color: ${t.backgroundColor}`}}}}]},addCommands(){return{setTableCellBackground:t=>$k(t,this.options),unsetTableCellBackground:()=>$k("",this.options)}}}),BQ=Lt.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:t}){return["th",yt(this.options.HTMLAttributes,t),0]}}),IQ=Lt.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:t}){return["tr",yt(this.options.HTMLAttributes,t),0]}}),RQ=Lt.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?e.split(",").map(r=>parseInt(r,10)):null}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:t}){return["td",yt(this.options.HTMLAttributes,t),0]}});function Dv(t,e){return e?["width",`${Math.max(e,t)}px`]:["min-width",`${t}px`]}function Hk(t,e,n,r,i,s){var a;let l=0,u=!0,c=e.firstChild;const f=t.firstChild;if(f!==null)for(let p=0,m=0;p<f.childCount;p+=1){const{colspan:g,colwidth:b}=f.child(p).attrs;for(let v=0;v<g;v+=1,m+=1){const y=i===m?s:b&&b[v],x=y?`${y}px`:"";if(l+=y||r,y||(u=!1),c){if(c.style.width!==x){const[E,k]=Dv(r,y);c.style.setProperty(E,k)}c=c.nextSibling}else{const E=document.createElement("col"),[k,C]=Dv(r,y);E.style.setProperty(k,C),e.appendChild(E)}}}for(;c;){const p=c.nextSibling;(a=c.parentNode)===null||a===void 0||a.removeChild(c),c=p}u?(n.style.width=`${l}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${l}px`)}class LQ{constructor(e,n){this.node=e,this.cellMinWidth=n,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Hk(e,this.colgroup,this.table,n),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,Hk(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}}function DQ(t,e,n,r){let i=0,s=!0;const a=[],l=t.firstChild;if(!l)return{};for(let p=0,m=0;p<l.childCount;p+=1){const{colspan:g,colwidth:b}=l.child(p).attrs;for(let v=0;v<g;v+=1,m+=1){const y=n===m?r:b&&b[v];i+=y||e,y||(s=!1);const[x,E]=Dv(e,y);a.push(["col",{style:`${x}: ${E}`}])}}const u=s?`${i}px`:"",c=s?"":`${i}px`;return{colgroup:["colgroup",{},...a],tableWidth:u,tableMinWidth:c}}function zk(t,e){return t.createAndFill()}function PQ(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach(n=>{const r=t.nodes[n];r.spec.tableRole&&(e[r.spec.tableRole]=r)}),t.cached.tableNodeTypes=e,e}function VQ(t,e,n,r,i){const s=PQ(t),a=[],l=[];for(let c=0;c<n;c+=1){const f=zk(s.cell);if(f&&l.push(f),r){const p=zk(s.header_cell);p&&a.push(p)}}const u=[];for(let c=0;c<e;c+=1)u.push(s.row.createChecked(null,r&&c===0?a:l));return s.table.createChecked(null,u)}function FQ(t){return t instanceof Wt}const Oh=({editor:t})=>{const{selection:e}=t.state;if(!FQ(e))return!1;let n=0;const r=n4(e.ranges[0].$from,s=>s.type.name==="table");return r==null||r.node.descendants(s=>{if(s.type.name==="table")return!1;["tableCell","tableHeader"].includes(s.type.name)&&(n+=1)}),n===e.ranges.length?(t.commands.deleteTable(),!0):!1},$Q=Lt.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:LQ,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:r,tableMinWidth:i}=DQ(t,this.options.cellMinWidth);return["table",yt(this.options.HTMLAttributes,e,{style:r?`width: ${r}`:`min-width: ${i}`}),n,["tbody",0]]},addCommands(){return{insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:i,editor:s})=>{const a=VQ(s.schema,t,e,n);if(i){const l=r.selection.from+1;r.replaceSelectionWith(a).scrollIntoView().setSelection(Pe.near(r.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:t,dispatch:e})=>KZ(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>GZ(t,e),deleteColumn:()=>({state:t,dispatch:e})=>YZ(t,e),addRowBefore:()=>({state:t,dispatch:e})=>ZZ(t,e),addRowAfter:()=>({state:t,dispatch:e})=>QZ(t,e),deleteRow:()=>({state:t,dispatch:e})=>eQ(t,e),deleteTable:()=>({state:t,dispatch:e})=>aQ(t,e),mergeCells:()=>({state:t,dispatch:e})=>_k(t,e),splitCell:()=>({state:t,dispatch:e})=>Tk(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>jc("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>jc("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>iQ(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>_k(t,e)?!0:Tk(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:r})=>rQ(t,e)(n,r),goToNextCell:()=>({state:t,dispatch:e})=>Mk(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>Mk(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&Ck(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const r=Wt.create(e.doc,t.anchorCell,t.headCell);e.setSelection(r)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Oh,"Mod-Backspace":Oh,Delete:Oh,"Mod-Delete":Oh}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[bQ({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],TQ({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:pt(He(t,"tableRole",e))}}}),HQ=/(android|bb\d+|meego).+mobile|armv7l|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series[46]0|samsungbrowser.*mobile|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i,zQ=/CrOS/,UQ=/android|ipad|playbook|silk/i;function Uk(t={}){let e=t.ua||typeof navigator<"u"&&navigator.userAgent;return e&&typeof e=="object"&&e.headers&&typeof e.headers["user-agent"]=="string"&&(e=e.headers["user-agent"]),typeof e!="string"?!1:!!(HQ.test(e)&&!zQ.test(e)||t.tablet&&UQ.test(e)||t.tablet&&t.featureDetect&&navigator&&navigator.maxTouchPoints>1&&e.includes("Macintosh")&&e.includes("Safari"))}const WQ=["disabled"],jQ={"content-class":"table-grid-size-editor","content-style":"padding:0"},qQ={class:"flex flex-col flex-wrap gap-1 justify-between"},KQ=["onMouseover","onMousedown"],GQ={class:"text-center text-sm text-zinc-600 mt-2"},XQ=o.defineComponent({__name:"CreateTablePopover",props:{disabled:{type:Boolean,default:!1}},emits:["create-table"],setup(t,{emit:e}){const n=e,r=o.ref(!1),i=o.ref(!0),s=o.reactive({rows:Uk()?sf:of,cols:Uk()?sf:of}),a=o.reactive({rows:af,cols:af});function l(g,b){g===s.rows&&(s.rows=Math.min(g+1,sf)),b===s.cols&&(s.cols=Math.min(b+1,sf)),a.rows=g,a.cols=b}function u(g,b){n("create-table",{rows:g,cols:b,withHeaderRow:o.unref(i)}),c()}function c(){r.value=!1,i.value=!1,s.rows=of,s.cols=of,a.rows=af,a.cols=af}const f=o.inject("isMobile",!1),{isOpen:p}=yp({scrollEl:"tool-bar-format-scroll",ignoreSelector:"[data-radix-popper-content-wrapper]"}),m=o.computed(()=>f?{modal:!1,open:p.value,"onUpdate:open":g=>p.value=g}:{});return(g,b)=>(o.openBlock(),o.createBlock(o.unref(fs),o.normalizeProps(o.guardReactiveProps(o.unref(m))),{default:o.withCtx(()=>[o.createVNode(o.unref(ga),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("button",{disabled:t.disabled,class:"m-0 p-0"},[o.renderSlot(g.$slots,"trigger")],8,WQ)]),_:3}),o.createVNode(o.unref(ps),{class:"w-full",align:"start",side:"bottom"},{default:o.withCtx(()=>[o.createElementVNode("div",jQ,[o.createElementVNode("div",qQ,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.rows,v=>(o.openBlock(),o.createElementBlock("div",{key:"r"+v,class:"flex gap-1"},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(s.cols,y=>(o.openBlock(),o.createElementBlock("div",{key:"c"+y,class:o.normalizeClass([[y<=a.cols&&v<=a.rows&&"bg-ed-foreground border-ed-border","cursor-pointer"],"pa-1"]),onMouseover:x=>l(v,y),onMousedown:x=>u(v,y)},b[0]||(b[0]=[o.createElementVNode("div",{class:"w-4 h-4 p-1 border box-border"},null,-1)]),42,KQ))),128))]))),128))]),o.createElementVNode("div",GQ,o.toDisplayString(a.rows)+" x "+o.toDisplayString(a.cols),1)])]),_:1})]),_:3},16))}}),YQ={style:{display:"flex"}},JQ=o.defineComponent({__name:"TableActionButton",props:{editor:{},icon:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},color:{default:void 0},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0}},setup(t){const e=t;function n(r){e.editor.isActive("table")||e.editor.chain().focus().insertTable({...r,withHeaderRow:!1}).run()}return(r,i)=>(o.openBlock(),o.createBlock(XQ,{disabled:r.editor.isActive("table"),onCreateTable:n},{trigger:o.withCtx(()=>[o.createElementVNode("div",YQ,[o.createVNode(Xe,{icon:r.icon,tooltip:r.tooltip,disabled:r.disabled,color:r.color,action:r.action,"is-active":r.isActive},null,8,["icon","tooltip","disabled","color","action","is-active"])])]),_:1},8,["disabled"]))}}),Pv=$Q.extend({addStorage(){return{isTableMenuOpen:!1}},addCommands(){var t;return{...(t=this.parent)==null?void 0:t.call(this),toggleTableEditor:e=>({editor:n})=>n.storage.table?(n.storage.table.isTableEditorOpen=e,!0):!1}},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),resizable:!0,lastColumnResizable:!0,allowTableNodeSelection:!1,button:({editor:e,t:n})=>({component:JQ,componentProps:{icon:"Table",tooltip:n("editor.table.tooltip"),action:()=>{var i;const r=((i=e.storage.table)==null?void 0:i.isTableEditorOpen)??!1;e.commands.toggleTableEditor(!r)}}})}},addExtensions(){return[IQ.configure(this.options.tableRow),BQ.configure(this.options.tableHeader),RQ.configure(this.options.tableCell),OQ.configure(this.options.tableCellBackground)]}}),ZQ={class:"flex items-center gap-2 px-2"},QQ=o.defineComponent({__name:"TextDropdown",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},maxHeight:{default:void 0},icon:{default:void 0},tooltip:{default:""}},setup(t){const e=t,{t:n}=Tt(),r=o.computed(()=>[{name:"paragraph",label:n("editor.paragraph.tooltip"),iconName:"Paragraph",isActive:()=>e.editor.isActive("paragraph")&&!e.editor.isActive("orderedList")&&!e.editor.isActive("bulletList")&&!e.editor.isActive("taskList"),action:()=>e.editor.chain().focus().clearNodes().run()},{name:"heading1",label:n("editor.heading.h1.tooltip"),isActive:()=>e.editor.isActive("heading",{level:1}),iconName:"Heading1",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:1}).run()},{name:"heading2",label:n("editor.heading.h2.tooltip"),isActive:()=>e.editor.isActive("heading",{level:2}),iconName:"Heading2",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:2}).run()},{name:"heading3",label:n("editor.heading.h3.tooltip"),isActive:()=>e.editor.isActive("heading",{level:3}),iconName:"Heading3",action:()=>e.editor.chain().focus().clearNodes().toggleHeading({level:3}).run()},{name:"bulletList",label:n("editor.bulletlist.tooltip"),isActive:()=>e.editor.isActive("bulletList"),iconName:"List",action:()=>e.editor.chain().focus().clearNodes().toggleBulletList().run()},{name:"numberedList",label:n("editor.orderedlist.tooltip"),isActive:()=>e.editor.isActive("orderedList"),iconName:"ListOrdered",action:()=>e.editor.chain().focus().clearNodes().toggleOrderedList().run()},{name:"taskList",label:n("editor.tasklist.tooltip"),isActive:()=>e.editor.isActive("taskList"),iconName:"ListTodo",action:()=>e.editor.chain().focus().clearNodes().toggleTaskList().run()},{name:"blockquote",label:n("editor.blockquote.tooltip"),isActive:()=>e.editor.isActive("blockquote"),iconName:"TextQuote",action:()=>e.editor.chain().focus().clearNodes().toggleBlockquote().run()},{name:"codeBlock",label:n("editor.codeblock.tooltip"),isActive:()=>e.editor.isActive("codeBlock"),iconName:"Code2",action:()=>e.editor.chain().focus().clearNodes().toggleCodeBlock().run()}]),i=o.computed(()=>r.value.filter(s=>s.isActive()).pop()??{label:n("editor.modify")});return(s,a)=>{var l;return o.openBlock(),o.createBlock(ka,{title:(l=i.value)==null?void 0:l.label,"side-offset":5},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(u,c)=>{var f;return o.openBlock(),o.createBlock(o.unref($l),{key:c,class:"cursor-pointer",checked:((f=u.isActive)==null?void 0:f.call(u))||!1,onClick:u.action},{default:o.withCtx(()=>[o.createElementVNode("div",ZQ,[o.createVNode(o.unref(Ot),{name:u.iconName,class:"h3 w-3"},null,8,["name"]),o.createElementVNode("span",null,o.toDisplayString(u.label),1)])]),_:2},1032,["checked","onClick"])}),128))]),_:1},8,["title"])}}}),NQ=et.create({name:"text-bubble",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),toolbar:!1,button:()=>({component:QQ,componentProps:{}})}}}),eN=[{label:"복합 표현 - 요일과 시간대",examples:["다음 월요일 저녁","이번 토요일 오전"],pattern:"(이번|다음)?\\s?(월|화|수|목|금|토|일)요일(\\s?(오전|오후|저녁|밤|새벽))?"},{label:"시각 표현",examples:["오전 10시","오후 3시 30분","정오","자정","새벽 2시"],pattern:"((오전|오후|새벽|밤|저녁)\\s?\\d{1,2}(시(\\s?\\d{1,2}분)?)?|정오|자정)"},{label:"시간 표현 - 이른/늦은",examples:["이른 아침","늦은 밤"],pattern:"(이른\\s아침|늦은\\s밤)"},{label:"연도+월",examples:["2019년 6월","2025년12월","2024년 01월"],pattern:"\\d{4}년\\s?\\d{1,2}월"},{label:"오늘/내일/어제",examples:["오늘","내일","모레","어제","그제","그끄제"],pattern:"(오늘|내일|모레|어제|그제|그끄제)"},{label:"상대적 주 단위",examples:["이번 주","다음 주","지난 주"],pattern:"(이번|다음|지난)\\s?주"},{label:"상대적 월 단위",examples:["이번 달","다음 달","지난 달"],pattern:"(이번|다음|지난)\\s?달"},{label:"상대적 연도",examples:["올해","내년","작년","재작년","내후년"],pattern:"(올해|내년|작년|재작년|내후년)"},{label:"복합 표현 - 날짜와 시간대",examples:["1월 1일 오전","12월25일 저녁","다음 주 금요일 오전"],pattern:"(내년|올해|작년)?\\s?\\d{1,2}\\s?월\\s?\\d{1,2}\\s?일(\\s?(오전|오후|저녁|밤|새벽))?"},{label:"정확한 날짜",examples:["1월1일","1월 1일","12월 25일","01월 01일"],pattern:"\\d{1,2}\\s?월\\s?\\d{1,2}\\s?일"},{label:"요일",examples:["월요일","화요일","이번 금요일","다음 화요일"],pattern:"(이번|다음)?\\s?(월|화|수|목|금|토|일)요일"},{label:"시간대",examples:["오전","오후","저녁","밤","새벽"],pattern:"(오전|오후|저녁|밤|새벽)"},{label:"짧은 시간 표현",examples:["방금","조금 전","금방","곧","잠시 후"],pattern:"(방금|조금\\s전|금방|곧|잠시\\s후)"},{label:"연도",examples:["2015년","2024년","1998년"],pattern:"\\d{4}년"}],tN=t=>{const e=[...t||[],...eN.map(n=>n.pattern)].join("|");return new RegExp(e,"gu")},nN=et.create({name:ep,addOptions(){return{additionalTimeWords:[],enabled:!0}},addStorage(){return{cachedRegex:null,cachedAdditionalWords:null,enabled:this.options.enabled}},addProseMirrorPlugins(){return[new nt({props:{decorations:t=>{if(!this.storage.enabled)return ut.empty;const e=[];return(this.storage.cachedAdditionalWords!==this.options.additionalTimeWords||!this.storage.cachedRegex)&&(this.storage.cachedAdditionalWords=this.options.additionalTimeWords,this.storage.cachedRegex=tN(this.options.additionalTimeWords)),t.doc.descendants((n,r)=>{if(!n.isText)return;let i;const s=this.storage.cachedRegex;for(;i=s.exec(n.text||"");){const a=r+i.index,l=a+i[0].length;e.push(qt.inline(a,l,{class:"time-highlight"}))}}),ut.create(t.doc,e)}}})]},addCommands(){return{toggleTimeHighlight:()=>({editor:t})=>{const e=t.storage[ep];return e.enabled=!e.enabled,t.view.dispatch(t.state.tr),!0}}}});function Vv(t){const e=JSON.stringify(t),n=window.ReactNativeWebView;if(n){n.postMessage(e);return}console.warn("[clipboardBridge] no bridge found")}function rN(){return new Promise(t=>{const e=window.receiveDriverData;window.receiveDriverData=n=>{var i;e&&e(n);let r;try{r=typeof n=="string"?JSON.parse(n):n}catch{return}(r==null?void 0:r.type)==="CLIPBOARD_STATE"&&t(!!((i=r.data)!=null&&i.hasClipboard))},Vv({type:"REQUEST_CLIPBOARD_STATE"})})}function oN(){return new Promise(t=>{const e=window.receiveDriverData;window.receiveDriverData=n=>{var i;e&&e(n);let r;try{r=typeof n=="string"?JSON.parse(n):n}catch{return}(r==null?void 0:r.type)==="PASTE_RESULT"&&t(((i=r.data)==null?void 0:i.text)??null)},Vv({type:"PASTE"})})}function iN(t,e){Vv({type:"COPY",data:{html:t,text:e}})}async function sN(t,e){try{const n=new ClipboardItem({"text/html":new Blob([t],{type:"text/html"}),"text/plain":new Blob([e],{type:"text/plain"})});await navigator.clipboard.write([n])}catch(n){console.error("navigator clipboard write failed:",n)}}async function aN(){try{if("read"in navigator.clipboard){const t=await navigator.clipboard.read();for(const e of t){if(e.types.includes("text/html"))return await(await e.getType("text/html")).text();if(e.types.includes("text/plain"))return await(await e.getType("text/plain")).text()}}}catch(t){console.warn("navigator clipboard read failed:",t)}}const lN=et.create({name:"clipboard",addCommands(){return{copyContent:()=>({editor:t,state:e})=>{const{from:n,to:r}=e.selection;return n===r?!1:((async()=>{try{const i=e.doc.slice(n,r),a=Pr.fromSchema(t.schema).serializeFragment(i.content),l=document.createElement("div");l.appendChild(a);const u=l.innerHTML,c=e.doc.textBetween(n,r,`
344
344
  `);t.storage.deviceEnv.isMobile?iN(u,c):await sN(u,c)}catch(i){console.warn("[clipboard] copy failed",i)}})(),!0)},cutContent:()=>({editor:t})=>((async()=>{try{await t.commands.copyContent(),t.chain().focus().deleteSelection().run()}catch(e){console.warn("[clipboard] cut failed",e)}})(),!0),pasteContent:()=>({editor:t})=>((async()=>{try{t.chain().focus().run();const e=t.storage.deviceEnv.isMobile?await oN():await aN();if(!e)return;let n="",r="";if(IJ(e)){n=e;const a=document.createElement("div");a.innerHTML=e,r=a.innerText}else r=e,n=e.replace(/\n/g,"<br>");const i=new DataTransfer;i.setData("text/html",n),i.setData("text/plain",r);const s=new ClipboardEvent("paste",{bubbles:!0,cancelable:!0});Object.defineProperty(s,"clipboardData",{value:i}),t.view.dom.dispatchEvent(s)}catch(e){console.warn("Clipboard paste failed:",e)}})(),!0)}},onCreate(){const t=this.editor;t.hasClipboard=async()=>{try{return!!(t.storage.deviceEnv.isMobile?await rN():await navigator.clipboard.readText())}catch(e){return console.warn("[clipboard] check failed",e),!1}}}}),uN=et.create({name:"deviceEnv",addOptions(){return{initial:!1,specialCharModal:void 0}},addStorage(){return{isMobile:this.options.initial,specialCharModal:this.options.specialCharModal,isForceCloseBubble:!1}},addCommands(){return{setIsMobile:t=>({editor:e})=>{var n;return e.storage.deviceEnv.isMobile=t,(n=e.storage.spellchecker)==null||n.spellchecker.setIsMobile(t),!0},setForceCloseBubble:t=>({editor:e})=>(e.storage.deviceEnv.isForceCloseBubble=t,!0),resetForceCloseBubble:()=>({editor:t})=>(t.storage.deviceEnv.isForceCloseBubble=!1,!0)}}}),Bh=o.defineComponent({__name:"TabsContent",props:{value:{},forceMount:{type:Boolean},asChild:{type:Boolean},as:{},class:{}},setup(t){const e=t,n=o.computed(()=>{const{class:r,...i}=e;return i});return(r,i)=>(o.openBlock(),o.createBlock(o.unref(FV),o.mergeProps({class:o.unref(Se)("mt-2 ring-offset-ed-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ed-ring focus-visible:ring-offset-2",e.class)},n.value),{default:o.withCtx(()=>[o.renderSlot(r.$slots,"default")]),_:3},16,["class"]))}}),cN={class:"flex items-center w-full p-3 my-3 hover:bg-ed-accent border border-ed-border text-ed-muted-foreground cursor-pointer rounded-sm transition-all"},dN={key:0,class:"flex justify-center items-center gap-3 text-s"},fN={key:1,class:"flex justify-between items-center w-full"},pN={class:"flex justify-center items-center gap-3"},hN={class:"text-sm"},mN={class:"flex items-center gap-2"},gN=o.defineComponent({__name:"VideoUploader",props:{...na},setup(t){const e=t,n=o.inject("isEditable",o.ref(!0)),r=o.ref(""),i=o.ref(!1),s=o.ref(),{t:a}=Tt();function l(p){var y;i.value=!0;const m=p.target,g=Array.from((m==null?void 0:m.files)||[]),b=(y=e.editor.extensionManager.extensions.find(x=>x.name==="videoUpload"))==null?void 0:y.options;if(!e.editor||e.editor.isDestroyed||g.length===0||typeof(b==null?void 0:b.upload)!="function")return;const v=g[0];b.upload(v).then(x=>{e.editor.chain().setVideo({src:x}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run(),i.value=!1})}function u(){e.editor.chain().setVideo({src:r.value,width:640}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run()}function c(){e.deleteNode()}function f(){var p;(p=s.value)==null||p.click()}return(p,m)=>(o.openBlock(),o.createBlock(o.unref(ta),{as:"div","data-drag-handle":"",class:o.normalizeClass(o.unref(Se)(!o.unref(n)&&"pointer-events-none"))},{default:o.withCtx(()=>[o.createVNode(o.unref(fs),{"default-open":o.unref(n)},{default:o.withCtx(()=>[o.createVNode(o.unref(ga),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",cN,[i.value?(o.openBlock(),o.createElementBlock("div",dN,[o.createVNode(o.unref(Ot),{class:"animate-spin w-6 h-6",name:"LoaderCircle"}),o.createElementVNode("span",null,o.toDisplayString(o.unref(a)("editor.video.dialog.uploading"))+"...",1)])):(o.openBlock(),o.createElementBlock("div",fN,[o.createElementVNode("div",pN,[o.createVNode(o.unref(Ot),{name:"Video",class:"w-6 h-6"}),o.createElementVNode("span",hN,o.toDisplayString(o.unref(a)("editor.video.dialog.title")),1)]),o.createVNode(o.unref(Ot),{name:"Trash2",class:"hover:text-ed-foreground",onClick:o.withModifiers(c,["stop"])})]))])]),_:1}),o.createVNode(o.unref(ps),{"trap-focus":"",class:"w-full","on-open-auto-focus":g=>g.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref(rp),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(op),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Rl),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Rl),{value:"link",disabled:i.value},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.link")),1)]),_:1},8,["disabled"])]),_:1}),o.createVNode(o.unref(Bh),{value:"upload"},{default:o.withCtx(()=>[o.createVNode(o.unref(vn),{class:"w-full mt-1",size:"sm",disabled:i.value,onClick:f},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.tab.upload")),1)]),_:1},8,["disabled"]),o.createElementVNode("input",{ref_key:"fileInput",ref:s,type:"file",accept:"video/*",hidden:"",onChange:l},null,544)]),_:1}),o.createVNode(o.unref(Bh),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",mN,[o.createVNode(o.unref(hs),{modelValue:r.value,"onUpdate:modelValue":m[0]||(m[0]=g=>r.value=g),type:"url",autofocus:"",required:"",placeholder:o.unref(a)("editor.video.dialog.placeholder")},null,8,["modelValue","placeholder"]),o.createVNode(o.unref(vn),{onClick:u},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(a)("editor.video.dialog.button.apply")),1)]),_:1})])]),_:1})]),_:1})]),_:1},8,["on-open-auto-focus"])]),_:1},8,["default-open"])]),_:1},8,["class"]))}}),Wk=Lt.create({name:sc,isolating:!0,defining:!0,group:"block",draggable:!0,selectable:!1,inline:!1,parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML(){return["div",{"data-type":this.name}]},addCommands(){return{setVideoUpload:()=>({commands:t})=>t.insertContent(`<div data-type="${this.name}"></div>`)}},addNodeView(){return ra(gN)},addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),upload:()=>Promise.reject("link video not found"),button:({editor:e,t:n})=>{var r,i;return{component:Xe,componentProps:{action:()=>e.commands.setVideoUpload(),isActive:()=>e.isActive("video")||!1,disabled:!((i=(r=e.can()).setVideo)!=null&&i.call(r,{})),icon:"Video",tooltip:n("editor.video.tooltip")}}}}}});function bN(t){return t=t.replace("https://youtu.be/","https://www.youtube.com/watch?v=").replace("watch?v=","embed/"),t=t.replace("https://vimeo.com/","https://player.vimeo.com/video/"),/^https?:\/\/www.bilibili.com\/video\/.*/i.test(t)&&(t=t.replace(/\?.*$/i,"").replace("https://www.bilibili.com/video/","https://player.bilibili.com/player.html?bvid=")),t.includes("drive.google.com")&&(t=t.replace("/view","/preview")),t}function vN(t){return t?t.includes("youtube.com/embed")||t.includes("player.vimeo.com")||t.includes("player.bilibili.com")||t.includes("drive.google.com"):!1}const jk=Lt.create({name:"video",group:"block",atom:!0,draggable:!0,addOptions(){return{divider:!1,spacer:!1,allowFullscreen:!0,upload:void 0,width:lf["size-medium"],controls:!0,autoplay:!1,HTMLAttributes:{class:"iframe-wrapper",style:"display: flex;justify-content: center;"}}},addAttributes(){return{src:{default:null,renderHTML:({src:t})=>({src:t?bN(t):null})},width:{default:this.options.width,renderHTML:({width:t})=>({width:rn(t)})},allowfullscreen:{default:this.options.allowFullscreen,parseHTML:()=>this.options.allowFullscreen},controls:{default:this.options.controls}}},parseHTML(){return[{tag:"video"},{tag:"iframe"}]},renderHTML({HTMLAttributes:t}){const{src:e,width:n,controls:r,allowfullscreen:i}=t??{},s=`max-width: ${rn(n)};`;return vN(e)?["iframe",{src:e,style:s,...i&&{allowfullscreen:i}}]:["video",{src:e?e.replace(/\\/g,"/"):"",style:s,...r&&{controls:r}}]},addCommands(){return{setVideo:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t}),updateVideo:t=>({commands:e})=>e.updateAttributes(this.name,t)}}}),Gl=new Et("upload-image"),yN=()=>new nt({key:Gl,state:{init(){return ut.empty},apply(t,e){e=e.map(t.mapping,t.doc);const n=t.getMeta(Gl);if(n!=null&&n.add){const r=n.add.map(({id:i,pos:s,src:a})=>{const l=wN(a);return qt.widget(s,l,{id:i,side:-1})});e=e.add(t.doc,r)}return n!=null&&n.remove&&n.remove.forEach(r=>{e=e.remove(e.find(void 0,void 0,i=>i.id===r))}),e}},props:{decorations(t){return this.getState(t)}}});function wN(t){const e=document.createElement("div"),n=document.createElement("img");return n.setAttribute("class","opacity-50"),n.src=t,n.onload=()=>{e.setAttribute("class","img-placeholder")},e.appendChild(n),e}function xN(t,e){var i;const r=Gl.getState(t).find(void 0,void 0,s=>s.id===e);return r.length?(i=r[0])==null?void 0:i.from:null}const qk=({validateFn:t,onUpload:e})=>async(n,r,i)=>{const s=[];for(const a of n){if(t&&!t(a))continue;const l=Xr(6),u=URL.createObjectURL(a);s.push({file:a,id:l,preview:u})}s.length!==0&&(r.dispatch(r.state.tr.setMeta(Gl,{add:s.map(({id:a,preview:l})=>({id:a,pos:i,src:l}))})),await Promise.all(s.map(async({file:a,id:l,preview:u})=>{var c,f;try{const p=await e(a),m=xN(r.state,l);if(m===null)return;const{schema:g}=r.state,b=typeof p=="object"?u:p,v=(c=g.nodes.image)==null?void 0:c.create({src:b}),y=(f=g.nodes.paragraph)==null?void 0:f.create();if(!v||!y)return;r.dispatch(r.state.tr.replaceWith(m,m,v).insert(m+v.nodeSize,y).setMeta(Gl,{remove:[l]}))}catch{r.dispatch(r.state.tr.setMeta(Gl,{remove:[l]}))}})))},CN=(t,e,n)=>{var i;const r=Array.from(((i=e.clipboardData)==null?void 0:i.files)||[]);if(r.length){e.preventDefault();const s=t.state.selection.from;return n(r,t,s+1),!0}return!1},EN=(t,e,n,r)=>{var s;const i=Array.from(((s=e.dataTransfer)==null?void 0:s.files)||[]);if(!n&&i.length){e.preventDefault();const a=t.posAtCoords({left:e.clientX,top:e.clientY});if(a)return r(i,t,a.pos+1),!0}return!1},kN={class:"flex items-center w-full p-3 my-3 transition-all border rounded-sm cursor-pointer hover:bg-ed-accent border-ed-border text-ed-muted-foreground"},SN={class:"flex items-center justify-between w-full"},_N={class:"flex items-center justify-center gap-3"},TN={class:"text-sm"},AN={class:"flex items-center gap-2"},MN=o.defineComponent({__name:"ImageUploader",props:{...na},setup(t){const e=t,n=o.ref(""),r=o.ref(),{t:i}=Tt(),s=o.inject("isEditable",o.ref(!0));function a(f){var v,y;const p=(v=f==null?void 0:f.target)==null?void 0:v.files;if(!e.editor||e.editor.isDestroyed||p.length===0)return;const m=Array.from(p),g=(y=e.editor.extensionManager.extensions.find(x=>x.name==="imageUpload"))==null?void 0:y.options;qk({validateFn:x=>!0,onUpload:g.upload})(m,e.editor.view,e.getPos(),e.node.attrs.id)}function l(){e.editor.chain().setImage({src:n.value}).deleteRange({from:e.getPos(),to:e.getPos()}).insertContentAt(e.getPos()+1,{type:"paragraph"}).focus().run()}function u(){e.deleteNode()}function c(){var f;(f=r.value)==null||f.click()}return(f,p)=>(o.openBlock(),o.createBlock(o.unref(ta),{id:f.node.attrs.id,"data-drag-handle":"",class:o.normalizeClass(o.unref(Se)(!o.unref(s)&&"pointer-events-none"))},{default:o.withCtx(()=>[o.createVNode(o.unref(fs),{"default-open":o.unref(s)},{default:o.withCtx(()=>[o.createVNode(o.unref(ga),{"as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",kN,[o.createElementVNode("div",SN,[o.createElementVNode("div",_N,[o.createVNode(o.unref(Ot),{name:"ImageUp",class:"w-6 h-6"}),o.createElementVNode("span",TN,o.toDisplayString(o.unref(i)("editor.image.dialog.title")),1)]),o.createVNode(o.unref(Ot),{name:"Trash2",class:"hover:text-ed-foreground",onClick:o.withModifiers(u,["stop"])})])])]),_:1}),o.createVNode(o.unref(ps),{"trap-focus":"",class:"w-full","on-open-auto-focus":m=>m.preventDefault()},{default:o.withCtx(()=>[o.createVNode(o.unref(rp),{"default-value":"upload",class:"w-[300px] sm:w-[400px]","activation-mode":"manual"},{default:o.withCtx(()=>[o.createVNode(o.unref(op),{class:"grid w-full grid-cols-2"},{default:o.withCtx(()=>[o.createVNode(o.unref(Rl),{value:"upload"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.upload")),1)]),_:1}),o.createVNode(o.unref(Rl),{value:"link"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.url")),1)]),_:1})]),_:1}),o.createVNode(o.unref(Bh),{value:"upload"},{default:o.withCtx(()=>[o.createVNode(o.unref(vn),{class:"w-full mt-1",size:"sm",onClick:c},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.tab.upload")),1)]),_:1}),o.createElementVNode("input",{ref_key:"fileInput",ref:r,type:"file",accept:"image/*",multiple:"",hidden:"",onChange:a},null,544)]),_:1}),o.createVNode(o.unref(Bh),{value:"link"},{default:o.withCtx(()=>[o.createElementVNode("div",AN,[o.createVNode(o.unref(hs),{modelValue:n.value,"onUpdate:modelValue":p[0]||(p[0]=m=>n.value=m),type:"url",autofocus:"",required:"",placeholder:o.unref(i)("editor.image.dialog.placeholder")},null,8,["modelValue","placeholder"]),o.createVNode(o.unref(vn),{onClick:l},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.image.dialog.button.apply")),1)]),_:1})])]),_:1})]),_:1})]),_:1},8,["on-open-auto-focus"])]),_:1},8,["default-open"])]),_:1},8,["id","class"]))}}),ON=1,BN=1e6,Si={ADD_TOAST:"ADD_TOAST",UPDATE_TOAST:"UPDATE_TOAST",DISMISS_TOAST:"DISMISS_TOAST",REMOVE_TOAST:"REMOVE_TOAST"};let Fv=0;function IN(){return Fv=(Fv+1)%Number.MAX_VALUE,Fv.toString()}const $v=new Map;function Kk(t){if($v.has(t))return;const e=setTimeout(()=>{$v.delete(t),qc({type:Si.REMOVE_TOAST,toastId:t})},BN);$v.set(t,e)}const ko=o.ref({toasts:[]});function qc(t){switch(t.type){case Si.ADD_TOAST:ko.value.toasts=[t.toast,...ko.value.toasts].slice(0,ON);break;case Si.UPDATE_TOAST:ko.value.toasts=ko.value.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e);break;case Si.DISMISS_TOAST:{const{toastId:e}=t;e?Kk(e):ko.value.toasts.forEach(n=>{Kk(n.id)}),ko.value.toasts=ko.value.toasts.map(n=>n.id===e||e===void 0?{...n,open:!1}:n);break}case Si.REMOVE_TOAST:t.toastId===void 0?ko.value.toasts=[]:ko.value.toasts=ko.value.toasts.filter(e=>e.id!==t.toastId);break}}function Hv(){return{toasts:o.computed(()=>ko.value.toasts),toast:RN,dismiss:t=>qc({type:Si.DISMISS_TOAST,toastId:t})}}function RN(t){const e=IN(),n=i=>qc({type:Si.UPDATE_TOAST,toast:{...i,id:e}}),r=()=>qc({type:Si.DISMISS_TOAST,toastId:e});return qc({type:Si.ADD_TOAST,toast:{...t,id:e,open:!0,onOpenChange:i=>{i||r()}}}),{id:e,dismiss:r,update:n}}const LN={acceptMimes:["image/jpeg","image/gif","image/png","image/jpg"],maxSize:1024*1024*5},DN=t=>`${(t/1024/1024).toFixed(2)}MB`,Gk=Lt.create({name:bi,isolating:!0,defining:!0,group:"block",draggable:!1,selectable:!1,inline:!1,onCreate(){if(typeof this.options.upload!="function")throw new Error("Image upload function should be a function")},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML(){return["div",{"data-type":this.name}]},addAttributes(){return{id:{default:Xr(6),parseHTML:t=>t.getAttribute("id"),renderHTML:t=>t.id?{id:t.id}:{}}}},addCommands(){return{setImageUpload:()=>({commands:t})=>t.insertContent(`<div data-type="${this.name}"></div>`)}},addNodeView(){return ra(MN)},addOptions(){var t;return{...LN,...(t=this.parent)==null?void 0:t.call(this),upload:()=>Promise.reject("Image Upload Function"),button:({editor:e,extension:n,t:r})=>{var i,s;return{component:Xe,componentProps:{action:()=>e.commands.setImageUpload(),disabled:!((s=(i=e.can()).setImage)!=null&&s.call(i,{})),icon:"ImageUp",tooltip:r("editor.image.tooltip")}}}}},addProseMirrorPlugins(){const{toast:t}=Hv(),{t:e}=Tt(),r=qk({validateFn:i=>this.options.acceptMimes.includes(i.type)?i.size>this.options.maxSize?(t({description:`${e("editor.imageUpload.fileSizeTooBig")} ${DN(this.options.maxSize)}.`,duration:2e3}),!1):!0:(t({description:e("editor.imageUpload.fileTypeNotSupported"),duration:2e3}),!1),onUpload:this.options.upload});return[new nt({props:{handlePaste:(i,s)=>!s.clipboardData||Array.from(s.clipboardData.items||[]).some(l=>l.type==="text/html")?!1:CN(i,s,r),handleDrop:(i,s,a,l)=>!(s instanceof DragEvent)||!s.dataTransfer||!Array.from(s.dataTransfer.files||[]).some(f=>this.options.acceptMimes.includes(f.type))?!1:EN(i,s,l,r)}}),yN()]}}),PN=et.create({name:"searchHighlight",addGlobalAttributes(){return[{types:["textStyle"],attributes:{searchHighlight:{default:null,parseHTML:t=>{const e=t,n=e.style.color,r=e.style.backgroundColor;return!n||!r?null:{color:n,backgroundColor:r}},renderHTML:t=>{if(!t.searchHighlight)return{};const{color:e,backgroundColor:n}=t.searchHighlight;return{style:`color: ${e}; background-color: ${n}`}}}}}]}}),VN=o.defineComponent({__name:"SpecialCharacterButton",props:{editor:l4},setup(t){const e=t,{t:n}=Tt(),r=xn(),i=o.computed(()=>{var p;return(p=e.editor)==null?void 0:p.storage.specialCharacter.specialCharModal}),s=o.ref(!1);let a=null;function l(){const p=document.activeElement;if(p instanceof HTMLInputElement){a={type:"input",el:p};return}r.editorFocusedInstance.value&&(a={type:"editor"})}const u=()=>{if(!i.value||!i.value.component){console.error("Please configure specialCharModal!");return}s.value=!s.value};document.addEventListener("focusin",p=>{var b,v;if(!s.value)return;const m=p.target;if(m instanceof HTMLInputElement){a={type:"input",el:m};return}const g=r.editorFocusedInstance.value;(v=(b=g==null?void 0:g.view)==null?void 0:b.dom)!=null&&v.contains(m)&&(a={type:"editor"})});function c(p,m){const g=p.selectionStart??p.value.length,b=p.selectionEnd??p.value.length;p.value=p.value.slice(0,g)+m+p.value.slice(b);const v=g+m.length;p.setSelectionRange(v,v),p.dispatchEvent(new Event("input",{bubbles:!0})),p.focus()}const f=(p,m)=>{if(m){if((a==null?void 0:a.type)==="input"){c(a.el,p);return}if((a==null?void 0:a.type)==="editor"){const g=r.editorFocusedInstance.value;if(!g)return;const{view:b}=g,{from:v}=b.state.selection;g.commands.insertContentAt(v,p),g.commands.focus()}}};return(p,m)=>{const g=va,b=ms,v=ba,y=ya;return o.openBlock(),o.createBlock(y,null,{default:o.withCtx(()=>[o.createVNode(v,{"delay-duration":0},{default:o.withCtx(()=>[o.createVNode(g,null,{default:o.withCtx(()=>[o.createVNode(vn,{class:"text-[#65558F] hover:bg-[#ECE6F0]/90 text-xs rounded-none font-normal h-[26px] px-3 border border-gray-300 bg-ed-gray-50 dark:bg-black dark:text-white dark:hover:bg-gray-700 transition-all",onPointerdown:l,onClick:u},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.insert.symbol")),1)]),_:1})]),_:1}),o.createVNode(b,null,{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.insert.symbol")),1)]),_:1})]),_:1}),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[o.unref(s)?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(i).component),o.mergeProps({key:0},o.unref(i).props,{"custom-class":"!z-[70] !pointer-events-auto",onClose:m[0]||(m[0]=x=>s.value=!1),onSelectedChar:f}),null,16)):o.createCommentVNode("",!0)]))]),_:1})}}}),FN=et.create({name:tp,addOptions(){return{button:({editor:t})=>({component:VN,componentProps:{editor:t}}),specialCharModal:void 0}},addStorage(){return{specialCharModal:this.options.specialCharModal}}}),Xk=et.create({name:"base-kit",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),timeHighlighter:{additionalTimeWords:[]},bubble:{list:ZI,defaultBubbleList:RG,button:({editor:e,extension:n,t:r})=>{var l;const{list:i={},defaultBubbleList:s}=((l=n.options)==null?void 0:l.bubble)??{},a=(s==null?void 0:s(e))??[];return LG(i,a,{editor:e,extension:n,t:r})}}}},addExtensions(){var n,r,i;const{t}=Tt(),e=[];this.options.placeholder!==!1&&e.push(Y5.configure({placeholder:({node:s,pos:a})=>{var u;const l=(u=s==null?void 0:s.type)==null?void 0:u.name;return l==="heading"?`${t(`editor.heading.h${s.attrs.level}.tooltip`)}`:l==="table"||l==="codeBlock"?"":a===0?t("editor.content"):""},...this.options.placeholder})),this.options.focus!==!1&&e.push(xG.configure({className:"focus",...this.options.focus})),this.options.document!==!1&&(this.options.page?(e.push(Q5.configure().extend({content:"page+"})),e.push(lZ.configure({types:((r=(n=this.options.page)==null?void 0:n.nodesComputedOption)==null?void 0:r.types)??[],slots:o.useSlots()}))):e.push(Q5.configure())),this.options.dropcursor!==!1&&e.push(wG.configure({...this.options.dropcursor,width:2,class:"ProseMirror-dropcursor border-black"})),this.options.characterCount!==!1&&e.push(bG.configure(this.options.characterCount)),this.options.paragraph!==!1&&e.push(X5.configure(this.options.paragraph)),this.options.hardBreak!==!1&&e.push(G5.configure(this.options.hardBreak)),this.options.listItem!==!1&&e.push(OG.configure(this.options.listItem)),this.options.textStyle!==!1&&e.push(BG.configure(this.options.textStyle)),this.options.imageUpload!==!1&&e.push(Gk.configure(this.options.imageUpload)),this.options.video!==!1&&e.push(jk.configure(this.options.video)),this.options.videoUpload!==!1&&e.push(Wk.configure(this.options.videoUpload)),this.options.history!==!1&&e.push(zb.configure(this.options.history)),this.options.fontFamily!==!1&&e.push(pk.configure(this.options.fontFamily)),this.options.fontSize!==!1&&e.push(m5.configure(this.options.fontSize)),this.options.fontWeight!==!1&&e.push(fZ.configure(this.options.fontWeight)),this.options.mode!==Me.EDITOR&&e.push(FN.configure(this.options.specialCharacter)),this.options.mode!==Me.EDITOR&&e.push(gZ),this.options.superText!==!1&&this.options.mode!==Me.PLAIN_TEXT&&this.options.mode!==Me.EDITOR&&(typeof this.options.superText=="boolean"?e.push(ik.configure()):e.push(ik.configure(this.options.superText))),this.options.mode===Me.EDITOR&&(this.options.image!==!1&&e.push(qu.configure()),e.push(p5.configure({spacer:!0}),V8,P8,F8,Fb,Pv,$8,g5.configure({spacer:!0}),h5.configure({types:["heading","paragraph","tableCell","tableHeader"],spacer:!0}),gk)),this.options.mode!==Me.EDITOR&&this.options.configPlan!==!1&&this.options.mode!==Me.PLAIN_TEXT&&(typeof this.options.configPlan=="boolean"?e.push(vk.configure()):e.push(vk.configure({specialCharModal:(i=this.options.configPlan)==null?void 0:i.specialCharModal}))),this.options.mode!==Me.EDITOR&&this.options.mode!==Me.PLAIN_TEXT&&e.push(vZ),(this.options.mode===Me.STRAIGHT||this.options.mode===Me.REPORT||this.options.mode===Me.EDITOR)&&this.options.timeHighlighter&&e.push(nN.configure(this.options.timeHighlighter)),this.options.invalidCharFocus!==!1&&e.push(uk.configure(this.options.invalidCharFocus)),this.options.disabled&&e.push(PN),e.push(N5,J5.configure(),NQ.configure(),MG.configure(),Tv,Sv,hb,lN,uN.configure(this.options.deviceEnv),b5.configure({multicolor:!0}));for(const s in this.options.excludes)Object.prototype.hasOwnProperty.call(this.options.excludes,s)&&this.options.excludes[s]&&kt.remove(e,({name:l})=>l===s);return e},addStorage(){return{mode:this.options.mode}}}),Yk=zn.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(t){return t!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sub",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSubscript:()=>({commands:t})=>t.setMark(this.name),toggleSubscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSubscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),Jk=zn.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(t){return t!=="super"?!1:null}}]},renderHTML({HTMLAttributes:t}){return["sup",yt(this.options.HTMLAttributes,t),0]},addCommands(){return{setSuperscript:()=>({commands:t})=>t.setMark(this.name),toggleSuperscript:()=>({commands:t})=>t.toggleMark(this.name),unsetSuperscript:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),$N=et.create({name:"subAndSuperScript",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,extension:n,t:r})=>{const i=n.options.subscript,s=n.options.superscript,a={component:Xe,componentProps:{action:()=>e.commands.toggleSubscript(),isActive:()=>e.isActive("subscript")||!1,disabled:!e.can().toggleSubscript(),icon:"Subscript",tooltip:r("editor.subscript.tooltip")}},l={component:Xe,componentProps:{action:()=>e.commands.toggleSuperscript(),isActive:()=>e.isActive("superscript")||!1,disabled:!e.can().toggleSuperscript(),icon:"Superscript",tooltip:r("editor.superscript.tooltip")}},u=[];return i!==!1&&u.push(a),s!==!1&&u.push(l),u}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(Yk.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(Jk.configure(this.options.superscript)),t}}),HN={class:"ml-1"},zN=o.defineComponent({__name:"ActionMoreButton",props:{editor:{},disabled:{type:Boolean,default:!1},color:{default:void 0},maxHeight:{default:void 0},icon:{default:void 0},tooltip:{default:""},items:{default:()=>[]}},setup(t){const e=t,n=o.computed(()=>{const r=e.items.find(s=>s.isActive());return r&&!r.default?{...r,icon:r.icon?r.icon:e.icon}:{title:e.tooltip,icon:e.icon,isActive:()=>!1}});return(r,i)=>(o.openBlock(),o.createBlock(ka,{icon:r.icon,tooltip:r.tooltip,disabled:r.disabled},{default:o.withCtx(()=>[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.items,(s,a)=>(o.openBlock(),o.createBlock(o.unref($l),{key:a,checked:n.value.title===s.title,disabled:s.disabled,class:"flex gap-3 items-center",onClick:s.action},{default:o.withCtx(()=>[s.icon?(o.openBlock(),o.createBlock(o.unref(Ot),{key:0,name:s.icon},null,8,["name"])):o.createCommentVNode("",!0),o.createElementVNode("span",HN,o.toDisplayString(s.title),1),s.shortcutKeys?(o.openBlock(),o.createBlock(o.unref(f5),{key:1,class:"ml-auto"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(KC)(s.shortcutKeys)),1)]),_:2},1024)):o.createCommentVNode("",!0)]),_:2},1032,["checked","disabled","onClick"]))),128))]),_:1},8,["icon","tooltip","disabled"]))}}),UN=et.create({name:"moreMark",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button({editor:e,extension:n,t:r}){const i=n.options.subscript,s=n.options.superscript,a={action:()=>e.commands.toggleSubscript(),isActive:()=>e.isActive("subscript")||!1,disabled:!e.can().toggleSubscript(),icon:"Subscript",title:r("editor.subscript.tooltip"),shortcutKeys:["mod","."]},l={action:()=>e.commands.toggleSuperscript(),isActive:()=>e.isActive("superscript")||!1,disabled:!e.can().toggleSuperscript(),icon:"Superscript",title:r("editor.superscript.tooltip"),shortcutKeys:["mod",","]},u=p1(e,"code"),c=[];if(i!==!1&&c.push(a),s!==!1&&c.push(l),u){const f={action:()=>e.commands.toggleCode(),isActive:()=>e.isActive("code")||!1,disabled:!e.can().toggleCode(),icon:"Code",title:r("editor.code.tooltip"),shortcutKeys:["mod","E"]};u&&c.push(f)}return{component:zN,componentProps:{icon:"Type",tooltip:r("editor.moremark"),disabled:!e.isEditable||c.every(f=>f.disabled),items:c}}}}},addExtensions(){const t=[];return this.options.subscript!==!1&&t.push(Yk.configure(this.options.subscript)),this.options.superscript!==!1&&t.push(Jk.configure(this.options.superscript)),t}});var Ra=(t=>(t[t.max=7]="max",t[t.min=0]="min",t[t.more=1]="more",t[t.less=-1]="less",t))(Ra||{});function WN(t,e,n){return t<e?e:t>n?n:t}function jN(t,e,n,r){const{doc:i,selection:s}=t;if(!i||!s||!(s instanceof Pe||s instanceof Fn))return t;const{from:a,to:l}=s;return i.nodesBetween(a,l,(u,c)=>{const f=u.type;return n.includes(f.name)?(t=qN(t,c,e),!1):!$0(u.type.name,r.extensionManager.extensions)}),t}function qN(t,e,n){if(!t.doc)return t;const r=t.doc.nodeAt(e);if(!r)return t;const a=WN((r.attrs.indent||0)+n,0,7);if(a===r.attrs.indent)return t;const l={...r.attrs,indent:a};return t.setNodeMarkup(e,r.type,l,r.marks)}function Zk({delta:t,types:e}){return({state:n,dispatch:r,editor:i})=>{const{selection:s}=n;let{tr:a}=n;return a=a.setSelection(s),a=jN(a,t,e,i),a.docChanged?(r&&r(a),!0):!1}}const KN=et.create({name:"indent",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),types:["paragraph","heading","blockquote"],minIndent:Ra.min,maxIndent:Ra.max,button({editor:e,t:n}){var s,a;const{selection:r}=e.state,i=r.$anchor.parent;return[{component:Xe,componentProps:{action:()=>{e.commands.indent()},disabled:((s=i==null?void 0:i.attrs)==null?void 0:s.indent)>=Ra.max||!e.can().indent(),shortcutKeys:["Tab"],icon:"IndentIncrease",tooltip:n("editor.indent.tooltip")}},{component:Xe,componentProps:{action:()=>{e.commands.outdent()},shortcutKeys:["Shift","Tab"],disabled:((a=i==null?void 0:i.attrs)==null?void 0:a.indent)<=Ra.min||!e.can().outdent(),icon:"IndentDecrease",tooltip:n("editor.outdent.tooltip")}}]}}},addGlobalAttributes(){return[{types:this.options.types,attributes:{indent:{default:0,parseHTML:t=>{const e=t.getAttribute("data-indent");return(e?parseInt(e,10):0)||0},renderHTML:t=>t.indent?{"data-indent":t.indent}:{}}}}]},addCommands(){return{indent:()=>Zk({delta:Ra.more,types:this.options.types}),outdent:()=>Zk({delta:Ra.less,types:this.options.types})}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});function GN(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:l}=t,u=r&&!i,c=aB(n),f=new RegExp(`\\s${c}$`),p=a?"^":"",m=i?"":c,g=u?new RegExp(`${p}${c}.*?(?=\\s${m}|$)`,"gm"):new RegExp(`${p}(?:^)?${c}[^\\s${m}]*`,"gm"),b=((e=l.nodeBefore)===null||e===void 0?void 0:e.isText)&&l.nodeBefore.text;if(!b)return null;const v=l.pos-b.length,y=Array.from(b.matchAll(g)).pop();if(!y||y.input===void 0||y.index===void 0)return null;const x=y.input.slice(Math.max(0,y.index-1),y.index),E=new RegExp(`^[${s==null?void 0:s.join("")}\0]?$`).test(x);if(s!==null&&!E)return null;const k=v+y.index;let C=k+y[0].length;return u&&f.test(b.slice(C-1,C+1))&&(y[0]+=" ",C+=1),k<l.pos&&C>=l.pos?{range:{from:k,to:C},query:y[0].slice(n.length),text:y[0]}:null}const XN=new Et("suggestion");function YN({pluginKey:t=XN,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:s=[" "],startOfLine:a=!1,decorationTag:l="span",decorationClass:u="suggestion",command:c=()=>null,items:f=()=>[],render:p=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=GN}){let b;const v=p==null?void 0:p(),y=new nt({key:t,view(){return{update:async(x,E)=>{var k,C,_,T,A,D,O;const M=(k=this.key)===null||k===void 0?void 0:k.getState(E),$=(C=this.key)===null||C===void 0?void 0:C.getState(x.state),V=M.active&&$.active&&M.range.from!==$.range.from,G=!M.active&&$.active,ee=M.active&&!$.active,W=!G&&!ee&&M.query!==$.query,F=G||V&&W,R=W||V,H=ee||V&&W;if(!F&&!R&&!H)return;const L=H&&!F?M:$,q=x.dom.querySelector(`[data-decoration-id="${L.decorationId}"]`);b={editor:e,range:L.range,query:L.query,text:L.text,items:[],command:X=>c({editor:e,range:L.range,props:X}),decorationNode:q,clientRect:q?()=>{var X;const{decorationId:le}=(X=this.key)===null||X===void 0?void 0:X.getState(e.state),pe=x.dom.querySelector(`[data-decoration-id="${le}"]`);return(pe==null?void 0:pe.getBoundingClientRect())||null}:null},F&&((_=v==null?void 0:v.onBeforeStart)===null||_===void 0||_.call(v,b)),R&&((T=v==null?void 0:v.onBeforeUpdate)===null||T===void 0||T.call(v,b)),(R||F)&&(b.items=await f({editor:e,query:L.query})),H&&((A=v==null?void 0:v.onExit)===null||A===void 0||A.call(v,b)),R&&((D=v==null?void 0:v.onUpdate)===null||D===void 0||D.call(v,b)),F&&((O=v==null?void 0:v.onStart)===null||O===void 0||O.call(v,b))},destroy:()=>{var x;b&&((x=v==null?void 0:v.onExit)===null||x===void 0||x.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(x,E,k,C){const{isEditable:_}=e,{composing:T}=e.view,{selection:A}=x,{empty:D,from:O}=A,M={...E};if(M.composing=T,_&&(D||e.view.composing)){(O<E.range.from||O>E.range.to)&&!T&&!E.composing&&(M.active=!1);const $=g({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:A.$from}),V=`id_${Math.floor(Math.random()*4294967295)}`;$&&m({editor:e,state:C,range:$.range,isActive:E.active})?(M.active=!0,M.decorationId=E.decorationId?E.decorationId:V,M.range=$.range,M.query=$.query,M.text=$.text):M.active=!1}else M.active=!1;return M.active||(M.decorationId=null,M.range={from:0,to:0},M.query=null,M.text=null),M}},props:{handleKeyDown(x,E){var k;const{active:C,range:_}=y.getState(x.state);return C&&((k=v==null?void 0:v.onKeyDown)===null||k===void 0?void 0:k.call(v,{view:x,event:E,range:_}))||!1},decorations(x){const{active:E,range:k,decorationId:C}=y.getState(x);return E?ut.create(x.doc,[qt.inline(k.from,k.to,{nodeName:l,class:u,"data-decoration-id":C})]):null}}});return y}const JN=[{label:"优酷",value:"youku",icon:"Youku"},{label:"哔哩哔哩",value:"bilibili",icon:"BiliBili"},{label:"腾讯视频",value:"qqvideo",icon:"QQVideo"}],ZN=[{label:"高德地图",value:"amap",icon:"Gaode"},{label:"百度地图",value:"baidu_map",icon:"Baidu"}],QN=[{label:"墨刀",value:"modao",icon:"Modao"},{label:"蓝湖",value:"lanhu",icon:"Lanhu"},{label:"Figma",value:"figma",icon:"Figma"},{label:"Canva",value:"canva",icon:"Canva"},{label:"ProcessOn",value:"processon",icon:"Processon"}],NN=[{label:"CodePen",value:"codepen",icon:"Codepen"}],eee=[{label:"金数据",value:"jinshuju",icon:"Jinshuju"}],tee=[],nee=[...JN,...ZN,...QN,...NN,...eee,...tee];function ree(t){const{t:e}=Tt(),n=[{name:"format",title:e("editor.slash.format"),commands:[{name:"paragraph",label:e("editor.paragraph.tooltip"),aliases:["paragraph","zw"],iconName:"Paragraph",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setHeading({level:1}).run()}},{name:"heading1",label:e("editor.heading.h1.tooltip"),aliases:["h1","bt","bt1"],iconName:"Heading1",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setHeading({level:1}).run()}},{name:"heading2",label:e("editor.heading.h2.tooltip"),aliases:["h2","bt","bt2"],iconName:"Heading2",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setNode("heading",{level:2}).run()}},{name:"heading3",label:e("editor.heading.h3.tooltip"),aliases:["h3","bt","bt3","heading3"],iconName:"Heading3",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setNode("heading",{level:3}).run()}},{name:"bulletList",label:e("editor.bulletlist.tooltip"),aliases:["ul","yxlb","bulletList"],iconName:"List",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).toggleBulletList().run()}},{name:"numberedList",label:e("editor.orderedlist.tooltip"),aliases:["ol","yxlb"],iconName:"ListOrdered",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).toggleOrderedList().run()}},{name:"codeBlock",label:e("editor.codeblock.tooltip"),iconName:"Code2",aliases:["codeBlock"],description:"Code block with syntax highlighting",shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setCodeBlock().run()}},{name:"blockquote",label:e("editor.blockquote.tooltip"),description:"插入引入格式",aliases:["yr"],iconName:"TextQuote",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setBlockquote().run()}},{name:"horizontalrule",label:e("editor.horizontalrule.tooltip"),aliases:["fgx","horizontalRule"],iconName:"Minus",action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setHorizontalRule().run()}},{name:"link",label:e("editor.link.tooltip"),aliases:["link","lianjie","lj"],iconName:"Link",action:({editor:i,range:s})=>{i.chain().deleteRange(s).extendMarkRange("link").insertContent({type:"text",text:"link",marks:[{type:"link",attrs:{href:"",target:"_blank"}}]}).setLink({href:""}).focus().run()}}]},{name:"insert",title:e("editor.slash.insert"),commands:[{name:"image",label:e("editor.image.tooltip"),iconName:"ImageUp",description:"Insert a image",aliases:["image","tp","tupian"],shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setImageUpload().run()}},{name:"table",label:e("editor.table.tooltip"),iconName:"Table",description:"Insert a table",aliases:["table","bg","biaoge","biao"],shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).insertTable({rows:3,cols:3,withHeaderRow:!1}).run()}},{name:"video",label:e("editor.video.tooltip"),iconName:"Video",description:"Insert a video",aliases:["video","sp","shipin"],shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).setVideoUpload().run()}},{name:"taskList",label:e("editor.tasklist.tooltip"),iconName:"ListTodo",description:"Task list with todo items",aliases:["todo"],action:({editor:i,range:s})=>{i.chain().focus().deleteRange(s).toggleTaskList().run()}},{name:"columns",label:e("editor.columns.tooltip"),iconName:"Columns2",description:"Add two column content",aliases:["columns","cols","2cols"],shouldBeHidden:i=>i.isActive("columns"),action:({editor:i,range:s})=>{i.chain().deleteRange(s).setColumns().focus(i.state.selection.head-1).run()}}]}];if(p1(t,"iframes")){const i=nee;n.push({name:"others",title:e("editor.slash.embed"),commands:i.map(s=>({name:s.value,label:s.label,iconName:s.icon,aliases:[s.value,s.label],shouldBeHidden:a=>a.isActive("columns"),action:({editor:a,range:l})=>{a.chain().deleteRange(l).focus().setIframe({src:"",service:s.value}).run()}}))})}return n}const oee={key:0,class:"grid grid-cols-1 gap-0.5 min-w-48"},iee={className:"text-neutral-500 text-[0.65rem] col-[1/-1] mx-2 mt-2 font-semibold tracking-wider select-none uppercase first:mt-0.5"},see=["onClick"],aee=["src"],lee={key:1,class:"p-3"},uee={class:"text-xs text-gray-800 dark:text-gray-400"},cee=o.defineComponent({__name:"CommandsList",props:{editor:{},items:{default:void 0},command:{type:Function,default:void 0}},setup(t,{expose:e}){const n=o.ref(0),r=o.ref(0),i=o.ref(null),{t:s}=Tt(),a=o.ref([]),l=t;e({onKeyDown:u}),o.watch([()=>n.value,()=>r.value],async()=>{if(!i.value)return;await o.nextTick();const v=r.value*1e3+n.value,y=a.value[v];y&&y.scrollIntoView({behavior:"smooth",block:"nearest"})});function u({event:v}){return v.key==="ArrowUp"?(c(),!0):v.key==="ArrowDown"?(f(),!0):v.key==="Enter"?(p(),!0):!1}function c(){var x;if(!l.items.length)return!1;let v=n.value-1,y=r.value;v<0&&(y=r.value-1,v=((x=l.items[y])==null?void 0:x.commands.length)-1||0),y<0&&(y=l.items.length-1,v=l.items[y].commands.length-1),n.value=v,r.value=y}function f(){if(!l.items.length)return!1;const v=l.items[r.value].commands;let y=n.value+1,x=r.value;v.length-1<y&&(y=0,x=r.value+1),l.items.length-1<x&&(x=0),n.value=y,r.value=x}function p(){if(!l.items.length||r.value===-1||n.value===-1)return!1;m(r.value,n.value)}function m(v,y){const x=l.items[v].commands[y];l.command(x)}function g(v,y){m(v,y)}function b(v,y,x){a.value[v*1e3+y]=x}return(v,y)=>{var x;return o.openBlock(),o.createElementBlock("div",{ref_key:"scrollContainer",ref:i,class:"bg-white rounded-lg dark:bg-black shadow-sm border border-neutral-200 dark:border-neutral-800 text-black max-h-[min(80vh,24rem)] overflow-auto flex-wrap mb-8 p-1"},[(x=v.items)!=null&&x.length?(o.openBlock(),o.createElementBlock("div",oee,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(v.items,(E,k)=>(o.openBlock(),o.createElementBlock(o.Fragment,{key:E.title},[o.createElementVNode("div",iee,o.toDisplayString(E.title),1),(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(E.commands,(C,_)=>(o.openBlock(),o.createElementBlock("button",{ref_for:!0,ref:T=>b(k,_,T),key:_,class:o.normalizeClass(["flex items-center gap-3 px-2 py-1.5 text-sm text-neutral-800 dark:text-neutral-200 text-left w-full rounded-sm outline-none transition-colors",[r.value===k&&n.value===_?"bg-ed-accent text-neutral-800 dark:bg-neutral-900 dark:text-neutral-200":"hover:bg-ed-accent hover:text-neutral-800 dark:hover:bg-neutral-900 dark:hover:text-neutral-200"]]),onClick:T=>g(k,_)},[C.iconUrl?(o.openBlock(),o.createElementBlock("img",{key:0,class:"w-6 h-6",src:C.iconUrl},null,8,aee)):o.createCommentVNode("",!0),C.iconName?(o.openBlock(),o.createBlock(o.unref(Ot),{key:1,name:C.iconName,class:"mr-1 text-lg"},null,8,["name"])):o.createCommentVNode("",!0),o.createTextVNode(" "+o.toDisplayString(C.label),1)],10,see))),128))],64))),128))])):(o.openBlock(),o.createElementBlock("div",lee,[o.createElementVNode("span",uee,o.toDisplayString(o.unref(s)("editor.slash.empty")),1)]))],512)}}}),La="slashCommand";let Vt;const dee=et.create({name:La,priority:200,onCreate(){Vt=ea("body",{interactive:!0,trigger:"manual",placement:"bottom-start",theme:"slash-command",maxWidth:"16rem",offset:[16,8],popperOptions:{strategy:"fixed",modifiers:[{name:"flip",enabled:!1}]}})},addProseMirrorPlugins(){return[YN({editor:this.editor,char:"/",allowSpaces:!0,startOfLine:!0,pluginKey:new Et(La),allow:({state:t,range:e})=>{var c,f,p;const n=t.doc.resolve(e.from),r=n.depth===1,i=n.parent.type.name==="paragraph",s=((c=n.parent.textContent)==null?void 0:c.charAt(0))==="/",a=this.editor.isActive("column"),l=(p=n.parent.textContent)==null?void 0:p.substring((f=n.parent.textContent)==null?void 0:f.indexOf("/")),u=!(l!=null&&l.endsWith(" "));return(r&&i&&s||a&&i&&s)&&u},command:({editor:t,range:e,props:n})=>{const{view:r}=t;n.action({editor:t,range:e}),r.focus()},items:({query:t})=>ree(this.editor).map(s=>({...s,commands:s.commands.filter(a=>{const l=a.label.toLowerCase().trim(),u=t.toLowerCase().trim();if(a.aliases){const c=a.aliases.map(m=>m.toLowerCase().trim()),f=l.match(u),p=c.some(m=>m.match(u));return f||p}return l.match(u)}).filter(a=>a.shouldBeHidden?!a.shouldBeHidden(this.editor):!0)})).filter(s=>s.commands.length>0).map(s=>({...s,commands:s.commands.map(a=>({...a,isEnabled:!0}))})),render:()=>{let t,e=null;return{onStart:n=>{var s;t=new t6(cee,{props:n,editor:n.editor});const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[La].rect;const a=n.clientRect();if(!a)return n.editor.storage[La].rect;let l=a.y;if(t.element instanceof HTMLElement&&a.top+t.element.offsetHeight+40>window.innerHeight){const u=a.top+t.element.offsetHeight-window.innerHeight+40;l=a.y-u}return new DOMRect(a.x,l,a.width,a.height)};e=()=>{Vt==null||Vt[0].setProps({getReferenceClientRect:i})},(s=r.dom.parentElement)==null||s.addEventListener("scroll",e),t.element&&(Vt==null||Vt[0].setProps({getReferenceClientRect:i,appendTo:()=>document.body,content:t.element})),Vt==null||Vt[0].show()},onUpdate(n){var a;t.updateProps(n);const{view:r}=n.editor,i=()=>{if(!n.clientRect)return n.editor.storage[La].rect;const l=n.clientRect();return l?new DOMRect(l.x,l.y,l.width,l.height):n.editor.storage[La].rect},s=()=>{Vt==null||Vt[0].setProps({getReferenceClientRect:i})};(a=r.dom.parentElement)==null||a.addEventListener("scroll",s),n.editor.storage[La].rect=n.clientRect?i():{width:0,height:0,left:0,top:0,right:0,bottom:0},Vt==null||Vt[0].setProps({getReferenceClientRect:i})},onKeyDown(n){var r;return n.event.key==="Escape"?(Vt==null||Vt[0].hide(),!0):(Vt!=null&&Vt[0].state.isShown||Vt==null||Vt[0].show(),(r=t.ref)==null?void 0:r.onKeyDown(n))},onExit(n){var r;if(Vt==null||Vt[0].hide(),e){const{view:i}=n.editor;(r=i.dom.parentElement)==null||r.removeEventListener("scroll",e)}t.destroy()}}}})]},addStorage(){return{rect:{width:0,height:0,left:0,top:0,right:0,bottom:0}}}}),fee=o.defineComponent({__name:"AIButton",props:{editor:{},icon:{default:void 0},title:{default:void 0},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},shortcutKeys:{default:void 0},customClass:{default:""},loading:{type:Boolean,default:!1},tooltipOptions:{default:void 0},color:{default:void 0},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0}},setup(t){const e=t,n=xn(),{toast:r}=Hv();function i(){var a,l,u;const s=(l=(a=e.editor.extensionManager.extensions.find(c=>c.name==="AI"))==null?void 0:a.options)==null?void 0:l.completions;if(typeof s!="function"){r({title:"AI completions method is not set or is not a valid function",variant:"destructive"});return}if(s.constructor.name!=="AsyncFunction"){r({title:"AI completions method must be an asynchronous function",variant:"destructive"});return}n.state.AIMenu=!0,(u=e.editor)==null||u.commands.focus()}return(s,a)=>(o.openBlock(),o.createBlock(Xe,{action:i,title:"AI",disabled:s.disabled,icon:s.icon,tooltip:s.tooltip},null,8,["disabled","icon","tooltip"]))}}),pee=Lt.create({name:"AI",group:"block",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),toolbar:!1,button:({editor:e,t:n})=>({component:fee,componentProps:{icon:"Sparkles",tooltip:n("editor.AI.ask")}})}}});function hee(t,e){const n=atob(t.split(",")[1]),r=new Array(n.length);for(let s=0;s<n.length;s++)r[s]=n.charCodeAt(s);const i=new Uint8Array(r);return new Blob([i],{type:e})}function mee(t,e){return new File([t],e,{type:t.type})}const gee=et.create({name:"importWord",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),upload:void 0,convert:void 0,limit:1024*1024*10,button:({editor:e,extension:n,t:r})=>({component:Xe,componentProps:{action:()=>{var i;return(i=e.commands)==null?void 0:i.toggleImportWord()},disabled:!e.can().setHorizontalRule(),icon:"Word",tooltip:r("editor.importWord.tooltip")}})}},addCommands(){return{toggleImportWord:()=>({chain:t,editor:e})=>{const{toast:n}=Hv(),{t:r}=Tt();async function i(u){var g;const f=new DOMParser().parseFromString(u,"text/html"),p=f.querySelectorAll("img");if(!p.length)return f.body.innerHTML;if(p1(e,"image")){const b=(g=e.extensionManager.extensions.find(v=>v.name==="importWord"))==null?void 0:g.options;if(b&&typeof b.upload=="function"){const v=[];for(const x of p){const E=x.getAttribute("src"),k=hee(E,"image/jpeg"),C=mee(k,"image.jpeg");v.push(C)}const y=await b.upload(v);for(let x=0;x<p.length;x++){const E=p[x];E.setAttribute("src",y[x].src);const k=E.parentElement;(k==null?void 0:k.tagName)==="P"&&(k.insertAdjacentElement("beforebegin",E),!k.hasChildNodes()&&k.textContent===""&&k.remove())}return f.body.innerHTML}else return console.warn("Image Upload method found, skip image conversion"),f.body.innerHTML}else return console.error("Image extension not found, unable to convert image"),f.body.innerHTML}async function s(u){const c=await i(u);e.chain().setContent(c.toString(),!0).run(),n({title:r("editor.importWord.success")})}const{open:a,onChange:l}=Ne.useFileDialog({accept:".docx",reset:!0,multiple:!1});return a(),l(async u=>{const[c]=Array.from(u??[]);if(c){if(c.size>this.options.limit){n({title:r("editor.importWord.fileTooLarge"),variant:"destructive"});return}if(this.options.convert){const f=await this.options.convert(c);s(f)}else{const f=new FormData,p=JSON.stringify({collaboration_features:{comments:!0,user_id:"e3",track_changes:!0},formatting:{resets:"none",defaults:"inline",styles:"inline",comments:"basic"}});f.append("config",p),f.append("file",c),fetch("https://docx-converter.cke-cs.com/v2/convert/docx-html",{method:"POST",body:f}).then(m=>m.json()).then(async m=>{s(m.html)}).catch(m=>{n({title:r("editor.importWord.error"),variant:"destructive"}),console.error("Error:",m)})}}}),!1}}}}),zv=xn(),bee=et.create({name:"preview",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({t:e})=>({component:Xe,componentProps:{icon:"Eye",action:()=>{zv.togglePreview()},tooltip:e("editor.preview.tooltip"),isActive:()=>zv.state.showPreview}})}},addCommands(){return{togglePreview:()=>()=>(zv.togglePreview(),!0)}}}),Qk=xn(),vee=(t,e,n)=>RegExp(e?t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"):t,n?"gu":"gui");function yee(t,e,n,r){const i=[],s=[];let a=[],l=0;if(!e)return{decorationsToReturn:ut.empty,results:[]};t==null||t.descendants((u,c)=>{u.isText?a[l]?a[l]={text:a[l].text+u.text,pos:a[l].pos}:a[l]={text:`${u.text}`,pos:c}:l+=1}),a=a.filter(Boolean);for(const u of a){const{text:c,pos:f}=u,p=Array.from(c.matchAll(e)).filter(([m])=>m.trim());for(const m of p){if(m[0]==="")break;m.index!==void 0&&s.push({from:f+m.index,to:f+m.index+m[0].length})}}for(let u=0;u<s.length;u+=1){const c=s[u],f=u===r?`${n} ${n}-current`:n,p=qt.inline(c.from,c.to,{class:f});i.push(p)}return{decorationsToReturn:ut.create(t,i),results:s}}const wee=(t,e,{state:n,dispatch:r})=>{if(!e[0])return;const{from:s,to:a}=e[0];r&&r(n.tr.insertText(t,s,a))},xee=(t,e,n,r)=>{const i=e+1;if(!r[i])return null;const{from:s,to:a}=r[e],l=a-s-t.length+n,{from:u,to:c}=r[i];return r[i]={to:c-l,from:u-l},[l,r]},Cee=(t,e,{tr:n,dispatch:r})=>{let i=0,s=e.slice();if(s.length){for(let a=0;a<s.length;a+=1){const{from:l,to:u}=s[a];n.insertText(t,l,u);const c=xee(t,a,i,s);c&&(i=c[0],s=c[1])}r&&r(n)}},Eee=new Et("findAndReplacePlugin"),kee=et.create({name:"findAndReplace",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),searchResultClass:"vdc-editor-search-result",disableRegex:!0,button:({editor:e,extension:n,t:r})=>({component:Xe,componentProps:{icon:"DocSearch",tooltip:r("editor.findAndReplace.tooltip"),action:()=>{Qk.toggleFindAndReplace()},isActive:()=>Qk.state.findAndReplace}})}},addStorage(){return{searchTerm:"",replaceTerm:"",results:[],lastSearchTerm:"",caseSensitive:!1,lastCaseSensitive:!1,resultIndex:0,lastResultIndex:0}},addCommands(){return{setSearchTerm:t=>({editor:e})=>(e.storage.findAndReplace.searchTerm=t,!1),setReplaceTerm:t=>({editor:e})=>(e.storage.findAndReplace.replaceTerm=t,!1),setCaseSensitive:t=>({editor:e})=>(e.storage.findAndReplace.caseSensitive=t,!1),resetIndex:()=>({editor:t})=>(t.storage.findAndReplace.resultIndex=0,!1),nextSearchResult:()=>({editor:t})=>{const{results:e,resultIndex:n}=t.storage.findAndReplace,r=n+1;return e[r]?t.storage.findAndReplace.resultIndex=r:t.storage.findAndReplace.resultIndex=0,!1},previousSearchResult:()=>({editor:t})=>{const{results:e,resultIndex:n}=t.storage.findAndReplace,r=n-1;return e[r]?t.storage.findAndReplace.resultIndex=r:t.storage.findAndReplace.resultIndex=e.length-1,!1},replace:()=>({editor:t,state:e,dispatch:n})=>{const{replaceTerm:r,results:i}=t.storage.findAndReplace;return wee(r,i,{state:e,dispatch:n}),!1},replaceAll:()=>({editor:t,tr:e,dispatch:n})=>{const{replaceTerm:r,results:i}=t.storage.findAndReplace;return Cee(r,i,{tr:e,dispatch:n}),!1}}},addProseMirrorPlugins(){const t=this.editor,{searchResultClass:e,disableRegex:n}=this.options,r=a=>t.storage.findAndReplace.lastSearchTerm=a,i=a=>t.storage.findAndReplace.lastCaseSensitive=a,s=a=>t.storage.findAndReplace.lastResultIndex=a;return[new nt({key:Eee,state:{init:()=>ut.empty,apply({doc:a,docChanged:l},u){const{searchTerm:c,lastSearchTerm:f,caseSensitive:p,lastCaseSensitive:m,resultIndex:g,lastResultIndex:b}=t.storage.findAndReplace;if(!l&&f===c&&m===p&&b===g)return u;if(r(c),i(p),s(g),!c)return t.storage.findAndReplace.results=[],ut.empty;const{decorationsToReturn:v,results:y}=yee(a,vee(c,n,p),e,g);return t.storage.findAndReplace.results=y,v}},props:{decorations(a){return this.getState(a)}}})]}}),{togglePrinter:See,state:_ee}=xn(),Tee=et.create({name:"printer",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({t:e})=>({component:Xe,componentProps:{tooltip:e("editor.printer.tooltip"),action:()=>See(),icon:"Printer",shortcutKeys:["mod","P"],isActive:()=>_ee.printer}})}}}),Aee=async function(t){let e=[];try{if(this.enabled===!1||t.length===0||t.trim()==="")return e;if(this.limit&&t.length>this.limit)throw new Error("Text is too long");const n=await an.post(this.getApi(),{value:t}),r=this.transfer(n.data);e=(r==null?void 0:r.map(i=>i.errorText))||[],this!=null&&this.setSuggestions&&this.setSuggestions(r)}catch(n){console.error(n)}return e};class Nk{constructor({api:e,limit:n,transfer:r,enabled:i}){Ft(this,"suggestions",[]);Ft(this,"api","");Ft(this,"enabled",!0);Ft(this,"limit");Ft(this,"transfer");this.suggestions=[],this.api=e,this.limit=n,this.transfer=r,this.enabled=i??!0}setSuggestions(e){this.suggestions=e}getSuggestions(e){var n;return Promise.resolve(((n=this.suggestions.find(r=>r.errorText.wrongWord===e))==null?void 0:n.spellData.correctWord)??[])}getApi(){return this.api}normalizeTextForLanguage(e){return e}proofreadText(e){return Promise.resolve(Aee.call(this,e))}toggleIsEnabled(){this.enabled=!this.enabled}setEnabled(e){this.enabled=e}getIsEnabled(){return this.enabled}}const Mee=Object.freeze(Object.defineProperty({__proto__:null,AI:pee,BaseKit:Xk,Blockquote:MK,Bold:P8,BulletList:wK,Clear:hb,Code:Tj,CodeBlock:jq,Color:g5,Columns:Tv,FindAndReplace:kee,FontFamily:pk,FontSize:m5,FormatPainter:Sv,Fullscreen:gG,Heading:p5,Highlight:mK,History:zb,HorizontalRule:iG,Image:qu,ImageUpload:Gk,ImportWord:gee,Indent:KN,Italic:V8,LineHeight:gk,Link:Fb,MoreMark:UN,OrderedList:kK,Preview:bee,Printer:Tee,Proofreader:Nk,SlashCommand:dee,SpellcheckerExtension:ak,Strike:$8,SubAndSuperScript:$N,Table:Pv,TaskList:TK,TextAlign:h5,Underline:F8,Video:jk,VideoUpload:Wk},Symbol.toStringTag,{value:"Module"})),Oee='<page id="ft6nbbxs" extend="false" pagenumber="1" force="false"><h1 id="tk6n64mj" extend="&quot;false&quot;"><strong>Introduction(English)</strong></h1><p id="s864ng1o" extend="&quot;false&quot;">MyMy Editor is open-source document editor based on Vue3 and Tiptap. MyMy Editor provides comprehensive document editing capabilities, supports pagination, supports Markdown syntax, offers basic rich text editing functions, allows for the insertion of various node types in multiple formats, provides a variety of practical tools, and supports setting page styles. It also supports exporting in various formats, printing and print preview, block-level document editing, adding custom extensions, multi-language settings, and a dark theme.</p><h1 id="jm9johtz" extend="&quot;false&quot;"><strong>소개(국문)</strong></h1><p id="0qei01hl" extend="&quot;false&quot;">마이마이 에디터는 Vue3과 Tiptap을 기반으로 한 오픈소스 문서 편집기입니다. 마이마이 에디터는 포괄적인 문서 편집 기능을 제공하며, 페이지네이션, 마크다운 구문 지원, 기본적인 리치 텍스트 편집 기능, 다양한 형식의 다양한 노드 유형 삽입, 다양한 실용적인 도구 제공, 페이지 스타일 설정 지원 등을 제공합니다. 또한 다양한 형식으로 내보내기, 인쇄 및 인쇄 미리보기, 블록 수준의 문서 편집, 사용자 지정 확장 추가, 다국어 설정 및 다크 테마를 지원합니다.마이마이 에디터는 Vue3과 Tiptap을 기반으로 한 오픈소스 문서 편집기입니다. 마이마이 에디터는 포괄적인 문서 편집 기능을 제공하며, 페이지네이션, 마크다운 구문 지원, 기본적인 리치 텍스트 편집 기능, 다양한 형식의 다양한 노드 유형 삽입, 다양한 실용적인 도구 제공, 페이지 스타일 설정 지원 등을 제공합니다. 또한 다양한 형식으로 내보내기, 인쇄 및 인쇄 미리보기, 블록 수준의 문서 편집, 사용자 지정 확장 추가, 다국어 설정 및 다크 테마를 지원합니다.</p><blockquote class="blockquote"><p id="nekf7yi0" extend="false"><span style="color: rgb(115, 209, 61)"><strong><em>Make by VDC</em></strong></span></p></blockquote></page>';function Bee(){const t=window.localStorage.getItem("content"),e=o.ref(t||Oee),n=o.computed(()=>[Xk.configure({placeholder:{showOnlyCurrent:!0},characterCount:{limit:1e5},excludes:{}}),zb,Tv,Sv,hb,Fb,qu,Pv]),r=Ne.useEventBus(fr.RENDER_SUPER_TEXT);function i(s,a){const l={action:"status",payload:{id:s,status:a}};r.emit(l)}return{defaultExtensions:n,content:e,dispatchUpdateStatusSuperText:i}}function Iee(){const t=o.ref(!1);return{hasEverFocused:t,markAsFocused:()=>{t.value=!0},insertHtml:(r,i)=>{const{state:s}=r,{doc:a,selection:l}=s,u=l.$from,c=a.firstChild,f=r.isEmpty;if(!t.value){if(f&&c){r.chain().insertContentAt({from:0,to:c.nodeSize},i).focus().run();return}const m=a.content.size;r.chain().insertContentAt(m,i).focus().run();return}const p=u.parent;if(p.type.name==="paragraph"&&p.textContent.trim().length===0){const m=u.before();r.chain().insertContentAt({from:m,to:m+p.nodeSize},i).focus().run();return}if(u.parentOffset===0&&p.type.name==="paragraph"&&p.content.size>0){const m=u.before();r.chain().insertContentAt(m,i).focus().run();return}r.chain().insertContentAt(r.state.selection,i).focus().run()}}}function Xl(t=250){const e=o.ref(!1);let n=null;const r=()=>{e.value=!0,n&&clearTimeout(n),n=setTimeout(()=>{e.value=!1},t)};return o.onUnmounted(()=>{n&&clearTimeout(n)}),{isScrolling:e,handleScroll:r}}function Ree(){const t=o.ref(!1);let e=!1;function n(){const l=Array.from(document.querySelectorAll(".inside-toolbar")),u=document.querySelector("#tool-bar-format"),c=document.querySelector("#tool-bar-image"),f=Array.from(document.querySelectorAll('[contenteditable="true"].tiptap:not(.simple-editor)'));return{popupInsideToolbars:l,toolBarFormat:u,toolBarImage:c,tiptapEditors:f}}function r(l){if(!l)return!1;const{popupInsideToolbars:u,toolBarFormat:c,toolBarImage:f,tiptapEditors:p}=n();return u.some(m=>m.contains(l))||((c==null?void 0:c.contains(l))??!1)||((f==null?void 0:f.contains(l))??!1)||p.some(m=>m.contains(l))}function i(l){e=r(l.target)}function s(l){const u=l.target;u&&r(u)&&(t.value=!0)}function a(l){const u=l.relatedTarget;r(u)||e&&u===null||(t.value=!1)}return Ne.useEventListener(document,"mousedown",i,{capture:!0}),Ne.useEventListener(document,"touchstart",i,{capture:!0}),Ne.useEventListener(document,"focusin",s),Ne.useEventListener(document,"focusout",a),{isShowToolBarBaseOnEditor:t}}const Lee={class:"flex items-center h-[32px] hover:bg-ed-muted rounded-md"},Dee={class:"text-sm flex items-center justify-center"},Pee={width:"18px",height:"18px",viewBox:"0 0 256 256",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},Vee={id:"icon/填充色",stroke:"none","stroke-width":"1",fill:"none","fill-rule":"evenodd"},Fee={id:"icon/背景颜色"},$ee=["fill"],eS=o.defineComponent({__name:"HighlightActionButton",props:{editor:{},tooltip:{default:void 0},disabled:{type:Boolean,default:!1},action:{type:Function,default:void 0},isActive:{type:Function,default:void 0},tooltipOptions:{default:void 0}},setup(t){const e=t,n=o.ref(void 0),{state:r}=xn();function i(a){var l;(l=e.action)==null||l.call(e,a)}function s(a){var l;(l=e.action)==null||l.call(e,n.value)}return o.watchEffect(()=>{const{color:a}=e.editor.getAttributes("highlight");r.highlight=a}),(a,l)=>(o.openBlock(),o.createElementBlock("div",Lee,[o.createVNode(Xe,{id:"highlight",tooltip:a.tooltip,disabled:a.disabled,action:s,"tooltip-options":a.tooltipOptions},{icon:o.withCtx(()=>[o.createElementVNode("span",Dee,[(o.openBlock(),o.createElementBlock("svg",Pee,[o.createElementVNode("g",Vee,[o.createElementVNode("g",Fee,[l[1]||(l[1]=o.createElementVNode("g",{id:"编组",fill:"currentColor"},[o.createElementVNode("g",{id:"矩形",transform:"translate(119.502295, 137.878331) rotate(-135.000000) translate(-119.502295, -137.878331) translate(48.002295, 31.757731)"},[o.createElementVNode("path",{d:"M100.946943,60.8084699 L43.7469427,60.8084699 C37.2852111,60.8084699 32.0469427,66.0467383 32.0469427,72.5084699 L32.0469427,118.70847 C32.0469427,125.170201 37.2852111,130.40847 43.7469427,130.40847 L100.946943,130.40847 C107.408674,130.40847 112.646943,125.170201 112.646943,118.70847 L112.646943,72.5084699 C112.646943,66.0467383 107.408674,60.8084699 100.946943,60.8084699 Z M93.646,79.808 L93.646,111.408 L51.046,111.408 L51.046,79.808 L93.646,79.808 Z","fill-rule":"nonzero"}),o.createElementVNode("path",{d:"M87.9366521,16.90916 L87.9194966,68.2000001 C87.9183543,69.4147389 86.9334998,70.399264 85.7187607,70.4 L56.9423078,70.4 C55.7272813,70.4 54.7423078,69.4150264 54.7423078,68.2 L54.7423078,39.4621057 C54.7423078,37.2523513 55.5736632,35.1234748 57.0711706,33.4985176 L76.4832996,12.4342613 C78.9534987,9.75382857 83.1289108,9.5834005 85.8093436,12.0535996 C87.1658473,13.303709 87.9372691,15.0644715 87.9366521,16.90916 Z","fill-rule":"evenodd"}),o.createElementVNode("path",{d:"M131.3,111.241199 L11.7,111.241199 C5.23826843,111.241199 0,116.479467 0,122.941199 L0,200.541199 C0,207.002931 5.23826843,212.241199 11.7,212.241199 L131.3,212.241199 C137.761732,212.241199 143,207.002931 143,200.541199 L143,122.941199 C143,116.479467 137.761732,111.241199 131.3,111.241199 Z M124,130.241 L124,193.241 L19,193.241 L19,130.241 L124,130.241 Z","fill-rule":"nonzero"})])],-1)),o.createElementVNode("path",{id:"矩形",d:"M51,218 L205,218 C211.075132,218 216,222.924868 216,229 C216,235.075132 211.075132,240 205,240 L51,240 C44.9248678,240 40,235.075132 40,229 C40,222.924868 44.9248678,218 51,218 Z",fill:n.value||"#FBDE28"},null,8,$ee)])])]))])]),_:1},8,["tooltip","disabled","tooltip-options"]),o.createVNode(A8,{modelValue:n.value,"onUpdate:modelValue":l[0]||(l[0]=u=>n.value=u),highlight:"",disabled:a.disabled,onChange:i},{default:o.withCtx(()=>[o.createVNode(o.unref(vn),{variant:"ghost",size:"icon",class:"w-3 h-[32px] rounded-l-none hover:bg-ed-muted-foreground/20",disabled:a.disabled},{default:o.withCtx(()=>[o.createVNode(o.unref(Ot),{class:"w-3 h-3 text-zinc-500",name:"MenuDown"})]),_:1},8,["disabled"])]),_:1},8,["modelValue","disabled"])]))}}),Hee={class:"h-full w-fit min-w-32 flex items-center leading-none gap-0.5 p-2 bg-ed-background rounded-lg shadow-sm border border-ed-border"},Ih=o.defineComponent({__name:"TableBubbleMenu",props:{editor:{}},setup(t){const e=t,n=()=>document.body,r=({editor:y})=>{var x;return y.isActive("table")&&(((x=y.storage.table)==null?void 0:x.isTableEditorOpen)??!1)},{t:i}=Tt();function s(){e.editor.chain().focus().addColumnBefore().run()}function a(){e.editor.chain().focus().addColumnAfter().run()}function l(){e.editor.chain().focus().deleteColumn().run()}function u(){e.editor.chain().focus().addRowBefore().run()}function c(){e.editor.chain().focus().addRowAfter().run()}function f(){e.editor.chain().focus().deleteRow().run()}function p(){e.editor.chain().focus().mergeCells().run()}function m(){var y;(y=e.editor)==null||y.chain().focus().splitCell().run()}function g(){e.editor.chain().focus().deleteTable().run()}function b(y){e.editor.chain().focus().setTableCellBackground(y).run()}const v=()=>{const y=document.querySelector(".vdc-editor");if(!y)return new DOMRect(-1e3,-1e3,0,0);const x=y.getBoundingClientRect();return new DOMRect(x.left,x.top+10,x.width,0)};return(y,x)=>(o.openBlock(),o.createBlock(o.unref(Wu),{editor:y.editor,"plugin-key":"table","update-delay":0,"should-show":r,"tippy-options":{zIndex:9999,maxWidth:"auto",getReferenceClientRect:v,appendTo:n}},{default:o.withCtx(()=>{var E,k,C,_,T,A,D,O,M;return[o.createElementVNode("div",Hee,[o.createVNode(Xe,{icon:"TablerColumnInsertLeft","icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertColumnBefore"),action:s,"tooltip-options":{sideOffset:15},disabled:!((E=y.editor)!=null&&E.can().addColumnBefore())},null,8,["tooltip","disabled"]),o.createVNode(Xe,{icon:"TablerColumnInsertRight",tooltip:o.unref(i)("editor.table.menu.insertColumnAfter"),"icon-class":"w-5 h-5",action:a,"tooltip-options":{sideOffset:15},disabled:!((k=y.editor)!=null&&k.can().addColumnAfter())},null,8,["tooltip","disabled"]),o.createVNode(Xe,{icon:"TablerColumnRemove",action:l,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.deleteColumn"),"tooltip-options":{sideOffset:15},disabled:!((C=y.editor)!=null&&C.can().deleteColumn())},null,8,["tooltip","disabled"]),o.createVNode(o.unref(mo),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Xe,{icon:"TablerRowInsertTop",action:u,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertRowAbove"),"tooltip-options":{sideOffset:15},disabled:!((_=y.editor)!=null&&_.can().addRowBefore())},null,8,["tooltip","disabled"]),o.createVNode(Xe,{icon:"TablerRowInsertBottom",action:c,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.insertRowBelow"),"tooltip-options":{sideOffset:15},disabled:!((T=y.editor)!=null&&T.can().addRowAfter())},null,8,["tooltip","disabled"]),o.createVNode(Xe,{icon:"TablerRowRemove",action:f,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.deleteRow"),"tooltip-options":{sideOffset:15},disabled:!((A=y.editor)!=null&&A.can().deleteRow())},null,8,["tooltip","disabled"]),o.createVNode(o.unref(mo),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Xe,{icon:"TableCellsMerge",action:p,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.mergeCells"),"tooltip-options":{sideOffset:15},disabled:!((D=y.editor)!=null&&D.can().mergeCells())},null,8,["tooltip","disabled"]),o.createVNode(Xe,{icon:"TableCellsSplit",action:m,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.splitCells"),"tooltip-options":{sideOffset:15},disabled:!((O=y.editor)!=null&&O.can().splitCell())},null,8,["tooltip","disabled"]),o.createVNode(o.unref(mo),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(eS,{editor:y.editor,tooltip:o.unref(i)("editor.table.menu.setCellsBgColor"),action:b,"tooltip-options":{sideOffset:15}},null,8,["editor","tooltip"]),o.createVNode(Xe,{icon:"Trash2",tooltip:o.unref(i)("editor.table.menu.deleteTable"),"icon-class":"w-5 h-5",action:g,"tooltip-options":{sideOffset:15},disabled:!((M=y.editor)!=null&&M.can().deleteTable())},null,8,["tooltip","disabled"])])]}),_:1},8,["editor","tippy-options"]))}}),zee={class:"p-2 bg-white border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800"},Uee={class:"flex items-center gap-1"},Rh=o.defineComponent({__name:"ColumnsBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=({editor:l})=>F0(l.view.state,"columns"),r=()=>{const l=x8(e.editor,"columns");return(l==null?void 0:l.getBoundingClientRect())||new DOMRect(-1e3,-1e3,0,0)},i=()=>{e.editor.chain().focus().setLayout(Ba.SidebarLeft).run()},s=()=>{e.editor.chain().focus().setLayout(Ba.SidebarRight).run()},a=()=>{e.editor.chain().focus().setLayout(Ba.TwoColumn).run()};return(l,u)=>(o.openBlock(),o.createBlock(o.unref(Wu),{editor:l.editor,"plugin-key":"columns","should-show":n,"update-delay":0,"tippy-options":{offset:[0,8],popperOptions:{modifiers:[{name:"flip",enabled:!1}]},getReferenceClientRect:r,plugins:[o.unref(zI)],sticky:"popper"}},{default:o.withCtx(()=>[o.createElementVNode("div",zee,[o.createElementVNode("div",Uee,[o.createVNode(Xe,{id:"panel-left",title:"ok",icon:"PanelLeft",tooltip:"tooltip",action:i,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(Ba).SidebarLeft}),"tooltip-options":{sideOffset:15}},null,8,["is-active"]),o.createVNode(Xe,{id:"columns",title:"ok",icon:"Columns",tooltip:"tooltip",action:a,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(Ba).TwoColumn}),"tooltip-options":{sideOffset:15}},null,8,["is-active"]),o.createVNode(Xe,{id:"panel-right",title:"ok",icon:"PanelRight",tooltip:"tooltip",action:s,"is-active":()=>l.editor.isActive("columns",{layout:o.unref(Ba).SidebarRight}),"tooltip-options":{sideOffset:15}},null,8,["is-active"])])])]),_:1},8,["editor","tippy-options"]))}}),Wee={class:"flex items-center gap-2 p-2 bg-white border rounded-lg shadow-sm dark:bg-black border-neutral-200 dark:border-neutral-800"},jee=["href"],qee={class:"flex flex-nowrap"},Kee=o.defineComponent({__name:"LinkViewBlock",props:{editor:{},link:{default:void 0}},emits:["clear","edit"],setup(t,{emit:e}){const{t:n}=Tt(),r=e;function i(){r("clear")}function s(){r("edit")}return(a,l)=>(o.openBlock(),o.createElementBlock("div",Wee,[o.createElementVNode("a",{href:a.link,target:"_blank",rel:"noopener noreferrer",class:"text-sm underline break-all"},o.toDisplayString(o.unref(kt.truncate)(a.link,{length:50,omission:"…"})),9,jee),a.link?(o.openBlock(),o.createBlock(o.unref(mo),{key:0,orientation:"vertical",class:"h-4"})):o.createCommentVNode("",!0),o.createElementVNode("div",qee,[o.createVNode(Xe,{icon:"Pencil",tooltip:o.unref(n)("editor.link.edit.tooltip"),action:s,"tooltip-options":{sideOffset:15}},null,8,["tooltip"]),o.createVNode(Xe,{icon:"Unlink",tooltip:o.unref(n)("editor.link.unlink.tooltip"),action:i,"tooltip-options":{sideOffset:15}},null,8,["tooltip"])])]))}}),Lh=o.defineComponent({__name:"LinkBubbleMenu",props:{editor:{},disabled:{type:Boolean,default:!1}},setup(t){const e=t,n=o.ref(!1),r=o.computed(()=>{const{href:l}=e.editor.getAttributes("link");return l}),i=o.computed(()=>e.editor.isActive("link"));function s(l,u,c){e.editor.chain().extendMarkRange("link").insertContent({type:"text",text:u,marks:[{type:"link",attrs:{href:l,target:c?"_blank":""}}]}).setLink({href:l}).focus().run(),n.value=!1}function a(){e.editor.chain().extendMarkRange("link").unsetLink().focus().run(),n.value=!1}return(l,u)=>o.withDirectives((o.openBlock(),o.createBlock(o.unref(Wu),{editor:l.editor,"update-delay":0,"tippy-options":{popperOptions:{modifiers:[{name:"flip",enabled:!0}]},appendTo:"parent",placement:"bottom-start",offset:[-2,16],zIndex:9999,onHidden:()=>{n.value=!1}}},{default:o.withCtx(()=>[o.createVNode(o.unref(fs),{open:n.value,"onUpdate:open":u[1]||(u[1]=c=>n.value=c)},{default:o.withCtx(()=>[o.createVNode(o.unref(DP),null,{default:o.withCtx(()=>[n.value?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(Kee,{key:0,editor:l.editor,link:r.value,onClear:a,onEdit:u[0]||(u[0]=c=>n.value=!0)},null,8,["editor","link"]))]),_:1}),o.createVNode(o.unref(ps),{class:"p-0 border-0 w-fit shadow-none",align:"start",side:"bottom"},{default:o.withCtx(()=>[o.createVNode($5,{class:"p-4",editor:l.editor,onOnSetLink:s},null,8,["editor"])]),_:1})]),_:1},8,["open"])]),_:1},8,["editor","tippy-options"])),[[o.vShow,i.value]])}}),tS=(t,e,n,r,i)=>{const s=o.ref(0),a=Ne.useEventBus(fr.RENDER_SUPER_TEXT),l=_=>{if(!e.value||!t)return;const T=e.value.index,A=e.value.id,{state:D}=t,{tr:O}=D;let M=!1;D.doc.descendants(($,V)=>{var G,ee;if(((G=$.attrs)==null?void 0:G[rt.ID])===A){(ee=$.attrs[rt.TEXT])!=null&&ee.trim();const W=_.trim();if(Eh(W))return O.delete(V,V+1),M=!0,!1;const{[rt.ELEMENT_ID]:F,...R}=$.attrs;return O.setNodeMarkup(V,void 0,{...R,[rt.TEXT]:W}),M=!0,!1}return!0}),M&&t&&t.view.dispatch(O),T!==-1&&(n.value[T].text=_,n.value[T].textOriginal=_)},u=o.ref(new Map),c=()=>{if(!(t!=null&&t.view.dom))return[];const _=[],T=t==null?void 0:t.view.dom.querySelectorAll("[node-id]"),A=new Map;return u.value.clear(),T.forEach(D=>{const O=D.getBoundingClientRect().top;A.has(O)||A.set(O,D),u.value.set(D.getAttribute("node-id")||"unknown",0)}),_.push(...A.values()),_},f=_=>{const T=_.closest(`#${r}`);if(!T)return;const A=T.getBoundingClientRect().top,D=T==null?void 0:T.scrollTop;return _.getBoundingClientRect().top-(A-D)},p=(_,T)=>{const A=n.value.findIndex(D=>D.id===_);A>-1&&(n.value[A].status=T)},m=_=>_.replace(/<p><\/p>/g,"<p>&nbsp;</p>"),g=()=>{if(!n.value||n.value.length===0){s.value=0,u.value.clear();return}if(!i.value||i.value.length===0)return;const _=i.value,T=new Set(n.value.map(O=>O.id)),A=_.map(O=>({isHidden:O.classList.contains("hidden"),isTruncated:O.classList.contains("super-text-truncate")}));_.forEach(O=>{O.classList.remove("hidden"),O.classList.remove("super-text-truncate")});for(const O of u.value.keys())T.has(O)||u.value.delete(O);_.forEach(O=>{const M=O.getAttribute("book-mark-id");if(!M)return;const $=O.offsetTop+O.offsetHeight,V=u.value.get(M)||0;u.value.set(M,Math.max($,V))}),_.forEach((O,M)=>{A[M].isHidden&&O.classList.add("hidden"),A[M].isTruncated&&O.classList.add("super-text-truncate")});let D=0;for(const O of u.value.values())O>D&&(D=O);s.value=D},b=async()=>{await o.nextTick();const T=c().map(A=>{const D=A.getAttribute("node-id"),O=A.getAttribute("book-mark-content"),M=A.getAttribute("page-id"),$=A.getAttribute("page-number"),V=A.getBoundingClientRect(),G=A.getAttribute("line-id"),ee=A.getAttribute("element-id");return{position:V,text:m(O),id:D,pageId:M,pageNumber:$,visiblePosition:f(A),status:0,lineId:G,elementId:ee,textOriginal:m(O)}});n.value=T},v=(_,T)=>{const A=_.bottom<=T.top,D=_.top>=T.bottom;return!(A||D)};async function y(){const _=i.value;if(!_||_.length===0){g();return}_.sort((T,A)=>{const D=Number(T.getAttribute("index")),O=Number(A.getAttribute("index"));return D-O}),_.forEach(T=>T.classList.remove("super-text-truncate")),_.forEach((T,A)=>{const D=T.getBoundingClientRect();_.slice(A+1).forEach(O=>{const M=O.getBoundingClientRect();v(D,M)&&T.classList.add("super-text-truncate")})}),g()}const x=async _=>{await o.nextTick();const T=t==null?void 0:t.view.dom.querySelector(`[node-id='${_.dataId}']`),A=i.value.find(M=>{const $=M.getBoundingClientRect().top,V=T==null?void 0:T.getBoundingClientRect().top;if(V==null)return!1;const G=V-$;return Math.abs(G-9)<=2});if(!A)return;const D=Number(A.getAttribute("index"));if(!_.text){A.querySelector(".super-text-lines").innerHTML=n.value[D].textOriginal,i.value.forEach(M=>M.classList.remove("hidden")),y();return}A.querySelector(".super-text-lines").innerHTML=m(_.text),A.classList.remove("super-text-truncate");const O=A.getBoundingClientRect();i.value.forEach((M,$)=>{if($!==D){const V=M.getBoundingClientRect();v(O,V)&&M.classList.add("hidden")}}),g()},E=_=>{switch(_.action){case"hover":x(_.payload);break;case"status":p(_.payload.id,_.payload.status);break;case"render":b();break;default:console.log("There is no action")}},k=(_,T)=>{const A=_.currentTarget;A.classList.remove("super-text-truncate");const D=A.getBoundingClientRect();i.value.forEach((O,M)=>{if(M!==T){const $=O.getBoundingClientRect();v(D,$)&&O.classList.add("hidden")}}),g()},C=()=>{i.value.forEach(_=>_.classList.remove("hidden")),y()};return o.onBeforeMount(()=>{a.on(E),window.addEventListener("resize",b)}),o.onBeforeUnmount(()=>{a.off(E),window.removeEventListener("resize",b)}),o.watch(()=>n,async()=>{await o.nextTick(),y()},{deep:!0}),{onUpdate:l,hanldeTruncateSuperTexts:y,eventListener:E,handleMouseOver:k,handleMouseLeave:C,wrapperMinHeight:s}},Gee=["index","book-mark-id","line-id","onMouseover"],Xee=["innerHTML"],Yee=uo(o.defineComponent({__name:"SuperTextView",props:{editor:{},superPreviewCustomClass:{},minChars:{},fontSize:{}},setup(t,{expose:e}){const n=t,r=o.ref([]),i=o.ref([]),s=o.ref(!1),a=o.ref(!1),l=o.ref(null),u=o.inject("isMobile",!1),c=o.inject("canEditSuper",o.ref(!0)),{onUpdate:f,handleMouseOver:p,handleMouseLeave:m,wrapperMinHeight:g}=tS(n.editor,l,i,"editor-container",r),b=(k,C)=>{c.value&&(l.value={id:k.id,text:k.text,elementId:k.elementId,index:C},s.value=!0,u&&(a.value=!0))},v=k=>{var C,_;return cd(k?((C=n.superPreviewCustomClass)==null?void 0:C.completedSuper)??"bg-black":((_=n.superPreviewCustomClass)==null?void 0:_.unproducedSuper)??"bg-red-500")},y=o.computed(()=>n.fontSize??""),{contentInner:x,measuredMinWidth:E}=df({minChars:n.minChars,fontSize:y});return e({measuredMinWidthComment:E}),(k,C)=>{var T;const _=Ot;return o.openBlock(),o.createElementBlock("div",{id:"super-text-view-wrapper",ref_key:"contentInner",ref:x,style:o.normalizeStyle({width:`${Number(o.unref(E))+25}px`,minHeight:`${o.unref(g)}px`}),class:o.normalizeClass(o.unref(Se)("relative border border-ed-gray-400 dark:bg-black rounded-[3px] mr-2.5",((T=k.superPreviewCustomClass)==null?void 0:T.overall)??"bg-ed-gray-50"))},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,(A,D)=>{var O,M,$;return o.openBlock(),o.createElementBlock("div",{key:A.id,ref_for:!0,ref_key:"superTextRefs",ref:r,index:D,"book-mark-id":A.id,"line-id":A.lineId,class:o.normalizeClass(o.unref(Se)("super-text-view","absolute w-full px-2 translate-y-[-10px] group",{})),style:o.normalizeStyle({top:`${A.visiblePosition||((O=A.position)==null?void 0:O.top)}px`}),onMouseover:V=>o.unref(p)(V,D),onMouseleave:C[0]||(C[0]=(...V)=>o.unref(m)&&o.unref(m)(...V))},[o.createVNode(o.unref(uv),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(Se)("wrap-anywhere whitespace-normal w-full !font-normal px-1 pt-0 m-0 !leading-tight rounded-sm text-white border-transparent cursor-pointer",A.elementId?((M=k.superPreviewCustomClass)==null?void 0:M.completedSuper)??"bg-black":(($=k.superPreviewCustomClass)==null?void 0:$.unproducedSuper)??"bg-red-500",{"cursor-default":!o.unref(c)})),onDblclick:V=>b(A,D)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"super-text-lines",innerHTML:A.text},null,8,Xee),o.createVNode(_,{name:"triangle",class:o.normalizeClass(["absolute top-[0.4em] rotate-90 w-3 h-3 right-0",v(A.elementId)])},null,8,["class"])]),_:2},1032,["class","onDblclick"])],46,Gee)}),128)),!o.unref(u)&&l.value?(o.openBlock(),o.createBlock(Wc,{key:0,open:s.value,editor:n.editor,"super-text-init":l.value.text,"super-text-element-id":l.value.elementId,onClose:C[1]||(C[1]=A=>s.value=!1),onSave:o.unref(f)},null,8,["open","editor","super-text-init","super-text-element-id","onSave"])):o.createCommentVNode("",!0)],6)}}}),[["__scopeId","data-v-18e941f3"]]),Jee=["index","book-mark-id","line-id","onMouseover"],Zee=["innerHTML"],Qee=uo(o.defineComponent({__name:"SuperTextViewComment",props:{editor:{},disableSuperInput:{type:Boolean},superPreviewCustomClass:{}},setup(t){const e=t,n=o.ref([]),r=o.ref([]),i=o.ref(!1),s=o.ref(!1),a=o.ref(null),l=o.inject("isMobile",!1),u=o.inject("isEditable",o.ref(!0)),{onUpdate:c,handleMouseOver:f,handleMouseLeave:p,wrapperMinHeight:m}=tS(e.editor,a,r,"editor-container-comment",n),g=(y,x)=>{u.value&&(a.value={id:y.id,text:y.text,elementId:y.elementId,index:x},e.disableSuperInput||(i.value=!0),l&&(s.value=!0))},b=y=>{var x,E;return cd(y?((x=e.superPreviewCustomClass)==null?void 0:x.completedSuper)??"bg-black":((E=e.superPreviewCustomClass)==null?void 0:E.unproducedSuper)??"bg-red-500")},v=o.inject("measuredMinWidthComment",0);return(y,x)=>{var k;const E=Ot;return o.openBlock(),o.createElementBlock("div",{id:"super-text-view-wrapper",style:o.normalizeStyle({width:`${Number(o.unref(v))+25}px`,minHeight:`${o.unref(m)}px`}),class:o.normalizeClass(o.unref(Se)("relative border border-ed-gray-400 dark:bg-black rounded-[3px] mr-2.5",((k=y.superPreviewCustomClass)==null?void 0:k.overall)??"bg-ed-gray-50"))},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(r.value,(C,_)=>{var T,A,D;return o.openBlock(),o.createElementBlock("div",{key:C.id,ref_for:!0,ref_key:"superTextRefs",ref:n,index:_,"book-mark-id":C.id,"line-id":C.lineId,class:o.normalizeClass(o.unref(Se)("super-text-view","absolute w-full px-2 translate-y-[-10px] group",{})),style:o.normalizeStyle({top:`${C.visiblePosition||((T=C.position)==null?void 0:T.top)}px`}),onMouseover:O=>o.unref(f)(O,_),onMouseleave:x[0]||(x[0]=(...O)=>o.unref(p)&&o.unref(p)(...O))},[o.createVNode(o.unref(uv),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(Se)("wrap-anywhere whitespace-normal w-full !font-normal px-1 pt-0 m-0 !leading-tight rounded-sm text-white border-transparent cursor-pointer",C.elementId?((A=y.superPreviewCustomClass)==null?void 0:A.completedSuper)??"bg-black":((D=y.superPreviewCustomClass)==null?void 0:D.unproducedSuper)??"bg-red-500",{"cursor-default":!o.unref(u)})),onDblclick:O=>g(C,_)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"super-text-lines",innerHTML:C.text},null,8,Zee),o.createVNode(E,{name:"triangle",class:o.normalizeClass(["absolute top-[0.4em] rotate-90 w-3 h-3 right-0",b(C.elementId)])},null,8,["class"])]),_:2},1032,["class","onDblclick"])],46,Jee)}),128)),!o.unref(l)&&a.value&&!y.disableSuperInput?(o.openBlock(),o.createBlock(Wc,{key:0,open:i.value,editor:e.editor,"super-text-init":a.value.text,"super-text-element-id":a.value.elementId,onClose:x[1]||(x[1]=C=>i.value=!1),onSave:o.unref(c)},null,8,["open","editor","super-text-init","super-text-element-id","onSave"])):o.createCommentVNode("",!0)],6)}}}),[["__scopeId","data-v-9e49a79c"]]),nS=t=>{console.log(t),t=t.replace(/\s*style="[^"]*"/g,""),t=t.replace(/<iframe\b[\s\S]*?<\/iframe\s*>/gi,"");const e=t.match(/<!--StartFragment-->([\s\S]*?)<!--EndFragment-->/),r=(e?e[1]:t).replace(/<br\s*\/?>/gi,`
345
- `).split(/\r?\n/),i=[];for(const a of r){const l=a.trim();if(l==="")i.push("<p></p>");else if(/^<br\s*\/?>/i.test(l)){const u=l.replace(/^<br\s*\/?>/i,"").trim();i.push(`<p>${u}</p>`)}else if(/^<\/BR>/i.test(l)){const u=l.replace(/^<\/BR>/i,"").trim();i.push(`<p>${u}</p>`)}else/^<(?!p\b)[^>]+>/i.test(l)?i.push(`<p>${l}</p>`):i.push(l)}let s=i.join("");return s=s.replace(/<p\b[^>]*>/gi,"<p>"),s},Uv=t=>/^https?:\/\/[^\s]+$/i.test(t.trim()),Wv=(t,e)=>{const{tr:n,selection:r,schema:i}=t.state,s=i.marks.link.create({href:e});return r.empty?(t.dispatch(n.insertText(e,r.from).addMark(r.from,r.from+e.length,s)),!0):(t.dispatch(n.addMark(r.from,r.to,s)),!0)},Nee=(t,e)=>{const{tr:n,schema:r}=t.state,i=e.split(/(?:\r\n?|\n)/),s=[];if(i.forEach(u=>{let c={type:"paragraph"};u.length>0&&(c.content=[{type:"text",text:u}]);let f=Dr.fromJSON(r,c);s.push(f)}),s.length===0)return!1;const a=ge.fromArray(s),l=Te.maxOpen(a);return t.dispatch(n.replaceSelection(l)),!0},ete=xn(),Dh=t=>{const e=o.computed(()=>ete.state.spellCheck);o.watch(()=>e.value,n=>{t.view.dispatch(t.state.tr.setMeta(qn.IS_ACTIVE_SPELLCHECK,n)),t.extensionStorage.spellchecker.spellchecker.hideSuggestionBox(),WC(t)&&t.commands.focus()},{immediate:!0})},tte={id:"editor-container-comment",class:"flex flex-col"},nte={class:"flex flex-1"},rte={id:"editor-panel",class:"flex-1 p-2.5 border border-ed-gray-400 rounded-[3px] focus-within:border-ed-input-focus"},ote=o.defineComponent({__name:"EditorComment",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{},fontFamilyDefault:{},fontWeightDefault:{},contentTextStyle:{},isOpenSuperView:{type:Boolean,default:!0},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:600},maxHeight:{default:void 0},height:{},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},customClassToolbar:{},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean},superPreviewCustomClass:{default:void 0},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{type:Boolean},editorContentInstance:{},toolbarExtensionOrder:{},watermarkOverlay:{},bottomOffset:{},characterCountLimit:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=Ne.useEventBus(fr.RENDER_SUPER_TEXT),a=o.useAttrs(),l=xn(),{isReady:u,editor:c,updateEditorState:f,superTextStore:p,checkSpellStore:m,setEditorContextMenuRef:g,setEditorFocusedInstance:b}=l,v=o.inject("isEditable",o.ref(!0)),y=new Lo({enablePasteRules:!1,enableInputRules:!1,content:bn(r.modelValue,r.disabled),editorProps:{attributes:{id:lr.COMMENT,[lr.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:kt.throttle((T,A)=>A.key==="Enter"&&a.enter&&!A.shiftKey?(i("enter"),!0):!1,Vo),transformPastedHTML:T=>nS(T),handlePaste:(T,A)=>{const D=A.clipboardData;if(!D)return!1;const O=r.mode,M=D.getData("text/plain")||"",$=Array.from(D.items).some(V=>V.type.startsWith("image/"));return(O===Me.STRAIGHT||O===Me.REPORT)&&$?(A.preventDefault(),!0):O===Me.PLAIN_TEXT?(A.preventDefault(),T.dispatch(T.state.tr.insertText(M,T.state.selection.from)),!0):!1},clipboardTextParser:(T,A)=>{const D=T.split(/(?:\r\n?|\n)/),O=[];D.forEach($=>{let V={type:"paragraph"};$.length>0&&(V.content=[{type:"text",text:$}]);let G=Dr.fromJSON(A.doc.type.schema,V);O.push(G)});const M=ge.fromArray(O);return Te.maxOpen(M)}},onCreate:({editor:T})=>{f(T)},onUpdate:kt.throttle(({editor:T})=>{u.value=!0;const A=E(T,r.output);i("update:modelValue",A),i("change",{editor:T,output:A}),f(T),x()},Vo),extensions:r.extensions,editable:v.value,onFocus:T=>{g(k.value),b(T.editor)}});async function x(){await o.nextTick(),s.emit({action:"render"})}function E(T,A){if(!T)return"";if(T.isEmpty)return A==="json"?{}:"";switch(A){case"html":return T.getHTML();case"json":return T.getJSON();case"text":return T.getText();default:return""}}o.watch(()=>r.disableSuperInput,()=>{const T=document.getElementById(lr.COMMENT);T==null||T.setAttribute(lr.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),o.watch(()=>m.languages,()=>{y.commands.checkSpelling()}),o.watch(()=>r.modelValue,T=>{if(!y||kt.isEqual(E(y,r.output),T))return;const{from:A,to:D}=y.state.selection;y.commands.setTextSelection({from:A,to:D}),y.commands.setContent(bn(T,r.disabled),!1),x()},{deep:!0}),o.watch(()=>v.value,T=>{var A;y==null||y.setEditable(T),(A=y==null?void 0:y.commands)!=null&&A.setIsEnableSuggestion&&y.commands.setIsEnableSuggestion(T)},{immediate:!0}),o.watch(()=>c.value,()=>{c.value&&c.value.on("selectionUpdate",({editor:T})=>{i("changed:selection",{editor:T})})}),o.onUnmounted(()=>y==null?void 0:y.destroy()),wc(ju.SAVE,()=>{localStorage.setItem("comment",E(y,"html"))});const k=o.ref(null);function C(T){T===Me.REPORT&&g(k.value)}function _(T){T===Me.REPORT&&b(y)}return o.onMounted(()=>{C(r.mode),_(r.mode)}),o.watch(()=>r.mode,T=>{C(T),_(T)}),o.watch(()=>{var T,A;return(A=(T=r.editorContentInstance)==null?void 0:T.storage[ep])==null?void 0:A.enabled},()=>{y.commands.toggleTimeHighlight()}),Dh(y),e({editor:y}),(T,A)=>(o.openBlock(),o.createElementBlock("div",tte,[o.createElementVNode("div",nte,[o.withDirectives(o.createVNode(Qee,{"disable-super-input":T.disableSuperInput,editor:o.unref(y),"super-preview-custom-class":T.superPreviewCustomClass},null,8,["disable-super-input","editor","super-preview-custom-class"]),[[o.vShow,T.isOpenSuperView]]),o.createElementVNode("div",rte,[o.createVNode(kv,{ref_key:"selectContextMenuRef",ref:k,"disable-super-input":T.disableSuperInput,editor:o.unref(y),mode:T.mode,"super-text-store":o.unref(p)},{default:o.withCtx(()=>[o.createVNode(o.unref(Qn),{editor:o.unref(y),spellcheck:"true",class:"h-full break-all"},null,8,["editor"])]),_:1},8,["disable-super-input","editor","mode","super-text-store"])])])]))}});function ite(t,e,n=!1,r=200){const{height:i}=Ne.useElementSize(t),s=o.ref(0),a=o.ref(0),l=o.ref(r),u=o.ref(0),c=async()=>{await o.nextTick();const f=i.value-8;e.value===Me.REPORT?(s.value=f/3,a.value=n?"auto":f-s.value,l.value=r/3*2,u.value=r/3):(s.value=0,a.value=n?"auto":i.value)};return n||o.watch(()=>i.value,c),o.onMounted(()=>{c()}),{commentHeight:s,contentHeight:a,minHeight:l,minHeightComment:u}}var ste={exports:{}};(function(t){(function(){var e=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],n=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ",["ㅗ","ㅏ"],["ㅗ","ㅐ"],["ㅗ","ㅣ"],"ㅛ","ㅜ",["ㅜ","ㅓ"],["ㅜ","ㅔ"],["ㅜ","ㅣ"],"ㅠ","ㅡ",["ㅡ","ㅣ"],"ㅣ"],r=["","ㄱ","ㄲ",["ㄱ","ㅅ"],"ㄴ",["ㄴ","ㅈ"],["ㄴ","ㅎ"],"ㄷ","ㄹ",["ㄹ","ㄱ"],["ㄹ","ㅁ"],["ㄹ","ㅂ"],["ㄹ","ㅅ"],["ㄹ","ㅌ"],["ㄹ","ㅍ"],["ㄹ","ㅎ"],"ㅁ","ㅂ",["ㅂ","ㅅ"],"ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],i=44032,s=["ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄸ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅃ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],a=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],l=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"],u=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],c=[["ㄱ","ㅅ","ㄳ"],["ㄴ","ㅈ","ㄵ"],["ㄴ","ㅎ","ㄶ"],["ㄹ","ㄱ","ㄺ"],["ㄹ","ㅁ","ㄻ"],["ㄹ","ㅂ","ㄼ"],["ㄹ","ㅅ","ㄽ"],["ㄹ","ㅌ","ㄾ"],["ㄹ","ㅍ","ㄿ"],["ㄹ","ㅎ","ㅀ"],["ㅂ","ㅅ","ㅄ"]],f=[["ㅗ","ㅏ","ㅘ"],["ㅗ","ㅐ","ㅙ"],["ㅗ","ㅣ","ㅚ"],["ㅜ","ㅓ","ㅝ"],["ㅜ","ㅔ","ㅞ"],["ㅜ","ㅣ","ㅟ"],["ㅡ","ㅣ","ㅢ"]],p,m,g,b,v,y;function x(L){for(var q=L.length,X={0:0},le=0;le<q;le++)L[le]&&(X[L[le].charCodeAt(0)]=le);return X}p=x(s),m=x(a),g=x(l),b=x(u);function E(L){for(var q=L.length,X={},le,pe,_e=0;_e<q;_e++)le=L[_e][0].charCodeAt(0),pe=L[_e][1].charCodeAt(0),typeof X[le]>"u"&&(X[le]={}),X[le][pe]=L[_e][2].charCodeAt(0);return X}v=E(c),y=E(f);function k(L){return typeof p[L]<"u"}function C(L){return typeof m[L]<"u"}function _(L){return typeof g[L]<"u"}function T(L){return typeof b[L]<"u"}function A(L){return 44032<=L&&L<=55203}function D(L,q){return y[L]&&y[L][q]?y[L][q]:!1}function O(L,q){return v[L]&&v[L][q]?v[L][q]:!1}var M=function(L,q){if(L===null)throw new Error("Arguments cannot be null");typeof L=="object"&&(L=L.join(""));for(var X=[],le=L.length,pe,_e,re,be,Y,te=0;te<le;te++){var ne=[];be=L.charCodeAt(te),A(be)?(be-=i,re=be%28,_e=(be-re)/28%21,pe=parseInt((be-re)/28/21),ne.push(e[pe]),typeof n[_e]=="object"?ne=ne.concat(n[_e]):ne.push(n[_e]),re>0&&(typeof r[re]=="object"?ne=ne.concat(r[re]):ne.push(r[re]))):k(be)?(C(be)?Y=e[m[be]]:Y=r[b[be]],typeof Y=="string"?ne.push(Y):ne=ne.concat(Y)):_(be)?(Y=n[g[be]],typeof Y=="string"?ne.push(Y):ne=ne.concat(Y)):ne.push(L.charAt(te)),q?X.push(ne):X=X.concat(ne)}return X},$=function(L){return typeof L!="string"?"":(L=M(L),L.join(""))},V=function(L){typeof L=="string"&&(L=M(L));var q=[],X=L.length,le,pe=0,_e=-1,re,be=!1;function Y(ne){var oe,ce,Ae,Be=0,We,Ge="";if(be=!1,!(_e+1>ne))for(var Ke=1;;Ke++){if(Ke===1){if(oe=L[_e+Ke].charCodeAt(0),_(oe))if(_e+Ke+1<=ne&&_(ce=L[_e+Ke+1].charCodeAt(0))){q.push(String.fromCharCode(D(oe,ce))),_e=ne;return}else{q.push(L[_e+Ke]),_e=ne;return}else if(!C(oe)){q.push(L[_e+Ke]),_e=ne;return}Ge=L[_e+Ke]}else if(Ke===2)if(ce=L[_e+Ke].charCodeAt(0),C(ce)){oe=O(oe,ce),Ge=String.fromCharCode(oe),q.push(Ge),_e=ne;return}else Ge=String.fromCharCode((m[oe]*21+g[ce])*28+i);else Ke===3?(Ae=L[_e+Ke].charCodeAt(0),D(ce,Ae)?ce=D(ce,Ae):Be=Ae,Ge=String.fromCharCode((m[oe]*21+g[ce])*28+b[Be]+i)):Ke===4?(We=L[_e+Ke].charCodeAt(0),O(Be,We)?Be=O(Be,We):Be=We,Ge=String.fromCharCode((m[oe]*21+g[ce])*28+b[Be]+i)):Ke===5&&(We=L[_e+Ke].charCodeAt(0),Be=O(Be,We),Ge=String.fromCharCode((m[oe]*21+g[ce])*28+b[Be]+i));if(_e+Ke>=ne){q.push(Ge),_e=ne;return}}}for(var te=0;te<X;te++){if(le=L[te].charCodeAt(0),!C(le)&&!_(le)&&!T(le)){Y(te-1),Y(te),pe=0;continue}pe===0?C(le)?pe=1:_(le)&&(pe=4):pe==1?_(le)?pe=2:O(re,le)?pe=5:Y(te-1):pe==2?T(le)?pe=3:_(le)?D(re,le)||(Y(te-1),pe=4):(Y(te-1),pe=1):pe==3?T(le)?!be&&O(re,le)?be=!0:(Y(te-1),pe=1):C(le)?(Y(te-1),pe=1):_(le)&&(Y(te-2),pe=2):pe==4?_(le)?D(re,le)?(Y(te),pe=0):Y(te-1):(Y(te-1),pe=1):pe==5&&(_(le)?(Y(te-2),pe=2):(Y(te-1),pe=1)),re=le}return Y(te-1),q.join("")},G=function(L,q){var X=M(L).join(""),le=M(q).join("");return X.indexOf(le)},ee=function(L,q){var X=M(L).join(""),le=M(q).join(""),pe=M(L,!0),_e=new RegExp(le,"gi"),re=[],be;if(!q.length)return[];for(;be=_e.exec(X);)re.push(be.index);function Y(ne){for(var oe=0,ce=0;oe<pe.length;++oe)if(ce+=pe[oe].length,ne<ce)return oe}function te(ne){for(var oe=0,ce=0;oe<pe.length;++oe)if(ce+=pe[oe].length,ne+le.length<=ce)return oe}return re.map(function(ne){return[Y(ne),te(ne)]})};function W(L){this.string=L,this.disassembled=M(L).join("")}W.prototype.search=function(L){return M(L).join("").indexOf(this.disassembled)};var F=function(L){typeof L=="object"&&(L=L.join(""));var q=L.charCodeAt(L.length-1);if(A(q)){q-=i;var X=q%28;if(X>0)return!0}else if(k(q))return!0;return!1},R=function(L,q){return M(L).pop()===q},H={disassemble:M,d:M,disassembleToString:$,ds:$,assemble:V,a:V,search:G,rangeSearch:ee,Searcher:W,endsWithConsonant:F,endsWith:R,isHangul:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),A(L)},isComplete:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),A(L)},isConsonant:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),k(L)},isVowel:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),_(L)},isCho:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),C(L)},isJong:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),T(L)},isHangulAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!A(L.charCodeAt(q)))return!1;return!0},isCompleteAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!A(L.charCodeAt(q)))return!1;return!0},isConsonantAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!k(L.charCodeAt(q)))return!1;return!0},isVowelAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!_(L.charCodeAt(q)))return!1;return!0},isChoAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!C(L.charCodeAt(q)))return!1;return!0},isJongAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!T(L.charCodeAt(q)))return!1;return!0}};t.exports=H})()})(ste);const Yl=new Et("searchHighlight");function Ph(t,e,n){const r=[];if(!e)return r;const i=n.caseSensitive?e.normalize("NFC"):e.normalize("NFC").toLowerCase(),{doc:s}=t.state,a=l=>/[0-9A-Za-z가-힣_]/.test(l);return s.descendants((l,u)=>{if(!l.isText||!l.text)return;let c=l.text.normalize("NFC");n.caseSensitive||(c=c.toLowerCase());let f=0,p=c.indexOf(i,f);for(;p!==-1;){const m=p,g=p+i.length-1;if(n.wholeWord){const b=m>0?c[m-1]:"",v=g+1<c.length?c[g+1]:"";if(b&&a(b)||v&&a(v)){f=p+1,p=c.indexOf(i,f);continue}}r.push({from:u+m,to:u+g+1}),f=p+i.length,p=c.indexOf(i,f)}}),r}function jv(t){return t.state.selection.from}function rS(t){if(t.state.plugins.find(r=>r.spec.key===Yl))return;const n=new nt({key:Yl,state:{init(){return ut.empty},apply(r,i){const s=r.getMeta(Yl);return s!==void 0?s:i.map(r.mapping,r.doc)}},props:{decorations(r){return Yl.getState(r)}}});t.registerPlugin(n)}function oS(t,e,n){rS(t);const r=e.map((a,l)=>qt.inline(a.from,a.to,{class:l===n?"search-match-active":"search-match"})),i=ut.create(t.state.doc,r),s=t.state.tr.setMeta(Yl,i);t.view.dispatch(s)}function Jl(t){rS(t);const e=t.state.tr.setMeta(Yl,ut.empty);t.view.dispatch(e)}function ate(t){const e=o.ref(-1),n=o.ref([]),r=o.computed(()=>n.value.length);function i(p){var x;const m=t.value;if(!m||n.value.length===0)return;const g=n.value.length;e.value=(p%g+g)%g,oS(m,n.value,e.value);const b=n.value[e.value],y=m.view.domAtPos(b.from).node;(x=y==null?void 0:y.scrollIntoView)==null||x.call(y,{block:"nearest",behavior:"smooth"}),m.chain().setTextSelection({from:b.from,to:b.to}).scrollIntoView().run()}function s(p){const m=t.value;if(!m)return;if(n.value=Ph(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=jv(m),b=n.value.findIndex(v=>v.from>g);i(b===-1?0:b)}function a(p){const m=t.value;if(!m)return;if(n.value=Ph(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=jv(m);let b=-1;for(let v=n.value.length-1;v>=0;v--)if(n.value[v].to<g){b=v;break}i(b===-1?n.value.length-1:b)}function l(p){const m=t.value;if(!m||e.value===-1||n.value.length===0)return;const g=n.value[e.value],{state:b}=m,v=b.doc.textBetween(g.from,g.to);if(!(p.caseSensitive?v===p.find:v.toLowerCase()===p.find.toLowerCase())){s(p);return}m.chain().focus().setTextSelection({from:g.from,to:g.to}).insertContent(p.replace).run(),s(p)}function u(p){const m=t.value;if(!m)return;const g=Ph(m,p.find,p);if(g.length===0)return;const b=m.chain().focus();[...g].reverse().forEach(v=>{b.setTextSelection({from:v.from,to:v.to}).insertContent(p.replace)}),b.run(),n.value=[],e.value=-1,Jl(m)}function c(p){const m=t.value;if(!m)return;if(!p.find){n.value=[],e.value=-1,Jl(m);return}if(n.value=Ph(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=jv(m),b=n.value.findIndex(y=>y.from>=g),v=b===-1?0:b;e.value=v,i(v),oS(m,n.value,v)}function f(){const p=t.value;p&&(n.value=[],e.value=-1,Jl(p))}return{searchUp:a,searchDown:s,replaceCurrent:l,replaceAll:u,totalMatches:r,currentMatchIndex:o.readonly(e),refreshMatches:c,clearSearch:f}}const iS=o.defineComponent({__name:"Checkbox",props:{defaultChecked:{type:Boolean},checked:{type:[Boolean,String]},disabled:{type:Boolean},required:{type:Boolean},name:{},value:{},id:{},asChild:{type:Boolean},as:{},class:{}},emits:["update:checked"],setup(t,{emit:e}){const n=t,r=e,i=o.computed(()=>{const{class:a,...l}=n;return l}),s=Dt(i,r);return(a,l)=>(o.openBlock(),o.createBlock(o.unref(LD),o.mergeProps(o.unref(s),{class:o.unref(Se)("peer h-5 w-5 shrink-0 rounded-sm border border-ed-border shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ed-ring disabled:cursor-not-allowed disabled:opacity-50 text-ed-blue",n.class)}),{default:o.withCtx(()=>[o.createVNode(o.unref(DD),{class:"flex h-full w-full items-center justify-center"},{default:o.withCtx(()=>[o.renderSlot(a.$slots,"default",{},()=>[o.createVNode(o.unref(Gg),{icon:"fa-solid:check"})])]),_:3})]),_:3},16,["class"]))}}),lte={class:"flex items-center justify-between px-5 pt-4 pb-2 cursor-move bg-[#F6FAFE]"},ute={class:"text-base font-semibold text-gray-800"},cte={class:"px-5 pt-[20px] pb-4 flex flex-col gap-y-3 bg-white"},dte={class:"grid grid-cols-[60px,1fr] gap-x-3 items-center"},fte={class:"text-right text-sm text-gray-600"},pte={class:"relative"},hte={key:0,class:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-gray-400 pointer-events-none"},mte={class:"grid grid-cols-[60px,1fr] gap-x-3 items-center"},gte={class:"text-right text-sm text-gray-600"},bte={class:"grid grid-cols-[60px,1fr] gap-x-3"},vte={class:"flex gap-x-5"},yte={class:"flex items-center space-x-2 text-sm"},wte={for:"caseSensitive",class:"select-none text-gray-700"},xte={class:"grid grid-cols-[60px,1fr] gap-x-3"},Cte={class:"flex gap-x-2"},Ete=uo(o.defineComponent({__name:"BatchReplaceDialog",props:{modelValue:{type:Boolean},totalMatches:{default:0},currentMatchIndex:{default:-1}},emits:["update:modelValue","search-down","search-up","replace","replace-all","refresh"],setup(t,{emit:e}){const n=t,r=e;function i(){return{find:s.value,replace:a.value,caseSensitive:u.value,wholeWord:c.value}}const s=o.ref(""),a=o.ref(""),l=o.ref(null),u=o.ref(!1),c=o.ref(!1),f=o.computed(()=>s.value?n.totalMatches===0?"No matches":`${n.currentMatchIndex+1} / ${n.totalMatches}`:""),p=Ne.useLocalStorage("findReplaceDialogPosition",null),m=o.reactive({x:0,y:0}),g=o.ref(!1),b={x:0,y:0},v=O=>{const M=O.target;if(M.closest("input")||M.closest("button")||M.closest("label")||M.closest(".content-area"))return;g.value=!0;const $=document.querySelector(".find-replace-dialog");if(!$)return;const V=$.getBoundingClientRect();b.x=O.clientX-V.left,b.y=O.clientY-V.top,document.addEventListener("mousemove",y),document.addEventListener("mouseup",x)},y=O=>{g.value&&(m.x=O.clientX-b.x,m.y=O.clientY-b.y)},x=()=>{g.value=!1,p.value={x:m.x,y:m.y},document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",x)};o.onUnmounted(()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",x)}),o.watch(()=>n.modelValue,async O=>{var G,ee;if(!O)return;await o.nextTick();const M=document.querySelector(".find-replace-dialog");if(!M)return;const $=window.innerWidth,V=window.innerHeight;p.value&&p.value.x!==void 0&&p.value.y!==void 0?(m.x=p.value.x,m.y=p.value.y):(m.x=Math.max(($-M.offsetWidth)/2,0),m.y=Math.max((V-M.offsetHeight)/2,0)),s.value&&r("refresh",i()),await o.nextTick(),(ee=(G=l.value)==null?void 0:G.$el)==null||ee.focus()});const E=()=>{r("update:modelValue",!1)},k=()=>{s.value&&r("search-down",i())},C=()=>{s.value&&r("search-up",i())},_=()=>{r("replace",{find:s.value,replace:a.value,caseSensitive:u.value,wholeWord:c.value})},T=()=>{r("replace-all",{find:s.value,replace:a.value,caseSensitive:u.value,wholeWord:c.value})};function A(O){const M=O.target.value;s.value=M,r("refresh",i())}function D(O){const $=O.target.value+(O.data??"");r("refresh",{find:$,replace:a.value,caseSensitive:u.value,wholeWord:c.value})}return(O,M)=>{const $=hs,V=iS,G=vn,ee=Vc,W=Pc;return o.openBlock(),o.createBlock(W,{open:O.modelValue},{default:o.withCtx(()=>[o.createVNode(ee,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none max-w-max","as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"find-replace-dialog fixed z-[70] pointer-events-auto w-[460px] rounded-[10px] overflow-hidden bg-white shadow-xl",style:o.normalizeStyle({top:"0px",left:"0px",transform:`translate(${m.x}px, ${m.y}px)`}),onMousedown:v},[o.createElementVNode("div",lte,[o.createElementVNode("span",ute,o.toDisplayString(O.$t("찾기 및 바꾸기")),1),o.createElementVNode("button",{class:"bg-transparent text-gray-400 hover:text-gray-600 transition-colors p-1",onClick:E},[o.createVNode(o.unref(kc),{class:"w-5 h-5"})])]),o.createElementVNode("div",cte,[o.createElementVNode("div",dte,[o.createElementVNode("label",fte,o.toDisplayString(O.$t("검색")),1),o.createElementVNode("div",pte,[o.createVNode($,{ref_key:"findInputRef",ref:l,modelValue:s.value,"onUpdate:modelValue":M[0]||(M[0]=F=>s.value=F),class:"rounded-md h-[36px] text-sm pr-[90px] !border-gray-300 focus:!border-blue-500 focus:!ring-0 outline-none",onInput:A,onCompositionupdate:D,onKeydown:o.withKeys(o.withModifiers(k,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"]),o.unref(f)?(o.openBlock(),o.createElementBlock("span",hte,o.toDisplayString(o.unref(f)),1)):o.createCommentVNode("",!0)])]),o.createElementVNode("div",mte,[o.createElementVNode("label",gte,o.toDisplayString(O.$t("바꾸기")),1),o.createVNode($,{modelValue:a.value,"onUpdate:modelValue":M[1]||(M[1]=F=>a.value=F),class:"rounded-md h-[36px] text-sm !border-gray-300 focus:!border-blue-500 focus:!ring-0 outline-none"},null,8,["modelValue"])]),o.createElementVNode("div",bte,[M[3]||(M[3]=o.createElementVNode("div",null,null,-1)),o.createElementVNode("div",vte,[o.createElementVNode("div",yte,[o.createVNode(V,{id:"caseSensitive",checked:u.value,"onUpdate:checked":M[2]||(M[2]=F=>{u.value=!!F})},null,8,["checked"]),o.createElementVNode("label",wte,o.toDisplayString(O.$t("대소문자 일치")),1)])])]),o.createElementVNode("div",xte,[M[4]||(M[4]=o.createElementVNode("div",null,null,-1)),o.createElementVNode("div",Cte,[o.createVNode(G,{variant:"outline",class:"h-[36px] text-sm flex-1 rounded-md border-blue-500 text-blue-600 hover:bg-blue-50",onClick:_},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("바꾸기")),1)]),_:1}),o.createVNode(G,{variant:"outline",class:"h-[36px] text-sm flex-1 rounded-md border-blue-500 text-blue-600 hover:bg-blue-50",onClick:T},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("모두 바꾸기")),1)]),_:1}),o.createVNode(G,{class:"h-[36px] text-sm flex-1 rounded-md bg-blue-500 hover:bg-blue-600",disabled:!s.value,onClick:C},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("이전")),1)]),_:1},8,["disabled"]),o.createVNode(G,{class:"h-[36px] text-sm flex-1 rounded-md bg-blue-500 hover:bg-blue-600",disabled:!s.value,onClick:k},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("다음")),1)]),_:1},8,["disabled"])])])])],36)]),_:1})]),_:1},8,["open"])}}}),[["__scopeId","data-v-5ec84714"]]),kte={class:"flex flex-1"},Vh=o.defineComponent({__name:"CoreEditorV2",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{default:""},commentCuesheet:{default:""},hideComment:{type:Boolean,default:!1},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{default:"14px"},fontFamilyDefault:{default:"NanumGothicCoding"},fontWeightDefault:{default:void 0},contentTextStyle:{},isOpenSuperView:{type:Boolean},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{default:null},fieldNameCommentCuesheet:{default:null},fieldNameContent:{default:null},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:200},maxHeight:{default:void 0},height:{default:void 0},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean,default:!1},textAlert:{},customClassToolbar:{default:""},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean,default:!1},autoFocus:{type:Boolean},superPreviewCustomClass:{default:()=>({overall:"bg-ed-gray-50",unproducedSuper:"bg-red-500",completedSuper:"bg-black"})},minChar:{default:()=>({superPreview:29,content:26})},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{type:Boolean},editorContentInstance:{},toolbarExtensionOrder:{default:void 0},watermarkOverlay:{},bottomOffset:{},characterCountLimit:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur","open-batch-replace"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=Ne.useEventBus(fr.RENDER_SUPER_TEXT),a=Ne.useEventBus(fr.INCREASE_DECREASE_FONTSIZE),l=o.useAttrs(),u=xn(),{isFullscreen:c,isReady:f,editor:p,updateEditorState:m,superTextStore:g,checkSpellStore:b,setEditorContextMenuRef:v,setEditorContentInstance:y,setEditorFocusedInstance:x}=u,E=o.computed(()=>!(r.disabled||r.readonly));o.provide("isEditable",E);const k=o.computed(()=>E.value?!0:r.canEditSuperReadOnly);o.provide("canEditSuper",k);const C=o.computed(()=>r.mode===Me.EDITOR),_=o.ref(r.fontSizeDefault),T=o.ref(r.fontFamilyDefault),A=o.ref(r.fontWeightDefault);o.provide("fontSize",_),o.provide("fontFamily",T),o.provide("fontWeight",A);const D=ie=>{(ie.ctrlKey||ie.metaKey)&&ie.key.toLowerCase()==="h"&&(ie.preventDefault(),ie.stopPropagation(),ie.stopImmediatePropagation(),$.value=!0)};o.onMounted(()=>{We(),window.addEventListener("keydown",D,!0)}),o.onUnmounted(()=>{window.removeEventListener("keydown",D,!0)});const O=ie=>{const Ie=parseInt(_.value||"16px"),st=ie?Ie+2:Ie-2;_.value=st+"px"};o.onBeforeMount(()=>{r.disabled||a.on(O)}),o.onBeforeUnmount(()=>{r.disabled||a.off(O)});const M=o.computed(()=>({...o.unref(c)?{height:"100%"}:{minHeight:r.minHeight?rn(r.minHeight):void 0,maxHeight:r.maxHeight?rn(r.maxHeight):void 0,height:r.height?rn(r.height):void 0},maxWidth:rn(r.maxWidth),width:r.maxWidth?"100%":void 0,margin:r.maxWidth?"0 auto":void 0})),$=o.ref(!1),{searchUp:V,searchDown:G,replaceCurrent:ee,replaceAll:W,totalMatches:F,currentMatchIndex:R,refreshMatches:H,clearSearch:L}=ate(p);o.watch($,ie=>{ie||L()});const q=ie=>{H(ie)},X=ie=>{G(ie)},le=ie=>{V(ie)},pe=ie=>{ee(ie)},_e=ie=>{W(ie)},re=new Lo({enablePasteRules:!1,enableInputRules:!1,content:bn(r.modelValue,r.disabled,r.mode),editorProps:{handleKeyDown:kt.throttle((ie,Ie)=>Ie.key==="Enter"&&l.enter&&!Ie.shiftKey?(i("enter"),!0):!1,Vo),transformPastedHTML:ie=>r.mode===Me.EDITOR?nR(ie):nS(ie),handlePaste:(ie,Ie)=>{var ot;const st=Ie.clipboardData;if(!st)return!1;const Yt=r.mode,ae=Array.from(st.items),Le=ae.some(At=>At.type.startsWith("image/")),ze=ae.some(At=>At.type.startsWith("video/"));if((Yt===Me.STRAIGHT||Yt===Me.REPORT)&&(Le||ze))return Ie.preventDefault(),!0;if(ze)return Ie.preventDefault(),Ke(["video"])&&ae.forEach(async At=>{var Ts;if(!At.type.startsWith("video/"))return;const dn=At.getAsFile();if(!dn)return;const fn=re.extensionManager.extensions.find(As=>As.name==="video"),pr=(Ts=fn==null?void 0:fn.options)==null?void 0:Ts.upload,An=pr?await pr(dn):URL.createObjectURL(dn);re.commands.focus(),re.commands.setVideo({src:An})}),!0;const at=((ot=Ie.clipboardData)==null?void 0:ot.getData("text/plain"))||"";return r.mode===Me.EDITOR&&Uv(at)?(Ie.preventDefault(),Wv(ie,at.trim())):!1},clipboardTextParser:(ie,Ie)=>{const st=ie.split(/(?:\r\n?|\n)/),Yt=[];st.forEach(Le=>{let ze={type:"paragraph"};Le.length>0&&(ze.content=[{type:"text",text:Le}]);let at=Dr.fromJSON(Ie.doc.type.schema,ze);Yt.push(at)});const ae=ge.fromArray(Yt);return Te.maxOpen(ae)}},onCreate:({editor:ie})=>{m(ie)},onUpdate:kt.throttle(({editor:ie})=>{f.value=!0;const Ie=Ge(ie,r.output);i("update:modelValue",Ie),i("change",{editor:ie,output:Ie}),m(ie),o.nextTick(()=>{We()}),oe()},Vo),extensions:kt.uniqBy(qC(r.extensions,r),"name"),editable:E.value,onFocus:ie=>{v(we.value),x(ie.editor),i("onFocus",ie)},onBlur:ie=>i("onBlur",ie),parseOptions:{preserveWhitespace:"full"}}),be=o.computed(()=>r.mode===Me.REPORT||r.mode===Me.STRAIGHT||r.mode===Me.PLAIN_TEXT),Y=o.computed(()=>{const ie={height:"auto",minHeight:r.minHeight?rn(r.minHeight):void 0,maxHeight:r.maxHeight?rn(r.maxHeight):void 0,overflowY:"auto"},Ie={fontFamily:np(re,uc)&&T.value||r.fontFamilyDefault,fontSize:np(re,Qf)&&_.value||r.fontSizeDefault,...np(re,HC)&&(A.value||r.fontWeightDefault)?{fontWeight:A.value||r.fontWeightDefault}:{}};return C.value&&!r.autoHeight?{}:C.value&&r.autoHeight?ie:!C.value&&r.autoHeight?{...ie,...Ie}:Ie});o.watch(()=>[Y.value,r.disabled],async()=>{We()}),o.provide("minCharSuperInput",r.minChar.superPreview);const{contentInner:te,measuredMinWidth:ne,measure:oe}=df({minChars:r.minChar.content,fontSize:_,editor:re}),ce=o.ref(null),Ae=o.computed(()=>{var ie;return(ie=ce.value)==null?void 0:ie.measuredMinWidthComment});o.provide("measuredMinWidthComment",Ae);const Be=o.computed(()=>C.value?0:Bt.value?Number(ne==null?void 0:ne.value)+Number(Ae==null?void 0:Ae.value)+30:Number(ne==null?void 0:ne.value));async function We(){await o.nextTick(),s.emit({action:"render"})}function Ge(ie,Ie){if(!ie)return"";if(ie.isEmpty)return Ie==="json"?{}:"";if(r.mode===Me.PLAIN_TEXT)return ie.getText({blockSeparator:`
345
+ `).split(/\r?\n/),i=[];for(const a of r){const l=a.trim();if(l==="")i.push("<p></p>");else if(/^<br\s*\/?>/i.test(l)){const u=l.replace(/^<br\s*\/?>/i,"").trim();i.push(`<p>${u}</p>`)}else if(/^<\/BR>/i.test(l)){const u=l.replace(/^<\/BR>/i,"").trim();i.push(`<p>${u}</p>`)}else/^<(?!p\b)[^>]+>/i.test(l)?i.push(`<p>${l}</p>`):i.push(l)}let s=i.join("");return s=s.replace(/<p\b[^>]*>/gi,"<p>"),s},Uv=t=>/^https?:\/\/[^\s]+$/i.test(t.trim()),Wv=(t,e)=>{const{tr:n,selection:r,schema:i}=t.state,s=i.marks.link.create({href:e});return r.empty?(t.dispatch(n.insertText(e,r.from).addMark(r.from,r.from+e.length,s)),!0):(t.dispatch(n.addMark(r.from,r.to,s)),!0)},Nee=(t,e)=>{const{tr:n,schema:r}=t.state,i=e.split(/(?:\r\n?|\n)/),s=[];if(i.forEach(u=>{let c={type:"paragraph"};u.length>0&&(c.content=[{type:"text",text:u}]);let f=Dr.fromJSON(r,c);s.push(f)}),s.length===0)return!1;const a=ge.fromArray(s),l=Te.maxOpen(a);return t.dispatch(n.replaceSelection(l)),!0},ete=xn(),Dh=t=>{const e=o.computed(()=>ete.state.spellCheck);o.watch(()=>e.value,n=>{t.view.dispatch(t.state.tr.setMeta(qn.IS_ACTIVE_SPELLCHECK,n)),t.extensionStorage.spellchecker.spellchecker.hideSuggestionBox(),WC(t)&&t.commands.focus()},{immediate:!0})},tte={id:"editor-container-comment",class:"flex flex-col"},nte={class:"flex flex-1"},rte={id:"editor-panel",class:"flex-1 p-2.5 border border-ed-gray-400 rounded-[3px] focus-within:border-ed-input-focus"},ote=o.defineComponent({__name:"EditorComment",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{},fontFamilyDefault:{},fontWeightDefault:{},contentTextStyle:{},isOpenSuperView:{type:Boolean,default:!0},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:600},maxHeight:{default:void 0},height:{},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},customClassToolbar:{},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean},superPreviewCustomClass:{default:void 0},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{type:Boolean},editorContentInstance:{},toolbarExtensionOrder:{},watermarkOverlay:{},bottomOffset:{},characterCountLimit:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=Ne.useEventBus(fr.RENDER_SUPER_TEXT),a=o.useAttrs(),l=xn(),{isReady:u,editor:c,updateEditorState:f,superTextStore:p,checkSpellStore:m,setEditorContextMenuRef:g,setEditorFocusedInstance:b}=l,v=o.inject("isEditable",o.ref(!0)),y=new Lo({enablePasteRules:!1,enableInputRules:!1,content:bn(r.modelValue,r.disabled),editorProps:{attributes:{id:lr.COMMENT,[lr.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:kt.throttle((T,A)=>A.key==="Enter"&&a.enter&&!A.shiftKey?(i("enter"),!0):!1,Vo),transformPastedHTML:T=>nS(T),handlePaste:(T,A)=>{const D=A.clipboardData;if(!D)return!1;const O=r.mode,M=D.getData("text/plain")||"",$=Array.from(D.items).some(V=>V.type.startsWith("image/"));return(O===Me.STRAIGHT||O===Me.REPORT)&&$?(A.preventDefault(),!0):O===Me.PLAIN_TEXT?(A.preventDefault(),T.dispatch(T.state.tr.insertText(M,T.state.selection.from)),!0):!1},clipboardTextParser:(T,A)=>{const D=T.split(/(?:\r\n?|\n)/),O=[];D.forEach($=>{let V={type:"paragraph"};$.length>0&&(V.content=[{type:"text",text:$}]);let G=Dr.fromJSON(A.doc.type.schema,V);O.push(G)});const M=ge.fromArray(O);return Te.maxOpen(M)}},onCreate:({editor:T})=>{f(T)},onUpdate:kt.throttle(({editor:T})=>{u.value=!0;const A=E(T,r.output);i("update:modelValue",A),i("change",{editor:T,output:A}),f(T),x()},Vo),extensions:r.extensions,editable:v.value,onFocus:T=>{g(k.value),b(T.editor)}});async function x(){await o.nextTick(),s.emit({action:"render"})}function E(T,A){if(!T)return"";if(T.isEmpty)return A==="json"?{}:"";switch(A){case"html":return T.getHTML();case"json":return T.getJSON();case"text":return T.getText();default:return""}}o.watch(()=>r.disableSuperInput,()=>{const T=document.getElementById(lr.COMMENT);T==null||T.setAttribute(lr.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),o.watch(()=>m.languages,()=>{y.commands.checkSpelling()}),o.watch(()=>r.modelValue,T=>{if(!y||kt.isEqual(E(y,r.output),T))return;const{from:A,to:D}=y.state.selection;y.commands.setTextSelection({from:A,to:D}),y.commands.setContent(bn(T,r.disabled),!1),x()},{deep:!0}),o.watch(()=>v.value,T=>{var A;y==null||y.setEditable(T),(A=y==null?void 0:y.commands)!=null&&A.setIsEnableSuggestion&&y.commands.setIsEnableSuggestion(T)},{immediate:!0}),o.watch(()=>c.value,()=>{c.value&&c.value.on("selectionUpdate",({editor:T})=>{i("changed:selection",{editor:T})})}),o.onUnmounted(()=>y==null?void 0:y.destroy()),wc(ju.SAVE,()=>{localStorage.setItem("comment",E(y,"html"))});const k=o.ref(null);function C(T){T===Me.REPORT&&g(k.value)}function _(T){T===Me.REPORT&&b(y)}return o.onMounted(()=>{C(r.mode),_(r.mode)}),o.watch(()=>r.mode,T=>{C(T),_(T)}),o.watch(()=>{var T,A;return(A=(T=r.editorContentInstance)==null?void 0:T.storage[ep])==null?void 0:A.enabled},()=>{y.commands.toggleTimeHighlight()}),Dh(y),e({editor:y}),(T,A)=>(o.openBlock(),o.createElementBlock("div",tte,[o.createElementVNode("div",nte,[o.withDirectives(o.createVNode(Qee,{"disable-super-input":T.disableSuperInput,editor:o.unref(y),"super-preview-custom-class":T.superPreviewCustomClass},null,8,["disable-super-input","editor","super-preview-custom-class"]),[[o.vShow,T.isOpenSuperView]]),o.createElementVNode("div",rte,[o.createVNode(kv,{ref_key:"selectContextMenuRef",ref:k,"disable-super-input":T.disableSuperInput,editor:o.unref(y),mode:T.mode,"super-text-store":o.unref(p)},{default:o.withCtx(()=>[o.createVNode(o.unref(Qn),{editor:o.unref(y),spellcheck:"true",class:"h-full break-all"},null,8,["editor"])]),_:1},8,["disable-super-input","editor","mode","super-text-store"])])])]))}});function ite(t,e,n=!1,r=200){const{height:i}=Ne.useElementSize(t),s=o.ref(0),a=o.ref(0),l=o.ref(r),u=o.ref(0),c=async()=>{await o.nextTick();const f=i.value-8;e.value===Me.REPORT?(s.value=f/3,a.value=n?"auto":f-s.value,l.value=r/3*2,u.value=r/3):(s.value=0,a.value=n?"auto":i.value)};return n||o.watch(()=>i.value,c),o.onMounted(()=>{c()}),{commentHeight:s,contentHeight:a,minHeight:l,minHeightComment:u}}var ste={exports:{}};(function(t){(function(){var e=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],n=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ",["ㅗ","ㅏ"],["ㅗ","ㅐ"],["ㅗ","ㅣ"],"ㅛ","ㅜ",["ㅜ","ㅓ"],["ㅜ","ㅔ"],["ㅜ","ㅣ"],"ㅠ","ㅡ",["ㅡ","ㅣ"],"ㅣ"],r=["","ㄱ","ㄲ",["ㄱ","ㅅ"],"ㄴ",["ㄴ","ㅈ"],["ㄴ","ㅎ"],"ㄷ","ㄹ",["ㄹ","ㄱ"],["ㄹ","ㅁ"],["ㄹ","ㅂ"],["ㄹ","ㅅ"],["ㄹ","ㅌ"],["ㄹ","ㅍ"],["ㄹ","ㅎ"],"ㅁ","ㅂ",["ㅂ","ㅅ"],"ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],i=44032,s=["ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄸ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅃ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],a=["ㄱ","ㄲ","ㄴ","ㄷ","ㄸ","ㄹ","ㅁ","ㅂ","ㅃ","ㅅ","ㅆ","ㅇ","ㅈ","ㅉ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],l=["ㅏ","ㅐ","ㅑ","ㅒ","ㅓ","ㅔ","ㅕ","ㅖ","ㅗ","ㅘ","ㅙ","ㅚ","ㅛ","ㅜ","ㅝ","ㅞ","ㅟ","ㅠ","ㅡ","ㅢ","ㅣ"],u=["","ㄱ","ㄲ","ㄳ","ㄴ","ㄵ","ㄶ","ㄷ","ㄹ","ㄺ","ㄻ","ㄼ","ㄽ","ㄾ","ㄿ","ㅀ","ㅁ","ㅂ","ㅄ","ㅅ","ㅆ","ㅇ","ㅈ","ㅊ","ㅋ","ㅌ","ㅍ","ㅎ"],c=[["ㄱ","ㅅ","ㄳ"],["ㄴ","ㅈ","ㄵ"],["ㄴ","ㅎ","ㄶ"],["ㄹ","ㄱ","ㄺ"],["ㄹ","ㅁ","ㄻ"],["ㄹ","ㅂ","ㄼ"],["ㄹ","ㅅ","ㄽ"],["ㄹ","ㅌ","ㄾ"],["ㄹ","ㅍ","ㄿ"],["ㄹ","ㅎ","ㅀ"],["ㅂ","ㅅ","ㅄ"]],f=[["ㅗ","ㅏ","ㅘ"],["ㅗ","ㅐ","ㅙ"],["ㅗ","ㅣ","ㅚ"],["ㅜ","ㅓ","ㅝ"],["ㅜ","ㅔ","ㅞ"],["ㅜ","ㅣ","ㅟ"],["ㅡ","ㅣ","ㅢ"]],p,m,g,b,v,y;function x(L){for(var q=L.length,X={0:0},le=0;le<q;le++)L[le]&&(X[L[le].charCodeAt(0)]=le);return X}p=x(s),m=x(a),g=x(l),b=x(u);function E(L){for(var q=L.length,X={},le,pe,_e=0;_e<q;_e++)le=L[_e][0].charCodeAt(0),pe=L[_e][1].charCodeAt(0),typeof X[le]>"u"&&(X[le]={}),X[le][pe]=L[_e][2].charCodeAt(0);return X}v=E(c),y=E(f);function k(L){return typeof p[L]<"u"}function C(L){return typeof m[L]<"u"}function _(L){return typeof g[L]<"u"}function T(L){return typeof b[L]<"u"}function A(L){return 44032<=L&&L<=55203}function D(L,q){return y[L]&&y[L][q]?y[L][q]:!1}function O(L,q){return v[L]&&v[L][q]?v[L][q]:!1}var M=function(L,q){if(L===null)throw new Error("Arguments cannot be null");typeof L=="object"&&(L=L.join(""));for(var X=[],le=L.length,pe,_e,re,be,Y,te=0;te<le;te++){var ne=[];be=L.charCodeAt(te),A(be)?(be-=i,re=be%28,_e=(be-re)/28%21,pe=parseInt((be-re)/28/21),ne.push(e[pe]),typeof n[_e]=="object"?ne=ne.concat(n[_e]):ne.push(n[_e]),re>0&&(typeof r[re]=="object"?ne=ne.concat(r[re]):ne.push(r[re]))):k(be)?(C(be)?Y=e[m[be]]:Y=r[b[be]],typeof Y=="string"?ne.push(Y):ne=ne.concat(Y)):_(be)?(Y=n[g[be]],typeof Y=="string"?ne.push(Y):ne=ne.concat(Y)):ne.push(L.charAt(te)),q?X.push(ne):X=X.concat(ne)}return X},$=function(L){return typeof L!="string"?"":(L=M(L),L.join(""))},V=function(L){typeof L=="string"&&(L=M(L));var q=[],X=L.length,le,pe=0,_e=-1,re,be=!1;function Y(ne){var oe,ce,Ae,Be=0,We,Ge="";if(be=!1,!(_e+1>ne))for(var Ke=1;;Ke++){if(Ke===1){if(oe=L[_e+Ke].charCodeAt(0),_(oe))if(_e+Ke+1<=ne&&_(ce=L[_e+Ke+1].charCodeAt(0))){q.push(String.fromCharCode(D(oe,ce))),_e=ne;return}else{q.push(L[_e+Ke]),_e=ne;return}else if(!C(oe)){q.push(L[_e+Ke]),_e=ne;return}Ge=L[_e+Ke]}else if(Ke===2)if(ce=L[_e+Ke].charCodeAt(0),C(ce)){oe=O(oe,ce),Ge=String.fromCharCode(oe),q.push(Ge),_e=ne;return}else Ge=String.fromCharCode((m[oe]*21+g[ce])*28+i);else Ke===3?(Ae=L[_e+Ke].charCodeAt(0),D(ce,Ae)?ce=D(ce,Ae):Be=Ae,Ge=String.fromCharCode((m[oe]*21+g[ce])*28+b[Be]+i)):Ke===4?(We=L[_e+Ke].charCodeAt(0),O(Be,We)?Be=O(Be,We):Be=We,Ge=String.fromCharCode((m[oe]*21+g[ce])*28+b[Be]+i)):Ke===5&&(We=L[_e+Ke].charCodeAt(0),Be=O(Be,We),Ge=String.fromCharCode((m[oe]*21+g[ce])*28+b[Be]+i));if(_e+Ke>=ne){q.push(Ge),_e=ne;return}}}for(var te=0;te<X;te++){if(le=L[te].charCodeAt(0),!C(le)&&!_(le)&&!T(le)){Y(te-1),Y(te),pe=0;continue}pe===0?C(le)?pe=1:_(le)&&(pe=4):pe==1?_(le)?pe=2:O(re,le)?pe=5:Y(te-1):pe==2?T(le)?pe=3:_(le)?D(re,le)||(Y(te-1),pe=4):(Y(te-1),pe=1):pe==3?T(le)?!be&&O(re,le)?be=!0:(Y(te-1),pe=1):C(le)?(Y(te-1),pe=1):_(le)&&(Y(te-2),pe=2):pe==4?_(le)?D(re,le)?(Y(te),pe=0):Y(te-1):(Y(te-1),pe=1):pe==5&&(_(le)?(Y(te-2),pe=2):(Y(te-1),pe=1)),re=le}return Y(te-1),q.join("")},G=function(L,q){var X=M(L).join(""),le=M(q).join("");return X.indexOf(le)},ee=function(L,q){var X=M(L).join(""),le=M(q).join(""),pe=M(L,!0),_e=new RegExp(le,"gi"),re=[],be;if(!q.length)return[];for(;be=_e.exec(X);)re.push(be.index);function Y(ne){for(var oe=0,ce=0;oe<pe.length;++oe)if(ce+=pe[oe].length,ne<ce)return oe}function te(ne){for(var oe=0,ce=0;oe<pe.length;++oe)if(ce+=pe[oe].length,ne+le.length<=ce)return oe}return re.map(function(ne){return[Y(ne),te(ne)]})};function W(L){this.string=L,this.disassembled=M(L).join("")}W.prototype.search=function(L){return M(L).join("").indexOf(this.disassembled)};var F=function(L){typeof L=="object"&&(L=L.join(""));var q=L.charCodeAt(L.length-1);if(A(q)){q-=i;var X=q%28;if(X>0)return!0}else if(k(q))return!0;return!1},R=function(L,q){return M(L).pop()===q},H={disassemble:M,d:M,disassembleToString:$,ds:$,assemble:V,a:V,search:G,rangeSearch:ee,Searcher:W,endsWithConsonant:F,endsWith:R,isHangul:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),A(L)},isComplete:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),A(L)},isConsonant:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),k(L)},isVowel:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),_(L)},isCho:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),C(L)},isJong:function(L){return typeof L=="string"&&(L=L.charCodeAt(0)),T(L)},isHangulAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!A(L.charCodeAt(q)))return!1;return!0},isCompleteAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!A(L.charCodeAt(q)))return!1;return!0},isConsonantAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!k(L.charCodeAt(q)))return!1;return!0},isVowelAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!_(L.charCodeAt(q)))return!1;return!0},isChoAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!C(L.charCodeAt(q)))return!1;return!0},isJongAll:function(L){if(typeof L!="string")return!1;for(var q=0;q<L.length;q++)if(!T(L.charCodeAt(q)))return!1;return!0}};t.exports=H})()})(ste);const Yl=new Et("searchHighlight");function Ph(t,e,n){const r=[];if(!e)return r;const i=n.caseSensitive?e.normalize("NFC"):e.normalize("NFC").toLowerCase(),{doc:s}=t.state,a=l=>/[0-9A-Za-z가-힣_]/.test(l);return s.descendants((l,u)=>{if(!l.isText||!l.text)return;let c=l.text.normalize("NFC");n.caseSensitive||(c=c.toLowerCase());let f=0,p=c.indexOf(i,f);for(;p!==-1;){const m=p,g=p+i.length-1;if(n.wholeWord){const b=m>0?c[m-1]:"",v=g+1<c.length?c[g+1]:"";if(b&&a(b)||v&&a(v)){f=p+1,p=c.indexOf(i,f);continue}}r.push({from:u+m,to:u+g+1}),f=p+i.length,p=c.indexOf(i,f)}}),r}function jv(t){return t.state.selection.from}function rS(t){if(t.state.plugins.find(r=>r.spec.key===Yl))return;const n=new nt({key:Yl,state:{init(){return ut.empty},apply(r,i){const s=r.getMeta(Yl);return s!==void 0?s:i.map(r.mapping,r.doc)}},props:{decorations(r){return Yl.getState(r)}}});t.registerPlugin(n)}function oS(t,e,n){rS(t);const r=e.map((a,l)=>qt.inline(a.from,a.to,{class:l===n?"search-match-active":"search-match"})),i=ut.create(t.state.doc,r),s=t.state.tr.setMeta(Yl,i);t.view.dispatch(s)}function Jl(t){rS(t);const e=t.state.tr.setMeta(Yl,ut.empty);t.view.dispatch(e)}function ate(t){const e=o.ref(-1),n=o.ref([]),r=o.computed(()=>n.value.length);function i(p){var x;const m=t.value;if(!m||n.value.length===0)return;const g=n.value.length;e.value=(p%g+g)%g,oS(m,n.value,e.value);const b=n.value[e.value],y=m.view.domAtPos(b.from).node;(x=y==null?void 0:y.scrollIntoView)==null||x.call(y,{block:"nearest",behavior:"smooth"}),m.chain().setTextSelection({from:b.from,to:b.to}).scrollIntoView().run()}function s(p){const m=t.value;if(!m)return;if(n.value=Ph(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=jv(m),b=n.value.findIndex(v=>v.from>g);i(b===-1?0:b)}function a(p){const m=t.value;if(!m)return;if(n.value=Ph(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=jv(m);let b=-1;for(let v=n.value.length-1;v>=0;v--)if(n.value[v].to<g){b=v;break}i(b===-1?n.value.length-1:b)}function l(p){const m=t.value;if(!m||e.value===-1||n.value.length===0)return;const g=n.value[e.value],{state:b}=m,v=b.doc.textBetween(g.from,g.to);if(!(p.caseSensitive?v===p.find:v.toLowerCase()===p.find.toLowerCase())){s(p);return}m.chain().focus().setTextSelection({from:g.from,to:g.to}).insertContent(p.replace).run(),s(p)}function u(p){const m=t.value;if(!m)return;const g=Ph(m,p.find,p);if(g.length===0)return;const b=m.chain().focus();[...g].reverse().forEach(v=>{b.setTextSelection({from:v.from,to:v.to}).insertContent(p.replace)}),b.run(),n.value=[],e.value=-1,Jl(m)}function c(p){const m=t.value;if(!m)return;if(!p.find){n.value=[],e.value=-1,Jl(m);return}if(n.value=Ph(m,p.find,p),n.value.length===0){e.value=-1,Jl(m);return}const g=jv(m),b=n.value.findIndex(y=>y.from>=g),v=b===-1?0:b;e.value=v,i(v),oS(m,n.value,v)}function f(){const p=t.value;p&&(n.value=[],e.value=-1,Jl(p))}return{searchUp:a,searchDown:s,replaceCurrent:l,replaceAll:u,totalMatches:r,currentMatchIndex:o.readonly(e),refreshMatches:c,clearSearch:f}}const iS=o.defineComponent({__name:"Checkbox",props:{defaultChecked:{type:Boolean},checked:{type:[Boolean,String]},disabled:{type:Boolean},required:{type:Boolean},name:{},value:{},id:{},asChild:{type:Boolean},as:{},class:{}},emits:["update:checked"],setup(t,{emit:e}){const n=t,r=e,i=o.computed(()=>{const{class:a,...l}=n;return l}),s=Dt(i,r);return(a,l)=>(o.openBlock(),o.createBlock(o.unref(LD),o.mergeProps(o.unref(s),{class:o.unref(Se)("peer h-5 w-5 shrink-0 rounded-sm border border-ed-border shadow focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ed-ring disabled:cursor-not-allowed disabled:opacity-50 text-ed-blue",n.class)}),{default:o.withCtx(()=>[o.createVNode(o.unref(DD),{class:"flex h-full w-full items-center justify-center"},{default:o.withCtx(()=>[o.renderSlot(a.$slots,"default",{},()=>[o.createVNode(o.unref(Gg),{icon:"fa-solid:check"})])]),_:3})]),_:3},16,["class"]))}}),lte={class:"flex items-center justify-between px-5 pt-4 pb-2 cursor-move bg-[#F6FAFE]"},ute={class:"text-base font-semibold text-gray-800"},cte={class:"px-5 pt-[20px] pb-4 flex flex-col gap-y-3 bg-white"},dte={class:"grid grid-cols-[60px,1fr] gap-x-3 items-center"},fte={class:"text-right text-sm text-gray-600"},pte={class:"relative"},hte={key:0,class:"absolute right-3 top-1/2 -translate-y-1/2 text-xs text-gray-400 pointer-events-none"},mte={class:"grid grid-cols-[60px,1fr] gap-x-3 items-center"},gte={class:"text-right text-sm text-gray-600"},bte={class:"grid grid-cols-[60px,1fr] gap-x-3"},vte={class:"flex gap-x-5"},yte={class:"flex items-center space-x-2 text-sm"},wte={for:"caseSensitive",class:"select-none text-gray-700"},xte={class:"grid grid-cols-[60px,1fr] gap-x-3"},Cte={class:"flex gap-x-2"},Ete=uo(o.defineComponent({__name:"BatchReplaceDialog",props:{modelValue:{type:Boolean},totalMatches:{default:0},currentMatchIndex:{default:-1}},emits:["update:modelValue","search-down","search-up","replace","replace-all","refresh"],setup(t,{emit:e}){const n=t,r=e;function i(){return{find:s.value,replace:a.value,caseSensitive:u.value,wholeWord:c.value}}const s=o.ref(""),a=o.ref(""),l=o.ref(null),u=o.ref(!1),c=o.ref(!1),f=o.computed(()=>s.value?n.totalMatches===0?"No matches":`${n.currentMatchIndex+1} / ${n.totalMatches}`:""),p=Ne.useLocalStorage("findReplaceDialogPosition",null),m=o.reactive({x:0,y:0}),g=o.ref(!1),b={x:0,y:0},v=O=>{const M=O.target;if(M.closest("input")||M.closest("button")||M.closest("label")||M.closest(".content-area"))return;g.value=!0;const $=document.querySelector(".find-replace-dialog");if(!$)return;const V=$.getBoundingClientRect();b.x=O.clientX-V.left,b.y=O.clientY-V.top,document.addEventListener("mousemove",y),document.addEventListener("mouseup",x)},y=O=>{g.value&&(m.x=O.clientX-b.x,m.y=O.clientY-b.y)},x=()=>{g.value=!1,p.value={x:m.x,y:m.y},document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",x)};o.onUnmounted(()=>{document.removeEventListener("mousemove",y),document.removeEventListener("mouseup",x)}),o.watch(()=>n.modelValue,async O=>{var G,ee;if(!O)return;await o.nextTick();const M=document.querySelector(".find-replace-dialog");if(!M)return;const $=window.innerWidth,V=window.innerHeight;p.value&&p.value.x!==void 0&&p.value.y!==void 0?(m.x=p.value.x,m.y=p.value.y):(m.x=Math.max(($-M.offsetWidth)/2,0),m.y=Math.max((V-M.offsetHeight)/2,0)),s.value&&r("refresh",i()),await o.nextTick(),(ee=(G=l.value)==null?void 0:G.$el)==null||ee.focus()});const E=()=>{r("update:modelValue",!1)},k=()=>{s.value&&r("search-down",i())},C=()=>{s.value&&r("search-up",i())},_=()=>{r("replace",{find:s.value,replace:a.value,caseSensitive:u.value,wholeWord:c.value})},T=()=>{r("replace-all",{find:s.value,replace:a.value,caseSensitive:u.value,wholeWord:c.value})};function A(O){const M=O.target.value;s.value=M,r("refresh",i())}function D(O){const $=O.target.value+(O.data??"");r("refresh",{find:$,replace:a.value,caseSensitive:u.value,wholeWord:c.value})}return(O,M)=>{const $=hs,V=iS,G=vn,ee=Vc,W=Pc;return o.openBlock(),o.createBlock(W,{open:O.modelValue},{default:o.withCtx(()=>[o.createVNode(ee,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none max-w-max","as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"find-replace-dialog fixed z-[70] pointer-events-auto w-[460px] rounded-[10px] overflow-hidden bg-white shadow-xl",style:o.normalizeStyle({top:"0px",left:"0px",transform:`translate(${m.x}px, ${m.y}px)`}),onMousedown:v},[o.createElementVNode("div",lte,[o.createElementVNode("span",ute,o.toDisplayString(O.$t("찾기 및 바꾸기")),1),o.createElementVNode("button",{class:"bg-transparent text-gray-400 hover:text-gray-600 transition-colors p-1",onClick:E},[o.createVNode(o.unref(kc),{class:"w-5 h-5"})])]),o.createElementVNode("div",cte,[o.createElementVNode("div",dte,[o.createElementVNode("label",fte,o.toDisplayString(O.$t("검색")),1),o.createElementVNode("div",pte,[o.createVNode($,{ref_key:"findInputRef",ref:l,modelValue:s.value,"onUpdate:modelValue":M[0]||(M[0]=F=>s.value=F),class:"rounded-md h-[36px] text-sm pr-[90px] !border-gray-300 focus:!border-blue-500 focus:!ring-0 outline-none",onInput:A,onCompositionupdate:D,onKeydown:o.withKeys(o.withModifiers(k,["prevent"]),["enter"])},null,8,["modelValue","onKeydown"]),o.unref(f)?(o.openBlock(),o.createElementBlock("span",hte,o.toDisplayString(o.unref(f)),1)):o.createCommentVNode("",!0)])]),o.createElementVNode("div",mte,[o.createElementVNode("label",gte,o.toDisplayString(O.$t("바꾸기")),1),o.createVNode($,{modelValue:a.value,"onUpdate:modelValue":M[1]||(M[1]=F=>a.value=F),class:"rounded-md h-[36px] text-sm !border-gray-300 focus:!border-blue-500 focus:!ring-0 outline-none"},null,8,["modelValue"])]),o.createElementVNode("div",bte,[M[3]||(M[3]=o.createElementVNode("div",null,null,-1)),o.createElementVNode("div",vte,[o.createElementVNode("div",yte,[o.createVNode(V,{id:"caseSensitive",checked:u.value,"onUpdate:checked":M[2]||(M[2]=F=>{u.value=!!F})},null,8,["checked"]),o.createElementVNode("label",wte,o.toDisplayString(O.$t("대소문자 일치")),1)])])]),o.createElementVNode("div",xte,[M[4]||(M[4]=o.createElementVNode("div",null,null,-1)),o.createElementVNode("div",Cte,[o.createVNode(G,{variant:"outline",class:"h-[36px] text-sm flex-1 rounded-md border-blue-500 text-blue-600 hover:bg-blue-50",onClick:_},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("바꾸기")),1)]),_:1}),o.createVNode(G,{variant:"outline",class:"h-[36px] text-sm flex-1 rounded-md border-blue-500 text-blue-600 hover:bg-blue-50",onClick:T},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("모두 바꾸기")),1)]),_:1}),o.createVNode(G,{class:"h-[36px] text-sm flex-1 rounded-md bg-blue-500 hover:bg-blue-600",disabled:!s.value,onClick:C},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("이전")),1)]),_:1},8,["disabled"]),o.createVNode(G,{class:"h-[36px] text-sm flex-1 rounded-md bg-blue-500 hover:bg-blue-600",disabled:!s.value,onClick:k},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(O.$t("다음")),1)]),_:1},8,["disabled"])])])])],36)]),_:1})]),_:1},8,["open"])}}}),[["__scopeId","data-v-5ec84714"]]),kte={class:"flex flex-1"},Vh=o.defineComponent({__name:"CoreEditorV2",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{default:""},commentCuesheet:{default:""},hideComment:{type:Boolean,default:!1},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{default:"14px"},fontFamilyDefault:{default:"NanumGothicCoding"},fontWeightDefault:{default:void 0},contentTextStyle:{},isOpenSuperView:{type:Boolean},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{default:null},fieldNameCommentCuesheet:{default:null},fieldNameContent:{default:null},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:200},maxHeight:{default:void 0},height:{default:void 0},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean,default:!1},textAlert:{},customClassToolbar:{default:""},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean,default:!1},autoFocus:{type:Boolean},superPreviewCustomClass:{default:()=>({overall:"bg-ed-gray-50",unproducedSuper:"bg-red-500",completedSuper:"bg-black"})},minChar:{default:()=>({superPreview:29,content:26})},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{type:Boolean},editorContentInstance:{},toolbarExtensionOrder:{default:void 0},watermarkOverlay:{},bottomOffset:{},characterCountLimit:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur","open-batch-replace"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=Ne.useEventBus(fr.RENDER_SUPER_TEXT),a=Ne.useEventBus(fr.INCREASE_DECREASE_FONTSIZE),l=o.useAttrs(),u=xn(),{isFullscreen:c,isReady:f,editor:p,updateEditorState:m,superTextStore:g,checkSpellStore:b,setEditorContextMenuRef:v,setEditorContentInstance:y,setEditorFocusedInstance:x}=u,E=o.computed(()=>!(r.disabled||r.readonly));o.provide("isEditable",E);const k=o.computed(()=>E.value?!0:r.canEditSuperReadOnly);o.provide("canEditSuper",k);const C=o.computed(()=>r.mode===Me.EDITOR),_=o.ref(r.fontSizeDefault),T=o.ref(r.fontFamilyDefault),A=o.ref(r.fontWeightDefault);o.provide("fontSize",_),o.provide("fontFamily",T),o.provide("fontWeight",A);const D=ie=>{!E.value||!((ie.ctrlKey||ie.metaKey)&&ie.key.toLowerCase()==="h")||(ie.preventDefault(),ie.stopPropagation(),ie.stopImmediatePropagation(),$.value=!0)};o.onMounted(()=>{We(),window.addEventListener("keydown",D,!0)}),o.onUnmounted(()=>{window.removeEventListener("keydown",D,!0)}),o.onActivated(()=>{window.addEventListener("keydown",D,!0)}),o.onDeactivated(()=>{window.removeEventListener("keydown",D,!0)});const O=ie=>{const Ie=parseInt(_.value||"16px"),st=ie?Ie+2:Ie-2;_.value=st+"px"};o.onBeforeMount(()=>{r.disabled||a.on(O)}),o.onBeforeUnmount(()=>{r.disabled||a.off(O)});const M=o.computed(()=>({...o.unref(c)?{height:"100%"}:{minHeight:r.minHeight?rn(r.minHeight):void 0,maxHeight:r.maxHeight?rn(r.maxHeight):void 0,height:r.height?rn(r.height):void 0},maxWidth:rn(r.maxWidth),width:r.maxWidth?"100%":void 0,margin:r.maxWidth?"0 auto":void 0})),$=o.ref(!1),{searchUp:V,searchDown:G,replaceCurrent:ee,replaceAll:W,totalMatches:F,currentMatchIndex:R,refreshMatches:H,clearSearch:L}=ate(p);o.watch($,ie=>{ie||L()});const q=ie=>{H(ie)},X=ie=>{G(ie)},le=ie=>{V(ie)},pe=ie=>{ee(ie)},_e=ie=>{W(ie)},re=new Lo({enablePasteRules:!1,enableInputRules:!1,content:bn(r.modelValue,r.disabled,r.mode),editorProps:{handleKeyDown:kt.throttle((ie,Ie)=>Ie.key==="Enter"&&l.enter&&!Ie.shiftKey?(i("enter"),!0):!1,Vo),transformPastedHTML:ie=>r.mode===Me.EDITOR?nR(ie):nS(ie),handlePaste:(ie,Ie)=>{var ot;const st=Ie.clipboardData;if(!st)return!1;const Yt=r.mode,ae=Array.from(st.items),Le=ae.some(At=>At.type.startsWith("image/")),ze=ae.some(At=>At.type.startsWith("video/"));if((Yt===Me.STRAIGHT||Yt===Me.REPORT)&&(Le||ze))return Ie.preventDefault(),!0;if(ze)return Ie.preventDefault(),Ke(["video"])&&ae.forEach(async At=>{var Ts;if(!At.type.startsWith("video/"))return;const dn=At.getAsFile();if(!dn)return;const fn=re.extensionManager.extensions.find(As=>As.name==="video"),pr=(Ts=fn==null?void 0:fn.options)==null?void 0:Ts.upload,An=pr?await pr(dn):URL.createObjectURL(dn);re.commands.focus(),re.commands.setVideo({src:An})}),!0;const at=((ot=Ie.clipboardData)==null?void 0:ot.getData("text/plain"))||"";return r.mode===Me.EDITOR&&Uv(at)?(Ie.preventDefault(),Wv(ie,at.trim())):!1},clipboardTextParser:(ie,Ie)=>{const st=ie.split(/(?:\r\n?|\n)/),Yt=[];st.forEach(Le=>{let ze={type:"paragraph"};Le.length>0&&(ze.content=[{type:"text",text:Le}]);let at=Dr.fromJSON(Ie.doc.type.schema,ze);Yt.push(at)});const ae=ge.fromArray(Yt);return Te.maxOpen(ae)}},onCreate:({editor:ie})=>{m(ie)},onUpdate:kt.throttle(({editor:ie})=>{f.value=!0;const Ie=Ge(ie,r.output);i("update:modelValue",Ie),i("change",{editor:ie,output:Ie}),m(ie),o.nextTick(()=>{We()}),oe()},Vo),extensions:kt.uniqBy(qC(r.extensions,r),"name"),editable:E.value,onFocus:ie=>{v(we.value),x(ie.editor),i("onFocus",ie)},onBlur:ie=>i("onBlur",ie),parseOptions:{preserveWhitespace:"full"}}),be=o.computed(()=>r.mode===Me.REPORT||r.mode===Me.STRAIGHT||r.mode===Me.PLAIN_TEXT),Y=o.computed(()=>{const ie={height:"auto",minHeight:r.minHeight?rn(r.minHeight):void 0,maxHeight:r.maxHeight?rn(r.maxHeight):void 0,overflowY:"auto"},Ie={fontFamily:np(re,uc)&&T.value||r.fontFamilyDefault,fontSize:np(re,Qf)&&_.value||r.fontSizeDefault,...np(re,HC)&&(A.value||r.fontWeightDefault)?{fontWeight:A.value||r.fontWeightDefault}:{}};return C.value&&!r.autoHeight?{}:C.value&&r.autoHeight?ie:!C.value&&r.autoHeight?{...ie,...Ie}:Ie});o.watch(()=>[Y.value,r.disabled],async()=>{We()}),o.provide("minCharSuperInput",r.minChar.superPreview);const{contentInner:te,measuredMinWidth:ne,measure:oe}=df({minChars:r.minChar.content,fontSize:_,editor:re}),ce=o.ref(null),Ae=o.computed(()=>{var ie;return(ie=ce.value)==null?void 0:ie.measuredMinWidthComment});o.provide("measuredMinWidthComment",Ae);const Be=o.computed(()=>C.value?0:Bt.value?Number(ne==null?void 0:ne.value)+Number(Ae==null?void 0:Ae.value)+30:Number(ne==null?void 0:ne.value));async function We(){await o.nextTick(),s.emit({action:"render"})}function Ge(ie,Ie){if(!ie)return"";if(ie.isEmpty)return Ie==="json"?{}:"";if(r.mode===Me.PLAIN_TEXT)return ie.getText({blockSeparator:`
346
346
  `});switch(Ie){case"html":return h1(ie,{removeNodes:[sc,bi]});case"json":return ie.getJSON();case"text":return ie.getText({blockSeparator:`
347
347
  `});default:return""}}function Ke(ie){return ie.every(Ie=>re==null?void 0:re.extensionManager.extensions.find(st=>st.name===Ie))}o.watch(()=>b.languages,()=>{re.commands.checkSpelling()}),o.watch(()=>r.modelValue,ie=>{if(!re||kt.isEqual(Ge(re,r.output),ie))return;const{from:Ie,to:st}=re.state.selection;re.commands.setTextSelection({from:Ie,to:st}),re.commands.setContent(bn(ie,r.disabled,r.mode),!1,{preserveWhitespace:"full"}),We()},{deep:!0}),o.watch(()=>E.value,ie=>{var Ie;re==null||re.setEditable(ie),(Ie=re==null?void 0:re.commands)!=null&&Ie.setIsEnableSuggestion&&re.commands.setIsEnableSuggestion(ie)},{immediate:!0}),o.watch(()=>p.value,()=>{p.value&&p.value.on("selectionUpdate",({editor:ie})=>{i("changed:selection",{editor:ie})})}),o.onUnmounted(()=>re==null?void 0:re.destroy()),wc(ju.SAVE,()=>{localStorage.setItem("content",Ge(re,"html"))});const Bt=o.computed(()=>{var Yt;if(!((Yt=re==null?void 0:re.storage)!=null&&Yt.superText))return!1;const{enable:ie}=re.storage.superText,Ie=[Me.EDITOR,Me.PLAIN_TEXT].includes(r.mode),st=r.disabled;return ie&&!Ie&&!st}),j=o.ref(null),z=o.computed(()=>r.mode),{commentHeight:he,contentHeight:Ee,minHeight:$e,minHeightComment:Q}=ite(j,z,r.autoHeight,typeof r.minHeight=="string"?parseInt(r.minHeight):r.minHeight),we=o.ref(null);function N(ie){ie===Me.STRAIGHT&&v(we.value)}function me(ie){ie!==Me.REPORT&&x(re)}o.onMounted(()=>{N(r.mode),me(r.mode),y(re)}),o.watch(()=>r.mode,ie=>{N(ie),me(ie)});const de=o.ref(null),Ce=()=>{var Ie;(Ie=de.value)!=null&&Ie.editor.commands.focusInvalidChar()||re.commands.focusInvalidChar()};u.focusFirstInvalidChar.value=Ce,o.onActivated(()=>{u.focusFirstInvalidChar.value=Ce});const qe=o.computed(()=>{var Ie,st,Yt;const ie=((Ie=r.fieldNameComment)==null?void 0:Ie.label)||((st=r.fieldNameCommentCuesheet)==null?void 0:st.label)||((Yt=r.fieldNameContent)==null?void 0:Yt.label);return r.disabled&&ie});return e({editor:re}),(ie,Ie)=>{var ot;const st=Lh,Yt=Rh,ae=Ih,Le=C8,ze=mz,at=xR;return o.unref(re)?(o.openBlock(),o.createElementBlock("div",{key:0,id:"vdc-editor",class:o.normalizeClass(["vdc-editor w-full flex flex-col",[ie.editorClass,{"outline-ed-primary":o.unref(re).isFocused,"outline-ed-border":!o.unref(re).isFocused}]]),style:o.normalizeStyle(o.unref(M))},[!ie.hideBubble&&!ie.disabled&&o.unref(E)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[Ke([o.unref(ac)])?(o.openBlock(),o.createBlock(st,{key:0,editor:o.unref(re)},null,8,["editor"])):o.createCommentVNode("",!0),Ke([o.unref(ma)])?(o.openBlock(),o.createBlock(Yt,{key:1,editor:o.unref(re)},null,8,["editor"])):o.createCommentVNode("",!0),Ke([o.unref(ds)])?(o.openBlock(),o.createBlock(ae,{key:2,editor:o.unref(re)},null,8,["editor"])):o.createCommentVNode("",!0),Ke([o.unref(Il),o.unref(bi)])?(o.openBlock(),o.createBlock(Le,{key:3,editor:o.unref(re)},null,8,["editor"])):o.createCommentVNode("",!0)],64)):o.createCommentVNode("",!0),ie.hideToolbar?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(ze,{key:1,editor:o.unref(re),"editor-comment":(ot=o.unref(de))==null?void 0:ot.editor,mode:ie.mode,class:"mb-2","custom-class-toolbar":ie.customClassToolbar,"toolbar-extension-order":ie.toolbarExtensionOrder},null,8,["editor","editor-comment","mode","custom-class-toolbar","toolbar-extension-order"])),o.createElementVNode("div",{ref_key:"editorWrapRef",ref:j,class:o.normalizeClass(o.unref(Se)("space-y-2 flex-1 flex flex-col break-keep",o.unref(be)&&"[&_*]:!font-inherit",o.unref(be)&&"[&_*]:!text-font-size-inherit")),style:o.normalizeStyle(o.unref(Y))},[o.unref(qe)?(o.openBlock(),o.createBlock(at,{key:0,extensions:ie.extensions,mode:ie.mode,"hide-comment":ie.hideComment,"field-name-comment":ie.fieldNameComment,"field-name-comment-cuesheet":ie.fieldNameCommentCuesheet,"field-name-content":ie.fieldNameContent,comment:ie.comment,"comment-cuesheet":ie.commentCuesheet,content:ie.modelValue,"min-chars":ie.minChar.content,"font-size":o.unref(_)},null,8,["extensions","mode","hide-comment","field-name-comment","field-name-comment-cuesheet","field-name-content","comment","comment-cuesheet","content","min-chars","font-size"])):(o.openBlock(),o.createElementBlock("div",{key:1,class:"space-y-2 flex-1 flex flex-col",style:o.normalizeStyle({minWidth:`${o.unref(Be)}px`})},[ie.mode===o.unref(Me).REPORT&&!ie.hideComment?(o.openBlock(),o.createBlock(ote,{key:0,ref_key:"editorCommentRef",ref:de,mode:o.unref(Me).REPORT,extensions:ie.extensions,"model-value":r.comment,disabled:r.disabled,"disable-super-input":ie.disableSuperInput,"is-open-super-view":o.unref(Bt),"super-preview-custom-class":ie.superPreviewCustomClass,"min-char":ie.minChar,"font-size":o.unref(_),style:o.normalizeStyle(r.autoHeight?{height:"auto",minHeight:o.unref(rn)(o.unref(Q))}:{height:o.unref(rn)(o.unref(he)),minHeight:o.unref(rn)(o.unref($e))}),"editor-content-instance":o.unref(re),class:"relative overflow-y-auto","onUpdate:modelValue":Ie[0]||(Ie[0]=At=>i("update:comment",At))},null,8,["mode","extensions","model-value","disabled","disable-super-input","is-open-super-view","super-preview-custom-class","min-char","font-size","style","editor-content-instance"])):o.createCommentVNode("",!0),o.createElementVNode("div",{id:"editor-container",class:"relative overflow-y-auto flex flex-col",style:o.normalizeStyle(r.autoHeight?{height:"auto",minHeight:o.unref(rn)(o.unref($e))}:{height:o.unref(rn)(o.unref(Ee))})},[o.createElementVNode("div",kte,[o.withDirectives(o.createVNode(Yee,{ref_key:"superTextViewRef",ref:ce,editor:o.unref(re),"super-preview-custom-class":ie.superPreviewCustomClass,"min-chars":ie.minChar.superPreview,"font-size":o.unref(_)},null,8,["editor","super-preview-custom-class","min-chars","font-size"]),[[o.vShow,o.unref(Bt)]]),o.createElementVNode("div",{id:"editor-panel",ref_key:"contentInner",ref:te,class:"flex-1 p-2.5 border border-ed-gray-400 rounded-[3px] focus-within:border-ed-input-focus"},[o.createVNode(kv,{ref_key:"selectContextMenuRef",ref:we,editor:o.unref(re),mode:ie.mode,"super-text-store":o.unref(g)},{default:o.withCtx(()=>[o.createVNode(o.unref(Qn),{editor:o.unref(re),spellcheck:"true",class:o.normalizeClass(o.unref(Se)("h-full break-all",ie.mode===o.unref(Me).PLAIN_TEXT&&"plain-text"))},null,8,["editor","class"])]),_:1},8,["editor","mode","super-text-store"])],512)])],4)],4))],6),o.createVNode(Ete,{modelValue:o.unref($),"onUpdate:modelValue":Ie[1]||(Ie[1]=At=>o.isRef($)?$.value=At:null),"total-matches":o.unref(F),"current-match-index":o.unref(R),onSearchDown:X,onSearchUp:le,onReplace:pe,onReplaceAll:_e,onRefresh:q},null,8,["modelValue","total-matches","current-match-index"])],6)):o.createCommentVNode("",!0)}}}),Ste={class:"relative px-2.5"},_te={key:0,class:"w-12 rounded-tl-full rounded-bl-full pointer-events-none absolute inset-y-0 left-0 bg-white-fade-left z-10","aria-hidden":"true"},Tte={key:1,class:"w-12 rounded-tr-full rounded-br-full pointer-events-none absolute inset-y-0 right-0 bg-white-fade-right z-10","aria-hidden":"true"},Ate=o.defineComponent({__name:"ToolbarFormat",props:{editor:{},disabled:{type:Boolean,default:!1},mode:{},activeExtensions:{default:()=>[]},threshold:{default:5}},setup(t){const{t:e}=Tt(),n=t,r=[Yf,lc,vi,Nf],i=o.computed(()=>{const m=[...n.editor.extensionManager.extensions],g=jC(m,{[zC]:0});let b=[];for(const v of g){const{button:y,divider:x=!1,spacer:E=!1,toolbar:k=!0}=v.options;if(!y||!f1(y)||!k)continue;const C=y({editor:n.editor,extension:v,t:o.unref(e),isMobile:!0});if(Array.isArray(C)){const _=C.map((T,A)=>({id:`${v.name}`,button:T,divider:A===C.length-1?x:!1,spacer:A===0?E:!1,buttonName:T.buttonName}));b=[...b,..._];continue}b.push({button:C,divider:x,spacer:E,id:`${v.name}`})}return n.activeExtensions.length?b.filter(v=>v.id&&n.activeExtensions.includes(v.id)):(r.length&&(b=b.filter(v=>v.id&&!r.includes(v.id))),b=b.map(v=>{const y=["videoUpload","heading","strike","color","fontSize","fontFamily"],x=["redo"],E=b.some(_=>_.id==="imageUpload"),k=b.some(_=>_.id==="videoUpload");k||y.push("imageUpload"),!E&&!k&&y.push("link");const C=y.includes(v.id??"")||x.includes(v.buttonName??"");return{...v,separator:C}}),b)}),s=m=>m.id==="spellchecker"?"!text-ed-blue !bg-white !font-normal rounded [&>div>svg]:w-[19px] [&>div>svg]:h-[19px] h-[26px] gap-x-1 whitespace-nowrap":m.button.componentProps.customClass,a=m=>m.id==="spellchecker"?"Spellchecker":m.button.componentProps.icon,l=o.ref(null),u=o.ref(!1),c=o.ref(!1);function f(){const m=l.value;if(!m)return;const{scrollLeft:g,scrollWidth:b,clientWidth:v}=m;if(!(b>v+1)){u.value=!1,c.value=!1;return}const x=g<=n.threshold,E=g+v>=b-n.threshold;u.value=!x,c.value=!E}const p=Ne.useThrottleFn(f,10);return Ne.useEventListener(l,"scroll",p),Ne.useResizeObserver(l,p),Ne.useEventListener(window,"resize",p),(m,g)=>(o.openBlock(),o.createElementBlock("div",{id:"tool-bar-format",class:o.normalizeClass(o.unref(Se)("bg-white border border-gray-100 dark:bg-ed-gray-500 dark:border-ed-muted rounded-full shadow-elevation2",!i.value.length&&"hidden"))},[o.createElementVNode("div",Ste,[o.unref(u)?(o.openBlock(),o.createElementBlock("div",_te)):o.createCommentVNode("",!0),o.unref(c)?(o.openBlock(),o.createElementBlock("div",Tte)):o.createCommentVNode("",!0),o.createElementVNode("div",{ref_key:"scrollEl",ref:l,id:"tool-bar-format-scroll",class:"text-ed-gray-700 flex gap-2 items-center overflow-x-auto overflow-y-hidden min-h-11 scrollbar-hide overflow-scrolling-touch relative"},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,(b,v)=>{var y;return o.openBlock(),o.createElementBlock(o.Fragment,{key:v},[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(b.button.component),o.mergeProps({id:b.id,ref_for:!0},b.button.componentProps,{editor:m.editor,disabled:m.disabled||((y=b.button.componentProps)==null?void 0:y.disabled),"custom-class":s(b),icon:a(b)}),o.createSlots({_:2},[o.renderList(b.button.componentSlots,(x,E,k)=>({name:`${E}`,fn:o.withCtx(C=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(x),o.mergeProps({ref_for:!0},C==null?void 0:C.props,{id:b.id}),null,16,["id"]))])}))]),1040,["id","editor","disabled","custom-class","icon"])),b.separator?(o.openBlock(),o.createBlock(o.unref(mo),{key:0,orientation:"vertical",class:"h-5"})):o.createCommentVNode("",!0)],64)}),128))],512)])],2))}}),Mte={class:"relative px-2.5"},Ote={key:0,class:"w-12 rounded-tl-full rounded-bl-full pointer-events-none absolute inset-y-0 left-0 bg-white-fade-left z-10","aria-hidden":"true"},Bte={key:1,class:"w-12 rounded-tr-full rounded-br-full pointer-events-none absolute inset-y-0 right-0 bg-white-fade-right z-10","aria-hidden":"true"},Ite={class:"flex items-center gap-2"},Rte={class:"mt-3"},Lte=o.defineComponent({__name:"ToolbarImage",props:{editor:{},disabled:{type:Boolean,default:!1},threshold:{default:10}},setup(t){const e=t,{t:n}=Tt(),r=o.ref("100"),i=o.ref(),s=o.ref(),a=o.ref(),l=["left","center","right"],u={left:"AlignLeft",center:"AlignCenter",right:"AlignRight"};function c(G){G==null||G.preventDefault(),e.editor.getAttributes("image").src&&(e.editor.commands.updateImage({width:i.value?`${i.value}px`:null}),cf())}function f(G){const ee=Math.max(0,Math.min(100,parseInt(r.value)));e.editor.commands.updateImage({width:`${ee}%`}),cf()}function p(G){e.editor.commands.updateAttributes("image",{textAlign:G})}o.watch(r,()=>{r.value&&f()}),o.watch(()=>e.editor.getAttributes("image"),G=>{G&&(i.value=Math.round(parseFloat(G.originWidth)),s.value=Math.round(parseFloat(G.originHeight)),a.value=G.originWidth/G.originHeight)});function m(){s.value&&a.value?i.value=Math.max(30,Math.round(s.value*a.value)):i.value=null}function g(){i.value&&a.value?s.value=Math.max(20,Math.round(i.value/a.value)):s.value=null}function b(G){p(G)}function v(){const G=e.editor.getAttributes("image"),{flipX:ee}=G;e.editor.commands.updateImage({flipX:!ee})}function y(){const G=e.editor.getAttributes("image"),{flipY:ee}=G;e.editor.commands.updateImage({flipY:!ee})}function x(){const{state:G,dispatch:ee}=e.editor.view;ol(G,ee)}function E(){const{state:G,dispatch:ee}=e.editor.view,{tr:W,selection:F}=G;if(!(F instanceof Ve))return;const R=F.from,H=G.doc.nodeAt(R);if(!H)return;const q=G.doc.resolve(R).nodeBefore;if(!q)return;const X=R-q.nodeSize,le=W.delete(R,R+H.nodeSize).insert(X,H).setSelection(Ve.create(W.doc,X));ee(le)}function k(){const{state:G,dispatch:ee}=e.editor.view,{tr:W,doc:F,selection:R}=G;if(!(R instanceof Ve))return;const H=R.from,L=F.nodeAt(H);if(!L)return;const q=H+L.nodeSize;if(q>=F.content.size)return;const X=F.nodeAt(q);if(!X)return;const le=q+X.nodeSize-L.nodeSize,pe=H+X.nodeSize,_e=W.delete(H,H+L.nodeSize).insert(le,L).setSelection(Ve.create(W.doc,pe));ee(_e)}const C=o.ref(null),_=o.ref(!1),T=o.ref(!1);function A(){const G=C.value;if(!G)return;const{scrollLeft:ee,scrollWidth:W,clientWidth:F}=G;if(!(W>F+1)){_.value=!1,T.value=!1;return}const H=ee<=e.threshold,L=ee+F>=W-e.threshold;_.value=!H,T.value=!L}const D=Ne.useThrottleFn(A,10);Ne.useEventListener(C,"scroll",D),Ne.useResizeObserver(C,D),Ne.useEventListener(window,"resize",D);const O=o.inject("isMobile",!1),M=`dropdown-trigger-${Xr(10)}`,{isOpen:$}=yp({scrollEl:"tool-bar-image-scroll",ignoreSelector:`[data-radix-popper-content-wrapper], .${M}`}),V=o.computed(()=>O?{modal:!1,open:$.value,"onUpdate:open":G=>$.value=G}:{});return(G,ee)=>{const W=Xe,F=mo,R=ga,H=cc,L=hs,q=Rl,X=op,le=rp,pe=ps,_e=fs;return o.openBlock(),o.createElementBlock("div",{id:"tool-bar-image",class:o.normalizeClass(o.unref(Se)("bg-white border border-gray-100 dark:bg-ed-gray-500 dark:border-ed-muted rounded-full shadow-elevation2"))},[o.createElementVNode("div",Mte,[_.value?(o.openBlock(),o.createElementBlock("div",Ote)):o.createCommentVNode("",!0),T.value?(o.openBlock(),o.createElementBlock("div",Bte)):o.createCommentVNode("",!0),o.createElementVNode("div",{ref_key:"scrollEl",ref:C,id:"tool-bar-image-scroll",class:"text-ed-gray-700 flex gap-1.5 items-center overflow-x-auto overflow-y-hidden min-h-11 scrollbar-hide overflow-scrolling-touch relative whitespace-nowrap"},[o.createVNode(W,{tooltip:o.unref(n)("editor.image.menu.flipX"),icon:"FlipVertical",action:v},null,8,["tooltip"]),o.createVNode(W,{tooltip:o.unref(n)("editor.image.menu.flipY"),icon:"FlipHorizontal",action:y},null,8,["tooltip"]),o.createVNode(F,{orientation:"vertical",class:"h-5"}),o.createVNode(W,{tooltip:o.unref(n)("editor.image.menu.moveUp"),icon:"MoveUp",action:E,disabled:!G.editor.isEditable},null,8,["tooltip","disabled"]),o.createVNode(W,{tooltip:o.unref(n)("editor.image.menu.moveDown"),icon:"MoveDown",action:k,disabled:!G.editor.isEditable},null,8,["tooltip","disabled"]),o.createVNode(F,{orientation:"vertical",class:"h-5"}),o.createVNode(_e,o.normalizeProps(o.guardReactiveProps(o.unref(V))),{default:o.withCtx(()=>[o.createVNode(R,{class:o.normalizeClass(M)},{default:o.withCtx(()=>[o.createVNode(W,{title:o.unref(n)("editor.image.menu.size"),icon:"ImageSize"},null,8,["title"])]),_:1}),o.createVNode(pe,{class:"w-84 inside-toolbar"},{default:o.withCtx(()=>[o.createElementVNode("div",Ite,[o.createVNode(H,{for:"maxWidth",class:"whitespace-nowrap"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.image.menu.size.width")),1)]),_:1}),o.createVNode(L,{id:"maxWidth",modelValue:i.value,"onUpdate:modelValue":ee[0]||(ee[0]=re=>i.value=re),type:"number",class:"w-20 h-8 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",onInput:g,onKeyup:o.withKeys(c,["enter"])},null,8,["modelValue"]),o.createVNode(H,{for:"maxWidth",class:"whitespace-nowrap"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)("editor.image.menu.size.height")),1)]),_:1}),o.createVNode(L,{id:"maxWidth",modelValue:s.value,"onUpdate:modelValue":ee[1]||(ee[1]=re=>s.value=re),type:"number",class:"w-20 h-8 [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none",onInput:m,onKeyup:o.withKeys(c,["enter"])},null,8,["modelValue"])]),o.createElementVNode("div",Rte,[o.createVNode(le,{"model-value":r.value,"onUpdate:modelValue":[ee[2]||(ee[2]=re=>r.value=re),ee[3]||(ee[3]=re=>{r.value=re})]},{default:o.withCtx(()=>[o.createVNode(X,null,{default:o.withCtx(()=>[(o.openBlock(),o.createElementBlock(o.Fragment,null,o.renderList(["25","50","75","100"],re=>o.createVNode(q,{key:re,value:re},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(re)+"% ",1)]),_:2},1032,["value"])),64))]),_:1})]),_:1},8,["model-value"])])]),_:1})]),_:1},16),o.createVNode(F,{orientation:"vertical",class:"h-5"}),(o.openBlock(),o.createElementBlock(o.Fragment,null,o.renderList(l,(re,be)=>o.createVNode(W,{key:be,tooltip:o.unref(n)(`editor.textalign.${re}.tooltip`),icon:u[re],action:()=>b(re),disabled:!G.editor.can().setTextAlign(re),"is-active":()=>G.editor.isActive({textAlign:re})||!1},null,8,["tooltip","icon","action","disabled","is-active"])),64)),o.createVNode(F,{orientation:"vertical",class:"h-5"}),o.createVNode(W,{tooltip:o.unref(n)("editor.remove"),icon:"Trash2",action:x,disabled:!G.editor.isEditable},null,8,["tooltip","disabled"])],512)])],2)}}}),Dte=o.defineComponent({__name:"Switch",props:{defaultChecked:{type:Boolean},checked:{type:Boolean},disabled:{type:Boolean},required:{type:Boolean},name:{},id:{},value:{},asChild:{type:Boolean},as:{},class:{},customClassThumb:{}},emits:["update:checked"],setup(t,{emit:e}){const n=t,r=e,i=o.computed(()=>{const{class:a,customClassThumb:l,...u}=n;return u}),s=Dt(i,r);return(a,l)=>(o.openBlock(),o.createBlock(o.unref(RV),o.mergeProps(o.unref(s),{class:o.unref(Se)("peer inline-flex h-5 w-9 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent shadow-sm transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ed-ring focus-visible:ring-offset-2 focus-visible:ring-offset-ed-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-ed-primary data-[state=unchecked]:bg-ed-input",n.class)}),{default:o.withCtx(()=>[o.createVNode(o.unref(LV),{class:o.normalizeClass(o.unref(Se)("pointer-events-none block h-4 w-4 rounded-full bg-ed-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-4 data-[state=unchecked]:translate-x-0",n.customClassThumb))},null,8,["class"])]),_:1},16,["class"]))}}),Pte={class:"text-red-500 relative -top-1"},Kc=o.defineComponent({__name:"EditorFieldName",props:{fieldName:{},disabled:{type:Boolean,default:!1},isRequired:{type:Boolean,default:!1}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(o.unref(Se)("label-large",e.fieldName.customClass))},[o.createElementVNode("span",null,o.toDisplayString(e.fieldName.label),1),o.withDirectives(o.createElementVNode("span",Pte," •",512),[[o.vShow,e.fieldName.isRequired]])],2))}}),Fh={__name:"splitpanes",props:{horizontal:{type:Boolean,default:!1},pushOtherPanes:{type:Boolean,default:!0},maximizePanes:{type:Boolean,default:!0},rtl:{type:Boolean,default:!1},firstSplitter:{type:Boolean,default:!1}},emits:["ready","resize","resized","pane-click","pane-maximize","pane-add","pane-remove","splitter-click","splitter-dblclick"],setup(t,{emit:e}){const n=e,r=t,i=o.useSlots(),s=o.ref([]),a=o.computed(()=>s.value.reduce((Y,te)=>(Y[~~te.id]=te)&&Y,{})),l=o.computed(()=>s.value.length),u=o.ref(null),c=o.ref(!1),f=o.ref({mouseDown:!1,dragging:!1,activeSplitter:null,cursorOffset:0}),p=o.ref({splitter:null,timeoutId:null}),m=o.computed(()=>({[`splitpanes splitpanes--${r.horizontal?"horizontal":"vertical"}`]:!0,"splitpanes--dragging":f.value.dragging})),g=()=>{document.addEventListener("mousemove",y,{passive:!1}),document.addEventListener("mouseup",x),"ontouchstart"in window&&(document.addEventListener("touchmove",y,{passive:!1}),document.addEventListener("touchend",x))},b=()=>{document.removeEventListener("mousemove",y,{passive:!1}),document.removeEventListener("mouseup",x),"ontouchstart"in window&&(document.removeEventListener("touchmove",y,{passive:!1}),document.removeEventListener("touchend",x))},v=(Y,te)=>{const ne=Y.target.closest(".splitpanes__splitter");if(ne){const{left:oe,top:ce}=ne.getBoundingClientRect(),{clientX:Ae,clientY:Be}="ontouchstart"in window&&Y.touches?Y.touches[0]:Y;f.value.cursorOffset=r.horizontal?Be-ce:Ae-oe}g(),f.value.mouseDown=!0,f.value.activeSplitter=te},y=Y=>{f.value.mouseDown&&(Y.preventDefault(),f.value.dragging=!0,requestAnimationFrame(()=>{A(_(Y)),re("resize",{event:Y},!0)}))},x=Y=>{f.value.dragging&&(window.getSelection().removeAllRanges(),re("resized",{event:Y},!0)),f.value.mouseDown=!1,f.value.activeSplitter=null,setTimeout(()=>{f.value.dragging=!1,b()},100)},E=(Y,te)=>{"ontouchstart"in window&&(Y.preventDefault(),p.value.splitter===te?(clearTimeout(p.value.timeoutId),p.value.timeoutId=null,k(Y,te),p.value.splitter=null):(p.value.splitter=te,p.value.timeoutId=setTimeout(()=>p.value.splitter=null,500))),f.value.dragging||re("splitter-click",{event:Y,index:te},!0)},k=(Y,te)=>{if(re("splitter-dblclick",{event:Y,index:te},!0),r.maximizePanes){let ne=0;s.value=s.value.map((oe,ce)=>(oe.size=ce===te?oe.max:oe.min,ce!==te&&(ne+=oe.min),oe)),s.value[te].size-=ne,re("pane-maximize",{event:Y,index:te,pane:s.value[te]}),re("resized",{event:Y,index:te},!0)}},C=(Y,te)=>{re("pane-click",{event:Y,index:a.value[te].index,pane:a.value[te]})},_=Y=>{const te=u.value.getBoundingClientRect(),{clientX:ne,clientY:oe}="ontouchstart"in window&&Y.touches?Y.touches[0]:Y;return{x:ne-(r.horizontal?0:f.value.cursorOffset)-te.left,y:oe-(r.horizontal?f.value.cursorOffset:0)-te.top}},T=Y=>{Y=Y[r.horizontal?"y":"x"];const te=u.value[r.horizontal?"clientHeight":"clientWidth"];return r.rtl&&!r.horizontal&&(Y=te-Y),Y*100/te},A=Y=>{const te=f.value.activeSplitter;let ne={prevPanesSize:O(te),nextPanesSize:M(te),prevReachedMinPanes:0,nextReachedMinPanes:0};const oe=0+(r.pushOtherPanes?0:ne.prevPanesSize),ce=100-(r.pushOtherPanes?0:ne.nextPanesSize),Ae=Math.max(Math.min(T(Y),ce),oe);let Be=[te,te+1],We=s.value[Be[0]]||null,Ge=s.value[Be[1]]||null;const Ke=We.max<100&&Ae>=We.max+ne.prevPanesSize,Bt=Ge.max<100&&Ae<=100-(Ge.max+M(te+1));if(Ke||Bt){Ke?(We.size=We.max,Ge.size=Math.max(100-We.max-ne.prevPanesSize-ne.nextPanesSize,0)):(We.size=Math.max(100-Ge.max-ne.prevPanesSize-M(te+1),0),Ge.size=Ge.max);return}if(r.pushOtherPanes){const j=D(ne,Ae);if(!j)return;({sums:ne,panesToResize:Be}=j),We=s.value[Be[0]]||null,Ge=s.value[Be[1]]||null}We!==null&&(We.size=Math.min(Math.max(Ae-ne.prevPanesSize-ne.prevReachedMinPanes,We.min),We.max)),Ge!==null&&(Ge.size=Math.min(Math.max(100-Ae-ne.nextPanesSize-ne.nextReachedMinPanes,Ge.min),Ge.max))},D=(Y,te)=>{const ne=f.value.activeSplitter,oe=[ne,ne+1];return te<Y.prevPanesSize+s.value[oe[0]].min&&(oe[0]=$(ne).index,Y.prevReachedMinPanes=0,oe[0]<ne&&s.value.forEach((ce,Ae)=>{Ae>oe[0]&&Ae<=ne&&(ce.size=ce.min,Y.prevReachedMinPanes+=ce.min)}),Y.prevPanesSize=O(oe[0]),oe[0]===void 0)?(Y.prevReachedMinPanes=0,s.value[0].size=s.value[0].min,s.value.forEach((ce,Ae)=>{Ae>0&&Ae<=ne&&(ce.size=ce.min,Y.prevReachedMinPanes+=ce.min)}),s.value[oe[1]].size=100-Y.prevReachedMinPanes-s.value[0].min-Y.prevPanesSize-Y.nextPanesSize,null):te>100-Y.nextPanesSize-s.value[oe[1]].min&&(oe[1]=V(ne).index,Y.nextReachedMinPanes=0,oe[1]>ne+1&&s.value.forEach((ce,Ae)=>{Ae>ne&&Ae<oe[1]&&(ce.size=ce.min,Y.nextReachedMinPanes+=ce.min)}),Y.nextPanesSize=M(oe[1]-1),oe[1]===void 0)?(Y.nextReachedMinPanes=0,s.value.forEach((ce,Ae)=>{Ae<l.value-1&&Ae>=ne+1&&(ce.size=ce.min,Y.nextReachedMinPanes+=ce.min)}),s.value[oe[0]].size=100-Y.prevPanesSize-M(oe[0]-1),null):{sums:Y,panesToResize:oe}},O=Y=>s.value.reduce((te,ne,oe)=>te+(oe<Y?ne.size:0),0),M=Y=>s.value.reduce((te,ne,oe)=>te+(oe>Y+1?ne.size:0),0),$=Y=>[...s.value].reverse().find(te=>te.index<Y&&te.size>te.min)||{},V=Y=>s.value.find(te=>te.index>Y+1&&te.size>te.min)||{},G=()=>{var Y;const te=Array.from(((Y=u.value)==null?void 0:Y.children)||[]);for(const ne of te){const oe=ne.classList.contains("splitpanes__pane"),ce=ne.classList.contains("splitpanes__splitter");!oe&&!ce&&(ne.remove(),console.warn("Splitpanes: Only <pane> elements are allowed at the root of <splitpanes>. One of your DOM nodes was removed."))}},ee=(Y,te,ne=!1)=>{const oe=Y-1,ce=document.createElement("div");ce.classList.add("splitpanes__splitter"),ne||(ce.onmousedown=Ae=>v(Ae,oe),typeof window<"u"&&"ontouchstart"in window&&(ce.ontouchstart=Ae=>v(Ae,oe)),ce.onclick=Ae=>E(Ae,oe+1)),ce.ondblclick=Ae=>k(Ae,oe+1),te.parentNode.insertBefore(ce,te)},W=Y=>{Y.onmousedown=void 0,Y.onclick=void 0,Y.ondblclick=void 0,Y.remove()},F=()=>{var Y;const te=Array.from(((Y=u.value)==null?void 0:Y.children)||[]);for(const oe of te)oe.className.includes("splitpanes__splitter")&&W(oe);let ne=0;for(const oe of te)oe.className.includes("splitpanes__pane")&&(!ne&&r.firstSplitter?ee(ne,oe,!0):ne&&ee(ne,oe),ne++)},R=({uid:Y,...te})=>{const ne=a.value[Y];for(const[oe,ce]of Object.entries(te))ne[oe]=ce},H=Y=>{var te;let ne=-1;Array.from(((te=u.value)==null?void 0:te.children)||[]).some(oe=>(oe.className.includes("splitpanes__pane")&&ne++,oe.isSameNode(Y.el))),s.value.splice(ne,0,{...Y,index:ne}),s.value.forEach((oe,ce)=>oe.index=ce),c.value&&o.nextTick(()=>{F(),q({addedPane:s.value[ne]}),re("pane-add",{pane:s.value[ne]})})},L=Y=>{const te=s.value.findIndex(oe=>oe.id===Y);s.value[te].el=null;const ne=s.value.splice(te,1)[0];s.value.forEach((oe,ce)=>oe.index=ce),o.nextTick(()=>{F(),re("pane-remove",{pane:ne}),q({removedPane:{...ne}})})},q=(Y={})=>{!Y.addedPane&&!Y.removedPane?le():s.value.some(te=>te.givenSize!==null||te.min||te.max<100)?pe(Y):X(),c.value&&re("resized")},X=()=>{const Y=100/l.value;let te=0;const ne=[],oe=[];for(const ce of s.value)ce.size=Math.max(Math.min(Y,ce.max),ce.min),te-=ce.size,ce.size>=ce.max&&ne.push(ce.id),ce.size<=ce.min&&oe.push(ce.id);te>.1&&_e(te,ne,oe)},le=()=>{let Y=100;const te=[],ne=[];let oe=0;for(const Ae of s.value)Y-=Ae.size,Ae.givenSize!==null&&oe++,Ae.size>=Ae.max&&te.push(Ae.id),Ae.size<=Ae.min&&ne.push(Ae.id);let ce=100;if(Y>.1){for(const Ae of s.value)Ae.givenSize===null&&(Ae.size=Math.max(Math.min(Y/(l.value-oe),Ae.max),Ae.min)),ce-=Ae.size;ce>.1&&_e(ce,te,ne)}},pe=({addedPane:Y,removedPane:te}={})=>{let ne=100/l.value,oe=0;const ce=[],Ae=[];((Y==null?void 0:Y.givenSize)??null)!==null&&(ne=(100-Y.givenSize)/(l.value-1));for(const Be of s.value)oe-=Be.size,Be.size>=Be.max&&ce.push(Be.id),Be.size<=Be.min&&Ae.push(Be.id);if(!(Math.abs(oe)<.1)){for(const Be of s.value)(Y==null?void 0:Y.givenSize)!==null&&(Y==null?void 0:Y.id)===Be.id||(Be.size=Math.max(Math.min(ne,Be.max),Be.min)),oe-=Be.size,Be.size>=Be.max&&ce.push(Be.id),Be.size<=Be.min&&Ae.push(Be.id);oe>.1&&_e(oe,ce,Ae)}},_e=(Y,te,ne)=>{let oe;Y>0?oe=Y/(l.value-te.length):oe=Y/(l.value-ne.length),s.value.forEach((ce,Ae)=>{if(Y>0&&!te.includes(ce.id)){const Be=Math.max(Math.min(ce.size+oe,ce.max),ce.min),We=Be-ce.size;Y-=We,ce.size=Be}else if(!ne.includes(ce.id)){const Be=Math.max(Math.min(ce.size+oe,ce.max),ce.min),We=Be-ce.size;Y-=We,ce.size=Be}}),Math.abs(Y)>.1&&o.nextTick(()=>{c.value&&console.warn("Splitpanes: Could not resize panes correctly due to their constraints.")})},re=(Y,te=void 0,ne=!1)=>{const oe=(te==null?void 0:te.index)??f.value.activeSplitter??null;n(Y,{...te,...oe!==null&&{index:oe},...ne&&oe!==null&&{prevPane:s.value[oe-(r.firstSplitter?1:0)],nextPane:s.value[oe+(r.firstSplitter?0:1)]},panes:s.value.map(ce=>({min:ce.min,max:ce.max,size:ce.size}))})};o.watch(()=>r.firstSplitter,()=>F()),o.onMounted(()=>{G(),F(),q(),re("ready"),c.value=!0}),o.onBeforeUnmount(()=>c.value=!1);const be=()=>{var Y;return o.h("div",{ref:u,class:m.value},(Y=i.default)==null?void 0:Y.call(i))};return o.provide("panes",s),o.provide("indexedPanes",a),o.provide("horizontal",o.computed(()=>r.horizontal)),o.provide("requestUpdate",R),o.provide("onPaneAdd",H),o.provide("onPaneRemove",L),o.provide("onPaneClick",C),(Y,te)=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(be)))}},Zo={__name:"pane",props:{size:{type:[Number,String]},minSize:{type:[Number,String],default:0},maxSize:{type:[Number,String],default:100}},setup(t){var e;const n=t,r=o.inject("requestUpdate"),i=o.inject("onPaneAdd"),s=o.inject("horizontal"),a=o.inject("onPaneRemove"),l=o.inject("onPaneClick"),u=(e=o.getCurrentInstance())==null?void 0:e.uid,c=o.inject("indexedPanes"),f=o.computed(()=>c.value[u]),p=o.ref(null),m=o.computed(()=>{const y=isNaN(n.size)||n.size===void 0?0:parseFloat(n.size);return Math.max(Math.min(y,b.value),g.value)}),g=o.computed(()=>{const y=parseFloat(n.minSize);return isNaN(y)?0:y}),b=o.computed(()=>{const y=parseFloat(n.maxSize);return isNaN(y)?100:y}),v=o.computed(()=>{var y;return`${s.value?"height":"width"}: ${(y=f.value)==null?void 0:y.size}%`});return o.watch(()=>m.value,y=>r({uid:u,size:y})),o.watch(()=>g.value,y=>r({uid:u,min:y})),o.watch(()=>b.value,y=>r({uid:u,max:y})),o.onMounted(()=>{i({id:u,el:p.value,min:g.value,max:b.value,givenSize:n.size===void 0?null:m.value,size:m.value})}),o.onBeforeUnmount(()=>a(u)),(y,x)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"paneEl",ref:p,class:"splitpanes__pane",onClick:x[0]||(x[0]=E=>o.unref(l)(E,y._.uid)),style:o.normalizeStyle(v.value)},[o.renderSlot(y.$slots,"default")],4))}},Vte={class:"px-5 py-2.5"},Fte=["innerHTML"],$te={key:0,class:"px-5 py-2.5"},Hte=["innerHTML"],zte={key:1,class:"px-5 py-2.5"},Ute=["innerHTML"],Wte={key:2,class:"px-5 py-2.5"},jte=["innerHTML"],qte={class:"px-5 py-2.5"},Kte=["innerHTML"],Gte=o.defineComponent({__name:"EditorViewMobile",props:{extensions:{},mode:{},hideComment:{type:Boolean},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},comment:{},commentCuesheet:{},content:{},isEditorViewSplitContent:{type:Boolean},contentTextStyle:{}},setup(t){const e=t,n=o.computed(()=>{var A;const T=((A=e.extensions)==null?void 0:A.filter(D=>D.name!=="spellchecker"))||[];return T.some(D=>D.name==="image")||T.push(qu.configure()),T}),r=o.computed(()=>oa(e.comment)),i=o.computed(()=>oa(e.commentCuesheet)),s=o.computed(()=>oa(e.content));function a(T){return u1(T).replace(/<script\b[\s\S]*?<\/script\s*>/gi,"")}const l=o.computed(()=>r.value?a(e.comment):""),u=o.computed(()=>i.value?a(e.commentCuesheet):""),c=o.computed(()=>s.value?a(e.content):""),f=o.ref(),p=o.ref(),m=o.ref();o.onBeforeUnmount(()=>{f.value&&f.value.destroy(),p.value&&p.value.destroy(),m.value&&m.value.destroy()});function g(T){return new Lo({extensions:n.value,content:T,editable:!1,parseOptions:{preserveWhitespace:"full"}})}r.value||(f.value=g(bn(e.comment,!0,e.mode))),i.value||(p.value=g(bn(e.commentCuesheet,!0,e.mode))),s.value||(m.value=g(bn(e.content,!0,e.mode)));function b(T,A){if(!T)return;const D=bn(A,!0,e.mode);kt.isEqual(T.getHTML(),D)||T.commands.setContent(D,!1,{preserveWhitespace:"full"})}o.watch(()=>e.comment,T=>{r.value||b(f.value,T)}),o.watch(()=>e.commentCuesheet,T=>{i.value||b(p.value,T)}),o.watch(()=>e.content,T=>{s.value||b(m.value,T)});const{isScrolling:v,handleScroll:y}=Xl(),{isScrolling:x,handleScroll:E}=Xl(),k=o.computed(()=>e.mode!==Me.EDITOR?!0:!e.hideComment),C=o.computed(()=>e.mode!==Me.REPORT?!0:e.mode===Me.REPORT&&!e.hideComment),_=o.computed(()=>e.mode===Me.STRAIGHT||e.mode===Me.PLAIN_TEXT||!k.value);return(T,A)=>{const D=Kc;return o.openBlock(),o.createBlock(o.unref(Fh),{horizontal:"",class:o.normalizeClass(o.unref(Se)("flex-1 text-sm"))},{default:o.withCtx(()=>[o.unref(_)?(o.openBlock(),o.createBlock(o.unref(Zo),{key:0,class:o.normalizeClass(o.unref(Se)("!overflow-y-auto border border-ed-gray rounded-md",!T.isEditorViewSplitContent&&"border-none",!o.unref(x)&&"scrollbar-thumb-transparent",T.contentTextStyle)),onScroll:o.unref(E)},{default:o.withCtx(()=>[o.createElementVNode("div",Vte,[T.fieldNameContent?(o.openBlock(),o.createBlock(D,{key:0,"field-name":T.fieldNameContent,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.unref(s)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(c)},null,8,Fte)):(o.openBlock(),o.createBlock(o.unref(Qn),{key:2,editor:o.unref(m)},null,8,["editor"]))])]),_:1},8,["class","onScroll"])):(o.openBlock(),o.createElementBlock(o.Fragment,{key:1},[o.unref(k)?(o.openBlock(),o.createBlock(o.unref(Zo),{key:0,class:o.normalizeClass(o.unref(Se)("!overflow-y-auto border border-ed-gray rounded-md",!T.isEditorViewSplitContent&&"border-none",!o.unref(v)&&"scrollbar-thumb-transparent")),onScroll:o.unref(y)},{default:o.withCtx(()=>[o.createElementVNode("div",{class:o.normalizeClass(o.unref(Se)("divide-y divide-ed-gray divide-dashed"))},[o.unref(C)?(o.openBlock(),o.createElementBlock("div",$te,[T.fieldNameComment?(o.openBlock(),o.createBlock(D,{key:0,"field-name":T.fieldNameComment,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.unref(r)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(l)},null,8,Hte)):(o.openBlock(),o.createBlock(o.unref(Qn),{key:2,editor:o.unref(f)},null,8,["editor"]))])):o.createCommentVNode("",!0),T.mode===o.unref(Me).REPORT?(o.openBlock(),o.createElementBlock("div",zte,[T.fieldNameCommentCuesheet?(o.openBlock(),o.createBlock(D,{key:0,"field-name":T.fieldNameCommentCuesheet,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.unref(i)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(u)},null,8,Ute)):(o.openBlock(),o.createBlock(o.unref(Qn),{key:2,editor:o.unref(p)},null,8,["editor"]))])):o.createCommentVNode("",!0),T.isEditorViewSplitContent?o.createCommentVNode("",!0):(o.openBlock(),o.createElementBlock("div",Wte,[T.fieldNameContent?(o.openBlock(),o.createBlock(D,{key:0,"field-name":T.fieldNameContent,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.unref(s)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(c)},null,8,jte)):(o.openBlock(),o.createBlock(o.unref(Qn),{key:2,editor:o.unref(m)},null,8,["editor"]))]))],2)]),_:1},8,["class","onScroll"])):o.createCommentVNode("",!0),T.isEditorViewSplitContent?(o.openBlock(),o.createBlock(o.unref(Zo),{key:1,class:o.normalizeClass(o.unref(Se)("!overflow-y-auto border border-ed-gray rounded-md",!o.unref(x)&&"scrollbar-thumb-transparent",T.contentTextStyle)),onScroll:o.unref(E)},{default:o.withCtx(()=>[o.createElementVNode("div",qte,[T.fieldNameContent?(o.openBlock(),o.createBlock(D,{key:0,"field-name":T.fieldNameContent,class:"leading-7 font-medium text-blue-500"},null,8,["field-name"])):o.createCommentVNode("",!0),o.unref(s)?(o.openBlock(),o.createElementBlock("div",{key:1,class:"ProseMirror",innerHTML:o.unref(c)},null,8,Kte)):(o.openBlock(),o.createBlock(o.unref(Qn),{key:2,editor:o.unref(m)},null,8,["editor"]))])]),_:1},8,["class","onScroll"])):o.createCommentVNode("",!0)],64))]),_:1},8,["class"])}}}),Xte={class:"flex gap-2 items-center overflow-x-auto"},sS=o.defineComponent({__name:"ToolbarMobile",props:{editor:{},disabled:{type:Boolean,default:!1},mode:{},activeExtensions:{default:()=>[lc,vi,Lg]},customClassToolbar:{}},setup(t){const{t:e}=Tt(),n=t,r=o.inject("isEditable",o.ref(!0)),i=o.computed(()=>{const u=[...n.editor.extensionManager.extensions],c=u.find(m=>m.name===Lg);let f=u.sort((m,g)=>m.name==="spellchecker"?-1:g.name==="spellchecker"||m.name==="superText"?1:g.name==="superText"?-1:0);c&&(f=u.sort((m,g)=>m.name==="configPlan"?1:g.name==="configPlan"?-1:0));let p=[];for(const m of f){const{button:g,divider:b=!1,spacer:v=!1,toolbar:y=!0}=m.options;if(!g||!f1(g)||!y)continue;const x=g({editor:n.editor,extension:m,t:o.unref(e),isMobile:!0});if(Array.isArray(x)){const E=x.map((k,C)=>({id:`${m.name}`,button:k,divider:C===x.length-1?b:!1,spacer:C===0?v:!1}));p=[...p,...E];continue}p.push({button:x,divider:b,spacer:v,id:`${m.name}`})}if(!r.value){const m=p.find(g=>g.id==="superText");m&&(m.button.componentProps.disabled=!0)}return n.activeExtensions.length?p.filter(m=>m.id&&n.activeExtensions.includes(m.id)):p}),s=u=>u.id==="spellchecker"?"!text-ed-blue data-[state=off]:bg-white dark:data-[state=off]:bg-ed-accent/40 !font-normal rounded [&>div>svg]:w-[19px] [&>div>svg]:h-[19px] h-[26px] gap-x-1 whitespace-nowrap":u.button.componentProps.customClass,a=u=>u.id==="spellchecker"?"Spellchecker":u.button.componentProps.icon,l=o.ref(!1);return(u,c)=>{const f=iS;return o.openBlock(),o.createElementBlock("div",{id:"tool-bar",class:o.normalizeClass(o.unref(Se)("z-10 border border-ed-input rounded-[5px] px-2.5 py-[5px] leading-none",!i.value.length&&"hidden",u.customClassToolbar))},[o.createElementVNode("div",Xte,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(i.value,(p,m)=>{var g,b,v;return o.openBlock(),o.createElementBlock(o.Fragment,{key:m},[p.spacer&&m!==0?(o.openBlock(),o.createBlock(o.unref(mo),{key:0,orientation:"vertical",class:"h-[16px] mx-[10px]"})):o.createCommentVNode("",!0),(o.openBlock(),o.createBlock(o.resolveDynamicComponent(p.button.component),o.mergeProps({id:p.id,ref_for:!0},p.button.componentProps,{editor:u.editor,disabled:u.disabled||((g=p.button.componentProps)==null?void 0:g.disabled),"custom-class":s(p),icon:a(p)}),o.createSlots({_:2},[o.renderList(p.button.componentSlots,(y,x,E)=>({name:`${x}`,fn:o.withCtx(k=>[(o.openBlock(),o.createBlock(o.resolveDynamicComponent(y),o.mergeProps({ref_for:!0},k==null?void 0:k.props,{id:p.id}),null,16,["id"]))])}))]),1040,["id","editor","disabled","custom-class","icon"])),p.id===vi&&o.unref(l)?(o.openBlock(),o.createBlock(f,{key:1,class:"bg-white border-inherit w-[26px] h-[26px] shadow-none",checked:(v=(b=p.button.componentProps).isActive)==null?void 0:v.call(b),"onUpdate:checked":y=>{var x,E;return(E=(x=p.button.componentProps).action)==null?void 0:E.call(x)}},null,8,["checked","onUpdate:checked"])):o.createCommentVNode("",!0),p.divider?(o.openBlock(),o.createBlock(o.unref(mo),{key:2,orientation:"vertical",class:"mx-2 h-auto"})):o.createCommentVNode("",!0)],64)}),128))])],2)}}}),Yte={class:"flex w-fit rounded-md bg-ed-gray-600 text-white text-sm max-w-full overflow-x-auto"},Jte=uo(o.defineComponent({__name:"MainBubbleMenuList",props:{editor:{},mode:{},disableSuperInput:{type:Boolean},hasClipboard:{type:Boolean}},emits:["close-long-press-menu"],setup(t,{emit:e}){const n=t,r=e,{t:i}=Tt(),s=o.computed(()=>[...n.editor.extensionManager.extensions].find(p=>p.name==="superText")),a=o.ref(!1),l=o.computed(()=>n.editor.storage.deviceEnv.specialCharModal),u=f=>{const{state:p}=n.editor,{from:m}=p.selection;n.editor.commands.insertContentAt(m,f)},c=()=>{n.editor.chain().focus().toggleSuperInputMoblie().run(),r("close-long-press-menu");const f=BJ(n.editor);n.editor.commands.setSuperTextContent(f)};return(f,p)=>{var m,g,b;return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createElementVNode("div",Yte,[o.unref(s)&&!f.disableSuperInput&&f.mode!==o.unref(Me).EDITOR?(o.openBlock(),o.createElementBlock("button",{key:0,class:"bubble-menu-item",onClick:c},o.toDisplayString(o.unref(i)("editor.super")),1)):o.createCommentVNode("",!0),o.createElementVNode("button",{class:"bubble-menu-item",onClick:p[0]||(p[0]=v=>a.value=!0)},o.toDisplayString(o.unref(i)("editor.insertSpecial")),1),f.hasClipboard?(o.openBlock(),o.createElementBlock("button",{key:1,class:"bubble-menu-item",onClick:p[1]||(p[1]=v=>(f.editor.chain().focus().pasteContent().run(),r("close-long-press-menu")))},o.toDisplayString(o.unref(i)("editor.paste")),1)):o.createCommentVNode("",!0),o.createElementVNode("button",{class:"bubble-menu-item",onClick:p[2]||(p[2]=v=>f.editor.chain().focus().cutContent().run())},o.toDisplayString(o.unref(i)("editor.cut")),1),o.createElementVNode("button",{class:"bubble-menu-item",onClick:p[3]||(p[3]=()=>{f.editor.chain().focus().copyContent().setTextSelection(0).blur().run(),r("close-long-press-menu")})},o.toDisplayString(o.unref(i)("editor.copy")),1),o.createElementVNode("button",{class:"bubble-menu-item",onClick:p[4]||(p[4]=v=>f.editor.chain().focus().selectAll().run())},o.toDisplayString(o.unref(i)("editor.selectAll")),1)]),(o.openBlock(),o.createBlock(o.Teleport,{to:"body"},[(o.openBlock(),o.createBlock(o.resolveDynamicComponent((m=o.unref(l))==null?void 0:m.component),{"is-open":o.unref(a),open:o.unref(a),class:o.normalizeClass((b=(g=o.unref(l))==null?void 0:g.componentProps)==null?void 0:b.class),onSelectedChar:u,onClose:p[5]||(p[5]=v=>a.value=!1)},null,40,["is-open","open","class"]))]))],64)}}}),[["__scopeId","data-v-b4e2ce28"]]),aS=o.defineComponent({__name:"MainBubbleMenu",props:{editor:{},mode:{},disableSuperInput:{type:Boolean}},setup(t){const e=t,n=new c1,r=o.ref(!1),i=async()=>{var g,b;const m=await((b=(g=e.editor).hasClipboard)==null?void 0:b.call(g));r.value=!!m},s={duration:200,placement:"bottom",appendTo:()=>document.body.querySelector(".splitpanes__pane"),onShow:()=>{i(),n.sendToNative("hideIOSEditMenu")},getReferenceClientRect:()=>{if(e.editor&&!e.editor.isDestroyed){const{view:m,state:g}=e.editor,{from:b,to:v}=g.selection,y=m.dom.getBoundingClientRect(),x=m.coordsAtPos(b),E=m.coordsAtPos(v),k=Math.min(x.top,E.top),_=Math.max(x.bottom,E.bottom)-k;return new DOMRect(y.left,k,y.width,_)}return null}},a=o.ref(null),l=o.ref(!1),u=({editor:m,state:g})=>{if(e.editor.storage.deviceEnv.isForceCloseBubble||e.editor.isActive("link"))return!1;const{selection:b}=g,v=!b.empty&&jd(b)||l.value;return v&&m.extensionStorage.spellchecker.spellchecker.hideSuggestionBox(),v};function c(m){return f(m)&&m.touches.length>0?{x:m.touches[0].clientX,y:m.touches[0].clientY}:f(m)&&m.changedTouches.length>0?{x:m.changedTouches[0].clientX,y:m.changedTouches[0].clientY}:m instanceof MouseEvent?{x:m.clientX,y:m.clientY}:window.PointerEvent&&m instanceof PointerEvent?{x:m.clientX,y:m.clientY}:null}function f(m){return"touches"in m}function p(m){if(!e.editor)return;const g=c(m);if(!g)return;const b=e.editor.view,v=b.state,y=b.posAtCoords({left:g.x,top:g.y});if(!y||y.inside===-1)return;const x=y.pos,E=v.doc.content.size,k=Math.min(x+1,E);let C=v.tr;C=C.setSelection(Pe.create(v.doc,x,k)),b.dispatch(C),requestAnimationFrame(()=>{const _=b.state.tr.setSelection(Pe.create(b.state.doc,x,x));b.dispatch(_),b.focus()})}return o.onMounted(()=>{const m=e.editor.view.dom;Ne.onLongPress(o.ref(m),v=>{l.value=!0,p(v)},{delay:500,modifiers:{prevent:!1}});const g=()=>{e.editor.state.selection.empty&&(l.value=!1)};m.addEventListener("pointerdown",g);const b=({transaction:v})=>{l.value&&v.docChanged&&(l.value=!1,o.nextTick(()=>{var y;try{const x=(y=a.value)==null?void 0:y.$el;x&&x._tippy&&typeof x._tippy.hide=="function"&&x._tippy.hide()}catch{const E=e.editor.view,k=E.state,C=k.selection.from,_=k.doc.content.size,T=Math.min(C+1,_);E.dispatch(k.tr.setSelection(Pe.create(k.doc,C,T))),requestAnimationFrame(()=>{E.dispatch(E.state.tr.setSelection(Pe.create(E.state.doc,C,C)))})}}))};e.editor.on("transaction",b),o.onUnmounted(()=>{m.removeEventListener("pointerdown",g),e.editor.off("transaction",b)})}),(m,g)=>(o.openBlock(),o.createBlock(o.unref(Wu),{ref_key:"bubbleMenuRef",ref:a,editor:m.editor,"tippy-options":s,"should-show":u},{default:o.withCtx(()=>[o.createVNode(Jte,{editor:m.editor,mode:m.mode,disableSuperInput:m.disableSuperInput,hasClipboard:o.unref(r),onCloseLongPressMenu:g[0]||(g[0]=b=>l.value=!1)},null,8,["editor","mode","disableSuperInput","hasClipboard"])]),_:1},8,["editor"]))}}),Zte={class:"flex items-center justify-between label-large mb-2"},Qte={class:"mb-5"},Nte={class:"flex gap-x-3"},ene=o.defineComponent({__name:"SuperInputBottomSheet",props:{editor:{},open:{type:Boolean},bottomSheetComponent:{}},emits:["save","close"],setup(t,{emit:e}){const n=t,r=e,i=o.ref(""),s=o.ref(""),a=o.computed(()=>Eh(i.value)),l=()=>{i.value="",s.value="",n.editor.commands.setSuperTextContent(i.value,s.value)},u=()=>{l(),r("close")};o.watch(()=>n.open,()=>{n.open&&(i.value=n.editor.storage.superText.superTextContent,s.value=n.editor.storage.superText.superTextPosition)});const c=()=>{i.value=n.editor.storage.superText.superTextContent},f=()=>{r("save",i.value,s.value),l()};return(p,m)=>{var b;const g=Ot;return o.openBlock(),o.createBlock(o.resolveDynamicComponent((b=p.bottomSheetComponent)==null?void 0:b.component),{"is-open":p.open,type:"bottom",title:"수퍼 입력",onOnClose:u},{customContent:o.withCtx(()=>{var v;return[o.createElementVNode("div",Zte,[m[2]||(m[2]=o.createElementVNode("span",null,"내용",-1)),(o.openBlock(),o.createBlock(o.resolveDynamicComponent((v=p.bottomSheetComponent)==null?void 0:v.button),{class:"w-fit [&_svg]:size-6 text-blue",variant:"ghost",size:"icon",onClick:c},{default:o.withCtx(()=>[o.createVNode(g,{name:"reset",class:"h-5 w-5"}),m[1]||(m[1]=o.createElementVNode("span",null,"초기화",-1))]),_:1}))])]}),body:o.withCtx(()=>[o.createElementVNode("div",Qte,[o.createVNode(Ev,{modelValue:o.unref(i),"onUpdate:modelValue":m[0]||(m[0]=v=>o.isRef(i)?i.value=v:null),"parent-editor":p.editor,"spellcheck-enabled":!1,autofocus:"end"},null,8,["modelValue","parent-editor"])])]),footer:o.withCtx(()=>{var v,y;return[o.createElementVNode("div",Nte,[(o.openBlock(),o.createBlock(o.resolveDynamicComponent((v=p.bottomSheetComponent)==null?void 0:v.button),{variant:"outline",onClick:u},{default:o.withCtx(()=>m[3]||(m[3]=[o.createTextVNode(" 취소 ")])),_:1})),(o.openBlock(),o.createBlock(o.resolveDynamicComponent((y=p.bottomSheetComponent)==null?void 0:y.button),{disabled:o.unref(a),variant:o.unref(a)?"disabled":"default",onClick:f},{default:o.withCtx(()=>m[4]||(m[4]=[o.createTextVNode(" 입력 ")])),_:1},8,["disabled","variant"]))])]}),_:1},40,["is-open"])}}}),lS=zn.create({name:"diffDel",parseHTML(){return[{tag:"span.diff-del"}]},renderHTML({HTMLAttributes:t}){return["span",{class:"diff-del",...t},0]}});function uS(t=100){let e=null,n=!0;function r(s){let a=s==null?void 0:s.parentElement;for(;a;){if(a.id==="comment-wrap-scroll"){a=a.parentElement;continue}const u=getComputedStyle(a).overflowY;if(u==="auto"||u==="scroll")return a;a=a.parentElement}return window}function i(s){if(n){n=!1;return}e&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{const{view:a,state:l}=s,{from:u}=l.selection,c=a.coordsAtPos(u),f=r(a.dom),p=o.unref(t);if(f===window){const y=window.innerHeight;c.top>y-p&&window.scrollBy({top:c.top-(y-p),behavior:"smooth"});return}const m=f,g=m.getBoundingClientRect(),b=c.top-g.top,v=m.clientHeight;b>v-p&&m.scrollBy({top:b-(v-p),behavior:"smooth"})})}return{scrollCaretNearBottom:i}}const tne=o.defineComponent({__name:"EditorCommentMoblie",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{},commentCuesheet:{},hideComment:{type:Boolean},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{},fontFamilyDefault:{},fontWeightDefault:{},contentTextStyle:{},isOpenSuperView:{type:Boolean,default:!0},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{},titleBarComment:{},titleBarContent:{},fieldNameComment:{},fieldNameCommentCuesheet:{},fieldNameContent:{},fieldNameSuper:{},isScreenSplit:{},isShowLineNumber:{type:Boolean},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:600},maxHeight:{default:void 0},height:{},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},customClassToolbar:{},readonly:{type:Boolean},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean,default:!0},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean},isEditorViewSplitContent:{type:Boolean},editorContentInstance:{},toolbarExtensionOrder:{},watermarkOverlay:{},bottomOffset:{},characterCountLimit:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=o.useAttrs(),a=xn(),{isReady:l,editor:u,updateEditorState:c,checkSpellStore:f}=a,{scrollCaretNearBottom:p}=uS(r.bottomOffset),m=o.inject("isEditable",o.ref(!0)),g=new Lo({enablePasteRules:!1,enableInputRules:!1,content:bn(r.modelValue,r.disabled),editorProps:{attributes:{id:lr.COMMENT,[lr.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:kt.throttle((E,k)=>k.key==="Enter"&&s.enter&&!k.shiftKey?(i("enter"),!0):!1,Vo),transformPastedHTML:E=>(E=E.replace(/\s*style="[^"]*"/g,""),E),handlePaste(E,k){var _;const C=((_=k.clipboardData)==null?void 0:_.getData("text/plain"))||"";return r.mode===Me.EDITOR&&Uv(C)?(k.preventDefault(),Wv(E,C.trim())):!1}},onCreate:({editor:E})=>{c(E)},onUpdate:kt.throttle(({editor:E})=>{l.value=!0;const k=v(E,r.output);i("update:modelValue",k),i("change",{editor:E,output:k}),c(E)},Vo),extensions:[lS,...kt.uniqBy(r.extensions,"name")],editable:m.value,onFocus:()=>{b()},onBlur:({editor:E,event:k})=>{i("onBlurEditor",k)},onSelectionUpdate:({editor:E})=>{m.value&&p(E)}});function b(){i("setEditorSelected",g)}b();function v(E,k){if(!E)return"";if(E.isEmpty)return k==="json"?{}:"";switch(k){case"html":return h1(E,{removeNodes:[sc,bi]});case"json":return E.getJSON();case"text":return E.getText();default:return""}}function y(E){return E.every(k=>g==null?void 0:g.extensionManager.extensions.find(C=>C.name===k))}o.watch(()=>f.languages,()=>{g.commands.checkSpelling()}),o.watch(()=>r.modelValue,E=>{if(!g||kt.isEqual(v(g,r.output),E))return;const{from:k,to:C}=g.state.selection;g.commands.setTextSelection({from:k,to:C}),g.commands.setContent(bn(E,r.disabled),!1)},{deep:!0}),o.watch(()=>u.value,()=>{u.value&&u.value.on("selectionUpdate",({editor:E})=>{i("changed:selection",{editor:E})})}),o.watch(()=>r.disableSuperInput,()=>{const E=document.getElementById(lr.COMMENT);E==null||E.setAttribute(lr.DISABLE_SUPER_INPUT,`${r.disableSuperInput}`)}),o.onUnmounted(()=>g==null?void 0:g.destroy()),wc(ju.SAVE,()=>{localStorage.setItem("comment",v(g,"html"))});function x(E){g.commands.focus("end"),b()}return Dh(g),o.onMounted(()=>{var E;r.autoFocus&&x(r.mode),(E=g==null?void 0:g.commands)!=null&&E.setIsMobile&&g.commands.setIsMobile(!0)}),o.watch(()=>r.mode,E=>{r.autoFocus&&x()}),o.watch(()=>m.value,E=>{var k;g==null||g.setEditable(E),(k=g==null?void 0:g.commands)!=null&&k.setIsEnableSuggestion&&g.commands.setIsEnableSuggestion(E)},{immediate:!0}),e({editor:g}),(E,k)=>{const C=aS,_=Lh,T=Rh,A=Ih;return o.openBlock(),o.createElementBlock(o.Fragment,null,[!E.hideBubble&&!E.disabled&&o.unref(m)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[o.createVNode(C,{editor:o.unref(g),mode:E.mode,"disable-super-input":E.disableSuperInput},null,8,["editor","mode","disable-super-input"]),y([o.unref(ac)])?(o.openBlock(),o.createBlock(_,{key:0,editor:o.unref(g)},null,8,["editor"])):o.createCommentVNode("",!0),y([o.unref(ma)])?(o.openBlock(),o.createBlock(T,{key:1,editor:o.unref(g)},null,8,["editor"])):o.createCommentVNode("",!0),y([o.unref(ds)])?(o.openBlock(),o.createBlock(A,{key:2,editor:o.unref(g)},null,8,["editor"])):o.createCommentVNode("",!0)],64)):o.createCommentVNode("",!0),o.createVNode(o.unref(Qn),{id:"editor-panel",editor:o.unref(g),spellcheck:"true",class:"flex-1 relative"},null,8,["editor"])],64)}}}),cS=o.defineComponent({__name:"ToolbarTitle",props:{titleBar:{},customClass:{}},setup(t){return(e,n)=>(o.openBlock(),o.createElementBlock("h3",{class:o.normalizeClass(o.unref(Se)("rounded-[5px] px-2.5 py-[5px] min-h-[32px] flex items-center bg-ed-gray-500",[e.customClass],[e.titleBar.bgClass]))},o.toDisplayString(e.titleBar.title),3))}});function dS(t=!1,e=10){const n=e,r=90,i=50,s=n+1,a=o.ref(!0),l=o.ref(!0),u=o.ref(i),c=o.ref(i);return{HEADER_ONLY_SIZE:n,FULL_SIZE:r,SPLIT_SIZE:i,pane1ContentVisible:a,pane2ContentVisible:l,pane1Size:u,pane2Size:c,togglePane:m=>{if(o.unref(t)){l.value?(l.value=!1,c.value=n):(l.value=!0,c.value=r+n);return}if(m==="pane1"){a.value&&l.value?(a.value=!1,u.value=n,c.value=r):a.value&&!l.value?(a.value=!1,l.value=!0,u.value=n,c.value=r):!a.value&&l.value?(a.value=!0,u.value=i,c.value=i):(a.value=!0,u.value=r,c.value=n);return}m==="pane2"&&(a.value&&l.value?(l.value=!1,u.value=r,c.value=n):l.value&&!a.value?(l.value=!1,a.value=!0,u.value=r,c.value=n):!l.value&&a.value?(l.value=!0,u.value=i,c.value=i):(l.value=!0,u.value=n,c.value=r))},handlePaneResize:m=>{const g=m.panes;if(g&&g.length>=2){const b=g[0].size,v=g[1].size;u.value=b,c.value=v,b>n&&!a.value&&(a.value=!0),v>n&&!l.value&&(l.value=!0),b<=s&&a.value&&(a.value=!1),v<=s&&l.value&&(l.value=!1)}}}}const nne={class:"flex justify-between items-center relative gap-x-3"},rne={class:"flex items-center gap-x-4"},Gc=o.defineComponent({__name:"CoreEditorMoblie",props:{isMobile:{type:Boolean},superTextArea:{default:{view:!0,button:!0}},mode:{},modelValue:{default:""},comment:{default:""},commentCuesheet:{default:""},hideComment:{type:Boolean,default:!1},disableSuperInput:{type:Boolean,default:!1},fontSizeDefault:{default:""},fontFamilyDefault:{default:""},fontWeightDefault:{default:void 0},contentTextStyle:{default:""},isOpenSuperView:{type:Boolean},output:{default:"html"},dark:{type:Boolean,default:void 0},disabled:{type:Boolean,default:!1},hideToolbar:{type:Boolean,default:!1},isShowFormatControlBar:{type:Boolean},customClassFormatControlBar:{default:""},titleBarComment:{default:null},titleBarContent:{default:null},fieldNameComment:{default:null},fieldNameCommentCuesheet:{},fieldNameContent:{default:null},fieldNameSuper:{},isScreenSplit:{default:!1},isShowLineNumber:{type:Boolean,default:!1},hideMenubar:{type:Boolean},disableBubble:{type:Boolean,default:!1},hideBubble:{type:Boolean,default:!1},maxWidth:{default:void 0},minHeight:{default:200},maxHeight:{default:void 0},height:{default:void 0},extensions:{default:()=>[]},editorClass:{default:void 0},contentClass:{default:void 0},isCompare:{type:Boolean},autoHeight:{type:Boolean},textAlert:{},customClassToolbar:{default:""},readonly:{type:Boolean,default:!1},canEditSuperReadOnly:{type:Boolean},autoFocus:{type:Boolean,default:!0},superPreviewCustomClass:{},minChar:{},isAccordion:{type:Boolean},contentAutoCopied:{},isEditorView:{type:Boolean,default:!1},isEditorViewSplitContent:{type:Boolean,default:!1},editorContentInstance:{},toolbarExtensionOrder:{},watermarkOverlay:{},bottomOffset:{},characterCountLimit:{}},emits:["enter","change","update:modelValue","update:comment","onFocusEditor","changed:selection","setEditorSelected","onBlurEditor","lineFocus","onFocus","onBlur"],setup(t,{expose:e,emit:n}){var $e;const r=t,i=n,s=new c1;o.provide("isMobile",!0),Ne.useEventBus(fr.INCREASE_DECREASE_FONTSIZE);const a=o.useAttrs(),l=xn(),{state:u,isFullscreen:c,isReady:f,editor:p,updateEditorState:m,checkSpellStore:g,setImageAttachment:b,setEditorContentMobile:v,footerTargetRef:y}=l,{markAsFocused:x,insertHtml:E}=Iee(),k=o.computed(()=>F.value?100:40),{scrollCaretNearBottom:C}=uS(k),_=o.ref(!r.disabled&&!r.readonly);o.provide("isEditable",_);const T=o.ref(r.fontSizeDefault),A=o.ref(r.fontFamilyDefault),D=o.ref(r.fontWeightDefault);o.provide("fontSize",T),o.provide("fontFamily",A),o.provide("fontWeight",D);const O=o.computed(()=>({...o.unref(c)?{height:"100%"}:{minHeight:r.minHeight?rn(r.minHeight):void 0,maxHeight:r.maxHeight?rn(r.maxHeight):void 0,height:r.height?rn(r.height):void 0},maxWidth:rn(r.maxWidth),width:r.maxWidth?"100%":void 0,margin:r.maxWidth?"0 auto":void 0})),M=new Lo({enablePasteRules:!1,enableInputRules:!1,content:bn(r.modelValue,r.disabled,r.mode),editorProps:{handleKeyDown:kt.throttle((Q,we)=>we.key==="Enter"&&a.enter&&!we.shiftKey?(i("enter"),!0):!1,Vo),transformPastedHTML:Q=>(Q=Q.replace(/\s*style="[^"]*"/g,""),Q),handlePaste(Q,we){var me;const N=((me=we.clipboardData)==null?void 0:me.getData("text/plain"))||"";return r.mode===Me.EDITOR&&Uv(N)?(we.preventDefault(),Wv(Q,N.trim())):r.mode===Me.PLAIN_TEXT?(we.preventDefault(),Nee(Q,N)):!1}},onCreate:({editor:Q})=>{m(Q)},onUpdate:kt.throttle(({editor:Q})=>{f.value=!0;const we=L(Q,r.output);i("update:modelValue",we),i("change",{editor:Q,output:we}),m(Q),$(Q)},Vo),extensions:kt.uniqBy(qC(r.extensions,r),"name"),editable:_.value,onFocus:Q=>{R(),i("onFocus",Q),x()},onBlur:Q=>i("onBlur",Q),parseOptions:{preserveWhitespace:"full"},onSelectionUpdate:({editor:Q})=>{_.value&&C(Q)}});function $(Q){const we=[];Q.state.doc.descendants(N=>{N.type.name==="image"&&we.push({id:N.attrs.id,src:N.attrs.src})}),b(we)}const V=o.ref(),{isShowToolBarBaseOnEditor:G}=Ree(),ee=o.ref(!1);function W(){s.isNativeWebViewAvailable()&&(s.receiveDataFromNative(s1.KEYBOARD_DID_SHOW,Q=>{ee.value=!0}),s.receiveDataFromNative(s1.KEYBOARD_DID_HIDE,Q=>{ee.value=!1}))}o.watch(ee,Q=>{Q&&C(V.value)}),o.onMounted(()=>{R(M),v(M),W()});const F=o.computed(()=>r.isShowFormatControlBar&&r.mode===Me.EDITOR&&_&&!r.isEditorView);function R(Q){V.value=Q??M,l.setEditorSelectedMobile(V.value)}const H=o.computed(()=>M.storage.superText.isShowSuperInputMoblie);function L(Q,we){if(!Q)return"";if(Q.isEmpty)return we==="json"?{}:"";if(r.mode===Me.PLAIN_TEXT)return Q.getText({blockSeparator:`
348
348
  `});switch(we){case"html":return h1(Q,{removeNodes:[sc,bi]});case"json":return Q.getJSON();case"text":return Q.getText({blockSeparator:`