."+h));K.forEach(function(re){var rt=re.dateObj,ze=rt.getTime(),zn=P>0&&ze0&&ze>Q;if(zn){re.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(fn){re.classList.remove(fn)});return}else if(X&&!zn)return;["startRange","inRange","endRange","notAllowed"].forEach(function(fn){re.classList.remove(fn)}),f!==void 0&&(f.classList.add(m<=t.selectedDates[0].getTime()?"startRange":"endRange"),bm&&ze===b&&re.classList.add("endRange"),ze>=P&&(Q===0||ze<=Q)&&yc(ze,b,m)&&re.classList.add("inRange"))})}}function Ti(){t.isOpen&&!t.config.static&&!t.config.inline&&ln()}function Br(f,h){if(h===void 0&&(h=t._positionElement),t.isMobile===!0){if(f){f.preventDefault();var m=$e(f);m&&m.blur()}t.mobileInput!==void 0&&(t.mobileInput.focus(),t.mobileInput.click()),ue("onOpen");return}else if(t._input.disabled||t.config.inline)return;var b=t.isOpen;t.isOpen=!0,b||(t.calendarContainer.classList.add("open"),t._input.classList.add("active"),ue("onOpen"),ln(h)),t.config.enableTime===!0&&t.config.noCalendar===!0&&t.config.allowInput===!1&&(f===void 0||!t.timeContainer.contains(f.relatedTarget))&&setTimeout(function(){return t.hourElement.select()},50)}function Ci(f){return function(h){var m=t.config["_"+f+"Date"]=t.parseDate(h,t.config.dateFormat),b=t.config["_"+(f==="min"?"max":"min")+"Date"];m!==void 0&&(t[f==="min"?"minDateHasTime":"maxDateHasTime"]=m.getHours()>0||m.getMinutes()>0||m.getSeconds()>0),t.selectedDates&&(t.selectedDates=t.selectedDates.filter(function(C){return oe(C)}),!t.selectedDates.length&&f==="min"&&p(m),at()),t.daysContainer&&(Bn(),m!==void 0?t.currentYearElement[f]=m.getFullYear().toString():t.currentYearElement.removeAttribute(f),t.currentYearElement.disabled=!!b&&m!==void 0&&b.getFullYear()===m.getFullYear())}}function Si(){var f=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],h=Le(Le({},JSON.parse(JSON.stringify(n.dataset||{}))),e),m={};t.config.parseDate=h.parseDate,t.config.formatDate=h.formatDate,Object.defineProperty(t.config,"enable",{get:function(){return t.config._enable},set:function(K){t.config._enable=ds(K)}}),Object.defineProperty(t.config,"disable",{get:function(){return t.config._disable},set:function(K){t.config._disable=ds(K)}});var b=h.mode==="time";if(!h.dateFormat&&(h.enableTime||b)){var C=Ee.defaultConfig.dateFormat||Pt.dateFormat;m.dateFormat=h.noCalendar||b?"H:i"+(h.enableSeconds?":S":""):C+" H:i"+(h.enableSeconds?":S":"")}if(h.altInput&&(h.enableTime||b)&&!h.altFormat){var R=Ee.defaultConfig.altFormat||Pt.altFormat;m.altFormat=h.noCalendar||b?"h:i"+(h.enableSeconds?":S K":" K"):R+(" h:i"+(h.enableSeconds?":S":"")+" K")}Object.defineProperty(t.config,"minDate",{get:function(){return t.config._minDate},set:Ci("min")}),Object.defineProperty(t.config,"maxDate",{get:function(){return t.config._maxDate},set:Ci("max")});var X=function(K){return function(re){t.config[K==="min"?"_minTime":"_maxTime"]=t.parseDate(re,"H:i:S")}};Object.defineProperty(t.config,"minTime",{get:function(){return t.config._minTime},set:X("min")}),Object.defineProperty(t.config,"maxTime",{get:function(){return t.config._maxTime},set:X("max")}),h.mode==="time"&&(t.config.noCalendar=!0,t.config.enableTime=!0),Object.assign(t.config,m,h);for(var P=0;P-1?t.config[I]=Lr(Q[I]).map(s).concat(t.config[I]):typeof h[I]=="undefined"&&(t.config[I]=Q[I])}h.altInputClass||(t.config.altInputClass=$n().className+" "+t.config.altInputClass),ue("onParseConfig")}function $n(){return t.config.wrap?n.querySelector("[data-input]"):n}function Ai(){typeof t.config.locale!="object"&&typeof Ee.l10ns[t.config.locale]=="undefined"&&t.config.errorHandler(new Error("flatpickr: invalid locale "+t.config.locale)),t.l10n=Le(Le({},Ee.l10ns.default),typeof t.config.locale=="object"?t.config.locale:t.config.locale!=="default"?Ee.l10ns[t.config.locale]:void 0),Et.D="("+t.l10n.weekdays.shorthand.join("|")+")",Et.l="("+t.l10n.weekdays.longhand.join("|")+")",Et.M="("+t.l10n.months.shorthand.join("|")+")",Et.F="("+t.l10n.months.longhand.join("|")+")",Et.K="("+t.l10n.amPM[0]+"|"+t.l10n.amPM[1]+"|"+t.l10n.amPM[0].toLowerCase()+"|"+t.l10n.amPM[1].toLowerCase()+")";var f=Le(Le({},e),JSON.parse(JSON.stringify(n.dataset||{})));f.time_24hr===void 0&&Ee.defaultConfig.time_24hr===void 0&&(t.config.time_24hr=t.l10n.time_24hr),t.formatDate=rs(t),t.parseDate=Mr({config:t.config,l10n:t.l10n})}function ln(f){if(typeof t.config.position=="function")return void t.config.position(t,f);if(t.calendarContainer!==void 0){ue("onPreCalendarPosition");var h=f||t._positionElement,m=Array.prototype.reduce.call(t.calendarContainer.children,function(Jc,Zc){return Jc+Zc.offsetHeight},0),b=t.calendarContainer.offsetWidth,C=t.config.position.split(" "),R=C[0],X=C.length>1?C[1]:null,P=h.getBoundingClientRect(),Q=window.innerHeight-P.bottom,I=R==="above"||R!=="below"&&Qm,K=window.pageYOffset+P.top+(I?-m-2:h.offsetHeight+2);if(Oe(t.calendarContainer,"arrowTop",!I),Oe(t.calendarContainer,"arrowBottom",I),!t.config.inline){var re=window.pageXOffset+P.left,rt=!1,ze=!1;X==="center"?(re-=(b-P.width)/2,rt=!0):X==="right"&&(re-=b-P.width,ze=!0),Oe(t.calendarContainer,"arrowLeft",!rt&&!ze),Oe(t.calendarContainer,"arrowCenter",rt),Oe(t.calendarContainer,"arrowRight",ze);var zn=window.document.body.offsetWidth-(window.pageXOffset+P.right),fn=re+b>window.document.body.offsetWidth,qc=zn+b>window.document.body.offsetWidth;if(Oe(t.calendarContainer,"rightMost",fn),!t.config.static)if(t.calendarContainer.style.top=K+"px",!fn)t.calendarContainer.style.left=re+"px",t.calendarContainer.style.right="auto";else if(!qc)t.calendarContainer.style.left="auto",t.calendarContainer.style.right=zn+"px";else{var Wr=st();if(Wr===void 0)return;var Uc=window.document.body.offsetWidth,Yc=Math.max(0,Uc/2-b/2),Gc=".flatpickr-calendar.centerMost:before",Kc=".flatpickr-calendar.centerMost:after",Xc=Wr.cssRules.length,Qc="{left:"+P.left+"px;right:auto;}";Oe(t.calendarContainer,"rightMost",!1),Oe(t.calendarContainer,"centerMost",!0),Wr.insertRule(Gc+","+Kc+Qc,Xc),t.calendarContainer.style.left=Yc+"px",t.calendarContainer.style.right="auto"}}}}function st(){for(var f=null,h=0;ht.currentMonth+t.config.showMonths-1)&&t.config.mode!=="range";if(t.selectedDateElem=b,t.config.mode==="single")t.selectedDates=[C];else if(t.config.mode==="multiple"){var X=zr(C);X?t.selectedDates.splice(parseInt(X),1):t.selectedDates.push(C)}else t.config.mode==="range"&&(t.selectedDates.length===2&&t.clear(!1,!1),t.latestSelectedDateObj=C,t.selectedDates.push(C),Be(C,t.selectedDates[0],!0)!==0&&t.selectedDates.sort(function(K,re){return K.getTime()-re.getTime()}));if(d(),R){var P=t.currentYear!==C.getFullYear();t.currentYear=C.getFullYear(),t.currentMonth=C.getMonth(),P&&(ue("onYearChange"),J()),ue("onMonthChange")}if(Li(),ie(),at(),!R&&t.config.mode!=="range"&&t.config.showMonths===1?D(b):t.selectedDateElem!==void 0&&t.hourElement===void 0&&t.selectedDateElem&&t.selectedDateElem.focus(),t.hourElement!==void 0&&t.hourElement!==void 0&&t.hourElement.focus(),t.config.closeOnSelect){var Q=t.config.mode==="single"&&!t.config.enableTime,I=t.config.mode==="range"&&t.selectedDates.length===2&&!t.config.enableTime;(Q||I)&&un()}_()}}var $t={locale:[Ai,He],showMonths:[Ce,a,qe],minDate:[w],maxDate:[w],positionElement:[fs],clickOpens:[function(){t.config.clickOpens===!0?(y(t._input,"focus",t.open),y(t._input,"click",t.open)):(t._input.removeEventListener("focus",t.open),t._input.removeEventListener("click",t.open))}]};function Di(f,h){if(f!==null&&typeof f=="object"){Object.assign(t.config,f);for(var m in f)$t[m]!==void 0&&$t[m].forEach(function(b){return b()})}else t.config[f]=h,$t[f]!==void 0?$t[f].forEach(function(b){return b()}):Ar.indexOf(f)>-1&&(t.config[f]=Lr(h));t.redraw(),at(!0)}function Vn(f,h){var m=[];if(f instanceof Array)m=f.map(function(b){return t.parseDate(b,h)});else if(f instanceof Date||typeof f=="number")m=[t.parseDate(f,h)];else if(typeof f=="string")switch(t.config.mode){case"single":case"time":m=[t.parseDate(f,h)];break;case"multiple":m=f.split(t.config.conjunction).map(function(b){return t.parseDate(b,h)});break;case"range":m=f.split(t.l10n.rangeSeparator).map(function(b){return t.parseDate(b,h)});break;default:break}else t.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(f)));t.selectedDates=t.config.allowInvalidPreload?m:m.filter(function(b){return b instanceof Date&&oe(b,!1)}),t.config.mode==="range"&&t.selectedDates.sort(function(b,C){return b.getTime()-C.getTime()})}function Oi(f,h,m){if(h===void 0&&(h=!1),m===void 0&&(m=t.config.dateFormat),f!==0&&!f||f instanceof Array&&f.length===0)return t.clear(h);Vn(f,m),t.latestSelectedDateObj=t.selectedDates[t.selectedDates.length-1],t.redraw(),w(void 0,h),p(),t.selectedDates.length===0&&t.clear(!1),at(h),h&&ue("onChange")}function ds(f){return f.slice().map(function(h){return typeof h=="string"||typeof h=="number"||h instanceof Date?t.parseDate(h,void 0,!0):h&&typeof h=="object"&&h.from&&h.to?{from:t.parseDate(h.from,void 0),to:t.parseDate(h.to,void 0)}:h}).filter(function(h){return h})}function Fc(){t.selectedDates=[],t.now=t.parseDate(t.config.now)||new Date;var f=t.config.defaultDate||((t.input.nodeName==="INPUT"||t.input.nodeName==="TEXTAREA")&&t.input.placeholder&&t.input.value===t.input.placeholder?null:t.input.value);f&&Vn(f,t.config.dateFormat),t._initialDate=t.selectedDates.length>0?t.selectedDates[0]:t.config.minDate&&t.config.minDate.getTime()>t.now.getTime()?t.config.minDate:t.config.maxDate&&t.config.maxDate.getTime()0&&(t.latestSelectedDateObj=t.selectedDates[0]),t.config.minTime!==void 0&&(t.config.minTime=t.parseDate(t.config.minTime,"H:i")),t.config.maxTime!==void 0&&(t.config.maxTime=t.parseDate(t.config.maxTime,"H:i")),t.minDateHasTime=!!t.config.minDate&&(t.config.minDate.getHours()>0||t.config.minDate.getMinutes()>0||t.config.minDate.getSeconds()>0),t.maxDateHasTime=!!t.config.maxDate&&(t.config.maxDate.getHours()>0||t.config.maxDate.getMinutes()>0||t.config.maxDate.getSeconds()>0)}function $c(){if(t.input=$n(),!t.input){t.config.errorHandler(new Error("Invalid input element specified"));return}t.input._type=t.input.type,t.input.type="text",t.input.classList.add("flatpickr-input"),t._input=t.input,t.config.altInput&&(t.altInput=te(t.input.nodeName,t.config.altInputClass),t._input=t.altInput,t.altInput.placeholder=t.input.placeholder,t.altInput.disabled=t.input.disabled,t.altInput.required=t.input.required,t.altInput.tabIndex=t.input.tabIndex,t.altInput.type="text",t.input.setAttribute("type","hidden"),!t.config.static&&t.input.parentNode&&t.input.parentNode.insertBefore(t.altInput,t.input.nextSibling)),t.config.allowInput||t._input.setAttribute("readonly","readonly"),fs()}function fs(){t._positionElement=t.config.positionElement||t._input}function Bc(){var f=t.config.enableTime?t.config.noCalendar?"time":"datetime-local":"date";t.mobileInput=te("input",t.input.className+" flatpickr-mobile"),t.mobileInput.tabIndex=1,t.mobileInput.type=f,t.mobileInput.disabled=t.input.disabled,t.mobileInput.required=t.input.required,t.mobileInput.placeholder=t.input.placeholder,t.mobileFormatStr=f==="datetime-local"?"Y-m-d\\TH:i:S":f==="date"?"Y-m-d":"H:i:S",t.selectedDates.length>0&&(t.mobileInput.defaultValue=t.mobileInput.value=t.formatDate(t.selectedDates[0],t.mobileFormatStr)),t.config.minDate&&(t.mobileInput.min=t.formatDate(t.config.minDate,"Y-m-d")),t.config.maxDate&&(t.mobileInput.max=t.formatDate(t.config.maxDate,"Y-m-d")),t.input.getAttribute("step")&&(t.mobileInput.step=String(t.input.getAttribute("step"))),t.input.type="hidden",t.altInput!==void 0&&(t.altInput.type="hidden");try{t.input.parentNode&&t.input.parentNode.insertBefore(t.mobileInput,t.input.nextSibling)}catch(h){}y(t.mobileInput,"change",function(h){t.setDate($e(h).value,!1,t.mobileFormatStr),ue("onChange"),ue("onClose")})}function Vc(f){if(t.isOpen===!0)return t.close();t.open(f)}function ue(f,h){if(t.config!==void 0){var m=t.config[f];if(m!==void 0&&m.length>0)for(var b=0;m[b]&&b=0&&Be(f,t.selectedDates[1])<=0}function Li(){t.config.noCalendar||t.isMobile||!t.monthNav||(t.yearElements.forEach(function(f,h){var m=new Date(t.currentYear,t.currentMonth,1);m.setMonth(t.currentMonth+h),t.config.showMonths>1||t.config.monthSelectorType==="static"?t.monthElements[h].textContent=bi(m.getMonth(),t.config.shorthandCurrentMonth,t.l10n)+" ":t.monthsDropdownContainer.value=m.getMonth().toString(),f.value=m.getFullYear().toString()}),t._hidePrevMonthArrow=t.config.minDate!==void 0&&(t.currentYear===t.config.minDate.getFullYear()?t.currentMonth<=t.config.minDate.getMonth():t.currentYeart.config.maxDate.getMonth():t.currentYear>t.config.maxDate.getFullYear()))}function jr(f){var h=f||(t.config.altInput?t.config.altFormat:t.config.dateFormat);return t.selectedDates.map(function(m){return t.formatDate(m,h)}).filter(function(m,b,C){return t.config.mode!=="range"||t.config.enableTime||C.indexOf(m)===b}).join(t.config.mode!=="range"?t.config.conjunction:t.l10n.rangeSeparator)}function at(f){f===void 0&&(f=!0),t.mobileInput!==void 0&&t.mobileFormatStr&&(t.mobileInput.value=t.latestSelectedDateObj!==void 0?t.formatDate(t.latestSelectedDateObj,t.mobileFormatStr):""),t.input.value=jr(t.config.dateFormat),t.altInput!==void 0&&(t.altInput.value=jr(t.config.altFormat)),f!==!1&&ue("onValueUpdate")}function jc(f){var h=$e(f),m=t.prevMonthNav.contains(h),b=t.nextMonthNav.contains(h);m||b?k(m?-1:1):t.yearElements.indexOf(h)>=0?h.select():h.classList.contains("arrowUp")?t.changeYear(t.currentYear+1):h.classList.contains("arrowDown")&&t.changeYear(t.currentYear-1)}function Wc(f){f.preventDefault();var h=f.type==="keydown",m=$e(f),b=m;t.amPM!==void 0&&m===t.amPM&&(t.amPM.textContent=t.l10n.amPM[Fe(t.amPM.textContent===t.l10n.amPM[0])]);var C=parseFloat(b.getAttribute("min")),R=parseFloat(b.getAttribute("max")),X=parseFloat(b.getAttribute("step")),P=parseInt(b.value,10),Q=f.delta||(h?f.which===38?1:-1:0),I=P+X*Q;if(typeof b.value!="undefined"&&b.value.length===2){var K=b===t.hourElement,re=b===t.minuteElement;IR&&(I=b===t.hourElement?I-R-Fe(!t.amPM):C,re&&M(void 0,1,t.hourElement)),t.amPM&&K&&(X===1?I+P===23:Math.abs(I-P)>X)&&(t.amPM.textContent=t.l10n.amPM[Fe(t.amPM.textContent===t.l10n.amPM[0])]),b.value=De(I)}}return r(),t}function Nn(n,e){for(var t=Array.prototype.slice.call(n).filter(function(s){return s instanceof HTMLElement}),i=[],r=0;r option"))if(e.selected){for(let t of H("#id_columns"))t.appendChild(e.cloneNode(!0));e.remove()}n.preventDefault()}function Gg(n){for(let e of H("#id_columns > option"))if(e.selected){for(let t of H("#id_available_columns"))t.appendChild(e.cloneNode(!0));e.remove()}n.preventDefault()}function xc(n,e){return lt(this,null,function*(){return yield Ln(n,e)})}function Kg(n){var l,c,u;n.preventDefault();let e=n.currentTarget,t=e.getAttribute("data-url");if(t==null){Rt("danger","Error Updating Table Configuration","No API path defined for configuration form.").show();return}let i=((l=document.activeElement)==null?void 0:l.getAttribute("value"))==="Reset",r=(u=(c=e.getAttribute("data-config-root"))==null?void 0:c.split("."))!=null?u:[];if(i){let d=r.reduceRight((p,v)=>({[v]:p}),{});xc(t,d).then(p=>{tn(p)?Rt("danger","Error Resetting Table Configuration",p.error).show():location.reload()});return}let o=wl(e,"select[name=columns]"),s=Object.assign({},...o.map(d=>({[d.name]:d.options}))),a=r.reduceRight((d,p)=>({[p]:d}),s);xc(t,a).then(d=>{tn(d)?Rt("danger","Error Updating Table Configuration",d.error).show():location.reload()})}function Tc(){for(let n of H("#save_tableconfig"))n.addEventListener("click",Ug);for(let n of H("#add_columns"))n.addEventListener("click",Yg);for(let n of H("#remove_columns"))n.addEventListener("click",Gg);for(let n of H("form.userconfigform"))n.addEventListener("submit",Kg)}function Cc(n){return typeof n=="string"&&["show","hide"].includes(n)}var rn=class extends Error{constructor(t,i){super(t);ee(this,"table");this.table=i}},Rn=class{constructor(e,t){ee(this,"button");ee(this,"rows");this.button=e,this.rows=t}hideRows(){for(let e of this.rows)e.classList.add("d-none")}set buttonState(e){Cc(e)&&this.button.setAttribute("data-state",e)}get buttonState(){let e=this.button.getAttribute("data-state");return Cc(e)?e:null}toggleButton(){this.buttonState==="show"?this.button.innerText=Mn(this.button.innerText,"Show","Hide"):this.buttonState==="hide"&&(this.button.innerText=Mn(this.button.innerHTML,"Hide","Show"))}toggleState(){this.buttonState==="show"?this.buttonState="hide":this.buttonState==="hide"&&(this.buttonState="show")}toggle(){this.toggleState(),this.toggleButton()}handleClick(e){e.currentTarget.isEqualNode(this.button)&&this.toggle(),this.buttonState==="hide"&&this.hideRows()}},os=class{constructor(e){ee(this,"table");ee(this,"enabledButton");ee(this,"disabledButton");ee(this,"virtualButton");ee(this,"disconnectedButton");ee(this,"rows");this.table=e,this.rows=this.table.querySelectorAll("tr");try{let t=nn(this.table,"button.toggle-enabled"),i=nn(this.table,"button.toggle-disabled"),r=nn(this.table,"button.toggle-virtual"),o=nn(this.table,"button.toggle-disconnected");if(t===null)throw new rn("Table is missing a 'toggle-enabled' button.",e);if(i===null)throw new rn("Table is missing a 'toggle-disabled' button.",e);if(r===null)throw new rn("Table is missing a 'toggle-virtual' button.",e);if(o===null)throw new rn("Table is missing a 'toggle-disconnected' button.",e);t.addEventListener("click",s=>this.handleClick(s,this)),i.addEventListener("click",s=>this.handleClick(s,this)),r.addEventListener("click",s=>this.handleClick(s,this)),o.addEventListener("click",s=>this.handleClick(s,this)),this.enabledButton=new Rn(t,e.querySelectorAll('tr[data-enabled="enabled"]')),this.disabledButton=new Rn(i,e.querySelectorAll('tr[data-enabled="disabled"]')),this.virtualButton=new Rn(r,e.querySelectorAll('tr[data-type="virtual"]')),this.disconnectedButton=new Rn(o,e.querySelectorAll('tr[data-connected="disconnected"]'))}catch(t){if(t instanceof rn){console.debug("Table does not contain enable/disable toggle buttons");return}else throw t}}handleClick(e,t){for(let i of this.rows)i.classList.remove("d-none");t.enabledButton.handleClick(e),t.disabledButton.handleClick(e),t.virtualButton.handleClick(e),t.disconnectedButton.handleClick(e)}};function Sc(){for(let n of H("table"))new os(n)}var ss=class{constructor(e){ee(this,"base");ee(this,"state");ee(this,"activeLink",null);ee(this,"sections",[]);this.base=e,this.state=new gi({pinned:!0},{persist:!0,key:"netbox-sidenav"}),this.init(),this.initSectionLinks(),this.initLinks()}bodyHas(e){return document.body.hasAttribute(`data-sidenav-${e}`)}bodyRemove(...e){for(let t of e)document.body.removeAttribute(`data-sidenav-${t}`)}bodyAdd(...e){for(let t of e)document.body.setAttribute(`data-sidenav-${t}`,"")}init(){for(let e of this.base.querySelectorAll(".sidenav-toggle"))e.addEventListener("click",t=>this.onToggle(t));for(let e of H(".sidenav-toggle-mobile"))e.addEventListener("click",t=>this.onMobileToggle(t));window.innerWidth>1200&&(this.state.get("pinned")&&this.pin(),this.state.get("pinned")||this.unpin(),window.addEventListener("resize",()=>this.onResize())),window.innerWidth<1200&&(this.bodyRemove("hide"),this.bodyAdd("hidden"),window.addEventListener("resize",()=>this.onResize())),this.base.addEventListener("mouseenter",()=>this.onEnter()),this.base.addEventListener("mouseleave",()=>this.onLeave())}initLinks(){for(let e of this.getActiveLinks())this.bodyHas("show")?this.activateLink(e,"expand"):this.bodyHas("hidden")&&this.activateLink(e,"collapse")}show(){this.bodyAdd("show"),this.bodyRemove("hidden","hide")}hide(){this.bodyAdd("hidden"),this.bodyRemove("pinned","show");for(let e of this.base.querySelectorAll(".collapse"))e.classList.remove("show")}pin(){this.bodyAdd("show","pinned"),this.bodyRemove("hidden"),this.state.set("pinned",!0)}unpin(){this.bodyRemove("pinned","show"),this.bodyAdd("hidden");for(let e of this.base.querySelectorAll(".collapse"))e.classList.remove("show");this.state.set("pinned",!1)}handleSectionClick(e){e.preventDefault();let t=e.target;this.activeLink=t,this.closeInactiveSections()}closeInactiveSections(){for(let[e,t]of this.sections)e!==this.activeLink&&(e.classList.add("collapsed"),e.setAttribute("aria-expanded","false"),t.hide())}initSectionLinks(){for(let e of H(".navbar-nav .nav-item .nav-link[data-bs-toggle]"))if(e.parentElement!==null){let t=e.parentElement.querySelector(".collapse");if(t!==null){let i=new St(t,{toggle:!1});this.sections.push([e,i]),e.addEventListener("click",r=>this.handleSectionClick(r))}}}activateLink(e,t){var r;let i=e.closest(".dropdown-menu");if(gr(i)){let o=i.parentElement,s=(r=i.parentElement)==null?void 0:r.querySelector(".nav-link");if(gr(s)&&gr(o))switch(t){case"expand":s.setAttribute("aria-expanded","true"),o.classList.add("active"),i.classList.add("show"),e.classList.add("active");break;case"collapse":s.setAttribute("aria-expanded","false"),o.classList.remove("active"),i.classList.remove("show"),e.classList.remove("active");break}}}*getActiveLinks(){for(let e of this.base.querySelectorAll("ul.navbar-nav .nav-item .dropdown-item")){let t=e.querySelector("a");if(t){let i=new RegExp(t.href,"gi");window.location.href.match(i)&&(yield e)}}}onEnter(){if(!this.bodyHas("pinned")){this.bodyRemove("hide","hidden"),this.bodyAdd("show");for(let e of this.getActiveLinks())this.activateLink(e,"expand")}}onLeave(){if(!this.bodyHas("pinned")){this.bodyRemove("show"),this.bodyAdd("hide");for(let e of this.getActiveLinks())this.activateLink(e,"collapse");this.bodyRemove("hide"),this.bodyAdd("hidden")}}onResize(){this.bodyHas("show")&&!this.bodyHas("pinned")&&(this.bodyRemove("show"),this.bodyAdd("hidden"))}onToggle(e){e.preventDefault(),this.state.get("pinned")?this.unpin():this.pin()}onMobileToggle(e){e.preventDefault(),this.bodyHas("hidden")?this.show():this.hide()}};function Ac(){for(let n of H(".navbar"))new ss(n)}function Dc(n,e,t,i,r){let o=(...s)=>(console.warn("gridstack.js: Function `"+t+"` is deprecated in "+r+" and has been replaced with `"+i+"`. It will be **removed** in a future release"),e.apply(n,s));return o.prototype=e.prototype,o}var E=class n{static getElements(e,t=document){if(typeof e=="string"){let i="getElementById"in t?t:void 0;if(i&&!isNaN(+e[0])){let o=i.getElementById(e);return o?[o]:[]}let r=t.querySelectorAll(e);return!r.length&&e[0]!=="."&&e[0]!=="#"&&(r=t.querySelectorAll("."+e),r.length||(r=t.querySelectorAll("#"+e))),Array.from(r)}return[e]}static getElement(e,t=document){if(typeof e=="string"){let i="getElementById"in t?t:void 0;if(!e.length)return null;if(i&&e[0]==="#")return i.getElementById(e.substring(1));if(e[0]==="#"||e[0]==="."||e[0]==="[")return t.querySelector(e);if(i&&!isNaN(+e[0]))return i.getElementById(e);let r=t.querySelector(e);return i&&!r&&(r=i.getElementById(e)),r||(r=t.querySelector("."+e)),r}return e}static createWidgetDivs(e,t){var s,a;let i=n.createDiv(["grid-stack-item",e]),r=n.createDiv(["grid-stack-item-content"],i);return t.lazyLoad||((a=(s=t.grid)==null?void 0:s.opts)==null?void 0:a.lazyLoad)&&t.lazyLoad!==!1?t.visibleObservable||(t.visibleObservable=new IntersectionObserver(([l])=>{var c;l.isIntersecting&&((c=t.visibleObservable)==null||c.disconnect(),delete t.visibleObservable,Je.renderCB(r,t))}),window.setTimeout(()=>{var l;return(l=t.visibleObservable)==null?void 0:l.observe(i)})):Je.renderCB(r,t),i}static createDiv(e,t){let i=document.createElement("div");return e.forEach(r=>{r&&i.classList.add(r)}),t==null||t.appendChild(i),i}static shouldSizeToContent(e,t=!1){return(e==null?void 0:e.grid)&&(t?e.sizeToContent===!0||e.grid.opts.sizeToContent===!0&&e.sizeToContent===void 0:!!e.sizeToContent||e.grid.opts.sizeToContent&&e.sizeToContent!==!1)}static isIntercepted(e,t){return!(e.y>=t.y+t.h||e.y+e.h<=t.y||e.x+e.w<=t.x||e.x>=t.x+t.w)}static isTouching(e,t){return n.isIntercepted(e,{x:t.x-.5,y:t.y-.5,w:t.w+1,h:t.h+1})}static areaIntercept(e,t){let i=e.x>t.x?e.x:t.x,r=e.x+e.wt.y?e.y:t.y,s=e.y+e.h{var a,l,c,u;let s=t*(((a=r.y)!=null?a:1e4)-((l=o.y)!=null?l:1e4));return s===0?t*(((c=r.x)!=null?c:1e4)-((u=o.x)!=null?u:1e4)):s})}static find(e,t){return t?e.find(i=>i.id===t):void 0}static createStylesheet(e,t,i){let r=document.createElement("style"),o=i==null?void 0:i.nonce;return o&&(r.nonce=o),r.setAttribute("type","text/css"),r.setAttribute("gs-style-id",e),r.styleSheet?r.styleSheet.cssText="":r.appendChild(document.createTextNode("")),t?t.insertBefore(r,t.firstChild):(t=document.getElementsByTagName("head")[0],t.appendChild(r)),r}static removeStylesheet(e,t){let r=(t||document).querySelector("STYLE[gs-style-id="+e+"]");r&&r.parentNode&&r.remove()}static addCSSRule(e,t,i){e.textContent+=`${t} { ${i} } `}static toBool(e){return typeof e=="boolean"?e:typeof e=="string"?(e=e.toLowerCase(),!(e===""||e==="no"||e==="false"||e==="0")):!!e}static toNumber(e){return e===null||e.length===0?void 0:Number(e)}static parseHeight(e){let t,i="px";if(typeof e=="string")if(e==="auto"||e==="")t=0;else{let r=e.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!r)throw new Error(`Invalid height val = ${e}`);i=r[2]||"px",t=parseFloat(r[1])}else t=e;return{h:t,unit:i}}static defaults(e,...t){return t.forEach(i=>{for(let r in i){if(!i.hasOwnProperty(r))return;e[r]===null||e[r]===void 0?e[r]=i[r]:typeof i[r]=="object"&&typeof e[r]=="object"&&this.defaults(e[r],i[r])}}),e}static same(e,t){if(typeof e!="object")return e==t;if(typeof e!=typeof t||Object.keys(e).length!==Object.keys(t).length)return!1;for(let i in e)if(e[i]!==t[i])return!1;return!0}static copyPos(e,t,i=!1){return t.x!==void 0&&(e.x=t.x),t.y!==void 0&&(e.y=t.y),t.w!==void 0&&(e.w=t.w),t.h!==void 0&&(e.h=t.h),i&&(t.minW&&(e.minW=t.minW),t.minH&&(e.minH=t.minH),t.maxW&&(e.maxW=t.maxW),t.maxH&&(e.maxH=t.maxH)),e}static samePos(e,t){return e&&t&&e.x===t.x&&e.y===t.y&&(e.w||1)===(t.w||1)&&(e.h||1)===(t.h||1)}static sanitizeMinMax(e){e.minW||delete e.minW,e.minH||delete e.minH,e.maxW||delete e.maxW,e.maxH||delete e.maxH}static removeInternalAndSame(e,t){if(!(typeof e!="object"||typeof t!="object"))for(let i in e){let r=e[i],o=t[i];i[0]==="_"||r===o?delete e[i]:r&&typeof r=="object"&&o!==void 0&&(n.removeInternalAndSame(r,o),Object.keys(r).length||delete e[i])}}static removeInternalForSave(e,t=!0){for(let i in e)(i[0]==="_"||e[i]===null||e[i]===void 0)&&delete e[i];delete e.grid,t&&delete e.el,e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,e.locked||delete e.locked,(e.w===1||e.w===e.minW)&&delete e.w,(e.h===1||e.h===e.minH)&&delete e.h}static throttle(e,t){let i=!1;return(...r)=>{i||(i=!0,setTimeout(()=>{e(...r),i=!1},t))}}static removePositioningStyles(e){let t=e.style;t.position&&t.removeProperty("position"),t.left&&t.removeProperty("left"),t.top&&t.removeProperty("top"),t.width&&t.removeProperty("width"),t.height&&t.removeProperty("height")}static getScrollElement(e){if(!e)return document.scrollingElement||document.documentElement;let t=getComputedStyle(e);return/(auto|scroll)/.test(t.overflow+t.overflowY)?e:this.getScrollElement(e.parentElement)}static updateScrollPosition(e,t,i){let r=e.getBoundingClientRect(),o=window.innerHeight||document.documentElement.clientHeight;if(r.top<0||r.bottom>o){let s=r.bottom-o,a=r.top,l=this.getScrollElement(e);if(l!==null){let c=l.scrollTop;r.top<0&&i<0?e.offsetHeight>o?l.scrollTop+=i:l.scrollTop+=Math.abs(a)>Math.abs(i)?i:a:i>0&&(e.offsetHeight>o?l.scrollTop+=i:l.scrollTop+=s>i?i:s),t.top+=l.scrollTop-c}}}static updateScrollResize(e,t,i){let r=this.getScrollElement(t),o=r.clientHeight,s=r===this.getScrollElement()?0:r.getBoundingClientRect().top,a=e.clientY-s,l=ao-i;l?r.scrollBy({behavior:"smooth",top:a-i}):c&&r.scrollBy({behavior:"smooth",top:i-(o-a)})}static clone(e){return e==null||typeof e!="object"?e:e instanceof Array?[...e]:O({},e)}static cloneDeep(e){let t=["parentGrid","el","grid","subGrid","engine"],i=n.clone(e);for(let r in i)i.hasOwnProperty(r)&&typeof i[r]=="object"&&r.substring(0,2)!=="__"&&!t.find(o=>o===r)&&(i[r]=n.cloneDeep(e[r]));return i}static cloneNode(e){let t=e.cloneNode(!0);return t.removeAttribute("id"),t}static appendTo(e,t){let i;typeof t=="string"?i=n.getElement(t):i=t,i&&i.appendChild(e)}static addElStyles(e,t){if(t instanceof Object)for(let i in t)t.hasOwnProperty(i)&&(Array.isArray(t[i])?t[i].forEach(r=>{e.style[i]=r}):e.style[i]=t[i])}static initEvent(e,t){let i={type:t.type},r={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:t.target?t.target:e.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(o=>i[o]=e[o]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(o=>i[o]=e[o]),O(O({},i),r)}static simulateMouseEvent(e,t,i){let r=document.createEvent("MouseEvents");r.initMouseEvent(t,!0,!0,window,1,e.screenX,e.screenY,e.clientX,e.clientY,e.ctrlKey,e.altKey,e.shiftKey,e.metaKey,0,e.target),(i||e.target).dispatchEvent(r)}static getValuesFromTransformedElement(e){let t=document.createElement("div");n.addElStyles(t,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),e.appendChild(t);let i=t.getBoundingClientRect();return e.removeChild(t),t.remove(),{xScale:1/i.width,yScale:1/i.height,xOffset:i.left,yOffset:i.top}}static swap(e,t,i){if(!e)return;let r=e[t];e[t]=e[i],e[i]=r}static canBeRotated(e){var t;return!(!e||e.w===e.h||e.locked||e.noResize||(t=e.grid)!=null&&t.opts.disableResize||e.minW&&e.minW===e.maxW||e.minH&&e.minH===e.maxH)}};var on=class n{constructor(e={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=e.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=e.maxRow,this._float=e.float,this.nodes=e.nodes||[],this.onChange=e.onChange}batchUpdate(e=!0,t=!0){return!!this.batchMode===e?this:(this.batchMode=e,e?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,t&&this._packNodes(),this._notify()),this)}_useEntireRowArea(e,t){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!e._moving||e._skipDown||t.y<=e.y)}_fixCollisions(e,t=e,i,r={}){if(this.sortNodes(-1),i=i||this.collide(e,t),!i)return!1;if(e._moving&&!r.nested&&!this.float&&this.swap(e,i))return!0;let o=t;!this._loading&&this._useEntireRowArea(e,t)&&(o={x:0,w:this.column,y:t.y,h:t.h},i=this.collide(e,o,r.skip));let s=!1,a={nested:!0,pack:!1},l=0;for(;i=i||this.collide(e,o,r.skip);){if(l++>this.nodes.length*2)throw new Error("Infinite collide check");let c;if(i.locked||this._loading||e._moving&&!e._skipDown&&t.y>e.y&&!this.float&&(!this.collide(i,ae(O({},i),{y:e.y}),e)||!this.collide(i,ae(O({},i),{y:t.y-i.h}),e))){e._skipDown=e._skipDown||t.y>e.y;let u=O(ae(O({},t),{y:i.y+i.h}),a);c=this._loading&&E.samePos(e,u)?!0:this.moveNode(e,u),(i.locked||this._loading)&&c?E.copyPos(t,e):!i.locked&&c&&r.pack&&(this._packNodes(),t.y=i.y+i.h,E.copyPos(e,t)),s=s||c}else c=this.moveNode(i,O(ae(O({},i),{y:t.y+t.h,skip:e}),a));if(!c)return s;i=void 0}return s}collide(e,t=e,i){let r=e._id,o=i==null?void 0:i._id;return this.nodes.find(s=>s._id!==r&&s._id!==o&&E.isIntercepted(s,t))}collideAll(e,t=e,i){let r=e._id,o=i==null?void 0:i._id;return this.nodes.filter(s=>s._id!==r&&s._id!==o&&E.isIntercepted(s,t))}directionCollideCoverage(e,t,i){if(!t.rect||!e._rect)return;let r=e._rect,o=O({},t.rect);o.y>r.y?(o.h+=o.y-r.y,o.y=r.y):o.h+=r.y-o.y,o.x>r.x?(o.w+=o.x-r.x,o.x=r.x):o.w+=r.x-o.x;let s,a=.5;for(let l of i){if(l.locked||!l._rect)break;let c=l._rect,u=Number.MAX_VALUE,d=Number.MAX_VALUE;r.yc.y+c.h&&(u=(c.y+c.h-o.y)/c.h),r.xc.x+c.w&&(d=(c.x+c.w-o.x)/c.w);let p=Math.min(d,u);p>a&&(a=p,s=l)}return t.collide=s,s}cacheRects(e,t,i,r,o,s){return this.nodes.forEach(a=>a._rect={y:a.y*t+i,x:a.x*e+s,w:a.w*e-s-r,h:a.h*t-i-o}),this}swap(e,t){if(!t||t.locked||!e||e.locked)return!1;function i(){let o=t.x,s=t.y;return t.x=e.x,t.y=e.y,e.h!=t.h?(e.x=o,e.y=t.y+t.h):e.w!=t.w?(e.x=t.x+t.w,e.y=s):(e.x=o,e.y=s),e._dirty=t._dirty=!0,!0}let r;if(e.w===t.w&&e.h===t.h&&(e.x===t.x||e.y===t.y)&&(r=E.isTouching(e,t)))return i();if(r!==!1){if(e.w===t.w&&e.x===t.x&&(r||(r=E.isTouching(e,t)))){if(t.y{let c;s.locked||(s.autoPosition=!0,e==="list"&&a&&(c=l[a-1])),this.addNode(s,!1,c)}),r||delete this._inColumnResize,i||this.batchUpdate(!1),this}set float(e){this._float!==e&&(this._float=e||!1,e||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(e=1){return this.nodes=E.sort(this.nodes,e),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(e=>{if(e._updating||e._orig===void 0||e.y===e._orig.y)return;let t=e.y;for(;t>e._orig.y;)--t,this.collide(e,{x:e.x,y:t,w:e.w,h:e.h})||(e._dirty=!0,e.y=t)}):this.nodes.forEach((e,t)=>{if(!e.locked)for(;e.y>0;){let i=t===0?0:e.y-1;if(!(t===0||!this.collide(e,{x:e.x,y:i,w:e.w,h:e.h})))break;e._dirty=e.y!==i,e.y=i}}),this)}prepareNode(e,t){var o;e._id=(o=e._id)!=null?o:n._idSeq++;let i=e.id;if(i){let s=1;for(;this.nodes.find(a=>a.id===e.id&&a!==e);)e.id=i+"_"+s++}(e.x===void 0||e.y===void 0||e.x===null||e.y===null)&&(e.autoPosition=!0);let r={x:0,y:0,w:1,h:1};return E.defaults(e,r),e.autoPosition||delete e.autoPosition,e.noResize||delete e.noResize,e.noMove||delete e.noMove,E.sanitizeMinMax(e),typeof e.x=="string"&&(e.x=Number(e.x)),typeof e.y=="string"&&(e.y=Number(e.y)),typeof e.w=="string"&&(e.w=Number(e.w)),typeof e.h=="string"&&(e.h=Number(e.h)),isNaN(e.x)&&(e.x=r.x,e.autoPosition=!0),isNaN(e.y)&&(e.y=r.y,e.autoPosition=!0),isNaN(e.w)&&(e.w=r.w),isNaN(e.h)&&(e.h=r.h),this.nodeBoundFix(e,t),e}nodeBoundFix(e,t){let i=e._orig||E.copyPos({},e);if(e.maxW&&e.w&&(e.w=Math.min(e.w,e.maxW)),e.maxH&&e.h&&(e.h=Math.min(e.h,e.maxH)),e.minW&&e.w&&e.minW<=this.column&&(e.w=Math.max(e.w,e.minW)),e.minH&&e.h&&(e.h=Math.max(e.h,e.minH)),(e.x||0)+(e.w||1)>this.column&&this.columnthis.column?e.w=this.column:e.w<1&&(e.w=1),this.maxRow&&e.h>this.maxRow?e.h=this.maxRow:e.h<1&&(e.h=1),e.x<0&&(e.x=0),e.y<0&&(e.y=0),e.x+e.w>this.column&&(t?e.w=this.column-e.x:e.x=this.column-e.w),this.maxRow&&e.y+e.h>this.maxRow&&(t?e.h=this.maxRow-e.y:e.y=this.maxRow-e.h),E.samePos(e,i)||(e._dirty=!0),this}getDirtyNodes(e){return e?this.nodes.filter(t=>t._dirty&&!E.samePos(t,t._orig)):this.nodes.filter(t=>t._dirty)}_notify(e){if(this.batchMode||!this.onChange)return this;let t=(e||[]).concat(this.getDirtyNodes());return this.onChange(t),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(e=>{delete e._dirty,delete e._lastTried}),this)}saveInitial(){return this.nodes.forEach(e=>{e._orig=E.copyPos({},e),delete e._dirty}),this._hasLocked=this.nodes.some(e=>e.locked),this}restoreInitial(){return this.nodes.forEach(e=>{!e._orig||E.samePos(e,e._orig)||(E.copyPos(e,e._orig),e._dirty=!0)}),this._notify(),this}findEmptyPosition(e,t=this.nodes,i=this.column,r){let o=r?r.y*i+(r.x+r.w):0,s=!1;for(let a=o;!s;++a){let l=a%i,c=Math.floor(a/i);if(l+e.w>i)continue;let u={x:l,y:c,w:e.w,h:e.h};t.find(d=>E.isIntercepted(u,d))||((e.x!==l||e.y!==c)&&(e._dirty=!0),e.x=l,e.y=c,delete e.autoPosition,s=!0)}return s}addNode(e,t=!1,i){let r=this.nodes.find(s=>s._id===e._id);if(r)return r;this._inColumnResize?this.nodeBoundFix(e):this.prepareNode(e),delete e._temporaryRemoved,delete e._removeDOM;let o;return e.autoPosition&&this.findEmptyPosition(e,this.nodes,this.column,i)&&(delete e.autoPosition,o=!0),this.nodes.push(e),t&&this.addedNodes.push(e),o||this._fixCollisions(e),this.batchMode||this._packNodes()._notify(),e}removeNode(e,t=!0,i=!1){return this.nodes.find(r=>r._id===e._id)?(i&&this.removedNodes.push(e),t&&(e._removeDOM=!0),this.nodes=this.nodes.filter(r=>r._id!==e._id),e._isAboutToRemove||this._packNodes(),this._notify([e]),this):this}removeAll(e=!0,t=!0){if(delete this._layouts,!this.nodes.length)return this;e&&this.nodes.forEach(r=>r._removeDOM=!0);let i=this.nodes;return this.removedNodes=t?i:[],this.nodes=[],this._notify(i)}moveNodeCheck(e,t){if(!this.changedPosConstrain(e,t))return!1;if(t.pack=!0,!this.maxRow)return this.moveNode(e,t);let i,r=new n({column:this.column,float:this.float,nodes:this.nodes.map(s=>s._id===e._id?(i=O({},s),i):O({},s))});if(!i)return!1;let o=r.moveNode(i,t)&&r.getRow()<=Math.max(this.getRow(),this.maxRow);if(!o&&!t.resizing&&t.collide){let s=t.collide.el.gridstackNode;if(this.swap(e,s))return this._notify(),!0}return o?(r.nodes.filter(s=>s._dirty).forEach(s=>{let a=this.nodes.find(l=>l._id===s._id);a&&(E.copyPos(a,s),a._dirty=!0)}),this._notify(),!0):!1}willItFit(e){if(delete e._willFitPos,!this.maxRow)return!0;let t=new n({column:this.column,float:this.float,nodes:this.nodes.map(r=>O({},r))}),i=O({},e);return this.cleanupNode(i),delete i.el,delete i._id,delete i.content,delete i.grid,t.addNode(i),t.getRow()<=this.maxRow?(e._willFitPos=E.copyPos({},i),!0):!1}changedPosConstrain(e,t){return t.w=t.w||e.w,t.h=t.h||e.h,e.x!==t.x||e.y!==t.y?!0:(e.maxW&&(t.w=Math.min(t.w,e.maxW)),e.maxH&&(t.h=Math.min(t.h,e.maxH)),e.minW&&(t.w=Math.max(t.w,e.minW)),e.minH&&(t.h=Math.max(t.h,e.minH)),e.w!==t.w||e.h!==t.h)}moveNode(e,t){var c,u;if(!e||!t)return!1;let i;t.pack===void 0&&!this.batchMode&&(i=t.pack=!0),typeof t.x!="number"&&(t.x=e.x),typeof t.y!="number"&&(t.y=e.y),typeof t.w!="number"&&(t.w=e.w),typeof t.h!="number"&&(t.h=e.h);let r=e.w!==t.w||e.h!==t.h,o=E.copyPos({},e,!0);if(E.copyPos(o,t),this.nodeBoundFix(o,r),E.copyPos(t,o),!t.forceCollide&&E.samePos(e,t))return!1;let s=E.copyPos({},e),a=this.collideAll(e,o,t.skip),l=!0;if(a.length){let d=e._moving&&!t.nested,p=d?this.directionCollideCoverage(e,t,a):a[0];if(d&&p&&((u=(c=e.grid)==null?void 0:c.opts)!=null&&u.subGridDynamic)&&!e.grid._isTemp){let v=E.areaIntercept(t.rect,p._rect),g=E.area(t.rect),y=E.area(p._rect);v/(g.8&&(p.grid.makeSubGrid(p.el,void 0,e),p=void 0)}p?l=!this._fixCollisions(e,o,p,t):(l=!1,i&&delete t.pack)}return l&&!E.samePos(e,o)&&(e._dirty=!0,E.copyPos(e,o)),t.pack&&this._packNodes()._notify(),!E.samePos(e,s)}getRow(){return this.nodes.reduce((e,t)=>Math.max(e,t.y+t.h),0)}beginUpdate(e){return e._updating||(e._updating=!0,delete e._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){let e=this.nodes.find(t=>t._updating);return e&&(delete e._updating,delete e._skipDown),this}save(e=!0,t){var s;let i=(s=this._layouts)==null?void 0:s.length,r=i&&this.column!==i-1?this._layouts[i-1]:null,o=[];return this.sortNodes(),this.nodes.forEach(a=>{let l=r==null?void 0:r.find(u=>u._id===a._id),c=O(O({},a),l||{});E.removeInternalForSave(c,!e),t&&t(a,c),o.push(c)}),o}layoutsNodesChange(e){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((t,i)=>{if(!t||i===this.column)return this;if(i{if(!o._orig)return;let s=t.find(a=>a._id===o._id);s&&(s.y>=0&&o.y!==o._orig.y&&(s.y+=o.y-o._orig.y),o.x!==o._orig.x&&(s.x=Math.round(o.x*r)),o.w!==o._orig.w&&(s.w=Math.round(o.w*r)))})}}),this)}columnChanged(e,t,i="moveScale"){var a;if(!this.nodes.length||!t||e===t)return this;let r=i==="compact"||i==="list";r&&this.sortNodes(1),te&&this._layouts){let l=this._layouts[t]||[],c=this._layouts.length-1;!l.length&&e!==c&&((a=this._layouts[c])!=null&&a.length)&&(e=c,this._layouts[c].forEach(u=>{var p,v,g;let d=s.find(y=>y._id===u._id);d&&(!r&&!u.autoPosition&&(d.x=(p=u.x)!=null?p:d.x,d.y=(v=u.y)!=null?v:d.y),d.w=(g=u.w)!=null?g:d.w,(u.x==null||u.y===void 0)&&(d.autoPosition=!0))})),l.forEach(u=>{var p,v,g;let d=s.findIndex(y=>y._id===u._id);if(d!==-1){let y=s[d];if(r){y.w=u.w;return}(u.autoPosition||isNaN(u.x)||isNaN(u.y))&&this.findEmptyPosition(u,o),u.autoPosition||(y.x=(p=u.x)!=null?p:y.x,y.y=(v=u.y)!=null?v:y.y,y.w=(g=u.w)!=null?g:y.w,o.push(y)),s.splice(d,1)}})}if(r)this.compact(i,!1);else{if(s.length)if(typeof i=="function")i(t,e,o,s);else{let l=r||i==="none"?1:t/e,c=i==="move"||i==="moveScale",u=i==="scale"||i==="moveScale";s.forEach(d=>{d.x=t===1?0:c?Math.round(d.x*l):Math.min(d.x,t-1),d.w=t===1||e===1?1:u?Math.round(d.w*l)||1:Math.min(d.w,t),o.push(d)}),s=[]}o=E.sort(o,-1),this._inColumnResize=!0,this.nodes=[],o.forEach(l=>{this.addNode(l,!1),delete l._orig})}return this.nodes.forEach(l=>delete l._orig),this.batchUpdate(!1,!r),delete this._inColumnResize,this}cacheLayout(e,t,i=!1){let r=[];return e.forEach((o,s)=>{var a;if(o._id===void 0){let l=o.id?this.nodes.find(c=>c.id===o.id):void 0;o._id=(a=l==null?void 0:l._id)!=null?a:n._idSeq++}r[s]={x:o.x,y:o.y,w:o.w,_id:o._id}}),this._layouts=i?[]:this._layouts||[],this._layouts[t]=r,this}cacheOneLayout(e,t){var o;e._id=(o=e._id)!=null?o:n._idSeq++;let i={x:e.x,y:e.y,w:e.w,_id:e._id};(e.autoPosition||e.x===void 0)&&(delete i.x,delete i.y,e.autoPosition&&(i.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[t]=this._layouts[t]||[];let r=this.findCacheLayout(e,t);return r===-1?this._layouts[t].push(i):this._layouts[t][r]=i,this}findCacheLayout(e,t){var i,r,o;return(o=(r=(i=this._layouts)==null?void 0:i[t])==null?void 0:r.findIndex(s=>s._id===e._id))!=null?o:-1}removeNodeFromLayoutCache(e){if(this._layouts)for(let t=0;t0||navigator.msMaxTouchPoints>0),Ze=class{};function Hr(n,e){if(n.touches.length>1)return;n.cancelable&&n.preventDefault();let t=n.changedTouches[0],i=document.createEvent("MouseEvents");i.initMouseEvent(e,!0,!0,window,1,t.screenX,t.screenY,t.clientX,t.clientY,!1,!1,!1,!1,0,null),n.target.dispatchEvent(i)}function Oc(n,e){n.cancelable&&n.preventDefault();let t=document.createEvent("MouseEvents");t.initMouseEvent(e,!0,!0,window,1,n.screenX,n.screenY,n.clientX,n.clientY,!1,!1,!1,!1,0,null),n.target.dispatchEvent(t)}function Hn(n){Ze.touchHandled||(Ze.touchHandled=!0,Hr(n,"mousedown"))}function In(n){Ze.touchHandled&&Hr(n,"mousemove")}function Pn(n){if(!Ze.touchHandled)return;Ze.pointerLeaveTimeout&&(window.clearTimeout(Ze.pointerLeaveTimeout),delete Ze.pointerLeaveTimeout);let e=!!$.dragElement;Hr(n,"mouseup"),e||Hr(n,"click"),Ze.touchHandled=!1}function Fn(n){n.pointerType!=="mouse"&&n.target.releasePointerCapture(n.pointerId)}function as(n){$.dragElement&&n.pointerType!=="mouse"&&Oc(n,"mouseenter")}function ls(n){$.dragElement&&n.pointerType!=="mouse"&&(Ze.pointerLeaveTimeout=window.setTimeout(()=>{delete Ze.pointerLeaveTimeout,Oc(n,"mouseleave")},10))}var _i=class n{constructor(e,t,i){this.host=e,this.dir=t,this.option=i,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){let e=this.el=document.createElement("div");return e.classList.add("ui-resizable-handle"),e.classList.add(`${n.prefix}${this.dir}`),e.style.zIndex="100",e.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),Ne&&(this.el.addEventListener("touchstart",Hn),this.el.addEventListener("pointerdown",Fn)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),Ne&&(this.el.removeEventListener("touchstart",Hn),this.el.removeEventListener("pointerdown",Fn)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(e){this.mouseDownEvent=e,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Ne&&(this.el.addEventListener("touchmove",In),this.el.addEventListener("touchend",Pn)),e.stopPropagation(),e.preventDefault()}_mouseMove(e){let t=this.mouseDownEvent;this.moving?this._triggerEvent("move",e):Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",e),document.addEventListener("keydown",this._keyEvent)),e.stopPropagation()}_mouseUp(e){this.moving&&(this._triggerEvent("stop",e),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Ne&&(this.el.removeEventListener("touchmove",In),this.el.removeEventListener("touchend",Pn)),delete this.moving,delete this.mouseDownEvent,e.stopPropagation(),e.preventDefault()}_keyEvent(e){var t,i;e.key==="Escape"&&((i=(t=this.host.gridstackNode)==null?void 0:t.grid)==null||i.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(e,t){return this.option[e]&&this.option[e](t),this}};_i.prefix="ui-resizable-";var Ft=class{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(e,t){this._eventRegister[e]=t}off(e){delete this._eventRegister[e]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(e,t){if(!this.disabled&&this._eventRegister&&this._eventRegister[e])return this._eventRegister[e](t)}};var wi=class n extends Ft{constructor(e,t={}){super(),this.el=e,this.option=t,this.rectScale={x:1,y:1},this._ui=()=>{let r=this.el.parentElement.getBoundingClientRect(),o={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},s=this.temporalRect||o;return{position:{left:(s.left-r.left)*this.rectScale.x,top:(s.top-r.top)*this.rectScale.y},size:{width:s.width*this.rectScale.x,height:s.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(e){let t=e.handles&&e.handles!==this.option.handles,i=e.autoHide&&e.autoHide!==this.option.autoHide;return Object.keys(e).forEach(r=>this.option[r]=e[r]),t&&(this._removeHandlers(),this._setupHandlers()),i&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(e){return e?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),$.overResizeElement===this&&delete $.overResizeElement),this}_mouseOver(e){$.overResizeElement||$.dragElement||($.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(e){$.overResizeElement===this&&(delete $.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(e=>e.trim()).map(e=>new _i(this.el,e,{start:t=>{this._resizeStart(t)},stop:t=>{this._resizeStop(t)},move:t=>{this._resizing(t,e)}})),this}_resizeStart(e){this.sizeToContent=E.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=E.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=e,this._setupHelper(),this._applyChange();let t=E.initEvent(e,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(t,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",t),this}_resizing(e,t){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(e,t),this._applyChange();let i=E.initEvent(e,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(i,this._ui()),this.triggerEvent("resize",i),this}_resizeStop(e){let t=E.initEvent(e,{type:"resizestop",target:this.el});return this.option.stop&&this.option.stop(t),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",t),this._cleanHelper(),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=n._originStyleProp.map(i=>this.el.style[i]),this.parentOriginStylePosition=this.el.parentElement.style.position;let e=this.el.parentElement,t=E.getValuesFromTransformedElement(e);return this.rectScale={x:t.xScale,y:t.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return n._originStyleProp.forEach((e,t)=>{this.el.style[e]=this.elOriginStyleVal[t]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(e,t){let i=this.startEvent,r={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},o=e.clientX-i.clientX,s=this.sizeToContent?0:e.clientY-i.clientY,a,l;t.indexOf("e")>-1?r.width+=o:t.indexOf("w")>-1&&(r.width-=o,r.left+=o,a=!0),t.indexOf("s")>-1?r.height+=s:t.indexOf("n")>-1&&(r.height-=s,r.top+=s,l=!0);let c=this._constrainSize(r.width,r.height,a,l);return Math.round(r.width)!==Math.round(c.width)&&(t.indexOf("w")>-1&&(r.left+=r.width-c.width),r.width=c.width),Math.round(r.height)!==Math.round(c.height)&&(t.indexOf("n")>-1&&(r.top+=r.height-c.height),r.height=c.height),r}_constrainSize(e,t,i,r){let o=this.option,s=(i?o.maxWidthMoveLeft:o.maxWidth)||Number.MAX_SAFE_INTEGER,a=o.minWidth/this.rectScale.x||e,l=(r?o.maxHeightMoveUp:o.maxHeight)||Number.MAX_SAFE_INTEGER,c=o.minHeight/this.rectScale.y||t,u=Math.min(s,Math.max(a,e)),d=Math.min(l,Math.max(c,t));return{width:u,height:d}}_applyChange(){let e={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){let t=this.el.parentElement,{left:i,top:r}=t.getBoundingClientRect();e={left:i,top:r,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(t=>{let i=this.temporalRect[t],r=t==="width"||t==="left"?this.rectScale.x:t==="height"||t==="top"?this.rectScale.y:1;this.el.style[t]=(i-e[t])*r+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(e=>e.destroy()),delete this.handlers,this}};wi._originStyleProp=["width","height","position","left","top","opacity","zIndex"];var Xg='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle',xi=class n extends Ft{constructor(e,t={}){var o;super(),this.el=e,this.option=t,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};let i=(o=t==null?void 0:t.handle)==null?void 0:o.substring(1),r=e.gridstackNode;this.dragEls=!i||e.classList.contains(i)?[e]:r!=null&&r.subGrid?[e.querySelector(t.handle)||e]:Array.from(e.querySelectorAll(t.handle)),this.dragEls.length===0&&(this.dragEls=[e]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(e=>{e.addEventListener("mousedown",this._mouseDown),Ne&&(e.addEventListener("touchstart",Hn),e.addEventListener("pointerdown",Fn))}),this.el.classList.remove("ui-draggable-disabled"))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(t=>{t.removeEventListener("mousedown",this._mouseDown),Ne&&(t.removeEventListener("touchstart",Hn),t.removeEventListener("pointerdown",Fn))}),e||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this}_mouseDown(e){if(!$.mouseHandled)return e.button!==0||!this.dragEls.find(t=>t===e.target)&&e.target.closest(Xg)||this.option.cancel&&e.target.closest(this.option.cancel)||(this.mouseDownEvent=e,delete this.dragging,delete $.dragElement,delete $.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),Ne&&(e.currentTarget.addEventListener("touchmove",In),e.currentTarget.addEventListener("touchend",Pn)),e.preventDefault(),document.activeElement&&document.activeElement.blur(),$.mouseHandled=!0),!0}_callDrag(e){if(!this.dragging)return;let t=E.initEvent(e,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(t,this.ui()),this.triggerEvent("drag",t)}_mouseMove(e){var i;let t=this.mouseDownEvent;if(this.lastDrag=e,this.dragging)if(this._dragFollow(e),$.pauseDrag){let r=Number.isInteger($.pauseDrag)?$.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(e),r)}else this._callDrag(e);else if(Math.abs(e.x-t.x)+Math.abs(e.y-t.y)>3){this.dragging=!0,$.dragElement=this;let r=(i=this.el.gridstackNode)==null?void 0:i.grid;r?$.dropElement=r.el.ddElement.ddDroppable:delete $.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=E.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(e,this.el,this.helperContainment),this._setupHelperStyle(e);let o=E.initEvent(e,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(o,this.ui()),this.triggerEvent("dragstart",o),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(e){var t,i;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),Ne&&e.currentTarget&&(e.currentTarget.removeEventListener("touchmove",In,!0),e.currentTarget.removeEventListener("touchend",Pn,!0)),this.dragging){delete this.dragging,(t=this.el.gridstackNode)==null||delete t._origRotate,document.removeEventListener("keydown",this._keyEvent),((i=$.dropElement)==null?void 0:i.el)===this.el.parentElement&&delete $.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();let r=E.initEvent(e,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(r),this.triggerEvent("dragstop",r),$.dropElement&&$.dropElement.drop(e)}delete this.helper,delete this.mouseDownEvent,delete $.dragElement,delete $.dropElement,delete $.mouseHandled,e.preventDefault()}_keyEvent(e){var r,o;let t=this.el.gridstackNode,i=(t==null?void 0:t.grid)||((o=(r=$.dropElement)==null?void 0:r.el)==null?void 0:o.gridstack);if(e.key==="Escape")t&&t._origRotate&&(t._orig=t._origRotate,delete t._origRotate),i==null||i.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(t&&i&&(e.key==="r"||e.key==="R")){if(!E.canBeRotated(t))return;t._origRotate=t._origRotate||O({},t._orig),delete t._moving,i.setAnimation(!1).rotate(t.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),t._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,t.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",E.swap(t._orig,"w","h"),delete t._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let e=this.el;return typeof this.option.helper=="function"?e=this.option.helper(this.el):this.option.helper==="clone"&&(e=E.cloneNode(this.el)),document.body.contains(e)||E.appendTo(e,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=n.originStyleProp.map(t=>this.el.style[t]),e}_setupHelperStyle(e){this.helper.classList.add("ui-draggable-dragging");let t=this.helper.style;return t.pointerEvents="none",t.width=this.dragOffset.width+"px",t.height=this.dragOffset.height+"px",t.willChange="left, top",t.position="fixed",this._dragFollow(e),t.transition="none",setTimeout(()=>{this.helper&&(t.transition=null)},0),this}_removeHelperStyle(){var t;this.helper.classList.remove("ui-draggable-dragging");let e=(t=this.helper)==null?void 0:t.gridstackNode;if(!(e!=null&&e._isAboutToRemove)&&this.dragElementOriginStyle){let i=this.helper,r=this.dragElementOriginStyle.transition||null;i.style.transition=this.dragElementOriginStyle.transition="none",n.originStyleProp.forEach(o=>i.style[o]=this.dragElementOriginStyle[o]||null),setTimeout(()=>i.style.transition=r,50)}return delete this.dragElementOriginStyle,this}_dragFollow(e){let t={left:0,top:0},i=this.helper.style,r=this.dragOffset;i.left=(e.clientX+r.offsetLeft-t.left)*this.dragTransform.xScale+"px",i.top=(e.clientY+r.offsetTop-t.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(e,t,i){let r=0,o=0;i&&(r=this.dragTransform.xOffset,o=this.dragTransform.yOffset);let s=t.getBoundingClientRect();return{left:s.left,top:s.top,offsetLeft:-e.clientX+s.left-r,offsetTop:-e.clientY+s.top-o,width:s.width*this.dragTransform.xScale,height:s.height*this.dragTransform.yScale}}ui(){let t=this.el.parentElement.getBoundingClientRect(),i=this.helper.getBoundingClientRect();return{position:{top:(i.top-t.top)*this.dragTransform.yScale,left:(i.left-t.left)*this.dragTransform.xScale}}}};xi.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];var Ir=class extends Ft{constructor(e,t={}){super(),this.el=e,this.option=t,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(e,t){super.on(e,t)}off(e){super.off(e)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),Ne&&(this.el.addEventListener("pointerenter",as),this.el.addEventListener("pointerleave",ls)))}disable(e=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),e||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),Ne&&(this.el.removeEventListener("pointerenter",as),this.el.removeEventListener("pointerleave",ls)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(e){return Object.keys(e).forEach(t=>this.option[t]=e[t]),this._setupAccept(),this}_mouseEnter(e){if(!$.dragElement||!this._canDrop($.dragElement.el))return;e.preventDefault(),e.stopPropagation(),$.dropElement&&$.dropElement!==this&&$.dropElement._mouseLeave(e,!0),$.dropElement=this;let t=E.initEvent(e,{target:this.el,type:"dropover"});this.option.over&&this.option.over(t,this._ui($.dragElement)),this.triggerEvent("dropover",t),this.el.classList.add("ui-droppable-over")}_mouseLeave(e,t=!1){var r;if(!$.dragElement||$.dropElement!==this)return;e.preventDefault(),e.stopPropagation();let i=E.initEvent(e,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(i,this._ui($.dragElement)),this.triggerEvent("dropout",i),$.dropElement===this&&(delete $.dropElement,!t)){let o,s=this.el.parentElement;for(;!o&&s;)o=(r=s.ddElement)==null?void 0:r.ddDroppable,s=s.parentElement;o&&o._mouseEnter(e)}}drop(e){e.preventDefault();let t=E.initEvent(e,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(t,this._ui($.dragElement)),this.triggerEvent("drop",t)}_canDrop(e){return e&&(!this.accept||this.accept(e))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=e=>e.classList.contains(this.option.accept)||e.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(e){return O({draggable:e.el},e.ui())}};var Pr=class n{static init(e){return e.ddElement||(e.ddElement=new n(e)),e.ddElement}constructor(e){this.el=e}on(e,t){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.on(e,t):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.on(e,t):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.on(e,t),this}off(e){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(e)>-1?this.ddDraggable.off(e):this.ddDroppable&&["drop","dropover","dropout"].indexOf(e)>-1?this.ddDroppable.off(e):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(e)>-1&&this.ddResizable.off(e),this}setupDraggable(e){return this.ddDraggable?this.ddDraggable.updateOption(e):this.ddDraggable=new xi(this.el,e),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(e){return this.ddResizable?this.ddResizable.updateOption(e):this.ddResizable=new wi(this.el,e),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(e){return this.ddDroppable?this.ddDroppable.updateOption(e):this.ddDroppable=new Ir(this.el,e),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}};var Fr=class{resizable(e,t,i,r){return this._getDDElements(e).forEach(o=>{if(t==="disable"||t==="enable")o.ddResizable&&o.ddResizable[t]();else if(t==="destroy")o.ddResizable&&o.cleanResizable();else if(t==="option")o.setupResizable({[i]:r});else{let a=o.el.gridstackNode.grid,l=o.el.getAttribute("gs-resize-handles")||a.opts.resizable.handles||"e,s,se";l==="all"&&(l="n,e,s,w,se,sw,ne,nw");let c=!a.opts.alwaysShowResizeHandle;o.setupResizable(ae(O({},a.opts.resizable),{handles:l,autoHide:c,start:t.start,stop:t.stop,resize:t.resize}))}}),this}draggable(e,t,i,r){return this._getDDElements(e).forEach(o=>{if(t==="disable"||t==="enable")o.ddDraggable&&o.ddDraggable[t]();else if(t==="destroy")o.ddDraggable&&o.cleanDraggable();else if(t==="option")o.setupDraggable({[i]:r});else{let s=o.el.gridstackNode.grid;o.setupDraggable(ae(O({},s.opts.draggable),{start:t.start,stop:t.stop,drag:t.drag}))}}),this}dragIn(e,t){return this._getDDElements(e).forEach(i=>i.setupDraggable(t)),this}droppable(e,t,i,r){return typeof t.accept=="function"&&!t._accept&&(t._accept=t.accept,t.accept=o=>t._accept(o)),this._getDDElements(e).forEach(o=>{t==="disable"||t==="enable"?o.ddDroppable&&o.ddDroppable[t]():t==="destroy"?o.ddDroppable&&o.cleanDroppable():t==="option"?o.setupDroppable({[i]:r}):o.setupDroppable(t)}),this}isDroppable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDroppable&&!e.ddElement.ddDroppable.disabled)}isDraggable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddDraggable&&!e.ddElement.ddDraggable.disabled)}isResizable(e){var t;return!!((t=e==null?void 0:e.ddElement)!=null&&t.ddResizable&&!e.ddElement.ddResizable.disabled)}on(e,t,i){return this._getDDElements(e).forEach(r=>r.on(t,o=>{i(o,$.dragElement?$.dragElement.el:o.target,$.dragElement?$.dragElement.helper:null)})),this}off(e,t){return this._getDDElements(e).forEach(i=>i.off(t)),this}_getDDElements(e,t=!0){let i=E.getElements(e);if(!i.length)return[];let r=i.map(o=>o.ddElement||(t?Pr.init(o):null));return t||r.filter(o=>o),r}};var Re=new Fr,Je=class n{static init(e={},t=".grid-stack"){if(typeof document=="undefined")return null;let i=n.getGridElement(t);return i?(i.gridstack||(i.gridstack=new n(i,E.cloneDeep(e))),i.gridstack):(console.error(typeof t=="string"?'GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
-Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(e={},t=".grid-stack"){let i=[];return typeof document=="undefined"||(n.getGridElements(t).forEach(r=>{r.gridstack||(r.gridstack=new n(r,E.cloneDeep(e))),i.push(r.gridstack)}),i.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+t+`" - element missing or wrong selector ?
-Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),i}static addGrid(e,t={}){if(!e)return null;let i=e;if(i.gridstack){let s=i.gridstack;return t&&(s.opts=O(O({},s.opts),t)),t.children!==void 0&&s.load(t.children),s}return(!e.classList.contains("grid-stack")||n.addRemoveCB)&&(n.addRemoveCB?i=n.addRemoveCB(e,t,!0,!0):i=E.createDiv(["grid-stack",t.class],e)),n.init(t,i)}static registerEngine(e){n.engineClass=e}get placeholder(){if(!this._placeholder){this._placeholder=E.createDiv([this.opts.placeholderClass,Ve.itemClass,this.opts.itemClass]);let e=E.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(e.textContent=this.opts.placeholderText)}return this._placeholder}constructor(e,t={}){var d,p,v;this.el=e,this.opts=t,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},e.gridstack=this,this.opts=t=t||{},e.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),t.row&&(t.minRow=t.maxRow=t.row,delete t.row);let i=E.toNumber(e.getAttribute("gs-row"));t.column==="auto"&&delete t.column,t.alwaysShowResizeHandle!==void 0&&(t._alwaysShowResizeHandle=t.alwaysShowResizeHandle);let r=(d=t.columnOpts)==null?void 0:d.breakpoints,o=t;if(o.oneColumnModeDomSort&&(delete o.oneColumnModeDomSort,console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")),o.oneColumnSize||o.disableOneColumnMode===!1){let g=o.oneColumnSize||768;delete o.oneColumnSize,delete o.disableOneColumnMode,t.columnOpts=t.columnOpts||{},r=t.columnOpts.breakpoints=t.columnOpts.breakpoints||[];let y=r.find(_=>_.c===1);y?y.w=g:(y={c:1,w:g},r.push(y,{c:12,w:g+1}))}let s=t.columnOpts;s&&(!s.columnWidth&&!((p=s.breakpoints)!=null&&p.length)?(delete t.columnOpts,r=void 0):s.columnMax=s.columnMax||12),(r==null?void 0:r.length)>1&&r.sort((g,y)=>(y.w||0)-(g.w||0));let a=ae(O({},E.cloneDeep(Ve)),{column:E.toNumber(e.getAttribute("gs-column"))||Ve.column,minRow:i||E.toNumber(e.getAttribute("gs-min-row"))||Ve.minRow,maxRow:i||E.toNumber(e.getAttribute("gs-max-row"))||Ve.maxRow,staticGrid:E.toBool(e.getAttribute("gs-static"))||Ve.staticGrid,sizeToContent:E.toBool(e.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(t.handleClass?"."+t.handleClass:t.handle?t.handle:"")||Ve.draggable.handle},removableOptions:{accept:t.itemClass||Ve.removableOptions.accept,decline:Ve.removableOptions.decline}});e.getAttribute("gs-animate")&&(a.animate=E.toBool(e.getAttribute("gs-animate"))),t=E.defaults(t,a),this._initMargin(),this.checkDynamicColumn(),this.el.classList.add("gs-"+t.column),t.rtl==="auto"&&(t.rtl=e.style.direction==="rtl"),t.rtl&&this.el.classList.add("grid-stack-rtl");let l=this.el.closest("."+Ve.itemClass),c=l==null?void 0:l.gridstackNode;c&&(c.subGrid=this,this.parentGridNode=c,this.el.classList.add("grid-stack-nested"),c.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=t.cellHeight==="auto",this._isAutoCellHeight||t.cellHeight==="initial"?this.cellHeight(void 0,!1):(typeof t.cellHeight=="number"&&t.cellHeightUnit&&t.cellHeightUnit!==Ve.cellHeightUnit&&(t.cellHeight=t.cellHeight+t.cellHeightUnit,delete t.cellHeightUnit),this.cellHeight(t.cellHeight,!1)),t.alwaysShowResizeHandle==="mobile"&&(t.alwaysShowResizeHandle=Ne),this._styleSheetClass="gs-id-"+on._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();let u=t.engineClass||n.engineClass||on;if(this.engine=new u({column:this.getColumn(),float:t.float,maxRow:t.maxRow,onChange:g=>{let y=0;this.engine.nodes.forEach(_=>{y=Math.max(y,_.y+_.h)}),g.forEach(_=>{let T=_.el;T&&(_._removeDOM?(T&&T.remove(),delete _._removeDOM):this._writePosAttr(T,_))}),this._updateStyles(!1,y)}}),this._updateStyles(!1,0),t.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(g=>this._prepareElement(g)),delete this.engine._loading,this.batchUpdate(!1)),t.children){let g=t.children;delete t.children,g.length&&this.load(g)}this.setAnimation(),t.subGridDynamic&&!$.pauseDrag&&($.pauseDrag=!0),((v=t.draggable)==null?void 0:v.pause)!==void 0&&($.pauseDrag=t.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}addWidget(e){if(typeof e=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(e.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(e);let t,i=e;if(i.grid=this,i!=null&&i.el?t=i.el:n.addRemoveCB?t=n.addRemoveCB(this.el,e,!0,!1):t=E.createWidgetDivs(this.opts.itemClass,i),!t)return;if(i=t.gridstackNode,i&&t.parentElement===this.el&&this.engine.nodes.find(o=>o._id===i._id))return t;let r=this._readAttr(t);return E.defaults(e,r),this.engine.prepareNode(e),this.el.appendChild(t),this.makeWidget(t,e),t}makeSubGrid(e,t,i,r=!0){var v,g,y;let o=e.gridstackNode;if(o||(o=this.makeWidget(e).gridstackNode),(v=o.subGrid)!=null&&v.el)return o.subGrid;let s,a=this;for(;a&&!s;)s=(g=a.opts)==null?void 0:g.subGridOpts,a=(y=a.parentGridNode)==null?void 0:y.grid;t=E.cloneDeep(O(O(ae(O({},this.opts),{id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0}),s||{}),t||o.subGridOpts||{})),o.subGridOpts=t;let l;t.column==="auto"&&(l=!0,t.column=Math.max(o.w||1,(i==null?void 0:i.w)||1),delete t.columnOpts);let c=o.el.querySelector(".grid-stack-item-content"),u,d;if(r&&(this._removeDD(o.el),d=ae(O({},o),{x:0,y:0}),E.removeInternalForSave(d),delete d.subGridOpts,o.content&&(d.content=o.content,delete o.content),n.addRemoveCB?u=n.addRemoveCB(this.el,d,!0,!1):(u=E.createDiv(["grid-stack-item"]),u.appendChild(c),c=E.createDiv(["grid-stack-item-content"],o.el)),this._prepareDragDropByNode(o)),i){let _=l?t.column:o.w,T=o.h+i.h,w=o.el.style;w.transition="none",this.update(o.el,{w:_,h:T}),setTimeout(()=>w.transition=null)}let p=o.subGrid=n.addGrid(c,t);return i!=null&&i._moving&&(p._isTemp=!0),l&&(p._autoColumn=!0),r&&p.makeWidget(u,d),i&&(i._moving?window.setTimeout(()=>E.simulateMouseEvent(i._event,"mouseenter",p.el),0):p.makeWidget(o.el,o)),this.resizeToContentCheck(!1,o),p}removeAsSubGrid(e){var i;let t=(i=this.parentGridNode)==null?void 0:i.grid;t&&(t.batchUpdate(),t.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(r=>{r.x+=this.parentGridNode.x,r.y+=this.parentGridNode.y,t.makeWidget(r.el,r)}),t.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,e&&window.setTimeout(()=>E.simulateMouseEvent(e._event,"mouseenter",t.el),0))}save(e=!0,t=!1,i=n.saveCB){let r=this.engine.save(e,i);if(r.forEach(o=>{var s;if(e&&o.el&&!o.subGrid&&!i){let a=o.el.querySelector(".grid-stack-item-content");o.content=a==null?void 0:a.innerHTML,o.content||delete o.content}else if(!e&&!i&&delete o.content,(s=o.subGrid)!=null&&s.el){let a=o.subGrid.save(e,t,i);o.subGridOpts=t?a:{children:a},delete o.subGrid}delete o.el}),t){let o=E.cloneDeep(this.opts);o.marginBottom===o.marginTop&&o.marginRight===o.marginLeft&&o.marginTop===o.marginRight&&(o.margin=o.marginTop,delete o.marginTop,delete o.marginRight,delete o.marginBottom,delete o.marginLeft),o.rtl===(this.el.style.direction==="rtl")&&(o.rtl="auto"),this._isAutoCellHeight&&(o.cellHeight="auto"),this._autoColumn&&(o.column="auto");let s=o._alwaysShowResizeHandle;return delete o._alwaysShowResizeHandle,s!==void 0?o.alwaysShowResizeHandle=s:delete o.alwaysShowResizeHandle,E.removeInternalAndSame(o,Ve),o.children=r,o}return r}load(e,t=n.addRemoveCB||!0){var c;e=E.cloneDeep(e);let i=this.getColumn();e.forEach(u=>{u.w=u.w||1,u.h=u.h||1}),e=E.sort(e),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let r=0;e.forEach(u=>{r=Math.max(r,(u.x||0)+u.w)}),r>this.engine.defaultColumn&&(this.engine.defaultColumn=r),r>i&&this.engine.cacheLayout(e,r,!0);let o=n.addRemoveCB;typeof t=="function"&&(n.addRemoveCB=t);let s=[];this.batchUpdate();let a=!this.engine.nodes.length;a&&this.setAnimation(!1),!a&&t&&[...this.engine.nodes].forEach(d=>{if(!d.id)return;E.find(e,d.id)||(n.addRemoveCB&&n.addRemoveCB(this.el,d,!1,!1),s.push(d),this.removeWidget(d.el,!0,!1))}),this.engine._loading=!0;let l=[];return this.engine.nodes=this.engine.nodes.filter(u=>E.find(e,u.id)?(l.push(u),!1):!0),e.forEach(u=>{var p;let d=E.find(l,u.id);if(d){if(E.shouldSizeToContent(d)&&(u.h=d.h),this.engine.nodeBoundFix(u),(u.autoPosition||u.x===void 0||u.y===void 0)&&(u.w=u.w||d.w,u.h=u.h||d.h,this.engine.findEmptyPosition(u)),this.engine.nodes.push(d),E.samePos(d,u)&&this.engine.nodes.length>1&&(this.moveNode(d,ae(O({},u),{forceCollide:!0})),E.copyPos(u,d)),this.update(d.el,u),(p=u.subGridOpts)!=null&&p.children){let v=d.el.querySelector(".grid-stack");v&&v.gridstack&&v.gridstack.load(u.subGridOpts.children)}}else t&&this.addWidget(u)}),delete this.engine._loading,this.engine.removedNodes=s,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,o?n.addRemoveCB=o:delete n.addRemoveCB,a&&((c=this.opts)!=null&&c.animate)&&this.setAnimation(this.opts.animate,!0),this}batchUpdate(e=!0){return this.engine.batchUpdate(e),e||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(e=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!e||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;let t=this.el.querySelector("."+this.opts.itemClass);if(t){let r=E.toNumber(t.getAttribute("gs-h"))||1;return Math.round(t.offsetHeight/r)}let i=parseInt(this.el.getAttribute("gs-current-row"));return i?Math.round(this.el.getBoundingClientRect().height/i):this.opts.cellHeight}cellHeight(e,t=!0){if(t&&e!==void 0&&this._isAutoCellHeight!==(e==="auto")&&(this._isAutoCellHeight=e==="auto",this._updateResizeEvent()),(e==="initial"||e==="auto")&&(e=void 0),e===void 0){let r=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;e=this.cellWidth()+r}let i=E.parseHeight(e);return this.opts.cellHeightUnit===i.unit&&this.opts.cellHeight===i.h?this:(this.opts.cellHeightUnit=i.unit,this.opts.cellHeight=i.h,this.resizeToContentCheck(),t&&this._updateStyles(!0),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(e=!1){var t;return e&&((t=this.opts.columnOpts)!=null&&t.breakpointForWindow)?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var o,s;let e=this.opts.columnOpts;if(!e||!e.columnWidth&&!((o=e.breakpoints)!=null&&o.length))return!1;let t=this.getColumn(),i=t,r=this._widthOrContainer(!0);if(e.columnWidth)i=Math.min(Math.round(r/e.columnWidth)||1,e.columnMax);else{i=e.columnMax;let a=0;for(;al.c===i);return this.column(i,(a==null?void 0:a.layout)||e.layout),!0}return!1}compact(e="compact",t=!0){return this.engine.compact(e,t),this._triggerChangeEvent(),this}column(e,t="moveScale"){if(!e||e<1||this.opts.column===e)return this;let i=this.getColumn();return this.opts.column=e,this.engine?(this.engine.column=e,this.el.classList.remove("gs-"+i),this.el.classList.add("gs-"+e),this.engine.columnChanged(i,e,t),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):this}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(e=>e.matches("."+this.opts.itemClass)&&!e.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(e=!0){var t,i;if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),e?this.el.parentNode.removeChild(this.el):(this.removeAll(e),this.el.classList.remove(this._styleSheetClass),this.el.removeAttribute("gs-current-row")),this._removeStylesheet(),(t=this.parentGridNode)==null||delete t.subGrid,delete this.parentGridNode,delete this.opts,(i=this._placeholder)==null||delete i.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(e){return this.opts.float!==e&&(this.opts.float=this.engine.float=e,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(e,t=!1){let i=this.el.getBoundingClientRect(),r;t?r={top:i.top+document.documentElement.scrollTop,left:i.left}:r={top:this.el.offsetTop,left:this.el.offsetLeft};let o=e.left-r.left,s=e.top-r.top,a=i.width/this.getColumn(),l=i.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(o/a),y:Math.floor(s/l)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(e,t,i,r){return this.engine.isAreaEmpty(e,t,i,r)}makeWidget(e,t){let i=n.getElement(e);if(!i)return;i.parentElement||this.el.appendChild(i),this._prepareElement(i,!0,t);let r=i.gridstackNode;this._updateContainerHeight(),r.subGridOpts&&this.makeSubGrid(i,r.subGridOpts,void 0,!1);let o;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(o=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),o&&delete this._ignoreLayoutsNodeChange,i}on(e,t){return e.indexOf(" ")!==-1?(e.split(" ").forEach(r=>this.on(r,t)),this):(e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable"?(e==="enable"||e==="disable"?this._gsEventHandler[e]=r=>t(r):this._gsEventHandler[e]=r=>{r.detail&&t(r,r.detail)},this.el.addEventListener(e,this._gsEventHandler[e])):e==="drag"||e==="dragstart"||e==="dragstop"||e==="resizestart"||e==="resize"||e==="resizestop"||e==="dropped"||e==="resizecontent"?this._gsEventHandler[e]=t:console.error("GridStack.on("+e+") event not supported"),this)}off(e){return e.indexOf(" ")!==-1?(e.split(" ").forEach(i=>this.off(i)),this):((e==="change"||e==="added"||e==="removed"||e==="enable"||e==="disable")&&this._gsEventHandler[e]&&this.el.removeEventListener(e,this._gsEventHandler[e]),delete this._gsEventHandler[e],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(e=>this.off(e)),this}removeWidget(e,t=!0,i=!0){return e?(n.getElements(e).forEach(r=>{if(r.parentElement&&r.parentElement!==this.el)return;let o=r.gridstackNode;o||(o=this.engine.nodes.find(s=>r===s.el)),o&&(t&&n.addRemoveCB&&n.addRemoveCB(this.el,o,!1,!1),delete r.gridstackNode,this._removeDD(r),this.engine.removeNode(o,t,i),t&&r.parentElement&&r.remove())}),i&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(e=!0,t=!0){return this.engine.nodes.forEach(i=>{e&&n.addRemoveCB&&n.addRemoveCB(this.el,i,!1,!1),delete i.el.gridstackNode,this.opts.staticGrid||this._removeDD(i.el)}),this.engine.removeAll(e,t),t&&this._triggerRemoveEvent(),this}setAnimation(e=this.opts.animate,t){return t?setTimeout(()=>{this.opts&&this.setAnimation(e)}):e?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(e,t=!0,i=!0){return!!this.opts.staticGrid===e?this:(e?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(r=>{this._prepareDragDropByNode(r),r.subGrid&&i&&r.subGrid.setStatic(e,t,i)}),t&&this._setStaticClass(),this)}update(e,t){if(arguments.length>2){console.warn("gridstack.ts: `update(el, x, y, w, h)` is deprecated. Use `update(el, {x, w, content, ...})`. It will be removed soon");let i=arguments,r=1;return t={x:i[r++],y:i[r++],w:i[r++],h:i[r++]},this.update(e,t)}return n.getElements(e).forEach(i=>{var u;let r=i==null?void 0:i.gridstackNode;if(!r)return;let o=E.cloneDeep(t);this.engine.nodeBoundFix(o),delete o.autoPosition;let s=["x","y","w","h"],a;if(s.some(d=>o[d]!==void 0&&o[d]!==r[d])&&(a={},s.forEach(d=>{a[d]=o[d]!==void 0?o[d]:r[d],delete o[d]})),!a&&(o.minW||o.minH||o.maxW||o.maxH)&&(a={}),o.content!==void 0){let d=i.querySelector(".grid-stack-item-content");d&&d.textContent!==o.content&&(r.content=o.content,n.renderCB(d,o),(u=r.subGrid)!=null&&u.el&&(d.appendChild(r.subGrid.el),r.subGrid.opts.styleInHead||r.subGrid._updateStyles(!0))),delete o.content}let l=!1,c=!1;for(let d in o)d[0]!=="_"&&r[d]!==o[d]&&(r[d]=o[d],l=!0,c=c||!this.opts.staticGrid&&(d==="noResize"||d==="noMove"||d==="locked"));if(E.sanitizeMinMax(r),a){let d=a.w!==void 0&&a.w!==r.w;this.moveNode(r,a),d&&r.subGrid?r.subGrid.onResize(this.hasAnimationCSS()?r.w:void 0):this.resizeToContentCheck(d,r),delete r._orig}(a||l)&&this._writeAttr(i,r),c&&this._prepareDragDropByNode(r)}),this}moveNode(e,t){let i=e._updating;i||this.engine.cleanNodes().beginUpdate(e),this.engine.moveNode(e,t),this._updateContainerHeight(),i||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(e){var p,v;if(!e||(e.classList.remove("size-to-content-max"),!e.clientHeight))return;let t=e.gridstackNode;if(!t)return;let i=t.grid;if(!i||e.parentElement!==i.el)return;let r=i.getCellHeight(!0);if(!r)return;let o=t.h?t.h*r:e.clientHeight,s;if(t.resizeToContentParent&&(s=e.querySelector(t.resizeToContentParent)),s||(s=e.querySelector(n.resizeToContentParent)),!s)return;let a=e.clientHeight-s.clientHeight,l=t.h?t.h*r-a:s.clientHeight,c;if(t.subGrid){c=t.subGrid.getRow()*t.subGrid.getCellHeight(!0);let g=t.subGrid.el.getBoundingClientRect(),y=t.subGrid.el.parentElement.getBoundingClientRect();c+=g.top-y.top}else{if((v=(p=t.subGridOpts)==null?void 0:p.children)!=null&&v.length)return;{let g=s.firstElementChild;if(!g){console.error(`Error: GridStack.resizeToContent() widget id:${t.id} '${n.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}c=g.getBoundingClientRect().height||l}}if(l===c)return;o+=c-l;let u=Math.ceil(o/r),d=Number.isInteger(t.sizeToContent)?t.sizeToContent:0;d&&u>d&&(u=d,e.classList.add("size-to-content-max")),t.minH&&ut.maxH&&(u=t.maxH),u!==t.h&&(i._ignoreLayoutsNodeChange=!0,i.moveNode(t,{h:u}),delete i._ignoreLayoutsNodeChange)}resizeToContentCBCheck(e){n.resizeToContentCB?n.resizeToContentCB(e):this.resizeToContent(e)}rotate(e,t){return n.getElements(e).forEach(i=>{let r=i.gridstackNode;if(!E.canBeRotated(r))return;let o={w:r.h,h:r.w,minH:r.minW,minW:r.minH,maxH:r.maxW,maxW:r.maxH};if(t){let a=t.left>0?Math.floor(t.left/this.cellWidth()):0,l=t.top>0?Math.floor(t.top/this.opts.cellHeight):0;o.x=r.x+a-(r.h-(l+1)),o.y=r.y+l-a}Object.keys(o).forEach(a=>{o[a]===void 0&&delete o[a]});let s=r._orig;this.update(i,o),r._orig=s}),this}margin(e){if(!(typeof e=="string"&&e.split(" ").length>1)){let i=E.parseHeight(e);if(this.opts.marginUnit===i.unit&&this.opts.margin===i.h)return}return this.opts.margin=e,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this._updateStyles(!0),this}getMargin(){return this.opts.margin}willItFit(e){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");let t=arguments,i=0,r={x:t[i++],y:t[i++],w:t[i++],h:t[i++],autoPosition:t[i++]};return this.willItFit(r)}return this.engine.willItFit(e)}_triggerChangeEvent(){if(this.engine.batchMode)return this;let e=this.engine.getDirtyNodes(!0);return e&&e.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(e),this._triggerEvent("change",e)),this.engine.saveInitial(),this}_triggerAddEvent(){var e;if(this.engine.batchMode)return this;if((e=this.engine.addedNodes)!=null&&e.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(i=>{delete i._dirty});let t=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",t)}return this}_triggerRemoveEvent(){var e;if(this.engine.batchMode)return this;if((e=this.engine.removedNodes)!=null&&e.length){let t=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",t)}return this}_triggerEvent(e,t){let i=t?new CustomEvent(e,{bubbles:!1,detail:t}):new Event(e);return this.el.dispatchEvent(i),this}_removeStylesheet(){if(this._styles){let e=this.opts.styleInHead?void 0:this.el.parentNode;E.removeStylesheet(this._styleSheetClass,e),delete this._styles}return this}_updateStyles(e=!1,t){if(e&&this._removeStylesheet(),t===void 0&&(t=this.getRow()),this._updateContainerHeight(),this.opts.cellHeight===0)return this;let i=this.opts.cellHeight,r=this.opts.cellHeightUnit,o=`.${this._styleSheetClass} > .${this.opts.itemClass}`;if(!this._styles){let s=this.opts.styleInHead?void 0:this.el.parentNode;if(this._styles=E.createStylesheet(this._styleSheetClass,s,{nonce:this.opts.nonce}),!this._styles)return this;this._styles._max=0,E.addCSSRule(this._styles,o,`height: ${i}${r}`);let a=this.opts.marginTop+this.opts.marginUnit,l=this.opts.marginBottom+this.opts.marginUnit,c=this.opts.marginRight+this.opts.marginUnit,u=this.opts.marginLeft+this.opts.marginUnit,d=`${o} > .grid-stack-item-content`,p=`.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;E.addCSSRule(this._styles,d,`top: ${a}; right: ${c}; bottom: ${l}; left: ${u};`),E.addCSSRule(this._styles,p,`top: ${a}; right: ${c}; bottom: ${l}; left: ${u};`),E.addCSSRule(this._styles,`${o} > .ui-resizable-n`,`top: ${a};`),E.addCSSRule(this._styles,`${o} > .ui-resizable-s`,`bottom: ${l}`),E.addCSSRule(this._styles,`${o} > .ui-resizable-ne`,`right: ${c}; top: ${a}`),E.addCSSRule(this._styles,`${o} > .ui-resizable-e`,`right: ${c}`),E.addCSSRule(this._styles,`${o} > .ui-resizable-se`,`right: ${c}; bottom: ${l}`),E.addCSSRule(this._styles,`${o} > .ui-resizable-nw`,`left: ${u}; top: ${a}`),E.addCSSRule(this._styles,`${o} > .ui-resizable-w`,`left: ${u}`),E.addCSSRule(this._styles,`${o} > .ui-resizable-sw`,`left: ${u}; bottom: ${l}`)}if(t=t||this._styles._max,t>this._styles._max){let s=a=>i*a+r;for(let a=this._styles._max+1;a<=t;a++)E.addCSSRule(this._styles,`${o}[gs-y="${a}"]`,`top: ${s(a)}`),E.addCSSRule(this._styles,`${o}[gs-h="${a+1}"]`,`height: ${s(a+1)}`);this._styles._max=t}return this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;let e=this.parentGridNode,t=this.getRow()+this._extraDragRow,i=this.opts.cellHeight,r=this.opts.cellHeightUnit;if(!i)return this;if(!e){let o=E.parseHeight(getComputedStyle(this.el).minHeight);if(o.h>0&&o.unit===r){let s=Math.floor(o.h/i);t1?e.setAttribute("gs-w",String(t.w)):e.removeAttribute("gs-w"),t.h>1?e.setAttribute("gs-h",String(t.h)):e.removeAttribute("gs-h"),this}_writeAttr(e,t){if(!t)return this;this._writePosAttr(e,t);let i={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(let r in i)t[r]?e.setAttribute(i[r],String(t[r])):e.removeAttribute(i[r]);return this}_readAttr(e,t=!0){let i={};i.x=E.toNumber(e.getAttribute("gs-x")),i.y=E.toNumber(e.getAttribute("gs-y")),i.w=E.toNumber(e.getAttribute("gs-w")),i.h=E.toNumber(e.getAttribute("gs-h")),i.autoPosition=E.toBool(e.getAttribute("gs-auto-position")),i.noResize=E.toBool(e.getAttribute("gs-no-resize")),i.noMove=E.toBool(e.getAttribute("gs-no-move")),i.locked=E.toBool(e.getAttribute("gs-locked")),i.sizeToContent=E.toBool(e.getAttribute("gs-size-to-content")),i.id=e.getAttribute("gs-id"),i.maxW=E.toNumber(e.getAttribute("gs-max-w")),i.minW=E.toNumber(e.getAttribute("gs-min-w")),i.maxH=E.toNumber(e.getAttribute("gs-max-h")),i.minH=E.toNumber(e.getAttribute("gs-min-h")),t&&(i.w===1&&e.removeAttribute("gs-w"),i.h===1&&e.removeAttribute("gs-h"),i.maxW&&e.removeAttribute("gs-max-w"),i.minW&&e.removeAttribute("gs-min-w"),i.maxH&&e.removeAttribute("gs-max-h"),i.minH&&e.removeAttribute("gs-min-h"));for(let r in i){if(!i.hasOwnProperty(r))return;!i[r]&&i[r]!==0&&delete i[r]}return i}_setStaticClass(){let e=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...e),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...e),this.el.removeAttribute("gs-static")),this}onResize(e=(t=>(t=this.el)==null?void 0:t.clientWidth)()){if(!e||this.prevWidth===e)return;this.prevWidth=e,this.batchUpdate();let i=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),i=!0):i=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(r=>{r.subGrid&&r.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(i),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(e=!1,t=void 0){if(this.engine){if(e&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,t),this.animationDelay);if(t)E.shouldSizeToContent(t)&&this.resizeToContentCBCheck(t.el);else if(this.engine.nodes.some(i=>E.shouldSizeToContent(i))){let i=[...this.engine.nodes];this.batchUpdate(),i.forEach(r=>{E.shouldSizeToContent(r)&&this.resizeToContentCBCheck(r.el)}),this.batchUpdate(!1)}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,t?[t]:this.engine.nodes)}}_updateResizeEvent(e=!1){let t=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(i=>i.sizeToContent));return!e&&t&&!this.resizeObserver?(this._sizeThrottle=E.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(e||!t)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(e=".grid-stack-item"){return E.getElement(e)}static getElements(e=".grid-stack-item"){return E.getElements(e)}static getGridElement(e){return n.getElement(e)}static getGridElements(e){return E.getElements(e)}_initMargin(){let e,t=0,i=[];return typeof this.opts.margin=="string"&&(i=this.opts.margin.split(" ")),i.length===2?(this.opts.marginTop=this.opts.marginBottom=i[0],this.opts.marginLeft=this.opts.marginRight=i[1]):i.length===4?(this.opts.marginTop=i[0],this.opts.marginRight=i[1],this.opts.marginBottom=i[2],this.opts.marginLeft=i[3]):(e=E.parseHeight(this.opts.margin),this.opts.marginUnit=e.unit,t=this.opts.margin=e.h),this.opts.marginTop===void 0?this.opts.marginTop=t:(e=E.parseHeight(this.opts.marginTop),this.opts.marginTop=e.h,delete this.opts.margin),this.opts.marginBottom===void 0?this.opts.marginBottom=t:(e=E.parseHeight(this.opts.marginBottom),this.opts.marginBottom=e.h,delete this.opts.margin),this.opts.marginRight===void 0?this.opts.marginRight=t:(e=E.parseHeight(this.opts.marginRight),this.opts.marginRight=e.h,delete this.opts.margin),this.opts.marginLeft===void 0?this.opts.marginLeft=t:(e=E.parseHeight(this.opts.marginLeft),this.opts.marginLeft=e.h,delete this.opts.margin),this.opts.marginUnit=e.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop),this}static getDD(){return Re}static setupDragIn(e,t,i,r=document){(t==null?void 0:t.pause)!==void 0&&($.pauseDrag=t.pause),t=O({appendTo:"body",helper:"clone"},t||{}),(typeof e=="string"?E.getElements(e,r):e).forEach((s,a)=>{Re.isDraggable(s)||Re.dragIn(s,t),i!=null&&i[a]&&(s.gridstackNode=i[a])})}movable(e,t){return this.opts.staticGrid?this:(n.getElements(e).forEach(i=>{let r=i.gridstackNode;r&&(t?delete r.noMove:r.noMove=!0,this._prepareDragDropByNode(r))}),this)}resizable(e,t){return this.opts.staticGrid?this:(n.getElements(e).forEach(i=>{let r=i.gridstackNode;r&&(t?delete r.noResize:r.noResize=!0,this._prepareDragDropByNode(r))}),this)}disable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!1,e),this.enableResize(!1,e),this._triggerEvent("disable"),this}enable(e=!0){if(!this.opts.staticGrid)return this.enableMove(!0,e),this.enableResize(!0,e),this._triggerEvent("enable"),this}enableMove(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(i=>{this._prepareDragDropByNode(i),i.subGrid&&t&&i.subGrid.enableMove(e,t)}),this)}enableResize(e,t=!0){return this.opts.staticGrid?this:(e?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(i=>{this._prepareDragDropByNode(i),i.subGrid&&t&&i.subGrid.enableResize(e,t)}),this)}cancelDrag(){var t;let e=(t=this._placeholder)==null?void 0:t.gridstackNode;e&&(e._isExternal?(e._isAboutToRemove=!0,this.engine.removeNode(e)):e._isAboutToRemove&&n._itemRemoving(e.el,!1),this.engine.restoreInitial())}_removeDD(e){return Re.draggable(e,"destroy").resizable(e,"destroy"),e.gridstackNode&&delete e.gridstackNode._initDD,delete e.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return Re.droppable(this.el,"destroy"),this;let e,t,i=(r,o,s)=>{var p;s=s||o;let a=s.gridstackNode;if(!a)return;if(!((p=a.grid)!=null&&p.el)){s.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;let v=s.getBoundingClientRect();s.style.left=v.x+(this.dragTransform.xScale-1)*(r.clientX-v.x)/this.dragTransform.xScale+"px",s.style.top=v.y+(this.dragTransform.yScale-1)*(r.clientY-v.y)/this.dragTransform.yScale+"px",s.style.transformOrigin="0px 0px"}let{top:l,left:c}=s.getBoundingClientRect(),u=this.el.getBoundingClientRect();c-=u.left,l-=u.top;let d={position:{top:l*this.dragTransform.xScale,left:c*this.dragTransform.yScale}};if(a._temporaryRemoved){if(a.x=Math.max(0,Math.round(c/t)),a.y=Math.max(0,Math.round(l/e)),delete a.autoPosition,this.engine.nodeBoundFix(a),!this.engine.willItFit(a)){if(a.autoPosition=!0,!this.engine.willItFit(a)){Re.off(o,"drag");return}a._willFitPos&&(E.copyPos(a,a._willFitPos),delete a._willFitPos)}this._onStartMoving(s,r,d,a,t,e)}else this._dragOrResize(s,r,d,a,t,e)};return Re.droppable(this.el,{accept:r=>{let o=r.gridstackNode||this._readAttr(r,!1);if((o==null?void 0:o.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;let s=!0;if(typeof this.opts.acceptWidgets=="function")s=this.opts.acceptWidgets(r);else{let a=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;s=r.matches(a)}if(s&&o&&this.opts.maxRow){let a={w:o.w,h:o.h,minW:o.minW,minH:o.minH};s=this.engine.willItFit(a)}return s}}).on(this.el,"dropover",(r,o,s)=>{let a=(s==null?void 0:s.gridstackNode)||o.gridstackNode;if((a==null?void 0:a.grid)===this&&!a._temporaryRemoved)return!1;if(a!=null&&a.grid&&a.grid!==this&&!a._temporaryRemoved&&a.grid._leave(o,s),s=s||o,t=this.cellWidth(),e=this.getCellHeight(!0),!a){let u=s.getAttribute("data-gs-widget")||s.getAttribute("gridstacknode");if(u){try{a=JSON.parse(u)}catch(d){console.error("Gridstack dropover: Bad JSON format: ",u)}s.removeAttribute("data-gs-widget"),s.removeAttribute("gridstacknode")}a||(a=this._readAttr(s))}a.grid||(a.el||(a=O({},a)),a._isExternal=!0,s.gridstackNode=a);let l=a.w||Math.round(s.offsetWidth/t)||1,c=a.h||Math.round(s.offsetHeight/e)||1;return a.grid&&a.grid!==this?(o._gridstackNodeOrig||(o._gridstackNodeOrig=a),o.gridstackNode=a=ae(O({},a),{w:l,h:c,grid:this}),delete a.x,delete a.y,this.engine.cleanupNode(a).nodeBoundFix(a),a._initDD=a._isExternal=a._temporaryRemoved=!0):(a.w=l,a.h=c,a._temporaryRemoved=!0),n._itemRemoving(a.el,!1),Re.on(o,"drag",i),i(r,o,s),!1}).on(this.el,"dropout",(r,o,s)=>{let a=(s==null?void 0:s.gridstackNode)||o.gridstackNode;return a&&(!a.grid||a.grid===this)&&(this._leave(o,s),this._isTemp&&this.removeAsSubGrid(a)),!1}).on(this.el,"drop",(r,o,s)=>{var v,g,y;let a=(s==null?void 0:s.gridstackNode)||o.gridstackNode;if((a==null?void 0:a.grid)===this&&!a._isExternal)return!1;let l=!!this.placeholder.parentElement,c=o!==s;this.placeholder.remove(),delete this.placeholder.gridstackNode;let u=l&&this.opts.animate;u&&this.setAnimation(!1);let d=o._gridstackNodeOrig;if(delete o._gridstackNodeOrig,l&&(d!=null&&d.grid)&&d.grid!==this){let _=d.grid;_.engine.removeNodeFromLayoutCache(d),_.engine.removedNodes.push(d),_._triggerRemoveEvent()._triggerChangeEvent(),_.parentGridNode&&!_.engine.nodes.length&&_.opts.subGridDynamic&&_.removeAsSubGrid()}if(!a||(l&&(this.engine.cleanupNode(a),a.grid=this),(v=a.grid)==null||delete v._isTemp,Re.off(o,"drag"),s!==o?(s.remove(),o=s):o.remove(),this._removeDD(o),!l))return!1;let p=(y=(g=a.subGrid)==null?void 0:g.el)==null?void 0:y.gridstack;return E.copyPos(a,this._readAttr(this.placeholder)),E.removePositioningStyles(o),c&&(a.content||a.subGridOpts||n.addRemoveCB)?(delete a.el,o=this.addWidget(a)):(this._prepareElement(o,!0,a),this.el.appendChild(o),this.resizeToContentCheck(!1,a),p&&(p.parentGridNode=a,p.opts.styleInHead||p._updateStyles(!0)),this._updateContainerHeight()),this.engine.addedNodes.push(a),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped(ae(O({},r),{type:"dropped"}),d&&d.grid?d:void 0,a),u&&this.setAnimation(this.opts.animate,!0),!1}),this}static _itemRemoving(e,t){if(!e)return;let i=e?e.gridstackNode:void 0;!(i!=null&&i.grid)||e.classList.contains(i.grid.opts.removableOptions.decline)||(t?i._isAboutToRemove=!0:delete i._isAboutToRemove,t?e.classList.add("grid-stack-item-removing"):e.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;let e=document.querySelector(this.opts.removable);return e?(!this.opts.staticGrid&&!Re.isDroppable(e)&&Re.droppable(e,this.opts.removableOptions).on(e,"dropover",(t,i)=>n._itemRemoving(i,!0)).on(e,"dropout",(t,i)=>n._itemRemoving(i,!1)),this):this}_prepareDragDropByNode(e){let t=e.el,i=e.noMove||this.opts.disableDrag,r=e.noResize||this.opts.disableResize;if(this.opts.staticGrid||i&&r)return e._initDD&&(this._removeDD(t),delete e._initDD),t.classList.add("ui-draggable-disabled","ui-resizable-disabled"),this;if(!e._initDD){let o,s,a=(u,d)=>{this._gsEventHandler[u.type]&&this._gsEventHandler[u.type](u,u.target),o=this.cellWidth(),s=this.getCellHeight(!0),this._onStartMoving(t,u,d,e,o,s)},l=(u,d)=>{this._dragOrResize(t,u,d,e,o,s)},c=u=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete e._moving,delete e._event,delete e._lastTried;let d=e.w!==e._orig.w,p=u.target;if(!(!p.gridstackNode||p.gridstackNode.grid!==this)){if(e.el=p,e._isAboutToRemove){let v=t.gridstackNode.grid;v._gsEventHandler[u.type]&&v._gsEventHandler[u.type](u,p),v.engine.nodes.push(e),v.removeWidget(t,!0,!0)}else E.removePositioningStyles(p),e._temporaryRemoved?(E.copyPos(e,e._orig),this._writePosAttr(p,e),this.engine.addNode(e)):this._writePosAttr(p,e),this._gsEventHandler[u.type]&&this._gsEventHandler[u.type](u,p);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),u.type==="resizestop"&&(Number.isInteger(e.sizeToContent)&&(e.sizeToContent=e.h),this.resizeToContentCheck(d,e))}};Re.draggable(t,{start:a,stop:c,drag:l}).resizable(t,{start:a,stop:c,resize:l}),e._initDD=!0}return Re.draggable(t,i?"disable":"enable").resizable(t,r?"disable":"enable"),this}_onStartMoving(e,t,i,r,o,s){var a;if(this.engine.cleanNodes().beginUpdate(r),this._writePosAttr(this.placeholder,r),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=r,(a=r.grid)!=null&&a.el)this.dragTransform=E.getValuesFromTransformedElement(e);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){let l=this.placeholder.closest(".grid-stack");this.dragTransform=E.getValuesFromTransformedElement(l)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(r.el=this.placeholder,r._lastUiPosition=i.position,r._prevYPix=i.position.top,r._moving=t.type==="dragstart",delete r._lastTried,t.type==="dropover"&&r._temporaryRemoved&&(this.engine.addNode(r),r._moving=!0),this.engine.cacheRects(o,s,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),t.type==="resizestart"){let l=this.getColumn()-r.x,c=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-r.y;Re.resizable(e,"option","minWidth",o*Math.min(r.minW||1,l)).resizable(e,"option","minHeight",s*Math.min(r.minH||1,c)).resizable(e,"option","maxWidth",o*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,l)).resizable(e,"option","maxWidthMoveLeft",o*Math.min(r.maxW||Number.MAX_SAFE_INTEGER,r.x+r.w)).resizable(e,"option","maxHeight",s*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,c)).resizable(e,"option","maxHeightMoveUp",s*Math.min(r.maxH||Number.MAX_SAFE_INTEGER,r.y+r.h))}}_dragOrResize(e,t,i,r,o,s){let a=O({},r._orig),l,c=this.opts.marginLeft,u=this.opts.marginRight,d=this.opts.marginTop,p=this.opts.marginBottom,v=Math.round(s*.1),g=Math.round(o*.1);if(c=Math.min(c,g),u=Math.min(u,g),d=Math.min(d,v),p=Math.min(p,v),t.type==="drag"){if(r._temporaryRemoved)return;let _=i.position.top-r._prevYPix;r._prevYPix=i.position.top,this.opts.draggable.scroll!==!1&&E.updateScrollPosition(e,i.position,_);let T=i.position.left+(i.position.left>r._lastUiPosition.left?-u:c),w=i.position.top+(i.position.top>r._lastUiPosition.top?-p:d);a.x=Math.round(T/o),a.y=Math.round(w/s);let S=this._extraDragRow;if(this.engine.collide(r,a)){let M=this.getRow(),G=Math.max(0,a.y+r.h-M);this.opts.maxRow&&M+G>this.opts.maxRow&&(G=Math.max(0,this.opts.maxRow-M)),this._extraDragRow=G}else this._extraDragRow=0;if(this._extraDragRow!==S&&this._updateContainerHeight(),r.x===a.x&&r.y===a.y)return}else if(t.type==="resize"){if(a.x<0||(E.updateScrollResize(t,e,s),a.w=Math.round((i.size.width-c)/o),a.h=Math.round((i.size.height-d)/s),r.w===a.w&&r.h===a.h)||r._lastTried&&r._lastTried.w===a.w&&r._lastTried.h===a.h)return;let _=i.position.left+c,T=i.position.top+d;a.x=Math.round(_/o),a.y=Math.round(T/s),l=!0}r._event=t,r._lastTried=a;let y={x:i.position.left+c,y:i.position.top+d,w:(i.size?i.size.width:r.w*o)-c-u,h:(i.size?i.size.height:r.h*s)-d-p};if(this.engine.moveNodeCheck(r,ae(O({},a),{cellWidth:o,cellHeight:s,rect:y,resizing:l}))){r._lastUiPosition=i.position,this.engine.cacheRects(o,s,d,u,p,c),delete r._skipDown,l&&r.subGrid&&r.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();let _=t.target;this._writePosAttr(_,r),this._gsEventHandler[t.type]&&this._gsEventHandler[t.type](t,_)}}_leave(e,t){t=t||e;let i=t.gridstackNode;i&&(t.style.transform=t.style.transformOrigin=null,Re.off(e,"drag"),!i._temporaryRemoved&&(i._temporaryRemoved=!0,this.engine.removeNode(i),i.el=i._isExternal&&t?t:e,i._isExternal&&this.engine.cleanupNode(i),this.opts.removable===!0&&n._itemRemoving(e,!0),e._gridstackNodeOrig?(e.gridstackNode=e._gridstackNodeOrig,delete e._gridstackNodeOrig):i._isExternal&&this.engine.restoreInitial()))}commit(){return Dc(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}};Je.renderCB=(n,e)=>{n&&(e!=null&&e.content)&&(n.textContent=e.content)};Je.resizeToContentParent=".grid-stack-item-content";Je.Utils=E;Je.Engine=on;Je.GDRev="11.3.0";function Qg(){let n=document.getElementById("dashboard");n&&n.gridstack.disable()}function Jg(){let n=document.getElementById("dashboard");n&&n.gridstack.enable()}function Zg(n,e){return lt(this,null,function*(){return yield Ln(n,{layout:e})})}function Lc(){if(document.getElementById("dashboard")==null)return;let e=Je.init({cellHeight:100,disableDrag:!0,disableResize:!0,draggable:{handle:".grid-stack-item-content .card-header",appendTo:"body",scroll:!0}}),t=document.getElementById("lock_dashboard");t&&t.addEventListener("click",()=>{Qg()});let i=document.getElementById("unlock_dashboard");i&&i.addEventListener("click",()=>{Jg()});let r=document.getElementById("save_dashboard");r!==null&&r.addEventListener("click",()=>{let o=r.getAttribute("data-url");if(o==null)return;let s=e.save(!1);Zg(o,s).then(a=>{tn(a)?Rt("danger","Error Saving Dashboard Config",a.error).show():location.reload()})})}function Mc(n,e){switch(n){case"images-and-labels":{cs("image.device-image",e),cs("text.device-image-label",e);break}case"images-only":{cs("image.device-image",e),us("text.device-image-label",e);break}case"labels-only":{us("image.device-image",e),us("text.device-image-label",e);break}}}function cs(n,e){var i,r;let t=(r=(i=e.contentDocument)==null?void 0:i.querySelectorAll(n))!=null?r:[];for(let o of t)o.classList.remove("hidden")}function us(n,e){var i,r;let t=(r=(i=e.contentDocument)==null?void 0:i.querySelectorAll(n))!=null?r:[];for(let o of t)o.classList.add("hidden")}function ev(n,e){e.set("view",n);for(let t of H(".rack_elevation"))Mc(n,t)}function kc(){let n=Jo.get("view");for(let e of H("select.rack-view"))e.selectedIndex=[...e.options].findIndex(t=>t.value==n),e.addEventListener("change",t=>{ev(t.currentTarget.value,Jo)},!1);for(let e of H(".rack_elevation"))e.addEventListener("load",()=>{Mc(n,e)})}function tv(n){let e=document.getElementById("selector_results");if(e==null)return;let t=e.getAttribute("data-selector-target");if(t==null)return;let i=document.getElementById(t);if(i==null)return;let r=n.getAttribute("data-label"),o=n.getAttribute("data-value");i.tomselect.addOption({id:o,display:r}),i.tomselect.addItem(o)}function Nc(){for(let n of H("#selector_results a"))n.addEventListener("click",()=>tv(n))}function nv(){let n=document.getElementById("quick-add-object");if(n==null)return;let e=n.getAttribute("data-object-id");if(e==null)return;let t=n.getAttribute("data-object-repr");if(t==null)return;let i=n.getAttribute("data-target-id");if(i==null)return;let r=document.getElementById(i);if(r==null)return;r.tomselect.addOption({id:e,display:t}),r.tomselect.addItem(e);let o=document.getElementById("htmx-modal");if(o){let s=nt.getInstance(o);s&&s.hide()}}function Rc(){let n=document.getElementById("htmx-modal-content");n&&n.addEventListener("htmx:afterSwap",()=>nv())}function iv(){Tr(),Sr(),vr(),xr(),Nc(),Rc(),yr(),Cr()}function Hc(){document.addEventListener("htmx:afterSettle",iv)}function rv(n){let e=n.currentTarget,t=e.baseURI.split("?")[0],i="?",r=Array.from(e.options).filter(o=>o.selected).map(o=>`filter_id=${o.value}`).join("&");t+=`${i}${r}`,document.location.href=t}function Ic(){let n=document.getElementById("results");if(pe(n)){let e=document.getElementById("id_filter_id");pe(e)&&e.addEventListener("change",rv)}}function Pc(){for(let n of[yr,pc,Cr,vr,Al,xr,wc,Tr,Sr,Tc,Sc,Ac,Lc,kc,Hc,Ic])n()}function ov(){let n=document.forms;for(let t of n)t.method.toUpperCase()=="GET"&&t.addEventListener("formdata",function(i){let r=i.formData;for(let[o,s]of Array.from(r.entries()))s===""&&r.delete(o)});let e=document.querySelector(".content-container");e!==null&&e.focus()}window.addEventListener("load",ov);document.readyState!=="loading"?Pc():document.addEventListener("DOMContentLoaded",Pc);})();
+ `}}function Yi(){ti.calendarContainer.classList.add("hasWeeks");var fi=tn("div","flatpickr-weekwrapper");fi.appendChild(tn("span","flatpickr-weekday",ti.l10n.weekAbbreviation));var hi=tn("div","flatpickr-weeks");return fi.appendChild(hi),{weekWrapper:fi,weekNumbers:hi}}function Ri(fi,hi){hi===void 0&&(hi=!0);var mi=hi?fi:fi-ti.currentMonth;mi<0&&ti._hidePrevMonthArrow===!0||mi>0&&ti._hideNextMonthArrow===!0||(ti.currentMonth+=mi,(ti.currentMonth<0||ti.currentMonth>11)&&(ti.currentYear+=ti.currentMonth>11?1:-1,ti.currentMonth=(ti.currentMonth+12)%12,un("onYearChange"),Ji()),Qi(),un("onMonthChange"),Sa())}function Ii(fi,hi){if(fi===void 0&&(fi=!0),hi===void 0&&(hi=!0),ti.input.value="",ti.altInput!==void 0&&(ti.altInput.value=""),ti.mobileInput!==void 0&&(ti.mobileInput.value=""),ti.selectedDates=[],ti.latestSelectedDateObj=void 0,hi===!0&&(ti.currentYear=ti._initialDate.getFullYear(),ti.currentMonth=ti._initialDate.getMonth()),ti.config.enableTime===!0){var mi=Ol(ti.config),_i=mi.hours,Ti=mi.minutes,Ni=mi.seconds;yi(_i,Ti,Ni)}ti.redraw(),fi&&un("onChange")}function Ui(){ti.isOpen=!1,ti.isMobile||(ti.calendarContainer!==void 0&&ti.calendarContainer.classList.remove("open"),ti._input!==void 0&&ti._input.classList.remove("active")),un("onClose")}function ji(){ti.config!==void 0&&un("onDestroy");for(var fi=ti._handlers.length;fi--;)ti._handlers[fi].remove();if(ti._handlers=[],ti.mobileInput)ti.mobileInput.parentNode&&ti.mobileInput.parentNode.removeChild(ti.mobileInput),ti.mobileInput=void 0;else if(ti.calendarContainer&&ti.calendarContainer.parentNode)if(ti.config.static&&ti.calendarContainer.parentNode){var hi=ti.calendarContainer.parentNode;if(hi.lastChild&&hi.removeChild(hi.lastChild),hi.parentNode){for(;hi.firstChild;)hi.parentNode.insertBefore(hi.firstChild,hi);hi.parentNode.removeChild(hi)}}else ti.calendarContainer.parentNode.removeChild(ti.calendarContainer);ti.altInput&&(ti.input.type="text",ti.altInput.parentNode&&ti.altInput.parentNode.removeChild(ti.altInput),delete ti.altInput),ti.input&&(ti.input.type=ti.input._type,ti.input.classList.remove("flatpickr-input"),ti.input.removeAttribute("readonly")),["_showTimeInput","latestSelectedDateObj","_hideNextMonthArrow","_hidePrevMonthArrow","__hideNextMonthArrow","__hidePrevMonthArrow","isMobile","isOpen","selectedDateElem","minDateHasTime","maxDateHasTime","days","daysContainer","_input","_positionElement","innerContainer","rContainer","monthNav","todayDateElem","calendarContainer","weekdayContainer","prevMonthNav","nextMonthNav","monthsDropdownContainer","currentMonthElement","currentYearElement","navigationCurrentMonth","selectedDateElem","config"].forEach(function(mi){try{delete ti[mi]}catch(_i){}})}function Pi(fi){return ti.calendarContainer.contains(fi)}function ln(fi){if(ti.isOpen&&!ti.config.inline){var hi=Wn(fi),mi=Pi(hi),_i=hi===ti.input||hi===ti.altInput||ti.element.contains(hi)||fi.path&&fi.path.indexOf&&(~fi.path.indexOf(ti.input)||~fi.path.indexOf(ti.altInput)),Ti=!_i&&!mi&&!Pi(fi.relatedTarget),Ni=!ti.config.ignoredFocusElements.some(function(Ki){return Ki.contains(hi)});Ti&&Ni&&(ti.config.allowInput&&ti.setDate(ti._input.value,!1,ti.config.altInput?ti.config.altFormat:ti.config.dateFormat),ti.timeContainer!==void 0&&ti.minuteElement!==void 0&&ti.hourElement!==void 0&&ti.input.value!==""&&ti.input.value!==void 0&&li(),ti.close(),ti.config&&ti.config.mode==="range"&&ti.selectedDates.length===1&&ti.clear(!1))}}function kn(fi){if(!(!fi||ti.config.minDate&&fiti.config.maxDate.getFullYear())){var hi=fi,mi=ti.currentYear!==hi;ti.currentYear=hi||ti.currentYear,ti.config.maxDate&&ti.currentYear===ti.config.maxDate.getFullYear()?ti.currentMonth=Math.min(ti.config.maxDate.getMonth(),ti.currentMonth):ti.config.minDate&&ti.currentYear===ti.config.minDate.getFullYear()&&(ti.currentMonth=Math.max(ti.config.minDate.getMonth(),ti.currentMonth)),mi&&(ti.redraw(),un("onYearChange"),Ji())}}function yn(fi,hi){var mi;hi===void 0&&(hi=!0);var _i=ti.parseDate(fi,void 0,hi);if(ti.config.minDate&&_i&&Un(_i,ti.config.minDate,hi!==void 0?hi:!ti.minDateHasTime)<0||ti.config.maxDate&&_i&&Un(_i,ti.config.maxDate,hi!==void 0?hi:!ti.maxDateHasTime)>0)return!1;if(!ti.config.enable&&ti.config.disable.length===0)return!0;if(_i===void 0)return!1;for(var Ti=!!ti.config.enable,Ni=(mi=ti.config.enable)!==null&&mi!==void 0?mi:ti.config.disable,Ki=0,$i=void 0;Ki=$i.from.getTime()&&_i.getTime()<=$i.to.getTime())return Ti}return!Ti}function Sn(fi){return ti.daysContainer!==void 0?fi.className.indexOf("hidden")===-1&&fi.className.indexOf("flatpickr-disabled")===-1&&ti.daysContainer.contains(fi):!1}function $s(fi){var hi=fi.target===ti._input,mi=ti._input.value.trimEnd()!==Pl();hi&&mi&&!(fi.relatedTarget&&Pi(fi.relatedTarget))&&ti.setDate(ti._input.value,!0,fi.target===ti.altInput?ti.config.altFormat:ti.config.dateFormat)}function no(fi){var hi=Wn(fi),mi=ti.config.wrap?ii.contains(hi):hi===ti._input,_i=ti.config.allowInput,Ti=ti.isOpen&&(!_i||!mi),Ni=ti.config.inline&&mi&&!_i;if(fi.keyCode===13&&mi){if(_i)return ti.setDate(ti._input.value,!0,hi===ti.altInput?ti.config.altFormat:ti.config.dateFormat),ti.close(),hi.blur();ti.open()}else if(Pi(hi)||Ti||Ni){var Ki=!!ti.timeContainer&&ti.timeContainer.contains(hi);switch(fi.keyCode){case 13:Ki?(fi.preventDefault(),li(),us()):ds(fi);break;case 27:fi.preventDefault(),us();break;case 8:case 46:mi&&!ti.config.allowInput&&(fi.preventDefault(),ti.clear());break;case 37:case 39:if(!Ki&&!mi){fi.preventDefault();var $i=oi();if(ti.daysContainer!==void 0&&(_i===!1||$i&&Sn($i))){var Xi=fi.keyCode===39?1:-1;fi.ctrlKey?(fi.stopPropagation(),Ri(Xi),qi(Mi(1),0)):qi(void 0,Xi)}}else ti.hourElement&&ti.hourElement.focus();break;case 38:case 40:fi.preventDefault();var Fi=fi.keyCode===40?1:-1;ti.daysContainer&&hi.$i!==void 0||hi===ti.input||hi===ti.altInput?fi.ctrlKey?(fi.stopPropagation(),kn(ti.currentYear-Fi),qi(Mi(1),0)):Ki||qi(void 0,Fi*7):hi===ti.currentYearElement?kn(ti.currentYear-Fi):ti.config.enableTime&&(!Ki&&ti.hourElement&&ti.hourElement.focus(),li(fi),ti._debouncedChange());break;case 9:if(Ki){var Gi=[ti.hourElement,ti.minuteElement,ti.secondElement,ti.amPM].concat(ti.pluginElements).filter(function(Kn){return Kn}),nn=Gi.indexOf(hi);if(nn!==-1){var ro=Gi[nn+(fi.shiftKey?-1:1)];fi.preventDefault(),(ro||ti._input).focus()}}else!ti.config.noCalendar&&ti.daysContainer&&ti.daysContainer.contains(hi)&&fi.shiftKey&&(fi.preventDefault(),ti._input.focus());break;default:break}}if(ti.amPM!==void 0&&hi===ti.amPM)switch(fi.key){case ti.l10n.amPM[0].charAt(0):case ti.l10n.amPM[0].charAt(0).toLowerCase():ti.amPM.textContent=ti.l10n.amPM[0],di(),ao();break;case ti.l10n.amPM[1].charAt(0):case ti.l10n.amPM[1].charAt(0).toLowerCase():ti.amPM.textContent=ti.l10n.amPM[1],di(),ao();break}(mi||Pi(hi))&&un("onKeyDown",fi)}function wo(fi,hi){if(hi===void 0&&(hi="flatpickr-day"),!(ti.selectedDates.length!==1||fi&&(!fi.classList.contains(hi)||fi.classList.contains("flatpickr-disabled")))){for(var mi=fi?fi.dateObj.getTime():ti.days.firstElementChild.dateObj.getTime(),_i=ti.parseDate(ti.selectedDates[0],void 0,!0).getTime(),Ti=Math.min(mi,ti.selectedDates[0].getTime()),Ni=Math.max(mi,ti.selectedDates[0].getTime()),Ki=!1,$i=0,Xi=0,Fi=Ti;FiTi&&Fi$i)?$i=Fi:Fi>_i&&(!Xi||Fi ."+hi));Gi.forEach(function(nn){var ro=nn.dateObj,Kn=ro.getTime(),Vs=$i>0&&Kn<$i||Xi>0&&Kn>Xi;if(Vs){nn.classList.add("notAllowed"),["inRange","startRange","endRange"].forEach(function(fs){nn.classList.remove(fs)});return}else if(Ki&&!Vs)return;["startRange","inRange","endRange","notAllowed"].forEach(function(fs){nn.classList.remove(fs)}),fi!==void 0&&(fi.classList.add(mi<=ti.selectedDates[0].getTime()?"startRange":"endRange"),_imi&&Kn===_i&&nn.classList.add("endRange"),Kn>=$i&&(Xi===0||Kn<=Xi)&&mh(Kn,_i,mi)&&nn.classList.add("inRange"))})}}function bn(){ti.isOpen&&!ti.config.static&&!ti.config.inline&&Gn()}function xo(fi,hi){if(hi===void 0&&(hi=ti._positionElement),ti.isMobile===!0){if(fi){fi.preventDefault();var mi=Wn(fi);mi&&mi.blur()}ti.mobileInput!==void 0&&(ti.mobileInput.focus(),ti.mobileInput.click()),un("onOpen");return}else if(ti._input.disabled||ti.config.inline)return;var _i=ti.isOpen;ti.isOpen=!0,_i||(ti.calendarContainer.classList.add("open"),ti._input.classList.add("active"),un("onOpen"),Gn(hi)),ti.config.enableTime===!0&&ti.config.noCalendar===!0&&ti.config.allowInput===!1&&(fi===void 0||!ti.timeContainer.contains(fi.relatedTarget))&&setTimeout(function(){return ti.hourElement.select()},50)}function so(fi){return function(hi){var mi=ti.config["_"+fi+"Date"]=ti.parseDate(hi,ti.config.dateFormat),_i=ti.config["_"+(fi==="min"?"max":"min")+"Date"];mi!==void 0&&(ti[fi==="min"?"minDateHasTime":"maxDateHasTime"]=mi.getHours()>0||mi.getMinutes()>0||mi.getSeconds()>0),ti.selectedDates&&(ti.selectedDates=ti.selectedDates.filter(function(Ti){return yn(Ti)}),!ti.selectedDates.length&&fi==="min"&&pi(mi),ao()),ti.daysContainer&&(Bs(),mi!==void 0?ti.currentYearElement[fi]=mi.getFullYear().toString():ti.currentYearElement.removeAttribute(fi),ti.currentYearElement.disabled=!!_i&&mi!==void 0&&_i.getFullYear()===mi.getFullYear())}}function ls(){var fi=["wrap","weekNumbers","allowInput","allowInvalidPreload","clickOpens","time_24hr","enableTime","noCalendar","altInput","shorthandCurrentMonth","inline","static","enableSeconds","disableMobile"],hi=Hn(Hn({},JSON.parse(JSON.stringify(ii.dataset||{}))),ei),mi={};ti.config.parseDate=hi.parseDate,ti.config.formatDate=hi.formatDate,Object.defineProperty(ti.config,"enable",{get:function(){return ti.config._enable},set:function(Gi){ti.config._enable=ru(Gi)}}),Object.defineProperty(ti.config,"disable",{get:function(){return ti.config._disable},set:function(Gi){ti.config._disable=ru(Gi)}});var _i=hi.mode==="time";if(!hi.dateFormat&&(hi.enableTime||_i)){var Ti=xn.defaultConfig.dateFormat||Bo.dateFormat;mi.dateFormat=hi.noCalendar||_i?"H:i"+(hi.enableSeconds?":S":""):Ti+" H:i"+(hi.enableSeconds?":S":"")}if(hi.altInput&&(hi.enableTime||_i)&&!hi.altFormat){var Ni=xn.defaultConfig.altFormat||Bo.altFormat;mi.altFormat=hi.noCalendar||_i?"h:i"+(hi.enableSeconds?":S K":" K"):Ni+(" h:i"+(hi.enableSeconds?":S":"")+" K")}Object.defineProperty(ti.config,"minDate",{get:function(){return ti.config._minDate},set:so("min")}),Object.defineProperty(ti.config,"maxDate",{get:function(){return ti.config._maxDate},set:so("max")});var Ki=function(Gi){return function(nn){ti.config[Gi==="min"?"_minTime":"_maxTime"]=ti.parseDate(nn,"H:i:S")}};Object.defineProperty(ti.config,"minTime",{get:function(){return ti.config._minTime},set:Ki("min")}),Object.defineProperty(ti.config,"maxTime",{get:function(){return ti.config._maxTime},set:Ki("max")}),hi.mode==="time"&&(ti.config.noCalendar=!0,ti.config.enableTime=!0),Object.assign(ti.config,mi,hi);for(var $i=0;$i-1?ti.config[Fi]=Sl(Xi[Fi]).map(si).concat(ti.config[Fi]):typeof hi[Fi]=="undefined"&&(ti.config[Fi]=Xi[Fi])}hi.altInputClass||(ti.config.altInputClass=On().className+" "+ti.config.altInputClass),un("onParseConfig")}function On(){return ti.config.wrap?ii.querySelector("[data-input]"):ii}function zn(){typeof ti.config.locale!="object"&&typeof xn.l10ns[ti.config.locale]=="undefined"&&ti.config.errorHandler(new Error("flatpickr: invalid locale "+ti.config.locale)),ti.l10n=Hn(Hn({},xn.l10ns.default),typeof ti.config.locale=="object"?ti.config.locale:ti.config.locale!=="default"?xn.l10ns[ti.config.locale]:void 0),_o.D="("+ti.l10n.weekdays.shorthand.join("|")+")",_o.l="("+ti.l10n.weekdays.longhand.join("|")+")",_o.M="("+ti.l10n.months.shorthand.join("|")+")",_o.F="("+ti.l10n.months.longhand.join("|")+")",_o.K="("+ti.l10n.amPM[0]+"|"+ti.l10n.amPM[1]+"|"+ti.l10n.amPM[0].toLowerCase()+"|"+ti.l10n.amPM[1].toLowerCase()+")";var fi=Hn(Hn({},ei),JSON.parse(JSON.stringify(ii.dataset||{})));fi.time_24hr===void 0&&xn.defaultConfig.time_24hr===void 0&&(ti.config.time_24hr=ti.l10n.time_24hr),ti.formatDate=Xc(ti),ti.parseDate=Al({config:ti.config,l10n:ti.l10n})}function Gn(fi){if(typeof ti.config.position=="function")return void ti.config.position(ti,fi);if(ti.calendarContainer!==void 0){un("onPreCalendarPosition");var hi=fi||ti._positionElement,mi=Array.prototype.reduce.call(ti.calendarContainer.children,function(Kh,Qh){return Kh+Qh.offsetHeight},0),_i=ti.calendarContainer.offsetWidth,Ti=ti.config.position.split(" "),Ni=Ti[0],Ki=Ti.length>1?Ti[1]:null,$i=hi.getBoundingClientRect(),Xi=window.innerHeight-$i.bottom,Fi=Ni==="above"||Ni!=="below"&&Ximi,Gi=window.pageYOffset+$i.top+(Fi?-mi-2:hi.offsetHeight+2);if(In(ti.calendarContainer,"arrowTop",!Fi),In(ti.calendarContainer,"arrowBottom",Fi),!ti.config.inline){var nn=window.pageXOffset+$i.left,ro=!1,Kn=!1;Ki==="center"?(nn-=(_i-$i.width)/2,ro=!0):Ki==="right"&&(nn-=_i-$i.width,Kn=!0),In(ti.calendarContainer,"arrowLeft",!ro&&!Kn),In(ti.calendarContainer,"arrowCenter",ro),In(ti.calendarContainer,"arrowRight",Kn);var Vs=window.document.body.offsetWidth-(window.pageXOffset+$i.right),fs=nn+_i>window.document.body.offsetWidth,Vh=Vs+_i>window.document.body.offsetWidth;if(In(ti.calendarContainer,"rightMost",fs),!ti.config.static)if(ti.calendarContainer.style.top=Gi+"px",!fs)ti.calendarContainer.style.left=nn+"px",ti.calendarContainer.style.right="auto";else if(!Vh)ti.calendarContainer.style.left="auto",ti.calendarContainer.style.right=Vs+"px";else{var Fl=Jn();if(Fl===void 0)return;var jh=window.document.body.offsetWidth,qh=Math.max(0,jh/2-_i/2),Wh=".flatpickr-calendar.centerMost:before",Uh=".flatpickr-calendar.centerMost:after",Yh=Fl.cssRules.length,Gh="{left:"+$i.left+"px;right:auto;}";In(ti.calendarContainer,"rightMost",!1),In(ti.calendarContainer,"centerMost",!0),Fl.insertRule(Wh+","+Uh+Gh,Yh),ti.calendarContainer.style.left=qh+"px",ti.calendarContainer.style.right="auto"}}}}function Jn(){for(var fi=null,hi=0;hiti.currentMonth+ti.config.showMonths-1)&&ti.config.mode!=="range";if(ti.selectedDateElem=_i,ti.config.mode==="single")ti.selectedDates=[Ti];else if(ti.config.mode==="multiple"){var Ki=Hl(Ti);Ki?ti.selectedDates.splice(parseInt(Ki),1):ti.selectedDates.push(Ti)}else ti.config.mode==="range"&&(ti.selectedDates.length===2&&ti.clear(!1,!1),ti.latestSelectedDateObj=Ti,ti.selectedDates.push(Ti),Un(Ti,ti.selectedDates[0],!0)!==0&&ti.selectedDates.sort(function(Gi,nn){return Gi.getTime()-nn.getTime()}));if(di(),Ni){var $i=ti.currentYear!==Ti.getFullYear();ti.currentYear=Ti.getFullYear(),ti.currentMonth=Ti.getMonth(),$i&&(un("onYearChange"),Ji()),un("onMonthChange")}if(Sa(),Qi(),ao(),!Ni&&ti.config.mode!=="range"&&ti.config.showMonths===1?ki(_i):ti.selectedDateElem!==void 0&&ti.hourElement===void 0&&ti.selectedDateElem&&ti.selectedDateElem.focus(),ti.hourElement!==void 0&&ti.hourElement!==void 0&&ti.hourElement.focus(),ti.config.closeOnSelect){var Xi=ti.config.mode==="single"&&!ti.config.enableTime,Fi=ti.config.mode==="range"&&ti.selectedDates.length===2&&!ti.config.enableTime;(Xi||Fi)&&us()}Ei()}}var Vo={locale:[zn,vn],showMonths:[rn,ai,Mn],minDate:[xi],maxDate:[xi],positionElement:[ou],clickOpens:[function(){ti.config.clickOpens===!0?(vi(ti._input,"focus",ti.open),vi(ti._input,"click",ti.open)):(ti._input.removeEventListener("focus",ti.open),ti._input.removeEventListener("click",ti.open))}]};function Ta(fi,hi){if(fi!==null&&typeof fi=="object"){Object.assign(ti.config,fi);for(var mi in fi)Vo[mi]!==void 0&&Vo[mi].forEach(function(_i){return _i()})}else ti.config[fi]=hi,Vo[fi]!==void 0?Vo[fi].forEach(function(_i){return _i()}):xl.indexOf(fi)>-1&&(ti.config[fi]=Sl(hi));ti.redraw(),ao(!0)}function zs(fi,hi){var mi=[];if(fi instanceof Array)mi=fi.map(function(_i){return ti.parseDate(_i,hi)});else if(fi instanceof Date||typeof fi=="number")mi=[ti.parseDate(fi,hi)];else if(typeof fi=="string")switch(ti.config.mode){case"single":case"time":mi=[ti.parseDate(fi,hi)];break;case"multiple":mi=fi.split(ti.config.conjunction).map(function(_i){return ti.parseDate(_i,hi)});break;case"range":mi=fi.split(ti.l10n.rangeSeparator).map(function(_i){return ti.parseDate(_i,hi)});break;default:break}else ti.config.errorHandler(new Error("Invalid date supplied: "+JSON.stringify(fi)));ti.selectedDates=ti.config.allowInvalidPreload?mi:mi.filter(function(_i){return _i instanceof Date&&yn(_i,!1)}),ti.config.mode==="range"&&ti.selectedDates.sort(function(_i,Ti){return _i.getTime()-Ti.getTime()})}function Ca(fi,hi,mi){if(hi===void 0&&(hi=!1),mi===void 0&&(mi=ti.config.dateFormat),fi!==0&&!fi||fi instanceof Array&&fi.length===0)return ti.clear(hi);zs(fi,mi),ti.latestSelectedDateObj=ti.selectedDates[ti.selectedDates.length-1],ti.redraw(),xi(void 0,hi),pi(),ti.selectedDates.length===0&&ti.clear(!1),ao(hi),hi&&un("onChange")}function ru(fi){return fi.slice().map(function(hi){return typeof hi=="string"||typeof hi=="number"||hi instanceof Date?ti.parseDate(hi,void 0,!0):hi&&typeof hi=="object"&&hi.from&&hi.to?{from:ti.parseDate(hi.from,void 0),to:ti.parseDate(hi.to,void 0)}:hi}).filter(function(hi){return hi})}function Ih(){ti.selectedDates=[],ti.now=ti.parseDate(ti.config.now)||new Date;var fi=ti.config.defaultDate||((ti.input.nodeName==="INPUT"||ti.input.nodeName==="TEXTAREA")&&ti.input.placeholder&&ti.input.value===ti.input.placeholder?null:ti.input.value);fi&&zs(fi,ti.config.dateFormat),ti._initialDate=ti.selectedDates.length>0?ti.selectedDates[0]:ti.config.minDate&&ti.config.minDate.getTime()>ti.now.getTime()?ti.config.minDate:ti.config.maxDate&&ti.config.maxDate.getTime()0&&(ti.latestSelectedDateObj=ti.selectedDates[0]),ti.config.minTime!==void 0&&(ti.config.minTime=ti.parseDate(ti.config.minTime,"H:i")),ti.config.maxTime!==void 0&&(ti.config.maxTime=ti.parseDate(ti.config.maxTime,"H:i")),ti.minDateHasTime=!!ti.config.minDate&&(ti.config.minDate.getHours()>0||ti.config.minDate.getMinutes()>0||ti.config.minDate.getSeconds()>0),ti.maxDateHasTime=!!ti.config.maxDate&&(ti.config.maxDate.getHours()>0||ti.config.maxDate.getMinutes()>0||ti.config.maxDate.getSeconds()>0)}function Hh(){if(ti.input=On(),!ti.input){ti.config.errorHandler(new Error("Invalid input element specified"));return}ti.input._type=ti.input.type,ti.input.type="text",ti.input.classList.add("flatpickr-input"),ti._input=ti.input,ti.config.altInput&&(ti.altInput=tn(ti.input.nodeName,ti.config.altInputClass),ti._input=ti.altInput,ti.altInput.placeholder=ti.input.placeholder,ti.altInput.disabled=ti.input.disabled,ti.altInput.required=ti.input.required,ti.altInput.tabIndex=ti.input.tabIndex,ti.altInput.type="text",ti.input.setAttribute("type","hidden"),!ti.config.static&&ti.input.parentNode&&ti.input.parentNode.insertBefore(ti.altInput,ti.input.nextSibling)),ti.config.allowInput||ti._input.setAttribute("readonly","readonly"),ou()}function ou(){ti._positionElement=ti.config.positionElement||ti._input}function Ph(){var fi=ti.config.enableTime?ti.config.noCalendar?"time":"datetime-local":"date";ti.mobileInput=tn("input",ti.input.className+" flatpickr-mobile"),ti.mobileInput.tabIndex=1,ti.mobileInput.type=fi,ti.mobileInput.disabled=ti.input.disabled,ti.mobileInput.required=ti.input.required,ti.mobileInput.placeholder=ti.input.placeholder,ti.mobileFormatStr=fi==="datetime-local"?"Y-m-d\\TH:i:S":fi==="date"?"Y-m-d":"H:i:S",ti.selectedDates.length>0&&(ti.mobileInput.defaultValue=ti.mobileInput.value=ti.formatDate(ti.selectedDates[0],ti.mobileFormatStr)),ti.config.minDate&&(ti.mobileInput.min=ti.formatDate(ti.config.minDate,"Y-m-d")),ti.config.maxDate&&(ti.mobileInput.max=ti.formatDate(ti.config.maxDate,"Y-m-d")),ti.input.getAttribute("step")&&(ti.mobileInput.step=String(ti.input.getAttribute("step"))),ti.input.type="hidden",ti.altInput!==void 0&&(ti.altInput.type="hidden");try{ti.input.parentNode&&ti.input.parentNode.insertBefore(ti.mobileInput,ti.input.nextSibling)}catch(hi){}vi(ti.mobileInput,"change",function(hi){ti.setDate(Wn(hi).value,!1,ti.mobileFormatStr),un("onChange"),un("onClose")})}function Fh(fi){if(ti.isOpen===!0)return ti.close();ti.open(fi)}function un(fi,hi){if(ti.config!==void 0){var mi=ti.config[fi];if(mi!==void 0&&mi.length>0)for(var _i=0;mi[_i]&&_i=0&&Un(fi,ti.selectedDates[1])<=0}function Sa(){ti.config.noCalendar||ti.isMobile||!ti.monthNav||(ti.yearElements.forEach(function(fi,hi){var mi=new Date(ti.currentYear,ti.currentMonth,1);mi.setMonth(ti.currentMonth+hi),ti.config.showMonths>1||ti.config.monthSelectorType==="static"?ti.monthElements[hi].textContent=_a(mi.getMonth(),ti.config.shorthandCurrentMonth,ti.l10n)+" ":ti.monthsDropdownContainer.value=mi.getMonth().toString(),fi.value=mi.getFullYear().toString()}),ti._hidePrevMonthArrow=ti.config.minDate!==void 0&&(ti.currentYear===ti.config.minDate.getFullYear()?ti.currentMonth<=ti.config.minDate.getMonth():ti.currentYearti.config.maxDate.getMonth():ti.currentYear>ti.config.maxDate.getFullYear()))}function Pl(fi){var hi=fi||(ti.config.altInput?ti.config.altFormat:ti.config.dateFormat);return ti.selectedDates.map(function(mi){return ti.formatDate(mi,hi)}).filter(function(mi,_i,Ti){return ti.config.mode!=="range"||ti.config.enableTime||Ti.indexOf(mi)===_i}).join(ti.config.mode!=="range"?ti.config.conjunction:ti.l10n.rangeSeparator)}function ao(fi){fi===void 0&&(fi=!0),ti.mobileInput!==void 0&&ti.mobileFormatStr&&(ti.mobileInput.value=ti.latestSelectedDateObj!==void 0?ti.formatDate(ti.latestSelectedDateObj,ti.mobileFormatStr):""),ti.input.value=Pl(ti.config.dateFormat),ti.altInput!==void 0&&(ti.altInput.value=Pl(ti.config.altFormat)),fi!==!1&&un("onValueUpdate")}function Bh(fi){var hi=Wn(fi),mi=ti.prevMonthNav.contains(hi),_i=ti.nextMonthNav.contains(hi);mi||_i?Ri(mi?-1:1):ti.yearElements.indexOf(hi)>=0?hi.select():hi.classList.contains("arrowUp")?ti.changeYear(ti.currentYear+1):hi.classList.contains("arrowDown")&&ti.changeYear(ti.currentYear-1)}function zh(fi){fi.preventDefault();var hi=fi.type==="keydown",mi=Wn(fi),_i=mi;ti.amPM!==void 0&&mi===ti.amPM&&(ti.amPM.textContent=ti.l10n.amPM[qn(ti.amPM.textContent===ti.l10n.amPM[0])]);var Ti=parseFloat(_i.getAttribute("min")),Ni=parseFloat(_i.getAttribute("max")),Ki=parseFloat(_i.getAttribute("step")),$i=parseInt(_i.value,10),Xi=fi.delta||(hi?fi.which===38?1:-1:0),Fi=$i+Ki*Xi;if(typeof _i.value!="undefined"&&_i.value.length===2){var Gi=_i===ti.hourElement,nn=_i===ti.minuteElement;FiNi&&(Fi=_i===ti.hourElement?Fi-Ni-qn(!ti.amPM):Ti,nn&&Oi(void 0,1,ti.hourElement)),ti.amPM&&Gi&&(Ki===1?Fi+$i===23:Math.abs(Fi-$i)>Ki)&&(ti.amPM.textContent=ti.l10n.amPM[qn(ti.amPM.textContent===ti.l10n.amPM[0])]),_i.value=Rn(Fi)}}return ri(),ti}function Ns(ii,ei){for(var ti=Array.prototype.slice.call(ii).filter(function(si){return si instanceof HTMLElement}),ni=[],ri=0;ri option"))if(ei.selected){for(let ti of Hi("#id_columns"))ti.appendChild(ei.cloneNode(!0));ei.remove()}ii.preventDefault()}function z_(ii){for(let ei of Hi("#id_columns > option"))if(ei.selected){for(let ti of Hi("#id_available_columns"))ti.appendChild(ei.cloneNode(!0));ei.remove()}ii.preventDefault()}function _h(ii,ei){return lo(this,null,function*(){return yield Ls(ii,ei)})}function V_(ii){var li,ci,ui;ii.preventDefault();let ei=ii.currentTarget,ti=ei.getAttribute("data-url");if(ti==null){Po("danger","Error Updating Table Configuration","No API path defined for configuration form.").show();return}let ni=((li=document.activeElement)==null?void 0:li.getAttribute("value"))==="Reset",ri=(ui=(ci=ei.getAttribute("data-config-root"))==null?void 0:ci.split("."))!=null?ui:[];if(ni){let di=ri.reduceRight((pi,yi)=>({[yi]:pi}),{});_h(ti,di).then(pi=>{rs(pi)?Po("danger","Error Resetting Table Configuration",pi.error).show():location.reload()});return}let oi=bf(ei,"select[name=columns]"),si=Object.assign({},...oi.map(di=>({[di.name]:di.options}))),ai=ri.reduceRight((di,pi)=>({[pi]:di}),si);_h(ti,ai).then(di=>{rs(di)?Po("danger","Error Updating Table Configuration",di.error).show():location.reload()})}function Eh(){for(let ii of Hi("#save_tableconfig"))ii.addEventListener("click",$_);for(let ii of Hi("#add_columns"))ii.addEventListener("click",B_);for(let ii of Hi("#remove_columns"))ii.addEventListener("click",z_);for(let ii of Hi("form.userconfigform"))ii.addEventListener("submit",V_)}function wh(ii){return typeof ii=="string"&&["show","hide"].includes(ii)}var ss=class extends Error{constructor(ti,ni){super(ti);en(this,"table");this.table=ni}},Rs=class{constructor(ei,ti){en(this,"button");en(this,"rows");this.button=ei,this.rows=ti}hideRows(){for(let ei of this.rows)ei.classList.add("d-none")}set buttonState(ei){wh(ei)&&this.button.setAttribute("data-state",ei)}get buttonState(){let ei=this.button.getAttribute("data-state");return wh(ei)?ei:null}toggleButton(){this.buttonState==="show"?this.button.innerText=Ms(this.button.innerText,"Show","Hide"):this.buttonState==="hide"&&(this.button.innerText=Ms(this.button.innerHTML,"Hide","Show"))}toggleState(){this.buttonState==="show"?this.buttonState="hide":this.buttonState==="hide"&&(this.buttonState="show")}toggle(){this.toggleState(),this.toggleButton()}handleClick(ei){ei.currentTarget.isEqualNode(this.button)&&this.toggle(),this.buttonState==="hide"&&this.hideRows()}},Jc=class{constructor(ei){en(this,"table");en(this,"enabledButton");en(this,"disabledButton");en(this,"virtualButton");en(this,"disconnectedButton");en(this,"rows");this.table=ei,this.rows=this.table.querySelectorAll("tr");try{let ti=os(this.table,"button.toggle-enabled"),ni=os(this.table,"button.toggle-disabled"),ri=os(this.table,"button.toggle-virtual"),oi=os(this.table,"button.toggle-disconnected");if(ti===null)throw new ss("Table is missing a 'toggle-enabled' button.",ei);if(ni===null)throw new ss("Table is missing a 'toggle-disabled' button.",ei);if(ri===null)throw new ss("Table is missing a 'toggle-virtual' button.",ei);if(oi===null)throw new ss("Table is missing a 'toggle-disconnected' button.",ei);ti.addEventListener("click",si=>this.handleClick(si,this)),ni.addEventListener("click",si=>this.handleClick(si,this)),ri.addEventListener("click",si=>this.handleClick(si,this)),oi.addEventListener("click",si=>this.handleClick(si,this)),this.enabledButton=new Rs(ti,ei.querySelectorAll('tr[data-enabled="enabled"]')),this.disabledButton=new Rs(ni,ei.querySelectorAll('tr[data-enabled="disabled"]')),this.virtualButton=new Rs(ri,ei.querySelectorAll('tr[data-type="virtual"]')),this.disconnectedButton=new Rs(oi,ei.querySelectorAll('tr[data-connected="disconnected"]'))}catch(ti){if(ti instanceof ss){console.debug("Table does not contain enable/disable toggle buttons");return}else throw ti}}handleClick(ei,ti){for(let ni of this.rows)ni.classList.remove("d-none");ti.enabledButton.handleClick(ei),ti.disabledButton.handleClick(ei),ti.virtualButton.handleClick(ei),ti.disconnectedButton.handleClick(ei)}};function xh(){for(let ii of Hi("table"))new Jc(ii)}var Zc=class{constructor(ei){en(this,"base");en(this,"state");en(this,"activeLink",null);en(this,"sections",[]);this.base=ei,this.state=new ga({pinned:!0},{persist:!0,key:"netbox-sidenav"}),this.init(),this.initSectionLinks(),this.initLinks()}bodyHas(ei){return document.body.hasAttribute(`data-sidenav-${ei}`)}bodyRemove(...ei){for(let ti of ei)document.body.removeAttribute(`data-sidenav-${ti}`)}bodyAdd(...ei){for(let ti of ei)document.body.setAttribute(`data-sidenav-${ti}`,"")}init(){for(let ei of this.base.querySelectorAll(".sidenav-toggle"))ei.addEventListener("click",ti=>this.onToggle(ti));for(let ei of Hi(".sidenav-toggle-mobile"))ei.addEventListener("click",ti=>this.onMobileToggle(ti));window.innerWidth>1200&&(this.state.get("pinned")&&this.pin(),this.state.get("pinned")||this.unpin(),window.addEventListener("resize",()=>this.onResize())),window.innerWidth<1200&&(this.bodyRemove("hide"),this.bodyAdd("hidden"),window.addEventListener("resize",()=>this.onResize())),this.base.addEventListener("mouseenter",()=>this.onEnter()),this.base.addEventListener("mouseleave",()=>this.onLeave())}initLinks(){for(let ei of this.getActiveLinks())this.bodyHas("show")?this.activateLink(ei,"expand"):this.bodyHas("hidden")&&this.activateLink(ei,"collapse")}show(){this.bodyAdd("show"),this.bodyRemove("hidden","hide")}hide(){this.bodyAdd("hidden"),this.bodyRemove("pinned","show");for(let ei of this.base.querySelectorAll(".collapse"))ei.classList.remove("show")}pin(){this.bodyAdd("show","pinned"),this.bodyRemove("hidden"),this.state.set("pinned",!0)}unpin(){this.bodyRemove("pinned","show"),this.bodyAdd("hidden");for(let ei of this.base.querySelectorAll(".collapse"))ei.classList.remove("show");this.state.set("pinned",!1)}handleSectionClick(ei){ei.preventDefault();let ti=ei.target;this.activeLink=ti,this.closeInactiveSections()}closeInactiveSections(){for(let[ei,ti]of this.sections)ei!==this.activeLink&&(ei.classList.add("collapsed"),ei.setAttribute("aria-expanded","false"),ti.hide())}initSectionLinks(){for(let ei of Hi(".navbar-nav .nav-item .nav-link[data-bs-toggle]"))if(ei.parentElement!==null){let ti=ei.parentElement.querySelector(".collapse");if(ti!==null){let ni=new Oo(ti,{toggle:!1});this.sections.push([ei,ni]),ei.addEventListener("click",ri=>this.handleSectionClick(ri))}}}activateLink(ei,ti){var ri;let ni=ei.closest(".dropdown-menu");if(fl(ni)){let oi=ni.parentElement,si=(ri=ni.parentElement)==null?void 0:ri.querySelector(".nav-link");if(fl(si)&&fl(oi))switch(ti){case"expand":si.setAttribute("aria-expanded","true"),oi.classList.add("active"),ni.classList.add("show"),ei.classList.add("active");break;case"collapse":si.setAttribute("aria-expanded","false"),oi.classList.remove("active"),ni.classList.remove("show"),ei.classList.remove("active");break}}}*getActiveLinks(){for(let ei of this.base.querySelectorAll("ul.navbar-nav .nav-item .dropdown-item")){let ti=ei.querySelector("a");if(ti){let ni=new RegExp(ti.href,"gi");window.location.href.match(ni)&&(yield ei)}}}onEnter(){if(!this.bodyHas("pinned")){this.bodyRemove("hide","hidden"),this.bodyAdd("show");for(let ei of this.getActiveLinks())this.activateLink(ei,"expand")}}onLeave(){if(!this.bodyHas("pinned")){this.bodyRemove("show"),this.bodyAdd("hide");for(let ei of this.getActiveLinks())this.activateLink(ei,"collapse");this.bodyRemove("hide"),this.bodyAdd("hidden")}}onResize(){this.bodyHas("show")&&!this.bodyHas("pinned")&&(this.bodyRemove("show"),this.bodyAdd("hidden"))}onToggle(ei){ei.preventDefault(),this.state.get("pinned")?this.unpin():this.pin()}onMobileToggle(ei){ei.preventDefault(),this.bodyHas("hidden")?this.show():this.hide()}};function Th(){for(let ii of Hi(".navbar"))new Zc(ii)}function Ch(ii,ei,ti,ni,ri){let oi=(...si)=>(console.warn("gridstack.js: Function `"+ti+"` is deprecated in "+ri+" and has been replaced with `"+ni+"`. It will be **removed** in a future release"),ei.apply(ii,si));return oi.prototype=ei.prototype,oi}var bi=class ii{static getElements(ei,ti=document){if(typeof ei=="string"){let ni="getElementById"in ti?ti:void 0;if(ni&&!isNaN(+ei[0])){let oi=ni.getElementById(ei);return oi?[oi]:[]}let ri=ti.querySelectorAll(ei);return!ri.length&&ei[0]!=="."&&ei[0]!=="#"&&(ri=ti.querySelectorAll("."+ei),ri.length||(ri=ti.querySelectorAll("#"+ei))),Array.from(ri)}return[ei]}static getElement(ei,ti=document){if(typeof ei=="string"){let ni="getElementById"in ti?ti:void 0;if(!ei.length)return null;if(ni&&ei[0]==="#")return ni.getElementById(ei.substring(1));if(ei[0]==="#"||ei[0]==="."||ei[0]==="[")return ti.querySelector(ei);if(ni&&!isNaN(+ei[0]))return ni.getElementById(ei);let ri=ti.querySelector(ei);return ni&&!ri&&(ri=ni.getElementById(ei)),ri||(ri=ti.querySelector("."+ei)),ri}return ei}static lazyLoad(ei){var ti,ni;return ei.lazyLoad||((ni=(ti=ei.grid)==null?void 0:ti.opts)==null?void 0:ni.lazyLoad)&&ei.lazyLoad!==!1}static createDiv(ei,ti){let ni=document.createElement("div");return ei.forEach(ri=>{ri&&ni.classList.add(ri)}),ti==null||ti.appendChild(ni),ni}static shouldSizeToContent(ei,ti=!1){return(ei==null?void 0:ei.grid)&&(ti?ei.sizeToContent===!0||ei.grid.opts.sizeToContent===!0&&ei.sizeToContent===void 0:!!ei.sizeToContent||ei.grid.opts.sizeToContent&&ei.sizeToContent!==!1)}static isIntercepted(ei,ti){return!(ei.y>=ti.y+ti.h||ei.y+ei.h<=ti.y||ei.x+ei.w<=ti.x||ei.x>=ti.x+ti.w)}static isTouching(ei,ti){return ii.isIntercepted(ei,{x:ti.x-.5,y:ti.y-.5,w:ti.w+1,h:ti.h+1})}static areaIntercept(ei,ti){let ni=ei.x>ti.x?ei.x:ti.x,ri=ei.x+ei.wti.y?ei.y:ti.y,si=ei.y+ei.h{var ai,li,ci,ui;let si=ti*(((ai=ri.y)!=null?ai:1e4)-((li=oi.y)!=null?li:1e4));return si===0?ti*(((ci=ri.x)!=null?ci:1e4)-((ui=oi.x)!=null?ui:1e4)):si})}static find(ei,ti){return ti?ei.find(ni=>ni.id===ti):void 0}static createStylesheet(ei,ti,ni){let ri=document.createElement("style"),oi=ni==null?void 0:ni.nonce;return oi&&(ri.nonce=oi),ri.setAttribute("type","text/css"),ri.setAttribute("gs-style-id",ei),ri.styleSheet?ri.styleSheet.cssText="":ri.appendChild(document.createTextNode("")),ti?ti.insertBefore(ri,ti.firstChild):(ti=document.getElementsByTagName("head")[0],ti.appendChild(ri)),ri}static removeStylesheet(ei,ti){let ri=(ti||document).querySelector("STYLE[gs-style-id="+ei+"]");ri&&ri.parentNode&&ri.remove()}static addCSSRule(ei,ti,ni){ei.textContent+=`${ti} { ${ni} } `}static toBool(ei){return typeof ei=="boolean"?ei:typeof ei=="string"?(ei=ei.toLowerCase(),!(ei===""||ei==="no"||ei==="false"||ei==="0")):!!ei}static toNumber(ei){return ei===null||ei.length===0?void 0:Number(ei)}static parseHeight(ei){let ti,ni="px";if(typeof ei=="string")if(ei==="auto"||ei==="")ti=0;else{let ri=ei.match(/^(-[0-9]+\.[0-9]+|[0-9]*\.[0-9]+|-[0-9]+|[0-9]+)(px|em|rem|vh|vw|%|cm|mm)?$/);if(!ri)throw new Error(`Invalid height val = ${ei}`);ni=ri[2]||"px",ti=parseFloat(ri[1])}else ti=ei;return{h:ti,unit:ni}}static defaults(ei,...ti){return ti.forEach(ni=>{for(let ri in ni){if(!ni.hasOwnProperty(ri))return;ei[ri]===null||ei[ri]===void 0?ei[ri]=ni[ri]:typeof ni[ri]=="object"&&typeof ei[ri]=="object"&&this.defaults(ei[ri],ni[ri])}}),ei}static same(ei,ti){if(typeof ei!="object")return ei==ti;if(typeof ei!=typeof ti||Object.keys(ei).length!==Object.keys(ti).length)return!1;for(let ni in ei)if(ei[ni]!==ti[ni])return!1;return!0}static copyPos(ei,ti,ni=!1){return ti.x!==void 0&&(ei.x=ti.x),ti.y!==void 0&&(ei.y=ti.y),ti.w!==void 0&&(ei.w=ti.w),ti.h!==void 0&&(ei.h=ti.h),ni&&(ti.minW&&(ei.minW=ti.minW),ti.minH&&(ei.minH=ti.minH),ti.maxW&&(ei.maxW=ti.maxW),ti.maxH&&(ei.maxH=ti.maxH)),ei}static samePos(ei,ti){return ei&&ti&&ei.x===ti.x&&ei.y===ti.y&&(ei.w||1)===(ti.w||1)&&(ei.h||1)===(ti.h||1)}static sanitizeMinMax(ei){ei.minW||delete ei.minW,ei.minH||delete ei.minH,ei.maxW||delete ei.maxW,ei.maxH||delete ei.maxH}static removeInternalAndSame(ei,ti){if(!(typeof ei!="object"||typeof ti!="object"))for(let ni in ei){let ri=ei[ni],oi=ti[ni];ni[0]==="_"||ri===oi?delete ei[ni]:ri&&typeof ri=="object"&&oi!==void 0&&(ii.removeInternalAndSame(ri,oi),Object.keys(ri).length||delete ei[ni])}}static removeInternalForSave(ei,ti=!0){for(let ni in ei)(ni[0]==="_"||ei[ni]===null||ei[ni]===void 0)&&delete ei[ni];delete ei.grid,ti&&delete ei.el,ei.autoPosition||delete ei.autoPosition,ei.noResize||delete ei.noResize,ei.noMove||delete ei.noMove,ei.locked||delete ei.locked,(ei.w===1||ei.w===ei.minW)&&delete ei.w,(ei.h===1||ei.h===ei.minH)&&delete ei.h}static throttle(ei,ti){let ni=!1;return(...ri)=>{ni||(ni=!0,setTimeout(()=>{ei(...ri),ni=!1},ti))}}static removePositioningStyles(ei){let ti=ei.style;ti.position&&ti.removeProperty("position"),ti.left&&ti.removeProperty("left"),ti.top&&ti.removeProperty("top"),ti.width&&ti.removeProperty("width"),ti.height&&ti.removeProperty("height")}static getScrollElement(ei){if(!ei)return document.scrollingElement||document.documentElement;let ti=getComputedStyle(ei);return/(auto|scroll)/.test(ti.overflow+ti.overflowY)?ei:this.getScrollElement(ei.parentElement)}static updateScrollPosition(ei,ti,ni){let ri=ei.getBoundingClientRect(),oi=window.innerHeight||document.documentElement.clientHeight;if(ri.top<0||ri.bottom>oi){let si=ri.bottom-oi,ai=ri.top,li=this.getScrollElement(ei);if(li!==null){let ci=li.scrollTop;ri.top<0&&ni<0?ei.offsetHeight>oi?li.scrollTop+=ni:li.scrollTop+=Math.abs(ai)>Math.abs(ni)?ni:ai:ni>0&&(ei.offsetHeight>oi?li.scrollTop+=ni:li.scrollTop+=si>ni?ni:si),ti.top+=li.scrollTop-ci}}}static updateScrollResize(ei,ti,ni){let ri=this.getScrollElement(ti),oi=ri.clientHeight,si=ri===this.getScrollElement()?0:ri.getBoundingClientRect().top,ai=ei.clientY-si,li=aioi-ni;li?ri.scrollBy({behavior:"smooth",top:ai-ni}):ci&&ri.scrollBy({behavior:"smooth",top:ni-(oi-ai)})}static clone(ei){return ei==null||typeof ei!="object"?ei:ei instanceof Array?[...ei]:Si({},ei)}static cloneDeep(ei){let ti=["parentGrid","el","grid","subGrid","engine"],ni=ii.clone(ei);for(let ri in ni)ni.hasOwnProperty(ri)&&typeof ni[ri]=="object"&&ri.substring(0,2)!=="__"&&!ti.find(oi=>oi===ri)&&(ni[ri]=ii.cloneDeep(ei[ri]));return ni}static cloneNode(ei){let ti=ei.cloneNode(!0);return ti.removeAttribute("id"),ti}static appendTo(ei,ti){let ni;typeof ti=="string"?ni=ii.getElement(ti):ni=ti,ni&&ni.appendChild(ei)}static addElStyles(ei,ti){if(ti instanceof Object)for(let ni in ti)ti.hasOwnProperty(ni)&&(Array.isArray(ti[ni])?ti[ni].forEach(ri=>{ei.style[ni]=ri}):ei.style[ni]=ti[ni])}static initEvent(ei,ti){let ni={type:ti.type},ri={button:0,which:0,buttons:1,bubbles:!0,cancelable:!0,target:ti.target?ti.target:ei.target};return["altKey","ctrlKey","metaKey","shiftKey"].forEach(oi=>ni[oi]=ei[oi]),["pageX","pageY","clientX","clientY","screenX","screenY"].forEach(oi=>ni[oi]=ei[oi]),Si(Si({},ni),ri)}static simulateMouseEvent(ei,ti,ni){var si,ai,li,ci;let ri=ei,oi=new MouseEvent(ti,{bubbles:!0,composed:!0,cancelable:!0,view:window,detail:1,screenX:ei.screenX,screenY:ei.screenY,clientX:ei.clientX,clientY:ei.clientY,ctrlKey:(si=ri.ctrlKey)!=null?si:!1,altKey:(ai=ri.altKey)!=null?ai:!1,shiftKey:(li=ri.shiftKey)!=null?li:!1,metaKey:(ci=ri.metaKey)!=null?ci:!1,button:0,relatedTarget:ei.target});(ni||ei.target).dispatchEvent(oi)}static getValuesFromTransformedElement(ei){let ti=document.createElement("div");ii.addElStyles(ti,{opacity:"0",position:"fixed",top:"0px",left:"0px",width:"1px",height:"1px",zIndex:"-999999"}),ei.appendChild(ti);let ni=ti.getBoundingClientRect();return ei.removeChild(ti),ti.remove(),{xScale:1/ni.width,yScale:1/ni.height,xOffset:ni.left,yOffset:ni.top}}static swap(ei,ti,ni){if(!ei)return;let ri=ei[ti];ei[ti]=ei[ni],ei[ni]=ri}static canBeRotated(ei){var ti;return!(!ei||ei.w===ei.h||ei.locked||ei.noResize||(ti=ei.grid)!=null&&ti.opts.disableResize||ei.minW&&ei.minW===ei.maxW||ei.minH&&ei.minH===ei.maxH)}};var as=class ii{constructor(ei={}){this.addedNodes=[],this.removedNodes=[],this.defaultColumn=12,this.column=ei.column||this.defaultColumn,this.column>this.defaultColumn&&(this.defaultColumn=this.column),this.maxRow=ei.maxRow,this._float=ei.float,this.nodes=ei.nodes||[],this.onChange=ei.onChange}batchUpdate(ei=!0,ti=!0){return!!this.batchMode===ei?this:(this.batchMode=ei,ei?(this._prevFloat=this._float,this._float=!0,this.cleanNodes(),this.saveInitial()):(this._float=this._prevFloat,delete this._prevFloat,ti&&this._packNodes(),this._notify()),this)}_useEntireRowArea(ei,ti){return(!this.float||this.batchMode&&!this._prevFloat)&&!this._hasLocked&&(!ei._moving||ei._skipDown||ti.y<=ei.y)}_fixCollisions(ei,ti=ei,ni,ri={}){if(this.sortNodes(-1),ni=ni||this.collide(ei,ti),!ni)return!1;if(ei._moving&&!ri.nested&&!this.float&&this.swap(ei,ni))return!0;let oi=ti;!this._loading&&this._useEntireRowArea(ei,ti)&&(oi={x:0,w:this.column,y:ti.y,h:ti.h},ni=this.collide(ei,oi,ri.skip));let si=!1,ai={nested:!0,pack:!1},li=0;for(;ni=ni||this.collide(ei,oi,ri.skip);){if(li++>this.nodes.length*2)throw new Error("Infinite collide check");let ci;if(ni.locked||this._loading||ei._moving&&!ei._skipDown&&ti.y>ei.y&&!this.float&&(!this.collide(ni,sn(Si({},ni),{y:ei.y}),ei)||!this.collide(ni,sn(Si({},ni),{y:ti.y-ni.h}),ei))){ei._skipDown=ei._skipDown||ti.y>ei.y;let ui=Si(sn(Si({},ti),{y:ni.y+ni.h}),ai);ci=this._loading&&bi.samePos(ei,ui)?!0:this.moveNode(ei,ui),(ni.locked||this._loading)&&ci?bi.copyPos(ti,ei):!ni.locked&&ci&&ri.pack&&(this._packNodes(),ti.y=ni.y+ni.h,bi.copyPos(ei,ti)),si=si||ci}else ci=this.moveNode(ni,Si(sn(Si({},ni),{y:ti.y+ti.h,skip:ei}),ai));if(!ci)return si;ni=void 0}return si}collide(ei,ti=ei,ni){let ri=ei._id,oi=ni==null?void 0:ni._id;return this.nodes.find(si=>si._id!==ri&&si._id!==oi&&bi.isIntercepted(si,ti))}collideAll(ei,ti=ei,ni){let ri=ei._id,oi=ni==null?void 0:ni._id;return this.nodes.filter(si=>si._id!==ri&&si._id!==oi&&bi.isIntercepted(si,ti))}directionCollideCoverage(ei,ti,ni){if(!ti.rect||!ei._rect)return;let ri=ei._rect,oi=Si({},ti.rect);oi.y>ri.y?(oi.h+=oi.y-ri.y,oi.y=ri.y):oi.h+=ri.y-oi.y,oi.x>ri.x?(oi.w+=oi.x-ri.x,oi.x=ri.x):oi.w+=ri.x-oi.x;let si,ai=.5;for(let li of ni){if(li.locked||!li._rect)break;let ci=li._rect,ui=Number.MAX_VALUE,di=Number.MAX_VALUE;ri.yci.y+ci.h&&(ui=(ci.y+ci.h-oi.y)/ci.h),ri.xci.x+ci.w&&(di=(ci.x+ci.w-oi.x)/ci.w);let pi=Math.min(di,ui);pi>ai&&(ai=pi,si=li)}return ti.collide=si,si}cacheRects(ei,ti,ni,ri,oi,si){return this.nodes.forEach(ai=>ai._rect={y:ai.y*ti+ni,x:ai.x*ei+si,w:ai.w*ei-si-ri,h:ai.h*ti-ni-oi}),this}swap(ei,ti){if(!ti||ti.locked||!ei||ei.locked)return!1;function ni(){let oi=ti.x,si=ti.y;return ti.x=ei.x,ti.y=ei.y,ei.h!=ti.h?(ei.x=oi,ei.y=ti.y+ti.h):ei.w!=ti.w?(ei.x=ti.x+ti.w,ei.y=si):(ei.x=oi,ei.y=si),ei._dirty=ti._dirty=!0,!0}let ri;if(ei.w===ti.w&&ei.h===ti.h&&(ei.x===ti.x||ei.y===ti.y)&&(ri=bi.isTouching(ei,ti)))return ni();if(ri!==!1){if(ei.w===ti.w&&ei.x===ti.x&&(ri||(ri=bi.isTouching(ei,ti)))){if(ti.y{let ci;si.locked||(si.autoPosition=!0,ei==="list"&&ai&&(ci=li[ai-1])),this.addNode(si,!1,ci)}),ri||delete this._inColumnResize,ni||this.batchUpdate(!1),this}set float(ei){this._float!==ei&&(this._float=ei||!1,ei||this._packNodes()._notify())}get float(){return this._float||!1}sortNodes(ei=1){return this.nodes=bi.sort(this.nodes,ei),this}_packNodes(){return this.batchMode?this:(this.sortNodes(),this.float?this.nodes.forEach(ei=>{if(ei._updating||ei._orig===void 0||ei.y===ei._orig.y)return;let ti=ei.y;for(;ti>ei._orig.y;)--ti,this.collide(ei,{x:ei.x,y:ti,w:ei.w,h:ei.h})||(ei._dirty=!0,ei.y=ti)}):this.nodes.forEach((ei,ti)=>{if(!ei.locked)for(;ei.y>0;){let ni=ti===0?0:ei.y-1;if(!(ti===0||!this.collide(ei,{x:ei.x,y:ni,w:ei.w,h:ei.h})))break;ei._dirty=ei.y!==ni,ei.y=ni}}),this)}prepareNode(ei,ti){var oi;ei._id=(oi=ei._id)!=null?oi:ii._idSeq++;let ni=ei.id;if(ni){let si=1;for(;this.nodes.find(ai=>ai.id===ei.id&&ai!==ei);)ei.id=ni+"_"+si++}(ei.x===void 0||ei.y===void 0||ei.x===null||ei.y===null)&&(ei.autoPosition=!0);let ri={x:0,y:0,w:1,h:1};return bi.defaults(ei,ri),ei.autoPosition||delete ei.autoPosition,ei.noResize||delete ei.noResize,ei.noMove||delete ei.noMove,bi.sanitizeMinMax(ei),typeof ei.x=="string"&&(ei.x=Number(ei.x)),typeof ei.y=="string"&&(ei.y=Number(ei.y)),typeof ei.w=="string"&&(ei.w=Number(ei.w)),typeof ei.h=="string"&&(ei.h=Number(ei.h)),isNaN(ei.x)&&(ei.x=ri.x,ei.autoPosition=!0),isNaN(ei.y)&&(ei.y=ri.y,ei.autoPosition=!0),isNaN(ei.w)&&(ei.w=ri.w),isNaN(ei.h)&&(ei.h=ri.h),this.nodeBoundFix(ei,ti),ei}nodeBoundFix(ei,ti){let ni=ei._orig||bi.copyPos({},ei);if(ei.maxW&&(ei.w=Math.min(ei.w||1,ei.maxW)),ei.maxH&&(ei.h=Math.min(ei.h||1,ei.maxH)),ei.minW&&(ei.w=Math.max(ei.w||1,ei.minW)),ei.minH&&(ei.h=Math.max(ei.h||1,ei.minH)),(ei.x||0)+(ei.w||1)>this.column&&this.columnthis.column?ei.w=this.column:ei.w<1&&(ei.w=1),this.maxRow&&ei.h>this.maxRow?ei.h=this.maxRow:ei.h<1&&(ei.h=1),ei.x<0&&(ei.x=0),ei.y<0&&(ei.y=0),ei.x+ei.w>this.column&&(ti?ei.w=this.column-ei.x:ei.x=this.column-ei.w),this.maxRow&&ei.y+ei.h>this.maxRow&&(ti?ei.h=this.maxRow-ei.y:ei.y=this.maxRow-ei.h),bi.samePos(ei,ni)||(ei._dirty=!0),this}getDirtyNodes(ei){return ei?this.nodes.filter(ti=>ti._dirty&&!bi.samePos(ti,ti._orig)):this.nodes.filter(ti=>ti._dirty)}_notify(ei){if(this.batchMode||!this.onChange)return this;let ti=(ei||[]).concat(this.getDirtyNodes());return this.onChange(ti),this}cleanNodes(){return this.batchMode?this:(this.nodes.forEach(ei=>{delete ei._dirty,delete ei._lastTried}),this)}saveInitial(){return this.nodes.forEach(ei=>{ei._orig=bi.copyPos({},ei),delete ei._dirty}),this._hasLocked=this.nodes.some(ei=>ei.locked),this}restoreInitial(){return this.nodes.forEach(ei=>{!ei._orig||bi.samePos(ei,ei._orig)||(bi.copyPos(ei,ei._orig),ei._dirty=!0)}),this._notify(),this}findEmptyPosition(ei,ti=this.nodes,ni=this.column,ri){let oi=ri?ri.y*ni+(ri.x+ri.w):0,si=!1;for(let ai=oi;!si;++ai){let li=ai%ni,ci=Math.floor(ai/ni);if(li+ei.w>ni)continue;let ui={x:li,y:ci,w:ei.w,h:ei.h};ti.find(di=>bi.isIntercepted(ui,di))||((ei.x!==li||ei.y!==ci)&&(ei._dirty=!0),ei.x=li,ei.y=ci,delete ei.autoPosition,si=!0)}return si}addNode(ei,ti=!1,ni){let ri=this.nodes.find(si=>si._id===ei._id);if(ri)return ri;this._inColumnResize?this.nodeBoundFix(ei):this.prepareNode(ei),delete ei._temporaryRemoved,delete ei._removeDOM;let oi;return ei.autoPosition&&this.findEmptyPosition(ei,this.nodes,this.column,ni)&&(delete ei.autoPosition,oi=!0),this.nodes.push(ei),ti&&this.addedNodes.push(ei),oi||this._fixCollisions(ei),this.batchMode||this._packNodes()._notify(),ei}removeNode(ei,ti=!0,ni=!1){return this.nodes.find(ri=>ri._id===ei._id)?(ni&&this.removedNodes.push(ei),ti&&(ei._removeDOM=!0),this.nodes=this.nodes.filter(ri=>ri._id!==ei._id),ei._isAboutToRemove||this._packNodes(),this._notify([ei]),this):this}removeAll(ei=!0,ti=!0){if(delete this._layouts,!this.nodes.length)return this;ei&&this.nodes.forEach(ri=>ri._removeDOM=!0);let ni=this.nodes;return this.removedNodes=ti?ni:[],this.nodes=[],this._notify(ni)}moveNodeCheck(ei,ti){if(!this.changedPosConstrain(ei,ti))return!1;if(ti.pack=!0,!this.maxRow)return this.moveNode(ei,ti);let ni,ri=new ii({column:this.column,float:this.float,nodes:this.nodes.map(si=>si._id===ei._id?(ni=Si({},si),ni):Si({},si))});if(!ni)return!1;let oi=ri.moveNode(ni,ti)&&ri.getRow()<=Math.max(this.getRow(),this.maxRow);if(!oi&&!ti.resizing&&ti.collide){let si=ti.collide.el.gridstackNode;if(this.swap(ei,si))return this._notify(),!0}return oi?(ri.nodes.filter(si=>si._dirty).forEach(si=>{let ai=this.nodes.find(li=>li._id===si._id);ai&&(bi.copyPos(ai,si),ai._dirty=!0)}),this._notify(),!0):!1}willItFit(ei){if(delete ei._willFitPos,!this.maxRow)return!0;let ti=new ii({column:this.column,float:this.float,nodes:this.nodes.map(ri=>Si({},ri))}),ni=Si({},ei);return this.cleanupNode(ni),delete ni.el,delete ni._id,delete ni.content,delete ni.grid,ti.addNode(ni),ti.getRow()<=this.maxRow?(ei._willFitPos=bi.copyPos({},ni),!0):!1}changedPosConstrain(ei,ti){return ti.w=ti.w||ei.w,ti.h=ti.h||ei.h,ei.x!==ti.x||ei.y!==ti.y?!0:(ei.maxW&&(ti.w=Math.min(ti.w,ei.maxW)),ei.maxH&&(ti.h=Math.min(ti.h,ei.maxH)),ei.minW&&(ti.w=Math.max(ti.w,ei.minW)),ei.minH&&(ti.h=Math.max(ti.h,ei.minH)),ei.w!==ti.w||ei.h!==ti.h)}moveNode(ei,ti){var ci,ui;if(!ei||!ti)return!1;let ni;ti.pack===void 0&&!this.batchMode&&(ni=ti.pack=!0),typeof ti.x!="number"&&(ti.x=ei.x),typeof ti.y!="number"&&(ti.y=ei.y),typeof ti.w!="number"&&(ti.w=ei.w),typeof ti.h!="number"&&(ti.h=ei.h);let ri=ei.w!==ti.w||ei.h!==ti.h,oi=bi.copyPos({},ei,!0);if(bi.copyPos(oi,ti),this.nodeBoundFix(oi,ri),bi.copyPos(ti,oi),!ti.forceCollide&&bi.samePos(ei,ti))return!1;let si=bi.copyPos({},ei),ai=this.collideAll(ei,oi,ti.skip),li=!0;if(ai.length){let di=ei._moving&&!ti.nested,pi=di?this.directionCollideCoverage(ei,ti,ai):ai[0];if(di&&pi&&((ui=(ci=ei.grid)==null?void 0:ci.opts)!=null&&ui.subGridDynamic)&&!ei.grid._isTemp){let yi=bi.areaIntercept(ti.rect,pi._rect),gi=bi.area(ti.rect),vi=bi.area(pi._rect);yi/(gi.8&&(pi.grid.makeSubGrid(pi.el,void 0,ei),pi=void 0)}pi?li=!this._fixCollisions(ei,oi,pi,ti):(li=!1,ni&&delete ti.pack)}return li&&!bi.samePos(ei,oi)&&(ei._dirty=!0,bi.copyPos(ei,oi)),ti.pack&&this._packNodes()._notify(),!bi.samePos(ei,si)}getRow(){return this.nodes.reduce((ei,ti)=>Math.max(ei,ti.y+ti.h),0)}beginUpdate(ei){return ei._updating||(ei._updating=!0,delete ei._skipDown,this.batchMode||this.saveInitial()),this}endUpdate(){let ei=this.nodes.find(ti=>ti._updating);return ei&&(delete ei._updating,delete ei._skipDown),this}save(ei=!0,ti){var si;let ni=(si=this._layouts)==null?void 0:si.length,ri=ni&&this.column!==ni-1?this._layouts[ni-1]:null,oi=[];return this.sortNodes(),this.nodes.forEach(ai=>{let li=ri==null?void 0:ri.find(ui=>ui._id===ai._id),ci=Si(Si({},ai),li||{});bi.removeInternalForSave(ci,!ei),ti&&ti(ai,ci),oi.push(ci)}),oi}layoutsNodesChange(ei){return!this._layouts||this._inColumnResize?this:(this._layouts.forEach((ti,ni)=>{if(!ti||ni===this.column)return this;if(ni{if(!oi._orig)return;let si=ti.find(ai=>ai._id===oi._id);si&&(si.y>=0&&oi.y!==oi._orig.y&&(si.y+=oi.y-oi._orig.y),oi.x!==oi._orig.x&&(si.x=Math.round(oi.x*ri)),oi.w!==oi._orig.w&&(si.w=Math.round(oi.w*ri)))})}}),this)}columnChanged(ei,ti,ni="moveScale"){var ai;if(!this.nodes.length||!ti||ei===ti)return this;let ri=ni==="compact"||ni==="list";ri&&this.sortNodes(1),tiei&&this._layouts){let li=this._layouts[ti]||[],ci=this._layouts.length-1;!li.length&&ei!==ci&&((ai=this._layouts[ci])!=null&&ai.length)&&(ei=ci,this._layouts[ci].forEach(ui=>{var pi,yi,gi;let di=si.find(vi=>vi._id===ui._id);di&&(!ri&&!ui.autoPosition&&(di.x=(pi=ui.x)!=null?pi:di.x,di.y=(yi=ui.y)!=null?yi:di.y),di.w=(gi=ui.w)!=null?gi:di.w,(ui.x==null||ui.y===void 0)&&(di.autoPosition=!0))})),li.forEach(ui=>{var pi,yi,gi;let di=si.findIndex(vi=>vi._id===ui._id);if(di!==-1){let vi=si[di];if(ri){vi.w=ui.w;return}(ui.autoPosition||isNaN(ui.x)||isNaN(ui.y))&&this.findEmptyPosition(ui,oi),ui.autoPosition||(vi.x=(pi=ui.x)!=null?pi:vi.x,vi.y=(yi=ui.y)!=null?yi:vi.y,vi.w=(gi=ui.w)!=null?gi:vi.w,oi.push(vi)),si.splice(di,1)}})}if(ri)this.compact(ni,!1);else{if(si.length)if(typeof ni=="function")ni(ti,ei,oi,si);else{let li=ri||ni==="none"?1:ti/ei,ci=ni==="move"||ni==="moveScale",ui=ni==="scale"||ni==="moveScale";si.forEach(di=>{di.x=ti===1?0:ci?Math.round(di.x*li):Math.min(di.x,ti-1),di.w=ti===1||ei===1?1:ui?Math.round(di.w*li)||1:Math.min(di.w,ti),oi.push(di)}),si=[]}oi=bi.sort(oi,-1),this._inColumnResize=!0,this.nodes=[],oi.forEach(li=>{this.addNode(li,!1),delete li._orig})}return this.nodes.forEach(li=>delete li._orig),this.batchUpdate(!1,!ri),delete this._inColumnResize,this}cacheLayout(ei,ti,ni=!1){let ri=[];return ei.forEach((oi,si)=>{var ai;if(oi._id===void 0){let li=oi.id?this.nodes.find(ci=>ci.id===oi.id):void 0;oi._id=(ai=li==null?void 0:li._id)!=null?ai:ii._idSeq++}ri[si]={x:oi.x,y:oi.y,w:oi.w,_id:oi._id}}),this._layouts=ni?[]:this._layouts||[],this._layouts[ti]=ri,this}cacheOneLayout(ei,ti){var oi;ei._id=(oi=ei._id)!=null?oi:ii._idSeq++;let ni={x:ei.x,y:ei.y,w:ei.w,_id:ei._id};(ei.autoPosition||ei.x===void 0)&&(delete ni.x,delete ni.y,ei.autoPosition&&(ni.autoPosition=!0)),this._layouts=this._layouts||[],this._layouts[ti]=this._layouts[ti]||[];let ri=this.findCacheLayout(ei,ti);return ri===-1?this._layouts[ti].push(ni):this._layouts[ti][ri]=ni,this}findCacheLayout(ei,ti){var ni,ri,oi;return(oi=(ri=(ni=this._layouts)==null?void 0:ni[ti])==null?void 0:ri.findIndex(si=>si._id===ei._id))!=null?oi:-1}removeNodeFromLayoutCache(ei){if(this._layouts)for(let ti=0;ti0||navigator.msMaxTouchPoints>0),Jr=class{};function Ml(ii,ei){ii.touches.length>1||(ii.cancelable&&ii.preventDefault(),bi.simulateMouseEvent(ii.changedTouches[0],ei))}function Sh(ii,ei){ii.cancelable&&ii.preventDefault(),bi.simulateMouseEvent(ii,ei)}function Is(ii){Jr.touchHandled||(Jr.touchHandled=!0,Ml(ii,"mousedown"))}function Hs(ii){Jr.touchHandled&&Ml(ii,"mousemove")}function Ps(ii){if(!Jr.touchHandled)return;Jr.pointerLeaveTimeout&&(window.clearTimeout(Jr.pointerLeaveTimeout),delete Jr.pointerLeaveTimeout);let ei=!!Bi.dragElement;Ml(ii,"mouseup"),ei||Ml(ii,"click"),Jr.touchHandled=!1}function Fs(ii){ii.pointerType!=="mouse"&&ii.target.releasePointerCapture(ii.pointerId)}function eu(ii){Bi.dragElement&&ii.pointerType!=="mouse"&&Sh(ii,"mouseenter")}function tu(ii){Bi.dragElement&&ii.pointerType!=="mouse"&&(Jr.pointerLeaveTimeout=window.setTimeout(()=>{delete Jr.pointerLeaveTimeout,Sh(ii,"mouseleave")},10))}var Ea=class ii{constructor(ei,ti,ni){this.host=ei,this.dir=ti,this.option=ni,this.moving=!1,this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this._init()}_init(){let ei=this.el=document.createElement("div");return ei.classList.add("ui-resizable-handle"),ei.classList.add(`${ii.prefix}${this.dir}`),ei.style.zIndex="100",ei.style.userSelect="none",this.host.appendChild(this.el),this.el.addEventListener("mousedown",this._mouseDown),$n&&(this.el.addEventListener("touchstart",Is),this.el.addEventListener("pointerdown",Fs)),this}destroy(){return this.moving&&this._mouseUp(this.mouseDownEvent),this.el.removeEventListener("mousedown",this._mouseDown),$n&&(this.el.removeEventListener("touchstart",Is),this.el.removeEventListener("pointerdown",Fs)),this.host.removeChild(this.el),delete this.el,delete this.host,this}_mouseDown(ei){this.mouseDownEvent=ei,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),$n&&(this.el.addEventListener("touchmove",Hs),this.el.addEventListener("touchend",Ps)),ei.stopPropagation(),ei.preventDefault()}_mouseMove(ei){let ti=this.mouseDownEvent;this.moving?this._triggerEvent("move",ei):Math.abs(ei.x-ti.x)+Math.abs(ei.y-ti.y)>2&&(this.moving=!0,this._triggerEvent("start",this.mouseDownEvent),this._triggerEvent("move",ei),document.addEventListener("keydown",this._keyEvent)),ei.stopPropagation()}_mouseUp(ei){this.moving&&(this._triggerEvent("stop",ei),document.removeEventListener("keydown",this._keyEvent)),document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),$n&&(this.el.removeEventListener("touchmove",Hs),this.el.removeEventListener("touchend",Ps)),delete this.moving,delete this.mouseDownEvent,ei.stopPropagation(),ei.preventDefault()}_keyEvent(ei){var ti,ni;ei.key==="Escape"&&((ni=(ti=this.host.gridstackNode)==null?void 0:ti.grid)==null||ni.engine.restoreInitial(),this._mouseUp(this.mouseDownEvent))}_triggerEvent(ei,ti){return this.option[ei]&&this.option[ei](ti),this}};Ea.prefix="ui-resizable-";var zo=class{constructor(){this._eventRegister={}}get disabled(){return this._disabled}on(ei,ti){this._eventRegister[ei]=ti}off(ei){delete this._eventRegister[ei]}enable(){this._disabled=!1}disable(){this._disabled=!0}destroy(){delete this._eventRegister}triggerEvent(ei,ti){if(!this.disabled&&this._eventRegister&&this._eventRegister[ei])return this._eventRegister[ei](ti)}};var wa=class ii extends zo{constructor(ei,ti={}){super(),this.el=ei,this.option=ti,this.rectScale={x:1,y:1},this._ui=()=>{let ri=this.el.parentElement.getBoundingClientRect(),oi={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},si=this.temporalRect||oi;return{position:{left:(si.left-ri.left)*this.rectScale.x,top:(si.top-ri.top)*this.rectScale.y},size:{width:si.width*this.rectScale.x,height:si.height*this.rectScale.y}}},this._mouseOver=this._mouseOver.bind(this),this._mouseOut=this._mouseOut.bind(this),this.enable(),this._setupAutoHide(this.option.autoHide),this._setupHandlers()}on(ei,ti){super.on(ei,ti)}off(ei){super.off(ei)}enable(){super.enable(),this.el.classList.remove("ui-resizable-disabled"),this._setupAutoHide(this.option.autoHide)}disable(){super.disable(),this.el.classList.add("ui-resizable-disabled"),this._setupAutoHide(!1)}destroy(){this._removeHandlers(),this._setupAutoHide(!1),delete this.el,super.destroy()}updateOption(ei){let ti=ei.handles&&ei.handles!==this.option.handles,ni=ei.autoHide&&ei.autoHide!==this.option.autoHide;return Object.keys(ei).forEach(ri=>this.option[ri]=ei[ri]),ti&&(this._removeHandlers(),this._setupHandlers()),ni&&this._setupAutoHide(this.option.autoHide),this}_setupAutoHide(ei){return ei?(this.el.classList.add("ui-resizable-autohide"),this.el.addEventListener("mouseover",this._mouseOver),this.el.addEventListener("mouseout",this._mouseOut)):(this.el.classList.remove("ui-resizable-autohide"),this.el.removeEventListener("mouseover",this._mouseOver),this.el.removeEventListener("mouseout",this._mouseOut),Bi.overResizeElement===this&&delete Bi.overResizeElement),this}_mouseOver(ei){Bi.overResizeElement||Bi.dragElement||(Bi.overResizeElement=this,this.el.classList.remove("ui-resizable-autohide"))}_mouseOut(ei){Bi.overResizeElement===this&&(delete Bi.overResizeElement,this.el.classList.add("ui-resizable-autohide"))}_setupHandlers(){return this.handlers=this.option.handles.split(",").map(ei=>ei.trim()).map(ei=>new Ea(this.el,ei,{start:ti=>{this._resizeStart(ti)},stop:ti=>{this._resizeStop(ti)},move:ti=>{this._resizing(ti,ei)}})),this}_resizeStart(ei){this.sizeToContent=bi.shouldSizeToContent(this.el.gridstackNode,!0),this.originalRect=this.el.getBoundingClientRect(),this.scrollEl=bi.getScrollElement(this.el),this.scrollY=this.scrollEl.scrollTop,this.scrolled=0,this.startEvent=ei,this._setupHelper(),this._applyChange();let ti=bi.initEvent(ei,{type:"resizestart",target:this.el});return this.option.start&&this.option.start(ti,this._ui()),this.el.classList.add("ui-resizable-resizing"),this.triggerEvent("resizestart",ti),this}_resizing(ei,ti){this.scrolled=this.scrollEl.scrollTop-this.scrollY,this.temporalRect=this._getChange(ei,ti),this._applyChange();let ni=bi.initEvent(ei,{type:"resize",target:this.el});return this.option.resize&&this.option.resize(ni,this._ui()),this.triggerEvent("resize",ni),this}_resizeStop(ei){let ti=bi.initEvent(ei,{type:"resizestop",target:this.el});return this.option.stop&&this.option.stop(ti),this.el.classList.remove("ui-resizable-resizing"),this.triggerEvent("resizestop",ti),this._cleanHelper(),delete this.startEvent,delete this.originalRect,delete this.temporalRect,delete this.scrollY,delete this.scrolled,this}_setupHelper(){this.elOriginStyleVal=ii._originStyleProp.map(ni=>this.el.style[ni]),this.parentOriginStylePosition=this.el.parentElement.style.position;let ei=this.el.parentElement,ti=bi.getValuesFromTransformedElement(ei);return this.rectScale={x:ti.xScale,y:ti.yScale},getComputedStyle(this.el.parentElement).position.match(/static/)&&(this.el.parentElement.style.position="relative"),this.el.style.position="absolute",this.el.style.opacity="0.8",this}_cleanHelper(){return ii._originStyleProp.forEach((ei,ti)=>{this.el.style[ei]=this.elOriginStyleVal[ti]||null}),this.el.parentElement.style.position=this.parentOriginStylePosition||null,this}_getChange(ei,ti){let ni=this.startEvent,ri={width:this.originalRect.width,height:this.originalRect.height+this.scrolled,left:this.originalRect.left,top:this.originalRect.top-this.scrolled},oi=ei.clientX-ni.clientX,si=this.sizeToContent?0:ei.clientY-ni.clientY,ai,li;ti.indexOf("e")>-1?ri.width+=oi:ti.indexOf("w")>-1&&(ri.width-=oi,ri.left+=oi,ai=!0),ti.indexOf("s")>-1?ri.height+=si:ti.indexOf("n")>-1&&(ri.height-=si,ri.top+=si,li=!0);let ci=this._constrainSize(ri.width,ri.height,ai,li);return Math.round(ri.width)!==Math.round(ci.width)&&(ti.indexOf("w")>-1&&(ri.left+=ri.width-ci.width),ri.width=ci.width),Math.round(ri.height)!==Math.round(ci.height)&&(ti.indexOf("n")>-1&&(ri.top+=ri.height-ci.height),ri.height=ci.height),ri}_constrainSize(ei,ti,ni,ri){let oi=this.option,si=(ni?oi.maxWidthMoveLeft:oi.maxWidth)||Number.MAX_SAFE_INTEGER,ai=oi.minWidth/this.rectScale.x||ei,li=(ri?oi.maxHeightMoveUp:oi.maxHeight)||Number.MAX_SAFE_INTEGER,ci=oi.minHeight/this.rectScale.y||ti,ui=Math.min(si,Math.max(ai,ei)),di=Math.min(li,Math.max(ci,ti));return{width:ui,height:di}}_applyChange(){let ei={left:0,top:0,width:0,height:0};if(this.el.style.position==="absolute"){let ti=this.el.parentElement,{left:ni,top:ri}=ti.getBoundingClientRect();ei={left:ni,top:ri,width:0,height:0}}return this.temporalRect?(Object.keys(this.temporalRect).forEach(ti=>{let ni=this.temporalRect[ti],ri=ti==="width"||ti==="left"?this.rectScale.x:ti==="height"||ti==="top"?this.rectScale.y:1;this.el.style[ti]=(ni-ei[ti])*ri+"px"}),this):this}_removeHandlers(){return this.handlers.forEach(ei=>ei.destroy()),delete this.handlers,this}};wa._originStyleProp=["width","height","position","left","top","opacity","zIndex"];var j_='input,textarea,button,select,option,[contenteditable="true"],.ui-resizable-handle',xa=class ii extends zo{constructor(ei,ti={}){var oi;super(),this.el=ei,this.option=ti,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0};let ni=(oi=ti==null?void 0:ti.handle)==null?void 0:oi.substring(1),ri=ei.gridstackNode;this.dragEls=!ni||ei.classList.contains(ni)?[ei]:ri!=null&&ri.subGrid?[ei.querySelector(ti.handle)||ei]:Array.from(ei.querySelectorAll(ti.handle)),this.dragEls.length===0&&(this.dragEls=[ei]),this._mouseDown=this._mouseDown.bind(this),this._mouseMove=this._mouseMove.bind(this),this._mouseUp=this._mouseUp.bind(this),this._keyEvent=this._keyEvent.bind(this),this.enable()}on(ei,ti){super.on(ei,ti)}off(ei){super.off(ei)}enable(){this.disabled!==!1&&(super.enable(),this.dragEls.forEach(ei=>{ei.addEventListener("mousedown",this._mouseDown),$n&&(ei.addEventListener("touchstart",Is),ei.addEventListener("pointerdown",Fs))}),this.el.classList.remove("ui-draggable-disabled"))}disable(ei=!1){this.disabled!==!0&&(super.disable(),this.dragEls.forEach(ti=>{ti.removeEventListener("mousedown",this._mouseDown),$n&&(ti.removeEventListener("touchstart",Is),ti.removeEventListener("pointerdown",Fs))}),ei||this.el.classList.add("ui-draggable-disabled"))}destroy(){this.dragTimeout&&window.clearTimeout(this.dragTimeout),delete this.dragTimeout,this.mouseDownEvent&&this._mouseUp(this.mouseDownEvent),this.disable(!0),delete this.el,delete this.helper,delete this.option,super.destroy()}updateOption(ei){return Object.keys(ei).forEach(ti=>this.option[ti]=ei[ti]),this}_mouseDown(ei){if(!Bi.mouseHandled)return ei.button!==0||!this.dragEls.find(ti=>ti===ei.target)&&ei.target.closest(j_)||this.option.cancel&&ei.target.closest(this.option.cancel)||(this.mouseDownEvent=ei,delete this.dragging,delete Bi.dragElement,delete Bi.dropElement,document.addEventListener("mousemove",this._mouseMove,{capture:!0,passive:!0}),document.addEventListener("mouseup",this._mouseUp,!0),$n&&(ei.currentTarget.addEventListener("touchmove",Hs),ei.currentTarget.addEventListener("touchend",Ps)),ei.preventDefault(),document.activeElement&&document.activeElement.blur(),Bi.mouseHandled=!0),!0}_callDrag(ei){if(!this.dragging)return;let ti=bi.initEvent(ei,{target:this.el,type:"drag"});this.option.drag&&this.option.drag(ti,this.ui()),this.triggerEvent("drag",ti)}_mouseMove(ei){var ni;let ti=this.mouseDownEvent;if(this.lastDrag=ei,this.dragging)if(this._dragFollow(ei),Bi.pauseDrag){let ri=Number.isInteger(Bi.pauseDrag)?Bi.pauseDrag:100;this.dragTimeout&&window.clearTimeout(this.dragTimeout),this.dragTimeout=window.setTimeout(()=>this._callDrag(ei),ri)}else this._callDrag(ei);else if(Math.abs(ei.x-ti.x)+Math.abs(ei.y-ti.y)>3){this.dragging=!0,Bi.dragElement=this;let ri=(ni=this.el.gridstackNode)==null?void 0:ni.grid;ri?Bi.dropElement=ri.el.ddElement.ddDroppable:delete Bi.dropElement,this.helper=this._createHelper(),this._setupHelperContainmentStyle(),this.dragTransform=bi.getValuesFromTransformedElement(this.helperContainment),this.dragOffset=this._getDragOffset(ei,this.el,this.helperContainment),this._setupHelperStyle(ei);let oi=bi.initEvent(ei,{target:this.el,type:"dragstart"});this.option.start&&this.option.start(oi,this.ui()),this.triggerEvent("dragstart",oi),document.addEventListener("keydown",this._keyEvent)}return!0}_mouseUp(ei){var ti,ni;if(document.removeEventListener("mousemove",this._mouseMove,!0),document.removeEventListener("mouseup",this._mouseUp,!0),$n&&ei.currentTarget&&(ei.currentTarget.removeEventListener("touchmove",Hs,!0),ei.currentTarget.removeEventListener("touchend",Ps,!0)),this.dragging){delete this.dragging,(ti=this.el.gridstackNode)==null||delete ti._origRotate,document.removeEventListener("keydown",this._keyEvent),((ni=Bi.dropElement)==null?void 0:ni.el)===this.el.parentElement&&delete Bi.dropElement,this.helperContainment.style.position=this.parentOriginStylePosition||null,this.helper!==this.el&&this.helper.remove(),this._removeHelperStyle();let ri=bi.initEvent(ei,{target:this.el,type:"dragstop"});this.option.stop&&this.option.stop(ri),this.triggerEvent("dragstop",ri),Bi.dropElement&&Bi.dropElement.drop(ei)}delete this.helper,delete this.mouseDownEvent,delete Bi.dragElement,delete Bi.dropElement,delete Bi.mouseHandled,ei.preventDefault()}_keyEvent(ei){var ri,oi;let ti=this.el.gridstackNode,ni=(ti==null?void 0:ti.grid)||((oi=(ri=Bi.dropElement)==null?void 0:ri.el)==null?void 0:oi.gridstack);if(ei.key==="Escape")ti&&ti._origRotate&&(ti._orig=ti._origRotate,delete ti._origRotate),ni==null||ni.cancelDrag(),this._mouseUp(this.mouseDownEvent);else if(ti&&ni&&(ei.key==="r"||ei.key==="R")){if(!bi.canBeRotated(ti))return;ti._origRotate=ti._origRotate||Si({},ti._orig),delete ti._moving,ni.setAnimation(!1).rotate(ti.el,{top:-this.dragOffset.offsetTop,left:-this.dragOffset.offsetLeft}).setAnimation(),ti._moving=!0,this.dragOffset=this._getDragOffset(this.lastDrag,ti.el,this.helperContainment),this.helper.style.width=this.dragOffset.width+"px",this.helper.style.height=this.dragOffset.height+"px",bi.swap(ti._orig,"w","h"),delete ti._rect,this._mouseMove(this.lastDrag)}}_createHelper(){let ei=this.el;return typeof this.option.helper=="function"?ei=this.option.helper(this.el):this.option.helper==="clone"&&(ei=bi.cloneNode(this.el)),ei.parentElement||bi.appendTo(ei,this.option.appendTo==="parent"?this.el.parentElement:this.option.appendTo),this.dragElementOriginStyle=ii.originStyleProp.map(ti=>this.el.style[ti]),ei}_setupHelperStyle(ei){this.helper.classList.add("ui-draggable-dragging");let ti=this.helper.style;return ti.pointerEvents="none",ti.width=this.dragOffset.width+"px",ti.height=this.dragOffset.height+"px",ti.willChange="left, top",ti.position="fixed",this._dragFollow(ei),ti.transition="none",setTimeout(()=>{this.helper&&(ti.transition=null)},0),this}_removeHelperStyle(){var ti;this.helper.classList.remove("ui-draggable-dragging");let ei=(ti=this.helper)==null?void 0:ti.gridstackNode;if(!(ei!=null&&ei._isAboutToRemove)&&this.dragElementOriginStyle){let ni=this.helper,ri=this.dragElementOriginStyle.transition||null;ni.style.transition=this.dragElementOriginStyle.transition="none",ii.originStyleProp.forEach(oi=>ni.style[oi]=this.dragElementOriginStyle[oi]||null),setTimeout(()=>ni.style.transition=ri,50)}return delete this.dragElementOriginStyle,this}_dragFollow(ei){let ti={left:0,top:0},ni=this.helper.style,ri=this.dragOffset;ni.left=(ei.clientX+ri.offsetLeft-ti.left)*this.dragTransform.xScale+"px",ni.top=(ei.clientY+ri.offsetTop-ti.top)*this.dragTransform.yScale+"px"}_setupHelperContainmentStyle(){return this.helperContainment=this.helper.parentElement,this.helper.style.position!=="fixed"&&(this.parentOriginStylePosition=this.helperContainment.style.position,getComputedStyle(this.helperContainment).position.match(/static/)&&(this.helperContainment.style.position="relative")),this}_getDragOffset(ei,ti,ni){let ri=0,oi=0;ni&&(ri=this.dragTransform.xOffset,oi=this.dragTransform.yOffset);let si=ti.getBoundingClientRect();return{left:si.left,top:si.top,offsetLeft:-ei.clientX+si.left-ri,offsetTop:-ei.clientY+si.top-oi,width:si.width*this.dragTransform.xScale,height:si.height*this.dragTransform.yScale}}ui(){let ti=this.el.parentElement.getBoundingClientRect(),ni=this.helper.getBoundingClientRect();return{position:{top:(ni.top-ti.top)*this.dragTransform.yScale,left:(ni.left-ti.left)*this.dragTransform.xScale}}}};xa.originStyleProp=["width","height","transform","transform-origin","transition","pointerEvents","position","left","top","minWidth","willChange"];var kl=class extends zo{constructor(ei,ti={}){super(),this.el=ei,this.option=ti,this._mouseEnter=this._mouseEnter.bind(this),this._mouseLeave=this._mouseLeave.bind(this),this.enable(),this._setupAccept()}on(ei,ti){super.on(ei,ti)}off(ei){super.off(ei)}enable(){this.disabled!==!1&&(super.enable(),this.el.classList.add("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),this.el.addEventListener("mouseenter",this._mouseEnter),this.el.addEventListener("mouseleave",this._mouseLeave),$n&&(this.el.addEventListener("pointerenter",eu),this.el.addEventListener("pointerleave",tu)))}disable(ei=!1){this.disabled!==!0&&(super.disable(),this.el.classList.remove("ui-droppable"),ei||this.el.classList.add("ui-droppable-disabled"),this.el.removeEventListener("mouseenter",this._mouseEnter),this.el.removeEventListener("mouseleave",this._mouseLeave),$n&&(this.el.removeEventListener("pointerenter",eu),this.el.removeEventListener("pointerleave",tu)))}destroy(){this.disable(!0),this.el.classList.remove("ui-droppable"),this.el.classList.remove("ui-droppable-disabled"),super.destroy()}updateOption(ei){return Object.keys(ei).forEach(ti=>this.option[ti]=ei[ti]),this._setupAccept(),this}_mouseEnter(ei){if(!Bi.dragElement||!this._canDrop(Bi.dragElement.el))return;ei.preventDefault(),ei.stopPropagation(),Bi.dropElement&&Bi.dropElement!==this&&Bi.dropElement._mouseLeave(ei,!0),Bi.dropElement=this;let ti=bi.initEvent(ei,{target:this.el,type:"dropover"});this.option.over&&this.option.over(ti,this._ui(Bi.dragElement)),this.triggerEvent("dropover",ti),this.el.classList.add("ui-droppable-over")}_mouseLeave(ei,ti=!1){var ri;if(!Bi.dragElement||Bi.dropElement!==this)return;ei.preventDefault(),ei.stopPropagation();let ni=bi.initEvent(ei,{target:this.el,type:"dropout"});if(this.option.out&&this.option.out(ni,this._ui(Bi.dragElement)),this.triggerEvent("dropout",ni),Bi.dropElement===this&&(delete Bi.dropElement,!ti)){let oi,si=this.el.parentElement;for(;!oi&&si;)oi=(ri=si.ddElement)==null?void 0:ri.ddDroppable,si=si.parentElement;oi&&oi._mouseEnter(ei)}}drop(ei){ei.preventDefault();let ti=bi.initEvent(ei,{target:this.el,type:"drop"});this.option.drop&&this.option.drop(ti,this._ui(Bi.dragElement)),this.triggerEvent("drop",ti)}_canDrop(ei){return ei&&(!this.accept||this.accept(ei))}_setupAccept(){return this.option.accept?(typeof this.option.accept=="string"?this.accept=ei=>ei.classList.contains(this.option.accept)||ei.matches(this.option.accept):this.accept=this.option.accept,this):this}_ui(ei){return Si({draggable:ei.el},ei.ui())}};var Nl=class ii{static init(ei){return ei.ddElement||(ei.ddElement=new ii(ei)),ei.ddElement}constructor(ei){this.el=ei}on(ei,ti){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(ei)>-1?this.ddDraggable.on(ei,ti):this.ddDroppable&&["drop","dropover","dropout"].indexOf(ei)>-1?this.ddDroppable.on(ei,ti):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(ei)>-1&&this.ddResizable.on(ei,ti),this}off(ei){return this.ddDraggable&&["drag","dragstart","dragstop"].indexOf(ei)>-1?this.ddDraggable.off(ei):this.ddDroppable&&["drop","dropover","dropout"].indexOf(ei)>-1?this.ddDroppable.off(ei):this.ddResizable&&["resizestart","resize","resizestop"].indexOf(ei)>-1&&this.ddResizable.off(ei),this}setupDraggable(ei){return this.ddDraggable?this.ddDraggable.updateOption(ei):this.ddDraggable=new xa(this.el,ei),this}cleanDraggable(){return this.ddDraggable&&(this.ddDraggable.destroy(),delete this.ddDraggable),this}setupResizable(ei){return this.ddResizable?this.ddResizable.updateOption(ei):this.ddResizable=new wa(this.el,ei),this}cleanResizable(){return this.ddResizable&&(this.ddResizable.destroy(),delete this.ddResizable),this}setupDroppable(ei){return this.ddDroppable?this.ddDroppable.updateOption(ei):this.ddDroppable=new kl(this.el,ei),this}cleanDroppable(){return this.ddDroppable&&(this.ddDroppable.destroy(),delete this.ddDroppable),this}};var Rl=class{resizable(ei,ti,ni,ri){return this._getDDElements(ei,ti).forEach(oi=>{if(ti==="disable"||ti==="enable")oi.ddResizable&&oi.ddResizable[ti]();else if(ti==="destroy")oi.ddResizable&&oi.cleanResizable();else if(ti==="option")oi.setupResizable({[ni]:ri});else{let ai=oi.el.gridstackNode.grid,li=oi.el.getAttribute("gs-resize-handles")||ai.opts.resizable.handles||"e,s,se";li==="all"&&(li="n,e,s,w,se,sw,ne,nw");let ci=!ai.opts.alwaysShowResizeHandle;oi.setupResizable(sn(Si({},ai.opts.resizable),{handles:li,autoHide:ci,start:ti.start,stop:ti.stop,resize:ti.resize}))}}),this}draggable(ei,ti,ni,ri){return this._getDDElements(ei,ti).forEach(oi=>{if(ti==="disable"||ti==="enable")oi.ddDraggable&&oi.ddDraggable[ti]();else if(ti==="destroy")oi.ddDraggable&&oi.cleanDraggable();else if(ti==="option")oi.setupDraggable({[ni]:ri});else{let si=oi.el.gridstackNode.grid;oi.setupDraggable(sn(Si({},si.opts.draggable),{start:ti.start,stop:ti.stop,drag:ti.drag}))}}),this}dragIn(ei,ti){return this._getDDElements(ei).forEach(ni=>ni.setupDraggable(ti)),this}droppable(ei,ti,ni,ri){return typeof ti.accept=="function"&&!ti._accept&&(ti._accept=ti.accept,ti.accept=oi=>ti._accept(oi)),this._getDDElements(ei,ti).forEach(oi=>{ti==="disable"||ti==="enable"?oi.ddDroppable&&oi.ddDroppable[ti]():ti==="destroy"?oi.ddDroppable&&oi.cleanDroppable():ti==="option"?oi.setupDroppable({[ni]:ri}):oi.setupDroppable(ti)}),this}isDroppable(ei){var ti;return!!((ti=ei==null?void 0:ei.ddElement)!=null&&ti.ddDroppable&&!ei.ddElement.ddDroppable.disabled)}isDraggable(ei){var ti;return!!((ti=ei==null?void 0:ei.ddElement)!=null&&ti.ddDraggable&&!ei.ddElement.ddDraggable.disabled)}isResizable(ei){var ti;return!!((ti=ei==null?void 0:ei.ddElement)!=null&&ti.ddResizable&&!ei.ddElement.ddResizable.disabled)}on(ei,ti,ni){return this._getDDElements(ei).forEach(ri=>ri.on(ti,oi=>{ni(oi,Bi.dragElement?Bi.dragElement.el:oi.target,Bi.dragElement?Bi.dragElement.helper:null)})),this}off(ei,ti){return this._getDDElements(ei).forEach(ni=>ni.off(ti)),this}_getDDElements(ei,ti){let ni=ei.gridstack||ti!=="destroy"&&ti!=="disable",ri=bi.getElements(ei);return ri.length?ri.map(si=>si.ddElement||(ni?Nl.init(si):null)).filter(si=>si):[]}};var Bn=new Rl,Eo=class ii{static init(ei={},ti=".grid-stack"){if(typeof document=="undefined")return null;let ni=ii.getGridElement(ti);return ni?(ni.gridstack||(ni.gridstack=new ii(ni,bi.cloneDeep(ei))),ni.gridstack):(console.error(typeof ti=="string"?'GridStack.initAll() no grid was found with selector "'+ti+`" - element missing or wrong selector ?
+Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`:"GridStack.init() no grid element was passed."),null)}static initAll(ei={},ti=".grid-stack"){let ni=[];return typeof document=="undefined"||(ii.getGridElements(ti).forEach(ri=>{ri.gridstack||(ri.gridstack=new ii(ri,bi.cloneDeep(ei))),ni.push(ri.gridstack)}),ni.length===0&&console.error('GridStack.initAll() no grid was found with selector "'+ti+`" - element missing or wrong selector ?
+Note: ".grid-stack" is required for proper CSS styling and drag/drop, and is the default selector.`)),ni}static addGrid(ei,ti={}){if(!ei)return null;let ni=ei;if(ni.gridstack){let si=ni.gridstack;return ti&&(si.opts=Si(Si({},si.opts),ti)),ti.children!==void 0&&si.load(ti.children),si}return(!ei.classList.contains("grid-stack")||ii.addRemoveCB)&&(ii.addRemoveCB?ni=ii.addRemoveCB(ei,ti,!0,!0):ni=bi.createDiv(["grid-stack",ti.class],ei)),ii.init(ti,ni)}static registerEngine(ei){ii.engineClass=ei}get placeholder(){if(!this._placeholder){this._placeholder=bi.createDiv([this.opts.placeholderClass,Yn.itemClass,this.opts.itemClass]);let ei=bi.createDiv(["placeholder-content"],this._placeholder);this.opts.placeholderText&&(ei.textContent=this.opts.placeholderText)}return this._placeholder}constructor(ei,ti={}){var di,pi,yi;this.el=ei,this.opts=ti,this.animationDelay=310,this._gsEventHandler={},this._extraDragRow=0,this.dragTransform={xScale:1,yScale:1,xOffset:0,yOffset:0},ei.gridstack=this,this.opts=ti=ti||{},ei.classList.contains("grid-stack")||this.el.classList.add("grid-stack"),ti.row&&(ti.minRow=ti.maxRow=ti.row,delete ti.row);let ni=bi.toNumber(ei.getAttribute("gs-row"));ti.column==="auto"&&delete ti.column,ti.alwaysShowResizeHandle!==void 0&&(ti._alwaysShowResizeHandle=ti.alwaysShowResizeHandle);let ri=(di=ti.columnOpts)==null?void 0:di.breakpoints,oi=ti;if(oi.oneColumnModeDomSort&&(delete oi.oneColumnModeDomSort,console.log("warning: Gridstack oneColumnModeDomSort no longer supported. Use GridStackOptions.columnOpts instead.")),oi.oneColumnSize||oi.disableOneColumnMode===!1){let gi=oi.oneColumnSize||768;delete oi.oneColumnSize,delete oi.disableOneColumnMode,ti.columnOpts=ti.columnOpts||{},ri=ti.columnOpts.breakpoints=ti.columnOpts.breakpoints||[];let vi=ri.find(Ei=>Ei.c===1);vi?vi.w=gi:(vi={c:1,w:gi},ri.push(vi,{c:12,w:gi+1}))}let si=ti.columnOpts;si&&(!si.columnWidth&&!((pi=si.breakpoints)!=null&&pi.length)?(delete ti.columnOpts,ri=void 0):si.columnMax=si.columnMax||12),(ri==null?void 0:ri.length)>1&&ri.sort((gi,vi)=>(vi.w||0)-(gi.w||0));let ai=sn(Si({},bi.cloneDeep(Yn)),{column:bi.toNumber(ei.getAttribute("gs-column"))||Yn.column,minRow:ni||bi.toNumber(ei.getAttribute("gs-min-row"))||Yn.minRow,maxRow:ni||bi.toNumber(ei.getAttribute("gs-max-row"))||Yn.maxRow,staticGrid:bi.toBool(ei.getAttribute("gs-static"))||Yn.staticGrid,sizeToContent:bi.toBool(ei.getAttribute("gs-size-to-content"))||void 0,draggable:{handle:(ti.handleClass?"."+ti.handleClass:ti.handle?ti.handle:"")||Yn.draggable.handle},removableOptions:{accept:ti.itemClass||Yn.removableOptions.accept,decline:Yn.removableOptions.decline}});ei.getAttribute("gs-animate")&&(ai.animate=bi.toBool(ei.getAttribute("gs-animate"))),ti=bi.defaults(ti,ai),this._initMargin(),this.checkDynamicColumn(),this.el.classList.add("gs-"+ti.column),ti.rtl==="auto"&&(ti.rtl=ei.style.direction==="rtl"),ti.rtl&&this.el.classList.add("grid-stack-rtl");let li=this.el.closest("."+Yn.itemClass),ci=li==null?void 0:li.gridstackNode;ci&&(ci.subGrid=this,this.parentGridNode=ci,this.el.classList.add("grid-stack-nested"),ci.el.classList.add("grid-stack-sub-grid")),this._isAutoCellHeight=ti.cellHeight==="auto",this._isAutoCellHeight||ti.cellHeight==="initial"?this.cellHeight(void 0,!1):(typeof ti.cellHeight=="number"&&ti.cellHeightUnit&&ti.cellHeightUnit!==Yn.cellHeightUnit&&(ti.cellHeight=ti.cellHeight+ti.cellHeightUnit,delete ti.cellHeightUnit),this.cellHeight(ti.cellHeight,!1)),ti.alwaysShowResizeHandle==="mobile"&&(ti.alwaysShowResizeHandle=$n),this._styleSheetClass="gs-id-"+as._idSeq++,this.el.classList.add(this._styleSheetClass),this._setStaticClass();let ui=ti.engineClass||ii.engineClass||as;if(this.engine=new ui({column:this.getColumn(),float:ti.float,maxRow:ti.maxRow,onChange:gi=>{let vi=0;this.engine.nodes.forEach(Ei=>{vi=Math.max(vi,Ei.y+Ei.h)}),gi.forEach(Ei=>{let Ai=Ei.el;Ai&&(Ei._removeDOM?(Ai&&Ai.remove(),delete Ei._removeDOM):this._writePosAttr(Ai,Ei))}),this._updateStyles(!1,vi)}}),this._updateStyles(!1,0),ti.auto&&(this.batchUpdate(),this.engine._loading=!0,this.getGridItems().forEach(gi=>this._prepareElement(gi)),delete this.engine._loading,this.batchUpdate(!1)),ti.children){let gi=ti.children;delete ti.children,gi.length&&this.load(gi)}this.setAnimation(),ti.subGridDynamic&&!Bi.pauseDrag&&(Bi.pauseDrag=!0),((yi=ti.draggable)==null?void 0:yi.pause)!==void 0&&(Bi.pauseDrag=ti.draggable.pause),this._setupRemoveDrop(),this._setupAcceptWidget(),this._updateResizeEvent()}addWidget(ei){if(typeof ei=="string"){console.error("V11: GridStack.addWidget() does not support string anymore. see #2736");return}if(ei.ELEMENT_NODE)return console.error("V11: GridStack.addWidget() does not support HTMLElement anymore. use makeWidget()"),this.makeWidget(ei);let ti,ni=ei;if(ni.grid=this,ni!=null&&ni.el?ti=ni.el:ii.addRemoveCB?ti=ii.addRemoveCB(this.el,ei,!0,!1):ti=this.createWidgetDivs(ni),!ti)return;if(ni=ti.gridstackNode,ni&&ti.parentElement===this.el&&this.engine.nodes.find(oi=>oi._id===ni._id))return ti;let ri=this._readAttr(ti);return bi.defaults(ei,ri),this.engine.prepareNode(ei),this.el.appendChild(ti),this.makeWidget(ti,ei),ti}createWidgetDivs(ei){let ti=bi.createDiv(["grid-stack-item",this.opts.itemClass]),ni=bi.createDiv(["grid-stack-item-content"],ti);return bi.lazyLoad(ei)?ei.visibleObservable||(ei.visibleObservable=new IntersectionObserver(([ri])=>{var oi,si;ri.isIntersecting&&((oi=ei.visibleObservable)==null||oi.disconnect(),delete ei.visibleObservable,ii.renderCB(ni,ei),(si=ei.grid)==null||si.prepareDragDrop(ei.el))}),window.setTimeout(()=>{var ri;return(ri=ei.visibleObservable)==null?void 0:ri.observe(ti)})):ii.renderCB(ni,ei),ti}makeSubGrid(ei,ti,ni,ri=!0){var yi,gi,vi;let oi=ei.gridstackNode;if(oi||(oi=this.makeWidget(ei).gridstackNode),(yi=oi.subGrid)!=null&&yi.el)return oi.subGrid;let si,ai=this;for(;ai&&!si;)si=(gi=ai.opts)==null?void 0:gi.subGridOpts,ai=(vi=ai.parentGridNode)==null?void 0:vi.grid;ti=bi.cloneDeep(Si(Si(sn(Si({},this.opts),{id:void 0,children:void 0,column:"auto",columnOpts:void 0,layout:"list",subGridOpts:void 0}),si||{}),ti||oi.subGridOpts||{})),oi.subGridOpts=ti;let li;ti.column==="auto"&&(li=!0,ti.column=Math.max(oi.w||1,(ni==null?void 0:ni.w)||1),delete ti.columnOpts);let ci=oi.el.querySelector(".grid-stack-item-content"),ui,di;if(ri&&(this._removeDD(oi.el),di=sn(Si({},oi),{x:0,y:0}),bi.removeInternalForSave(di),delete di.subGridOpts,oi.content&&(di.content=oi.content,delete oi.content),ii.addRemoveCB?ui=ii.addRemoveCB(this.el,di,!0,!1):(ui=bi.createDiv(["grid-stack-item"]),ui.appendChild(ci),ci=bi.createDiv(["grid-stack-item-content"],oi.el)),this.prepareDragDrop(oi.el)),ni){let Ei=li?ti.column:oi.w,Ai=oi.h+ni.h,xi=oi.el.style;xi.transition="none",this.update(oi.el,{w:Ei,h:Ai}),setTimeout(()=>xi.transition=null)}let pi=oi.subGrid=ii.addGrid(ci,ti);return ni!=null&&ni._moving&&(pi._isTemp=!0),li&&(pi._autoColumn=!0),ri&&pi.makeWidget(ui,di),ni&&(ni._moving?window.setTimeout(()=>bi.simulateMouseEvent(ni._event,"mouseenter",pi.el),0):pi.makeWidget(oi.el,oi)),this.resizeToContentCheck(!1,oi),pi}removeAsSubGrid(ei){var ni;let ti=(ni=this.parentGridNode)==null?void 0:ni.grid;ti&&(ti.batchUpdate(),ti.removeWidget(this.parentGridNode.el,!0,!0),this.engine.nodes.forEach(ri=>{ri.x+=this.parentGridNode.x,ri.y+=this.parentGridNode.y,ti.makeWidget(ri.el,ri)}),ti.batchUpdate(!1),this.parentGridNode&&delete this.parentGridNode.subGrid,delete this.parentGridNode,ei&&window.setTimeout(()=>bi.simulateMouseEvent(ei._event,"mouseenter",ti.el),0))}save(ei=!0,ti=!1,ni=ii.saveCB){let ri=this.engine.save(ei,ni);if(ri.forEach(oi=>{var si;if(ei&&oi.el&&!oi.subGrid&&!ni){let ai=oi.el.querySelector(".grid-stack-item-content");oi.content=ai==null?void 0:ai.innerHTML,oi.content||delete oi.content}else if(!ei&&!ni&&delete oi.content,(si=oi.subGrid)!=null&&si.el){let ai=oi.subGrid.save(ei,ti,ni);oi.subGridOpts=ti?ai:{children:ai},delete oi.subGrid}delete oi.el}),ti){let oi=bi.cloneDeep(this.opts);oi.marginBottom===oi.marginTop&&oi.marginRight===oi.marginLeft&&oi.marginTop===oi.marginRight&&(oi.margin=oi.marginTop,delete oi.marginTop,delete oi.marginRight,delete oi.marginBottom,delete oi.marginLeft),oi.rtl===(this.el.style.direction==="rtl")&&(oi.rtl="auto"),this._isAutoCellHeight&&(oi.cellHeight="auto"),this._autoColumn&&(oi.column="auto");let si=oi._alwaysShowResizeHandle;return delete oi._alwaysShowResizeHandle,si!==void 0?oi.alwaysShowResizeHandle=si:delete oi.alwaysShowResizeHandle,bi.removeInternalAndSame(oi,Yn),oi.children=ri,oi}return ri}load(ei,ti=ii.addRemoveCB||!0){var ci;ei=bi.cloneDeep(ei);let ni=this.getColumn();ei.forEach(ui=>{ui.w=ui.w||1,ui.h=ui.h||1}),ei=bi.sort(ei),this.engine.skipCacheUpdate=this._ignoreLayoutsNodeChange=!0;let ri=0;ei.forEach(ui=>{ri=Math.max(ri,(ui.x||0)+ui.w)}),ri>this.engine.defaultColumn&&(this.engine.defaultColumn=ri),ri>ni&&this.engine.cacheLayout(ei,ri,!0);let oi=ii.addRemoveCB;typeof ti=="function"&&(ii.addRemoveCB=ti);let si=[];this.batchUpdate();let ai=!this.engine.nodes.length;ai&&this.setAnimation(!1),!ai&&ti&&[...this.engine.nodes].forEach(di=>{if(!di.id)return;bi.find(ei,di.id)||(ii.addRemoveCB&&ii.addRemoveCB(this.el,di,!1,!1),si.push(di),this.removeWidget(di.el,!0,!1))}),this.engine._loading=!0;let li=[];return this.engine.nodes=this.engine.nodes.filter(ui=>bi.find(ei,ui.id)?(li.push(ui),!1):!0),ei.forEach(ui=>{var pi;let di=bi.find(li,ui.id);if(di){if(bi.shouldSizeToContent(di)&&(ui.h=di.h),this.engine.nodeBoundFix(ui),(ui.autoPosition||ui.x===void 0||ui.y===void 0)&&(ui.w=ui.w||di.w,ui.h=ui.h||di.h,this.engine.findEmptyPosition(ui)),this.engine.nodes.push(di),bi.samePos(di,ui)&&this.engine.nodes.length>1&&(this.moveNode(di,sn(Si({},ui),{forceCollide:!0})),bi.copyPos(ui,di)),this.update(di.el,ui),(pi=ui.subGridOpts)!=null&&pi.children){let yi=di.el.querySelector(".grid-stack");yi&&yi.gridstack&&yi.gridstack.load(ui.subGridOpts.children)}}else ti&&this.addWidget(ui)}),delete this.engine._loading,this.engine.removedNodes=si,this.batchUpdate(!1),delete this._ignoreLayoutsNodeChange,delete this.engine.skipCacheUpdate,oi?ii.addRemoveCB=oi:delete ii.addRemoveCB,ai&&((ci=this.opts)!=null&&ci.animate)&&this.setAnimation(this.opts.animate,!0),this}batchUpdate(ei=!0){return this.engine.batchUpdate(ei),ei||(this._updateContainerHeight(),this._triggerRemoveEvent(),this._triggerAddEvent(),this._triggerChangeEvent()),this}getCellHeight(ei=!1){if(this.opts.cellHeight&&this.opts.cellHeight!=="auto"&&(!ei||!this.opts.cellHeightUnit||this.opts.cellHeightUnit==="px"))return this.opts.cellHeight;if(this.opts.cellHeightUnit==="rem")return this.opts.cellHeight*parseFloat(getComputedStyle(document.documentElement).fontSize);if(this.opts.cellHeightUnit==="em")return this.opts.cellHeight*parseFloat(getComputedStyle(this.el).fontSize);if(this.opts.cellHeightUnit==="cm")return this.opts.cellHeight*(96/2.54);if(this.opts.cellHeightUnit==="mm")return this.opts.cellHeight*(96/2.54)/10;let ti=this.el.querySelector("."+this.opts.itemClass);if(ti){let ri=bi.toNumber(ti.getAttribute("gs-h"))||1;return Math.round(ti.offsetHeight/ri)}let ni=parseInt(this.el.getAttribute("gs-current-row"));return ni?Math.round(this.el.getBoundingClientRect().height/ni):this.opts.cellHeight}cellHeight(ei,ti=!0){if(ti&&ei!==void 0&&this._isAutoCellHeight!==(ei==="auto")&&(this._isAutoCellHeight=ei==="auto",this._updateResizeEvent()),(ei==="initial"||ei==="auto")&&(ei=void 0),ei===void 0){let ri=-this.opts.marginRight-this.opts.marginLeft+this.opts.marginTop+this.opts.marginBottom;ei=this.cellWidth()+ri}let ni=bi.parseHeight(ei);return this.opts.cellHeightUnit===ni.unit&&this.opts.cellHeight===ni.h?this:(this.opts.cellHeightUnit=ni.unit,this.opts.cellHeight=ni.h,this.resizeToContentCheck(),ti&&this._updateStyles(!0),this)}cellWidth(){return this._widthOrContainer()/this.getColumn()}_widthOrContainer(ei=!1){var ti;return ei&&((ti=this.opts.columnOpts)!=null&&ti.breakpointForWindow)?window.innerWidth:this.el.clientWidth||this.el.parentElement.clientWidth||window.innerWidth}checkDynamicColumn(){var oi,si;let ei=this.opts.columnOpts;if(!ei||!ei.columnWidth&&!((oi=ei.breakpoints)!=null&&oi.length))return!1;let ti=this.getColumn(),ni=ti,ri=this._widthOrContainer(!0);if(ei.columnWidth)ni=Math.min(Math.round(ri/ei.columnWidth)||1,ei.columnMax);else{ni=ei.columnMax;let ai=0;for(;aili.c===ni);return this.column(ni,(ai==null?void 0:ai.layout)||ei.layout),!0}return!1}compact(ei="compact",ti=!0){return this.engine.compact(ei,ti),this._triggerChangeEvent(),this}column(ei,ti="moveScale"){if(!ei||ei<1||this.opts.column===ei)return this;let ni=this.getColumn();return this.opts.column=ei,this.engine?(this.engine.column=ei,this.el.classList.remove("gs-"+ni),this.el.classList.add("gs-"+ei),this.engine.columnChanged(ni,ei,ti),this._isAutoCellHeight&&this.cellHeight(),this.resizeToContentCheck(!0),this._ignoreLayoutsNodeChange=!0,this._triggerChangeEvent(),delete this._ignoreLayoutsNodeChange,this):this}getColumn(){return this.opts.column}getGridItems(){return Array.from(this.el.children).filter(ei=>ei.matches("."+this.opts.itemClass)&&!ei.matches("."+this.opts.placeholderClass))}isIgnoreChangeCB(){return this._ignoreLayoutsNodeChange}destroy(ei=!0){var ti,ni;if(this.el)return this.offAll(),this._updateResizeEvent(!0),this.setStatic(!0,!1),this.setAnimation(!1),ei?this.el.parentNode.removeChild(this.el):(this.removeAll(ei),this.el.classList.remove(this._styleSheetClass),this.el.removeAttribute("gs-current-row")),this._removeStylesheet(),(ti=this.parentGridNode)==null||delete ti.subGrid,delete this.parentGridNode,delete this.opts,(ni=this._placeholder)==null||delete ni.gridstackNode,delete this._placeholder,delete this.engine,delete this.el.gridstack,delete this.el,this}float(ei){return this.opts.float!==ei&&(this.opts.float=this.engine.float=ei,this._triggerChangeEvent()),this}getFloat(){return this.engine.float}getCellFromPixel(ei,ti=!1){let ni=this.el.getBoundingClientRect(),ri;ti?ri={top:ni.top+document.documentElement.scrollTop,left:ni.left}:ri={top:this.el.offsetTop,left:this.el.offsetLeft};let oi=ei.left-ri.left,si=ei.top-ri.top,ai=ni.width/this.getColumn(),li=ni.height/parseInt(this.el.getAttribute("gs-current-row"));return{x:Math.floor(oi/ai),y:Math.floor(si/li)}}getRow(){return Math.max(this.engine.getRow(),this.opts.minRow)}isAreaEmpty(ei,ti,ni,ri){return this.engine.isAreaEmpty(ei,ti,ni,ri)}makeWidget(ei,ti){let ni=ii.getElement(ei);if(!ni)return;ni.parentElement||this.el.appendChild(ni),this._prepareElement(ni,!0,ti);let ri=ni.gridstackNode;this._updateContainerHeight(),ri.subGridOpts&&this.makeSubGrid(ni,ri.subGridOpts,void 0,!1);let oi;return this.opts.column===1&&!this._ignoreLayoutsNodeChange&&(oi=this._ignoreLayoutsNodeChange=!0),this._triggerAddEvent(),this._triggerChangeEvent(),oi&&delete this._ignoreLayoutsNodeChange,ni}on(ei,ti){return ei.indexOf(" ")!==-1?(ei.split(" ").forEach(ri=>this.on(ri,ti)),this):(ei==="change"||ei==="added"||ei==="removed"||ei==="enable"||ei==="disable"?(ei==="enable"||ei==="disable"?this._gsEventHandler[ei]=ri=>ti(ri):this._gsEventHandler[ei]=ri=>{ri.detail&&ti(ri,ri.detail)},this.el.addEventListener(ei,this._gsEventHandler[ei])):ei==="drag"||ei==="dragstart"||ei==="dragstop"||ei==="resizestart"||ei==="resize"||ei==="resizestop"||ei==="dropped"||ei==="resizecontent"?this._gsEventHandler[ei]=ti:console.error("GridStack.on("+ei+") event not supported"),this)}off(ei){return ei.indexOf(" ")!==-1?(ei.split(" ").forEach(ni=>this.off(ni)),this):((ei==="change"||ei==="added"||ei==="removed"||ei==="enable"||ei==="disable")&&this._gsEventHandler[ei]&&this.el.removeEventListener(ei,this._gsEventHandler[ei]),delete this._gsEventHandler[ei],this)}offAll(){return Object.keys(this._gsEventHandler).forEach(ei=>this.off(ei)),this}removeWidget(ei,ti=!0,ni=!0){return ei?(ii.getElements(ei).forEach(ri=>{if(ri.parentElement&&ri.parentElement!==this.el)return;let oi=ri.gridstackNode;oi||(oi=this.engine.nodes.find(si=>ri===si.el)),oi&&(ti&&ii.addRemoveCB&&ii.addRemoveCB(this.el,oi,!1,!1),delete ri.gridstackNode,this._removeDD(ri),this.engine.removeNode(oi,ti,ni),ti&&ri.parentElement&&ri.remove())}),ni&&(this._triggerRemoveEvent(),this._triggerChangeEvent()),this):(console.error("Error: GridStack.removeWidget(undefined) called"),this)}removeAll(ei=!0,ti=!0){return this.engine.nodes.forEach(ni=>{ei&&ii.addRemoveCB&&ii.addRemoveCB(this.el,ni,!1,!1),delete ni.el.gridstackNode,this.opts.staticGrid||this._removeDD(ni.el)}),this.engine.removeAll(ei,ti),ti&&this._triggerRemoveEvent(),this}setAnimation(ei=this.opts.animate,ti){return ti?setTimeout(()=>{this.opts&&this.setAnimation(ei)}):ei?this.el.classList.add("grid-stack-animate"):this.el.classList.remove("grid-stack-animate"),this}hasAnimationCSS(){return this.el.classList.contains("grid-stack-animate")}setStatic(ei,ti=!0,ni=!0){return!!this.opts.staticGrid===ei?this:(ei?this.opts.staticGrid=!0:delete this.opts.staticGrid,this._setupRemoveDrop(),this._setupAcceptWidget(),this.engine.nodes.forEach(ri=>{this.prepareDragDrop(ri.el),ri.subGrid&&ni&&ri.subGrid.setStatic(ei,ti,ni)}),ti&&this._setStaticClass(),this)}updateOptions(ei){var ni;let ti=this.opts;return ei.acceptWidgets!==void 0&&this._setupAcceptWidget(),ei.animate!==void 0&&this.setAnimation(),ei.cellHeight&&(this.cellHeight(ei.cellHeight,!0),delete ei.cellHeight),ei.class&&ei.class!==ti.class&&(ti.class&&this.el.classList.remove(ti.class),this.el.classList.add(ei.class)),typeof ei.column=="number"&&!ei.columnOpts&&(this.column(ei.column),delete ei.column),ei.margin!==void 0&&this.margin(ei.margin),ei.staticGrid!==void 0&&this.setStatic(ei.staticGrid),ei.disableDrag!==void 0&&!ei.staticGrid&&this.enableMove(!ei.disableDrag),ei.disableResize!==void 0&&!ei.staticGrid&&this.enableResize(!ei.disableResize),ei.float!==void 0&&this.float(ei.float),ei.row!==void 0&&(ti.minRow=ti.maxRow=ei.row),(ni=ei.children)!=null&&ni.length&&(this.load(ei.children),delete ei.children),this.opts=Si(Si({},this.opts),ei),this}update(ei,ti){return ii.getElements(ei).forEach(ni=>{var ui;let ri=ni==null?void 0:ni.gridstackNode;if(!ri)return;let oi=Si(Si({},bi.copyPos({},ri)),bi.cloneDeep(ti));this.engine.nodeBoundFix(oi),delete oi.autoPosition;let si=["x","y","w","h"],ai;if(si.some(di=>oi[di]!==void 0&&oi[di]!==ri[di])&&(ai={},si.forEach(di=>{ai[di]=oi[di]!==void 0?oi[di]:ri[di],delete oi[di]})),!ai&&(oi.minW||oi.minH||oi.maxW||oi.maxH)&&(ai={}),oi.content!==void 0){let di=ni.querySelector(".grid-stack-item-content");di&&di.textContent!==oi.content&&(ri.content=oi.content,ii.renderCB(di,oi),(ui=ri.subGrid)!=null&&ui.el&&(di.appendChild(ri.subGrid.el),ri.subGrid.opts.styleInHead||ri.subGrid._updateStyles(!0))),delete oi.content}let li=!1,ci=!1;for(let di in oi)di[0]!=="_"&&ri[di]!==oi[di]&&(ri[di]=oi[di],li=!0,ci=ci||!this.opts.staticGrid&&(di==="noResize"||di==="noMove"||di==="locked"));if(bi.sanitizeMinMax(ri),ai){let di=ai.w!==void 0&&ai.w!==ri.w;this.moveNode(ri,ai),di&&ri.subGrid?ri.subGrid.onResize(this.hasAnimationCSS()?ri.w:void 0):this.resizeToContentCheck(di,ri),delete ri._orig}(ai||li)&&this._writeAttr(ni,ri),ci&&this.prepareDragDrop(ri.el)}),this}moveNode(ei,ti){let ni=ei._updating;ni||this.engine.cleanNodes().beginUpdate(ei),this.engine.moveNode(ei,ti),this._updateContainerHeight(),ni||(this._triggerChangeEvent(),this.engine.endUpdate())}resizeToContent(ei){var pi,yi;if(!ei||(ei.classList.remove("size-to-content-max"),!ei.clientHeight))return;let ti=ei.gridstackNode;if(!ti)return;let ni=ti.grid;if(!ni||ei.parentElement!==ni.el)return;let ri=ni.getCellHeight(!0);if(!ri)return;let oi=ti.h?ti.h*ri:ei.clientHeight,si;if(ti.resizeToContentParent&&(si=ei.querySelector(ti.resizeToContentParent)),si||(si=ei.querySelector(ii.resizeToContentParent)),!si)return;let ai=ei.clientHeight-si.clientHeight,li=ti.h?ti.h*ri-ai:si.clientHeight,ci;if(ti.subGrid){ci=ti.subGrid.getRow()*ti.subGrid.getCellHeight(!0);let gi=ti.subGrid.el.getBoundingClientRect(),vi=ti.subGrid.el.parentElement.getBoundingClientRect();ci+=gi.top-vi.top}else{if((yi=(pi=ti.subGridOpts)==null?void 0:pi.children)!=null&&yi.length)return;{let gi=si.firstElementChild;if(!gi){console.error(`Error: GridStack.resizeToContent() widget id:${ti.id} '${ii.resizeToContentParent}'.firstElementChild is null, make sure to have a div like container. Skipping sizing.`);return}ci=gi.getBoundingClientRect().height||li}}if(li===ci)return;oi+=ci-li;let ui=Math.ceil(oi/ri),di=Number.isInteger(ti.sizeToContent)?ti.sizeToContent:0;di&&ui>di&&(ui=di,ei.classList.add("size-to-content-max")),ti.minH&&uiti.maxH&&(ui=ti.maxH),ui!==ti.h&&(ni._ignoreLayoutsNodeChange=!0,ni.moveNode(ti,{h:ui}),delete ni._ignoreLayoutsNodeChange)}resizeToContentCBCheck(ei){ii.resizeToContentCB?ii.resizeToContentCB(ei):this.resizeToContent(ei)}rotate(ei,ti){return ii.getElements(ei).forEach(ni=>{let ri=ni.gridstackNode;if(!bi.canBeRotated(ri))return;let oi={w:ri.h,h:ri.w,minH:ri.minW,minW:ri.minH,maxH:ri.maxW,maxW:ri.maxH};if(ti){let ai=ti.left>0?Math.floor(ti.left/this.cellWidth()):0,li=ti.top>0?Math.floor(ti.top/this.opts.cellHeight):0;oi.x=ri.x+ai-(ri.h-(li+1)),oi.y=ri.y+li-ai}Object.keys(oi).forEach(ai=>{oi[ai]===void 0&&delete oi[ai]});let si=ri._orig;this.update(ni,oi),ri._orig=si}),this}margin(ei){if(!(typeof ei=="string"&&ei.split(" ").length>1)){let ni=bi.parseHeight(ei);if(this.opts.marginUnit===ni.unit&&this.opts.margin===ni.h)return}return this.opts.margin=ei,this.opts.marginTop=this.opts.marginBottom=this.opts.marginLeft=this.opts.marginRight=void 0,this._initMargin(),this._updateStyles(!0),this}getMargin(){return this.opts.margin}willItFit(ei){if(arguments.length>1){console.warn("gridstack.ts: `willItFit(x,y,w,h,autoPosition)` is deprecated. Use `willItFit({x, y,...})`. It will be removed soon");let ti=arguments,ni=0,ri={x:ti[ni++],y:ti[ni++],w:ti[ni++],h:ti[ni++],autoPosition:ti[ni++]};return this.willItFit(ri)}return this.engine.willItFit(ei)}_triggerChangeEvent(){if(this.engine.batchMode)return this;let ei=this.engine.getDirtyNodes(!0);return ei&&ei.length&&(this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(ei),this._triggerEvent("change",ei)),this.engine.saveInitial(),this}_triggerAddEvent(){var ei;if(this.engine.batchMode)return this;if((ei=this.engine.addedNodes)!=null&&ei.length){this._ignoreLayoutsNodeChange||this.engine.layoutsNodesChange(this.engine.addedNodes),this.engine.addedNodes.forEach(ni=>{delete ni._dirty});let ti=[...this.engine.addedNodes];this.engine.addedNodes=[],this._triggerEvent("added",ti)}return this}_triggerRemoveEvent(){var ei;if(this.engine.batchMode)return this;if((ei=this.engine.removedNodes)!=null&&ei.length){let ti=[...this.engine.removedNodes];this.engine.removedNodes=[],this._triggerEvent("removed",ti)}return this}_triggerEvent(ei,ti){let ni=ti?new CustomEvent(ei,{bubbles:!1,detail:ti}):new Event(ei);return this.el.dispatchEvent(ni),this}_removeStylesheet(){if(this._styles){let ei=this.opts.styleInHead?void 0:this.el.parentNode;bi.removeStylesheet(this._styleSheetClass,ei),delete this._styles}return this}_updateStyles(ei=!1,ti){if(ei&&this._removeStylesheet(),ti===void 0&&(ti=this.getRow()),this._updateContainerHeight(),this.opts.cellHeight===0)return this;let ni=this.opts.cellHeight,ri=this.opts.cellHeightUnit,oi=`.${this._styleSheetClass} > .${this.opts.itemClass}`;if(!this._styles){let si=this.opts.styleInHead?void 0:this.el.parentNode;if(this._styles=bi.createStylesheet(this._styleSheetClass,si,{nonce:this.opts.nonce}),!this._styles)return this;this._styles._max=0,bi.addCSSRule(this._styles,oi,`height: ${ni}${ri}`);let ai=this.opts.marginTop+this.opts.marginUnit,li=this.opts.marginBottom+this.opts.marginUnit,ci=this.opts.marginRight+this.opts.marginUnit,ui=this.opts.marginLeft+this.opts.marginUnit,di=`${oi} > .grid-stack-item-content`,pi=`.${this._styleSheetClass} > .grid-stack-placeholder > .placeholder-content`;bi.addCSSRule(this._styles,di,`top: ${ai}; right: ${ci}; bottom: ${li}; left: ${ui};`),bi.addCSSRule(this._styles,pi,`top: ${ai}; right: ${ci}; bottom: ${li}; left: ${ui};`),bi.addCSSRule(this._styles,`${oi} > .ui-resizable-n`,`top: ${ai};`),bi.addCSSRule(this._styles,`${oi} > .ui-resizable-s`,`bottom: ${li}`),bi.addCSSRule(this._styles,`${oi} > .ui-resizable-ne`,`right: ${ci}; top: ${ai}`),bi.addCSSRule(this._styles,`${oi} > .ui-resizable-e`,`right: ${ci}`),bi.addCSSRule(this._styles,`${oi} > .ui-resizable-se`,`right: ${ci}; bottom: ${li}`),bi.addCSSRule(this._styles,`${oi} > .ui-resizable-nw`,`left: ${ui}; top: ${ai}`),bi.addCSSRule(this._styles,`${oi} > .ui-resizable-w`,`left: ${ui}`),bi.addCSSRule(this._styles,`${oi} > .ui-resizable-sw`,`left: ${ui}; bottom: ${li}`)}if(ti=ti||this._styles._max,ti>this._styles._max){let si=ai=>ni*ai+ri;for(let ai=this._styles._max+1;ai<=ti;ai++)bi.addCSSRule(this._styles,`${oi}[gs-y="${ai}"]`,`top: ${si(ai)}`),bi.addCSSRule(this._styles,`${oi}[gs-h="${ai+1}"]`,`height: ${si(ai+1)}`);this._styles._max=ti}return this}_updateContainerHeight(){if(!this.engine||this.engine.batchMode)return this;let ei=this.parentGridNode,ti=this.getRow()+this._extraDragRow,ni=this.opts.cellHeight,ri=this.opts.cellHeightUnit;if(!ni)return this;if(!ei){let oi=bi.parseHeight(getComputedStyle(this.el).minHeight);if(oi.h>0&&oi.unit===ri){let si=Math.floor(oi.h/ni);ti1?ei.setAttribute("gs-w",String(ti.w)):ei.removeAttribute("gs-w"),ti.h>1?ei.setAttribute("gs-h",String(ti.h)):ei.removeAttribute("gs-h"),this}_writeAttr(ei,ti){if(!ti)return this;this._writePosAttr(ei,ti);let ni={noResize:"gs-no-resize",noMove:"gs-no-move",locked:"gs-locked",id:"gs-id",sizeToContent:"gs-size-to-content"};for(let ri in ni)ti[ri]?ei.setAttribute(ni[ri],String(ti[ri])):ei.removeAttribute(ni[ri]);return this}_readAttr(ei,ti=!0){let ni={};ni.x=bi.toNumber(ei.getAttribute("gs-x")),ni.y=bi.toNumber(ei.getAttribute("gs-y")),ni.w=bi.toNumber(ei.getAttribute("gs-w")),ni.h=bi.toNumber(ei.getAttribute("gs-h")),ni.autoPosition=bi.toBool(ei.getAttribute("gs-auto-position")),ni.noResize=bi.toBool(ei.getAttribute("gs-no-resize")),ni.noMove=bi.toBool(ei.getAttribute("gs-no-move")),ni.locked=bi.toBool(ei.getAttribute("gs-locked"));let ri=ei.getAttribute("gs-size-to-content");ri&&(ri==="true"||ri==="false"?ni.sizeToContent=bi.toBool(ri):ni.sizeToContent=parseInt(ri,10)),ni.id=ei.getAttribute("gs-id"),ni.maxW=bi.toNumber(ei.getAttribute("gs-max-w")),ni.minW=bi.toNumber(ei.getAttribute("gs-min-w")),ni.maxH=bi.toNumber(ei.getAttribute("gs-max-h")),ni.minH=bi.toNumber(ei.getAttribute("gs-min-h")),ti&&(ni.w===1&&ei.removeAttribute("gs-w"),ni.h===1&&ei.removeAttribute("gs-h"),ni.maxW&&ei.removeAttribute("gs-max-w"),ni.minW&&ei.removeAttribute("gs-min-w"),ni.maxH&&ei.removeAttribute("gs-max-h"),ni.minH&&ei.removeAttribute("gs-min-h"));for(let oi in ni){if(!ni.hasOwnProperty(oi))return;!ni[oi]&&ni[oi]!==0&&oi!=="gs-size-to-content"&&delete ni[oi]}return ni}_setStaticClass(){let ei=["grid-stack-static"];return this.opts.staticGrid?(this.el.classList.add(...ei),this.el.setAttribute("gs-static","true")):(this.el.classList.remove(...ei),this.el.removeAttribute("gs-static")),this}onResize(ei=(ti=>(ti=this.el)==null?void 0:ti.clientWidth)()){if(!ei||this.prevWidth===ei)return;this.prevWidth=ei,this.batchUpdate();let ni=!1;return this._autoColumn&&this.parentGridNode?this.opts.column!==this.parentGridNode.w&&(this.column(this.parentGridNode.w,this.opts.layout||"list"),ni=!0):ni=this.checkDynamicColumn(),this._isAutoCellHeight&&this.cellHeight(),this.engine.nodes.forEach(ri=>{ri.subGrid&&ri.subGrid.onResize()}),this._skipInitialResize||this.resizeToContentCheck(ni),delete this._skipInitialResize,this.batchUpdate(!1),this}resizeToContentCheck(ei=!1,ti=void 0){if(this.engine){if(ei&&this.hasAnimationCSS())return setTimeout(()=>this.resizeToContentCheck(!1,ti),this.animationDelay);if(ti)bi.shouldSizeToContent(ti)&&this.resizeToContentCBCheck(ti.el);else if(this.engine.nodes.some(ni=>bi.shouldSizeToContent(ni))){let ni=[...this.engine.nodes];this.batchUpdate(),ni.forEach(ri=>{bi.shouldSizeToContent(ri)&&this.resizeToContentCBCheck(ri.el)}),this.batchUpdate(!1)}this._gsEventHandler.resizecontent&&this._gsEventHandler.resizecontent(null,ti?[ti]:this.engine.nodes)}}_updateResizeEvent(ei=!1){let ti=!this.parentGridNode&&(this._isAutoCellHeight||this.opts.sizeToContent||this.opts.columnOpts||this.engine.nodes.find(ni=>ni.sizeToContent));return!ei&&ti&&!this.resizeObserver?(this._sizeThrottle=bi.throttle(()=>this.onResize(),this.opts.cellHeightThrottle),this.resizeObserver=new ResizeObserver(()=>this._sizeThrottle()),this.resizeObserver.observe(this.el),this._skipInitialResize=!0):(ei||!ti)&&this.resizeObserver&&(this.resizeObserver.disconnect(),delete this.resizeObserver,delete this._sizeThrottle),this}static getElement(ei=".grid-stack-item"){return bi.getElement(ei)}static getElements(ei=".grid-stack-item"){return bi.getElements(ei)}static getGridElement(ei){return ii.getElement(ei)}static getGridElements(ei){return bi.getElements(ei)}_initMargin(){let ei,ti=0,ni=[];return typeof this.opts.margin=="string"&&(ni=this.opts.margin.split(" ")),ni.length===2?(this.opts.marginTop=this.opts.marginBottom=ni[0],this.opts.marginLeft=this.opts.marginRight=ni[1]):ni.length===4?(this.opts.marginTop=ni[0],this.opts.marginRight=ni[1],this.opts.marginBottom=ni[2],this.opts.marginLeft=ni[3]):(ei=bi.parseHeight(this.opts.margin),this.opts.marginUnit=ei.unit,ti=this.opts.margin=ei.h),this.opts.marginTop===void 0?this.opts.marginTop=ti:(ei=bi.parseHeight(this.opts.marginTop),this.opts.marginTop=ei.h,delete this.opts.margin),this.opts.marginBottom===void 0?this.opts.marginBottom=ti:(ei=bi.parseHeight(this.opts.marginBottom),this.opts.marginBottom=ei.h,delete this.opts.margin),this.opts.marginRight===void 0?this.opts.marginRight=ti:(ei=bi.parseHeight(this.opts.marginRight),this.opts.marginRight=ei.h,delete this.opts.margin),this.opts.marginLeft===void 0?this.opts.marginLeft=ti:(ei=bi.parseHeight(this.opts.marginLeft),this.opts.marginLeft=ei.h,delete this.opts.margin),this.opts.marginUnit=ei.unit,this.opts.marginTop===this.opts.marginBottom&&this.opts.marginLeft===this.opts.marginRight&&this.opts.marginTop===this.opts.marginRight&&(this.opts.margin=this.opts.marginTop),this}static getDD(){return Bn}static setupDragIn(ei,ti,ni,ri=document){(ti==null?void 0:ti.pause)!==void 0&&(Bi.pauseDrag=ti.pause),ti=Si({appendTo:"body",helper:"clone"},ti||{}),(typeof ei=="string"?bi.getElements(ei,ri):ei).forEach((si,ai)=>{Bn.isDraggable(si)||Bn.dragIn(si,ti),ni!=null&&ni[ai]&&(si.gridstackNode=ni[ai])})}movable(ei,ti){return this.opts.staticGrid?this:(ii.getElements(ei).forEach(ni=>{let ri=ni.gridstackNode;ri&&(ti?delete ri.noMove:ri.noMove=!0,this.prepareDragDrop(ri.el))}),this)}resizable(ei,ti){return this.opts.staticGrid?this:(ii.getElements(ei).forEach(ni=>{let ri=ni.gridstackNode;ri&&(ti?delete ri.noResize:ri.noResize=!0,this.prepareDragDrop(ri.el))}),this)}disable(ei=!0){if(!this.opts.staticGrid)return this.enableMove(!1,ei),this.enableResize(!1,ei),this._triggerEvent("disable"),this}enable(ei=!0){if(!this.opts.staticGrid)return this.enableMove(!0,ei),this.enableResize(!0,ei),this._triggerEvent("enable"),this}enableMove(ei,ti=!0){return this.opts.staticGrid?this:(ei?delete this.opts.disableDrag:this.opts.disableDrag=!0,this.engine.nodes.forEach(ni=>{this.prepareDragDrop(ni.el),ni.subGrid&&ti&&ni.subGrid.enableMove(ei,ti)}),this)}enableResize(ei,ti=!0){return this.opts.staticGrid?this:(ei?delete this.opts.disableResize:this.opts.disableResize=!0,this.engine.nodes.forEach(ni=>{this.prepareDragDrop(ni.el),ni.subGrid&&ti&&ni.subGrid.enableResize(ei,ti)}),this)}cancelDrag(){var ti;let ei=(ti=this._placeholder)==null?void 0:ti.gridstackNode;ei&&(ei._isExternal?(ei._isAboutToRemove=!0,this.engine.removeNode(ei)):ei._isAboutToRemove&&ii._itemRemoving(ei.el,!1),this.engine.restoreInitial())}_removeDD(ei){return Bn.draggable(ei,"destroy").resizable(ei,"destroy"),ei.gridstackNode&&delete ei.gridstackNode._initDD,delete ei.ddElement,this}_setupAcceptWidget(){if(this.opts.staticGrid||!this.opts.acceptWidgets&&!this.opts.removable)return Bn.droppable(this.el,"destroy"),this;let ei,ti,ni=(ri,oi,si)=>{var pi;si=si||oi;let ai=si.gridstackNode;if(!ai)return;if(!((pi=ai.grid)!=null&&pi.el)){si.style.transform=`scale(${1/this.dragTransform.xScale},${1/this.dragTransform.yScale})`;let yi=si.getBoundingClientRect();si.style.left=yi.x+(this.dragTransform.xScale-1)*(ri.clientX-yi.x)/this.dragTransform.xScale+"px",si.style.top=yi.y+(this.dragTransform.yScale-1)*(ri.clientY-yi.y)/this.dragTransform.yScale+"px",si.style.transformOrigin="0px 0px"}let{top:li,left:ci}=si.getBoundingClientRect(),ui=this.el.getBoundingClientRect();ci-=ui.left,li-=ui.top;let di={position:{top:li*this.dragTransform.xScale,left:ci*this.dragTransform.yScale}};if(ai._temporaryRemoved){if(ai.x=Math.max(0,Math.round(ci/ti)),ai.y=Math.max(0,Math.round(li/ei)),delete ai.autoPosition,this.engine.nodeBoundFix(ai),!this.engine.willItFit(ai)){if(ai.autoPosition=!0,!this.engine.willItFit(ai)){Bn.off(oi,"drag");return}ai._willFitPos&&(bi.copyPos(ai,ai._willFitPos),delete ai._willFitPos)}this._onStartMoving(si,ri,di,ai,ti,ei)}else this._dragOrResize(si,ri,di,ai,ti,ei)};return Bn.droppable(this.el,{accept:ri=>{let oi=ri.gridstackNode||this._readAttr(ri,!1);if((oi==null?void 0:oi.grid)===this)return!0;if(!this.opts.acceptWidgets)return!1;let si=!0;if(typeof this.opts.acceptWidgets=="function")si=this.opts.acceptWidgets(ri);else{let ai=this.opts.acceptWidgets===!0?".grid-stack-item":this.opts.acceptWidgets;si=ri.matches(ai)}if(si&&oi&&this.opts.maxRow){let ai={w:oi.w,h:oi.h,minW:oi.minW,minH:oi.minH};si=this.engine.willItFit(ai)}return si}}).on(this.el,"dropover",(ri,oi,si)=>{let ai=(si==null?void 0:si.gridstackNode)||oi.gridstackNode;if((ai==null?void 0:ai.grid)===this&&!ai._temporaryRemoved)return!1;if(ai!=null&&ai._sidebarOrig&&(ai.w=ai._sidebarOrig.w,ai.h=ai._sidebarOrig.h),ai!=null&&ai.grid&&ai.grid!==this&&!ai._temporaryRemoved&&ai.grid._leave(oi,si),si=si||oi,ti=this.cellWidth(),ei=this.getCellHeight(!0),!ai){let ui=si.getAttribute("data-gs-widget")||si.getAttribute("gridstacknode");if(ui){try{ai=JSON.parse(ui)}catch(di){console.error("Gridstack dropover: Bad JSON format: ",ui)}si.removeAttribute("data-gs-widget"),si.removeAttribute("gridstacknode")}ai||(ai=this._readAttr(si)),ai._sidebarOrig={w:ai.w,h:ai.h}}ai.grid||(ai.el||(ai=Si({},ai)),ai._isExternal=!0,si.gridstackNode=ai);let li=ai.w||Math.round(si.offsetWidth/ti)||1,ci=ai.h||Math.round(si.offsetHeight/ei)||1;return ai.grid&&ai.grid!==this?(oi._gridstackNodeOrig||(oi._gridstackNodeOrig=ai),oi.gridstackNode=ai=sn(Si({},ai),{w:li,h:ci,grid:this}),delete ai.x,delete ai.y,this.engine.cleanupNode(ai).nodeBoundFix(ai),ai._initDD=ai._isExternal=ai._temporaryRemoved=!0):(ai.w=li,ai.h=ci,ai._temporaryRemoved=!0),ii._itemRemoving(ai.el,!1),Bn.on(oi,"drag",ni),ni(ri,oi,si),!1}).on(this.el,"dropout",(ri,oi,si)=>{let ai=(si==null?void 0:si.gridstackNode)||oi.gridstackNode;return ai&&(!ai.grid||ai.grid===this)&&(this._leave(oi,si),this._isTemp&&this.removeAsSubGrid(ai)),!1}).on(this.el,"drop",(ri,oi,si)=>{var yi,gi,vi;let ai=(si==null?void 0:si.gridstackNode)||oi.gridstackNode;if((ai==null?void 0:ai.grid)===this&&!ai._isExternal)return!1;let li=!!this.placeholder.parentElement,ci=oi!==si;this.placeholder.remove(),delete this.placeholder.gridstackNode;let ui=li&&this.opts.animate;ui&&this.setAnimation(!1);let di=oi._gridstackNodeOrig;if(delete oi._gridstackNodeOrig,li&&(di!=null&&di.grid)&&di.grid!==this){let Ei=di.grid;Ei.engine.removeNodeFromLayoutCache(di),Ei.engine.removedNodes.push(di),Ei._triggerRemoveEvent()._triggerChangeEvent(),Ei.parentGridNode&&!Ei.engine.nodes.length&&Ei.opts.subGridDynamic&&Ei.removeAsSubGrid()}if(!ai||(li&&(this.engine.cleanupNode(ai),ai.grid=this),(yi=ai.grid)==null||delete yi._isTemp,Bn.off(oi,"drag"),si!==oi?(si.remove(),oi=si):oi.remove(),this._removeDD(oi),!li))return!1;let pi=(vi=(gi=ai.subGrid)==null?void 0:gi.el)==null?void 0:vi.gridstack;return bi.copyPos(ai,this._readAttr(this.placeholder)),bi.removePositioningStyles(oi),ci&&(ai.content||ai.subGridOpts||ii.addRemoveCB)?(delete ai.el,oi=this.addWidget(ai)):(this._prepareElement(oi,!0,ai),this.el.appendChild(oi),this.resizeToContentCheck(!1,ai),pi&&(pi.parentGridNode=ai,pi.opts.styleInHead||pi._updateStyles(!0)),this._updateContainerHeight()),this.engine.addedNodes.push(ai),this._triggerAddEvent(),this._triggerChangeEvent(),this.engine.endUpdate(),this._gsEventHandler.dropped&&this._gsEventHandler.dropped(sn(Si({},ri),{type:"dropped"}),di&&di.grid?di:void 0,ai),ui&&this.setAnimation(this.opts.animate,!0),!1}),this}static _itemRemoving(ei,ti){if(!ei)return;let ni=ei?ei.gridstackNode:void 0;!(ni!=null&&ni.grid)||ei.classList.contains(ni.grid.opts.removableOptions.decline)||(ti?ni._isAboutToRemove=!0:delete ni._isAboutToRemove,ti?ei.classList.add("grid-stack-item-removing"):ei.classList.remove("grid-stack-item-removing"))}_setupRemoveDrop(){if(typeof this.opts.removable!="string")return this;let ei=document.querySelector(this.opts.removable);return ei?(!this.opts.staticGrid&&!Bn.isDroppable(ei)&&Bn.droppable(ei,this.opts.removableOptions).on(ei,"dropover",(ti,ni)=>ii._itemRemoving(ni,!0)).on(ei,"dropout",(ti,ni)=>ii._itemRemoving(ni,!1)),this):this}prepareDragDrop(ei,ti=!1){let ni=ei==null?void 0:ei.gridstackNode;if(!ni)return;let ri=ni.noMove||this.opts.disableDrag,oi=ni.noResize||this.opts.disableResize,si=ni.locked||this.opts.staticGrid||ri&&oi;if((ti||si)&&(ni._initDD&&(this._removeDD(ei),delete ni._initDD),si))return ei.classList.add("ui-draggable-disabled","ui-resizable-disabled"),this;if(!ni._initDD){let ai,li,ci=(pi,yi)=>{this._gsEventHandler[pi.type]&&this._gsEventHandler[pi.type](pi,pi.target),ai=this.cellWidth(),li=this.getCellHeight(!0),this._onStartMoving(ei,pi,yi,ni,ai,li)},ui=(pi,yi)=>{this._dragOrResize(ei,pi,yi,ni,ai,li)},di=pi=>{this.placeholder.remove(),delete this.placeholder.gridstackNode,delete ni._moving,delete ni._event,delete ni._lastTried;let yi=ni.w!==ni._orig.w,gi=pi.target;if(!(!gi.gridstackNode||gi.gridstackNode.grid!==this)){if(ni.el=gi,ni._isAboutToRemove){let vi=ei.gridstackNode.grid;vi._gsEventHandler[pi.type]&&vi._gsEventHandler[pi.type](pi,gi),vi.engine.nodes.push(ni),vi.removeWidget(ei,!0,!0)}else bi.removePositioningStyles(gi),ni._temporaryRemoved?(bi.copyPos(ni,ni._orig),this._writePosAttr(gi,ni),this.engine.addNode(ni)):this._writePosAttr(gi,ni),this._gsEventHandler[pi.type]&&this._gsEventHandler[pi.type](pi,gi);this._extraDragRow=0,this._updateContainerHeight(),this._triggerChangeEvent(),this.engine.endUpdate(),pi.type==="resizestop"&&(Number.isInteger(ni.sizeToContent)&&(ni.sizeToContent=ni.h),this.resizeToContentCheck(yi,ni))}};Bn.draggable(ei,{start:ci,stop:di,drag:ui}).resizable(ei,{start:ci,stop:di,resize:ui}),ni._initDD=!0}return Bn.draggable(ei,ri?"disable":"enable").resizable(ei,oi?"disable":"enable"),this}_onStartMoving(ei,ti,ni,ri,oi,si){var ai;if(this.engine.cleanNodes().beginUpdate(ri),this._writePosAttr(this.placeholder,ri),this.el.appendChild(this.placeholder),this.placeholder.gridstackNode=ri,(ai=ri.grid)!=null&&ai.el)this.dragTransform=bi.getValuesFromTransformedElement(ei);else if(this.placeholder&&this.placeholder.closest(".grid-stack")){let li=this.placeholder.closest(".grid-stack");this.dragTransform=bi.getValuesFromTransformedElement(li)}else this.dragTransform={xScale:1,xOffset:0,yScale:1,yOffset:0};if(ri.el=this.placeholder,ri._lastUiPosition=ni.position,ri._prevYPix=ni.position.top,ri._moving=ti.type==="dragstart",delete ri._lastTried,ti.type==="dropover"&&ri._temporaryRemoved&&(this.engine.addNode(ri),ri._moving=!0),this.engine.cacheRects(oi,si,this.opts.marginTop,this.opts.marginRight,this.opts.marginBottom,this.opts.marginLeft),ti.type==="resizestart"){let li=this.getColumn()-ri.x,ci=(this.opts.maxRow||Number.MAX_SAFE_INTEGER)-ri.y;Bn.resizable(ei,"option","minWidth",oi*Math.min(ri.minW||1,li)).resizable(ei,"option","minHeight",si*Math.min(ri.minH||1,ci)).resizable(ei,"option","maxWidth",oi*Math.min(ri.maxW||Number.MAX_SAFE_INTEGER,li)).resizable(ei,"option","maxWidthMoveLeft",oi*Math.min(ri.maxW||Number.MAX_SAFE_INTEGER,ri.x+ri.w)).resizable(ei,"option","maxHeight",si*Math.min(ri.maxH||Number.MAX_SAFE_INTEGER,ci)).resizable(ei,"option","maxHeightMoveUp",si*Math.min(ri.maxH||Number.MAX_SAFE_INTEGER,ri.y+ri.h))}}_dragOrResize(ei,ti,ni,ri,oi,si){let ai=Si({},ri._orig),li,ci=this.opts.marginLeft,ui=this.opts.marginRight,di=this.opts.marginTop,pi=this.opts.marginBottom,yi=Math.round(si*.1),gi=Math.round(oi*.1);if(ci=Math.min(ci,gi),ui=Math.min(ui,gi),di=Math.min(di,yi),pi=Math.min(pi,yi),ti.type==="drag"){if(ri._temporaryRemoved)return;let Ei=ni.position.top-ri._prevYPix;ri._prevYPix=ni.position.top,this.opts.draggable.scroll!==!1&&bi.updateScrollPosition(ei,ni.position,Ei);let Ai=ni.position.left+(ni.position.left>ri._lastUiPosition.left?-ui:ci),xi=ni.position.top+(ni.position.top>ri._lastUiPosition.top?-pi:di);ai.x=Math.round(Ai/oi),ai.y=Math.round(xi/si);let Li=this._extraDragRow;if(this.engine.collide(ri,ai)){let Oi=this.getRow(),zi=Math.max(0,ai.y+ri.h-Oi);this.opts.maxRow&&Oi+zi>this.opts.maxRow&&(zi=Math.max(0,this.opts.maxRow-Oi)),this._extraDragRow=zi}else this._extraDragRow=0;if(this._extraDragRow!==Li&&this._updateContainerHeight(),ri.x===ai.x&&ri.y===ai.y)return}else if(ti.type==="resize"){if(ai.x<0||(bi.updateScrollResize(ti,ei,si),ai.w=Math.round((ni.size.width-ci)/oi),ai.h=Math.round((ni.size.height-di)/si),ri.w===ai.w&&ri.h===ai.h)||ri._lastTried&&ri._lastTried.w===ai.w&&ri._lastTried.h===ai.h)return;let Ei=ni.position.left+ci,Ai=ni.position.top+di;ai.x=Math.round(Ei/oi),ai.y=Math.round(Ai/si),li=!0}ri._event=ti,ri._lastTried=ai;let vi={x:ni.position.left+ci,y:ni.position.top+di,w:(ni.size?ni.size.width:ri.w*oi)-ci-ui,h:(ni.size?ni.size.height:ri.h*si)-di-pi};if(this.engine.moveNodeCheck(ri,sn(Si({},ai),{cellWidth:oi,cellHeight:si,rect:vi,resizing:li}))){ri._lastUiPosition=ni.position,this.engine.cacheRects(oi,si,di,ui,pi,ci),delete ri._skipDown,li&&ri.subGrid&&ri.subGrid.onResize(),this._extraDragRow=0,this._updateContainerHeight();let Ei=ti.target;ri._sidebarOrig||this._writePosAttr(Ei,ri),this._gsEventHandler[ti.type]&&this._gsEventHandler[ti.type](ti,Ei)}}_leave(ei,ti){ti=ti||ei;let ni=ti.gridstackNode;if(!ni||(ti.style.transform=ti.style.transformOrigin=null,Bn.off(ei,"drag"),ni._temporaryRemoved))return;ni._temporaryRemoved=!0,this.engine.removeNode(ni),ni.el=ni._isExternal&&ti?ti:ei;let ri=ni._sidebarOrig;ni._isExternal&&this.engine.cleanupNode(ni),ni._sidebarOrig=ri,this.opts.removable===!0&&ii._itemRemoving(ei,!0),ei._gridstackNodeOrig?(ei.gridstackNode=ei._gridstackNodeOrig,delete ei._gridstackNodeOrig):ni._isExternal&&this.engine.restoreInitial()}commit(){return Ch(this,this.batchUpdate(!1),"commit","batchUpdate","5.2"),this}};Eo.renderCB=(ii,ei)=>{ii&&(ei!=null&&ei.content)&&(ii.textContent=ei.content)};Eo.resizeToContentParent=".grid-stack-item-content";Eo.Utils=bi;Eo.Engine=as;Eo.GDRev="11.5.0";function q_(){let ii=document.getElementById("dashboard");ii&&ii.gridstack.disable()}function W_(){let ii=document.getElementById("dashboard");ii&&ii.gridstack.enable()}function U_(ii,ei){return lo(this,null,function*(){return yield Ls(ii,{layout:ei})})}function Ah(){if(document.getElementById("dashboard")==null)return;let ei=Eo.init({cellHeight:100,disableDrag:!0,disableResize:!0,draggable:{handle:".grid-stack-item-content .card-header",appendTo:"body",scroll:!0}}),ti=document.getElementById("lock_dashboard");ti&&ti.addEventListener("click",()=>{q_()});let ni=document.getElementById("unlock_dashboard");ni&&ni.addEventListener("click",()=>{W_()});let ri=document.getElementById("save_dashboard");ri!==null&&ri.addEventListener("click",()=>{let oi=ri.getAttribute("data-url");if(oi==null)return;let si=ei.save(!1);U_(oi,si).then(ai=>{rs(ai)?Po("danger","Error Saving Dashboard Config",ai.error).show():location.reload()})})}function Dh(ii,ei){switch(ii){case"images-and-labels":{iu("image.device-image",ei),iu("text.device-image-label",ei);break}case"images-only":{iu("image.device-image",ei),nu("text.device-image-label",ei);break}case"labels-only":{nu("image.device-image",ei),nu("text.device-image-label",ei);break}}}function iu(ii,ei){var ni,ri;let ti=(ri=(ni=ei.contentDocument)==null?void 0:ni.querySelectorAll(ii))!=null?ri:[];for(let oi of ti)oi.classList.remove("hidden")}function nu(ii,ei){var ni,ri;let ti=(ri=(ni=ei.contentDocument)==null?void 0:ni.querySelectorAll(ii))!=null?ri:[];for(let oi of ti)oi.classList.add("hidden")}function Y_(ii,ei){ei.set("view",ii);for(let ti of Hi(".rack_elevation"))Dh(ii,ti)}function Oh(){let ii=Wc.get("view");for(let ei of Hi("select.rack-view"))ei.selectedIndex=[...ei.options].findIndex(ti=>ti.value==ii),ei.addEventListener("change",ti=>{Y_(ti.currentTarget.value,Wc)},!1);for(let ei of Hi(".rack_elevation"))ei.addEventListener("load",()=>{Dh(ii,ei)})}function G_(ii){let ei=document.getElementById("selector_results");if(ei==null)return;let ti=ei.getAttribute("data-selector-target");if(ti==null)return;let ni=document.getElementById(ti);if(ni==null)return;let ri=ii.getAttribute("data-label"),oi=ii.getAttribute("data-value");ni.tomselect.addOption({id:oi,display:ri}),ni.tomselect.addItem(oi)}function Lh(){for(let ii of Hi("#selector_results a"))ii.addEventListener("click",()=>G_(ii))}function K_(){let ii=document.getElementById("quick-add-object");if(ii==null)return;let ei=ii.getAttribute("data-object-id");if(ei==null)return;let ti=ii.getAttribute("data-object-repr");if(ti==null)return;let ni=ii.getAttribute("data-target-id");if(ni==null)return;let ri=document.getElementById(ni);if(ri==null)return;ri.tomselect.addOption({id:ei,display:ti}),ri.tomselect.addItem(ei);let oi=document.getElementById("htmx-modal");if(oi){let si=to.getInstance(oi);si&&si.hide()}}function Mh(){let ii=document.getElementById("htmx-modal-content");ii&&ii.addEventListener("htmx:afterSwap",()=>K_())}function Q_(){_l(),wl(),hl(),bl(),Lh(),Mh(),pl(),El()}function kh(){document.addEventListener("htmx:afterSettle",Q_)}function X_(ii){let ei=ii.currentTarget,ti=ei.baseURI.split("?")[0],ni="?",ri=Array.from(ei.options).filter(oi=>oi.selected).map(oi=>`filter_id=${oi.value}`).join("&");ti+=`${ni}${ri}`,document.location.href=ti}function Nh(){let ii=document.getElementById("results");if(pn(ii)){let ei=document.getElementById("id_filter_id");pn(ei)&&ei.addEventListener("change",X_)}}function Rh(){for(let ii of[pl,dh,El,hl,Tf,bl,bh,_l,wl,Eh,xh,Th,Ah,Oh,kh,Nh])ii()}function J_(){let ii=document.forms;for(let ti of ii)ti.method.toUpperCase()=="GET"&&ti.addEventListener("formdata",function(ni){let ri=ni.formData;for(let[oi,si]of Array.from(ri.entries()))si===""&&ri.delete(oi)});let ei=document.querySelector(".content-container");ei!==null&&ei.focus()}window.addEventListener("load",J_);document.readyState!=="loading"?Rh():document.addEventListener("DOMContentLoaded",Rh);})();
/*! Bundled license information:
clipboard/dist/clipboard.js:
@@ -18,14 +19,14 @@ clipboard/dist/clipboard.js:
bootstrap/dist/js/bootstrap.esm.js:
(*!
- * Bootstrap v5.3.3 (https://getbootstrap.com/)
- * Copyright 2011-2024 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
+ * Bootstrap v5.3.5 (https://getbootstrap.com/)
+ * Copyright 2011-2025 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*)
gridstack/dist/gridstack.js:
(*!
- * GridStack 11.3.0
+ * GridStack 11.5.0
* https://gridstackjs.com/
*
* Copyright (c) 2021-2024 Alain Dumesny
diff --git a/netbox/project-static/dist/netbox.js.map b/netbox/project-static/dist/netbox.js.map
index 853d32177..88c6c8050 100644
--- a/netbox/project-static/dist/netbox.js.map
+++ b/netbox/project-static/dist/netbox.js.map
@@ -1,7 +1,7 @@
{
"version": 3,
- "sources": ["../node_modules/clipboard/dist/clipboard.js", "../node_modules/@popperjs/core/lib/index.js", "../node_modules/@popperjs/core/lib/enums.js", "../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js", "../node_modules/@popperjs/core/lib/dom-utils/getWindow.js", "../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js", "../node_modules/@popperjs/core/lib/modifiers/applyStyles.js", "../node_modules/@popperjs/core/lib/utils/getBasePlacement.js", "../node_modules/@popperjs/core/lib/utils/math.js", "../node_modules/@popperjs/core/lib/utils/userAgent.js", "../node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js", "../node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js", "../node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js", "../node_modules/@popperjs/core/lib/dom-utils/contains.js", "../node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js", "../node_modules/@popperjs/core/lib/dom-utils/isTableElement.js", "../node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js", "../node_modules/@popperjs/core/lib/dom-utils/getParentNode.js", "../node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js", "../node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js", "../node_modules/@popperjs/core/lib/utils/within.js", "../node_modules/@popperjs/core/lib/utils/getFreshSideObject.js", "../node_modules/@popperjs/core/lib/utils/mergePaddingObject.js", "../node_modules/@popperjs/core/lib/utils/expandToHashMap.js", "../node_modules/@popperjs/core/lib/modifiers/arrow.js", "../node_modules/@popperjs/core/lib/utils/getVariation.js", "../node_modules/@popperjs/core/lib/modifiers/computeStyles.js", "../node_modules/@popperjs/core/lib/modifiers/eventListeners.js", "../node_modules/@popperjs/core/lib/utils/getOppositePlacement.js", "../node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js", "../node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js", "../node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js", "../node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js", "../node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js", "../node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js", "../node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js", "../node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js", "../node_modules/@popperjs/core/lib/utils/rectToClientRect.js", "../node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js", "../node_modules/@popperjs/core/lib/utils/computeOffsets.js", "../node_modules/@popperjs/core/lib/utils/detectOverflow.js", "../node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js", "../node_modules/@popperjs/core/lib/modifiers/flip.js", "../node_modules/@popperjs/core/lib/modifiers/hide.js", "../node_modules/@popperjs/core/lib/modifiers/offset.js", "../node_modules/@popperjs/core/lib/modifiers/popperOffsets.js", "../node_modules/@popperjs/core/lib/utils/getAltAxis.js", "../node_modules/@popperjs/core/lib/modifiers/preventOverflow.js", "../node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js", "../node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js", "../node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js", "../node_modules/@popperjs/core/lib/utils/orderModifiers.js", "../node_modules/@popperjs/core/lib/utils/debounce.js", "../node_modules/@popperjs/core/lib/utils/mergeByName.js", "../node_modules/@popperjs/core/lib/createPopper.js", "../node_modules/@popperjs/core/lib/popper-lite.js", "../node_modules/@popperjs/core/lib/popper.js", "../node_modules/bootstrap/js/src/dom/data.js", "../node_modules/bootstrap/js/src/util/index.js", "../node_modules/bootstrap/js/src/dom/event-handler.js", "../node_modules/bootstrap/js/src/dom/manipulator.js", "../node_modules/bootstrap/js/src/util/config.js", "../node_modules/bootstrap/js/src/base-component.js", "../node_modules/bootstrap/js/src/dom/selector-engine.js", "../node_modules/bootstrap/js/src/util/component-functions.js", "../node_modules/bootstrap/js/src/alert.js", "../node_modules/bootstrap/js/src/button.js", "../node_modules/bootstrap/js/src/util/swipe.js", "../node_modules/bootstrap/js/src/carousel.js", "../node_modules/bootstrap/js/src/collapse.js", "../node_modules/bootstrap/js/src/dropdown.js", "../node_modules/bootstrap/js/src/util/backdrop.js", "../node_modules/bootstrap/js/src/util/focustrap.js", "../node_modules/bootstrap/js/src/util/scrollbar.js", "../node_modules/bootstrap/js/src/modal.js", "../node_modules/bootstrap/js/src/offcanvas.js", "../node_modules/bootstrap/js/src/util/sanitizer.js", "../node_modules/bootstrap/js/src/util/template-factory.js", "../node_modules/bootstrap/js/src/tooltip.js", "../node_modules/bootstrap/js/src/popover.js", "../node_modules/bootstrap/js/src/scrollspy.js", "../node_modules/bootstrap/js/src/tab.js", "../node_modules/bootstrap/js/src/toast.js", "../node_modules/htmx.org/dist/htmx.esm.js", "../node_modules/tom-select/src/contrib/microevent.ts", "../node_modules/tom-select/src/contrib/microplugin.ts", "../node_modules/@orchidjs/unicode-variants/lib/regex.ts", "../node_modules/@orchidjs/unicode-variants/lib/strings.ts", "../node_modules/@orchidjs/unicode-variants/lib/index.ts", "../node_modules/@orchidjs/sifter/lib/utils.ts", "../node_modules/@orchidjs/sifter/lib/sifter.ts", "../node_modules/tom-select/src/utils.ts", "../node_modules/tom-select/src/vanilla.ts", "../node_modules/tom-select/src/contrib/highlight.ts", "../node_modules/tom-select/src/constants.ts", "../node_modules/tom-select/src/defaults.ts", "../node_modules/tom-select/src/getSettings.ts", "../node_modules/tom-select/src/tom-select.ts", "../node_modules/tom-select/src/utils.ts", "../node_modules/tom-select/src/plugins/change_listener/plugin.ts", "../node_modules/tom-select/src/utils.ts", "../node_modules/tom-select/src/vanilla.ts", "../node_modules/tom-select/src/plugins/checkbox_options/plugin.ts", "../node_modules/tom-select/src/vanilla.ts", "../node_modules/tom-select/src/plugins/clear_button/plugin.ts", "../node_modules/tom-select/src/utils.ts", "../node_modules/tom-select/src/vanilla.ts", "../node_modules/tom-select/src/plugins/drag_drop/plugin.ts", "../node_modules/tom-select/src/utils.ts", "../node_modules/tom-select/src/vanilla.ts", "../node_modules/tom-select/src/plugins/dropdown_header/plugin.ts", "../node_modules/tom-select/src/utils.ts", "../node_modules/tom-select/src/vanilla.ts", "../node_modules/tom-select/src/plugins/caret_position/plugin.ts", "../node_modules/tom-select/src/constants.ts", "../node_modules/tom-select/src/utils.ts", "../node_modules/tom-select/src/vanilla.ts", "../node_modules/tom-select/src/plugins/dropdown_input/plugin.ts", "../node_modules/tom-select/src/utils.ts", "../node_modules/tom-select/src/plugins/input_autogrow/plugin.ts", "../node_modules/tom-select/src/plugins/no_backspace_delete/plugin.ts", "../node_modules/tom-select/src/plugins/no_active_items/plugin.ts", "../node_modules/tom-select/src/constants.ts", "../node_modules/tom-select/src/vanilla.ts", "../node_modules/tom-select/src/plugins/optgroup_columns/plugin.ts", "../node_modules/tom-select/src/utils.ts", "../node_modules/tom-select/src/vanilla.ts", "../node_modules/tom-select/src/plugins/remove_button/plugin.ts", "../node_modules/tom-select/src/plugins/restore_on_backspace/plugin.ts", "../node_modules/tom-select/src/utils.ts", "../node_modules/tom-select/src/vanilla.ts", "../node_modules/tom-select/src/plugins/virtual_scroll/plugin.ts", "../node_modules/tom-select/src/tom-select.complete.ts", "../src/util.ts", "../src/forms/elements.ts", "../src/forms/speedSelector.ts", "../src/forms/index.ts", "../src/bs.ts", "../src/search.ts", "../src/select/config.ts", "../src/select/static.ts", "../node_modules/tom-select/src/utils.ts", "../node_modules/tom-select/src/vanilla.ts", "../node_modules/query-string/base.js", "../node_modules/decode-uri-component/index.js", "../node_modules/filter-obj/index.js", "../node_modules/split-on-first/index.js", "../node_modules/query-string/index.js", "../src/select/types.ts", "../src/select/classes/dynamicParamsMap.ts", "../src/select/classes/dynamicTomSelect.ts", "../src/select/dynamic.ts", "../src/select/index.ts", "../src/buttons/connectionToggle.ts", "../src/state/index.ts", "../src/stores/objectDepth.ts", "../src/stores/rackImages.ts", "../src/stores/previousPkCheck.ts", "../src/stores/secret.ts", "../src/buttons/depthToggle.ts", "../src/buttons/moveOptions.ts", "../src/buttons/reslug.ts", "../src/buttons/selectAll.ts", "../src/buttons/floatBulk.ts", "../src/buttons/selectMultiple.ts", "../src/buttons/markdownPreview.ts", "../src/buttons/secretToggle.ts", "../src/buttons/index.ts", "../src/colorMode.ts", "../src/messages.ts", "../src/clipboard.ts", "../node_modules/flatpickr/dist/esm/types/options.js", "../node_modules/flatpickr/dist/esm/l10n/default.js", "../node_modules/flatpickr/dist/esm/utils/index.js", "../node_modules/flatpickr/dist/esm/utils/dom.js", "../node_modules/flatpickr/dist/esm/utils/formatting.js", "../node_modules/flatpickr/dist/esm/utils/dates.js", "../node_modules/flatpickr/dist/esm/utils/polyfills.js", "../node_modules/flatpickr/dist/esm/index.js", "../src/dateSelector.ts", "../src/tableConfig.ts", "../src/tables/interfaceTable.ts", "../src/sidenav.ts", "../node_modules/gridstack/src/utils.ts", "../node_modules/gridstack/src/gridstack-engine.ts", "../node_modules/gridstack/src/types.ts", "../node_modules/gridstack/src/dd-manager.ts", "../node_modules/gridstack/src/dd-touch.ts", "../node_modules/gridstack/src/dd-resizable-handle.ts", "../node_modules/gridstack/src/dd-base-impl.ts", "../node_modules/gridstack/src/dd-resizable.ts", "../node_modules/gridstack/src/dd-draggable.ts", "../node_modules/gridstack/src/dd-droppable.ts", "../node_modules/gridstack/src/dd-element.ts", "../node_modules/gridstack/src/dd-gridstack.ts", "../node_modules/gridstack/src/gridstack.ts", "../src/dashboard.ts", "../src/racks.ts", "../src/objectSelector.ts", "../src/quickAdd.ts", "../src/htmx.ts", "../src/forms/savedFiltersSelect.ts", "../src/netbox.ts"],
- "sourcesContent": ["/*!\n * clipboard.js v2.0.11\n * https://clipboardjs.com/\n *\n * Licensed MIT \u00A9 Zeno Rocha\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"ClipboardJS\"] = factory();\n\telse\n\t\troot[\"ClipboardJS\"] = factory();\n})(this, function() {\nreturn /******/ (function() { // webpackBootstrap\n/******/ \tvar __webpack_modules__ = ({\n\n/***/ 686:\n/***/ (function(__unused_webpack_module, __webpack_exports__, __webpack_require__) {\n\n\"use strict\";\n\n// EXPORTS\n__webpack_require__.d(__webpack_exports__, {\n \"default\": function() { return /* binding */ clipboard; }\n});\n\n// EXTERNAL MODULE: ./node_modules/tiny-emitter/index.js\nvar tiny_emitter = __webpack_require__(279);\nvar tiny_emitter_default = /*#__PURE__*/__webpack_require__.n(tiny_emitter);\n// EXTERNAL MODULE: ./node_modules/good-listener/src/listen.js\nvar listen = __webpack_require__(370);\nvar listen_default = /*#__PURE__*/__webpack_require__.n(listen);\n// EXTERNAL MODULE: ./node_modules/select/src/select.js\nvar src_select = __webpack_require__(817);\nvar select_default = /*#__PURE__*/__webpack_require__.n(src_select);\n;// CONCATENATED MODULE: ./src/common/command.js\n/**\n * Executes a given operation type.\n * @param {String} type\n * @return {Boolean}\n */\nfunction command(type) {\n try {\n return document.execCommand(type);\n } catch (err) {\n return false;\n }\n}\n;// CONCATENATED MODULE: ./src/actions/cut.js\n\n\n/**\n * Cut action wrapper.\n * @param {String|HTMLElement} target\n * @return {String}\n */\n\nvar ClipboardActionCut = function ClipboardActionCut(target) {\n var selectedText = select_default()(target);\n command('cut');\n return selectedText;\n};\n\n/* harmony default export */ var actions_cut = (ClipboardActionCut);\n;// CONCATENATED MODULE: ./src/common/create-fake-element.js\n/**\n * Creates a fake textarea element with a value.\n * @param {String} value\n * @return {HTMLElement}\n */\nfunction createFakeElement(value) {\n var isRTL = document.documentElement.getAttribute('dir') === 'rtl';\n var fakeElement = document.createElement('textarea'); // Prevent zooming on iOS\n\n fakeElement.style.fontSize = '12pt'; // Reset box model\n\n fakeElement.style.border = '0';\n fakeElement.style.padding = '0';\n fakeElement.style.margin = '0'; // Move element out of screen horizontally\n\n fakeElement.style.position = 'absolute';\n fakeElement.style[isRTL ? 'right' : 'left'] = '-9999px'; // Move element to the same position vertically\n\n var yPosition = window.pageYOffset || document.documentElement.scrollTop;\n fakeElement.style.top = \"\".concat(yPosition, \"px\");\n fakeElement.setAttribute('readonly', '');\n fakeElement.value = value;\n return fakeElement;\n}\n;// CONCATENATED MODULE: ./src/actions/copy.js\n\n\n\n/**\n * Create fake copy action wrapper using a fake element.\n * @param {String} target\n * @param {Object} options\n * @return {String}\n */\n\nvar fakeCopyAction = function fakeCopyAction(value, options) {\n var fakeElement = createFakeElement(value);\n options.container.appendChild(fakeElement);\n var selectedText = select_default()(fakeElement);\n command('copy');\n fakeElement.remove();\n return selectedText;\n};\n/**\n * Copy action wrapper.\n * @param {String|HTMLElement} target\n * @param {Object} options\n * @return {String}\n */\n\n\nvar ClipboardActionCopy = function ClipboardActionCopy(target) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n container: document.body\n };\n var selectedText = '';\n\n if (typeof target === 'string') {\n selectedText = fakeCopyAction(target, options);\n } else if (target instanceof HTMLInputElement && !['text', 'search', 'url', 'tel', 'password'].includes(target === null || target === void 0 ? void 0 : target.type)) {\n // If input type doesn't support `setSelectionRange`. Simulate it. https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/setSelectionRange\n selectedText = fakeCopyAction(target.value, options);\n } else {\n selectedText = select_default()(target);\n command('copy');\n }\n\n return selectedText;\n};\n\n/* harmony default export */ var actions_copy = (ClipboardActionCopy);\n;// CONCATENATED MODULE: ./src/actions/default.js\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\n\n\n/**\n * Inner function which performs selection from either `text` or `target`\n * properties and then executes copy or cut operations.\n * @param {Object} options\n */\n\nvar ClipboardActionDefault = function ClipboardActionDefault() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n // Defines base properties passed from constructor.\n var _options$action = options.action,\n action = _options$action === void 0 ? 'copy' : _options$action,\n container = options.container,\n target = options.target,\n text = options.text; // Sets the `action` to be performed which can be either 'copy' or 'cut'.\n\n if (action !== 'copy' && action !== 'cut') {\n throw new Error('Invalid \"action\" value, use either \"copy\" or \"cut\"');\n } // Sets the `target` property using an element that will be have its content copied.\n\n\n if (target !== undefined) {\n if (target && _typeof(target) === 'object' && target.nodeType === 1) {\n if (action === 'copy' && target.hasAttribute('disabled')) {\n throw new Error('Invalid \"target\" attribute. Please use \"readonly\" instead of \"disabled\" attribute');\n }\n\n if (action === 'cut' && (target.hasAttribute('readonly') || target.hasAttribute('disabled'))) {\n throw new Error('Invalid \"target\" attribute. You can\\'t cut text from elements with \"readonly\" or \"disabled\" attributes');\n }\n } else {\n throw new Error('Invalid \"target\" value, use a valid Element');\n }\n } // Define selection strategy based on `text` property.\n\n\n if (text) {\n return actions_copy(text, {\n container: container\n });\n } // Defines which selection strategy based on `target` property.\n\n\n if (target) {\n return action === 'cut' ? actions_cut(target) : actions_copy(target, {\n container: container\n });\n }\n};\n\n/* harmony default export */ var actions_default = (ClipboardActionDefault);\n;// CONCATENATED MODULE: ./src/clipboard.js\nfunction clipboard_typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { clipboard_typeof = function _typeof(obj) { return typeof obj; }; } else { clipboard_typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return clipboard_typeof(obj); }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (clipboard_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n\n\n/**\n * Helper function to retrieve attribute value.\n * @param {String} suffix\n * @param {Element} element\n */\n\nfunction getAttributeValue(suffix, element) {\n var attribute = \"data-clipboard-\".concat(suffix);\n\n if (!element.hasAttribute(attribute)) {\n return;\n }\n\n return element.getAttribute(attribute);\n}\n/**\n * Base class which takes one or more elements, adds event listeners to them,\n * and instantiates a new `ClipboardAction` on each click.\n */\n\n\nvar Clipboard = /*#__PURE__*/function (_Emitter) {\n _inherits(Clipboard, _Emitter);\n\n var _super = _createSuper(Clipboard);\n\n /**\n * @param {String|HTMLElement|HTMLCollection|NodeList} trigger\n * @param {Object} options\n */\n function Clipboard(trigger, options) {\n var _this;\n\n _classCallCheck(this, Clipboard);\n\n _this = _super.call(this);\n\n _this.resolveOptions(options);\n\n _this.listenClick(trigger);\n\n return _this;\n }\n /**\n * Defines if attributes would be resolved using internal setter functions\n * or custom functions that were passed in the constructor.\n * @param {Object} options\n */\n\n\n _createClass(Clipboard, [{\n key: \"resolveOptions\",\n value: function resolveOptions() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n this.action = typeof options.action === 'function' ? options.action : this.defaultAction;\n this.target = typeof options.target === 'function' ? options.target : this.defaultTarget;\n this.text = typeof options.text === 'function' ? options.text : this.defaultText;\n this.container = clipboard_typeof(options.container) === 'object' ? options.container : document.body;\n }\n /**\n * Adds a click event listener to the passed trigger.\n * @param {String|HTMLElement|HTMLCollection|NodeList} trigger\n */\n\n }, {\n key: \"listenClick\",\n value: function listenClick(trigger) {\n var _this2 = this;\n\n this.listener = listen_default()(trigger, 'click', function (e) {\n return _this2.onClick(e);\n });\n }\n /**\n * Defines a new `ClipboardAction` on each click event.\n * @param {Event} e\n */\n\n }, {\n key: \"onClick\",\n value: function onClick(e) {\n var trigger = e.delegateTarget || e.currentTarget;\n var action = this.action(trigger) || 'copy';\n var text = actions_default({\n action: action,\n container: this.container,\n target: this.target(trigger),\n text: this.text(trigger)\n }); // Fires an event based on the copy operation result.\n\n this.emit(text ? 'success' : 'error', {\n action: action,\n text: text,\n trigger: trigger,\n clearSelection: function clearSelection() {\n if (trigger) {\n trigger.focus();\n }\n\n window.getSelection().removeAllRanges();\n }\n });\n }\n /**\n * Default `action` lookup function.\n * @param {Element} trigger\n */\n\n }, {\n key: \"defaultAction\",\n value: function defaultAction(trigger) {\n return getAttributeValue('action', trigger);\n }\n /**\n * Default `target` lookup function.\n * @param {Element} trigger\n */\n\n }, {\n key: \"defaultTarget\",\n value: function defaultTarget(trigger) {\n var selector = getAttributeValue('target', trigger);\n\n if (selector) {\n return document.querySelector(selector);\n }\n }\n /**\n * Allow fire programmatically a copy action\n * @param {String|HTMLElement} target\n * @param {Object} options\n * @returns Text copied.\n */\n\n }, {\n key: \"defaultText\",\n\n /**\n * Default `text` lookup function.\n * @param {Element} trigger\n */\n value: function defaultText(trigger) {\n return getAttributeValue('text', trigger);\n }\n /**\n * Destroy lifecycle.\n */\n\n }, {\n key: \"destroy\",\n value: function destroy() {\n this.listener.destroy();\n }\n }], [{\n key: \"copy\",\n value: function copy(target) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {\n container: document.body\n };\n return actions_copy(target, options);\n }\n /**\n * Allow fire programmatically a cut action\n * @param {String|HTMLElement} target\n * @returns Text cutted.\n */\n\n }, {\n key: \"cut\",\n value: function cut(target) {\n return actions_cut(target);\n }\n /**\n * Returns the support of the given action, or all actions if no action is\n * given.\n * @param {String} [action]\n */\n\n }, {\n key: \"isSupported\",\n value: function isSupported() {\n var action = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ['copy', 'cut'];\n var actions = typeof action === 'string' ? [action] : action;\n var support = !!document.queryCommandSupported;\n actions.forEach(function (action) {\n support = support && !!document.queryCommandSupported(action);\n });\n return support;\n }\n }]);\n\n return Clipboard;\n}((tiny_emitter_default()));\n\n/* harmony default export */ var clipboard = (Clipboard);\n\n/***/ }),\n\n/***/ 828:\n/***/ (function(module) {\n\nvar DOCUMENT_NODE_TYPE = 9;\n\n/**\n * A polyfill for Element.matches()\n */\nif (typeof Element !== 'undefined' && !Element.prototype.matches) {\n var proto = Element.prototype;\n\n proto.matches = proto.matchesSelector ||\n proto.mozMatchesSelector ||\n proto.msMatchesSelector ||\n proto.oMatchesSelector ||\n proto.webkitMatchesSelector;\n}\n\n/**\n * Finds the closest parent that matches a selector.\n *\n * @param {Element} element\n * @param {String} selector\n * @return {Function}\n */\nfunction closest (element, selector) {\n while (element && element.nodeType !== DOCUMENT_NODE_TYPE) {\n if (typeof element.matches === 'function' &&\n element.matches(selector)) {\n return element;\n }\n element = element.parentNode;\n }\n}\n\nmodule.exports = closest;\n\n\n/***/ }),\n\n/***/ 438:\n/***/ (function(module, __unused_webpack_exports, __webpack_require__) {\n\nvar closest = __webpack_require__(828);\n\n/**\n * Delegates event to a selector.\n *\n * @param {Element} element\n * @param {String} selector\n * @param {String} type\n * @param {Function} callback\n * @param {Boolean} useCapture\n * @return {Object}\n */\nfunction _delegate(element, selector, type, callback, useCapture) {\n var listenerFn = listener.apply(this, arguments);\n\n element.addEventListener(type, listenerFn, useCapture);\n\n return {\n destroy: function() {\n element.removeEventListener(type, listenerFn, useCapture);\n }\n }\n}\n\n/**\n * Delegates event to a selector.\n *\n * @param {Element|String|Array} [elements]\n * @param {String} selector\n * @param {String} type\n * @param {Function} callback\n * @param {Boolean} useCapture\n * @return {Object}\n */\nfunction delegate(elements, selector, type, callback, useCapture) {\n // Handle the regular Element usage\n if (typeof elements.addEventListener === 'function') {\n return _delegate.apply(null, arguments);\n }\n\n // Handle Element-less usage, it defaults to global delegation\n if (typeof type === 'function') {\n // Use `document` as the first parameter, then apply arguments\n // This is a short way to .unshift `arguments` without running into deoptimizations\n return _delegate.bind(null, document).apply(null, arguments);\n }\n\n // Handle Selector-based usage\n if (typeof elements === 'string') {\n elements = document.querySelectorAll(elements);\n }\n\n // Handle Array-like based usage\n return Array.prototype.map.call(elements, function (element) {\n return _delegate(element, selector, type, callback, useCapture);\n });\n}\n\n/**\n * Finds closest match and invokes callback.\n *\n * @param {Element} element\n * @param {String} selector\n * @param {String} type\n * @param {Function} callback\n * @return {Function}\n */\nfunction listener(element, selector, type, callback) {\n return function(e) {\n e.delegateTarget = closest(e.target, selector);\n\n if (e.delegateTarget) {\n callback.call(element, e);\n }\n }\n}\n\nmodule.exports = delegate;\n\n\n/***/ }),\n\n/***/ 879:\n/***/ (function(__unused_webpack_module, exports) {\n\n/**\n * Check if argument is a HTML element.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.node = function(value) {\n return value !== undefined\n && value instanceof HTMLElement\n && value.nodeType === 1;\n};\n\n/**\n * Check if argument is a list of HTML elements.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.nodeList = function(value) {\n var type = Object.prototype.toString.call(value);\n\n return value !== undefined\n && (type === '[object NodeList]' || type === '[object HTMLCollection]')\n && ('length' in value)\n && (value.length === 0 || exports.node(value[0]));\n};\n\n/**\n * Check if argument is a string.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.string = function(value) {\n return typeof value === 'string'\n || value instanceof String;\n};\n\n/**\n * Check if argument is a function.\n *\n * @param {Object} value\n * @return {Boolean}\n */\nexports.fn = function(value) {\n var type = Object.prototype.toString.call(value);\n\n return type === '[object Function]';\n};\n\n\n/***/ }),\n\n/***/ 370:\n/***/ (function(module, __unused_webpack_exports, __webpack_require__) {\n\nvar is = __webpack_require__(879);\nvar delegate = __webpack_require__(438);\n\n/**\n * Validates all params and calls the right\n * listener function based on its target type.\n *\n * @param {String|HTMLElement|HTMLCollection|NodeList} target\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listen(target, type, callback) {\n if (!target && !type && !callback) {\n throw new Error('Missing required arguments');\n }\n\n if (!is.string(type)) {\n throw new TypeError('Second argument must be a String');\n }\n\n if (!is.fn(callback)) {\n throw new TypeError('Third argument must be a Function');\n }\n\n if (is.node(target)) {\n return listenNode(target, type, callback);\n }\n else if (is.nodeList(target)) {\n return listenNodeList(target, type, callback);\n }\n else if (is.string(target)) {\n return listenSelector(target, type, callback);\n }\n else {\n throw new TypeError('First argument must be a String, HTMLElement, HTMLCollection, or NodeList');\n }\n}\n\n/**\n * Adds an event listener to a HTML element\n * and returns a remove listener function.\n *\n * @param {HTMLElement} node\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listenNode(node, type, callback) {\n node.addEventListener(type, callback);\n\n return {\n destroy: function() {\n node.removeEventListener(type, callback);\n }\n }\n}\n\n/**\n * Add an event listener to a list of HTML elements\n * and returns a remove listener function.\n *\n * @param {NodeList|HTMLCollection} nodeList\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listenNodeList(nodeList, type, callback) {\n Array.prototype.forEach.call(nodeList, function(node) {\n node.addEventListener(type, callback);\n });\n\n return {\n destroy: function() {\n Array.prototype.forEach.call(nodeList, function(node) {\n node.removeEventListener(type, callback);\n });\n }\n }\n}\n\n/**\n * Add an event listener to a selector\n * and returns a remove listener function.\n *\n * @param {String} selector\n * @param {String} type\n * @param {Function} callback\n * @return {Object}\n */\nfunction listenSelector(selector, type, callback) {\n return delegate(document.body, selector, type, callback);\n}\n\nmodule.exports = listen;\n\n\n/***/ }),\n\n/***/ 817:\n/***/ (function(module) {\n\nfunction select(element) {\n var selectedText;\n\n if (element.nodeName === 'SELECT') {\n element.focus();\n\n selectedText = element.value;\n }\n else if (element.nodeName === 'INPUT' || element.nodeName === 'TEXTAREA') {\n var isReadOnly = element.hasAttribute('readonly');\n\n if (!isReadOnly) {\n element.setAttribute('readonly', '');\n }\n\n element.select();\n element.setSelectionRange(0, element.value.length);\n\n if (!isReadOnly) {\n element.removeAttribute('readonly');\n }\n\n selectedText = element.value;\n }\n else {\n if (element.hasAttribute('contenteditable')) {\n element.focus();\n }\n\n var selection = window.getSelection();\n var range = document.createRange();\n\n range.selectNodeContents(element);\n selection.removeAllRanges();\n selection.addRange(range);\n\n selectedText = selection.toString();\n }\n\n return selectedText;\n}\n\nmodule.exports = select;\n\n\n/***/ }),\n\n/***/ 279:\n/***/ (function(module) {\n\nfunction E () {\n // Keep this empty so it's easier to inherit from\n // (via https://github.com/lipsmack from https://github.com/scottcorgan/tiny-emitter/issues/3)\n}\n\nE.prototype = {\n on: function (name, callback, ctx) {\n var e = this.e || (this.e = {});\n\n (e[name] || (e[name] = [])).push({\n fn: callback,\n ctx: ctx\n });\n\n return this;\n },\n\n once: function (name, callback, ctx) {\n var self = this;\n function listener () {\n self.off(name, listener);\n callback.apply(ctx, arguments);\n };\n\n listener._ = callback\n return this.on(name, listener, ctx);\n },\n\n emit: function (name) {\n var data = [].slice.call(arguments, 1);\n var evtArr = ((this.e || (this.e = {}))[name] || []).slice();\n var i = 0;\n var len = evtArr.length;\n\n for (i; i < len; i++) {\n evtArr[i].fn.apply(evtArr[i].ctx, data);\n }\n\n return this;\n },\n\n off: function (name, callback) {\n var e = this.e || (this.e = {});\n var evts = e[name];\n var liveEvents = [];\n\n if (evts && callback) {\n for (var i = 0, len = evts.length; i < len; i++) {\n if (evts[i].fn !== callback && evts[i].fn._ !== callback)\n liveEvents.push(evts[i]);\n }\n }\n\n // Remove event from queue to prevent memory leak\n // Suggested by https://github.com/lazd\n // Ref: https://github.com/scottcorgan/tiny-emitter/commit/c6ebfaa9bc973b33d110a84a307742b7cf94c953#commitcomment-5024910\n\n (liveEvents.length)\n ? e[name] = liveEvents\n : delete e[name];\n\n return this;\n }\n};\n\nmodule.exports = E;\nmodule.exports.TinyEmitter = E;\n\n\n/***/ })\n\n/******/ \t});\n/************************************************************************/\n/******/ \t// The module cache\n/******/ \tvar __webpack_module_cache__ = {};\n/******/ \t\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(__webpack_module_cache__[moduleId]) {\n/******/ \t\t\treturn __webpack_module_cache__[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = __webpack_module_cache__[moduleId] = {\n/******/ \t\t\t// no module.id needed\n/******/ \t\t\t// no module.loaded needed\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/ \t\n/******/ \t\t// Execute the module function\n/******/ \t\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n/******/ \t\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/ \t\n/************************************************************************/\n/******/ \t/* webpack/runtime/compat get default export */\n/******/ \t!function() {\n/******/ \t\t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t\t__webpack_require__.n = function(module) {\n/******/ \t\t\tvar getter = module && module.__esModule ?\n/******/ \t\t\t\tfunction() { return module['default']; } :\n/******/ \t\t\t\tfunction() { return module; };\n/******/ \t\t\t__webpack_require__.d(getter, { a: getter });\n/******/ \t\t\treturn getter;\n/******/ \t\t};\n/******/ \t}();\n/******/ \t\n/******/ \t/* webpack/runtime/define property getters */\n/******/ \t!function() {\n/******/ \t\t// define getter functions for harmony exports\n/******/ \t\t__webpack_require__.d = function(exports, definition) {\n/******/ \t\t\tfor(var key in definition) {\n/******/ \t\t\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n/******/ \t\t\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n/******/ \t\t\t\t}\n/******/ \t\t\t}\n/******/ \t\t};\n/******/ \t}();\n/******/ \t\n/******/ \t/* webpack/runtime/hasOwnProperty shorthand */\n/******/ \t!function() {\n/******/ \t\t__webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); }\n/******/ \t}();\n/******/ \t\n/************************************************************************/\n/******/ \t// module exports must be returned from runtime so entry inlining is disabled\n/******/ \t// startup\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(686);\n/******/ })()\n.default;\n});", "export * from \"./enums.js\";\nexport * from \"./modifiers/index.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport { popperGenerator, detectOverflow, createPopper as createPopperBase } from \"./createPopper.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper } from \"./popper.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper as createPopperLite } from \"./popper-lite.js\";", "export var top = 'top';\nexport var bottom = 'bottom';\nexport var right = 'right';\nexport var left = 'left';\nexport var auto = 'auto';\nexport var basePlacements = [top, bottom, right, left];\nexport var start = 'start';\nexport var end = 'end';\nexport var clippingParents = 'clippingParents';\nexport var viewport = 'viewport';\nexport var popper = 'popper';\nexport var reference = 'reference';\nexport var variationPlacements = /*#__PURE__*/basePlacements.reduce(function (acc, placement) {\n return acc.concat([placement + \"-\" + start, placement + \"-\" + end]);\n}, []);\nexport var placements = /*#__PURE__*/[].concat(basePlacements, [auto]).reduce(function (acc, placement) {\n return acc.concat([placement, placement + \"-\" + start, placement + \"-\" + end]);\n}, []); // modifiers that need to read the DOM\n\nexport var beforeRead = 'beforeRead';\nexport var read = 'read';\nexport var afterRead = 'afterRead'; // pure-logic modifiers\n\nexport var beforeMain = 'beforeMain';\nexport var main = 'main';\nexport var afterMain = 'afterMain'; // modifier with the purpose to write to the DOM (or write into a framework state)\n\nexport var beforeWrite = 'beforeWrite';\nexport var write = 'write';\nexport var afterWrite = 'afterWrite';\nexport var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];", "export default function getNodeName(element) {\n return element ? (element.nodeName || '').toLowerCase() : null;\n}", "export default function getWindow(node) {\n if (node == null) {\n return window;\n }\n\n if (node.toString() !== '[object Window]') {\n var ownerDocument = node.ownerDocument;\n return ownerDocument ? ownerDocument.defaultView || window : window;\n }\n\n return node;\n}", "import getWindow from \"./getWindow.js\";\n\nfunction isElement(node) {\n var OwnElement = getWindow(node).Element;\n return node instanceof OwnElement || node instanceof Element;\n}\n\nfunction isHTMLElement(node) {\n var OwnElement = getWindow(node).HTMLElement;\n return node instanceof OwnElement || node instanceof HTMLElement;\n}\n\nfunction isShadowRoot(node) {\n // IE 11 has no ShadowRoot\n if (typeof ShadowRoot === 'undefined') {\n return false;\n }\n\n var OwnElement = getWindow(node).ShadowRoot;\n return node instanceof OwnElement || node instanceof ShadowRoot;\n}\n\nexport { isElement, isHTMLElement, isShadowRoot };", "import getNodeName from \"../dom-utils/getNodeName.js\";\nimport { isHTMLElement } from \"../dom-utils/instanceOf.js\"; // This modifier takes the styles prepared by the `computeStyles` modifier\n// and applies them to the HTMLElements such as popper and arrow\n\nfunction applyStyles(_ref) {\n var state = _ref.state;\n Object.keys(state.elements).forEach(function (name) {\n var style = state.styles[name] || {};\n var attributes = state.attributes[name] || {};\n var element = state.elements[name]; // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n } // Flow doesn't support to extend this property, but it's the most\n // effective way to apply styles to an HTMLElement\n // $FlowFixMe[cannot-write]\n\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (name) {\n var value = attributes[name];\n\n if (value === false) {\n element.removeAttribute(name);\n } else {\n element.setAttribute(name, value === true ? '' : value);\n }\n });\n });\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state;\n var initialStyles = {\n popper: {\n position: state.options.strategy,\n left: '0',\n top: '0',\n margin: '0'\n },\n arrow: {\n position: 'absolute'\n },\n reference: {}\n };\n Object.assign(state.elements.popper.style, initialStyles.popper);\n state.styles = initialStyles;\n\n if (state.elements.arrow) {\n Object.assign(state.elements.arrow.style, initialStyles.arrow);\n }\n\n return function () {\n Object.keys(state.elements).forEach(function (name) {\n var element = state.elements[name];\n var attributes = state.attributes[name] || {};\n var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]); // Set all values to an empty string to unset them\n\n var style = styleProperties.reduce(function (style, property) {\n style[property] = '';\n return style;\n }, {}); // arrow is optional + virtual elements\n\n if (!isHTMLElement(element) || !getNodeName(element)) {\n return;\n }\n\n Object.assign(element.style, style);\n Object.keys(attributes).forEach(function (attribute) {\n element.removeAttribute(attribute);\n });\n });\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'applyStyles',\n enabled: true,\n phase: 'write',\n fn: applyStyles,\n effect: effect,\n requires: ['computeStyles']\n};", "import { auto } from \"../enums.js\";\nexport default function getBasePlacement(placement) {\n return placement.split('-')[0];\n}", "export var max = Math.max;\nexport var min = Math.min;\nexport var round = Math.round;", "export default function getUAString() {\n var uaData = navigator.userAgentData;\n\n if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {\n return uaData.brands.map(function (item) {\n return item.brand + \"/\" + item.version;\n }).join(' ');\n }\n\n return navigator.userAgent;\n}", "import getUAString from \"../utils/userAgent.js\";\nexport default function isLayoutViewport() {\n return !/^((?!chrome|android).)*safari/i.test(getUAString());\n}", "import { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport { round } from \"../utils/math.js\";\nimport getWindow from \"./getWindow.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getBoundingClientRect(element, includeScale, isFixedStrategy) {\n if (includeScale === void 0) {\n includeScale = false;\n }\n\n if (isFixedStrategy === void 0) {\n isFixedStrategy = false;\n }\n\n var clientRect = element.getBoundingClientRect();\n var scaleX = 1;\n var scaleY = 1;\n\n if (includeScale && isHTMLElement(element)) {\n scaleX = element.offsetWidth > 0 ? round(clientRect.width) / element.offsetWidth || 1 : 1;\n scaleY = element.offsetHeight > 0 ? round(clientRect.height) / element.offsetHeight || 1 : 1;\n }\n\n var _ref = isElement(element) ? getWindow(element) : window,\n visualViewport = _ref.visualViewport;\n\n var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;\n var x = (clientRect.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;\n var y = (clientRect.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;\n var width = clientRect.width / scaleX;\n var height = clientRect.height / scaleY;\n return {\n width: width,\n height: height,\n top: y,\n right: x + width,\n bottom: y + height,\n left: x,\n x: x,\n y: y\n };\n}", "import getBoundingClientRect from \"./getBoundingClientRect.js\"; // Returns the layout rect of an element relative to its offsetParent. Layout\n// means it doesn't take into account transforms.\n\nexport default function getLayoutRect(element) {\n var clientRect = getBoundingClientRect(element); // Use the clientRect sizes if it's not been transformed.\n // Fixes https://github.com/popperjs/popper-core/issues/1223\n\n var width = element.offsetWidth;\n var height = element.offsetHeight;\n\n if (Math.abs(clientRect.width - width) <= 1) {\n width = clientRect.width;\n }\n\n if (Math.abs(clientRect.height - height) <= 1) {\n height = clientRect.height;\n }\n\n return {\n x: element.offsetLeft,\n y: element.offsetTop,\n width: width,\n height: height\n };\n}", "import { isShadowRoot } from \"./instanceOf.js\";\nexport default function contains(parent, child) {\n var rootNode = child.getRootNode && child.getRootNode(); // First, attempt with faster native method\n\n if (parent.contains(child)) {\n return true;\n } // then fallback to custom implementation with Shadow DOM support\n else if (rootNode && isShadowRoot(rootNode)) {\n var next = child;\n\n do {\n if (next && parent.isSameNode(next)) {\n return true;\n } // $FlowFixMe[prop-missing]: need a better way to handle this...\n\n\n next = next.parentNode || next.host;\n } while (next);\n } // Give up, the result is false\n\n\n return false;\n}", "import getWindow from \"./getWindow.js\";\nexport default function getComputedStyle(element) {\n return getWindow(element).getComputedStyle(element);\n}", "import getNodeName from \"./getNodeName.js\";\nexport default function isTableElement(element) {\n return ['table', 'td', 'th'].indexOf(getNodeName(element)) >= 0;\n}", "import { isElement } from \"./instanceOf.js\";\nexport default function getDocumentElement(element) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return ((isElement(element) ? element.ownerDocument : // $FlowFixMe[prop-missing]\n element.document) || window.document).documentElement;\n}", "import getNodeName from \"./getNodeName.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport { isShadowRoot } from \"./instanceOf.js\";\nexport default function getParentNode(element) {\n if (getNodeName(element) === 'html') {\n return element;\n }\n\n return (// this is a quicker (but less type safe) way to save quite some bytes from the bundle\n // $FlowFixMe[incompatible-return]\n // $FlowFixMe[prop-missing]\n element.assignedSlot || // step into the shadow DOM of the parent of a slotted node\n element.parentNode || ( // DOM Element detected\n isShadowRoot(element) ? element.host : null) || // ShadowRoot detected\n // $FlowFixMe[incompatible-call]: HTMLElement is a Node\n getDocumentElement(element) // fallback\n\n );\n}", "import getWindow from \"./getWindow.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isHTMLElement, isShadowRoot } from \"./instanceOf.js\";\nimport isTableElement from \"./isTableElement.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getUAString from \"../utils/userAgent.js\";\n\nfunction getTrueOffsetParent(element) {\n if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837\n getComputedStyle(element).position === 'fixed') {\n return null;\n }\n\n return element.offsetParent;\n} // `.offsetParent` reports `null` for fixed elements, while absolute elements\n// return the containing block\n\n\nfunction getContainingBlock(element) {\n var isFirefox = /firefox/i.test(getUAString());\n var isIE = /Trident/i.test(getUAString());\n\n if (isIE && isHTMLElement(element)) {\n // In IE 9, 10 and 11 fixed elements containing block is always established by the viewport\n var elementCss = getComputedStyle(element);\n\n if (elementCss.position === 'fixed') {\n return null;\n }\n }\n\n var currentNode = getParentNode(element);\n\n if (isShadowRoot(currentNode)) {\n currentNode = currentNode.host;\n }\n\n while (isHTMLElement(currentNode) && ['html', 'body'].indexOf(getNodeName(currentNode)) < 0) {\n var css = getComputedStyle(currentNode); // This is non-exhaustive but covers the most common CSS properties that\n // create a containing block.\n // https://developer.mozilla.org/en-US/docs/Web/CSS/Containing_block#identifying_the_containing_block\n\n if (css.transform !== 'none' || css.perspective !== 'none' || css.contain === 'paint' || ['transform', 'perspective'].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === 'filter' || isFirefox && css.filter && css.filter !== 'none') {\n return currentNode;\n } else {\n currentNode = currentNode.parentNode;\n }\n }\n\n return null;\n} // Gets the closest ancestor positioned element. Handles some edge cases,\n// such as table ancestors and cross browser bugs.\n\n\nexport default function getOffsetParent(element) {\n var window = getWindow(element);\n var offsetParent = getTrueOffsetParent(element);\n\n while (offsetParent && isTableElement(offsetParent) && getComputedStyle(offsetParent).position === 'static') {\n offsetParent = getTrueOffsetParent(offsetParent);\n }\n\n if (offsetParent && (getNodeName(offsetParent) === 'html' || getNodeName(offsetParent) === 'body' && getComputedStyle(offsetParent).position === 'static')) {\n return window;\n }\n\n return offsetParent || getContainingBlock(element) || window;\n}", "export default function getMainAxisFromPlacement(placement) {\n return ['top', 'bottom'].indexOf(placement) >= 0 ? 'x' : 'y';\n}", "import { max as mathMax, min as mathMin } from \"./math.js\";\nexport function within(min, value, max) {\n return mathMax(min, mathMin(value, max));\n}\nexport function withinMaxClamp(min, value, max) {\n var v = within(min, value, max);\n return v > max ? max : v;\n}", "export default function getFreshSideObject() {\n return {\n top: 0,\n right: 0,\n bottom: 0,\n left: 0\n };\n}", "import getFreshSideObject from \"./getFreshSideObject.js\";\nexport default function mergePaddingObject(paddingObject) {\n return Object.assign({}, getFreshSideObject(), paddingObject);\n}", "export default function expandToHashMap(value, keys) {\n return keys.reduce(function (hashMap, key) {\n hashMap[key] = value;\n return hashMap;\n }, {});\n}", "import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport contains from \"../dom-utils/contains.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport { within } from \"../utils/within.js\";\nimport mergePaddingObject from \"../utils/mergePaddingObject.js\";\nimport expandToHashMap from \"../utils/expandToHashMap.js\";\nimport { left, right, basePlacements, top, bottom } from \"../enums.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar toPaddingObject = function toPaddingObject(padding, state) {\n padding = typeof padding === 'function' ? padding(Object.assign({}, state.rects, {\n placement: state.placement\n })) : padding;\n return mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n};\n\nfunction arrow(_ref) {\n var _state$modifiersData$;\n\n var state = _ref.state,\n name = _ref.name,\n options = _ref.options;\n var arrowElement = state.elements.arrow;\n var popperOffsets = state.modifiersData.popperOffsets;\n var basePlacement = getBasePlacement(state.placement);\n var axis = getMainAxisFromPlacement(basePlacement);\n var isVertical = [left, right].indexOf(basePlacement) >= 0;\n var len = isVertical ? 'height' : 'width';\n\n if (!arrowElement || !popperOffsets) {\n return;\n }\n\n var paddingObject = toPaddingObject(options.padding, state);\n var arrowRect = getLayoutRect(arrowElement);\n var minProp = axis === 'y' ? top : left;\n var maxProp = axis === 'y' ? bottom : right;\n var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets[axis] - state.rects.popper[len];\n var startDiff = popperOffsets[axis] - state.rects.reference[axis];\n var arrowOffsetParent = getOffsetParent(arrowElement);\n var clientSize = arrowOffsetParent ? axis === 'y' ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;\n var centerToReference = endDiff / 2 - startDiff / 2; // Make sure the arrow doesn't overflow the popper if the center point is\n // outside of the popper bounds\n\n var min = paddingObject[minProp];\n var max = clientSize - arrowRect[len] - paddingObject[maxProp];\n var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;\n var offset = within(min, center, max); // Prevents breaking syntax highlighting...\n\n var axisProp = axis;\n state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset, _state$modifiersData$.centerOffset = offset - center, _state$modifiersData$);\n}\n\nfunction effect(_ref2) {\n var state = _ref2.state,\n options = _ref2.options;\n var _options$element = options.element,\n arrowElement = _options$element === void 0 ? '[data-popper-arrow]' : _options$element;\n\n if (arrowElement == null) {\n return;\n } // CSS selector\n\n\n if (typeof arrowElement === 'string') {\n arrowElement = state.elements.popper.querySelector(arrowElement);\n\n if (!arrowElement) {\n return;\n }\n }\n\n if (!contains(state.elements.popper, arrowElement)) {\n return;\n }\n\n state.elements.arrow = arrowElement;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'arrow',\n enabled: true,\n phase: 'main',\n fn: arrow,\n effect: effect,\n requires: ['popperOffsets'],\n requiresIfExists: ['preventOverflow']\n};", "export default function getVariation(placement) {\n return placement.split('-')[1];\n}", "import { top, left, right, bottom, end } from \"../enums.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport getWindow from \"../dom-utils/getWindow.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getComputedStyle from \"../dom-utils/getComputedStyle.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport { round } from \"../utils/math.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar unsetSides = {\n top: 'auto',\n right: 'auto',\n bottom: 'auto',\n left: 'auto'\n}; // Round the offsets to the nearest suitable subpixel based on the DPR.\n// Zooming can change the DPR, but it seems to report a value that will\n// cleanly divide the values into the appropriate subpixels.\n\nfunction roundOffsetsByDPR(_ref, win) {\n var x = _ref.x,\n y = _ref.y;\n var dpr = win.devicePixelRatio || 1;\n return {\n x: round(x * dpr) / dpr || 0,\n y: round(y * dpr) / dpr || 0\n };\n}\n\nexport function mapToStyles(_ref2) {\n var _Object$assign2;\n\n var popper = _ref2.popper,\n popperRect = _ref2.popperRect,\n placement = _ref2.placement,\n variation = _ref2.variation,\n offsets = _ref2.offsets,\n position = _ref2.position,\n gpuAcceleration = _ref2.gpuAcceleration,\n adaptive = _ref2.adaptive,\n roundOffsets = _ref2.roundOffsets,\n isFixed = _ref2.isFixed;\n var _offsets$x = offsets.x,\n x = _offsets$x === void 0 ? 0 : _offsets$x,\n _offsets$y = offsets.y,\n y = _offsets$y === void 0 ? 0 : _offsets$y;\n\n var _ref3 = typeof roundOffsets === 'function' ? roundOffsets({\n x: x,\n y: y\n }) : {\n x: x,\n y: y\n };\n\n x = _ref3.x;\n y = _ref3.y;\n var hasX = offsets.hasOwnProperty('x');\n var hasY = offsets.hasOwnProperty('y');\n var sideX = left;\n var sideY = top;\n var win = window;\n\n if (adaptive) {\n var offsetParent = getOffsetParent(popper);\n var heightProp = 'clientHeight';\n var widthProp = 'clientWidth';\n\n if (offsetParent === getWindow(popper)) {\n offsetParent = getDocumentElement(popper);\n\n if (getComputedStyle(offsetParent).position !== 'static' && position === 'absolute') {\n heightProp = 'scrollHeight';\n widthProp = 'scrollWidth';\n }\n } // $FlowFixMe[incompatible-cast]: force type refinement, we compare offsetParent with window above, but Flow doesn't detect it\n\n\n offsetParent = offsetParent;\n\n if (placement === top || (placement === left || placement === right) && variation === end) {\n sideY = bottom;\n var offsetY = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.height : // $FlowFixMe[prop-missing]\n offsetParent[heightProp];\n y -= offsetY - popperRect.height;\n y *= gpuAcceleration ? 1 : -1;\n }\n\n if (placement === left || (placement === top || placement === bottom) && variation === end) {\n sideX = right;\n var offsetX = isFixed && offsetParent === win && win.visualViewport ? win.visualViewport.width : // $FlowFixMe[prop-missing]\n offsetParent[widthProp];\n x -= offsetX - popperRect.width;\n x *= gpuAcceleration ? 1 : -1;\n }\n }\n\n var commonStyles = Object.assign({\n position: position\n }, adaptive && unsetSides);\n\n var _ref4 = roundOffsets === true ? roundOffsetsByDPR({\n x: x,\n y: y\n }, getWindow(popper)) : {\n x: x,\n y: y\n };\n\n x = _ref4.x;\n y = _ref4.y;\n\n if (gpuAcceleration) {\n var _Object$assign;\n\n return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? '0' : '', _Object$assign[sideX] = hasX ? '0' : '', _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? \"translate(\" + x + \"px, \" + y + \"px)\" : \"translate3d(\" + x + \"px, \" + y + \"px, 0)\", _Object$assign));\n }\n\n return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + \"px\" : '', _Object$assign2[sideX] = hasX ? x + \"px\" : '', _Object$assign2.transform = '', _Object$assign2));\n}\n\nfunction computeStyles(_ref5) {\n var state = _ref5.state,\n options = _ref5.options;\n var _options$gpuAccelerat = options.gpuAcceleration,\n gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat,\n _options$adaptive = options.adaptive,\n adaptive = _options$adaptive === void 0 ? true : _options$adaptive,\n _options$roundOffsets = options.roundOffsets,\n roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;\n var commonStyles = {\n placement: getBasePlacement(state.placement),\n variation: getVariation(state.placement),\n popper: state.elements.popper,\n popperRect: state.rects.popper,\n gpuAcceleration: gpuAcceleration,\n isFixed: state.options.strategy === 'fixed'\n };\n\n if (state.modifiersData.popperOffsets != null) {\n state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.popperOffsets,\n position: state.options.strategy,\n adaptive: adaptive,\n roundOffsets: roundOffsets\n })));\n }\n\n if (state.modifiersData.arrow != null) {\n state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {\n offsets: state.modifiersData.arrow,\n position: 'absolute',\n adaptive: false,\n roundOffsets: roundOffsets\n })));\n }\n\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-placement': state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'computeStyles',\n enabled: true,\n phase: 'beforeWrite',\n fn: computeStyles,\n data: {}\n};", "import getWindow from \"../dom-utils/getWindow.js\"; // eslint-disable-next-line import/no-unused-modules\n\nvar passive = {\n passive: true\n};\n\nfunction effect(_ref) {\n var state = _ref.state,\n instance = _ref.instance,\n options = _ref.options;\n var _options$scroll = options.scroll,\n scroll = _options$scroll === void 0 ? true : _options$scroll,\n _options$resize = options.resize,\n resize = _options$resize === void 0 ? true : _options$resize;\n var window = getWindow(state.elements.popper);\n var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);\n\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.addEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.addEventListener('resize', instance.update, passive);\n }\n\n return function () {\n if (scroll) {\n scrollParents.forEach(function (scrollParent) {\n scrollParent.removeEventListener('scroll', instance.update, passive);\n });\n }\n\n if (resize) {\n window.removeEventListener('resize', instance.update, passive);\n }\n };\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'eventListeners',\n enabled: true,\n phase: 'write',\n fn: function fn() {},\n effect: effect,\n data: {}\n};", "var hash = {\n left: 'right',\n right: 'left',\n bottom: 'top',\n top: 'bottom'\n};\nexport default function getOppositePlacement(placement) {\n return placement.replace(/left|right|bottom|top/g, function (matched) {\n return hash[matched];\n });\n}", "var hash = {\n start: 'end',\n end: 'start'\n};\nexport default function getOppositeVariationPlacement(placement) {\n return placement.replace(/start|end/g, function (matched) {\n return hash[matched];\n });\n}", "import getWindow from \"./getWindow.js\";\nexport default function getWindowScroll(node) {\n var win = getWindow(node);\n var scrollLeft = win.pageXOffset;\n var scrollTop = win.pageYOffset;\n return {\n scrollLeft: scrollLeft,\n scrollTop: scrollTop\n };\n}", "import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nexport default function getWindowScrollBarX(element) {\n // If has a CSS width greater than the viewport, then this will be\n // incorrect for RTL.\n // Popper 1 is broken in this case and never had a bug report so let's assume\n // it's not an issue. I don't think anyone ever specifies width on \n // anyway.\n // Browsers where the left scrollbar doesn't cause an issue report `0` for\n // this (e.g. Edge 2019, IE11, Safari)\n return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;\n}", "import getWindow from \"./getWindow.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport isLayoutViewport from \"./isLayoutViewport.js\";\nexport default function getViewportRect(element, strategy) {\n var win = getWindow(element);\n var html = getDocumentElement(element);\n var visualViewport = win.visualViewport;\n var width = html.clientWidth;\n var height = html.clientHeight;\n var x = 0;\n var y = 0;\n\n if (visualViewport) {\n width = visualViewport.width;\n height = visualViewport.height;\n var layoutViewport = isLayoutViewport();\n\n if (layoutViewport || !layoutViewport && strategy === 'fixed') {\n x = visualViewport.offsetLeft;\n y = visualViewport.offsetTop;\n }\n }\n\n return {\n width: width,\n height: height,\n x: x + getWindowScrollBarX(element),\n y: y\n };\n}", "import getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getWindowScroll from \"./getWindowScroll.js\";\nimport { max } from \"../utils/math.js\"; // Gets the entire size of the scrollable document area, even extending outside\n// of the `` and `` rect bounds if horizontally scrollable\n\nexport default function getDocumentRect(element) {\n var _element$ownerDocumen;\n\n var html = getDocumentElement(element);\n var winScroll = getWindowScroll(element);\n var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;\n var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);\n var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);\n var x = -winScroll.scrollLeft + getWindowScrollBarX(element);\n var y = -winScroll.scrollTop;\n\n if (getComputedStyle(body || html).direction === 'rtl') {\n x += max(html.clientWidth, body ? body.clientWidth : 0) - width;\n }\n\n return {\n width: width,\n height: height,\n x: x,\n y: y\n };\n}", "import getComputedStyle from \"./getComputedStyle.js\";\nexport default function isScrollParent(element) {\n // Firefox wants us to check `-x` and `-y` variations as well\n var _getComputedStyle = getComputedStyle(element),\n overflow = _getComputedStyle.overflow,\n overflowX = _getComputedStyle.overflowX,\n overflowY = _getComputedStyle.overflowY;\n\n return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);\n}", "import getParentNode from \"./getParentNode.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nexport default function getScrollParent(node) {\n if (['html', 'body', '#document'].indexOf(getNodeName(node)) >= 0) {\n // $FlowFixMe[incompatible-return]: assume body is always available\n return node.ownerDocument.body;\n }\n\n if (isHTMLElement(node) && isScrollParent(node)) {\n return node;\n }\n\n return getScrollParent(getParentNode(node));\n}", "import getScrollParent from \"./getScrollParent.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport getWindow from \"./getWindow.js\";\nimport isScrollParent from \"./isScrollParent.js\";\n/*\ngiven a DOM element, return the list of all scroll parents, up the list of ancesors\nuntil we get to the top window object. This list is what we attach scroll listeners\nto, because if any of these parent elements scroll, we'll need to re-calculate the\nreference element's position.\n*/\n\nexport default function listScrollParents(element, list) {\n var _element$ownerDocumen;\n\n if (list === void 0) {\n list = [];\n }\n\n var scrollParent = getScrollParent(element);\n var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);\n var win = getWindow(scrollParent);\n var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;\n var updatedList = list.concat(target);\n return isBody ? updatedList : // $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here\n updatedList.concat(listScrollParents(getParentNode(target)));\n}", "export default function rectToClientRect(rect) {\n return Object.assign({}, rect, {\n left: rect.x,\n top: rect.y,\n right: rect.x + rect.width,\n bottom: rect.y + rect.height\n });\n}", "import { viewport } from \"../enums.js\";\nimport getViewportRect from \"./getViewportRect.js\";\nimport getDocumentRect from \"./getDocumentRect.js\";\nimport listScrollParents from \"./listScrollParents.js\";\nimport getOffsetParent from \"./getOffsetParent.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport getComputedStyle from \"./getComputedStyle.js\";\nimport { isElement, isHTMLElement } from \"./instanceOf.js\";\nimport getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getParentNode from \"./getParentNode.js\";\nimport contains from \"./contains.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport rectToClientRect from \"../utils/rectToClientRect.js\";\nimport { max, min } from \"../utils/math.js\";\n\nfunction getInnerBoundingClientRect(element, strategy) {\n var rect = getBoundingClientRect(element, false, strategy === 'fixed');\n rect.top = rect.top + element.clientTop;\n rect.left = rect.left + element.clientLeft;\n rect.bottom = rect.top + element.clientHeight;\n rect.right = rect.left + element.clientWidth;\n rect.width = element.clientWidth;\n rect.height = element.clientHeight;\n rect.x = rect.left;\n rect.y = rect.top;\n return rect;\n}\n\nfunction getClientRectFromMixedType(element, clippingParent, strategy) {\n return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement(clippingParent) ? getInnerBoundingClientRect(clippingParent, strategy) : rectToClientRect(getDocumentRect(getDocumentElement(element)));\n} // A \"clipping parent\" is an overflowable container with the characteristic of\n// clipping (or hiding) overflowing elements with a position different from\n// `initial`\n\n\nfunction getClippingParents(element) {\n var clippingParents = listScrollParents(getParentNode(element));\n var canEscapeClipping = ['absolute', 'fixed'].indexOf(getComputedStyle(element).position) >= 0;\n var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;\n\n if (!isElement(clipperElement)) {\n return [];\n } // $FlowFixMe[incompatible-return]: https://github.com/facebook/flow/issues/1414\n\n\n return clippingParents.filter(function (clippingParent) {\n return isElement(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== 'body';\n });\n} // Gets the maximum area that the element is visible in due to any number of\n// clipping parents\n\n\nexport default function getClippingRect(element, boundary, rootBoundary, strategy) {\n var mainClippingParents = boundary === 'clippingParents' ? getClippingParents(element) : [].concat(boundary);\n var clippingParents = [].concat(mainClippingParents, [rootBoundary]);\n var firstClippingParent = clippingParents[0];\n var clippingRect = clippingParents.reduce(function (accRect, clippingParent) {\n var rect = getClientRectFromMixedType(element, clippingParent, strategy);\n accRect.top = max(rect.top, accRect.top);\n accRect.right = min(rect.right, accRect.right);\n accRect.bottom = min(rect.bottom, accRect.bottom);\n accRect.left = max(rect.left, accRect.left);\n return accRect;\n }, getClientRectFromMixedType(element, firstClippingParent, strategy));\n clippingRect.width = clippingRect.right - clippingRect.left;\n clippingRect.height = clippingRect.bottom - clippingRect.top;\n clippingRect.x = clippingRect.left;\n clippingRect.y = clippingRect.top;\n return clippingRect;\n}", "import getBasePlacement from \"./getBasePlacement.js\";\nimport getVariation from \"./getVariation.js\";\nimport getMainAxisFromPlacement from \"./getMainAxisFromPlacement.js\";\nimport { top, right, bottom, left, start, end } from \"../enums.js\";\nexport default function computeOffsets(_ref) {\n var reference = _ref.reference,\n element = _ref.element,\n placement = _ref.placement;\n var basePlacement = placement ? getBasePlacement(placement) : null;\n var variation = placement ? getVariation(placement) : null;\n var commonX = reference.x + reference.width / 2 - element.width / 2;\n var commonY = reference.y + reference.height / 2 - element.height / 2;\n var offsets;\n\n switch (basePlacement) {\n case top:\n offsets = {\n x: commonX,\n y: reference.y - element.height\n };\n break;\n\n case bottom:\n offsets = {\n x: commonX,\n y: reference.y + reference.height\n };\n break;\n\n case right:\n offsets = {\n x: reference.x + reference.width,\n y: commonY\n };\n break;\n\n case left:\n offsets = {\n x: reference.x - element.width,\n y: commonY\n };\n break;\n\n default:\n offsets = {\n x: reference.x,\n y: reference.y\n };\n }\n\n var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;\n\n if (mainAxis != null) {\n var len = mainAxis === 'y' ? 'height' : 'width';\n\n switch (variation) {\n case start:\n offsets[mainAxis] = offsets[mainAxis] - (reference[len] / 2 - element[len] / 2);\n break;\n\n case end:\n offsets[mainAxis] = offsets[mainAxis] + (reference[len] / 2 - element[len] / 2);\n break;\n\n default:\n }\n }\n\n return offsets;\n}", "import getClippingRect from \"../dom-utils/getClippingRect.js\";\nimport getDocumentElement from \"../dom-utils/getDocumentElement.js\";\nimport getBoundingClientRect from \"../dom-utils/getBoundingClientRect.js\";\nimport computeOffsets from \"./computeOffsets.js\";\nimport rectToClientRect from \"./rectToClientRect.js\";\nimport { clippingParents, reference, popper, bottom, top, right, basePlacements, viewport } from \"../enums.js\";\nimport { isElement } from \"../dom-utils/instanceOf.js\";\nimport mergePaddingObject from \"./mergePaddingObject.js\";\nimport expandToHashMap from \"./expandToHashMap.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport default function detectOverflow(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n _options$placement = _options.placement,\n placement = _options$placement === void 0 ? state.placement : _options$placement,\n _options$strategy = _options.strategy,\n strategy = _options$strategy === void 0 ? state.strategy : _options$strategy,\n _options$boundary = _options.boundary,\n boundary = _options$boundary === void 0 ? clippingParents : _options$boundary,\n _options$rootBoundary = _options.rootBoundary,\n rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary,\n _options$elementConte = _options.elementContext,\n elementContext = _options$elementConte === void 0 ? popper : _options$elementConte,\n _options$altBoundary = _options.altBoundary,\n altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary,\n _options$padding = _options.padding,\n padding = _options$padding === void 0 ? 0 : _options$padding;\n var paddingObject = mergePaddingObject(typeof padding !== 'number' ? padding : expandToHashMap(padding, basePlacements));\n var altContext = elementContext === popper ? reference : popper;\n var popperRect = state.rects.popper;\n var element = state.elements[altBoundary ? altContext : elementContext];\n var clippingClientRect = getClippingRect(isElement(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary, strategy);\n var referenceClientRect = getBoundingClientRect(state.elements.reference);\n var popperOffsets = computeOffsets({\n reference: referenceClientRect,\n element: popperRect,\n strategy: 'absolute',\n placement: placement\n });\n var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets));\n var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect; // positive = overflowing the clipping rect\n // 0 or negative = within the clipping rect\n\n var overflowOffsets = {\n top: clippingClientRect.top - elementClientRect.top + paddingObject.top,\n bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,\n left: clippingClientRect.left - elementClientRect.left + paddingObject.left,\n right: elementClientRect.right - clippingClientRect.right + paddingObject.right\n };\n var offsetData = state.modifiersData.offset; // Offsets can be applied only to the popper element\n\n if (elementContext === popper && offsetData) {\n var offset = offsetData[placement];\n Object.keys(overflowOffsets).forEach(function (key) {\n var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;\n var axis = [top, bottom].indexOf(key) >= 0 ? 'y' : 'x';\n overflowOffsets[key] += offset[axis] * multiply;\n });\n }\n\n return overflowOffsets;\n}", "import getVariation from \"./getVariation.js\";\nimport { variationPlacements, basePlacements, placements as allPlacements } from \"../enums.js\";\nimport detectOverflow from \"./detectOverflow.js\";\nimport getBasePlacement from \"./getBasePlacement.js\";\nexport default function computeAutoPlacement(state, options) {\n if (options === void 0) {\n options = {};\n }\n\n var _options = options,\n placement = _options.placement,\n boundary = _options.boundary,\n rootBoundary = _options.rootBoundary,\n padding = _options.padding,\n flipVariations = _options.flipVariations,\n _options$allowedAutoP = _options.allowedAutoPlacements,\n allowedAutoPlacements = _options$allowedAutoP === void 0 ? allPlacements : _options$allowedAutoP;\n var variation = getVariation(placement);\n var placements = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function (placement) {\n return getVariation(placement) === variation;\n }) : basePlacements;\n var allowedPlacements = placements.filter(function (placement) {\n return allowedAutoPlacements.indexOf(placement) >= 0;\n });\n\n if (allowedPlacements.length === 0) {\n allowedPlacements = placements;\n } // $FlowFixMe[incompatible-type]: Flow seems to have problems with two array unions...\n\n\n var overflows = allowedPlacements.reduce(function (acc, placement) {\n acc[placement] = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding\n })[getBasePlacement(placement)];\n return acc;\n }, {});\n return Object.keys(overflows).sort(function (a, b) {\n return overflows[a] - overflows[b];\n });\n}", "import getOppositePlacement from \"../utils/getOppositePlacement.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getOppositeVariationPlacement from \"../utils/getOppositeVariationPlacement.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport computeAutoPlacement from \"../utils/computeAutoPlacement.js\";\nimport { bottom, top, start, right, left, auto } from \"../enums.js\";\nimport getVariation from \"../utils/getVariation.js\"; // eslint-disable-next-line import/no-unused-modules\n\nfunction getExpandedFallbackPlacements(placement) {\n if (getBasePlacement(placement) === auto) {\n return [];\n }\n\n var oppositePlacement = getOppositePlacement(placement);\n return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];\n}\n\nfunction flip(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n\n if (state.modifiersData[name]._skip) {\n return;\n }\n\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis,\n specifiedFallbackPlacements = options.fallbackPlacements,\n padding = options.padding,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n _options$flipVariatio = options.flipVariations,\n flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio,\n allowedAutoPlacements = options.allowedAutoPlacements;\n var preferredPlacement = state.options.placement;\n var basePlacement = getBasePlacement(preferredPlacement);\n var isBasePlacement = basePlacement === preferredPlacement;\n var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));\n var placements = [preferredPlacement].concat(fallbackPlacements).reduce(function (acc, placement) {\n return acc.concat(getBasePlacement(placement) === auto ? computeAutoPlacement(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n flipVariations: flipVariations,\n allowedAutoPlacements: allowedAutoPlacements\n }) : placement);\n }, []);\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var checksMap = new Map();\n var makeFallbackChecks = true;\n var firstFittingPlacement = placements[0];\n\n for (var i = 0; i < placements.length; i++) {\n var placement = placements[i];\n\n var _basePlacement = getBasePlacement(placement);\n\n var isStartVariation = getVariation(placement) === start;\n var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;\n var len = isVertical ? 'width' : 'height';\n var overflow = detectOverflow(state, {\n placement: placement,\n boundary: boundary,\n rootBoundary: rootBoundary,\n altBoundary: altBoundary,\n padding: padding\n });\n var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;\n\n if (referenceRect[len] > popperRect[len]) {\n mainVariationSide = getOppositePlacement(mainVariationSide);\n }\n\n var altVariationSide = getOppositePlacement(mainVariationSide);\n var checks = [];\n\n if (checkMainAxis) {\n checks.push(overflow[_basePlacement] <= 0);\n }\n\n if (checkAltAxis) {\n checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);\n }\n\n if (checks.every(function (check) {\n return check;\n })) {\n firstFittingPlacement = placement;\n makeFallbackChecks = false;\n break;\n }\n\n checksMap.set(placement, checks);\n }\n\n if (makeFallbackChecks) {\n // `2` may be desired in some cases \u2013 research later\n var numberOfChecks = flipVariations ? 3 : 1;\n\n var _loop = function _loop(_i) {\n var fittingPlacement = placements.find(function (placement) {\n var checks = checksMap.get(placement);\n\n if (checks) {\n return checks.slice(0, _i).every(function (check) {\n return check;\n });\n }\n });\n\n if (fittingPlacement) {\n firstFittingPlacement = fittingPlacement;\n return \"break\";\n }\n };\n\n for (var _i = numberOfChecks; _i > 0; _i--) {\n var _ret = _loop(_i);\n\n if (_ret === \"break\") break;\n }\n }\n\n if (state.placement !== firstFittingPlacement) {\n state.modifiersData[name]._skip = true;\n state.placement = firstFittingPlacement;\n state.reset = true;\n }\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'flip',\n enabled: true,\n phase: 'main',\n fn: flip,\n requiresIfExists: ['offset'],\n data: {\n _skip: false\n }\n};", "import { top, bottom, left, right } from \"../enums.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\n\nfunction getSideOffsets(overflow, rect, preventedOffsets) {\n if (preventedOffsets === void 0) {\n preventedOffsets = {\n x: 0,\n y: 0\n };\n }\n\n return {\n top: overflow.top - rect.height - preventedOffsets.y,\n right: overflow.right - rect.width + preventedOffsets.x,\n bottom: overflow.bottom - rect.height + preventedOffsets.y,\n left: overflow.left - rect.width - preventedOffsets.x\n };\n}\n\nfunction isAnySideFullyClipped(overflow) {\n return [top, right, bottom, left].some(function (side) {\n return overflow[side] >= 0;\n });\n}\n\nfunction hide(_ref) {\n var state = _ref.state,\n name = _ref.name;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var preventedOffsets = state.modifiersData.preventOverflow;\n var referenceOverflow = detectOverflow(state, {\n elementContext: 'reference'\n });\n var popperAltOverflow = detectOverflow(state, {\n altBoundary: true\n });\n var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);\n var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);\n var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);\n var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);\n state.modifiersData[name] = {\n referenceClippingOffsets: referenceClippingOffsets,\n popperEscapeOffsets: popperEscapeOffsets,\n isReferenceHidden: isReferenceHidden,\n hasPopperEscaped: hasPopperEscaped\n };\n state.attributes.popper = Object.assign({}, state.attributes.popper, {\n 'data-popper-reference-hidden': isReferenceHidden,\n 'data-popper-escaped': hasPopperEscaped\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'hide',\n enabled: true,\n phase: 'main',\n requiresIfExists: ['preventOverflow'],\n fn: hide\n};", "import getBasePlacement from \"../utils/getBasePlacement.js\";\nimport { top, left, right, placements } from \"../enums.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport function distanceAndSkiddingToXY(placement, rects, offset) {\n var basePlacement = getBasePlacement(placement);\n var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;\n\n var _ref = typeof offset === 'function' ? offset(Object.assign({}, rects, {\n placement: placement\n })) : offset,\n skidding = _ref[0],\n distance = _ref[1];\n\n skidding = skidding || 0;\n distance = (distance || 0) * invertDistance;\n return [left, right].indexOf(basePlacement) >= 0 ? {\n x: distance,\n y: skidding\n } : {\n x: skidding,\n y: distance\n };\n}\n\nfunction offset(_ref2) {\n var state = _ref2.state,\n options = _ref2.options,\n name = _ref2.name;\n var _options$offset = options.offset,\n offset = _options$offset === void 0 ? [0, 0] : _options$offset;\n var data = placements.reduce(function (acc, placement) {\n acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset);\n return acc;\n }, {});\n var _data$state$placement = data[state.placement],\n x = _data$state$placement.x,\n y = _data$state$placement.y;\n\n if (state.modifiersData.popperOffsets != null) {\n state.modifiersData.popperOffsets.x += x;\n state.modifiersData.popperOffsets.y += y;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'offset',\n enabled: true,\n phase: 'main',\n requires: ['popperOffsets'],\n fn: offset\n};", "import computeOffsets from \"../utils/computeOffsets.js\";\n\nfunction popperOffsets(_ref) {\n var state = _ref.state,\n name = _ref.name;\n // Offsets are the actual position the popper needs to have to be\n // properly positioned near its reference element\n // This is the most basic placement, and will be adjusted by\n // the modifiers in the next step\n state.modifiersData[name] = computeOffsets({\n reference: state.rects.reference,\n element: state.rects.popper,\n strategy: 'absolute',\n placement: state.placement\n });\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'popperOffsets',\n enabled: true,\n phase: 'read',\n fn: popperOffsets,\n data: {}\n};", "export default function getAltAxis(axis) {\n return axis === 'x' ? 'y' : 'x';\n}", "import { top, left, right, bottom, start } from \"../enums.js\";\nimport getBasePlacement from \"../utils/getBasePlacement.js\";\nimport getMainAxisFromPlacement from \"../utils/getMainAxisFromPlacement.js\";\nimport getAltAxis from \"../utils/getAltAxis.js\";\nimport { within, withinMaxClamp } from \"../utils/within.js\";\nimport getLayoutRect from \"../dom-utils/getLayoutRect.js\";\nimport getOffsetParent from \"../dom-utils/getOffsetParent.js\";\nimport detectOverflow from \"../utils/detectOverflow.js\";\nimport getVariation from \"../utils/getVariation.js\";\nimport getFreshSideObject from \"../utils/getFreshSideObject.js\";\nimport { min as mathMin, max as mathMax } from \"../utils/math.js\";\n\nfunction preventOverflow(_ref) {\n var state = _ref.state,\n options = _ref.options,\n name = _ref.name;\n var _options$mainAxis = options.mainAxis,\n checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis,\n _options$altAxis = options.altAxis,\n checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis,\n boundary = options.boundary,\n rootBoundary = options.rootBoundary,\n altBoundary = options.altBoundary,\n padding = options.padding,\n _options$tether = options.tether,\n tether = _options$tether === void 0 ? true : _options$tether,\n _options$tetherOffset = options.tetherOffset,\n tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;\n var overflow = detectOverflow(state, {\n boundary: boundary,\n rootBoundary: rootBoundary,\n padding: padding,\n altBoundary: altBoundary\n });\n var basePlacement = getBasePlacement(state.placement);\n var variation = getVariation(state.placement);\n var isBasePlacement = !variation;\n var mainAxis = getMainAxisFromPlacement(basePlacement);\n var altAxis = getAltAxis(mainAxis);\n var popperOffsets = state.modifiersData.popperOffsets;\n var referenceRect = state.rects.reference;\n var popperRect = state.rects.popper;\n var tetherOffsetValue = typeof tetherOffset === 'function' ? tetherOffset(Object.assign({}, state.rects, {\n placement: state.placement\n })) : tetherOffset;\n var normalizedTetherOffsetValue = typeof tetherOffsetValue === 'number' ? {\n mainAxis: tetherOffsetValue,\n altAxis: tetherOffsetValue\n } : Object.assign({\n mainAxis: 0,\n altAxis: 0\n }, tetherOffsetValue);\n var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;\n var data = {\n x: 0,\n y: 0\n };\n\n if (!popperOffsets) {\n return;\n }\n\n if (checkMainAxis) {\n var _offsetModifierState$;\n\n var mainSide = mainAxis === 'y' ? top : left;\n var altSide = mainAxis === 'y' ? bottom : right;\n var len = mainAxis === 'y' ? 'height' : 'width';\n var offset = popperOffsets[mainAxis];\n var min = offset + overflow[mainSide];\n var max = offset - overflow[altSide];\n var additive = tether ? -popperRect[len] / 2 : 0;\n var minLen = variation === start ? referenceRect[len] : popperRect[len];\n var maxLen = variation === start ? -popperRect[len] : -referenceRect[len]; // We need to include the arrow in the calculation so the arrow doesn't go\n // outside the reference bounds\n\n var arrowElement = state.elements.arrow;\n var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {\n width: 0,\n height: 0\n };\n var arrowPaddingObject = state.modifiersData['arrow#persistent'] ? state.modifiersData['arrow#persistent'].padding : getFreshSideObject();\n var arrowPaddingMin = arrowPaddingObject[mainSide];\n var arrowPaddingMax = arrowPaddingObject[altSide]; // If the reference length is smaller than the arrow length, we don't want\n // to include its full size in the calculation. If the reference is small\n // and near the edge of a boundary, the popper can overflow even if the\n // reference is not overflowing as well (e.g. virtual elements with no\n // width or height)\n\n var arrowLen = within(0, referenceRect[len], arrowRect[len]);\n var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;\n var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;\n var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);\n var clientOffset = arrowOffsetParent ? mainAxis === 'y' ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;\n var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;\n var tetherMin = offset + minOffset - offsetModifierValue - clientOffset;\n var tetherMax = offset + maxOffset - offsetModifierValue;\n var preventedOffset = within(tether ? mathMin(min, tetherMin) : min, offset, tether ? mathMax(max, tetherMax) : max);\n popperOffsets[mainAxis] = preventedOffset;\n data[mainAxis] = preventedOffset - offset;\n }\n\n if (checkAltAxis) {\n var _offsetModifierState$2;\n\n var _mainSide = mainAxis === 'x' ? top : left;\n\n var _altSide = mainAxis === 'x' ? bottom : right;\n\n var _offset = popperOffsets[altAxis];\n\n var _len = altAxis === 'y' ? 'height' : 'width';\n\n var _min = _offset + overflow[_mainSide];\n\n var _max = _offset - overflow[_altSide];\n\n var isOriginSide = [top, left].indexOf(basePlacement) !== -1;\n\n var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;\n\n var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;\n\n var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;\n\n var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);\n\n popperOffsets[altAxis] = _preventedOffset;\n data[altAxis] = _preventedOffset - _offset;\n }\n\n state.modifiersData[name] = data;\n} // eslint-disable-next-line import/no-unused-modules\n\n\nexport default {\n name: 'preventOverflow',\n enabled: true,\n phase: 'main',\n fn: preventOverflow,\n requiresIfExists: ['offset']\n};", "export default function getHTMLElementScroll(element) {\n return {\n scrollLeft: element.scrollLeft,\n scrollTop: element.scrollTop\n };\n}", "import getWindowScroll from \"./getWindowScroll.js\";\nimport getWindow from \"./getWindow.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getHTMLElementScroll from \"./getHTMLElementScroll.js\";\nexport default function getNodeScroll(node) {\n if (node === getWindow(node) || !isHTMLElement(node)) {\n return getWindowScroll(node);\n } else {\n return getHTMLElementScroll(node);\n }\n}", "import getBoundingClientRect from \"./getBoundingClientRect.js\";\nimport getNodeScroll from \"./getNodeScroll.js\";\nimport getNodeName from \"./getNodeName.js\";\nimport { isHTMLElement } from \"./instanceOf.js\";\nimport getWindowScrollBarX from \"./getWindowScrollBarX.js\";\nimport getDocumentElement from \"./getDocumentElement.js\";\nimport isScrollParent from \"./isScrollParent.js\";\nimport { round } from \"../utils/math.js\";\n\nfunction isElementScaled(element) {\n var rect = element.getBoundingClientRect();\n var scaleX = round(rect.width) / element.offsetWidth || 1;\n var scaleY = round(rect.height) / element.offsetHeight || 1;\n return scaleX !== 1 || scaleY !== 1;\n} // Returns the composite rect of an element relative to its offsetParent.\n// Composite means it takes into account transforms as well as layout.\n\n\nexport default function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {\n if (isFixed === void 0) {\n isFixed = false;\n }\n\n var isOffsetParentAnElement = isHTMLElement(offsetParent);\n var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);\n var documentElement = getDocumentElement(offsetParent);\n var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);\n var scroll = {\n scrollLeft: 0,\n scrollTop: 0\n };\n var offsets = {\n x: 0,\n y: 0\n };\n\n if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {\n if (getNodeName(offsetParent) !== 'body' || // https://github.com/popperjs/popper-core/issues/1078\n isScrollParent(documentElement)) {\n scroll = getNodeScroll(offsetParent);\n }\n\n if (isHTMLElement(offsetParent)) {\n offsets = getBoundingClientRect(offsetParent, true);\n offsets.x += offsetParent.clientLeft;\n offsets.y += offsetParent.clientTop;\n } else if (documentElement) {\n offsets.x = getWindowScrollBarX(documentElement);\n }\n }\n\n return {\n x: rect.left + scroll.scrollLeft - offsets.x,\n y: rect.top + scroll.scrollTop - offsets.y,\n width: rect.width,\n height: rect.height\n };\n}", "import { modifierPhases } from \"../enums.js\"; // source: https://stackoverflow.com/questions/49875255\n\nfunction order(modifiers) {\n var map = new Map();\n var visited = new Set();\n var result = [];\n modifiers.forEach(function (modifier) {\n map.set(modifier.name, modifier);\n }); // On visiting object, check for its dependencies and visit them recursively\n\n function sort(modifier) {\n visited.add(modifier.name);\n var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);\n requires.forEach(function (dep) {\n if (!visited.has(dep)) {\n var depModifier = map.get(dep);\n\n if (depModifier) {\n sort(depModifier);\n }\n }\n });\n result.push(modifier);\n }\n\n modifiers.forEach(function (modifier) {\n if (!visited.has(modifier.name)) {\n // check for visited object\n sort(modifier);\n }\n });\n return result;\n}\n\nexport default function orderModifiers(modifiers) {\n // order based on dependencies\n var orderedModifiers = order(modifiers); // order based on phase\n\n return modifierPhases.reduce(function (acc, phase) {\n return acc.concat(orderedModifiers.filter(function (modifier) {\n return modifier.phase === phase;\n }));\n }, []);\n}", "export default function debounce(fn) {\n var pending;\n return function () {\n if (!pending) {\n pending = new Promise(function (resolve) {\n Promise.resolve().then(function () {\n pending = undefined;\n resolve(fn());\n });\n });\n }\n\n return pending;\n };\n}", "export default function mergeByName(modifiers) {\n var merged = modifiers.reduce(function (merged, current) {\n var existing = merged[current.name];\n merged[current.name] = existing ? Object.assign({}, existing, current, {\n options: Object.assign({}, existing.options, current.options),\n data: Object.assign({}, existing.data, current.data)\n }) : current;\n return merged;\n }, {}); // IE11 does not support Object.values\n\n return Object.keys(merged).map(function (key) {\n return merged[key];\n });\n}", "import getCompositeRect from \"./dom-utils/getCompositeRect.js\";\nimport getLayoutRect from \"./dom-utils/getLayoutRect.js\";\nimport listScrollParents from \"./dom-utils/listScrollParents.js\";\nimport getOffsetParent from \"./dom-utils/getOffsetParent.js\";\nimport orderModifiers from \"./utils/orderModifiers.js\";\nimport debounce from \"./utils/debounce.js\";\nimport mergeByName from \"./utils/mergeByName.js\";\nimport detectOverflow from \"./utils/detectOverflow.js\";\nimport { isElement } from \"./dom-utils/instanceOf.js\";\nvar DEFAULT_OPTIONS = {\n placement: 'bottom',\n modifiers: [],\n strategy: 'absolute'\n};\n\nfunction areValidElements() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return !args.some(function (element) {\n return !(element && typeof element.getBoundingClientRect === 'function');\n });\n}\n\nexport function popperGenerator(generatorOptions) {\n if (generatorOptions === void 0) {\n generatorOptions = {};\n }\n\n var _generatorOptions = generatorOptions,\n _generatorOptions$def = _generatorOptions.defaultModifiers,\n defaultModifiers = _generatorOptions$def === void 0 ? [] : _generatorOptions$def,\n _generatorOptions$def2 = _generatorOptions.defaultOptions,\n defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;\n return function createPopper(reference, popper, options) {\n if (options === void 0) {\n options = defaultOptions;\n }\n\n var state = {\n placement: 'bottom',\n orderedModifiers: [],\n options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),\n modifiersData: {},\n elements: {\n reference: reference,\n popper: popper\n },\n attributes: {},\n styles: {}\n };\n var effectCleanupFns = [];\n var isDestroyed = false;\n var instance = {\n state: state,\n setOptions: function setOptions(setOptionsAction) {\n var options = typeof setOptionsAction === 'function' ? setOptionsAction(state.options) : setOptionsAction;\n cleanupModifierEffects();\n state.options = Object.assign({}, defaultOptions, state.options, options);\n state.scrollParents = {\n reference: isElement(reference) ? listScrollParents(reference) : reference.contextElement ? listScrollParents(reference.contextElement) : [],\n popper: listScrollParents(popper)\n }; // Orders the modifiers based on their dependencies and `phase`\n // properties\n\n var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers, state.options.modifiers))); // Strip out disabled modifiers\n\n state.orderedModifiers = orderedModifiers.filter(function (m) {\n return m.enabled;\n });\n runModifierEffects();\n return instance.update();\n },\n // Sync update \u2013 it will always be executed, even if not necessary. This\n // is useful for low frequency updates where sync behavior simplifies the\n // logic.\n // For high frequency updates (e.g. `resize` and `scroll` events), always\n // prefer the async Popper#update method\n forceUpdate: function forceUpdate() {\n if (isDestroyed) {\n return;\n }\n\n var _state$elements = state.elements,\n reference = _state$elements.reference,\n popper = _state$elements.popper; // Don't proceed if `reference` or `popper` are not valid elements\n // anymore\n\n if (!areValidElements(reference, popper)) {\n return;\n } // Store the reference and popper rects to be read by modifiers\n\n\n state.rects = {\n reference: getCompositeRect(reference, getOffsetParent(popper), state.options.strategy === 'fixed'),\n popper: getLayoutRect(popper)\n }; // Modifiers have the ability to reset the current update cycle. The\n // most common use case for this is the `flip` modifier changing the\n // placement, which then needs to re-run all the modifiers, because the\n // logic was previously ran for the previous placement and is therefore\n // stale/incorrect\n\n state.reset = false;\n state.placement = state.options.placement; // On each update cycle, the `modifiersData` property for each modifier\n // is filled with the initial data specified by the modifier. This means\n // it doesn't persist and is fresh on each update.\n // To ensure persistent data, use `${name}#persistent`\n\n state.orderedModifiers.forEach(function (modifier) {\n return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);\n });\n\n for (var index = 0; index < state.orderedModifiers.length; index++) {\n if (state.reset === true) {\n state.reset = false;\n index = -1;\n continue;\n }\n\n var _state$orderedModifie = state.orderedModifiers[index],\n fn = _state$orderedModifie.fn,\n _state$orderedModifie2 = _state$orderedModifie.options,\n _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2,\n name = _state$orderedModifie.name;\n\n if (typeof fn === 'function') {\n state = fn({\n state: state,\n options: _options,\n name: name,\n instance: instance\n }) || state;\n }\n }\n },\n // Async and optimistically optimized update \u2013 it will not be executed if\n // not necessary (debounced to run at most once-per-tick)\n update: debounce(function () {\n return new Promise(function (resolve) {\n instance.forceUpdate();\n resolve(state);\n });\n }),\n destroy: function destroy() {\n cleanupModifierEffects();\n isDestroyed = true;\n }\n };\n\n if (!areValidElements(reference, popper)) {\n return instance;\n }\n\n instance.setOptions(options).then(function (state) {\n if (!isDestroyed && options.onFirstUpdate) {\n options.onFirstUpdate(state);\n }\n }); // Modifiers have the ability to execute arbitrary code before the first\n // update cycle runs. They will be executed in the same order as the update\n // cycle. This is useful when a modifier adds some persistent data that\n // other modifiers need to use, but the modifier is run after the dependent\n // one.\n\n function runModifierEffects() {\n state.orderedModifiers.forEach(function (_ref) {\n var name = _ref.name,\n _ref$options = _ref.options,\n options = _ref$options === void 0 ? {} : _ref$options,\n effect = _ref.effect;\n\n if (typeof effect === 'function') {\n var cleanupFn = effect({\n state: state,\n name: name,\n instance: instance,\n options: options\n });\n\n var noopFn = function noopFn() {};\n\n effectCleanupFns.push(cleanupFn || noopFn);\n }\n });\n }\n\n function cleanupModifierEffects() {\n effectCleanupFns.forEach(function (fn) {\n return fn();\n });\n effectCleanupFns = [];\n }\n\n return instance;\n };\n}\nexport var createPopper = /*#__PURE__*/popperGenerator(); // eslint-disable-next-line import/no-unused-modules\n\nexport { detectOverflow };", "import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow };", "import { popperGenerator, detectOverflow } from \"./createPopper.js\";\nimport eventListeners from \"./modifiers/eventListeners.js\";\nimport popperOffsets from \"./modifiers/popperOffsets.js\";\nimport computeStyles from \"./modifiers/computeStyles.js\";\nimport applyStyles from \"./modifiers/applyStyles.js\";\nimport offset from \"./modifiers/offset.js\";\nimport flip from \"./modifiers/flip.js\";\nimport preventOverflow from \"./modifiers/preventOverflow.js\";\nimport arrow from \"./modifiers/arrow.js\";\nimport hide from \"./modifiers/hide.js\";\nvar defaultModifiers = [eventListeners, popperOffsets, computeStyles, applyStyles, offset, flip, preventOverflow, arrow, hide];\nvar createPopper = /*#__PURE__*/popperGenerator({\n defaultModifiers: defaultModifiers\n}); // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper, popperGenerator, defaultModifiers, detectOverflow }; // eslint-disable-next-line import/no-unused-modules\n\nexport { createPopper as createPopperLite } from \"./popper-lite.js\"; // eslint-disable-next-line import/no-unused-modules\n\nexport * from \"./modifiers/index.js\";", "/**\n * --------------------------------------------------------------------------\n * Bootstrap dom/data.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n/**\n * Constants\n */\n\nconst elementMap = new Map()\n\nexport default {\n set(element, key, instance) {\n if (!elementMap.has(element)) {\n elementMap.set(element, new Map())\n }\n\n const instanceMap = elementMap.get(element)\n\n // make it clear we only want one instance per element\n // can be removed later when multiple key/instances are fine to be used\n if (!instanceMap.has(key) && instanceMap.size !== 0) {\n // eslint-disable-next-line no-console\n console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`)\n return\n }\n\n instanceMap.set(key, instance)\n },\n\n get(element, key) {\n if (elementMap.has(element)) {\n return elementMap.get(element).get(key) || null\n }\n\n return null\n },\n\n remove(element, key) {\n if (!elementMap.has(element)) {\n return\n }\n\n const instanceMap = elementMap.get(element)\n\n instanceMap.delete(key)\n\n // free up element references if there are no instances left for an element\n if (instanceMap.size === 0) {\n elementMap.delete(element)\n }\n }\n}\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap util/index.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nconst MAX_UID = 1_000_000\nconst MILLISECONDS_MULTIPLIER = 1000\nconst TRANSITION_END = 'transitionend'\n\n/**\n * Properly escape IDs selectors to handle weird IDs\n * @param {string} selector\n * @returns {string}\n */\nconst parseSelector = selector => {\n if (selector && window.CSS && window.CSS.escape) {\n // document.querySelector needs escaping to handle IDs (html5+) containing for instance /\n selector = selector.replace(/#([^\\s\"#']+)/g, (match, id) => `#${CSS.escape(id)}`)\n }\n\n return selector\n}\n\n// Shout-out Angus Croll (https://goo.gl/pxwQGp)\nconst toType = object => {\n if (object === null || object === undefined) {\n return `${object}`\n }\n\n return Object.prototype.toString.call(object).match(/\\s([a-z]+)/i)[1].toLowerCase()\n}\n\n/**\n * Public Util API\n */\n\nconst getUID = prefix => {\n do {\n prefix += Math.floor(Math.random() * MAX_UID)\n } while (document.getElementById(prefix))\n\n return prefix\n}\n\nconst getTransitionDurationFromElement = element => {\n if (!element) {\n return 0\n }\n\n // Get transition-duration of the element\n let { transitionDuration, transitionDelay } = window.getComputedStyle(element)\n\n const floatTransitionDuration = Number.parseFloat(transitionDuration)\n const floatTransitionDelay = Number.parseFloat(transitionDelay)\n\n // Return 0 if element or transition duration is not found\n if (!floatTransitionDuration && !floatTransitionDelay) {\n return 0\n }\n\n // If multiple durations are defined, take the first\n transitionDuration = transitionDuration.split(',')[0]\n transitionDelay = transitionDelay.split(',')[0]\n\n return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER\n}\n\nconst triggerTransitionEnd = element => {\n element.dispatchEvent(new Event(TRANSITION_END))\n}\n\nconst isElement = object => {\n if (!object || typeof object !== 'object') {\n return false\n }\n\n if (typeof object.jquery !== 'undefined') {\n object = object[0]\n }\n\n return typeof object.nodeType !== 'undefined'\n}\n\nconst getElement = object => {\n // it's a jQuery object or a node element\n if (isElement(object)) {\n return object.jquery ? object[0] : object\n }\n\n if (typeof object === 'string' && object.length > 0) {\n return document.querySelector(parseSelector(object))\n }\n\n return null\n}\n\nconst isVisible = element => {\n if (!isElement(element) || element.getClientRects().length === 0) {\n return false\n }\n\n const elementIsVisible = getComputedStyle(element).getPropertyValue('visibility') === 'visible'\n // Handle `details` element as its content may falsie appear visible when it is closed\n const closedDetails = element.closest('details:not([open])')\n\n if (!closedDetails) {\n return elementIsVisible\n }\n\n if (closedDetails !== element) {\n const summary = element.closest('summary')\n if (summary && summary.parentNode !== closedDetails) {\n return false\n }\n\n if (summary === null) {\n return false\n }\n }\n\n return elementIsVisible\n}\n\nconst isDisabled = element => {\n if (!element || element.nodeType !== Node.ELEMENT_NODE) {\n return true\n }\n\n if (element.classList.contains('disabled')) {\n return true\n }\n\n if (typeof element.disabled !== 'undefined') {\n return element.disabled\n }\n\n return element.hasAttribute('disabled') && element.getAttribute('disabled') !== 'false'\n}\n\nconst findShadowRoot = element => {\n if (!document.documentElement.attachShadow) {\n return null\n }\n\n // Can find the shadow root otherwise it'll return the document\n if (typeof element.getRootNode === 'function') {\n const root = element.getRootNode()\n return root instanceof ShadowRoot ? root : null\n }\n\n if (element instanceof ShadowRoot) {\n return element\n }\n\n // when we don't find a shadow root\n if (!element.parentNode) {\n return null\n }\n\n return findShadowRoot(element.parentNode)\n}\n\nconst noop = () => {}\n\n/**\n * Trick to restart an element's animation\n *\n * @param {HTMLElement} element\n * @return void\n *\n * @see https://www.charistheo.io/blog/2021/02/restart-a-css-animation-with-javascript/#restarting-a-css-animation\n */\nconst reflow = element => {\n element.offsetHeight // eslint-disable-line no-unused-expressions\n}\n\nconst getjQuery = () => {\n if (window.jQuery && !document.body.hasAttribute('data-bs-no-jquery')) {\n return window.jQuery\n }\n\n return null\n}\n\nconst DOMContentLoadedCallbacks = []\n\nconst onDOMContentLoaded = callback => {\n if (document.readyState === 'loading') {\n // add listener on the first call when the document is in loading state\n if (!DOMContentLoadedCallbacks.length) {\n document.addEventListener('DOMContentLoaded', () => {\n for (const callback of DOMContentLoadedCallbacks) {\n callback()\n }\n })\n }\n\n DOMContentLoadedCallbacks.push(callback)\n } else {\n callback()\n }\n}\n\nconst isRTL = () => document.documentElement.dir === 'rtl'\n\nconst defineJQueryPlugin = plugin => {\n onDOMContentLoaded(() => {\n const $ = getjQuery()\n /* istanbul ignore if */\n if ($) {\n const name = plugin.NAME\n const JQUERY_NO_CONFLICT = $.fn[name]\n $.fn[name] = plugin.jQueryInterface\n $.fn[name].Constructor = plugin\n $.fn[name].noConflict = () => {\n $.fn[name] = JQUERY_NO_CONFLICT\n return plugin.jQueryInterface\n }\n }\n })\n}\n\nconst execute = (possibleCallback, args = [], defaultValue = possibleCallback) => {\n return typeof possibleCallback === 'function' ? possibleCallback(...args) : defaultValue\n}\n\nconst executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {\n if (!waitForTransition) {\n execute(callback)\n return\n }\n\n const durationPadding = 5\n const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding\n\n let called = false\n\n const handler = ({ target }) => {\n if (target !== transitionElement) {\n return\n }\n\n called = true\n transitionElement.removeEventListener(TRANSITION_END, handler)\n execute(callback)\n }\n\n transitionElement.addEventListener(TRANSITION_END, handler)\n setTimeout(() => {\n if (!called) {\n triggerTransitionEnd(transitionElement)\n }\n }, emulatedDuration)\n}\n\n/**\n * Return the previous/next element of a list.\n *\n * @param {array} list The list of elements\n * @param activeElement The active element\n * @param shouldGetNext Choose to get next or previous element\n * @param isCycleAllowed\n * @return {Element|elem} The proper element\n */\nconst getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {\n const listLength = list.length\n let index = list.indexOf(activeElement)\n\n // if the element does not exist in the list return an element\n // depending on the direction and if cycle is allowed\n if (index === -1) {\n return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0]\n }\n\n index += shouldGetNext ? 1 : -1\n\n if (isCycleAllowed) {\n index = (index + listLength) % listLength\n }\n\n return list[Math.max(0, Math.min(index, listLength - 1))]\n}\n\nexport {\n defineJQueryPlugin,\n execute,\n executeAfterTransition,\n findShadowRoot,\n getElement,\n getjQuery,\n getNextActiveElement,\n getTransitionDurationFromElement,\n getUID,\n isDisabled,\n isElement,\n isRTL,\n isVisible,\n noop,\n onDOMContentLoaded,\n parseSelector,\n reflow,\n triggerTransitionEnd,\n toType\n}\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap dom/event-handler.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { getjQuery } from '../util/index.js'\n\n/**\n * Constants\n */\n\nconst namespaceRegex = /[^.]*(?=\\..*)\\.|.*/\nconst stripNameRegex = /\\..*/\nconst stripUidRegex = /::\\d+$/\nconst eventRegistry = {} // Events storage\nlet uidEvent = 1\nconst customEvents = {\n mouseenter: 'mouseover',\n mouseleave: 'mouseout'\n}\n\nconst nativeEvents = new Set([\n 'click',\n 'dblclick',\n 'mouseup',\n 'mousedown',\n 'contextmenu',\n 'mousewheel',\n 'DOMMouseScroll',\n 'mouseover',\n 'mouseout',\n 'mousemove',\n 'selectstart',\n 'selectend',\n 'keydown',\n 'keypress',\n 'keyup',\n 'orientationchange',\n 'touchstart',\n 'touchmove',\n 'touchend',\n 'touchcancel',\n 'pointerdown',\n 'pointermove',\n 'pointerup',\n 'pointerleave',\n 'pointercancel',\n 'gesturestart',\n 'gesturechange',\n 'gestureend',\n 'focus',\n 'blur',\n 'change',\n 'reset',\n 'select',\n 'submit',\n 'focusin',\n 'focusout',\n 'load',\n 'unload',\n 'beforeunload',\n 'resize',\n 'move',\n 'DOMContentLoaded',\n 'readystatechange',\n 'error',\n 'abort',\n 'scroll'\n])\n\n/**\n * Private methods\n */\n\nfunction makeEventUid(element, uid) {\n return (uid && `${uid}::${uidEvent++}`) || element.uidEvent || uidEvent++\n}\n\nfunction getElementEvents(element) {\n const uid = makeEventUid(element)\n\n element.uidEvent = uid\n eventRegistry[uid] = eventRegistry[uid] || {}\n\n return eventRegistry[uid]\n}\n\nfunction bootstrapHandler(element, fn) {\n return function handler(event) {\n hydrateObj(event, { delegateTarget: element })\n\n if (handler.oneOff) {\n EventHandler.off(element, event.type, fn)\n }\n\n return fn.apply(element, [event])\n }\n}\n\nfunction bootstrapDelegationHandler(element, selector, fn) {\n return function handler(event) {\n const domElements = element.querySelectorAll(selector)\n\n for (let { target } = event; target && target !== this; target = target.parentNode) {\n for (const domElement of domElements) {\n if (domElement !== target) {\n continue\n }\n\n hydrateObj(event, { delegateTarget: target })\n\n if (handler.oneOff) {\n EventHandler.off(element, event.type, selector, fn)\n }\n\n return fn.apply(target, [event])\n }\n }\n }\n}\n\nfunction findHandler(events, callable, delegationSelector = null) {\n return Object.values(events)\n .find(event => event.callable === callable && event.delegationSelector === delegationSelector)\n}\n\nfunction normalizeParameters(originalTypeEvent, handler, delegationFunction) {\n const isDelegated = typeof handler === 'string'\n // TODO: tooltip passes `false` instead of selector, so we need to check\n const callable = isDelegated ? delegationFunction : (handler || delegationFunction)\n let typeEvent = getTypeEvent(originalTypeEvent)\n\n if (!nativeEvents.has(typeEvent)) {\n typeEvent = originalTypeEvent\n }\n\n return [isDelegated, callable, typeEvent]\n}\n\nfunction addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {\n if (typeof originalTypeEvent !== 'string' || !element) {\n return\n }\n\n let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction)\n\n // in case of mouseenter or mouseleave wrap the handler within a function that checks for its DOM position\n // this prevents the handler from being dispatched the same way as mouseover or mouseout does\n if (originalTypeEvent in customEvents) {\n const wrapFunction = fn => {\n return function (event) {\n if (!event.relatedTarget || (event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget))) {\n return fn.call(this, event)\n }\n }\n }\n\n callable = wrapFunction(callable)\n }\n\n const events = getElementEvents(element)\n const handlers = events[typeEvent] || (events[typeEvent] = {})\n const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null)\n\n if (previousFunction) {\n previousFunction.oneOff = previousFunction.oneOff && oneOff\n\n return\n }\n\n const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ''))\n const fn = isDelegated ?\n bootstrapDelegationHandler(element, handler, callable) :\n bootstrapHandler(element, callable)\n\n fn.delegationSelector = isDelegated ? handler : null\n fn.callable = callable\n fn.oneOff = oneOff\n fn.uidEvent = uid\n handlers[uid] = fn\n\n element.addEventListener(typeEvent, fn, isDelegated)\n}\n\nfunction removeHandler(element, events, typeEvent, handler, delegationSelector) {\n const fn = findHandler(events[typeEvent], handler, delegationSelector)\n\n if (!fn) {\n return\n }\n\n element.removeEventListener(typeEvent, fn, Boolean(delegationSelector))\n delete events[typeEvent][fn.uidEvent]\n}\n\nfunction removeNamespacedHandlers(element, events, typeEvent, namespace) {\n const storeElementEvent = events[typeEvent] || {}\n\n for (const [handlerKey, event] of Object.entries(storeElementEvent)) {\n if (handlerKey.includes(namespace)) {\n removeHandler(element, events, typeEvent, event.callable, event.delegationSelector)\n }\n }\n}\n\nfunction getTypeEvent(event) {\n // allow to get the native events from namespaced events ('click.bs.button' --> 'click')\n event = event.replace(stripNameRegex, '')\n return customEvents[event] || event\n}\n\nconst EventHandler = {\n on(element, event, handler, delegationFunction) {\n addHandler(element, event, handler, delegationFunction, false)\n },\n\n one(element, event, handler, delegationFunction) {\n addHandler(element, event, handler, delegationFunction, true)\n },\n\n off(element, originalTypeEvent, handler, delegationFunction) {\n if (typeof originalTypeEvent !== 'string' || !element) {\n return\n }\n\n const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction)\n const inNamespace = typeEvent !== originalTypeEvent\n const events = getElementEvents(element)\n const storeElementEvent = events[typeEvent] || {}\n const isNamespace = originalTypeEvent.startsWith('.')\n\n if (typeof callable !== 'undefined') {\n // Simplest case: handler is passed, remove that listener ONLY.\n if (!Object.keys(storeElementEvent).length) {\n return\n }\n\n removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null)\n return\n }\n\n if (isNamespace) {\n for (const elementEvent of Object.keys(events)) {\n removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1))\n }\n }\n\n for (const [keyHandlers, event] of Object.entries(storeElementEvent)) {\n const handlerKey = keyHandlers.replace(stripUidRegex, '')\n\n if (!inNamespace || originalTypeEvent.includes(handlerKey)) {\n removeHandler(element, events, typeEvent, event.callable, event.delegationSelector)\n }\n }\n },\n\n trigger(element, event, args) {\n if (typeof event !== 'string' || !element) {\n return null\n }\n\n const $ = getjQuery()\n const typeEvent = getTypeEvent(event)\n const inNamespace = event !== typeEvent\n\n let jQueryEvent = null\n let bubbles = true\n let nativeDispatch = true\n let defaultPrevented = false\n\n if (inNamespace && $) {\n jQueryEvent = $.Event(event, args)\n\n $(element).trigger(jQueryEvent)\n bubbles = !jQueryEvent.isPropagationStopped()\n nativeDispatch = !jQueryEvent.isImmediatePropagationStopped()\n defaultPrevented = jQueryEvent.isDefaultPrevented()\n }\n\n const evt = hydrateObj(new Event(event, { bubbles, cancelable: true }), args)\n\n if (defaultPrevented) {\n evt.preventDefault()\n }\n\n if (nativeDispatch) {\n element.dispatchEvent(evt)\n }\n\n if (evt.defaultPrevented && jQueryEvent) {\n jQueryEvent.preventDefault()\n }\n\n return evt\n }\n}\n\nfunction hydrateObj(obj, meta = {}) {\n for (const [key, value] of Object.entries(meta)) {\n try {\n obj[key] = value\n } catch {\n Object.defineProperty(obj, key, {\n configurable: true,\n get() {\n return value\n }\n })\n }\n }\n\n return obj\n}\n\nexport default EventHandler\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap dom/manipulator.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nfunction normalizeData(value) {\n if (value === 'true') {\n return true\n }\n\n if (value === 'false') {\n return false\n }\n\n if (value === Number(value).toString()) {\n return Number(value)\n }\n\n if (value === '' || value === 'null') {\n return null\n }\n\n if (typeof value !== 'string') {\n return value\n }\n\n try {\n return JSON.parse(decodeURIComponent(value))\n } catch {\n return value\n }\n}\n\nfunction normalizeDataKey(key) {\n return key.replace(/[A-Z]/g, chr => `-${chr.toLowerCase()}`)\n}\n\nconst Manipulator = {\n setDataAttribute(element, key, value) {\n element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value)\n },\n\n removeDataAttribute(element, key) {\n element.removeAttribute(`data-bs-${normalizeDataKey(key)}`)\n },\n\n getDataAttributes(element) {\n if (!element) {\n return {}\n }\n\n const attributes = {}\n const bsKeys = Object.keys(element.dataset).filter(key => key.startsWith('bs') && !key.startsWith('bsConfig'))\n\n for (const key of bsKeys) {\n let pureKey = key.replace(/^bs/, '')\n pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length)\n attributes[pureKey] = normalizeData(element.dataset[key])\n }\n\n return attributes\n },\n\n getDataAttribute(element, key) {\n return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`))\n }\n}\n\nexport default Manipulator\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap util/config.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Manipulator from '../dom/manipulator.js'\nimport { isElement, toType } from './index.js'\n\n/**\n * Class definition\n */\n\nclass Config {\n // Getters\n static get Default() {\n return {}\n }\n\n static get DefaultType() {\n return {}\n }\n\n static get NAME() {\n throw new Error('You have to implement the static method \"NAME\", for each component!')\n }\n\n _getConfig(config) {\n config = this._mergeConfigObj(config)\n config = this._configAfterMerge(config)\n this._typeCheckConfig(config)\n return config\n }\n\n _configAfterMerge(config) {\n return config\n }\n\n _mergeConfigObj(config, element) {\n const jsonConfig = isElement(element) ? Manipulator.getDataAttribute(element, 'config') : {} // try to parse\n\n return {\n ...this.constructor.Default,\n ...(typeof jsonConfig === 'object' ? jsonConfig : {}),\n ...(isElement(element) ? Manipulator.getDataAttributes(element) : {}),\n ...(typeof config === 'object' ? config : {})\n }\n }\n\n _typeCheckConfig(config, configTypes = this.constructor.DefaultType) {\n for (const [property, expectedTypes] of Object.entries(configTypes)) {\n const value = config[property]\n const valueType = isElement(value) ? 'element' : toType(value)\n\n if (!new RegExp(expectedTypes).test(valueType)) {\n throw new TypeError(\n `${this.constructor.NAME.toUpperCase()}: Option \"${property}\" provided type \"${valueType}\" but expected type \"${expectedTypes}\".`\n )\n }\n }\n }\n}\n\nexport default Config\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap base-component.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Data from './dom/data.js'\nimport EventHandler from './dom/event-handler.js'\nimport Config from './util/config.js'\nimport { executeAfterTransition, getElement } from './util/index.js'\n\n/**\n * Constants\n */\n\nconst VERSION = '5.3.3'\n\n/**\n * Class definition\n */\n\nclass BaseComponent extends Config {\n constructor(element, config) {\n super()\n\n element = getElement(element)\n if (!element) {\n return\n }\n\n this._element = element\n this._config = this._getConfig(config)\n\n Data.set(this._element, this.constructor.DATA_KEY, this)\n }\n\n // Public\n dispose() {\n Data.remove(this._element, this.constructor.DATA_KEY)\n EventHandler.off(this._element, this.constructor.EVENT_KEY)\n\n for (const propertyName of Object.getOwnPropertyNames(this)) {\n this[propertyName] = null\n }\n }\n\n _queueCallback(callback, element, isAnimated = true) {\n executeAfterTransition(callback, element, isAnimated)\n }\n\n _getConfig(config) {\n config = this._mergeConfigObj(config, this._element)\n config = this._configAfterMerge(config)\n this._typeCheckConfig(config)\n return config\n }\n\n // Static\n static getInstance(element) {\n return Data.get(getElement(element), this.DATA_KEY)\n }\n\n static getOrCreateInstance(element, config = {}) {\n return this.getInstance(element) || new this(element, typeof config === 'object' ? config : null)\n }\n\n static get VERSION() {\n return VERSION\n }\n\n static get DATA_KEY() {\n return `bs.${this.NAME}`\n }\n\n static get EVENT_KEY() {\n return `.${this.DATA_KEY}`\n }\n\n static eventName(name) {\n return `${name}${this.EVENT_KEY}`\n }\n}\n\nexport default BaseComponent\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap dom/selector-engine.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport { isDisabled, isVisible, parseSelector } from '../util/index.js'\n\nconst getSelector = element => {\n let selector = element.getAttribute('data-bs-target')\n\n if (!selector || selector === '#') {\n let hrefAttribute = element.getAttribute('href')\n\n // The only valid content that could double as a selector are IDs or classes,\n // so everything starting with `#` or `.`. If a \"real\" URL is used as the selector,\n // `document.querySelector` will rightfully complain it is invalid.\n // See https://github.com/twbs/bootstrap/issues/32273\n if (!hrefAttribute || (!hrefAttribute.includes('#') && !hrefAttribute.startsWith('.'))) {\n return null\n }\n\n // Just in case some CMS puts out a full URL with the anchor appended\n if (hrefAttribute.includes('#') && !hrefAttribute.startsWith('#')) {\n hrefAttribute = `#${hrefAttribute.split('#')[1]}`\n }\n\n selector = hrefAttribute && hrefAttribute !== '#' ? hrefAttribute.trim() : null\n }\n\n return selector ? selector.split(',').map(sel => parseSelector(sel)).join(',') : null\n}\n\nconst SelectorEngine = {\n find(selector, element = document.documentElement) {\n return [].concat(...Element.prototype.querySelectorAll.call(element, selector))\n },\n\n findOne(selector, element = document.documentElement) {\n return Element.prototype.querySelector.call(element, selector)\n },\n\n children(element, selector) {\n return [].concat(...element.children).filter(child => child.matches(selector))\n },\n\n parents(element, selector) {\n const parents = []\n let ancestor = element.parentNode.closest(selector)\n\n while (ancestor) {\n parents.push(ancestor)\n ancestor = ancestor.parentNode.closest(selector)\n }\n\n return parents\n },\n\n prev(element, selector) {\n let previous = element.previousElementSibling\n\n while (previous) {\n if (previous.matches(selector)) {\n return [previous]\n }\n\n previous = previous.previousElementSibling\n }\n\n return []\n },\n // TODO: this is now unused; remove later along with prev()\n next(element, selector) {\n let next = element.nextElementSibling\n\n while (next) {\n if (next.matches(selector)) {\n return [next]\n }\n\n next = next.nextElementSibling\n }\n\n return []\n },\n\n focusableChildren(element) {\n const focusables = [\n 'a',\n 'button',\n 'input',\n 'textarea',\n 'select',\n 'details',\n '[tabindex]',\n '[contenteditable=\"true\"]'\n ].map(selector => `${selector}:not([tabindex^=\"-\"])`).join(',')\n\n return this.find(focusables, element).filter(el => !isDisabled(el) && isVisible(el))\n },\n\n getSelectorFromElement(element) {\n const selector = getSelector(element)\n\n if (selector) {\n return SelectorEngine.findOne(selector) ? selector : null\n }\n\n return null\n },\n\n getElementFromSelector(element) {\n const selector = getSelector(element)\n\n return selector ? SelectorEngine.findOne(selector) : null\n },\n\n getMultipleElementsFromSelector(element) {\n const selector = getSelector(element)\n\n return selector ? SelectorEngine.find(selector) : []\n }\n}\n\nexport default SelectorEngine\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap util/component-functions.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport EventHandler from '../dom/event-handler.js'\nimport SelectorEngine from '../dom/selector-engine.js'\nimport { isDisabled } from './index.js'\n\nconst enableDismissTrigger = (component, method = 'hide') => {\n const clickEvent = `click.dismiss${component.EVENT_KEY}`\n const name = component.NAME\n\n EventHandler.on(document, clickEvent, `[data-bs-dismiss=\"${name}\"]`, function (event) {\n if (['A', 'AREA'].includes(this.tagName)) {\n event.preventDefault()\n }\n\n if (isDisabled(this)) {\n return\n }\n\n const target = SelectorEngine.getElementFromSelector(this) || this.closest(`.${name}`)\n const instance = component.getOrCreateInstance(target)\n\n // Method argument is left, for Alert and only, as it doesn't implement the 'hide' method\n instance[method]()\n })\n}\n\nexport {\n enableDismissTrigger\n}\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap alert.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport { enableDismissTrigger } from './util/component-functions.js'\nimport { defineJQueryPlugin } from './util/index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'alert'\nconst DATA_KEY = 'bs.alert'\nconst EVENT_KEY = `.${DATA_KEY}`\n\nconst EVENT_CLOSE = `close${EVENT_KEY}`\nconst EVENT_CLOSED = `closed${EVENT_KEY}`\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_SHOW = 'show'\n\n/**\n * Class definition\n */\n\nclass Alert extends BaseComponent {\n // Getters\n static get NAME() {\n return NAME\n }\n\n // Public\n close() {\n const closeEvent = EventHandler.trigger(this._element, EVENT_CLOSE)\n\n if (closeEvent.defaultPrevented) {\n return\n }\n\n this._element.classList.remove(CLASS_NAME_SHOW)\n\n const isAnimated = this._element.classList.contains(CLASS_NAME_FADE)\n this._queueCallback(() => this._destroyElement(), this._element, isAnimated)\n }\n\n // Private\n _destroyElement() {\n this._element.remove()\n EventHandler.trigger(this._element, EVENT_CLOSED)\n this.dispose()\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Alert.getOrCreateInstance(this)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config](this)\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nenableDismissTrigger(Alert, 'close')\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Alert)\n\nexport default Alert\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap button.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport { defineJQueryPlugin } from './util/index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'button'\nconst DATA_KEY = 'bs.button'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst CLASS_NAME_ACTIVE = 'active'\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"button\"]'\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\n/**\n * Class definition\n */\n\nclass Button extends BaseComponent {\n // Getters\n static get NAME() {\n return NAME\n }\n\n // Public\n toggle() {\n // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method\n this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE))\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Button.getOrCreateInstance(this)\n\n if (config === 'toggle') {\n data[config]()\n }\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, event => {\n event.preventDefault()\n\n const button = event.target.closest(SELECTOR_DATA_TOGGLE)\n const data = Button.getOrCreateInstance(button)\n\n data.toggle()\n})\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Button)\n\nexport default Button\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap util/swipe.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport EventHandler from '../dom/event-handler.js'\nimport Config from './config.js'\nimport { execute } from './index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'swipe'\nconst EVENT_KEY = '.bs.swipe'\nconst EVENT_TOUCHSTART = `touchstart${EVENT_KEY}`\nconst EVENT_TOUCHMOVE = `touchmove${EVENT_KEY}`\nconst EVENT_TOUCHEND = `touchend${EVENT_KEY}`\nconst EVENT_POINTERDOWN = `pointerdown${EVENT_KEY}`\nconst EVENT_POINTERUP = `pointerup${EVENT_KEY}`\nconst POINTER_TYPE_TOUCH = 'touch'\nconst POINTER_TYPE_PEN = 'pen'\nconst CLASS_NAME_POINTER_EVENT = 'pointer-event'\nconst SWIPE_THRESHOLD = 40\n\nconst Default = {\n endCallback: null,\n leftCallback: null,\n rightCallback: null\n}\n\nconst DefaultType = {\n endCallback: '(function|null)',\n leftCallback: '(function|null)',\n rightCallback: '(function|null)'\n}\n\n/**\n * Class definition\n */\n\nclass Swipe extends Config {\n constructor(element, config) {\n super()\n this._element = element\n\n if (!element || !Swipe.isSupported()) {\n return\n }\n\n this._config = this._getConfig(config)\n this._deltaX = 0\n this._supportPointerEvents = Boolean(window.PointerEvent)\n this._initEvents()\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n dispose() {\n EventHandler.off(this._element, EVENT_KEY)\n }\n\n // Private\n _start(event) {\n if (!this._supportPointerEvents) {\n this._deltaX = event.touches[0].clientX\n\n return\n }\n\n if (this._eventIsPointerPenTouch(event)) {\n this._deltaX = event.clientX\n }\n }\n\n _end(event) {\n if (this._eventIsPointerPenTouch(event)) {\n this._deltaX = event.clientX - this._deltaX\n }\n\n this._handleSwipe()\n execute(this._config.endCallback)\n }\n\n _move(event) {\n this._deltaX = event.touches && event.touches.length > 1 ?\n 0 :\n event.touches[0].clientX - this._deltaX\n }\n\n _handleSwipe() {\n const absDeltaX = Math.abs(this._deltaX)\n\n if (absDeltaX <= SWIPE_THRESHOLD) {\n return\n }\n\n const direction = absDeltaX / this._deltaX\n\n this._deltaX = 0\n\n if (!direction) {\n return\n }\n\n execute(direction > 0 ? this._config.rightCallback : this._config.leftCallback)\n }\n\n _initEvents() {\n if (this._supportPointerEvents) {\n EventHandler.on(this._element, EVENT_POINTERDOWN, event => this._start(event))\n EventHandler.on(this._element, EVENT_POINTERUP, event => this._end(event))\n\n this._element.classList.add(CLASS_NAME_POINTER_EVENT)\n } else {\n EventHandler.on(this._element, EVENT_TOUCHSTART, event => this._start(event))\n EventHandler.on(this._element, EVENT_TOUCHMOVE, event => this._move(event))\n EventHandler.on(this._element, EVENT_TOUCHEND, event => this._end(event))\n }\n }\n\n _eventIsPointerPenTouch(event) {\n return this._supportPointerEvents && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)\n }\n\n // Static\n static isSupported() {\n return 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0\n }\n}\n\nexport default Swipe\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap carousel.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport Manipulator from './dom/manipulator.js'\nimport SelectorEngine from './dom/selector-engine.js'\nimport {\n defineJQueryPlugin,\n getNextActiveElement,\n isRTL,\n isVisible,\n reflow,\n triggerTransitionEnd\n} from './util/index.js'\nimport Swipe from './util/swipe.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'carousel'\nconst DATA_KEY = 'bs.carousel'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst ARROW_LEFT_KEY = 'ArrowLeft'\nconst ARROW_RIGHT_KEY = 'ArrowRight'\nconst TOUCHEVENT_COMPAT_WAIT = 500 // Time for mouse compat events to fire after touch\n\nconst ORDER_NEXT = 'next'\nconst ORDER_PREV = 'prev'\nconst DIRECTION_LEFT = 'left'\nconst DIRECTION_RIGHT = 'right'\n\nconst EVENT_SLIDE = `slide${EVENT_KEY}`\nconst EVENT_SLID = `slid${EVENT_KEY}`\nconst EVENT_KEYDOWN = `keydown${EVENT_KEY}`\nconst EVENT_MOUSEENTER = `mouseenter${EVENT_KEY}`\nconst EVENT_MOUSELEAVE = `mouseleave${EVENT_KEY}`\nconst EVENT_DRAG_START = `dragstart${EVENT_KEY}`\nconst EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_CAROUSEL = 'carousel'\nconst CLASS_NAME_ACTIVE = 'active'\nconst CLASS_NAME_SLIDE = 'slide'\nconst CLASS_NAME_END = 'carousel-item-end'\nconst CLASS_NAME_START = 'carousel-item-start'\nconst CLASS_NAME_NEXT = 'carousel-item-next'\nconst CLASS_NAME_PREV = 'carousel-item-prev'\n\nconst SELECTOR_ACTIVE = '.active'\nconst SELECTOR_ITEM = '.carousel-item'\nconst SELECTOR_ACTIVE_ITEM = SELECTOR_ACTIVE + SELECTOR_ITEM\nconst SELECTOR_ITEM_IMG = '.carousel-item img'\nconst SELECTOR_INDICATORS = '.carousel-indicators'\nconst SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'\nconst SELECTOR_DATA_RIDE = '[data-bs-ride=\"carousel\"]'\n\nconst KEY_TO_DIRECTION = {\n [ARROW_LEFT_KEY]: DIRECTION_RIGHT,\n [ARROW_RIGHT_KEY]: DIRECTION_LEFT\n}\n\nconst Default = {\n interval: 5000,\n keyboard: true,\n pause: 'hover',\n ride: false,\n touch: true,\n wrap: true\n}\n\nconst DefaultType = {\n interval: '(number|boolean)', // TODO:v6 remove boolean support\n keyboard: 'boolean',\n pause: '(string|boolean)',\n ride: '(boolean|string)',\n touch: 'boolean',\n wrap: 'boolean'\n}\n\n/**\n * Class definition\n */\n\nclass Carousel extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._interval = null\n this._activeElement = null\n this._isSliding = false\n this.touchTimeout = null\n this._swipeHelper = null\n\n this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, this._element)\n this._addEventListeners()\n\n if (this._config.ride === CLASS_NAME_CAROUSEL) {\n this.cycle()\n }\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n next() {\n this._slide(ORDER_NEXT)\n }\n\n nextWhenVisible() {\n // FIXME TODO use `document.visibilityState`\n // Don't call next when the page isn't visible\n // or the carousel or its parent isn't visible\n if (!document.hidden && isVisible(this._element)) {\n this.next()\n }\n }\n\n prev() {\n this._slide(ORDER_PREV)\n }\n\n pause() {\n if (this._isSliding) {\n triggerTransitionEnd(this._element)\n }\n\n this._clearInterval()\n }\n\n cycle() {\n this._clearInterval()\n this._updateInterval()\n\n this._interval = setInterval(() => this.nextWhenVisible(), this._config.interval)\n }\n\n _maybeEnableCycle() {\n if (!this._config.ride) {\n return\n }\n\n if (this._isSliding) {\n EventHandler.one(this._element, EVENT_SLID, () => this.cycle())\n return\n }\n\n this.cycle()\n }\n\n to(index) {\n const items = this._getItems()\n if (index > items.length - 1 || index < 0) {\n return\n }\n\n if (this._isSliding) {\n EventHandler.one(this._element, EVENT_SLID, () => this.to(index))\n return\n }\n\n const activeIndex = this._getItemIndex(this._getActive())\n if (activeIndex === index) {\n return\n }\n\n const order = index > activeIndex ? ORDER_NEXT : ORDER_PREV\n\n this._slide(order, items[index])\n }\n\n dispose() {\n if (this._swipeHelper) {\n this._swipeHelper.dispose()\n }\n\n super.dispose()\n }\n\n // Private\n _configAfterMerge(config) {\n config.defaultInterval = config.interval\n return config\n }\n\n _addEventListeners() {\n if (this._config.keyboard) {\n EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event))\n }\n\n if (this._config.pause === 'hover') {\n EventHandler.on(this._element, EVENT_MOUSEENTER, () => this.pause())\n EventHandler.on(this._element, EVENT_MOUSELEAVE, () => this._maybeEnableCycle())\n }\n\n if (this._config.touch && Swipe.isSupported()) {\n this._addTouchEventListeners()\n }\n }\n\n _addTouchEventListeners() {\n for (const img of SelectorEngine.find(SELECTOR_ITEM_IMG, this._element)) {\n EventHandler.on(img, EVENT_DRAG_START, event => event.preventDefault())\n }\n\n const endCallBack = () => {\n if (this._config.pause !== 'hover') {\n return\n }\n\n // If it's a touch-enabled device, mouseenter/leave are fired as\n // part of the mouse compatibility events on first tap - the carousel\n // would stop cycling until user tapped out of it;\n // here, we listen for touchend, explicitly pause the carousel\n // (as if it's the second time we tap on it, mouseenter compat event\n // is NOT fired) and after a timeout (to allow for mouse compatibility\n // events to fire) we explicitly restart cycling\n\n this.pause()\n if (this.touchTimeout) {\n clearTimeout(this.touchTimeout)\n }\n\n this.touchTimeout = setTimeout(() => this._maybeEnableCycle(), TOUCHEVENT_COMPAT_WAIT + this._config.interval)\n }\n\n const swipeConfig = {\n leftCallback: () => this._slide(this._directionToOrder(DIRECTION_LEFT)),\n rightCallback: () => this._slide(this._directionToOrder(DIRECTION_RIGHT)),\n endCallback: endCallBack\n }\n\n this._swipeHelper = new Swipe(this._element, swipeConfig)\n }\n\n _keydown(event) {\n if (/input|textarea/i.test(event.target.tagName)) {\n return\n }\n\n const direction = KEY_TO_DIRECTION[event.key]\n if (direction) {\n event.preventDefault()\n this._slide(this._directionToOrder(direction))\n }\n }\n\n _getItemIndex(element) {\n return this._getItems().indexOf(element)\n }\n\n _setActiveIndicatorElement(index) {\n if (!this._indicatorsElement) {\n return\n }\n\n const activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE, this._indicatorsElement)\n\n activeIndicator.classList.remove(CLASS_NAME_ACTIVE)\n activeIndicator.removeAttribute('aria-current')\n\n const newActiveIndicator = SelectorEngine.findOne(`[data-bs-slide-to=\"${index}\"]`, this._indicatorsElement)\n\n if (newActiveIndicator) {\n newActiveIndicator.classList.add(CLASS_NAME_ACTIVE)\n newActiveIndicator.setAttribute('aria-current', 'true')\n }\n }\n\n _updateInterval() {\n const element = this._activeElement || this._getActive()\n\n if (!element) {\n return\n }\n\n const elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10)\n\n this._config.interval = elementInterval || this._config.defaultInterval\n }\n\n _slide(order, element = null) {\n if (this._isSliding) {\n return\n }\n\n const activeElement = this._getActive()\n const isNext = order === ORDER_NEXT\n const nextElement = element || getNextActiveElement(this._getItems(), activeElement, isNext, this._config.wrap)\n\n if (nextElement === activeElement) {\n return\n }\n\n const nextElementIndex = this._getItemIndex(nextElement)\n\n const triggerEvent = eventName => {\n return EventHandler.trigger(this._element, eventName, {\n relatedTarget: nextElement,\n direction: this._orderToDirection(order),\n from: this._getItemIndex(activeElement),\n to: nextElementIndex\n })\n }\n\n const slideEvent = triggerEvent(EVENT_SLIDE)\n\n if (slideEvent.defaultPrevented) {\n return\n }\n\n if (!activeElement || !nextElement) {\n // Some weirdness is happening, so we bail\n // TODO: change tests that use empty divs to avoid this check\n return\n }\n\n const isCycling = Boolean(this._interval)\n this.pause()\n\n this._isSliding = true\n\n this._setActiveIndicatorElement(nextElementIndex)\n this._activeElement = nextElement\n\n const directionalClassName = isNext ? CLASS_NAME_START : CLASS_NAME_END\n const orderClassName = isNext ? CLASS_NAME_NEXT : CLASS_NAME_PREV\n\n nextElement.classList.add(orderClassName)\n\n reflow(nextElement)\n\n activeElement.classList.add(directionalClassName)\n nextElement.classList.add(directionalClassName)\n\n const completeCallBack = () => {\n nextElement.classList.remove(directionalClassName, orderClassName)\n nextElement.classList.add(CLASS_NAME_ACTIVE)\n\n activeElement.classList.remove(CLASS_NAME_ACTIVE, orderClassName, directionalClassName)\n\n this._isSliding = false\n\n triggerEvent(EVENT_SLID)\n }\n\n this._queueCallback(completeCallBack, activeElement, this._isAnimated())\n\n if (isCycling) {\n this.cycle()\n }\n }\n\n _isAnimated() {\n return this._element.classList.contains(CLASS_NAME_SLIDE)\n }\n\n _getActive() {\n return SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element)\n }\n\n _getItems() {\n return SelectorEngine.find(SELECTOR_ITEM, this._element)\n }\n\n _clearInterval() {\n if (this._interval) {\n clearInterval(this._interval)\n this._interval = null\n }\n }\n\n _directionToOrder(direction) {\n if (isRTL()) {\n return direction === DIRECTION_LEFT ? ORDER_PREV : ORDER_NEXT\n }\n\n return direction === DIRECTION_LEFT ? ORDER_NEXT : ORDER_PREV\n }\n\n _orderToDirection(order) {\n if (isRTL()) {\n return order === ORDER_PREV ? DIRECTION_LEFT : DIRECTION_RIGHT\n }\n\n return order === ORDER_PREV ? DIRECTION_RIGHT : DIRECTION_LEFT\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Carousel.getOrCreateInstance(this, config)\n\n if (typeof config === 'number') {\n data.to(config)\n return\n }\n\n if (typeof config === 'string') {\n if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n }\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_SLIDE, function (event) {\n const target = SelectorEngine.getElementFromSelector(this)\n\n if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) {\n return\n }\n\n event.preventDefault()\n\n const carousel = Carousel.getOrCreateInstance(target)\n const slideIndex = this.getAttribute('data-bs-slide-to')\n\n if (slideIndex) {\n carousel.to(slideIndex)\n carousel._maybeEnableCycle()\n return\n }\n\n if (Manipulator.getDataAttribute(this, 'slide') === 'next') {\n carousel.next()\n carousel._maybeEnableCycle()\n return\n }\n\n carousel.prev()\n carousel._maybeEnableCycle()\n})\n\nEventHandler.on(window, EVENT_LOAD_DATA_API, () => {\n const carousels = SelectorEngine.find(SELECTOR_DATA_RIDE)\n\n for (const carousel of carousels) {\n Carousel.getOrCreateInstance(carousel)\n }\n})\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Carousel)\n\nexport default Carousel\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap collapse.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport SelectorEngine from './dom/selector-engine.js'\nimport {\n defineJQueryPlugin,\n getElement,\n reflow\n} from './util/index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'collapse'\nconst DATA_KEY = 'bs.collapse'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_COLLAPSE = 'collapse'\nconst CLASS_NAME_COLLAPSING = 'collapsing'\nconst CLASS_NAME_COLLAPSED = 'collapsed'\nconst CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`\nconst CLASS_NAME_HORIZONTAL = 'collapse-horizontal'\n\nconst WIDTH = 'width'\nconst HEIGHT = 'height'\n\nconst SELECTOR_ACTIVES = '.collapse.show, .collapse.collapsing'\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"collapse\"]'\n\nconst Default = {\n parent: null,\n toggle: true\n}\n\nconst DefaultType = {\n parent: '(null|element)',\n toggle: 'boolean'\n}\n\n/**\n * Class definition\n */\n\nclass Collapse extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._isTransitioning = false\n this._triggerArray = []\n\n const toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE)\n\n for (const elem of toggleList) {\n const selector = SelectorEngine.getSelectorFromElement(elem)\n const filterElement = SelectorEngine.find(selector)\n .filter(foundElement => foundElement === this._element)\n\n if (selector !== null && filterElement.length) {\n this._triggerArray.push(elem)\n }\n }\n\n this._initializeChildren()\n\n if (!this._config.parent) {\n this._addAriaAndCollapsedClass(this._triggerArray, this._isShown())\n }\n\n if (this._config.toggle) {\n this.toggle()\n }\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n toggle() {\n if (this._isShown()) {\n this.hide()\n } else {\n this.show()\n }\n }\n\n show() {\n if (this._isTransitioning || this._isShown()) {\n return\n }\n\n let activeChildren = []\n\n // find active children\n if (this._config.parent) {\n activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES)\n .filter(element => element !== this._element)\n .map(element => Collapse.getOrCreateInstance(element, { toggle: false }))\n }\n\n if (activeChildren.length && activeChildren[0]._isTransitioning) {\n return\n }\n\n const startEvent = EventHandler.trigger(this._element, EVENT_SHOW)\n if (startEvent.defaultPrevented) {\n return\n }\n\n for (const activeInstance of activeChildren) {\n activeInstance.hide()\n }\n\n const dimension = this._getDimension()\n\n this._element.classList.remove(CLASS_NAME_COLLAPSE)\n this._element.classList.add(CLASS_NAME_COLLAPSING)\n\n this._element.style[dimension] = 0\n\n this._addAriaAndCollapsedClass(this._triggerArray, true)\n this._isTransitioning = true\n\n const complete = () => {\n this._isTransitioning = false\n\n this._element.classList.remove(CLASS_NAME_COLLAPSING)\n this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW)\n\n this._element.style[dimension] = ''\n\n EventHandler.trigger(this._element, EVENT_SHOWN)\n }\n\n const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1)\n const scrollSize = `scroll${capitalizedDimension}`\n\n this._queueCallback(complete, this._element, true)\n this._element.style[dimension] = `${this._element[scrollSize]}px`\n }\n\n hide() {\n if (this._isTransitioning || !this._isShown()) {\n return\n }\n\n const startEvent = EventHandler.trigger(this._element, EVENT_HIDE)\n if (startEvent.defaultPrevented) {\n return\n }\n\n const dimension = this._getDimension()\n\n this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`\n\n reflow(this._element)\n\n this._element.classList.add(CLASS_NAME_COLLAPSING)\n this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW)\n\n for (const trigger of this._triggerArray) {\n const element = SelectorEngine.getElementFromSelector(trigger)\n\n if (element && !this._isShown(element)) {\n this._addAriaAndCollapsedClass([trigger], false)\n }\n }\n\n this._isTransitioning = true\n\n const complete = () => {\n this._isTransitioning = false\n this._element.classList.remove(CLASS_NAME_COLLAPSING)\n this._element.classList.add(CLASS_NAME_COLLAPSE)\n EventHandler.trigger(this._element, EVENT_HIDDEN)\n }\n\n this._element.style[dimension] = ''\n\n this._queueCallback(complete, this._element, true)\n }\n\n _isShown(element = this._element) {\n return element.classList.contains(CLASS_NAME_SHOW)\n }\n\n // Private\n _configAfterMerge(config) {\n config.toggle = Boolean(config.toggle) // Coerce string values\n config.parent = getElement(config.parent)\n return config\n }\n\n _getDimension() {\n return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT\n }\n\n _initializeChildren() {\n if (!this._config.parent) {\n return\n }\n\n const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE)\n\n for (const element of children) {\n const selected = SelectorEngine.getElementFromSelector(element)\n\n if (selected) {\n this._addAriaAndCollapsedClass([element], this._isShown(selected))\n }\n }\n }\n\n _getFirstLevelChildren(selector) {\n const children = SelectorEngine.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent)\n // remove children if greater depth\n return SelectorEngine.find(selector, this._config.parent).filter(element => !children.includes(element))\n }\n\n _addAriaAndCollapsedClass(triggerArray, isOpen) {\n if (!triggerArray.length) {\n return\n }\n\n for (const element of triggerArray) {\n element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen)\n element.setAttribute('aria-expanded', isOpen)\n }\n }\n\n // Static\n static jQueryInterface(config) {\n const _config = {}\n if (typeof config === 'string' && /show|hide/.test(config)) {\n _config.toggle = false\n }\n\n return this.each(function () {\n const data = Collapse.getOrCreateInstance(this, _config)\n\n if (typeof config === 'string') {\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n }\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n // preventDefault only for elements (which change the URL) not inside the collapsible element\n if (event.target.tagName === 'A' || (event.delegateTarget && event.delegateTarget.tagName === 'A')) {\n event.preventDefault()\n }\n\n for (const element of SelectorEngine.getMultipleElementsFromSelector(this)) {\n Collapse.getOrCreateInstance(element, { toggle: false }).toggle()\n }\n})\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Collapse)\n\nexport default Collapse\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap dropdown.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport * as Popper from '@popperjs/core'\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport Manipulator from './dom/manipulator.js'\nimport SelectorEngine from './dom/selector-engine.js'\nimport {\n defineJQueryPlugin,\n execute,\n getElement,\n getNextActiveElement,\n isDisabled,\n isElement,\n isRTL,\n isVisible,\n noop\n} from './util/index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'dropdown'\nconst DATA_KEY = 'bs.dropdown'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst ESCAPE_KEY = 'Escape'\nconst TAB_KEY = 'Tab'\nconst ARROW_UP_KEY = 'ArrowUp'\nconst ARROW_DOWN_KEY = 'ArrowDown'\nconst RIGHT_MOUSE_BUTTON = 2 // MouseEvent.button value for the secondary button, usually the right button\n\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_DROPUP = 'dropup'\nconst CLASS_NAME_DROPEND = 'dropend'\nconst CLASS_NAME_DROPSTART = 'dropstart'\nconst CLASS_NAME_DROPUP_CENTER = 'dropup-center'\nconst CLASS_NAME_DROPDOWN_CENTER = 'dropdown-center'\n\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"dropdown\"]:not(.disabled):not(:disabled)'\nconst SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE}.${CLASS_NAME_SHOW}`\nconst SELECTOR_MENU = '.dropdown-menu'\nconst SELECTOR_NAVBAR = '.navbar'\nconst SELECTOR_NAVBAR_NAV = '.navbar-nav'\nconst SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'\n\nconst PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start'\nconst PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end'\nconst PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start'\nconst PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end'\nconst PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start'\nconst PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start'\nconst PLACEMENT_TOPCENTER = 'top'\nconst PLACEMENT_BOTTOMCENTER = 'bottom'\n\nconst Default = {\n autoClose: true,\n boundary: 'clippingParents',\n display: 'dynamic',\n offset: [0, 2],\n popperConfig: null,\n reference: 'toggle'\n}\n\nconst DefaultType = {\n autoClose: '(boolean|string)',\n boundary: '(string|element)',\n display: 'string',\n offset: '(array|string|function)',\n popperConfig: '(null|object|function)',\n reference: '(string|element|object)'\n}\n\n/**\n * Class definition\n */\n\nclass Dropdown extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._popper = null\n this._parent = this._element.parentNode // dropdown wrapper\n // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/\n this._menu = SelectorEngine.next(this._element, SELECTOR_MENU)[0] ||\n SelectorEngine.prev(this._element, SELECTOR_MENU)[0] ||\n SelectorEngine.findOne(SELECTOR_MENU, this._parent)\n this._inNavbar = this._detectNavbar()\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n toggle() {\n return this._isShown() ? this.hide() : this.show()\n }\n\n show() {\n if (isDisabled(this._element) || this._isShown()) {\n return\n }\n\n const relatedTarget = {\n relatedTarget: this._element\n }\n\n const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, relatedTarget)\n\n if (showEvent.defaultPrevented) {\n return\n }\n\n this._createPopper()\n\n // If this is a touch-enabled device we add extra\n // empty mouseover listeners to the body's immediate children;\n // only needed because of broken event delegation on iOS\n // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html\n if ('ontouchstart' in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) {\n for (const element of [].concat(...document.body.children)) {\n EventHandler.on(element, 'mouseover', noop)\n }\n }\n\n this._element.focus()\n this._element.setAttribute('aria-expanded', true)\n\n this._menu.classList.add(CLASS_NAME_SHOW)\n this._element.classList.add(CLASS_NAME_SHOW)\n EventHandler.trigger(this._element, EVENT_SHOWN, relatedTarget)\n }\n\n hide() {\n if (isDisabled(this._element) || !this._isShown()) {\n return\n }\n\n const relatedTarget = {\n relatedTarget: this._element\n }\n\n this._completeHide(relatedTarget)\n }\n\n dispose() {\n if (this._popper) {\n this._popper.destroy()\n }\n\n super.dispose()\n }\n\n update() {\n this._inNavbar = this._detectNavbar()\n if (this._popper) {\n this._popper.update()\n }\n }\n\n // Private\n _completeHide(relatedTarget) {\n const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE, relatedTarget)\n if (hideEvent.defaultPrevented) {\n return\n }\n\n // If this is a touch-enabled device we remove the extra\n // empty mouseover listeners we added for iOS support\n if ('ontouchstart' in document.documentElement) {\n for (const element of [].concat(...document.body.children)) {\n EventHandler.off(element, 'mouseover', noop)\n }\n }\n\n if (this._popper) {\n this._popper.destroy()\n }\n\n this._menu.classList.remove(CLASS_NAME_SHOW)\n this._element.classList.remove(CLASS_NAME_SHOW)\n this._element.setAttribute('aria-expanded', 'false')\n Manipulator.removeDataAttribute(this._menu, 'popper')\n EventHandler.trigger(this._element, EVENT_HIDDEN, relatedTarget)\n }\n\n _getConfig(config) {\n config = super._getConfig(config)\n\n if (typeof config.reference === 'object' && !isElement(config.reference) &&\n typeof config.reference.getBoundingClientRect !== 'function'\n ) {\n // Popper virtual elements require a getBoundingClientRect method\n throw new TypeError(`${NAME.toUpperCase()}: Option \"reference\" provided type \"object\" without a required \"getBoundingClientRect\" method.`)\n }\n\n return config\n }\n\n _createPopper() {\n if (typeof Popper === 'undefined') {\n throw new TypeError('Bootstrap\\'s dropdowns require Popper (https://popper.js.org)')\n }\n\n let referenceElement = this._element\n\n if (this._config.reference === 'parent') {\n referenceElement = this._parent\n } else if (isElement(this._config.reference)) {\n referenceElement = getElement(this._config.reference)\n } else if (typeof this._config.reference === 'object') {\n referenceElement = this._config.reference\n }\n\n const popperConfig = this._getPopperConfig()\n this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig)\n }\n\n _isShown() {\n return this._menu.classList.contains(CLASS_NAME_SHOW)\n }\n\n _getPlacement() {\n const parentDropdown = this._parent\n\n if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {\n return PLACEMENT_RIGHT\n }\n\n if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {\n return PLACEMENT_LEFT\n }\n\n if (parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)) {\n return PLACEMENT_TOPCENTER\n }\n\n if (parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)) {\n return PLACEMENT_BOTTOMCENTER\n }\n\n // We need to trim the value because custom properties can also include spaces\n const isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end'\n\n if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {\n return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP\n }\n\n return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM\n }\n\n _detectNavbar() {\n return this._element.closest(SELECTOR_NAVBAR) !== null\n }\n\n _getOffset() {\n const { offset } = this._config\n\n if (typeof offset === 'string') {\n return offset.split(',').map(value => Number.parseInt(value, 10))\n }\n\n if (typeof offset === 'function') {\n return popperData => offset(popperData, this._element)\n }\n\n return offset\n }\n\n _getPopperConfig() {\n const defaultBsPopperConfig = {\n placement: this._getPlacement(),\n modifiers: [{\n name: 'preventOverflow',\n options: {\n boundary: this._config.boundary\n }\n },\n {\n name: 'offset',\n options: {\n offset: this._getOffset()\n }\n }]\n }\n\n // Disable Popper if we have a static display or Dropdown is in Navbar\n if (this._inNavbar || this._config.display === 'static') {\n Manipulator.setDataAttribute(this._menu, 'popper', 'static') // TODO: v6 remove\n defaultBsPopperConfig.modifiers = [{\n name: 'applyStyles',\n enabled: false\n }]\n }\n\n return {\n ...defaultBsPopperConfig,\n ...execute(this._config.popperConfig, [defaultBsPopperConfig])\n }\n }\n\n _selectMenuItem({ key, target }) {\n const items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter(element => isVisible(element))\n\n if (!items.length) {\n return\n }\n\n // if target isn't included in items (e.g. when expanding the dropdown)\n // allow cycling to get the last item in case key equals ARROW_UP_KEY\n getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus()\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Dropdown.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n })\n }\n\n static clearMenus(event) {\n if (event.button === RIGHT_MOUSE_BUTTON || (event.type === 'keyup' && event.key !== TAB_KEY)) {\n return\n }\n\n const openToggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE_SHOWN)\n\n for (const toggle of openToggles) {\n const context = Dropdown.getInstance(toggle)\n if (!context || context._config.autoClose === false) {\n continue\n }\n\n const composedPath = event.composedPath()\n const isMenuTarget = composedPath.includes(context._menu)\n if (\n composedPath.includes(context._element) ||\n (context._config.autoClose === 'inside' && !isMenuTarget) ||\n (context._config.autoClose === 'outside' && isMenuTarget)\n ) {\n continue\n }\n\n // Tab navigation through the dropdown menu or events from contained inputs shouldn't close the menu\n if (context._menu.contains(event.target) && ((event.type === 'keyup' && event.key === TAB_KEY) || /input|select|option|textarea|form/i.test(event.target.tagName))) {\n continue\n }\n\n const relatedTarget = { relatedTarget: context._element }\n\n if (event.type === 'click') {\n relatedTarget.clickEvent = event\n }\n\n context._completeHide(relatedTarget)\n }\n }\n\n static dataApiKeydownHandler(event) {\n // If not an UP | DOWN | ESCAPE key => not a dropdown command\n // If input/textarea && if key is other than ESCAPE => not a dropdown command\n\n const isInput = /input|textarea/i.test(event.target.tagName)\n const isEscapeEvent = event.key === ESCAPE_KEY\n const isUpOrDownEvent = [ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key)\n\n if (!isUpOrDownEvent && !isEscapeEvent) {\n return\n }\n\n if (isInput && !isEscapeEvent) {\n return\n }\n\n event.preventDefault()\n\n // TODO: v6 revert #37011 & change markup https://getbootstrap.com/docs/5.3/forms/input-group/\n const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE) ?\n this :\n (SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE)[0] ||\n SelectorEngine.next(this, SELECTOR_DATA_TOGGLE)[0] ||\n SelectorEngine.findOne(SELECTOR_DATA_TOGGLE, event.delegateTarget.parentNode))\n\n const instance = Dropdown.getOrCreateInstance(getToggleButton)\n\n if (isUpOrDownEvent) {\n event.stopPropagation()\n instance.show()\n instance._selectMenuItem(event)\n return\n }\n\n if (instance._isShown()) { // else is escape and we check if it is shown\n event.stopPropagation()\n instance.hide()\n getToggleButton.focus()\n }\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE, Dropdown.dataApiKeydownHandler)\nEventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler)\nEventHandler.on(document, EVENT_CLICK_DATA_API, Dropdown.clearMenus)\nEventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus)\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n event.preventDefault()\n Dropdown.getOrCreateInstance(this).toggle()\n})\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Dropdown)\n\nexport default Dropdown\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap util/backdrop.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport EventHandler from '../dom/event-handler.js'\nimport Config from './config.js'\nimport {\n execute, executeAfterTransition, getElement, reflow\n} from './index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'backdrop'\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_SHOW = 'show'\nconst EVENT_MOUSEDOWN = `mousedown.bs.${NAME}`\n\nconst Default = {\n className: 'modal-backdrop',\n clickCallback: null,\n isAnimated: false,\n isVisible: true, // if false, we use the backdrop helper without adding any element to the dom\n rootElement: 'body' // give the choice to place backdrop under different elements\n}\n\nconst DefaultType = {\n className: 'string',\n clickCallback: '(function|null)',\n isAnimated: 'boolean',\n isVisible: 'boolean',\n rootElement: '(element|string)'\n}\n\n/**\n * Class definition\n */\n\nclass Backdrop extends Config {\n constructor(config) {\n super()\n this._config = this._getConfig(config)\n this._isAppended = false\n this._element = null\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n show(callback) {\n if (!this._config.isVisible) {\n execute(callback)\n return\n }\n\n this._append()\n\n const element = this._getElement()\n if (this._config.isAnimated) {\n reflow(element)\n }\n\n element.classList.add(CLASS_NAME_SHOW)\n\n this._emulateAnimation(() => {\n execute(callback)\n })\n }\n\n hide(callback) {\n if (!this._config.isVisible) {\n execute(callback)\n return\n }\n\n this._getElement().classList.remove(CLASS_NAME_SHOW)\n\n this._emulateAnimation(() => {\n this.dispose()\n execute(callback)\n })\n }\n\n dispose() {\n if (!this._isAppended) {\n return\n }\n\n EventHandler.off(this._element, EVENT_MOUSEDOWN)\n\n this._element.remove()\n this._isAppended = false\n }\n\n // Private\n _getElement() {\n if (!this._element) {\n const backdrop = document.createElement('div')\n backdrop.className = this._config.className\n if (this._config.isAnimated) {\n backdrop.classList.add(CLASS_NAME_FADE)\n }\n\n this._element = backdrop\n }\n\n return this._element\n }\n\n _configAfterMerge(config) {\n // use getElement() with the default \"body\" to get a fresh Element on each instantiation\n config.rootElement = getElement(config.rootElement)\n return config\n }\n\n _append() {\n if (this._isAppended) {\n return\n }\n\n const element = this._getElement()\n this._config.rootElement.append(element)\n\n EventHandler.on(element, EVENT_MOUSEDOWN, () => {\n execute(this._config.clickCallback)\n })\n\n this._isAppended = true\n }\n\n _emulateAnimation(callback) {\n executeAfterTransition(callback, this._getElement(), this._config.isAnimated)\n }\n}\n\nexport default Backdrop\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap util/focustrap.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport EventHandler from '../dom/event-handler.js'\nimport SelectorEngine from '../dom/selector-engine.js'\nimport Config from './config.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'focustrap'\nconst DATA_KEY = 'bs.focustrap'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst EVENT_FOCUSIN = `focusin${EVENT_KEY}`\nconst EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY}`\n\nconst TAB_KEY = 'Tab'\nconst TAB_NAV_FORWARD = 'forward'\nconst TAB_NAV_BACKWARD = 'backward'\n\nconst Default = {\n autofocus: true,\n trapElement: null // The element to trap focus inside of\n}\n\nconst DefaultType = {\n autofocus: 'boolean',\n trapElement: 'element'\n}\n\n/**\n * Class definition\n */\n\nclass FocusTrap extends Config {\n constructor(config) {\n super()\n this._config = this._getConfig(config)\n this._isActive = false\n this._lastTabNavDirection = null\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n activate() {\n if (this._isActive) {\n return\n }\n\n if (this._config.autofocus) {\n this._config.trapElement.focus()\n }\n\n EventHandler.off(document, EVENT_KEY) // guard against infinite focus loop\n EventHandler.on(document, EVENT_FOCUSIN, event => this._handleFocusin(event))\n EventHandler.on(document, EVENT_KEYDOWN_TAB, event => this._handleKeydown(event))\n\n this._isActive = true\n }\n\n deactivate() {\n if (!this._isActive) {\n return\n }\n\n this._isActive = false\n EventHandler.off(document, EVENT_KEY)\n }\n\n // Private\n _handleFocusin(event) {\n const { trapElement } = this._config\n\n if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {\n return\n }\n\n const elements = SelectorEngine.focusableChildren(trapElement)\n\n if (elements.length === 0) {\n trapElement.focus()\n } else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {\n elements[elements.length - 1].focus()\n } else {\n elements[0].focus()\n }\n }\n\n _handleKeydown(event) {\n if (event.key !== TAB_KEY) {\n return\n }\n\n this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD\n }\n}\n\nexport default FocusTrap\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap util/scrollBar.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Manipulator from '../dom/manipulator.js'\nimport SelectorEngine from '../dom/selector-engine.js'\nimport { isElement } from './index.js'\n\n/**\n * Constants\n */\n\nconst SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'\nconst SELECTOR_STICKY_CONTENT = '.sticky-top'\nconst PROPERTY_PADDING = 'padding-right'\nconst PROPERTY_MARGIN = 'margin-right'\n\n/**\n * Class definition\n */\n\nclass ScrollBarHelper {\n constructor() {\n this._element = document.body\n }\n\n // Public\n getWidth() {\n // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes\n const documentWidth = document.documentElement.clientWidth\n return Math.abs(window.innerWidth - documentWidth)\n }\n\n hide() {\n const width = this.getWidth()\n this._disableOverFlow()\n // give padding to element to balance the hidden scrollbar width\n this._setElementAttributes(this._element, PROPERTY_PADDING, calculatedValue => calculatedValue + width)\n // trick: We adjust positive paddingRight and negative marginRight to sticky-top elements to keep showing fullwidth\n this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, calculatedValue => calculatedValue + width)\n this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, calculatedValue => calculatedValue - width)\n }\n\n reset() {\n this._resetElementAttributes(this._element, 'overflow')\n this._resetElementAttributes(this._element, PROPERTY_PADDING)\n this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING)\n this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN)\n }\n\n isOverflowing() {\n return this.getWidth() > 0\n }\n\n // Private\n _disableOverFlow() {\n this._saveInitialAttribute(this._element, 'overflow')\n this._element.style.overflow = 'hidden'\n }\n\n _setElementAttributes(selector, styleProperty, callback) {\n const scrollbarWidth = this.getWidth()\n const manipulationCallBack = element => {\n if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {\n return\n }\n\n this._saveInitialAttribute(element, styleProperty)\n const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty)\n element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`)\n }\n\n this._applyManipulationCallback(selector, manipulationCallBack)\n }\n\n _saveInitialAttribute(element, styleProperty) {\n const actualValue = element.style.getPropertyValue(styleProperty)\n if (actualValue) {\n Manipulator.setDataAttribute(element, styleProperty, actualValue)\n }\n }\n\n _resetElementAttributes(selector, styleProperty) {\n const manipulationCallBack = element => {\n const value = Manipulator.getDataAttribute(element, styleProperty)\n // We only want to remove the property if the value is `null`; the value can also be zero\n if (value === null) {\n element.style.removeProperty(styleProperty)\n return\n }\n\n Manipulator.removeDataAttribute(element, styleProperty)\n element.style.setProperty(styleProperty, value)\n }\n\n this._applyManipulationCallback(selector, manipulationCallBack)\n }\n\n _applyManipulationCallback(selector, callBack) {\n if (isElement(selector)) {\n callBack(selector)\n return\n }\n\n for (const sel of SelectorEngine.find(selector, this._element)) {\n callBack(sel)\n }\n }\n}\n\nexport default ScrollBarHelper\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap modal.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport SelectorEngine from './dom/selector-engine.js'\nimport Backdrop from './util/backdrop.js'\nimport { enableDismissTrigger } from './util/component-functions.js'\nimport FocusTrap from './util/focustrap.js'\nimport {\n defineJQueryPlugin, isRTL, isVisible, reflow\n} from './util/index.js'\nimport ScrollBarHelper from './util/scrollbar.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'modal'\nconst DATA_KEY = 'bs.modal'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\nconst ESCAPE_KEY = 'Escape'\n\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_RESIZE = `resize${EVENT_KEY}`\nconst EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY}`\nconst EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY}`\nconst EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_OPEN = 'modal-open'\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_STATIC = 'modal-static'\n\nconst OPEN_SELECTOR = '.modal.show'\nconst SELECTOR_DIALOG = '.modal-dialog'\nconst SELECTOR_MODAL_BODY = '.modal-body'\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"modal\"]'\n\nconst Default = {\n backdrop: true,\n focus: true,\n keyboard: true\n}\n\nconst DefaultType = {\n backdrop: '(boolean|string)',\n focus: 'boolean',\n keyboard: 'boolean'\n}\n\n/**\n * Class definition\n */\n\nclass Modal extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, this._element)\n this._backdrop = this._initializeBackDrop()\n this._focustrap = this._initializeFocusTrap()\n this._isShown = false\n this._isTransitioning = false\n this._scrollBar = new ScrollBarHelper()\n\n this._addEventListeners()\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n toggle(relatedTarget) {\n return this._isShown ? this.hide() : this.show(relatedTarget)\n }\n\n show(relatedTarget) {\n if (this._isShown || this._isTransitioning) {\n return\n }\n\n const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, {\n relatedTarget\n })\n\n if (showEvent.defaultPrevented) {\n return\n }\n\n this._isShown = true\n this._isTransitioning = true\n\n this._scrollBar.hide()\n\n document.body.classList.add(CLASS_NAME_OPEN)\n\n this._adjustDialog()\n\n this._backdrop.show(() => this._showElement(relatedTarget))\n }\n\n hide() {\n if (!this._isShown || this._isTransitioning) {\n return\n }\n\n const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE)\n\n if (hideEvent.defaultPrevented) {\n return\n }\n\n this._isShown = false\n this._isTransitioning = true\n this._focustrap.deactivate()\n\n this._element.classList.remove(CLASS_NAME_SHOW)\n\n this._queueCallback(() => this._hideModal(), this._element, this._isAnimated())\n }\n\n dispose() {\n EventHandler.off(window, EVENT_KEY)\n EventHandler.off(this._dialog, EVENT_KEY)\n\n this._backdrop.dispose()\n this._focustrap.deactivate()\n\n super.dispose()\n }\n\n handleUpdate() {\n this._adjustDialog()\n }\n\n // Private\n _initializeBackDrop() {\n return new Backdrop({\n isVisible: Boolean(this._config.backdrop), // 'static' option will be translated to true, and booleans will keep their value,\n isAnimated: this._isAnimated()\n })\n }\n\n _initializeFocusTrap() {\n return new FocusTrap({\n trapElement: this._element\n })\n }\n\n _showElement(relatedTarget) {\n // try to append dynamic modal\n if (!document.body.contains(this._element)) {\n document.body.append(this._element)\n }\n\n this._element.style.display = 'block'\n this._element.removeAttribute('aria-hidden')\n this._element.setAttribute('aria-modal', true)\n this._element.setAttribute('role', 'dialog')\n this._element.scrollTop = 0\n\n const modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog)\n if (modalBody) {\n modalBody.scrollTop = 0\n }\n\n reflow(this._element)\n\n this._element.classList.add(CLASS_NAME_SHOW)\n\n const transitionComplete = () => {\n if (this._config.focus) {\n this._focustrap.activate()\n }\n\n this._isTransitioning = false\n EventHandler.trigger(this._element, EVENT_SHOWN, {\n relatedTarget\n })\n }\n\n this._queueCallback(transitionComplete, this._dialog, this._isAnimated())\n }\n\n _addEventListeners() {\n EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {\n if (event.key !== ESCAPE_KEY) {\n return\n }\n\n if (this._config.keyboard) {\n this.hide()\n return\n }\n\n this._triggerBackdropTransition()\n })\n\n EventHandler.on(window, EVENT_RESIZE, () => {\n if (this._isShown && !this._isTransitioning) {\n this._adjustDialog()\n }\n })\n\n EventHandler.on(this._element, EVENT_MOUSEDOWN_DISMISS, event => {\n // a bad trick to segregate clicks that may start inside dialog but end outside, and avoid listen to scrollbar clicks\n EventHandler.one(this._element, EVENT_CLICK_DISMISS, event2 => {\n if (this._element !== event.target || this._element !== event2.target) {\n return\n }\n\n if (this._config.backdrop === 'static') {\n this._triggerBackdropTransition()\n return\n }\n\n if (this._config.backdrop) {\n this.hide()\n }\n })\n })\n }\n\n _hideModal() {\n this._element.style.display = 'none'\n this._element.setAttribute('aria-hidden', true)\n this._element.removeAttribute('aria-modal')\n this._element.removeAttribute('role')\n this._isTransitioning = false\n\n this._backdrop.hide(() => {\n document.body.classList.remove(CLASS_NAME_OPEN)\n this._resetAdjustments()\n this._scrollBar.reset()\n EventHandler.trigger(this._element, EVENT_HIDDEN)\n })\n }\n\n _isAnimated() {\n return this._element.classList.contains(CLASS_NAME_FADE)\n }\n\n _triggerBackdropTransition() {\n const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED)\n if (hideEvent.defaultPrevented) {\n return\n }\n\n const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight\n const initialOverflowY = this._element.style.overflowY\n // return if the following background transition hasn't yet completed\n if (initialOverflowY === 'hidden' || this._element.classList.contains(CLASS_NAME_STATIC)) {\n return\n }\n\n if (!isModalOverflowing) {\n this._element.style.overflowY = 'hidden'\n }\n\n this._element.classList.add(CLASS_NAME_STATIC)\n this._queueCallback(() => {\n this._element.classList.remove(CLASS_NAME_STATIC)\n this._queueCallback(() => {\n this._element.style.overflowY = initialOverflowY\n }, this._dialog)\n }, this._dialog)\n\n this._element.focus()\n }\n\n /**\n * The following methods are used to handle overflowing modals\n */\n\n _adjustDialog() {\n const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight\n const scrollbarWidth = this._scrollBar.getWidth()\n const isBodyOverflowing = scrollbarWidth > 0\n\n if (isBodyOverflowing && !isModalOverflowing) {\n const property = isRTL() ? 'paddingLeft' : 'paddingRight'\n this._element.style[property] = `${scrollbarWidth}px`\n }\n\n if (!isBodyOverflowing && isModalOverflowing) {\n const property = isRTL() ? 'paddingRight' : 'paddingLeft'\n this._element.style[property] = `${scrollbarWidth}px`\n }\n }\n\n _resetAdjustments() {\n this._element.style.paddingLeft = ''\n this._element.style.paddingRight = ''\n }\n\n // Static\n static jQueryInterface(config, relatedTarget) {\n return this.each(function () {\n const data = Modal.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config](relatedTarget)\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n const target = SelectorEngine.getElementFromSelector(this)\n\n if (['A', 'AREA'].includes(this.tagName)) {\n event.preventDefault()\n }\n\n EventHandler.one(target, EVENT_SHOW, showEvent => {\n if (showEvent.defaultPrevented) {\n // only register focus restorer if modal will actually get shown\n return\n }\n\n EventHandler.one(target, EVENT_HIDDEN, () => {\n if (isVisible(this)) {\n this.focus()\n }\n })\n })\n\n // avoid conflict when clicking modal toggler while another one is open\n const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR)\n if (alreadyOpen) {\n Modal.getInstance(alreadyOpen).hide()\n }\n\n const data = Modal.getOrCreateInstance(target)\n\n data.toggle(this)\n})\n\nenableDismissTrigger(Modal)\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Modal)\n\nexport default Modal\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap offcanvas.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport SelectorEngine from './dom/selector-engine.js'\nimport Backdrop from './util/backdrop.js'\nimport { enableDismissTrigger } from './util/component-functions.js'\nimport FocusTrap from './util/focustrap.js'\nimport {\n defineJQueryPlugin,\n isDisabled,\n isVisible\n} from './util/index.js'\nimport ScrollBarHelper from './util/scrollbar.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'offcanvas'\nconst DATA_KEY = 'bs.offcanvas'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\nconst EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`\nconst ESCAPE_KEY = 'Escape'\n\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_SHOWING = 'showing'\nconst CLASS_NAME_HIDING = 'hiding'\nconst CLASS_NAME_BACKDROP = 'offcanvas-backdrop'\nconst OPEN_SELECTOR = '.offcanvas.show'\n\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_RESIZE = `resize${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`\nconst EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY}`\n\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"offcanvas\"]'\n\nconst Default = {\n backdrop: true,\n keyboard: true,\n scroll: false\n}\n\nconst DefaultType = {\n backdrop: '(boolean|string)',\n keyboard: 'boolean',\n scroll: 'boolean'\n}\n\n/**\n * Class definition\n */\n\nclass Offcanvas extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._isShown = false\n this._backdrop = this._initializeBackDrop()\n this._focustrap = this._initializeFocusTrap()\n this._addEventListeners()\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n toggle(relatedTarget) {\n return this._isShown ? this.hide() : this.show(relatedTarget)\n }\n\n show(relatedTarget) {\n if (this._isShown) {\n return\n }\n\n const showEvent = EventHandler.trigger(this._element, EVENT_SHOW, { relatedTarget })\n\n if (showEvent.defaultPrevented) {\n return\n }\n\n this._isShown = true\n this._backdrop.show()\n\n if (!this._config.scroll) {\n new ScrollBarHelper().hide()\n }\n\n this._element.setAttribute('aria-modal', true)\n this._element.setAttribute('role', 'dialog')\n this._element.classList.add(CLASS_NAME_SHOWING)\n\n const completeCallBack = () => {\n if (!this._config.scroll || this._config.backdrop) {\n this._focustrap.activate()\n }\n\n this._element.classList.add(CLASS_NAME_SHOW)\n this._element.classList.remove(CLASS_NAME_SHOWING)\n EventHandler.trigger(this._element, EVENT_SHOWN, { relatedTarget })\n }\n\n this._queueCallback(completeCallBack, this._element, true)\n }\n\n hide() {\n if (!this._isShown) {\n return\n }\n\n const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE)\n\n if (hideEvent.defaultPrevented) {\n return\n }\n\n this._focustrap.deactivate()\n this._element.blur()\n this._isShown = false\n this._element.classList.add(CLASS_NAME_HIDING)\n this._backdrop.hide()\n\n const completeCallback = () => {\n this._element.classList.remove(CLASS_NAME_SHOW, CLASS_NAME_HIDING)\n this._element.removeAttribute('aria-modal')\n this._element.removeAttribute('role')\n\n if (!this._config.scroll) {\n new ScrollBarHelper().reset()\n }\n\n EventHandler.trigger(this._element, EVENT_HIDDEN)\n }\n\n this._queueCallback(completeCallback, this._element, true)\n }\n\n dispose() {\n this._backdrop.dispose()\n this._focustrap.deactivate()\n super.dispose()\n }\n\n // Private\n _initializeBackDrop() {\n const clickCallback = () => {\n if (this._config.backdrop === 'static') {\n EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED)\n return\n }\n\n this.hide()\n }\n\n // 'static' option will be translated to true, and booleans will keep their value\n const isVisible = Boolean(this._config.backdrop)\n\n return new Backdrop({\n className: CLASS_NAME_BACKDROP,\n isVisible,\n isAnimated: true,\n rootElement: this._element.parentNode,\n clickCallback: isVisible ? clickCallback : null\n })\n }\n\n _initializeFocusTrap() {\n return new FocusTrap({\n trapElement: this._element\n })\n }\n\n _addEventListeners() {\n EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, event => {\n if (event.key !== ESCAPE_KEY) {\n return\n }\n\n if (this._config.keyboard) {\n this.hide()\n return\n }\n\n EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED)\n })\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Offcanvas.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config](this)\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n const target = SelectorEngine.getElementFromSelector(this)\n\n if (['A', 'AREA'].includes(this.tagName)) {\n event.preventDefault()\n }\n\n if (isDisabled(this)) {\n return\n }\n\n EventHandler.one(target, EVENT_HIDDEN, () => {\n // focus on trigger when it is closed\n if (isVisible(this)) {\n this.focus()\n }\n })\n\n // avoid conflict when clicking a toggler of an offcanvas, while another is open\n const alreadyOpen = SelectorEngine.findOne(OPEN_SELECTOR)\n if (alreadyOpen && alreadyOpen !== target) {\n Offcanvas.getInstance(alreadyOpen).hide()\n }\n\n const data = Offcanvas.getOrCreateInstance(target)\n data.toggle(this)\n})\n\nEventHandler.on(window, EVENT_LOAD_DATA_API, () => {\n for (const selector of SelectorEngine.find(OPEN_SELECTOR)) {\n Offcanvas.getOrCreateInstance(selector).show()\n }\n})\n\nEventHandler.on(window, EVENT_RESIZE, () => {\n for (const element of SelectorEngine.find('[aria-modal][class*=show][class*=offcanvas-]')) {\n if (getComputedStyle(element).position !== 'fixed') {\n Offcanvas.getOrCreateInstance(element).hide()\n }\n }\n})\n\nenableDismissTrigger(Offcanvas)\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Offcanvas)\n\nexport default Offcanvas\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap util/sanitizer.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\n// js-docs-start allow-list\nconst ARIA_ATTRIBUTE_PATTERN = /^aria-[\\w-]*$/i\n\nexport const DefaultAllowlist = {\n // Global attributes allowed on any supplied element below.\n '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN],\n a: ['target', 'href', 'title', 'rel'],\n area: [],\n b: [],\n br: [],\n col: [],\n code: [],\n dd: [],\n div: [],\n dl: [],\n dt: [],\n em: [],\n hr: [],\n h1: [],\n h2: [],\n h3: [],\n h4: [],\n h5: [],\n h6: [],\n i: [],\n img: ['src', 'srcset', 'alt', 'title', 'width', 'height'],\n li: [],\n ol: [],\n p: [],\n pre: [],\n s: [],\n small: [],\n span: [],\n sub: [],\n sup: [],\n strong: [],\n u: [],\n ul: []\n}\n// js-docs-end allow-list\n\nconst uriAttributes = new Set([\n 'background',\n 'cite',\n 'href',\n 'itemtype',\n 'longdesc',\n 'poster',\n 'src',\n 'xlink:href'\n])\n\n/**\n * A pattern that recognizes URLs that are safe wrt. XSS in URL navigation\n * contexts.\n *\n * Shout-out to Angular https://github.com/angular/angular/blob/15.2.8/packages/core/src/sanitization/url_sanitizer.ts#L38\n */\n// eslint-disable-next-line unicorn/better-regex\nconst SAFE_URL_PATTERN = /^(?!javascript:)(?:[a-z0-9+.-]+:|[^&:/?#]*(?:[/?#]|$))/i\n\nconst allowedAttribute = (attribute, allowedAttributeList) => {\n const attributeName = attribute.nodeName.toLowerCase()\n\n if (allowedAttributeList.includes(attributeName)) {\n if (uriAttributes.has(attributeName)) {\n return Boolean(SAFE_URL_PATTERN.test(attribute.nodeValue))\n }\n\n return true\n }\n\n // Check if a regular expression validates the attribute.\n return allowedAttributeList.filter(attributeRegex => attributeRegex instanceof RegExp)\n .some(regex => regex.test(attributeName))\n}\n\nexport function sanitizeHtml(unsafeHtml, allowList, sanitizeFunction) {\n if (!unsafeHtml.length) {\n return unsafeHtml\n }\n\n if (sanitizeFunction && typeof sanitizeFunction === 'function') {\n return sanitizeFunction(unsafeHtml)\n }\n\n const domParser = new window.DOMParser()\n const createdDocument = domParser.parseFromString(unsafeHtml, 'text/html')\n const elements = [].concat(...createdDocument.body.querySelectorAll('*'))\n\n for (const element of elements) {\n const elementName = element.nodeName.toLowerCase()\n\n if (!Object.keys(allowList).includes(elementName)) {\n element.remove()\n continue\n }\n\n const attributeList = [].concat(...element.attributes)\n const allowedAttributes = [].concat(allowList['*'] || [], allowList[elementName] || [])\n\n for (const attribute of attributeList) {\n if (!allowedAttribute(attribute, allowedAttributes)) {\n element.removeAttribute(attribute.nodeName)\n }\n }\n }\n\n return createdDocument.body.innerHTML\n}\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap util/template-factory.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport SelectorEngine from '../dom/selector-engine.js'\nimport Config from './config.js'\nimport { DefaultAllowlist, sanitizeHtml } from './sanitizer.js'\nimport { execute, getElement, isElement } from './index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'TemplateFactory'\n\nconst Default = {\n allowList: DefaultAllowlist,\n content: {}, // { selector : text , selector2 : text2 , }\n extraClass: '',\n html: false,\n sanitize: true,\n sanitizeFn: null,\n template: '
'\n}\n\nconst DefaultType = {\n allowList: 'object',\n content: 'object',\n extraClass: '(string|function)',\n html: 'boolean',\n sanitize: 'boolean',\n sanitizeFn: '(null|function)',\n template: 'string'\n}\n\nconst DefaultContentType = {\n entry: '(string|element|function|null)',\n selector: '(string|element)'\n}\n\n/**\n * Class definition\n */\n\nclass TemplateFactory extends Config {\n constructor(config) {\n super()\n this._config = this._getConfig(config)\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n getContent() {\n return Object.values(this._config.content)\n .map(config => this._resolvePossibleFunction(config))\n .filter(Boolean)\n }\n\n hasContent() {\n return this.getContent().length > 0\n }\n\n changeContent(content) {\n this._checkContent(content)\n this._config.content = { ...this._config.content, ...content }\n return this\n }\n\n toHtml() {\n const templateWrapper = document.createElement('div')\n templateWrapper.innerHTML = this._maybeSanitize(this._config.template)\n\n for (const [selector, text] of Object.entries(this._config.content)) {\n this._setContent(templateWrapper, text, selector)\n }\n\n const template = templateWrapper.children[0]\n const extraClass = this._resolvePossibleFunction(this._config.extraClass)\n\n if (extraClass) {\n template.classList.add(...extraClass.split(' '))\n }\n\n return template\n }\n\n // Private\n _typeCheckConfig(config) {\n super._typeCheckConfig(config)\n this._checkContent(config.content)\n }\n\n _checkContent(arg) {\n for (const [selector, content] of Object.entries(arg)) {\n super._typeCheckConfig({ selector, entry: content }, DefaultContentType)\n }\n }\n\n _setContent(template, content, selector) {\n const templateElement = SelectorEngine.findOne(selector, template)\n\n if (!templateElement) {\n return\n }\n\n content = this._resolvePossibleFunction(content)\n\n if (!content) {\n templateElement.remove()\n return\n }\n\n if (isElement(content)) {\n this._putElementInTemplate(getElement(content), templateElement)\n return\n }\n\n if (this._config.html) {\n templateElement.innerHTML = this._maybeSanitize(content)\n return\n }\n\n templateElement.textContent = content\n }\n\n _maybeSanitize(arg) {\n return this._config.sanitize ? sanitizeHtml(arg, this._config.allowList, this._config.sanitizeFn) : arg\n }\n\n _resolvePossibleFunction(arg) {\n return execute(arg, [this])\n }\n\n _putElementInTemplate(element, templateElement) {\n if (this._config.html) {\n templateElement.innerHTML = ''\n templateElement.append(element)\n return\n }\n\n templateElement.textContent = element.textContent\n }\n}\n\nexport default TemplateFactory\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap tooltip.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport * as Popper from '@popperjs/core'\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport Manipulator from './dom/manipulator.js'\nimport {\n defineJQueryPlugin, execute, findShadowRoot, getElement, getUID, isRTL, noop\n} from './util/index.js'\nimport { DefaultAllowlist } from './util/sanitizer.js'\nimport TemplateFactory from './util/template-factory.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'tooltip'\nconst DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn'])\n\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_MODAL = 'modal'\nconst CLASS_NAME_SHOW = 'show'\n\nconst SELECTOR_TOOLTIP_INNER = '.tooltip-inner'\nconst SELECTOR_MODAL = `.${CLASS_NAME_MODAL}`\n\nconst EVENT_MODAL_HIDE = 'hide.bs.modal'\n\nconst TRIGGER_HOVER = 'hover'\nconst TRIGGER_FOCUS = 'focus'\nconst TRIGGER_CLICK = 'click'\nconst TRIGGER_MANUAL = 'manual'\n\nconst EVENT_HIDE = 'hide'\nconst EVENT_HIDDEN = 'hidden'\nconst EVENT_SHOW = 'show'\nconst EVENT_SHOWN = 'shown'\nconst EVENT_INSERTED = 'inserted'\nconst EVENT_CLICK = 'click'\nconst EVENT_FOCUSIN = 'focusin'\nconst EVENT_FOCUSOUT = 'focusout'\nconst EVENT_MOUSEENTER = 'mouseenter'\nconst EVENT_MOUSELEAVE = 'mouseleave'\n\nconst AttachmentMap = {\n AUTO: 'auto',\n TOP: 'top',\n RIGHT: isRTL() ? 'left' : 'right',\n BOTTOM: 'bottom',\n LEFT: isRTL() ? 'right' : 'left'\n}\n\nconst Default = {\n allowList: DefaultAllowlist,\n animation: true,\n boundary: 'clippingParents',\n container: false,\n customClass: '',\n delay: 0,\n fallbackPlacements: ['top', 'right', 'bottom', 'left'],\n html: false,\n offset: [0, 6],\n placement: 'top',\n popperConfig: null,\n sanitize: true,\n sanitizeFn: null,\n selector: false,\n template: '',\n title: '',\n trigger: 'hover focus'\n}\n\nconst DefaultType = {\n allowList: 'object',\n animation: 'boolean',\n boundary: '(string|element)',\n container: '(string|element|boolean)',\n customClass: '(string|function)',\n delay: '(number|object)',\n fallbackPlacements: 'array',\n html: 'boolean',\n offset: '(array|string|function)',\n placement: '(string|function)',\n popperConfig: '(null|object|function)',\n sanitize: 'boolean',\n sanitizeFn: '(null|function)',\n selector: '(string|boolean)',\n template: 'string',\n title: '(string|element|function)',\n trigger: 'string'\n}\n\n/**\n * Class definition\n */\n\nclass Tooltip extends BaseComponent {\n constructor(element, config) {\n if (typeof Popper === 'undefined') {\n throw new TypeError('Bootstrap\\'s tooltips require Popper (https://popper.js.org)')\n }\n\n super(element, config)\n\n // Private\n this._isEnabled = true\n this._timeout = 0\n this._isHovered = null\n this._activeTrigger = {}\n this._popper = null\n this._templateFactory = null\n this._newContent = null\n\n // Protected\n this.tip = null\n\n this._setListeners()\n\n if (!this._config.selector) {\n this._fixTitle()\n }\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n enable() {\n this._isEnabled = true\n }\n\n disable() {\n this._isEnabled = false\n }\n\n toggleEnabled() {\n this._isEnabled = !this._isEnabled\n }\n\n toggle() {\n if (!this._isEnabled) {\n return\n }\n\n this._activeTrigger.click = !this._activeTrigger.click\n if (this._isShown()) {\n this._leave()\n return\n }\n\n this._enter()\n }\n\n dispose() {\n clearTimeout(this._timeout)\n\n EventHandler.off(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler)\n\n if (this._element.getAttribute('data-bs-original-title')) {\n this._element.setAttribute('title', this._element.getAttribute('data-bs-original-title'))\n }\n\n this._disposePopper()\n super.dispose()\n }\n\n show() {\n if (this._element.style.display === 'none') {\n throw new Error('Please use show on visible elements')\n }\n\n if (!(this._isWithContent() && this._isEnabled)) {\n return\n }\n\n const showEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOW))\n const shadowRoot = findShadowRoot(this._element)\n const isInTheDom = (shadowRoot || this._element.ownerDocument.documentElement).contains(this._element)\n\n if (showEvent.defaultPrevented || !isInTheDom) {\n return\n }\n\n // TODO: v6 remove this or make it optional\n this._disposePopper()\n\n const tip = this._getTipElement()\n\n this._element.setAttribute('aria-describedby', tip.getAttribute('id'))\n\n const { container } = this._config\n\n if (!this._element.ownerDocument.documentElement.contains(this.tip)) {\n container.append(tip)\n EventHandler.trigger(this._element, this.constructor.eventName(EVENT_INSERTED))\n }\n\n this._popper = this._createPopper(tip)\n\n tip.classList.add(CLASS_NAME_SHOW)\n\n // If this is a touch-enabled device we add extra\n // empty mouseover listeners to the body's immediate children;\n // only needed because of broken event delegation on iOS\n // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html\n if ('ontouchstart' in document.documentElement) {\n for (const element of [].concat(...document.body.children)) {\n EventHandler.on(element, 'mouseover', noop)\n }\n }\n\n const complete = () => {\n EventHandler.trigger(this._element, this.constructor.eventName(EVENT_SHOWN))\n\n if (this._isHovered === false) {\n this._leave()\n }\n\n this._isHovered = false\n }\n\n this._queueCallback(complete, this.tip, this._isAnimated())\n }\n\n hide() {\n if (!this._isShown()) {\n return\n }\n\n const hideEvent = EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDE))\n if (hideEvent.defaultPrevented) {\n return\n }\n\n const tip = this._getTipElement()\n tip.classList.remove(CLASS_NAME_SHOW)\n\n // If this is a touch-enabled device we remove the extra\n // empty mouseover listeners we added for iOS support\n if ('ontouchstart' in document.documentElement) {\n for (const element of [].concat(...document.body.children)) {\n EventHandler.off(element, 'mouseover', noop)\n }\n }\n\n this._activeTrigger[TRIGGER_CLICK] = false\n this._activeTrigger[TRIGGER_FOCUS] = false\n this._activeTrigger[TRIGGER_HOVER] = false\n this._isHovered = null // it is a trick to support manual triggering\n\n const complete = () => {\n if (this._isWithActiveTrigger()) {\n return\n }\n\n if (!this._isHovered) {\n this._disposePopper()\n }\n\n this._element.removeAttribute('aria-describedby')\n EventHandler.trigger(this._element, this.constructor.eventName(EVENT_HIDDEN))\n }\n\n this._queueCallback(complete, this.tip, this._isAnimated())\n }\n\n update() {\n if (this._popper) {\n this._popper.update()\n }\n }\n\n // Protected\n _isWithContent() {\n return Boolean(this._getTitle())\n }\n\n _getTipElement() {\n if (!this.tip) {\n this.tip = this._createTipElement(this._newContent || this._getContentForTemplate())\n }\n\n return this.tip\n }\n\n _createTipElement(content) {\n const tip = this._getTemplateFactory(content).toHtml()\n\n // TODO: remove this check in v6\n if (!tip) {\n return null\n }\n\n tip.classList.remove(CLASS_NAME_FADE, CLASS_NAME_SHOW)\n // TODO: v6 the following can be achieved with CSS only\n tip.classList.add(`bs-${this.constructor.NAME}-auto`)\n\n const tipId = getUID(this.constructor.NAME).toString()\n\n tip.setAttribute('id', tipId)\n\n if (this._isAnimated()) {\n tip.classList.add(CLASS_NAME_FADE)\n }\n\n return tip\n }\n\n setContent(content) {\n this._newContent = content\n if (this._isShown()) {\n this._disposePopper()\n this.show()\n }\n }\n\n _getTemplateFactory(content) {\n if (this._templateFactory) {\n this._templateFactory.changeContent(content)\n } else {\n this._templateFactory = new TemplateFactory({\n ...this._config,\n // the `content` var has to be after `this._config`\n // to override config.content in case of popover\n content,\n extraClass: this._resolvePossibleFunction(this._config.customClass)\n })\n }\n\n return this._templateFactory\n }\n\n _getContentForTemplate() {\n return {\n [SELECTOR_TOOLTIP_INNER]: this._getTitle()\n }\n }\n\n _getTitle() {\n return this._resolvePossibleFunction(this._config.title) || this._element.getAttribute('data-bs-original-title')\n }\n\n // Private\n _initializeOnDelegatedTarget(event) {\n return this.constructor.getOrCreateInstance(event.delegateTarget, this._getDelegateConfig())\n }\n\n _isAnimated() {\n return this._config.animation || (this.tip && this.tip.classList.contains(CLASS_NAME_FADE))\n }\n\n _isShown() {\n return this.tip && this.tip.classList.contains(CLASS_NAME_SHOW)\n }\n\n _createPopper(tip) {\n const placement = execute(this._config.placement, [this, tip, this._element])\n const attachment = AttachmentMap[placement.toUpperCase()]\n return Popper.createPopper(this._element, tip, this._getPopperConfig(attachment))\n }\n\n _getOffset() {\n const { offset } = this._config\n\n if (typeof offset === 'string') {\n return offset.split(',').map(value => Number.parseInt(value, 10))\n }\n\n if (typeof offset === 'function') {\n return popperData => offset(popperData, this._element)\n }\n\n return offset\n }\n\n _resolvePossibleFunction(arg) {\n return execute(arg, [this._element])\n }\n\n _getPopperConfig(attachment) {\n const defaultBsPopperConfig = {\n placement: attachment,\n modifiers: [\n {\n name: 'flip',\n options: {\n fallbackPlacements: this._config.fallbackPlacements\n }\n },\n {\n name: 'offset',\n options: {\n offset: this._getOffset()\n }\n },\n {\n name: 'preventOverflow',\n options: {\n boundary: this._config.boundary\n }\n },\n {\n name: 'arrow',\n options: {\n element: `.${this.constructor.NAME}-arrow`\n }\n },\n {\n name: 'preSetPlacement',\n enabled: true,\n phase: 'beforeMain',\n fn: data => {\n // Pre-set Popper's placement attribute in order to read the arrow sizes properly.\n // Otherwise, Popper mixes up the width and height dimensions since the initial arrow style is for top placement\n this._getTipElement().setAttribute('data-popper-placement', data.state.placement)\n }\n }\n ]\n }\n\n return {\n ...defaultBsPopperConfig,\n ...execute(this._config.popperConfig, [defaultBsPopperConfig])\n }\n }\n\n _setListeners() {\n const triggers = this._config.trigger.split(' ')\n\n for (const trigger of triggers) {\n if (trigger === 'click') {\n EventHandler.on(this._element, this.constructor.eventName(EVENT_CLICK), this._config.selector, event => {\n const context = this._initializeOnDelegatedTarget(event)\n context.toggle()\n })\n } else if (trigger !== TRIGGER_MANUAL) {\n const eventIn = trigger === TRIGGER_HOVER ?\n this.constructor.eventName(EVENT_MOUSEENTER) :\n this.constructor.eventName(EVENT_FOCUSIN)\n const eventOut = trigger === TRIGGER_HOVER ?\n this.constructor.eventName(EVENT_MOUSELEAVE) :\n this.constructor.eventName(EVENT_FOCUSOUT)\n\n EventHandler.on(this._element, eventIn, this._config.selector, event => {\n const context = this._initializeOnDelegatedTarget(event)\n context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true\n context._enter()\n })\n EventHandler.on(this._element, eventOut, this._config.selector, event => {\n const context = this._initializeOnDelegatedTarget(event)\n context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] =\n context._element.contains(event.relatedTarget)\n\n context._leave()\n })\n }\n }\n\n this._hideModalHandler = () => {\n if (this._element) {\n this.hide()\n }\n }\n\n EventHandler.on(this._element.closest(SELECTOR_MODAL), EVENT_MODAL_HIDE, this._hideModalHandler)\n }\n\n _fixTitle() {\n const title = this._element.getAttribute('title')\n\n if (!title) {\n return\n }\n\n if (!this._element.getAttribute('aria-label') && !this._element.textContent.trim()) {\n this._element.setAttribute('aria-label', title)\n }\n\n this._element.setAttribute('data-bs-original-title', title) // DO NOT USE IT. Is only for backwards compatibility\n this._element.removeAttribute('title')\n }\n\n _enter() {\n if (this._isShown() || this._isHovered) {\n this._isHovered = true\n return\n }\n\n this._isHovered = true\n\n this._setTimeout(() => {\n if (this._isHovered) {\n this.show()\n }\n }, this._config.delay.show)\n }\n\n _leave() {\n if (this._isWithActiveTrigger()) {\n return\n }\n\n this._isHovered = false\n\n this._setTimeout(() => {\n if (!this._isHovered) {\n this.hide()\n }\n }, this._config.delay.hide)\n }\n\n _setTimeout(handler, timeout) {\n clearTimeout(this._timeout)\n this._timeout = setTimeout(handler, timeout)\n }\n\n _isWithActiveTrigger() {\n return Object.values(this._activeTrigger).includes(true)\n }\n\n _getConfig(config) {\n const dataAttributes = Manipulator.getDataAttributes(this._element)\n\n for (const dataAttribute of Object.keys(dataAttributes)) {\n if (DISALLOWED_ATTRIBUTES.has(dataAttribute)) {\n delete dataAttributes[dataAttribute]\n }\n }\n\n config = {\n ...dataAttributes,\n ...(typeof config === 'object' && config ? config : {})\n }\n config = this._mergeConfigObj(config)\n config = this._configAfterMerge(config)\n this._typeCheckConfig(config)\n return config\n }\n\n _configAfterMerge(config) {\n config.container = config.container === false ? document.body : getElement(config.container)\n\n if (typeof config.delay === 'number') {\n config.delay = {\n show: config.delay,\n hide: config.delay\n }\n }\n\n if (typeof config.title === 'number') {\n config.title = config.title.toString()\n }\n\n if (typeof config.content === 'number') {\n config.content = config.content.toString()\n }\n\n return config\n }\n\n _getDelegateConfig() {\n const config = {}\n\n for (const [key, value] of Object.entries(this._config)) {\n if (this.constructor.Default[key] !== value) {\n config[key] = value\n }\n }\n\n config.selector = false\n config.trigger = 'manual'\n\n // In the future can be replaced with:\n // const keysWithDifferentValues = Object.entries(this._config).filter(entry => this.constructor.Default[entry[0]] !== this._config[entry[0]])\n // `Object.fromEntries(keysWithDifferentValues)`\n return config\n }\n\n _disposePopper() {\n if (this._popper) {\n this._popper.destroy()\n this._popper = null\n }\n\n if (this.tip) {\n this.tip.remove()\n this.tip = null\n }\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Tooltip.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n })\n }\n}\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Tooltip)\n\nexport default Tooltip\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap popover.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport Tooltip from './tooltip.js'\nimport { defineJQueryPlugin } from './util/index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'popover'\n\nconst SELECTOR_TITLE = '.popover-header'\nconst SELECTOR_CONTENT = '.popover-body'\n\nconst Default = {\n ...Tooltip.Default,\n content: '',\n offset: [0, 8],\n placement: 'right',\n template: '' +\n '
' +\n '' +\n '
' +\n '
',\n trigger: 'click'\n}\n\nconst DefaultType = {\n ...Tooltip.DefaultType,\n content: '(null|string|element|function)'\n}\n\n/**\n * Class definition\n */\n\nclass Popover extends Tooltip {\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Overrides\n _isWithContent() {\n return this._getTitle() || this._getContent()\n }\n\n // Private\n _getContentForTemplate() {\n return {\n [SELECTOR_TITLE]: this._getTitle(),\n [SELECTOR_CONTENT]: this._getContent()\n }\n }\n\n _getContent() {\n return this._resolvePossibleFunction(this._config.content)\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Popover.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n })\n }\n}\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Popover)\n\nexport default Popover\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap scrollspy.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport SelectorEngine from './dom/selector-engine.js'\nimport {\n defineJQueryPlugin, getElement, isDisabled, isVisible\n} from './util/index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'scrollspy'\nconst DATA_KEY = 'bs.scrollspy'\nconst EVENT_KEY = `.${DATA_KEY}`\nconst DATA_API_KEY = '.data-api'\n\nconst EVENT_ACTIVATE = `activate${EVENT_KEY}`\nconst EVENT_CLICK = `click${EVENT_KEY}`\nconst EVENT_LOAD_DATA_API = `load${EVENT_KEY}${DATA_API_KEY}`\n\nconst CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'\nconst CLASS_NAME_ACTIVE = 'active'\n\nconst SELECTOR_DATA_SPY = '[data-bs-spy=\"scroll\"]'\nconst SELECTOR_TARGET_LINKS = '[href]'\nconst SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'\nconst SELECTOR_NAV_LINKS = '.nav-link'\nconst SELECTOR_NAV_ITEMS = '.nav-item'\nconst SELECTOR_LIST_ITEMS = '.list-group-item'\nconst SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`\nconst SELECTOR_DROPDOWN = '.dropdown'\nconst SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'\n\nconst Default = {\n offset: null, // TODO: v6 @deprecated, keep it for backwards compatibility reasons\n rootMargin: '0px 0px -25%',\n smoothScroll: false,\n target: null,\n threshold: [0.1, 0.5, 1]\n}\n\nconst DefaultType = {\n offset: '(number|null)', // TODO v6 @deprecated, keep it for backwards compatibility reasons\n rootMargin: 'string',\n smoothScroll: 'boolean',\n target: 'element',\n threshold: 'array'\n}\n\n/**\n * Class definition\n */\n\nclass ScrollSpy extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n // this._element is the observablesContainer and config.target the menu links wrapper\n this._targetLinks = new Map()\n this._observableSections = new Map()\n this._rootElement = getComputedStyle(this._element).overflowY === 'visible' ? null : this._element\n this._activeTarget = null\n this._observer = null\n this._previousScrollData = {\n visibleEntryTop: 0,\n parentScrollTop: 0\n }\n this.refresh() // initialize\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n refresh() {\n this._initializeTargetsAndObservables()\n this._maybeEnableSmoothScroll()\n\n if (this._observer) {\n this._observer.disconnect()\n } else {\n this._observer = this._getNewObserver()\n }\n\n for (const section of this._observableSections.values()) {\n this._observer.observe(section)\n }\n }\n\n dispose() {\n this._observer.disconnect()\n super.dispose()\n }\n\n // Private\n _configAfterMerge(config) {\n // TODO: on v6 target should be given explicitly & remove the {target: 'ss-target'} case\n config.target = getElement(config.target) || document.body\n\n // TODO: v6 Only for backwards compatibility reasons. Use rootMargin only\n config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin\n\n if (typeof config.threshold === 'string') {\n config.threshold = config.threshold.split(',').map(value => Number.parseFloat(value))\n }\n\n return config\n }\n\n _maybeEnableSmoothScroll() {\n if (!this._config.smoothScroll) {\n return\n }\n\n // unregister any previous listeners\n EventHandler.off(this._config.target, EVENT_CLICK)\n\n EventHandler.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, event => {\n const observableSection = this._observableSections.get(event.target.hash)\n if (observableSection) {\n event.preventDefault()\n const root = this._rootElement || window\n const height = observableSection.offsetTop - this._element.offsetTop\n if (root.scrollTo) {\n root.scrollTo({ top: height, behavior: 'smooth' })\n return\n }\n\n // Chrome 60 doesn't support `scrollTo`\n root.scrollTop = height\n }\n })\n }\n\n _getNewObserver() {\n const options = {\n root: this._rootElement,\n threshold: this._config.threshold,\n rootMargin: this._config.rootMargin\n }\n\n return new IntersectionObserver(entries => this._observerCallback(entries), options)\n }\n\n // The logic of selection\n _observerCallback(entries) {\n const targetElement = entry => this._targetLinks.get(`#${entry.target.id}`)\n const activate = entry => {\n this._previousScrollData.visibleEntryTop = entry.target.offsetTop\n this._process(targetElement(entry))\n }\n\n const parentScrollTop = (this._rootElement || document.documentElement).scrollTop\n const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop\n this._previousScrollData.parentScrollTop = parentScrollTop\n\n for (const entry of entries) {\n if (!entry.isIntersecting) {\n this._activeTarget = null\n this._clearActiveClass(targetElement(entry))\n\n continue\n }\n\n const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop\n // if we are scrolling down, pick the bigger offsetTop\n if (userScrollsDown && entryIsLowerThanPrevious) {\n activate(entry)\n // if parent isn't scrolled, let's keep the first visible item, breaking the iteration\n if (!parentScrollTop) {\n return\n }\n\n continue\n }\n\n // if we are scrolling up, pick the smallest offsetTop\n if (!userScrollsDown && !entryIsLowerThanPrevious) {\n activate(entry)\n }\n }\n }\n\n _initializeTargetsAndObservables() {\n this._targetLinks = new Map()\n this._observableSections = new Map()\n\n const targetLinks = SelectorEngine.find(SELECTOR_TARGET_LINKS, this._config.target)\n\n for (const anchor of targetLinks) {\n // ensure that the anchor has an id and is not disabled\n if (!anchor.hash || isDisabled(anchor)) {\n continue\n }\n\n const observableSection = SelectorEngine.findOne(decodeURI(anchor.hash), this._element)\n\n // ensure that the observableSection exists & is visible\n if (isVisible(observableSection)) {\n this._targetLinks.set(decodeURI(anchor.hash), anchor)\n this._observableSections.set(anchor.hash, observableSection)\n }\n }\n }\n\n _process(target) {\n if (this._activeTarget === target) {\n return\n }\n\n this._clearActiveClass(this._config.target)\n this._activeTarget = target\n target.classList.add(CLASS_NAME_ACTIVE)\n this._activateParents(target)\n\n EventHandler.trigger(this._element, EVENT_ACTIVATE, { relatedTarget: target })\n }\n\n _activateParents(target) {\n // Activate dropdown parents\n if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {\n SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE, target.closest(SELECTOR_DROPDOWN))\n .classList.add(CLASS_NAME_ACTIVE)\n return\n }\n\n for (const listGroup of SelectorEngine.parents(target, SELECTOR_NAV_LIST_GROUP)) {\n // Set triggered links parents as active\n // With both and markup a parent is the previous sibling of any nav ancestor\n for (const item of SelectorEngine.prev(listGroup, SELECTOR_LINK_ITEMS)) {\n item.classList.add(CLASS_NAME_ACTIVE)\n }\n }\n }\n\n _clearActiveClass(parent) {\n parent.classList.remove(CLASS_NAME_ACTIVE)\n\n const activeNodes = SelectorEngine.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE}`, parent)\n for (const node of activeNodes) {\n node.classList.remove(CLASS_NAME_ACTIVE)\n }\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = ScrollSpy.getOrCreateInstance(this, config)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(window, EVENT_LOAD_DATA_API, () => {\n for (const spy of SelectorEngine.find(SELECTOR_DATA_SPY)) {\n ScrollSpy.getOrCreateInstance(spy)\n }\n})\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(ScrollSpy)\n\nexport default ScrollSpy\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap tab.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport SelectorEngine from './dom/selector-engine.js'\nimport { defineJQueryPlugin, getNextActiveElement, isDisabled } from './util/index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'tab'\nconst DATA_KEY = 'bs.tab'\nconst EVENT_KEY = `.${DATA_KEY}`\n\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\nconst EVENT_CLICK_DATA_API = `click${EVENT_KEY}`\nconst EVENT_KEYDOWN = `keydown${EVENT_KEY}`\nconst EVENT_LOAD_DATA_API = `load${EVENT_KEY}`\n\nconst ARROW_LEFT_KEY = 'ArrowLeft'\nconst ARROW_RIGHT_KEY = 'ArrowRight'\nconst ARROW_UP_KEY = 'ArrowUp'\nconst ARROW_DOWN_KEY = 'ArrowDown'\nconst HOME_KEY = 'Home'\nconst END_KEY = 'End'\n\nconst CLASS_NAME_ACTIVE = 'active'\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_DROPDOWN = 'dropdown'\n\nconst SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'\nconst SELECTOR_DROPDOWN_MENU = '.dropdown-menu'\nconst NOT_SELECTOR_DROPDOWN_TOGGLE = `:not(${SELECTOR_DROPDOWN_TOGGLE})`\n\nconst SELECTOR_TAB_PANEL = '.list-group, .nav, [role=\"tablist\"]'\nconst SELECTOR_OUTER = '.nav-item, .list-group-item'\nconst SELECTOR_INNER = `.nav-link${NOT_SELECTOR_DROPDOWN_TOGGLE}, .list-group-item${NOT_SELECTOR_DROPDOWN_TOGGLE}, [role=\"tab\"]${NOT_SELECTOR_DROPDOWN_TOGGLE}`\nconst SELECTOR_DATA_TOGGLE = '[data-bs-toggle=\"tab\"], [data-bs-toggle=\"pill\"], [data-bs-toggle=\"list\"]' // TODO: could only be `tab` in v6\nconst SELECTOR_INNER_ELEM = `${SELECTOR_INNER}, ${SELECTOR_DATA_TOGGLE}`\n\nconst SELECTOR_DATA_TOGGLE_ACTIVE = `.${CLASS_NAME_ACTIVE}[data-bs-toggle=\"tab\"], .${CLASS_NAME_ACTIVE}[data-bs-toggle=\"pill\"], .${CLASS_NAME_ACTIVE}[data-bs-toggle=\"list\"]`\n\n/**\n * Class definition\n */\n\nclass Tab extends BaseComponent {\n constructor(element) {\n super(element)\n this._parent = this._element.closest(SELECTOR_TAB_PANEL)\n\n if (!this._parent) {\n return\n // TODO: should throw exception in v6\n // throw new TypeError(`${element.outerHTML} has not a valid parent ${SELECTOR_INNER_ELEM}`)\n }\n\n // Set up initial aria attributes\n this._setInitialAttributes(this._parent, this._getChildren())\n\n EventHandler.on(this._element, EVENT_KEYDOWN, event => this._keydown(event))\n }\n\n // Getters\n static get NAME() {\n return NAME\n }\n\n // Public\n show() { // Shows this elem and deactivate the active sibling if exists\n const innerElem = this._element\n if (this._elemIsActive(innerElem)) {\n return\n }\n\n // Search for active tab on same parent to deactivate it\n const active = this._getActiveElem()\n\n const hideEvent = active ?\n EventHandler.trigger(active, EVENT_HIDE, { relatedTarget: innerElem }) :\n null\n\n const showEvent = EventHandler.trigger(innerElem, EVENT_SHOW, { relatedTarget: active })\n\n if (showEvent.defaultPrevented || (hideEvent && hideEvent.defaultPrevented)) {\n return\n }\n\n this._deactivate(active, innerElem)\n this._activate(innerElem, active)\n }\n\n // Private\n _activate(element, relatedElem) {\n if (!element) {\n return\n }\n\n element.classList.add(CLASS_NAME_ACTIVE)\n\n this._activate(SelectorEngine.getElementFromSelector(element)) // Search and activate/show the proper section\n\n const complete = () => {\n if (element.getAttribute('role') !== 'tab') {\n element.classList.add(CLASS_NAME_SHOW)\n return\n }\n\n element.removeAttribute('tabindex')\n element.setAttribute('aria-selected', true)\n this._toggleDropDown(element, true)\n EventHandler.trigger(element, EVENT_SHOWN, {\n relatedTarget: relatedElem\n })\n }\n\n this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE))\n }\n\n _deactivate(element, relatedElem) {\n if (!element) {\n return\n }\n\n element.classList.remove(CLASS_NAME_ACTIVE)\n element.blur()\n\n this._deactivate(SelectorEngine.getElementFromSelector(element)) // Search and deactivate the shown section too\n\n const complete = () => {\n if (element.getAttribute('role') !== 'tab') {\n element.classList.remove(CLASS_NAME_SHOW)\n return\n }\n\n element.setAttribute('aria-selected', false)\n element.setAttribute('tabindex', '-1')\n this._toggleDropDown(element, false)\n EventHandler.trigger(element, EVENT_HIDDEN, { relatedTarget: relatedElem })\n }\n\n this._queueCallback(complete, element, element.classList.contains(CLASS_NAME_FADE))\n }\n\n _keydown(event) {\n if (!([ARROW_LEFT_KEY, ARROW_RIGHT_KEY, ARROW_UP_KEY, ARROW_DOWN_KEY, HOME_KEY, END_KEY].includes(event.key))) {\n return\n }\n\n event.stopPropagation()// stopPropagation/preventDefault both added to support up/down keys without scrolling the page\n event.preventDefault()\n\n const children = this._getChildren().filter(element => !isDisabled(element))\n let nextActiveElement\n\n if ([HOME_KEY, END_KEY].includes(event.key)) {\n nextActiveElement = children[event.key === HOME_KEY ? 0 : children.length - 1]\n } else {\n const isNext = [ARROW_RIGHT_KEY, ARROW_DOWN_KEY].includes(event.key)\n nextActiveElement = getNextActiveElement(children, event.target, isNext, true)\n }\n\n if (nextActiveElement) {\n nextActiveElement.focus({ preventScroll: true })\n Tab.getOrCreateInstance(nextActiveElement).show()\n }\n }\n\n _getChildren() { // collection of inner elements\n return SelectorEngine.find(SELECTOR_INNER_ELEM, this._parent)\n }\n\n _getActiveElem() {\n return this._getChildren().find(child => this._elemIsActive(child)) || null\n }\n\n _setInitialAttributes(parent, children) {\n this._setAttributeIfNotExists(parent, 'role', 'tablist')\n\n for (const child of children) {\n this._setInitialAttributesOnChild(child)\n }\n }\n\n _setInitialAttributesOnChild(child) {\n child = this._getInnerElement(child)\n const isActive = this._elemIsActive(child)\n const outerElem = this._getOuterElement(child)\n child.setAttribute('aria-selected', isActive)\n\n if (outerElem !== child) {\n this._setAttributeIfNotExists(outerElem, 'role', 'presentation')\n }\n\n if (!isActive) {\n child.setAttribute('tabindex', '-1')\n }\n\n this._setAttributeIfNotExists(child, 'role', 'tab')\n\n // set attributes to the related panel too\n this._setInitialAttributesOnTargetPanel(child)\n }\n\n _setInitialAttributesOnTargetPanel(child) {\n const target = SelectorEngine.getElementFromSelector(child)\n\n if (!target) {\n return\n }\n\n this._setAttributeIfNotExists(target, 'role', 'tabpanel')\n\n if (child.id) {\n this._setAttributeIfNotExists(target, 'aria-labelledby', `${child.id}`)\n }\n }\n\n _toggleDropDown(element, open) {\n const outerElem = this._getOuterElement(element)\n if (!outerElem.classList.contains(CLASS_DROPDOWN)) {\n return\n }\n\n const toggle = (selector, className) => {\n const element = SelectorEngine.findOne(selector, outerElem)\n if (element) {\n element.classList.toggle(className, open)\n }\n }\n\n toggle(SELECTOR_DROPDOWN_TOGGLE, CLASS_NAME_ACTIVE)\n toggle(SELECTOR_DROPDOWN_MENU, CLASS_NAME_SHOW)\n outerElem.setAttribute('aria-expanded', open)\n }\n\n _setAttributeIfNotExists(element, attribute, value) {\n if (!element.hasAttribute(attribute)) {\n element.setAttribute(attribute, value)\n }\n }\n\n _elemIsActive(elem) {\n return elem.classList.contains(CLASS_NAME_ACTIVE)\n }\n\n // Try to get the inner element (usually the .nav-link)\n _getInnerElement(elem) {\n return elem.matches(SELECTOR_INNER_ELEM) ? elem : SelectorEngine.findOne(SELECTOR_INNER_ELEM, elem)\n }\n\n // Try to get the outer element (usually the .nav-item)\n _getOuterElement(elem) {\n return elem.closest(SELECTOR_OUTER) || elem\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Tab.getOrCreateInstance(this)\n\n if (typeof config !== 'string') {\n return\n }\n\n if (data[config] === undefined || config.startsWith('_') || config === 'constructor') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config]()\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nEventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {\n if (['A', 'AREA'].includes(this.tagName)) {\n event.preventDefault()\n }\n\n if (isDisabled(this)) {\n return\n }\n\n Tab.getOrCreateInstance(this).show()\n})\n\n/**\n * Initialize on focus\n */\nEventHandler.on(window, EVENT_LOAD_DATA_API, () => {\n for (const element of SelectorEngine.find(SELECTOR_DATA_TOGGLE_ACTIVE)) {\n Tab.getOrCreateInstance(element)\n }\n})\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Tab)\n\nexport default Tab\n", "/**\n * --------------------------------------------------------------------------\n * Bootstrap toast.js\n * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)\n * --------------------------------------------------------------------------\n */\n\nimport BaseComponent from './base-component.js'\nimport EventHandler from './dom/event-handler.js'\nimport { enableDismissTrigger } from './util/component-functions.js'\nimport { defineJQueryPlugin, reflow } from './util/index.js'\n\n/**\n * Constants\n */\n\nconst NAME = 'toast'\nconst DATA_KEY = 'bs.toast'\nconst EVENT_KEY = `.${DATA_KEY}`\n\nconst EVENT_MOUSEOVER = `mouseover${EVENT_KEY}`\nconst EVENT_MOUSEOUT = `mouseout${EVENT_KEY}`\nconst EVENT_FOCUSIN = `focusin${EVENT_KEY}`\nconst EVENT_FOCUSOUT = `focusout${EVENT_KEY}`\nconst EVENT_HIDE = `hide${EVENT_KEY}`\nconst EVENT_HIDDEN = `hidden${EVENT_KEY}`\nconst EVENT_SHOW = `show${EVENT_KEY}`\nconst EVENT_SHOWN = `shown${EVENT_KEY}`\n\nconst CLASS_NAME_FADE = 'fade'\nconst CLASS_NAME_HIDE = 'hide' // @deprecated - kept here only for backwards compatibility\nconst CLASS_NAME_SHOW = 'show'\nconst CLASS_NAME_SHOWING = 'showing'\n\nconst DefaultType = {\n animation: 'boolean',\n autohide: 'boolean',\n delay: 'number'\n}\n\nconst Default = {\n animation: true,\n autohide: true,\n delay: 5000\n}\n\n/**\n * Class definition\n */\n\nclass Toast extends BaseComponent {\n constructor(element, config) {\n super(element, config)\n\n this._timeout = null\n this._hasMouseInteraction = false\n this._hasKeyboardInteraction = false\n this._setListeners()\n }\n\n // Getters\n static get Default() {\n return Default\n }\n\n static get DefaultType() {\n return DefaultType\n }\n\n static get NAME() {\n return NAME\n }\n\n // Public\n show() {\n const showEvent = EventHandler.trigger(this._element, EVENT_SHOW)\n\n if (showEvent.defaultPrevented) {\n return\n }\n\n this._clearTimeout()\n\n if (this._config.animation) {\n this._element.classList.add(CLASS_NAME_FADE)\n }\n\n const complete = () => {\n this._element.classList.remove(CLASS_NAME_SHOWING)\n EventHandler.trigger(this._element, EVENT_SHOWN)\n\n this._maybeScheduleHide()\n }\n\n this._element.classList.remove(CLASS_NAME_HIDE) // @deprecated\n reflow(this._element)\n this._element.classList.add(CLASS_NAME_SHOW, CLASS_NAME_SHOWING)\n\n this._queueCallback(complete, this._element, this._config.animation)\n }\n\n hide() {\n if (!this.isShown()) {\n return\n }\n\n const hideEvent = EventHandler.trigger(this._element, EVENT_HIDE)\n\n if (hideEvent.defaultPrevented) {\n return\n }\n\n const complete = () => {\n this._element.classList.add(CLASS_NAME_HIDE) // @deprecated\n this._element.classList.remove(CLASS_NAME_SHOWING, CLASS_NAME_SHOW)\n EventHandler.trigger(this._element, EVENT_HIDDEN)\n }\n\n this._element.classList.add(CLASS_NAME_SHOWING)\n this._queueCallback(complete, this._element, this._config.animation)\n }\n\n dispose() {\n this._clearTimeout()\n\n if (this.isShown()) {\n this._element.classList.remove(CLASS_NAME_SHOW)\n }\n\n super.dispose()\n }\n\n isShown() {\n return this._element.classList.contains(CLASS_NAME_SHOW)\n }\n\n // Private\n\n _maybeScheduleHide() {\n if (!this._config.autohide) {\n return\n }\n\n if (this._hasMouseInteraction || this._hasKeyboardInteraction) {\n return\n }\n\n this._timeout = setTimeout(() => {\n this.hide()\n }, this._config.delay)\n }\n\n _onInteraction(event, isInteracting) {\n switch (event.type) {\n case 'mouseover':\n case 'mouseout': {\n this._hasMouseInteraction = isInteracting\n break\n }\n\n case 'focusin':\n case 'focusout': {\n this._hasKeyboardInteraction = isInteracting\n break\n }\n\n default: {\n break\n }\n }\n\n if (isInteracting) {\n this._clearTimeout()\n return\n }\n\n const nextElement = event.relatedTarget\n if (this._element === nextElement || this._element.contains(nextElement)) {\n return\n }\n\n this._maybeScheduleHide()\n }\n\n _setListeners() {\n EventHandler.on(this._element, EVENT_MOUSEOVER, event => this._onInteraction(event, true))\n EventHandler.on(this._element, EVENT_MOUSEOUT, event => this._onInteraction(event, false))\n EventHandler.on(this._element, EVENT_FOCUSIN, event => this._onInteraction(event, true))\n EventHandler.on(this._element, EVENT_FOCUSOUT, event => this._onInteraction(event, false))\n }\n\n _clearTimeout() {\n clearTimeout(this._timeout)\n this._timeout = null\n }\n\n // Static\n static jQueryInterface(config) {\n return this.each(function () {\n const data = Toast.getOrCreateInstance(this, config)\n\n if (typeof config === 'string') {\n if (typeof data[config] === 'undefined') {\n throw new TypeError(`No method named \"${config}\"`)\n }\n\n data[config](this)\n }\n })\n }\n}\n\n/**\n * Data API implementation\n */\n\nenableDismissTrigger(Toast)\n\n/**\n * jQuery\n */\n\ndefineJQueryPlugin(Toast)\n\nexport default Toast\n", "var htmx = (function() {\n 'use strict'\n\n // Public API\n const htmx = {\n // Tsc madness here, assigning the functions directly results in an invalid TypeScript output, but reassigning is fine\n /* Event processing */\n /** @type {typeof onLoadHelper} */\n onLoad: null,\n /** @type {typeof processNode} */\n process: null,\n /** @type {typeof addEventListenerImpl} */\n on: null,\n /** @type {typeof removeEventListenerImpl} */\n off: null,\n /** @type {typeof triggerEvent} */\n trigger: null,\n /** @type {typeof ajaxHelper} */\n ajax: null,\n /* DOM querying helpers */\n /** @type {typeof find} */\n find: null,\n /** @type {typeof findAll} */\n findAll: null,\n /** @type {typeof closest} */\n closest: null,\n /**\n * Returns the input values that would resolve for a given element via the htmx value resolution mechanism\n *\n * @see https://htmx.org/api/#values\n *\n * @param {Element} elt the element to resolve values on\n * @param {HttpVerb} type the request type (e.g. **get** or **post**) non-GET's will include the enclosing form of the element. Defaults to **post**\n * @returns {Object}\n */\n values: function(elt, type) {\n const inputValues = getInputValues(elt, type || 'post')\n return inputValues.values\n },\n /* DOM manipulation helpers */\n /** @type {typeof removeElement} */\n remove: null,\n /** @type {typeof addClassToElement} */\n addClass: null,\n /** @type {typeof removeClassFromElement} */\n removeClass: null,\n /** @type {typeof toggleClassOnElement} */\n toggleClass: null,\n /** @type {typeof takeClassForElement} */\n takeClass: null,\n /** @type {typeof swap} */\n swap: null,\n /* Extension entrypoints */\n /** @type {typeof defineExtension} */\n defineExtension: null,\n /** @type {typeof removeExtension} */\n removeExtension: null,\n /* Debugging */\n /** @type {typeof logAll} */\n logAll: null,\n /** @type {typeof logNone} */\n logNone: null,\n /* Debugging */\n /**\n * The logger htmx uses to log with\n *\n * @see https://htmx.org/api/#logger\n */\n logger: null,\n /**\n * A property holding the configuration htmx uses at runtime.\n *\n * Note that using a [meta tag](https://htmx.org/docs/#config) is the preferred mechanism for setting these properties.\n *\n * @see https://htmx.org/api/#config\n */\n config: {\n /**\n * Whether to use history.\n * @type boolean\n * @default true\n */\n historyEnabled: true,\n /**\n * The number of pages to keep in **localStorage** for history support.\n * @type number\n * @default 10\n */\n historyCacheSize: 10,\n /**\n * @type boolean\n * @default false\n */\n refreshOnHistoryMiss: false,\n /**\n * The default swap style to use if **[hx-swap](https://htmx.org/attributes/hx-swap)** is omitted.\n * @type HtmxSwapStyle\n * @default 'innerHTML'\n */\n defaultSwapStyle: 'innerHTML',\n /**\n * The default delay between receiving a response from the server and doing the swap.\n * @type number\n * @default 0\n */\n defaultSwapDelay: 0,\n /**\n * The default delay between completing the content swap and settling attributes.\n * @type number\n * @default 20\n */\n defaultSettleDelay: 20,\n /**\n * If true, htmx will inject a small amount of CSS into the page to make indicators invisible unless the **htmx-indicator** class is present.\n * @type boolean\n * @default true\n */\n includeIndicatorStyles: true,\n /**\n * The class to place on indicators when a request is in flight.\n * @type string\n * @default 'htmx-indicator'\n */\n indicatorClass: 'htmx-indicator',\n /**\n * The class to place on triggering elements when a request is in flight.\n * @type string\n * @default 'htmx-request'\n */\n requestClass: 'htmx-request',\n /**\n * The class to temporarily place on elements that htmx has added to the DOM.\n * @type string\n * @default 'htmx-added'\n */\n addedClass: 'htmx-added',\n /**\n * The class to place on target elements when htmx is in the settling phase.\n * @type string\n * @default 'htmx-settling'\n */\n settlingClass: 'htmx-settling',\n /**\n * The class to place on target elements when htmx is in the swapping phase.\n * @type string\n * @default 'htmx-swapping'\n */\n swappingClass: 'htmx-swapping',\n /**\n * Allows the use of eval-like functionality in htmx, to enable **hx-vars**, trigger conditions & script tag evaluation. Can be set to **false** for CSP compatibility.\n * @type boolean\n * @default true\n */\n allowEval: true,\n /**\n * If set to false, disables the interpretation of script tags.\n * @type boolean\n * @default true\n */\n allowScriptTags: true,\n /**\n * If set, the nonce will be added to inline scripts.\n * @type string\n * @default ''\n */\n inlineScriptNonce: '',\n /**\n * If set, the nonce will be added to inline styles.\n * @type string\n * @default ''\n */\n inlineStyleNonce: '',\n /**\n * The attributes to settle during the settling phase.\n * @type string[]\n * @default ['class', 'style', 'width', 'height']\n */\n attributesToSettle: ['class', 'style', 'width', 'height'],\n /**\n * Allow cross-site Access-Control requests using credentials such as cookies, authorization headers or TLS client certificates.\n * @type boolean\n * @default false\n */\n withCredentials: false,\n /**\n * @type number\n * @default 0\n */\n timeout: 0,\n /**\n * The default implementation of **getWebSocketReconnectDelay** for reconnecting after unexpected connection loss by the event code **Abnormal Closure**, **Service Restart** or **Try Again Later**.\n * @type {'full-jitter' | ((retryCount:number) => number)}\n * @default \"full-jitter\"\n */\n wsReconnectDelay: 'full-jitter',\n /**\n * The type of binary data being received over the WebSocket connection\n * @type BinaryType\n * @default 'blob'\n */\n wsBinaryType: 'blob',\n /**\n * @type string\n * @default '[hx-disable], [data-hx-disable]'\n */\n disableSelector: '[hx-disable], [data-hx-disable]',\n /**\n * @type {'auto' | 'instant' | 'smooth'}\n * @default 'instant'\n */\n scrollBehavior: 'instant',\n /**\n * If the focused element should be scrolled into view.\n * @type boolean\n * @default false\n */\n defaultFocusScroll: false,\n /**\n * If set to true htmx will include a cache-busting parameter in GET requests to avoid caching partial responses by the browser\n * @type boolean\n * @default false\n */\n getCacheBusterParam: false,\n /**\n * If set to true, htmx will use the View Transition API when swapping in new content.\n * @type boolean\n * @default false\n */\n globalViewTransitions: false,\n /**\n * htmx will format requests with these methods by encoding their parameters in the URL, not the request body\n * @type {(HttpVerb)[]}\n * @default ['get', 'delete']\n */\n methodsThatUseUrlParams: ['get', 'delete'],\n /**\n * If set to true, disables htmx-based requests to non-origin hosts.\n * @type boolean\n * @default false\n */\n selfRequestsOnly: true,\n /**\n * If set to true htmx will not update the title of the document when a title tag is found in new content\n * @type boolean\n * @default false\n */\n ignoreTitle: false,\n /**\n * Whether the target of a boosted element is scrolled into the viewport.\n * @type boolean\n * @default true\n */\n scrollIntoViewOnBoost: true,\n /**\n * The cache to store evaluated trigger specifications into.\n * You may define a simple object to use a never-clearing cache, or implement your own system using a [proxy object](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Proxy)\n * @type {Object|null}\n * @default null\n */\n triggerSpecsCache: null,\n /** @type boolean */\n disableInheritance: false,\n /** @type HtmxResponseHandlingConfig[] */\n responseHandling: [\n { code: '204', swap: false },\n { code: '[23]..', swap: true },\n { code: '[45]..', swap: false, error: true }\n ],\n /**\n * Whether to process OOB swaps on elements that are nested within the main response element.\n * @type boolean\n * @default true\n */\n allowNestedOobSwaps: true\n },\n /** @type {typeof parseInterval} */\n parseInterval: null,\n /** @type {typeof internalEval} */\n _: null,\n version: '2.0.4'\n }\n // Tsc madness part 2\n htmx.onLoad = onLoadHelper\n htmx.process = processNode\n htmx.on = addEventListenerImpl\n htmx.off = removeEventListenerImpl\n htmx.trigger = triggerEvent\n htmx.ajax = ajaxHelper\n htmx.find = find\n htmx.findAll = findAll\n htmx.closest = closest\n htmx.remove = removeElement\n htmx.addClass = addClassToElement\n htmx.removeClass = removeClassFromElement\n htmx.toggleClass = toggleClassOnElement\n htmx.takeClass = takeClassForElement\n htmx.swap = swap\n htmx.defineExtension = defineExtension\n htmx.removeExtension = removeExtension\n htmx.logAll = logAll\n htmx.logNone = logNone\n htmx.parseInterval = parseInterval\n htmx._ = internalEval\n\n const internalAPI = {\n addTriggerHandler,\n bodyContains,\n canAccessLocalStorage,\n findThisElement,\n filterValues,\n swap,\n hasAttribute,\n getAttributeValue,\n getClosestAttributeValue,\n getClosestMatch,\n getExpressionVars,\n getHeaders,\n getInputValues,\n getInternalData,\n getSwapSpecification,\n getTriggerSpecs,\n getTarget,\n makeFragment,\n mergeObjects,\n makeSettleInfo,\n oobSwap,\n querySelectorExt,\n settleImmediately,\n shouldCancel,\n triggerEvent,\n triggerErrorEvent,\n withExtensions\n }\n\n const VERBS = ['get', 'post', 'put', 'delete', 'patch']\n const VERB_SELECTOR = VERBS.map(function(verb) {\n return '[hx-' + verb + '], [data-hx-' + verb + ']'\n }).join(', ')\n\n //= ===================================================================\n // Utilities\n //= ===================================================================\n\n /**\n * Parses an interval string consistent with the way htmx does. Useful for plugins that have timing-related attributes.\n *\n * Caution: Accepts an int followed by either **s** or **ms**. All other values use **parseFloat**\n *\n * @see https://htmx.org/api/#parseInterval\n *\n * @param {string} str timing string\n * @returns {number|undefined}\n */\n function parseInterval(str) {\n if (str == undefined) {\n return undefined\n }\n\n let interval = NaN\n if (str.slice(-2) == 'ms') {\n interval = parseFloat(str.slice(0, -2))\n } else if (str.slice(-1) == 's') {\n interval = parseFloat(str.slice(0, -1)) * 1000\n } else if (str.slice(-1) == 'm') {\n interval = parseFloat(str.slice(0, -1)) * 1000 * 60\n } else {\n interval = parseFloat(str)\n }\n return isNaN(interval) ? undefined : interval\n }\n\n /**\n * @param {Node} elt\n * @param {string} name\n * @returns {(string | null)}\n */\n function getRawAttribute(elt, name) {\n return elt instanceof Element && elt.getAttribute(name)\n }\n\n /**\n * @param {Element} elt\n * @param {string} qualifiedName\n * @returns {boolean}\n */\n // resolve with both hx and data-hx prefixes\n function hasAttribute(elt, qualifiedName) {\n return !!elt.hasAttribute && (elt.hasAttribute(qualifiedName) ||\n elt.hasAttribute('data-' + qualifiedName))\n }\n\n /**\n *\n * @param {Node} elt\n * @param {string} qualifiedName\n * @returns {(string | null)}\n */\n function getAttributeValue(elt, qualifiedName) {\n return getRawAttribute(elt, qualifiedName) || getRawAttribute(elt, 'data-' + qualifiedName)\n }\n\n /**\n * @param {Node} elt\n * @returns {Node | null}\n */\n function parentElt(elt) {\n const parent = elt.parentElement\n if (!parent && elt.parentNode instanceof ShadowRoot) return elt.parentNode\n return parent\n }\n\n /**\n * @returns {Document}\n */\n function getDocument() {\n return document\n }\n\n /**\n * @param {Node} elt\n * @param {boolean} global\n * @returns {Node|Document}\n */\n function getRootNode(elt, global) {\n return elt.getRootNode ? elt.getRootNode({ composed: global }) : getDocument()\n }\n\n /**\n * @param {Node} elt\n * @param {(e:Node) => boolean} condition\n * @returns {Node | null}\n */\n function getClosestMatch(elt, condition) {\n while (elt && !condition(elt)) {\n elt = parentElt(elt)\n }\n\n return elt || null\n }\n\n /**\n * @param {Element} initialElement\n * @param {Element} ancestor\n * @param {string} attributeName\n * @returns {string|null}\n */\n function getAttributeValueWithDisinheritance(initialElement, ancestor, attributeName) {\n const attributeValue = getAttributeValue(ancestor, attributeName)\n const disinherit = getAttributeValue(ancestor, 'hx-disinherit')\n var inherit = getAttributeValue(ancestor, 'hx-inherit')\n if (initialElement !== ancestor) {\n if (htmx.config.disableInheritance) {\n if (inherit && (inherit === '*' || inherit.split(' ').indexOf(attributeName) >= 0)) {\n return attributeValue\n } else {\n return null\n }\n }\n if (disinherit && (disinherit === '*' || disinherit.split(' ').indexOf(attributeName) >= 0)) {\n return 'unset'\n }\n }\n return attributeValue\n }\n\n /**\n * @param {Element} elt\n * @param {string} attributeName\n * @returns {string | null}\n */\n function getClosestAttributeValue(elt, attributeName) {\n let closestAttr = null\n getClosestMatch(elt, function(e) {\n return !!(closestAttr = getAttributeValueWithDisinheritance(elt, asElement(e), attributeName))\n })\n if (closestAttr !== 'unset') {\n return closestAttr\n }\n }\n\n /**\n * @param {Node} elt\n * @param {string} selector\n * @returns {boolean}\n */\n function matches(elt, selector) {\n // @ts-ignore: non-standard properties for browser compatibility\n // noinspection JSUnresolvedVariable\n const matchesFunction = elt instanceof Element && (elt.matches || elt.matchesSelector || elt.msMatchesSelector || elt.mozMatchesSelector || elt.webkitMatchesSelector || elt.oMatchesSelector)\n return !!matchesFunction && matchesFunction.call(elt, selector)\n }\n\n /**\n * @param {string} str\n * @returns {string}\n */\n function getStartTag(str) {\n const tagMatcher = /<([a-z][^\\/\\0>\\x20\\t\\r\\n\\f]*)/i\n const match = tagMatcher.exec(str)\n if (match) {\n return match[1].toLowerCase()\n } else {\n return ''\n }\n }\n\n /**\n * @param {string} resp\n * @returns {Document}\n */\n function parseHTML(resp) {\n const parser = new DOMParser()\n return parser.parseFromString(resp, 'text/html')\n }\n\n /**\n * @param {DocumentFragment} fragment\n * @param {Node} elt\n */\n function takeChildrenFor(fragment, elt) {\n while (elt.childNodes.length > 0) {\n fragment.append(elt.childNodes[0])\n }\n }\n\n /**\n * @param {HTMLScriptElement} script\n * @returns {HTMLScriptElement}\n */\n function duplicateScript(script) {\n const newScript = getDocument().createElement('script')\n forEach(script.attributes, function(attr) {\n newScript.setAttribute(attr.name, attr.value)\n })\n newScript.textContent = script.textContent\n newScript.async = false\n if (htmx.config.inlineScriptNonce) {\n newScript.nonce = htmx.config.inlineScriptNonce\n }\n return newScript\n }\n\n /**\n * @param {HTMLScriptElement} script\n * @returns {boolean}\n */\n function isJavaScriptScriptNode(script) {\n return script.matches('script') && (script.type === 'text/javascript' || script.type === 'module' || script.type === '')\n }\n\n /**\n * we have to make new copies of script tags that we are going to insert because\n * SOME browsers (not saying who, but it involves an element and an animal) don't\n * execute scripts created in tags when they are inserted into the DOM\n * and all the others do lmao\n * @param {DocumentFragment} fragment\n */\n function normalizeScriptTags(fragment) {\n Array.from(fragment.querySelectorAll('script')).forEach(/** @param {HTMLScriptElement} script */ (script) => {\n if (isJavaScriptScriptNode(script)) {\n const newScript = duplicateScript(script)\n const parent = script.parentNode\n try {\n parent.insertBefore(newScript, script)\n } catch (e) {\n logError(e)\n } finally {\n script.remove()\n }\n }\n })\n }\n\n /**\n * @typedef {DocumentFragment & {title?: string}} DocumentFragmentWithTitle\n * @description a document fragment representing the response HTML, including\n * a `title` property for any title information found\n */\n\n /**\n * @param {string} response HTML\n * @returns {DocumentFragmentWithTitle}\n */\n function makeFragment(response) {\n // strip head tag to determine shape of response we are dealing with\n const responseWithNoHead = response.replace(/]*)?>[\\s\\S]*?<\\/head>/i, '')\n const startTag = getStartTag(responseWithNoHead)\n /** @type DocumentFragmentWithTitle */\n let fragment\n if (startTag === 'html') {\n // if it is a full document, parse it and return the body\n fragment = /** @type DocumentFragmentWithTitle */ (new DocumentFragment())\n const doc = parseHTML(response)\n takeChildrenFor(fragment, doc.body)\n fragment.title = doc.title\n } else if (startTag === 'body') {\n // parse body w/o wrapping in template\n fragment = /** @type DocumentFragmentWithTitle */ (new DocumentFragment())\n const doc = parseHTML(responseWithNoHead)\n takeChildrenFor(fragment, doc.body)\n fragment.title = doc.title\n } else {\n // otherwise we have non-body partial HTML content, so wrap it in a template to maximize parsing flexibility\n const doc = parseHTML('' + responseWithNoHead + ' ')\n fragment = /** @type DocumentFragmentWithTitle */ (doc.querySelector('template').content)\n // extract title into fragment for later processing\n fragment.title = doc.title\n\n // for legacy reasons we support a title tag at the root level of non-body responses, so we need to handle it\n var titleElement = fragment.querySelector('title')\n if (titleElement && titleElement.parentNode === fragment) {\n titleElement.remove()\n fragment.title = titleElement.innerText\n }\n }\n if (fragment) {\n if (htmx.config.allowScriptTags) {\n normalizeScriptTags(fragment)\n } else {\n // remove all script tags if scripts are disabled\n fragment.querySelectorAll('script').forEach((script) => script.remove())\n }\n }\n return fragment\n }\n\n /**\n * @param {Function} func\n */\n function maybeCall(func) {\n if (func) {\n func()\n }\n }\n\n /**\n * @param {any} o\n * @param {string} type\n * @returns\n */\n function isType(o, type) {\n return Object.prototype.toString.call(o) === '[object ' + type + ']'\n }\n\n /**\n * @param {*} o\n * @returns {o is Function}\n */\n function isFunction(o) {\n return typeof o === 'function'\n }\n\n /**\n * @param {*} o\n * @returns {o is Object}\n */\n function isRawObject(o) {\n return isType(o, 'Object')\n }\n\n /**\n * @typedef {Object} OnHandler\n * @property {(keyof HTMLElementEventMap)|string} event\n * @property {EventListener} listener\n */\n\n /**\n * @typedef {Object} ListenerInfo\n * @property {string} trigger\n * @property {EventListener} listener\n * @property {EventTarget} on\n */\n\n /**\n * @typedef {Object} HtmxNodeInternalData\n * Element data\n * @property {number} [initHash]\n * @property {boolean} [boosted]\n * @property {OnHandler[]} [onHandlers]\n * @property {number} [timeout]\n * @property {ListenerInfo[]} [listenerInfos]\n * @property {boolean} [cancelled]\n * @property {boolean} [triggeredOnce]\n * @property {number} [delayed]\n * @property {number|null} [throttle]\n * @property {WeakMap>} [lastValue]\n * @property {boolean} [loaded]\n * @property {string} [path]\n * @property {string} [verb]\n * @property {boolean} [polling]\n * @property {HTMLButtonElement|HTMLInputElement|null} [lastButtonClicked]\n * @property {number} [requestCount]\n * @property {XMLHttpRequest} [xhr]\n * @property {(() => void)[]} [queuedRequests]\n * @property {boolean} [abortable]\n * @property {boolean} [firstInitCompleted]\n *\n * Event data\n * @property {HtmxTriggerSpecification} [triggerSpec]\n * @property {EventTarget[]} [handledFor]\n */\n\n /**\n * getInternalData retrieves \"private\" data stored by htmx within an element\n * @param {EventTarget|Event} elt\n * @returns {HtmxNodeInternalData}\n */\n function getInternalData(elt) {\n const dataProp = 'htmx-internal-data'\n let data = elt[dataProp]\n if (!data) {\n data = elt[dataProp] = {}\n }\n return data\n }\n\n /**\n * toArray converts an ArrayLike object into a real array.\n * @template T\n * @param {ArrayLike} arr\n * @returns {T[]}\n */\n function toArray(arr) {\n const returnArr = []\n if (arr) {\n for (let i = 0; i < arr.length; i++) {\n returnArr.push(arr[i])\n }\n }\n return returnArr\n }\n\n /**\n * @template T\n * @param {T[]|NamedNodeMap|HTMLCollection|HTMLFormControlsCollection|ArrayLike} arr\n * @param {(T) => void} func\n */\n function forEach(arr, func) {\n if (arr) {\n for (let i = 0; i < arr.length; i++) {\n func(arr[i])\n }\n }\n }\n\n /**\n * @param {Element} el\n * @returns {boolean}\n */\n function isScrolledIntoView(el) {\n const rect = el.getBoundingClientRect()\n const elemTop = rect.top\n const elemBottom = rect.bottom\n return elemTop < window.innerHeight && elemBottom >= 0\n }\n\n /**\n * Checks whether the element is in the document (includes shadow roots).\n * This function this is a slight misnomer; it will return true even for elements in the head.\n *\n * @param {Node} elt\n * @returns {boolean}\n */\n function bodyContains(elt) {\n return elt.getRootNode({ composed: true }) === document\n }\n\n /**\n * @param {string} trigger\n * @returns {string[]}\n */\n function splitOnWhitespace(trigger) {\n return trigger.trim().split(/\\s+/)\n }\n\n /**\n * mergeObjects takes all the keys from\n * obj2 and duplicates them into obj1\n * @template T1\n * @template T2\n * @param {T1} obj1\n * @param {T2} obj2\n * @returns {T1 & T2}\n */\n function mergeObjects(obj1, obj2) {\n for (const key in obj2) {\n if (obj2.hasOwnProperty(key)) {\n // @ts-ignore tsc doesn't seem to properly handle types merging\n obj1[key] = obj2[key]\n }\n }\n // @ts-ignore tsc doesn't seem to properly handle types merging\n return obj1\n }\n\n /**\n * @param {string} jString\n * @returns {any|null}\n */\n function parseJSON(jString) {\n try {\n return JSON.parse(jString)\n } catch (error) {\n logError(error)\n return null\n }\n }\n\n /**\n * @returns {boolean}\n */\n function canAccessLocalStorage() {\n const test = 'htmx:localStorageTest'\n try {\n localStorage.setItem(test, test)\n localStorage.removeItem(test)\n return true\n } catch (e) {\n return false\n }\n }\n\n /**\n * @param {string} path\n * @returns {string}\n */\n function normalizePath(path) {\n try {\n const url = new URL(path)\n if (url) {\n path = url.pathname + url.search\n }\n // remove trailing slash, unless index page\n if (!(/^\\/$/.test(path))) {\n path = path.replace(/\\/+$/, '')\n }\n return path\n } catch (e) {\n // be kind to IE11, which doesn't support URL()\n return path\n }\n }\n\n //= =========================================================================================\n // public API\n //= =========================================================================================\n\n /**\n * @param {string} str\n * @returns {any}\n */\n function internalEval(str) {\n return maybeEval(getDocument().body, function() {\n return eval(str)\n })\n }\n\n /**\n * Adds a callback for the **htmx:load** event. This can be used to process new content, for example initializing the content with a javascript library\n *\n * @see https://htmx.org/api/#onLoad\n *\n * @param {(elt: Node) => void} callback the callback to call on newly loaded content\n * @returns {EventListener}\n */\n function onLoadHelper(callback) {\n const value = htmx.on('htmx:load', /** @param {CustomEvent} evt */ function(evt) {\n callback(evt.detail.elt)\n })\n return value\n }\n\n /**\n * Log all htmx events, useful for debugging.\n *\n * @see https://htmx.org/api/#logAll\n */\n function logAll() {\n htmx.logger = function(elt, event, data) {\n if (console) {\n console.log(event, elt, data)\n }\n }\n }\n\n function logNone() {\n htmx.logger = null\n }\n\n /**\n * Finds an element matching the selector\n *\n * @see https://htmx.org/api/#find\n *\n * @param {ParentNode|string} eltOrSelector the root element to find the matching element in, inclusive | the selector to match\n * @param {string} [selector] the selector to match\n * @returns {Element|null}\n */\n function find(eltOrSelector, selector) {\n if (typeof eltOrSelector !== 'string') {\n return eltOrSelector.querySelector(selector)\n } else {\n return find(getDocument(), eltOrSelector)\n }\n }\n\n /**\n * Finds all elements matching the selector\n *\n * @see https://htmx.org/api/#findAll\n *\n * @param {ParentNode|string} eltOrSelector the root element to find the matching elements in, inclusive | the selector to match\n * @param {string} [selector] the selector to match\n * @returns {NodeListOf}\n */\n function findAll(eltOrSelector, selector) {\n if (typeof eltOrSelector !== 'string') {\n return eltOrSelector.querySelectorAll(selector)\n } else {\n return findAll(getDocument(), eltOrSelector)\n }\n }\n\n /**\n * @returns Window\n */\n function getWindow() {\n return window\n }\n\n /**\n * Removes an element from the DOM\n *\n * @see https://htmx.org/api/#remove\n *\n * @param {Node} elt\n * @param {number} [delay]\n */\n function removeElement(elt, delay) {\n elt = resolveTarget(elt)\n if (delay) {\n getWindow().setTimeout(function() {\n removeElement(elt)\n elt = null\n }, delay)\n } else {\n parentElt(elt).removeChild(elt)\n }\n }\n\n /**\n * @param {any} elt\n * @return {Element|null}\n */\n function asElement(elt) {\n return elt instanceof Element ? elt : null\n }\n\n /**\n * @param {any} elt\n * @return {HTMLElement|null}\n */\n function asHtmlElement(elt) {\n return elt instanceof HTMLElement ? elt : null\n }\n\n /**\n * @param {any} value\n * @return {string|null}\n */\n function asString(value) {\n return typeof value === 'string' ? value : null\n }\n\n /**\n * @param {EventTarget} elt\n * @return {ParentNode|null}\n */\n function asParentNode(elt) {\n return elt instanceof Element || elt instanceof Document || elt instanceof DocumentFragment ? elt : null\n }\n\n /**\n * This method adds a class to the given element.\n *\n * @see https://htmx.org/api/#addClass\n *\n * @param {Element|string} elt the element to add the class to\n * @param {string} clazz the class to add\n * @param {number} [delay] the delay (in milliseconds) before class is added\n */\n function addClassToElement(elt, clazz, delay) {\n elt = asElement(resolveTarget(elt))\n if (!elt) {\n return\n }\n if (delay) {\n getWindow().setTimeout(function() {\n addClassToElement(elt, clazz)\n elt = null\n }, delay)\n } else {\n elt.classList && elt.classList.add(clazz)\n }\n }\n\n /**\n * Removes a class from the given element\n *\n * @see https://htmx.org/api/#removeClass\n *\n * @param {Node|string} node element to remove the class from\n * @param {string} clazz the class to remove\n * @param {number} [delay] the delay (in milliseconds before class is removed)\n */\n function removeClassFromElement(node, clazz, delay) {\n let elt = asElement(resolveTarget(node))\n if (!elt) {\n return\n }\n if (delay) {\n getWindow().setTimeout(function() {\n removeClassFromElement(elt, clazz)\n elt = null\n }, delay)\n } else {\n if (elt.classList) {\n elt.classList.remove(clazz)\n // if there are no classes left, remove the class attribute\n if (elt.classList.length === 0) {\n elt.removeAttribute('class')\n }\n }\n }\n }\n\n /**\n * Toggles the given class on an element\n *\n * @see https://htmx.org/api/#toggleClass\n *\n * @param {Element|string} elt the element to toggle the class on\n * @param {string} clazz the class to toggle\n */\n function toggleClassOnElement(elt, clazz) {\n elt = resolveTarget(elt)\n elt.classList.toggle(clazz)\n }\n\n /**\n * Takes the given class from its siblings, so that among its siblings, only the given element will have the class.\n *\n * @see https://htmx.org/api/#takeClass\n *\n * @param {Node|string} elt the element that will take the class\n * @param {string} clazz the class to take\n */\n function takeClassForElement(elt, clazz) {\n elt = resolveTarget(elt)\n forEach(elt.parentElement.children, function(child) {\n removeClassFromElement(child, clazz)\n })\n addClassToElement(asElement(elt), clazz)\n }\n\n /**\n * Finds the closest matching element in the given elements parentage, inclusive of the element\n *\n * @see https://htmx.org/api/#closest\n *\n * @param {Element|string} elt the element to find the selector from\n * @param {string} selector the selector to find\n * @returns {Element|null}\n */\n function closest(elt, selector) {\n elt = asElement(resolveTarget(elt))\n if (elt && elt.closest) {\n return elt.closest(selector)\n } else {\n // TODO remove when IE goes away\n do {\n if (elt == null || matches(elt, selector)) {\n return elt\n }\n }\n while (elt = elt && asElement(parentElt(elt)))\n return null\n }\n }\n\n /**\n * @param {string} str\n * @param {string} prefix\n * @returns {boolean}\n */\n function startsWith(str, prefix) {\n return str.substring(0, prefix.length) === prefix\n }\n\n /**\n * @param {string} str\n * @param {string} suffix\n * @returns {boolean}\n */\n function endsWith(str, suffix) {\n return str.substring(str.length - suffix.length) === suffix\n }\n\n /**\n * @param {string} selector\n * @returns {string}\n */\n function normalizeSelector(selector) {\n const trimmedSelector = selector.trim()\n if (startsWith(trimmedSelector, '<') && endsWith(trimmedSelector, '/>')) {\n return trimmedSelector.substring(1, trimmedSelector.length - 2)\n } else {\n return trimmedSelector\n }\n }\n\n /**\n * @param {Node|Element|Document|string} elt\n * @param {string} selector\n * @param {boolean=} global\n * @returns {(Node|Window)[]}\n */\n function querySelectorAllExt(elt, selector, global) {\n if (selector.indexOf('global ') === 0) {\n return querySelectorAllExt(elt, selector.slice(7), true)\n }\n\n elt = resolveTarget(elt)\n\n const parts = []\n {\n let chevronsCount = 0\n let offset = 0\n for (let i = 0; i < selector.length; i++) {\n const char = selector[i]\n if (char === ',' && chevronsCount === 0) {\n parts.push(selector.substring(offset, i))\n offset = i + 1\n continue\n }\n if (char === '<') {\n chevronsCount++\n } else if (char === '/' && i < selector.length - 1 && selector[i + 1] === '>') {\n chevronsCount--\n }\n }\n if (offset < selector.length) {\n parts.push(selector.substring(offset))\n }\n }\n\n const result = []\n const unprocessedParts = []\n while (parts.length > 0) {\n const selector = normalizeSelector(parts.shift())\n let item\n if (selector.indexOf('closest ') === 0) {\n item = closest(asElement(elt), normalizeSelector(selector.substr(8)))\n } else if (selector.indexOf('find ') === 0) {\n item = find(asParentNode(elt), normalizeSelector(selector.substr(5)))\n } else if (selector === 'next' || selector === 'nextElementSibling') {\n item = asElement(elt).nextElementSibling\n } else if (selector.indexOf('next ') === 0) {\n item = scanForwardQuery(elt, normalizeSelector(selector.substr(5)), !!global)\n } else if (selector === 'previous' || selector === 'previousElementSibling') {\n item = asElement(elt).previousElementSibling\n } else if (selector.indexOf('previous ') === 0) {\n item = scanBackwardsQuery(elt, normalizeSelector(selector.substr(9)), !!global)\n } else if (selector === 'document') {\n item = document\n } else if (selector === 'window') {\n item = window\n } else if (selector === 'body') {\n item = document.body\n } else if (selector === 'root') {\n item = getRootNode(elt, !!global)\n } else if (selector === 'host') {\n item = (/** @type ShadowRoot */(elt.getRootNode())).host\n } else {\n unprocessedParts.push(selector)\n }\n\n if (item) {\n result.push(item)\n }\n }\n\n if (unprocessedParts.length > 0) {\n const standardSelector = unprocessedParts.join(',')\n const rootNode = asParentNode(getRootNode(elt, !!global))\n result.push(...toArray(rootNode.querySelectorAll(standardSelector)))\n }\n\n return result\n }\n\n /**\n * @param {Node} start\n * @param {string} match\n * @param {boolean} global\n * @returns {Element}\n */\n var scanForwardQuery = function(start, match, global) {\n const results = asParentNode(getRootNode(start, global)).querySelectorAll(match)\n for (let i = 0; i < results.length; i++) {\n const elt = results[i]\n if (elt.compareDocumentPosition(start) === Node.DOCUMENT_POSITION_PRECEDING) {\n return elt\n }\n }\n }\n\n /**\n * @param {Node} start\n * @param {string} match\n * @param {boolean} global\n * @returns {Element}\n */\n var scanBackwardsQuery = function(start, match, global) {\n const results = asParentNode(getRootNode(start, global)).querySelectorAll(match)\n for (let i = results.length - 1; i >= 0; i--) {\n const elt = results[i]\n if (elt.compareDocumentPosition(start) === Node.DOCUMENT_POSITION_FOLLOWING) {\n return elt\n }\n }\n }\n\n /**\n * @param {Node|string} eltOrSelector\n * @param {string=} selector\n * @returns {Node|Window}\n */\n function querySelectorExt(eltOrSelector, selector) {\n if (typeof eltOrSelector !== 'string') {\n return querySelectorAllExt(eltOrSelector, selector)[0]\n } else {\n return querySelectorAllExt(getDocument().body, eltOrSelector)[0]\n }\n }\n\n /**\n * @template {EventTarget} T\n * @param {T|string} eltOrSelector\n * @param {T} [context]\n * @returns {Element|T|null}\n */\n function resolveTarget(eltOrSelector, context) {\n if (typeof eltOrSelector === 'string') {\n return find(asParentNode(context) || document, eltOrSelector)\n } else {\n return eltOrSelector\n }\n }\n\n /**\n * @typedef {keyof HTMLElementEventMap|string} AnyEventName\n */\n\n /**\n * @typedef {Object} EventArgs\n * @property {EventTarget} target\n * @property {AnyEventName} event\n * @property {EventListener} listener\n * @property {Object|boolean} options\n */\n\n /**\n * @param {EventTarget|AnyEventName} arg1\n * @param {AnyEventName|EventListener} arg2\n * @param {EventListener|Object|boolean} [arg3]\n * @param {Object|boolean} [arg4]\n * @returns {EventArgs}\n */\n function processEventArgs(arg1, arg2, arg3, arg4) {\n if (isFunction(arg2)) {\n return {\n target: getDocument().body,\n event: asString(arg1),\n listener: arg2,\n options: arg3\n }\n } else {\n return {\n target: resolveTarget(arg1),\n event: asString(arg2),\n listener: arg3,\n options: arg4\n }\n }\n }\n\n /**\n * Adds an event listener to an element\n *\n * @see https://htmx.org/api/#on\n *\n * @param {EventTarget|string} arg1 the element to add the listener to | the event name to add the listener for\n * @param {string|EventListener} arg2 the event name to add the listener for | the listener to add\n * @param {EventListener|Object|boolean} [arg3] the listener to add | options to add\n * @param {Object|boolean} [arg4] options to add\n * @returns {EventListener}\n */\n function addEventListenerImpl(arg1, arg2, arg3, arg4) {\n ready(function() {\n const eventArgs = processEventArgs(arg1, arg2, arg3, arg4)\n eventArgs.target.addEventListener(eventArgs.event, eventArgs.listener, eventArgs.options)\n })\n const b = isFunction(arg2)\n return b ? arg2 : arg3\n }\n\n /**\n * Removes an event listener from an element\n *\n * @see https://htmx.org/api/#off\n *\n * @param {EventTarget|string} arg1 the element to remove the listener from | the event name to remove the listener from\n * @param {string|EventListener} arg2 the event name to remove the listener from | the listener to remove\n * @param {EventListener} [arg3] the listener to remove\n * @returns {EventListener}\n */\n function removeEventListenerImpl(arg1, arg2, arg3) {\n ready(function() {\n const eventArgs = processEventArgs(arg1, arg2, arg3)\n eventArgs.target.removeEventListener(eventArgs.event, eventArgs.listener)\n })\n return isFunction(arg2) ? arg2 : arg3\n }\n\n //= ===================================================================\n // Node processing\n //= ===================================================================\n\n const DUMMY_ELT = getDocument().createElement('output') // dummy element for bad selectors\n /**\n * @param {Element} elt\n * @param {string} attrName\n * @returns {(Node|Window)[]}\n */\n function findAttributeTargets(elt, attrName) {\n const attrTarget = getClosestAttributeValue(elt, attrName)\n if (attrTarget) {\n if (attrTarget === 'this') {\n return [findThisElement(elt, attrName)]\n } else {\n const result = querySelectorAllExt(elt, attrTarget)\n if (result.length === 0) {\n logError('The selector \"' + attrTarget + '\" on ' + attrName + ' returned no matches!')\n return [DUMMY_ELT]\n } else {\n return result\n }\n }\n }\n }\n\n /**\n * @param {Element} elt\n * @param {string} attribute\n * @returns {Element|null}\n */\n function findThisElement(elt, attribute) {\n return asElement(getClosestMatch(elt, function(elt) {\n return getAttributeValue(asElement(elt), attribute) != null\n }))\n }\n\n /**\n * @param {Element} elt\n * @returns {Node|Window|null}\n */\n function getTarget(elt) {\n const targetStr = getClosestAttributeValue(elt, 'hx-target')\n if (targetStr) {\n if (targetStr === 'this') {\n return findThisElement(elt, 'hx-target')\n } else {\n return querySelectorExt(elt, targetStr)\n }\n } else {\n const data = getInternalData(elt)\n if (data.boosted) {\n return getDocument().body\n } else {\n return elt\n }\n }\n }\n\n /**\n * @param {string} name\n * @returns {boolean}\n */\n function shouldSettleAttribute(name) {\n const attributesToSettle = htmx.config.attributesToSettle\n for (let i = 0; i < attributesToSettle.length; i++) {\n if (name === attributesToSettle[i]) {\n return true\n }\n }\n return false\n }\n\n /**\n * @param {Element} mergeTo\n * @param {Element} mergeFrom\n */\n function cloneAttributes(mergeTo, mergeFrom) {\n forEach(mergeTo.attributes, function(attr) {\n if (!mergeFrom.hasAttribute(attr.name) && shouldSettleAttribute(attr.name)) {\n mergeTo.removeAttribute(attr.name)\n }\n })\n forEach(mergeFrom.attributes, function(attr) {\n if (shouldSettleAttribute(attr.name)) {\n mergeTo.setAttribute(attr.name, attr.value)\n }\n })\n }\n\n /**\n * @param {HtmxSwapStyle} swapStyle\n * @param {Element} target\n * @returns {boolean}\n */\n function isInlineSwap(swapStyle, target) {\n const extensions = getExtensions(target)\n for (let i = 0; i < extensions.length; i++) {\n const extension = extensions[i]\n try {\n if (extension.isInlineSwap(swapStyle)) {\n return true\n }\n } catch (e) {\n logError(e)\n }\n }\n return swapStyle === 'outerHTML'\n }\n\n /**\n * @param {string} oobValue\n * @param {Element} oobElement\n * @param {HtmxSettleInfo} settleInfo\n * @param {Node|Document} [rootNode]\n * @returns\n */\n function oobSwap(oobValue, oobElement, settleInfo, rootNode) {\n rootNode = rootNode || getDocument()\n let selector = '#' + getRawAttribute(oobElement, 'id')\n /** @type HtmxSwapStyle */\n let swapStyle = 'outerHTML'\n if (oobValue === 'true') {\n // do nothing\n } else if (oobValue.indexOf(':') > 0) {\n swapStyle = oobValue.substring(0, oobValue.indexOf(':'))\n selector = oobValue.substring(oobValue.indexOf(':') + 1)\n } else {\n swapStyle = oobValue\n }\n oobElement.removeAttribute('hx-swap-oob')\n oobElement.removeAttribute('data-hx-swap-oob')\n\n const targets = querySelectorAllExt(rootNode, selector, false)\n if (targets) {\n forEach(\n targets,\n function(target) {\n let fragment\n const oobElementClone = oobElement.cloneNode(true)\n fragment = getDocument().createDocumentFragment()\n fragment.appendChild(oobElementClone)\n if (!isInlineSwap(swapStyle, target)) {\n fragment = asParentNode(oobElementClone) // if this is not an inline swap, we use the content of the node, not the node itself\n }\n\n const beforeSwapDetails = { shouldSwap: true, target, fragment }\n if (!triggerEvent(target, 'htmx:oobBeforeSwap', beforeSwapDetails)) return\n\n target = beforeSwapDetails.target // allow re-targeting\n if (beforeSwapDetails.shouldSwap) {\n handlePreservedElements(fragment)\n swapWithStyle(swapStyle, target, target, fragment, settleInfo)\n restorePreservedElements()\n }\n forEach(settleInfo.elts, function(elt) {\n triggerEvent(elt, 'htmx:oobAfterSwap', beforeSwapDetails)\n })\n }\n )\n oobElement.parentNode.removeChild(oobElement)\n } else {\n oobElement.parentNode.removeChild(oobElement)\n triggerErrorEvent(getDocument().body, 'htmx:oobErrorNoTarget', { content: oobElement })\n }\n return oobValue\n }\n\n function restorePreservedElements() {\n const pantry = find('#--htmx-preserve-pantry--')\n if (pantry) {\n for (const preservedElt of [...pantry.children]) {\n const existingElement = find('#' + preservedElt.id)\n // @ts-ignore - use proposed moveBefore feature\n existingElement.parentNode.moveBefore(preservedElt, existingElement)\n existingElement.remove()\n }\n pantry.remove()\n }\n }\n\n /**\n * @param {DocumentFragment|ParentNode} fragment\n */\n function handlePreservedElements(fragment) {\n forEach(findAll(fragment, '[hx-preserve], [data-hx-preserve]'), function(preservedElt) {\n const id = getAttributeValue(preservedElt, 'id')\n const existingElement = getDocument().getElementById(id)\n if (existingElement != null) {\n if (preservedElt.moveBefore) { // if the moveBefore API exists, use it\n // get or create a storage spot for stuff\n let pantry = find('#--htmx-preserve-pantry--')\n if (pantry == null) {\n getDocument().body.insertAdjacentHTML('afterend', \"
\")\n pantry = find('#--htmx-preserve-pantry--')\n }\n // @ts-ignore - use proposed moveBefore feature\n pantry.moveBefore(existingElement, null)\n } else {\n preservedElt.parentNode.replaceChild(existingElement, preservedElt)\n }\n }\n })\n }\n\n /**\n * @param {Node} parentNode\n * @param {ParentNode} fragment\n * @param {HtmxSettleInfo} settleInfo\n */\n function handleAttributes(parentNode, fragment, settleInfo) {\n forEach(fragment.querySelectorAll('[id]'), function(newNode) {\n const id = getRawAttribute(newNode, 'id')\n if (id && id.length > 0) {\n const normalizedId = id.replace(\"'\", \"\\\\'\")\n const normalizedTag = newNode.tagName.replace(':', '\\\\:')\n const parentElt = asParentNode(parentNode)\n const oldNode = parentElt && parentElt.querySelector(normalizedTag + \"[id='\" + normalizedId + \"']\")\n if (oldNode && oldNode !== parentElt) {\n const newAttributes = newNode.cloneNode()\n cloneAttributes(newNode, oldNode)\n settleInfo.tasks.push(function() {\n cloneAttributes(newNode, newAttributes)\n })\n }\n }\n })\n }\n\n /**\n * @param {Node} child\n * @returns {HtmxSettleTask}\n */\n function makeAjaxLoadTask(child) {\n return function() {\n removeClassFromElement(child, htmx.config.addedClass)\n processNode(asElement(child))\n processFocus(asParentNode(child))\n triggerEvent(child, 'htmx:load')\n }\n }\n\n /**\n * @param {ParentNode} child\n */\n function processFocus(child) {\n const autofocus = '[autofocus]'\n const autoFocusedElt = asHtmlElement(matches(child, autofocus) ? child : child.querySelector(autofocus))\n if (autoFocusedElt != null) {\n autoFocusedElt.focus()\n }\n }\n\n /**\n * @param {Node} parentNode\n * @param {Node} insertBefore\n * @param {ParentNode} fragment\n * @param {HtmxSettleInfo} settleInfo\n */\n function insertNodesBefore(parentNode, insertBefore, fragment, settleInfo) {\n handleAttributes(parentNode, fragment, settleInfo)\n while (fragment.childNodes.length > 0) {\n const child = fragment.firstChild\n addClassToElement(asElement(child), htmx.config.addedClass)\n parentNode.insertBefore(child, insertBefore)\n if (child.nodeType !== Node.TEXT_NODE && child.nodeType !== Node.COMMENT_NODE) {\n settleInfo.tasks.push(makeAjaxLoadTask(child))\n }\n }\n }\n\n /**\n * based on https://gist.github.com/hyamamoto/fd435505d29ebfa3d9716fd2be8d42f0,\n * derived from Java's string hashcode implementation\n * @param {string} string\n * @param {number} hash\n * @returns {number}\n */\n function stringHash(string, hash) {\n let char = 0\n while (char < string.length) {\n hash = (hash << 5) - hash + string.charCodeAt(char++) | 0 // bitwise or ensures we have a 32-bit int\n }\n return hash\n }\n\n /**\n * @param {Element} elt\n * @returns {number}\n */\n function attributeHash(elt) {\n let hash = 0\n // IE fix\n if (elt.attributes) {\n for (let i = 0; i < elt.attributes.length; i++) {\n const attribute = elt.attributes[i]\n if (attribute.value) { // only include attributes w/ actual values (empty is same as non-existent)\n hash = stringHash(attribute.name, hash)\n hash = stringHash(attribute.value, hash)\n }\n }\n }\n return hash\n }\n\n /**\n * @param {EventTarget} elt\n */\n function deInitOnHandlers(elt) {\n const internalData = getInternalData(elt)\n if (internalData.onHandlers) {\n for (let i = 0; i < internalData.onHandlers.length; i++) {\n const handlerInfo = internalData.onHandlers[i]\n removeEventListenerImpl(elt, handlerInfo.event, handlerInfo.listener)\n }\n delete internalData.onHandlers\n }\n }\n\n /**\n * @param {Node} element\n */\n function deInitNode(element) {\n const internalData = getInternalData(element)\n if (internalData.timeout) {\n clearTimeout(internalData.timeout)\n }\n if (internalData.listenerInfos) {\n forEach(internalData.listenerInfos, function(info) {\n if (info.on) {\n removeEventListenerImpl(info.on, info.trigger, info.listener)\n }\n })\n }\n deInitOnHandlers(element)\n forEach(Object.keys(internalData), function(key) { if (key !== 'firstInitCompleted') delete internalData[key] })\n }\n\n /**\n * @param {Node} element\n */\n function cleanUpElement(element) {\n triggerEvent(element, 'htmx:beforeCleanupElement')\n deInitNode(element)\n // @ts-ignore IE11 code\n // noinspection JSUnresolvedReference\n if (element.children) { // IE\n // @ts-ignore\n forEach(element.children, function(child) { cleanUpElement(child) })\n }\n }\n\n /**\n * @param {Node} target\n * @param {ParentNode} fragment\n * @param {HtmxSettleInfo} settleInfo\n */\n function swapOuterHTML(target, fragment, settleInfo) {\n if (target instanceof Element && target.tagName === 'BODY') { // special case the body to innerHTML because DocumentFragments can't contain a body elt unfortunately\n return swapInnerHTML(target, fragment, settleInfo)\n }\n /** @type {Node} */\n let newElt\n const eltBeforeNewContent = target.previousSibling\n const parentNode = parentElt(target)\n if (!parentNode) { // when parent node disappears, we can't do anything\n return\n }\n insertNodesBefore(parentNode, target, fragment, settleInfo)\n if (eltBeforeNewContent == null) {\n newElt = parentNode.firstChild\n } else {\n newElt = eltBeforeNewContent.nextSibling\n }\n settleInfo.elts = settleInfo.elts.filter(function(e) { return e !== target })\n // scan through all newly added content and add all elements to the settle info so we trigger\n // events properly on them\n while (newElt && newElt !== target) {\n if (newElt instanceof Element) {\n settleInfo.elts.push(newElt)\n }\n newElt = newElt.nextSibling\n }\n cleanUpElement(target)\n if (target instanceof Element) {\n target.remove()\n } else {\n target.parentNode.removeChild(target)\n }\n }\n\n /**\n * @param {Node} target\n * @param {ParentNode} fragment\n * @param {HtmxSettleInfo} settleInfo\n */\n function swapAfterBegin(target, fragment, settleInfo) {\n return insertNodesBefore(target, target.firstChild, fragment, settleInfo)\n }\n\n /**\n * @param {Node} target\n * @param {ParentNode} fragment\n * @param {HtmxSettleInfo} settleInfo\n */\n function swapBeforeBegin(target, fragment, settleInfo) {\n return insertNodesBefore(parentElt(target), target, fragment, settleInfo)\n }\n\n /**\n * @param {Node} target\n * @param {ParentNode} fragment\n * @param {HtmxSettleInfo} settleInfo\n */\n function swapBeforeEnd(target, fragment, settleInfo) {\n return insertNodesBefore(target, null, fragment, settleInfo)\n }\n\n /**\n * @param {Node} target\n * @param {ParentNode} fragment\n * @param {HtmxSettleInfo} settleInfo\n */\n function swapAfterEnd(target, fragment, settleInfo) {\n return insertNodesBefore(parentElt(target), target.nextSibling, fragment, settleInfo)\n }\n\n /**\n * @param {Node} target\n */\n function swapDelete(target) {\n cleanUpElement(target)\n const parent = parentElt(target)\n if (parent) {\n return parent.removeChild(target)\n }\n }\n\n /**\n * @param {Node} target\n * @param {ParentNode} fragment\n * @param {HtmxSettleInfo} settleInfo\n */\n function swapInnerHTML(target, fragment, settleInfo) {\n const firstChild = target.firstChild\n insertNodesBefore(target, firstChild, fragment, settleInfo)\n if (firstChild) {\n while (firstChild.nextSibling) {\n cleanUpElement(firstChild.nextSibling)\n target.removeChild(firstChild.nextSibling)\n }\n cleanUpElement(firstChild)\n target.removeChild(firstChild)\n }\n }\n\n /**\n * @param {HtmxSwapStyle} swapStyle\n * @param {Element} elt\n * @param {Node} target\n * @param {ParentNode} fragment\n * @param {HtmxSettleInfo} settleInfo\n */\n function swapWithStyle(swapStyle, elt, target, fragment, settleInfo) {\n switch (swapStyle) {\n case 'none':\n return\n case 'outerHTML':\n swapOuterHTML(target, fragment, settleInfo)\n return\n case 'afterbegin':\n swapAfterBegin(target, fragment, settleInfo)\n return\n case 'beforebegin':\n swapBeforeBegin(target, fragment, settleInfo)\n return\n case 'beforeend':\n swapBeforeEnd(target, fragment, settleInfo)\n return\n case 'afterend':\n swapAfterEnd(target, fragment, settleInfo)\n return\n case 'delete':\n swapDelete(target)\n return\n default:\n var extensions = getExtensions(elt)\n for (let i = 0; i < extensions.length; i++) {\n const ext = extensions[i]\n try {\n const newElements = ext.handleSwap(swapStyle, target, fragment, settleInfo)\n if (newElements) {\n if (Array.isArray(newElements)) {\n // if handleSwap returns an array (like) of elements, we handle them\n for (let j = 0; j < newElements.length; j++) {\n const child = newElements[j]\n if (child.nodeType !== Node.TEXT_NODE && child.nodeType !== Node.COMMENT_NODE) {\n settleInfo.tasks.push(makeAjaxLoadTask(child))\n }\n }\n }\n return\n }\n } catch (e) {\n logError(e)\n }\n }\n if (swapStyle === 'innerHTML') {\n swapInnerHTML(target, fragment, settleInfo)\n } else {\n swapWithStyle(htmx.config.defaultSwapStyle, elt, target, fragment, settleInfo)\n }\n }\n }\n\n /**\n * @param {DocumentFragment} fragment\n * @param {HtmxSettleInfo} settleInfo\n * @param {Node|Document} [rootNode]\n */\n function findAndSwapOobElements(fragment, settleInfo, rootNode) {\n var oobElts = findAll(fragment, '[hx-swap-oob], [data-hx-swap-oob]')\n forEach(oobElts, function(oobElement) {\n if (htmx.config.allowNestedOobSwaps || oobElement.parentElement === null) {\n const oobValue = getAttributeValue(oobElement, 'hx-swap-oob')\n if (oobValue != null) {\n oobSwap(oobValue, oobElement, settleInfo, rootNode)\n }\n } else {\n oobElement.removeAttribute('hx-swap-oob')\n oobElement.removeAttribute('data-hx-swap-oob')\n }\n })\n return oobElts.length > 0\n }\n\n /**\n * Implements complete swapping pipeline, including: focus and selection preservation,\n * title updates, scroll, OOB swapping, normal swapping and settling\n * @param {string|Element} target\n * @param {string} content\n * @param {HtmxSwapSpecification} swapSpec\n * @param {SwapOptions} [swapOptions]\n */\n function swap(target, content, swapSpec, swapOptions) {\n if (!swapOptions) {\n swapOptions = {}\n }\n\n target = resolveTarget(target)\n const rootNode = swapOptions.contextElement ? getRootNode(swapOptions.contextElement, false) : getDocument()\n\n // preserve focus and selection\n const activeElt = document.activeElement\n let selectionInfo = {}\n try {\n selectionInfo = {\n elt: activeElt,\n // @ts-ignore\n start: activeElt ? activeElt.selectionStart : null,\n // @ts-ignore\n end: activeElt ? activeElt.selectionEnd : null\n }\n } catch (e) {\n // safari issue - see https://github.com/microsoft/playwright/issues/5894\n }\n const settleInfo = makeSettleInfo(target)\n\n // For text content swaps, don't parse the response as HTML, just insert it\n if (swapSpec.swapStyle === 'textContent') {\n target.textContent = content\n // Otherwise, make the fragment and process it\n } else {\n let fragment = makeFragment(content)\n\n settleInfo.title = fragment.title\n\n // select-oob swaps\n if (swapOptions.selectOOB) {\n const oobSelectValues = swapOptions.selectOOB.split(',')\n for (let i = 0; i < oobSelectValues.length; i++) {\n const oobSelectValue = oobSelectValues[i].split(':', 2)\n let id = oobSelectValue[0].trim()\n if (id.indexOf('#') === 0) {\n id = id.substring(1)\n }\n const oobValue = oobSelectValue[1] || 'true'\n const oobElement = fragment.querySelector('#' + id)\n if (oobElement) {\n oobSwap(oobValue, oobElement, settleInfo, rootNode)\n }\n }\n }\n // oob swaps\n findAndSwapOobElements(fragment, settleInfo, rootNode)\n forEach(findAll(fragment, 'template'), /** @param {HTMLTemplateElement} template */function(template) {\n if (template.content && findAndSwapOobElements(template.content, settleInfo, rootNode)) {\n // Avoid polluting the DOM with empty templates that were only used to encapsulate oob swap\n template.remove()\n }\n })\n\n // normal swap\n if (swapOptions.select) {\n const newFragment = getDocument().createDocumentFragment()\n forEach(fragment.querySelectorAll(swapOptions.select), function(node) {\n newFragment.appendChild(node)\n })\n fragment = newFragment\n }\n handlePreservedElements(fragment)\n swapWithStyle(swapSpec.swapStyle, swapOptions.contextElement, target, fragment, settleInfo)\n restorePreservedElements()\n }\n\n // apply saved focus and selection information to swapped content\n if (selectionInfo.elt &&\n !bodyContains(selectionInfo.elt) &&\n getRawAttribute(selectionInfo.elt, 'id')) {\n const newActiveElt = document.getElementById(getRawAttribute(selectionInfo.elt, 'id'))\n const focusOptions = { preventScroll: swapSpec.focusScroll !== undefined ? !swapSpec.focusScroll : !htmx.config.defaultFocusScroll }\n if (newActiveElt) {\n // @ts-ignore\n if (selectionInfo.start && newActiveElt.setSelectionRange) {\n try {\n // @ts-ignore\n newActiveElt.setSelectionRange(selectionInfo.start, selectionInfo.end)\n } catch (e) {\n // the setSelectionRange method is present on fields that don't support it, so just let this fail\n }\n }\n newActiveElt.focus(focusOptions)\n }\n }\n\n target.classList.remove(htmx.config.swappingClass)\n forEach(settleInfo.elts, function(elt) {\n if (elt.classList) {\n elt.classList.add(htmx.config.settlingClass)\n }\n triggerEvent(elt, 'htmx:afterSwap', swapOptions.eventInfo)\n })\n if (swapOptions.afterSwapCallback) {\n swapOptions.afterSwapCallback()\n }\n\n // merge in new title after swap but before settle\n if (!swapSpec.ignoreTitle) {\n handleTitle(settleInfo.title)\n }\n\n // settle\n const doSettle = function() {\n forEach(settleInfo.tasks, function(task) {\n task.call()\n })\n forEach(settleInfo.elts, function(elt) {\n if (elt.classList) {\n elt.classList.remove(htmx.config.settlingClass)\n }\n triggerEvent(elt, 'htmx:afterSettle', swapOptions.eventInfo)\n })\n\n if (swapOptions.anchor) {\n const anchorTarget = asElement(resolveTarget('#' + swapOptions.anchor))\n if (anchorTarget) {\n anchorTarget.scrollIntoView({ block: 'start', behavior: 'auto' })\n }\n }\n\n updateScrollState(settleInfo.elts, swapSpec)\n if (swapOptions.afterSettleCallback) {\n swapOptions.afterSettleCallback()\n }\n }\n\n if (swapSpec.settleDelay > 0) {\n getWindow().setTimeout(doSettle, swapSpec.settleDelay)\n } else {\n doSettle()\n }\n }\n\n /**\n * @param {XMLHttpRequest} xhr\n * @param {string} header\n * @param {EventTarget} elt\n */\n function handleTriggerHeader(xhr, header, elt) {\n const triggerBody = xhr.getResponseHeader(header)\n if (triggerBody.indexOf('{') === 0) {\n const triggers = parseJSON(triggerBody)\n for (const eventName in triggers) {\n if (triggers.hasOwnProperty(eventName)) {\n let detail = triggers[eventName]\n if (isRawObject(detail)) {\n // @ts-ignore\n elt = detail.target !== undefined ? detail.target : elt\n } else {\n detail = { value: detail }\n }\n triggerEvent(elt, eventName, detail)\n }\n }\n } else {\n const eventNames = triggerBody.split(',')\n for (let i = 0; i < eventNames.length; i++) {\n triggerEvent(elt, eventNames[i].trim(), [])\n }\n }\n }\n\n const WHITESPACE = /\\s/\n const WHITESPACE_OR_COMMA = /[\\s,]/\n const SYMBOL_START = /[_$a-zA-Z]/\n const SYMBOL_CONT = /[_$a-zA-Z0-9]/\n const STRINGISH_START = ['\"', \"'\", '/']\n const NOT_WHITESPACE = /[^\\s]/\n const COMBINED_SELECTOR_START = /[{(]/\n const COMBINED_SELECTOR_END = /[})]/\n\n /**\n * @param {string} str\n * @returns {string[]}\n */\n function tokenizeString(str) {\n /** @type string[] */\n const tokens = []\n let position = 0\n while (position < str.length) {\n if (SYMBOL_START.exec(str.charAt(position))) {\n var startPosition = position\n while (SYMBOL_CONT.exec(str.charAt(position + 1))) {\n position++\n }\n tokens.push(str.substring(startPosition, position + 1))\n } else if (STRINGISH_START.indexOf(str.charAt(position)) !== -1) {\n const startChar = str.charAt(position)\n var startPosition = position\n position++\n while (position < str.length && str.charAt(position) !== startChar) {\n if (str.charAt(position) === '\\\\') {\n position++\n }\n position++\n }\n tokens.push(str.substring(startPosition, position + 1))\n } else {\n const symbol = str.charAt(position)\n tokens.push(symbol)\n }\n position++\n }\n return tokens\n }\n\n /**\n * @param {string} token\n * @param {string|null} last\n * @param {string} paramName\n * @returns {boolean}\n */\n function isPossibleRelativeReference(token, last, paramName) {\n return SYMBOL_START.exec(token.charAt(0)) &&\n token !== 'true' &&\n token !== 'false' &&\n token !== 'this' &&\n token !== paramName &&\n last !== '.'\n }\n\n /**\n * @param {EventTarget|string} elt\n * @param {string[]} tokens\n * @param {string} paramName\n * @returns {ConditionalFunction|null}\n */\n function maybeGenerateConditional(elt, tokens, paramName) {\n if (tokens[0] === '[') {\n tokens.shift()\n let bracketCount = 1\n let conditionalSource = ' return (function(' + paramName + '){ return ('\n let last = null\n while (tokens.length > 0) {\n const token = tokens[0]\n // @ts-ignore For some reason tsc doesn't understand the shift call, and thinks we're comparing the same value here, i.e. '[' vs ']'\n if (token === ']') {\n bracketCount--\n if (bracketCount === 0) {\n if (last === null) {\n conditionalSource = conditionalSource + 'true'\n }\n tokens.shift()\n conditionalSource += ')})'\n try {\n const conditionFunction = maybeEval(elt, function() {\n return Function(conditionalSource)()\n },\n function() { return true })\n conditionFunction.source = conditionalSource\n return conditionFunction\n } catch (e) {\n triggerErrorEvent(getDocument().body, 'htmx:syntax:error', { error: e, source: conditionalSource })\n return null\n }\n }\n } else if (token === '[') {\n bracketCount++\n }\n if (isPossibleRelativeReference(token, last, paramName)) {\n conditionalSource += '((' + paramName + '.' + token + ') ? (' + paramName + '.' + token + ') : (window.' + token + '))'\n } else {\n conditionalSource = conditionalSource + token\n }\n last = tokens.shift()\n }\n }\n }\n\n /**\n * @param {string[]} tokens\n * @param {RegExp} match\n * @returns {string}\n */\n function consumeUntil(tokens, match) {\n let result = ''\n while (tokens.length > 0 && !match.test(tokens[0])) {\n result += tokens.shift()\n }\n return result\n }\n\n /**\n * @param {string[]} tokens\n * @returns {string}\n */\n function consumeCSSSelector(tokens) {\n let result\n if (tokens.length > 0 && COMBINED_SELECTOR_START.test(tokens[0])) {\n tokens.shift()\n result = consumeUntil(tokens, COMBINED_SELECTOR_END).trim()\n tokens.shift()\n } else {\n result = consumeUntil(tokens, WHITESPACE_OR_COMMA)\n }\n return result\n }\n\n const INPUT_SELECTOR = 'input, textarea, select'\n\n /**\n * @param {Element} elt\n * @param {string} explicitTrigger\n * @param {Object} cache for trigger specs\n * @returns {HtmxTriggerSpecification[]}\n */\n function parseAndCacheTrigger(elt, explicitTrigger, cache) {\n /** @type HtmxTriggerSpecification[] */\n const triggerSpecs = []\n const tokens = tokenizeString(explicitTrigger)\n do {\n consumeUntil(tokens, NOT_WHITESPACE)\n const initialLength = tokens.length\n const trigger = consumeUntil(tokens, /[,\\[\\s]/)\n if (trigger !== '') {\n if (trigger === 'every') {\n /** @type HtmxTriggerSpecification */\n const every = { trigger: 'every' }\n consumeUntil(tokens, NOT_WHITESPACE)\n every.pollInterval = parseInterval(consumeUntil(tokens, /[,\\[\\s]/))\n consumeUntil(tokens, NOT_WHITESPACE)\n var eventFilter = maybeGenerateConditional(elt, tokens, 'event')\n if (eventFilter) {\n every.eventFilter = eventFilter\n }\n triggerSpecs.push(every)\n } else {\n /** @type HtmxTriggerSpecification */\n const triggerSpec = { trigger }\n var eventFilter = maybeGenerateConditional(elt, tokens, 'event')\n if (eventFilter) {\n triggerSpec.eventFilter = eventFilter\n }\n consumeUntil(tokens, NOT_WHITESPACE)\n while (tokens.length > 0 && tokens[0] !== ',') {\n const token = tokens.shift()\n if (token === 'changed') {\n triggerSpec.changed = true\n } else if (token === 'once') {\n triggerSpec.once = true\n } else if (token === 'consume') {\n triggerSpec.consume = true\n } else if (token === 'delay' && tokens[0] === ':') {\n tokens.shift()\n triggerSpec.delay = parseInterval(consumeUntil(tokens, WHITESPACE_OR_COMMA))\n } else if (token === 'from' && tokens[0] === ':') {\n tokens.shift()\n if (COMBINED_SELECTOR_START.test(tokens[0])) {\n var from_arg = consumeCSSSelector(tokens)\n } else {\n var from_arg = consumeUntil(tokens, WHITESPACE_OR_COMMA)\n if (from_arg === 'closest' || from_arg === 'find' || from_arg === 'next' || from_arg === 'previous') {\n tokens.shift()\n const selector = consumeCSSSelector(tokens)\n // `next` and `previous` allow a selector-less syntax\n if (selector.length > 0) {\n from_arg += ' ' + selector\n }\n }\n }\n triggerSpec.from = from_arg\n } else if (token === 'target' && tokens[0] === ':') {\n tokens.shift()\n triggerSpec.target = consumeCSSSelector(tokens)\n } else if (token === 'throttle' && tokens[0] === ':') {\n tokens.shift()\n triggerSpec.throttle = parseInterval(consumeUntil(tokens, WHITESPACE_OR_COMMA))\n } else if (token === 'queue' && tokens[0] === ':') {\n tokens.shift()\n triggerSpec.queue = consumeUntil(tokens, WHITESPACE_OR_COMMA)\n } else if (token === 'root' && tokens[0] === ':') {\n tokens.shift()\n triggerSpec[token] = consumeCSSSelector(tokens)\n } else if (token === 'threshold' && tokens[0] === ':') {\n tokens.shift()\n triggerSpec[token] = consumeUntil(tokens, WHITESPACE_OR_COMMA)\n } else {\n triggerErrorEvent(elt, 'htmx:syntax:error', { token: tokens.shift() })\n }\n consumeUntil(tokens, NOT_WHITESPACE)\n }\n triggerSpecs.push(triggerSpec)\n }\n }\n if (tokens.length === initialLength) {\n triggerErrorEvent(elt, 'htmx:syntax:error', { token: tokens.shift() })\n }\n consumeUntil(tokens, NOT_WHITESPACE)\n } while (tokens[0] === ',' && tokens.shift())\n if (cache) {\n cache[explicitTrigger] = triggerSpecs\n }\n return triggerSpecs\n }\n\n /**\n * @param {Element} elt\n * @returns {HtmxTriggerSpecification[]}\n */\n function getTriggerSpecs(elt) {\n const explicitTrigger = getAttributeValue(elt, 'hx-trigger')\n let triggerSpecs = []\n if (explicitTrigger) {\n const cache = htmx.config.triggerSpecsCache\n triggerSpecs = (cache && cache[explicitTrigger]) || parseAndCacheTrigger(elt, explicitTrigger, cache)\n }\n\n if (triggerSpecs.length > 0) {\n return triggerSpecs\n } else if (matches(elt, 'form')) {\n return [{ trigger: 'submit' }]\n } else if (matches(elt, 'input[type=\"button\"], input[type=\"submit\"]')) {\n return [{ trigger: 'click' }]\n } else if (matches(elt, INPUT_SELECTOR)) {\n return [{ trigger: 'change' }]\n } else {\n return [{ trigger: 'click' }]\n }\n }\n\n /**\n * @param {Element} elt\n */\n function cancelPolling(elt) {\n getInternalData(elt).cancelled = true\n }\n\n /**\n * @param {Element} elt\n * @param {TriggerHandler} handler\n * @param {HtmxTriggerSpecification} spec\n */\n function processPolling(elt, handler, spec) {\n const nodeData = getInternalData(elt)\n nodeData.timeout = getWindow().setTimeout(function() {\n if (bodyContains(elt) && nodeData.cancelled !== true) {\n if (!maybeFilterEvent(spec, elt, makeEvent('hx:poll:trigger', {\n triggerSpec: spec,\n target: elt\n }))) {\n handler(elt)\n }\n processPolling(elt, handler, spec)\n }\n }, spec.pollInterval)\n }\n\n /**\n * @param {HTMLAnchorElement} elt\n * @returns {boolean}\n */\n function isLocalLink(elt) {\n return location.hostname === elt.hostname &&\n getRawAttribute(elt, 'href') &&\n getRawAttribute(elt, 'href').indexOf('#') !== 0\n }\n\n /**\n * @param {Element} elt\n */\n function eltIsDisabled(elt) {\n return closest(elt, htmx.config.disableSelector)\n }\n\n /**\n * @param {Element} elt\n * @param {HtmxNodeInternalData} nodeData\n * @param {HtmxTriggerSpecification[]} triggerSpecs\n */\n function boostElement(elt, nodeData, triggerSpecs) {\n if ((elt instanceof HTMLAnchorElement && isLocalLink(elt) && (elt.target === '' || elt.target === '_self')) || (elt.tagName === 'FORM' && String(getRawAttribute(elt, 'method')).toLowerCase() !== 'dialog')) {\n nodeData.boosted = true\n let verb, path\n if (elt.tagName === 'A') {\n verb = (/** @type HttpVerb */('get'))\n path = getRawAttribute(elt, 'href')\n } else {\n const rawAttribute = getRawAttribute(elt, 'method')\n verb = (/** @type HttpVerb */(rawAttribute ? rawAttribute.toLowerCase() : 'get'))\n path = getRawAttribute(elt, 'action')\n if (path == null || path === '') {\n // if there is no action attribute on the form set path to current href before the\n // following logic to properly clear parameters on a GET (not on a POST!)\n path = getDocument().location.href\n }\n if (verb === 'get' && path.includes('?')) {\n path = path.replace(/\\?[^#]+/, '')\n }\n }\n triggerSpecs.forEach(function(triggerSpec) {\n addEventListener(elt, function(node, evt) {\n const elt = asElement(node)\n if (eltIsDisabled(elt)) {\n cleanUpElement(elt)\n return\n }\n issueAjaxRequest(verb, path, elt, evt)\n }, nodeData, triggerSpec, true)\n })\n }\n }\n\n /**\n * @param {Event} evt\n * @param {Node} node\n * @returns {boolean}\n */\n function shouldCancel(evt, node) {\n const elt = asElement(node)\n if (!elt) {\n return false\n }\n if (evt.type === 'submit' || evt.type === 'click') {\n if (elt.tagName === 'FORM') {\n return true\n }\n if (matches(elt, 'input[type=\"submit\"], button') &&\n (matches(elt, '[form]') || closest(elt, 'form') !== null)) {\n return true\n }\n if (elt instanceof HTMLAnchorElement && elt.href &&\n (elt.getAttribute('href') === '#' || elt.getAttribute('href').indexOf('#') !== 0)) {\n return true\n }\n }\n return false\n }\n\n /**\n * @param {Node} elt\n * @param {Event|MouseEvent|KeyboardEvent|TouchEvent} evt\n * @returns {boolean}\n */\n function ignoreBoostedAnchorCtrlClick(elt, evt) {\n return getInternalData(elt).boosted && elt instanceof HTMLAnchorElement && evt.type === 'click' &&\n // @ts-ignore this will resolve to undefined for events that don't define those properties, which is fine\n (evt.ctrlKey || evt.metaKey)\n }\n\n /**\n * @param {HtmxTriggerSpecification} triggerSpec\n * @param {Node} elt\n * @param {Event} evt\n * @returns {boolean}\n */\n function maybeFilterEvent(triggerSpec, elt, evt) {\n const eventFilter = triggerSpec.eventFilter\n if (eventFilter) {\n try {\n return eventFilter.call(elt, evt) !== true\n } catch (e) {\n const source = eventFilter.source\n triggerErrorEvent(getDocument().body, 'htmx:eventFilter:error', { error: e, source })\n return true\n }\n }\n return false\n }\n\n /**\n * @param {Node} elt\n * @param {TriggerHandler} handler\n * @param {HtmxNodeInternalData} nodeData\n * @param {HtmxTriggerSpecification} triggerSpec\n * @param {boolean} [explicitCancel]\n */\n function addEventListener(elt, handler, nodeData, triggerSpec, explicitCancel) {\n const elementData = getInternalData(elt)\n /** @type {(Node|Window)[]} */\n let eltsToListenOn\n if (triggerSpec.from) {\n eltsToListenOn = querySelectorAllExt(elt, triggerSpec.from)\n } else {\n eltsToListenOn = [elt]\n }\n // store the initial values of the elements, so we can tell if they change\n if (triggerSpec.changed) {\n if (!('lastValue' in elementData)) {\n elementData.lastValue = new WeakMap()\n }\n eltsToListenOn.forEach(function(eltToListenOn) {\n if (!elementData.lastValue.has(triggerSpec)) {\n elementData.lastValue.set(triggerSpec, new WeakMap())\n }\n // @ts-ignore value will be undefined for non-input elements, which is fine\n elementData.lastValue.get(triggerSpec).set(eltToListenOn, eltToListenOn.value)\n })\n }\n forEach(eltsToListenOn, function(eltToListenOn) {\n /** @type EventListener */\n const eventListener = function(evt) {\n if (!bodyContains(elt)) {\n eltToListenOn.removeEventListener(triggerSpec.trigger, eventListener)\n return\n }\n if (ignoreBoostedAnchorCtrlClick(elt, evt)) {\n return\n }\n if (explicitCancel || shouldCancel(evt, elt)) {\n evt.preventDefault()\n }\n if (maybeFilterEvent(triggerSpec, elt, evt)) {\n return\n }\n const eventData = getInternalData(evt)\n eventData.triggerSpec = triggerSpec\n if (eventData.handledFor == null) {\n eventData.handledFor = []\n }\n if (eventData.handledFor.indexOf(elt) < 0) {\n eventData.handledFor.push(elt)\n if (triggerSpec.consume) {\n evt.stopPropagation()\n }\n if (triggerSpec.target && evt.target) {\n if (!matches(asElement(evt.target), triggerSpec.target)) {\n return\n }\n }\n if (triggerSpec.once) {\n if (elementData.triggeredOnce) {\n return\n } else {\n elementData.triggeredOnce = true\n }\n }\n if (triggerSpec.changed) {\n const node = event.target\n // @ts-ignore value will be undefined for non-input elements, which is fine\n const value = node.value\n const lastValue = elementData.lastValue.get(triggerSpec)\n if (lastValue.has(node) && lastValue.get(node) === value) {\n return\n }\n lastValue.set(node, value)\n }\n if (elementData.delayed) {\n clearTimeout(elementData.delayed)\n }\n if (elementData.throttle) {\n return\n }\n\n if (triggerSpec.throttle > 0) {\n if (!elementData.throttle) {\n triggerEvent(elt, 'htmx:trigger')\n handler(elt, evt)\n elementData.throttle = getWindow().setTimeout(function() {\n elementData.throttle = null\n }, triggerSpec.throttle)\n }\n } else if (triggerSpec.delay > 0) {\n elementData.delayed = getWindow().setTimeout(function() {\n triggerEvent(elt, 'htmx:trigger')\n handler(elt, evt)\n }, triggerSpec.delay)\n } else {\n triggerEvent(elt, 'htmx:trigger')\n handler(elt, evt)\n }\n }\n }\n if (nodeData.listenerInfos == null) {\n nodeData.listenerInfos = []\n }\n nodeData.listenerInfos.push({\n trigger: triggerSpec.trigger,\n listener: eventListener,\n on: eltToListenOn\n })\n eltToListenOn.addEventListener(triggerSpec.trigger, eventListener)\n })\n }\n\n let windowIsScrolling = false // used by initScrollHandler\n let scrollHandler = null\n function initScrollHandler() {\n if (!scrollHandler) {\n scrollHandler = function() {\n windowIsScrolling = true\n }\n window.addEventListener('scroll', scrollHandler)\n window.addEventListener('resize', scrollHandler)\n setInterval(function() {\n if (windowIsScrolling) {\n windowIsScrolling = false\n forEach(getDocument().querySelectorAll(\"[hx-trigger*='revealed'],[data-hx-trigger*='revealed']\"), function(elt) {\n maybeReveal(elt)\n })\n }\n }, 200)\n }\n }\n\n /**\n * @param {Element} elt\n */\n function maybeReveal(elt) {\n if (!hasAttribute(elt, 'data-hx-revealed') && isScrolledIntoView(elt)) {\n elt.setAttribute('data-hx-revealed', 'true')\n const nodeData = getInternalData(elt)\n if (nodeData.initHash) {\n triggerEvent(elt, 'revealed')\n } else {\n // if the node isn't initialized, wait for it before triggering the request\n elt.addEventListener('htmx:afterProcessNode', function() { triggerEvent(elt, 'revealed') }, { once: true })\n }\n }\n }\n\n //= ===================================================================\n\n /**\n * @param {Element} elt\n * @param {TriggerHandler} handler\n * @param {HtmxNodeInternalData} nodeData\n * @param {number} delay\n */\n function loadImmediately(elt, handler, nodeData, delay) {\n const load = function() {\n if (!nodeData.loaded) {\n nodeData.loaded = true\n triggerEvent(elt, 'htmx:trigger')\n handler(elt)\n }\n }\n if (delay > 0) {\n getWindow().setTimeout(load, delay)\n } else {\n load()\n }\n }\n\n /**\n * @param {Element} elt\n * @param {HtmxNodeInternalData} nodeData\n * @param {HtmxTriggerSpecification[]} triggerSpecs\n * @returns {boolean}\n */\n function processVerbs(elt, nodeData, triggerSpecs) {\n let explicitAction = false\n forEach(VERBS, function(verb) {\n if (hasAttribute(elt, 'hx-' + verb)) {\n const path = getAttributeValue(elt, 'hx-' + verb)\n explicitAction = true\n nodeData.path = path\n nodeData.verb = verb\n triggerSpecs.forEach(function(triggerSpec) {\n addTriggerHandler(elt, triggerSpec, nodeData, function(node, evt) {\n const elt = asElement(node)\n if (closest(elt, htmx.config.disableSelector)) {\n cleanUpElement(elt)\n return\n }\n issueAjaxRequest(verb, path, elt, evt)\n })\n })\n }\n })\n return explicitAction\n }\n\n /**\n * @callback TriggerHandler\n * @param {Node} elt\n * @param {Event} [evt]\n */\n\n /**\n * @param {Node} elt\n * @param {HtmxTriggerSpecification} triggerSpec\n * @param {HtmxNodeInternalData} nodeData\n * @param {TriggerHandler} handler\n */\n function addTriggerHandler(elt, triggerSpec, nodeData, handler) {\n if (triggerSpec.trigger === 'revealed') {\n initScrollHandler()\n addEventListener(elt, handler, nodeData, triggerSpec)\n maybeReveal(asElement(elt))\n } else if (triggerSpec.trigger === 'intersect') {\n const observerOptions = {}\n if (triggerSpec.root) {\n observerOptions.root = querySelectorExt(elt, triggerSpec.root)\n }\n if (triggerSpec.threshold) {\n observerOptions.threshold = parseFloat(triggerSpec.threshold)\n }\n const observer = new IntersectionObserver(function(entries) {\n for (let i = 0; i < entries.length; i++) {\n const entry = entries[i]\n if (entry.isIntersecting) {\n triggerEvent(elt, 'intersect')\n break\n }\n }\n }, observerOptions)\n observer.observe(asElement(elt))\n addEventListener(asElement(elt), handler, nodeData, triggerSpec)\n } else if (!nodeData.firstInitCompleted && triggerSpec.trigger === 'load') {\n if (!maybeFilterEvent(triggerSpec, elt, makeEvent('load', { elt }))) {\n loadImmediately(asElement(elt), handler, nodeData, triggerSpec.delay)\n }\n } else if (triggerSpec.pollInterval > 0) {\n nodeData.polling = true\n processPolling(asElement(elt), handler, triggerSpec)\n } else {\n addEventListener(elt, handler, nodeData, triggerSpec)\n }\n }\n\n /**\n * @param {Node} node\n * @returns {boolean}\n */\n function shouldProcessHxOn(node) {\n const elt = asElement(node)\n if (!elt) {\n return false\n }\n const attributes = elt.attributes\n for (let j = 0; j < attributes.length; j++) {\n const attrName = attributes[j].name\n if (startsWith(attrName, 'hx-on:') || startsWith(attrName, 'data-hx-on:') ||\n startsWith(attrName, 'hx-on-') || startsWith(attrName, 'data-hx-on-')) {\n return true\n }\n }\n return false\n }\n\n /**\n * @param {Node} elt\n * @returns {Element[]}\n */\n const HX_ON_QUERY = new XPathEvaluator()\n .createExpression('.//*[@*[ starts-with(name(), \"hx-on:\") or starts-with(name(), \"data-hx-on:\") or' +\n ' starts-with(name(), \"hx-on-\") or starts-with(name(), \"data-hx-on-\") ]]')\n\n function processHXOnRoot(elt, elements) {\n if (shouldProcessHxOn(elt)) {\n elements.push(asElement(elt))\n }\n const iter = HX_ON_QUERY.evaluate(elt)\n let node = null\n while (node = iter.iterateNext()) elements.push(asElement(node))\n }\n\n function findHxOnWildcardElements(elt) {\n /** @type {Element[]} */\n const elements = []\n if (elt instanceof DocumentFragment) {\n for (const child of elt.childNodes) {\n processHXOnRoot(child, elements)\n }\n } else {\n processHXOnRoot(elt, elements)\n }\n return elements\n }\n\n /**\n * @param {Element} elt\n * @returns {NodeListOf|[]}\n */\n function findElementsToProcess(elt) {\n if (elt.querySelectorAll) {\n const boostedSelector = ', [hx-boost] a, [data-hx-boost] a, a[hx-boost], a[data-hx-boost]'\n\n const extensionSelectors = []\n for (const e in extensions) {\n const extension = extensions[e]\n if (extension.getSelectors) {\n var selectors = extension.getSelectors()\n if (selectors) {\n extensionSelectors.push(selectors)\n }\n }\n }\n\n const results = elt.querySelectorAll(VERB_SELECTOR + boostedSelector + \", form, [type='submit'],\" +\n ' [hx-ext], [data-hx-ext], [hx-trigger], [data-hx-trigger]' + extensionSelectors.flat().map(s => ', ' + s).join(''))\n\n return results\n } else {\n return []\n }\n }\n\n /**\n * Handle submit buttons/inputs that have the form attribute set\n * see https://developer.mozilla.org/docs/Web/HTML/Element/button\n * @param {Event} evt\n */\n function maybeSetLastButtonClicked(evt) {\n const elt = /** @type {HTMLButtonElement|HTMLInputElement} */ (closest(asElement(evt.target), \"button, input[type='submit']\"))\n const internalData = getRelatedFormData(evt)\n if (internalData) {\n internalData.lastButtonClicked = elt\n }\n }\n\n /**\n * @param {Event} evt\n */\n function maybeUnsetLastButtonClicked(evt) {\n const internalData = getRelatedFormData(evt)\n if (internalData) {\n internalData.lastButtonClicked = null\n }\n }\n\n /**\n * @param {Event} evt\n * @returns {HtmxNodeInternalData|undefined}\n */\n function getRelatedFormData(evt) {\n const elt = closest(asElement(evt.target), \"button, input[type='submit']\")\n if (!elt) {\n return\n }\n const form = resolveTarget('#' + getRawAttribute(elt, 'form'), elt.getRootNode()) || closest(elt, 'form')\n if (!form) {\n return\n }\n return getInternalData(form)\n }\n\n /**\n * @param {EventTarget} elt\n */\n function initButtonTracking(elt) {\n // need to handle both click and focus in:\n // focusin - in case someone tabs in to a button and hits the space bar\n // click - on OSX buttons do not focus on click see https://bugs.webkit.org/show_bug.cgi?id=13724\n elt.addEventListener('click', maybeSetLastButtonClicked)\n elt.addEventListener('focusin', maybeSetLastButtonClicked)\n elt.addEventListener('focusout', maybeUnsetLastButtonClicked)\n }\n\n /**\n * @param {Element} elt\n * @param {string} eventName\n * @param {string} code\n */\n function addHxOnEventHandler(elt, eventName, code) {\n const nodeData = getInternalData(elt)\n if (!Array.isArray(nodeData.onHandlers)) {\n nodeData.onHandlers = []\n }\n let func\n /** @type EventListener */\n const listener = function(e) {\n maybeEval(elt, function() {\n if (eltIsDisabled(elt)) {\n return\n }\n if (!func) {\n func = new Function('event', code)\n }\n func.call(elt, e)\n })\n }\n elt.addEventListener(eventName, listener)\n nodeData.onHandlers.push({ event: eventName, listener })\n }\n\n /**\n * @param {Element} elt\n */\n function processHxOnWildcard(elt) {\n // wipe any previous on handlers so that this function takes precedence\n deInitOnHandlers(elt)\n\n for (let i = 0; i < elt.attributes.length; i++) {\n const name = elt.attributes[i].name\n const value = elt.attributes[i].value\n if (startsWith(name, 'hx-on') || startsWith(name, 'data-hx-on')) {\n const afterOnPosition = name.indexOf('-on') + 3\n const nextChar = name.slice(afterOnPosition, afterOnPosition + 1)\n if (nextChar === '-' || nextChar === ':') {\n let eventName = name.slice(afterOnPosition + 1)\n // if the eventName starts with a colon or dash, prepend \"htmx\" for shorthand support\n if (startsWith(eventName, ':')) {\n eventName = 'htmx' + eventName\n } else if (startsWith(eventName, '-')) {\n eventName = 'htmx:' + eventName.slice(1)\n } else if (startsWith(eventName, 'htmx-')) {\n eventName = 'htmx:' + eventName.slice(5)\n }\n\n addHxOnEventHandler(elt, eventName, value)\n }\n }\n }\n }\n\n /**\n * @param {Element|HTMLInputElement} elt\n */\n function initNode(elt) {\n if (closest(elt, htmx.config.disableSelector)) {\n cleanUpElement(elt)\n return\n }\n const nodeData = getInternalData(elt)\n const attrHash = attributeHash(elt)\n if (nodeData.initHash !== attrHash) {\n // clean up any previously processed info\n deInitNode(elt)\n\n nodeData.initHash = attrHash\n\n triggerEvent(elt, 'htmx:beforeProcessNode')\n\n const triggerSpecs = getTriggerSpecs(elt)\n const hasExplicitHttpAction = processVerbs(elt, nodeData, triggerSpecs)\n\n if (!hasExplicitHttpAction) {\n if (getClosestAttributeValue(elt, 'hx-boost') === 'true') {\n boostElement(elt, nodeData, triggerSpecs)\n } else if (hasAttribute(elt, 'hx-trigger')) {\n triggerSpecs.forEach(function(triggerSpec) {\n // For \"naked\" triggers, don't do anything at all\n addTriggerHandler(elt, triggerSpec, nodeData, function() {\n })\n })\n }\n }\n\n // Handle submit buttons/inputs that have the form attribute set\n // see https://developer.mozilla.org/docs/Web/HTML/Element/button\n if (elt.tagName === 'FORM' || (getRawAttribute(elt, 'type') === 'submit' && hasAttribute(elt, 'form'))) {\n initButtonTracking(elt)\n }\n\n nodeData.firstInitCompleted = true\n triggerEvent(elt, 'htmx:afterProcessNode')\n }\n }\n\n /**\n * Processes new content, enabling htmx behavior. This can be useful if you have content that is added to the DOM outside of the normal htmx request cycle but still want htmx attributes to work.\n *\n * @see https://htmx.org/api/#process\n *\n * @param {Element|string} elt element to process\n */\n function processNode(elt) {\n elt = resolveTarget(elt)\n if (closest(elt, htmx.config.disableSelector)) {\n cleanUpElement(elt)\n return\n }\n initNode(elt)\n forEach(findElementsToProcess(elt), function(child) { initNode(child) })\n forEach(findHxOnWildcardElements(elt), processHxOnWildcard)\n }\n\n //= ===================================================================\n // Event/Log Support\n //= ===================================================================\n\n /**\n * @param {string} str\n * @returns {string}\n */\n function kebabEventName(str) {\n return str.replace(/([a-z0-9])([A-Z])/g, '$1-$2').toLowerCase()\n }\n\n /**\n * @param {string} eventName\n * @param {any} detail\n * @returns {CustomEvent}\n */\n function makeEvent(eventName, detail) {\n let evt\n if (window.CustomEvent && typeof window.CustomEvent === 'function') {\n // TODO: `composed: true` here is a hack to make global event handlers work with events in shadow DOM\n // This breaks expected encapsulation but needs to be here until decided otherwise by core devs\n evt = new CustomEvent(eventName, { bubbles: true, cancelable: true, composed: true, detail })\n } else {\n evt = getDocument().createEvent('CustomEvent')\n evt.initCustomEvent(eventName, true, true, detail)\n }\n return evt\n }\n\n /**\n * @param {EventTarget|string} elt\n * @param {string} eventName\n * @param {any=} detail\n */\n function triggerErrorEvent(elt, eventName, detail) {\n triggerEvent(elt, eventName, mergeObjects({ error: eventName }, detail))\n }\n\n /**\n * @param {string} eventName\n * @returns {boolean}\n */\n function ignoreEventForLogging(eventName) {\n return eventName === 'htmx:afterProcessNode'\n }\n\n /**\n * `withExtensions` locates all active extensions for a provided element, then\n * executes the provided function using each of the active extensions. It should\n * be called internally at every extendable execution point in htmx.\n *\n * @param {Element} elt\n * @param {(extension:HtmxExtension) => void} toDo\n * @returns void\n */\n function withExtensions(elt, toDo) {\n forEach(getExtensions(elt), function(extension) {\n try {\n toDo(extension)\n } catch (e) {\n logError(e)\n }\n })\n }\n\n function logError(msg) {\n if (console.error) {\n console.error(msg)\n } else if (console.log) {\n console.log('ERROR: ', msg)\n }\n }\n\n /**\n * Triggers a given event on an element\n *\n * @see https://htmx.org/api/#trigger\n *\n * @param {EventTarget|string} elt the element to trigger the event on\n * @param {string} eventName the name of the event to trigger\n * @param {any=} detail details for the event\n * @returns {boolean}\n */\n function triggerEvent(elt, eventName, detail) {\n elt = resolveTarget(elt)\n if (detail == null) {\n detail = {}\n }\n detail.elt = elt\n const event = makeEvent(eventName, detail)\n if (htmx.logger && !ignoreEventForLogging(eventName)) {\n htmx.logger(elt, eventName, detail)\n }\n if (detail.error) {\n logError(detail.error)\n triggerEvent(elt, 'htmx:error', { errorInfo: detail })\n }\n let eventResult = elt.dispatchEvent(event)\n const kebabName = kebabEventName(eventName)\n if (eventResult && kebabName !== eventName) {\n const kebabedEvent = makeEvent(kebabName, event.detail)\n eventResult = eventResult && elt.dispatchEvent(kebabedEvent)\n }\n withExtensions(asElement(elt), function(extension) {\n eventResult = eventResult && (extension.onEvent(eventName, event) !== false && !event.defaultPrevented)\n })\n return eventResult\n }\n\n //= ===================================================================\n // History Support\n //= ===================================================================\n let currentPathForHistory = location.pathname + location.search\n\n /**\n * @returns {Element}\n */\n function getHistoryElement() {\n const historyElt = getDocument().querySelector('[hx-history-elt],[data-hx-history-elt]')\n return historyElt || getDocument().body\n }\n\n /**\n * @param {string} url\n * @param {Element} rootElt\n */\n function saveToHistoryCache(url, rootElt) {\n if (!canAccessLocalStorage()) {\n return\n }\n\n // get state to save\n const innerHTML = cleanInnerHtmlForHistory(rootElt)\n const title = getDocument().title\n const scroll = window.scrollY\n\n if (htmx.config.historyCacheSize <= 0) {\n // make sure that an eventually already existing cache is purged\n localStorage.removeItem('htmx-history-cache')\n return\n }\n\n url = normalizePath(url)\n\n const historyCache = parseJSON(localStorage.getItem('htmx-history-cache')) || []\n for (let i = 0; i < historyCache.length; i++) {\n if (historyCache[i].url === url) {\n historyCache.splice(i, 1)\n break\n }\n }\n\n /** @type HtmxHistoryItem */\n const newHistoryItem = { url, content: innerHTML, title, scroll }\n\n triggerEvent(getDocument().body, 'htmx:historyItemCreated', { item: newHistoryItem, cache: historyCache })\n\n historyCache.push(newHistoryItem)\n while (historyCache.length > htmx.config.historyCacheSize) {\n historyCache.shift()\n }\n\n // keep trying to save the cache until it succeeds or is empty\n while (historyCache.length > 0) {\n try {\n localStorage.setItem('htmx-history-cache', JSON.stringify(historyCache))\n break\n } catch (e) {\n triggerErrorEvent(getDocument().body, 'htmx:historyCacheError', { cause: e, cache: historyCache })\n historyCache.shift() // shrink the cache and retry\n }\n }\n }\n\n /**\n * @typedef {Object} HtmxHistoryItem\n * @property {string} url\n * @property {string} content\n * @property {string} title\n * @property {number} scroll\n */\n\n /**\n * @param {string} url\n * @returns {HtmxHistoryItem|null}\n */\n function getCachedHistory(url) {\n if (!canAccessLocalStorage()) {\n return null\n }\n\n url = normalizePath(url)\n\n const historyCache = parseJSON(localStorage.getItem('htmx-history-cache')) || []\n for (let i = 0; i < historyCache.length; i++) {\n if (historyCache[i].url === url) {\n return historyCache[i]\n }\n }\n return null\n }\n\n /**\n * @param {Element} elt\n * @returns {string}\n */\n function cleanInnerHtmlForHistory(elt) {\n const className = htmx.config.requestClass\n const clone = /** @type Element */ (elt.cloneNode(true))\n forEach(findAll(clone, '.' + className), function(child) {\n removeClassFromElement(child, className)\n })\n // remove the disabled attribute for any element disabled due to an htmx request\n forEach(findAll(clone, '[data-disabled-by-htmx]'), function(child) {\n child.removeAttribute('disabled')\n })\n return clone.innerHTML\n }\n\n function saveCurrentPageToHistory() {\n const elt = getHistoryElement()\n const path = currentPathForHistory || location.pathname + location.search\n\n // Allow history snapshot feature to be disabled where hx-history=\"false\"\n // is present *anywhere* in the current document we're about to save,\n // so we can prevent privileged data entering the cache.\n // The page will still be reachable as a history entry, but htmx will fetch it\n // live from the server onpopstate rather than look in the localStorage cache\n let disableHistoryCache\n try {\n disableHistoryCache = getDocument().querySelector('[hx-history=\"false\" i],[data-hx-history=\"false\" i]')\n } catch (e) {\n // IE11: insensitive modifier not supported so fallback to case sensitive selector\n disableHistoryCache = getDocument().querySelector('[hx-history=\"false\"],[data-hx-history=\"false\"]')\n }\n if (!disableHistoryCache) {\n triggerEvent(getDocument().body, 'htmx:beforeHistorySave', { path, historyElt: elt })\n saveToHistoryCache(path, elt)\n }\n\n if (htmx.config.historyEnabled) history.replaceState({ htmx: true }, getDocument().title, window.location.href)\n }\n\n /**\n * @param {string} path\n */\n function pushUrlIntoHistory(path) {\n // remove the cache buster parameter, if any\n if (htmx.config.getCacheBusterParam) {\n path = path.replace(/org\\.htmx\\.cache-buster=[^&]*&?/, '')\n if (endsWith(path, '&') || endsWith(path, '?')) {\n path = path.slice(0, -1)\n }\n }\n if (htmx.config.historyEnabled) {\n history.pushState({ htmx: true }, '', path)\n }\n currentPathForHistory = path\n }\n\n /**\n * @param {string} path\n */\n function replaceUrlInHistory(path) {\n if (htmx.config.historyEnabled) history.replaceState({ htmx: true }, '', path)\n currentPathForHistory = path\n }\n\n /**\n * @param {HtmxSettleTask[]} tasks\n */\n function settleImmediately(tasks) {\n forEach(tasks, function(task) {\n task.call(undefined)\n })\n }\n\n /**\n * @param {string} path\n */\n function loadHistoryFromServer(path) {\n const request = new XMLHttpRequest()\n const details = { path, xhr: request }\n triggerEvent(getDocument().body, 'htmx:historyCacheMiss', details)\n request.open('GET', path, true)\n request.setRequestHeader('HX-Request', 'true')\n request.setRequestHeader('HX-History-Restore-Request', 'true')\n request.setRequestHeader('HX-Current-URL', getDocument().location.href)\n request.onload = function() {\n if (this.status >= 200 && this.status < 400) {\n triggerEvent(getDocument().body, 'htmx:historyCacheMissLoad', details)\n const fragment = makeFragment(this.response)\n /** @type ParentNode */\n const content = fragment.querySelector('[hx-history-elt],[data-hx-history-elt]') || fragment\n const historyElement = getHistoryElement()\n const settleInfo = makeSettleInfo(historyElement)\n handleTitle(fragment.title)\n\n handlePreservedElements(fragment)\n swapInnerHTML(historyElement, content, settleInfo)\n restorePreservedElements()\n settleImmediately(settleInfo.tasks)\n currentPathForHistory = path\n triggerEvent(getDocument().body, 'htmx:historyRestore', { path, cacheMiss: true, serverResponse: this.response })\n } else {\n triggerErrorEvent(getDocument().body, 'htmx:historyCacheMissLoadError', details)\n }\n }\n request.send()\n }\n\n /**\n * @param {string} [path]\n */\n function restoreHistory(path) {\n saveCurrentPageToHistory()\n path = path || location.pathname + location.search\n const cached = getCachedHistory(path)\n if (cached) {\n const fragment = makeFragment(cached.content)\n const historyElement = getHistoryElement()\n const settleInfo = makeSettleInfo(historyElement)\n handleTitle(cached.title)\n handlePreservedElements(fragment)\n swapInnerHTML(historyElement, fragment, settleInfo)\n restorePreservedElements()\n settleImmediately(settleInfo.tasks)\n getWindow().setTimeout(function() {\n window.scrollTo(0, cached.scroll)\n }, 0) // next 'tick', so browser has time to render layout\n currentPathForHistory = path\n triggerEvent(getDocument().body, 'htmx:historyRestore', { path, item: cached })\n } else {\n if (htmx.config.refreshOnHistoryMiss) {\n // @ts-ignore: optional parameter in reload() function throws error\n // noinspection JSUnresolvedReference\n window.location.reload(true)\n } else {\n loadHistoryFromServer(path)\n }\n }\n }\n\n /**\n * @param {Element} elt\n * @returns {Element[]}\n */\n function addRequestIndicatorClasses(elt) {\n let indicators = /** @type Element[] */ (findAttributeTargets(elt, 'hx-indicator'))\n if (indicators == null) {\n indicators = [elt]\n }\n forEach(indicators, function(ic) {\n const internalData = getInternalData(ic)\n internalData.requestCount = (internalData.requestCount || 0) + 1\n ic.classList.add.call(ic.classList, htmx.config.requestClass)\n })\n return indicators\n }\n\n /**\n * @param {Element} elt\n * @returns {Element[]}\n */\n function disableElements(elt) {\n let disabledElts = /** @type Element[] */ (findAttributeTargets(elt, 'hx-disabled-elt'))\n if (disabledElts == null) {\n disabledElts = []\n }\n forEach(disabledElts, function(disabledElement) {\n const internalData = getInternalData(disabledElement)\n internalData.requestCount = (internalData.requestCount || 0) + 1\n disabledElement.setAttribute('disabled', '')\n disabledElement.setAttribute('data-disabled-by-htmx', '')\n })\n return disabledElts\n }\n\n /**\n * @param {Element[]} indicators\n * @param {Element[]} disabled\n */\n function removeRequestIndicators(indicators, disabled) {\n forEach(indicators.concat(disabled), function(ele) {\n const internalData = getInternalData(ele)\n internalData.requestCount = (internalData.requestCount || 1) - 1\n })\n forEach(indicators, function(ic) {\n const internalData = getInternalData(ic)\n if (internalData.requestCount === 0) {\n ic.classList.remove.call(ic.classList, htmx.config.requestClass)\n }\n })\n forEach(disabled, function(disabledElement) {\n const internalData = getInternalData(disabledElement)\n if (internalData.requestCount === 0) {\n disabledElement.removeAttribute('disabled')\n disabledElement.removeAttribute('data-disabled-by-htmx')\n }\n })\n }\n\n //= ===================================================================\n // Input Value Processing\n //= ===================================================================\n\n /**\n * @param {Element[]} processed\n * @param {Element} elt\n * @returns {boolean}\n */\n function haveSeenNode(processed, elt) {\n for (let i = 0; i < processed.length; i++) {\n const node = processed[i]\n if (node.isSameNode(elt)) {\n return true\n }\n }\n return false\n }\n\n /**\n * @param {Element} element\n * @return {boolean}\n */\n function shouldInclude(element) {\n // Cast to trick tsc, undefined values will work fine here\n const elt = /** @type {HTMLInputElement} */ (element)\n if (elt.name === '' || elt.name == null || elt.disabled || closest(elt, 'fieldset[disabled]')) {\n return false\n }\n // ignore \"submitter\" types (see jQuery src/serialize.js)\n if (elt.type === 'button' || elt.type === 'submit' || elt.tagName === 'image' || elt.tagName === 'reset' || elt.tagName === 'file') {\n return false\n }\n if (elt.type === 'checkbox' || elt.type === 'radio') {\n return elt.checked\n }\n return true\n }\n\n /** @param {string} name\n * @param {string|Array|FormDataEntryValue} value\n * @param {FormData} formData */\n function addValueToFormData(name, value, formData) {\n if (name != null && value != null) {\n if (Array.isArray(value)) {\n value.forEach(function(v) { formData.append(name, v) })\n } else {\n formData.append(name, value)\n }\n }\n }\n\n /** @param {string} name\n * @param {string|Array} value\n * @param {FormData} formData */\n function removeValueFromFormData(name, value, formData) {\n if (name != null && value != null) {\n let values = formData.getAll(name)\n if (Array.isArray(value)) {\n values = values.filter(v => value.indexOf(v) < 0)\n } else {\n values = values.filter(v => v !== value)\n }\n formData.delete(name)\n forEach(values, v => formData.append(name, v))\n }\n }\n\n /**\n * @param {Element[]} processed\n * @param {FormData} formData\n * @param {HtmxElementValidationError[]} errors\n * @param {Element|HTMLInputElement|HTMLSelectElement|HTMLFormElement} elt\n * @param {boolean} validate\n */\n function processInputValue(processed, formData, errors, elt, validate) {\n if (elt == null || haveSeenNode(processed, elt)) {\n return\n } else {\n processed.push(elt)\n }\n if (shouldInclude(elt)) {\n const name = getRawAttribute(elt, 'name')\n // @ts-ignore value will be undefined for non-input elements, which is fine\n let value = elt.value\n if (elt instanceof HTMLSelectElement && elt.multiple) {\n value = toArray(elt.querySelectorAll('option:checked')).map(function(e) { return (/** @type HTMLOptionElement */(e)).value })\n }\n // include file inputs\n if (elt instanceof HTMLInputElement && elt.files) {\n value = toArray(elt.files)\n }\n addValueToFormData(name, value, formData)\n if (validate) {\n validateElement(elt, errors)\n }\n }\n if (elt instanceof HTMLFormElement) {\n forEach(elt.elements, function(input) {\n if (processed.indexOf(input) >= 0) {\n // The input has already been processed and added to the values, but the FormData that will be\n // constructed right after on the form, will include it once again. So remove that input's value\n // now to avoid duplicates\n removeValueFromFormData(input.name, input.value, formData)\n } else {\n processed.push(input)\n }\n if (validate) {\n validateElement(input, errors)\n }\n })\n new FormData(elt).forEach(function(value, name) {\n if (value instanceof File && value.name === '') {\n return // ignore no-name files\n }\n addValueToFormData(name, value, formData)\n })\n }\n }\n\n /**\n *\n * @param {Element} elt\n * @param {HtmxElementValidationError[]} errors\n */\n function validateElement(elt, errors) {\n const element = /** @type {HTMLElement & ElementInternals} */ (elt)\n if (element.willValidate) {\n triggerEvent(element, 'htmx:validation:validate')\n if (!element.checkValidity()) {\n errors.push({ elt: element, message: element.validationMessage, validity: element.validity })\n triggerEvent(element, 'htmx:validation:failed', { message: element.validationMessage, validity: element.validity })\n }\n }\n }\n\n /**\n * Override values in the one FormData with those from another.\n * @param {FormData} receiver the formdata that will be mutated\n * @param {FormData} donor the formdata that will provide the overriding values\n * @returns {FormData} the {@linkcode receiver}\n */\n function overrideFormData(receiver, donor) {\n for (const key of donor.keys()) {\n receiver.delete(key)\n }\n donor.forEach(function(value, key) {\n receiver.append(key, value)\n })\n return receiver\n }\n\n /**\n * @param {Element|HTMLFormElement} elt\n * @param {HttpVerb} verb\n * @returns {{errors: HtmxElementValidationError[], formData: FormData, values: Object}}\n */\n function getInputValues(elt, verb) {\n /** @type Element[] */\n const processed = []\n const formData = new FormData()\n const priorityFormData = new FormData()\n /** @type HtmxElementValidationError[] */\n const errors = []\n const internalData = getInternalData(elt)\n if (internalData.lastButtonClicked && !bodyContains(internalData.lastButtonClicked)) {\n internalData.lastButtonClicked = null\n }\n\n // only validate when form is directly submitted and novalidate or formnovalidate are not set\n // or if the element has an explicit hx-validate=\"true\" on it\n let validate = (elt instanceof HTMLFormElement && elt.noValidate !== true) || getAttributeValue(elt, 'hx-validate') === 'true'\n if (internalData.lastButtonClicked) {\n validate = validate && internalData.lastButtonClicked.formNoValidate !== true\n }\n\n // for a non-GET include the closest form\n if (verb !== 'get') {\n processInputValue(processed, priorityFormData, errors, closest(elt, 'form'), validate)\n }\n\n // include the element itself\n processInputValue(processed, formData, errors, elt, validate)\n\n // if a button or submit was clicked last, include its value\n if (internalData.lastButtonClicked || elt.tagName === 'BUTTON' ||\n (elt.tagName === 'INPUT' && getRawAttribute(elt, 'type') === 'submit')) {\n const button = internalData.lastButtonClicked || (/** @type HTMLInputElement|HTMLButtonElement */(elt))\n const name = getRawAttribute(button, 'name')\n addValueToFormData(name, button.value, priorityFormData)\n }\n\n // include any explicit includes\n const includes = findAttributeTargets(elt, 'hx-include')\n forEach(includes, function(node) {\n processInputValue(processed, formData, errors, asElement(node), validate)\n // if a non-form is included, include any input values within it\n if (!matches(node, 'form')) {\n forEach(asParentNode(node).querySelectorAll(INPUT_SELECTOR), function(descendant) {\n processInputValue(processed, formData, errors, descendant, validate)\n })\n }\n })\n\n // values from a