@bagelink/vue 1.15.27 → 1.15.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -28,7 +28,7 @@ ${f}}`:p.map(([h,v])=>`${h}: ${typeof v=="object"&&v!==null?i(v,d+1):String(v)}`
28
28
  `);return i===-1?"":o.stack.slice(i+1)})();try{if(!n.stack)n.stack=a;else if(a){const i=a.indexOf(`
29
29
  `),l=i===-1?-1:a.indexOf(`
30
30
  `,i+1),s=l===-1?"":a.slice(l+1);String(n.stack).endsWith(s)||(n.stack+=`
31
- `+a)}}catch{}}throw n}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Fr(this.defaults,t);const{transitional:n,paramsSerializer:o,headers:a}=t;n!==void 0&&pi.assertOptions(n,{silentJSONParsing:Bt.transitional(Bt.boolean),forcedJSONParsing:Bt.transitional(Bt.boolean),clarifyTimeoutError:Bt.transitional(Bt.boolean),legacyInterceptorReqResOrdering:Bt.transitional(Bt.boolean),advertiseZstdAcceptEncoding:Bt.transitional(Bt.boolean)},!1),o!=null&&(K.isFunction(o)?t.paramsSerializer={serialize:o}:pi.assertOptions(o,{encode:Bt.function,serialize:Bt.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),pi.assertOptions(t,{baseUrl:Bt.spelling("baseURL"),withXsrfToken:Bt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=a&&K.merge(a.common,a[t.method]);a&&K.forEach(["delete","get","head","post","put","patch","query","common"],p=>{delete a[p]}),t.headers=on.concat(i,a);const l=[];let s=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(t)===!1)return;s=s&&h.synchronous;const v=t.transitional||au;v&&v.legacyInterceptorReqResOrdering?l.unshift(h.fulfilled,h.rejected):l.push(h.fulfilled,h.rejected)});const c=[];this.interceptors.response.forEach(function(h){c.push(h.fulfilled,h.rejected)});let u,d=0,f;if(!s){const p=[Jd.bind(this),void 0];for(p.unshift(...l),p.push(...c),f=p.length,u=Promise.resolve(t);d<f;)u=u.then(p[d++],p[d++]);return u}f=l.length;let m=t;for(;d<f;){const p=l[d++],h=l[d++];try{m=p(m)}catch(v){h.call(this,v);break}}try{u=Jd.call(this,m)}catch(p){return Promise.reject(p)}for(d=0,f=c.length;d<f;)u=u.then(c[d++],c[d++]);return u}getUri(e){return e=Fr(this.defaults,e),qh(Kh(e.baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};K.forEach(["delete","get","head","options"],function(t){Ii.prototype[t]=function(n,o){return this.request(Fr(o||{},{method:t,url:n,data:(o||{}).data}))}});K.forEach(["post","put","patch","query"],function(t){function n(o){return function(i,l,s){return this.request(Fr(s||{},{method:t,headers:o?{"Content-Type":"multipart/form-data"}:{},url:i,data:l}))}}Ii.prototype[t]=n(),t!=="query"&&(Ii.prototype[t+"Form"]=n(!0))});var hi=Ii,JS=class e0{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const o=this;this.promise.then(a=>{if(!o._listeners)return;let i=o._listeners.length;for(;i-- >0;)o._listeners[i](a);o._listeners=null}),this.promise.then=a=>{let i;const l=new Promise(s=>{o.subscribe(s),i=s}).then(a);return l.cancel=function(){o.unsubscribe(i)},l},t(function(i,l,s){o.reason||(o.reason=new Oa(i,l,s),n(o.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=o=>{t.abort(o)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new e0(function(o){t=o}),cancel:t}}},ZS=JS;function QS(e){return function(n){return e.apply(null,n)}}function e3(e){return K.isObject(e)&&e.isAxiosError===!0}var Zs={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Zs).forEach(([e,t])=>{Zs[t]=e});var t3=Zs;function t0(e){const t=new hi(e),n=Bh(hi.prototype.request,t);return K.extend(n,hi.prototype,t,{allOwnKeys:!0}),K.extend(n,t,null,{allOwnKeys:!0}),n.create=function(a){return t0(Fr(e,a))},n}var dt=t0(su);dt.Axios=hi;dt.CanceledError=Oa;dt.CancelToken=ZS;dt.isCancel=Yh;dt.VERSION=cu;dt.toFormData=vl;dt.AxiosError=Ce;dt.Cancel=dt.CanceledError;dt.all=function(t){return Promise.all(t)};dt.spread=QS;dt.isAxiosError=e3;dt.mergeConfig=Fr;dt.AxiosHeaders=on;dt.formToJSON=e=>Gh(K.isHTMLForm(e)?new FormData(e):e);dt.getAdapter=Qh.getAdapter;dt.HttpStatusCode=t3;dt.default=dt;var du=dt,oo=du;function n3(e={}){e.baseURL!==void 0&&(oo=du.create({baseURL:e.baseURL}))}const Jl={get:async e=>oo.get("/files",{params:{path_key:e}}),put:async(e,t)=>oo.put("/files",e,{params:{path_key:t}}),delete:async e=>oo.delete(`/files/${e}`,{params:{path_key:e}}),upload:async(e,t)=>{const n=new FormData;return n.append("file",e),n.append("upload",e),oo.post("/files/upload",n,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:t?.onUploadProgress,params:{dir_path:t?.dirPath,tags:t?.tags}})},list:async e=>oo.get("/files/list",{params:{dir_path:e}})};function n0(e={}){const t=e.namespace||"default",n=(0,r.ref)([]),o=(0,r.ref)([]),a=(0,r.ref)([]),i=(0,r.computed)(()=>{const f=o.value.map(m=>m.path_key);return[...a.value,...f]}),l=f=>URL.createObjectURL(f);function s(f){if(!f)return;let m=[];f instanceof File?m=[f]:f instanceof FileList?m=Array.from(f):Array.isArray(f)&&(m=f);const p=m.map(h=>({url:l(h),name:h.name,file:h,progress:0,namespace:t}));e.multiple?n.value.push(...p):n.value=p,e.onFileQueued&&p.length>0&&e.onFileQueued(p)}async function c(f){if(typeof f=="string"){o.value=o.value.filter(p=>p.path_key!==f);const m=a.value.indexOf(f);m!==-1&&a.value.splice(m,1);try{await Jl.delete(f)}catch{}}else if(f){const m=f instanceof File?{name:f.name}:f,p=n.value.findIndex(h=>h.file.name===m.name&&h.namespace===t);p!==-1&&n.value.splice(p,1)}e.onChange?.()}async function u(){const f=n.value.filter(m=>m.namespace===t);for(const m of f){m.uploading=!0,e.multiple||a.value.splice(0,1);try{const{data:p}=await Jl.upload(m.file,{onUploadProgress:h=>{m.progress=h.loaded/h.total*100-1},dirPath:(0,r.toValue)(e.dirPath)});a.value.push(p.path_key)}catch{}}n.value=n.value.filter(m=>m.namespace!==t)}function d(f=!1){if(e.disabled)return;const m=document.createElement("input");m.type="file",m.multiple=!!e.multiple,m.accept=e.accept||"",e.capture!==void 0&&e.capture!==!1&&(m.capture=e.capture===!0?"environment":e.capture),m.onchange=p=>{s(p.target.files),f&&u()},m.click()}return(0,r.onMounted)(()=>{const f=(0,r.toValue)(e.dirPath);f&&Jl.list(f).then(m=>{const p=Array.isArray(m.data)?m.data:[m.data];o.value.push(...p)}).catch(m=>{})}),{fileQueue:n,storageFiles:o,pk:a,pathKeys:i,fileToUrl:l,removeFile:c,flushQueue:u,addFile:s,browse:d,namespace:t}}var r3=["data-field"],o3={key:0},a3={key:0},i3=["name"],l3={key:1,class:"flex align-items-center gap-1 p-05"},s3={class:"txt-gray txt-12"},c3={class:"m-05 flex opacity-8 z-99 gap-025"},u3={class:"flex gap-025 rounded pe-1 ps-05 py-025 -my-1"},d3={class:"ellipsis-1 word-break-all h-20 m-0 color-black txt16"},f3={key:2,class:"txt-gray txt-12"},m3={key:0,class:"bgl-multi-preview"},p3={class:"m-0"},h3=["src"],g3={class:"no-margin multi-preview-txt"},v3={key:0,class:"progress"},y3={key:1,class:"bgl-single-preview"},b3={key:0,class:"h-100"},_3=["src"],w3={class:"p-1 flex column hover fileUploadPlaceHolder justify-content-center mb-05"},$3={class:"pretty balance user-select-none"},E3={key:4,class:"error-message"},k3=(0,r.defineComponent)({__name:"UploadInput",props:{id:{},name:{},label:{},multiple:{type:Boolean},modelValue:{},width:{},height:{default:"215px"},dirPath:{},fill:{type:Boolean},oval:{type:Boolean},theme:{default:"dropzone"},accept:{default:"*"},capture:{type:[Boolean,String]},required:{type:Boolean},disabled:{type:Boolean},baseURL:{},placeholder:{},dropPlaceholder:{},noFilePlaceholder:{},btnPlaceholder:{},error:{},showIcon:{type:Boolean,default:!0},icon:{default:"upload_2"},iconSize:{default:2.5},iconMobileSize:{},frame:{type:Boolean},outline:{type:Boolean},minWidth:{},maxWidth:{},labelColor:{},labelActiveColor:{}},emits:["update:modelValue","addFileStart"],setup(e,{emit:t}){const n=e,o=t,{$t:a}=ft(),i=(0,r.useSlots)(),{fileQueue:l,pathKeys:s,removeFile:c,flushQueue:u,addFile:d,browse:f,pk:m}=n0({disabled:n.disabled,dirPath:n.dirPath,multiple:n.multiple,accept:n.accept,capture:n.capture,namespace:n.id||"upload",onFileQueued:async()=>{await u(),$()},onChange:$});(0,r.watch)(()=>n.modelValue,E=>m.value=E?[E].flat().filter(Boolean):[],{immediate:!0});const{shellClass:p,shellStyle:h}=lt(n),v=(0,r.computed)(()=>s.value.length>0||l.value.length>0),b=(0,r.computed)(()=>{const E=n.dropPlaceholder??n.placeholder;if(E==null)return a("upload.dropPlaceholder");const I=Ee(E);return I!=null&&I!==""?I:a("upload.dropPlaceholder")}),g=(0,r.computed)(()=>!s.value.length&&!l.value.length||!!n.multiple),y=E=>Li.test(E),_=(0,r.ref)(!1);function w(E,I=!1){E.preventDefault(),E.stopPropagation(),n.disabled||(_.value=I)}function $(){n.multiple?o("update:modelValue",s.value):o("update:modelValue",s.value[0]||void 0)}async function N(E){n.disabled||(E.preventDefault(),E.stopPropagation(),o("addFileStart"),d(E.dataTransfer?.files),_.value=!1)}function k(E){return!E||typeof E!="string"?"file":E.split("/").pop()||"file"}return(E,I)=>{const D=(0,r.resolveDirective)("tooltip"),V=(0,r.resolveDirective)("lightbox");return(0,r.openBlock)(),(0,r.createElementBlock)("div",{class:(0,r.normalizeClass)(["bagel-input",[(0,r.unref)(p),{"has-error":!!e.error,"has-value":v.value}]]),style:(0,r.normalizeStyle)((0,r.unref)(h)),"data-field":e.name||e.id},[e.label?((0,r.openBlock)(),(0,r.createElementBlock)("label",o3,[(0,r.createTextVNode)((0,r.toDisplayString)(e.label),1),e.required?((0,r.openBlock)(),(0,r.createElementBlock)("span",a3," *")):(0,r.createCommentVNode)("",!0)])):(0,r.createCommentVNode)("",!0),e.required&&!(0,r.unref)(s).length?((0,r.openBlock)(),(0,r.createElementBlock)("input",{key:1,name:e.name||e.id,placeholder:"required",type:"text",required:"",class:"pixel"},null,8,i3)):(0,r.createCommentVNode)("",!0),e.theme==="basic"?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(or),{key:2,outline:"",class:"flex p-05 gap-1",onDragover:I[2]||(I[2]=x=>w(x,!0)),onDrop:N},{default:(0,r.withCtx)(()=>[!(0,r.unref)(s).length&&!(0,r.unref)(l).length?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:0,class:"px-1-5",icon:"upload",outline:"",value:e.btnPlaceholder||(0,r.unref)(a)("upload.upload"),onClick:I[0]||(I[0]=x=>(0,r.unref)(f)())},null,8,["value"])):(0,r.createCommentVNode)("",!0),(0,r.unref)(l).length>0?((0,r.openBlock)(),(0,r.createElementBlock)("div",l3,[(0,r.createVNode)((0,r.unref)(Wr),{size:"20"}),(0,r.createElementVNode)("span",s3,(0,r.toDisplayString)((0,r.unref)(a)("upload.uploading",{count:(0,r.unref)(l).length,plural:(0,r.unref)(l).length>1?"s":""})),1)])):(0,r.createCommentVNode)("",!0),((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(s),x=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:x,class:"txt-gray txt-12 flex"},[(0,r.createElementVNode)("div",c3,[(0,r.withDirectives)((0,r.createVNode)((0,r.unref)(re),{color:"gray",thin:"",icon:"delete",onClick:T=>(0,r.unref)(c)(x)},null,8,["onClick"]),[[D,"Delete"]]),(0,r.withDirectives)((0,r.createVNode)((0,r.unref)(re),{color:"gray",thin:"",icon:"autorenew",onClick:I[1]||(I[1]=T=>(0,r.unref)(f)())},null,512),[[D,"Replace"]]),(0,r.createVNode)((0,r.unref)(re),{icon:"download",color:"gray",thin:"",href:(0,r.unref)(fn)(x),download:k(x)},null,8,["href","download"]),(0,r.createElementVNode)("div",u3,[(0,r.createVNode)((0,r.unref)(ve),{icon:"draft",size:1.5}),(0,r.withDirectives)(((0,r.openBlock)(),(0,r.createElementBlock)("p",d3,[(0,r.createTextVNode)((0,r.toDisplayString)(k(x)),1)])),[[V,{src:(0,r.unref)(fn)(x),download:!0}]])])])]))),128)),!(0,r.unref)(s).length&&!(0,r.unref)(l).length?((0,r.openBlock)(),(0,r.createElementBlock)("span",f3,(0,r.toDisplayString)(e.noFilePlaceholder||(0,r.unref)(a)("upload.noFile")),1)):(0,r.createCommentVNode)("",!0)]),_:1})):((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:3,class:(0,r.normalizeClass)(["fileUploadWrap",{fileDropZone:!(0,r.unref)(s).length&&!(0,r.unref)(l).length,dragover:_.value,"bgl_oval-upload":e.oval}]),style:(0,r.normalizeStyle)({width:e.width,height:e.height}),onClick:I[4]||(I[4]=x=>(0,r.unref)(f)()),onDragover:I[5]||(I[5]=x=>w(x,!0)),onDrop:N,onDragleave:I[6]||(I[6]=x=>w(x))},[(0,r.renderSlot)(E.$slots,"files",{files:(0,r.unref)(s),fileQueue:(0,r.unref)(l)},()=>[e.multiple?((0,r.openBlock)(),(0,r.createElementBlock)("div",m3,[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(s),x=>(0,r.withDirectives)(((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:x,class:(0,r.normalizeClass)(["multi-image-item-preview",{"bgl_fill-image":e.fill}])},[y(x)?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(bo),{key:0,pathKey:x,class:"multi-preview"},null,8,["pathKey"])):((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(ve),{key:1,icon:"description",class:"multi-preview"})),(0,r.createElementVNode)("p",p3,(0,r.toDisplayString)(k(x)),1),(0,r.createVNode)((0,r.unref)(re),{thin:"",flat:"",icon:"delete",color:"red",onClick:T=>(0,r.unref)(c)(x)},null,8,["onClick"])],2)),[[V,{src:(0,r.unref)(fn)(x),download:!0}]])),128)),((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(l),x=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:x.name,class:(0,r.normalizeClass)(["multi-image-item-preview",{"bgl_fill-image":e.fill}])},[y(x.file.type)?((0,r.openBlock)(),(0,r.createElementBlock)("img",{key:0,class:"multi-preview",src:x.url,alt:""},null,8,h3)):((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(ve),{key:1,icon:"description",class:"multi-preview"})),(0,r.createElementVNode)("p",g3,(0,r.toDisplayString)(x.name),1),(0,r.createElementVNode)("div",{class:(0,r.normalizeClass)(["pie",{complete:x.progress===100}]),style:(0,r.normalizeStyle)([{"--p":x.progress},{"--b":"2px"}])},[x.progress<100?((0,r.openBlock)(),(0,r.createElementBlock)("span",v3,(0,r.toDisplayString)(x.progress.toFixed(0)),1)):(0,r.createCommentVNode)("",!0),(0,r.createVNode)((0,r.unref)(ve),{class:"success",icon:"check_circle"})],6)],2))),128))])):(0,r.unref)(s).length>0||(0,r.unref)(l).length>0?((0,r.openBlock)(),(0,r.createElementBlock)("div",y3,[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(s),x=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:x,class:(0,r.normalizeClass)(["single-image-item-preview",{"bgl_fill-image":e.fill}])},[(0,r.createElementVNode)("div",{class:(0,r.normalizeClass)(["flex opacity-8 z-99 gap-025 absolute top-0 start-0",{"mx-auto end-0 mt-1 justify-content-center":e.oval,"m-05":!e.oval}])},[(0,r.withDirectives)((0,r.createVNode)((0,r.unref)(re),{color:"white",frame:"",thin:"",icon:"delete",onClick:T=>(0,r.unref)(c)(x)},null,8,["onClick"]),[[D,"Delete"]]),(0,r.withDirectives)((0,r.createVNode)((0,r.unref)(re),{color:"white",frame:"",thin:"",icon:"autorenew",onClick:I[3]||(I[3]=T=>(0,r.unref)(f)())},null,512),[[D,"Replace"]]),(0,r.withDirectives)((0,r.createVNode)((0,r.unref)(re),{color:"white",frame:"",thin:"",icon:"download",href:(0,r.unref)(fn)(x),download:k(x)},null,8,["href","download"]),[[D,"Download"]])],2),y(x)?((0,r.openBlock)(),(0,r.createElementBlock)("div",b3,[(0,r.withDirectives)((0,r.createVNode)((0,r.unref)(bo),{class:"single-preview",pathKey:x,alt:""},null,8,["pathKey"]),[[V,{src:(0,r.unref)(fn)(x),download:!0}]])])):(0,r.withDirectives)(((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(ve),{key:1,size:4,weight:"2",icon:"description",class:"color-primary w-100"},null,512)),[[V,{src:(0,r.unref)(fn)(x),download:!0}]])],2))),128)),((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(l),x=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:x.name,class:(0,r.normalizeClass)(["single-image-item-preview",{"bgl_fill-image":e.fill}])},[(0,r.createVNode)((0,r.unref)(Wr),{type:"bar",progress:x.progress,class:"absolute bottom-05 end start w-100px mx-auto rounded overflow-hidden"},null,8,["progress"]),y(x.file.type)?((0,r.openBlock)(),(0,r.createElementBlock)("img",{key:0,class:"single-preview opacity-5",src:x.url,alt:""},null,8,_3)):(0,r.createCommentVNode)("",!0)],2))),128))])):(0,r.createCommentVNode)("",!0)],!0),g.value&&(0,r.unref)(i)["drop-placeholder"]?(0,r.renderSlot)(E.$slots,"drop-placeholder",{key:0,files:(0,r.unref)(s),fileQueue:(0,r.unref)(l),browse:(0,r.unref)(f)},void 0,!0):g.value?(0,r.renderSlot)(E.$slots,"placeholder",{key:1,files:(0,r.unref)(s),fileQueue:(0,r.unref)(l),browse:(0,r.unref)(f)},()=>[(0,r.createElementVNode)("p",w3,[e.showIcon?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(ve),{key:0,icon:e.icon,size:e.iconSize,"mobile-size":e.iconMobileSize,class:"user-select-none line-height-1"},null,8,["icon","size","mobile-size"])):(0,r.createCommentVNode)("",!0),(0,r.createElementVNode)("span",$3,(0,r.toDisplayString)(b.value),1)])],!0):(0,r.createCommentVNode)("",!0)],38)),e.error?((0,r.openBlock)(),(0,r.createElementBlock)("div",E3,(0,r.toDisplayString)(e.error),1)):(0,r.createCommentVNode)("",!0)],14,r3)}}}),ga=$e(k3,[["__scopeId","data-v-742753b3"]]);const C3=["mergeCells","splitCells","addRowBefore","addRowAfter","deleteRow","insertColumnLeft","insertColumnRight","deleteColumn","tableAlignLeft","tableAlignCenter","tableAlignRight","tableAlignJustify","deleteTable"],S3=["h1","h2","h3","h4","h5","h6","separator","p","blockquote","orderedList","unorderedList","separator","bold","italic","underline","separator","alignMenu","ltrDirection","rtlDirection","separator","insertTable","separator","link","image","video","embed","clear","separator","undo","redo","separator","splitView","fullScreen"],hR=["h1","h2","h3","h4","h5","h6","separator","bold","italic","underline","separator","fontColor","bgColor","separator","p","blockquote","orderedList","unorderedList","indent","outdent","separator","link","image","video","embed","separator","splitView","clear","insertTable",...C3,"separator","undo","redo","fullScreen"],x3=[{name:"headingsMenu",label:"Headings",icon:"title"},{name:"mediaMenu",label:"Media",icon:"perm_media"},{name:"alignMenu",label:"Alignment",icon:"format_align_left"},{name:"h1",label:"Heading 1",icon:"format_h1"},{name:"h2",label:"Heading 2",icon:"format_h2"},{name:"h3",label:"Heading 3",icon:"format_h3"},{name:"h4",label:"Heading 4",icon:"format_h4"},{name:"h5",label:"Heading 5",icon:"format_h5"},{name:"h6",label:"Heading 6",icon:"format_h6"},{name:"p",label:"Paragraph",icon:"format_paragraph"},{name:"blockquote",label:"Blockquote",icon:"format_quote"},{name:"bold",label:"Bold",icon:"format_bold"},{name:"italic",label:"Italic",icon:"format_italic"},{name:"underline",label:"Underline",icon:"format_underlined"},{name:"orderedList",label:"Ordered List",icon:"format_list_numbered"},{name:"unorderedList",label:"Unordered List",icon:"format_list_bulleted"},{name:"link",label:"Link",icon:"add_link"},{name:"image",label:"Image",icon:"add_photo_alternate"},{name:"video",label:"Video",icon:"play_circle"},{name:"embed",label:"Embed",icon:"media_link"},{name:"splitView",label:"Split View",icon:"code"},{name:"clear",label:"Clear Formatting",icon:"format_clear"},{name:"alignLeft",label:"Align Left",icon:"format_align_left"},{name:"alignCenter",label:"Align Center",icon:"format_align_center"},{name:"alignRight",label:"Align Right",icon:"format_align_right"},{name:"alignJustify",label:"Align Justify",icon:"format_align_justify"},{name:"tableAlignLeft",label:"Table Align Left",icon:"format_align_left"},{name:"tableAlignCenter",label:"Table Align Center",icon:"format_align_center"},{name:"tableAlignRight",label:"Table Align Right",icon:"format_align_right"},{name:"tableAlignJustify",label:"Table Align Justify",icon:"format_align_justify"},{name:"indent",label:"Indent",icon:"format_indent_increase"},{name:"outdent",label:"Outdent",icon:"format_indent_decrease"},{name:"fontColor",label:"Font Color",icon:"format_color_text"},{name:"bgColor",label:"Background Color",icon:"format_color_fill"},{name:"insertTable",label:"Insert Table",icon:"table"},{name:"deleteTable",label:"Delete Table",icon:"delete_sweep"},{name:"mergeCells",label:"Merge Cells",icon:"table_chart"},{name:"splitCells",label:"Split Cells",icon:"dashboard"},{name:"addRowBefore",label:"Insert Row Above",icon:"add_box"},{name:"addRowAfter",label:"Insert Row Below",icon:"vertical_align_bottom"},{name:"deleteRow",label:"Delete Row",icon:"remove"},{name:"insertColumnLeft",label:"Insert Column Left",icon:"format_indent_decrease"},{name:"insertColumnRight",label:"Insert Column Right",icon:"format_indent_increase"},{name:"deleteColumn",label:"Delete Column",icon:"view_week"},{name:"separator"},{name:"undo",label:"Undo",icon:"undo"},{name:"redo",label:"Redo",icon:"redo"},{name:"separator"},{name:"fullScreen",label:"Full Screen",icon:"fullscreen",class:"ms-auto"},{name:"textDirection",label:"Text Direction (RTL/LTR)",icon:"format_textdirection_r_to_l"},{name:"ltrDirection",label:"Left to Right",icon:"format_textdirection_l_to_r"},{name:"rtlDirection",label:"Right to Left",icon:"format_textdirection_r_to_l"}];var T3={class:"table-grid-selector p-075"},N3={class:"txt-center mb-075"},D3={style:{"font-size":"14px","font-weight":"500",color:"#333","margin-bottom":"4px"}},A3=["onFocus","onMouseenter","onClick"],B3={class:"border-top pt-075"},M3=10,L3=10,P3=(0,r.defineComponent)({__name:"TableGridSelector",emits:["insert","openAdvanced"],setup(e,{emit:t}){const n=t,o=(0,r.ref)(0),a=(0,r.ref)(0),i=(0,r.computed)(()=>{const f=[];for(let m=1;m<=M3;m++)for(let p=1;p<=L3;p++)f.push({row:m,col:p,isActive:m<=o.value&&p<=a.value});return f}),l=(0,r.computed)(()=>o.value===0||a.value===0?"Select table size":`${o.value} × ${a.value}`);function s(f,m){o.value=f,a.value=m}function c(f,m,p){n("insert",f,m),p()}function u(f){n("openAdvanced"),f()}function d(){o.value=0,a.value=0}return(f,m)=>((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(Vt),{placement:"bottom-start",thin:"",flat:"",icon:"table"},{default:(0,r.withCtx)(({hide:p})=>[(0,r.createElementVNode)("div",T3,[(0,r.createElementVNode)("div",N3,[(0,r.createElementVNode)("div",D3,(0,r.toDisplayString)(l.value),1),m[0]||(m[0]=(0,r.createElementVNode)("div",{style:{"font-size":"12px",color:"#666"}}," Hover to select size ",-1))]),(0,r.createElementVNode)("div",{style:{display:"grid","grid-template-columns":"repeat(10, 20px)","grid-template-rows":"repeat(10, 20px)",gap:"2px","margin-bottom":"12px",direction:"ltr"},onMouseleave:d,onBlur:d},[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(i.value,h=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:`${h.row}-${h.col}`,tabindex:"0",style:(0,r.normalizeStyle)({width:"20px",height:"20px",border:"1px solid #ddd",backgroundColor:h.isActive?"var(--bgl-primary)":"#fff",cursor:"pointer",borderRadius:"2px",transition:"background-color 0.1s ease"}),onFocus:v=>s(h),onMouseenter:v=>s(h.row,h.col),onClick:v=>c(h.row,h.col,p)},null,44,A3))),128))],32),(0,r.createElementVNode)("div",B3,[(0,r.createVNode)((0,r.unref)(re),{value:"Advanced Settings",icon:"settings",class:"bg-gray-30 color-black",onClick:h=>u(p)},null,8,["onClick"])])])]),_:1}))}}),I3=P3,V3={class:"toolbar flex gap-025 pb-05 flex-wrap",role:"toolbar",style:{position:"relative"}},O3={class:"flex flex-column p-025"},R3=(0,r.defineComponent)({__name:"EditorToolbar",props:{config:{default:()=>S3},selectedStyles:{},hideImages:{type:Boolean,default:!1},hideVideos:{type:Boolean,default:!1},hideEmbeds:{type:Boolean,default:!1},hideTables:{type:Boolean,default:!1},hideAlignment:{type:Boolean,default:!1},hideDirections:{type:Boolean,default:!1},hideH5H6:{type:Boolean,default:!1},hide:{default:()=>[]}},emits:["action"],setup(e,{emit:t}){const n=t;function o(){return e.selectedStyles.has("alignLeft")?"format_align_left":e.selectedStyles.has("alignCenter")?"format_align_center":e.selectedStyles.has("alignRight")?"format_align_right":e.selectedStyles.has("alignJustify")?"format_align_justify":"format_align_left"}function a(){return e.selectedStyles.has("alignLeft")||e.selectedStyles.has("alignCenter")||e.selectedStyles.has("alignRight")||e.selectedStyles.has("alignJustify")}function i(f){if(e.hide.includes(f))return!0;for(const[m,p]of Object.entries({image:["insertImage","image"],video:["insertVideo","video"],embed:["insertEmbed","embed"],table:["insertTable"],direction:["textDirection"],fullScreen:["fullScreen"],ul:["unorderedList"],ol:["orderedList"],splitView:["splitView"],p:["p"],align:["alignMenu"],alignment:["alignMenu"]}))if(e.hide.includes(m)&&p.includes(f))return!0;return{insertImage:e.hideImages,insertVideo:e.hideVideos,insertEmbed:e.hideEmbeds,insertTable:e.hideTables,alignMenu:e.hideAlignment,textDirection:e.hideDirections,h5:e.hideH5H6,h6:e.hideH5H6}[f]||!1}const l=f=>x3.find(m=>m.name===f);function s(f){const m=e.config.map(l).filter(Boolean);let p=-1;for(let v=f-1;v>=0;v--){const b=m[v];if(b&&b.name!=="separator"&&!i(b.name)){p=v;break}}let h=-1;for(let v=f+1;v<m.length;v++){const b=m[v];if(b&&b.name!=="separator"&&!i(b.name)){h=v;break}}if(p===-1||h===-1)return!1;for(let v=p+1;v<f;v++){const b=m[v];if(b&&b.name==="separator")return!1}return!0}function c(f,m){n("action",f,m)}function u(f,m){const p=document.createElement("table");p.style.width="100%",p.style.borderCollapse="collapse",p.style.marginBottom="1rem";const h=document.createElement("thead"),v=h.insertRow();for(let g=0;g<m;g++){const y=document.createElement("th");y.innerHTML=`Header ${g+1}`,y.style.padding="8px",y.style.border="1px solid #ddd",y.style.backgroundColor="#f4f4f4",v.appendChild(y)}p.appendChild(h);const b=document.createElement("tbody");for(let g=0;g<f;g++){const y=b.insertRow();for(let _=0;_<m;_++){const w=y.insertCell();w.innerHTML="&nbsp;",w.style.padding="8px",w.style.border="1px solid #ddd"}}p.appendChild(b),n("action","insertTable",p.outerHTML)}function d(){n("action","insertTable")}return(f,m)=>{const p=(0,r.resolveDirective)("tooltip");return(0,r.openBlock)(),(0,r.createElementBlock)("div",V3,[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(e.config.map(l).filter(Boolean),(h,v)=>((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:v},[h.name==="insertTable"&&!i("insertTable")?((0,r.openBlock)(),(0,r.createBlock)(I3,{key:0,onInsert:u,onOpenAdvanced:d})):h.name==="insertImage"&&!i("insertImage")?(0,r.withDirectives)(((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:1,icon:h.icon,thin:"",flat:"","aria-label":h.name,class:(0,r.normalizeClass)([[h.class,{active:e.selectedStyles.has(h.name)}],""]),tabindex:"-1",onClick:b=>c(h.name)},null,8,["icon","aria-label","class","onClick"])),[[p,h.label]]):h.name==="insertVideo"&&!i("insertVideo")?(0,r.withDirectives)(((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:2,icon:h.icon,thin:"",flat:"","aria-label":h.name,class:(0,r.normalizeClass)([[h.class,{active:e.selectedStyles.has(h.name)}],""]),tabindex:"-1",onClick:b=>c(h.name)},null,8,["icon","aria-label","class","onClick"])),[[p,h.label]]):h.name==="insertEmbed"&&!i("insertEmbed")?(0,r.withDirectives)(((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:3,icon:h.icon,thin:"",flat:"","aria-label":h.name,class:(0,r.normalizeClass)([[h.class,{active:e.selectedStyles.has(h.name)}],""]),tabindex:"-1",onClick:b=>c(h.name)},null,8,["icon","aria-label","class","onClick"])),[[p,h.label]]):h.name==="alignMenu"&&!i("alignMenu")?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(Vt),{key:4,placement:"bottom-start",thin:"",flat:"",icon:o(),class:(0,r.normalizeClass)({"alignment-active":a()})},{default:(0,r.withCtx)(({hide:b})=>[(0,r.createElementVNode)("div",O3,[(0,r.createVNode)((0,r.unref)(re),{thin:"",flat:"",icon:"format_align_left",class:(0,r.normalizeClass)({active:e.selectedStyles.has("alignLeft")}),onClick:g=>{c("alignLeft"),b()}},null,8,["class","onClick"]),(0,r.createVNode)((0,r.unref)(re),{thin:"",flat:"",icon:"format_align_center",class:(0,r.normalizeClass)({active:e.selectedStyles.has("alignCenter")}),onClick:g=>{c("alignCenter"),b()}},null,8,["class","onClick"]),(0,r.createVNode)((0,r.unref)(re),{thin:"",flat:"",icon:"format_align_right",class:(0,r.normalizeClass)({active:e.selectedStyles.has("alignRight")}),onClick:g=>{c("alignRight"),b()}},null,8,["class","onClick"]),(0,r.createVNode)((0,r.unref)(re),{thin:"",flat:"",icon:"format_align_justify",class:(0,r.normalizeClass)({active:e.selectedStyles.has("alignJustify")}),onClick:g=>{c("alignJustify"),b()}},null,8,["class","onClick"])])]),_:1},8,["icon","class"])):h.name==="textDirection"&&!i("textDirection")?(0,r.withDirectives)(((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:5,icon:e.selectedStyles.has("textDirection")?"format_textdirection_l_to_r":"format_textdirection_r_to_l",thin:"",flat:"","aria-label":h.name,class:(0,r.normalizeClass)([[h.class,{active:e.selectedStyles.has("textDirection")}],""]),tabindex:"-1",onClick:b=>c(h.name)},null,8,["icon","aria-label","class","onClick"])),[[p,h.label]]):(h.name==="h5"||h.name==="h6")&&!i(h.name)?(0,r.withDirectives)(((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:6,icon:h.icon,thin:"",flat:"","aria-label":h.name,class:(0,r.normalizeClass)([[h.class,{active:e.selectedStyles.has(h.name)}],""]),tabindex:"-1",onClick:b=>c(h.name)},null,8,["icon","aria-label","class","onClick"])),[[p,h.label]]):h.name!=="separator"&&h.name!=="insertTable"&&h.name!=="insertImage"&&h.name!=="insertVideo"&&h.name!=="insertEmbed"&&h.name!=="alignMenu"&&h.name!=="textDirection"&&h.name!=="h5"&&h.name!=="h6"&&!i(h.name)?(0,r.withDirectives)(((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:7,icon:h.icon,thin:"",flat:"","aria-label":h.name,class:(0,r.normalizeClass)([[h.class,{active:e.selectedStyles.has(h.name)}],""]),tabindex:"-1",onClick:b=>c(h.name)},null,8,["icon","aria-label","class","onClick"])),[[p,h.label]]):h.name==="separator"&&s(v)?((0,r.openBlock)(),(0,r.createElementBlock)("span",{key:`separator-${v}`,class:"opacity-2 mb-025"},"|")):(0,r.createCommentVNode)("",!0)],64))),128))])}}}),F3=$e(R3,[["__scopeId","data-v-2af54422"]]);function z3(e,t){const{doc:n}=t;if(!n)return;const o=n.getSelection();if(!o||!o.rangeCount)return;let a=o.getRangeAt(0);if(a.collapsed){if(!U3(n,a)){const{showTooltipMessage:s}=t;s?s("To add a link, please select text first or place cursor within a word"):alert("To add a link, please select text first or place the cursor within a word you want to turn into a link.");return}a=o.getRangeAt(0)}const i=a.commonAncestorContainer,l=(i.nodeType===Node.TEXT_NODE?i.parentElement:i)?.closest("a");if(t.openLinkModal){t.openLinkModal(o,a,l);return}alert("Link functionality requires proper modal setup")}function U3(e,t){if(!t.collapsed)return!0;let n=t.startContainer,o=t.startOffset;if(n.nodeType!==Node.TEXT_NODE){const c=n;if(c.childNodes.length>0&&o<c.childNodes.length){const u=c.childNodes[o];if(u.nodeType===Node.TEXT_NODE)n=u,o=0;else return!1}else return!1}const a=n.textContent||"";if(!a)return!1;let i=o,l=o;const s=/[\u0590-\u05FF\u0600-\u06FF\w]/;for(;i>0&&s.test(a[i-1]);)i--;for(;l<a.length&&s.test(a[l]);)l++;if(i<l){t.setStart(n,i),t.setEnd(n,l);const c=e.getSelection();return c&&(c.removeAllRanges(),c.addRange(t)),!0}return!1}function Qd(e,t,n){if(!n.doc)return;const o=n.doc.createElement("table");o.style.width="100%",o.style.borderCollapse="collapse",o.style.marginBottom="1rem";const a=n.doc.createElement("thead"),i=a.insertRow();for(let c=0;c<t;c++){const u=n.doc.createElement("th");u.innerHTML=`Header ${c+1}`,u.style.padding="8px",u.style.border="1px solid var(--bgl-border-color, #ddd)",u.style.backgroundColor="var(--bgl-gray-light, #f4f4f4)",i.appendChild(u)}o.appendChild(a);const l=n.doc.createElement("tbody");for(let c=0;c<e;c++){const u=l.insertRow();for(let d=0;d<t;d++){const f=u.insertCell();f.innerHTML="&nbsp;",f.style.padding="8px",f.style.border="1px solid var(--bgl-border-color, #ddd)"}}o.appendChild(l);const{range:s}=n;if(s){if(s.insertNode(o),n.doc.getSelection()){const c=o.querySelector("td");if(c){s.selectNodeContents(c),s.collapse(!0);const u=n.doc.getSelection();u&&(u.removeAllRanges(),u.addRange(s))}}}else n.doc.body.appendChild(o);n.content=n.doc.body.innerHTML}function H3(e,t){const n=Array.from(e.cloneContents().querySelectorAll("td"));if(n.length<2)return;const o=e.startContainer.parentElement?.closest("td");if(!o)return;o.colSpan=n.length,o.innerHTML=n.map(i=>i.innerHTML).join(" "),n.slice(1).forEach(i=>{t.getElementById(i.id)?.remove()});const a=t.editorState;a&&(a.content=t.body.innerHTML)}function W3(e,t){const n=e.startContainer.parentElement?.closest("td");if(!n||!n.colSpan||n.colSpan===1)return;const o=new Array(n.colSpan-1).fill(0).map(()=>{const i=t.createElement("td");return i.style.border="1px solid var(--bgl-border-color)",i.style.padding="8px",i.innerHTML="&nbsp;",i});n.colSpan=1,n.insertAdjacentElement("afterend",o[0]),o.slice(1).forEach(i=>{o[0].insertAdjacentElement("afterend",i)});const a=t.editorState;a&&(a.content=t.body.innerHTML)}function ef(e,t,n){const o=t.startContainer.parentElement?.closest("td");if(!o)return;const a=o.parentElement,i=a?.parentElement;if(!a||!i)return;const l=a.cloneNode(!0);Array.from(l.cells).forEach(c=>c.innerHTML="&nbsp;"),a.insertAdjacentElement(e==="before"?"beforebegin":"afterend",l);const s=n.editorState;s&&(s.content=n.body.innerHTML)}function j3(e){const t=e.startContainer.parentElement?.closest("td");if(!t)return;const n=t.parentElement;if(!n)return;const o=n.ownerDocument;n.remove();const a=o.editorState;a&&(a.content=o.body.innerHTML)}function q3(e){const t=e.startContainer.parentElement?.closest("td");if(!t)return;const n=t.closest("table");if(!n)return;const o=n.ownerDocument;n.remove();const a=o.editorState;a&&(a.content=o.body.innerHTML)}function tf(e,t){const n=t.startContainer.parentElement?.closest("td");if(!n)return;const o=n.closest("table");if(!o)return;const a=n.cellIndex,{rows:i}=o;for(let s=0;s<i.length;s++){const c=i[s].insertCell(e==="after"?a+1:a);c.innerHTML="&nbsp;",c.style.border="1px solid var(--bgl-border-color)",c.style.padding="8px"}const l=o.ownerDocument.editorState;l&&(l.content=o.ownerDocument.body.innerHTML)}function G3(e){const t=e.startContainer.parentElement?.closest("td");if(!t)return;const n=t.closest("table");if(!n)return;const o=t.cellIndex,{rows:a}=n,i=n.ownerDocument;for(let s=0;s<a.length;s++)a[s].deleteCell(o);a[0].cells.length===0&&n.remove();const l=i.editorState;l&&(l.content=i.body.innerHTML)}function Y3(e,t){const n=e.startContainer.parentElement?.closest("td");if(!n)return;const o=n.closest("table");if(!o)return;const a=n.cellIndex,{rows:i}=o;for(let s=0;s<i.length;s++){const c=i[s].cells[a];c&&(c.style.textAlign=t)}const l=o.ownerDocument.editorState;l&&(l.content=o.ownerDocument.body.innerHTML)}function We(e){if(!e.doc)return null;const t=e.doc.getSelection();return!t||!t.rangeCount?null:{selection:t,range:t.getRangeAt(0)}}function Zl(e,t,n){if(!t.collapsed)return!1;let o=t.startContainer,a=t.startOffset;if(o.nodeType!==Node.TEXT_NODE){const f=o;if(f.childNodes.length>0&&a<f.childNodes.length){const m=f.childNodes[a];if(m.nodeType===Node.TEXT_NODE)o=m,a=0;else return!1}else return!1}const{parentElement:i}=o,l=i?.closest(n.toLowerCase());if(l)try{const f=l.parentNode;if(f){for(;l.firstChild;)f.insertBefore(l.firstChild,l);f.removeChild(l);const m=e.createRange();m.setStart(o,a),m.collapse(!0);const p=e.getSelection();return p&&(p.removeAllRanges(),p.addRange(m)),!0}}catch{return!1}const s=o.textContent||"";if(!s)return!1;let c=a,u=a;const d=/[\u0590-\u05FF\u0600-\u06FF\w]/;for(a>0&&d.test(s[a-1])&&(a>=s.length||!d.test(s[a]))&&(c=a-1,u=a-1);c>0&&d.test(s[c-1]);)c--;for(;u<s.length&&d.test(s[u]);)u++;if(c<u&&u>c)try{const f=s.substring(0,c),m=s.substring(c,u),p=s.substring(u),h=e.createElement(n);h.textContent=m;const v=o.parentNode;if(v){if(f){const y=e.createTextNode(f);v.insertBefore(y,o)}if(v.insertBefore(h,o),p){const y=e.createTextNode(p);v.insertBefore(y,o)}v.removeChild(o);const b=e.createRange();b.setStartAfter(h),b.collapse(!0);const g=e.getSelection();return g&&(g.removeAllRanges(),g.addRange(b)),!0}}catch{}return!1}function X3(e){if(!e.doc)return;e.content=e.doc.body.innerHTML;const t=e.doc.getSelection();t&&t.rangeCount>0&&(e.selection=t,e.range=t.getRangeAt(0).cloneRange(),e.rangeCount=t.rangeCount)}function Uo(e){let t=e.nodeType===Node.TEXT_NODE?e.parentElement:e;for(;t;){if(t.matches&&t.matches("p,h1,h2,h3,h4,h5,h6,blockquote,li,div"))return t;t=t.parentElement}return null}function Ae(e,t,n){return{name:e,execute:(o,a)=>{o.doc&&(t(o,a),X3(o))},isActive:n}}function K3(e){const t={undo:Ae("Undo",()=>{if(e.undoStack.length>0&&e.doc){const m=e.undoStack.pop();m!==void 0&&(e.redoStack.push(e.content),e.content=m,e.doc.body.innerHTML=m)}}),redo:Ae("Redo",()=>{if(e.redoStack.length>0&&e.doc){const m=e.redoStack.pop();m!==void 0&&(e.undoStack.push(e.content),e.content=m,e.doc.body.innerHTML=m)}})},n={bold:Ae("Bold",m=>{const p=We(m);if(!p)return;let{range:h,selection:v}=p;if(h.collapsed)return Zl(m.doc,h,"b"),void 0;const b=h.commonAncestorContainer,g=(b.nodeType===Node.TEXT_NODE?b.parentElement:b)?.closest("b, strong");if(g)try{const y=g.parentNode;for(;g.firstChild;)y?.insertBefore(g.firstChild,g);y?.removeChild(g),v.removeAllRanges(),v.addRange(h)}catch{}else try{const y=m.doc.createElement("b");try{h.surroundContents(y)}catch{const _=h.extractContents();y.appendChild(_),h.insertNode(y)}h.selectNodeContents(y),v.removeAllRanges(),v.addRange(h)}catch{}},m=>{const p=We(m);if(!p)return!1;const h=p.range.commonAncestorContainer;return!!(h.nodeType===Node.TEXT_NODE?h.parentElement:h)?.closest("b, strong")}),italic:Ae("Italic",m=>{const p=We(m);if(!p)return;let{range:h,selection:v}=p;if(h.collapsed)return Zl(m.doc,h,"i"),void 0;const b=h.commonAncestorContainer,g=(b.nodeType===Node.TEXT_NODE?b.parentElement:b)?.closest("i, em");if(g)try{const y=g.parentNode;for(;g.firstChild;)y?.insertBefore(g.firstChild,g);y?.removeChild(g),v.removeAllRanges(),v.addRange(h)}catch{}else try{const y=m.doc.createElement("i");try{h.surroundContents(y)}catch{const _=h.extractContents();y.appendChild(_),h.insertNode(y)}h.selectNodeContents(y),v.removeAllRanges(),v.addRange(h)}catch{}},m=>{const p=We(m);if(!p)return!1;const h=p.range.commonAncestorContainer;return!!(h.nodeType===Node.TEXT_NODE?h.parentElement:h)?.closest("i, em")}),underline:Ae("Underline",m=>{const p=We(m);if(!p)return;let{range:h,selection:v}=p;if(h.collapsed)return Zl(m.doc,h,"u"),void 0;const b=h.commonAncestorContainer,g=(b.nodeType===Node.TEXT_NODE?b.parentElement:b)?.closest("u");if(g)try{const y=g.parentNode;for(;g.firstChild;)y?.insertBefore(g.firstChild,g);y?.removeChild(g),v.removeAllRanges(),v.addRange(h)}catch{}else try{const y=m.doc.createElement("u");try{h.surroundContents(y)}catch{const _=h.extractContents();y.appendChild(_),h.insertNode(y)}h.selectNodeContents(y),v.removeAllRanges(),v.addRange(h)}catch{}},m=>{const p=We(m);if(!p)return!1;const h=p.range.commonAncestorContainer;return!!(h.nodeType===Node.TEXT_NODE?h.parentElement:h)?.closest("u")}),link:Ae("Link",m=>{const{openLinkModal:p}=m;p&&z3(p,m)},m=>{const p=We(m);if(!p)return!1;const h=p.range.commonAncestorContainer;return!!(h.nodeType===Node.TEXT_NODE?h.parentElement:h)?.closest("a")})},o=["h1","h2","h3","h4","h5","h6"].reduce((m,p)=>({...m,[p]:Ae(`Heading ${p}`,h=>{const v=We(h);if(!v)return;const{range:b,selection:g}=v,y=Uo(b.commonAncestorContainer);if(!y)return;const{startContainer:_}=b,{endContainer:w}=b,{startOffset:$}=b,{endOffset:N}=b,k=b.collapsed,E=y.tagName.toLowerCase()===p.toLowerCase(),I=E?"p":p;try{const D=h.doc.createElement(I);for(;y.firstChild;)D.appendChild(y.firstChild);y.parentNode?.replaceChild(D,y);try{const V=h.doc.createRange(),x=(F,O,B)=>{if(F===O)return B;if(F.nodeType===Node.TEXT_NODE){const j=h.doc.createTreeWalker(B,NodeFilter.SHOW_TEXT,null);let te=0;const Q=h.doc.createTreeWalker(O,NodeFilter.SHOW_TEXT,null);let ie=Q.nextNode();for(;ie&&ie!==F;)te++,ie=Q.nextNode();let R=j.nextNode(),P=0;for(;R&&P<te;)P++,R=j.nextNode();return R}return B.firstChild},T=x(_,y,D),L=x(w,y,D);if(T&&L){if(T.nodeType===Node.TEXT_NODE){const F=Math.min($,T.textContent?.length||0);V.setStart(T,F)}else V.setStart(T,0);if(k)V.collapse(!0);else if(L.nodeType===Node.TEXT_NODE){const F=Math.min(N,L.textContent?.length||0);V.setEnd(L,F)}else V.setEnd(L,0);g.removeAllRanges(),g.addRange(V)}else V.selectNodeContents(D),k&&V.collapse(!0),g.removeAllRanges(),g.addRange(V)}catch{const x=h.doc.createRange();x.selectNodeContents(D),x.collapse(!0),g.removeAllRanges(),g.addRange(x)}if(!E&&!D.nextElementSibling){const V=h.doc.createElement("p");V.dir=D.dir||h.doc.body.dir,D.parentNode?.insertBefore(V,D.nextSibling)}}catch{}})}),{}),a={p:Ae("Paragraph",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=Uo(h.commonAncestorContainer);if(v&&v.tagName.toLowerCase()!=="p")try{const b=m.doc.createElement("p");for(;v.firstChild;)b.appendChild(v.firstChild);v.parentNode?.replaceChild(b,v),h.selectNodeContents(b),h.collapse(!1),p.selection.removeAllRanges(),p.selection.addRange(h)}catch{}}),blockquote:Ae("Blockquote",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=Uo(h.commonAncestorContainer);if(!v)return;const b=v.tagName.toLowerCase()==="blockquote"?"p":"blockquote";try{const g=m.doc.createElement(b);for(;v.firstChild;)g.appendChild(v.firstChild);v.parentNode?.replaceChild(g,v),h.selectNodeContents(g),h.collapse(!1),p.selection.removeAllRanges(),p.selection.addRange(h)}catch{}})},i={orderedList:Ae("Ordered List",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=Uo(h.commonAncestorContainer);if(!v)return;const b=v.closest("li");if(b){const g=b.parentElement;if(!g)return;if(g.tagName.toLowerCase()==="ol"){const y=m.doc.createElement("p");for(;b.firstChild;)y.appendChild(b.firstChild);g.parentNode?.insertBefore(y,g),b.remove(),g.querySelector("li")||g.remove(),h.selectNodeContents(y),h.collapse(!1),p.selection.removeAllRanges(),p.selection.addRange(h);return}if(g.tagName.toLowerCase()==="ul"){const y=m.doc.createElement("ol"),_=h.startOffset,w=h.startContainer;for(;g.firstChild;)y.appendChild(g.firstChild);g.parentNode?.replaceChild(y,g);try{const $=m.doc.createRange();$.setStart(w,_),$.collapse(!0),p.selection.removeAllRanges(),p.selection.addRange($)}catch{const $=y.querySelector("li");if($){const N=m.doc.createRange();N.selectNodeContents($),N.collapse(!0),p.selection.removeAllRanges(),p.selection.addRange(N)}}return}}try{const g=m.doc.createElement("ol"),y=m.doc.createElement("li");for(;v.firstChild;)y.appendChild(v.firstChild);g.appendChild(y),v.parentNode?.replaceChild(g,v),h.selectNodeContents(y),h.collapse(!1),p.selection.removeAllRanges(),p.selection.addRange(h)}catch{}}),unorderedList:Ae("Unordered List",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=Uo(h.commonAncestorContainer);if(!v)return;const b=v.closest("li");if(b){const g=b.parentElement;if(!g)return;if(g.tagName.toLowerCase()==="ul"){const y=m.doc.createElement("p");for(;b.firstChild;)y.appendChild(b.firstChild);g.parentNode?.insertBefore(y,g),b.remove(),g.querySelector("li")||g.remove(),h.selectNodeContents(y),h.collapse(!1),p.selection.removeAllRanges(),p.selection.addRange(h);return}if(g.tagName.toLowerCase()==="ol"){const y=m.doc.createElement("ul"),_=h.startOffset,w=h.startContainer;for(;g.firstChild;)y.appendChild(g.firstChild);g.parentNode?.replaceChild(y,g);try{const $=m.doc.createRange();$.setStart(w,_),$.collapse(!0),p.selection.removeAllRanges(),p.selection.addRange($)}catch{const N=y.querySelector("li");if(N){const k=m.doc.createRange();k.selectNodeContents(N),k.collapse(!0),p.selection.removeAllRanges(),p.selection.addRange(k)}}return}}try{const g=m.doc.createElement("ul"),y=m.doc.createElement("li");for(;v.firstChild;)y.appendChild(v.firstChild);g.appendChild(y),v.parentNode?.replaceChild(g,v),h.selectNodeContents(y),h.collapse(!1),p.selection.removeAllRanges(),p.selection.addRange(h)}catch{}})},l={clear:Ae("Clear Formatting",m=>{const p=We(m);if(!p)return;const{range:h,selection:v}=p;try{let y=function(w){return w.replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/\s+/g," ").replace(/\u00A0/g," ").trim()},_=function(w){if(w.nodeType===Node.TEXT_NODE){const $=y(w.textContent||"");return m.doc.createTextNode($)}if(w.nodeType===Node.ELEMENT_NODE){const $=w,N=$.tagName.toLowerCase(),k=["p","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","div","table","tr","td","th","thead","tbody","b","i","u","a","img","iframe","video","audio","figure","figcaption"];if(["strong","em","span","font","strike","sub","sup","mark","del","ins","small","big"].includes(N)){const E=y($.textContent||"");return m.doc.createTextNode(E)}if(k.includes(N)){const E=m.doc.createElement(N);return N==="a"&&$.hasAttribute("href")?(E.setAttribute("href",$.getAttribute("href")||""),$.hasAttribute("target")&&E.setAttribute("target",$.getAttribute("target")||""),$.hasAttribute("rel")&&E.setAttribute("rel",$.getAttribute("rel")||"")):N==="img"?($.hasAttribute("src")&&E.setAttribute("src",$.getAttribute("src")||""),$.hasAttribute("alt")&&E.setAttribute("alt",$.getAttribute("alt")||""),$.hasAttribute("width")&&E.setAttribute("width",$.getAttribute("width")||""),$.hasAttribute("height")&&E.setAttribute("height",$.getAttribute("height")||"")):N==="iframe"?($.hasAttribute("src")&&E.setAttribute("src",$.getAttribute("src")||""),$.hasAttribute("width")&&E.setAttribute("width",$.getAttribute("width")||""),$.hasAttribute("height")&&E.setAttribute("height",$.getAttribute("height")||""),$.hasAttribute("frameborder")&&E.setAttribute("frameborder",$.getAttribute("frameborder")||""),$.hasAttribute("allowfullscreen")&&E.setAttribute("allowfullscreen",$.getAttribute("allowfullscreen")||"")):(N==="video"||N==="audio")&&($.hasAttribute("src")&&E.setAttribute("src",$.getAttribute("src")||""),$.hasAttribute("controls")&&E.setAttribute("controls",$.getAttribute("controls")||""),$.hasAttribute("width")&&E.setAttribute("width",$.getAttribute("width")||""),$.hasAttribute("height")&&E.setAttribute("height",$.getAttribute("height")||"")),Array.from($.childNodes).forEach(I=>{const D=_(I);(D.textContent?.trim()||D.nodeType===Node.ELEMENT_NODE)&&E.appendChild(D)}),E}}return m.doc.createTextNode("")};var b=y,g=_;if(h.collapsed){const{body:w}=m.doc,$=m.doc.createDocumentFragment();if(Array.from(w.childNodes).forEach(N=>{const k=_(N);(k.textContent?.trim()||k.nodeType===Node.ELEMENT_NODE)&&$.appendChild(k)}),w.innerHTML="",w.appendChild($),!w.firstElementChild){const N=m.doc.createElement("p");w.appendChild(N);const k=m.doc.createRange();k.selectNodeContents(N),k.collapse(!0),v.removeAllRanges(),v.addRange(k)}}else{const w=h.cloneContents(),$=m.doc.createElement("div");$.appendChild(w);const N=m.doc.createDocumentFragment();Array.from($.childNodes).forEach(k=>{const E=_(k);(E.textContent?.trim()||E.nodeType===Node.ELEMENT_NODE)&&N.appendChild(E)}),h.deleteContents(),h.insertNode(N),h.collapse(!1),v.removeAllRanges(),v.addRange(h)}}catch{}})},s={insertTable:Ae("Insert Table",(m,p)=>{if(m.openTableEditor&&!p){m.openTableEditor(null);return}if(!p){const[h,v]=[3,3];Qd(h,v,m);return}if(p.includes("<table")){const h=We(m);if(!h||!m.doc)return;const{range:v}=h;try{const b=m.doc.createElement("div");b.innerHTML=p;const g=b.querySelector("table");if(g){const y=g.cloneNode(!0);v.insertNode(y),v.setStartAfter(y),v.collapse(!0);const _=m.doc.getSelection();_&&(_.removeAllRanges(),_.addRange(v))}}catch{}}else{const[h,v]=p.split("x").map(Number)||[3,3];Qd(h,v,m)}}),deleteTable:Ae("Delete Table",m=>m.range&&q3(m.range)),mergeCells:Ae("Merge Cells",m=>m.range&&m.doc&&H3(m.range,m.doc)),splitCells:Ae("Split Cells",m=>m.range&&m.doc&&W3(m.range,m.doc)),addRowBefore:Ae("Add Row Before",m=>m.range&&m.doc&&ef("before",m.range,m.doc)),addRowAfter:Ae("Add Row After",m=>m.range&&m.doc&&ef("after",m.range,m.doc)),deleteRow:Ae("Delete Row",m=>m.range&&j3(m.range)),insertColumnLeft:Ae("Insert Column Left",m=>m.range&&tf("before",m.range)),insertColumnRight:Ae("Insert Column Right",m=>m.range&&tf("after",m.range)),deleteColumn:Ae("Delete Column",m=>m.range&&G3(m.range))},c=["Left","Center","Right","Justify"].reduce((m,p)=>({...m,[`tableAlign${p}`]:Ae(`Table Align ${p}`,h=>{if(h.range){const v=p==="Left"?"start":p==="Right"?"end":p.toLowerCase();Y3(h.range,v)}})}),{}),u={alignLeft:Ae("Align Left",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6");v&&(v.style.textAlign="left")},m=>{const p=We(m);if(!p)return!1;const{range:h}=p;return(h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6"))?.style.textAlign==="left"}),alignCenter:Ae("Align Center",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6");v&&(v.style.textAlign="center")},m=>{const p=We(m);if(!p)return!1;const{range:h}=p;return(h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6"))?.style.textAlign==="center"}),alignRight:Ae("Align Right",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6");v&&(v.style.textAlign="right")},m=>{const p=We(m);if(!p)return!1;const{range:h}=p;return(h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6"))?.style.textAlign==="right"}),alignJustify:Ae("Align Justify",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6");v&&(v.style.textAlign="justify")},m=>{const p=We(m);if(!p)return!1;const{range:h}=p;return(h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6"))?.style.textAlign==="justify"}),textDirection:Ae("Toggle Text Direction",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6");v&&(v.dir=(v.dir||"ltr")==="ltr"?"rtl":"ltr")},m=>{const p=We(m);if(!p)return!1;const{range:h}=p;return(h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6"))?.dir==="rtl"}),ltrDirection:Ae("Set Left to Right Direction",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6");v&&(v.dir="ltr")},m=>{const p=We(m);if(!p)return!1;const{range:h}=p;return(h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6"))?.dir==="ltr"}),rtlDirection:Ae("Set Right to Left Direction",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6");v&&(v.dir="rtl")},m=>{const p=We(m);if(!p)return!1;const{range:h}=p;return(h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6"))?.dir==="rtl"})},d={fullScreen:Ae("Full Screen",m=>{m.isFullscreen=!m.isFullscreen},m=>m.isFullscreen),splitView:Ae("Split View",m=>{m.isSplitView=!m.isSplitView},m=>m.isSplitView),codeView:Ae("Code View",m=>{m.isCodeView=!m.isCodeView},m=>m.isCodeView)},f={image:Ae("Insert Image",m=>{const{openImageModal:p}=m;p&&p()}),video:Ae("Insert Video",m=>{const{openVideoModal:p}=m;p&&p()}),embed:Ae("Insert Embed",m=>{const{openEmbedModal:p}=m;p&&p()})};return{...t,...n,...o,...a,...i,...l,...s,...c,...u,...d,...f}}function J3(e,t){return{execute(n,o){const a=t[n];a&&a.execute(e,o)},isActive(n){return t[n].isActive?.(e)||!1},getValue(n){return t[n].getValue?.(e)||null}}}function r0(e,t){const n=t.getSelection();if(!n||!n.rangeCount)return!1;const o=n.getRangeAt(0).commonAncestorContainer,a=o.nodeType===Node.TEXT_NODE?o.parentElement:o;if(!a)return!1;const i=(c,u)=>c?u(c)?!0:i(c.parentElement,u):!1,l={bold:c=>{const u=c.tagName?.toLowerCase();return u==="strong"||u==="b"},italic:c=>{const u=c.tagName?.toLowerCase();return u==="em"||u==="i"},underline:c=>c.tagName?.toLowerCase()==="u",h1:c=>c.tagName?.toLowerCase()==="h1",h2:c=>c.tagName?.toLowerCase()==="h2",h3:c=>c.tagName?.toLowerCase()==="h3",h4:c=>c.tagName?.toLowerCase()==="h4",h5:c=>c.tagName?.toLowerCase()==="h5",h6:c=>c.tagName?.toLowerCase()==="h6",p:c=>c.tagName?.toLowerCase()==="p",blockquote:c=>c.tagName?.toLowerCase()==="blockquote",orderedList:c=>!!c.closest("ol"),unorderedList:c=>!!c.closest("ul"),alignLeft:c=>c.closest("p, h1, h2, h3, h4, h5, h6")?.style.textAlign==="start",alignCenter:c=>c.closest("p, h1, h2, h3, h4, h5, h6")?.style.textAlign==="center",alignRight:c=>c.closest("p, h1, h2, h3, h4, h5, h6")?.style.textAlign==="end",alignJustify:c=>c.closest("p, h1, h2, h3, h4, h5, h6")?.style.textAlign==="justify",textDirection:c=>c.closest("p, h1, h2, h3, h4, h5, h6")?.dir==="rtl",ltrDirection:c=>c.closest("p, h1, h2, h3, h4, h5, h6")?.dir==="ltr",rtlDirection:c=>c.closest("p, h1, h2, h3, h4, h5, h6")?.dir==="rtl"};if(["splitView","codeView","fullScreen"].includes(e))return!1;const s=l[e];return s?i(a,s):i(a,c=>c.tagName?.toLowerCase()===e.toLowerCase())}function Z3(e,t){const n=J3(e,K3(e)),o=()=>{if(!e.doc)return;const a=new Set;["bold","italic","underline","link","h1","h2","h3","h4","h5","h6","blockquote","p","orderedList","unorderedList","alignLeft","alignCenter","alignRight","alignJustify","textDirection","ltrDirection","rtlDirection"].forEach(i=>{r0(i,e.doc)&&a.add(i)}),e.selectedStyles=a};return{execute:(a,i)=>{if(!e.doc)return;if(t?.logCommand(a,i),["splitView","codeView","fullScreen"].includes(a))switch(a){case"splitView":e.isSplitView=!e.isSplitView;return;case"codeView":e.isCodeView=!e.isCodeView;return;case"fullScreen":e.isFullscreen=!e.isFullscreen;return}try{e.doc.body.focus()}catch{}const l=e.doc.getSelection();l?.rangeCount&&(e.selection=l,e.range=l.getRangeAt(0).cloneRange(),e.rangeCount=l.rangeCount);try{n.execute(a,i),["splitView","codeView","fullScreen"].includes(a)||o()}catch{}},isActive:n.isActive,getValue:n.getValue}}var Q3=class{session;maxActions;isDevelopment;constructor(e=1e3){this.maxActions=e,this.session=this.createNewSession(),this.isDevelopment=!1}createNewSession(){return{id:`session_${Date.now()}`,startTime:Date.now(),actions:[]}}getNodeDescription(e){if(e.nodeType===Node.TEXT_NODE)return`Text("${e.textContent?.slice(0,20)}${e.textContent&&e.textContent.length>20?"...":""}")`;const t=e;return`${t.tagName.toLowerCase()}${t.id?`#${t.id}`:""}`}captureState(e){if(!e.doc||!e.selection)return{content:"",selection:null,activeStyles:[],caretPosition:null};const{selection:t}=e,n=t.rangeCount?t.getRangeAt(0):null;return{content:e.doc.body.innerHTML,selection:n?{start:n.startOffset,end:n.endOffset,collapsed:n.collapsed,text:n.toString()}:null,activeStyles:Array.from(e.selectedStyles),caretPosition:n?{node:this.getNodeDescription(n.startContainer),offset:n.startOffset}:null}}logCommand(e,t,n){this.addAction({type:"command",name:e,timestamp:Date.now(),details:{value:t},state:this.captureState(n)})}logPaste(e,t){this.addAction({type:"paste",name:"paste",timestamp:Date.now(),details:{html:e.getData("text/html"),text:e.getData("text/plain"),types:Array.from(e.types)},state:this.captureState(t)})}logKeyboard(e,t){this.addAction({type:"keyboard",name:"keypress",timestamp:Date.now(),details:{key:e.key,code:e.code,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey},state:this.captureState(t)})}logSelection(e){this.addAction({type:"selection",name:"selection_change",timestamp:Date.now(),details:{},state:this.captureState(e)})}logInput(e,t,n){this.addAction({type:"input",name:e,timestamp:Date.now(),details:{data:t},state:this.captureState(n)})}addAction(e){this.session.actions.push(e),this.session.actions.length>this.maxActions&&this.session.actions.shift(),this.isDevelopment}getSession(){return this.session}clearSession(){this.session=this.createNewSession()}exportSession(){return JSON.stringify(this.session,null,2)}downloadSession(){const e=new Blob([this.exportSession()],{type:"application/json"}),t=URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.download=`editor_session_${this.session.id}.json`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}exportSessionWithPrompt(e){const t={message:e||"here is a debug log, can you analyze and fix accordingly?",session:this.session};return JSON.stringify(t,null,2)}};function nf(e){const t=document.createElement("div");t.innerHTML=e;const n=[],o=[];return t.querySelectorAll("iframe").forEach((a,i)=>{const l=`<!--iframe-${i}-->`;n.push(a.cloneNode(!0)),o.push(l),a.replaceWith(l)}),{html:t.innerHTML,iframes:n}}function rf(e,t,n){const o=/<!--iframe-(\d+)-->/g;e.body.innerHTML=t.replace(o,(a,i)=>{const l=n[Number(i)];return l?l.outerHTML:""})}function ex(){let e=null;const t=(0,r.reactive)({content:"",doc:void 0,selection:null,selectedStyles:new Set,isFullscreen:!1,isSplitView:!1,isCodeView:!1,hasInit:!1,undoStack:[],redoStack:[],rangeCount:0,range:null,debug:void 0}),n={styles:()=>{if(!t.doc)return;const c=new Set;["bold","italic","underline","h1","h2","h3","h4","h5","h6","blockquote","p","orderedList","unorderedList","alignLeft","alignCenter","alignRight","alignJustify","textDirection","ltrDirection","rtlDirection"].forEach(u=>{t.doc&&r0(u,t.doc)&&c.add(u)}),t.selectedStyles=c},content:c=>{if(!t.doc)return;t.doc.body.innerHTML!==t.content&&(t.undoStack.push(t.content),t.redoStack=[]);const u=t.doc.getSelection(),d=u?.rangeCount?u.getRangeAt(0).cloneRange():null;if(c==="html"){const f=nf(t.content);t.doc.body.innerHTML=f.html,setTimeout(()=>{if(t.doc&&(rf(t.doc,t.content,f.iframes),d&&u))try{u.removeAllRanges(),u.addRange(d)}catch{}},0)}else t.doc.body.textContent=t.content},selection:()=>{if(!t.doc)return;const c=t.doc.getSelection();if(c)try{if(!t.doc.body.contains(c.anchorNode)){t.doc.body.focus();return}(!t.selection||t.selection!==c||t.rangeCount!==c.rangeCount||c.rangeCount>0&&t.range&&(t.range.startContainer!==c.getRangeAt(0).startContainer||t.range.startOffset!==c.getRangeAt(0).startOffset||t.range.endContainer!==c.getRangeAt(0).endContainer||t.range.endOffset!==c.getRangeAt(0).endOffset))&&(t.selection=c,t.rangeCount=c.rangeCount,c.rangeCount>0&&(t.range=c.getRangeAt(0).cloneRange()),n.styles())}catch{t.selection=null,t.range=null,t.rangeCount=0,t.selectedStyles=new Set}}},o={undo:()=>{if(t.undoStack.length===0)return;t.redoStack.push(t.content);const c=t.undoStack.pop();c!==void 0&&(t.content=c,n.content("html"))},redo:()=>{if(t.redoStack.length===0)return;t.undoStack.push(t.content);const c=t.redoStack.pop();c!==void 0&&(t.content=c,n.content("html"))}},a={emptyTags:c=>{const u=c.createTreeWalker(c.body,NodeFilter.SHOW_ELEMENT,null),d=[];let f=u.nextNode();for(;f;){if(["br","img","hr","input"].includes(f.tagName.toLowerCase())){f=u.nextNode();continue}const m=f.textContent?.trim()||"",p=f.innerHTML.trim(),h=p==="<br>"||p==="<br/>",v=p==="&nbsp;"||m===" ",b=!m&&!p,g=f.parentElement===c.body;(b||v||h&&!g)&&d.push(f),f=u.nextNode()}d.forEach(m=>{m.remove()})},normalizeContent:c=>{const u=c.createTreeWalker(c.body,NodeFilter.SHOW_TEXT),d=[];let f;for(;f=u.nextNode();)f.parentElement===c.body&&f.textContent?.trim()&&d.push(f);d.forEach(m=>{const p=c.createElement("p");p.dir=c.body.dir,p.appendChild(m.cloneNode()),c.body.replaceChild(p,m)})}};function i(c){e&&(e(),e=null);let u=!1;const d={input:()=>{if(u)return;u=!0;const f=c.body.innerHTML;f!==t.content&&(t.content=f),u=!1},selectionchange:()=>{u||n.selection()},mouseup:()=>{u||n.selection()},keyup:f=>{u||["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(f.key)&&n.selection()}};return Object.entries(d).forEach(([f,m])=>{c.addEventListener(f,m)}),e=()=>{Object.entries(d).forEach(([f,m])=>{c.removeEventListener(f,m)})},e}function l(c){if(t.hasInit&&e&&(e(),e=null),t.doc=c,t.hasInit=!0,c.editorState=t,t.content&&t.content.trim()&&!t.content.match(/^<p(?:\s[^>]*)?>(?:<br\s*\/?>)?\s*<\/p>$/i)){const u=nf(t.content);c.body.innerHTML=u.html,setTimeout(()=>{t.doc&&rf(c,t.content,u.iframes)},0)}if(a.normalizeContent(c),c.body.firstElementChild){const u=c.createRange(),d=c.getSelection();d&&(u.selectNodeContents(c.body),u.collapse(!1),d.removeAllRanges(),d.addRange(u),t.range=u.cloneRange(),t.selection=d,t.rangeCount=d.rangeCount)}else{const u=c.getSelection();if(u){const d=c.createRange();d.setStart(c.body,0),d.setEnd(c.body,0),u.removeAllRanges(),u.addRange(d),t.range=d.cloneRange(),t.selection=u,t.rangeCount=u.rangeCount}}e=i(c)}function s(){if(!t.debug){const c=new Q3;t.debug={debugger:c,logCommand:(u,d)=>{c.logCommand(u,d,t)},getSession:()=>c.getSession(),clearSession:()=>{c.clearSession()},downloadSession:()=>{c.downloadSession()},exportDebugWithPrompt:u=>c.exportSessionWithPrompt(u)}}}return typeof window<"u"&&window.addEventListener("beforeunload",()=>{e&&e()}),{state:t,init:l,updateState:n,history:o,initDebugger:s,cleanup:()=>{e&&(e(),e=null)}}}var tx=[{key:"b",command:"bold"},{key:"i",command:"italic"},{key:"u",command:"underline"},{key:"k",command:"link"},{key:"z",command:"undo"},{key:"z",modifiers:{shift:!0},command:"redo"},{key:"y",command:"redo"},{key:".",modifiers:{shift:!0},command:"orderedList"},{key:"/",modifiers:{shift:!0},command:"unorderedList"},{key:"]",command:"indent"},{key:"[",command:"outdent"},...Array.from({length:6},(e,t)=>({key:String(t+1),modifiers:{alt:!0},command:`h${t+1}`}))];function nx(e,t){e.addEventListener("keydown",n=>{if(!n.ctrlKey&&!n.metaKey)return;const o=tx.find(a=>{const i=a.key===n.key,l=!a.modifiers||(!a.modifiers.ctrl||n.ctrlKey||n.metaKey)&&(!a.modifiers.alt||n.altKey)&&(!a.modifiers.shift||n.shiftKey);return i&&l});o&&(n.preventDefault(),t.execute(o.command))})}var rx={key:0},ox={key:1,class:"flex pt-05"},ax={class:"inline-toolbar-content"},ix={class:"menu-header"},lx={class:"px-025"},sx={key:3,class:"context-menu-separator"},cx={class:"flex gap-05 align-items-end"},ux={class:"flex gap-1"},dx={class:"flex gap-05 w-100"},fx={class:"flex gap-1"},mx={class:"flex gap-05 w-100"},px={class:"grid gap-0"},hx={key:0,class:"flex gap-025 opacity-5 -mt-05"},gx={key:1,class:"grid grid-wrap-2 gap-05"},vx={class:"grid grid-wrap-2 gap-05 py-1"},yx={class:"overflow-hidden flex justify-content-center"},bx={class:"flex gap-05 w-100"},_x={class:"grid grid-wrap-4 m_grid-wrap-2 gap-col-1 table-editor testMe1"},wx={class:"grid-span-1"},$x={class:"flex gap-025 mt-025 radius-1 p-05 w-fit",style:{height:"var(--bgl-input-height)",background:"var(--bgl-input-bg)"}},Ex={class:"grid-span-1"},kx={class:"flex gap-025 mt-025 radius-1 p-025 w-fit",style:{height:"var(--bgl-input-height)",background:"var(--bgl-input-bg)"}},Cx={key:0,class:"grid-span-4 m_grid-span-2 grid-wrap-4 m_grid-wrap-2 grid gap-col-1 border-bottom pb-05 mb-05"},Sx={key:1,class:"grid grid-wrap-4 m_grid-wrap-2 gap-col-1 grid-span-4 m_grid-span-2 border-bottom pb-05 mb-05"},xx=["innerHTML"],Tx=(0,r.defineComponent)({inheritAttrs:!1,__name:"index",props:{modelValue:{},toolbarConfig:{},debug:{type:Boolean},label:{},height:{},basic:{type:Boolean},simple:{type:Boolean},placeholder:{},hideToolbar:{type:Boolean},hideInlineToolbar:{type:Boolean},hideImages:{type:Boolean},hideVideos:{type:Boolean},hideEmbed:{type:Boolean},hideTables:{type:Boolean},hideAlignment:{type:Boolean},hideDirections:{type:Boolean},hideH5H6:{type:Boolean},hide:{},autofocus:{type:Boolean},textColor:{},fontSize:{},frame:{type:Boolean},outline:{type:Boolean},minWidth:{},maxWidth:{},labelColor:{},labelActiveColor:{}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const o=e,a=n,{shellClass:i,shellStyle:l}=lt(o),s=(0,r.computed)(()=>!!o.modelValue?.trim()),c=(0,r.useAttrs)(),u=(0,r.ref)(),d=ex(),f=(0,r.ref)(!1),m=(0,r.ref)(!1),p=Z3(d.state,d.state.debug),h=(0,r.ref)(0),v=(0,r.computed)(()=>(h.value,typeof document<"u"&&getComputedStyle(document.documentElement).getPropertyValue("--bgl-input-color").trim()||"#000")),b=(0,r.computed)(()=>{const M=v.value;return o.textColor||(M&&M.length>0&&M!=="#000"?M:"inherit")}),g=(0,r.computed)(()=>(h.value,typeof document<"u"&&getComputedStyle(document.documentElement).getPropertyValue("--bgl-font").trim()||"sans-serif"));let y=null;(0,r.onMounted)(()=>{typeof document<"u"&&(y=new MutationObserver(M=>{let C=!1;M.forEach(S=>{if(S.type==="attributes"){const{attributeName:ne}=S;(ne==="data-theme"||ne==="class"||ne==="style")&&(C=!0)}}),C&&(h.value++,m.value&&setTimeout(()=>{zl()},50))}),y.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","class","style"]}),document.body&&y.observe(document.body,{attributes:!0,attributeFilter:["class","data-theme"]}))}),(0,r.onBeforeUnmount)(()=>{y?.disconnect()}),o.debug&&typeof window<"u"&&(window.forceRichTextUpdate=()=>{h.value++},window.debugRichText=_e);const _=(0,r.computed)(()=>!(o.hideToolbar||o.basic)),w=(0,r.computed)(()=>!o.hideInlineToolbar),$=(0,r.computed)(()=>o.toolbarConfig),N=(0,r.computed)(()=>{const M=[...o.hide||[]];return o.simple&&["h1","h2","h3","h4","h5","h6","image","video","embed","ul","ol","blockquote","direction","table","alignment"].forEach(C=>{M.includes(C)||M.push(C)}),M}),k=(0,r.ref)(!1),E=(0,r.ref)({url:"",openInNewTab:!0}),I=(0,r.ref)(!1),D=(0,r.ref)({message:"",x:0,y:0});let V=null;const x=(0,r.ref)(!1),T=(0,r.ref)({src:"",alt:"",width:"",height:"",credit:"",figcaption:!1});let L=null;const F=(0,r.ref)(!1),O=(0,r.ref)({src:"",width:"560",height:"315",alt:""});let B=null;const j=(0,r.ref)(!1),te=(0,r.ref)({top:0,left:0}),Q=(0,r.ref)(null),ie=(0,r.ref)(!1),R=(0,r.ref)({src:"",width:"",autoplay:!1,mute:!1,controls:!0,loop:!1,aspectRatio:"16:9",customWidth:"",customHeight:"",caption:"",showCaption:!1});let P=null;const U=(0,r.ref)(!1),A=(0,r.ref)({rows:3,cols:3,width:100,borderWidth:1,borderColor:"#dddddd",cellPadding:8,showHeaders:!0,headerBgColor:"#f4f4f4",headerTextColor:"#333333",cellBgColor:"#ffffff",cellTextColor:"#333333",alternateRows:!1,alternateRowBgColor:"#f9f9f9",alternateRowTextColor:"#333333",fixedLayout:!0,alignment:"left",direction:"ltr"}),W=(0,r.ref)(!1),q=(0,r.ref)({x:0,y:0}),X=(0,r.ref)(null);let ae=null;const be=(0,r.computed)(()=>{const M=A.value;let C=`<table style="${`
31
+ `+a)}}catch{}}throw n}}_request(e,t){typeof e=="string"?(t=t||{},t.url=e):t=e||{},t=Fr(this.defaults,t);const{transitional:n,paramsSerializer:o,headers:a}=t;n!==void 0&&pi.assertOptions(n,{silentJSONParsing:Bt.transitional(Bt.boolean),forcedJSONParsing:Bt.transitional(Bt.boolean),clarifyTimeoutError:Bt.transitional(Bt.boolean),legacyInterceptorReqResOrdering:Bt.transitional(Bt.boolean),advertiseZstdAcceptEncoding:Bt.transitional(Bt.boolean)},!1),o!=null&&(K.isFunction(o)?t.paramsSerializer={serialize:o}:pi.assertOptions(o,{encode:Bt.function,serialize:Bt.function},!0)),t.allowAbsoluteUrls!==void 0||(this.defaults.allowAbsoluteUrls!==void 0?t.allowAbsoluteUrls=this.defaults.allowAbsoluteUrls:t.allowAbsoluteUrls=!0),pi.assertOptions(t,{baseUrl:Bt.spelling("baseURL"),withXsrfToken:Bt.spelling("withXSRFToken")},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase();let i=a&&K.merge(a.common,a[t.method]);a&&K.forEach(["delete","get","head","post","put","patch","query","common"],p=>{delete a[p]}),t.headers=on.concat(i,a);const l=[];let s=!0;this.interceptors.request.forEach(function(h){if(typeof h.runWhen=="function"&&h.runWhen(t)===!1)return;s=s&&h.synchronous;const v=t.transitional||au;v&&v.legacyInterceptorReqResOrdering?l.unshift(h.fulfilled,h.rejected):l.push(h.fulfilled,h.rejected)});const c=[];this.interceptors.response.forEach(function(h){c.push(h.fulfilled,h.rejected)});let u,d=0,f;if(!s){const p=[Jd.bind(this),void 0];for(p.unshift(...l),p.push(...c),f=p.length,u=Promise.resolve(t);d<f;)u=u.then(p[d++],p[d++]);return u}f=l.length;let m=t;for(;d<f;){const p=l[d++],h=l[d++];try{m=p(m)}catch(v){h.call(this,v);break}}try{u=Jd.call(this,m)}catch(p){return Promise.reject(p)}for(d=0,f=c.length;d<f;)u=u.then(c[d++],c[d++]);return u}getUri(e){return e=Fr(this.defaults,e),qh(Kh(e.baseURL,e.url,e.allowAbsoluteUrls),e.params,e.paramsSerializer)}};K.forEach(["delete","get","head","options"],function(t){Ii.prototype[t]=function(n,o){return this.request(Fr(o||{},{method:t,url:n,data:(o||{}).data}))}});K.forEach(["post","put","patch","query"],function(t){function n(o){return function(i,l,s){return this.request(Fr(s||{},{method:t,headers:o?{"Content-Type":"multipart/form-data"}:{},url:i,data:l}))}}Ii.prototype[t]=n(),t!=="query"&&(Ii.prototype[t+"Form"]=n(!0))});var hi=Ii,JS=class e0{constructor(t){if(typeof t!="function")throw new TypeError("executor must be a function.");let n;this.promise=new Promise(function(i){n=i});const o=this;this.promise.then(a=>{if(!o._listeners)return;let i=o._listeners.length;for(;i-- >0;)o._listeners[i](a);o._listeners=null}),this.promise.then=a=>{let i;const l=new Promise(s=>{o.subscribe(s),i=s}).then(a);return l.cancel=function(){o.unsubscribe(i)},l},t(function(i,l,s){o.reason||(o.reason=new Oa(i,l,s),n(o.reason))})}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){if(this.reason){t(this.reason);return}this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const n=this._listeners.indexOf(t);n!==-1&&this._listeners.splice(n,1)}toAbortSignal(){const t=new AbortController,n=o=>{t.abort(o)};return this.subscribe(n),t.signal.unsubscribe=()=>this.unsubscribe(n),t.signal}static source(){let t;return{token:new e0(function(o){t=o}),cancel:t}}},ZS=JS;function QS(e){return function(n){return e.apply(null,n)}}function e3(e){return K.isObject(e)&&e.isAxiosError===!0}var Zs={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,WebServerIsDown:521,ConnectionTimedOut:522,OriginIsUnreachable:523,TimeoutOccurred:524,SslHandshakeFailed:525,InvalidSslCertificate:526};Object.entries(Zs).forEach(([e,t])=>{Zs[t]=e});var t3=Zs;function t0(e){const t=new hi(e),n=Bh(hi.prototype.request,t);return K.extend(n,hi.prototype,t,{allOwnKeys:!0}),K.extend(n,t,null,{allOwnKeys:!0}),n.create=function(a){return t0(Fr(e,a))},n}var dt=t0(su);dt.Axios=hi;dt.CanceledError=Oa;dt.CancelToken=ZS;dt.isCancel=Yh;dt.VERSION=cu;dt.toFormData=vl;dt.AxiosError=Ce;dt.Cancel=dt.CanceledError;dt.all=function(t){return Promise.all(t)};dt.spread=QS;dt.isAxiosError=e3;dt.mergeConfig=Fr;dt.AxiosHeaders=on;dt.formToJSON=e=>Gh(K.isHTMLForm(e)?new FormData(e):e);dt.getAdapter=Qh.getAdapter;dt.HttpStatusCode=t3;dt.default=dt;var du=dt,oo=du;function n3(e={}){e.baseURL!==void 0&&(oo=du.create({baseURL:e.baseURL}))}const Jl={get:async e=>oo.get("/files",{params:{path_key:e}}),put:async(e,t)=>oo.put("/files",e,{params:{path_key:t}}),delete:async e=>oo.delete(`/files/${e}`,{params:{path_key:e}}),upload:async(e,t)=>{const n=new FormData;return n.append("file",e),n.append("upload",e),oo.post("/files/upload",n,{headers:{"Content-Type":"multipart/form-data"},onUploadProgress:t?.onUploadProgress,params:{dir_path:t?.dirPath,tags:t?.tags}})},list:async e=>oo.get("/files/list",{params:{dir_path:e}})};function n0(e={}){const t=e.namespace||"default",n=(0,r.ref)([]),o=(0,r.ref)([]),a=(0,r.ref)([]),i=(0,r.computed)(()=>{const f=o.value.map(m=>m.path_key);return[...a.value,...f]}),l=f=>URL.createObjectURL(f);function s(f){if(!f)return;let m=[];f instanceof File?m=[f]:f instanceof FileList?m=Array.from(f):Array.isArray(f)&&(m=f);const p=m.map(h=>({url:l(h),name:h.name,file:h,progress:0,namespace:t}));e.multiple?n.value.push(...p):n.value=p,e.onFileQueued&&p.length>0&&e.onFileQueued(p)}async function c(f){if(typeof f=="string"){o.value=o.value.filter(p=>p.path_key!==f);const m=a.value.indexOf(f);m!==-1&&a.value.splice(m,1);try{await Jl.delete(f)}catch{}}else if(f){const m=f instanceof File?{name:f.name}:f,p=n.value.findIndex(h=>h.file.name===m.name&&h.namespace===t);p!==-1&&n.value.splice(p,1)}e.onChange?.()}async function u(){const f=n.value.filter(m=>m.namespace===t);for(const m of f){m.uploading=!0,e.multiple||a.value.splice(0,1);try{const{data:p}=await Jl.upload(m.file,{onUploadProgress:h=>{m.progress=h.loaded/h.total*100-1},dirPath:(0,r.toValue)(e.dirPath)});a.value.push(p.path_key)}catch{}}n.value=n.value.filter(m=>m.namespace!==t)}function d(f=!1){if(e.disabled)return;const m=document.createElement("input");m.type="file",m.multiple=!!e.multiple,m.accept=e.accept||"",e.capture!==void 0&&e.capture!==!1&&(m.capture=e.capture===!0?"environment":e.capture),m.onchange=p=>{s(p.target.files),f&&u()},m.click()}return(0,r.onMounted)(()=>{const f=(0,r.toValue)(e.dirPath);f&&Jl.list(f).then(m=>{const p=Array.isArray(m.data)?m.data:[m.data];o.value.push(...p)}).catch(m=>{})}),{fileQueue:n,storageFiles:o,pk:a,pathKeys:i,fileToUrl:l,removeFile:c,flushQueue:u,addFile:s,browse:d,namespace:t}}var r3=["data-field"],o3={key:0},a3={key:0},i3=["name"],l3={key:1,class:"flex align-items-center gap-1 p-05"},s3={class:"txt-gray txt-12"},c3={class:"m-05 flex opacity-8 z-99 gap-025"},u3={class:"flex gap-025 rounded pe-1 ps-05 py-025 -my-1"},d3={class:"ellipsis-1 word-break-all h-20 m-0 color-black txt16"},f3={key:2,class:"txt-gray txt-12"},m3={key:0,class:"bgl-multi-preview"},p3={class:"m-0"},h3=["src"],g3={class:"no-margin multi-preview-txt"},v3={key:0,class:"progress"},y3={key:1,class:"bgl-single-preview"},b3={key:0,class:"h-100"},_3=["src"],w3={class:"p-1 flex column hover fileUploadPlaceHolder justify-content-center mb-05"},$3={class:"pretty balance user-select-none"},E3={key:4,class:"error-message"},k3=(0,r.defineComponent)({__name:"UploadInput",props:{id:{},name:{},label:{},multiple:{type:Boolean},modelValue:{},width:{},height:{default:"215px"},dirPath:{},fill:{type:Boolean},oval:{type:Boolean},theme:{default:"dropzone"},accept:{default:"*"},capture:{type:[Boolean,String]},required:{type:Boolean},disabled:{type:Boolean},baseURL:{},placeholder:{},dropPlaceholder:{},noFilePlaceholder:{},btnPlaceholder:{},error:{},showIcon:{type:Boolean,default:!0},icon:{default:"upload_2"},iconSize:{default:2.5},iconMobileSize:{},frame:{type:Boolean},outline:{type:Boolean},minWidth:{},maxWidth:{},labelColor:{},labelActiveColor:{}},emits:["update:modelValue","addFileStart"],setup(e,{emit:t}){const n=e,o=t,{$t:a}=ft(),i=(0,r.useSlots)(),{fileQueue:l,pathKeys:s,removeFile:c,flushQueue:u,addFile:d,browse:f,pk:m}=n0({disabled:n.disabled,dirPath:n.dirPath,multiple:n.multiple,accept:n.accept,capture:n.capture,namespace:n.id||"upload",onFileQueued:async()=>{await u(),$()},onChange:$});(0,r.watch)(()=>n.modelValue,E=>m.value=E?[E].flat().filter(Boolean):[],{immediate:!0});const{shellClass:p,shellStyle:h}=lt(n),v=(0,r.computed)(()=>s.value.length>0||l.value.length>0),b=(0,r.computed)(()=>{const E=n.dropPlaceholder??n.placeholder;if(E==null)return a("upload.dropPlaceholder");const I=Ee(E);return I!=null&&I!==""?I:a("upload.dropPlaceholder")}),g=(0,r.computed)(()=>!s.value.length&&!l.value.length||!!n.multiple),y=E=>Li.test(E),_=(0,r.ref)(!1);function w(E,I=!1){E.preventDefault(),E.stopPropagation(),n.disabled||(_.value=I)}function $(){n.multiple?o("update:modelValue",s.value):o("update:modelValue",s.value[0]||void 0)}async function N(E){n.disabled||(E.preventDefault(),E.stopPropagation(),o("addFileStart"),d(E.dataTransfer?.files),_.value=!1)}function k(E){return!E||typeof E!="string"?"file":E.split("/").pop()||"file"}return(E,I)=>{const D=(0,r.resolveDirective)("tooltip"),V=(0,r.resolveDirective)("lightbox");return(0,r.openBlock)(),(0,r.createElementBlock)("div",{class:(0,r.normalizeClass)(["bagel-input",[(0,r.unref)(p),{"has-error":!!e.error,"has-value":v.value}]]),style:(0,r.normalizeStyle)((0,r.unref)(h)),"data-field":e.name||e.id},[e.label?((0,r.openBlock)(),(0,r.createElementBlock)("label",o3,[(0,r.createTextVNode)((0,r.toDisplayString)(e.label),1),e.required?((0,r.openBlock)(),(0,r.createElementBlock)("span",a3," *")):(0,r.createCommentVNode)("",!0)])):(0,r.createCommentVNode)("",!0),e.required&&!(0,r.unref)(s).length?((0,r.openBlock)(),(0,r.createElementBlock)("input",{key:1,name:e.name||e.id,placeholder:"required",type:"text",required:"",class:"pixel"},null,8,i3)):(0,r.createCommentVNode)("",!0),e.theme==="basic"?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(or),{key:2,outline:"",class:"flex p-05 gap-1",onDragover:I[2]||(I[2]=x=>w(x,!0)),onDrop:N},{default:(0,r.withCtx)(()=>[!(0,r.unref)(s).length&&!(0,r.unref)(l).length?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:0,class:"px-1-5",icon:"upload",outline:"",value:e.btnPlaceholder||(0,r.unref)(a)("upload.upload"),onClick:I[0]||(I[0]=x=>(0,r.unref)(f)())},null,8,["value"])):(0,r.createCommentVNode)("",!0),(0,r.unref)(l).length>0?((0,r.openBlock)(),(0,r.createElementBlock)("div",l3,[(0,r.createVNode)((0,r.unref)(Wr),{size:"20"}),(0,r.createElementVNode)("span",s3,(0,r.toDisplayString)((0,r.unref)(a)("upload.uploading",{count:(0,r.unref)(l).length,plural:(0,r.unref)(l).length>1?"s":""})),1)])):(0,r.createCommentVNode)("",!0),((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(s),x=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:x,class:"txt-gray txt-12 flex"},[(0,r.createElementVNode)("div",c3,[(0,r.withDirectives)((0,r.createVNode)((0,r.unref)(re),{color:"gray",thin:"",icon:"delete",onClick:T=>(0,r.unref)(c)(x)},null,8,["onClick"]),[[D,"Delete"]]),(0,r.withDirectives)((0,r.createVNode)((0,r.unref)(re),{color:"gray",thin:"",icon:"autorenew",onClick:I[1]||(I[1]=T=>(0,r.unref)(f)())},null,512),[[D,"Replace"]]),(0,r.createVNode)((0,r.unref)(re),{icon:"download",color:"gray",thin:"",target:"_blank",href:(0,r.unref)(fn)(x),download:k(x)},null,8,["href","download"]),(0,r.createElementVNode)("div",u3,[(0,r.createVNode)((0,r.unref)(ve),{icon:"draft",size:1.5}),(0,r.withDirectives)(((0,r.openBlock)(),(0,r.createElementBlock)("p",d3,[(0,r.createTextVNode)((0,r.toDisplayString)(k(x)),1)])),[[V,{src:(0,r.unref)(fn)(x),download:!0}]])])])]))),128)),!(0,r.unref)(s).length&&!(0,r.unref)(l).length?((0,r.openBlock)(),(0,r.createElementBlock)("span",f3,(0,r.toDisplayString)(e.noFilePlaceholder||(0,r.unref)(a)("upload.noFile")),1)):(0,r.createCommentVNode)("",!0)]),_:1})):((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:3,class:(0,r.normalizeClass)(["fileUploadWrap",{fileDropZone:!(0,r.unref)(s).length&&!(0,r.unref)(l).length,dragover:_.value,"bgl_oval-upload":e.oval}]),style:(0,r.normalizeStyle)({width:e.width,height:e.height}),onClick:I[4]||(I[4]=x=>(0,r.unref)(f)()),onDragover:I[5]||(I[5]=x=>w(x,!0)),onDrop:N,onDragleave:I[6]||(I[6]=x=>w(x))},[(0,r.renderSlot)(E.$slots,"files",{files:(0,r.unref)(s),fileQueue:(0,r.unref)(l)},()=>[e.multiple?((0,r.openBlock)(),(0,r.createElementBlock)("div",m3,[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(s),x=>(0,r.withDirectives)(((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:x,class:(0,r.normalizeClass)(["multi-image-item-preview",{"bgl_fill-image":e.fill}])},[y(x)?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(bo),{key:0,pathKey:x,class:"multi-preview"},null,8,["pathKey"])):((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(ve),{key:1,icon:"description",class:"multi-preview"})),(0,r.createElementVNode)("p",p3,(0,r.toDisplayString)(k(x)),1),(0,r.createVNode)((0,r.unref)(re),{thin:"",flat:"",icon:"delete",color:"red",onClick:T=>(0,r.unref)(c)(x)},null,8,["onClick"])],2)),[[V,{src:(0,r.unref)(fn)(x),download:!0}]])),128)),((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(l),x=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:x.name,class:(0,r.normalizeClass)(["multi-image-item-preview",{"bgl_fill-image":e.fill}])},[y(x.file.type)?((0,r.openBlock)(),(0,r.createElementBlock)("img",{key:0,class:"multi-preview",src:x.url,alt:""},null,8,h3)):((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(ve),{key:1,icon:"description",class:"multi-preview"})),(0,r.createElementVNode)("p",g3,(0,r.toDisplayString)(x.name),1),(0,r.createElementVNode)("div",{class:(0,r.normalizeClass)(["pie",{complete:x.progress===100}]),style:(0,r.normalizeStyle)([{"--p":x.progress},{"--b":"2px"}])},[x.progress<100?((0,r.openBlock)(),(0,r.createElementBlock)("span",v3,(0,r.toDisplayString)(x.progress.toFixed(0)),1)):(0,r.createCommentVNode)("",!0),(0,r.createVNode)((0,r.unref)(ve),{class:"success",icon:"check_circle"})],6)],2))),128))])):(0,r.unref)(s).length>0||(0,r.unref)(l).length>0?((0,r.openBlock)(),(0,r.createElementBlock)("div",y3,[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(s),x=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:x,class:(0,r.normalizeClass)(["single-image-item-preview",{"bgl_fill-image":e.fill}])},[(0,r.createElementVNode)("div",{class:(0,r.normalizeClass)(["flex opacity-8 z-99 gap-025 absolute top-0 start-0",{"mx-auto end-0 mt-1 justify-content-center":e.oval,"m-05":!e.oval}])},[(0,r.withDirectives)((0,r.createVNode)((0,r.unref)(re),{color:"white",frame:"",thin:"",icon:"delete",onClick:T=>(0,r.unref)(c)(x)},null,8,["onClick"]),[[D,"Delete"]]),(0,r.withDirectives)((0,r.createVNode)((0,r.unref)(re),{color:"white",frame:"",thin:"",icon:"autorenew",onClick:I[3]||(I[3]=T=>(0,r.unref)(f)())},null,512),[[D,"Replace"]]),(0,r.withDirectives)((0,r.createVNode)((0,r.unref)(re),{color:"white",frame:"",thin:"",target:"_blank",icon:"download",href:(0,r.unref)(fn)(x),download:k(x)},null,8,["href","download"]),[[D,"Download"]])],2),y(x)?((0,r.openBlock)(),(0,r.createElementBlock)("div",b3,[(0,r.withDirectives)((0,r.createVNode)((0,r.unref)(bo),{class:"single-preview",pathKey:x,alt:""},null,8,["pathKey"]),[[V,{src:(0,r.unref)(fn)(x),download:!0}]])])):(0,r.withDirectives)(((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(ve),{key:1,size:4,weight:"2",icon:"description",class:"color-primary w-100"},null,512)),[[V,{src:(0,r.unref)(fn)(x),download:!0}]])],2))),128)),((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)((0,r.unref)(l),x=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:x.name,class:(0,r.normalizeClass)(["single-image-item-preview",{"bgl_fill-image":e.fill}])},[(0,r.createVNode)((0,r.unref)(Wr),{type:"bar",progress:x.progress,class:"absolute bottom-05 end start w-100px mx-auto rounded overflow-hidden"},null,8,["progress"]),y(x.file.type)?((0,r.openBlock)(),(0,r.createElementBlock)("img",{key:0,class:"single-preview opacity-5",src:x.url,alt:""},null,8,_3)):(0,r.createCommentVNode)("",!0)],2))),128))])):(0,r.createCommentVNode)("",!0)],!0),g.value&&(0,r.unref)(i)["drop-placeholder"]?(0,r.renderSlot)(E.$slots,"drop-placeholder",{key:0,files:(0,r.unref)(s),fileQueue:(0,r.unref)(l),browse:(0,r.unref)(f)},void 0,!0):g.value?(0,r.renderSlot)(E.$slots,"placeholder",{key:1,files:(0,r.unref)(s),fileQueue:(0,r.unref)(l),browse:(0,r.unref)(f)},()=>[(0,r.createElementVNode)("p",w3,[e.showIcon?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(ve),{key:0,icon:e.icon,size:e.iconSize,"mobile-size":e.iconMobileSize,class:"user-select-none line-height-1"},null,8,["icon","size","mobile-size"])):(0,r.createCommentVNode)("",!0),(0,r.createElementVNode)("span",$3,(0,r.toDisplayString)(b.value),1)])],!0):(0,r.createCommentVNode)("",!0)],38)),e.error?((0,r.openBlock)(),(0,r.createElementBlock)("div",E3,(0,r.toDisplayString)(e.error),1)):(0,r.createCommentVNode)("",!0)],14,r3)}}}),ga=$e(k3,[["__scopeId","data-v-04d7cdbf"]]);const C3=["mergeCells","splitCells","addRowBefore","addRowAfter","deleteRow","insertColumnLeft","insertColumnRight","deleteColumn","tableAlignLeft","tableAlignCenter","tableAlignRight","tableAlignJustify","deleteTable"],S3=["h1","h2","h3","h4","h5","h6","separator","p","blockquote","orderedList","unorderedList","separator","bold","italic","underline","separator","alignMenu","ltrDirection","rtlDirection","separator","insertTable","separator","link","image","video","embed","clear","separator","undo","redo","separator","splitView","fullScreen"],hR=["h1","h2","h3","h4","h5","h6","separator","bold","italic","underline","separator","fontColor","bgColor","separator","p","blockquote","orderedList","unorderedList","indent","outdent","separator","link","image","video","embed","separator","splitView","clear","insertTable",...C3,"separator","undo","redo","fullScreen"],x3=[{name:"headingsMenu",label:"Headings",icon:"title"},{name:"mediaMenu",label:"Media",icon:"perm_media"},{name:"alignMenu",label:"Alignment",icon:"format_align_left"},{name:"h1",label:"Heading 1",icon:"format_h1"},{name:"h2",label:"Heading 2",icon:"format_h2"},{name:"h3",label:"Heading 3",icon:"format_h3"},{name:"h4",label:"Heading 4",icon:"format_h4"},{name:"h5",label:"Heading 5",icon:"format_h5"},{name:"h6",label:"Heading 6",icon:"format_h6"},{name:"p",label:"Paragraph",icon:"format_paragraph"},{name:"blockquote",label:"Blockquote",icon:"format_quote"},{name:"bold",label:"Bold",icon:"format_bold"},{name:"italic",label:"Italic",icon:"format_italic"},{name:"underline",label:"Underline",icon:"format_underlined"},{name:"orderedList",label:"Ordered List",icon:"format_list_numbered"},{name:"unorderedList",label:"Unordered List",icon:"format_list_bulleted"},{name:"link",label:"Link",icon:"add_link"},{name:"image",label:"Image",icon:"add_photo_alternate"},{name:"video",label:"Video",icon:"play_circle"},{name:"embed",label:"Embed",icon:"media_link"},{name:"splitView",label:"Split View",icon:"code"},{name:"clear",label:"Clear Formatting",icon:"format_clear"},{name:"alignLeft",label:"Align Left",icon:"format_align_left"},{name:"alignCenter",label:"Align Center",icon:"format_align_center"},{name:"alignRight",label:"Align Right",icon:"format_align_right"},{name:"alignJustify",label:"Align Justify",icon:"format_align_justify"},{name:"tableAlignLeft",label:"Table Align Left",icon:"format_align_left"},{name:"tableAlignCenter",label:"Table Align Center",icon:"format_align_center"},{name:"tableAlignRight",label:"Table Align Right",icon:"format_align_right"},{name:"tableAlignJustify",label:"Table Align Justify",icon:"format_align_justify"},{name:"indent",label:"Indent",icon:"format_indent_increase"},{name:"outdent",label:"Outdent",icon:"format_indent_decrease"},{name:"fontColor",label:"Font Color",icon:"format_color_text"},{name:"bgColor",label:"Background Color",icon:"format_color_fill"},{name:"insertTable",label:"Insert Table",icon:"table"},{name:"deleteTable",label:"Delete Table",icon:"delete_sweep"},{name:"mergeCells",label:"Merge Cells",icon:"table_chart"},{name:"splitCells",label:"Split Cells",icon:"dashboard"},{name:"addRowBefore",label:"Insert Row Above",icon:"add_box"},{name:"addRowAfter",label:"Insert Row Below",icon:"vertical_align_bottom"},{name:"deleteRow",label:"Delete Row",icon:"remove"},{name:"insertColumnLeft",label:"Insert Column Left",icon:"format_indent_decrease"},{name:"insertColumnRight",label:"Insert Column Right",icon:"format_indent_increase"},{name:"deleteColumn",label:"Delete Column",icon:"view_week"},{name:"separator"},{name:"undo",label:"Undo",icon:"undo"},{name:"redo",label:"Redo",icon:"redo"},{name:"separator"},{name:"fullScreen",label:"Full Screen",icon:"fullscreen",class:"ms-auto"},{name:"textDirection",label:"Text Direction (RTL/LTR)",icon:"format_textdirection_r_to_l"},{name:"ltrDirection",label:"Left to Right",icon:"format_textdirection_l_to_r"},{name:"rtlDirection",label:"Right to Left",icon:"format_textdirection_r_to_l"}];var T3={class:"table-grid-selector p-075"},N3={class:"txt-center mb-075"},D3={style:{"font-size":"14px","font-weight":"500",color:"#333","margin-bottom":"4px"}},A3=["onFocus","onMouseenter","onClick"],B3={class:"border-top pt-075"},M3=10,L3=10,P3=(0,r.defineComponent)({__name:"TableGridSelector",emits:["insert","openAdvanced"],setup(e,{emit:t}){const n=t,o=(0,r.ref)(0),a=(0,r.ref)(0),i=(0,r.computed)(()=>{const f=[];for(let m=1;m<=M3;m++)for(let p=1;p<=L3;p++)f.push({row:m,col:p,isActive:m<=o.value&&p<=a.value});return f}),l=(0,r.computed)(()=>o.value===0||a.value===0?"Select table size":`${o.value} × ${a.value}`);function s(f,m){o.value=f,a.value=m}function c(f,m,p){n("insert",f,m),p()}function u(f){n("openAdvanced"),f()}function d(){o.value=0,a.value=0}return(f,m)=>((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(Vt),{placement:"bottom-start",thin:"",flat:"",icon:"table"},{default:(0,r.withCtx)(({hide:p})=>[(0,r.createElementVNode)("div",T3,[(0,r.createElementVNode)("div",N3,[(0,r.createElementVNode)("div",D3,(0,r.toDisplayString)(l.value),1),m[0]||(m[0]=(0,r.createElementVNode)("div",{style:{"font-size":"12px",color:"#666"}}," Hover to select size ",-1))]),(0,r.createElementVNode)("div",{style:{display:"grid","grid-template-columns":"repeat(10, 20px)","grid-template-rows":"repeat(10, 20px)",gap:"2px","margin-bottom":"12px",direction:"ltr"},onMouseleave:d,onBlur:d},[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(i.value,h=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:`${h.row}-${h.col}`,tabindex:"0",style:(0,r.normalizeStyle)({width:"20px",height:"20px",border:"1px solid #ddd",backgroundColor:h.isActive?"var(--bgl-primary)":"#fff",cursor:"pointer",borderRadius:"2px",transition:"background-color 0.1s ease"}),onFocus:v=>s(h),onMouseenter:v=>s(h.row,h.col),onClick:v=>c(h.row,h.col,p)},null,44,A3))),128))],32),(0,r.createElementVNode)("div",B3,[(0,r.createVNode)((0,r.unref)(re),{value:"Advanced Settings",icon:"settings",class:"bg-gray-30 color-black",onClick:h=>u(p)},null,8,["onClick"])])])]),_:1}))}}),I3=P3,V3={class:"toolbar flex gap-025 pb-05 flex-wrap",role:"toolbar",style:{position:"relative"}},O3={class:"flex flex-column p-025"},R3=(0,r.defineComponent)({__name:"EditorToolbar",props:{config:{default:()=>S3},selectedStyles:{},hideImages:{type:Boolean,default:!1},hideVideos:{type:Boolean,default:!1},hideEmbeds:{type:Boolean,default:!1},hideTables:{type:Boolean,default:!1},hideAlignment:{type:Boolean,default:!1},hideDirections:{type:Boolean,default:!1},hideH5H6:{type:Boolean,default:!1},hide:{default:()=>[]}},emits:["action"],setup(e,{emit:t}){const n=t;function o(){return e.selectedStyles.has("alignLeft")?"format_align_left":e.selectedStyles.has("alignCenter")?"format_align_center":e.selectedStyles.has("alignRight")?"format_align_right":e.selectedStyles.has("alignJustify")?"format_align_justify":"format_align_left"}function a(){return e.selectedStyles.has("alignLeft")||e.selectedStyles.has("alignCenter")||e.selectedStyles.has("alignRight")||e.selectedStyles.has("alignJustify")}function i(f){if(e.hide.includes(f))return!0;for(const[m,p]of Object.entries({image:["insertImage","image"],video:["insertVideo","video"],embed:["insertEmbed","embed"],table:["insertTable"],direction:["textDirection"],fullScreen:["fullScreen"],ul:["unorderedList"],ol:["orderedList"],splitView:["splitView"],p:["p"],align:["alignMenu"],alignment:["alignMenu"]}))if(e.hide.includes(m)&&p.includes(f))return!0;return{insertImage:e.hideImages,insertVideo:e.hideVideos,insertEmbed:e.hideEmbeds,insertTable:e.hideTables,alignMenu:e.hideAlignment,textDirection:e.hideDirections,h5:e.hideH5H6,h6:e.hideH5H6}[f]||!1}const l=f=>x3.find(m=>m.name===f);function s(f){const m=e.config.map(l).filter(Boolean);let p=-1;for(let v=f-1;v>=0;v--){const b=m[v];if(b&&b.name!=="separator"&&!i(b.name)){p=v;break}}let h=-1;for(let v=f+1;v<m.length;v++){const b=m[v];if(b&&b.name!=="separator"&&!i(b.name)){h=v;break}}if(p===-1||h===-1)return!1;for(let v=p+1;v<f;v++){const b=m[v];if(b&&b.name==="separator")return!1}return!0}function c(f,m){n("action",f,m)}function u(f,m){const p=document.createElement("table");p.style.width="100%",p.style.borderCollapse="collapse",p.style.marginBottom="1rem";const h=document.createElement("thead"),v=h.insertRow();for(let g=0;g<m;g++){const y=document.createElement("th");y.innerHTML=`Header ${g+1}`,y.style.padding="8px",y.style.border="1px solid #ddd",y.style.backgroundColor="#f4f4f4",v.appendChild(y)}p.appendChild(h);const b=document.createElement("tbody");for(let g=0;g<f;g++){const y=b.insertRow();for(let _=0;_<m;_++){const w=y.insertCell();w.innerHTML="&nbsp;",w.style.padding="8px",w.style.border="1px solid #ddd"}}p.appendChild(b),n("action","insertTable",p.outerHTML)}function d(){n("action","insertTable")}return(f,m)=>{const p=(0,r.resolveDirective)("tooltip");return(0,r.openBlock)(),(0,r.createElementBlock)("div",V3,[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(e.config.map(l).filter(Boolean),(h,v)=>((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:v},[h.name==="insertTable"&&!i("insertTable")?((0,r.openBlock)(),(0,r.createBlock)(I3,{key:0,onInsert:u,onOpenAdvanced:d})):h.name==="insertImage"&&!i("insertImage")?(0,r.withDirectives)(((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:1,icon:h.icon,thin:"",flat:"","aria-label":h.name,class:(0,r.normalizeClass)([[h.class,{active:e.selectedStyles.has(h.name)}],""]),tabindex:"-1",onClick:b=>c(h.name)},null,8,["icon","aria-label","class","onClick"])),[[p,h.label]]):h.name==="insertVideo"&&!i("insertVideo")?(0,r.withDirectives)(((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:2,icon:h.icon,thin:"",flat:"","aria-label":h.name,class:(0,r.normalizeClass)([[h.class,{active:e.selectedStyles.has(h.name)}],""]),tabindex:"-1",onClick:b=>c(h.name)},null,8,["icon","aria-label","class","onClick"])),[[p,h.label]]):h.name==="insertEmbed"&&!i("insertEmbed")?(0,r.withDirectives)(((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:3,icon:h.icon,thin:"",flat:"","aria-label":h.name,class:(0,r.normalizeClass)([[h.class,{active:e.selectedStyles.has(h.name)}],""]),tabindex:"-1",onClick:b=>c(h.name)},null,8,["icon","aria-label","class","onClick"])),[[p,h.label]]):h.name==="alignMenu"&&!i("alignMenu")?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(Vt),{key:4,placement:"bottom-start",thin:"",flat:"",icon:o(),class:(0,r.normalizeClass)({"alignment-active":a()})},{default:(0,r.withCtx)(({hide:b})=>[(0,r.createElementVNode)("div",O3,[(0,r.createVNode)((0,r.unref)(re),{thin:"",flat:"",icon:"format_align_left",class:(0,r.normalizeClass)({active:e.selectedStyles.has("alignLeft")}),onClick:g=>{c("alignLeft"),b()}},null,8,["class","onClick"]),(0,r.createVNode)((0,r.unref)(re),{thin:"",flat:"",icon:"format_align_center",class:(0,r.normalizeClass)({active:e.selectedStyles.has("alignCenter")}),onClick:g=>{c("alignCenter"),b()}},null,8,["class","onClick"]),(0,r.createVNode)((0,r.unref)(re),{thin:"",flat:"",icon:"format_align_right",class:(0,r.normalizeClass)({active:e.selectedStyles.has("alignRight")}),onClick:g=>{c("alignRight"),b()}},null,8,["class","onClick"]),(0,r.createVNode)((0,r.unref)(re),{thin:"",flat:"",icon:"format_align_justify",class:(0,r.normalizeClass)({active:e.selectedStyles.has("alignJustify")}),onClick:g=>{c("alignJustify"),b()}},null,8,["class","onClick"])])]),_:1},8,["icon","class"])):h.name==="textDirection"&&!i("textDirection")?(0,r.withDirectives)(((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:5,icon:e.selectedStyles.has("textDirection")?"format_textdirection_l_to_r":"format_textdirection_r_to_l",thin:"",flat:"","aria-label":h.name,class:(0,r.normalizeClass)([[h.class,{active:e.selectedStyles.has("textDirection")}],""]),tabindex:"-1",onClick:b=>c(h.name)},null,8,["icon","aria-label","class","onClick"])),[[p,h.label]]):(h.name==="h5"||h.name==="h6")&&!i(h.name)?(0,r.withDirectives)(((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:6,icon:h.icon,thin:"",flat:"","aria-label":h.name,class:(0,r.normalizeClass)([[h.class,{active:e.selectedStyles.has(h.name)}],""]),tabindex:"-1",onClick:b=>c(h.name)},null,8,["icon","aria-label","class","onClick"])),[[p,h.label]]):h.name!=="separator"&&h.name!=="insertTable"&&h.name!=="insertImage"&&h.name!=="insertVideo"&&h.name!=="insertEmbed"&&h.name!=="alignMenu"&&h.name!=="textDirection"&&h.name!=="h5"&&h.name!=="h6"&&!i(h.name)?(0,r.withDirectives)(((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:7,icon:h.icon,thin:"",flat:"","aria-label":h.name,class:(0,r.normalizeClass)([[h.class,{active:e.selectedStyles.has(h.name)}],""]),tabindex:"-1",onClick:b=>c(h.name)},null,8,["icon","aria-label","class","onClick"])),[[p,h.label]]):h.name==="separator"&&s(v)?((0,r.openBlock)(),(0,r.createElementBlock)("span",{key:`separator-${v}`,class:"opacity-2 mb-025"},"|")):(0,r.createCommentVNode)("",!0)],64))),128))])}}}),F3=$e(R3,[["__scopeId","data-v-2af54422"]]);function z3(e,t){const{doc:n}=t;if(!n)return;const o=n.getSelection();if(!o||!o.rangeCount)return;let a=o.getRangeAt(0);if(a.collapsed){if(!U3(n,a)){const{showTooltipMessage:s}=t;s?s("To add a link, please select text first or place cursor within a word"):alert("To add a link, please select text first or place the cursor within a word you want to turn into a link.");return}a=o.getRangeAt(0)}const i=a.commonAncestorContainer,l=(i.nodeType===Node.TEXT_NODE?i.parentElement:i)?.closest("a");if(t.openLinkModal){t.openLinkModal(o,a,l);return}alert("Link functionality requires proper modal setup")}function U3(e,t){if(!t.collapsed)return!0;let n=t.startContainer,o=t.startOffset;if(n.nodeType!==Node.TEXT_NODE){const c=n;if(c.childNodes.length>0&&o<c.childNodes.length){const u=c.childNodes[o];if(u.nodeType===Node.TEXT_NODE)n=u,o=0;else return!1}else return!1}const a=n.textContent||"";if(!a)return!1;let i=o,l=o;const s=/[\u0590-\u05FF\u0600-\u06FF\w]/;for(;i>0&&s.test(a[i-1]);)i--;for(;l<a.length&&s.test(a[l]);)l++;if(i<l){t.setStart(n,i),t.setEnd(n,l);const c=e.getSelection();return c&&(c.removeAllRanges(),c.addRange(t)),!0}return!1}function Qd(e,t,n){if(!n.doc)return;const o=n.doc.createElement("table");o.style.width="100%",o.style.borderCollapse="collapse",o.style.marginBottom="1rem";const a=n.doc.createElement("thead"),i=a.insertRow();for(let c=0;c<t;c++){const u=n.doc.createElement("th");u.innerHTML=`Header ${c+1}`,u.style.padding="8px",u.style.border="1px solid var(--bgl-border-color, #ddd)",u.style.backgroundColor="var(--bgl-gray-light, #f4f4f4)",i.appendChild(u)}o.appendChild(a);const l=n.doc.createElement("tbody");for(let c=0;c<e;c++){const u=l.insertRow();for(let d=0;d<t;d++){const f=u.insertCell();f.innerHTML="&nbsp;",f.style.padding="8px",f.style.border="1px solid var(--bgl-border-color, #ddd)"}}o.appendChild(l);const{range:s}=n;if(s){if(s.insertNode(o),n.doc.getSelection()){const c=o.querySelector("td");if(c){s.selectNodeContents(c),s.collapse(!0);const u=n.doc.getSelection();u&&(u.removeAllRanges(),u.addRange(s))}}}else n.doc.body.appendChild(o);n.content=n.doc.body.innerHTML}function H3(e,t){const n=Array.from(e.cloneContents().querySelectorAll("td"));if(n.length<2)return;const o=e.startContainer.parentElement?.closest("td");if(!o)return;o.colSpan=n.length,o.innerHTML=n.map(i=>i.innerHTML).join(" "),n.slice(1).forEach(i=>{t.getElementById(i.id)?.remove()});const a=t.editorState;a&&(a.content=t.body.innerHTML)}function W3(e,t){const n=e.startContainer.parentElement?.closest("td");if(!n||!n.colSpan||n.colSpan===1)return;const o=new Array(n.colSpan-1).fill(0).map(()=>{const i=t.createElement("td");return i.style.border="1px solid var(--bgl-border-color)",i.style.padding="8px",i.innerHTML="&nbsp;",i});n.colSpan=1,n.insertAdjacentElement("afterend",o[0]),o.slice(1).forEach(i=>{o[0].insertAdjacentElement("afterend",i)});const a=t.editorState;a&&(a.content=t.body.innerHTML)}function ef(e,t,n){const o=t.startContainer.parentElement?.closest("td");if(!o)return;const a=o.parentElement,i=a?.parentElement;if(!a||!i)return;const l=a.cloneNode(!0);Array.from(l.cells).forEach(c=>c.innerHTML="&nbsp;"),a.insertAdjacentElement(e==="before"?"beforebegin":"afterend",l);const s=n.editorState;s&&(s.content=n.body.innerHTML)}function j3(e){const t=e.startContainer.parentElement?.closest("td");if(!t)return;const n=t.parentElement;if(!n)return;const o=n.ownerDocument;n.remove();const a=o.editorState;a&&(a.content=o.body.innerHTML)}function q3(e){const t=e.startContainer.parentElement?.closest("td");if(!t)return;const n=t.closest("table");if(!n)return;const o=n.ownerDocument;n.remove();const a=o.editorState;a&&(a.content=o.body.innerHTML)}function tf(e,t){const n=t.startContainer.parentElement?.closest("td");if(!n)return;const o=n.closest("table");if(!o)return;const a=n.cellIndex,{rows:i}=o;for(let s=0;s<i.length;s++){const c=i[s].insertCell(e==="after"?a+1:a);c.innerHTML="&nbsp;",c.style.border="1px solid var(--bgl-border-color)",c.style.padding="8px"}const l=o.ownerDocument.editorState;l&&(l.content=o.ownerDocument.body.innerHTML)}function G3(e){const t=e.startContainer.parentElement?.closest("td");if(!t)return;const n=t.closest("table");if(!n)return;const o=t.cellIndex,{rows:a}=n,i=n.ownerDocument;for(let s=0;s<a.length;s++)a[s].deleteCell(o);a[0].cells.length===0&&n.remove();const l=i.editorState;l&&(l.content=i.body.innerHTML)}function Y3(e,t){const n=e.startContainer.parentElement?.closest("td");if(!n)return;const o=n.closest("table");if(!o)return;const a=n.cellIndex,{rows:i}=o;for(let s=0;s<i.length;s++){const c=i[s].cells[a];c&&(c.style.textAlign=t)}const l=o.ownerDocument.editorState;l&&(l.content=o.ownerDocument.body.innerHTML)}function We(e){if(!e.doc)return null;const t=e.doc.getSelection();return!t||!t.rangeCount?null:{selection:t,range:t.getRangeAt(0)}}function Zl(e,t,n){if(!t.collapsed)return!1;let o=t.startContainer,a=t.startOffset;if(o.nodeType!==Node.TEXT_NODE){const f=o;if(f.childNodes.length>0&&a<f.childNodes.length){const m=f.childNodes[a];if(m.nodeType===Node.TEXT_NODE)o=m,a=0;else return!1}else return!1}const{parentElement:i}=o,l=i?.closest(n.toLowerCase());if(l)try{const f=l.parentNode;if(f){for(;l.firstChild;)f.insertBefore(l.firstChild,l);f.removeChild(l);const m=e.createRange();m.setStart(o,a),m.collapse(!0);const p=e.getSelection();return p&&(p.removeAllRanges(),p.addRange(m)),!0}}catch{return!1}const s=o.textContent||"";if(!s)return!1;let c=a,u=a;const d=/[\u0590-\u05FF\u0600-\u06FF\w]/;for(a>0&&d.test(s[a-1])&&(a>=s.length||!d.test(s[a]))&&(c=a-1,u=a-1);c>0&&d.test(s[c-1]);)c--;for(;u<s.length&&d.test(s[u]);)u++;if(c<u&&u>c)try{const f=s.substring(0,c),m=s.substring(c,u),p=s.substring(u),h=e.createElement(n);h.textContent=m;const v=o.parentNode;if(v){if(f){const y=e.createTextNode(f);v.insertBefore(y,o)}if(v.insertBefore(h,o),p){const y=e.createTextNode(p);v.insertBefore(y,o)}v.removeChild(o);const b=e.createRange();b.setStartAfter(h),b.collapse(!0);const g=e.getSelection();return g&&(g.removeAllRanges(),g.addRange(b)),!0}}catch{}return!1}function X3(e){if(!e.doc)return;e.content=e.doc.body.innerHTML;const t=e.doc.getSelection();t&&t.rangeCount>0&&(e.selection=t,e.range=t.getRangeAt(0).cloneRange(),e.rangeCount=t.rangeCount)}function Uo(e){let t=e.nodeType===Node.TEXT_NODE?e.parentElement:e;for(;t;){if(t.matches&&t.matches("p,h1,h2,h3,h4,h5,h6,blockquote,li,div"))return t;t=t.parentElement}return null}function Ae(e,t,n){return{name:e,execute:(o,a)=>{o.doc&&(t(o,a),X3(o))},isActive:n}}function K3(e){const t={undo:Ae("Undo",()=>{if(e.undoStack.length>0&&e.doc){const m=e.undoStack.pop();m!==void 0&&(e.redoStack.push(e.content),e.content=m,e.doc.body.innerHTML=m)}}),redo:Ae("Redo",()=>{if(e.redoStack.length>0&&e.doc){const m=e.redoStack.pop();m!==void 0&&(e.undoStack.push(e.content),e.content=m,e.doc.body.innerHTML=m)}})},n={bold:Ae("Bold",m=>{const p=We(m);if(!p)return;let{range:h,selection:v}=p;if(h.collapsed)return Zl(m.doc,h,"b"),void 0;const b=h.commonAncestorContainer,g=(b.nodeType===Node.TEXT_NODE?b.parentElement:b)?.closest("b, strong");if(g)try{const y=g.parentNode;for(;g.firstChild;)y?.insertBefore(g.firstChild,g);y?.removeChild(g),v.removeAllRanges(),v.addRange(h)}catch{}else try{const y=m.doc.createElement("b");try{h.surroundContents(y)}catch{const _=h.extractContents();y.appendChild(_),h.insertNode(y)}h.selectNodeContents(y),v.removeAllRanges(),v.addRange(h)}catch{}},m=>{const p=We(m);if(!p)return!1;const h=p.range.commonAncestorContainer;return!!(h.nodeType===Node.TEXT_NODE?h.parentElement:h)?.closest("b, strong")}),italic:Ae("Italic",m=>{const p=We(m);if(!p)return;let{range:h,selection:v}=p;if(h.collapsed)return Zl(m.doc,h,"i"),void 0;const b=h.commonAncestorContainer,g=(b.nodeType===Node.TEXT_NODE?b.parentElement:b)?.closest("i, em");if(g)try{const y=g.parentNode;for(;g.firstChild;)y?.insertBefore(g.firstChild,g);y?.removeChild(g),v.removeAllRanges(),v.addRange(h)}catch{}else try{const y=m.doc.createElement("i");try{h.surroundContents(y)}catch{const _=h.extractContents();y.appendChild(_),h.insertNode(y)}h.selectNodeContents(y),v.removeAllRanges(),v.addRange(h)}catch{}},m=>{const p=We(m);if(!p)return!1;const h=p.range.commonAncestorContainer;return!!(h.nodeType===Node.TEXT_NODE?h.parentElement:h)?.closest("i, em")}),underline:Ae("Underline",m=>{const p=We(m);if(!p)return;let{range:h,selection:v}=p;if(h.collapsed)return Zl(m.doc,h,"u"),void 0;const b=h.commonAncestorContainer,g=(b.nodeType===Node.TEXT_NODE?b.parentElement:b)?.closest("u");if(g)try{const y=g.parentNode;for(;g.firstChild;)y?.insertBefore(g.firstChild,g);y?.removeChild(g),v.removeAllRanges(),v.addRange(h)}catch{}else try{const y=m.doc.createElement("u");try{h.surroundContents(y)}catch{const _=h.extractContents();y.appendChild(_),h.insertNode(y)}h.selectNodeContents(y),v.removeAllRanges(),v.addRange(h)}catch{}},m=>{const p=We(m);if(!p)return!1;const h=p.range.commonAncestorContainer;return!!(h.nodeType===Node.TEXT_NODE?h.parentElement:h)?.closest("u")}),link:Ae("Link",m=>{const{openLinkModal:p}=m;p&&z3(p,m)},m=>{const p=We(m);if(!p)return!1;const h=p.range.commonAncestorContainer;return!!(h.nodeType===Node.TEXT_NODE?h.parentElement:h)?.closest("a")})},o=["h1","h2","h3","h4","h5","h6"].reduce((m,p)=>({...m,[p]:Ae(`Heading ${p}`,h=>{const v=We(h);if(!v)return;const{range:b,selection:g}=v,y=Uo(b.commonAncestorContainer);if(!y)return;const{startContainer:_}=b,{endContainer:w}=b,{startOffset:$}=b,{endOffset:N}=b,k=b.collapsed,E=y.tagName.toLowerCase()===p.toLowerCase(),I=E?"p":p;try{const D=h.doc.createElement(I);for(;y.firstChild;)D.appendChild(y.firstChild);y.parentNode?.replaceChild(D,y);try{const V=h.doc.createRange(),x=(F,O,B)=>{if(F===O)return B;if(F.nodeType===Node.TEXT_NODE){const j=h.doc.createTreeWalker(B,NodeFilter.SHOW_TEXT,null);let te=0;const Q=h.doc.createTreeWalker(O,NodeFilter.SHOW_TEXT,null);let ie=Q.nextNode();for(;ie&&ie!==F;)te++,ie=Q.nextNode();let R=j.nextNode(),P=0;for(;R&&P<te;)P++,R=j.nextNode();return R}return B.firstChild},T=x(_,y,D),L=x(w,y,D);if(T&&L){if(T.nodeType===Node.TEXT_NODE){const F=Math.min($,T.textContent?.length||0);V.setStart(T,F)}else V.setStart(T,0);if(k)V.collapse(!0);else if(L.nodeType===Node.TEXT_NODE){const F=Math.min(N,L.textContent?.length||0);V.setEnd(L,F)}else V.setEnd(L,0);g.removeAllRanges(),g.addRange(V)}else V.selectNodeContents(D),k&&V.collapse(!0),g.removeAllRanges(),g.addRange(V)}catch{const x=h.doc.createRange();x.selectNodeContents(D),x.collapse(!0),g.removeAllRanges(),g.addRange(x)}if(!E&&!D.nextElementSibling){const V=h.doc.createElement("p");V.dir=D.dir||h.doc.body.dir,D.parentNode?.insertBefore(V,D.nextSibling)}}catch{}})}),{}),a={p:Ae("Paragraph",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=Uo(h.commonAncestorContainer);if(v&&v.tagName.toLowerCase()!=="p")try{const b=m.doc.createElement("p");for(;v.firstChild;)b.appendChild(v.firstChild);v.parentNode?.replaceChild(b,v),h.selectNodeContents(b),h.collapse(!1),p.selection.removeAllRanges(),p.selection.addRange(h)}catch{}}),blockquote:Ae("Blockquote",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=Uo(h.commonAncestorContainer);if(!v)return;const b=v.tagName.toLowerCase()==="blockquote"?"p":"blockquote";try{const g=m.doc.createElement(b);for(;v.firstChild;)g.appendChild(v.firstChild);v.parentNode?.replaceChild(g,v),h.selectNodeContents(g),h.collapse(!1),p.selection.removeAllRanges(),p.selection.addRange(h)}catch{}})},i={orderedList:Ae("Ordered List",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=Uo(h.commonAncestorContainer);if(!v)return;const b=v.closest("li");if(b){const g=b.parentElement;if(!g)return;if(g.tagName.toLowerCase()==="ol"){const y=m.doc.createElement("p");for(;b.firstChild;)y.appendChild(b.firstChild);g.parentNode?.insertBefore(y,g),b.remove(),g.querySelector("li")||g.remove(),h.selectNodeContents(y),h.collapse(!1),p.selection.removeAllRanges(),p.selection.addRange(h);return}if(g.tagName.toLowerCase()==="ul"){const y=m.doc.createElement("ol"),_=h.startOffset,w=h.startContainer;for(;g.firstChild;)y.appendChild(g.firstChild);g.parentNode?.replaceChild(y,g);try{const $=m.doc.createRange();$.setStart(w,_),$.collapse(!0),p.selection.removeAllRanges(),p.selection.addRange($)}catch{const $=y.querySelector("li");if($){const N=m.doc.createRange();N.selectNodeContents($),N.collapse(!0),p.selection.removeAllRanges(),p.selection.addRange(N)}}return}}try{const g=m.doc.createElement("ol"),y=m.doc.createElement("li");for(;v.firstChild;)y.appendChild(v.firstChild);g.appendChild(y),v.parentNode?.replaceChild(g,v),h.selectNodeContents(y),h.collapse(!1),p.selection.removeAllRanges(),p.selection.addRange(h)}catch{}}),unorderedList:Ae("Unordered List",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=Uo(h.commonAncestorContainer);if(!v)return;const b=v.closest("li");if(b){const g=b.parentElement;if(!g)return;if(g.tagName.toLowerCase()==="ul"){const y=m.doc.createElement("p");for(;b.firstChild;)y.appendChild(b.firstChild);g.parentNode?.insertBefore(y,g),b.remove(),g.querySelector("li")||g.remove(),h.selectNodeContents(y),h.collapse(!1),p.selection.removeAllRanges(),p.selection.addRange(h);return}if(g.tagName.toLowerCase()==="ol"){const y=m.doc.createElement("ul"),_=h.startOffset,w=h.startContainer;for(;g.firstChild;)y.appendChild(g.firstChild);g.parentNode?.replaceChild(y,g);try{const $=m.doc.createRange();$.setStart(w,_),$.collapse(!0),p.selection.removeAllRanges(),p.selection.addRange($)}catch{const N=y.querySelector("li");if(N){const k=m.doc.createRange();k.selectNodeContents(N),k.collapse(!0),p.selection.removeAllRanges(),p.selection.addRange(k)}}return}}try{const g=m.doc.createElement("ul"),y=m.doc.createElement("li");for(;v.firstChild;)y.appendChild(v.firstChild);g.appendChild(y),v.parentNode?.replaceChild(g,v),h.selectNodeContents(y),h.collapse(!1),p.selection.removeAllRanges(),p.selection.addRange(h)}catch{}})},l={clear:Ae("Clear Formatting",m=>{const p=We(m);if(!p)return;const{range:h,selection:v}=p;try{let y=function(w){return w.replace(/[\u200B-\u200D\uFEFF]/g,"").replace(/\s+/g," ").replace(/\u00A0/g," ").trim()},_=function(w){if(w.nodeType===Node.TEXT_NODE){const $=y(w.textContent||"");return m.doc.createTextNode($)}if(w.nodeType===Node.ELEMENT_NODE){const $=w,N=$.tagName.toLowerCase(),k=["p","h1","h2","h3","h4","h5","h6","ul","ol","li","blockquote","div","table","tr","td","th","thead","tbody","b","i","u","a","img","iframe","video","audio","figure","figcaption"];if(["strong","em","span","font","strike","sub","sup","mark","del","ins","small","big"].includes(N)){const E=y($.textContent||"");return m.doc.createTextNode(E)}if(k.includes(N)){const E=m.doc.createElement(N);return N==="a"&&$.hasAttribute("href")?(E.setAttribute("href",$.getAttribute("href")||""),$.hasAttribute("target")&&E.setAttribute("target",$.getAttribute("target")||""),$.hasAttribute("rel")&&E.setAttribute("rel",$.getAttribute("rel")||"")):N==="img"?($.hasAttribute("src")&&E.setAttribute("src",$.getAttribute("src")||""),$.hasAttribute("alt")&&E.setAttribute("alt",$.getAttribute("alt")||""),$.hasAttribute("width")&&E.setAttribute("width",$.getAttribute("width")||""),$.hasAttribute("height")&&E.setAttribute("height",$.getAttribute("height")||"")):N==="iframe"?($.hasAttribute("src")&&E.setAttribute("src",$.getAttribute("src")||""),$.hasAttribute("width")&&E.setAttribute("width",$.getAttribute("width")||""),$.hasAttribute("height")&&E.setAttribute("height",$.getAttribute("height")||""),$.hasAttribute("frameborder")&&E.setAttribute("frameborder",$.getAttribute("frameborder")||""),$.hasAttribute("allowfullscreen")&&E.setAttribute("allowfullscreen",$.getAttribute("allowfullscreen")||"")):(N==="video"||N==="audio")&&($.hasAttribute("src")&&E.setAttribute("src",$.getAttribute("src")||""),$.hasAttribute("controls")&&E.setAttribute("controls",$.getAttribute("controls")||""),$.hasAttribute("width")&&E.setAttribute("width",$.getAttribute("width")||""),$.hasAttribute("height")&&E.setAttribute("height",$.getAttribute("height")||"")),Array.from($.childNodes).forEach(I=>{const D=_(I);(D.textContent?.trim()||D.nodeType===Node.ELEMENT_NODE)&&E.appendChild(D)}),E}}return m.doc.createTextNode("")};var b=y,g=_;if(h.collapsed){const{body:w}=m.doc,$=m.doc.createDocumentFragment();if(Array.from(w.childNodes).forEach(N=>{const k=_(N);(k.textContent?.trim()||k.nodeType===Node.ELEMENT_NODE)&&$.appendChild(k)}),w.innerHTML="",w.appendChild($),!w.firstElementChild){const N=m.doc.createElement("p");w.appendChild(N);const k=m.doc.createRange();k.selectNodeContents(N),k.collapse(!0),v.removeAllRanges(),v.addRange(k)}}else{const w=h.cloneContents(),$=m.doc.createElement("div");$.appendChild(w);const N=m.doc.createDocumentFragment();Array.from($.childNodes).forEach(k=>{const E=_(k);(E.textContent?.trim()||E.nodeType===Node.ELEMENT_NODE)&&N.appendChild(E)}),h.deleteContents(),h.insertNode(N),h.collapse(!1),v.removeAllRanges(),v.addRange(h)}}catch{}})},s={insertTable:Ae("Insert Table",(m,p)=>{if(m.openTableEditor&&!p){m.openTableEditor(null);return}if(!p){const[h,v]=[3,3];Qd(h,v,m);return}if(p.includes("<table")){const h=We(m);if(!h||!m.doc)return;const{range:v}=h;try{const b=m.doc.createElement("div");b.innerHTML=p;const g=b.querySelector("table");if(g){const y=g.cloneNode(!0);v.insertNode(y),v.setStartAfter(y),v.collapse(!0);const _=m.doc.getSelection();_&&(_.removeAllRanges(),_.addRange(v))}}catch{}}else{const[h,v]=p.split("x").map(Number)||[3,3];Qd(h,v,m)}}),deleteTable:Ae("Delete Table",m=>m.range&&q3(m.range)),mergeCells:Ae("Merge Cells",m=>m.range&&m.doc&&H3(m.range,m.doc)),splitCells:Ae("Split Cells",m=>m.range&&m.doc&&W3(m.range,m.doc)),addRowBefore:Ae("Add Row Before",m=>m.range&&m.doc&&ef("before",m.range,m.doc)),addRowAfter:Ae("Add Row After",m=>m.range&&m.doc&&ef("after",m.range,m.doc)),deleteRow:Ae("Delete Row",m=>m.range&&j3(m.range)),insertColumnLeft:Ae("Insert Column Left",m=>m.range&&tf("before",m.range)),insertColumnRight:Ae("Insert Column Right",m=>m.range&&tf("after",m.range)),deleteColumn:Ae("Delete Column",m=>m.range&&G3(m.range))},c=["Left","Center","Right","Justify"].reduce((m,p)=>({...m,[`tableAlign${p}`]:Ae(`Table Align ${p}`,h=>{if(h.range){const v=p==="Left"?"start":p==="Right"?"end":p.toLowerCase();Y3(h.range,v)}})}),{}),u={alignLeft:Ae("Align Left",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6");v&&(v.style.textAlign="left")},m=>{const p=We(m);if(!p)return!1;const{range:h}=p;return(h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6"))?.style.textAlign==="left"}),alignCenter:Ae("Align Center",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6");v&&(v.style.textAlign="center")},m=>{const p=We(m);if(!p)return!1;const{range:h}=p;return(h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6"))?.style.textAlign==="center"}),alignRight:Ae("Align Right",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6");v&&(v.style.textAlign="right")},m=>{const p=We(m);if(!p)return!1;const{range:h}=p;return(h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6"))?.style.textAlign==="right"}),alignJustify:Ae("Align Justify",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6");v&&(v.style.textAlign="justify")},m=>{const p=We(m);if(!p)return!1;const{range:h}=p;return(h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6"))?.style.textAlign==="justify"}),textDirection:Ae("Toggle Text Direction",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6");v&&(v.dir=(v.dir||"ltr")==="ltr"?"rtl":"ltr")},m=>{const p=We(m);if(!p)return!1;const{range:h}=p;return(h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6"))?.dir==="rtl"}),ltrDirection:Ae("Set Left to Right Direction",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6");v&&(v.dir="ltr")},m=>{const p=We(m);if(!p)return!1;const{range:h}=p;return(h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6"))?.dir==="ltr"}),rtlDirection:Ae("Set Right to Left Direction",m=>{const p=We(m);if(!p)return;const{range:h}=p,v=h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6");v&&(v.dir="rtl")},m=>{const p=We(m);if(!p)return!1;const{range:h}=p;return(h.startContainer.nodeType===Node.TEXT_NODE?h.startContainer.parentElement?.closest("p, h1, h2, h3, h4, h5, h6"):h.startContainer.closest("p, h1, h2, h3, h4, h5, h6"))?.dir==="rtl"})},d={fullScreen:Ae("Full Screen",m=>{m.isFullscreen=!m.isFullscreen},m=>m.isFullscreen),splitView:Ae("Split View",m=>{m.isSplitView=!m.isSplitView},m=>m.isSplitView),codeView:Ae("Code View",m=>{m.isCodeView=!m.isCodeView},m=>m.isCodeView)},f={image:Ae("Insert Image",m=>{const{openImageModal:p}=m;p&&p()}),video:Ae("Insert Video",m=>{const{openVideoModal:p}=m;p&&p()}),embed:Ae("Insert Embed",m=>{const{openEmbedModal:p}=m;p&&p()})};return{...t,...n,...o,...a,...i,...l,...s,...c,...u,...d,...f}}function J3(e,t){return{execute(n,o){const a=t[n];a&&a.execute(e,o)},isActive(n){return t[n].isActive?.(e)||!1},getValue(n){return t[n].getValue?.(e)||null}}}function r0(e,t){const n=t.getSelection();if(!n||!n.rangeCount)return!1;const o=n.getRangeAt(0).commonAncestorContainer,a=o.nodeType===Node.TEXT_NODE?o.parentElement:o;if(!a)return!1;const i=(c,u)=>c?u(c)?!0:i(c.parentElement,u):!1,l={bold:c=>{const u=c.tagName?.toLowerCase();return u==="strong"||u==="b"},italic:c=>{const u=c.tagName?.toLowerCase();return u==="em"||u==="i"},underline:c=>c.tagName?.toLowerCase()==="u",h1:c=>c.tagName?.toLowerCase()==="h1",h2:c=>c.tagName?.toLowerCase()==="h2",h3:c=>c.tagName?.toLowerCase()==="h3",h4:c=>c.tagName?.toLowerCase()==="h4",h5:c=>c.tagName?.toLowerCase()==="h5",h6:c=>c.tagName?.toLowerCase()==="h6",p:c=>c.tagName?.toLowerCase()==="p",blockquote:c=>c.tagName?.toLowerCase()==="blockquote",orderedList:c=>!!c.closest("ol"),unorderedList:c=>!!c.closest("ul"),alignLeft:c=>c.closest("p, h1, h2, h3, h4, h5, h6")?.style.textAlign==="start",alignCenter:c=>c.closest("p, h1, h2, h3, h4, h5, h6")?.style.textAlign==="center",alignRight:c=>c.closest("p, h1, h2, h3, h4, h5, h6")?.style.textAlign==="end",alignJustify:c=>c.closest("p, h1, h2, h3, h4, h5, h6")?.style.textAlign==="justify",textDirection:c=>c.closest("p, h1, h2, h3, h4, h5, h6")?.dir==="rtl",ltrDirection:c=>c.closest("p, h1, h2, h3, h4, h5, h6")?.dir==="ltr",rtlDirection:c=>c.closest("p, h1, h2, h3, h4, h5, h6")?.dir==="rtl"};if(["splitView","codeView","fullScreen"].includes(e))return!1;const s=l[e];return s?i(a,s):i(a,c=>c.tagName?.toLowerCase()===e.toLowerCase())}function Z3(e,t){const n=J3(e,K3(e)),o=()=>{if(!e.doc)return;const a=new Set;["bold","italic","underline","link","h1","h2","h3","h4","h5","h6","blockquote","p","orderedList","unorderedList","alignLeft","alignCenter","alignRight","alignJustify","textDirection","ltrDirection","rtlDirection"].forEach(i=>{r0(i,e.doc)&&a.add(i)}),e.selectedStyles=a};return{execute:(a,i)=>{if(!e.doc)return;if(t?.logCommand(a,i),["splitView","codeView","fullScreen"].includes(a))switch(a){case"splitView":e.isSplitView=!e.isSplitView;return;case"codeView":e.isCodeView=!e.isCodeView;return;case"fullScreen":e.isFullscreen=!e.isFullscreen;return}try{e.doc.body.focus()}catch{}const l=e.doc.getSelection();l?.rangeCount&&(e.selection=l,e.range=l.getRangeAt(0).cloneRange(),e.rangeCount=l.rangeCount);try{n.execute(a,i),["splitView","codeView","fullScreen"].includes(a)||o()}catch{}},isActive:n.isActive,getValue:n.getValue}}var Q3=class{session;maxActions;isDevelopment;constructor(e=1e3){this.maxActions=e,this.session=this.createNewSession(),this.isDevelopment=!1}createNewSession(){return{id:`session_${Date.now()}`,startTime:Date.now(),actions:[]}}getNodeDescription(e){if(e.nodeType===Node.TEXT_NODE)return`Text("${e.textContent?.slice(0,20)}${e.textContent&&e.textContent.length>20?"...":""}")`;const t=e;return`${t.tagName.toLowerCase()}${t.id?`#${t.id}`:""}`}captureState(e){if(!e.doc||!e.selection)return{content:"",selection:null,activeStyles:[],caretPosition:null};const{selection:t}=e,n=t.rangeCount?t.getRangeAt(0):null;return{content:e.doc.body.innerHTML,selection:n?{start:n.startOffset,end:n.endOffset,collapsed:n.collapsed,text:n.toString()}:null,activeStyles:Array.from(e.selectedStyles),caretPosition:n?{node:this.getNodeDescription(n.startContainer),offset:n.startOffset}:null}}logCommand(e,t,n){this.addAction({type:"command",name:e,timestamp:Date.now(),details:{value:t},state:this.captureState(n)})}logPaste(e,t){this.addAction({type:"paste",name:"paste",timestamp:Date.now(),details:{html:e.getData("text/html"),text:e.getData("text/plain"),types:Array.from(e.types)},state:this.captureState(t)})}logKeyboard(e,t){this.addAction({type:"keyboard",name:"keypress",timestamp:Date.now(),details:{key:e.key,code:e.code,ctrl:e.ctrlKey,alt:e.altKey,shift:e.shiftKey,meta:e.metaKey},state:this.captureState(t)})}logSelection(e){this.addAction({type:"selection",name:"selection_change",timestamp:Date.now(),details:{},state:this.captureState(e)})}logInput(e,t,n){this.addAction({type:"input",name:e,timestamp:Date.now(),details:{data:t},state:this.captureState(n)})}addAction(e){this.session.actions.push(e),this.session.actions.length>this.maxActions&&this.session.actions.shift(),this.isDevelopment}getSession(){return this.session}clearSession(){this.session=this.createNewSession()}exportSession(){return JSON.stringify(this.session,null,2)}downloadSession(){const e=new Blob([this.exportSession()],{type:"application/json"}),t=URL.createObjectURL(e),n=document.createElement("a");n.href=t,n.download=`editor_session_${this.session.id}.json`,document.body.appendChild(n),n.click(),document.body.removeChild(n),URL.revokeObjectURL(t)}exportSessionWithPrompt(e){const t={message:e||"here is a debug log, can you analyze and fix accordingly?",session:this.session};return JSON.stringify(t,null,2)}};function nf(e){const t=document.createElement("div");t.innerHTML=e;const n=[],o=[];return t.querySelectorAll("iframe").forEach((a,i)=>{const l=`<!--iframe-${i}-->`;n.push(a.cloneNode(!0)),o.push(l),a.replaceWith(l)}),{html:t.innerHTML,iframes:n}}function rf(e,t,n){const o=/<!--iframe-(\d+)-->/g;e.body.innerHTML=t.replace(o,(a,i)=>{const l=n[Number(i)];return l?l.outerHTML:""})}function ex(){let e=null;const t=(0,r.reactive)({content:"",doc:void 0,selection:null,selectedStyles:new Set,isFullscreen:!1,isSplitView:!1,isCodeView:!1,hasInit:!1,undoStack:[],redoStack:[],rangeCount:0,range:null,debug:void 0}),n={styles:()=>{if(!t.doc)return;const c=new Set;["bold","italic","underline","h1","h2","h3","h4","h5","h6","blockquote","p","orderedList","unorderedList","alignLeft","alignCenter","alignRight","alignJustify","textDirection","ltrDirection","rtlDirection"].forEach(u=>{t.doc&&r0(u,t.doc)&&c.add(u)}),t.selectedStyles=c},content:c=>{if(!t.doc)return;t.doc.body.innerHTML!==t.content&&(t.undoStack.push(t.content),t.redoStack=[]);const u=t.doc.getSelection(),d=u?.rangeCount?u.getRangeAt(0).cloneRange():null;if(c==="html"){const f=nf(t.content);t.doc.body.innerHTML=f.html,setTimeout(()=>{if(t.doc&&(rf(t.doc,t.content,f.iframes),d&&u))try{u.removeAllRanges(),u.addRange(d)}catch{}},0)}else t.doc.body.textContent=t.content},selection:()=>{if(!t.doc)return;const c=t.doc.getSelection();if(c)try{if(!t.doc.body.contains(c.anchorNode)){t.doc.body.focus();return}(!t.selection||t.selection!==c||t.rangeCount!==c.rangeCount||c.rangeCount>0&&t.range&&(t.range.startContainer!==c.getRangeAt(0).startContainer||t.range.startOffset!==c.getRangeAt(0).startOffset||t.range.endContainer!==c.getRangeAt(0).endContainer||t.range.endOffset!==c.getRangeAt(0).endOffset))&&(t.selection=c,t.rangeCount=c.rangeCount,c.rangeCount>0&&(t.range=c.getRangeAt(0).cloneRange()),n.styles())}catch{t.selection=null,t.range=null,t.rangeCount=0,t.selectedStyles=new Set}}},o={undo:()=>{if(t.undoStack.length===0)return;t.redoStack.push(t.content);const c=t.undoStack.pop();c!==void 0&&(t.content=c,n.content("html"))},redo:()=>{if(t.redoStack.length===0)return;t.undoStack.push(t.content);const c=t.redoStack.pop();c!==void 0&&(t.content=c,n.content("html"))}},a={emptyTags:c=>{const u=c.createTreeWalker(c.body,NodeFilter.SHOW_ELEMENT,null),d=[];let f=u.nextNode();for(;f;){if(["br","img","hr","input"].includes(f.tagName.toLowerCase())){f=u.nextNode();continue}const m=f.textContent?.trim()||"",p=f.innerHTML.trim(),h=p==="<br>"||p==="<br/>",v=p==="&nbsp;"||m===" ",b=!m&&!p,g=f.parentElement===c.body;(b||v||h&&!g)&&d.push(f),f=u.nextNode()}d.forEach(m=>{m.remove()})},normalizeContent:c=>{const u=c.createTreeWalker(c.body,NodeFilter.SHOW_TEXT),d=[];let f;for(;f=u.nextNode();)f.parentElement===c.body&&f.textContent?.trim()&&d.push(f);d.forEach(m=>{const p=c.createElement("p");p.dir=c.body.dir,p.appendChild(m.cloneNode()),c.body.replaceChild(p,m)})}};function i(c){e&&(e(),e=null);let u=!1;const d={input:()=>{if(u)return;u=!0;const f=c.body.innerHTML;f!==t.content&&(t.content=f),u=!1},selectionchange:()=>{u||n.selection()},mouseup:()=>{u||n.selection()},keyup:f=>{u||["ArrowUp","ArrowDown","ArrowLeft","ArrowRight"].includes(f.key)&&n.selection()}};return Object.entries(d).forEach(([f,m])=>{c.addEventListener(f,m)}),e=()=>{Object.entries(d).forEach(([f,m])=>{c.removeEventListener(f,m)})},e}function l(c){if(t.hasInit&&e&&(e(),e=null),t.doc=c,t.hasInit=!0,c.editorState=t,t.content&&t.content.trim()&&!t.content.match(/^<p(?:\s[^>]*)?>(?:<br\s*\/?>)?\s*<\/p>$/i)){const u=nf(t.content);c.body.innerHTML=u.html,setTimeout(()=>{t.doc&&rf(c,t.content,u.iframes)},0)}if(a.normalizeContent(c),c.body.firstElementChild){const u=c.createRange(),d=c.getSelection();d&&(u.selectNodeContents(c.body),u.collapse(!1),d.removeAllRanges(),d.addRange(u),t.range=u.cloneRange(),t.selection=d,t.rangeCount=d.rangeCount)}else{const u=c.getSelection();if(u){const d=c.createRange();d.setStart(c.body,0),d.setEnd(c.body,0),u.removeAllRanges(),u.addRange(d),t.range=d.cloneRange(),t.selection=u,t.rangeCount=u.rangeCount}}e=i(c)}function s(){if(!t.debug){const c=new Q3;t.debug={debugger:c,logCommand:(u,d)=>{c.logCommand(u,d,t)},getSession:()=>c.getSession(),clearSession:()=>{c.clearSession()},downloadSession:()=>{c.downloadSession()},exportDebugWithPrompt:u=>c.exportSessionWithPrompt(u)}}}return typeof window<"u"&&window.addEventListener("beforeunload",()=>{e&&e()}),{state:t,init:l,updateState:n,history:o,initDebugger:s,cleanup:()=>{e&&(e(),e=null)}}}var tx=[{key:"b",command:"bold"},{key:"i",command:"italic"},{key:"u",command:"underline"},{key:"k",command:"link"},{key:"z",command:"undo"},{key:"z",modifiers:{shift:!0},command:"redo"},{key:"y",command:"redo"},{key:".",modifiers:{shift:!0},command:"orderedList"},{key:"/",modifiers:{shift:!0},command:"unorderedList"},{key:"]",command:"indent"},{key:"[",command:"outdent"},...Array.from({length:6},(e,t)=>({key:String(t+1),modifiers:{alt:!0},command:`h${t+1}`}))];function nx(e,t){e.addEventListener("keydown",n=>{if(!n.ctrlKey&&!n.metaKey)return;const o=tx.find(a=>{const i=a.key===n.key,l=!a.modifiers||(!a.modifiers.ctrl||n.ctrlKey||n.metaKey)&&(!a.modifiers.alt||n.altKey)&&(!a.modifiers.shift||n.shiftKey);return i&&l});o&&(n.preventDefault(),t.execute(o.command))})}var rx={key:0},ox={key:1,class:"flex pt-05"},ax={class:"inline-toolbar-content"},ix={class:"menu-header"},lx={class:"px-025"},sx={key:3,class:"context-menu-separator"},cx={class:"flex gap-05 align-items-end"},ux={class:"flex gap-1"},dx={class:"flex gap-05 w-100"},fx={class:"flex gap-1"},mx={class:"flex gap-05 w-100"},px={class:"grid gap-0"},hx={key:0,class:"flex gap-025 opacity-5 -mt-05"},gx={key:1,class:"grid grid-wrap-2 gap-05"},vx={class:"grid grid-wrap-2 gap-05 py-1"},yx={class:"overflow-hidden flex justify-content-center"},bx={class:"flex gap-05 w-100"},_x={class:"grid grid-wrap-4 m_grid-wrap-2 gap-col-1 table-editor testMe1"},wx={class:"grid-span-1"},$x={class:"flex gap-025 mt-025 radius-1 p-05 w-fit",style:{height:"var(--bgl-input-height)",background:"var(--bgl-input-bg)"}},Ex={class:"grid-span-1"},kx={class:"flex gap-025 mt-025 radius-1 p-025 w-fit",style:{height:"var(--bgl-input-height)",background:"var(--bgl-input-bg)"}},Cx={key:0,class:"grid-span-4 m_grid-span-2 grid-wrap-4 m_grid-wrap-2 grid gap-col-1 border-bottom pb-05 mb-05"},Sx={key:1,class:"grid grid-wrap-4 m_grid-wrap-2 gap-col-1 grid-span-4 m_grid-span-2 border-bottom pb-05 mb-05"},xx=["innerHTML"],Tx=(0,r.defineComponent)({inheritAttrs:!1,__name:"index",props:{modelValue:{},toolbarConfig:{},debug:{type:Boolean},label:{},height:{},basic:{type:Boolean},simple:{type:Boolean},placeholder:{},hideToolbar:{type:Boolean},hideInlineToolbar:{type:Boolean},hideImages:{type:Boolean},hideVideos:{type:Boolean},hideEmbed:{type:Boolean},hideTables:{type:Boolean},hideAlignment:{type:Boolean},hideDirections:{type:Boolean},hideH5H6:{type:Boolean},hide:{},autofocus:{type:Boolean},textColor:{},fontSize:{},frame:{type:Boolean},outline:{type:Boolean},minWidth:{},maxWidth:{},labelColor:{},labelActiveColor:{}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const o=e,a=n,{shellClass:i,shellStyle:l}=lt(o),s=(0,r.computed)(()=>!!o.modelValue?.trim()),c=(0,r.useAttrs)(),u=(0,r.ref)(),d=ex(),f=(0,r.ref)(!1),m=(0,r.ref)(!1),p=Z3(d.state,d.state.debug),h=(0,r.ref)(0),v=(0,r.computed)(()=>(h.value,typeof document<"u"&&getComputedStyle(document.documentElement).getPropertyValue("--bgl-input-color").trim()||"#000")),b=(0,r.computed)(()=>{const M=v.value;return o.textColor||(M&&M.length>0&&M!=="#000"?M:"inherit")}),g=(0,r.computed)(()=>(h.value,typeof document<"u"&&getComputedStyle(document.documentElement).getPropertyValue("--bgl-font").trim()||"sans-serif"));let y=null;(0,r.onMounted)(()=>{typeof document<"u"&&(y=new MutationObserver(M=>{let C=!1;M.forEach(S=>{if(S.type==="attributes"){const{attributeName:ne}=S;(ne==="data-theme"||ne==="class"||ne==="style")&&(C=!0)}}),C&&(h.value++,m.value&&setTimeout(()=>{zl()},50))}),y.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme","class","style"]}),document.body&&y.observe(document.body,{attributes:!0,attributeFilter:["class","data-theme"]}))}),(0,r.onBeforeUnmount)(()=>{y?.disconnect()}),o.debug&&typeof window<"u"&&(window.forceRichTextUpdate=()=>{h.value++},window.debugRichText=_e);const _=(0,r.computed)(()=>!(o.hideToolbar||o.basic)),w=(0,r.computed)(()=>!o.hideInlineToolbar),$=(0,r.computed)(()=>o.toolbarConfig),N=(0,r.computed)(()=>{const M=[...o.hide||[]];return o.simple&&["h1","h2","h3","h4","h5","h6","image","video","embed","ul","ol","blockquote","direction","table","alignment"].forEach(C=>{M.includes(C)||M.push(C)}),M}),k=(0,r.ref)(!1),E=(0,r.ref)({url:"",openInNewTab:!0}),I=(0,r.ref)(!1),D=(0,r.ref)({message:"",x:0,y:0});let V=null;const x=(0,r.ref)(!1),T=(0,r.ref)({src:"",alt:"",width:"",height:"",credit:"",figcaption:!1});let L=null;const F=(0,r.ref)(!1),O=(0,r.ref)({src:"",width:"560",height:"315",alt:""});let B=null;const j=(0,r.ref)(!1),te=(0,r.ref)({top:0,left:0}),Q=(0,r.ref)(null),ie=(0,r.ref)(!1),R=(0,r.ref)({src:"",width:"",autoplay:!1,mute:!1,controls:!0,loop:!1,aspectRatio:"16:9",customWidth:"",customHeight:"",caption:"",showCaption:!1});let P=null;const U=(0,r.ref)(!1),A=(0,r.ref)({rows:3,cols:3,width:100,borderWidth:1,borderColor:"#dddddd",cellPadding:8,showHeaders:!0,headerBgColor:"#f4f4f4",headerTextColor:"#333333",cellBgColor:"#ffffff",cellTextColor:"#333333",alternateRows:!1,alternateRowBgColor:"#f9f9f9",alternateRowTextColor:"#333333",fixedLayout:!0,alignment:"left",direction:"ltr"}),W=(0,r.ref)(!1),q=(0,r.ref)({x:0,y:0}),X=(0,r.ref)(null);let ae=null;const be=(0,r.computed)(()=>{const M=A.value;let C=`<table style="${`
32
32
  width: ${M.width}%;
33
33
  border-collapse: collapse;
34
34
  margin-bottom: 1rem;
@@ -427,7 +427,7 @@ ${t.preList[o]}
427
427
 
428
428
  `}return o});H.subParser("makeMarkdown.paragraph",(e,t)=>{let n="";if(e.hasChildNodes()){let o=e.childNodes,a=o.length;for(let i=0;i<a;++i)n+=H.subParser("makeMarkdown.node")(o[i],t)}return n=n.trim(),n});H.subParser("makeMarkdown.pre",(e,t)=>{let n=e.getAttribute("prenum");return`<pre>${t.preList[n]}</pre>`});H.subParser("makeMarkdown.strikethrough",(e,t)=>{let n="";if(e.hasChildNodes()){n+="~~";let o=e.childNodes,a=o.length;for(let i=0;i<a;++i)n+=H.subParser("makeMarkdown.node")(o[i],t);n+="~~"}return n});H.subParser("makeMarkdown.strong",(e,t)=>{let n="";if(e.hasChildNodes()){n+="**";let o=e.childNodes,a=o.length;for(let i=0;i<a;++i)n+=H.subParser("makeMarkdown.node")(o[i],t);n+="**"}return n});H.subParser("makeMarkdown.table",(e,t)=>{let n="",o=[[],[]],a=e.querySelectorAll("thead>tr>th"),i=e.querySelectorAll("tbody>tr");for(let s=0;s<a.length;++s){let c=H.subParser("makeMarkdown.tableCell")(a[s],t),u="---";if(a[s].hasAttribute("style"))switch(a[s].getAttribute("style").toLowerCase().replace(/\s/g,"")){case"text-align:left;":u=":---";break;case"text-align:right;":u="---:";break;case"text-align:center;":u=":---:";break}o[0][s]=c.trim(),o[1][s]=u}for(let s=0;s<i.length;++s){let c=o.push([])-1,u=i[s].getElementsByTagName("td");for(let d=0;d<a.length;++d){let f=" ";typeof u[d]<"u"&&(f=H.subParser("makeMarkdown.tableCell")(u[d],t)),o[c].push(f)}}let l=3;for(let s=0;s<o.length;++s)for(let c=0;c<o[s].length;++c){let u=o[s][c].length;u>l&&(l=u)}for(let s=0;s<o.length;++s){for(let c=0;c<o[s].length;++c)s===1?o[s][c].slice(-1)===":"?o[s][c]=`${H.helper.padEnd(o[s][c].slice(-1),l-1,"-")}:`:o[s][c]=H.helper.padEnd(o[s][c],l,"-"):o[s][c]=H.helper.padEnd(o[s][c],l);n+=`| ${o[s].join(" | ")} |
429
429
  `}return n.trim()});H.subParser("makeMarkdown.tableCell",(e,t)=>{let n="";if(!e.hasChildNodes())return"";let o=e.childNodes,a=o.length;for(let i=0;i<a;++i)n+=H.subParser("makeMarkdown.node")(o[i],t,!0);return n.trim()});H.subParser("makeMarkdown.txt",e=>{let t=e.nodeValue;return t=t.replace(/ +/g," "),t=t.replace(/¨NBSP;/g," "),t=H.helper.unescapeHTMLEntities(t),t=t.replace(/([*_~|`])/g,"\\$1"),t=t.replace(/^(\s*)>/g,"\\$1>"),t=t.replace(/^#/gm,"\\#"),t=t.replace(/^(\s*)([-=]{3,})(\s*)$/,"$1\\$2$3"),t=t.replace(/^( {0,3}\d+)\./gm,"$1\\."),t=t.replace(/^( {0,3})([+-])/gm,"$1\\$2"),t=t.replace(/\](\s*)\(/g,"\\]$1\\("),t=t.replace(/^ {0,3}\[([\S \t]*?)\]:/gm,"\\[$1]:"),t});function nI(){try{const{locale:e}=$r().global;return typeof e=="string"?e:e.value}catch{return typeof navigator>"u"?"en-US":navigator.languages&&navigator.languages.length?navigator.languages[0]:navigator.language}}function oi(e){if(e instanceof Date)return e;if(typeof e=="number")return new Date(e);let t=e.trim().replace(" ","T");return!t.endsWith("Z")&&!t.includes("+")&&!/[+-]\d{2}:\d{2}$/.test(t)&&(t+="Z"),new Date(t)}const rI=Object.assign(oi,{iso(e){return oi(e).toISOString()},date(e){return oi(e).toISOString().slice(0,10)},ms(e){return oi(e).getTime()}});function Pg(e){const t=-e.getTimezoneOffset();return`${t>=0?"+":"-"}${String(Math.floor(Math.abs(t)/60)).padStart(2,"0")}:${String(Math.abs(t)%60).padStart(2,"0")}`}function oI(e){return`${e.getFullYear()}-${String(e.getMonth()+1).padStart(2,"0")}-${String(e.getDate()).padStart(2,"0")}T${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}:${String(e.getSeconds()).padStart(2,"0")}.${String(e.getMilliseconds()).padStart(3,"0")}${Pg(e)}`}const aI={iso(e=new Date){return oI(e)},offset(e=new Date){return Pg(e)}},Io={SECOND:1e3,MINUTE:6e4,HOUR:36e5,DAY:864e5,WEEK:6048e5},{SECOND:iI}=Io,{MINUTE:lI}=Io,{HOUR:sI}=Io,{DAY:cI}=Io,{WEEK:uI}=Io;function dn(e,t){const n=new Date(e);return t.days&&n.setDate(n.getDate()+t.days),t.hours&&n.setHours(n.getHours()+t.hours),t.minutes&&n.setMinutes(n.getMinutes()+t.minutes),t.seconds&&n.setSeconds(n.getSeconds()+t.seconds),t.weeks&&n.setDate(n.getDate()+t.weeks*7),t.months&&n.setMonth(n.getMonth()+t.months),t.years&&n.setFullYear(n.getFullYear()+t.years),n}var dI={seconds:1e3,minutes:6e4,hours:36e5,days:864e5,weeks:6048e5,months:0};function Fu(e,t,n="days"){const o=new Date(e),a=new Date(t);return n==="months"?(a.getFullYear()-o.getFullYear())*12+(a.getMonth()-o.getMonth()):Math.floor((a.getTime()-o.getTime())/dI[n])}var yt=class Bc{_date;constructor(t){this._date=new Date(t)}add(t,n="days"){return new Bc(dn(this._date,{[n]:t}))}subtract(t,n="days"){return new Bc(dn(this._date,{[n]:-t}))}diff(t,n="days"){return Fu(this._date,t,n)}isBefore(t){return this._date.getTime()<new Date(t).getTime()}isAfter(t){return this._date.getTime()>new Date(t).getTime()}isSameDay(t){const n=new Date(t);return this._date.getFullYear()===n.getFullYear()&&this._date.getMonth()===n.getMonth()&&this._date.getDate()===n.getDate()}toDate(){return new Date(this._date)}valueOf(){return this._date.getTime()}toString(){return this._date.toISOString()}};function fI(e){return new yt(e!==void 0?e:new Date)}const mI=Object.assign(fI,{get now(){return new yt(new Date)},get today(){const e=new Date;return e.setHours(0,0,0,0),new yt(e)},get tomorrow(){return new yt(dn(new Date,{days:1}))},get yesterday(){return new yt(dn(new Date,{days:-1}))},get nextWeek(){return new yt(dn(new Date,{weeks:1}))},get lastWeek(){return new yt(dn(new Date,{weeks:-1}))},get firstOfMonth(){const e=new Date;return new yt(new Date(e.getFullYear(),e.getMonth(),1))},get lastOfMonth(){const e=new Date;return new yt(new Date(e.getFullYear(),e.getMonth()+1,0))},get firstOfWeek(){const e=new Date;return new yt(new Date(e.setDate(e.getDate()-e.getDay())))},get lastOfWeek(){const e=new Date;return new yt(new Date(e.setDate(e.getDate()+(6-e.getDay()))))},get firstOfNextMonth(){const e=new Date;return new yt(new Date(e.getFullYear(),e.getMonth()+1,1))},get lastOfNextMonth(){const e=new Date;return new yt(new Date(e.getFullYear(),e.getMonth()+2,0))},get firstOfNextYear(){return new yt(new Date(new Date().getFullYear()+1,0,1))},in:(e,t="days")=>new yt(dn(new Date,{[t]:e})),ago:(e,t="days")=>new yt(dn(new Date,{[t]:-e})),diff:(e,t,n="days")=>Fu(e,t,n),isBefore:(e,t)=>new Date(e).getTime()<new Date(t).getTime(),isAfter:(e,t)=>new Date(e).getTime()>new Date(t).getTime(),isSameDay:(e,t)=>{const n=new Date(e),o=new Date(t);return n.getFullYear()===o.getFullYear()&&n.getMonth()===o.getMonth()&&n.getDate()===o.getDate()}});function Ig(e,t){if(t.timeZone==="UTC"){const n=new Date(e.getTime());return n.setMinutes(n.getMinutes()+e.getTimezoneOffset()),n}try{const n=new Intl.DateTimeFormat("en-US",{...t,month:"numeric"}).formatToParts(e),o={};for(const a of n)a.type!=="literal"&&a.type!=="timeZoneName"&&(o[a.type]=Number.parseInt(a.value,10));return new Date(o.year,(o.month||1)-1,o.day,o.hour||0,o.minute||0,o.second||0)}catch{return e}}function zu(e,t,n){const o=n?.timeZone?Ig(e,n):e,a=o.getFullYear().toString();return{AmPm:o.toLocaleString(t,{hour:"numeric",hour12:!0,minute:"numeric"}).split(" ")[1],DD:String(o.getDate()).padStart(2,"0"),DDD:o.toLocaleString(t,{weekday:"short"}),DDDD:o.toLocaleString(t,{weekday:"long"}),HH:String(o.getHours()).padStart(2,"0"),mm:String(o.getMinutes()).padStart(2,"0"),MM:String(o.getMonth()+1).padStart(2,"0"),MMM:o.toLocaleString(t,{month:"short"}),MMMM:o.toLocaleString(t,{month:"long"}),ss:String(o.getSeconds()).padStart(2,"0"),sss:String(o.getMilliseconds()).padStart(3,"0"),YY:a.slice(-2),YYYY:a}}var pI=zu(new Date,"en-US"),hI=Object.keys(pI).sort((e,t)=>t.length-e.length),gI=new RegExp(hI.join("|"),"g");function it(e,t){if(!e)return"";let n,o,a,i={};if(typeof t=="string"?n=t:t&&typeof t=="object"&&(n=t.format,o=t.locale,a=t.tz,i=t),n==="ISO"||n==="ISO8601"){const l=new Date(e);return Number.isNaN(l.getTime())?"":l.toISOString()}n=n||"DD.MM.YY",o=o||nI();try{let l=new Date(e);if(typeof e=="string"&&Number.isNaN(l.getTime())){const f=e.split(/[/.-]/);if(f.length===3){const[m,p,h]=f.map(v=>Number.parseInt(v,10));if(!Number.isNaN(m)&&!Number.isNaN(p)&&!Number.isNaN(h)){const v=h<100?2e3+h:h;l=new Date(v,p-1,m)}}}if(Number.isNaN(l.getTime()))return"";const s={day:"numeric",hour:"2-digit",hour12:i.hour12===void 0?!0:i.hour12,minute:"2-digit",month:"long",second:"2-digit",timeZone:a,weekday:"long",year:"numeric"},c=zu(l,o,s),u=new Intl.DateTimeFormat(o,s).formatToParts(l),d={};for(const f of u)f.type!=="literal"&&(d[f.type]=f.value);return d.month&&(c.MMM=d.month.substring(0,3),c.MMMM=d.month),d.weekday&&(c.DDD=new Intl.DateTimeFormat(o,{weekday:"short",timeZone:a}).format(l),c.DDDD=d.weekday),d.dayPeriod&&(c.AmPm=d.dayPeriod),n.replace(gI,f=>c[f])}catch{return""}}const vI=it;function Ci(e,t){if(!t)return{matches:!0,score:0};const n=e.toLowerCase(),o=t.toLowerCase();if(n.includes(o))return{matches:!0,score:1e3};const a=o.split(/\s+/).filter(f=>f.length>0),i=n.split(/\s+/);let l=0;for(const f of a)i.some(m=>m.includes(f))&&l++;if(l===a.length)return{matches:!0,score:100+l*10};let s=0,c=0,u=0,d=0;for(let f=0;f<n.length&&s<o.length;f++)n[f]===o[s]?(s++,c++,d++,u=Math.max(u,c)):c=0;return s===o.length?{matches:!0,score:u*5+d}:{matches:!1,score:0}}function yI(...e){return e.filter(Boolean).join(", ")}function bI(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{const t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function _I(e){const t=e;return t.label??t.name??t.title??String(t.id??"")}function wI(e){const t=e;return t.value??t.key??t.id??""}function $I(e){if(Array.isArray(e))return e.map(n=>({...n,label:_I(n),value:wI(n)}));const t=e;return n=>n.map(o=>({...o,label:typeof t.label=="function"?t.label(o):String(o[t.label]??""),value:o[t.value]}))}function EI(e){return Array.isArray(e)?e:"data"in e?e.data:"items"in e?e.items:[]}function kI(e,t,n){const o=n?.timeout??1e4,a=e.length>0;let i=null;async function l(c){const u=a?e(c??""):e();return t(EI(await Promise.race([u,new Promise((d,f)=>setTimeout(()=>{f(new Error("Request timeout"))},o))])))}const s=async c=>{try{return a?await l(c):(i||(i=await l()),c?i.filter(u=>{const{label:d}=u;return typeof d!="string"?!0:Ci(d,c).matches}).sort((u,d)=>{const f=u.label??"";return Ci(d.label??"",c).score-Ci(f,c).score}):i)}catch{return[]}};return s.clearCache=()=>{i=null},s}function Mc(e,t){return t==="titleCase"?e.split("_").map(n=>n[0].toUpperCase()+n.slice(1).toLocaleLowerCase()).join(" "):t==="pascal"?e.split("_").map(n=>n[0].toUpperCase()+n.slice(1).toLocaleLowerCase()).join(""):t==="camel"?e.split("_").map((n,o)=>o===0?n:n[0].toUpperCase()+n.slice(1)).join(""):t==="snake"?[...e].map(n=>n===n.toUpperCase()?`_${n.toLowerCase()}`:n).join(""):e}var Cs=new Map;function CI(e,t=500){clearTimeout(Cs.get(e));const n=setTimeout(()=>{e(),Cs.delete(e)},t);Cs.set(e,n)}function SI(e){return e.toLowerCase().replace(/[^a-z0-9-\s]/g,"").split(/[\s-]+/).join("-")}function Ha(e){return e===void 0?e:e.split("_").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ")||e}async function Vg(e,t){await navigator.clipboard.writeText(e),t&&t("Copied to clipboard")}function Og(...e){return e=e.flatMap(t=>t.split(/\s/)),e.map(t=>t.charAt(0)).join("")}function Rg(e){if(!e||typeof document>"u")return e;const t=document.createElement("template");t.innerHTML=e;const n=o=>{for(const a of Array.from(o.children)){const i=a.tagName.toLowerCase();if(["script","iframe","object","embed","link","meta","base","form"].includes(i)){a.remove();continue}for(const l of Array.from(a.attributes)){const s=l.name.toLowerCase(),c=l.value.trim().toLowerCase();(s.startsWith("on")||(s==="href"||s==="src"||s==="xlink:href")&&(c.startsWith("javascript:")||c.startsWith("data:")))&&a.removeAttribute(l.name)}n(a)}};return n(t.content),t.innerHTML}function xI(e,t){e.key==="Escape"&&t()}function Fg(e,t,...n){return n.map(o=>typeof o=="function"?o(e,t):o).join(" ")}function Lc(e,t,n){if(!e)return{};const o=["class","onClick","$el"],a=Object.entries(e).filter(([l])=>!o.includes(l)).map(([l,s])=>[l,typeof s=="function"?s(t,n):s]),i=Object.fromEntries(a);for(const l of o.slice(1))e[l]&&(i[l]=e[l]);return i}function TI(e,t){return e["v-if"]===void 0?!0:typeof e["v-if"]=="boolean"?e["v-if"]:typeof e["v-if"]=="string"?!0:typeof e["v-if"]=="function"?e["v-if"]?.(t?.[e.id],t):!0}function NI(e,t){if(t)return e?e[t]:void 0}const Pc=e=>!Number.isNaN(Date.parse(e));function zg(e,t){const n=Array.from(new Set((e??[]).flatMap(Object.keys))).map(o=>({id:o,label:Ha(o),transform:a=>["created_at","updated_at"].includes(o)?a&&new Date(a).toLocaleString():a}));return t?n.filter(o=>t.includes(o.id)||!o.id):n}function Uu(e=100){return new Promise(t=>setTimeout(t,e))}var jo=new Map;async function Wa(e,t){const n=t?.id||e;if(await Uu(1),jo.has(n)){const a=jo.get(n);if(a)return a}if(t?.id&&document.getElementById(t.id)||document.querySelector(`script[src="${e}"]`))return Promise.resolve();const o=new Promise((a,i)=>{const l=document.createElement("script");l.src=e,t?.id&&(l.id=t.id),l.onload=()=>{a(),jo.delete(n)},l.onerror=s=>{i(new Error(String(s))),jo.delete(n)},document.head.append(l)});return jo.set(n,o),o}async function Ji(e,{timeout:t=1e4,interval:n=50}={}){const o=Date.now();for(;window[e]===void 0;){if(Date.now()-o>t)throw new Error(`awaitGlobal: window.${e} not available after ${t}ms`);await Uu(n)}return window[e]}function Ic(e){return new Promise((t,n)=>{if(document.querySelector(`link[href="${e}"]`)){t();return}const o=document.createElement("link");o.href=e,o.rel="stylesheet",o.onload=()=>{t()},o.onerror=n,document.head.append(o)})}function Hu(e){return e.startsWith("https://")?e:(e=e.replace(/http:\/\//,""),`https://${e}`)}function cn(e,t="px"){return typeof e=="number"?`${e}${t}`:e}var DI=/^https?:\/\/|^\/\//;function fn(e){if(!(e==null||e===""))return DI.test(e)||e.startsWith("/")?e:e.startsWith("static/")||e.startsWith("images/")?`/${e}`:`https://files.bagel.design/${e}`}function la(e,t,n=void 0){if(!t)return e;const o=t.split(/[.[]/);let a=e;for(const i of o){if(!a||typeof a!="object"||!(i in a))return n;a=a[i]}return a??n}var AI=e=>e.replace(/http:\/\//,"//");function Ug(e,t){try{return e()}catch(n){t&&t(n)}}function Wu(e,t){if(typeof document>"u")return;const n=document.createElement("a");n.target="_blank",n.rel="noopener noreferrer";const o=t!==void 0&&t!=="";if(typeof e=="string"){n.href=AI(e);const a=e.split("/").pop();n.download=o?t:a!==void 0&&a!==""?a:"download"}else{const a=URL.createObjectURL(e);n.href=a,n.download=o?t:"download",setTimeout(()=>Ug(()=>{URL.revokeObjectURL(a)}),0)}document.body.appendChild(n),n.click(),document.body.removeChild(n)}var BI=e=>Object.keys(e),Fm=e=>e?.split(" ").map(t=>t.charAt(0).toUpperCase()+t.slice(1)).join(" ");function zm(e,t){return t?e.map(n=>{const o={};return t.forEach(a=>{const{id:i,transform:l,label:s}=a;if(i){const c=la(n,i),u=s||i;o[u]=l?.(c,n)||c||""}}),o}):e}function MI(e){const t=new Set;return e.forEach(n=>{Object.keys(n).forEach(o=>t.add(o))}),Array.from(t).map(n=>({id:n,label:n}))}function LI(){const e=(0,r.ref)(!1);async function t(){return e.value||(await Wa("https://cdn.jsdelivr.net/npm/xlsx/dist/xlsx.full.min.js"),e.value=!0),window.XLSX}async function n(f,m="data",p){const h=(0,r.toValue)(p)||MI(f),v=await t(),b=zm(f,h),g=h.length>0?h.map(w=>{const{id:$,label:N}=w;return{v:N||$,t:"s"}}):[],y=v.utils.json_to_sheet(b);g.length>0&&v.utils.sheet_add_aoa(y,[g.map(w=>w.v)],{origin:"A1"});const _=v.utils.book_new();v.utils.book_append_sheet(_,y,"Sheet1"),m=m.endsWith(".xlsx")?m:`${m}.xlsx`,v.writeFile(_,m)}async function o(f,m="data",p){const h=p?p.map(y=>y.id).filter(Boolean):[...new Set(f.flatMap(BI))],v=p?p.map(y=>{const{label:_,id:w}=y;return _||Fm(w)}):h.map(Fm),b=zm(f,p),g=[v.join(","),...b.map(y=>h.map(_=>{const w=y[_]!==void 0?y[_]:"";return`"${String(w).replace(/"/g,'""')}"`}).join(","))].join(`
430
- `);m=m.endsWith(".csv")?m:`${m}.csv`,Wu(new Blob([g],{type:"text/csv;charset=utf-8"}),m)}async function a(f){const m=await t(),p=await f.arrayBuffer();return m.read(p)}async function i(f){return(await a(f)).SheetNames}async function l(f,m,p=!0){const h=await t(),v=(await a(f)).Sheets[m],b=h.utils.sheet_to_json(v,{header:1});if(b.length===0)return{headers:[],data:[]};let g=[],y=0;p?(g=b[0].map(w=>String(w||"").trim()),y=1):g=b[0].map((w,$)=>String.fromCharCode(65+$));const _=[];for(let w=y;w<b.length;w++){const $=b[w],N={};for(let k=0;k<g.length;k++)k<$.length?N[g[k]]=$[k]:N[g[k]]="";_.push(N)}return{headers:g,data:_}}async function s(f){const m=await t();return new Promise((p,h)=>{const v=new FileReader;v.onload=b=>{try{const g=new Uint8Array(b.target?.result),y=m.read(g,{type:"array"}),_=y.SheetNames[0],w=y.Sheets[_];p(m.utils.sheet_to_json(w))}catch(g){h(g)}},v.onerror=()=>{h(new Error("Failed to read file"))},v.readAsArrayBuffer(f)})}function c(f){return typeof f=="number"&&Number.isInteger(f)&&f>=2e4&&f<=5e4}function u(f){const m=new Date(Date.UTC(1899,11,30));return new Date(m.getTime()+f*(1440*60*1e3))}function d(f,m=!1){if(!(f instanceof Date)||Number.isNaN(f.getTime()))return"";const p=f.getFullYear(),h=String(f.getMonth()+1).padStart(2,"0"),v=String(f.getDate()).padStart(2,"0");return m?`${p}-${h}-${v}T${String(f.getHours()).padStart(2,"0")}:${String(f.getMinutes()).padStart(2,"0")}:${String(f.getSeconds()).padStart(2,"0")}`:`${p}-${h}-${v}`}return{downloadExcel:n,downloadCSV:o,readExcelFile:s,ensureXLSXLoaded:t,getSheetNames:i,readSheetData:l,getWorkbook:a,isExcelSerialDate:c,excelSerialDateToJSDate:u,formatDate:d}}var uo={},Um=!1,Vc=typeof window<"u";function PI(){!Vc||Um||(Um=!0,window.addEventListener("storage",e=>{e.key!==null&&e.key in uo&&(uo[e.key].value=e.newValue!==null?JSON.parse(e.newValue):null)}))}function II(e,t=null){if(!(e in uo)){const n=Vc?localStorage.getItem(e):null;uo[e]=(0,r.ref)(n!==null?JSON.parse(n):t),(0,r.watch)(uo[e],o=>{Vc&&localStorage.setItem(e,JSON.stringify(o))})}return uo[e]}function Hg(e){return PI(),new Proxy({},{get(t,n){return II(n,e?.[n]??null)}})}var Wg=1e3,VI=60*Wg;function OI(e,t={}){const{interval:n=30*Wg,inactivityThreshold:o=5*VI,pauseInBackground:a=!0}=t,{idle:i}=A_(o),l=(0,r.ref)(!0),s=(0,r.ref)(null),c=()=>!a||document.visibilityState==="visible",u=()=>{l.value=!1,s.value!==null&&(clearTimeout(s.value),s.value=null)},d=()=>{s.value!==null&&(clearTimeout(s.value),s.value=null)},f=()=>{s.value!==null&&(clearTimeout(s.value),s.value=null);const h=async()=>{if(l.value&&c()&&!i.value)try{await e()}catch{}l.value&&(s.value=window.setTimeout(h,n))};h()},m=()=>{l.value&&f()};function p(){document.visibilityState==="visible"?l.value&&f():a&&d()}return(0,r.onMounted)(()=>{document.addEventListener("visibilitychange",p),f()}),(0,r.onUnmounted)(()=>{document.removeEventListener("visibilitychange",p),u()}),{isPolling:l,pausePolling:d,resumePolling:m,startPolling:f,stopPolling:u}}function RI(e,t,n){const o={...e};return n===void 0?delete o[t]:o[t]=n,o}function FI(e){const t=(0,Ni.useRoute)(),n=(0,Ni.useRouter)(),o={};return new Proxy({},{get(a,i){if(!(i in o)){const l=e?.[i];o[i]=(0,r.computed)({get:()=>t.query[i]??l,set:s=>n.replace({query:RI(t.query,i,s)})})}return o[i]}})}function zI(e){const t=(0,r.ref)(0),n=(0,r.ref)(0);let o=null;return(0,r.onMounted)(()=>{e.value&&(o=new ResizeObserver(a=>{for(const i of a)t.value=i.contentRect.width,n.value=i.contentRect.height}),o.observe(e.value),t.value=e.value.clientWidth,n.value=e.value.clientHeight)}),(0,r.onUnmounted)(()=>{o&&(o.disconnect(),o=null)}),{width:t,height:n}}var pn=(0,r.ref)([{value:"dark",class:"bgl-dark-mode",icon:"cloudy_night",label:"Dark Mode",isDark:!0},{value:"light",class:"bgl-light-mode",icon:"brightness_7",label:"Light Mode",isDark:!1},{value:"system",class:"system",icon:"settings_input_component",label:"System Default"}]),Hm="color-mode",pr=(0,r.ref)("system"),Oc=(0,r.ref)(!1),ju=typeof window<"u";function UI(){return ju&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function HI(e){return pn.value.find(t=>t.value===e)}function Ss(e){if(!ju)return;const t=document.documentElement;if(pn.value.forEach(n=>{n.class!=="system"&&t.classList.remove(n.class)}),e==="system"){const n=UI();Oc.value=n;const o=pn.value.find(l=>l.value==="dark"),a=pn.value.find(l=>l.value==="light"),i=n?o:a;i&&t.classList.add(i.class)}else{const n=HI(e);n&&(t.classList.add(n.class),Oc.value=n.isDark??!1)}}function WI(){const e=pn.value.filter(t=>t.value!=="system");e.length!==0&&(pr.value=e[(e.findIndex(t=>t.value===pr.value)+1)%e.length].value)}function jI(e){if(!pn.value.some(t=>t.value===e.value)){const t=pn.value.findIndex(n=>n.value==="system");t>-1?pn.value.splice(t,0,e):pn.value.push(e)}}var Wm=!1;function qI(){if(Wm||!ju)return;Wm=!0;const e=window.localStorage.getItem(Hm);pn.value.some(t=>t.value===e)&&(pr.value=e),Ss(pr.value),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{pr.value==="system"&&Ss("system")}),(0,r.watch)(pr,t=>{localStorage.setItem(Hm,t),Ss(t)})}function GI(){return qI(),{isDark:Oc,theme:(0,r.computed)(()=>pr.value),themeOptions:pn,toggleTheme:WI,addTheme:jI,setTheme:e=>{pr.value=e}}}function jg(e,t,n,o){k_(e,(a,i)=>{if(t?.()?.setCustomValidity(""),!n||a===i||!a)return;const l=n(a,o?.());typeof l=="string"&&t?.()?.setCustomValidity(l)},{debounce:500})}function qg({schema:e,columns:t,data:n}={}){const o=(0,r.computed)(()=>(0,r.toValue)(e)),a=(0,r.computed)(()=>(0,r.toValue)(t));return o.value?a.value&&a.value.length>0?o.value.filter(i=>a.value?.includes(i.id)):o.value:zg(n,a.value)}const YI={s:"400px",m:"540px",l:"720px",xl:"960px",full:"100%"};var XI={key:2,class:"flex-grow-1"},KI=(0,r.defineComponent)({__name:"Dialog",props:{open:{type:Boolean},title:{},width:{default:"m"},position:{default:"center"},dismissable:{type:Boolean,default:!0},flat:{type:Boolean,default:!0},thin:{type:Boolean,default:!1},centerTitle:{type:Boolean,default:!1},ellipsisTitle:{type:Boolean,default:!1},closePlacement:{default:"header-end"}},emits:["update:open","close"],setup(e,{expose:t,emit:n}){const o=e,a=n,i=(0,r.ref)(null),l=(0,r.ref)(!1),s=(0,r.ref)(!0),c=(0,r.computed)(()=>YI[o.width]),u=(0,r.computed)(()=>o.position==="left"?"dialog-left ms-1 me-auto mt-1 mb-1 height-100-2 m_m-0 m_h-100vh m_max-h-100vh m_radius-0":o.position==="right"?"dialog-right me-1 ms-auto mt-1 mb-1 height-100-2 m_m-0 m_h-100vh m_max-h-100vh m_radius-0":o.position==="top"?"dialog-top mx-auto mt-1 mb-auto":o.position==="bottom"?"dialog-bottom mx-auto mb-1 mt-auto":"dialog-center mx-auto");(0,r.watch)(()=>o.open,v=>{v?(i.value?.showModal(),l.value=!1,s.value=!1,setTimeout(()=>{s.value=!0},250)):d()}),(0,r.onMounted)(()=>{o.open&&i.value?.showModal()});function d(){l.value||(l.value=!0)}function f(){l.value&&(i.value?.close(),l.value=!1,a("close"))}function m(v){v.target===i.value&&o.dismissable&&a("update:open",!1)}function p(v){if(!o.dismissable){v.preventDefault();return}a("update:open",!1)}function h(){s.value=!1,a("update:open",!1)}return t({close:h}),(v,b)=>((0,r.openBlock)(),(0,r.createElementBlock)("dialog",{ref_key:"dialogRef",ref:i,class:(0,r.normalizeClass)([[u.value,{"is-closing":l.value}],"border-none shadow-30 p-0 testMe1"]),style:(0,r.normalizeStyle)({"--dialog-width":c.value}),onClick:m,onCancel:p,onAnimationend:f},[(0,r.createElementVNode)("div",{class:"grid grid-dialog max-height-100-2",onClick:b[0]||(b[0]=(0,r.withModifiers)(()=>{},["stop"]))},[e.title||e.dismissable?((0,r.openBlock)(),(0,r.createElementBlock)("header",{key:0,class:(0,r.normalizeClass)(["flex space-between flex-shrink-0 align-items-start gap-05",{"border-bottom":!e.flat,"border-none":!e.title,"m_ps-1":e.title,"p-05 m_p-05":!e.title,"ps-1-5 pe-1 py-1 ":!e.thin&&e.title,"ps-1 pe-05 py-05":e.thin&&e.title}])},[e.dismissable&&e.closePlacement==="header-start"?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:0,flat:"",icon:"close","aria-label":"Close",class:"dialog-close",thin:"",onClick:h})):(0,r.createCommentVNode)("",!0),e.title?((0,r.openBlock)(),(0,r.createElementBlock)("h3",{key:1,class:(0,r.normalizeClass)(["dialog-title m-0 txt20 semi w-100p",{"txt-center balance":e.centerTitle,"word-break-all":!e.centerTitle,"ellipsis-1":e.ellipsisTitle}])},(0,r.toDisplayString)(e.title),3)):(0,r.createCommentVNode)("",!0),e.title?(0,r.createCommentVNode)("",!0):((0,r.openBlock)(),(0,r.createElementBlock)("div",XI)),e.dismissable&&e.closePlacement==="header-end"?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:3,flat:"",icon:"close","aria-label":"Close",class:"dialog-close",thin:"",onClick:h})):(0,r.createCommentVNode)("",!0)],2)):(0,r.createCommentVNode)("",!0),(0,r.createElementVNode)("div",{class:(0,r.normalizeClass)(["overflow-y flex-grow-1 m_p-1",{"px-1 py-05":e.thin,"px-1-5 py-1":!e.thin}])},[(0,r.renderSlot)(v.$slots,"default",{},void 0,!0)],2),v.$slots.footer?((0,r.openBlock)(),(0,r.createElementBlock)("footer",{key:1,class:(0,r.normalizeClass)(["flex flex-shrink-0 gap-05 m_px-05 m_py-05 justify-content-end",{"border-top":!e.flat,"px-05 py-05":e.thin,"px-1-5 py-1":!e.thin}])},[(0,r.renderSlot)(v.$slots,"footer",{},void 0,!0)],2)):(0,r.createCommentVNode)("",!0)]),e.dismissable&&e.closePlacement==="overlay-start"&&s.value?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:0,icon:"close","aria-label":"Close",class:"fixed top-1 start-1 z-999 overlay-btn",onClick:h})):(0,r.createCommentVNode)("",!0),e.dismissable&&e.closePlacement==="overlay-end"&&s.value?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:1,icon:"close","aria-label":"Close",class:"fixed top-1 end-1 z-999 overlay-btn",onClick:h})):(0,r.createCommentVNode)("",!0)],38))}}),qn=$e(KI,[["__scopeId","data-v-717532fe"]]),JI=(0,r.defineComponent)({__name:"DialogConfirm",props:{open:{type:Boolean},title:{},message:{},width:{default:"s"},position:{default:"center"},dismissable:{type:Boolean,default:!0},confirmText:{},cancelText:{},confirmColor:{default:"primary"}},emits:["update:open","resolve"],setup(e,{emit:t}){const n=e,o=t,{$t:a}=ft(),i=(0,r.computed)(()=>n.title||a("modalConfirm.title")),l=(0,r.computed)(()=>n.confirmText||a("modalConfirm.confirm")),s=(0,r.computed)(()=>n.cancelText||a("modalConfirm.cancel"));function c(){o("resolve",!0),o("update:open",!1)}function u(){o("resolve",!1),o("update:open",!1)}function d(){o("resolve",!1)}return(f,m)=>((0,r.openBlock)(),(0,r.createBlock)(qn,{open:e.open,title:i.value,width:e.width,position:e.position,dismissable:e.dismissable,"onUpdate:open":m[0]||(m[0]=p=>f.$emit("update:open",p)),onClose:d},{footer:(0,r.withCtx)(()=>[(0,r.createVNode)(re,{flat:"",onClick:u},{default:(0,r.withCtx)(()=>[(0,r.createTextVNode)((0,r.toDisplayString)(s.value),1)]),_:1}),(0,r.createVNode)(re,{color:e.confirmColor,onClick:c},{default:(0,r.withCtx)(()=>[(0,r.createTextVNode)((0,r.toDisplayString)(l.value),1)]),_:1},8,["color"])]),default:(0,r.withCtx)(()=>[(0,r.createElementVNode)("p",null,(0,r.toDisplayString)(e.message),1)]),_:1},8,["open","title","width","position","dismissable"]))}}),Gg=JI,ZI=(0,r.defineComponent)({__name:"FormFlow",props:{schema:{},modelValue:{},components:{},errors:{},onSubmit:{type:Function}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const o=e,a=n,{$t:i}=ft();function l(T,L){const F=L.split(".");let O=T;for(const B of F)O=O?.[B];return O}function s(T,L,F){const O=L.split(".");let B=T;for(let j=0;j<O.length-1;j++){const te=O[j];(B[te]==null||typeof B[te]!="object")&&(B[te]={}),B=B[te]}B[O[O.length-1]]=F}function c(T){const L={...T??{}};for(const[F,O]of Object.entries(o.schema._fields)){const B=O._config.default;B!==void 0&&l(L,F)===void 0&&s(L,F,B)}return L}const u=(0,r.ref)(c(o.modelValue)),d=(0,r.ref)({}),f=(0,r.ref)(!1),m=(0,r.ref)("idle"),p=(0,r.ref)();let h=!1;(0,r.watch)(()=>o.modelValue,T=>{h||(u.value=c(T))},{deep:!0}),(0,r.watch)(u,T=>{h=!0,a("update:modelValue",T),(0,r.nextTick)(()=>{h=!1})},{deep:!0});function v(T){return T._condition==null?!0:m2(T._condition,u.value)}const b=(0,r.computed)(()=>{const T=[];for(const[L,F]of Object.entries(o.schema._fields))v(F)&&T.push({key:L,field:F});return T});function g(T,L,F){s(u.value,T,L),(m.value==="success"||m.value==="error")&&(m.value="idle"),f.value&&_(T,F)}function y(T,L){return T==null||T===""||Array.isArray(T)&&T.length===0||L._type==="tel"&&typeof T=="string"&&/^\+\d+$/.test(T)}function _(T,L){const F=w(T);if(L._config.required===!0&&y(F,L))return d.value={...d.value,[T]:L._config.requiredMessage??i("form.required")},!1;if(L._type==="email"&&F&&!Nr.test(F))return d.value={...d.value,[T]:i("form.invalidEmail")},!1;if(L._validations!=null)for(const O of L._validations){const B=O(F);if(B!==!0)return d.value={...d.value,[T]:B},!1}return d.value=Object.fromEntries(Object.entries(d.value).filter(([O])=>O!==T)),!0}function w(T){return l(u.value,T)}function $(T,L){return L._config.label!=null?L._config.label:T.split(/[._-]/).map(F=>F.charAt(0).toUpperCase()+F.slice(1)).join(" ")}function N(T){if(typeof T!="string"&&(T._type==="select"||T._type==="multiselect")&&T._config.display==="btn")return o0;const L=typeof T=="string"?T:T._type;return{text:Fe,email:tu,password:Nh,number:Nn,tel:_u,url:Fe,date:pa,time:Fe,datetime:pa,textarea:Fe,richtext:fu,json:eu,checkbox:St,toggle:$l,radio:Ah,select:Ut,multiselect:Ut,array:ro,upload:ga,color:xn,range:ru}[L]??Fe}const k=(0,r.computed)(()=>{const T={...d.value,...o.errors||{}},L={};for(const[F,O]of Object.entries(T))L[F]=Ee(O)??O;return L});function E(T,L){const F={label:$(L,T),modelValue:w(L),"onUpdate:modelValue":O=>{g(L,O,T)},error:k.value[L],...T._config,name:T._config.name??L};if(T._type==="textarea"&&(F.multiline=!0),T._type==="multiselect"&&(F.multiselect=!0),T._type==="json"&&(F.language=F.language??"json"),T._type==="array"){const O=Object.fromEntries(Object.entries(T._config).filter(([B])=>B!=="schema"&&B!=="itemType"));Object.assign(F,O),F.allowAdd=F.allowAdd??!0,F.allowDelete=F.allowDelete??!0}return F}function I(T){return typeof T=="string"&&o.components?.[T]!=null?o.components[T]:T}function D(T){return T._component!=null}function V(){let T=!0;const L={};for(const{key:F,field:O}of b.value){const B=w(F);if(O._config.required===!0&&y(B,O)){L[F]=O._config.requiredMessage??i("form.required"),T=!1;continue}if(O._type==="email"&&B&&!Nr.test(B)){L[F]=i("form.invalidEmail"),T=!1;continue}if(O._validations!=null)for(const j of O._validations){const te=j(B);if(te!==!0){L[F]=te,T=!1;break}}}return d.value=L,T}async function x(T){T&&T.preventDefault(),f.value=!0;const L=V();if(L){if(o.onSubmit){m.value="submitting";try{await o.onSubmit(u.value),m.value="success"}catch{m.value="error"}}}else{T?.stopPropagation();const F=b.value.find(({key:O})=>d.value[O])?.key;if(F!=null&&p.value){const O=p.value.querySelector(`[name="${F}"]`)||p.value.querySelector(`[id="${F}"]`)||p.value.querySelector(`[data-field="${F}"]`)||p.value.querySelector("input, select, textarea");O&&(O.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(()=>{O instanceof HTMLElement&&O.focus()},300))}}return L}return t({validate:V,submit:x,formState:m}),(T,L)=>{const F=(0,r.resolveComponent)("FormFlow",!0);return(0,r.openBlock)(),(0,r.createElementBlock)("form",{ref_key:"formElement",ref:p,class:(0,r.normalizeClass)(["grid-form",e.schema._class]),onSubmit:x},[m.value==="success"?(0,r.renderSlot)(T.$slots,"success",{key:0,formData:u.value}):((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:1},[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(b.value,({key:O,field:B})=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:O,class:(0,r.normalizeClass)([B._class,B._config.class])},[(0,r.renderSlot)(T.$slots,`field:${O}`,{value:w(O),field:B,formData:u.value,error:d.value[O],onChange:j=>{g(O,j,B)}},()=>[B._type==="array"&&B._config.schema?._isSchema?((0,r.openBlock)(),(0,r.createBlock)(ro,(0,r.mergeProps)({key:0,ref_for:!0},E(B,O)),{default:(0,r.withCtx)(({item:j})=>[(0,r.createVNode)(F,{"model-value":j.value,schema:B._config.schema,components:e.components,"onUpdate:modelValue":te=>{j.value=te}},null,8,["model-value","schema","components","onUpdate:modelValue"])]),_:2},1040)):B._type==="array"&&typeof B._config.schema=="string"?((0,r.openBlock)(),(0,r.createBlock)(ro,(0,r.mergeProps)({key:1,ref_for:!0},E(B,O)),{default:(0,r.withCtx)(({item:j})=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(N(B._config.schema)),{"model-value":j.value,"onUpdate:modelValue":te=>{j.value=te}},null,8,["model-value","onUpdate:modelValue"]))]),_:2},1040)):B._type==="array"&&B._config.schema?((0,r.openBlock)(),(0,r.createBlock)(ro,(0,r.mergeProps)({key:2,ref_for:!0},E(B,O)),{default:(0,r.withCtx)(({item:j})=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(I(B._config.schema)),{modelValue:j.value,"onUpdate:modelValue":te=>j.value=te},null,8,["modelValue","onUpdate:modelValue"]))]),_:2},1040)):B._type==="array"&&B._config.itemType?((0,r.openBlock)(),(0,r.createBlock)(ro,(0,r.mergeProps)({key:3,ref_for:!0},E(B,O)),{default:(0,r.withCtx)(({item:j})=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(N(B._config.itemType)),{"model-value":j.value,"onUpdate:modelValue":te=>{j.value=te}},null,8,["model-value","onUpdate:modelValue"]))]),_:2},1040)):D(B)?((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(I(B._component.component)),(0,r.mergeProps)({key:4,"model-value":w(O)},{ref_for:!0},B._component.props,{"onUpdate:modelValue":j=>g(O,j,B)}),null,16,["model-value","onUpdate:modelValue"])):((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(N(B)),(0,r.mergeProps)({key:5,ref_for:!0},E(B,O)),null,16))])],2))),128)),(0,r.renderSlot)(T.$slots,"errors",{errors:k.value,errorCount:Object.keys(k.value).filter(O=>k.value[O]).length,visibleFields:b.value}),m.value==="error"?(0,r.renderSlot)(T.$slots,"error",{key:0,formData:u.value}):(0,r.createCommentVNode)("",!0),(0,r.renderSlot)(T.$slots,"submit",{submit:x,validate:V,formData:u.value,errors:k.value,formState:m.value})],64))],34)}}}),qu=ZI,QI={key:0,class:"dialog-form-error bg-red-30 color-red radius-1 mb-1 txt14 px-1 py-075"},e7=(0,r.defineComponent)({__name:"DialogForm",props:{open:{type:Boolean},title:{},width:{default:"m"},position:{default:"center"},dismissable:{type:Boolean,default:!0},schema:{},modelValue:{},onSubmit:{},onDelete:{},submitText:{},cancelText:{},deleteText:{}},emits:["update:open","resolve"],setup(e,{emit:t}){const n=e,o=t,{$t:a}=ft(),i=(0,r.ref)({...n.modelValue||{}}),l=(0,r.ref)(!1),s=(0,r.ref)(!1),c=(0,r.ref)(null),u=(0,r.ref)(),d=(0,r.computed)(()=>typeof n.onDelete=="function");async function f(){if(!l.value){if(!u.value?.validate()){c.value=a("dialogForm.validationError");return}c.value=null,l.value=!0;try{n.onSubmit&&await n.onSubmit(i.value),o("resolve",{action:"submit",data:i.value}),o("update:open",!1)}catch(v){c.value=v instanceof Error?v.message:a("dialogForm.errorOccurred")}finally{l.value=!1}}}async function m(){if(!(s.value||!n.onDelete)){c.value=null,s.value=!0;try{await n.onDelete(i.value),o("resolve",{action:"delete",data:i.value}),o("update:open",!1)}catch(v){c.value=v instanceof Error?v.message:a("dialogForm.errorOccurred")}finally{s.value=!1}}}function p(){o("resolve",{action:"cancel",data:i.value}),o("update:open",!1)}function h(){o("resolve",{action:"cancel",data:i.value})}return(v,b)=>((0,r.openBlock)(),(0,r.createBlock)(qn,{open:e.open,title:e.title,width:e.width,position:e.position,dismissable:e.dismissable,"onUpdate:open":b[1]||(b[1]=g=>v.$emit("update:open",g)),onClose:h},{footer:(0,r.withCtx)(()=>[d.value?((0,r.openBlock)(),(0,r.createBlock)(re,{key:0,color:"red",flat:"",loading:s.value,disabled:l.value,class:"me-auto",onClick:m},{default:(0,r.withCtx)(()=>[(0,r.createTextVNode)((0,r.toDisplayString)(e.deleteText||(0,r.unref)(a)("dialogForm.delete")),1)]),_:1},8,["loading","disabled"])):(0,r.createCommentVNode)("",!0),b[2]||(b[2]=(0,r.createElementVNode)("div",{class:"flex-grow-1"},null,-1)),(0,r.createVNode)(re,{flat:"",disabled:l.value||s.value,onClick:p},{default:(0,r.withCtx)(()=>[(0,r.createTextVNode)((0,r.toDisplayString)(e.cancelText||(0,r.unref)(a)("dialogForm.cancel")),1)]),_:1},8,["disabled"]),(0,r.createVNode)(re,{color:"primary",loading:l.value,disabled:s.value,onClick:f},{default:(0,r.withCtx)(()=>[(0,r.createTextVNode)((0,r.toDisplayString)(e.submitText||(0,r.unref)(a)("dialogForm.save")),1)]),_:1},8,["loading","disabled"])]),default:(0,r.withCtx)(()=>[c.value?((0,r.openBlock)(),(0,r.createElementBlock)("div",QI,(0,r.toDisplayString)(c.value),1)):(0,r.createCommentVNode)("",!0),(0,r.createVNode)(qu,{ref_key:"formFlowRef",ref:u,modelValue:i.value,"onUpdate:modelValue":b[0]||(b[0]=g=>i.value=g),schema:e.schema,onSubmit:f},null,8,["modelValue","schema"])]),_:1},8,["open","title","width","position","dismissable"]))}}),Yg=e7;const Gu=Symbol("dialog");var Zi=null;function Xg(){const e=(0,r.inject)(Gu,null);if(!e){if(Zi)return Zi;throw new Error("Dialog API not provided. Make sure DialogPlugin is installed via app.use(DialogPlugin)")}return e}const Kg={install:e=>{let t=0;const n=(0,r.reactive)([]),o={form:i=>new Promise(l=>{const s=++t;n.push({id:s,type:"form",options:i,resolve:l,open:!0})}),confirm:i=>new Promise(l=>{const s=++t,c=typeof i=="string"?{message:i}:i;n.push({id:s,type:"confirm",options:c,resolve:l,open:!0})}),open:i=>{const l=++t,s={id:l,type:"open",options:i,resolve:()=>{},open:!0};return n.push(s),{close:()=>{const c=n.findIndex(u=>u.id===l);c!==-1&&(n[c].open=!1,setTimeout(()=>{const u=n.findIndex(d=>d.id===l);u!==-1&&n.splice(u,1)},200))}}}};Zi||(Zi=o),e.provide(Gu,o);const a=(0,r.defineComponent)({name:"DialogContainer",setup(){function i(c,u){c.resolve(u),c.open=!1,setTimeout(()=>{const d=n.findIndex(f=>f.id===c.id);d!==-1&&n.splice(d,1)},200)}function l(c,u){c.resolve(u),c.open=!1,setTimeout(()=>{const d=n.findIndex(f=>f.id===c.id);d!==-1&&n.splice(d,1)},200)}function s(c,u){u||(c.open=!1,setTimeout(()=>{const d=n.findIndex(f=>f.id===c.id);d!==-1&&n.splice(d,1)},200))}return{dialogStack:n,handleFormResolve:i,handleConfirmResolve:l,handleOpenUpdate:s}},render(){return this.dialogStack.map(i=>{if(i.type==="form")return(0,r.h)(Yg,{key:i.id,open:i.open,...i.options,"onUpdate:open":l=>{l||this.handleFormResolve(i,{action:"cancel",data:i.options.modelValue||{}})},onResolve:l=>{this.handleFormResolve(i,l)}});if(i.type==="confirm")return(0,r.h)(Gg,{key:i.id,open:i.open,...i.options,"onUpdate:open":l=>{l||this.handleConfirmResolve(i,!1)},onResolve:l=>{this.handleConfirmResolve(i,l)}});if(i.type==="open"){const l=i.options;return(0,r.h)(qn,{key:i.id,open:i.open,title:l.title,width:l.width,position:l.position,dismissable:l.dismissable,class:l.class,"onUpdate:open":s=>{this.handleOpenUpdate(i,s)}},{default:()=>(0,r.h)((typeof l.component=="string",l.component),l.props||{})})}return null})}});if(e.component("DialogContainer",a),typeof document<"u"&&typeof window<"u"){const i=()=>{if(!document.getElementById("bagelink-dialog-root")){const l=document.createElement("div");l.id="bagelink-dialog-root",document.body.appendChild(l);const s=(0,r.createApp)(a);Object.assign(s._context,e._context),s.mount(l)}};document.body&&i(),e.mixin({mounted(){this.$root===this&&i()}})}}};var Yu={pint:{pattern:/\d/},int:{pattern:/[\d-]/},pnum:{pattern:/[\d.]/},tel:{pattern:/[\d.\-()\s+]/},money:{pattern:/[\d.\s,]/},number:{pattern:/[\d\-.]/},num:{pattern:/[\d\-.]/},hex:{pattern:/[0-9a-f]/i},email:{pattern:/[\w.\-@]/},alpha:{pattern:/[a-z_]/i},alphanum:{pattern:/\w/},lower:{pattern:/[a-z]/i,transform:e=>e.toLowerCase()},upper:{pattern:/[A-Z]/i,transform:e=>e.toUpperCase()},slug:{pattern:/[a-z0-9-]/i,transform:e=>e.toLowerCase().replace(/\s/g,"-")},snake:{pattern:/[a-z_]/,transform:e=>e.toLowerCase().replace(/\s/g,"_")}},ai=new WeakMap;function xs(e){if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)return e;const t=e.querySelector("input, textarea");return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?t:null}function jm(e){const t=Object.keys(e.modifiers);return t.length>0?t[t.length-1]:""}function Jg(e){return e.pattern!=null?e.pattern:e.modifier!=null&&e.modifier!==""?Yu[e.modifier]?.pattern??/./:/./}function qm(e,t,n){n.keydownEvent=(o=>{n7(o,t,n)}),n.inputEvent=(o=>{Zg(o,t,n)}),n.compositionStartEvent=(()=>{r7(n)}),n.compositionEndEvent=(o=>{o7(o,t,n)}),t.addEventListener("keydown",n.keydownEvent),t.addEventListener("input",n.inputEvent,{capture:!0}),t.addEventListener("compositionstart",n.compositionStartEvent),t.addEventListener("compositionend",n.compositionEndEvent)}function Gm(e,t){t.keydownEvent&&e.removeEventListener("keydown",t.keydownEvent),t.inputEvent&&e.removeEventListener("input",t.inputEvent,{capture:!0}),t.compositionStartEvent&&e.removeEventListener("compositionstart",t.compositionStartEvent),t.compositionEndEvent&&e.removeEventListener("compositionend",t.compositionEndEvent),t.keydownEvent=void 0,t.inputEvent=void 0,t.compositionStartEvent=void 0,t.compositionEndEvent=void 0}function t7(e){const t=["Tab","Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Enter"];return e.ctrlKey||e.altKey||e.metaKey?!0:t.includes(e.key)}function n7(e,t,n){if(n.composing===!0||t7(e)||n.modifier!=null&&n.modifier!==""&&typeof Yu[n.modifier]?.transform=="function")return;const o=Jg(n),a=e.key;o.test(a)||e.preventDefault()}function r7(e){e.composing=!0}function o7(e,t,n){n.composing=!1,Zg(e,t,n)}function Ym(e,t){const n=Jg(t);let o;if(t.modifier!=null&&t.modifier!==""){const i=Yu[t.modifier]?.transform;o=i?i(e):e}else o=e;let a="";for(let i=0;i<o.length;i++){const l=o[i];n.test(l)&&(a+=l)}return a}function Zg(e,t,n){if(n.reformatting===!0||n.composing===!0)return;const o=t.value,a=t.selectionEnd??o.length,i=o.slice(0,a),l=Ym(o,n);if(l===o)return;const s=Ym(i,n).length;n.reformatting=!0,t.value=l,t.setSelectionRange(s,s),n.reformatting=!1}var a7={beforeMount(e,t){const n=xs(e);if(n===null)return;const o={modifier:jm(t)};typeof t.value=="object"&&t.value!==null&&(o.pattern=t.value.pattern??/./,o.validateOnly=t.value.validateOnly===!0),ai.set(e,o),qm(e,n,o)},updated(e,t){const n=xs(e);if(n===null)return;const o=ai.get(e);o!==void 0&&(Gm(n,o),o.modifier=jm(t),typeof t.value=="object"&&t.value!==null&&(o.pattern=t.value.pattern??/./,o.validateOnly=t.value.validateOnly===!0),qm(e,n,o))},unmounted(e){const t=xs(e),n=ai.get(e);t!==null&&n!==void 0&&Gm(t,n),ai.delete(e)},getSSRProps(){return{}}},Qg=a7;function i7(e){let t=e.__rippleContainer;return(!t||!t.isConnected)&&(t=document.createElement("span"),Object.assign(t.style,{position:"absolute",inset:"0",overflow:"hidden",borderRadius:"inherit",pointerEvents:"none"}),e.appendChild(t),e.__rippleContainer=t),t}var l7={mounted(e,t){const n=o=>{const a=e.getBoundingClientRect(),i=Math.max(a.width,a.height),l=document.createElement("span");l.className="ripple",Object.assign(l.style,{width:`${i}px`,height:`${i}px`,left:`${o.clientX-a.left-i/2}px`,top:`${o.clientY-a.top-i/2}px`,position:"absolute",borderRadius:"50%",transform:"scale(0)",background:"rgba(0, 0, 0, 0.3)",pointerEvents:"none",animation:"rippleEffect 0.6s ease-out"}),i7(e).appendChild(l),setTimeout(()=>{l.remove()},600)};e.__rippleClickHandler=n,t.value!==!1&&(getComputedStyle(e).position==="static"&&(e.style.position="relative"),e.addEventListener("mousedown",n))},updated(e,t){const n=e.__rippleClickHandler;t.value===!1?e.removeEventListener("mousedown",n):(getComputedStyle(e).position==="static"&&(e.style.position="relative"),e.addEventListener("mousedown",n))},unmounted(e){const t=e.__rippleClickHandler;t&&(e.removeEventListener("mousedown",t),delete e.__rippleClickHandler)},getSSRProps(){return{}}},ev=l7,Zo=Symbol("resize");function Xm(e,t){const n=t.value||{};let o=!1,a=0,i=0,l=null;n.handle?(l=e.querySelector(n.handle),l||(l=document.createElement("div"),l.className=n.handle.replace(".","")+(n.handleClass?` ${n.handleClass}`:""),l.style.cssText=`
430
+ `);m=m.endsWith(".csv")?m:`${m}.csv`,Wu(new Blob([g],{type:"text/csv;charset=utf-8"}),m)}async function a(f){const m=await t(),p=await f.arrayBuffer();return m.read(p)}async function i(f){return(await a(f)).SheetNames}async function l(f,m,p=!0){const h=await t(),v=(await a(f)).Sheets[m],b=h.utils.sheet_to_json(v,{header:1});if(b.length===0)return{headers:[],data:[]};let g=[],y=0;p?(g=b[0].map(w=>String(w||"").trim()),y=1):g=b[0].map((w,$)=>String.fromCharCode(65+$));const _=[];for(let w=y;w<b.length;w++){const $=b[w],N={};for(let k=0;k<g.length;k++)k<$.length?N[g[k]]=$[k]:N[g[k]]="";_.push(N)}return{headers:g,data:_}}async function s(f){const m=await t();return new Promise((p,h)=>{const v=new FileReader;v.onload=b=>{try{const g=new Uint8Array(b.target?.result),y=m.read(g,{type:"array"}),_=y.SheetNames[0],w=y.Sheets[_];p(m.utils.sheet_to_json(w))}catch(g){h(g)}},v.onerror=()=>{h(new Error("Failed to read file"))},v.readAsArrayBuffer(f)})}function c(f){return typeof f=="number"&&Number.isInteger(f)&&f>=2e4&&f<=5e4}function u(f){const m=new Date(Date.UTC(1899,11,30));return new Date(m.getTime()+f*(1440*60*1e3))}function d(f,m=!1){if(!(f instanceof Date)||Number.isNaN(f.getTime()))return"";const p=f.getFullYear(),h=String(f.getMonth()+1).padStart(2,"0"),v=String(f.getDate()).padStart(2,"0");return m?`${p}-${h}-${v}T${String(f.getHours()).padStart(2,"0")}:${String(f.getMinutes()).padStart(2,"0")}:${String(f.getSeconds()).padStart(2,"0")}`:`${p}-${h}-${v}`}return{downloadExcel:n,downloadCSV:o,readExcelFile:s,ensureXLSXLoaded:t,getSheetNames:i,readSheetData:l,getWorkbook:a,isExcelSerialDate:c,excelSerialDateToJSDate:u,formatDate:d}}var uo={},Um=!1,Vc=typeof window<"u";function PI(){!Vc||Um||(Um=!0,window.addEventListener("storage",e=>{e.key!==null&&e.key in uo&&(uo[e.key].value=e.newValue!==null?JSON.parse(e.newValue):null)}))}function II(e,t=null){if(!(e in uo)){const n=Vc?localStorage.getItem(e):null;uo[e]=(0,r.ref)(n!==null?JSON.parse(n):t),(0,r.watch)(uo[e],o=>{Vc&&localStorage.setItem(e,JSON.stringify(o))})}return uo[e]}function Hg(e){return PI(),new Proxy({},{get(t,n){return II(n,e?.[n]??null)}})}var Wg=1e3,VI=60*Wg;function OI(e,t={}){const{interval:n=30*Wg,inactivityThreshold:o=5*VI,pauseInBackground:a=!0}=t,{idle:i}=A_(o),l=(0,r.ref)(!0),s=(0,r.ref)(null),c=()=>!a||document.visibilityState==="visible",u=()=>{l.value=!1,s.value!==null&&(clearTimeout(s.value),s.value=null)},d=()=>{s.value!==null&&(clearTimeout(s.value),s.value=null)},f=()=>{s.value!==null&&(clearTimeout(s.value),s.value=null);const h=async()=>{if(l.value&&c()&&!i.value)try{await e()}catch{}l.value&&(s.value=window.setTimeout(h,n))};h()},m=()=>{l.value&&f()};function p(){document.visibilityState==="visible"?l.value&&f():a&&d()}return(0,r.onMounted)(()=>{document.addEventListener("visibilitychange",p),f()}),(0,r.onUnmounted)(()=>{document.removeEventListener("visibilitychange",p),u()}),{isPolling:l,pausePolling:d,resumePolling:m,startPolling:f,stopPolling:u}}function RI(e,t,n){const o={...e};return n===void 0?delete o[t]:o[t]=n,o}function FI(e){const t=(0,Ni.useRoute)(),n=(0,Ni.useRouter)(),o={};return new Proxy({},{get(a,i){if(!(i in o)){const l=e?.[i];o[i]=(0,r.computed)({get:()=>t.query[i]??l,set:s=>n.replace({query:RI(t.query,i,s)})})}return o[i]}})}function zI(e){const t=(0,r.ref)(0),n=(0,r.ref)(0);let o=null;return(0,r.onMounted)(()=>{e.value&&(o=new ResizeObserver(a=>{for(const i of a)t.value=i.contentRect.width,n.value=i.contentRect.height}),o.observe(e.value),t.value=e.value.clientWidth,n.value=e.value.clientHeight)}),(0,r.onUnmounted)(()=>{o&&(o.disconnect(),o=null)}),{width:t,height:n}}var pn=(0,r.ref)([{value:"dark",class:"bgl-dark-mode",icon:"cloudy_night",label:"Dark Mode",isDark:!0},{value:"light",class:"bgl-light-mode",icon:"brightness_7",label:"Light Mode",isDark:!1},{value:"system",class:"system",icon:"settings_input_component",label:"System Default"}]),Hm="color-mode",pr=(0,r.ref)("system"),Oc=(0,r.ref)(!1),ju=typeof window<"u";function UI(){return ju&&window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches}function HI(e){return pn.value.find(t=>t.value===e)}function Ss(e){if(!ju)return;const t=document.documentElement;if(pn.value.forEach(n=>{n.class!=="system"&&t.classList.remove(n.class)}),e==="system"){const n=UI();Oc.value=n;const o=pn.value.find(l=>l.value==="dark"),a=pn.value.find(l=>l.value==="light"),i=n?o:a;i&&t.classList.add(i.class)}else{const n=HI(e);n&&(t.classList.add(n.class),Oc.value=n.isDark??!1)}}function WI(){const e=pn.value.filter(t=>t.value!=="system");e.length!==0&&(pr.value=e[(e.findIndex(t=>t.value===pr.value)+1)%e.length].value)}function jI(e){if(!pn.value.some(t=>t.value===e.value)){const t=pn.value.findIndex(n=>n.value==="system");t>-1?pn.value.splice(t,0,e):pn.value.push(e)}}var Wm=!1;function qI(){if(Wm||!ju)return;Wm=!0;const e=window.localStorage.getItem(Hm);pn.value.some(t=>t.value===e)&&(pr.value=e),Ss(pr.value),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",()=>{pr.value==="system"&&Ss("system")}),(0,r.watch)(pr,t=>{localStorage.setItem(Hm,t),Ss(t)})}function GI(){return qI(),{isDark:Oc,theme:(0,r.computed)(()=>pr.value),themeOptions:pn,toggleTheme:WI,addTheme:jI,setTheme:e=>{pr.value=e}}}function jg(e,t,n,o){k_(e,(a,i)=>{if(t?.()?.setCustomValidity(""),!n||a===i||!a)return;const l=n(a,o?.());typeof l=="string"&&t?.()?.setCustomValidity(l)},{debounce:500})}function qg({schema:e,columns:t,data:n}={}){const o=(0,r.computed)(()=>(0,r.toValue)(e)),a=(0,r.computed)(()=>(0,r.toValue)(t));return o.value?a.value&&a.value.length>0?o.value.filter(i=>a.value?.includes(i.id)):o.value:zg(n,a.value)}const YI={s:"400px",m:"540px",l:"720px",xl:"960px",full:"100%"};var XI={key:2,class:"flex-grow-1"},KI=(0,r.defineComponent)({__name:"Dialog",props:{open:{type:Boolean},title:{},width:{default:"m"},position:{default:"center"},dismissable:{type:Boolean,default:!0},flat:{type:Boolean,default:!0},thin:{type:Boolean,default:!1},centerTitle:{type:Boolean,default:!1},ellipsisTitle:{type:Boolean,default:!1},closePlacement:{default:"header-end"}},emits:["update:open","close"],setup(e,{expose:t,emit:n}){const o=e,a=n,i=(0,r.ref)(null),l=(0,r.ref)(!1),s=(0,r.ref)(!0),c=(0,r.computed)(()=>YI[o.width]),u=(0,r.computed)(()=>o.position==="left"?"dialog-left ms-1 me-auto mt-1 mb-1 height-100-2 m_m-0 m_h-100vh m_max-h-100vh m_radius-0":o.position==="right"?"dialog-right me-1 ms-auto mt-1 mb-1 height-100-2 m_m-0 m_h-100vh m_max-h-100vh m_radius-0":o.position==="top"?"dialog-top mx-auto mt-1 mb-auto":o.position==="bottom"?"dialog-bottom mx-auto mb-1 mt-auto":"dialog-center mx-auto");(0,r.watch)(()=>o.open,v=>{v?(i.value?.showModal(),l.value=!1,s.value=!1,setTimeout(()=>{s.value=!0},250)):d()}),(0,r.onMounted)(()=>{o.open&&i.value?.showModal()});function d(){l.value||(l.value=!0)}function f(){l.value&&(i.value?.close(),l.value=!1,a("close"))}function m(v){v.target===i.value&&o.dismissable&&a("update:open",!1)}function p(v){if(!o.dismissable){v.preventDefault();return}a("update:open",!1)}function h(){s.value=!1,a("update:open",!1)}return t({close:h}),(v,b)=>((0,r.openBlock)(),(0,r.createElementBlock)("dialog",{ref_key:"dialogRef",ref:i,class:(0,r.normalizeClass)([[u.value,{"is-closing":l.value}],"border-none shadow-30 p-0 testMe1"]),style:(0,r.normalizeStyle)({"--dialog-width":c.value}),onClick:m,onCancel:p,onAnimationend:f},[(0,r.createElementVNode)("div",{class:"grid grid-dialog max-height-100-2",onClick:b[0]||(b[0]=(0,r.withModifiers)(()=>{},["stop"]))},[e.title||e.dismissable?((0,r.openBlock)(),(0,r.createElementBlock)("header",{key:0,class:(0,r.normalizeClass)(["flex space-between flex-shrink-0 align-items-start gap-05",{"border-bottom":!e.flat,"border-none":!e.title,"m_ps-1":e.title,"p-05 m_p-05":!e.title,"ps-1-5 pe-1 py-1 ":!e.thin&&e.title,"ps-1 pe-05 py-05":e.thin&&e.title}])},[e.dismissable&&e.closePlacement==="header-start"?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:0,flat:"",icon:"close","aria-label":"Close",class:"dialog-close relative z-2",thin:"",onClick:h})):(0,r.createCommentVNode)("",!0),e.title?((0,r.openBlock)(),(0,r.createElementBlock)("h3",{key:1,class:(0,r.normalizeClass)(["dialog-title m-0 txt20 semi w-100p",{"txt-center balance":e.centerTitle,"word-break-all":!e.centerTitle,"ellipsis-1":e.ellipsisTitle}])},(0,r.toDisplayString)(e.title),3)):(0,r.createCommentVNode)("",!0),e.title?(0,r.createCommentVNode)("",!0):((0,r.openBlock)(),(0,r.createElementBlock)("div",XI)),e.dismissable&&e.closePlacement==="header-end"?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:3,flat:"",icon:"close","aria-label":"Close",class:"dialog-close relative z-2",thin:"",onClick:h})):(0,r.createCommentVNode)("",!0)],2)):(0,r.createCommentVNode)("",!0),(0,r.createElementVNode)("div",{class:(0,r.normalizeClass)(["overflow-y flex-grow-1 m_p-1",{"px-1 py-05":e.thin,"px-1-5 py-1":!e.thin}])},[(0,r.renderSlot)(v.$slots,"default",{},void 0,!0)],2),v.$slots.footer?((0,r.openBlock)(),(0,r.createElementBlock)("footer",{key:1,class:(0,r.normalizeClass)(["flex flex-shrink-0 gap-05 m_px-05 m_py-05 justify-content-end",{"border-top":!e.flat,"px-05 py-05":e.thin,"px-1-5 py-1":!e.thin}])},[(0,r.renderSlot)(v.$slots,"footer",{},void 0,!0)],2)):(0,r.createCommentVNode)("",!0)]),e.dismissable&&e.closePlacement==="overlay-start"&&s.value?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:0,icon:"close","aria-label":"Close",class:"fixed top-1 start-1 z-999 overlay-btn",onClick:h})):(0,r.createCommentVNode)("",!0),e.dismissable&&e.closePlacement==="overlay-end"&&s.value?((0,r.openBlock)(),(0,r.createBlock)((0,r.unref)(re),{key:1,icon:"close","aria-label":"Close",class:"fixed top-1 end-1 z-999 overlay-btn",onClick:h})):(0,r.createCommentVNode)("",!0)],38))}}),qn=$e(KI,[["__scopeId","data-v-3fa1d15e"]]),JI=(0,r.defineComponent)({__name:"DialogConfirm",props:{open:{type:Boolean},title:{},message:{},width:{default:"s"},position:{default:"center"},dismissable:{type:Boolean,default:!0},confirmText:{},cancelText:{},confirmColor:{default:"primary"}},emits:["update:open","resolve"],setup(e,{emit:t}){const n=e,o=t,{$t:a}=ft(),i=(0,r.computed)(()=>n.title||a("modalConfirm.title")),l=(0,r.computed)(()=>n.confirmText||a("modalConfirm.confirm")),s=(0,r.computed)(()=>n.cancelText||a("modalConfirm.cancel"));function c(){o("resolve",!0),o("update:open",!1)}function u(){o("resolve",!1),o("update:open",!1)}function d(){o("resolve",!1)}return(f,m)=>((0,r.openBlock)(),(0,r.createBlock)(qn,{open:e.open,title:i.value,width:e.width,position:e.position,dismissable:e.dismissable,"onUpdate:open":m[0]||(m[0]=p=>f.$emit("update:open",p)),onClose:d},{footer:(0,r.withCtx)(()=>[(0,r.createVNode)(re,{flat:"",onClick:u},{default:(0,r.withCtx)(()=>[(0,r.createTextVNode)((0,r.toDisplayString)(s.value),1)]),_:1}),(0,r.createVNode)(re,{color:e.confirmColor,onClick:c},{default:(0,r.withCtx)(()=>[(0,r.createTextVNode)((0,r.toDisplayString)(l.value),1)]),_:1},8,["color"])]),default:(0,r.withCtx)(()=>[(0,r.createElementVNode)("p",null,(0,r.toDisplayString)(e.message),1)]),_:1},8,["open","title","width","position","dismissable"]))}}),Gg=JI,ZI=(0,r.defineComponent)({__name:"FormFlow",props:{schema:{},modelValue:{},components:{},errors:{},onSubmit:{type:Function}},emits:["update:modelValue"],setup(e,{expose:t,emit:n}){const o=e,a=n,{$t:i}=ft();function l(T,L){const F=L.split(".");let O=T;for(const B of F)O=O?.[B];return O}function s(T,L,F){const O=L.split(".");let B=T;for(let j=0;j<O.length-1;j++){const te=O[j];(B[te]==null||typeof B[te]!="object")&&(B[te]={}),B=B[te]}B[O[O.length-1]]=F}function c(T){const L={...T??{}};for(const[F,O]of Object.entries(o.schema._fields)){const B=O._config.default;B!==void 0&&l(L,F)===void 0&&s(L,F,B)}return L}const u=(0,r.ref)(c(o.modelValue)),d=(0,r.ref)({}),f=(0,r.ref)(!1),m=(0,r.ref)("idle"),p=(0,r.ref)();let h=!1;(0,r.watch)(()=>o.modelValue,T=>{h||(u.value=c(T))},{deep:!0}),(0,r.watch)(u,T=>{h=!0,a("update:modelValue",T),(0,r.nextTick)(()=>{h=!1})},{deep:!0});function v(T){return T._condition==null?!0:m2(T._condition,u.value)}const b=(0,r.computed)(()=>{const T=[];for(const[L,F]of Object.entries(o.schema._fields))v(F)&&T.push({key:L,field:F});return T});function g(T,L,F){s(u.value,T,L),(m.value==="success"||m.value==="error")&&(m.value="idle"),f.value&&_(T,F)}function y(T,L){return T==null||T===""||Array.isArray(T)&&T.length===0||L._type==="tel"&&typeof T=="string"&&/^\+\d+$/.test(T)}function _(T,L){const F=w(T);if(L._config.required===!0&&y(F,L))return d.value={...d.value,[T]:L._config.requiredMessage??i("form.required")},!1;if(L._type==="email"&&F&&!Nr.test(F))return d.value={...d.value,[T]:i("form.invalidEmail")},!1;if(L._validations!=null)for(const O of L._validations){const B=O(F);if(B!==!0)return d.value={...d.value,[T]:B},!1}return d.value=Object.fromEntries(Object.entries(d.value).filter(([O])=>O!==T)),!0}function w(T){return l(u.value,T)}function $(T,L){return L._config.label!=null?L._config.label:T.split(/[._-]/).map(F=>F.charAt(0).toUpperCase()+F.slice(1)).join(" ")}function N(T){if(typeof T!="string"&&(T._type==="select"||T._type==="multiselect")&&T._config.display==="btn")return o0;const L=typeof T=="string"?T:T._type;return{text:Fe,email:tu,password:Nh,number:Nn,tel:_u,url:Fe,date:pa,time:Fe,datetime:pa,textarea:Fe,richtext:fu,json:eu,checkbox:St,toggle:$l,radio:Ah,select:Ut,multiselect:Ut,array:ro,upload:ga,color:xn,range:ru}[L]??Fe}const k=(0,r.computed)(()=>{const T={...d.value,...o.errors||{}},L={};for(const[F,O]of Object.entries(T))L[F]=Ee(O)??O;return L});function E(T,L){const F={label:$(L,T),modelValue:w(L),"onUpdate:modelValue":O=>{g(L,O,T)},error:k.value[L],...T._config,name:T._config.name??L};if(T._type==="textarea"&&(F.multiline=!0),T._type==="multiselect"&&(F.multiselect=!0),T._type==="json"&&(F.language=F.language??"json"),T._type==="array"){const O=Object.fromEntries(Object.entries(T._config).filter(([B])=>B!=="schema"&&B!=="itemType"));Object.assign(F,O),F.allowAdd=F.allowAdd??!0,F.allowDelete=F.allowDelete??!0}return F}function I(T){return typeof T=="string"&&o.components?.[T]!=null?o.components[T]:T}function D(T){return T._component!=null}function V(){let T=!0;const L={};for(const{key:F,field:O}of b.value){const B=w(F);if(O._config.required===!0&&y(B,O)){L[F]=O._config.requiredMessage??i("form.required"),T=!1;continue}if(O._type==="email"&&B&&!Nr.test(B)){L[F]=i("form.invalidEmail"),T=!1;continue}if(O._validations!=null)for(const j of O._validations){const te=j(B);if(te!==!0){L[F]=te,T=!1;break}}}return d.value=L,T}async function x(T){T&&T.preventDefault(),f.value=!0;const L=V();if(L){if(o.onSubmit){m.value="submitting";try{await o.onSubmit(u.value),m.value="success"}catch{m.value="error"}}}else{T?.stopPropagation();const F=b.value.find(({key:O})=>d.value[O])?.key;if(F!=null&&p.value){const O=p.value.querySelector(`[name="${F}"]`)||p.value.querySelector(`[id="${F}"]`)||p.value.querySelector(`[data-field="${F}"]`)||p.value.querySelector("input, select, textarea");O&&(O.scrollIntoView({behavior:"smooth",block:"center"}),setTimeout(()=>{O instanceof HTMLElement&&O.focus()},300))}}return L}return t({validate:V,submit:x,formState:m}),(T,L)=>{const F=(0,r.resolveComponent)("FormFlow",!0);return(0,r.openBlock)(),(0,r.createElementBlock)("form",{ref_key:"formElement",ref:p,class:(0,r.normalizeClass)(["grid-form",e.schema._class]),onSubmit:x},[m.value==="success"?(0,r.renderSlot)(T.$slots,"success",{key:0,formData:u.value}):((0,r.openBlock)(),(0,r.createElementBlock)(r.Fragment,{key:1},[((0,r.openBlock)(!0),(0,r.createElementBlock)(r.Fragment,null,(0,r.renderList)(b.value,({key:O,field:B})=>((0,r.openBlock)(),(0,r.createElementBlock)("div",{key:O,class:(0,r.normalizeClass)([B._class,B._config.class])},[(0,r.renderSlot)(T.$slots,`field:${O}`,{value:w(O),field:B,formData:u.value,error:d.value[O],onChange:j=>{g(O,j,B)}},()=>[B._type==="array"&&B._config.schema?._isSchema?((0,r.openBlock)(),(0,r.createBlock)(ro,(0,r.mergeProps)({key:0,ref_for:!0},E(B,O)),{default:(0,r.withCtx)(({item:j})=>[(0,r.createVNode)(F,{"model-value":j.value,schema:B._config.schema,components:e.components,"onUpdate:modelValue":te=>{j.value=te}},null,8,["model-value","schema","components","onUpdate:modelValue"])]),_:2},1040)):B._type==="array"&&typeof B._config.schema=="string"?((0,r.openBlock)(),(0,r.createBlock)(ro,(0,r.mergeProps)({key:1,ref_for:!0},E(B,O)),{default:(0,r.withCtx)(({item:j})=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(N(B._config.schema)),{"model-value":j.value,"onUpdate:modelValue":te=>{j.value=te}},null,8,["model-value","onUpdate:modelValue"]))]),_:2},1040)):B._type==="array"&&B._config.schema?((0,r.openBlock)(),(0,r.createBlock)(ro,(0,r.mergeProps)({key:2,ref_for:!0},E(B,O)),{default:(0,r.withCtx)(({item:j})=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(I(B._config.schema)),{modelValue:j.value,"onUpdate:modelValue":te=>j.value=te},null,8,["modelValue","onUpdate:modelValue"]))]),_:2},1040)):B._type==="array"&&B._config.itemType?((0,r.openBlock)(),(0,r.createBlock)(ro,(0,r.mergeProps)({key:3,ref_for:!0},E(B,O)),{default:(0,r.withCtx)(({item:j})=>[((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(N(B._config.itemType)),{"model-value":j.value,"onUpdate:modelValue":te=>{j.value=te}},null,8,["model-value","onUpdate:modelValue"]))]),_:2},1040)):D(B)?((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(I(B._component.component)),(0,r.mergeProps)({key:4,"model-value":w(O)},{ref_for:!0},B._component.props,{"onUpdate:modelValue":j=>g(O,j,B)}),null,16,["model-value","onUpdate:modelValue"])):((0,r.openBlock)(),(0,r.createBlock)((0,r.resolveDynamicComponent)(N(B)),(0,r.mergeProps)({key:5,ref_for:!0},E(B,O)),null,16))])],2))),128)),(0,r.renderSlot)(T.$slots,"errors",{errors:k.value,errorCount:Object.keys(k.value).filter(O=>k.value[O]).length,visibleFields:b.value}),m.value==="error"?(0,r.renderSlot)(T.$slots,"error",{key:0,formData:u.value}):(0,r.createCommentVNode)("",!0),(0,r.renderSlot)(T.$slots,"submit",{submit:x,validate:V,formData:u.value,errors:k.value,formState:m.value})],64))],34)}}}),qu=ZI,QI={key:0,class:"dialog-form-error bg-red-30 color-red radius-1 mb-1 txt14 px-1 py-075"},e7=(0,r.defineComponent)({__name:"DialogForm",props:{open:{type:Boolean},title:{},width:{default:"m"},position:{default:"center"},dismissable:{type:Boolean,default:!0},schema:{},modelValue:{},onSubmit:{},onDelete:{},submitText:{},cancelText:{},deleteText:{}},emits:["update:open","resolve"],setup(e,{emit:t}){const n=e,o=t,{$t:a}=ft(),i=(0,r.ref)({...n.modelValue||{}}),l=(0,r.ref)(!1),s=(0,r.ref)(!1),c=(0,r.ref)(null),u=(0,r.ref)(),d=(0,r.computed)(()=>typeof n.onDelete=="function");async function f(){if(!l.value){if(!u.value?.validate()){c.value=a("dialogForm.validationError");return}c.value=null,l.value=!0;try{n.onSubmit&&await n.onSubmit(i.value),o("resolve",{action:"submit",data:i.value}),o("update:open",!1)}catch(v){c.value=v instanceof Error?v.message:a("dialogForm.errorOccurred")}finally{l.value=!1}}}async function m(){if(!(s.value||!n.onDelete)){c.value=null,s.value=!0;try{await n.onDelete(i.value),o("resolve",{action:"delete",data:i.value}),o("update:open",!1)}catch(v){c.value=v instanceof Error?v.message:a("dialogForm.errorOccurred")}finally{s.value=!1}}}function p(){o("resolve",{action:"cancel",data:i.value}),o("update:open",!1)}function h(){o("resolve",{action:"cancel",data:i.value})}return(v,b)=>((0,r.openBlock)(),(0,r.createBlock)(qn,{open:e.open,title:e.title,width:e.width,position:e.position,dismissable:e.dismissable,"onUpdate:open":b[1]||(b[1]=g=>v.$emit("update:open",g)),onClose:h},{footer:(0,r.withCtx)(()=>[d.value?((0,r.openBlock)(),(0,r.createBlock)(re,{key:0,color:"red",flat:"",loading:s.value,disabled:l.value,class:"me-auto",onClick:m},{default:(0,r.withCtx)(()=>[(0,r.createTextVNode)((0,r.toDisplayString)(e.deleteText||(0,r.unref)(a)("dialogForm.delete")),1)]),_:1},8,["loading","disabled"])):(0,r.createCommentVNode)("",!0),b[2]||(b[2]=(0,r.createElementVNode)("div",{class:"flex-grow-1"},null,-1)),(0,r.createVNode)(re,{flat:"",disabled:l.value||s.value,onClick:p},{default:(0,r.withCtx)(()=>[(0,r.createTextVNode)((0,r.toDisplayString)(e.cancelText||(0,r.unref)(a)("dialogForm.cancel")),1)]),_:1},8,["disabled"]),(0,r.createVNode)(re,{color:"primary",loading:l.value,disabled:s.value,onClick:f},{default:(0,r.withCtx)(()=>[(0,r.createTextVNode)((0,r.toDisplayString)(e.submitText||(0,r.unref)(a)("dialogForm.save")),1)]),_:1},8,["loading","disabled"])]),default:(0,r.withCtx)(()=>[c.value?((0,r.openBlock)(),(0,r.createElementBlock)("div",QI,(0,r.toDisplayString)(c.value),1)):(0,r.createCommentVNode)("",!0),(0,r.createVNode)(qu,{ref_key:"formFlowRef",ref:u,modelValue:i.value,"onUpdate:modelValue":b[0]||(b[0]=g=>i.value=g),schema:e.schema,onSubmit:f},null,8,["modelValue","schema"])]),_:1},8,["open","title","width","position","dismissable"]))}}),Yg=e7;const Gu=Symbol("dialog");var Zi=null;function Xg(){const e=(0,r.inject)(Gu,null);if(!e){if(Zi)return Zi;throw new Error("Dialog API not provided. Make sure DialogPlugin is installed via app.use(DialogPlugin)")}return e}const Kg={install:e=>{let t=0;const n=(0,r.reactive)([]),o={form:i=>new Promise(l=>{const s=++t;n.push({id:s,type:"form",options:i,resolve:l,open:!0})}),confirm:i=>new Promise(l=>{const s=++t,c=typeof i=="string"?{message:i}:i;n.push({id:s,type:"confirm",options:c,resolve:l,open:!0})}),open:i=>{const l=++t,s={id:l,type:"open",options:i,resolve:()=>{},open:!0};return n.push(s),{close:()=>{const c=n.findIndex(u=>u.id===l);c!==-1&&(n[c].open=!1,setTimeout(()=>{const u=n.findIndex(d=>d.id===l);u!==-1&&n.splice(u,1)},200))}}}};Zi||(Zi=o),e.provide(Gu,o);const a=(0,r.defineComponent)({name:"DialogContainer",setup(){function i(c,u){c.resolve(u),c.open=!1,setTimeout(()=>{const d=n.findIndex(f=>f.id===c.id);d!==-1&&n.splice(d,1)},200)}function l(c,u){c.resolve(u),c.open=!1,setTimeout(()=>{const d=n.findIndex(f=>f.id===c.id);d!==-1&&n.splice(d,1)},200)}function s(c,u){u||(c.open=!1,setTimeout(()=>{const d=n.findIndex(f=>f.id===c.id);d!==-1&&n.splice(d,1)},200))}return{dialogStack:n,handleFormResolve:i,handleConfirmResolve:l,handleOpenUpdate:s}},render(){return this.dialogStack.map(i=>{if(i.type==="form")return(0,r.h)(Yg,{key:i.id,open:i.open,...i.options,"onUpdate:open":l=>{l||this.handleFormResolve(i,{action:"cancel",data:i.options.modelValue||{}})},onResolve:l=>{this.handleFormResolve(i,l)}});if(i.type==="confirm")return(0,r.h)(Gg,{key:i.id,open:i.open,...i.options,"onUpdate:open":l=>{l||this.handleConfirmResolve(i,!1)},onResolve:l=>{this.handleConfirmResolve(i,l)}});if(i.type==="open"){const l=i.options;return(0,r.h)(qn,{key:i.id,open:i.open,title:l.title,width:l.width,position:l.position,dismissable:l.dismissable,class:l.class,"onUpdate:open":s=>{this.handleOpenUpdate(i,s)}},{default:()=>(0,r.h)((typeof l.component=="string",l.component),l.props||{})})}return null})}});if(e.component("DialogContainer",a),typeof document<"u"&&typeof window<"u"){const i=()=>{if(!document.getElementById("bagelink-dialog-root")){const l=document.createElement("div");l.id="bagelink-dialog-root",document.body.appendChild(l);const s=(0,r.createApp)(a);Object.assign(s._context,e._context),s.mount(l)}};document.body&&i(),e.mixin({mounted(){this.$root===this&&i()}})}}};var Yu={pint:{pattern:/\d/},int:{pattern:/[\d-]/},pnum:{pattern:/[\d.]/},tel:{pattern:/[\d.\-()\s+]/},money:{pattern:/[\d.\s,]/},number:{pattern:/[\d\-.]/},num:{pattern:/[\d\-.]/},hex:{pattern:/[0-9a-f]/i},email:{pattern:/[\w.\-@]/},alpha:{pattern:/[a-z_]/i},alphanum:{pattern:/\w/},lower:{pattern:/[a-z]/i,transform:e=>e.toLowerCase()},upper:{pattern:/[A-Z]/i,transform:e=>e.toUpperCase()},slug:{pattern:/[a-z0-9-]/i,transform:e=>e.toLowerCase().replace(/\s/g,"-")},snake:{pattern:/[a-z_]/,transform:e=>e.toLowerCase().replace(/\s/g,"_")}},ai=new WeakMap;function xs(e){if(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)return e;const t=e.querySelector("input, textarea");return t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement?t:null}function jm(e){const t=Object.keys(e.modifiers);return t.length>0?t[t.length-1]:""}function Jg(e){return e.pattern!=null?e.pattern:e.modifier!=null&&e.modifier!==""?Yu[e.modifier]?.pattern??/./:/./}function qm(e,t,n){n.keydownEvent=(o=>{n7(o,t,n)}),n.inputEvent=(o=>{Zg(o,t,n)}),n.compositionStartEvent=(()=>{r7(n)}),n.compositionEndEvent=(o=>{o7(o,t,n)}),t.addEventListener("keydown",n.keydownEvent),t.addEventListener("input",n.inputEvent,{capture:!0}),t.addEventListener("compositionstart",n.compositionStartEvent),t.addEventListener("compositionend",n.compositionEndEvent)}function Gm(e,t){t.keydownEvent&&e.removeEventListener("keydown",t.keydownEvent),t.inputEvent&&e.removeEventListener("input",t.inputEvent,{capture:!0}),t.compositionStartEvent&&e.removeEventListener("compositionstart",t.compositionStartEvent),t.compositionEndEvent&&e.removeEventListener("compositionend",t.compositionEndEvent),t.keydownEvent=void 0,t.inputEvent=void 0,t.compositionStartEvent=void 0,t.compositionEndEvent=void 0}function t7(e){const t=["Tab","Backspace","Delete","ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Enter"];return e.ctrlKey||e.altKey||e.metaKey?!0:t.includes(e.key)}function n7(e,t,n){if(n.composing===!0||t7(e)||n.modifier!=null&&n.modifier!==""&&typeof Yu[n.modifier]?.transform=="function")return;const o=Jg(n),a=e.key;o.test(a)||e.preventDefault()}function r7(e){e.composing=!0}function o7(e,t,n){n.composing=!1,Zg(e,t,n)}function Ym(e,t){const n=Jg(t);let o;if(t.modifier!=null&&t.modifier!==""){const i=Yu[t.modifier]?.transform;o=i?i(e):e}else o=e;let a="";for(let i=0;i<o.length;i++){const l=o[i];n.test(l)&&(a+=l)}return a}function Zg(e,t,n){if(n.reformatting===!0||n.composing===!0)return;const o=t.value,a=t.selectionEnd??o.length,i=o.slice(0,a),l=Ym(o,n);if(l===o)return;const s=Ym(i,n).length;n.reformatting=!0,t.value=l,t.setSelectionRange(s,s),n.reformatting=!1}var a7={beforeMount(e,t){const n=xs(e);if(n===null)return;const o={modifier:jm(t)};typeof t.value=="object"&&t.value!==null&&(o.pattern=t.value.pattern??/./,o.validateOnly=t.value.validateOnly===!0),ai.set(e,o),qm(e,n,o)},updated(e,t){const n=xs(e);if(n===null)return;const o=ai.get(e);o!==void 0&&(Gm(n,o),o.modifier=jm(t),typeof t.value=="object"&&t.value!==null&&(o.pattern=t.value.pattern??/./,o.validateOnly=t.value.validateOnly===!0),qm(e,n,o))},unmounted(e){const t=xs(e),n=ai.get(e);t!==null&&n!==void 0&&Gm(t,n),ai.delete(e)},getSSRProps(){return{}}},Qg=a7;function i7(e){let t=e.__rippleContainer;return(!t||!t.isConnected)&&(t=document.createElement("span"),Object.assign(t.style,{position:"absolute",inset:"0",overflow:"hidden",borderRadius:"inherit",pointerEvents:"none"}),e.appendChild(t),e.__rippleContainer=t),t}var l7={mounted(e,t){const n=o=>{const a=e.getBoundingClientRect(),i=Math.max(a.width,a.height),l=document.createElement("span");l.className="ripple",Object.assign(l.style,{width:`${i}px`,height:`${i}px`,left:`${o.clientX-a.left-i/2}px`,top:`${o.clientY-a.top-i/2}px`,position:"absolute",borderRadius:"50%",transform:"scale(0)",background:"rgba(0, 0, 0, 0.3)",pointerEvents:"none",animation:"rippleEffect 0.6s ease-out"}),i7(e).appendChild(l),setTimeout(()=>{l.remove()},600)};e.__rippleClickHandler=n,t.value!==!1&&(getComputedStyle(e).position==="static"&&(e.style.position="relative"),e.addEventListener("mousedown",n))},updated(e,t){const n=e.__rippleClickHandler;t.value===!1?e.removeEventListener("mousedown",n):(getComputedStyle(e).position==="static"&&(e.style.position="relative"),e.addEventListener("mousedown",n))},unmounted(e){const t=e.__rippleClickHandler;t&&(e.removeEventListener("mousedown",t),delete e.__rippleClickHandler)},getSSRProps(){return{}}},ev=l7,Zo=Symbol("resize");function Xm(e,t){const n=t.value||{};let o=!1,a=0,i=0,l=null;n.handle?(l=e.querySelector(n.handle),l||(l=document.createElement("div"),l.className=n.handle.replace(".","")+(n.handleClass?` ${n.handleClass}`:""),l.style.cssText=`
431
431
  position: absolute;
432
432
  bottom: 0;
433
433
  left: 0;