@bagelink/vue 1.5.13 → 1.5.15

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.mjs CHANGED
@@ -14,7 +14,7 @@ var e=function(exports){function t(e){"@babel/helpers - typeof";return t=typeof
14
14
  transition: transform 0.1s;
15
15
  }
16
16
  `,document.head.appendChild(e)}}let s={animation:150,mode:`line`,ghostClass:`draggable-ghost`,dragClass:`draggable-dragging`,dropIndicatorClass:`draggable-drop-indicator`,...e},c=0,l=0,u=0,d=0,f=0,p,m=null,h=-1,g=0,_=150,v=new Map;function y(e){if(!o)return null;let t=e.cloneNode(!0),n=e.getBoundingClientRect();return t.style.position=`fixed`,t.style.margin=`0`,t.style.top=`${n.top}px`,t.style.left=`${n.left}px`,t.style.width=`${n.width}px`,t.style.height=`${n.height}px`,t.style.transform=`translate3d(0, 0, 0)`,t.style.pointerEvents=`none`,t.style.zIndex=`9999`,t.style.cursor=`grabbing`,t.style.willChange=`transform`,t.classList.add(s.ghostClass),document.body.appendChild(t),t}function b(e){if(!o)return null;let t=document.createElement(`div`);t.classList.add(s.dropIndicatorClass),t.style.position=`fixed`,t.style.pointerEvents=`none`,t.style.zIndex=`9999`,t.style.height=`2px`,t.style.background=`var(--primary-color, #0066ff)`,t.style.boxShadow=`0 0 4px rgba(0, 102, 255, 0.5)`,t.style.transition=`all 0.15s ease`,t.style.display=`none`;let n=document.createElement(`div`);return n.style.position=`absolute`,n.style.left=`-4px`,n.style.top=`-3px`,n.style.width=`8px`,n.style.height=`8px`,n.style.borderRadius=`50%`,n.style.background=`var(--primary-color, #0066ff)`,t.appendChild(n),document.body.appendChild(t),t}function x(e,t){if(!i.value)return;let n=e.getBoundingClientRect();i.value.style.display=`block`,i.value.style.width=`${n.width}px`,i.value.style.left=`${n.left}px`,t?i.value.style.top=`${n.bottom}px`:i.value.style.top=`${n.top}px`}function S(e){let t=e;for(;t&&(!(`__drag_group`in t)||t.dataset.draggable===`false`);)t=t.parentElement;return t}function C(e){return e.style.opacity=`0.4`,e.style.transform=`scale(0.95)`,e.offsetHeight}function w(e){return e.style.opacity=`0.5`,2}function T(e){v.clear(),e.forEach((e,t)=>{let n=e.getBoundingClientRect();v.set(t,{top:n.top,bottom:n.bottom})})}function E(e,t,n,r){let i=Date.now();if(i-g<_)return h===-1?n:h;v.size===0&&T(t);let a=e.clientY,o=t.indexOf(r),s=v.get(o);if(!s)return n;let c=s.bottom-s.top,l=a-s.top,u=c*.3,d=c*.7,f=o;return o===n?l>d&&(f+=1):o===h?f=o>n?l<u?o:o+1:l>d?o+1:o:l>c*.6&&(f+=1),h=f,g=i,f}function D(){if(o){if(document.removeEventListener(`mousemove`,ee),document.removeEventListener(`mouseup`,N),document.removeEventListener(`keydown`,O),document.removeEventListener(`touchmove`,F),document.removeEventListener(`touchend`,I),document.removeEventListener(`touchcancel`,I),window.removeEventListener(`blur`,D),r.value&&(r.value.style.opacity=`0`,r.value.style.transform+=` scale(0.8)`,setTimeout(()=>{var e;(e=r.value)==null||(e=e.parentNode)==null||e.removeChild(r.value),r.value=null},150)),i.value&&(i.value.style.opacity=`0`,setTimeout(()=>{var e;(e=i.value)==null||(e=e.parentNode)==null||e.removeChild(i.value),i.value=null},150)),n.value){let e=n.value.__drag_list;e?.forEach(e=>{e.style.transition=``,e.style.transform=``,e.style.opacity=``}),n.value.classList.remove(s.dragClass),n.value=null}t.value=!1,a.value=null,o&&(document.body.style.userSelect=``,document.body.style.webkitUserSelect=``,document.body.style.cursor=``),m&&(cancelAnimationFrame(m),m=null),h=-1,g=0,v.clear()}}function O(e){e.key===`Escape`&&t.value&&D()}function k(e){var a;if(!o||s.disabled||e.button!==0||e.ctrlKey||e.metaKey||e.shiftKey||e.altKey)return;let p=S(e.target);if(!p||p.dataset.draggable===`false`)return;if(s.handle){let t=e.target.closest(s.handle);if(!t||!p.contains(t))return}e.preventDefault(),t.value=!0,n.value=p,c=e.clientX,l=e.clientY;let m=p.getBoundingClientRect();u=m.left,d=m.top,r.value=y(p),r.value&&(r.value.style.left=`${u}px`,r.value.style.top=`${d}px`),s.mode===`line`&&(i.value=b(p)),p.classList.add(s.dragClass),f=s.mode===`ghost`?C(p):w(p),(a=s.onStart)?.call(s,e),o&&(document.body.style.userSelect=`none`,document.body.style.webkitUserSelect=`none`,document.body.style.cursor=`grabbing`,window.addEventListener(`blur`,D),document.addEventListener(`mousemove`,ee),document.addEventListener(`mouseup`,N),document.addEventListener(`keydown`,O))}function A(e){let t=e.parentElement;for(;t;){let{overflow:e,overflowY:n}=window.getComputedStyle(t);if(/auto|scroll/.test(e+n))return t;t=t.parentElement}return document.scrollingElement||document.documentElement||document.body}function j(e){n.value&&(m&&cancelAnimationFrame(m),m=requestAnimationFrame(()=>{let t=A(n.value),r=t.getBoundingClientRect(),i=50,a=Math.min(20,r.height*.1),{scrollTop:o}=t,s=t.scrollHeight-t.clientHeight;if(e.clientY-r.top<i){let e=Math.max(0,o-a);t.scrollTop=e}else if(r.bottom-e.clientY<i){let e=Math.min(s,o+a);t.scrollTop=e}}))}function ee(e){if(!t.value||!n.value)return;if(r.value){let t=e.clientX-c,n=e.clientY-l;r.value.style.transform=`translate3d(${t}px, ${n}px, 0)`}let o=n.value.__drag_list,u=o.filter(e=>e.dataset.draggable!==`false`),d=u.indexOf(n.value),p=document.elementFromPoint(e.clientX,e.clientY),m=S(p);if(!m||m.__drag_group!==n.value.__drag_group){i.value&&(i.value.style.display=`none`);return}let h=E(e,u,d,m);if(a.value!==m||a.value.__intended_index!==h){if(a.value=m,a.value.__intended_index=h,i.value&&s.mode===`line`){let e=h>d;x(m,e)}let e=f;u.forEach(t=>{if(t.style.transition=`transform ${s.animation}ms cubic-bezier(0.2, 0, 0, 1)`,t.style.transform=`translate3d(0, 0, 0)`,t===n.value){if(s.mode===`ghost`){let n=(h-d)*e;t.style.transform=`translate3d(0, ${n}px, 0)`}}else{let n=u.indexOf(t);d<h?n>d&&n<=h&&(t.style.transform=`translate3d(0, -${e}px, 0)`):d>h&&n>=h&&n<d&&(t.style.transform=`translate3d(0, ${e}px, 0)`)}})}j(e)}function N(e){if(!t.value||!n.value||!a.value){D();return}let r=n.value.__drag_list;if(!r||!r.length){D();return}let i=r.filter(e=>e.dataset.draggable!==`false`),o=i.indexOf(n.value),c=a.value.__intended_index;if(o!==-1&&c!==-1){var l;r.forEach(e=>{e.style.transition=`none`,e.style.transform=``}),document.body.offsetHeight;let t=new MouseEvent(`mouseup`,e);t.oldIndex=o,t.newIndex=c,t.item=n.value.__drag_data,(l=s.onEnd)?.call(s,t)}D()}function P(e){var a;if(!o||s.disabled||!e.target)return;let p=e.touches[0];if(!p)return;let m=e.target,h=S(m);if(!h)return;let{handle:g}=s;if(g&&!m.closest(g))return;e.preventDefault(),t.value=!0,n.value=h,c=p.clientX,l=p.clientY;let _=h.getBoundingClientRect();u=_.left,d=_.top,r.value=y(h),r.value&&(r.value.style.left=`${u}px`,r.value.style.top=`${d}px`),s.mode===`line`&&(i.value=b(h)),n.value.classList.add(s.dragClass),f=s.mode===`ghost`?C(n.value):w(n.value),(a=s.onStart)?.call(s,e),o&&(document.body.style.userSelect=`none`,document.body.style.webkitUserSelect=`none`,document.body.style.cursor=`grabbing`,window.addEventListener(`blur`,D),document.addEventListener(`touchmove`,F,{passive:!1}),document.addEventListener(`touchend`,I),document.addEventListener(`touchcancel`,I))}function F(e){e.preventDefault();let t=e.touches[0];if(!t)return;let n={clientX:t.clientX,clientY:t.clientY,target:document.elementFromPoint(t.clientX,t.clientY)};ee(n),j(n)}function I(e){let t=e.changedTouches[0];if(!t)return;let n={clientX:t.clientX,clientY:t.clientY,target:document.elementFromPoint(t.clientX,t.clientY)};N(n),document.removeEventListener(`touchmove`,F),document.removeEventListener(`touchend`,I),document.removeEventListener(`touchcancel`,I)}function L(s){if(!o)return;p?.(),t.value=!1,n.value=null,r.value=null,i.value=null,a.value=null;let c=Array.from(s.children);c.forEach(e=>{delete e.__drag_group,delete e.__drag_index,delete e.__drag_list});let l=0;c.forEach((t,n)=>{t.dataset.draggable!==`false`&&(t.style.userSelect=`none`,t.style.webkitUserSelect=`none`,t.__drag_group=e.group,t.__drag_index=l++,t.__drag_list=c.filter(e=>e.dataset.draggable!==`false`),e.items&&(t.__drag_data=e.items[n]),t.addEventListener(`mousedown`,k),t.addEventListener(`touchstart`,P))}),p=()=>{c.forEach(e=>{e.removeEventListener(`mousedown`,k),e.removeEventListener(`touchstart`,P),delete e.__drag_group,delete e.__drag_index,delete e.__drag_list}),D()}}return M(()=>{p?.()}),{isDragging:t,dragElement:n,initDraggableContainer:L}}var Vi=h({__name:`Draggable`,props:{modelValue:{},group:{},handle:{},mode:{default:`line`},disabled:{type:Boolean,default:!1}},emits:[`update:modelValue`,`start`,`end`],setup(e,{emit:t}){let r=e,i=t,a=R(),{initDraggableContainer:o}=Bi({group:r.group,handle:r.handle,mode:r.mode,disabled:r.disabled,items:r.modelValue,onStart:e=>{i(`start`,e)},onEnd:e=>{let t=[...r.modelValue],[n]=t.splice(e.oldIndex,1);t.splice(e.newIndex,0,n),i(`update:modelValue`,t),i(`end`,e),E(()=>{a.value&&o(a.value)})}});return q(()=>r.modelValue,()=>{a.value&&o(a.value)},{deep:!0}),j(()=>{a.value&&o(a.value)}),(e,t)=>(P(),u(`div`,{ref_key:`dragContainer`,ref:a},[(P(!0),u(n,null,z(e.modelValue,(t,n)=>B(e.$slots,`default`,{key:n,item:t,index:n})),128))],512))}}),Hi=Vi;const Ui={mounted(e,t){let{initDraggableContainer:n}=Bi(t.value||{});n(e)},updated(e,t){if(t.value!==t.oldValue){let{initDraggableContainer:n}=Bi(t.value||{});n(e)}}},Wi={key:0,class:`drag-overlay`};var Gi=h({__name:`DragOver`,props:{multiple:{type:Boolean},accept:{},disabled:{type:Boolean},browse:{type:Boolean}},emits:[`addFiles`],setup(e,{emit:t}){let n=e,r=t,i=R(!1),a=R(0);function o(e){n.disabled||(e.preventDefault(),e.stopPropagation(),a.value++,i.value=!0)}function s(e){n.disabled||(e.preventDefault(),e.stopPropagation())}function c(e){n.disabled||(e.preventDefault(),e.stopPropagation(),a.value--,a.value===0&&(i.value=!1))}function d(e){if(!n.browse||n.disabled)return;e.preventDefault(),e.stopPropagation();let t=document.createElement(`input`);t.type=`file`,t.multiple=!!n.multiple,t.accept=n.accept||`*`,t.onchange=e=>{let{files:t}=e.target;t&&r(`addFiles`,t)},t.click()}function f(e){n.disabled||(e.preventDefault(),e.stopPropagation(),a.value=0,i.value=!1,e.dataTransfer&&r(`addFiles`,e.dataTransfer.files))}return(e,t)=>(P(),u(`div`,{class:D([`drag-over-container`,{"is-dragging":i.value,"is-disabled":e.disabled}]),onDragenter:o,onDragover:s,onDragleave:c,onDrop:f,onClick:d},[B(e.$slots,`default`,{},void 0,!0),i.value&&!e.disabled?(P(),u(`div`,Wi,[m(G($),{name:`download`,color:`white`,size:`2`})])):l(``,!0)],34))}}),Ki=Y(Gi,[[`__scopeId`,`data-v-2d9b6701`]]);const qi=[`top`,`right`,`bottom`,`left`],Ji=[`start`,`end`],Yi=qi.reduce((e,t)=>e.concat(t,t+`-`+Ji[0],t+`-`+Ji[1]),[]),Xi=Math.min,Zi=Math.max,Qi={left:`right`,right:`left`,bottom:`top`,top:`bottom`},$i={start:`end`,end:`start`};function ea(e,t,n){return Zi(e,Xi(t,n))}function ta(e,t){return typeof e==`function`?e(t):e}function na(e){return e.split(`-`)[0]}function ra(e){return e.split(`-`)[1]}function ia(e){return e===`x`?`y`:`x`}function aa(e){return e===`y`?`height`:`width`}function oa(e){return[`top`,`bottom`].includes(na(e))?`y`:`x`}function sa(e){return ia(oa(e))}function ca(e,t,n){n===void 0&&(n=!1);let r=ra(e),i=sa(e),a=aa(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=pa(o)),[o,pa(o)]}function la(e){let t=pa(e);return[ua(e),t,ua(t)]}function ua(e){return e.replace(/start|end/g,e=>$i[e])}function da(e,t,n){let r=[`left`,`right`],i=[`right`,`left`],a=[`top`,`bottom`],o=[`bottom`,`top`];switch(e){case`top`:case`bottom`:return n?t?i:r:t?r:i;case`left`:case`right`:return t?a:o;default:return[]}}function fa(e,t,n,r){let i=ra(e),a=da(na(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(ua)))),a}function pa(e){return e.replace(/left|right|bottom|top/g,e=>Qi[e])}function ma(e){return{top:0,right:0,bottom:0,left:0,...e}}function ha(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:ma(e)}function ga(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function _a(e,t,n){let{reference:r,floating:i}=e,a=oa(t),o=sa(t),s=aa(o),c=na(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(ra(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}const va=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=_a(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=_a(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}};async function ya(e,t){var n;t===void 0&&(t={});let{x:r,y:i,platform:a,rects:o,elements:s,strategy:c}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=ta(t,e),m=ha(p),h=d===`floating`?`reference`:`floating`,g=s[f?h:d],_=ga(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(g)))??!0?g:g.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:c})),v=d===`floating`?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,y=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),b=await(a.isElement==null?void 0:a.isElement(y))&&await(a.getScale==null?void 0:a.getScale(y))||{x:1,y:1},x=ga(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:v,offsetParent:y,strategy:c}):v);return{top:(_.top-x.top+m.top)/b.y,bottom:(x.bottom-_.bottom+m.bottom)/b.y,left:(_.left-x.left+m.left)/b.x,right:(x.right-_.right+m.right)/b.x}}const ba=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=ta(e,t)||{};if(l==null)return{};let d=ha(u),f={x:n,y:r},p=sa(i),m=aa(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=Xi(d[_],T),D=Xi(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=ea(O,A,k),ee=!c.arrow&&ra(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,M=ee?A<O?A-O:A-k:0;return{[p]:f[p]+M,data:{[p]:j,centerOffset:A-j-M,...ee&&{alignmentOffset:M}},reset:ee}}});function xa(e,t,n){let r=e?[...n.filter(t=>ra(t)===e),...n.filter(t=>ra(t)!==e)]:n.filter(e=>na(e)===e);return r.filter(n=>e?ra(n)===e||(t?ua(n)!==n:!1):!0)}const Sa=function(e){return e===void 0&&(e={}),{name:`autoPlacement`,options:e,async fn(t){var n,r,i;let{rects:a,middlewareData:o,placement:s,platform:c,elements:l}=t,{crossAxis:u=!1,alignment:d,allowedPlacements:f=Yi,autoAlignment:p=!0,...m}=ta(e,t),h=d!==void 0||f===Yi?xa(d||null,p,f):f,g=await ya(t,m),_=(n=o.autoPlacement)?.index||0,v=h[_];if(v==null)return{};let y=ca(v,a,await(c.isRTL==null?void 0:c.isRTL(l.floating)));if(s!==v)return{reset:{placement:h[0]}};let b=[g[na(v)],g[y[0]],g[y[1]]],x=[...(r=o.autoPlacement)?.overflows||[],{placement:v,overflows:b}],S=h[_+1];if(S)return{data:{index:_+1,overflows:x},reset:{placement:S}};let C=x.map(e=>{let t=ra(e.placement);return[e.placement,t&&u?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),w=C.filter(e=>e[2].slice(0,ra(e[0])?2:3).every(e=>e<=0)),T=(i=w[0])?.[0]||C[0][0];return T===s?{}:{data:{index:_+1,overflows:x},reset:{placement:T}}}}},Ca=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n,r;let{placement:i,middlewareData:a,rects:o,initialPlacement:s,platform:c,elements:l}=t,{mainAxis:u=!0,crossAxis:d=!0,fallbackPlacements:f,fallbackStrategy:p=`bestFit`,fallbackAxisSideDirection:m=`none`,flipAlignment:h=!0,...g}=ta(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};let _=na(i),v=oa(s),y=na(s)===s,b=await(c.isRTL==null?void 0:c.isRTL(l.floating)),x=f||(y||!h?[pa(s)]:la(s)),S=m!==`none`;!f&&S&&x.push(...fa(s,h,m,b));let C=[s,...x],w=await ya(t,g),T=[],E=(r=a.flip)?.overflows||[];if(u&&T.push(w[_]),d){let e=ca(i,o,b);T.push(w[e[0]],w[e[1]])}if(E=[...E,{placement:i,overflows:T}],!T.every(e=>e<=0)){var D,O;let e=((D=a.flip)?.index||0)+1,t=C[e];if(t){var k;let n=d===`alignment`?v!==oa(t):!1,r=(k=E[0])?.overflows[0]>0;if(!n||r)return{data:{index:e,overflows:E},reset:{placement:t}}}let n=(O=E.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0])?.placement;if(!n)switch(p){case`bestFit`:{var A;let e=(A=E.filter(e=>{if(S){let t=oa(e.placement);return t===v||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0])?.[0];e&&(n=e);break}case`initialPlacement`:n=s;break}if(i!==n)return{reset:{placement:n}}}return{}}}};async function wa(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=na(n),s=ra(n),c=oa(n)===`y`,l=[`left`,`top`].includes(o)?-1:1,u=a&&c?-1:1,d=ta(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}const Ta=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n,r;let{x:i,y:a,placement:o,middlewareData:s}=t,c=await wa(t,e);return o===(n=s.offset)?.placement&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:i+c.x,y:a+c.y,data:{...c,placement:o}}}}},Ea=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=ta(e,t),l={x:n,y:r},u=await ya(t,c),d=oa(na(i)),f=ia(d),p=l[f],m=l[d];if(a){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=p+u[e],r=p-u[t];p=ea(n,p,r)}if(o){let e=d===`y`?`top`:`left`,t=d===`y`?`bottom`:`right`,n=m+u[e],r=m-u[t];m=ea(n,m,r)}let h=s.fn({...t,[f]:p,[d]:m});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:a,[d]:o}}}}}},Da=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=ta(e,t),u=await ya(t,l),d=na(i),f=ra(i),p=oa(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=Xi(h-u[g],v),x=Xi(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=Zi(u.left,0),t=Zi(u.right,0),n=Zi(u.top,0),r=Zi(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:Zi(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:Zi(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function Oa(e){var t;return(t=e.ownerDocument)?.defaultView||window}function ka(e){return Oa(e).getComputedStyle(e)}const Aa=Math.min,ja=Math.max,Ma=Math.round;function Na(e){let t=ka(e),n=parseFloat(t.width),r=parseFloat(t.height),i=e.offsetWidth,a=e.offsetHeight,o=Ma(n)!==i||Ma(r)!==a;return o&&(n=i,r=a),{width:n,height:r,fallback:o}}function Pa(e){return za(e)?(e.nodeName||``).toLowerCase():``}let Fa;function Ia(){if(Fa)return Fa;let e=navigator.userAgentData;return e&&Array.isArray(e.brands)?(Fa=e.brands.map(e=>e.brand+`/`+e.version).join(` `),Fa):navigator.userAgent}function La(e){return e instanceof Oa(e).HTMLElement}function Ra(e){return e instanceof Oa(e).Element}function za(e){return e instanceof Oa(e).Node}function Ba(e){return typeof ShadowRoot>`u`?!1:e instanceof Oa(e).ShadowRoot||e instanceof ShadowRoot}function Va(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=ka(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&![`inline`,`contents`].includes(i)}function Ha(e){return[`table`,`td`,`th`].includes(Pa(e))}function Ua(e){let t=/firefox/i.test(Ia()),n=ka(e),r=n.backdropFilter||n.WebkitBackdropFilter;return n.transform!==`none`||n.perspective!==`none`||!!r&&r!==`none`||t&&n.willChange===`filter`||t&&!!n.filter&&n.filter!==`none`||[`transform`,`perspective`].some(e=>n.willChange.includes(e))||[`paint`,`layout`,`strict`,`content`].some(e=>{let t=n.contain;return t!=null&&t.includes(e)})}function Wa(){return!/^((?!chrome|android).)*safari/i.test(Ia())}function Ga(e){return[`html`,`body`,`#document`].includes(Pa(e))}function Ka(e){return Ra(e)?e:e.contextElement}const qa={x:1,y:1};function Ja(e){let t=Ka(e);if(!La(t))return qa;let n=t.getBoundingClientRect(),{width:r,height:i,fallback:a}=Na(t),o=(a?Ma(n.width):n.width)/r,s=(a?Ma(n.height):n.height)/i;return o&&Number.isFinite(o)||(o=1),s&&Number.isFinite(s)||(s=1),{x:o,y:s}}function Ya(e,t,n,r){var i,a;t===void 0&&(t=!1),n===void 0&&(n=!1);let o=e.getBoundingClientRect(),s=Ka(e),c=qa;t&&(r?Ra(r)&&(c=Ja(r)):c=Ja(e));let l=s?Oa(s):window,u=!Wa()&&n,d=(o.left+(u&&(i=l.visualViewport)?.offsetLeft||0))/c.x,f=(o.top+(u&&(a=l.visualViewport)?.offsetTop||0))/c.y,p=o.width/c.x,m=o.height/c.y;if(s){let e=Oa(s),t=r&&Ra(r)?Oa(r):r,n=e.frameElement;for(;n&&r&&t!==e;){let e=Ja(n),t=n.getBoundingClientRect(),r=getComputedStyle(n);t.x+=(n.clientLeft+parseFloat(r.paddingLeft))*e.x,t.y+=(n.clientTop+parseFloat(r.paddingTop))*e.y,d*=e.x,f*=e.y,p*=e.x,m*=e.y,d+=t.x,f+=t.y,n=Oa(n).frameElement}}return{width:p,height:m,top:f,right:d+p,bottom:f+m,left:d,x:d,y:f}}function Xa(e){return((za(e)?e.ownerDocument:e.document)||window.document).documentElement}function Za(e){return Ra(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.pageXOffset,scrollTop:e.pageYOffset}}function Qa(e){return Ya(Xa(e)).left+Za(e).scrollLeft}function $a(e){if(Pa(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ba(e)&&e.host||Xa(e);return Ba(t)?t.host:t}function eo(e){let t=$a(e);return Ga(t)?t.ownerDocument.body:La(t)&&Va(t)?t:eo(t)}function to(e,t){var n;t===void 0&&(t=[]);let r=eo(e),i=r===(n=e.ownerDocument)?.body,a=Oa(r);return i?t.concat(a,a.visualViewport||[],Va(r)?r:[]):t.concat(r,to(r))}function no(e,t,n){return t===`viewport`?ga(function(e,t){let n=Oa(e),r=Xa(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=Wa();(e||!e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}return{width:a,height:o,x:s,y:c}}(e,n)):Ra(t)?ga(function(e,t){let n=Ya(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=La(e)?Ja(e):{x:1,y:1};return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}(t,n)):ga(function(e){let t=Xa(e),n=Za(e),r=e.ownerDocument.body,i=ja(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=ja(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+Qa(e),s=-n.scrollTop;return ka(r).direction===`rtl`&&(o+=ja(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}(Xa(e)))}function ro(e){return La(e)&&ka(e).position!==`fixed`?e.offsetParent:null}function io(e){let t=Oa(e),n=ro(e);for(;n&&Ha(n)&&ka(n).position===`static`;)n=ro(n);return n&&(Pa(n)===`html`||Pa(n)===`body`&&ka(n).position===`static`&&!Ua(n))?t:n||function(e){let t=$a(e);for(;La(t)&&!Ga(t);){if(Ua(t))return t;t=$a(t)}return null}(e)||t}function ao(e,t,n){let r=La(t),i=Xa(t),a=Ya(e,!0,n===`fixed`,t),o={scrollLeft:0,scrollTop:0},s={x:0,y:0};if(r||!r&&n!==`fixed`)if((Pa(t)!==`body`||Va(i))&&(o=Za(t)),La(t)){let e=Ya(t,!0);s.x=e.x+t.clientLeft,s.y=e.y+t.clientTop}else i&&(s.x=Qa(i));return{x:a.left+o.scrollLeft-s.x,y:a.top+o.scrollTop-s.y,width:a.width,height:a.height}}const oo={getClippingRect:function(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=n===`clippingAncestors`?function(e,t){let n=t.get(e);if(n)return n;let r=to(e).filter(e=>Ra(e)&&Pa(e)!==`body`),i=null,a=ka(e).position===`fixed`,o=a?$a(e):e;for(;Ra(o)&&!Ga(o);){let e=ka(o),t=Ua(o);(a?t||i:t||e.position!==`static`||!i||![`absolute`,`fixed`].includes(i.position))?i=e:r=r.filter(e=>e!==o),o=$a(o)}return t.set(e,r),r}(t,this._c):[].concat(n),o=[...a,r],s=o[0],c=o.reduce((e,n)=>{let r=no(t,n,i);return e.top=ja(r.top,e.top),e.right=Aa(r.right,e.right),e.bottom=Aa(r.bottom,e.bottom),e.left=ja(r.left,e.left),e},no(t,s,i));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}},convertOffsetParentRelativeRectToViewportRelativeRect:function(e){let{rect:t,offsetParent:n,strategy:r}=e,i=La(n),a=Xa(n);if(n===a)return t;let o={scrollLeft:0,scrollTop:0},s={x:1,y:1},c={x:0,y:0};if((i||!i&&r!==`fixed`)&&((Pa(n)!==`body`||Va(a))&&(o=Za(n)),La(n))){let e=Ya(n);s=Ja(n),c.x=e.x+n.clientLeft,c.y=e.y+n.clientTop}return{width:t.width*s.x,height:t.height*s.y,x:t.x*s.x-o.scrollLeft*s.x+c.x,y:t.y*s.y-o.scrollTop*s.y+c.y}},isElement:Ra,getDimensions:function(e){return La(e)?Na(e):e.getBoundingClientRect()},getOffsetParent:io,getDocumentElement:Xa,getScale:Ja,async getElementRects(e){let{reference:t,floating:n,strategy:r}=e,i=this.getOffsetParent||io,a=this.getDimensions;return{reference:ao(t,await i(n),r),floating:{x:0,y:0,...await a(n)}}},getClientRects:e=>Array.from(e.getClientRects()),isRTL:e=>ka(e).direction===`rtl`},so=(e,t,n)=>{let r=new Map,i={platform:oo,...n},a={...i.platform,_c:r};return va(e,t,{...i,platform:a})};function co(e,t){for(let n in t)Object.prototype.hasOwnProperty.call(t,n)&&(typeof t[n]==`object`&&e[n]?co(e[n],t[n]):e[n]=t[n])}const lo={disabled:!1,distance:5,skidding:0,container:`body`,boundary:void 0,instantMove:!1,disposeTimeout:150,popperTriggers:[],strategy:`absolute`,preventOverflow:!0,flip:!0,shift:!0,overflowPadding:0,arrowPadding:0,arrowOverflow:!0,autoHideOnMousedown:!1,themes:{tooltip:{placement:`top`,triggers:[`hover`,`focus`,`touch`],hideTriggers:e=>[...e,`click`],delay:{show:200,hide:0},handleResize:!1,html:!1,loadingContent:`...`},dropdown:{placement:`bottom`,triggers:[`click`],delay:0,handleResize:!0,autoHide:!0},menu:{$extend:`dropdown`,triggers:[`hover`,`focus`],popperTriggers:[`hover`],delay:{show:0,hide:400}}}};function uo(e,t){let n=lo.themes[e]||{},r;do r=n[t],typeof r>`u`?n.$extend?n=lo.themes[n.$extend]||{}:(n=null,r=lo[t]):n=null;while(n);return r}function fo(e){let t=[e],n=lo.themes[e]||{};do n.$extend&&!n.$resetCss?(t.push(n.$extend),n=lo.themes[n.$extend]||{}):n=null;while(n);return t.map(e=>`v-popper--theme-${e}`)}function po(e){let t=[e],n=lo.themes[e]||{};do n.$extend?(t.push(n.$extend),n=lo.themes[n.$extend]||{}):n=null;while(n);return t}let mo=!1;if(typeof window<`u`){mo=!1;try{let e=Object.defineProperty({},`passive`,{get(){mo=!0}});window.addEventListener(`test`,null,e)}catch{}}let ho=!1;typeof window<`u`&&typeof navigator<`u`&&(ho=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream);const go=[`auto`,`top`,`bottom`,`left`,`right`].reduce((e,t)=>e.concat([t,`${t}-start`,`${t}-end`]),[]),_o={hover:`mouseenter`,focus:`focus`,click:`click`,touch:`touchstart`,pointer:`pointerdown`},vo={hover:`mouseleave`,focus:`blur`,click:`click`,touch:`touchend`,pointer:`pointerup`};function yo(e,t){let n=e.indexOf(t);n!==-1&&e.splice(n,1)}function bo(){return new Promise(e=>requestAnimationFrame(()=>{requestAnimationFrame(e)}))}const xo=[];let So=null;const Co={};function wo(e){let t=Co[e];return t||=Co[e]=[],t}let To=function(){};typeof window<`u`&&(To=window.Element);function Eo(e){return function(t){return uo(t.theme,e)}}const Do=`__floating-vue__popper`,Oo=()=>h({name:`VPopper`,provide(){return{[Do]:{parentPopper:this}}},inject:{[Do]:{default:null}},props:{theme:{type:String,required:!0},targetNodes:{type:Function,required:!0},referenceNode:{type:Function,default:null},popperNode:{type:Function,required:!0},shown:{type:Boolean,default:!1},showGroup:{type:String,default:null},ariaId:{default:null},disabled:{type:Boolean,default:Eo(`disabled`)},positioningDisabled:{type:Boolean,default:Eo(`positioningDisabled`)},placement:{type:String,default:Eo(`placement`),validator:e=>go.includes(e)},delay:{type:[String,Number,Object],default:Eo(`delay`)},distance:{type:[Number,String],default:Eo(`distance`)},skidding:{type:[Number,String],default:Eo(`skidding`)},triggers:{type:Array,default:Eo(`triggers`)},showTriggers:{type:[Array,Function],default:Eo(`showTriggers`)},hideTriggers:{type:[Array,Function],default:Eo(`hideTriggers`)},popperTriggers:{type:Array,default:Eo(`popperTriggers`)},popperShowTriggers:{type:[Array,Function],default:Eo(`popperShowTriggers`)},popperHideTriggers:{type:[Array,Function],default:Eo(`popperHideTriggers`)},container:{type:[String,Object,To,Boolean],default:Eo(`container`)},boundary:{type:[String,To],default:Eo(`boundary`)},strategy:{type:String,validator:e=>[`absolute`,`fixed`].includes(e),default:Eo(`strategy`)},autoHide:{type:[Boolean,Function],default:Eo(`autoHide`)},handleResize:{type:Boolean,default:Eo(`handleResize`)},instantMove:{type:Boolean,default:Eo(`instantMove`)},eagerMount:{type:Boolean,default:Eo(`eagerMount`)},popperClass:{type:[String,Array,Object],default:Eo(`popperClass`)},computeTransformOrigin:{type:Boolean,default:Eo(`computeTransformOrigin`)},autoMinSize:{type:Boolean,default:Eo(`autoMinSize`)},autoSize:{type:[Boolean,String],default:Eo(`autoSize`)},autoMaxSize:{type:Boolean,default:Eo(`autoMaxSize`)},autoBoundaryMaxSize:{type:Boolean,default:Eo(`autoBoundaryMaxSize`)},preventOverflow:{type:Boolean,default:Eo(`preventOverflow`)},overflowPadding:{type:[Number,String],default:Eo(`overflowPadding`)},arrowPadding:{type:[Number,String],default:Eo(`arrowPadding`)},arrowOverflow:{type:Boolean,default:Eo(`arrowOverflow`)},flip:{type:Boolean,default:Eo(`flip`)},shift:{type:Boolean,default:Eo(`shift`)},shiftCrossAxis:{type:Boolean,default:Eo(`shiftCrossAxis`)},noAutoFocus:{type:Boolean,default:Eo(`noAutoFocus`)},disposeTimeout:{type:Number,default:Eo(`disposeTimeout`)}},emits:{show:()=>!0,hide:()=>!0,"update:shown":e=>!0,"apply-show":()=>!0,"apply-hide":()=>!0,"close-group":()=>!0,"close-directive":()=>!0,"auto-hide":()=>!0,resize:()=>!0},data(){return{isShown:!1,isMounted:!1,skipTransition:!1,classes:{showFrom:!1,showTo:!1,hideFrom:!1,hideTo:!0},result:{x:0,y:0,placement:``,strategy:this.strategy,arrow:{x:0,y:0,centerOffset:0},transformOrigin:null},randomId:`popper_${[Math.random(),Date.now()].map(e=>e.toString(36).substring(2,10)).join(`_`)}`,shownChildren:new Set,lastAutoHide:!0,pendingHide:!1,containsGlobalTarget:!1,isDisposed:!0,mouseDownContains:!1}},computed:{popperId(){return this.ariaId==null?this.randomId:this.ariaId},shouldMountContent(){return this.eagerMount||this.isMounted},slotData(){return{popperId:this.popperId,isShown:this.isShown,shouldMountContent:this.shouldMountContent,skipTransition:this.skipTransition,autoHide:typeof this.autoHide==`function`?this.lastAutoHide:this.autoHide,show:this.show,hide:this.hide,handleResize:this.handleResize,onResize:this.onResize,classes:{...this.classes,popperClass:this.popperClass},result:this.positioningDisabled?null:this.result,attrs:this.$attrs}},parentPopper(){var e;return(e=this[Do])?.parentPopper},hasPopperShowTriggerHover(){var e,t;return(e=this.popperTriggers)?.includes(`hover`)||(t=this.popperShowTriggers)?.includes(`hover`)}},watch:{shown:`$_autoShowHide`,disabled(e){e?this.dispose():this.init()},async container(){this.isShown&&(this.$_ensureTeleport(),await this.$_computePosition())},triggers:{handler:`$_refreshListeners`,deep:!0},positioningDisabled:`$_refreshListeners`,...[`placement`,`distance`,`skidding`,`boundary`,`strategy`,`overflowPadding`,`arrowPadding`,`preventOverflow`,`shift`,`shiftCrossAxis`,`flip`].reduce((e,t)=>(e[t]=`$_computePosition`,e),{})},created(){this.autoMinSize&&console.warn('[floating-vue] `autoMinSize` option is deprecated. Use `autoSize="min"` instead.'),this.autoMaxSize&&console.warn("[floating-vue] `autoMaxSize` option is deprecated. Use `autoBoundaryMaxSize` instead.")},mounted(){this.init(),this.$_detachPopperNode()},activated(){this.$_autoShowHide()},deactivated(){this.hide()},beforeUnmount(){this.dispose()},methods:{show({event:e=null,skipDelay:t=!1,force:n=!1}={}){var r,i;(r=this.parentPopper)!=null&&r.lockedChild&&this.parentPopper.lockedChild!==this||(this.pendingHide=!1,(n||!this.disabled)&&((i=this.parentPopper)?.lockedChild===this&&(this.parentPopper.lockedChild=null),this.$_scheduleShow(e,t),this.$emit(`show`),this.$_showFrameLocked=!0,requestAnimationFrame(()=>{this.$_showFrameLocked=!1})),this.$emit(`update:shown`,!0))},hide({event:e=null,skipDelay:t=!1}={}){var n;if(!this.$_hideInProgress){if(this.shownChildren.size>0){this.pendingHide=!0;return}if(this.hasPopperShowTriggerHover&&this.$_isAimingPopper()){this.parentPopper&&(this.parentPopper.lockedChild=this,clearTimeout(this.parentPopper.lockedChildTimer),this.parentPopper.lockedChildTimer=setTimeout(()=>{this.parentPopper.lockedChild===this&&(this.parentPopper.lockedChild.hide({skipDelay:t}),this.parentPopper.lockedChild=null)},1e3));return}(n=this.parentPopper)?.lockedChild===this&&(this.parentPopper.lockedChild=null),this.pendingHide=!1,this.$_scheduleHide(e,t),this.$emit(`hide`),this.$emit(`update:shown`,!1)}},init(){var e;this.isDisposed&&(this.isDisposed=!1,this.isMounted=!1,this.$_events=[],this.$_preventShow=!1,this.$_referenceNode=(e=this.referenceNode)?.call(this)??this.$el,this.$_targetNodes=this.targetNodes().filter(e=>e.nodeType===e.ELEMENT_NODE),this.$_popperNode=this.popperNode(),this.$_innerNode=this.$_popperNode.querySelector(`.v-popper__inner`),this.$_arrowNode=this.$_popperNode.querySelector(`.v-popper__arrow-container`),this.$_swapTargetAttrs(`title`,`data-original-title`),this.$_detachPopperNode(),this.triggers.length&&this.$_addEventListeners(),this.shown&&this.show())},dispose(){this.isDisposed||(this.isDisposed=!0,this.$_removeEventListeners(),this.hide({skipDelay:!0}),this.$_detachPopperNode(),this.isMounted=!1,this.isShown=!1,this.$_updateParentShownChildren(!1),this.$_swapTargetAttrs(`data-original-title`,`title`))},async onResize(){this.isShown&&(await this.$_computePosition(),this.$emit(`resize`))},async $_computePosition(){if(this.isDisposed||this.positioningDisabled)return;let e={strategy:this.strategy,middleware:[]};(this.distance||this.skidding)&&e.middleware.push(Ta({mainAxis:this.distance,crossAxis:this.skidding}));let t=this.placement.startsWith(`auto`);if(t?e.middleware.push(Sa({alignment:this.placement.split(`-`)[1]??``})):e.placement=this.placement,this.preventOverflow&&(this.shift&&e.middleware.push(Ea({padding:this.overflowPadding,boundary:this.boundary,crossAxis:this.shiftCrossAxis})),!t&&this.flip&&e.middleware.push(Ca({padding:this.overflowPadding,boundary:this.boundary}))),e.middleware.push(ba({element:this.$_arrowNode,padding:this.arrowPadding})),this.arrowOverflow&&e.middleware.push({name:`arrowOverflow`,fn:({placement:e,rects:t,middlewareData:n})=>{let r,{centerOffset:i}=n.arrow;return r=e.startsWith(`top`)||e.startsWith(`bottom`)?Math.abs(i)>t.reference.width/2:Math.abs(i)>t.reference.height/2,{data:{overflow:r}}}}),this.autoMinSize||this.autoSize){let t=this.autoSize?this.autoSize:this.autoMinSize?`min`:null;e.middleware.push({name:`autoSize`,fn:({rects:e,placement:n,middlewareData:r})=>{var i;if((i=r.autoSize)!=null&&i.skip)return{};let a,o;return n.startsWith(`top`)||n.startsWith(`bottom`)?a=e.reference.width:o=e.reference.height,this.$_innerNode.style[t===`min`?`minWidth`:t===`max`?`maxWidth`:`width`]=a==null?null:`${a}px`,this.$_innerNode.style[t===`min`?`minHeight`:t===`max`?`maxHeight`:`height`]=o==null?null:`${o}px`,{data:{skip:!0},reset:{rects:!0}}}})}(this.autoMaxSize||this.autoBoundaryMaxSize)&&(this.$_innerNode.style.maxWidth=null,this.$_innerNode.style.maxHeight=null,e.middleware.push(Da({boundary:this.boundary,padding:this.overflowPadding,apply:({availableWidth:e,availableHeight:t})=>{this.$_innerNode.style.maxWidth=e==null?null:`${e}px`,this.$_innerNode.style.maxHeight=t==null?null:`${t}px`}})));let n=await so(this.$_referenceNode,this.$_popperNode,e);Object.assign(this.result,{x:n.x,y:n.y,placement:n.placement,strategy:n.strategy,arrow:{...n.middlewareData.arrow,...n.middlewareData.arrowOverflow}})},$_scheduleShow(e,t=!1){if(this.$_updateParentShownChildren(!0),this.$_hideInProgress=!1,clearTimeout(this.$_scheduleTimer),So&&this.instantMove&&So.instantMove&&So!==this.parentPopper){So.$_applyHide(!0),this.$_applyShow(!0);return}t?this.$_applyShow():this.$_scheduleTimer=setTimeout(this.$_applyShow.bind(this),this.$_computeDelay(`show`))},$_scheduleHide(e,t=!1){if(this.shownChildren.size>0){this.pendingHide=!0;return}this.$_updateParentShownChildren(!1),this.$_hideInProgress=!0,clearTimeout(this.$_scheduleTimer),this.isShown&&(So=this),t?this.$_applyHide():this.$_scheduleTimer=setTimeout(this.$_applyHide.bind(this),this.$_computeDelay(`hide`))},$_computeDelay(e){let t=this.delay;return parseInt(t&&t[e]||t||0)},async $_applyShow(e=!1){clearTimeout(this.$_disposeTimer),clearTimeout(this.$_scheduleTimer),this.skipTransition=e,!this.isShown&&(this.$_ensureTeleport(),await bo(),await this.$_computePosition(),await this.$_applyShowEffect(),this.positioningDisabled||this.$_registerEventListeners([...to(this.$_referenceNode),...to(this.$_popperNode)],`scroll`,()=>{this.$_computePosition()}))},async $_applyShowEffect(){if(this.$_hideInProgress)return;if(this.computeTransformOrigin){let e=this.$_referenceNode.getBoundingClientRect(),t=this.$_popperNode.querySelector(`.v-popper__wrapper`),n=t.parentNode.getBoundingClientRect(),r=e.x+e.width/2-(n.left+t.offsetLeft),i=e.y+e.height/2-(n.top+t.offsetTop);this.result.transformOrigin=`${r}px ${i}px`}this.isShown=!0,this.$_applyAttrsToTarget({"aria-describedby":this.popperId,"data-popper-shown":``});let e=this.showGroup;if(e){let t;for(let n=0;n<xo.length;n++)t=xo[n],t.showGroup!==e&&(t.hide(),t.$emit(`close-group`))}xo.push(this),document.body.classList.add(`v-popper--some-open`);for(let e of po(this.theme))wo(e).push(this),document.body.classList.add(`v-popper--some-open--${e}`);this.$emit(`apply-show`),this.classes.showFrom=!0,this.classes.showTo=!1,this.classes.hideFrom=!1,this.classes.hideTo=!1,await bo(),this.classes.showFrom=!1,this.classes.showTo=!0,this.noAutoFocus||this.$_popperNode.focus()},async $_applyHide(e=!1){if(this.shownChildren.size>0){this.pendingHide=!0,this.$_hideInProgress=!1;return}if(clearTimeout(this.$_scheduleTimer),!this.isShown)return;this.skipTransition=e,yo(xo,this),xo.length===0&&document.body.classList.remove(`v-popper--some-open`);for(let e of po(this.theme)){let t=wo(e);yo(t,this),t.length===0&&document.body.classList.remove(`v-popper--some-open--${e}`)}So===this&&(So=null),this.isShown=!1,this.$_applyAttrsToTarget({"aria-describedby":void 0,"data-popper-shown":void 0}),clearTimeout(this.$_disposeTimer);let t=this.disposeTimeout;t!==null&&(this.$_disposeTimer=setTimeout(()=>{this.$_popperNode&&(this.$_detachPopperNode(),this.isMounted=!1)},t)),this.$_removeEventListeners(`scroll`),this.$emit(`apply-hide`),this.classes.showFrom=!1,this.classes.showTo=!1,this.classes.hideFrom=!0,this.classes.hideTo=!1,await bo(),this.classes.hideFrom=!1,this.classes.hideTo=!0},$_autoShowHide(){this.shown?this.show():this.hide()},$_ensureTeleport(){if(this.isDisposed)return;let e=this.container;if(typeof e==`string`?e=window.document.querySelector(e):e===!1&&(e=this.$_targetNodes[0].parentNode),!e)throw Error(`No container for popover: `+this.container);e.appendChild(this.$_popperNode),this.isMounted=!0},$_addEventListeners(){let e=e=>{this.isShown&&!this.$_hideInProgress||(e.usedByTooltip=!0,!this.$_preventShow&&this.show({event:e}))};this.$_registerTriggerListeners(this.$_targetNodes,_o,this.triggers,this.showTriggers,e),this.$_registerTriggerListeners([this.$_popperNode],_o,this.popperTriggers,this.popperShowTriggers,e);let t=e=>{e.usedByTooltip||this.hide({event:e})};this.$_registerTriggerListeners(this.$_targetNodes,vo,this.triggers,this.hideTriggers,t),this.$_registerTriggerListeners([this.$_popperNode],vo,this.popperTriggers,this.popperHideTriggers,t)},$_registerEventListeners(e,t,n){this.$_events.push({targetNodes:e,eventType:t,handler:n}),e.forEach(e=>e.addEventListener(t,n,mo?{passive:!0}:void 0))},$_registerTriggerListeners(e,t,n,r,i){let a=n;r!=null&&(a=typeof r==`function`?r(a):r),a.forEach(n=>{let r=t[n];r&&this.$_registerEventListeners(e,r,i)})},$_removeEventListeners(e){let t=[];this.$_events.forEach(n=>{let{targetNodes:r,eventType:i,handler:a}=n;!e||e===i?r.forEach(e=>e.removeEventListener(i,a)):t.push(n)}),this.$_events=t},$_refreshListeners(){this.isDisposed||(this.$_removeEventListeners(),this.$_addEventListeners())},$_handleGlobalClose(e,t=!1){this.$_showFrameLocked||(this.hide({event:e}),e.closePopover?this.$emit(`close-directive`):this.$emit(`auto-hide`),t&&(this.$_preventShow=!0,setTimeout(()=>{this.$_preventShow=!1},300)))},$_detachPopperNode(){this.$_popperNode.parentNode&&this.$_popperNode.parentNode.removeChild(this.$_popperNode)},$_swapTargetAttrs(e,t){for(let n of this.$_targetNodes){let r=n.getAttribute(e);r&&(n.removeAttribute(e),n.setAttribute(t,r))}},$_applyAttrsToTarget(e){for(let t of this.$_targetNodes)for(let n in e){let r=e[n];r==null?t.removeAttribute(n):t.setAttribute(n,r)}},$_updateParentShownChildren(e){let t=this.parentPopper;for(;t;)e?t.shownChildren.add(this.randomId):(t.shownChildren.delete(this.randomId),t.pendingHide&&t.hide()),t=t.parentPopper},$_isAimingPopper(){let e=this.$_referenceNode.getBoundingClientRect();if(Lo>=e.left&&Lo<=e.right&&Ro>=e.top&&Ro<=e.bottom){let e=this.$_popperNode.getBoundingClientRect(),t=Lo-Fo,n=Ro-Io,r=e.left+e.width/2-Fo+(e.top+e.height/2)-Io+e.width+e.height,i=Fo+t*r,a=Io+n*r;return zo(Fo,Io,i,a,e.left,e.top,e.left,e.bottom)||zo(Fo,Io,i,a,e.left,e.top,e.right,e.top)||zo(Fo,Io,i,a,e.right,e.top,e.right,e.bottom)||zo(Fo,Io,i,a,e.left,e.bottom,e.right,e.bottom)}return!1}},render(){return this.$slots.default(this.slotData)}});if(typeof document<`u`&&typeof window<`u`){if(ho){let e=mo?{passive:!0,capture:!0}:!0;document.addEventListener(`touchstart`,e=>ko(e,!0),e),document.addEventListener(`touchend`,e=>Ao(e,!0),e)}else window.addEventListener(`mousedown`,e=>ko(e,!1),!0),window.addEventListener(`click`,e=>Ao(e,!1),!0);window.addEventListener(`resize`,Po)}function ko(e,t){if(lo.autoHideOnMousedown)jo(e,t);else for(let t=0;t<xo.length;t++){let n=xo[t];try{n.mouseDownContains=n.popperNode().contains(e.target)}catch{}}}function Ao(e,t){lo.autoHideOnMousedown||jo(e,t)}function jo(e,t){let n={};for(let r=xo.length-1;r>=0;r--){let i=xo[r];try{let r=i.containsGlobalTarget=i.mouseDownContains||i.popperNode().contains(e.target);i.pendingHide=!1,requestAnimationFrame(()=>{if(i.pendingHide=!1,!n[i.randomId]&&Mo(i,r,e)){if(i.$_handleGlobalClose(e,t),!e.closeAllPopover&&e.closePopover&&r){let e=i.parentPopper;for(;e;)n[e.randomId]=!0,e=e.parentPopper;return}let a=i.parentPopper;for(;a&&Mo(a,a.containsGlobalTarget,e);)a.$_handleGlobalClose(e,t),a=a.parentPopper}})}catch{}}}function Mo(e,t,n){return n.closeAllPopover||n.closePopover&&t||No(e,n)&&!t}function No(e,t){if(typeof e.autoHide==`function`){let n=e.autoHide(t);return e.lastAutoHide=n,n}return e.autoHide}function Po(){for(let e=0;e<xo.length;e++)xo[e].$_computePosition()}let Fo=0,Io=0,Lo=0,Ro=0;typeof window<`u`&&window.addEventListener(`mousemove`,e=>{Fo=Lo,Io=Ro,Lo=e.clientX,Ro=e.clientY},mo?{passive:!0}:void 0);function zo(e,t,n,r,i,a,o,s){let c=((o-i)*(t-a)-(s-a)*(e-i))/((s-a)*(n-e)-(o-i)*(r-t)),l=((n-e)*(t-a)-(r-t)*(e-i))/((s-a)*(n-e)-(o-i)*(r-t));return c>=0&&c<=1&&l>=0&&l<=1}const Bo={extends:Oo()},Vo=(e,t)=>{let n=e.__vccOpts||e;for(let[e,r]of t)n[e]=r;return n};function Ho(e,t,n,r,i,a){return P(),u(`div`,{ref:`reference`,class:D([`v-popper`,{"v-popper--shown":e.slotData.isShown}])},[B(e.$slots,`default`,O(v(e.slotData)))],2)}const Uo=Vo(Bo,[[`render`,Ho]]);function Wo(){var e=window.navigator.userAgent,t=e.indexOf(`MSIE `);if(t>0)return parseInt(e.substring(t+5,e.indexOf(`.`,t)),10);var n=e.indexOf(`Trident/`);if(n>0){var r=e.indexOf(`rv:`);return parseInt(e.substring(r+3,e.indexOf(`.`,r)),10)}var i=e.indexOf(`Edge/`);return i>0?parseInt(e.substring(i+5,e.indexOf(`.`,i)),10):-1}let Go;function Ko(){Ko.init||(Ko.init=!0,Go=Wo()!==-1)}var qo={name:`ResizeObserver`,props:{emitOnMount:{type:Boolean,default:!1},ignoreWidth:{type:Boolean,default:!1},ignoreHeight:{type:Boolean,default:!1}},emits:[`notify`],mounted(){Ko(),E(()=>{this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.emitOnMount&&this.emitSize()});let e=document.createElement(`object`);this._resizeObject=e,e.setAttribute(`aria-hidden`,`true`),e.setAttribute(`tabindex`,-1),e.onload=this.addResizeHandlers,e.type=`text/html`,Go&&this.$el.appendChild(e),e.data=`about:blank`,Go||this.$el.appendChild(e)},beforeUnmount(){this.removeResizeHandlers()},methods:{compareAndNotify(){(!this.ignoreWidth&&this._w!==this.$el.offsetWidth||!this.ignoreHeight&&this._h!==this.$el.offsetHeight)&&(this._w=this.$el.offsetWidth,this._h=this.$el.offsetHeight,this.emitSize())},emitSize(){this.$emit(`notify`,{width:this._w,height:this._h})},addResizeHandlers(){this._resizeObject.contentDocument.defaultView.addEventListener(`resize`,this.compareAndNotify),this.compareAndNotify()},removeResizeHandlers(){this._resizeObject&&this._resizeObject.onload&&(!Go&&this._resizeObject.contentDocument&&this._resizeObject.contentDocument.defaultView.removeEventListener(`resize`,this.compareAndNotify),this.$el.removeChild(this._resizeObject),this._resizeObject.onload=null,this._resizeObject=null)}}};const Jo=ge(`data-v-b329ee4c`);L(`data-v-b329ee4c`);const Yo={class:`resize-observer`,tabindex:`-1`};F();const Xo=Jo((e,t,n,r,i,a)=>(P(),c(`div`,Yo)));qo.render=Xo,qo.__scopeId=`data-v-b329ee4c`,qo.__file=`src/components/ResizeObserver.vue`;const Zo=(e=`theme`)=>({computed:{themeClass(){return fo(this[e])}}}),Qo=h({name:`VPopperContent`,components:{ResizeObserver:qo},mixins:[Zo()],props:{popperId:String,theme:String,shown:Boolean,mounted:Boolean,skipTransition:Boolean,autoHide:Boolean,handleResize:Boolean,classes:Object,result:Object},emits:[`hide`,`resize`],methods:{toPx(e){return e!=null&&!isNaN(e)?`${e}px`:null}}}),$o=[`id`,`aria-hidden`,`tabindex`,`data-popper-placement`],es={ref:`inner`,class:`v-popper__inner`},ts=d(`div`,{class:`v-popper__arrow-outer`},null,-1),ns=d(`div`,{class:`v-popper__arrow-inner`},null,-1),rs=[ts,ns];function os(e,t,r,i,a,o){let s=ne(`ResizeObserver`);return P(),u(`div`,{id:e.popperId,ref:`popover`,class:D([`v-popper__popper`,[e.themeClass,e.classes.popperClass,{"v-popper__popper--shown":e.shown,"v-popper__popper--hidden":!e.shown,"v-popper__popper--show-from":e.classes.showFrom,"v-popper__popper--show-to":e.classes.showTo,"v-popper__popper--hide-from":e.classes.hideFrom,"v-popper__popper--hide-to":e.classes.hideTo,"v-popper__popper--skip-transition":e.skipTransition,"v-popper__popper--arrow-overflow":e.result&&e.result.arrow.overflow,"v-popper__popper--no-positioning":!e.result}]]),style:k(e.result?{position:e.result.strategy,transform:`translate3d(${Math.round(e.result.x)}px,${Math.round(e.result.y)}px,0)`}:void 0),"aria-hidden":e.shown?`false`:`true`,tabindex:e.autoHide?0:void 0,"data-popper-placement":e.result?e.result.placement:void 0,onKeyup:t[2]||=me(t=>e.autoHide&&e.$emit(`hide`),[`esc`])},[d(`div`,{class:`v-popper__backdrop`,onClick:t[0]||=t=>e.autoHide&&e.$emit(`hide`)}),d(`div`,{class:`v-popper__wrapper`,style:k(e.result?{transformOrigin:e.result.transformOrigin}:void 0)},[d(`div`,es,[e.mounted?(P(),u(n,{key:0},[d(`div`,null,[B(e.$slots,`default`)]),e.handleResize?(P(),c(s,{key:0,onNotify:t[1]||=t=>e.$emit(`resize`,t)})):l(``,!0)],64)):l(``,!0)],512),d(`div`,{ref:`arrow`,class:`v-popper__arrow-container`,style:k(e.result?{left:e.toPx(e.result.arrow.x),top:e.toPx(e.result.arrow.y)}:void 0)},rs,4)],4)],46,$o)}const ss=Vo(Qo,[[`render`,os]]),cs={methods:{show(...e){return this.$refs.popper.show(...e)},hide(...e){return this.$refs.popper.hide(...e)},dispose(...e){return this.$refs.popper.dispose(...e)},onResize(...e){return this.$refs.popper.onResize(...e)}}};let ls=function(){};typeof window<`u`&&(ls=window.Element);const us=h({name:`VPopperWrapper`,components:{Popper:Uo,PopperContent:ss},mixins:[cs,Zo(`finalTheme`)],props:{theme:{type:String,default:null},referenceNode:{type:Function,default:null},shown:{type:Boolean,default:!1},showGroup:{type:String,default:null},ariaId:{default:null},disabled:{type:Boolean,default:void 0},positioningDisabled:{type:Boolean,default:void 0},placement:{type:String,default:void 0},delay:{type:[String,Number,Object],default:void 0},distance:{type:[Number,String],default:void 0},skidding:{type:[Number,String],default:void 0},triggers:{type:Array,default:void 0},showTriggers:{type:[Array,Function],default:void 0},hideTriggers:{type:[Array,Function],default:void 0},popperTriggers:{type:Array,default:void 0},popperShowTriggers:{type:[Array,Function],default:void 0},popperHideTriggers:{type:[Array,Function],default:void 0},container:{type:[String,Object,ls,Boolean],default:void 0},boundary:{type:[String,ls],default:void 0},strategy:{type:String,default:void 0},autoHide:{type:[Boolean,Function],default:void 0},handleResize:{type:Boolean,default:void 0},instantMove:{type:Boolean,default:void 0},eagerMount:{type:Boolean,default:void 0},popperClass:{type:[String,Array,Object],default:void 0},computeTransformOrigin:{type:Boolean,default:void 0},autoMinSize:{type:Boolean,default:void 0},autoSize:{type:[Boolean,String],default:void 0},autoMaxSize:{type:Boolean,default:void 0},autoBoundaryMaxSize:{type:Boolean,default:void 0},preventOverflow:{type:Boolean,default:void 0},overflowPadding:{type:[Number,String],default:void 0},arrowPadding:{type:[Number,String],default:void 0},arrowOverflow:{type:Boolean,default:void 0},flip:{type:Boolean,default:void 0},shift:{type:Boolean,default:void 0},shiftCrossAxis:{type:Boolean,default:void 0},noAutoFocus:{type:Boolean,default:void 0},disposeTimeout:{type:Number,default:void 0}},emits:{show:()=>!0,hide:()=>!0,"update:shown":e=>!0,"apply-show":()=>!0,"apply-hide":()=>!0,"close-group":()=>!0,"close-directive":()=>!0,"auto-hide":()=>!0,resize:()=>!0},computed:{finalTheme(){return this.theme??this.$options.vPopperTheme}},methods:{getTargetNodes(){return Array.from(this.$el.children).filter(e=>e!==this.$refs.popperContent.$el)}}});function ds(e,t,n,r,i,a){let o=ne(`PopperContent`),s=ne(`Popper`);return P(),c(s,T({ref:`popper`},e.$props,{theme:e.finalTheme,"target-nodes":e.getTargetNodes,"popper-node":()=>e.$refs.popperContent.$el,class:[e.themeClass],onShow:t[0]||=()=>e.$emit(`show`),onHide:t[1]||=()=>e.$emit(`hide`),"onUpdate:shown":t[2]||=t=>e.$emit(`update:shown`,t),onApplyShow:t[3]||=()=>e.$emit(`apply-show`),onApplyHide:t[4]||=()=>e.$emit(`apply-hide`),onCloseGroup:t[5]||=()=>e.$emit(`close-group`),onCloseDirective:t[6]||=()=>e.$emit(`close-directive`),onAutoHide:t[7]||=()=>e.$emit(`auto-hide`),onResize:t[8]||=()=>e.$emit(`resize`)}),{default:J(({popperId:t,isShown:n,shouldMountContent:r,skipTransition:i,autoHide:a,show:s,hide:c,handleResize:l,onResize:u,classes:d,result:f})=>[B(e.$slots,`default`,{shown:n,show:s,hide:c}),m(o,{ref:`popperContent`,"popper-id":t,theme:e.finalTheme,shown:n,mounted:r,"skip-transition":i,"auto-hide":a,"handle-resize":l,classes:d,result:f,onHide:c,onResize:u},{default:J(()=>[B(e.$slots,`popper`,{shown:n,hide:c})]),_:2},1032,[`popper-id`,`theme`,`shown`,`mounted`,`skip-transition`,`auto-hide`,`handle-resize`,`classes`,`result`,`onHide`,`onResize`])]),_:3},16,[`theme`,`target-nodes`,`popper-node`,`class`])}const fs=Vo(us,[[`render`,ds]]),ps={...fs,name:`VDropdown`,vPopperTheme:`dropdown`},ms={...fs,name:`VMenu`,vPopperTheme:`menu`},hs={...fs,name:`VTooltip`,vPopperTheme:`tooltip`},gs=h({name:`VTooltipDirective`,components:{Popper:Oo(),PopperContent:ss},mixins:[cs],inheritAttrs:!1,props:{theme:{type:String,default:`tooltip`},html:{type:Boolean,default:e=>uo(e.theme,`html`)},content:{type:[String,Number,Function],default:null},loadingContent:{type:String,default:e=>uo(e.theme,`loadingContent`)},targetNodes:{type:Function,required:!0}},data(){return{asyncContent:null}},computed:{isContentAsync(){return typeof this.content==`function`},loading(){return this.isContentAsync&&this.asyncContent==null},finalContent(){return this.isContentAsync?this.loading?this.loadingContent:this.asyncContent:this.content}},watch:{content:{handler(){this.fetchContent(!0)},immediate:!0},async finalContent(){await this.$nextTick(),this.$refs.popper.onResize()}},created(){this.$_fetchId=0},methods:{fetchContent(e){if(typeof this.content==`function`&&this.$_isShown&&(e||!this.$_loading&&this.asyncContent==null)){this.asyncContent=null,this.$_loading=!0;let e=++this.$_fetchId,t=this.content(this);t.then?t.then(t=>this.onResult(e,t)):this.onResult(e,t)}},onResult(e,t){e===this.$_fetchId&&(this.$_loading=!1,this.asyncContent=t)},onShow(){this.$_isShown=!0,this.fetchContent()},onHide(){this.$_isShown=!1}}}),_s=[`innerHTML`],vs=[`textContent`];function ys(e,t,n,r,i,a){let o=ne(`PopperContent`),s=ne(`Popper`);return P(),c(s,T({ref:`popper`},e.$attrs,{theme:e.theme,"target-nodes":e.targetNodes,"popper-node":()=>e.$refs.popperContent.$el,onApplyShow:e.onShow,onApplyHide:e.onHide}),{default:J(({popperId:t,isShown:n,shouldMountContent:r,skipTransition:i,autoHide:a,hide:s,handleResize:c,onResize:l,classes:d,result:f})=>[m(o,{ref:`popperContent`,class:D({"v-popper--tooltip-loading":e.loading}),"popper-id":t,theme:e.theme,shown:n,mounted:r,"skip-transition":i,"auto-hide":a,"handle-resize":c,classes:d,result:f,onHide:s,onResize:l},{default:J(()=>[e.html?(P(),u(`div`,{key:0,innerHTML:e.finalContent},null,8,_s)):(P(),u(`div`,{key:1,textContent:U(e.finalContent)},null,8,vs))]),_:2},1032,[`class`,`popper-id`,`theme`,`shown`,`mounted`,`skip-transition`,`auto-hide`,`handle-resize`,`classes`,`result`,`onHide`,`onResize`])]),_:1},16,[`theme`,`target-nodes`,`popper-node`,`onApplyShow`,`onApplyHide`])}const bs=Vo(gs,[[`render`,ys]]),xs=`v-popper--has-tooltip`;function Ss(e,t){let n=e.placement;if(!n&&t)for(let e of go)t[e]&&(n=e);return n||=uo(e.theme||`tooltip`,`placement`),n}function Cs(e,t,n){let r,i=typeof t;return r=i===`string`?{content:t}:t&&i===`object`?t:{content:!1},r.placement=Ss(r,n),r.targetNodes=()=>[e],r.referenceNode=()=>e,r}let ws,Ts,Es=0;function Ds(){if(ws)return;Ts=R([]),ws=s({name:`VTooltipDirectiveApp`,setup(){return{directives:Ts}},render(){return this.directives.map(e=>y(bs,{...e.options,shown:e.shown||e.options.shown,key:e.id}))},devtools:{hide:!0}});let e=document.createElement(`div`);document.body.appendChild(e),ws.mount(e)}function Os(e,t,n){Ds();let r=R(Cs(e,t,n)),i=R(!1),a={id:Es++,options:r,shown:i};return Ts.value.push(a),e.classList&&e.classList.add(xs),e.$_popper={options:r,item:a,show(){i.value=!0},hide(){i.value=!1}}}function ks(e){if(e.$_popper){let t=Ts.value.indexOf(e.$_popper.item);t!==-1&&Ts.value.splice(t,1),delete e.$_popper,delete e.$_popperOldShown,delete e.$_popperMountTarget}e.classList&&e.classList.remove(xs)}function As(e,{value:t,modifiers:n}){let r=Cs(e,t,n);if(!r.content||uo(r.theme||`tooltip`,`disabled`))ks(e);else{let i;e.$_popper?(i=e.$_popper,i.options.value=r):i=Os(e,t,n),typeof t.shown<`u`&&t.shown!==e.$_popperOldShown&&(e.$_popperOldShown=t.shown,t.shown?i.show():i.hide())}}const js={beforeMount:As,updated:As,beforeUnmount(e){ks(e)}};function Ms(e){e.addEventListener(`mousedown`,Ps),e.addEventListener(`click`,Ps),e.addEventListener(`touchstart`,Fs,mo?{passive:!0}:!1)}function Ns(e){e.removeEventListener(`mousedown`,Ps),e.removeEventListener(`click`,Ps),e.removeEventListener(`touchstart`,Fs),e.removeEventListener(`touchend`,Is),e.removeEventListener(`touchcancel`,Ls)}function Ps(e){let t=e.currentTarget;e.closePopover=!t.$_vclosepopover_touch,e.closeAllPopover=t.$_closePopoverModifiers&&!!t.$_closePopoverModifiers.all}function Fs(e){if(e.changedTouches.length===1){let t=e.currentTarget;t.$_vclosepopover_touch=!0;let n=e.changedTouches[0];t.$_vclosepopover_touchPoint=n,t.addEventListener(`touchend`,Is),t.addEventListener(`touchcancel`,Ls)}}function Is(e){let t=e.currentTarget;if(t.$_vclosepopover_touch=!1,e.changedTouches.length===1){let n=e.changedTouches[0],r=t.$_vclosepopover_touchPoint;e.closePopover=Math.abs(n.screenY-r.screenY)<20&&Math.abs(n.screenX-r.screenX)<20,e.closeAllPopover=t.$_closePopoverModifiers&&!!t.$_closePopoverModifiers.all}}function Ls(e){let t=e.currentTarget;t.$_vclosepopover_touch=!1}const Rs={beforeMount(e,{value:t,modifiers:n}){e.$_closePopoverModifiers=n,(typeof t>`u`||t)&&Ms(e)},updated(e,{value:t,oldValue:n,modifiers:r}){e.$_closePopoverModifiers=r,t!==n&&(typeof t>`u`||t?Ms(e):Ns(e))},beforeUnmount(e){Ns(e)}},zs=lo,Bs=js,Vs=js,Hs=Rs,Us=Rs,Ws=ps,Gs=ms,Ks=Oo,qs=ss,Js=cs,Ys=fs,Xs=Zo,Zs=hs,Qs=bs;function $s(e,t={}){e.$_vTooltipInstalled||(e.$_vTooltipInstalled=!0,co(lo,t),e.directive(`tooltip`,js),e.directive(`close-popper`,Rs),e.component(`VTooltip`,hs),e.component(`VDropdown`,ps),e.component(`VMenu`,ms))}const ec={version:`5.2.2`,install:$s,options:lo};var tc=h({__name:`Dropdown`,props:w({value:{},thin:{type:Boolean,default:!0},flat:{type:Boolean,default:!0},disabled:{type:Boolean},icon:{},color:{},triggerClass:{},iconEnd:{},border:{type:Boolean},outline:{type:Boolean},round:{type:Boolean},placement:{default:`bottom-start`},disablePlacement:{type:Boolean,default:!1},noAutoFocus:{type:Boolean},autoHide:{type:Boolean,default:!0},triggers:{default:()=>[`click`]},showTriggers:{},hideTriggers:{},popperTriggers:{default:()=>[]},popperShowTriggers:{default:()=>[]},popperHideTriggers:{default:()=>[]},showGroup:{},delay:{}},{shown:{type:Boolean,default:!1},shownModifiers:{}}),emits:w([`show`,`hide`],[`update:shown`]),setup(e,{expose:t,emit:n}){let r=n,i=o(()=>{if(e.icon)return e.icon;if(!e.value)return`more_vert`}),a=R(),s=R(),l=se(e,`shown`),u=()=>{var e;return(e=a.value)?.show()};function f(){var e,t;(e=s.value)?.focus(),(t=a.value)?.hide()}let{isMobile:p,innerWidth:h}=hD(),g=o(()=>e.disablePlacement&&p),_=o(()=>h.value<910),v=o(()=>_.value&&e.triggers.includes(`hover`)?e.triggers.map(e=>e===`hover`?`click`:e):e.triggers),y=o(()=>e.showTriggers===void 0?v.value:_.value&&e.showTriggers.includes(`hover`)?e.showTriggers.map(e=>e===`hover`?`click`:e):e.showTriggers),b=o(()=>e.hideTriggers===void 0?v.value.length===1&&v.value[0]===`click`?[`click`]:e.triggers.includes(`hover`)?[...v.value,`click`]:v.value:_.value&&e.hideTriggers.includes(`hover`)?e.hideTriggers.map(e=>e===`hover`?`click`:e):e.hideTriggers),x=o(()=>e.popperTriggers.length>0?e.popperTriggers:e.triggers.includes(`hover`)&&!_.value?[`hover`]:[]),S=o(()=>{let t=Array.isArray(e.popperShowTriggers)&&e.popperShowTriggers.length>0;if(t)return e.popperShowTriggers;if(e.triggers.includes(`hover`)&&!_.value)return[`hover`]}),C=o(()=>{let t=Array.isArray(e.popperHideTriggers)&&e.popperHideTriggers.length>0;return t?e.popperHideTriggers:e.triggers.includes(`hover`)&&!_.value?[`hover`]:[]}),w=o(()=>e.autoHide),T=o(()=>e.delay===void 0?e.triggers.includes(`hover`)&&!_.value?{show:0,hide:10}:0:e.delay);return t({show:u,hide:f,shown:l}),(e,t)=>(P(),c(G(Ws),{ref_key:`ddownRef`,ref:a,shown:l.value,"onUpdate:shown":t[0]||=e=>l.value=e,disabled:e.disabled,noAutoFocus:e.noAutoFocus,"positioning-disabled":g.value,placement:e.placement,autoHide:w.value,delay:T.value,triggers:v.value,showTriggers:y.value,hideTriggers:b.value,popperTriggers:x.value,popperShowTriggers:S.value,popperHideTriggers:C.value,showGroup:e.showGroup,onHide:t[1]||=e=>r(`hide`),onShow:t[2]||=e=>r(`show`)},{popper:J(({hide:t,show:n,shown:r})=>[B(e.$slots,`default`,{hide:t,show:n,shown:r})]),default:J(()=>[d(`div`,{ref_key:`triggerRef`,ref:s},null,512),B(e.$slots,`trigger`,{show:u,hide:f,shown:l.value},()=>[m(G(X),{class:D(e.triggerClass),iconEnd:e.iconEnd,icon:i.value,value:e.value,thin:e.thin,flat:e.flat,outline:e.outline,round:e.round,color:e.color},null,8,[`class`,`iconEnd`,`icon`,`value`,`thin`,`flat`,`outline`,`round`,`color`])])]),_:3},8,[`shown`,`disabled`,`noAutoFocus`,`positioning-disabled`,`placement`,`autoHide`,`delay`,`triggers`,`showTriggers`,`hideTriggers`,`popperTriggers`,`popperShowTriggers`,`popperHideTriggers`,`showGroup`]))}}),nc=tc;const rc={class:`px-1 pt-025 pb-1`},ic={class:`ms-1`};var ac=h({__name:`FieldSetVue`,props:{label:{},legend:{}},setup(e){return(e,t)=>(P(),u(`fieldset`,rc,[d(`legend`,ic,U(e.legend||e.label),1),B(e.$slots,`default`,{},void 0,!0)]))}}),oc=Y(ac,[[`__scopeId`,`data-v-f7e758e5`]]),sc=h({__name:`Flag`,props:{country:{},size:{},circle:{type:Boolean},square:{type:Boolean}},setup(e){let t=e,n=o(()=>!!(t.circle||t.square)),r=o(()=>`${t.size||1}rem`),i=o(()=>{let e=t.country.toLowerCase();e===`ac`&&(e=`sh-ac`);let r=`https://cdn.jsdelivr.net/gh/lipis/flag-icons@7.0.0/flags`;return n.value?`url(${r}/1x1/${e.toLowerCase()}.svg)`:`url(${r}/4x3/${e.toLowerCase()}.svg)`});return(e,t)=>(P(),u(`span`,{class:D([`fi`,{fis:n.value,circle:e.circle}]),style:k({height:r.value,backgroundImage:i.value})},null,6))}}),cc=Y(sc,[[`__scopeId`,`data-v-f99f1900`]]),lc={};be(lc,{arrField:()=>Ec,bglForm:()=>Sc,checkField:()=>hc,colorField:()=>wc,createSchema:()=>Dc,dateField:()=>_c,emailField:()=>gc,findBglFieldById:()=>Tc,frmRow:()=>yc,getBaseField:()=>uc,numField:()=>vc,rangeField:()=>xc,richText:()=>dc,selectField:()=>pc,slctField:()=>mc,telField:()=>Cc,txtField:()=>fc,uploadField:()=>bc,useForm:()=>Oc});function uc(e,t={},n={}){return typeof t==`object`?{id:e,...t}:{id:e,label:t,...n}}function dc(e,t,n){return{$el:`richtext`,class:n?.class,required:n?.required,id:e,label:t,helptext:n?.helpText,disabled:n?.disabled,defaultValue:n?.defaultValue,vIf:n?.vIf,transform:n?.transform,placeholder:n?.placeholder,attrs:{height:n?.height,basic:n?.basic,simple:n?.simple,debug:n?.debug,hideToolbar:n?.hideToolbar,hideInlineToolbar:n?.hideInlineToolbar,hideImages:n?.hideImages,hideVideos:n?.hideVideos,hideEmbed:n?.hideEmbed,hideTables:n?.hideTables,hideAlignment:n?.hideAlignment,hideDirections:n?.hideDirections,hideH5H6:n?.hideH5H6,hide:n?.hide,autofocus:n?.autofocus,textColor:n?.textColor,autocomplete:n?.autocomplete}}}function fc(e,t,n){return{$el:`text`,id:e,label:t,class:n?.class,required:n?.required,placeholder:n?.placeholder,helptext:n?.helptext,disabled:n?.disabled,defaultValue:n?.defaultValue,vIf:n?.vIf,transform:n?.transform,attrs:{autocomplete:n?.autocomplete,pattern:n?.pattern,multiline:n?.multiline,autoheight:n?.autoheight,code:n?.code,rows:n?.rows,icon:n?.icon,iconStart:n?.iconStart,type:n?.type}}}function pc(e,t,n,r){return{$el:`select`,id:e,label:t,class:r?.class,required:r?.required,helptext:r?.helptext,disabled:r?.disabled,defaultValue:r?.defaultValue,vIf:r?.vIf,transform:r?.transform,options:n,attrs:{...r?.attrs,searchable:r?.searchable,multiselect:r?.multiselect,clearable:r?.clearable}}}const mc=pc;function hc(e,t,n){return{$el:`check`,id:e,label:t,class:n?.class,required:n?.required,helptext:n?.helptext,disabled:n?.disabled,defaultValue:n?.defaultValue,vIf:n?.vIf,transform:n?.transform,attrs:{...n?.attrs,value:n?.value}}}function gc(e,t,n){return{$el:`email`,id:e,label:t,class:n?.class,required:n?.required,vIf:n?.vIf,transform:n?.transform,attrs:{autocorrect:n?.autocorrect,serverValidate:n?.serverValidate,preventFakeEmails:n?.preventFakeEmails,pattern:n?.pattern}}}function _c(e,t,n){return{$el:`date`,class:n?.class,required:n?.required,id:e,disabled:n?.disabled,label:t,defaultValue:n?.defaultValue,vIf:n?.vIf,transform:n?.transform,attrs:{disabled:n?.disabled,autocomplete:n?.autocomplete,enableTime:n?.enableTime,mode:n?.mode,locale:n?.locale,timezone:n?.timezone}}}function vc(e,t,n){return{$el:`number`,class:n?.class,required:n?.required,defaultValue:n?.defaultValue,id:e,label:t,disabled:n?.disabled,placeholder:n?.placeholder,helptext:n?.helptext,vIf:n?.vIf,transform:n?.transform,attrs:{autocomplete:n?.autocomplete,step:n?.step,min:n?.min,max:n?.max,layout:n?.layout,padZero:n?.padZero,center:n?.center,useGrouping:n?.useGrouping}}}function yc(...e){return{$el:`div`,class:`flex gap-1 m_block align-items-end`,children:e}}function bc(e,t,n){return{$el:`upload`,id:e,label:t,class:n?.class,required:n?.required,helptext:n?.helptext,disabled:n?.disabled,defaultValue:n?.defaultValue,vIf:n?.vIf,transform:n?.transform,attrs:{...n}}}function xc(e,t,n){return{$el:`range`,id:e,label:t,vIf:n?.vIf,transform:n?.transform,attrs:{autocomplete:n?.autocomplete,min:n?.min,max:n?.max,step:n?.step,rtl:n?.rtl,multiRange:n?.multiRange,formatValue:n?.formatValue}}}function Sc(e,...t){return typeof e==`string`?{$el:`bagelform`,id:e,attrs:{schema:[e,...t]}}:{$el:`bagelform`,attrs:{schema:[e,...t]}}}function Cc(e,t,n){return{$el:`tel`,id:e,label:t,class:n?.class,required:n?.required,placeholder:n?.placeholder,helptext:n?.helptext,disabled:n?.disabled,defaultValue:n?.defaultValue,vIf:n?.vIf,transform:n?.transform,attrs:{...n?.attrs,pattern:n?.pattern,autocomplete:n?.autocomplete}}}function wc(e,t,n){return{$el:`color`,id:e,label:t,vIf:n?.vIf,attrs:n,class:n?.class,transform:n?.transform}}function Tc(e,t){for(let n of t){if(n.id===e)return n;if(n.children&&Number(n.children.length)>0){let t=n.children.filter(e=>typeof e==`object`&&`$el`in e),r=Tc(e,t);if(r)return r}}}function Ec(e,t,n,r){let i=typeof n==`string`?{type:n}:{schema:n},a={delete:!0,add:!0,...r,...i};return{label:t,id:e,class:r?.class,$el:`array`,vIf:r?.vIf,transform:r?.transform,attrs:a}}function Dc(){return{txtField:(e,t,n)=>fc(e,t,n),selectField:(e,t,n,r)=>pc(e,t,n,r),dateField:(e,t,n)=>_c(e,t,n),telField:(e,t,n)=>Cc(e,t,n),frmRow:(...e)=>yc(...e),numField:(e,t,n)=>vc(e,t,n),checkField:(e,t,n)=>hc(e,t,n),emailField:(e,t,n)=>gc(e,t,n),uploadField:(e,t,n)=>bc(e,t,n),rangeField:(e,t,n)=>xc(e,t,n),colorField:(e,t,n)=>wc(e,t,n),richText:(e,t,n)=>dc(e,t,n)}}function Oc(){return{txtField:fc,selectField:pc,checkField:hc,dateField:_c,numField:vc,emailField:gc,frmRow:yc,uploadField:bc,rangeField:xc,bglForm:Sc,telField:Cc,colorField:wc,arrField:Ec,richText:dc,findBglFieldById:Tc,getBaseField:uc,createSchema:Dc}}const kc=te({defaultLang:``,availableLangs:[],lang:`en`});function Ac(e){return e?e[kc.lang]||e[kc.defaultLang]||``:(console.warn(`No language element provided for $tdb function`),``)}function jc(){let e=o({get:()=>kc.lang,set:e=>kc.lang=e}),t=o({get:()=>kc.availableLangs,set:e=>kc.availableLangs=e}),n=o({get:()=>kc.defaultLang,set:e=>kc.defaultLang=e});return{lang:e,$tdb:Ac,availableLangs:t,defaultLang:n}}function Mc(e,t){return t===`titleCase`?e.split(`_`).map(e=>e[0].toUpperCase()+e.slice(1).toLocaleLowerCase()).join(` `):t===`pascal`?e.split(`_`).map(e=>e[0].toUpperCase()+e.slice(1).toLocaleLowerCase()).join(``):t===`camel`?e.split(`_`).map((e,t)=>t===0?e:e[0].toUpperCase()+e.slice(1)).join(``):t===`snake`?[...e].map(e=>e===e.toUpperCase()?`_${e.toLowerCase()}`:e).join(``):e}const Nc=H(null);function Pc(){let e=Nc.value;if(!e)throw Error(`Bagel instance is not initialized. Please install BagelVue plugin first.`);return e}function Fc(e){Nc.value=e}function Ic(){return Nc.value}const Lc=new Map;function Rc(e,t=500){clearTimeout(Lc.get(e));let n=setTimeout(()=>{e(),Lc.delete(e)},t);Lc.set(e,n)}function zc(e){return e.toLowerCase().replace(/[^a-z0-9-\s]/g,``).split(/[\s-]+/).join(`-`)}function Bc(e){return e===void 0?e:e.split(`_`).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)||e}async function Vc(e,t){await navigator.clipboard.writeText(e),t&&t(`Copied to clipboard`)}function Hc(...e){return e=e.flatMap(e=>e.split(/\s/)),e.map(e=>e.charAt(0)).join(``)}function Uc(e,t){e.key===`Escape`&&t()}function Wc(e,t,...n){return n.map(n=>typeof n==`function`?n(e,t):n).join(` `)}function Gc(e,t,n){if(!e)return{};let r=[`class`,`onClick`,`$el`],i=Object.entries(e).filter(([e])=>!r.includes(e)).map(([e,r])=>[e,typeof r==`function`?r(t,n):r]),a=Object.fromEntries(i);for(let t of r.slice(1))e[t]&&(a[t]=e[t]);return a}function Kc(e,t){var n;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`?(n=e[`v-if`])?.call(e,t?.[e.id],t):!0}function qc(e,t){if(t)return e?e[t]:void 0}const Jc=e=>!Number.isNaN(Date.parse(e));function Yc(e,t){let n=Array.from(new Set((e??[]).flatMap(Object.keys))),r=n.map(e=>({id:e,label:Bc(e),transform:t=>{let n=[`created_at`,`updated_at`];return n.includes(e)?t&&new Date(t).toLocaleString():t}}));return t?r.filter(e=>t.includes(e.id)||!e.id):r}function Xc(e=100){return new Promise(t=>setTimeout(t,e))}const Zc=new Map;async function Qc(e,t){let n=t?.id||e;if(await Xc(1),Zc.has(n)){let e=Zc.get(n);if(e)return e}if(t?.id&&document.getElementById(t.id)||document.querySelector(`script[src="${e}"]`))return Promise.resolve();let r=new Promise((r,i)=>{let a=document.createElement(`script`);a.src=e,t?.id&&(a.id=t.id),a.onload=()=>{r(),Zc.delete(n)},a.onerror=e=>{i(Error(String(e))),Zc.delete(n)},document.head.append(a)});return Zc.set(n,r),r}function $c(e){return new Promise((t,n)=>{if(document.querySelector(`link[href="${e}"]`)){t();return}let r=document.createElement(`link`);r.href=e,r.rel=`stylesheet`,r.onload=()=>{t()},r.onerror=n,document.head.append(r)})}function el(e){return e.startsWith(`https://`)?e:(e=e.replace(/http:\/\//,``),`https://${e}`)}function tl(e,t=`px`){return typeof e==`number`?`${e}${t}`:e}const nl=/^https?:\/\/|^\/\//;function rl(e){if(e===void 0||e===``||nl.test(e))return e;let t=Ic();if(!t)return console.warn(`Bagel instance is not initialized. Please install BagelVue plugin.`),e;if(e.startsWith(`static/`))return t.host===void 0||t.host===``?(console.warn(`Bagel host is not configured. Please set it in BagelVue options.`),e):`${t.host}/${e}`;let n=t.fileBaseUrl??`https://files.bagel.design`;return`${n}/${e}`}function il(e,t,n=void 0){if(!t)return e;let r=t.split(/[.[]/),i=e;for(let e of r){if(!i||typeof i!=`object`||!(e in i))return n;i=i[e]}return i??n}const al=e=>e.replace(/http:\/\//,`//`);function ol(e,t){let n=document.createElement(`a`);if(n.target=`_blank`,typeof e==`string`){n.href=al(e);let r=e.split(`/`).pop();n.download=t||r||`download`}else{let r=URL.createObjectURL(e);n.href=r,n.download=t||`download`,URL.revokeObjectURL(r)}document.body.appendChild(n),n.click(),document.body.removeChild(n)}var sl=h({__name:`BagelForm`,props:{modelValue:{default:void 0},schema:{type:[Object,Function],default:void 0},tag:{default:`form`},class:{default:``},onSubmit:{}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let i=e,a=r,s=e=>e&&JSON.parse(JSON.stringify(e)),d=R(),f=R(s(i.modelValue??{})),p=R(s(i.modelValue??{})),m=R(`idle`),h=o(()=>W(i.schema)),g=o(()=>{try{return JSON.stringify(f.value)!==JSON.stringify(p.value)}catch{return!1}});j(()=>{i.modelValue&&(p.value=s(i.modelValue)),_()}),q(()=>i.modelValue,e=>{e!==void 0&&(f.value=s(e))},{immediate:!0,deep:!0});function _(){let e=h.value;if(!e)return;let t=e=>{for(let n of e){if(!n||typeof n!=`object`)continue;let e=typeof n.id==`string`&&n.id.length>0,r=Object.prototype.hasOwnProperty.call(n,`defaultValue`)&&n.defaultValue!==void 0;if(e&&r){let e=il(f.value,n.id,void 0);(e===void 0||e===``)&&v({fieldId:n.id,value:n.defaultValue})}Array.isArray(n.children)&&n.children.length&&t(n.children)}};t(e)}q(h,()=>{_()},{deep:!0});function v({fieldId:e,value:t}){let n=e?.split(`.`)||[],r=s(f.value),i=r;for(let e=0;e<n.length-1;e++){let t=n[e];(!i[t]||typeof i[t]!=`object`)&&(i[t]={}),i=i[t]}i[n[n.length-1]]=t,f.value=r,a(`update:modelValue`,f.value)}let y=()=>{var e;return(e=d.value)?.reportValidity()??!1},b=()=>{var e;return(e=d.value)?.checkValidity()??!1},x=R();async function S(){try{var e;let t=y();if(!t||m.value===`submitting`)return;m.value=`submitting`,await(e=i.onSubmit)?.call(i,f.value),p.value=s(f.value),m.value=`success`,window.parent.postMessage({type:`BAGEL_FORM_SUCCESS`,data:JSON.stringify(f.value)},`*`)}catch(e){m.value=`error`,x.value=e,console.error(`Submit error:`,x.value)}}let{renderField:C}=vi({mode:`form`,getFormData:()=>f.value,onUpdateModelValue:(e,t)=>{var n;e.id&&(v({fieldId:e.id,value:t}),(n=e.onUpdate)?.call(e,t,f.value))}}),w=e=>C(e);function T(e){let t=e.target;if(t.name){let e=t.type===`checkbox`?t.checked:t.value;v({fieldId:t.name,value:e})}}return t({form:d,isDirty:g,validateForm:y,checkValidity:b}),(e,t)=>(P(),u(n,null,[m.value!==`success`||!e.$slots.success?(P(),u(n,{key:0},[i.tag===`form`?(P(),u(`form`,{key:0,ref_key:`form`,ref:d,class:D(i.class),onSubmit:he(S,[`prevent`]),onInput:T},[h.value?(P(!0),u(n,{key:0},z(h.value,e=>(P(),c(V(w(e)),{key:e.id}))),128)):B(e.$slots,`default`,{key:1}),B(e.$slots,`submit`,{submit:S,isDirty:g.value,validateForm:y,formState:m.value})],34)):(P(),u(n,{key:1},[h.value?(P(!0),u(n,{key:0},z(h.value,e=>(P(),c(V(w(e)),{key:e.id,class:D(i.class)},null,8,[`class`]))),128)):l(``,!0)],64))],64)):l(``,!0),m.value===`success`?B(e.$slots,`success`,{key:1}):l(``,!0),m.value===`error`?B(e.$slots,`error`,{key:2,error:x.value}):l(``,!0)],64))}}),cl=sl;const ll={class:`bgl-multi-step-form`},ul={key:0,class:`bgl-step-progress`},dl={class:`bgl-steps-indicator`},fl=[`onClick`],pl={key:0,class:`bgl-step-label`},ml={class:`bgl-form-wrapper`},hl={class:`bgl-step-controls`};var gl=h({__name:`BglMultiStepForm`,props:w({bagelFormProps:{default:()=>({})},schema:{},showProgress:{type:Boolean,default:!1},rtl:{type:Boolean,default:!1},stepLabels:{},allowStepNavigation:{type:Boolean,default:!1},validateOnSteps:{type:Boolean,default:!0},direction:{default:`auto`}},{modelValue:{default:()=>({}),required:!0},modelModifiers:{}}),emits:w([`submit`,`stepChange`],[`update:modelValue`]),setup(e,{expose:t,emit:r}){var a;let s=e,p=r,h=R(),g=se(e,`modelValue`),_=R(0),y=R(0),b=R([]);function x(){if(!h.value)return!1;let e=h.value.validateForm();return e&&!b.value.includes(_.value)&&b.value.push(_.value),e}let S=o(()=>FD({schema:W(s.schema)})),C=o(()=>{let e=S.value;return e.filter((e,t)=>{if(e.vIf!==void 0||e[`v-if`]!==void 0){let t=e.vIf??e[`v-if`];if(typeof t==`function`)return t(void 0,g.value);if(typeof t==`boolean`)return t;if(typeof t==`string`)return!!t}return!0})}),w=o(()=>C.value.length),k=o(()=>{let e=[];return S.value.forEach((t,n)=>{let r=t.vIf??t[`v-if`],i=!0;r!==void 0&&(typeof r==`function`?i=r(void 0,g.value):typeof r==`boolean`?i=r:typeof r==`string`&&(i=!!r)),i&&e.push(n)}),e}),A=o(()=>{let e=k.value[_.value];return[S.value[e]]}),j=R(s.rtl?`right`:`left`);q(()=>_.value,(e,t)=>{s.direction===`auto`?j.value=s.rtl?e>t?`right`:`left`:e>t?`left`:`right`:j.value=s.direction,y.value=t,p(`stepChange`,{newStep:e,oldStep:t,totalSteps:w.value,direction:j.value})});let ee=o(()=>_.value===w.value-1),M=o(()=>e=>b.value.includes(e)),N=R(!1);async function F(){var e;await E(),s.validateOnSteps?N.value=(e=h.value)?.checkValidity()??!1:N.value=!0}function I(){_.value>0&&_.value--}let L=R();async function te(){s.validateOnSteps&&x()===!1||(ee.value||_.value++,await Xc(400),F())}async function ne(e){if(e<_.value||b.value.includes(e))return _.value=e,!0;if(e>_.value){if(s.validateOnSteps&&x()===!1)return!1;for(let n=_.value+1;n<=e;n++)if(_.value=n,await E(),await Xc(100),s.validateOnSteps){var t;let e=(t=h.value)?.checkValidity()??!1;if(e)b.value.includes(n)||b.value.push(n);else return!1}return!0}return!1}function re(){x()!==!1&&p(`submit`,g.value)}function V(){b.value=[],_.value=0}return q(()=>g.value,()=>{F(),_.value>=w.value&&w.value>0&&(_.value=0)},{deep:!0}),t({submit:re,validateForm:x,checkValidity:(a=h.value)?.checkValidity,isDirty:o(()=>{var e;return(e=h.value)?.isDirty}),reset:V,isLastStep:ee,goToStep:ne,currentStep:_,totalSteps:o(()=>w.value),isStepValid:N,nextStep:te,prevStep:I}),(e,t)=>(P(),u(`div`,ll,[e.showProgress?(P(),u(`div`,ul,[B(e.$slots,`progress`,O(v({currentStep:_.value,totalSteps:w.value,goToStep:ne,stepLabels:s.stepLabels,allowStepNavigation:s.allowStepNavigation,isStepValidated:M.value})),()=>[d(`div`,dl,[(P(!0),u(n,null,z(w.value,(e,t)=>(P(),u(`div`,{key:t,class:D([`bgl-step-indicator`,[{active:t===_.value},{completed:t<_.value||M.value(t)},{clickable:s.allowStepNavigation}]]),onClick:e=>s.allowStepNavigation&&ne(t)},[d(`span`,null,U(t+1),1),s.stepLabels&&s.stepLabels[t]?(P(),u(`span`,pl,U(s.stepLabels[t]),1)):l(``,!0)],10,fl))),128))])],!0)])):l(``,!0),d(`div`,ml,[m(i,{name:j.value===`right`?`slide-right`:`slide-left`,mode:`out-in`},{default:J(()=>[(P(),u(`div`,{key:_.value,ref_key:`formContainer`,ref:L,class:`bgl-form-container`},[m(G(cl),T({ref_key:`formRef`,ref:h,modelValue:g.value,"onUpdate:modelValue":t[0]||=e=>g.value=e,schema:A.value},e.bagelFormProps),f({_:2},[e.$slots.success?{name:`success`,fn:J(()=>[B(e.$slots,`success`,{},void 0,!0)]),key:`0`}:void 0,e.$slots.error?{name:`error`,fn:J(()=>[B(e.$slots,`error`,{},void 0,!0)]),key:`1`}:void 0]),1040,[`modelValue`,`schema`])]))]),_:3},8,[`name`]),d(`div`,hl,[B(e.$slots,`steppers`,O(v({prevStep:I,nextStep:te,submit:re,currentStep:_.value,totalSteps:w.value,isLastStep:ee.value,isStepValid:N.value})),()=>[_.value===0?l(``,!0):(P(),c(G(X),{key:0,color:`gray`,icon:`arrow_back`,onClick:I})),ee.value?(P(),c(G(X),{key:2,value:`Submit`,onClick:re})):(P(),c(G(X),{key:1,icon:`arrow_forward`,disabled:s.validateOnSteps&&!N.value,onClick:te},null,8,[`disabled`]))],!0)])])]))}}),_l=Y(gl,[[`__scopeId`,`data-v-1e915d1e`]]);const vl={key:0,class:`label mb-05`},yl={class:`ps-025 border-start mb-05`},bl={key:0,class:`flex-center h-300px`},xl={key:1,class:`py-1`},Sl={key:0,class:`minimizedText txt14 p-025 opacity-7`},Cl={class:`bg-gray-80 -my-05 px-025 pt-065 pb-05 txt-center space-between flex column`};var wl=h({__name:`FieldArray`,props:{el:{default:`div`},id:{},label:{},placeholder:{},children:{},class:{type:[String,Number,Boolean,Object,Function]},attrs:{},required:{type:Boolean},disabled:{type:Boolean},helptext:{},options:{},defaultValue:{},add:{type:Boolean,default:!0},delete:{type:Boolean,default:!0},transform:{},schema:{},modelValue:{},type:{default:`object`}},emits:[`update:modelValue`],setup(e,{emit:t}){let r=e,i=t,a=cl,s=R([]),f=R(r.modelValue||[]),p=R(`loaded`),m=o(()=>r.type===`text`?[{id:`value`,type:`text`,label:``,$el:`text`}]:r.type===`number`?[{id:`value`,type:`number`,label:``,$el:`number`}]:[]),h=o(()=>r.type===`object`?W(r.schema):m.value);q(()=>r.modelValue,e=>{f.value=e||[]},{deep:!0});function g(){i(`update:modelValue`,f.value)}function _(e){f.value.splice(e,1),g()}function v(){let e={text:``,number:0,object:{}};f.value.push(e[r.type]),g()}function y(e){s.value[e]=!s.value[e]}function b(e,t){r.type===`text`||r.type===`number`?f.value[e]=r.type===`number`?Number(t.value):t.value:f.value[e]=t,g()}let x=o(()=>r.type===`text`||r.type===`number`),S=o(()=>{var e;return x.value||r.type===`object`&&Number((e=h.value)?.length)>0}),C=o(()=>{var e,t;return Number((e=h.value)?.length)>2||(t=h.value)?.some(e=>e.$el===`richtext`)});return(e,t)=>(P(),u(`div`,{class:D(r.class)},[e.label?(P(),u(`p`,vl,U(e.label),1)):l(``,!0),d(`div`,yl,[p.value===`loaded`?S.value?(P(),u(n,{key:2},[(P(!0),u(n,null,z(f.value,(t,n)=>(P(),u(`div`,{key:n,outline:``,thin:``,class:D([`mb-05 itemBox transition ps-05 pb-025 pt-025 radius-05 gap-05 overflow-hidden`,{minimized:s.value[n]}])},[s.value[n]?(P(),u(`p`,Sl,U(e.label)+` `+U(n+1),1)):(P(),c(G(a),{key:1,"model-value":x.value?{value:t}:t,schema:G(h),"onUpdate:modelValue":e=>b(n,e)},null,8,[`model-value`,`schema`,`onUpdate:modelValue`])),d(`div`,Cl,[C.value?(P(),c(G(X),{key:0,class:`block rotate-180 txt10 opacity-7 p-025`,flat:``,thin:``,icon:`keyboard_arrow_down`,onClick:e=>y(n)},null,8,[`onClick`])):l(``,!0),r.delete?(P(),c(G(X),{key:1,icon:`delete`,class:`txt10 opacity-7`,thin:``,flat:``,onClick:e=>_(n)},null,8,[`onClick`])):l(``,!0)])],2))),128)),e.add?(P(),c(G(X),{key:0,thin:``,icon:`add`,color:`gray`,class:`txt12 arrayAddButton`,onClick:v},{default:J(()=>[d(`p`,null,U(e.label),1)]),_:1})):l(``,!0)],64)):(P(),u(`div`,xl,t[0]||=[d(`p`,{class:`opacity-7`},` No schema available `,-1)])):(P(),u(`div`,bl,[p.value===`loading`?(P(),c(G(DT),{key:0})):p.value===`error`?(P(),c(G($),{key:1,icon:`error`,color:`red`})):l(``,!0)]))])],2))}}),Tl=wl;const El={class:`primary-checkbox`};var Dl=h({__name:`Checkbox`,props:{modelValue:{type:Boolean,default:!1},modelModifiers:{}},emits:[`update:modelValue`],setup(e){let t=se(e,`modelValue`);return(e,n)=>(P(),u(`label`,El,[B(e.$slots,`label`,{},void 0,!0),pe(d(`input`,{"onUpdate:modelValue":n[0]||=e=>t.value=e,type:`checkbox`},null,512),[[ce,t.value]])]))}}),Ol=Y(Dl,[[`__scopeId`,`data-v-73f1d9ad`]]);const kl=[`title`],Al=[`id`,`disabled`,`value`,`required`],jl=[`for`];var Ml=h({__name:`CheckInput`,props:w({label:{},id:{},title:{},small:{type:Boolean},required:{type:Boolean},disabled:{type:Boolean},defaultValue:{default:!1},value:{}},{modelValue:{default:void 0},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=o(()=>e.id||Math.random().toString(36).slice(7)),n=se(e,`modelValue`);return j(()=>{n.value===void 0&&(n.value=e.defaultValue)}),(e,r)=>(P(),u(`div`,{class:D([`bagel-input bgl-checkbox align-items-center ps-025`,{small:e.small}]),title:e.title},[pe(d(`input`,{id:t.value+e.value,"onUpdate:modelValue":r[0]||=e=>n.value=e,disabled:e.disabled,value:e.value,required:e.required,type:`checkbox`,class:`me-05`},null,8,Al),[[ce,n.value]]),d(`label`,{for:t.value+e.value},[B(e.$slots,`label`,{},()=>[p(U(e.label),1)],!0)],8,jl)],10,kl))}}),Nl=Y(Ml,[[`__scopeId`,`data-v-083702e1`]]);function Pl(e=`dark`){let t=R(null),n=R(!1),r=R(e),i=e=>e===`dark`?`atom-one-dark`:e===`light`?`atom-one-light`:e,a=e=>`https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.0/styles/${e}.min.css`,o=()=>{document.querySelectorAll(`link[rel="stylesheet"]`).forEach(e=>{if(e instanceof HTMLLinkElement&&e.href.includes(`/styles/`)){var t;e.href.includes(`highlight.js`)&&(t=e.parentElement)?.removeChild(e)}})},s=async e=>{let t=i(e);if(t!==r.value)try{o();let e=a(t);console.log(`setTheme`,e),await $c(e),r.value=t}catch(e){console.error(`Failed to apply theme. Falling back to atom-one-dark:`,e),o(),r.value=`atom-one-dark`;let t=a(r.value);await $c(t)}},c=async()=>{if(!n.value)try{await Qc(`https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.11.0/highlight.min.js`,{id:`hljs-cdn`}),await s(r.value),window.hljs?(t.value=window.hljs,n.value=!0):console.error(`Failed to load highlight.js`)}catch(e){console.error(`Error loading highlight.js:`,e)}},l=e=>e.replace(/[&<>"']/g,e=>{let t={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#039;`};return t[e]||``}),u=(e,n,r=!0,i=!0)=>{if(!t.value)return l(e);try{let a=n||``;if(a&&!r&&!t.value.getLanguage(a))return console.warn(`The language "${a}" is not available.`),l(e);let o=r?t.value.highlightAuto(e):t.value.highlight(e,{language:a,ignoreIllegals:i});return o.value||l(e)}catch(t){return console.error(`Highlighting error:`,t),l(e)}};return{hljs:t,loaded:n,loadHighlight:c,setTheme:s,currentTheme:r,escapeHtml:l,highlightCode:u}}const Fl={key:0,class:`label`},Il={class:`editor-content-papa relative`},Ll={class:`code-display`,wrap:``},Rl=[`innerHTML`],zl=[`value`];var Bl=h({__name:`Index`,props:{language:{type:String,default:`html`},readonly:{type:Boolean,default:!1},modelValue:{type:String,default:``},autodetect:{type:Boolean,default:!0},ignoreIllegals:{type:Boolean,default:!0},label:{type:String,default:``},height:{type:String,default:`240px`},disabled:{type:Boolean,default:!1},theme:{type:String,default:`dark`}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=R(n.modelValue||``),a=R(),{loaded:s,loadHighlight:c,highlightCode:f,setTheme:p}=Pl(n.theme),m=o(()=>{let e=n.height??`240px`;return e.match(/^\d+$/)?`${e}px`:e}),h=o(()=>f(i.value,n.language,n.autodetect,n.ignoreIllegals));function g(e){let t=e.target;i.value=t.value,r(`update:modelValue`,i.value)}function _(e){if(e.key!==`Tab`)return;e.preventDefault();let t=e.target,n=t.selectionStart,a=t.selectionEnd,o=`${i.value.substring(0,n)} ${i.value.substring(a)}`;i.value=o,r(`update:modelValue`,i.value),setTimeout(()=>{t.selectionStart=t.selectionEnd=n+2},0)}return j(async()=>{await c()}),q(()=>n.theme,e=>{p(e)}),q(()=>n.modelValue,e=>{e!==void 0&&e!==i.value&&(i.value=e)},{immediate:!0}),(t,n)=>(P(),u(`div`,{class:`code-editor-container ltr`,style:k({maxHeight:m.value})},[e.label?(P(),u(`label`,Fl,U(e.label),1)):l(``,!0),G(s)?(P(),u(`div`,{key:1,ref_key:`editorRef`,ref:a,class:`code-editor-grandpa hljs`},[d(`div`,Il,[d(`pre`,Ll,[d(`code`,{innerHTML:h.value},null,8,Rl)]),!e.readonly&&!e.disabled?(P(),u(`textarea`,{key:0,value:i.value,class:`code-input`,spellcheck:`false`,autocomplete:`off`,autocorrect:`off`,autocapitalize:`off`,onInput:g,onKeydown:_},null,40,zl)):l(``,!0)])],512)):l(``,!0)],4))}}),Vl=Y(Bl,[[`__scopeId`,`data-v-206c54b2`]]);const Hl=[`title`],Ul=[`id`,`placeholder`,`required`];var Wl=h({__name:`ColorInput`,props:{label:{},id:{},placeholder:{},modelValue:{},editMode:{type:Boolean,default:!0},small:{type:Boolean},required:{type:Boolean},nativeInputAttrs:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,i=R(n.modelValue);return q(()=>i.value,e=>{r(`update:modelValue`,e)}),(e,t)=>(P(),u(`div`,{class:D([`bagel-input testMe1`,{small:e.small}]),title:e.label},[d(`label`,null,[p(U(e.label)+` `,1),d(`div`,{class:D([`flex rounded colorInputPickWrap`,{"px-025 bg-input":!e.small}])},[pe(d(`input`,T({id:e.id,"onUpdate:modelValue":t[0]||=e=>i.value=e,class:[`border`,{"no-edit":!e.editMode,"opacity-1":!i.value}],type:`color`,placeholder:e.placeholder||e.label,required:e.required},e.nativeInputAttrs),null,16,Ul),[[de,i.value]]),e.small?l(``,!0):pe((P(),u(`input`,{key:0,"onUpdate:modelValue":t[1]||=e=>i.value=e,class:`flex-grow-1 border colorInputPick`,type:`text`,placeholder:`Enter color`},null,512)),[[de,i.value]]),m(G(X),{class:D({"not-allowed opacity-3":!i.value}),round:``,flat:``,thin:``,icon:`clear`,onClick:t[2]||=e=>i.value=``},null,8,[`class`])],2)])],10,Hl))}}),Gl=Wl;const Kl=/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/,ql=/^\d{4}-\d{2}-\d{2}$/;let Jl=function(e){return e.REGULAR=`regular`,e.SHORTENED=`shortened`,e.FLEXIBLE=`flexible`,e}({}),Yl=function(e){return e[e.MIDNIGHT=0]=`MIDNIGHT`,e[e.ONE_AM=100]=`ONE_AM`,e[e.TWO_AM=200]=`TWO_AM`,e[e.THREE_AM=300]=`THREE_AM`,e[e.FOUR_AM=400]=`FOUR_AM`,e[e.FIVE_AM=500]=`FIVE_AM`,e[e.SIX_AM=600]=`SIX_AM`,e[e.SEVEN_AM=700]=`SEVEN_AM`,e[e.EIGHT_AM=800]=`EIGHT_AM`,e[e.NINE_AM=900]=`NINE_AM`,e[e.TEN_AM=1e3]=`TEN_AM`,e[e.ELEVEN_AM=1100]=`ELEVEN_AM`,e[e.TWELVE_PM=1200]=`TWELVE_PM`,e[e.ONE_PM=1300]=`ONE_PM`,e[e.TWO_PM=1400]=`TWO_PM`,e[e.THREE_PM=1500]=`THREE_PM`,e[e.FOUR_PM=1600]=`FOUR_PM`,e[e.FIVE_PM=1700]=`FIVE_PM`,e[e.SIX_PM=1800]=`SIX_PM`,e[e.SEVEN_PM=1900]=`SEVEN_PM`,e[e.EIGHT_PM=2e3]=`EIGHT_PM`,e[e.NINE_PM=2100]=`NINE_PM`,e[e.TEN_PM=2200]=`TEN_PM`,e[e.ELEVEN_PM=2300]=`ELEVEN_PM`,e[e.TWELVE_AM=2400]=`TWELVE_AM`,e}({});var Xl=class{static getBrowserNavigatorLocale(){return typeof navigator==`object`?navigator.languages&&navigator.languages.length?navigator.languages[0]:navigator.language:`en-US`}static hasSlotContent(e){return e?e().some(e=>e.type===t||Array.isArray(e.children)&&!e.children.length?!1:e.type!==r||typeof e.children==`string`&&e.children.trim()!==``):!1}static getEventType(e,t){let n=Kl.test(e.time.start)&&Kl.test(e.time.end),r=ql.test(e.time.start)&&ql.test(e.time.end);if(n)return this.getTimedEventType(e,t);if(r)return this.getFullDayEventType(e,t);throw Error(`Event has invalid type`)}static getTimedEventType(e,t){if(t.dateStringsHaveEqualDates(e.time.start,e.time.end))return`SINGLE_DAY_TIMED`;if(t.dayMode===Jl.FLEXIBLE){let n=t.setHourInDateTimeString(t.addDaysToDateTimeString(1,t.dateStringFrom(e.time.start)),Ql.getHourFromTimePoints(t.DAY_END));if(e.time.end<n)return`SINGLE_HYBRID_DAY_TIMED`}return`MULTI_DAY_TIMED`}static getFullDayEventType(e,t){return t.dateStringsHaveEqualDates(e.time.start,e.time.end)?`SINGLE_DAY_FULL_DAY`:`MULTI_DAY_FULL_DAY`}static isUIEventTouchEvent(e){return`touches`in e&&typeof e.touches==`object`}};let Zl=function(e){return e.SUNDAY=`sunday`,e.MONDAY=`monday`,e}({});var Ql=class t{constructor(n=Zl.MONDAY,r=null,i={start:0,end:2400}){e.defineProperty(this,`FIRST_DAY_OF_WEEK`,void 0),e.defineProperty(this,`CALENDAR_LOCALE`,void 0),e.defineProperty(this,`ALL_HOURS`,[0,100,200,300,400,500,600,700,800,900,1e3,1100,1200,1300,1400,1500,1600,1700,1800,1900,2e3,2100,2200,2300]),e.defineProperty(this,`DAY_START`,void 0),e.defineProperty(this,`DAY_END`,void 0),e.defineProperty(this,`HOURS_PER_DAY`,24),e.defineProperty(this,`MS_PER_DAY`,void 0),this.FIRST_DAY_OF_WEEK=n,this.CALENDAR_LOCALE=r||Xl.getBrowserNavigatorLocale(),this.DAY_START=i.start,this.DAY_END=i.end,this.HOURS_PER_DAY=(()=>{let e=t.getHourFromTimePoints(this.DAY_END),n=t.getHourFromTimePoints(this.DAY_START);return e>n?e-n:this.HOURS_PER_DAY-n+e})(),this.MS_PER_DAY=864e5}get dayMode(){return this.DAY_START===0&&this.DAY_END===2400?Jl.REGULAR:this.DAY_START>=this.DAY_END?Jl.FLEXIBLE:Jl.SHORTENED}getDatesBetweenTwoDates(e,t){let n=[],r=new Date(e);for(;r<=t;)n.push(new Date(r.getFullYear(),r.getMonth(),r.getDate())),r.setDate(r.getDate()+1);return n}getCalendarWeekDateObjects(e){let t;t=this.FIRST_DAY_OF_WEEK===`sunday`?e.getDay():e.getDay()===0?6:e.getDay()-1;let n=e.getDate()-t,r=new Date(e.getFullYear(),e.getMonth(),n);return this.getDatesBetweenTwoDates(r,new Date(r.getFullYear(),r.getMonth(),r.getDate()+6))}getCalendarMonthSplitInWeeks(e,t){let n=[],r=new Date(e,t,1),i=new Date(r.getFullYear(),r.getMonth(),1),a=this.getCalendarWeekDateObjects(i);n.push(a);let o=!0,s=a[0],c=r.getMonth();for(;o;){let e=new Date(s.getFullYear(),s.getMonth(),s.getDate()+7);e.getMonth()===c?(n.push(this.getCalendarWeekDateObjects(e)),s=e):o=!1}return n}getCalendarYearMonths(e){let t=[],n=0;for(;n<=11;)t.push(new Date(e,n,1)),n++;return t}getHourAndMinutesFromTimePoints(e){let t=e.toString(),n=`0`,r=`0`;return t.length===4?(n=t[0]+t[1],r=t[2]+t[3]):t.length===3&&(n=t[0],r=t[1]+t[2]),{hour:+n,minutes:+r}}getHourLocaleStringFromHourDigits(e){let{hour:t,minutes:n}=this.getHourAndMinutesFromTimePoints(e),r=new Date(2100,0,1,+t,+n,0).toLocaleTimeString(this.CALENDAR_LOCALE,{hour:`2-digit`});return r[0]===`0`?r.substring(1):r}getLocalizedNameOfWeekday(e,t=`short`){return e.toLocaleDateString(this.CALENDAR_LOCALE,{weekday:t})}getLocalizedNameOfMonth(e,t=`short`){return e.toLocaleDateString(this.CALENDAR_LOCALE,{month:t})}getLocalizedDateString(e){return e.toLocaleDateString(this.CALENDAR_LOCALE)}getDateTimeStringFromDate(e,t){let n=e.getFullYear(),r=e.getMonth()+1,i=e.getDate(),a=`${n}-${r>=10?r:`0${r}`}-${i>=10?i:`0${i}`}`;if(!t){let t=e.getHours(),n=e.getMinutes();return`${a} ${t>=10?t:`0${t}`}:${n>=10?n:`0${n}`}`}let o=t===`start`?`00:00`:`23:59`;return`${a} ${o}`}getLocalizedTime(e){let{year:t,month:n,date:r,hour:i,minutes:a}=this.getAllVariablesFromDateTimeString(e),o=new Date(t,n,r,i,a);return o.toLocaleTimeString(this.CALENDAR_LOCALE,{hour:`numeric`,minute:`numeric`})}getLocalizedHour(e){return e.toLocaleTimeString(this.CALENDAR_LOCALE,{hour:`2-digit`})}getLocalizedTimeRange(e,t){return`${this.getLocalizedTime(e)} - ${this.getLocalizedTime(t)}`}getAllVariablesFromDateTimeString(e){return{year:+e.substring(0,4),month:e.substring(5,7)-1,date:+e.substring(8,10),hour:this.hourFrom(e),minutes:this.minutesFrom(e)}}dateIsToday(e){let t=new Date,n=t.getFullYear(),r=t.getMonth(),i=t.getDate(),a=e.getFullYear(),o=e.getMonth(),s=e.getDate();return n===a&&r===o&&i===s}dateIsInWeek(e,t){let n=new Date(e),r=n.getDate(),i=n.getMonth(),a=n.getFullYear();for(let e of t){let t=r===e.getDate(),n=i===e.getMonth(),o=a===e.getFullYear();if(t&&n&&o)return!0}return!1}getDateStringFromDate(e){let t=e.getFullYear(),n=e.getMonth()+1,r=e.getDate();return`${t}-${n>=10?n:`0${n}`}-${r>=10?r:`0${r}`}`}addMinutesToDateTimeString(e,t){let{year:n,month:r,date:i,hour:a,minutes:o}=this.getAllVariablesFromDateTimeString(t),s=new Date(n,r,i,a,o),c=new Date(s.getTime()+e*6e4);return this.getDateTimeStringFromDate(c)}addDaysToDateTimeString(e,t){return this.addMinutesToDateTimeString(e*1440,t)}dateStringsHaveEqualDates(e,t){let{year:n,month:r,date:i}=this.getAllVariablesFromDateTimeString(e),{year:a,month:o,date:s}=this.getAllVariablesFromDateTimeString(t);return n===a&&r===o&&i===s}setDateToEndOfDay(e){return new Date(e.getFullYear(),e.getMonth(),e.getDate(),23,59,59,999)}turnMinutesIntoPercentageOfHour(e){let t=100/60,n=t*e;return n<10?`0${n}`:n.toString()}getPercentageOfDayFromDateTimeString(e,t,n){let r=this.hourFrom(e),i=r*100,a=+e.substring(14,16),o=+this.turnMinutesIntoPercentageOfHour(+a);if(n>t){let e=n-t,r=i+o,a=r-t;return a/e*100}let s=Yl.TWELVE_AM-t,c=s+n,l=i+o,u=l>=t?l-t:s+l;return u/c*100}getTimeFromClick(e,t){if(t<=0)throw Error(`weekHeight cannot be a negative number`);if(e<0)throw Error(`clickOffsetY cannot be a negative number`);let n=this.DAY_START/100,r=t/this.HOURS_PER_DAY,i=Math.floor(e%r/(r/60));if(this.DAY_END<=this.DAY_START){let n=this.DAY_END/100,a=n*r,o=t-a;if(e>o){let t=Math.floor((e-o)/r);return`${this.doubleDigit(t)}:${this.doubleDigit(i)}`}}let a=Math.floor(e/r)+n;return`${this.doubleDigit(a)}:${this.doubleDigit(i)}`}setSegmentOfDateTimeString(e,t){if(t.hour<0||t.hour>23)throw Error(`Invalid hour`);let n=this.doubleDigit(t.hour);return e=e.replace(/\d{2}:/,`${n}:`),e}isTrailingOrLeadingDate(e,t){let n=new Date(e),r=n.getMonth();return t!==r}static getTimePointsFromHour(e){if(e<0||e>24||e%1!=0)throw Error(`Invalid day boundary`);return e===0?e:e*100}static getHourFromTimePoints(e){if(e<0||e>2400||e%100!=0)throw Error(`Invalid time points`);return e===0?e:e/100}getTimelineHours(){return this.dayMode===Jl.FLEXIBLE?[...this.ALL_HOURS.filter(e=>e>=this.DAY_START),...this.ALL_HOURS.filter(e=>e<this.DAY_END)]:this.ALL_HOURS.filter(e=>e>=this.DAY_START&&e<this.DAY_END)}dateStringFrom(e){return e.substring(0,10)}timeStringFrom(e){return e.substring(11,16)}hourFrom(e){return+e.substring(11,13)}minutesFrom(e){return+e.substring(14,16)}areDaysConsecutive(e,t){let n=this.dateStringFrom(this.addDaysToDateTimeString(1,e));return n===this.dateStringFrom(t)}setHourInDateTimeString(e,t){let n=this.doubleDigit(t);return e=e.replace(/\d{2}:/,`${n}:`),e}setMinutesInDateTimeString(e,t){let n=this.doubleDigit(t);return e=e.replace(/:\d{2}/,`:${n}`),e}getDateTimeStringDayBoundariesFrom(e){if(this.DAY_END<=this.DAY_START){let t=this.addDaysToDateTimeString(1,e),n=this.setHourInDateTimeString(t,this.getHourAndMinutesFromTimePoints(this.DAY_END).hour),r=this.setHourInDateTimeString(e,this.getHourAndMinutesFromTimePoints(this.DAY_START).hour);return{start:r,end:n}}let t=this.setHourInDateTimeString(e,this.getHourAndMinutesFromTimePoints(this.DAY_START).hour),n;return this.DAY_END===Yl.TWELVE_AM?(n=this.setHourInDateTimeString(e,23),n=this.setMinutesInDateTimeString(n,59)):n=this.setHourInDateTimeString(e,this.getHourAndMinutesFromTimePoints(this.DAY_END).hour),{start:t,end:n}}doubleDigit(e){if(e<0||e>60)throw Error(`Invalid number. This is not a valid hour or minute`);return e<10?`0${e}`:String(e)}};const $l={class:`calendar-section m_border-none px-05 pb-05 pt-025 m_p-0`},eu={class:`flex space-between pb-1`},tu={class:`flex gap-05`},nu={class:`month-year`},ru={key:0,class:`calendar-grid grid gap-025`},iu=[`disabled`,`onClick`],au={key:1,class:`month-grid grid gap-05 p-05`},ou={key:2,class:`year-grid grid gap-05 p-0`},su={key:0,class:`time-picker border-start flex column gap-1 w-120px px-025`},cu={class:`flex gap-025`};var lu=h({__name:`DatePicker`,props:{modelValue:{},min:{},max:{},mode:{default:()=>({mode:`day`})},firstDayOfWeek:{default:Zl.SUNDAY},locale:{default:``},enableTime:{type:Boolean,default:!1},highlightedDates:{},disabledDates:{},autoSize:{type:Boolean}},emits:[`update:modelValue`],setup(e,{emit:t}){let r=e,i=t,a=o(()=>W(r.highlightedDates)),s=o(()=>W(r.disabledDates)),f=R(new Date),h=R(`days`),g=new Ql(r.firstDayOfWeek,r.locale);function _(e){if(!e)return null;let t=typeof e==`string`?new Date(e):e;return Number.isNaN(t.getTime())?null:t}function v(){let e=e=>{if(!e)return!0;let t=_(r.min),n=_(r.max);if(t&&e<t||n&&e>n)return!0;if(Array.isArray(s.value)&&s.value.length>0){let t=s.value.some(t=>{let n=_(t);return n?e.getFullYear()===n.getFullYear()&&e.getMonth()===n.getMonth()&&e.getDate()===n.getDate():!1});if(t)return!0}return!1},t=e=>{let t=_(r.min),n=_(r.max);return!!(t&&e<t.getFullYear()||n&&e>n.getFullYear())};return{isDateDisabled:e,isYearDisabled:t}}function y(){let e=o(()=>_(r.modelValue));return{selectedDate:e}}let{isDateDisabled:b,isYearDisabled:x}=v(),{selectedDate:S}=y();function C(){let e=o(()=>{let e=f.value.getFullYear(),t=f.value.getMonth(),n=g.getCalendarMonthSplitInWeeks(e,t);for(;n.length<6;){let e=n[n.length-1],t=e[e.length-1],r=new Date(t.getFullYear(),t.getMonth(),t.getDate()+1),i=g.getCalendarWeekDateObjects(r);n.push(i)}return n.flat()}),t=o(()=>({month:f.value.getMonth(),year:f.value.getFullYear(),formatted:{month:g.getLocalizedNameOfMonth(f.value,`long`),year:g.getLocalizedDateString(f.value).split(`/`).pop()}})),n=o(()=>Array.from({length:12},(e,n)=>{let r=new Date(t.value.year,n,1);return{name:g.getLocalizedNameOfMonth(r,`short`),value:n,disabled:b(r)}})),i=o(()=>{let e=t.value.year-10;return Array.from({length:18},(t,n)=>({value:e+n,disabled:x(e+n)}))}),s=o(()=>{let e=new Date;return e.setDate(e.getDate()-e.getDay()+(r.firstDayOfWeek===Zl.MONDAY?1:0)),Array.from({length:7},(t,n)=>{let r=new Date(e);return r.setDate(e.getDate()+n),g.getLocalizedNameOfWeekday(r,`short`)})}),c=e=>!e||!S.value?!1:e.getFullYear()===S.value.getFullYear()&&e.getMonth()===S.value.getMonth()&&e.getDate()===S.value.getDate(),l=e=>e?g.dateIsToday(e):!1,u=e=>g.isTrailingOrLeadingDate(e,f.value.getMonth()),d=o(()=>e=>!e||!Array.isArray(a.value)||!a.value.length?!1:a.value.some(t=>{let n=_(t);return n?e.getFullYear()===n.getFullYear()&&e.getMonth()===n.getMonth()&&e.getDate()===n.getDate():!1}));return{currentMonthDays:e,currentMonthValue:t,months:n,years:i,weekDays:s,isSelected:c,isToday:l,isNotInMonth:u,isHighlighted:d}}function w(){let e=e=>{f.value=new Date(f.value.getFullYear(),e,1),h.value=`days`},t=e=>{f.value=new Date(e,f.value.getMonth(),1),h.value=`months`},n=()=>{f.value=new Date(f.value.getFullYear(),f.value.getMonth()-1,1)},r=()=>{f.value=new Date(f.value.getFullYear(),f.value.getMonth()+1,1)},i=()=>{let e=h.value===`months`?1:21;f.value=new Date(f.value.getFullYear()-e,f.value.getMonth(),1)},a=()=>{let e=h.value===`months`?1:21;f.value=new Date(f.value.getFullYear()+e,f.value.getMonth(),1)};return{selectMonth:e,selectYear:t,previousMonth:n,nextMonth:r,previousYear:i,nextYear:a}}function T(){let e=o(()=>{var e;return(e=S.value)?.getHours()??0}),t=o(()=>{var e;return(e=S.value)?.getMinutes()??0}),n=e=>{if(!S.value)return;let t=new Date(S.value);t.setHours(e),E(t)},r=e=>{if(!S.value)return;let t=new Date(S.value);t.setMinutes(e),E(t)};return{hours:e,minutes:t,handleHourInput:n,handleMinuteInput:r}}function E(e){if(r.enableTime)i(`update:modelValue`,e.toISOString());else{let t=new Date(e);t.setHours(0,0,0,0),i(`update:modelValue`,t.toISOString())}}let{currentMonthDays:O,currentMonthValue:k,months:A,years:j,weekDays:ee,isSelected:M,isToday:N,isNotInMonth:F,isHighlighted:I}=C(),{selectMonth:L,selectYear:te,previousMonth:B,nextMonth:ne,previousYear:re,nextYear:V}=w(),{hours:H,minutes:ie,handleHourInput:ae,handleMinuteInput:oe}=T();function se(e){if(e)if(r.enableTime){var t,n;let r=new Date(e.getFullYear(),e.getMonth(),e.getDate()),i=(t=S.value)?.getHours()??new Date().getHours(),a=(n=S.value)?.getMinutes()??new Date().getMinutes();r.setHours(i),r.setMinutes(a),E(r)}else{let t=new Date(e.getFullYear(),e.getMonth(),e.getDate());E(t)}}return(e,t)=>(P(),u(`div`,{class:D([`ltr gap-075 m_flex-wrap calendar-container justify-content-center h-100p border p-025`,{flex:!e.autoSize}])},[d(`div`,$l,[d(`div`,eu,[h.value===`days`?(P(),u(n,{key:0},[m(G(X),{flat:``,thin:``,icon:`chevron_left`,onClick:G(B)},null,8,[`onClick`]),d(`div`,tu,[m(G(X),{flat:``,thin:``,class:`month-btn`,onClick:t[0]||=e=>h.value=`months`},{default:J(()=>[p(U(G(k).formatted.month),1)]),_:1}),m(G(X),{flat:``,thin:``,class:`year-btn`,onClick:t[1]||=e=>h.value=`years`},{default:J(()=>[p(U(G(k).formatted.year),1)]),_:1})]),m(G(X),{flat:``,thin:``,icon:`chevron_right`,onClick:G(ne)},null,8,[`onClick`])],64)):(P(),u(n,{key:1},[m(G(X),{flat:``,thin:``,icon:`chevron_left`,onClick:G(re)},null,8,[`onClick`]),d(`span`,nu,U(G(k).formatted.year),1),m(G(X),{flat:``,thin:``,icon:`chevron_right`,onClick:G(V)},null,8,[`onClick`])],64))]),h.value===`days`?(P(),u(`div`,ru,[(P(!0),u(n,null,z(G(ee),e=>(P(),u(`div`,{key:e,class:`txt-center txt-12 opacity-6`},U(e),1))),128)),(P(!0),u(n,null,z(G(O),e=>(P(),u(`button`,{key:e?.toISOString(),type:`button`,class:D([`day aspect-ratio-1 flex align-items-center justify-content-center pointer round txt14 p-0`,{selected:G(M)(e),today:G(N)(e),disabled:G(b)(e),"not-in-month":G(F)(e),highlighted:G(I)(e)}]),disabled:G(b)(e),onClick:t=>se(e)},U(e?.getDate()),11,iu))),128))])):h.value===`months`?(P(),u(`div`,au,[(P(!0),u(n,null,z(G(A),e=>(P(),c(G(X),{key:e.value,thin:``,flat:e.value!==G(k).month,disabled:e.disabled,value:e.name,onClick:t=>G(L)(e.value)},null,8,[`flat`,`disabled`,`value`,`onClick`]))),128))])):(P(),u(`div`,ou,[(P(!0),u(n,null,z(G(j),e=>(P(),c(G(X),{key:e.value,thin:``,flat:e.value!==G(k).year,disabled:e.disabled,value:e.value.toString(),onClick:t=>G(te)(e.value)},null,8,[`flat`,`disabled`,`value`,`onClick`]))),128))]))]),e.enableTime&&h.value===`days`?(P(),u(`div`,su,[d(`div`,cu,[m(G(Vu),{center:``,modelValue:G(H),disabled:!G(S),min:0,max:23,layout:`vertical`,padZero:2,"onUpdate:modelValue":G(ae)},null,8,[`modelValue`,`disabled`,`onUpdate:modelValue`]),t[2]||=d(`p`,{class:`pb-075`},` : `,-1),m(G(Vu),{center:``,modelValue:G(ie),disabled:!G(S),min:0,max:59,padZero:2,layout:`vertical`,"onUpdate:modelValue":G(oe)},null,8,[`modelValue`,`disabled`,`onUpdate:modelValue`])])])):l(``,!0)],2))}}),uu=Y(lu,[[`__scopeId`,`data-v-55eb37a5`]]);const du=[`title`],fu={key:0},pu={key:0,class:`required`};var mu=h({__name:`DateInput`,props:w({required:{type:Boolean},label:{},editMode:{type:Boolean,default:!0},small:{type:Boolean,default:!1},enableTime:{type:Boolean,default:!1},modelValue:{},min:{},max:{},mode:{default:()=>({mode:`day`})},defaultValue:{},firstDayOfWeek:{default:Zl.SUNDAY},locale:{default:``},center:{type:Boolean}},{modelValue:{default:()=>new Date},modelModifiers:{}}),emits:[`update:modelValue`],setup(e){let t=e,n=se(e,`modelValue`),r=R(!1);function i(){let e=e=>e?tk(e,{fmt:t.enableTime?`DD.MM.YY HH:mm`:`DD.MM.YY`}):``,n=e=>{let t=new Date(e);if(!Number.isNaN(t.getTime()))return t;let n=e.split(/[/.-]/);if(n.length===3){let[e,t,r]=n.map(e=>Number.parseInt(e,10));if(!Number.isNaN(e)&&!Number.isNaN(t)&&!Number.isNaN(r)){let n=new Date(r,t-1,e);if(n.getFullYear()===r&&n.getMonth()===t-1&&n.getDate()===e)return n}}return null},r=e=>{if(t.enableTime)return e.toISOString();{let t=new Date(e);return t.setHours(0,0,0,0),t.toISOString().split(`T`)[0]}};return{formatDisplayDate:e,parseUserInput:n,normalizeDate:r}}let{formatDisplayDate:a,parseUserInput:o,normalizeDate:s}=i();function c(){let e=R(``),t=t=>{let r=t.target;e.value=r.value;let i=o(r.value);i&&(n.value=s(i))},i=e=>{e.preventDefault(),e.stopPropagation(),r.value=!0},a=e=>{e.preventDefault(),e.stopPropagation()},c=t=>{if(t.key===`Escape`)r.value=!1;else if(t.key===`Enter`&&e.value){let t=o(e.value);t&&(n.value=s(t),r.value=!1)}};return{inputValue:e,handleInput:t,handleFocus:i,handleClick:a,handleKeydown:c}}let{handleInput:f,handleFocus:h,handleClick:g,handleKeydown:_}=c(),v=R(null),y=R(null);return j(()=>{Pn(v.value,()=>{r.value=!1},{ignore:()=>[y.value]})}),(e,t)=>(P(),u(`div`,{class:D([`bagel-input`,{small:e.small}]),title:e.label,onFocusin:t[4]||=(...e)=>G(h)&&G(h)(...e)},[e.label?(P(),u(`label`,fu,[p(U(e.label)+` `,1),e.required?(P(),u(`span`,pu,`*`)):l(``,!0)])):l(``,!0),m(G(nc),{shown:r.value,placement:`bottom-start`,autoHide:!1,triggers:[`click`]},{trigger:J(()=>[d(`div`,{ref_key:`datePickerRef`,ref:v,class:`date-picker-container`,onMousedown:t[0]||=he(()=>{},[`stop`]),onClick:t[1]||=he(()=>{},[`stop`])},[m(G(Ld),{modelValue:G(a)(n.value),iconStart:`calendar`,min:G(a)(e.min),max:G(a)(e.max),required:e.required,disabled:!e.editMode,class:D([`date-input m-0`,{"txt-center":e.center}]),readonly:!1,onInput:G(f),onFocus:G(h),onClick:G(g),onKeydown:G(_)},null,8,[`modelValue`,`min`,`max`,`required`,`disabled`,`class`,`onInput`,`onFocus`,`onClick`,`onKeydown`])],544)]),default:J(()=>[d(`div`,{ref_key:`calendarRef`,ref:y,onClick:t[3]||=he(()=>{},[`stop`])},[m(uu,{modelValue:n.value,"onUpdate:modelValue":t[2]||=e=>n.value=e,min:e.min,max:e.max,mode:e.mode,firstDayOfWeek:e.firstDayOfWeek,locale:e.locale,enableTime:e.enableTime},null,8,[`modelValue`,`min`,`max`,`mode`,`firstDayOfWeek`,`locale`,`enableTime`])],512)]),_:1},8,[`shown`])],42,du))}}),hu=mu;const gu=[`jpeg`,`png`,`webp`,`avif`,`apng`,`gif`,`avifs`,`svg`,`bmp`,`jpg`,`heic`,`heif`,`ico`,`cur`,`tif`,`tiff`],_u=RegExp(`(${gu.join(`|`)})$`,`i`),vu=[`mp4`,`webm`,`ogg`,`mov`,`avi`,`flv`,`wmv`,`mkv`,`ts`,`m3u8`],yu=RegExp(`(${vu.join(`|`)})$`,`i`),bu=/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-0-9]+\.)+[a-z]{2,}))$/i,xu=[`title`],Su=[`for`],Cu={class:`flex`},wu={key:0},Tu={key:1,class:`opacity-7 light`},Eu={key:3,class:`validating`},Du=[`id`,`name`,`title`,`placeholder`,`disabled`,`required`];var Ou=h({__name:`EmailInput`,props:{id:{},title:{},helptext:{},name:{},placeholder:{},modelValue:{default:``},label:{},small:{type:Boolean},required:{type:Boolean},pattern:{default:`[a-z0-9._%+\\-]+@[a-z0-9.\\-]+\\.[a-z]{2,}`},defaultValue:{},shrink:{type:Boolean},disabled:{type:Boolean},nativeInputAttrs:{},icon:{},iconStart:{},autocomplete:{},autofocus:{type:Boolean},onFocusout:{},onFocus:{},autocorrect:{type:Boolean,default:!0},serverValidate:{type:Boolean,default:!1},preventFakeEmails:{type:Boolean,default:!1},validate:{},getFormData:{}},emits:[`update:modelValue`,`debounce`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=[`gmail.com`,`yahoo.com`,`hotmail.com`,`outlook.com`,`aol.com`,`icloud.com`,`protonmail.com`,`mail.com`,`zoho.com`,`yandex.com`,`gmx.com`,`live.com`,`msn.com`],o=`mailinator.com,tempmail.com,10minutemail.com,guerrillamail.com,guerrillamail.info,throwawaymail.com,yopmail.com,tempinbox.com,dispostable.com,mailnesia.com,trashmail.com,sharklasers.com,temp-mail.org,fakeinbox.com,getnada.com,armyspy.com,cuvox.de,dayrep.com,einrot.com,fleckens.hu,gustr.com,jourrapide.com,rhyta.com,superrito.com,teleworm.us,nbmbb.com,poplk.com`.split(`,`),s=R(``),f=R(null),m=R(``),h=R(!1),g=R(!0),_=new Map,v=R();function y(e){if(e){if(!bu.test(e))return`Please enter a valid email address`;if(r.preventFakeEmails&&e.includes(`@`)){let[,t]=e.split(`@`);if(t){let e=t.toLowerCase();if(o.includes(e))return`Please use a non-disposable email address`}}if(m.value)return m.value}}let b=bn(()=>{i(`debounce`,s.value)},700);function S(){if(!v.value||(v.value.setCustomValidity(``),!s.value))return;let e=y(s.value);typeof e==`string`&&v.value.setCustomValidity(e)}async function C(e){if(!(!r.serverValidate||!e||!bu.test(e))){if(_.has(e)){g.value=_.get(e)||!1;return}h.value=!0,m.value=``;try{var t;let r=await fetch(`https://api.mailcheck.ai/domain/${e.split(`@`)[1]}`,{method:`GET`,headers:{"Content-Type":`application/json`}});if(!r.ok)throw Error(`Validation service unavailable`);let i=await r.json(),a=i.status===`valid`||i.has_mx===!0;if(g.value=a,_.set(e,a),a)(t=v.value)?.setCustomValidity(``);else{var n;m.value=`This email domain appears to be invalid`,(n=v.value)?.setCustomValidity(m.value)}}catch(e){console.error(`Email validation error:`,e)}finally{h.value=!1}}}function w(e){if(!r.autocorrect||!e)return;if(e.includes(`@`)&&!e.includes(`.`)){let[t,n]=e.split(`@`),r=n.toLowerCase();for(let e of a)if(e.startsWith(r)){f.value=`${t}@${e}`;return}}if(!e.includes(`@`))return;let[t,n]=e.split(`@`),i=n.toLowerCase();if(a.includes(i)){f.value=null;return}for(let e of a)if(k(i,e)<=2){f.value=`${t}@${e}`.toLowerCase();return}f.value=null}function O(){f.value&&(s.value=f.value,f.value=null,i(`update:modelValue`,s.value),b())}function k(e,t){let n=[];for(let t=0;t<=e.length;t++)n[t]=[t];for(let e=0;e<=t.length;e++)n[0][e]=e;for(let r=1;r<=e.length;r++)for(let i=1;i<=t.length;i++){let a=e[r-1]===t[i-1]?0:1;n[r][i]=Math.min(n[r-1][i]+1,n[r][i-1]+1,n[r-1][i-1]+a)}return n[e.length][t.length]}let A=bn(()=>C(s.value),1e3);function ee(){r.disabled||(f.value=null,S(),r.serverValidate&&A(),i(`update:modelValue`,s.value),b())}function M(e){w(s.value),r.serverValidate&&bu.test(s.value)&&C(s.value),r.onFocusout&&r.onFocusout(e)}q(()=>r.modelValue,e=>{e!==s.value&&(s.value=e||``,E(()=>{S()}))},{immediate:!0}),q(()=>s.value,()=>{S()},{immediate:!0});let N=()=>document.activeElement===v.value,F=()=>{var e;return(e=v.value)?.focus()};return t({focus:F,hasFocus:N}),j(()=>{r.autofocus&&setTimeout(()=>{var e;return(e=v.value)?.focus()},10),r.defaultValue&&!r.modelValue&&(s.value=r.defaultValue)}),(e,t)=>{let n=re(`pattern`);return P(),u(`div`,{class:D([`bagel-input text-input`,{small:e.small,shrink:e.shrink,textInputIconWrap:e.icon,txtInputIconStart:e.iconStart,"is-validating":h.value}]),title:e.title},[d(`label`,{for:e.id},[d(`div`,Cu,[p(U(e.label)+` `,1),e.required?(P(),u(`span`,wu,`*`)):l(``,!0),e.helptext?(P(),u(`span`,Tu,U(e.helptext),1)):l(``,!0),f.value?(P(),u(`span`,{key:2,class:`pointer nowrap inline-block ms-auto color-red txt-10px p-0`,onClick:he(O,[`prevent`])},` did you mean `+U(f.value)+`? `,1)):l(``,!0),h.value?(P(),u(`span`,Eu,`Validating email...`)):l(``,!0)]),pe(d(`input`,T({id:e.id,ref_key:`input`,ref:v,"onUpdate:modelValue":t[0]||=e=>x(s)?s.value=e:s=e,class:`ltr`,name:e.name,title:e.title,autocomplete:`email`,type:`email`,placeholder:e.placeholder||e.label,disabled:e.disabled,required:e.required},e.nativeInputAttrs,{onFocusout:M,onFocus:t[1]||=(...t)=>e.onFocus&&e.onFocus(...t),onInput:ee}),null,16,Du),[[de,G(s)],[n,void 0,`lower`]]),e.iconStart?(P(),c(G($),{key:0,class:`iconStart`,icon:e.iconStart},null,8,[`icon`])):l(``,!0),e.icon?(P(),c(G($),{key:1,icon:e.icon},null,8,[`icon`])):l(``,!0)],8,Su)],10,xu)}}}),ku=Y(Ou,[[`__scopeId`,`data-v-e3d13caa`]]);const Au=[`title`],ju={key:0},Mu=[`value`,`placeholder`];var Nu=h({__name:`JSONInput`,props:{description:{default:``},label:{default:``},modelValue:{},placeholder:{default:``},editMode:{type:Boolean,default:!0},small:{type:Boolean}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=t;function r(e){let t=e.target;n(`update:modelValue`,t.value)}return(e,t)=>{let n=ne(`LangText`);return P(),u(`div`,{class:D([`bagel-input`,{small:e.small}]),title:e.description},[e.label?(P(),u(`label`,ju,[m(n,{input:e.label},null,8,[`input`])])):l(``,!0),d(`textarea`,{value:e.modelValue,class:D({"no-edit":!e.editMode}),placeholder:e.placeholder,onInput:r},null,42,Mu)],10,Au)}}}),Pu=Y(Nu,[[`__scopeId`,`data-v-1cbaeab2`]]);const Fu=[`for`],Iu={key:0,class:`block`},Lu=[`id`,`placeholder`,`disabled`,`required`,`readonly`,`pattern`,`onKeydown`],Ru={key:1,class:`opacity-7 light`},zu={key:5,class:`flex column spinner`};var Bu=h({__name:`NumberInput`,props:{modelValue:{},min:{},max:{},step:{default:1},spinner:{type:Boolean,default:!0},iconStart:{},icon:{},label:{},defaultValue:{},placeholder:{},disabled:{type:Boolean},required:{type:Boolean},id:{},helptext:{},layout:{},center:{type:Boolean},padZero:{default:1},useGrouping:{type:Boolean,default:!0}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=t,r=R();j(()=>{let t=e.modelValue===void 0?void 0:Number.parseFloat(`${e.modelValue}`),n=e.defaultValue===void 0?void 0:Number.parseFloat(`${e.defaultValue}`);r.value=t??n});let i=[`horizontal`,`vertical`];function a(...t){var n;let r=t.map(e=>e||0),i=(n=e.step.toString().split(`.`)[1])?.length||0;return Number.parseFloat(r.reduce((e,t)=>e+t,0).toFixed(i))}function s(...t){var n;let r=t.map(e=>e||0),i=r.shift()||0,a=(n=e.step.toString().split(`.`)[1])?.length||0;return Number.parseFloat(r.reduce((e,t)=>e-t,i).toFixed(a))}let f=o(()=>e.max===void 0||a(r.value,e.step)<=e.max),p=o(()=>e.min===void 0||s(r.value,e.step)>=e.min);function h(){f.value&&(r.value=a(r.value??0,e.step),n(`update:modelValue`,r.value))}function g(){p.value&&(r.value=s(r.value||0,e.step),n(`update:modelValue`,r.value))}function _(t){if(Number.isNaN(t))return``;let n=new Intl.NumberFormat(`en-US`,{minimumFractionDigits:0,maximumFractionDigits:20,useGrouping:e.useGrouping}),r=n.format(t),[i,a]=r.split(`.`),o=e.padZero&&e.padZero>i.replace(/,/g,``).length?`0`.repeat(e.padZero-i.replace(/,/g,``).length):``;return a?`${o}${i}.${a}`:`${o}${i}`}let v=R(``);function y(){let e=v.value.replace(/[^\d.-]/g,``),t=[``,`-`,`.`,`-.`].includes(e),i=v.value.endsWith(`.`),a=/\.\d*0$/.test(e);if(t||i||a){n(`update:modelValue`,e===`-`?`-`:e);return}r.value=Number.parseFloat(e),v.value=t?``:_(r.value),n(`update:modelValue`,r.value)}return q(()=>r.value,()=>{E(()=>{v.value.endsWith(`.`)||/\.\d*0$/.test(v.value)||(v.value=r.value===void 0?``:_(r.value))})}),q(()=>e.modelValue,e=>{if(e!==r.value){if(typeof e==`string`&&(e===`-`||e.endsWith(`.`))){v.value=e;return}r.value=Number.parseFloat(`${e}`)||0}},{immediate:!0}),(e,t)=>{let n=re(`pattern`);return P(),u(`div`,{class:D([`bagel-input num-input`,{textInputSpinnerWrap:e.icon||e.spinner,txtInputIconStart:e.iconStart}])},[d(`div`,{for:e.id},[e.label?(P(),u(`label`,Iu,U(e.label),1)):l(``,!0),d(`div`,{class:D([`gap-025`,{"column flex":e.layout===`vertical`,flex:e.layout===`horizontal`}])},[e.layout&&i.includes(e.layout)?(P(),c(G(X),{key:0,flat:``,icon:`add`,class:D([`radius`,[{"bgl-big-ctrl-num-btn":e.layout===`vertical`}]]),tabindex:`-1`,onClick:h},null,8,[`class`])):l(``,!0),pe(d(`input`,{id:e.id,"onUpdate:modelValue":t[0]||=e=>x(v)?v.value=e:v=e,type:`text`,class:D({"txt-center":e.center,min0:e.layout,"bgl-number-input":e.layout!==`vertical`&&e.layout!==`horizontal`}),placeholder:e.placeholder||e.label,disabled:e.disabled,required:e.required,readonly:e.disabled,inputmode:`decimal`,autocomplete:`off`,pattern:e.useGrouping?`^-?\\d{1,3}(,\\d{3})*(.\\d+)?$`:`^-?\\d*.?d*$`,autocorrect:`off`,spellcheck:`false`,onInput:y,onKeydown:[me(he(h,[`prevent`]),[`up`]),me(he(g,[`prevent`]),[`down`])]},null,42,Lu),[[de,G(v),void 0,{trim:!0}],[n,void 0,void 0,{number:!0}]]),e.helptext?(P(),u(`p`,Ru,U(e.helptext),1)):l(``,!0),e.iconStart?(P(),c(G($),{key:2,class:`iconStart`,size:`0.9`,icon:e.iconStart},null,8,[`icon`])):l(``,!0),e.icon?(P(),c(G($),{key:3,icon:e.icon,size:`0.9`},null,8,[`icon`])):l(``,!0),e.layout&&i.includes(e.layout)?(P(),c(G(X),{key:4,flat:``,icon:`remove`,class:D([`radius`,[{"bgl-big-ctrl-num-btn":e.layout===`vertical`}]]),tabindex:`-1`,onClick:g},null,8,[`class`])):l(``,!0),e.spinner&&(!e.layout||!i.includes(e.layout))?(P(),u(`div`,zu,[m(G(X),{icon:`add`,flat:``,thin:``,class:`bgl-ctrl-num-btn ctrl-add top-bgl-ctrl-num-btn`,disabled:!f.value,tabindex:`-1`,onClick:h},null,8,[`disabled`]),m(G(X),{icon:`remove`,flat:``,thin:``,class:`bgl-ctrl-num-btn ctrl-remove`,disabled:!p.value,tabindex:`-1`,onClick:g},null,8,[`disabled`])])):l(``,!0)],2)],8,Fu)],2)}}}),Vu=Y(Bu,[[`__scopeId`,`data-v-ce37385e`]]);const Hu=[`value`,`autofocus`,`onKeydown`,`onPaste`];var Uu=h({__name:`OTP`,props:{digitCount:{},default:{},modelValue:{}},emits:[`update:modelValue`,`complete`],setup(e,{emit:t}){let r=e,i=t,a=te([]),o=R();function s(e,t){e.preventDefault();let{clipboardData:n}=e,r=n?.getData(`text`).replaceAll(/\D/g,``),i=[...r??``];if(i){for(let e=0;e<i.length;e++){let n=i[e];t+e<a.length&&(a[t+e]=n)}c()}}function c(){i(`update:modelValue`,a.join(``)),d()&&i(`complete`,a.join(``))}function l(e,t){let n=[`Tab`,`ArrowRight`,`ArrowLeft`,`Control`,`Shift`,`Alt`,`Meta`];if(n.includes(e.key))return;let i=[`ArrowUp`,`ArrowDown`];if(i.includes(e.key)){e.preventDefault();return}if(e.key===`Backspace`){if(a[t]=void 0,t!==0){var s;let e=(s=o.value)?.children[t-1];e.focus()}c();return}let l=/^\d$/;l.test(e.key)&&(a[t]=e.key,t!==r.digitCount-1&&setTimeout(()=>{var e;let n=(e=o.value)?.children[t+1];n.focus()},10),c())}if(r.default&&r.default.length===r.digitCount)for(let e=0;e<r.digitCount;e++)a[e]=r.default.charAt(e);else for(let e=0;e<r.digitCount;e++)a[e]=void 0;function d(){for(let e of a)if(e===void 0)return!1;return!0}return(e,t)=>(P(),u(`div`,{ref_key:`otpCont`,ref:o,class:`otp_wrap`},[(P(!0),u(n,null,z(a,(e,n)=>(P(),u(`input`,{key:n,value:a[n]||``,type:`number`,inputmode:`numeric`,class:`digit-box`,autofocus:n===0,maxlength:`1`,pattern:`[0-9]*`,oninput:`this.value = this.value.slice(0, 1)`,onKeydown:e=>l(e,n),onPaste:e=>s(e,n),onKeyup:t[0]||=he(()=>{},[`prevent`])},null,40,Hu))),128))],512))}}),Wu=Y(Uu,[[`__scopeId`,`data-v-ab0a46bf`]]);const Gu={class:`relative passwordInput`},Ku={class:`m-password position-bottom-end flex column justify-content-center`};var qu=h({__name:`PasswordInput`,props:w({id:{},title:{},helptext:{},placeholder:{},label:{default:``},small:{type:Boolean},dense:{type:Boolean},required:{type:Boolean},pattern:{},shrink:{type:Boolean},disabled:{type:Boolean},name:{},nativeInputAttrs:{},icon:{},iconStart:{},multiline:{type:Boolean},autoheight:{type:Boolean},code:{type:Boolean},lines:{},autofocus:{type:Boolean},debounceDelay:{},autocomplete:{default:`current-password`},onFocusout:{}},{modelValue:{},modelModifiers:{},showPwd:{type:Boolean,default:!1},showPwdModifiers:{}}),emits:[`update:modelValue`,`update:showPwd`],setup(e){let t=e,n=se(e,`modelValue`),r=se(e,`showPwd`),i=o(()=>r.value?`visibility_off`:`visibility`),a=o(()=>r.value?`text`:`password`);return(e,o)=>(P(),u(`div`,Gu,[m(G(Ld),T({modelValue:n.value,"onUpdate:modelValue":o[0]||=e=>n.value=e},t,{type:a.value,class:`mb-0`,name:t.name}),null,16,[`modelValue`,`type`,`name`]),d(`div`,Ku,[m(G(X),{flat:``,thin:``,class:`mx-05`,icon:i.value,onClick:o[1]||=e=>r.value=!r.value},null,8,[`icon`])])]))}}),Ju=qu;const Yu=[`for`],Xu=[`id`,`disabled`,`name`,`value`,`required`],Zu=[`src`,`alt`],Qu={class:``},$u=[`innerHTML`],ed={key:1,class:`txt-gray txt-12 m-0 pt-025`};var td=h({__name:`RadioGroup`,props:w({id:{},groupName:{},options:{},deletable:{type:Boolean},required:{type:Boolean},error:{},disabled:{type:Boolean},thin:{type:Boolean},flat:{type:Boolean},invertedActive:{type:Boolean},align:{default:`center`},hideRadio:{type:Boolean},bgColor:{},activeBgColor:{},borderColor:{},textColor:{},textAlign:{}},{modelValue:{},modelModifiers:{}}),emits:w([`delete`,`focus`,`blur`,`change`],[`update:modelValue`]),setup(e,{emit:t}){oe(e=>({"3f077eaa":e.activeBgColor||`var(--bgl-primary-light)`}));let r=e,i=t,a=o(()=>r.groupName||r.id||Math.random().toString(36).substring(2,15)),s=se(e,`modelValue`),f=R([]),p=o(()=>Array.isArray(r.options)?r.options:f.value);async function m(){if(typeof r.options==`function`)try{f.value=await r.options()}catch{f.value=[]}}q(()=>r.options,()=>{f.value=[],m()},{immediate:!0,deep:!0});let h=R(!1),g=o(()=>({"has-error":!!r.error,"is-disabled":r.disabled,"is-focused":h.value}));function _(){h.value=!0,i(`focus`)}function v(){h.value=!1,i(`blur`)}function y(){i(`change`,s.value)}return(e,t)=>(P(),u(`div`,{class:D(g.value)},[(P(!0),u(n,null,z(p.value,(n,r)=>(P(),u(`label`,{key:n.id||`${a.value}-${r}`,class:D([`border rounded flex active-list-item hover`,{"p-05 gap-025":e.thin,"py-1 gap-075":!e.thin,"ps-05":!e.hideRadio,"bg-gray-light":!e.bgColor&&!e.flat,"align-items-start":e.align===`start`||e.align===`top`,"align-items-center":e.align===`center`,"align-items-end":e.align===`end`||e.align===`bottom`,invertedActive:e.invertedActive}]),for:n.id||`${a.value}-${r}`,style:k({backgroundColor:e.bgColor,borderColor:e.borderColor})},[pe(d(`input`,{id:n.id||`${a.value}-${r}`,"onUpdate:modelValue":t[0]||=e=>s.value=e,disabled:e.disabled,class:D([`radio-input-list`,{"mt-025":e.align===`start`||e.align===`top`,"mb-025":e.align===`end`||e.align===`bottom`,hideRadio:e.hideRadio}]),type:`radio`,name:a.value,value:n.value,required:e.required,onFocus:_,onBlur:v,onChange:y},null,42,Xu),[[ue,s.value]]),d(`div`,{class:D([`flex w-100 gap-1 flex-wrap m_gap-05 m_gap-row-025`,{"txt-center justify-content-center":e.textAlign===`center`,"txt-end justify-content-end":e.textAlign===`right`,"txt-start justify-content-start":e.textAlign===`left`}]),style:k({color:e.textColor})},[n.imgSrc?(P(),u(`img`,{key:0,class:`bg-popup shadow-light py-025 radius-05 m_w40`,height:`40`,src:n.imgSrc,alt:n.imgAlt},null,8,Zu)):l(``,!0),d(`div`,Qu,[n.label?(P(),u(`div`,{key:0,class:`m-0 m_txt-14 line-height-14`,innerHTML:n.label},null,8,$u)):l(``,!0),n.subLabel?(P(),u(`p`,ed,U(n.subLabel),1)):l(``,!0)]),B(e.$slots,`radioItem`,T({ref_for:!0},n),void 0,!0)],6),e.deletable?(P(),c(G(X),{key:0,class:`ms-auto`,flat:``,thin:``,icon:`delete`,onClick:t=>e.$emit(`delete`,n)},null,8,[`onClick`])):l(``,!0)],14,Yu))),128))],2))}}),nd=Y(td,[[`__scopeId`,`data-v-3c01ca25`]]);const rd={class:`bagel-input`},id={class:`pb-025`},ad={class:`flex gap-05 flex-wrap`},od=[`id`,`name`,`value`,`checked`],sd=[`for`];var cd=h({__name:`RadioPillsInput`,props:{options:{},modelValue:{default:``},id:{default:()=>`radio-pill-${Math.random().toString(36).slice(2,9)}`},label:{default:``}},emits:[`update:modelValue`],setup(e,{emit:t}){let r=e,i=t;function a(e){return typeof e==`string`?e:typeof e==`number`?`${e}`:typeof e==`boolean`?e?`Yes`:`No`:e.label}function o(e){return typeof e==`string`||typeof e==`number`?e:typeof e==`boolean`?e?`Yes`:`No`:e.value}let s=R(r.modelValue);function c(e){var t;let n=(t=e.target)?.value;i(`update:modelValue`,n),s.value=n}return q(()=>r.modelValue,(e,t)=>{e===t||t===void 0||s.value!==e&&(s.value=e)},{immediate:!0}),j(()=>{s.value=r.modelValue}),(e,t)=>(P(),u(`div`,rd,[d(`label`,id,U(e.label),1),d(`div`,ad,[(P(!0),u(n,null,z(e.options,(t,n)=>(P(),u(`div`,{key:n,class:`radio-pill`},[d(`input`,{id:`${e.id}-${o(t)}`,type:`radio`,name:e.id,value:o(t),checked:G(s)===o(t),onChange:c},null,40,od),d(`label`,{for:`${e.id}-${o(t)}`},U(a(t)),9,sd)]))),128))])]))}}),ld=Y(cd,[[`__scopeId`,`data-v-68b4cdd0`]]);const ud=[`dir`],dd={key:0,class:`label`},fd={class:`range-slider relative w-100`},pd=[`id`,`value`,`min`,`max`,`step`,`required`,`disabled`,`aria-label`],md=[`value`,`min`,`max`,`step`,`required`,`disabled`],hd={class:`track absolute pointer-events-none overflow-hidden round`},gd={class:`txt-center txt-14 user-select-none range-slider-txt flex space-between opacity-4 mx-05`};var _d=h({__name:`RangeInput`,props:{modelValue:{},min:{},max:{},step:{},required:{type:Boolean},label:{},disabled:{type:Boolean},id:{},rtl:{type:Boolean},multiRange:{type:Boolean},formatValue:{type:Function}},emits:[`update:modelValue`],setup(e,{emit:t}){let n=e,r=t,{min:i=0,max:a=100,step:s=1,multiRange:c=!1,formatValue:f=e=>e.toString()}=n,m=R(Array.isArray(n.modelValue)?n.modelValue[0]:n.modelValue??i),h=R(Array.isArray(n.modelValue)?n.modelValue[1]:a),g=o(()=>Math.min(Math.max(m.value,i),c?h.value:a)),_=o(()=>Math.max(Math.min(h.value,a),m.value)),v=o(()=>(g.value-i)/(a-i)*100),y=o(()=>(_.value-i)/(a-i)*100);q(()=>n.modelValue,e=>{Array.isArray(e)&&c?(m.value=e[0]??i,h.value=e[1]??a):Array.isArray(e)||(m.value=e??i,h.value=a)},{immediate:!0});function b(e,t){t?m.value=e:h.value=e,r(`update:modelValue`,c?[g.value,_.value]:g.value)}let x=o(()=>c?{left:`${v.value}%`,width:`${y.value-v.value}%`}:n.rtl?{left:`${100-v.value}%`,width:`${v.value}%`}:{left:`0`,width:`${v.value}%`}),S=o(()=>f(g.value)),C=o(()=>f(_.value));return(e,t)=>(P(),u(`div`,{dir:e.rtl?`rtl`:`ltr`},[n.label?(P(),u(`label`,dd,U(n.label),1)):l(``,!0),d(`div`,fd,[d(`input`,{id:e.id,value:g.value,class:`from`,type:`range`,min:G(i),max:G(a),step:G(s),required:e.required,disabled:e.disabled,"aria-label":G(c)?`Minimum value`:`Value`,onInput:t[0]||=e=>b(+e.target.value,!0)},null,40,pd),G(c)?(P(),u(`input`,{key:0,value:_.value,class:`to`,type:`range`,min:G(i),max:G(a),step:G(s),required:e.required,disabled:e.disabled,"aria-label":`Maximum value`,onInput:t[1]||=e=>b(+e.target.value,!1)},null,40,md)):l(``,!0),d(`div`,hd,[d(`div`,{class:`active-range absolute h-100 pointer-events-none bg-primary`,style:k(x.value)},null,4)]),g.value===G(i)?l(``,!0):(P(),u(`p`,{key:1,class:`txt-center txt-12 range-slider-position-txt absolute line-height-1`,style:k({"--progress":`${v.value}`})},[G(c)?l(``,!0):B(e.$slots,`progress`,{key:0,progress:S.value,min:G(f)(G(i)),max:G(f)(G(a))},()=>[p(U(S.value),1)],!0),G(c)?B(e.$slots,`from`,{key:1,from:S.value,to:C.value,min:G(f)(G(i)),max:G(f)(G(a))},()=>[p(U(S.value),1)],!0):l(``,!0)],4)),G(c)&&_.value!==G(a)?(P(),u(`p`,{key:2,class:`txt-center txt-12 range-slider-position-txt line-height-1 absolute`,style:k({"--progress":`${y.value}`})},[B(e.$slots,`to`,{to:C.value,from:S.value,min:G(f)(G(i)),max:G(f)(G(a))},()=>[p(U(C.value),1)],!0)],4)):l(``,!0)]),d(`p`,gd,[B(e.$slots,`min`,{max:G(f)(G(a)),min:G(f)(G(i)),from:S.value,to:C.value,progress:S.value},()=>[d(`span`,null,U(G(f)(G(i))),1)],!0),B(e.$slots,`max`,{max:G(f)(G(a)),min:G(f)(G(i)),from:S.value,to:C.value,progress:S.value},()=>[d(`span`,null,U(G(f)(G(a))),1)],!0)])],8,ud))}}),vd=Y(_d,[[`__scopeId`,`data-v-46e22f3e`]]);const yd={key:0},bd={class:`flex gap-05`},xd=[`disabled`],Sd={key:1},Cd={key:2,class:`ms-auto ps-05 me-05`},wd=[`value`],Td=[`aria-selected`,`onClick`,`onKeydown`],Ed={class:`block`},Dd={key:0,class:`selectinput-option opacity-3 pointer-events-none`};var Od=h({__name:`SelectInput`,props:{options:{},placeholder:{default:`Select`},disabled:{type:Boolean},modelValue:{type:[String,Number,Boolean,Object]},searchable:{type:Boolean},required:{type:Boolean},label:{},fullWidth:{type:Boolean},multiselect:{type:Boolean},icon:{},hideLabel:{type:Boolean},defaultValue:{type:[String,Number,Boolean,Object]},clearable:{type:Boolean},placement:{default:`bottom-start`},searchPlaceholder:{}},emits:[`update:modelValue`],setup(e,{emit:t}){let r=e,i=t,a=e=>typeof e==`function`,s=R(),f=R(),h=R([]),g=o(()=>h.value.length??0),_=R(``),v=R(),y=R(!1),b=R(!1),S=o(()=>{if(g.value===0)return r.placeholder;if(g.value>4){let e=h.value.slice(0,4).map(e=>F(e)).join(`, `);return`${e}... +${g.value-4}`}return h.value.map(e=>F(e)).join(`, `)}),C=o(()=>r.searchPlaceholder??S.value??`Search`),{results:w,isLoading:E}=Ek({searchTerm:()=>_.value,serverSearch:a(r.options)?r.options:void 0,items:()=>Array.isArray(r.options)?r.options:[],minChars:a(r.options)?0:2}),O=R(-1),A=R();function ee(e){if(!b.value){b.value=!0,setTimeout(()=>{ee(e)},210);return}e===`up`?O.value=O.value>0?O.value-1:w.value.length-1:e===`down`&&(O.value=O.value<w.value.length-1?O.value+1:0),setTimeout(()=>{var e;let t=(e=A.value)?.children[O.value];t?t.focus():O.value=-1},10)}let M=e=>h.value.find(t=>I(e)===I(t))!==void 0;function N(){if(!A.value||g.value===0)return;let e=w.value.findIndex(e=>M(e));if(e===-1)return;let t=A.value.children[e];t&&t.scrollIntoView({block:`center`,behavior:`instant`})}function F(e){return e==null?``:typeof e==`object`?e.label??String(e.value??``):typeof e==`boolean`?e?`Yes`:`No`:String(e)}function I(e){if(e!=null)return typeof e==`object`?e.value:e}function L(){b.value=!0,setTimeout(()=>{s.value&&s.value.focus()},10)}function te(e){var t;y.value=!0;let n=h.value.findIndex(t=>I(t)===I(e));if(n>-1)h.value.splice(n,1);else if(r.multiselect){let t=[...h.value];t.push(e),h.value=t}else h.value.splice(0,g.value,e);let i=document.activeElement;i&&(t=A.value)?.contains(i)&&i.blur(),r.multiselect||(b.value=!1,setTimeout(()=>{var e;(e=f.value)?.focus()},0)),ne()}function ne(){if(r.multiselect)i(`update:modelValue`,h.value.map(I).filter(Boolean));else{let[e]=h.value;i(`update:modelValue`,I(e))}}function re(e,t){if(e.length!==t.length)return!1;let n=e.map(I).filter(Boolean).map(String).sort(),r=t.map(I).filter(Boolean).map(String).sort();return n.every((e,t)=>e===r[t])}return q(()=>r.modelValue,e=>{if(r.multiselect){let t=[e].flat(),n=re(t,h.value);n||h.value.splice(0,g.value,...t)}else{let t=Array.isArray(r.options)?r.options.find(t=>I(t)===e)??e:e;t&&!M(t)&&(h.value=[t])}},{immediate:!0}),q(()=>b.value,e=>{e&&(O.value=-1,setTimeout(()=>{N()},10))}),q(()=>r.options,()=>{let e=r.options;Array.isArray(e)&&h.value.forEach((t,n)=>{let r=e.find(e=>I(e)===I(t));r===void 0?h.value.splice(n,1):h.value.splice(n,1,r)})},{deep:!0,immediate:!0}),j(()=>{let e=r.options;if(r.defaultValue!==void 0&&Array.isArray(e)){let t=e.find(e=>I(e)===I(r.defaultValue));if(t===void 0)return;h.value=[t]}}),(e,t)=>(P(),c(G(nc),{ref_key:`dropdown`,ref:v,shown:G(b),"onUpdate:shown":t[10]||=e=>x(b)?b.value=e:b=e,placement:e.placement,class:`bagel-input selectinput`,"no-auto-focus":``,onClick:t[11]||=he(()=>{},[`stop`])},{trigger:J(()=>[d(`label`,null,[p(U(e.label)+` `,1),e.required&&e.label?(P(),u(`span`,yd,`*`)):l(``,!0),d(`div`,bd,[e.searchable&&G(b)?(P(),c(G(Ld),{key:0,ref_key:`searchInput`,ref:s,modelValue:_.value,"onUpdate:modelValue":t[0]||=e=>_.value=e,class:`mb-0`,placeholder:C.value,icon:`search`,onInput:t[1]||=e=>x(y)?y.value=!1:y=!1,onClick:L,onKeydown:[t[2]||=me(he(e=>ee(`down`),[`prevent`]),[`down`]),t[3]||=me(he(e=>ee(`up`),[`prevent`]),[`up`])]},null,8,[`modelValue`,`placeholder`])):(P(),u(`button`,{key:1,ref_key:`triggerBtn`,ref:f,disabled:e.disabled,type:`button`,class:D([`selectinput-btn`,{isEmpty:g.value===0}]),onKeydown:[t[5]||=me(he(e=>ee(`down`),[`prevent`]),[`down`]),t[6]||=me(he(e=>ee(`up`),[`prevent`]),[`up`])]},[e.icon?(P(),c(G($),{key:0,icon:e.icon},null,8,[`icon`])):l(``,!0),e.hideLabel?l(``,!0):(P(),u(`p`,Sd,U(S.value),1)),e.clearable&&g.value>0?(P(),u(`div`,Cd,[m(G(X),{flat:``,thin:``,icon:`clear`,class:`color-gray`,onClick:t[4]||=e=>{x(h)?h.value=[]:h=[],ne()}})])):l(``,!0),e.disabled?l(``,!0):(P(),c(G($),T({key:3,thin:``},{icon:G(b)?`unfold_less`:`unfold_more`}),null,16))],42,xd)),e.required?(P(),u(`input`,{key:2,tabindex:`-1`,style:{width:`0`,height:`0`,position:`absolute`,opacity:`0`,"z-index":`-1`},value:G(h),required:``},null,8,wd)):l(``,!0)])])]),default:J(()=>[G(E)?(P(),c(G(Mw),{key:0,count:6,width:`200px`,height:`25px`,class:`mx-1 my-1`})):l(``,!0),m(G(ci),{class:`p-05`,frame:``,style:k({width:e.fullWidth?`100%`:`auto`}),onClick:t[9]||=he(()=>{},[`stop`])},{default:J(()=>[d(`div`,{ref_key:`selectOptions`,ref:A,class:D([`selectinput-options`,{multiselect:e.multiselect}])},[(P(!0),u(n,null,z(G(w),(r,i)=>(P(),u(`div`,{key:`${String(I(r))}-${i}`,class:D([`selectinput-option hover gap-1 align-items-center`,{selected:M(r)}]),role:`option`,tabindex:`0`,"aria-selected":M(r),onClick:e=>te(r),onKeydown:[me(e=>te(r),[`enter`]),t[7]||=me(he(e=>ee(`down`),[`prevent`]),[`down`]),t[8]||=me(he(e=>ee(`up`),[`prevent`]),[`up`])]},[e.multiselect?(P(),u(n,{key:0},[M(r)?(P(),c(G($),{key:0,size:1.1,icon:`select_check_box`})):l(``,!0),M(r)?l(``,!0):(P(),c(G($),{key:1,class:`opacity-3`,icon:`check_box_outline_blank`,size:1.1}))],64)):l(``,!0),d(`span`,Ed,U(F(r)),1)],42,Td))),128)),G(w).length===0?(P(),u(`p`,Dd,`No options found`)):l(``,!0)],2),B(e.$slots,`last`,{},void 0,!0)]),_:3},8,[`style`])]),_:3},8,[`shown`,`placement`]))}}),kd=Y(Od,[[`__scopeId`,`data-v-23d5f165`]]);const Ad=[`title`],jd=[`for`],Md={key:0},Nd=[`id`,`name`,`title`,`autocomplete`,`type`,`placeholder`,`disabled`,`required`,`pattern`],Pd=[`id`,`name`,`title`,`type`,`rows`,`placeholder`,`disabled`,`required`,`pattern`],Fd={key:3,class:`opacity-7 light`};var Id=h({__name:`TextInput`,props:{id:{},title:{},helptext:{},name:{},placeholder:{},modelValue:{default:``},label:{},small:{type:Boolean},dense:{type:Boolean},required:{type:Boolean},pattern:{},defaultValue:{},shrink:{type:Boolean},disabled:{type:Boolean},type:{default:`text`},nativeInputAttrs:{},icon:{},iconStart:{},multiline:{type:Boolean},autoheight:{type:Boolean},code:{type:Boolean},rows:{},autocomplete:{},autofocus:{type:Boolean},onFocusout:{},onFocus:{},validate:{},getFormData:{}},emits:[`update:modelValue`,`debounce`],setup(e,{expose:t,emit:n}){let r=e,i=n,a=R(),s=R();PD(()=>a.value,()=>s.value,r.validate,r.getFormData);let f=o(()=>{let e=Number(r.rows)||1;return r.autoheight&&(e=Math.max(e,String(a.value).split(`
17
- `).length)),(r.multiline||r.code)&&(e=Math.max(e,4)),e}),m=bn(()=>{i(`debounce`,a.value)},700);function h(){if(!r.autoheight||!s.value||s.value.tagName!==`TEXTAREA`)return;let e=s.value;e.style.height=`auto`,e.style.height=e.scrollHeight+1+`px`}function g(){r.disabled||(i(`update:modelValue`,a.value),m(),r.autoheight&&E(()=>h()))}q(()=>r.modelValue,e=>{e!==a.value&&(a.value=e,r.autoheight&&E(()=>h()))},{immediate:!0});let _=()=>document.activeElement===s.value,v=()=>{var e;return(e=s.value)?.focus()};return t({focus:v,hasFocus:_}),j(async()=>{if(r.autofocus){var e;await wn(()=>s.value).toBeTruthy(),await Xc(400),(e=s.value)?.focus()}r.defaultValue&&!r.modelValue&&(a.value=r.defaultValue),r.autoheight&&(await E(),h())}),(e,t)=>(P(),u(`div`,{class:D([`bagel-input text-input`,{dense:e.dense,small:e.small,shrink:e.shrink,code:e.code,textInputIconWrap:e.icon,txtInputIconStart:e.iconStart}]),title:e.title},[d(`label`,{for:e.id},[p(U(e.label)+` `,1),e.required&&e.label?(P(),u(`span`,Md,`*`)):l(``,!0),!e.multiline&&!e.autoheight&&!e.code&&f.value<2?pe((P(),u(`input`,T({key:1,id:e.id,ref_key:`input`,ref:s,"onUpdate:modelValue":t[0]||=e=>x(a)?a.value=e:a=e,name:e.name,title:e.title,autocomplete:e.autocomplete,type:e.type,rows:1,placeholder:e.placeholder||e.label,disabled:e.disabled,required:e.required,pattern:e.pattern},e.nativeInputAttrs,{onFocusout:t[1]||=(...t)=>e.onFocusout&&e.onFocusout(...t),onFocus:t[2]||=(...t)=>e.onFocus&&e.onFocus(...t),onInput:g}),null,16,Nd)),[[le,G(a),void 0,{trim:!0}]]):pe((P(),u(`textarea`,T({key:2,id:e.id,ref_key:`input`,ref:s,"onUpdate:modelValue":t[3]||=e=>x(a)?a.value=e:a=e,name:e.name,title:e.title,type:e.type,rows:f.value,placeholder:e.placeholder||e.label,disabled:e.disabled,required:e.required,pattern:e.pattern},e.nativeInputAttrs,{onInput:g,onFocusout:t[4]||=(...t)=>e.onFocusout&&e.onFocusout(...t)}),null,16,Pd)),[[de,G(a)]]),e.helptext?(P(),u(`p`,Fd,U(e.helptext),1)):l(``,!0),e.iconStart?(P(),c(G($),{key:4,class:`iconStart`,icon:e.iconStart},null,8,[`icon`])):l(``,!0),e.icon?(P(),c(G($),{key:5,icon:e.icon},null,8,[`icon`])):l(``,!0)],8,jd)],10,Ad))}}),Ld=Y(Id,[[`__scopeId`,`data-v-e8567134`]]);const Rd=[`mergeCells`,`splitCells`,`addRowBefore`,`addRowAfter`,`deleteRow`,`insertColumnLeft`,`insertColumnRight`,`deleteColumn`,`tableAlignLeft`,`tableAlignCenter`,`tableAlignRight`,`tableAlignJustify`,`deleteTable`],zd=`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`.split(`.`),Bd=[`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`,...Rd,`separator`,`undo`,`redo`,`fullScreen`],Vd=[{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`}],Hd={class:`table-grid-selector p-075`},Ud={class:`txt-center mb-075`},Wd={style:{"font-size":`14px`,"font-weight":`500`,color:`#333`,"margin-bottom":`4px`}},Gd=[`onMouseenter`,`onClick`],Kd={class:`border-top pt-075`},qd=10,Jd=10;var Yd=h({__name:`TableGridSelector`,emits:[`insert`,`openAdvanced`],setup(e,{emit:t}){let r=t,i=R(0),a=R(0),s=o(()=>{let e=[];for(let t=1;t<=qd;t++)for(let n=1;n<=Jd;n++)e.push({row:t,col:n,isActive:t<=i.value&&n<=a.value});return e}),l=o(()=>i.value===0||a.value===0?`Select table size`:`${i.value} × ${a.value}`),f=(e,t)=>{i.value=e,a.value=t},p=(e,t,n)=>{r(`insert`,e,t),n()},h=e=>{r(`openAdvanced`),e()},g=()=>{i.value=0,a.value=0};return(e,t)=>(P(),c(G(nc),{placement:`bottom-start`,thin:``,flat:``,icon:`table`},{default:J(({hide:e})=>[d(`div`,Hd,[d(`div`,Ud,[d(`div`,Wd,U(l.value),1),t[0]||=d(`div`,{style:{"font-size":`12px`,color:`#666`}},` Hover to select size `,-1)]),d(`div`,{style:{display:`grid`,"grid-template-columns":`repeat(10, 20px)`,"grid-template-rows":`repeat(10, 20px)`,gap:`2px`,"margin-bottom":`12px`,direction:`ltr`},onMouseleave:g},[(P(!0),u(n,null,z(s.value,t=>(P(),u(`div`,{key:`${t.row}-${t.col}`,onMouseenter:e=>f(t.row,t.col),onClick:n=>p(t.row,t.col,e),style:k({width:`20px`,height:`20px`,border:`1px solid #ddd`,backgroundColor:t.isActive?`var(--bgl-primary)`:`#fff`,cursor:`pointer`,borderRadius:`2px`,transition:`background-color 0.1s ease`})},null,44,Gd))),128))],32),d(`div`,Kd,[m(G(X),{onClick:t=>h(e),value:`Advanced Settings`,icon:`settings`,class:`bg-gray-30 color-black`},null,8,[`onClick`])])])]),_:1}))}}),Xd=Yd;const Zd={class:`toolbar flex gap-025 pb-05 flex-wrap`,role:`toolbar`,style:{position:`relative`}},Qd={class:`flex flex-column p-025`};var $d=h({__name:`EditorToolbar`,props:{config:{default:zd},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}){let r=t;function i(){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 o(t){if(e.hide.includes(t))return!0;let n={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`]};for(let[r,i]of Object.entries(n))if(e.hide.includes(r)&&i.includes(t))return!0;let r={insertImage:e.hideImages,insertVideo:e.hideVideos,insertEmbed:e.hideEmbeds,insertTable:e.hideTables,alignMenu:e.hideAlignment,textDirection:e.hideDirections,h5:e.hideH5H6,h6:e.hideH5H6};return r[t]||!1}function s(t){let n=e.config.map(f).filter(Boolean),r=-1;for(let e=t-1;e>=0;e--){let t=n[e];if(t&&t.name!==`separator`&&!o(t.name)){r=e;break}}let i=-1;for(let e=t+1;e<n.length;e++){let t=n[e];if(t&&t.name!==`separator`&&!o(t.name)){i=e;break}}if(r===-1||i===-1)return!1;for(let e=r+1;e<t;e++){let t=n[e];if(t&&t.name===`separator`)return!1}return!0}let f=e=>Vd.find(t=>t.name===e);function p(e,t){console.log(`EditorToolbar: runAction called`,{name:e,value:t}),r(`action`,e,t)}function h(e,t){let n=document.createElement(`table`);n.style.width=`100%`,n.style.borderCollapse=`collapse`,n.style.marginBottom=`1rem`;let i=document.createElement(`thead`),a=i.insertRow();for(let e=0;e<t;e++){let t=document.createElement(`th`);t.innerHTML=`Header ${e+1}`,t.style.padding=`8px`,t.style.border=`1px solid #ddd`,t.style.backgroundColor=`#f4f4f4`,a.appendChild(t)}n.appendChild(i);let o=document.createElement(`tbody`);for(let n=0;n<e;n++){let e=o.insertRow();for(let n=0;n<t;n++){let t=e.insertCell();t.innerHTML=`&nbsp;`,t.style.padding=`8px`,t.style.border=`1px solid #ddd`}}n.appendChild(o),r(`action`,`insertTable`,n.outerHTML)}function g(){r(`action`,`insertTable`)}return(e,t)=>{let r=re(`tooltip`);return P(),u(`div`,Zd,[(P(!0),u(n,null,z(e.config.map(f).filter(Boolean),(t,f)=>(P(),u(n,{key:f},[t.name===`insertTable`&&!o(`insertTable`)?(P(),c(Xd,{key:0,onInsert:h,onOpenAdvanced:g})):t.name===`insertImage`&&!o(`insertImage`)?pe((P(),c(G(X),{key:1,icon:t.icon,thin:``,flat:``,"aria-label":t.name,class:D([[t.class,{active:e.selectedStyles.has(t.name)}],``]),tabindex:`-1`,onClick:e=>p(t.name)},null,8,[`icon`,`aria-label`,`class`,`onClick`])),[[r,t.label]]):t.name===`insertVideo`&&!o(`insertVideo`)?pe((P(),c(G(X),{key:2,icon:t.icon,thin:``,flat:``,"aria-label":t.name,class:D([[t.class,{active:e.selectedStyles.has(t.name)}],``]),tabindex:`-1`,onClick:e=>p(t.name)},null,8,[`icon`,`aria-label`,`class`,`onClick`])),[[r,t.label]]):t.name===`insertEmbed`&&!o(`insertEmbed`)?pe((P(),c(G(X),{key:3,icon:t.icon,thin:``,flat:``,"aria-label":t.name,class:D([[t.class,{active:e.selectedStyles.has(t.name)}],``]),tabindex:`-1`,onClick:e=>p(t.name)},null,8,[`icon`,`aria-label`,`class`,`onClick`])),[[r,t.label]]):t.name===`alignMenu`&&!o(`alignMenu`)?(P(),c(G(nc),{key:4,placement:`bottom-start`,thin:``,flat:``,icon:i(),class:D({"alignment-active":a()})},{default:J(({hide:t})=>[d(`div`,Qd,[m(G(X),{thin:``,flat:``,icon:`format_align_left`,class:D({active:e.selectedStyles.has(`alignLeft`)}),onClick:e=>{p(`alignLeft`),t()}},null,8,[`class`,`onClick`]),m(G(X),{thin:``,flat:``,icon:`format_align_center`,class:D({active:e.selectedStyles.has(`alignCenter`)}),onClick:e=>{p(`alignCenter`),t()}},null,8,[`class`,`onClick`]),m(G(X),{thin:``,flat:``,icon:`format_align_right`,class:D({active:e.selectedStyles.has(`alignRight`)}),onClick:e=>{p(`alignRight`),t()}},null,8,[`class`,`onClick`]),m(G(X),{thin:``,flat:``,icon:`format_align_justify`,class:D({active:e.selectedStyles.has(`alignJustify`)}),onClick:e=>{p(`alignJustify`),t()}},null,8,[`class`,`onClick`])])]),_:1},8,[`icon`,`class`])):t.name===`textDirection`&&!o(`textDirection`)?pe((P(),c(G(X),{key:5,icon:e.selectedStyles.has(`textDirection`)?`format_textdirection_l_to_r`:`format_textdirection_r_to_l`,thin:``,flat:``,"aria-label":t.name,class:D([[t.class,{active:e.selectedStyles.has(`textDirection`)}],``]),tabindex:`-1`,onClick:e=>p(t.name)},null,8,[`icon`,`aria-label`,`class`,`onClick`])),[[r,t.label]]):(t.name===`h5`||t.name===`h6`)&&!o(t.name)?pe((P(),c(G(X),{key:6,icon:t.icon,thin:``,flat:``,"aria-label":t.name,class:D([[t.class,{active:e.selectedStyles.has(t.name)}],``]),tabindex:`-1`,onClick:e=>p(t.name)},null,8,[`icon`,`aria-label`,`class`,`onClick`])),[[r,t.label]]):t.name!==`separator`&&t.name!==`insertTable`&&t.name!==`insertImage`&&t.name!==`insertVideo`&&t.name!==`insertEmbed`&&t.name!==`alignMenu`&&t.name!==`textDirection`&&t.name!==`h5`&&t.name!==`h6`&&!o(t.name)?pe((P(),c(G(X),{key:7,icon:t.icon,thin:``,flat:``,"aria-label":t.name,class:D([[t.class,{active:e.selectedStyles.has(t.name)}],``]),tabindex:`-1`,onClick:e=>p(t.name)},null,8,[`icon`,`aria-label`,`class`,`onClick`])),[[r,t.label]]):t.name===`separator`&&s(f)?(P(),u(`span`,{key:`separator-${f}`,class:`opacity-2 mb-025`},`|`)):l(``,!0)],64))),128))])}}}),ef=Y($d,[[`__scopeId`,`data-v-d36f1ef5`]]);function tf(e,t){let{doc:n}=t;if(!n){console.log(`No doc found`);return}let r=n.getSelection();if(!r||!r.rangeCount){console.log(`No selection found`);return}let i=r.getRangeAt(0);if(i.collapsed){let e=nf(n,i);if(!e){console.log(`Failed to select word at cursor`);let e=t.showTooltipMessage;e?e(`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}i=r.getRangeAt(0)}let a=i.commonAncestorContainer,o=a.nodeType===Node.TEXT_NODE?a.parentElement:a,s=o?.closest(`a`);if(t.openLinkModal){t.openLinkModal(r,i,s);return}console.warn(`Link modal not available - openLinkModal function not found`),alert(`Link functionality requires proper modal setup`)}function nf(e,t){if(!t.collapsed)return!0;let n=t.startContainer,r=t.startOffset;if(n.nodeType!==Node.TEXT_NODE){let e=n;if(e.childNodes.length>0&&r<e.childNodes.length){let t=e.childNodes[r];if(t.nodeType===Node.TEXT_NODE)n=t,r=0;else return!1}else return!1}let i=n.textContent||``;if(!i)return!1;let a=r,o=r,s=/[\u0590-\u05FF\u0600-\u06FF\w]/;for(;a>0&&s.test(i[a-1]);)a--;for(;o<i.length&&s.test(i[o]);)o++;if(a<o){t.setStart(n,a),t.setEnd(n,o);let r=e.getSelection();return r&&(r.removeAllRanges(),r.addRange(t)),!0}return!1}function rf(e,t,n){if(!n.doc)return;let r=n.doc.createElement(`table`);r.style.width=`100%`,r.style.borderCollapse=`collapse`,r.style.marginBottom=`1rem`;let i=n.doc.createElement(`thead`),a=i.insertRow();for(let e=0;e<t;e++){let t=n.doc.createElement(`th`);t.innerHTML=`Header ${e+1}`,t.style.padding=`8px`,t.style.border=`1px solid var(--border-color, #ddd)`,t.style.backgroundColor=`var(--bgl-gray-light, #f4f4f4)`,a.appendChild(t)}r.appendChild(i);let o=n.doc.createElement(`tbody`);for(let n=0;n<e;n++){let e=o.insertRow();for(let n=0;n<t;n++){let t=e.insertCell();t.innerHTML=`&nbsp;`,t.style.padding=`8px`,t.style.border=`1px solid var(--border-color, #ddd)`}}r.appendChild(o);let{range:s}=n;if(s){if(s.insertNode(r),n.doc.getSelection()){let e=r.querySelector(`td`);if(e){s.selectNodeContents(e),s.collapse(!0);let t=n.doc.getSelection();t&&(t.removeAllRanges(),t.addRange(s))}}}else n.doc.body.appendChild(r);n.content=n.doc.body.innerHTML}function af(e,t){var n;let r=Array.from(e.cloneContents().querySelectorAll(`td`));if(r.length<2)return;let i=(n=e.startContainer.parentElement)?.closest(`td`);if(!i)return;i.colSpan=r.length,i.innerHTML=r.map(e=>e.innerHTML).join(` `),r.slice(1).forEach(e=>{let n=t.getElementById(e.id);n?.remove()});let a=t.editorState;a&&(a.content=t.body.innerHTML)}function sf(e,t){var n;let r=(n=e.startContainer.parentElement)?.closest(`td`);if(!r||!r.colSpan||r.colSpan===1)return;let i=Array(r.colSpan-1).fill(0).map(()=>{let e=t.createElement(`td`);return e.style.border=`1px solid var(--border-color)`,e.style.padding=`8px`,e.innerHTML=`&nbsp;`,e});r.colSpan=1,r.insertAdjacentElement(`afterend`,i[0]),i.slice(1).forEach(e=>{i[0].insertAdjacentElement(`afterend`,e)});let a=t.editorState;a&&(a.content=t.body.innerHTML)}function cf(e,t,n){var r;let i=(r=t.startContainer.parentElement)?.closest(`td`);if(!i)return;let a=i.parentElement,o=a?.parentElement;if(!a||!o)return;let s=a.cloneNode(!0);Array.from(s.cells).forEach(e=>e.innerHTML=`&nbsp;`),a.insertAdjacentElement(e===`before`?`beforebegin`:`afterend`,s);let c=n.editorState;c&&(c.content=n.body.innerHTML)}function lf(e){var t;let n=(t=e.startContainer.parentElement)?.closest(`td`);if(!n)return;let r=n.parentElement;if(!r)return;let i=r.ownerDocument;r.remove();let a=i.editorState;a&&(a.content=i.body.innerHTML)}function uf(e){var t;let n=(t=e.startContainer.parentElement)?.closest(`td`);if(!n)return;let r=n.closest(`table`);if(!r)return;let i=r.ownerDocument;r.remove();let a=i.editorState;a&&(a.content=i.body.innerHTML)}function df(e,t){var n;let r=(n=t.startContainer.parentElement)?.closest(`td`);if(!r)return;let i=r.closest(`table`);if(!i)return;let a=r.cellIndex,{rows:o}=i;for(let t=0;t<o.length;t++){let n=o[t].insertCell(e===`after`?a+1:a);n.innerHTML=`&nbsp;`,n.style.border=`1px solid var(--border-color)`,n.style.padding=`8px`}let s=i.ownerDocument.editorState;s&&(s.content=i.ownerDocument.body.innerHTML)}function ff(e){var t;let n=(t=e.startContainer.parentElement)?.closest(`td`);if(!n)return;let r=n.closest(`table`);if(!r)return;let i=n.cellIndex,{rows:a}=r,o=r.ownerDocument;for(let e=0;e<a.length;e++)a[e].deleteCell(i);a[0].cells.length===0&&r.remove();let s=o.editorState;s&&(s.content=o.body.innerHTML)}function pf(e,t){var n;let r=(n=e.startContainer.parentElement)?.closest(`td`);if(!r)return;let i=r.closest(`table`);if(!i)return;let a=r.cellIndex,{rows:o}=i;for(let e=0;e<o.length;e++){let n=o[e].cells[a];n&&(n.style.textAlign=t)}let s=i.ownerDocument.editorState;s&&(s.content=i.ownerDocument.body.innerHTML)}function mf(e){if(!e.doc)return null;let t=e.doc.getSelection();if(!t||!t.rangeCount)return null;let n=t.getRangeAt(0);return{selection:t,range:n}}function hf(e,t,n){if(!t.collapsed)return!1;let r=t.startContainer,i=t.startOffset;if(r.nodeType!==Node.TEXT_NODE){let e=r;if(e.childNodes.length>0&&i<e.childNodes.length){let t=e.childNodes[i];if(t.nodeType===Node.TEXT_NODE)r=t,i=0;else return!1}else return!1}let a=r.parentElement,o=a?.closest(n.toLowerCase());if(o)try{let t=o.parentNode;if(t){for(;o.firstChild;)t.insertBefore(o.firstChild,o);t.removeChild(o);let n=e.createRange();n.setStart(r,i),n.collapse(!0);let a=e.getSelection();return a&&(a.removeAllRanges(),a.addRange(n)),!0}}catch(e){return console.error(`Error removing formatting from word:`,e),!1}let s=r.textContent||``;if(!s)return!1;let c=i,l=i,u=/[\u0590-\u05FF\u0600-\u06FF\w]/;for(i>0&&u.test(s[i-1])&&(i>=s.length||!u.test(s[i]))&&(c=i-1,l=i-1);c>0&&u.test(s[c-1]);)c--;for(;l<s.length&&u.test(s[l]);)l++;if(c<l&&l>c)try{let t=s.substring(0,c),i=s.substring(c,l),a=s.substring(l),o=e.createElement(n);o.textContent=i;let u=r.parentNode;if(u){if(t){let n=e.createTextNode(t);u.insertBefore(n,r)}if(u.insertBefore(o,r),a){let t=e.createTextNode(a);u.insertBefore(t,r)}u.removeChild(r);let n=e.createRange();n.setStartAfter(o),n.collapse(!0);let i=e.getSelection();return i&&(i.removeAllRanges(),i.addRange(n)),!0}}catch(e){console.error(`Error applying formatting to word:`,e)}return!1}function gf(e){if(!e.doc)return;e.content=e.doc.body.innerHTML;let t=e.doc.getSelection();t&&t.rangeCount>0&&(e.selection=t,e.range=t.getRangeAt(0).cloneRange(),e.rangeCount=t.rangeCount)}function _f(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 vf(e,t,n){return{name:e,execute:(e,n)=>{e.doc&&(t(e,n),gf(e))},isActive:n}}function yf(e){let t={undo:vf(`Undo`,()=>{if(e.undoStack.length>0&&e.doc){let t=e.undoStack.pop();t!==void 0&&(e.redoStack.push(e.content),e.content=t,e.doc.body.innerHTML=t)}}),redo:vf(`Redo`,()=>{if(e.redoStack.length>0&&e.doc){let t=e.redoStack.pop();t!==void 0&&(e.undoStack.push(e.content),e.content=t,e.doc.body.innerHTML=t)}})},n={bold:vf(`Bold`,e=>{let t=mf(e);if(!t)return;let{range:n,selection:r}=t;if(n.collapsed){let t=hf(e.doc,n,`b`);return}let i=n.commonAncestorContainer,a=i.nodeType===Node.TEXT_NODE?i.parentElement:i,o=a?.closest(`b, strong`);if(o)try{let e=o.parentNode;for(;o.firstChild;)e?.insertBefore(o.firstChild,o);e?.removeChild(o),r.removeAllRanges(),r.addRange(n)}catch(e){console.error(`Error removing bold:`,e)}else try{let t=e.doc.createElement(`b`);try{n.surroundContents(t)}catch{let e=n.extractContents();t.appendChild(e),n.insertNode(t)}n.selectNodeContents(t),r.removeAllRanges(),r.addRange(n)}catch(e){console.error(`Error applying bold:`,e)}},e=>{let t=mf(e);if(!t)return!1;let n=t.range.commonAncestorContainer,r=n.nodeType===Node.TEXT_NODE?n.parentElement:n;return!!r?.closest(`b, strong`)}),italic:vf(`Italic`,e=>{let t=mf(e);if(!t)return;let{range:n,selection:r}=t;if(n.collapsed){let t=hf(e.doc,n,`i`);return}let i=n.commonAncestorContainer,a=i.nodeType===Node.TEXT_NODE?i.parentElement:i,o=a?.closest(`i, em`);if(o)try{let e=o.parentNode;for(;o.firstChild;)e?.insertBefore(o.firstChild,o);e?.removeChild(o),r.removeAllRanges(),r.addRange(n)}catch(e){console.error(`Error removing italic:`,e)}else try{let t=e.doc.createElement(`i`);try{n.surroundContents(t)}catch{let e=n.extractContents();t.appendChild(e),n.insertNode(t)}n.selectNodeContents(t),r.removeAllRanges(),r.addRange(n)}catch(e){console.error(`Error applying italic:`,e)}},e=>{let t=mf(e);if(!t)return!1;let n=t.range.commonAncestorContainer,r=n.nodeType===Node.TEXT_NODE?n.parentElement:n;return!!r?.closest(`i, em`)}),underline:vf(`Underline`,e=>{let t=mf(e);if(!t)return;let{range:n,selection:r}=t;if(n.collapsed){let t=hf(e.doc,n,`u`);return}let i=n.commonAncestorContainer,a=i.nodeType===Node.TEXT_NODE?i.parentElement:i,o=a?.closest(`u`);if(o)try{let e=o.parentNode;for(;o.firstChild;)e?.insertBefore(o.firstChild,o);e?.removeChild(o),r.removeAllRanges(),r.addRange(n)}catch(e){console.error(`Error removing underline:`,e)}else try{let t=e.doc.createElement(`u`);try{n.surroundContents(t)}catch{let e=n.extractContents();t.appendChild(e),n.insertNode(t)}n.selectNodeContents(t),r.removeAllRanges(),r.addRange(n)}catch(e){console.error(`Error applying underline:`,e)}},e=>{let t=mf(e);if(!t)return!1;let n=t.range.commonAncestorContainer,r=n.nodeType===Node.TEXT_NODE?n.parentElement:n;return!!r?.closest(`u`)}),link:vf(`Link`,e=>{let t=e.openLinkModal;t&&tf(t,e)},e=>{let t=mf(e);if(!t)return!1;let n=t.range.commonAncestorContainer,r=n.nodeType===Node.TEXT_NODE?n.parentElement:n;return!!r?.closest(`a`)})},r=[`h1`,`h2`,`h3`,`h4`,`h5`,`h6`].reduce((e,t)=>({...e,[t]:vf(`Heading ${t}`,e=>{let n=mf(e);if(!n)return;let{range:r,selection:i}=n,a=_f(r.commonAncestorContainer);if(!a)return;let o=r.startContainer,s=r.endContainer,c=r.startOffset,l=r.endOffset,u=r.collapsed,d=a.tagName.toLowerCase()===t.toLowerCase(),f=d?`p`:t;try{var p;let t=e.doc.createElement(f);for(;a.firstChild;)t.appendChild(a.firstChild);(p=a.parentNode)?.replaceChild(t,a);try{let n=e.doc.createRange(),r=(t,n,r)=>{if(t===n)return r;if(t.nodeType===Node.TEXT_NODE){let i=e.doc.createTreeWalker(r,NodeFilter.SHOW_TEXT,null),a=0,o=e.doc.createTreeWalker(n,NodeFilter.SHOW_TEXT,null),s=o.nextNode();for(;s&&s!==t;)a++,s=o.nextNode();let c=i.nextNode(),l=0;for(;c&&l<a;)l++,c=i.nextNode();return c}return r.firstChild},d=r(o,a,t),f=r(s,a,t);if(d&&f){if(d.nodeType===Node.TEXT_NODE){var m;let e=Math.min(c,(m=d.textContent)?.length||0);n.setStart(d,e)}else n.setStart(d,0);if(u)n.collapse(!0);else if(f.nodeType===Node.TEXT_NODE){var h;let e=Math.min(l,(h=f.textContent)?.length||0);n.setEnd(f,e)}else n.setEnd(f,0);i.removeAllRanges(),i.addRange(n)}else n.selectNodeContents(t),u&&n.collapse(!0),i.removeAllRanges(),i.addRange(n)}catch(n){console.warn(`Error restoring selection after heading change:`,n);let r=e.doc.createRange();r.selectNodeContents(t),r.collapse(!0),i.removeAllRanges(),i.addRange(r)}if(!d){let n=t.nextElementSibling;if(!n){var g;let n=e.doc.createElement(`p`);n.dir=t.dir||e.doc.body.dir,(g=t.parentNode)?.insertBefore(n,t.nextSibling)}}}catch(e){console.error(`Error applying ${t} heading:`,e)}})}),{}),i={p:vf(`Paragraph`,e=>{let t=mf(e);if(!t)return;let{range:n}=t,r=_f(n.commonAncestorContainer);if(r&&r.tagName.toLowerCase()!==`p`)try{var i;let a=e.doc.createElement(`p`);for(;r.firstChild;)a.appendChild(r.firstChild);(i=r.parentNode)?.replaceChild(a,r),n.selectNodeContents(a),n.collapse(!1),t.selection.removeAllRanges(),t.selection.addRange(n)}catch(e){console.error(`Error applying paragraph:`,e)}}),blockquote:vf(`Blockquote`,e=>{let t=mf(e);if(!t)return;let{range:n}=t,r=_f(n.commonAncestorContainer);if(!r)return;let i=r.tagName.toLowerCase()===`blockquote`,a=i?`p`:`blockquote`;try{var o;let i=e.doc.createElement(a);for(;r.firstChild;)i.appendChild(r.firstChild);(o=r.parentNode)?.replaceChild(i,r),n.selectNodeContents(i),n.collapse(!1),t.selection.removeAllRanges(),t.selection.addRange(n)}catch(e){console.error(`Error applying blockquote:`,e)}})},a={orderedList:vf(`Ordered List`,e=>{let t=mf(e);if(!t)return;let{range:n}=t,r=_f(n.commonAncestorContainer);if(!r)return;let i=r.closest(`li`);if(i){let r=i.parentElement;if(!r)return;if(r.tagName.toLowerCase()===`ol`){var a;let o=e.doc.createElement(`p`);for(;i.firstChild;)o.appendChild(i.firstChild);(a=r.parentNode)?.insertBefore(o,r),i.remove(),r.querySelector(`li`)||r.remove(),n.selectNodeContents(o),n.collapse(!1),t.selection.removeAllRanges(),t.selection.addRange(n);return}if(r.tagName.toLowerCase()===`ul`){var o;let i=e.doc.createElement(`ol`),a=n.startOffset,s=n.startContainer;for(;r.firstChild;)i.appendChild(r.firstChild);(o=r.parentNode)?.replaceChild(i,r);try{let n=e.doc.createRange();n.setStart(s,a),n.collapse(!0),t.selection.removeAllRanges(),t.selection.addRange(n)}catch{let n=i.querySelector(`li`);if(n){let r=e.doc.createRange();r.selectNodeContents(n),r.collapse(!0),t.selection.removeAllRanges(),t.selection.addRange(r)}}return}}try{var s;let i=e.doc.createElement(`ol`),a=e.doc.createElement(`li`);for(;r.firstChild;)a.appendChild(r.firstChild);i.appendChild(a),(s=r.parentNode)?.replaceChild(i,r),n.selectNodeContents(a),n.collapse(!1),t.selection.removeAllRanges(),t.selection.addRange(n)}catch(e){console.error(`Error creating ordered list:`,e)}}),unorderedList:vf(`Unordered List`,e=>{let t=mf(e);if(!t)return;let{range:n}=t,r=_f(n.commonAncestorContainer);if(!r)return;let i=r.closest(`li`);if(i){let r=i.parentElement;if(!r)return;if(r.tagName.toLowerCase()===`ul`){var a;let o=e.doc.createElement(`p`);for(;i.firstChild;)o.appendChild(i.firstChild);(a=r.parentNode)?.insertBefore(o,r),i.remove(),r.querySelector(`li`)||r.remove(),n.selectNodeContents(o),n.collapse(!1),t.selection.removeAllRanges(),t.selection.addRange(n);return}if(r.tagName.toLowerCase()===`ol`){var o;let i=e.doc.createElement(`ul`),a=n.startOffset,s=n.startContainer;for(;r.firstChild;)i.appendChild(r.firstChild);(o=r.parentNode)?.replaceChild(i,r);try{let n=e.doc.createRange();n.setStart(s,a),n.collapse(!0),t.selection.removeAllRanges(),t.selection.addRange(n)}catch(n){console.warn(`Could not restore cursor position:`,n);let r=i.querySelector(`li`);if(r){let n=e.doc.createRange();n.selectNodeContents(r),n.collapse(!0),t.selection.removeAllRanges(),t.selection.addRange(n)}}return}}try{var s;let i=e.doc.createElement(`ul`),a=e.doc.createElement(`li`);for(;r.firstChild;)a.appendChild(r.firstChild);i.appendChild(a),(s=r.parentNode)?.replaceChild(i,r),n.selectNodeContents(a),n.collapse(!1),t.selection.removeAllRanges(),t.selection.addRange(n)}catch(e){console.error(`Error creating unordered list:`,e)}})},o={clear:vf(`Clear Formatting`,e=>{let t=mf(e);if(!t)return;let{range:n,selection:r}=t;try{function t(e){return e.replace(/[\u200B-\u200D\uFEFF]/g,``).replace(/\s+/g,` `).replace(/[\u00A0]/g,` `).trim()}function i(n){if(n.nodeType===Node.TEXT_NODE){let r=t(n.textContent||``);return e.doc.createTextNode(r)}if(n.nodeType===Node.ELEMENT_NODE){let r=n,a=r.tagName.toLowerCase(),o=`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`.split(`.`),s=[`strong`,`em`,`span`,`font`,`strike`,`sub`,`sup`,`mark`,`del`,`ins`,`small`,`big`];if(s.includes(a)){let n=t(r.textContent||``);return e.doc.createTextNode(n)}else if(o.includes(a)){let t=e.doc.createElement(a);return a===`a`&&r.hasAttribute(`href`)?(t.setAttribute(`href`,r.getAttribute(`href`)||``),r.hasAttribute(`target`)&&t.setAttribute(`target`,r.getAttribute(`target`)||``),r.hasAttribute(`rel`)&&t.setAttribute(`rel`,r.getAttribute(`rel`)||``)):a===`img`?(r.hasAttribute(`src`)&&t.setAttribute(`src`,r.getAttribute(`src`)||``),r.hasAttribute(`alt`)&&t.setAttribute(`alt`,r.getAttribute(`alt`)||``),r.hasAttribute(`width`)&&t.setAttribute(`width`,r.getAttribute(`width`)||``),r.hasAttribute(`height`)&&t.setAttribute(`height`,r.getAttribute(`height`)||``)):a===`iframe`?(r.hasAttribute(`src`)&&t.setAttribute(`src`,r.getAttribute(`src`)||``),r.hasAttribute(`width`)&&t.setAttribute(`width`,r.getAttribute(`width`)||``),r.hasAttribute(`height`)&&t.setAttribute(`height`,r.getAttribute(`height`)||``),r.hasAttribute(`frameborder`)&&t.setAttribute(`frameborder`,r.getAttribute(`frameborder`)||``),r.hasAttribute(`allowfullscreen`)&&t.setAttribute(`allowfullscreen`,r.getAttribute(`allowfullscreen`)||``)):(a===`video`||a===`audio`)&&(r.hasAttribute(`src`)&&t.setAttribute(`src`,r.getAttribute(`src`)||``),r.hasAttribute(`controls`)&&t.setAttribute(`controls`,r.getAttribute(`controls`)||``),r.hasAttribute(`width`)&&t.setAttribute(`width`,r.getAttribute(`width`)||``),r.hasAttribute(`height`)&&t.setAttribute(`height`,r.getAttribute(`height`)||``)),Array.from(r.childNodes).forEach(e=>{var n;let r=i(e);((n=r.textContent)?.trim()||r.nodeType===Node.ELEMENT_NODE)&&t.appendChild(r)}),t}}return e.doc.createTextNode(``)}if(n.collapsed){let t=e.doc.body,n=e.doc.createDocumentFragment();if(Array.from(t.childNodes).forEach(e=>{var t;let r=i(e);((t=r.textContent)?.trim()||r.nodeType===Node.ELEMENT_NODE)&&n.appendChild(r)}),t.innerHTML=``,t.appendChild(n),!t.firstElementChild){let n=e.doc.createElement(`p`);t.appendChild(n);let i=e.doc.createRange();i.selectNodeContents(n),i.collapse(!0),r.removeAllRanges(),r.addRange(i)}}else{let t=n.cloneContents(),a=e.doc.createElement(`div`);a.appendChild(t);let o=e.doc.createDocumentFragment();Array.from(a.childNodes).forEach(e=>{var t;let n=i(e);((t=n.textContent)?.trim()||n.nodeType===Node.ELEMENT_NODE)&&o.appendChild(n)}),n.deleteContents(),n.insertNode(o),n.collapse(!1),r.removeAllRanges(),r.addRange(n)}}catch(e){console.error(`Error clearing formatting:`,e)}})},s={insertTable:vf(`Insert Table`,(e,t)=>{if(console.log(`insertTable command called with value:`,t),e.openTableEditor&&!t){console.log(`Opening table editor modal for new table`),e.openTableEditor(null);return}if(!t){let[t,n]=[3,3];rf(t,n,e);return}if(t.includes(`<table`)){console.log(`Inserting HTML table`);let n=mf(e);if(!n||!e.doc){console.error(`No selection info or document`);return}let{range:r}=n;try{let n=e.doc.createElement(`div`);n.innerHTML=t;let i=n.querySelector(`table`);if(i){console.log(`Table parsed successfully, inserting...`);let t=i.cloneNode(!0);r.insertNode(t),r.setStartAfter(t),r.collapse(!0);let n=e.doc.getSelection();n&&(n.removeAllRanges(),n.addRange(r)),console.log(`Table inserted successfully`)}else console.error(`Could not parse table from HTML`)}catch(e){console.error(`Error inserting HTML table:`,e)}}else{let[n,r]=t.split(`x`).map(Number)||[3,3];rf(n,r,e)}}),deleteTable:vf(`Delete Table`,e=>e.range&&uf(e.range)),mergeCells:vf(`Merge Cells`,e=>e.range&&e.doc&&af(e.range,e.doc)),splitCells:vf(`Split Cells`,e=>e.range&&e.doc&&sf(e.range,e.doc)),addRowBefore:vf(`Add Row Before`,e=>e.range&&e.doc&&cf(`before`,e.range,e.doc)),addRowAfter:vf(`Add Row After`,e=>e.range&&e.doc&&cf(`after`,e.range,e.doc)),deleteRow:vf(`Delete Row`,e=>e.range&&lf(e.range)),insertColumnLeft:vf(`Insert Column Left`,e=>e.range&&df(`before`,e.range)),insertColumnRight:vf(`Insert Column Right`,e=>e.range&&df(`after`,e.range)),deleteColumn:vf(`Delete Column`,e=>e.range&&ff(e.range))},c=[`Left`,`Center`,`Right`,`Justify`].reduce((e,t)=>({...e,[`tableAlign${t}`]:vf(`Table Align ${t}`,e=>{if(e.range){let n=t===`Left`?`start`:t===`Right`?`end`:t.toLowerCase();return pf(e.range,n)}})}),{}),l={alignLeft:vf(`Align Left`,e=>{var t;let n=mf(e);if(!n)return;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);i&&(i.style.textAlign=`left`)},e=>{var t;let n=mf(e);if(!n)return!1;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);return i?.style.textAlign===`left`}),alignCenter:vf(`Align Center`,e=>{var t;let n=mf(e);if(!n)return;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);i&&(i.style.textAlign=`center`)},e=>{var t;let n=mf(e);if(!n)return!1;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);return i?.style.textAlign===`center`}),alignRight:vf(`Align Right`,e=>{var t;let n=mf(e);if(!n)return;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);i&&(i.style.textAlign=`right`)},e=>{var t;let n=mf(e);if(!n)return!1;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);return i?.style.textAlign===`right`}),alignJustify:vf(`Align Justify`,e=>{var t;let n=mf(e);if(!n)return;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);i&&(i.style.textAlign=`justify`)},e=>{var t;let n=mf(e);if(!n)return!1;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);return i?.style.textAlign===`justify`}),textDirection:vf(`Toggle Text Direction`,e=>{var t;let n=mf(e);if(!n)return;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);if(i){let e=i.dir||`ltr`;i.dir=e===`ltr`?`rtl`:`ltr`}},e=>{var t;let n=mf(e);if(!n)return!1;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);return i?.dir===`rtl`}),ltrDirection:vf(`Set Left to Right Direction`,e=>{var t;let n=mf(e);if(!n)return;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);i&&(i.dir=`ltr`)},e=>{var t;let n=mf(e);if(!n)return!1;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);return i?.dir===`ltr`}),rtlDirection:vf(`Set Right to Left Direction`,e=>{var t;let n=mf(e);if(!n)return;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);i&&(i.dir=`rtl`)},e=>{var t;let n=mf(e);if(!n)return!1;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);return i?.dir===`rtl`})},u={fullScreen:vf(`Full Screen`,e=>{e.isFullscreen=!e.isFullscreen},e=>e.isFullscreen),splitView:vf(`Split View`,e=>{e.isSplitView=!e.isSplitView},e=>e.isSplitView),codeView:vf(`Code View`,e=>{e.isCodeView=!e.isCodeView},e=>e.isCodeView)},d={image:vf(`Insert Image`,e=>{let t=e.openImageModal;t?t():console.warn(`Image insertion requires modal implementation`)}),video:vf(`Insert Video`,e=>{let t=e.openVideoModal;t?t():console.warn(`Video insertion requires modal implementation`)}),embed:vf(`Insert Embed`,e=>{let t=e.openEmbedModal;t?t():console.warn(`Embed insertion requires modal implementation`)})};return{...t,...n,...r,...i,...a,...o,...s,...c,...l,...u,...d}}function bf(e,t){return{execute(n,r){let i=t[n];i&&i.execute(e,r)},isActive(n){var r;let i=t[n];return(r=i.isActive)?.call(i,e)||!1},getValue(n){var r;let i=t[n];return(r=i.getValue)?.call(i,e)||null}}}function xf(e,t){let n=t.getSelection();if(!n||!n.rangeCount)return!1;let r=n.getRangeAt(0),i=r.commonAncestorContainer,a=i.nodeType===Node.TEXT_NODE?i.parentElement:i;if(!a)return!1;let o=(e,t)=>e?t(e)?!0:o(e.parentElement,t):!1,s={bold:e=>{var t;let n=(t=e.tagName)?.toLowerCase();return n===`strong`||n===`b`},italic:e=>{var t;let n=(t=e.tagName)?.toLowerCase();return n===`em`||n===`i`},underline:e=>{var t;let n=(t=e.tagName)?.toLowerCase();return n===`u`},h1:e=>{var t;return(t=e.tagName)?.toLowerCase()===`h1`},h2:e=>{var t;return(t=e.tagName)?.toLowerCase()===`h2`},h3:e=>{var t;return(t=e.tagName)?.toLowerCase()===`h3`},h4:e=>{var t;return(t=e.tagName)?.toLowerCase()===`h4`},h5:e=>{var t;return(t=e.tagName)?.toLowerCase()===`h5`},h6:e=>{var t;return(t=e.tagName)?.toLowerCase()===`h6`},p:e=>{var t;return(t=e.tagName)?.toLowerCase()===`p`},blockquote:e=>{var t;return(t=e.tagName)?.toLowerCase()===`blockquote`},orderedList:e=>!!e.closest(`ol`),unorderedList:e=>!!e.closest(`ul`),alignLeft:e=>{let t=e.closest(`p, h1, h2, h3, h4, h5, h6`);return t?.style.textAlign===`start`},alignCenter:e=>{let t=e.closest(`p, h1, h2, h3, h4, h5, h6`);return t?.style.textAlign===`center`},alignRight:e=>{let t=e.closest(`p, h1, h2, h3, h4, h5, h6`);return t?.style.textAlign===`end`},alignJustify:e=>{let t=e.closest(`p, h1, h2, h3, h4, h5, h6`);return t?.style.textAlign===`justify`},textDirection:e=>{let t=e.closest(`p, h1, h2, h3, h4, h5, h6`);return t?.dir===`rtl`},ltrDirection:e=>{let t=e.closest(`p, h1, h2, h3, h4, h5, h6`);return t?.dir===`ltr`},rtlDirection:e=>{let t=e.closest(`p, h1, h2, h3, h4, h5, h6`);return t?.dir===`rtl`}};if([`splitView`,`codeView`,`fullScreen`].includes(e))return!1;let c=s[e];return c?o(a,c):o(a,t=>{var n;return(n=t.tagName)?.toLowerCase()===e.toLowerCase()})}function Sf(e,t){let n=yf(e),r=bf(e,n),i=()=>{if(!e.doc)return;let t=new Set,n=[`bold`,`italic`,`underline`,`link`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`blockquote`,`p`,`orderedList`,`unorderedList`,`alignLeft`,`alignCenter`,`alignRight`,`alignJustify`,`textDirection`,`ltrDirection`,`rtlDirection`];n.forEach(n=>{xf(n,e.doc)&&t.add(n)}),e.selectedStyles=t};return{execute:(n,a)=>{if(!e.doc){console.log(`[useCommands] No document available, skipping command`);return}if(t?.logCommand(n,a),[`splitView`,`codeView`,`fullScreen`].includes(n))switch(n){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(e){console.error(`[useCommands] Error focusing editor:`,e)}let o=e.doc.getSelection();o?.rangeCount&&(e.selection=o,e.range=o.getRangeAt(0).cloneRange(),e.rangeCount=o.rangeCount);try{r.execute(n,a);let e=[`splitView`,`codeView`,`fullScreen`];e.includes(n)||i()}catch(e){console.error(`[useCommands] Error during command execution:`,e)}},isActive:r.isActive,getValue:r.getValue}}var Cf=class{constructor(t=1e3){e.defineProperty(this,`session`,void 0),e.defineProperty(this,`maxActions`,void 0),e.defineProperty(this,`isDevelopment`,void 0),this.maxActions=t,this.session=this.createNewSession(),this.isDevelopment=!1}createNewSession(){return{id:`session_${Date.now()}`,startTime:Date.now(),actions:[]}}getNodeDescription(e){var t;if(e.nodeType===Node.TEXT_NODE)return`Text("${(t=e.textContent)?.slice(0,20)}${e.textContent&&e.textContent.length>20?`...`:``}")`;let n=e;return`${n.tagName.toLowerCase()}${n.id?`#${n.id}`:``}`}captureState(e){if(!e.doc||!e.selection)return{content:``,selection:null,activeStyles:[],caretPosition:null};let{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&&console.log(`Editor Action:`,e)}getSession(){return this.session}clearSession(){this.session=this.createNewSession()}exportSession(){return JSON.stringify(this.session,null,2)}downloadSession(){let 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){let t={message:e||`here is a debug log, can you analyze and fix accordingly?`,session:this.session};return JSON.stringify(t,null,2)}};function wf(e){let t=document.createElement(`div`);t.innerHTML=e;let n=[],r=[];return t.querySelectorAll(`iframe`).forEach((e,t)=>{let i=`<!--iframe-${t}-->`;n.push(e.cloneNode(!0)),r.push(i),e.replaceWith(i)}),{html:t.innerHTML,iframes:n}}function Tf(e,t,n){let r=/<!--iframe-(\d+)-->/g;e.body.innerHTML=t.replace(r,(e,t)=>{let r=n[Number(t)];return r?r.outerHTML:``})}function Ef(){let e=null,t=te({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;let e=new Set,n=[`bold`,`italic`,`underline`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`blockquote`,`p`,`orderedList`,`unorderedList`,`alignLeft`,`alignCenter`,`alignRight`,`alignJustify`,`textDirection`,`ltrDirection`,`rtlDirection`];n.forEach(n=>{t.doc&&xf(n,t.doc)&&e.add(n)}),t.selectedStyles=e},content:e=>{if(!t.doc)return;let n=t.doc.body.innerHTML;n!==t.content&&(t.undoStack.push(t.content),t.redoStack=[]);let r=t.doc.getSelection(),i=r?.rangeCount?r.getRangeAt(0).cloneRange():null;if(e===`html`){let e=wf(t.content);t.doc.body.innerHTML=e.html,setTimeout(()=>{if(t.doc&&(Tf(t.doc,t.content,e.iframes),i&&r))try{r.removeAllRanges(),r.addRange(i)}catch{}},0)}else t.doc.body.textContent=t.content},selection:()=>{if(!t.doc)return;let e=t.doc.getSelection();if(e)try{if(!t.doc.body.contains(e.anchorNode)){t.doc.body.focus();return}let r=!t.selection||t.selection!==e||t.rangeCount!==e.rangeCount||e.rangeCount>0&&t.range&&(t.range.startContainer!==e.getRangeAt(0).startContainer||t.range.startOffset!==e.getRangeAt(0).startOffset||t.range.endContainer!==e.getRangeAt(0).endContainer||t.range.endOffset!==e.getRangeAt(0).endOffset);r&&(t.selection=e,t.rangeCount=e.rangeCount,e.rangeCount>0&&(t.range=e.getRangeAt(0).cloneRange()),n.styles())}catch{t.selection=null,t.range=null,t.rangeCount=0,t.selectedStyles=new Set}}},r={undo:()=>{if(t.undoStack.length===0)return;t.redoStack.push(t.content);let e=t.undoStack.pop();e!==void 0&&(t.content=e,n.content(`html`))},redo:()=>{if(t.redoStack.length===0)return;t.undoStack.push(t.content);let e=t.redoStack.pop();e!==void 0&&(t.content=e,n.content(`html`))}},i={emptyTags:e=>{let t=e.createTreeWalker(e.body,NodeFilter.SHOW_ELEMENT,null),n=[],r=t.nextNode();for(;r;){var i;if([`br`,`img`,`hr`,`input`].includes(r.tagName.toLowerCase())){r=t.nextNode();continue}let a=(i=r.textContent)?.trim()||``,o=r.innerHTML.trim(),s=o===`<br>`||o===`<br/>`,c=o===`&nbsp;`||a===`\xA0`,l=!a&&!o,u=r.parentElement===e.body;(l||c||s&&!u)&&n.push(r),r=t.nextNode()}n.forEach(e=>{e.remove()})},normalizeContent:e=>{var t;let n=e.createTreeWalker(e.body,NodeFilter.SHOW_TEXT),r=[],i;for(;i=n.nextNode();)i.parentElement===e.body&&(t=i.textContent)?.trim()&&r.push(i);r.forEach(t=>{let n=e.createElement(`p`);n.dir=e.body.dir,n.appendChild(t.cloneNode()),e.body.replaceChild(n,t)})}};function a(r){e&&(e(),e=null);let i=!1,a={input:()=>{if(i)return;i=!0;let e=r.body.innerHTML;e!==t.content&&(t.content=e),i=!1},selectionchange:()=>{i||n.selection()},mouseup:()=>{i||n.selection()},keyup:e=>{i||[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`].includes(e.key)&&n.selection()}};return Object.entries(a).forEach(([e,t])=>{r.addEventListener(e,t)}),e=()=>{Object.entries(a).forEach(([e,t])=>{r.removeEventListener(e,t)})},e}function o(n){if(t.hasInit&&e&&(e(),e=null),t.doc=n,t.hasInit=!0,n.editorState=t,t.content&&t.content.trim()&&!t.content.match(/^<p(?:\s[^>]*)?>(?:<br\s*\/?>)?\s*<\/p>$/i)){let e=wf(t.content);n.body.innerHTML=e.html,setTimeout(()=>{t.doc&&Tf(n,t.content,e.iframes)},0)}if(i.normalizeContent(n),n.body.firstElementChild){let e=n.createRange(),r=n.getSelection();r&&(e.selectNodeContents(n.body),e.collapse(!1),r.removeAllRanges(),r.addRange(e),t.range=e.cloneRange(),t.selection=r,t.rangeCount=r.rangeCount)}else{let e=n.getSelection();if(e){let r=n.createRange();r.setStart(n.body,0),r.setEnd(n.body,0),e.removeAllRanges(),e.addRange(r),t.range=r.cloneRange(),t.selection=e,t.rangeCount=e.rangeCount}}e=a(n)}function s(){if(!t.debug){let e=new Cf,n={debugger:e,logCommand:(n,r)=>{e.logCommand(n,r,t)},getSession:()=>e.getSession(),clearSession:()=>{e.clearSession()},downloadSession:()=>{e.downloadSession()},exportDebugWithPrompt:t=>e.exportSessionWithPrompt(t)};t.debug=n}}return typeof window<`u`&&window.addEventListener(`beforeunload`,()=>{e&&e()}),{state:t,init:o,updateState:n,history:r,initDebugger:s,cleanup:()=>{e&&(e(),e=null)}}}const Df=[{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 Of(e,t){e.addEventListener(`keydown`,e=>{if(!e.ctrlKey&&!e.metaKey)return;let n=Df.find(t=>{let n=t.key===e.key,r=!t.modifiers||(!t.modifiers.ctrl||e.ctrlKey||e.metaKey)&&(!t.modifiers.alt||e.altKey)&&(!t.modifiers.shift||e.shiftKey);return n&&r});n&&(e.preventDefault(),t.execute(n.command))})}const kf={key:0},Af={key:1,class:`flex pt-05`},jf={class:`inline-toolbar-content`},Mf={class:`menu-header`},Nf={class:`px-025`},Pf={key:3,class:`context-menu-separator`},Ff={class:`flex gap-05 align-items-end`},If={class:`flex gap-1`},Lf={class:`flex gap-05 w-100`},Rf={class:`flex gap-1`},zf={class:`flex gap-05 w-100`},Bf={class:`grid gap-0`},Vf={key:0,class:`flex gap-025 opacity-5 -mt-05`},Hf={key:1,class:`grid grid-wrap-2 gap-05`},Uf={class:`grid grid-wrap-2 gap-05 py-1`},Wf={class:`overflow-hidden flex justify-content-center`},Gf={class:`flex gap-05 w-100`},Kf={class:`grid grid-wrap-4 m_grid-wrap-2 gap-col-1 table-editor testMe1`},qf={class:`grid-span-1`},Jf={class:`flex gap-025 mt-025 radius-1 p-05 w-fit`,style:{height:`var(--input-height)`,background:`var(--input-bg)`}},Yf={class:`grid-span-1`},Xf={class:`flex gap-025 mt-025 radius-1 p-025 w-fit`,style:{height:`var(--input-height)`,background:`var(--input-bg)`}},Zf={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`},Qf={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`},$f=[`innerHTML`];var ep=h({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:{}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let i=e,a=r,s=ae(),f=R(),h=Ef(),g=R(!1),_=R(!1),v=Sf(h.state,h.state.debug),y=o(()=>!(i.hideToolbar||i.basic)),b=o(()=>!i.hideInlineToolbar),x=o(()=>i.toolbarConfig),S=o(()=>{let e=[...i.hide||[]];if(i.simple){let t=[`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`image`,`video`,`embed`,`ul`,`ol`,`blockquote`,`direction`,`table`,`alignment`];t.forEach(t=>{e.includes(t)||e.push(t)})}return e}),C=R(!1),w=R({url:``,openInNewTab:!0}),E=R(!1),O=R({message:``,x:0,y:0}),j=null,ee=R(!1),N=R({src:``,alt:``,width:``,height:``,credit:``,figcaption:!1}),F=null,I=R(!1),L=R({src:``,width:`560`,height:`315`,alt:``}),te=null,z=R(!1),B=R({top:0,left:0}),ne=R(null),re=R(!1),V=R({src:``,width:``,autoplay:!1,mute:!1,controls:!0,loop:!1,aspectRatio:`16:9`,customWidth:``,customHeight:``,caption:``,showCaption:!1}),H=null,ie=R(!1),W=R({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`}),oe=R(!1),se=R({x:0,y:0}),K=R(null),ce=null,le=o(()=>{let e=W.value,t=`
17
+ `).length)),(r.multiline||r.code)&&(e=Math.max(e,4)),e}),m=bn(()=>{i(`debounce`,a.value)},700);function h(){if(!r.autoheight||!s.value||s.value.tagName!==`TEXTAREA`)return;let e=s.value;e.style.height=`auto`,e.style.height=`${e.scrollHeight+1}px`}function g(){r.disabled||(i(`update:modelValue`,a.value),m(),r.autoheight&&E(()=>{h()}))}q(()=>r.modelValue,e=>{e!==a.value&&(a.value=e,r.autoheight&&E(()=>{h()}))},{immediate:!0});let _=()=>document.activeElement===s.value,v=()=>{var e;return(e=s.value)?.focus()};return t({focus:v,hasFocus:_}),j(async()=>{if(r.autofocus){var e;await wn(()=>s.value).toBeTruthy(),await Xc(400),(e=s.value)?.focus()}r.defaultValue&&!r.modelValue&&(a.value=r.defaultValue),r.autoheight&&(await E(),h())}),(e,t)=>(P(),u(`div`,{class:D([`bagel-input text-input`,{dense:e.dense,small:e.small,shrink:e.shrink,code:e.code,textInputIconWrap:e.icon,txtInputIconStart:e.iconStart}]),title:e.title},[d(`label`,{for:e.id},[p(U(e.label)+` `,1),e.required&&e.label?(P(),u(`span`,Md,`*`)):l(``,!0),!e.multiline&&!e.autoheight&&!e.code&&f.value<2?pe((P(),u(`input`,T({key:1,id:e.id,ref_key:`input`,ref:s,"onUpdate:modelValue":t[0]||=e=>x(a)?a.value=e:a=e,name:e.name,title:e.title,autocomplete:e.autocomplete,type:e.type,rows:1,placeholder:e.placeholder||e.label,disabled:e.disabled,required:e.required,pattern:e.pattern},e.nativeInputAttrs,{onFocusout:t[1]||=(...t)=>e.onFocusout&&e.onFocusout(...t),onFocus:t[2]||=(...t)=>e.onFocus&&e.onFocus(...t),onInput:g}),null,16,Nd)),[[le,G(a),void 0,{trim:!0}]]):pe((P(),u(`textarea`,T({key:2,id:e.id,ref_key:`input`,ref:s,"onUpdate:modelValue":t[3]||=e=>x(a)?a.value=e:a=e,name:e.name,title:e.title,type:e.type,rows:f.value,placeholder:e.placeholder||e.label,disabled:e.disabled,required:e.required,pattern:e.pattern},e.nativeInputAttrs,{onInput:g,onFocusout:t[4]||=(...t)=>e.onFocusout&&e.onFocusout(...t)}),null,16,Pd)),[[de,G(a)]]),e.helptext?(P(),u(`p`,Fd,U(e.helptext),1)):l(``,!0),e.iconStart?(P(),c(G($),{key:4,class:`iconStart`,icon:e.iconStart},null,8,[`icon`])):l(``,!0),e.icon?(P(),c(G($),{key:5,icon:e.icon},null,8,[`icon`])):l(``,!0)],8,jd)],10,Ad))}}),Ld=Y(Id,[[`__scopeId`,`data-v-158a9742`]]);const Rd=[`mergeCells`,`splitCells`,`addRowBefore`,`addRowAfter`,`deleteRow`,`insertColumnLeft`,`insertColumnRight`,`deleteColumn`,`tableAlignLeft`,`tableAlignCenter`,`tableAlignRight`,`tableAlignJustify`,`deleteTable`],zd=`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`.split(`.`),Bd=[`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`,...Rd,`separator`,`undo`,`redo`,`fullScreen`],Vd=[{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`}],Hd={class:`table-grid-selector p-075`},Ud={class:`txt-center mb-075`},Wd={style:{"font-size":`14px`,"font-weight":`500`,color:`#333`,"margin-bottom":`4px`}},Gd=[`onMouseenter`,`onClick`],Kd={class:`border-top pt-075`},qd=10,Jd=10;var Yd=h({__name:`TableGridSelector`,emits:[`insert`,`openAdvanced`],setup(e,{emit:t}){let r=t,i=R(0),a=R(0),s=o(()=>{let e=[];for(let t=1;t<=qd;t++)for(let n=1;n<=Jd;n++)e.push({row:t,col:n,isActive:t<=i.value&&n<=a.value});return e}),l=o(()=>i.value===0||a.value===0?`Select table size`:`${i.value} × ${a.value}`),f=(e,t)=>{i.value=e,a.value=t},p=(e,t,n)=>{r(`insert`,e,t),n()},h=e=>{r(`openAdvanced`),e()},g=()=>{i.value=0,a.value=0};return(e,t)=>(P(),c(G(nc),{placement:`bottom-start`,thin:``,flat:``,icon:`table`},{default:J(({hide:e})=>[d(`div`,Hd,[d(`div`,Ud,[d(`div`,Wd,U(l.value),1),t[0]||=d(`div`,{style:{"font-size":`12px`,color:`#666`}},` Hover to select size `,-1)]),d(`div`,{style:{display:`grid`,"grid-template-columns":`repeat(10, 20px)`,"grid-template-rows":`repeat(10, 20px)`,gap:`2px`,"margin-bottom":`12px`,direction:`ltr`},onMouseleave:g},[(P(!0),u(n,null,z(s.value,t=>(P(),u(`div`,{key:`${t.row}-${t.col}`,onMouseenter:e=>f(t.row,t.col),onClick:n=>p(t.row,t.col,e),style:k({width:`20px`,height:`20px`,border:`1px solid #ddd`,backgroundColor:t.isActive?`var(--bgl-primary)`:`#fff`,cursor:`pointer`,borderRadius:`2px`,transition:`background-color 0.1s ease`})},null,44,Gd))),128))],32),d(`div`,Kd,[m(G(X),{onClick:t=>h(e),value:`Advanced Settings`,icon:`settings`,class:`bg-gray-30 color-black`},null,8,[`onClick`])])])]),_:1}))}}),Xd=Yd;const Zd={class:`toolbar flex gap-025 pb-05 flex-wrap`,role:`toolbar`,style:{position:`relative`}},Qd={class:`flex flex-column p-025`};var $d=h({__name:`EditorToolbar`,props:{config:{default:zd},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}){let r=t;function i(){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 o(t){if(e.hide.includes(t))return!0;let n={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`]};for(let[r,i]of Object.entries(n))if(e.hide.includes(r)&&i.includes(t))return!0;let r={insertImage:e.hideImages,insertVideo:e.hideVideos,insertEmbed:e.hideEmbeds,insertTable:e.hideTables,alignMenu:e.hideAlignment,textDirection:e.hideDirections,h5:e.hideH5H6,h6:e.hideH5H6};return r[t]||!1}function s(t){let n=e.config.map(f).filter(Boolean),r=-1;for(let e=t-1;e>=0;e--){let t=n[e];if(t&&t.name!==`separator`&&!o(t.name)){r=e;break}}let i=-1;for(let e=t+1;e<n.length;e++){let t=n[e];if(t&&t.name!==`separator`&&!o(t.name)){i=e;break}}if(r===-1||i===-1)return!1;for(let e=r+1;e<t;e++){let t=n[e];if(t&&t.name===`separator`)return!1}return!0}let f=e=>Vd.find(t=>t.name===e);function p(e,t){console.log(`EditorToolbar: runAction called`,{name:e,value:t}),r(`action`,e,t)}function h(e,t){let n=document.createElement(`table`);n.style.width=`100%`,n.style.borderCollapse=`collapse`,n.style.marginBottom=`1rem`;let i=document.createElement(`thead`),a=i.insertRow();for(let e=0;e<t;e++){let t=document.createElement(`th`);t.innerHTML=`Header ${e+1}`,t.style.padding=`8px`,t.style.border=`1px solid #ddd`,t.style.backgroundColor=`#f4f4f4`,a.appendChild(t)}n.appendChild(i);let o=document.createElement(`tbody`);for(let n=0;n<e;n++){let e=o.insertRow();for(let n=0;n<t;n++){let t=e.insertCell();t.innerHTML=`&nbsp;`,t.style.padding=`8px`,t.style.border=`1px solid #ddd`}}n.appendChild(o),r(`action`,`insertTable`,n.outerHTML)}function g(){r(`action`,`insertTable`)}return(e,t)=>{let r=re(`tooltip`);return P(),u(`div`,Zd,[(P(!0),u(n,null,z(e.config.map(f).filter(Boolean),(t,f)=>(P(),u(n,{key:f},[t.name===`insertTable`&&!o(`insertTable`)?(P(),c(Xd,{key:0,onInsert:h,onOpenAdvanced:g})):t.name===`insertImage`&&!o(`insertImage`)?pe((P(),c(G(X),{key:1,icon:t.icon,thin:``,flat:``,"aria-label":t.name,class:D([[t.class,{active:e.selectedStyles.has(t.name)}],``]),tabindex:`-1`,onClick:e=>p(t.name)},null,8,[`icon`,`aria-label`,`class`,`onClick`])),[[r,t.label]]):t.name===`insertVideo`&&!o(`insertVideo`)?pe((P(),c(G(X),{key:2,icon:t.icon,thin:``,flat:``,"aria-label":t.name,class:D([[t.class,{active:e.selectedStyles.has(t.name)}],``]),tabindex:`-1`,onClick:e=>p(t.name)},null,8,[`icon`,`aria-label`,`class`,`onClick`])),[[r,t.label]]):t.name===`insertEmbed`&&!o(`insertEmbed`)?pe((P(),c(G(X),{key:3,icon:t.icon,thin:``,flat:``,"aria-label":t.name,class:D([[t.class,{active:e.selectedStyles.has(t.name)}],``]),tabindex:`-1`,onClick:e=>p(t.name)},null,8,[`icon`,`aria-label`,`class`,`onClick`])),[[r,t.label]]):t.name===`alignMenu`&&!o(`alignMenu`)?(P(),c(G(nc),{key:4,placement:`bottom-start`,thin:``,flat:``,icon:i(),class:D({"alignment-active":a()})},{default:J(({hide:t})=>[d(`div`,Qd,[m(G(X),{thin:``,flat:``,icon:`format_align_left`,class:D({active:e.selectedStyles.has(`alignLeft`)}),onClick:e=>{p(`alignLeft`),t()}},null,8,[`class`,`onClick`]),m(G(X),{thin:``,flat:``,icon:`format_align_center`,class:D({active:e.selectedStyles.has(`alignCenter`)}),onClick:e=>{p(`alignCenter`),t()}},null,8,[`class`,`onClick`]),m(G(X),{thin:``,flat:``,icon:`format_align_right`,class:D({active:e.selectedStyles.has(`alignRight`)}),onClick:e=>{p(`alignRight`),t()}},null,8,[`class`,`onClick`]),m(G(X),{thin:``,flat:``,icon:`format_align_justify`,class:D({active:e.selectedStyles.has(`alignJustify`)}),onClick:e=>{p(`alignJustify`),t()}},null,8,[`class`,`onClick`])])]),_:1},8,[`icon`,`class`])):t.name===`textDirection`&&!o(`textDirection`)?pe((P(),c(G(X),{key:5,icon:e.selectedStyles.has(`textDirection`)?`format_textdirection_l_to_r`:`format_textdirection_r_to_l`,thin:``,flat:``,"aria-label":t.name,class:D([[t.class,{active:e.selectedStyles.has(`textDirection`)}],``]),tabindex:`-1`,onClick:e=>p(t.name)},null,8,[`icon`,`aria-label`,`class`,`onClick`])),[[r,t.label]]):(t.name===`h5`||t.name===`h6`)&&!o(t.name)?pe((P(),c(G(X),{key:6,icon:t.icon,thin:``,flat:``,"aria-label":t.name,class:D([[t.class,{active:e.selectedStyles.has(t.name)}],``]),tabindex:`-1`,onClick:e=>p(t.name)},null,8,[`icon`,`aria-label`,`class`,`onClick`])),[[r,t.label]]):t.name!==`separator`&&t.name!==`insertTable`&&t.name!==`insertImage`&&t.name!==`insertVideo`&&t.name!==`insertEmbed`&&t.name!==`alignMenu`&&t.name!==`textDirection`&&t.name!==`h5`&&t.name!==`h6`&&!o(t.name)?pe((P(),c(G(X),{key:7,icon:t.icon,thin:``,flat:``,"aria-label":t.name,class:D([[t.class,{active:e.selectedStyles.has(t.name)}],``]),tabindex:`-1`,onClick:e=>p(t.name)},null,8,[`icon`,`aria-label`,`class`,`onClick`])),[[r,t.label]]):t.name===`separator`&&s(f)?(P(),u(`span`,{key:`separator-${f}`,class:`opacity-2 mb-025`},`|`)):l(``,!0)],64))),128))])}}}),ef=Y($d,[[`__scopeId`,`data-v-d36f1ef5`]]);function tf(e,t){let{doc:n}=t;if(!n){console.log(`No doc found`);return}let r=n.getSelection();if(!r||!r.rangeCount){console.log(`No selection found`);return}let i=r.getRangeAt(0);if(i.collapsed){let e=nf(n,i);if(!e){console.log(`Failed to select word at cursor`);let e=t.showTooltipMessage;e?e(`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}i=r.getRangeAt(0)}let a=i.commonAncestorContainer,o=a.nodeType===Node.TEXT_NODE?a.parentElement:a,s=o?.closest(`a`);if(t.openLinkModal){t.openLinkModal(r,i,s);return}console.warn(`Link modal not available - openLinkModal function not found`),alert(`Link functionality requires proper modal setup`)}function nf(e,t){if(!t.collapsed)return!0;let n=t.startContainer,r=t.startOffset;if(n.nodeType!==Node.TEXT_NODE){let e=n;if(e.childNodes.length>0&&r<e.childNodes.length){let t=e.childNodes[r];if(t.nodeType===Node.TEXT_NODE)n=t,r=0;else return!1}else return!1}let i=n.textContent||``;if(!i)return!1;let a=r,o=r,s=/[\u0590-\u05FF\u0600-\u06FF\w]/;for(;a>0&&s.test(i[a-1]);)a--;for(;o<i.length&&s.test(i[o]);)o++;if(a<o){t.setStart(n,a),t.setEnd(n,o);let r=e.getSelection();return r&&(r.removeAllRanges(),r.addRange(t)),!0}return!1}function rf(e,t,n){if(!n.doc)return;let r=n.doc.createElement(`table`);r.style.width=`100%`,r.style.borderCollapse=`collapse`,r.style.marginBottom=`1rem`;let i=n.doc.createElement(`thead`),a=i.insertRow();for(let e=0;e<t;e++){let t=n.doc.createElement(`th`);t.innerHTML=`Header ${e+1}`,t.style.padding=`8px`,t.style.border=`1px solid var(--border-color, #ddd)`,t.style.backgroundColor=`var(--bgl-gray-light, #f4f4f4)`,a.appendChild(t)}r.appendChild(i);let o=n.doc.createElement(`tbody`);for(let n=0;n<e;n++){let e=o.insertRow();for(let n=0;n<t;n++){let t=e.insertCell();t.innerHTML=`&nbsp;`,t.style.padding=`8px`,t.style.border=`1px solid var(--border-color, #ddd)`}}r.appendChild(o);let{range:s}=n;if(s){if(s.insertNode(r),n.doc.getSelection()){let e=r.querySelector(`td`);if(e){s.selectNodeContents(e),s.collapse(!0);let t=n.doc.getSelection();t&&(t.removeAllRanges(),t.addRange(s))}}}else n.doc.body.appendChild(r);n.content=n.doc.body.innerHTML}function af(e,t){var n;let r=Array.from(e.cloneContents().querySelectorAll(`td`));if(r.length<2)return;let i=(n=e.startContainer.parentElement)?.closest(`td`);if(!i)return;i.colSpan=r.length,i.innerHTML=r.map(e=>e.innerHTML).join(` `),r.slice(1).forEach(e=>{let n=t.getElementById(e.id);n?.remove()});let a=t.editorState;a&&(a.content=t.body.innerHTML)}function sf(e,t){var n;let r=(n=e.startContainer.parentElement)?.closest(`td`);if(!r||!r.colSpan||r.colSpan===1)return;let i=Array(r.colSpan-1).fill(0).map(()=>{let e=t.createElement(`td`);return e.style.border=`1px solid var(--border-color)`,e.style.padding=`8px`,e.innerHTML=`&nbsp;`,e});r.colSpan=1,r.insertAdjacentElement(`afterend`,i[0]),i.slice(1).forEach(e=>{i[0].insertAdjacentElement(`afterend`,e)});let a=t.editorState;a&&(a.content=t.body.innerHTML)}function cf(e,t,n){var r;let i=(r=t.startContainer.parentElement)?.closest(`td`);if(!i)return;let a=i.parentElement,o=a?.parentElement;if(!a||!o)return;let s=a.cloneNode(!0);Array.from(s.cells).forEach(e=>e.innerHTML=`&nbsp;`),a.insertAdjacentElement(e===`before`?`beforebegin`:`afterend`,s);let c=n.editorState;c&&(c.content=n.body.innerHTML)}function lf(e){var t;let n=(t=e.startContainer.parentElement)?.closest(`td`);if(!n)return;let r=n.parentElement;if(!r)return;let i=r.ownerDocument;r.remove();let a=i.editorState;a&&(a.content=i.body.innerHTML)}function uf(e){var t;let n=(t=e.startContainer.parentElement)?.closest(`td`);if(!n)return;let r=n.closest(`table`);if(!r)return;let i=r.ownerDocument;r.remove();let a=i.editorState;a&&(a.content=i.body.innerHTML)}function df(e,t){var n;let r=(n=t.startContainer.parentElement)?.closest(`td`);if(!r)return;let i=r.closest(`table`);if(!i)return;let a=r.cellIndex,{rows:o}=i;for(let t=0;t<o.length;t++){let n=o[t].insertCell(e===`after`?a+1:a);n.innerHTML=`&nbsp;`,n.style.border=`1px solid var(--border-color)`,n.style.padding=`8px`}let s=i.ownerDocument.editorState;s&&(s.content=i.ownerDocument.body.innerHTML)}function ff(e){var t;let n=(t=e.startContainer.parentElement)?.closest(`td`);if(!n)return;let r=n.closest(`table`);if(!r)return;let i=n.cellIndex,{rows:a}=r,o=r.ownerDocument;for(let e=0;e<a.length;e++)a[e].deleteCell(i);a[0].cells.length===0&&r.remove();let s=o.editorState;s&&(s.content=o.body.innerHTML)}function pf(e,t){var n;let r=(n=e.startContainer.parentElement)?.closest(`td`);if(!r)return;let i=r.closest(`table`);if(!i)return;let a=r.cellIndex,{rows:o}=i;for(let e=0;e<o.length;e++){let n=o[e].cells[a];n&&(n.style.textAlign=t)}let s=i.ownerDocument.editorState;s&&(s.content=i.ownerDocument.body.innerHTML)}function mf(e){if(!e.doc)return null;let t=e.doc.getSelection();if(!t||!t.rangeCount)return null;let n=t.getRangeAt(0);return{selection:t,range:n}}function hf(e,t,n){if(!t.collapsed)return!1;let r=t.startContainer,i=t.startOffset;if(r.nodeType!==Node.TEXT_NODE){let e=r;if(e.childNodes.length>0&&i<e.childNodes.length){let t=e.childNodes[i];if(t.nodeType===Node.TEXT_NODE)r=t,i=0;else return!1}else return!1}let a=r.parentElement,o=a?.closest(n.toLowerCase());if(o)try{let t=o.parentNode;if(t){for(;o.firstChild;)t.insertBefore(o.firstChild,o);t.removeChild(o);let n=e.createRange();n.setStart(r,i),n.collapse(!0);let a=e.getSelection();return a&&(a.removeAllRanges(),a.addRange(n)),!0}}catch(e){return console.error(`Error removing formatting from word:`,e),!1}let s=r.textContent||``;if(!s)return!1;let c=i,l=i,u=/[\u0590-\u05FF\u0600-\u06FF\w]/;for(i>0&&u.test(s[i-1])&&(i>=s.length||!u.test(s[i]))&&(c=i-1,l=i-1);c>0&&u.test(s[c-1]);)c--;for(;l<s.length&&u.test(s[l]);)l++;if(c<l&&l>c)try{let t=s.substring(0,c),i=s.substring(c,l),a=s.substring(l),o=e.createElement(n);o.textContent=i;let u=r.parentNode;if(u){if(t){let n=e.createTextNode(t);u.insertBefore(n,r)}if(u.insertBefore(o,r),a){let t=e.createTextNode(a);u.insertBefore(t,r)}u.removeChild(r);let n=e.createRange();n.setStartAfter(o),n.collapse(!0);let i=e.getSelection();return i&&(i.removeAllRanges(),i.addRange(n)),!0}}catch(e){console.error(`Error applying formatting to word:`,e)}return!1}function gf(e){if(!e.doc)return;e.content=e.doc.body.innerHTML;let t=e.doc.getSelection();t&&t.rangeCount>0&&(e.selection=t,e.range=t.getRangeAt(0).cloneRange(),e.rangeCount=t.rangeCount)}function _f(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 vf(e,t,n){return{name:e,execute:(e,n)=>{e.doc&&(t(e,n),gf(e))},isActive:n}}function yf(e){let t={undo:vf(`Undo`,()=>{if(e.undoStack.length>0&&e.doc){let t=e.undoStack.pop();t!==void 0&&(e.redoStack.push(e.content),e.content=t,e.doc.body.innerHTML=t)}}),redo:vf(`Redo`,()=>{if(e.redoStack.length>0&&e.doc){let t=e.redoStack.pop();t!==void 0&&(e.undoStack.push(e.content),e.content=t,e.doc.body.innerHTML=t)}})},n={bold:vf(`Bold`,e=>{let t=mf(e);if(!t)return;let{range:n,selection:r}=t;if(n.collapsed){let t=hf(e.doc,n,`b`);return}let i=n.commonAncestorContainer,a=i.nodeType===Node.TEXT_NODE?i.parentElement:i,o=a?.closest(`b, strong`);if(o)try{let e=o.parentNode;for(;o.firstChild;)e?.insertBefore(o.firstChild,o);e?.removeChild(o),r.removeAllRanges(),r.addRange(n)}catch(e){console.error(`Error removing bold:`,e)}else try{let t=e.doc.createElement(`b`);try{n.surroundContents(t)}catch{let e=n.extractContents();t.appendChild(e),n.insertNode(t)}n.selectNodeContents(t),r.removeAllRanges(),r.addRange(n)}catch(e){console.error(`Error applying bold:`,e)}},e=>{let t=mf(e);if(!t)return!1;let n=t.range.commonAncestorContainer,r=n.nodeType===Node.TEXT_NODE?n.parentElement:n;return!!r?.closest(`b, strong`)}),italic:vf(`Italic`,e=>{let t=mf(e);if(!t)return;let{range:n,selection:r}=t;if(n.collapsed){let t=hf(e.doc,n,`i`);return}let i=n.commonAncestorContainer,a=i.nodeType===Node.TEXT_NODE?i.parentElement:i,o=a?.closest(`i, em`);if(o)try{let e=o.parentNode;for(;o.firstChild;)e?.insertBefore(o.firstChild,o);e?.removeChild(o),r.removeAllRanges(),r.addRange(n)}catch(e){console.error(`Error removing italic:`,e)}else try{let t=e.doc.createElement(`i`);try{n.surroundContents(t)}catch{let e=n.extractContents();t.appendChild(e),n.insertNode(t)}n.selectNodeContents(t),r.removeAllRanges(),r.addRange(n)}catch(e){console.error(`Error applying italic:`,e)}},e=>{let t=mf(e);if(!t)return!1;let n=t.range.commonAncestorContainer,r=n.nodeType===Node.TEXT_NODE?n.parentElement:n;return!!r?.closest(`i, em`)}),underline:vf(`Underline`,e=>{let t=mf(e);if(!t)return;let{range:n,selection:r}=t;if(n.collapsed){let t=hf(e.doc,n,`u`);return}let i=n.commonAncestorContainer,a=i.nodeType===Node.TEXT_NODE?i.parentElement:i,o=a?.closest(`u`);if(o)try{let e=o.parentNode;for(;o.firstChild;)e?.insertBefore(o.firstChild,o);e?.removeChild(o),r.removeAllRanges(),r.addRange(n)}catch(e){console.error(`Error removing underline:`,e)}else try{let t=e.doc.createElement(`u`);try{n.surroundContents(t)}catch{let e=n.extractContents();t.appendChild(e),n.insertNode(t)}n.selectNodeContents(t),r.removeAllRanges(),r.addRange(n)}catch(e){console.error(`Error applying underline:`,e)}},e=>{let t=mf(e);if(!t)return!1;let n=t.range.commonAncestorContainer,r=n.nodeType===Node.TEXT_NODE?n.parentElement:n;return!!r?.closest(`u`)}),link:vf(`Link`,e=>{let t=e.openLinkModal;t&&tf(t,e)},e=>{let t=mf(e);if(!t)return!1;let n=t.range.commonAncestorContainer,r=n.nodeType===Node.TEXT_NODE?n.parentElement:n;return!!r?.closest(`a`)})},r=[`h1`,`h2`,`h3`,`h4`,`h5`,`h6`].reduce((e,t)=>({...e,[t]:vf(`Heading ${t}`,e=>{let n=mf(e);if(!n)return;let{range:r,selection:i}=n,a=_f(r.commonAncestorContainer);if(!a)return;let o=r.startContainer,s=r.endContainer,c=r.startOffset,l=r.endOffset,u=r.collapsed,d=a.tagName.toLowerCase()===t.toLowerCase(),f=d?`p`:t;try{var p;let t=e.doc.createElement(f);for(;a.firstChild;)t.appendChild(a.firstChild);(p=a.parentNode)?.replaceChild(t,a);try{let n=e.doc.createRange(),r=(t,n,r)=>{if(t===n)return r;if(t.nodeType===Node.TEXT_NODE){let i=e.doc.createTreeWalker(r,NodeFilter.SHOW_TEXT,null),a=0,o=e.doc.createTreeWalker(n,NodeFilter.SHOW_TEXT,null),s=o.nextNode();for(;s&&s!==t;)a++,s=o.nextNode();let c=i.nextNode(),l=0;for(;c&&l<a;)l++,c=i.nextNode();return c}return r.firstChild},d=r(o,a,t),f=r(s,a,t);if(d&&f){if(d.nodeType===Node.TEXT_NODE){var m;let e=Math.min(c,(m=d.textContent)?.length||0);n.setStart(d,e)}else n.setStart(d,0);if(u)n.collapse(!0);else if(f.nodeType===Node.TEXT_NODE){var h;let e=Math.min(l,(h=f.textContent)?.length||0);n.setEnd(f,e)}else n.setEnd(f,0);i.removeAllRanges(),i.addRange(n)}else n.selectNodeContents(t),u&&n.collapse(!0),i.removeAllRanges(),i.addRange(n)}catch(n){console.warn(`Error restoring selection after heading change:`,n);let r=e.doc.createRange();r.selectNodeContents(t),r.collapse(!0),i.removeAllRanges(),i.addRange(r)}if(!d){let n=t.nextElementSibling;if(!n){var g;let n=e.doc.createElement(`p`);n.dir=t.dir||e.doc.body.dir,(g=t.parentNode)?.insertBefore(n,t.nextSibling)}}}catch(e){console.error(`Error applying ${t} heading:`,e)}})}),{}),i={p:vf(`Paragraph`,e=>{let t=mf(e);if(!t)return;let{range:n}=t,r=_f(n.commonAncestorContainer);if(r&&r.tagName.toLowerCase()!==`p`)try{var i;let a=e.doc.createElement(`p`);for(;r.firstChild;)a.appendChild(r.firstChild);(i=r.parentNode)?.replaceChild(a,r),n.selectNodeContents(a),n.collapse(!1),t.selection.removeAllRanges(),t.selection.addRange(n)}catch(e){console.error(`Error applying paragraph:`,e)}}),blockquote:vf(`Blockquote`,e=>{let t=mf(e);if(!t)return;let{range:n}=t,r=_f(n.commonAncestorContainer);if(!r)return;let i=r.tagName.toLowerCase()===`blockquote`,a=i?`p`:`blockquote`;try{var o;let i=e.doc.createElement(a);for(;r.firstChild;)i.appendChild(r.firstChild);(o=r.parentNode)?.replaceChild(i,r),n.selectNodeContents(i),n.collapse(!1),t.selection.removeAllRanges(),t.selection.addRange(n)}catch(e){console.error(`Error applying blockquote:`,e)}})},a={orderedList:vf(`Ordered List`,e=>{let t=mf(e);if(!t)return;let{range:n}=t,r=_f(n.commonAncestorContainer);if(!r)return;let i=r.closest(`li`);if(i){let r=i.parentElement;if(!r)return;if(r.tagName.toLowerCase()===`ol`){var a;let o=e.doc.createElement(`p`);for(;i.firstChild;)o.appendChild(i.firstChild);(a=r.parentNode)?.insertBefore(o,r),i.remove(),r.querySelector(`li`)||r.remove(),n.selectNodeContents(o),n.collapse(!1),t.selection.removeAllRanges(),t.selection.addRange(n);return}if(r.tagName.toLowerCase()===`ul`){var o;let i=e.doc.createElement(`ol`),a=n.startOffset,s=n.startContainer;for(;r.firstChild;)i.appendChild(r.firstChild);(o=r.parentNode)?.replaceChild(i,r);try{let n=e.doc.createRange();n.setStart(s,a),n.collapse(!0),t.selection.removeAllRanges(),t.selection.addRange(n)}catch{let n=i.querySelector(`li`);if(n){let r=e.doc.createRange();r.selectNodeContents(n),r.collapse(!0),t.selection.removeAllRanges(),t.selection.addRange(r)}}return}}try{var s;let i=e.doc.createElement(`ol`),a=e.doc.createElement(`li`);for(;r.firstChild;)a.appendChild(r.firstChild);i.appendChild(a),(s=r.parentNode)?.replaceChild(i,r),n.selectNodeContents(a),n.collapse(!1),t.selection.removeAllRanges(),t.selection.addRange(n)}catch(e){console.error(`Error creating ordered list:`,e)}}),unorderedList:vf(`Unordered List`,e=>{let t=mf(e);if(!t)return;let{range:n}=t,r=_f(n.commonAncestorContainer);if(!r)return;let i=r.closest(`li`);if(i){let r=i.parentElement;if(!r)return;if(r.tagName.toLowerCase()===`ul`){var a;let o=e.doc.createElement(`p`);for(;i.firstChild;)o.appendChild(i.firstChild);(a=r.parentNode)?.insertBefore(o,r),i.remove(),r.querySelector(`li`)||r.remove(),n.selectNodeContents(o),n.collapse(!1),t.selection.removeAllRanges(),t.selection.addRange(n);return}if(r.tagName.toLowerCase()===`ol`){var o;let i=e.doc.createElement(`ul`),a=n.startOffset,s=n.startContainer;for(;r.firstChild;)i.appendChild(r.firstChild);(o=r.parentNode)?.replaceChild(i,r);try{let n=e.doc.createRange();n.setStart(s,a),n.collapse(!0),t.selection.removeAllRanges(),t.selection.addRange(n)}catch(n){console.warn(`Could not restore cursor position:`,n);let r=i.querySelector(`li`);if(r){let n=e.doc.createRange();n.selectNodeContents(r),n.collapse(!0),t.selection.removeAllRanges(),t.selection.addRange(n)}}return}}try{var s;let i=e.doc.createElement(`ul`),a=e.doc.createElement(`li`);for(;r.firstChild;)a.appendChild(r.firstChild);i.appendChild(a),(s=r.parentNode)?.replaceChild(i,r),n.selectNodeContents(a),n.collapse(!1),t.selection.removeAllRanges(),t.selection.addRange(n)}catch(e){console.error(`Error creating unordered list:`,e)}})},o={clear:vf(`Clear Formatting`,e=>{let t=mf(e);if(!t)return;let{range:n,selection:r}=t;try{function t(e){return e.replace(/[\u200B-\u200D\uFEFF]/g,``).replace(/\s+/g,` `).replace(/[\u00A0]/g,` `).trim()}function i(n){if(n.nodeType===Node.TEXT_NODE){let r=t(n.textContent||``);return e.doc.createTextNode(r)}if(n.nodeType===Node.ELEMENT_NODE){let r=n,a=r.tagName.toLowerCase(),o=`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`.split(`.`),s=[`strong`,`em`,`span`,`font`,`strike`,`sub`,`sup`,`mark`,`del`,`ins`,`small`,`big`];if(s.includes(a)){let n=t(r.textContent||``);return e.doc.createTextNode(n)}else if(o.includes(a)){let t=e.doc.createElement(a);return a===`a`&&r.hasAttribute(`href`)?(t.setAttribute(`href`,r.getAttribute(`href`)||``),r.hasAttribute(`target`)&&t.setAttribute(`target`,r.getAttribute(`target`)||``),r.hasAttribute(`rel`)&&t.setAttribute(`rel`,r.getAttribute(`rel`)||``)):a===`img`?(r.hasAttribute(`src`)&&t.setAttribute(`src`,r.getAttribute(`src`)||``),r.hasAttribute(`alt`)&&t.setAttribute(`alt`,r.getAttribute(`alt`)||``),r.hasAttribute(`width`)&&t.setAttribute(`width`,r.getAttribute(`width`)||``),r.hasAttribute(`height`)&&t.setAttribute(`height`,r.getAttribute(`height`)||``)):a===`iframe`?(r.hasAttribute(`src`)&&t.setAttribute(`src`,r.getAttribute(`src`)||``),r.hasAttribute(`width`)&&t.setAttribute(`width`,r.getAttribute(`width`)||``),r.hasAttribute(`height`)&&t.setAttribute(`height`,r.getAttribute(`height`)||``),r.hasAttribute(`frameborder`)&&t.setAttribute(`frameborder`,r.getAttribute(`frameborder`)||``),r.hasAttribute(`allowfullscreen`)&&t.setAttribute(`allowfullscreen`,r.getAttribute(`allowfullscreen`)||``)):(a===`video`||a===`audio`)&&(r.hasAttribute(`src`)&&t.setAttribute(`src`,r.getAttribute(`src`)||``),r.hasAttribute(`controls`)&&t.setAttribute(`controls`,r.getAttribute(`controls`)||``),r.hasAttribute(`width`)&&t.setAttribute(`width`,r.getAttribute(`width`)||``),r.hasAttribute(`height`)&&t.setAttribute(`height`,r.getAttribute(`height`)||``)),Array.from(r.childNodes).forEach(e=>{var n;let r=i(e);((n=r.textContent)?.trim()||r.nodeType===Node.ELEMENT_NODE)&&t.appendChild(r)}),t}}return e.doc.createTextNode(``)}if(n.collapsed){let t=e.doc.body,n=e.doc.createDocumentFragment();if(Array.from(t.childNodes).forEach(e=>{var t;let r=i(e);((t=r.textContent)?.trim()||r.nodeType===Node.ELEMENT_NODE)&&n.appendChild(r)}),t.innerHTML=``,t.appendChild(n),!t.firstElementChild){let n=e.doc.createElement(`p`);t.appendChild(n);let i=e.doc.createRange();i.selectNodeContents(n),i.collapse(!0),r.removeAllRanges(),r.addRange(i)}}else{let t=n.cloneContents(),a=e.doc.createElement(`div`);a.appendChild(t);let o=e.doc.createDocumentFragment();Array.from(a.childNodes).forEach(e=>{var t;let n=i(e);((t=n.textContent)?.trim()||n.nodeType===Node.ELEMENT_NODE)&&o.appendChild(n)}),n.deleteContents(),n.insertNode(o),n.collapse(!1),r.removeAllRanges(),r.addRange(n)}}catch(e){console.error(`Error clearing formatting:`,e)}})},s={insertTable:vf(`Insert Table`,(e,t)=>{if(console.log(`insertTable command called with value:`,t),e.openTableEditor&&!t){console.log(`Opening table editor modal for new table`),e.openTableEditor(null);return}if(!t){let[t,n]=[3,3];rf(t,n,e);return}if(t.includes(`<table`)){console.log(`Inserting HTML table`);let n=mf(e);if(!n||!e.doc){console.error(`No selection info or document`);return}let{range:r}=n;try{let n=e.doc.createElement(`div`);n.innerHTML=t;let i=n.querySelector(`table`);if(i){console.log(`Table parsed successfully, inserting...`);let t=i.cloneNode(!0);r.insertNode(t),r.setStartAfter(t),r.collapse(!0);let n=e.doc.getSelection();n&&(n.removeAllRanges(),n.addRange(r)),console.log(`Table inserted successfully`)}else console.error(`Could not parse table from HTML`)}catch(e){console.error(`Error inserting HTML table:`,e)}}else{let[n,r]=t.split(`x`).map(Number)||[3,3];rf(n,r,e)}}),deleteTable:vf(`Delete Table`,e=>e.range&&uf(e.range)),mergeCells:vf(`Merge Cells`,e=>e.range&&e.doc&&af(e.range,e.doc)),splitCells:vf(`Split Cells`,e=>e.range&&e.doc&&sf(e.range,e.doc)),addRowBefore:vf(`Add Row Before`,e=>e.range&&e.doc&&cf(`before`,e.range,e.doc)),addRowAfter:vf(`Add Row After`,e=>e.range&&e.doc&&cf(`after`,e.range,e.doc)),deleteRow:vf(`Delete Row`,e=>e.range&&lf(e.range)),insertColumnLeft:vf(`Insert Column Left`,e=>e.range&&df(`before`,e.range)),insertColumnRight:vf(`Insert Column Right`,e=>e.range&&df(`after`,e.range)),deleteColumn:vf(`Delete Column`,e=>e.range&&ff(e.range))},c=[`Left`,`Center`,`Right`,`Justify`].reduce((e,t)=>({...e,[`tableAlign${t}`]:vf(`Table Align ${t}`,e=>{if(e.range){let n=t===`Left`?`start`:t===`Right`?`end`:t.toLowerCase();return pf(e.range,n)}})}),{}),l={alignLeft:vf(`Align Left`,e=>{var t;let n=mf(e);if(!n)return;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);i&&(i.style.textAlign=`left`)},e=>{var t;let n=mf(e);if(!n)return!1;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);return i?.style.textAlign===`left`}),alignCenter:vf(`Align Center`,e=>{var t;let n=mf(e);if(!n)return;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);i&&(i.style.textAlign=`center`)},e=>{var t;let n=mf(e);if(!n)return!1;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);return i?.style.textAlign===`center`}),alignRight:vf(`Align Right`,e=>{var t;let n=mf(e);if(!n)return;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);i&&(i.style.textAlign=`right`)},e=>{var t;let n=mf(e);if(!n)return!1;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);return i?.style.textAlign===`right`}),alignJustify:vf(`Align Justify`,e=>{var t;let n=mf(e);if(!n)return;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);i&&(i.style.textAlign=`justify`)},e=>{var t;let n=mf(e);if(!n)return!1;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);return i?.style.textAlign===`justify`}),textDirection:vf(`Toggle Text Direction`,e=>{var t;let n=mf(e);if(!n)return;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);if(i){let e=i.dir||`ltr`;i.dir=e===`ltr`?`rtl`:`ltr`}},e=>{var t;let n=mf(e);if(!n)return!1;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);return i?.dir===`rtl`}),ltrDirection:vf(`Set Left to Right Direction`,e=>{var t;let n=mf(e);if(!n)return;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);i&&(i.dir=`ltr`)},e=>{var t;let n=mf(e);if(!n)return!1;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);return i?.dir===`ltr`}),rtlDirection:vf(`Set Right to Left Direction`,e=>{var t;let n=mf(e);if(!n)return;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);i&&(i.dir=`rtl`)},e=>{var t;let n=mf(e);if(!n)return!1;let{range:r}=n,i=r.startContainer.nodeType===Node.TEXT_NODE?(t=r.startContainer.parentElement)?.closest(`p, h1, h2, h3, h4, h5, h6`):r.startContainer.closest(`p, h1, h2, h3, h4, h5, h6`);return i?.dir===`rtl`})},u={fullScreen:vf(`Full Screen`,e=>{e.isFullscreen=!e.isFullscreen},e=>e.isFullscreen),splitView:vf(`Split View`,e=>{e.isSplitView=!e.isSplitView},e=>e.isSplitView),codeView:vf(`Code View`,e=>{e.isCodeView=!e.isCodeView},e=>e.isCodeView)},d={image:vf(`Insert Image`,e=>{let t=e.openImageModal;t?t():console.warn(`Image insertion requires modal implementation`)}),video:vf(`Insert Video`,e=>{let t=e.openVideoModal;t?t():console.warn(`Video insertion requires modal implementation`)}),embed:vf(`Insert Embed`,e=>{let t=e.openEmbedModal;t?t():console.warn(`Embed insertion requires modal implementation`)})};return{...t,...n,...r,...i,...a,...o,...s,...c,...l,...u,...d}}function bf(e,t){return{execute(n,r){let i=t[n];i&&i.execute(e,r)},isActive(n){var r;let i=t[n];return(r=i.isActive)?.call(i,e)||!1},getValue(n){var r;let i=t[n];return(r=i.getValue)?.call(i,e)||null}}}function xf(e,t){let n=t.getSelection();if(!n||!n.rangeCount)return!1;let r=n.getRangeAt(0),i=r.commonAncestorContainer,a=i.nodeType===Node.TEXT_NODE?i.parentElement:i;if(!a)return!1;let o=(e,t)=>e?t(e)?!0:o(e.parentElement,t):!1,s={bold:e=>{var t;let n=(t=e.tagName)?.toLowerCase();return n===`strong`||n===`b`},italic:e=>{var t;let n=(t=e.tagName)?.toLowerCase();return n===`em`||n===`i`},underline:e=>{var t;let n=(t=e.tagName)?.toLowerCase();return n===`u`},h1:e=>{var t;return(t=e.tagName)?.toLowerCase()===`h1`},h2:e=>{var t;return(t=e.tagName)?.toLowerCase()===`h2`},h3:e=>{var t;return(t=e.tagName)?.toLowerCase()===`h3`},h4:e=>{var t;return(t=e.tagName)?.toLowerCase()===`h4`},h5:e=>{var t;return(t=e.tagName)?.toLowerCase()===`h5`},h6:e=>{var t;return(t=e.tagName)?.toLowerCase()===`h6`},p:e=>{var t;return(t=e.tagName)?.toLowerCase()===`p`},blockquote:e=>{var t;return(t=e.tagName)?.toLowerCase()===`blockquote`},orderedList:e=>!!e.closest(`ol`),unorderedList:e=>!!e.closest(`ul`),alignLeft:e=>{let t=e.closest(`p, h1, h2, h3, h4, h5, h6`);return t?.style.textAlign===`start`},alignCenter:e=>{let t=e.closest(`p, h1, h2, h3, h4, h5, h6`);return t?.style.textAlign===`center`},alignRight:e=>{let t=e.closest(`p, h1, h2, h3, h4, h5, h6`);return t?.style.textAlign===`end`},alignJustify:e=>{let t=e.closest(`p, h1, h2, h3, h4, h5, h6`);return t?.style.textAlign===`justify`},textDirection:e=>{let t=e.closest(`p, h1, h2, h3, h4, h5, h6`);return t?.dir===`rtl`},ltrDirection:e=>{let t=e.closest(`p, h1, h2, h3, h4, h5, h6`);return t?.dir===`ltr`},rtlDirection:e=>{let t=e.closest(`p, h1, h2, h3, h4, h5, h6`);return t?.dir===`rtl`}};if([`splitView`,`codeView`,`fullScreen`].includes(e))return!1;let c=s[e];return c?o(a,c):o(a,t=>{var n;return(n=t.tagName)?.toLowerCase()===e.toLowerCase()})}function Sf(e,t){let n=yf(e),r=bf(e,n),i=()=>{if(!e.doc)return;let t=new Set,n=[`bold`,`italic`,`underline`,`link`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`blockquote`,`p`,`orderedList`,`unorderedList`,`alignLeft`,`alignCenter`,`alignRight`,`alignJustify`,`textDirection`,`ltrDirection`,`rtlDirection`];n.forEach(n=>{xf(n,e.doc)&&t.add(n)}),e.selectedStyles=t};return{execute:(n,a)=>{if(!e.doc){console.log(`[useCommands] No document available, skipping command`);return}if(t?.logCommand(n,a),[`splitView`,`codeView`,`fullScreen`].includes(n))switch(n){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(e){console.error(`[useCommands] Error focusing editor:`,e)}let o=e.doc.getSelection();o?.rangeCount&&(e.selection=o,e.range=o.getRangeAt(0).cloneRange(),e.rangeCount=o.rangeCount);try{r.execute(n,a);let e=[`splitView`,`codeView`,`fullScreen`];e.includes(n)||i()}catch(e){console.error(`[useCommands] Error during command execution:`,e)}},isActive:r.isActive,getValue:r.getValue}}var Cf=class{constructor(t=1e3){e.defineProperty(this,`session`,void 0),e.defineProperty(this,`maxActions`,void 0),e.defineProperty(this,`isDevelopment`,void 0),this.maxActions=t,this.session=this.createNewSession(),this.isDevelopment=!1}createNewSession(){return{id:`session_${Date.now()}`,startTime:Date.now(),actions:[]}}getNodeDescription(e){var t;if(e.nodeType===Node.TEXT_NODE)return`Text("${(t=e.textContent)?.slice(0,20)}${e.textContent&&e.textContent.length>20?`...`:``}")`;let n=e;return`${n.tagName.toLowerCase()}${n.id?`#${n.id}`:``}`}captureState(e){if(!e.doc||!e.selection)return{content:``,selection:null,activeStyles:[],caretPosition:null};let{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&&console.log(`Editor Action:`,e)}getSession(){return this.session}clearSession(){this.session=this.createNewSession()}exportSession(){return JSON.stringify(this.session,null,2)}downloadSession(){let 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){let t={message:e||`here is a debug log, can you analyze and fix accordingly?`,session:this.session};return JSON.stringify(t,null,2)}};function wf(e){let t=document.createElement(`div`);t.innerHTML=e;let n=[],r=[];return t.querySelectorAll(`iframe`).forEach((e,t)=>{let i=`<!--iframe-${t}-->`;n.push(e.cloneNode(!0)),r.push(i),e.replaceWith(i)}),{html:t.innerHTML,iframes:n}}function Tf(e,t,n){let r=/<!--iframe-(\d+)-->/g;e.body.innerHTML=t.replace(r,(e,t)=>{let r=n[Number(t)];return r?r.outerHTML:``})}function Ef(){let e=null,t=te({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;let e=new Set,n=[`bold`,`italic`,`underline`,`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`blockquote`,`p`,`orderedList`,`unorderedList`,`alignLeft`,`alignCenter`,`alignRight`,`alignJustify`,`textDirection`,`ltrDirection`,`rtlDirection`];n.forEach(n=>{t.doc&&xf(n,t.doc)&&e.add(n)}),t.selectedStyles=e},content:e=>{if(!t.doc)return;let n=t.doc.body.innerHTML;n!==t.content&&(t.undoStack.push(t.content),t.redoStack=[]);let r=t.doc.getSelection(),i=r?.rangeCount?r.getRangeAt(0).cloneRange():null;if(e===`html`){let e=wf(t.content);t.doc.body.innerHTML=e.html,setTimeout(()=>{if(t.doc&&(Tf(t.doc,t.content,e.iframes),i&&r))try{r.removeAllRanges(),r.addRange(i)}catch{}},0)}else t.doc.body.textContent=t.content},selection:()=>{if(!t.doc)return;let e=t.doc.getSelection();if(e)try{if(!t.doc.body.contains(e.anchorNode)){t.doc.body.focus();return}let r=!t.selection||t.selection!==e||t.rangeCount!==e.rangeCount||e.rangeCount>0&&t.range&&(t.range.startContainer!==e.getRangeAt(0).startContainer||t.range.startOffset!==e.getRangeAt(0).startOffset||t.range.endContainer!==e.getRangeAt(0).endContainer||t.range.endOffset!==e.getRangeAt(0).endOffset);r&&(t.selection=e,t.rangeCount=e.rangeCount,e.rangeCount>0&&(t.range=e.getRangeAt(0).cloneRange()),n.styles())}catch{t.selection=null,t.range=null,t.rangeCount=0,t.selectedStyles=new Set}}},r={undo:()=>{if(t.undoStack.length===0)return;t.redoStack.push(t.content);let e=t.undoStack.pop();e!==void 0&&(t.content=e,n.content(`html`))},redo:()=>{if(t.redoStack.length===0)return;t.undoStack.push(t.content);let e=t.redoStack.pop();e!==void 0&&(t.content=e,n.content(`html`))}},i={emptyTags:e=>{let t=e.createTreeWalker(e.body,NodeFilter.SHOW_ELEMENT,null),n=[],r=t.nextNode();for(;r;){var i;if([`br`,`img`,`hr`,`input`].includes(r.tagName.toLowerCase())){r=t.nextNode();continue}let a=(i=r.textContent)?.trim()||``,o=r.innerHTML.trim(),s=o===`<br>`||o===`<br/>`,c=o===`&nbsp;`||a===`\xA0`,l=!a&&!o,u=r.parentElement===e.body;(l||c||s&&!u)&&n.push(r),r=t.nextNode()}n.forEach(e=>{e.remove()})},normalizeContent:e=>{var t;let n=e.createTreeWalker(e.body,NodeFilter.SHOW_TEXT),r=[],i;for(;i=n.nextNode();)i.parentElement===e.body&&(t=i.textContent)?.trim()&&r.push(i);r.forEach(t=>{let n=e.createElement(`p`);n.dir=e.body.dir,n.appendChild(t.cloneNode()),e.body.replaceChild(n,t)})}};function a(r){e&&(e(),e=null);let i=!1,a={input:()=>{if(i)return;i=!0;let e=r.body.innerHTML;e!==t.content&&(t.content=e),i=!1},selectionchange:()=>{i||n.selection()},mouseup:()=>{i||n.selection()},keyup:e=>{i||[`ArrowUp`,`ArrowDown`,`ArrowLeft`,`ArrowRight`].includes(e.key)&&n.selection()}};return Object.entries(a).forEach(([e,t])=>{r.addEventListener(e,t)}),e=()=>{Object.entries(a).forEach(([e,t])=>{r.removeEventListener(e,t)})},e}function o(n){if(t.hasInit&&e&&(e(),e=null),t.doc=n,t.hasInit=!0,n.editorState=t,t.content&&t.content.trim()&&!t.content.match(/^<p(?:\s[^>]*)?>(?:<br\s*\/?>)?\s*<\/p>$/i)){let e=wf(t.content);n.body.innerHTML=e.html,setTimeout(()=>{t.doc&&Tf(n,t.content,e.iframes)},0)}if(i.normalizeContent(n),n.body.firstElementChild){let e=n.createRange(),r=n.getSelection();r&&(e.selectNodeContents(n.body),e.collapse(!1),r.removeAllRanges(),r.addRange(e),t.range=e.cloneRange(),t.selection=r,t.rangeCount=r.rangeCount)}else{let e=n.getSelection();if(e){let r=n.createRange();r.setStart(n.body,0),r.setEnd(n.body,0),e.removeAllRanges(),e.addRange(r),t.range=r.cloneRange(),t.selection=e,t.rangeCount=e.rangeCount}}e=a(n)}function s(){if(!t.debug){let e=new Cf,n={debugger:e,logCommand:(n,r)=>{e.logCommand(n,r,t)},getSession:()=>e.getSession(),clearSession:()=>{e.clearSession()},downloadSession:()=>{e.downloadSession()},exportDebugWithPrompt:t=>e.exportSessionWithPrompt(t)};t.debug=n}}return typeof window<`u`&&window.addEventListener(`beforeunload`,()=>{e&&e()}),{state:t,init:o,updateState:n,history:r,initDebugger:s,cleanup:()=>{e&&(e(),e=null)}}}const Df=[{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 Of(e,t){e.addEventListener(`keydown`,e=>{if(!e.ctrlKey&&!e.metaKey)return;let n=Df.find(t=>{let n=t.key===e.key,r=!t.modifiers||(!t.modifiers.ctrl||e.ctrlKey||e.metaKey)&&(!t.modifiers.alt||e.altKey)&&(!t.modifiers.shift||e.shiftKey);return n&&r});n&&(e.preventDefault(),t.execute(n.command))})}const kf={key:0},Af={key:1,class:`flex pt-05`},jf={class:`inline-toolbar-content`},Mf={class:`menu-header`},Nf={class:`px-025`},Pf={key:3,class:`context-menu-separator`},Ff={class:`flex gap-05 align-items-end`},If={class:`flex gap-1`},Lf={class:`flex gap-05 w-100`},Rf={class:`flex gap-1`},zf={class:`flex gap-05 w-100`},Bf={class:`grid gap-0`},Vf={key:0,class:`flex gap-025 opacity-5 -mt-05`},Hf={key:1,class:`grid grid-wrap-2 gap-05`},Uf={class:`grid grid-wrap-2 gap-05 py-1`},Wf={class:`overflow-hidden flex justify-content-center`},Gf={class:`flex gap-05 w-100`},Kf={class:`grid grid-wrap-4 m_grid-wrap-2 gap-col-1 table-editor testMe1`},qf={class:`grid-span-1`},Jf={class:`flex gap-025 mt-025 radius-1 p-05 w-fit`,style:{height:`var(--input-height)`,background:`var(--input-bg)`}},Yf={class:`grid-span-1`},Xf={class:`flex gap-025 mt-025 radius-1 p-025 w-fit`,style:{height:`var(--input-height)`,background:`var(--input-bg)`}},Zf={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`},Qf={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`},$f=[`innerHTML`];var ep=h({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:{}},emits:[`update:modelValue`],setup(e,{expose:t,emit:r}){let i=e,a=r,s=ae(),f=R(),h=Ef(),g=R(!1),_=R(!1),v=Sf(h.state,h.state.debug),y=o(()=>!(i.hideToolbar||i.basic)),b=o(()=>!i.hideInlineToolbar),x=o(()=>i.toolbarConfig),S=o(()=>{let e=[...i.hide||[]];if(i.simple){let t=[`h1`,`h2`,`h3`,`h4`,`h5`,`h6`,`image`,`video`,`embed`,`ul`,`ol`,`blockquote`,`direction`,`table`,`alignment`];t.forEach(t=>{e.includes(t)||e.push(t)})}return e}),C=R(!1),w=R({url:``,openInNewTab:!0}),E=R(!1),O=R({message:``,x:0,y:0}),j=null,ee=R(!1),N=R({src:``,alt:``,width:``,height:``,credit:``,figcaption:!1}),F=null,I=R(!1),L=R({src:``,width:`560`,height:`315`,alt:``}),te=null,z=R(!1),B=R({top:0,left:0}),ne=R(null),re=R(!1),V=R({src:``,width:``,autoplay:!1,mute:!1,controls:!0,loop:!1,aspectRatio:`16:9`,customWidth:``,customHeight:``,caption:``,showCaption:!1}),H=null,ie=R(!1),W=R({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`}),oe=R(!1),se=R({x:0,y:0}),K=R(null),ce=null,le=o(()=>{let e=W.value,t=`
18
18
  width: ${e.width}%;
19
19
  border-collapse: collapse;
20
20
  margin-bottom: 1rem;