vdc-editor 0.1.286 → 0.1.287
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/BulkSpellChecker-IraxV0f0.mjs +5 -0
- package/lib/BulkSpellChecker-IraxV0f0.mjs.map +1 -0
- package/lib/{index-BEPLzVf6.mjs → index-CSWlx85G.mjs} +10 -10
- package/lib/{index-BEPLzVf6.mjs.map → index-CSWlx85G.mjs.map} +1 -1
- package/lib/style.css +1 -1
- package/lib/vdc-editor.mjs +1 -1
- package/lib/vdc-editor.umd.js +2 -2
- package/lib/vdc-editor.umd.js.map +1 -1
- package/package.json +1 -1
- package/lib/BulkSpellChecker-DWb9Bf6o.mjs +0 -5
- package/lib/BulkSpellChecker-DWb9Bf6o.mjs.map +0 -1
package/lib/vdc-editor.umd.js
CHANGED
|
@@ -333,7 +333,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Y=I,K=U),L===void 0&&(
|
|
|
333
333
|
`)}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...n){const r=new this(e);return n.forEach(i=>r.set(i)),r}static accessor(e){const r=(this[$E]=this[$E]={accessors:{}}).accessors,i=this.prototype;function s(a){const l=zc(a);r[l]||(lJ(i,a),r[l]=!0)}return de.isArray(e)?e.forEach(s):s(e),this}};fr.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),de.reduceDescriptors(fr.prototype,({value:t},e)=>{let n=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(r){this[n]=r}}}),de.freezeMethods(fr);function bv(t,e){const n=this||Hc,r=e||n,i=fr.from(r.headers);let s=r.data;return de.forEach(t,function(l){s=l.call(n,s,i.normalize(),e?e.status:void 0)}),i.normalize(),s}function HE(t){return!!(t&&t.__CANCEL__)}function ql(t,e,n){ut.call(this,t??"canceled",ut.ERR_CANCELED,e,n),this.name="CanceledError"}de.inherits(ql,ut,{__CANCEL__:!0});function zE(t,e,n){const r=n.config.validateStatus;!n.status||!r||r(n.status)?t(n):e(new ut("Request failed with status code "+n.status,[ut.ERR_BAD_REQUEST,ut.ERR_BAD_RESPONSE][Math.floor(n.status/100)-4],n.config,n.request,n))}function uJ(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}function cJ(t,e){t=t||10;const n=new Array(t),r=new Array(t);let i=0,s=0,a;return e=e!==void 0?e:1e3,function(u){const c=Date.now(),f=r[s];a||(a=c),n[i]=u,r[i]=c;let p=s,m=0;for(;p!==i;)m+=n[p++],p=p%t;if(i=(i+1)%t,i===s&&(s=(s+1)%t),c-a<e)return;const g=f&&c-f;return g?Math.round(m*1e3/g):void 0}}function dJ(t,e){let n=0,r=1e3/e,i,s;const a=(c,f=Date.now())=>{n=f,i=null,s&&(clearTimeout(s),s=null),t.apply(null,c)};return[(...c)=>{const f=Date.now(),p=f-n;p>=r?a(c,f):(i=c,s||(s=setTimeout(()=>{s=null,a(i)},r-p)))},()=>i&&a(i)]}const vh=(t,e,n=3)=>{let r=0;const i=cJ(50,250);return dJ(s=>{const a=s.loaded,l=s.lengthComputable?s.total:void 0,u=a-r,c=i(u),f=a<=l;r=a;const p={loaded:a,total:l,progress:l?a/l:void 0,bytes:u,rate:c||void 0,estimated:c&&l&&f?(l-a)/c:void 0,event:s,lengthComputable:l!=null,[e?"download":"upload"]:!0};t(p)},n)},UE=(t,e)=>{const n=t!=null;return[r=>e[0]({lengthComputable:n,total:t,loaded:r}),e[1]]},WE=t=>(...e)=>de.asap(()=>t(...e)),fJ=Wn.hasStandardBrowserEnv?((t,e)=>n=>(n=new URL(n,Wn.origin),t.protocol===n.protocol&&t.host===n.host&&(e||t.port===n.port)))(new URL(Wn.origin),Wn.navigator&&/(msie|trident)/i.test(Wn.navigator.userAgent)):()=>!0,pJ=Wn.hasStandardBrowserEnv?{write(t,e,n,r,i,s){const a=[t+"="+encodeURIComponent(e)];de.isNumber(n)&&a.push("expires="+new Date(n).toGMTString()),de.isString(r)&&a.push("path="+r),de.isString(i)&&a.push("domain="+i),s===!0&&a.push("secure"),document.cookie=a.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function hJ(t){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(t)}function mJ(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}function jE(t,e,n){let r=!hJ(e);return t&&(r||n==!1)?mJ(t,e):e}const qE=t=>t instanceof fr?{...t}:t;function Ma(t,e){e=e||{};const n={};function r(c,f,p,m){return de.isPlainObject(c)&&de.isPlainObject(f)?de.merge.call({caseless:m},c,f):de.isPlainObject(f)?de.merge({},f):de.isArray(f)?f.slice():f}function i(c,f,p,m){if(de.isUndefined(f)){if(!de.isUndefined(c))return r(void 0,c,p,m)}else return r(c,f,p,m)}function s(c,f){if(!de.isUndefined(f))return r(void 0,f)}function a(c,f){if(de.isUndefined(f)){if(!de.isUndefined(c))return r(void 0,c)}else return r(void 0,f)}function l(c,f,p){if(p in e)return r(c,f);if(p in t)return r(void 0,c)}const u={url:s,method:s,data:s,baseURL:a,transformRequest:a,transformResponse:a,paramsSerializer:a,timeout:a,timeoutMessage:a,withCredentials:a,withXSRFToken:a,adapter:a,responseType:a,xsrfCookieName:a,xsrfHeaderName:a,onUploadProgress:a,onDownloadProgress:a,decompress:a,maxContentLength:a,maxBodyLength:a,beforeRedirect:a,transport:a,httpAgent:a,httpsAgent:a,cancelToken:a,socketPath:a,responseEncoding:a,validateStatus:l,headers:(c,f,p)=>i(qE(c),qE(f),p,!0)};return de.forEach(Object.keys(Object.assign({},t,e)),function(f){const p=u[f]||i,m=p(t[f],e[f],f);de.isUndefined(m)&&p!==l||(n[f]=m)}),n}const KE=t=>{const e=Ma({},t);let{data:n,withXSRFToken:r,xsrfHeaderName:i,xsrfCookieName:s,headers:a,auth:l}=e;e.headers=a=fr.from(a),e.url=DE(jE(e.baseURL,e.url,e.allowAbsoluteUrls),t.params,t.paramsSerializer),l&&a.set("Authorization","Basic "+btoa((l.username||"")+":"+(l.password?unescape(encodeURIComponent(l.password)):"")));let u;if(de.isFormData(n)){if(Wn.hasStandardBrowserEnv||Wn.hasStandardBrowserWebWorkerEnv)a.setContentType(void 0);else if((u=a.getContentType())!==!1){const[c,...f]=u?u.split(";").map(p=>p.trim()).filter(Boolean):[];a.setContentType([c||"multipart/form-data",...f].join("; "))}}if(Wn.hasStandardBrowserEnv&&(r&&de.isFunction(r)&&(r=r(e)),r||r!==!1&&fJ(e.url))){const c=i&&s&&pJ.read(s);c&&a.set(i,c)}return e},gJ=typeof XMLHttpRequest<"u"&&function(t){return new Promise(function(n,r){const i=KE(t);let s=i.data;const a=fr.from(i.headers).normalize();let{responseType:l,onUploadProgress:u,onDownloadProgress:c}=i,f,p,m,g,b;function v(){g&&g(),b&&b(),i.cancelToken&&i.cancelToken.unsubscribe(f),i.signal&&i.signal.removeEventListener("abort",f)}let y=new XMLHttpRequest;y.open(i.method.toUpperCase(),i.url,!0),y.timeout=i.timeout;function x(){if(!y)return;const k=fr.from("getAllResponseHeaders"in y&&y.getAllResponseHeaders()),_={data:!l||l==="text"||l==="json"?y.responseText:y.response,status:y.status,statusText:y.statusText,headers:k,config:t,request:y};zE(function(A){n(A),v()},function(A){r(A),v()},_),y=null}"onloadend"in y?y.onloadend=x:y.onreadystatechange=function(){!y||y.readyState!==4||y.status===0&&!(y.responseURL&&y.responseURL.indexOf("file:")===0)||setTimeout(x)},y.onabort=function(){y&&(r(new ut("Request aborted",ut.ECONNABORTED,t,y)),y=null)},y.onerror=function(){r(new ut("Network Error",ut.ERR_NETWORK,t,y)),y=null},y.ontimeout=function(){let C=i.timeout?"timeout of "+i.timeout+"ms exceeded":"timeout exceeded";const _=i.transitional||VE;i.timeoutErrorMessage&&(C=i.timeoutErrorMessage),r(new ut(C,_.clarifyTimeoutError?ut.ETIMEDOUT:ut.ECONNABORTED,t,y)),y=null},s===void 0&&a.setContentType(null),"setRequestHeader"in y&&de.forEach(a.toJSON(),function(C,_){y.setRequestHeader(_,C)}),de.isUndefined(i.withCredentials)||(y.withCredentials=!!i.withCredentials),l&&l!=="json"&&(y.responseType=i.responseType),c&&([m,b]=vh(c,!0),y.addEventListener("progress",m)),u&&y.upload&&([p,g]=vh(u),y.upload.addEventListener("progress",p),y.upload.addEventListener("loadend",g)),(i.cancelToken||i.signal)&&(f=k=>{y&&(r(!k||k.type?new ql(null,t,y):k),y.abort(),y=null)},i.cancelToken&&i.cancelToken.subscribe(f),i.signal&&(i.signal.aborted?f():i.signal.addEventListener("abort",f)));const E=uJ(i.url);if(E&&Wn.protocols.indexOf(E)===-1){r(new ut("Unsupported protocol "+E+":",ut.ERR_BAD_REQUEST,t));return}y.send(s||null)})},bJ=(t,e)=>{const{length:n}=t=t?t.filter(Boolean):[];if(e||n){let r=new AbortController,i;const s=function(c){if(!i){i=!0,l();const f=c instanceof Error?c:this.reason;r.abort(f instanceof ut?f:new ql(f instanceof Error?f.message:f))}};let a=e&&setTimeout(()=>{a=null,s(new ut(`timeout ${e} of ms exceeded`,ut.ETIMEDOUT))},e);const l=()=>{t&&(a&&clearTimeout(a),a=null,t.forEach(c=>{c.unsubscribe?c.unsubscribe(s):c.removeEventListener("abort",s)}),t=null)};t.forEach(c=>c.addEventListener("abort",s));const{signal:u}=r;return u.unsubscribe=()=>de.asap(l),u}},vJ=function*(t,e){let n=t.byteLength;if(n<e){yield t;return}let r=0,i;for(;r<n;)i=r+e,yield t.slice(r,i),r=i},yJ=async function*(t,e){for await(const n of wJ(t))yield*vJ(n,e)},wJ=async function*(t){if(t[Symbol.asyncIterator]){yield*t;return}const e=t.getReader();try{for(;;){const{done:n,value:r}=await e.read();if(n)break;yield r}}finally{await e.cancel()}},GE=(t,e,n,r)=>{const i=yJ(t,e);let s=0,a,l=u=>{a||(a=!0,r&&r(u))};return new ReadableStream({async pull(u){try{const{done:c,value:f}=await i.next();if(c){l(),u.close();return}let p=f.byteLength;if(n){let m=s+=p;n(m)}u.enqueue(new Uint8Array(f))}catch(c){throw l(c),c}},cancel(u){return l(u),i.return()}},{highWaterMark:2})},yh=typeof fetch=="function"&&typeof Request=="function"&&typeof Response=="function",XE=yh&&typeof ReadableStream=="function",xJ=yh&&(typeof TextEncoder=="function"?(t=>e=>t.encode(e))(new TextEncoder):async t=>new Uint8Array(await new Response(t).arrayBuffer())),YE=(t,...e)=>{try{return!!t(...e)}catch{return!1}},CJ=XE&&YE(()=>{let t=!1;const e=new Request(Wn.origin,{body:new ReadableStream,method:"POST",get duplex(){return t=!0,"half"}}).headers.has("Content-Type");return t&&!e}),JE=64*1024,vv=XE&&YE(()=>de.isReadableStream(new Response("").body)),wh={stream:vv&&(t=>t.body)};yh&&(t=>{["text","arrayBuffer","blob","formData","stream"].forEach(e=>{!wh[e]&&(wh[e]=de.isFunction(t[e])?n=>n[e]():(n,r)=>{throw new ut(`Response type '${e}' is not supported`,ut.ERR_NOT_SUPPORT,r)})})})(new Response);const EJ=async t=>{if(t==null)return 0;if(de.isBlob(t))return t.size;if(de.isSpecCompliantForm(t))return(await new Request(Wn.origin,{method:"POST",body:t}).arrayBuffer()).byteLength;if(de.isArrayBufferView(t)||de.isArrayBuffer(t))return t.byteLength;if(de.isURLSearchParams(t)&&(t=t+""),de.isString(t))return(await xJ(t)).byteLength},kJ=async(t,e)=>{const n=de.toFiniteNumber(t.getContentLength());return n??EJ(e)},yv={http:qY,xhr:gJ,fetch:yh&&(async t=>{let{url:e,method:n,data:r,signal:i,cancelToken:s,timeout:a,onDownloadProgress:l,onUploadProgress:u,responseType:c,headers:f,withCredentials:p="same-origin",fetchOptions:m}=KE(t);c=c?(c+"").toLowerCase():"text";let g=bJ([i,s&&s.toAbortSignal()],a),b;const v=g&&g.unsubscribe&&(()=>{g.unsubscribe()});let y;try{if(u&&CJ&&n!=="get"&&n!=="head"&&(y=await kJ(f,r))!==0){let _=new Request(e,{method:"POST",body:r,duplex:"half"}),T;if(de.isFormData(r)&&(T=_.headers.get("content-type"))&&f.setContentType(T),_.body){const[A,D]=UE(y,vh(WE(u)));r=GE(_.body,JE,A,D)}}de.isString(p)||(p=p?"include":"omit");const x="credentials"in Request.prototype;b=new Request(e,{...m,signal:g,method:n.toUpperCase(),headers:f.normalize().toJSON(),body:r,duplex:"half",credentials:x?p:void 0});let E=await fetch(b);const k=vv&&(c==="stream"||c==="response");if(vv&&(l||k&&v)){const _={};["status","statusText","headers"].forEach(M=>{_[M]=E[M]});const T=de.toFiniteNumber(E.headers.get("content-length")),[A,D]=l&&UE(T,vh(WE(l),!0))||[];E=new Response(GE(E.body,JE,A,()=>{D&&D(),v&&v()}),_)}c=c||"text";let C=await wh[de.findKey(wh,c)||"text"](E,t);return!k&&v&&v(),await new Promise((_,T)=>{zE(_,T,{data:C,headers:fr.from(E.headers),status:E.status,statusText:E.statusText,config:t,request:b})})}catch(x){throw v&&v(),x&&x.name==="TypeError"&&/fetch/i.test(x.message)?Object.assign(new ut("Network Error",ut.ERR_NETWORK,t,b),{cause:x.cause||x}):ut.from(x,x&&x.code,t,b)}})};de.forEach(yv,(t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch{}Object.defineProperty(t,"adapterName",{value:e})}});const ZE=t=>`- ${t}`,SJ=t=>de.isFunction(t)||t===null||t===!1,QE={getAdapter:t=>{t=de.isArray(t)?t:[t];const{length:e}=t;let n,r;const i={};for(let s=0;s<e;s++){n=t[s];let a;if(r=n,!SJ(n)&&(r=yv[(a=String(n)).toLowerCase()],r===void 0))throw new ut(`Unknown adapter '${a}'`);if(r)break;i[a||"#"+s]=r}if(!r){const s=Object.entries(i).map(([l,u])=>`adapter ${l} `+(u===!1?"is not supported by the environment":"is not available in the build"));let a=e?s.length>1?`since :
|
|
334
334
|
`+s.map(ZE).join(`
|
|
335
335
|
`):" "+ZE(s[0]):"as no adapter specified";throw new ut("There is no suitable adapter to dispatch the request "+a,"ERR_NOT_SUPPORT")}return r},adapters:yv};function wv(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new ql(null,t)}function NE(t){return wv(t),t.headers=fr.from(t.headers),t.data=bv.call(t,t.transformRequest),["post","put","patch"].indexOf(t.method)!==-1&&t.headers.setContentType("application/x-www-form-urlencoded",!1),QE.getAdapter(t.adapter||Hc.adapter)(t).then(function(r){return wv(t),r.data=bv.call(t,t.transformResponse,r),r.headers=fr.from(r.headers),r},function(r){return HE(r)||(wv(t),r&&r.response&&(r.response.data=bv.call(t,t.transformResponse,r.response),r.response.headers=fr.from(r.response.headers))),Promise.reject(r)})}const ek="1.8.4",xh={};["object","boolean","number","function","string","symbol"].forEach((t,e)=>{xh[t]=function(r){return typeof r===t||"a"+(e<1?"n ":" ")+t}});const tk={};xh.transitional=function(e,n,r){function i(s,a){return"[Axios v"+ek+"] Transitional option '"+s+"'"+a+(r?". "+r:"")}return(s,a,l)=>{if(e===!1)throw new ut(i(a," has been removed"+(n?" in "+n:"")),ut.ERR_DEPRECATED);return n&&!tk[a]&&(tk[a]=!0,console.warn(i(a," has been deprecated since v"+n+" and will be removed in the near future"))),e?e(s,a,l):!0}},xh.spelling=function(e){return(n,r)=>(console.warn(`${r} is likely a misspelling of ${e}`),!0)};function _J(t,e,n){if(typeof t!="object")throw new ut("options must be an object",ut.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let i=r.length;for(;i-- >0;){const s=r[i],a=e[s];if(a){const l=t[s],u=l===void 0||a(l,s,t);if(u!==!0)throw new ut("option "+s+" must be "+u,ut.ERR_BAD_OPTION_VALUE);continue}if(n!==!0)throw new ut("Unknown option "+s,ut.ERR_BAD_OPTION)}}const Ch={assertOptions:_J,validators:xh},Zo=Ch.validators;let Oa=class{constructor(e){this.defaults=e,this.interceptors={request:new PE,response:new PE}}async request(e,n){try{return await this._request(e,n)}catch(r){if(r instanceof Error){let i={};Error.captureStackTrace?Error.captureStackTrace(i):i=new Error;const s=i.stack?i.stack.replace(/^.+\n/,""):"";try{r.stack?s&&!String(r.stack).endsWith(s.replace(/^.+\n.+\n/,""))&&(r.stack+=`
|
|
336
|
-
`+s):r.stack=s}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Ma(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&Ch.assertOptions(r,{silentJSONParsing:Zo.transitional(Zo.boolean),forcedJSONParsing:Zo.transitional(Zo.boolean),clarifyTimeoutError:Zo.transitional(Zo.boolean)},!1),i!=null&&(de.isFunction(i)?n.paramsSerializer={serialize:i}:Ch.assertOptions(i,{encode:Zo.function,serialize:Zo.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ch.assertOptions(n,{baseUrl:Zo.spelling("baseURL"),withXsrfToken:Zo.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=s&&de.merge(s.common,s[n.method]);s&&de.forEach(["delete","get","head","post","put","patch","common"],b=>{delete s[b]}),n.headers=fr.concat(a,s);const l=[];let u=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(n)===!1||(u=u&&v.synchronous,l.unshift(v.fulfilled,v.rejected))});const c=[];this.interceptors.response.forEach(function(v){c.push(v.fulfilled,v.rejected)});let f,p=0,m;if(!u){const b=[NE.bind(this),void 0];for(b.unshift.apply(b,l),b.push.apply(b,c),m=b.length,f=Promise.resolve(n);p<m;)f=f.then(b[p++],b[p++]);return f}m=l.length;let g=n;for(p=0;p<m;){const b=l[p++],v=l[p++];try{g=b(g)}catch(y){v.call(this,y);break}}try{f=NE.call(this,g)}catch(b){return Promise.reject(b)}for(p=0,m=c.length;p<m;)f=f.then(c[p++],c[p++]);return f}getUri(e){e=Ma(this.defaults,e);const n=jE(e.baseURL,e.url,e.allowAbsoluteUrls);return DE(n,e.params,e.paramsSerializer)}};de.forEach(["delete","get","head","options"],function(e){Oa.prototype[e]=function(n,r){return this.request(Ma(r||{},{method:e,url:n,data:(r||{}).data}))}}),de.forEach(["post","put","patch"],function(e){function n(r){return function(s,a,l){return this.request(Ma(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}Oa.prototype[e]=n(),Oa.prototype[e+"Form"]=n(!0)});let TJ=class X9{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const a=new Promise(l=>{r.subscribe(l),s=l}).then(i);return a.cancel=function(){r.unsubscribe(s)},a},e(function(s,a,l){r.reason||(r.reason=new ql(s,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new X9(function(i){e=i}),cancel:e}}};function AJ(t){return function(n){return t.apply(null,n)}}function MJ(t){return de.isObject(t)&&t.isAxiosError===!0}const xv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(xv).forEach(([t,e])=>{xv[e]=t});function nk(t){const e=new Oa(t),n=xE(Oa.prototype.request,e);return de.extend(n,Oa.prototype,e,{allOwnKeys:!0}),de.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return nk(Ma(t,i))},n}const an=nk(Hc);an.Axios=Oa,an.CanceledError=ql,an.CancelToken=TJ,an.isCancel=HE,an.VERSION=ek,an.toFormData=gh,an.AxiosError=ut,an.Cancel=an.CanceledError,an.all=function(e){return Promise.all(e)},an.spread=AJ,an.isAxiosError=MJ,an.mergeConfig=Ma,an.AxiosHeaders=fr,an.formToJSON=t=>FE(de.isHTMLForm(t)?new FormData(t):t),an.getAdapter=QE.getAdapter,an.HttpStatusCode=xv,an.default=an;const{Axios:zce,AxiosError:Uce,CanceledError:Wce,isCancel:jce,CancelToken:qce,VERSION:Kce,all:Gce,Cancel:Xce,isAxiosError:Yce,spread:Jce,toFormData:Zce,AxiosHeaders:Qce,HttpStatusCode:Nce,formToJSON:ede,getAdapter:tde,mergeConfig:nde}=an;function OJ(t){let e=t;for(;e&&e!==document.body;){if(e.nodeType===1){const n=e;if(n.id==="editor-panel")return n}e=e.parentNode}return null}const Eh=t=>{var n;if(!t)return!0;const e=document.createElement("div");return e.innerHTML=t,((n=e==null?void 0:e.textContent)==null?void 0:n.trim())===""},BJ=t=>{if(!t)return"";const{from:e,to:n}=t.state.selection,r=t.state.doc.cut(e,n),s=Vr.fromSchema(t.schema).serializeFragment(r.content),a=document.createElement("div");return a.appendChild(s),a.innerHTML},IJ=t=>/<\/?[a-z][\s\S]*>/i.test(t);var pr=(t=>(t.TOGGLE_SUPER_TEXT="toggle-super-text",t.SUPER_TEXT_UPDATE_POSITION="SUPER_TEXT_UPDATE_POSITION",t.RENDER_SUPER_TEXT="RENDER_SUPER_TEXT",t.SUPER_VIEW_PAGE="SUPER_VIEW_PAGE",t.INCREASE_DECREASE_FONTSIZE="increase-decrease-fontsize",t))(pr||{});const rk=8;function RJ(t,e){const n=o.ref(!1);let r=!1,i=null,s=null,a=null,l=null,u=0,c=0;function f(E){const k=E.cloneNode(!0);return k.style.position="fixed",k.style.pointerEvents="none",k.style.opacity="0.9",k.style.zIndex="9999",k.style.transform="translate(-50%, -50%)",k.style.left="0px",k.style.top="0px",document.body.appendChild(k),k}function p(){s&&s.parentElement&&s.parentElement.removeChild(s),s=null}function m(){try{if(typeof t.getPos=="function"){const E=t.getPos();if(typeof E=="number"&&E>=0)return E}}catch{}return null}function g(E,k){n.value||(l=m(),document.body.style.userSelect="none",document.body.style.touchAction="none",k&&(s=f(k),s.style.left=`${E.clientX}px`,s.style.top=`${E.clientY}px`),n.value=!0,r=!1,a=null)}function b(){i=null,l=null,a=null,r=!1,n.value=!1,p(),document.body.style.userSelect="",document.body.style.touchAction=""}function v(E){if(o.unref(e)||n.value)return;const k=E.changedTouches[0];i=k.identifier,u=k.clientX,c=k.clientY,r=!0,l=null,a=null}function y(E){var A;if(!r&&!n.value||i===null)return;const k=Array.from(E.changedTouches).find(D=>D.identifier===i);if(!k)return;const C=k.clientX-u,_=k.clientY-c,T=C*C+_*_;if(!n.value&&r&&T>=rk*rk){const D=E.currentTarget||E.target||null;g(k,D)}if(n.value){s&&(s.style.left=`${k.clientX}px`,s.style.top=`${k.clientY}px`);try{const D=(A=t.editor)==null?void 0:A.view;if(!D){a=null;return}const M=D.posAtCoords({left:k.clientX,top:k.clientY});M&&typeof M.pos=="number"?a=M.pos:a=null}catch{a=null}}}async function x(E){var k;if(n.value){if(document.body.style.userSelect="",document.body.style.touchAction="",p(),n.value=!1,l===null||a===null){b();return}const C=(k=t.editor)==null?void 0:k.view;if(!C){b();return}const _=C.state.doc.nodeAt(l);if(!_){b();return}const T=_.nodeSize,A=l,D=A+T,M=a;if(M>=A&&M<=D){b();return}let B=M;M>A&&(B=M-T);const F=C.state.doc.content.size;B<0&&(B=0),B>F&&(B=F);const H=_.type.create(_.attrs),X=C.state.tr;X.delete(A,D),X.insert(B,H),C.dispatch(X),b();return}if(r){b();return}}return{onTouchStart:v,onTouchMove:y,onTouchEnd:x}}function LJ(...t){return gy(Om(t))}const DJ=["innerHTML"],PJ=["book-mark-node-id","book-mark-content","node-id","element-id","line-id"],VJ=o.defineComponent({__name:"SuperText",props:na,setup(t){const e=t,n=o.ref(!1),r=o.inject("isMobile",!1),i=o.computed(()=>e.editor.storage.superText.enable),s=Qe.useEventBus(pr.RENDER_SUPER_TEXT),{onTouchStart:a,onTouchMove:l,onTouchEnd:u}=RJ(e,i),c=o.ref(null),f=o.ref(!1),p=()=>{f.value=!0},m=()=>{f.value=!1};o.watch(f,()=>{f.value&&_(c.value)});const g={mouseenter:C,mouseleave:_,dragstart:p,dragend:m},b={touchstart:a,touchmove:l,touchend:u,touchcancel:u},v=o.computed(()=>r?b:g),y=o.computed(()=>{const B=e.getPos(),F=e.editor.state.doc.resolve(B);for(let H=F.depth;H>0;H--){const X=F.node(H);if(X.type.name==="paragraph")return X}return null}),x=o.computed(()=>{var B;return((B=y.value)==null?void 0:B.attrs.id)||""}),E=o.inject("canEditSuper",o.ref(!0));function k(B){var $,I;if(Eh(B)){T();return}const F=e.getPos(),H=($=e.editor)==null?void 0:$.state.doc.nodeAt(F),X=B.trim(),{[nt.ELEMENT_ID]:ee,...V}=(H==null?void 0:H.attrs)||{};(I=e.editor)==null||I.view.dispatch(e.editor.state.tr.setNodeMarkup(F,void 0,{...V,[nt.TEXT]:X})),requestAnimationFrame(()=>{e.editor.commands.setTextSelection(F+1),e.editor.view.focus()})}function C(B){c.value=B;const F=e.node.attrs[nt.TEXT],H=e.node.attrs[nt.ID],ee={lineId:B.target.querySelector(`[node-id="${H}"]`).getAttribute("line-id"),dataId:H,text:F};s.emit({action:"hover",payload:ee})}function _(B){const F=e.node.attrs[nt.ID],X={lineId:B==null?void 0:B.target.querySelector(`[node-id="${F}"]`).getAttribute("line-id"),dataId:F,text:""};s.emit({action:"hover",payload:X}),c.value=null}function T(){const{getPos:B,node:F,editor:H}=e,X=B(),ee=X+1;H.commands.deleteRange({from:X,to:ee})}function A(){if(!E.value)return;const{attributes:B}=e.editor.options.editorProps;if(B&&B.id===ur.COMMENT){const F=document.getElementById(ur.COMMENT);if((F==null?void 0:F.getAttribute(ur.DISABLE_SUPER_INPUT))==="true")return}e.editor.view.dom.blur(),n.value=!0}function D(){e.editor.commands.setSuperTextContent(e.node.attrs[nt.TEXT],e.node.attrs[nt.POSITION]),e.editor.commands.toggleSuperInputMoblie()}o.watch(i,B=>{r&&(e.editor.setEditable(!B),B?e.editor.view.dom.classList.add("super-text-view-mode"):e.editor.view.dom.classList.remove("super-text-view-mode"))});const M=o.computed(()=>`{${e.node.attrs[nt.TEXT].replace(/<\/p>\s*<p>/g,"<br/>").replace(/<\/?p[^>]*>/g,"").trim()}}`);return(B,F)=>{const H=bn,X=ov,ee=rv,V=nv,$=tv,I=Wc;return o.openBlock(),o.createBlock(o.unref(ta),o.mergeProps({as:"span",class:o.unref(LJ)("text-inherit super-text shrink-0 inline-flex items-center justify-center",o.unref(r)&&i.value&&"block"),"data-drag-handle":"",draggable:o.unref(E)},o.toHandlers(v.value)),{default:o.withCtx(()=>[o.unref(r)&&!i.value?(o.openBlock(),o.createElementBlock("button",{key:0,onClick:o.withModifiers(D,["stop"]),class:"w-6 inline-flex justify-center rounded text-ed-red-500 active:bg-ed-accent"},[o.createVNode(o.unref(Ot),{name:"fileEdit2",class:"w-5 h-5"})])):o.createCommentVNode("",!0),o.unref(r)&&i.value?(o.openBlock(),o.createElementBlock("div",{key:1,innerHTML:M.value,onClick:o.withModifiers(D,["stop"]),class:"super-text-view-mode-item"},null,8,DJ)):o.createCommentVNode("",!0),o.unref(r)?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock($,{key:2},{default:o.withCtx(()=>[o.createVNode(X,{as:"template",class:"relative",disabled:!o.unref(E)},{default:o.withCtx(()=>[o.createVNode(H,{class:o.normalizeClass([{"pointer-events-none":!o.unref(E)},"!p-0 !m-0 !h-fit"]),variant:"ghost",onDblclick:o.withModifiers(A,["stop"])},{default:o.withCtx(()=>[o.createVNode(o.unref(Ot),{name:"fileEdit"}),o.createElementVNode("div",{ref:"bookMarkRef","book-mark-node-id":e.node.attrs[o.unref(nt).ID],"book-mark-content":e.node.attrs[o.unref(nt).TEXT],"node-id":e.node.attrs[o.unref(nt).ID],"element-id":e.node.attrs[o.unref(nt).ELEMENT_ID],"line-id":x.value},null,8,PJ)]),_:1},8,["class"])]),_:1},8,["disabled"]),o.createVNode(V,null,{default:o.withCtx(()=>[o.createVNode(ee,{onSelect:F[0]||(F[0]=U=>n.value=!0)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(B.$t("editor.super.edit")),1)]),_:1}),o.createVNode(ee,{onSelect:T},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(B.$t("editor.super.delete")),1)]),_:1})]),_:1})]),_:1})),o.unref(r)?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(I,{key:3,open:n.value,editor:e.editor,"super-text-init":e.node.attrs[o.unref(nt).TEXT],"super-text-element-id":e.node.attrs[o.unref(nt).ELEMENT_ID],onClose:F[1]||(F[1]=U=>n.value=!1),onSave:k},null,8,["open","editor","super-text-init","super-text-element-id"]))]),_:1},16,["class","draggable"])}}}),FJ=new tt({props:{handleKeyDown(t,e){var n;if(e.key==="Backspace"){const{state:r,dispatch:i}=t,{$from:s}=r.selection;if(s.parentOffset===1){const u=s.nodeAfter;if(u&&u.type.name==="superText"){const c=r.tr;c.delete(s.pos-1,s.pos);const f=r.schema.text("");return c.insert(s.pos-1,me.from(f)),c.setSelection(Le.create(c.doc,s.pos)),i(c),e.preventDefault(),!0}}const a=s.nodeBefore,l=s.nodeAfter;if(a&&a.isText&&((n=a.text)==null?void 0:n.length)===1&&l&&l.type.name==="superText"){const u=s.parent.childBefore(s.parentOffset-1).node;if(u&&u.type.name==="superText"){const c=r.tr;return c.delete(s.pos-1,s.pos),c.setSelection(Le.create(c.doc,s.pos-1)),i(c),e.preventDefault(),!0}}}return!1}}}),$J=new tt({appendTransaction(t,e,n){const r=new Set;let i=n.tr,s=!1;return n.doc.descendants((a,l)=>{if(a.type.name===Uc){const u=a.attrs[nt.ID];if(!u||r.has(u)){const c=Yr();i=i.setNodeMarkup(l,void 0,{...a.attrs,[nt.ID]:c}),s=!0,r.add(c)}else r.add(u)}}),s?i:null}}),Uc="superText",ok={UPDATE:"superTextUpdate"},ik=Lt.create({name:"superText",inline:!0,group:"inline",selectable:!1,defining:!0,draggable:!0,addStorage(){return{enable:!0,isShowSuperInputMoblie:!1,view:!0,items:[],superInputModal:this.options.superInputModal,toggleSuperViewMobileCallBack:this.options.toggleSuperViewMobileCallBack,bottomSheetComponent:this.options.bottomSheetComponent,addToast:this.options.addToast,superTextContent:"",superTextPosition:""}},addOptions(){return{specialCharModal:null,button:({editor:t,t:e,isMobile:n})=>n?[{component:Ge,componentProps:{action:()=>{t.commands.toggleSuperInputMoblie()},isActive:()=>{},icon:"fileEdit",title:e("editor.menubar.menu.insertSuper"),tooltip:e("editor.menubar.menu.insertSuper"),customClass:"whitespace-nowrap !bg-ed-blue active:!bg-ed-blue/90 !transition-none !text-white !font-normal rounded-[3px] h-[26px] ml-auto",customClassTooltip:"ml-auto"}}]:[{component:Ge,componentProps:{action:()=>t.commands.toggleSuperTextView(),isActive:()=>t.storage.superText.enable,title:e("editor.menubar.menu.superView"),customClass:`whitespace-nowrap !text-white !font-normal rounded-[3px] h-[26px]
|
|
336
|
+
`+s):r.stack=s}catch{}}throw r}}_request(e,n){typeof e=="string"?(n=n||{},n.url=e):n=e||{},n=Ma(this.defaults,n);const{transitional:r,paramsSerializer:i,headers:s}=n;r!==void 0&&Ch.assertOptions(r,{silentJSONParsing:Zo.transitional(Zo.boolean),forcedJSONParsing:Zo.transitional(Zo.boolean),clarifyTimeoutError:Zo.transitional(Zo.boolean)},!1),i!=null&&(de.isFunction(i)?n.paramsSerializer={serialize:i}:Ch.assertOptions(i,{encode:Zo.function,serialize:Zo.function},!0)),n.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?n.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:n.allowAbsoluteUrls=!0),Ch.assertOptions(n,{baseUrl:Zo.spelling("baseURL"),withXsrfToken:Zo.spelling("withXSRFToken")},!0),n.method=(n.method||this.defaults.method||"get").toLowerCase();let a=s&&de.merge(s.common,s[n.method]);s&&de.forEach(["delete","get","head","post","put","patch","common"],b=>{delete s[b]}),n.headers=fr.concat(a,s);const l=[];let u=!0;this.interceptors.request.forEach(function(v){typeof v.runWhen=="function"&&v.runWhen(n)===!1||(u=u&&v.synchronous,l.unshift(v.fulfilled,v.rejected))});const c=[];this.interceptors.response.forEach(function(v){c.push(v.fulfilled,v.rejected)});let f,p=0,m;if(!u){const b=[NE.bind(this),void 0];for(b.unshift.apply(b,l),b.push.apply(b,c),m=b.length,f=Promise.resolve(n);p<m;)f=f.then(b[p++],b[p++]);return f}m=l.length;let g=n;for(p=0;p<m;){const b=l[p++],v=l[p++];try{g=b(g)}catch(y){v.call(this,y);break}}try{f=NE.call(this,g)}catch(b){return Promise.reject(b)}for(p=0,m=c.length;p<m;)f=f.then(c[p++],c[p++]);return f}getUri(e){e=Ma(this.defaults,e);const n=jE(e.baseURL,e.url,e.allowAbsoluteUrls);return DE(n,e.params,e.paramsSerializer)}};de.forEach(["delete","get","head","options"],function(e){Oa.prototype[e]=function(n,r){return this.request(Ma(r||{},{method:e,url:n,data:(r||{}).data}))}}),de.forEach(["post","put","patch"],function(e){function n(r){return function(s,a,l){return this.request(Ma(l||{},{method:e,headers:r?{"Content-Type":"multipart/form-data"}:{},url:s,data:a}))}}Oa.prototype[e]=n(),Oa.prototype[e+"Form"]=n(!0)});let TJ=class X9{constructor(e){if(typeof e!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(s){n=s});const r=this;this.promise.then(i=>{if(!r._listeners)return;let s=r._listeners.length;for(;s-- >0;)r._listeners[s](i);r._listeners=null}),this.promise.then=i=>{let s;const a=new Promise(l=>{r.subscribe(l),s=l}).then(i);return a.cancel=function(){r.unsubscribe(s)},a},e(function(s,a,l){r.reason||(r.reason=new ql(s,a,l),n(r.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){if(this.reason){e(this.reason);return}this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const n=this._listeners.indexOf(e);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const e=new AbortController,n=r=>{e.abort(r)};return this.subscribe(n),e.signal.unsubscribe=()=>this.unsubscribe(n),e.signal}static source(){let e;return{token:new X9(function(i){e=i}),cancel:e}}};function AJ(t){return function(n){return t.apply(null,n)}}function MJ(t){return de.isObject(t)&&t.isAxiosError===!0}const xv={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(xv).forEach(([t,e])=>{xv[e]=t});function nk(t){const e=new Oa(t),n=xE(Oa.prototype.request,e);return de.extend(n,Oa.prototype,e,{allOwnKeys:!0}),de.extend(n,e,null,{allOwnKeys:!0}),n.create=function(i){return nk(Ma(t,i))},n}const an=nk(Hc);an.Axios=Oa,an.CanceledError=ql,an.CancelToken=TJ,an.isCancel=HE,an.VERSION=ek,an.toFormData=gh,an.AxiosError=ut,an.Cancel=an.CanceledError,an.all=function(e){return Promise.all(e)},an.spread=AJ,an.isAxiosError=MJ,an.mergeConfig=Ma,an.AxiosHeaders=fr,an.formToJSON=t=>FE(de.isHTMLForm(t)?new FormData(t):t),an.getAdapter=QE.getAdapter,an.HttpStatusCode=xv,an.default=an;const{Axios:zce,AxiosError:Uce,CanceledError:Wce,isCancel:jce,CancelToken:qce,VERSION:Kce,all:Gce,Cancel:Xce,isAxiosError:Yce,spread:Jce,toFormData:Zce,AxiosHeaders:Qce,HttpStatusCode:Nce,formToJSON:ede,getAdapter:tde,mergeConfig:nde}=an;function OJ(t){let e=t;for(;e&&e!==document.body;){if(e.nodeType===1){const n=e;if(n.id==="editor-panel")return n}e=e.parentNode}return null}const Eh=t=>{var n;if(!t)return!0;const e=document.createElement("div");return e.innerHTML=t,((n=e==null?void 0:e.textContent)==null?void 0:n.trim())===""},BJ=t=>{if(!t)return"";const{from:e,to:n}=t.state.selection,r=t.state.doc.cut(e,n),s=Vr.fromSchema(t.schema).serializeFragment(r.content),a=document.createElement("div");return a.appendChild(s),a.innerHTML},IJ=t=>/<\/?[a-z][\s\S]*>/i.test(t);var pr=(t=>(t.TOGGLE_SUPER_TEXT="toggle-super-text",t.SUPER_TEXT_UPDATE_POSITION="SUPER_TEXT_UPDATE_POSITION",t.RENDER_SUPER_TEXT="RENDER_SUPER_TEXT",t.SUPER_VIEW_PAGE="SUPER_VIEW_PAGE",t.INCREASE_DECREASE_FONTSIZE="increase-decrease-fontsize",t))(pr||{});const rk=8;function RJ(t,e){const n=o.ref(!1);let r=!1,i=null,s=null,a=null,l=null,u=0,c=0;function f(E){const k=E.cloneNode(!0);return k.style.position="fixed",k.style.pointerEvents="none",k.style.opacity="0.9",k.style.zIndex="9999",k.style.transform="translate(-50%, -50%)",k.style.left="0px",k.style.top="0px",document.body.appendChild(k),k}function p(){s&&s.parentElement&&s.parentElement.removeChild(s),s=null}function m(){try{if(typeof t.getPos=="function"){const E=t.getPos();if(typeof E=="number"&&E>=0)return E}}catch{}return null}function g(E,k){n.value||(l=m(),document.body.style.userSelect="none",document.body.style.touchAction="none",k&&(s=f(k),s.style.left=`${E.clientX}px`,s.style.top=`${E.clientY}px`),n.value=!0,r=!1,a=null)}function b(){i=null,l=null,a=null,r=!1,n.value=!1,p(),document.body.style.userSelect="",document.body.style.touchAction=""}function v(E){if(o.unref(e)||n.value)return;const k=E.changedTouches[0];i=k.identifier,u=k.clientX,c=k.clientY,r=!0,l=null,a=null}function y(E){var A;if(!r&&!n.value||i===null)return;const k=Array.from(E.changedTouches).find(D=>D.identifier===i);if(!k)return;const C=k.clientX-u,_=k.clientY-c,T=C*C+_*_;if(!n.value&&r&&T>=rk*rk){const D=E.currentTarget||E.target||null;g(k,D)}if(n.value){s&&(s.style.left=`${k.clientX}px`,s.style.top=`${k.clientY}px`);try{const D=(A=t.editor)==null?void 0:A.view;if(!D){a=null;return}const M=D.posAtCoords({left:k.clientX,top:k.clientY});M&&typeof M.pos=="number"?a=M.pos:a=null}catch{a=null}}}async function x(E){var k;if(n.value){if(document.body.style.userSelect="",document.body.style.touchAction="",p(),n.value=!1,l===null||a===null){b();return}const C=(k=t.editor)==null?void 0:k.view;if(!C){b();return}const _=C.state.doc.nodeAt(l);if(!_){b();return}const T=_.nodeSize,A=l,D=A+T,M=a;if(M>=A&&M<=D){b();return}let B=M;M>A&&(B=M-T);const F=C.state.doc.content.size;B<0&&(B=0),B>F&&(B=F);const H=_.type.create(_.attrs),X=C.state.tr;X.delete(A,D),X.insert(B,H),C.dispatch(X),b();return}if(r){b();return}}return{onTouchStart:v,onTouchMove:y,onTouchEnd:x}}function LJ(...t){return gy(Om(t))}const DJ=["innerHTML"],PJ=["book-mark-node-id","book-mark-content","node-id","element-id","line-id"],VJ=o.defineComponent({__name:"SuperText",props:na,setup(t){const e=t,n=o.ref(!1),r=o.inject("isMobile",!1),i=o.computed(()=>e.editor.storage.superText.enable),s=Qe.useEventBus(pr.RENDER_SUPER_TEXT),{onTouchStart:a,onTouchMove:l,onTouchEnd:u}=RJ(e,i),c=o.ref(null),f=o.ref(!1),p=()=>{f.value=!0},m=()=>{f.value=!1};o.watch(f,()=>{f.value&&_(c.value)});const g={mouseenter:C,mouseleave:_,dragstart:p,dragend:m},b={touchstart:a,touchmove:l,touchend:u,touchcancel:u},v=o.computed(()=>r?b:g),y=o.computed(()=>{const B=e.getPos(),F=e.editor.state.doc.resolve(B);for(let H=F.depth;H>0;H--){const X=F.node(H);if(X.type.name==="paragraph")return X}return null}),x=o.computed(()=>{var B;return((B=y.value)==null?void 0:B.attrs.id)||""}),E=o.inject("canEditSuper",o.ref(!0));function k(B){var $,I;if(Eh(B)){T();return}const F=e.getPos(),H=($=e.editor)==null?void 0:$.state.doc.nodeAt(F),X=B.trim(),{[nt.ELEMENT_ID]:ee,...V}=(H==null?void 0:H.attrs)||{};(I=e.editor)==null||I.view.dispatch(e.editor.state.tr.setNodeMarkup(F,void 0,{...V,[nt.TEXT]:X})),requestAnimationFrame(()=>{e.editor.commands.setTextSelection(F+1),e.editor.view.focus()})}function C(B){c.value=B;const F=e.node.attrs[nt.TEXT],H=e.node.attrs[nt.ID],ee={lineId:B.target.querySelector(`[node-id="${H}"]`).getAttribute("line-id"),dataId:H,text:F};s.emit({action:"hover",payload:ee})}function _(B){const F=e.node.attrs[nt.ID],X={lineId:B==null?void 0:B.target.querySelector(`[node-id="${F}"]`).getAttribute("line-id"),dataId:F,text:""};s.emit({action:"hover",payload:X}),c.value=null}function T(){const{getPos:B,node:F,editor:H}=e,X=B(),ee=X+1;H.commands.deleteRange({from:X,to:ee})}function A(){if(!E.value)return;const{attributes:B}=e.editor.options.editorProps;if(B&&B.id===ur.COMMENT){const F=document.getElementById(ur.COMMENT);if((F==null?void 0:F.getAttribute(ur.DISABLE_SUPER_INPUT))==="true")return}e.editor.view.dom.blur(),n.value=!0}function D(){e.editor.commands.setSuperTextContent(e.node.attrs[nt.TEXT],e.node.attrs[nt.POSITION]),e.editor.commands.toggleSuperInputMoblie()}o.watch(i,B=>{r&&(e.editor.setEditable(!B),B?e.editor.view.dom.classList.add("super-text-view-mode"):e.editor.view.dom.classList.remove("super-text-view-mode"))});const M=o.computed(()=>`{${e.node.attrs[nt.TEXT].replace(/<\/p>\s*<p>/g,"<br/>").replace(/<\/?p[^>]*>/g,"").trim()}}`);return(B,F)=>{const H=bn,X=ov,ee=rv,V=nv,$=tv,I=Wc;return o.openBlock(),o.createBlock(o.unref(ta),o.mergeProps({as:"span",class:o.unref(LJ)("text-inherit super-text shrink-0 inline-flex items-center justify-center",o.unref(r)&&i.value&&"block"),"data-drag-handle":"",draggable:o.unref(E)},o.toHandlers(v.value)),{default:o.withCtx(()=>[o.unref(r)&&!i.value?(o.openBlock(),o.createElementBlock("button",{key:0,class:"w-6 inline-flex justify-center rounded text-ed-red-500 active:bg-ed-accent",onClick:o.withModifiers(D,["stop"])},[o.createVNode(o.unref(Ot),{name:"fileEdit2",class:"w-5 h-5"})])):o.createCommentVNode("",!0),o.unref(r)&&i.value?(o.openBlock(),o.createElementBlock("div",{key:1,class:"super-text-view-mode-item whitespace-pre-wrap",onClick:o.withModifiers(D,["stop"]),innerHTML:M.value},null,8,DJ)):o.createCommentVNode("",!0),o.unref(r)?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock($,{key:2},{default:o.withCtx(()=>[o.createVNode(X,{as:"template",class:"relative",disabled:!o.unref(E)},{default:o.withCtx(()=>[o.createVNode(H,{class:o.normalizeClass([{"pointer-events-none":!o.unref(E)},"!p-0 !m-0 !h-fit"]),variant:"ghost",onDblclick:o.withModifiers(A,["stop"])},{default:o.withCtx(()=>[o.createVNode(o.unref(Ot),{name:"fileEdit"}),o.createElementVNode("div",{ref:"bookMarkRef","book-mark-node-id":e.node.attrs[o.unref(nt).ID],"book-mark-content":e.node.attrs[o.unref(nt).TEXT],"node-id":e.node.attrs[o.unref(nt).ID],"element-id":e.node.attrs[o.unref(nt).ELEMENT_ID],"line-id":x.value},null,8,PJ)]),_:1},8,["class"])]),_:1},8,["disabled"]),o.createVNode(V,null,{default:o.withCtx(()=>[o.createVNode(ee,{onSelect:F[0]||(F[0]=U=>n.value=!0)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(B.$t("editor.super.edit")),1)]),_:1}),o.createVNode(ee,{onSelect:T},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(B.$t("editor.super.delete")),1)]),_:1})]),_:1})]),_:1})),o.unref(r)?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(I,{key:3,open:n.value,editor:e.editor,"super-text-init":e.node.attrs[o.unref(nt).TEXT],"super-text-element-id":e.node.attrs[o.unref(nt).ELEMENT_ID],onClose:F[1]||(F[1]=U=>n.value=!1),onSave:k},null,8,["open","editor","super-text-init","super-text-element-id"]))]),_:1},16,["class","draggable"])}}}),FJ=new tt({props:{handleKeyDown(t,e){var n;if(e.key==="Backspace"){const{state:r,dispatch:i}=t,{$from:s}=r.selection;if(s.parentOffset===1){const u=s.nodeAfter;if(u&&u.type.name==="superText"){const c=r.tr;c.delete(s.pos-1,s.pos);const f=r.schema.text("");return c.insert(s.pos-1,me.from(f)),c.setSelection(Le.create(c.doc,s.pos)),i(c),e.preventDefault(),!0}}const a=s.nodeBefore,l=s.nodeAfter;if(a&&a.isText&&((n=a.text)==null?void 0:n.length)===1&&l&&l.type.name==="superText"){const u=s.parent.childBefore(s.parentOffset-1).node;if(u&&u.type.name==="superText"){const c=r.tr;return c.delete(s.pos-1,s.pos),c.setSelection(Le.create(c.doc,s.pos-1)),i(c),e.preventDefault(),!0}}}return!1}}}),$J=new tt({appendTransaction(t,e,n){const r=new Set;let i=n.tr,s=!1;return n.doc.descendants((a,l)=>{if(a.type.name===Uc){const u=a.attrs[nt.ID];if(!u||r.has(u)){const c=Yr();i=i.setNodeMarkup(l,void 0,{...a.attrs,[nt.ID]:c}),s=!0,r.add(c)}else r.add(u)}}),s?i:null}}),Uc="superText",ok={UPDATE:"superTextUpdate"},ik=Lt.create({name:"superText",inline:!0,group:"inline",selectable:!1,defining:!0,draggable:!0,addStorage(){return{enable:!0,isShowSuperInputMoblie:!1,view:!0,items:[],superInputModal:this.options.superInputModal,toggleSuperViewMobileCallBack:this.options.toggleSuperViewMobileCallBack,bottomSheetComponent:this.options.bottomSheetComponent,addToast:this.options.addToast,superTextContent:"",superTextPosition:""}},addOptions(){return{specialCharModal:null,button:({editor:t,t:e,isMobile:n})=>n?[{component:Ge,componentProps:{action:()=>{t.commands.toggleSuperInputMoblie()},isActive:()=>{},icon:"fileEdit",title:e("editor.menubar.menu.insertSuper"),tooltip:e("editor.menubar.menu.insertSuper"),customClass:"whitespace-nowrap !bg-ed-blue active:!bg-ed-blue/90 !transition-none !text-white !font-normal rounded-[3px] h-[26px] ml-auto",customClassTooltip:"ml-auto"}}]:[{component:Ge,componentProps:{action:()=>t.commands.toggleSuperTextView(),isActive:()=>t.storage.superText.enable,title:e("editor.menubar.menu.superView"),customClass:`whitespace-nowrap !text-white !font-normal rounded-[3px] h-[26px]
|
|
337
337
|
${t.storage.superText.enable?"!bg-blue-500":"!bg-gray-600"}
|
|
338
338
|
`,tooltip:"수퍼 보기",customClassTooltip:"flex items-center justify-center"}}]}},addAttributes(){return{[nt.ID]:{default:null},[nt.TEXT]:{default:""},[nt.POSITION]:{default:"0"},[nt.ELEMENT_ID]:{default:""}}},addCommands(){return{toggleSuperTextView:()=>({editor:t})=>t.storage.superText.enable=!t.storage.superText.enable,toggleSuperInputMoblie:()=>({editor:t})=>t.storage.superText.bottomSheetComponent?t.storage.superText.isShowSuperInputMoblie=!t.storage.superText.isShowSuperInputMoblie:(console.error("Please configure bottomSheetComponent!"),!1),setSuperTextContent:(t,e)=>({editor:n})=>(n.storage.superText.superTextContent=t,n.storage.superText.superTextPosition=e,!!t)}},parseHTML(){return[{tag:"button.super-text"}]},renderHTML({HTMLAttributes:t}){return["button",yt(t,{class:"super-text"})]},addNodeView(){return ra(VJ)},addProseMirrorPlugins(){return[new tt({appendTransaction(t,e,n){let r=n.tr,i=!1;return n.doc.descendants((s,a)=>{if(s.type.name==="superText"){const l=s.attrs[nt.POSITION],u=String(a);l!==u&&(r=r.setNodeMarkup(a,void 0,{...s.attrs,[nt.POSITION]:u}),i=!0)}}),i?r:null}}),new tt({filterTransaction(t,e){return t.steps.some(r=>{if(r.toJSON&&r.toJSON().stepType==="replace"){const i=r.toJSON();return i.slice&&i.slice.content&&i.slice.content.some(s=>s.type===Uc)}return!1})&&t.setMeta(ok.UPDATE,!0),!0}}),FJ,$J]}}),Cv="spell-check";class HJ{constructor(e,n,r,i=1e3,s=Fo.ERROR_TYPE,a=es,l){Ft(this,"debouncedGetMatchAndSetDecorations",kt.debounce(this.getMatchAndSetDecorations.bind(this),300));Ft(this,"debouncedGetMatchAndSetDecorationsList",kt.debounce(this.getMatchAndSetDecorationsList.bind(this),300));Ft(this,"debouncedClickEventsListener",this.clickEventsListener.bind(this));Ft(this,"debouncedAcceptSuggestionEventsListener",this.acceptSuggestionListener.bind(this));Ft(this,"debouncedProofreadChangedNodes",kt.debounce(this.proofreadChangedNodes.bind(this),300));Ft(this,"proofreader");Ft(this,"uiStrings");Ft(this,"showSuggestionsEvent");Ft(this,"decorationSet");Ft(this,"editorView");Ft(this,"isInitialProofreadingDone",!1);Ft(this,"lastOriginalFrom",0);Ft(this,"lastClickedDecoration",null);Ft(this,"suggestionBox");Ft(this,"isEnableSuggestion");Ft(this,"isMobile");Ft(this,"limit",1e3);Ft(this,"docLimit");Ft(this,"spellcheckHighlightMode");Ft(this,"spellcheckHighlightColor");Ft(this,"_debouncedProofreadDoc",kt.debounce((e,n)=>{this.proofreadDoc(e),n&&n()},500));Ft(this,"_debouncedHandleEnterKey",kt.debounce((e,n,r)=>{this.handleEnterKey(e,n),r&&r()},500));this.proofreader=e,this.uiStrings=n,this.showSuggestionsEvent=r,this.decorationSet=lt.empty,this.limit=i,this.docLimit=l,this.spellcheckHighlightMode=s,this.spellcheckHighlightColor=a,this.suggestionBox=document.createElement("div"),this.suggestionBox.id="suggestions-box",this.suggestionBox.tabIndex=0,this.isEnableSuggestion=!0,this.isMobile=!1,this.hideSuggestionBox()}get completeProofreadingDone(){return this.isInitialProofreadingDone}getProofreader(){return this.proofreader}toggleIsEnabledSpellCheck(){this.proofreader.toggleIsEnabled()}setEnabledProofreadText(e){this.proofreader.setEnabled(e)}getIsEnabledSpellCheck(){return this.proofreader.getIsEnabled()}setDecorationSet(e){this.decorationSet=e}getDecorationSet(){return this.decorationSet}setEditorView(e){this.editorView=e}getEditorView(){return this.editorView}getSuggestionBox(){return this.suggestionBox}hideSuggestionBox(){this.suggestionBox.textContent="",this.suggestionBox.style.display="none"}setIsEnableSuggestion(e){if(this.isEnableSuggestion=e,this.isEnableSuggestion){this.addEventListenersToDecorations();return}this.hideSuggestionBox(),this.removeEventListenersFromDecorations()}setIsMobile(e){this.isMobile=e}getChangedNodesFromTransaction(e,n=!1,r=!1){const i=[],s=new Set;let a=!1;return e.steps.forEach(l=>{var p,m,g;const u=l;if(u.from===void 0||u.to===void 0||n&&u.structure)return;((m=(p=u.slice)==null?void 0:p.content[0])==null?void 0:m.type.name)===Uc&&(a=!0);const c=u.from-(r?1:0);let f=Math.max(u.to,u.from+(((g=u.slice)==null?void 0:g.size)||0))-(r?1:0);f>e.doc.content.size&&(f=e.doc.content.size),e.doc.nodesBetween(c,f,(b,v)=>{b&&(b.isText&&!s.has(v)&&(i.push({node:b,pos:v}),s.add(v)),b.type.name===Uc&&(a=!0))})}),{changedNodes:i,isChangedSuperText:a}}debouncedProofreadDoc(e,n){this._debouncedProofreadDoc(e,n)}isSuperTextAlone(e,n){let r=!1;return e.descendants((i,s,a)=>i===n?(a&&a.type.name==="paragraph"&&a.childCount===1&&a.firstChild===n&&(r=!0),!1):!0),r}isDocExceedLimit(e){return!!(this.docLimit&&e.textContent.length>this.docLimit)}proofreadDoc(e){if(this.isDocExceedLimit(e))return;let n=[],r=0;e==null||e.descendants((u,c)=>{if(u.isText){const f={text:u.text??"",from:c,to:c+u.nodeSize};return n[r]&&(f.text=n[r].text+f.text,f.from=n[r].from),n[r]=f,r+=1,!1}return u.type.name!==Uc}),n=n.filter(Boolean);let i="",s=1;for(const{text:u,from:c,to:f}of n){const p=c-s;p>0&&(i+=Array(p+1).join(`
|
|
339
339
|
`)),s=f,i+=u}const a=f6(i,this.limit),l=this.getMatchAndSetDecorationsList(a.map(u=>({text:u.text,originalFrom:u.offset+1})));this.editorView&&this.dispatch(this.editorView.state.tr.setMeta(jn.LOADING_TRANSACTION,!0)),l.then(()=>{this.editorView&&this.dispatch(this.editorView.state.tr.setMeta(jn.LOADING_TRANSACTION,!1))}),this.isInitialProofreadingDone=!0}async proofreadChangedNodes(e){if(this.editorView&&this.isDocExceedLimit(this.editorView.state.doc))return;const n=this.isMobile?1:2,i=e.reduce((s,a)=>{if(s.length===0)return s.push({changedNode:a,time:1}),s;const l=s[s.length-1];return a.pos===l.changedNode.pos+l.changedNode.node.nodeSize+n*(l.time-1)?(l.changedNode.node.text+=a.node.text,l.time+=1):s.push({changedNode:a,time:1}),s},[]).map(({changedNode:s})=>{var c;const a=((c=s.node)==null?void 0:c.textContent)||"",l=s.pos;return f6(a,this.limit).map(f=>({text:f.text,originalFrom:l+f.offset}))});this.debouncedGetMatchAndSetDecorationsList(i.flat())}async getMatchAndSetDecorationsList(e){const n=e.map(r=>this.getMatchAndSetDecorations(r.text,r.originalFrom));await Promise.all(n)}async getMatchAndSetDecorations(e,n){const r=await this.proofreader.proofreadText(this.proofreader.normalizeTextForLanguage(e)),i=[];for(const l of r){const u=l.startIndex+n,c=u+l.length,f=await this.proofreader.getSuggestions(l.wrongWord),p={length:l.length,wrongWord:l.wrongWord,suggestions:f};let m="spell-error",g="";this.spellcheckHighlightMode===Fo.SINGLE?g=`border-bottom: 2px solid ${this.spellcheckHighlightColor};`:m=`spell-error ${n6[l.errorType??-1]??r6}`,i.push(qt.inline(u,c,{class:m,nodeName:"span",style:g,[Cv]:JSON.stringify(p)}))}const s=this.decorationSet.find(n,n+e.length);let a=this.decorationSet.remove(s);this.editorView&&(a=a.add(this.editorView.state.doc,i)),this.setDecorationSet(a),this.editorView&&this.dispatch(this.editorView.state.tr.setMeta(jn.SPELLCHECKER_TRANSACTION,!0)),this.addEventListenersToDecorations()}removeEventListenersFromDecorations(){var r;const e=(r=this.editorView)==null?void 0:r.domAtPos(this.lastOriginalFrom).node,n=(e==null?void 0:e.querySelectorAll("span.spell-error"))||[];n.length&&n.forEach(i=>{i.removeEventListener("click",this.debouncedClickEventsListener)})}addEventListenersToDecorations(){var e;if(this.isEnableSuggestion)try{const n=(e=this.editorView)==null?void 0:e.domAtPos(this.lastOriginalFrom).node,r=(n==null?void 0:n.querySelectorAll("span.spell-error"))||[];if(!r.length)return;r.forEach(i=>{i.addEventListener("click",this.debouncedClickEventsListener)})}catch{}}addEventListenersToSuggestionBox(){const e=this.suggestionBox.querySelectorAll("li");e.length&&e.forEach(n=>{n.addEventListener("mousedown",this.debouncedAcceptSuggestionEventsListener)})}dispatch(e){this.editorView&&this.editorView.dispatch(e)}findChangedTextNodes(e,n,r,i){if(!e.isBlock)return!1;if(!e.isTextblock)return e.descendants((u,c)=>{this.findChangedTextNodes(u,c,r,i)}),!1;const[s,a]=[n,n+e.nodeSize];if(!(s<=r&&i<=a))return;const l={node:e,pos:n};this.onNodeChanged(l.node.textContent,l.pos+1)}onNodeChanged(e,n){n!==this.lastOriginalFrom?this.getMatchAndSetDecorations(e,n):this.debouncedGetMatchAndSetDecorations(e,n),this.lastOriginalFrom=n}async clickEventsListener(e){var c,f;if(!e.target)return;let n=e.target;for(;n&&!n.classList.contains("spell-error");)n=n.parentElement;if(!n||!n.classList.contains("spell-error"))return;this.lastClickedDecoration=n;const r=(c=n.getAttribute(Cv))==null?void 0:c.trim();if(!r){console.error("No match string provided",{spellCheckerAttributes:r});return}const{length:i,wrongWord:s,suggestions:a}=JSON.parse(r),l=((f=this.editorView)==null?void 0:f.posAtDOM(n,0))??0,u=l+i;if(this.editorView){this.addSuggestionsList(a,l,u),this.suggestionBox.style.display="";const p=OJ(n);if(!p)return;const m=n.getBoundingClientRect(),g=p.getBoundingClientRect(),b=window.getComputedStyle(p).padding,v=m.left-g.left+3-parseInt(b);let y=m.top-g.top+30-parseInt(b);this.suggestionBox.style.left=v+"px",this.suggestionBox.style.top=y+"px";const x=this.suggestionBox.getBoundingClientRect();x.bottom>g.bottom&&(y=m.top-g.top-x.height-7-parseInt(b),this.suggestionBox.style.top=y+"px"),this.showSuggestionsEvent&&this.showSuggestionsEvent(this.proofreader.normalizeTextForLanguage(s)),setTimeout(()=>{n.scrollIntoView({behavior:"smooth",block:"center"})},100)}return this.addEventListenersToSuggestionBox(),!1}acceptSuggestionListener(e){var s;if(!e||!e.target)return;e.preventDefault(),e.stopPropagation();const n=e.target;let r=0,i=0;if(this.lastClickedDecoration&&this.editorView){const a=(s=this.lastClickedDecoration.getAttribute(Cv))==null?void 0:s.trim();if(a){const{length:l}=JSON.parse(a);r=this.editorView.posAtDOM(this.lastClickedDecoration,0),i=r+l}}if(this.editorView&&r>=0&&i>r){this.dispatch(this.editorView.state.tr.setMeta(jn.ACCEPT_SUGGESTION,!0));const a=n.textContent||"",l=this.editorView.state.tr.insertText(a,r,i),u=r+a.length,c=Le.create(l.doc,u);l.setSelection(c),this.dispatch(l),this.editorView.focus()}this.hideSuggestionBox(),this.lastClickedDecoration&&(this.lastClickedDecoration.removeEventListener("click",this.debouncedClickEventsListener),this.lastClickedDecoration=null)}addSuggestionsList(e,n,r){if(this.suggestionBox.textContent="",e.length>0){const i=document.createElement("ul");i.className="suggestion-list",e.forEach(s=>{const a=document.createElement("li");a.innerText=s,a.dataset.from=n+"",a.dataset.to=r+"",i.appendChild(a)}),this.suggestionBox.appendChild(i)}if(e.length===0){const i=document.createElement("b"),s=this.uiStrings&&this.uiStrings.noSuggestions?this.uiStrings.noSuggestions:"No suggestions found";i.textContent=s,this.suggestionBox.appendChild(i)}}isUndoRedo(e,n){return e.getMeta(K5.ADD_TO_HISTORY_TRANSACTION)===!1||e.getMeta(jn.APPENDED)===!0||n.isUndoRedoOperation}handleUndoRedo(e,n){var s;const r=(s=e.getMeta(K5.HISTORY_TRANSACTION))==null?void 0:s.redo;if(n.isUndoRedoOperation=!1,r)return this.debouncedProofreadDoc(e.doc),this.getDecorationSet();const{changedNodes:i}=this.getChangedNodesFromTransaction(e,!0);return i.length===0?this.getDecorationSet():i.length===1?(this.debouncedProofreadChangedNodes(i),this.getDecorationSet()):(this.debouncedProofreadDoc(e.doc),this.getDecorationSet())}isTextContentChangedOrDeleted(e){let n=!1;return{isTextContentChanged:e.steps.some(i=>{var a,l;const s=(a=i.toJSON)==null?void 0:a.call(i);return(s==null?void 0:s.stepType)==="replace"&&((l=s==null?void 0:s.slice)!=null&&l.content)?s.slice.content.some(u=>u.type==="paragraph"&&u.content&&u.content.length>0):(s==null?void 0:s.stepType)==="replace"&&(!s.slice||!s.slice.content||s.slice.content.length===0)?(n=!0,s.from!==s.to):!1}),isDeleteAction:n}}handleEnterKey(e,n){if(n)return this.debouncedProofreadDoc(e.doc),this.getDecorationSet();const r=e.getMeta(jn.APPENDED_TRANSACTION);if(!r)return this.getDecorationSet();const s=r.steps[0].to,a=r.before.nodeAt(s-1);if(!(a!=null&&a.isText))return this.getDecorationSet();let l=0;return r.before.descendants((c,f)=>{c.textContent===(a==null?void 0:a.textContent)&&(l=f)}),l+((a==null?void 0:a.nodeSize)||0)===s?this.getDecorationSet():(this.debouncedProofreadDoc(e.doc),this.getDecorationSet())}handleEnterKeyDebounced(e,n,r){this._debouncedHandleEnterKey(e,n,r)}}const sk=wn(),jn={SPELLCHECKER_TRANSACTION:"spellcheckerTransaction",IS_ACTIVE_SPELLCHECK:"isActiveSpellCheck",LOADING_TRANSACTION:"loading",PREVENT_UPDATE:"preventUpdate",APPENDED:"appended",APPENDED_TRANSACTION:"appendedTransaction",ACCEPT_SUGGESTION:"acceptSuggestion",SKIP_SPELLCHECK:"skipSpellcheck",UI_EVENT:"uiEvent"},zJ={DROP:"drop"},ak=Ne.create({name:"spellchecker",addOptions(){return{proofreader:void 0,uiStrings:{noSuggestions:""},spellcheckHighlightMode:Fo.ERROR_TYPE,spellcheckHighlightColor:es,button:({editor:t,t:e,isMobile:n})=>({component:Ge,componentProps:{action:()=>t.commands.handleActiveSpellCheck(),isActive:()=>{var r,i,s,a;return((a=(s=(i=(r=t==null?void 0:t.extensionStorage)==null?void 0:r.spellchecker)==null?void 0:i.spellchecker)==null?void 0:s.proofreader)==null?void 0:a.enabled)||!1},icon:"SpellCheck",tooltip:"맞춤법 검사",title:n?e("editor.menubar.menu.spelling"):"",customClassTooltip:"flex items-center justify-center"}})}},addStorage(){return{didPaste:!1,spellchecker:void 0,isUndoRedoOperation:!1,pendingSpellCheck:!1,enterKeyPressed:!1}},addCommands(){return{checkSpelling:()=>({tr:t})=>(this.storage.spellchecker.proofreadDoc(t.doc),!0),selectAll:()=>({state:t,dispatch:e})=>(yM(t,e),!0),copy:()=>()=>(document.execCommand("copy"),!0),handleActiveSpellCheck:(t=!0)=>({editor:e})=>{const n=e.extensionStorage.spellchecker.spellchecker;return n.toggleIsEnabledSpellCheck(),e.view.dispatch(e.state.tr.setMeta(jn.IS_ACTIVE_SPELLCHECK,n.getIsEnabledSpellCheck())),t&&sk.setSpellCheck(n.getIsEnabledSpellCheck()),n.hideSuggestionBox(),WC(e)&&e.commands.focus(),!0},setIsEnableSuggestion:t=>()=>(this.storage.spellchecker.setIsEnableSuggestion(t),!0)}},addProseMirrorPlugins(){return[new tt({key:new Et("skipMarkPlugin"),view:e=>{const n=e.dispatch;return e.dispatch=r=>(r.steps.some(s=>s instanceof oi||s instanceof ao)&&r.setMeta(jn.SKIP_SPELLCHECK,!0),n.call(e,r)),{}}}),new tt({key:new Et("spellcheckerPlugin"),props:{decorations(e){return this.getState(e)},handlePaste:()=>{this.storage.didPaste=!0},handleClick:()=>{this.storage.spellchecker.hideSuggestionBox()},handleKeyDown:(e,n)=>((n.ctrlKey||n.metaKey)&&(n.key==="z"||n.key==="y")&&(this.storage.isUndoRedoOperation=!0,this.storage.pendingSpellCheck=!0),this.storage.enterKeyPressed&&(this.storage.pendingSpellCheck=!0),n.key==="Enter"&&(this.storage.enterKeyPressed=!0),!1)},state:{init:(e,n)=>{var i,s;const r=new HJ(this.options.proofreader,this.options.uiStrings,this.options.onShowSuggestionsEvent,(i=this.options.proofreader)==null?void 0:i.limit,this.options.spellcheckHighlightMode??Fo.ERROR_TYPE,this.options.spellcheckHighlightColor??es,this.options.docLimit);return this.storage.spellchecker=r,r.setDecorationSet(lt.create(n.doc,[])),sk.setSpellCheck(r.getIsEnabledSpellCheck()),(s=this.options.proofreader)!=null&&s.enabled&&r.proofreadDoc(n.doc),r.getDecorationSet()},apply:(e,n)=>{var s;if(e.getMeta(jn.SKIP_SPELLCHECK))return n;const r=this.storage.spellchecker,i=e.getMeta(jn.IS_ACTIVE_SPELLCHECK);if(i!==void 0)return i?r.proofreadDoc(e.doc):r.setDecorationSet(lt.empty),r.getDecorationSet();if(e.getMeta(jn.SPELLCHECKER_TRANSACTION))return r.getDecorationSet();if(e.docChanged&&e.doc.nodeSize){const l=r.getDecorationSet().map(e.mapping,e.doc);if(r.setDecorationSet(l),e.getMeta(jn.UI_EVENT)===zJ.DROP)return r.debouncedProofreadDoc(e.doc),r.getDecorationSet();if(r.isUndoRedo(e,this.storage))return r.handleUndoRedo(e,this.storage);const{isTextContentChanged:u,isDeleteAction:c}=r.isTextContentChangedOrDeleted(e);if(c){const{changedNodes:g}=r.getChangedNodesFromTransaction(e,!1,!0);return g.length>0&&r.debouncedProofreadChangedNodes([g[0]]),r.getDecorationSet()}if(this.storage.enterKeyPressed)return r.handleEnterKeyDebounced(e,this.storage.pendingSpellCheck,()=>{this.storage.enterKeyPressed=!1,this.storage.pendingSpellCheck=!1}),r.getDecorationSet();if(this.storage.pendingSpellCheck||u)return r.debouncedProofreadDoc(e.doc,()=>{this.storage.pendingSpellCheck=!1}),r.getDecorationSet();if(e.getMeta(ok.UPDATE)||e.updated===0&&((s=e.steps[0])==null?void 0:s.structure)===!0)return r.getDecorationSet();if(e.getMeta(jn.PREVENT_UPDATE)===!0&&e.before.textContent.length===0)return r.debouncedProofreadDoc(e.doc),r.getDecorationSet();this.storage.didPaste&&(this.storage.didPaste=!1);const{changedNodes:p,isChangedSuperText:m}=r.getChangedNodesFromTransaction(e);if(m)return r.debouncedProofreadDoc(e.doc),r.getDecorationSet();p.length>0&&r.debouncedProofreadChangedNodes(p)}return r.getDecorationSet()}},view:()=>({update:e=>{var r,i;const n=this.storage.spellchecker;n.setEditorView(e),(i=(r=e==null?void 0:e.dom)==null?void 0:r.parentNode)==null||i.appendChild(n.getSuggestionBox())}})})]}}),UJ=()=>{const t=o.reactive({[Vo.EDITOR_COMMENT]:{editor:null,wrongWords:[]},[Vo.EDITOR_CONTENT]:{editor:null,wrongWords:[]}});function e(x,E){t[x].editor=E}const n=o.ref(uo.NO_ERROR);function r(){Object.values(t).forEach(x=>{x.wrongWords=[]})}function i(x,E){return x?uo.FAIL:E?uo.HAS_ERROR:uo.NO_ERROR}async function s(){var k,C;n.value=uo.LOADING;let x=!1,E=!1;for(const[_,{editor:T}]of Object.entries(t)){if(!T)continue;const A=(k=T==null?void 0:T.extensionManager.extensions.find(M=>M.name==="spellchecker"))==null?void 0:k.options.proofreader.api,D=T.getText({blockSeparator:`
|
|
@@ -341,7 +341,7 @@ https://github.com/highlightjs/highlight.js/issues/2277`),Y=I,K=U),L===void 0&&(
|
|
|
341
341
|
`){if(!x||!E.length)return;const C=wE(x,k);function _(F){if(F<0&&(F=0),F>=C.length)return x.state.doc.content.size;if(C[F]!=null)return C[F];for(let H=F;H<C.length;H++)if(C[H]!=null)return C[H];for(let H=F-1;H>=0;H--)if(C[H]!=null)return C[H];return x.state.doc.content.size}const A=E.map(F=>{var V;const H=_(F.startIndex),X=_(Math.max(0,F.endIndex-1))+1,ee=((V=F.correctWord)==null?void 0:V[0])??F.wrongWord;return{item:F,from:H,to:X,replacement:ee}}).filter(F=>typeof F.from=="number"&&typeof F.to=="number"&&F.from<F.to);if(!A.length)return;A.sort((F,H)=>H.from-F.from);const D=x.state.tr;let M=Number.POSITIVE_INFINITY;const B=new Set;for(const F of A)F.to>M||(D.insertText(F.replacement,F.from,F.to),B.add(F.item),M=F.from);B.size>0&&(x.view.dispatch(D),x.view.focus()),B.size>0&&(E=E.filter(F=>![...B].some(H=>H===F))),av(x,E)}function y(){for(const[x,{editor:E,wrongWords:k}]of Object.entries(t))E&&v(E,k)}return{editorsState:t,spellCheckStatus:n,countTotalWrongWords:a,allWrongWordsMissSuggestions:l,setEditor:e,resetAllEditorWrongWords:r,disableSpellCheckRealTime:g,resetEnableSpellCheckRealTime:b,applyAllEditorHighlightErrors:c,clearAllEditorHighlightErrors:f,reRunSpellCheckAndHighlight:p,handleRunSpellCheck:s,replaceAllEditorErrors:y}},WJ=o.defineComponent({__name:"DialogTrigger",props:{asChild:{type:Boolean},as:{}},setup(t){const e=t;return(n,r)=>(o.openBlock(),o.createBlock(o.unref(oD),o.normalizeProps(o.guardReactiveProps(e)),{default:o.withCtx(()=>[o.renderSlot(n.$slots,"default")]),_:3},16))}}),jJ={key:0,class:"border-blue-500 text-white text-xs text-nowrap px-3 py-2 h-auto bg-blue-500 hover:bg-blue-500/80 flex items-center rounded"},lk=o.defineComponent({__name:"BulkSpellChecker",props:{editor:{},editorComment:{},isEnableSpellCheckRealTime:{type:Boolean},align:{default:"right"}},setup(t){var B,F;const e=t,{editorsState:n,countTotalWrongWords:r,spellCheckStatus:i,allWrongWordsMissSuggestions:s,setEditor:a,disableSpellCheckRealTime:l,resetEnableSpellCheckRealTime:u,handleRunSpellCheck:c,resetAllEditorWrongWords:f,applyAllEditorHighlightErrors:p,clearAllEditorHighlightErrors:m,reRunSpellCheckAndHighlight:g,replaceAllEditorErrors:b}=UJ(),v=o.ref(!1),y=o.reactive({x:0,y:0}),x=o.ref(!1),E={x:0,y:0},k=H=>{x.value=!0,E.x=H.clientX-y.x,E.y=H.clientY-y.y,document.addEventListener("mousemove",C),document.addEventListener("mouseup",_)},C=H=>{x.value&&(y.x=H.clientX-E.x,y.y=H.clientY-E.y)},_=()=>{x.value=!1,document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",_)};o.onUnmounted(()=>{document.removeEventListener("mousemove",C),document.removeEventListener("mouseup",_)});const T=o.ref(null),A=o.ref({top:0,right:0,left:0}),D=()=>{if(T.value){const H=T.value.$el.getBoundingClientRect();A.value={top:H.bottom+window.scrollY+5,right:window.innerWidth-H.right-window.scrollX,left:H.left+window.scrollX},y.x=0,y.y=0}};o.onMounted(async()=>{e.editorComment&&a(Vo.EDITOR_COMMENT,e.editorComment),a(Vo.EDITOR_CONTENT,e.editor)}),o.onUnmounted(()=>{a(Vo.EDITOR_COMMENT,null),a(Vo.EDITOR_CONTENT,null)}),o.watch(v,async H=>{H?(await o.nextTick(),D(),l(e.isEnableSpellCheckRealTime),await c(),p()):(f(),u(),m())});const M=(F=(B=e.editor)==null?void 0:B.extensionManager.extensions.find(H=>H.name==="spellchecker"))==null?void 0:F.options.bulkSpellCheckerButton;return(H,X)=>{const ee=Ot,V=uv,$=dh,I=ch,U=uh,L=lh,K=iY,Y=Vc,ue=Pc;return o.openBlock(),o.createBlock(ue,{open:o.unref(v)},{default:o.withCtx(()=>[o.createVNode(o.unref(WJ),{"as-child":"",ref_key:"triggerRef",ref:T,onClick:X[0]||(X[0]=pe=>v.value=!o.unref(v))},{default:o.withCtx(()=>[o.unref(M)?(o.openBlock(),o.createBlock(o.resolveDynamicComponent(o.unref(M).component),{key:1,buttonName:o.unref(M).props.buttonName,icon:o.unref(M).props.icon,type:o.unref(M).props.type,disabled:o.unref(M).props.disabled,iconPosition:o.unref(M).props.iconPosition,buttonSize:o.unref(M).props.buttonSize,iconClass:o.unref(M).props.iconClass},null,8,["buttonName","icon","type","disabled","iconPosition","buttonSize","iconClass"])):(o.openBlock(),o.createElementBlock("button",jJ,[o.createVNode(ee,{name:"checkUnderline"}),X[4]||(X[4]=o.createTextVNode("맞춤법 일괄 교정 "))]))]),_:1},512),o.createVNode(Y,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none dark:border-ed-muted","as-child":""},{default:o.withCtx(()=>[o.createElementVNode("div",{class:"z-[70]",style:o.normalizeStyle({transform:`translate(${o.unref(y).x}px, ${o.unref(y).y}px)`,top:`${o.unref(A).top}px`,right:H.align==="left"?"auto":`${o.unref(A).right}px`,left:H.align==="left"?`${o.unref(A).left}px`:"auto"})},[o.createVNode(U,{class:"bg-ed-blue-light py-3.5 px-6 rounded-t-[5px] cursor-move text-blue-500 dark:text-dark-blue-100 flex-row items-center justify-between",onMousedown:o.withModifiers(k,["prevent"])},{default:o.withCtx(()=>[o.createVNode($,{class:"text-base space-x-2"},{default:o.withCtx(()=>[X[5]||(X[5]=o.createElementVNode("span",null,"맞춤법/문법 오류",-1)),o.createVNode(V,{class:"text-sm bg-blue-500 hover:bg-blue-500 dark:bg-dark-blue-100 px-2"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(r))+"개",1)]),_:1})]),_:1}),o.createVNode(I,{onClick:X[1]||(X[1]=pe=>v.value=!1),class:"text-xs flex items-center gap-x-1"},{default:o.withCtx(()=>[o.createVNode(ee,{name:"Close",class:"w-4 h-4"}),o.createTextVNode(o.toDisplayString(H.$t("editor.close")),1)]),_:1})]),_:1}),o.createVNode(L),o.createVNode(K,{editorsState:o.unref(n),spellCheckStatus:o.unref(i),allWrongWordsMissSuggestions:o.unref(s),onCloseModal:X[2]||(X[2]=pe=>v.value=!1),onRunSpellcheck:o.unref(g),onReplaceAllEditorErrors:X[3]||(X[3]=pe=>(o.unref(b)(),v.value=!1))},null,8,["editorsState","spellCheckStatus","allWrongWordsMissSuggestions","onRunSpellcheck"])],4)]),_:1})]),_:1},8,["open"])}}}),qJ=Object.freeze(Object.defineProperty({__proto__:null,default:lk},Symbol.toStringTag,{value:"Module"})),uk=Ne.create({name:"invalidCharFocus",addOptions(){return{invalidChars:["{","}"]}},addCommands(){return{focusInvalidChar:()=>({state:t,dispatch:e,view:n})=>{let r=null;if(t.doc.descendants((s,a)=>{if(!s.isText)return!0;const l=s.text??"";for(let u=0;u<l.length;u++)if(this.options.invalidChars.includes(l[u])){const c=a+u+1;(r==null||c<r)&&(r=c)}return!0}),r==null)return!1;const i=t.tr.setSelection(Le.create(t.doc,r));return e&&e(i.scrollIntoView()),n&&n.focus(),!0},hasInvalidChar:()=>({state:t})=>{let e=!1;return t.doc.descendants(n=>{if(!n.isText)return!0;const r=n.text??"";return this.options.invalidChars.some(i=>r.includes(i))?(e=!0,!1):!0}),e}}}}),Ev=o.defineComponent({__name:"SimpleEditor",props:{modelValue:{default:""},parentEditor:{default:null},isReadOnly:{type:Boolean},autofocus:{type:[String,Number,Boolean,null],default:"start"},spellcheckEnabled:{type:Boolean,default:!0}},emits:["update:modelValue"],setup(t,{expose:e,emit:n}){const r=t,i=n,s=o.inject("isMobile",!1),a=o.inject("minCharSuperInput",0),l=[Z5,X5,J5,G5,Y5.configure({placeholder:"수퍼를 입력하세요"}),uk,N5],u=o.ref(r.spellcheckEnabled),c=o.computed(()=>{var D;return(D=r.parentEditor)==null?void 0:D.extensionManager.extensions.find(M=>M.name==="spellchecker")}),f=o.computed(()=>{var D,M,B,F,H,X,ee,V,$,I;return ak.configure({proofreader:new Nk({api:(M=(D=c.value)==null?void 0:D.options.proofreader)==null?void 0:M.api,limit:(F=(B=c.value)==null?void 0:B.options.proofreader)==null?void 0:F.limit,transfer:(X=(H=c.value)==null?void 0:H.options.proofreader)==null?void 0:X.transfer,enabled:u.value}),uiStrings:(ee=c.value)==null?void 0:ee.options.uiStrings,bulkSpellCheckerButton:(V=c.value)==null?void 0:V.options.bulkSpellCheckerButton,spellcheckHighlightMode:($=c.value)==null?void 0:$.options.spellcheckHighlightMode,spellcheckHighlightColor:(I=c.value)==null?void 0:I.options.spellcheckHighlightColor})}),p=new Po({enablePasteRules:!1,enableInputRules:!1,content:r.modelValue,extensions:l.concat(f.value),editable:!r.isReadOnly,autofocus:r.autofocus,onUpdate:({editor:D})=>{i("update:modelValue",D.getHTML())},parseOptions:{preserveWhitespace:"full"}});o.watch(()=>r.isReadOnly,D=>{var M;p.setEditable(!D),(M=p==null?void 0:p.commands)!=null&&M.setIsEnableSuggestion&&p.commands.setIsEnableSuggestion(!D)},{immediate:!0});function m(D){const{view:M}=p,{from:B}=M.state.selection;p.commands.insertContentAt(B,D),p.commands.focus()}function g(){var D;u.value=!u.value,p.commands.handleActiveSpellCheck(u.value),(D=p==null?void 0:p.commands)!=null&&D.setIsEnableSuggestion&&p.commands.setIsEnableSuggestion(u.value)}const{contentInner:b,measuredMinWidth:v,measure:y}=df({minChars:a,fontSize:"",editor:p});o.watch(()=>r.modelValue,()=>{y(),p&&p.getHTML()!==r.modelValue&&p.commands.setContent(r.modelValue??"",!1)});const x=o.computed(()=>s?{}:{width:`${v.value}px`}),k=document.createElement("canvas").getContext("2d");function C(){if(!v.value||!(b.value instanceof Element)||!k)return;const D=p.getText({blockSeparator:`
|
|
342
342
|
`}),M=getComputedStyle(b.value);k.font=M.font;const B=20,F=()=>Math.max(0,(v.value||0)-B);function H($,I){let U=1,L=$.length,K=0;for(;U<=L;){const Y=Math.floor((U+L)/2);k.measureText($.slice(0,Y)).width<=I?(K=Y,U=Y+1):L=Y-1}return K}let X="";const ee=[];for(const $ of D){if($===`
|
|
343
343
|
`){ee.push(X),X="";continue}if(X+=$,k.measureText(X).width>F())for(;k.measureText(X).width>F();){const I=H(X,F());I<=0?(ee.push(X.charAt(0)),X=X.slice(1)):(ee.push(X.slice(0,I)),X=X.slice(I))}}return ee.push(X),ee.map($=>`<p>${$}</p>`).join("")}const _=o.computed(()=>{var M,B,F;const D=(F=(B=(M=r.parentEditor)==null?void 0:M.storage.superText.superInputModal)==null?void 0:B.props)==null?void 0:F.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,M)=>(o.openBlock(),o.createElementBlock("div",{ref_key:"contentInner",ref:b,class:o.normalizeClass(o.unref(Ee)("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")),style:o.normalizeStyle([o.unref(x),o.unref(_)]),onScroll:M[0]||(M[0]=(...B)=>o.unref(A)&&o.unref(A)(...B))},[o.createVNode(o.unref(Qn),{id:"editor-panel",editor:o.unref(p),class:o.normalizeClass(o.unref(Ee)("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 $,I;const n=e,r=t,{t:i}=Tt(),s=o.ref(""),a=o.ref(""),l=o.ref(null),u=o.ref(!1),c=Qe.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=U=>{p.value=!0;const L=U.currentTarget.closest(".draggable-dialog").getBoundingClientRect();m.x=U.clientX-L.left,m.y=U.clientY-L.top,document.addEventListener("mousemove",x),document.addEventListener("mouseup",E)},x=U=>{p.value&&(f.x=U.clientX-m.x,f.y=U.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 U=>{if(!U)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 K=window.innerWidth,Y=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((K-L.offsetWidth)/2,0),f.y=Math.max((Y-L.offsetHeight)/2,0))},{immediate:!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=(I=($=r.editor)==null?void 0:$.extensionManager.extensions.find(U=>U.name==="superText"))==null?void 0:I.options.specialCharModal,A=o.inject("fontFamily",""),D=o.computed(()=>{var U,L,K;return np(r.editor,uc)&&o.unref(A)?o.unref(A):(K=(L=(U=r.editor)==null?void 0:U.storage.superText.superInputModal)==null?void 0:L.props)==null?void 0:K.fontFamily}),M=Qe.useLocalStorage("recentSpecialChars",[]),B=U=>{if(!U)return;const L=(M.value??[]).filter(K=>K!==U);L.unshift(U),M.value=L.slice(0,ck)},F=U=>{var L;(L=l.value)==null||L.insertSpecialCharater(U)},H=(U,L)=>{var K;L&&((K=l.value)==null||K.insertSpecialCharater(U),B(U))},X=o.computed(()=>{var U;return(U=l.value)==null?void 0:U.isChecked}),ee=()=>{var U;(U=l.value)==null||U.toggleSpellCheck()};o.onUnmounted(()=>{document.removeEventListener("mousemove",x),document.removeEventListener("mouseup",E)}),o.watch(s,U=>{!r.superTextElementId||r.superTextElementId===""||(b.value=U!==(r.superTextInit??""))});const V=o.computed(()=>{var U;return(U=l.value)==null?void 0:U.editor});return(U,L)=>{const K=dh,Y=ch,ue=uh,pe=lh,ke=lk,oe=iv,ge=Vc,J=Pc,te=SX;return o.openBlock(),o.createElementBlock(o.Fragment,null,[o.createVNode(J,{open:U.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(ge,{"is-overlay-transparent":"",class:"p-0 gap-0 !animate-none !transition-none max-w-max","as-child":""},{default:o.withCtx(()=>{var ne,se;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(ue,{class:"bg-blue-500 text-white p-2.5 rounded-t-[5px] cursor-move",onMousedown:o.withModifiers(y,["prevent"])},{default:o.withCtx(()=>[o.createVNode(K,null,{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(i)("editor.superinput")),1)]),_:1}),o.createVNode(Y,{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(U.$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(Ee)("flex gap-x-6",o.unref(M).length===ck&&"gap-x-4"))},[o.createVNode(bn,{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(X),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(M),ce=>(o.openBlock(),o.createBlock(bn,{key:ce,variant:"outline",size:"xs",class:"h-[25px] w-[25px] p-0",onClick:Se=>F(ce)},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(ce),1)]),_:2},1032,["onClick"]))),128))]),o.createElementVNode("div",NJ,[o.unref(V)?(o.openBlock(),o.createBlock(ke,{key:0,editor:o.unref(V),"is-enable-spell-check-real-time":(ne=o.unref(V))==null?void 0:ne.extensionStorage.spellchecker.spellchecker.proofreader.enabled,align:"left"},null,8,["editor","is-enable-spell-check-real-time"])):o.createCommentVNode("",!0)])],2),u.value?(o.openBlock(),o.createBlock(o.resolveDynamicComponent((se=o.unref(T))==null?void 0:se.component),o.mergeProps({key:0,"custom-class":"!z-[70] !pointer-events-auto","font-family":o.unref(D)},o.unref(T).props,{onSelectedChar:H,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":U.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(gs,{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(oe,{class:"sm:justify-center pb-3.5 pt-1"},{default:o.withCtx(()=>[o.createVNode(bn,{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(bn,{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(U.$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===Te.EDITOR||n.mode===Te.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=Vr.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]=M=>{var B;return(B=E.editor)==null?void 0:B.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]=M=>{var B;return(B=E.editor)==null?void 0:B.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]=M=>{var B;return(B=E.editor)==null?void 0:B.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=co(o.defineComponent({__name:"PageNode",props:na,setup(t){const{state:e,page:n,superTextStore:r}=wn(),{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===Te.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=Qe.useEventBus(pr.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(Te).REPORT:o.unref(Te).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 De&&s.node.isBlock)return!l.parentOffset||!wr(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 Le&&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=wr(e.doc,e.mapping.map(l.pos),1,g);if(!g&&!b&&wr(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=vn(t,n.schema),{$from:a,$to:l}=n.selection,u=n.selection instanceof De?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=me.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=me.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(me.from(s.createAndFill(null,C)??void 0));const _=a.before(a.depth-(x-1));e.replace(_,a.after(-E),new _e(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(Le.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(!wr(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,ps,Ag,Bl,Og,Ig,Mg,ma,Il,yi,Bg,Rg,Tg,Xr],lZ=Lt.create({priority:200,name:`${Xr}`,content:"block*",group:`${Xr}`,isolating:!0,selectable:!1,draggable:!1,isLeaf:!0,addOptions(){return{SystemAttributes:{},nodesComputed:{},View:ra(oZ),types:[],slots:{}}},addAttributes(){return{HTMLAttributes:{},id:{default:Yr(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=We.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(We.atEnd(l).from===c&&!u.parentOffset)return r.deleteNode(Xr);const f=ci(p=>p.type.name===Xr)(a);if(f){if(!f.node.firstChild)return r.deleteNode(Xr);const p=f.node.firstChild.type;if(f.start+We.atStart(f.node).from===c){const g=Le.create(l,f.start-2,f.start-2),b=ci(v=>v.type.name===Xr)(g);if(b){const v=We.atEnd(b.node).from+b.start,y=Le.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 mn(v,c,_e.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=ci(f=>f.type.name===Bl)(s);return c&&c.start+We.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(We.atEnd(a).from===u)return r.deleteNode(Xr);const c=ci(f=>f.type.name===Xr)(s);if(c&&c.start+We.atEnd(c.node).from===u){const p=Le.create(a,u+2,u+2),m=ci(g=>g.type.name===Xr)(p);if(m){const g=We.atStart(m.node).from+m.start,b=Le.create(a,g,g);if(ci(y=>y.attrs.extend)(b))return i.step(new mn(u,g,_e.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=Ne.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===Te.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=Qe.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=Ne.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=co(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=Qe.useEventBus(pr.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(bs),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(bs),null,{default:o.withCtx(()=>a[3]||(a[3]=[o.createTextVNode(" 글꼴 크기 작게 ")])),_:1})]),_:1})]),_:1})])}}}),[["__scopeId","data-v-250d04b3"]]),gZ=Hn.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=Ne.create({name:"painter",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({editor:e,extension:n,t:r})=>({component:Ge,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 tt({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=()=>Yr(10),hk=new Et("attrkey"),bZ=t=>new tt({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,ps,Ag,Bl,Og,Ig,Mg,ma,Il,yi,Bg,Rg,Tg,Xr],vZ=Ne.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 Le||n instanceof Vn))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=Ne.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=co(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)},{immediate:!0});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,{"is-overlay-transparent":"",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,{modelValue:s.value,"onUpdate:modelValue":b[0]||(b[0]=T=>s.value=T),"is-read-only":l.value,"parent-editor":g.editor,"spellcheck-enabled":!1},null,8,["modelValue","is-read-only","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",{disabled:o.unref(c),class:o.normalizeClass({"cursor-not-allowed":o.unref(c)}),onClick:p},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-c6e8813c"]]),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=Qe.useEventBus(pr.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[nt.TEXT],k=e.node.attrs[nt.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[nt.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=bn,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(nt).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(nt).ID],"page-id":c.value.pageId,"page-number":c.value.pageNumber,"book-mark-content":e.node.attrs[o.unref(nt).TEXT],"node-id":e.node.attrs[o.unref(nt).ID],"line-id":p.value},null,8,MZ)]),_:1})]),_:1}),o.createVNode(T,null,{default:o.withCtx(()=>[o.createVNode(_,{onSelect:E[0]||(E[0]=M=>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(nt).TEXT],"super-text-id":e.node.attrs[o.unref(nt).ID],onClose:E[2]||(E[2]=M=>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(nt).TEXT],"super-text-element-id":e.node.attrs[o.unref(nt).ELEMENT_ID],onClose:E[1]||(E[1]=M=>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:Ge,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 tt({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 qn(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 As=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 ko(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=qn(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 Vi extends We{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()?Vi.rowSelection(r,i):s&&this.isColSelection()?Vi.colSelection(r,i):new Vi(r,i)}return Le.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(me.from(c)))}const l=this.isColSelection()&&this.isRowSelection()?e:a;return new _e(me.from(l),1,1)}replace(e,n=_e.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?_e.empty:n)}const s=We.findFrom(e.doc.resolve(e.mapping.slice(r).map(this.to)),-1);s&&e.setSelection(s)}replaceWith(e,n){this.replace(e,new _e(me.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 Vi(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 Vi&&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 Vi(e,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,n){return new Vi(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){return new Vi(e.resolve(n),e.resolve(r))}getBookmark(){return new $Z(this.$anchorCell.pos,this.$headCell.pos)}};Wt.prototype.visible=!1,We.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):We.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"}))}),lt.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 De&&(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 Le&&zZ(r)?s=Le.create(i,r.from):r instanceof Le&&UZ(r)&&(s=Le.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=qn(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 Qo(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?qn(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(!ko(t))return!1;if(e){const n=Qo(t);e(Ek(t.tr,n,n.left))}return!0}function GZ(t,e){if(!ko(t))return!1;if(e){const n=Qo(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(!ko(t))return!1;if(e){const n=Qo(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=qn(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?qn(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,qn(r.type.schema).row.create(null,l)),t}function ZZ(t,e){if(!ko(t))return!1;if(e){const n=Qo(t);e(kk(t.tr,n,n.top))}return!0}function QZ(t,e){if(!ko(t))return!1;if(e){const n=Qo(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(!ko(t))return!1;if(e){const n=Qo(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=Qo(t),{map:i}=r;if(tQ(i,r))return!1;if(e){const s=t.tr,a={};let l=me.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=qn(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=Qo(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(!ko(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(!ko(e))return!1;if(n){const r=qn(e.schema),i=Qo(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(!ko(n))return!1;if(r){const i=qn(n.schema),s=Qo(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(!ko(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(Le.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=qn(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 _e(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(qn(a).row,new _e(c,f,p)).content),l.push(c)}else if(s=="cell"||s=="header_cell")l.push(n||r?Iv(qn(a).row,new _e(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(me.empty),n[i]<r){const s=qn(t).cell.createAndFill(),a=[];for(let l=n[i];l<r;l++)a.push(s);e[i]=e[i].append(me.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(me.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(me.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=qn(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,me.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 _e(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,We.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,We.near(n.doc.resolve(s.head+e),e));{const l=n.doc.resolve(a),u=yk(l,t,e);let c;return u?c=We.near(u,1):e<0?c=We.near(n.doc.resolve(l.before(-1)),-1):c=We.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(!ko(t.state))return!1;let r=lQ(n);const i=t.state.selection;if(i instanceof Wt){r||(r={width:1,height:1,rows:[me.from(Iv(qn(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=As.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(As,u.pos),t.dispatch(g)}}function a(){t.root.removeEventListener("mouseup",a),t.root.removeEventListener("dragstart",a),t.root.removeEventListener("mousemove",l),As.getState(t.state)!=null&&t.dispatch(t.state.tr.setMeta(As,-1))}function l(u){const c=u,f=As.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 Le))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 Mr=new Et("tableColumnResizing");function bQ({handleWidth:t=5,cellMinWidth:e=25,defaultCellMinWidth:n=100,View:r=gQ,lastColumnResizable:i=!0}={}){const s=new tt({key:Mr,state:{init(a,l){var u,c;const f=(c=(u=s.spec)==null?void 0:u.props)==null?void 0:c.nodeViews,p=qn(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=Mr.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=Mr.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(Mr);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=Mr.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=Mr.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=Mr.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(Mr,{setDragging:{startX:e.clientX,startWidth:u}}));function c(p){s.removeEventListener("mouseup",c),s.removeEventListener("mousemove",f);const m=Mr.getState(t.state);m!=null&&m.dragging&&(kQ(t,m.activeHandle,Pk(m.dragging,p,n)),t.dispatch(t.state.tr.setMeta(Mr,{setDragging:null})))}function f(p){if(!p.which)return c(p);const m=Mr.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(Mr,{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 lt.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=Mr.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 lt.create(t.doc,r)}function TQ({allowTableNodeSelection:t=!1}={}){return new tt({key:As,state:{init(){return null},apply(e,n){const r=e.getMeta(As);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 As.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=Ne.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(Le.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(Fe(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(hs),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(ms),{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(Ge,{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=Ne.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=Ne.create({name:ep,addOptions(){return{additionalTimeWords:[],enabled:!0}},addStorage(){return{cachedRegex:null,cachedAdditionalWords:null,enabled:this.options.enabled}},addProseMirrorPlugins(){return[new tt({props:{decorations:t=>{if(!this.storage.enabled)return lt.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"}))}}),lt.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=Ne.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=Vr.fromSchema(t.schema).serializeFragment(i.content),l=document.createElement("div");l.appendChild(a);const u=l.innerHTML,c=e.doc.textBetween(n,r,`
|
|
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=Ne.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(Ee)("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(Ee)(!o.unref(n)&&"pointer-events-none"))},{default:o.withCtx(()=>[o.createVNode(o.unref(hs),{"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(ms),{"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(bn),{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(gs),{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(bn),{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:Ge,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 tt({key:Gl,state:{init(){return lt.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=Yr(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(Ee)(!o.unref(s)&&"pointer-events-none"))},{default:o.withCtx(()=>[o.createVNode(o.unref(hs),{"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(ms),{"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(bn),{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(gs),{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(bn),{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,Ti={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:Ti.REMOVE_TOAST,toastId:t})},BN);$v.set(t,e)}const So=o.ref({toasts:[]});function qc(t){switch(t.type){case Ti.ADD_TOAST:So.value.toasts=[t.toast,...So.value.toasts].slice(0,ON);break;case Ti.UPDATE_TOAST:So.value.toasts=So.value.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e);break;case Ti.DISMISS_TOAST:{const{toastId:e}=t;e?Kk(e):So.value.toasts.forEach(n=>{Kk(n.id)}),So.value.toasts=So.value.toasts.map(n=>n.id===e||e===void 0?{...n,open:!1}:n);break}case Ti.REMOVE_TOAST:t.toastId===void 0?So.value.toasts=[]:So.value.toasts=So.value.toasts.filter(e=>e.id!==t.toastId);break}}function Hv(){return{toasts:o.computed(()=>So.value.toasts),toast:RN,dismiss:t=>qc({type:Ti.DISMISS_TOAST,toastId:t})}}function RN(t){const e=IN(),n=i=>qc({type:Ti.UPDATE_TOAST,toast:{...i,id:e}}),r=()=>qc({type:Ti.DISMISS_TOAST,toastId:e});return qc({type:Ti.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:yi,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:Yr(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:Ge,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 tt({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=Ne.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=wn(),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=bs,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(bn,{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=Ne.create({name:tp,addOptions(){return{button:({editor:t})=>({component:VN,componentProps:{editor:t}}),specialCharModal:void 0}},addStorage(){return{specialCharModal:this.options.specialCharModal}}}),Xk=Ne.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!==Te.EDITOR&&e.push(FN.configure(this.options.specialCharacter)),this.options.mode!==Te.EDITOR&&e.push(gZ),this.options.superText!==!1&&this.options.mode!==Te.PLAIN_TEXT&&this.options.mode!==Te.EDITOR&&(typeof this.options.superText=="boolean"?e.push(ik.configure()):e.push(ik.configure(this.options.superText))),this.options.mode===Te.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!==Te.EDITOR&&this.options.configPlan!==!1&&this.options.mode!==Te.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!==Te.EDITOR&&this.options.mode!==Te.PLAIN_TEXT&&e.push(vZ),(this.options.mode===Te.STRAIGHT||this.options.mode===Te.REPORT||this.options.mode===Te.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=Hn.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=Hn.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=Ne.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:Ge,componentProps:{action:()=>e.commands.toggleSubscript(),isActive:()=>e.isActive("subscript")||!1,disabled:!e.can().toggleSubscript(),icon:"Subscript",tooltip:r("editor.subscript.tooltip")}},l={component:Ge,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=Ne.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 Le||s instanceof Vn))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=Ne.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:Ge,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:Ge,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 tt({key:t,view(){return{update:async(x,E)=>{var k,C,_,T,A,D,M;const B=(k=this.key)===null||k===void 0?void 0:k.getState(E),F=(C=this.key)===null||C===void 0?void 0:C.getState(x.state),H=B.active&&F.active&&B.range.from!==F.range.from,X=!B.active&&F.active,ee=B.active&&!F.active,V=!X&&!ee&&B.query!==F.query,$=X||H&&V,I=V||H,U=ee||H&&V;if(!$&&!I&&!U)return;const L=U&&!$?B:F,K=x.dom.querySelector(`[data-decoration-id="${L.decorationId}"]`);b={editor:e,range:L.range,query:L.query,text:L.text,items:[],command:Y=>c({editor:e,range:L.range,props:Y}),decorationNode:K,clientRect:K?()=>{var Y;const{decorationId:ue}=(Y=this.key)===null||Y===void 0?void 0:Y.getState(e.state),pe=x.dom.querySelector(`[data-decoration-id="${ue}"]`);return(pe==null?void 0:pe.getBoundingClientRect())||null}:null},$&&((_=v==null?void 0:v.onBeforeStart)===null||_===void 0||_.call(v,b)),I&&((T=v==null?void 0:v.onBeforeUpdate)===null||T===void 0||T.call(v,b)),(I||$)&&(b.items=await f({editor:e,query:L.query})),U&&((A=v==null?void 0:v.onExit)===null||A===void 0||A.call(v,b)),I&&((D=v==null?void 0:v.onUpdate)===null||D===void 0||D.call(v,b)),$&&((M=v==null?void 0:v.onStart)===null||M===void 0||M.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:M}=A,B={...E};if(B.composing=T,_&&(D||e.view.composing)){(M<E.range.from||M>E.range.to)&&!T&&!E.composing&&(B.active=!1);const F=g({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:A.$from}),H=`id_${Math.floor(Math.random()*4294967295)}`;F&&m({editor:e,state:C,range:F.range,isActive:E.active})?(B.active=!0,B.decorationId=E.decorationId?E.decorationId:H,B.range=F.range,B.query=F.query,B.text=F.text):B.active=!1}else B.active=!1;return B.active||(B.decorationId=null,B.range={from:0,to:0},B.query=null,B.text=null),B}},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?lt.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=Ne.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=wn(),{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(Ge,{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=Ne.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:Ge,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}=Qe.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=wn(),bee=Ne.create({name:"preview",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({t:e})=>({component:Ge,componentProps:{icon:"Eye",action:()=>{zv.togglePreview()},tooltip:e("editor.preview.tooltip"),isActive:()=>zv.state.showPreview}})}},addCommands(){return{togglePreview:()=>()=>(zv.togglePreview(),!0)}}}),Qk=wn(),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:lt.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:lt.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=Ne.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:Ge,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 tt({key:Eee,state:{init:()=>lt.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=[],lt.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}=wn(),Tee=Ne.create({name:"printer",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({t:e})=>({component:Ge,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=""false""><strong>Introduction(English)</strong></h1><p id="s864ng1o" extend=""false"">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=""false""><strong>소개(국문)</strong></h1><p id="0qei01hl" extend=""false"">마이마이 에디터는 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=Qe.useEventBus(pr.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 Qe.useEventListener(document,"mousedown",i,{capture:!0}),Qe.useEventListener(document,"touchstart",i,{capture:!0}),Qe.useEventListener(document,"focusin",s),Qe.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}=wn();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(Ge,{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(bn),{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,M,B;return[o.createElementVNode("div",Hee,[o.createVNode(Ge,{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(Ge,{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(Ge,{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(go),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Ge,{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(Ge,{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(Ge,{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(go),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Ge,{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(Ge,{icon:"TableCellsSplit",action:m,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.splitCells"),"tooltip-options":{sideOffset:15},disabled:!((M=y.editor)!=null&&M.can().splitCell())},null,8,["tooltip","disabled"]),o.createVNode(o.unref(go),{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(Ge,{icon:"Trash2",tooltip:o.unref(i)("editor.table.menu.deleteTable"),"icon-class":"w-5 h-5",action:g,"tooltip-options":{sideOffset:15},disabled:!((B=y.editor)!=null&&B.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(Ge,{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(Ge,{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(Ge,{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(go),{key:0,orientation:"vertical",class:"h-4"})):o.createCommentVNode("",!0),o.createElementVNode("div",qee,[o.createVNode(Ge,{icon:"Pencil",tooltip:o.unref(n)("editor.link.edit.tooltip"),action:s,"tooltip-options":{sideOffset:15}},null,8,["tooltip"]),o.createVNode(Ge,{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(hs),{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(ms),{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=Qe.useEventBus(pr.RENDER_SUPER_TEXT),l=_=>{if(!e.value||!t)return;const T=e.value.index,A=e.value.id,{state:D}=t,{tr:M}=D;let B=!1;D.doc.descendants((F,H)=>{var X,ee;if(((X=F.attrs)==null?void 0:X[nt.ID])===A){(ee=F.attrs[nt.TEXT])!=null&&ee.trim();const V=_.trim();if(Eh(V))return M.delete(H,H+1),B=!0,!1;const{[nt.ELEMENT_ID]:$,...I}=F.attrs;return M.setNodeMarkup(H,void 0,{...I,[nt.TEXT]:V}),B=!0,!1}return!0}),B&&t&&t.view.dispatch(M),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 M=D.getBoundingClientRect().top;A.has(M)||A.set(M,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> </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(M=>M.id)),A=_.map(M=>({isHidden:M.classList.contains("hidden"),isTruncated:M.classList.contains("super-text-truncate")}));_.forEach(M=>{M.classList.remove("hidden"),M.classList.remove("super-text-truncate")});for(const M of u.value.keys())T.has(M)||u.value.delete(M);_.forEach(M=>{const B=M.getAttribute("book-mark-id");if(!B)return;const F=M.offsetTop+M.offsetHeight,H=u.value.get(B)||0;u.value.set(B,Math.max(F,H))}),_.forEach((M,B)=>{A[B].isHidden&&M.classList.add("hidden"),A[B].isTruncated&&M.classList.add("super-text-truncate")});let D=0;for(const M of u.value.values())M>D&&(D=M);s.value=D},b=async()=>{await o.nextTick();const T=c().map(A=>{const D=A.getAttribute("node-id"),M=A.getAttribute("book-mark-content"),B=A.getAttribute("page-id"),F=A.getAttribute("page-number"),H=A.getBoundingClientRect(),X=A.getAttribute("line-id"),ee=A.getAttribute("element-id");return{position:H,text:m(M),id:D,pageId:B,pageNumber:F,visiblePosition:f(A),status:0,lineId:X,elementId:ee,textOriginal:m(M)}});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")),M=Number(A.getAttribute("index"));return D-M}),_.forEach(T=>T.classList.remove("super-text-truncate")),_.forEach((T,A)=>{const D=T.getBoundingClientRect();_.slice(A+1).forEach(M=>{const B=M.getBoundingClientRect();v(D,B)&&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(B=>{const F=B.getBoundingClientRect().top,H=T==null?void 0:T.getBoundingClientRect().top;if(H==null)return!1;const X=H-F;return Math.abs(X-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(B=>B.classList.remove("hidden")),y();return}A.querySelector(".super-text-lines").innerHTML=m(_.text),A.classList.remove("super-text-truncate");const M=A.getBoundingClientRect();i.value.forEach((B,F)=>{if(F!==D){const H=B.getBoundingClientRect();v(M,H)&&B.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((M,B)=>{if(B!==T){const F=M.getBoundingClientRect();v(D,F)&&M.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=co(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(Ee)("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 M,B,F;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(Ee)("super-text-view","absolute w-full px-2 translate-y-[-10px] group",{})),style:o.normalizeStyle({top:`${A.visiblePosition||((M=A.position)==null?void 0:M.top)}px`}),onMouseover:H=>o.unref(p)(H,D),onMouseleave:C[0]||(C[0]=(...H)=>o.unref(m)&&o.unref(m)(...H))},[o.createVNode(o.unref(uv),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(Ee)("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?((B=k.superPreviewCustomClass)==null?void 0:B.completedSuper)??"bg-black":((F=k.superPreviewCustomClass)==null?void 0:F.unproducedSuper)??"bg-red-500",{"cursor-default":!o.unref(c)})),onDblclick:H=>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=co(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(Ee)("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(Ee)("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:M=>o.unref(f)(M,_),onMouseleave:x[0]||(x[0]=(...M)=>o.unref(p)&&o.unref(p)(...M))},[o.createVNode(o.unref(uv),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(Ee)("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:M=>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,`
|
|
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=Ne.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(Ee)("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(Ee)(!o.unref(n)&&"pointer-events-none"))},{default:o.withCtx(()=>[o.createVNode(o.unref(hs),{"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(ms),{"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(bn),{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(gs),{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(bn),{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:Ge,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 tt({key:Gl,state:{init(){return lt.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=Yr(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(Ee)(!o.unref(s)&&"pointer-events-none"))},{default:o.withCtx(()=>[o.createVNode(o.unref(hs),{"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(ms),{"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(bn),{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(gs),{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(bn),{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,Ti={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:Ti.REMOVE_TOAST,toastId:t})},BN);$v.set(t,e)}const So=o.ref({toasts:[]});function qc(t){switch(t.type){case Ti.ADD_TOAST:So.value.toasts=[t.toast,...So.value.toasts].slice(0,ON);break;case Ti.UPDATE_TOAST:So.value.toasts=So.value.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e);break;case Ti.DISMISS_TOAST:{const{toastId:e}=t;e?Kk(e):So.value.toasts.forEach(n=>{Kk(n.id)}),So.value.toasts=So.value.toasts.map(n=>n.id===e||e===void 0?{...n,open:!1}:n);break}case Ti.REMOVE_TOAST:t.toastId===void 0?So.value.toasts=[]:So.value.toasts=So.value.toasts.filter(e=>e.id!==t.toastId);break}}function Hv(){return{toasts:o.computed(()=>So.value.toasts),toast:RN,dismiss:t=>qc({type:Ti.DISMISS_TOAST,toastId:t})}}function RN(t){const e=IN(),n=i=>qc({type:Ti.UPDATE_TOAST,toast:{...i,id:e}}),r=()=>qc({type:Ti.DISMISS_TOAST,toastId:e});return qc({type:Ti.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:yi,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:Yr(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:Ge,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 tt({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=Ne.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=wn(),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=bs,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(bn,{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=Ne.create({name:tp,addOptions(){return{button:({editor:t})=>({component:VN,componentProps:{editor:t}}),specialCharModal:void 0}},addStorage(){return{specialCharModal:this.options.specialCharModal}}}),Xk=Ne.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!==Te.EDITOR&&e.push(FN.configure(this.options.specialCharacter)),this.options.mode!==Te.EDITOR&&e.push(gZ),this.options.superText!==!1&&this.options.mode!==Te.PLAIN_TEXT&&this.options.mode!==Te.EDITOR&&(typeof this.options.superText=="boolean"?e.push(ik.configure()):e.push(ik.configure(this.options.superText))),this.options.mode===Te.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!==Te.EDITOR&&this.options.configPlan!==!1&&this.options.mode!==Te.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!==Te.EDITOR&&this.options.mode!==Te.PLAIN_TEXT&&e.push(vZ),(this.options.mode===Te.STRAIGHT||this.options.mode===Te.REPORT||this.options.mode===Te.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=Hn.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=Hn.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=Ne.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:Ge,componentProps:{action:()=>e.commands.toggleSubscript(),isActive:()=>e.isActive("subscript")||!1,disabled:!e.can().toggleSubscript(),icon:"Subscript",tooltip:r("editor.subscript.tooltip")}},l={component:Ge,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=Ne.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 Le||s instanceof Vn))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=Ne.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:Ge,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:Ge,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 tt({key:t,view(){return{update:async(x,E)=>{var k,C,_,T,A,D,M;const B=(k=this.key)===null||k===void 0?void 0:k.getState(E),F=(C=this.key)===null||C===void 0?void 0:C.getState(x.state),H=B.active&&F.active&&B.range.from!==F.range.from,X=!B.active&&F.active,ee=B.active&&!F.active,V=!X&&!ee&&B.query!==F.query,$=X||H&&V,I=V||H,U=ee||H&&V;if(!$&&!I&&!U)return;const L=U&&!$?B:F,K=x.dom.querySelector(`[data-decoration-id="${L.decorationId}"]`);b={editor:e,range:L.range,query:L.query,text:L.text,items:[],command:Y=>c({editor:e,range:L.range,props:Y}),decorationNode:K,clientRect:K?()=>{var Y;const{decorationId:ue}=(Y=this.key)===null||Y===void 0?void 0:Y.getState(e.state),pe=x.dom.querySelector(`[data-decoration-id="${ue}"]`);return(pe==null?void 0:pe.getBoundingClientRect())||null}:null},$&&((_=v==null?void 0:v.onBeforeStart)===null||_===void 0||_.call(v,b)),I&&((T=v==null?void 0:v.onBeforeUpdate)===null||T===void 0||T.call(v,b)),(I||$)&&(b.items=await f({editor:e,query:L.query})),U&&((A=v==null?void 0:v.onExit)===null||A===void 0||A.call(v,b)),I&&((D=v==null?void 0:v.onUpdate)===null||D===void 0||D.call(v,b)),$&&((M=v==null?void 0:v.onStart)===null||M===void 0||M.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:M}=A,B={...E};if(B.composing=T,_&&(D||e.view.composing)){(M<E.range.from||M>E.range.to)&&!T&&!E.composing&&(B.active=!1);const F=g({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:s,startOfLine:a,$position:A.$from}),H=`id_${Math.floor(Math.random()*4294967295)}`;F&&m({editor:e,state:C,range:F.range,isActive:E.active})?(B.active=!0,B.decorationId=E.decorationId?E.decorationId:H,B.range=F.range,B.query=F.query,B.text=F.text):B.active=!1}else B.active=!1;return B.active||(B.decorationId=null,B.range={from:0,to:0},B.query=null,B.text=null),B}},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?lt.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=Ne.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=wn(),{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(Ge,{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=Ne.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:Ge,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}=Qe.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=wn(),bee=Ne.create({name:"preview",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({t:e})=>({component:Ge,componentProps:{icon:"Eye",action:()=>{zv.togglePreview()},tooltip:e("editor.preview.tooltip"),isActive:()=>zv.state.showPreview}})}},addCommands(){return{togglePreview:()=>()=>(zv.togglePreview(),!0)}}}),Qk=wn(),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:lt.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:lt.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=Ne.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:Ge,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 tt({key:Eee,state:{init:()=>lt.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=[],lt.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}=wn(),Tee=Ne.create({name:"printer",addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),button:({t:e})=>({component:Ge,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=""false""><strong>Introduction(English)</strong></h1><p id="s864ng1o" extend=""false"">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=""false""><strong>소개(국문)</strong></h1><p id="0qei01hl" extend=""false"">마이마이 에디터는 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=Qe.useEventBus(pr.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 Qe.useEventListener(document,"mousedown",i,{capture:!0}),Qe.useEventListener(document,"touchstart",i,{capture:!0}),Qe.useEventListener(document,"focusin",s),Qe.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}=wn();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(Ge,{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(bn),{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,M,B;return[o.createElementVNode("div",Hee,[o.createVNode(Ge,{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(Ge,{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(Ge,{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(go),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Ge,{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(Ge,{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(Ge,{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(go),{orientation:"vertical",class:"mx-1 me-2 h-[16px]"}),o.createVNode(Ge,{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(Ge,{icon:"TableCellsSplit",action:m,"icon-class":"w-5 h-5",tooltip:o.unref(i)("editor.table.menu.splitCells"),"tooltip-options":{sideOffset:15},disabled:!((M=y.editor)!=null&&M.can().splitCell())},null,8,["tooltip","disabled"]),o.createVNode(o.unref(go),{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(Ge,{icon:"Trash2",tooltip:o.unref(i)("editor.table.menu.deleteTable"),"icon-class":"w-5 h-5",action:g,"tooltip-options":{sideOffset:15},disabled:!((B=y.editor)!=null&&B.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(Ge,{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(Ge,{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(Ge,{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(go),{key:0,orientation:"vertical",class:"h-4"})):o.createCommentVNode("",!0),o.createElementVNode("div",qee,[o.createVNode(Ge,{icon:"Pencil",tooltip:o.unref(n)("editor.link.edit.tooltip"),action:s,"tooltip-options":{sideOffset:15}},null,8,["tooltip"]),o.createVNode(Ge,{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(hs),{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(ms),{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=Qe.useEventBus(pr.RENDER_SUPER_TEXT),l=_=>{if(!e.value||!t)return;const T=e.value.index,A=e.value.id,{state:D}=t,{tr:M}=D;let B=!1;D.doc.descendants((F,H)=>{var X,ee;if(((X=F.attrs)==null?void 0:X[nt.ID])===A){(ee=F.attrs[nt.TEXT])!=null&&ee.trim();const V=_.trim();if(Eh(V))return M.delete(H,H+1),B=!0,!1;const{[nt.ELEMENT_ID]:$,...I}=F.attrs;return M.setNodeMarkup(H,void 0,{...I,[nt.TEXT]:V}),B=!0,!1}return!0}),B&&t&&t.view.dispatch(M),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 M=D.getBoundingClientRect().top;A.has(M)||A.set(M,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> </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(M=>M.id)),A=_.map(M=>({isHidden:M.classList.contains("hidden"),isTruncated:M.classList.contains("super-text-truncate")}));_.forEach(M=>{M.classList.remove("hidden"),M.classList.remove("super-text-truncate")});for(const M of u.value.keys())T.has(M)||u.value.delete(M);_.forEach(M=>{const B=M.getAttribute("book-mark-id");if(!B)return;const F=M.offsetTop+M.offsetHeight,H=u.value.get(B)||0;u.value.set(B,Math.max(F,H))}),_.forEach((M,B)=>{A[B].isHidden&&M.classList.add("hidden"),A[B].isTruncated&&M.classList.add("super-text-truncate")});let D=0;for(const M of u.value.values())M>D&&(D=M);s.value=D},b=async()=>{await o.nextTick();const T=c().map(A=>{const D=A.getAttribute("node-id"),M=A.getAttribute("book-mark-content"),B=A.getAttribute("page-id"),F=A.getAttribute("page-number"),H=A.getBoundingClientRect(),X=A.getAttribute("line-id"),ee=A.getAttribute("element-id");return{position:H,text:m(M),id:D,pageId:B,pageNumber:F,visiblePosition:f(A),status:0,lineId:X,elementId:ee,textOriginal:m(M)}});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")),M=Number(A.getAttribute("index"));return D-M}),_.forEach(T=>T.classList.remove("super-text-truncate")),_.forEach((T,A)=>{const D=T.getBoundingClientRect();_.slice(A+1).forEach(M=>{const B=M.getBoundingClientRect();v(D,B)&&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(B=>{const F=B.getBoundingClientRect().top,H=T==null?void 0:T.getBoundingClientRect().top;if(H==null)return!1;const X=H-F;return Math.abs(X-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(B=>B.classList.remove("hidden")),y();return}A.querySelector(".super-text-lines").innerHTML=m(_.text),A.classList.remove("super-text-truncate");const M=A.getBoundingClientRect();i.value.forEach((B,F)=>{if(F!==D){const H=B.getBoundingClientRect();v(M,H)&&B.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((M,B)=>{if(B!==T){const F=M.getBoundingClientRect();v(D,F)&&M.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=co(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(Ee)("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 M,B,F;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(Ee)("super-text-view","absolute w-full px-2 translate-y-[-10px] group",{})),style:o.normalizeStyle({top:`${A.visiblePosition||((M=A.position)==null?void 0:M.top)}px`}),onMouseover:H=>o.unref(p)(H,D),onMouseleave:C[0]||(C[0]=(...H)=>o.unref(m)&&o.unref(m)(...H))},[o.createVNode(o.unref(uv),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(Ee)("wrap-anywhere whitespace-pre-wrap w-full !font-normal px-1 pt-0 m-0 !leading-tight rounded-sm text-white border-transparent cursor-pointer",A.elementId?((B=k.superPreviewCustomClass)==null?void 0:B.completedSuper)??"bg-black":((F=k.superPreviewCustomClass)==null?void 0:F.unproducedSuper)??"bg-red-500",{"cursor-default":!o.unref(c)})),onDblclick:H=>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-f034d4ce"]]),Jee=["index","book-mark-id","line-id","onMouseover"],Zee=["innerHTML"],Qee=co(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(Ee)("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(Ee)("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:M=>o.unref(f)(M,_),onMouseleave:x[0]||(x[0]=(...M)=>o.unref(p)&&o.unref(p)(...M))},[o.createVNode(o.unref(uv),{role:"text",variant:"outline",class:o.normalizeClass(o.unref(Ee)("wrap-anywhere whitespace-pre-wrap 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:M=>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-b0ec2837"]]),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
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=Pr.fromJSON(r,c);s.push(f)}),s.length===0)return!1;const a=me.fromArray(s),l=_e.maxOpen(a);return t.dispatch(n.replaceSelection(l)),!0},ete=wn(),Dh=t=>{const e=o.computed(()=>ete.state.spellCheck);o.watch(()=>e.value,n=>{t.view.dispatch(t.state.tr.setMeta(jn.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=Qe.useEventBus(pr.RENDER_SUPER_TEXT),a=o.useAttrs(),l=wn(),{isReady:u,editor:c,updateEditorState:f,superTextStore:p,checkSpellStore:m,setEditorContextMenuRef:g,setEditorFocusedInstance:b}=l,v=o.inject("isEditable",o.ref(!0)),y=new Po({enablePasteRules:!1,enableInputRules:!1,content:gn(r.modelValue,r.disabled),editorProps:{attributes:{id:ur.COMMENT,[ur.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:kt.throttle((T,A)=>A.key==="Enter"&&a.enter&&!A.shiftKey?(i("enter"),!0):!1,$o),transformPastedHTML:T=>nS(T),handlePaste:(T,A)=>{const D=A.clipboardData;if(!D)return!1;const M=r.mode,B=D.getData("text/plain")||"",F=Array.from(D.items).some(H=>H.type.startsWith("image/"));return(M===Te.STRAIGHT||M===Te.REPORT)&&F?(A.preventDefault(),!0):M===Te.PLAIN_TEXT?(A.preventDefault(),T.dispatch(T.state.tr.insertText(B,T.state.selection.from)),!0):!1},clipboardTextParser:(T,A)=>{const D=T.split(/(?:\r\n?|\n)/),M=[];D.forEach(F=>{let H={type:"paragraph"};F.length>0&&(H.content=[{type:"text",text:F}]);let X=Pr.fromJSON(A.doc.type.schema,H);M.push(X)});const B=me.fromArray(M);return _e.maxOpen(B)}},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()},$o),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(ur.COMMENT);T==null||T.setAttribute(ur.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(gn(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===Te.REPORT&&g(k.value)}function _(T){T===Te.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}=Qe.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===Te.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 K=L.length,Y={0:0},ue=0;ue<K;ue++)L[ue]&&(Y[L[ue].charCodeAt(0)]=ue);return Y}p=x(s),m=x(a),g=x(l),b=x(u);function E(L){for(var K=L.length,Y={},ue,pe,ke=0;ke<K;ke++)ue=L[ke][0].charCodeAt(0),pe=L[ke][1].charCodeAt(0),typeof Y[ue]>"u"&&(Y[ue]={}),Y[ue][pe]=L[ke][2].charCodeAt(0);return Y}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,K){return y[L]&&y[L][K]?y[L][K]:!1}function M(L,K){return v[L]&&v[L][K]?v[L][K]:!1}var B=function(L,K){if(L===null)throw new Error("Arguments cannot be null");typeof L=="object"&&(L=L.join(""));for(var Y=[],ue=L.length,pe,ke,oe,ge,J,te=0;te<ue;te++){var ne=[];ge=L.charCodeAt(te),A(ge)?(ge-=i,oe=ge%28,ke=(ge-oe)/28%21,pe=parseInt((ge-oe)/28/21),ne.push(e[pe]),typeof n[ke]=="object"?ne=ne.concat(n[ke]):ne.push(n[ke]),oe>0&&(typeof r[oe]=="object"?ne=ne.concat(r[oe]):ne.push(r[oe]))):k(ge)?(C(ge)?J=e[m[ge]]:J=r[b[ge]],typeof J=="string"?ne.push(J):ne=ne.concat(J)):_(ge)?(J=n[g[ge]],typeof J=="string"?ne.push(J):ne=ne.concat(J)):ne.push(L.charAt(te)),K?Y.push(ne):Y=Y.concat(ne)}return Y},F=function(L){return typeof L!="string"?"":(L=B(L),L.join(""))},H=function(L){typeof L=="string"&&(L=B(L));var K=[],Y=L.length,ue,pe=0,ke=-1,oe,ge=!1;function J(ne){var se,ce,Se,Be=0,Ue,qe="";if(ge=!1,!(ke+1>ne))for(var Ke=1;;Ke++){if(Ke===1){if(se=L[ke+Ke].charCodeAt(0),_(se))if(ke+Ke+1<=ne&&_(ce=L[ke+Ke+1].charCodeAt(0))){K.push(String.fromCharCode(D(se,ce))),ke=ne;return}else{K.push(L[ke+Ke]),ke=ne;return}else if(!C(se)){K.push(L[ke+Ke]),ke=ne;return}qe=L[ke+Ke]}else if(Ke===2)if(ce=L[ke+Ke].charCodeAt(0),C(ce)){se=M(se,ce),qe=String.fromCharCode(se),K.push(qe),ke=ne;return}else qe=String.fromCharCode((m[se]*21+g[ce])*28+i);else Ke===3?(Se=L[ke+Ke].charCodeAt(0),D(ce,Se)?ce=D(ce,Se):Be=Se,qe=String.fromCharCode((m[se]*21+g[ce])*28+b[Be]+i)):Ke===4?(Ue=L[ke+Ke].charCodeAt(0),M(Be,Ue)?Be=M(Be,Ue):Be=Ue,qe=String.fromCharCode((m[se]*21+g[ce])*28+b[Be]+i)):Ke===5&&(Ue=L[ke+Ke].charCodeAt(0),Be=M(Be,Ue),qe=String.fromCharCode((m[se]*21+g[ce])*28+b[Be]+i));if(ke+Ke>=ne){K.push(qe),ke=ne;return}}}for(var te=0;te<Y;te++){if(ue=L[te].charCodeAt(0),!C(ue)&&!_(ue)&&!T(ue)){J(te-1),J(te),pe=0;continue}pe===0?C(ue)?pe=1:_(ue)&&(pe=4):pe==1?_(ue)?pe=2:M(oe,ue)?pe=5:J(te-1):pe==2?T(ue)?pe=3:_(ue)?D(oe,ue)||(J(te-1),pe=4):(J(te-1),pe=1):pe==3?T(ue)?!ge&&M(oe,ue)?ge=!0:(J(te-1),pe=1):C(ue)?(J(te-1),pe=1):_(ue)&&(J(te-2),pe=2):pe==4?_(ue)?D(oe,ue)?(J(te),pe=0):J(te-1):(J(te-1),pe=1):pe==5&&(_(ue)?(J(te-2),pe=2):(J(te-1),pe=1)),oe=ue}return J(te-1),K.join("")},X=function(L,K){var Y=B(L).join(""),ue=B(K).join("");return Y.indexOf(ue)},ee=function(L,K){var Y=B(L).join(""),ue=B(K).join(""),pe=B(L,!0),ke=new RegExp(ue,"gi"),oe=[],ge;if(!K.length)return[];for(;ge=ke.exec(Y);)oe.push(ge.index);function J(ne){for(var se=0,ce=0;se<pe.length;++se)if(ce+=pe[se].length,ne<ce)return se}function te(ne){for(var se=0,ce=0;se<pe.length;++se)if(ce+=pe[se].length,ne+ue.length<=ce)return se}return oe.map(function(ne){return[J(ne),te(ne)]})};function V(L){this.string=L,this.disassembled=B(L).join("")}V.prototype.search=function(L){return B(L).join("").indexOf(this.disassembled)};var $=function(L){typeof L=="object"&&(L=L.join(""));var K=L.charCodeAt(L.length-1);if(A(K)){K-=i;var Y=K%28;if(Y>0)return!0}else if(k(K))return!0;return!1},I=function(L,K){return B(L).pop()===K},U={disassemble:B,d:B,disassembleToString:F,ds:F,assemble:H,a:H,search:X,rangeSearch:ee,Searcher:V,endsWithConsonant:$,endsWith:I,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 K=0;K<L.length;K++)if(!A(L.charCodeAt(K)))return!1;return!0},isCompleteAll:function(L){if(typeof L!="string")return!1;for(var K=0;K<L.length;K++)if(!A(L.charCodeAt(K)))return!1;return!0},isConsonantAll:function(L){if(typeof L!="string")return!1;for(var K=0;K<L.length;K++)if(!k(L.charCodeAt(K)))return!1;return!0},isVowelAll:function(L){if(typeof L!="string")return!1;for(var K=0;K<L.length;K++)if(!_(L.charCodeAt(K)))return!1;return!0},isChoAll:function(L){if(typeof L!="string")return!1;for(var K=0;K<L.length;K++)if(!C(L.charCodeAt(K)))return!1;return!0},isJongAll:function(L){if(typeof L!="string")return!1;for(var K=0;K<L.length;K++)if(!T(L.charCodeAt(K)))return!1;return!0}};t.exports=U})()})(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 tt({key:Yl,state:{init(){return lt.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=lt.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,lt.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(Ee)("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=co(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=Qe.useLocalStorage("findReplaceDialogPosition",null),m=o.reactive({x:0,y:0}),g=o.ref(!1),b={x:0,y:0},v=M=>{const B=M.target;if(B.closest("input")||B.closest("button")||B.closest("label")||B.closest(".content-area"))return;g.value=!0;const F=document.querySelector(".find-replace-dialog");if(!F)return;const H=F.getBoundingClientRect();b.x=M.clientX-H.left,b.y=M.clientY-H.top,document.addEventListener("mousemove",y),document.addEventListener("mouseup",x)},y=M=>{g.value&&(m.x=M.clientX-b.x,m.y=M.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 M=>{var X,ee;if(!M)return;await o.nextTick();const B=document.querySelector(".find-replace-dialog");if(!B)return;const F=window.innerWidth,H=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((F-B.offsetWidth)/2,0),m.y=Math.max((H-B.offsetHeight)/2,0)),s.value&&r("refresh",i()),await o.nextTick(),(ee=(X=l.value)==null?void 0:X.$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(M){const B=M.target.value;s.value=B,r("refresh",i())}function D(M){const F=M.target.value+(M.data??"");r("refresh",{find:F,replace:a.value,caseSensitive:u.value,wholeWord:c.value})}return(M,B)=>{const F=gs,H=iS,X=bn,ee=Vc,V=Pc;return o.openBlock(),o.createBlock(V,{open:M.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(M.$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(M.$t("검색")),1),o.createElementVNode("div",pte,[o.createVNode(F,{ref_key:"findInputRef",ref:l,modelValue:s.value,"onUpdate:modelValue":B[0]||(B[0]=$=>s.value=$),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(M.$t("바꾸기")),1),o.createVNode(F,{modelValue:a.value,"onUpdate:modelValue":B[1]||(B[1]=$=>a.value=$),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,[B[3]||(B[3]=o.createElementVNode("div",null,null,-1)),o.createElementVNode("div",vte,[o.createElementVNode("div",yte,[o.createVNode(H,{id:"caseSensitive",checked:u.value,"onUpdate:checked":B[2]||(B[2]=$=>{u.value=!!$})},null,8,["checked"]),o.createElementVNode("label",wte,o.toDisplayString(M.$t("대소문자 일치")),1)])])]),o.createElementVNode("div",xte,[B[4]||(B[4]=o.createElementVNode("div",null,null,-1)),o.createElementVNode("div",Cte,[o.createVNode(X,{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(M.$t("바꾸기")),1)]),_:1}),o.createVNode(X,{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(M.$t("모두 바꾸기")),1)]),_:1}),o.createVNode(X,{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(M.$t("이전")),1)]),_:1},8,["disabled"]),o.createVNode(X,{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(M.$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=Qe.useEventBus(pr.RENDER_SUPER_TEXT),a=Qe.useEventBus(pr.INCREASE_DECREASE_FONTSIZE),l=o.useAttrs(),u=wn(),{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===Te.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(),F.value=!0)};o.onMounted(()=>{Ue(),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 M=ie=>{const Me=parseInt(_.value||"16px"),it=ie?Me+2:Me-2;_.value=it+"px"};o.onBeforeMount(()=>{r.disabled||a.on(M)}),o.onBeforeUnmount(()=>{r.disabled||a.off(M)});const B=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})),F=o.ref(!1),{searchUp:H,searchDown:X,replaceCurrent:ee,replaceAll:V,totalMatches:$,currentMatchIndex:I,refreshMatches:U,clearSearch:L}=ate(p);o.watch(F,ie=>{ie||L()});const K=ie=>{U(ie)},Y=ie=>{X(ie)},ue=ie=>{H(ie)},pe=ie=>{ee(ie)},ke=ie=>{V(ie)},oe=new Po({enablePasteRules:!1,enableInputRules:!1,content:gn(r.modelValue,r.disabled,r.mode),editorProps:{handleKeyDown:kt.throttle((ie,Me)=>Me.key==="Enter"&&l.enter&&!Me.shiftKey?(i("enter"),!0):!1,$o),transformPastedHTML:ie=>r.mode===Te.EDITOR?nR(ie):nS(ie),handlePaste:(ie,Me)=>{var st;const it=Me.clipboardData;if(!it)return!1;const Yt=r.mode,le=Array.from(it.items),Ie=le.some(At=>At.type.startsWith("image/")),He=le.some(At=>At.type.startsWith("video/"));if((Yt===Te.STRAIGHT||Yt===Te.REPORT)&&(Ie||He))return Me.preventDefault(),!0;if(He)return Me.preventDefault(),Ke(["video"])&&le.forEach(async At=>{var hr;if(!At.type.startsWith("video/"))return;const dn=At.getAsFile();if(!dn)return;const Kn=oe.extensionManager.extensions.find(nr=>nr.name==="video"),_o=(hr=Kn==null?void 0:Kn.options)==null?void 0:hr.upload,xn=_o?await _o(dn):URL.createObjectURL(dn);oe.commands.focus(),oe.commands.setVideo({src:xn})}),!0;const ct=((st=Me.clipboardData)==null?void 0:st.getData("text/plain"))||"";return r.mode===Te.EDITOR&&Uv(ct)?(Me.preventDefault(),Wv(ie,ct.trim())):!1},clipboardTextParser:(ie,Me)=>{const it=ie.split(/(?:\r\n?|\n)/),Yt=[];it.forEach(Ie=>{let He={type:"paragraph"};Ie.length>0&&(He.content=[{type:"text",text:Ie}]);let ct=Pr.fromJSON(Me.doc.type.schema,He);Yt.push(ct)});const le=me.fromArray(Yt);return _e.maxOpen(le)}},onCreate:({editor:ie})=>{m(ie)},onUpdate:kt.throttle(({editor:ie})=>{f.value=!0;const Me=qe(ie,r.output);i("update:modelValue",Me),i("change",{editor:ie,output:Me}),m(ie),o.nextTick(()=>{Ue()}),se()},$o),extensions:kt.uniqBy(qC(r.extensions,r),"name"),editable:E.value,onFocus:ie=>{v(je.value),x(ie.editor),i("onFocus",ie)},onBlur:ie=>i("onBlur",ie),parseOptions:{preserveWhitespace:"full"}}),ge=o.computed(()=>r.mode===Te.REPORT||r.mode===Te.STRAIGHT||r.mode===Te.PLAIN_TEXT),J=o.computed(()=>{const ie={height:"auto",minHeight:r.minHeight?rn(r.minHeight):void 0,maxHeight:r.maxHeight?rn(r.maxHeight):void 0,overflowY:"auto"},Me={fontFamily:np(oe,uc)&&T.value||r.fontFamilyDefault,fontSize:np(oe,Qf)&&_.value||r.fontSizeDefault,...np(oe,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,...Me}:Me});o.watch(()=>[J.value,r.disabled],async()=>{Ue()}),o.provide("minCharSuperInput",r.minChar.superPreview);const{contentInner:te,measuredMinWidth:ne,measure:se}=df({minChars:r.minChar.content,fontSize:_,editor:oe}),ce=o.ref(null),Se=o.computed(()=>{var ie;return(ie=ce.value)==null?void 0:ie.measuredMinWidthComment});o.provide("measuredMinWidthComment",Se);const Be=o.computed(()=>C.value?0:It.value?Number(ne==null?void 0:ne.value)+Number(Se==null?void 0:Se.value)+30:Number(ne==null?void 0:ne.value));async function Ue(){await o.nextTick(),s.emit({action:"render"})}function qe(ie,Me){if(!ie)return"";if(ie.isEmpty)return Me==="json"?{}:"";if(r.mode===Te.PLAIN_TEXT)return ie.getText({blockSeparator:`
|
|
346
346
|
`});switch(Me){case"html":return h1(ie,{removeNodes:[sc,yi]});case"json":return ie.getJSON();case"text":return ie.getText({blockSeparator:`
|
|
347
347
|
`});default:return""}}function Ke(ie){return ie.every(Me=>oe==null?void 0:oe.extensionManager.extensions.find(it=>it.name===Me))}o.watch(()=>b.languages,()=>{oe.commands.checkSpelling()}),o.watch(()=>r.modelValue,ie=>{if(!oe||kt.isEqual(qe(oe,r.output),ie))return;const{from:Me,to:it}=oe.state.selection;oe.commands.setTextSelection({from:Me,to:it}),oe.commands.setContent(gn(ie,r.disabled,r.mode),!1,{preserveWhitespace:"full"}),Ue()},{deep:!0}),o.watch(()=>E.value,ie=>{var Me;oe==null||oe.setEditable(ie),(Me=oe==null?void 0:oe.commands)!=null&&Me.setIsEnableSuggestion&&oe.commands.setIsEnableSuggestion(ie)},{immediate:!0}),o.watch(()=>p.value,()=>{p.value&&p.value.on("selectionUpdate",({editor:ie})=>{i("changed:selection",{editor:ie})})}),o.onUnmounted(()=>oe==null?void 0:oe.destroy()),wc(ju.SAVE,()=>{localStorage.setItem("content",qe(oe,"html"))});const It=o.computed(()=>{var Yt;if(!((Yt=oe==null?void 0:oe.storage)!=null&&Yt.superText))return!1;const{enable:ie}=oe.storage.superText,Me=[Te.EDITOR,Te.PLAIN_TEXT].includes(r.mode),it=r.disabled;return ie&&!Me&&!it}),q=o.ref(null),W=o.computed(()=>r.mode),{commentHeight:he,contentHeight:xe,minHeight:Ve,minHeightComment:ot}=ite(q,W,r.autoHeight,typeof r.minHeight=="string"?parseInt(r.minHeight):r.minHeight),je=o.ref(null);function z(ie){ie===Te.STRAIGHT&&v(je.value)}function N(ie){ie!==Te.REPORT&&x(oe)}o.onMounted(()=>{z(r.mode),N(r.mode),y(oe)}),o.watch(()=>r.mode,ie=>{z(ie),N(ie)});const re=o.ref(null),ye=()=>{var Me;(Me=re.value)!=null&&Me.editor.commands.focusInvalidChar()||oe.commands.focusInvalidChar()};u.focusFirstInvalidChar.value=ye,o.onActivated(()=>{u.focusFirstInvalidChar.value=ye});const $e=o.computed(()=>{var Me,it,Yt;const ie=((Me=r.fieldNameComment)==null?void 0:Me.label)||((it=r.fieldNameCommentCuesheet)==null?void 0:it.label)||((Yt=r.fieldNameContent)==null?void 0:Yt.label);return r.disabled&&ie});return e({editor:oe}),(ie,Me)=>{var st;const it=Lh,Yt=Rh,le=Ih,Ie=C8,He=mz,ct=xR;return o.unref(oe)?(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(oe).isFocused,"outline-ed-border":!o.unref(oe).isFocused}]]),style:o.normalizeStyle(o.unref(B))},[!ie.hideBubble&&!ie.disabled&&o.unref(E)?(o.openBlock(),o.createElementBlock(o.Fragment,{key:0},[Ke([o.unref(ac)])?(o.openBlock(),o.createBlock(it,{key:0,editor:o.unref(oe)},null,8,["editor"])):o.createCommentVNode("",!0),Ke([o.unref(ma)])?(o.openBlock(),o.createBlock(Yt,{key:1,editor:o.unref(oe)},null,8,["editor"])):o.createCommentVNode("",!0),Ke([o.unref(ps)])?(o.openBlock(),o.createBlock(le,{key:2,editor:o.unref(oe)},null,8,["editor"])):o.createCommentVNode("",!0),Ke([o.unref(Il),o.unref(yi)])?(o.openBlock(),o.createBlock(Ie,{key:3,editor:o.unref(oe)},null,8,["editor"])):o.createCommentVNode("",!0)],64)):o.createCommentVNode("",!0),ie.hideToolbar?o.createCommentVNode("",!0):(o.openBlock(),o.createBlock(He,{key:1,editor:o.unref(oe),"editor-comment":(st=o.unref(re))==null?void 0:st.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:q,class:o.normalizeClass(o.unref(Ee)("space-y-2 flex-1 flex flex-col break-keep",o.unref(ge)&&"[&_*]:!font-inherit",o.unref(ge)&&"[&_*]:!text-font-size-inherit")),style:o.normalizeStyle(o.unref(J))},[o.unref($e)?(o.openBlock(),o.createBlock(ct,{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(Te).REPORT&&!ie.hideComment?(o.openBlock(),o.createBlock(ote,{key:0,ref_key:"editorCommentRef",ref:re,mode:o.unref(Te).REPORT,extensions:ie.extensions,"model-value":r.comment,disabled:r.disabled,"disable-super-input":ie.disableSuperInput,"is-open-super-view":o.unref(It),"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(ot))}:{height:o.unref(rn)(o.unref(he)),minHeight:o.unref(rn)(o.unref(Ve))}),"editor-content-instance":o.unref(oe),class:"relative overflow-y-auto","onUpdate:modelValue":Me[0]||(Me[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(Ve))}:{height:o.unref(rn)(o.unref(xe))})},[o.createElementVNode("div",kte,[o.withDirectives(o.createVNode(Yee,{ref_key:"superTextViewRef",ref:ce,editor:o.unref(oe),"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(It)]]),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:je,editor:o.unref(oe),mode:ie.mode,"super-text-store":o.unref(g)},{default:o.withCtx(()=>[o.createVNode(o.unref(Qn),{editor:o.unref(oe),spellcheck:"true",class:o.normalizeClass(o.unref(Ee)("h-full break-all",ie.mode===o.unref(Te).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(F),"onUpdate:modelValue":Me[1]||(Me[1]=At=>o.isRef(F)?F.value=At:null),"total-matches":o.unref($),"current-match-index":o.unref(I),onSearchDown:Y,onSearchUp:ue,onReplace:pe,onReplaceAll:ke,onRefresh:K},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,wi,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=Qe.useThrottleFn(f,10);return Qe.useEventListener(l,"scroll",p),Qe.useResizeObserver(l,p),Qe.useEventListener(window,"resize",p),(m,g)=>(o.openBlock(),o.createElementBlock("div",{id:"tool-bar-format",class:o.normalizeClass(o.unref(Ee)("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(go),{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(X){X==null||X.preventDefault(),e.editor.getAttributes("image").src&&(e.editor.commands.updateImage({width:i.value?`${i.value}px`:null}),cf())}function f(X){const ee=Math.max(0,Math.min(100,parseInt(r.value)));e.editor.commands.updateImage({width:`${ee}%`}),cf()}function p(X){e.editor.commands.updateAttributes("image",{textAlign:X})}o.watch(r,()=>{r.value&&f()}),o.watch(()=>e.editor.getAttributes("image"),X=>{X&&(i.value=Math.round(parseFloat(X.originWidth)),s.value=Math.round(parseFloat(X.originHeight)),a.value=X.originWidth/X.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(X){p(X)}function v(){const X=e.editor.getAttributes("image"),{flipX:ee}=X;e.editor.commands.updateImage({flipX:!ee})}function y(){const X=e.editor.getAttributes("image"),{flipY:ee}=X;e.editor.commands.updateImage({flipY:!ee})}function x(){const{state:X,dispatch:ee}=e.editor.view;ol(X,ee)}function E(){const{state:X,dispatch:ee}=e.editor.view,{tr:V,selection:$}=X;if(!($ instanceof De))return;const I=$.from,U=X.doc.nodeAt(I);if(!U)return;const K=X.doc.resolve(I).nodeBefore;if(!K)return;const Y=I-K.nodeSize,ue=V.delete(I,I+U.nodeSize).insert(Y,U).setSelection(De.create(V.doc,Y));ee(ue)}function k(){const{state:X,dispatch:ee}=e.editor.view,{tr:V,doc:$,selection:I}=X;if(!(I instanceof De))return;const U=I.from,L=$.nodeAt(U);if(!L)return;const K=U+L.nodeSize;if(K>=$.content.size)return;const Y=$.nodeAt(K);if(!Y)return;const ue=K+Y.nodeSize-L.nodeSize,pe=U+Y.nodeSize,ke=V.delete(U,U+L.nodeSize).insert(ue,L).setSelection(De.create(V.doc,pe));ee(ke)}const C=o.ref(null),_=o.ref(!1),T=o.ref(!1);function A(){const X=C.value;if(!X)return;const{scrollLeft:ee,scrollWidth:V,clientWidth:$}=X;if(!(V>$+1)){_.value=!1,T.value=!1;return}const U=ee<=e.threshold,L=ee+$>=V-e.threshold;_.value=!U,T.value=!L}const D=Qe.useThrottleFn(A,10);Qe.useEventListener(C,"scroll",D),Qe.useResizeObserver(C,D),Qe.useEventListener(window,"resize",D);const M=o.inject("isMobile",!1),B=`dropdown-trigger-${Yr(10)}`,{isOpen:F}=yp({scrollEl:"tool-bar-image-scroll",ignoreSelector:`[data-radix-popper-content-wrapper], .${B}`}),H=o.computed(()=>M?{modal:!1,open:F.value,"onUpdate:open":X=>F.value=X}:{});return(X,ee)=>{const V=Ge,$=go,I=ga,U=cc,L=gs,K=Rl,Y=op,ue=rp,pe=ms,ke=hs;return o.openBlock(),o.createElementBlock("div",{id:"tool-bar-image",class:o.normalizeClass(o.unref(Ee)("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(V,{tooltip:o.unref(n)("editor.image.menu.flipX"),icon:"FlipVertical",action:v},null,8,["tooltip"]),o.createVNode(V,{tooltip:o.unref(n)("editor.image.menu.flipY"),icon:"FlipHorizontal",action:y},null,8,["tooltip"]),o.createVNode($,{orientation:"vertical",class:"h-5"}),o.createVNode(V,{tooltip:o.unref(n)("editor.image.menu.moveUp"),icon:"MoveUp",action:E,disabled:!X.editor.isEditable},null,8,["tooltip","disabled"]),o.createVNode(V,{tooltip:o.unref(n)("editor.image.menu.moveDown"),icon:"MoveDown",action:k,disabled:!X.editor.isEditable},null,8,["tooltip","disabled"]),o.createVNode($,{orientation:"vertical",class:"h-5"}),o.createVNode(ke,o.normalizeProps(o.guardReactiveProps(o.unref(H))),{default:o.withCtx(()=>[o.createVNode(I,{class:o.normalizeClass(B)},{default:o.withCtx(()=>[o.createVNode(V,{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(U,{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]=oe=>i.value=oe),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(U,{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]=oe=>s.value=oe),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(ue,{"model-value":r.value,"onUpdate:modelValue":[ee[2]||(ee[2]=oe=>r.value=oe),ee[3]||(ee[3]=oe=>{r.value=oe})]},{default:o.withCtx(()=>[o.createVNode(Y,null,{default:o.withCtx(()=>[(o.openBlock(),o.createElementBlock(o.Fragment,null,o.renderList(["25","50","75","100"],oe=>o.createVNode(K,{key:oe,value:oe},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(oe)+"% ",1)]),_:2},1032,["value"])),64))]),_:1})]),_:1},8,["model-value"])])]),_:1})]),_:1},16),o.createVNode($,{orientation:"vertical",class:"h-5"}),(o.openBlock(),o.createElementBlock(o.Fragment,null,o.renderList(l,(oe,ge)=>o.createVNode(V,{key:ge,tooltip:o.unref(n)(`editor.textalign.${oe}.tooltip`),icon:u[oe],action:()=>b(oe),disabled:!X.editor.can().setTextAlign(oe),"is-active":()=>X.editor.isActive({textAlign:oe})||!1},null,8,["tooltip","icon","action","disabled","is-active"])),64)),o.createVNode($,{orientation:"vertical",class:"h-5"}),o.createVNode(V,{tooltip:o.unref(n)("editor.remove"),icon:"Trash2",action:x,disabled:!X.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(Ee)("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(Ee)("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(Ee)("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((J,te)=>(J[~~te.id]=te)&&J,{})),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=(J,te)=>{const ne=J.target.closest(".splitpanes__splitter");if(ne){const{left:se,top:ce}=ne.getBoundingClientRect(),{clientX:Se,clientY:Be}="ontouchstart"in window&&J.touches?J.touches[0]:J;f.value.cursorOffset=r.horizontal?Be-ce:Se-se}g(),f.value.mouseDown=!0,f.value.activeSplitter=te},y=J=>{f.value.mouseDown&&(J.preventDefault(),f.value.dragging=!0,requestAnimationFrame(()=>{A(_(J)),oe("resize",{event:J},!0)}))},x=J=>{f.value.dragging&&(window.getSelection().removeAllRanges(),oe("resized",{event:J},!0)),f.value.mouseDown=!1,f.value.activeSplitter=null,setTimeout(()=>{f.value.dragging=!1,b()},100)},E=(J,te)=>{"ontouchstart"in window&&(J.preventDefault(),p.value.splitter===te?(clearTimeout(p.value.timeoutId),p.value.timeoutId=null,k(J,te),p.value.splitter=null):(p.value.splitter=te,p.value.timeoutId=setTimeout(()=>p.value.splitter=null,500))),f.value.dragging||oe("splitter-click",{event:J,index:te},!0)},k=(J,te)=>{if(oe("splitter-dblclick",{event:J,index:te},!0),r.maximizePanes){let ne=0;s.value=s.value.map((se,ce)=>(se.size=ce===te?se.max:se.min,ce!==te&&(ne+=se.min),se)),s.value[te].size-=ne,oe("pane-maximize",{event:J,index:te,pane:s.value[te]}),oe("resized",{event:J,index:te},!0)}},C=(J,te)=>{oe("pane-click",{event:J,index:a.value[te].index,pane:a.value[te]})},_=J=>{const te=u.value.getBoundingClientRect(),{clientX:ne,clientY:se}="ontouchstart"in window&&J.touches?J.touches[0]:J;return{x:ne-(r.horizontal?0:f.value.cursorOffset)-te.left,y:se-(r.horizontal?f.value.cursorOffset:0)-te.top}},T=J=>{J=J[r.horizontal?"y":"x"];const te=u.value[r.horizontal?"clientHeight":"clientWidth"];return r.rtl&&!r.horizontal&&(J=te-J),J*100/te},A=J=>{const te=f.value.activeSplitter;let ne={prevPanesSize:M(te),nextPanesSize:B(te),prevReachedMinPanes:0,nextReachedMinPanes:0};const se=0+(r.pushOtherPanes?0:ne.prevPanesSize),ce=100-(r.pushOtherPanes?0:ne.nextPanesSize),Se=Math.max(Math.min(T(J),ce),se);let Be=[te,te+1],Ue=s.value[Be[0]]||null,qe=s.value[Be[1]]||null;const Ke=Ue.max<100&&Se>=Ue.max+ne.prevPanesSize,It=qe.max<100&&Se<=100-(qe.max+B(te+1));if(Ke||It){Ke?(Ue.size=Ue.max,qe.size=Math.max(100-Ue.max-ne.prevPanesSize-ne.nextPanesSize,0)):(Ue.size=Math.max(100-qe.max-ne.prevPanesSize-B(te+1),0),qe.size=qe.max);return}if(r.pushOtherPanes){const q=D(ne,Se);if(!q)return;({sums:ne,panesToResize:Be}=q),Ue=s.value[Be[0]]||null,qe=s.value[Be[1]]||null}Ue!==null&&(Ue.size=Math.min(Math.max(Se-ne.prevPanesSize-ne.prevReachedMinPanes,Ue.min),Ue.max)),qe!==null&&(qe.size=Math.min(Math.max(100-Se-ne.nextPanesSize-ne.nextReachedMinPanes,qe.min),qe.max))},D=(J,te)=>{const ne=f.value.activeSplitter,se=[ne,ne+1];return te<J.prevPanesSize+s.value[se[0]].min&&(se[0]=F(ne).index,J.prevReachedMinPanes=0,se[0]<ne&&s.value.forEach((ce,Se)=>{Se>se[0]&&Se<=ne&&(ce.size=ce.min,J.prevReachedMinPanes+=ce.min)}),J.prevPanesSize=M(se[0]),se[0]===void 0)?(J.prevReachedMinPanes=0,s.value[0].size=s.value[0].min,s.value.forEach((ce,Se)=>{Se>0&&Se<=ne&&(ce.size=ce.min,J.prevReachedMinPanes+=ce.min)}),s.value[se[1]].size=100-J.prevReachedMinPanes-s.value[0].min-J.prevPanesSize-J.nextPanesSize,null):te>100-J.nextPanesSize-s.value[se[1]].min&&(se[1]=H(ne).index,J.nextReachedMinPanes=0,se[1]>ne+1&&s.value.forEach((ce,Se)=>{Se>ne&&Se<se[1]&&(ce.size=ce.min,J.nextReachedMinPanes+=ce.min)}),J.nextPanesSize=B(se[1]-1),se[1]===void 0)?(J.nextReachedMinPanes=0,s.value.forEach((ce,Se)=>{Se<l.value-1&&Se>=ne+1&&(ce.size=ce.min,J.nextReachedMinPanes+=ce.min)}),s.value[se[0]].size=100-J.prevPanesSize-B(se[0]-1),null):{sums:J,panesToResize:se}},M=J=>s.value.reduce((te,ne,se)=>te+(se<J?ne.size:0),0),B=J=>s.value.reduce((te,ne,se)=>te+(se>J+1?ne.size:0),0),F=J=>[...s.value].reverse().find(te=>te.index<J&&te.size>te.min)||{},H=J=>s.value.find(te=>te.index>J+1&&te.size>te.min)||{},X=()=>{var J;const te=Array.from(((J=u.value)==null?void 0:J.children)||[]);for(const ne of te){const se=ne.classList.contains("splitpanes__pane"),ce=ne.classList.contains("splitpanes__splitter");!se&&!ce&&(ne.remove(),console.warn("Splitpanes: Only <pane> elements are allowed at the root of <splitpanes>. One of your DOM nodes was removed."))}},ee=(J,te,ne=!1)=>{const se=J-1,ce=document.createElement("div");ce.classList.add("splitpanes__splitter"),ne||(ce.onmousedown=Se=>v(Se,se),typeof window<"u"&&"ontouchstart"in window&&(ce.ontouchstart=Se=>v(Se,se)),ce.onclick=Se=>E(Se,se+1)),ce.ondblclick=Se=>k(Se,se+1),te.parentNode.insertBefore(ce,te)},V=J=>{J.onmousedown=void 0,J.onclick=void 0,J.ondblclick=void 0,J.remove()},$=()=>{var J;const te=Array.from(((J=u.value)==null?void 0:J.children)||[]);for(const se of te)se.className.includes("splitpanes__splitter")&&V(se);let ne=0;for(const se of te)se.className.includes("splitpanes__pane")&&(!ne&&r.firstSplitter?ee(ne,se,!0):ne&&ee(ne,se),ne++)},I=({uid:J,...te})=>{const ne=a.value[J];for(const[se,ce]of Object.entries(te))ne[se]=ce},U=J=>{var te;let ne=-1;Array.from(((te=u.value)==null?void 0:te.children)||[]).some(se=>(se.className.includes("splitpanes__pane")&&ne++,se.isSameNode(J.el))),s.value.splice(ne,0,{...J,index:ne}),s.value.forEach((se,ce)=>se.index=ce),c.value&&o.nextTick(()=>{$(),K({addedPane:s.value[ne]}),oe("pane-add",{pane:s.value[ne]})})},L=J=>{const te=s.value.findIndex(se=>se.id===J);s.value[te].el=null;const ne=s.value.splice(te,1)[0];s.value.forEach((se,ce)=>se.index=ce),o.nextTick(()=>{$(),oe("pane-remove",{pane:ne}),K({removedPane:{...ne}})})},K=(J={})=>{!J.addedPane&&!J.removedPane?ue():s.value.some(te=>te.givenSize!==null||te.min||te.max<100)?pe(J):Y(),c.value&&oe("resized")},Y=()=>{const J=100/l.value;let te=0;const ne=[],se=[];for(const ce of s.value)ce.size=Math.max(Math.min(J,ce.max),ce.min),te-=ce.size,ce.size>=ce.max&&ne.push(ce.id),ce.size<=ce.min&&se.push(ce.id);te>.1&&ke(te,ne,se)},ue=()=>{let J=100;const te=[],ne=[];let se=0;for(const Se of s.value)J-=Se.size,Se.givenSize!==null&&se++,Se.size>=Se.max&&te.push(Se.id),Se.size<=Se.min&&ne.push(Se.id);let ce=100;if(J>.1){for(const Se of s.value)Se.givenSize===null&&(Se.size=Math.max(Math.min(J/(l.value-se),Se.max),Se.min)),ce-=Se.size;ce>.1&&ke(ce,te,ne)}},pe=({addedPane:J,removedPane:te}={})=>{let ne=100/l.value,se=0;const ce=[],Se=[];((J==null?void 0:J.givenSize)??null)!==null&&(ne=(100-J.givenSize)/(l.value-1));for(const Be of s.value)se-=Be.size,Be.size>=Be.max&&ce.push(Be.id),Be.size<=Be.min&&Se.push(Be.id);if(!(Math.abs(se)<.1)){for(const Be of s.value)(J==null?void 0:J.givenSize)!==null&&(J==null?void 0:J.id)===Be.id||(Be.size=Math.max(Math.min(ne,Be.max),Be.min)),se-=Be.size,Be.size>=Be.max&&ce.push(Be.id),Be.size<=Be.min&&Se.push(Be.id);se>.1&&ke(se,ce,Se)}},ke=(J,te,ne)=>{let se;J>0?se=J/(l.value-te.length):se=J/(l.value-ne.length),s.value.forEach((ce,Se)=>{if(J>0&&!te.includes(ce.id)){const Be=Math.max(Math.min(ce.size+se,ce.max),ce.min),Ue=Be-ce.size;J-=Ue,ce.size=Be}else if(!ne.includes(ce.id)){const Be=Math.max(Math.min(ce.size+se,ce.max),ce.min),Ue=Be-ce.size;J-=Ue,ce.size=Be}}),Math.abs(J)>.1&&o.nextTick(()=>{c.value&&console.warn("Splitpanes: Could not resize panes correctly due to their constraints.")})},oe=(J,te=void 0,ne=!1)=>{const se=(te==null?void 0:te.index)??f.value.activeSplitter??null;n(J,{...te,...se!==null&&{index:se},...ne&&se!==null&&{prevPane:s.value[se-(r.firstSplitter?1:0)],nextPane:s.value[se+(r.firstSplitter?0:1)]},panes:s.value.map(ce=>({min:ce.min,max:ce.max,size:ce.size}))})};o.watch(()=>r.firstSplitter,()=>$()),o.onMounted(()=>{X(),$(),K(),oe("ready"),c.value=!0}),o.onBeforeUnmount(()=>c.value=!1);const ge=()=>{var J;return o.h("div",{ref:u,class:m.value},(J=i.default)==null?void 0:J.call(i))};return o.provide("panes",s),o.provide("indexedPanes",a),o.provide("horizontal",o.computed(()=>r.horizontal)),o.provide("requestUpdate",I),o.provide("onPaneAdd",U),o.provide("onPaneRemove",L),o.provide("onPaneClick",C),(J,te)=>(o.openBlock(),o.createBlock(o.resolveDynamicComponent(ge)))}},No={__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 Po({extensions:n.value,content:T,editable:!1,parseOptions:{preserveWhitespace:"full"}})}r.value||(f.value=g(gn(e.comment,!0,e.mode))),i.value||(p.value=g(gn(e.commentCuesheet,!0,e.mode))),s.value||(m.value=g(gn(e.content,!0,e.mode)));function b(T,A){if(!T)return;const D=gn(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!==Te.EDITOR?!0:!e.hideComment),C=o.computed(()=>e.mode!==Te.REPORT?!0:e.mode===Te.REPORT&&!e.hideComment),_=o.computed(()=>e.mode===Te.STRAIGHT||e.mode===Te.PLAIN_TEXT||!k.value);return(T,A)=>{const D=Kc;return o.openBlock(),o.createBlock(o.unref(Fh),{horizontal:"",class:o.normalizeClass(o.unref(Ee)("flex-1 text-sm"))},{default:o.withCtx(()=>[o.unref(_)?(o.openBlock(),o.createBlock(o.unref(No),{key:0,class:o.normalizeClass(o.unref(Ee)("!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(No),{key:0,class:o.normalizeClass(o.unref(Ee)("!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(Ee)("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(Te).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(No),{key:1,class:o.normalizeClass(o.unref(Ee)("!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,wi,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(Ee)("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(go),{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===wi&&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(go),{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=co(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(Te).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(Le.create(v.doc,x,k)),b.dispatch(C),requestAnimationFrame(()=>{const _=b.state.tr.setSelection(Le.create(b.state.doc,x,x));b.dispatch(_),b.focus()})}return o.onMounted(()=>{const m=e.editor.view.dom;Qe.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(Le.create(k.doc,C,T))),requestAnimationFrame(()=>{E.dispatch(E.state.tr.setSelection(Le.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=Hn.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(l){n=l}function i(l){let u=l==null?void 0:l.parentElement;for(;u;){if(u.id==="comment-wrap-scroll"){u=u.parentElement;continue}const f=getComputedStyle(u).overflowY;if(f==="auto"||f==="scroll")return u;u=u.parentElement}return window}function s(l){e&&cancelAnimationFrame(e),e=requestAnimationFrame(()=>{const{view:u,state:c}=l,{from:f}=c.selection,p=u.coordsAtPos(f),m=i(u.dom),g=o.unref(t);if(m===window){const C=window.innerHeight-g,_=p.top-C;_>0&&window.scrollBy({top:_,behavior:"smooth"});return}const b=m,v=b.getBoundingClientRect(),y=p.top-v.top,x=b.clientHeight-g,E=y-x;E>0&&b.scrollBy({top:E,behavior:"smooth"})})}function a(l){requestAnimationFrame(()=>{const{view:u,state:c}=l,{from:f}=c.selection,p=u.coordsAtPos(f),m=i(u.dom),g=o.unref(t);if(m===window){const T=window.innerHeight,A=T-n-g;if(!(p.top>A))return;const M=T-g,B=p.top-M;B>0&&window.scrollBy({top:B,behavior:"smooth"});return}const b=m,v=b.getBoundingClientRect(),y=p.top-v.top,x=b.clientHeight,E=x-n-g;if(!(y>E))return;const C=x-g,_=y-C;_>0&&b.scrollBy({top:_,behavior:"smooth"})})}return{onTypingScrollCaretNearBottom:s,onKeyboardShowScrollNearBottom:a,setKeyboardHeight:r}}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=wn(),{isReady:l,editor:u,updateEditorState:c,checkSpellStore:f}=a,{onTypingScrollCaretNearBottom:p}=uS(r.bottomOffset),m=o.inject("isEditable",o.ref(!0)),g=new Po({enablePasteRules:!1,enableInputRules:!1,content:gn(r.modelValue,r.disabled),editorProps:{attributes:{id:ur.COMMENT,[ur.DISABLE_SUPER_INPUT]:`${r.disableSuperInput}`},handleKeyDown:kt.throttle((E,k)=>k.key==="Enter"&&s.enter&&!k.shiftKey?(i("enter"),!0):!1,$o),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===Te.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)},$o),extensions:[lS,...kt.uniqBy(r.extensions,"name")],editable:m.value,onFocus:()=>{b()},onBlur:({editor:E,event:k})=>{i("onBlurEditor",k)},onSelectionUpdate:({editor:E})=>{E.isFocused&&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,yi]});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(gn(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(ur.COMMENT);E==null||E.setAttribute(ur.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(ps)])?(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(Ee)("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 je;const r=t,i=n,s=new c1;o.provide("isMobile",!0),Qe.useEventBus(pr.INCREASE_DECREASE_FONTSIZE);const a=o.useAttrs(),l=wn(),{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(()=>r.isShowFormatControlBar&&r.mode===Te.EDITOR&&B&&!r.isEditorView),C=o.computed(()=>k.value?100:40),_=o.ref(!1),{onTypingScrollCaretNearBottom:T,onKeyboardShowScrollNearBottom:A,setKeyboardHeight:D}=uS(C);function M(){s.isNativeWebViewAvailable()&&(s.receiveDataFromNative(s1.KEYBOARD_DID_SHOW,z=>{_.value=!0,D(z.height),setTimeout(()=>{var N;(N=I.value)!=null&&N.isFocused&&A(I.value)},50)}),s.receiveDataFromNative(s1.KEYBOARD_DID_HIDE,()=>{_.value=!1}))}const B=o.ref(!r.disabled&&!r.readonly);o.provide("isEditable",B);const F=o.ref(r.fontSizeDefault),H=o.ref(r.fontFamilyDefault),X=o.ref(r.fontWeightDefault);o.provide("fontSize",F),o.provide("fontFamily",H),o.provide("fontWeight",X);const ee=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})),V=new Po({enablePasteRules:!1,enableInputRules:!1,content:gn(r.modelValue,r.disabled,r.mode),editorProps:{handleKeyDown:kt.throttle((z,N)=>N.key==="Enter"&&a.enter&&!N.shiftKey?(i("enter"),!0):!1,$o),transformPastedHTML:z=>(z=z.replace(/\s*style="[^"]*"/g,""),z),handlePaste(z,N){var ye;const re=((ye=N.clipboardData)==null?void 0:ye.getData("text/plain"))||"";return r.mode===Te.EDITOR&&Uv(re)?(N.preventDefault(),Wv(z,re.trim())):r.mode===Te.PLAIN_TEXT?(N.preventDefault(),Nee(z,re)):!1}},onCreate:({editor:z})=>{m(z)},onUpdate:kt.throttle(({editor:z})=>{f.value=!0;const N=Y(z,r.output);i("update:modelValue",N),i("change",{editor:z,output:N}),m(z),$(z)},$o),extensions:kt.uniqBy(qC(r.extensions,r),"name"),editable:B.value,onFocus:z=>{L(),i("onFocus",z),x()},onBlur:z=>i("onBlur",z),parseOptions:{preserveWhitespace:"full"},onSelectionUpdate:({editor:z})=>{z.isFocused&&T(z)}});function $(z){const N=[];z.state.doc.descendants(re=>{re.type.name==="image"&&N.push({id:re.attrs.id,src:re.attrs.src})}),b(N)}const I=o.ref(),{isShowToolBarBaseOnEditor:U}=Ree();o.onMounted(()=>{L(V),v(V),M()});function L(z){I.value=z??V,l.setEditorSelectedMobile(I.value)}const K=o.computed(()=>V.storage.superText.isShowSuperInputMoblie);function Y(z,N){if(!z)return"";if(z.isEmpty)return N==="json"?{}:"";if(r.mode===Te.PLAIN_TEXT)return z.getText({blockSeparator:`
|