@kvass/widgets 1.8.32 → 1.8.33
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.es2.js +1 -1
- package/dist/kvass-form.js +3 -3
- package/package.json +2 -2
package/dist/index.es2.js
CHANGED
|
@@ -5,7 +5,7 @@ import{G as ka,q as Q,r as X,e as $,o as E,X as qt,E as Ee,b as I,c as O,i as qn
|
|
|
5
5
|
* @author RubaXa <trash@rubaxa.org>
|
|
6
6
|
* @author owenm <owen23355@gmail.com>
|
|
7
7
|
* @license MIT
|
|
8
|
-
*/function Of(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function wn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Of(Object(n),!0).forEach(function(r){FT(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Of(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ta(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ta=function(e){return typeof e}:Ta=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ta(t)}function FT(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function jn(){return jn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},jn.apply(this,arguments)}function LT(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function VT(t,e){if(t==null)return{};var n=LT(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}var BT="1.14.0";function Vn(t){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(t)}var Un=Vn(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ms=Vn(/Edge/i),Af=Vn(/firefox/i),Vo=Vn(/safari/i)&&!Vn(/chrome/i)&&!Vn(/android/i),vy=Vn(/iP(ad|od|hone)/i),$T=Vn(/chrome/i)&&Vn(/android/i),yy={capture:!1,passive:!1};function ve(t,e,n){t.addEventListener(e,n,!Un&&yy)}function me(t,e,n){t.removeEventListener(e,n,!Un&&yy)}function Ya(t,e){if(e){if(e[0]===">"&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch{return!1}return!1}}function jT(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function hn(t,e,n,r){if(t){n=n||document;do{if(e!=null&&(e[0]===">"?t.parentNode===n&&Ya(t,e):Ya(t,e))||r&&t===n)return t;if(t===n)break}while(t=jT(t))}return null}var Mf=/\s+/g;function Et(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var r=(" "+t.className+" ").replace(Mf," ").replace(" "+e+" "," ");t.className=(r+(n?" "+e:"")).replace(Mf," ")}}function ee(t,e,n){var r=t&&t.style;if(r){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),e===void 0?n:n[e];!(e in r)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),r[e]=n+(typeof n=="string"?"":"px")}}function Vi(t,e){var n="";if(typeof t=="string")n=t;else do{var r=ee(t,"transform");r&&r!=="none"&&(n=r+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function by(t,e,n){if(t){var r=t.getElementsByTagName(e),i=0,o=r.length;if(n)for(;i<o;i++)n(r[i],i);return r}return[]}function yn(){var t=document.scrollingElement;return t||document.documentElement}function Be(t,e,n,r,i){if(!(!t.getBoundingClientRect&&t!==window)){var o,s,a,l,u,c,d;if(t!==window&&t.parentNode&&t!==yn()?(o=t.getBoundingClientRect(),s=o.top,a=o.left,l=o.bottom,u=o.right,c=o.height,d=o.width):(s=0,a=0,l=window.innerHeight,u=window.innerWidth,c=window.innerHeight,d=window.innerWidth),(e||n)&&t!==window&&(i=i||t.parentNode,!Un))do if(i&&i.getBoundingClientRect&&(ee(i,"transform")!=="none"||n&&ee(i,"position")!=="static")){var h=i.getBoundingClientRect();s-=h.top+parseInt(ee(i,"border-top-width")),a-=h.left+parseInt(ee(i,"border-left-width")),l=s+o.height,u=a+o.width;break}while(i=i.parentNode);if(r&&t!==window){var p=Vi(i||t),f=p&&p.a,m=p&&p.d;p&&(s/=m,a/=f,d/=f,c/=m,l=s+c,u=a+d)}return{top:s,left:a,bottom:l,right:u,width:d,height:c}}}function _f(t,e,n){for(var r=sr(t,!0),i=Be(t)[e];r;){var o=Be(r)[n],s=void 0;if(s=i>=o,!s)return r;if(r===yn())break;r=sr(r,!1)}return!1}function Ki(t,e,n,r){for(var i=0,o=0,s=t.children;o<s.length;){if(s[o].style.display!=="none"&&s[o]!==te.ghost&&(r||s[o]!==te.dragged)&&hn(s[o],n.draggable,t,!1)){if(i===e)return s[o];i++}o++}return null}function Rp(t,e){for(var n=t.lastElementChild;n&&(n===te.ghost||ee(n,"display")==="none"||e&&!Ya(n,e));)n=n.previousElementSibling;return n||null}function Lt(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)t.nodeName.toUpperCase()!=="TEMPLATE"&&t!==te.clone&&(!e||Ya(t,e))&&n++;return n}function Df(t){var e=0,n=0,r=yn();if(t)do{var i=Vi(t),o=i.a,s=i.d;e+=t.scrollLeft*o,n+=t.scrollTop*s}while(t!==r&&(t=t.parentNode));return[e,n]}function zT(t,e){for(var n in t)if(t.hasOwnProperty(n)){for(var r in e)if(e.hasOwnProperty(r)&&e[r]===t[n][r])return Number(n)}return-1}function sr(t,e){if(!t||!t.getBoundingClientRect)return yn();var n=t,r=!1;do if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=ee(n);if(n.clientWidth<n.scrollWidth&&(i.overflowX=="auto"||i.overflowX=="scroll")||n.clientHeight<n.scrollHeight&&(i.overflowY=="auto"||i.overflowY=="scroll")){if(!n.getBoundingClientRect||n===document.body)return yn();if(r||e)return n;r=!0}}while(n=n.parentNode);return yn()}function HT(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function Ku(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}var Bo;function ky(t,e){return function(){if(!Bo){var n=arguments,r=this;n.length===1?t.call(r,n[0]):t.apply(r,n),Bo=setTimeout(function(){Bo=void 0},e)}}}function qT(){clearTimeout(Bo),Bo=void 0}function wy(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function xy(t){var e=window.Polymer,n=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):n?n(t).clone(!0)[0]:t.cloneNode(!0)}var Tt="Sortable"+new Date().getTime();function WT(){var t=[],e;return{captureAnimationState:function(){if(t=[],!!this.options.animation){var n=[].slice.call(this.el.children);n.forEach(function(r){if(!(ee(r,"display")==="none"||r===te.ghost)){t.push({target:r,rect:Be(r)});var i=wn({},t[t.length-1].rect);if(r.thisAnimationDuration){var o=Vi(r,!0);o&&(i.top-=o.f,i.left-=o.e)}r.fromRect=i}})}},addAnimationState:function(n){t.push(n)},removeAnimationState:function(n){t.splice(zT(t,{target:n}),1)},animateAll:function(n){var r=this;if(!this.options.animation){clearTimeout(e),typeof n=="function"&&n();return}var i=!1,o=0;t.forEach(function(s){var a=0,l=s.target,u=l.fromRect,c=Be(l),d=l.prevFromRect,h=l.prevToRect,p=s.rect,f=Vi(l,!0);f&&(c.top-=f.f,c.left-=f.e),l.toRect=c,l.thisAnimationDuration&&Ku(d,c)&&!Ku(u,c)&&(p.top-c.top)/(p.left-c.left)===(u.top-c.top)/(u.left-c.left)&&(a=KT(p,d,h,r.options)),Ku(c,u)||(l.prevFromRect=u,l.prevToRect=c,a||(a=r.options.animation),r.animate(l,p,c,a)),a&&(i=!0,o=Math.max(o,a),clearTimeout(l.animationResetTimer),l.animationResetTimer=setTimeout(function(){l.animationTime=0,l.prevFromRect=null,l.fromRect=null,l.prevToRect=null,l.thisAnimationDuration=null},a),l.thisAnimationDuration=a)}),clearTimeout(e),i?e=setTimeout(function(){typeof n=="function"&&n()},o):typeof n=="function"&&n(),t=[]},animate:function(n,r,i,o){if(o){ee(n,"transition",""),ee(n,"transform","");var s=Vi(this.el),a=s&&s.a,l=s&&s.d,u=(r.left-i.left)/(a||1),c=(r.top-i.top)/(l||1);n.animatingX=!!u,n.animatingY=!!c,ee(n,"transform","translate3d("+u+"px,"+c+"px,0)"),this.forRepaintDummy=UT(n),ee(n,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),ee(n,"transform","translate3d(0,0,0)"),typeof n.animated=="number"&&clearTimeout(n.animated),n.animated=setTimeout(function(){ee(n,"transition",""),ee(n,"transform",""),n.animated=!1,n.animatingX=!1,n.animatingY=!1},o)}}}}function UT(t){return t.offsetWidth}function KT(t,e,n,r){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-n.top,2)+Math.pow(e.left-n.left,2))*r.animation}var xi=[],Gu={initializeByDefault:!0},_s={mount:function(t){for(var e in Gu)Gu.hasOwnProperty(e)&&!(e in t)&&(t[e]=Gu[e]);xi.forEach(function(n){if(n.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}),xi.push(t)},pluginEvent:function(t,e,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var i=t+"Global";xi.forEach(function(o){e[o.pluginName]&&(e[o.pluginName][i]&&e[o.pluginName][i](wn({sortable:e},n)),e.options[o.pluginName]&&e[o.pluginName][t]&&e[o.pluginName][t](wn({sortable:e},n)))})},initializePlugins:function(t,e,n,r){xi.forEach(function(s){var a=s.pluginName;if(!(!t.options[a]&&!s.initializeByDefault)){var l=new s(t,e,t.options);l.sortable=t,l.options=t.options,t[a]=l,jn(n,l.defaults)}});for(var i in t.options)if(t.options.hasOwnProperty(i)){var o=this.modifyOption(t,i,t.options[i]);typeof o<"u"&&(t.options[i]=o)}},getEventProperties:function(t,e){var n={};return xi.forEach(function(r){typeof r.eventProperties=="function"&&jn(n,r.eventProperties.call(e[r.pluginName],t))}),n},modifyOption:function(t,e,n){var r;return xi.forEach(function(i){t[i.pluginName]&&i.optionListeners&&typeof i.optionListeners[e]=="function"&&(r=i.optionListeners[e].call(t[i.pluginName],n))}),r}};function GT(t){var e=t.sortable,n=t.rootEl,r=t.name,i=t.targetEl,o=t.cloneEl,s=t.toEl,a=t.fromEl,l=t.oldIndex,u=t.newIndex,c=t.oldDraggableIndex,d=t.newDraggableIndex,h=t.originalEvent,p=t.putSortable,f=t.extraEventProperties;if(e=e||n&&n[Tt],!!e){var m,g=e.options,y="on"+r.charAt(0).toUpperCase()+r.substr(1);window.CustomEvent&&!Un&&!Ms?m=new CustomEvent(r,{bubbles:!0,cancelable:!0}):(m=document.createEvent("Event"),m.initEvent(r,!0,!0)),m.to=s||n,m.from=a||n,m.item=i||n,m.clone=o,m.oldIndex=l,m.newIndex=u,m.oldDraggableIndex=c,m.newDraggableIndex=d,m.originalEvent=h,m.pullMode=p?p.lastPutMode:void 0;var b=wn(wn({},f),_s.getEventProperties(r,e));for(var k in b)m[k]=b[k];n&&n.dispatchEvent(m),g[y]&&g[y].call(e,m)}}var JT=["evt"],gt=function(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.evt,i=VT(n,JT);_s.pluginEvent.bind(te)(t,e,wn({dragEl:P,parentEl:Ae,ghostEl:ae,rootEl:xe,nextEl:$r,lastDownEl:Oa,cloneEl:Me,cloneHidden:rr,dragStarted:Ao,putSortable:Ge,activeSortable:te.active,originalEvent:r,oldIndex:Ii,oldDraggableIndex:$o,newIndex:Ct,newDraggableIndex:Qn,hideGhostForTarget:Ty,unhideGhostForTarget:Oy,cloneNowHidden:function(){rr=!0},cloneNowShown:function(){rr=!1},dispatchSortableEvent:function(o){ut({sortable:e,name:o,originalEvent:r})}},i))};function ut(t){GT(wn({putSortable:Ge,cloneEl:Me,targetEl:P,rootEl:xe,oldIndex:Ii,oldDraggableIndex:$o,newIndex:Ct,newDraggableIndex:Qn},t))}var P,Ae,ae,xe,$r,Oa,Me,rr,Ii,Ct,$o,Qn,ra,Ge,Ti=!1,Za=!1,Qa=[],Pr,Gt,Ju,Xu,Nf,If,Ao,Ei,jo,zo=!1,ia=!1,Aa,tt,Yu=[],ld=!1,el=[],gu=typeof document<"u",oa=vy,Rf=Ms||Un?"cssFloat":"float",XT=gu&&!$T&&!vy&&"draggable"in document.createElement("div"),Ey=function(){if(gu){if(Un)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),Cy=function(t,e){var n=ee(t),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=Ki(t,0,e),o=Ki(t,1,e),s=i&&ee(i),a=o&&ee(o),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Be(i).width,u=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Be(o).width;if(n.display==="flex")return n.flexDirection==="column"||n.flexDirection==="column-reverse"?"vertical":"horizontal";if(n.display==="grid")return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&s.float&&s.float!=="none"){var c=s.float==="left"?"left":"right";return o&&(a.clear==="both"||a.clear===c)?"vertical":"horizontal"}return i&&(s.display==="block"||s.display==="flex"||s.display==="table"||s.display==="grid"||l>=r&&n[Rf]==="none"||o&&n[Rf]==="none"&&l+u>r)?"vertical":"horizontal"},YT=function(t,e,n){var r=n?t.left:t.top,i=n?t.right:t.bottom,o=n?t.width:t.height,s=n?e.left:e.top,a=n?e.right:e.bottom,l=n?e.width:e.height;return r===s||i===a||r+o/2===s+l/2},ZT=function(t,e){var n;return Qa.some(function(r){var i=r[Tt].options.emptyInsertThreshold;if(!(!i||Rp(r))){var o=Be(r),s=t>=o.left-i&&t<=o.right+i,a=e>=o.top-i&&e<=o.bottom+i;if(s&&a)return n=r}}),n},Sy=function(t){function e(i,o){return function(s,a,l,u){var c=s.options.group.name&&a.options.group.name&&s.options.group.name===a.options.group.name;if(i==null&&(o||c))return!0;if(i==null||i===!1)return!1;if(o&&i==="clone")return i;if(typeof i=="function")return e(i(s,a,l,u),o)(s,a,l,u);var d=(o?s:a).options.group.name;return i===!0||typeof i=="string"&&i===d||i.join&&i.indexOf(d)>-1}}var n={},r=t.group;(!r||Ta(r)!="object")&&(r={name:r}),n.name=r.name,n.checkPull=e(r.pull,!0),n.checkPut=e(r.put),n.revertClone=r.revertClone,t.group=n},Ty=function(){!Ey&&ae&&ee(ae,"display","none")},Oy=function(){!Ey&&ae&&ee(ae,"display","")};gu&&document.addEventListener("click",function(t){if(Za)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Za=!1,!1},!0);var Fr=function(t){if(P){t=t.touches?t.touches[0]:t;var e=ZT(t.clientX,t.clientY);if(e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[Tt]._onDragOver(n)}}},QT=function(t){P&&P.parentNode[Tt]._isOutsideThisEl(t.target)};function te(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=jn({},e),t[Tt]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Cy(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(o,s){o.setData("Text",s.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:te.supportPointer!==!1&&"PointerEvent"in window&&!Vo,emptyInsertThreshold:5};_s.initializePlugins(this,t,n);for(var r in n)!(r in e)&&(e[r]=n[r]);Sy(e);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=e.forceFallback?!1:XT,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?ve(t,"pointerdown",this._onTapStart):(ve(t,"mousedown",this._onTapStart),ve(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(ve(t,"dragover",this),ve(t,"dragenter",this)),Qa.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),jn(this,WT())}te.prototype={constructor:te,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(Ei=null)},_getDirection:function(t,e){return typeof this.options.direction=="function"?this.options.direction.call(this,t,e,P):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,r=this.options,i=r.preventOnFilter,o=t.type,s=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,a=(s||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,u=r.filter;if(aO(n),!P&&!(/mousedown|pointerdown/.test(o)&&t.button!==0||r.disabled)&&!l.isContentEditable&&!(!this.nativeDraggable&&Vo&&a&&a.tagName.toUpperCase()==="SELECT")&&(a=hn(a,r.draggable,n,!1),!(a&&a.animated)&&Oa!==a)){if(Ii=Lt(a),$o=Lt(a,r.draggable),typeof u=="function"){if(u.call(this,t,a,this)){ut({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),gt("filter",e,{evt:t}),i&&t.cancelable&&t.preventDefault();return}}else if(u&&(u=u.split(",").some(function(c){if(c=hn(l,c.trim(),n,!1),c)return ut({sortable:e,rootEl:c,name:"filter",targetEl:a,fromEl:n,toEl:n}),gt("filter",e,{evt:t}),!0}),u)){i&&t.cancelable&&t.preventDefault();return}r.handle&&!hn(l,r.handle,n,!1)||this._prepareDragStart(t,s,a)}}},_prepareDragStart:function(t,e,n){var r=this,i=r.el,o=r.options,s=i.ownerDocument,a;if(n&&!P&&n.parentNode===i){var l=Be(n);if(xe=i,P=n,Ae=P.parentNode,$r=P.nextSibling,Oa=n,ra=o.group,te.dragged=P,Pr={target:P,clientX:(e||t).clientX,clientY:(e||t).clientY},Nf=Pr.clientX-l.left,If=Pr.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,P.style["will-change"]="all",a=function(){if(gt("delayEnded",r,{evt:t}),te.eventCanceled){r._onDrop();return}r._disableDelayedDragEvents(),!Af&&r.nativeDraggable&&(P.draggable=!0),r._triggerDragStart(t,e),ut({sortable:r,name:"choose",originalEvent:t}),Et(P,o.chosenClass,!0)},o.ignore.split(",").forEach(function(u){by(P,u.trim(),Zu)}),ve(s,"dragover",Fr),ve(s,"mousemove",Fr),ve(s,"touchmove",Fr),ve(s,"mouseup",r._onDrop),ve(s,"touchend",r._onDrop),ve(s,"touchcancel",r._onDrop),Af&&this.nativeDraggable&&(this.options.touchStartThreshold=4,P.draggable=!0),gt("delayStart",this,{evt:t}),o.delay&&(!o.delayOnTouchOnly||e)&&(!this.nativeDraggable||!(Ms||Un))){if(te.eventCanceled){this._onDrop();return}ve(s,"mouseup",r._disableDelayedDrag),ve(s,"touchend",r._disableDelayedDrag),ve(s,"touchcancel",r._disableDelayedDrag),ve(s,"mousemove",r._delayedDragTouchMoveHandler),ve(s,"touchmove",r._delayedDragTouchMoveHandler),o.supportPointer&&ve(s,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(a,o.delay)}else a()}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){P&&Zu(P),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;me(t,"mouseup",this._disableDelayedDrag),me(t,"touchend",this._disableDelayedDrag),me(t,"touchcancel",this._disableDelayedDrag),me(t,"mousemove",this._delayedDragTouchMoveHandler),me(t,"touchmove",this._delayedDragTouchMoveHandler),me(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||t.pointerType=="touch"&&t,!this.nativeDraggable||e?this.options.supportPointer?ve(document,"pointermove",this._onTouchMove):e?ve(document,"touchmove",this._onTouchMove):ve(document,"mousemove",this._onTouchMove):(ve(P,"dragend",this),ve(xe,"dragstart",this._onDragStart));try{document.selection?Ma(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,e){if(Ti=!1,xe&&P){gt("dragStarted",this,{evt:e}),this.nativeDraggable&&ve(document,"dragover",QT);var n=this.options;!t&&Et(P,n.dragClass,!1),Et(P,n.ghostClass,!0),te.active=this,t&&this._appendGhost(),ut({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Gt){this._lastX=Gt.clientX,this._lastY=Gt.clientY,Ty();for(var t=document.elementFromPoint(Gt.clientX,Gt.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Gt.clientX,Gt.clientY),t!==e);)e=t;if(P.parentNode[Tt]._isOutsideThisEl(t),e)do{if(e[Tt]){var n=void 0;if(n=e[Tt]._onDragOver({clientX:Gt.clientX,clientY:Gt.clientY,target:t,rootEl:e}),n&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);Oy()}},_onTouchMove:function(t){if(Pr){var e=this.options,n=e.fallbackTolerance,r=e.fallbackOffset,i=t.touches?t.touches[0]:t,o=ae&&Vi(ae,!0),s=ae&&o&&o.a,a=ae&&o&&o.d,l=oa&&tt&&Df(tt),u=(i.clientX-Pr.clientX+r.x)/(s||1)+(l?l[0]-Yu[0]:0)/(s||1),c=(i.clientY-Pr.clientY+r.y)/(a||1)+(l?l[1]-Yu[1]:0)/(a||1);if(!te.active&&!Ti){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(ae){o?(o.e+=u-(Ju||0),o.f+=c-(Xu||0)):o={a:1,b:0,c:0,d:1,e:u,f:c};var d="matrix(".concat(o.a,",").concat(o.b,",").concat(o.c,",").concat(o.d,",").concat(o.e,",").concat(o.f,")");ee(ae,"webkitTransform",d),ee(ae,"mozTransform",d),ee(ae,"msTransform",d),ee(ae,"transform",d),Ju=u,Xu=c,Gt=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!ae){var t=this.options.fallbackOnBody?document.body:xe,e=Be(P,!0,oa,!0,t),n=this.options;if(oa){for(tt=t;ee(tt,"position")==="static"&&ee(tt,"transform")==="none"&&tt!==document;)tt=tt.parentNode;tt!==document.body&&tt!==document.documentElement?(tt===document&&(tt=yn()),e.top+=tt.scrollTop,e.left+=tt.scrollLeft):tt=yn(),Yu=Df(tt)}ae=P.cloneNode(!0),Et(ae,n.ghostClass,!1),Et(ae,n.fallbackClass,!0),Et(ae,n.dragClass,!0),ee(ae,"transition",""),ee(ae,"transform",""),ee(ae,"box-sizing","border-box"),ee(ae,"margin",0),ee(ae,"top",e.top),ee(ae,"left",e.left),ee(ae,"width",e.width),ee(ae,"height",e.height),ee(ae,"opacity","0.8"),ee(ae,"position",oa?"absolute":"fixed"),ee(ae,"zIndex","100000"),ee(ae,"pointerEvents","none"),te.ghost=ae,t.appendChild(ae),ee(ae,"transform-origin",Nf/parseInt(ae.style.width)*100+"% "+If/parseInt(ae.style.height)*100+"%")}},_onDragStart:function(t,e){var n=this,r=t.dataTransfer,i=n.options;if(gt("dragStart",this,{evt:t}),te.eventCanceled){this._onDrop();return}gt("setupClone",this),te.eventCanceled||(Me=xy(P),Me.draggable=!1,Me.style["will-change"]="",this._hideClone(),Et(Me,this.options.chosenClass,!1),te.clone=Me),n.cloneId=Ma(function(){gt("clone",n),!te.eventCanceled&&(n.options.removeCloneOnHide||xe.insertBefore(Me,P),n._hideClone(),ut({sortable:n,name:"clone"}))}),!e&&Et(P,i.dragClass,!0),e?(Za=!0,n._loopId=setInterval(n._emulateDragOver,50)):(me(document,"mouseup",n._onDrop),me(document,"touchend",n._onDrop),me(document,"touchcancel",n._onDrop),r&&(r.effectAllowed="move",i.setData&&i.setData.call(n,r,P)),ve(document,"drop",n),ee(P,"transform","translateZ(0)")),Ti=!0,n._dragStartId=Ma(n._dragStarted.bind(n,e,t)),ve(document,"selectstart",n),Ao=!0,Vo&&ee(document.body,"user-select","none")},_onDragOver:function(t){var e=this.el,n=t.target,r,i,o,s=this.options,a=s.group,l=te.active,u=ra===a,c=s.sort,d=Ge||l,h,p=this,f=!1;if(ld)return;function m(ue,ge){gt(ue,p,wn({evt:t,isOwner:u,axis:h?"vertical":"horizontal",revert:o,dragRect:r,targetRect:i,canSort:c,fromSortable:d,target:n,completed:y,onMove:function(Te,mt){return sa(xe,e,P,r,Te,Be(Te),t,mt)},changed:b},ge))}function g(){m("dragOverAnimationCapture"),p.captureAnimationState(),p!==d&&d.captureAnimationState()}function y(ue){return m("dragOverCompleted",{insertion:ue}),ue&&(u?l._hideClone():l._showClone(p),p!==d&&(Et(P,Ge?Ge.options.ghostClass:l.options.ghostClass,!1),Et(P,s.ghostClass,!0)),Ge!==p&&p!==te.active?Ge=p:p===te.active&&Ge&&(Ge=null),d===p&&(p._ignoreWhileAnimating=n),p.animateAll(function(){m("dragOverAnimationComplete"),p._ignoreWhileAnimating=null}),p!==d&&(d.animateAll(),d._ignoreWhileAnimating=null)),(n===P&&!P.animated||n===e&&!n.animated)&&(Ei=null),!s.dragoverBubble&&!t.rootEl&&n!==document&&(P.parentNode[Tt]._isOutsideThisEl(t.target),!ue&&Fr(t)),!s.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function b(){Ct=Lt(P),Qn=Lt(P,s.draggable),ut({sortable:p,name:"change",toEl:e,newIndex:Ct,newDraggableIndex:Qn,originalEvent:t})}if(t.preventDefault!==void 0&&t.cancelable&&t.preventDefault(),n=hn(n,s.draggable,e,!0),m("dragOver"),te.eventCanceled)return f;if(P.contains(t.target)||n.animated&&n.animatingX&&n.animatingY||p._ignoreWhileAnimating===n)return y(!1);if(Za=!1,l&&!s.disabled&&(u?c||(o=Ae!==xe):Ge===this||(this.lastPutMode=ra.checkPull(this,l,P,t))&&a.checkPut(this,l,P,t))){if(h=this._getDirection(t,n)==="vertical",r=Be(P),m("dragOverValid"),te.eventCanceled)return f;if(o)return Ae=xe,g(),this._hideClone(),m("revert"),te.eventCanceled||($r?xe.insertBefore(P,$r):xe.appendChild(P)),y(!0);var k=Rp(e,s.draggable);if(!k||rO(t,h,this)&&!k.animated){if(k===P)return y(!1);if(k&&e===t.target&&(n=k),n&&(i=Be(n)),sa(xe,e,P,r,n,i,t,!!n)!==!1)return g(),e.appendChild(P),Ae=e,b(),y(!0)}else if(k&&nO(t,h,this)){var v=Ki(e,0,s,!0);if(v===P)return y(!1);if(n=v,i=Be(n),sa(xe,e,P,r,n,i,t,!1)!==!1)return g(),e.insertBefore(P,v),Ae=e,b(),y(!0)}else if(n.parentNode===e){i=Be(n);var w=0,x,S=P.parentNode!==e,N=!YT(P.animated&&P.toRect||r,n.animated&&n.toRect||i,h),A=h?"top":"left",C=_f(n,"top","top")||_f(P,"top","top"),_=C?C.scrollTop:void 0;Ei!==n&&(x=i[A],zo=!1,ia=!N&&s.invertSwap||S),w=iO(t,n,i,h,N?1:s.swapThreshold,s.invertedSwapThreshold==null?s.swapThreshold:s.invertedSwapThreshold,ia,Ei===n);var L;if(w!==0){var W=Lt(P);do W-=w,L=Ae.children[W];while(L&&(ee(L,"display")==="none"||L===ae))}if(w===0||L===n)return y(!1);Ei=n,jo=w;var q=n.nextElementSibling,K=!1;K=w===1;var J=sa(xe,e,P,r,n,i,t,K);if(J!==!1)return(J===1||J===-1)&&(K=J===1),ld=!0,setTimeout(tO,30),g(),K&&!q?e.appendChild(P):n.parentNode.insertBefore(P,K?q:n),C&&wy(C,0,_-C.scrollTop),Ae=P.parentNode,x!==void 0&&!ia&&(Aa=Math.abs(x-Be(n)[A])),b(),y(!0)}if(e.contains(P))return y(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){me(document,"mousemove",this._onTouchMove),me(document,"touchmove",this._onTouchMove),me(document,"pointermove",this._onTouchMove),me(document,"dragover",Fr),me(document,"mousemove",Fr),me(document,"touchmove",Fr)},_offUpEvents:function(){var t=this.el.ownerDocument;me(t,"mouseup",this._onDrop),me(t,"touchend",this._onDrop),me(t,"pointerup",this._onDrop),me(t,"touchcancel",this._onDrop),me(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;if(Ct=Lt(P),Qn=Lt(P,n.draggable),gt("drop",this,{evt:t}),Ae=P&&P.parentNode,Ct=Lt(P),Qn=Lt(P,n.draggable),te.eventCanceled){this._nulling();return}Ti=!1,ia=!1,zo=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),ud(this.cloneId),ud(this._dragStartId),this.nativeDraggable&&(me(document,"drop",this),me(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Vo&&ee(document.body,"user-select",""),ee(P,"transform",""),t&&(Ao&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),ae&&ae.parentNode&&ae.parentNode.removeChild(ae),(xe===Ae||Ge&&Ge.lastPutMode!=="clone")&&Me&&Me.parentNode&&Me.parentNode.removeChild(Me),P&&(this.nativeDraggable&&me(P,"dragend",this),Zu(P),P.style["will-change"]="",Ao&&!Ti&&Et(P,Ge?Ge.options.ghostClass:this.options.ghostClass,!1),Et(P,this.options.chosenClass,!1),ut({sortable:this,name:"unchoose",toEl:Ae,newIndex:null,newDraggableIndex:null,originalEvent:t}),xe!==Ae?(Ct>=0&&(ut({rootEl:Ae,name:"add",toEl:Ae,fromEl:xe,originalEvent:t}),ut({sortable:this,name:"remove",toEl:Ae,originalEvent:t}),ut({rootEl:Ae,name:"sort",toEl:Ae,fromEl:xe,originalEvent:t}),ut({sortable:this,name:"sort",toEl:Ae,originalEvent:t})),Ge&&Ge.save()):Ct!==Ii&&Ct>=0&&(ut({sortable:this,name:"update",toEl:Ae,originalEvent:t}),ut({sortable:this,name:"sort",toEl:Ae,originalEvent:t})),te.active&&((Ct==null||Ct===-1)&&(Ct=Ii,Qn=$o),ut({sortable:this,name:"end",toEl:Ae,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){gt("nulling",this),xe=P=Ae=ae=$r=Me=Oa=rr=Pr=Gt=Ao=Ct=Qn=Ii=$o=Ei=jo=Ge=ra=te.dragged=te.ghost=te.clone=te.active=null,el.forEach(function(t){t.checked=!0}),el.length=Ju=Xu=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":P&&(this._onDragOver(t),eO(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],e,n=this.el.children,r=0,i=n.length,o=this.options;r<i;r++)e=n[r],hn(e,o.draggable,this.el,!1)&&t.push(e.getAttribute(o.dataIdAttr)||sO(e));return t},sort:function(t,e){var n={},r=this.el;this.toArray().forEach(function(i,o){var s=r.children[o];hn(s,this.options.draggable,r,!1)&&(n[i]=s)},this),e&&this.captureAnimationState(),t.forEach(function(i){n[i]&&(r.removeChild(n[i]),r.appendChild(n[i]))}),e&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return hn(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var n=this.options;if(e===void 0)return n[t];var r=_s.modifyOption(this,t,e);typeof r<"u"?n[t]=r:n[t]=e,t==="group"&&Sy(n)},destroy:function(){gt("destroy",this);var t=this.el;t[Tt]=null,me(t,"mousedown",this._onTapStart),me(t,"touchstart",this._onTapStart),me(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(me(t,"dragover",this),me(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(e){e.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Qa.splice(Qa.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!rr){if(gt("hideClone",this),te.eventCanceled)return;ee(Me,"display","none"),this.options.removeCloneOnHide&&Me.parentNode&&Me.parentNode.removeChild(Me),rr=!0}},_showClone:function(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(rr){if(gt("showClone",this),te.eventCanceled)return;P.parentNode==xe&&!this.options.group.revertClone?xe.insertBefore(Me,P):$r?xe.insertBefore(Me,$r):xe.appendChild(Me),this.options.group.revertClone&&this.animate(P,Me),ee(Me,"display",""),rr=!1}}};function eO(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}function sa(t,e,n,r,i,o,s,a){var l,u=t[Tt],c=u.options.onMove,d;return window.CustomEvent&&!Un&&!Ms?l=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(l=document.createEvent("Event"),l.initEvent("move",!0,!0)),l.to=e,l.from=t,l.dragged=n,l.draggedRect=r,l.related=i||e,l.relatedRect=o||Be(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),c&&(d=c.call(u,l,s)),d}function Zu(t){t.draggable=!1}function tO(){ld=!1}function nO(t,e,n){var r=Be(Ki(n.el,0,n.options,!0)),i=10;return e?t.clientX<r.left-i||t.clientY<r.top&&t.clientX<r.right:t.clientY<r.top-i||t.clientY<r.bottom&&t.clientX<r.left}function rO(t,e,n){var r=Be(Rp(n.el,n.options.draggable)),i=10;return e?t.clientX>r.right+i||t.clientX<=r.right&&t.clientY>r.bottom&&t.clientX>=r.left:t.clientX>r.right&&t.clientY>r.top||t.clientX<=r.right&&t.clientY>r.bottom+i}function iO(t,e,n,r,i,o,s,a){var l=r?t.clientY:t.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,h=!1;if(!s){if(a&&Aa<u*i){if(!zo&&(jo===1?l>c+u*o/2:l<d-u*o/2)&&(zo=!0),zo)h=!0;else if(jo===1?l<c+Aa:l>d-Aa)return-jo}else if(l>c+u*(1-i)/2&&l<d-u*(1-i)/2)return oO(e)}return h=h||s,h&&(l<c+u*o/2||l>d-u*o/2)?l>c+u/2?1:-1:0}function oO(t){return Lt(P)<Lt(t)?1:-1}function sO(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,r=0;n--;)r+=e.charCodeAt(n);return r.toString(36)}function aO(t){el.length=0;for(var e=t.getElementsByTagName("input"),n=e.length;n--;){var r=e[n];r.checked&&el.push(r)}}function Ma(t){return setTimeout(t,0)}function ud(t){return clearTimeout(t)}gu&&ve(document,"touchmove",function(t){(te.active||Ti)&&t.cancelable&&t.preventDefault()});te.utils={on:ve,off:me,css:ee,find:by,is:function(t,e){return!!hn(t,e,t,!1)},extend:HT,throttle:ky,closest:hn,toggleClass:Et,clone:xy,index:Lt,nextTick:Ma,cancelNextTick:ud,detectDirection:Cy,getChild:Ki};te.get=function(t){return t[Tt]};te.mount=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e[0].constructor===Array&&(e=e[0]),e.forEach(function(r){if(!r.prototype||!r.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(r));r.utils&&(te.utils=wn(wn({},te.utils),r.utils)),_s.mount(r)})};te.create=function(t,e){return new te(t,e)};te.version=BT;var Re=[],Mo,cd,dd=!1,Qu,ec,tl,_o;function lO(){function t(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var e in this)e.charAt(0)==="_"&&typeof this[e]=="function"&&(this[e]=this[e].bind(this))}return t.prototype={dragStarted:function(e){var n=e.originalEvent;this.sortable.nativeDraggable?ve(document,"dragover",this._handleAutoScroll):this.options.supportPointer?ve(document,"pointermove",this._handleFallbackAutoScroll):n.touches?ve(document,"touchmove",this._handleFallbackAutoScroll):ve(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var n=e.originalEvent;!this.options.dragOverBubble&&!n.rootEl&&this._handleAutoScroll(n)},drop:function(){this.sortable.nativeDraggable?me(document,"dragover",this._handleAutoScroll):(me(document,"pointermove",this._handleFallbackAutoScroll),me(document,"touchmove",this._handleFallbackAutoScroll),me(document,"mousemove",this._handleFallbackAutoScroll)),Pf(),_a(),qT()},nulling:function(){tl=cd=Mo=dd=_o=Qu=ec=null,Re.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,n){var r=this,i=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,s=document.elementFromPoint(i,o);if(tl=e,n||this.options.forceAutoScrollFallback||Ms||Un||Vo){tc(e,this.options,s,n);var a=sr(s,!0);dd&&(!_o||i!==Qu||o!==ec)&&(_o&&Pf(),_o=setInterval(function(){var l=sr(document.elementFromPoint(i,o),!0);l!==a&&(a=l,_a()),tc(e,r.options,l,n)},10),Qu=i,ec=o)}else{if(!this.options.bubbleScroll||sr(s,!0)===yn()){_a();return}tc(e,this.options,sr(s,!1),!1)}}},jn(t,{pluginName:"scroll",initializeByDefault:!0})}function _a(){Re.forEach(function(t){clearInterval(t.pid)}),Re=[]}function Pf(){clearInterval(_o)}var tc=ky(function(t,e,n,r){if(e.scroll){var i=(t.touches?t.touches[0]:t).clientX,o=(t.touches?t.touches[0]:t).clientY,s=e.scrollSensitivity,a=e.scrollSpeed,l=yn(),u=!1,c;cd!==n&&(cd=n,_a(),Mo=e.scroll,c=e.scrollFn,Mo===!0&&(Mo=sr(n,!0)));var d=0,h=Mo;do{var p=h,f=Be(p),m=f.top,g=f.bottom,y=f.left,b=f.right,k=f.width,v=f.height,w=void 0,x=void 0,S=p.scrollWidth,N=p.scrollHeight,A=ee(p),C=p.scrollLeft,_=p.scrollTop;p===l?(w=k<S&&(A.overflowX==="auto"||A.overflowX==="scroll"||A.overflowX==="visible"),x=v<N&&(A.overflowY==="auto"||A.overflowY==="scroll"||A.overflowY==="visible")):(w=k<S&&(A.overflowX==="auto"||A.overflowX==="scroll"),x=v<N&&(A.overflowY==="auto"||A.overflowY==="scroll"));var L=w&&(Math.abs(b-i)<=s&&C+k<S)-(Math.abs(y-i)<=s&&!!C),W=x&&(Math.abs(g-o)<=s&&_+v<N)-(Math.abs(m-o)<=s&&!!_);if(!Re[d])for(var q=0;q<=d;q++)Re[q]||(Re[q]={});(Re[d].vx!=L||Re[d].vy!=W||Re[d].el!==p)&&(Re[d].el=p,Re[d].vx=L,Re[d].vy=W,clearInterval(Re[d].pid),(L!=0||W!=0)&&(u=!0,Re[d].pid=setInterval(function(){r&&this.layer===0&&te.active._onTouchMove(tl);var K=Re[this.layer].vy?Re[this.layer].vy*a:0,J=Re[this.layer].vx?Re[this.layer].vx*a:0;typeof c=="function"&&c.call(te.dragged.parentNode[Tt],J,K,t,tl,Re[this.layer].el)!=="continue"||wy(Re[this.layer].el,J,K)}.bind({layer:d}),24))),d++}while(e.bubbleScroll&&h!==l&&(h=sr(h,!1)));dd=u}},30),Ay=function(t){var e=t.originalEvent,n=t.putSortable,r=t.dragEl,i=t.activeSortable,o=t.dispatchSortableEvent,s=t.hideGhostForTarget,a=t.unhideGhostForTarget;if(e){var l=n||i;s();var u=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,c=document.elementFromPoint(u.clientX,u.clientY);a(),l&&!l.el.contains(c)&&(o("spill"),this.onSpill({dragEl:r,putSortable:n}))}};function Pp(){}Pp.prototype={startIndex:null,dragStart:function(t){var e=t.oldDraggableIndex;this.startIndex=e},onSpill:function(t){var e=t.dragEl,n=t.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var r=Ki(this.sortable.el,this.startIndex,this.options);r?this.sortable.el.insertBefore(e,r):this.sortable.el.appendChild(e),this.sortable.animateAll(),n&&n.animateAll()},drop:Ay};jn(Pp,{pluginName:"revertOnSpill"});function Fp(){}Fp.prototype={onSpill:function(t){var e=t.dragEl,n=t.putSortable,r=n||this.sortable;r.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),r.animateAll()},drop:Ay};jn(Fp,{pluginName:"removeOnSpill"});te.mount(new lO);te.mount(Fp,Pp);function nc(t){t.parentElement!==null&&t.parentElement.removeChild(t)}function Ff(t,e,n){const r=n===0?t.children[0]:t.children[n-1].nextSibling;t.insertBefore(e,r)}function uO(){return typeof window<"u"?window.console:global.console}const cO=uO();function dO(t){const e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}const pO=/-(\w)/g,hO=dO(t=>t.replace(pO,(e,n)=>n.toUpperCase())),My=["Start","Add","Remove","Update","End"],_y=["Choose","Unchoose","Sort","Filter","Clone"],Dy=["Move"],fO=[Dy,My,_y].flatMap(t=>t).map(t=>`on${t}`),pd={manage:Dy,manageAndEmit:My,emit:_y};function mO(t){return fO.indexOf(t)!==-1}const gO=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"];function vO(t){return gO.includes(t)}function yO(t){return["transition-group","TransitionGroup"].includes(t)}function Ny(t){return["id","class","role","style"].includes(t)||t.startsWith("data-")||t.startsWith("aria-")||t.startsWith("on")}function Iy(t){return t.reduce((e,[n,r])=>(e[n]=r,e),{})}function bO({$attrs:t,componentData:e={}}){return{...Iy(Object.entries(t).filter(([n,r])=>Ny(n))),...e}}function kO({$attrs:t,callBackBuilder:e}){const n=Iy(Ry(t));Object.entries(e).forEach(([i,o])=>{pd[i].forEach(s=>{n[`on${s}`]=o(s)})});const r=`[data-draggable]${n.draggable||""}`;return{...n,draggable:r}}function Ry(t){return Object.entries(t).filter(([e,n])=>!Ny(e)).map(([e,n])=>[hO(e),n]).filter(([e,n])=>!mO(e))}const Lf=({el:t})=>t,wO=(t,e)=>t.__draggable_context=e,Vf=t=>t.__draggable_context;class xO{constructor({nodes:{header:e,default:n,footer:r},root:i,realList:o}){this.defaultNodes=n,this.children=[...e,...n,...r],this.externalComponent=i.externalComponent,this.rootTransition=i.transition,this.tag=i.tag,this.realList=o}get _isRootComponent(){return this.externalComponent||this.rootTransition}render(e,n){const{tag:r,children:i,_isRootComponent:o}=this;return e(r,n,o?{default:()=>i}:i)}updated(){const{defaultNodes:e,realList:n}=this;e.forEach((r,i)=>{wO(Lf(r),{element:n[i],index:i})})}getUnderlyingVm(e){return Vf(e)}getVmIndexFromDomIndex(e,n){const{defaultNodes:r}=this,{length:i}=r,o=n.children,s=o.item(e);if(s===null)return i;const a=Vf(s);if(a)return a.index;if(i===0)return 0;const l=Lf(r[0]),u=[...o].findIndex(c=>c===l);return e<u?0:i}}function EO(t,e){const n=t[e];return n?n():[]}function CO({$slots:t,realList:e,getKey:n}){const r=e||[],[i,o]=["header","footer"].map(l=>EO(t,l)),{item:s}=t;if(!s)throw new Error("draggable element must have an item slot");const a=r.flatMap((l,u)=>s({element:l,index:u}).map(c=>(c.key=n(l),c.props={...c.props||{},"data-draggable":!0},c)));if(a.length!==r.length)throw new Error("Item slot must have only one child");return{header:i,footer:o,default:a}}function SO(t){const e=yO(t),n=!vO(t)&&!e;return{transition:e,externalComponent:n,tag:n?Ck(t):e?Sk:t}}function TO({$slots:t,tag:e,realList:n,getKey:r}){const i=CO({$slots:t,realList:n,getKey:r}),o=SO(e);return new xO({nodes:i,root:o,realList:n})}function Py(t,e){kr(()=>this.$emit(t.toLowerCase(),e))}function Fy(t){return(e,n)=>{if(this.realList!==null)return this[`onDrag${t}`](e,n)}}function OO(t){const e=Fy.call(this,t);return(n,r)=>{e.call(this,n,r),Py.call(this,t,n)}}let rc=null;const AO={list:{type:Array,required:!1,default:null},modelValue:{type:Array,required:!1,default:null},itemKey:{type:[String,Function],required:!0},clone:{type:Function,default:t=>t},tag:{type:String,default:"div"},move:{type:Function,default:null},componentData:{type:Object,required:!1,default:null}},MO=["update:modelValue","change",...[...pd.manageAndEmit,...pd.emit].map(t=>t.toLowerCase())],Ly=Q({name:"draggable",inheritAttrs:!1,props:AO,emits:MO,data(){return{error:!1}},render(){try{this.error=!1;const{$slots:t,$attrs:e,tag:n,componentData:r,realList:i,getKey:o}=this,s=TO({$slots:t,tag:n,realList:i,getKey:o});this.componentStructure=s;const a=bO({$attrs:e,componentData:r});return s.render(ns,a)}catch(t){return this.error=!0,ns("pre",{style:{color:"red"}},t.stack)}},created(){this.list!==null&&this.modelValue!==null&&cO.error("modelValue and list props are mutually exclusive! Please set one or another.")},mounted(){if(this.error)return;const{$attrs:t,$el:e,componentStructure:n}=this;n.updated();const r=kO({$attrs:t,callBackBuilder:{manageAndEmit:o=>OO.call(this,o),emit:o=>Py.bind(this,o),manage:o=>Fy.call(this,o)}}),i=e.nodeType===1?e:e.parentElement;this._sortable=new te(i,r),this.targetDomElement=i,i.__draggable_component__=this},updated(){this.componentStructure.updated()},beforeUnmount(){this._sortable!==void 0&&this._sortable.destroy()},computed:{realList(){const{list:t}=this;return t||this.modelValue},getKey(){const{itemKey:t}=this;return typeof t=="function"?t:e=>e[t]}},watch:{$attrs:{handler(t){const{_sortable:e}=this;e&&Ry(t).forEach(([n,r])=>{e.option(n,r)})},deep:!0}},methods:{getUnderlyingVm(t){return this.componentStructure.getUnderlyingVm(t)||null},getUnderlyingPotencialDraggableComponent(t){return t.__draggable_component__},emitChanges(t){kr(()=>this.$emit("change",t))},alterList(t){if(this.list){t(this.list);return}const e=[...this.modelValue];t(e),this.$emit("update:modelValue",e)},spliceList(){const t=e=>e.splice(...arguments);this.alterList(t)},updatePosition(t,e){const n=r=>r.splice(e,0,r.splice(t,1)[0]);this.alterList(n)},getRelatedContextFromMoveEvent({to:t,related:e}){const n=this.getUnderlyingPotencialDraggableComponent(t);if(!n)return{component:n};const r=n.realList,i={list:r,component:n};return t!==e&&r?{...n.getUnderlyingVm(e)||{},...i}:i},getVmIndexFromDomIndex(t){return this.componentStructure.getVmIndexFromDomIndex(t,this.targetDomElement)},onDragStart(t){this.context=this.getUnderlyingVm(t.item),t.item._underlying_vm_=this.clone(this.context.element),rc=t.item},onDragAdd(t){const e=t.item._underlying_vm_;if(e===void 0)return;nc(t.item);const n=this.getVmIndexFromDomIndex(t.newIndex);this.spliceList(n,0,e);const r={element:e,newIndex:n};this.emitChanges({added:r})},onDragRemove(t){if(Ff(this.$el,t.item,t.oldIndex),t.pullMode==="clone"){nc(t.clone);return}const{index:e,element:n}=this.context;this.spliceList(e,1);const r={element:n,oldIndex:e};this.emitChanges({removed:r})},onDragUpdate(t){nc(t.item),Ff(t.from,t.item,t.oldIndex);const e=this.context.index,n=this.getVmIndexFromDomIndex(t.newIndex);this.updatePosition(e,n);const r={element:this.context.element,oldIndex:e,newIndex:n};this.emitChanges({moved:r})},computeFutureIndex(t,e){if(!t.element)return 0;const n=[...e.to.children].filter(o=>o.style.display!=="none"),r=n.indexOf(e.related),i=t.component.getVmIndexFromDomIndex(r);return n.indexOf(rc)!==-1||!e.willInsertAfter?i:i+1},onDragMove(t,e){const{move:n,realList:r}=this;if(!n||!r)return!0;const i=this.getRelatedContextFromMoveEvent(t),o=this.computeFutureIndex(i,t),s={...this.context,futureIndex:o},a={...t,relatedContext:i,draggedContext:s};return n(a,e)},onDragEnd(){rc=null}}}),_O={key:0,class:"k-media__label-wrapper"},DO={key:1,class:"k-media__sublabel"},TL=Q({__name:"Media",props:{modelValue:{},types:{default:()=>["Image"]},label:{},sublabel:{},multiple:{type:Boolean},sortable:{type:Boolean,default:!0},upload:{type:Function,default:()=>(t,e,n)=>(console.warn("[@kvass-ui/media]: You need to setup the upload function before using this component!"),e(50),new Promise((r,i)=>{let o=new FileReader;o.onloadend=function(){r({url:o.result,type:t.type})},o.readAsDataURL(t)}))},size:{default:"cover"},placement:{default:"outside"},uploadOptions:{default:()=>({})},description:{type:Boolean,default:!0},dropMessage:{default:"Drag an image here or <b>browse</b> to upload."},type:{default:"file"},accept:{default:"image/*"},labels:{default:()=>({cancel:"Cancel",save:"Save",selectMessage:"Select a type from the menu",select:"Select",descriptionPlaceholder:"Add caption...",image:{createLabel:"Image"}})},required:{type:Boolean},disabled:{type:Boolean},thumbnailSize:{default:"4rem"}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=X(null),o=I(()=>i.value?n.modelValue instanceof Array?n.modelValue.find(p=>{var f;return p.url===((f=i.value)==null?void 0:f.url)}):n.modelValue:null),s=I({get(){return n.modelValue?(n.modelValue instanceof Array?n.modelValue:[n.modelValue]).map(p=>{var f;return{...p,selected:((f=i.value)==null?void 0:f.url)===p.url,typeConfig:a.value.find(m=>m.condition(p))}}):[]},set(p){n.multiple&&r("update:modelValue",p.map(f=>{let{selected:m,typeConfig:g,...y}=f;return y}))}}),a=I(()=>n.types.map(p=>typeof p=="string"?PT[p]:p).filter(Boolean));Ee(()=>n.modelValue,(p,f)=>{(!i.value||!s.value.find(m=>{var g;return m.url===((g=i.value)==null?void 0:g.url)}))&&l()},{immediate:!0});function l(p){return!n.modelValue||n.multiple&&!n.modelValue.length?i.value=null:p?i.value=p:i.value=s.value[0]}function u(p){var f;let{selected:m,typeConfig:g,...y}=p;r("update:modelValue",n.multiple?(n.modelValue||[]).filter(b=>b.url!==y.url):null),((f=i?.value)==null?void 0:f.url)===p.url&&kr(()=>{l()})}function c(p){r("update:modelValue",n.multiple?[...n.modelValue||[],p]:p),kr(()=>l(s.value.find(f=>f.url===p.url)))}function d(p){r("update:modelValue",p)}const h=rn("k-media",{variants:{placement:{outside:"k-media--placement-outside",inside:"k-media--placement-inside"}}});return(p,f)=>(E(),O("div",{class:Ce(B(h)({placement:p.placement}))},[p.label||p.sublabel||p.$slots.sublabel||p.$slots.label?(E(),O("div",_O,[p.label||p.$slots.label?(E(),O("label",{key:0,class:Ce(["k-media__label",{"k-media__label-required":p.required}])},[F(p.$slots,"label",{},()=>[$e(oe(p.label),1)])],2)):R("",!0),p.sublabel||p.$slots.sublabel?(E(),O("span",DO,[F(p.$slots,"sublabel",{},()=>[$e(oe(p.sublabel),1)])])):R("",!0)])):R("",!0),he(_T,{type:p.type,accept:p.accept,ref:"input",value:p.modelValue,multiple:p.multiple,required:p.required,onSelect:l,onRemove:u,onInput:d,selected:i.value,disabled:p.disabled,"upload-options":p.uploadOptions,upload:p.upload,dropMessage:p.dropMessage},Cs({default:Z(({openFileWindow:m})=>[he(yT,{onOpenFileWindow:m,ref:"typeSelector",value:a.value,onAdd:c,labels:p.labels,upload:p.upload},null,8,["onOpenFileWindow","value","labels","upload"])]),"drop-message":Z(()=>[F(p.$slots,"drop-message")]),"custom-message":Z(()=>[F(p.$slots,"custom-message")]),_:2},[i.value?{name:"preview",fn:Z(()=>[p.description&&o.value?(E(),$(bT,{key:0,modelValue:o.value.description,"onUpdate:modelValue":f[0]||(f[0]=m=>o.value.description=m),disabled:p.disabled,placeholder:p.labels.descriptionPlaceholder},null,8,["modelValue","disabled","placeholder"])):R("",!0),(E(),$(Qe(i.value.typeConfig.components.Preview),{value:i.value,size:p.size},null,8,["value","size"]))]),key:"0"}:void 0]),1032,["type","accept","value","multiple","required","selected","disabled","upload-options","upload","dropMessage"]),F(p.$slots,"bottom"),p.multiple?(E(),$(B(Ly),{key:1,modelValue:s.value,"onUpdate:modelValue":f[1]||(f[1]=m=>s.value=m),sort:p.sortable&&!p.disabled,class:"k-media__thumbnails","item-key":"url",animation:200,onEnd:f[2]||(f[2]=(m,g)=>{i.value=s.value[m.newIndex]})},{item:Z(({element:m,index:g})=>[(E(),$(mT,{onKeydown:op(y=>i.value=m,["enter"]),tabindex:"0",size:p.thumbnailSize,key:m.url,value:m,disabled:p.disabled,onClick:y=>i.value=m,onDelete:y=>u(m)},null,8,["onKeydown","size","value","disabled","onClick","onDelete"]))]),_:1},8,["modelValue","sort"])):R("",!0)],2))}});var NO=Ln("switch").parts("root","label","control","thumb"),aa=NO.build(),Vy=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`switch:${t.id}`},Bf=t=>{var e;return((e=t.ids)==null?void 0:e.label)??`switch:${t.id}:label`},IO=t=>{var e;return((e=t.ids)==null?void 0:e.thumb)??`switch:${t.id}:thumb`},RO=t=>{var e;return((e=t.ids)==null?void 0:e.control)??`switch:${t.id}:control`},hd=t=>{var e;return((e=t.ids)==null?void 0:e.hiddenInput)??`switch:${t.id}:input`},PO=t=>t.getById(Vy(t)),Do=t=>t.getById(hd(t));function FO(t,e){const{context:n,send:r,prop:i,scope:o}=t,s=i("disabled"),a=i("readOnly"),l=!!n.get("checked"),u=!s&&n.get("focused"),c=!s&&n.get("focusVisible"),d={"data-active":G(n.get("active")),"data-focus":G(u),"data-focus-visible":G(c),"data-readonly":G(a),"data-hover":G(n.get("hovered")),"data-disabled":G(s),"data-state":l?"checked":"unchecked","data-invalid":G(i("invalid"))};return{checked:l,disabled:s,focused:u,setChecked(h){r({type:"CHECKED.SET",checked:h,isTrusted:!1})},toggleChecked(){r({type:"CHECKED.TOGGLE",checked:l,isTrusted:!1})},getRootProps(){return e.label({...aa.root.attrs,...d,dir:i("dir"),id:Vy(o),htmlFor:hd(o),onPointerMove(){s||r({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){s||r({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(h){s||ct(h)===Do(o)&&h.stopPropagation()}})},getLabelProps(){return e.element({...aa.label.attrs,...d,dir:i("dir"),id:Bf(o)})},getThumbProps(){return e.element({...aa.thumb.attrs,...d,dir:i("dir"),id:IO(o),"aria-hidden":!0})},getControlProps(){return e.element({...aa.control.attrs,...d,dir:i("dir"),id:RO(o),"aria-hidden":!0})},getHiddenInputProps(){return e.input({id:hd(o),type:"checkbox",required:i("required"),defaultChecked:l,disabled:s,"aria-labelledby":Bf(o),"aria-invalid":i("invalid"),name:i("name"),form:i("form"),value:i("value"),style:bp,onFocus(){const h=is();r({type:"CONTEXT.SET",context:{focused:!0,focusVisible:h}})},onBlur(){r({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(h){if(a){h.preventDefault();return}const p=h.currentTarget.checked;r({type:"CHECKED.SET",checked:p,isTrusted:!0})}})}}}var{not:$f}=eu(),LO={props({props:t}){return{defaultChecked:!1,label:"switch",value:"on",...t}},initialState(){return"ready"},context({prop:t,bindable:e}){return{checked:e(()=>({defaultValue:t("defaultChecked"),value:t("checked"),onChange(n){var r;(r=t("onCheckedChange"))==null||r({checked:n})}})),fieldsetDisabled:e(()=>({defaultValue:!1})),focusVisible:e(()=>({defaultValue:!1})),active:e(()=>({defaultValue:!1})),focused:e(()=>({defaultValue:!1})),hovered:e(()=>({defaultValue:!1}))}},computed:{isDisabled:({context:t,prop:e})=>e("disabled")||t.get("fieldsetDisabled")},watch({track:t,prop:e,context:n,action:r}){t([()=>e("disabled")],()=>{r(["removeFocusIfNeeded"])}),t([()=>n.get("checked")],()=>{r(["syncInputElement"])})},effects:["trackFormControlState","trackPressEvent","trackFocusVisible"],on:{"CHECKED.TOGGLE":[{guard:$f("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:$f("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},states:{ready:{}},implementations:{guards:{isTrusted:({event:t})=>!!t.isTrusted},effects:{trackPressEvent({computed:t,scope:e,context:n}){if(!t("isDisabled"))return pv({pointerNode:PO(e),keyboardNode:Do(e),isValidKey:r=>r.key===" ",onPress:()=>n.set("active",!1),onPressStart:()=>n.set("active",!0),onPressEnd:()=>n.set("active",!1)})},trackFocusVisible({computed:t,scope:e}){if(!t("isDisabled"))return kp({root:e.getRootNode()})},trackFormControlState({context:t,send:e,scope:n}){return Yl(Do(n),{onFieldsetDisabledChange(r){t.set("fieldsetDisabled",r)},onFormReset(){const r=t.initial("checked");e({type:"CHECKED.SET",checked:!!r,src:"form-reset"})}})}},actions:{setContext({context:t,event:e}){for(const n in e.context)t.set(n,e.context[n])},syncInputElement({context:t,scope:e}){const n=Do(e);n&&mp(n,!!t.get("checked"))},removeFocusIfNeeded({context:t,prop:e}){e("disabled")&&t.set("focused",!1)},setChecked({context:t,event:e}){t.set("checked",e.checked)},toggleChecked({context:t}){t.set("checked",!t.get("checked"))},dispatchChangeEvent({context:t,scope:e}){const n=Do(e);gp(n,{checked:t.get("checked")})}}}};Wn()(["checked","defaultChecked","dir","disabled","form","getRootNode","id","ids","invalid","label","name","onCheckedChange","readOnly","required","value"]);const VO={class:"k-switch__label"},OL=Q({__name:"Switch",props:{modelValue:{type:Boolean},disabled:{type:Boolean},getRootNode:{type:Function},labels:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=pi(LO,{id:Qt(),...n,defaultChecked:n.modelValue,onCheckedChange:({checked:s})=>r("update:modelValue",s)}),o=I(()=>FO(i,di));return Ee(()=>n.modelValue,()=>{if(o.value.checked!==n.modelValue)return o.value.setChecked(n.modelValue)}),(s,a)=>(E(),O("label",ne({class:"k-switch"},o.value.getRootProps()),[z("input",be(Ie(o.value.getHiddenInputProps())),null,16),z("span",be(Ie(o.value.getControlProps())),[z("span",be(Ie(o.value.getThumbProps())),null,16)],16),s.labels||s.$slots.default?(E(),O("span",be(ne({key:0},o.value.getLabelProps())),[z("span",VO,[F(s.$slots,"default",{checked:o.value.checked},()=>[$e(oe(o.value.checked?s.labels.on:s.labels.off),1)])])],16)):R("",!0)],16))}}),AL=Q({__name:"LazyLoad",props:{wrapperTag:{default:"div"},threshold:{default:0},observerRoot:{default:null}},emits:["intersect"],setup(t,{emit:e}){const n=t,r=e,i=X(!1);function o(u){const c=u[0];c.isIntersecting&&(i.value=!0,kr(()=>{r("intersect",c),l()}))}const s=X(),a=X();qn(()=>{s.value=new IntersectionObserver(o,{root:n.observerRoot,threshold:n.threshold}),s.value.observe(a.value)}),ao(()=>{l()});function l(){s.value&&s.value.disconnect()}return(u,c)=>(E(),$(Qe(u.wrapperTag),{ref_key:"rootRef",ref:a,class:"k-lazyload"},{default:Z(()=>[i.value?F(u.$slots,"default",{key:0}):F(u.$slots,"placeholder",{key:1})]),_:3},512))}}),BO={class:"k-file-uploader__bar"},$O={class:"k-file-uploader__meta"},jO={key:0},zO={key:1},HO=Q({__name:"Uploader",props:{value:{},bytes:{},current:{default:1},total:{default:1}},setup(t){const e=t,n=I(()=>e.total>1),r=I(()=>Np(e.bytes)),i=I(()=>Math.floor(e.value));return(o,s)=>(E(),$(ni,{class:"k-file-uploader",align:"center",justify:"space-between",gap:"0rem"},{default:Z(()=>[z("div",null,oe(i.value)+" %",1),z("div",BO,[z("div",{class:"k-file-uploader__bar-value",style:Cr({width:o.value+"%"})},null,4)]),z("div",$O,[n.value?(E(),O("div",jO,oe(o.current)+" / "+oe(o.total),1)):R("",!0),o.bytes?(E(),O("div",zO,"("+oe(r.value)+")",1)):R("",!0)])]),_:1}))}}),qO=["innerHTML"],jf=Q({__name:"SlotHandler",props:{value:{}},setup(t){const e=t,n=I(()=>typeof e.value=="string"?e.value:void 0),r=I(()=>typeof e.value=="string"?"div":e.value);return(i,o)=>(E(),$(Qe(r.value),be(Ie(i.$attrs)),{default:Z(()=>[n.value?(E(),O("span",{key:0,innerHTML:n.value},null,8,qO)):R("",!0)]),_:1},16))}}),WO={class:"k-file-droparea__instruction"},UO=["accept","required","disabled","multiple"],KO={key:0,class:"k-file-droparea__max-size"},GO=Q({__name:"DropArea",props:{value:{},multiple:{type:Boolean},upload:{},uploadOptions:{},accept:{},dropMessage:{},fileSizeError:{},disabled:{type:Boolean},required:{type:Boolean},rename:{type:Boolean},labels:{}},emits:["input"],setup(t,{emit:e}){const n=t,r=e,i=X(!1),o=X(!0),s=X(),a=X(!1),l=I(()=>!!n.required),u=I(()=>n.disabled),c=I(()=>!u.value&&!p.total),d=I(()=>hT(n.accept)),{run:h,queue:p}=new my(n);function f(S){return h(S).then(N=>{!N||!N.length||r("input",n.multiple?[...n.value||[],...N]:N[0])})}function m(S){if(!S)return 0;const N={bytes:1,b:1,kb:1024,mb:1024**2,gb:1024**3,tb:1024**4,pb:1024**5},A=S.trim().toLowerCase().match(/^([\d.]+)\s*(bytes|b|kb|mb|gb|tb|pb)$/);if(!A)throw new Error("Invalid size format");const C=parseFloat(A[1]),_=A[2];return Math.round(C*N[_])}function g(){return o.value=!1,a.value=!0,setTimeout(()=>{w()},1500)}function y(S=0){var N;return m((N=n?.uploadOptions)==null?void 0:N.maxSize)<S}async function b(S){var N;if(u.value)return;let A=S.target.files||[];if(Array.from(A).some(C=>y(C.size))&&(N=n.uploadOptions)!=null&&N.maxSize)return g();n.uploadOptions.preTransform&&(A=await n.uploadOptions.preTransform(S)),f(A),s.value&&(s.value.value="")}async function k(S){var N,A;if(u.value||!s.value)return;S.preventDefault();let C=(N=S.dataTransfer)==null?void 0:N.files;if(C!=null&&C.length){if(Array.from(C).some(_=>y(_.size))&&(A=n.uploadOptions)!=null&&A.maxSize)return g();if(!o.value)return w();w(),n.uploadOptions.preTransform&&(C=await n.uploadOptions.preTransform(S)),C!=null&&C.length&&(s.value.files=S.dataTransfer.files,s.value.dispatchEvent(new InputEvent("input")),f(C))}}function v(S){if(u.value||!S.dataTransfer)return;const N=Array.from(S.dataTransfer.items).every(C=>Ip(C,n.accept)),A=n.multiple?!0:S.dataTransfer.items.length===1;o.value=N&&A,i.value=!0,S.preventDefault()}function w(){o.value=!0,i.value=!1,a.value=!1}const x=rn("k-file-droparea",{variants:{active:{true:"k-file-droparea--active"},invalid:{true:"k-file-droparea--invalid"},disabled:{true:"k-file-droparea--disabled"}}});return(S,N)=>{var A,C,_;return E(),O(De,null,[z("div",{class:Ce(B(x)({active:i.value,invalid:!o.value,disabled:u.value})),onDrop:k,onDragover:v,onDragleave:w},[F(S.$slots,"preview"),z("div",WO,[c.value?(E(),O("input",{key:0,type:"file",accept:Array.isArray(S.accept)?S.accept.join(","):S.accept,required:l.value,ref_key:"input",ref:s,onChange:b,disabled:!c.value,multiple:S.multiple,class:"k-file-droparea__input"},null,40,UO)):R("",!0),o.value?(E(),O(De,{key:1},[F(S.$slots,"drop-message",{extensions:d.value},()=>[he(jf,{value:S.dropMessage,extensions:d.value},null,8,["value","extensions"])]),(A=n.uploadOptions)!=null&&A.maxSize?(E(),O("div",KO,[z("span",null,oe(`${(C=S.labels)==null?void 0:C.maxSize}: ${(_=n?.uploadOptions)==null?void 0:_.maxSize}`),1)])):R("",!0)],64)):(E(),$(B(Ze),{key:2,icon:"fa-pro-light:ban",style:{"font-size":"2rem"}})),a.value?F(S.$slots,"file-size-error",{key:3,extensions:d.value},()=>[he(jf,{class:"k-file-droparea__file-size-error",value:S.fileSizeError,extensions:d.value},null,8,["value","extensions"])]):R("",!0),F(S.$slots,"custom-message")])],34),B(p).total?(E(),$(HO,{key:0,value:B(p).progress,bytes:B(p).bytes,current:B(p).counter,total:B(p).total},null,8,["value","bytes","current","total"])):R("",!0)],64)}}}),JO=Os?window:void 0;function XO(t){var e;const n=He(t);return(e=n?.$el)!=null?e:n}function YO(...t){const e=[],n=()=>{e.forEach(a=>a()),e.length=0},r=(a,l,u,c)=>(a.addEventListener(l,u,c),()=>a.removeEventListener(l,u,c)),i=I(()=>{const a=Gr(He(t[0])).filter(l=>l!=null);return a.every(l=>typeof l!="string")?a:void 0}),o=Av(()=>{var a,l;return[(l=(a=i.value)==null?void 0:a.map(u=>XO(u)))!=null?l:[JO].filter(u=>u!=null),Gr(He(i.value?t[1]:t[0])),Gr(B(i.value?t[2]:t[1])),He(i.value?t[3]:t[2])]},([a,l,u,c])=>{if(n(),!(a!=null&&a.length)||!(l!=null&&l.length)||!(u!=null&&u.length))return;const d=Ov(c)?{...c}:c;e.push(...a.flatMap(h=>l.flatMap(p=>u.map(f=>r(h,p,f,d)))))},{flush:"post"}),s=()=>{o(),n()};return Ts(n),s}const ZO=Q({name:"UseClipboard",props:["source","read","navigator","copiedDuring","legacy"],setup(t,{slots:e}){const n=sp(K1(t));return()=>{var r;return(r=e.default)==null?void 0:r.call(e,n)}}});function ic(t){return typeof Window<"u"&&t instanceof Window?t.document.documentElement:typeof Document<"u"&&t instanceof Document?t.documentElement:t}function By(t){const e=window.getComputedStyle(t);if(e.overflowX==="scroll"||e.overflowY==="scroll"||e.overflowX==="auto"&&t.clientWidth<t.scrollWidth||e.overflowY==="auto"&&t.clientHeight<t.scrollHeight)return!0;{const n=t.parentNode;return!n||n.tagName==="BODY"?!1:By(n)}}function QO(t){const e=t||window.event,n=e.target;return By(n)?!1:e.touches.length>1?!0:(e.preventDefault&&e.preventDefault(),!1)}const oc=new WeakMap;function eA(t,e=!1){const n=qt(e);let r=null,i="";Ee(z1(t),a=>{const l=ic(He(a));if(l){const u=l;if(oc.get(u)||oc.set(u,u.style.overflow),u.style.overflow!=="hidden"&&(i=u.style.overflow),u.style.overflow==="hidden")return n.value=!0;if(n.value)return u.style.overflow="hidden"}},{immediate:!0});const o=()=>{const a=ic(He(t));!a||n.value||(Qh&&(r=YO(a,"touchmove",l=>{QO(l)},{passive:!1})),a.style.overflow="hidden",n.value=!0)},s=()=>{const a=ic(He(t));!a||!n.value||(Qh&&r?.(),a.style.overflow=i,oc.delete(a),n.value=!1)};return Ts(s),I({get(){return n.value},set(a){a?o():s()}})}function tA(){let t=!1;const e=qt(!1);return(n,r)=>{if(e.value=r.value,t)return;t=!0;const i=eA(n,r.value);Ee(e,o=>i.value=o)}}tA();var nA=Ln("toggle-group").parts("root","item"),zf=nA.build(),nl=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`toggle-group:${t.id}`},rA=(t,e)=>{var n,r;return((r=(n=t.ids)==null?void 0:n.item)==null?void 0:r.call(n,e))??`toggle-group:${t.id}:${e}`},$y=t=>t.getById(nl(t)),vu=t=>{const e=`[data-ownedby='${CSS.escape(nl(t))}']:not([data-disabled])`;return yp($y(t),e)},Hf=t=>yv(vu(t)),iA=t=>bv(vu(t)),oA=(t,e,n)=>Nx(vu(t),e,n),sA=(t,e,n)=>Ix(vu(t),e,n);function aA(t,e){const{context:n,send:r,prop:i,scope:o}=t,s=n.get("value"),a=i("disabled"),l=!i("multiple"),u=i("rovingFocus"),c=i("orientation")==="horizontal";function d(h){const p=rA(o,h.value);return{id:p,disabled:!!(h.disabled||a),pressed:!!s.includes(h.value),focused:n.get("focusedId")===p}}return{value:s,setValue(h){r({type:"VALUE.SET",value:h})},getRootProps(){return e.element({...zf.root.attrs,id:nl(o),dir:i("dir"),role:l?"radiogroup":"group",tabIndex:n.get("isTabbingBackward")?-1:0,"data-disabled":G(a),"data-orientation":i("orientation"),"data-focus":G(n.get("focusedId")!=null),style:{outline:"none"},onMouseDown(){a||r({type:"ROOT.MOUSE_DOWN"})},onFocus(h){a||h.currentTarget===ct(h)&&(n.get("isClickFocus")||n.get("isTabbingBackward")||r({type:"ROOT.FOCUS"}))},onBlur(){a||r({type:"ROOT.BLUR"})}})},getItemState:d,getItemProps(h){const p=d(h),f=p.focused?0:-1;return e.button({...zf.item.attrs,id:p.id,type:"button","data-ownedby":nl(o),"data-focus":G(p.focused),disabled:p.disabled,tabIndex:u?f:void 0,role:l?"radio":void 0,"aria-checked":l?p.pressed:void 0,"aria-pressed":l?void 0:p.pressed,"data-disabled":G(p.disabled),"data-orientation":i("orientation"),dir:i("dir"),"data-state":p.pressed?"on":"off",onFocus(){p.disabled||r({type:"TOGGLE.FOCUS",id:p.id})},onClick(m){p.disabled||(r({type:"TOGGLE.CLICK",id:p.id,value:h.value}),ix()&&m.currentTarget.focus({preventScroll:!0}))},onKeyDown(m){if(m.defaultPrevented||!ax(m)||p.disabled)return;const g={Tab(y){const b=y.shiftKey;r({type:"TOGGLE.SHIFT_TAB",isShiftTab:b})},ArrowLeft(){!u||!c||r({type:"TOGGLE.FOCUS_PREV"})},ArrowRight(){!u||!c||r({type:"TOGGLE.FOCUS_NEXT"})},ArrowUp(){!u||c||r({type:"TOGGLE.FOCUS_PREV"})},ArrowDown(){!u||c||r({type:"TOGGLE.FOCUS_NEXT"})},Home(){u&&r({type:"TOGGLE.FOCUS_FIRST"})},End(){u&&r({type:"TOGGLE.FOCUS_LAST"})}}[ov(m)];g&&(g(m),m.key!=="Tab"&&m.preventDefault())}})}}}var{not:qf,and:lA}=eu(),uA={props({props:t}){return{defaultValue:[],orientation:"horizontal",rovingFocus:!0,loopFocus:!0,...t}},initialState(){return"idle"},context({prop:t,bindable:e}){return{value:e(()=>({defaultValue:t("defaultValue"),value:t("value"),onChange(n){var r;(r=t("onValueChange"))==null||r({value:n})}})),focusedId:e(()=>({defaultValue:null})),isTabbingBackward:e(()=>({defaultValue:!1})),isClickFocus:e(()=>({defaultValue:!1})),isWithinToolbar:e(()=>({defaultValue:!1}))}},computed:{currentLoopFocus:({context:t,prop:e})=>e("loopFocus")&&!t.get("isWithinToolbar")},entry:["checkIfWithinToolbar"],on:{"VALUE.SET":{actions:["setValue"]},"TOGGLE.CLICK":{actions:["setValue"]},"ROOT.MOUSE_DOWN":{actions:["setClickFocus"]}},states:{idle:{on:{"ROOT.FOCUS":{target:"focused",guard:qf(lA("isClickFocus","isTabbingBackward")),actions:["focusFirstToggle","clearClickFocus"]},"TOGGLE.FOCUS":{target:"focused",actions:["setFocusedId"]}}},focused:{on:{"ROOT.BLUR":{target:"idle",actions:["clearIsTabbingBackward","clearFocusedId"]},"TOGGLE.FOCUS":{actions:["setFocusedId"]},"TOGGLE.FOCUS_NEXT":{actions:["focusNextToggle"]},"TOGGLE.FOCUS_PREV":{actions:["focusPrevToggle"]},"TOGGLE.FOCUS_FIRST":{actions:["focusFirstToggle"]},"TOGGLE.FOCUS_LAST":{actions:["focusLastToggle"]},"TOGGLE.SHIFT_TAB":[{guard:qf("isFirstToggleFocused"),target:"idle",actions:["setIsTabbingBackward"]},{actions:["setIsTabbingBackward"]}]}}},implementations:{guards:{isClickFocus:({context:t})=>t.get("isClickFocus"),isTabbingBackward:({context:t})=>t.get("isTabbingBackward"),isFirstToggleFocused:({context:t,scope:e})=>{var n;return t.get("focusedId")===((n=Hf(e))==null?void 0:n.id)}},actions:{setIsTabbingBackward({context:t}){t.set("isTabbingBackward",!0)},clearIsTabbingBackward({context:t}){t.set("isTabbingBackward",!1)},setClickFocus({context:t}){t.set("isClickFocus",!0)},clearClickFocus({context:t}){t.set("isClickFocus",!1)},checkIfWithinToolbar({context:t,scope:e}){var n;const r=(n=$y(e))==null?void 0:n.closest("[role=toolbar]");t.set("isWithinToolbar",!!r)},setFocusedId({context:t,event:e}){t.set("focusedId",e.id)},clearFocusedId({context:t}){t.set("focusedId",null)},setValue({context:t,event:e,prop:n}){h1(e,["value"]);let r=t.get("value");Zx(e.value)?r=e.value:n("multiple")?r=Xx(r,e.value):r=Ss(r,[e.value])?[]:[e.value],t.set("value",r)},focusNextToggle({context:t,scope:e,prop:n}){At(()=>{var r;const i=t.get("focusedId");i&&((r=oA(e,i,n("loopFocus")))==null||r.focus({preventScroll:!0}))})},focusPrevToggle({context:t,scope:e,prop:n}){At(()=>{var r;const i=t.get("focusedId");i&&((r=sA(e,i,n("loopFocus")))==null||r.focus({preventScroll:!0}))})},focusFirstToggle({scope:t}){At(()=>{var e;(e=Hf(t))==null||e.focus({preventScroll:!0})})},focusLastToggle({scope:t}){At(()=>{var e;(e=iA(t))==null||e.focus({preventScroll:!0})})}}}};Wn()(["dir","disabled","getRootNode","id","ids","loopFocus","multiple","onValueChange","orientation","rovingFocus","value","defaultValue"]);Wn()(["value","disabled"]);const jy=Q({__name:"ButtonGroup",props:{modelValue:{},items:{},dropdownItems:{},direction:{default:"horizontal"},multiple:{type:Boolean},disabled:{type:Boolean},getRootNode:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=pi(uA,{id:Qt(),...n,orientation:n.direction,defaultValue:n.modelValue,onValueChange:({value:a})=>{r("update:modelValue",a)},rovingFocus:!0,loopFocus:!0}),o=I(()=>aA(i,di)),s=X();return Ee(()=>{var a;return(a=s.value)==null?void 0:a.isOpen},a=>{a||!o.value.value.includes("dropdown")||o.value.setValue(o.value.value.filter(l=>l!=="dropdown"))}),Ee(()=>n.modelValue,a=>{o.value.setValue([...a])},{deep:!1}),(a,l)=>(E(),O("div",ne({class:["k-buttongroup",`k-buttongroup--direction-${a.direction}`]},o.value.getRootProps()),[F(a.$slots,"default",{getItemProps:o.value.getItemProps},()=>[a.items?(E(!0),O(De,{key:0},_t(a.items,({id:u,...c})=>(E(),$(ze,ne({class:"k-buttongroup__item",variant:"tertiary",ref_for:!0},{...c,...o.value.getItemProps({value:u})}),null,16))),256)):R("",!0)]),a.dropdownItems||a.$slots.dropdown?(E(),$(pu,ne({key:0,ref_key:"dropdown",ref:s,keepOpen:!0,items:a.dropdownItems},o.value.getItemProps({value:"dropdown"})),{default:Z(({close:u})=>[F(a.$slots,"dropdown",{close:u,getItemProps:o.value.getItemProps})]),_:3},16,["items"])):R("",!0)],16))}}),cA=["href"],dA={class:"k-file-thumbnail__info"},pA=["value","disabled"],hA={class:"k-file-thumbnail__info-footer"},fA={key:0,class:"k-file-thumbnail__size"},mA=Q({__name:"Thumbnail",props:{value:{},disabled:{type:Boolean},rename:{type:Boolean},sortable:{type:Boolean},icons:{},labels:{}},emits:["rename","delete"],setup(t,{emit:e}){const n=[{pattern:/text.*/,icon:"fa-pro-solid:file-alt"},{pattern:/image.*/,icon:"fa-pro-solid:file-image"},{pattern:/pdf/,icon:"fa-pro-solid:file-pdf"},{pattern:/word/,icon:"fa-pro-solid:file-word"},{pattern:/excel/,icon:"fa-pro-solid:file-excel"},{pattern:/powerpoint/,icon:"fa-pro-solid:file-powerpoint"},{pattern:/octet-stream|zip/,icon:"fa-pro-solid:file-archive"}],r=t,i=I(()=>{let p=[...n,...r.icons].find(f=>r.value.type.match(f.pattern));return p?.icon||"fa-pro-solid:file"}),o=I(()=>r.disabled?"a":"div"),s=I(()=>r.disabled?{click:p=>{p.preventDefault(),ad(r.value)}}:{}),a=I(()=>r.disabled?{title:r.disabled?"Download":null}:{});function l(){r.disabled||ad(r.value)}const u=X(),c=X([]),d=X();function h(){var p;(p=u.value)==null||p.blur()}return(p,f)=>(E(),$(Qe(o.value),ne({class:["k-file-thumbnail",{"k-file-thumbnail--clickable":p.disabled}]},a.value,Bg(s.value)),{default:Z(()=>[he(ni,{class:"k-file-thumbnail__preview",gap:"0rem",justify:"center",align:"center"},{default:Z(()=>[F(p.$slots,"icon",{},()=>[p.value.type.includes("image")?(E(),O("a",{key:0,href:p.value.url,target:"_blank"},[he(au,{class:"k-file-thumbnail__preview-image",src:p.value.url,alt:p.value.name,size:"contain",aspectRatio:"1/1"},null,8,["src","alt"])],8,cA)):(E(),$(B(Ze),{key:1,icon:i.value,class:"k-file-thumbnail__preview-icon"},null,8,["icon"]))])]),_:3}),z("div",dA,[z("input",{type:"text",ref_key:"input",ref:u,class:"k-file-thumbnail__name",value:p.value.name,onKeypress:op(h,["enter"]),disabled:p.disabled||!p.rename,onInput:f[0]||(f[0]=m=>p.$emit("rename",m.target.value))},null,40,pA),z("div",hA,[p.value.size?(E(),O("span",fA,oe(B(Np)(p.value.size)),1)):R("",!0)])]),he(jy,{modelValue:c.value,"onUpdate:modelValue":f[2]||(f[2]=m=>{c.value=m.filter(g=>g!=="download")}),disabled:p.disabled},{default:Z(({getItemProps:m})=>[p.value.url?(E(),$(ze,ne({key:0,is:"a",href:p.value.url,class:"k-file-thumbnail__download",onClick:Ba(l,["prevent"]),icon:"fa-pro-light:arrow-down-to-line",variant:"tertiary"},m({value:"download"})),null,16,["href"])):R("",!0)]),dropdown:Z(({close:m})=>[p.value.url?(E(),$(ze,{key:0,is:"a",href:p.value.url,class:"k-file-thumbnail__download",onClick:Ba(l,["prevent"]),iconRight:"fa-pro-light:arrow-down-to-line",label:p.labels.download,variant:"tertiary"},null,8,["href","label"])):R("",!0),he(B(ZO),null,{default:Z(({copy:g,copied:y})=>[p.value.url?(E(),$(ze,{key:0,class:"k-file-thumbnail__copy",iconRight:"fa-pro-light:copy",label:p.labels.copy,variant:"tertiary",promise:d.value,onClick:()=>{d.value=g(p.value.url)}},null,8,["label","promise","onClick"])):R("",!0)]),_:1}),p.disabled?R("",!0):(E(),$(ze,{key:1,variant:"danger",label:p.labels.delete,class:"k-file-thumbnail__delete",iconRight:"fa-pro-light:times",onClick:f[1]||(f[1]=g=>p.$emit("delete"))},null,8,["label"]))]),_:1},8,["modelValue","disabled"]),p.sortable?(E(),$(B(Ze),{key:0,icon:"fa-pro-solid:arrows-alt-v",class:"k-file-thumbnail__handle"})):R("",!0)]),_:3},16,["class"]))}}),gA={key:0,class:"k-file__label-wrapper"},vA={key:1,class:"k-file__sublabel"},ML=Q({__name:"File",props:{modelValue:{},label:{},sublabel:{},multiple:{type:Boolean},sortable:{type:Boolean,default:!0},upload:{type:Function,default:()=>(t,e,n)=>(console.warn("[@kvass-ui/file]: You need to setup the upload function before using this component!"),e(50),new Promise((r,i)=>{let o=new FileReader;o.onloadend=function(){r({url:o.result,type:t.type})},o.readAsDataURL(t)}))},uploadOptions:{},dropMessage:{default:"Drag a file here or <b>browse</b> to upload."},fileSizeError:{default:"The file size exceeds the allowed limit."},rename:{type:Boolean,default:!0},accept:{},serialize:{type:Function,default:t=>t},required:{type:Boolean},disabled:{type:Boolean},icons:{default:()=>[]},labels:{default:()=>({delete:"Delete",download:"Download",copy:"Copy link",maxSize:"Maximum size"})}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e;function i(u){r("update:modelValue",u)}function o(u){r("update:modelValue",n.multiple?(n.modelValue||[]).filter(c=>c!==u):null)}const s=I(()=>n.multiple||!n.modelValue),a=I({get(){return n.modelValue?n.modelValue instanceof Array?n.modelValue:[n.modelValue]:[]},set(u){n.multiple&&i(u)}}),l=rn("k-file",{variants:{}});return(u,c)=>(E(),O("div",{class:Ce(B(l)({}))},[u.label||u.sublabel||u.$slots.sublabel||u.$slots.label?(E(),O("div",gA,[u.label||u.$slots.label?(E(),O("label",{key:0,class:Ce(["k-file__label",{"k-file__label-required":u.required}])},[F(u.$slots,"label",{},()=>[$e(oe(u.label),1)])],2)):R("",!0),u.sublabel||u.$slots.sublabel?(E(),O("span",vA,[F(u.$slots,"sublabel",{},()=>[$e(oe(u.sublabel),1)])])):R("",!0)])):R("",!0),he(ni,{direction:"column"},{default:Z(()=>[a.value.length?(E(),$(B(Ly),{key:0,modelValue:a.value,"onUpdate:modelValue":c[0]||(c[0]=d=>a.value=d),disabled:!u.multiple||!u.sortable,animation:200,class:"k-file__thumbnails","item-key":"url",handle:".k-file-thumbnail__handle"},{item:Z(({element:d,index:h})=>[(E(),$(mA,{key:d.url,disabled:u.disabled,sortable:!u.disabled&&u.sortable&&u.multiple&&a.value.length>1,rename:u.rename===!0,value:u.serialize(d),onRename:p=>d.name=p,onDelete:p=>o(d),icons:u.icons,labels:u.labels},Cs({_:2},[_t(u.$slots,(p,f)=>({name:f,fn:Z(()=>[F(u.$slots,f,{item:d})])}))]),1032,["disabled","sortable","rename","value","onRename","onDelete","icons","labels"]))]),_:3},8,["modelValue","disabled"])):R("",!0),s.value?(E(),$(GO,{key:1,accept:u.accept,ref:"input",value:u.modelValue,multiple:u.multiple,required:u.required,onInput:i,disabled:u.disabled,"upload-options":u.uploadOptions,upload:u.upload,dropMessage:u.dropMessage,fileSizeError:u.fileSizeError,rename:u.rename,labels:u.labels},{"drop-message":Z(({extensions:d})=>[F(u.$slots,"drop-message",{extensions:d})]),"custom-message":Z(()=>[F(u.$slots,"custom-message")]),_:3},8,["accept","value","multiple","required","disabled","upload-options","upload","dropMessage","fileSizeError","rename","labels"])):R("",!0)]),_:3})],2))}}),zy=new Set,yt=new WeakMap,Gi=new WeakMap,ii=new WeakMap,fd=new WeakMap,yA=new WeakMap,Ji=new WeakMap,rl=new WeakMap,No=new WeakSet;let xr,Lp=0,Vp=0;const Rn="__aa_tgt",us="__aa_del",il="__aa_new",bA=t=>{const e=SA(t);e&&e.forEach(n=>TA(n))},kA=t=>{t.forEach(e=>{e.target===xr&&xA(),yt.has(e.target)&&hi(e.target)})};function wA(t){const e=fd.get(t);e?.disconnect();let n=yt.get(t),r=0;const i=5;n||(n=Xi(t),yt.set(t,n));const{offsetWidth:o,offsetHeight:s}=xr,a=[n.top-i,o-(n.left+i+n.width),s-(n.top+i+n.height),n.left-i].map(u=>`${-1*Math.floor(u)}px`).join(" "),l=new IntersectionObserver(()=>{++r>1&&hi(t)},{root:xr,threshold:1,rootMargin:a});l.observe(t),fd.set(t,l)}function hi(t){clearTimeout(rl.get(t));const e=yu(t),n=cs(e)?500:e.duration;rl.set(t,setTimeout(async()=>{const r=ii.get(t);try{await r?.finished,yt.set(t,Xi(t)),wA(t)}catch{}},n))}function xA(){clearTimeout(rl.get(xr)),rl.set(xr,setTimeout(()=>{zy.forEach(t=>Uy(t,e=>Hy(()=>hi(e))))},100))}function EA(t){setTimeout(()=>{yA.set(t,setInterval(()=>Hy(hi.bind(null,t)),2e3))},Math.round(2e3*Math.random()))}function Hy(t){typeof requestIdleCallback=="function"?requestIdleCallback(()=>t()):requestAnimationFrame(()=>t())}let md,Ho;const CA=typeof window<"u"&&"ResizeObserver"in window;CA&&(xr=document.documentElement,md=new MutationObserver(bA),Ho=new ResizeObserver(kA),window.addEventListener("scroll",()=>{Vp=window.scrollY,Lp=window.scrollX}),Ho.observe(xr));function SA(t){return t.reduce((e,n)=>[...e,...Array.from(n.addedNodes),...Array.from(n.removedNodes)],[]).every(e=>e.nodeName==="#comment")?!1:t.reduce((e,n)=>{if(e===!1)return!1;if(n.target instanceof Element){if(sc(n.target),!e.has(n.target)){e.add(n.target);for(let r=0;r<n.target.children.length;r++){const i=n.target.children.item(r);if(i){if(us in i)return!1;sc(n.target,i),e.add(i)}}}if(n.removedNodes.length)for(let r=0;r<n.removedNodes.length;r++){const i=n.removedNodes[r];if(us in i)return!1;i instanceof Element&&(e.add(i),sc(n.target,i),Gi.set(i,[n.previousSibling,n.nextSibling]))}}return e},new Set)}function sc(t,e){!e&&!(Rn in t)?Object.defineProperty(t,Rn,{value:t}):e&&!(Rn in e)&&Object.defineProperty(e,Rn,{value:t})}function TA(t){var e;const n=t.isConnected,r=yt.has(t);n&&Gi.has(t)&&Gi.delete(t),ii.has(t)&&((e=ii.get(t))===null||e===void 0||e.cancel()),il in t?Wf(t):r&&n?AA(t):r&&!n?MA(t):Wf(t)}function un(t){return Number(t.replace(/[^0-9.\-]/g,""))}function OA(t){let e=t.parentElement;for(;e;){if(e.scrollLeft||e.scrollTop)return{x:e.scrollLeft,y:e.scrollTop};e=e.parentElement}return{x:0,y:0}}function Xi(t){const e=t.getBoundingClientRect(),{x:n,y:r}=OA(t);return{top:e.top+r,left:e.left+n,width:e.width,height:e.height}}function qy(t,e,n){let r=e.width,i=e.height,o=n.width,s=n.height;const a=getComputedStyle(t);if(a.getPropertyValue("box-sizing")==="content-box"){const l=un(a.paddingTop)+un(a.paddingBottom)+un(a.borderTopWidth)+un(a.borderBottomWidth),u=un(a.paddingLeft)+un(a.paddingRight)+un(a.borderRightWidth)+un(a.borderLeftWidth);r-=u,o-=u,i-=l,s-=l}return[r,o,i,s].map(Math.round)}function yu(t){return Rn in t&&Ji.has(t[Rn])?Ji.get(t[Rn]):{duration:250,easing:"ease-in-out"}}function Wy(t){if(Rn in t)return t[Rn]}function Bp(t){const e=Wy(t);return e?No.has(e):!1}function Uy(t,...e){e.forEach(n=>n(t,Ji.has(t)));for(let n=0;n<t.children.length;n++){const r=t.children.item(n);r&&e.forEach(i=>i(r,Ji.has(r)))}}function $p(t){return Array.isArray(t)?t:[t]}function cs(t){return typeof t=="function"}function AA(t){const e=yt.get(t),n=Xi(t);if(!Bp(t))return yt.set(t,n);let r;if(!e)return;const i=yu(t);if(typeof i!="function"){const o=e.left-n.left,s=e.top-n.top,[a,l,u,c]=qy(t,e,n),d={transform:`translate(${o}px, ${s}px)`},h={transform:"translate(0, 0)"};a!==l&&(d.width=`${a}px`,h.width=`${l}px`),u!==c&&(d.height=`${u}px`,h.height=`${c}px`),r=t.animate([d,h],{duration:i.duration,easing:i.easing})}else{const[o]=$p(i(t,"remain",e,n));r=new Animation(o),r.play()}ii.set(t,r),yt.set(t,n),r.addEventListener("finish",hi.bind(null,t))}function Wf(t){il in t&&delete t[il];const e=Xi(t);yt.set(t,e);const n=yu(t);if(!Bp(t))return;let r;if(typeof n!="function")r=t.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:n.duration*1.5,easing:"ease-in"});else{const[i]=$p(n(t,"add",e));r=new Animation(i),r.play()}ii.set(t,r),r.addEventListener("finish",hi.bind(null,t))}function Uf(t,e){var n;t.remove(),yt.delete(t),Gi.delete(t),ii.delete(t),(n=fd.get(t))===null||n===void 0||n.disconnect(),setTimeout(()=>{if(us in t&&delete t[us],Object.defineProperty(t,il,{value:!0,configurable:!0}),e&&t instanceof HTMLElement)for(const r in e)t.style[r]=""},0)}function MA(t){var e;if(!Gi.has(t)||!yt.has(t))return;const[n,r]=Gi.get(t);Object.defineProperty(t,us,{value:!0,configurable:!0});const i=window.scrollX,o=window.scrollY;if(r&&r.parentNode&&r.parentNode instanceof Element?r.parentNode.insertBefore(t,r):n&&n.parentNode?n.parentNode.appendChild(t):(e=Wy(t))===null||e===void 0||e.appendChild(t),!Bp(t))return Uf(t);const[s,a,l,u]=DA(t),c=yu(t),d=yt.get(t);(i!==Lp||o!==Vp)&&_A(t,i,o,c);let h,p={position:"absolute",top:`${s}px`,left:`${a}px`,width:`${l}px`,height:`${u}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!cs(c))Object.assign(t.style,p),h=t.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:c.duration,easing:"ease-out"});else{const[f,m]=$p(c(t,"remove",d));m?.styleReset!==!1&&(p=m?.styleReset||p,Object.assign(t.style,p)),h=new Animation(f),h.play()}ii.set(t,h),h.addEventListener("finish",Uf.bind(null,t,p))}function _A(t,e,n,r){const i=Lp-e,o=Vp-n,s=document.documentElement.style.scrollBehavior;if(getComputedStyle(xr).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+i,window.scrollY+o),!t.parentElement)return;const a=t.parentElement;let l=a.clientHeight,u=a.clientWidth;const c=performance.now();function d(){requestAnimationFrame(()=>{if(!cs(r)){const h=l-a.clientHeight,p=u-a.clientWidth;c+r.duration>performance.now()?(window.scrollTo({left:window.scrollX-p,top:window.scrollY-h}),l=a.clientHeight,u=a.clientWidth,d()):document.documentElement.style.scrollBehavior=s}})}d()}function DA(t){const e=yt.get(t),[n,,r]=qy(t,e,Xi(t));let i=t.parentElement;for(;i&&(getComputedStyle(i).position==="static"||i instanceof HTMLBodyElement);)i=i.parentElement;i||(i=document.body);const o=getComputedStyle(i),s=yt.get(i)||Xi(i),a=Math.round(e.top-s.top)-un(o.borderTopWidth),l=Math.round(e.left-s.left)-un(o.borderLeftWidth);return[a,l,n,r]}function NA(t,e={}){return md&&Ho&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!cs(e)&&!e.disrespectUserMotionPreference||(No.add(t),getComputedStyle(t).position==="static"&&Object.assign(t.style,{position:"relative"}),Uy(t,hi,EA,n=>Ho?.observe(n)),cs(e)?Ji.set(t,e):Ji.set(t,{duration:250,easing:"ease-in-out",...e}),md.observe(t,{childList:!0}),zy.add(t))),Object.freeze({parent:t,enable:()=>{No.add(t)},disable:()=>{No.delete(t)},isEnabled:()=>No.has(t)})}const Kf={mounted:(t,e)=>{NA(t,e.value||{})},getSSRProps:()=>({})},IA=["disabled"],RA={key:0,class:"k-expandable__title"},PA={key:1,class:"k-expandable__subtitle"},FA={key:2,class:"k-expandable__actions"},_L=Q({__name:"Expandable",props:{title:{},subtitle:{},disabled:{type:Boolean,default:!1},expandable:{type:Boolean,default:!0},expanded:{type:Boolean,default:!1},variant:{default:"border"},gap:{default:"1rem"}},setup(t){const e=t,n=ip(),r=I(()=>n.actions),i=I(()=>n.footer),o=I(()=>n.default),s=X(e.expanded),a=()=>{!e.expandable||!o.value||(s.value=!s.value)},l=rn("k-expandable",{variants:{disabled:{true:"k-expandable--disabled"},expandable:{true:"k-expandable--expandable"},expanded:{true:"k-expandable--expanded",false:"k-expandable--collapsed"},variant:{shadow:"k-expandable--variant-shadow",flat:"k-expandable--variant-flat",border:"k-expandable--variant-border"}}});return(u,c)=>Va((E(),O("fieldset",{disabled:u.disabled,class:Ce(B(l)({disabled:u.disabled,expandable:u.expandable,expanded:s.value,variant:u.variant}))},[he(ze,{class:Ce(["k-expandable__header",{"k-expandable__header--open":s.value}]),is:"legend",tabindex:"0",onKeydown:op(a,["enter"]),onClick:a,variant:"tertiary"},Cs({default:Z(()=>[u.$slots.title||u.title?(E(),O("span",RA,[F(u.$slots,"title",{},()=>[$e(oe(u.title),1)])])):R("",!0),u.$slots.subtitle||u.subtitle?(E(),O("span",PA,[F(u.$slots,"subtitle",{},()=>[$e(oe(u.subtitle),1)])])):R("",!0),r.value?(E(),O("span",FA,[F(u.$slots,"actions")])):R("",!0)]),_:2},[u.expandable?{name:"icon-left",fn:Z(()=>[he(B(Ze),{class:"k-expandable__icon",icon:s.value?"fa-pro-regular:angle-up":"fa-pro-regular:angle-down"},null,8,["icon"])]),key:"0"}:void 0]),1032,["class"]),s.value&&o.value?(E(),O(De,{key:0},[Va((E(),$(ni,{class:"k-expandable__content",direction:"column",gap:u.gap},{default:Z(()=>[F(u.$slots,"default")]),_:3},8,["gap"])),[[B(Kf)]]),i.value?(E(),$(ni,{key:0,justify:"center",align:"center",class:"k-expandable__footer"},{default:Z(()=>[F(u.$slots,"footer")]),_:3})):R("",!0)],64)):R("",!0)],10,IA)),[[B(Kf)]])}});function Je(t){this.content=t}Je.prototype={constructor:Je,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),o=r.content.slice();return i==-1?o.push(n||t,e):(o[i+1]=e,n&&(o[i]=n)),new Je(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Je(n)},addToStart:function(t,e){return new Je([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Je(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),o=r.find(t);return i.splice(o==-1?i.length:o,0,e,n),new Je(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Je.from(t),t.size?new Je(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Je.from(t),t.size?new Je(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Je.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Je.from=function(t){if(t instanceof Je)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Je(e)};function Ky(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=Ky(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function Gy(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),a=e.child(--o),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let u=0,c=Math.min(s.text.length,a.text.length);for(;u<c&&s.text[s.text.length-u-1]==a.text[a.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let u=Gy(s.content,a.content,n-1,r-1);if(u)return u}n-=l,r-=l}}class M{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,o){for(let s=0,a=0;a<n;s++){let l=this.content[s],u=a+l.nodeSize;if(u>e&&r(l,i+a,o||null,s)!==!1&&l.content.size){let c=a+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,i+c)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=u},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new M(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let o=0,s=0;s<n;o++){let a=this.content[o],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),i+=a.nodeSize),s=l}return new M(r,i)}cutByIndex(e,n){return e==n?M.empty:e==0&&n==this.content.length?this:new M(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new M(i,o)}addToStart(e){return new M([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new M(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Ky(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Gy(this,e,n,r)}findIndex(e,n=-1){if(e==0)return la(0,e);if(e==this.size)return la(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||n>0?la(r+1,s):la(r,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return M.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new M(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return M.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new M(n||e,r)}static from(e){if(!e)return M.empty;if(e instanceof M)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new M([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}M.empty=new M([],0);const ac={index:0,offset:0};function la(t,e){return ac.index=t,ac.offset=e,ac}function ol(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!ol(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!ol(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ke=class gd{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ol(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return gd.none;if(e instanceof gd)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};ke.none=[];class sl extends Error{}class V{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Xy(this.content,e+this.openStart,n);return r&&new V(r,this.openStart,this.openEnd)}removeBetween(e,n){return new V(Jy(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return V.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new V(M.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new V(e,r,i)}}V.empty=new V(M.empty,0,0);function Jy(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(Jy(o.content,e-i-1,n-i-1)))}function Xy(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=Xy(s.content,e-o-1,n);return a&&t.replaceChild(i,s.copy(a))}function LA(t,e,n){if(n.openStart>t.depth)throw new sl("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new sl("Inconsistent open depths");return Yy(t,e,n,0)}function Yy(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=Yy(t,e,n,r+1);return o.copy(o.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return Xr(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=VA(n,t);return Xr(o,Qy(t,s,a,e,r))}else return Xr(o,al(t,e,r))}function Zy(t,e){if(!e.type.compatibleContent(t.type))throw new sl("Cannot join "+e.type.name+" onto "+t.type.name)}function vd(t,e,n){let r=t.node(n);return Zy(r,e.node(n)),r}function Jr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function qo(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Jr(t.nodeAfter,r),o++));for(let a=o;a<s;a++)Jr(i.child(a),r);e&&e.depth==n&&e.textOffset&&Jr(e.nodeBefore,r)}function Xr(t,e){return t.type.checkContent(e),t.copy(e)}function Qy(t,e,n,r,i){let o=t.depth>i&&vd(t,e,i+1),s=r.depth>i&&vd(n,r,i+1),a=[];return qo(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(Zy(o,s),Jr(Xr(o,Qy(t,e,n,r,i+1)),a)):(o&&Jr(Xr(o,al(t,e,i+1)),a),qo(e,n,i,a),s&&Jr(Xr(s,al(n,r,i+1)),a)),qo(r,null,i,a),new M(a)}function al(t,e,n){let r=[];if(qo(null,t,n,r),t.depth>n){let i=vd(t,e,n+1);Jr(Xr(i,al(t,e,n+1)),r)}return qo(e,null,n,r),new M(r)}function VA(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)r=e.node(i).copy(M.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class ds{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return ke.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new ll(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(o),u=o-l;if(r.push(s,a,i+l),!u||(s=s.child(a),s.isText))break;o=u-1,i+=l+1}return new ds(n,r,o)}static resolveCached(e,n){let r=Gf.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==n)return s}else Gf.set(e,r=new BA);let i=r.elts[r.i]=ds.resolve(e,n);return r.i=(r.i+1)%$A,i}}class BA{constructor(){this.elts=[],this.i=0}}const $A=12,Gf=new WeakMap;class ll{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const jA=Object.create(null);let fr=class yd{constructor(e,n,r,i=ke.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||M.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&ol(this.attrs,n||e.defaultAttrs||jA)&&ke.sameSet(this.marks,r||ke.none)}copy(e=null){return e==this.content?this:new yd(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new yd(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return V.empty;let i=this.resolve(e),o=this.resolve(n),s=r?0:i.sharedDepth(n),a=i.start(s),l=i.node(s).content.cut(i.pos-a,o.pos-a);return new V(l,i.depth-s,o.depth-s)}replace(e,n,r){return LA(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return ds.resolveCached(this,e)}resolveNoCache(e){return ds.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),eb(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=M.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<o;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ke.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ke.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=M.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};fr.prototype.text=void 0;class ul extends fr{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):eb(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ul(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ul(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function eb(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class oi{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new zA(e,n);if(r.next==null)return oi.empty;let i=tb(r);r.next&&r.err("Unexpected trailing text");let o=JA(GA(i));return XA(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function o(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return M.from(a.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:c,next:d}=s.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let h=o(d,a.concat(c));if(h)return h}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:l}=o.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
|
|
8
|
+
*/function Of(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function wn(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Of(Object(n),!0).forEach(function(r){FT(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Of(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function Ta(t){"@babel/helpers - typeof";return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ta=function(e){return typeof e}:Ta=function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ta(t)}function FT(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function jn(){return jn=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},jn.apply(this,arguments)}function LT(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function VT(t,e){if(t==null)return{};var n=LT(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}var BT="1.14.0";function Vn(t){if(typeof window<"u"&&window.navigator)return!!navigator.userAgent.match(t)}var Un=Vn(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Ms=Vn(/Edge/i),Af=Vn(/firefox/i),Vo=Vn(/safari/i)&&!Vn(/chrome/i)&&!Vn(/android/i),vy=Vn(/iP(ad|od|hone)/i),$T=Vn(/chrome/i)&&Vn(/android/i),yy={capture:!1,passive:!1};function ve(t,e,n){t.addEventListener(e,n,!Un&&yy)}function me(t,e,n){t.removeEventListener(e,n,!Un&&yy)}function Ya(t,e){if(e){if(e[0]===">"&&(e=e.substring(1)),t)try{if(t.matches)return t.matches(e);if(t.msMatchesSelector)return t.msMatchesSelector(e);if(t.webkitMatchesSelector)return t.webkitMatchesSelector(e)}catch{return!1}return!1}}function jT(t){return t.host&&t!==document&&t.host.nodeType?t.host:t.parentNode}function hn(t,e,n,r){if(t){n=n||document;do{if(e!=null&&(e[0]===">"?t.parentNode===n&&Ya(t,e):Ya(t,e))||r&&t===n)return t;if(t===n)break}while(t=jT(t))}return null}var Mf=/\s+/g;function Et(t,e,n){if(t&&e)if(t.classList)t.classList[n?"add":"remove"](e);else{var r=(" "+t.className+" ").replace(Mf," ").replace(" "+e+" "," ");t.className=(r+(n?" "+e:"")).replace(Mf," ")}}function ee(t,e,n){var r=t&&t.style;if(r){if(n===void 0)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(t,""):t.currentStyle&&(n=t.currentStyle),e===void 0?n:n[e];!(e in r)&&e.indexOf("webkit")===-1&&(e="-webkit-"+e),r[e]=n+(typeof n=="string"?"":"px")}}function Vi(t,e){var n="";if(typeof t=="string")n=t;else do{var r=ee(t,"transform");r&&r!=="none"&&(n=r+" "+n)}while(!e&&(t=t.parentNode));var i=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return i&&new i(n)}function by(t,e,n){if(t){var r=t.getElementsByTagName(e),i=0,o=r.length;if(n)for(;i<o;i++)n(r[i],i);return r}return[]}function yn(){var t=document.scrollingElement;return t||document.documentElement}function Be(t,e,n,r,i){if(!(!t.getBoundingClientRect&&t!==window)){var o,s,a,l,u,c,d;if(t!==window&&t.parentNode&&t!==yn()?(o=t.getBoundingClientRect(),s=o.top,a=o.left,l=o.bottom,u=o.right,c=o.height,d=o.width):(s=0,a=0,l=window.innerHeight,u=window.innerWidth,c=window.innerHeight,d=window.innerWidth),(e||n)&&t!==window&&(i=i||t.parentNode,!Un))do if(i&&i.getBoundingClientRect&&(ee(i,"transform")!=="none"||n&&ee(i,"position")!=="static")){var h=i.getBoundingClientRect();s-=h.top+parseInt(ee(i,"border-top-width")),a-=h.left+parseInt(ee(i,"border-left-width")),l=s+o.height,u=a+o.width;break}while(i=i.parentNode);if(r&&t!==window){var p=Vi(i||t),f=p&&p.a,m=p&&p.d;p&&(s/=m,a/=f,d/=f,c/=m,l=s+c,u=a+d)}return{top:s,left:a,bottom:l,right:u,width:d,height:c}}}function _f(t,e,n){for(var r=sr(t,!0),i=Be(t)[e];r;){var o=Be(r)[n],s=void 0;if(s=i>=o,!s)return r;if(r===yn())break;r=sr(r,!1)}return!1}function Ki(t,e,n,r){for(var i=0,o=0,s=t.children;o<s.length;){if(s[o].style.display!=="none"&&s[o]!==te.ghost&&(r||s[o]!==te.dragged)&&hn(s[o],n.draggable,t,!1)){if(i===e)return s[o];i++}o++}return null}function Rp(t,e){for(var n=t.lastElementChild;n&&(n===te.ghost||ee(n,"display")==="none"||e&&!Ya(n,e));)n=n.previousElementSibling;return n||null}function Lt(t,e){var n=0;if(!t||!t.parentNode)return-1;for(;t=t.previousElementSibling;)t.nodeName.toUpperCase()!=="TEMPLATE"&&t!==te.clone&&(!e||Ya(t,e))&&n++;return n}function Df(t){var e=0,n=0,r=yn();if(t)do{var i=Vi(t),o=i.a,s=i.d;e+=t.scrollLeft*o,n+=t.scrollTop*s}while(t!==r&&(t=t.parentNode));return[e,n]}function zT(t,e){for(var n in t)if(t.hasOwnProperty(n)){for(var r in e)if(e.hasOwnProperty(r)&&e[r]===t[n][r])return Number(n)}return-1}function sr(t,e){if(!t||!t.getBoundingClientRect)return yn();var n=t,r=!1;do if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var i=ee(n);if(n.clientWidth<n.scrollWidth&&(i.overflowX=="auto"||i.overflowX=="scroll")||n.clientHeight<n.scrollHeight&&(i.overflowY=="auto"||i.overflowY=="scroll")){if(!n.getBoundingClientRect||n===document.body)return yn();if(r||e)return n;r=!0}}while(n=n.parentNode);return yn()}function HT(t,e){if(t&&e)for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t}function Ku(t,e){return Math.round(t.top)===Math.round(e.top)&&Math.round(t.left)===Math.round(e.left)&&Math.round(t.height)===Math.round(e.height)&&Math.round(t.width)===Math.round(e.width)}var Bo;function ky(t,e){return function(){if(!Bo){var n=arguments,r=this;n.length===1?t.call(r,n[0]):t.apply(r,n),Bo=setTimeout(function(){Bo=void 0},e)}}}function qT(){clearTimeout(Bo),Bo=void 0}function wy(t,e,n){t.scrollLeft+=e,t.scrollTop+=n}function xy(t){var e=window.Polymer,n=window.jQuery||window.Zepto;return e&&e.dom?e.dom(t).cloneNode(!0):n?n(t).clone(!0)[0]:t.cloneNode(!0)}var Tt="Sortable"+new Date().getTime();function WT(){var t=[],e;return{captureAnimationState:function(){if(t=[],!!this.options.animation){var n=[].slice.call(this.el.children);n.forEach(function(r){if(!(ee(r,"display")==="none"||r===te.ghost)){t.push({target:r,rect:Be(r)});var i=wn({},t[t.length-1].rect);if(r.thisAnimationDuration){var o=Vi(r,!0);o&&(i.top-=o.f,i.left-=o.e)}r.fromRect=i}})}},addAnimationState:function(n){t.push(n)},removeAnimationState:function(n){t.splice(zT(t,{target:n}),1)},animateAll:function(n){var r=this;if(!this.options.animation){clearTimeout(e),typeof n=="function"&&n();return}var i=!1,o=0;t.forEach(function(s){var a=0,l=s.target,u=l.fromRect,c=Be(l),d=l.prevFromRect,h=l.prevToRect,p=s.rect,f=Vi(l,!0);f&&(c.top-=f.f,c.left-=f.e),l.toRect=c,l.thisAnimationDuration&&Ku(d,c)&&!Ku(u,c)&&(p.top-c.top)/(p.left-c.left)===(u.top-c.top)/(u.left-c.left)&&(a=KT(p,d,h,r.options)),Ku(c,u)||(l.prevFromRect=u,l.prevToRect=c,a||(a=r.options.animation),r.animate(l,p,c,a)),a&&(i=!0,o=Math.max(o,a),clearTimeout(l.animationResetTimer),l.animationResetTimer=setTimeout(function(){l.animationTime=0,l.prevFromRect=null,l.fromRect=null,l.prevToRect=null,l.thisAnimationDuration=null},a),l.thisAnimationDuration=a)}),clearTimeout(e),i?e=setTimeout(function(){typeof n=="function"&&n()},o):typeof n=="function"&&n(),t=[]},animate:function(n,r,i,o){if(o){ee(n,"transition",""),ee(n,"transform","");var s=Vi(this.el),a=s&&s.a,l=s&&s.d,u=(r.left-i.left)/(a||1),c=(r.top-i.top)/(l||1);n.animatingX=!!u,n.animatingY=!!c,ee(n,"transform","translate3d("+u+"px,"+c+"px,0)"),this.forRepaintDummy=UT(n),ee(n,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),ee(n,"transform","translate3d(0,0,0)"),typeof n.animated=="number"&&clearTimeout(n.animated),n.animated=setTimeout(function(){ee(n,"transition",""),ee(n,"transform",""),n.animated=!1,n.animatingX=!1,n.animatingY=!1},o)}}}}function UT(t){return t.offsetWidth}function KT(t,e,n,r){return Math.sqrt(Math.pow(e.top-t.top,2)+Math.pow(e.left-t.left,2))/Math.sqrt(Math.pow(e.top-n.top,2)+Math.pow(e.left-n.left,2))*r.animation}var xi=[],Gu={initializeByDefault:!0},_s={mount:function(t){for(var e in Gu)Gu.hasOwnProperty(e)&&!(e in t)&&(t[e]=Gu[e]);xi.forEach(function(n){if(n.pluginName===t.pluginName)throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}),xi.push(t)},pluginEvent:function(t,e,n){var r=this;this.eventCanceled=!1,n.cancel=function(){r.eventCanceled=!0};var i=t+"Global";xi.forEach(function(o){e[o.pluginName]&&(e[o.pluginName][i]&&e[o.pluginName][i](wn({sortable:e},n)),e.options[o.pluginName]&&e[o.pluginName][t]&&e[o.pluginName][t](wn({sortable:e},n)))})},initializePlugins:function(t,e,n,r){xi.forEach(function(s){var a=s.pluginName;if(!(!t.options[a]&&!s.initializeByDefault)){var l=new s(t,e,t.options);l.sortable=t,l.options=t.options,t[a]=l,jn(n,l.defaults)}});for(var i in t.options)if(t.options.hasOwnProperty(i)){var o=this.modifyOption(t,i,t.options[i]);typeof o<"u"&&(t.options[i]=o)}},getEventProperties:function(t,e){var n={};return xi.forEach(function(r){typeof r.eventProperties=="function"&&jn(n,r.eventProperties.call(e[r.pluginName],t))}),n},modifyOption:function(t,e,n){var r;return xi.forEach(function(i){t[i.pluginName]&&i.optionListeners&&typeof i.optionListeners[e]=="function"&&(r=i.optionListeners[e].call(t[i.pluginName],n))}),r}};function GT(t){var e=t.sortable,n=t.rootEl,r=t.name,i=t.targetEl,o=t.cloneEl,s=t.toEl,a=t.fromEl,l=t.oldIndex,u=t.newIndex,c=t.oldDraggableIndex,d=t.newDraggableIndex,h=t.originalEvent,p=t.putSortable,f=t.extraEventProperties;if(e=e||n&&n[Tt],!!e){var m,g=e.options,y="on"+r.charAt(0).toUpperCase()+r.substr(1);window.CustomEvent&&!Un&&!Ms?m=new CustomEvent(r,{bubbles:!0,cancelable:!0}):(m=document.createEvent("Event"),m.initEvent(r,!0,!0)),m.to=s||n,m.from=a||n,m.item=i||n,m.clone=o,m.oldIndex=l,m.newIndex=u,m.oldDraggableIndex=c,m.newDraggableIndex=d,m.originalEvent=h,m.pullMode=p?p.lastPutMode:void 0;var b=wn(wn({},f),_s.getEventProperties(r,e));for(var k in b)m[k]=b[k];n&&n.dispatchEvent(m),g[y]&&g[y].call(e,m)}}var JT=["evt"],gt=function(t,e){var n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},r=n.evt,i=VT(n,JT);_s.pluginEvent.bind(te)(t,e,wn({dragEl:P,parentEl:Ae,ghostEl:ae,rootEl:xe,nextEl:$r,lastDownEl:Oa,cloneEl:Me,cloneHidden:rr,dragStarted:Ao,putSortable:Ge,activeSortable:te.active,originalEvent:r,oldIndex:Ii,oldDraggableIndex:$o,newIndex:Ct,newDraggableIndex:Qn,hideGhostForTarget:Ty,unhideGhostForTarget:Oy,cloneNowHidden:function(){rr=!0},cloneNowShown:function(){rr=!1},dispatchSortableEvent:function(o){ut({sortable:e,name:o,originalEvent:r})}},i))};function ut(t){GT(wn({putSortable:Ge,cloneEl:Me,targetEl:P,rootEl:xe,oldIndex:Ii,oldDraggableIndex:$o,newIndex:Ct,newDraggableIndex:Qn},t))}var P,Ae,ae,xe,$r,Oa,Me,rr,Ii,Ct,$o,Qn,ra,Ge,Ti=!1,Za=!1,Qa=[],Pr,Gt,Ju,Xu,Nf,If,Ao,Ei,jo,zo=!1,ia=!1,Aa,tt,Yu=[],ld=!1,el=[],gu=typeof document<"u",oa=vy,Rf=Ms||Un?"cssFloat":"float",XT=gu&&!$T&&!vy&&"draggable"in document.createElement("div"),Ey=function(){if(gu){if(Un)return!1;var t=document.createElement("x");return t.style.cssText="pointer-events:auto",t.style.pointerEvents==="auto"}}(),Cy=function(t,e){var n=ee(t),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),i=Ki(t,0,e),o=Ki(t,1,e),s=i&&ee(i),a=o&&ee(o),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+Be(i).width,u=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Be(o).width;if(n.display==="flex")return n.flexDirection==="column"||n.flexDirection==="column-reverse"?"vertical":"horizontal";if(n.display==="grid")return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(i&&s.float&&s.float!=="none"){var c=s.float==="left"?"left":"right";return o&&(a.clear==="both"||a.clear===c)?"vertical":"horizontal"}return i&&(s.display==="block"||s.display==="flex"||s.display==="table"||s.display==="grid"||l>=r&&n[Rf]==="none"||o&&n[Rf]==="none"&&l+u>r)?"vertical":"horizontal"},YT=function(t,e,n){var r=n?t.left:t.top,i=n?t.right:t.bottom,o=n?t.width:t.height,s=n?e.left:e.top,a=n?e.right:e.bottom,l=n?e.width:e.height;return r===s||i===a||r+o/2===s+l/2},ZT=function(t,e){var n;return Qa.some(function(r){var i=r[Tt].options.emptyInsertThreshold;if(!(!i||Rp(r))){var o=Be(r),s=t>=o.left-i&&t<=o.right+i,a=e>=o.top-i&&e<=o.bottom+i;if(s&&a)return n=r}}),n},Sy=function(t){function e(i,o){return function(s,a,l,u){var c=s.options.group.name&&a.options.group.name&&s.options.group.name===a.options.group.name;if(i==null&&(o||c))return!0;if(i==null||i===!1)return!1;if(o&&i==="clone")return i;if(typeof i=="function")return e(i(s,a,l,u),o)(s,a,l,u);var d=(o?s:a).options.group.name;return i===!0||typeof i=="string"&&i===d||i.join&&i.indexOf(d)>-1}}var n={},r=t.group;(!r||Ta(r)!="object")&&(r={name:r}),n.name=r.name,n.checkPull=e(r.pull,!0),n.checkPut=e(r.put),n.revertClone=r.revertClone,t.group=n},Ty=function(){!Ey&&ae&&ee(ae,"display","none")},Oy=function(){!Ey&&ae&&ee(ae,"display","")};gu&&document.addEventListener("click",function(t){if(Za)return t.preventDefault(),t.stopPropagation&&t.stopPropagation(),t.stopImmediatePropagation&&t.stopImmediatePropagation(),Za=!1,!1},!0);var Fr=function(t){if(P){t=t.touches?t.touches[0]:t;var e=ZT(t.clientX,t.clientY);if(e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);n.target=n.rootEl=e,n.preventDefault=void 0,n.stopPropagation=void 0,e[Tt]._onDragOver(n)}}},QT=function(t){P&&P.parentNode[Tt]._isOutsideThisEl(t.target)};function te(t,e){if(!(t&&t.nodeType&&t.nodeType===1))throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(t));this.el=t,this.options=e=jn({},e),t[Tt]=this;var n={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(t.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return Cy(t,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(o,s){o.setData("Text",s.textContent)},dropBubble:!1,dragoverBubble:!1,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:!1,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:!1,fallbackClass:"sortable-fallback",fallbackOnBody:!1,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:te.supportPointer!==!1&&"PointerEvent"in window&&!Vo,emptyInsertThreshold:5};_s.initializePlugins(this,t,n);for(var r in n)!(r in e)&&(e[r]=n[r]);Sy(e);for(var i in this)i.charAt(0)==="_"&&typeof this[i]=="function"&&(this[i]=this[i].bind(this));this.nativeDraggable=e.forceFallback?!1:XT,this.nativeDraggable&&(this.options.touchStartThreshold=1),e.supportPointer?ve(t,"pointerdown",this._onTapStart):(ve(t,"mousedown",this._onTapStart),ve(t,"touchstart",this._onTapStart)),this.nativeDraggable&&(ve(t,"dragover",this),ve(t,"dragenter",this)),Qa.push(this.el),e.store&&e.store.get&&this.sort(e.store.get(this)||[]),jn(this,WT())}te.prototype={constructor:te,_isOutsideThisEl:function(t){!this.el.contains(t)&&t!==this.el&&(Ei=null)},_getDirection:function(t,e){return typeof this.options.direction=="function"?this.options.direction.call(this,t,e,P):this.options.direction},_onTapStart:function(t){if(t.cancelable){var e=this,n=this.el,r=this.options,i=r.preventOnFilter,o=t.type,s=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,a=(s||t).target,l=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||a,u=r.filter;if(aO(n),!P&&!(/mousedown|pointerdown/.test(o)&&t.button!==0||r.disabled)&&!l.isContentEditable&&!(!this.nativeDraggable&&Vo&&a&&a.tagName.toUpperCase()==="SELECT")&&(a=hn(a,r.draggable,n,!1),!(a&&a.animated)&&Oa!==a)){if(Ii=Lt(a),$o=Lt(a,r.draggable),typeof u=="function"){if(u.call(this,t,a,this)){ut({sortable:e,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),gt("filter",e,{evt:t}),i&&t.cancelable&&t.preventDefault();return}}else if(u&&(u=u.split(",").some(function(c){if(c=hn(l,c.trim(),n,!1),c)return ut({sortable:e,rootEl:c,name:"filter",targetEl:a,fromEl:n,toEl:n}),gt("filter",e,{evt:t}),!0}),u)){i&&t.cancelable&&t.preventDefault();return}r.handle&&!hn(l,r.handle,n,!1)||this._prepareDragStart(t,s,a)}}},_prepareDragStart:function(t,e,n){var r=this,i=r.el,o=r.options,s=i.ownerDocument,a;if(n&&!P&&n.parentNode===i){var l=Be(n);if(xe=i,P=n,Ae=P.parentNode,$r=P.nextSibling,Oa=n,ra=o.group,te.dragged=P,Pr={target:P,clientX:(e||t).clientX,clientY:(e||t).clientY},Nf=Pr.clientX-l.left,If=Pr.clientY-l.top,this._lastX=(e||t).clientX,this._lastY=(e||t).clientY,P.style["will-change"]="all",a=function(){if(gt("delayEnded",r,{evt:t}),te.eventCanceled){r._onDrop();return}r._disableDelayedDragEvents(),!Af&&r.nativeDraggable&&(P.draggable=!0),r._triggerDragStart(t,e),ut({sortable:r,name:"choose",originalEvent:t}),Et(P,o.chosenClass,!0)},o.ignore.split(",").forEach(function(u){by(P,u.trim(),Zu)}),ve(s,"dragover",Fr),ve(s,"mousemove",Fr),ve(s,"touchmove",Fr),ve(s,"mouseup",r._onDrop),ve(s,"touchend",r._onDrop),ve(s,"touchcancel",r._onDrop),Af&&this.nativeDraggable&&(this.options.touchStartThreshold=4,P.draggable=!0),gt("delayStart",this,{evt:t}),o.delay&&(!o.delayOnTouchOnly||e)&&(!this.nativeDraggable||!(Ms||Un))){if(te.eventCanceled){this._onDrop();return}ve(s,"mouseup",r._disableDelayedDrag),ve(s,"touchend",r._disableDelayedDrag),ve(s,"touchcancel",r._disableDelayedDrag),ve(s,"mousemove",r._delayedDragTouchMoveHandler),ve(s,"touchmove",r._delayedDragTouchMoveHandler),o.supportPointer&&ve(s,"pointermove",r._delayedDragTouchMoveHandler),r._dragStartTimer=setTimeout(a,o.delay)}else a()}},_delayedDragTouchMoveHandler:function(t){var e=t.touches?t.touches[0]:t;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){P&&Zu(P),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var t=this.el.ownerDocument;me(t,"mouseup",this._disableDelayedDrag),me(t,"touchend",this._disableDelayedDrag),me(t,"touchcancel",this._disableDelayedDrag),me(t,"mousemove",this._delayedDragTouchMoveHandler),me(t,"touchmove",this._delayedDragTouchMoveHandler),me(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(t,e){e=e||t.pointerType=="touch"&&t,!this.nativeDraggable||e?this.options.supportPointer?ve(document,"pointermove",this._onTouchMove):e?ve(document,"touchmove",this._onTouchMove):ve(document,"mousemove",this._onTouchMove):(ve(P,"dragend",this),ve(xe,"dragstart",this._onDragStart));try{document.selection?Ma(function(){document.selection.empty()}):window.getSelection().removeAllRanges()}catch{}},_dragStarted:function(t,e){if(Ti=!1,xe&&P){gt("dragStarted",this,{evt:e}),this.nativeDraggable&&ve(document,"dragover",QT);var n=this.options;!t&&Et(P,n.dragClass,!1),Et(P,n.ghostClass,!0),te.active=this,t&&this._appendGhost(),ut({sortable:this,name:"start",originalEvent:e})}else this._nulling()},_emulateDragOver:function(){if(Gt){this._lastX=Gt.clientX,this._lastY=Gt.clientY,Ty();for(var t=document.elementFromPoint(Gt.clientX,Gt.clientY),e=t;t&&t.shadowRoot&&(t=t.shadowRoot.elementFromPoint(Gt.clientX,Gt.clientY),t!==e);)e=t;if(P.parentNode[Tt]._isOutsideThisEl(t),e)do{if(e[Tt]){var n=void 0;if(n=e[Tt]._onDragOver({clientX:Gt.clientX,clientY:Gt.clientY,target:t,rootEl:e}),n&&!this.options.dragoverBubble)break}t=e}while(e=e.parentNode);Oy()}},_onTouchMove:function(t){if(Pr){var e=this.options,n=e.fallbackTolerance,r=e.fallbackOffset,i=t.touches?t.touches[0]:t,o=ae&&Vi(ae,!0),s=ae&&o&&o.a,a=ae&&o&&o.d,l=oa&&tt&&Df(tt),u=(i.clientX-Pr.clientX+r.x)/(s||1)+(l?l[0]-Yu[0]:0)/(s||1),c=(i.clientY-Pr.clientY+r.y)/(a||1)+(l?l[1]-Yu[1]:0)/(a||1);if(!te.active&&!Ti){if(n&&Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))<n)return;this._onDragStart(t,!0)}if(ae){o?(o.e+=u-(Ju||0),o.f+=c-(Xu||0)):o={a:1,b:0,c:0,d:1,e:u,f:c};var d="matrix(".concat(o.a,",").concat(o.b,",").concat(o.c,",").concat(o.d,",").concat(o.e,",").concat(o.f,")");ee(ae,"webkitTransform",d),ee(ae,"mozTransform",d),ee(ae,"msTransform",d),ee(ae,"transform",d),Ju=u,Xu=c,Gt=i}t.cancelable&&t.preventDefault()}},_appendGhost:function(){if(!ae){var t=this.options.fallbackOnBody?document.body:xe,e=Be(P,!0,oa,!0,t),n=this.options;if(oa){for(tt=t;ee(tt,"position")==="static"&&ee(tt,"transform")==="none"&&tt!==document;)tt=tt.parentNode;tt!==document.body&&tt!==document.documentElement?(tt===document&&(tt=yn()),e.top+=tt.scrollTop,e.left+=tt.scrollLeft):tt=yn(),Yu=Df(tt)}ae=P.cloneNode(!0),Et(ae,n.ghostClass,!1),Et(ae,n.fallbackClass,!0),Et(ae,n.dragClass,!0),ee(ae,"transition",""),ee(ae,"transform",""),ee(ae,"box-sizing","border-box"),ee(ae,"margin",0),ee(ae,"top",e.top),ee(ae,"left",e.left),ee(ae,"width",e.width),ee(ae,"height",e.height),ee(ae,"opacity","0.8"),ee(ae,"position",oa?"absolute":"fixed"),ee(ae,"zIndex","100000"),ee(ae,"pointerEvents","none"),te.ghost=ae,t.appendChild(ae),ee(ae,"transform-origin",Nf/parseInt(ae.style.width)*100+"% "+If/parseInt(ae.style.height)*100+"%")}},_onDragStart:function(t,e){var n=this,r=t.dataTransfer,i=n.options;if(gt("dragStart",this,{evt:t}),te.eventCanceled){this._onDrop();return}gt("setupClone",this),te.eventCanceled||(Me=xy(P),Me.draggable=!1,Me.style["will-change"]="",this._hideClone(),Et(Me,this.options.chosenClass,!1),te.clone=Me),n.cloneId=Ma(function(){gt("clone",n),!te.eventCanceled&&(n.options.removeCloneOnHide||xe.insertBefore(Me,P),n._hideClone(),ut({sortable:n,name:"clone"}))}),!e&&Et(P,i.dragClass,!0),e?(Za=!0,n._loopId=setInterval(n._emulateDragOver,50)):(me(document,"mouseup",n._onDrop),me(document,"touchend",n._onDrop),me(document,"touchcancel",n._onDrop),r&&(r.effectAllowed="move",i.setData&&i.setData.call(n,r,P)),ve(document,"drop",n),ee(P,"transform","translateZ(0)")),Ti=!0,n._dragStartId=Ma(n._dragStarted.bind(n,e,t)),ve(document,"selectstart",n),Ao=!0,Vo&&ee(document.body,"user-select","none")},_onDragOver:function(t){var e=this.el,n=t.target,r,i,o,s=this.options,a=s.group,l=te.active,u=ra===a,c=s.sort,d=Ge||l,h,p=this,f=!1;if(ld)return;function m(ue,ge){gt(ue,p,wn({evt:t,isOwner:u,axis:h?"vertical":"horizontal",revert:o,dragRect:r,targetRect:i,canSort:c,fromSortable:d,target:n,completed:y,onMove:function(Te,mt){return sa(xe,e,P,r,Te,Be(Te),t,mt)},changed:b},ge))}function g(){m("dragOverAnimationCapture"),p.captureAnimationState(),p!==d&&d.captureAnimationState()}function y(ue){return m("dragOverCompleted",{insertion:ue}),ue&&(u?l._hideClone():l._showClone(p),p!==d&&(Et(P,Ge?Ge.options.ghostClass:l.options.ghostClass,!1),Et(P,s.ghostClass,!0)),Ge!==p&&p!==te.active?Ge=p:p===te.active&&Ge&&(Ge=null),d===p&&(p._ignoreWhileAnimating=n),p.animateAll(function(){m("dragOverAnimationComplete"),p._ignoreWhileAnimating=null}),p!==d&&(d.animateAll(),d._ignoreWhileAnimating=null)),(n===P&&!P.animated||n===e&&!n.animated)&&(Ei=null),!s.dragoverBubble&&!t.rootEl&&n!==document&&(P.parentNode[Tt]._isOutsideThisEl(t.target),!ue&&Fr(t)),!s.dragoverBubble&&t.stopPropagation&&t.stopPropagation(),f=!0}function b(){Ct=Lt(P),Qn=Lt(P,s.draggable),ut({sortable:p,name:"change",toEl:e,newIndex:Ct,newDraggableIndex:Qn,originalEvent:t})}if(t.preventDefault!==void 0&&t.cancelable&&t.preventDefault(),n=hn(n,s.draggable,e,!0),m("dragOver"),te.eventCanceled)return f;if(P.contains(t.target)||n.animated&&n.animatingX&&n.animatingY||p._ignoreWhileAnimating===n)return y(!1);if(Za=!1,l&&!s.disabled&&(u?c||(o=Ae!==xe):Ge===this||(this.lastPutMode=ra.checkPull(this,l,P,t))&&a.checkPut(this,l,P,t))){if(h=this._getDirection(t,n)==="vertical",r=Be(P),m("dragOverValid"),te.eventCanceled)return f;if(o)return Ae=xe,g(),this._hideClone(),m("revert"),te.eventCanceled||($r?xe.insertBefore(P,$r):xe.appendChild(P)),y(!0);var k=Rp(e,s.draggable);if(!k||rO(t,h,this)&&!k.animated){if(k===P)return y(!1);if(k&&e===t.target&&(n=k),n&&(i=Be(n)),sa(xe,e,P,r,n,i,t,!!n)!==!1)return g(),e.appendChild(P),Ae=e,b(),y(!0)}else if(k&&nO(t,h,this)){var v=Ki(e,0,s,!0);if(v===P)return y(!1);if(n=v,i=Be(n),sa(xe,e,P,r,n,i,t,!1)!==!1)return g(),e.insertBefore(P,v),Ae=e,b(),y(!0)}else if(n.parentNode===e){i=Be(n);var w=0,x,S=P.parentNode!==e,N=!YT(P.animated&&P.toRect||r,n.animated&&n.toRect||i,h),A=h?"top":"left",C=_f(n,"top","top")||_f(P,"top","top"),_=C?C.scrollTop:void 0;Ei!==n&&(x=i[A],zo=!1,ia=!N&&s.invertSwap||S),w=iO(t,n,i,h,N?1:s.swapThreshold,s.invertedSwapThreshold==null?s.swapThreshold:s.invertedSwapThreshold,ia,Ei===n);var L;if(w!==0){var W=Lt(P);do W-=w,L=Ae.children[W];while(L&&(ee(L,"display")==="none"||L===ae))}if(w===0||L===n)return y(!1);Ei=n,jo=w;var q=n.nextElementSibling,K=!1;K=w===1;var J=sa(xe,e,P,r,n,i,t,K);if(J!==!1)return(J===1||J===-1)&&(K=J===1),ld=!0,setTimeout(tO,30),g(),K&&!q?e.appendChild(P):n.parentNode.insertBefore(P,K?q:n),C&&wy(C,0,_-C.scrollTop),Ae=P.parentNode,x!==void 0&&!ia&&(Aa=Math.abs(x-Be(n)[A])),b(),y(!0)}if(e.contains(P))return y(!1)}return!1},_ignoreWhileAnimating:null,_offMoveEvents:function(){me(document,"mousemove",this._onTouchMove),me(document,"touchmove",this._onTouchMove),me(document,"pointermove",this._onTouchMove),me(document,"dragover",Fr),me(document,"mousemove",Fr),me(document,"touchmove",Fr)},_offUpEvents:function(){var t=this.el.ownerDocument;me(t,"mouseup",this._onDrop),me(t,"touchend",this._onDrop),me(t,"pointerup",this._onDrop),me(t,"touchcancel",this._onDrop),me(document,"selectstart",this)},_onDrop:function(t){var e=this.el,n=this.options;if(Ct=Lt(P),Qn=Lt(P,n.draggable),gt("drop",this,{evt:t}),Ae=P&&P.parentNode,Ct=Lt(P),Qn=Lt(P,n.draggable),te.eventCanceled){this._nulling();return}Ti=!1,ia=!1,zo=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),ud(this.cloneId),ud(this._dragStartId),this.nativeDraggable&&(me(document,"drop",this),me(e,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Vo&&ee(document.body,"user-select",""),ee(P,"transform",""),t&&(Ao&&(t.cancelable&&t.preventDefault(),!n.dropBubble&&t.stopPropagation()),ae&&ae.parentNode&&ae.parentNode.removeChild(ae),(xe===Ae||Ge&&Ge.lastPutMode!=="clone")&&Me&&Me.parentNode&&Me.parentNode.removeChild(Me),P&&(this.nativeDraggable&&me(P,"dragend",this),Zu(P),P.style["will-change"]="",Ao&&!Ti&&Et(P,Ge?Ge.options.ghostClass:this.options.ghostClass,!1),Et(P,this.options.chosenClass,!1),ut({sortable:this,name:"unchoose",toEl:Ae,newIndex:null,newDraggableIndex:null,originalEvent:t}),xe!==Ae?(Ct>=0&&(ut({rootEl:Ae,name:"add",toEl:Ae,fromEl:xe,originalEvent:t}),ut({sortable:this,name:"remove",toEl:Ae,originalEvent:t}),ut({rootEl:Ae,name:"sort",toEl:Ae,fromEl:xe,originalEvent:t}),ut({sortable:this,name:"sort",toEl:Ae,originalEvent:t})),Ge&&Ge.save()):Ct!==Ii&&Ct>=0&&(ut({sortable:this,name:"update",toEl:Ae,originalEvent:t}),ut({sortable:this,name:"sort",toEl:Ae,originalEvent:t})),te.active&&((Ct==null||Ct===-1)&&(Ct=Ii,Qn=$o),ut({sortable:this,name:"end",toEl:Ae,originalEvent:t}),this.save()))),this._nulling()},_nulling:function(){gt("nulling",this),xe=P=Ae=ae=$r=Me=Oa=rr=Pr=Gt=Ao=Ct=Qn=Ii=$o=Ei=jo=Ge=ra=te.dragged=te.ghost=te.clone=te.active=null,el.forEach(function(t){t.checked=!0}),el.length=Ju=Xu=0},handleEvent:function(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":P&&(this._onDragOver(t),eO(t));break;case"selectstart":t.preventDefault();break}},toArray:function(){for(var t=[],e,n=this.el.children,r=0,i=n.length,o=this.options;r<i;r++)e=n[r],hn(e,o.draggable,this.el,!1)&&t.push(e.getAttribute(o.dataIdAttr)||sO(e));return t},sort:function(t,e){var n={},r=this.el;this.toArray().forEach(function(i,o){var s=r.children[o];hn(s,this.options.draggable,r,!1)&&(n[i]=s)},this),e&&this.captureAnimationState(),t.forEach(function(i){n[i]&&(r.removeChild(n[i]),r.appendChild(n[i]))}),e&&this.animateAll()},save:function(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function(t,e){return hn(t,e||this.options.draggable,this.el,!1)},option:function(t,e){var n=this.options;if(e===void 0)return n[t];var r=_s.modifyOption(this,t,e);typeof r<"u"?n[t]=r:n[t]=e,t==="group"&&Sy(n)},destroy:function(){gt("destroy",this);var t=this.el;t[Tt]=null,me(t,"mousedown",this._onTapStart),me(t,"touchstart",this._onTapStart),me(t,"pointerdown",this._onTapStart),this.nativeDraggable&&(me(t,"dragover",this),me(t,"dragenter",this)),Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),function(e){e.removeAttribute("draggable")}),this._onDrop(),this._disableDelayedDragEvents(),Qa.splice(Qa.indexOf(this.el),1),this.el=t=null},_hideClone:function(){if(!rr){if(gt("hideClone",this),te.eventCanceled)return;ee(Me,"display","none"),this.options.removeCloneOnHide&&Me.parentNode&&Me.parentNode.removeChild(Me),rr=!0}},_showClone:function(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(rr){if(gt("showClone",this),te.eventCanceled)return;P.parentNode==xe&&!this.options.group.revertClone?xe.insertBefore(Me,P):$r?xe.insertBefore(Me,$r):xe.appendChild(Me),this.options.group.revertClone&&this.animate(P,Me),ee(Me,"display",""),rr=!1}}};function eO(t){t.dataTransfer&&(t.dataTransfer.dropEffect="move"),t.cancelable&&t.preventDefault()}function sa(t,e,n,r,i,o,s,a){var l,u=t[Tt],c=u.options.onMove,d;return window.CustomEvent&&!Un&&!Ms?l=new CustomEvent("move",{bubbles:!0,cancelable:!0}):(l=document.createEvent("Event"),l.initEvent("move",!0,!0)),l.to=e,l.from=t,l.dragged=n,l.draggedRect=r,l.related=i||e,l.relatedRect=o||Be(e),l.willInsertAfter=a,l.originalEvent=s,t.dispatchEvent(l),c&&(d=c.call(u,l,s)),d}function Zu(t){t.draggable=!1}function tO(){ld=!1}function nO(t,e,n){var r=Be(Ki(n.el,0,n.options,!0)),i=10;return e?t.clientX<r.left-i||t.clientY<r.top&&t.clientX<r.right:t.clientY<r.top-i||t.clientY<r.bottom&&t.clientX<r.left}function rO(t,e,n){var r=Be(Rp(n.el,n.options.draggable)),i=10;return e?t.clientX>r.right+i||t.clientX<=r.right&&t.clientY>r.bottom&&t.clientX>=r.left:t.clientX>r.right&&t.clientY>r.top||t.clientX<=r.right&&t.clientY>r.bottom+i}function iO(t,e,n,r,i,o,s,a){var l=r?t.clientY:t.clientX,u=r?n.height:n.width,c=r?n.top:n.left,d=r?n.bottom:n.right,h=!1;if(!s){if(a&&Aa<u*i){if(!zo&&(jo===1?l>c+u*o/2:l<d-u*o/2)&&(zo=!0),zo)h=!0;else if(jo===1?l<c+Aa:l>d-Aa)return-jo}else if(l>c+u*(1-i)/2&&l<d-u*(1-i)/2)return oO(e)}return h=h||s,h&&(l<c+u*o/2||l>d-u*o/2)?l>c+u/2?1:-1:0}function oO(t){return Lt(P)<Lt(t)?1:-1}function sO(t){for(var e=t.tagName+t.className+t.src+t.href+t.textContent,n=e.length,r=0;n--;)r+=e.charCodeAt(n);return r.toString(36)}function aO(t){el.length=0;for(var e=t.getElementsByTagName("input"),n=e.length;n--;){var r=e[n];r.checked&&el.push(r)}}function Ma(t){return setTimeout(t,0)}function ud(t){return clearTimeout(t)}gu&&ve(document,"touchmove",function(t){(te.active||Ti)&&t.cancelable&&t.preventDefault()});te.utils={on:ve,off:me,css:ee,find:by,is:function(t,e){return!!hn(t,e,t,!1)},extend:HT,throttle:ky,closest:hn,toggleClass:Et,clone:xy,index:Lt,nextTick:Ma,cancelNextTick:ud,detectDirection:Cy,getChild:Ki};te.get=function(t){return t[Tt]};te.mount=function(){for(var t=arguments.length,e=new Array(t),n=0;n<t;n++)e[n]=arguments[n];e[0].constructor===Array&&(e=e[0]),e.forEach(function(r){if(!r.prototype||!r.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(r));r.utils&&(te.utils=wn(wn({},te.utils),r.utils)),_s.mount(r)})};te.create=function(t,e){return new te(t,e)};te.version=BT;var Re=[],Mo,cd,dd=!1,Qu,ec,tl,_o;function lO(){function t(){this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0};for(var e in this)e.charAt(0)==="_"&&typeof this[e]=="function"&&(this[e]=this[e].bind(this))}return t.prototype={dragStarted:function(e){var n=e.originalEvent;this.sortable.nativeDraggable?ve(document,"dragover",this._handleAutoScroll):this.options.supportPointer?ve(document,"pointermove",this._handleFallbackAutoScroll):n.touches?ve(document,"touchmove",this._handleFallbackAutoScroll):ve(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var n=e.originalEvent;!this.options.dragOverBubble&&!n.rootEl&&this._handleAutoScroll(n)},drop:function(){this.sortable.nativeDraggable?me(document,"dragover",this._handleAutoScroll):(me(document,"pointermove",this._handleFallbackAutoScroll),me(document,"touchmove",this._handleFallbackAutoScroll),me(document,"mousemove",this._handleFallbackAutoScroll)),Pf(),_a(),qT()},nulling:function(){tl=cd=Mo=dd=_o=Qu=ec=null,Re.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,n){var r=this,i=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,s=document.elementFromPoint(i,o);if(tl=e,n||this.options.forceAutoScrollFallback||Ms||Un||Vo){tc(e,this.options,s,n);var a=sr(s,!0);dd&&(!_o||i!==Qu||o!==ec)&&(_o&&Pf(),_o=setInterval(function(){var l=sr(document.elementFromPoint(i,o),!0);l!==a&&(a=l,_a()),tc(e,r.options,l,n)},10),Qu=i,ec=o)}else{if(!this.options.bubbleScroll||sr(s,!0)===yn()){_a();return}tc(e,this.options,sr(s,!1),!1)}}},jn(t,{pluginName:"scroll",initializeByDefault:!0})}function _a(){Re.forEach(function(t){clearInterval(t.pid)}),Re=[]}function Pf(){clearInterval(_o)}var tc=ky(function(t,e,n,r){if(e.scroll){var i=(t.touches?t.touches[0]:t).clientX,o=(t.touches?t.touches[0]:t).clientY,s=e.scrollSensitivity,a=e.scrollSpeed,l=yn(),u=!1,c;cd!==n&&(cd=n,_a(),Mo=e.scroll,c=e.scrollFn,Mo===!0&&(Mo=sr(n,!0)));var d=0,h=Mo;do{var p=h,f=Be(p),m=f.top,g=f.bottom,y=f.left,b=f.right,k=f.width,v=f.height,w=void 0,x=void 0,S=p.scrollWidth,N=p.scrollHeight,A=ee(p),C=p.scrollLeft,_=p.scrollTop;p===l?(w=k<S&&(A.overflowX==="auto"||A.overflowX==="scroll"||A.overflowX==="visible"),x=v<N&&(A.overflowY==="auto"||A.overflowY==="scroll"||A.overflowY==="visible")):(w=k<S&&(A.overflowX==="auto"||A.overflowX==="scroll"),x=v<N&&(A.overflowY==="auto"||A.overflowY==="scroll"));var L=w&&(Math.abs(b-i)<=s&&C+k<S)-(Math.abs(y-i)<=s&&!!C),W=x&&(Math.abs(g-o)<=s&&_+v<N)-(Math.abs(m-o)<=s&&!!_);if(!Re[d])for(var q=0;q<=d;q++)Re[q]||(Re[q]={});(Re[d].vx!=L||Re[d].vy!=W||Re[d].el!==p)&&(Re[d].el=p,Re[d].vx=L,Re[d].vy=W,clearInterval(Re[d].pid),(L!=0||W!=0)&&(u=!0,Re[d].pid=setInterval(function(){r&&this.layer===0&&te.active._onTouchMove(tl);var K=Re[this.layer].vy?Re[this.layer].vy*a:0,J=Re[this.layer].vx?Re[this.layer].vx*a:0;typeof c=="function"&&c.call(te.dragged.parentNode[Tt],J,K,t,tl,Re[this.layer].el)!=="continue"||wy(Re[this.layer].el,J,K)}.bind({layer:d}),24))),d++}while(e.bubbleScroll&&h!==l&&(h=sr(h,!1)));dd=u}},30),Ay=function(t){var e=t.originalEvent,n=t.putSortable,r=t.dragEl,i=t.activeSortable,o=t.dispatchSortableEvent,s=t.hideGhostForTarget,a=t.unhideGhostForTarget;if(e){var l=n||i;s();var u=e.changedTouches&&e.changedTouches.length?e.changedTouches[0]:e,c=document.elementFromPoint(u.clientX,u.clientY);a(),l&&!l.el.contains(c)&&(o("spill"),this.onSpill({dragEl:r,putSortable:n}))}};function Pp(){}Pp.prototype={startIndex:null,dragStart:function(t){var e=t.oldDraggableIndex;this.startIndex=e},onSpill:function(t){var e=t.dragEl,n=t.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var r=Ki(this.sortable.el,this.startIndex,this.options);r?this.sortable.el.insertBefore(e,r):this.sortable.el.appendChild(e),this.sortable.animateAll(),n&&n.animateAll()},drop:Ay};jn(Pp,{pluginName:"revertOnSpill"});function Fp(){}Fp.prototype={onSpill:function(t){var e=t.dragEl,n=t.putSortable,r=n||this.sortable;r.captureAnimationState(),e.parentNode&&e.parentNode.removeChild(e),r.animateAll()},drop:Ay};jn(Fp,{pluginName:"removeOnSpill"});te.mount(new lO);te.mount(Fp,Pp);function nc(t){t.parentElement!==null&&t.parentElement.removeChild(t)}function Ff(t,e,n){const r=n===0?t.children[0]:t.children[n-1].nextSibling;t.insertBefore(e,r)}function uO(){return typeof window<"u"?window.console:global.console}const cO=uO();function dO(t){const e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}const pO=/-(\w)/g,hO=dO(t=>t.replace(pO,(e,n)=>n.toUpperCase())),My=["Start","Add","Remove","Update","End"],_y=["Choose","Unchoose","Sort","Filter","Clone"],Dy=["Move"],fO=[Dy,My,_y].flatMap(t=>t).map(t=>`on${t}`),pd={manage:Dy,manageAndEmit:My,emit:_y};function mO(t){return fO.indexOf(t)!==-1}const gO=["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","math","menu","menuitem","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rb","rp","rt","rtc","ruby","s","samp","script","section","select","slot","small","source","span","strong","style","sub","summary","sup","svg","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"];function vO(t){return gO.includes(t)}function yO(t){return["transition-group","TransitionGroup"].includes(t)}function Ny(t){return["id","class","role","style"].includes(t)||t.startsWith("data-")||t.startsWith("aria-")||t.startsWith("on")}function Iy(t){return t.reduce((e,[n,r])=>(e[n]=r,e),{})}function bO({$attrs:t,componentData:e={}}){return{...Iy(Object.entries(t).filter(([n,r])=>Ny(n))),...e}}function kO({$attrs:t,callBackBuilder:e}){const n=Iy(Ry(t));Object.entries(e).forEach(([i,o])=>{pd[i].forEach(s=>{n[`on${s}`]=o(s)})});const r=`[data-draggable]${n.draggable||""}`;return{...n,draggable:r}}function Ry(t){return Object.entries(t).filter(([e,n])=>!Ny(e)).map(([e,n])=>[hO(e),n]).filter(([e,n])=>!mO(e))}const Lf=({el:t})=>t,wO=(t,e)=>t.__draggable_context=e,Vf=t=>t.__draggable_context;class xO{constructor({nodes:{header:e,default:n,footer:r},root:i,realList:o}){this.defaultNodes=n,this.children=[...e,...n,...r],this.externalComponent=i.externalComponent,this.rootTransition=i.transition,this.tag=i.tag,this.realList=o}get _isRootComponent(){return this.externalComponent||this.rootTransition}render(e,n){const{tag:r,children:i,_isRootComponent:o}=this;return e(r,n,o?{default:()=>i}:i)}updated(){const{defaultNodes:e,realList:n}=this;e.forEach((r,i)=>{wO(Lf(r),{element:n[i],index:i})})}getUnderlyingVm(e){return Vf(e)}getVmIndexFromDomIndex(e,n){const{defaultNodes:r}=this,{length:i}=r,o=n.children,s=o.item(e);if(s===null)return i;const a=Vf(s);if(a)return a.index;if(i===0)return 0;const l=Lf(r[0]),u=[...o].findIndex(c=>c===l);return e<u?0:i}}function EO(t,e){const n=t[e];return n?n():[]}function CO({$slots:t,realList:e,getKey:n}){const r=e||[],[i,o]=["header","footer"].map(l=>EO(t,l)),{item:s}=t;if(!s)throw new Error("draggable element must have an item slot");const a=r.flatMap((l,u)=>s({element:l,index:u}).map(c=>(c.key=n(l),c.props={...c.props||{},"data-draggable":!0},c)));if(a.length!==r.length)throw new Error("Item slot must have only one child");return{header:i,footer:o,default:a}}function SO(t){const e=yO(t),n=!vO(t)&&!e;return{transition:e,externalComponent:n,tag:n?Ck(t):e?Sk:t}}function TO({$slots:t,tag:e,realList:n,getKey:r}){const i=CO({$slots:t,realList:n,getKey:r}),o=SO(e);return new xO({nodes:i,root:o,realList:n})}function Py(t,e){kr(()=>this.$emit(t.toLowerCase(),e))}function Fy(t){return(e,n)=>{if(this.realList!==null)return this[`onDrag${t}`](e,n)}}function OO(t){const e=Fy.call(this,t);return(n,r)=>{e.call(this,n,r),Py.call(this,t,n)}}let rc=null;const AO={list:{type:Array,required:!1,default:null},modelValue:{type:Array,required:!1,default:null},itemKey:{type:[String,Function],required:!0},clone:{type:Function,default:t=>t},tag:{type:String,default:"div"},move:{type:Function,default:null},componentData:{type:Object,required:!1,default:null}},MO=["update:modelValue","change",...[...pd.manageAndEmit,...pd.emit].map(t=>t.toLowerCase())],Ly=Q({name:"draggable",inheritAttrs:!1,props:AO,emits:MO,data(){return{error:!1}},render(){try{this.error=!1;const{$slots:t,$attrs:e,tag:n,componentData:r,realList:i,getKey:o}=this,s=TO({$slots:t,tag:n,realList:i,getKey:o});this.componentStructure=s;const a=bO({$attrs:e,componentData:r});return s.render(ns,a)}catch(t){return this.error=!0,ns("pre",{style:{color:"red"}},t.stack)}},created(){this.list!==null&&this.modelValue!==null&&cO.error("modelValue and list props are mutually exclusive! Please set one or another.")},mounted(){if(this.error)return;const{$attrs:t,$el:e,componentStructure:n}=this;n.updated();const r=kO({$attrs:t,callBackBuilder:{manageAndEmit:o=>OO.call(this,o),emit:o=>Py.bind(this,o),manage:o=>Fy.call(this,o)}}),i=e.nodeType===1?e:e.parentElement;this._sortable=new te(i,r),this.targetDomElement=i,i.__draggable_component__=this},updated(){this.componentStructure.updated()},beforeUnmount(){this._sortable!==void 0&&this._sortable.destroy()},computed:{realList(){const{list:t}=this;return t||this.modelValue},getKey(){const{itemKey:t}=this;return typeof t=="function"?t:e=>e[t]}},watch:{$attrs:{handler(t){const{_sortable:e}=this;e&&Ry(t).forEach(([n,r])=>{e.option(n,r)})},deep:!0}},methods:{getUnderlyingVm(t){return this.componentStructure.getUnderlyingVm(t)||null},getUnderlyingPotencialDraggableComponent(t){return t.__draggable_component__},emitChanges(t){kr(()=>this.$emit("change",t))},alterList(t){if(this.list){t(this.list);return}const e=[...this.modelValue];t(e),this.$emit("update:modelValue",e)},spliceList(){const t=e=>e.splice(...arguments);this.alterList(t)},updatePosition(t,e){const n=r=>r.splice(e,0,r.splice(t,1)[0]);this.alterList(n)},getRelatedContextFromMoveEvent({to:t,related:e}){const n=this.getUnderlyingPotencialDraggableComponent(t);if(!n)return{component:n};const r=n.realList,i={list:r,component:n};return t!==e&&r?{...n.getUnderlyingVm(e)||{},...i}:i},getVmIndexFromDomIndex(t){return this.componentStructure.getVmIndexFromDomIndex(t,this.targetDomElement)},onDragStart(t){this.context=this.getUnderlyingVm(t.item),t.item._underlying_vm_=this.clone(this.context.element),rc=t.item},onDragAdd(t){const e=t.item._underlying_vm_;if(e===void 0)return;nc(t.item);const n=this.getVmIndexFromDomIndex(t.newIndex);this.spliceList(n,0,e);const r={element:e,newIndex:n};this.emitChanges({added:r})},onDragRemove(t){if(Ff(this.$el,t.item,t.oldIndex),t.pullMode==="clone"){nc(t.clone);return}const{index:e,element:n}=this.context;this.spliceList(e,1);const r={element:n,oldIndex:e};this.emitChanges({removed:r})},onDragUpdate(t){nc(t.item),Ff(t.from,t.item,t.oldIndex);const e=this.context.index,n=this.getVmIndexFromDomIndex(t.newIndex);this.updatePosition(e,n);const r={element:this.context.element,oldIndex:e,newIndex:n};this.emitChanges({moved:r})},computeFutureIndex(t,e){if(!t.element)return 0;const n=[...e.to.children].filter(o=>o.style.display!=="none"),r=n.indexOf(e.related),i=t.component.getVmIndexFromDomIndex(r);return n.indexOf(rc)!==-1||!e.willInsertAfter?i:i+1},onDragMove(t,e){const{move:n,realList:r}=this;if(!n||!r)return!0;const i=this.getRelatedContextFromMoveEvent(t),o=this.computeFutureIndex(i,t),s={...this.context,futureIndex:o},a={...t,relatedContext:i,draggedContext:s};return n(a,e)},onDragEnd(){rc=null}}}),_O={key:0,class:"k-media__label-wrapper"},DO={key:1,class:"k-media__sublabel"},TL=Q({__name:"Media",props:{modelValue:{},types:{default:()=>["Image"]},label:{},sublabel:{},multiple:{type:Boolean},sortable:{type:Boolean,default:!0},upload:{type:Function,default:()=>(t,e,n)=>(console.warn("[@kvass-ui/media]: You need to setup the upload function before using this component!"),e(50),new Promise((r,i)=>{let o=new FileReader;o.onloadend=function(){r({url:o.result,type:t.type})},o.readAsDataURL(t)}))},size:{default:"cover"},placement:{default:"outside"},uploadOptions:{default:()=>({})},description:{type:Boolean,default:!0},dropMessage:{default:"Drag an image here or <b>browse</b> to upload."},type:{default:"file"},accept:{default:"image/*"},labels:{default:()=>({cancel:"Cancel",save:"Save",selectMessage:"Select a type from the menu",select:"Select",descriptionPlaceholder:"Add caption...",image:{createLabel:"Image"}})},required:{type:Boolean},disabled:{type:Boolean},thumbnailSize:{default:"4rem"}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=X(null),o=I(()=>i.value?n.modelValue instanceof Array?n.modelValue.find(p=>{var f;return p.url===((f=i.value)==null?void 0:f.url)}):n.modelValue:null),s=I({get(){return n.modelValue?(n.modelValue instanceof Array?n.modelValue:[n.modelValue]).map(p=>{var f;return{...p,selected:((f=i.value)==null?void 0:f.url)===p.url,typeConfig:a.value.find(m=>m.condition(p))}}):[]},set(p){n.multiple&&r("update:modelValue",p.map(f=>{let{selected:m,typeConfig:g,...y}=f;return y}))}}),a=I(()=>n.types.map(p=>typeof p=="string"?PT[p]:p).filter(Boolean));Ee(()=>n.modelValue,(p,f)=>{(!i.value||!s.value.find(m=>{var g;return m.url===((g=i.value)==null?void 0:g.url)}))&&l()},{immediate:!0});function l(p){return!n.modelValue||n.multiple&&!n.modelValue.length?i.value=null:p?i.value=p:i.value=s.value[0]}function u(p){var f;let{selected:m,typeConfig:g,...y}=p;r("update:modelValue",n.multiple?(n.modelValue||[]).filter(b=>b.url!==y.url):null),((f=i?.value)==null?void 0:f.url)===p.url&&kr(()=>{l()})}function c(p){r("update:modelValue",n.multiple?[...n.modelValue||[],p]:p),kr(()=>l(s.value.find(f=>f.url===p.url)))}function d(p){r("update:modelValue",p)}const h=rn("k-media",{variants:{placement:{outside:"k-media--placement-outside",inside:"k-media--placement-inside"}}});return(p,f)=>(E(),O("div",{class:Ce(B(h)({placement:p.placement}))},[p.label||p.sublabel||p.$slots.sublabel||p.$slots.label?(E(),O("div",_O,[p.label||p.$slots.label?(E(),O("label",{key:0,class:Ce(["k-media__label",{"k-media__label-required":p.required}])},[F(p.$slots,"label",{},()=>[$e(oe(p.label),1)])],2)):R("",!0),p.sublabel||p.$slots.sublabel?(E(),O("span",DO,[F(p.$slots,"sublabel",{},()=>[$e(oe(p.sublabel),1)])])):R("",!0)])):R("",!0),he(_T,{type:p.type,accept:p.accept,ref:"input",value:p.modelValue,multiple:p.multiple,required:p.required,onSelect:l,onRemove:u,onInput:d,selected:i.value,disabled:p.disabled,"upload-options":p.uploadOptions,upload:p.upload,dropMessage:p.dropMessage},Cs({default:Z(({openFileWindow:m})=>[he(yT,{onOpenFileWindow:m,ref:"typeSelector",value:a.value,onAdd:c,labels:p.labels,upload:p.upload},null,8,["onOpenFileWindow","value","labels","upload"])]),"drop-message":Z(()=>[F(p.$slots,"drop-message")]),"custom-message":Z(()=>[F(p.$slots,"custom-message")]),_:2},[i.value?{name:"preview",fn:Z(()=>[p.description&&o.value?(E(),$(bT,{key:0,modelValue:o.value.description,"onUpdate:modelValue":f[0]||(f[0]=m=>o.value.description=m),disabled:p.disabled,placeholder:p.labels.descriptionPlaceholder},null,8,["modelValue","disabled","placeholder"])):R("",!0),(E(),$(Qe(i.value.typeConfig.components.Preview),{value:i.value,size:p.size},null,8,["value","size"]))]),key:"0"}:void 0]),1032,["type","accept","value","multiple","required","selected","disabled","upload-options","upload","dropMessage"]),F(p.$slots,"bottom"),p.multiple?(E(),$(B(Ly),{key:1,modelValue:s.value,"onUpdate:modelValue":f[1]||(f[1]=m=>s.value=m),sort:p.sortable&&!p.disabled,class:"k-media__thumbnails","item-key":"url",animation:200,onEnd:f[2]||(f[2]=(m,g)=>{i.value=s.value[m.newIndex]})},{item:Z(({element:m,index:g})=>[(E(),$(mT,{onKeydown:op(y=>i.value=m,["enter"]),tabindex:"0",size:p.thumbnailSize,key:m.url,value:m,disabled:p.disabled,onClick:y=>i.value=m,onDelete:y=>u(m)},null,8,["onKeydown","size","value","disabled","onClick","onDelete"]))]),_:1},8,["modelValue","sort"])):R("",!0)],2))}});var NO=Ln("switch").parts("root","label","control","thumb"),aa=NO.build(),Vy=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`switch:${t.id}`},Bf=t=>{var e;return((e=t.ids)==null?void 0:e.label)??`switch:${t.id}:label`},IO=t=>{var e;return((e=t.ids)==null?void 0:e.thumb)??`switch:${t.id}:thumb`},RO=t=>{var e;return((e=t.ids)==null?void 0:e.control)??`switch:${t.id}:control`},hd=t=>{var e;return((e=t.ids)==null?void 0:e.hiddenInput)??`switch:${t.id}:input`},PO=t=>t.getById(Vy(t)),Do=t=>t.getById(hd(t));function FO(t,e){const{context:n,send:r,prop:i,scope:o}=t,s=i("disabled"),a=i("readOnly"),l=!!n.get("checked"),u=!s&&n.get("focused"),c=!s&&n.get("focusVisible"),d={"data-active":G(n.get("active")),"data-focus":G(u),"data-focus-visible":G(c),"data-readonly":G(a),"data-hover":G(n.get("hovered")),"data-disabled":G(s),"data-state":l?"checked":"unchecked","data-invalid":G(i("invalid"))};return{checked:l,disabled:s,focused:u,setChecked(h){r({type:"CHECKED.SET",checked:h,isTrusted:!1})},toggleChecked(){r({type:"CHECKED.TOGGLE",checked:l,isTrusted:!1})},getRootProps(){return e.label({...aa.root.attrs,...d,dir:i("dir"),id:Vy(o),htmlFor:hd(o),onPointerMove(){s||r({type:"CONTEXT.SET",context:{hovered:!0}})},onPointerLeave(){s||r({type:"CONTEXT.SET",context:{hovered:!1}})},onClick(h){s||ct(h)===Do(o)&&h.stopPropagation()}})},getLabelProps(){return e.element({...aa.label.attrs,...d,dir:i("dir"),id:Bf(o)})},getThumbProps(){return e.element({...aa.thumb.attrs,...d,dir:i("dir"),id:IO(o),"aria-hidden":!0})},getControlProps(){return e.element({...aa.control.attrs,...d,dir:i("dir"),id:RO(o),"aria-hidden":!0})},getHiddenInputProps(){return e.input({id:hd(o),type:"checkbox",required:i("required"),defaultChecked:l,disabled:s,"aria-labelledby":Bf(o),"aria-invalid":i("invalid"),name:i("name"),form:i("form"),value:i("value"),style:bp,onFocus(){const h=is();r({type:"CONTEXT.SET",context:{focused:!0,focusVisible:h}})},onBlur(){r({type:"CONTEXT.SET",context:{focused:!1,focusVisible:!1}})},onClick(h){if(a){h.preventDefault();return}const p=h.currentTarget.checked;r({type:"CHECKED.SET",checked:p,isTrusted:!0})}})}}}var{not:$f}=eu(),LO={props({props:t}){return{defaultChecked:!1,label:"switch",value:"on",...t}},initialState(){return"ready"},context({prop:t,bindable:e}){return{checked:e(()=>({defaultValue:t("defaultChecked"),value:t("checked"),onChange(n){var r;(r=t("onCheckedChange"))==null||r({checked:n})}})),fieldsetDisabled:e(()=>({defaultValue:!1})),focusVisible:e(()=>({defaultValue:!1})),active:e(()=>({defaultValue:!1})),focused:e(()=>({defaultValue:!1})),hovered:e(()=>({defaultValue:!1}))}},computed:{isDisabled:({context:t,prop:e})=>e("disabled")||t.get("fieldsetDisabled")},watch({track:t,prop:e,context:n,action:r}){t([()=>e("disabled")],()=>{r(["removeFocusIfNeeded"])}),t([()=>n.get("checked")],()=>{r(["syncInputElement"])})},effects:["trackFormControlState","trackPressEvent","trackFocusVisible"],on:{"CHECKED.TOGGLE":[{guard:$f("isTrusted"),actions:["toggleChecked","dispatchChangeEvent"]},{actions:["toggleChecked"]}],"CHECKED.SET":[{guard:$f("isTrusted"),actions:["setChecked","dispatchChangeEvent"]},{actions:["setChecked"]}],"CONTEXT.SET":{actions:["setContext"]}},states:{ready:{}},implementations:{guards:{isTrusted:({event:t})=>!!t.isTrusted},effects:{trackPressEvent({computed:t,scope:e,context:n}){if(!t("isDisabled"))return pv({pointerNode:PO(e),keyboardNode:Do(e),isValidKey:r=>r.key===" ",onPress:()=>n.set("active",!1),onPressStart:()=>n.set("active",!0),onPressEnd:()=>n.set("active",!1)})},trackFocusVisible({computed:t,scope:e}){if(!t("isDisabled"))return kp({root:e.getRootNode()})},trackFormControlState({context:t,send:e,scope:n}){return Yl(Do(n),{onFieldsetDisabledChange(r){t.set("fieldsetDisabled",r)},onFormReset(){const r=t.initial("checked");e({type:"CHECKED.SET",checked:!!r,src:"form-reset"})}})}},actions:{setContext({context:t,event:e}){for(const n in e.context)t.set(n,e.context[n])},syncInputElement({context:t,scope:e}){const n=Do(e);n&&mp(n,!!t.get("checked"))},removeFocusIfNeeded({context:t,prop:e}){e("disabled")&&t.set("focused",!1)},setChecked({context:t,event:e}){t.set("checked",e.checked)},toggleChecked({context:t}){t.set("checked",!t.get("checked"))},dispatchChangeEvent({context:t,scope:e}){const n=Do(e);gp(n,{checked:t.get("checked")})}}}};Wn()(["checked","defaultChecked","dir","disabled","form","getRootNode","id","ids","invalid","label","name","onCheckedChange","readOnly","required","value"]);const VO={class:"k-switch__label"},OL=Q({__name:"Switch",props:{modelValue:{type:Boolean},disabled:{type:Boolean},getRootNode:{type:Function},labels:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=pi(LO,{id:Qt(),...n,defaultChecked:n.modelValue,onCheckedChange:({checked:s})=>r("update:modelValue",s)}),o=I(()=>FO(i,di));return Ee(()=>n.modelValue,()=>{if(o.value.checked!==n.modelValue)return o.value.setChecked(n.modelValue)}),(s,a)=>(E(),O("label",ne({class:"k-switch"},o.value.getRootProps()),[z("input",be(Ie(o.value.getHiddenInputProps())),null,16),z("span",be(Ie(o.value.getControlProps())),[z("span",be(Ie(o.value.getThumbProps())),null,16)],16),s.labels||s.$slots.default?(E(),O("span",be(ne({key:0},o.value.getLabelProps())),[z("span",VO,[F(s.$slots,"default",{checked:o.value.checked},()=>[$e(oe(o.value.checked?s.labels.on:s.labels.off),1)])])],16)):R("",!0)],16))}}),AL=Q({__name:"LazyLoad",props:{wrapperTag:{default:"div"},threshold:{default:0},observerRoot:{default:null}},emits:["intersect"],setup(t,{emit:e}){const n=t,r=e,i=X(!1);function o(u){const c=u[0];c.isIntersecting&&(i.value=!0,kr(()=>{r("intersect",c),l()}))}const s=X(),a=X();qn(()=>{s.value=new IntersectionObserver(o,{root:n.observerRoot,threshold:n.threshold}),s.value.observe(a.value)}),ao(()=>{l()});function l(){s.value&&s.value.disconnect()}return(u,c)=>(E(),$(Qe(u.wrapperTag),{ref_key:"rootRef",ref:a,class:"k-lazyload"},{default:Z(()=>[i.value?F(u.$slots,"default",{key:0}):F(u.$slots,"placeholder",{key:1})]),_:3},512))}}),BO={class:"k-file-uploader__bar"},$O={class:"k-file-uploader__meta"},jO={key:0},zO={key:1},HO=Q({__name:"Uploader",props:{value:{},bytes:{},current:{default:1},total:{default:1}},setup(t){const e=t,n=I(()=>e.total>1),r=I(()=>Np(e.bytes)),i=I(()=>Math.floor(e.value));return(o,s)=>(E(),$(ni,{class:"k-file-uploader",align:"center",justify:"space-between",gap:"0rem"},{default:Z(()=>[z("div",null,oe(i.value)+" %",1),z("div",BO,[z("div",{class:"k-file-uploader__bar-value",style:Cr({width:o.value+"%"})},null,4)]),z("div",$O,[n.value?(E(),O("div",jO,oe(o.current)+" / "+oe(o.total),1)):R("",!0),o.bytes?(E(),O("div",zO,"("+oe(r.value)+")",1)):R("",!0)])]),_:1}))}}),qO=["innerHTML"],jf=Q({__name:"SlotHandler",props:{value:{}},setup(t){const e=t,n=I(()=>typeof e.value=="string"?e.value:void 0),r=I(()=>typeof e.value=="string"?"div":e.value);return(i,o)=>(E(),$(Qe(r.value),be(Ie(i.$attrs)),{default:Z(()=>[n.value?(E(),O("span",{key:0,innerHTML:n.value},null,8,qO)):R("",!0)]),_:1},16))}}),WO={class:"k-file-droparea__instruction"},UO=["accept","required","disabled","multiple"],KO={key:0,class:"k-file-droparea__max-size"},GO=Q({__name:"DropArea",props:{value:{},multiple:{type:Boolean},upload:{},uploadOptions:{},accept:{},dropMessage:{},fileSizeError:{},disabled:{type:Boolean},required:{type:Boolean},rename:{type:Boolean},labels:{}},emits:["input"],setup(t,{emit:e}){const n=t,r=e,i=X(!1),o=X(!0),s=X(),a=X(!1),l=I(()=>!!n.required),u=I(()=>n.disabled),c=I(()=>!u.value&&!p.total),d=I(()=>hT(n.accept)),{run:h,queue:p}=new my(n);function f(S){return h(S).then(N=>{!N||!N.length||r("input",n.multiple?[...n.value||[],...N]:N[0])})}function m(S){if(!S)return 0;const N={bytes:1,b:1,kb:1024,mb:1024**2,gb:1024**3,tb:1024**4,pb:1024**5},A=S.trim().toLowerCase().match(/^([\d.]+)\s*(bytes|b|kb|mb|gb|tb|pb)$/);if(!A)throw new Error("Invalid size format");const C=parseFloat(A[1]),_=A[2];return Math.round(C*N[_])}function g(){return o.value=!1,a.value=!0,setTimeout(()=>{w()},1500)}function y(S=0){var N;return m((N=n?.uploadOptions)==null?void 0:N.maxSize)<S}async function b(S){var N;if(u.value)return;let A=S.target.files||[];if(Array.from(A).some(C=>y(C.size))&&(N=n.uploadOptions)!=null&&N.maxSize)return g();n.uploadOptions.preTransform&&(A=await n.uploadOptions.preTransform(S)),f(A),s.value&&(s.value.value="")}async function k(S){var N,A;if(u.value||!s.value)return;S.preventDefault();let C=(N=S.dataTransfer)==null?void 0:N.files;if(C!=null&&C.length){if(Array.from(C).some(_=>y(_.size))&&(A=n.uploadOptions)!=null&&A.maxSize)return g();if(!o.value)return w();w(),n.uploadOptions.preTransform&&(C=await n.uploadOptions.preTransform(S)),C!=null&&C.length&&(s.value.files=S.dataTransfer.files,s.value.dispatchEvent(new InputEvent("input")),f(C))}}function v(S){if(u.value||!S.dataTransfer)return;const N=Array.from(S.dataTransfer.items).every(C=>Ip(C,n.accept)),A=n.multiple?!0:S.dataTransfer.items.length===1;o.value=N&&A,i.value=!0,S.preventDefault()}function w(){o.value=!0,i.value=!1,a.value=!1}const x=rn("k-file-droparea",{variants:{active:{true:"k-file-droparea--active"},invalid:{true:"k-file-droparea--invalid"},disabled:{true:"k-file-droparea--disabled"}}});return(S,N)=>{var A,C,_;return E(),O(De,null,[z("div",{class:Ce(B(x)({active:i.value,invalid:!o.value,disabled:u.value})),onDrop:k,onDragover:v,onDragleave:w},[F(S.$slots,"preview"),z("div",WO,[c.value?(E(),O("input",{key:0,type:"file",accept:Array.isArray(S.accept)?S.accept.join(","):S.accept,required:l.value,ref_key:"input",ref:s,onChange:b,disabled:!c.value,multiple:S.multiple,class:"k-file-droparea__input"},null,40,UO)):R("",!0),o.value?(E(),O(De,{key:1},[F(S.$slots,"drop-message",{extensions:d.value},()=>[he(jf,{value:S.dropMessage,extensions:d.value},null,8,["value","extensions"])]),(A=n.uploadOptions)!=null&&A.maxSize?(E(),O("div",KO,[z("span",null,oe(`${(C=S.labels)==null?void 0:C.maxSize}: ${(_=n?.uploadOptions)==null?void 0:_.maxSize}`),1)])):R("",!0)],64)):(E(),$(B(Ze),{key:2,icon:"fa-pro-light:ban",style:{"font-size":"2rem"}})),a.value?F(S.$slots,"file-size-error",{key:3,extensions:d.value},()=>[he(jf,{class:"k-file-droparea__file-size-error",value:S.fileSizeError,extensions:d.value},null,8,["value","extensions"])]):R("",!0),F(S.$slots,"custom-message")])],34),B(p).total?(E(),$(HO,{key:0,value:B(p).progress,bytes:B(p).bytes,current:B(p).counter,total:B(p).total},null,8,["value","bytes","current","total"])):R("",!0)],64)}}}),JO=Os?window:void 0;function XO(t){var e;const n=He(t);return(e=n?.$el)!=null?e:n}function YO(...t){const e=[],n=()=>{e.forEach(a=>a()),e.length=0},r=(a,l,u,c)=>(a.addEventListener(l,u,c),()=>a.removeEventListener(l,u,c)),i=I(()=>{const a=Gr(He(t[0])).filter(l=>l!=null);return a.every(l=>typeof l!="string")?a:void 0}),o=Av(()=>{var a,l;return[(l=(a=i.value)==null?void 0:a.map(u=>XO(u)))!=null?l:[JO].filter(u=>u!=null),Gr(He(i.value?t[1]:t[0])),Gr(B(i.value?t[2]:t[1])),He(i.value?t[3]:t[2])]},([a,l,u,c])=>{if(n(),!(a!=null&&a.length)||!(l!=null&&l.length)||!(u!=null&&u.length))return;const d=Ov(c)?{...c}:c;e.push(...a.flatMap(h=>l.flatMap(p=>u.map(f=>r(h,p,f,d)))))},{flush:"post"}),s=()=>{o(),n()};return Ts(n),s}const ZO=Q({name:"UseClipboard",props:["source","read","navigator","copiedDuring","legacy"],setup(t,{slots:e}){const n=sp(K1(t));return()=>{var r;return(r=e.default)==null?void 0:r.call(e,n)}}});function ic(t){return typeof Window<"u"&&t instanceof Window?t.document.documentElement:typeof Document<"u"&&t instanceof Document?t.documentElement:t}function By(t){const e=window.getComputedStyle(t);if(e.overflowX==="scroll"||e.overflowY==="scroll"||e.overflowX==="auto"&&t.clientWidth<t.scrollWidth||e.overflowY==="auto"&&t.clientHeight<t.scrollHeight)return!0;{const n=t.parentNode;return!n||n.tagName==="BODY"?!1:By(n)}}function QO(t){const e=t||window.event,n=e.target;return By(n)?!1:e.touches.length>1?!0:(e.preventDefault&&e.preventDefault(),!1)}const oc=new WeakMap;function eA(t,e=!1){const n=qt(e);let r=null,i="";Ee(z1(t),a=>{const l=ic(He(a));if(l){const u=l;if(oc.get(u)||oc.set(u,u.style.overflow),u.style.overflow!=="hidden"&&(i=u.style.overflow),u.style.overflow==="hidden")return n.value=!0;if(n.value)return u.style.overflow="hidden"}},{immediate:!0});const o=()=>{const a=ic(He(t));!a||n.value||(Qh&&(r=YO(a,"touchmove",l=>{QO(l)},{passive:!1})),a.style.overflow="hidden",n.value=!0)},s=()=>{const a=ic(He(t));!a||!n.value||(Qh&&r?.(),a.style.overflow=i,oc.delete(a),n.value=!1)};return Ts(s),I({get(){return n.value},set(a){a?o():s()}})}function tA(){let t=!1;const e=qt(!1);return(n,r)=>{if(e.value=r.value,t)return;t=!0;const i=eA(n,r.value);Ee(e,o=>i.value=o)}}tA();var nA=Ln("toggle-group").parts("root","item"),zf=nA.build(),nl=t=>{var e;return((e=t.ids)==null?void 0:e.root)??`toggle-group:${t.id}`},rA=(t,e)=>{var n,r;return((r=(n=t.ids)==null?void 0:n.item)==null?void 0:r.call(n,e))??`toggle-group:${t.id}:${e}`},$y=t=>t.getById(nl(t)),vu=t=>{const e=`[data-ownedby='${CSS.escape(nl(t))}']:not([data-disabled])`;return yp($y(t),e)},Hf=t=>yv(vu(t)),iA=t=>bv(vu(t)),oA=(t,e,n)=>Nx(vu(t),e,n),sA=(t,e,n)=>Ix(vu(t),e,n);function aA(t,e){const{context:n,send:r,prop:i,scope:o}=t,s=n.get("value"),a=i("disabled"),l=!i("multiple"),u=i("rovingFocus"),c=i("orientation")==="horizontal";function d(h){const p=rA(o,h.value);return{id:p,disabled:!!(h.disabled||a),pressed:!!s.includes(h.value),focused:n.get("focusedId")===p}}return{value:s,setValue(h){r({type:"VALUE.SET",value:h})},getRootProps(){return e.element({...zf.root.attrs,id:nl(o),dir:i("dir"),role:l?"radiogroup":"group",tabIndex:n.get("isTabbingBackward")?-1:0,"data-disabled":G(a),"data-orientation":i("orientation"),"data-focus":G(n.get("focusedId")!=null),style:{outline:"none"},onMouseDown(){a||r({type:"ROOT.MOUSE_DOWN"})},onFocus(h){a||h.currentTarget===ct(h)&&(n.get("isClickFocus")||n.get("isTabbingBackward")||r({type:"ROOT.FOCUS"}))},onBlur(){a||r({type:"ROOT.BLUR"})}})},getItemState:d,getItemProps(h){const p=d(h),f=p.focused?0:-1;return e.button({...zf.item.attrs,id:p.id,type:"button","data-ownedby":nl(o),"data-focus":G(p.focused),disabled:p.disabled,tabIndex:u?f:void 0,role:l?"radio":void 0,"aria-checked":l?p.pressed:void 0,"aria-pressed":l?void 0:p.pressed,"data-disabled":G(p.disabled),"data-orientation":i("orientation"),dir:i("dir"),"data-state":p.pressed?"on":"off",onFocus(){p.disabled||r({type:"TOGGLE.FOCUS",id:p.id})},onClick(m){p.disabled||(r({type:"TOGGLE.CLICK",id:p.id,value:h.value}),ix()&&m.currentTarget.focus({preventScroll:!0}))},onKeyDown(m){if(m.defaultPrevented||!ax(m)||p.disabled)return;const g={Tab(y){const b=y.shiftKey;r({type:"TOGGLE.SHIFT_TAB",isShiftTab:b})},ArrowLeft(){!u||!c||r({type:"TOGGLE.FOCUS_PREV"})},ArrowRight(){!u||!c||r({type:"TOGGLE.FOCUS_NEXT"})},ArrowUp(){!u||c||r({type:"TOGGLE.FOCUS_PREV"})},ArrowDown(){!u||c||r({type:"TOGGLE.FOCUS_NEXT"})},Home(){u&&r({type:"TOGGLE.FOCUS_FIRST"})},End(){u&&r({type:"TOGGLE.FOCUS_LAST"})}}[ov(m)];g&&(g(m),m.key!=="Tab"&&m.preventDefault())}})}}}var{not:qf,and:lA}=eu(),uA={props({props:t}){return{defaultValue:[],orientation:"horizontal",rovingFocus:!0,loopFocus:!0,...t}},initialState(){return"idle"},context({prop:t,bindable:e}){return{value:e(()=>({defaultValue:t("defaultValue"),value:t("value"),onChange(n){var r;(r=t("onValueChange"))==null||r({value:n})}})),focusedId:e(()=>({defaultValue:null})),isTabbingBackward:e(()=>({defaultValue:!1})),isClickFocus:e(()=>({defaultValue:!1})),isWithinToolbar:e(()=>({defaultValue:!1}))}},computed:{currentLoopFocus:({context:t,prop:e})=>e("loopFocus")&&!t.get("isWithinToolbar")},entry:["checkIfWithinToolbar"],on:{"VALUE.SET":{actions:["setValue"]},"TOGGLE.CLICK":{actions:["setValue"]},"ROOT.MOUSE_DOWN":{actions:["setClickFocus"]}},states:{idle:{on:{"ROOT.FOCUS":{target:"focused",guard:qf(lA("isClickFocus","isTabbingBackward")),actions:["focusFirstToggle","clearClickFocus"]},"TOGGLE.FOCUS":{target:"focused",actions:["setFocusedId"]}}},focused:{on:{"ROOT.BLUR":{target:"idle",actions:["clearIsTabbingBackward","clearFocusedId"]},"TOGGLE.FOCUS":{actions:["setFocusedId"]},"TOGGLE.FOCUS_NEXT":{actions:["focusNextToggle"]},"TOGGLE.FOCUS_PREV":{actions:["focusPrevToggle"]},"TOGGLE.FOCUS_FIRST":{actions:["focusFirstToggle"]},"TOGGLE.FOCUS_LAST":{actions:["focusLastToggle"]},"TOGGLE.SHIFT_TAB":[{guard:qf("isFirstToggleFocused"),target:"idle",actions:["setIsTabbingBackward"]},{actions:["setIsTabbingBackward"]}]}}},implementations:{guards:{isClickFocus:({context:t})=>t.get("isClickFocus"),isTabbingBackward:({context:t})=>t.get("isTabbingBackward"),isFirstToggleFocused:({context:t,scope:e})=>{var n;return t.get("focusedId")===((n=Hf(e))==null?void 0:n.id)}},actions:{setIsTabbingBackward({context:t}){t.set("isTabbingBackward",!0)},clearIsTabbingBackward({context:t}){t.set("isTabbingBackward",!1)},setClickFocus({context:t}){t.set("isClickFocus",!0)},clearClickFocus({context:t}){t.set("isClickFocus",!1)},checkIfWithinToolbar({context:t,scope:e}){var n;const r=(n=$y(e))==null?void 0:n.closest("[role=toolbar]");t.set("isWithinToolbar",!!r)},setFocusedId({context:t,event:e}){t.set("focusedId",e.id)},clearFocusedId({context:t}){t.set("focusedId",null)},setValue({context:t,event:e,prop:n}){h1(e,["value"]);let r=t.get("value");Zx(e.value)?r=e.value:n("multiple")?r=Xx(r,e.value):r=Ss(r,[e.value])?[]:[e.value],t.set("value",r)},focusNextToggle({context:t,scope:e,prop:n}){At(()=>{var r;const i=t.get("focusedId");i&&((r=oA(e,i,n("loopFocus")))==null||r.focus({preventScroll:!0}))})},focusPrevToggle({context:t,scope:e,prop:n}){At(()=>{var r;const i=t.get("focusedId");i&&((r=sA(e,i,n("loopFocus")))==null||r.focus({preventScroll:!0}))})},focusFirstToggle({scope:t}){At(()=>{var e;(e=Hf(t))==null||e.focus({preventScroll:!0})})},focusLastToggle({scope:t}){At(()=>{var e;(e=iA(t))==null||e.focus({preventScroll:!0})})}}}};Wn()(["dir","disabled","getRootNode","id","ids","loopFocus","multiple","onValueChange","orientation","rovingFocus","value","defaultValue"]);Wn()(["value","disabled"]);const jy=Q({__name:"ButtonGroup",props:{modelValue:{},items:{},dropdownItems:{},direction:{default:"horizontal"},multiple:{type:Boolean},disabled:{type:Boolean},getRootNode:{}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e,i=pi(uA,{id:Qt(),...n,orientation:n.direction,defaultValue:n.modelValue,onValueChange:({value:a})=>{r("update:modelValue",a)},rovingFocus:!0,loopFocus:!0}),o=I(()=>aA(i,di)),s=X();return Ee(()=>{var a;return(a=s.value)==null?void 0:a.isOpen},a=>{a||!o.value.value.includes("dropdown")||o.value.setValue(o.value.value.filter(l=>l!=="dropdown"))}),Ee(()=>n.modelValue,a=>{o.value.setValue([...a])},{deep:!1}),(a,l)=>(E(),O("div",ne({class:["k-buttongroup",`k-buttongroup--direction-${a.direction}`]},o.value.getRootProps()),[F(a.$slots,"default",{getItemProps:o.value.getItemProps},()=>[a.items?(E(!0),O(De,{key:0},_t(a.items,({id:u,...c})=>(E(),$(ze,ne({class:"k-buttongroup__item",variant:"tertiary",ref_for:!0},{...c,...o.value.getItemProps({value:u})}),null,16))),256)):R("",!0)]),a.dropdownItems||a.$slots.dropdown?(E(),$(pu,ne({key:0,ref_key:"dropdown",ref:s,keepOpen:!0,items:a.dropdownItems},o.value.getItemProps({value:"dropdown"})),{default:Z(({close:u})=>[F(a.$slots,"dropdown",{close:u,getItemProps:o.value.getItemProps})]),_:3},16,["items"])):R("",!0)],16))}}),cA=["href"],dA={class:"k-file-thumbnail__info"},pA=["value","disabled"],hA={class:"k-file-thumbnail__info-footer"},fA={key:0,class:"k-file-thumbnail__size"},mA=Q({__name:"Thumbnail",props:{value:{},disabled:{type:Boolean},rename:{type:Boolean},sortable:{type:Boolean},disablePreview:{type:Boolean},icons:{},labels:{}},emits:["rename","delete"],setup(t,{emit:e}){const n=[{pattern:/text.*/,icon:"fa-pro-solid:file-alt"},{pattern:/image.*/,icon:"fa-pro-solid:file-image"},{pattern:/pdf/,icon:"fa-pro-solid:file-pdf"},{pattern:/word/,icon:"fa-pro-solid:file-word"},{pattern:/excel/,icon:"fa-pro-solid:file-excel"},{pattern:/powerpoint/,icon:"fa-pro-solid:file-powerpoint"},{pattern:/octet-stream|zip/,icon:"fa-pro-solid:file-archive"}],r=t,i=I(()=>{let p=[...n,...r.icons].find(f=>r.value.type.match(f.pattern));return p?.icon||"fa-pro-solid:file"}),o=I(()=>r.disabled?"a":"div"),s=I(()=>r.disabled?{click:p=>{p.preventDefault(),ad(r.value)}}:{}),a=I(()=>r.disabled?{title:r.disabled?"Download":null}:{});function l(){r.disabled||ad(r.value)}const u=X(),c=X([]),d=X();function h(){var p;(p=u.value)==null||p.blur()}return(p,f)=>(E(),$(Qe(o.value),ne({class:["k-file-thumbnail",{"k-file-thumbnail--clickable":p.disabled}]},a.value,Bg(s.value)),{default:Z(()=>[he(ni,{class:"k-file-thumbnail__preview",gap:"0rem",justify:"center",align:"center"},{default:Z(()=>[F(p.$slots,"icon",{},()=>[!r.disablePreview&&p.value.type.includes("image")?(E(),O("a",{key:0,href:p.value.url,target:"_blank"},[he(au,{class:"k-file-thumbnail__preview-image",src:p.value.url,alt:p.value.name,size:"contain",aspectRatio:"1/1"},null,8,["src","alt"])],8,cA)):(E(),$(B(Ze),{key:1,icon:i.value,class:"k-file-thumbnail__preview-icon"},null,8,["icon"]))])]),_:3}),z("div",dA,[z("input",{type:"text",ref_key:"input",ref:u,class:"k-file-thumbnail__name",value:p.value.name,onKeypress:op(h,["enter"]),disabled:p.disabled||!p.rename,onInput:f[0]||(f[0]=m=>p.$emit("rename",m.target.value))},null,40,pA),z("div",hA,[p.value.size?(E(),O("span",fA,oe(B(Np)(p.value.size)),1)):R("",!0)])]),he(jy,{modelValue:c.value,"onUpdate:modelValue":f[2]||(f[2]=m=>{c.value=m.filter(g=>g!=="download")}),disabled:p.disabled},{default:Z(({getItemProps:m})=>[p.value.url?(E(),$(ze,ne({key:0,is:"a",href:p.value.url,class:"k-file-thumbnail__download",onClick:Ba(l,["prevent"]),icon:"fa-pro-light:arrow-down-to-line",variant:"tertiary"},m({value:"download"})),null,16,["href"])):R("",!0)]),dropdown:Z(({close:m})=>[p.value.url?(E(),$(ze,{key:0,is:"a",href:p.value.url,class:"k-file-thumbnail__download",onClick:Ba(l,["prevent"]),iconRight:"fa-pro-light:arrow-down-to-line",label:p.labels.download,variant:"tertiary"},null,8,["href","label"])):R("",!0),he(B(ZO),null,{default:Z(({copy:g,copied:y})=>[p.value.url?(E(),$(ze,{key:0,class:"k-file-thumbnail__copy",iconRight:"fa-pro-light:copy",label:p.labels.copy,variant:"tertiary",promise:d.value,onClick:()=>{d.value=g(p.value.url)}},null,8,["label","promise","onClick"])):R("",!0)]),_:1}),p.disabled?R("",!0):(E(),$(ze,{key:1,variant:"danger",label:p.labels.delete,class:"k-file-thumbnail__delete",iconRight:"fa-pro-light:times",onClick:f[1]||(f[1]=g=>p.$emit("delete"))},null,8,["label"]))]),_:1},8,["modelValue","disabled"]),p.sortable?(E(),$(B(Ze),{key:0,icon:"fa-pro-solid:arrows-alt-v",class:"k-file-thumbnail__handle"})):R("",!0)]),_:3},16,["class"]))}}),gA={key:0,class:"k-file__label-wrapper"},vA={key:1,class:"k-file__sublabel"},ML=Q({__name:"File",props:{modelValue:{},label:{},sublabel:{},multiple:{type:Boolean},sortable:{type:Boolean,default:!0},upload:{type:Function,default:()=>(t,e,n)=>(console.warn("[@kvass-ui/file]: You need to setup the upload function before using this component!"),e(50),new Promise((r,i)=>{let o=new FileReader;o.onloadend=function(){r({url:o.result,type:t.type})},o.readAsDataURL(t)}))},uploadOptions:{},dropMessage:{default:"Drag a file here or <b>browse</b> to upload."},fileSizeError:{default:"The file size exceeds the allowed limit."},rename:{type:Boolean,default:!0},accept:{},serialize:{type:Function,default:t=>t},required:{type:Boolean},disabled:{type:Boolean},disablePreview:{type:Boolean},icons:{default:()=>[]},labels:{default:()=>({delete:"Delete",download:"Download",copy:"Copy link",maxSize:"Maximum size"})}},emits:["update:modelValue"],setup(t,{emit:e}){const n=t,r=e;function i(u){r("update:modelValue",u)}function o(u){r("update:modelValue",n.multiple?(n.modelValue||[]).filter(c=>c!==u):null)}const s=I(()=>n.multiple||!n.modelValue),a=I({get(){return n.modelValue?n.modelValue instanceof Array?n.modelValue:[n.modelValue]:[]},set(u){n.multiple&&i(u)}}),l=rn("k-file",{variants:{}});return(u,c)=>(E(),O("div",{class:Ce(B(l)({}))},[u.label||u.sublabel||u.$slots.sublabel||u.$slots.label?(E(),O("div",gA,[u.label||u.$slots.label?(E(),O("label",{key:0,class:Ce(["k-file__label",{"k-file__label-required":u.required}])},[F(u.$slots,"label",{},()=>[$e(oe(u.label),1)])],2)):R("",!0),u.sublabel||u.$slots.sublabel?(E(),O("span",vA,[F(u.$slots,"sublabel",{},()=>[$e(oe(u.sublabel),1)])])):R("",!0)])):R("",!0),he(ni,{direction:"column"},{default:Z(()=>[a.value.length?(E(),$(B(Ly),{key:0,modelValue:a.value,"onUpdate:modelValue":c[0]||(c[0]=d=>a.value=d),disabled:!u.multiple||!u.sortable,animation:200,class:"k-file__thumbnails","item-key":"url",handle:".k-file-thumbnail__handle"},{item:Z(({element:d,index:h})=>[(E(),$(mA,{key:d.url,disabled:u.disabled,sortable:!u.disabled&&u.sortable&&u.multiple&&a.value.length>1,"disable-preview":u.disablePreview,rename:u.rename===!0,value:u.serialize(d),onRename:p=>d.name=p,onDelete:p=>o(d),icons:u.icons,labels:u.labels},Cs({_:2},[_t(u.$slots,(p,f)=>({name:f,fn:Z(()=>[F(u.$slots,f,{item:d})])}))]),1032,["disabled","sortable","disable-preview","rename","value","onRename","onDelete","icons","labels"]))]),_:3},8,["modelValue","disabled"])):R("",!0),s.value?(E(),$(GO,{key:1,accept:u.accept,ref:"input",value:u.modelValue,multiple:u.multiple,required:u.required,onInput:i,disabled:u.disabled,"upload-options":u.uploadOptions,upload:u.upload,dropMessage:u.dropMessage,fileSizeError:u.fileSizeError,rename:u.rename,labels:u.labels},{"drop-message":Z(({extensions:d})=>[F(u.$slots,"drop-message",{extensions:d})]),"custom-message":Z(()=>[F(u.$slots,"custom-message")]),_:3},8,["accept","value","multiple","required","disabled","upload-options","upload","dropMessage","fileSizeError","rename","labels"])):R("",!0)]),_:3})],2))}}),zy=new Set,yt=new WeakMap,Gi=new WeakMap,ii=new WeakMap,fd=new WeakMap,yA=new WeakMap,Ji=new WeakMap,rl=new WeakMap,No=new WeakSet;let xr,Lp=0,Vp=0;const Rn="__aa_tgt",us="__aa_del",il="__aa_new",bA=t=>{const e=SA(t);e&&e.forEach(n=>TA(n))},kA=t=>{t.forEach(e=>{e.target===xr&&xA(),yt.has(e.target)&&hi(e.target)})};function wA(t){const e=fd.get(t);e?.disconnect();let n=yt.get(t),r=0;const i=5;n||(n=Xi(t),yt.set(t,n));const{offsetWidth:o,offsetHeight:s}=xr,a=[n.top-i,o-(n.left+i+n.width),s-(n.top+i+n.height),n.left-i].map(u=>`${-1*Math.floor(u)}px`).join(" "),l=new IntersectionObserver(()=>{++r>1&&hi(t)},{root:xr,threshold:1,rootMargin:a});l.observe(t),fd.set(t,l)}function hi(t){clearTimeout(rl.get(t));const e=yu(t),n=cs(e)?500:e.duration;rl.set(t,setTimeout(async()=>{const r=ii.get(t);try{await r?.finished,yt.set(t,Xi(t)),wA(t)}catch{}},n))}function xA(){clearTimeout(rl.get(xr)),rl.set(xr,setTimeout(()=>{zy.forEach(t=>Uy(t,e=>Hy(()=>hi(e))))},100))}function EA(t){setTimeout(()=>{yA.set(t,setInterval(()=>Hy(hi.bind(null,t)),2e3))},Math.round(2e3*Math.random()))}function Hy(t){typeof requestIdleCallback=="function"?requestIdleCallback(()=>t()):requestAnimationFrame(()=>t())}let md,Ho;const CA=typeof window<"u"&&"ResizeObserver"in window;CA&&(xr=document.documentElement,md=new MutationObserver(bA),Ho=new ResizeObserver(kA),window.addEventListener("scroll",()=>{Vp=window.scrollY,Lp=window.scrollX}),Ho.observe(xr));function SA(t){return t.reduce((e,n)=>[...e,...Array.from(n.addedNodes),...Array.from(n.removedNodes)],[]).every(e=>e.nodeName==="#comment")?!1:t.reduce((e,n)=>{if(e===!1)return!1;if(n.target instanceof Element){if(sc(n.target),!e.has(n.target)){e.add(n.target);for(let r=0;r<n.target.children.length;r++){const i=n.target.children.item(r);if(i){if(us in i)return!1;sc(n.target,i),e.add(i)}}}if(n.removedNodes.length)for(let r=0;r<n.removedNodes.length;r++){const i=n.removedNodes[r];if(us in i)return!1;i instanceof Element&&(e.add(i),sc(n.target,i),Gi.set(i,[n.previousSibling,n.nextSibling]))}}return e},new Set)}function sc(t,e){!e&&!(Rn in t)?Object.defineProperty(t,Rn,{value:t}):e&&!(Rn in e)&&Object.defineProperty(e,Rn,{value:t})}function TA(t){var e;const n=t.isConnected,r=yt.has(t);n&&Gi.has(t)&&Gi.delete(t),ii.has(t)&&((e=ii.get(t))===null||e===void 0||e.cancel()),il in t?Wf(t):r&&n?AA(t):r&&!n?MA(t):Wf(t)}function un(t){return Number(t.replace(/[^0-9.\-]/g,""))}function OA(t){let e=t.parentElement;for(;e;){if(e.scrollLeft||e.scrollTop)return{x:e.scrollLeft,y:e.scrollTop};e=e.parentElement}return{x:0,y:0}}function Xi(t){const e=t.getBoundingClientRect(),{x:n,y:r}=OA(t);return{top:e.top+r,left:e.left+n,width:e.width,height:e.height}}function qy(t,e,n){let r=e.width,i=e.height,o=n.width,s=n.height;const a=getComputedStyle(t);if(a.getPropertyValue("box-sizing")==="content-box"){const l=un(a.paddingTop)+un(a.paddingBottom)+un(a.borderTopWidth)+un(a.borderBottomWidth),u=un(a.paddingLeft)+un(a.paddingRight)+un(a.borderRightWidth)+un(a.borderLeftWidth);r-=u,o-=u,i-=l,s-=l}return[r,o,i,s].map(Math.round)}function yu(t){return Rn in t&&Ji.has(t[Rn])?Ji.get(t[Rn]):{duration:250,easing:"ease-in-out"}}function Wy(t){if(Rn in t)return t[Rn]}function Bp(t){const e=Wy(t);return e?No.has(e):!1}function Uy(t,...e){e.forEach(n=>n(t,Ji.has(t)));for(let n=0;n<t.children.length;n++){const r=t.children.item(n);r&&e.forEach(i=>i(r,Ji.has(r)))}}function $p(t){return Array.isArray(t)?t:[t]}function cs(t){return typeof t=="function"}function AA(t){const e=yt.get(t),n=Xi(t);if(!Bp(t))return yt.set(t,n);let r;if(!e)return;const i=yu(t);if(typeof i!="function"){const o=e.left-n.left,s=e.top-n.top,[a,l,u,c]=qy(t,e,n),d={transform:`translate(${o}px, ${s}px)`},h={transform:"translate(0, 0)"};a!==l&&(d.width=`${a}px`,h.width=`${l}px`),u!==c&&(d.height=`${u}px`,h.height=`${c}px`),r=t.animate([d,h],{duration:i.duration,easing:i.easing})}else{const[o]=$p(i(t,"remain",e,n));r=new Animation(o),r.play()}ii.set(t,r),yt.set(t,n),r.addEventListener("finish",hi.bind(null,t))}function Wf(t){il in t&&delete t[il];const e=Xi(t);yt.set(t,e);const n=yu(t);if(!Bp(t))return;let r;if(typeof n!="function")r=t.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:n.duration*1.5,easing:"ease-in"});else{const[i]=$p(n(t,"add",e));r=new Animation(i),r.play()}ii.set(t,r),r.addEventListener("finish",hi.bind(null,t))}function Uf(t,e){var n;t.remove(),yt.delete(t),Gi.delete(t),ii.delete(t),(n=fd.get(t))===null||n===void 0||n.disconnect(),setTimeout(()=>{if(us in t&&delete t[us],Object.defineProperty(t,il,{value:!0,configurable:!0}),e&&t instanceof HTMLElement)for(const r in e)t.style[r]=""},0)}function MA(t){var e;if(!Gi.has(t)||!yt.has(t))return;const[n,r]=Gi.get(t);Object.defineProperty(t,us,{value:!0,configurable:!0});const i=window.scrollX,o=window.scrollY;if(r&&r.parentNode&&r.parentNode instanceof Element?r.parentNode.insertBefore(t,r):n&&n.parentNode?n.parentNode.appendChild(t):(e=Wy(t))===null||e===void 0||e.appendChild(t),!Bp(t))return Uf(t);const[s,a,l,u]=DA(t),c=yu(t),d=yt.get(t);(i!==Lp||o!==Vp)&&_A(t,i,o,c);let h,p={position:"absolute",top:`${s}px`,left:`${a}px`,width:`${l}px`,height:`${u}px`,margin:"0",pointerEvents:"none",transformOrigin:"center",zIndex:"100"};if(!cs(c))Object.assign(t.style,p),h=t.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:c.duration,easing:"ease-out"});else{const[f,m]=$p(c(t,"remove",d));m?.styleReset!==!1&&(p=m?.styleReset||p,Object.assign(t.style,p)),h=new Animation(f),h.play()}ii.set(t,h),h.addEventListener("finish",Uf.bind(null,t,p))}function _A(t,e,n,r){const i=Lp-e,o=Vp-n,s=document.documentElement.style.scrollBehavior;if(getComputedStyle(xr).scrollBehavior==="smooth"&&(document.documentElement.style.scrollBehavior="auto"),window.scrollTo(window.scrollX+i,window.scrollY+o),!t.parentElement)return;const a=t.parentElement;let l=a.clientHeight,u=a.clientWidth;const c=performance.now();function d(){requestAnimationFrame(()=>{if(!cs(r)){const h=l-a.clientHeight,p=u-a.clientWidth;c+r.duration>performance.now()?(window.scrollTo({left:window.scrollX-p,top:window.scrollY-h}),l=a.clientHeight,u=a.clientWidth,d()):document.documentElement.style.scrollBehavior=s}})}d()}function DA(t){const e=yt.get(t),[n,,r]=qy(t,e,Xi(t));let i=t.parentElement;for(;i&&(getComputedStyle(i).position==="static"||i instanceof HTMLBodyElement);)i=i.parentElement;i||(i=document.body);const o=getComputedStyle(i),s=yt.get(i)||Xi(i),a=Math.round(e.top-s.top)-un(o.borderTopWidth),l=Math.round(e.left-s.left)-un(o.borderLeftWidth);return[a,l,n,r]}function NA(t,e={}){return md&&Ho&&(window.matchMedia("(prefers-reduced-motion: reduce)").matches&&!cs(e)&&!e.disrespectUserMotionPreference||(No.add(t),getComputedStyle(t).position==="static"&&Object.assign(t.style,{position:"relative"}),Uy(t,hi,EA,n=>Ho?.observe(n)),cs(e)?Ji.set(t,e):Ji.set(t,{duration:250,easing:"ease-in-out",...e}),md.observe(t,{childList:!0}),zy.add(t))),Object.freeze({parent:t,enable:()=>{No.add(t)},disable:()=>{No.delete(t)},isEnabled:()=>No.has(t)})}const Kf={mounted:(t,e)=>{NA(t,e.value||{})},getSSRProps:()=>({})},IA=["disabled"],RA={key:0,class:"k-expandable__title"},PA={key:1,class:"k-expandable__subtitle"},FA={key:2,class:"k-expandable__actions"},_L=Q({__name:"Expandable",props:{title:{},subtitle:{},disabled:{type:Boolean,default:!1},expandable:{type:Boolean,default:!0},expanded:{type:Boolean,default:!1},variant:{default:"border"},gap:{default:"1rem"}},setup(t){const e=t,n=ip(),r=I(()=>n.actions),i=I(()=>n.footer),o=I(()=>n.default),s=X(e.expanded),a=()=>{!e.expandable||!o.value||(s.value=!s.value)},l=rn("k-expandable",{variants:{disabled:{true:"k-expandable--disabled"},expandable:{true:"k-expandable--expandable"},expanded:{true:"k-expandable--expanded",false:"k-expandable--collapsed"},variant:{shadow:"k-expandable--variant-shadow",flat:"k-expandable--variant-flat",border:"k-expandable--variant-border"}}});return(u,c)=>Va((E(),O("fieldset",{disabled:u.disabled,class:Ce(B(l)({disabled:u.disabled,expandable:u.expandable,expanded:s.value,variant:u.variant}))},[he(ze,{class:Ce(["k-expandable__header",{"k-expandable__header--open":s.value}]),is:"legend",tabindex:"0",onKeydown:op(a,["enter"]),onClick:a,variant:"tertiary"},Cs({default:Z(()=>[u.$slots.title||u.title?(E(),O("span",RA,[F(u.$slots,"title",{},()=>[$e(oe(u.title),1)])])):R("",!0),u.$slots.subtitle||u.subtitle?(E(),O("span",PA,[F(u.$slots,"subtitle",{},()=>[$e(oe(u.subtitle),1)])])):R("",!0),r.value?(E(),O("span",FA,[F(u.$slots,"actions")])):R("",!0)]),_:2},[u.expandable?{name:"icon-left",fn:Z(()=>[he(B(Ze),{class:"k-expandable__icon",icon:s.value?"fa-pro-regular:angle-up":"fa-pro-regular:angle-down"},null,8,["icon"])]),key:"0"}:void 0]),1032,["class"]),s.value&&o.value?(E(),O(De,{key:0},[Va((E(),$(ni,{class:"k-expandable__content",direction:"column",gap:u.gap},{default:Z(()=>[F(u.$slots,"default")]),_:3},8,["gap"])),[[B(Kf)]]),i.value?(E(),$(ni,{key:0,justify:"center",align:"center",class:"k-expandable__footer"},{default:Z(()=>[F(u.$slots,"footer")]),_:3})):R("",!0)],64)):R("",!0)],10,IA)),[[B(Kf)]])}});function Je(t){this.content=t}Je.prototype={constructor:Je,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),o=r.content.slice();return i==-1?o.push(n||t,e):(o[i+1]=e,n&&(o[i]=n)),new Je(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new Je(n)},addToStart:function(t,e){return new Je([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new Je(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),o=r.find(t);return i.splice(o==-1?i.length:o,0,e,n),new Je(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=Je.from(t),t.size?new Je(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=Je.from(t),t.size?new Je(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=Je.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};Je.from=function(t){if(t instanceof Je)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new Je(e)};function Ky(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)n++;return n}if(i.content.size||o.content.size){let s=Ky(i.content,o.content,n+1);if(s!=null)return s}n+=i.nodeSize}}function Gy(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let s=t.child(--i),a=e.child(--o),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let u=0,c=Math.min(s.text.length,a.text.length);for(;u<c&&s.text[s.text.length-u-1]==a.text[a.text.length-u-1];)u++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){let u=Gy(s.content,a.content,n-1,r-1);if(u)return u}n-=l,r-=l}}class M{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,o){for(let s=0,a=0;a<n;s++){let l=this.content[s],u=a+l.nodeSize;if(u>e&&r(l,i+a,o||null,s)!==!1&&l.content.size){let c=a+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,i+c)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=u},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new M(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let o=0,s=0;s<n;o++){let a=this.content[o],l=s+a.nodeSize;l>e&&((s<e||l>n)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),i+=a.nodeSize),s=l}return new M(r,i)}cutByIndex(e,n){return e==n?M.empty:e==0&&n==this.content.length?this:new M(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new M(i,o)}addToStart(e){return new M([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new M(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return Ky(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return Gy(this,e,n,r)}findIndex(e,n=-1){if(e==0)return la(0,e);if(e==this.size)return la(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=e)return s==e||n>0?la(r+1,s):la(r,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return M.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new M(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return M.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new M(n||e,r)}static from(e){if(!e)return M.empty;if(e instanceof M)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new M([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}M.empty=new M([],0);const ac={index:0,offset:0};function la(t,e){return ac.index=t,ac.offset=e,ac}function ol(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!ol(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!ol(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let ke=class gd{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&ol(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return gd.none;if(e instanceof gd)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};ke.none=[];class sl extends Error{}class V{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=Xy(this.content,e+this.openStart,n);return r&&new V(r,this.openStart,this.openEnd)}removeBetween(e,n){return new V(Jy(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return V.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new V(M.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new V(e,r,i)}}V.empty=new V(M.empty,0,0);function Jy(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(i==e||o.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(Jy(o.content,e-i-1,n-i-1)))}function Xy(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),s=t.maybeChild(i);if(o==e||s.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=Xy(s.content,e-o-1,n);return a&&t.replaceChild(i,s.copy(a))}function LA(t,e,n){if(n.openStart>t.depth)throw new sl("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new sl("Inconsistent open depths");return Yy(t,e,n,0)}function Yy(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let s=Yy(t,e,n,r+1);return o.copy(o.content.replaceChild(i,s))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let s=t.parent,a=s.content;return Xr(s,a.cut(0,t.parentOffset).append(n.content).append(a.cut(e.parentOffset)))}else{let{start:s,end:a}=VA(n,t);return Xr(o,Qy(t,s,a,e,r))}else return Xr(o,al(t,e,r))}function Zy(t,e){if(!e.type.compatibleContent(t.type))throw new sl("Cannot join "+e.type.name+" onto "+t.type.name)}function vd(t,e,n){let r=t.node(n);return Zy(r,e.node(n)),r}function Jr(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function qo(t,e,n,r){let i=(e||t).node(n),o=0,s=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&(Jr(t.nodeAfter,r),o++));for(let a=o;a<s;a++)Jr(i.child(a),r);e&&e.depth==n&&e.textOffset&&Jr(e.nodeBefore,r)}function Xr(t,e){return t.type.checkContent(e),t.copy(e)}function Qy(t,e,n,r,i){let o=t.depth>i&&vd(t,e,i+1),s=r.depth>i&&vd(n,r,i+1),a=[];return qo(null,t,i,a),o&&s&&e.index(i)==n.index(i)?(Zy(o,s),Jr(Xr(o,Qy(t,e,n,r,i+1)),a)):(o&&Jr(Xr(o,al(t,e,i+1)),a),qo(e,n,i,a),s&&Jr(Xr(s,al(n,r,i+1)),a)),qo(r,null,i,a),new M(a)}function al(t,e,n){let r=[];if(qo(null,t,n,r),t.depth>n){let i=vd(t,e,n+1);Jr(Xr(i,al(t,e,n+1)),r)}return qo(e,null,n,r),new M(r)}function VA(t,e){let n=e.depth-t.openStart,r=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)r=e.node(i).copy(M.from(r));return{start:r.resolveNoCache(t.openStart+n),end:r.resolveNoCache(r.content.size-t.openEnd-n)}}class ds{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return ke.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let a=r;r=i,i=a}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new ll(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(o),u=o-l;if(r.push(s,a,i+l),!u||(s=s.child(a),s.isText))break;o=u-1,i+=l+1}return new ds(n,r,o)}static resolveCached(e,n){let r=Gf.get(e);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==n)return s}else Gf.set(e,r=new BA);let i=r.elts[r.i]=ds.resolve(e,n);return r.i=(r.i+1)%$A,i}}class BA{constructor(){this.elts=[],this.i=0}}const $A=12,Gf=new WeakMap;class ll{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const jA=Object.create(null);let fr=class yd{constructor(e,n,r,i=ke.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||M.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&ol(this.attrs,n||e.defaultAttrs||jA)&&ke.sameSet(this.marks,r||ke.none)}copy(e=null){return e==this.content?this:new yd(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new yd(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return V.empty;let i=this.resolve(e),o=this.resolve(n),s=r?0:i.sharedDepth(n),a=i.start(s),l=i.node(s).content.cut(i.pos-a,o.pos-a);return new V(l,i.depth-s,o.depth-s)}replace(e,n,r){return LA(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return ds.resolveCached(this,e)}resolveNoCache(e){return ds.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),eb(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=M.empty,i=0,o=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=i;l<o;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),s=o&&o.matchFragment(this.content,n);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=ke.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!ke.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=M.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};fr.prototype.text=void 0;class ul extends fr{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):eb(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new ul(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new ul(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function eb(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class oi{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new zA(e,n);if(r.next==null)return oi.empty;let i=tb(r);r.next&&r.err("Unexpected trailing text");let o=JA(GA(i));return XA(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function o(s,a){let l=s.matchFragment(e,r);if(l&&(!n||l.validEnd))return M.from(a.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:c,next:d}=s.next[u];if(!(c.isText||c.hasRequiredAttrs())&&i.indexOf(d)==-1){i.push(d);let h=o(d,a.concat(c));if(h)return h}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:l}=o.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in n)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),n[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+e.indexOf(r.next[s].next);return o}).join(`
|
|
9
9
|
`)}}oi.empty=new oi(!0);class zA{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function tb(t){let e=[];do e.push(HA(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function HA(t){let e=[];do e.push(qA(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function qA(t){let e=KA(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=WA(t,e);else break;return e}function Jf(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function WA(t,e){let n=Jf(t),r=n;return t.eat(",")&&(t.next!="}"?r=Jf(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function UA(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let s=n[o];s.isInGroup(e)&&i.push(s)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function KA(t){if(t.eat("(")){let e=tb(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=UA(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function GA(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let u={term:l,to:a};return e[s].push(u),u}function i(s,a){s.forEach(l=>l.to=a)}function o(s,a){if(s.type=="choice")return s.exprs.reduce((l,u)=>l.concat(o(u,a)),[]);if(s.type=="seq")for(let l=0;;l++){let u=o(s.exprs[l],a);if(l==s.exprs.length-1)return u;i(u,a=n())}else if(s.type=="star"){let l=n();return r(a,l),i(o(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return i(o(s.expr,a),l),i(o(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(o(s.expr,a));if(s.type=="range"){let l=a;for(let u=0;u<s.min;u++){let c=n();i(o(s.expr,l),c),l=c}if(s.max==-1)i(o(s.expr,l),l);else for(let u=s.min;u<s.max;u++){let c=n();r(l,c),i(o(s.expr,l),c),l=c}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function nb(t,e){return e-t}function Xf(t,e){let n=[];return r(e),n.sort(nb);function r(i){let o=t[i];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(i);for(let s=0;s<o.length;s++){let{term:a,to:l}=o[s];!a&&n.indexOf(l)==-1&&r(l)}}}function JA(t){let e=Object.create(null);return n(Xf(t,0));function n(r){let i=[];r.forEach(s=>{t[s].forEach(({term:a,to:l})=>{if(!a)return;let u;for(let c=0;c<i.length;c++)i[c][0]==a&&(u=i[c][1]);Xf(t,l).forEach(c=>{u||i.push([a,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let o=e[r.join(",")]=new oi(r.indexOf(t.length-1)>-1);for(let s=0;s<i.length;s++){let a=i[s][1].sort(nb);o.next.push({type:i[s][0],next:e[a.join(",")]||n(a)})}return o}}function XA(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],o=!i.validEnd,s=[];for(let a=0;a<i.next.length;a++){let{type:l,next:u}=i.next[a];s.push(l.name),o&&!(l.isText||l.hasRequiredAttrs())&&(o=!1),r.indexOf(u)==-1&&r.push(u)}o&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function rb(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function ib(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let o=t[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function ob(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let o=t[i];o.validate&&o.validate(e[i])}}function sb(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new ZA(t,r,e[r]);return n}let Yf=class ab{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=sb(e,r.attrs),this.defaultAttrs=rb(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==oi.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:ib(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new fr(this,this.computeAttrs(e),M.from(n),ke.setFrom(r))}createChecked(e=null,n,r){return n=M.from(n),this.checkContent(n),new fr(this,this.computeAttrs(e),n,ke.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=M.from(n),n.size){let s=this.contentMatch.fillBefore(n);if(!s)return null;n=s.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(M.empty,!0);return o?new fr(this,e,n.append(o),ke.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){ob(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:ke.none:e}static compile(e,n){let r=Object.create(null);e.forEach((o,s)=>r[o]=new ab(o,n,s));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function YA(t,e,n){let r=n.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}class ZA{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?YA(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class bu{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=sb(e,i.attrs),this.excluded=null;let o=rb(this.attrs);this.instance=o?new ke(this,o):null}create(e=null){return!e&&this.instance?this.instance:new ke(this,ib(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,s)=>r[o]=new bu(o,i++,n,s)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){ob(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class lb{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=Je.from(e.nodes),n.marks=Je.from(e.marks||{}),this.nodes=Yf.compile(this.spec.nodes,this),this.marks=bu.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],s=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=oi.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?Zf(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:Zf(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Yf){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new ul(r,r.defaultAttrs,e,ke.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return fr.fromJSON(this,e)}markFromJSON(e){return ke.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function Zf(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=t.marks[i],s=o;if(o)n.push(o);else for(let a in t.marks){let l=t.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function QA(t){return t.tag!=null}function eM(t){return t.style!=null}class mr{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(QA(i))this.tags.push(i);else if(eM(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new em(this,n,!1);return r.addAll(e,ke.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new em(this,n,!0);return r.addAll(e,ke.none,n.from,n.to),V.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(rM(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(e);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(e,n,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],a=s.style;if(!(a.indexOf(e)!=0||s.context&&!r.matchesContext(s.context)||a.length>e.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<n.length;s++){let a=n[s];if((a.priority==null?50:a.priority)<o)break}n.splice(s,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=tm(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=tm(s)),s.node||s.ignore||s.mark||(s.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new mr(e,mr.schemaRules(e)))}}const ub={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},tM={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},cb={ol:!0,ul:!0},ps=1,bd=2,Da=4;function Qf(t,e,n){return e!=null?(e?ps:0)|(e==="full"?bd:0):t&&t.whitespace=="pre"?ps|bd:n&-5}class ua{constructor(e,n,r,i,o,s){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=ke.none,this.match=o||(s&Da?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(M.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ps)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=M.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(M.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!ub.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class em{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,s=Qf(null,n.preserveWhitespace,0)|(r?Da:0);i?o=new ua(i.type,i.attrs,ke.none,!0,n.topMatch||i.type.contentMatch,s):r?o=new ua(null,null,ke.none,!0,null,s):o=new ua(e.schema.topNodeType,null,ke.none,!0,null,s),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,o=i.options&bd?"full":this.localPreserveWS||(i.options&ps)>0;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)o!=="full"?r=r.replace(/\r?\n|\r/g," "):r=r.replace(/\r\n?/g,`
|
|
10
10
|
`);else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let s=i.content[i.content.length-1],a=e.previousSibling;(!s||a&&a.nodeName=="BR"||s.isText&&/[ \t\r\n\u000c]$/.test(s.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),n),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),a;cb.hasOwnProperty(s)&&this.parser.normalizeLists&&nM(e);let l=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(a=this.parser.matchTag(e,this,r));e:if(l?l.ignore:tM.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,n);else if(!l||l.skip||l.closeParent){l&&l.closeParent?this.open=Math.max(0,this.open-1):l&&l.skip.nodeType&&(e=l.skip);let u,c=this.needsBlock;if(ub.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),u=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let d=l&&l.skip?n:this.readStyles(e,n);d&&this.addAll(e,d),u&&this.sync(o),this.needsBlock=c}else{let u=this.readStyles(e,n);u&&this.addElementByRule(e,l,u,l.consuming===!1?a:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
11
11
|
`),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(o,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?n=n.filter(u=>!l.clearMark(u)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return n}addElementByRule(e,n,r,i){let o,s;if(n.node)if(s=this.parser.schema.nodes[n.node],s.isLeaf)this.insertNode(s.create(n.attrs),r)||this.leafFallback(e,r);else{let l=this.enter(s,n.attrs||null,r,n.preserveWhitespace);l&&(o=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l,r));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l,r),this.findAround(e,l,!1)}o&&this.sync(a)&&this.open--}addAll(e,n,r,i){let o=r||0;for(let s=r?e.childNodes[r]:e.firstChild,a=i==null?null:e.childNodes[i];s!=a;s=s.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(s,n);this.findAtPoint(e,o)}findPlace(e,n){let r,i;for(let o=this.open;o>=0;o--){let s=this.nodes[o],a=s.findWrapping(e);if(a&&(!r||r.length>a.length)&&(r=a,i=s,!a.length)||s.solid)break}if(!r)return null;this.sync(i);for(let o=0;o<r.length;o++)n=this.enterInner(r[o],null,n,!1);return n}insertNode(e,n){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(n=this.enterInner(i,null,n))}let r=this.findPlace(e,n);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let o=ke.none;for(let s of r.concat(e.marks))(i.type?i.type.allowsMarkType(s.type):nm(s.type,e.type))&&(o=s.addToSet(o));return i.content.push(e.mark(o)),!0}return!1}enter(e,n,r,i){let o=this.findPlace(e.create(n),r);return o&&(o=this.enterInner(e,n,r,!0,i)),o}enterInner(e,n,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let a=Qf(e,o,s.options);s.options&Da&&s.content.length==0&&(a|=Da);let l=ke.none;return r=r.filter(u=>(s.type?s.type.allowsMarkType(u.type):nm(u.type,e))?(l=u.addToSet(l),!1):!0),this.nodes.push(new ua(e,n,l,i,null,a)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=ps)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(a,l)=>{for(;a>=0;a--){let u=n[a];if(u==""){if(a==n.length-1||a==0)continue;for(;l>=o;l--)if(s(a-1,l))return!0;return!1}else{let c=l>0||l==0&&i?this.nodes[l].type:r&&l>=o?r.node(l-o).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function nM(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&cb.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function rM(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function tm(t){let e={};for(let n in t)e[n]=t[n];return e}function nm(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],s=a=>{o.push(a);for(let l=0;l<a.edgeCount;l++){let{type:u,next:c}=a.edge(l);if(u==e||o.indexOf(c)<0&&s(c))return!0}};if(s(i.contentMatch))return!0}}class fi{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=lc(n).createDocumentFragment());let i=r,o=[];return e.forEach(s=>{if(o.length||s.marks.length){let a=0,l=0;for(;a<o.length&&l<s.marks.length;){let u=s.marks[l];if(!this.marks[u.type.name]){l++;continue}if(!u.eq(o[a][0])||u.type.spec.spanning===!1)break;a++,l++}for(;a<o.length;)i=o.pop()[1];for(;l<s.marks.length;){let u=s.marks[l++],c=this.serializeMark(u,s.isInline,n);c&&(o.push([u,i]),i.appendChild(c.dom),i=c.contentDOM||c.dom)}}i.appendChild(this.serializeNodeInner(s,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Na(lc(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Na(lc(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Na(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new fi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=rm(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return rm(e.marks)}}function rm(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function lc(t){return t.document||window.document}const im=new WeakMap;function iM(t){let e=im.get(t);return e===void 0&&im.set(t,e=oM(t)),e}function oM(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function Na(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=iM(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(n=i.slice(0,s),i=i.slice(s+1));let a,l=n?t.createElementNS(n,i):t.createElement(i),u=e[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let d in u)if(u[d]!=null){let h=d.indexOf(" ");h>0?l.setAttributeNS(d.slice(0,h),d.slice(h+1),u[d]):l.setAttribute(d,u[d])}}for(let d=c;d<e.length;d++){let h=e[d];if(h===0){if(d<e.length-1||d>c)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:p,contentDOM:f}=Na(t,h,n,r);if(l.appendChild(p),f){if(a)throw new RangeError("Multiple content holes");a=f}}}return{dom:l,contentDOM:a}}const db=65535,pb=Math.pow(2,16);function sM(t,e){return t+e*pb}function om(t){return t&db}function aM(t){return(t-(t&db))/pb}const hb=1,fb=2,Ia=4,mb=8;class kd{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&mb)>0}get deletedBefore(){return(this.delInfo&(hb|Ia))>0}get deletedAfter(){return(this.delInfo&(fb|Ia))>0}get deletedAcross(){return(this.delInfo&Ia)>0}}class Ot{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Ot.empty)return Ot.empty}recover(e){let n=0,r=om(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+aM(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>e)break;let u=this.ranges[a+o],c=this.ranges[a+s],d=l+u;if(e<=d){let h=u?e==l?-1:e==d?1:n:n,p=l+i+(h<0?0:c);if(r)return p;let f=e==(n<0?l:d)?null:sM(a/3,e-l),m=e==l?fb:e==d?hb:Ia;return(n<0?e!=l:e!=d)&&(m|=mb),new kd(p,m,f)}i+=c-u}return r?e+i:new kd(e+i,0,null)}touches(e,n){let r=0,i=om(n),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>e)break;let u=this.ranges[a+o],c=l+u;if(e<=c&&a==i*3)return!0;r+=this.ranges[a+s]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),u=this.ranges[i+n],c=this.ranges[i+r];e(a,a+u,l,l+c),o+=c-u}}invert(){return new Ot(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Ot.empty:new Ot(e<0?[0,-e,0]:[0,0,e])}}Ot.empty=new Ot([]);class Bi{constructor(e=[],n,r=0,i=e.length){this.maps=e,this.mirror=n,this.from=r,this.to=i}slice(e=0,n=this.maps.length){return new Bi(this.maps,this.mirror,e,n)}copy(){return new Bi(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(e,n){this.to=this.maps.push(e),n!=null&&this.setMirror(this.maps.length-1,n)}appendMapping(e){for(let n=0,r=this.maps.length;n<e.maps.length;n++){let i=e.getMirror(n);this.appendMap(e.maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this.maps.length+e.maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e.maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new Bi;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this.maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this.maps[o],a=s.mapResult(e,n);if(a.recover!=null){let l=this.getMirror(o);if(l!=null&&l>o&&l<this.to){o=l,e=this.maps[l].recover(a.recover);continue}}i|=a.delInfo,e=a.pos}return r?e:new kd(e,i,null)}}const uc=Object.create(null);class st{getMap(){return Ot.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=uc[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in uc)throw new RangeError("Duplicate use of step JSON ID "+e);return uc[e]=n,n.prototype.jsonID=e,n}}class Fe{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Fe(e,null)}static fail(e){return new Fe(null,e)}static fromReplace(e,n,r,i){try{return Fe.ok(e.replace(n,r,i))}catch(o){if(o instanceof sl)return Fe.fail(o.message);throw o}}}function jp(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(jp(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return M.fromArray(r)}class ar extends st{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new V(jp(n.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),n.openStart,n.openEnd);return Fe.fromReplace(e,this.from,this.to,o)}invert(){return new gn(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new ar(n.pos,r.pos,this.mark)}merge(e){return e instanceof ar&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new ar(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new ar(n.from,n.to,e.markFromJSON(n.mark))}}st.jsonID("addMark",ar);class gn extends st{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new V(jp(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Fe.fromReplace(e,this.from,this.to,r)}invert(){return new ar(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new gn(n.pos,r.pos,this.mark)}merge(e){return e instanceof gn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new gn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new gn(n.from,n.to,e.markFromJSON(n.mark))}}st.jsonID("removeMark",gn);class lr extends st{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Fe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Fe.fromReplace(e,this.pos,this.pos+1,new V(M.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new lr(this.pos,n.marks[i]);return new lr(this.pos,this.mark)}}return new Yi(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new lr(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new lr(n.pos,e.markFromJSON(n.mark))}}st.jsonID("addNodeMark",lr);class Yi extends st{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Fe.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Fe.fromReplace(e,this.pos,this.pos+1,new V(M.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new lr(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Yi(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Yi(n.pos,e.markFromJSON(n.mark))}}st.jsonID("removeNodeMark",Yi);class je extends st{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&wd(e,this.from,this.to)?Fe.fail("Structure replace would overwrite content"):Fe.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ot([this.from,this.to-this.from,this.slice.size])}invert(e){return new je(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new je(n.pos,Math.max(n.pos,r.pos),this.slice)}merge(e){if(!(e instanceof je)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?V.empty:new V(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new je(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?V.empty:new V(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new je(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new je(n.from,n.to,V.fromJSON(e,n.slice),!!n.structure)}}st.jsonID("replace",je);class qe extends st{constructor(e,n,r,i,o,s,a=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(e){if(this.structure&&(wd(e,this.from,this.gapFrom)||wd(e,this.gapTo,this.to)))return Fe.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Fe.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Fe.fromReplace(e,this.from,this.to,r):Fe.fail("Content does not fit in gap")}getMap(){return new Ot([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new qe(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new qe(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new qe(n.from,n.to,n.gapFrom,n.gapTo,V.fromJSON(e,n.slice),n.insert,!!n.structure)}}st.jsonID("replaceAround",qe);function wd(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function lM(t,e,n,r){let i=[],o=[],s,a;t.doc.nodesBetween(e,n,(l,u,c)=>{if(!l.isInline)return;let d=l.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let h=Math.max(u,e),p=Math.min(u+l.nodeSize,n),f=r.addToSet(d);for(let m=0;m<d.length;m++)d[m].isInSet(f)||(s&&s.to==h&&s.mark.eq(d[m])?s.to=p:i.push(s=new gn(h,p,d[m])));a&&a.to==h?a.to=p:o.push(a=new ar(h,p,r))}}),i.forEach(l=>t.step(l)),o.forEach(l=>t.step(l))}function uM(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;o++;let l=null;if(r instanceof bu){let u=s.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let u=Math.min(a+s.nodeSize,n);for(let c=0;c<l.length;c++){let d=l[c],h;for(let p=0;p<i.length;p++){let f=i[p];f.step==o-1&&d.eq(i[p].style)&&(h=f)}h?(h.to=u,h.step=o):i.push({style:d,from:Math.max(a,e),to:u,step:o})}}}),i.forEach(s=>t.step(new gn(s.from,s.to,s.style)))}function zp(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),s=[],a=e+1;for(let l=0;l<o.childCount;l++){let u=o.child(l),c=a+u.nodeSize,d=r.matchType(u.type);if(!d)s.push(new je(a,c,V.empty));else{r=d;for(let h=0;h<u.marks.length;h++)n.allowsMarkType(u.marks[h].type)||t.step(new gn(a,c,u.marks[h]));if(i&&u.isText&&n.whitespace!="pre"){let h,p=/\r?\n|\r/g,f;for(;h=p.exec(u.text);)f||(f=new V(M.from(n.schema.text(" ",n.allowedMarks(u.marks))),0,0)),s.push(new je(a+h.index,a+h.index+h[0].length,f))}}a=c}if(!r.validEnd){let l=r.fillBefore(M.empty,!0);t.replace(a,a,new V(l,0,0))}for(let l=s.length-1;l>=0;l--)t.step(s[l])}function cM(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function uo(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth;;--n){let r=t.$from.node(n),i=t.$from.index(n),o=t.$to.indexAfter(n);if(n<t.depth&&r.canReplace(i,o,e))return n;if(n==0||r.type.spec.isolating||!cM(r,i,o))break}return null}function dM(t,e,n){let{$from:r,$to:i,depth:o}=e,s=r.before(o+1),a=i.after(o+1),l=s,u=a,c=M.empty,d=0;for(let f=o,m=!1;f>n;f--)m||r.index(f)>0?(m=!0,c=M.from(r.node(f).copy(c)),d++):l--;let h=M.empty,p=0;for(let f=o,m=!1;f>n;f--)m||i.after(f+1)<i.end(f)?(m=!0,h=M.from(i.node(f).copy(h)),p++):u++;t.step(new qe(l,u,s,a,new V(c.append(h),d,p),c.size-d,!0))}function Hp(t,e,n=null,r=t){let i=pM(t,e),o=i&&hM(r,e);return o?i.map(sm).concat({type:e,attrs:n}).concat(o.map(sm)):null}function sm(t){return{type:t,attrs:null}}function pM(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.contentMatchAt(r).findWrapping(e);if(!o)return null;let s=o.length?o[0]:e;return n.canReplaceWith(r,i,s)?o:null}function hM(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.child(r),s=e.contentMatch.findWrapping(o.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let l=r;a&&l<i;l++)a=a.matchType(n.child(l).type);return!a||!a.validEnd?null:s}function fM(t,e,n){let r=M.empty;for(let s=n.length-1;s>=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=M.from(n[s].type.create(n[s].attrs,r))}let i=e.start,o=e.end;t.step(new qe(i,o,i,o,new V(r,0,0),n.length,!0))}function mM(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&gM(t.doc,t.mapping.slice(o).map(a),r)){let u=null;if(r.schema.linebreakReplacement){let p=r.whitespace=="pre",f=!!r.contentMatch.matchType(r.schema.linebreakReplacement);p&&!f?u=!1:!p&&f&&(u=!0)}u===!1&&vb(t,s,a,o),zp(t,t.mapping.slice(o).map(a,1),r,void 0,u===null);let c=t.mapping.slice(o),d=c.map(a,1),h=c.map(a+s.nodeSize,1);return t.step(new qe(d,h,d+1,h-1,new V(M.from(r.create(l,null,s.marks)),0,0),1,!0)),u===!0&&gb(t,s,a,o),!1}})}function gb(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let l=t.mapping.slice(r).map(n+1+o+s.index);t.replaceWith(l,l+1,e.type.schema.linebreakReplacement.create())}}})}function vb(t,e,n,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=t.mapping.slice(r).map(n+1+o);t.replaceWith(s,s+1,e.type.schema.text(`
|