/******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ 7609: /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; const atob = __webpack_require__(7776); const btoa = __webpack_require__(2350); module.exports = { atob, btoa }; /***/ }), /***/ 7776: /***/ ((module) => { "use strict"; /** * Implementation of atob() according to the HTML and Infra specs, except that * instead of throwing INVALID_CHARACTER_ERR we return null. */ function atob(data) { if (arguments.length === 0) { throw new TypeError("1 argument required, but only 0 present."); } // Web IDL requires DOMStrings to just be converted using ECMAScript // ToString, which in our case amounts to using a template literal. data = `${data}`; // "Remove all ASCII whitespace from data." data = data.replace(/[ \t\n\f\r]/g, ""); // "If data's length divides by 4 leaving no remainder, then: if data ends // with one or two U+003D (=) code points, then remove them from data." if (data.length % 4 === 0) { data = data.replace(/==?$/, ""); } // "If data's length divides by 4 leaving a remainder of 1, then return // failure." // // "If data contains a code point that is not one of // // U+002B (+) // U+002F (/) // ASCII alphanumeric // // then return failure." if (data.length % 4 === 1 || /[^+/0-9A-Za-z]/.test(data)) { return null; } // "Let output be an empty byte sequence." let output = ""; // "Let buffer be an empty buffer that can have bits appended to it." // // We append bits via left-shift and or. accumulatedBits is used to track // when we've gotten to 24 bits. let buffer = 0; let accumulatedBits = 0; // "Let position be a position variable for data, initially pointing at the // start of data." // // "While position does not point past the end of data:" for (let i = 0; i < data.length; i++) { // "Find the code point pointed to by position in the second column of // Table 1: The Base 64 Alphabet of RFC 4648. Let n be the number given in // the first cell of the same row. // // "Append to buffer the six bits corresponding to n, most significant bit // first." // // atobLookup() implements the table from RFC 4648. buffer <<= 6; buffer |= atobLookup(data[i]); accumulatedBits += 6; // "If buffer has accumulated 24 bits, interpret them as three 8-bit // big-endian numbers. Append three bytes with values equal to those // numbers to output, in the same order, and then empty buffer." if (accumulatedBits === 24) { output += String.fromCharCode((buffer & 0xff0000) >> 16); output += String.fromCharCode((buffer & 0xff00) >> 8); output += String.fromCharCode(buffer & 0xff); buffer = accumulatedBits = 0; } // "Advance position by 1." } // "If buffer is not empty, it contains either 12 or 18 bits. If it contains // 12 bits, then discard the last four and interpret the remaining eight as // an 8-bit big-endian number. If it contains 18 bits, then discard the last // two and interpret the remaining 16 as two 8-bit big-endian numbers. Append // the one or two bytes with values equal to those one or two numbers to // output, in the same order." if (accumulatedBits === 12) { buffer >>= 4; output += String.fromCharCode(buffer); } else if (accumulatedBits === 18) { buffer >>= 2; output += String.fromCharCode((buffer & 0xff00) >> 8); output += String.fromCharCode(buffer & 0xff); } // "Return output." return output; } /** * A lookup table for atob(), which converts an ASCII character to the * corresponding six-bit number. */ const keystr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; function atobLookup(chr) { const index = keystr.indexOf(chr); // Throw exception if character is not in the lookup string; should not be hit in tests return index < 0 ? undefined : index; } module.exports = atob; /***/ }), /***/ 2350: /***/ ((module) => { "use strict"; /** * btoa() as defined by the HTML and Infra specs, which mostly just references * RFC 4648. */ function btoa(s) { if (arguments.length === 0) { throw new TypeError("1 argument required, but only 0 present."); } let i; // String conversion as required by Web IDL. s = `${s}`; // "The btoa() method must throw an "InvalidCharacterError" DOMException if // data contains any character whose code point is greater than U+00FF." for (i = 0; i < s.length; i++) { if (s.charCodeAt(i) > 255) { return null; } } let out = ""; for (i = 0; i < s.length; i += 3) { const groupsOfSix = [undefined, undefined, undefined, undefined]; groupsOfSix[0] = s.charCodeAt(i) >> 2; groupsOfSix[1] = (s.charCodeAt(i) & 0x03) << 4; if (s.length > i + 1) { groupsOfSix[1] |= s.charCodeAt(i + 1) >> 4; groupsOfSix[2] = (s.charCodeAt(i + 1) & 0x0f) << 2; } if (s.length > i + 2) { groupsOfSix[2] |= s.charCodeAt(i + 2) >> 6; groupsOfSix[3] = s.charCodeAt(i + 2) & 0x3f; } for (let j = 0; j < groupsOfSix.length; j++) { if (typeof groupsOfSix[j] === "undefined") { out += "="; } else { out += btoaLookup(groupsOfSix[j]); } } } return out; } /** * Lookup table for btoa(), which converts a six-bit number into the * corresponding ASCII character. */ const keystr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; function btoaLookup(index) { if (index >= 0 && index < 64) { return keystr[index]; } // Throw INVALID_CHARACTER_ERR exception here -- won't be hit in the tests. return undefined; } module.exports = btoa; /***/ }), /***/ 3170: /***/ (function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Native Javascript for Bootstrap 4 v2.0.27 | © dnp_theme | MIT-License (function (root, factory) { if (true) { // AMD support: !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } else { var bsn; } })(this, function () { /* Native Javascript for Bootstrap 4 | Internal Utility Functions ----------------------------------------------------------------*/ "use strict"; // globals var globalObject = typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : this || window, DOC = document, HTML = DOC.documentElement, body = 'body', // allow the library to be used in // Native Javascript for Bootstrap Global Object BSN = globalObject.BSN = {}, supports = BSN.supports = [], // function toggle attributes dataToggle = 'data-toggle', dataDismiss = 'data-dismiss', dataSpy = 'data-spy', dataRide = 'data-ride', // components stringAlert = 'Alert', stringButton = 'Button', stringCarousel = 'Carousel', stringCollapse = 'Collapse', stringDropdown = 'Dropdown', stringModal = 'Modal', stringPopover = 'Popover', stringScrollSpy = 'ScrollSpy', stringTab = 'Tab', stringTooltip = 'Tooltip', stringToast = 'Toast', // options DATA API dataAutohide = 'data-autohide', databackdrop = 'data-backdrop', dataKeyboard = 'data-keyboard', dataTarget = 'data-target', dataInterval = 'data-interval', dataHeight = 'data-height', dataPause = 'data-pause', dataTitle = 'data-title', dataOriginalTitle = 'data-original-title', dataDismissible = 'data-dismissible', dataTrigger = 'data-trigger', dataAnimation = 'data-animation', dataContainer = 'data-container', dataPlacement = 'data-placement', dataDelay = 'data-delay', // option keys backdrop = 'backdrop', keyboard = 'keyboard', delay = 'delay', content = 'content', target = 'target', currentTarget = 'currentTarget', interval = 'interval', pause = 'pause', animation = 'animation', placement = 'placement', container = 'container', // box model offsetTop = 'offsetTop', offsetBottom = 'offsetBottom', offsetLeft = 'offsetLeft', scrollTop = 'scrollTop', scrollLeft = 'scrollLeft', clientWidth = 'clientWidth', clientHeight = 'clientHeight', offsetWidth = 'offsetWidth', offsetHeight = 'offsetHeight', innerWidth = 'innerWidth', innerHeight = 'innerHeight', scrollHeight = 'scrollHeight', scrollWidth = 'scrollWidth', height = 'height', // aria ariaExpanded = 'aria-expanded', ariaHidden = 'aria-hidden', ariaSelected = 'aria-selected', // event names clickEvent = 'click', focusEvent = 'focus', hoverEvent = 'hover', keydownEvent = 'keydown', keyupEvent = 'keyup', resizeEvent = 'resize', // passive scrollEvent = 'scroll', // passive mouseHover = 'onmouseleave' in DOC ? ['mouseenter', 'mouseleave'] : ['mouseover', 'mouseout'], // touch since 2.0.26 touchEvents = { start: 'touchstart', end: 'touchend', move: 'touchmove' }, // passive // originalEvents showEvent = 'show', shownEvent = 'shown', hideEvent = 'hide', hiddenEvent = 'hidden', closeEvent = 'close', closedEvent = 'closed', slidEvent = 'slid', slideEvent = 'slide', changeEvent = 'change', // other getAttribute = 'getAttribute', setAttribute = 'setAttribute', hasAttribute = 'hasAttribute', createElement = 'createElement', appendChild = 'appendChild', innerHTML = 'innerHTML', getElementsByTagName = 'getElementsByTagName', preventDefault = 'preventDefault', getBoundingClientRect = 'getBoundingClientRect', querySelectorAll = 'querySelectorAll', getElementsByCLASSNAME = 'getElementsByClassName', getComputedStyle = 'getComputedStyle', indexOf = 'indexOf', parentNode = 'parentNode', length = 'length', toLowerCase = 'toLowerCase', Transition = 'Transition', Duration = 'Duration', Webkit = 'Webkit', style = 'style', push = 'push', tabindex = 'tabindex', contains = 'contains', active = 'active', showClass = 'show', collapsing = 'collapsing', disabled = 'disabled', loading = 'loading', left = 'left', right = 'right', top = 'top', bottom = 'bottom', // tooltip / popover tipPositions = /\b(top|bottom|left|right)+/, // modal modalOverlay = 0, fixedTop = 'fixed-top', fixedBottom = 'fixed-bottom', // transitionEnd since 2.0.4 supportTransitions = Webkit + Transition in HTML[style] || Transition[toLowerCase]() in HTML[style], transitionEndEvent = Webkit + Transition in HTML[style] ? Webkit[toLowerCase]() + Transition + 'End' : Transition[toLowerCase]() + 'end', transitionDuration = Webkit + Duration in HTML[style] ? Webkit[toLowerCase]() + Transition + Duration : Transition[toLowerCase]() + Duration, // set new focus element since 2.0.3 setFocus = function (element) { element.focus ? element.focus() : element.setActive(); }, // class manipulation, since 2.0.0 requires polyfill.js addClass = function (element, classNAME) { element.classList.add(classNAME); }, removeClass = function (element, classNAME) { element.classList.remove(classNAME); }, hasClass = function (element, classNAME) { // since 2.0.0 return element.classList[contains](classNAME); }, // selection methods getElementsByClassName = function (element, classNAME) { // returns Array return [].slice.call(element[getElementsByCLASSNAME](classNAME)); }, queryElement = function (selector, parent) { var lookUp = parent ? parent : DOC; return typeof selector === 'object' ? selector : lookUp.querySelector(selector); }, getClosest = function (element, selector) { //element is the element and selector is for the closest parent element to find // source http://gomakethings.com/climbing-up-and-down-the-dom-tree-with-vanilla-javascript/ var firstChar = selector.charAt(0), selectorSubstring = selector.substr(1); if (firstChar === '.') { // If selector is a class for (; element && element !== DOC; element = element[parentNode]) { // Get closest match if (queryElement(selector, element[parentNode]) !== null && hasClass(element, selectorSubstring)) { return element; } } } else if (firstChar === '#') { // If selector is an ID for (; element && element !== DOC; element = element[parentNode]) { // Get closest match if (element.id === selectorSubstring) { return element; } } } return false; }, // event attach jQuery style / trigger since 1.2.0 on = function (element, event, handler, options) { options = options || false; element.addEventListener(event, handler, options); }, off = function (element, event, handler, options) { options = options || false; element.removeEventListener(event, handler, options); }, one = function (element, event, handler, options) { // one since 2.0.4 on(element, event, function handlerWrapper(e) { handler(e); off(element, event, handlerWrapper, options); }, options); }, // determine support for passive events supportPassive = function () { // Test via a getter in the options object to see if the passive property is accessed var result = false; try { var opts = Object.defineProperty({}, 'passive', { get: function () { result = true; } }); one(globalObject, 'testPassive', null, opts); } catch (e) {} return result; }(), // event options // https://github.com/WICG/EventListenerOptions/blob/gh-pages/explainer.md#feature-detection passiveHandler = supportPassive ? { passive: true } : false, // transitions getTransitionDurationFromElement = function (element) { var duration = supportTransitions ? globalObject[getComputedStyle](element)[transitionDuration] : 0; duration = parseFloat(duration); duration = typeof duration === 'number' && !isNaN(duration) ? duration * 1000 : 0; return duration; // we take a short offset to make sure we fire on the next frame after animation }, emulateTransitionEnd = function (element, handler) { // emulateTransitionEnd since 2.0.4 var called = 0, duration = getTransitionDurationFromElement(element); duration ? one(element, transitionEndEvent, function (e) { !called && handler(e), called = 1; }) : setTimeout(function () { !called && handler(), called = 1; }, 17); }, bootstrapCustomEvent = function (eventName, componentName, related) { var OriginalCustomEvent = new CustomEvent(eventName + '.bs.' + componentName); OriginalCustomEvent.relatedTarget = related; this.dispatchEvent(OriginalCustomEvent); }, // tooltip / popover stuff getScroll = function () { // also Affix and ScrollSpy uses it return { y: globalObject.pageYOffset || HTML[scrollTop], x: globalObject.pageXOffset || HTML[scrollLeft] }; }, styleTip = function (link, element, position, parent) { // both popovers and tooltips (target,tooltip,placement,elementToAppendTo) var elementDimensions = { w: element[offsetWidth], h: element[offsetHeight] }, windowWidth = HTML[clientWidth] || DOC[body][clientWidth], windowHeight = HTML[clientHeight] || DOC[body][clientHeight], rect = link[getBoundingClientRect](), scroll = parent === DOC[body] ? getScroll() : { x: parent[offsetLeft] + parent[scrollLeft], y: parent[offsetTop] + parent[scrollTop] }, linkDimensions = { w: rect[right] - rect[left], h: rect[bottom] - rect[top] }, isPopover = hasClass(element, 'popover'), topPosition, leftPosition, arrow = queryElement('.arrow', element), arrowTop, arrowLeft, arrowWidth, arrowHeight, halfTopExceed = rect[top] + linkDimensions.h / 2 - elementDimensions.h / 2 < 0, halfLeftExceed = rect[left] + linkDimensions.w / 2 - elementDimensions.w / 2 < 0, halfRightExceed = rect[left] + elementDimensions.w / 2 + linkDimensions.w / 2 >= windowWidth, halfBottomExceed = rect[top] + elementDimensions.h / 2 + linkDimensions.h / 2 >= windowHeight, topExceed = rect[top] - elementDimensions.h < 0, leftExceed = rect[left] - elementDimensions.w < 0, bottomExceed = rect[top] + elementDimensions.h + linkDimensions.h >= windowHeight, rightExceed = rect[left] + elementDimensions.w + linkDimensions.w >= windowWidth; // recompute position position = (position === left || position === right) && leftExceed && rightExceed ? top : position; // first, when both left and right limits are exceeded, we fall back to top|bottom position = position === top && topExceed ? bottom : position; position = position === bottom && bottomExceed ? top : position; position = position === left && leftExceed ? right : position; position = position === right && rightExceed ? left : position; // update tooltip/popover class element.className[indexOf](position) === -1 && (element.className = element.className.replace(tipPositions, position)); // we check the computed width & height and update here arrowWidth = arrow[offsetWidth]; arrowHeight = arrow[offsetHeight]; // apply styling to tooltip or popover if (position === left || position === right) { // secondary|side positions if (position === left) { // LEFT leftPosition = rect[left] + scroll.x - elementDimensions.w - (isPopover ? arrowWidth : 0); } else { // RIGHT leftPosition = rect[left] + scroll.x + linkDimensions.w; } // adjust top and arrow if (halfTopExceed) { topPosition = rect[top] + scroll.y; arrowTop = linkDimensions.h / 2 - arrowWidth; } else if (halfBottomExceed) { topPosition = rect[top] + scroll.y - elementDimensions.h + linkDimensions.h; arrowTop = elementDimensions.h - linkDimensions.h / 2 - arrowWidth; } else { topPosition = rect[top] + scroll.y - elementDimensions.h / 2 + linkDimensions.h / 2; arrowTop = elementDimensions.h / 2 - (isPopover ? arrowHeight * 0.9 : arrowHeight / 2); } } else if (position === top || position === bottom) { // primary|vertical positions if (position === top) { // TOP topPosition = rect[top] + scroll.y - elementDimensions.h - (isPopover ? arrowHeight : 0); } else { // BOTTOM topPosition = rect[top] + scroll.y + linkDimensions.h; } // adjust left | right and also the arrow if (halfLeftExceed) { leftPosition = 0; arrowLeft = rect[left] + linkDimensions.w / 2 - arrowWidth; } else if (halfRightExceed) { leftPosition = windowWidth - elementDimensions.w * 1.01; arrowLeft = elementDimensions.w - (windowWidth - rect[left]) + linkDimensions.w / 2 - arrowWidth / 2; } else { leftPosition = rect[left] + scroll.x - elementDimensions.w / 2 + linkDimensions.w / 2; arrowLeft = elementDimensions.w / 2 - (isPopover ? arrowWidth : arrowWidth / 2); } } // apply style to tooltip/popover and its arrow element[style][top] = topPosition + 'px'; element[style][left] = leftPosition + 'px'; arrowTop && (arrow[style][top] = arrowTop + 'px'); arrowLeft && (arrow[style][left] = arrowLeft + 'px'); }; BSN.version = '2.0.27'; /* Native Javascript for Bootstrap 4 | Alert -------------------------------------------*/ // ALERT DEFINITION // ================ var Alert = function (element) { // initialization element element = queryElement(element); // bind, target alert, duration and stuff var self = this, component = 'alert', alert = getClosest(element, '.' + component), triggerHandler = function () { hasClass(alert, 'fade') ? emulateTransitionEnd(alert, transitionEndHandler) : transitionEndHandler(); }, // handlers clickHandler = function (e) { alert = getClosest(e[target], '.' + component); element = queryElement('[' + dataDismiss + '="' + component + '"]', alert); element && alert && (element === e[target] || element[contains](e[target])) && self.close(); }, transitionEndHandler = function () { bootstrapCustomEvent.call(alert, closedEvent, component); off(element, clickEvent, clickHandler); // detach it's listener alert[parentNode].removeChild(alert); }; // public method this.close = function () { if (alert && element && hasClass(alert, showClass)) { bootstrapCustomEvent.call(alert, closeEvent, component); removeClass(alert, showClass); alert && triggerHandler(); } }; // init if (!(stringAlert in element)) { // prevent adding event handlers twice on(element, clickEvent, clickHandler); } element[stringAlert] = self; }; // ALERT DATA API // ============== supports[push]([stringAlert, Alert, '[' + dataDismiss + '="alert"]']); /* Native Javascript for Bootstrap 4 | Button ---------------------------------------------*/ // BUTTON DEFINITION // =================== var Button = function (element) { // initialization element element = queryElement(element); // constant var toggled = false, // toggled makes sure to prevent triggering twice the change.bs.button events // strings component = 'button', checked = 'checked', LABEL = 'LABEL', INPUT = 'INPUT', // private methods keyHandler = function (e) { var key = e.which || e.keyCode; key === 32 && e[target] === DOC.activeElement && toggle(e); }, preventScroll = function (e) { var key = e.which || e.keyCode; key === 32 && e[preventDefault](); }, toggle = function (e) { var label = e[target].tagName === LABEL ? e[target] : e[target][parentNode].tagName === LABEL ? e[target][parentNode] : null; // the .btn label if (!label) return; //react if a label or its immediate child is clicked var labels = getElementsByClassName(label[parentNode], 'btn'), // all the button group buttons input = label[getElementsByTagName](INPUT)[0]; if (!input) return; // return if no input found // manage the dom manipulation if (input.type === 'checkbox') { //checkboxes if (!input[checked]) { addClass(label, active); input[getAttribute](checked); input[setAttribute](checked, checked); input[checked] = true; } else { removeClass(label, active); input[getAttribute](checked); input.removeAttribute(checked); input[checked] = false; } if (!toggled) { // prevent triggering the event twice toggled = true; bootstrapCustomEvent.call(input, changeEvent, component); //trigger the change for the input bootstrapCustomEvent.call(element, changeEvent, component); //trigger the change for the btn-group } } if (input.type === 'radio' && !toggled) { // radio buttons // don't trigger if already active (the OR condition is a hack to check if the buttons were selected with key press and NOT mouse click) if (!input[checked] || e.screenX === 0 && e.screenY == 0) { addClass(label, active); addClass(label, focusEvent); input[setAttribute](checked, checked); input[checked] = true; bootstrapCustomEvent.call(input, changeEvent, component); //trigger the change for the input bootstrapCustomEvent.call(element, changeEvent, component); //trigger the change for the btn-group toggled = true; for (var i = 0, ll = labels[length]; i < ll; i++) { var otherLabel = labels[i], otherInput = otherLabel[getElementsByTagName](INPUT)[0]; if (otherLabel !== label && hasClass(otherLabel, active)) { removeClass(otherLabel, active); otherInput.removeAttribute(checked); otherInput[checked] = false; bootstrapCustomEvent.call(otherInput, changeEvent, component); // trigger the change } } } } setTimeout(function () { toggled = false; }, 50); }, focusHandler = function (e) { addClass(e[target][parentNode], focusEvent); }, blurHandler = function (e) { removeClass(e[target][parentNode], focusEvent); }; // init if (!(stringButton in element)) { // prevent adding event handlers twice on(element, clickEvent, toggle); on(element, keyupEvent, keyHandler), on(element, keydownEvent, preventScroll); var allBtns = getElementsByClassName(element, 'btn'); for (var i = 0; i < allBtns.length; i++) { var input = allBtns[i][getElementsByTagName](INPUT)[0]; on(input, focusEvent, focusHandler), on(input, 'blur', blurHandler); } } // activate items on load var labelsToACtivate = getElementsByClassName(element, 'btn'), lbll = labelsToACtivate[length]; for (var i = 0; i < lbll; i++) { !hasClass(labelsToACtivate[i], active) && queryElement('input:checked', labelsToACtivate[i]) && addClass(labelsToACtivate[i], active); } element[stringButton] = this; }; // BUTTON DATA API // ================= supports[push]([stringButton, Button, '[' + dataToggle + '="buttons"]']); /* Native Javascript for Bootstrap 4 | Collapse -----------------------------------------------*/ // COLLAPSE DEFINITION // =================== var Collapse = function (element, options) { // initialization element element = queryElement(element); // set options options = options || {}; // event targets and constants var accordion = null, collapse = null, self = this, accordionData = element[getAttribute]('data-parent'), activeCollapse, activeElement, // component strings component = 'collapse', collapsed = 'collapsed', isAnimating = 'isAnimating', // private methods openAction = function (collapseElement, toggle) { bootstrapCustomEvent.call(collapseElement, showEvent, component); collapseElement[isAnimating] = true; addClass(collapseElement, collapsing); removeClass(collapseElement, component); collapseElement[style][height] = collapseElement[scrollHeight] + 'px'; emulateTransitionEnd(collapseElement, function () { collapseElement[isAnimating] = false; collapseElement[setAttribute](ariaExpanded, 'true'); toggle[setAttribute](ariaExpanded, 'true'); removeClass(collapseElement, collapsing); addClass(collapseElement, component); addClass(collapseElement, showClass); collapseElement[style][height] = ''; bootstrapCustomEvent.call(collapseElement, shownEvent, component); }); }, closeAction = function (collapseElement, toggle) { bootstrapCustomEvent.call(collapseElement, hideEvent, component); collapseElement[isAnimating] = true; collapseElement[style][height] = collapseElement[scrollHeight] + 'px'; // set height first removeClass(collapseElement, component); removeClass(collapseElement, showClass); addClass(collapseElement, collapsing); collapseElement[offsetWidth]; // force reflow to enable transition collapseElement[style][height] = '0px'; emulateTransitionEnd(collapseElement, function () { collapseElement[isAnimating] = false; collapseElement[setAttribute](ariaExpanded, 'false'); toggle[setAttribute](ariaExpanded, 'false'); removeClass(collapseElement, collapsing); addClass(collapseElement, component); collapseElement[style][height] = ''; bootstrapCustomEvent.call(collapseElement, hiddenEvent, component); }); }, getTarget = function () { var href = element.href && element[getAttribute]('href'), parent = element[getAttribute](dataTarget), id = href || parent && parent.charAt(0) === '#' && parent; return id && queryElement(id); }; // public methods this.toggle = function (e) { e[preventDefault](); if (!hasClass(collapse, showClass)) { self.show(); } else { self.hide(); } }; this.hide = function () { if (collapse[isAnimating]) return; closeAction(collapse, element); addClass(element, collapsed); }; this.show = function () { if (accordion) { activeCollapse = queryElement('.' + component + '.' + showClass, accordion); activeElement = activeCollapse && (queryElement('[' + dataTarget + '="#' + activeCollapse.id + '"]', accordion) || queryElement('[href="#' + activeCollapse.id + '"]', accordion)); } if (!collapse[isAnimating] || activeCollapse && !activeCollapse[isAnimating]) { if (activeElement && activeCollapse !== collapse) { closeAction(activeCollapse, activeElement); addClass(activeElement, collapsed); } openAction(collapse, element); removeClass(element, collapsed); } }; // init if (!(stringCollapse in element)) { // prevent adding event handlers twice on(element, clickEvent, self.toggle); } collapse = getTarget(); collapse[isAnimating] = false; // when true it will prevent click handlers accordion = queryElement(options.parent) || accordionData && getClosest(element, accordionData); element[stringCollapse] = self; }; // COLLAPSE DATA API // ================= supports[push]([stringCollapse, Collapse, '[' + dataToggle + '="collapse"]']); /* Native Javascript for Bootstrap 4 | Dropdown ----------------------------------------------*/ // DROPDOWN DEFINITION // =================== var Dropdown = function (element, option) { // initialization element element = queryElement(element); // set option this.persist = option === true || element[getAttribute]('data-persist') === 'true' || false; // constants, event targets, strings var self = this, children = 'children', parent = element[parentNode], component = 'dropdown', open = 'open', relatedTarget = null, menu = queryElement('.dropdown-menu', parent), menuItems = function () { var set = menu[children], newSet = []; for (var i = 0; i < set[length]; i++) { set[i][children][length] && set[i][children][0].tagName === 'A' && newSet[push](set[i][children][0]); set[i].tagName === 'A' && newSet[push](set[i]); } return newSet; }(), // preventDefault on empty anchor links preventEmptyAnchor = function (anchor) { (anchor.href && anchor.href.slice(-1) === '#' || anchor[parentNode] && anchor[parentNode].href && anchor[parentNode].href.slice(-1) === '#') && this[preventDefault](); }, // toggle dismissible events toggleDismiss = function () { var type = element[open] ? on : off; type(DOC, clickEvent, dismissHandler); type(DOC, keydownEvent, preventScroll); type(DOC, keyupEvent, keyHandler); type(DOC, focusEvent, dismissHandler, true); }, // handlers dismissHandler = function (e) { var eventTarget = e[target], hasData = eventTarget && (eventTarget[getAttribute](dataToggle) || eventTarget[parentNode] && getAttribute in eventTarget[parentNode] && eventTarget[parentNode][getAttribute](dataToggle)); if (e.type === focusEvent && (eventTarget === element || eventTarget === menu || menu[contains](eventTarget))) { return; } if ((eventTarget === menu || menu[contains](eventTarget)) && (self.persist || hasData)) { return; } else { relatedTarget = eventTarget === element || element[contains](eventTarget) ? element : null; hide(); } preventEmptyAnchor.call(e, eventTarget); }, clickHandler = function (e) { relatedTarget = element; show(); preventEmptyAnchor.call(e, e[target]); }, preventScroll = function (e) { var key = e.which || e.keyCode; if (key === 38 || key === 40) { e[preventDefault](); } }, keyHandler = function (e) { var key = e.which || e.keyCode, activeItem = DOC.activeElement, idx = menuItems[indexOf](activeItem), isSameElement = activeItem === element, isInsideMenu = menu[contains](activeItem), isMenuItem = activeItem[parentNode] === menu || activeItem[parentNode][parentNode] === menu; if (isMenuItem) { // navigate up | down idx = isSameElement ? 0 : key === 38 ? idx > 1 ? idx - 1 : 0 : key === 40 ? idx < menuItems[length] - 1 ? idx + 1 : idx : idx; menuItems[idx] && setFocus(menuItems[idx]); } if ((menuItems[length] && isMenuItem // menu has items || !menuItems[length] && (isInsideMenu || isSameElement) // menu might be a form || !isInsideMenu // or the focused element is not in the menu at all ) && element[open] && key === 27 // menu must be open ) { self.toggle(); relatedTarget = null; } }, // private methods show = function () { bootstrapCustomEvent.call(parent, showEvent, component, relatedTarget); addClass(menu, showClass); addClass(parent, showClass); element[setAttribute](ariaExpanded, true); bootstrapCustomEvent.call(parent, shownEvent, component, relatedTarget); element[open] = true; off(element, clickEvent, clickHandler); setTimeout(function () { setFocus(menu[getElementsByTagName]('INPUT')[0] || element); // focus the first input item | element toggleDismiss(); }, 1); }, hide = function () { bootstrapCustomEvent.call(parent, hideEvent, component, relatedTarget); removeClass(menu, showClass); removeClass(parent, showClass); element[setAttribute](ariaExpanded, false); bootstrapCustomEvent.call(parent, hiddenEvent, component, relatedTarget); element[open] = false; toggleDismiss(); setFocus(element); setTimeout(function () { on(element, clickEvent, clickHandler); }, 1); }; // set initial state to closed element[open] = false; // public methods this.toggle = function () { if (hasClass(parent, showClass) && element[open]) { hide(); } else { show(); } }; // init if (!(stringDropdown in element)) { // prevent adding event handlers twice !tabindex in menu && menu[setAttribute](tabindex, '0'); // Fix onblur on Chrome | Safari on(element, clickEvent, clickHandler); } element[stringDropdown] = self; }; // DROPDOWN DATA API // ================= supports[push]([stringDropdown, Dropdown, '[' + dataToggle + '="dropdown"]']); /* Native Javascript for Bootstrap 4 | Modal -------------------------------------------*/ // MODAL DEFINITION // =============== var Modal = function (element, options) { // element can be the modal/triggering button // the modal (both JavaScript / DATA API init) / triggering button element (DATA API) element = queryElement(element); // strings var component = 'modal', staticString = 'static', modalTrigger = 'modalTrigger', paddingRight = 'paddingRight', modalBackdropString = 'modal-backdrop', isAnimating = 'isAnimating', // determine modal, triggering element btnCheck = element[getAttribute](dataTarget) || element[getAttribute]('href'), checkModal = queryElement(btnCheck), modal = hasClass(element, component) ? element : checkModal; if (hasClass(element, component)) { element = null; } // modal is now independent of it's triggering element if (!modal) { return; } // invalidate // set options options = options || {}; this[keyboard] = options[keyboard] === false || modal[getAttribute](dataKeyboard) === 'false' ? false : true; this[backdrop] = options[backdrop] === staticString || modal[getAttribute](databackdrop) === staticString ? staticString : true; this[backdrop] = options[backdrop] === false || modal[getAttribute](databackdrop) === 'false' ? false : this[backdrop]; this[animation] = hasClass(modal, 'fade') ? true : false; this[content] = options[content]; // JavaScript only // set an initial state of the modal modal[isAnimating] = false; // bind, constants, event targets and other vars var self = this, relatedTarget = null, bodyIsOverflowing, scrollBarWidth, overlay, overlayDelay, modalTimer, // also find fixed-top / fixed-bottom items fixedItems = getElementsByClassName(HTML, fixedTop).concat(getElementsByClassName(HTML, fixedBottom)), // private methods getWindowWidth = function () { var htmlRect = HTML[getBoundingClientRect](); return globalObject[innerWidth] || htmlRect[right] - Math.abs(htmlRect[left]); }, setScrollbar = function () { var bodyStyle = globalObject[getComputedStyle](DOC[body]), bodyPad = parseInt(bodyStyle[paddingRight], 10), itemPad; if (bodyIsOverflowing) { DOC[body][style][paddingRight] = bodyPad + scrollBarWidth + 'px'; modal[style][paddingRight] = scrollBarWidth + 'px'; if (fixedItems[length]) { for (var i = 0; i < fixedItems[length]; i++) { itemPad = globalObject[getComputedStyle](fixedItems[i])[paddingRight]; fixedItems[i][style][paddingRight] = parseInt(itemPad) + scrollBarWidth + 'px'; } } } }, resetScrollbar = function () { DOC[body][style][paddingRight] = ''; modal[style][paddingRight] = ''; if (fixedItems[length]) { for (var i = 0; i < fixedItems[length]; i++) { fixedItems[i][style][paddingRight] = ''; } } }, measureScrollbar = function () { // thx walsh var scrollDiv = DOC[createElement]('div'), widthValue; scrollDiv.className = component + '-scrollbar-measure'; // this is here to stay DOC[body][appendChild](scrollDiv); widthValue = scrollDiv[offsetWidth] - scrollDiv[clientWidth]; DOC[body].removeChild(scrollDiv); return widthValue; }, checkScrollbar = function () { bodyIsOverflowing = DOC[body][clientWidth] < getWindowWidth(); scrollBarWidth = measureScrollbar(); }, createOverlay = function () { var newOverlay = DOC[createElement]('div'); overlay = queryElement('.' + modalBackdropString); if (overlay === null) { newOverlay[setAttribute]('class', modalBackdropString + (self[animation] ? ' fade' : '')); overlay = newOverlay; DOC[body][appendChild](overlay); } modalOverlay = 1; }, removeOverlay = function () { overlay = queryElement('.' + modalBackdropString); if (overlay && overlay !== null && typeof overlay === 'object') { modalOverlay = 0; DOC[body].removeChild(overlay); overlay = null; } }, // triggers triggerShow = function () { setFocus(modal); modal[isAnimating] = false; bootstrapCustomEvent.call(modal, shownEvent, component, relatedTarget); on(globalObject, resizeEvent, self.update, passiveHandler); on(modal, clickEvent, dismissHandler); on(DOC, keydownEvent, keyHandler); }, triggerHide = function () { modal[style].display = ''; element && setFocus(element); bootstrapCustomEvent.call(modal, hiddenEvent, component); (function () { if (!getElementsByClassName(DOC, component + ' ' + showClass)[0]) { resetScrollbar(); removeClass(DOC[body], component + '-open'); overlay && hasClass(overlay, 'fade') ? (removeClass(overlay, showClass), emulateTransitionEnd(overlay, removeOverlay)) : removeOverlay(); off(globalObject, resizeEvent, self.update, passiveHandler); off(modal, clickEvent, dismissHandler); off(DOC, keydownEvent, keyHandler); } })(); modal[isAnimating] = false; }, // handlers clickHandler = function (e) { if (modal[isAnimating]) return; var clickTarget = e[target]; clickTarget = clickTarget[hasAttribute](dataTarget) || clickTarget[hasAttribute]('href') ? clickTarget : clickTarget[parentNode]; if (clickTarget === element && !hasClass(modal, showClass)) { modal[modalTrigger] = element; relatedTarget = element; self.show(); e[preventDefault](); } }, keyHandler = function (e) { if (modal[isAnimating]) return; if (self[keyboard] && e.which == 27 && hasClass(modal, showClass)) { self.hide(); } }, dismissHandler = function (e) { if (modal[isAnimating]) return; var clickTarget = e[target]; if (hasClass(modal, showClass) && (clickTarget[parentNode][getAttribute](dataDismiss) === component || clickTarget[getAttribute](dataDismiss) === component || clickTarget === modal && self[backdrop] !== staticString)) { self.hide(); relatedTarget = null; e[preventDefault](); } }; // public methods this.toggle = function () { if (hasClass(modal, showClass)) { this.hide(); } else { this.show(); } }; this.show = function () { if (hasClass(modal, showClass) || modal[isAnimating]) { return; } clearTimeout(modalTimer); modalTimer = setTimeout(function () { modal[isAnimating] = true; bootstrapCustomEvent.call(modal, showEvent, component, relatedTarget); // we elegantly hide any opened modal var currentOpen = getElementsByClassName(DOC, component + ' ' + showClass)[0]; if (currentOpen && currentOpen !== modal) { modalTrigger in currentOpen && currentOpen[modalTrigger][stringModal].hide(); stringModal in currentOpen && currentOpen[stringModal].hide(); } if (self[backdrop]) { !modalOverlay && !overlay && createOverlay(); } if (overlay && !hasClass(overlay, showClass)) { overlay[offsetWidth]; // force reflow to enable trasition overlayDelay = getTransitionDurationFromElement(overlay); addClass(overlay, showClass); } setTimeout(function () { modal[style].display = 'block'; checkScrollbar(); setScrollbar(); addClass(DOC[body], component + '-open'); addClass(modal, showClass); modal[setAttribute](ariaHidden, false); hasClass(modal, 'fade') ? emulateTransitionEnd(modal, triggerShow) : triggerShow(); }, supportTransitions && overlay && overlayDelay ? overlayDelay : 1); }, 1); }; this.hide = function () { if (modal[isAnimating] || !hasClass(modal, showClass)) { return; } clearTimeout(modalTimer); modalTimer = setTimeout(function () { modal[isAnimating] = true; bootstrapCustomEvent.call(modal, hideEvent, component); overlay = queryElement('.' + modalBackdropString); overlayDelay = overlay && getTransitionDurationFromElement(overlay); removeClass(modal, showClass); modal[setAttribute](ariaHidden, true); setTimeout(function () { hasClass(modal, 'fade') ? emulateTransitionEnd(modal, triggerHide) : triggerHide(); }, supportTransitions && overlay && overlayDelay ? overlayDelay : 2); }, 2); }; this.setContent = function (content) { queryElement('.' + component + '-content', modal)[innerHTML] = content; }; this.update = function () { if (hasClass(modal, showClass)) { checkScrollbar(); setScrollbar(); } }; // init // prevent adding event handlers over and over // modal is independent of a triggering element if (!!element && !(stringModal in element)) { on(element, clickEvent, clickHandler); } if (!!self[content]) { self.setContent(self[content]); } if (element) { element[stringModal] = self; modal[modalTrigger] = element; } else { modal[stringModal] = self; } }; // DATA API supports[push]([stringModal, Modal, '[' + dataToggle + '="modal"]']); /* Native Javascript for Bootstrap 4 | Popover ----------------------------------------------*/ // POPOVER DEFINITION // ================== var Popover = function (element, options) { // initialization element element = queryElement(element); // set options options = options || {}; // DATA API var triggerData = element[getAttribute](dataTrigger), // click / hover / focus animationData = element[getAttribute](dataAnimation), // true / false placementData = element[getAttribute](dataPlacement), dismissibleData = element[getAttribute](dataDismissible), delayData = element[getAttribute](dataDelay), containerData = element[getAttribute](dataContainer), // internal strings component = 'popover', template = 'template', trigger = 'trigger', classString = 'class', div = 'div', fade = 'fade', dataContent = 'data-content', dismissible = 'dismissible', closeBtn = '', // check container containerElement = queryElement(options[container]), containerDataElement = queryElement(containerData), // maybe the element is inside a modal modal = getClosest(element, '.modal'), // maybe the element is inside a fixed navbar navbarFixedTop = getClosest(element, '.' + fixedTop), navbarFixedBottom = getClosest(element, '.' + fixedBottom); // set instance options this[template] = options[template] ? options[template] : null; // JavaScript only this[trigger] = options[trigger] ? options[trigger] : triggerData || hoverEvent; this[animation] = options[animation] && options[animation] !== fade ? options[animation] : animationData || fade; this[placement] = options[placement] ? options[placement] : placementData || top; this[delay] = parseInt(options[delay] || delayData) || 200; this[dismissible] = options[dismissible] || dismissibleData === 'true' ? true : false; this[container] = containerElement ? containerElement : containerDataElement ? containerDataElement : navbarFixedTop ? navbarFixedTop : navbarFixedBottom ? navbarFixedBottom : modal ? modal : DOC[body]; // bind, content var self = this, titleString = options.title || element[getAttribute](dataTitle) || null, contentString = options.content || element[getAttribute](dataContent) || null; if (!contentString && !this[template]) return; // invalidate // constants, vars var popover = null, timer = 0, placementSetting = this[placement], // handlers dismissibleHandler = function (e) { if (popover !== null && e[target] === queryElement('.close', popover)) { self.hide(); } }, // private methods removePopover = function () { self[container].removeChild(popover); timer = null; popover = null; }, createPopover = function () { titleString = options.title || element[getAttribute](dataTitle); contentString = options.content || element[getAttribute](dataContent); // fixing https://github.com/thednp/bootstrap.native/issues/233 contentString = !!contentString ? contentString.trim() : null; popover = DOC[createElement](div); // popover arrow var popoverArrow = DOC[createElement](div); popoverArrow[setAttribute](classString, 'arrow'); popover[appendChild](popoverArrow); if (contentString !== null && self[template] === null) { //create the popover from data attributes popover[setAttribute]('role', 'tooltip'); if (titleString !== null) { var popoverTitle = DOC[createElement]('h3'); popoverTitle[setAttribute](classString, component + '-header'); popoverTitle[innerHTML] = self[dismissible] ? titleString + closeBtn : titleString; popover[appendChild](popoverTitle); } //set popover content var popoverContent = DOC[createElement](div); popoverContent[setAttribute](classString, component + '-body'); popoverContent[innerHTML] = self[dismissible] && titleString === null ? contentString + closeBtn : contentString; popover[appendChild](popoverContent); } else { // or create the popover from template var popoverTemplate = DOC[createElement](div); self[template] = self[template].trim(); popoverTemplate[innerHTML] = self[template]; popover[innerHTML] = popoverTemplate.firstChild[innerHTML]; } //append to the container self[container][appendChild](popover); popover[style].display = 'block'; popover[setAttribute](classString, component + ' bs-' + component + '-' + placementSetting + ' ' + self[animation]); }, showPopover = function () { !hasClass(popover, showClass) && addClass(popover, showClass); }, updatePopover = function () { styleTip(element, popover, placementSetting, self[container]); }, // event toggle dismissHandlerToggle = function (type) { if (clickEvent == self[trigger] || 'focus' == self[trigger]) { !self[dismissible] && type(element, 'blur', self.hide); } self[dismissible] && type(DOC, clickEvent, dismissibleHandler); type(globalObject, resizeEvent, self.hide, passiveHandler); }, // triggers showTrigger = function () { dismissHandlerToggle(on); bootstrapCustomEvent.call(element, shownEvent, component); }, hideTrigger = function () { dismissHandlerToggle(off); removePopover(); bootstrapCustomEvent.call(element, hiddenEvent, component); }; // public methods / handlers this.toggle = function () { if (popover === null) { self.show(); } else { self.hide(); } }; this.show = function () { clearTimeout(timer); timer = setTimeout(function () { if (popover === null) { placementSetting = self[placement]; // we reset placement in all cases createPopover(); updatePopover(); showPopover(); bootstrapCustomEvent.call(element, showEvent, component); !!self[animation] ? emulateTransitionEnd(popover, showTrigger) : showTrigger(); } }, 20); }; this.hide = function () { clearTimeout(timer); timer = setTimeout(function () { if (popover && popover !== null && hasClass(popover, showClass)) { bootstrapCustomEvent.call(element, hideEvent, component); removeClass(popover, showClass); !!self[animation] ? emulateTransitionEnd(popover, hideTrigger) : hideTrigger(); } }, self[delay]); }; // init if (!(stringPopover in element)) { // prevent adding event handlers twice if (self[trigger] === hoverEvent) { on(element, mouseHover[0], self.show); if (!self[dismissible]) { on(element, mouseHover[1], self.hide); } } else if (clickEvent == self[trigger] || 'focus' == self[trigger]) { on(element, self[trigger], self.toggle); } } element[stringPopover] = self; }; // POPOVER DATA API // ================ supports[push]([stringPopover, Popover, '[' + dataToggle + '="popover"]']); /* Native Javascript for Bootstrap 4 | Tab -----------------------------------------*/ // TAB DEFINITION // ============== var Tab = function (element, options) { // initialization element element = queryElement(element); // DATA API var heightData = element[getAttribute](dataHeight), // strings component = 'tab', height = 'height', float = 'float', isAnimating = 'isAnimating'; // set options options = options || {}; this[height] = supportTransitions ? options[height] || heightData === 'true' : false; // bind, event targets var self = this, next, tabs = getClosest(element, '.nav'), tabsContentContainer = false, dropdown = tabs && queryElement('.dropdown-toggle', tabs), activeTab, activeContent, nextContent, containerHeight, equalContents, nextHeight, // trigger triggerEnd = function () { tabsContentContainer[style][height] = ''; removeClass(tabsContentContainer, collapsing); tabs[isAnimating] = false; }, triggerShow = function () { if (tabsContentContainer) { // height animation if (equalContents) { triggerEnd(); } else { setTimeout(function () { // enables height animation tabsContentContainer[style][height] = nextHeight + 'px'; // height animation tabsContentContainer[offsetWidth]; emulateTransitionEnd(tabsContentContainer, triggerEnd); }, 50); } } else { tabs[isAnimating] = false; } bootstrapCustomEvent.call(next, shownEvent, component, activeTab); }, triggerHide = function () { if (tabsContentContainer) { activeContent[style][float] = left; nextContent[style][float] = left; containerHeight = activeContent[scrollHeight]; } addClass(nextContent, active); bootstrapCustomEvent.call(next, showEvent, component, activeTab); removeClass(activeContent, active); bootstrapCustomEvent.call(activeTab, hiddenEvent, component, next); if (tabsContentContainer) { nextHeight = nextContent[scrollHeight]; equalContents = nextHeight === containerHeight; addClass(tabsContentContainer, collapsing); tabsContentContainer[style][height] = containerHeight + 'px'; // height animation tabsContentContainer[offsetHeight]; activeContent[style][float] = ''; nextContent[style][float] = ''; } if (hasClass(nextContent, 'fade')) { setTimeout(function () { addClass(nextContent, showClass); emulateTransitionEnd(nextContent, triggerShow); }, 20); } else { triggerShow(); } }; if (!tabs) return; // invalidate // set default animation state tabs[isAnimating] = false; // private methods var getActiveTab = function () { var activeTabs = getElementsByClassName(tabs, active), activeTab; if (activeTabs[length] === 1 && !hasClass(activeTabs[0][parentNode], 'dropdown')) { activeTab = activeTabs[0]; } else if (activeTabs[length] > 1) { activeTab = activeTabs[activeTabs[length] - 1]; } return activeTab; }, getActiveContent = function () { return queryElement(getActiveTab()[getAttribute]('href')); }, // handler clickHandler = function (e) { e[preventDefault](); next = e[currentTarget]; !tabs[isAnimating] && !hasClass(next, active) && self.show(); }; // public method this.show = function () { // the tab we clicked is now the next tab next = next || element; nextContent = queryElement(next[getAttribute]('href')); //this is the actual object, the next tab content to activate activeTab = getActiveTab(); activeContent = getActiveContent(); tabs[isAnimating] = true; removeClass(activeTab, active); activeTab[setAttribute](ariaSelected, 'false'); addClass(next, active); next[setAttribute](ariaSelected, 'true'); if (dropdown) { if (!hasClass(element[parentNode], 'dropdown-menu')) { if (hasClass(dropdown, active)) removeClass(dropdown, active); } else { if (!hasClass(dropdown, active)) addClass(dropdown, active); } } bootstrapCustomEvent.call(activeTab, hideEvent, component, next); if (hasClass(activeContent, 'fade')) { removeClass(activeContent, showClass); emulateTransitionEnd(activeContent, triggerHide); } else { triggerHide(); } }; // init if (!(stringTab in element)) { // prevent adding event handlers twice on(element, clickEvent, clickHandler); } if (self[height]) { tabsContentContainer = getActiveContent()[parentNode]; } element[stringTab] = self; }; // TAB DATA API // ============ supports[push]([stringTab, Tab, '[' + dataToggle + '="tab"]']); /* Native Javascript for Bootstrap | Initialize Data API --------------------------------------------------------*/ var initializeDataAPI = function (constructor, collection) { for (var i = 0, l = collection[length]; i < l; i++) { new constructor(collection[i]); } }, initCallback = BSN.initCallback = function (lookUp) { lookUp = lookUp || DOC; for (var i = 0, l = supports[length]; i < l; i++) { initializeDataAPI(supports[i][1], lookUp[querySelectorAll](supports[i][2])); } }; // bulk initialize all components DOC[body] ? initCallback() : on(DOC, 'DOMContentLoaded', function () { initCallback(); }); return { Alert: Alert, Button: Button, Collapse: Collapse, Dropdown: Dropdown, Modal: Modal, Popover: Popover, Tab: Tab }; }); /***/ }), /***/ 4923: /***/ ((module) => { !function (t, e) { true ? module.exports = e() : 0; }(window, function () { return function (t) { var e = {}; function r(n) { if (e[n]) return e[n].exports; var i = e[n] = { i: n, l: !1, exports: {} }; return t[n].call(i.exports, i, i.exports, r), i.l = !0, i.exports; } return r.m = t, r.c = e, r.d = function (t, e, n) { r.o(t, e) || Object.defineProperty(t, e, { configurable: !1, enumerable: !0, get: n }); }, r.r = function (t) { Object.defineProperty(t, "__esModule", { value: !0 }); }, r.n = function (t) { var e = t && t.__esModule ? function () { return t.default; } : function () { return t; }; return r.d(e, "a", e), e; }, r.o = function (t, e) { return Object.prototype.hasOwnProperty.call(t, e); }, r.p = "", r(r.s = 7); }([function (t, e, r) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); e.loadImageElement = function (t, e) { return new Promise(function (r, n) { t.addEventListener("load", function () { r(t); }, !1), t.addEventListener("error", function (t) { n(t); }, !1), t.src = e; }); }, e.resize = function (t, e, r, n) { if (!r && !n) return { currentWidth: t, currentHeight: e }; var i = t / e, o = void 0, a = void 0; return i > r / n ? a = (o = Math.min(t, r)) / i : o = (a = Math.min(e, n)) * i, { width: o, height: a }; }; }, function (t, e, r) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); e.base64ToFile = function (t) { for (var e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "image/jpeg", r = window.atob(t), n = [], i = 0; i < r.length; i++) n[i] = r.charCodeAt(i); return new window.Blob([new Uint8Array(n)], { type: e }); }, e.imageToCanvas = function (t, e, r, n) { var i = document.createElement("canvas"), o = i.getContext("2d"); if (i.width = e, i.height = r, !n || n > 8) return o.drawImage(t, 0, 0, i.width, i.height), i; switch (n > 4 && (i.width = r, i.height = e), n) { case 2: o.translate(e, 0), o.scale(-1, 1); break; case 3: o.translate(e, r), o.rotate(Math.PI); break; case 4: o.translate(0, r), o.scale(1, -1); break; case 5: o.rotate(.5 * Math.PI), o.scale(1, -1); break; case 6: o.rotate(.5 * Math.PI), o.translate(0, -r); break; case 7: o.rotate(.5 * Math.PI), o.translate(e, -r), o.scale(-1, 1); break; case 8: o.rotate(-.5 * Math.PI), o.translate(-e, 0); } return n > 4 ? o.drawImage(t, 0, 0, i.height, i.width) : o.drawImage(t, 0, 0, i.width, i.height), i; }, e.canvasToBlob = function (t, e) { return new Promise(function (r, n) { t.toBlob(function (t) { r(t); }, "image/jpeg", e); }); }, e.size = function (t) { return { kB: .001 * t, MB: 1e-6 * t }; }, e.blobToBase64 = function (t) { return new Promise(function (e, r) { var n = new window.FileReader(); n.addEventListener("load", function (t) { e(t.target.result); }, !1), n.addEventListener("error", function (t) { r(t); }, !1), n.readAsDataURL(t); }); }; }, function (t, e, r) { t.exports = r(6); }, function (t, e, r) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); e.extractOrientation = function (t) { return new Promise(function (e, r) { var n = new window.FileReader(); n.onload = function (t) { var r = new DataView(t.target.result); 65496 !== r.getUint16(0, !1) && e(-2); for (var n = r.byteLength, i = 2; i < n;) { var o = r.getUint16(i, !1); if (i += 2, 65505 === o) { 1165519206 !== r.getUint32(i += 2, !1) && e(-1); var a = 18761 === r.getUint16(i += 6, !1); i += r.getUint32(i + 4, a); var u = r.getUint16(i, a); i += 2; for (var s = 0; s < u; s++) 274 === r.getUint16(i + 12 * s, a) && e(r.getUint16(i + 12 * s + 8, a)); } else { if (65280 != (65280 & o)) break; i += r.getUint16(i, !1); } } e(-1); }, n.readAsArrayBuffer(t.slice(0, 65536)); }); }; }, function (t, e, r) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var n, i = r(2), o = (n = i) && n.__esModule ? n : { default: n }, a = function () { function t(t, e) { for (var r = 0; r < e.length; r++) { var n = e[r]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n); } } return function (e, r, n) { return r && t(e.prototype, r), n && t(e, n), e; }; }(), u = r(3), s = r(0), c = r(1); function f(t) { return function () { var e = t.apply(this, arguments); return new Promise(function (t, r) { return function n(i, o) { try { var a = e[i](o), u = a.value; } catch (t) { return void r(t); } if (!a.done) return Promise.resolve(u).then(function (t) { n("next", t); }, function (t) { n("throw", t); }); t(u); }("next"); }); }; } var l = function () { function t(e) { !function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); }(this, t), this.data = e, this.name = e.name, this.type = e.type, this.size = e.size; } return a(t, [{ key: "setData", value: function (t) { this.data = t, this.size = t.size, this.type = t.type; } }, { key: "_calculateOrientation", value: function () { var t = f(o.default.mark(function t() { var e; return o.default.wrap(function (t) { for (;;) switch (t.prev = t.next) { case 0: return t.next = 2, (0, u.extractOrientation)(this.data); case 2: e = t.sent, this.orientation = e; case 4: case "end": return t.stop(); } }, t, this); })); return function () { return t.apply(this, arguments); }; }() }, { key: "load", value: function () { var t = f(o.default.mark(function t() { var e, r; return o.default.wrap(function (t) { for (;;) switch (t.prev = t.next) { case 0: return t.next = 2, this._calculateOrientation(); case 2: return e = URL.createObjectURL(this.data), r = new window.Image(), t.next = 6, (0, s.loadImageElement)(r, e); case 6: URL.revokeObjectURL(e), this._img = r, this.width = r.naturalWidth, this.height = r.naturalHeight; case 10: case "end": return t.stop(); } }, t, this); })); return function () { return t.apply(this, arguments); }; }() }, { key: "getCanvas", value: function (t, e, r) { return void 0 !== r ? (0, c.imageToCanvas)(this._img, t, e, r) : (0, c.imageToCanvas)(this._img, t, e, this.orientation); } }]), t; }(); e.default = l, t.exports = e.default; }, function (t, e) { !function (e) { "use strict"; var r, n = Object.prototype, i = n.hasOwnProperty, o = "function" == typeof Symbol ? Symbol : {}, a = o.iterator || "@@iterator", u = o.asyncIterator || "@@asyncIterator", s = o.toStringTag || "@@toStringTag", c = "object" == typeof t, f = e.regeneratorRuntime; if (f) c && (t.exports = f);else { (f = e.regeneratorRuntime = c ? t.exports : {}).wrap = w; var l = "suspendedStart", h = "suspendedYield", p = "executing", d = "completed", A = {}, v = {}; v[a] = function () { return this; }; var y = Object.getPrototypeOf, g = y && y(y(z([]))); g && g !== n && i.call(g, a) && (v = g); var m = B.prototype = x.prototype = Object.create(v); b.prototype = m.constructor = B, B.constructor = b, B[s] = b.displayName = "GeneratorFunction", f.isGeneratorFunction = function (t) { var e = "function" == typeof t && t.constructor; return !!e && (e === b || "GeneratorFunction" === (e.displayName || e.name)); }, f.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, B) : (t.__proto__ = B, s in t || (t[s] = "GeneratorFunction")), t.prototype = Object.create(m), t; }, f.awrap = function (t) { return { __await: t }; }, Q(_.prototype), _.prototype[u] = function () { return this; }, f.AsyncIterator = _, f.async = function (t, e, r, n) { var i = new _(w(t, e, r, n)); return f.isGeneratorFunction(e) ? i : i.next().then(function (t) { return t.done ? t.value : i.next(); }); }, Q(m), m[s] = "Generator", m[a] = function () { return this; }, m.toString = function () { return "[object Generator]"; }, f.keys = function (t) { var e = []; for (var r in t) e.push(r); return e.reverse(), function r() { for (; e.length;) { var n = e.pop(); if (n in t) return r.value = n, r.done = !1, r; } return r.done = !0, r; }; }, f.values = z, O.prototype = { constructor: O, reset: function (t) { if (this.prev = 0, this.next = 0, this.sent = this._sent = r, this.done = !1, this.delegate = null, this.method = "next", this.arg = r, this.tryEntries.forEach(P), !t) for (var e in this) "t" === e.charAt(0) && i.call(this, e) && !isNaN(+e.slice(1)) && (this[e] = r); }, stop: function () { this.done = !0; var t = this.tryEntries[0].completion; if ("throw" === t.type) throw t.arg; return this.rval; }, dispatchException: function (t) { if (this.done) throw t; var e = this; function n(n, i) { return u.type = "throw", u.arg = t, e.next = n, i && (e.method = "next", e.arg = r), !!i; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var a = this.tryEntries[o], u = a.completion; if ("root" === a.tryLoc) return n("end"); if (a.tryLoc <= this.prev) { var s = i.call(a, "catchLoc"), c = i.call(a, "finallyLoc"); if (s && c) { if (this.prev < a.catchLoc) return n(a.catchLoc, !0); if (this.prev < a.finallyLoc) return n(a.finallyLoc); } else if (s) { if (this.prev < a.catchLoc) return n(a.catchLoc, !0); } else { if (!c) throw new Error("try statement without catch or finally"); if (this.prev < a.finallyLoc) return n(a.finallyLoc); } } } }, abrupt: function (t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var n = this.tryEntries[r]; if (n.tryLoc <= this.prev && i.call(n, "finallyLoc") && this.prev < n.finallyLoc) { var o = n; break; } } o && ("break" === t || "continue" === t) && o.tryLoc <= e && e <= o.finallyLoc && (o = null); var a = o ? o.completion : {}; return a.type = t, a.arg = e, o ? (this.method = "next", this.next = o.finallyLoc, A) : this.complete(a); }, complete: function (t, e) { if ("throw" === t.type) throw t.arg; return "break" === t.type || "continue" === t.type ? this.next = t.arg : "return" === t.type ? (this.rval = this.arg = t.arg, this.method = "return", this.next = "end") : "normal" === t.type && e && (this.next = e), A; }, finish: function (t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), P(r), A; } }, catch: function (t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if ("throw" === n.type) { var i = n.arg; P(r); } return i; } } throw new Error("illegal catch attempt"); }, delegateYield: function (t, e, n) { return this.delegate = { iterator: z(t), resultName: e, nextLoc: n }, "next" === this.method && (this.arg = r), A; } }; } function w(t, e, r, n) { var i = e && e.prototype instanceof x ? e : x, o = Object.create(i.prototype), a = new O(n || []); return o._invoke = function (t, e, r) { var n = l; return function (i, o) { if (n === p) throw new Error("Generator is already running"); if (n === d) { if ("throw" === i) throw o; return j(); } for (r.method = i, r.arg = o;;) { var a = r.delegate; if (a) { var u = k(a, r); if (u) { if (u === A) continue; return u; } } if ("next" === r.method) r.sent = r._sent = r.arg;else if ("throw" === r.method) { if (n === l) throw n = d, r.arg; r.dispatchException(r.arg); } else "return" === r.method && r.abrupt("return", r.arg); n = p; var s = E(t, e, r); if ("normal" === s.type) { if (n = r.done ? d : h, s.arg === A) continue; return { value: s.arg, done: r.done }; } "throw" === s.type && (n = d, r.method = "throw", r.arg = s.arg); } }; }(t, r, a), o; } function E(t, e, r) { try { return { type: "normal", arg: t.call(e, r) }; } catch (t) { return { type: "throw", arg: t }; } } function x() {} function b() {} function B() {} function Q(t) { ["next", "throw", "return"].forEach(function (e) { t[e] = function (t) { return this._invoke(e, t); }; }); } function _(t) { var e; this._invoke = function (r, n) { function o() { return new Promise(function (e, o) { !function e(r, n, o, a) { var u = E(t[r], t, n); if ("throw" !== u.type) { var s = u.arg, c = s.value; return c && "object" == typeof c && i.call(c, "__await") ? Promise.resolve(c.__await).then(function (t) { e("next", t, o, a); }, function (t) { e("throw", t, o, a); }) : Promise.resolve(c).then(function (t) { s.value = t, o(s); }, a); } a(u.arg); }(r, n, e, o); }); } return e = e ? e.then(o, o) : o(); }; } function k(t, e) { var n = t.iterator[e.method]; if (n === r) { if (e.delegate = null, "throw" === e.method) { if (t.iterator.return && (e.method = "return", e.arg = r, k(t, e), "throw" === e.method)) return A; e.method = "throw", e.arg = new TypeError("The iterator does not provide a 'throw' method"); } return A; } var i = E(n, t.iterator, e.arg); if ("throw" === i.type) return e.method = "throw", e.arg = i.arg, e.delegate = null, A; var o = i.arg; return o ? o.done ? (e[t.resultName] = o.value, e.next = t.nextLoc, "return" !== e.method && (e.method = "next", e.arg = r), e.delegate = null, A) : o : (e.method = "throw", e.arg = new TypeError("iterator result is not an object"), e.delegate = null, A); } function L(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function P(t) { var e = t.completion || {}; e.type = "normal", delete e.arg, t.completion = e; } function O(t) { this.tryEntries = [{ tryLoc: "root" }], t.forEach(L, this), this.reset(!0); } function z(t) { if (t) { var e = t[a]; if (e) return e.call(t); if ("function" == typeof t.next) return t; if (!isNaN(t.length)) { var n = -1, o = function e() { for (; ++n < t.length;) if (i.call(t, n)) return e.value = t[n], e.done = !1, e; return e.value = r, e.done = !0, e; }; return o.next = o; } } return { next: j }; } function j() { return { value: r, done: !0 }; } }(function () { return this; }() || Function("return this")()); }, function (t, e, r) { var n = function () { return this; }() || Function("return this")(), i = n.regeneratorRuntime && Object.getOwnPropertyNames(n).indexOf("regeneratorRuntime") >= 0, o = i && n.regeneratorRuntime; if (n.regeneratorRuntime = void 0, t.exports = r(5), i) n.regeneratorRuntime = o;else try { delete n.regeneratorRuntime; } catch (t) { n.regeneratorRuntime = void 0; } }, function (t, e, r) { "use strict"; Object.defineProperty(e, "__esModule", { value: !0 }); var n = s(r(2)), i = function () { function t(t, e) { for (var r = 0; r < e.length; r++) { var n = e[r]; n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(t, n.key, n); } } return function (e, r, n) { return r && t(e.prototype, r), n && t(e, n), e; }; }(), o = function (t) { if (t && t.__esModule) return t; var e = {}; if (null != t) for (var r in t) Object.prototype.hasOwnProperty.call(t, r) && (e[r] = t[r]); return e.default = t, e; }(r(1)), a = r(0), u = s(r(4)); function s(t) { return t && t.__esModule ? t : { default: t }; } function c(t) { return function () { var e = t.apply(this, arguments); return new Promise(function (t, r) { return function n(i, o) { try { var a = e[i](o), u = a.value; } catch (t) { return void r(t); } if (!a.done) return Promise.resolve(u).then(function (t) { n("next", t); }, function (t) { n("throw", t); }); t(u); }("next"); }); }; } var f = function () { function t() { var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {}; !function (t, e) { if (!(t instanceof e)) throw new TypeError("Cannot call a class as a function"); }(this, t), this.setOptions(e); } return i(t, [{ key: "setOptions", value: function (t) { var e = { targetSize: 1 / 0, quality: .75, minQuality: .5, qualityStepSize: .1, maxWidth: 1920, maxHeight: 1920, resize: !0, throwIfSizeNotReached: !1, autoRotate: !0 }, r = new Proxy(t, { get: function (t, r) { return r in t ? t[r] : e[r]; } }); this.options = r; } }, { key: "_compressFile", value: function () { var t = c(n.default.mark(function t(e) { var r, i; return n.default.wrap(function (t) { for (;;) switch (t.prev = t.next) { case 0: return r = new u.default(e), (i = {}).start = window.performance.now(), i.quality = this.options.quality, i.startType = r.type, t.next = 7, r.load(); case 7: return t.next = 9, this._compressImage(r, i); case 9: return t.abrupt("return", t.sent); case 10: case "end": return t.stop(); } }, t, this); })); return function (e) { return t.apply(this, arguments); }; }() }, { key: "_compressImage", value: function () { var t = c(n.default.mark(function t(e, r) { var i, u, s, c, f; return n.default.wrap(function (t) { for (;;) switch (t.prev = t.next) { case 0: return r.startWidth = e.width, r.startHeight = e.height, i = void 0, u = void 0, this.options.resize ? (s = (0, a.resize)(e.width, e.height, this.options.maxWidth, this.options.maxHeight), i = s.width, u = s.height) : (i = e.width, u = e.height), r.endWidth = i, r.endHeight = u, c = this.doAutoRotation ? void 0 : 1, f = e.getCanvas(i, u, c), r.iterations = 0, r.startSizeMB = o.size(e.size).MB, t.next = 12, this._loopCompression(f, e, r); case 12: return r.endSizeMB = o.size(e.size).MB, r.sizeReducedInPercent = (r.startSizeMB - r.endSizeMB) / r.startSizeMB * 100, r.end = window.performance.now(), r.elapsedTimeInSeconds = (r.end - r.start) / 1e3, r.endType = e.type, t.abrupt("return", { photo: e, info: r }); case 18: case "end": return t.stop(); } }, t, this); })); return function (e, r) { return t.apply(this, arguments); }; }() }, { key: "_loopCompression", value: function () { var t = c(n.default.mark(function t(e, r, i) { var a; return n.default.wrap(function (t) { for (;;) switch (t.prev = t.next) { case 0: return i.iterations++, t.t0 = r, t.next = 4, o.canvasToBlob(e, i.quality); case 4: if (t.t1 = t.sent, t.t0.setData.call(t.t0, t.t1), 1 == i.iterations && (r.width = i.endWidth, r.height = i.endHeight), !(o.size(r.size).MB > this.options.targetSize)) { t.next = 24; break; } if (!(i.quality.toFixed(10) - .1 < this.options.minQuality)) { t.next = 18; break; } if (a = "Couldn't compress image to target size while maintaining quality.\n Target size: " + this.options.targetSize + "\n Actual size: " + o.size(r.size).MB, this.options.throwIfSizeNotReached) { t.next = 14; break; } console.error(a), t.next = 15; break; case 14: throw new Error(a); case 15: return t.abrupt("return"); case 18: return i.quality -= this.options.qualityStepSize, t.next = 21, this._loopCompression(e, r, i); case 21: return t.abrupt("return", t.sent); case 22: t.next = 25; break; case 24: return t.abrupt("return"); case 25: case "end": return t.stop(); } }, t, this); })); return function (e, r, n) { return t.apply(this, arguments); }; }() }, { key: "setAutoRotate", value: function () { var e = c(n.default.mark(function e() { var r; return n.default.wrap(function (e) { for (;;) switch (e.prev = e.next) { case 0: return e.next = 2, t.automaticRotationFeatureTest(); case 2: r = e.sent, this.doAutoRotation = this.options.autoRotate && !r; case 4: case "end": return e.stop(); } }, e, this); })); return function () { return e.apply(this, arguments); }; }() }, { key: "compress", value: function () { var t = c(n.default.mark(function t(e) { var r = this; return n.default.wrap(function (t) { for (;;) switch (t.prev = t.next) { case 0: return t.next = 2, this.setAutoRotate(); case 2: return t.abrupt("return", Promise.all(e.map(function (t) { return r._compressFile(t); }))); case 3: case "end": return t.stop(); } }, t, this); })); return function (e) { return t.apply(this, arguments); }; }() }], [{ key: "blobToBase64", value: function () { var t = c(n.default.mark(function t() { var e = arguments; return n.default.wrap(function (t) { for (;;) switch (t.prev = t.next) { case 0: return t.next = 2, o.blobToBase64.apply(o, e); case 2: return t.abrupt("return", t.sent); case 3: case "end": return t.stop(); } }, t, this); })); return function () { return t.apply(this, arguments); }; }() }, { key: "loadImageElement", value: function () { var t = c(n.default.mark(function t() { var e = arguments; return n.default.wrap(function (t) { for (;;) switch (t.prev = t.next) { case 0: return t.next = 2, a.loadImageElement.apply(void 0, e); case 2: return t.abrupt("return", t.sent); case 3: case "end": return t.stop(); } }, t, this); })); return function () { return t.apply(this, arguments); }; }() }, { key: "automaticRotationFeatureTest", value: function () { return new Promise(function (t) { var e = new Image(); e.onload = function () { var r = 1 === e.width && 2 === e.height; t(r); }, e.src = "data:image/jpeg;base64,/9j/4QAiRXhpZgAATU0AKgAAAAgAAQESAAMAAAABAAYAAAAAAAD/2wCEAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAf/AABEIAAEAAgMBEQACEQEDEQH/xABKAAEAAAAAAAAAAAAAAAAAAAALEAEAAAAAAAAAAAAAAAAAAAAAAQEAAAAAAAAAAAAAAAAAAAAAEQEAAAAAAAAAAAAAAAAAAAAA/9oADAMBAAIRAxEAPwA/8H//2Q=="; }); } }]), t; }(); e.default = f, t.exports = e.default; }]); }); /***/ }), /***/ 7705: /***/ ((module) => { "use strict"; /* MIT License http://www.opensource.org/licenses/mit-license.php Author Tobias Koppers @sokra */ module.exports = function (cssWithMappingToString) { var list = []; // return the list of modules as css string list.toString = function toString() { return this.map(function (item) { var content = ""; var needLayer = typeof item[5] !== "undefined"; if (item[4]) { content += "@supports (".concat(item[4], ") {"); } if (item[2]) { content += "@media ".concat(item[2], " {"); } if (needLayer) { content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {"); } content += cssWithMappingToString(item); if (needLayer) { content += "}"; } if (item[2]) { content += "}"; } if (item[4]) { content += "}"; } return content; }).join(""); }; // import a list of modules into the list list.i = function i(modules, media, dedupe, supports, layer) { if (typeof modules === "string") { modules = [[null, modules, undefined]]; } var alreadyImportedModules = {}; if (dedupe) { for (var k = 0; k < this.length; k++) { var id = this[k][0]; if (id != null) { alreadyImportedModules[id] = true; } } } for (var _k = 0; _k < modules.length; _k++) { var item = [].concat(modules[_k]); if (dedupe && alreadyImportedModules[item[0]]) { continue; } if (typeof layer !== "undefined") { if (typeof item[5] === "undefined") { item[5] = layer; } else { item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}"); item[5] = layer; } } if (media) { if (!item[2]) { item[2] = media; } else { item[1] = "@media ".concat(item[2], " {").concat(item[1], "}"); item[2] = media; } } if (supports) { if (!item[4]) { item[4] = "".concat(supports); } else { item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}"); item[4] = supports; } } list.push(item); } }; return list; }; /***/ }), /***/ 4216: /***/ ((module) => { "use strict"; module.exports = function (item) { var content = item[1]; var cssMapping = item[3]; if (!cssMapping) { return content; } if (typeof btoa === "function") { var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping)))); var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64); var sourceMapping = "/*# ".concat(data, " */"); var sourceURLs = cssMapping.sources.map(function (source) { return "/*# sourceURL=".concat(cssMapping.sourceRoot || "").concat(source, " */"); }); return [content].concat(sourceURLs).concat([sourceMapping]).join("\n"); } return [content].join("\n"); }; /***/ }), /***/ 7076: /***/ (function(module) { !function (t, e) { true ? module.exports = e() : 0; }(this, function () { "use strict"; var t = 1e3, e = 6e4, n = 36e5, r = "millisecond", i = "second", s = "minute", u = "hour", a = "day", o = "week", f = "month", h = "quarter", c = "year", d = "date", l = "Invalid Date", $ = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, y = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, M = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function (t) { var e = ["th", "st", "nd", "rd"], n = t % 100; return "[" + t + (e[(n - 20) % 10] || e[n] || e[0]) + "]"; } }, m = function (t, e, n) { var r = String(t); return !r || r.length >= e ? t : "" + Array(e + 1 - r.length).join(n) + t; }, v = { s: m, z: function (t) { var e = -t.utcOffset(), n = Math.abs(e), r = Math.floor(n / 60), i = n % 60; return (e <= 0 ? "+" : "-") + m(r, 2, "0") + ":" + m(i, 2, "0"); }, m: function t(e, n) { if (e.date() < n.date()) return -t(n, e); var r = 12 * (n.year() - e.year()) + (n.month() - e.month()), i = e.clone().add(r, f), s = n - i < 0, u = e.clone().add(r + (s ? -1 : 1), f); return +(-(r + (n - i) / (s ? i - u : u - i)) || 0); }, a: function (t) { return t < 0 ? Math.ceil(t) || 0 : Math.floor(t); }, p: function (t) { return { M: f, y: c, w: o, d: a, D: d, h: u, m: s, s: i, ms: r, Q: h }[t] || String(t || "").toLowerCase().replace(/s$/, ""); }, u: function (t) { return void 0 === t; } }, g = "en", D = {}; D[g] = M; var p = function (t) { return t instanceof _; }, S = function t(e, n, r) { var i; if (!e) return g; if ("string" == typeof e) { var s = e.toLowerCase(); D[s] && (i = s), n && (D[s] = n, i = s); var u = e.split("-"); if (!i && u.length > 1) return t(u[0]); } else { var a = e.name; D[a] = e, i = a; } return !r && i && (g = i), i || !r && g; }, w = function (t, e) { if (p(t)) return t.clone(); var n = "object" == typeof e ? e : {}; return n.date = t, n.args = arguments, new _(n); }, O = v; O.l = S, O.i = p, O.w = function (t, e) { return w(t, { locale: e.$L, utc: e.$u, x: e.$x, $offset: e.$offset }); }; var _ = function () { function M(t) { this.$L = S(t.locale, null, !0), this.parse(t); } var m = M.prototype; return m.parse = function (t) { this.$d = function (t) { var e = t.date, n = t.utc; if (null === e) return new Date(NaN); if (O.u(e)) return new Date(); if (e instanceof Date) return new Date(e); if ("string" == typeof e && !/Z$/i.test(e)) { var r = e.match($); if (r) { var i = r[2] - 1 || 0, s = (r[7] || "0").substring(0, 3); return n ? new Date(Date.UTC(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s)) : new Date(r[1], i, r[3] || 1, r[4] || 0, r[5] || 0, r[6] || 0, s); } } return new Date(e); }(t), this.$x = t.x || {}, this.init(); }, m.init = function () { var t = this.$d; this.$y = t.getFullYear(), this.$M = t.getMonth(), this.$D = t.getDate(), this.$W = t.getDay(), this.$H = t.getHours(), this.$m = t.getMinutes(), this.$s = t.getSeconds(), this.$ms = t.getMilliseconds(); }, m.$utils = function () { return O; }, m.isValid = function () { return !(this.$d.toString() === l); }, m.isSame = function (t, e) { var n = w(t); return this.startOf(e) <= n && n <= this.endOf(e); }, m.isAfter = function (t, e) { return w(t) < this.startOf(e); }, m.isBefore = function (t, e) { return this.endOf(e) < w(t); }, m.$g = function (t, e, n) { return O.u(t) ? this[e] : this.set(n, t); }, m.unix = function () { return Math.floor(this.valueOf() / 1e3); }, m.valueOf = function () { return this.$d.getTime(); }, m.startOf = function (t, e) { var n = this, r = !!O.u(e) || e, h = O.p(t), l = function (t, e) { var i = O.w(n.$u ? Date.UTC(n.$y, e, t) : new Date(n.$y, e, t), n); return r ? i : i.endOf(a); }, $ = function (t, e) { return O.w(n.toDate()[t].apply(n.toDate("s"), (r ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(e)), n); }, y = this.$W, M = this.$M, m = this.$D, v = "set" + (this.$u ? "UTC" : ""); switch (h) { case c: return r ? l(1, 0) : l(31, 11); case f: return r ? l(1, M) : l(0, M + 1); case o: var g = this.$locale().weekStart || 0, D = (y < g ? y + 7 : y) - g; return l(r ? m - D : m + (6 - D), M); case a: case d: return $(v + "Hours", 0); case u: return $(v + "Minutes", 1); case s: return $(v + "Seconds", 2); case i: return $(v + "Milliseconds", 3); default: return this.clone(); } }, m.endOf = function (t) { return this.startOf(t, !1); }, m.$set = function (t, e) { var n, o = O.p(t), h = "set" + (this.$u ? "UTC" : ""), l = (n = {}, n[a] = h + "Date", n[d] = h + "Date", n[f] = h + "Month", n[c] = h + "FullYear", n[u] = h + "Hours", n[s] = h + "Minutes", n[i] = h + "Seconds", n[r] = h + "Milliseconds", n)[o], $ = o === a ? this.$D + (e - this.$W) : e; if (o === f || o === c) { var y = this.clone().set(d, 1); y.$d[l]($), y.init(), this.$d = y.set(d, Math.min(this.$D, y.daysInMonth())).$d; } else l && this.$d[l]($); return this.init(), this; }, m.set = function (t, e) { return this.clone().$set(t, e); }, m.get = function (t) { return this[O.p(t)](); }, m.add = function (r, h) { var d, l = this; r = Number(r); var $ = O.p(h), y = function (t) { var e = w(l); return O.w(e.date(e.date() + Math.round(t * r)), l); }; if ($ === f) return this.set(f, this.$M + r); if ($ === c) return this.set(c, this.$y + r); if ($ === a) return y(1); if ($ === o) return y(7); var M = (d = {}, d[s] = e, d[u] = n, d[i] = t, d)[$] || 1, m = this.$d.getTime() + r * M; return O.w(m, this); }, m.subtract = function (t, e) { return this.add(-1 * t, e); }, m.format = function (t) { var e = this, n = this.$locale(); if (!this.isValid()) return n.invalidDate || l; var r = t || "YYYY-MM-DDTHH:mm:ssZ", i = O.z(this), s = this.$H, u = this.$m, a = this.$M, o = n.weekdays, f = n.months, h = function (t, n, i, s) { return t && (t[n] || t(e, r)) || i[n].slice(0, s); }, c = function (t) { return O.s(s % 12 || 12, t, "0"); }, d = n.meridiem || function (t, e, n) { var r = t < 12 ? "AM" : "PM"; return n ? r.toLowerCase() : r; }, $ = { YY: String(this.$y).slice(-2), YYYY: this.$y, M: a + 1, MM: O.s(a + 1, 2, "0"), MMM: h(n.monthsShort, a, f, 3), MMMM: h(f, a), D: this.$D, DD: O.s(this.$D, 2, "0"), d: String(this.$W), dd: h(n.weekdaysMin, this.$W, o, 2), ddd: h(n.weekdaysShort, this.$W, o, 3), dddd: o[this.$W], H: String(s), HH: O.s(s, 2, "0"), h: c(1), hh: c(2), a: d(s, u, !0), A: d(s, u, !1), m: String(u), mm: O.s(u, 2, "0"), s: String(this.$s), ss: O.s(this.$s, 2, "0"), SSS: O.s(this.$ms, 3, "0"), Z: i }; return r.replace(y, function (t, e) { return e || $[t] || i.replace(":", ""); }); }, m.utcOffset = function () { return 15 * -Math.round(this.$d.getTimezoneOffset() / 15); }, m.diff = function (r, d, l) { var $, y = O.p(d), M = w(r), m = (M.utcOffset() - this.utcOffset()) * e, v = this - M, g = O.m(this, M); return g = ($ = {}, $[c] = g / 12, $[f] = g, $[h] = g / 3, $[o] = (v - m) / 6048e5, $[a] = (v - m) / 864e5, $[u] = v / n, $[s] = v / e, $[i] = v / t, $)[y] || v, l ? g : O.a(g); }, m.daysInMonth = function () { return this.endOf(f).$D; }, m.$locale = function () { return D[this.$L]; }, m.locale = function (t, e) { if (!t) return this.$L; var n = this.clone(), r = S(t, e, !0); return r && (n.$L = r), n; }, m.clone = function () { return O.w(this.$d, this); }, m.toDate = function () { return new Date(this.valueOf()); }, m.toJSON = function () { return this.isValid() ? this.toISOString() : null; }, m.toISOString = function () { return this.$d.toISOString(); }, m.toString = function () { return this.$d.toUTCString(); }, M; }(), T = _.prototype; return w.prototype = T, [["$ms", r], ["$s", i], ["$m", s], ["$H", u], ["$W", a], ["$M", f], ["$y", c], ["$D", d]].forEach(function (t) { T[t[1]] = function (e) { return this.$g(e, t[0], t[1]); }; }), w.extend = function (t, e) { return t.$i || (t(e, _, w), t.$i = !0), w; }, w.locale = S, w.isDayjs = p, w.unix = function (t) { return w(1e3 * t); }, w.en = D[g], w.Ls = D, w.p = {}, w; }); /***/ }), /***/ 2455: /***/ (function(module) { !function (e, t) { true ? module.exports = t() : 0; }(this, function () { "use strict"; return function (e, t) { var r = t.prototype, n = r.format; r.format = function (e) { var t = this, r = this.$locale(); if (!this.isValid()) return n.bind(this)(e); var s = this.$utils(), a = (e || "YYYY-MM-DDTHH:mm:ssZ").replace(/\[([^\]]+)]|Q|wo|ww|w|WW|W|zzz|z|gggg|GGGG|Do|X|x|k{1,2}|S/g, function (e) { switch (e) { case "Q": return Math.ceil((t.$M + 1) / 3); case "Do": return r.ordinal(t.$D); case "gggg": return t.weekYear(); case "GGGG": return t.isoWeekYear(); case "wo": return r.ordinal(t.week(), "W"); case "w": case "ww": return s.s(t.week(), "w" === e ? 1 : 2, "0"); case "W": case "WW": return s.s(t.isoWeek(), "W" === e ? 1 : 2, "0"); case "k": case "kk": return s.s(String(0 === t.$H ? 24 : t.$H), "k" === e ? 1 : 2, "0"); case "X": return Math.floor(t.$d.getTime() / 1e3); case "x": return t.$d.getTime(); case "z": return "[" + t.offsetName() + "]"; case "zzz": return "[" + t.offsetName("long") + "]"; default: return e; } }); return n.bind(this)(a); }; }; }); /***/ }), /***/ 1199: /***/ (function(module) { /*! @license DOMPurify 2.4.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.0/LICENSE */ (function (global, factory) { true ? module.exports = factory() : 0; })(this, function () { 'use strict'; function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var hasOwnProperty = Object.hasOwnProperty, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var freeze = Object.freeze, seal = Object.seal, create = Object.create; // eslint-disable-line import/no-mutable-exports var _ref = typeof Reflect !== 'undefined' && Reflect, apply = _ref.apply, construct = _ref.construct; if (!apply) { apply = function apply(fun, thisValue, args) { return fun.apply(thisValue, args); }; } if (!freeze) { freeze = function freeze(x) { return x; }; } if (!seal) { seal = function seal(x) { return x; }; } if (!construct) { construct = function construct(Func, args) { return _construct(Func, _toConsumableArray(args)); }; } var arrayForEach = unapply(Array.prototype.forEach); var arrayPop = unapply(Array.prototype.pop); var arrayPush = unapply(Array.prototype.push); var stringToLowerCase = unapply(String.prototype.toLowerCase); var stringMatch = unapply(String.prototype.match); var stringReplace = unapply(String.prototype.replace); var stringIndexOf = unapply(String.prototype.indexOf); var stringTrim = unapply(String.prototype.trim); var regExpTest = unapply(RegExp.prototype.test); var typeErrorCreate = unconstruct(TypeError); function unapply(func) { return function (thisArg) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return apply(func, thisArg, args); }; } function unconstruct(func) { return function () { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } return construct(func, args); }; } /* Add properties to a lookup table */ function addToSet(set, array, transformCaseFunc) { transformCaseFunc = transformCaseFunc ? transformCaseFunc : stringToLowerCase; if (setPrototypeOf) { // Make 'in' and truthy checks like Boolean(set.constructor) // independent of any properties defined on Object.prototype. // Prevent prototype setters from intercepting set as a this value. setPrototypeOf(set, null); } var l = array.length; while (l--) { var element = array[l]; if (typeof element === 'string') { var lcElement = transformCaseFunc(element); if (lcElement !== element) { // Config presets (e.g. tags.js, attrs.js) are immutable. if (!isFrozen(array)) { array[l] = lcElement; } element = lcElement; } } set[element] = true; } return set; } /* Shallow clone an object */ function clone(object) { var newObject = create(null); var property; for (property in object) { if (apply(hasOwnProperty, object, [property])) { newObject[property] = object[property]; } } return newObject; } /* IE10 doesn't support __lookupGetter__ so lets' * simulate it. It also automatically checks * if the prop is function or getter and behaves * accordingly. */ function lookupGetter(object, prop) { while (object !== null) { var desc = getOwnPropertyDescriptor(object, prop); if (desc) { if (desc.get) { return unapply(desc.get); } if (typeof desc.value === 'function') { return unapply(desc.value); } } object = getPrototypeOf(object); } function fallbackValue(element) { console.warn('fallback value for', element); return null; } return fallbackValue; } var html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG var svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']); var svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default. // We still need to know them so that we can do namespace // checks properly in case one wants to add them to // allow-list. var svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'fedropshadow', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']); var mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover']); // Similarly to SVG, we want to know all MathML elements, // even those that we disallow by default. var mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']); var text = freeze(['#text']); var html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']); var svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']); var mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']); var xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']); var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm); var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape var ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape var IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape ); var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); var ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex ); var DOCTYPE_NAME = seal(/^html$/i); var getGlobal = function getGlobal() { return typeof window === 'undefined' ? null : window; }; /** * Creates a no-op policy for internal use only. * Don't export this function outside this module! * @param {?TrustedTypePolicyFactory} trustedTypes The policy factory. * @param {Document} document The document object (to determine policy name suffix) * @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types * are not supported). */ var _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) { if (_typeof(trustedTypes) !== 'object' || typeof trustedTypes.createPolicy !== 'function') { return null; } // Allow the callers to control the unique policy name // by adding a data-tt-policy-suffix to the script element with the DOMPurify. // Policy creation with duplicate names throws in Trusted Types. var suffix = null; var ATTR_NAME = 'data-tt-policy-suffix'; if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) { suffix = document.currentScript.getAttribute(ATTR_NAME); } var policyName = 'dompurify' + (suffix ? '#' + suffix : ''); try { return trustedTypes.createPolicy(policyName, { createHTML: function createHTML(html) { return html; }, createScriptURL: function createScriptURL(scriptUrl) { return scriptUrl; } }); } catch (_) { // Policy creation failed (most likely another DOMPurify script has // already run). Skip creating the policy, as this will only cause errors // if TT are enforced. console.warn('TrustedTypes policy ' + policyName + ' could not be created.'); return null; } }; function createDOMPurify() { var window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal(); var DOMPurify = function DOMPurify(root) { return createDOMPurify(root); }; /** * Version label, exposed for easier checks * if DOMPurify is up to date or not */ DOMPurify.version = '2.4.0'; /** * Array of elements that DOMPurify removed during sanitation. * Empty if nothing was removed. */ DOMPurify.removed = []; if (!window || !window.document || window.document.nodeType !== 9) { // Not running in a browser, provide a factory function // so that you can pass your own Window DOMPurify.isSupported = false; return DOMPurify; } var originalDocument = window.document; var document = window.document; var DocumentFragment = window.DocumentFragment, HTMLTemplateElement = window.HTMLTemplateElement, Node = window.Node, Element = window.Element, NodeFilter = window.NodeFilter, _window$NamedNodeMap = window.NamedNodeMap, NamedNodeMap = _window$NamedNodeMap === void 0 ? window.NamedNodeMap || window.MozNamedAttrMap : _window$NamedNodeMap, HTMLFormElement = window.HTMLFormElement, DOMParser = window.DOMParser, trustedTypes = window.trustedTypes; var ElementPrototype = Element.prototype; var cloneNode = lookupGetter(ElementPrototype, 'cloneNode'); var getNextSibling = lookupGetter(ElementPrototype, 'nextSibling'); var getChildNodes = lookupGetter(ElementPrototype, 'childNodes'); var getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a // new document created via createHTMLDocument. As per the spec // (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries) // a new empty registry is used when creating a template contents owner // document, so we use that as our parent document to ensure nothing // is inherited. if (typeof HTMLTemplateElement === 'function') { var template = document.createElement('template'); if (template.content && template.content.ownerDocument) { document = template.content.ownerDocument; } } var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument); var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : ''; var _document = document, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName; var importNode = originalDocument.importNode; var documentMode = {}; try { documentMode = clone(document).documentMode ? document.documentMode : {}; } catch (_) {} var hooks = {}; /** * Expose whether this browser supports running the full DOMPurify. */ DOMPurify.isSupported = typeof getParentNode === 'function' && implementation && typeof implementation.createHTMLDocument !== 'undefined' && documentMode !== 9; var MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE; var IS_ALLOWED_URI$1 = IS_ALLOWED_URI; /** * We consider the elements and attributes below to be safe. Ideally * don't add any new ones but feel free to remove unwanted ones. */ /* allowed element names */ var ALLOWED_TAGS = null; var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(svgFilters), _toConsumableArray(mathMl$1), _toConsumableArray(text))); /* Allowed attribute names */ var ALLOWED_ATTR = null; var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml))); /* * Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements. * @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements) * @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list) * @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`. */ var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, { tagNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, attributeNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, allowCustomizedBuiltInElements: { writable: true, configurable: false, enumerable: true, value: false } })); /* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */ var FORBID_TAGS = null; /* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */ var FORBID_ATTR = null; /* Decide if ARIA attributes are okay */ var ALLOW_ARIA_ATTR = true; /* Decide if custom data attributes are okay */ var ALLOW_DATA_ATTR = true; /* Decide if unknown protocols are okay */ var ALLOW_UNKNOWN_PROTOCOLS = false; /* Output should be safe for common template engines. * This means, DOMPurify removes data attributes, mustaches and ERB */ var SAFE_FOR_TEMPLATES = false; /* Decide if document with ... should be returned */ var WHOLE_DOCUMENT = false; /* Track whether config is already set on this instance of DOMPurify. */ var SET_CONFIG = false; /* Decide if all elements (e.g. style, script) must be children of * document.body. By default, browsers might move them to document.head */ var FORCE_BODY = false; /* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html * string (or a TrustedHTML object if Trusted Types are supported). * If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead */ var RETURN_DOM = false; /* Decide if a DOM `DocumentFragment` should be returned, instead of a html * string (or a TrustedHTML object if Trusted Types are supported) */ var RETURN_DOM_FRAGMENT = false; /* Try to return a Trusted Type object instead of a string, return a string in * case Trusted Types are not supported */ var RETURN_TRUSTED_TYPE = false; /* Output should be free from DOM clobbering attacks? * This sanitizes markups named with colliding, clobberable built-in DOM APIs. */ var SANITIZE_DOM = true; /* Achieve full DOM Clobbering protection by isolating the namespace of named * properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules. * * HTML/DOM spec rules that enable DOM Clobbering: * - Named Access on Window (§7.3.3) * - DOM Tree Accessors (§3.1.5) * - Form Element Parent-Child Relations (§4.10.3) * - Iframe srcdoc / Nested WindowProxies (§4.8.5) * - HTMLCollection (§4.2.10.2) * * Namespace isolation is implemented by prefixing `id` and `name` attributes * with a constant string, i.e., `user-content-` */ var SANITIZE_NAMED_PROPS = false; var SANITIZE_NAMED_PROPS_PREFIX = 'user-content-'; /* Keep element content when removing element? */ var KEEP_CONTENT = true; /* If a `Node` is passed to sanitize(), then performs sanitization in-place instead * of importing it into a new Document and returning a sanitized copy */ var IN_PLACE = false; /* Allow usage of profiles like html, svg and mathMl */ var USE_PROFILES = {}; /* Tags to ignore content of when KEEP_CONTENT is true */ var FORBID_CONTENTS = null; var DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']); /* Tags that are safe for data: URIs */ var DATA_URI_TAGS = null; var DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']); /* Attributes safe for values like "javascript:" */ var URI_SAFE_ATTRIBUTES = null; var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']); var MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML'; var SVG_NAMESPACE = 'http://www.w3.org/2000/svg'; var HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml'; /* Document namespace */ var NAMESPACE = HTML_NAMESPACE; var IS_EMPTY_INPUT = false; /* Parsing of strict XHTML documents */ var PARSER_MEDIA_TYPE; var SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html']; var DEFAULT_PARSER_MEDIA_TYPE = 'text/html'; var transformCaseFunc; /* Keep a reference to config to pass to hooks */ var CONFIG = null; /* Ideally, do not touch anything below this line */ /* ______________________________________________ */ var formElement = document.createElement('form'); var isRegexOrFunction = function isRegexOrFunction(testValue) { return testValue instanceof RegExp || testValue instanceof Function; }; /** * _parseConfig * * @param {Object} cfg optional config literal */ // eslint-disable-next-line complexity var _parseConfig = function _parseConfig(cfg) { if (CONFIG && CONFIG === cfg) { return; } /* Shield configuration object from tampering */ if (!cfg || _typeof(cfg) !== 'object') { cfg = {}; } /* Shield configuration object from prototype pollution */ cfg = clone(cfg); PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is. transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? function (x) { return x; } : stringToLowerCase; /* Set configuration parameters */ ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS; ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR; URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent transformCaseFunc // eslint-disable-line indent ) // eslint-disable-line indent : DEFAULT_URI_SAFE_ATTRIBUTES; DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent transformCaseFunc // eslint-disable-line indent ) // eslint-disable-line indent : DEFAULT_DATA_URI_TAGS; FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS; FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {}; FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {}; USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false; ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false RETURN_DOM = cfg.RETURN_DOM || false; // Default false RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false FORCE_BODY = cfg.FORCE_BODY || false; // Default false SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true IN_PLACE = cfg.IN_PLACE || false; // Default false IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$1; NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE; if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) { CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck; } if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) { CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck; } if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') { CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements; } if (SAFE_FOR_TEMPLATES) { ALLOW_DATA_ATTR = false; } if (RETURN_DOM_FRAGMENT) { RETURN_DOM = true; } /* Parse profile info */ if (USE_PROFILES) { ALLOWED_TAGS = addToSet({}, _toConsumableArray(text)); ALLOWED_ATTR = []; if (USE_PROFILES.html === true) { addToSet(ALLOWED_TAGS, html$1); addToSet(ALLOWED_ATTR, html); } if (USE_PROFILES.svg === true) { addToSet(ALLOWED_TAGS, svg$1); addToSet(ALLOWED_ATTR, svg); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.svgFilters === true) { addToSet(ALLOWED_TAGS, svgFilters); addToSet(ALLOWED_ATTR, svg); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.mathMl === true) { addToSet(ALLOWED_TAGS, mathMl$1); addToSet(ALLOWED_ATTR, mathMl); addToSet(ALLOWED_ATTR, xml); } } /* Merge configuration parameters */ if (cfg.ADD_TAGS) { if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { ALLOWED_TAGS = clone(ALLOWED_TAGS); } addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc); } if (cfg.ADD_ATTR) { if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { ALLOWED_ATTR = clone(ALLOWED_ATTR); } addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc); } if (cfg.ADD_URI_SAFE_ATTR) { addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc); } if (cfg.FORBID_CONTENTS) { if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) { FORBID_CONTENTS = clone(FORBID_CONTENTS); } addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc); } /* Add #text in case KEEP_CONTENT is set to true */ if (KEEP_CONTENT) { ALLOWED_TAGS['#text'] = true; } /* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */ if (WHOLE_DOCUMENT) { addToSet(ALLOWED_TAGS, ['html', 'head', 'body']); } /* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */ if (ALLOWED_TAGS.table) { addToSet(ALLOWED_TAGS, ['tbody']); delete FORBID_TAGS.tbody; } // Prevent further manipulation of configuration. // Not available in IE8, Safari 5, etc. if (freeze) { freeze(cfg); } CONFIG = cfg; }; var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']); var HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML // namespace. We need to specify them explicitly // so that they don't get erroneously deleted from // HTML namespace. var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']); /* Keep track of all possible SVG and MathML tags * so that we can perform the namespace checks * correctly. */ var ALL_SVG_TAGS = addToSet({}, svg$1); addToSet(ALL_SVG_TAGS, svgFilters); addToSet(ALL_SVG_TAGS, svgDisallowed); var ALL_MATHML_TAGS = addToSet({}, mathMl$1); addToSet(ALL_MATHML_TAGS, mathMlDisallowed); /** * * * @param {Element} element a DOM element whose namespace is being checked * @returns {boolean} Return false if the element has a * namespace that a spec-compliant parser would never * return. Return true otherwise. */ var _checkValidNamespace = function _checkValidNamespace(element) { var parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode // can be null. We just simulate parent in this case. if (!parent || !parent.tagName) { parent = { namespaceURI: HTML_NAMESPACE, tagName: 'template' }; } var tagName = stringToLowerCase(element.tagName); var parentTagName = stringToLowerCase(parent.tagName); if (element.namespaceURI === SVG_NAMESPACE) { // The only way to switch from HTML namespace to SVG // is via . If it happens via any other tag, then // it should be killed. if (parent.namespaceURI === HTML_NAMESPACE) { return tagName === 'svg'; } // The only way to switch from MathML to SVG is via // svg if parent is either or MathML // text integration points. if (parent.namespaceURI === MATHML_NAMESPACE) { return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]); } // We only allow elements that are defined in SVG // spec. All others are disallowed in SVG namespace. return Boolean(ALL_SVG_TAGS[tagName]); } if (element.namespaceURI === MATHML_NAMESPACE) { // The only way to switch from HTML namespace to MathML // is via . If it happens via any other tag, then // it should be killed. if (parent.namespaceURI === HTML_NAMESPACE) { return tagName === 'math'; } // The only way to switch from SVG to MathML is via // and HTML integration points if (parent.namespaceURI === SVG_NAMESPACE) { return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName]; } // We only allow elements that are defined in MathML // spec. All others are disallowed in MathML namespace. return Boolean(ALL_MATHML_TAGS[tagName]); } if (element.namespaceURI === HTML_NAMESPACE) { // The only way to switch from SVG to HTML is via // HTML integration points, and from MathML to HTML // is via MathML text integration points if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) { return false; } if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) { return false; } // We disallow tags that are specific for MathML // or SVG and should never appear in HTML namespace return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]); } // The code should never reach this place (this means // that the element somehow got namespace that is not // HTML, SVG or MathML). Return false just in case. return false; }; /** * _forceRemove * * @param {Node} node a DOM node */ var _forceRemove = function _forceRemove(node) { arrayPush(DOMPurify.removed, { element: node }); try { // eslint-disable-next-line unicorn/prefer-dom-node-remove node.parentNode.removeChild(node); } catch (_) { try { node.outerHTML = emptyHTML; } catch (_) { node.remove(); } } }; /** * _removeAttribute * * @param {String} name an Attribute name * @param {Node} node a DOM node */ var _removeAttribute = function _removeAttribute(name, node) { try { arrayPush(DOMPurify.removed, { attribute: node.getAttributeNode(name), from: node }); } catch (_) { arrayPush(DOMPurify.removed, { attribute: null, from: node }); } node.removeAttribute(name); // We void attribute values for unremovable "is"" attributes if (name === 'is' && !ALLOWED_ATTR[name]) { if (RETURN_DOM || RETURN_DOM_FRAGMENT) { try { _forceRemove(node); } catch (_) {} } else { try { node.setAttribute(name, ''); } catch (_) {} } } }; /** * _initDocument * * @param {String} dirty a string of dirty markup * @return {Document} a DOM, filled with the dirty markup */ var _initDocument = function _initDocument(dirty) { /* Create a HTML document */ var doc; var leadingWhitespace; if (FORCE_BODY) { dirty = '' + dirty; } else { /* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */ var matches = stringMatch(dirty, /^[\r\n\t ]+/); leadingWhitespace = matches && matches[0]; } if (PARSER_MEDIA_TYPE === 'application/xhtml+xml') { // Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict) dirty = '' + dirty + ''; } var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; /* * Use the DOMParser API by default, fallback later if needs be * DOMParser not work for svg when has multiple root element. */ if (NAMESPACE === HTML_NAMESPACE) { try { doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE); } catch (_) {} } /* Use createHTMLDocument in case DOMParser is not available */ if (!doc || !doc.documentElement) { doc = implementation.createDocument(NAMESPACE, 'template', null); try { doc.documentElement.innerHTML = IS_EMPTY_INPUT ? '' : dirtyPayload; } catch (_) {// Syntax error if dirtyPayload is invalid xml } } var body = doc.body || doc.documentElement; if (dirty && leadingWhitespace) { body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null); } /* Work on whole document or just its body */ if (NAMESPACE === HTML_NAMESPACE) { return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0]; } return WHOLE_DOCUMENT ? doc.documentElement : body; }; /** * _createIterator * * @param {Document} root document/fragment to create iterator for * @return {Iterator} iterator instance */ var _createIterator = function _createIterator(root) { return createNodeIterator.call(root.ownerDocument || root, root, // eslint-disable-next-line no-bitwise NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false); }; /** * _isClobbered * * @param {Node} elm element to check for clobbering attacks * @return {Boolean} true if clobbered, false if safe */ var _isClobbered = function _isClobbered(elm) { return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function'); }; /** * _isNode * * @param {Node} obj object to check whether it's a DOM node * @return {Boolean} true is object is a DOM node */ var _isNode = function _isNode(object) { return _typeof(Node) === 'object' ? object instanceof Node : object && _typeof(object) === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string'; }; /** * _executeHook * Execute user configurable hooks * * @param {String} entryPoint Name of the hook's entry point * @param {Node} currentNode node to work on with the hook * @param {Object} data additional hook parameters */ var _executeHook = function _executeHook(entryPoint, currentNode, data) { if (!hooks[entryPoint]) { return; } arrayForEach(hooks[entryPoint], function (hook) { hook.call(DOMPurify, currentNode, data, CONFIG); }); }; /** * _sanitizeElements * * @protect nodeName * @protect textContent * @protect removeChild * * @param {Node} currentNode to check for permission to exist * @return {Boolean} true if node was killed, false if left alive */ var _sanitizeElements = function _sanitizeElements(currentNode) { var content; /* Execute a hook if present */ _executeHook('beforeSanitizeElements', currentNode, null); /* Check if element is clobbered or can clobber */ if (_isClobbered(currentNode)) { _forceRemove(currentNode); return true; } /* Check if tagname contains Unicode */ if (regExpTest(/[\u0080-\uFFFF]/, currentNode.nodeName)) { _forceRemove(currentNode); return true; } /* Now let's check the element's type and name */ var tagName = transformCaseFunc(currentNode.nodeName); /* Execute a hook if present */ _executeHook('uponSanitizeElement', currentNode, { tagName: tagName, allowedTags: ALLOWED_TAGS }); /* Detect mXSS attempts abusing namespace confusion */ if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) { _forceRemove(currentNode); return true; } /* Mitigate a problem with templates inside select */ if (tagName === 'select' && regExpTest(/