1var Pe=Object.defineProperty;var Ye=(r,t,e)=>t in r?Pe(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var w=(r,t,e)=>Ye(r,typeof t!="symbol"?t+"":t,e);class C{constructor(t){this._canceled=!1,this.data=t}get type(){return this.constructor.type}get cancelable(){return this.constructor.cancelable}cancel(){this._canceled=!0}canceled(){return this._canceled}clone(t){return new this.constructor({...this.data,...t})}}C.type="event";C.cancelable=!1;class L{constructor(t){this.draggable=t}attach(){throw new Error("Not Implemented")}detach(){throw new Error("Not Implemented")}}const I={mouse:0,drag:0,touch:100};class ee{constructor(t=[],e={}){this.containers=[...t],this.options={...e},this.dragging=!1,this.currentContainer=null,this.originalSource=null,this.startEvent=null,this.delay=Ne(e.delay)}attach(){return this}detach(){return this}addContainer(...t){this.containers=[...this.containers,...t]}removeContainer(...t){this.containers=this.containers.filter(e=>!t.includes(e))}trigger(t,e){const n=document.createEvent("Event");return n.detail=e,n.initEvent(e.type,!0,!0),t.dispatchEvent(n),this.lastEvent=e,e}}function Ne(r){const t={};if(r===void 0)return{...I};if(typeof r=="number"){for(const e in I)Object.prototype.hasOwnProperty.call(I,e)&&(t[e]=r);return t}for(const e in I)Object.prototype.hasOwnProperty.call(I,e)&&(r[e]===void 0?t[e]=I[e]:t[e]=r[e]);return t}function y(r,t){if(r==null)return null;function e(i){return i==null||t==null?!1:$e(t)?Element.prototype.matches.call(i,t):ze(t)?[...t].includes(i):ke(t)?t===i:je(t)?t(i):!1}let n=r;do{if(n=n.correspondingUseElement||n.correspondingElement||n,e(n))return n;n=(n==null?void 0:n.parentNode)||null}while(n!=null&&n!==document.body&&n!==document);return null}function $e(r){return typeof r=="string"}function ze(r){return r instanceof NodeList||r instanceof Array}function ke(r){return r instanceof Node}function je(r){return typeof r=="function"}function re(r,t,e,n){return Math.sqrt((e-r)**2+(n-t)**2)}class xt extends C{get originalEvent(){return this.data.originalEvent}get clientX(){return this.data.clientX}get clientY(){return this.data.clientY}get target(){return this.data.target}get container(){return this.data.container}get originalSource(){return this.data.originalSource}get pressure(){return this.data.pressure}}class Pt extends xt{}Pt.type="drag:start";class Yt extends xt{}Yt.type="drag:move";class Nt extends xt{}Nt.type="drag:stop";class Ue extends xt{}Ue.type="drag:pressure";const j=Symbol("onContextMenuWhileDragging"),U=Symbol("onMouseDown"),B=Symbol("onMouseMove"),q=Symbol("onMouseUp"),mt=Symbol("startDrag"),M=Symbol("onDistanceChange");class Be extends ee{constructor(t=[],e={}){super(t,e),this.mouseDownTimeout=null,this.pageX=null,this.pageY=null,this[j]=this[j].bind(this),this[U]=this[U].bind(this),this[B]=this[B].bind(this),this[q]=this[q].bind(this),this[mt]=this[mt].bind(this),this[M]=this[M].bind(this)}attach(){document.addEventListener("mousedown",this[U],!0)}detach(){document.removeEventListener("mousedown",this[U],!0)}[U](t){if(t.button!==0||t.ctrlKey||t.metaKey)return;const e=y(t.target,this.containers);if(!e||this.options.handle&&t.target&&!y(t.target,this.options.handle))return;const n=y(t.target,this.options.draggable);if(!n)return;const{delay:i}=this,{pageX:s,pageY:o}=t;Object.assign(this,{pageX:s,pageY:o}),this.onMouseDownAt=Date.now(),this.startEvent=t,this.currentContainer=e,this.originalSource=n,document.addEventListener("mouseup",this[q]),document.addEventListener("dragstart",Ht),document.addEventListener("mousemove",this[M]),this.mouseDownTimeout=window.setTimeout(()=>{this[M]({pageX:this.pageX,pageY:this.pageY})},i.mouse)}[mt](){const t=this.startEvent,e=this.currentContainer,n=this.originalSource,i=new Pt({clientX:t.clientX,clientY:t.clientY,target:t.target,container:e,originalSource:n,originalEvent:t});this.trigger(this.currentContainer,i),this.dragging=!i.canceled(),this.dragging&&(document.addEventListener("contextmenu",this[j],!0),document.addEventListener("mousemove",this[B]))}[M](t){const{pageX:e,pageY:n}=t,{distance:i}=this.options,{startEvent:s,delay:o}=this;if(Object.assign(this,{pageX:e,pageY:n}),!this.currentContainer)return;const a=Date.now()-this.onMouseDownAt,l=re(s.pageX,s.pageY,e,n)||0;clearTimeout(this.mouseDownTimeout),a<o.mouse?document.removeEventListener("mousemove",this[M]):l>=i&&(document.removeEventListener("mousemove",this[M]),this[mt]())}[B](t){if(!this.dragging)return;const e=document.elementFromPoint(t.clientX,t.clientY),n=new Yt({clientX:t.clientX,clientY:t.clientY,target:e,container:this.currentContainer,originalEvent:t});this.trigger(this.currentContainer,n)}[q](t){if(clearTimeout(this.mouseDownTimeout),t.button!==0||(document.removeEventListener("mouseup",this[q]),document.removeEventListener("dragstart",Ht),document.removeEventListener("mousemove",this[M]),!this.dragging))return;const e=document.elementFromPoint(t.clientX,t.clientY),n=new Nt({clientX:t.clientX,clientY:t.clientY,target:e,container:this.currentContainer,originalEvent:t});this.trigger(this.currentContainer,n),document.removeEventListener("contextmenu",this[j],!0),document.removeEventListener("mousemove",this[B]),this.currentContainer=null,this.dragging=!1,this.startEvent=null}[j](t){t.preventDefault()}}function Ht(r){r.preventDefault()}function X(r){const{touches:t,changedTouches:e}=r;return t&&t[0]||e&&e[0]}const R=Symbol("onTouchStart"),F=Symbol("onTouchEnd"),H=Symbol("onTouchMove"),pt=Symbol("startDrag"),T=Symbol("onDistanceChange");let Et=!1;window.addEventListener("touchmove",r=>{Et&&r.preventDefault()},{passive:!1});class qe extends ee{constructor(t=[],e={}){super(t,e),this.currentScrollableParent=null,this.tapTimeout=null,this.touchMoved=!1,this.pageX=null,this.pageY=null,this[R]=this[R].bind(this),this[F]=this[F].bind(this),this[H]=this[H].bind(this),this[pt]=this[pt].bind(this),this[T]=this[T].bind(this)}attach(){document.addEventListener("touchstart",this[R])}detach(){document.removeEventListener("touchstart",this[R])}
1[R](t){const e=y(t.target,this.containers);if(!e||this.options.handle&&t.target&&!y(t.target,this.options.handle))return;const n=y(t.target,this.options.draggable);if(!n)return;const{distance:i=0}=this.options,{delay:s}=this,{pageX:o,pageY:a}=X(t);Object.assign(this,{pageX:o,pageY:a}),this.onTouchStartAt=Date.now(),this.startEvent=t,this.currentContainer=e,this.originalSource=n,document.addEventListener("touchend",this[F]),document.addEventListener("touchcancel",this[F]),document.addEventListener("touchmove",this[T]),e.addEventListener("contextmenu",Wt),i&&(Et=!0),this.tapTimeout=window.setTimeout(()=>{this[T]({touches:[{pageX:this.pageX,pageY:this.pageY}]})},s.touch)}[pt](){const t=this.startEvent,e=this.currentContainer,n=X(t),i=this.originalSource,s=new Pt({clientX:n.pageX,clientY:n.pageY,target:t.target,container:e,originalSource:i,originalEvent:t});this.trigger(this.currentContainer,s),this.dragging=!s.canceled(),this.dragging&&document.addEventListener("touchmove",this[H]),Et=this.dragging}[T](t){const{distance:e}=this.options,{startEvent:n,delay:i}=this,s=X(n),o=X(t),a=Date.now()-this.onTouchStartAt,l=re(s.pageX,s.pageY,o.pageX,o.pageY);Object.assign(this,o),clearTimeout(this.tapTimeout),a<i.touch?document.removeEventListener("touchmove",this[T]):l>=e&&(document.removeEventListener("touchmove",this[T]),this[pt]())}[H](t){if(!this.dragging)return;const{pageX:e,pageY:n}=X(t),i=document.elementFromPoint(e-window.scrollX,n-window.scrollY),s=new Yt({clientX:e,clientY:n,target:i,container:this.currentContainer,originalEvent:t});this.trigger(this.currentContainer,s)}[F](t){if(clearTimeout(this.tapTimeout),Et=!1,document.removeEventListener("touchend",this[F]),document.removeEventListener("touchcancel",this[F]),document.removeEventListener("touchmove",this[T]),this.currentContainer&&this.currentContainer.removeEventListener("contextmenu",Wt),!this.dragging)return;document.removeEventListener("touchmove",this[H]);const{pageX:e,pageY:n}=X(t),i=document.elementFromPoint(e-window.scrollX,n-window.scrollY);t.preventDefault();const s=new Nt({clientX:e,clientY:n,target:i,container:this.currentContainer,originalEvent:t});this.trigger(this.currentContainer,s),this.currentContainer=null,this.dragging=!1,this.startEvent=null}}function Wt(r){r.preventDefault(),r.stopPropagation()}class $t extends C{constructor(t){super(t),this.data=t}get dragEvent(){return this.data.dragEvent}}$t.type="collidable";class Re extends $t{get collidingElement(){return this.data.collidingElement}}Re.type="collidable:in";class He extends $t{get collidingElement(){return this.data.collidingElement}}He.type="collidable:out";function ne(r,t){return function(e){_e(t,"addInitializer"),yt(e,"An initializer"),r.push(e)}}function Tt(r,t){if(!r(t))throw new TypeError("Attempted to access private element on non-instance")}function We(r,t,e,n,i,s,o,a,l,h,g){var d;switch(s){case 1:d="accessor";break;case 2:d="method";break;case 3:d="getter";break;case 4:d="setter";break;default:d="field"}var c,u,m={kind:d,name:a?"#"+e:e,static:o,private:a,metadata:g},v={v:!1};if(s!==0&&(m.addInitializer=ne(i,v)),a||s!==0&&s!==2)if(s===2)c=function(p){return Tt(h,p),n.value};else{var b=s===0||s===1;(b||s===3)&&(c=a?function(p){return Tt(h,p),n.get.call(p)}:function(p){return n.get.call(p)}),(b||s===4)&&(u=a?function(p,E){Tt(h,p),n.set.call(p,E)}:function(p,E){n.set.call(p,E)})}else c=function(p){return p[e]},s===0&&(u=function(p,E){p[e]=E});var f=a?h.bind():function(p){return e in p};m.access=c&&u?{get:c,set:u,has:f}:c?{get:c,has:f}:{set:u,has:f};try{return r.call(t,l,m)}finally{v.v=!0}}function _e(r,t){if(r.v)throw new Error("attempted to call "+t+" after decoration was finished")}function yt(r,t){if(typeof r!="function")throw new TypeError(t+" must be a function")}function se(r,t){var e=typeof t;if(r===1){if(e!=="object"||t===null)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");t.get!==void 0&&yt(t.get,"accessor.get"),t.set!==void 0&&yt(t.set,"accessor.set"),t.init!==void 0&&yt(t.init,"accessor.init")}else if(e!=="function"){var n;throw n=r===0?"field":r===5?"class":"method",new TypeError(n+" decorators must return a function or void 0")}}function Ve(r){return function(){return r(this)}}function Ke(r){return function(t){r(this,t)}}function Ge(r,t,e,n,i,s,o,a,l,h,g){var d,c,u,m,v,b,f=e[0];n||Array.isArray(f)||(f=[f]),a?d=s===0||s===1?{get:Ve(e[3]),set:Ke(e[4])}:s===3?{get:e[3]}:s===4?{set:e[3]}:{value:e[3]}:s!==0&&(d=Object.getOwnPropertyDescriptor(t,i)),s===1?u={get:d.get,set:d.set}:s===2?u=d.value:s===3?u=d.get:s===4&&(u=d.set);for(var p=n?2:1,E=f.length-1;E>=0;E-=p){var O;(m=We(f[E],n?f[E-1]:void 0,i,d,l,s,o,a,u,h,g))!==void 0&&(se(s,m),s===0?O=m:s===1?(O=m.init,v=m.get||u.get,b=m.set||u.set,u={get:v,set:b}):u=m,O!==void 0&&(c===void 0?c=O:typeof c=="function"?c=[c,O]:c.push(O)))}if(s===0||s===1){if(c===void 0)c=function(x,S){return S};else if(typeof c!="function"){var A=c;c=function(x,S){for(var Ot=S,Mt=A.length-1;Mt>=0;Mt--)Ot=A[Mt].call(x,Ot);return Ot}}else{var Dt=c;c=function(x,S){return Dt.call(x,S)}}r.push(c)}s!==0&&(s===1?(d.get=u.get,d.set=u.set):s===2?d.value=u:s===3?d.get=u:s===4&&(d.set=u),a?s===1?(r.push(function(x,S){return u.get.call(x,S)}),r.push(function(x,S){return u.set.call(x,S)})):s===2?r.push(u):r.push(function(x,S){return u.call(x,S)}):Object.defineProperty(t,i,d))}function Je(r,t,e,n){for(var i,s,o,a=[],l=new Map,h=new Map,g=0;g<t.length;g++){var d=t[g];if(Array.isArray(d)){var c,u,m=d[1],v=d[2],b=d.length>3,f=16&m,p=!!(8&m),E=e;
1if(m&=7,p?(c=r,m!==0&&(u=s=s||[]),b&&!o&&(o=function(Dt){return Ze(Dt)===r}),E=o):(c=r.prototype,m!==0&&(u=i=i||[])),m!==0&&!b){var O=p?h:l,A=O.get(v)||0;if(A===!0||A===3&&m!==4||A===4&&m!==3)throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+v);O.set(v,!(!A&&m>2)||m)}Ge(a,c,d,f,v,m,p,b,u,E,n)}}return _t(a,i),_t(a,s),a}function _t(r,t){t&&r.push(function(e){for(var n=0;n<t.length;n++)t[n].call(e);return e})}function Qe(r,t,e,n){if(t.length){for(var i=[],s=r,o=r.name,a=1,l=t.length-1;l>=0;l-=a){var h={v:!1};try{var g=t[l].call(e?t[l-1]:void 0,s,{kind:"class",name:o,addInitializer:ne(i,h),metadata:n})}finally{h.v=!0}g!==void 0&&(se(5,g),s=g)}return[ie(s,n),function(){for(var d=0;d<i.length;d++)i[d].call(s)}]}}function ie(r,t){return Object.defineProperty(r,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:t})}function oe(r,t,e,n,i,s){if(arguments.length>=6)var o=s[Symbol.metadata||Symbol.for("Symbol.metadata")];var a=Object.create(o===void 0?null:o),l=Je(r,t,i,a);return e.length||ie(r,a),{e:l,get c(){return Qe(r,e,n,a)}}}function Ze(r){if(Object(r)!==r)throw TypeError("right-hand side of 'in' should be an object, got "+(r!==null?typeof r:"null"));return r}function St(r,{name:t,addInitializer:e}){e(function(){this[t]=r.bind(this)})}function tr(r){return requestAnimationFrame(()=>{requestAnimationFrame(r)})}class D extends C{constructor(t){super(t),this.data=t}get source(){return this.data.source}get originalSource(){return this.data.originalSource}get mirror(){return this.data.mirror}get sourceContainer(){return this.data.sourceContainer}get sensorEvent(){return this.data.sensorEvent}get originalEvent(){return this.sensorEvent?this.sensorEvent.originalEvent:null}}D.type="drag";class zt extends D{}zt.type="drag:start";zt.cancelable=!0;class ae extends D{}ae.type="drag:move";class wt extends D{get overContainer(){return this.data.overContainer}get over(){return this.data.over}}wt.type="drag:over";wt.cancelable=!0;function er(r){return r.type===wt.type}class le extends D{get overContainer(){return this.data.overContainer}get over(){return this.data.over}}le.type="drag:out";class ce extends D{get overContainer(){return this.data.overContainer}}ce.type="drag:over:container";class de extends D{get overContainer(){return this.data.overContainer}}de.type="drag:out:container";class he extends D{get pressure(){return this.data.pressure}}he.type="drag:pressure";class kt extends D{}kt.type="drag:stop";kt.cancelable=!0;class ue extends D{}ue.type="drag:stopped";var ge,me;class rr extends L{constructor(t){ge(super(t)),this.lastWidth=0,this.lastHeight=0,this.mirror=null}attach(){this.draggable.on("mirror:created",this.onMirrorCreated).on("drag:over",this.onDragOver).on("drag:over:container",this.onDragOver)}detach(){this.draggable.off("mirror:created",this.onMirrorCreated).off("mirror:destroy",this.onMirrorDestroy).off("drag:over",this.onDragOver).off("drag:over:container",this.onDragOver)}getOptions(){return this.draggable.options.resizeMirror||{}}onMirrorCreated({mirror:t}){this.mirror=t}onMirrorDestroy(){this.mirror=null}onDragOver(t){this.resize(t)}resize(t){requestAnimationFrame(()=>{let e=null;const{overContainer:n}=t;if(this.mirror==null||this.mirror.parentNode==null)return;this.mirror.parentNode!==n&&n.appendChild(this.mirror),er(t)&&(e=t.over);const i=e||this.draggable.getDraggableElementsForContainer(n)[0];i&&tr(()=>{const s=i.getBoundingClientRect();this.mirror==null||this.lastHeight===s.height&&this.lastWidth===s.width||(this.mirror.style.width=`${s.width}px`,this.mirror.style.height=`${s.height}px`,this.lastWidth=s.width,this.lastHeight=s.height)})})}}me=rr;[ge]=oe(me,[[St,2,"onMirrorCreated"],[St,2,"onMirrorDestroy"],[St,2,"onDragOver"]],[],0,void 0,L).e;class jt extends C{get dragEvent(){return this.data.dragEvent}get snappable(){return this.data.snappable}}jt.type="snap";class pe extends jt{}pe.type="snap:in";pe.cancelable=!0;class fe extends jt{}fe.type="snap:out";fe.cancelable=!0;var ve,be;const nr={duration:150,easingFunction:"ease-in-out",horizontal:!1};class Ee extends L{constructor(t){ve(super(t)),this.options={...nr,...this.getOptions()},this.lastAnimationFrame=null}attach(){this.draggable.on("sortable:sorted",this.onSortableSorted)}detach(){this.draggable.off("sortable:sorted",this.onSortableSorted)}
1getOptions(){return this.draggable.options.swapAnimation||{}}onSortableSorted({oldIndex:t,newIndex:e,dragEvent:n}){const{source:i,over:s}=n;this.lastAnimationFrame&&cancelAnimationFrame(this.lastAnimationFrame),this.lastAnimationFrame=requestAnimationFrame(()=>{t>=e?Vt(i,s,this.options):Vt(s,i,this.options)})}}be=Ee;[ve]=oe(be,[[St,2,"onSortableSorted"]],[],0,void 0,L).e;function Vt(r,t,{duration:e,easingFunction:n,horizontal:i}){for(const s of[r,t])s.style.pointerEvents="none";if(i){const s=r.offsetWidth;r.style.transform=`translate3d(${s}px, 0, 0)`,t.style.transform=`translate3d(-${s}px, 0, 0)`}else{const s=r.offsetHeight;r.style.transform=`translate3d(0, ${s}px, 0)`,t.style.transform=`translate3d(0, -${s}px, 0)`}requestAnimationFrame(()=>{for(const s of[r,t])s.addEventListener("transitionend",ye),s.style.transition=`transform ${e}ms ${n}`,s.style.transform=""})}function ye(r){r.target==null||!sr(r.target)||(r.target.style.transition="",r.target.style.pointerEvents="",r.target.removeEventListener("transitionend",ye))}function sr(r){return"style"in r}const ft=Symbol("onInitialize"),vt=Symbol("onDestroy"),Kt=Symbol("announceEvent"),Lt=Symbol("announceMessage"),ir="aria-relevant",or="aria-atomic",ar="aria-live",lr="role",cr={expire:7e3};class dr extends L{constructor(t){super(t),this.options={...cr,...this.getOptions()},this.originalTriggerMethod=this.draggable.trigger,this[ft]=this[ft].bind(this),this[vt]=this[vt].bind(this)}attach(){this.draggable.on("draggable:initialize",this[ft])}detach(){this.draggable.off("draggable:destroy",this[vt])}getOptions(){return this.draggable.options.announcements||{}}[Kt](t){const e=this.options[t.type];e&&typeof e=="string"&&this[Lt](e),e&&typeof e=="function"&&this[Lt](e(t))}[Lt](t){hr(t,{expire:this.options.expire})}[ft](){this.draggable.trigger=t=>{try{this[Kt](t)}finally{this.originalTriggerMethod.call(this.draggable,t)}}}[vt](){this.draggable.trigger=this.originalTriggerMethod}}const At=ur();function hr(r,{expire:t}){const e=document.createElement("div");return e.textContent=r,At.appendChild(e),setTimeout(()=>{At.removeChild(e)},t)}function ur(){const r=document.createElement("div");return r.setAttribute("id","draggable-live-region"),r.setAttribute(ir,"additions"),r.setAttribute(or,"true"),r.setAttribute(ar,"assertive"),r.setAttribute(lr,"log"),r.style.position="fixed",r.style.width="1px",r.style.height="1px",r.style.top="-1px",r.style.overflow="hidden",r}document.addEventListener("DOMContentLoaded",()=>{document.body.appendChild(At)});const W=Symbol("onInitialize"),P=Symbol("onDestroy"),gr={};class mr extends L{constructor(t){super(t),this.options={...gr,...this.getOptions()},this[W]=this[W].bind(this),this[P]=this[P].bind(this)}attach(){this.draggable.on("draggable:initialize",this[W]).on("draggable:destroy",this[P])}detach(){this.draggable.off("draggable:initialize",this[W]).off("draggable:destroy",this[P]),this[P]()}getOptions(){return this.draggable.options.focusable||{}}getElements(){return[...this.draggable.containers,...this.draggable.getDraggableElements()]}[W](){requestAnimationFrame(()=>{this.getElements().forEach(t=>pr(t))})}[P](){requestAnimationFrame(()=>{this.getElements().forEach(t=>fr(t))})}}const Ft=[];function pr(r){!r.getAttribute("tabindex")&&r.tabIndex===-1&&(Ft.push(r),r.tabIndex=0)}function fr(r){const t=Ft.indexOf(r);t!==-1&&(r.tabIndex=-1,Ft.splice(t,1))}class z extends C{constructor(t){super(t),this.data=t}get source(){return this.data.source}get originalSource(){return this.data.originalSource}get sourceContainer(){return this.data.sourceContainer}get sensorEvent(){return this.data.sensorEvent}get dragEvent(){return this.data.dragEvent}get originalEvent(){return this.sensorEvent?this.sensorEvent.originalEvent:null}}class Se extends z{}Se.type="mirror:create";class Ce extends z{get mirror(){return this.data.mirror}}Ce.type="mirror:created";class xe extends z{get mirror(){return this.data.mirror}}xe.type="mirror:attached";class Ut extends z{get mirror(){return this.data.mirror}get passedThreshX(){return this.data.passedThreshX}get passedThreshY(){return this.data.passedThreshY}}Ut.type="mirror:move";Ut.cancelable=!0;class we extends z{get mirror(){return this.data.mirror}get passedThreshX(){return this.data.passedThreshX}get passedThreshY(){return this.data.passedThreshY}}we.type="mirror:moved";class Bt extends z{get mirror(){return this.data.mirror}}Bt.type="mirror:destroy";Bt.cancelable=!0;const _=Symbol("onDragStart"),V=Symbol("onDragMove"),K=Symbol("onDragStop"),G=Symbol("onMirrorCreated"),J=Symbol("onMirrorMove"),Q=Symbol("onScroll"),Gt=Symbol("getAppendableContainer"),vr={constrainDimensions:!1,xAxis:!0,yAxis:!0,cursorOffsetX:null,cursorOffsetY:null,thresholdX:null,thresholdY:null};class br extends L{constructor(t){super(t),this.options={...vr,...this.getOptions()},this.scrollOffset={x:0,y:0},this.initialScrollOffset={x:window.scrollX,y:window.scrollY},this[_]=this[_].bind(this),this[V]=this[V].bind(this),this[K]=this[K].bind(this),this[G]=this[G].bind(this),this[J]=this[J].bind(this),this[Q]=this[Q].bind(this)}attach(){this.draggable.on("drag:start",this[_]).on("drag:move",this[V]).on("drag:stop",this[K]).on("mirror:created",this[G]).on("mirror:move",this[J])}detach(){this.draggable.off("drag:start",this[_]).off("drag:move",this[V]).off("drag:stop",this[K]).off("mirror:created",this[G]).off("mirror:move",this[J])}
1getOptions(){return this.draggable.options.mirror||{}}[_](t){if(t.canceled())return;"ontouchstart"in window&&document.addEventListener("scroll",this[Q],!0),this.initialScrollOffset={x:window.scrollX,y:window.scrollY};const{source:e,originalSource:n,sourceContainer:i,sensorEvent:s}=t;this.lastMirrorMovedClient={x:s.clientX,y:s.clientY};const o=new Se({source:e,originalSource:n,sourceContainer:i,sensorEvent:s,dragEvent:t});if(this.draggable.trigger(o),wr(s)||o.canceled())return;const a=this[Gt](e)||i;this.mirror=e.cloneNode(!0);const l=new Ce({source:e,originalSource:n,sourceContainer:i,sensorEvent:s,dragEvent:t,mirror:this.mirror}),h=new xe({source:e,originalSource:n,sourceContainer:i,sensorEvent:s,dragEvent:t,mirror:this.mirror});this.draggable.trigger(l),a.appendChild(this.mirror),this.draggable.trigger(h)}[V](t){if(!this.mirror||t.canceled())return;const{source:e,originalSource:n,sourceContainer:i,sensorEvent:s}=t;let o=!0,a=!0;if(this.options.thresholdX||this.options.thresholdY){const{x:h,y:g}=this.lastMirrorMovedClient;if(Math.abs(h-s.clientX)<this.options.thresholdX?o=!1:this.lastMirrorMovedClient.x=s.clientX,Math.abs(g-s.clientY)<this.options.thresholdY?a=!1:this.lastMirrorMovedClient.y=s.clientY,!o&&!a)return}const l=new Ut({source:e,originalSource:n,sourceContainer:i,sensorEvent:s,dragEvent:t,mirror:this.mirror,passedThreshX:o,passedThreshY:a});this.draggable.trigger(l)}[K](t){if("ontouchstart"in window&&document.removeEventListener("scroll",this[Q],!0),this.initialScrollOffset={x:0,y:0},this.scrollOffset={x:0,y:0},!this.mirror)return;const{source:e,sourceContainer:n,sensorEvent:i}=t,s=new Bt({source:e,mirror:this.mirror,sourceContainer:n,sensorEvent:i,dragEvent:t});this.draggable.trigger(s),s.canceled()||this.mirror.remove()}[Q](){this.scrollOffset={x:window.scrollX-this.initialScrollOffset.x,y:window.scrollY-this.initialScrollOffset.y}}[G]({mirror:t,source:e,sensorEvent:n}){const i=this.draggable.getClassNamesFor("mirror"),s=({mirrorOffset:a,initialX:l,initialY:h,...g})=>(this.mirrorOffset=a,this.initialX=l,this.initialY=h,this.lastMovedX=l,this.lastMovedY=h,{mirrorOffset:a,initialX:l,initialY:h,...g});t.style.display="none";const o={mirror:t,source:e,sensorEvent:n,mirrorClasses:i,scrollOffset:this.scrollOffset,options:this.options,passedThreshX:!0,passedThreshY:!0};return Promise.resolve(o).then(Er).then(yr).then(Sr).then(Cr).then(Jt({initial:!0})).then(xr).then(s)}[J](t){if(t.canceled())return null;const e=({lastMovedX:s,lastMovedY:o,...a}
1)=>(this.lastMovedX=s,this.lastMovedY=o,{lastMovedX:s,lastMovedY:o,...a}),n=s=>{const o=new we({source:t.source,originalSource:t.originalSource,sourceContainer:t.sourceContainer,sensorEvent:t.sensorEvent,dragEvent:t.dragEvent,mirror:this.mirror,passedThreshX:t.passedThreshX,passedThreshY:t.passedThreshY});return this.draggable.trigger(o),s},i={mirror:t.mirror,sensorEvent:t.sensorEvent,mirrorOffset:this.mirrorOffset,options:this.options,initialX:this.initialX,initialY:this.initialY,scrollOffset:this.scrollOffset,passedThreshX:t.passedThreshX,passedThreshY:t.passedThreshY,lastMovedX:this.lastMovedX,lastMovedY:this.lastMovedY};return Promise.resolve(i).then(Jt({})).then(e).then(n)}[Gt](t){const e=this.options.appendTo;return typeof e=="string"?document.querySelector(e):e instanceof HTMLElement?e:typeof e=="function"?e(t):t.parentNode}}function Er({source:r,...t}){return k(e=>{const n=r.getBoundingClientRect();e({source:r,sourceRect:n,...t})})}function yr({sensorEvent:r,sourceRect:t,options:e,...n}){return k(i=>{const s=e.cursorOffsetY===null?r.clientY-t.top:e.cursorOffsetY,o=e.curs
1orOffsetX===null?r.clientX-t.left:e.cursorOffsetX;i({sensorEvent:r,sourceRect:t,mirrorOffset:{top:s,left:o},options:e,...n})})}function Sr({mirror:r,source:t,options:e,...n}){return k(i=>{let s,o;if(e.constrainDimensions){const a=getComputedStyle(t);s=a.getPropertyValue("height"),o=a.getPropertyValue("width")}r.style.display=null,r.style.position="fixed",r.style.pointerEvents="none",r.style.top=0,r.style.left=0,r.style.margin=0,e.constrainDimensions&&(r.style.height=s,r.style.width=o),i({mirror:r,source:t,options:e,...n})})}function Cr({mirror:r,mirrorClasses:t,...e}){return k(n=>{r.classList.add(...t),n({mirror:r,mirrorClasses:t,...e})})}function xr({mirror:r,...t}){return k(e=>{r.removeAttribute("id"),delete r.id,e({mirror:r,...t})})}function Jt({withFrame:r=!1,initial:t=!1}={}){return({mirror:e,sensorEvent:n,mirrorOffset:i,initialY:s,initialX:o,scrollOffset:a,options:l,passedThreshX:h,passedThreshY:g,lastMovedX:d,lastMovedY:c,...u})=>k(m=>{const v={mirror:e,sensorEvent:n,mirrorOffset:i,options:l,...u};if(i){const b=h?Math.round((n.clientX-i.left-a.x)/(l.thresholdX||1))*(l.thresholdX||1):Math.round(d),f=g?Math.round((n.clientY-i.top-a.y)/(l.thresholdY||1))*(l.thresholdY||1):Math.round(c);l.xAxis&&l.yAxis||t?e.style.transform=`translate3d(${b}px, ${f}px, 0)`:l.xAxis&&!l.yAxis?e.style.transform=`translate3d(${b}px, ${s}px, 0)`:l.yAxis&&!l.xAxis&&(e.style.transform=`translate3d(${o}px, ${f}px, 0)`),t&&(v.initialX=b,v.initialY=f),v.lastMovedX=b,v.lastMovedY=f}m(v)},{})}function k(r,{raf:t=!1}={}){return new Promise((e,n)=>{t?requestAnimationFrame(()=>{r(e,n)}):r(e,n)})}function wr(r){return/^drag/.test(r.originalEvent.type)}const Z=Symbol("onDragStart"),tt=Symbol("onDragMove"),et=Symbol("onDragStop"),rt=Symbol("scroll"),Dr={speed:6,sensitivity:50,scrollableElements:[]};class Or extends L{constructor(t){super(t),this.options={...Dr,...this.getOptions()},this.currentMousePosition=null,this.scrollAnimationFrame=null,this.scrollableElement=null,this.findScrollableElementFrame=null,this[Z]=this[Z].bind(this),this[tt]=this[tt].bind(this),this[et]=this[et].bind(this),this[rt]=this[rt].bind(this)}attach(){this.draggable.on("drag:start",this[Z]).on("drag:move",this[tt]).on("drag:stop",this[et])}detach(){this.draggable.off("drag:start",this[Z]).off("drag:move",this[tt]).off("drag:stop",this[et])}getOptions(){return this.draggable.options.scrollable||{}}getScrollableElement(t){return this.hasDefinedScrollableElements()?y(t,this.options.scrollableElements)||document.documentElement:Lr(t)}hasDefinedScrollableElements(){return this.options.scrollableElements.length!==0}[Z](t){this.findScrollableElementFrame=requestAnimationFrame(()=>{this.scrollableElement=this.getScrollableElement(t.source)})}[tt](t){if(this.findScrollableElementFrame=requestAnimationFrame(()=>{this.scrollableElement=this.getScrollableElement(t.sensorEvent.target)}),!this.scrollableElement)return;const e=t.sensorEvent,n={x:0,y:0};"ontouchstart"in window&&(n.y=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0,n.x=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0),this.currentMousePosition={clientX:e.clientX-n.x,clientY:e.clientY-n.y},this.scrollAnimationFrame=requestAnimationFrame(this[rt])}[et](){cancelAnimationFrame(this.scrollAnimationFrame),cancelAnimationFrame(this.findScrollableElementFrame),this.scrollableElement=null,this.scrollAnimationFrame=null,this.findScrollableElementFrame=null,this.currentMousePosition=null}[rt](){if(!this.scrollableElement||!this.currentMousePosition)return;cancelAnimationFrame(this.scrollAnimationFrame);const{speed:t,sensitivity:e}=this.options,n=this.scrollableElement.getBoundingClientRect(),i=n.bottom>window.innerHeight,o=n.top<0||i,a=It(),l=this.scrollableElement,h=this.currentMousePosition.clientX,g=this.currentMousePosition.clientY;if(l!==document.body&&l!==document.documentElement&&!o){const{offsetHeight:d,offsetWidth:c}=l;n.top+d-g<e?l.scrollTop+=t:g-n.top<e&&(l.scrollTop-=t),n.left+c-h<e?l.scrollLeft+=t:h-n.left<e&&(l.scrollLeft-=t)}else{const{innerHeight:d,innerWidth:c}=window;g<e?a.scrollTop-=t:d-g<e&&(a.scrollTop+=t),h<e?a.scrollLeft-=t:c-h<e&&(a.scrollLeft+=t)}this.scrollAnimationFrame=requestAnimationFrame(this[rt])}}function Mr(r){const t=/(auto|scroll)/,e=getComputedStyle(r,null),n=e.getPropertyValue("overflow")+e.getPropertyValue("overflow-y")+e.getPropertyValue("overflow-x");return t.test(n)}function Tr(r){return getComputedStyle(r).getPropertyValue("position")==="static"}function Lr(r){if(!r)return It();const t=getComputedStyle(r).getPropertyValue("position"),e=t==="absolute",n=y(r,i=>e&&Tr(i)?!1:Mr(i));return t==="fixed"||!n?It():n}function It(){return document.scrollingElement||document.documentElement}class Ar{constructor(){this.callbacks={}}on(t,...e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(...e),this}off(t,e){if(!this.callbacks[t])return null;const n=this.callbacks[t].slice(0);for(let i=0;i<n.length;i++)e===n[i]&&this.callbacks[t].splice(i,1);return this}trigger(t){if(!this.callbacks[t.type])return null;const e=[...this.callbacks[t.type]],n=[];for(let i=e.length-1;i>=0;i--){const s=e[i];try{s(t)}catch(o){n.push(o)}}return n.length&&console.error(`Draggable caught errors while triggering '${t.type}'`,n),this}}class qt extends C{get draggable(){return this.data.draggable}}qt.type="draggable";class De extends qt{}De.type="draggable:initialize";class Oe extends qt{}Oe.type="draggable:destroy";const nt=Symbol("onDragStart"),Y=Symbol("onDragMove"),st=Symbol("onDragStop"),it=Symbol("onDragPressure"),ot=Symbol("dragStop"),Fr={"drag:start":r=>`Picked up ${r.source.textContent.trim()||r.source.id||"draggable element"}`,"drag:stop":r=>`Released ${r.source.textContent.trim()||r.source.id||"draggable element"}`},Ir={"container:dragging":"draggable-container--is-dragging","source:dragging":"draggable-source--is-dragging","source:placed":"draggable-source--placed","container:placed":"draggable-container--placed","body:dragging":"draggable--is-dragging","draggable:over":"draggable--over","container:over":"draggable-container--over","source:original":"draggable--original",mirror:"draggable-mirror"},Xr={draggable:".draggable-source",handle:null,delay:{},distance:0,placedTimeout:800,plugins:[],sensors:[],exclude:{plugins:[],sensors:[]}};class N{constructor(t=[document.body],e={}){if(t instanceof NodeList||t instanceof Array)this.containers=[...t];else if(t instanceof HTMLElement)this.containers=[t];else throw new Error("Draggable containers are expected to be of type `NodeList`, `HTMLElement[]` or `HTMLElement`");this.options={...Xr,...e,classes:{...Ir,...e.classes||{}},announcements:{...Fr,...e.announcements||{}},exclude:{plugins:e.exclude&&e.exclude.plugins||[],sensors:e.exclude&&e.exclude.sensors||[]}},this.emitter=new Ar,this.dragging=!1,this.plugins=[],this.sensors=[],this[nt]=this[nt].bind(this),this[Y]=this[Y].bind(this),this[st]=this[st].bind(this),this[it]=this[it].bind(this),this[ot]=this[ot].bind(this),document.addEventListener("drag:start",this[nt],!0),document.addEventListener("drag:move",this[Y],!0),document.addEventListener("drag:stop",this[st],!0),document.addEventListener("drag:pressure",this[it],!0);const n=Object.values(N.Plugins).filter(o=>!this.options.exclude.plugins.includes(o)),i=Object.values(N.Sensors).filter(o=>!this.options.exclude.sensors.includes(o));this.addPlugin(...n,...this.options.plugins),this.addSensor(...i,...this.options.sensors);const s=new De({draggable:this});this.on("mirror:created",({mirror:o})=>this.mirror=o),this.on("mirror:destroy",()=>this.mirror=null),this.trigger(s)}destroy(){document.removeEventListener("drag:start",this[nt],!0),document.removeEventListener("drag:move",this[Y],!0),document.removeEventListener("drag:stop",this[st],!0),document.removeEventListener("drag:pressure",this[it],!0);const t=new Oe({draggable:this});this.trigger(t),this.removePlugin(...this.plugins.map(e=>e.constructor)),this.removeSensor(...this.sensors.map(e=>e.constructor))}addPlugin(...t){const e=t.map(n=>new n(this));return e.forEach(n=>n.attach()),this.plugins=[...this.plugins,...e],this}removePlugin(...t){return this.plugins.filter(n=>
1t.includes(n.constructor)).forEach(n=>n.detach()),this.plugins=this.plugins.filter(n=>!t.includes(n.constructor)),this}addSensor(...t){const e=t.map(n=>new n(this.containers,this.options));return e.forEach(n=>n.attach()),this.sensors=[...this.sensors,...e],this}removeSensor(...t){return this.sensors.filter(n=>t.includes(n.constructor)).forEach(n=>n.detach()),this.sensors=this.sensors.filter(n=>!t.includes(n.constructor)),this}addContainer(...t){return this.containers=[...this.containers,...t],this.sensors.forEach(e=>e.addContainer(...t)),this}removeContainer(...t){return this.containers=this.containers.filter(e=>!t.includes(e)),this.sensors.forEach(e=>e.removeContainer(...t)),this}on(t,...e){return this.emitter.on(t,...e),this}off(t,e){return this.emitter.off(t,e),this}trigger(t){return this.emitter.trigger(t),this}getClassNameFor(t){return this.getClassNamesFor(t)[0]}getClassNamesFor(t){const e=this.options.classes[t];return e instanceof Array?e:typeof e=="string"||e instanceof String?[e]:[]}isDragging(){return!!this.dragging}getDraggableElements(){return this.containers.reduce((t,e)=>[...t,...this.getDraggableElementsForContainer(e)],[])}getDraggableElementsForContainer(t){return[...t.querySelectorAll(this.options.draggable)].filter(n=>n!==this.originalSource&&n!==this.mirror)}cancel(){this[ot]()}[nt](t){const e=bt(t),{target:n,container:i,originalSource:s}=e;if(!this.containers.includes(i))return;if(this.options.handle&&n&&!y(n,this.options.handle)){e.cancel();return}this.originalSource=s,this.sourceContainer=i,this.lastPlacedSource&&this.lastPlacedContainer&&(clearTimeout(this.placedTimeoutID),this.lastPlacedSource.classList.remove(...this.getClassNamesFor("source:placed")),this.lastPlacedContainer.classList.remove(...this.getClassNamesFor("container:placed"))),this.source=this.originalSource.cloneNode(!0),this.originalSource.parentNode.insertBefore(this.source,this.originalSource),this.originalSource.style.display="none";const o=new zt({source:this.source,originalSource:this.originalSource,sourceContainer:i,sensorEvent:e});if(this.trigger(o),this.dragging=!o.canceled(),o.canceled()){this.source.remove(),this.originalSource.style.display=null;return}this.originalSource.classList.add(...this.getClassNamesFor("source:original")),this.source.classList.add(...this.getClassNamesFor("source:dragging")),this.sourceContainer.classList.add(...this.getClassNamesFor("container:dragging")),document.body.classList.add(...this.getClassNamesFor("body:dragging")),Qt(document.body,"none"),requestAnimationFrame(()=>{const l=bt(t).clone({target:this.source});this[Y]({...t,detail:l})})}[Y](t){if(!this.dragging)return;const e=bt(t),{container:n}=e;let i=e.target;const s=new ae({source:this.source,originalSource:this.originalSource,sourceContainer:n,sensorEvent:e});this.trigger(s),s.canceled()&&e.cancel(),i=y(i,this.options.draggable);const o=y(e.target,this.containers),a=e.overContainer||o,l=this.currentOverContainer&&a!==this.currentOverContainer,h=this.currentOver&&i!==this.currentOver,g=a&&this.currentOverContainer!==a,d=o&&i&&this.currentOver!==i;if(h){const c=new le({source:this.source,originalSource:this.originalSource,sourceContainer:n,sensorEvent:e,over:this.currentOver,overContainer:this.currentOverContainer});this.currentOver.classList.remove(...this.getClassNamesFor("draggable:over")),this.currentOver=null,this.trigger(c)}if(l){const c=new de({source:this.source,originalSource:this.originalSource,sourceContainer:n,sensorEvent:e,overContainer:this.currentOverContainer});this.currentOverContainer.classList.remove(...this.getClassNamesFor("container:over")),this.currentOverContainer=null,this.trigger(c)}if(g){a.classList.add(...this.getClassNamesFor("container:over"));const c=new ce({source:this.source,originalSource:this.originalSource,sourceContainer:n,sensorEvent:e,overContainer:a});this.currentOverContainer=a,this.trigger(c)}if(d){i.classList.add(...this.getClassNamesFor("draggable:over"));const c=new wt({source:this.source,originalSource:this.originalSource,sourceContainer:n,sensorEvent:e,overContainer:a,over:i});this.currentOver=i,this.trigger(c)}}[ot](t){if(!this.dragging)return;this.dragging=!1;const e=new kt({source:this.source,originalSource:this.originalSource,sensorEvent:t?t.sensorEvent:null,sourceContainer:this.sourceContainer});this.trigger(e),e.canceled()||this.source.parentNode.insertBefore(this.originalSource,this.source),this.source.remove(),this.originalSource.style.display="",this.source.classList.remove(...this.getClassNamesFor("source:dragging")),this.originalSource.classList.remove(...this.getClassNamesFor("source:original")),this.originalSource.classList.add(...this.getClassNamesFor("source:placed")),this.sourceContainer.classList.add(...this.getClassNamesFor("container:placed")),this.sourceContainer.classList.remove(...this.getClassNamesFor("container:dragging")),document.body.classList.remove(...this.getClassNamesFor("body:dragging")),Qt(document.body,""),this.currentOver&&this.currentOver.classList.remove(...this.getClassNamesFor("draggable:over")),this.currentOverContainer&&this.currentOverContainer.classList.remove(...this.getClassNamesFor("container:over")),this.lastPlacedSource=this.originalSource,this.lastPlacedContainer=this.sourceContainer,this.placedTimeoutID=setTimeout(()=>{this.lastPlacedSource&&this.lastPlacedSource.classList.remove(...this.getClassNamesFor("source:placed")),this.lastPlacedContainer&&this.lastPlacedContainer.classList.remove(...this.getClassNamesFor("container:placed")),this.lastPlacedSource=null,this.lastPlacedContainer=null},this.options.placedTimeout);const n=new ue({source:this.source,originalSource:this.originalSource,sensorEvent:t?t.sensorEvent:null,sourceContainer:this.sourceContainer});this.trigger(n),this.source=null,this.originalSource=null,this.currentOverContainer=null,this.currentOver=null,this.sourceContainer=null}[st](t){this[ot](t)}[it](t){if(!this.dragging)return;const e=bt(t),n=this.source||y(e.originalEvent.target,this.options.draggable),i=new he({sensorEvent:e,source:n,pressure:e.pressure});this.trigger(i)}}N.Plugins={Announcement:dr,Focusable:mr,Mirror:br,Scrollable:Or};N.Sensors={MouseSensor:Be,TouchSensor:qe};function bt(r){return r.detail}function Qt(r,t){r.style.webkitUserSelect=t,r.style.mozUserSelect=t,r.style.msUserSelect=t,r.style.oUserSelect=t,r.style.userSelect=t}class ht extends C{constructor(t){super(t),this.data=t}get dragEvent(){return this.data.dragEvent}}ht.type="droppable";class Me extends ht{get dropzone(){return this.data.dropzone}}Me.type="droppable:start";Me.cancelable=!0;class Te extends ht{get dropzone(){return this.data.dropzone}}Te.type="droppable:dropped";Te.cancelable=!0;class Le extends ht{get dropzone(){return this.data.dropzone}}Le.type="droppable:returned";Le.cancelable=!0;class Ae extends ht{get dropzone(){return this.data.dropzone}}Ae.type="droppable:stop";Ae.cancelable=!0;class ut extends C{constructor(t){super(t),this.data=t}get dragEvent(){return this.data.dragEvent}}ut.type="swappable";class Fe extends ut{}Fe.type="swappable:start";Fe.cancelable=!0;class Ie extends ut{get over(){return this.data.over}get overContainer(){return this.data.overContainer}}
1Ie.type="swappable:swap";Ie.cancelable=!0;class Pr extends ut{get swappedElement(){return this.data.swappedElement}}Pr.type="swappable:swapped";class Yr extends ut{}Yr.type="swappable:stop";class gt extends C{constructor(t){super(t),this.data=t}get dragEvent(){return this.data.dragEvent}}gt.type="sortable";class Rt extends gt{get startIndex(){return this.data.startIndex}get startContainer(){return this.data.startContainer}}Rt.type="sortable:start";Rt.cancelable=!0;class Ct extends gt{get currentIndex(){return this.data.currentIndex}get over(){return this.data.over}get overContainer(){return this.data.dragEvent.overContainer}}Ct.type="sortable:sort";Ct.cancelable=!0;class Xt extends gt{get oldIndex(){return this.data.oldIndex}get newIndex(){return this.data.newIndex}get oldContainer(){return this.data.oldContainer}get newContainer(){return this.data.newContainer}}Xt.type="sortable:sorted";class Xe extends gt{get oldIndex(){return this.data.oldIndex}get newIndex(){return this.data.newIndex}get oldContainer(){return this.data.oldContainer}get newContainer(){return this.data.newContainer}}Xe.type="sortable:stop";const at=Symbol("onDragStart"),lt=Symbol("onDragOverContainer"),ct=Symbol("onDragOver"),dt=Symbol("onDragStop");function Nr({dragEvent:r}){const t=r.source.textContent.trim()||r.source.id||"sortable element";if(r.over){const e=r.over.textContent.trim()||r.over.id||"sortable element";return r.source.compareDocumentPosition(r.over)&Node.DOCUMENT_POSITION_FOLLOWING?`Placed ${t} after ${e}`:`Placed ${t} before ${e}`}else return`Placed ${t} into a different container`}const $r={"sortable:sorted":Nr};class zr extends N{constructor(t=[],e={}){super(t,{...e,announcements:{...$r,...e.announcements||{}}}),this.startIndex=null,this.startContainer=null,this[at]=this[at].bind(this),this[lt]=this[lt].bind(this),this[ct]=this[ct].bind(this),this[dt]=this[dt].bind(this),this.on("drag:start",this[at]).on("drag:over:container",this[lt]).on("drag:over",this[ct]).on("drag:stop",this[dt])}destroy(){super.destroy(),this.off("drag:start",this[at]).off("drag:over:container",this[lt]).off("drag:over",this[ct]).off("drag:stop",this[dt])}index(t){return this.getSortableElementsForContainer(t.parentNode).indexOf(t)}getSortableElementsForContainer(t){return[...t.querySelectorAll(this.options.draggable)].filter(n=>n!==this.originalSource&&n!==this.mirror&&n.parentNode===t)}[at](t){this.startContainer=t.source.parentNode,this.startIndex=this.index(t.source);const e=new Rt({dragEvent:t,startIndex:this.startIndex,startContainer:this.startContainer});this.trigger(e),e.canceled()&&t.cancel()}[lt](t){if(t.canceled())return;const{source:e,over:n,overContainer:i}=t,s=this.index(e),o=new Ct({dragEvent:t,currentIndex:s,source:e,over:n});if(this.trigger(o),o.canceled())return;const a=this.getSortableElementsForContainer(i),l=te({source:e,over:n,overContainer:i,children:a});if(!l)return;const{oldContainer:h,newContainer:g}=l,d=this.index(t.source),c=new Xt({dragEvent:t,oldIndex:s,newIndex:d,oldContainer:h,newContainer:g});this.trigger(c)}[ct](t){if(t.over===t.originalSource||t.over===t.source)return;const{source:e,over:n,overContainer:i}=t,s=this.index(e),o=new Ct({dragEvent:t,currentIndex:s,source:e,over:n});if(this.trigger(o),o.canceled())return;const a=this.getDraggableElementsForContainer(i),l=te({source:e,over:n,overContainer:i,children:a});if(!l)return;const{oldContainer:h,newContainer:g}=l,d=this.index(e),c=new Xt({dragEvent:t,oldIndex:s,newIndex:d,oldContainer:h,newContainer:g});this.trigger(c)}[dt](t){const e=new Xe({dragEvent:t,oldIndex:this.startIndex,newIndex:this.index(t.source),oldContainer:this.startContainer,newContainer:t.source.parentNode});this.trigger(e),this.startIndex=null,this.startContainer=null}}function Zt(r){return Array.prototype.indexOf.call(r.parentNode.children,r)}function te({source:r,over:t,overContainer:e,children:n}){const i=!n.length,s=r.parentNode!==e,o=t&&r.parentNode===t.parentNode;return i?kr(r,e):o?jr(r,t):s?Ur(r,t,e):null}function kr(r,t){const e=r.parentNode;return t.appendChild(r),{oldContainer:e,newContainer:t}}function jr(r,t){const e=Zt(r),n=Zt(t);return e<n?r.parentNode.insertBefore(r,t.nextElementSibling):r.parentNode.insertBefore(r,t),{oldContainer:r.parentNode,newContainer:r.parentNode}}function Ur(r,t,e){const n=r.parentNode;return t?t.parentNode.insertBefore(r,t):e.appendChild(r),{oldContainer:n,newContainer:r.parentNode}}class qr{constructor(t,e=""){w(this,"sortable");w(this,"container");w(this,"list");w(this,"orderUrl");w(this,"orderXhr");w(this,"deleteUrl");w(this,"onUpdateOrderSuccess");w(this,"onDeleteSuccess");w(this,"onEditItem");if(this.container=t,e?this.list=$(e,this.container):this.list=this.container,this.container.length!==1||this.list.length!==1){console.error(`unable to start list manager for ${t}. It does not appear on this page`);return}this.orderUrl=this.container.data("order-url")||this.list.data("sort
1-url"),this.orderUrl?this.initSorting():console.warn("list item manager used but there is no data-order-url defined"),this.deleteUrl=this.container.data("delete-url"),this.deleteUrl?$(".js-DeleteBtn",this.container).on("click",n=>this.onDeleteClick(n)):console.warn("list item manager used but there is no data-delete-url defined"),$(".js-EditBtn",this.container).on("click",n=>this.onEditClick(n))}initSorting(){this.sortable=new zr(this.list.get(0),{draggable:".js-Item",mirror:{appendTo:"body",constrainDimensions:!0,xAxis:!1},plugins:[Ee]}),this.sortable.on("drag:start",t=>{$(t.originalEvent.target).closest(".js-MoveInitiator").length||(t.cancel(),$(t.sourceContainer).children().attr("style",""))}),this.sortable.on("drag:out:container",()=>{this.sortable.mirror.classList.add("Faded")}),this.sortable.on("drag:over:container",()=>{this.sortable.mirror.classList.remove("Faded")}),this.sortable.on("sortable:stop",()=>{setTimeout(()=>this.updateOrder(),0)})}updateOrder(){const t=[];this.list.find(".js-Item[data-id]").each((e,n)=>{t.push($(n).data("id"))}),this.orderXhr&&this.orderXhr.abort(),this.orderXhr=$.ajax({url:this.orderUrl,method:"POST",data:{order:t},success:()=>{this.onUpdateOrderSuccess&&this.onUpdateOrderSuccess(t)},error:()=>{console.error("Order not saved")}})}onDeleteClick(t){const e=this.getItemFromEvent(t).data("id");$.ajax({url:this.deleteUrl,method:"POST",data:{id:e},success:()=>{$(`.js-Item[data-id="${e}"]`,this.list).remove(),this.onDeleteSuccess&&this.onDeleteSuccess(e)},error:()=>{console.error("Failed to delete item")}})}onEditClick(t){const n=this.getItemFromEvent(t).data("formdata");this.onEditItem&&this.onEditItem(n)}getItemFromEvent(t){return $(t.currentTarget).closest(".js-Item")}}export{qr as SortableList};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.