vendor: 5,119 bytes, lines 1-132
1import "./preload-helper-0tpz3Uaa.js"; 2import { c as commonjsGlobal, $ as $$1 } from "./jquery-owkqGIup.js"; 3import { w as widgetPreviewUpdateEventHandler } from "./widgetPreviewUpdateEventHandler-DodjIeca.js"; 4import { w as widgetScan } from "./widget-scan-CJOpgxH1.js"; 5import { c as checkoutForm } from "./checkout-02xYAXw6.js"; 6import { a6 as axios } from "./vendor-BACcT7ut.js"; 7import { p as policyView } from "./policy-view-BE_dSg8E.js"; 8(function(module, exports) { 9 (function(global, factory) { 10 factory(); 11 })(commonjsGlobal, function() { 12 function applyFocusVisiblePolyfill(scope) { 13 var hadKeyboardEvent = true; 14 var hadFocusVisibleRecently = false; 15 var hadFocusVisibleRecentlyTimeout = null; 16 var inputTypesAllowlist = { 17 text: true, 18 search: true, 19 url: true, 20 tel: true, 21 email: true, 22 password: true, 23 number: true, 24 date: true, 25 month: true, 26 week: true, 27 time: true, 28 datetime: true, 29 "datetime-local": true 30 }; 31 function isValidFocusTarget(el) { 32 if (el && el !== document && el.nodeName !== "HTML" && el.nodeName !== "BODY" && "classList" in el && "contains" in el.classList) { 33 return true; 34 } 35 return false; 36 } 37 function focusTriggersKeyboardModality(el) { 38 var type = el.type; 39 var tagName = el.tagName; 40 if (tagName === "INPUT" && inputTypesAllowlist[type] && !el.readOnly) { 41 return true; 42 } 43 if (tagName === "TEXTAREA" && !el.readOnly) { 44 return true; 45 } 46 if (el.isContentEditable) { 47 return true; 48 } 49 return false; 50 } 51 function addFocusVisibleClass(el) { 52 if (el.classList.contains("focus-visible")) { 53 return; 54 } 55 el.classList.add("focus-visible"); 56 el.setAttribute("data-focus-visible-added", ""); 57 } 58 function removeFocusVisibleClass(el) { 59 if (!el.hasAttribute("data-focus-visible-added")) { 60 return; 61 } 62 el.classList.remove("focus-visible"); 63 el.removeAttribute("data-focus-visible-added"); 64 } 65 function onKeyDown(e) { 66 if (e.metaKey || e.altKey || e.ctrlKey) { 67 return; 68 } 69 if (isValidFocusTarget(scope.activeElement)) { 70 addFocusVisibleClass(scope.activeElement); 71 } 72 hadKeyboardEvent = true; 73 } 74 function onPointerDown(e) { 75 hadKeyboardEvent = false; 76 } 77 function onFocus(e) { 78 if (!isValidFocusTarget(e.target)) { 79 return; 80 } 81 if (hadKeyboardEvent || focusTriggersKeyboardModality(e.target)) { 82 addFocusVisibleClass(e.target); 83 } 84 } 85 function onBlur(e) { 86 if (!isValidFocusTarget(e.target)) { 87 return; 88 } 89 if (e.target.classList.contains("focus-visible") || e.target.hasAttribute("data-focus-visible-added")) { 90 hadFocusVisibleRecently = true; 91 window.clearTimeout(hadFocusVisibleRecentlyTimeout); 92 hadFocusVisibleRecentlyTimeout = window.setTimeout(function() { 93 hadFocusVisibleRecently = false; 94 }, 100); 95 removeFocusVisibleClass(e.target); 96 } 97 } 98 function onVisibilityChange(e) { 99 if (document.visibilityState === "hidden") { 100 if (hadFocusVisibleRecently) { 101 hadKeyboardEvent = true; 102 } 103 addInitialPointerMoveListeners(); 104 } 105 } 106 function addInitialPointerMoveListeners() { 107 document.addEventListener("mousemove", onInitialPointerMove); 108 document.addEventListener("mousedown", onInitialPointerMove); 109 document.addEventListener("mouseup", onInitialPointerMove); 110 document.addEventListener("pointermove", onInitialPointerMove); 111 document.addEventListener("pointerdown", onInitialPointerMove); 112 document.addEventListener("pointerup", onInitialPointerMove); 113 document.addEventListener("touchmove", onInitialPointerMove); 114 document.addEventListener("touchstart", onInitialPointerMove); 115 document.addEventListener("touchend", onInitialPointerMove); 116 } 117 function removeInitialPointerMoveListeners() { 118 document.removeEventListener("mousemove", onInitialPointerMove); 119 document.removeEventListener("mousedown", onInitialPointerMove); 120 document.removeEventListener("mouseup", onInitialPointerMove); 121 document.removeEventListener("pointermove", onInitialPointerMove); 122 document.removeEventListener("pointerdown", onInitialPointerMove); 123 document.removeEventListener("pointerup", onInitialPointerMove); 124 document.removeEventListener("touchmove", onInitialPointerMove); 125 document.removeEventListener("touchstart", onInitialPointerMove); 126 document.removeEventListener("touchend", onInitialPointerMove); 127 } 128 function onInitialPointerMove(e) { 129 if (e.target.nodeName && e.target.nodeName.toLowerCase() === "html") { 130 return; 131 } 132 hadKeyboardEvent = false;
133 removeInitialPointerMoveListeners(); 134 } 135 document.addEventListener("keydown", onKeyDown, true); 136 document.addEventListener("mousedown", onPointerDown, true); 137 document.addEventListener("pointerdown", onPointerDown, true); 138 document.addEventListener("touchstart", onPointerDown, true); 139 document.addEventListener("visibilitychange", onVisibilityChange, true); 140 addInitialPointerMoveListeners(); 141 scope.addEventListener("focus", onFocus, true); 142 scope.addEventListener("blur", onBlur, true); 143 if (scope.nodeType === Node.DOCUMENT_FRAGMENT_NODE && scope.host) { 144 scope.host.setAttribute("data-js-focus-visible", ""); 145 } else if (scope.nodeType === Node.DOCUMENT_NODE) { 146 document.documentElement.classList.add("js-focus-visible"); 147 document.documentElement.setAttribute("data-js-focus-visible", ""); 148 } 149 } 150 if (typeof window !== "undefined" && typeof document !== "undefined") { 151 window.applyFocusVisiblePolyfill = applyFocusVisiblePolyfill; 152 var event; 153 try { 154 event = new CustomEvent("focus-visible-polyfill-ready"); 155 } catch (error) { 156 event = document.createEvent("CustomEvent"); 157 event.initCustomEvent("focus-visible-polyfill-ready", false, false, {}); 158 } 159 window.dispatchEvent(event); 160 } 161 if (typeof document !== "undefined") { 162 applyFocusVisiblePolyfill(document); 163 } 164 }); 165})(); 166var lazysizes = { exports: {} }; 167(function(module) { 168 (function(window2, factory) { 169 var lazySizes = factory(window2, window2.document, Date); 170 window2.lazySizes = lazySizes; 171 if (module.exports) { 172 module.exports = lazySizes; 173 } 174 })( 175 typeof window != "undefined" ? window : {}, 176 /** 177 * import("./types/global") 178 * @typedef { import("./types/lazysizes-config").LazySizesConfigPartial } LazySizesConfigPartial 179 */ 180 function l(window2, document2, Date2) { 181 var lazysizes2, lazySizesCfg; 182 (function() { 183 var prop; 184 var lazySizesDefaults = { 185 lazyClass: "lazyload", 186 loadedClass: "lazyloaded", 187 loadingClass: "lazyloading", 188 preloadClass: "lazypreload", 189 errorClass: "lazyerror", 190 //strictClass: 'lazystrict', 191 autosizesClass: "lazyautosizes", 192 fastLoadedClass: "ls-is-cached", 193 iframeLoadMode: 0, 194 srcAttr: "data-src", 195 srcsetAttr: "data-srcset", 196 sizesAttr: "data-sizes", 197 //preloadAfterLoad: false, 198 minSize: 40, 199 customMedia: {}, 200 init: true, 201 expFactor: 1.5, 202 hFac: 0.8, 203 loadMode: 2, 204 loadHidden: true, 205 ricTimeout: 0, 206 throttleDelay: 125 207 }; 208 lazySizesCfg = window2.lazySizesConfig || window2.lazysizesConfig || {}; 209 for (prop in lazySizesDefaults) { 210 if (!(prop in lazySizesCfg)) { 211 lazySizesCfg[prop] = lazySizesDefaults[prop]; 212 } 213 } 214 })(); 215 if (!document2 || !document2.getElementsByClassName) { 216 return { 217 init: function() { 218 }, 219 /** 220 * @type { LazySizesConfigPartial } 221 */ 222 cfg: lazySizesCfg, 223 /** 224 * @type { true } 225 */ 226 noSupport: true 227 }; 228 } 229 var docElem = document2.documentElement; 230 var supportPicture = window2.HTMLPictureElement; 231 var _addEventListener = "addEventListener"; 232 var _getAttribute = "getAttribute"; 233 var addEventListener = window2[_addEventListener].bind(window2); 234 var setTimeout2 = window2.setTimeout; 235 var requestAnimationFrame = window2.requestAnimationFrame || setTimeout2; 236 var requestIdleCallback = window2.requestIdleCallback; 237 var regPicture = /^picture$/i; 238 var loadEvents = ["load", "error", "lazyincluded", "_lazyloaded"]; 239 var regClassCache = {}; 240 var forEach = Array.prototype.forEach; 241 var hasClass = function(ele, cls) { 242 if (!regClassCache[cls]) { 243 regClassCache[cls] = new RegExp("(\\s|^)" + cls + "(\\s|$)"); 244 } 245 return regClassCache[cls].test(ele[_getAttribute]("class") || "") && regClassCache[cls]; 246 }; 247 var addClass = function(ele, cls) { 248 if (!hasClass(ele, cls)) { 249 ele.setAttribute("class", (ele[_getAttribute]("class") || "").trim() + " " + cls); 250 } 251 }; 252 var removeClass = function(ele, cls) { 253 var reg; 254 if (reg = hasClass(ele, cls)) { 255 ele.setAttribute("class", (ele[_getAttribute]("class") || "").replace(reg, " ")); 256 } 257 }; 258 var addRemoveLoadEvents = function(dom, fn, add) { 259 var action = add ? _addEventListener : "removeEventListener"; 260 if (add) { 261 addRemoveLoadEvents(dom, fn); 262 }
263 loadEvents.forEach(function(evt) { 264 dom[action](evt, fn); 265 }); 266 }; 267 var triggerEvent = function(elem, name, detail, noBubbles, noCancelable) { 268 var event = document2.createEvent("Event"); 269 if (!detail) { 270 detail = {}; 271 } 272 detail.instance = lazysizes2; 273 event.initEvent(name, !noBubbles, !noCancelable); 274 event.detail = detail; 275 elem.dispatchEvent(event); 276 return event; 277 }; 278 var updatePolyfill = function(el, full) { 279 var polyfill; 280 if (!supportPicture && (polyfill = window2.picturefill || lazySizesCfg.pf)) { 281 if (full && full.src && !el[_getAttribute]("srcset")) { 282 el.setAttribute("srcset", full.src); 283 } 284 polyfill({ reevaluate: true, elements: [el] }); 285 } else if (full && full.src) { 286 el.src = full.src; 287 } 288 }; 289 var getCSS = function(elem, style) { 290 return (getComputedStyle(elem, null) || {})[style]; 291 }; 292 var getWidth = function(elem, parent, width) { 293 width = width || elem.offsetWidth; 294 while (width < lazySizesCfg.minSize && parent && !elem._lazysizesWidth) { 295 width = parent.offsetWidth; 296 parent = parent.parentNode; 297 } 298 return width; 299 }; 300 var rAF = function() { 301 var running, waiting; 302 var firstFns = []; 303 var secondFns = []; 304 var fns = firstFns; 305 var run = function() { 306 var runFns = fns; 307 fns = firstFns.length ? secondFns : firstFns; 308 running = true; 309 waiting = false; 310 while (runFns.length) { 311 runFns.shift()(); 312 } 313 running = false; 314 }; 315 var rafBatch = function(fn, queue) { 316 if (running && !queue) { 317 fn.apply(this, arguments); 318 } else { 319 fns.push(fn); 320 if (!waiting) { 321 waiting = true; 322 (document2.hidden ? setTimeout2 : requestAnimationFrame)(run); 323 } 324 } 325 }; 326 rafBatch._lsFlush = run; 327 return rafBatch; 328 }(); 329 var rAFIt = function(fn, simple) { 330 return simple ? function() { 331 rAF(fn); 332 } : function() { 333 var that = this; 334 var args = arguments; 335 rAF(function() { 336 fn.apply(that, args); 337 }); 338 }; 339 }; 340 var throttle = function(fn) { 341 var running; 342 var lastTime = 0; 343 var gDelay = lazySizesCfg.throttleDelay; 344 var rICTimeout = lazySizesCfg.ricTimeout; 345 var run = function() { 346 running = false; 347 lastTime = Date2.now(); 348 fn(); 349 }; 350 var idleCallback = requestIdleCallback && rICTimeout > 49 ? function() { 351 requestIdleCallback(run, { timeout: rICTimeout }); 352 if (rICTimeout !== lazySizesCfg.ricTimeout) { 353 rICTimeout = lazySizesCfg.ricTimeout; 354 } 355 } : rAFIt(function() { 356 setTimeout2(run); 357 }, true); 358 return function(isPriority) { 359 var delay; 360 if (isPriority = isPriority === true) { 361 rICTimeout = 33; 362 } 363 if (running) { 364 return; 365 } 366 running = true; 367 delay = gDelay - (Date2.now() - lastTime); 368 if (delay < 0) { 369 delay = 0; 370 } 371 if (isPriority || delay < 9) { 372 idleCallback(); 373 } else { 374 setTimeout2(idleCallback, delay); 375 } 376 }; 377 }; 378 var debounce2 = function(func) { 379 var timeout, timestamp; 380 var wait = 99; 381 var run = function() { 382 timeout = null; 383 func(); 384 }; 385 var later = function() { 386 var last = Date2.now() - timestamp; 387 if (last < wait) { 388 setTimeout2(later, wait - last); 389 } else { 390 (requestIdleCallback || run)(run); 391 } 392 }; 393 return function() { 394 timestamp = Date2.now(); 395 if (!timeout) { 396 timeout = setTimeout2(later, wait); 397 } 398 }; 399 }; 400 var loader = function() { 401 var preloadElems, isCompleted, resetPreloadingTimer, loadMode, started; 402 var eLvW, elvH, eLtop, eLleft, eLright, eLbottom, isBodyHidden; 403 var regImg = /^img$/i; 404 var regIframe = /^iframe$/i; 405 var supportScroll = "onscroll" in window2 && !/(gle|ing)bot/.test(navigator.userAgent); 406 var shrinkExpand = 0; 407 var currentExpand = 0; 408 var isLoading = 0; 409 var lowRuns = -1; 410 var resetPreloading = function(e) { 411 isLoading--; 412 if (!e || isLoading < 0 || !e.target) { 413 isLoading = 0; 414 } 415 }; 416 var isVisible = function(elem) { 417 if (isBodyHidden == null) { 418 isBodyHidden = getCSS(document2.body, "visibility") == "hidden"; 419 } 420 return isBodyHidden || !(getCSS(elem.parentNode, "visibility") == "hidden" && getCSS(elem, "visibility") == "hidden"); 421 }; 422 var isNestedVisible = function(elem, elemExpand) { 423 var outerRect; 424 var parent = elem; 425 var visible = isVisible(elem); 426 eLtop -= elemExpand; 427 eLbottom += elemExpand; 428 eLleft -= elemExpand; 429 eLright += elemExpand; 430 while (visible && (parent = parent.offsetParent) && parent != document2.body && parent != docElem) { 431 visible = (getCSS(parent, "opacity") || 1) > 0; 432 if (visible && getCSS(parent, "overflow") != "visible") { 433 outerRect = parent.getBoundingClientRect(); 434 visible = eLright > outerRect.left && eLleft < outerRect.right && eLbottom > outerRect.top - 1 && eLtop < outerRect.bottom + 1; 435 } 436 } 437 return visible; 438 }; 439 var checkElements = function() { 440 var eLlen, i, rect, autoLoadElem, loadedSomething, elemExpand, elemNegativeExpand, elemExpandVal, beforeE
440xpandVal, defaultExpand, preloadExpand, hFac; 441 var lazyloadElems = lazysizes2.elements; 442 if ((loadMode = lazySizesCfg.loadMode) && isLoading < 8 && (eLlen = lazyloadElems.length)) { 443 i = 0; 444 lowRuns++; 445 for (; i < eLlen; i++) { 446 if (!lazyloadElems[i] || lazyloadElems[i]._lazyRace) { 447 continue; 448 } 449 if (!supportScroll || lazysizes2.prematureUnveil && lazysizes2.prematureUnveil(lazyloadElems[i])) { 450 unveilElement(lazyloadElems[i]); 451 continue; 452 } 453 if (!(elemExpandVal = lazyloadElems[i][_getAttribute]("data-expand")) || !(elemExpand = elemExpandVal * 1)) { 454 elemExpand = currentExpand; 455 } 456 if (!defaultExpand) { 457 defaultExpand = !lazySizesCfg.expand || lazySizesCfg.expand < 1 ? docElem.clientHeight > 500 && docElem.clientWidth > 500 ? 500 : 370 : lazySizesCfg.expand; 458 lazysizes2._defEx = defaultExpand; 459 preloadExpand = defaultExpand * lazySizesCfg.expFactor; 460 hFac = lazySizesCfg.hFac; 461 isBodyHidden = null; 462 if (currentExpand < preloadExpand && isLoading < 1 && lowRuns > 2 && loadMode > 2 && !document2.hidden) { 463 currentExpand = preloadExpand; 464 lowRuns = 0; 465 } else if (loadMode > 1 && lowRuns > 1 && isLoading < 6) { 466 currentExpand = defaultExpand; 467 } else { 468 currentExpand = shrinkExpand; 469 } 470 } 471 if (beforeExpandVal !== elemExpand) { 472 eLvW = innerWidth + elemExpand * hFac; 473 elvH = innerHeight + elemExpand; 474 elemNegativeExpand = elemExpand * -1; 475 beforeExpandVal = elemExpand; 476 } 477 rect = lazyloadElems[i].getBoundingClientRect(); 478 if ((eLbottom = rect.bottom) >= elemNegativeExpand && (eLtop = rect.top) <= elvH && (eLright = rect.right) >= elemNegativeExpand * hFac && (eLleft = rect.left) <= eLvW && (eLbottom || eLright || eLleft || eLtop) && (lazySizesCfg.loadHidden || isVisible(lazyloadElems[i])) && (isCompleted && isLoading < 3 && !elemExpandVal && (loadMode < 3 || lowRuns < 4) || isNestedVisible(lazyloadElems[i], elemExpand))) { 479 unveilElement(lazyloadElems[i]); 480 loadedSomething = true; 481 if (isLoading > 9) { 482 break; 483 } 484 } else if (!loadedSomething && isCompleted && !autoLoadElem && isLoading < 4 && lowRuns < 4 && loadMode > 2 && (preloadElems[0] || lazySizesCfg.preloadAfterLoad) && (preloadElems[0] || !elemExpandVal && (eLbottom || eLright || eLleft || eLtop || lazyloadElems[i][_getAttribute](lazySizesCfg.sizesAttr) != "auto"))) { 485 autoLoadElem = preloadElems[0] || lazyloadElems[i]; 486 } 487 } 488 if (autoLoadElem && !loadedSomething) { 489 unveilElement(autoLoadElem); 490 } 491 } 492 }; 493 var throttledCheckElements = throttle(checkElements); 494 var switchLoadingClass = function(e) { 495 var elem = e.target; 496 if (elem._lazyCache) { 497 delete elem._lazyCache; 498 return; 499 } 500 resetPreloading(e); 501 addClass(elem, lazySizesCfg.loadedClass); 502 removeClass(elem, lazySizesCfg.loadingClass); 503 addRemoveLoadEvents(elem, rafSwitchLoadingClass); 504 triggerEvent(elem, "lazyloaded"); 505 }; 506 var rafedSwitchLoadingClass = rAFIt(switchLoadingClass); 507 var rafSwitchLoadingClass = function(e) { 508 rafedSwitchLoadingClass({ target: e.target }); 509 }; 510 var changeIframeSrc = function(elem, src) { 511 var loadMode2 = elem.getAttribute("data-load-mode") || lazySizesCfg.iframeLoadMode; 512 if (loadMode2 == 0) { 513 elem.contentWindow.location.replace(src); 514 } else if (loadMode2 == 1) { 515 elem.src = src; 516 } 517 }; 518 var handleSources = function(source) { 519 var customMedia; 520 var sourceSrcset = source[_getAttribute](lazySizesCfg.srcsetAttr); 521 if (customMedia = lazySizesCfg.customMedia[source[_getAttribute]("data-media") || source[_getAttribute]("media")]) { 522 source.setAttribute("media", customMedia); 523 } 524 if (sourceSrcset) { 525 source.setAttribute("srcset", sourceSrcset); 526 } 527 }; 528 var lazyUnveil = rAFIt(function(elem, detail, isAuto, sizes, isImg) { 529 var src, srcset, parent, isPicture, event, firesLoad; 530 if (!(event = triggerEvent(elem, "lazybeforeunveil", detail)).defaultPrevented) { 531 if (sizes) { 532 if (isAuto) { 533 addClass(elem, lazySizesCfg.autosizesClass); 534 } else { 535 elem.setAttribute("sizes", sizes); 536 } 537 } 538 srcset = elem[_getAttribute](lazySizesCfg.srcsetAttr); 539 src = elem[_getAttribute](lazySizesCfg.srcAttr); 540 if (isImg) { 541 parent = elem.parentNode; 542 isPicture = parent && regPicture.test(parent.nodeName || ""); 543 } 544 firesLoad = detail.firesLoad || "src" in elem && (srcset || src || isPicture); 545 event = { target: elem }; 546 addClass(elem, lazySizesCfg.loadingClass); 547 if (firesLoad) { 548 clearTimeout(resetPreloadingTimer); 549 resetPreloadingTimer = setTimeout2(resetPreloading, 2500); 550 addRemoveLoadEvents(elem, rafSwitchLoadingClass, true); 551 } 552 if (isPicture) {
vendor: 7,899 bytes, lines 553-770
553 forEach.call(parent.getElementsByTagName("source"), handleSources); 554 } 555 if (srcset) { 556 elem.setAttribute("srcset", srcset); 557 } else if (src && !isPicture) { 558 if (regIframe.test(elem.nodeName)) { 559 changeIframeSrc(elem, src); 560 } else { 561 elem.src = src; 562 } 563 } 564 if (isImg && (srcset || isPicture)) { 565 updatePolyfill(elem, { src }); 566 } 567 } 568 if (elem._lazyRace) { 569 delete elem._lazyRace; 570 } 571 removeClass(elem, lazySizesCfg.lazyClass); 572 rAF(function() { 573 var isLoaded = elem.complete && elem.naturalWidth > 1; 574 if (!firesLoad || isLoaded) { 575 if (isLoaded) { 576 addClass(elem, lazySizesCfg.fastLoadedClass); 577 } 578 switchLoadingClass(event); 579 elem._lazyCache = true; 580 setTimeout2(function() { 581 if ("_lazyCache" in elem) { 582 delete elem._lazyCache; 583 } 584 }, 9); 585 } 586 if (elem.loading == "lazy") { 587 isLoading--; 588 } 589 }, true); 590 }); 591 var unveilElement = function(elem) { 592 if (elem._lazyRace) { 593 return; 594 } 595 var detail; 596 var isImg = regImg.test(elem.nodeName); 597 var sizes = isImg && (elem[_getAttribute](lazySizesCfg.sizesAttr) || elem[_getAttribute]("sizes")); 598 var isAuto = sizes == "auto"; 599 if ((isAuto || !isCompleted) && isImg && (elem[_getAttribute]("src") || elem.srcset) && !elem.complete && !hasClass(elem, lazySizesCfg.errorClass) && hasClass(elem, lazySizesCfg.lazyClass)) { 600 return; 601 } 602 detail = triggerEvent(elem, "lazyunveilread").detail; 603 if (isAuto) { 604 autoSizer.updateElem(elem, true, elem.offsetWidth); 605 } 606 elem._lazyRace = true; 607 isLoading++; 608 lazyUnveil(elem, detail, isAuto, sizes, isImg); 609 }; 610 var afterScroll = debounce2(function() { 611 lazySizesCfg.loadMode = 3; 612 throttledCheckElements(); 613 }); 614 var altLoadmodeScrollListner = function() { 615 if (lazySizesCfg.loadMode == 3) { 616 lazySizesCfg.loadMode = 2; 617 } 618 afterScroll(); 619 }; 620 var onload = function() { 621 if (isCompleted) { 622 return; 623 } 624 if (Date2.now() - started < 999) { 625 setTimeout2(onload, 999); 626 return; 627 } 628 isCompleted = true; 629 lazySizesCfg.loadMode = 3; 630 throttledCheckElements(); 631 addEventListener("scroll", altLoadmodeScrollListner, true); 632 }; 633 return { 634 _: function() { 635 started = Date2.now(); 636 lazysizes2.elements = document2.getElementsByClassName(lazySizesCfg.lazyClass); 637 preloadElems = document2.getElementsByClassName(lazySizesCfg.lazyClass + " " + lazySizesCfg.preloadClass); 638 addEventListener("scroll", throttledCheckElements, true); 639 addEventListener("resize", throttledCheckElements, true); 640 addEventListener("pageshow", function(e) { 641 if (e.persisted) { 642 var loadingElements = document2.querySelectorAll("." + lazySizesCfg.loadingClass); 643 if (loadingElements.length && loadingElements.forEach) { 644 requestAnimationFrame(function() { 645 loadingElements.forEach(function(img) { 646 if (img.complete) { 647 unveilElement(img); 648 } 649 }); 650 }); 651 } 652 } 653 }); 654 if (window2.MutationObserver) { 655 new MutationObserver(throttledCheckElements).observe(docElem, { childList: true, subtree: true, attributes: true }); 656 } else { 657 docElem[_addEventListener]("DOMNodeInserted", throttledCheckElements, true); 658 docElem[_addEventListener]("DOMAttrModified", throttledCheckElements, true); 659 setInterval(throttledCheckElements, 999); 660 } 661 addEventListener("hashchange", throttledCheckElements, true); 662 ["focus", "mouseover", "click", "load", "transitionend", "animationend"].forEach(function(name) { 663 document2[_addEventListener](name, throttledCheckElements, true); 664 }); 665 if (/d$|^c/.test(document2.readyState)) { 666 onload(); 667 } else { 668 addEventListener("load", onload); 669 document2[_addEventListener]("DOMContentLoaded", throttledCheckElements); 670 setTimeout2(onload, 2e4); 671 } 672 if (lazysizes2.elements.length) { 673 checkElements(); 674 rAF._lsFlush(); 675 } else { 676 throttledCheckElements(); 677 } 678 }, 679 checkElems: throttledCheckElements, 680 unveil: unveilElement, 681 _aLSL: altLoadmodeScrollListner 682 }; 683 }(); 684 var autoSizer = function() { 685 var autosizesElems; 686 var sizeElement = rAFIt(function(elem, parent, event, width) { 687 var sources, i, len; 688 elem._lazysizesWidth = width; 689 width += "px"; 690 elem.setAttribute("sizes", width); 691 if (regPicture.test(parent.nodeName || "")) { 692 sources = parent.getElementsByTagName("source"); 693 for (i = 0, len = sources.length; i < len; i++) { 694 sources[i].setAttribute("sizes", width); 695 } 696 } 697 if (!event.detail.dataAttr) { 698 updatePolyfill(elem, event.detail); 699 } 700 }); 701 var getSizeElement = function(elem, dataAttr, width) { 702 var event; 703 var parent = elem.parentNode; 704 if (parent) { 705 width = getWidth(elem, parent, width); 706 event = triggerEvent(elem, "lazybeforesizes", { width, dataAttr: !!dataAttr }); 707 if (!event.defaultPrevented) { 708 width = event.detail.width; 709 if (width && width !== elem._lazysizesWidth) { 710 sizeElement(elem, parent, event, width); 711 } 712 } 713 } 714 }; 715 var updateElementsSizes = function() { 716 var i; 717 var len = autosizesElems.length; 718 if (len) { 719 i = 0; 720 for (; i < len; i++) { 721 getSizeElement(autosizesElems[i]); 722 } 723 } 724 }; 725 var debouncedUpdateElementsSizes = debounce2(updateElementsSizes); 726 return { 727 _: function() { 728 autosizesElems = document2.getElementsByClassName(lazySizesCfg.autosizesClass); 729 addEventListener("resize", debouncedUpdateElementsSizes); 730 }, 731 checkElems: debouncedUpdateElementsSizes, 732 updateElem: getSizeElement 733 }; 734 }(); 735 var init = function() { 736 if (!init.i && document2.getElementsByClassName) { 737 init.i = true; 738 autoSizer._(); 739 loader._(); 740 } 741 }; 742 setTimeout2(function() { 743 if (lazySizesCfg.init) { 744 init(); 745 } 746 }); 747 lazysizes2 = { 748 /** 749 * @type { LazySizesConfigPartial } 750 */ 751 cfg: lazySizesCfg, 752 autoSizer, 753 loader, 754 init, 755 uP: updatePolyfill, 756 aC: addClass, 757 rC: removeClass, 758 hC: hasClass, 759 fire: triggerEvent, 760 gW: getWidth, 761 rAF 762 }; 763 return lazysizes2; 764 } 765 ); 766})(lazysizes); 767function smoothScroll() { 768 $$1('a[href*="#"]').not('[href="#"]').not('[href="#0"]').click(function(event) { 769 var scrollElem = "html, body"; 770 var innerScroll = false;
771 var focusShift = true; 772 var self = $$1(this); 773 if (self.attr("data-scroll-element")) { 774 innerScroll = true; 775 scrollElem = self.attr("data-scroll-element"); 776 } 777 if (self.attr("data-focus-shift") == "false") { 778 focusShift = false; 779 } 780 if (location.pathname.replace(/^\//, "") == this.pathname.replace(/^\//, "") && location.hostname == this.hostname) { 781 var target = $$1(this.hash); 782 target = target.length ? target : $$1("[name=" + this.hash.slice(1) + "]"); 783 if (target.length) { 784 event.preventDefault(); 785 var offset = target.offset().top; 786 if (innerScroll) { 787 offset = target.position().top; 788 } 789 var $scroll_animation_duration = window.matchMedia( 790 "(prefers-reduced-motion: reduce)" 791 ).matches ? 0 : 1e3; 792 $$1(scrollElem).animate( 793 { 794 scrollTop: offset - $$1(".header-main").outerHeight() 795 }, 796 $scroll_animation_duration, 797 function() { 798 if (focusShift) { 799 var $target = $$1(target); 800 $target.focus(); 801 if ($target.is(":focus")) { 802 return false; 803 } else { 804 $target.attr("tabindex", "-1"); 805 var x = window.scrollX, y = window.scrollY; 806 $target.focus(); 807 window.scrollTo(x, y); 808 return $target; 809 } 810 } 811 } 812 ); 813 } 814 } 815 }); 816} 817class Accordion { 818 constructor(node) { 819 if (!node) return; 820 this.node = node; 821 this.trigger = this.node.querySelector("[data-accordion-trigger]"); 822 this.panel = this.node.querySelector("[data-accordion-panel]"); 823 this.group = this.trigger.getAttribute("data-accordion-group"); 824 this.breakpoint = this.node.getAttribute("data-breakpoint"); 825 this.boundToggle = this.toggle.bind(this); 826 this.init(); 827 } 828 init() { 829 this.trigger.addEventListener("click", this.boundToggle); 830 } 831 toggle() { 832 const isExpanded = this.trigger.getAttribute("aria-expanded") === "true"; 833 this.expandPanel(this.trigger, !isExpanded ? true : false); 834 if (this.group && !isExpanded) { 835 const accordionsInGroup = document.querySelectorAll( 836 `[aria-expanded="true"][data-accordion-group="${this.group}"]:not([aria-controls="${this.trigger.getAttribute( 837 "aria-controls" 838 )}"])` 839 ); 840 accordionsInGroup.forEach((accordion) => { 841 this.expandPanel(accordion, false); 842 }); 843 } 844 } 845 expandPanel(trigger, isExpanded) { 846 const panel = document.getElementById( 847 trigger.getAttribute("aria-controls") 848 ); 849 trigger.setAttribute("aria-expanded", isExpanded ? "true" : "false"); 850 this.node.classList.toggle("open", isExpanded); 851 if (panel) { 852 panel.setAttribute("data-expanded", isExpanded ? "true" : "false"); 853 } 854 } 855} 856function accordionCookies() { 857 const theAccordionCookies = Array.prototype.slice.call( 858 document.querySelectorAll(".accordion-cookies") 859 ); 860 if (theAccordionCookies.length) { 861 theAccordionCookies.forEach((accordionCookies2) => { 862 const head = accordionCookies2.querySelector( 863 ".accordion-cookies__head" 864 ); 865 const panel = accordionCookies2.querySelector( 866 ".accordion-cookies__panel" 867 ); 868 const pinner = accordionCookies2.querySelector( 869 ".accordion-cookies__panel__inner" 870 ); 871 const accordionCookiesIsActive = () => accordionCookies2.classList.contains("is-active"); 872 pinner.setAttribute("hidden", "hidden"); 873 panel.addEventListener("transitionend", () => panel.style = ""); 874 const openPanel = () => { 875 panel.style.maxHeight = "0px"; 876 panel.style.overflow = "hidden"; 877 void panel.offsetHeight; 878 panel.style.transition = "max-height 0.5s cubic-bezier(0.2, 0, 0, 1)"; 879 panel.style.maxHeight = panel.scrollHeight + "px"; 880 accordionCookies2.classList.add("is-active"); 881 head.setAttribute("aria-expanded", true); 882 }; 883 const closePanel = () => { 884 panel.style.maxHeight = panel.scrollHeight + "px"; 885 panel.style.transition = "max-height 0.5s cubic-bezier(0.2, 0, 0, 1)"; 886 panel.style.overflow = "hidden"; 887 void panel.offsetHeight; 888 panel.style.maxHeight = "0px"; 889 accordionCookies2.classList.remove("is-active"); 890 head.setAttribute("aria-expanded", false); 891 }; 892 head.addEventListener("click", () => { 893 if (!accordionCookiesIsActive()) { 894 pinner.removeAttribute("hidden");
895 openPanel(); 896 } else { 897 closePanel(); 898 setTimeout(function() { 899 pinner.setAttribute("hidden", "hidden"); 900 }, 500); 901 } 902 }); 903 }); 904 } 905} 906function inactiveCookiesForm() { 907 $$1(function() { 908 $$1(".reactivate-inactive-cookie-btn").each(function() { 909 var btn = $$1(this); 910 btn.click(function() { 911 $$1.ajax({ 912 type: "POST", 913 url: btn.data("href"), 914 data: {}, 915 dataType: "json", 916 headers: { 917 "X-CSRF-TOKEN": btn.data("csrf") 918 } 919 }).done(function(response) { 920 if (response.success) { 921 btn.closest("tr").remove(); 922 } 923 window.location.reload(); 924 }); 925 return false; 926 }); 927 }); 928 $$1(".delete-inactive-cookie-btn").each(function() { 929 var btn = $$1(this); 930 btn.click(function() { 931 if (confirm( 932 "This will remove the cookie from your database. It will be re-added if detected in a future scan." 933 )) { 934 $$1.ajax({ 935 type: "POST", 936 url: btn.data("href"), 937 data: {}, 938 dataType: "json", 939 headers: { 940 "X-CSRF-TOKEN": btn.data("csrf") 941 } 942 }).done(function(response) { 943 var accordion = btn.closest(".accordion-cookies"); 944 var accordion_title = accordion.find("span.accordion-title").text(title); 945 if (response.success) { 946 btn.closest("tr").remove(); 947 } 948 var count = accordion.find("tbody tr").length; 949 var title = "Inactive Cookies (" + count + ")"; 950 accordion_title.text(title); 951 if (count == 0) { 952 accordion.hide(); 953 } 954 }); 955 } 956 return false; 957 }); 958 }); 959 }); 960} 961function inactiveStorageItemsForm() { 962 $$1(function() { 963 $$1(".reactivate-inactive-storage-item-btn").each(function() { 964 var btn = $$1(this); 965 btn.click(function() { 966 $$1.ajax({ 967 type: "POST", 968 url: btn.data("href"), 969 data: {}, 970 dataType: "json", 971 headers: { 972 "X-CSRF-TOKEN": btn.data("csrf") 973 } 974 }).done(function(response) { 975 if (response.success) { 976 btn.closest("tr").remove(); 977 } 978 window.location.reload(); 979 }); 980 return false; 981 }); 982 }); 983 $$1(".delete-inactive-storage-item-btn").each(function() { 984 var btn = $$1(this); 985 btn.click(function() { 986 if (confirm( 987 "This will remove the storage item from your database. It will be re-added if detected in a future scan." 988 )) { 989 $$1.ajax({ 990 type: "POST", 991 url: btn.data("href"), 992 data: {}, 993 dataType: "json", 994 headers: { 995 "X-CSRF-TOKEN": btn.data("csrf") 996 } 997 }).done(function(response) { 998 if (response.success) { 999 btn.closest("tr").remove(); 1000 } 1001 }); 1002 } 1003 return false; 1004 }); 1005 }); 1006 }); 1007} 1008class Dropdown { 1009 constructor(selector, config = { 1010 arguments: {}, 1011 events: {} 1012 }) { 1013 this.selector = selector; 1014 this.config = config; 1015 this.elements = document.querySelectorAll(this.selector); 1016 this.arguments = this.config.arguments; 1017 this.toggleSelector = this.config.toggleSelector; 1018 if (this.elements.length === 0) { 1019 return; 1020 } 1021 this.mount(); 1022 } 1023 mount() { 1024 if (this.config.events) { 1025 Object.keys(this.config.events).forEach((eventName) => { 1026 let eventCallback = this.config.events[eventName]; 1027 this.elements.forEach( 1028 (el) => el.addEventListener(eventName, eventCallback, { 1029 passive: true, 1030 once: false 1031 }) 1032 ); 1033 }); 1034 } 1035 this.init(); 1036 } 1037 init() { 1038 this.elements.forEach((el) => { 1039 const toggle = el.querySelector(this.toggleSelector); 1040 if (!toggle) return; 1041 toggle.addEventListener("click", () => { 1042 this.expandPanel( 1043 toggle, 1044 toggle.getAttribute("aria-expanded") == "false" ? true : false 1045 ); 1046 document.onkeyup = (e) => { 1047 e = e || window.event; 1048 let isEscape = false;
1049 if ("key" in e) { 1050 isEscape = e.key === "Escape" || e.key === "Esc"; 1051 } else { 1052 isEscape = e.keyCode === 27; 1053 } 1054 if (isEscape) { 1055 if (toggle.getAttribute("aria-expanded") === "true") { 1056 this.expandPanel(toggle, false); 1057 toggle.focus(); 1058 } 1059 } 1060 }; 1061 const clickOutsideHandler = (event) => { 1062 const isClickInside = el.contains(event.target); 1063 if (!isClickInside) { 1064 this.expandPanel(toggle, false); 1065 document.removeEventListener( 1066 "click", 1067 clickOutsideHandler 1068 ); 1069 } 1070 }; 1071 document.addEventListener("click", clickOutsideHandler); 1072 }); 1073 }); 1074 } 1075 expandPanel(toggle, isExpanded) { 1076 const target = document.getElementById( 1077 toggle.getAttribute("aria-controls") 1078 ); 1079 toggle.setAttribute("aria-expanded", isExpanded ? "true" : "false"); 1080 if (target) { 1081 target.setAttribute("data-expanded", isExpanded ? "true" : "false"); 1082 } 1083 if (!target) { 1084 return; 1085 } 1086 const links = [ 1087 ...target.querySelectorAll("a"), 1088 ...target.querySelectorAll("button") 1089 ]; 1090 if (links) { 1091 links.forEach((link) => { 1092 const handleLinkClick = () => { 1093 this.expandPanel(toggle, false); 1094 toggle.focus(); 1095 link.removeEventListener("click", handleLinkClick); 1096 }; 1097 link.addEventListener("click", handleLinkClick); 1098 }); 1099 } 1100 } 1101} 1102class DropdownToggle { 1103 constructor(node) { 1104 if (!node) return; 1105 this.node = node; 1106 this.current = this.node.querySelector("[data-dropdown-current]"); 1107 this.selects = this.node.querySelectorAll("[data-dropdown-select]"); 1108 this.input = this.node.querySelector("[data-dropdown-value]"); 1109 this.defaultValue = this.input ? this.input.value : null; 1110 this.init(); 1111 } 1112 init() { 1113 this.selects.forEach((select) => { 1114 select.addEventListener("click", () => { 1115 this.select(select); 1116 }); 1117 }); 1118 if (this.input && this.input.form) { 1119 this.input.form.addEventListener("reset", () => { 1120 const fallback = [...this.selects].find( 1121 (select) => select.getAttribute("data-value") === this.defaultValue 1122 ); 1123 if (fallback) { 1124 this.select(fallback, true); 1125 } 1126 }); 1127 } 1128 } 1129 select(option, silent = false) { 1130 if (this.current) { 1131 this.current.innerHTML = option.innerHTML; 1132 } 1133 this.selects.forEach((select) => { 1134 select.classList.toggle("is-active", select === option); 1135 }); 1136 if (this.input && option.hasAttribute("data-value")) { 1137 this.input.value = option.getAttribute("data-value"); 1138 if (!silent) { 1139 this.input.dispatchEvent(new Event("change", { bubbles: true })); 1140 } 1141 } 1142 } 1143} 1144function colorPicker() { 1145 const fields = document.querySelectorAll(".widget-color"); 1146 const hexRegex = /^#?[A-Fa-f0-9]{0,6}$/; 1147 fields.forEach((field) => { 1148 const picker = field.querySelector(".widget-color__input"); 1149 const text = field.querySelector(".widget-color__value"); 1150 let textValue = text.value; 1151 picker.addEventListener("input", () => { 1152 text.value = picker.value.toUpperCase(); 1153 }); 1154 text.addEventListener("input", (e) => { 1155 if (!hexRegex.test(text.value)) text.value = textValue; 1156 textValue = text.value; 1157 }); 1158 text.addEventListener("change", () => { 1159 text.value = text.value.toUpperCase(); 1160 if (text.value[0] !== "#") { 1161 text.value = "#" + text.value; 1162 } 1163 const withoutHash = text.value.slice(1); 1164 if (withoutHash.length < 6) { 1165 const padZeroes = new Array(6 - withoutHash.length).fill("0").join(""); 1166 text.value += padZeroes; 1167 } 1168 if (hexRegex.test(text.value)) { 1169 picker.value = text.value; 1170 picker.dispatchEvent(new Event("input")); 1171 textValue = text.value; 1172 } 1173 }); 1174 }); 1175} 1176function widgetLanguage() { 1177 const languageDropdown = document.getElementById("languageSelect"); 1178 if (languageDropdown) { 1179 languageDropdown.addEventListener("change", () => { 1180 document.querySelectorAll(".widget-content-language").forEach((element) => { 1181 element.style.display = "none"; 1182 element.removeAttribute("data-active-language"); 1183 }); 1184 const contentToShow = document.querySelector( 1185 `[data-content-id="${languageDropdown.value}"]` 1186 ); 1187 if (contentToShow) { 1188 contentToShow.style.display = "block"; 1189 contentToShow.dataset.activeLanguage = "true"; 1190 } 1191 }); 1192 } 1193} 1194function restoreWidgetMessageOnClick() { 1195 const field = document.querySelector("#widget-message"); 1196 const button = document.querySelector("#widget-message-reset"); 1197 if (field && button) { 1198 button.addEventListener("click", () => { 1199 field.value = button.dataset.reset; 1200 field.dispatchEvent(new Event("change")); 1201 }); 1202 } 1203} 1204const widgetPreview = () => { 1205 const iframe = document.querySelector("#widget-preview-iframe"); 1206 const iframeWindow = iframe && iframe.contentWindow; 1207 const themeInputs = document.querySelectorAll( 1208 "[data-update-preview-theme]" 1209 ); 1210 const appearanceInputs = document.querySelectorAll( 1211 "[data-update-preview-appearance]" 1212 ); 1213 const positionsRadioGroup = document.getElementById( 1214 "widget-radio-group-embed_config[layout][position]" 1215 ); 1216 const positionInputs = document.querySelectorAll( 1217 "[data-update-preview-position]" 1218 ); 1219 const preferencesInputs = document.querySelectorAll( 1220 "[data-update-preview-preferences]" 1221 ); 1222 const blockInteractionInputs = document.querySelectorAll( 1223 "[data-update-preview-block-interaction]" 1224 ); 1225 const rejectInputs = document.querySelectorAll( 1226 "[data-update-preview-reject-all]" 1227 ); 1228 const updatePreferenceInputs = document.querySelectorAll( 1229 "[data-update-preview-update-after-close]" 1230 ); 1231 const reopenButtonPositionInputs = document.querySelectorAll( 1232 "[data-update-preview-reopen-button-position]" 1233 ); 1234 const cookiePolicyLanguageDropdown = document.querySelector( 1235 "[data-update-preview-language]" 1236 ); 1237 const widgetContentFieldMap = { 1238 "[data-update-preview-policy]": "updateCookiePolicyUrl", 1239 "[data-update-preview-link-text]": "updateCookiePolicyLinkText", 1240 "[data-update-after-close-button-color]": "updateAfterCloseButtonColor", 1241 "[data-update-make-all-buttons-primary]": "makeAllBtnPrimary", 1242 "[data-update-dialog-title]": "updateDialogTitle", 1243 "[data-update-dialog-message]": "updateDialogMessage", 1244 "[data-update-dialog-save-preferences-button]": "updateDialogSavePreferences", 1245 "[data-update-dialog-accept-all-button]": "updateDialogAcceptAll", 1246 "[data-update-dialog-reject-all-button]": "updateDialogRejectAll", 1247 "[data-update-preview-message]": "updateMessage", 1248 "[data-update-widget-pill-message]": "updatePillMessage", 1249 "[data-update-widget-banner-title]": "updateBannerTitle", 1250 "[data-update-widget-manage-preferences-button]": "updateWidgetManagePreferences", 1251 "[data-update-widget-reject-all-button]": "updateWidgetRejectAllButton", 1252 "[data-update-widget-accept-all-button]": "updateWidgetAcceptAllButton", 1253 "[data-update-preview-update-after-close]": "updateShowPreferencesAfterClose", 1254 "[data-update-widget-show-cookies-button]": "updateWidgetShowCookiesButton",
1255 "[data-update-widget-hide-cookies-button]": "updateWidgetHideCookiesButton", 1256 "[data-update-cookie-essential-title]": "updateEssentialTitle", 1257 "[data-update-cookie-essential-description]": "updateEssentialDescription", 1258 "[data-update-cookie-functional-title]": "updateFunctionalTitle", 1259 "[data-update-cookie-functional-description]": "updateFunctionalDescription", 1260 "[data-update-cookie-marketing-title]": "updateMarketingTitle", 1261 "[data-update-cookie-marketing-description]": "updateMarketingDescription", 1262 "[data-update-cookie-analytics-title]": "updateAnalyticsTitle", 1263 "[data-update-cookie-analytics-description]": "updateAnalyticsDescription", 1264 "[data-update-cookie-unclassified-title]": "updateUnclassifiedTitle", 1265 "[data-update-cookie-unclassified-description]": "updateUnclassifiedDescription", 1266 "[data-update-cookie-heading-platform]": "updateCookieHeadingPlatform", 1267 "[data-update-cookie-heading-name-description]": "updateCookieHeadingNameDescription", 1268 "[data-update-cookie-heading-retention]": "updateCookieHeadingRetention", 1269 "[data-update-storage-heading]": "updateStorageHeading", 1270 "[data-update-storage-heading-type]": "updateStorageHeadingType", 1271 "[data-update-storage-heading-name]": "updateStorageHeadingName", 1272 "[data-update-storage-heading-origin]": "updateStorageHeadingOrigin" 1273 }; 1274 const widgetFullPreviewButton = document.querySelector( 1275 "#widget-preview-full" 1276 ); 1277 let isWidgetPreviewShowing = false; 1278 document.addEventListener("previewUpdate", (event) => { 1279 const eventData = event.detail.data; 1280 const reinit = event.detail.reinit; 1281 widgetPreviewUpdateEventHandler( 1282 eventData, 1283 reinit && isWidgetPreviewShowing 1284 ); 1285 iframeWindow.postMessage({ data: eventData, reinit }); 1286 }); 1287 function triggerPreviewUpdate(data, reinit = true) { 1288 document.dispatchEvent( 1289 new CustomEvent("previewUpdate", { detail: { data, reinit } }) 1290 ); 1291 } 1292 if (iframeWindow) {
1293 window.gtCookieWidgetConfig = JSON.parse(iframe.dataset.config); 1294 themeInputs.forEach( 1295 (input) => input.addEventListener("input", () => { 1296 triggerPreviewUpdate( 1297 { 1298 type: "updateTheme", 1299 value: { 1300 variable: input.dataset.updatePreviewTheme, 1301 value: input.value 1302 } 1303 }, 1304 true 1305 ); 1306 }) 1307 ); 1308 appearanceInputs.forEach( 1309 (input) => input.addEventListener("change", () => { 1310 if (input.checked) { 1311 triggerPreviewUpdate( 1312 { 1313 type: "updateAppearance", 1314 value: input.value 1315 }, 1316 true 1317 ); 1318 positionsRadioGroup.classList.toggle( 1319 "hide", 1320 input.value === "banner" || input.value === "popup" 1321 ); 1322 } 1323 }) 1324 ); 1325 positionInputs.forEach( 1326 (input) => input.addEventListener("change", () => { 1327 if (input.checked) { 1328 triggerPreviewUpdate( 1329 { 1330 type: "updatePosition", 1331 value: input.value 1332 }, 1333 true 1334 ); 1335 } 1336 }) 1337 ); 1338 preferencesInputs.forEach( 1339 (input) => input.addEventListener("change", () => { 1340 if (input.checked) { 1341 triggerPreviewUpdate( 1342 { 1343 type: "updateAllowPreferences", 1344 value: input.value 1345 }, 1346 true 1347 ); 1348 } 1349 }) 1350 ); 1351 blockInteractionInputs.forEach( 1352 (input) => input.addEventListener("change", () => { 1353 if (input.checked) { 1354 triggerPreviewUpdate( 1355 { 1356 type: "updateBlockInteraction", 1357 value: input.value 1358 }, 1359 true 1360 ); 1361 } 1362 }) 1363 ); 1364 rejectInputs.forEach( 1365 (input) => input.addEventListener("change", () => { 1366 if (input.checked) { 1367 triggerPreviewUpdate( 1368 { 1369 type: "updateRejectAll", 1370 value: input.value 1371 }, 1372 true 1373 ); 1374 } 1375 }) 1376 ); 1377 updatePreferenceInputs.forEach( 1378 (input) => input.addEventListener("change", () => { 1379 if (input.checked) { 1380 triggerPreviewUpdate( 1381 { 1382 type: "updateShowPreferencesAfterClose", 1383 value: input.value 1384 }, 1385 true 1386 ); 1387 } 1388 }) 1389 ); 1390 reopenButtonPositionInputs.forEach( 1391 (input) => input.addEventListener("change", () => { 1392 if (input.checked) { 1393 triggerPreviewUpdate( 1394 { 1395 type: "updateReopenButtonPosition", 1396 value: input.value 1397 }, 1398 false 1399 ); 1400 } 1401 }) 1402 ); 1403 if (cookiePolicyLanguageDropdown) { 1404 cookiePolicyLanguageDropdown.addEventListener("change", () => { 1405 const languageContainer = document.querySelector( 1406 `[data-content-id="${cookiePolicyLanguageDropdown.value}"` 1407 ); 1408 if (languageContainer) { 1409 Object.entries(widgetContentFieldMap).forEach( 1410 ([selector, event], index, array) => { 1411 const input = languageContainer.querySelector(selector); 1412 if (input) { 1413 triggerPreviewUpdate( 1414 { 1415 type: event, 1416 value: input.value 1417 }, 1418 index === array.length - 1 1419 ); 1420 } 1421 } 1422 ); 1423 } 1424 }); 1425 } 1426 Object.entries(widgetContentFieldMap).forEach(([selector, event]) => { 1427 const inputs = document.querySelectorAll(selector); 1428 inputs.forEach((input) => { 1429 input.addEventListener("change", (e) => { 1430 triggerPreviewUpdate({ 1431 type: event, 1432 value: input.value 1433 }); 1434 }); 1435 }); 1436 }); 1437 } 1438 if (widgetFullPreviewButton) { 1439 widgetFullPreviewButton.addEventListener("click", () => { 1440 const scriptTag = document.querySelector("#widget-script"); 1441 const textTag = widgetFullPreviewButton.querySelector(".inner"); 1442 isWidgetPreviewShowing = !isWidgetPreviewShowing; 1443 updateButton(); 1444 if (isWidgetPreviewShowing) { 1445 if (!scriptTag) { 1446 const script = document.createElement("script"); 1447 script.src = "/build/js/cookie-widget-vue.js"; 1448 script.id = "widget-script"; 1449 script.async = false;
1450 script.onload = () => { 1451 window.gtCookieWidgetPreview(); 1452 document.addEventListener( 1453 "click", 1454 onDocumentClickCheckWidgetDismiss 1455 ); 1456 }; 1457 document.head.appendChild(script); 1458 } else { 1459 window.gtCookieWidgetPreview(); 1460 document.addEventListener( 1461 "click", 1462 onDocumentClickCheckWidgetDismiss 1463 ); 1464 } 1465 } else { 1466 const widget = document.querySelector( 1467 ".gt-cookie-widget-wrapper" 1468 ); 1469 widget && widget.remove(); 1470 document.removeEventListener( 1471 "click", 1472 onDocumentClickCheckWidgetDismiss 1473 ); 1474 } 1475 function updateButton() { 1476 widgetFullPreviewButton.classList.toggle( 1477 "btn--border-primary", 1478 isWidgetPreviewShowing 1479 ); 1480 widgetFullPreviewButton.classList.toggle( 1481 "btn--border-grey", 1482 !isWidgetPreviewShowing 1483 ); 1484 textTag.textContent = isWidgetPreviewShowing ? widgetFullPreviewButton.dataset.hideMessage : widgetFullPreviewButton.dataset.showMessage; 1485 } 1486 function onDocumentClickCheckWidgetDismiss(e) { 1487 if (e.target.closest( 1488 "[data-gt-cookie-accept-all], [data-gt-cookie-save], [data-gt-cookie-reject-all]" 1489 )) { 1490 isWidgetPreviewShowing = false; 1491 updateButton(); 1492 document.removeEventListener( 1493 "click", 1494 onDocumentClickCheckWidgetDismiss 1495 ); 1496 } 1497 } 1498 }); 1499 } 1500}; 1501const widgetTabs = () => { 1502 const preview = document.querySelector(".widget-preview"); 1503 const tabButtons = document.querySelectorAll(".widget-tabs__button"); 1504 const tabPanels = document.querySelectorAll(".widget-tab-panel"); 1505 if (!preview || !tabButtons.length) { 1506 return; 1507 } 1508 function openTabId(id) { 1509 const button = Array.from(tabButtons).find( 1510 (button2) => button2.dataset.tabId === id 1511 ); 1512 const hidePreview = button.dataset.hidePreview !== void 0; 1513 tabButtons.forEach((button2) => { 1514 button2.classList.toggle( 1515 "widget-tabs__button--active", 1516 button2.dataset.tabId === id 1517 ); 1518 }); 1519 tabPanels.forEach((panel) => { 1520 panel.classList.toggle("widget-tab-panel--active", panel.id === id); 1521 }); 1522 preview.classList.toggle("widget-preview--hidden", hidePreview); 1523 } 1524 tabButtons.forEach((button) => { 1525 button.addEventListener("click", () => { 1526 openTabId(button.dataset.tabId); 1527 }); 1528 }); 1529}; 1530const policyContentTabs = () => { 1531 document.addEventListener("click", (e) => { 1532 const button = e.target.closest(".policy-content-tabs .tab-btn"); 1533 if (!button) { 1534 return; 1535 } 1536 const nav = button.closest(".policy-content-tabs"); 1537 const target = button.dataset.tab; 1538 nav.querySelectorAll(".tab-btn").forEach((btn) => { 1539 btn.classList.toggle("is-active", btn === button); 1540 }); 1541 document.querySelectorAll(".tab-content").forEach((content) => { 1542 content.classList.toggle("hidden", content.id !== `tab-${target}`); 1543 }); 1544 }); 1545}; 1546function widgetInstructions() { 1547 var _a, _b; 1548 const googleConsentModeInputs = document.querySelectorAll( 1549 "[data-update-consent-mode]" 1550 ); 1551 const instructionSets = document.querySelectorAll("[data-instructions]"); 1552 googleConsentModeInputs.forEach( 1553 (input) => input.addEventListener("change", () => { 1554 if (input.checked) { 1555 switch (input.value) { 1556 case "on": 1557 instructionSets.forEach((el) => { 1558 el.classList.toggle( 1559 "hidden", 1560 el.dataset.instructions !== "consent-mode" 1561 ); 1562 }); 1563 break; 1564 case "off": 1565 instructionSets.forEach((el) => { 1566 el.classList.toggle( 1567 "hidden", 1568 el.dataset.instructions !== "default" 1569 ); 1570 }); 1571 break; 1572 } 1573 } 1574 }) 1575 ); 1576 const instructionSections = document.querySelectorAll("[data-instructions]"); 1577 instructionSections.forEach((section) => { 1578 const dropdown = section.querySelector("[data-installation-language]"); 1579 const embedCode = section.querySelectorAll("[data-embed-code], #code-inner-widget-embed, #code-inner-widget-embed-v2"); 1580 const embedAutoCode = section.querySelector("[data-embed-auto-code]"); 1581 const autoLanguageRadios = section.querySelectorAll("[name='embed_config[functionality][enable_auto_language]']"); 1582 if (!dropdown) return; 1583 let priorValue = dropdown.value; 1584 autoLanguageRadios.forEach((radio) => { 1585 radio.addEventListener("change", () => { 1586 if (radio.checked) { 1587 console.log("Auto language changed to:", radio.value); 1588 if (radio.value === "on") { 1589 if (embedCode && embedCode.length > 0) { 1590 embedCode.forEach((el) => { 1591 if (el.innerHTML.includes("?auto=true")) return; 1592 el.innerHTML = el.innerHTML.replaceAll( 1593 `/${priorValue}`, 1594 `/${priorValue}?auto=true` 1595 ); 1596 createUpdateMessage(el); 1597 }); 1598 } 1599 } else { 1600 if (embedCode && embedCode.length > 0) { 1601 embedCode.forEach((el) => { 1602 el.innerHTML = el.innerHTML.replaceAll( 1603 `?auto=true`, 1604 "" 1605 ); 1606 createUpdateMessage(el); 1607 }); 1608 } 1609 } 1610 } 1611 }); 1612 }); 1613 dropdown.addEventListener("change", () => { 1614 if (embedCode && embedCode.length > 0) { 1615 embedCode.forEach((el) => { 1616 el.innerHTML = el.innerHTML.replaceAll( 1617 `/${priorValue}`, 1618 `/${dropdown.value}` 1619 ); 1620 createUpdateMessage(el); 1621 }); 1622 } 1623 if (embedAutoCode) { 1624 embedAutoCode.innerHTML = embedAutoCode.innerHTML.replaceAll( 1625 `/${priorValue}?auto=true`, 1626 `/${dropdown.value}?auto=true` 1627 ); 1628 } 1629 priorValue = dropdown.value; 1630 }); 1631 }); 1632 const debugRadios = document.querySelectorAll("[data-installation-debug-toggle]"); 1633 if (debugRadios && debugRadios.length) { 1634 const container = document.getElementById("widget-installation"); 1635 const endpoint = container ? container.dataset.debugUrl : null; 1636 const csrf = (_a = document.querySelector('meta[name="csrf-token"]')) == null ? void 0 : _a.getAttribute("content"); 1637 debugRadios.forEach((radio) => { 1638 radio.addEventListener("change", async () => { 1639 if (!radio.checked) return; 1640 const enable = radio.value === "on"; 1641 const embeds = document.querySelectorAll("[data-embed-code], #code-inner-widget-embed, #code-inner-widget-embed-v2"); 1642 embeds.forEach((el) => { 1643 const updated = updateEmbedCodeDebug(el.innerHTML, enable); 1644 if (updated !== el.innerHTML) { 1645 el.innerHTML = updated; 1646 createUpdateMessage(el); 1647 } 1648 }); 1649 if (endpoint) { 1650 try { 1651 const res = await fetch(endpoint, { 1652 method: "POST", 1653 headers: { 1654 "Content-Type": "application/json", 1655 "Accept": "application/json", 1656 ...csrf ? { "X-CSRF-TOKEN": csrf }
1656 : {} 1657 }, 1658 body: JSON.stringify({ _value: enable ? "on" : "off" }), 1659 credentials: "same-origin" 1660 }); 1661 if (!res.ok) throw new Error("Network error"); 1662 const data = await res.json(); 1663 const firstEl = embeds[0] || container; 1664 if (firstEl) createUpdateMessage(firstEl, "Debug mode saved"); 1665 } catch (e) { 1666 const groupName = radio.getAttribute("name"); 1667 const other = document.querySelector(`input[name="${groupName}"][value="${enable ? "off" : "on"}"]`); 1668 if (other) other.checked = true; 1669 const firstEl = embeds[0] || container; 1670 if (firstEl) createUpdateMessage(firstEl, "Failed to save debug mode"); 1671 } 1672 } 1673 }); 1674 }); 1675 } 1676 const diagRadios = document.querySelectorAll("[data-installation-diagnostics-toggle]"); 1677 if (diagRadios && diagRadios.length) { 1678 const container = document.getElementById("widget-installation"); 1679 const endpoint = container ? container.dataset.diagnosticsUrl : null; 1680 const csrf = document.querySelector('meta[name="csrf-token"]').getAttribute("content"); 1681 const issuesSection = document.getElementById("installation-issues"); 1682 diagRadios.forEach((radio) => { 1683 radio.addEventListener("change", async () => { 1684 if (!radio.checked) return; 1685 const enable = radio.value === "on"; 1686 if (issuesSection) { 1687 if (!enable) { 1688 issuesSection.classList.add("hidden"); 1689 } else { 1690 issuesSection.classList.remove("hidden"); 1691 } 1692 } 1693 if (endpoint) { 1694 try { 1695 const res = await fetch(endpoint, { 1696 method: "POST", 1697 headers: { 1698 "Content-Type": "application/json", 1699 "Accept": "application/json", 1700 ...csrf ? { "X-CSRF-TOKEN": csrf } : {} 1701 }, 1702 body: JSON.stringify({ _value: enable ? "on" : "off" }), 1703 credentials: "same-origin" 1704 }); 1705 if (!res.ok) throw new Error("Network error"); 1706 const target = issuesSection || container; 1707 if (target) createUpdateMessage(target, "Diagnostics setting saved"); 1708 } catch (e) { 1709 const groupName = radio.getAttribute("name"); 1710 const other = document.querySelector(`input[name="${groupName}"][value="${enable ? "off" : "on"}"]`); 1711 if (other) other.checked = true; 1712 const target = issuesSection || container; 1713 if (target) createUpdateMessage(target, "Failed to save diagnostics setting"); 1714 if (issuesSection) { 1715 if (enable) { 1716 issuesSection.classList.add("hidden"); 1717 } else { 1718 issuesSection.classList.remove("hidden"); 1719 } 1720 } 1721 } 1722 } 1723 }); 1724 }); 1725 } 1726 try { 1727 const issuesSection = document.getElementById("installation-issues"); 1728 if (issuesSection) { 1729 const listEl = issuesSection.querySelector(".installation-issues__list"); 1730 const resolveUrl = issuesSection.dataset.diagResolveUrl; 1731 const ignoreUrl = issuesSection.dataset.diagIgnoreUrl; 1732 const csrf = (_b = document.querySelector('meta[name="csrf-token"]')) == null ? void 0 : _b.getAttribute("content"); 1733 issuesSection.addEventListener("click", async (e) => { 1734 const toggle = e.target.closest('button[data-toggle="issue-help"]'); 1735 if (toggle) { 1736 const issue = toggle.closest(".issue"); 1737 const help = issue ? issue.querySelector(".issue__help") : null; 1738 if (help) { 1739 const isHidden = help.style.display === "none"; 1740 help.style.display = isHidden ? "block" : "none"; 1741 toggle.setAttribute("aria-expanded", String(isHidden)); 1742 toggle.textContent = isHidden ? "Hide details" : "What does this mean?"; 1743 } 1744 return; 1745 } 1746 const btn = e.target.closest("button[data-action]"); 1747 if (!btn) return; 1748 const action = btn.dataset.action; 1749 const code = btn.dataset.code; 1750 const url = action === "resolve" ? resolveUrl : ignoreUrl; 1751 btn.disabled = true; 1752 try { 1753 const res = await fetch(url, { 1754 method: "POST", 1755 headers: { 1756 "Content-Type": "application/json", 1757 "Accept": "application/json", 1758 ...csrf ? { "X-CSRF-TOKEN": csrf }
1758 : {} 1759 }, 1760 body: JSON.stringify({ code }), 1761 credentials: "same-origin" 1762 }); 1763 if (!res.ok) throw new Error("Network error"); 1764 const li = btn.closest("li.installation-issues__item"); 1765 if (li) li.remove(); 1766 if (listEl && listEl.children.length === 0) { 1767 issuesSection.remove(); 1768 } 1769 } catch (err) { 1770 btn.disabled = false; 1771 } 1772 }); 1773 } 1774 } catch (e) { 1775 } 1776} 1777function updateEmbedCodeDebug(html, enable) { 1778 try { 1779 const srcMatch = html.match(/src=\"([^\"]+)\"/i); 1780 if (!srcMatch) return html; 1781 let url = srcMatch[1]; 1782 const hasParam = /[?&]getterms_debug=1(?!\d)/.test(url); 1783 if (enable && !hasParam) { 1784 url += (url.includes("?") ? "&" : "?") + "getterms_debug=1"; 1785 } else if (!enable && hasParam) { 1786 url = url.replace(/([?&])getterms_debug=1(&?)/, (m, p1, p2) => { 1787 if (p1 === "?" && p2) return "?"; 1788 if (p1 === "?" && !p2) return ""; 1789 if (p1 === "&" && p2) return "&"; 1790 return ""; 1791 }).replace(/\?$/, ""); 1792 } 1793 return html.replace(srcMatch[1], url); 1794 } catch (e) { 1795 return html; 1796 } 1797} 1798const createUpdateMessage = (el, message = "Embed code updated") => { 1799 const updateMessage = document.createElement("div"); 1800 updateMessage.classList.add("code-block__notification"); 1801 updateMessage.role = "alert"; 1802 updateMessage.ariaAtomic = "true"; 1803 updateMessage.textContent = message; 1804 el.parentNode.appendChild(updateMessage); 1805 setTimeout(() => { 1806 updateMessage.classList.add("is-active"); 1807 }, 100); 1808 setTimeout(() => { 1809 updateMessage.classList.remove("is-active"); 1810 updateMessage.addEventListener("transitionend", function() { 1811 updateMessage.remove(); 1812 }); 1813 }, 2e3); 1814}; 1815function copyText() { 1816 const copyTextButtons = document.querySelectorAll("[data-copy]"); 1817 copyTextButtons.forEach((button) => { 1818 button.addEventListener("click", async () => { 1819 const copyTargetSelector = button.dataset.copy; 1820 const successMessageString = button.dataset.successMessage || "Copied to the clipboard"; 1821 const elementToCopy = document.querySelector(copyTargetSelector); 1822 if (elementToCopy) { 1823 console.log(elementToCopy); 1824 try { 1825 const textToCopy = elementToCopy.innerText.trim(); 1826 await navigator.clipboard.writeText(textToCopy).then(() => { 1827 const isInlineMessage = button.classList.contains("inline-message"); 1828 const buttonLabel = button.querySelector(".btn__label"); 1829 const successMessage = document.createElement("div"); 1830 successMessage.classList.add("clipboard-message"); 1831 successMessage.classList.add(isInlineMessage ? "clipboard-message--inline" : "clipboard-message--fixed"); 1832 successMessage.role = "alert"; 1833 successMessage.ariaAtomic = "true"; 1834 successMessage.innerHTML = "<p>" + successMessageString + "</p>"; 1835 if (isInlineMessage) { 1836 button.parentNode.appendChild(successMessage); 1837 } else { 1838 document.body.appendChild(successMessage); 1839 } 1840 setTimeout(function() { 1841 successMessage.classList.add("is-active"); 1842 if (buttonLabel) { 1843 buttonLabel.textContent = "Copied"; 1844 } 1845 }, 100); 1846 setTimeout(function() { 1847 successMessage.classList.remove("is-active"); 1848 successMessage.addEventListener("transitionend", function() { 1849 successMessage.remove(); 1850 if (buttonLabel) { 1851 buttonLabel.textContent = "Copy"; 1852 } 1853 }); 1854 }, 1500); 1855 }); 1856 } catch (error) { 1857 console.error( 1858 `Failed to copy from selector ${copyTargetSelector}`, 1859 error 1860 ); 1861 } 1862 } else { 1863 console.error( 1864 `Failed to find element using selector ${copyTargetSelector}` 1865 ); 1866 } 1867 }); 1868 }); 1869} 1870function typeDropdown() { 1871 const typeDropdownEl = document.querySelector(".type-dropdown"); 1872 if (typeDropdownEl) { 1873 const button = typeDropdownEl.querySelector("button"); 1874 button.addEventListener("click", () => { 1875 let is_expanded = typeDropdownEl.classList.contains("is-open") ? true : false;
1876 if (!is_expanded) { 1877 typeDropdownEl.querySelector(".types-wrap").removeAttribute("hidden"); 1878 setTimeout(function() { 1879 typeDropdownEl.classList.add("is-open"); 1880 }, 200); 1881 } else { 1882 typeDropdownEl.classList.remove("is-open"); 1883 typeDropdownEl.querySelector("button").focus(); 1884 setTimeout(function() { 1885 typeDropdownEl.querySelector(".types-wrap").setAttribute("hidden", ""); 1886 }, 200); 1887 } 1888 toggleDropdown(button, is_expanded ? false : true); 1889 }); 1890 } 1891 document.addEventListener("keydown", typeEsc, false); 1892 function typeEsc(evt) { 1893 evt = evt || window.event; 1894 if (evt.keyCode == 27) { 1895 typeClose(); 1896 } 1897 } 1898 document.addEventListener( 1899 "click", 1900 (evt) => { 1901 if (!evt.target.classList.contains("type-dropdown") && jQuery(evt.target).parents(".type-dropdown").length === 0) { 1902 typeClose(); 1903 } 1904 }, 1905 false 1906 ); 1907 function typeClose() { 1908 if (typeDropdownEl == null) { 1909 return; 1910 } 1911 typeDropdownEl.classList.remove("is-open"); 1912 setTimeout(function() { 1913 typeDropdownEl.querySelector(".types-wrap").setAttribute("hidden", ""); 1914 }, 200); 1915 } 1916 function toggleDropdown(toggle, is_expanded) { 1917 const target = document.getElementById( 1918 toggle.getAttribute("aria-controls") 1919 ); 1920 toggle.setAttribute("aria-expanded", is_expanded ? "true" : "false"); 1921 if (target) { 1922 target.setAttribute( 1923 "data-expanded", 1924 is_expanded ? "true" : "false" 1925 ); 1926 } 1927 } 1928} 1929function menuToggle() { 1930 const mainNav = document.querySelector(".main-nav"); 1931 const hamburgerSelector = document.querySelectorAll(".js-open-main-nav"); 1932 hamburgerSelector.forEach(function(hamburger) { 1933 hamburger.addEventListener("click", function(e) { 1934 e.preventDefault(); 1935 if (!document.documentElement.classList.contains("is-menu-open")) { 1936 mainNav.removeAttribute("hidden"); 1937 setTimeout(function() { 1938 scrollControl.disable(); 1939 document.documentElement.classList.add("is-menu-open"); 1940 mainNav.querySelector(".title").focus(); 1941 }, 100); 1942 } else { 1943 scrollControl.enable(); 1944 document.documentElement.classList.remove("is-menu-open"); 1945 setTimeout(function() { 1946 mainNav.setAttribute("hidden", ""); 1947 document.querySelector(".hamburger").focus(); 1948 }, 650); 1949 } 1950 }); 1951 }); 1952 document.addEventListener("keydown", menuEsc, false); 1953 function menuEsc(evt) { 1954 evt = evt || window.event; 1955 if (evt.keyCode == 27 && document.documentElement.classList.contains("is-menu-open")) { 1956 scrollControl.enable(); 1957 document.documentElement.classList.remove("is-menu-open"); 1958 setTimeout(function() { 1959 mainNav.setAttribute("hidden", ""); 1960 document.querySelector(".hamburger").focus(); 1961 }, 650); 1962 } 1963 } 1964 const scrollControl = { 1965 scrollContainer: document.scrollingElement || document.documentElement, 1966 scrollTop: null, 1967 originalStyles: null, 1968 enable: () => { 1969 document.body.style.cssText = scrollControl.originalStyles; 1970 scrollControl.scrollContainer.scrollTop = scrollControl.scrollTop; 1971 }, 1972 disable: () => { 1973 scrollControl.scrollTop = scrollControl.scrollContainer.scrollTop; 1974 scrollControl.originalStyles = document.body.style.cssText; 1975 document.body.style.cssText = `overflow: hidden; position: fixed; height: 100%; width: 100%; top: ${-scrollControl.scrollTop}px`; 1976 } 1977 }; 1978} 1979function planSelect() { 1980 const eleContainer = document.querySelector(".hero-home__grid"); 1981 const ele = document.querySelectorAll(".card-plan");
1982 if (eleContainer) { 1983 eleContainer.addEventListener("mouseenter", function() { 1984 if (!eleContainer.classList.contains("is-hovered")) { 1985 eleContainer.classList.add("is-hovered"); 1986 } 1987 }); 1988 eleContainer.addEventListener("mouseleave", function() { 1989 if (eleContainer.classList.contains("is-hovered")) { 1990 eleContainer.classList.remove("is-hovered"); 1991 } 1992 setTimeout(function() { 1993 }, 150); 1994 }); 1995 ele.forEach(function(item) { 1996 item.addEventListener("mouseenter", function() { 1997 if (!item.parentNode.classList.contains("is-active")) { 1998 item.parentNode.classList.add("is-active"); 1999 } 2000 }); 2001 item.addEventListener("mouseleave", function() { 2002 if (item.parentNode.classList.contains("is-active")) { 2003 item.parentNode.classList.remove("is-active"); 2004 } 2005 setTimeout(function() { 2006 }, 150); 2007 }); 2008 }); 2009 } 2010} 2011function comparisonToggle() { 2012 const optionsSection = document.querySelector(".hero-home"); 2013 if (optionsSection) { 2014 const compareBtn = optionsSection.querySelector(".js-compare"); 2015 const inclusionsLists = Array.prototype.slice.call( 2016 optionsSection.querySelectorAll(".js-inclusions") 2017 ); 2018 const compareIsOpen = () => optionsSection.classList.contains("js-compare-open"); 2019 inclusionsLists.forEach((item) => { 2020 item.addEventListener("transitionend", () => { 2021 item.style = ""; 2022 }); 2023 }); 2024 const openCompare = () => { 2025 inclusionsLists.forEach((item) => { 2026 item.style.maxHeight = "0px"; 2027 item.style.overflow = "hidden"; 2028 void item.offsetHeight; 2029 item.style.transition = "max-height 0.5s cubic-bezier(0.2, 0, 0, 1)"; 2030 item.style.maxHeight = item.scrollHeight + "px"; 2031 item.setAttribute("aria-expanded", true); 2032 }); 2033 optionsSection.classList.add("js-compare-open"); 2034 }; 2035 const closeCompare = () => { 2036 inclusionsLists.forEach((item) => { 2037 item.style.maxHeight = item.scrollHeight + "px"; 2038 item.style.transition = "max-height 0.5s cubic-bezier(0.2, 0, 0, 1)"; 2039 item.style.overflow = "hidden"; 2040 void item.offsetHeight; 2041 item.style.maxHeight = "0px"; 2042 item.setAttribute("aria-expanded", false); 2043 }); 2044 optionsSection.classList.remove("js-compare-open"); 2045 }; 2046 compareBtn.addEventListener("click", (e) => { 2047 const span = e.currentTarget.querySelector("span.inner"); 2048 let isOpening = true; 2049 if (compareIsOpen()) { 2050 isOpening = false; 2051 closeCompare(); 2052 } else { 2053 openCompare(); 2054 } 2055 if (span) { 2056 span.innerText = isOpening ? "Hide Comparison" : "Compare Packages"; 2057 } 2058 }); 2059 } 2060} 2061const reviewsTicker = function() { 2062 const reviews2 = document.querySelector(".reviews"); 2063 if (reviews2) { 2064 const reviewsRows = reviews2.querySelectorAll(".reviews__row"); 2065 reviewsRows.forEach((row) => { 2066 const reviewCards = row.querySelectorAll(".card-review"); 2067 reviewCards.forEach((card) => { 2068 const clonedCard = card.cloneNode(true); 2069 row.appendChild(clonedCard); 2070 }); 2071 }); 2072 } 2073}; 2074function addLoader() { 2075 const svg = `<svg aria-hidden="true" style="--icon-width: 1em;" class="stroke" width="14" height="14" viewBox="0 0 14 14" xmlns="http://www.w3.org/2000/svg"><path d="M7 13a6 6 0 1 0-6-6" stroke="#FFF" stroke-width="2" fill="none" fill-rule="evenodd" stroke-linecap="round"/></svg>`; 2076 const loader = document.createElement("div"); 2077 loader.classList.add("loading-icon"); 2078 loader.innerHTML = svg; 2079 return loader; 2080} 2081var HOOKS = [ 2082 "onChange", 2083 "onClose", 2084 "onDayCreate", 2085 "onDestroy", 2086 "onKeyDown", 2087 "onMonthChange", 2088 "onOpen", 2089 "onParseConfig", 2090 "onReady", 2091 "onValueUpdate", 2092 "onYearChange", 2093 "onPreCalendarPosition" 2094]; 2095var defaults = { 2096 _disable: [], 2097 allowInput: false, 2098 allowInvalidPreload: false, 2099 altFormat: "F j, Y", 2100 altInput: false, 2101 altInputClass: "form-control input", 2102 animate: typeof window === "object" && window.navigator.userAgent.indexOf("MSIE") === -1, 2103 ariaDateFormat: "F j, Y", 2104 autoFillDefaultTime: true, 2105 clickOpens: true, 2106 closeOnSelect: true, 2107 conjunction: ", ", 2108 dateFormat: "Y-m-d", 2109 defaultHour: 12, 2110 defaultMinute: 0, 2111 defaultSeconds: 0, 2112 disable: [], 2113 disableMobile: false, 2114 enableSeconds: false, 2115 enableTime: false, 2116 errorHandler: function(err) { 2117 return typeof console !== "undefined" && console.warn(err); 2118 }, 2119 getWeek: function(givenDate) { 2120 var date = new Date(givenDate.getTime()); 2121 date.setHours(0, 0, 0, 0); 2122 date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7); 2123 var week1 = new Date(date.getFullYear(), 0, 4); 2124 return 1 + Math.round(((date.getTime() - week1.getTime()) / 864e5 - 3 + (week1.getDay() + 6) % 7) / 7); 2125 }, 2126 hourIncrement: 1, 2127 ignoredFocusElements: [], 2128 inline: false, 2129 locale: "default", 2130 minuteIncrement: 5, 2131 mode: "single", 2132 monthSelectorType: "dropdown", 2133 nextArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewB
2133ox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>", 2134 noCalendar: false, 2135 now: /* @__PURE__ */ new Date(), 2136 onChange: [], 2137 onClose: [], 2138 onDayCreate: [], 2139 onDestroy: [], 2140 onKeyDown: [], 2141 onMonthChange: [], 2142 onOpen: [], 2143 onParseConfig: [], 2144 onReady: [], 2145 onValueUpdate: [], 2146 onYearChange: [], 2147 onPreCalendarPosition: [], 2148 plugins: [], 2149 position: "auto", 2150 positionElement: void 0, 2151 prevArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>", 2152 shorthandCurrentMonth: false, 2153 showMonths: 1, 2154 static: false, 2155 time_24hr: false, 2156 weekNumbers: false, 2157 wrap: false 2158}; 2159var english = { 2160 weekdays: { 2161 shorthand: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], 2162 longhand: [ 2163 "Sunday", 2164 "Monday", 2165 "Tuesday", 2166 "Wednesday", 2167 "Thursday", 2168 "Friday", 2169 "Saturday" 2170 ] 2171 }, 2172 months: { 2173 shorthand: [ 2174 "Jan", 2175 "Feb", 2176 "Mar", 2177 "Apr", 2178 "May", 2179 "Jun", 2180 "Jul", 2181 "Aug", 2182 "Sep", 2183 "Oct", 2184 "Nov", 2185 "Dec" 2186 ], 2187 longhand: [ 2188 "January", 2189 "February", 2190 "March", 2191 "April", 2192 "May", 2193 "June", 2194 "July", 2195 "August", 2196 "September", 2197 "October", 2198 "November", 2199 "December" 2200 ] 2201 }, 2202 daysInMonth: [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31], 2203 firstDayOfWeek: 0, 2204 ordinal: function(nth) { 2205 var s = nth % 100; 2206 if (s > 3 && s < 21) 2207 return "th"; 2208 switch (s % 10) { 2209 case 1: 2210 return "st"; 2211 case 2: 2212 return "nd"; 2213 case 3: 2214 return "rd"; 2215 default: 2216 return "th"; 2217 } 2218 }, 2219 rangeSeparator: " to ", 2220 weekAbbreviation: "Wk", 2221 scrollTitle: "Scroll to increment", 2222 toggleTitle: "Click to toggle", 2223 amPM: ["AM", "PM"], 2224 yearAriaLabel: "Year", 2225 monthAriaLabel: "Month", 2226 hourAriaLabel: "Hour", 2227 minuteAriaLabel: "Minute", 2228 time_24hr: false 2229}; 2230var pad = function(number, length) { 2231 if (length === void 0) { 2232 length = 2; 2233 } 2234 return ("000" + number).slice(length * -1); 2235}; 2236var int = function(bool) { 2237 return bool === true ? 1 : 0; 2238}; 2239function debounce(fn, wait) { 2240 var t; 2241 return function() { 2242 var _this = this; 2243 var args = arguments; 2244 clearTimeout(t); 2245 t = setTimeout(function() { 2246 return fn.apply(_this, args); 2247 }, wait); 2248 }; 2249} 2250var arrayify = function(obj) { 2251 return obj instanceof Array ? obj : [obj]; 2252}; 2253function toggleClass(elem, className, bool) { 2254 if (bool === true) 2255 return elem.classList.add(className); 2256 elem.classList.remove(className); 2257} 2258function createElement(tag, className, content) { 2259 var e = window.document.createElement(tag); 2260 className = className || ""; 2261 content = content || ""; 2262 e.className = className; 2263 if (content !== void 0) 2264 e.textContent = content; 2265 return e; 2266} 2267function clearNode(node) { 2268 while (node.firstChild) 2269 node.removeChild(node.firstChild); 2270} 2271function findParent(node, condition) { 2272 if (condition(node)) 2273 return node; 2274 else if (node.parentNode) 2275 return findParent(node.parentNode, condition); 2276 return void 0; 2277} 2278function createNumberInput(inputClassName, opts) { 2279 var wrapper = createElement("div", "numInputWrapper"), numInput = createElement("input", "numInput " + inputClassName), arrowUp = createElement("span", "arrowUp"), arrowDown = createElement("span", "arrowDown"); 2280 if (navigator.userAgent.indexOf("MSIE 9.0") === -1) { 2281 numInput.type = "number"; 2282 } else { 2283 numInput.type = "text"; 2284 numInput.pattern = "\\d*"; 2285 } 2286 if (opts !== void 0) 2287 for (var key in opts) 2288 numInput.setAttribute(key, opts[key]); 2289 wrapper.appendChild(numInput); 2290 wrapper.appendChild(arrowUp); 2291 wrapper.appendChild(arrowDown); 2292 return wrapper; 2293} 2294function getEventTarget(event) { 2295 try { 2296 if (typeof event.composedPath === "function") { 2297 var path = event.composedPath(); 2298 return path[0]; 2299 } 2300 return event.target; 2301 } catch (error) { 2302 return event.target; 2303 } 2304} 2305var doNothing = function() { 2306 return void 0; 2307}; 2308var monthToStr = function(monthNumber, shorthand, locale) { 2309 return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; 2310}; 2311var revFormat = { 2312 D: doNothing, 2313 F: function(dateObj, monthName, locale) { 2314 dateObj.setMonth(locale.months.longhand.indexOf(monthName)); 2315 }, 2316 G: function(dateObj, hour) { 2317 dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour)); 2318 }, 2319 H: function(dateObj, hour) { 2320 dateObj.setHours(parseFloat(hour)); 2321 }, 2322 J: function(dateObj, day) { 2323 dateObj.setDate(parseFloat(day)); 2324 }, 2325 K: function(dateObj, amPM, locale) { 2326 dateObj.setHours(dateObj.getHours() % 12 + 12 * int(new RegExp(locale.amPM[1], "i").test(amPM))); 2327 }, 2328 M: function(dateObj, shortMonth, locale) { 2329 dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth)); 2330 }, 2331 S: function(dateObj, seconds) { 2332 dateObj.setSeconds(parseFloat(seconds)); 2333 }, 2334 U: function(_2, unixSeconds) { 2335 return new Date(parseFloat(unixSeconds) * 1e3); 2336 }, 2337 W: function(dateObj, weekNum, locale) { 2338 var weekNumber = parseInt(weekNum); 2339 var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0); 2340 date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek); 2341 return date; 2342 }, 2343 Y: function(dateObj, year) { 2344 dateObj.setFullYear(parseFloat(year)); 2345 }, 2346 Z: function(_2, ISODate) { 2347 return new Date(ISODate); 2348 }, 2349 d: function(dateObj, day) { 2350 dateObj.setDate(parseFloat(day)); 2351 }, 2352 h: function(dateObj, hour) { 2353 dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour)); 2354 }, 2355 i: function(dateObj, minutes) { 2356 dateObj.setMinutes(parseFloat(minutes)); 2357 }, 2358 j: function(dateObj, day) { 2359 dateObj.setDate(parseFloat(day)); 2360 }, 2361 l: doNothing, 2362 m: function(dateObj, month) { 2363 dateObj.setMonth(parseFloat(month) - 1); 2364 }, 2365 n: function(dateObj, month) { 2366 dateObj.setMonth(parseFloat(month) - 1); 2367 }, 2368 s: function(dateObj, seconds) { 2369 dateObj.setSeconds(parseFloat(seconds)); 2370 }, 2371 u: function(_2, unixMillSeconds) { 2372 return new Date(parseFloat(unixMillSeconds)); 2373 }, 2374 w: doNothing, 2375 y: function(dateObj, year) { 2376 dateObj.setFullYear(2e3 + parseFloat(year)); 2377 } 2378}; 2379var tokenRegex = { 2380 D: "", 2381 F: "", 2382 G: "(\\d\\d|\\d)", 2383 H: "(\\d\\d|\\d)", 2384 J: "(\\d\\d|\\d)\\w+", 2385 K: "", 2386 M: "", 2387 S: "(\\d\\d|\\d)", 2388 U: "(.+)", 2389 W: "(\\d\\d|\\d)", 2390 Y: "(\\d{4})", 2391 Z: "(.+)", 2392 d: "(\\d\\d|\\d)", 2393 h: "(\\d\\d|\\d)", 2394 i: "(\\d\\d|\\d)", 2395 j: "(\\d\\d|\\d)", 2396 l: "", 2397 m: "(\\d\\d|\\d)", 2398 n: "(\\d\\d|\\d)", 2399 s: "(\\d\\d|\\d)", 2400 u: "(.+)", 2401 w: "(\\d\\d|\\d)", 2402 y: "(\\d{2})" 2403}; 2404var formats = { 2405 Z: function(date) { 2406 return date.toISOString(); 2407 }, 2408 D: function(date, locale, options) { 2409 return locale.weekdays.shorthand[formats.w(date, locale, options)]; 2410 }, 2411 F: function(date, locale, options) { 2412 return monthToStr(formats.n(date, locale, options) - 1, false, locale); 2413 }, 2414 G: function(date, locale, options) { 2415 return pad(formats.h(date, locale, options)); 2416 }, 2417 H: function(date) { 2418 return pad(date.getHours()); 2419 }, 2420 J: function(date, locale) { 2421 return locale.ordinal !== void 0 ? date.getDate() + locale.ordinal(date.getDate()) : date.getDate(); 2422 }, 2423 K: function(date, locale) { 2424 return locale.amPM[int(date.getHours() > 11)]; 2425 }, 2426 M: function(date, locale) { 2427 return monthToStr(date.getMonth(), true, locale); 2428 }, 2429 S: function(date) { 2430 return pad(date.getSeconds()); 2431 }, 2432 U: function(date) { 2433 return date.getTime() / 1e3; 2434 }, 2435 W: function(date, _2, options) { 2436 return options.getWeek(date); 2437 }, 2438 Y: function(date) { 2439 return pad(date.getFullYear(), 4); 2440 }, 2441 d: function(date) { 2442 return pad(date.getDate()); 2443 }, 2444 h: function(date) { 2445 return date.getHours() % 12 ? date.getHours() % 12 : 12; 2446 }, 2447 i: function(date) { 2448 return pad(date.getMinutes()); 2449 }, 2450 j: function(date) { 2451 return date.getDate(); 2452 }, 2453 l: function(date, locale) { 2454 return locale.weekdays.longhand[date.getDay()]; 2455 }, 2456 m: function(date) { 2457 return pad(date.getMonth() + 1); 2458 }, 2459 n: function(date) { 2460 return date.getMonth() + 1; 2461 }, 2462 s: function(date) { 2463 return date.getSeconds(); 2464 }, 2465 u: function(date) { 2466 return date.getTime(); 2467 }, 2468 w: function(date) { 2469 return date.getDay(); 2470 }, 2471 y: function(date) { 2472 return String(date.getFullYear()).substring(2); 2473 } 2474}; 2475var createDateFormatter = function(_a) { 2476 var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _
2476c, _d = _a.isMobile, isMobile = _d === void 0 ? false : _d; 2477 return function(dateObj, frmt, overrideLocale) { 2478 var locale = overrideLocale || l10n; 2479 if (config.formatDate !== void 0 && !isMobile) { 2480 return config.formatDate(dateObj, frmt, locale); 2481 } 2482 return frmt.split("").map(function(c, i, arr) { 2483 return formats[c] && arr[i - 1] !== "\\" ? formats[c](dateObj, locale, config) : c !== "\\" ? c : ""; 2484 }).join(""); 2485 }; 2486}; 2487var createDateParser = function(_a) { 2488 var _b = _a.config, config = _b === void 0 ? defaults : _b, _c = _a.l10n, l10n = _c === void 0 ? english : _c; 2489 return function(date, givenFormat, timeless, customLocale) { 2490 if (date !== 0 && !date) 2491 return void 0; 2492 var locale = customLocale || l10n; 2493 var parsedDate; 2494 var dateOrig = date; 2495 if (date instanceof Date) 2496 parsedDate = new Date(date.getTime()); 2497 else if (typeof date !== "string" && date.toFixed !== void 0) 2498 parsedDate = new Date(date); 2499 else if (typeof date === "string") { 2500 var format = givenFormat || (config || defaults).dateFormat; 2501 var datestr = String(date).trim(); 2502 if (datestr === "today") { 2503 parsedDate = /* @__PURE__ */ new Date(); 2504 timeless = true; 2505 } else if (config && config.parseDate) { 2506 parsedDate = config.parseDate(date, format); 2507 } else if (/Z$/.test(datestr) || /GMT$/.test(datestr)) { 2508 parsedDate = new Date(date); 2509 } else { 2510 var matched = void 0, ops = []; 2511 for (var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++) { 2512 var token = format[i]; 2513 var isBackSlash = token === "\\"; 2514 var escaped = format[i - 1] === "\\" || isBackSlash; 2515 if (tokenRegex[token] && !escaped) { 2516 regexStr += tokenRegex[token]; 2517 var match = new RegExp(regexStr).exec(date); 2518 if (match && (matched = true)) { 2519 ops[token !== "Y" ? "push" : "unshift"]({ 2520 fn: revFormat[token], 2521 val: match[++matchIndex] 2522 }); 2523 } 2524 } else if (!isBackSlash) 2525 regexStr += "."; 2526 } 2527 parsedDate = !config || !config.noCalendar ? new Date((/* @__PURE__ */ new Date()).getFullYear(), 0, 1, 0, 0, 0, 0) : new Date((/* @__PURE__ */ new Date()).setHours(0, 0, 0, 0)); 2528 ops.forEach(function(_a2) { 2529 var fn = _a2.fn, val = _a2.val; 2530 return parsedDate = fn(parsedDate, val, locale) || parsedDate; 2531 }); 2532 parsedDate = matched ? parsedDate : void 0; 2533 } 2534 } 2535 if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) { 2536 config.errorHandler(new Error("Invalid date provided: " + dateOrig)); 2537 return void 0; 2538 } 2539 if (timeless === true) 2540 parsedDate.setHours(0, 0, 0, 0); 2541 return parsedDate; 2542 }; 2543}; 2544function compareDates(date1, date2, timeless) { 2545 if (timeless === void 0) { 2546 timeless = true; 2547 } 2548 if (timeless !== false) { 2549 return new Date(date1.getTime()).setHours(0, 0, 0, 0) - new Date(date2.getTime()).setHours(0, 0, 0, 0); 2550 } 2551 return date1.getTime() - date2.getTime(); 2552} 2553var isBetween = function(ts, ts1, ts2) { 2554 return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2); 2555}; 2556var calculateSecondsSinceMidnight = function(hours, minutes, seconds) { 2557 return hours * 3600 + minutes * 60 + seconds; 2558}; 2559var parseSeconds = function(secondsSinceMidnight) { 2560 var hours = Math.floor(secondsSinceMidnight / 3600), minutes = (secondsSinceMidnight - hours * 3600) / 60; 2561 return [hours, minutes, secondsSinceMidnight - hours * 3600 - minutes * 60]; 2562}; 2563var duration = { 2564 DAY: 864e5 2565}; 2566function getDefaultHours(config) { 2567 var hours = config.defaultHour; 2568 var minutes = config.defaultMinute; 2569 var seconds = config.defaultSeconds; 2570 if (config.minDate !== void 0) { 2571 var minHour = config.minDate.getHours(); 2572 var minMinutes = config.minDate.getMinutes(); 2573 var minSeconds = config.minDate.getSeconds(); 2574 if (hours < minHour) { 2575 hours = minHour; 2576 } 2577 if (hours === minHour && minutes < minMinutes) { 2578 minutes = minMinutes; 2579 } 2580 if (hours === minHour && minutes === minMinutes && seconds < minSeconds) 2581 seconds = config.minDate.getSeconds(); 2582 } 2583 if (config.maxDate !== void 0) { 2584 var maxHr = config.maxDate.getHours(); 2585 var maxMinutes = config.maxDate.getMinutes(); 2586 hours = Math.min(hours, maxHr); 2587 if (hours === maxHr) 2588 minutes = Math.min(maxMinutes, minutes); 2589 if (hours === maxHr && minutes === maxMinutes) 2590 seconds = config.maxDate.getSeconds(); 2591 } 2592 return { hours, minutes, seconds }; 2593} 2594if (typeof Object.assign !== "function") { 2595 Object.assign = function(target) { 2596 var args = []; 2597 for (var _i = 1; _i < arguments.length; _i++) { 2598 args[_i - 1] = arguments[_i]; 2599 } 2600 if (!target) { 2601 throw TypeError("Cannot convert undefined or null to object"); 2602 } 2603 var _loop_1 = function(source2) { 2604 if (source2) { 2605 Object.keys(source2).forEach(function(key) { 2606 return target[key] = source2[key]; 2607 }); 2608 } 2609 }; 2610 for (var _a = 0, args_1 = args; _a < args_1.length; _a++) { 2611 var source = args_1[_a]; 2612 _loop_1(source); 2613 } 2614 return target; 2615 }; 2616} 2617var __assign = function() { 2618 __assign = Object.assign || function(t) { 2619 for (var s, i = 1, n = arguments.length; i < n; i++) { 2620 s = arguments[i]; 2621 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 2622 t[p] = s[p]; 2623 } 2624 return t; 2625 }; 2626 return __assign.apply(this, arguments); 2627};
2628var __spreadArrays = function() { 2629 for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length; 2630 for (var r = Array(s), k = 0, i = 0; i < il; i++) 2631 for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) 2632 r[k] = a[j]; 2633 return r; 2634}; 2635var DEBOUNCED_CHANGE_MS = 300; 2636function FlatpickrInstance(element, instanceConfig) { 2637 var self = { 2638 config: __assign(__assign({}, defaults), flatpickr.defaultConfig), 2639 l10n: english 2640 }; 2641 self.parseDate = createDateParser({ config: self.config, l10n: self.l10n }); 2642 self._handlers = []; 2643 self.pluginElements = []; 2644 self.loadedPlugins = []; 2645 self._bind = bind; 2646 self._setHoursFromDate = setHoursFromDate; 2647 self._positionCalendar = positionCalendar; 2648 self.changeMonth = changeMonth; 2649 self.changeYear = changeYear; 2650 self.clear = clear; 2651 self.close = close; 2652 self.onMouseOver = onMouseOver; 2653 self._createElement = createElement; 2654 self.createDay = createDay; 2655 self.destroy = destroy; 2656 self.isEnabled = isEnabled; 2657 self.jumpToDate = jumpToDate; 2658 self.updateValue = updateValue; 2659 self.open = open; 2660 self.redraw = redraw; 2661 self.set = set; 2662 self.setDate = setDate; 2663 self.toggle = toggle; 2664 function setupHelperFunctions() { 2665 self.utils = { 2666 getDaysInMonth: function(month, yr) { 2667 if (month === void 0) { 2668 month = self.currentMonth; 2669 } 2670 if (yr === void 0) { 2671 yr = self.currentYear; 2672 } 2673 if (month === 1 && (yr % 4 === 0 && yr % 100 !== 0 || yr % 400 === 0)) 2674 return 29; 2675 return self.l10n.daysInMonth[month]; 2676 } 2677 }; 2678 } 2679 function init() { 2680 self.element = self.input = element; 2681 self.isOpen = false; 2682 parseConfig(); 2683 setupLocale(); 2684 setupInputs(); 2685 setupDates(); 2686 setupHelperFunctions(); 2687 if (!self.isMobile) 2688 build2(); 2689 bindEvents(); 2690 if (self.selectedDates.length || self.config.noCalendar) { 2691 if (self.config.enableTime) { 2692 setHoursFromDate(self.config.noCalendar ? self.latestSelectedDateObj : void 0); 2693 } 2694 updateValue(false); 2695 } 2696 setCalendarWidth(); 2697 var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); 2698 if (!self.isMobile && isSafari) { 2699 positionCalendar(); 2700 } 2701 triggerEvent("onReady"); 2702 } 2703 function getClosestActiveElement() { 2704 var _a; 2705 return ((_a = self.calendarContainer) === null || _a === void 0 ? void 0 : _a.getRootNode()).activeElement || document.activeElement; 2706 } 2707 function bindToInstance(fn) { 2708 return fn.bind(self); 2709 } 2710 function setCalendarWidth() { 2711 var config = self.config; 2712 if (config.weekNumbers === false && config.showMonths === 1) { 2713 return; 2714 } else if (config.noCalendar !== true) { 2715 window.requestAnimationFrame(function() { 2716 if (self.calendarContainer !== void 0) { 2717 self.calendarContainer.style.visibility = "hidden"; 2718 self.calendarContainer.style.display = "block"; 2719 } 2720 if (self.daysContainer !== void 0) { 2721 var daysWidth = (self.days.offsetWidth + 1) * config.showMonths; 2722 self.daysContainer.style.width = daysWidth + "px"; 2723 self.calendarContainer.style.width = daysWidth + (self.weekWrapper !== void 0 ? self.weekWrapper.offsetWidth : 0) + "px"; 2724 self.calendarContainer.style.removeProperty("visibility"); 2725 self.calendarContainer.style.removeProperty("display"); 2726 } 2727 }); 2728 } 2729 } 2730 function updateTime(e) { 2731 if (self.selectedDates.length === 0) { 2732 var defaultDate = self.config.minDate === void 0 || compareDates(/* @__PURE__ */ new Date(), self.config.minDate) >= 0 ? /* @__PURE__ */ new Date() : new Date(self.config.minDate.getTime()); 2733 var defaults2 = getDefaultHours(self.config); 2734 defaultDate.setHours(defaults2.hours, defaults2.minutes, defaults2.seconds, defaultDate.getMilliseconds()); 2735 self.selectedDates = [defaultDate]; 2736 self.latestSelectedDateObj = defaultDate; 2737 } 2738 if (e !== void 0 && e.type !== "blur") { 2739 timeWrapper(e); 2740 } 2741 var prevValue = self._input.value; 2742 setHoursFromInputs();
2743 updateValue(); 2744 if (self._input.value !== prevValue) { 2745 self._debouncedChange(); 2746 } 2747 } 2748 function ampm2military(hour, amPM) { 2749 return hour % 12 + 12 * int(amPM === self.l10n.amPM[1]); 2750 } 2751 function military2ampm(hour) { 2752 switch (hour % 24) { 2753 case 0: 2754 case 12: 2755 return 12; 2756 default: 2757 return hour % 12; 2758 } 2759 } 2760 function setHoursFromInputs() { 2761 if (self.hourElement === void 0 || self.minuteElement === void 0) 2762 return; 2763 var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== void 0 ? (parseInt(self.secondElement.value, 10) || 0) % 60 : 0; 2764 if (self.amPM !== void 0) { 2765 hours = ampm2military(hours, self.amPM.textContent); 2766 } 2767 var limitMinHours = self.config.minTime !== void 0 || self.config.minDate && self.minDateHasTime && self.latestSelectedDateObj && compareDates(self.latestSelectedDateObj, self.config.minDate, true) === 0; 2768 var limitMaxHours = self.config.maxTime !== void 0 || self.config.maxDate && self.maxDateHasTime && self.latestSelectedDateObj && compareDates(self.latestSelectedDateObj, self.config.maxDate, true) === 0; 2769 if (self.config.maxTime !== void 0 && self.config.minTime !== void 0 && self.config.minTime > self.config.maxTime) { 2770 var minBound = calculateSecondsSinceMidnight(self.config.minTime.getHours(), self.config.minTime.getMinutes(), self.config.minTime.getSeconds()); 2771 var maxBound = calculateSecondsSinceMidnight(self.config.maxTime.getHours(), self.config.maxTime.getMinutes(), self.config.maxTime.getSeconds()); 2772 var currentTime = calculateSecondsSinceMidnight(hours, minutes, seconds); 2773 if (currentTime > maxBound && currentTime < minBound) { 2774 var result = parseSeconds(minBound); 2775 hours = result[0]; 2776 minutes = result[1]; 2777 seconds = result[2]; 2778 } 2779 } else { 2780 if (limitMaxHours) { 2781 var maxTime = self.config.maxTime !== void 0 ? self.config.maxTime : self.config.maxDate; 2782 hours = Math.min(hours, maxTime.getHours()); 2783 if (hours === maxTime.getHours()) 2784 minutes = Math.min(minutes, maxTime.getMinutes()); 2785 if (minutes === maxTime.getMinutes()) 2786 seconds = Math.min(seconds, maxTime.getSeconds()); 2787 } 2788 if (limitMinHours) { 2789 var minTime = self.config.minTime !== void 0 ? self.config.minTime : self.config.minDate; 2790 hours = Math.max(hours, minTime.getHours()); 2791 if (hours === minTime.getHours() && minutes < minTime.getMinutes()) 2792 minutes = minTime.getMinutes(); 2793 if (minutes === minTime.getMinutes()) 2794 seconds = Math.max(seconds, minTime.getSeconds()); 2795 } 2796 } 2797 setHours(hours, minutes, seconds); 2798 } 2799 function setHoursFromDate(dateObj) { 2800 var date = dateObj || self.latestSelectedDateObj; 2801 if (date && date instanceof Date) { 2802 setHours(date.getHours(), date.getMinutes(), date.getSeconds()); 2803 } 2804 } 2805 function setHours(hours, minutes, seconds) { 2806 if (self.latestSelectedDateObj !== void 0) { 2807 self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0); 2808 } 2809 if (!self.hourElement || !self.minuteElement || self.isMobile) 2810 return; 2811 self.hourElement.value = pad(!self.config.time_24hr ? (12 + hours) % 12 + 12 * int(hours % 12 === 0) : hours); 2812 self.minuteElement.value = pad(minutes); 2813 if (self.amPM !== void 0) 2814 self.amPM.textContent = self.l10n.amPM[int(hours >= 12)]; 2815 if (self.secondElement !== void 0) 2816 self.secondElement.value = pad(seconds); 2817 } 2818 function onYearInput(event) { 2819 var eventTarget = getEventTarget(event); 2820 var year = parseInt(eventTarget.value) + (event.delta || 0); 2821 if (year / 1e3 > 1 || event.key === "Enter" && !/[^\d]/.test(year.toString())) { 2822 changeYear(year); 2823 } 2824 } 2825 function bind(element2, event, handler, options) { 2826 if (event instanceof Array) 2827 return event.forEach(function(ev) { 2828 return bind(element2, ev, handler, options); 2829 }); 2830 if (element2 instanceof Array) 2831 return element2.forEach(function(el) { 2832 return bind(el, event, handler, options); 2833 }); 2834 element2.addEventListener(event, handler, options); 2835 self._handlers.push({ 2836 remove: function() { 2837 return element2.removeEventListener(event, handler, options); 2838 } 2839 }); 2840 } 2841 function triggerChange() { 2842 triggerEvent("onChange"); 2843 } 2844 function bindEvents() { 2845 if (self.config.wrap) { 2846 ["open", "close", "toggle", "clear"].forEach(function(evt) { 2847 Array.prototype.forEach.call(self.element.querySelectorAll("[data-" + evt + "]"), function(el) { 2848 return bind(el, "click", self[evt]); 2849 }); 2850 }); 2851 } 2852 if (self.isMobile) { 2853 setupMobile(); 2854 return; 2855 } 2856 var debouncedResize = debounce(onResize, 50);
2857 self._debouncedChange = debounce(triggerChange, DEBOUNCED_CHANGE_MS); 2858 if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent)) 2859 bind(self.daysContainer, "mouseover", function(e) { 2860 if (self.config.mode === "range") 2861 onMouseOver(getEventTarget(e)); 2862 }); 2863 bind(self._input, "keydown", onKeyDown); 2864 if (self.calendarContainer !== void 0) { 2865 bind(self.calendarContainer, "keydown", onKeyDown); 2866 } 2867 if (!self.config.inline && !self.config.static) 2868 bind(window, "resize", debouncedResize); 2869 if (window.ontouchstart !== void 0) 2870 bind(window.document, "touchstart", documentClick); 2871 else 2872 bind(window.document, "mousedown", documentClick); 2873 bind(window.document, "focus", documentClick, { capture: true }); 2874 if (self.config.clickOpens === true) { 2875 bind(self._input, "focus", self.open); 2876 bind(self._input, "click", self.open); 2877 } 2878 if (self.daysContainer !== void 0) { 2879 bind(self.monthNav, "click", onMonthNavClick); 2880 bind(self.monthNav, ["keyup", "increment"], onYearInput); 2881 bind(self.daysContainer, "click", selectDate); 2882 } 2883 if (self.timeContainer !== void 0 && self.minuteElement !== void 0 && self.hourElement !== void 0) { 2884 var selText = function(e) { 2885 return getEventTarget(e).select(); 2886 }; 2887 bind(self.timeContainer, ["increment"], updateTime); 2888 bind(self.timeContainer, "blur", updateTime, { capture: true }); 2889 bind(self.timeContainer, "click", timeIncrement); 2890 bind([self.hourElement, self.minuteElement], ["focus", "click"], selText); 2891 if (self.secondElement !== void 0) 2892 bind(self.secondElement, "focus", function() { 2893 return self.secondElement && self.secondElement.select(); 2894 }); 2895 if (self.amPM !== void 0) { 2896 bind(self.amPM, "click", function(e) { 2897 updateTime(e); 2898 }); 2899 } 2900 } 2901 if (self.config.allowInput) { 2902 bind(self._input, "blur", onBlur); 2903 } 2904 } 2905 function jumpToDate(jumpDate, triggerChange2) { 2906 var jumpTo = jumpDate !== void 0 ? self.parseDate(jumpDate) : self.latestSelectedDateObj || (self.config.minDate && self.config.minDate > self.now ? self.config.minDate : self.config.maxDate && self.config.maxDate < self.now ? self.config.maxDate : self.now); 2907 var oldYear = self.currentYear; 2908 var oldMonth = self.currentMonth; 2909 try { 2910 if (jumpTo !== void 0) { 2911 self.currentYear = jumpTo.getFullYear(); 2912 self.currentMonth = jumpTo.getMonth(); 2913 } 2914 } catch (e) { 2915 e.message = "Invalid date supplied: " + jumpTo; 2916 self.config.errorHandler(e); 2917 } 2918 if (triggerChange2 && self.currentYear !== oldYear) { 2919 triggerEvent("onYearChange"); 2920 buildMonthSwitch(); 2921 } 2922 if (triggerChange2 && (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) { 2923 triggerEvent("onMonthChange"); 2924 } 2925 self.redraw(); 2926 } 2927 function timeIncrement(e) { 2928 var eventTarget = getEventTarget(e); 2929 if (~eventTarget.className.indexOf("arrow")) 2930 incrementNumInput(e, eventTarget.classList.contains("arrowUp") ? 1 : -1); 2931 } 2932 function incrementNumInput(e, delta, inputElem) { 2933 var target = e && getEventTarget(e); 2934 var input = inputElem || target && target.parentNode && target.parentNode.firstChild; 2935 var event = createEvent("increment"); 2936 event.delta = delta; 2937 input && input.dispatchEvent(event); 2938 } 2939 function build2() { 2940 var fragment = window.document.createDocumentFragment(); 2941 self.calendarContainer = createElement("div", "flatpickr-calendar"); 2942 self.calendarContainer.tabIndex = -1; 2943 if (!self.config.noCalendar) { 2944 fragment.appendChild(buildMonthNav()); 2945 self.innerContainer = createElement("div", "flatpickr-innerContainer"); 2946 if (self.config.weekNumbers) { 2947 var _a = buildWeeks(), weekWrapper = _a.weekWrapper, weekNumbers = _a.weekNumbers; 2948 self.innerContainer.appendChild(weekWrapper); 2949 self.weekNumbers = weekNumbers; 2950 self.weekWrapper = weekWrapper; 2951 } 2952 self.rContainer = createElement("div", "flatpickr-rContainer"); 2953 self.rContainer.appendChild(buildWeekdays()); 2954 if (!self.daysContainer) { 2955 self.daysContainer = createElement("div", "flatpickr-days"); 2956 self.daysContainer.tabIndex = -1; 2957 } 2958 buildDays(); 2959 self.rContainer.appendChild(self.daysContainer); 2960 self.innerContainer.appendChild(self.rContainer); 2961 fragment.appendChild(self.innerContainer); 2962 } 2963 if (self.config.enableTime) { 2964 fragment.appendChild(buildTime()); 2965 } 2966 toggleClass(self.calendarContainer, "rangeMode", self.config.mode === "range"); 2967 toggleClass(self.calendarContainer, "animate", self.config.animate === true); 2968 toggleClass(self.calendarContainer, "multiMonth", self.config.showMonths > 1); 2969 self.calendarContainer.appendChild(fragment); 2970 var customAppend = self.config.appendTo !== void 0 && self.config.appendTo.nodeType !== void 0; 2971 if (self.config.inline || self.config.static) { 2972 self.calendarContainer.classList.add(self.config.inline ? "inline" : "static"); 2973 if (self.config.inline) { 2974 if (!customAppend && self.element.parentNode) 2975 self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling); 2976 else if (self.config.appendTo !== void 0) 2977 self.config.appendTo.appendChild(self.calendarContainer); 2978 } 2979 if (self.config.static) { 2980 var wrapper = createElement("div", "flatpickr-wrapper"); 2981 if (self.element.parentNode) 2982 self.element.parentNode.insertBefore(wrapper, self.element); 2983 wrapper.appendChild(self.element); 2984 if (self.altInput) 2985 wrapper.appendChild(self.altInput); 2986 wrapper.appendChild(self.calendarContainer); 2987 } 2988 } 2989 if (!self.config.static && !self.config.inline) 2990 (self.config.appendTo !== void 0 ? self.config.appendTo : window.document.body).appendChild(self.calendarContainer); 2991 } 2992 function createDay(className, date, _dayNumber, i) { 2993 var dateIsEnabled = isEnabled(date, true), dayElement = createElement("span", className, date.getDate().toString()); 2994 dayElement.dateObj = date; 2995 dayElement.$i = i; 2996 dayElement.setAttribute("aria-label", self.formatDate(date, self.config.ariaDateFormat)); 2997 if (className.indexOf("hidden") === -1 && compareDates(date, self.now) === 0) { 2998 self.todayDateElem = dayElement; 2999 dayElement.classList.add("today"); 3000 dayElement.setAttribute("aria-current", "date"); 3001 } 3002 if (dateIsEnabled) { 3003 dayElement.tabIndex = -1; 3004 if (isDateSelected(date)) { 3005 dayElement.classList.add("selected"); 3006 self.selectedDateElem = dayElement; 3007 if (self.config.mode === "range") { 3008 toggleClass(dayElement, "startRange", self.selectedDates[0] && compareDates(date, self.selectedDates[0], true) === 0); 3009 toggleClass(dayElement, "endRange", self.selectedDates[1] && compareDates(date, self.selectedDates[1], true) === 0); 3010 if (className === "nextMonthDay") 3011 dayElement.classList.add("inRange"); 3012 } 3013 } 3014 } else { 3015 dayElement.classList.add("flatpickr-disabled"); 3016 } 3017 if (self.config.mode === "range") { 3018 if (isDateInRange(date) && !isDateSelected(date)) 3019 dayElement.classList.add("inRange"); 3020 } 3021 if (self.weekNumbers && self.config.showMonths === 1 && className !== "prevMonthDay" && i % 7 === 6) { 3022 self.weekNumbers.insertAdjacentHTML("beforeend", "<span class='flatpickr-day'>" + self.config.getWeek(date) + "</span>"); 3023 } 3024 triggerEvent("onDayCreate", dayElement); 3025 return dayElement; 3026 } 3027 function focusOnDayElem(targetNode) { 3028 targetNode.focus(); 3029 if (self.config.mode === "range") 3030 onMouseOver(targetNode); 3031 } 3032 function getFirstAvailableDay(delta) { 3033 var startMonth = delta > 0 ? 0 : self.config.showMonths - 1; 3034 var endMonth = delta > 0 ? self.config.showMonths : -1; 3035 for (var m = startMonth; m != endMonth; m += delta) {
3036 var month = self.daysContainer.children[m]; 3037 var startIndex = delta > 0 ? 0 : month.children.length - 1; 3038 var endIndex = delta > 0 ? month.children.length : -1; 3039 for (var i = startIndex; i != endIndex; i += delta) { 3040 var c = month.children[i]; 3041 if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj)) 3042 return c; 3043 } 3044 } 3045 return void 0; 3046 } 3047 function getNextAvailableDay(current, delta) { 3048 var givenMonth = current.className.indexOf("Month") === -1 ? current.dateObj.getMonth() : self.currentMonth; 3049 var endMonth = delta > 0 ? self.config.showMonths : -1; 3050 var loopDelta = delta > 0 ? 1 : -1; 3051 for (var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta) { 3052 var month = self.daysContainer.children[m]; 3053 var startIndex = givenMonth - self.currentMonth === m ? current.$i + delta : delta < 0 ? month.children.length - 1 : 0; 3054 var numMonthDays = month.children.length; 3055 for (var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta) { 3056 var c = month.children[i]; 3057 if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj) && Math.abs(current.$i - i) >= Math.abs(delta)) 3058 return focusOnDayElem(c); 3059 } 3060 } 3061 self.changeMonth(loopDelta); 3062 focusOnDay(getFirstAvailableDay(loopDelta), 0); 3063 return void 0; 3064 } 3065 function focusOnDay(current, offset) { 3066 var activeElement = getClosestActiveElement(); 3067 var dayFocused = isInView(activeElement || document.body); 3068 var startElem = current !== void 0 ? current : dayFocused ? activeElement : self.selectedDateElem !== void 0 && isInView(self.selectedDateElem) ? self.selectedDateElem : self.todayDateElem !== void 0 && isInView(self.todayDateElem) ? self.todayDateElem : getFirstAvailableDay(offset > 0 ? 1 : -1); 3069 if (startElem === void 0) { 3070 self._input.focus(); 3071 } else if (!dayFocused) { 3072 focusOnDayElem(startElem); 3073 } else { 3074 getNextAvailableDay(startElem, offset); 3075 } 3076 } 3077 function buildMonthDays(year, month) { 3078 var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7; 3079 var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12, year); 3080 var daysInMonth = self.utils.getDaysInMonth(month, year), days = window.document.createDocumentFragment(), isMultiMonth = self.config.showMonths > 1, prevMonthDayClass = isMultiMonth ? "prevMonthDay hidden" : "prevMonthDay", nextMonthDayClass = isMultiMonth ? "nextMonthDay hidden" : "nextMonthDay"; 3081 var dayNumber = prevMonthDays + 1 - firstOfMonth, dayIndex = 0; 3082 for (; dayNumber <= prevMonthDays; dayNumber++, dayIndex++) { 3083 days.appendChild(createDay("flatpickr-day " + prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex)); 3084 } 3085 for (dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++) { 3086 days.appendChild(createDay("flatpickr-day", new Date(year, month, dayNumber), dayNumber, dayIndex)); 3087 } 3088 for (var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth && (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++) { 3089 days.appendChild(createDay("flatpickr-day " + nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex)); 3090 } 3091 var dayContainer = createElement("div", "dayContainer"); 3092 dayContainer.appendChild(days); 3093 return dayContainer; 3094 } 3095 function buildDays() { 3096 if (self.daysContainer === void 0) { 3097 return; 3098 } 3099 clearNode(self.daysContainer); 3100 if (self.weekNumbers) 3101 clearNode(self.weekNumbers); 3102 var frag = document.createDocumentFragment(); 3103 for (var i = 0; i < self.config.showMonths; i++) { 3104 var d = new Date(self.currentYear, self.currentMonth, 1); 3105 d.setMonth(self.currentMonth + i); 3106 frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth())); 3107 } 3108 self.daysContainer.appendChild(frag); 3109 self.days = self.daysContainer.firstChild; 3110 if (self.config.mode === "range" && self.selectedDates.length === 1) { 3111 onMouseOver(); 3112 } 3113 } 3114 function buildMonthSwitch() { 3115 if (self.config.showMonths > 1 || self.config.monthSelectorType !== "dropdown") 3116 return; 3117 var shouldBuildMonth = function(month2) { 3118 if (self.config.minDate !== void 0 && self.currentYear === self.config.minDate.getFullYear() && month2 < self.config.minDate.getMonth()) { 3119 return false;
vendor: 5,927 bytes, lines 3120-3253
3120 } 3121 return !(self.config.maxDate !== void 0 && self.currentYear === self.config.maxDate.getFullYear() && month2 > self.config.maxDate.getMonth()); 3122 }; 3123 self.monthsDropdownContainer.tabIndex = -1; 3124 self.monthsDropdownContainer.innerHTML = ""; 3125 for (var i = 0; i < 12; i++) { 3126 if (!shouldBuildMonth(i)) 3127 continue; 3128 var month = createElement("option", "flatpickr-monthDropdown-month"); 3129 month.value = new Date(self.currentYear, i).getMonth().toString(); 3130 month.textContent = monthToStr(i, self.config.shorthandCurrentMonth, self.l10n); 3131 month.tabIndex = -1; 3132 if (self.currentMonth === i) { 3133 month.selected = true; 3134 } 3135 self.monthsDropdownContainer.appendChild(month); 3136 } 3137 } 3138 function buildMonth() { 3139 var container = createElement("div", "flatpickr-month"); 3140 var monthNavFragment = window.document.createDocumentFragment(); 3141 var monthElement; 3142 if (self.config.showMonths > 1 || self.config.monthSelectorType === "static") { 3143 monthElement = createElement("span", "cur-month"); 3144 } else { 3145 self.monthsDropdownContainer = createElement("select", "flatpickr-monthDropdown-months"); 3146 self.monthsDropdownContainer.setAttribute("aria-label", self.l10n.monthAriaLabel); 3147 bind(self.monthsDropdownContainer, "change", function(e) { 3148 var target = getEventTarget(e); 3149 var selectedMonth = parseInt(target.value, 10); 3150 self.changeMonth(selectedMonth - self.currentMonth); 3151 triggerEvent("onMonthChange"); 3152 }); 3153 buildMonthSwitch(); 3154 monthElement = self.monthsDropdownContainer; 3155 } 3156 var yearInput = createNumberInput("cur-year", { tabindex: "-1" }); 3157 var yearElement = yearInput.getElementsByTagName("input")[0]; 3158 yearElement.setAttribute("aria-label", self.l10n.yearAriaLabel); 3159 if (self.config.minDate) { 3160 yearElement.setAttribute("min", self.config.minDate.getFullYear().toString()); 3161 } 3162 if (self.config.maxDate) { 3163 yearElement.setAttribute("max", self.config.maxDate.getFullYear().toString()); 3164 yearElement.disabled = !!self.config.minDate && self.config.minDate.getFullYear() === self.config.maxDate.getFullYear(); 3165 } 3166 var currentMonth = createElement("div", "flatpickr-current-month"); 3167 currentMonth.appendChild(monthElement); 3168 currentMonth.appendChild(yearInput); 3169 monthNavFragment.appendChild(currentMonth); 3170 container.appendChild(monthNavFragment); 3171 return { 3172 container, 3173 yearElement, 3174 monthElement 3175 }; 3176 } 3177 function buildMonths() { 3178 clearNode(self.monthNav); 3179 self.monthNav.appendChild(self.prevMonthNav); 3180 if (self.config.showMonths) { 3181 self.yearElements = []; 3182 self.monthElements = []; 3183 } 3184 for (var m = self.config.showMonths; m--; ) { 3185 var month = buildMonth(); 3186 self.yearElements.push(month.yearElement); 3187 self.monthElements.push(month.monthElement); 3188 self.monthNav.appendChild(month.container); 3189 } 3190 self.monthNav.appendChild(self.nextMonthNav); 3191 } 3192 function buildMonthNav() { 3193 self.monthNav = createElement("div", "flatpickr-months"); 3194 self.yearElements = []; 3195 self.monthElements = []; 3196 self.prevMonthNav = createElement("span", "flatpickr-prev-month"); 3197 self.prevMonthNav.innerHTML = self.config.prevArrow; 3198 self.nextMonthNav = createElement("span", "flatpickr-next-month"); 3199 self.nextMonthNav.innerHTML = self.config.nextArrow; 3200 buildMonths(); 3201 Object.defineProperty(self, "_hidePrevMonthArrow", { 3202 get: function() { 3203 return self.__hidePrevMonthArrow; 3204 }, 3205 set: function(bool) { 3206 if (self.__hidePrevMonthArrow !== bool) { 3207 toggleClass(self.prevMonthNav, "flatpickr-disabled", bool); 3208 self.__hidePrevMonthArrow = bool; 3209 } 3210 } 3211 }); 3212 Object.defineProperty(self, "_hideNextMonthArrow", { 3213 get: function() { 3214 return self.__hideNextMonthArrow; 3215 }, 3216 set: function(bool) { 3217 if (self.__hideNextMonthArrow !== bool) { 3218 toggleClass(self.nextMonthNav, "flatpickr-disabled", bool); 3219 self.__hideNextMonthArrow = bool; 3220 } 3221 } 3222 }); 3223 self.currentYearElement = self.yearElements[0]; 3224 updateNavigationCurrentMonth(); 3225 return self.monthNav; 3226 } 3227 function buildTime() { 3228 self.calendarContainer.classList.add("hasTime"); 3229 if (self.config.noCalendar) 3230 self.calendarContainer.classList.add("noCalendar"); 3231 var defaults2 = getDefaultHours(self.config); 3232 self.timeContainer = createElement("div", "flatpickr-time"); 3233 self.timeContainer.tabIndex = -1; 3234 var separator = createElement("span", "flatpickr-time-separator", ":"); 3235 var hourInput = createNumberInput("flatpickr-hour", { 3236 "aria-label": self.l10n.hourAriaLabel 3237 }); 3238 self.hourElement = hourInput.getElementsByTagName("input")[0]; 3239 var minuteInput = createNumberInput("flatpickr-minute", { 3240 "aria-label": self.l10n.minuteAriaLabel 3241 }); 3242 self.minuteElement = minuteInput.getElementsByTagName("input")[0]; 3243 self.hourElement.tabIndex = self.minuteElement.tabIndex = -1; 3244 self.hourElement.value = pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getHours() : self.config.time_24hr ? defaults2.hours : military2ampm(defaults2.hours)); 3245 self.minuteElement.value = pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getMinutes() : defaults2.minutes); 3246 self.hourElement.setAttribute("step", self.config.hourIncrement.toString()); 3247 self.minuteElement.setAttribute("step", self.config.minuteIncrement.toString()); 3248 self.hourElement.setAttribute("min", self.config.time_24hr ? "0" : "1"); 3249 self.hourElement.setAttribute("max", self.config.time_24hr ? "23" : "12"); 3250 self.hourElement.setAttribute("maxlength", "2"); 3251 self.minuteElement.setAttribute("min", "0"); 3252 self.minuteElement.setAttribute("max", "59"); 3253 self.minuteElement.setAttribute("maxlength", "2");
3254 self.timeContainer.appendChild(hourInput); 3255 self.timeContainer.appendChild(separator); 3256 self.timeContainer.appendChild(minuteInput); 3257 if (self.config.time_24hr) 3258 self.timeContainer.classList.add("time24hr"); 3259 if (self.config.enableSeconds) { 3260 self.timeContainer.classList.add("hasSeconds"); 3261 var secondInput = createNumberInput("flatpickr-second"); 3262 self.secondElement = secondInput.getElementsByTagName("input")[0]; 3263 self.secondElement.value = pad(self.latestSelectedDateObj ? self.latestSelectedDateObj.getSeconds() : defaults2.seconds); 3264 self.secondElement.setAttribute("step", self.minuteElement.getAttribute("step")); 3265 self.secondElement.setAttribute("min", "0"); 3266 self.secondElement.setAttribute("max", "59"); 3267 self.secondElement.setAttribute("maxlength", "2"); 3268 self.timeContainer.appendChild(createElement("span", "flatpickr-time-separator", ":")); 3269 self.timeContainer.appendChild(secondInput); 3270 } 3271 if (!self.config.time_24hr) { 3272 self.amPM = createElement("span", "flatpickr-am-pm", self.l10n.amPM[int((self.latestSelectedDateObj ? self.hourElement.value : self.config.defaultHour) > 11)]); 3273 self.amPM.title = self.l10n.toggleTitle; 3274 self.amPM.tabIndex = -1; 3275 self.timeContainer.appendChild(self.amPM); 3276 } 3277 return self.timeContainer; 3278 } 3279 function buildWeekdays() { 3280 if (!self.weekdayContainer) 3281 self.weekdayContainer = createElement("div", "flatpickr-weekdays"); 3282 else 3283 clearNode(self.weekdayContainer); 3284 for (var i = self.config.showMonths; i--; ) { 3285 var container = createElement("div", "flatpickr-weekdaycontainer"); 3286 self.weekdayContainer.appendChild(container); 3287 } 3288 updateWeekdays(); 3289 return self.weekdayContainer; 3290 } 3291 function updateWeekdays() { 3292 if (!self.weekdayContainer) { 3293 return; 3294 } 3295 var firstDayOfWeek = self.l10n.firstDayOfWeek; 3296 var weekdays = __spreadArrays(self.l10n.weekdays.shorthand); 3297 if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) { 3298 weekdays = __spreadArrays(weekdays.splice(firstDayOfWeek, weekdays.length), weekdays.splice(0, firstDayOfWeek)); 3299 } 3300 for (var i = self.config.showMonths; i--; ) { 3301 self.weekdayContainer.children[i].innerHTML = "\n <span class='flatpickr-weekday'>\n " + weekdays.join("</span><span class='flatpickr-weekday'>") + "\n </span>\n "; 3302 } 3303 } 3304 function buildWeeks() { 3305 self.calendarContainer.classList.add("hasWeeks"); 3306 var weekWrapper = createElement("div", "flatpickr-weekwrapper"); 3307 weekWrapper.appendChild(createElement("span", "flatpickr-weekday", self.l10n.weekAbbreviation)); 3308 var weekNumbers = createElement("div", "flatpickr-weeks"); 3309 weekWrapper.appendChild(weekNumbers); 3310 return { 3311 weekWrapper, 3312 weekNumbers 3313 }; 3314 } 3315 function changeMonth(value, isOffset) { 3316 if (isOffset === void 0) { 3317 isOffset = true; 3318 } 3319 var delta = isOffset ? value : value - self.currentMonth; 3320 if (delta < 0 && self._hidePrevMonthArrow === true || delta > 0 && self._hideNextMonthArrow === true) 3321 return; 3322 self.currentMonth += delta; 3323 if (self.currentMonth < 0 || self.currentMonth > 11) { 3324 self.currentYear += self.currentMonth > 11 ? 1 : -1; 3325 self.currentMonth = (self.currentMonth + 12) % 12; 3326 triggerEvent("onYearChange"); 3327 buildMonthSwitch(); 3328 } 3329 buildDays(); 3330 triggerEvent("onMonthChange"); 3331 updateNavigationCurrentMonth(); 3332 } 3333 function clear(triggerChangeEvent, toInitial) { 3334 if (triggerChangeEvent === void 0) { 3335 triggerChangeEvent = true; 3336 } 3337 if (toInitial === void 0) { 3338 toInitial = true; 3339 } 3340 self.input.value = ""; 3341 if (self.altInput !== void 0) 3342 self.altInput.value = ""; 3343 if (self.mobileInput !== void 0) 3344 self.mobileInput.value = ""; 3345 self.selectedDates = []; 3346 self.latestSelectedDateObj = void 0; 3347 if (toInitial === true) { 3348 self.currentYear = self._initialDate.getFullYear(); 3349 self.currentMonth = self._initialDate.getMonth(); 3350 } 3351 if (self.config.enableTime === true) { 3352 var _a = getDefaultHours(self.config), hours = _a.hours, minutes = _a.minutes, seconds = _a.seconds; 3353 setHours(hours, minutes, seconds); 3354 } 3355 self.redraw(); 3356 if (triggerChangeEvent) 3357 triggerEvent("onChange"); 3358 } 3359 function close() { 3360 self.isOpen = false;
3361 if (!self.isMobile) { 3362 if (self.calendarContainer !== void 0) { 3363 self.calendarContainer.classList.remove("open"); 3364 } 3365 if (self._input !== void 0) { 3366 self._input.classList.remove("active"); 3367 } 3368 } 3369 triggerEvent("onClose"); 3370 } 3371 function destroy() { 3372 if (self.config !== void 0) 3373 triggerEvent("onDestroy"); 3374 for (var i = self._handlers.length; i--; ) { 3375 self._handlers[i].remove(); 3376 } 3377 self._handlers = []; 3378 if (self.mobileInput) { 3379 if (self.mobileInput.parentNode) 3380 self.mobileInput.parentNode.removeChild(self.mobileInput); 3381 self.mobileInput = void 0; 3382 } else if (self.calendarContainer && self.calendarContainer.parentNode) { 3383 if (self.config.static && self.calendarContainer.parentNode) { 3384 var wrapper = self.calendarContainer.parentNode; 3385 wrapper.lastChild && wrapper.removeChild(wrapper.lastChild); 3386 if (wrapper.parentNode) { 3387 while (wrapper.firstChild) 3388 wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper); 3389 wrapper.parentNode.removeChild(wrapper); 3390 } 3391 } else 3392 self.calendarContainer.parentNode.removeChild(self.calendarContainer); 3393 } 3394 if (self.altInput) { 3395 self.input.type = "text"; 3396 if (self.altInput.parentNode) 3397 self.altInput.parentNode.removeChild(self.altInput); 3398 delete self.altInput; 3399 } 3400 if (self.input) { 3401 self.input.type = self.input._type; 3402 self.input.classList.remove("flatpickr-input"); 3403 self.input.removeAttribute("readonly"); 3404 } 3405 [ 3406 "_showTimeInput", 3407 "latestSelectedDateObj", 3408 "_hideNextMonthArrow", 3409 "_hidePrevMonthArrow", 3410 "__hideNextMonthArrow", 3411 "__hidePrevMonthArrow", 3412 "isMobile", 3413 "isOpen", 3414 "selectedDateElem", 3415 "minDateHasTime", 3416 "maxDateHasTime", 3417 "days", 3418 "daysContainer", 3419 "_input", 3420 "_positionElement", 3421 "innerContainer", 3422 "rContainer", 3423 "monthNav", 3424 "todayDateElem", 3425 "calendarContainer", 3426 "weekdayContainer", 3427 "prevMonthNav", 3428 "nextMonthNav", 3429 "monthsDropdownContainer", 3430 "currentMonthElement", 3431 "currentYearElement", 3432 "navigationCurrentMonth", 3433 "selectedDateElem", 3434 "config" 3435 ].forEach(function(k) { 3436 try { 3437 delete self[k]; 3438 } catch (_2) { 3439 } 3440 }); 3441 } 3442 function isCalendarElem(elem) { 3443 return self.calendarContainer.contains(elem); 3444 } 3445 function documentClick(e) { 3446 if (self.isOpen && !self.config.inline) { 3447 var eventTarget_1 = getEventTarget(e); 3448 var isCalendarElement = isCalendarElem(eventTarget_1); 3449 var isInput = eventTarget_1 === self.input || eventTarget_1 === self.altInput || self.element.contains(eventTarget_1) || e.path && e.path.indexOf && (~e.path.indexOf(self.input) || ~e.path.indexOf(self.altInput)); 3450 var lostFocus = !isInput && !isCalendarElement && !isCalendarElem(e.relatedTarget); 3451 var isIgnored = !self.config.ignoredFocusElements.some(function(elem) { 3452 return elem.contains(eventTarget_1); 3453 }); 3454 if (lostFocus && isIgnored) { 3455 if (self.config.allowInput) { 3456 self.setDate(self._input.value, false, self.config.altInput ? self.config.altFormat : self.config.dateFormat); 3457 } 3458 if (self.timeContainer !== void 0 && self.minuteElement !== void 0 && self.hourElement !== void 0 && self.input.value !== "" && self.input.value !== void 0) { 3459 updateTime(); 3460 } 3461 self.close(); 3462 if (self.config && self.config.mode === "range" && self.selectedDates.length === 1) 3463 self.clear(false); 3464 } 3465 } 3466 } 3467 function changeYear(newYear) { 3468 if (!newYear || self.config.minDate && newYear < self.config.minDate.getFullYear() || self.config.maxDate && newYear > self.config.maxDate.getFullYear()) 3469 return; 3470 var newYearNum = newYear, isNewYear = self.currentYear !== newYearNum; 3471 self.currentYear = newYearNum || self.currentYear; 3472 if (self.config.maxDate && self.currentYear === self.config.maxDate.getFullYear()) { 3473 self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth); 3474 } else if (self.config.minDate && self.currentYear === self.config.minDate.getFullYear()) { 3475 self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth); 3476 } 3477 if (isNewYear) { 3478 self.redraw(); 3479 triggerEvent("onYearChange"); 3480 buildMonthSwitch(); 3481 } 3482 } 3483 function isEnabled(date, timeless) { 3484 var _a; 3485 if (timeless === void 0) { 3486 timeless = true; 3487 } 3488 var dateToCheck = self.parseDate(date, void 0, timeless); 3489 if (self.config.minDate && dateToCheck && compareDates(dateToCheck, self.config.minDate, timeless !== void 0 ? timeless : !self.minDateHasTime) < 0 || self.config.maxDate && dateToCheck && compareDates(dateToCheck, self.config.maxDate, timeless !== void 0 ? timeless : !self.maxDateHasTime) > 0) 3490 return false;
3491 if (!self.config.enable && self.config.disable.length === 0) 3492 return true; 3493 if (dateToCheck === void 0) 3494 return false; 3495 var bool = !!self.config.enable, array = (_a = self.config.enable) !== null && _a !== void 0 ? _a : self.config.disable; 3496 for (var i = 0, d = void 0; i < array.length; i++) { 3497 d = array[i]; 3498 if (typeof d === "function" && d(dateToCheck)) 3499 return bool; 3500 else if (d instanceof Date && dateToCheck !== void 0 && d.getTime() === dateToCheck.getTime()) 3501 return bool; 3502 else if (typeof d === "string") { 3503 var parsed = self.parseDate(d, void 0, true); 3504 return parsed && parsed.getTime() === dateToCheck.getTime() ? bool : !bool; 3505 } else if (typeof d === "object" && dateToCheck !== void 0 && d.from && d.to && dateToCheck.getTime() >= d.from.getTime() && dateToCheck.getTime() <= d.to.getTime()) 3506 return bool; 3507 } 3508 return !bool; 3509 } 3510 function isInView(elem) { 3511 if (self.daysContainer !== void 0) 3512 return elem.className.indexOf("hidden") === -1 && elem.className.indexOf("flatpickr-disabled") === -1 && self.daysContainer.contains(elem); 3513 return false; 3514 } 3515 function onBlur(e) { 3516 var isInput = e.target === self._input; 3517 var valueChanged = self._input.value.trimEnd() !== getDateStr(); 3518 if (isInput && valueChanged && !(e.relatedTarget && isCalendarElem(e.relatedTarget))) { 3519 self.setDate(self._input.value, true, e.target === self.altInput ? self.config.altFormat : self.config.dateFormat); 3520 } 3521 } 3522 function onKeyDown(e) { 3523 var eventTarget = getEventTarget(e); 3524 var isInput = self.config.wrap ? element.contains(eventTarget) : eventTarget === self._input; 3525 var allowInput = self.config.allowInput; 3526 var allowKeydown = self.isOpen && (!allowInput || !isInput); 3527 var allowInlineKeydown = self.config.inline && isInput && !allowInput; 3528 if (e.keyCode === 13 && isInput) { 3529 if (allowInput) { 3530 self.setDate(self._input.value, true, eventTarget === self.altInput ? self.config.altFormat : self.config.dateFormat); 3531 self.close(); 3532 return eventTarget.blur(); 3533 } else { 3534 self.open(); 3535 } 3536 } else if (isCalendarElem(eventTarget) || allowKeydown || allowInlineKeydown) { 3537 var isTimeObj = !!self.timeContainer && self.timeContainer.contains(eventTarget); 3538 switch (e.keyCode) { 3539 case 13: 3540 if (isTimeObj) { 3541 e.preventDefault(); 3542 updateTime(); 3543 focusAndClose(); 3544 } else 3545 selectDate(e); 3546 break; 3547 case 27: 3548 e.preventDefault(); 3549 focusAndClose(); 3550 break; 3551 case 8: 3552 case 46: 3553 if (isInput && !self.config.allowInput) { 3554 e.preventDefault(); 3555 self.clear(); 3556 } 3557 break; 3558 case 37: 3559 case 39: 3560 if (!isTimeObj && !isInput) { 3561 e.preventDefault(); 3562 var activeElement = getClosestActiveElement(); 3563 if (self.daysContainer !== void 0 && (allowInput === false || activeElement && isInView(activeElement))) { 3564 var delta_1 = e.keyCode === 39 ? 1 : -1; 3565 if (!e.ctrlKey) 3566 focusOnDay(void 0, delta_1); 3567 else { 3568 e.stopPropagation(); 3569 changeMonth(delta_1); 3570 focusOnDay(getFirstAvailableDay(1), 0); 3571 } 3572 } 3573 } else if (self.hourElement) 3574 self.hourElement.focus(); 3575 break; 3576 case 38: 3577 case 40: 3578 e.preventDefault(); 3579 var delta = e.keyCode === 40 ? 1 : -1; 3580 if (self.daysContainer && eventTarget.$i !== void 0 || eventTarget === self.input || eventTarget === self.altInput) { 3581 if (e.ctrlKey) { 3582 e.stopPropagation(); 3583 changeYear(self.currentYear - delta); 3584 focusOnDay(getFirstAvailableDay(1), 0); 3585 } else if (!isTimeObj) 3586 focusOnDay(void 0, delta * 7); 3587 } else if (eventTarget === self.currentYearElement) { 3588 changeYear(self.currentYear - delta); 3589 } else if (self.config.enableTime) { 3590 if (!isTimeObj && self.hourElement) 3591 self.hourElement.focus(); 3592 updateTime(e); 3593 self._debouncedChange(); 3594 } 3595 break; 3596 case 9: 3597 if (isTimeObj) { 3598 var elems = [ 3599 self.hourElement, 3600 self.minuteElement, 3601 self.secondElement, 3602 self.amPM 3603 ].concat(self.pluginElements).filter(function(x) { 3604 return x; 3605 }); 3606 var i = elems.indexOf(eventTarget); 3607 if (i !== -1) { 3608 var target = elems[i + (e.shiftKey ? -1 : 1)]; 3609 e.preventDefault(); 3610 (target || self._input).focus(); 3611 } 3612 } else if (!self.config.noCalendar && self.daysContainer && self.daysContainer.contains(eventTarget) && e.shiftKey) { 3613 e.preventDefault(); 3614 self._input.focus(); 3615 } 3616 break; 3617 } 3618 } 3619 if (self.amPM !== void 0 && eventTarget === self.amPM) { 3620 switch (e.key) { 3621 case self.l10n.amPM[0].charAt(0): 3622 case self.l10n.amPM[0].charAt(0).toLowerCase(): 3623 self.amPM.textContent = self.l10n.amPM[0]; 3624 setHoursFromInputs();
3625 updateValue(); 3626 break; 3627 case self.l10n.amPM[1].charAt(0): 3628 case self.l10n.amPM[1].charAt(0).toLowerCase(): 3629 self.amPM.textContent = self.l10n.amPM[1]; 3630 setHoursFromInputs(); 3631 updateValue(); 3632 break; 3633 } 3634 } 3635 if (isInput || isCalendarElem(eventTarget)) { 3636 triggerEvent("onKeyDown", e); 3637 } 3638 } 3639 function onMouseOver(elem, cellClass) { 3640 if (cellClass === void 0) { 3641 cellClass = "flatpickr-day"; 3642 } 3643 if (self.selectedDates.length !== 1 || elem && (!elem.classList.contains(cellClass) || elem.classList.contains("flatpickr-disabled"))) 3644 return; 3645 var hoverDate = elem ? elem.dateObj.getTime() : self.days.firstElementChild.dateObj.getTime(), initialDate = self.parseDate(self.selectedDates[0], void 0, true).getTime(), rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()), rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime()); 3646 var containsDisabled = false; 3647 var minRange = 0, maxRange = 0; 3648 for (var t = rangeStartDate; t < rangeEndDate; t += duration.DAY) { 3649 if (!isEnabled(new Date(t), true)) { 3650 containsDisabled = containsDisabled || t > rangeStartDate && t < rangeEndDate; 3651 if (t < initialDate && (!minRange || t > minRange)) 3652 minRange = t; 3653 else if (t > initialDate && (!maxRange || t < maxRange)) 3654 maxRange = t; 3655 } 3656 } 3657 var hoverableCells = Array.from(self.rContainer.querySelectorAll("*:nth-child(-n+" + self.config.showMonths + ") > ." + cellClass)); 3658 hoverableCells.forEach(function(dayElem) { 3659 var date = dayElem.dateObj; 3660 var timestamp = date.getTime(); 3661 var outOfRange = minRange > 0 && timestamp < minRange || maxRange > 0 && timestamp > maxRange; 3662 if (outOfRange) { 3663 dayElem.classList.add("notAllowed"); 3664 ["inRange", "startRange", "endRange"].forEach(function(c) { 3665 dayElem.classList.remove(c); 3666 }); 3667 return; 3668 } else if (containsDisabled && !outOfRange) 3669 return; 3670 ["startRange", "inRange", "endRange", "notAllowed"].forEach(function(c) { 3671 dayElem.classList.remove(c); 3672 }); 3673 if (elem !== void 0) { 3674 elem.classList.add(hoverDate <= self.selectedDates[0].getTime() ? "startRange" : "endRange"); 3675 if (initialDate < hoverDate && timestamp === initialDate) 3676 dayElem.classList.add("startRange"); 3677 else if (initialDate > hoverDate && timestamp === initialDate) 3678 dayElem.classList.add("endRange"); 3679 if (timestamp >= minRange && (maxRange === 0 || timestamp <= maxRange) && isBetween(timestamp, initialDate, hoverDate)) 3680 dayElem.classList.add("inRange"); 3681 } 3682 }); 3683 } 3684 function onResize() { 3685 if (self.isOpen && !self.config.static && !self.config.inline) 3686 positionCalendar(); 3687 } 3688 function open(e, positionElement) { 3689 if (positionElement === void 0) { 3690 positionElement = self._positionElement; 3691 } 3692 if (self.isMobile === true) { 3693 if (e) { 3694 e.preventDefault(); 3695 var eventTarget = getEventTarget(e); 3696 if (eventTarget) { 3697 eventTarget.blur(); 3698 } 3699 } 3700 if (self.mobileInput !== void 0) { 3701 self.mobileInput.focus(); 3702 self.mobileInput.click(); 3703 } 3704 triggerEvent("onOpen"); 3705 return; 3706 } else if (self._input.disabled || self.config.inline) { 3707 return; 3708 } 3709 var wasOpen = self.isOpen; 3710 self.isOpen = true; 3711 if (!wasOpen) { 3712 self.calendarContainer.classList.add("open"); 3713 self._input.classList.add("active"); 3714 triggerEvent("onOpen"); 3715 positionCalendar(positionElement); 3716 } 3717 if (self.config.enableTime === true && self.config.noCalendar === true) { 3718 if (self.config.allowInput === false && (e === void 0 || !self.timeContainer.contains(e.relatedTarget))) { 3719 setTimeout(function() { 3720 return self.hourElement.select(); 3721 }, 50); 3722 } 3723 } 3724 } 3725 function minMaxDateSetter(type) { 3726 return function(date) { 3727 var dateObj = self.config["_" + type + "Date"] = self.parseDate(date, self.config.dateFormat); 3728 var inverseDateObj = self.config["_" + (type === "min" ? "max" : "min") + "Date"]; 3729 if (dateObj !== void 0) { 3730 self[type === "min" ? "minDateHasTime" : "maxDateHasTime"] = dateObj.getHours() > 0 || dateObj.getMinutes() > 0 || dateObj.getSeconds() > 0; 3731 } 3732 if (self.selectedDates) { 3733 self.selectedDates = self.selectedDates.filter(function(d) { 3734 return isEnabled(d); 3735 }); 3736 if (!self.selectedDates.length && type === "min") 3737 setHoursFromDate(dateObj);
3738 updateValue(); 3739 } 3740 if (self.daysContainer) { 3741 redraw(); 3742 if (dateObj !== void 0) 3743 self.currentYearElement[type] = dateObj.getFullYear().toString(); 3744 else 3745 self.currentYearElement.removeAttribute(type); 3746 self.currentYearElement.disabled = !!inverseDateObj && dateObj !== void 0 && inverseDateObj.getFullYear() === dateObj.getFullYear(); 3747 } 3748 }; 3749 } 3750 function parseConfig() { 3751 var boolOpts = [ 3752 "wrap", 3753 "weekNumbers", 3754 "allowInput", 3755 "allowInvalidPreload", 3756 "clickOpens", 3757 "time_24hr", 3758 "enableTime", 3759 "noCalendar", 3760 "altInput", 3761 "shorthandCurrentMonth", 3762 "inline", 3763 "static", 3764 "enableSeconds", 3765 "disableMobile" 3766 ]; 3767 var userConfig = __assign(__assign({}, JSON.parse(JSON.stringify(element.dataset || {}))), instanceConfig); 3768 var formats2 = {}; 3769 self.config.parseDate = userConfig.parseDate; 3770 self.config.formatDate = userConfig.formatDate; 3771 Object.defineProperty(self.config, "enable", { 3772 get: function() { 3773 return self.config._enable; 3774 }, 3775 set: function(dates) { 3776 self.config._enable = parseDateRules(dates); 3777 } 3778 }); 3779 Object.defineProperty(self.config, "disable", { 3780 get: function() { 3781 return self.config._disable; 3782 }, 3783 set: function(dates) { 3784 self.config._disable = parseDateRules(dates); 3785 } 3786 }); 3787 var timeMode = userConfig.mode === "time"; 3788 if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) { 3789 var defaultDateFormat = flatpickr.defaultConfig.dateFormat || defaults.dateFormat; 3790 formats2.dateFormat = userConfig.noCalendar || timeMode ? "H:i" + (userConfig.enableSeconds ? ":S" : "") : defaultDateFormat + " H:i" + (userConfig.enableSeconds ? ":S" : ""); 3791 } 3792 if (userConfig.altInput && (userConfig.enableTime || timeMode) && !userConfig.altFormat) { 3793 var defaultAltFormat = flatpickr.defaultConfig.altFormat || defaults.altFormat; 3794 formats2.altFormat = userConfig.noCalendar || timeMode ? "h:i" + (userConfig.enableSeconds ? ":S K" : " K") : defaultAltFormat + (" h:i"
3794+ (userConfig.enableSeconds ? ":S" : "") + " K"); 3795 } 3796 Object.defineProperty(self.config, "minDate", { 3797 get: function() { 3798 return self.config._minDate; 3799 }, 3800 set: minMaxDateSetter("min") 3801 }); 3802 Object.defineProperty(self.config, "maxDate", { 3803 get: function() { 3804 return self.config._maxDate; 3805 }, 3806 set: minMaxDateSetter("max") 3807 }); 3808 var minMaxTimeSetter = function(type) { 3809 return function(val) { 3810 self.config[type === "min" ? "_minTime" : "_maxTime"] = self.parseDate(val, "H:i:S"); 3811 }; 3812 }; 3813 Object.defineProperty(self.config, "minTime", { 3814 get: function() { 3815 return self.config._minTime; 3816 }, 3817 set: minMaxTimeSetter("min") 3818 }); 3819 Object.defineProperty(self.config, "maxTime", { 3820 get: function() { 3821 return self.config._maxTime; 3822 }, 3823 set: minMaxTimeSetter("max") 3824 }); 3825 if (userConfig.mode === "time") { 3826 self.config.noCalendar = true; 3827 self.config.enableTime = true; 3828 } 3829 Object.assign(self.config, formats2, userConfig); 3830 for (var i = 0; i < boolOpts.length; i++) 3831 self.config[boolOpts[i]] = self.config[boolOpts[i]] === true || self.config[boolOpts[i]] === "true"; 3832 HOOKS.filter(function(hook) { 3833 return self.config[hook] !== void 0; 3834 }
vendor: 5,891 bytes, lines 3834-3935
3834).forEach(function(hook) { 3835 self.config[hook] = arrayify(self.config[hook] || []).map(bindToInstance); 3836 }); 3837 self.isMobile = !self.config.disableMobile && !self.config.inline && self.config.mode === "single" && !self.config.disable.length && !self.config.enable && !self.config.weekNumbers && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 3838 for (var i = 0; i < self.config.plugins.length; i++) { 3839 var pluginConf = self.config.plugins[i](self) || {}; 3840 for (var key in pluginConf) { 3841 if (HOOKS.indexOf(key) > -1) { 3842 self.config[key] = arrayify(pluginConf[key]).map(bindToInstance).concat(self.config[key]); 3843 } else if (typeof userConfig[key] === "undefined") 3844 self.config[key] = pluginConf[key]; 3845 } 3846 } 3847 if (!userConfig.altInputClass) { 3848 self.config.altInputClass = getInputElem().className + " " + self.config.altInputClass; 3849 } 3850 triggerEvent("onParseConfig"); 3851 } 3852 function getInputElem() { 3853 return self.config.wrap ? element.querySelector("[data-input]") : element; 3854 } 3855 function setupLocale() { 3856 if (typeof self.config.locale !== "object" && typeof flatpickr.l10ns[self.config.locale] === "undefined") 3857 self.config.errorHandler(new Error("flatpickr: invalid locale " + self.config.locale)); 3858 self.l10n = __assign(__assign({}, flatpickr.l10ns.default), typeof self.config.locale === "object" ? self.config.locale : self.config.locale !== "default" ? flatpickr.l10ns[self.config.locale] : void 0); 3859 tokenRegex.D = "(" + self.l10n.weekdays.shorthand.join("|") + ")"; 3860 tokenRegex.l = "(" + self.l10n.weekdays.longhand.join("|") + ")"; 3861 tokenRegex.M = "(" + self.l10n.months.shorthand.join("|") + ")"; 3862 tokenRegex.F = "(" + self.l10n.months.longhand.join("|") + ")"; 3863 tokenRegex.K = "(" + self.l10n.amPM[0] + "|" + self.l10n.amPM[1] + "|" + self.l10n.amPM[0].toLowerCase() + "|" + self.l10n.amPM[1].toLowerCase() + ")"; 3864 var userConfig = __assign(__assign({}, instanceConfig), JSON.parse(JSON.stringify(element.dataset || {}))); 3865 if (userConfig.time_24hr === void 0 && flatpickr.defaultConfig.time_24hr === void 0) { 3866 self.config.time_24hr = self.l10n.time_24hr; 3867 } 3868 self.formatDate = createDateFormatter(self); 3869 self.parseDate = createDateParser({ config: self.config, l10n: self.l10n }); 3870 } 3871 function positionCalendar(customPositionElement) { 3872 if (typeof self.config.position === "function") { 3873 return void self.config.position(self, customPositionElement); 3874 } 3875 if (self.calendarContainer === void 0) 3876 return; 3877 triggerEvent("onPreCalendarPosition"); 3878 var positionElement = customPositionElement || self._positionElement; 3879 var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, function(acc, child) { 3880 return acc + child.offsetHeight; 3881 }, 0), calendarWidth = self.calendarContainer.offsetWidth, configPos = self.config.position.split(" "), configPosVertical = configPos[0], configPosHorizontal = configPos.length > 1 ? configPos[1] : null, inputBounds = positionElement.getBoundingClientRect(), distanceFromBottom = window.innerHeight - inputBounds.bottom, showOnTop = configPosVertical === "above" || configPosVertical !== "below" && distanceFromBottom < calendarHeight && inputBounds.top > calendarHeight; 3882 var top = window.pageYOffset + inputBounds.top + (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2); 3883 toggleClass(self.calendarContainer, "arrowTop", !showOnTop); 3884 toggleClass(self.calendarContainer, "arrowBottom", showOnTop); 3885 if (self.config.inline) 3886 return; 3887 var left = window.pageXOffset + inputBounds.left; 3888 var isCenter = false; 3889 var isRight = false; 3890 if (configPosHorizontal === "center") { 3891 left -= (calendarWidth - inputBounds.width) / 2; 3892 isCenter = true; 3893 } else if (configPosHorizontal === "right") { 3894 left -= calendarWidth - inputBounds.width; 3895 isRight = true; 3896 } 3897 toggleClass(self.calendarContainer, "arrowLeft", !isCenter && !isRight); 3898 toggleClass(self.calendarContainer, "arrowCenter", isCenter); 3899 toggleClass(self.calendarContainer, "arrowRight", isRight); 3900 var right = window.document.body.offsetWidth - (window.pageXOffset + inputBounds.right); 3901 var rightMost = left + calendarWidth > window.document.body.offsetWidth; 3902 var centerMost = right + calendarWidth > window.document.body.offsetWidth; 3903 toggleClass(self.calendarContainer, "rightMost", rightMost); 3904 if (self.config.static) 3905 return; 3906 self.calendarContainer.style.top = top + "px"; 3907 if (!rightMost) { 3908 self.calendarContainer.style.left = left + "px"; 3909 self.calendarContainer.style.right = "auto"; 3910 } else if (!centerMost) { 3911 self.calendarContainer.style.left = "auto"; 3912 self.calendarContainer.style.right = right + "px"; 3913 } else { 3914 var doc = getDocumentStyleSheet(); 3915 if (doc === void 0) 3916 return; 3917 var bodyWidth = window.document.body.offsetWidth; 3918 var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2); 3919 var centerBefore = ".flatpickr-calendar.centerMost:before"; 3920 var centerAfter = ".flatpickr-calendar.centerMost:after"; 3921 var centerIndex = doc.cssRules.length; 3922 var centerStyle = "{left:" + inputBounds.left + "px;right:auto;}"; 3923 toggleClass(self.calendarContainer, "rightMost", false); 3924 toggleClass(self.calendarContainer, "centerMost", true); 3925 doc.insertRule(centerBefore + "," + centerAfter + centerStyle, centerIndex); 3926 self.calendarContainer.style.left = centerLeft + "px"; 3927 self.calendarContainer.style.right = "auto"; 3928 } 3929 } 3930 function getDocumentStyleSheet() { 3931 var editableSheet = null; 3932 for (var i = 0; i < document.styleSheets.length; i++) { 3933 var sheet = document.styleSheets[i]; 3934 if (!sheet.cssRules) 3935 continue;
3936 try { 3937 sheet.cssRules; 3938 } catch (err) { 3939 continue; 3940 } 3941 editableSheet = sheet; 3942 break; 3943 } 3944 return editableSheet != null ? editableSheet : createStyleSheet(); 3945 } 3946 function createStyleSheet() { 3947 var style = document.createElement("style"); 3948 document.head.appendChild(style); 3949 return style.sheet; 3950 } 3951 function redraw() { 3952 if (self.config.noCalendar || self.isMobile) 3953 return; 3954 buildMonthSwitch(); 3955 updateNavigationCurrentMonth(); 3956 buildDays(); 3957 } 3958 function focusAndClose() { 3959 self._input.focus(); 3960 if (window.navigator.userAgent.indexOf("MSIE") !== -1 || navigator.msMaxTouchPoints !== void 0) { 3961 setTimeout(self.close, 0); 3962 } else { 3963 self.close(); 3964 } 3965 } 3966 function selectDate(e) { 3967 e.preventDefault(); 3968 e.stopPropagation(); 3969 var isSelectable = function(day) { 3970 return day.classList && day.classList.contains("flatpickr-day") && !day.classList.contains("flatpickr-disabled") && !day.classList.contains("notAllowed"); 3971 }; 3972 var t = findParent(getEventTarget(e), isSelectable); 3973 if (t === void 0) 3974 return; 3975 var target = t; 3976 var selectedDate = self.latestSelectedDateObj = new Date(target.dateObj.getTime()); 3977 var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth || selectedDate.getMonth() > self.currentMonth + self.config.showMonths - 1) && self.config.mode !== "range"; 3978 self.selectedDateElem = target; 3979 if (self.config.mode === "single") 3980 self.selectedDates = [selectedDate]; 3981 else if (self.config.mode === "multiple") { 3982 var selectedIndex = isDateSelected(selectedDate); 3983 if (selectedIndex) 3984 self.selectedDates.splice(parseInt(selectedIndex), 1); 3985 else 3986 self.selectedDates.push(selectedDate); 3987 } else if (self.config.mode === "range") { 3988 if (self.selectedDates.length === 2) { 3989 self.clear(false, false); 3990 } 3991 self.latestSelectedDateObj = selectedDate; 3992 self.selectedDates.push(selectedDate); 3993 if (compareDates(selectedDate, self.selectedDates[0], true) !== 0) 3994 self.selectedDates.sort(function(a, b) { 3995 return a.getTime() - b.getTime(); 3996 }); 3997 } 3998 setHoursFromInputs(); 3999 if (shouldChangeMonth) { 4000 var isNewYear = self.currentYear !== selectedDate.getFullYear(); 4001 self.currentYear = selectedDate.getFullYear(); 4002 self.currentMonth = selectedDate.getMonth(); 4003 if (isNewYear) { 4004 triggerEvent("onYearChange"); 4005 buildMonthSwitch(); 4006 } 4007 triggerEvent("onMonthChange"); 4008 } 4009 updateNavigationCurrentMonth(); 4010 buildDays(); 4011 updateValue(); 4012 if (!shouldChangeMonth && self.config.mode !== "range" && self.config.showMonths === 1) 4013 focusOnDayElem(target); 4014 else if (self.selectedDateElem !== void 0 && self.hourElement === void 0) { 4015 self.selectedDateElem && self.selectedDateElem.focus(); 4016 } 4017 if (self.hourElement !== void 0) 4018 self.hourElement !== void 0 && self.hourElement.focus(); 4019 if (self.config.closeOnSelect) { 4020 var single = self.config.mode === "single" && !self.config.enableTime; 4021 var range = self.config.mode === "range" && self.selectedDates.length === 2 && !self.config.enableTime; 4022 if (single || range) { 4023 focusAndClose(); 4024 } 4025 } 4026 triggerChange(); 4027 } 4028 var CALLBACKS = { 4029 locale: [setupLocale, updateWeekdays], 4030 showMonths: [buildMonths, setCalendarWidth, buildWeekdays], 4031 minDate: [jumpToDate], 4032 maxDate: [jumpToDate], 4033 positionElement: [updatePositionElement], 4034 clickOpens: [ 4035 function() { 4036 if (self.config.clickOpens === true) {
4037 bind(self._input, "focus", self.open); 4038 bind(self._input, "click", self.open); 4039 } else { 4040 self._input.removeEventListener("focus", self.open); 4041 self._input.removeEventListener("click", self.open); 4042 } 4043 } 4044 ] 4045 }; 4046 function set(option, value) { 4047 if (option !== null && typeof option === "object") { 4048 Object.assign(self.config, option); 4049 for (var key in option) { 4050 if (CALLBACKS[key] !== void 0) 4051 CALLBACKS[key].forEach(function(x) { 4052 return x(); 4053 }); 4054 } 4055 } else { 4056 self.config[option] = value; 4057 if (CALLBACKS[option] !== void 0) 4058 CALLBACKS[option].forEach(function(x) { 4059 return x(); 4060 }); 4061 else if (HOOKS.indexOf(option) > -1) 4062 self.config[option] = arrayify(value); 4063 } 4064 self.redraw(); 4065 updateValue(true); 4066 } 4067 function setSelectedDate(inputDate, format) { 4068 var dates = []; 4069 if (inputDate instanceof Array) 4070 dates = inputDate.map(function(d) { 4071 return self.parseDate(d, format); 4072 }); 4073 else if (inputDate instanceof Date || typeof inputDate === "number") 4074 dates = [self.parseDate(inputDate, format)]; 4075 else if (typeof inputDate === "string") { 4076 switch (self.config.mode) { 4077 case "single": 4078 case "time": 4079 dates = [self.parseDate(inputDate, format)]; 4080 break; 4081 case "multiple": 4082 dates = inputDate.split(self.config.conjunction).map(function(date) { 4083 return self.parseDate(date, format); 4084 }); 4085 break; 4086 case "range": 4087 dates = inputDate.split(self.l10n.rangeSeparator).map(function(date) { 4088 return self.parseDate(date, format); 4089 }); 4090 break; 4091 } 4092 } else 4093 self.config.errorHandler(new Error("Invalid date supplied: " + JSON.stringify(inputDate))); 4094 self.selectedDates = self.config.allowInvalidPreload ? dates : dates.filter(function(d) { 4095 return d instanceof Date && isEnabled(d, false); 4096 }); 4097 if (self.config.mode === "range") 4098 self.selectedDates.sort(function(a, b) { 4099 return a.getTime() - b.getTime(); 4100 }); 4101 } 4102 function setDate(date, triggerChange2, format) { 4103 if (triggerChange2 === void 0) { 4104 triggerChange2 = false; 4105 } 4106 if (format === void 0) { 4107 format = self.config.dateFormat; 4108 } 4109 if (date !== 0 && !date || date instanceof Array && date.length === 0) 4110 return self.clear(triggerChange2); 4111 setSelectedDate(date, format); 4112 self.latestSelectedDateObj = self.selectedDates[self.selectedDates.length - 1]; 4113 self.redraw(); 4114 jumpToDate(void 0, triggerChange2); 4115 setHoursFromDate(); 4116 if (self.selectedDates.length === 0) { 4117 self.clear(false); 4118 } 4119 updateValue(triggerChange2); 4120 if (triggerChange2) 4121 triggerEvent("onChange"); 4122 } 4123 function parseDateRules(arr) { 4124 return arr.slice().map(function(rule) { 4125 if (typeof rule === "string" || typeof rule === "number" || rule instanceof Date) { 4126 return self.parseDate(rule, void 0, true); 4127 } else if (rule && typeof rule === "object" && rule.from && rule.to) 4128 return { 4129 from: self.parseDate(rule.from, void 0), 4130 to: self.parseDate(rule.to, void 0) 4131 }; 4132 return rule; 4133 }).filter(function(x) { 4134 return x; 4135 }); 4136 } 4137 function setupDates() { 4138 self.selectedDates = []; 4139 self.now = self.parseDate(self.config.now) || /* @__PURE__ */ new Date(); 4140 var preloadedDate = self.config.defaultDate || ((self.input.nodeName === "INPUT" || self.input.nodeName === "TEXTAREA") && self.input.placeholder && self.input.value === self.input.placeholder ? null : self.input.value); 4141 if (preloadedDate) 4142 setSelectedDate(preloadedDate, self.config.dateFormat); 4143 self._initialDate = self.selectedDates.length > 0 ? self.selectedDates[0] : self.config.minDate && self.config.minDate.getTime() > self.now.getTime() ? self.config.minDate : self.config.maxDate && self.config.maxDate.getTime() < self.now.getTime() ? self.config.maxDate : self.now; 4144 self.currentYear = self._initialDate.getFullYear(); 4145 self.currentMonth = self._initialDate.getMonth(); 4146 if (self.selectedDates.length > 0) 4147 self.latestSelectedDateObj = self.selectedDates[0]; 4148 if (self.config.minTime !== void 0) 4149 self.config.minTime = self.parseDate(self.config.minTime, "H:i"); 4150 if (self.config.maxTime !== void 0) 4151 self.config.maxTime = self.parseDate(self.config.maxTime, "H:i"); 4152 self.minDateHasTime = !!self.config.minDate && (self.config.minDate.getHours() > 0 || self.config.minDate.getMinutes() > 0 || self.config.minDate.getSeconds() > 0); 4153 self.maxDateHasTime = !!self.config.maxDate && (self.config.maxDate.getHours() > 0 || self.config.maxDate.getMinutes() > 0 || self.config.maxDate.getSeconds() > 0); 4154 } 4155 function setupInputs() { 4156 self.input = getInputElem(); 4157 if (!self.input) { 4158 self.config.errorHandler(new Error("Invalid input element specified")); 4159 return; 4160 } 4161 self.input._type = self.input.type; 4162 self.input.type = "text"; 4163 self.input.classList.add("flatpickr-input"); 4164 self._input = self.input; 4165 if (self.config.altInput) { 4166 self.altInput = createElement(self.input.nodeName, self.config.altInputClass); 4167 self._input = self.altInput; 4168 self.altInput.placeholder = self.input.placeholder; 4169 self.altInput.disabled = self.input.disabled; 4170 self.altInput.required = self.input.required; 4171 self.altInput.tabIndex = self.input.tabIndex; 4172 self.altInput.type = "text"; 4173 self.input.setAttribute("type", "hidden"); 4174 if (!self.config.static && self.input.parentNode) 4175 self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling); 4176 } 4177 if (!self.config.allowInput) 4178 self._input.setAttribute("readonly", "readonly"); 4179 updatePositionElement(); 4180 } 4181 function updatePositionElement() { 4182 self._positionElement = self.config.positionElement || self._input; 4183 } 4184 function setupMobile() { 4185 var inputType = self.config.enableTime ? self.config.noCalendar ? "time" : "datetime-local" : "date"; 4186 self.mobileInput = createElement("input", self.input.className + " flatpickr-mobile"); 4187 self.mobileInput.tabIndex = 1; 4188 self.mobileInput.type = inputType; 4189 self.mobileInput.disabled = self.input.disabled; 4190 self.mobileInput.required = self.input.required; 4191 self.mobileInput.placeholder = self.input.placeholder; 4192 self.mobileFormatStr = inputType === "datetime-local" ? "Y-m-d\\TH:i:S" : inputType === "date" ? "Y-m-d" : "H:i:S"; 4193 if (self.selectedDates.length > 0) { 4194 self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr); 4195 } 4196 if (self.config.minDate) 4197 self.mobileInput.min = self.formatDate(self.config.minDate, "Y-m-d"); 4198 if (self.config.maxDate) 4199 self.mobileInput.max = self.formatDate(self.config.maxDate, "Y-m-d"); 4200 if (self.input.getAttribute("step")) 4201 self.mobileInput.step = String(self.input.getAttribute("step")); 4202 self.input.type = "hidden"; 4203 if (self.altInput !== void 0) 4204 self.altInput.type = "hidden"; 4205 try { 4206 if (self.input.parentNode) 4207 self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling); 4208 } catch (_a) { 4209 } 4210 bind(self.mobileInput, "change", function(e) { 4211 self.setDate(getEventTarget(e).value, false, self.mobileFormatStr); 4212 triggerEvent("onChange"); 4213 triggerEvent("onClose"); 4214 }); 4215 } 4216 function toggle(e) { 4217 if (self.isOpen === true) 4218 return self.close(); 4219 self.open(e); 4220 } 4221 function triggerEvent(event, data) { 4222 if (self.config === void 0) 4223 return; 4224 var hooks = self.config[event]; 4225 if (hooks !== void 0 && hooks.length > 0) { 4226 for (var i = 0; hooks[i] && i < hooks.length; i++) 4227 hooks[i](self.selectedDates, self.input.value, self, data); 4228 } 4229 if (event === "onChange") { 4230 self.input.dispatchEvent(createEvent("change")); 4231 self.input.dispatchEvent(createEvent("input")); 4232 } 4233 } 4234 function createEvent(name) { 4235 var e = document.createEvent("Event"); 4236 e.initEvent(name, true, true); 4237 return e; 4238 } 4239 function isDateSelected(date) { 4240 for (var i = 0; i < self.selectedDates.length; i++) { 4241 var selectedDate = self.selectedDates[i]; 4242 if (selectedDate instanceof Date && compareDates(selectedDate, date) === 0) 4243 return "" + i; 4244 } 4245 return false;
4246 } 4247 function isDateInRange(date) { 4248 if (self.config.mode !== "range" || self.selectedDates.length < 2) 4249 return false; 4250 return compareDates(date, self.selectedDates[0]) >= 0 && compareDates(date, self.selectedDates[1]) <= 0; 4251 } 4252 function updateNavigationCurrentMonth() { 4253 if (self.config.noCalendar || self.isMobile || !self.monthNav) 4254 return; 4255 self.yearElements.forEach(function(yearElement, i) { 4256 var d = new Date(self.currentYear, self.currentMonth, 1); 4257 d.setMonth(self.currentMonth + i); 4258 if (self.config.showMonths > 1 || self.config.monthSelectorType === "static") { 4259 self.monthElements[i].textContent = monthToStr(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + " "; 4260 } else { 4261 self.monthsDropdownContainer.value = d.getMonth().toString(); 4262 } 4263 yearElement.value = d.getFullYear().toString(); 4264 }); 4265 self._hidePrevMonthArrow = self.config.minDate !== void 0 && (self.currentYear === self.config.minDate.getFullYear() ? self.currentMonth <= self.config.minDate.getMonth() : self.currentYear < self.config.minDate.getFullYear()); 4266 self._hideNextMonthArrow = self.config.maxDate !== void 0 && (self.currentYear === self.config.maxDate.getFullYear() ? self.currentMonth + 1 > self.config.maxDate.getMonth() : self.currentYear > self.config.maxDate.getFullYear()); 4267 } 4268 function getDateStr(specificFormat) { 4269 var format = specificFormat || (self.config.altInput ? self.config.altFormat : self.config.dateFormat); 4270 return self.selectedDates.map(function(dObj) { 4271 return self.formatDate(dObj, format); 4272 }).filter(function(d, i, arr) { 4273 return self.config.mode !== "range" || self.config.enableTime || arr.indexOf(d) === i; 4274 }).join(self.config.mode !== "range" ? self.config.conjunction : self.l10n.rangeSeparator); 4275 } 4276 function updateValue(triggerChange2) { 4277 if (triggerChange2 === void 0) { 4278 triggerChange2 = true; 4279 } 4280 if (self.mobileInput !== void 0 && self.mobileFormatStr) { 4281 self.mobileInput.value = self.latestSelectedDateObj !== void 0 ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr) : ""; 4282 } 4283 self.input.value = getDateStr(self.config.dateFormat); 4284 if (self.altInput !== void 0) { 4285 self.altInput.value = getDateStr(self.config.altFormat); 4286 } 4287 if (triggerChange2 !== false) 4288 triggerEvent("onValueUpdate"); 4289 } 4290 function onMonthNavClick(e) { 4291 var eventTarget = getEventTarget(e); 4292 var isPrevMonth = self.prevMonthNav.contains(eventTarget); 4293 var isNextMonth = self.nextMonthNav.contains(eventTarget); 4294 if (isPrevMonth || isNextMonth) { 4295 changeMonth(isPrevMonth ? -1 : 1); 4296 } else if (self.yearElements.indexOf(eventTarget) >= 0) { 4297 eventTarget.select(); 4298 } else if (eventTarget.classList.contains("arrowUp")) { 4299 self.changeYear(self.currentYear + 1); 4300 } else if (eventTarget.classList.contains("arrowDown")) { 4301 self.changeYear(self.currentYear - 1); 4302 } 4303 } 4304 function timeWrapper(e) { 4305 e.preventDefault(); 4306 var isKeyDown = e.type === "keydown", eventTarget = getEventTarget(e), input = eventTarget; 4307 if (self.amPM !== void 0 && eventTarget === self.amPM) { 4308 self.amPM.textContent = self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])]; 4309 } 4310 var min = parseFloat(input.getAttribute("min")), max = parseFloat(input.getAttribute("max")), step = parseFloat(input.getAttribute("step")), curValue = parseInt(input.value, 10), delta = e.delta || (isKeyDown ? e.which === 38 ? 1 : -1 : 0); 4311 var newValue = curValue + step * delta; 4312 if (typeof input.value !== "undefined" && input.value.length === 2) { 4313 var isHourElem = input === self.hourElement, isMinuteElem = input === self.minuteElement; 4314 if (newValue < min) { 4315 newValue = max + newValue + int(!isHourElem) + (int(isHourElem) && int(!self.amPM)); 4316 if (isMinuteElem) 4317 incrementNumInput(void 0, -1, self.hourElement); 4318 } else if (newValue > max) { 4319 newValue = input === self.hourElement ? newValue - max - int(!self.amPM) : min; 4320 if (isMinuteElem) 4321 incrementNumInput(void 0, 1, self.hourElement); 4322 } 4323 if (self.amPM && isHourElem && (step === 1 ? newValue + curValue === 23 : Math.abs(newValue - curValue) > step)) { 4324 self.amPM.textContent = self.l10n.amPM[int(self.amPM.textContent === self.l10n.amPM[0])]; 4325 } 4326 input.value = pad(newValue); 4327 } 4328 } 4329 init(); 4330 return self; 4331} 4332function _flatpickr(nodeList, config) { 4333 var nodes = Array.prototype.slice.call(nodeList).filter(function(x) { 4334 return x instanceof HTMLElement; 4335 }); 4336 var instances = []; 4337 for (var i = 0; i < nodes.length; i++) { 4338 var node = nodes[i]; 4339 try { 4340 if (node.getAttribute("data-fp-omit") !== null) 4341 continue; 4342 if (node._flatpickr !== void 0) { 4343 node._flatpickr.destroy(); 4344 node._flatpickr = void 0; 4345 } 4346 node._flatpickr = FlatpickrInstance(node, config || {}); 4347 instances.push(node._flatpickr); 4348 } catch (e) { 4349 console.error(e); 4350 } 4351 } 4352 return instances.length === 1 ? instances[0] : instances; 4353} 4354if (typeof HTMLElement !== "undefined" && typeof HTMLCollection !== "undefined" && typeof NodeList !== "undefined") { 4355 HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function(config) { 4356 return _flatpickr(this, config); 4357 }; 4358 HTMLElement.prototype.flatpickr = function(config) { 4359 return _flatpickr([this], config); 4360 }; 4361} 4362var flatpickr = function(selector, config) { 4363 if (typeof selector === "string") { 4364 return _flatpickr(window.document.querySelectorAll(selector), config); 4365 } else if (selector instanceof Node) { 4366 return _flatpickr([selector], config); 4367 } else { 4368 return _flatpickr(selector, config); 4369 } 4370}; 4371flatpickr.defaultConfig = {}; 4372flatpickr.l10ns = { 4373 en: __assign({}, english), 4374 default: __assign({}, english) 4375}; 4376flatpickr.localize = function(l10n) { 4377 flatpickr.l10ns.default = __assign(__assign({}, flatpickr.l10ns.default), l10n); 4378}; 4379flatpickr.setDefaults = function(config) { 4380 flatpickr.defaultConfig = __assign(__assign({}, flatpickr.defaultConfig), config); 4381}; 4382flatpickr.parseDate = createDateParser({}); 4383flatpickr.formatDate = createDateFormatter({}); 4384flatpickr.compareDates = compareDates; 4385if (typeof jQuery !== "undefined" && typeof jQuery.fn !== "undefined") { 4386 jQuery.fn.flatpickr = function(config) { 4387 return _flatpickr(this, config); 4388 }; 4389} 4390Date.prototype.fp_incr = function(days) { 4391 return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === "string" ? parseInt(days, 10) : days)); 4392}; 4393if (typeof window !== "undefined") { 4394 window.flatpickr = flatpickr; 4395} 4396const reviews = () => { 4397 $(function() { 4398 if ($("div.widget-reviews").length == 0) { 4399 return; 4400 } 4401 $(".widget-reviews input, .widget-reviews textarea").each(function() { 4402 input_fill($(this)); 4403 }).on("focus blur click", function() { 4404 input_fill($(this)); 4405 }); 4406 function input_fill(self) { 4407 if (self.val().length > 0) { 4408 self.parent().addClass("is-filled"); 4409 } 4410 } 4411 if ($(".widget-reviews__rating").length) { 4412 $(".widget-reviews__rating-item").on("mouseover", function() { 4413 $(this).prevAll(".widget-reviews__rating-item").addClass("widget-reviews__rating-item--active"); 4414 $(this).nextAll(".widget-reviews__rating-item").addClass("widget-reviews__rating-item--hover"); 4415 }).on("mouseout", function() { 4416 $(".widget-reviews__rating-item").removeClass( 4417 "widget-reviews__rating-item--active widget-reviews__rating-item--hover" 4418 ); 4419 }); 4420 } 4421 $("body").on("click", ".widget-reviews__close", function() { 4422 $(".widget-reviews").addClass("widget-reviews--hide"); 4423 setTimeout(function() { 4424 $(".widget-reviews").remove(); 4425 }, 1e3); 4426 }); 4427 $('input[name="sentiment"]').change(function() { 4428 var sentiment = $('input[name="sentiment"]:checked').val(); 4429 $(".reviews-when-" + sentiment).show(); 4430 $(".widget-reviews__step").hide(); 4431 $(".widget-reviews__step--2").show(); 4432 }); 4433 $("#review-form").validate({ 4434 rules: {}, 4435 submitHandler: function(form) { 4436 var $form = $(form); 4437 var data = $form.serialize(); 4438 var $button = $form.find('button[type="submit"]'); 4439 $button.text("Submitting...").prop("disabled", true); 4440 $.ajax({ 4441 type: "POST", 4442 url: "/api/review", 4443 data, 4444 dataType: "json" 4445 }).done(function(data2) { 4446 $button.prop("disabled", false).text("Submit feedback"); 4447 if (!data2.error) { 4448 $(".widget-reviews__step").hide(); 4449 $(".widget-reviews__step--3").show(); 4450 setTimeout(function() { 4451 $(".widget-reviews").addClass( 4452 "widget-reviews--hide" 4453 ); 4454 }, 5e3); 4455 } 4456 }).fail(function() { 4457 $button.prop("disabled", false).text("Try again"); 4458 }); 4459 } 4460 }); 4461 }); 4462}; 4463const agencyManagement = () => { 4464 const deleteButtons = document.querySelectorAll(".delete-agency-user"); 4465 const roleSelects = document.querySelectorAll(".agency-user-role"); 4466 const inviteForm = document.getElementById("invite-agency-user"); 4467 const csrfToken = $('meta[name="csrf-token"]').attr("content"); 4468 const headers = { 4469 "X-CSRF-TOKEN": csrfToken 4470 }; 4471 const successWrapper = document.getElementById("agency-success-wrapper"); 4472 const errorWrapper = document.getElementById("agency-error-wrapper"); 4473 deleteButtons.forEach((button) => { 4474 button.addEventListener("click", function(event) { 4475 const userId = this.getAttribute("data-user"); 4476 $(successWrapper).hide(); 4477 $(errorWrapper).hide(); 4478 $.ajax({ 4479 type: "POST", 4480 url: "/manage-users/remove-user", 4481 data: { 4482 userId 4483 }, 4484 headers 4485 }).done(function(data) { 4486 $('[data-userid="' + data.userId + '"]').remove(); 4487 $(successWrapper).html(data.message).show(); 4488 setTimeout(function() { 4489 $(successWrapper).fadeOut("slow"); 4490 }, 5e3); 4491 if (data.total < 10) { 4492 showInviteForm$1(); 4493 } 4494 }).fail(function(data) { 4495 let errorMessage = data.responseJSON.message || "An error occurred"; 4496 $(errorWrapper).html(errorMessage).show(); 4497 }); 4498 }); 4499 });
4500 roleSelects.forEach((select) => { 4501 select.addEventListener("change", function(event) { 4502 const userId = this.getAttribute("data-user"); 4503 const selectedOptionValue = event.target.value; 4504 $(successWrapper).hide(); 4505 $(errorWrapper).hide(); 4506 $.ajax({ 4507 type: "POST", 4508 url: "/manage-users/set-user-role", 4509 data: { 4510 userId, 4511 role: selectedOptionValue 4512 }, 4513 headers 4514 }).done(function(response) { 4515 $(successWrapper).html(response.message).show(); 4516 setTimeout(function() { 4517 $(successWrapper).fadeOut("slow"); 4518 }, 5e3); 4519 }).fail(function(response) { 4520 let errorMessage = response.responseJSON.message || "An error occurred"; 4521 $(errorWrapper).html(errorMessage).show(); 4522 }); 4523 }); 4524 }); 4525 if (inviteForm) { 4526 inviteForm.addEventListener("submit", function(e) { 4527 e.preventDefault(); 4528 const formData = new FormData(this); 4529 $(successWrapper).hide(); 4530 $(errorWrapper).hide(); 4531 fetch("/manage-users/invite-user", { 4532 method: "POST", 4533 body: formData, 4534 headers 4535 }).then((response) => response.json()).then((data) => { 4536 if (data.success) { 4537 var newListItem = $( 4538 "<div class='card-user'><svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><path fill='#065af9' d='M13.43 10.51c-.3-.73-.74-1.39-1.3-1.95s-1.21-1-1.95-1.3c-.18-.07-.36-.14-.55-.2.98-.59 1.64-1.66 1.64-2.88C11.27 2.32 9.76.8 7.9.8S4.52 2.32 4.52 4.18c0 1.22.66 2.28 1.64 2.88-.94.28-1.79.79-2.5 1.5A6.03 6.03 0 0 0 1.9 12.8v1.5c0 .41.34.75.75.75h10.5c.41 0 .75-.34.75-.75v-1.5c-.01-.79-.16-1.56-.47-2.29zm-5.54-8.2c1.03 0 1.87.84 1.87 1.88s-.84 1.87-1.87 1.87-1.87-.84-1.87-1.88.84-1.87 1.87-1.87zm4.5 11.25h-9v-.75c0-1.18.48-2.34 1.32-3.18 1.27-1.27 3.24-1.66 4.9-.98.55.23 1.04.56 1.46.98s.75.91.97 1.46c.23.55.34 1.13.34 1.72v.75z'/></svg><span class='card-user__text'>" + data.email + '</span> <button type="button" class="card-user__button revoke-invite" data-invite="' + data.id + '">Revoke</button></div>' 4539 ); 4540 $("#agency-invited-users").show(); 4541 $("#agency-invited-users-list").append(newListItem); 4542 inviteForm.reset(); 4543 if (data.total >= 10) { 4544 hideInviteForm$1(); 4545 } 4546 $(successWrapper).html(data.message).show(); 4547 setTimeout(function() { 4548 $(successWrapper).fadeOut("slow"); 4549 }, 5e3); 4550 } 4551 if (data.errors) { 4552 let errorMessageHtml = ""; 4553 for (const fieldName in data.errors) { 4554 data.errors[fieldName].forEach(function(error) { 4555 errorMessageHtml += error + "<br>"; 4556 }); 4557 } 4558 $(errorWrapper).html(errorMessageHtml).show(); 4559 } 4560 }).catch((error) => { 4561 }); 4562 }); 4563 } 4564 $("#invite-agency-user").on("click", ".revoke-invite", function() { 4565 const inviteId = $(this).data("invite"); 4566 let formData = new FormData(); 4567 formData.append("invite", inviteId); 4568 const formDataObj = Object.fromEntries(formData.entries()); 4569 $(successWrapper).hide(); 4570 $(errorWrapper).hide(); 4571 $.ajax({ 4572 type: "POST", 4573 url: "/manage-users/revoke-invite", 4574 data: formDataObj, 4575 headers, 4576 success: function(data) { 4577 if (data.success) { 4578 $('[data-invite="' + data.inviteId + '"]').closest(".card-user").remove(); 4579 $(successWrapper).html(data.message).show(); 4580 setTimeout(function() { 4581 $(successWrapper).fadeOut("slow"); 4582 }, 5e3); 4583 if (data.total < 10) { 4584 showInviteForm$1(); 4585 } 4586 if (data.invited === 0) { 4587 $("#agency-invited-users").hide(); 4588 } else { 4589 $("#agency-invited-users").show(); 4590 } 4591 } 4592 if (data.errors) { 4593 let errorMessageHtml = ""; 4594 for (const fieldName in data.errors) { 4595 data.errors[fieldName].forEach(function(error) { 4596 errorMessageHtml += error + "<br>"; 4597 }); 4598 } 4599 $(errorWrapper).html(errorMessageHtml).show(); 4600 } 4601 }, 4602 error: function(jqXHR) { 4603 let errorMessage = "An error occurred"; 4604 if (jqXHR.responseJSON && jqXHR.responseJSON.message) { 4605 errorMessage = jqXHR.responseJSON.message; 4606 } 4607 $(errorWrapper).html(errorMessage).show(); 4608 } 4609 }); 4610 }); 4611}; 4612function hideInviteForm$1() { 4613 const elements = document.querySelectorAll( 4614 '[data-form-component="invite-form"]' 4615 );
4616 elements.forEach((element) => { 4617 element.style.display = "none"; 4618 }); 4619} 4620function showInviteForm$1() { 4621 const elements = document.querySelectorAll( 4622 '[data-form-component="invite-form"]' 4623 ); 4624 elements.forEach((element) => { 4625 element.style.display = ""; 4626 }); 4627} 4628const clientManagement = () => { 4629 const deleteButtons = document.querySelectorAll(".delete-client"); 4630 const inviteForm = document.getElementById("invite-client"); 4631 const csrfToken = $('meta[name="csrf-token"]').attr("content"); 4632 const headers = { 4633 "X-CSRF-TOKEN": csrfToken 4634 }; 4635 const successWrapper = document.getElementById("client-success-wrapper"); 4636 const errorWrapper = document.getElementById("client-error-wrapper"); 4637 deleteButtons.forEach((button) => { 4638 button.addEventListener("click", function(event) { 4639 const userId = this.getAttribute("data-user"); 4640 $(successWrapper).hide(); 4641 $(errorWrapper).hide(); 4642 $.ajax({ 4643 type: "POST", 4644 url: "/manage-clients/remove-client", 4645 data: { 4646 userId 4647 }, 4648 headers 4649 }).done(function(data) { 4650 $('[data-userid="' + data.userId + '"]').remove(); 4651 $(successWrapper).html(data.message).show(); 4652 setTimeout(function() { 4653 $(successWrapper).fadeOut("slow"); 4654 }, 5e3); 4655 if (data.total < 10) { 4656 showInviteForm(); 4657 } 4658 }).fail(function(data) { 4659 let errorMessage = data.responseJSON.message || "An error occurred"; 4660 $(errorWrapper).html(errorMessage).show(); 4661 }); 4662 }); 4663 }); 4664 if (inviteForm) { 4665 inviteForm.addEventListener("submit", function(e) { 4666 e.preventDefault(); 4667 const formData = new FormData(this); 4668 $(successWrapper).hide(); 4669 $(errorWrapper).hide(); 4670 fetch("/manage-clients/invite-client", { 4671 method: "POST", 4672 body: formData, 4673 headers 4674 }).then((response) => response.json()).then((data) => { 4675 if (data.success) { 4676 var newListItem = $( 4677 "<div class='card-user'><svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'><path fill='#065af9' d='M13.43 10.51c-.3-.73-.74-1.39-1.3-1.95s-1.21-1-1.95-1.3c-.18-.07-.36-.14-.55-.2.98-.59 1.64-1.66 1.64-2.88C11.27 2.32 9.76.8 7.9.8S4.52 2.32 4.52 4.18c0 1.22.66 2.28 1.64 2.88-.94.28-1.79.79-2.5 1.5A6.03 6.03 0 0 0 1.9 12.8v1.5c0 .41.34.75.75.75h10.5c.41 0 .75-.34.75-.75v-1.5c-.01-.79-.16-1.56-.47-2.29zm-5.54-8.2c1.03 0 1.87.84 1.87 1.88s-.84 1.87-1.87 1.87-1.87-.84-1.87-1.88.84-1.87 1.87-1.87zm4.5 11.25h-9v-.75c0-1.18.48-2.34 1.32-3.18 1.27-1.27 3.24-1.66 4.9-.98.55.23 1.04.56 1.46.98s.75.91.97 1.46c.23.55.34 1.13.34 1.72v.75z'/></svg><span class='card-user__text'>" + data.email + '</span> <button type="button" class="card-user__button revoke-invite" data-invite="' + data.id + '">Revoke</button></div>' 4678 ); 4679 $("#invited-clients").show(); 4680 $("#invited-clients-list").append(newListItem); 4681 inviteForm.reset(); 4682 if (data.total >= 10) { 4683 hideInviteForm(); 4684 } 4685 $(successWrapper).html(data.message).show(); 4686 setTimeout(function() { 4687 $(successWrapper).fadeOut("slow"); 4688 }, 5e3); 4689 } 4690 if (data.errors) { 4691 let errorMessageHtml = ""; 4692 for (const fieldName in data.errors) { 4693 data.errors[fieldName].forEach(function(error) { 4694 errorMessageHtml += error + "<br>"; 4695 }); 4696 } 4697 $(errorWrapper).html(errorMessageHtml).show(); 4698 } 4699 }).catch((error) => { 4700 }); 4701 }); 4702 } 4703 $("#invite-client").on("click", ".revoke-invite", function() { 4704 const inviteId = $(this).data("invite"); 4705 let formData = new FormData(); 4706 formData.append("invite", inviteId); 4707 const formDataObj = Object.fromEntries(formData.entries()); 4708 $(successWrapper).hide(); 4709 $(errorWrapper).hide(); 4710 $.ajax({ 4711 type: "POST", 4712 url: "/manage-clients/revoke-invite", 4713 data: formDataObj, 4714 headers, 4715 success: function(data) { 4716 if (data.success) { 4717 $('[data-invite="' + data.inviteId + '"]').closest(".card-user").remove(); 4718 $(successWrapper).html(data.message).show(); 4719 setTimeout(function() { 4720 $(successWrapper).fadeOut("slow"); 4721 }, 5e3); 4722 if (data.total < 10) { 4723 showInviteForm(); 4724 } 4725 if (data.invited === 0) { 4726 $("#invited-clients").hide(); 4727 } else { 4728 $("#invited-clients").show(); 4729 } 4730 } 4731 if (data.errors) { 4732 let errorMessageHtml = ""; 4733 for (const fieldName in data.errors) { 4734 data.errors[fieldName].forEach(function(error) { 4735 errorMessageHtml += error + "<br>"; 4736 }); 4737 } 4738 $(errorWrapper).html(errorMessageHtml).show(); 4739 } 4740 }, 4741 error: function(jqXHR) { 4742 let errorMessage = "An error occurred"; 4743 if (jqXHR.responseJSON && jqXHR.responseJSON.message) { 4744 errorMessage = jqXHR.responseJSON.message; 4745 } 4746 $(errorWrapper).html(errorMessage).show(); 4747 } 4748 }); 4749 }); 4750}; 4751function hideInviteForm() { 4752 const elements = document.querySelectorAll( 4753 '[data-form-component="invite-form"]' 4754 );
4755 elements.forEach((element) => { 4756 element.style.display = "none"; 4757 }); 4758} 4759function showInviteForm() { 4760 const elements = document.querySelectorAll( 4761 '[data-form-component="invite-form"]' 4762 ); 4763 elements.forEach((element) => { 4764 element.style.display = ""; 4765 }); 4766} 4767const policyTabs = () => { 4768 const policy = document.querySelector(".policy-tabs"); 4769 let tabs; 4770 let tabList; 4771 let policyPacks; 4772 if (policy != null) { 4773 tabs = policy.querySelectorAll('[role="tab"]'); 4774 tabList = policy.querySelector('[role="tablist"]'); 4775 policyPacks = policy.querySelectorAll(".policy-packs"); 4776 } 4777 if (tabs) { 4778 tabs.forEach((tab) => { 4779 tab.addEventListener("click", changeTabs); 4780 }); 4781 } 4782 if (tabList) { 4783 let tabFocus = 0; 4784 tabList.addEventListener("keydown", (e) => { 4785 if (e.keyCode === 39 || e.keyCode === 37) { 4786 tabs[tabFocus].setAttribute("tabindex", -1); 4787 if (e.keyCode === 39) { 4788 tabFocus++; 4789 if (tabFocus >= tabs.length) { 4790 tabFocus = 0; 4791 } 4792 } else if (e.keyCode === 37) { 4793 tabFocus--; 4794 if (tabFocus < 0) { 4795 tabFocus = tabs.length - 1; 4796 } 4797 } 4798 tabs[tabFocus].setAttribute("tabindex", 0); 4799 tabs[tabFocus].focus(); 4800 } 4801 }); 4802 } 4803 if (policyPacks) { 4804 policyPacks.forEach((pack) => { 4805 const inner = pack.getElementsByClassName("policy-packs__inner")[0]; 4806 pack.style.setProperty("--height", inner.offsetHeight + "px"); 4807 let timeout; 4808 window.addEventListener("resize", function() { 4809 clearTimeout(timeout); 4810 timeout = setTimeout(function() { 4811 pack.style.setProperty( 4812 "--height", 4813 inner.offsetHeight + "px" 4814 ); 4815 }, 150); 4816 }); 4817 }); 4818 } 4819 function changeTabs(e) { 4820 const target = e.target; 4821 const parent = target.parentNode; 4822 const grandparent = parent.parentNode; 4823 parent.querySelectorAll('[aria-selected="true"]').forEach((t) => t.setAttribute("aria-selected", false)); 4824 target.setAttribute("aria-selected", true); 4825 grandparent.querySelectorAll('[role="tabpanel"]').forEach((p) => p.classList.remove("is-active")); 4826 grandparent.parentNode.querySelector(`#${target.getAttribute("aria-controls")}`).classList.add("is-active"); 4827 } 4828}; 4829const policyUpdate = () => { 4830 const successMessage = document.querySelector(".alert--success"); 4831 if (successMessage) { 4832 setTimeout(() => { 4833 successMessage.style.display = "none"; 4834 }, 5e3); 4835 } 4836}; 4837const trackEvent = function(e) { 4838 var category = e["category"]; 4839 var action = e["action"]; 4840 var label = e["label"]; 4841 var value = e["value"]; 4842 if (typeof dataLayer != "undefined") { 4843 dataLayer.push({ 4844 event: "pack_purchase", 4845 event_category: category, 4846 event_action: action, 4847 event_label: label, 4848 event_value: value 4849 }); 4850 } 4851}; 4852const initThankYou = () => { 4853 if (!$("body").hasClass("thank-you")) { 4854 return; 4855 } 4856 if (typeof completed_order !== "undefined") { 4857 trackEvent({ 4858 category: completed_order.type, 4859 action: "payment", 4860 label: completed_order.token, 4861 value: completed_order.price 4862 }); 4863 if (typeof dataLayer != "undefined") { 4864 dataLayer.push({ ecommerce: null }); 4865 dataLayer.push({ 4866 ecommerce: { 4867 purchase: { 4868 actionField: { 4869 id: completed_order.token, 4870 affiliation: "Online Store", 4871 revenue: completed_order.price, 4872 tax: "0", 4873 shipping: "0", 4874 coupon: completed_order.coupon 4875 }, 4876 products: [ 4877 { 4878 name: completed_order.type, 4879 price: completed_order.price, 4880 brand: "GetTerms", 4881 category: "eCommerce", 4882 quantity: 1 4883 } 4884 ] 4885 } 4886 } 4887 }); 4888 } 4889 setTimeout(function() { 4890 $(".thank-you--message").hide(); 4891 $(".thank-you--proceed").show(); 4892 window.location.href = completed_order.url; 4893 }, 5e3); 4894 } 4895}; 4896const creditSelect = () => { 4897 $(document).ready(() => { 4898 const creditOption = $('input[name="creditOption"]:checked'); 4899 const generateTermSubmitButton = $("#generate-term-submit-button"); 4900 const generateTermButtonInner = generateTermSubmitButton.find(".inner"); 4901 if (creditOption.val()) { 4902 generateTermSubmitButton.removeClass("disabled"); 4903 if (creditOption.val() === "securePayment") { 4904 generateTermButtonInner.html("Proceed to Plan Selection"); 4905 } else { 4906 generateTermButtonInner.html("Create Compliance Pack"); 4907 } 4908 } 4909 $('input[name="creditOption"]').on("change", function() { 4910 const selectedCreditOption = $(this); 4911 if (selectedCreditOption.val()) { 4912 generateTermSubmitButton.removeClass("disabled"); 4913 if (selectedCreditOption.val() === "securePayment") { 4914 generateTermButtonInner.html("Proceed to Plan Selection"); 4915 } else { 4916 generateTermButtonInner.html("Create Compliance Pack"); 4917 } 4918 } else { 4919 generateTermSubmitButton.addClass("disabled"); 4920 generateTermButtonInner.html("Please Select an Option"); 4921 } 4922 }); 4923 }); 4924}; 4925const enableSubmit = () => { 4926 if (document.querySelector(".form-required")) { 4927 var form = document.querySelector(".form-required"); 4928 var required = document.querySelectorAll("input.required"); 4929 var submit = document.querySelector('button[type="submit"]'); 4930 form.addEventListener("keyup", function() { 4931 var disabled = false;
4932 required.forEach((input) => { 4933 if (input.value === "" || !input.value.replace(/\s/g, "").length) { 4934 disabled = true; 4935 } 4936 }); 4937 if (disabled) { 4938 submit.classList.add("disabled"); 4939 } else { 4940 submit.classList.remove("disabled"); 4941 } 4942 }); 4943 } 4944}; 4945class BtnExpand { 4946 constructor(selector, config = { 4947 classname: "btn--expand", 4948 closeOnOutsideClick: false, 4949 events: {} 4950 }) { 4951 this.selector = selector; 4952 this.config = config; 4953 this.elements = document.querySelectorAll(this.selector); 4954 this.is_ie11 = !!window.MSInputMethodContext && !!document.documentMode; 4955 if (this.elements.length === 0) { 4956 return; 4957 } 4958 this.mount(); 4959 } 4960 mount() { 4961 if (this.config.events) { 4962 Object.keys(this.config.events).forEach((eventName) => { 4963 let eventCallback = this.config.events[eventName]; 4964 this.elements.forEach( 4965 (el) => el.addEventListener(eventName, eventCallback), 4966 { 4967 passive: true, 4968 once: true 4969 } 4970 ); 4971 }); 4972 } 4973 this.init(); 4974 } 4975 init() { 4976 this.elements.forEach((btn) => { 4977 btn.addEventListener("click", () => { 4978 this.toggleBtn( 4979 btn, 4980 btn.getAttribute("aria-expanded") == "true" ? false : true 4981 ); 4982 }); 4983 if (this.config.closeOnOutsideClick) { 4984 document.addEventListener( 4985 "click", 4986 (evt) => { 4987 if (jQuery(evt.target).parents(this.selector).length === 0 && evt.target !== btn && jQuery(evt.target).parents( 4988 `#${btn.getAttribute("aria-controls")}` 4989 ).length === 0) { 4990 this.toggleBtn(btn, false); 4991 } 4992 }, 4993 false 4994 ); 4995 } 4996 }); 4997 } 4998 toggleBtn(btn, is_expanded) { 4999 const target = document.getElementById( 5000 btn.getAttribute("aria-controls") 5001 ); 5002 btn.setAttribute("aria-expanded", is_expanded); 5003 if (target) { 5004 const parents = document.querySelectorAll( 5005 `[data-policy="${target.getAttribute("id")}"]` 5006 ); 5007 target.setAttribute("data-expanded", is_expanded); 5008 parents.forEach((parent) => { 5009 if (is_expanded) { 5010 parent.classList.add("is-expanded"); 5011 } else { 5012 parent.classList.remove("is-expanded"); 5013 } 5014 }); 5015 } 5016 } 5017} 5018class paymentPlanDropdownHandler { 5019 constructor(selector, config = { 5020 inputName: "subscription_type", 5021 classname: "payment-plan-trigger", 5022 itemsClassName: "payment-plan-item", 5023 dropdownClassName: "payment-plan-dropdown", 5024 events: {} 5025 }) { 5026 this.selector = selector; 5027 this.config = config; 5028 this.elements = document.querySelectorAll(this.selector); 5029 this.is_ie11 = !!window.MSInputMethodContext && !!document.documentMode; 5030 if (this.elements.length === 0) { 5031 return; 5032 } 5033 this.mount(); 5034 } 5035 mount() { 5036 if (this.config.events) { 5037 Object.keys(this.config.events).forEach((eventName) => { 5038 let eventCallback = this.config.events[eventName]; 5039 this.elements.forEach( 5040 (el) => el.addEventListener(eventName, eventCallback), 5041 { 5042 passive: true, 5043 once: true 5044 } 5045 ); 5046 }); 5047 } 5048 this.init(); 5049 } 5050 init() { 5051 this.elements.forEach((trigger) => { 5052 trigger.addEventListener("click", () => { 5053 this.toggleClick( 5054 trigger, 5055 trigger.getAttribute("aria-expanded") == "true" ? false : true 5056 ); 5057 }); 5058 document.addEventListener( 5059 "click", 5060 (evt) => { 5061 if (!evt.target.classList.contains(this.config.classname) && jQuery(evt.target).parents(`.${this.config.classname}`).length === 0 && jQuery(evt.target).parents( 5062 `.${this.config.dropdownClassName}` 5063 ).length === 0) { 5064 this.toggleClick(trigger, false); 5065 } 5066 }, 5067 false 5068 ); 5069 }); 5070 this.planChange( 5071 document.querySelectorAll( 5072 'input[type="radio"][name="' + this.config.inputName + '"]' 5073 ) 5074 ); 5075 const wrapper = document.querySelector(".payment-plan"); 5076 if (!wrapper.classList.contains("payment-plan--initialized")) { 5077 wrapper.classList.add("payment-plan--initialized"); 5078 } 5079 if (document.querySelectorAll( 5080 'input[type="radio"][name="' + this.config.inputName + '"]:checked' 5081 ).length === 0) { 5082 document.querySelector( 5083 'input[type="radio"][name="' + this.config.inputName + '"]' 5084 ).checked = true; 5085 } 5086 } 5087 toggleClick(trigger, is_expanded) { 5088 let target = document.getElementById( 5089 trigger.getAttribute("aria-controls") 5090 ); 5091 trigger.setAttribute("aria-expanded", is_expanded); 5092 if (target) { 5093 target.setAttribute("data-expanded", is_expanded); 5094 } 5095 } 5096 planChange(radios) {
5097 Object.values(radios).forEach((radio) => { 5098 radio.addEventListener("change", () => { 5099 let trigger = document.querySelector( 5100 '.payment-plan-trigger[aria-controls="' + radio.parentNode.parentNode.parentNode.getAttribute( 5101 "id" 5102 ) + '"]' 5103 ); 5104 this.toggleClick(trigger, false); 5105 this.updateTriggerLabel( 5106 trigger, 5107 document.querySelector( 5108 'label[for="' + radio.getAttribute("id") + '"' 5109 ).innerHTML 5110 ); 5111 this.updateTotal(radio.dataset.frequency, radio.dataset.price); 5112 }); 5113 }); 5114 if (document.querySelectorAll( 5115 'input[type="radio"][name="' + this.config.inputName + '"]:checked' 5116 ).length > 0) { 5117 document.querySelectorAll( 5118 'input[type="radio"][name="' + this.config.inputName + '"]:checked' 5119 )[0].dispatchEvent(new Event("change", { bubbles: true })); 5120 } 5121 } 5122 updateTriggerLabel(trigger, value) { 5123 trigger.querySelector(".btn__label").innerHTML = value; 5124 } 5125 updateTotal(type, cost) { 5126 let sum; 5127 let frequency; 5128 switch (type) { 5129 case "once": 5130 sum = cost; 5131 frequency = ""; 5132 break; 5133 case "year": 5134 sum = cost; 5135 frequency = "/year"; 5136 break; 5137 case "month": 5138 sum = cost; 5139 frequency = "/month"; 5140 break; 5141 } 5142 document.querySelector("span[data-sum]").innerHTML = sum; 5143 document.querySelector("span[data-frequency]").innerHTML = frequency; 5144 } 5145} 5146class PaymentPlanToggle { 5147 constructor(selector, config = { 5148 arguments: {}, 5149 events: {} 5150 }) { 5151 this.selector = selector; 5152 this.config = config; 5153 this.elements = document.querySelectorAll(this.selector); 5154 this.arguments = this.config.arguments; 5155 if (this.elements.length === 0) { 5156 return; 5157 } 5158 this.mount(); 5159 } 5160 mount() { 5161 if (this.config.events) { 5162 Object.keys(this.config.events).forEach((eventName) => { 5163 let eventCallback = this.config.events[eventName]; 5164 this.elements.forEach( 5165 (el) => el.addEventListener(eventName, eventCallback, { 5166 passive: true, 5167 once: false 5168 }) 5169 ); 5170 }); 5171 } 5172 this.init(); 5173 } 5174 init() { 5175 this.elements.forEach((radio) => { 5176 radio.addEventListener("change", () => { 5177 const els = document.querySelectorAll("[data-plan-frequency]"); 5178 els.forEach((el) => { 5179 if (el.getAttribute("data-plan-frequency") == radio.value) { 5180 el.style.display = null; 5181 const input = el.querySelector("input"); 5182 if (radio.value !== "Lifetime") { 5183 input.checked = true; 5184 } 5185 } else { 5186 el.style.display = "none"; 5187 } 5188 }); 5189 }); 5190 }); 5191 } 5192} 5193const googleConsentMode = () => { 5194 $(function() { 5195 var _a; 5196 const consentToggles = document.querySelectorAll('input[name="embed_config[functionality][google_consent_mode]"]'); 5197 const slug = (_a = document.querySelector('input[name="widget_slug"]')) == null ? void 0 : _a.value; 5198 if (!consentToggles || !slug) { 5199 return; 5200 } 5201 consentToggles.forEach((toggle) => { 5202 toggle.addEventListener("change", function(e) { 5203 e.preventDefault(); 5204 const url = "/cookie-consent/" + slug + "/dashboard/toggle-consent-mode"; 5205 axios.post(url, toggle).then((response) => { 5206 if (response.data.success) { 5207 const newValue = toggle.value; 5208 const defaultSection = document.querySelector('section[data-instructions="default"]'); 5209 const consentModeSection = document.querySelector('section[data-instructions="consent-mode"]'); 5210 if (!defaultSection || !consentModeSection) { 5211 return; 5212 } 5213 if (newValue === "on") { 5214 defaultSection == null ? void 0 : defaultSection.classList.add("hidden"); 5215 consentModeSection == null ? void 0 : consentModeSection.classList.remove("hidden"); 5216 } else { 5217 defaultSection == null ? void 0 : defaultSection.classList.remove("hidden"); 5218 consentModeSection == null ? void 0 : consentModeSection.classList.add("hidden"); 5219 } 5220 } else { 5221 console.log("error", response.data.message); 5222 } 5223 }).catch((error) => { 5224 console.error("Error updating Google Consent Mode setting:", error); 5225 }); 5226 }); 5227 }); 5228 }); 5229}; 5230class _ { 5231 constructor(e, o = { 5232 type: "", 5233 close_aria_label: "", 5234 close_text: "", 5235 content_source: "",
5236 is_locked: false, 5237 hide_close: false, 5238 fullscreen: false, 5239 background_scroll: false 5240 }) { 5241 this.selector = e, this.config = o, this.elements = document.querySelectorAll(this.selector), this.lastFocus = null, this.clickHandler = null, this.keydownHandler = null, this.keyupHandler = null; 5242 const t = { 5243 //General 5244 type: "inline", 5245 content_source: null, 5246 desc: "", 5247 animation: "fade", 5248 animation_speed: 300, 5249 after_callback_delay: 350, 5250 is_locked: false, 5251 hide_close: false, 5252 background: "rgba(0,0,0,0.8)", 5253 overlay_opacity: "1", 5254 overlay_close: true, 5255 accessible_title: "Dialog Window", 5256 start_open: false, 5257 fullscreen: false, 5258 custom_class: "", 5259 background_scroll: false, 5260 should_open: true, 5261 close_text: "Close", 5262 close_aria_label: "Close (Press escape to close)", 5263 width: null, 5264 height: null, 5265 //Events 5266 before_open: function() { 5267 }, 5268 after_open: function() { 5269 }, 5270 before_close: function() { 5271 }, 5272 after_close: function() { 5273 }, 5274 // source: function (element, src) { 5275 // return src; 5276 // }, 5277 //Confirm Modal 5278 confirm_button_text: "Confirm", 5279 // text on confirm button 5280 confirm_cancel_button_text: "Cancel", 5281 confirm_title: "Confirm Title", 5282 // title for confirm modal 5283 confirm_content: "<p>This is the default confirm dialog content. Replace me through the options</p>", 5284 // html for confirm message 5285 confirm_callback: function() { 5286 }, 5287 confirm_cancel_callback: function() { 5288 }, 5289 // //Gallery Modal 5290 gallery_active_class: "gallery_active_item", 5291 outer_controls: false, 5292 before_image_change: function(s, a) { 5293 }, 5294 after_image_change: function(s) { 5295 }, 5296 // //Ajax Modal 5297 loading_content: "Loading...", 5298 loading_class: "is_loading", 5299 ajax_error_class: "modaal-error", 5300 ajax_success: function() { 5301 } 5302 }; 5303 this.private_options = { 5304 active_class: "is_active" 5305 }, this.options = Object.assign({}, t, this.config), this.before_open = this.options.before_open, this.after_open = this.options.after_open, this.before_close = this.options.before_close, this.after_close = this.options.after_close, this.confirm_callback = this.options.confirm_callback, this.confirm_cancel_callback = this.options.confirm_cancel_callback, this.before_image_change = this.options.before_image_change, this.ajax_success = this.options.ajax_success, this.contains = (s, a) => s !== a && s.contains(a), this.elements.length !== 0 && this.mount(); 5306 } 5307 mount() { 5308 this.init(); 5309 } 5310 init() { 5311 this.elements.forEach((e) => { 5312 const o = JSON.parse(e.getAttribute("data-modaal")) || {}; 5313 let t = Object.assign({}, this.options, o); 5314 t.content_source || (t.content_source = e.getAttribute("href")), t.animation == "none" && (t.animation_speed = "0", t.after_callback_delay = "0"), (t.type == "confirm" || t.hide_close) && (t.is_locked = true), e.scope = { 5315 is_open: false, 5316 id: "modaal_" + (/* @__PURE__ */ new Date()).getTime() + Math.random().toString(16).substring(2), 5317 source: this.content_source || e.getAttribute("href") || null, 5318 close_btn: t.is_locked ? "" : `<button type="button" class="modaal-close" id="modaal-close" aria-label="${this.options.close_aria_label}"><span>${this.options.close_text}</span></button>`, 5319 options: t, 5320 xhr: null 5321 }, this.lastFocus = null; 5322 const s = this.options.outer_controls ? "outer" : "inner"; 5323 e.scope.prev_btn = `<button type="button" class="modaal-gallery-control modaal-gallery-prev modaal-gallery-prev-${s}" id="modaal-gallery-prev" aria-label="Previous image (use left arrow to change)"><span>Previous Image</span></button>`, e.scope.next_btn = `<button type="button" class="modaal-gallery-control modaal-gallery-next modaal-gallery-next-${s}" id="modaal-gallery-next" aria-label="Next image (use right arrow to change)"><span>Next Image</span></button>`, e.setAttribute("data-modaal-scope", e.scope.id), e.addEventListener("click", (a) => { 5324 a.preventDefault(), this.create_modaal(e, a); 5325 }), e.scope.options.start_open === true && this.create_modaal(e); 5326 }); 5327 } 5328 create_modaal(e, o) { 5329 if (this.lastFocus = e, !!e.scope.options.should_open) { 5330 switch (this.before_open.call(e, o), e.scope.options.type) { 5331 case "inline": 5332 this.create_basic(e); 5333 break; 5334 case "video": 5335 this.create_video(e); 5336 break; 5337 case "iframe": 5338 this.create_iframe(e); 5339 break; 5340 case "confirm": 5341 this.create_confirm(e); 5342 break; 5343 case "image": 5344 this.create_image(e); 5345 break; 5346 case "ajax": 5347 this.fetch_ajax(e); 5348 break; 5349 } 5350 this.watch_events(e); 5351 } 5352 } 5353 create_basic(e) { 5354 const o = document.querySelector(e.scope.options.content_source); 5355 let t = ""; 5356 if (o) 5357 for (t = o.innerHTML; o.firstChild; ) 5358 o.removeChild(o.firstChild); 5359 else 5360 t = "Content could not be loaded. Please check the source and try again."; 5361 this.build_modal(e, t); 5362 } 5363 create_video(e) { 5364 const t = `<div class="modaal-video-container"><iframe src="${this.parse_video_url(e.scope.options.content_source)}" class="modaal-video-frame" frameborder="0" style="border:none;" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe></div>`; 5365 this.build_modal(e, t); 5366 } 5367 create_iframe(e) { 5368 const o = e.scope.options.content_source; 5369 let t; 5370 e.scope.options.width || e.scope.options.height ? t = `<iframe src="${o}" class="modaal-iframe-elem" frameborder="0" allowfullscreen></iframe>` : t = '<div class="modaal-content-container">Please specify a width and height for your iframe</div>', this.build_modal(e, t); 5371 } 5372 parse_video_url(e) { 5373 return e.includes("autoplay=") || (e.includes("?") || (e += "?"), e += "&autoplay=1", e.includes("autopause=") || (e += "&autopause=0"), e.includes("playsinline=") || (e += "&playsinline=1")), e; 5374 } 5375 create_confirm(e) { 5376 const o = `<div class="modaal-content-container"> 5377 <h1 id="modaal-title">${e.scope.options.confirm_title}</h1> 5378 <div class="modaal-confirm-content">${e.scope.options.confirm_content}</div> 5379 <div class="modaal-confirm-wrap"> 5380 <button type="button" class="modaal-confirm-btn modaal-ok" aria-label="Confirm">${e.scope.options.confirm_button_text}</button> 5381 <button type="button" class="modaal-confirm-btn modaal-cancel" aria-label="Cancel">${e.scope.options.confirm_cancel_button_text}</button> 5382 </div></div></div>`; 5383 this.build_modal(e, o); 5384 } 5385 create_image(e) { 5386 let o, t = "", s; 5387 const a = e.getAttribute("data-group"); 5388 a ? (t = this.create_image_group_markup(e), s = document.querySelectorAll(`[data-group="${a}"]`).length - 1) : t = this.create_image_single_markup(e), o = t, this.build_modal(e, o); 5389 const i = document.querySelector(".modaal-gallery-prev"), c = document.querySelector(".modaal-gallery-next"); 5390 i && i.toggleAttribute( 5391 "disabled", 5392 document.querySelector(".modaal-gallery-item.is_active").classList.contains("gallery-item-0") 5393 ), c && c.toggleAttribute( 5394 "disabled", 5395 document.querySelector(".modaal-gallery-item.is_active").classList.contains(`gallery-item-${s}`) 5396 ); 5397 } 5398 create_image_single_markup(e) { 5399 let o = ""; 5400 const t = e.scope.options.content_source || e.getAttribute("src") || null, s = e.scope.options.desc.replace(/</g, "<").replace(/>/g, ">"), a = t ? `<img src="${t}" alt="${s}">` : "trigger requires href or content-source option", i = s ? `Image: ${s}` : "Image no description"; 5401 return o = `<div class="modaal-gallery-item ${this.private_options.active_class}" aria-label="${i}"><div class="modaal-gallery-item__image">${a}</div>`, e.scope.options.desc && (o += `<div class="modaal-gallery-label">${e.scope.options.desc}</div>`), o += "</div>", o; 5402 } 5403 create_image_group_markup(e) { 5404 const o = e.getAttribute("data-group"), t = document.querySelectorAll(`[data-group="${o}"]`); 5405 t.forEach((i) => { 5406 i.removeAttribute("data-gallery-active"); 5407 }), e.setAttribute("data-gallery-active", this.private_options.active_class), t.length - 1; 5408 let s = [], a = '<div class="modaal-gallery-item-wrap">'; 5409 return t.forEach((i, c) => { 5410 const n = i.scope.options.desc, r = i.scope.options.content_source || i.getAttribute("src") || null, l = { 5411 url: r, 5412 alt: i.scope.options.desc, 5413 rawdesc: n.replace(/</g, "<").replace(/>/g, ">"), 5414 desc: `<div class="modaal-gallery-label"><span class="modaal-accessible-hide">Image ${c + 1}
5414 - </span>${n}</div>`, 5415 active: !!i.getAttribute("data-gallery-active"), 5416 src_error: !r 5417 }, p = document.createElement("img"); 5418 p.src = r, p.style.opacity = "0", document.body.appendChild(p), p.addEventListener("load", (d) => { 5419 l.ratio = d.target.naturalWidth / d.target.naturalHeight, l.width = d.target.naturalWidth, d.target.remove(); 5420 }), s.push(l); 5421 }), s.forEach((i, c) => { 5422 const n = i.rawdesc ? `Image: ${i.rawdesc}` : `Image ${c + 1} no description`, r = i.src_error ? "trigger requires href or content-source option" : `<img src="${i.url}" alt="${i.rawdesc}">`; 5423 let l = ["modaal-gallery-item", `gallery-item-${c}`]; 5424 i.active && l.push(this.private_options.active_class), a += `<div class="${l.join( 5425 " " 5426 )}" aria-label="${n}"><div class="modaal-gallery-item__image">${r}</div>${i.desc}</div>`; 5427 }), a += "</div>", e.scope.options.outer_controls != true && (a += e.scope.prev_btn + e.scope.next_btn), a; 5428 } 5429 galleryTransitionOut(e) { 5430 return current_dimensions; 5431 } 5432 watch_events(e) { 5433 this.keydownHandler = (o) => { 5434 const t = o.keyCode, s = o.target; 5435 if (t == 9 && e.scope.is_open == true && !this.contains(document.getElementById(e.scope.id), s)) { 5436 const a = document.querySelector(`#${e.scope.id} [tabindex="0"]`); 5437 a && a.focus(); 5438 } 5439 }, document.body.addEventListener("keydown", this.keydownHandler), this.keyupHandler = (o) => { 5440 const t = o.keyCode, s = o.target; 5441 if (o.shiftKey && o.keyCode == 9 && e.scope.is_open && !this.contains(document.getElementById(e.scope.id), s)) { 5442 const a = document.querySelector(`#${e.scope.id} .modaal-close`); 5443 a && a.focus(); 5444 } 5445 if (t == 27 && e.scope.is_open && !e.scope.options.is_locked) { 5446 if (document.activeElement.tagName == "INPUT" && document.activeElement.getAttribute("type") !== "checkbox" && document.activeElement.getAttribute("type") !== "radio" || document.activeElement.tagName == "TEXTAREA") 5447 return false; 5448 this.modaal_close(e); 5449 } 5450 if (e.scope.options.type == "image" && e.scope.is_open) { 5451 const a = document.querySelector(`#${e.scope.id} .modaal-gallery-prev`), i = document.querySelector(`#${e.scope.id} .modaal-gallery-next`); 5452 t == 37 && a && !a.getAttribute("disabled") && this.gallery_update(e, "prev"), t == 39 && i && !i.getAttribute("disabled") && this.gallery_update(e, "next"); 5453 return; 5454 } 5455 }, document.body.addEventListener("keyup", this.keyupHandler), this.clickHandler = (o) => { 5456 const t = o.target; 5457 if (!e.scope.options.is_locked && (e.scope.options.overlay_close && t.classList.contains("modaal-inner-wrapper") || t.classList.contains("modaal-close") || t.closest(".modaal-close"))) { 5458 this.modaal_close(e); 5459 return; 5460 } 5461 if (t.classList.contains("modaal-confirm-btn")) { 5462 t.classList.contains("modaal-ok") && this.confirm_callback.call(e, this.lastFocus), t.classList.contains("modaal-cancel") && this.confirm_cancel_callback.call(e, this.lastFocus), this.modaal_close(e); 5463 return; 5464 } 5465 if (t.classList.contains("modaal-gallery-control")) { 5466 if (t.getAttribute("disabled")) 5467 return; 5468 t.classList.contains("modaal-gallery-prev") && this.gallery_update(e, "prev"), t.classList.contains("modaal-gallery-next") && this.gallery_update(e, "next"); 5469 return; 5470 } 5471 }, document.body.addEventListener("click", this.clickHandler); 5472 } 5473 unwatch_events() { 5474 document.body.removeEventListener("click", this.clickHandler), document.body.removeEventListener("keyup", this.keyupHandler), document.body.removeEventListener("keydown", this.keydownHandler); 5475 } 5476 build_modal(e, o) { 5477 document.getElementById(`${e.scope.id}_overlay`) || null || document.body.insertAdjacentHTML("beforeend", this.build_markup(e, o)), e.scope.options.type == "inline" && document.querySelector(`#${e.scope.id} .modaal-content-container`).insertAdjacentHTML("beforeend", o), this.modaal_overlay(e, "show"); 5478 } 5479 build_markup(e, o) { 5480 const t = ["modaal-focus"]; 5481 e.scope.options.type == "video" ? t.push("modaal-video-wrap") : t.push("modaal-content"); 5482 let s; 5483 if (e.scope.options.type == "image") { 5484 t.push("modaal-gallery-wrap"); 5485 const n = e.getAttribute("data-group"); 5486 s = document.querySelectorAll(`[data-group="${n}"]`); 5487 } 5488 const a = [ 5489 "modaal-wrapper", 5490 `modaal-${e.scope.options.type}`, 5491 `modaal-start_${e.scope.options.animation}` 5492 ]; 5493 e.scope.options.fullscreen && a.push("modaal-fullscreen"), e.scope.options.custom_class && a.push(e.scope.options.custom_class); 5494 let i = `<div class="${a.join(" ")}" id="${e.scope.id}" data-shown="false"><div class="modaal-outer-wrapper"><div class="modaal-inner-wrapper">`; 5495 e.scope.options.type != "video" && (i += `<div class="modaal-container"${this.get_container_styles(e)}>`); 5496 const c = s && s.length > 1 ? ` data-gallery-count="${s.length}"` : ""; 5497 return i += `<div class="${t.join(" ")}" aria-hidden="false" aria-label="${e.scope.options.accessible_title} - ${e.scope.options.close_aria_label}" role="dialog"${c}>`, e.scope.options.type == "inline" ? i += '<div class="modaal-content-container" role="document"></div>' : i += o, i += "</div>", i += e.scope.close_btn, e.scope.options.type != "video" && (i += "</div>"), i += "</div>", e.scope.options.type == "image" && e.scope.options.outer_controls === true && (i += e.scope.prev_btn + e.scope.next_btn), i += "</div></div>", i; 5498 } 5499 get_container_styles(e) { 5500 let o = "", t = [];
5501 return e.scope.options.width && t.push({ property: "--modaal-width", value: `${e.scope.options.width}px` }), e.scope.options.height && t.push({ property: "--modaal-height", value: `${e.scope.options.height}px` }), t.length && (o += ' style="', t.forEach((s) => { 5502 o += `${s.property}: ${s.value};`; 5503 }), o += '"'), o; 5504 } 5505 modaal_overlay(e, o) { 5506 let t; 5507 switch (o) { 5508 case "show": 5509 e.scope.is_open = true, e.scope.options.background_scroll || document.body.classList.add("modaal-noscroll"), t = document.getElementById(`${e.scope.id}_overlay`), new Promise((a, i) => { 5510 t || (t = document.createElement("div"), t.classList.add("modaal-overlay"), t.id = `${e.scope.id}_overlay`, t.setAttribute("data-shown", "false"), document.body.append(t), t.style.setProperty("--modaal-overlay-opacity", e.scope.options.overlay_opacity), t.style.setProperty("--modaal-overlay-background", e.scope.options.background), t.style.setProperty("--modaal-animation-speed", `${e.scope.options.animation_speed}ms`)), document.getElementById(`${e.scope.id}_overlay`) ? setTimeout(() => { 5511 a(); 5512 }, 0) : i(); 5513 }).then(() => this.animate_in_modaal(e, t)); 5514 break; 5515 case "hide": 5516 t = document.getElementById(`${e.scope.id}_overlay`), t.setAttribute("data-shown", "false"), setTimeout(() => { 5517 t.remove(), document.body.classList.remove("modaal-noscroll"); 5518 }, e.scope.options.animation_speed); 5519 break; 5520 } 5521 } 5522 animate_in_modaal(e, o) { 5523 o.setAttribute("data-shown", "true"), setTimeout(() => { 5524 this.modaal_open(e); 5525 }, e.scope.options.animation_speed); 5526 } 5527 modaal_open(e) { 5528 const o = document.getElementById(e.scope.id); 5529 o.style.setProperty("--modaal-animation-speed", `${e.scope.options.animation_speed}ms`), o.setAttribute("data-shown", "true"); 5530 let t = o; 5531 document.querySelectorAll('.modaal-wrapper [tabindex="0"]').forEach((s) => { 5532 s.removeAttribute("tabindex"); 5533 }), e.scope.options.type == "image" ? (t = document.getElementById(e.scope.id).querySelector(`.modaal-gallery-item.${this.private_options.active_class}`), this.update_gallery_dimensions(t), window.addEventListener("resize", () => { 5534 t.parentNode.style.setProperty("--animating-width", null), t.parentNode.style.setProperty("--animating-height", null), this.update_gallery_dimensions(t); 5535 })) : o.querySelector(".modaal-iframe-elem") ? t = o.querySelector(".modaal-iframe-elem") : o.querySelector(".modaal-video-wrap") ? t = o.querySelector(".modaal-video-wrap") : t = o.querySelector(".modaal-focus"), t.setAttribute("tabindex", "0"), t.focus(), setTimeout(() => { 5536 this.after_open.call(e, o); 5537 }, e.scope.options.after_callback_delay); 5538 } 5539 modaal_close(e) { 5540 const o = document.getElementById(e.scope.id); 5541 this.before_close.call(e, o), this.unwatch_events(), o.setAttribute("data-shown", "false"), setTimeout(() => { 5542 if (e.scope.options.type == "inline") { 5543 const t = document.querySelector(`#${e.scope.id} .modaal-content-container`); 5544 if (t) { 5545 const s = t.innerHTML; 5546 for (; t.firstChild; ) 5547 t.removeChild(t.firstChild); 5548 document.querySelector(e.scope.options.content_source).insertAdjacentHTML("beforeend", s); 5549 } 5550 } 5551 o.remove(), e.scope.is_open = false, this.after_close.call(e); 5552 }, e.scope.options.after_callback_delay), this.modaal_overlay(e, "hide"), this.lastFocus != null && this.lastFocus.focus(); 5553 } 5554 gallery_update(e, o) { 5555 const t = document.getElementById(e.scope.id), s = t.querySelectorAll(".modaal-gallery-item").length - 1; 5556 if (s == 0) 5557 return false; 5558 const a = t.querySelector(".modaal-gallery-prev"), i = t.querySelector(".modaal-gallery-next"), c = t.querySelector(`.modaal-gallery-item.${this.private_options.active_class}`), n = o == "next" ? c.nextElementSibling : c.previousElementSibling; 5559 if (!n) 5560 return false; 5561 const r = n.querySelector("img"); 5562 this.options.before_image_change.call(e, c, n); 5563 const l = n.classList.contains("gallery-item-0"), p = n.classList.contains(`gallery-item-${s}`); 5564 a.toggleAttribute("disabled", l), i.toggleAttribute("disabled", p); 5565 const d = c.querySelector("img"); 5566 d.style.opacity = "0", d.addEventListener( 5567 "transitionend", 5568 () => { 5569 n.classList.add("is_next"), n.style = { 5570 position: "absolute", 5571 zIndex: 5, 5572 display: "block", 5573 opacity: "0", 5574 top: "0", 5575 left: "0" 5576 }, c.classList.remove(this.private_options.active_class, e.scope.options.gallery_active_class), c.removeAttribute("style"), n.classList.add(this.private_options.active_class, e.scope.options.gallery_active_class), n.classList.remove("is_next"), n.removeAttribute("style"), r.style.opacity = "0", setTimeout(() => { 5577 this.update_gallery_dimensions(n), window.addEventListener("resize", () => { 5578 n.parentNode.style.setProperty("--animating-width", null), n.parentNode.style.setProperty("--animating-height", null), this.update_gallery_dimensions(n); 5579 }), setTimeout( 5580 () => { 5581 r.style.opacity = "1", this.options.after_image_change.call(e, n), t.querySelectorAll(".modaal-gallery-item").forEach((u) => u.removeAttribute("tabindex")), n.setAttribute("tabindex", "0"), n.focus(); 5582 }, 5583 window.matchMedia("(prefers-reduced-motion: reduce)").matches ? 0 : 250 5584 ); 5585 }, 0); 5586 }, 5587 { 5588 passive: false, 5589 once: true 5590 } 5591 ); 5592 } 5593 update_gallery_dimensions(e) {
5594 const o = e.querySelector("img"), t = o.naturalWidth / o.naturalHeight, s = window.matchMedia("(min-width: 1141px)").matches ? window.innerWidth - 25 * 2 - 50 * 2 - 40 * 2 : window.innerWidth - 25 * 2, a = Math.min(o.naturalWidth, s); 5595 let i; 5596 a / t > window.innerHeight - 60 * 2 ? i = { 5597 width: Math.round((window.innerHeight - 60 * 2) * t), 5598 height: Math.round(window.innerHeight - 60 * 2) 5599 } : i = { 5600 width: Math.round(a), 5601 height: Math.round(a / t) 5602 }, e.parentNode.style.setProperty("--animating-width", `${i.width}px`), e.parentNode.style.setProperty("--animating-height", `${i.height}px`); 5603 } 5604 // Fetch Ajax Data 5605 // ---------------------------------------------------------------- 5606 fetch_ajax(e) { 5607 const o = e.scope.options.content_source; 5608 e.scope.options.accessible_title == null && (e.scope.options.accessible_title = "Dialog Window"), e.scope.xhr !== null && (e.scope.xhr.abort(), e.scope.xhr = null); 5609 let t = ["modaal-content-container"]; 5610 e.scope.options.loading_class && t.push(e.scope.options.loading_class), this.build_modal(e, `<div class="${t.join(" ")}">${e.scope.options.loading_content}</div>`), fetch(o).then((s) => { 5611 if (!s.ok) { 5612 const a = document.querySelector(`#${e.scope.id} .modaal-content-container`); 5613 throw a && (a.classList.remove(e.scope.options.loading_class), a.classList.add(e.scope.options.ajax_error_class), a.innerHTML = "Content could not be loaded. Please check the source and try again."), new Error(`HTTP error! Status: ${s.status} (${s.statusText})`); 5614 } 5615 return s.text(); 5616 }).then((s) => { 5617 const a = document.querySelector(`#${e.scope.id} .modaal-content-container`); 5618 a && (a.classList.remove(e.scope.options.loading_class), a.innerHTML = s, this.options.ajax_success.call(e, a)); 5619 }); 5620 } 5621} 5622var build = {}; 5623try { 5624 var ce = new window.CustomEvent("test"); 5625 ce.preventDefault(); 5626 if (ce.defaultPrevented !== true) { 5627 throw new Error("Could not prevent default"); 5628 } 5629} catch (e) { 5630 var CustomEvent$1 = function(event, params) { 5631 var evt, origPrevent; 5632 params = params || { 5633 bubbles: false, 5634 cancelable: false, 5635 detail: void 0 5636 }; 5637 evt = document.createEvent("CustomEvent"); 5638 evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail); 5639 origPrevent = evt.preventDefault; 5640 evt.preventDefault = function() { 5641 origPrevent.call(this); 5642 try { 5643 Object.defineProperty(this, "defaultPrevented", { 5644 get: function() { 5645 return true; 5646 } 5647 }); 5648 } catch (e2) { 5649 this.defaultPrevented = true; 5650 } 5651 }; 5652 return evt; 5653 }; 5654 CustomEvent$1.prototype = window.Event.prototype; 5655 window.CustomEvent = CustomEvent$1; 5656} 5657Object.defineProperty(build, "__esModule", { 5658 value: true 5659}); 5660var _extends = Object.assign || function(target) { 5661 for (var i = 1; i < arguments.length; i++) { 5662 var source = arguments[i]; 5663 for (var key in source) { 5664 if (Object.prototype.hasOwnProperty.call(source, key)) { 5665 target[key] = source[key]; 5666 } 5667 } 5668 } 5669 return target; 5670}; 5671var _slicedToArray = /* @__PURE__ */ function() { 5672 function sliceIterator(arr, i) { 5673 var _arr = []; 5674 var _n = true; 5675 var _d = false; 5676 var _e = void 0; 5677 try { 5678 for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { 5679 _arr.push(_s.value); 5680 if (i && _arr.length === i) break; 5681 } 5682 } catch (err) { 5683 _d = true; 5684 _e = err; 5685 } finally { 5686 try { 5687 if (!_n && _i["return"]) _i["return"](); 5688 } finally { 5689 if (_d) throw _e; 5690 } 5691 } 5692 return _arr; 5693 } 5694 return function(arr, i) { 5695 if (Array.isArray(arr)) { 5696 return arr; 5697 } else if (Symbol.iterator in Object(arr)) { 5698 return sliceIterator(arr, i); 5699 } else { 5700 throw new TypeError("Invalid attempt to destructure non-iterable instance"); 5701 } 5702 }; 5703}(); 5704var _default = build.default = customSelect; 5705var defaultParams = { 5706 containerClass: "custom-select-container", 5707 openerClass: "custom-select-opener", 5708 panelClass: "custom-select-panel", 5709 optionClass: "custom-select-option", 5710 optgroupClass: "custom-select-optgroup", 5711 isSelectedClass: "is-selected", 5712 hasFocusClass: "has-focus", 5713 isDisabledClass: "is-disabled", 5714 isOpenClass: "is-open" 5715}; 5716function builder(el, builderParams) { 5717 var containerClass = "customSelect"; 5718 var isOpen = false;
vendor: 14,345 bytes, lines 5719-6099
5719 var uId = ""; 5720 var select = el; 5721 var container = void 0; 5722 var opener = void 0; 5723 var focusedElement = void 0; 5724 var selectedElement = void 0; 5725 var panel = void 0; 5726 var currLabel = void 0; 5727 var resetSearchTimeout = void 0; 5728 var searchKey = ""; 5729 function setFocusedElement(cstOption) { 5730 if (focusedElement) { 5731 focusedElement.classList.remove(builderParams.hasFocusClass); 5732 } 5733 if (typeof cstOption !== "undefined") { 5734 focusedElement = cstOption; 5735 focusedElement.classList.add(builderParams.hasFocusClass); 5736 if (isOpen) { 5737 if (cstOption.offsetTop < cstOption.offsetParent.scrollTop || cstOption.offsetTop > cstOption.offsetParent.scrollTop + cstOption.offsetParent.clientHeight - cstOption.clientHeight) { 5738 cstOption.dispatchEvent(new CustomEvent("custom-select:focus-outside-panel", { bubbles: true })); 5739 } 5740 } 5741 } else { 5742 focusedElement = void 0; 5743 } 5744 } 5745 function setSelectedElement(cstOption) { 5746 if (selectedElement) { 5747 selectedElement.classList.remove(builderParams.isSelectedClass); 5748 selectedElement.removeAttribute("id"); 5749 opener.removeAttribute("aria-activedescendant"); 5750 } 5751 if (typeof cstOption !== "undefined") { 5752 cstOption.classList.add(builderParams.isSelectedClass); 5753 cstOption.setAttribute("id", containerClass + "-" + uId + "-selectedOption"); 5754 opener.setAttribute("aria-activedescendant", containerClass + "-" + uId + "-selectedOption"); 5755 selectedElement = cstOption; 5756 opener.children[0].textContent = selectedElement.customSelectOriginalOption.text; 5757 } else { 5758 selectedElement = void 0; 5759 opener.children[0].textContent = ""; 5760 } 5761 setFocusedElement(cstOption); 5762 } 5763 function setValue(value) { 5764 var toSelect = select.querySelector("option[value='" + value + "']"); 5765 if (!toSelect) { 5766 var _select$options = _slicedToArray(select.options, 1); 5767 toSelect = _select$options[0]; 5768 } 5769 toSelect.selected = true; 5770 setSelectedElement(select.options[select.selectedIndex].customSelectCstOption); 5771 } 5772 function moveFocuesedElement(direction) { 5773 var currentFocusedIndex = [].indexOf.call(select.options, focusedElement.customSelectOriginalOption); 5774 if (select.options[currentFocusedIndex + direction]) { 5775 setFocusedElement(select.options[currentFocusedIndex + direction].customSelectCstOption); 5776 } 5777 } 5778 function open(bool) { 5779 if (bool || typeof bool === "undefined") { 5780 var openedCustomSelect = document.querySelector("." + containerClass + "." + builderParams.isOpenClass); 5781 if (openedCustomSelect) { 5782 openedCustomSelect.customSelect.open = false; 5783 } 5784 container.classList.add(builderParams.isOpenClass); 5785 container.classList.add(builderParams.isOpenClass); 5786 opener.setAttribute("aria-expanded", "true"); 5787 if (selectedElement) { 5788 panel.scrollTop = selectedElement.offsetTop; 5789 } 5790 container.dispatchEvent(new CustomEvent("custom-select:open")); 5791 isOpen = true; 5792 } else { 5793 container.classList.remove(builderParams.isOpenClass); 5794 opener.setAttribute("aria-expanded", "false"); 5795 isOpen = false; 5796 setFocusedElement(selectedElement); 5797 container.dispatchEvent(new CustomEvent("custom-select:close")); 5798 } 5799 return isOpen; 5800 } 5801 function clickEvent(e) { 5802 if (e.target === opener || opener.contains(e.target)) { 5803 if (isOpen) { 5804 open(false); 5805 } else { 5806 open(); 5807 } 5808 } else if (e.target.classList && e.target.classList.contains(builderParams.optionClass) && panel.contains(e.target)) { 5809 setSelectedElement(e.target); 5810 selectedElement.customSelectOriginalOption.selected = true; 5811 open(false); 5812 select.dispatchEvent(new CustomEvent("change")); 5813 } else if (e.target === select) { 5814 if (opener !== document.activeElement && select !== document.activeElement) { 5815 opener.focus(); 5816 } 5817 } else if (isOpen && !container.contains(e.target)) { 5818 open(false); 5819 } 5820 } 5821 function mouseoverEvent(e) { 5822 if (e.target.classList && e.target.classList.contains(builderParams.optionClass)) { 5823 setFocusedElement(e.target); 5824 } 5825 } 5826 function keydownEvent(e) { 5827 if (!isOpen) { 5828 if (e.keyCode === 40 || e.keyCode === 38 || e.keyCode === 32) { 5829 open(); 5830 } 5831 } else { 5832 switch (e.keyCode) { 5833 case 13: 5834 case 32: 5835 setSelectedElement(focusedElement); 5836 selectedElement.customSelectOriginalOption.selected = true; 5837 select.dispatchEvent(new CustomEvent("change")); 5838 open(false); 5839 break; 5840 case 27: 5841 open(false); 5842 break; 5843 case 38: 5844 moveFocuesedElement(-1); 5845 break; 5846 case 40: 5847 moveFocuesedElement(1); 5848 break; 5849 default: 5850 if (e.keyCode >= 48 && e.keyCode <= 90) { 5851 if (resetSearchTimeout) { 5852 clearTimeout(resetSearchTimeout); 5853 } 5854 resetSearchTimeout = setTimeout(function() { 5855 searchKey = ""; 5856 }, 1500); 5857 searchKey += String.fromCharCode(e.keyCode); 5858 for (var i2 = 0, l = select.options.length; i2 < l; i2++) { 5859 if (select.options[i2].text.toUpperCase().substr(0, searchKey.length) === searchKey) { 5860 setFocusedElement(select.options[i2].customSelectCstOption); 5861 break; 5862 } 5863 } 5864 } 5865 break; 5866 } 5867 } 5868 } 5869 function changeEvent() { 5870 var index = select.selectedIndex; 5871 var element = index === -1 ? void 0 : select.options[index].customSelectCstOption; 5872 setSelectedElement(element); 5873 } 5874 function scrollToFocused(e) { 5875 var currPanel = e.currentTarget; 5876 var currOption = e.target; 5877 if (currOption.offsetTop < currPanel.scrollTop) { 5878 currPanel.scrollTop = currOption.offsetTop; 5879 } else { 5880 currPanel.scrollTop = currOption.offsetTop + currOption.clientHeight - currPanel.clientHeight; 5881 } 5882 } 5883 function addEvents() { 5884 document.addEventListener("click", clickEvent); 5885 panel.addEventListener("mouseover", mouseoverEvent); 5886 panel.addEventListener("custom-select:focus-outside-panel", scrollToFocused); 5887 select.addEventListener("change", changeEvent); 5888 container.addEventListener("keydown", keydownEvent); 5889 } 5890 function removeEvents() { 5891 document.removeEventListener("click", clickEvent); 5892 panel.removeEventListener("mouseover", mouseoverEvent); 5893 panel.removeEventListener("custom-select:focus-outside-panel", scrollToFocused); 5894 select.removeEventListener("change", changeEvent); 5895 container.removeEventListener("keydown", keydownEvent); 5896 } 5897 function disabled(bool) { 5898 if (bool && !select.disabled) { 5899 container.classList.add(builderParams.isDisabledClass); 5900 select.disabled = true; 5901 opener.removeAttribute("tabindex"); 5902 container.dispatchEvent(new CustomEvent("custom-select:disabled")); 5903 removeEvents(); 5904 } else if (!bool && select.disabled) { 5905 container.classList.remove(builderParams.isDisabledClass); 5906 select.disabled = false; 5907 opener.setAttribute("tabindex", "0"); 5908 container.dispatchEvent(new CustomEvent("custom-select:enabled")); 5909 addEvents(); 5910 } 5911 } 5912 function parseMarkup(children) { 5913 var nodeList = children; 5914 var cstList = []; 5915 if (typeof nodeList.length === "undefined") { 5916 throw new TypeError("Invalid Argument"); 5917 } 5918 for (var i2 = 0, li = nodeList.length; i2 < li; i2++) { 5919 if (nodeList[i2] instanceof HTMLElement && nodeList[i2].tagName.toUpperCase() === "OPTGROUP") { 5920 var cstOptgroup = document.createElement("div"); 5921 cstOptgroup.classList.add(builderParams.optgroupClass); 5922 cstOptgroup.setAttribute("data-label", nodeList[i2].label); 5923 cstOptgroup.customSelectOriginalOptgroup = nodeList[i2]; 5924 nodeList[i2].customSelectCstOptgroup = cstOptgroup; 5925 var subNodes = parseMarkup(nodeList[i2].children); 5926 for (var j = 0, lj = subNodes.length; j < lj; j++) { 5927 cstOptgroup.appendChild(subNodes[j]); 5928 } 5929 cstList.push(cstOptgroup); 5930 } else if (nodeList[i2] instanceof HTMLElement && nodeList[i2].tagName.toUpperCase() === "OPTION") { 5931 var cstOption = document.createElement("div"); 5932 cstOption.classList.add(builderParams.optionClass); 5933 cstOption.textContent = nodeList[i2].text; 5934 cstOption.setAttribute("data-value", nodeList[i2].value); 5935 cstOption.setAttribute("role", "option"); 5936 cstOption.customSelectOriginalOption = nodeList[i2]; 5937 nodeList[i2].customSelectCstOption = cstOption; 5938 if (nodeList[i2].selected) { 5939 setSelectedElement(cstOption); 5940 } 5941 cstList.push(cstOption); 5942 } else { 5943 throw new TypeError("Invalid Argument"); 5944 } 5945 } 5946 return cstList; 5947 } 5948 function _append(nodePar, appendIntoOriginal, targetPar) { 5949 var target = void 0; 5950 if (typeof targetPar === "undefined" || targetPar === select) { 5951 target = panel; 5952 } else if (targetPar instanceof HTMLElement && targetPar.tagName.toUpperCase() === "OPTGROUP" && select.contains(targetPar)) { 5953 target = targetPar.customSelectCstOptgroup; 5954 } else { 5955 throw new TypeError("Invalid Argument"); 5956 } 5957 var node = nodePar instanceof HTMLElement ? [nodePar] : nodePar; 5958 if (appendIntoOriginal) { 5959 for (var i2 = 0, l = node.length; i2 < l; i2++) { 5960 if (target === panel) { 5961 select.appendChild(node[i2]); 5962 } else { 5963 target.customSelectOriginalOptgroup.appendChild(node[i2]); 5964 } 5965 } 5966 } 5967 var markupToInsert = parseMarkup(node); 5968 for (var _i = 0, _l = markupToInsert.length; _i < _l; _i++) { 5969 target.appendChild(markupToInsert[_i]); 5970 } 5971 return node; 5972 } 5973 function _insertBefore(node, targetPar) { 5974 var target = void 0; 5975 if (targetPar instanceof HTMLElement && targetPar.tagName.toUpperCase() === "OPTION" && select.contains(targetPar)) { 5976 target = targetPar.customSelectCstOption; 5977 } else if (targetPar instanceof HTMLElement && targetPar.tagName.toUpperCase() === "OPTGROUP" && select.contains(targetPar)) { 5978 target = targetPar.customSelectCstOptgroup; 5979 } else { 5980 throw new TypeError("Invalid Argument"); 5981 } 5982 var markupToInsert = parseMarkup(node.length ? node : [node]); 5983 target.parentNode.insertBefore(markupToInsert[0], target); 5984 return targetPar.parentNode.insertBefore(node.length ? node[0] : node, targetPar); 5985 } 5986 function remove(node) { 5987 var cstNode = void 0; 5988 if (node instanceof HTMLElement && node.tagName.toUpperCase() === "OPTION" && select.contains(node)) { 5989 cstNode = node.customSelectCstOption; 5990 } else if (node instanceof HTMLElement && node.tagName.toUpperCase() === "OPTGROUP" && select.contains(node)) { 5991 cstNode = node.customSelectCstOptgroup; 5992 } else { 5993 throw new TypeError("Invalid Argument"); 5994 } 5995 cstNode.parentNode.removeChild(cstNode); 5996 var removedNode = node.parentNode.removeChild(node); 5997 changeEvent(); 5998 return removedNode; 5999 } 6000 function empty() { 6001 var removed = []; 6002 while (select.children.length) { 6003 panel.removeChild(panel.children[0]); 6004 removed.push(select.removeChild(select.children[0])); 6005 } 6006 setSelectedElement(); 6007 return removed; 6008 } 6009 function destroy() { 6010 for (var i2 = 0, l = select.options.length; i2 < l; i2++) { 6011 delete select.options[i2].customSelectCstOption; 6012 } 6013 var optGroup = select.getElementsByTagName("optgroup"); 6014 for (var _i2 = 0, _l2 = optGroup.length; _i2 < _l2; _i2++) { 6015 delete optGroup.customSelectCstOptgroup; 6016 } 6017 removeEvents(); 6018 return container.parentNode.replaceChild(select, container); 6019 } 6020 container = document.createElement("div"); 6021 container.classList.add(builderParams.containerClass, containerClass); 6022 opener = document.createElement("span"); 6023 opener.className = builderParams.openerClass; 6024 opener.setAttribute("role", "combobox"); 6025 opener.setAttribute("aria-autocomplete", "list"); 6026 opener.setAttribute("aria-expanded", "false"); 6027 opener.innerHTML = "<span>\n " + (select.selectedIndex !== -1 ? select.options[select.selectedIndex].text : "") + "\n </span>"; 6028 panel = document.createElement("div"); 6029 var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; 6030 for (var i = 0; i < 5; i++) { 6031 uId += possible.charAt(Math.floor(Math.random() * possible.length)); 6032 } 6033 panel.id = containerClass + "-" + uId + "-panel"; 6034 panel.className = builderParams.panelClass; 6035 panel.setAttribute("role", "listbox"); 6036 opener.setAttribute("aria-owns", panel.id); 6037 _append(select.children, false); 6038 container.appendChild(opener); 6039 select.parentNode.replaceChild(container, select); 6040 container.appendChild(select); 6041 container.appendChild(panel); 6042 if (document.querySelector('label[for="' + select.id + '"]')) { 6043 currLabel = document.querySelector('label[for="' + select.id + '"]'); 6044 } else if (container.parentNode.tagName.toUpperCase() === "LABEL") { 6045 currLabel = container.parentNode; 6046 } 6047 if (typeof currLabel !== "undefined") { 6048 currLabel.setAttribute("id", containerClass + "-" + uId + "-label"); 6049 opener.setAttribute("aria-labelledby", containerClass + "-" + uId + "-label"); 6050 } 6051 if (select.disabled) { 6052 container.classList.add(builderParams.isDisabledClass); 6053 } else { 6054 opener.setAttribute("tabindex", "0"); 6055 select.setAttribute("tabindex", "-1"); 6056 addEvents(); 6057 } 6058 container.customSelect = { 6059 get pluginOptions() { 6060 return builderParams; 6061 }, 6062 get open() { 6063 return isOpen; 6064 }, 6065 set open(bool) { 6066 open(bool); 6067 }, 6068 get disabled() { 6069 return select.disabled; 6070 }, 6071 set disabled(bool) { 6072 disabled(bool); 6073 }, 6074 get value() { 6075 return select.value; 6076 }, 6077 set value(val) { 6078 setValue(val); 6079 }, 6080 append: function append(node, target) { 6081 return _append(node, true, target); 6082 }, 6083 insertBefore: function insertBefore(node, target) { 6084 return _insertBefore(node, target); 6085 }, 6086 remove, 6087 empty, 6088 destroy, 6089 opener, 6090 select, 6091 panel, 6092 container 6093 }; 6094 select.customSelect = container.customSelect; 6095 return container.customSelect; 6096} 6097function customSelect(element, customParams) { 6098 var nodeList = []; 6099 var selects = [];
6100 return function init() { 6101 if (element && element instanceof HTMLElement && element.tagName.toUpperCase() === "SELECT") { 6102 nodeList.push(element); 6103 } else if (element && typeof element === "string") { 6104 var elementsList = document.querySelectorAll(element); 6105 for (var i = 0, l = elementsList.length; i < l; ++i) { 6106 if (elementsList[i] instanceof HTMLElement && elementsList[i].tagName.toUpperCase() === "SELECT") { 6107 nodeList.push(elementsList[i]); 6108 } 6109 } 6110 } else if (element && element.length) { 6111 for (var _i3 = 0, _l3 = element.length; _i3 < _l3; ++_i3) { 6112 if (element[_i3] instanceof HTMLElement && element[_i3].tagName.toUpperCase() === "SELECT") { 6113 nodeList.push(element[_i3]); 6114 } 6115 } 6116 } 6117 for (var _i4 = 0, _l4 = nodeList.length; _i4 < _l4; ++_i4) { 6118 selects.push(builder(nodeList[_i4], _extends({}, defaultParams, customParams))); 6119 } 6120 return selects; 6121 }(); 6122} 6123function flattenObject(obj, parentKey = "") { 6124 let result = {}; 6125 for (let key in obj) { 6126 if (Object.hasOwn(obj, key)) { 6127 let newKey = parentKey ? `${parentKey}[${key}]` : key; 6128 if (typeof obj[key] === "object" && obj[key] !== null) { 6129 Object.assign(result, flattenObject(obj[key], newKey)); 6130 } else { 6131 result[newKey] = obj[key]; 6132 } 6133 } 6134 } 6135 return result; 6136} 6137function setInputValue(element, value) { 6138 if (element.type === "radio") { 6139 if (element.value === value) { 6140 element.checked = true; 6141 element.dispatchEvent(new Event("change")); 6142 } 6143 return; 6144 } 6145 if (element.value === value) { 6146 return; 6147 } 6148 element.value = value; 6149 element.dispatchEvent(new Event("input")); 6150 element.dispatchEvent(new Event("change")); 6151} 6152const formDefault = () => { 6153 const forms = document.querySelectorAll("form[data-default]"); 6154 forms.forEach((form) => { 6155 const defaults2 = flattenObject(JSON.parse(form.dataset["default"])); 6156 form.querySelectorAll("[data-reset-tab]").forEach((button) => { 6157 const tab = form.querySelector( 6158 `[data-widget-tab="${button.dataset.resetTab}"]` 6159 ); 6160 button.addEventListener("click", (event) => { 6161 event.preventDefault(); 6162 let parent = tab.querySelector("[data-active-language]") || tab; 6163 const inputs = parent.querySelectorAll([ 6164 "input", 6165 "select", 6166 "textarea" 6167 ]); 6168 inputs.forEach((input) => { 6169 if (defaults2[input.name]) { 6170 setInputValue(input, defaults2[input.name]); 6171 } 6172 }); 6173 }); 6174 }); 6175 }); 6176}; 6177window.$ = window.jQuery = $$1; 6178window.addLoader = addLoader; 6179window.addEventListener("load", function() { 6180 colorPicker(); 6181 widgetLanguage(); 6182 widgetPreview(); 6183 widgetTabs(); 6184 policyContentTabs(); 6185 restoreWidgetMessageOnClick(); 6186 widgetInstructions(); 6187 copyText(); 6188 formDefault(); 6189 typeDropdown(); 6190 const deleteForm = document.querySelector("#delete-form"); 6191 if (deleteForm) { 6192 deleteForm.addEventListener("submit", function(event) { 6193 if (!confirm("Are you sure?")) { 6194 event.preventDefault(); 6195 } 6196 }); 6197 } 6198 _default(".custom-select"); 6199 const signin = document.body; 6200 if (signin.classList.contains("signin")) { 6201 const firstInput = signin.querySelector(".fields input"); 6202 firstInput && firstInput.focus(); 6203 } 6204 var vh = window.innerHeight * 0.01; 6205 document.documentElement.style.setProperty("--vh", vh + "px"); 6206 window.addEventListener("resize", function() { 6207 var vh2 = window.innerHeight * 0.01; 6208 document.documentElement.style.setProperty("--vh", vh2 + "px"); 6209 }); 6210 new BtnExpand(".btn--expand", { 6211 classname: "btn--expand", 6212 closeOnOutsideClick: true, 6213 event: {} 6214 }); 6215 smoothScroll(); 6216 const accordions = document.querySelectorAll(".accordion:not(.accordion--vue)"); 6217 accordions && accordions.forEach((accordion) => { 6218 new Accordion(accordion); 6219 }); 6220 new Dropdown(".dropdown:not([data-vue-dropdown])", { 6221 toggleSelector: ".dropdown__trigger" 6222 }); 6223 const dropdownToggles = document.querySelectorAll(".dropdown-toggle");
6224 dropdownToggles && dropdownToggles.forEach((dropdown) => { 6225 new DropdownToggle(dropdown); 6226 }); 6227 accordionCookies(); 6228 inactiveCookiesForm(); 6229 inactiveStorageItemsForm(); 6230 menuToggle(); 6231 planSelect(); 6232 comparisonToggle(); 6233 reviews(); 6234 reviewsTicker(); 6235 policyUpdate(); 6236 agencyManagement(); 6237 clientManagement(); 6238 modaalInit(); 6239 checkoutForm(); 6240 creditSelect(); 6241 enableSubmit(); 6242 policyTabs(); 6243 initThankYou(); 6244 widgetScan(); 6245 flatpickr(".date-picker", { 6246 altInput: true, 6247 altFormat: "j F Y", 6248 dateFormat: "j F Y" 6249 }); 6250 new paymentPlanDropdownHandler(".payment-plan-trigger", { 6251 inputName: "subscription_type", 6252 classname: "payment-plan-trigger", 6253 itemsClassName: "payment-plan-item", 6254 dropdownClassName: "payment-plan-dropdown", 6255 events: {} 6256 }); 6257 new PaymentPlanToggle( 6258 "input[type='radio'][name='subscription_frequency']", 6259 {} 6260 ); 6261 const ele = document.querySelectorAll("input.toggle"); 6262 if (ele) { 6263 ele.forEach(function(item) { 6264 item.addEventListener("change", function() { 6265 if (item.checked) { 6266 item.parentNode.classList.add("is-active"); 6267 } else { 6268 item.parentNode.classList.remove("is-active"); 6269 } 6270 }); 6271 }); 6272 document.querySelectorAll("input.toggle:checked").forEach((item) => { 6273 item.dispatchEvent(new Event("change")); 6274 }); 6275 } 6276 const loginForm = document.getElementById("login-form"); 6277 if (loginForm) { 6278 loginForm.addEventListener("submit", function() { 6279 document.getElementById("login-submit").disabled = true; 6280 }); 6281 } 6282 const tabs_selector = document.querySelectorAll(".tabs__trigger"); 6283 if (tabs_selector) { 6284 tabs_selector.forEach(function(item) { 6285 if (item.dataset.tab) { 6286 item.addEventListener("click", function(event) { 6287 if (item.classList.contains("is-active")) { 6288 if (!item.parentNode.classList.contains("is-open")) { 6289 item.parentNode.classList.add("is-open"); 6290 } else { 6291 item.parentNode.classList.remove("is-open"); 6292 } 6293 } 6294 event.preventDefault(); 6295 }); 6296 } 6297 }); 6298 } 6299 function dashboardSearch() { 6300 const searchInput = document.querySelector( 6301 '#dashboard-search input[name="search"]' 6302 ); 6303 const searchForm = document.querySelector("#dashboard-search"); 6304 let debounceTimeout; 6305 if (!searchInput || !searchForm) return; 6306 const urlParams = new URLSearchParams(window.location.search); 6307 if (urlParams.has("search")) { 6308 searchInput.focus(); 6309 } 6310 const debounce2 = (callback, delay) => { 6311 clearTimeout(debounceTimeout); 6312 debounceTimeout = setTimeout(callback, delay); 6313 }; 6314 searchInput.addEventListener("input", function() { 6315 debounce2(() => { 6316 searchForm.submit(); 6317 }, 500); 6318 }); 6319 } 6320 function dashboardPerPage() { 6321 const perPageForm = document.querySelector("#dashboard-per-page-form"); 6322 if (!perPageForm) return; 6323 perPageForm.querySelectorAll("select").forEach((control) => { 6324 control.addEventListener("change", function() { 6325 perPageForm.submit(); 6326 }); 6327 }); 6328 } 6329 function preferenceButtonColorToggle() { 6330 const radios = document.querySelectorAll( 6331 '[name="embed_config[functionality][update_after_close_button_color]"]' 6332 ); 6333 if (radios.length) { 6334 radios.forEach((radio) => { 6335 radio.addEventListener("change", function() { 6336 var _a; 6337 const selected = (_a = document.querySelector( 6338 '[name="embed_config[functionality][update_after_close_button_color]"]:checked' 6339 )) == null ? void 0 : _a.value; 6340 const wrapper = document.querySelector( 6341 "#update-after-close-button-color" 6342 ); 6343 if (wrapper) { 6344 if (selected === "on") { 6345 wrapper.style.display = "grid"; 6346 } else { 6347 wrapper.style.display = "none"; 6348 } 6349 } 6350 }); 6351 }); 6352 } 6353 } 6354 preferenceButtonColorToggle(); 6355 dashboardSearch(); 6356 dashboardPerPage(); 6357 googleConsentMode(); 6358}); 6359function modaalInit() { 6360 new _(".js-embed", { 6361 content_source: "#modalEmbed", 6362 custom_class: "modal-embed", 6363 after_open: () => { 6364 policyView(); 6365 } 6366 }); 6367 new _("#modalCreateTrigger", { 6368 content_source: "#modalCreate", 6369 custom_class: "modal-create", 6370 before_open: () => { 6371 creditSelect(); 6372 } 6373 }); 6374} 6375policyUpdateEditorToggle(); 6376function policyUpdateEditorToggle() { 6377 const HIDDEN_CLASS = "policy-update-editor--preview-hidden"; 6378 const STORAGE_KEY = "policyUpdateEditor.previewHidden"; 6379 const applyInitial = () => { 6380 const editor = document.querySelector(".js-policy-update-editor"); 6381 if (!editor) return; 6382 editor.classList.toggle(HIDDEN_CLASS, localStorage.getItem(STORAGE_KEY) !== "0"); 6383 }; 6384 document.addEventListener("click", (e) => {
6385 const hideBtn = e.target.closest && e.target.closest(".js-policy-update-editor-hide-preview"); 6386 const showBtn = e.target.closest && e.target.closest(".js-policy-update-editor-show-preview"); 6387 if (!hideBtn && !showBtn) return; 6388 const trigger = hideBtn || showBtn; 6389 const editor = trigger.closest(".js-policy-update-editor"); 6390 if (!editor) return; 6391 const hidden = Boolean(hideBtn); 6392 editor.classList.toggle(HIDDEN_CLASS, hidden); 6393 localStorage.setItem(STORAGE_KEY, hidden ? "1" : "0"); 6394 }); 6395 if (document.readyState === "loading") { 6396 document.addEventListener("DOMContentLoaded", () => setTimeout(applyInitial, 0)); 6397 } else { 6398 setTimeout(applyInitial, 0); 6399 } 6400 document.addEventListener("livewire:navigated", applyInitial); 6401} 6402tooltips(); 6403function tooltips() { 6404 const tooltips2 = document.querySelectorAll(".tooltip__content"); 6405 if (!tooltips2) return; 6406 tooltips2.forEach((tooltip) => { 6407 const tooltipPos = tooltip.getBoundingClientRect(); 6408 const parentWrapper = document.getElementById( 6409 tooltip.parentNode.getAttribute("data-wrapper") 6410 ); 6411 if (tooltipPos.right > (window.innerWidth || document.documentElement.clientWidth)) { 6412 tooltip.classList.add("tooltip__content--left"); 6413 } 6414 if (parentWrapper) { 6415 const parentWrapperPos = parentWrapper.getBoundingClientRect(); 6416 if (tooltipPos.right > parentWrapperPos.right) { 6417 tooltip.classList.add("tooltip__content--left"); 6418 } 6419 if (tooltipPos.bottom > parentWrapperPos.bottom) { 6420 tooltip.classList.add("tooltip__content--top"); 6421 } 6422 } 6423 }); 6424} 6425createPlanToggle(); 6426function createPlanToggle() { 6427 const toggles = document.querySelectorAll(".checkout-pack__toggle"); 6428 if (!toggles) return; 6429 toggles.forEach((toggle) => { 6430 toggle.addEventListener("click", (e) => { 6431 e.preventDefault(); 6432 let type = toggle.getAttribute("data-type"); 6433 if (type) { 6434 let input = document.querySelector( 6435 `input[name="plan-type"]` 6436 ); 6437 if (input) { 6438 input.value = type; 6439 } 6440 let intervalInput = document.querySelector( 6441 `input[name="${type}-interval"]` 6442 ); 6443 if (intervalInput) { 6444 let planIntervalInput = document.querySelector( 6445 `input[name="plan-interval"]` 6446 ); 6447 if (planIntervalInput) { 6448 planIntervalInput.value = intervalInput.value; 6449 } 6450 } 6451 } 6452 let isExpanded = toggle.getAttribute("aria-expanded") === "true"; 6453 let target = document.getElementById( 6454 toggle.getAttribute("aria-controls") 6455 ); 6456 if (!isExpanded) { 6457 let activeToggle = document.querySelector( 6458 ".checkout-pack__toggle[aria-controls][aria-expanded='true']" 6459 ); 6460 let activeTarget = document.getElementById( 6461 activeToggle.getAttribute("aria-controls") 6462 ); 6463 activeToggle.setAttribute("aria-expanded", "false"); 6464 activeTarget.setAttribute("data-expanded", "false"); 6465 toggle.setAttribute("aria-expanded", "true"); 6466 target.setAttribute("data-expanded", "true"); 6467 } 6468 }); 6469 }); 6470} 6471//# sourceMappingURL=index-CATTCrhM.js.map
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.