bootstrap5-toggle 5.3.2 → 5.3.3
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 +6 -6
- package/css/bootstrap5-toggle.css +1 -1
- package/css/bootstrap5-toggle.min.css +1 -1
- package/dist/bootstrap5-toggle.cjs +1 -1
- package/dist/bootstrap5-toggle.d.ts +3 -3
- package/dist/bootstrap5-toggle.mjs +1 -1
- package/js/bootstrap5-toggle.ecmas.js +21 -11
- package/js/bootstrap5-toggle.ecmas.js.map +1 -1
- package/js/bootstrap5-toggle.ecmas.min.js +2 -2
- package/js/bootstrap5-toggle.ecmas.min.js.map +1 -1
- package/js/bootstrap5-toggle.jquery.js +18 -11
- package/js/bootstrap5-toggle.jquery.js.map +1 -1
- package/js/bootstrap5-toggle.jquery.min.js +2 -2
- package/js/bootstrap5-toggle.jquery.min.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap5-toggle.jquery.min.js","sources":["../src/main/js/core/StateReducer.types.js","../src/main/js/core/DOMBuilder.js","../src/main/js/core/Tools.js","../src/main/js/core/OptionResolver.types.js","../src/main/js/core/OptionResolver.js","../src/main/js/types/ToggleEvents.js","../src/main/js/core/StateReducer.js","../src/main/js/types/ToggleMethods.js","../src/main/js/BootstrapToggle.js","../src/main/js/index.jquery.js"],"sourcesContent":["export var ToggleStateValue;\n(function (ToggleStateValue) {\n ToggleStateValue[\"ON\"] = \"on\";\n ToggleStateValue[\"OFF\"] = \"off\";\n ToggleStateValue[\"MIXED\"] = \"mixed\";\n})(ToggleStateValue || (ToggleStateValue = {}));\nexport var ToggleStateStatus;\n(function (ToggleStateStatus) {\n ToggleStateStatus[\"ENABLED\"] = \"enabled\";\n ToggleStateStatus[\"DISABLED\"] = \"disabled\";\n ToggleStateStatus[\"READONLY\"] = \"readonly\";\n})(ToggleStateStatus || (ToggleStateStatus = {}));\nexport var ToggleActionType;\n(function (ToggleActionType) {\n ToggleActionType[\"NEXT\"] = \"next\";\n ToggleActionType[\"ON\"] = \"on\";\n ToggleActionType[\"OFF\"] = \"off\";\n ToggleActionType[\"TOGGLE\"] = \"toggle\";\n ToggleActionType[\"DETERMINATE\"] = \"determinate\";\n ToggleActionType[\"INDETERMINATE\"] = \"indeterminate\";\n ToggleActionType[\"READONLY\"] = \"readonly\";\n ToggleActionType[\"DISABLE\"] = \"disable\";\n ToggleActionType[\"ENABLE\"] = \"enable\";\n})(ToggleActionType || (ToggleActionType = {}));\n","import { ToggleStateStatus, ToggleStateValue, } from \"./StateReducer.types\";\nvar DOMBuilder = /** @class */ (function () {\n /**\n * Initializes a new instance of the DOMBuilder class.\n * This renders the toggle if the parent element is visible, otherwise defers rendering until it becomes visible.\n * @param checkbox HTMLInputElement element representing the toggle.\n * @param options ToggleOptions object containing options for the toggle.\n * @param state ToggleState object containing the initial state of the toggle.\n */\n function DOMBuilder(checkbox, options, state) {\n this.isBuilt = false;\n this.lastState = state;\n this.onStyle = \"btn-\".concat(options.onstyle);\n this.offStyle = \"btn-\".concat(options.offstyle);\n this.name = options.name;\n this.checkbox = checkbox;\n if (options.onvalue)\n this.checkbox.value = options.onvalue;\n this.invCheckbox = options.offvalue\n ? this.createInvCheckbox(options.offvalue)\n : null;\n this.sizeClass = DOMBuilder.sizeResolver(options.size);\n this.toggleOn = this.createToggleSpan(options.onlabel, this.onStyle, options.ontitle);\n this.toggleOff = this.createToggleSpan(options.offlabel, this.offStyle, options.offtitle);\n this.toggleHandle = this.createToggleHandle();\n this.toggleGroup = this.createToggleGroup();\n this.toggle = document.createElement(\"div\");\n if (options.tooltip) {\n this.tooltipLabels = options.tooltip.title;\n }\n if (this.isVisible()) {\n this.renderToggle(options);\n this.render(state);\n }\n else {\n this.deferRender(options);\n }\n }\n /**\n * Checks if the parent element of the checkbox is visible.\n * A parent element is considered visible if its `offsetWidth` and `offsetHeight` are greater than `0`.\n * @returns boolean indicating whether the parent element is visible or not.\n */\n DOMBuilder.prototype.isVisible = function () {\n var parent = this.checkbox.parentElement;\n return !!parent && parent.offsetWidth > 0 && parent.offsetHeight > 0;\n };\n /**\n * Defer rendering the toggle until the parent element is visible.\n * It does this by observing the parent element's bounding rectangle and only rendering the toggle once the width and height of the bounding rectangle are greater than 0.\n * @param options ToggleOptions object containing options for the toggle.\n */\n DOMBuilder.prototype.deferRender = function (options) {\n var _this = this;\n this.resizeObserver = new ResizeObserver(function (entries) {\n if (_this.isBuilt) {\n _this.resizeObserver.disconnect();\n return;\n }\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n var entry = entries_1[_i];\n if (entry.contentRect.width > 0 && entry.contentRect.height > 0) {\n _this.renderToggle(options);\n _this.render(_this.lastState);\n _this.isBuilt = true;\n _this.resizeObserver.disconnect();\n return;\n }\n }\n });\n this.resizeObserver.observe(this.checkbox.parentElement);\n };\n /**\n * Resolves the size class for the toggle based on the provided size.\n * If size is not provided or is invalid, returns an empty string.\n * @param size ToggleSize value representing the size of the toggle.\n * @returns string representing the size class for the toggle.\n */\n DOMBuilder.sizeResolver = function (size) {\n var _a;\n var sizeMap = {\n large: \"btn-lg\",\n lg: \"btn-lg\",\n small: \"btn-sm\",\n sm: \"btn-sm\",\n mini: \"btn-xs\",\n xs: \"btn-xs\",\n };\n return (_a = sizeMap[size]) !== null && _a !== void 0 ? _a : \"\";\n };\n /**\n * Creates an inverted checkbox element that is used in the toggle.\n * This checkbox is used to create the toggle's \"off\" state.\n * @param offValue The value of the checkbox when the toggle is in the \"off\" state.\n * @returns An HTMLInputElement representing the inverted checkbox element.\n */\n DOMBuilder.prototype.createInvCheckbox = function (offValue) {\n var invCheckbox = this.checkbox.cloneNode(true);\n invCheckbox.value = offValue;\n invCheckbox.dataset.toggle = \"invert-toggle\";\n invCheckbox.removeAttribute(\"id\");\n return invCheckbox;\n };\n /**\n * Renders the toggle element and its children.\n * Sets the class attribute of the toggle with the provided style and size class.\n * Sets the tabindex attribute of the toggle with the provided tabindex.\n * Inserts the toggle element before the original checkbox element.\n * Appends the checkbox, inverted checkbox (if exists) and toggle group elements to the toggle element.\n * Handles the toggle size by setting the width and height attributes of the toggle element.\n * @param options - ToggleOptions object containing the style, width, height and tabindex for the toggle.\n */\n DOMBuilder.prototype.renderToggle = function (_a) {\n var _b;\n var style = _a.style, width = _a.width, height = _a.height, tabindex = _a.tabindex, aria = _a.aria, tooltip = _a.tooltip;\n this.toggle.className = \"toggle btn \".concat(this.sizeClass, \" \").concat(style);\n this.toggle.dataset.toggle = \"toggle\";\n this.toggle.tabIndex = tabindex;\n this.toggle.role = \"switch\";\n this.checkbox.tabIndex = -1;\n if (this.invCheckbox)\n this.invCheckbox.tabIndex = -1;\n (_b = this.checkbox.parentElement) === null || _b === void 0 ? void 0 : _b.insertBefore(this.toggle, this.checkbox);\n this.toggle.appendChild(this.checkbox);\n if (this.invCheckbox)\n this.toggle.appendChild(this.invCheckbox);\n this.toggle.appendChild(this.toggleGroup);\n this.handleLabels(aria);\n this.handleToggleSize(width, height);\n if (tooltip)\n this.createTooltip(tooltip);\n this.isBuilt = true;\n };\n /**\n * Creates a div element representing the toggle group.\n * The toggle group contains the on, off, and handle elements of the toggle.\n * @returns An HTMLElement representing the toggle group element.\n */\n DOMBuilder.prototype.createToggleGroup = function () {\n var toggleGroup = document.createElement(\"div\");\n toggleGroup.className = \"toggle-group\";\n toggleGroup.appendChild(this.toggleOn);\n toggleGroup.appendChild(this.toggleOff);\n toggleGroup.appendChild(this.toggleHandle);\n return toggleGroup;\n };\n /**\n * Creates a span element representing a toggle option (on/off).\n * The span element is given a class attribute with the provided style and size class.\n * The innerHTML of the span element is set to the provided label.\n * If a title is provided, the span element is given a title attribute with the provided title.\n * @param label The text to be displayed in the toggle option.\n * @param style The style of the toggle option (primary, secondary, etc.).\n * @param title The title of the toggle option.\n * @returns An HTMLElement representing the toggle option element.\n */\n DOMBuilder.prototype.createToggleSpan = function (label, style, title) {\n var toggleSpan = document.createElement(\"span\");\n toggleSpan.className = \"btn \".concat(this.sizeClass, \" \").concat(style);\n toggleSpan.innerHTML = label;\n if (title)\n toggleSpan.title = title;\n return toggleSpan;\n };\n /**\n * Creates a span element representing the toggle handle.\n * The span element is given a class attribute with the provided size class.\n * @returns An HTMLElement representing the toggle handle element.\n */\n DOMBuilder.prototype.createToggleHandle = function () {\n var toggleHandle = document.createElement(\"span\");\n toggleHandle.className = \"toggle-handle btn \".concat(this.sizeClass);\n return toggleHandle;\n };\n /**\n * Sets the width and height of the toggle element.\n * If a width or height is not provided, the toggle element will be given a minimum width and height\n * that is calculated based on the size of the toggle on and off options.\n * @param width The width of the toggle element.\n * @param height The height of the toggle element.\n */\n DOMBuilder.prototype.handleToggleSize = function (width, height) {\n var _this = this;\n this.cancelPendingAnimationFrame();\n if (typeof requestAnimationFrame === \"function\") {\n this.requestAnimationFrameId = requestAnimationFrame(function () {\n try {\n _this.calculateToggleSize(width, height);\n }\n catch (error) {\n console.warn(\"Error calculating toggle size:\", error);\n }\n });\n }\n else {\n // Fallback if requestAnimationFrame is not supported\n this.calculateToggleSize(width, height);\n }\n };\n DOMBuilder.prototype.calculateToggleSize = function (width, height) {\n if (width) {\n this.toggle.style.width = width;\n }\n else {\n this.toggle.style.minWidth = \"100px\"; // First approach for better calculation\n this.toggle.style.minWidth = \"\".concat(Math.max(this.toggleOn.getBoundingClientRect().width, this.toggleOff.getBoundingClientRect().width) +\n this.toggleHandle.getBoundingClientRect().width / 2, \"px\");\n }\n if (height) {\n this.toggle.style.height = height;\n }\n else {\n this.toggle.style.minHeight = \"36px\"; // First approach for better calculation\n this.toggle.style.minHeight = \"\".concat(Math.max(this.toggleOn.getBoundingClientRect().height, this.toggleOff.getBoundingClientRect().height), \"px\");\n }\n // B: Apply on/off class\n this.toggleOn.classList.add(\"toggle-on\");\n this.toggleOff.classList.add(\"toggle-off\");\n // C: Finally, set lineHeight if needed\n if (height) {\n this.toggleOn.style.lineHeight = DOMBuilder.calcH(this.toggleOn) + \"px\";\n this.toggleOff.style.lineHeight = DOMBuilder.calcH(this.toggleOff) + \"px\";\n }\n };\n /**\n * Calculates the height of the toggle element that should be used for the line-height property.\n * This calculation is used when the toggle element is given a height that is not explicitly set.\n * The calculation takes into account the height of the toggle element, the border-top and border-bottom widths,\n * and the padding-top and padding-bottom of the toggle element.\n * @param toggleSpan The HTMLElement that represents the toggle element.\n * @returns The height of the toggle element that should be used for the line-height property.\n */\n DOMBuilder.calcH = function (toggleSpan) {\n var styles = globalThis.window.getComputedStyle(toggleSpan);\n var height = toggleSpan.offsetHeight;\n var borderTopWidth = Number.parseFloat(styles.borderTopWidth);\n var borderBottomWidth = Number.parseFloat(styles.borderBottomWidth);\n var paddingTop = Number.parseFloat(styles.paddingTop);\n var paddingBottom = Number.parseFloat(styles.paddingBottom);\n return (height - borderBottomWidth - borderTopWidth - paddingTop - paddingBottom);\n };\n /**\n * Cancels any pending animation frame request if one exists.\n * This is used to prevent unnecessary calculations when the toggle size is being changed.\n */\n DOMBuilder.prototype.cancelPendingAnimationFrame = function () {\n if (this.requestAnimationFrameId !== undefined && typeof cancelAnimationFrame === \"function\") {\n cancelAnimationFrame(this.requestAnimationFrameId);\n this.requestAnimationFrameId = undefined;\n }\n };\n /**\n * Handles the aria-labelledby and aria-label attributes of the toggle element.\n * If the checkbox element has a labels property and the length of the labels property is greater than 0,\n * the aria-labelledby attribute of the toggle element is set to the id of the labels elements.\n * Otherwise, the aria-label attribute of the toggle element is set to the label property of the ariaOpts object.\n * @param {AriaToggleOptions} ariaOpts - The object containing the label property to be used for the aria-label attribute.\n */\n DOMBuilder.prototype.handleLabels = function (ariaOpts) {\n var _a;\n if ((_a = this.checkbox.labels) === null || _a === void 0 ? void 0 : _a.length) {\n var ids = Array.from(this.checkbox.labels)\n .map(function (l) { return l.id; })\n .filter(Boolean);\n if (ids.length) {\n this.toggle.setAttribute(\"aria-labelledby\", ids.join(\" \"));\n }\n }\n else {\n this.toggle.setAttribute(\"aria-label\", ariaOpts.label);\n }\n };\n /**\n * Creates a tooltip for the toggle element.\n * If the tooltip is successfully created, it is stored in the `tooltip` property of the DOMBuilder instance.\n * @param {TooltipOptions} tooltip - The options for the tooltip.\n */\n DOMBuilder.prototype.createTooltip = function (tooltip) {\n try {\n this.tooltip = new globalThis.window.bootstrap.Tooltip(this.toggle, { placement: tooltip.placement, html: true, title: tooltip.title.on });\n }\n catch (error) {\n console.error(\"Error creating tooltip:\", error);\n }\n };\n /**\n * Renders the toggle element based on the provided state if the toggle is already built.\n * This method should be called whenever the state of the toggle changes.\n * @param {ToggleState} state The state of the toggle element.\n */\n DOMBuilder.prototype.render = function (state) {\n this.lastState = state;\n if (!this.isBuilt)\n return;\n this.updateToggleByValue(state);\n this.updateToggleByChecked(state);\n this.updateToggleByState(state);\n this.updateAria(state);\n this.updateTooltip(state);\n };\n /**\n * Updates the class of the toggle element based on the provided state.\n * Removes any existing on/off/indeterminate classes and adds the appropriate class based on the state.\n * If the state is indeterminate, adds the 'indeterminate' class and either the on or off class based on the checked attribute.\n * @param {ToggleState} state The state of the toggle element.\n */\n DOMBuilder.prototype.updateToggleByValue = function (state) {\n this.toggle.classList.remove(this.onStyle, this.offStyle, \"off\", \"indeterminate\");\n switch (state.value) {\n case ToggleStateValue.ON:\n this.toggle.classList.add(this.onStyle);\n break;\n case ToggleStateValue.OFF:\n this.toggle.classList.add(this.offStyle, \"off\");\n break;\n case ToggleStateValue.MIXED:\n this.toggle.classList.add(\"indeterminate\");\n if (state.checked) {\n this.toggle.classList.add(this.onStyle);\n }\n else {\n this.toggle.classList.add(this.offStyle, \"off\");\n }\n break;\n }\n };\n /**\n * Updates the toggle element based on the provided state.\n * Calls {@link DOMBuilder.updateCheckboxByChecked} and {@link DOMBuilder.updateInvCheckboxByChecked} to update the checkbox and inverted checkbox elements respectively.\n * @param {ToggleState} state The state of the toggle element.\n */\n DOMBuilder.prototype.updateToggleByChecked = function (state) {\n this.updateCheckboxByChecked(state);\n this.updateInvCheckboxByChecked(state);\n };\n /**\n * Updates the checkbox element based on the provided state.\n * Sets the checked attribute of the checkbox based on the state's checked attribute.\n * Sets the disabled and readonly attributes of the checkbox based on the state's status.\n * Adds or removes the 'disabled' class from the toggle element based on the state's status.\n * @param {ToggleState} state The state of the toggle element.\n */\n DOMBuilder.prototype.updateCheckboxByChecked = function (state) {\n this.checkbox.checked = state.checked;\n switch (state.status) {\n case ToggleStateStatus.ENABLED:\n this.checkbox.disabled = false;\n this.checkbox.readOnly = false;\n this.toggle.classList.remove(\"disabled\");\n this.toggle.removeAttribute(\"disabled\");\n break;\n case ToggleStateStatus.DISABLED:\n this.checkbox.disabled = true;\n this.checkbox.readOnly = false;\n this.toggle.classList.add(\"disabled\");\n this.toggle.setAttribute(\"disabled\", \"\");\n break;\n case ToggleStateStatus.READONLY:\n this.checkbox.disabled = false;\n this.checkbox.readOnly = true;\n this.toggle.classList.add(\"disabled\");\n this.toggle.setAttribute(\"disabled\", \"\");\n break;\n }\n };\n /**\n * Updates the inverted checkbox element based on the provided state.\n * Sets the checked attribute of the inverted checkbox to the opposite of the state's checked attribute.\n * Sets the disabled and readonly attributes of the inverted checkbox based on the state's status.\n * @param {ToggleState} state The state of the toggle element.\n */\n DOMBuilder.prototype.updateInvCheckboxByChecked = function (state) {\n if (!this.invCheckbox)\n return;\n this.invCheckbox.checked = !state.checked;\n switch (state.status) {\n case ToggleStateStatus.ENABLED:\n this.invCheckbox.disabled = false;\n this.invCheckbox.readOnly = false;\n break;\n case ToggleStateStatus.DISABLED:\n this.invCheckbox.disabled = true;\n this.invCheckbox.readOnly = false;\n break;\n case ToggleStateStatus.READONLY:\n this.invCheckbox.disabled = false;\n this.invCheckbox.readOnly = true;\n break;\n }\n };\n /**\n * Updates the indeterminate attribute of the checkbox and inverted checkbox elements based on the provided state.\n * If the state is indeterminate, sets the indeterminate attribute of the checkbox and inverted checkbox to true and removes the name attribute.\n * If the state is not indeterminate, sets the indeterminate attribute of the checkbox and inverted checkbox to false and sets the name attribute to the provided name.\n * @param {ToggleState} state The state of the toggle element.\n */\n DOMBuilder.prototype.updateToggleByState = function (state) {\n if (state.indeterminate) {\n this.checkbox.indeterminate = true;\n this.checkbox.removeAttribute(\"name\");\n if (this.invCheckbox)\n this.invCheckbox.indeterminate = true;\n if (this.invCheckbox)\n this.invCheckbox.removeAttribute(\"name\");\n }\n else {\n this.checkbox.indeterminate = false;\n if (this.name)\n this.checkbox.name = this.name;\n if (this.invCheckbox)\n this.invCheckbox.indeterminate = false;\n if (this.invCheckbox && this.name)\n this.invCheckbox.name = this.name;\n }\n };\n /**\n * Updates the aria attributes of the toggle element based on the provided state.\n * Sets aria-checked to \"mixed\" if the state is indeterminate, otherwise sets it to the string representation of the state's checked attribute.\n * Sets aria-disabled to the string representation of whether the state's status is disabled.\n * Sets aria-readonly to the string representation of whether the state's status is readonly.\n * @param {ToggleState} state The state of the toggle element.\n */\n DOMBuilder.prototype.updateAria = function (state) {\n if (state.indeterminate) {\n this.toggle.setAttribute(\"aria-checked\", \"mixed\");\n }\n else {\n this.toggle.setAttribute(\"aria-checked\", String(state.checked));\n }\n this.toggle.setAttribute(\"aria-disabled\", String(state.status === ToggleStateStatus.DISABLED));\n this.toggle.setAttribute(\"aria-readonly\", String(state.status === ToggleStateStatus.READONLY));\n };\n /**\n * Updates the tooltip of the toggle element based on the provided state.\n * Sets the content of the tooltip to the corresponding label based on the state's value.\n * If the tooltip or tooltipLabels are not set, does nothing.\n * @param {ToggleState} state The state of the toggle element.\n */\n DOMBuilder.prototype.updateTooltip = function (state) {\n if (!this.tooltip || !this.tooltipLabels)\n return;\n switch (state.value) {\n case ToggleStateValue.ON:\n this.tooltip.setContent({ \".tooltip-inner\": this.tooltipLabels.on });\n return;\n case ToggleStateValue.OFF:\n this.tooltip.setContent({ \".tooltip-inner\": this.tooltipLabels.off });\n return;\n case ToggleStateValue.MIXED:\n if (this.tooltipLabels.mixed)\n this.tooltip.setContent({ \".tooltip-inner\": this.tooltipLabels.mixed });\n return;\n }\n };\n Object.defineProperty(DOMBuilder.prototype, \"root\", {\n /**\n * Returns the root element of the toggle, which is the container of all toggle elements.\n * @returns {HTMLElement} The root element of the toggle.\n */\n get: function () {\n return this.toggle;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Destroys the toggle by removing the toggle element from the DOM and\n * inserting the original checkbox element back into its original position.\n * Also disconnects the ResizeObserver if it was used.\n */\n DOMBuilder.prototype.destroy = function () {\n var _a, _b;\n this.cancelPendingAnimationFrame();\n if (this.tooltip) {\n this.tooltip.dispose();\n this.tooltip = undefined;\n }\n (_a = this.toggle.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(this.checkbox, this.toggle);\n this.toggle.remove();\n (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();\n this.resizeObserver = undefined;\n this.isBuilt = false;\n };\n return DOMBuilder;\n}());\nexport { DOMBuilder };\n","export var SanitizeMode;\n(function (SanitizeMode) {\n SanitizeMode[\"HTML\"] = \"HTML\";\n SanitizeMode[\"TEXT\"] = \"TEXT\";\n})(SanitizeMode || (SanitizeMode = {}));\n/**\n * Sanitizes a given text string according to the provided options.\n * If the input text is null, it will return null.\n * If the input text is not null, it will sanitize the text according to the provided mode.\n * If the mode is HTML, it will sanitize the text using the sanitizeHTML function.\n * If the mode is TEXT, it will sanitize the text using the sanitizeText function.\n * @param text The text string to sanitize.\n * @param opts The options to use for sanitizing the text.\n * @return The sanitized text string, or null if the input text was null.\n */\nexport function sanitize(text, opts) {\n if (!text)\n return text;\n switch (opts.mode) {\n case SanitizeMode.HTML:\n return sanitizeHTML(text);\n case SanitizeMode.TEXT:\n return sanitizeText(text);\n }\n}\n/**\n * Sanitizes a given text string, replacing special characters with their HTML entities.\n * If the input text is null, it will return null.\n * @param text The text string to sanitize.\n * @return The sanitized text string, or null if the input text was null.\n */\nfunction sanitizeText(text) {\n var map = {\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n '\"': \""\",\n \"'\": \"'\",\n \"/\": \"/\"\n };\n // Using replace with regex for single-pass character mapping compatible with ES5\n return text.replace(/[&<>\"'/]/g, function (m) { return map[m]; });\n}\n/**\n * Sanitizes HTML content using an allow-list approach to prevent XSS attacks.\n *\n * @param html The HTML string to sanitize\n * @param options Configuration options for allowed tags and attributes\n * @returns Sanitized HTML string\n */\nfunction sanitizeHTML(html) {\n var config = {\n allowedTags: [\"b\", \"i\", \"strong\", \"em\", \"span\", \"small\", \"sup\", \"sub\", \"img\"],\n allowedAttributes: [\"class\", \"style\", \"src\", \"alt\", \"title\", \"data-*\"]\n };\n // Implementation using DOMParser for browser compatibility\n var parser = new DOMParser();\n var doc = parser.parseFromString(html, \"text/html\");\n // Sanitize all nodes in the document body\n var bodyChildren = Array.from(doc.body.childNodes);\n bodyChildren.forEach(function (node) { return sanitizeNode(node, config); });\n return doc.body.innerHTML;\n}\n/**\n * Sanitizes a single node in the document tree.\n *\n * For element nodes, it removes disallowed tags and attributes.\n * For text nodes, it keeps them as is.\n *\n * Recursively sanitizes all children of an element node.\n *\n * @param node The node to sanitize\n * @param config Configuration options for allowed tags and attributes\n */\nfunction sanitizeNode(node, config) {\n var sanitizeNodeRecursive = function (node) {\n var _a;\n if (node.nodeType === Node.ELEMENT_NODE) {\n var element_1 = node;\n var tagName = element_1.tagName.toLowerCase();\n // Remove disallowed tags\n if (!config.allowedTags.includes(tagName)) {\n // Replace disallowed element with its text content\n var fragment_1 = document.createDocumentFragment();\n Array.from(element_1.childNodes).forEach(function (child) {\n fragment_1.appendChild(child.cloneNode(true));\n });\n (_a = element_1.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(fragment_1, element_1);\n return;\n }\n // Remove disallowed attributes\n Array.from(element_1.attributes).forEach(function (attr) {\n var attrName = attr.name.toLowerCase();\n var isAllowed = config.allowedAttributes.some(function (allowed) {\n return allowed.endsWith(\"*\") ? attrName.startsWith(allowed.slice(0, -1)) : attrName === allowed;\n });\n if (isAllowed) {\n sanitizeAllowedAttr(element_1, attr, attrName);\n }\n else {\n element_1.removeAttribute(attr.name);\n }\n });\n // Recursively sanitize children\n var children = Array.from(element_1.childNodes);\n children.forEach(sanitizeNodeRecursive);\n }\n else if (node.nodeType === Node.TEXT_NODE) {\n // Text nodes are safe, keep them as is\n return;\n }\n };\n sanitizeNodeRecursive(node);\n}\n/**\n * Sanitizes an allowed attribute by removing it if its value is a dangerous protocol.\n * Only works for \"src\" and \"href\" attributes.\n * @param element The element to check for the attribute.\n * @param attr The attribute to check the value of.\n * @param attrName The name of the attribute to check (either \"src\" or \"href\").\n */\nfunction sanitizeAllowedAttr(element, attr, attrName) {\n if (attrName !== \"src\" && attrName !== \"href\")\n return;\n var value = attr.value.toLowerCase();\n // sonar typescript:S1523 - This is security detection, not execution\n var isDangerousProtocol = value.startsWith(\"javascript:\") ||\n value.startsWith(\"vbscript:\") ||\n (value.startsWith(\"data:\") && !value.startsWith(\"data:image/\"));\n if (isDangerousProtocol) {\n element.removeAttribute(attr.name);\n }\n}\n;\n/**\n * Checks if the given string is a valid numeric value.\n *\n * A valid numeric value is a `string` that starts with an optional plus or minus sign,\n * followed by one or more digits, optionally followed by a decimal point and\n * one or more digits.\n *\n * Examples of valid numeric values include \"123\", \"-123\", \"+123.45\", \"-123.45\", etc.\n * Examples of invalid numeric values include \"abc\", \"123abc\", \"123.abc\", etc.\n * @param {string | number} value The string or number to check for being a valid numeric value.\n * @returns {boolean} `true` if the string contains a valid numeric value, `false` otherwise.\n */\nexport function isNumeric(value) {\n return /^[+-]?\\d+(\\.\\d+)?$/.test(value.toString().trim());\n}\n","export var PlacementOptions;\n(function (PlacementOptions) {\n PlacementOptions[\"TOP\"] = \"top\";\n PlacementOptions[\"BOTTOM\"] = \"bottom\";\n PlacementOptions[\"LEFT\"] = \"left\";\n PlacementOptions[\"RIGHT\"] = \"right\";\n})(PlacementOptions || (PlacementOptions = {}));\n","import { isNumeric, sanitize, SanitizeMode } from \"./Tools\";\nimport { PlacementOptions, } from \"./OptionResolver.types\";\n/**\n * OptionResolver is responsible for reading HTML attributes and user options\n * to build a complete ToggleOptions object.\n * It also handles deprecated options.\n */\nvar OptionResolver = /** @class */ (function () {\n function OptionResolver() {\n }\n /**\n * Gets a sanitized attribute value from an HTML element\n * @param element HTMLInputElement to read\n * @param attrName Attribute name\n * @param options method options\n * @param options.sanitized Flag to indicate if the sanitized mode needs to be used (default: `TEXT`)\n * @returns Sanitized attribute value or null\n */\n OptionResolver.getAttr = function (element, attrName, opts) {\n var _a = (opts !== null && opts !== void 0 ? opts : {}).sanitized, sanitized = _a === void 0 ? SanitizeMode.TEXT : _a;\n var value = element.getAttribute(attrName);\n return sanitize(value, { mode: sanitized });\n ;\n };\n /**\n * Returns the value of an attribute, user-provided value, or default value\n * @param element HTMLInputElement to read\n * @param attrName Attribute name\n * @param userValue Value provided by the user\n * @param defaultValue Default value if neither attribute nor user value exists\n * @param sanitized Flag to indicate if the sanitized mode needs to be used (default: `TEXT`)\n * @returns Final attribute value\n */\n OptionResolver.getAttrOrDefault = function (element, attrName, userValue, defaultValue, sanitized) {\n if (sanitized === void 0) { sanitized = SanitizeMode.TEXT; }\n var sanitizedUserValue = typeof userValue === \"string\" ? sanitize(userValue, { mode: sanitized }) : userValue;\n return OptionResolver.getAttr(element, attrName, { sanitized: sanitized }) ||\n sanitizedUserValue ||\n defaultValue;\n };\n /**\n * Returns the value of an attribute, user-provided value, or marks as deprecated\n * @param element HTMLInputElement to read\n * @param attrName Attribute name\n * @param userValue Value provided by the user\n * @param sanitized Flag to indicate if the sanitized mode needs to be used (default: `TEXT`)\n * @returns Final attribute value or DeprecationConfig.value if not found\n */\n OptionResolver.getAttrOrDeprecation = function (element, attrName, userValue, sanitized) {\n if (sanitized === void 0) { sanitized = SanitizeMode.TEXT; }\n var sanitizedUserValue = typeof userValue === \"string\" ? sanitize(userValue, { mode: sanitized }) : userValue;\n return OptionResolver.getAttr(element, attrName, { sanitized: sanitized }) ||\n sanitizedUserValue ||\n DeprecationConfig.value;\n };\n /**\n * Resolves all toggle options from the element and user options\n * @param element HTMLInputElement representing the toggle\n * @param userOptions Options provided by the user\n * @returns Complete ToggleOptions object\n */\n OptionResolver.resolve = function (element, userOptions) {\n var _a;\n if (userOptions === void 0) { userOptions = {}; }\n var options = {\n onlabel: this.getAttrOrDeprecation(element, \"data-onlabel\", userOptions.onlabel, SanitizeMode.HTML),\n offlabel: this.getAttrOrDeprecation(element, \"data-offlabel\", userOptions.offlabel, SanitizeMode.HTML),\n onstyle: this.getAttrOrDefault(element, \"data-onstyle\", userOptions.onstyle, OptionResolver.DEFAULT.onstyle),\n offstyle: this.getAttrOrDefault(element, \"data-offstyle\", userOptions.offstyle, OptionResolver.DEFAULT.offstyle),\n onvalue: this.getAttr(element, \"value\") || this.getAttrOrDefault(element, \"data-onvalue\", userOptions.onvalue, OptionResolver.DEFAULT.onvalue),\n offvalue: this.getAttrOrDefault(element, \"data-offvalue\", userOptions.offvalue, OptionResolver.DEFAULT.offvalue),\n ontitle: this.getAttrOrDefault(element, \"data-ontitle\", userOptions.ontitle, OptionResolver.getAttr(element, \"title\") ||\n OptionResolver.DEFAULT.ontitle),\n offtitle: this.getAttrOrDefault(element, \"data-offtitle\", userOptions.offtitle, OptionResolver.getAttr(element, \"title\") ||\n OptionResolver.DEFAULT.offtitle),\n size: this.getAttrOrDefault(element, \"data-size\", userOptions.size, this.DEFAULT.size),\n style: this.getAttrOrDefault(element, \"data-style\", userOptions.style, this.DEFAULT.style),\n width: this.getAttrOrDefault(element, \"data-width\", userOptions.width, this.DEFAULT.width),\n height: this.getAttrOrDefault(element, \"data-height\", userOptions.height, this.DEFAULT.height),\n tabindex: Number(this.getAttrOrDefault(element, \"tabindex\", userOptions.tabindex, this.DEFAULT.tabindex)),\n tristate: element.hasAttribute(\"tristate\") ||\n userOptions.tristate ||\n OptionResolver.DEFAULT.tristate,\n name: this.getAttrOrDefault(element, \"name\", userOptions.name, this.DEFAULT.name),\n aria: {\n label: this.getAttrOrDefault(element, \"aria-label\", (_a = userOptions.aria) === null || _a === void 0 ? void 0 : _a.label, this.DEFAULT.aria.label),\n },\n tooltip: OptionResolver.resolveTooltipOptions(element, userOptions),\n };\n if (options.width && isNumeric(options.width))\n options.width = \"\".concat(options.width, \"px\");\n if (options.height && isNumeric(options.height))\n options.height = \"\".concat(options.height, \"px\");\n DeprecationConfig.handle(options, element, userOptions);\n return options;\n };\n /**\n * Resolve tooltip options from element attributes and user options.\n * @param element HTMLInputElement representing the toggle\n * @param userOptions Options provided by the user\n * @returns Resolved tooltip options or undefined if not found.\n */\n OptionResolver.resolveTooltipOptions = function (element, userOptions) {\n var _this = this;\n var _a, _b, _c, _d;\n var getTitle = function (attr, userOption) { return _this.getAttrOrDefault(element, attr, userOption, null, SanitizeMode.HTML) || _this.getAttr(element, \"data-tooltip-title\", { sanitized: SanitizeMode.HTML }); };\n var titleOn = getTitle(\"data-tooltip-title-on\", (_a = userOptions.tooltip) === null || _a === void 0 ? void 0 : _a.title.on);\n var titleOff = getTitle(\"data-tooltip-title-off\", (_b = userOptions.tooltip) === null || _b === void 0 ? void 0 : _b.title.off);\n var titleMixed = getTitle(\"data-tooltip-title-mixed\", (_c = userOptions.tooltip) === null || _c === void 0 ? void 0 : _c.title.mixed);\n if (!titleOn || !titleOff)\n return OptionResolver.DEFAULT.tooltip;\n var placement = this.getAttrOrDefault(element, \"data-tooltip-placement\", (_d = userOptions.tooltip) === null || _d === void 0 ? void 0 : _d.placement, PlacementOptions.TOP);\n return {\n placement: Object.values(PlacementOptions).includes(placement) ? placement : PlacementOptions.TOP,\n title: {\n on: titleOn,\n off: titleOff,\n mixed: titleMixed !== null && titleMixed !== void 0 ? titleMixed : undefined,\n },\n };\n };\n /** Default values for all toggle options */\n OptionResolver.DEFAULT = {\n onlabel: \"On\",\n onstyle: \"primary\",\n onvalue: null,\n ontitle: null,\n offlabel: \"Off\",\n offstyle: \"secondary\",\n offvalue: null,\n offtitle: null,\n size: \"\",\n style: \"\",\n width: null,\n height: null,\n tabindex: 0,\n tristate: false,\n name: null,\n aria: { label: \"Toggle\", },\n tooltip: undefined,\n };\n return OptionResolver;\n}());\nexport { OptionResolver };\n/** Types of deprecation source */\nvar OptionType;\n(function (OptionType) {\n OptionType[\"ATTRIBUTE\"] = \"attribute\";\n OptionType[\"OPTION\"] = \"option\";\n})(OptionType || (OptionType = {}));\n/**\n * Handles deprecated attributes and options for Bootstrap Toggle.\n */\nvar DeprecationConfig = /** @class */ (function () {\n function DeprecationConfig() {\n }\n /**\n * Processes deprecated options and attributes and logs warnings\n * @param options ToggleOptions object to update\n * @param element HTMLInputElement to read deprecated attributes from\n * @param userOptions UserOptions provided by the user\n */\n DeprecationConfig.handle = function (options, element, userOptions) {\n var _this = this;\n this.deprecatedOptions.forEach(function (_a) {\n var currentOpt = _a.currentOpt, deprecatedAttr = _a.deprecatedAttr, deprecatedOpt = _a.deprecatedOpt, mode = _a.mode;\n if (options[currentOpt] === DeprecationConfig.value) {\n var deprecatedAttrSanitized = sanitize(element.getAttribute(deprecatedAttr), { mode: mode });\n if (deprecatedAttrSanitized) {\n _this.log(OptionType.ATTRIBUTE, deprecatedAttr, \"data-\".concat(currentOpt));\n options[currentOpt] = deprecatedAttrSanitized;\n }\n else if (userOptions[deprecatedOpt]) {\n _this.log(OptionType.OPTION, deprecatedOpt, currentOpt);\n options[currentOpt] = userOptions[deprecatedOpt];\n }\n else {\n options[currentOpt] = OptionResolver.DEFAULT[currentOpt];\n }\n }\n });\n };\n /**\n * Logs a deprecation warning to the console\n * @param type Source of the deprecated option (ATTRIBUTE | OPTION)\n * @param oldLabel Deprecated attribute or option name\n * @param newLabel Recommended replacement option name\n */\n DeprecationConfig.log = function (type, oldLabel, newLabel) {\n console.warn(\"Bootstrap Toggle deprecation warning: Using \".concat(oldLabel, \" \").concat(type, \" is deprecated. Use \").concat(newLabel, \" instead.\"));\n };\n /** Unique string used to detect deprecated placeholders */\n DeprecationConfig.value = \"BOOTSTRAP TOGGLE DEPRECATION CHECK -- a0Jhux0QySypjjs4tLtEo8xT2kx0AbYaq9K6mgNjWSs0HF0L8T8J0M0o3Kr7zkm7 --\";\n /** Mapping of current option, deprecated attribute, and deprecated user option */\n DeprecationConfig.deprecatedOptions = [\n {\n currentOpt: \"onlabel\",\n deprecatedAttr: \"data-on\",\n deprecatedOpt: \"on\",\n mode: SanitizeMode.HTML\n },\n {\n currentOpt: \"offlabel\",\n deprecatedAttr: \"data-off\",\n deprecatedOpt: \"off\",\n mode: SanitizeMode.HTML\n },\n ];\n return DeprecationConfig;\n}());\n","var ToggleEvents;\n(function (ToggleEvents) {\n ToggleEvents[\"ON\"] = \"toggle:on\";\n ToggleEvents[\"OFF\"] = \"toggle:off\";\n ToggleEvents[\"MIXED\"] = \"toggle:mixed\";\n ToggleEvents[\"ENABLED\"] = \"toggle:enabled\";\n ToggleEvents[\"DISABLED\"] = \"toggle:disabled\";\n ToggleEvents[\"READONLY\"] = \"toggle:readonly\";\n})(ToggleEvents || (ToggleEvents = {}));\nexport default ToggleEvents;\n","var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nimport { ToggleActionType, ToggleStateStatus, ToggleStateValue, } from \"./StateReducer.types\";\nvar StateReducer = /** @class */ (function () {\n /**\n * Constructor for the StateReducer class.\n * @param element The HTMLInputElement which represents the toggle.\n * @param isTristate A boolean indicating whether the toggle is tristate.\n * Initializes the toggle state with the given element and tristate value.\n */\n function StateReducer(element, isTristate) {\n this.isTristate = isTristate;\n this.state = this.getElementState(element);\n }\n /**\n * Retrieves the current state of the toggle based on the HTMLInputElement.\n * The state is determined by the following:\n * - The checked property of the input element\n * - The disabled property of the input element\n * - The readonly property of the input element\n * - The indeterminate property of the input element if the toggle is tristate\n * @returns An object containing the state of the toggle.\n */\n StateReducer.prototype.getElementState = function (element) {\n var checked = element.checked;\n var status;\n if (element.disabled) {\n status = ToggleStateStatus.DISABLED;\n }\n else if (element.readOnly) {\n status = ToggleStateStatus.READONLY;\n }\n else {\n status = ToggleStateStatus.ENABLED;\n }\n var indeterminate = this.isTristate && element.indeterminate;\n var value;\n if (indeterminate) {\n value = ToggleStateValue.MIXED;\n }\n else if (checked) {\n value = ToggleStateValue.ON;\n }\n else {\n value = ToggleStateValue.OFF;\n }\n return {\n value: value,\n checked: checked,\n status: status,\n indeterminate: indeterminate,\n };\n };\n /**\n * Get the current toggle state.\n * @returns An immutable copy of the current toggle state.\n */\n StateReducer.prototype.get = function () {\n return Object.freeze(__assign({}, this.state));\n };\n /**\n * Determines whether the toggle is enabled and can be interacted with.\n * @returns True if the toggle is enabled and can be interacted with, false otherwise.\n */\n StateReducer.prototype.canInteract = function () {\n return this.state.status === ToggleStateStatus.ENABLED;\n };\n /**\n * Synchronizes the internal state of the toggle with the provided HTMLInputElement.\n * This method is useful when you need to update the internal state of the toggle\n * manually, such as when the toggle is updated programmatically.\n * @param element The HTMLInputElement to synchronize the toggle state with.\n */\n StateReducer.prototype.sync = function (element) {\n this.state = this.getElementState(element);\n };\n /**\n * Apply a toggle action to the toggle state.\n * @param action The toggle action to apply.\n * @returns A boolean indicating whether the action was successful.\n * If the toggle is disabled, any action execpect {@code ToggleActionType.ENABLE} will return {@code false}.\n * If the toggle is currently in the target state of the action, the action will return {@code false}.\n * If the toggle is in the indeterminate state and the action is {@code ToggleActionType.DETERMINATE},\n * the toggle will be set to the checked state.\n * If the action is {@code ToggleActionType.NEXT} :\n * - For a tristate toggle, the toggle will do ON -> INDETERMINATE -> OFF -> INDETERMINATE -> ON.\n * - For a non-tristate toggle, the toggle will do ON -> OFF -> ON.\n */\n StateReducer.prototype.do = function (action) {\n var actionsRequiringInteract = [\n ToggleActionType.ON,\n ToggleActionType.OFF,\n ToggleActionType.TOGGLE,\n ToggleActionType.INDETERMINATE,\n ToggleActionType.DETERMINATE,\n ToggleActionType.NEXT,\n ToggleActionType.READONLY,\n ];\n if (actionsRequiringInteract.includes(action) && !this.canInteract())\n return false;\n switch (action) {\n case ToggleActionType.ON:\n return this.setValueIfChanged(ToggleStateValue.ON, true, false);\n case ToggleActionType.OFF:\n return this.setValueIfChanged(ToggleStateValue.OFF, false, false);\n case ToggleActionType.TOGGLE:\n if (this.state.value === ToggleStateValue.ON)\n return this.do(ToggleActionType.OFF);\n if (this.state.value === ToggleStateValue.OFF)\n return this.do(ToggleActionType.ON);\n return false;\n case ToggleActionType.INDETERMINATE:\n return this.setValueIfChanged(ToggleStateValue.MIXED, undefined, true);\n case ToggleActionType.DETERMINATE:\n if (this.state.value != ToggleStateValue.MIXED)\n return false;\n return this.setValue(this.state.checked ? ToggleStateValue.ON : ToggleStateValue.OFF, this.state.checked, false);\n case ToggleActionType.NEXT:\n return this.doNext();\n case ToggleActionType.DISABLE:\n return this.setStatusIfChanged(ToggleStateStatus.DISABLED);\n case ToggleActionType.ENABLE:\n return this.setStatusIfChanged(ToggleStateStatus.ENABLED);\n case ToggleActionType.READONLY:\n return this.setStatus(ToggleStateStatus.READONLY);\n }\n };\n /**\n * Sets the state of the toggle to the provided value.\n * If checked or indeterminate is provided, sets the corresponding property of the state to the provided value.\n * Otherwise, leaves the property unchanged.\n * @param value The value of the toggle to set.\n * @param checked The checked state of the toggle to set. If not provided, the property is left unchanged.\n * @param indeterminate The indeterminate state of the toggle to set. If not provided, the property is left unchanged.\n * @returns A boolean indicating whether the state was updated.\n */\n StateReducer.prototype.setValue = function (value, checked, indeterminate) {\n this.state = __assign(__assign({}, this.state), { value: value, checked: checked !== null && checked !== void 0 ? checked : this.state.checked, indeterminate: indeterminate !== null && indeterminate !== void 0 ? indeterminate : this.state.indeterminate });\n return true;\n };\n /**\n * Sets the state of the toggle to the provided value if the value is different from the current state.\n * If checked or indeterminate is provided, sets the corresponding property of the state to the provided value.\n * Otherwise, leaves the property unchanged.\n * @returns A boolean indicating whether the state was updated.\n */\n StateReducer.prototype.setValueIfChanged = function (value, checked, indeterminate) {\n if (this.state.value === value)\n return false;\n return this.setValue(value, checked, indeterminate);\n };\n /**\n * Sets the status of the toggle to the provided value.\n * @param status The new status of the toggle.\n * @returns A boolean indicating whether the state was updated.\n */\n StateReducer.prototype.setStatus = function (status) {\n this.state = __assign(__assign({}, this.state), { status: status });\n return true;\n };\n /**\n * Sets the status of the toggle to the provided value if the value is different from the current status.\n * @param status The new status of the toggle.\n * @returns A boolean indicating whether the state was updated.\n */\n StateReducer.prototype.setStatusIfChanged = function (status) {\n if (this.state.status === status)\n return false;\n return this.setStatus(status);\n };\n /**\n * Applies the next action based on the current state of the toggle.\n * If the toggle is tristate, cycles through the on, off, and indeterminate states.\n * If the toggle is not tristate, cycles through the on and off states.\n * @returns A boolean indicating whether the state was updated.\n */\n StateReducer.prototype.doNext = function () {\n if (this.isTristate) {\n if (this.state.value === ToggleStateValue.ON || this.state.value === ToggleStateValue.OFF) {\n return this.do(ToggleActionType.INDETERMINATE);\n }\n if (this.state.value === ToggleStateValue.MIXED) {\n return this.state.checked\n ? this.do(ToggleActionType.OFF)\n : this.do(ToggleActionType.ON);\n }\n }\n else {\n return this.state.value === ToggleStateValue.ON\n ? this.do(ToggleActionType.OFF)\n : this.do(ToggleActionType.ON);\n }\n return false;\n };\n return StateReducer;\n}());\nexport { StateReducer };\n","export var ToggleMethods;\n(function (ToggleMethods) {\n ToggleMethods[\"ON\"] = \"on\";\n ToggleMethods[\"OFF\"] = \"off\";\n ToggleMethods[\"TOGGLE\"] = \"toggle\";\n ToggleMethods[\"DETERMINATE\"] = \"determinate\";\n ToggleMethods[\"INDETERMINATE\"] = \"indeterminate\";\n ToggleMethods[\"ENABLE\"] = \"enable\";\n ToggleMethods[\"DISABLE\"] = \"disable\";\n ToggleMethods[\"READONLY\"] = \"readonly\";\n ToggleMethods[\"DESTROY\"] = \"destroy\";\n ToggleMethods[\"RERENDER\"] = \"rerender\";\n})(ToggleMethods || (ToggleMethods = {}));\n","import { DOMBuilder } from \"./core/DOMBuilder\";\nimport { OptionResolver } from \"./core/OptionResolver\";\nimport { StateReducer } from \"./core/StateReducer\";\nimport { ToggleActionType, ToggleStateValue } from \"./core/StateReducer.types\";\nimport ToggleEvents from \"./types/ToggleEvents\";\nvar Toggle = /** @class */ (function () {\n /**\n * Initializes a new instance of the BootstrapToggle class.\n * @param element The HTMLInputElement element which represents the toggle.\n * @param options The options for the toggle.\n * @returns The constructed BootstrapToggle instance.\n */\n function Toggle(element, options) {\n var _this = this;\n this.pointer = null;\n this.SCROLL_THRESHOLD = 10;\n this.eventsBound = false;\n this.suppressExternalSync = false;\n this.originalDescriptors = new Map();\n /**\n * Handles the change event of the input element of the toggle.\n * This event listener is responsible for detecting when the input element\n * of the toggle changes its state and triggering the update method to keep the toggle in sync.\n */\n this.onExternalChange = function () {\n _this.update();\n };\n this.onFormReset = function () {\n setTimeout(function () { return _this.onExternalChange(); }, 0);\n };\n /**\n * Handles pointer down events by initiating the toggle action and setting up\n * listeners for pointer movement, release, and cancellation.\n *\n * The method early exits if:\n * - the pointer event is not a primary mouse button click\n * - the toggle cannot be interacted with (`disabled` or `readonly`)\n * @param e The PointerEvent object representing the pointer down event.\n */\n this.onPointerDown = function (e) {\n if (e.pointerType === \"mouse\" && e.button !== 0)\n return;\n if (!_this.stateReducer.canInteract())\n return;\n _this.pointer = { x: e.clientX, y: e.clientY };\n _this.domBuilder.root.addEventListener(\"pointermove\", _this.onPointerMove, {\n passive: true,\n });\n _this.domBuilder.root.addEventListener(\"pointerup\", _this.onPointerUp, {\n passive: true,\n });\n _this.domBuilder.root.addEventListener(\"pointercancel\", _this.onPointerCancel, { passive: true });\n };\n /**\n * Handles pointer move events by checking the distance moved from the initial pointer down position.\n * If the pointer has moved beyond a certain threshold, the pointer interaction is cancelled.\n *\n * Allows dragging within the width of the toggle but cancels if vertical movement exceeds the scroll threshold.\n * @param e The PointerEvent object representing the pointer move event.\n */\n this.onPointerMove = function (e) {\n var dx = Math.abs(e.clientX - _this.pointer.x);\n var dy = Math.abs(e.clientY - _this.pointer.y);\n if (dy > _this.SCROLL_THRESHOLD || dx > _this.domBuilder.root.offsetWidth) {\n _this.onPointerCancel();\n }\n };\n /**\n * Handles pointer up events by determining if the pointer interaction\n * should trigger a toggle action based on the distance moved.\n *\n * If the pointer has moved beyond a certain threshold, the pointer interaction is cancelled.\n * Allows dragging within the width of the toggle but cancels if vertical movement exceeds the scroll threshold.\n * Finally, it cleans up by calling the pointer cancel handler.\n *\n * If the pointer event is not a primary mouse button click, the interaction is cancelled.\n * @param e The PointerEvent object representing the pointer up event.\n */\n this.onPointerUp = function (e) {\n if (e.pointerType === \"mouse\" && e.button !== 0) {\n _this.onPointerCancel();\n return;\n }\n var dx = Math.abs(e.clientX - _this.pointer.x);\n var dy = Math.abs(e.clientY - _this.pointer.y);\n if (dy <= _this.SCROLL_THRESHOLD && dx <= _this.domBuilder.root.offsetWidth) {\n _this.apply(ToggleActionType.NEXT);\n }\n _this.onPointerCancel();\n };\n /**\n * Cleans up pointer event listeners after a pointer interaction is completed or cancelled.\n *\n * This method removes the `pointermove`, `pointerup`, and `pointercancel` event listeners\n * from the root element of the toggle.\n * However, `pointerdown` listener remains active for future interactions.\n */\n this.onPointerCancel = function () {\n _this.domBuilder.root.removeEventListener(\"pointermove\", _this.onPointerMove);\n _this.domBuilder.root.removeEventListener(\"pointerup\", _this.onPointerUp);\n _this.domBuilder.root.removeEventListener(\"pointercancel\", _this.onPointerCancel);\n };\n this.handlerKeyboardEvent = function (e) {\n if (e.key === \" \" || e.key === \"Enter\") {\n e.preventDefault();\n _this.apply(ToggleActionType.NEXT);\n }\n };\n this.handlerLabelEvent = function (e) {\n e.preventDefault();\n _this.apply(ToggleActionType.NEXT);\n _this.domBuilder.root.focus();\n };\n this.element = element;\n this.userOptions = options;\n this.options = OptionResolver.resolve(element, options);\n this.stateReducer = new StateReducer(element, this.options.tristate);\n this.domBuilder = new DOMBuilder(element, this.options, this.stateReducer.get());\n this.bindEventListeners();\n this.interceptInputProperties();\n this.element.bsToggle = this;\n }\n /**\n * Intercepts the following input properties to detect external changes:\n * - checked\n * - disabled\n * - readonly\n * - indeterminate\n * This method is used to detect changes made to the input element directly,\n * rather than through the BootstrapToggle API. It is used to maintain the\n * state of the toggle in cases where the user changes the input element\n * directly, rather than through the API.\n * @returns void\n */\n Toggle.prototype.interceptInputProperties = function () {\n var _this = this;\n var props = [\"checked\", \"disabled\", \"readOnly\", \"indeterminate\"];\n props.forEach(function (prop) {\n var descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(_this.element), prop);\n if (!(descriptor === null || descriptor === void 0 ? void 0 : descriptor.set))\n return;\n _this.originalDescriptors.set(prop, descriptor);\n Object.defineProperty(_this.element, prop, {\n configurable: true,\n get: function () { return descriptor.get.call(_this.element); },\n set: function (value) {\n descriptor.set.call(_this.element, value);\n if (_this.suppressExternalSync)\n return;\n _this.onExternalChange();\n },\n });\n });\n };\n /**\n * Restores the original input properties of the toggle element.\n * This method is used to restore the original descriptors of the input properties\n * which were intercepted by the BootstrapToggle to detect external changes.\n * @returns void\n */\n Toggle.prototype.restoreInputProperties = function () {\n var _this = this;\n this.originalDescriptors.forEach(function (descriptor, prop) {\n Object.defineProperty(_this.element, prop, descriptor);\n });\n this.originalDescriptors.clear();\n };\n /**\n * Binds event listeners to the toggle element.\n * This method is called by the constructor and is responsible for\n * binding the following event listeners:\n * - Pointer events (click, touchstart, touchend)\n * - Keyboard events (keydown, keyup)\n * - Label events (click)\n * If the event listeners are already bound (i.e. this.eventsBound is true),\n * this method does nothing.\n * @returns void\n */\n Toggle.prototype.bindEventListeners = function () {\n if (this.eventsBound)\n return;\n this.bindFormResetListener();\n this.bindPointerEventListener();\n this.bindKeyboardEventListener();\n this.bindLabelEventListener();\n this.eventsBound = true;\n };\n /**\n * Unbinds all event listeners from the toggle element.\n * This method is called by the destructor and is responsible for\n * unbinding the following event listeners:\n * - Pointer events (click, touchstart, touchend)\n * - Keyboard events (keydown, keyup)\n * - Label events (click)\n * If the event listeners are not bound (i.e. this.eventsBound is false),\n * this method does nothing.\n * @returns void\n */\n Toggle.prototype.unbindEventListeners = function () {\n if (!this.eventsBound)\n return;\n this.unbindFormResetListener();\n this.unbindPointerEventListener();\n this.unbindKeyboardEventListener();\n this.unbindLabelEventListener();\n this.eventsBound = false;\n };\n Toggle.prototype.bindFormResetListener = function () {\n var form = this.element.form;\n if (!form)\n return;\n form.addEventListener(\"reset\", this.onFormReset);\n };\n Toggle.prototype.unbindFormResetListener = function () {\n var form = this.element.form;\n if (!form)\n return;\n form.removeEventListener(\"reset\", this.onFormReset);\n };\n /**\n * Binds a pointerdown event listener to the root element of the toggle.\n * The event listener is responsible for handling pointer events (e.g. mouse clicks, touch events)\n * and triggering the toggle's state change when a pointer event occurs.\n * The event listener is bound with the passive option, which means that it will not block\n * other event listeners from being triggered.\n */\n Toggle.prototype.bindPointerEventListener = function () {\n this.domBuilder.root.addEventListener(\"pointerdown\", this.onPointerDown, {\n passive: true,\n });\n };\n /**\n * Unbinds the pointerdown event listener from the root element of the toggle.\n * This method is responsible for unbinding the pointerdown event listener that was\n * previously bound by the bindPointerEventListener method.\n * If the event listener is not bound (i.e. this.eventsBound is false), this method does nothing.\n * @returns void\n */\n Toggle.prototype.unbindPointerEventListener = function () {\n this.domBuilder.root.removeEventListener(\"pointerdown\", this.onPointerDown);\n };\n /**\n * Binds a keydown event listener to the root element of the toggle.\n * The event listener is responsible for handling keydown events\n * and triggering the toggle's state change when a keydown event occurs.\n */\n Toggle.prototype.bindKeyboardEventListener = function () {\n this.domBuilder.root.addEventListener(\"keydown\", this.handlerKeyboardEvent, { passive: false });\n };\n /**\n * Unbinds the keydown event listener from the root element of the toggle.\n * This method is responsible for unbinding the keydown event listener that was\n * previously bound by the bindKeyboardEventListener method.\n * If the event listener is not bound (i.e. this.eventsBound is false), this method does nothing.\n * @returns void\n */\n Toggle.prototype.unbindKeyboardEventListener = function () {\n this.domBuilder.root.removeEventListener(\"keydown\", this.handlerKeyboardEvent);\n };\n /**\n * Binds a click event listener to all labels that are associated with the toggle's input element.\n * The event listener is responsible for handling click events and triggering the toggle's state change when a click event occurs.\n * 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.\n * This method is called by the constructor and is responsible for binding the event listener to the toggle's labels.\n * If the toggle's input element does not have an id (i.e. this.element.id is null or undefined), this method does nothing.\n * @returns void\n */\n Toggle.prototype.bindLabelEventListener = function () {\n var _this = this;\n if (this.element.id) {\n document\n .querySelectorAll('label[for=\"' + this.element.id + '\"]')\n .forEach(function (label) {\n label.addEventListener(\"click\", _this.handlerLabelEvent, {\n passive: false,\n });\n });\n }\n };\n /**\n * Unbinds the click event listener from all labels that are associated with the toggle's input element.\n * This method is responsible for unbinding the event listener that was previously bound by the bindLabelEventListener method.\n * If the toggle's input element does not have an id (i.e. this.element.id is null or undefined), this method does nothing.\n * @returns void\n */\n Toggle.prototype.unbindLabelEventListener = function () {\n var _this = this;\n if (this.element.id) {\n document\n .querySelectorAll('label[for=\"' + this.element.id + '\"]')\n .forEach(function (label) {\n label.removeEventListener(\"click\", _this.handlerLabelEvent);\n });\n }\n };\n /**\n * Applies a toggle action to the toggle state and renders the toggle element.\n * If the action is successful, this method will render the toggle element with the new state.\n * If the silent parameter is false, this method will also trigger the change event.\n * @param action The toggle action to apply.\n * @param silent A boolean indicating whether to trigger the change event after applying the action.\n */\n Toggle.prototype.apply = function (action, silent) {\n if (silent === void 0) { silent = false; }\n if (!this.stateReducer.do(action))\n return;\n this.suppressExternalSync = true;\n try {\n var state = this.stateReducer.get();\n this.domBuilder.render(state);\n if (!silent)\n this.trigger(action, state);\n }\n finally {\n this.suppressExternalSync = false;\n }\n };\n /**\n * Toggles the state of the toggle.\n * If the toggle is currently in the on state, it will be set to the off state.\n * If the toggle is currently in the off state, it will be set to the on state.\n * If the toggle is currently in the indeterminate state, it will be set to the on state.\n * If the silent parameter is false, this method will also trigger the change event.\n * @param silent A boolean indicating whether to trigger the change event after applying the action.\n */\n Toggle.prototype.toggle = function (silent) {\n if (silent === void 0) { silent = false; }\n this.apply(ToggleActionType.TOGGLE, silent);\n };\n /**\n * Sets the toggle state to on.\n * If the silent parameter is false, this method will also trigger the change event.\n * @param silent A boolean indicating whether to trigger the change event after applying the action.\n */\n Toggle.prototype.on = function (silent) {\n if (silent === void 0) { silent = false; }\n this.apply(ToggleActionType.ON, silent);\n };\n /**\n * Sets the toggle state to off.\n * If the silent parameter is false, this method will also trigger the change event.\n * @param silent A boolean indicating whether to trigger the change event after applying the action.\n */\n Toggle.prototype.off = function (silent) {\n if (silent === void 0) { silent = false; }\n this.apply(ToggleActionType.OFF, silent);\n };\n /**\n * Sets the toggle state to indeterminate.\n * If the silent parameter is false, this method will also trigger the change event.\n * @param {boolean} silent A boolean indicating whether to trigger the change event after applying the action.\n */\n Toggle.prototype.indeterminate = function (silent) {\n if (silent === void 0) { silent = false; }\n this.apply(ToggleActionType.INDETERMINATE, silent);\n };\n /**\n * Sets the toggle state to determinate.\n * If the silent parameter is false, this method will also trigger the change event.\n * @param {boolean} silent A boolean indicating whether to trigger the change event after applying the action.\n */\n Toggle.prototype.determinate = function (silent) {\n if (silent === void 0) { silent = false; }\n this.apply(ToggleActionType.DETERMINATE, silent);\n };\n /**\n * Enables the toggle.\n * If the toggle is currently disabled, this method will set the toggle state to enabled.\n * If the silent parameter is false, this method will also trigger the change event.\n * @param {boolean} silent A boolean indicating whether to trigger the change event after applying the action.\n * @returns void\n */\n Toggle.prototype.enable = function (silent) {\n if (silent === void 0) { silent = false; }\n this.apply(ToggleActionType.ENABLE, silent);\n };\n /**\n * Disables the toggle.\n * If the toggle is currently enabled, this method will set the toggle state to disabled.\n * If the silent parameter is false, this method will also trigger the change event.\n * @param {boolean} silent A boolean indicating whether to trigger the change event after applying the action.\n */\n Toggle.prototype.disable = function (silent) {\n if (silent === void 0) { silent = false; }\n this.apply(ToggleActionType.DISABLE, silent);\n };\n /**\n * Sets the toggle state to readonly.\n * If the toggle is currently disabled or enabled, this method will set the toggle state to readonly.\n * If the silent parameter is false, this method will also trigger the change event.\n * @param {boolean} silent A boolean indicating whether to trigger the change event after applying the action.\n * @returns void\n */\n Toggle.prototype.readonly = function (silent) {\n if (silent === void 0) { silent = false; }\n this.apply(ToggleActionType.READONLY, silent);\n };\n /**\n * Synchronizes the toggle state with the input element and renders the toggle.\n */\n Toggle.prototype.update = function () {\n this.suppressExternalSync = true;\n try {\n this.stateReducer.sync(this.element);\n this.domBuilder.render(this.stateReducer.get());\n }\n finally {\n this.suppressExternalSync = false;\n }\n };\n /**\n * Triggers the change event on the toggle's input element and the appropriate toggle event.\n * This method is called after a toggle action is applied to notify listeners of the state change.\n * @param {ToggleActionType} action The toggle action that was applied.\n * @param {ToggleState} state The state of the toggle once the action was applied.\n */\n Toggle.prototype.trigger = function (action, state) {\n this.element.dispatchEvent(new Event(\"change\", { bubbles: true }));\n var eventName = this.getEventForAction(action, state);\n var detail = { state: state };\n this.element.dispatchEvent(new CustomEvent(eventName, {\n bubbles: true,\n detail: detail\n }));\n };\n /**\n * Returns the corresponding toggle event for the given toggle action and state.\n * This method is used to determine which toggle event to trigger after a toggle action is applied.\n * @param {ToggleActionType} action The toggle action that was applied.\n * @param {ToggleState} state The previous state of the toggle before the action was applied.\n * @returns {ToggleEvents} The corresponding toggle event for the given toggle action and state.\n */\n Toggle.prototype.getEventForAction = function (action, state) {\n switch (action) {\n case ToggleActionType.ON:\n return ToggleEvents.ON;\n case ToggleActionType.OFF:\n return ToggleEvents.OFF;\n case ToggleActionType.INDETERMINATE:\n return ToggleEvents.MIXED;\n case ToggleActionType.ENABLE:\n return ToggleEvents.ENABLED;\n case ToggleActionType.DISABLE:\n return ToggleEvents.DISABLED;\n case ToggleActionType.READONLY:\n return ToggleEvents.READONLY;\n case ToggleActionType.DETERMINATE:\n case ToggleActionType.TOGGLE:\n case ToggleActionType.NEXT:\n return this.getValueEvent(state);\n }\n };\n /**\n * Returns the corresponding toggle event for the given toggle state.\n * This method is used to determine which toggle event to trigger after a toggle action is applied.\n * @param {ToggleState} state The previous state of the toggle before the action was applied.\n * @returns {ToggleEvents} The corresponding toggle event for the given toggle state.\n */\n Toggle.prototype.getValueEvent = function (state) {\n switch (state.value) {\n case ToggleStateValue.ON:\n return ToggleEvents.ON;\n case ToggleStateValue.OFF:\n return ToggleEvents.OFF;\n case ToggleStateValue.MIXED:\n return ToggleEvents.MIXED;\n }\n };\n /**\n * Destroys the toggle element and unbinds all event listeners.\n *This method is useful when you need to remove the toggle element from the DOM.\n *After calling this method, the toggle element will be removed from the DOM and all event listeners will be unbound.\n */\n Toggle.prototype.destroy = function () {\n this.restoreInputProperties();\n this.unbindEventListeners();\n this.domBuilder.destroy();\n delete this.element.bsToggle;\n };\n /**\n * Destroys the toggle element and reinitializes it with the same options.\n *This method is useful when you need to reinitialize the toggle element with the same options.\n */\n Toggle.prototype.rerender = function () {\n this.destroy();\n var _ = new Toggle(this.element, this.userOptions);\n };\n return Toggle;\n}());\nexport { Toggle };\n","import { Toggle } from \"./BootstrapToggle\";\r\nimport { ToggleMethods } from \"./types/ToggleMethods\";\r\n\r\n+(function ($) {\r\n function Plugin(options, silent) {\r\n const optArg = Array.prototype.slice.call(arguments, 1)[0];\r\n\r\n return ( this ).each(function () {\r\n const $this = $(this);\r\n let _bsToggle = this.bsToggle || new Toggle(this, (options && typeof options !== \"string\") ? options : {});\r\n\r\n if (options && typeof options === \"string\") {\r\n switch (options.toLowerCase()) {\r\n case ToggleMethods.TOGGLE:\r\n _bsToggle.toggle(silent);\r\n break;\r\n case ToggleMethods.ON:\r\n _bsToggle.on(silent);\r\n break;\r\n case ToggleMethods.OFF:\r\n _bsToggle.off(silent);\r\n break;\r\n case ToggleMethods.INDETERMINATE:\r\n _bsToggle.indeterminate(silent);\r\n break;\r\n case ToggleMethods.DETERMINATE:\r\n _bsToggle.determinate(silent);\r\n break;\r\n case ToggleMethods.ENABLE:\r\n _bsToggle.enable(silent);\r\n break;\r\n case ToggleMethods.DISABLE:\r\n _bsToggle.disable(silent);\r\n break;\r\n case ToggleMethods.READONLY:\r\n _bsToggle.readonly(silent);\r\n break;\r\n case ToggleMethods.DESTROY:\r\n _bsToggle.destroy();\r\n break;\r\n case ToggleMethods.RERENDER:\r\n _bsToggle.rerender();\r\n break;\r\n }\r\n }\r\n });\r\n }\r\n\r\n let old = $.fn.bootstrapToggle;\r\n\r\n $.fn.bootstrapToggle = Plugin;\r\n $.fn.bootstrapToggle.Constructor = Toggle;\r\n\r\n // TOGGLE NO CONFLICT\r\n // ==================\r\n\r\n $.fn.toggle.noConflict = function () {\r\n $.fn.bootstrapToggle = old;\r\n return this;\r\n };\r\n\r\n /**\r\n * Replace all `input[type=checkbox][data-toggle=\"toggle\"]` inputs with \"Bootstrap-Toggle\"\r\n * Executes once page elements have rendered enabling script to be placed in `<head>`\r\n */\r\n $(function () {\r\n $(\"input[type=checkbox][data-toggle^=toggle]\").bootstrapToggle();\r\n });\r\n})(jQuery);\r\n"],"names":["ToggleStateValue","ToggleStateStatus","ToggleActionType","SanitizeMode","PlacementOptions","DOMBuilder","checkbox","options","state","this","isBuilt","lastState","onStyle","concat","onstyle","offStyle","offstyle","name","onvalue","value","invCheckbox","offvalue","createInvCheckbox","sizeClass","sizeResolver","size","toggleOn","createToggleSpan","onlabel","ontitle","toggleOff","offlabel","offtitle","toggleHandle","createToggleHandle","toggleGroup","createToggleGroup","toggle","document","createElement","tooltip","tooltipLabels","title","isVisible","renderToggle","render","deferRender","prototype","parent","parentElement","offsetWidth","offsetHeight","_this","resizeObserver","ResizeObserver","entries","disconnect","_i","entries_1","length","entry","contentRect","width","height","observe","_a","large","lg","small","sm","mini","xs","offValue","cloneNode","dataset","removeAttribute","_b","style","tabindex","aria","className","tabIndex","role","insertBefore","appendChild","handleLabels","handleToggleSize","createTooltip","label","toggleSpan","innerHTML","cancelPendingAnimationFrame","requestAnimationFrame","requestAnimationFrameId","calculateToggleSize","error","console","warn","minWidth","Math","max","getBoundingClientRect","minHeight","classList","add","lineHeight","calcH","styles","globalThis","window","getComputedStyle","borderTopWidth","Number","parseFloat","borderBottomWidth","paddingTop","paddingBottom","undefined","cancelAnimationFrame","ariaOpts","labels","ids","Array","from","map","l","id","filter","Boolean","setAttribute","join","bootstrap","Tooltip","placement","html","on","updateToggleByValue","updateToggleByChecked","updateToggleByState","updateAria","updateTooltip","remove","ON","OFF","MIXED","checked","updateCheckboxByChecked","updateInvCheckboxByChecked","status","ENABLED","disabled","readOnly","DISABLED","READONLY","indeterminate","String","setContent","off","mixed","Object","defineProperty","get","enumerable","configurable","destroy","dispose","parentNode","sanitize","text","opts","mode","HTML","config","allowedTags","allowedAttributes","doc","DOMParser","parseFromString","body","childNodes","forEach","node","sanitizeNodeRecursive","nodeType","Node","ELEMENT_NODE","element_1","tagName","toLowerCase","includes","fragment_1","createDocumentFragment","child","replaceChild","attributes","attr","attrName","some","allowed","endsWith","startsWith","slice","element","sanitizeAllowedAttr","TEXT_NODE","sanitizeNode","TEXT","replace","m","sanitizeText","isNumeric","test","toString","trim","OptionType","OptionResolver","getAttr","sanitized","getAttribute","getAttrOrDefault","userValue","defaultValue","sanitizedUserValue","getAttrOrDeprecation","DeprecationConfig","resolve","userOptions","DEFAULT","tristate","hasAttribute","resolveTooltipOptions","handle","_c","_d","getTitle","userOption","titleOn","titleOff","titleMixed","TOP","values","ToggleEvents","deprecatedOptions","currentOpt","deprecatedAttr","deprecatedOpt","deprecatedAttrSanitized","log","ATTRIBUTE","OPTION","type","oldLabel","newLabel","__assign","assign","t","s","i","n","arguments","p","hasOwnProperty","call","apply","StateReducer","isTristate","getElementState","freeze","canInteract","sync","do","action","TOGGLE","INDETERMINATE","DETERMINATE","NEXT","setValueIfChanged","setValue","doNext","DISABLE","setStatusIfChanged","ENABLE","setStatus","ToggleMethods","Toggle","pointer","SCROLL_THRESHOLD","eventsBound","suppressExternalSync","originalDescriptors","Map","onExternalChange","update","onFormReset","setTimeout","onPointerDown","e","pointerType","button","stateReducer","x","clientX","y","clientY","domBuilder","root","addEventListener","onPointerMove","passive","onPointerUp","onPointerCancel","dx","abs","removeEventListener","handlerKeyboardEvent","key","preventDefault","handlerLabelEvent","focus","bindEventListeners","interceptInputProperties","bsToggle","prop","descriptor","getOwnPropertyDescriptor","getPrototypeOf","set","restoreInputProperties","clear","bindFormResetListener","bindPointerEventListener","bindKeyboardEventListener","bindLabelEventListener","unbindEventListeners","unbindFormResetListener","unbindPointerEventListener","unbindKeyboardEventListener","unbindLabelEventListener","form","querySelectorAll","silent","trigger","determinate","enable","disable","readonly","dispatchEvent","Event","bubbles","eventName","getEventForAction","detail","CustomEvent","getValueEvent","rerender","$","old","fn","bootstrapToggle","each","_bsToggle","DESTROY","RERENDER","Constructor","noConflict","jQuery"],"mappings":"0FAAO,IAAIA,EAMAC,EAMAC,GAXX,SAAWF,GACPA,EAAqB,GAAI,KACzBA,EAAsB,IAAI,MAC1BA,EAAwB,MAAI,OAC/B,CAJD,CAIGA,IAAqBA,EAAmB,CAAA,IAE3C,SAAWC,GACPA,EAA2B,QAAI,UAC/BA,EAA4B,SAAI,WAChCA,EAA4B,SAAI,UACnC,CAJD,CAIGA,IAAsBA,EAAoB,CAAA,IAE7C,SAAWC,GACPA,EAAuB,KAAI,OAC3BA,EAAqB,GAAI,KACzBA,EAAsB,IAAI,MAC1BA,EAAyB,OAAI,SAC7BA,EAA8B,YAAI,cAClCA,EAAgC,cAAI,gBACpCA,EAA2B,SAAI,WAC/BA,EAA0B,QAAI,UAC9BA,EAAyB,OAAI,QAChC,CAVD,CAUGA,IAAqBA,EAAmB,CAAA,ICtB3C,ICDWC,ECAAC,EFCPC,EAA4B,WAQ5B,SAASA,EAAWC,EAAUC,EAASC,GACnCC,KAAKC,SAAU,EACfD,KAAKE,UAAYH,EACjBC,KAAKG,QAAU,OAAOC,OAAON,EAAQO,SACrCL,KAAKM,SAAW,OAAOF,OAAON,EAAQS,UACtCP,KAAKQ,KAAOV,EAAQU,KACpBR,KAAKH,SAAWA,EACZC,EAAQW,UACRT,KAAKH,SAASa,MAAQZ,EAAQW,SA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ACJ,EAKAC,EAAEE,GAAGC,gBAAgBK,YAAc/E,EAKnCuE,EAAEE,GAAGhU,OAAOuU,WAAa,WAErB,OADAT,EAAEE,GAAGC,gBAAkBF,EAChB3V,IACX,EAMA0V,EAAE,WACEA,EAAE,6CAA6CG,iBACnD,EACH,CAjEA,CAiEEO"}
|
|
1
|
+
{"version":3,"file":"bootstrap5-toggle.jquery.min.js","sources":["../src/main/js/core/StateReducer.types.js","../src/main/js/core/DOMBuilder.js","../src/main/js/core/Tools.js","../src/main/js/core/OptionResolver.types.js","../src/main/js/core/OptionResolver.js","../src/main/js/types/ToggleEvents.js","../src/main/js/core/StateReducer.js","../src/main/js/types/ToggleMethods.js","../src/main/js/BootstrapToggle.js","../src/main/js/index.jquery.js"],"sourcesContent":["export var ToggleStateValue;\n(function (ToggleStateValue) {\n ToggleStateValue[\"ON\"] = \"on\";\n ToggleStateValue[\"OFF\"] = \"off\";\n ToggleStateValue[\"MIXED\"] = \"mixed\";\n})(ToggleStateValue || (ToggleStateValue = {}));\nexport var ToggleStateStatus;\n(function (ToggleStateStatus) {\n ToggleStateStatus[\"ENABLED\"] = \"enabled\";\n ToggleStateStatus[\"DISABLED\"] = \"disabled\";\n ToggleStateStatus[\"READONLY\"] = \"readonly\";\n})(ToggleStateStatus || (ToggleStateStatus = {}));\nexport var ToggleActionType;\n(function (ToggleActionType) {\n ToggleActionType[\"NEXT\"] = \"next\";\n ToggleActionType[\"ON\"] = \"on\";\n ToggleActionType[\"OFF\"] = \"off\";\n ToggleActionType[\"TOGGLE\"] = \"toggle\";\n ToggleActionType[\"DETERMINATE\"] = \"determinate\";\n ToggleActionType[\"INDETERMINATE\"] = \"indeterminate\";\n ToggleActionType[\"READONLY\"] = \"readonly\";\n ToggleActionType[\"DISABLE\"] = \"disable\";\n ToggleActionType[\"ENABLE\"] = \"enable\";\n})(ToggleActionType || (ToggleActionType = {}));\n","import { ToggleStateStatus, ToggleStateValue, } from \"./StateReducer.types\";\nvar DOMBuilder = /** @class */ (function () {\n /**\n * Initializes a new instance of the DOMBuilder class.\n * This renders the toggle if the parent element is visible, otherwise defers rendering until it becomes visible.\n * @param checkbox HTMLInputElement element representing the toggle.\n * @param options ToggleOptions object containing options for the toggle.\n * @param state ToggleState object containing the initial state of the toggle.\n */\n function DOMBuilder(checkbox, options, state) {\n this.isBuilt = false;\n this.lastState = state;\n this.onStyle = \"btn-\".concat(options.onstyle);\n this.offStyle = \"btn-\".concat(options.offstyle);\n this.name = options.name;\n this.checkbox = checkbox;\n if (options.onvalue)\n this.checkbox.value = options.onvalue;\n this.invCheckbox = options.offvalue\n ? this.createInvCheckbox(options.offvalue)\n : null;\n this.sizeClass = DOMBuilder.sizeResolver(options.size);\n this.toggleOn = this.createToggleSpan(options.onlabel, this.onStyle, options.ontitle);\n this.toggleOff = this.createToggleSpan(options.offlabel, this.offStyle, options.offtitle);\n this.toggleHandle = this.createToggleHandle();\n this.toggleGroup = this.createToggleGroup();\n this.toggle = document.createElement(\"div\");\n if (options.tooltip) {\n this.tooltipLabels = options.tooltip.title;\n }\n if (this.isVisible()) {\n this.renderToggle(options);\n this.render(state);\n }\n else {\n this.deferRender(options);\n }\n }\n /**\n * Checks if the parent element of the checkbox is visible.\n * A parent element is considered visible if its `offsetWidth` and `offsetHeight` are greater than `0`.\n * @returns boolean indicating whether the parent element is visible or not.\n */\n DOMBuilder.prototype.isVisible = function () {\n var parent = this.checkbox.parentElement;\n return !!parent && parent.offsetWidth > 0 && parent.offsetHeight > 0;\n };\n /**\n * Defer rendering the toggle until the parent element is visible.\n * It does this by observing the parent element's bounding rectangle and only rendering the toggle once the width and height of the bounding rectangle are greater than 0.\n * @param options ToggleOptions object containing options for the toggle.\n */\n DOMBuilder.prototype.deferRender = function (options) {\n var _this = this;\n this.resizeObserver = new ResizeObserver(function (entries) {\n if (_this.isBuilt) {\n _this.resizeObserver.disconnect();\n return;\n }\n for (var _i = 0, entries_1 = entries; _i < entries_1.length; _i++) {\n var entry = entries_1[_i];\n if (entry.contentRect.width > 0 && entry.contentRect.height > 0) {\n _this.renderToggle(options);\n _this.render(_this.lastState);\n _this.isBuilt = true;\n _this.resizeObserver.disconnect();\n return;\n }\n }\n });\n this.resizeObserver.observe(this.checkbox.parentElement);\n };\n /**\n * Resolves the size class for the toggle based on the provided size.\n * If size is not provided or is invalid, returns an empty string.\n * @param size ToggleSize value representing the size of the toggle.\n * @returns string representing the size class for the toggle.\n */\n DOMBuilder.sizeResolver = function (size) {\n var _a;\n var sizeMap = {\n large: \"btn-lg\",\n lg: \"btn-lg\",\n small: \"btn-sm\",\n sm: \"btn-sm\",\n mini: \"btn-xs\",\n xs: \"btn-xs\",\n };\n return (_a = sizeMap[size]) !== null && _a !== void 0 ? _a : \"\";\n };\n /**\n * Creates an inverted checkbox element that is used in the toggle.\n * This checkbox is used to create the toggle's \"off\" state.\n * @param offValue The value of the checkbox when the toggle is in the \"off\" state.\n * @returns An HTMLInputElement representing the inverted checkbox element.\n */\n DOMBuilder.prototype.createInvCheckbox = function (offValue) {\n var invCheckbox = this.checkbox.cloneNode(true);\n invCheckbox.value = offValue;\n invCheckbox.dataset.toggle = \"invert-toggle\";\n invCheckbox.removeAttribute(\"id\");\n return invCheckbox;\n };\n /**\n * Renders the toggle element and its children.\n * Sets the class attribute of the toggle with the provided style and size class.\n * Sets the tabindex attribute of the toggle with the provided tabindex.\n * Inserts the toggle element before the original checkbox element.\n * Appends the checkbox, inverted checkbox (if exists) and toggle group elements to the toggle element.\n * Handles the toggle size by setting the width and height attributes of the toggle element.\n * @param options - ToggleOptions object containing the style, width, height and tabindex for the toggle.\n */\n DOMBuilder.prototype.renderToggle = function (_a) {\n var _b;\n var style = _a.style, width = _a.width, height = _a.height, tabindex = _a.tabindex, aria = _a.aria, tooltip = _a.tooltip;\n this.toggle.className = \"toggle btn \".concat(this.sizeClass, \" \").concat(style);\n this.toggle.dataset.toggle = \"toggle\";\n this.toggle.tabIndex = tabindex;\n this.toggle.role = \"switch\";\n this.checkbox.tabIndex = -1;\n if (this.invCheckbox)\n this.invCheckbox.tabIndex = -1;\n (_b = this.checkbox.parentElement) === null || _b === void 0 ? void 0 : _b.insertBefore(this.toggle, this.checkbox);\n this.toggle.appendChild(this.checkbox);\n if (this.invCheckbox)\n this.toggle.appendChild(this.invCheckbox);\n this.toggle.appendChild(this.toggleGroup);\n this.handleLabels(aria);\n this.handleToggleSize(width, height);\n if (tooltip)\n this.createTooltip(tooltip);\n this.isBuilt = true;\n };\n /**\n * Creates a div element representing the toggle group.\n * The toggle group contains the on, off, and handle elements of the toggle.\n * @returns An HTMLElement representing the toggle group element.\n */\n DOMBuilder.prototype.createToggleGroup = function () {\n var toggleGroup = document.createElement(\"div\");\n toggleGroup.className = \"toggle-group\";\n toggleGroup.appendChild(this.toggleOn);\n toggleGroup.appendChild(this.toggleOff);\n toggleGroup.appendChild(this.toggleHandle);\n return toggleGroup;\n };\n /**\n * Creates a span element representing a toggle option (on/off).\n * The span element is given a class attribute with the provided style and size class.\n * The innerHTML of the span element is set to the provided label.\n * If a title is provided, the span element is given a title attribute with the provided title.\n * @param label The text to be displayed in the toggle option.\n * @param style The style of the toggle option (primary, secondary, etc.).\n * @param title The title of the toggle option.\n * @returns An HTMLElement representing the toggle option element.\n */\n DOMBuilder.prototype.createToggleSpan = function (label, style, title) {\n var toggleSpan = document.createElement(\"span\");\n toggleSpan.className = \"btn \".concat(this.sizeClass, \" \").concat(style);\n toggleSpan.innerHTML = label;\n if (title)\n toggleSpan.title = title;\n return toggleSpan;\n };\n /**\n * Creates a span element representing the toggle handle.\n * The span element is given a class attribute with the provided size class.\n * @returns An HTMLElement representing the toggle handle element.\n */\n DOMBuilder.prototype.createToggleHandle = function () {\n var toggleHandle = document.createElement(\"span\");\n toggleHandle.className = \"toggle-handle btn \".concat(this.sizeClass);\n return toggleHandle;\n };\n /**\n * Sets the width and height of the toggle element.\n * If a width or height is not provided, the toggle element will be given a minimum width and height\n * that is calculated based on the size of the toggle on and off options.\n * @param width The width of the toggle element.\n * @param height The height of the toggle element.\n */\n DOMBuilder.prototype.handleToggleSize = function (width, height) {\n var _this = this;\n this.cancelPendingAnimationFrame();\n if (typeof requestAnimationFrame === \"function\") {\n this.requestAnimationFrameId = requestAnimationFrame(function () {\n try {\n _this.calculateToggleSize(width, height);\n }\n catch (error) {\n console.warn(\"Error calculating toggle size:\", error);\n }\n });\n }\n else {\n // Fallback if requestAnimationFrame is not supported\n this.calculateToggleSize(width, height);\n }\n };\n DOMBuilder.prototype.calculateToggleSize = function (width, height) {\n if (width) {\n this.toggle.style.width = width;\n }\n else {\n this.toggle.style.minWidth = \"100px\"; // First approach for better calculation\n this.toggle.style.minWidth = \"\".concat(Math.max(this.toggleOn.getBoundingClientRect().width, this.toggleOff.getBoundingClientRect().width) +\n this.toggleHandle.getBoundingClientRect().width / 2, \"px\");\n }\n if (height) {\n this.toggle.style.height = height;\n }\n else {\n this.toggle.style.minHeight = \"36px\"; // First approach for better calculation\n this.toggle.style.minHeight = \"\".concat(Math.max(this.toggleOn.getBoundingClientRect().height, this.toggleOff.getBoundingClientRect().height), \"px\");\n }\n // B: Apply on/off class\n this.toggleOn.classList.add(\"toggle-on\");\n this.toggleOff.classList.add(\"toggle-off\");\n // C: Finally, set lineHeight if needed\n if (height) {\n this.toggleOn.style.lineHeight = DOMBuilder.calcH(this.toggleOn) + \"px\";\n this.toggleOff.style.lineHeight = DOMBuilder.calcH(this.toggleOff) + \"px\";\n }\n };\n /**\n * Calculates the height of the toggle element that should be used for the line-height property.\n * This calculation is used when the toggle element is given a height that is not explicitly set.\n * The calculation takes into account the height of the toggle element, the border-top and border-bottom widths,\n * and the padding-top and padding-bottom of the toggle element.\n * @param toggleSpan The HTMLElement that represents the toggle element.\n * @returns The height of the toggle element that should be used for the line-height property.\n */\n DOMBuilder.calcH = function (toggleSpan) {\n var styles = globalThis.window.getComputedStyle(toggleSpan);\n var height = toggleSpan.offsetHeight;\n var borderTopWidth = Number.parseFloat(styles.borderTopWidth);\n var borderBottomWidth = Number.parseFloat(styles.borderBottomWidth);\n var paddingTop = Number.parseFloat(styles.paddingTop);\n var paddingBottom = Number.parseFloat(styles.paddingBottom);\n return (height - borderBottomWidth - borderTopWidth - paddingTop - paddingBottom);\n };\n /**\n * Cancels any pending animation frame request if one exists.\n * This is used to prevent unnecessary calculations when the toggle size is being changed.\n */\n DOMBuilder.prototype.cancelPendingAnimationFrame = function () {\n if (this.requestAnimationFrameId !== undefined && typeof cancelAnimationFrame === \"function\") {\n cancelAnimationFrame(this.requestAnimationFrameId);\n this.requestAnimationFrameId = undefined;\n }\n };\n /**\n * Handles the aria-labelledby and aria-label attributes of the toggle element.\n * If the checkbox element has a labels property and the length of the labels property is greater than 0,\n * the aria-labelledby attribute of the toggle element is set to the id of the labels elements.\n * Otherwise, the aria-label attribute of the toggle element is set to the label property of the ariaOpts object.\n * @param {AriaToggleOptions} ariaOpts - The object containing the label property to be used for the aria-label attribute.\n */\n DOMBuilder.prototype.handleLabels = function (ariaOpts) {\n var _a;\n if ((_a = this.checkbox.labels) === null || _a === void 0 ? void 0 : _a.length) {\n var ids = Array.from(this.checkbox.labels)\n .map(function (l) { return l.id; })\n .filter(Boolean);\n if (ids.length) {\n this.toggle.setAttribute(\"aria-labelledby\", ids.join(\" \"));\n }\n }\n else {\n this.toggle.setAttribute(\"aria-label\", ariaOpts.label);\n }\n };\n /**\n * Creates a tooltip for the toggle element.\n * If the tooltip is successfully created, it is stored in the `tooltip` property of the DOMBuilder instance.\n * @param {TooltipOptions} tooltip - The options for the tooltip.\n */\n DOMBuilder.prototype.createTooltip = function (tooltip) {\n try {\n this.tooltip = new globalThis.window.bootstrap.Tooltip(this.toggle, { placement: tooltip.placement, html: true, title: tooltip.title.on });\n }\n catch (error) {\n console.error(\"Error creating tooltip:\", error);\n }\n };\n /**\n * Renders the toggle element based on the provided state if the toggle is already built.\n * This method should be called whenever the state of the toggle changes.\n * @param {ToggleState} state The state of the toggle element.\n */\n DOMBuilder.prototype.render = function (state) {\n this.lastState = state;\n if (!this.isBuilt)\n return;\n this.updateToggleByValue(state);\n this.updateToggleByChecked(state);\n this.updateToggleByState(state);\n this.updateAria(state);\n this.updateTooltip(state);\n };\n /**\n * Updates the class of the toggle element based on the provided state.\n * Removes any existing on/off/indeterminate classes and adds the appropriate class based on the state.\n * If the state is indeterminate, adds the 'indeterminate' class and either the on or off class based on the checked attribute.\n * @param {ToggleState} state The state of the toggle element.\n */\n DOMBuilder.prototype.updateToggleByValue = function (state) {\n this.toggle.classList.remove(this.onStyle, this.offStyle, \"off\", \"indeterminate\");\n switch (state.value) {\n case ToggleStateValue.ON:\n this.toggle.classList.add(this.onStyle);\n break;\n case ToggleStateValue.OFF:\n this.toggle.classList.add(this.offStyle, \"off\");\n break;\n case ToggleStateValue.MIXED:\n this.toggle.classList.add(\"indeterminate\");\n if (state.checked) {\n this.toggle.classList.add(this.onStyle);\n }\n else {\n this.toggle.classList.add(this.offStyle, \"off\");\n }\n break;\n }\n };\n /**\n * Updates the toggle element based on the provided state.\n * Calls {@link DOMBuilder.updateCheckboxByChecked} and {@link DOMBuilder.updateInvCheckboxByChecked} to update the checkbox and inverted checkbox elements respectively.\n * @param {ToggleState} state The state of the toggle element.\n */\n DOMBuilder.prototype.updateToggleByChecked = function (state) {\n this.updateCheckboxByChecked(state);\n this.updateInvCheckboxByChecked(state);\n };\n /**\n * Updates the checkbox element based on the provided state.\n * Sets the checked attribute of the checkbox based on the state's checked attribute.\n * Sets the disabled and readonly attributes of the checkbox based on the state's status.\n * Adds or removes the 'disabled' class from the toggle element based on the state's status.\n * @param {ToggleState} state The state of the toggle element.\n */\n DOMBuilder.prototype.updateCheckboxByChecked = function (state) {\n this.checkbox.checked = state.checked;\n switch (state.status) {\n case ToggleStateStatus.ENABLED:\n this.checkbox.disabled = false;\n this.checkbox.readOnly = false;\n this.toggle.classList.remove(\"disabled\");\n this.toggle.removeAttribute(\"disabled\");\n break;\n case ToggleStateStatus.DISABLED:\n this.checkbox.disabled = true;\n this.checkbox.readOnly = false;\n this.toggle.classList.add(\"disabled\");\n this.toggle.setAttribute(\"disabled\", \"\");\n break;\n case ToggleStateStatus.READONLY:\n this.checkbox.disabled = false;\n this.checkbox.readOnly = true;\n this.toggle.classList.add(\"disabled\");\n this.toggle.setAttribute(\"disabled\", \"\");\n break;\n }\n };\n /**\n * Updates the inverted checkbox element based on the provided state.\n * Sets the checked attribute of the inverted checkbox to the opposite of the state's checked attribute.\n * Sets the disabled and readonly attributes of the inverted checkbox based on the state's status.\n * @param {ToggleState} state The state of the toggle element.\n */\n DOMBuilder.prototype.updateInvCheckboxByChecked = function (state) {\n if (!this.invCheckbox)\n return;\n this.invCheckbox.checked = !state.checked;\n switch (state.status) {\n case ToggleStateStatus.ENABLED:\n this.invCheckbox.disabled = false;\n this.invCheckbox.readOnly = false;\n break;\n case ToggleStateStatus.DISABLED:\n this.invCheckbox.disabled = true;\n this.invCheckbox.readOnly = false;\n break;\n case ToggleStateStatus.READONLY:\n this.invCheckbox.disabled = false;\n this.invCheckbox.readOnly = true;\n break;\n }\n };\n /**\n * Updates the indeterminate attribute of the checkbox and inverted checkbox elements based on the provided state.\n * If the state is indeterminate, sets the indeterminate attribute of the checkbox and inverted checkbox to true and removes the name attribute.\n * If the state is not indeterminate, sets the indeterminate attribute of the checkbox and inverted checkbox to false and sets the name attribute to the provided name.\n * @param {ToggleState} state The state of the toggle element.\n */\n DOMBuilder.prototype.updateToggleByState = function (state) {\n if (state.indeterminate) {\n this.checkbox.indeterminate = true;\n this.checkbox.removeAttribute(\"name\");\n if (this.invCheckbox)\n this.invCheckbox.indeterminate = true;\n if (this.invCheckbox)\n this.invCheckbox.removeAttribute(\"name\");\n }\n else {\n this.checkbox.indeterminate = false;\n if (this.name)\n this.checkbox.name = this.name;\n if (this.invCheckbox)\n this.invCheckbox.indeterminate = false;\n if (this.invCheckbox && this.name)\n this.invCheckbox.name = this.name;\n }\n };\n /**\n * Updates the aria attributes of the toggle element based on the provided state.\n * Sets aria-checked to \"mixed\" if the state is indeterminate, otherwise sets it to the string representation of the state's checked attribute.\n * Sets aria-disabled to the string representation of whether the state's status is disabled.\n * Sets aria-readonly to the string representation of whether the state's status is readonly.\n * @param {ToggleState} state The state of the toggle element.\n */\n DOMBuilder.prototype.updateAria = function (state) {\n if (state.indeterminate) {\n this.toggle.setAttribute(\"aria-checked\", \"mixed\");\n }\n else {\n this.toggle.setAttribute(\"aria-checked\", String(state.checked));\n }\n this.toggle.setAttribute(\"aria-disabled\", String(state.status === ToggleStateStatus.DISABLED));\n this.toggle.setAttribute(\"aria-readonly\", String(state.status === ToggleStateStatus.READONLY));\n };\n /**\n * Updates the tooltip of the toggle element based on the provided state.\n * Sets the content of the tooltip to the corresponding label based on the state's value.\n * If the tooltip or tooltipLabels are not set, does nothing.\n * @param {ToggleState} state The state of the toggle element.\n */\n DOMBuilder.prototype.updateTooltip = function (state) {\n if (!this.tooltip || !this.tooltipLabels)\n return;\n switch (state.value) {\n case ToggleStateValue.ON:\n this.tooltip.setContent({ \".tooltip-inner\": this.tooltipLabels.on });\n return;\n case ToggleStateValue.OFF:\n this.tooltip.setContent({ \".tooltip-inner\": this.tooltipLabels.off });\n return;\n case ToggleStateValue.MIXED:\n if (this.tooltipLabels.mixed)\n this.tooltip.setContent({ \".tooltip-inner\": this.tooltipLabels.mixed });\n return;\n }\n };\n Object.defineProperty(DOMBuilder.prototype, \"root\", {\n /**\n * Returns the root element of the toggle, which is the container of all toggle elements.\n * @returns {HTMLElement} The root element of the toggle.\n */\n get: function () {\n return this.toggle;\n },\n enumerable: false,\n configurable: true\n });\n /**\n * Destroys the toggle by removing the toggle element from the DOM and\n * inserting the original checkbox element back into its original position.\n * Also disconnects the ResizeObserver if it was used.\n */\n DOMBuilder.prototype.destroy = function () {\n var _a, _b;\n this.cancelPendingAnimationFrame();\n if (this.tooltip) {\n this.tooltip.dispose();\n this.tooltip = undefined;\n }\n (_a = this.toggle.parentNode) === null || _a === void 0 ? void 0 : _a.insertBefore(this.checkbox, this.toggle);\n this.toggle.remove();\n (_b = this.resizeObserver) === null || _b === void 0 ? void 0 : _b.disconnect();\n this.resizeObserver = undefined;\n this.isBuilt = false;\n };\n return DOMBuilder;\n}());\nexport { DOMBuilder };\n","export var SanitizeMode;\n(function (SanitizeMode) {\n SanitizeMode[\"HTML\"] = \"HTML\";\n SanitizeMode[\"TEXT\"] = \"TEXT\";\n})(SanitizeMode || (SanitizeMode = {}));\n/**\n * Sanitizes a given text string according to the provided options.\n * If the input text is null, it will return null.\n * If the input text is not null, it will sanitize the text according to the provided mode.\n * If the mode is HTML, it will sanitize the text using the sanitizeHTML function.\n * If the mode is TEXT, it will sanitize the text using the sanitizeText function.\n * @param text The text string to sanitize.\n * @param opts The options to use for sanitizing the text.\n * @return The sanitized text string, or null if the input text was null.\n */\nexport function sanitize(text, opts) {\n if (!text)\n return text;\n switch (opts.mode) {\n case SanitizeMode.HTML:\n return sanitizeHTML(text);\n case SanitizeMode.TEXT:\n return sanitizeText(text);\n }\n}\n/**\n * Sanitizes a given text string, replacing special characters with their HTML entities.\n * If the input text is null, it will return null.\n * @param text The text string to sanitize.\n * @return The sanitized text string, or null if the input text was null.\n */\nfunction sanitizeText(text) {\n var map = {\n \"&\": \"&\",\n \"<\": \"<\",\n \">\": \">\",\n '\"': \""\",\n \"'\": \"'\",\n \"/\": \"/\"\n };\n // Using replace with regex for single-pass character mapping compatible with ES5\n return text.replace(/[&<>\"'/]/g, function (m) { return map[m]; });\n}\n/**\n * Sanitizes HTML content using an allow-list approach to prevent XSS attacks.\n *\n * @param html The HTML string to sanitize\n * @param options Configuration options for allowed tags and attributes\n * @returns Sanitized HTML string\n */\nfunction sanitizeHTML(html) {\n var config = {\n allowedTags: [\"b\", \"i\", \"strong\", \"em\", \"span\", \"small\", \"sup\", \"sub\", \"img\"],\n allowedAttributes: [\"class\", \"style\", \"src\", \"alt\", \"title\", \"data-*\"]\n };\n // Implementation using DOMParser for browser compatibility\n var parser = new DOMParser();\n var doc = parser.parseFromString(html, \"text/html\");\n // Sanitize all nodes in the document body\n var bodyChildren = Array.from(doc.body.childNodes);\n bodyChildren.forEach(function (node) { return sanitizeNode(node, config); });\n return doc.body.innerHTML;\n}\n/**\n * Sanitizes a single node in the document tree.\n *\n * For element nodes, it removes disallowed tags and attributes.\n * For text nodes, it keeps them as is.\n *\n * Recursively sanitizes all children of an element node.\n *\n * @param node The node to sanitize\n * @param config Configuration options for allowed tags and attributes\n */\nfunction sanitizeNode(node, config) {\n var sanitizeNodeRecursive = function (node) {\n var _a;\n if (node.nodeType === Node.ELEMENT_NODE) {\n var element_1 = node;\n var tagName = element_1.tagName.toLowerCase();\n // Remove disallowed tags\n if (!config.allowedTags.includes(tagName)) {\n // Replace disallowed element with its text content\n var fragment_1 = document.createDocumentFragment();\n Array.from(element_1.childNodes).forEach(function (child) {\n fragment_1.appendChild(child.cloneNode(true));\n });\n (_a = element_1.parentNode) === null || _a === void 0 ? void 0 : _a.replaceChild(fragment_1, element_1);\n return;\n }\n // Remove disallowed attributes\n Array.from(element_1.attributes).forEach(function (attr) {\n var attrName = attr.name.toLowerCase();\n var isAllowed = config.allowedAttributes.some(function (allowed) {\n return allowed.endsWith(\"*\") ? attrName.startsWith(allowed.slice(0, -1)) : attrName === allowed;\n });\n if (isAllowed) {\n sanitizeAllowedAttr(element_1, attr, attrName);\n }\n else {\n element_1.removeAttribute(attr.name);\n }\n });\n // Recursively sanitize children\n var children = Array.from(element_1.childNodes);\n children.forEach(sanitizeNodeRecursive);\n }\n else if (node.nodeType === Node.TEXT_NODE) {\n // Text nodes are safe, keep them as is\n return;\n }\n };\n sanitizeNodeRecursive(node);\n}\n/**\n * Sanitizes an allowed attribute by removing it if its value is a dangerous protocol.\n * Only works for \"src\" and \"href\" attributes.\n * @param element The element to check for the attribute.\n * @param attr The attribute to check the value of.\n * @param attrName The name of the attribute to check (either \"src\" or \"href\").\n */\nfunction sanitizeAllowedAttr(element, attr, attrName) {\n if (attrName !== \"src\" && attrName !== \"href\")\n return;\n var value = attr.value.toLowerCase();\n // sonar typescript:S1523 - This is security detection, not execution\n var isDangerousProtocol = value.startsWith(\"javascript:\") ||\n value.startsWith(\"vbscript:\") ||\n (value.startsWith(\"data:\") && !value.startsWith(\"data:image/\"));\n if (isDangerousProtocol) {\n element.removeAttribute(attr.name);\n }\n}\n;\n/**\n * Checks if the given string is a valid numeric value.\n *\n * A valid numeric value is a `string` that starts with an optional plus or minus sign,\n * followed by one or more digits, optionally followed by a decimal point and\n * one or more digits.\n *\n * Examples of valid numeric values include \"123\", \"-123\", \"+123.45\", \"-123.45\", etc.\n * Examples of invalid numeric values include \"abc\", \"123abc\", \"123.abc\", etc.\n * @param {string | number} value The string or number to check for being a valid numeric value.\n * @returns {boolean} `true` if the string contains a valid numeric value, `false` otherwise.\n */\nexport function isNumeric(value) {\n return /^[+-]?\\d+(\\.\\d+)?$/.test(value.toString().trim());\n}\n","export var PlacementOptions;\n(function (PlacementOptions) {\n PlacementOptions[\"TOP\"] = \"top\";\n PlacementOptions[\"BOTTOM\"] = \"bottom\";\n PlacementOptions[\"LEFT\"] = \"left\";\n PlacementOptions[\"RIGHT\"] = \"right\";\n})(PlacementOptions || (PlacementOptions = {}));\n","import { isNumeric, sanitize, SanitizeMode } from \"./Tools\";\nimport { PlacementOptions, } from \"./OptionResolver.types\";\n/**\n * OptionResolver is responsible for reading HTML attributes and user options\n * to build a complete ToggleOptions object.\n * It also handles deprecated options.\n */\nvar OptionResolver = /** @class */ (function () {\n function OptionResolver() {\n }\n /**\n * Gets a sanitized attribute value from an HTML element\n * @param element HTMLInputElement to read\n * @param attrName Attribute name\n * @param options method options\n * @param options.sanitized Flag to indicate if the sanitized mode needs to be used (default: `TEXT`)\n * @returns Sanitized attribute value or null\n */\n OptionResolver.getAttr = function (element, attrName, opts) {\n var _a = (opts !== null && opts !== void 0 ? opts : {}).sanitized, sanitized = _a === void 0 ? SanitizeMode.TEXT : _a;\n var value = element.getAttribute(attrName);\n return sanitize(value, { mode: sanitized });\n ;\n };\n /**\n * Returns the value of an attribute, user-provided value, or default value\n * @param element HTMLInputElement to read\n * @param attrName Attribute name\n * @param userValue Value provided by the user\n * @param defaultValue Default value if neither attribute nor user value exists\n * @param sanitized Flag to indicate if the sanitized mode needs to be used (default: `TEXT`)\n * @returns Final attribute value\n */\n OptionResolver.getAttrOrDefault = function (element, attrName, userValue, defaultValue, sanitized) {\n if (sanitized === void 0) { sanitized = SanitizeMode.TEXT; }\n var sanitizedUserValue = typeof userValue === \"string\" ? sanitize(userValue, { mode: sanitized }) : userValue;\n return OptionResolver.getAttr(element, attrName, { sanitized: sanitized }) ||\n sanitizedUserValue ||\n defaultValue;\n };\n /**\n * Returns the value of an attribute, user-provided value, or marks as deprecated\n * @param element HTMLInputElement to read\n * @param attrName Attribute name\n * @param userValue Value provided by the user\n * @param sanitized Flag to indicate if the sanitized mode needs to be used (default: `TEXT`)\n * @returns Final attribute value or DeprecationConfig.value if not found\n */\n OptionResolver.getAttrOrDeprecation = function (element, attrName, userValue, sanitized) {\n if (sanitized === void 0) { sanitized = SanitizeMode.TEXT; }\n var sanitizedUserValue = typeof userValue === \"string\" ? sanitize(userValue, { mode: sanitized }) : userValue;\n return OptionResolver.getAttr(element, attrName, { sanitized: sanitized }) ||\n sanitizedUserValue ||\n DeprecationConfig.value;\n };\n /**\n * Resolves all toggle options from the element and user options\n * @param element HTMLInputElement representing the toggle\n * @param userOptions Options provided by the user\n * @returns Complete ToggleOptions object\n */\n OptionResolver.resolve = function (element, userOptions) {\n var _a;\n if (userOptions === void 0) { userOptions = {}; }\n var options = {\n onlabel: this.getAttrOrDeprecation(element, \"data-onlabel\", userOptions.onlabel, SanitizeMode.HTML),\n offlabel: this.getAttrOrDeprecation(element, \"data-offlabel\", userOptions.offlabel, SanitizeMode.HTML),\n onstyle: this.getAttrOrDefault(element, \"data-onstyle\", userOptions.onstyle, OptionResolver.DEFAULT.onstyle),\n offstyle: this.getAttrOrDefault(element, \"data-offstyle\", userOptions.offstyle, OptionResolver.DEFAULT.offstyle),\n onvalue: this.getAttr(element, \"value\") || this.getAttrOrDefault(element, \"data-onvalue\", userOptions.onvalue, OptionResolver.DEFAULT.onvalue),\n offvalue: this.getAttrOrDefault(element, \"data-offvalue\", userOptions.offvalue, OptionResolver.DEFAULT.offvalue),\n ontitle: this.getAttrOrDefault(element, \"data-ontitle\", userOptions.ontitle, OptionResolver.getAttr(element, \"title\") ||\n OptionResolver.DEFAULT.ontitle),\n offtitle: this.getAttrOrDefault(element, \"data-offtitle\", userOptions.offtitle, OptionResolver.getAttr(element, \"title\") ||\n OptionResolver.DEFAULT.offtitle),\n size: this.getAttrOrDefault(element, \"data-size\", userOptions.size, this.DEFAULT.size),\n style: this.getAttrOrDefault(element, \"data-style\", userOptions.style, this.DEFAULT.style),\n width: this.getAttrOrDefault(element, \"data-width\", userOptions.width, this.DEFAULT.width),\n height: this.getAttrOrDefault(element, \"data-height\", userOptions.height, this.DEFAULT.height),\n tabindex: Number(this.getAttrOrDefault(element, \"tabindex\", userOptions.tabindex, this.DEFAULT.tabindex)),\n tristate: element.hasAttribute(\"tristate\") ||\n userOptions.tristate ||\n OptionResolver.DEFAULT.tristate,\n name: this.getAttrOrDefault(element, \"name\", userOptions.name, this.DEFAULT.name),\n aria: {\n label: this.getAttrOrDefault(element, \"aria-label\", (_a = userOptions.aria) === null || _a === void 0 ? void 0 : _a.label, this.DEFAULT.aria.label),\n },\n tooltip: OptionResolver.resolveTooltipOptions(element, userOptions),\n };\n if (options.width && isNumeric(options.width))\n options.width = \"\".concat(options.width, \"px\");\n if (options.height && isNumeric(options.height))\n options.height = \"\".concat(options.height, \"px\");\n DeprecationConfig.handle(options, element, userOptions);\n return options;\n };\n /**\n * Resolve tooltip options from element attributes and user options.\n * @param element HTMLInputElement representing the toggle\n * @param userOptions Options provided by the user\n * @returns Resolved tooltip options or undefined if not found.\n */\n OptionResolver.resolveTooltipOptions = function (element, userOptions) {\n var _this = this;\n var _a, _b, _c, _d;\n var getTitle = function (attr, userOption) { return _this.getAttrOrDefault(element, attr, userOption, null, SanitizeMode.HTML) || _this.getAttr(element, \"data-tooltip-title\", { sanitized: SanitizeMode.HTML }); };\n var titleOn = getTitle(\"data-tooltip-title-on\", (_a = userOptions.tooltip) === null || _a === void 0 ? void 0 : _a.title.on);\n var titleOff = getTitle(\"data-tooltip-title-off\", (_b = userOptions.tooltip) === null || _b === void 0 ? void 0 : _b.title.off);\n var titleMixed = getTitle(\"data-tooltip-title-mixed\", (_c = userOptions.tooltip) === null || _c === void 0 ? void 0 : _c.title.mixed);\n if (!titleOn || !titleOff)\n return OptionResolver.DEFAULT.tooltip;\n var placement = this.getAttrOrDefault(element, \"data-tooltip-placement\", (_d = userOptions.tooltip) === null || _d === void 0 ? void 0 : _d.placement, PlacementOptions.TOP);\n return {\n placement: Object.values(PlacementOptions).includes(placement) ? placement : PlacementOptions.TOP,\n title: {\n on: titleOn,\n off: titleOff,\n mixed: titleMixed !== null && titleMixed !== void 0 ? titleMixed : undefined,\n },\n };\n };\n /** Default values for all toggle options */\n OptionResolver.DEFAULT = {\n onlabel: \"On\",\n onstyle: \"primary\",\n onvalue: null,\n ontitle: null,\n offlabel: \"Off\",\n offstyle: \"secondary\",\n offvalue: null,\n offtitle: null,\n size: \"\",\n style: \"\",\n width: null,\n height: null,\n tabindex: 0,\n tristate: false,\n name: null,\n aria: { label: \"Toggle\", },\n tooltip: undefined,\n };\n return OptionResolver;\n}());\nexport { OptionResolver };\n/** Types of deprecation source */\nvar OptionType;\n(function (OptionType) {\n OptionType[\"ATTRIBUTE\"] = \"attribute\";\n OptionType[\"OPTION\"] = \"option\";\n})(OptionType || (OptionType = {}));\n/**\n * Handles deprecated attributes and options for Bootstrap Toggle.\n */\nvar DeprecationConfig = /** @class */ (function () {\n function DeprecationConfig() {\n }\n /**\n * Processes deprecated options and attributes and logs warnings\n * @param options ToggleOptions object to update\n * @param element HTMLInputElement to read deprecated attributes from\n * @param userOptions UserOptions provided by the user\n */\n DeprecationConfig.handle = function (options, element, userOptions) {\n var _this = this;\n this.deprecatedOptions.forEach(function (_a) {\n var currentOpt = _a.currentOpt, deprecatedAttr = _a.deprecatedAttr, deprecatedOpt = _a.deprecatedOpt, mode = _a.mode;\n if (options[currentOpt] === DeprecationConfig.value) {\n var deprecatedAttrSanitized = sanitize(element.getAttribute(deprecatedAttr), { mode: mode });\n if (deprecatedAttrSanitized) {\n _this.log(OptionType.ATTRIBUTE, deprecatedAttr, \"data-\".concat(currentOpt));\n options[currentOpt] = deprecatedAttrSanitized;\n }\n else if (userOptions[deprecatedOpt]) {\n _this.log(OptionType.OPTION, deprecatedOpt, currentOpt);\n options[currentOpt] = userOptions[deprecatedOpt];\n }\n else {\n options[currentOpt] = OptionResolver.DEFAULT[currentOpt];\n }\n }\n });\n };\n /**\n * Logs a deprecation warning to the console\n * @param type Source of the deprecated option (ATTRIBUTE | OPTION)\n * @param oldLabel Deprecated attribute or option name\n * @param newLabel Recommended replacement option name\n */\n DeprecationConfig.log = function (type, oldLabel, newLabel) {\n console.warn(\"Bootstrap Toggle deprecation warning: Using \".concat(oldLabel, \" \").concat(type, \" is deprecated. Use \").concat(newLabel, \" instead.\"));\n };\n /** Unique string used to detect deprecated placeholders */\n DeprecationConfig.value = \"BOOTSTRAP TOGGLE DEPRECATION CHECK -- a0Jhux0QySypjjs4tLtEo8xT2kx0AbYaq9K6mgNjWSs0HF0L8T8J0M0o3Kr7zkm7 --\";\n /** Mapping of current option, deprecated attribute, and deprecated user option */\n DeprecationConfig.deprecatedOptions = [\n {\n currentOpt: \"onlabel\",\n deprecatedAttr: \"data-on\",\n deprecatedOpt: \"on\",\n mode: SanitizeMode.HTML\n },\n {\n currentOpt: \"offlabel\",\n deprecatedAttr: \"data-off\",\n deprecatedOpt: \"off\",\n mode: SanitizeMode.HTML\n },\n ];\n return DeprecationConfig;\n}());\n","var ToggleEvents;\n(function (ToggleEvents) {\n ToggleEvents[\"ON\"] = \"toggle:on\";\n ToggleEvents[\"OFF\"] = \"toggle:off\";\n ToggleEvents[\"MIXED\"] = \"toggle:mixed\";\n ToggleEvents[\"ENABLED\"] = \"toggle:enabled\";\n ToggleEvents[\"DISABLED\"] = \"toggle:disabled\";\n ToggleEvents[\"READONLY\"] = \"toggle:readonly\";\n})(ToggleEvents || (ToggleEvents = {}));\nexport default ToggleEvents;\n","var __assign = (this && this.__assign) || function () {\n __assign = Object.assign || function(t) {\n for (var s, i = 1, n = arguments.length; i < n; i++) {\n s = arguments[i];\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))\n t[p] = s[p];\n }\n return t;\n };\n return __assign.apply(this, arguments);\n};\nimport { ToggleActionType, ToggleStateStatus, ToggleStateValue, } from \"./StateReducer.types\";\nvar StateReducer = /** @class */ (function () {\n /**\n * Constructor for the StateReducer class.\n * @param element The HTMLInputElement which represents the toggle.\n * @param isTristate A boolean indicating whether the toggle is tristate.\n * Initializes the toggle state with the given element and tristate value.\n */\n function StateReducer(element, isTristate) {\n this.isTristate = isTristate;\n this.state = this.getElementState(element);\n }\n /**\n * Retrieves the current state of the toggle based on the HTMLInputElement.\n * The state is determined by the following:\n * - The checked property of the input element\n * - The disabled property of the input element\n * - The readonly property of the input element\n * - The indeterminate property of the input element if the toggle is tristate\n * @returns An object containing the state of the toggle.\n */\n StateReducer.prototype.getElementState = function (element) {\n var checked = element.checked;\n var status;\n if (element.disabled) {\n status = ToggleStateStatus.DISABLED;\n }\n else if (element.readOnly) {\n status = ToggleStateStatus.READONLY;\n }\n else {\n status = ToggleStateStatus.ENABLED;\n }\n var indeterminate = this.isTristate && element.indeterminate;\n var value;\n if (indeterminate) {\n value = ToggleStateValue.MIXED;\n }\n else if (checked) {\n value = ToggleStateValue.ON;\n }\n else {\n value = ToggleStateValue.OFF;\n }\n return {\n value: value,\n checked: checked,\n status: status,\n indeterminate: indeterminate,\n };\n };\n /**\n * Get the current toggle state.\n * @returns An immutable copy of the current toggle state.\n */\n StateReducer.prototype.get = function () {\n return Object.freeze(__assign({}, this.state));\n };\n /**\n * Determines whether the toggle is enabled and can be interacted with.\n * @returns True if the toggle is enabled and can be interacted with, false otherwise.\n */\n StateReducer.prototype.canInteract = function () {\n return this.state.status === ToggleStateStatus.ENABLED;\n };\n /**\n * Synchronizes the internal state of the toggle with the provided HTMLInputElement.\n * This method is useful when you need to update the internal state of the toggle\n * manually, such as when the toggle is updated programmatically.\n * @param element The HTMLInputElement to synchronize the toggle state with.\n */\n StateReducer.prototype.sync = function (element) {\n this.state = this.getElementState(element);\n };\n /**\n * Apply a toggle action to the toggle state.\n * @param action The toggle action to apply.\n * @returns A boolean indicating whether the action was successful.\n * If the toggle is disabled, any action execpect {@code ToggleActionType.ENABLE} will return {@code false}.\n * If the toggle is currently in the target state of the action, the action will return {@code false}.\n * If the toggle is in the indeterminate state and the action is {@code ToggleActionType.DETERMINATE},\n * the toggle will be set to the checked state.\n * If the action is {@code ToggleActionType.NEXT} :\n * - For a tristate toggle, the toggle will do ON -> INDETERMINATE -> OFF -> INDETERMINATE -> ON.\n * - For a non-tristate toggle, the toggle will do ON -> OFF -> ON.\n */\n StateReducer.prototype.do = function (action) {\n var actionsRequiringInteract = [\n ToggleActionType.ON,\n ToggleActionType.OFF,\n ToggleActionType.TOGGLE,\n ToggleActionType.INDETERMINATE,\n ToggleActionType.DETERMINATE,\n ToggleActionType.NEXT,\n ToggleActionType.READONLY,\n ];\n if (actionsRequiringInteract.includes(action) && !this.canInteract())\n return false;\n switch (action) {\n case ToggleActionType.ON:\n return this.setValueIfChanged(ToggleStateValue.ON, true, false);\n case ToggleActionType.OFF:\n return this.setValueIfChanged(ToggleStateValue.OFF, false, false);\n case ToggleActionType.TOGGLE:\n if (this.state.value === ToggleStateValue.ON)\n return this.do(ToggleActionType.OFF);\n if (this.state.value === ToggleStateValue.OFF)\n return this.do(ToggleActionType.ON);\n return false;\n case ToggleActionType.INDETERMINATE:\n return this.setValueIfChanged(ToggleStateValue.MIXED, undefined, true);\n case ToggleActionType.DETERMINATE:\n if (this.state.value != ToggleStateValue.MIXED)\n return false;\n return this.setValue(this.state.checked ? ToggleStateValue.ON : ToggleStateValue.OFF, this.state.checked, false);\n case ToggleActionType.NEXT:\n return this.doNext();\n case ToggleActionType.DISABLE:\n return this.setStatusIfChanged(ToggleStateStatus.DISABLED);\n case ToggleActionType.ENABLE:\n return this.setStatusIfChanged(ToggleStateStatus.ENABLED);\n case ToggleActionType.READONLY:\n return this.setStatus(ToggleStateStatus.READONLY);\n }\n };\n /**\n * Sets the state of the toggle to the provided value.\n * If checked or indeterminate is provided, sets the corresponding property of the state to the provided value.\n * Otherwise, leaves the property unchanged.\n * @param value The value of the toggle to set.\n * @param checked The checked state of the toggle to set. If not provided, the property is left unchanged.\n * @param indeterminate The indeterminate state of the toggle to set. If not provided, the property is left unchanged.\n * @returns A boolean indicating whether the state was updated.\n */\n StateReducer.prototype.setValue = function (value, checked, indeterminate) {\n this.state = __assign(__assign({}, this.state), { value: value, checked: checked !== null && checked !== void 0 ? checked : this.state.checked, indeterminate: indeterminate !== null && indeterminate !== void 0 ? indeterminate : this.state.indeterminate });\n return true;\n };\n /**\n * Sets the state of the toggle to the provided value if the value is different from the current state.\n * If checked or indeterminate is provided, sets the corresponding property of the state to the provided value.\n * Otherwise, leaves the property unchanged.\n * @returns A boolean indicating whether the state was updated.\n */\n StateReducer.prototype.setValueIfChanged = function (value, checked, indeterminate) {\n if (this.state.value === value)\n return false;\n return this.setValue(value, checked, indeterminate);\n };\n /**\n * Sets the status of the toggle to the provided value.\n * @param status The new status of the toggle.\n * @returns A boolean indicating whether the state was updated.\n */\n StateReducer.prototype.setStatus = function (status) {\n this.state = __assign(__assign({}, this.state), { status: status });\n return true;\n };\n /**\n * Sets the status of the toggle to the provided value if the value is different from the current status.\n * @param status The new status of the toggle.\n * @returns A boolean indicating whether the state was updated.\n */\n StateReducer.prototype.setStatusIfChanged = function (status) {\n if (this.state.status === status)\n return false;\n return this.setStatus(status);\n };\n /**\n * Applies the next action based on the current state of the toggle.\n * If the toggle is tristate, cycles through the on, off, and indeterminate states.\n * If the toggle is not tristate, cycles through the on and off states.\n * @returns A boolean indicating whether the state was updated.\n */\n StateReducer.prototype.doNext = function () {\n if (this.isTristate) {\n if (this.state.value === ToggleStateValue.ON || this.state.value === ToggleStateValue.OFF) {\n return this.do(ToggleActionType.INDETERMINATE);\n }\n if (this.state.value === ToggleStateValue.MIXED) {\n return this.state.checked\n ? this.do(ToggleActionType.OFF)\n : this.do(ToggleActionType.ON);\n }\n }\n else {\n return this.state.value === ToggleStateValue.ON\n ? this.do(ToggleActionType.OFF)\n : this.do(ToggleActionType.ON);\n }\n return false;\n };\n return StateReducer;\n}());\nexport { StateReducer };\n","export var ToggleMethods;\n(function (ToggleMethods) {\n ToggleMethods[\"ON\"] = \"on\";\n ToggleMethods[\"OFF\"] = \"off\";\n ToggleMethods[\"TOGGLE\"] = \"toggle\";\n ToggleMethods[\"DETERMINATE\"] = \"determinate\";\n ToggleMethods[\"INDETERMINATE\"] = \"indeterminate\";\n ToggleMethods[\"ENABLE\"] = \"enable\";\n ToggleMethods[\"DISABLE\"] = \"disable\";\n ToggleMethods[\"READONLY\"] = \"readonly\";\n ToggleMethods[\"DESTROY\"] = \"destroy\";\n ToggleMethods[\"RERENDER\"] = \"rerender\";\n})(ToggleMethods || (ToggleMethods = {}));\n","import { DOMBuilder } from \"./core/DOMBuilder\";\nimport { OptionResolver } from \"./core/OptionResolver\";\nimport { StateReducer } from \"./core/StateReducer\";\nimport { ToggleActionType, ToggleStateValue } from \"./core/StateReducer.types\";\nimport ToggleEvents from \"./types/ToggleEvents\";\nvar Toggle = /** @class */ (function () {\n /**\n * Initializes a new instance of the BootstrapToggle class.\n * @param element The HTMLInputElement element which represents the toggle.\n * @param options The options for the toggle.\n * @returns The constructed BootstrapToggle instance.\n */\n function Toggle(element, options) {\n var _this = this;\n this.pointer = null;\n this.SCROLL_THRESHOLD = 10;\n this.eventsBound = false;\n this.suppressExternalSync = false;\n this.originalDescriptors = new Map();\n /**\n * Handles the change event of the input element of the toggle.\n * This event listener is responsible for detecting when the input element\n * of the toggle changes its state and triggering the update method to keep the toggle in sync.\n */\n this.onExternalChange = function () {\n _this.update();\n };\n this.onFormReset = function () {\n setTimeout(function () { return _this.onExternalChange(); }, 0);\n };\n /**\n * Handles pointer down events by initiating the toggle action and setting up\n * listeners for pointer movement, release, and cancellation.\n *\n * The method early exits if:\n * - the pointer event is not a primary mouse button click\n * - the toggle cannot be interacted with (`disabled` or `readonly`)\n * @param e The PointerEvent object representing the pointer down event.\n */\n this.onPointerDown = function (e) {\n if (e.pointerType === \"mouse\" && e.button !== 0)\n return;\n if (!_this.stateReducer.canInteract())\n return;\n _this.pointer = { x: e.clientX, y: e.clientY };\n _this.domBuilder.root.addEventListener(\"pointermove\", _this.onPointerMove, {\n passive: true,\n });\n _this.domBuilder.root.addEventListener(\"pointerup\", _this.onPointerUp, {\n passive: true,\n });\n _this.domBuilder.root.addEventListener(\"pointercancel\", _this.onPointerCancel, { passive: true });\n };\n /**\n * Handles pointer move events by checking the distance moved from the initial pointer down position.\n * If the pointer has moved beyond a certain threshold, the pointer interaction is cancelled.\n *\n * Allows dragging within the width of the toggle but cancels if vertical movement exceeds the scroll threshold.\n * @param e The PointerEvent object representing the pointer move event.\n */\n this.onPointerMove = function (e) {\n var dx = Math.abs(e.clientX - _this.pointer.x);\n var dy = Math.abs(e.clientY - _this.pointer.y);\n if (dy > _this.SCROLL_THRESHOLD || dx > _this.domBuilder.root.offsetWidth) {\n _this.onPointerCancel();\n }\n };\n /**\n * Handles pointer up events by determining if the pointer interaction\n * should trigger a toggle action based on the distance moved.\n *\n * If the pointer has moved beyond a certain threshold, the pointer interaction is cancelled.\n * Allows dragging within the width of the toggle but cancels if vertical movement exceeds the scroll threshold.\n * Finally, it cleans up by calling the pointer cancel handler.\n *\n * If the pointer event is not a primary mouse button click, the interaction is cancelled.\n * @param e The PointerEvent object representing the pointer up event.\n */\n this.onPointerUp = function (e) {\n if (e.pointerType === \"mouse\" && e.button !== 0) {\n _this.onPointerCancel();\n return;\n }\n var dx = Math.abs(e.clientX - _this.pointer.x);\n var dy = Math.abs(e.clientY - _this.pointer.y);\n if (dy <= _this.SCROLL_THRESHOLD && dx <= _this.domBuilder.root.offsetWidth) {\n _this.apply(ToggleActionType.NEXT);\n }\n _this.onPointerCancel();\n };\n /**\n * Cleans up pointer event listeners after a pointer interaction is completed or cancelled.\n *\n * This method removes the `pointermove`, `pointerup`, and `pointercancel` event listeners\n * from the root element of the toggle.\n * However, `pointerdown` listener remains active for future interactions.\n */\n this.onPointerCancel = function () {\n _this.domBuilder.root.removeEventListener(\"pointermove\", _this.onPointerMove);\n _this.domBuilder.root.removeEventListener(\"pointerup\", _this.onPointerUp);\n _this.domBuilder.root.removeEventListener(\"pointercancel\", _this.onPointerCancel);\n };\n this.handlerKeyboardEvent = function (e) {\n if (e.key === \" \" || e.key === \"Enter\") {\n e.preventDefault();\n _this.apply(ToggleActionType.NEXT);\n }\n };\n this.handlerLabelEvent = function (e) {\n e.preventDefault();\n _this.apply(ToggleActionType.NEXT);\n _this.domBuilder.root.focus();\n };\n this.element = element;\n this.userOptions = options;\n this.options = OptionResolver.resolve(element, options);\n this.stateReducer = new StateReducer(element, this.options.tristate);\n this.domBuilder = new DOMBuilder(element, this.options, this.stateReducer.get());\n this.bindEventListeners();\n this.interceptInputProperties();\n this.element.bsToggle = this;\n }\n /**\n * Intercepts the following input properties to detect external changes:\n * - checked\n * - disabled\n * - readonly\n * - indeterminate\n * This method is used to detect changes made to the input element directly,\n * rather than through the BootstrapToggle API. It is used to maintain the\n * state of the toggle in cases where the user changes the input element\n * directly, rather than through the API.\n * @returns void\n */\n Toggle.prototype.interceptInputProperties = function () {\n var _this = this;\n var props = [\"checked\", \"disabled\", \"readOnly\", \"indeterminate\"];\n props.forEach(function (prop) {\n var descriptor = Object.getOwnPropertyDescriptor(Object.getPrototypeOf(_this.element), prop);\n if (!(descriptor === null || descriptor === void 0 ? void 0 : descriptor.set))\n return;\n _this.originalDescriptors.set(prop, descriptor);\n Object.defineProperty(_this.element, prop, {\n configurable: true,\n get: function () { return descriptor.get.call(_this.element); },\n set: function (value) {\n descriptor.set.call(_this.element, value);\n if (_this.suppressExternalSync)\n return;\n _this.onExternalChange();\n },\n });\n });\n };\n /**\n * Restores the original input properties of the toggle element.\n * This method is used to restore the original descriptors of the input properties\n * which were intercepted by the BootstrapToggle to detect external changes.\n * @returns void\n */\n Toggle.prototype.restoreInputProperties = function () {\n var _this = this;\n this.originalDescriptors.forEach(function (descriptor, prop) {\n Object.defineProperty(_this.element, prop, descriptor);\n });\n this.originalDescriptors.clear();\n };\n /**\n * Binds event listeners to the toggle element.\n * This method is called by the constructor and is responsible for\n * binding the following event listeners:\n * - Pointer events (click, touchstart, touchend)\n * - Keyboard events (keydown, keyup)\n * - Label events (click)\n * If the event listeners are already bound (i.e. this.eventsBound is true),\n * this method does nothing.\n * @returns void\n */\n Toggle.prototype.bindEventListeners = function () {\n if (this.eventsBound)\n return;\n this.bindFormResetListener();\n this.bindPointerEventListener();\n this.bindKeyboardEventListener();\n this.bindLabelEventListener();\n this.eventsBound = true;\n };\n /**\n * Unbinds all event listeners from the toggle element.\n * This method is called by the destructor and is responsible for\n * unbinding the following event listeners:\n * - Pointer events (click, touchstart, touchend)\n * - Keyboard events (keydown, keyup)\n * - Label events (click)\n * If the event listeners are not bound (i.e. this.eventsBound is false),\n * this method does nothing.\n * @returns void\n */\n Toggle.prototype.unbindEventListeners = function () {\n if (!this.eventsBound)\n return;\n this.unbindFormResetListener();\n this.unbindPointerEventListener();\n this.unbindKeyboardEventListener();\n this.unbindLabelEventListener();\n this.eventsBound = false;\n };\n Toggle.prototype.bindFormResetListener = function () {\n var form = this.element.form;\n if (!form)\n return;\n form.addEventListener(\"reset\", this.onFormReset);\n };\n Toggle.prototype.unbindFormResetListener = function () {\n var form = this.element.form;\n if (!form)\n return;\n form.removeEventListener(\"reset\", this.onFormReset);\n };\n /**\n * Binds a pointerdown event listener to the root element of the toggle.\n * The event listener is responsible for handling pointer events (e.g. mouse clicks, touch events)\n * and triggering the toggle's state change when a pointer event occurs.\n * The event listener is bound with the passive option, which means that it will not block\n * other event listeners from being triggered.\n */\n Toggle.prototype.bindPointerEventListener = function () {\n this.domBuilder.root.addEventListener(\"pointerdown\", this.onPointerDown, {\n passive: true,\n });\n };\n /**\n * Unbinds the pointerdown event listener from the root element of the toggle.\n * This method is responsible for unbinding the pointerdown event listener that was\n * previously bound by the bindPointerEventListener method.\n * If the event listener is not bound (i.e. this.eventsBound is false), this method does nothing.\n * @returns void\n */\n Toggle.prototype.unbindPointerEventListener = function () {\n this.domBuilder.root.removeEventListener(\"pointerdown\", this.onPointerDown);\n };\n /**\n * Binds a keydown event listener to the root element of the toggle.\n * The event listener is responsible for handling keydown events\n * and triggering the toggle's state change when a keydown event occurs.\n */\n Toggle.prototype.bindKeyboardEventListener = function () {\n this.domBuilder.root.addEventListener(\"keydown\", this.handlerKeyboardEvent, { passive: false });\n };\n /**\n * Unbinds the keydown event listener from the root element of the toggle.\n * This method is responsible for unbinding the keydown event listener that was\n * previously bound by the bindKeyboardEventListener method.\n * If the event listener is not bound (i.e. this.eventsBound is false), this method does nothing.\n * @returns void\n */\n Toggle.prototype.unbindKeyboardEventListener = function () {\n this.domBuilder.root.removeEventListener(\"keydown\", this.handlerKeyboardEvent);\n };\n /**\n * Binds a click event listener to all labels that are associated with the toggle's input element.\n * The event listener is responsible for handling click events and triggering the toggle's state change when a click event occurs.\n * 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.\n * This method is called by the constructor and is responsible for binding the event listener to the toggle's labels.\n * If the toggle's input element does not have an id (i.e. this.element.id is null or undefined), this method does nothing.\n * @returns void\n */\n Toggle.prototype.bindLabelEventListener = function () {\n var _this = this;\n if (this.element.id) {\n document\n .querySelectorAll('label[for=\"' + this.element.id + '\"]')\n .forEach(function (label) {\n label.addEventListener(\"click\", _this.handlerLabelEvent, {\n passive: false,\n });\n });\n }\n };\n /**\n * Unbinds the click event listener from all labels that are associated with the toggle's input element.\n * This method is responsible for unbinding the event listener that was previously bound by the bindLabelEventListener method.\n * If the toggle's input element does not have an id (i.e. this.element.id is null or undefined), this method does nothing.\n * @returns void\n */\n Toggle.prototype.unbindLabelEventListener = function () {\n var _this = this;\n if (this.element.id) {\n document\n .querySelectorAll('label[for=\"' + this.element.id + '\"]')\n .forEach(function (label) {\n label.removeEventListener(\"click\", _this.handlerLabelEvent);\n });\n }\n };\n /**\n * Applies a toggle action to the toggle state and renders the toggle element.\n * If the action is successful, this method will render the toggle element with the new state.\n * If the silent parameter is false, this method will also trigger the change event.\n * @param action The toggle action to apply.\n * @param silent A boolean indicating whether to trigger the change event after applying the action.\n */\n Toggle.prototype.apply = function (action, silent) {\n if (silent === void 0) { silent = false; }\n if (!this.stateReducer.do(action))\n return;\n this.suppressExternalSync = true;\n try {\n var state = this.stateReducer.get();\n this.domBuilder.render(state);\n if (!silent)\n this.trigger(action, state);\n }\n finally {\n this.suppressExternalSync = false;\n }\n };\n /**\n * Toggles the state of the toggle.\n * If the toggle is currently in the on state, it will be set to the off state.\n * If the toggle is currently in the off state, it will be set to the on state.\n * If the toggle is currently in the indeterminate state, it will be set to the on state.\n * If the silent parameter is false, this method will also trigger the change event.\n * @param silent A boolean indicating whether to trigger the change event after applying the action.\n */\n Toggle.prototype.toggle = function (silent) {\n if (silent === void 0) { silent = false; }\n this.apply(ToggleActionType.TOGGLE, silent);\n };\n /**\n * Sets the toggle state to on.\n * If the silent parameter is false, this method will also trigger the change event.\n * @param silent A boolean indicating whether to trigger the change event after applying the action.\n */\n Toggle.prototype.on = function (silent) {\n if (silent === void 0) { silent = false; }\n this.apply(ToggleActionType.ON, silent);\n };\n /**\n * Sets the toggle state to off.\n * If the silent parameter is false, this method will also trigger the change event.\n * @param silent A boolean indicating whether to trigger the change event after applying the action.\n */\n Toggle.prototype.off = function (silent) {\n if (silent === void 0) { silent = false; }\n this.apply(ToggleActionType.OFF, silent);\n };\n /**\n * Sets the toggle state to indeterminate.\n * If the silent parameter is false, this method will also trigger the change event.\n * @param {boolean} silent A boolean indicating whether to trigger the change event after applying the action.\n */\n Toggle.prototype.indeterminate = function (silent) {\n if (silent === void 0) { silent = false; }\n this.apply(ToggleActionType.INDETERMINATE, silent);\n };\n /**\n * Sets the toggle state to determinate.\n * If the silent parameter is false, this method will also trigger the change event.\n * @param {boolean} silent A boolean indicating whether to trigger the change event after applying the action.\n */\n Toggle.prototype.determinate = function (silent) {\n if (silent === void 0) { silent = false; }\n this.apply(ToggleActionType.DETERMINATE, silent);\n };\n /**\n * Enables the toggle.\n * If the toggle is currently disabled, this method will set the toggle state to enabled.\n * If the silent parameter is false, this method will also trigger the change event.\n * @param {boolean} silent A boolean indicating whether to trigger the change event after applying the action.\n * @returns void\n */\n Toggle.prototype.enable = function (silent) {\n if (silent === void 0) { silent = false; }\n this.apply(ToggleActionType.ENABLE, silent);\n };\n /**\n * Disables the toggle.\n * If the toggle is currently enabled, this method will set the toggle state to disabled.\n * If the silent parameter is false, this method will also trigger the change event.\n * @param {boolean} silent A boolean indicating whether to trigger the change event after applying the action.\n */\n Toggle.prototype.disable = function (silent) {\n if (silent === void 0) { silent = false; }\n this.apply(ToggleActionType.DISABLE, silent);\n };\n /**\n * Sets the toggle state to readonly.\n * If the toggle is currently disabled or enabled, this method will set the toggle state to readonly.\n * If the silent parameter is false, this method will also trigger the change event.\n * @param {boolean} silent A boolean indicating whether to trigger the change event after applying the action.\n * @returns void\n */\n Toggle.prototype.readonly = function (silent) {\n if (silent === void 0) { silent = false; }\n this.apply(ToggleActionType.READONLY, silent);\n };\n /**\n * Synchronizes the toggle state with the input element and renders the toggle.\n */\n Toggle.prototype.update = function () {\n this.suppressExternalSync = true;\n try {\n this.stateReducer.sync(this.element);\n this.domBuilder.render(this.stateReducer.get());\n }\n finally {\n this.suppressExternalSync = false;\n }\n };\n /**\n * Triggers the change event on the toggle's input element and the appropriate toggle event.\n * This method is called after a toggle action is applied to notify listeners of the state change.\n * @param {ToggleActionType} action The toggle action that was applied.\n * @param {ToggleState} state The state of the toggle once the action was applied.\n */\n Toggle.prototype.trigger = function (action, state) {\n this.element.dispatchEvent(new Event(\"change\", { bubbles: true }));\n var eventName = this.getEventForAction(action, state);\n var detail = { state: state };\n this.element.dispatchEvent(new CustomEvent(eventName, {\n bubbles: true,\n detail: detail\n }));\n };\n /**\n * Returns the corresponding toggle event for the given toggle action and state.\n * This method is used to determine which toggle event to trigger after a toggle action is applied.\n * @param {ToggleActionType} action The toggle action that was applied.\n * @param {ToggleState} state The previous state of the toggle before the action was applied.\n * @returns {ToggleEvents} The corresponding toggle event for the given toggle action and state.\n */\n Toggle.prototype.getEventForAction = function (action, state) {\n switch (action) {\n case ToggleActionType.ON:\n return ToggleEvents.ON;\n case ToggleActionType.OFF:\n return ToggleEvents.OFF;\n case ToggleActionType.INDETERMINATE:\n return ToggleEvents.MIXED;\n case ToggleActionType.ENABLE:\n return ToggleEvents.ENABLED;\n case ToggleActionType.DISABLE:\n return ToggleEvents.DISABLED;\n case ToggleActionType.READONLY:\n return ToggleEvents.READONLY;\n case ToggleActionType.DETERMINATE:\n case ToggleActionType.TOGGLE:\n case ToggleActionType.NEXT:\n return this.getValueEvent(state);\n }\n };\n /**\n * Returns the corresponding toggle event for the given toggle state.\n * This method is used to determine which toggle event to trigger after a toggle action is applied.\n * @param {ToggleState} state The previous state of the toggle before the action was applied.\n * @returns {ToggleEvents} The corresponding toggle event for the given toggle state.\n */\n Toggle.prototype.getValueEvent = function (state) {\n switch (state.value) {\n case ToggleStateValue.ON:\n return ToggleEvents.ON;\n case ToggleStateValue.OFF:\n return ToggleEvents.OFF;\n case ToggleStateValue.MIXED:\n return ToggleEvents.MIXED;\n }\n };\n /**\n * Destroys the toggle element and unbinds all event listeners.\n *This method is useful when you need to remove the toggle element from the DOM.\n *After calling this method, the toggle element will be removed from the DOM and all event listeners will be unbound.\n */\n Toggle.prototype.destroy = function () {\n this.restoreInputProperties();\n this.unbindEventListeners();\n this.domBuilder.destroy();\n delete this.element.bsToggle;\n };\n /**\n * Destroys the toggle element and reinitializes it with the same options.\n *This method is useful when you need to reinitialize the toggle element with the same options.\n */\n Toggle.prototype.rerender = function () {\n this.destroy();\n var _ = new Toggle(this.element, this.userOptions);\n };\n return Toggle;\n}());\nexport { Toggle };\n","import { Toggle } from \"./BootstrapToggle\";\r\nimport { default as Events } from \"./types/ToggleEvents\";\r\nimport { ToggleStateValue as StateValue, ToggleStateStatus as StateStatus } from \"./core/StateReducer.types\";\r\nimport { ToggleMethods as Methods } from \"./types/ToggleMethods\";\r\n\r\n+(function ($) {\r\n /**\r\n * Add `BootstrapToggle` prototype function to Window\r\n * Enables execution when used with ECMAScript\r\n */\r\n globalThis.window.BootstrapToggle = globalThis.window.BootstrapToggle || {};\r\n Object.assign(globalThis.window.BootstrapToggle, {Events, Methods, StateValue, StateStatus});\r\n\r\n function Plugin(options, silent) {\r\n const optArg = Array.prototype.slice.call(arguments, 1)[0];\r\n\r\n return ( this ).each(function () {\r\n const $this = $(this);\r\n let _bsToggle = this.bsToggle || new Toggle(this, (options && typeof options !== \"string\") ? options : {});\r\n\r\n if (options && typeof options === \"string\") {\r\n switch (options.toLowerCase()) {\r\n case Methods.TOGGLE:\r\n _bsToggle.toggle(silent);\r\n break;\r\n case Methods.ON:\r\n _bsToggle.on(silent);\r\n break;\r\n case Methods.OFF:\r\n _bsToggle.off(silent);\r\n break;\r\n case Methods.INDETERMINATE:\r\n _bsToggle.indeterminate(silent);\r\n break;\r\n case Methods.DETERMINATE:\r\n _bsToggle.determinate(silent);\r\n break;\r\n case Methods.ENABLE:\r\n _bsToggle.enable(silent);\r\n break;\r\n case Methods.DISABLE:\r\n _bsToggle.disable(silent);\r\n break;\r\n case Methods.READONLY:\r\n _bsToggle.readonly(silent);\r\n break;\r\n case Methods.DESTROY:\r\n _bsToggle.destroy();\r\n break;\r\n case Methods.RERENDER:\r\n _bsToggle.rerender();\r\n break;\r\n }\r\n }\r\n });\r\n }\r\n\r\n let old = $.fn.bootstrapToggle;\r\n\r\n $.fn.bootstrapToggle = Plugin;\r\n $.fn.bootstrapToggle.Constructor = Toggle;\r\n\r\n // TOGGLE NO CONFLICT\r\n // ==================\r\n\r\n $.fn.toggle.noConflict = function () {\r\n $.fn.bootstrapToggle = old;\r\n return this;\r\n };\r\n\r\n /**\r\n * Replace all `input[type=checkbox][data-toggle=\"toggle\"]` inputs with \"Bootstrap-Toggle\"\r\n * Executes once page elements have rendered enabling script to be placed in `<head>`\r\n */\r\n $(function () {\r\n $(\"input[type=checkbox][data-toggle^=toggle]\").bootstrapToggle();\r\n });\r\n})(jQuery);\r\n"],"names":["ToggleStateValue","ToggleStateStatus","ToggleActionType","SanitizeMode","PlacementOptions","DOMBuilder","checkbox","options","state","this","isBuilt","lastState","onStyle","concat","onstyle","offStyle","offstyle","name","onvalue","value","invCheckbox","offvalue","createInvCheckbox","sizeClass","sizeResolver","size","toggleOn","createToggleSpan","onlabel","ontitle","toggleOff","offlabel","offtitle","toggleHandle","createToggleHandle","toggleGroup","createToggleGroup","toggle","document","createElement","tooltip","tooltipLabels","title","isVisible","renderToggle","render","deferRender","prototype","parent","parentElement","offsetWidth","offsetHeight","_this","resizeObserver","ResizeObserver","entries","disconnect","_i","entries_1","length","entry","contentRect","width","height","observe","_a","large","lg","small","sm","mini","xs","offValue","cloneNode","dataset","removeAttribute","_b","style","tabindex","aria","className","tabIndex","role","insertBefore","appendChild","handleLabels","handleToggleSize","createTooltip","label","toggleSpan","innerHTML","cancelPendingAnimationFrame","requestAnimationFrame","requestAnimationFrameId","calculateToggleSize","error","console","warn","minWidth","Math","max","getBoundingClientRect","minHeight","classList","add","lineHeight","calcH","styles","globalThis","window","getComputedStyle","borderTopWidth","Number","parseFloat","borderBottomWidth","paddingTop","paddingBottom","undefined","cancelAnimationFrame","ariaOpts","labels","ids","Array","from","map","l","id","filter","Boolean","setAttribute","join","bootstrap","Tooltip","placement","html","on","updateToggleByValue","updateToggleByChecked","updateToggleByState","updateAria","updateTooltip","remove","ON","OFF","MIXED","checked","updateCheckboxByChecked","updateInvCheckboxByChecked","status","ENABLED","disabled","readOnly","DISABLED","READONLY","indeterminate","String","setContent","off","mixed","Object","defineProperty","get","enumerable","configurable","destroy","dispose","parentNode","sanitize","text","opts","mode","HTML","config","allowedTags","allowedAttributes","doc","DOMParser","parseFromString","body","childNodes","forEach","node","sanitizeNodeRecursive","nodeType","Node","ELEMENT_NODE","element_1","tagName","toLowerCase","includes","fragment_1","createDocumentFragment","child","replaceChild","attributes","attr","attrName","some","allowed","endsWith","startsWith","slice","element","sanitizeAllowedAttr","TEXT_NODE","sanitizeNode","TEXT","replace","m","sanitizeText","isNumeric","test","toString","trim","OptionType","OptionResolver","getAttr","sanitized","getAttribute","getAttrOrDefault","userValue","defaultValue","sanitizedUserValue","getAttrOrDeprecation","DeprecationConfig","resolve","userOptions","DEFAULT","tristate","hasAttribute","resolveTooltipOptions","handle","_c","_d","getTitle","userOption","titleOn","titleOff","titleMixed","TOP","values","ToggleEvents","deprecatedOptions","currentOpt","deprecatedAttr","deprecatedOpt","deprecatedAttrSanitized","log","ATTRIBUTE","OPTION","type","oldLabel","newLabel","__assign","assign","t","s","i","n","arguments","p","hasOwnProperty","call","apply","StateReducer","isTristate","getElementState","freeze","canInteract","sync","do","action","TOGGLE","INDETERMINATE","DETERMINATE","NEXT","setValueIfChanged","setValue","doNext","DISABLE","setStatusIfChanged","ENABLE","setStatus","ToggleMethods","Events","Toggle","pointer","SCROLL_THRESHOLD","eventsBound","suppressExternalSync","originalDescriptors","Map","onExternalChange","update","onFormReset","setTimeout","onPointerDown","e","pointerType","button","stateReducer","x","clientX","y","clientY","domBuilder","root","addEventListener","onPointerMove","passive","onPointerUp","onPointerCancel","dx","abs","removeEventListener","handlerKeyboardEvent","key","preventDefault","handlerLabelEvent","focus","bindEventListeners","interceptInputProperties","bsToggle","prop","descriptor","getOwnPropertyDescriptor","getPrototypeOf","set","restoreInputProperties","clear","bindFormResetListener","bindPointerEventListener","bindKeyboardEventListener","bindLabelEventListener","unbindEventListeners","unbindFormResetListener","unbindPointerEventListener","unbindKeyboardEventListener","unbindLabelEventListener","form","querySelectorAll","silent","trigger","determinate","enable","disable","readonly","dispatchEvent","Event","bubbles","eventName","getEventForAction","detail","CustomEvent","getValueEvent","rerender","$","BootstrapToggle","Methods","StateValue","StateStatus","old","fn","bootstrapToggle","each","_bsToggle","DESTROY","RERENDER","Constructor","noConflict","jQuery"],"mappings":"0FAAO,IAAIA,EAMAC,EAMAC,GAXX,SAAWF,GACPA,EAAqB,GAAI,KACzBA,EAAsB,IAAI,MAC1BA,EAAwB,MAAI,OAC/B,CAJD,CAIGA,IAAqBA,EAAmB,CAAA,IAE3C,SAAWC,GACPA,EAA2B,QAAI,UAC/BA,EAA4B,SAAI,WAChCA,EAA4B,SAAI,UACnC,CAJD,CAIGA,IAAsBA,EAAoB,CAAA,IAE7C,SAAWC,GACPA,EAAuB,KAAI,OAC3BA,EAAqB,GAAI,KACzBA,EAAsB,IAAI,MAC1BA,EAAyB,OAAI,SAC7BA,EAA8B,YAAI,cAClCA,EAAgC,cAAI,gBACpCA,EAA2B,SAAI,WAC/BA,EAA0B,QAAI,UAC9BA,EAAyB,OAAI,QAChC,CAVD,CAUGA,IAAqBA,EAAmB,CAAA,ICtB3C,ICDWC,ECAAC,EFCPC,EAA4B,WAQ5B,SAASA,EAAWC,EAAUC,EAASC,GACnCC,KAAKC,SAAU,EACfD,KAAKE,UAAYH,EACjBC,KAAKG,QAAU,OAAOC,OAAON,EAAQO,SACrCL,KAAKM,SAAW,OAAOF,OAAON,EAAQS,UACtCP,KAAKQ,KAAOV,EAAQU,KACpBR,KAAKH,SAAWA,EACZC,EAAQW,UACRT,KAAKH,SAASa,MAAQZ,EAAQW,SAClCT,KAAKW,YAAcb,EAAQc,SACrBZ,KAAKa,kBAAkBf,EAAQc,UAC/B,KACNZ,KAAKc,UAAYlB,EAAWmB,aAAajB,EAAQkB,MACjDhB,KAAKiB,SAAWjB,KAAKk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