1(function webpackUniversalModuleDefinition(root, factory) { 2 if(typeof exports === 'object' && typeof module === 'object') 3 module.exports = factory(); 4 else if(typeof define === 'function' && define.amd) 5 define([], factory); 6 else { 7 var a = factory(); 8 for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i]; 9 } 10})(self, function() { 11return /******/ (function() { // webpackBootstrap 12/******/ "use strict"; 13/******/ // The require scope 14/******/ var __webpack_require__ = {}; 15/******/ 16/************************************************************************/ 17/******/ /* webpack/runtime/define property getters */ 18/******/ !function() { 19/******/ // define getter functions for harmony exports 20/******/ __webpack_require__.d = function(exports, definition) { 21/******/ for(var key in definition) { 22/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 23/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 24/******/ } 25/******/ } 26/******/ }; 27/******/ }(); 28/******/ 29/******/ /* webpack/runtime/hasOwnProperty shorthand */ 30/******/ !function() { 31/******/ __webpack_require__.o = function(obj, prop) { return Object.prototype.hasOwnProperty.call(obj, prop); } 32/******/ }(); 33/******/ 34/******/ /* webpack/runtime/make namespace object */ 35/******/ !function() { 36/******/ // define __esModule on exports 37/******/ __webpack_require__.r = function(exports) { 38/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 39/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 40/******/ } 41/******/ Object.defineProperty(exports, '__esModule', { value: true }); 42/******/ }; 43/******/ }(); 44/******/ 45/************************************************************************/ 46var __webpack_exports__ = {}; 47/*!***********************************************!*\ 48 !*** ./resources/assets/vendor/js/helpers.js ***! 49 \***********************************************/ 50__webpack_require__.r(__webpack_exports__); 51/* harmony export */ __webpack_require__.d(__webpack_exports__, { 52/* harmony export */ Helpers: function() { return /* binding */ Helpers; } 53/* harmony export */ }); 54function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); } 55function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } 56function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } 57function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } 58function _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); } 59function _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; } 60function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } } 61function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } 62// Constants 63var TRANS_EVENTS = ['transitionend', 'webkitTransitionEnd', 'oTransitionEnd']; 64var TRANS_PROPERTIES = ['transition', 'MozTransition', 'webkitTransition', 'WebkitTransition', 'OTransition']; 65var INLINE_STYLES = "\n.layout-menu-fixed .layout-navbar-full .layout-menu,\n.layout-menu-fixed-offcanvas .layout-navbar-full .layout-menu {\n top: {navbarHeight}px !important;\n}\n.layout-page {\n padding-top: {navbarHeight}px !important;\n}\n.content-wrapper {\n padding-bottom: {footerHeight}px !important;\n}"; 66 67// Guard 68function requiredParam(name) { 69 throw new Error("Parameter required".concat(name ? ": `".concat(name, "`") : '')); 70} 71var Helpers = { 72 // Root Element 73 ROOT_EL: typeof window !== 'undefined' ? document.documentElement : null, 74 // Large screens breakpoint 75 LAYOUT_BREAKPOINT: 1200, 76 // Resize delay in milliseconds 77 RESIZE_DELAY: 200, 78 menuPsScroll: null, 79 mainMenu: null, 80 // Internal variables 81 _curStyle: null, 82 _styleEl: null, 83 _resizeTimeout: null, 84 _resizeCallback: null, 85 _transitionCallback: null, 86 _transitionCallbackTimeout: null, 87 _listeners: [], 88 _initialized: false, 89 _autoUpdate: false, 90 _lastWindowHeight: 0,
91 // ******************************************************************************* 92 // * Utilities 93 // --- 94 // Scroll To Active Menu Item 95 _scrollToActive: function _scrollToActive() { 96 var animate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; 97 var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500; 98 var layoutMenu = this.getLayoutMenu(); 99 if (!layoutMenu) return; 100 var activeEl = layoutMenu.querySelector('li.menu-item.active:not(.open)'); 101 if (activeEl) { 102 // t = current time 103 // b = start value 104 // c = change in value 105 // d = duration 106 var easeInOutQuad = function easeInOutQuad(t, b, c, d) { 107 t /= d / 2; 108 if (t < 1) return c / 2 * t * t + b; 109 t -= 1; 110 return -c / 2 * (t * (t - 2) - 1) + b; 111 }; 112 var element = this.getLayoutMenu().querySelector('.menu-inner'); 113 if (typeof activeEl === 'string') { 114 activeEl = document.querySelector(activeEl); 115 } 116 if (typeof activeEl !== 'number') { 117 activeEl = activeEl.getBoundingClientRect().top + element.scrollTop; 118 } 119 120 // If active element's top position is less than 2/3 (66%) of menu height than do not scroll 121 if (activeEl < parseInt(element.clientHeight * 2 / 3, 10)) return; 122 var start = element.scrollTop; 123 var change = activeEl - start - parseInt(element.clientHeight / 2, 10); 124 var startDate = +new Date(); 125 if (animate === true) { 126 var animateScroll = function animateScroll() { 127 var currentDate = +new Date(); 128 var currentTime = currentDate - startDate; 129 var val = easeInOutQuad(currentTime, start, change, duration); 130 element.scrollTop = val; 131 if (currentTime < duration) { 132 requestAnimationFrame(animateScroll); 133 } else { 134 element.scrollTop = change; 135 } 136 }; 137 animateScroll(); 138 } else { 139 element.scrollTop = change; 140 } 141 } 142 }, 143 // --- 144 // Swipe In Gesture 145 _swipeIn: function _swipeIn(targetEl, callback) { 146 var _window = window, 147 Hammer = _window.Hammer; 148 if (typeof Hammer !== 'undefined' && typeof targetEl === 'string') { 149 // Swipe menu gesture 150 var swipeInElement = document.querySelector(targetEl); 151 if (swipeInElement) { 152 var hammerInstance = new Hammer(swipeInElement); 153 hammerInstance.on('panright', callback); 154 } 155 } 156 }, 157 // --- 158 // Swipe Out Gesture 159 _swipeOut: function _swipeOut(targetEl, callback) { 160 var _window2 = window, 161 Hammer = _window2.Hammer; 162 if (typeof Hammer !== 'undefined' && typeof targetEl === 'string') { 163 setTimeout(function () { 164 // Swipe menu gesture 165 var swipeOutElement = document.querySelector(targetEl); 166 if (swipeOutElement) { 167 var hammerInstance = new Hammer(swipeOutElement); 168 hammerInstance.get('pan').set({ 169 direction: Hammer.DIRECTION_ALL, 170 threshold: 250 171 }); 172 hammerInstance.on('panleft', callback); 173 } 174 }, 500); 175 } 176 }, 177 // --- 178 // Swipe Out On Overlay Tap 179 _overlayTap: function _overlayTap(targetEl, callback) { 180 var _window3 = window, 181 Hammer = _window3.Hammer; 182 if (typeof Hammer !== 'undefined' && typeof targetEl === 'string') { 183 // Swipe out overlay element 184 var swipeOutOverlayElement = document.querySelector(targetEl); 185 if (swipeOutOverlayElement) { 186 var hammerInstance = new Hammer(swipeOutOverlayElement); 187 hammerInstance.on('tap', callback); 188 } 189 } 190 }, 191 // --- 192 // Add classes 193 _addClass: function _addClass(cls) { 194 var el = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.ROOT_EL; 195 if (el.length !== undefined) { 196 // Add classes to multiple elements 197 el.forEach(function (e) { 198 cls.split(' ').forEach(function (c) { 199 return e.classList.add(c); 200 }); 201 }); 202 } else { 203 // Add classes to single element 204 cls.split(' ').forEach(function (c) { 205 return el.classList.add(c); 206 }); 207 } 208 }, 209 // --- 210 // Remove classes 211 _removeClass: function _removeClass(cls) { 212 var el = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.ROOT_EL; 213 if (el.length !== undefined) { 214 // Remove classes to multiple elements 215 el.forEach(function (e) { 216 cls.split(' ').forEach(function (c) { 217 return e.classList.remove(c); 218 }); 219 }); 220 } else { 221 // Remove classes to single element 222 cls.split(' ').forEach(function (c) { 223 return el.classList.remove(c); 224 }); 225 } 226 }, 227 // Toggle classes 228 _toggleClass: function _toggleClass() { 229 var el = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.ROOT_EL; 230 var cls1 = arguments.length > 1 ? arguments[1] : undefined; 231 var cls2 = arguments.length > 2 ? arguments[2] : undefined; 232 if (el.classList.contains(cls1)) { 233 el.classList.replace(cls1, cls2); 234 } else { 235 el.classList.replace(cls2, cls1); 236 } 237 }, 238 // --- 239 // Has class 240 _hasClass: function _hasClass(cls) { 241 var el = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.ROOT_EL; 242 var result = false;
243 cls.split(' ').forEach(function (c) { 244 if (el.classList.contains(c)) result = true; 245 }); 246 return result; 247 }, 248 _findParent: function _findParent(el, cls) { 249 if (el && el.tagName.toUpperCase() === 'BODY' || el.tagName.toUpperCase() === 'HTML') return null; 250 el = el.parentNode; 251 while (el && el.tagName.toUpperCase() !== 'BODY' && !el.classList.contains(cls)) { 252 el = el.parentNode; 253 } 254 el = el && el.tagName.toUpperCase() !== 'BODY' ? el : null; 255 return el; 256 }, 257 // --- 258 // Trigger window event 259 _triggerWindowEvent: function _triggerWindowEvent(name) { 260 if (typeof window === 'undefined') return; 261 if (document.createEvent) { 262 var event; 263 if (typeof Event === 'function') { 264 event = new Event(name); 265 } else { 266 event = document.createEvent('Event'); 267 event.initEvent(name, false, true); 268 } 269 window.dispatchEvent(event); 270 } else { 271 window.fireEvent("on".concat(name), document.createEventObject()); 272 } 273 }, 274 // --- 275 // Trigger event 276 _triggerEvent: function _triggerEvent(name) { 277 this._triggerWindowEvent("layout".concat(name)); 278 this._listeners.filter(function (listener) { 279 return listener.event === name; 280 }
280).forEach(function (listener) { 281 return listener.callback.call(null); 282 }); 283 }, 284 // --- 285 // Update style 286 _updateInlineStyle: function _updateInlineStyle() { 287 var navbarHeight = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; 288 var footerHeight = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; 289 if (!this._styleEl) { 290 this._styleEl = document.createElement('style'); 291 this._styleEl.type = 'text/css'; 292 document.head.appendChild(this._styleEl); 293 } 294 var newStyle = INLINE_STYLES.replace(/\{navbarHeight\}/gi, navbarHeight).replace(/\{footerHeight\}/gi, footerHeight); 295 if (this._curStyle !== newStyle) { 296 this._curStyle = newStyle; 297 this._styleEl.textContent = newStyle; 298 } 299 }, 300 // --- 301 // Remove style 302 _removeInlineStyle: function _removeInlineStyle() { 303 if (this._styleEl) document.head.removeChild(this._styleEl); 304 this._styleEl = null; 305 this._curStyle = null; 306 }, 307 // --- 308 // Redraw layout menu (Safari bugfix) 309 _redrawLayoutMenu: function _redrawLayoutMenu() { 310 var layoutMenu = this.getLayoutMenu(); 311 if (layoutMenu && layoutMenu.querySelector('.menu')) { 312 var inner = layoutMenu.querySelector('.menu-inner'); 313 var scrollTop = inner.scrollTop; 314 var pageScrollTop = document.documentElement.scrollTop; 315 layoutMenu.style.display = 'none'; 316 // layoutMenu.offsetHeight 317 layoutMenu.style.display = ''; 318 inner.scrollTop = scrollTop; 319 document.documentElement.scrollTop = pageScrollTop; 320 return true; 321 } 322 return false; 323 }, 324 // --- 325 // Check for transition support 326 _supportsTransitionEnd: function _supportsTransitionEnd() { 327 if (window.QUnit) return false; 328 var el = document.body || document.documentElement; 329 if (!el) return false; 330 var result = false;
331 TRANS_PROPERTIES.forEach(function (evnt) { 332 if (typeof el.style[evnt] !== 'undefined') result = true; 333 }); 334 return result; 335 }, 336 // --- 337 // Calculate current navbar height 338 _getNavbarHeight: function _getNavbarHeight() { 339 var _this2 = this; 340 var layoutNavbar = this.getLayoutNavbar(); 341 if (!layoutNavbar) return 0; 342 if (!this.isSmallScreen()) return layoutNavbar.getBoundingClientRect().height; 343 344 // Needs some logic to get navbar height on small screens 345 346 var clonedEl = layoutNavbar.cloneNode(true); 347 clonedEl.id = null; 348 clonedEl.style.visibility = 'hidden'; 349 clonedEl.style.position = 'absolute'; 350 Array.prototype.slice.call(clonedEl.querySelectorAll('.collapse.show')).forEach(function (el) { 351 return _this2._removeClass('show', el); 352 }); 353 layoutNavbar.parentNode.insertBefore(clonedEl, layoutNavbar); 354 var navbarHeight = clonedEl.getBoundingClientRect().height; 355 clonedEl.parentNode.removeChild(clonedEl); 356 return navbarHeight; 357 }, 358 // --- 359 // Get current footer height 360 _getFooterHeight: function _getFooterHeight() { 361 var layoutFooter = this.getLayoutFooter(); 362 if (!layoutFooter) return 0; 363 return layoutFooter.getBoundingClientRect().height; 364 }, 365 // --- 366 // Get animation duration of element 367 _getAnimationDuration: function _getAnimationDuration(el) { 368 var duration = window.getComputedStyle(el).transitionDuration; 369 return parseFloat(duration) * (duration.indexOf('ms') !== -1 ? 1 : 1000); 370 }, 371 // --- 372 // Set menu hover state 373 _setMenuHoverState: function _setMenuHoverState(hovered) { 374 this[hovered ? '_addClass' : '_removeClass']('layout-menu-hover'); 375 }, 376 // --- 377 // Toggle collapsed 378 _setCollapsed: function _setCollapsed(collapsed) { 379 var _this3 = this; 380 if (this.isSmallScreen()) { 381 if (collapsed) { 382 this._removeClass('layout-menu-expanded'); 383 } else { 384 setTimeout(function () { 385 _this3._addClass('layout-menu-expanded'); 386 }, this._redrawLayoutMenu() ? 5 : 0); 387 } 388 } else { 389 this[collapsed ? '_addClass' : '_removeClass']('layout-menu-collapsed'); 390 } 391 }, 392 // --- 393 // Add layout sivenav toggle animationEnd event 394 _bindLayoutAnimationEndEvent: function _bindLayoutAnimationEndEvent(modifier, cb) { 395 var _this4 = this; 396 var menu = this.getMenu(); 397 var duration = menu ? this._getAnimationDuration(menu) + 50 : 0; 398 if (!duration) { 399 modifier.call(this); 400 cb.call(this); 401 return; 402 } 403 this._transitionCallback = function (e) { 404 if (e.target !== menu) return; 405 _this4._unbindLayoutAnimationEndEvent(); 406 cb.call(_this4); 407 }; 408 TRANS_EVENTS.forEach(function (e) { 409 menu.addEventListener(e, _this4._transitionCallback, false); 410 }); 411 modifier.call(this); 412 this._transitionCallbackTimeout = setTimeout(function () { 413 _this4._transitionCallback.call(_this4, { 414 target: menu 415 }); 416 }, duration); 417 }, 418 // --- 419 // Remove layout sivenav toggle animationEnd event 420 _unbindLayoutAnimationEndEvent: function _unbindLayoutAnimationEndEvent() { 421 var _this5 = this; 422 var menu = this.getMenu(); 423 if (this._transitionCallbackTimeout) { 424 clearTimeout(this._transitionCallbackTimeout); 425 this._transitionCallbackTimeout = null; 426 } 427 if (menu && this._transitionCallback) { 428 TRANS_EVENTS.forEach(function (e) { 429 menu.removeEventListener(e, _this5._transitionCallback, false); 430 }); 431 } 432 if (this._transitionCallback) { 433 this._transitionCallback = null; 434 } 435 }, 436 // --- 437 // Bind delayed window resize event 438 _bindWindowResizeEvent: function _bindWindowResizeEvent() { 439 var _this6 = this; 440 this._unbindWindowResizeEvent(); 441 var cb = function cb() { 442 if (_this6._resizeTimeout) { 443 clearTimeout(_this6._resizeTimeout); 444 _this6._resizeTimeout = null; 445 } 446 _this6._triggerEvent('resize'); 447 }; 448 this._resizeCallback = function () { 449 if (_this6._resizeTimeout) clearTimeout(_this6._resizeTimeout); 450 _this6._resizeTimeout = setTimeout(cb, _this6.RESIZE_DELAY); 451 }; 452 window.addEventListener('resize', this._resizeCallback, false); 453 }, 454 // --- 455 // Unbind delayed window resize event 456 _unbindWindowResizeEvent: function _unbindWindowResizeEvent() { 457 if (this._resizeTimeout) { 458 clearTimeout(this._resizeTimeout); 459 this._resizeTimeout = null; 460 } 461 if (this._resizeCallback) { 462 window.removeEventListener('resize', this._resizeCallback, false); 463 this._resizeCallback = null; 464 } 465 }, 466 _bindMenuMouseEvents: function _bindMenuMouseEvents() { 467 var _this7 = this; 468 if (this._menuMouseEnter && this._menuMouseLeave && this._windowTouchStart) return; 469 var layoutMenu = this.getLayoutMenu(); 470 if (!layoutMenu) return this._unbindMenuMouseEvents(); 471 if (!this._menuMouseEnter) { 472 this._menuMouseEnter = function () { 473 if (_this7.isSmallScreen() || !_this7._hasClass('layout-menu-collapsed') || _this7.isOffcanvas() || _this7._hasClass('layout-transitioning')) { 474 return _this7._setMenuHoverState(false); 475 } 476 return _this7._setMenuHoverState(true); 477 }; 478 layoutMenu.addEventListener('mouseenter', this._menuMouseEnter, false); 479 layoutMenu.addEventListener('touchstart', this._menuMouseEnter, false); 480 } 481 if (!this._menuMouseLeave) { 482 this._menuMouseLeave = function () { 483 _this7._setMenuHoverState(false); 484 }; 485 layoutMenu.addEventListener('mouseleave', this._menuMouseLeave, false); 486 } 487 if (!this._windowTouchStart) { 488 this._windowTouchStart = function (e) { 489 if (!e || !e.target || !_this7._findParent(e.target, '.layout-menu')) { 490 _this7._setMenuHoverState(false); 491 } 492 }; 493 window.addEventListener('touchstart', this._windowTouchStart, true); 494 } 495 }, 496 _unbindMenuMouseEvents: function _unbindMenuMouseEvents() { 497 if (!this._menuMouseEnter && !this._menuMouseLeave && !this._windowTouchStart) return; 498 var layoutMenu = this.getLayoutMenu(); 499 if (this._menuMouseEnter) { 500 if (layoutMenu) { 501 layoutMenu.removeEventListener('mouseenter', this._menuMouseEnter, false); 502 layoutMenu.removeEventListener('touchstart', this._menuMouseEnter, false); 503 } 504 this._menuMouseEnter = null; 505 } 506 if (this._menuMouseLeave) { 507 if (layoutMenu) { 508 layoutMenu.removeEventListener('mouseleave', this._menuMouseLeave, false); 509 } 510 this._menuMouseLeave = null; 511 } 512 if (this._windowTouchStart) { 513 if (layoutMenu) { 514 window.addEventListener('touchstart', this._windowTouchStart, true); 515 } 516 this._windowTouchStart = null; 517 } 518 this._setMenuHoverState(false); 519 },
520 // ******************************************************************************* 521 // * Methods 522 scrollToActive: function scrollToActive() { 523 var animate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; 524 this._scrollToActive(animate); 525 }, 526 swipeIn: function swipeIn(el, callback) { 527 this._swipeIn(el, callback); 528 }, 529 swipeOut: function swipeOut(el, callback) { 530 this._swipeOut(el, callback); 531 }, 532 overlayTap: function overlayTap(el, callback) { 533 this._overlayTap(el, callback); 534 }, 535 scrollPageTo: function scrollPageTo(to) { 536 var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 500; 537 // t = current time 538 // b = start value 539 // c = change in value 540 // d = duration 541 var easeInOutQuad = function easeInOutQuad(t, b, c, d) { 542 t /= d / 2; 543 if (t < 1) return c / 2 * t * t + b; 544 t -= 1; 545 return -c / 2 * (t * (t - 2) - 1) + b; 546 }; 547 var element = document.scrollingElement; 548 if (typeof to === 'string') { 549 to = document.querySelector(to); 550 } 551 if (typeof to !== 'number') { 552 to = to.getBoundingClientRect().top + element.scrollTop; 553 } 554 var start = element.scrollTop; 555 var change = to - start; 556 var startDate = +new Date(); 557 // const increment = 20 558 559 var animateScroll = function animateScroll() { 560 var currentDate = +new Date(); 561 var currentTime = currentDate - startDate; 562 var val = easeInOutQuad(currentTime, start, change, duration); 563 element.scrollTop = val; 564 if (currentTime < duration) { 565 requestAnimationFrame(animateScroll); 566 } else { 567 element.scrollTop = to; 568 } 569 }; 570 animateScroll(); 571 }, 572 // --- 573 // Collapse / expand layout 574 setCollapsed: function setCollapsed() { 575 var _this8 = this; 576 var collapsed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : requiredParam('collapsed'); 577 var animate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; 578 var layoutMenu = this.getLayoutMenu(); 579 if (!layoutMenu) return; 580 this._unbindLayoutAnimationEndEvent(); 581 if (animate && this._supportsTransitionEnd()) { 582 this._addClass('layout-transitioning'); 583 if (collapsed) this._setMenuHoverState(false); 584 this._bindLayoutAnimationEndEvent(function () { 585 // Collapse / Expand 586 _this8._setCollapsed(collapsed); 587 }, function () { 588 _this8._removeClass('layout-transitioning'); 589 _this8._triggerWindowEvent('resize'); 590 _this8._triggerEvent('toggle'); 591 _this8._setMenuHoverState(false); 592 }); 593 } else { 594 this._addClass('layout-no-transition'); 595 if (collapsed) this._setMenuHoverState(false); 596 597 // Collapse / Expand 598 this._setCollapsed(collapsed); 599 setTimeout(function () { 600 _this8._removeClass('layout-no-transition'); 601 _this8._triggerWindowEvent('resize'); 602 _this8._triggerEvent('toggle'); 603 _this8._setMenuHoverState(false); 604 }, 1); 605 } 606 }, 607 // --- 608 // Toggle layout 609 toggleCollapsed: function toggleCollapsed() { 610 var animate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; 611 this.setCollapsed(!this.isCollapsed(), animate); 612 }, 613 // --- 614 // Set layout positioning 615 setPosition: function setPosition() { 616 var fixed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : requiredParam('fixed'); 617 var offcanvas = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : requiredParam('offcanvas'); 618 this._removeClass('layout-menu-offcanvas layout-menu-fixed layout-menu-fixed-offcanvas'); 619 if (!fixed && offcanvas) { 620 this._addClass('layout-menu-offcanvas'); 621 } else if (fixed && !offcanvas) { 622 this._addClass('layout-menu-fixed'); 623 this._redrawLayoutMenu(); 624 } else if (fixed && offcanvas) { 625 this._addClass('layout-menu-fixed-offcanvas'); 626 this._redrawLayoutMenu(); 627 } 628 this.update(); 629 }, 630 // ******************************************************************************* 631 // * Getters 632 getLayoutMenu: function getLayoutMenu() { 633 return document.querySelector('.layout-menu'); 634 }, 635 getMenu: function getMenu() { 636 var layoutMenu = this.getLayoutMenu(); 637 if (!layoutMenu) return null; 638 return !this._hasClass('menu', layoutMenu) ? layoutMenu.querySelector('.menu') : layoutMenu; 639 }, 640 getLayoutNavbar: function getLayoutNavbar() { 641 return document.querySelector('.layout-navbar'); 642 }, 643 getLayoutFooter: function getLayoutFooter() { 644 return document.querySelector('.content-footer'); 645 }, 646 getLayoutContainer: function getLayoutContainer() { 647 return document.querySelector('.layout-page'); 648 },
649 // ******************************************************************************* 650 // * Setters 651 setNavbarFixed: function setNavbarFixed() { 652 var fixed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : requiredParam('fixed'); 653 this[fixed ? '_addClass' : '_removeClass']('layout-navbar-fixed'); 654 this.update(); 655 }, 656 setNavbar: function setNavbar(type) { 657 if (type === 'sticky') { 658 this._addClass('layout-navbar-fixed'); 659 this._removeClass('layout-navbar-hidden'); 660 } else if (type === 'hidden') { 661 this._addClass('layout-navbar-hidden'); 662 this._removeClass('layout-navbar-fixed'); 663 } else { 664 this._removeClass('layout-navbar-hidden'); 665 this._removeClass('layout-navbar-fixed'); 666 } 667 this.update(); 668 }, 669 setFooterFixed: function setFooterFixed() { 670 var fixed = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : requiredParam('fixed'); 671 this[fixed ? '_addClass' : '_removeClass']('layout-footer-fixed'); 672 this.update(); 673 }, 674 setContentLayout: function setContentLayout() { 675 var _this9 = this; 676 var contentLayout = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : requiredParam('contentLayout'); 677 setTimeout(function () { 678 var contentArea = document.querySelector('.content-wrapper > div'); // For content area 679 var navbarArea = document.querySelector('.layout-navbar'); // For navbar area for vertical menu 680 var navbarAreaHorizontal = document.querySelector('.layout-navbar > div'); // For navbar area for horizontal menu 681 var navbarSearchInputWrapper = document.querySelector('.layout-navbar .search-input-wrapper'); // For navbar search input wrapper 682 var navbarSearchInput = document.querySelector('.layout-navbar .search-input-wrapper .search-input'); // For navbar search input 683 var footerArea = document.querySelector('.content-footer > div'); // For footer area 684 var containerFluid = [].slice.call(document.querySelectorAll('.container-fluid')); // To get container-fluid 685 var containerXxl = [].slice.call(document.querySelectorAll('.container-xxl')); // To get container-xxl 686 var verticalMenu = document.querySelector('.menu-vertical'); 687 var horizontalMenu = false; // For horizontal menu 688 var horizontalMenuArea; // For horizontal menu area 689 // Condition to check if layout is horizontal menu 690 if (document.querySelector('.content-wrapper > .menu-horizontal > div')) { 691 horizontalMenu = true; 692 horizontalMenuArea = document.querySelector('.content-wrapper > .menu-horizontal > div'); 693 } 694 // If compact mode layout 695 if (contentLayout === 'compact') { 696 // Remove container fluid class from content area and footer area 697 if (containerFluid.some(function (el) { 698 return [contentArea, footerArea].includes(el); 699 })) { 700 _this9._removeClass('container-fluid', [contentArea, footerArea]); 701 _this9._addClass('container-xxl', [contentArea, footerArea]); 702 } 703 // Navbar search input container condition is separated because it is not in starter kit 704 if (navbarSearchInput) { 705 _this9._removeClass('container-fluid', [navbarSearchInput]); 706 _this9._addClass('container-xxl', [navbarSearchInput]); 707 } 708 // Remove container fluid class from navbar area in vertical menu 709 if (verticalMenu) { 710 if (containerFluid.some(function (el) { 711 return [navbarArea].includes(el); 712 })) { 713 _this9._removeClass('container-fluid', [navbarArea]); 714 _this9._addClass('container-xxl', [navbarArea]); 715 } 716 } 717 // For horizontal menu only 718 if (horizontalMenu) { 719 _this9._removeClass('container-fluid', horizontalMenuArea); 720 _this9._addClass('container-xxl', horizontalMenuArea); 721 // For horizontal navbar only 722 if (navbarAreaHorizontal) { 723 _this9._removeClass('container-fluid', navbarAreaHorizontal); 724 _this9._addClass('container-xxl', navbarAreaHorizontal); 725 } 726 // Navbar search input container condition is separated because it is not in starter kit 727 if (navbarSearchInputWrapper) { 728 _this9._removeClass('container-fluid', navbarSearchInputWrapper); 729 _this9._addClass('container-xxl', navbarSearchInputWrapper); 730 } 731 } 732 } else { 733 // If wide mode layout 734
735 // Remove container xxl class from content area and footer area 736 if (containerXxl.some(function (el) { 737 return [contentArea, footerArea].includes(el); 738 })) { 739 _this9._removeClass('container-xxl', [contentArea, footerArea]); 740 _this9._addClass('container-fluid', [contentArea, footerArea]); 741 } 742 // Navbar search input container condition is separated because it is not in starter kit 743 if (navbarSearchInput) { 744 _this9._removeClass('container-xxl', [navbarSearchInput]); 745 _this9._addClass('container-fluid', [navbarSearchInput]); 746 } 747 // Remove container xxl class from navbar area in vertical menu 748 if (verticalMenu) { 749 if (containerXxl.some(function (el) { 750 return [navbarArea].includes(el); 751 })) { 752 _this9._removeClass('container-xxl', [navbarArea]); 753 _this9._addClass('container-fluid', [navbarArea]); 754 } 755 } 756 // For horizontal menu only 757 if (horizontalMenu) { 758 _this9._removeClass('container-xxl', horizontalMenuArea); 759 _this9._addClass('container-fluid', horizontalMenuArea); 760 // For horizontal navbar only 761 if (navbarAreaHorizontal) { 762 _this9._removeClass('container-xxl', navbarAreaHorizontal); 763 _this9._addClass('container-fluid', navbarAreaHorizontal); 764 } 765 // Navbar search input container condition is separated because it is not in starter kit 766 if (navbarSearchInputWrapper) { 767 _this9._removeClass('container-xxl', navbarSearchInputWrapper); 768 _this9._addClass('container-fluid', navbarSearchInputWrapper); 769 } 770 } 771 } 772 }, 100); 773 }, 774 // ******************************************************************************* 775 // * Update 776 update: function update() { 777 if (this.getLayoutNavbar() && (!this.isSmallScreen() && this.isLayoutNavbarFull() && this.isFixed() || this.isNavbarFixed()) || this.getLayoutFooter() && this.isFooterFixed()) { 778 this._updateInlineStyle(this._getNavbarHeight(), this._getFooterHeight()); 779 } 780 this._bindMenuMouseEvents(); 781 }, 782 setAutoUpdate: function setAutoUpdate() { 783 var _this10 = this; 784 var enable = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : requiredParam('enable'); 785 if (enable && !this._autoUpdate) { 786 this.on('resize.Helpers:autoUpdate', function () { 787 return _this10.update(); 788 }); 789 this._autoUpdate = true; 790 } else if (!enable && this._autoUpdate) { 791 this.off('resize.Helpers:autoUpdate'); 792 this._autoUpdate = false; 793 } 794 }, 795 // Update custom option based on element 796 updateCustomOptionCheck: function updateCustomOptionCheck(el) { 797 if (el.checked) { 798 // If custom option element is radio, remove checked from the siblings (closest `.row`) 799 if (el.type === 'radio') { 800 var customRadioOptionList = [].slice.call(el.closest('.row').querySelectorAll('.custom-option')); 801 customRadioOptionList.map(function (customRadioOptionEL) { 802 customRadioOptionEL.closest('.custom-option').classList.remove('checked'); 803 }); 804 } 805 el.closest('.custom-option').classList.add('checked'); 806 } else { 807 el.closest('.custom-option').classList.remove('checked'); 808 } 809 }, 810 // ******************************************************************************* 811 // * Tests 812 isRtl: function isRtl() { 813 return document.querySelector('body').getAttribute('dir') === 'rtl' || document.querySelector('html').getAttribute('dir') === 'rtl'; 814 }, 815 isMobileDevice: function isMobileDevice() { 816 return typeof window.orientation !== 'undefined' || navigator.userAgent.indexOf('IEMobile') !== -1; 817 }, 818 isSmallScreen: function isSmallScreen() { 819 return (window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth) < this.LAYOUT_BREAKPOINT; 820 }, 821 isLayoutNavbarFull: function isLayoutNavbarFull() { 822 return !!document.querySelector('.layout-wrapper.layout-navbar-full'); 823 }, 824 isCollapsed: function isCollapsed() { 825 if (this.isSmallScreen()) { 826 return !this._hasClass('layout-menu-expanded'); 827 } 828 return this._hasClass('layout-menu-collapsed'); 829 }, 830 isFixed: function isFixed() { 831 return this._hasClass('layout-menu-fixed layout-menu-fixed-offcanvas'); 832 }, 833 isOffcanvas: function isOffcanvas() { 834 return this._hasClass('layout-menu-offcanvas layout-menu-fixed-offcanvas'); 835 }, 836 isNavbarFixed: function isNavbarFixed() { 837 return this._hasClass('layout-navbar-fixed') || !this.isSmallScreen() && this.isFixed() && this.isLayoutNavbarFull(); 838 }, 839 isFooterFixed: function isFooterFixed() { 840 return this._hasClass('layout-footer-fixed'); 841 }, 842 isLightStyle: function isLightStyle() { 843 return document.documentElement.classList.contains('light-style'); 844 }, 845 isDarkStyle: function isDarkStyle() { 846 return document.documentElement.classList.contains('dark-style'); 847 },
848 // ******************************************************************************* 849 // * Events 850 on: function on() { 851 var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : requiredParam('event'); 852 var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : requiredParam('callback'); 853 var _event$split = event.split('.'), 854 _event$split2 = _slicedToArray(_event$split, 1), 855 _event = _event$split2[0]; 856 var _event$split3 = event.split('.'), 857 _event$split4 = _toArray(_event$split3), 858 namespace = _event$split4.slice(1); 859 // let [_event, ...namespace] = event.split('.') 860 namespace = namespace.join('.') || null; 861 this._listeners.push({ 862 event: _event, 863 namespace: namespace, 864 callback: callback 865 }); 866 }, 867 off: function off() { 868 var _this11 = this; 869 var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : requiredParam('event'); 870 var _event$split5 = event.split('.'), 871 _event$split6 = _slicedToArray(_event$split5, 1), 872 _event = _event$split6[0]; 873 var _event$split7 = event.split('.'), 874 _event$split8 = _toArray(_event$split7), 875 namespace = _event$split8.slice(1); 876 namespace = namespace.join('.') || null; 877 this._listeners.filter(function (listener) { 878 return listener.event === _event && listener.namespace === namespace; 879 }
879).forEach(function (listener) { 880 return _this11._listeners.splice(_this11._listeners.indexOf(listener), 1); 881 }); 882 }, 883 // ******************************************************************************* 884 // * Life cycle 885 init: function init() { 886 var _this12 = this; 887 if (this._initialized) return; 888 this._initialized = true; 889 890 // Initialize `style` element 891 this._updateInlineStyle(0); 892 893 // Bind window resize event 894 this._bindWindowResizeEvent(); 895 896 // Bind init event 897 this.off('init._Helpers'); 898 this.on('init._Helpers', function () { 899 _this12.off('resize._Helpers:redrawMenu'); 900 _this12.on('resize._Helpers:redrawMenu', function () { 901 // eslint-disable-next-line no-unused-expressions 902 _this12.isSmallScreen() && !_this12.isCollapsed() && _this12._redrawLayoutMenu(); 903 }); 904 905 // Force repaint in IE 10 906 if (typeof document.documentMode === 'number' && document.documentMode < 11) { 907 _this12.off('resize._Helpers:ie10RepaintBody'); 908 _this12.on('resize._Helpers:ie10RepaintBody', function () { 909 if (_this12.isFixed()) return; 910 var scrollTop = document.documentElement.scrollTop; 911 document.body.style.display = 'none'; 912 // document.body.offsetHeight 913 document.body.style.display = 'block'; 914 document.documentElement.scrollTop = scrollTop; 915 }); 916 } 917 }); 918 this._triggerEvent('init'); 919 }, 920 destroy: function destroy() { 921 var _this13 = this; 922 if (!this._initialized) return; 923 this._initialized = false; 924 this._removeClass('layout-transitioning'); 925 this._removeInlineStyle(); 926 this._unbindLayoutAnimationEndEvent(); 927 this._unbindWindowResizeEvent(); 928 this._unbindMenuMouseEvents(); 929 this.setAutoUpdate(false); 930 this.off('init._Helpers'); 931 932 // Remove all listeners except `init` 933 this._listeners.filter(function (listener) { 934 return listener.event !== 'init'; 935 }
935).forEach(function (listener) { 936 return _this13._listeners.splice(_this13._listeners.indexOf(listener), 1); 937 }); 938 }, 939 // --- 940 // Init Password Toggle 941 initPasswordToggle: function initPasswordToggle() { 942 var toggler = document.querySelectorAll('.form-password-toggle i'); 943 if (typeof toggler !== 'undefined' && toggler !== null) { 944 toggler.forEach(function (el) { 945 el.addEventListener('click', function (e) { 946 e.preventDefault(); 947 var formPasswordToggle = el.closest('.form-password-toggle'); 948 var formPasswordToggleIcon = formPasswordToggle.querySelector('i'); 949 var formPasswordToggleInput = formPasswordToggle.querySelector('input'); 950 if (formPasswordToggleInput.getAttribute('type') === 'text') { 951 formPasswordToggleInput.setAttribute('type', 'password'); 952 formPasswordToggleIcon.classList.replace('bx-show', 'bx-hide'); 953 } else if (formPasswordToggleInput.getAttribute('type') === 'password') { 954 formPasswordToggleInput.setAttribute('type', 'text'); 955 formPasswordToggleIcon.classList.replace('bx-hide', 'bx-show'); 956 } 957 }); 958 }); 959 } 960 }, 961 //-- 962 // Init custom option check 963 initCustomOptionCheck: function initCustomOptionCheck() { 964 var _this = this; 965 var custopOptionList = [].slice.call(document.querySelectorAll('.custom-option .form-check-input')); 966 custopOptionList.map(function (customOptionEL) { 967 // Update custom options check on page load 968 _this.updateCustomOptionCheck(customOptionEL); 969 970 // Update custom options check on click 971 customOptionEL.addEventListener('click', function (e) { 972 _this.updateCustomOptionCheck(customOptionEL); 973 }); 974 }); 975 }, 976 // --- 977 // Init Speech To Text 978 initSpeechToText: function initSpeechToText() { 979 var SpeechRecognition = window.SpeechRecognition || window.webkitSpeechRecognition; 980 var speechToText = document.querySelectorAll('.speech-to-text'); 981 if (SpeechRecognition !== undefined && SpeechRecognition !== null) { 982 if (typeof speechToText !== 'undefined' && speechToText !== null) { 983 var recognition = new SpeechRecognition(); 984 var toggler = document.querySelectorAll('.speech-to-text i'); 985 toggler.forEach(function (el) { 986 var listening = false; 987 el.addEventListener('click', function () { 988 el.closest('.input-group').querySelector('.form-control').focus(); 989 recognition.onspeechstart = function () { 990 listening = true; 991 }; 992 if (listening === false) { 993 recognition.start(); 994 } 995 recognition.onerror = function () { 996 listening = false; 997 }; 998 recognition.onresult = function (event) { 999 el.closest('.input-group').querySelector('.form-control').value = event.results[0][0].transcript; 1000 }; 1001 recognition.onspeechend = function () { 1002 listening = false; 1003 recognition.stop(); 1004 }; 1005 }); 1006 }); 1007 } 1008 } 1009 }, 1010 // --- 1011 // Init Navbar Dropdown (i.e notification) PerfectScrollbar 1012 initNavbarDropdownScrollbar: function initNavbarDropdownScrollbar() { 1013 var scrollbarContainer = document.querySelectorAll('.navbar-dropdown .scrollable-container'); 1014 var _window4 = window, 1015 PerfectScrollbar = _window4.PerfectScrollbar; 1016 if (PerfectScrollbar !== undefined) { 1017 if (typeof scrollbarContainer !== 'undefined' && scrollbarContainer !== null) { 1018 scrollbarContainer.forEach(function (el) { 1019 // eslint-disable-next-line no-new 1020 new PerfectScrollbar(el, { 1021 wheelPropagation: false, 1022 suppressScrollX: true 1023 }); 1024 }); 1025 } 1026 } 1027 }, 1028 // Ajax Call Promise 1029 ajaxCall: function ajaxCall(url) { 1030 return new Promise(function (resolve, reject) { 1031 var req = new XMLHttpRequest(); 1032 req.open('GET', url); 1033 req.onload = function () { 1034 return req.status === 200 ? resolve(req.response) : reject(Error(req.statusText)); 1035 }; 1036 req.onerror = function (e) { 1037 return reject(Error("Network Error: ".concat(e))); 1038 }; 1039 req.send(); 1040 }); 1041 }, 1042 // --- 1043 // SidebarToggle (Used in Apps) 1044 initSidebarToggle: function initSidebarToggle() { 1045 var sidebarToggler = document.querySelectorAll('[data-bs-toggle="sidebar"]'); 1046 sidebarToggler.forEach(function (el) { 1047 el.addEventListener('click', function () { 1048 var target = el.getAttribute('data-target');
1049 var overlay = el.getAttribute('data-overlay'); 1050 var appOverlay = document.querySelectorAll('.app-overlay'); 1051 var targetEl = document.querySelectorAll(target); 1052 targetEl.forEach(function (tel) { 1053 tel.classList.toggle('show'); 1054 if (typeof overlay !== 'undefined' && overlay !== null && overlay !== false && typeof appOverlay !== 'undefined') { 1055 if (tel.classList.contains('show')) { 1056 appOverlay[0].classList.add('show'); 1057 } else { 1058 appOverlay[0].classList.remove('show'); 1059 } 1060 appOverlay[0].addEventListener('click', function (e) { 1061 e.currentTarget.classList.remove('show'); 1062 tel.classList.remove('show'); 1063 }); 1064 } 1065 }); 1066 }); 1067 }); 1068 } 1069}; 1070 1071// ******************************************************************************* 1072// * Initialization 1073 1074if (typeof window !== 'undefined') { 1075 Helpers.init(); 1076 if (Helpers.isMobileDevice() && window.chrome) { 1077 document.documentElement.classList.add('layout-menu-100vh'); 1078 } 1079 1080 // Update layout after page load 1081 if (document.readyState === 'complete') Helpers.update();else document.addEventListener('DOMContentLoaded', function onContentLoaded() { 1082 Helpers.update(); 1083 document.removeEventListener('DOMContentLoaded', onContentLoaded); 1084 }); 1085} 1086 1087// --- 1088 1089/******/ return __webpack_exports__; 1090/******/ })() 1091; 1092});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.