rumine-web/static/wagtailadmin/js/core.316db9cf7dda.js

2 lines
73 KiB
JavaScript

/*! For license information please see core.js.LICENSE.txt */
(()=>{"use strict";var e,t={6525:(e,t,n)=>{var i=n(5311),o=n.n(i),r=n(6599),a=n(7647),s=n.n(a),l=n(1302),c=n(3407),h=n(5697),d=n.n(h);d().shape({live:d().bool.isRequired,status:d().string.isRequired}).isRequired;var u=n(335),p=n.n(u);const f=({name:e,component:t,className:n,duration:i,children:o})=>s().createElement(p(),{component:t,transitionEnterTimeout:i,transitionLeaveTimeout:i,transitionName:`w-transition-${e}`,className:n},o);f.propTypes={name:d().oneOf(["push","pop"]).isRequired,component:d().string,className:d().string,duration:d().number,children:d().node},f.defaultProps={component:"div",children:null,className:null,duration:210};var g=n(434);class m extends r.Controller{static values={continue:{type:Boolean,default:!1},url:String};click(){this.element.click()}noop(){}post(e){e.preventDefault(),e.stopPropagation();const t=document.createElement("form");t.action=this.urlValue,t.method="POST";const n=document.createElement("input");if(n.type="hidden",n.name="csrfmiddlewaretoken",n.value=g.QF.CSRF_TOKEN,t.appendChild(n),!this.continueValue){const e=document.createElement("input");e.type="hidden",e.name="next",e.value=window.location.href,t.appendChild(e)}document.body.appendChild(t),t.submit()}redirect(e){const t=e?.params?.url??e?.detail?.url??this.element.value;t&&window.location.assign(t)}reset(e){const t=this.element,n=t.value,{value:i=""}={value:t instanceof HTMLInputElement?t.defaultValue:"",...e?.params,...e?.detail};n!==i&&(t.value=i,this.dispatch("change",{bubbles:!0,cancelable:!1,prefix:"",target:t}))}select(){const e=this.element;e&&(e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement)&&e.select()}}var v=new Map;function b(e){var t=v.get(e);t&&t.destroy()}function y(e){var t=v.get(e);t&&t.update()}var w=null;"undefined"==typeof window?((w=function(e){return e}).destroy=function(e){return e},w.update=function(e){return e}):((w=function(e,t){return e&&Array.prototype.forEach.call(e.length?e:[e],(function(e){return function(e){if(e&&e.nodeName&&"TEXTAREA"===e.nodeName&&!v.has(e)){var t,n=null,i=window.getComputedStyle(e),o=(t=e.value,function(){a({testForHeightReduction:""===t||!e.value.startsWith(t),restoreTextAlign:null}),t=e.value}),r=function(t){e.removeEventListener("autosize:destroy",r),e.removeEventListener("autosize:update",s),e.removeEventListener("input",o),window.removeEventListener("resize",s),Object.keys(t).forEach((function(n){return e.style[n]=t[n]})),v.delete(e)}.bind(e,{height:e.style.height,resize:e.style.resize,textAlign:e.style.textAlign,overflowY:e.style.overflowY,overflowX:e.style.overflowX,wordWrap:e.style.wordWrap});e.addEventListener("autosize:destroy",r),e.addEventListener("autosize:update",s),e.addEventListener("input",o),window.addEventListener("resize",s),e.style.overflowX="hidden",e.style.wordWrap="break-word",v.set(e,{destroy:r,update:s}),s()}function a(t){var o,r,s=t.restoreTextAlign,l=void 0===s?null:s,c=t.testForHeightReduction,h=void 0===c||c,d=i.overflowY;if(0!==e.scrollHeight&&("vertical"===i.resize?e.style.resize="none":"both"===i.resize&&(e.style.resize="horizontal"),h&&(o=function(e){for(var t=[];e&&e.parentNode&&e.parentNode instanceof Element;)e.parentNode.scrollTop&&t.push([e.parentNode,e.parentNode.scrollTop]),e=e.parentNode;return function(){return t.forEach((function(e){var t=e[0],n=e[1];t.style.scrollBehavior="auto",t.scrollTop=n,t.style.scrollBehavior=null}))}}(e),e.style.height=""),r="content-box"===i.boxSizing?e.scrollHeight-(parseFloat(i.paddingTop)+parseFloat(i.paddingBottom)):e.scrollHeight+parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth),"none"!==i.maxHeight&&r>parseFloat(i.maxHeight)?("hidden"===i.overflowY&&(e.style.overflow="scroll"),r=parseFloat(i.maxHeight)):"hidden"!==i.overflowY&&(e.style.overflow="hidden"),e.style.height=r+"px",l&&(e.style.textAlign=l),o&&o(),n!==r&&(e.dispatchEvent(new Event("autosize:resized",{bubbles:!0})),n=r),d!==i.overflow&&!l)){var u=i.textAlign;"hidden"===i.overflow&&(e.style.textAlign="start"===u?"end":"start"),a({restoreTextAlign:u,testForHeightReduction:!0})}}function s(){a({testForHeightReduction:!0,restoreTextAlign:null})}}(e)})),e}).destroy=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],b),e},w.update=function(e){return e&&Array.prototype.forEach.call(e.length?e:[e],y),e});const E=w;var C=n(9437);class T extends r.Controller{resizeObserver;resize(){E.update(this.element)}initialize(){this.resize=(0,C.D)(this.resize.bind(this),50)}connect(){E(this.element),this.resizeObserver=new ResizeObserver(this.resize),this.resizeObserver.observe(this.element)}disconnect(){this.resizeObserver?.disconnect(),E.destroy(this.element)}}class S extends r.Controller{static classes=["actionInactive"];static targets=["action","all","item"];lastChanged;shiftActive;connect(){this.toggle(),this.handleShiftKey=this.handleShiftKey.bind(this),document.addEventListener("keydown",this.handleShiftKey),document.addEventListener("keyup",this.handleShiftKey)}getValidTargets(e=this.itemTargets){return e.filter((({disabled:e})=>!e))}handleShiftKey(e){if(!e)return;const{shiftKey:t,type:n}=e;"keydown"===n&&t&&(this.shiftActive=!0),"keyup"===n&&this.shiftActive&&(this.shiftActive=!1)}toggle(e){const t=this.getValidTargets(),n=this.lastChanged;if(this.shiftActive&&n instanceof HTMLElement){this.shiftActive=!1;const i=t.findIndex((e=>e===n)),o=t.findIndex((t=>t===e?.target)),[r,a]=[i,o].sort(((e,t)=>e-t));t.forEach(((e,n)=>{n>=r&&n<=a&&(e.checked=!!t[i].checked,this.dispatch("change",{target:e,bubbles:!0}))}))}this.lastChanged=t.find((t=>t.contains(e?.target)))??null;const i=t.filter((e=>e.checked)).length,o=i>0,r=i===t.length;this.getValidTargets(this.allTargets).forEach((e=>{e.checked=r}));const a=this.actionInactiveClasses;a.length&&this.actionTargets.forEach((e=>{a.forEach((t=>{e.classList.toggle(t,!o)}))}))}toggleAll(e){const{force:t=null}={...e.detail,...e.params};this.lastChanged=null;let n=!1;if("boolean"==typeof t)n=t;else if(e.target instanceof HTMLInputElement)n=e.target.checked;else{const e=this.allTargets[0];n=!e?.checked}this.getValidTargets().forEach((e=>{e.checked!==n&&(e.checked=n,e.dispatchEvent(new Event("change",{bubbles:!0})))})),this.toggle()}disconnect(){document?.removeEventListener("keydown",this.handleShiftKey),document?.removeEventListener("keyup",this.handleShiftKey)}}class A extends r.Controller{static targets=["value"];copy(e){const{value:t=(this.hasValueTarget?this.valueTarget.value:this.element.value||null)}={...e.detail,...e.params};t&&(this.dispatch("copy").defaultPrevented||new Promise(((e,n)=>{navigator.clipboard?navigator.clipboard.writeText(t).then(e,n):n()})).then((()=>this.dispatch("copied",{detail:{clear:!0,type:"success"}}))).catch((()=>this.dispatch("error",{detail:{clear:!0,type:"error"}}))))}}var D=n(4676);class V extends r.Controller{static classes=["added","hide","show"];static targets=["container","template"];static values={autoClear:{default:0,type:Number},clearDelay:{default:0,type:Number},showDelay:{default:0,type:Number}};isClearing;add(e){const{clear:t=!1,text:n="",type:i=null}={...e?.detail,...e?.params};this.element.classList.add(...this.addedClasses),t&&this.clear();const o=this.getTemplateContent(i);if(!o)return;const r=o.lastElementChild;r instanceof HTMLElement&&n&&(r.textContent=n),this.containerTarget.appendChild(o),(0,C.D)((()=>{this.element.classList.remove(...this.hideClasses),this.element.classList.add(...this.showClasses),this.dispatch("added")}),this.showDelayValue||null)().then((()=>{this.autoClearValue&&(0,C.D)((()=>{this.clear()}),this.autoClearValue)()}))}clear(e){if(this.isClearing=!1,!e)return void(this.containerTarget.innerHTML="");const t=this.clearDelayValue||null,n=this.element;this.isClearing=!0,n.classList.remove(...this.addedClasses),n.classList.remove(...this.showClasses),n.classList.add(...this.hideClasses),(0,C.D)(D.Z,t)().then((()=>{this?.isClearing&&(this.containerTarget.innerHTML="",this.dispatch("cleared"),this.isClearing=!1)}))}getTemplateContent(e){const t=e&&this.templateTargets.find((({dataset:t})=>t.type===e))||this.templateTarget,n=t.content.firstElementChild?.cloneNode(!0);return n instanceof HTMLElement?n:null}}var _=n(9408);class x extends r.Controller{static classes=["active"];static targets=["label","total"];static values={container:{default:"body",type:String},find:{default:".error-message,.help-critical",type:String},labels:{default:[],type:Array},min:{default:0,type:Number},total:{default:0,type:Number}};connect(){this.count()}count(){return this.totalValue=[...document.querySelectorAll(this.containerValue||"body")].map((e=>e.querySelectorAll(this.findValue).length)).reduce(((e,t)=>e+t),0),this.totalValue}getLabel(e){const t=(0,_.qP)("%(num)s error","%(num)s errors",e);if(this.labelsValue.length>1){const[t,n=this.labelsValue[1],i="__total__"]=this.labelsValue;return(0,_.qP)(t,n,e).replace(i,`${e}`)}return t.replace("%(num)s",`${e}`)}minValueChanged(){this.totalValueChanged(this.count())}totalValueChanged(e){const t=this.minValue;this.hasActiveClass&&this.element.classList.toggle(this.activeClass,e>t),this.hasLabelTarget&&(this.labelTarget.textContent=e>t?this.getLabel(e):""),this.hasTotalTarget&&(this.totalTarget.textContent=e>t?`${e}`:"")}}var L=n(859);class k extends r.Controller{static classes=["dismissed"];static values={dismissed:{default:!1,type:Boolean},id:{default:"",type:String}};toggle(){var e;this.idValue&&(this.element.classList.add(this.dismissedClass),this.dismissedValue=!0,e={[this.idValue]:!0},fetch(g.QF.ADMIN_URLS?.DISMISSIBLES,{method:"PATCH",headers:{[g.QF.CSRF_HEADER_NAME]:g.QF.CSRF_TOKEN,"Content-Type":"application/json"},body:JSON.stringify(e),mode:"same-origin"}))}}class O extends r.Controller{static targets=["count","menu","toggle"];static values={activeSubmenu:{default:"",type:String},countAttr:{default:"",type:String}};static outlets=["w-action","w-dropdown"];countTargetConnected(){this.updateCount()}connect(){this.open=this.open.bind(this)}wActionOutletConnected(e,t){t.addEventListener("click",this.open)}wActionOutletDisconnected(e,t){t.removeEventListener("click",this.open)}updateCount(){const e=document.querySelectorAll(`[${this.countAttrValue}]`).length;this.countTargets.forEach((t=>{const n=t.dataset.countName,i=n?document.querySelectorAll(`[${this.countAttrValue}=${n}]`).length:e;t.hidden=0===i,t.textContent=i.toString()}))}updateParams(e){const t=e;if("listing-results"===e.target?.id){const e=new URLSearchParams(t.detail?.requestUrl.split("?")[1]),n=new URLSearchParams;e.forEach(((e,t)=>{""===e.trim()||t.startsWith("_w_")||n.append(t,e)}));const i=`?${n.toString()}`;window.history.replaceState(null,"",i)}this.updateCount()}open(e){const t=e.target?.closest("button");this.activeSubmenuValue=t.getAttribute("aria-controls")||""}close(){this.activeSubmenuValue=""}delayedClose(){setTimeout((()=>this.close()),200)}activeSubmenuValueChanged(e,t){if(t){const e=document.querySelector(`[aria-controls="${t}"]`);this.toggle(!1,e)}if(e){const t=document.querySelector(`[aria-controls="${e}"]`);this.toggle(!0,t)}}preventOutletClickaway(e){const t=e.detail.target;if(!t)return;const n=this.toggleTargets.map((e=>e.getAttribute("aria-controls"))),i=t.closest("button")?.getAttribute("aria-controls")||"";n.includes(i)&&e.preventDefault()}toggle(e,t){this.hasWDropdownOutlet&&e&&this.wDropdownOutlet.show();const n=t.getAttribute("aria-controls"),i=this.element.querySelector(`#${n}`);i&&(t.setAttribute("aria-expanded",e.toString()),i.hidden=!e,this.menuTarget.hidden=e,e?i.focus():t.focus())}}var P=n(8689);const R=async()=>{"loading"===document.readyState&&await new Promise((e=>{document.addEventListener("DOMContentLoaded",(()=>e()),{once:!0,passive:!0})}))},N={name:"hideOnEsc",defaultValue:!0,fn({hide:e}){function t(t){"Escape"===t.key&&e()}return{onShow(){document.addEventListener("keydown",t)},onHide(){document.removeEventListener("keydown",t)}}}};class I extends r.Controller{static values={content:String,offset:Array,placement:{default:"bottom",type:String}};tippy;connect(){this.tippy=(0,P.ZP)(this.element,this.options)}contentValueChanged(e,t){t&&t!==e&&this.tippy?.setProps(this.options)}placementValueChanged(e,t){t&&t!==e&&this.tippy?.setProps(this.options)}hide(){this.tippy?.hide()}show(){this.tippy?.show()}get options(){return{content:this.contentValue,placement:this.placementValue,plugins:this.plugins,...this.hasOffsetValue&&{offset:this.offsetValue}}}get plugins(){return[N]}disconnect(){this.tippy?.destroy()}static afterLoad(){R().then((()=>{(0,P.ZP)("[data-tippy-content]",{plugins:[N]})}))}}const M={name:"hideTooltipOnBreadcrumbAndCollapse",fn({hide:e}){function t(){e()}return{onShow(){document.addEventListener("w-breadcrumbs:opened",t),document.addEventListener("w-breadcrumbs:closed",t)},onHide(){document.removeEventListener("w-breadcrumbs:closed",t),document.removeEventListener("w-breadcrumbs:opened",t)}}}},B={name:"hideTooltipOnClickInside",defaultValue:!0,fn(e){const t=()=>e.hide();return{onShow(){e.popper.addEventListener("click",t)},onHide(){e.popper.removeEventListener("click",t)}}}},F={name:"rotateToggleIcon",fn(e){const t=e.reference.querySelector(".icon-arrow-down, .icon-arrow-up");return t?{onShow:()=>t.classList.add("w-rotate-180"),onHide:()=>t.classList.remove("w-rotate-180")}:{}}};class H extends r.Controller{static targets=["toggle","content"];static values={hideOnClick:{default:!1,type:Boolean},keepMounted:{default:!1,type:Boolean},offset:Array,theme:{default:"dropdown",type:String}};tippy;connect(){this.tippy=(0,P.ZP)(this.toggleTarget,this.options)}hide(){this.tippy?.hide()}show(){this.tippy?.show()}get options(){const e=this.toggleTarget.getAttribute("aria-label");let t;return this.hasContentTarget&&(this.contentTarget.hidden=!1),e&&(t=(0,P.ZP)(this.toggleTarget,{content:e,placement:"bottom",plugins:[N]})),{...this.hasContentTarget?{content:this.contentTarget}:{},...this.themeOptions,trigger:"click",interactive:!0,...this.hasOffsetValue&&{offset:this.offsetValue},getReferenceClientRect:()=>this.reference.getBoundingClientRect(),theme:this.themeValue,onCreate:e=>{if(this.keepMountedValue){const{popper:t}=e;this.element.append(t),t.hidden=!0}},onShow:e=>{if(t&&t.disable(),this.keepMountedValue){const{popper:t}=e;t.hidden=!1}},onShown:()=>{this.dispatch("shown")},onHide:()=>{this.dispatch("hide"),t&&t.enable()},onHidden:e=>{if(this.keepMountedValue){const{popper:t}=e;this.element.append(t),t.hidden=!0}}}}get themeOptions(){return{dropdown:{arrow:!0,maxWidth:350,placement:"bottom",plugins:this.plugins},drilldown:{arrow:!1,maxWidth:"none",placement:"bottom-end",hideOnClick:!1,plugins:this.plugins.concat([this.hideTooltipOnClickAway])},"dropdown-button":{arrow:!1,maxWidth:"none",placement:"bottom-start",plugins:this.plugins}}[this.themeValue]}get hideTooltipOnClickAway(){return{name:"hideTooltipOnClickAway",fn:e=>{const t=t=>{this.dispatch("clickaway",{cancelable:!0,detail:{target:t.target}}).defaultPrevented||!e.state.isShown||this.reference.contains(t.target)&&!this.toggleTarget.contains(t.target)||e.hide()};return{onShow(){document.addEventListener("click",t)},onHide(){document.removeEventListener("click",t)}}}}}get plugins(){const e=[M,N,F];return this.hideOnClickValue&&e.push(B),e}get reference(){const e=this.toggleTarget.parentElement;return"dropdown-button"===this.themeValue?e.parentElement:e}}class z extends r.Controller{static classes=["ready","remove"];static values={delay:{default:-1,type:Number},event:{default:"",type:String}};connect(){this.ready()}ready(){const e=this.eventValue.split(" ").filter(Boolean),t=this.delayValue;(0,C.D)((()=>!0),t<0?null:t)().then((()=>{this.element.classList.add(...this.readyClasses),this.element.classList.remove(...this.removeClasses),this.dispatch("ready",{bubbles:!0,cancelable:!1}),e.forEach((e=>{this.dispatch(e,{bubbles:!0,cancelable:!1,prefix:""})})),this.remove()}))}remove(){const e=this.element,t=this.application.schema.controllerAttribute,n=(e.getAttribute(t)?.split(" ")??[]).filter((e=>e!==this.identifier)).join(" ");n?e.setAttribute(t,n):e.removeAttribute(t)}}class j extends r.Controller{static values={attrName:{default:"href",type:String},preserveKeys:{default:[],type:Array},reflectKeys:{default:["__all__"],type:Array}};get url(){return new URL(this.element.getAttribute(this.attrNameValue)||"",window.location.href)}connect(){this.setParamsFromLocation()}get reflectAll(){return this.reflectKeysValue.includes("__all__")}setParamsFromURL(e){const t=new URLSearchParams,n=this.reflectAll;e.searchParams.forEach(((e,i)=>{i.startsWith("_w_")||this.preserveKeysValue.includes(i)||!n&&!this.reflectKeysValue.includes(i)||t.append(i,e)}));const i=this.url;i.searchParams.forEach(((e,n)=>{this.preserveKeysValue.includes(n)&&t.append(n,e)})),i.search=t.toString(),this.element.setAttribute(this.attrNameValue,i.toString())}setParamsFromSwapRequest(e){e.detail?.requestUrl&&this.setParamsFromURL(new URL(e.detail.requestUrl,window.location.href))}setParamsFromLocation(){this.setParamsFromURL(new URL(window.location.href))}}function X(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function Y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?X(Object(n),!0).forEach((function(t){$(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):X(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function q(e){return q="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},q(e)}function $(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function U(){return U=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},U.apply(this,arguments)}function W(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var K=W(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),Z=W(/Edge/i),G=W(/firefox/i),Q=W(/safari/i)&&!W(/chrome/i)&&!W(/android/i),J=W(/iP(ad|od|hone)/i),ee=W(/chrome/i)&&W(/android/i),te={capture:!1,passive:!1};function ne(e,t,n){e.addEventListener(t,n,!K&&te)}function ie(e,t,n){e.removeEventListener(t,n,!K&&te)}function oe(e,t){if(t){if(">"===t[0]&&(t=t.substring(1)),e)try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return!1}return!1}}function re(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function ae(e,t,n,i){if(e){n=n||document;do{if(null!=t&&(">"===t[0]?e.parentNode===n&&oe(e,t):oe(e,t))||i&&e===n)return e;if(e===n)break}while(e=re(e))}return null}var se,le=/\s+/g;function ce(e,t,n){if(e&&t)if(e.classList)e.classList[n?"add":"remove"](t);else{var i=(" "+e.className+" ").replace(le," ").replace(" "+t+" "," ");e.className=(i+(n?" "+t:"")).replace(le," ")}}function he(e,t,n){var i=e&&e.style;if(i){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),void 0===t?n:n[t];t in i||-1!==t.indexOf("webkit")||(t="-webkit-"+t),i[t]=n+("string"==typeof n?"":"px")}}function de(e,t){var n="";if("string"==typeof e)n=e;else do{var i=he(e,"transform");i&&"none"!==i&&(n=i+" "+n)}while(!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function ue(e,t,n){if(e){var i=e.getElementsByTagName(t),o=0,r=i.length;if(n)for(;o<r;o++)n(i[o],o);return i}return[]}function pe(){return document.scrollingElement||document.documentElement}function fe(e,t,n,i,o){if(e.getBoundingClientRect||e===window){var r,a,s,l,c,h,d;if(e!==window&&e.parentNode&&e!==pe()?(a=(r=e.getBoundingClientRect()).top,s=r.left,l=r.bottom,c=r.right,h=r.height,d=r.width):(a=0,s=0,l=window.innerHeight,c=window.innerWidth,h=window.innerHeight,d=window.innerWidth),(t||n)&&e!==window&&(o=o||e.parentNode,!K))do{if(o&&o.getBoundingClientRect&&("none"!==he(o,"transform")||n&&"static"!==he(o,"position"))){var u=o.getBoundingClientRect();a-=u.top+parseInt(he(o,"border-top-width")),s-=u.left+parseInt(he(o,"border-left-width")),l=a+r.height,c=s+r.width;break}}while(o=o.parentNode);if(i&&e!==window){var p=de(o||e),f=p&&p.a,g=p&&p.d;p&&(l=(a/=g)+(h/=g),c=(s/=f)+(d/=f))}return{top:a,left:s,bottom:l,right:c,width:d,height:h}}}function ge(e,t,n){for(var i=we(e,!0),o=fe(e)[t];i;){var r=fe(i)[n];if(!("top"===n||"left"===n?o>=r:o<=r))return i;if(i===pe())break;i=we(i,!1)}return!1}function me(e,t,n,i){for(var o=0,r=0,a=e.children;r<a.length;){if("none"!==a[r].style.display&&a[r]!==Ct.ghost&&(i||a[r]!==Ct.dragged)&&ae(a[r],n.draggable,e,!1)){if(o===t)return a[r];o++}r++}return null}function ve(e,t){for(var n=e.lastElementChild;n&&(n===Ct.ghost||"none"===he(n,"display")||t&&!oe(n,t));)n=n.previousElementSibling;return n||null}function be(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===Ct.clone||t&&!oe(e,t)||n++;return n}function ye(e){var t=0,n=0,i=pe();if(e)do{var o=de(e),r=o.a,a=o.d;t+=e.scrollLeft*r,n+=e.scrollTop*a}while(e!==i&&(e=e.parentNode));return[t,n]}function we(e,t){if(!e||!e.getBoundingClientRect)return pe();var n=e,i=!1;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var o=he(n);if(n.clientWidth<n.scrollWidth&&("auto"==o.overflowX||"scroll"==o.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==o.overflowY||"scroll"==o.overflowY)){if(!n.getBoundingClientRect||n===document.body)return pe();if(i||t)return n;i=!0}}}while(n=n.parentNode);return pe()}function Ee(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function Ce(e,t){return function(){if(!se){var n=arguments;1===n.length?e.call(this,n[0]):e.apply(this,n),se=setTimeout((function(){se=void 0}),t)}}}function Te(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function Se(e){var t=window.Polymer,n=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(!0):n?n(e).clone(!0)[0]:e.cloneNode(!0)}var Ae="Sortable"+(new Date).getTime();var De=[],Ve={initializeByDefault:!0},_e={mount:function(e){for(var t in Ve)Ve.hasOwnProperty(t)&&!(t in e)&&(e[t]=Ve[t]);De.forEach((function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")})),De.push(e)},pluginEvent:function(e,t,n){var i=this;this.eventCanceled=!1,n.cancel=function(){i.eventCanceled=!0};var o=e+"Global";De.forEach((function(i){t[i.pluginName]&&(t[i.pluginName][o]&&t[i.pluginName][o](Y({sortable:t},n)),t.options[i.pluginName]&&t[i.pluginName][e]&&t[i.pluginName][e](Y({sortable:t},n)))}))},initializePlugins:function(e,t,n,i){for(var o in De.forEach((function(i){var o=i.pluginName;if(e.options[o]||i.initializeByDefault){var r=new i(e,t,e.options);r.sortable=e,r.options=e.options,e[o]=r,U(n,r.defaults)}})),e.options)if(e.options.hasOwnProperty(o)){var r=this.modifyOption(e,o,e.options[o]);void 0!==r&&(e.options[o]=r)}},getEventProperties:function(e,t){var n={};return De.forEach((function(i){"function"==typeof i.eventProperties&&U(n,i.eventProperties.call(t[i.pluginName],e))})),n},modifyOption:function(e,t,n){var i;return De.forEach((function(o){e[o.pluginName]&&o.optionListeners&&"function"==typeof o.optionListeners[t]&&(i=o.optionListeners[t].call(e[o.pluginName],n))})),i}};var xe=["evt"],Le=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},i=n.evt,o=function(e,t){if(null==e)return{};var n,i,o=function(e,t){if(null==e)return{};var n,i,o={},r=Object.keys(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(n,xe);_e.pluginEvent.bind(Ct)(e,t,Y({dragEl:Oe,parentEl:Pe,ghostEl:Re,rootEl:Ne,nextEl:Ie,lastDownEl:Me,cloneEl:Be,cloneHidden:Fe,dragStarted:Qe,putSortable:qe,activeSortable:Ct.active,originalEvent:i,oldIndex:He,oldDraggableIndex:je,newIndex:ze,newDraggableIndex:Xe,hideGhostForTarget:bt,unhideGhostForTarget:yt,cloneNowHidden:function(){Fe=!0},cloneNowShown:function(){Fe=!1},dispatchSortableEvent:function(e){ke({sortable:t,name:e,originalEvent:i})}},o))};function ke(e){!function(e){var t=e.sortable,n=e.rootEl,i=e.name,o=e.targetEl,r=e.cloneEl,a=e.toEl,s=e.fromEl,l=e.oldIndex,c=e.newIndex,h=e.oldDraggableIndex,d=e.newDraggableIndex,u=e.originalEvent,p=e.putSortable,f=e.extraEventProperties;if(t=t||n&&n[Ae]){var g,m=t.options,v="on"+i.charAt(0).toUpperCase()+i.substr(1);!window.CustomEvent||K||Z?(g=document.createEvent("Event")).initEvent(i,!0,!0):g=new CustomEvent(i,{bubbles:!0,cancelable:!0}),g.to=a||n,g.from=s||n,g.item=o||n,g.clone=r,g.oldIndex=l,g.newIndex=c,g.oldDraggableIndex=h,g.newDraggableIndex=d,g.originalEvent=u,g.pullMode=p?p.lastPutMode:void 0;var b=Y(Y({},f),_e.getEventProperties(i,t));for(var y in b)g[y]=b[y];n&&n.dispatchEvent(g),m[v]&&m[v].call(t,g)}}(Y({putSortable:qe,cloneEl:Be,targetEl:Oe,rootEl:Ne,oldIndex:He,oldDraggableIndex:je,newIndex:ze,newDraggableIndex:Xe},e))}var Oe,Pe,Re,Ne,Ie,Me,Be,Fe,He,ze,je,Xe,Ye,qe,$e,Ue,We,Ke,Ze,Ge,Qe,Je,et,tt,nt,it=!1,ot=!1,rt=[],at=!1,st=!1,lt=[],ct=!1,ht=[],dt="undefined"!=typeof document,ut=J,pt=Z||K?"cssFloat":"float",ft=dt&&!ee&&!J&&"draggable"in document.createElement("div"),gt=function(){if(dt){if(K)return!1;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),mt=function(e,t){var n=he(e),i=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=me(e,0,t),r=me(e,1,t),a=o&&he(o),s=r&&he(r),l=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+fe(o).width,c=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+fe(r).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&a.float&&"none"!==a.float){var h="left"===a.float?"left":"right";return!r||"both"!==s.clear&&s.clear!==h?"horizontal":"vertical"}return o&&("block"===a.display||"flex"===a.display||"table"===a.display||"grid"===a.display||l>=i&&"none"===n[pt]||r&&"none"===n[pt]&&l+c>i)?"vertical":"horizontal"},vt=function(e){function t(e,n){return function(i,o,r,a){var s=i.options.group.name&&o.options.group.name&&i.options.group.name===o.options.group.name;if(null==e&&(n||s))return!0;if(null==e||!1===e)return!1;if(n&&"clone"===e)return e;if("function"==typeof e)return t(e(i,o,r,a),n)(i,o,r,a);var l=(n?i:o).options.group.name;return!0===e||"string"==typeof e&&e===l||e.join&&e.indexOf(l)>-1}}var n={},i=e.group;i&&"object"==q(i)||(i={name:i}),n.name=i.name,n.checkPull=t(i.pull,!0),n.checkPut=t(i.put),n.revertClone=i.revertClone,e.group=n},bt=function(){!gt&&Re&&he(Re,"display","none")},yt=function(){!gt&&Re&&he(Re,"display","")};dt&&!ee&&document.addEventListener("click",(function(e){if(ot)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),ot=!1,!1}),!0);var wt=function(e){if(Oe){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,r=e.clientY,rt.some((function(e){var t=e[Ae].options.emptyInsertThreshold;if(t&&!ve(e)){var n=fe(e),i=o>=n.left-t&&o<=n.right+t,s=r>=n.top-t&&r<=n.bottom+t;return i&&s?a=e:void 0}})),a);if(t){var n={};for(var i in e)e.hasOwnProperty(i)&&(n[i]=e[i]);n.target=n.rootEl=t,n.preventDefault=void 0,n.stopPropagation=void 0,t[Ae]._onDragOver(n)}}var o,r,a},Et=function(e){Oe&&Oe.parentNode[Ae]._isOutsideThisEl(e.target)};function Ct(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=U({},t),e[Ae]=this;var n,i,o={group:null,sort:!0,disabled:!1,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:!1,invertedSwapThreshold:null,removeCloneOnHide:!0,direction:function(){return mt(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:!0,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.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:!1!==Ct.supportPointer&&"PointerEvent"in window&&!Q,emptyInsertThreshold:5};for(var r in _e.initializePlugins(this,e,o),o)!(r in t)&&(t[r]=o[r]);for(var a in vt(t),this)"_"===a.charAt(0)&&"function"==typeof this[a]&&(this[a]=this[a].bind(this));this.nativeDraggable=!t.forceFallback&&ft,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?ne(e,"pointerdown",this._onTapStart):(ne(e,"mousedown",this._onTapStart),ne(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(ne(e,"dragover",this),ne(e,"dragenter",this)),rt.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),U(this,(i=[],{captureAnimationState:function(){i=[],this.options.animation&&[].slice.call(this.el.children).forEach((function(e){if("none"!==he(e,"display")&&e!==Ct.ghost){i.push({target:e,rect:fe(e)});var t=Y({},i[i.length-1].rect);if(e.thisAnimationDuration){var n=de(e,!0);n&&(t.top-=n.f,t.left-=n.e)}e.fromRect=t}}))},addAnimationState:function(e){i.push(e)},removeAnimationState:function(e){i.splice(function(e,t){for(var n in e)if(e.hasOwnProperty(n))for(var i in t)if(t.hasOwnProperty(i)&&t[i]===e[n][i])return Number(n);return-1}(i,{target:e}),1)},animateAll:function(e){var t=this;if(!this.options.animation)return clearTimeout(n),void("function"==typeof e&&e());var o=!1,r=0;i.forEach((function(e){var n=0,i=e.target,a=i.fromRect,s=fe(i),l=i.prevFromRect,c=i.prevToRect,h=e.rect,d=de(i,!0);d&&(s.top-=d.f,s.left-=d.e),i.toRect=s,i.thisAnimationDuration&&Ee(l,s)&&!Ee(a,s)&&(h.top-s.top)/(h.left-s.left)==(a.top-s.top)/(a.left-s.left)&&(n=function(e,t,n,i){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-n.top,2)+Math.pow(t.left-n.left,2))*i.animation}(h,l,c,t.options)),Ee(s,a)||(i.prevFromRect=a,i.prevToRect=s,n||(n=t.options.animation),t.animate(i,h,s,n)),n&&(o=!0,r=Math.max(r,n),clearTimeout(i.animationResetTimer),i.animationResetTimer=setTimeout((function(){i.animationTime=0,i.prevFromRect=null,i.fromRect=null,i.prevToRect=null,i.thisAnimationDuration=null}),n),i.thisAnimationDuration=n)})),clearTimeout(n),o?n=setTimeout((function(){"function"==typeof e&&e()}),r):"function"==typeof e&&e(),i=[]},animate:function(e,t,n,i){if(i){he(e,"transition",""),he(e,"transform","");var o=de(this.el),r=o&&o.a,a=o&&o.d,s=(t.left-n.left)/(r||1),l=(t.top-n.top)/(a||1);e.animatingX=!!s,e.animatingY=!!l,he(e,"transform","translate3d("+s+"px,"+l+"px,0)"),this.forRepaintDummy=function(e){return e.offsetWidth}(e),he(e,"transition","transform "+i+"ms"+(this.options.easing?" "+this.options.easing:"")),he(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){he(e,"transition",""),he(e,"transform",""),e.animated=!1,e.animatingX=!1,e.animatingY=!1}),i)}}}))}function Tt(e,t,n,i,o,r,a,s){var l,c,h=e[Ae],d=h.options.onMove;return!window.CustomEvent||K||Z?(l=document.createEvent("Event")).initEvent("move",!0,!0):l=new CustomEvent("move",{bubbles:!0,cancelable:!0}),l.to=t,l.from=e,l.dragged=n,l.draggedRect=i,l.related=o||t,l.relatedRect=r||fe(t),l.willInsertAfter=s,l.originalEvent=a,e.dispatchEvent(l),d&&(c=d.call(h,l,a)),c}function St(e){e.draggable=!1}function At(){ct=!1}function Dt(e){for(var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,i=0;n--;)i+=t.charCodeAt(n);return i.toString(36)}function Vt(e){return setTimeout(e,0)}function _t(e){return clearTimeout(e)}Ct.prototype={constructor:Ct,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(Je=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,Oe):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,i=this.options,o=i.preventOnFilter,r=e.type,a=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,s=(a||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||s,c=i.filter;if(function(e){ht.length=0;for(var t=e.getElementsByTagName("input"),n=t.length;n--;){var i=t[n];i.checked&&ht.push(i)}}(n),!Oe&&!(/mousedown|pointerdown/.test(r)&&0!==e.button||i.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!Q||!s||"SELECT"!==s.tagName.toUpperCase())&&!((s=ae(s,i.draggable,n,!1))&&s.animated||Me===s)){if(He=be(s),je=be(s,i.draggable),"function"==typeof c){if(c.call(this,e,s,this))return ke({sortable:t,rootEl:l,name:"filter",targetEl:s,toEl:n,fromEl:n}),Le("filter",t,{evt:e}),void(o&&e.cancelable&&e.preventDefault())}else if(c&&(c=c.split(",").some((function(i){if(i=ae(l,i.trim(),n,!1))return ke({sortable:t,rootEl:i,name:"filter",targetEl:s,fromEl:n,toEl:n}),Le("filter",t,{evt:e}),!0}))))return void(o&&e.cancelable&&e.preventDefault());i.handle&&!ae(l,i.handle,n,!1)||this._prepareDragStart(e,a,s)}}},_prepareDragStart:function(e,t,n){var i,o=this,r=o.el,a=o.options,s=r.ownerDocument;if(n&&!Oe&&n.parentNode===r){var l=fe(n);if(Ne=r,Pe=(Oe=n).parentNode,Ie=Oe.nextSibling,Me=n,Ye=a.group,Ct.dragged=Oe,$e={target:Oe,clientX:(t||e).clientX,clientY:(t||e).clientY},Ze=$e.clientX-l.left,Ge=$e.clientY-l.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,Oe.style["will-change"]="all",i=function(){Le("delayEnded",o,{evt:e}),Ct.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!G&&o.nativeDraggable&&(Oe.draggable=!0),o._triggerDragStart(e,t),ke({sortable:o,name:"choose",originalEvent:e}),ce(Oe,a.chosenClass,!0))},a.ignore.split(",").forEach((function(e){ue(Oe,e.trim(),St)})),ne(s,"dragover",wt),ne(s,"mousemove",wt),ne(s,"touchmove",wt),ne(s,"mouseup",o._onDrop),ne(s,"touchend",o._onDrop),ne(s,"touchcancel",o._onDrop),G&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Oe.draggable=!0),Le("delayStart",this,{evt:e}),!a.delay||a.delayOnTouchOnly&&!t||this.nativeDraggable&&(Z||K))i();else{if(Ct.eventCanceled)return void this._onDrop();ne(s,"mouseup",o._disableDelayedDrag),ne(s,"touchend",o._disableDelayedDrag),ne(s,"touchcancel",o._disableDelayedDrag),ne(s,"mousemove",o._delayedDragTouchMoveHandler),ne(s,"touchmove",o._delayedDragTouchMoveHandler),a.supportPointer&&ne(s,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(i,a.delay)}}},_delayedDragTouchMoveHandler:function(e){var t=e.touches?e.touches[0]:e;Math.max(Math.abs(t.clientX-this._lastX),Math.abs(t.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Oe&&St(Oe),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;ie(e,"mouseup",this._disableDelayedDrag),ie(e,"touchend",this._disableDelayedDrag),ie(e,"touchcancel",this._disableDelayedDrag),ie(e,"mousemove",this._delayedDragTouchMoveHandler),ie(e,"touchmove",this._delayedDragTouchMoveHandler),ie(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?ne(document,"pointermove",this._onTouchMove):ne(document,t?"touchmove":"mousemove",this._onTouchMove):(ne(Oe,"dragend",this),ne(Ne,"dragstart",this._onDragStart));try{document.selection?Vt((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){if(it=!1,Ne&&Oe){Le("dragStarted",this,{evt:t}),this.nativeDraggable&&ne(document,"dragover",Et);var n=this.options;!e&&ce(Oe,n.dragClass,!1),ce(Oe,n.ghostClass,!0),Ct.active=this,e&&this._appendGhost(),ke({sortable:this,name:"start",originalEvent:t})}else this._nulling()},_emulateDragOver:function(){if(Ue){this._lastX=Ue.clientX,this._lastY=Ue.clientY,bt();for(var e=document.elementFromPoint(Ue.clientX,Ue.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(Ue.clientX,Ue.clientY))!==t;)t=e;if(Oe.parentNode[Ae]._isOutsideThisEl(e),t)do{if(t[Ae]&&t[Ae]._onDragOver({clientX:Ue.clientX,clientY:Ue.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break;e=t}while(t=t.parentNode);yt()}},_onTouchMove:function(e){if($e){var t=this.options,n=t.fallbackTolerance,i=t.fallbackOffset,o=e.touches?e.touches[0]:e,r=Re&&de(Re,!0),a=Re&&r&&r.a,s=Re&&r&&r.d,l=ut&&nt&&ye(nt),c=(o.clientX-$e.clientX+i.x)/(a||1)+(l?l[0]-lt[0]:0)/(a||1),h=(o.clientY-$e.clientY+i.y)/(s||1)+(l?l[1]-lt[1]:0)/(s||1);if(!Ct.active&&!it){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))<n)return;this._onDragStart(e,!0)}if(Re){r?(r.e+=c-(We||0),r.f+=h-(Ke||0)):r={a:1,b:0,c:0,d:1,e:c,f:h};var d="matrix(".concat(r.a,",").concat(r.b,",").concat(r.c,",").concat(r.d,",").concat(r.e,",").concat(r.f,")");he(Re,"webkitTransform",d),he(Re,"mozTransform",d),he(Re,"msTransform",d),he(Re,"transform",d),We=c,Ke=h,Ue=o}e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!Re){var e=this.options.fallbackOnBody?document.body:Ne,t=fe(Oe,!0,ut,!0,e),n=this.options;if(ut){for(nt=e;"static"===he(nt,"position")&&"none"===he(nt,"transform")&&nt!==document;)nt=nt.parentNode;nt!==document.body&&nt!==document.documentElement?(nt===document&&(nt=pe()),t.top+=nt.scrollTop,t.left+=nt.scrollLeft):nt=pe(),lt=ye(nt)}ce(Re=Oe.cloneNode(!0),n.ghostClass,!1),ce(Re,n.fallbackClass,!0),ce(Re,n.dragClass,!0),he(Re,"transition",""),he(Re,"transform",""),he(Re,"box-sizing","border-box"),he(Re,"margin",0),he(Re,"top",t.top),he(Re,"left",t.left),he(Re,"width",t.width),he(Re,"height",t.height),he(Re,"opacity","0.8"),he(Re,"position",ut?"absolute":"fixed"),he(Re,"zIndex","100000"),he(Re,"pointerEvents","none"),Ct.ghost=Re,e.appendChild(Re),he(Re,"transform-origin",Ze/parseInt(Re.style.width)*100+"% "+Ge/parseInt(Re.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,i=e.dataTransfer,o=n.options;Le("dragStart",this,{evt:e}),Ct.eventCanceled?this._onDrop():(Le("setupClone",this),Ct.eventCanceled||((Be=Se(Oe)).removeAttribute("id"),Be.draggable=!1,Be.style["will-change"]="",this._hideClone(),ce(Be,this.options.chosenClass,!1),Ct.clone=Be),n.cloneId=Vt((function(){Le("clone",n),Ct.eventCanceled||(n.options.removeCloneOnHide||Ne.insertBefore(Be,Oe),n._hideClone(),ke({sortable:n,name:"clone"}))})),!t&&ce(Oe,o.dragClass,!0),t?(ot=!0,n._loopId=setInterval(n._emulateDragOver,50)):(ie(document,"mouseup",n._onDrop),ie(document,"touchend",n._onDrop),ie(document,"touchcancel",n._onDrop),i&&(i.effectAllowed="move",o.setData&&o.setData.call(n,i,Oe)),ne(document,"drop",n),he(Oe,"transform","translateZ(0)")),it=!0,n._dragStartId=Vt(n._dragStarted.bind(n,t,e)),ne(document,"selectstart",n),Qe=!0,Q&&he(document.body,"user-select","none"))},_onDragOver:function(e){var t,n,i,o,r=this.el,a=e.target,s=this.options,l=s.group,c=Ct.active,h=Ye===l,d=s.sort,u=qe||c,p=this,f=!1;if(!ct){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),a=ae(a,s.draggable,r,!0),x("dragOver"),Ct.eventCanceled)return f;if(Oe.contains(e.target)||a.animated&&a.animatingX&&a.animatingY||p._ignoreWhileAnimating===a)return k(!1);if(ot=!1,c&&!s.disabled&&(h?d||(i=Pe!==Ne):qe===this||(this.lastPutMode=Ye.checkPull(this,c,Oe,e))&&l.checkPut(this,c,Oe,e))){if(o="vertical"===this._getDirection(e,a),t=fe(Oe),x("dragOverValid"),Ct.eventCanceled)return f;if(i)return Pe=Ne,L(),this._hideClone(),x("revert"),Ct.eventCanceled||(Ie?Ne.insertBefore(Oe,Ie):Ne.appendChild(Oe)),k(!0);var g=ve(r,s.draggable);if(!g||function(e,t,n){var i=fe(ve(n.el,n.options.draggable));return t?e.clientX>i.right+10||e.clientX<=i.right&&e.clientY>i.bottom&&e.clientX>=i.left:e.clientX>i.right&&e.clientY>i.top||e.clientX<=i.right&&e.clientY>i.bottom+10}(e,o,this)&&!g.animated){if(g===Oe)return k(!1);if(g&&r===e.target&&(a=g),a&&(n=fe(a)),!1!==Tt(Ne,r,Oe,t,a,n,e,!!a))return L(),g&&g.nextSibling?r.insertBefore(Oe,g.nextSibling):r.appendChild(Oe),Pe=r,O(),k(!0)}else if(g&&function(e,t,n){var i=fe(me(n.el,0,n.options,!0));return t?e.clientX<i.left-10||e.clientY<i.top&&e.clientX<i.right:e.clientY<i.top-10||e.clientY<i.bottom&&e.clientX<i.left}(e,o,this)){var m=me(r,0,s,!0);if(m===Oe)return k(!1);if(n=fe(a=m),!1!==Tt(Ne,r,Oe,t,a,n,e,!1))return L(),r.insertBefore(Oe,m),Pe=r,O(),k(!0)}else if(a.parentNode===r){n=fe(a);var v,b,y,w=Oe.parentNode!==r,E=!function(e,t,n){var i=n?e.left:e.top,o=n?e.right:e.bottom,r=n?e.width:e.height,a=n?t.left:t.top,s=n?t.right:t.bottom,l=n?t.width:t.height;return i===a||o===s||i+r/2===a+l/2}(Oe.animated&&Oe.toRect||t,a.animated&&a.toRect||n,o),C=o?"top":"left",T=ge(a,"top","top")||ge(Oe,"top","top"),S=T?T.scrollTop:void 0;if(Je!==a&&(b=n[C],at=!1,st=!E&&s.invertSwap||w),v=function(e,t,n,i,o,r,a,s){var l=i?e.clientY:e.clientX,c=i?n.height:n.width,h=i?n.top:n.left,d=i?n.bottom:n.right,u=!1;if(!a)if(s&&tt<c*o){if(!at&&(1===et?l>h+c*r/2:l<d-c*r/2)&&(at=!0),at)u=!0;else if(1===et?l<h+tt:l>d-tt)return-et}else if(l>h+c*(1-o)/2&&l<d-c*(1-o)/2)return function(e){return be(Oe)<be(e)?1:-1}(t);return(u=u||a)&&(l<h+c*r/2||l>d-c*r/2)?l>h+c/2?1:-1:0}(e,a,n,o,E?1:s.swapThreshold,null==s.invertedSwapThreshold?s.swapThreshold:s.invertedSwapThreshold,st,Je===a),0!==v){var A=be(Oe);do{A-=v,y=Pe.children[A]}while(y&&("none"===he(y,"display")||y===Re))}if(0===v||y===a)return k(!1);Je=a,et=v;var D=a.nextElementSibling,V=!1,_=Tt(Ne,r,Oe,t,a,n,e,V=1===v);if(!1!==_)return 1!==_&&-1!==_||(V=1===_),ct=!0,setTimeout(At,30),L(),V&&!D?r.appendChild(Oe):a.parentNode.insertBefore(Oe,V?D:a),T&&Te(T,0,S-T.scrollTop),Pe=Oe.parentNode,void 0===b||st||(tt=Math.abs(b-fe(a)[C])),O(),k(!0)}if(r.contains(Oe))return k(!1)}return!1}function x(s,l){Le(s,p,Y({evt:e,isOwner:h,axis:o?"vertical":"horizontal",revert:i,dragRect:t,targetRect:n,canSort:d,fromSortable:u,target:a,completed:k,onMove:function(n,i){return Tt(Ne,r,Oe,t,n,fe(n),e,i)},changed:O},l))}function L(){x("dragOverAnimationCapture"),p.captureAnimationState(),p!==u&&u.captureAnimationState()}function k(t){return x("dragOverCompleted",{insertion:t}),t&&(h?c._hideClone():c._showClone(p),p!==u&&(ce(Oe,qe?qe.options.ghostClass:c.options.ghostClass,!1),ce(Oe,s.ghostClass,!0)),qe!==p&&p!==Ct.active?qe=p:p===Ct.active&&qe&&(qe=null),u===p&&(p._ignoreWhileAnimating=a),p.animateAll((function(){x("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==u&&(u.animateAll(),u._ignoreWhileAnimating=null)),(a===Oe&&!Oe.animated||a===r&&!a.animated)&&(Je=null),s.dragoverBubble||e.rootEl||a===document||(Oe.parentNode[Ae]._isOutsideThisEl(e.target),!t&&wt(e)),!s.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),f=!0}function O(){ze=be(Oe),Xe=be(Oe,s.draggable),ke({sortable:p,name:"change",toEl:r,newIndex:ze,newDraggableIndex:Xe,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){ie(document,"mousemove",this._onTouchMove),ie(document,"touchmove",this._onTouchMove),ie(document,"pointermove",this._onTouchMove),ie(document,"dragover",wt),ie(document,"mousemove",wt),ie(document,"touchmove",wt)},_offUpEvents:function(){var e=this.el.ownerDocument;ie(e,"mouseup",this._onDrop),ie(e,"touchend",this._onDrop),ie(e,"pointerup",this._onDrop),ie(e,"touchcancel",this._onDrop),ie(document,"selectstart",this)},_onDrop:function(e){var t=this.el,n=this.options;ze=be(Oe),Xe=be(Oe,n.draggable),Le("drop",this,{evt:e}),Pe=Oe&&Oe.parentNode,ze=be(Oe),Xe=be(Oe,n.draggable),Ct.eventCanceled||(it=!1,st=!1,at=!1,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),_t(this.cloneId),_t(this._dragStartId),this.nativeDraggable&&(ie(document,"drop",this),ie(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),Q&&he(document.body,"user-select",""),he(Oe,"transform",""),e&&(Qe&&(e.cancelable&&e.preventDefault(),!n.dropBubble&&e.stopPropagation()),Re&&Re.parentNode&&Re.parentNode.removeChild(Re),(Ne===Pe||qe&&"clone"!==qe.lastPutMode)&&Be&&Be.parentNode&&Be.parentNode.removeChild(Be),Oe&&(this.nativeDraggable&&ie(Oe,"dragend",this),St(Oe),Oe.style["will-change"]="",Qe&&!it&&ce(Oe,qe?qe.options.ghostClass:this.options.ghostClass,!1),ce(Oe,this.options.chosenClass,!1),ke({sortable:this,name:"unchoose",toEl:Pe,newIndex:null,newDraggableIndex:null,originalEvent:e}),Ne!==Pe?(ze>=0&&(ke({rootEl:Pe,name:"add",toEl:Pe,fromEl:Ne,originalEvent:e}),ke({sortable:this,name:"remove",toEl:Pe,originalEvent:e}),ke({rootEl:Pe,name:"sort",toEl:Pe,fromEl:Ne,originalEvent:e}),ke({sortable:this,name:"sort",toEl:Pe,originalEvent:e})),qe&&qe.save()):ze!==He&&ze>=0&&(ke({sortable:this,name:"update",toEl:Pe,originalEvent:e}),ke({sortable:this,name:"sort",toEl:Pe,originalEvent:e})),Ct.active&&(null!=ze&&-1!==ze||(ze=He,Xe=je),ke({sortable:this,name:"end",toEl:Pe,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Le("nulling",this),Ne=Oe=Pe=Re=Ie=Be=Me=Fe=$e=Ue=Qe=ze=Xe=He=je=Je=et=qe=Ye=Ct.dragged=Ct.ghost=Ct.clone=Ct.active=null,ht.forEach((function(e){e.checked=!0})),ht.length=We=Ke=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":Oe&&(this._onDragOver(e),function(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move"),e.cancelable&&e.preventDefault()}(e));break;case"selectstart":e.preventDefault()}},toArray:function(){for(var e,t=[],n=this.el.children,i=0,o=n.length,r=this.options;i<o;i++)ae(e=n[i],r.draggable,this.el,!1)&&t.push(e.getAttribute(r.dataIdAttr)||Dt(e));return t},sort:function(e,t){var n={},i=this.el;this.toArray().forEach((function(e,t){var o=i.children[t];ae(o,this.options.draggable,i,!1)&&(n[e]=o)}),this),t&&this.captureAnimationState(),e.forEach((function(e){n[e]&&(i.removeChild(n[e]),i.appendChild(n[e]))})),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return ae(e,t||this.options.draggable,this.el,!1)},option:function(e,t){var n=this.options;if(void 0===t)return n[e];var i=_e.modifyOption(this,e,t);n[e]=void 0!==i?i:t,"group"===e&&vt(n)},destroy:function(){Le("destroy",this);var e=this.el;e[Ae]=null,ie(e,"mousedown",this._onTapStart),ie(e,"touchstart",this._onTapStart),ie(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(ie(e,"dragover",this),ie(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),rt.splice(rt.indexOf(this.el),1),this.el=e=null},_hideClone:function(){if(!Fe){if(Le("hideClone",this),Ct.eventCanceled)return;he(Be,"display","none"),this.options.removeCloneOnHide&&Be.parentNode&&Be.parentNode.removeChild(Be),Fe=!0}},_showClone:function(e){if("clone"===e.lastPutMode){if(Fe){if(Le("showClone",this),Ct.eventCanceled)return;Oe.parentNode!=Ne||this.options.group.revertClone?Ie?Ne.insertBefore(Be,Ie):Ne.appendChild(Be):Ne.insertBefore(Be,Oe),this.options.group.revertClone&&this.animate(Oe,Be),he(Be,"display",""),Fe=!1}}else this._hideClone()}},dt&&ne(document,"touchmove",(function(e){(Ct.active||it)&&e.cancelable&&e.preventDefault()})),Ct.utils={on:ne,off:ie,css:he,find:ue,is:function(e,t){return!!ae(e,t,e,!1)},extend:function(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},throttle:Ce,closest:ae,toggleClass:ce,clone:Se,index:be,nextTick:Vt,cancelNextTick:_t,detectDirection:mt,getChild:me},Ct.get=function(e){return e[Ae]},Ct.mount=function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];t[0].constructor===Array&&(t=t[0]),t.forEach((function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e));e.utils&&(Ct.utils=Y(Y({},Ct.utils),e.utils)),_e.mount(e)}))},Ct.create=function(e,t){return new Ct(e,t)},Ct.version="1.15.0";var xt,Lt,kt,Ot,Pt,Rt,Nt=[],It=!1;function Mt(){Nt.forEach((function(e){clearInterval(e.pid)})),Nt=[]}function Bt(){clearInterval(Rt)}var Ft=Ce((function(e,t,n,i){if(t.scroll){var o,r=(e.touches?e.touches[0]:e).clientX,a=(e.touches?e.touches[0]:e).clientY,s=t.scrollSensitivity,l=t.scrollSpeed,c=pe(),h=!1;Lt!==n&&(Lt=n,Mt(),xt=t.scroll,o=t.scrollFn,!0===xt&&(xt=we(n,!0)));var d=0,u=xt;do{var p=u,f=fe(p),g=f.top,m=f.bottom,v=f.left,b=f.right,y=f.width,w=f.height,E=void 0,C=void 0,T=p.scrollWidth,S=p.scrollHeight,A=he(p),D=p.scrollLeft,V=p.scrollTop;p===c?(E=y<T&&("auto"===A.overflowX||"scroll"===A.overflowX||"visible"===A.overflowX),C=w<S&&("auto"===A.overflowY||"scroll"===A.overflowY||"visible"===A.overflowY)):(E=y<T&&("auto"===A.overflowX||"scroll"===A.overflowX),C=w<S&&("auto"===A.overflowY||"scroll"===A.overflowY));var _=E&&(Math.abs(b-r)<=s&&D+y<T)-(Math.abs(v-r)<=s&&!!D),x=C&&(Math.abs(m-a)<=s&&V+w<S)-(Math.abs(g-a)<=s&&!!V);if(!Nt[d])for(var L=0;L<=d;L++)Nt[L]||(Nt[L]={});Nt[d].vx==_&&Nt[d].vy==x&&Nt[d].el===p||(Nt[d].el=p,Nt[d].vx=_,Nt[d].vy=x,clearInterval(Nt[d].pid),0==_&&0==x||(h=!0,Nt[d].pid=setInterval(function(){i&&0===this.layer&&Ct.active._onTouchMove(Pt);var t=Nt[this.layer].vy?Nt[this.layer].vy*l:0,n=Nt[this.layer].vx?Nt[this.layer].vx*l:0;"function"==typeof o&&"continue"!==o.call(Ct.dragged.parentNode[Ae],n,t,e,Pt,Nt[this.layer].el)||Te(Nt[this.layer].el,n,t)}.bind({layer:d}),24))),d++}while(t.bubbleScroll&&u!==c&&(u=we(u,!1)));It=h}}),30),Ht=function(e){var t=e.originalEvent,n=e.putSortable,i=e.dragEl,o=e.activeSortable,r=e.dispatchSortableEvent,a=e.hideGhostForTarget,s=e.unhideGhostForTarget;if(t){var l=n||o;a();var c=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,h=document.elementFromPoint(c.clientX,c.clientY);s(),l&&!l.el.contains(h)&&(r("spill"),this.onSpill({dragEl:i,putSortable:n}))}};function zt(){}function jt(){}zt.prototype={startIndex:null,dragStart:function(e){var t=e.oldDraggableIndex;this.startIndex=t},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();var i=me(this.sortable.el,this.startIndex,this.options);i?this.sortable.el.insertBefore(t,i):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:Ht},U(zt,{pluginName:"revertOnSpill"}),jt.prototype={onSpill:function(e){var t=e.dragEl,n=e.putSortable||this.sortable;n.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),n.animateAll()},drop:Ht},U(jt,{pluginName:"removeOnSpill"}),Ct.mount(new function(){function e(){for(var e in this.defaults={scroll:!0,forceAutoScrollFallback:!1,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:!0},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){var t=e.originalEvent;this.sortable.nativeDraggable?ne(document,"dragover",this._handleAutoScroll):this.options.supportPointer?ne(document,"pointermove",this._handleFallbackAutoScroll):t.touches?ne(document,"touchmove",this._handleFallbackAutoScroll):ne(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){var t=e.originalEvent;this.options.dragOverBubble||t.rootEl||this._handleAutoScroll(t)},drop:function(){this.sortable.nativeDraggable?ie(document,"dragover",this._handleAutoScroll):(ie(document,"pointermove",this._handleFallbackAutoScroll),ie(document,"touchmove",this._handleFallbackAutoScroll),ie(document,"mousemove",this._handleFallbackAutoScroll)),Bt(),Mt(),clearTimeout(se),se=void 0},nulling:function(){Pt=Lt=xt=It=Rt=kt=Ot=null,Nt.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,!0)},_handleAutoScroll:function(e,t){var n=this,i=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,r=document.elementFromPoint(i,o);if(Pt=e,t||this.options.forceAutoScrollFallback||Z||K||Q){Ft(e,this.options,r,t);var a=we(r,!0);!It||Rt&&i===kt&&o===Ot||(Rt&&Bt(),Rt=setInterval((function(){var r=we(document.elementFromPoint(i,o),!0);r!==a&&(a=r,Mt()),Ft(e,n.options,r,t)}),10),kt=i,Ot=o)}else{if(!this.options.bubbleScroll||we(r,!0)===pe())return void Mt();Ft(e,this.options,we(r,!1),!1)}}},U(e,{pluginName:"scroll",initializeByDefault:!0})}),Ct.mount(jt,zt);const Xt=Ct;var Yt;!function(e){e.Up="UP",e.Down="DOWN"}(Yt||(Yt={}));class qt extends r.Controller{static classes=["active","chosen","drag","ghost"];static targets=["handle","item"];static values={animation:{default:200,type:Number},container:{default:"",type:String},message:{default:"",type:String},url:String};order;sortable;constructor(e){super(e),this.order=[]}connect(){const e=this.containerValue,t=e&&this.element.querySelector(e)||this.element;this.sortable=Xt.create(t,this.options),this.order=this.sortable.toArray(),this.dispatch("ready",{cancelable:!1,detail:{order:this.order}})}get options(){const e=this.identifier;return{...this.hasGhostClass?{ghostClass:this.ghostClass}:{},...this.hasChosenClass?{chosenClass:this.chosenClass}:{},...this.hasDragClass?{dragClass:this.dragClass}:{},animation:this.animationValue,dataIdAttr:`data-${e}-item-id`,draggable:`[data-${e}-target="item"]`,handle:`[data-${e}-target="handle"]`,onStart:()=>{this.element.classList.add(...this.activeClasses)},onEnd:({item:e,newIndex:t,oldIndex:n})=>{this.element.classList.remove(...this.activeClasses),n!==t&&(this.order=this.sortable.toArray(),this.submit({...this.getItemData(e),newIndex:t}))}}}getItemData(e){const t=this.identifier,n=e instanceof HTMLElement&&e.closest(`[data-${t}-target='item']`);return n?{id:n.getAttribute(`data-${t}-item-id`)||"",label:n.getAttribute(`data-${t}-item-label`)||""}:{id:"",label:""}}apply({currentTarget:e}){const{id:t,label:n}=this.getItemData(e),i=this.order.indexOf(t);this.submit({id:t,label:n,newIndex:i})}move({currentTarget:e},t){const n=this.identifier,i=e instanceof HTMLElement&&e.closest(`[data-${n}-target='item']`);if(!i)return;const o=i.getAttribute(`data-${n}-item-id`)||"",r=this.order.indexOf(o);this.order.splice(r,1),t===Yt.Down?this.order.splice(r+1,0,o):t===Yt.Up&&r>0?this.order.splice(r-1,0,o):this.order.splice(r,0,o),this.sortable.sort(this.order,!0)}up(e){this.move(e,Yt.Up),e.currentTarget?.focus()}down(e){this.move(e,Yt.Down),e.currentTarget?.focus()}submit({id:e,label:t,newIndex:n}){let i=this.urlValue.replace("999999",e);null!==n&&(i+="?position="+n);const o=(this.messageValue||"__LABEL__").replace("__LABEL__",t),r=this.element.closest("form"),a=r&&r.querySelector('input[name="csrfmiddlewaretoken"]');if(a instanceof HTMLInputElement){const e=a.value,t=new FormData;t.append("csrfmiddlewaretoken",e),fetch(i,{method:"POST",body:t}).then((e=>{if(!e.ok)throw new Error(`HTTP error! Status: ${e.status}`)})).then((()=>{this.dispatch("w-messages:add",{prefix:"",target:window.document,detail:{clear:!0,text:o,type:"success"},cancelable:!1})})).catch((e=>{throw e}))}}disconnect(){this.sortable&&this.sortable.destroy()}}class $t extends r.Controller{static classes=["active"];static targets=["label"];static values={active:{default:"",type:String},duration:{default:3e4,type:Number},label:{default:"",type:String},loading:{default:!1,type:Boolean}};timer;connect(){if(this.hasLabelTarget)return;const e=this.element.querySelector("em");e&&e.setAttribute(`data-${this.identifier}-target`,"label")}activate(){const e=this.element.closest("form");e&&e.checkValidity&&!e.noValidate&&!e.checkValidity()||window.setTimeout((()=>{this.loadingValue=!0,this.timer=window.setTimeout((()=>{this.loadingValue=!1}),this.durationValue)}))}loadingValueChanged(e){const t=this.hasActiveClass?this.activeClass:"button-longrunning-active";this.element.classList.toggle(t,e),this.labelValue||(this.labelValue=this.hasLabelTarget?this.labelTarget.textContent:this.element.textContent),e?(this.element.setAttribute("disabled",""),this.activeValue&&this.hasLabelTarget&&(this.labelTarget.textContent=this.activeValue)):(this.element.removeAttribute("disabled"),this.labelValue&&this.hasLabelTarget&&(this.labelTarget.textContent=this.labelValue))}disconnect(){this.timer&&clearTimeout(this.timer)}}class Ut extends r.Controller{static classes=["closed","closeIcon","opened","openedContent","openIcon"];static targets=["content","toggle"];static values={closed:{default:!1,type:Boolean},peeking:{default:!1,type:Boolean},peekTarget:{default:"",type:String}};cleanUpPeekListener;connect(){const e=!!this.peekTargetValue&&this.element.closest(this.peekTargetValue);if(e){const t=()=>{this.peekingValue&&this.close(),this.peekingValue=!1};e.addEventListener("mouseleave",t,{passive:!0}),this.cleanUpPeekListener=()=>{e.removeEventListener("mouseleave",t)}}new Promise((e=>{setTimeout(e)})).then((()=>{this.dispatch("ready",{cancelable:!1,detail:{closed:this.closedValue}})}))}closedValueChanged(e,t){if(t===e)return;const n=this.closedClasses,i=this.openedClasses,o=this.contentTargets,r=void 0===t,a=this.peekingValue,s=this.openedContentClasses,l=this.toggles;if(a||this.updateToggleIcon(e),e){if(this.dispatch("closing",{cancelable:!0}).defaultPrevented)return;l.forEach((e=>{e.setAttribute("aria-expanded","false")})),o.forEach((e=>{e.classList.remove(...s),e.hidden=!0})),this.element.classList.add(...n),this.element.classList.remove(...i),this.dispatch("closed",{cancelable:!1})}else{if(this.dispatch("opening",{cancelable:!0}).defaultPrevented)return;l.forEach((e=>{e.setAttribute("aria-expanded","true")})),o.forEach((e=>{e.classList.add(...s),e.hidden=!1})),this.element.classList.remove(...n),this.element.classList.add(...i),this.dispatch("opened",{cancelable:!1})}r||l.forEach((t=>{this.dispatch("toggled",{cancelable:!1,detail:{closed:e},target:t})}))}close(){this.closedValue=!0}open(){this.closedValue=!1}peek(){this.closedValue&&(this.peekingValue=!0,this.open())}toggle(){if(this.peekingValue)return this.peekingValue=!1,void this.updateToggleIcon(!1);this.closedValue=!this.closedValue}get toggles(){const e=this.contentTargets.map((e=>e.id)).flatMap((e=>Array.from(document.querySelectorAll(`[aria-controls~="${e}"]`)))).concat(...this.toggleTargets);return Array.from(new Set(e))}updateToggleIcon(e=!1){if(!this.hasCloseIconClass||!this.hasOpenIconClass)return;const t=this.closeIconClass,n=this.openIconClass;t!==n&&this.toggles.map((e=>{const t=e.querySelector(".icon"),n=t?.querySelector("use");return n&&t?[t,n]:[]})).filter((({length:e})=>e)).forEach((([i,o])=>{e?(i.classList.remove(t),i.classList.add(n),o.setAttribute("href",`#${n}`)):(i.classList.remove(n),i.classList.add(t),o.setAttribute("href",`#${t}`))}))}disconnect(){this.cleanUpPeekListener?.call(this)}}class Wt extends r.Controller{skipToTarget;connect(){this.skipToTarget=document.querySelector(this.element.getAttribute("href")||"main")}handleBlur(){this.skipToTarget&&(this.skipToTarget.removeAttribute("tabindex"),this.skipToTarget.removeEventListener("blur",this.handleBlur),this.skipToTarget.removeEventListener("focusout",this.handleBlur))}skip(){this.skipToTarget&&(this.skipToTarget.setAttribute("tabindex","-1"),this.skipToTarget.addEventListener("blur",this.handleBlur),this.skipToTarget.addEventListener("focusout",this.handleBlur),this.skipToTarget.focus())}}const Kt=(e,{unicodeSlugsEnabled:t=!1}={})=>t?e.replace(/\s+/g,"-").replace(/[&/\\#,+()$~%.'":`@^!*?<>{}]/g,"").toLowerCase():e.replace(/\s+/g,"-").replace(/[^A-Za-z0-9\-_]/g,"").toLowerCase();class Zt extends r.Controller{static values={allowUnicode:{default:!1,type:Boolean}};compare(e){if(!this.element.value)return!0;const t=this[e.detail?.compareAs||e.params?.compareAs||"slugify"]({detail:{value:e.detail?.value||""}},!0),n=this.element.value,i=t.trim()===n.trim();return i||e?.preventDefault(),i}slugify(e,t=!1){const n=this.allowUnicodeValue,{value:i=this.element.value}=e?.detail||{},o=Kt(i.trim(),{unicodeSlugsEnabled:n});return t||(this.element.value=o),o}urlify(e,t=!1){const n=this.allowUnicodeValue,{value:i=this.element.value}=e?.detail||{},o=((e,t={})=>window.URLify(e,255)||Kt(e,t))(i.trim(),{unicodeSlugsEnabled:n});return t||(this.element.value=o),o}}class Gt extends r.Controller{submit(){const e=this.element.form;if(!e)throw new Error(`${this.identifier} controlled element must be part of a <form />`);e.requestSubmit?e.requestSubmit():e.submit()}}class Qt extends r.Controller{static defaultClearParam="p";static targets=["input"];static values={icon:{default:"",type:String},loading:{default:!1,type:Boolean},src:{default:"",type:String},target:{default:"#listing-results",type:String},wait:{default:200,type:Number}};abortController;iconElement;replaceLazy;searchLazy;submitLazy;connect(){const e=this.hasInputTarget?this.inputTarget.form:this.element;this.srcValue=this.srcValue||e?.getAttribute("action")||"";const t=this.target;this.iconElement=null;const n=(this.hasInputTarget?this.inputTarget:this.element).parentElement;this.iconElement=n?.querySelector("use")||null,this.iconValue=this.iconElement?.getAttribute("href")||"",this.loadingValue=!1,this.replaceLazy=(0,C.D)(this.replace.bind(this),this.waitValue),this.searchLazy=(0,C.D)(this.search.bind(this),this.waitValue),this.submitLazy=(0,C.D)(this.submit.bind(this),this.waitValue),this.dispatch("ready",{cancelable:!1,target:t})}get target(){const e=this.targetValue,t=document.querySelector(e),n=t&&t instanceof HTMLElement,i=!!this.srcValue,o=[];if(n||o.push(`Cannot find valid target element at "${e}"`),i||o.push("Cannot find valid src URL value"),o.length)throw new Error(o.join(", "));return t}loadingValueChanged(e,t){const n=void 0===t?null:this.target;e?(n?.setAttribute("aria-busy","true"),this.iconElement?.setAttribute("href","#icon-spinner")):(n?.removeAttribute("aria-busy"),this.iconElement?.setAttribute("href",this.iconValue))}search(e){const t=(e?.detail?.clear||e?.params?.clear||this.constructor.defaultClearParam).split(" "),n=this.hasInputTarget?this.inputTarget:this.element,i=n.name,o=new URLSearchParams(window.location.search),r=o.get(i)||"",a=n.value||"";if(r.trim()===a.trim())return;a?o.set(i,a):o.delete(i),t.forEach((e=>{o.delete(e)}));const s="?"+o.toString(),l=this.srcValue;this.replace(l+s).then((()=>{window.history.replaceState(null,"",s)}))}submit(){const e=this.hasInputTarget?this.inputTarget.form:this.element,t="?"+new URLSearchParams(new FormData(e)).toString(),n=this.srcValue;this.replace(n+t)}async replace(e){const t=this.target,n=("string"==typeof e?e:e?.detail?.url||e?.params?.url||"")||this.srcValue;this.abortController&&this.abortController.abort(),this.abortController=new AbortController;const{signal:i}=this.abortController;return this.loadingValue=!0,this.dispatch("begin",{cancelable:!0,detail:{requestUrl:n},target:this.target}).defaultPrevented?Promise.resolve():fetch(n,{headers:{"x-requested-with":"XMLHttpRequest"},signal:i}).then((e=>{if(!e.ok)throw new Error(`HTTP error! Status: ${e.status}`);return e.text()})).then((e=>(t.innerHTML=e,this.dispatch("success",{cancelable:!1,detail:{requestUrl:n,results:e},target:t}),e))).catch((e=>{i.aborted||(this.dispatch("error",{cancelable:!1,detail:{error:e,requestUrl:n},target:t}),console.error(`Error fetching ${n}`,e))})).finally((()=>{i===this.abortController?.signal&&(this.loadingValue=!1)}))}disconnect(){this.loadingValue=!1,this.replaceLazy?.cancel(),this.searchLazy?.cancel(),this.submitLazy?.cancel()}}class Jt extends r.Controller{static values={debounce:{default:100,type:Number},delay:{default:0,type:Number},disabled:{default:!1,type:Boolean},quiet:{default:!1,type:Boolean},target:String};connect(){this.processTargetElements("start",!0),this.apply=(0,C.D)(this.apply.bind(this),this.debounceValue)}check(){this.processTargetElements("check",!0)}apply(e){const t=e?.params?.apply||this.element.value,n=e=>{e.value=t,this.quietValue||this.dispatch("change",{cancelable:!1,prefix:"",target:e})};this.processTargetElements("apply").forEach((e=>{this.delayValue?setTimeout((()=>{n(e)}),this.delayValue):n(e)}))}clear(){this.processTargetElements("clear").forEach((e=>{setTimeout((()=>{e.setAttribute("value",""),this.quietValue||this.dispatch("change",{cancelable:!1,prefix:"",target:e})}),this.delayValue)}))}ping(){this.processTargetElements("ping",!1,{bubbles:!0})}processTargetElements(e,t=!1,n={}){if(!t&&this.disabledValue)return[];const i=[...document.querySelectorAll(this.targetValue)],o=i.filter((t=>!this.dispatch(e,{bubbles:!1,cancelable:!0,...n,detail:{element:this.element,value:this.element.value},target:t}).defaultPrevented));return t&&(this.disabledValue=i.length>o.length),o}}class en extends r.Controller{static values={options:{default:{},type:Object},url:String};tagit;connect(){const e=this.cleanTag.bind(this);o()(this.element).tagit({autocomplete:{source:this.urlValue},preprocessTag:e,...this.optionsValue})}cleanTag(e){return e&&'"'!==e[0]&&e.indexOf(" ")>-1?`"${e}"`:e}clear(){o()(this.element).tagit("removeAll")}}var tn=n(9633);const nn={initial:1e4,long:3e3,notify:30,short:300};class on extends r.Controller{static values={confirmation:{default:"",type:String},durations:{default:nn,type:Object},force:{default:!1,type:Boolean},hasComments:{default:!1,type:Boolean},hasEdits:{default:!1,type:Boolean},watch:{default:"edits",type:String}};initialFormData;observer;runningCheck;initialize(){this.notify=(0,C.D)(this.notify.bind(this),this.durationsValue.notify)}connect(){this.clear();const e=this.durationsValue,t=this.watchValue;t.includes("comments")&&this.watchComments(e),t.includes("edits")&&this.watchEdits(e),this.dispatch("ready",{cancelable:!1})}get formData(){const e=["comment_","comments-","csrfmiddlewaretoken","next"],t=new FormData(this.element);return JSON.stringify([...t.entries()].filter((([t])=>!e.some((e=>t.startsWith(e))))),((e,t)=>t instanceof File?{name:t.name,size:t.size,type:t.type}:t))}check(){const{long:e,short:t}=this.durationsValue;return this.runningCheck&&this.runningCheck.cancel(),this.runningCheck=(0,C.D)((()=>{this.forceValue?this.hasEditsValue=!0:this.initialFormData?this.hasEditsValue=this.initialFormData!==this.formData:this.hasEditsValue=!1}),this.hasEditsValue?e:t),this.runningCheck()}clear(){this.hasCommentsValue=!1,this.hasEditsValue=!1}confirm(e){const t=this.confirmationValue;return t&&(this.forceValue||this.hasCommentsValue||this.hasEditsValue)?(e.returnValue=t,t):null}hasCommentsValueChanged(e,t){e!==t&&this.notify()}hasEditsValueChanged(e,t){e!==t&&this.notify()}notify(){const e=this.hasCommentsValue,t=this.hasEditsValue;if(!e&&!t)return void this.dispatch("clear",{cancelable:!1});const[n]=[t&&e&&"all",e&&"comments",t&&"edits"].filter(Boolean);this.dispatch("add",{cancelable:!1,detail:{type:n}})}submit(){this.confirmationValue=""}watchComments({long:e,short:t}){let n;const{commentApp:i}=window.comments,o=i.selectors.selectIsDirty(i.store.getState());this.dispatch("watch-edits",{cancelable:!1,detail:{initialComments:o}}),this.hasCommentsValue=o,i.store.subscribe((()=>{n&&n.cancel(),n=(0,C.D)((()=>{this.hasCommentsValue=i.selectors.selectIsDirty(i.store.getState())}),this.hasCommentsValue?e:t),n()}))}watchEdits({initial:e}){const t=this.element;(0,C.D)((()=>{const e=this.formData;this.initialFormData=e,this.dispatch("watch-edits",{cancelable:!1,detail:{initialFormData:e}});const n=e=>e.nodeType===e.ELEMENT_NODE&&["INPUT","TEXTAREA","SELECT"].includes(e.tagName),i=new MutationObserver((e=>{e.some((e=>Array.from(e.addedNodes).some(n)||Array.from(e.removedNodes).some(n)))&&this.check()}));i.observe(t,{attributes:!1,childList:!0,subtree:!0}),this.observer=i}),e)()}disconnect(){this.runningCheck&&this.runningCheck.cancel(),this.observer&&this.observer.disconnect()}static afterLoad(e){window.enableDirtyFormCheck=(t,{alwaysDirty:n=!1,confirmationMessage:i=""})=>{R().then((()=>{const o=document.querySelector(`${t}:not([data-controller~='${e}'])`);o instanceof HTMLFormElement&&([["data-w-unsaved-confirmation-value",i||" "],["data-w-unsaved-force-value",String(n||!1)],["data-w-unsaved-watch-value","edits comments"]].forEach((([e,t])=>{o.setAttribute(e,t)})),o.setAttribute("data-action",[o.getAttribute("data-action")||"","w-unsaved#submit","beforeunload@window->w-unsaved#confirm","change->w-unsaved#check","keyup->w-unsaved#check"].filter(Boolean).join(" ")),o.setAttribute("data-controller",[o.getAttribute("data-controller")||"",e].filter(Boolean).join(" ")))}))}}}class rn extends Error{constructor(e){super(e),this.message=`Version number '${e}' is not formatted correctly.`}}class an extends Error{constructor(){super(),this.message="Can only compare prerelease versions"}}class sn{static MAJOR=new sn("Major");static MINOR=new sn("Minor");static PATCH=new sn("Patch");static PRE_RELEASE_STEP=new sn("PreReleaseStep");static PRE_RELEASE_VERSION=new sn("PreReleaseVersion");constructor(e){this.name=e}}class ln{constructor(e){const t=e.match(/^(?<major>\d+)\.{1}(?<minor>\d+)((\.{1}(?<patch>\d+))|(?<preReleaseStep>a|b|rc|\.dev){1}(?<preReleaseVersion>\d+)){0,1}$/);if(null===t)throw new rn(e);const n=t.groups;this.major=parseInt(n.major,10),this.minor=parseInt(n.minor,10),this.patch=n.patch?parseInt(n.patch,10):0,this.preReleaseStep=n.preReleaseStep?n.preReleaseStep:null,this.preReleaseVersion=n.preReleaseVersion?parseInt(n.preReleaseVersion,10):null}isPreRelease(){return null!==this.preReleaseStep}isPreReleaseStepBehind(e){if(!this.isPreRelease()||!e.isPreRelease())throw new an;return"a"===this.preReleaseStep&&("b"===e.preReleaseStep||"rc"===e.preReleaseStep)||"b"===this.preReleaseStep&&"rc"===e.preReleaseStep}howMuchBehind(e){if(this.major<e.major)return sn.MAJOR;if(this.major===e.major&&this.minor<e.minor)return sn.MINOR;if(this.major===e.major&&this.minor===e.minor&&!this.isPreRelease()&&!e.isPreRelease()&&this.patch<e.patch)return sn.PATCH;if(this.major===e.major&&this.minor===e.minor&&this.isPreRelease()){if(!e.isPreRelease())return sn.MINOR;if(this.isPreReleaseStepBehind(e))return sn.PRE_RELEASE_STEP;if(this.preReleaseStep===e.preReleaseStep&&this.preReleaseVersion<e.preReleaseVersion)return sn.PRE_RELEASE_VERSION}return null}}class cn extends r.Controller{static classes=["hidden"];static targets=["latestVersion","link"];static values={currentVersion:String,ltsOnly:{default:!1,type:Boolean},url:{default:"https://releases.wagtail.org/latest.txt",type:String}};connect(){this.checkVersion()}checkVersion(){const e=this.urlValue,t=new ln(this.currentVersionValue),n=this.ltsOnlyValue;fetch(e,{referrerPolicy:"strict-origin-when-cross-origin"}).then((t=>{if(200!==t.status)throw Error(`Unexpected response from ${e}. Status: ${t.status}`);return t.json()})).then((e=>{let i=e;if(i&&i.lts&&n&&(i=i.lts),i&&i.version){const e=new ln(i.version),o=t.howMuchBehind(e);let r=null;if(!o)return;if(r=o===sn.MAJOR||o===sn.MINOR?i.minorUrl:i.url,this.latestVersionTarget instanceof HTMLElement){const e=[i.version,n?"(LTS)":""].join(" ").trim();this.latestVersionTarget.textContent=e}this.linkTarget instanceof HTMLElement&&this.linkTarget.setAttribute("href",r||""),this.element.classList.remove(this.hiddenClass)}})).catch((t=>{console.error(`Error fetching ${e}. Error: ${t}`)}))}}const hn=[{controllerConstructor:m,identifier:"w-action"},{controllerConstructor:T,identifier:"w-autosize"},{controllerConstructor:S,identifier:"w-bulk"},{controllerConstructor:A,identifier:"w-clipboard"},{controllerConstructor:V,identifier:"w-clone"},{controllerConstructor:V,identifier:"w-messages"},{controllerConstructor:x,identifier:"w-count"},{controllerConstructor:L.Y,identifier:"w-dialog"},{controllerConstructor:k,identifier:"w-dismissible"},{controllerConstructor:O,identifier:"w-drilldown"},{controllerConstructor:H,identifier:"w-dropdown"},{controllerConstructor:z,identifier:"w-init"},{controllerConstructor:j,identifier:"w-link"},{controllerConstructor:qt,identifier:"w-orderable"},{controllerConstructor:$t,identifier:"w-progress"},{controllerConstructor:Ut,identifier:"w-breadcrumbs"},{controllerConstructor:Ut,identifier:"w-reveal"},{controllerConstructor:Wt,identifier:"w-skip-link"},{controllerConstructor:Zt,identifier:"w-slug"},{controllerConstructor:Gt,identifier:"w-submit"},{controllerConstructor:Qt,identifier:"w-swap"},{controllerConstructor:Jt,identifier:"w-sync"},{controllerConstructor:en,identifier:"w-tag"},{controllerConstructor:tn.y,identifier:"w-teleport"},{controllerConstructor:I,identifier:"w-tooltip"},{controllerConstructor:on,identifier:"w-unsaved"},{controllerConstructor:cn,identifier:"w-upgrade"}];var dn=n(5447);window.StimulusModule=r;const un=window.wagtail||{};un.app=(({debug:e=!1,definitions:t=[],root:n=document.documentElement}={})=>{const i=r.Application.start(n);return i.debug=e,i.load(t),i})({definitions:hn}),un.components={Icon:l.Z,Portal:c.Z},window.wagtail=un,window.escapeHtml=dn.X,o()((()=>{o()(".drop-zone").on("dragover",(function(){o()(this).addClass("hovered")})).on("dragleave dragend drop",(function(){o()(this).removeClass("hovered")}))}))},5311:e=>{e.exports=jQuery}},n={};function i(e){var o=n[e];if(void 0!==o)return o.exports;var r=n[e]={id:e,loaded:!1,exports:{}};return t[e].call(r.exports,r,r.exports,i),r.loaded=!0,r.exports}i.m=t,e=[],i.O=(t,n,o,r)=>{if(!n){var a=1/0;for(h=0;h<e.length;h++){for(var[n,o,r]=e[h],s=!0,l=0;l<n.length;l++)(!1&r||a>=r)&&Object.keys(i.O).every((e=>i.O[e](n[l])))?n.splice(l--,1):(s=!1,r<a&&(a=r));if(s){e.splice(h--,1);var c=o();void 0!==c&&(t=c)}}return t}r=r||0;for(var h=e.length;h>0&&e[h-1][2]>r;h--)e[h]=e[h-1];e[h]=[n,o,r]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),i.j=321,(()=>{var e={321:0};i.O.j=t=>0===e[t];var t=(t,n)=>{var o,r,[a,s,l]=n,c=0;if(a.some((t=>0!==e[t]))){for(o in s)i.o(s,o)&&(i.m[o]=s[o]);if(l)var h=l(i)}for(t&&t(n);c<a.length;c++)r=a[c],i.o(e,r)&&e[r]&&e[r][0](),e[r]=0;return i.O(h)},n=globalThis.webpackChunkwagtail=globalThis.webpackChunkwagtail||[];n.forEach(t.bind(null,0)),n.push=t.bind(null,n.push.bind(n))})();var o=i.O(void 0,[751],(()=>i(6525)));o=i.O(o)})();