bootstrap5-toggle 5.3.0 → 5.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -73,18 +73,18 @@ See EOL for each version in [Security Policy Page](https://github.com/palcarazm/
73
73
 
74
74
  ```html
75
75
  <link
76
- href="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@5.3.0/css/bootstrap5-toggle.min.css"
76
+ href="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@5.3.1/css/bootstrap5-toggle.min.css"
77
77
  rel="stylesheet" />
78
- <script src="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@5.3.0/js/bootstrap5-toggle.ecmas.min.js"></script>
78
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@5.3.1/js/bootstrap5-toggle.ecmas.min.js"></script>
79
79
  ```
80
80
 
81
81
  ### jQuery Interface
82
82
 
83
83
  ```html
84
84
  <link
85
- href="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@5.3.0/css/bootstrap5-toggle.min.css"
85
+ href="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@5.3.1/css/bootstrap5-toggle.min.css"
86
86
  rel="stylesheet" />
87
- <script src="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@5.3.0/js/bootstrap5-toggle.jquery.min.js"></script>
87
+ <script src="https://cdn.jsdelivr.net/npm/bootstrap5-toggle@5.3.1/js/bootstrap5-toggle.jquery.min.js"></script>
88
88
  ```
89
89
 
90
90
  ## Download
@@ -96,13 +96,13 @@ See EOL for each version in [Security Policy Page](https://github.com/palcarazm/
96
96
  [![NPM Badge](https://img.shields.io/npm/dm/bootstrap5-toggle?logo=npm)](https://www.npmjs.com/package/bootstrap5-toggle)
97
97
 
98
98
  ```ksh
99
- npm install bootstrap5-toggle@5.3.0
99
+ npm install bootstrap5-toggle@5.3.1
100
100
  ```
101
101
 
102
102
  ## Yarn
103
103
 
104
104
  ```ksh
105
- yarn add bootstrap5-toggle@5.3.0
105
+ yarn add bootstrap5-toggle@5.3.1
106
106
  ```
107
107
 
108
108
  # Usage
@@ -1,5 +1,5 @@
1
1
  /* Copyright Notice
2
- * bootstrap5-toggle v5.3.0
2
+ * bootstrap5-toggle v5.3.1
3
3
  * https://palcarazm.github.io/bootstrap5-toggle/
4
4
  * @author 2011-2014 Min Hur (https://github.com/minhur)
5
5
  * @author 2018-2019 Brent Ely (https://github.com/gitbrent)
@@ -1,5 +1,5 @@
1
1
  /* Copyright Notice
2
- * bootstrap5-toggle v5.3.0
2
+ * bootstrap5-toggle v5.3.1
3
3
  * https://palcarazm.github.io/bootstrap5-toggle/
4
4
  * @author 2011-2014 Min Hur (https://github.com/minhur)
5
5
  * @author 2018-2019 Brent Ely (https://github.com/gitbrent)
@@ -0,0 +1,13 @@
1
+ /* Copyright Notice
2
+ * bootstrap5-toggle v5.3.1
3
+ * https://palcarazm.github.io/bootstrap5-toggle/
4
+ * @author 2011-2014 Min Hur (https://github.com/minhur)
5
+ * @author 2018-2019 Brent Ely (https://github.com/gitbrent)
6
+ * @author 2022 Pablo Alcaraz Martínez (https://github.com/palcarazm)
7
+ * @funding GitHub Sponsors
8
+ * @see https://github.com/sponsors/palcarazm
9
+ * @license MIT
10
+ * @see https://github.com/palcarazm/bootstrap5-toggle/blob/master/LICENSE
11
+ */
12
+
13
+ "use strict";var t,e,i;!function(t){t.ON="on",t.OFF="off",t.MIXED="mixed"}(t||(t={})),function(t){t.ENABLED="enabled",t.DISABLED="disabled",t.READONLY="readonly"}(e||(e={})),function(t){t.NEXT="next",t.ON="on",t.OFF="off",t.TOGGLE="toggle",t.DETERMINATE="determinate",t.INDETERMINATE="indeterminate",t.READONLY="readonly",t.DISABLE="disable",t.ENABLE="enable"}(i||(i={}));var n,o,s=function(){function i(t,e,n){this.isBuilt=!1,this.lastState=n,this.onStyle="btn-".concat(e.onstyle),this.offStyle="btn-".concat(e.offstyle),this.name=e.name,this.checkbox=t,e.onvalue&&(this.checkbox.value=e.onvalue),this.invCheckbox=e.offvalue?this.createInvCheckbox(e.offvalue):null,this.sizeClass=i.sizeResolver(e.size),this.toggleOn=this.createToggleSpan(e.onlabel,this.onStyle,e.ontitle),this.toggleOff=this.createToggleSpan(e.offlabel,this.offStyle,e.offtitle),this.toggleHandle=this.createToggleHandle(),this.toggleGroup=this.createToggleGroup(),this.toggle=document.createElement("div"),e.tooltip&&(this.tooltipLabels=e.tooltip.title),this.isVisible()?(this.renderToggle(e),this.render(n)):this.deferRender(e)}return i.prototype.isVisible=function(){var t=this.checkbox.parentElement;return!!t&&t.offsetWidth>0&&t.offsetHeight>0},i.prototype.deferRender=function(t){var e=this;this.resizeObserver=new ResizeObserver(function(i){if(e.isBuilt)e.resizeObserver.disconnect();else for(var n=0,o=i;n<o.length;n++){var s=o[n];if(s.contentRect.width>0&&s.contentRect.height>0)return e.renderToggle(t),e.render(e.lastState),e.isBuilt=!0,void e.resizeObserver.disconnect()}}),this.resizeObserver.observe(this.checkbox.parentElement)},i.sizeResolver=function(t){var e;return null!==(e={large:"btn-lg",lg:"btn-lg",small:"btn-sm",sm:"btn-sm",mini:"btn-xs",xs:"btn-xs"}[t])&&void 0!==e?e:""},i.prototype.createInvCheckbox=function(t){var e=this.checkbox.cloneNode(!0);return e.value=t,e.dataset.toggle="invert-toggle",e.removeAttribute("id"),e},i.prototype.renderToggle=function(t){var e,i=t.style,n=t.width,o=t.height,s=t.tabindex,r=t.aria,a=t.tooltip;this.toggle.className="toggle btn ".concat(this.sizeClass," ").concat(i),this.toggle.dataset.toggle="toggle",this.toggle.tabIndex=s,this.toggle.role="switch",this.checkbox.tabIndex=-1,this.invCheckbox&&(this.invCheckbox.tabIndex=-1),null===(e=this.checkbox.parentElement)||void 0===e||e.insertBefore(this.toggle,this.checkbox),this.toggle.appendChild(this.checkbox),this.invCheckbox&&this.toggle.appendChild(this.invCheckbox),this.toggle.appendChild(this.toggleGroup),this.handleLabels(r),this.handleToggleSize(n,o),a&&this.createTooltip(a),this.isBuilt=!0},i.prototype.createToggleGroup=function(){var t=document.createElement("div");return t.className="toggle-group",t.appendChild(this.toggleOn),t.appendChild(this.toggleOff),t.appendChild(this.toggleHandle),t},i.prototype.createToggleSpan=function(t,e,i){var n=document.createElement("span");return n.className="btn ".concat(this.sizeClass," ").concat(e),n.innerHTML=t,i&&(n.title=i),n},i.prototype.createToggleHandle=function(){var t=document.createElement("span");return t.className="toggle-handle btn ".concat(this.sizeClass),t},i.prototype.handleToggleSize=function(t,e){var i=this;this.cancelPendingAnimationFrame(),"function"==typeof requestAnimationFrame?this.requestAnimationFrameId=requestAnimationFrame(function(){try{i.calculateToggleSize(t,e)}catch(t){console.warn("Error calculating toggle size:",t)}}):this.calculateToggleSize(t,e)},i.prototype.calculateToggleSize=function(t,e){t?this.toggle.style.width=t:(this.toggle.style.minWidth="100px",this.toggle.style.minWidth="".concat(Math.max(this.toggleOn.getBoundingClientRect().width,this.toggleOff.getBoundingClientRect().width)+this.toggleHandle.getBoundingClientRect().width/2,"px")),e?this.toggle.style.height=e:(this.toggle.style.minHeight="36px",this.toggle.style.minHeight="".concat(Math.max(this.toggleOn.getBoundingClientRect().height,this.toggleOff.getBoundingClientRect().height),"px")),this.toggleOn.classList.add("toggle-on"),this.toggleOff.classList.add("toggle-off"),e&&(this.toggleOn.style.lineHeight=i.calcH(this.toggleOn)+"px",this.toggleOff.style.lineHeight=i.calcH(this.toggleOff)+"px")},i.calcH=function(t){var e=globalThis.window.getComputedStyle(t),i=t.offsetHeight,n=Number.parseFloat(e.borderTopWidth);return i-Number.parseFloat(e.borderBottomWidth)-n-Number.parseFloat(e.paddingTop)-Number.parseFloat(e.paddingBottom)},i.prototype.cancelPendingAnimationFrame=function(){void 0!==this.requestAnimationFrameId&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(this.requestAnimationFrameId),this.requestAnimationFrameId=void 0)},i.prototype.handleLabels=function(t){var e;if(null===(e=this.checkbox.labels)||void 0===e?void 0:e.length){var i=Array.from(this.checkbox.labels).map(function(t){return t.id}).filter(Boolean);i.length&&this.toggle.setAttribute("aria-labelledby",i.join(" "))}else this.toggle.setAttribute("aria-label",t.label)},i.prototype.createTooltip=function(t){try{this.tooltip=new globalThis.window.bootstrap.Tooltip(this.toggle,{placement:t.placement,html:!0,title:t.title.on})}catch(t){console.error("Error creating tooltip:",t)}},i.prototype.render=function(t){this.lastState=t,this.isBuilt&&(this.updateToggleByValue(t),this.updateToggleByChecked(t),this.updateToggleByState(t),this.updateAria(t),this.updateTooltip(t))},i.prototype.updateToggleByValue=function(e){switch(this.toggle.classList.remove(this.onStyle,this.offStyle,"off","indeterminate"),e.value){case t.ON:this.toggle.classList.add(this.onStyle);break;case t.OFF:this.toggle.classList.add(this.offStyle,"off");break;case t.MIXED:this.toggle.classList.add("indeterminate"),e.checked?this.toggle.classList.add(this.onStyle):this.toggle.classList.add(this.offStyle,"off")}},i.prototype.updateToggleByChecked=function(t){this.updateCheckboxByChecked(t),this.updateInvCheckboxByChecked(t)},i.prototype.updateCheckboxByChecked=function(t){switch(this.checkbox.checked=t.checked,t.status){case e.ENABLED:this.checkbox.disabled=!1,this.checkbox.readOnly=!1,this.toggle.classList.remove("disabled"),this.toggle.removeAttribute("disabled");break;case e.DISABLED:this.checkbox.disabled=!0,this.checkbox.readOnly=!1,this.toggle.classList.add("disabled"),this.toggle.setAttribute("disabled","");break;case e.READONLY:this.checkbox.disabled=!1,this.checkbox.readOnly=!0,this.toggle.classList.add("disabled"),this.toggle.setAttribute("disabled","")}},i.prototype.updateInvCheckboxByChecked=function(t){if(this.invCheckbox)switch(this.invCheckbox.checked=!t.checked,t.status){case e.ENABLED:this.invCheckbox.disabled=!1,this.invCheckbox.readOnly=!1;break;case e.DISABLED:this.invCheckbox.disabled=!0,this.invCheckbox.readOnly=!1;break;case e.READONLY:this.invCheckbox.disabled=!1,this.invCheckbox.readOnly=!0}},i.prototype.updateToggleByState=function(t){t.indeterminate?(this.checkbox.indeterminate=!0,this.checkbox.removeAttribute("name"),this.invCheckbox&&(this.invCheckbox.indeterminate=!0),this.invCheckbox&&this.invCheckbox.removeAttribute("name")):(this.checkbox.indeterminate=!1,this.name&&(this.checkbox.name=this.name),this.invCheckbox&&(this.invCheckbox.indeterminate=!1),this.invCheckbox&&this.name&&(this.invCheckbox.name=this.name))},i.prototype.updateAria=function(t){t.indeterminate?this.toggle.setAttribute("aria-checked","mixed"):this.toggle.setAttribute("aria-checked",String(t.checked)),this.toggle.setAttribute("aria-disabled",String(t.status===e.DISABLED)),this.toggle.setAttribute("aria-readonly",String(t.status===e.READONLY))},i.prototype.updateTooltip=function(e){if(this.tooltip&&this.tooltipLabels)switch(e.value){case t.ON:return void this.tooltip.setContent({".tooltip-inner":this.tooltipLabels.on});case t.OFF:return void this.tooltip.setContent({".tooltip-inner":this.tooltipLabels.off});case t.MIXED:return void(this.tooltipLabels.mixed&&this.tooltip.setContent({".tooltip-inner":this.tooltipLabels.mixed}))}},Object.defineProperty(i.prototype,"root",{get:function(){return this.toggle},enumerable:!1,configurable:!0}),i.prototype.destroy=function(){var t,e;this.cancelPendingAnimationFrame(),this.tooltip&&(this.tooltip.dispose(),this.tooltip=void 0),null===(t=this.toggle.parentNode)||void 0===t||t.insertBefore(this.checkbox,this.toggle),this.toggle.remove(),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),this.resizeObserver=void 0,this.isBuilt=!1},i}();function r(t,e){if(!t)return t;switch(e.mode){case n.HTML:return i=t,o={allowedTags:["b","i","strong","em","span","small","sup","sub","img"],allowedAttributes:["class","style","src","alt","title","data-*"]},s=(new DOMParser).parseFromString(i,"text/html"),Array.from(s.body.childNodes).forEach(function(t){return function(t,e){var i=function(t){var n;if(t.nodeType===Node.ELEMENT_NODE){var o=t,s=o.tagName.toLowerCase();if(!e.allowedTags.includes(s)){var r=document.createDocumentFragment();return Array.from(o.childNodes).forEach(function(t){r.appendChild(t.cloneNode(!0))}),void(null===(n=o.parentNode)||void 0===n||n.replaceChild(r,o))}Array.from(o.attributes).forEach(function(t){var i=t.name.toLowerCase();e.allowedAttributes.some(function(t){return t.endsWith("*")?i.startsWith(t.slice(0,-1)):i===t})?function(t,e,i){if("src"===i||"href"===i){var n=e.value.toLowerCase();(n.startsWith("javascript:")||n.startsWith("vbscript:")||n.startsWith("data:")&&!n.startsWith("data:image/"))&&t.removeAttribute(e.name)}}(o,t,i):o.removeAttribute(t.name)}),Array.from(o.childNodes).forEach(i)}else if(t.nodeType===Node.TEXT_NODE)return};i(t)}(t,o)}),s.body.innerHTML;case n.TEXT:return function(t){var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return t.replace(/[&<>"'/]/g,function(t){return e[t]})}(t)}var i,o,s}function a(t){return/^[+-]?\d+(\.\d+)?$/.test(t.toString().trim())}!function(t){t.HTML="HTML",t.TEXT="TEXT"}(n||(n={})),function(t){t.TOP="top",t.BOTTOM="bottom",t.LEFT="left",t.RIGHT="right"}(o||(o={}));var l,h=function(){function t(){}return t.getAttr=function(t,e,i){var o=(null!=i?i:{}).sanitized,s=void 0===o?n.TEXT:o;return r(t.getAttribute(e),{mode:s})},t.getAttrOrDefault=function(e,i,o,s,a){void 0===a&&(a=n.TEXT);var l="string"==typeof o?r(o,{mode:a}):o;return t.getAttr(e,i,{sanitized:a})||l||s},t.getAttrOrDeprecation=function(e,i,o,s){void 0===s&&(s=n.TEXT);var a="string"==typeof o?r(o,{mode:s}):o;return t.getAttr(e,i,{sanitized:s})||a||d.value},t.resolve=function(e,i){var o;void 0===i&&(i={});var s={onlabel:this.getAttrOrDeprecation(e,"data-onlabel",i.onlabel,n.HTML),offlabel:this.getAttrOrDeprecation(e,"data-offlabel",i.offlabel,n.HTML),onstyle:this.getAttrOrDefault(e,"data-onstyle",i.onstyle,t.DEFAULT.onstyle),offstyle:this.getAttrOrDefault(e,"data-offstyle",i.offstyle,t.DEFAULT.offstyle),onvalue:this.getAttr(e,"value")||this.getAttrOrDefault(e,"data-onvalue",i.onvalue,t.DEFAULT.onvalue),offvalue:this.getAttrOrDefault(e,"data-offvalue",i.offvalue,t.DEFAULT.offvalue),ontitle:this.getAttrOrDefault(e,"data-ontitle",i.ontitle,t.getAttr(e,"title")||t.DEFAULT.ontitle),offtitle:this.getAttrOrDefault(e,"data-offtitle",i.offtitle,t.getAttr(e,"title")||t.DEFAULT.offtitle),size:this.getAttrOrDefault(e,"data-size",i.size,this.DEFAULT.size),style:this.getAttrOrDefault(e,"data-style",i.style,this.DEFAULT.style),width:this.getAttrOrDefault(e,"data-width",i.width,this.DEFAULT.width),height:this.getAttrOrDefault(e,"data-height",i.height,this.DEFAULT.height),tabindex:Number(this.getAttrOrDefault(e,"tabindex",i.tabindex,this.DEFAULT.tabindex)),tristate:e.hasAttribute("tristate")||i.tristate||t.DEFAULT.tristate,name:this.getAttrOrDefault(e,"name",i.name,this.DEFAULT.name),aria:{label:this.getAttrOrDefault(e,"aria-label",null===(o=i.aria)||void 0===o?void 0:o.label,this.DEFAULT.aria.label)},tooltip:t.resolveTooltipOptions(e,i)};return s.width&&a(s.width)&&(s.width="".concat(s.width,"px")),s.height&&a(s.height)&&(s.height="".concat(s.height,"px")),d.handle(s,e,i),s},t.resolveTooltipOptions=function(e,i){var s,r,a,l,h=this,c=function(t,i){return h.getAttrOrDefault(e,t,i,null,n.HTML)||h.getAttr(e,"data-tooltip-title",{sanitized:n.HTML})},d=c("data-tooltip-title-on",null===(s=i.tooltip)||void 0===s?void 0:s.title.on),u=c("data-tooltip-title-off",null===(r=i.tooltip)||void 0===r?void 0:r.title.off),p=c("data-tooltip-title-mixed",null===(a=i.tooltip)||void 0===a?void 0:a.title.mixed);if(!d||!u)return t.DEFAULT.tooltip;var g=this.getAttrOrDefault(e,"data-tooltip-placement",null===(l=i.tooltip)||void 0===l?void 0:l.placement,o.TOP);return{placement:Object.values(o).includes(g)?g:o.TOP,title:{on:d,off:u,mixed:null!=p?p:void 0}}},t.DEFAULT={onlabel:"On",onstyle:"primary",onvalue:null,ontitle:null,offlabel:"Off",offstyle:"secondary",offvalue:null,offtitle:null,size:"",style:"",width:null,height:null,tabindex:0,tristate:!1,name:null,aria:{label:"Toggle"},tooltip:void 0},t}();!function(t){t.ATTRIBUTE="attribute",t.OPTION="option"}(l||(l={}));var c,d=function(){function t(){}return t.handle=function(e,i,n){var o=this;this.deprecatedOptions.forEach(function(s){var a=s.currentOpt,c=s.deprecatedAttr,d=s.deprecatedOpt,u=s.mode;if(e[a]===t.value){var p=r(i.getAttribute(c),{mode:u});p?(o.log(l.ATTRIBUTE,c,"data-".concat(a)),e[a]=p):n[d]?(o.log(l.OPTION,d,a),e[a]=n[d]):e[a]=h.DEFAULT[a]}})},t.log=function(t,e,i){console.warn("Bootstrap Toggle deprecation warning: Using ".concat(e," ").concat(t," is deprecated. Use ").concat(i," instead."))},t.value="BOOTSTRAP TOGGLE DEPRECATION CHECK -- a0Jhux0QySypjjs4tLtEo8xT2kx0AbYaq9K6mgNjWSs0HF0L8T8J0M0o3Kr7zkm7 --",t.deprecatedOptions=[{currentOpt:"onlabel",deprecatedAttr:"data-on",deprecatedOpt:"on",mode:n.HTML},{currentOpt:"offlabel",deprecatedAttr:"data-off",deprecatedOpt:"off",mode:n.HTML}],t}(),u=function(){return u=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},u.apply(this,arguments)},p=function(){function n(t,e){this.isTristate=e,this.state=this.getElementState(t)}return n.prototype.getElementState=function(i){var n,o=i.checked;n=i.disabled?e.DISABLED:i.readOnly?e.READONLY:e.ENABLED;var s=this.isTristate&&i.indeterminate;return{value:s?t.MIXED:o?t.ON:t.OFF,checked:o,status:n,indeterminate:s}},n.prototype.get=function(){return Object.freeze(u({},this.state))},n.prototype.canInteract=function(){return this.state.status===e.ENABLED},n.prototype.sync=function(t){this.state=this.getElementState(t)},n.prototype.do=function(n){if([i.ON,i.OFF,i.TOGGLE,i.INDETERMINATE,i.DETERMINATE,i.NEXT,i.READONLY].includes(n)&&!this.canInteract())return!1;switch(n){case i.ON:return this.setValueIfChanged(t.ON,!0,!1);case i.OFF:return this.setValueIfChanged(t.OFF,!1,!1);case i.TOGGLE:return this.state.value===t.ON?this.do(i.OFF):this.state.value===t.OFF&&this.do(i.ON);case i.INDETERMINATE:return this.setValueIfChanged(t.MIXED,void 0,!0);case i.DETERMINATE:return this.state.value==t.MIXED&&this.setValue(this.state.checked?t.ON:t.OFF,this.state.checked,!1);case i.NEXT:return this.doNext();case i.DISABLE:return this.setStatusIfChanged(e.DISABLED);case i.ENABLE:return this.setStatusIfChanged(e.ENABLED);case i.READONLY:return this.setStatus(e.READONLY)}},n.prototype.setValue=function(t,e,i){return this.state=u(u({},this.state),{value:t,checked:null!=e?e:this.state.checked,indeterminate:null!=i?i:this.state.indeterminate}),!0},n.prototype.setValueIfChanged=function(t,e,i){return this.state.value!==t&&this.setValue(t,e,i)},n.prototype.setStatus=function(t){return this.state=u(u({},this.state),{status:t}),!0},n.prototype.setStatusIfChanged=function(t){return this.state.status!==t&&this.setStatus(t)},n.prototype.doNext=function(){return this.isTristate?this.state.value===t.ON||this.state.value===t.OFF?this.do(i.INDETERMINATE):this.state.value===t.MIXED&&(this.state.checked?this.do(i.OFF):this.do(i.ON)):this.state.value===t.ON?this.do(i.OFF):this.do(i.ON)},n}();!function(t){t.ON="toggle:on",t.OFF="toggle:off",t.MIXED="toggle:mixed",t.ENABLED="toggle:enabled",t.DISABLED="toggle:disabled",t.READONLY="toggle:readonly"}(c||(c={}));var g,f=c,v=function(){function e(t,e){var n=this;this.pointer=null,this.SCROLL_THRESHOLD=10,this.eventsBound=!1,this.suppressExternalSync=!1,this.originalDescriptors=new Map,this.onExternalChange=function(){n.update()},this.onFormReset=function(){setTimeout(function(){return n.onExternalChange()},0)},this.onPointerDown=function(t){"mouse"===t.pointerType&&0!==t.button||n.stateReducer.canInteract()&&(n.pointer={x:t.clientX,y:t.clientY},n.domBuilder.root.addEventListener("pointermove",n.onPointerMove,{passive:!0}),n.domBuilder.root.addEventListener("pointerup",n.onPointerUp,{passive:!0}),n.domBuilder.root.addEventListener("pointercancel",n.onPointerCancel,{passive:!0}))},this.onPointerMove=function(t){var e=Math.abs(t.clientX-n.pointer.x);(Math.abs(t.clientY-n.pointer.y)>n.SCROLL_THRESHOLD||e>n.domBuilder.root.offsetWidth)&&n.onPointerCancel()},this.onPointerUp=function(t){if("mouse"!==t.pointerType||0===t.button){var e=Math.abs(t.clientX-n.pointer.x);Math.abs(t.clientY-n.pointer.y)<=n.SCROLL_THRESHOLD&&e<=n.domBuilder.root.offsetWidth&&n.apply(i.NEXT),n.onPointerCancel()}else n.onPointerCancel()},this.onPointerCancel=function(){n.domBuilder.root.removeEventListener("pointermove",n.onPointerMove),n.domBuilder.root.removeEventListener("pointerup",n.onPointerUp),n.domBuilder.root.removeEventListener("pointercancel",n.onPointerCancel)},this.handlerKeyboardEvent=function(t){" "!==t.key&&"Enter"!==t.key||(t.preventDefault(),n.apply(i.NEXT))},this.handlerLabelEvent=function(t){t.preventDefault(),n.apply(i.NEXT),n.domBuilder.root.focus()},this.element=t,this.userOptions=e,this.options=h.resolve(t,e),this.stateReducer=new p(t,this.options.tristate),this.domBuilder=new s(t,this.options,this.stateReducer.get()),this.bindEventListeners(),this.interceptInputProperties(),this.element.bsToggle=this}return e.prototype.interceptInputProperties=function(){var t=this;["checked","disabled","readOnly","indeterminate"].forEach(function(e){var i=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t.element),e);(null==i?void 0:i.set)&&(t.originalDescriptors.set(e,i),Object.defineProperty(t.element,e,{configurable:!0,get:function(){return i.get.call(t.element)},set:function(e){i.set.call(t.element,e),t.suppressExternalSync||t.onExternalChange()}}))})},e.prototype.restoreInputProperties=function(){var t=this;this.originalDescriptors.forEach(function(e,i){Object.defineProperty(t.element,i,e)}),this.originalDescriptors.clear()},e.prototype.bindEventListeners=function(){this.eventsBound||(this.bindFormResetListener(),this.bindPointerEventListener(),this.bindKeyboardEventListener(),this.bindLabelEventListener(),this.eventsBound=!0)},e.prototype.unbindEventListeners=function(){this.eventsBound&&(this.unbindFormResetListener(),this.unbindPointerEventListener(),this.unbindKeyboardEventListener(),this.unbindLabelEventListener(),this.eventsBound=!1)},e.prototype.bindFormResetListener=function(){var t=this.element.form;t&&t.addEventListener("reset",this.onFormReset)},e.prototype.unbindFormResetListener=function(){var t=this.element.form;t&&t.removeEventListener("reset",this.onFormReset)},e.prototype.bindPointerEventListener=function(){this.domBuilder.root.addEventListener("pointerdown",this.onPointerDown,{passive:!0})},e.prototype.unbindPointerEventListener=function(){this.domBuilder.root.removeEventListener("pointerdown",this.onPointerDown)},e.prototype.bindKeyboardEventListener=function(){this.domBuilder.root.addEventListener("keydown",this.handlerKeyboardEvent,{passive:!1})},e.prototype.unbindKeyboardEventListener=function(){this.domBuilder.root.removeEventListener("keydown",this.handlerKeyboardEvent)},e.prototype.bindLabelEventListener=function(){var t=this;this.element.id&&document.querySelectorAll('label[for="'+this.element.id+'"]').forEach(function(e){e.addEventListener("click",t.handlerLabelEvent,{passive:!1})})},e.prototype.unbindLabelEventListener=function(){var t=this;this.element.id&&document.querySelectorAll('label[for="'+this.element.id+'"]').forEach(function(e){e.removeEventListener("click",t.handlerLabelEvent)})},e.prototype.apply=function(t,e){if(void 0===e&&(e=!1),this.stateReducer.do(t)){this.suppressExternalSync=!0;try{var i=this.stateReducer.get();this.domBuilder.render(i),e||this.trigger(t,i)}finally{this.suppressExternalSync=!1}}},e.prototype.toggle=function(t){void 0===t&&(t=!1),this.apply(i.TOGGLE,t)},e.prototype.on=function(t){void 0===t&&(t=!1),this.apply(i.ON,t)},e.prototype.off=function(t){void 0===t&&(t=!1),this.apply(i.OFF,t)},e.prototype.indeterminate=function(t){void 0===t&&(t=!1),this.apply(i.INDETERMINATE,t)},e.prototype.determinate=function(t){void 0===t&&(t=!1),this.apply(i.DETERMINATE,t)},e.prototype.enable=function(t){void 0===t&&(t=!1),this.apply(i.ENABLE,t)},e.prototype.disable=function(t){void 0===t&&(t=!1),this.apply(i.DISABLE,t)},e.prototype.readonly=function(t){void 0===t&&(t=!1),this.apply(i.READONLY,t)},e.prototype.update=function(){this.suppressExternalSync=!0;try{this.stateReducer.sync(this.element),this.domBuilder.render(this.stateReducer.get())}finally{this.suppressExternalSync=!1}},e.prototype.trigger=function(t,e){this.element.dispatchEvent(new Event("change",{bubbles:!0}));var i=this.getEventForAction(t,e),n={state:e};this.element.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:n}))},e.prototype.getEventForAction=function(t,e){switch(t){case i.ON:return f.ON;case i.OFF:return f.OFF;case i.INDETERMINATE:return f.MIXED;case i.ENABLE:return f.ENABLED;case i.DISABLE:return f.DISABLED;case i.READONLY:return f.READONLY;case i.DETERMINATE:case i.TOGGLE:case i.NEXT:return this.getValueEvent(e)}},e.prototype.getValueEvent=function(e){switch(e.value){case t.ON:return f.ON;case t.OFF:return f.OFF;case t.MIXED:return f.MIXED}},e.prototype.destroy=function(){this.restoreInputProperties(),this.unbindEventListeners(),this.domBuilder.destroy(),delete this.element.bsToggle},e.prototype.rerender=function(){this.destroy(),new e(this.element,this.userOptions)},e}();exports.Methods=void 0,(g=exports.Methods||(exports.Methods={})).ON="on",g.OFF="off",g.TOGGLE="toggle",g.DETERMINATE="determinate",g.INDETERMINATE="indeterminate",g.ENABLE="enable",g.DISABLE="disable",g.READONLY="readonly",g.DESTROY="destroy",g.RERENDER="rerender",exports.BootstrapToggle=v,exports.Events=f;
@@ -0,0 +1,374 @@
1
+ /* Copyright Notice
2
+ * bootstrap5-toggle v5.3.1
3
+ * https://palcarazm.github.io/bootstrap5-toggle/
4
+ * @author 2011-2014 Min Hur (https://github.com/minhur)
5
+ * @author 2018-2019 Brent Ely (https://github.com/gitbrent)
6
+ * @author 2022 Pablo Alcaraz Martínez (https://github.com/palcarazm)
7
+ * @funding GitHub Sponsors
8
+ * @see https://github.com/sponsors/palcarazm
9
+ * @license MIT
10
+ * @see https://github.com/palcarazm/bootstrap5-toggle/blob/master/LICENSE
11
+ */
12
+
13
+ interface ToggleOptions {
14
+ onlabel: string;
15
+ offlabel: string;
16
+ onstyle: ToggleStyle;
17
+ offstyle: ToggleStyle;
18
+ onvalue: string | null;
19
+ offvalue: string | null;
20
+ ontitle: string | null;
21
+ offtitle: string | null;
22
+ size: ToggleSize | "";
23
+ style: string;
24
+ width: string | null;
25
+ height: string | null;
26
+ tabindex: number;
27
+ tristate: boolean;
28
+ name: string | null;
29
+ aria: AriaToggleOptions;
30
+ tooltip?: TooltipOptions;
31
+ }
32
+ type AriaToggleOptions = {
33
+ label: string;
34
+ };
35
+ type TooltipOptions = {
36
+ placement: PlacementOptions;
37
+ title: {
38
+ on: string;
39
+ off: string;
40
+ mixed?: string;
41
+ };
42
+ };
43
+ type UserOptions = Partial<ToggleOptions> & {
44
+ on?: string;
45
+ off?: string;
46
+ width?: string | number;
47
+ height?: string | number;
48
+ };
49
+ type ToggleStyle = "primary" | "secondary" | "success" | "danger" | "warning" | "info" | "light" | "dark" | "outline-primary" | "outline-secondary" | "outline-success" | "outline-danger" | "outline-warning" | "outline-info" | "outline-light" | "outline-dark";
50
+ type ToggleSize = "large" | "normal" | "small" | "mini" | "lg" | "md" | "sm" | "xs";
51
+ declare enum PlacementOptions {
52
+ TOP = "top",
53
+ BOTTOM = "bottom",
54
+ LEFT = "left",
55
+ RIGHT = "right"
56
+ }
57
+
58
+ declare class Toggle {
59
+ private readonly element;
60
+ private readonly userOptions;
61
+ private readonly options;
62
+ private readonly stateReducer;
63
+ private readonly domBuilder;
64
+ private pointer;
65
+ private readonly SCROLL_THRESHOLD;
66
+ private eventsBound;
67
+ private suppressExternalSync;
68
+ private readonly originalDescriptors;
69
+ /**
70
+ * Initializes a new instance of the BootstrapToggle class.
71
+ * @param element The HTMLInputElement element which represents the toggle.
72
+ * @param options The options for the toggle.
73
+ * @returns The constructed BootstrapToggle instance.
74
+ */
75
+ constructor(element: HTMLInputElement, options: UserOptions);
76
+ /**
77
+ * Intercepts the following input properties to detect external changes:
78
+ * - checked
79
+ * - disabled
80
+ * - readonly
81
+ * - indeterminate
82
+ * This method is used to detect changes made to the input element directly,
83
+ * rather than through the BootstrapToggle API. It is used to maintain the
84
+ * state of the toggle in cases where the user changes the input element
85
+ * directly, rather than through the API.
86
+ * @returns void
87
+ */
88
+ private interceptInputProperties;
89
+ /**
90
+ * Restores the original input properties of the toggle element.
91
+ * This method is used to restore the original descriptors of the input properties
92
+ * which were intercepted by the BootstrapToggle to detect external changes.
93
+ * @returns void
94
+ */
95
+ private restoreInputProperties;
96
+ /**
97
+ * Handles the change event of the input element of the toggle.
98
+ * This event listener is responsible for detecting when the input element
99
+ * of the toggle changes its state and triggering the update method to keep the toggle in sync.
100
+ */
101
+ private readonly onExternalChange;
102
+ /**
103
+ * Binds event listeners to the toggle element.
104
+ * This method is called by the constructor and is responsible for
105
+ * binding the following event listeners:
106
+ * - Pointer events (click, touchstart, touchend)
107
+ * - Keyboard events (keydown, keyup)
108
+ * - Label events (click)
109
+ * If the event listeners are already bound (i.e. this.eventsBound is true),
110
+ * this method does nothing.
111
+ * @returns void
112
+ */
113
+ private bindEventListeners;
114
+ /**
115
+ * Unbinds all event listeners from the toggle element.
116
+ * This method is called by the destructor and is responsible for
117
+ * unbinding the following event listeners:
118
+ * - Pointer events (click, touchstart, touchend)
119
+ * - Keyboard events (keydown, keyup)
120
+ * - Label events (click)
121
+ * If the event listeners are not bound (i.e. this.eventsBound is false),
122
+ * this method does nothing.
123
+ * @returns void
124
+ */
125
+ private unbindEventListeners;
126
+ private bindFormResetListener;
127
+ private unbindFormResetListener;
128
+ private readonly onFormReset;
129
+ /**
130
+ * Binds a pointerdown event listener to the root element of the toggle.
131
+ * The event listener is responsible for handling pointer events (e.g. mouse clicks, touch events)
132
+ * and triggering the toggle's state change when a pointer event occurs.
133
+ * The event listener is bound with the passive option, which means that it will not block
134
+ * other event listeners from being triggered.
135
+ */
136
+ private bindPointerEventListener;
137
+ /**
138
+ * Unbinds the pointerdown event listener from the root element of the toggle.
139
+ * This method is responsible for unbinding the pointerdown event listener that was
140
+ * previously bound by the bindPointerEventListener method.
141
+ * If the event listener is not bound (i.e. this.eventsBound is false), this method does nothing.
142
+ * @returns void
143
+ */
144
+ private unbindPointerEventListener;
145
+ /**
146
+ * Handles pointer down events by initiating the toggle action and setting up
147
+ * listeners for pointer movement, release, and cancellation.
148
+ *
149
+ * The method early exits if:
150
+ * - the pointer event is not a primary mouse button click
151
+ * - the toggle cannot be interacted with (`disabled` or `readonly`)
152
+ * @param e The PointerEvent object representing the pointer down event.
153
+ */
154
+ private readonly onPointerDown;
155
+ /**
156
+ * Handles pointer move events by checking the distance moved from the initial pointer down position.
157
+ * If the pointer has moved beyond a certain threshold, the pointer interaction is cancelled.
158
+ *
159
+ * Allows dragging within the width of the toggle but cancels if vertical movement exceeds the scroll threshold.
160
+ * @param e The PointerEvent object representing the pointer move event.
161
+ */
162
+ private readonly onPointerMove;
163
+ /**
164
+ * Handles pointer up events by determining if the pointer interaction
165
+ * should trigger a toggle action based on the distance moved.
166
+ *
167
+ * If the pointer has moved beyond a certain threshold, the pointer interaction is cancelled.
168
+ * Allows dragging within the width of the toggle but cancels if vertical movement exceeds the scroll threshold.
169
+ * Finally, it cleans up by calling the pointer cancel handler.
170
+ *
171
+ * If the pointer event is not a primary mouse button click, the interaction is cancelled.
172
+ * @param e The PointerEvent object representing the pointer up event.
173
+ */
174
+ private readonly onPointerUp;
175
+ /**
176
+ * Cleans up pointer event listeners after a pointer interaction is completed or cancelled.
177
+ *
178
+ * This method removes the `pointermove`, `pointerup`, and `pointercancel` event listeners
179
+ * from the root element of the toggle.
180
+ * However, `pointerdown` listener remains active for future interactions.
181
+ */
182
+ private readonly onPointerCancel;
183
+ /**
184
+ * Binds a keydown event listener to the root element of the toggle.
185
+ * The event listener is responsible for handling keydown events
186
+ * and triggering the toggle's state change when a keydown event occurs.
187
+ */
188
+ private bindKeyboardEventListener;
189
+ /**
190
+ * Unbinds the keydown event listener from the root element of the toggle.
191
+ * This method is responsible for unbinding the keydown event listener that was
192
+ * previously bound by the bindKeyboardEventListener method.
193
+ * If the event listener is not bound (i.e. this.eventsBound is false), this method does nothing.
194
+ * @returns void
195
+ */
196
+ private unbindKeyboardEventListener;
197
+ private readonly handlerKeyboardEvent;
198
+ /**
199
+ * Binds a click event listener to all labels that are associated with the toggle's input element.
200
+ * The event listener is responsible for handling click events and triggering the toggle's state change when a click event occurs.
201
+ * The event listener is bound with the passive option set to false, which means that it will block other event listeners from being triggered until it has finished its execution.
202
+ * This method is called by the constructor and is responsible for binding the event listener to the toggle's labels.
203
+ * If the toggle's input element does not have an id (i.e. this.element.id is null or undefined), this method does nothing.
204
+ * @returns void
205
+ */
206
+ private bindLabelEventListener;
207
+ /**
208
+ * Unbinds the click event listener from all labels that are associated with the toggle's input element.
209
+ * This method is responsible for unbinding the event listener that was previously bound by the bindLabelEventListener method.
210
+ * If the toggle's input element does not have an id (i.e. this.element.id is null or undefined), this method does nothing.
211
+ * @returns void
212
+ */
213
+ private unbindLabelEventListener;
214
+ private readonly handlerLabelEvent;
215
+ /**
216
+ * Applies a toggle action to the toggle state and renders the toggle element.
217
+ * If the action is successful, this method will render the toggle element with the new state.
218
+ * If the silent parameter is false, this method will also trigger the change event.
219
+ * @param action The toggle action to apply.
220
+ * @param silent A boolean indicating whether to trigger the change event after applying the action.
221
+ */
222
+ private apply;
223
+ /**
224
+ * Toggles the state of the toggle.
225
+ * If the toggle is currently in the on state, it will be set to the off state.
226
+ * If the toggle is currently in the off state, it will be set to the on state.
227
+ * If the toggle is currently in the indeterminate state, it will be set to the on state.
228
+ * If the silent parameter is false, this method will also trigger the change event.
229
+ * @param silent A boolean indicating whether to trigger the change event after applying the action.
230
+ */
231
+ toggle(silent?: boolean): void;
232
+ /**
233
+ * Sets the toggle state to on.
234
+ * If the silent parameter is false, this method will also trigger the change event.
235
+ * @param silent A boolean indicating whether to trigger the change event after applying the action.
236
+ */
237
+ on(silent?: boolean): void;
238
+ /**
239
+ * Sets the toggle state to off.
240
+ * If the silent parameter is false, this method will also trigger the change event.
241
+ * @param silent A boolean indicating whether to trigger the change event after applying the action.
242
+ */
243
+ off(silent?: boolean): void;
244
+ /**
245
+ * Sets the toggle state to indeterminate.
246
+ * If the silent parameter is false, this method will also trigger the change event.
247
+ * @param {boolean} silent A boolean indicating whether to trigger the change event after applying the action.
248
+ */
249
+ indeterminate(silent?: boolean): void;
250
+ /**
251
+ * Sets the toggle state to determinate.
252
+ * If the silent parameter is false, this method will also trigger the change event.
253
+ * @param {boolean} silent A boolean indicating whether to trigger the change event after applying the action.
254
+ */
255
+ determinate(silent?: boolean): void;
256
+ /**
257
+ * Enables the toggle.
258
+ * If the toggle is currently disabled, this method will set the toggle state to enabled.
259
+ * If the silent parameter is false, this method will also trigger the change event.
260
+ * @param {boolean} silent A boolean indicating whether to trigger the change event after applying the action.
261
+ * @returns void
262
+ */
263
+ enable(silent?: boolean): void;
264
+ /**
265
+ * Disables the toggle.
266
+ * If the toggle is currently enabled, this method will set the toggle state to disabled.
267
+ * If the silent parameter is false, this method will also trigger the change event.
268
+ * @param {boolean} silent A boolean indicating whether to trigger the change event after applying the action.
269
+ */
270
+ disable(silent?: boolean): void;
271
+ /**
272
+ * Sets the toggle state to readonly.
273
+ * If the toggle is currently disabled or enabled, this method will set the toggle state to readonly.
274
+ * If the silent parameter is false, this method will also trigger the change event.
275
+ * @param {boolean} silent A boolean indicating whether to trigger the change event after applying the action.
276
+ * @returns void
277
+ */
278
+ readonly(silent?: boolean): void;
279
+ /**
280
+ * Synchronizes the toggle state with the input element and renders the toggle.
281
+ */
282
+ update(): void;
283
+ /**
284
+ * Triggers the change event on the toggle's input element and the appropriate toggle event.
285
+ * This method is called after a toggle action is applied to notify listeners of the state change.
286
+ * @param {ToggleActionType} action The toggle action that was applied.
287
+ * @param {ToggleState} state The state of the toggle once the action was applied.
288
+ */
289
+ private trigger;
290
+ /**
291
+ * Returns the corresponding toggle event for the given toggle action and state.
292
+ * This method is used to determine which toggle event to trigger after a toggle action is applied.
293
+ * @param {ToggleActionType} action The toggle action that was applied.
294
+ * @param {ToggleState} state The previous state of the toggle before the action was applied.
295
+ * @returns {ToggleEvents} The corresponding toggle event for the given toggle action and state.
296
+ */
297
+ private getEventForAction;
298
+ /**
299
+ * Returns the corresponding toggle event for the given toggle state.
300
+ * This method is used to determine which toggle event to trigger after a toggle action is applied.
301
+ * @param {ToggleState} state The previous state of the toggle before the action was applied.
302
+ * @returns {ToggleEvents} The corresponding toggle event for the given toggle state.
303
+ */
304
+ private getValueEvent;
305
+ /**
306
+ * Destroys the toggle element and unbinds all event listeners.
307
+ *This method is useful when you need to remove the toggle element from the DOM.
308
+ *After calling this method, the toggle element will be removed from the DOM and all event listeners will be unbound.
309
+ */
310
+ destroy(): void;
311
+ /**
312
+ * Destroys the toggle element and reinitializes it with the same options.
313
+ *This method is useful when you need to reinitialize the toggle element with the same options.
314
+ */
315
+ rerender(): void;
316
+ }
317
+
318
+ interface ToggleState {
319
+ value: ToggleStateValue;
320
+ checked: boolean;
321
+ status: ToggleStateStatus;
322
+ indeterminate: boolean;
323
+ }
324
+ declare enum ToggleStateValue {
325
+ ON = "on",
326
+ OFF = "off",
327
+ MIXED = "mixed"
328
+ }
329
+ declare enum ToggleStateStatus {
330
+ ENABLED = "enabled",
331
+ DISABLED = "disabled",
332
+ READONLY = "readonly"
333
+ }
334
+
335
+ declare enum ToggleEvents {
336
+ ON = "toggle:on",
337
+ OFF = "toggle:off",
338
+ MIXED = "toggle:mixed",
339
+ ENABLED = "toggle:enabled",
340
+ DISABLED = "toggle:disabled",
341
+ READONLY = "toggle:readonly"
342
+ }
343
+ interface ToggleEventDetail {
344
+ state: ToggleState;
345
+ }
346
+
347
+ declare enum ToggleMethods {
348
+ ON = "on",
349
+ OFF = "off",
350
+ TOGGLE = "toggle",
351
+ DETERMINATE = "determinate",
352
+ INDETERMINATE = "indeterminate",
353
+ ENABLE = "enable",
354
+ DISABLE = "disable",
355
+ READONLY = "readonly",
356
+ DESTROY = "destroy",
357
+ RERENDER = "rerender"
358
+ }
359
+
360
+ interface BootstrapToggleElement {
361
+ bootstrapToggle(options?: ToggleMethods | Record<string, unknown>, silent?: boolean): void;
362
+ bsToggle?: Toggle;
363
+ }
364
+ interface BootstrapToggleElementEventMap {
365
+ "toggle:on": CustomEvent<ToggleEventDetail>;
366
+ "toggle:off": CustomEvent<ToggleEventDetail>;
367
+ "toggle:mixed": CustomEvent<ToggleEventDetail>;
368
+ "toggle:enabled": CustomEvent<ToggleEventDetail>;
369
+ "toggle:disabled": CustomEvent<ToggleEventDetail>;
370
+ "toggle:readonly": CustomEvent<ToggleEventDetail>;
371
+ }
372
+
373
+ export { Toggle as BootstrapToggle, ToggleEvents as Events, ToggleMethods as Methods, ToggleStateStatus, ToggleStateValue };
374
+ export type { BootstrapToggleElement, BootstrapToggleElementEventMap, ToggleEventDetail, ToggleOptions, ToggleSize, ToggleState, ToggleStyle, UserOptions };
@@ -0,0 +1,13 @@
1
+ /* Copyright Notice
2
+ * bootstrap5-toggle v5.3.1
3
+ * https://palcarazm.github.io/bootstrap5-toggle/
4
+ * @author 2011-2014 Min Hur (https://github.com/minhur)
5
+ * @author 2018-2019 Brent Ely (https://github.com/gitbrent)
6
+ * @author 2022 Pablo Alcaraz Martínez (https://github.com/palcarazm)
7
+ * @funding GitHub Sponsors
8
+ * @see https://github.com/sponsors/palcarazm
9
+ * @license MIT
10
+ * @see https://github.com/palcarazm/bootstrap5-toggle/blob/master/LICENSE
11
+ */
12
+
13
+ var t,e,i;!function(t){t.ON="on",t.OFF="off",t.MIXED="mixed"}(t||(t={})),function(t){t.ENABLED="enabled",t.DISABLED="disabled",t.READONLY="readonly"}(e||(e={})),function(t){t.NEXT="next",t.ON="on",t.OFF="off",t.TOGGLE="toggle",t.DETERMINATE="determinate",t.INDETERMINATE="indeterminate",t.READONLY="readonly",t.DISABLE="disable",t.ENABLE="enable"}(i||(i={}));var n,o,s=function(){function i(t,e,n){this.isBuilt=!1,this.lastState=n,this.onStyle="btn-".concat(e.onstyle),this.offStyle="btn-".concat(e.offstyle),this.name=e.name,this.checkbox=t,e.onvalue&&(this.checkbox.value=e.onvalue),this.invCheckbox=e.offvalue?this.createInvCheckbox(e.offvalue):null,this.sizeClass=i.sizeResolver(e.size),this.toggleOn=this.createToggleSpan(e.onlabel,this.onStyle,e.ontitle),this.toggleOff=this.createToggleSpan(e.offlabel,this.offStyle,e.offtitle),this.toggleHandle=this.createToggleHandle(),this.toggleGroup=this.createToggleGroup(),this.toggle=document.createElement("div"),e.tooltip&&(this.tooltipLabels=e.tooltip.title),this.isVisible()?(this.renderToggle(e),this.render(n)):this.deferRender(e)}return i.prototype.isVisible=function(){var t=this.checkbox.parentElement;return!!t&&t.offsetWidth>0&&t.offsetHeight>0},i.prototype.deferRender=function(t){var e=this;this.resizeObserver=new ResizeObserver(function(i){if(e.isBuilt)e.resizeObserver.disconnect();else for(var n=0,o=i;n<o.length;n++){var s=o[n];if(s.contentRect.width>0&&s.contentRect.height>0)return e.renderToggle(t),e.render(e.lastState),e.isBuilt=!0,void e.resizeObserver.disconnect()}}),this.resizeObserver.observe(this.checkbox.parentElement)},i.sizeResolver=function(t){var e;return null!==(e={large:"btn-lg",lg:"btn-lg",small:"btn-sm",sm:"btn-sm",mini:"btn-xs",xs:"btn-xs"}[t])&&void 0!==e?e:""},i.prototype.createInvCheckbox=function(t){var e=this.checkbox.cloneNode(!0);return e.value=t,e.dataset.toggle="invert-toggle",e.removeAttribute("id"),e},i.prototype.renderToggle=function(t){var e,i=t.style,n=t.width,o=t.height,s=t.tabindex,r=t.aria,a=t.tooltip;this.toggle.className="toggle btn ".concat(this.sizeClass," ").concat(i),this.toggle.dataset.toggle="toggle",this.toggle.tabIndex=s,this.toggle.role="switch",this.checkbox.tabIndex=-1,this.invCheckbox&&(this.invCheckbox.tabIndex=-1),null===(e=this.checkbox.parentElement)||void 0===e||e.insertBefore(this.toggle,this.checkbox),this.toggle.appendChild(this.checkbox),this.invCheckbox&&this.toggle.appendChild(this.invCheckbox),this.toggle.appendChild(this.toggleGroup),this.handleLabels(r),this.handleToggleSize(n,o),a&&this.createTooltip(a),this.isBuilt=!0},i.prototype.createToggleGroup=function(){var t=document.createElement("div");return t.className="toggle-group",t.appendChild(this.toggleOn),t.appendChild(this.toggleOff),t.appendChild(this.toggleHandle),t},i.prototype.createToggleSpan=function(t,e,i){var n=document.createElement("span");return n.className="btn ".concat(this.sizeClass," ").concat(e),n.innerHTML=t,i&&(n.title=i),n},i.prototype.createToggleHandle=function(){var t=document.createElement("span");return t.className="toggle-handle btn ".concat(this.sizeClass),t},i.prototype.handleToggleSize=function(t,e){var i=this;this.cancelPendingAnimationFrame(),"function"==typeof requestAnimationFrame?this.requestAnimationFrameId=requestAnimationFrame(function(){try{i.calculateToggleSize(t,e)}catch(t){console.warn("Error calculating toggle size:",t)}}):this.calculateToggleSize(t,e)},i.prototype.calculateToggleSize=function(t,e){t?this.toggle.style.width=t:(this.toggle.style.minWidth="100px",this.toggle.style.minWidth="".concat(Math.max(this.toggleOn.getBoundingClientRect().width,this.toggleOff.getBoundingClientRect().width)+this.toggleHandle.getBoundingClientRect().width/2,"px")),e?this.toggle.style.height=e:(this.toggle.style.minHeight="36px",this.toggle.style.minHeight="".concat(Math.max(this.toggleOn.getBoundingClientRect().height,this.toggleOff.getBoundingClientRect().height),"px")),this.toggleOn.classList.add("toggle-on"),this.toggleOff.classList.add("toggle-off"),e&&(this.toggleOn.style.lineHeight=i.calcH(this.toggleOn)+"px",this.toggleOff.style.lineHeight=i.calcH(this.toggleOff)+"px")},i.calcH=function(t){var e=globalThis.window.getComputedStyle(t),i=t.offsetHeight,n=Number.parseFloat(e.borderTopWidth);return i-Number.parseFloat(e.borderBottomWidth)-n-Number.parseFloat(e.paddingTop)-Number.parseFloat(e.paddingBottom)},i.prototype.cancelPendingAnimationFrame=function(){void 0!==this.requestAnimationFrameId&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(this.requestAnimationFrameId),this.requestAnimationFrameId=void 0)},i.prototype.handleLabels=function(t){var e;if(null===(e=this.checkbox.labels)||void 0===e?void 0:e.length){var i=Array.from(this.checkbox.labels).map(function(t){return t.id}).filter(Boolean);i.length&&this.toggle.setAttribute("aria-labelledby",i.join(" "))}else this.toggle.setAttribute("aria-label",t.label)},i.prototype.createTooltip=function(t){try{this.tooltip=new globalThis.window.bootstrap.Tooltip(this.toggle,{placement:t.placement,html:!0,title:t.title.on})}catch(t){console.error("Error creating tooltip:",t)}},i.prototype.render=function(t){this.lastState=t,this.isBuilt&&(this.updateToggleByValue(t),this.updateToggleByChecked(t),this.updateToggleByState(t),this.updateAria(t),this.updateTooltip(t))},i.prototype.updateToggleByValue=function(e){switch(this.toggle.classList.remove(this.onStyle,this.offStyle,"off","indeterminate"),e.value){case t.ON:this.toggle.classList.add(this.onStyle);break;case t.OFF:this.toggle.classList.add(this.offStyle,"off");break;case t.MIXED:this.toggle.classList.add("indeterminate"),e.checked?this.toggle.classList.add(this.onStyle):this.toggle.classList.add(this.offStyle,"off")}},i.prototype.updateToggleByChecked=function(t){this.updateCheckboxByChecked(t),this.updateInvCheckboxByChecked(t)},i.prototype.updateCheckboxByChecked=function(t){switch(this.checkbox.checked=t.checked,t.status){case e.ENABLED:this.checkbox.disabled=!1,this.checkbox.readOnly=!1,this.toggle.classList.remove("disabled"),this.toggle.removeAttribute("disabled");break;case e.DISABLED:this.checkbox.disabled=!0,this.checkbox.readOnly=!1,this.toggle.classList.add("disabled"),this.toggle.setAttribute("disabled","");break;case e.READONLY:this.checkbox.disabled=!1,this.checkbox.readOnly=!0,this.toggle.classList.add("disabled"),this.toggle.setAttribute("disabled","")}},i.prototype.updateInvCheckboxByChecked=function(t){if(this.invCheckbox)switch(this.invCheckbox.checked=!t.checked,t.status){case e.ENABLED:this.invCheckbox.disabled=!1,this.invCheckbox.readOnly=!1;break;case e.DISABLED:this.invCheckbox.disabled=!0,this.invCheckbox.readOnly=!1;break;case e.READONLY:this.invCheckbox.disabled=!1,this.invCheckbox.readOnly=!0}},i.prototype.updateToggleByState=function(t){t.indeterminate?(this.checkbox.indeterminate=!0,this.checkbox.removeAttribute("name"),this.invCheckbox&&(this.invCheckbox.indeterminate=!0),this.invCheckbox&&this.invCheckbox.removeAttribute("name")):(this.checkbox.indeterminate=!1,this.name&&(this.checkbox.name=this.name),this.invCheckbox&&(this.invCheckbox.indeterminate=!1),this.invCheckbox&&this.name&&(this.invCheckbox.name=this.name))},i.prototype.updateAria=function(t){t.indeterminate?this.toggle.setAttribute("aria-checked","mixed"):this.toggle.setAttribute("aria-checked",String(t.checked)),this.toggle.setAttribute("aria-disabled",String(t.status===e.DISABLED)),this.toggle.setAttribute("aria-readonly",String(t.status===e.READONLY))},i.prototype.updateTooltip=function(e){if(this.tooltip&&this.tooltipLabels)switch(e.value){case t.ON:return void this.tooltip.setContent({".tooltip-inner":this.tooltipLabels.on});case t.OFF:return void this.tooltip.setContent({".tooltip-inner":this.tooltipLabels.off});case t.MIXED:return void(this.tooltipLabels.mixed&&this.tooltip.setContent({".tooltip-inner":this.tooltipLabels.mixed}))}},Object.defineProperty(i.prototype,"root",{get:function(){return this.toggle},enumerable:!1,configurable:!0}),i.prototype.destroy=function(){var t,e;this.cancelPendingAnimationFrame(),this.tooltip&&(this.tooltip.dispose(),this.tooltip=void 0),null===(t=this.toggle.parentNode)||void 0===t||t.insertBefore(this.checkbox,this.toggle),this.toggle.remove(),null===(e=this.resizeObserver)||void 0===e||e.disconnect(),this.resizeObserver=void 0,this.isBuilt=!1},i}();function r(t,e){if(!t)return t;switch(e.mode){case n.HTML:return i=t,o={allowedTags:["b","i","strong","em","span","small","sup","sub","img"],allowedAttributes:["class","style","src","alt","title","data-*"]},s=(new DOMParser).parseFromString(i,"text/html"),Array.from(s.body.childNodes).forEach(function(t){return function(t,e){var i=function(t){var n;if(t.nodeType===Node.ELEMENT_NODE){var o=t,s=o.tagName.toLowerCase();if(!e.allowedTags.includes(s)){var r=document.createDocumentFragment();return Array.from(o.childNodes).forEach(function(t){r.appendChild(t.cloneNode(!0))}),void(null===(n=o.parentNode)||void 0===n||n.replaceChild(r,o))}Array.from(o.attributes).forEach(function(t){var i=t.name.toLowerCase();e.allowedAttributes.some(function(t){return t.endsWith("*")?i.startsWith(t.slice(0,-1)):i===t})?function(t,e,i){if("src"===i||"href"===i){var n=e.value.toLowerCase();(n.startsWith("javascript:")||n.startsWith("vbscript:")||n.startsWith("data:")&&!n.startsWith("data:image/"))&&t.removeAttribute(e.name)}}(o,t,i):o.removeAttribute(t.name)}),Array.from(o.childNodes).forEach(i)}else if(t.nodeType===Node.TEXT_NODE)return};i(t)}(t,o)}),s.body.innerHTML;case n.TEXT:return function(t){var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#x2F;"};return t.replace(/[&<>"'/]/g,function(t){return e[t]})}(t)}var i,o,s}function a(t){return/^[+-]?\d+(\.\d+)?$/.test(t.toString().trim())}!function(t){t.HTML="HTML",t.TEXT="TEXT"}(n||(n={})),function(t){t.TOP="top",t.BOTTOM="bottom",t.LEFT="left",t.RIGHT="right"}(o||(o={}));var l,h=function(){function t(){}return t.getAttr=function(t,e,i){var o=(null!=i?i:{}).sanitized,s=void 0===o?n.TEXT:o;return r(t.getAttribute(e),{mode:s})},t.getAttrOrDefault=function(e,i,o,s,a){void 0===a&&(a=n.TEXT);var l="string"==typeof o?r(o,{mode:a}):o;return t.getAttr(e,i,{sanitized:a})||l||s},t.getAttrOrDeprecation=function(e,i,o,s){void 0===s&&(s=n.TEXT);var a="string"==typeof o?r(o,{mode:s}):o;return t.getAttr(e,i,{sanitized:s})||a||d.value},t.resolve=function(e,i){var o;void 0===i&&(i={});var s={onlabel:this.getAttrOrDeprecation(e,"data-onlabel",i.onlabel,n.HTML),offlabel:this.getAttrOrDeprecation(e,"data-offlabel",i.offlabel,n.HTML),onstyle:this.getAttrOrDefault(e,"data-onstyle",i.onstyle,t.DEFAULT.onstyle),offstyle:this.getAttrOrDefault(e,"data-offstyle",i.offstyle,t.DEFAULT.offstyle),onvalue:this.getAttr(e,"value")||this.getAttrOrDefault(e,"data-onvalue",i.onvalue,t.DEFAULT.onvalue),offvalue:this.getAttrOrDefault(e,"data-offvalue",i.offvalue,t.DEFAULT.offvalue),ontitle:this.getAttrOrDefault(e,"data-ontitle",i.ontitle,t.getAttr(e,"title")||t.DEFAULT.ontitle),offtitle:this.getAttrOrDefault(e,"data-offtitle",i.offtitle,t.getAttr(e,"title")||t.DEFAULT.offtitle),size:this.getAttrOrDefault(e,"data-size",i.size,this.DEFAULT.size),style:this.getAttrOrDefault(e,"data-style",i.style,this.DEFAULT.style),width:this.getAttrOrDefault(e,"data-width",i.width,this.DEFAULT.width),height:this.getAttrOrDefault(e,"data-height",i.height,this.DEFAULT.height),tabindex:Number(this.getAttrOrDefault(e,"tabindex",i.tabindex,this.DEFAULT.tabindex)),tristate:e.hasAttribute("tristate")||i.tristate||t.DEFAULT.tristate,name:this.getAttrOrDefault(e,"name",i.name,this.DEFAULT.name),aria:{label:this.getAttrOrDefault(e,"aria-label",null===(o=i.aria)||void 0===o?void 0:o.label,this.DEFAULT.aria.label)},tooltip:t.resolveTooltipOptions(e,i)};return s.width&&a(s.width)&&(s.width="".concat(s.width,"px")),s.height&&a(s.height)&&(s.height="".concat(s.height,"px")),d.handle(s,e,i),s},t.resolveTooltipOptions=function(e,i){var s,r,a,l,h=this,c=function(t,i){return h.getAttrOrDefault(e,t,i,null,n.HTML)||h.getAttr(e,"data-tooltip-title",{sanitized:n.HTML})},d=c("data-tooltip-title-on",null===(s=i.tooltip)||void 0===s?void 0:s.title.on),u=c("data-tooltip-title-off",null===(r=i.tooltip)||void 0===r?void 0:r.title.off),p=c("data-tooltip-title-mixed",null===(a=i.tooltip)||void 0===a?void 0:a.title.mixed);if(!d||!u)return t.DEFAULT.tooltip;var g=this.getAttrOrDefault(e,"data-tooltip-placement",null===(l=i.tooltip)||void 0===l?void 0:l.placement,o.TOP);return{placement:Object.values(o).includes(g)?g:o.TOP,title:{on:d,off:u,mixed:null!=p?p:void 0}}},t.DEFAULT={onlabel:"On",onstyle:"primary",onvalue:null,ontitle:null,offlabel:"Off",offstyle:"secondary",offvalue:null,offtitle:null,size:"",style:"",width:null,height:null,tabindex:0,tristate:!1,name:null,aria:{label:"Toggle"},tooltip:void 0},t}();!function(t){t.ATTRIBUTE="attribute",t.OPTION="option"}(l||(l={}));var c,d=function(){function t(){}return t.handle=function(e,i,n){var o=this;this.deprecatedOptions.forEach(function(s){var a=s.currentOpt,c=s.deprecatedAttr,d=s.deprecatedOpt,u=s.mode;if(e[a]===t.value){var p=r(i.getAttribute(c),{mode:u});p?(o.log(l.ATTRIBUTE,c,"data-".concat(a)),e[a]=p):n[d]?(o.log(l.OPTION,d,a),e[a]=n[d]):e[a]=h.DEFAULT[a]}})},t.log=function(t,e,i){console.warn("Bootstrap Toggle deprecation warning: Using ".concat(e," ").concat(t," is deprecated. Use ").concat(i," instead."))},t.value="BOOTSTRAP TOGGLE DEPRECATION CHECK -- a0Jhux0QySypjjs4tLtEo8xT2kx0AbYaq9K6mgNjWSs0HF0L8T8J0M0o3Kr7zkm7 --",t.deprecatedOptions=[{currentOpt:"onlabel",deprecatedAttr:"data-on",deprecatedOpt:"on",mode:n.HTML},{currentOpt:"offlabel",deprecatedAttr:"data-off",deprecatedOpt:"off",mode:n.HTML}],t}(),u=function(){return u=Object.assign||function(t){for(var e,i=1,n=arguments.length;i<n;i++)for(var o in e=arguments[i])Object.prototype.hasOwnProperty.call(e,o)&&(t[o]=e[o]);return t},u.apply(this,arguments)},p=function(){function n(t,e){this.isTristate=e,this.state=this.getElementState(t)}return n.prototype.getElementState=function(i){var n,o=i.checked;n=i.disabled?e.DISABLED:i.readOnly?e.READONLY:e.ENABLED;var s=this.isTristate&&i.indeterminate;return{value:s?t.MIXED:o?t.ON:t.OFF,checked:o,status:n,indeterminate:s}},n.prototype.get=function(){return Object.freeze(u({},this.state))},n.prototype.canInteract=function(){return this.state.status===e.ENABLED},n.prototype.sync=function(t){this.state=this.getElementState(t)},n.prototype.do=function(n){if([i.ON,i.OFF,i.TOGGLE,i.INDETERMINATE,i.DETERMINATE,i.NEXT,i.READONLY].includes(n)&&!this.canInteract())return!1;switch(n){case i.ON:return this.setValueIfChanged(t.ON,!0,!1);case i.OFF:return this.setValueIfChanged(t.OFF,!1,!1);case i.TOGGLE:return this.state.value===t.ON?this.do(i.OFF):this.state.value===t.OFF&&this.do(i.ON);case i.INDETERMINATE:return this.setValueIfChanged(t.MIXED,void 0,!0);case i.DETERMINATE:return this.state.value==t.MIXED&&this.setValue(this.state.checked?t.ON:t.OFF,this.state.checked,!1);case i.NEXT:return this.doNext();case i.DISABLE:return this.setStatusIfChanged(e.DISABLED);case i.ENABLE:return this.setStatusIfChanged(e.ENABLED);case i.READONLY:return this.setStatus(e.READONLY)}},n.prototype.setValue=function(t,e,i){return this.state=u(u({},this.state),{value:t,checked:null!=e?e:this.state.checked,indeterminate:null!=i?i:this.state.indeterminate}),!0},n.prototype.setValueIfChanged=function(t,e,i){return this.state.value!==t&&this.setValue(t,e,i)},n.prototype.setStatus=function(t){return this.state=u(u({},this.state),{status:t}),!0},n.prototype.setStatusIfChanged=function(t){return this.state.status!==t&&this.setStatus(t)},n.prototype.doNext=function(){return this.isTristate?this.state.value===t.ON||this.state.value===t.OFF?this.do(i.INDETERMINATE):this.state.value===t.MIXED&&(this.state.checked?this.do(i.OFF):this.do(i.ON)):this.state.value===t.ON?this.do(i.OFF):this.do(i.ON)},n}();!function(t){t.ON="toggle:on",t.OFF="toggle:off",t.MIXED="toggle:mixed",t.ENABLED="toggle:enabled",t.DISABLED="toggle:disabled",t.READONLY="toggle:readonly"}(c||(c={}));var g,f=c,v=function(){function e(t,e){var n=this;this.pointer=null,this.SCROLL_THRESHOLD=10,this.eventsBound=!1,this.suppressExternalSync=!1,this.originalDescriptors=new Map,this.onExternalChange=function(){n.update()},this.onFormReset=function(){setTimeout(function(){return n.onExternalChange()},0)},this.onPointerDown=function(t){"mouse"===t.pointerType&&0!==t.button||n.stateReducer.canInteract()&&(n.pointer={x:t.clientX,y:t.clientY},n.domBuilder.root.addEventListener("pointermove",n.onPointerMove,{passive:!0}),n.domBuilder.root.addEventListener("pointerup",n.onPointerUp,{passive:!0}),n.domBuilder.root.addEventListener("pointercancel",n.onPointerCancel,{passive:!0}))},this.onPointerMove=function(t){var e=Math.abs(t.clientX-n.pointer.x);(Math.abs(t.clientY-n.pointer.y)>n.SCROLL_THRESHOLD||e>n.domBuilder.root.offsetWidth)&&n.onPointerCancel()},this.onPointerUp=function(t){if("mouse"!==t.pointerType||0===t.button){var e=Math.abs(t.clientX-n.pointer.x);Math.abs(t.clientY-n.pointer.y)<=n.SCROLL_THRESHOLD&&e<=n.domBuilder.root.offsetWidth&&n.apply(i.NEXT),n.onPointerCancel()}else n.onPointerCancel()},this.onPointerCancel=function(){n.domBuilder.root.removeEventListener("pointermove",n.onPointerMove),n.domBuilder.root.removeEventListener("pointerup",n.onPointerUp),n.domBuilder.root.removeEventListener("pointercancel",n.onPointerCancel)},this.handlerKeyboardEvent=function(t){" "!==t.key&&"Enter"!==t.key||(t.preventDefault(),n.apply(i.NEXT))},this.handlerLabelEvent=function(t){t.preventDefault(),n.apply(i.NEXT),n.domBuilder.root.focus()},this.element=t,this.userOptions=e,this.options=h.resolve(t,e),this.stateReducer=new p(t,this.options.tristate),this.domBuilder=new s(t,this.options,this.stateReducer.get()),this.bindEventListeners(),this.interceptInputProperties(),this.element.bsToggle=this}return e.prototype.interceptInputProperties=function(){var t=this;["checked","disabled","readOnly","indeterminate"].forEach(function(e){var i=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t.element),e);(null==i?void 0:i.set)&&(t.originalDescriptors.set(e,i),Object.defineProperty(t.element,e,{configurable:!0,get:function(){return i.get.call(t.element)},set:function(e){i.set.call(t.element,e),t.suppressExternalSync||t.onExternalChange()}}))})},e.prototype.restoreInputProperties=function(){var t=this;this.originalDescriptors.forEach(function(e,i){Object.defineProperty(t.element,i,e)}),this.originalDescriptors.clear()},e.prototype.bindEventListeners=function(){this.eventsBound||(this.bindFormResetListener(),this.bindPointerEventListener(),this.bindKeyboardEventListener(),this.bindLabelEventListener(),this.eventsBound=!0)},e.prototype.unbindEventListeners=function(){this.eventsBound&&(this.unbindFormResetListener(),this.unbindPointerEventListener(),this.unbindKeyboardEventListener(),this.unbindLabelEventListener(),this.eventsBound=!1)},e.prototype.bindFormResetListener=function(){var t=this.element.form;t&&t.addEventListener("reset",this.onFormReset)},e.prototype.unbindFormResetListener=function(){var t=this.element.form;t&&t.removeEventListener("reset",this.onFormReset)},e.prototype.bindPointerEventListener=function(){this.domBuilder.root.addEventListener("pointerdown",this.onPointerDown,{passive:!0})},e.prototype.unbindPointerEventListener=function(){this.domBuilder.root.removeEventListener("pointerdown",this.onPointerDown)},e.prototype.bindKeyboardEventListener=function(){this.domBuilder.root.addEventListener("keydown",this.handlerKeyboardEvent,{passive:!1})},e.prototype.unbindKeyboardEventListener=function(){this.domBuilder.root.removeEventListener("keydown",this.handlerKeyboardEvent)},e.prototype.bindLabelEventListener=function(){var t=this;this.element.id&&document.querySelectorAll('label[for="'+this.element.id+'"]').forEach(function(e){e.addEventListener("click",t.handlerLabelEvent,{passive:!1})})},e.prototype.unbindLabelEventListener=function(){var t=this;this.element.id&&document.querySelectorAll('label[for="'+this.element.id+'"]').forEach(function(e){e.removeEventListener("click",t.handlerLabelEvent)})},e.prototype.apply=function(t,e){if(void 0===e&&(e=!1),this.stateReducer.do(t)){this.suppressExternalSync=!0;try{var i=this.stateReducer.get();this.domBuilder.render(i),e||this.trigger(t,i)}finally{this.suppressExternalSync=!1}}},e.prototype.toggle=function(t){void 0===t&&(t=!1),this.apply(i.TOGGLE,t)},e.prototype.on=function(t){void 0===t&&(t=!1),this.apply(i.ON,t)},e.prototype.off=function(t){void 0===t&&(t=!1),this.apply(i.OFF,t)},e.prototype.indeterminate=function(t){void 0===t&&(t=!1),this.apply(i.INDETERMINATE,t)},e.prototype.determinate=function(t){void 0===t&&(t=!1),this.apply(i.DETERMINATE,t)},e.prototype.enable=function(t){void 0===t&&(t=!1),this.apply(i.ENABLE,t)},e.prototype.disable=function(t){void 0===t&&(t=!1),this.apply(i.DISABLE,t)},e.prototype.readonly=function(t){void 0===t&&(t=!1),this.apply(i.READONLY,t)},e.prototype.update=function(){this.suppressExternalSync=!0;try{this.stateReducer.sync(this.element),this.domBuilder.render(this.stateReducer.get())}finally{this.suppressExternalSync=!1}},e.prototype.trigger=function(t,e){this.element.dispatchEvent(new Event("change",{bubbles:!0}));var i=this.getEventForAction(t,e),n={state:e};this.element.dispatchEvent(new CustomEvent(i,{bubbles:!0,detail:n}))},e.prototype.getEventForAction=function(t,e){switch(t){case i.ON:return f.ON;case i.OFF:return f.OFF;case i.INDETERMINATE:return f.MIXED;case i.ENABLE:return f.ENABLED;case i.DISABLE:return f.DISABLED;case i.READONLY:return f.READONLY;case i.DETERMINATE:case i.TOGGLE:case i.NEXT:return this.getValueEvent(e)}},e.prototype.getValueEvent=function(e){switch(e.value){case t.ON:return f.ON;case t.OFF:return f.OFF;case t.MIXED:return f.MIXED}},e.prototype.destroy=function(){this.restoreInputProperties(),this.unbindEventListeners(),this.domBuilder.destroy(),delete this.element.bsToggle},e.prototype.rerender=function(){this.destroy(),new e(this.element,this.userOptions)},e}();!function(t){t.ON="on",t.OFF="off",t.TOGGLE="toggle",t.DETERMINATE="determinate",t.INDETERMINATE="indeterminate",t.ENABLE="enable",t.DISABLE="disable",t.READONLY="readonly",t.DESTROY="destroy",t.RERENDER="rerender"}(g||(g={}));export{v as BootstrapToggle,f as Events,g as Methods};
@@ -1,5 +1,5 @@
1
1
  /* Copyright Notice
2
- * bootstrap5-toggle v5.3.0
2
+ * bootstrap5-toggle v5.3.1
3
3
  * https://palcarazm.github.io/bootstrap5-toggle/
4
4
  * @author 2011-2014 Min Hur (https://github.com/minhur)
5
5
  * @author 2018-2019 Brent Ely (https://github.com/gitbrent)
@@ -1592,26 +1592,16 @@
1592
1592
 
1593
1593
  var ToggleMethods;
1594
1594
  (function (ToggleMethods) {
1595
- ToggleMethods["on"] = "on";
1596
- ToggleMethods["ON"] = "ON";
1597
- ToggleMethods["off"] = "off";
1598
- ToggleMethods["OFF"] = "OFF";
1599
- ToggleMethods["toggle"] = "toggle";
1600
- ToggleMethods["TOGGLE"] = "TOGGLE";
1601
- ToggleMethods["determinate"] = "determinate";
1602
- ToggleMethods["DETERMINATE"] = "DETERMINATE";
1603
- ToggleMethods["indeterminate"] = "indeterminate";
1604
- ToggleMethods["INDETERMINATE"] = "INDETERMINATE";
1605
- ToggleMethods["enable"] = "enable";
1606
- ToggleMethods["ENABLE"] = "ENABLE";
1607
- ToggleMethods["disable"] = "disable";
1608
- ToggleMethods["DISABLE"] = "DISABLE";
1609
- ToggleMethods["readonly"] = "readonly";
1610
- ToggleMethods["READONLY"] = "READONLY";
1611
- ToggleMethods["destroy"] = "destroy";
1612
- ToggleMethods["DESTROY"] = "DESTROY";
1613
- ToggleMethods["rerender"] = "rerender";
1614
- ToggleMethods["RENDERER"] = "RENDERER";
1595
+ ToggleMethods["ON"] = "on";
1596
+ ToggleMethods["OFF"] = "off";
1597
+ ToggleMethods["TOGGLE"] = "toggle";
1598
+ ToggleMethods["DETERMINATE"] = "determinate";
1599
+ ToggleMethods["INDETERMINATE"] = "indeterminate";
1600
+ ToggleMethods["ENABLE"] = "enable";
1601
+ ToggleMethods["DISABLE"] = "disable";
1602
+ ToggleMethods["READONLY"] = "readonly";
1603
+ ToggleMethods["DESTROY"] = "destroy";
1604
+ ToggleMethods["RERENDER"] = "rerender";
1615
1605
  })(ToggleMethods || (ToggleMethods = {}));
1616
1606
 
1617
1607
  (function () {
@@ -1623,36 +1613,26 @@
1623
1613
  var _bsToggle = this.bsToggle || new Toggle(this, (options && typeof options !== "string") ? options : {});
1624
1614
  // Execute method calls
1625
1615
  if (options && typeof options === "string") {
1626
- switch (options) {
1616
+ switch (options.toLowerCase()) {
1627
1617
  case ToggleMethods.TOGGLE:
1628
- case ToggleMethods.toggle:
1629
1618
  return _bsToggle.toggle(silent);
1630
1619
  case ToggleMethods.ON:
1631
- case ToggleMethods.on:
1632
1620
  return _bsToggle.on(silent);
1633
1621
  case ToggleMethods.OFF:
1634
- case ToggleMethods.off:
1635
1622
  return _bsToggle.off(silent);
1636
1623
  case ToggleMethods.INDETERMINATE:
1637
- case ToggleMethods.indeterminate:
1638
1624
  return _bsToggle.indeterminate(silent);
1639
1625
  case ToggleMethods.DETERMINATE:
1640
- case ToggleMethods.determinate:
1641
1626
  return _bsToggle.determinate(silent);
1642
1627
  case ToggleMethods.ENABLE:
1643
- case ToggleMethods.enable:
1644
1628
  return _bsToggle.enable(silent);
1645
1629
  case ToggleMethods.DISABLE:
1646
- case ToggleMethods.disable:
1647
1630
  return _bsToggle.disable(silent);
1648
1631
  case ToggleMethods.READONLY:
1649
- case ToggleMethods.readonly:
1650
1632
  return _bsToggle.readonly(silent);
1651
1633
  case ToggleMethods.DESTROY:
1652
- case ToggleMethods.destroy:
1653
1634
  return _bsToggle.destroy();
1654
- case ToggleMethods.RENDERER:
1655
- case ToggleMethods.rerender:
1635
+ case ToggleMethods.RERENDER:
1656
1636
  return _bsToggle.rerender();
1657
1637
  }
1658
1638
  }