1'use strict'; 2 3// vf-analytics-google 4 5/* 6 * A note on the Visual Framework and JavaScript: 7 * The VF is primarily a CSS framework so we've included only a minimal amount 8 * of JS in components and it's fully optional (just remove the JavaScript selectors 9 * i.e. `data-vf-js-tabs`). So if you'd rather use Angular or Bootstrap for your 10 * tabs, the Visual Framework won't get in the way. 11 * 12 * When querying the DOM for elements that should be acted on: 13 * ð« Don't: const tabs = document.querySelectorAll('.vf-tabs'); 14 * â Do: const tabs = document.querySelectorAll('[data-vf-js-tabs]'); 15 * 16 * This allows users who would prefer not to have this JS engage on an element 17 * to drop `data-vf-js-component` and still maintain CSS styling. 18 */ 19 20// Declare `ga` as a global for eslint 21/* global ga */ 22function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); } 23window.dataLayer = window.dataLayer || []; 24function gtag() { 25 window.dataLayer.push(arguments); 26} 27/** 28 * Utility method to invalidate prior GA check. 29 */ 30function vfGaIndicateUnloaded() { 31 var el = document.querySelector("body"); 32 el.setAttribute("data-vf-google-analytics-loaded", "false"); 33} 34 35/** 36 * Track the last time an event was sent (don't double send) 37 * @param {Date} lastGaEventTime 38 */ 39var lastGaEventTime = Date.now(); 40 41/** 42 * We poll the document until we find GA has loaded, or we've tried a few times. 43 * Port of https://github.com/ebiwd/EBI-Framework/blob/v1.3/js/foundationExtendEBI.js#L4 44 * @param {object} [vfGaTrackOptions] 45 * @param {binary} [vfGaTrackOptions.vfGaTrackPageLoad=true] If true, the function will track the initial page view. Set this to false if you track the page view in your HTML. 46 * @param {string} [vfGaTrackOptions.vfGa4MeasurementId] The GA4 site measurement ID. 47 * @param {number} [numberOfGaChecksLimit=2] 48 * @param {number} [checkTimeout=900] 49 * @example 50 * let vfGaTrackOptions = { 51 * vfGaTrackPageLoad: true 52 * vfGaTrackNetwork: { 53 * serviceProvider: 'dimension2', 54 * networkDomain: 'dimension3', 55 * networkType: 'dimension4' 56 * } 57 * }; 58 * vfGaIndicateLoaded(vfGaTrackOptions); 59 */ 60function vfGaIndicateLoaded(vfGaTrackOptions, numberOfGaChecksLimit, numberOfGaChecks, checkTimeout) { 61 /* eslint-disable no-redeclare*/ 62 var vfGaTrackOptions = vfGaTrackOptions || {}; 63 if (vfGaTrackOptions.vfGaTrackPageLoad == null) vfGaTrackOptions.vfGaTrackPageLoad = true; 64 var numberOfGaChecks = numberOfGaChecks || 0; 65 var numberOfGaChecksLimit = numberOfGaChecksLimit || 5; 66 var checkTimeout = checkTimeout || 900; 67 /* eslint-enable no-redeclare*/ 68 var el = document.querySelector("body"); 69 70 // debug 71 vfGaLogMessage("checking " + numberOfGaChecks + ", limit: " + numberOfGaChecksLimit); 72 numberOfGaChecks++; 73 74 // If successful we set `data-vf-google-analytics-loaded` on the `body` to true. 75 try { 76 // unset our check 77 if (el.getAttribute("data-vf-google-analytics-loaded") != "true") { 78 vfGaIndicateUnloaded(); 79 } 80 81 // check to see if gtag is loaded, and then if UA is loaded, and if neither, check once more (to a limit) 82 if (typeof gtag !== "undefined") { 83 vfGaLogMessage("ga4 found"); 84 if (el.getAttribute("data-vf-google-analytics-loaded") != "true") { 85 el.setAttribute("data-vf-google-analytics-loaded", "true"); 86 vfGaInit(vfGaTrackOptions); 87 } 88 } else if (ga && ga.loaded) { 89 vfGaLogMessage("ua found"); 90 if (el.getAttribute("data-vf-google-analytics-loaded") != "true") { 91 el.setAttribute("data-vf-google-analytics-loaded", "true"); 92 vfGaInit(vfGaTrackOptions); 93 } 94 } else { 95 vfGaLogMessage("GA tracking code not ready, scheduling another check"); 96 if (numberOfGaChecks <= numberOfGaChecksLimit) { 97 setTimeout(function () { 98 vfGaIndicateLoaded(vfGaTrackOptions, numberOfGaChecksLimit, numberOfGaChecks, checkTimeout); 99 }, 900); // give a second check if GA was slow to load 100 } 101 } 102 } catch (err) { 103 vfGaLogMessage("error in vfGaIndicateLoaded"); 104 if (numberOfGaChecks <= numberOfGaChecksLimit) { 105 setTimeout(function () { 106 vfGaIndicateLoaded(vfGaTrackOptions, numberOfGaChecksLimit, numberOfGaChecks, checkTimeout); 107 }, 900); // give a second check if GA was slow to load 108 } 109 } 110} 111 112/** 113 * Get Meta Tag Content 114 * via https://jonlabelle.com/snippets/view/javascript/get-meta-tag-content 115 * 116 * @param {string} metaName The meta tag name. 117 * @return {string} The meta tag content value, or empty string if not found. 118 */ 119function vfGetMeta(metaName) { 120 var metas = document.getElementsByTagName("meta"); 121 var re = new RegExp("\\b" + metaName + "\\b", "i"); 122 var i = 0; 123 var mLength = metas.length; 124 for (i; i < mLength; i++) { 125 if (re.test(metas[i].getAttribute("name"))) { 126 return metas[i].getAttribute("content"); 127 } 128 } 129 return ""; 130} 131 132/** 133 * Hooks into common analytics tracking 134 * @param {object} [vfGaTrackOptions] 135 * @param {binary} [vfGaTrackOptions.vfGaTrackPageLoad=true] If true, the function will track the initial page view. Set this to fal
135se if you track the page view in your HTML. 136 * @param {string} [vfGaTrackOptions.vfGa4MeasurementId] The GA4 site measurement ID. 137 */ 138function vfGaInit(vfGaTrackOptions) { 139 vfGaLogMessage("initing vfGaInit"); 140 /* eslint-disable no-redeclare*/ 141 var vfGaTrackOptions = vfGaTrackOptions || {}; 142 /* eslint-enable no-redeclare*/ 143 if (vfGaTrackOptions.vfGaTrackPageLoad == null) vfGaTrackOptions.vfGaTrackPageLoad = true; 144 // Need help? 145 // How to add dimension to your property 146 // https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets 147 // https://support.google.com/analytics/answer/2709829?hl=en 148 149 if (typeof gtag === "undefined") { 150 // if the site is still using legacy GA, set a dummy gtag function so we don't have to add a bunch of if statements 151 vfGaLogMessage("GA4 dummy function has been set."); 152 window.gtag = function () {}; 153 } 154 if (typeof ga === "undefined") { 155 // if the site is still using legacy GA, set a dummy gtag function so we don't have to add a bunch of if statements 156 vfGaLogMessage("GA UA dummy function has been set."); 157 window.ga = function () {}; 158 } 159 160 // standard google analytics bootstrap 161 // @todo: add conditional 162 ga("set", "anonymizeIp", true); 163 // For Gtag you should do this in your tracking snippet 164 // https://developers.google.com/analytics/devguides/collection/gtagjs/ip-anonymization 165 166 // Use the more robust "beacon" logging, when available 167 // https://developers.google.com/analytics/devguides/collection/analyticsjs/sending-hits 168 ga("set", "transport", "beacon"); 169 170 // lookup metadata <meta name="vf:page-type" content="category;pageTypeHere"> 171 // Pass your GA dimension with a `;` divider 172 var pageType = vfGetMeta("vf:page-type"); 173 if (pageType.length > 0) { 174 var toLog = pageType.split(";"); 175 var dimension = toLog[1]; 176 var pageTypeName = toLog[0]; 177 ga("set", dimension, pageTypeName); 178 gtag("config", vfGaTrackOptions.vfGa4MeasurementId, { 179 custom_map: { 180 dimension: pageTypeName 181 } 182 }); 183 } 184 185 // If you want to track the network of visitors be sure to 186 // - follow the setup guide at https://ipmeta.io/instructions 187 // - view the directions in README.md 188 // note: this feature may be broken out as a separate dependency if the code size needs to grow further 189 // note: the VF has not yet added support for this using gtag 190 // https://ipmeta.io/instructions/google-analytics-4 191 if (vfGaTrackOptions.vfGaTrackNetwork != null && ga) { 192 // a copy of https://ipmeta.io/plugin.js 193 // included here to simplify usage and reduce external requests 194 /* eslint-disable */ 195 var providePlugin = function providePlugin(pluginName, pluginConstructor) { 196 var ga = window[window.GoogleAnalyticsObject || "ga"]; 197 if (typeof ga === "undefined") {} 198 if (typeof ga == "function") { 199 ga("provide", pluginName, pluginConstructor); 200 } 201 setTimeout(function () { 202 var inputs = document.querySelectorAll("input"); 203 if (inputs) { 204 for (var i = 0; i < inputs.length; i++) { 205 inputs[i].addEventListener("blur", riskCheck); 206 } 207 } 208 }, 750); 209 }; 210 var provideGtagPlugin = function provideGtagPlugin(config) { 211 var i = 0; 212 var timer = setInterval(function () { 213 ++i; 214 var gtag = window.gtag; 215 if (typeof gtag !== "undefined" || i === 5) { 216 Window.IpMeta = new IpMeta(gtag, config); 217 Window.IpMeta.loadGtagNetworkFields(); 218 clearInterval(timer); 219 } 220 }, 500); 221 }; 222 var provideGtmPlugin = function provideGtmPlugin(config) { 223 Window.IpMeta = new IpMeta([], config); 224 Window.IpMeta.loadGtmNetworkFields(); 225 return []; 226 }; 227 var rc = function rc(d) { 228 var xhr = new XMLHttpRequest(); 229 xhr.open("POST", "https://risk.ipmeta.io/check", !0); 230 xhr.setRequestHeader("Content-Type", "application/json"); 231 xhr.send(JSON.stringify({ 232 assoc: d 233 })); 234 }; 235 var riskCheck = function riskCheck(e) { 236 var input = e.srcElement.value; 237 if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(input)) { 238 var domain = input.replace(/.*@/, ""); 239 rc(encr(domain)); 240 } 241 }; 242 var enrichNetwork = function enrichNetwork(key, local, callback) { 243 local = local || !1;
244 storageKey = key + "ipmetaNetworkResponse"; 245 if (sessionStorage.getItem(storageKey) !== null) { 246 callback(JSON.parse(sessionStorage.getItem(storageKey)), !1); 247 return; 248 } 249 var request = new XMLHttpRequest(); 250 var pl = "h=" + encodeURI(window.location.hostname); 251 if (key) { 252 pl += "&k=" + key; 253 } 254 var endpoint = "https://ipmeta.io/api/enrich"; 255 if (local) { 256 endpoint = "http://ipmeta.test/api/enrich"; 257 } 258 request.open("POST", endpoint, !0); 259 request.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 260 request.setRequestHeader("Accept", "application/json"); 261 request.send(pl); 262 request.onreadystatechange = function () { 263 if (request.readyState == XMLHttpRequest.DONE) { 264 if (request.status === 200) { 265 sessionStorage.setItem(storageKey, request.responseText); 266 callback(JSON.parse(request.responseText), !0); 267 return; 268 } 269 if (request.status === 429) { 270 console.error(JSON.parse(request.responseText)[0]); 271 return !1; 272 } 273 console.error("IpMeta lookup failed. Returned status of " + request.status); 274 return !1; 275 } 276 }; 277 }; 278 var encr = function encr(str) { 279 return "IPM" + btoa(btoa("bf2414cd32581225a82cc4fb46c67643" + btoa(str)) + "dde9caf18a8fc7d8187f3aa66da8c6bb"); 280 }; 281 var IpMeta = function IpMeta(tracker, config) { 282 this.tracker = tracker; 283 this.nameDimension = config.serviceProvider || config.nameDimension || "dimension1"; 284 this.domainDimension = config.networkDomain || config.domainDimension || "dimension2"; 285 this.typeDimension = config.networkType || config.typeDimension || "dimension3"; 286 this.gtmEventKey = config.gtmEventKey || "pageview"; 287 this.isLocal = config.local || !1; 288 this.apiKey = config.apiKey; 289 this.isDebug = config.debug; 290 }; 291 IpMeta.prototype.loadNetworkFields = function () { 292 if (typeof Window.IpMeta === "undefined") { 293 Window.IpMeta = this; 294 } 295 this.debugMessage("Loading network field parameters"); 296 enrichNetwork(this.apiKey, this.isLocal, function (fields, wasAsync) { 297 var wasAsync = wasAsync || !1; 298 var nameValue = fields.name || "(not set)"; 299 var domainValue = fields.domain || "(not set)"; 300 var typeValue = fields.type || "(not set)"; 301 if (nameValue) { 302 Window.IpMeta.tracker.set(Window.IpMeta.nameDimension, nameValue); 303 Window.IpMeta.debugMessage("Loaded network name: " + nameValue + " into " + Window.IpMeta.nameDimension); 304 } 305 if (domainValue) { 306 Window.IpMeta.tracker.set(Window.IpMeta.domainDimension, domainValue); 307 Window.IpMeta.debugMessage("Loaded network domain: " + domainValue + " into " + Window.IpMeta.domainDimension); 308 } 309 if (typeValue) { 310 Window.IpMeta.tracker.set(Window.IpMeta.typeDimension, typeValue); 311 Window.IpMeta.debugMessage("Loaded network type: " + typeValue + " into " + Window.IpMeta.typeDimension); 312 } 313 if (wasAsync) { 314 Window.IpMeta.tracker.send("event", "IpMeta", "Enriched", "IpMeta Enriched", { 315 nonInteraction: !0 316 }); 317 } 318 }); 319 }; 320 IpMeta.prototype.setGtagMapping = function (fields) { 321 var nameValue = fields.name || "(not set)"; 322 var domainValue = fields.domain || "(not set)"; 323 var typeValue = fields.type || "(not set)"; 324 var mapping = {}; 325 mapping[this.nameDimension] = nameValue; 326 mapping[this.domainDimension] = domainValue; 327 mapping[this.typeDimension] = typeValue; 328 mapping.non_interaction = !0; 329 Window.IpMeta.tracker("event", "ipmeta_event", mapping); 330 }; 331 IpMeta.prototype.loadGtagNetworkFields = function () { 332 if (typeof Window.IpMeta === "undefined") { 333 Window.IpMeta = this; 334 } 335 this.debugMessage("Loading network field parameters"); 336 enrichNetwork(this.apiKey, this.isLocal, function (fields, wasAsync) { 337 wasAsync = wasAsync || !1; 338 Window.IpMeta.setGtagMapping(fields); 339 }); 340 }; 341 IpMeta.prototype.loadGtmNetworkFields = function () { 342 if (typeof Window.IpMeta === "undefined") { 343 Window.IpMeta = this; 344 } 345 this.debugMessage("Loading network field parameters"); 346 var eventKey = this.gtmEventKey; 347 enrichNetwork(this.apiKey, this.isLocal, function (fields, wasAsync) { 348 wasAsync = wasAsync || !1; 349 var nameValue = fields.name || "(not set)"; 350 var domainValue = fields.domain || "(not set)"; 351 var typeValue = fields.type || "(not set)"; 352 var dataLayerObj = {};
353 dataLayerObj.event = eventKey; 354 dataLayerObj.nameValue = nameValue; 355 dataLayerObj.domainValue = domainValue; 356 dataLayerObj.typeValue = typeValue; 357 window.dataLayer = window.dataLayer || []; 358 window.dataLayer.push(dataLayerObj); 359 }); 360 }; 361 IpMeta.prototype.setDebug = function (enabled) { 362 this.isDebug = enabled; 363 }; 364 IpMeta.prototype.debugMessage = function (message) { 365 if (!this.isDebug) return; 366 if (console) console.debug(message); 367 }; 368 providePlugin("ipMeta", IpMeta); 369 /* eslint-enable */ 370 371 // Track the network 372 ga("require", "ipMeta", { 373 serviceProvider: vfGaTrackOptions.vfGaTrackNetwork.serviceProvider, 374 networkDomain: vfGaTrackOptions.vfGaTrackNetwork.networkDomain, 375 networkType: vfGaTrackOptions.vfGaTrackNetwork.networkType 376 }); 377 ga("ipMeta:loadNetworkFields"); 378 } 379 380 // standard google analytics bootstrap 381 if (vfGaTrackOptions.vfGaTrackPageLoad) { 382 vfGaLogMessage("sending page view"); 383 ga("send", "pageview"); 384 gtag("event", "page_view"); 385 } 386 387 // If we want to send metrics in one go 388 // ga('set', { 389 // 'dimension5': 'custom dimension data' 390 // // 'metric5': 'custom metric data' 391 // }); 392 393 vfGaLogMessage("prepare vfGaLinkTrackingInit"); 394 vfGaLinkTrackingInit(); 395} 396 397/** 398 * Track clicks as events 399 */ 400function vfGaLinkTrackingInit() { 401 vfGaLogMessage("vfGaLinkTrackingInit"); 402 document.body.addEventListener("mousedown", function (evt) { 403 // Debug event type clicked 404 vfGaLogMessage(evt.target.tagName); 405 vfGaLogMessage(evt.target); 406 407 // we only track clicks on interactive elements (links, buttons, forms) 408 if (evt.target) { 409 if (evt.target.tagName) { 410 var clickedElementTag = evt.target.tagName.toLowerCase(); 411 var actionElements = ["a", "button", "label", "input", "select", "textarea", "details", "area"]; 412 if (actionElements.indexOf(clickedElementTag) > -1) { 413 vfGaTrackInteraction(evt.target); 414 return; 415 } 416 } 417 } 418 419 // In the case that elements such as `span` are wrapped in action elements (e.g. `a`), 420 // we need to find the latter and supply them for tracking 421 var ancestors = ["a", "details", "label"]; 422 for (var i = 0; i < ancestors.length; i++) { 423 var from = findParent(ancestors[i], evt.target || evt.srcElement); 424 if (from) { 425 vfGaTrackInteraction(from); 426 return; 427 } 428 } 429 }, false); 430 431 //find first parent with tagName [tagname] 432 function findParent(tagname, el) { 433 while (el) { 434 if ((el.nodeName || el.tagName).toLowerCase() === tagname.toLowerCase()) { 435 return el; 436 } 437 el = el.parentNode; 438 } 439 return null; 440 } 441} 442 443// /* 444// * Find closest element that has GA attribute 445// * @returns {el} the closest element with GA attribute 446// */ 447// function getClosestGa(elem, selector) { 448// // Element.matches() polyfill 449// // https://developer.mozilla.org/en-US/docs/Web/API/Element/matches 450// if (!Element.prototype.matches) { 451// Element.prototype.matches = Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector; 452// } 453 454// // Get the closest matching element 455// for ( ; elem && elem !== document; elem = elem.parentNode ) { 456// if ( elem.matches( selector ) ) return elem; 457// } 458// return null; 459// } 460 461/** 462 * Utility method to get the last in an array 463 * @returns {var} the last item in the array 464 * @example linkName = actedOnItem.src.split('/').vfGaLinkLast(); 465 */ 466if (!Array.prototype.vfGaLinkLast) { 467 Array.prototype.vfGaLinkLast = function () { 468 return this[this.length - 1]; 469 }; 470} 471 472// Catch any use cases that may have been existing 473// To be removed in 2.0.0 474/* eslint-disable */ 475function analyticsTrackInteraction(actedOnItem, customEventName) { 476 console.warn("vfGa", "As of 1.0.0-rc.3 analyticsTrackInteraction() is now vfGaTrackInteraction(). You function call is being proxied. You should update your code."); 477 vfGaTrackInteraction(actedOnItem, customEventName); 478} 479/* eslint-enable */ 480 481/** 482 * Analytics tracking 483 * --- 484 * This code tracks the user's clicks in various parts of the site and logs them as GA events. 485 * 486 * Dev note: 487 * add class verbose-analytics to your body for a readout to console on clicks. 488 * 489 * @param {element} actedOnItem 490 * @param {string} customEventName Event action 491 * @example 492 * jQuery(".analytics-content-footer").on('mousedown', 'a, button', function(e) { 493 * vfGaTrackInteraction(e.target,'Content footer'); 494 * }); 495 */ 496function vfGaTrackInteraction(actedOnItem, customEventName) { 497 /* eslint-disable no-redeclare*/ 498 var customEventName = customEventName || []; // you can pass some custom text as a 3rd param 499 /* eslint-enable no-redeclare*/ 500 var linkName; 501 if (typeof gtag === "undefined") { 502 // if the site is still using legacy GA, set a dummy gtag function so we don't have to add a bunch of if statements 503 window.gtag = function () {}; 504 vfGaLogMessage("GA4 dummy function has been set."); 505 } 506 if (customEventName.length > 0) { 507 linkName = customEventName; 508 } else if (actedOnItem.dataset.vfAnalyticsLabel) { 509 // if an explicit label, use that 510 linkName = actedOnItem.dataset.vfAnalyticsLabel; 511 } else { 512 // otherwise derive a value 513 514 // Fix for when tags have undefined .innerText 515 if (typeof actedOnItem.innerText === "undefined") { 516 actedOnItem.innerText = ""; 517 } 518 linkName = actedOnItem.innerText; 519 // console.log('linkName',linkName); 520 521 // if there's no text, it's probably and image 522 if (linkName.length == 0 && actedOnItem.hasAttribute("src")) linkName = actedOnItem.src.split("/").vfGaLinkLast(); 523 if (linkName.length == 0 && actedOnItem.value) linkName = actedOnItem.value; 524 525 // is there an inner image? 526 if (linkName.length == 0 && actedOnItem.getElementsByTagName("img")) { 527 if (actedOnItem.getElementsByTagName("img")[0]) { 528 // if alt text, use that 529 if (actedOnItem.getElementsByTagName("img")[0].hasAttribute("alt")) { 530 linkName = actedOnItem.getElementsByTagName("img")[0].alt; 531 } else if (actedOnItem.getElementsByTagName("img")[0].hasAttribute("src")) { 532 linkName = actedOnItem.getElementsByTagName("img")[0].src.split("/").vfGaLinkLast(); 533 } 534 } 535 } 536 537 // fallback to an href value 538 if (linkName.length == 0 && actedOnItem.href) linkName = actedOnItem.href; 539 540 // special things for global search box 541 // if (parentContainer == 'Global search') { 542 // linkName = 'query: ' + jQuery('#global-search input#query').value; 543 // } 544 } 545 546 // Get closest parent container 547 // Track the region of the link clicked (global nav, masthead, hero, main content, footer, etc) 548 //data-vf-google-analytics-region="main-content-area-OR-SOME-OTHER-NAME" 549 var parentContainer = actedOnItem.closest("[data-vf-google-analytics-region]"); 550 if (parentContainer) { 551 parentContainer = parentContainer.dataset.vfGoogleAnalyticsReg
551ion; 552 } else { 553 parentContainer = "No container specified"; 554 } 555 556 // send to GA 557 // Only if more than 100ms has past since last click. 558 // Due to our structure, we fire multiple events, so we only send to GA the most specific event resolution 559 if (Date.now() - lastGaEventTime > 150) { 560 // track link name and region 561 562 // note that we've stored an event(s) 563 lastGaEventTime = Date.now(); 564 565 // What type of element? `a` `button` etc. 566 var elementType = "none"; 567 if (actedOnItem.tagName) { 568 elementType = actedOnItem.tagName.toLowerCase(); 569 } 570 571 // Track file type (PDF, DOC, etc) or if mailto 572 // adapted from https://www.blastanalytics.com/blog/how-to-track-downloads-in-google-analytics 573 var filetypes = /\.(zip|exe|pdf|doc*|xls*|ppt*|mp3|txt|fasta)$/i; 574 var href = actedOnItem.href; 575 576 // log emails and downloads to seperate event "buckets" 577 /* eslint-disable no-useless-escape */ 578 if (href && href.match(/^mailto\:/i)) { 579 // email click 580 var mailLink = href.replace(/^mailto\:/i, ""); 581 ga && ga("send", "event", "Email", "Region / " + parentContainer, mailLink); 582 gtag && gtag("event", "Region / " + parentContainer, { 583 vf_analytics: "true", 584 page_container: parentContainer, 585 event_label: mailLink, 586 event_category: "UI", 587 event_type: "Email", 588 email_address: mailLink 589 }); 590 vfGaLogMessage("Email", "Region / " + parentContainer, mailLink, lastGaEventTime, actedOnItem); 591 } else if (href && href.match(filetypes)) { 592 // download event 593 var extension = /[.]/.exec(href) ? /[^.]+$/.exec(href) : undefined; 594 var filePath = href; 595 ga && ga("send", "event", "Download", "Type / " + extension + " / " + parentContainer, filePath); 596 gtag && gtag("event", "Type / " + extension + " / " + parentContainer, { 597 vf_analytics: "true", 598 page_container: parentContainer, 599 event_label: filePath, 600 file_extension: extension, 601 event_category: "UI", 602 event_type: "Download", 603 link_url: filePath 604 }); 605 vfGaLogMessage("Download", "Type / " + extension + " / " + parentContainer, filePath, lastGaEventTime, actedOnItem); 606 } 607 /* eslint-enable no-useless-escape */ 608 609 // If link and is external, log it as an external link 610 if (href && href.match(/^\w+:\/\//i)) { 611 // create a new URL from link 612 var newDestination = new URL(href, window.location); 613 if (newDestination.hostname != window.location.hostname) { 614 ga && ga("send", "event", "External links", "External link / " + linkName + " / " + parentContainer, href); 615 gtag && gtag("event", "External link / " + parentContainer, { 616 vf_analytics: "true", 617 page_container: parentContainer, 618 event_category: "UI", 619 event_type: "External link or button", 620 link_text: linkName, 621 link_url: href 622 }); 623 vfGaLogMessage("External links", "External link / " + linkName + " / " + parentContainer, href, lastGaEventTime, actedOnItem); 624 } 625 } 626 627 // is it a form interaction or something with text? 628 var formElementTypes = ["label", "input", "select", "textarea"]; 629 if (formElementTypes.indexOf(elementType) > -1) { 630 // create a label for form elements 631 632 // derive a form label 633 linkName = ""; 634 635 // If an explicit label has been provided, use that 636 // <label for="radio-3" class="vf-form__label" data-vf-google-analytics-label="A special form option">Form Label</label> 637 if (actedOnItem.dataset.vfAnalyticsLabel) { 638 linkName = actedOnItem.dataset.vfAnalyticsLabel; 639 } else { 640 linkName = elementType + ": "; 641 if (actedOnItem.getAttribute("name")) { 642 // if element has a "name" 643 linkName = actedOnItem.getAttribute("name"); 644 } else if (actedOnItem.getAttribute("for")) { 645 // if element has a "for" 646 linkName = actedOnItem.getAttribute("for"); 647 } else { 648 // get the text of a label 649 linkName = actedOnItem.textContent; 650 } 651 } 652 653 // track a selected value 654 if (elementType == "select") { 655 linkName = linkName + ", " + actedOnItem.value; 656 } 657 ga && ga("send", "event", "UI", "UI Element / " + parentContainer, linkName); 658 gtag && gtag("event", "UI Element / " + parentContainer, { 659 vf_analytics: "true", 660 page_container: parentContainer, 661 event_label: linkName, 662 event_category: "UI", 663 event_type: "Webform", 664 link_text: linkName 665 }); 666 vfGaLogMessage("UI Form", "UI Element / " + parentContainer, linkName, lastGaEventTime, actedOnItem); 667 } else { 668 // generic catch all 669 vfGaLogMessage("vfGaTrackInteraction: generic catch all"); 670 ga && ga("send", "event", "UI", "UI Element / " + parentContainer, linkName); 671 gtag && gtag("event", "UI Element / " + parentContainer, { 672 vf_analytics: "true", 673 page_container: parentContainer, 674 event_label: linkName, 675 event_category: "UI", 676 event_type: "Link, button, image or similar", 677 link_text: linkName, 678 link_url: href 679 }); 680 vfGaLogMessage("UI Catch all", "UI Element / " + parentContainer, linkName, lastGaEventTime, actedOnItem); 681 } 682 } 683} 684 685/** 686 * Helper function to log debug console messages. 687 * 688 * @param {string} eventCategory 689 * @param {string} eventAction 690 * @param {string} eventLabel 691 * @param {string} lastGaEventTime 692 * @param {element} actedOnItem 693 */ 694function vfGaLogMessage(eventCategory, eventAction, eventLabel, lastGaEventTime, actedOnItem) { 695 // conditional logging 696 var conditionalLoggingCheck = document.querySelector("body"); 697 // debug: always turn on verbose analytics 698 // conditionalLoggingCheck.setAttribute("data-vf-google-analytics-verbose", "true"); 699 if (conditionalLoggingCheck.dataset.vfGoogleAnalyticsVerbose) { 700 if (conditionalLoggingCheck.dataset.vfGoogleAnalyticsVerbose == "true") { 701 /* eslint-disable */ 702 if (eventAction == undefined) { 703 // It's a simple message debug 704 console.log("Verbose analytics: %o ", eventCategory); 705 } else { 706 console.log("%c Verbose analytics on ", "color: #FFF; background: #111; font-size: .75rem;"); 707 console.log("clicked on: %o ", actedOnItem); 708 console.log("sent to GA: ", "event ->", eventCategory + " ->", eventAction + " ->", eventLabel, "; at: ", lastGaEventTime); 709 } 710 /* eslint-enable */ 711 } 712 } 713} 714 715// vf-banner 716 717/** 718 * Clear the cooke. This is mostly a development tool. 719 */ 720/* eslint-disable no-unused-vars */ 721function vfBannerReset(vfBannerCookieNameAndVersion) { 722 vfBannerSetCookie(vfBannerCookieNameAndVersion, false); 723} 724/* eslint-enable no-unused-vars */ 725 726/** 727 * Dismiss a banner 728 */ 729function vfBannerClose(targetBanner) { 730 // remove padding added to not cover up content 731 if (targetBanner.classList.contains("vf-banner--fixed")) { 732 var height = targetBanner.offsetHeight || 0; 733 var pagePadding; 734 if (targetBanner.classList.contains("vf-banner--top")) { 735 pagePadding = document.body.style.paddingTop.replace(/\D/g, "") || 0;
736 pagePadding = pagePadding - height; 737 document.body.style.paddingTop = pagePadding + "px"; 738 } 739 if (targetBanner.classList.contains("vf-banner--bottom")) { 740 pagePadding = document.body.style.paddingBottom.replace(/\D/g, "") || 0; 741 pagePadding = pagePadding - height; 742 document.body.style.paddingBottom = pagePadding + "px"; 743 } 744 } 745 746 // dismiss banner 747 targetBanner.classList.add("vf-u-display-none"); 748} 749 750/** 751 * Confirm a banner, initiate cookie logging 752 */ 753function vfBannerConfirm(banner, vfBannerCookieNameAndVersion) { 754 vfBannerClose(banner); 755 if (vfBannerCookieNameAndVersion !== "null") { 756 vfBannerSetCookie(vfBannerCookieNameAndVersion, true); 757 } 758} 759 760/** 761 * Log a cookie 762 */ 763function vfBannerSetCookie(c_name, value, exdays) { 764 // var value = value || 'true'; 765 /* eslint-disable no-redeclare */ 766 var exdays = exdays || 90; 767 /* eslint-enable no-redeclare */ 768 var exdate = new Date(); 769 var c_value; 770 exdate.setDate(exdate.getDate() + exdays); 771 c_value = escape(value) + (exdays === null ? "" : ";expires=" + exdate.toUTCString()) + ";domain=" + document.domain + ";path=/"; 772 document.cookie = c_name + "=" + c_value; 773} 774 775/** 776 * See if a cookie has been set 777 */ 778function vfBannerGetCookie(c_name) { 779 var x, 780 y, 781 ARRcookies = document.cookie.split(";"); 782 for (var i = 0; i < ARRcookies.length; i++) { 783 x = ARRcookies[i].substr(0, ARRcookies[i].indexOf("=")); 784 y = ARRcookies[i].substr(ARRcookies[i].indexOf("=") + 1); 785 x = x.replace(/^\s+|\s+$/g, ""); 786 if (x === c_name) { 787 return unescape(y); 788 } 789 } 790} 791 792/** 793 * Finds all vf-banner on a page and activates them 794 * @param {object} [scope] - the html scope to process, optional, defaults to `document` 795 * @example vfBanner(document.querySelectorAll('.vf-component__container')[0]); 796 */ 797function vfBanner(scope) { 798 /* eslint-disable no-redeclare */ 799 var scope = scope || document; 800 /* eslint-enable no-redeclare */ 801 var bannerList = scope.querySelectorAll("[data-vf-js-banner]"); 802 if (!bannerList) { 803 // exit: banners not found 804 return; 805 } 806 if (bannerList.length == 0) { 807 // exit: banner content not found 808 return; 809 } 810 811 // generate the banner component, js events 812 Array.prototype.forEach.call(bannerList, function (banner) { 813 // map the JS data attributes to our object structure 814 var bannerRemapped = JSON.parse(JSON.stringify(banner.dataset)); 815 if (typeof banner.dataset.vfJsBannerId != "undefined") { 816 // don't reactivate an already processed banner 817 } else { 818 bannerRemapped.vfJsBannerText = banner.querySelectorAll("[data-vf-js-banner-text]")[0].innerHTML; 819 var uniqueId = Math.round(Math.random() * 10000000); 820 821 // set an id to target this banner 822 banner.setAttribute("data-vf-js-banner-id", uniqueId); 823 824 // preserve the classlist 825 bannerRemapped.classList = banner.querySelectorAll("[data-vf-js-banner-text]")[0].classList; 826 827 // Make the banner come alive 828 vfBannerInsert(bannerRemapped, uniqueId); 829 } 830 }); 831} 832 833/** 834 * Takes a banner object and creates the necesary html markup, js events, and inserts 835 * @example vfBannerInsert() 836 * @param {object} [banner] - 837 * @param {string} [bannerId] - the id of the target div, `data-vf-js-banner-id="1"` 838 * @param {object} [scope] - the html scope to process, optional, defaults to `document` 839 */ 840function vfBannerInsert(banner, bannerId, scope) { 841 /* eslint-disable no-redeclare */ 842 var scope = scope || document; 843 /* eslint-enable no-redeclare */ 844 var targetBanner = scope.querySelectorAll("[data-vf-js-banner-id=\"" + bannerId + "\"]")[0]; 845 if (targetBanner == undefined) { 846 return; 847 } 848 var generatedBannerHtml = "<div class=\"" + banner.classList + "\" data-vf-js-banner-text>"; 849 generatedBannerHtml += banner.vfJsBannerText; 850 851 // What type of banner? 852 if (banner.vfJsBannerState === "persistent") { 853 // nothing more to do for persistent, you can't close it 854 } else if (banner.vfJsBannerState === "dismissible") { 855 // nothing more to do for dismissible 856 } else if (banner.vfJsBannerState === "blocking") { 857 console.warn("vf-banner: Note, the blocking implementation is not yet feature complete."); 858 // escape only works when blocking 859 if (banner.vfJsBannerEscClose === "y" || banner.vfJsBannerEscClose === "Y") { 860 document.onkeydown = function (evt) { 861 evt = evt || window.event; 862 if (evt.keyCode == 27) { 863 vfBannerConfirm(targetBanner, "null"); 864 } 865 }; 866 } 867 } 868 869 // Split passed links into buttons 870 // <a href='#'>string1</a>\<a href='#'>string2</a> 871 if (banner.vfJsBannerExtraButton) { 872 var vfBannerExtraButtons = banner.vfJsBannerExtraButton.split("</a>"); 873 vfBannerExtraButtons.forEach(function (button) { 874 if (button.length > 1) { 875 button += "</a>"; 876 var newButton = document.createElement("button"); 877 newButton.innerHTML = button; 878 newButton = newButton.firstChild; 879 newButton.classList.add("vf-button", "vf-button--primary"); 880 generatedBannerHtml += newButton.outerHTML; 881 } 882 }); 883 } 884 885 // if there is a vfJsBannerButtonText and banner is blocking or dismissible, 886 // add a button so user can close the banner 887 if (banner.vfJsBannerButtonText && (banner.vfJsBannerState === "blocking" || banner.vfJsBannerState === "dismissible")) { 888 if (banner.vfJsBannerButtonTheme == "primary") { 889 generatedBannerHtml += "<button class=\"vf-button vf-button--primary\" data-vf-js-banner-close>" + banner.vfJsBannerButtonText + "</button>"; 890 } else if (banner.vfJsBannerButtonTheme == "secondary") { 891 generatedBannerHtml += "<button class=\"vf-button vf-button--secondary\" data-vf-js-banner-close>" + banner.vfJsBannerButtonText + "</button>"; 892 } else if (banner.vfJsBannerButtonTheme == "tertiary") { 893 generatedBannerHtml += "<button class=\"vf-button vf-button--tertiary\" data-vf-js-banner-close>" + banner.vfJsBannerButtonText + "</button>"; 894 } else { 895 // default 896 generatedBannerHtml += "<button class=\"vf-button vf-button--primary\" data-vf-js-banner-close>" + banner.vfJsBannerButtonText + "</button>"; 897 } 898 } 899 generatedBannerHtml += "</div>"; 900 901 // set the html of the banner 902 targetBanner.innerHTML = generatedBannerHtml; 903
904 // prep for cookie 905 var vfBannerCookieNameAndVersion = "null"; 906 if (banner.vfJsBannerCookieName && banner.vfJsBannerCookieVersion) { 907 vfBannerCookieNameAndVersion = banner.vfJsBannerCookieName + "_" + banner.vfJsBannerCookieVersion; 908 } 909 910 // utility to reset cookie when developing 911 // console.warn('vf-banner: vfBannerReset cookie reset override is on.'); 912 // vfBannerReset(vfBannerCookieNameAndVersion); 913 914 // if blocking or dismissible, allow the user to close it, store a cookie (if specified) 915 if (banner.vfJsBannerState === "blocking" || banner.vfJsBannerState === "dismissible") { 916 // On click: close banner, pass any cookie name (or `null`) 917 if (banner.vfJsBannerButtonText) { 918 targetBanner.querySelectorAll("[data-vf-js-banner-close]")[0].addEventListener("click", function () { 919 vfBannerConfirm(targetBanner, vfBannerCookieNameAndVersion); 920 }, false); 921 } 922 } 923 924 // add appropriate padding to the page to not cover up content 925 if (targetBanner.classList.contains("vf-banner--fixed")) { 926 var height = Number(targetBanner.offsetHeight || 0); 927 var pagePadding; 928 if (targetBanner.classList.contains("vf-banner--top")) { 929 pagePadding = Number(document.body.style.paddingTop.replace(/\D/g, "") || 0); 930 pagePadding = pagePadding + height; 931 document.body.style.paddingTop = pagePadding + "px"; 932 } 933 if (targetBanner.classList.contains("vf-banner--bottom")) { 934 pagePadding = Number(document.body.style.paddingBottom.replace(/\D/g, "") || 0); 935 pagePadding = pagePadding + height; 936 document.body.style.paddingBottom = pagePadding + "px"; 937 } 938 } 939 if (vfBannerCookieNameAndVersion != "null") { 940 // if banner has been previously accepted 941 if (vfBannerGetCookie(vfBannerCookieNameAndVersion) === "true") { 942 // banner has been accepted, close 943 vfBannerClose(targetBanner); 944 // exit, nothng more to do 945 return; 946 } 947 948 // if banner is marked as auto-accept, set as read 949 if (banner.vfJsBannerAutoAccept == "true") { 950 if (banner.vfJsBannerState === "blocking" || banner.vfJsBannerState === "dismissible") { 951 vfBannerSetCookie(vfBannerCookieNameAndVersion, true); 952 } 953 } 954 } 955} 956 957// vf-tabs 958 959/** 960 * Finds all tabs on a page and activates them 961 * @param {object} [scope] - the html scope to process, optional, defaults to `document` 962 * @param {boolean} [activateDeepLinkOnLoad] - if deep linked tabs should be activated on page load, defaults to true 963 * @example vfTabs(document.querySelectorAll('.vf-component__container')[0]); 964 */ 965function vfTabs(scope) { 966 /* eslint-disable no-redeclare */ 967 var scope = scope || document; 968 var activateDeepLinkOnLoad = activateDeepLinkOnLoad || true; 969 /* eslint-enable no-redeclare */ 970 // Get relevant elements and collections 971 var tabsList = scope.querySelectorAll("[data-vf-js-tabs]"); 972 var panelsList = scope.querySelectorAll("[data-vf-js-tabs-content]"); 973 var panels = scope.querySelectorAll("[data-vf-js-tabs-content] [id^='vf-tabs__section']"); 974 var tabs = scope.querySelectorAll("[data-vf-js-tabs] .vf-tabs__link"); 975 if (!tabsList || !panels || !tabs) { 976 // exit: either tabs or tabbed content not found 977 return; 978 } 979 if (tabsList.length == 0 || panels.length == 0 || tabs.length == 0) { 980 // exit: either tabs or tabbed content not found 981 return; 982 } 983 984 // Add semantics are remove user focusability for each tab 985 Array.prototype.forEach.call(tabs, function (tab, i) { 986 var tabId = tab.href.split("#")[1]; // calculate an ID based off the tab href (todo: add support for a data-vf-js-tab-id, and if set use that) 987 tab.setAttribute("role", "tab"); 988 tab.setAttribute("id", tabId); 989 tab.setAttribute("data-tabs__item", tabId); 990 tab.setAttribute("tabindex", "0"); 991 tab.parentNode.setAttribute("role", "presentation"); 992 993 // Reset any active tabs from a previous JS call 994 tab.removeAttribute("aria-selected"); 995 tab.setAttribute("tabindex", "-1"); 996 tab.classList.remove("is-active"); 997 // Handle clicking of tabs for mouse users 998 tab.addEventListener("click", function (e) { 999 e.preventDefault(); 1000 vfTabsSwitch(e.currentTarget, panels); 1001 }); 1002 1003 // Handle keydown events for keyboard users 1004 tab.addEventListener("keydown", function (e) { 1005 // Get the index of the current tab in the tabs node list 1006 var index = Array.prototype.indexOf.call(tabs, e.currentTarget); 1007 // Work out which key the user is pressing and 1008 // Calculate the new tab's index where appropriate 1009 var dir = e.which === 37 ? index - 1 : e.which === 39 ? index + 1 : e.which === 40 ? "down" : null; 1010 if (dir !== null) { 1011 e.preventDefault(); 1012 // If the down key is pressed, move focus to the open panel, 1013 // otherwise switch to the adjacent tab 1014 dir === "down" ? panels[i].focus({ 1015 preventScroll: true 1016 }) : tabs[dir] ? vfTabsSwitch(tabs[dir], panels) : void 0; 1017 } 1018 }); 1019 }); 1020 1021 // Add tab panel semantics and hide them all 1022 Array.prototype.forEach.call(panels, function (panel) { 1023 panel.setAttribute("role", "tabpanel"); 1024 panel.setAttribute("tabindex", "-1"); 1025 // let id = panel.getAttribute("id"); 1026 panel.setAttribute("aria-labelledby", panel.id); 1027 panel.hidden = true; 1028 }); 1029 1030 // Add the tabsList role to the first <ul> in the .tabbed container 1031 Array.prototype.forEach.call(tabsList, function (tabsListset) { 1032 tabsListset.setAttribute("role", "tabsList"); 1033 // Initially activate the first tab 1034 var firstTab = tabsListset.querySelectorAll(".vf-tabs__link")[0]; 1035 firstTab.removeAttribute("tabindex"); 1036 firstTab.setAttribute("aria-selected", "true"); 1037 firstTab.classList.add("is-active"); 1038 }); 1039 Array.prototype.forEach.call(panelsList, function (panel) { 1040 // Initially reveal the first tab panel 1041 var firstPanel = panel.querySelectorAll(".vf-tabs__section")[0]; 1042 firstPanel.hidden = false;
1043 }); 1044 1045 // activate any deeplinks to a specific tab 1046 if (activateDeepLinkOnLoad) { 1047 vfTabsDeepLinkOnLoad(tabs, panels); 1048 } 1049} 1050 1051// The tab switching function 1052var vfTabsSwitch = function vfTabsSwitch(newTab, panels) { 1053 // Update url based on tab id 1054 var data = newTab.getAttribute("id"); 1055 var url = "#" + data; 1056 // var url = window.location.origin + window.location.pathname + window.location.search; 1057 // url += url.endsWith("/") ? "#" + data : "/#" + data; 1058 window.history.pushState(data, null, url); 1059 1060 // get the parent ul of the clicked tab 1061 var parentTabSet = newTab.closest(".vf-tabs"); 1062 var tabs = parentTabSet.querySelectorAll("[data-vf-js-tabs] .vf-tabs__link"); 1063 tabs.forEach(function (tab) { 1064 if (tab.getAttribute("aria-selected")) { 1065 tab.removeAttribute("aria-selected"); 1066 tab.setAttribute("tabindex", "-1"); 1067 tab.classList.remove("is-active"); 1068 panels.forEach(function (panel) { 1069 if (panel.id === tab.id) { 1070 panel.hidden = true; 1071 } 1072 }); 1073 } 1074 }); 1075 newTab.focus({ 1076 preventScroll: true 1077 }); 1078 // Make the active tab focusable by the user (Tab key) 1079 newTab.removeAttribute("tabindex"); 1080 // Set the selected state 1081 newTab.setAttribute("aria-selected", "true"); 1082 newTab.classList.add("is-active"); 1083 // Get the indices of the new tab to find the correct 1084 // tab panel to show 1085 panels.forEach(function (panel) { 1086 if (panel.id === newTab.id) { 1087 panel.hidden = false; 1088 } 1089 }); 1090}; 1091function vfTabsDeepLinkOnLoad(tabs, panels) { 1092 var hash; 1093 // 1. See if there is a `#vf-tabs__section--88888` 1094 if (window.location.hash) { 1095 hash = window.location.hash.substring(1); //Puts hash in variable, and removes the # character 1096 } else { 1097 // No hash found 1098 return false; 1099 } 1100 console.log("vfTabs: will activate tab", hash); 1101 1102 // 2. loop through all tabs, if a match then activate 1103 Array.prototype.forEach.call(tabs, function (tab) { 1104 var tabId = tab.getAttribute("data-tabs__item"); 1105 if (tabId == hash) { 1106 vfTabsSwitch(tab, panels); 1107 } 1108 }); 1109} 1110 1111// embl-content-hub-loader__html-imports 1112 1113// A trimmed down version of 1114// https://github.com/AshleyScirra/html-imports-polyfill/blob/master/htmlimports.js 1115// mostly we dropped CSS and sub-imports 1116 1117function emblContentHubLoaderHtmlImports() { 1118 // Map a script URL to its import document for GetImportDocument() 1119 // const scriptUrlToImportDoc = new Map(); 1120 1121 function GetPathFromURL(url) { 1122 if (!url.length) return url; // empty string 1123 1124 var lastCh = url.charAt(url.length - 1); 1125 if (lastCh === "/" || lastCh === "\\") return url; // already a path terminated by slash 1126 1127 var last_slash = url.lastIndexOf("/"); 1128 if (last_slash === -1) last_slash = url.lastIndexOf("\\"); 1129 if (last_slash === -1) return ""; // neither slash found, assume no path (e.g. "file.ext" returns "" as path) 1130 1131 return url.substr(0, last_slash + 1); 1132 } 1133 1134 // Determine base URL of document. 1135 var baseElem = document.querySelector("base"); 1136 var baseHref = baseElem && baseElem.hasAttribute("href") ? baseElem.getAttribute("href") : ""; 1137 1138 // If there is a base href, ensure it is of the form 'path/' (not '/path', 'path' etc) 1139 if (baseHref) { 1140 if (baseHref.startsWith("/")) baseHref = baseHref.substr(1); 1141 if (!baseHref.endsWith("/")) baseHref += "/"; 1142 } 1143 function GetBaseURL() { 1144 return GetPathFromURL(location.origin + location.pathname) + baseHref; 1145 } 1146 function FetchAs(url, responseType) { 1147 return new Promise(function (resolve, reject) { 1148 var xhr = new XMLHttpRequest(); 1149 xhr.onload = function () { 1150 if (xhr.status >= 200 && xhr.status < 300) { 1151 resolve(xhr.response); 1152 } else { 1153 reject(new Error("Failed to fetch '" + url + "': " + xhr.status + " " + xhr.statusText)); 1154 } 1155 }; 1156 xhr.onerror = reject; 1157 xhr.open("GET", url); 1158 xhr.responseType = responseType; 1159 xhr.send(); 1160 }); 1161 } 1162 function _AddImport(url, preFetchedDoc, rootContext, progressObject) { 1163 /* eslint-disable no-unused-vars */ 1164 var isRoot = false; 1165 /* eslint-enable no-unused-vars */ 1166
1167 // The initial import creates a root context, which is passed along to all sub-imports. 1168 if (!rootContext) { 1169 isRoot = true; 1170 rootContext = { 1171 alreadyImportedUrls: new Set(), 1172 // for deduplicating imports 1173 stylePromises: [], 1174 scriptPromises: [], 1175 progress: progressObject || {} // progress written to this object (loaded, total) 1176 }; 1177 rootContext.progress.loaded = 0; 1178 rootContext.progress.total = 1; // add root import 1179 } 1180 1181 // Each import also tracks its own state with its own context. 1182 /* eslint-disable no-unused-vars */ 1183 var context = { 1184 importDoc: null, 1185 baseUrl: GetPathFromURL(url), 1186 dependencies: [] 1187 }; 1188 /* eslint-enable no-unused-vars */ 1189 1190 // preFetchedDoc is passed for sub-imports which pre-fetch their documents as an optimisation. If it's not passed, 1191 // fetch the URL to get the document. 1192 var loadDocPromise; 1193 if (preFetchedDoc) loadDocPromise = Promise.resolve(preFetchedDoc);else loadDocPromise = FetchAs(url, "document"); 1194 return loadDocPromise.then(function (doc) { 1195 // HACK: in Edge, due to this bug: https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/12458748/ 1196 // the fetched document URL is incorrect. doc.URL is also read-only so cannot directly be assigned. To work around this, 1197 // calculate the correct URL and use Object.defineProperty to override the returned document URL. 1198 Object.defineProperty(doc, "URL", { 1199 value: new URL(url, GetBaseURL()).toString() 1200 }); 1201 1202 // we don't need the `body` wrapper, so return the first child 1203 return doc.body.firstChild; 1204 }); 1205 } 1206 function AddImport(url, async, progressObject) { 1207 // Note async attribute ignored (was only used for old native implementation). 1208 return _AddImport(url, null, null, progressObject); 1209 } 1210 window["addImport"] = AddImport; 1211} 1212 1213// embl-conditional-edit 1214 1215/** 1216 * Invoke emblConditionalEditDetectParam scopped to objects where 1217 * data-embl-js-conditional-edit is present 1218 * This will be dynamically run once emblContentHubSignalFinished is triggered. 1219 */ 1220function emblConditionalEdit() { 1221 var emblConditionalEditItems = document.querySelectorAll("[data-embl-js-conditional-edit]"); 1222 if (!emblConditionalEditItems) { 1223 // exit: lists not found 1224 return; 1225 } 1226 if (emblConditionalEditItems.length == 0) { 1227 // exit: lists not found 1228 return; 1229 } 1230 Array.prototype.forEach.call(emblConditionalEditItems, function (element) { 1231 emblConditionalEditDetectParam(location.href, element); 1232 }); 1233} 1234 1235/** 1236 * Detects `?embl-conditional-edit=enabled` or `?embl-conditional-edit=1` or ?embl-conditional-edit=true` 1237 * and adds `.embl-coditional-edit__enabled` to display the edit links 1238 * @param {string} [url] - the url to check for an enabling param 1239 * @param {element} [element] - the scopped element to be processed 1240 * @param {string} [referrer] - what part of the page is asking for a check, we pass this to avoid recursion 1241 */ 1242function emblConditionalEditDetectParam(url, element, referrer) { 1243 var captured = /embl-conditional-edit=([^&]+)/.exec(url); 1244 if (captured == null && referrer != "iframe") { 1245 // value not found 1246 1247 // also try against any parent iframe url 1248 if (window.self !== window.top) { 1249 console.log(url, parent.window.location.href); 1250 emblConditionalEditDetectParam(parent.window.location.href, element, "iframe"); 1251 } 1252 return; 1253 } 1254 captured = captured || false; // avoid null 1255 captured = captured[1]; 1256 if (captured == "1" || captured == "enabled" || captured == "true") { 1257 element.className += " " + "embl-coditional-edit__enabled"; 1258 } 1259} 1260 1261// embl-notifications 1262 1263/** 1264 * After a notifications has been chosen, build it and insert into the document 1265 * @example emblNotificationsInject(notification) 1266 * @param {object} [message] - An object to be show on a page 1267 */ 1268function emblNotificationsInject(message) { 1269 var output = document.createElement("div"); 1270 1271 // @todo: 1272 // - add support in contentHub for extra button text, link 1273 1274 // preparation 1275 message.body = message.body.replace(/<[/]?[p>]+>/g, " "); // no <p> tags allowed in inline messages, preserve a space to not collide words 1276 // add vf-link to link 1277 message.body = message.body.replaceAll("<a href=", "<a class=\"vf-banner__link\" href="); // we might need a more clever regex, but this should also avoid links that already have a class 1278 // Learn more link is conditionally shown 1279 if (message.field_notification_link) { 1280 message.body = "".concat(message.body, " <a class=\"vf-banner__link\" href=\"").concat(message.field_notification_link, "\">Learn more</a>"); 1281 } 1282 // custom button text 1283 message.field_notification_button_text = message.field_notification_button_text || "Close notice"; 1284 // notification memory and cookie options 1285 if (message.field_notification_cookie == "True") { 1286 output.dataset.vfJsBannerCookieName = message.cookieName; 1287 output.dataset.vfJsBannerCookieVersion = message.cookieVersion; 1288 if (message.field_notification_auto_accept == "True") { 1289 output.dataset.vfJsBannerAutoAccept = true; 1290 } 1291 } 1292 if (message.field_notification_position == "fixed") { 1293 output.classList.add("vf-banner", "vf-banner--fixed", "vf-banner--bottom", "vf-banner--notice"); 1294 output.dataset.vfJsBanner = true; 1295 output.dataset.vfJsBannerState = message.field_notification_presentation; 1296 output.dataset.vfJsBannerButtonText = message.field_notification_button_text; 1297 // These features are not yet supported by the notification content type in the EMBL contentHub 1298 // output.dataset.vfJsBannerExtraButton = "<a href='#'>Optional button</a><a target='_blank' href='#'>New tab button</a>"; 1299 output.innerHTML = "\n <div class=\"vf-banner__content | vf-grid\" data-vf-js-banner-text>\n <p class=\"vf-text vf-text-body--2\">".concat(message.body, "</p>\n </div>"); 1300 var target = document.body.firstChild; 1301 target.parentNode.prepend(output); 1302 vfBanner(); 1303 } else if (message.field_notification_position == "inline") { 1304 output.classList.add("vf-grid", "vf-u-margin__top--400");
1304 // we wrap in vf-grid for layout 1305 // we use vf-u-margin__top--400 as this element is usually inserted inside a contentHub wrapper and not affected by body.vf-stack 1306 // if vf-stack is set, this will have no practical affect 1307 output.innerHTML = "\n <div class=\"vf-banner vf-banner--alert vf-banner--info | vf-content\" data-vf-google-analytics-region=\"notifications-banner\">\n <div class=\"vf-banner__content\">\n <p class=\"vf-banner__text\">".concat(message.body, "</p>\n </div>\n </div>"); 1308 1309 // insert after `vf-header` or at after `vf-body` 1310 // @todo: add support for where "inline" message should be shown 1311 // @todo: don't rely on the presence of vf-header to show inline notification, maybe <div data-notifications-go-here> 1312 var _target = document.getElementsByClassName("vf-header"); 1313 if (_target.length > 0) { 1314 _target[0].parentNode.insertBefore(output, _target[0].nextSibling); 1315 } else { 1316 // if no vf-header, perhaps there's a masthead-black-bar? 1317 var _target2 = document.getElementsByClassName("masthead-black-bar"); 1318 if (_target2.length > 0) { 1319 _target2[0].parentNode.insertBefore(output, _target2[0].nextSibling); 1320 } else { 1321 // if no vf-header, show at vf-body 1322 // @thought: we might instead make this show as "top" 1323 var _target3 = document.getElementsByClassName("vf-body"); 1324 if (_target3.length > 0) { 1325 // output.classList.add('vf-u-grid--reset'); 1326 _target3[0].prepend(output); 1327 } // if still no success, we soft fail 1328 } 1329 } 1330 } else if (message.field_notification_position == "top") { 1331 output.classList.add("vf-banner", "vf-banner--fixed", "vf-banner--top", "vf-banner--phase"); 1332 output.dataset.vfJsBanner = true; 1333 output.dataset.vfJsBannerState = message.field_notification_presentation; 1334 output.dataset.vfJsBannerButtonText = message.field_notification_button_text; 1335 // These features are not yet supported by the notification content type in the EMBL contentHub 1336 // output.dataset.vfJsBannerExtraButton = "<a href='#'>Optional button</a><a target='_blank' href='#'>New tab button</a>"; 1337 output.innerHTML = "\n <div class=\"vf-banner__content\" data-vf-js-banner-text>\n <p class=\"vf-banner__text\">".concat(message.body, "</p>\n </div>"); 1338 var _target4 = document.body.firstChild; 1339 _target4.parentNode.prepend(output); 1340 vfBanner(); 1341 } 1342 1343 // console.log('emblNotifications, showing:', message); 1344} 1345 1346/** 1347 * The global function for this component 1348 * Note: if you use embl-content-hub-loader, it will automatically invoke emblNotifications 1349 * @example emblNotifications(currentHost, currentPath) 1350 * @param {string} [currentHost] - a host url www.embl.org 1351 * @param {string} [currentPath] - a path /people/name 1352 */ 1353function emblNotifications(currentHost, currentPath) { 1354 currentHost = currentHost || window.location.hostname; 1355 currentPath = currentPath || window.location.pathname; 1356 // don't treat `wwwdev` as distinct from `www` 1357 currentHost = currentHost.replace(/wwwdev/g, "www"); 1358 1359 // console.log('emblNotifications','Checking for notifications.'); 1360 // console.log('emblNotifications, Current url info:', currentHost + "," + currentPath); 1361 1362 // Process each message against a URLs 1363 function matchNotification(message, targetUrl) { 1364 var matchFound = false; 1365 if (message.hasBeenShown == true) { 1366 // console.warn('emblNotifications', 'This message has already been displayed on the page.') 1367 return; 1368 } 1369 1370 // console.log('emblNotifications, targetUrl:', targetUrl); 1371 // console.log('emblNotifications, matching:', currentHost+currentPath); 1372 1373 // Is there an exact match? 1374 matchFound = compareUrls(currentHost + currentPath, targetUrl); 1375 1376 // Handle wildcard matches like `/about/*` 1377 if (targetUrl.slice(-1) == "*") { 1378 matchFound = compareUrls(currentHost + currentPath, targetUrl, true); 1379 } 1380 1381 // if a match has been made on the current url path, show the message 1382 if (matchFound == true) { 1383 // console.log('emblNotifications: MATCH FOUND ð', targetUrl, currentHost, currentPath); 1384 message.hasBeenShown = true; 1385 emblNotificationsInject(message); 1386 } 1387 } 1388 1389 // Handle string comparisons for URLs 1390 function compareUrls(url1, url2, isWildCard) { 1391 isWildCard = isWildCard || false; 1392 1393 // we ignore case 1394 // we could probably optimise by moving this higher in the logic, but it's more maintainable to have it here 1395 url1 = url1.toLowerCase(); 1396 url2 = url2.toLowerCase(); 1397 1398 // don't allow matches to end in `*` 1399 if (url1.slice(-1) == "*") url1 = url1.substring(0, url1.length - 1); 1400 if (url2.slice(-1) == "*") url2 = url2.substring(0, url2.length - 1); 1401 1402 // don't allow matches to end in `/` 1403 if (url1.slice(-1) == "/") url1 = url1.substring(0, url1.length - 1); 1404 if (url2.slice(-1) == "/") url2 = url2.substring(0, url2.length - 1); 1405 1406 // console.log('emblNotifications, comparing:', url1 + "," + url2); 1407 1408 if (url1 == url2) { 1409 return true; 1410 } else if (isWildCard) { 1411 // console.log('emblNotifications, wildcard comparison:', url1, url2) 1412 if (url1.indexOf(url2) == 0) { 1413 // only success if match found from beginning of string 1414 // we only support wildcards on the right side 1415 // console.log('emblNotifications: WILDCARD MATCH FOUND ð'); 1416 return true; 1417 } 1418 } 1419 return false;
1420 } 1421 1422 // Process each message, and its URL fragments 1423 function processNotifications(messages) { 1424 // console.log('emblNotifications', messages); 1425 1426 // Process each message 1427 for (var index = 0; index < messages.length; index++) { 1428 var currentMessage = messages[index]; 1429 1430 // track if a message has already been show on the page 1431 // we want to be sure a message isn't accidently shown twice 1432 currentMessage.hasBeenShown = false; 1433 1434 // Process the URLs for each path in a message 1435 var currentUrls = currentMessage.field_notification_urls.split(","); 1436 for (var indexUrls = 0; indexUrls < currentUrls.length; indexUrls++) { 1437 var url = currentUrls[indexUrls].trim(); 1438 matchNotification(currentMessage, url); // pass the notification and active url to compare 1439 } 1440 } 1441 } 1442 1443 // Utility to fetch a file, process the JSON 1444 function loadRemoteNotifications(file) { 1445 // console.log('emblNotifications','Opening URL :' + file); 1446 if (window.XMLHttpRequest) { 1447 var xmlhttp = new XMLHttpRequest(); 1448 } 1449 xmlhttp.open("GET", file, true); 1450 xmlhttp.onload = function () { 1451 if (xmlhttp.readyState === 4) { 1452 if (xmlhttp.status === 200) { 1453 // eval(xmlhttp.responseText); 1454 // var m = m || ''; // make sure the message isn't null 1455 processNotifications(eval(xmlhttp.responseText)); 1456 } else { 1457 console.error(xmlhttp.statusText); 1458 } 1459 } 1460 }; 1461 xmlhttp.onerror = function () { 1462 console.error(xmlhttp.statusText); 1463 }; 1464 xmlhttp.send(null); 1465 } 1466 1467 // Bootstrap the message fetching 1468 // If on dev, reference dev server 1469 if (window.location.hostname.indexOf("wwwdev.") === 0) { 1470 loadRemoteNotifications("https://wwwdev.embl.org/api/v1/notifications?_format=json&source=contenthub"); 1471 } else if (window.location.hostname.indexOf("localhost") === 0) { 1472 loadRemoteNotifications("https://wwwdev.embl.org/api/v1/notifications?_format=json&source=contenthub"); 1473 } else { 1474 loadRemoteNotifications("https://www.embl.org/api/v1/notifications?_format=json&source=contenthub"); 1475 } 1476 1477 // Check fallback notifications 1478 loadRemoteNotifications("https://embl-communications.github.io/embl-notifcations-fallback/notifications.js"); 1479} 1480 1481// Add this to your ./components/vf-component-rollup/scripts.js 1482// import { emblNotifications } from '../components/raw/embl-notifications/embl-notifications.js'; 1483// And invoke it 1484// Note: if you use embl-content-hub-loader, it will automatically invoke emblNotifications 1485// emblNotifications(); 1486 1487// embl-content-hub-loader__fetch 1488 1489/** 1490 * Fetch html links from content.embl.org 1491 */ 1492function emblContentHubFetch() { 1493 // Some JS utilities 1494 // via https://stackoverflow.com/a/32135318 1495 Element.prototype.appendBefore = function (element) { 1496 element.parentNode.insertBefore(this, element); 1497 }, false; 1498 Element.prototype.appendAfter = function (element) { 1499 element.parentNode.insertBefore(this, element.nextSibling); 1500 }, false; 1501 1502 /** 1503 * Get the number of days between two dates. 1504 */ 1505 function days_between(date1, date2) { 1506 // The number of milliseconds in one day 1507 var ONE_DAY = 1000 * 60 * 60 * 24; 1508 1509 // Convert both dates to milliseconds 1510 var date1_ms = date1.getTime(); 1511 var date2_ms = date2.getTime(); 1512 1513 // Calculate the difference in milliseconds 1514 var difference_ms = Math.abs(date1_ms - date2_ms); 1515 1516 // Convert back to days and return 1517 return Math.round(difference_ms / ONE_DAY) + 1; 1518 } 1519 1520 // A list of all the links 1521 var emblContentHubLinks = document.querySelectorAll("[data-embl-js-content-hub-loader]"); 1522 var emblContentHubLinkLoadingProgress = {}; 1523 var emblContentHubShowTimers = false; 1524 1525 // Handle the import of each element 1526 for (var i = 0; i < emblContentHubLinks.length; ++i) { 1527 (function () { 1528 var linkPosition = i; 1529 1530 // track time it takes for link to be shown 1531 if (emblContentHubShowTimers) { 1532 console.time("timer for import " + linkPosition); 1533 } 1534 1535 // await the load of the html import from the polyfill 1536 // note: we use polyfill in all cases; see https://github.com/visual-framework/vf-core/issues/508 1537 emblContentHubAwaitLoading(emblContentHubLinks[linkPosition], linkPosition); 1538 })(); 1539 } 1540 1541 // If nothing to import 1542 if (emblContentHubLinks.length == 0) { 1543 emblContentHubSignalFinished(); 1544 } 1545 1546 // Add a class to the body once the last item has been processed 1547 function emblContentHubSignalFinished() { 1548 // @todo, shouldn't require the body element 1549 document.querySelectorAll("body")[0].classList.add("embl-content-hub-loaded"); 1550 1551 // if the JS to run embl-conditional-edit is present, run it now 1552 if (typeof emblConditionalEdit === "function") { 1553 emblConditionalEdit(); 1554 } 1555 1556 // if the JS to run embl-notifications is present, run it now 1557 if (typeof emblNotifications === "function") { 1558 emblNotifications(); 1559 } 1560 } 1561 1562 // Dispatch load to the pollyfill 1563 function emblContentHubAwaitLoading(targetLink, position) { 1564 /* global addImport */ 1565 // Docs: https://github.com/AshleyScirra/html-imports-polyfill#usage 1566 addImport(targetLink.href, null, emblContentHubLinkLoadingProgress).then(function (value) { 1567 emblContentHubGrabTheContent(targetLink, position, value); 1568 if (position + 1 == emblContentHubLinks.length) { 1569 emblContentHubSignalFinished(); 1570 } 1571 }); 1572 } 1573 1574 // Generate a unique ID for the target element on the page 1575 function emblContentHubGenerateID(position) { 1576 return "contentDbItem" + ("0000" + position).slice(-5); 1577 } 1578 1579 // Show the remote content 1580 function emblContentHubGrabTheContent(targetLink, position, exportedContent) { 1581 // pickup the "meat" of the exported content 1582 exportedContent = exportedContent || targetLink.import.querySelector(".vf-content-hub-html"); 1583 1584 // make sure we have something 1585 if (!exportedContent) { 1586 console.log("No content found for this import, exiting. The import may have already been preformed.", targetLink); 1587 return; 1588 } 1589 1590 // if there is just one child element and it is a div, use that 1591 // (this helps with css grid layout) 1592 if (exportedContent.childElementCount === 1 && exportedContent.firstElementChild.innerHTML.trimLeft().substr(0, 4) === "<div") { 1593 exportedContent = exportedContent.firstElementChild; 1594 exportedContent.classList.add("vf-content-hub-html"); 1595 exportedContent.classList.add("vf-content-hub-html__derived-div"); 1596 } else if (exportedContent.childNodes.length <= 3) { 1597 // if there are three or fewer child nodes this is likely a no-results reply 1598 // We'll still inject the content from the contentHub along with any passed "no matches" text 1599 var noContentMessage = targetLink.getAttribute("data-embl-js-content-hub-loader-no-content");
1600 if (noContentMessage !== "null") { 1601 if (noContentMessage == "true") { 1602 // use a default 1603 noContentMessage = "No content was found found for this query."; 1604 } 1605 var noContentMessageElement = document.createElement("div"); 1606 noContentMessageElement.classList.add("vf-text"); 1607 noContentMessageElement.classList.add("embl-content-hub-html__no-content-found"); 1608 noContentMessageElement.innerHTML = noContentMessage; 1609 exportedContent.appendChild(noContentMessageElement.firstChild); 1610 } 1611 1612 // if data-embl-js-content-hub-loader-no-content-hide is true or has a class, hide accordingly 1613 var noContentHideBehavior = targetLink.getAttribute("data-embl-js-content-hub-loader-no-content-hide"); 1614 if (noContentHideBehavior) { 1615 if (noContentHideBehavior == "true") { 1616 // if true, just hide the response 1617 exportedContent.classList.add("vf-u-display-none"); 1618 } else { 1619 // otherwise hide any element specified 1620 document.querySelector(noContentHideBehavior).classList.add("vf-u-display-none"); 1621 } 1622 } // END noContentHideBehavior 1623 } // END exportedContent.childElementCount 1624 1625 var contentID = emblContentHubGenerateID(position); 1626 1627 // where does the content go? 1628 if (targetLink.dataset.target === "self") { 1629 // if element already exists, remove it 1630 var oldElement = document.getElementById(contentID); 1631 if (oldElement) { 1632 oldElement.innerHTML = exportedContent.innerHTML; 1633 } else { 1634 // give content an ID 1635 exportedContent.setAttribute("id", contentID); 1636 exportedContent.classList.add(contentID); 1637 // just insert the new content 1638 exportedContent.appendAfter(targetLink); 1639 } // end if oldElement 1640 } else { 1641 var targetLocation = document.querySelector("." + targetLink.dataset.target); 1642 // exportedContent.appendAfter(targetLocation); 1643 targetLocation.classList.add(contentID); 1644 targetLocation.innerHTML = exportedContent.innerHTML; 1645 } 1646 1647 // display how long it took to load 1648 if (emblContentHubShowTimers) { 1649 console.timeEnd("timer for import " + position); 1650 } 1651 emblContentHubAssignClasses(targetLink, position); 1652 emblContentHubUpdateDatesFormat(position); 1653 1654 // run JS for some components on content, if they exist 1655 // note: why do we use "try" here? 1656 // we would use `typeof(vfBanner)` but if the function is not present it becomes aliased as `vfBanner.vfBanner`, 1657 // so this `try` method is more reliable 1658 try { 1659 vfBanner(targetLocation); 1660 } catch (error) { 1661 console.warn("emblContentHubLoader", "vfBanner not found, any contentHub banner-based content will not correctly render."); 1662 } 1663 try { 1664 vfTabs(targetLocation); 1665 } catch (error) { 1666 console.warn("emblContentHubLoader", "vfTabs not found, any contentHub tabs-based content will not correctly render."); 1667 } 1668 // don't run breadcrumbs as part of contenthub, use case is different 1669 // if (typeof(emblBreadcrumbs) === 'function') { 1670 // emblBreadcrumbs(); // no scope for emblBreadcrumbs 1671 // } 1672 } 1673 1674 // Enable class injection after loading contents 1675 // ... for all those edge cases 1676 // Background: https://gitlabci.ebi.ac.uk/emblorg/backlog/issues/82 1677 // Sample: 1678 // <link rel="import" href="url" data-target="self" 1679 // data-inject-class="vf-grid vf-grid__col-2" 1680 // data-inject-class-target="ul" 1681 // data-embl-js-content-hub-loader> 1682 // This would make the ul a two-column grid. 1683 function emblContentHubAssignClasses(targetLink, position) { 1684 // var injectRequests = document.querySelectorAll('[data-inject-class][data-inject-class-target]'); 1685 // 1686 // for (var i = 0; i < injectRequests.length; ++i) { 1687 1688 var classesToInject = targetLink.getAttribute("data-inject-class"); 1689 var targetSelectorToInject = targetLink.getAttribute("data-inject-class-target"); 1690 if (classesToInject && targetSelectorToInject) { 1691 // Limit scope to the imported element 1692 var targetElement = document.querySelector("." + emblContentHubGenerateID(position)).querySelector(target
1692SelectorToInject); 1693 1694 // We can't inject space separated classes to we need to split it into arrays and add one by one. 1695 classesToInject = classesToInject.split(" "); 1696 for (var classNumber = 0; classNumber < classesToInject.length; classNumber++) { 1697 targetElement.classList.add(classesToInject[classNumber]); 1698 } 1699 } 1700 } 1701 1702 /** 1703 * Update the format of close date. 1704 */ 1705 function emblContentHubUpdateDatesFormat(position) { 1706 var dateRemainingList = document.querySelector("." + emblContentHubGenerateID(position)).querySelectorAll(".date-days-remaining"); 1707 var todayDate = new Date(); 1708 if (dateRemainingList.length > 0) { 1709 for (var dateRemainingIndex = 0; dateRemainingIndex < dateRemainingList.length; dateRemainingIndex++) { 1710 var dateValue = parseInt(dateRemainingList[dateRemainingIndex].getAttribute("data-datetime")) * 1000; 1711 dateValue = new Date(dateValue); 1712 var numberOfDiffDays = days_between(dateValue, todayDate); 1713 // Update to 'Closes in 6 Days.' format if number of days is less than 30 days. 1714 if (numberOfDiffDays < 30 && numberOfDiffDays > 1) { 1715 dateRemainingList[dateRemainingIndex].innerHTML = "Closes in " + "<span>" + numberOfDiffDays + " Days.</span>"; 1716 } 1717 if (numberOfDiffDays == 1) { 1718 dateRemainingList[dateRemainingIndex].innerHTML = "Closes in " + "<span>" + numberOfDiffDays + " Day.</span>"; 1719 } 1720 } 1721 } 1722 } 1723} 1724 1725// embl-content-hub-loader 1726 1727function emblContentHub() { 1728 // 1. make sure we have imports or a polyfill 1729 emblContentHubLoaderHtmlImports(); 1730 1731 // 2. import the content 1732 emblContentHubFetch(); 1733} 1734!function (e) { 1735 var t = {}; 1736 function r(n) { 1737 if (t[n]) return t[n].exports; 1738 var o = t[n] = { 1739 i: n, 1740 l: !1, 1741 exports: {} 1742 }; 1743 return e[n].call(o.exports, o, o.exports, r), o.l = !0, o.exports; 1744 } 1745 r.m = e, r.c = t, r.d = function (e, t, n) { 1746 r.o(e, t) || Object.defineProperty(e, t, { 1747 configurable: !1, 1748 enumerable: !0, 1749 get: n 1750 }); 1751 }, r.r = function (e) { 1752 Object.defineProperty(e, "__esModule", { 1753 value: !0 1754 }); 1755 }, r.n = function (e) { 1756 var t = e && e.__esModule ? function () { 1757 return e.default; 1758 } : function () { 1759 return e; 1760 }; 1761 return r.d(t, "a", t), t; 1762 }, r.o = function (e, t) { 1763 return Object.prototype.hasOwnProperty.call(e, t); 1764 }, r.p = "", r(r.s = 46); 1765}([function (e, t, r) { 1766 "use strict"; 1767 1768 Object.defineProperty(t, "__esModule", { 1769 value: !0 1770 }); 1771 var n = function () { 1772 function e(e, t) { 1773 for (var r = 0; r < t.length; r++) { 1774 var n = t[r]; 1775 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 1776 } 1777 } 1778 return function (t, r, n) { 1779 return r && e(t.prototype, r), n && e(t, n), t; 1780 }; 1781 }(); 1782 var o = function () { 1783 function e(t, r, n) { 1784 var o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null; 1785 !function (e, t) { 1786 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 1787 }(this, e), this.group = (t || "").trim().toLowerCase(), this.name = (r || "default").trim(), this.controls = n || [], this.deepLinkParams = [], o && o.has(this.group) && (this.deepLinkParams = o.get(this.group) || []); 1788 } 1789 return n(e, [{ 1790 key: "addControl", 1791 value: function value(e) { 1792 e && e.name === this.name && e.group === this.group && this.controls.push(e); 1793 } 1794 }, { 1795 key: "getDeepLink", 1796 value: function value() { 1797 return ""; 1798 } 1799 }]), e; 1800 }(); 1801 t.default = o; 1802}, function (e, t, r) { 1803 "use strict"; 1804 1805 Object.defineProperty(t, "__esModule", { 1806 value: !0 1807 }); 1808 t.default = function e(t) { 1809 !function (e, t) { 1810 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 1811 }(this, e), t && (this.element = t, this.element.initialHTML = t.outerHTML, this.type = (t.getAttribute("data-jplist-control") || "").trim().toLowerCase(), this.group = (t.getAttribute("data-group") || "").trim().toLowerCase(), this.name = (t.getAttribute("data-name") || t.getAttribute("name") || "default").trim(), this.id = (t.getAttribute("data-id") || "").trim().toLowerCase(), this.jump = (t.getAttribute("data-jump") || "").trim()); 1812 }; 1813}, function (e, t, r) { 1814 "use strict"; 1815 1816 Object.defineProperty(t, "__esModule", { 1817 value: !0 1818 }); 1819 var n = function () { 1820 function e(e, t) { 1821 for (var r = 0; r < t.length; r++) { 1822 var n = t[r]; 1823 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 1824 } 1825 } 1826 return function (t, r, n) { 1827 return r && e(t.prototype, r), n && e(t, n), t; 1828 }; 1829 }(), 1830 o = a(r(0)), 1831 i = a(r(8)); 1832 function a(e) {
1833 return e && e.__esModule ? e : { 1834 default: e 1835 }; 1836 } 1837 var l = function (e) { 1838 function t() { 1839 return function (e, t) { 1840 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 1841 }(this, t), function (e, t) { 1842 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 1843 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 1844 }(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments)); 1845 } 1846 return function (e, t) { 1847 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 1848 e.prototype = Object.create(t && t.prototype, { 1849 constructor: { 1850 value: e, 1851 enumerable: !1, 1852 writable: !0, 1853 configurable: !0 1854 } 1855 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 1856 }(t, o.default), n(t, [{ 1857 key: "getSortOptions", 1858 value: function value() { 1859 var e = [], 1860 t = !0, 1861 r = !1, 1862 n = void 0; 1863 try { 1864 for (var o, i = this.controls[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 1865 var a = o.value; 1866 e = e.concat(a.getSortOptions()); 1867 } 1868 } catch (e) { 1869 r = !0, n = e; 1870 } finally { 1871 try { 1872 !t && i.return && i.return(); 1873 } finally { 1874 if (r) throw n; 1875 } 1876 } 1877 return e; 1878 } 1879 }, { 1880 key: "addControl", 1881 value: function value(e) { 1882 if (e.name !== this.name || e.group !== this.group) return null; 1883 var t = new i.default(e.element); 1884 return this.controls.push(t), t; 1885 } 1886 }]), t; 1887 }(); 1888 t.default = l; 1889}, function (e, t, r) { 1890 "use strict"; 1891 1892 Object.defineProperty(t, "__esModule", { 1893 value: !0 1894 }); 1895 var n = function () { 1896 function e(e, t) { 1897 for (var r = 0; r < t.length; r++) { 1898 var n = t[r]; 1899 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 1900 } 1901 } 1902 return function (t, r, n) { 1903 return r && e(t.prototype, r), n && e(t, n), t; 1904 }; 1905 }(), 1906 o = a(r(0)), 1907 i = a(r(4)); 1908 function a(e) { 1909 return e && e.__esModule ? e : { 1910 default: e 1911 }; 1912 } 1913 var l = function (e) { 1914 function t() { 1915 return function (e, t) { 1916 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 1917 }(this, t), function (e, t) { 1918 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 1919 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 1920 }(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments)); 1921 } 1922 return function (e, t) { 1923 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 1924 e.prototype = Object.create(t && t.prototype, { 1925 constructor: { 1926 value: e, 1927 enumerable: !1, 1928 writable: !0, 1929 configurable: !0 1930 } 1931 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 1932 }(t, o.default), n(t, [{ 1933 key: "addControl", 1934 value: function value(e) { 1935 if (e.name !== this.name || e.group !== this.group) return null; 1936 var t = new i.default(e.element); 1937 return this.controls.push(t), t; 1938 } 1939 }, { 1940 key: "getPathFilterOptions", 1941 value: function value() { 1942 var e = [], 1943 t = !0, 1944 r = !1, 1945 n = void 0; 1946 try { 1947 for (var o, i = this.controls[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 1948 var a = o.value; 1949 e = e.concat(a.getPathFilterOptions()); 1950 } 1951 } catch (e) { 1952 r = !0, n = e; 1953 } finally { 1954 try { 1955 !t && i.return && i.return(); 1956 } finally { 1957 if (r) throw n; 1958 } 1959 } 1960 return e; 1961 } 1962 }]), t; 1963 }(); 1964 t.default = l; 1965}, function (e, t, r) { 1966 "use strict"; 1967 1968 Object.defineProperty(t, "__esModule", { 1969 value: !0 1970 }); 1971 var n, 1972 o = function () { 1973 function e(e, t) { 1974 for (var r = 0; r < t.length; r++) { 1975 var n = t[r]; 1976 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 1977 } 1978 } 1979 return function (t, r, n) { 1980 return r && e(t.prototype, r), n && e(t, n), t; 1981 }; 1982 }(), 1983 i = r(1), 1984 a = (n = i) && n.__esModule ? n : { 1985 default: n 1986 }; 1987 var l = function (e) { 1988 function t(e) { 1989 !function (e, t) { 1990 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 1991 }(this, t); 1992 var r = function (e, t) { 1993 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 1994 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 1995 }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e)); 1996 return e && (r.path = (e.getAttribute("data-path") || "").trim(), r.isInverted = "true" === (e.getAttribute("data-inverted") || "").toLowerCase().trim(), r.or = e.getAttribute("data-or") || null), r; 1997 } 1998 return function (e, t) { 1999 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 2000 e.prototype = Object.create(t && t.prototype, { 2001 constructor: { 2002 value: e, 2003 enumerable: !1, 2004 writable: !0, 2005 configurable: !0 2006 } 2007 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 2008 }(t, a.default), o(t, [{ 2009 key: "getPathFilterOptions", 2010 value: function value() { 2011 return { 2012 path: this.path, 2013 isInverted: this.isInverted, 2014 or: this.or 2015 }; 2016 } 2017 }, {
2018 key: "isEqualTo", 2019 value: function value(e) { 2020 return this.path === e.path && this.isInverted === e.isInverted; 2021 } 2022 }]), t; 2023 }(); 2024 t.default = l; 2025}, function (e, t, r) { 2026 "use strict"; 2027 2028 Object.defineProperty(t, "__esModule", { 2029 value: !0 2030 }); 2031 var n = function () { 2032 function e(e, t) { 2033 for (var r = 0; r < t.length; r++) { 2034 var n = t[r]; 2035 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 2036 } 2037 } 2038 return function (t, r, n) { 2039 return r && e(t.prototype, r), n && e(t, n), t; 2040 }; 2041 }(), 2042 o = a(r(0)), 2043 i = a(r(13)); 2044 function a(e) { 2045 return e && e.__esModule ? e : { 2046 default: e 2047 }; 2048 } 2049 var l = function (e) { 2050 function t() { 2051 return function (e, t) { 2052 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 2053 }(this, t), function (e, t) { 2054 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 2055 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 2056 }(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments)); 2057 } 2058 return function (e, t) { 2059 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 2060 e.prototype = Object.create(t && t.prototype, { 2061 constructor: { 2062 value: e, 2063 enumerable: !1, 2064 writable: !0, 2065 configurable: !0 2066 } 2067 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 2068 }(t, o.default), n(t, [{ 2069 key: "getTextFilterOptions", 2070 value: function value() { 2071 var e = [], 2072 t = !0, 2073 r = !1, 2074 n = void 0; 2075 try { 2076 for (var o, i = this.controls[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 2077 var a = o.value; 2078 e = e.concat(a.getTextFilterOptions()); 2079 } 2080 } catch (e) { 2081 r = !0, n = e; 2082 } finally { 2083 try { 2084 !t && i.return && i.return(); 2085 } finally { 2086 if (r) throw n; 2087 } 2088 } 2089 return e; 2090 } 2091 }, { 2092 key: "addControl", 2093 value: function value(e) { 2094 if (e.name !== this.name || e.group !== this.group) return null; 2095 var t = new i.default(e.element); 2096 return this.controls.push(t), t; 2097 } 2098 }, { 2099 key: "getDeepLink", 2100 value: function value() { 2101 var e = this.controls.map(function (e) { 2102 return e.id && "" !== e.text.trim() ? e.id + "=" + e.text.trim() : ""; 2103 }).filter(function (e) { 2104 return "" !== e; 2105 }); 2106 return Array.from(new Set(e)).join("&"); 2107 } 2108 }]), t; 2109 }(); 2110 t.default = l; 2111}, function (e, t, r) { 2112 "use strict"; 2113 2114 Object.defineProperty(t, "__esModule", { 2115 value: !0 2116 }); 2117 var n = function () { 2118 function e(e, t) { 2119 for (var r = 0; r < t.length; r++) { 2120 var n = t[r]; 2121 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 2122 } 2123 } 2124 return function (t, r, n) { 2125 return r && e(t.prototype, r), n && e(t, n), t; 2126 }; 2127 }(); 2128 r(53); 2129 var o = function () { 2130 function e(t) { 2131 if (function (e, t) { 2132 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 2133 }(this, e), t) { 2134 if (this.element = t, !this.element) return; 2135 this.panels = this.element.querySelectorAll('[data-type="panel"]'), this.element.openedClass = (this.element.getAttribute("data-opened-class") || "jplist-dd-opened").trim(); 2136 var r = !0, 2137 n = !1, 2138 o = void 0; 2139 try { 2140 for (var i, a = this.panels[Symbol.iterator](); !(r = (i = a.next()).done); r = !0) { 2141 var l = i.value; 2142 l.initialContent = l.innerHTML, l.element = t; 2143 } 2144 } catch (e) { 2145 n = !0, o = e; 2146 } finally { 2147 try { 2148 !r && a.return && a.return(); 2149 } finally { 2150 if (n) throw o; 2151 } 2152 } 2153 this.contents = this.element.querySelectorAll('[data-type="content"]'), this.handlePanelsClick(); 2154 } 2155 } 2156 return n(e, [{ 2157 key: "handlePanelsClick", 2158 value: function value() { 2159 var e = this; 2160 if (this.panels && !(this.panels.length <= 0)) { 2161 var t = !0, 2162 r = !1, 2163 n = void 0; 2164 try { 2165 for (var o, i = function i() { 2166 var t = o.value; 2167 t.addEventListener("click", function (r) { 2168 var n = !1, 2169 o = !0, 2170 i = !1, 2171 a = void 0; 2172 try { 2173 for (var l, u = e.contents[Symbol.iterator](); !(o = (l = u.next()).done); o = !0) { 2174 var s = l.value; 2175 s.classList.toggle(t.element.openedClass), s.classList.contains(t.element.openedClass) && (n = !0); 2176 } 2177 } catch (e) { 2178 i = !0, a = e; 2179 } finally { 2180 try { 2181 !o && u.return && u.return(); 2182 } finally { 2183 if (i) throw a; 2184 } 2185 } 2186 n ? (t.classList.add(t.element.openedClass), t.element.classList.add(t.element.openedClass)) : (t.classList.remove(t.element.openedClass), t.element.classList.remove(t.element.openedClass)); 2187 }); 2188 }, a = this.panels[Symbol.iterator](); !(t = (o = a.next()).done); t = !0) i(); 2189 } catch (e) { 2190 r = !0, n = e; 2191 } finally { 2192 try { 2193 !t && a.return && a.return(); 2194 } finally { 2195 if (r) throw n; 2196 } 2197 } 2198 document.addEventListener("click", function (t) { 2199 e.element.contains(t.target) || e.close(); 2200 }); 2201 } 2202 } 2203 }, {
2204 key: "setPanelsContent", 2205 value: function value(e) { 2206 var t = !0, 2207 r = !1, 2208 n = void 0; 2209 try { 2210 for (var o, i = this.panels[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 2211 o.value.innerHTML = e; 2212 } 2213 } catch (e) { 2214 r = !0, n = e; 2215 } finally { 2216 try { 2217 !t && i.return && i.return(); 2218 } finally { 2219 if (r) throw n; 2220 } 2221 } 2222 } 2223 }, { 2224 key: "restorePanelsContent", 2225 value: function value() { 2226 var e = !0, 2227 t = !1, 2228 r = void 0; 2229 try { 2230 for (var n, o = this.panels[Symbol.iterator](); !(e = (n = o.next()).done); e = !0) { 2231 var i = n.value; 2232 i.initialContent && (i.innerHTML = i.initialContent); 2233 } 2234 } catch (e) { 2235 t = !0, r = e; 2236 } finally { 2237 try { 2238 !e && o.return && o.return(); 2239 } finally { 2240 if (t) throw r; 2241 } 2242 } 2243 } 2244 }, { 2245 key: "close", 2246 value: function value() { 2247 var e = !0, 2248 t = !1, 2249 r = void 0; 2250 try { 2251 for (var n, o = this.contents[Symbol.iterator](); !(e = (n = o.next()).done); e = !0) { 2252 n.value.classList.remove(this.panels[0].element.openedClass); 2253 } 2254 } catch (e) { 2255 t = !0, r = e; 2256 } finally { 2257 try { 2258 !e && o.return && o.return(); 2259 } finally { 2260 if (t) throw r; 2261 } 2262 } 2263 var i = !0, 2264 a = !1, 2265 l = void 0; 2266 try { 2267 for (var u, s = this.panels[Symbol.iterator](); !(i = (u = s.next()).done); i = !0) { 2268 var c = u.value; 2269 c.classList.remove(c.element.openedClass), c.element.classList.remove(c.element.openedClass); 2270 } 2271 } catch (e) { 2272 a = !0, l = e; 2273 } finally { 2274 try { 2275 !i && s.return && s.return(); 2276 } finally { 2277 if (a) throw l; 2278 } 2279 } 2280 } 2281 }]), e; 2282 }(); 2283 t.default = o; 2284}, function (e, t, r) { 2285 "use strict"; 2286 2287 Object.defineProperty(t, "__esModule", { 2288 value: !0 2289 }); 2290 var n = function () { 2291 function e(e, t) { 2292 for (var r = 0; r < t.length; r++) { 2293 var n = t[r]; 2294 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 2295 } 2296 } 2297 return function (t, r, n) { 2298 return r && e(t.prototype, r), n && e(t, n), t; 2299 }; 2300 }(); 2301 t.default = function (e) { 2302 return function (t) { 2303 function r(e, t) { 2304 var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], 2305 o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null; 2306 !function (e, t) { 2307 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 2308 }(this, r); 2309 var i = function (e, t) { 2310 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 2311 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 2312 }(this, (r.__proto__ || Object.getPrototypeOf(r)).call(this, e, t, n, o)); 2313 return i.group = e, i.name = t, i.checkboxes = [], i.radios = [], i; 2314 } 2315 return function (e, t) { 2316 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 2317 e.prototype = Object.create(t && t.prototype, { 2318 constructor: { 2319 value: e, 2320 enumerable: !1, 2321 writable: !0, 2322 configurable: !0 2323 } 2324 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 2325 }(r, e), n(r, [{ 2326 key: "addControl", 2327 value: function value(e) { 2328 var t = this, 2329 n = function e(t, r, n) { 2330 null === t && (t = Function.prototype); 2331 var o = Object.getOwnPropertyDescriptor(t, r); 2332 if (void 0 === o) { 2333 var i = Object.getPrototypeOf(t); 2334 return null === i ? void 0 : e(i, r, n); 2335 } 2336 if ("value" in o) return o.value; 2337 var a = o.get; 2338 return void 0 !== a ? a.call(n) : void 0; 2339 }(r.prototype.__proto__ || Object.getPrototypeOf(r.prototype), "addControl", this).call(this, e); 2340 if (n.selected = "true" === n.element.getAttribute("data-selected"), n.mode = n.element.getAttribute("data-mode") || "radio", n.id) { 2341 var o = this.deepLinkParams.find(function (e) { 2342 return e.key === n.id; 2343 }); 2344 o && (n.selected = "1" === o.value); 2345 } 2346 "radio" === n.mode && (this.radios.push(n), this.handleRadios()), "checkbox" === n.mode && (this.checkboxes.push(n), this.handleCheckboxes()), n.element.addEventListener("click", function (e) { 2347 if (e.preventDefault(), "checkbox" === n.mode && (n.selected = !n.selected, t.checkboxes.forEac
2347h(function (e) { 2348 e.isEqualTo(n) && (e.selected = n.selected); 2349 }), t.handleCheckboxes()), "radio" === n.mode) { 2350 var r = !0, 2351 o = !1, 2352 i = void 0; 2353 try { 2354 for (var a, l = t.radios[Symbol.iterator](); !(r = (a = l.next()).done); r = !0) a.value.selected = !1; 2355 } catch (e) { 2356 o = !0, i = e; 2357 } finally { 2358 try { 2359 !r && l.return && l.return(); 2360 } finally { 2361 if (o) throw i; 2362 } 2363 } 2364 n.selected = !0, t.handleRadios(); 2365 } 2366 window.jplist && window.jplist.refresh(t.group, n); 2367 }); 2368 } 2369 }, { 2370 key: "handleCheckboxes", 2371 value: function value() { 2372 var e = !0, 2373 t = !1, 2374 r = void 0; 2375 try { 2376 for (var n, o = this.checkboxes[Symbol.iterator](); !(e = (n = o.next()).done); e = !0) { 2377 var i = n.value; 2378 i.selected ? i.element.classList.add("jplist-selected") : i.element.classList.remove("jplist-selected"), i.element.checked = i.selected; 2379 } 2380 } catch (e) { 2381 t = !0, r = e; 2382 } finally { 2383 try { 2384 !e && o.return && o.return(); 2385 } finally { 2386 if (t) throw r; 2387 } 2388 } 2389 } 2390 }, { 2391 key: "getLastSelectedRadio", 2392 value: function value() { 2393 var e = null, 2394 t = !0, 2395 r = !1, 2396 n = void 0; 2397 try { 2398 for (var o, i = this.radios[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 2399 var a = o.value; 2400 a.selected && (e = a); 2401 } 2402 } catch (e) { 2403 r = !0, n = e; 2404 } finally { 2405 try { 2406 !t && i.return && i.return(); 2407 } finally { 2408 if (r) throw n; 2409 } 2410 } 2411 return e; 2412 } 2413 }, { 2414 key: "handleRadios", 2415 value: function value() { 2416 if (this.radios.length > 0) { 2417 var e = this.getLastSelectedRadio(), 2418 t = !0, 2419 r = !1, 2420 n = void 0; 2421 try { 2422 for (var o, i = this.radios[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 2423 var a = o.value; 2424 a.selected = !1, a.element.classList.remove("jplist-selected"); 2425 } 2426 } catch (e) { 2427 r = !0, n = e; 2428 } finally { 2429 try { 2430 !t && i.return && i.return(); 2431 } finally { 2432 if (r) throw n; 2433 } 2434 } 2435 e && this.radios.forEach(function (t) { 2436 t.isEqualTo(e) && (t.selected = !0, t.element.checked = !0, t.element.classList.add("jplist-selected")); 2437 }); 2438 } 2439 } 2440 }, { 2441 key: "getDeepLink", 2442 value: function value() { 2443 var e = this.checkboxes.map(function (e) { 2444 return e.id ? e.selected ? e.id + "=1" : e.id + "=0" : ""; 2445 }).filter(function (e) { 2446 return "" !== e; 2447 }), 2448 t = this.radios.map(function (e) { 2449 return e.id && e.selected ? e.id + "=1" : ""; 2450 }).filter(function (e) { 2451 return "" !== e; 2452 }), 2453 r = e.concat(t); 2454 return Array.from(new Set(r)).join("&"); 2455 } 2456 }]), r; 2457 }(); 2458 }; 2459}, function (e, t, r) { 2460 "use strict"; 2461 2462 Object.defineProperty(t, "__esModule", { 2463 value: !0 2464 }); 2465 var n, 2466 o = function () { 2467 function e(e, t) { 2468 for (var r = 0; r < t.length; r++) { 2469 var n = t[r]; 2470 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 2471 } 2472 } 2473 return function (t, r, n) { 2474 return r && e(t.prototype, r), n && e(t, n), t; 2475 }; 2476 }(), 2477 i = r(1), 2478 a = (n = i) && n.__esModule ? n : { 2479 default: n 2480 }; 2481 var l = function (e) { 2482 function t(e) { 2483 !function (e, t) { 2484 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 2485 }(this, t); 2486 var r = function (e, t) { 2487 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 2488 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 2489 }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e)); 2490 if (e) { 2491 r.path = (e.getAttribute("data-path") || "").trim(), r.dataType = (e.getAttribute("data-type") || "text").trim().toLowerCase(), r.order = (e.getAttribute("data-order") || "asc").trim().toLowerCase(), r.regex = e.getAttribute("data-regex") || "", r.dateTimeFormat = (e.getAttribute("data-date-format") || "").trim().toLowerCase(), r.multipleSortsNumber = r.getMultipleSortsNumber(e); 2492 for (var n = 1; n <= r.multipleSortsNumber; n++) r["path" + n] = (e.getAttribute("data-path-" + n) || "").trim(), r["dataType" + n] = (e.getAttribute("data-type-" + n) || "text").trim().toLowerCase(), r["order" + n] = (e.getAttribute("data-order-" + n) || "asc").trim().toLowerCase(), r["regex" + n] = e.getAttribute("data-regex-"
2492+ n) || "", r["dateTimeFormat" + n] = (e.getAttribute("data-date-format-" + n) || "").trim().toLowerCase(); 2493 } 2494 return r; 2495 } 2496 return function (e, t) { 2497 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 2498 e.prototype = Object.create(t && t.prototype, { 2499 constructor: { 2500 value: e, 2501 enumerable: !1, 2502 writable: !0, 2503 configurable: !0 2504 } 2505 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 2506 }(t, a.default), o(t, [{ 2507 key: "getMultipleSortsNumber", 2508 value: function value(e) { 2509 var t = 0, 2510 r = !0, 2511 n = !1, 2512 o = void 0; 2513 try { 2514 for (var i, a = e.attributes[Symbol.iterator](); !(r = (i = a.next()).done); r = !0) for (var l = i.value, u = null, s = /^data-path-([0-9]+)$/g; u = s.exec(l.nodeName);) { 2515 var c = Number(u[1]); 2516 Number.isInteger(c) && t++; 2517 } 2518 } catch (e) { 2519 n = !0, o = e; 2520 } finally { 2521 try { 2522 !r && a.return && a.return(); 2523 } finally { 2524 if (n) throw o; 2525 } 2526 } 2527 return t; 2528 } 2529 }, { 2530 key: "getSortOptions", 2531 value: function value() { 2532 var e = []; 2533 if (this.path) { 2534 e.push({ 2535 path: this.path, 2536 dataType: this.dataType, 2537 order: this.order, 2538 ignoreRegex: this.ignoreRegex, 2539 dateTimeFormat: this.dateTimeFormat 2540 }); 2541 for (var t = 1; t <= this.multipleSortsNumber; t++) e.push({ 2542 path: this["path" + t], 2543 dataType: this["dataType" + t], 2544 order: this["order" + t], 2545 ignoreRegex: this["ignoreRegex" + t], 2546 dateTimeFormat: this["dateTimeFormat" + t] 2547 }); 2548 } 2549 return e; 2550 } 2551 }, { 2552 key: "isEqualTo", 2553 value: function value(e) { 2554 for (var t = !0, r = ["path", "dataType", "order", "regex", "dateTimeFormat"], n = 0; n < r.length; n++) t = t && this[r[n]] === e[r[n]]; 2555 t = t && this.multipleSortsNumber === e.multipleSortsNumber; 2556 for (var o = 1; o <= this.multipleSortsNumber; o++) for (var i = 0; i < r.length; i++) t = t && this[r[i] + o] === e[r[i] + o]; 2557 return t; 2558 } 2559 }]), t; 2560 }(); 2561 t.default = l; 2562}, function (e, t, r) { 2563 "use strict"; 2564 2565 Object.defineProperty(t, "__esModule", { 2566 value: !0 2567 }); 2568 var n, 2569 o = function () { 2570 function e(e, t) { 2571 for (var r = 0; r < t.length; r++) { 2572 var n = t[r]; 2573 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 2574 } 2575 } 2576 return function (t, r, n) { 2577 return r && e(t.prototype, r), n && e(t, n), t; 2578 }; 2579 }(), 2580 i = r(1), 2581 a = (n = i) && n.__esModule ? n : { 2582 default: n 2583 }; 2584 var l = function (e) { 2585 function t(e) { 2586 !function (e, t) { 2587 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 2588 }(this, t); 2589 var r = function (e, t) { 2590 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 2591 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 2592 }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e)); 2593 if (e) { 2594 r.path = (e.getAttribute("data-path") || "").trim(); 2595 var n = e.getAttribute("data-from"); 2596 r.from = null === n ? -1 / 0 : Number(n), isNaN(r.from) && (r.from = -1 / 0); 2597 var o = e.getAttribute("data-to"); 2598 r.to = null === o ? 1 / 0 : Number(o), isNaN(r.to) && (r.to = 1 / 0); 2599 var i = e.getAttribute("data-min"); 2600 r.min = null === i ? r.from : Number(i), isNaN(r.min) && (r.min = r.from); 2601 var a = e.getAttribute("data-max"); 2602 r.max = null === a ? r.to : Number(a), isNaN(r.max) && (r.max = r.to), r.or = e.getAttribute("data-or") || null; 2603 } 2604 return r; 2605 } 2606 return function (e, t) { 2607 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 2608 e.prototype = Object.create(t && t.prototype, { 2609 constructor: { 2610 value: e, 2611 enumerable: !1, 2612 writable: !0, 2613 configurable: !0 2614 } 2615 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 2616 }(t, a.default), o(t, [{ 2617 key: "getRangeFilterOptions", 2618 value: function value() { 2619 return { 2620 path: this.path, 2621 min: this.min, 2622 from: this.from, 2623 to: this.to, 2624 max: this.max, 2625 or: this.or 2626 }; 2627 } 2628 }, {
2629 key: "isEqualTo", 2630 value: function value(e) { 2631 return this.path === e.path && this.from === e.from && this.to === e.to && this.min === e.min && this.max === e.max; 2632 } 2633 }]), t; 2634 }(); 2635 t.default = l; 2636}, function (e, t, r) { 2637 "use strict"; 2638 2639 Object.defineProperty(t, "__esModule", { 2640 value: !0 2641 }); 2642 var n = function () { 2643 function e(e, t) { 2644 for (var r = 0; r < t.length; r++) { 2645 var n = t[r]; 2646 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 2647 } 2648 } 2649 return function (t, r, n) { 2650 return r && e(t.prototype, r), n && e(t, n), t; 2651 }; 2652 }(), 2653 o = a(r(0)), 2654 i = a(r(9)); 2655 function a(e) { 2656 return e && e.__esModule ? e : { 2657 default: e 2658 }; 2659 } 2660 var l = function (e) { 2661 function t() { 2662 return function (e, t) { 2663 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 2664 }(this, t), function (e, t) { 2665 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 2666 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 2667 }(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments)); 2668 } 2669 return function (e, t) { 2670 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 2671 e.prototype = Object.create(t && t.prototype, { 2672 constructor: { 2673 value: e, 2674 enumerable: !1, 2675 writable: !0, 2676 configurable: !0 2677 } 2678 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 2679 }(t, o.default), n(t, [{ 2680 key: "addControl", 2681 value: function value(e) { 2682 if (e.name !== this.name || e.group !== this.group) return null; 2683 var t = new i.default(e.element); 2684 return this.controls.push(t), t; 2685 } 2686 }, { 2687 key: "getRangeFilterOptions", 2688 value: function value() { 2689 var e = [], 2690 t = !0, 2691 r = !1, 2692 n = void 0; 2693 try { 2694 for (var o, i = this.controls[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 2695 var a = o.value; 2696 e = e.concat(a.getRangeFilterOptions()); 2697 } 2698 } catch (e) { 2699 r = !0, n = e; 2700 } finally { 2701 try { 2702 !t && i.return && i.return(); 2703 } finally { 2704 if (r) throw n; 2705 } 2706 } 2707 return e; 2708 } 2709 }]), t; 2710 }(); 2711 t.default = l; 2712}, function (e, t, r) { 2713 "use strict"; 2714 2715 Object.defineProperty(t, "__esModule", { 2716 value: !0 2717 }); 2718 var n = function () { 2719 function e(e, t) { 2720 for (var r = 0; r < t.length; r++) { 2721 var n = t[r]; 2722 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 2723 } 2724 } 2725 return function (t, r, n) { 2726 return r && e(t.prototype, r), n && e(t, n), t; 2727 }; 2728 }(); 2729 t.default = function (e) { 2730 return function (t) { 2731 function r(e, t) { 2732 var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], 2733 o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null; 2734 !function (e, t) { 2735 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 2736 }(this, r); 2737 var i = function (e, t) { 2738 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 2739 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 2740 }(this, (r.__proto__ || Object.getPrototypeOf(r)).call(this, e, t, n, o)); 2741 return i.group = e, i.name = t, i.radios = [], i; 2742 } 2743 return function (e, t) { 2744 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 2745 e.prototype = Object.create(t && t.prototype, { 2746 constructor: { 2747 value: e, 2748 enumerable: !1, 2749 writable: !0, 2750 configurable: !0 2751 } 2752 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 2753 }(r, e), n(r, [{ 2754 key: "addControl", 2755 value: function value(e) { 2756 var t = this, 2757 n = function e(t, r, n) { 2758 null === t && (t = Function.prototype); 2759 var o = Object.getOwnPropertyDescriptor(t, r); 2760 if (void 0 === o) { 2761 var i = Object.getPrototypeOf(t); 2762 return null === i ? void 0 : e(i, r, n); 2763 } 2764 if ("value" in o) return o.value; 2765 var a = o.get; 2766 return void 0 !== a ? a.call(n) : void 0; 2767 }(r.prototype.__proto__ || Object.getPrototypeOf(r.prototype), "addControl", this).call(this, e); 2768 if (n.selected = n.element.checked, n.id) { 2769 var o = this.deepLinkParams.find(function (e) { 2770 return e.key === n.id; 2771 }); 2772 o && (n.selected = "1" === o.value); 2773 } 2774 this.radios.push(n), this.handleRadios(), n.element.addEventListener("change", function (e) { 2775 e.preventDefault(); 2776 var r = !0, 2777 o = !1, 2778 i = void 0; 2779 try { 2780 for (var a, l = t.radios[Symbol.iterator](); !(r = (a = l.next()).done); r = !0) a.value.selected = !1; 2781 } catch (e) { 2782 o = !0, i = e; 2783 } finally { 2784 try { 2785 !r && l.return && l.return(); 2786 } finally { 2787 if (o) throw i; 2788 } 2789 } 2790 n.selected = !0, t.handleRadios(), window.jplist && window.jplist.refresh(t.group, n); 2791 }); 2792 } 2793 }, { 2794 key: "getLastSelectedRadio", 2795 value: function value() { 2796 var e = null, 2797 t = !0, 2798 r = !1, 2799 n = void 0; 2800 try { 2801 for (var o, i = this.radios[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 2802 var a = o.value; 2803 a.selected && (e = a); 2804 } 2805 } catch (e) { 2806 r = !0, n = e; 2807 } finally { 2808 try { 2809 !t && i.return && i.return(); 2810 } finally { 2811 if (r) throw n; 2812 } 2813 } 2814 return e; 2815 } 2816 }, { 2817 key: "handleRadios", 2818 value: function value() { 2819 if (this.radios.length > 0) { 2820 var e = this.getLastSelectedRadio(), 2821 t = !0, 2822 r = !1, 2823 n = void 0; 2824 try { 2825 for (var o, i = this.radios[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 2826 var a = o.value; 2827 a.selected = !1, a.element.classList.remove("jplist-selected"); 2828 } 2829 } catch (e) { 2830 r = !0, n = e; 2831 } finally { 2832 try { 2833 !t && i.return && i.return(); 2834 } finally { 2835 if (r) throw n; 2836 } 2837 } 2838 e && this.radios.forEach(function (t) { 2839 t.isEqualTo(e) && (t.selected = !0, t.element.checked = !0, t.element.classList.add("jplist-selected")); 2840 }); 2841 } 2842 } 2843 }, { 2844 key: "getDeepLink", 2845 value: function value() { 2846 var e = this.radios.map(function (e) { 2847 return e.id && e.selected ? e.id + "=1" : ""; 2848 }).filter(function (e) { 2849 return "" !== e; 2850 }); 2851 return Array.from(new Set(e)).join("&"); 2852 } 2853 }]), r; 2854 }(); 2855 }; 2856}, function (e, t, r) { 2857 "use strict"; 2858 2859 Object.defineProperty(t, "__esModule", { 2860 value: !0 2861 }); 2862 var n = function () { 2863 function e(e, t) { 2864 for (var r = 0; r < t.length; r++) { 2865 var n = t[r]; 2866 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 2867 } 2868 } 2869 return function (t, r, n) { 2870 return r && e(t.prototype, r), n && e(t, n), t; 2871 }; 2872 }(); 2873 t.default = function (e) { 2874 return function (t) { 2875 function r(e, t) { 2876 var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], 2877 o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null; 2878 !function (e, t) { 2879 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 2880 }(this, r); 2881 var i = function (e, t) { 2882 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 2883 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 2884 }(this, (r.__proto__ || Object.getPrototypeOf(r)).call(this, e, t, n, o)); 2885 return i.group = e, i.name = t, i.checkboxes = [], i; 2886 } 2887 return function (e, t) { 2888 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 2889 e.prototype = Object.create(t && t.prototype, { 2890 constructor: { 2891 value: e, 2892 enumerable: !1, 2893 writable: !0, 2894 configurable: !0 2895 } 2896 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 2897 }(r, e), n(r, [{ 2898 key: "addControl", 2899 value: function value(e) { 2900 var t = this, 2901 n = function e(t, r, n) { 2902 null === t && (t = Function.prototype); 2903 var o = Object.getOwnPropertyDescriptor(t, r); 2904 if (void 0 === o) { 2905 var i = Object.getPrototypeOf(t); 2906 return null === i ? void 0 : e(i, r, n); 2907 } 2908 if ("value" in o) return o.value; 2909 var a = o.get; 2910 return void 0 !== a ? a.call(n) : void 0; 2911 }(r.prototype.__proto__ || Object.getPrototypeOf(r.prototype), "addControl", this).call(this, e); 2912 if (n.selected = n.element.checked, n.id) { 2913 var o = this.deepLinkParams.find(function (e) { 2914 return e.key === n.id; 2915 }); 2916 o && (n.selected = "1" === o.value); 2917 } 2918 this.checkboxes.push(n), this.handleCheckboxes(), n.element.addEventListener("change", function (e) { 2919 e.preventDefault(), n.selected = !n.selected, t.checkboxes.forEac
2919h(function (e) { 2920 e.isEqualTo(n) && (e.selected = n.selected); 2921 }), t.handleCheckboxes(), window.jplist && window.jplist.refresh(t.group, n); 2922 }); 2923 } 2924 }, { 2925 key: "handleCheckboxes", 2926 value: function value() { 2927 var e = !0, 2928 t = !1, 2929 r = void 0; 2930 try { 2931 for (var n, o = this.checkboxes[Symbol.iterator](); !(e = (n = o.next()).done); e = !0) { 2932 var i = n.value; 2933 i.selected ? i.element.classList.add("jplist-selected") : i.element.classList.remove("jplist-selected"), i.element.checked = i.selected; 2934 } 2935 } catch (e) { 2936 t = !0, r = e; 2937 } finally { 2938 try { 2939 !e && o.return && o.return(); 2940 } finally { 2941 if (t) throw r; 2942 } 2943 } 2944 } 2945 }, { 2946 key: "getDeepLink", 2947 value: function value() { 2948 var e = this.checkboxes.map(function (e) { 2949 return e.id ? e.selected ? e.id + "=1" : e.id + "=0" : ""; 2950 }).filter(function (e) { 2951 return "" !== e; 2952 }); 2953 return Array.from(new Set(e)).join("&"); 2954 } 2955 }]), r; 2956 }(); 2957 }; 2958}, function (e, t, r) { 2959 "use strict"; 2960 2961 Object.defineProperty(t, "__esModule", { 2962 value: !0 2963 }); 2964 var n, 2965 o = function () { 2966 function e(e, t) { 2967 for (var r = 0; r < t.length; r++) { 2968 var n = t[r]; 2969 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 2970 } 2971 } 2972 return function (t, r, n) { 2973 return r && e(t.prototype, r), n && e(t, n), t; 2974 }; 2975 }(), 2976 i = r(1), 2977 a = (n = i) && n.__esModule ? n : { 2978 default: n 2979 }; 2980 var l = function (e) { 2981 function t(e) { 2982 !function (e, t) { 2983 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 2984 }(this, t); 2985 var r = function (e, t) { 2986 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 2987 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 2988 }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e)); 2989 return e && (r.path = (e.getAttribute("data-path") || "").trim(), r.initialText = e.getAttribute("data-text") || e.value || "", r._text = (e.getAttribute("data-text") || e.value || "").trim(), r.mode = (e.getAttribute("data-mode") || "contains").trim(), r.regex = e.getAttribute("data-regex") || "", r.or = e.getAttribute("data-or") || null), r; 2990 } 2991 return function (e, t) { 2992 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 2993 e.prototype = Object.create(t && t.prototype, { 2994 constructor: { 2995 value: e, 2996 enumerable: !1, 2997 writable: !0, 2998 configurable: !0 2999 } 3000 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 3001 }(t, a.default), o(t, [{ 3002 key: "getTextFilterOptions", 3003 value: function value() { 3004 return { 3005 path: this.path, 3006 text: this.text, 3007 mode: this.mode, 3008 ignoreRegex: this.regex, 3009 or: this.or 3010 }; 3011 } 3012 }, { 3013 key: "isEqualTo", 3014 value: function value(e) { 3015 var t = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], 3016 r = this.path === e.path && this.mode === e.mode && this.regex === e.regex; 3017 return t && (r = r && this.text === e.text), r; 3018 } 3019 }, { 3020 key: "text", 3021 set: function set(e) { 3022 this.initialText = e || "", this._text = (e || "").trim(); 3023 }, 3024 get: function get() { 3025 return this._text; 3026 } 3027 }]), t; 3028 }(); 3029 t.default = l; 3030}, function (e, t, r) { 3031 "use strict"; 3032 3033 Object.defineProperty(t, "__esModule", { 3034 value: !0 3035 }); 3036 var n = function () { 3037 function e(e, t) { 3038 for (var r = 0; r < t.length; r++) { 3039 var n = t[r]; 3040 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 3041 } 3042 } 3043 return function (t, r, n) { 3044 return r && e(t.prototype, r), n && e(t, n), t; 3045 }; 3046 }(); 3047 var o = function () { 3048 function e() { 3049 !function (e, t) { 3050 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 3051 }(this, e); 3052 } 3053 return n(e, null, [{ 3054 key: "textFilter", 3055 value: function value(e, t) { 3056 var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "", 3057 n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : "contains", 3058 o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : "", 3059 i = []; 3060 if (!e) return []; 3061 if ("default" === r) return e; 3062 var a = t.replace(new RegExp(o, "ig"), "").toLowerCase().trim(), 3063 l = !0, 3064 u = !1, 3065 s = void 0; 3066 try { 3067 for (var c, f = e[Symbol.iterator](); !(l = (c = f.next()).done); l = !0) { 3068 var d = c.value, 3069 p = r ? d.querySelectorAll(r) : [d]; 3070 if (p) { 3071 var h = !1, 3072 v = !0, 3073 y = !1, 3074 b = void 0; 3075 try { 3076 for (var m, g = p[Symbol.iterator](); !(v = (m = g.next()).done); v = !0) { 3077 var w = m.value.textContent.replace(new RegExp(o, "ig"), "").toLowerCase().trim(); 3078 switch (n) { 3079 case "startsWith": 3080 w.startsWith(a) && (h = !0); 3081 break; 3082 case "endsWith": 3083 w.endsWith(a) && (h = !0); 3084 break; 3085 case "equal": 3086 w === a && (h = !0); 3087 break; 3088 default: 3089 -1 !== w.indexOf(a) && (h = !0); 3090 } 3091 if (h) break; 3092 } 3093 } catch (e) { 3094 y = !0, b = e; 3095 } finally { 3096 try { 3097 !v && g.return && g.return(); 3098 } finally { 3099 if (y) throw b; 3100 } 3101 } 3102 h && i.push(d); 3103 } 3104 } 3105 } catch (e) { 3106 u = !0, s = e; 3107 } finally { 3108 try { 3109 !l && f.return && f.return(); 3110 } finally { 3111 if (u) throw s; 3112 } 3113 } 3114 return i; 3115 } 3116 }, {
3117 key: "pathFilter", 3118 value: function value(e) { 3119 var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "", 3120 r = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], 3121 n = []; 3122 if (!e) return []; 3123 if ("default" === t || !t) return e; 3124 var o = !0, 3125 i = !1, 3126 a = void 0; 3127 try { 3128 for (var l, u = e[Symbol.iterator](); !(o = (l = u.next()).done); o = !0) { 3129 var s = l.value, 3130 c = s.querySelector(t); 3131 (c && !r || !c && r) && n.push(s); 3132 } 3133 } catch (e) { 3134 i = !0, a = e; 3135 } finally { 3136 try { 3137 !o && u.return && u.return(); 3138 } finally { 3139 if (i) throw a; 3140 } 3141 } 3142 return n; 3143 } 3144 }, { 3145 key: "isNumeric", 3146 value: function value(e) { 3147 return !isNaN(parseFloat(e)) && isFinite(e); 3148 } 3149 }, { 3150 key: "rangeFilter", 3151 value: function value(t) { 3152 var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "", 3153 n = arguments[2], 3154 o = arguments[3], 3155 i = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : n, 3156 a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : o, 3157 l = []; 3158 if (!t) return []; 3159 if ("default" === r) return t; 3160 n = Math.max(n, i), o = Math.min(o, a); 3161 var u = !0, 3162 s = !1, 3163 c = void 0; 3164 try { 3165 for (var f, d = t[Symbol.iterator](); !(u = (f = d.next()).done); u = !0) { 3166 var p = f.value, 3167 h = r ? p.querySelectorAll(r) : [p]; 3168 if (h) { 3169 var v = [], 3170 y = !0, 3171 b = !1, 3172 m = void 0; 3173 try { 3174 for (var g, w = h[Symbol.iterator](); !(y = (g = w.next()).done); y = !0) { 3175 var O = g.value, 3176 _ = Number(O.textContent.trim().replace(/[^-0-9.]+/g, "")); 3177 isNaN(_) || v.push(_); 3178 } 3179 } catch (e) { 3180 b = !0, m = e; 3181 } finally { 3182 try { 3183 !y && w.return && w.return(); 3184 } finally { 3185 if (b) throw m; 3186 } 3187 } 3188 if (v.length > 0) { 3189 var j = Math.max.apply(Math, v), 3190 P = Math.min.apply(Math, v), 3191 k = !0; 3192 e.isNumeric(n) && n > P && (k = !1), e.isNumeric(o) && j > o && (k = !1), k && l.push(p); 3193 } 3194 } 3195 } 3196 } catch (e) { 3197 s = !0, c = e; 3198 } finally { 3199 try { 3200 !u && d.return && d.return(); 3201 } finally { 3202 if (s) throw c; 3203 } 3204 } 3205 return l; 3206 } 3207 }]), e; 3208 }(); 3209 t.default = o; 3210}, function (e, t, r) { 3211 "use strict"; 3212 3213 Object.defineProperty(t, "__esModule", { 3214 value: !0 3215 }); 3216 var n = function () { 3217 function e(e, t) { 3218 for (var r = 0; r < t.length; r++) { 3219 var n = t[r]; 3220 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 3221 } 3222 } 3223 return function (t, r, n) { 3224 return r && e(t.prototype, r), n && e(t, n), t; 3225 }; 3226 }(), 3227 o = s(r(0)), 3228 i = s(r(14)), 3229 a = s(r(4)), 3230 l = s(r(13)), 3231 u = s(r(9)); 3232 function s(e) { 3233 return e && e.__esModule ? e : { 3234 default: e 3235 }; 3236 } 3237 var c = function (e) { 3238 function t() { 3239 return function (e, t) { 3240 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 3241 }(this, t), function (e, t) { 3242 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 3243 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 3244 }(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments)); 3245 } 3246 return function (e, t) { 3247 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 3248 e.prototype = Object.create(t && t.prototype, { 3249 constructor: { 3250 value: e, 3251 enumerable: !1, 3252 writable: !0, 3253 configurable: !0 3254 } 3255 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 3256 }(t, o.default), n(t, [{ 3257 key: "render", 3258 value: function value(e) { 3259 var t = !0, 3260 r = !1, 3261 n = void 0; 3262 try { 3263 for (var o, i = this.controls[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 3264 var a = o.value; 3265 a.element.innerHTML = a.format.replace("{count}", e); 3266 } 3267 } catch (e) { 3268 r = !0, n = e; 3269 } finally { 3270 try { 3271 !t && i.return && i.return(); 3272 } finally { 3273 if (r) throw n; 3274 } 3275 } 3276 } 3277 }, {
3278 key: "addControl", 3279 value: function value(e) { 3280 var r = this; 3281 (function e(t, r, n) { 3282 null === t && (t = Function.prototype); 3283 var o = Object.getOwnPropertyDescriptor(t, r); 3284 if (void 0 === o) { 3285 var i = Object.getPrototypeOf(t); 3286 return null === i ? void 0 : e(i, r, n); 3287 } 3288 if ("value" in o) return o.value; 3289 var a = o.get; 3290 return void 0 !== a ? a.call(n) : void 0; 3291 })(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "addControl", this).call(this, e), e.filterType = e.element.getAttribute("data-filter-type") || "path", e.format = e.element.getAttribute("data-format") || "{count}", e.mode = e.element.getAttribute("data-mode") || "dynamic"; 3292 var n = null; 3293 switch (e.filterType) { 3294 case "text": 3295 n = new l.default(e.element); 3296 break; 3297 case "path": 3298 n = new a.default(e.element); 3299 break; 3300 case "range": 3301 n = new u.default(e.element); 3302 } 3303 e.element.addEventListener("jplist.state", function (o) { 3304 if (n && o.jplistState) { 3305 var i = 0; 3306 if ("static" === e.mode && o.jplistState.groups && o.jplistState.groups.has(e.group)) { 3307 var a = o.jplistState.groups.get(e.group); 3308 i = t.getStaticCounterValue(n, e.filterType, a); 3309 } 3310 "dynamic" === e.mode && o.jplistState.filtered && o.jplistState.filtered.length > 0 && (i = t.getDynamicCounterValue(n, e.filterType, o.jplistState.filtered)), r.render(i); 3311 } 3312 }, !1); 3313 } 3314 }], [{ 3315 key: "getDynamicCounterValue", 3316 value: function value(e, r, n) { 3317 return (n = t.getFilteredItems(e, r, n)).length; 3318 } 3319 }, { 3320 key: "getStaticCounterValue", 3321 value: function value(e, r, n) { 3322 var o = 0, 3323 i = !0, 3324 a = !1, 3325 l = void 0; 3326 try { 3327 for (var u, s = n[Symbol.iterator](); !(i = (u = s.next()).done); i = !0) { 3328 var c = u.value.items; 3329 o += (c = t.getFilteredItems(e, r, c)).length; 3330 } 3331 } catch (e) { 3332 a = !0, l = e; 3333 } finally { 3334 try { 3335 !i && s.return && s.return(); 3336 } finally { 3337 if (a) throw l; 3338 } 3339 } 3340 return o; 3341 } 3342 }, { 3343 key: "getFilteredItems", 3344 value: function value(e, t, r) { 3345 switch (t) { 3346 case "text": 3347 r = i.default.textFilter(r, e.text, e.path, e.mode, e.regex); 3348 break; 3349 case "path": 3350 r = i.default.pathFilter(r, e.path, e.isInverted); 3351 break; 3352 case "range": 3353 r = i.default.rangeFilter(r, e.path, e.from, e.to, e.min, e.max); 3354 } 3355 return r; 3356 } 3357 }]), t; 3358 }(); 3359 t.default = c; 3360}, function (e, t, r) { 3361 "use strict"; 3362 3363 Object.defineProperty(t, "__esModule", { 3364 value: !0 3365 }); 3366 var n, 3367 o = function () { 3368 function e(e, t) { 3369 for (var r = 0; r < t.length; r++) { 3370 var n = t[r]; 3371 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 3372 } 3373 } 3374 return function (t, r, n) { 3375 return r && e(t.prototype, r), n && e(t, n), t; 3376 }; 3377 }(), 3378 i = r(0), 3379 a = (n = i) && n.__esModule ? n : { 3380 default: n 3381 }; 3382 var l = function (e) { 3383 function t() { 3384 return function (e, t) { 3385 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 3386 }(this, t), function (e, t) { 3387 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 3388 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 3389 }(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments)); 3390 } 3391 return function (e, t) { 3392 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 3393 e.prototype = Object.create(t && t.prototype, { 3394 constructor: { 3395 value: e, 3396 enumerable: !1, 3397 writable: !0, 3398 configurable: !0 3399 } 3400 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 3401 }(t, a.default), o(t, [{ 3402 key: "addControl", 3403 value: function value(e) { 3404 var r = this; 3405 (function e(t, r, n) { 3406 null === t && (t = Function.prototype); 3407 var o = Object.getOwnPropertyDescriptor(t, r); 3408 if (void 0 === o) { 3409 var i = Object.getPrototypeOf(t); 3410 return null === i ? void 0 : e(i, r, n); 3411 } 3412 if ("value" in o) return o.value; 3413 var a = o.get; 3414 return void 0 !== a ? a.call(n) : void 0; 3415 })(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "addControl", this).call(this, e), e.element.addEventListener("click", function (t) { 3416 t.preventDefault(), window.jplist && window.jplist.resetControls(r.group, e); 3417 }, !1); 3418 } 3419 }]), t; 3420 }(); 3421 t.default = l; 3422}, function (e, t, r) { 3423 "use strict"; 3424 3425 Object.defineProperty(t, "__esModule", { 3426 value: !0 3427 }); 3428 var n, 3429 o = function () { 3430 function e(e, t) { 3431 for (var r = 0; r < t.length; r++) { 3432 var n = t[r]; 3433 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 3434 } 3435 } 3436 return function (t, r, n) { 3437 return r && e(t.prototype, r), n && e(t, n), t; 3438 }; 3439 }(), 3440 i = r(0), 3441 a = (n = i) && n.__esModule ? n : { 3442 default: n 3443 }; 3444 var l = function (e) { 3445 function t(e, r) { 3446 var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], 3447 o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null; 3448 !function (e, t) { 3449 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 3450 }(this, t); 3451 var i = function (e, t) { 3452 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 3453 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 3454 }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e, r, n, o)); 3455 return i.group = e, i.name = r, i.classNames = new Set(), i.selectedClassName = "", i; 3456 } 3457 return function (e, t) { 3458 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 3459 e.prototype = Object.create(t && t.prototype, { 3460 constructor: { 3461 value: e, 3462 enumerable: !1, 3463 writable: !0, 3464 configurable: !0 3465 } 3466 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 3467 }(t, a.default), o(t, [{ 3468 key: "addControl", 3469 value: function value(e) { 3470 var r = this; 3471 if (function e(t, r, n) { 3472 null === t && (t = Function.prototype); 3473 var o = Object.getOwnPropertyDescriptor(t, r); 3474 if (void 0 === o) { 3475 var i = Object.getPrototypeOf(t); 3476 return null === i ? void 0 : e(i, r, n); 3477 } 3478 if ("value" in o) return o.value; 3479 var a = o.get; 3480 return void 0 !== a ? a.call(n) : void 0; 3481 }(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "addControl", this).call(this, e), e.groupClassName = e.element.getAttribute("data-class") || "", e.selected = "true" === e.element.getAttribute("data-selected"), e.id) { 3482 var n = this.deepLinkParams.find(function (t) { 3483 return t.key === e.id; 3484 }); 3485 n && (e.selected = "1" === n.value); 3486 } 3487 this.classNames.add(e.groupClassName), e.element.addEventListener("click", function (t) { 3488 t.preventDefault(), r.handleSelectedControls(e.groupClassName), r.handleClasses(), window.jplist && window.jplist.refresh(r.group, e); 3489 }, !1), this.handleClasses(); 3490 } 3491 }, {
3492 key: "handleClasses", 3493 value: function value() { 3494 var e = document.querySelectorAll('[data-jplist-group="' + this.group + '"]'); 3495 this.resetAllGroups(e); 3496 var r = this.getLatestSelectedControl(); 3497 r && (this.handleSelectedControls(r.groupClassName), t.addClassToGroups(r.groupClassName, e)); 3498 } 3499 }, { 3500 key: "getLatestSelectedControl", 3501 value: function value() { 3502 var e = null, 3503 t = !0, 3504 r = !1, 3505 n = void 0; 3506 try { 3507 for (var o, i = this.controls[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 3508 var a = o.value; 3509 a.selected && (e = a); 3510 } 3511 } catch (e) { 3512 r = !0, n = e; 3513 } finally { 3514 try { 3515 !t && i.return && i.return(); 3516 } finally { 3517 if (r) throw n; 3518 } 3519 } 3520 return !e && this.controls.length > 0 && (e = this.controls[0]), e; 3521 } 3522 }, { 3523 key: "resetAllGroups", 3524 value: function value(e) { 3525 var t = !0, 3526 r = !1, 3527 n = void 0; 3528 try { 3529 for (var o, i = e[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 3530 var a = o.value, 3531 l = !0, 3532 u = !1, 3533 s = void 0; 3534 try { 3535 for (var c, f = this.classNames[Symbol.iterator](); !(l = (c = f.next()).done); l = !0) { 3536 var d = c.value; 3537 a.classList.remove(d); 3538 } 3539 } catch (e) { 3540 u = !0, s = e; 3541 } finally { 3542 try { 3543 !l && f.return && f.return(); 3544 } finally { 3545 if (u) throw s; 3546 } 3547 } 3548 } 3549 } catch (e) { 3550 r = !0, n = e; 3551 } finally { 3552 try { 3553 !t && i.return && i.return(); 3554 } finally { 3555 if (r) throw n; 3556 } 3557 } 3558 } 3559 }, { 3560 key: "handleSelectedControls", 3561 value: function value(e) { 3562 var t = !0, 3563 r = !1, 3564 n = void 0; 3565 try { 3566 for (var o, i = this.controls[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 3567 var a = o.value; 3568 a.groupClassName === e ? (a.selected = !0, a.element.classList.add("jplist-selected")) : (a.selected = !1, a.element.classList.remove("jplist-selected")); 3569 } 3570 } catch (e) { 3571 r = !0, n = e; 3572 } finally { 3573 try { 3574 !t && i.return && i.return(); 3575 } finally { 3576 if (r) throw n; 3577 } 3578 } 3579 } 3580 }, { 3581 key: "getDeepLink", 3582 value: function value() { 3583 var e = this.controls.map(function (e) { 3584 return e.id ? e.selected ? e.id + "=1" : e.id + "=0" : ""; 3585 }).filter(function (e) { 3586 return "" !== e; 3587 }); 3588 return Array.from(new Set(e)).join("&"); 3589 } 3590 }], [{ 3591 key: "addClassToGroups", 3592 value: function value(e, t) { 3593 var r = !0, 3594 n = !1, 3595 o = void 0; 3596 try { 3597 for (var i, a = t[Symbol.iterator](); !(r = (i = a.next()).done); r = !0) { 3598 i.value.classList.add(e); 3599 } 3600 } catch (e) { 3601 n = !0, o = e; 3602 } finally { 3603 try { 3604 !r && a.return && a.return(); 3605 } finally { 3606 if (n) throw o; 3607 } 3608 } 3609 } 3610 }]), t; 3611 }(); 3612 t.default = l; 3613}, function (e, t, r) { 3614 "use strict"; 3615 3616 Object.defineProperty(t, "__esModule", { 3617 value: !0 3618 }); 3619 var n, 3620 o = function () { 3621 function e(e, t) { 3622 for (var r = 0; r < t.length; r++) { 3623 var n = t[r]; 3624 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 3625 } 3626 } 3627 return function (t, r, n) { 3628 return r && e(t.prototype, r), n && e(t, n), t; 3629 }; 3630 }(), 3631 i = r(0), 3632 a = (n = i) && n.__esModule ? n : { 3633 default: n 3634 }; 3635 var l = function (e) { 3636 function t() { 3637 return function (e, t) { 3638 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 3639 }(this, t), function (e, t) { 3640 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 3641 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 3642 }(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments)); 3643 } 3644 return function (e, t) { 3645 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 3646 e.prototype = Object.create(t && t.prototype, { 3647 constructor: { 3648 value: e, 3649 enumerable: !1, 3650 writable: !0, 3651 configurable: !0 3652 } 3653 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 3654 }(t, a.default), o(t, [{ 3655 key: "addControl", 3656 value: function value(e) { 3657 (function e(t, r, n) { 3658 null === t && (t = Function.prototype); 3659 var o = Object.getOwnPropertyDescriptor(t, r); 3660 if (void 0 === o) { 3661 var i = Object.getPrototypeOf(t); 3662 return null === i ? void 0 : e(i, r, n); 3663 } 3664 if ("value" in o) return o.value; 3665 var a = o.get; 3666 return void 0 !== a ? a.call(n) : void 0; 3667 })(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "addControl", this).call(this, e), e.element.addEventListener("jplist.state", function (t) { 3668 if (t.jplistState) {
3669 var r = Number(t.jplistState.itemsNumber) || 0; 3670 e.element.style.display = 0 === r ? "" : "none"; 3671 } 3672 }, !1); 3673 } 3674 }]), t; 3675 }(); 3676 t.default = l; 3677}, function (e, t, r) { 3678 "use strict"; 3679 3680 Object.defineProperty(t, "__esModule", { 3681 value: !0 3682 }); 3683 var n = function () { 3684 function e(e, t) { 3685 for (var r = 0; r < t.length; r++) { 3686 var n = t[r]; 3687 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 3688 } 3689 } 3690 return function (t, r, n) { 3691 return r && e(t.prototype, r), n && e(t, n), t; 3692 }; 3693 }(); 3694 r(48); 3695 var o = function () { 3696 function e(t) { 3697 var r = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], 3698 n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : 0, 3699 o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : 0, 3700 i = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : 0, 3701 a = arguments.length > 5 && void 0 !== arguments[5] ? arguments[5] : 0, 3702 l = arguments.length > 6 && void 0 !== arguments[6] ? arguments[6] : function (e, t) {}; 3703 if (function (e, t) { 3704 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 3705 }(this, e), t) { 3706 if (this.element = t, this.element.classList.add("jplist-slider"), !this.element) return; 3707 this.isVertical = r, this.callback = l, this.min = n, this.max = a, r && this.element.classList.add("jplist-slider-vertical"), this.handler1 = document.createElement("span"), this.handler1.classList.add("jplist-slider-holder-1"), this.element.appendChild(this.handler1), this.range = document.createElement("span"), this.range.classList.add("jplist-slider-range"), this.element.appendChild(this.range), this.handler1.left = 0, this.handler1.top = 0, this.handler2 = document.createElement("span"), this.handler2.classList.add("jplist-slider-holder-2"), this.element.appendChild(this.handler2), this.handler2.left = 0, this.handler2.top = 0, this.dragging = null, this.handler1.addEventListener("mousedown", this.start.bind(this)), this.handler2.addEventListener("mousedown", this.start.bind(this)), this.handler1.addEventListener("touchstart", this.start.bind(this)), this.handler2.addEventListener("touchstart", this.start.bind(this)), document.addEventListener("mousemove", this.render.bind(this)), document.addEventListener("touchmove", this.render.bind(this)), window.addEventListener("resize", this.resize.bind(this)), document.addEventListener("mouseup", this.stop.bind(this)), document.addEventListener("touchend", this.stop.bind(this)), document.body.addEventListener("mouseleave", this.stop.bind(this)), this.element.addEventListener("mousedown", this.jump.bind(this)), this.setValues(o, i); 3708 } 3709 } 3710 return n(e, [{ 3711 key: "setValues", 3712 value: function value(e, t) { 3713 var r = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2]; 3714 t < e && (t = e); 3715 var n = this.getInnerValue(e, this.min, this.max), 3716 o = this.getInnerValue(t, this.min, this.max); 3717 this.update({ 3718 x: o, 3719 y: o 3720 }, this.handler2, r), this.update({ 3721 x: n, 3722 y: n 3723 }, this.handler1, r); 3724 } 3725 }, { 3726 key: "getPreviewValue", 3727 value: function value(e, t, r) { 3728 var n = t, 3729 o = r; 3730 return (e - 0) / (this.element.getBoundingClientRect()[this.isVertical ? "height" : "width"] - 0) * (o - n) + n; 3731 } 3732 }, { 3733 key: "getInnerValue", 3734 value: function value(e, t, r) { 3735 return (e - t) / (r - t) * (this.element.getBoundingClientRect()[this.isVertical ? "height" : "width"] - 0) + 0; 3736 } 3737 }, { 3738 key: "jump", 3739 value: function value(e) { 3740 e.preventDefault(); 3741 var t = this.getHandlerPos(e); 3742 this.isVertical ? this.dragging = Math.abs(t.y - this.handler1.top) < Math.abs(t.y - this.handler2.top) ? this.handler1 : this.handler2 : this.dragging = Math.abs(t.x - this.handler1.left) < Math.abs(t.x - this.handler2.left) ? this.handler1 : this.handler2, this.render(e); 3743 } 3744 }, {
3745 key: "setZIndex", 3746 value: function value() { 3747 var e = window.getComputedStyle && Number(document.defaultView.getComputedStyle(this.handler1, null).getPropertyValue("z-index")) || 200, 3748 t = window.getComputedStyle && Number(document.defaultView.getComputedStyle(this.handler2, null).getPropertyValue("z-index")) || 200; 3749 if (e === t) this.dragging.style["z-index"] = e + 1;else { 3750 var r = Math.max(e, t), 3751 n = Math.min(e, t); 3752 this.handler1.style["z-index"] = n, this.handler2.style["z-index"] = n, this.dragging.style["z-index"] = r; 3753 } 3754 } 3755 }, { 3756 key: "start", 3757 value: function value(e) { 3758 e.preventDefault(), e.stopPropagation(), this.dragging = e.target, this.setZIndex(), this.render(); 3759 } 3760 }, { 3761 key: "stop", 3762 value: function value(e) { 3763 this.dragging = null; 3764 } 3765 }, { 3766 key: "resize", 3767 value: function value(e) { 3768 this.handler1 && this.handler2 && this.setValues(this.handler1.value, this.handler2.value); 3769 } 3770 }, { 3771 key: "render", 3772 value: function value(e) { 3773 e && this.dragging && this.update(this.getHandlerPos(e), this.dragging); 3774 } 3775 }, { 3776 key: "update", 3777 value: function value(e, t) { 3778 var r = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2]; 3779 if (t) { 3780 var n = this.element.getBoundingClientRect(), 3781 o = this.isVertical ? "height" : "width", 3782 i = this.isVertical ? "y" : "x", 3783 a = this.isVertical ? "top" : "left"; 3784 e[i] < 0 && (e[i] = 0), e[i] > n[o] && (e[i] = n[o]), t === this.handler1 && e[i] >= this.handler2[a] && (e[i] = this.handler2[a]), t === this.handler2 && e[i] <= this.handler1[a] && (e[i] = this.handler1[a]), t[a] = e[i], t.value = this.getPreviewValue(e[i], this.min, this.max), t.style[a] = e[i] + "px", this.range.style[a] = this.handler1[a] + "px"; 3785 var l = this.handler2[a] - this.handler1[a]; 3786 this.range.style[o] = (l >= 0 ? l : 0) + "px", this.callback && r && this.callback(this.handler1.value, this.handler2.value); 3787 } 3788 } 3789 }, { 3790 key: "getHandlerPos", 3791 value: function value(t) { 3792 var r = this.element.getBoundingClientRect(), 3793 n = { 3794 x: t.touches && t.touches.length > 0 ? t.touches[0].pageX : t.clientX, 3795 y: t.touches && t.touches.length > 0 ? t.touches[0].pageY : t.clientY 3796 }, 3797 o = { 3798 x: r.left, 3799 y: r.top 3800 }; 3801 return e.sub(n, o); 3802 } 3803 }], [{ 3804 key: "sub", 3805 value: function value(e, t) { 3806 return { 3807 x: e.x - t.x, 3808 y: e.y - t.y 3809 }; 3810 } 3811 }]), e; 3812 }(); 3813 t.default = o; 3814}, function (e, t, r) { 3815 "use strict"; 3816 3817 Object.defineProperty(t, "__esModule", { 3818 value: !0 3819 }); 3820 var n = function () { 3821 function e(e, t) { 3822 for (var r = 0; r < t.length; r++) { 3823 var n = t[r]; 3824 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 3825 } 3826 } 3827 return function (t, r, n) { 3828 return r && e(t.prototype, r), n && e(t, n), t; 3829 }; 3830 }(), 3831 o = a(r(10)), 3832 i = a(r(19)); 3833 function a(e) { 3834 return e && e.__esModule ? e : { 3835 default: e 3836 }; 3837 } 3838 var l = function (e) { 3839 function t(e, r) { 3840 var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], 3841 o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null; 3842 !function (e, t) { 3843 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 3844 }(this, t); 3845 var i = function (e, t) { 3846 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 3847 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 3848 }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e, r, n, o)); 3849 return i.group = e, i.name = r, i; 3850 } 3851 return function (e, t) { 3852 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 3853 e.prototype = Object.create(t && t.prototype, { 3854 constructor: { 3855 value: e, 3856 enumerable: !1, 3857 writable: !0, 3858 configurable: !0 3859 } 3860 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 3861 }(t, o.default), n(t, [{ 3862 key: "addControl", 3863 value: function value(e) { 3864 var r = this, 3865 n = function e(t, r, n) { 3866 null === t && (t = Function.prototype); 3867 var o = Object.getOwnPropertyDescriptor(t, r); 3868 if (void 0 === o) { 3869 var i = Object.getPrototypeOf(t); 3870 return null === i ? void 0 : e(i, r, n); 3871 } 3872 if ("value" in o) return o.value; 3873 var a = o.get; 3874 return void 0 !== a ? a.call(n) : void 0; 3875 }(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "addControl", this).call(this, e), 3876 o = e.element.querySelector('[data-type="slider"]'); 3877 if (n.val1Elements = e.element.querySelectorAll('[data-type="value-1"]'), n.val2Elements = e.element.querySelectorAll('[data-type="value-2"]'), n.minElements = e.element.querySelectorAll('[data-type="min"]'), n.maxElements = e.element.querySelectorAll('[data-type="max"]'), o) { 3878 var a = e.element.getAttribute("data-orientation") || "horizontal", 3879 l = !0, 3880 u = !1, 3881 s = void 0; 3882 try { 3883 for (var c, f = n.minElements[Symbol.iterator](); !(l = (c = f.next()).done); l = !0) { 3884 c.value.textContent = n.min; 3885 } 3886 } catch (e) { 3887 u = !0, s = e; 3888 } finally { 3889 try { 3890 !l && f.return && f.return(); 3891 } finally { 3892 if (u) throw s; 3893 } 3894 } 3895 var d = !0, 3896 p = !1, 3897 h = void 0; 3898 try { 3899 for (var v, y = n.maxElements[Symbol.iterator](); !(d = (v = y.next()).done); d = !0) { 3900 v.value.textContent = n.max; 3901 } 3902 } catch (e) { 3903 p = !0, h = e; 3904 } finally { 3905 try { 3906 !d && y.return && y.return(); 3907 } finally { 3908 if (p) throw h; 3909 } 3910 } 3911 if (n.id) { 3912 var b = this.deepLinkParams.find(function (e) { 3913 return e.key === n.id; 3914 }); 3915 if (b && b.value) { 3916 var m = b.value.split("_"); 3917 2 === m.length && (n.from = Number(m[0]) || 0, n.to = Number(m[1]) || 0); 3918 } 3919 } 3920 n.slider = new i.default(o, "vertical" === a, n.min, n.from, n.to, n.max, function (e, t) { 3921 var o = !0, 3922 i = !1, 3923 a = void 0; 3924 try { 3925 for (var l, u = n.val1Elements[Symbol.iterator](); !(o = (l = u.next()).done); o = !0) { 3926 l.value.textContent = Math.round(e); 3927 } 3928 } catch (e) { 3929 i = !0, a = e; 3930 } finally { 3931 try { 3932 !o && u.return && u.return(); 3933 } finally { 3934 if (i) throw a; 3935 } 3936 } 3937 var s = !0, 3938 c = !1, 3939 f = void 0; 3940 try { 3941 for (var d, p = n.val2Elements[Symbol.iterator](); !(s = (d = p.next()).done); s = !0) { 3942 d.value.textContent = Math.round(t); 3943 } 3944 } catch (e) { 3945 c = !0, f = e; 3946 } finally { 3947 try { 3948 !s && p.return && p.return(); 3949 } finally { 3950 if (c) throw f; 3951 } 3952 } 3953 var h = !0, 3954 v = !1, 3955 y = void 0; 3956 try { 3957 for (var b, m = r.controls[Symbol.iterator](); !(h = (b = m.next()).done); h = !0) { 3958 var g = b.value; 3959 g.slider && g.slider.setValues(e, t, !1); 3960 } 3961 } catch (e) { 3962 v = !0, y = e; 3963 } finally { 3964 try { 3965 !h && m.return && m.return(); 3966 } finally { 3967 if (v) throw y; 3968 } 3969 } 3970 window.jplist && window.jplist.refresh(r.group, n); 3971 }); 3972 } 3973 } 3974 }, {
3975 key: "getRangeFilterOptions", 3976 value: function value() { 3977 var e = [], 3978 t = !0, 3979 r = !1, 3980 n = void 0; 3981 try { 3982 for (var o, i = this.controls[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 3983 var a = o.value; 3984 if (a.slider && a.slider.handler1 && a.slider.handler2) { 3985 var l = a.getRangeFilterOptions(); 3986 l.from = a.slider.handler1.value, l.to = a.slider.handler2.value, e = e.concat(l); 3987 } 3988 } 3989 } catch (e) { 3990 r = !0, n = e; 3991 } finally { 3992 try { 3993 !t && i.return && i.return(); 3994 } finally { 3995 if (r) throw n; 3996 } 3997 } 3998 return e; 3999 } 4000 }, { 4001 key: "getDeepLink", 4002 value: function value() { 4003 var e = this.controls.map(function (e) { 4004 return e.id && e.slider && e.slider.handler1 && e.slider.handler2 ? e.id + "=" + e.slider.handler1.value + "_" + e.slider.handler2.value : ""; 4005 }).filter(function (e) { 4006 return "" !== e; 4007 }); 4008 return Array.from(new Set(e)).join("&"); 4009 } 4010 }]), t; 4011 }(); 4012 t.default = l; 4013}, function (e, t, r) { 4014 "use strict"; 4015 4016 Object.defineProperty(t, "__esModule", { 4017 value: !0 4018 }); 4019 var n = function () { 4020 function e(e, t) { 4021 for (var r = 0; r < t.length; r++) { 4022 var n = t[r]; 4023 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 4024 } 4025 } 4026 return function (t, r, n) { 4027 return r && e(t.prototype, r), n && e(t, n), t; 4028 }; 4029 }(), 4030 o = a(r(10)), 4031 i = a(r(7)); 4032 function a(e) { 4033 return e && e.__esModule ? e : { 4034 default: e 4035 }; 4036 } 4037 var l = function (e) { 4038 function t() { 4039 return function (e, t) { 4040 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 4041 }(this, t), function (e, t) { 4042 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 4043 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 4044 }(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments)); 4045 } 4046 return function (e, t) { 4047 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 4048 e.prototype = Object.create(t && t.prototype, { 4049 constructor: { 4050 value: e, 4051 enumerable: !1, 4052 writable: !0, 4053 configurable: !0 4054 } 4055 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 4056 }(t, (0, i.default)(o.default)), n(t, [{ 4057 key: "getRangeFilterOptions", 4058 value: function value() { 4059 var e = [], 4060 t = this.getLastSelectedRadio(); 4061 t && (e = e.concat(t.getRangeFilterOptions())); 4062 var r = !0, 4063 n = !1, 4064 o = void 0; 4065 try { 4066 for (var i, a = this.checkboxes[Symbol.iterator](); !(r = (i = a.next()).done); r = !0) { 4067 var l = i.value; 4068 l.selected && (e = e.concat(l.getRangeFilterOptions())); 4069 } 4070 } catch (e) { 4071 n = !0, o = e; 4072 } finally { 4073 try { 4074 !r && a.return && a.return(); 4075 } finally { 4076 if (n) throw o; 4077 } 4078 } 4079 return e; 4080 } 4081 }]), t; 4082 }(); 4083 t.default = l; 4084}, function (e, t, r) { 4085 "use strict"; 4086 4087 Object.defineProperty(t, "__esModule", { 4088 value: !0 4089 }); 4090 var n = function () { 4091 function e(e, t) { 4092 for (var r = 0; r < t.length; r++) { 4093 var n = t[r]; 4094 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 4095 } 4096 } 4097 return function (t, r, n) { 4098 return r && e(t.prototype, r), n && e(t, n), t; 4099 }; 4100 }(), 4101 o = l(r(3)), 4102 i = l(r(4)), 4103 a = l(r(6)); 4104 function l(e) { 4105 return e && e.__esModule ? e : { 4106 default: e 4107 }; 4108 } 4109 var u = function (e) { 4110 function t(e, r) { 4111 var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], 4112 o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null; 4113 !function (e, t) { 4114 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 4115 }(this, t); 4116 var i = function (e, t) { 4117 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 4118 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 4119 }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e, r, n, o)); 4120 return i.group = e, i.name = r, i.selected = "", i.id = "", i; 4121 } 4122 return function (e, t) { 4123 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 4124 e.prototype = Object.create(t && t.prototype, { 4125 constructor: { 4126 value: e, 4127 enumerable: !1, 4128 writable: !0, 4129 configurable: !0 4130 } 4131 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 4132 }(t, o.default), n(t, [{ 4133 key: "addControl", 4134 value: function value(e) { 4135 var r = this, 4136 n = function e(t, r, n) { 4137 null === t && (t = Function.prototype); 4138 var o = Object.getOwnPropertyDescriptor(t, r); 4139 if (void 0 === o) { 4140 var i = Object.getPrototypeOf(t); 4141 return null === i ? void 0 : e(i, r, n); 4142 } 4143 if ("value" in o) return o.value; 4144 var a = o.get; 4145 return void 0 !== a ? a.call(n) : void 0; 4146 }(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "addControl", this).call(this, e); 4147 n.dropdown = new a.default(e.element), n.buttons = []; 4148 var o = n.element.querySelectorAll("[data-path]"), 4149 l = !0, 4150 u = !1, 4151 s = void 0; 4152 try { 4153 for (var c, f = function f() { 4154 var e = c.value; 4155 e.setAttribute("data-name", r.name), e.setAttribute("data-group", r.group), e.setAttribute("data-jump", n.jump); 4156 var t = new i.default(e); 4157 n.buttons.push(t), t.element.addEventListener("click", function (e) { 4158 e.preventDefault(), r.selected = t, r.setSelectedButton(n), window.jplist && window.jplist.refresh(r.group, t); 4159 }); 4160 }, d = o[Symbol.iterator](); !(l = (c = d.next()).done); l = !0) f(); 4161 } catch (e) { 4162 u = !0, s = e; 4163 } finally { 4164 try { 4165 !l && d.return && d.return(); 4166 } finally { 4167 if (u) throw s; 4168 } 4169 } 4170 if (this.selected = t.getSelectedButton(n.buttons), this.setSelectedButton(n), n.id) { 4171 this.id = n.id; 4172 var p = this.deepLinkParams.find(function (e) { 4173 return e.key === n.id; 4174 }); 4175 if (p) { 4176 var h = n.buttons.find(function (e) { 4177 var t = e.element.getAttribute("data-value"); 4178 return p.value === t ? e : null; 4179 }); 4180 h && (this.selected = h, this.setSelectedButton(n)); 4181 } 4182 } 4183 } 4184 }, {
4185 key: "getPathFilterOptions", 4186 value: function value() { 4187 return this.selected ? [this.selected.getPathFilterOptions()] : []; 4188 } 4189 }, { 4190 key: "getDeepLink", 4191 value: function value() { 4192 return this.id && this.selected && this.id + "=" + this.selected.element.getAttribute("data-value") || ""; 4193 } 4194 }, { 4195 key: "setSelectedButton", 4196 value: function value(e) { 4197 var t = this, 4198 r = !0, 4199 n = !1, 4200 o = void 0; 4201 try { 4202 for (var i, a = this.controls[Symbol.iterator](); !(r = (i = a.next()).done); r = !0) { 4203 var l = i.value; 4204 if (l.dropdown) { 4205 var u = e.buttons.find(function (e) { 4206 return t.selected.isEqualTo(e); 4207 }); 4208 u && l.dropdown.setPanelsContent(u.element.textContent), l.dropdown.close(); 4209 } 4210 } 4211 } catch (e) { 4212 n = !0, o = e; 4213 } finally { 4214 try { 4215 !r && a.return && a.return(); 4216 } finally { 4217 if (n) throw o; 4218 } 4219 } 4220 } 4221 }], [{ 4222 key: "getSelectedButton", 4223 value: function value(e) { 4224 if (e.length <= 0) return null; 4225 var t = !0, 4226 r = !1, 4227 n = void 0; 4228 try { 4229 for (var o, i = e[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 4230 var a = o.value; 4231 if ("true" === a.element.getAttribute("data-selected")) return a; 4232 } 4233 } catch (e) { 4234 r = !0, n = e; 4235 } finally { 4236 try { 4237 !t && i.return && i.return(); 4238 } finally { 4239 if (r) throw n; 4240 } 4241 } 4242 return e[0]; 4243 } 4244 }]), t; 4245 }(); 4246 t.default = u; 4247}, function (e, t, r) { 4248 "use strict"; 4249 4250 Object.defineProperty(t, "__esModule", { 4251 value: !0 4252 }); 4253 var n = function () { 4254 function e(e, t) { 4255 for (var r = 0; r < t.length; r++) { 4256 var n = t[r]; 4257 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 4258 } 4259 } 4260 return function (t, r, n) { 4261 return r && e(t.prototype, r), n && e(t, n), t; 4262 }; 4263 }(), 4264 o = a(r(3)), 4265 i = a(r(7)); 4266 function a(e) { 4267 return e && e.__esModule ? e : { 4268 default: e 4269 }; 4270 } 4271 var l = function (e) { 4272 function t() { 4273 return function (e, t) { 4274 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 4275 }(this, t), function (e, t) { 4276 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 4277 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 4278 }(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments)); 4279 } 4280 return function (e, t) { 4281 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 4282 e.prototype = Object.create(t && t.prototype, { 4283 constructor: { 4284 value: e, 4285 enumerable: !1, 4286 writable: !0, 4287 configurable: !0 4288 } 4289 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 4290 }(t, (0, i.default)(o.default)), n(t, [{ 4291 key: "getPathFilterOptions", 4292 value: function value() { 4293 var e = [], 4294 t = this.getLastSelectedRadio(); 4295 t && (e = e.concat(t.getPathFilterOptions())); 4296 var r = !0, 4297 n = !1, 4298 o = void 0; 4299 try { 4300 for (var i, a = this.checkboxes[Symbol.iterator](); !(r = (i = a.next()).done); r = !0) { 4301 var l = i.value; 4302 l.selected && (e = e.concat(l.getPathFilterOptions())); 4303 } 4304 } catch (e) { 4305 n = !0, o = e; 4306 } finally { 4307 try { 4308 !r && a.return && a.return(); 4309 } finally { 4310 if (n) throw o; 4311 } 4312 } 4313 return e; 4314 } 4315 }]), t; 4316 }(); 4317 t.default = l; 4318}, function (e, t, r) { 4319 "use strict"; 4320 4321 Object.defineProperty(t, "__esModule", { 4322 value: !0 4323 }); 4324 var n = function () { 4325 function e(e, t) { 4326 for (var r = 0; r < t.length; r++) { 4327 var n = t[r]; 4328 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 4329 } 4330 } 4331 return function (t, r, n) { 4332 return r && e(t.prototype, r), n && e(t, n), t; 4333 }; 4334 }(), 4335 o = a(r(3)), 4336 i = a(r(11)); 4337 function a(e) {
4338 return e && e.__esModule ? e : { 4339 default: e 4340 }; 4341 } 4342 var l = function (e) { 4343 function t() { 4344 return function (e, t) { 4345 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 4346 }(this, t), function (e, t) { 4347 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 4348 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 4349 }(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments)); 4350 } 4351 return function (e, t) { 4352 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 4353 e.prototype = Object.create(t && t.prototype, { 4354 constructor: { 4355 value: e, 4356 enumerable: !1, 4357 writable: !0, 4358 configurable: !0 4359 } 4360 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 4361 }(t, (0, i.default)(o.default)), n(t, [{ 4362 key: "getPathFilterOptions", 4363 value: function value() { 4364 var e = [], 4365 t = this.getLastSelectedRadio(); 4366 return t && (e = e.concat(t.getPathFilterOptions())), e; 4367 } 4368 }]), t; 4369 }(); 4370 t.default = l; 4371}, function (e, t, r) { 4372 "use strict"; 4373 4374 Object.defineProperty(t, "__esModule", { 4375 value: !0 4376 }); 4377 var n = function () { 4378 function e(e, t) { 4379 for (var r = 0; r < t.length; r++) { 4380 var n = t[r]; 4381 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 4382 } 4383 } 4384 return function (t, r, n) { 4385 return r && e(t.prototype, r), n && e(t, n), t; 4386 }; 4387 }(), 4388 o = a(r(3)), 4389 i = a(r(12)); 4390 function a(e) { 4391 return e && e.__esModule ? e : { 4392 default: e 4393 }; 4394 } 4395 var l = function (e) { 4396 function t() { 4397 return function (e, t) { 4398 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 4399 }(this, t), function (e, t) { 4400 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 4401 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 4402 }(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments)); 4403 } 4404 return function (e, t) { 4405 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 4406 e.prototype = Object.create(t && t.prototype, { 4407 constructor: { 4408 value: e, 4409 enumerable: !1, 4410 writable: !0, 4411 configurable: !0 4412 } 4413 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 4414 }(t, (0, i.default)(o.default)), n(t, [{ 4415 key: "getPathFilterOptions", 4416 value: function value() { 4417 var e = [], 4418 t = !0, 4419 r = !1, 4420 n = void 0; 4421 try { 4422 for (var o, i = this.checkboxes[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 4423 var a = o.value; 4424 a.selected && (e = e.concat(a.getPathFilterOptions())); 4425 } 4426 } catch (e) { 4427 r = !0, n = e; 4428 } finally { 4429 try { 4430 !t && i.return && i.return(); 4431 } finally { 4432 if (r) throw n; 4433 } 4434 } 4435 return e; 4436 } 4437 }]), t; 4438 }(); 4439 t.default = l; 4440}, function (e, t, r) { 4441 "use strict"; 4442 4443 Object.defineProperty(t, "__esModule", { 4444 value: !0 4445 }); 4446 var n = function () { 4447 function e(e, t) { 4448 for (var r = 0; r < t.length; r++) { 4449 var n = t[r]; 4450 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 4451 } 4452 } 4453 return function (t, r, n) { 4454 return r && e(t.prototype, r), n && e(t, n), t; 4455 }; 4456 }(), 4457 o = a(r(3)), 4458 i = a(r(4)); 4459 function a(e) { 4460 return e && e.__esModule ? e : { 4461 default: e 4462 }; 4463 } 4464 var l = function (e) { 4465 function t(e, r) { 4466 var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], 4467 o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null; 4468 !function (e, t) { 4469 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 4470 }(this, t); 4471 var i = function (e, t) { 4472 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 4473 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 4474 }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e, r, n, o)); 4475 return i.group = e, i.name = r, i.options = [], i.selected = "", i.id = "", i; 4476 } 4477 return function (e, t) { 4478 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 4479 e.prototype = Object.create(t && t.prototype, { 4480 constructor: { 4481 value: e, 4482 enumerable: !1, 4483 writable: !0, 4484 configurable: !0 4485 } 4486 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 4487 }(t, o.default), n(t, [{ 4488 key: "addControl", 4489 value: function value(e) { 4490 var r = this, 4491 n = function e(t, r, n) { 4492 null === t && (t = Function.prototype); 4493 var o = Object.getOwnPropertyDescriptor(t, r); 4494 if (void 0 === o) { 4495 var i = Object.getPrototypeOf(t); 4496 return null === i ? void 0 : e(i, r, n); 4497 } 4498 if ("value" in o) return o.value; 4499 var a = o.get; 4500 return void 0 !== a ? a.call(n) : void 0; 4501 }(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "addControl", this).call(this, e), 4502 o = n.element.querySelectorAll("option"), 4503 a = !0, 4504 l = !1, 4505 u = void 0; 4506 try { 4507 for (var s, c = function c() { 4508 var e = s.value; 4509 e.setAttribute("data-name", r.name), e.setAttribute("data-group", r.group), r.options.find(function (t) { 4510 return t.element.value === e.value; 4511 }) || r.options.push(new i.default(e)); 4512 }, f = o[Symbol.iterator](); !(a = (s = f.next()).done); a = !0) c(); 4513 } catch (e) { 4514 l = !0, u = e; 4515 } finally { 4516 try { 4517 !a && f.return && f.return(); 4518 } finally { 4519 if (l) throw u; 4520 } 4521 } 4522 if (this.selected = n.element.value, n.id) { 4523 this.id = n.id; 4524 var d = this.deepLinkParams.find(function (e) { 4525 return e.key === n.id; 4526 }); 4527 d && (n.element.value = d.value, this.selected = d.value); 4528 } 4529 n.element.addEventListener("change", function (e) { 4530 e.preventDefault(), r.selected = e.target.value; 4531 var t = !0, 4532 o = !1, 4533 i = void 0; 4534 try { 4535 for (var a, l = r.controls[Symbol.iterator](); !(t = (a = l.next()).done); t = !0) { 4536 a.value.element.value = r.selected; 4537 } 4538 } catch (e) { 4539 o = !0, i = e; 4540 } finally { 4541 try { 4542 !t && l.return && l.return(); 4543 } finally { 4544 if (o) throw i; 4545 } 4546 } 4547 window.jplist && window.jplist.refresh(r.group, n); 4548 }); 4549 } 4550 }, {
4551 key: "getPathFilterOptions", 4552 value: function value() { 4553 var e = this, 4554 t = this.options.find(function (t) { 4555 return t.element.value === e.selected; 4556 }); 4557 return t ? [t.getPathFilterOptions()] : []; 4558 } 4559 }, { 4560 key: "getDeepLink", 4561 value: function value() { 4562 var e = this, 4563 t = this.options.find(function (t) { 4564 return t.element.value === e.selected; 4565 }); 4566 return this.id ? this.id + "=" + t.element.value : ""; 4567 } 4568 }]), t; 4569 }(); 4570 t.default = l; 4571}, function (e, t, r) { 4572 "use strict"; 4573 4574 Object.defineProperty(t, "__esModule", { 4575 value: !0 4576 }); 4577 var n = function () { 4578 function e(e, t) { 4579 for (var r = 0; r < t.length; r++) { 4580 var n = t[r]; 4581 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 4582 } 4583 } 4584 return function (t, r, n) { 4585 return r && e(t.prototype, r), n && e(t, n), t; 4586 }; 4587 }(), 4588 o = a(r(5)), 4589 i = a(r(7)); 4590 function a(e) { 4591 return e && e.__esModule ? e : { 4592 default: e 4593 }; 4594 } 4595 var l = function (e) { 4596 function t() { 4597 return function (e, t) { 4598 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 4599 }(this, t), function (e, t) { 4600 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 4601 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 4602 }(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments)); 4603 } 4604 return function (e, t) { 4605 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 4606 e.prototype = Object.create(t && t.prototype, { 4607 constructor: { 4608 value: e, 4609 enumerable: !1, 4610 writable: !0, 4611 configurable: !0 4612 } 4613 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 4614 }(t, (0, i.default)(o.default)), n(t, [{ 4615 key: "getTextFilterOptions", 4616 value: function value() { 4617 var e = [], 4618 t = this.getLastSelectedRadio(); 4619 t && (e = e.concat(t.getTextFilterOptions())); 4620 var r = !0, 4621 n = !1, 4622 o = void 0; 4623 try { 4624 for (var i, a = this.checkboxes[Symbol.iterator](); !(r = (i = a.next()).done); r = !0) { 4625 var l = i.value; 4626 l.selected && (e = e.concat(l.getTextFilterOptions())); 4627 } 4628 } catch (e) { 4629 n = !0, o = e; 4630 } finally { 4631 try { 4632 !r && a.return && a.return(); 4633 } finally { 4634 if (n) throw o; 4635 } 4636 } 4637 return e; 4638 } 4639 }]), t; 4640 }(); 4641 t.default = l; 4642}, function (e, t, r) { 4643 "use strict"; 4644 4645 Object.defineProperty(t, "__esModule", { 4646 value: !0 4647 }); 4648 var n = function () { 4649 function e(e, t) { 4650 for (var r = 0; r < t.length; r++) { 4651 var n = t[r]; 4652 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 4653 } 4654 } 4655 return function (t, r, n) { 4656 return r && e(t.prototype, r), n && e(t, n), t; 4657 }; 4658 }(), 4659 o = a(r(5)), 4660 i = a(r(11)); 4661 function a(e) { 4662 return e && e.__esModule ? e : { 4663 default: e 4664 }; 4665 } 4666 var l = function (e) { 4667 function t() { 4668 return function (e, t) { 4669 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 4670 }(this, t), function (e, t) { 4671 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 4672 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 4673 }(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments)); 4674 } 4675 return function (e, t) { 4676 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 4677 e.prototype = Object.create(t && t.prototype, { 4678 constructor: { 4679 value: e, 4680 enumerable: !1, 4681 writable: !0, 4682 configurable: !0 4683 } 4684 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 4685 }(t, (0, i.default)(o.default)), n(t, [{ 4686 key: "getTextFilterOptions", 4687 value: function value() { 4688 var e = [], 4689 t = this.getLastSelectedRadio(); 4690 return t && (e = e.concat(t.getTextFilterOptions())), e; 4691 } 4692 }]), t; 4693 }(); 4694 t.default = l; 4695}, function (e, t, r) { 4696 "use strict"; 4697 4698 Object.defineProperty(t, "__esModule", { 4699 value: !0 4700 }); 4701 var n = function () { 4702 function e(e, t) { 4703 for (var r = 0; r < t.length; r++) { 4704 var n = t[r]; 4705 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 4706 } 4707 } 4708 return function (t, r, n) { 4709 return r && e(t.prototype, r), n && e(t, n), t; 4710 }; 4711 }(), 4712 o = a(r(5)), 4713 i = a(r(12)); 4714 function a(e) {
4715 return e && e.__esModule ? e : { 4716 default: e 4717 }; 4718 } 4719 var l = function (e) { 4720 function t() { 4721 return function (e, t) { 4722 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 4723 }(this, t), function (e, t) { 4724 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 4725 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 4726 }(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments)); 4727 } 4728 return function (e, t) { 4729 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 4730 e.prototype = Object.create(t && t.prototype, { 4731 constructor: { 4732 value: e, 4733 enumerable: !1, 4734 writable: !0, 4735 configurable: !0 4736 } 4737 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 4738 }(t, (0, i.default)(o.default)), n(t, [{ 4739 key: "getTextFilterOptions", 4740 value: function value() { 4741 var e = [], 4742 t = !0, 4743 r = !1, 4744 n = void 0; 4745 try { 4746 for (var o, i = this.checkboxes[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 4747 var a = o.value; 4748 a.selected && (e = e.concat(a.getTextFilterOptions())); 4749 } 4750 } catch (e) { 4751 r = !0, n = e; 4752 } finally { 4753 try { 4754 !t && i.return && i.return(); 4755 } finally { 4756 if (r) throw n; 4757 } 4758 } 4759 return e; 4760 } 4761 }]), t; 4762 }(); 4763 t.default = l; 4764}, function (e, t, r) { 4765 "use strict"; 4766 4767 Object.defineProperty(t, "__esModule", { 4768 value: !0 4769 }); 4770 var n, 4771 o = function () { 4772 function e(e, t) { 4773 for (var r = 0; r < t.length; r++) { 4774 var n = t[r]; 4775 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 4776 } 4777 } 4778 return function (t, r, n) { 4779 return r && e(t.prototype, r), n && e(t, n), t; 4780 }; 4781 }(), 4782 i = r(5), 4783 a = (n = i) && n.__esModule ? n : { 4784 default: n 4785 }; 4786 var l = function (e) { 4787 function t(e, r) { 4788 var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], 4789 o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null; 4790 !function (e, t) { 4791 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 4792 }(this, t); 4793 var i = function (e, t) { 4794 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 4795 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 4796 }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e, r, n, o)); 4797 return i.group = e, i.name = r, i; 4798 } 4799 return function (e, t) { 4800 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 4801 e.prototype = Object.create(t && t.prototype, { 4802 constructor: { 4803 value: e, 4804 enumerable: !1, 4805 writable: !0, 4806 configurable: !0 4807 } 4808 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 4809 }(t, a.default), o(t, [{ 4810 key: "addControl", 4811 value: function value(e) { 4812 var r = this, 4813 n = function e(t, r, n) { 4814 null === t && (t = Function.prototype); 4815 var o = Object.getOwnPropertyDescriptor(t, r); 4816 if (void 0 === o) { 4817 var i = Object.getPrototypeOf(t); 4818 return null === i ? void 0 : e(i, r, n); 4819 } 4820 if ("value" in o) return o.value; 4821 var a = o.get; 4822 return void 0 !== a ? a.call(n) : void 0; 4823 }(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "addControl", this).call(this, e); 4824 if (n.id) { 4825 var o = this.deepLinkParams.find(function (e) { 4826 return e.key === n.id; 4827 }); 4828 o && (n.text = o.value, n.element.value = o.value); 4829 } 4830 if (n.element.addEventListener("keyup", function (e) { 4831 e.preventDefault(), n.text = e.target.value, r.textChanged(n); 4832 }), n.clearButtonID = (n.element.getAttribute("data-clear-btn-id") || "").trim(), n.clearButtonID) { 4833 var i = document.getElementById(n.clearButtonID); 4834 i && i.addEventListener("click", function (e) { 4835 e.preventDefault(), n.text = "", r.textChanged(n); 4836 }); 4837 } 4838 } 4839 }, {
4840 key: "textChanged", 4841 value: function value(e) { 4842 this.controls.forEach(function (t) { 4843 t.isEqualTo(e, !1) && (t.element.value = e.initialText, t.text = e.initialText); 4844 }), window.jplist && window.jplist.refresh(this.group, e); 4845 } 4846 }]), t; 4847 }(); 4848 t.default = l; 4849}, function (e, t, r) { 4850 "use strict"; 4851 4852 Object.defineProperty(t, "__esModule", { 4853 value: !0 4854 }); 4855 var n, 4856 o = function () { 4857 function e(e, t) { 4858 for (var r = 0; r < t.length; r++) { 4859 var n = t[r]; 4860 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 4861 } 4862 } 4863 return function (t, r, n) { 4864 return r && e(t.prototype, r), n && e(t, n), t; 4865 }; 4866 }(), 4867 i = r(1), 4868 a = (n = i) && n.__esModule ? n : { 4869 default: n 4870 }; 4871 var l = function (e) { 4872 function t(e) { 4873 !function (e, t) { 4874 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 4875 }(this, t); 4876 var r = function (e, t) { 4877 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 4878 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 4879 }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e)); 4880 return e && (r.itemsPerPage = Number(e.getAttribute("data-items-per-page")) || 10, r.currentPage = Number(e.getAttribute("data-current-page")) || 0, r.range = Number(e.getAttribute("data-range")) || 10, r.disabledClass = (e.getAttribute("data-disabled-class") || "jplist-disabled").trim(), r.selectedClass = (e.getAttribute("data-selected-class") || "jplist-selected").trim()), r; 4881 } 4882 return function (e, t) { 4883 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 4884 e.prototype = Object.create(t && t.prototype, { 4885 constructor: { 4886 value: e, 4887 enumerable: !1, 4888 writable: !0, 4889 configurable: !0 4890 } 4891 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 4892 }(t, a.default), o(t, [{ 4893 key: "getPaginationOptions", 4894 value: function value() { 4895 return { 4896 itemsPerPage: this.itemsPerPage, 4897 currentPage: this.currentPage, 4898 range: this.range 4899 }; 4900 } 4901 }]), t; 4902 }(); 4903 t.default = l; 4904}, function (e, t, r) { 4905 "use strict"; 4906 4907 Object.defineProperty(t, "__esModule", { 4908 value: !0 4909 }); 4910 var n = function () { 4911 function e(e, t) { 4912 for (var r = 0; r < t.length; r++) { 4913 var n = t[r]; 4914 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 4915 } 4916 } 4917 return function (t, r, n) { 4918 return r && e(t.prototype, r), n && e(t, n), t; 4919 }; 4920 }(), 4921 o = a(r(0)), 4922 i = a(r(31)); 4923 function a(e) { 4924 return e && e.__esModule ? e : { 4925 default: e 4926 }; 4927 } 4928 var l = function (e) { 4929 function t() { 4930 return function (e, t) { 4931 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 4932 }(this, t), function (e, t) { 4933 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 4934 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 4935 }(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments)); 4936 } 4937 return function (e, t) { 4938 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 4939 e.prototype = Object.create(t && t.prototype, { 4940 constructor: { 4941 value: e, 4942 enumerable: !1, 4943 writable: !0, 4944 configurable: !0 4945 } 4946 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 4947 }(t, o.default), n(t, [{ 4948 key: "getPaginationOptions", 4949 value: function value() { 4950 return this.controls.length > 0 ? this.controls[this.controls.length - 1].getPaginationOptions() : null; 4951 } 4952 }, {
4953 key: "setPaginationOptions", 4954 value: function value(e) {} 4955 }, { 4956 key: "addControl", 4957 value: function value(e) { 4958 if (e.name !== this.name || e.group !== this.group) return null; 4959 var t = new i.default(e.element); 4960 return this.controls.push(t), t; 4961 } 4962 }]), t; 4963 }(); 4964 t.default = l; 4965}, function (e, t, r) { 4966 "use strict"; 4967 4968 Object.defineProperty(t, "__esModule", { 4969 value: !0 4970 }); 4971 var n = function () { 4972 function e(e, t) { 4973 for (var r = 0; r < t.length; r++) { 4974 var n = t[r]; 4975 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 4976 } 4977 } 4978 return function (t, r, n) { 4979 return r && e(t.prototype, r), n && e(t, n), t; 4980 }; 4981 }(), 4982 o = a(r(32)), 4983 i = a(r(6)); 4984 function a(e) { 4985 return e && e.__esModule ? e : { 4986 default: e 4987 }; 4988 } 4989 var l = function (e) { 4990 function t(e, r) { 4991 var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], 4992 o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null; 4993 !function (e, t) { 4994 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 4995 }(this, t); 4996 var i = function (e, t) { 4997 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 4998 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 4999 }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e, r, n, o)); 5000 return i.currentPage = 0, i.itemsPerPage = 0, i.range = 0, i.id = "", i; 5001 } 5002 return function (e, t) { 5003 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 5004 e.prototype = Object.create(t && t.prototype, { 5005 constructor: { 5006 value: e, 5007 enumerable: !1, 5008 writable: !0, 5009 configurable: !0 5010 } 5011 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 5012 }(t, o.default), n(t, [{ 5013 key: "addControl", 5014 value: function value(e) { 5015 var r = function e(t, r, n) { 5016 null === t && (t = Function.prototype); 5017 var o = Object.getOwnPropertyDescriptor(t, r); 5018 if (void 0 === o) { 5019 var i = Object.getPrototypeOf(t); 5020 return null === i ? void 0 : e(i, r, n); 5021 } 5022 if ("value" in o) return o.value; 5023 var a = o.get; 5024 return void 0 !== a ? a.call(n) : void 0; 5025 }(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "addControl", this).call(this, e); 5026 if (this.currentPage = r.currentPage, this.itemsPerPage = Number(r.itemsPerPage) || 0, this.range = r.range, this.restoreFromDeepLink(r), r.pageButtonsHolder = r.element.querySelector('[data-type="pages"]'), r.pageButtonsHolder && (r.btnTemplate = r.pageButtonsHolder.innerHTML), r.firstButtons = r.element.querySelectorAll('[data-type="first"]'), r.lastButtons = r.element.querySelectorAll('[data-type="last"]'), r.prevButtons = r.element.querySelectorAll('[data-type="prev"]'), r.nextButtons = r.element.querySelectorAll('[data-type="next"]'), t.bindEventHandler(r.firstButtons, "click", this.pageButtonClick.bind(this), r), t.bindEventHandler(r.lastButtons, "click", this.pageButtonClick.bind(this), r), t.bindEventHandler(r.prevButtons, "click", this.pageButtonClick.bind(this), r), t.bindEventHandler(r.nextButtons, "click", this.pageButtonClick.bind(this), r), r.itemsPerPageSelects = Array.from(r.element.querySelectorAll('[data-type="items-per-page"]')), this.updateItemsPerPageSelect(r.itemsPerPageSelects), r.itemsPerPageDD = Array.from(r.element.querySelectorAll('[data-type="items-per-page-dd"]')), this.initCustomDropdowns(r), t.bindEventHandler(r.itemsPerPageSelects, "change", this.selectChange.bind(this), r), r.labels = r.element.querySelectorAll('[data-type="info"]'), r.labels) { 5027 var n = !0, 5028 o = !1, 5029 i = void 0; 5030 try { 5031 for (var a, l = r.labels[Symbol.iterator](); !(n = (a = l.next()).done); n = !0) { 5032 var u = a.value; 5033 u.template = u.innerHTML; 5034 } 5035 } catch (e) { 5036 o = !0, i = e; 5037 } finally { 5038 try { 5039 !n && l.return && l.return(); 5040 } finally { 5041 if (o) throw i; 5042 } 5043 } 5044 } 5045 } 5046 }, {
5047 key: "updateItemsPerPageSelect", 5048 value: function value(e) { 5049 var t = this, 5050 r = !0, 5051 n = !1, 5052 o = void 0; 5053 try { 5054 for (var i, a = e[Symbol.iterator](); !(r = (i = a.next()).done); r = !0) { 5055 var l = i.value, 5056 u = Array.from(l.options).find(function (e) { 5057 return e.value === t.itemsPerPage.toString(); 5058 }); 5059 l.value = u && Number(this.itemsPerPage) || 0; 5060 } 5061 } catch (e) { 5062 n = !0, o = e; 5063 } finally { 5064 try { 5065 !r && a.return && a.return(); 5066 } finally { 5067 if (n) throw o; 5068 } 5069 } 5070 } 5071 }, { 5072 key: "initCustomDropdowns", 5073 value: function value(e) { 5074 var t = this, 5075 r = e.itemsPerPageDD; 5076 if (r && !(r.length <= 0)) { 5077 var n = !0, 5078 o = !1, 5079 a = void 0; 5080 try { 5081 for (var l, u = function u() { 5082 var r = l.value; 5083 r.dropdown = new i.default(r), r.buttons = Array.from(r.querySelectorAll("[data-value]")); 5084 var n = !0, 5085 o = !1, 5086 a = void 0; 5087 try { 5088 for (var u, s = function s() { 5089 var n = u.value; 5090 n.addEventListener("click", function (o) { 5091 o.preventDefault(), t.itemsPerPage = Number(n.getAttribute("data-value")) || 0, t.setSelectedButton(), r.dropdown.close(), window.jplist && window.jplist.refresh(t.group, e); 5092 }); 5093 }, c = r.buttons[Symbol.iterator](); !(n = (u = c.next()).done); n = !0) s(); 5094 } catch (e) { 5095 o = !0, a = e; 5096 } finally { 5097 try { 5098 !n && c.return && c.return(); 5099 } finally { 5100 if (o) throw a; 5101 } 5102 } 5103 }, s = r[Symbol.iterator](); !(n = (l = s.next()).done); n = !0) u(); 5104 } catch (e) { 5105 o = !0, a = e; 5106 } finally { 5107 try { 5108 !n && s.return && s.return(); 5109 } finally { 5110 if (o) throw a; 5111 } 5112 } 5113 this.setSelectedButton(); 5114 } 5115 } 5116 }, { 5117 key: "setSelectedButton", 5118 value: function value() { 5119 var e = this, 5120 t = !0, 5121 r = !1, 5122 n = void 0; 5123 try { 5124 for (var o, i = this.controls[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 5125 var a = o.value; 5126 if (a.itemsPerPageDD) { 5127 var l = !0, 5128 u = !1, 5129 s = void 0; 5130 try { 5131 for (var c, f = a.itemsPerPageDD[Symbol.iterator](); !(l = (c = f.next()).done); l = !0) { 5132 var d = c.value; 5133 if (d.buttons) { 5134 var p = d.buttons.find(function (t) { 5135 return (Number(t.getAttribute("data-value")) || 0) === e.itemsPerPage; 5136 }); 5137 p || (p = d.buttons.find(function (e) { 5138 return 0 === (Number(e.getAttribute("data-value")) || 0); 5139 })), p && d.dropdown.setPanelsContent(p.textContent); 5140 } 5141 } 5142 } catch (e) { 5143 u = !0, s = e; 5144 } finally { 5145 try { 5146 !l && f.return && f.return(); 5147 } finally { 5148 if (u) throw s; 5149 } 5150 } 5151 } 5152 } 5153 } catch (e) { 5154 r = !0, n = e; 5155 } finally { 5156 try { 5157 !t && i.return && i.return(); 5158 } finally { 5159 if (r) throw n; 5160 } 5161 } 5162 } 5163 }, { 5164 key: "getPaginationOptions", 5165 value: function value() { 5166 return { 5167 itemsPerPage: this.itemsPerPage, 5168 currentPage: this.currentPage, 5169 range: this.range 5170 }; 5171 } 5172 }, { 5173 key: "setPaginationOptions", 5174 value: function value(e) { 5175 var r = this; 5176 if (e) { 5177 this.currentPage = e.currentPage, this.itemsPerPage = e.itemsPerPage; 5178 var n = !0, 5179 o = !1, 5180 i = void 0; 5181 try { 5182 for (var a, l = function l() { 5183 var n = a.value; 5184 if (!n.btnTemplate || !n.pageButtonsHolder) return "continue";
5185 for (; n.pageButtonsHolder.firstChild;) n.pageButtonsHolder.removeChild(n.pageButtonsHolder.firstChild); 5186 for (var o = function o(e) { 5187 var t = document.createElement("div"); 5188 t.innerHTML = n.btnTemplate.replace(new RegExp("{pageNumber}", "g"), e + 1).trim(); 5189 var o = t.firstChild, 5190 i = o.querySelector('[data-type="page"]'); 5191 i || (i = o), i.setAttribute("data-page", e.toString()), e === r.currentPage && (i.classList.add(n.selectedClass), i.setAttribute("data-selected", "true")), i.addEventListener("click", function (e) { 5192 r.pageButtonClick(e, i, n); 5193 }), n.pageButtonsHolder.appendChild(o); 5194 }, i = e.rangeStart; i <= e.rangeEnd; i++) o(i); 5195 t.setPageAttr(n.firstButtons, 0, 0 !== r.currentPage, n.disabledClass), t.setPageAttr(n.lastButtons, e.pagesNumber - 1, r.currentPage !== e.pagesNumber - 1, n.disabledClass), t.setPageAttr(n.prevButtons, e.prevPage, 0 !== r.currentPage, n.disabledClass), t.setPageAttr(n.nextButtons, e.nextPage, r.currentPage !== e.pagesNumber - 1, n.disabledClass); 5196 var l = [{ 5197 key: "{pageNumber}", 5198 value: e.currentPage + 1 5199 }, { 5200 key: "{pagesNumber}", 5201 value: e.pagesNumber 5202 }, { 5203 key: "{startItem}", 5204 value: e.start + 1 5205 }, { 5206 key: "{endItem}", 5207 value: e.end 5208 }, { 5209 key: "{itemsNumber}", 5210 value: e.itemsNumber 5211 }]; 5212 if (n.labels) { 5213 var u = !0, 5214 s = !1, 5215 c = void 0; 5216 try { 5217 for (var f, d = n.labels[Symbol.iterator](); !(u = (f = d.next()).done); u = !0) { 5218 var p = f.value; 5219 if (p.template) { 5220 var h = p.template, 5221 v = !0, 5222 y = !1, 5223 b = void 0; 5224 try { 5225 for (var m, g = l[Symbol.iterator](); !(v = (m = g.next()).done); v = !0) { 5226 var w = m.value; 5227 h = h.replace(new RegExp(w.key, "g"), w.value); 5228 } 5229 } catch (e) { 5230 y = !0, b = e; 5231 } finally { 5232 try { 5233 !v && g.return && g.return(); 5234 } finally { 5235 if (y) throw b; 5236 } 5237 } 5238 p.innerHTML = h; 5239 } 5240 } 5241 } catch (e) { 5242 s = !0, c = e; 5243 } finally { 5244 try { 5245 !u && d.return && d.return(); 5246 } finally { 5247 if (s) throw c; 5248 } 5249 } 5250 } 5251 var O = Array.from(n.element.classList).filter(function (e) { 5252 return e.startsWith("jplist-pages-number-") || e.startsWith("jplist-items-number-"); 5253 }), 5254 _ = !0, 5255 j = !1, 5256 P = void 0; 5257 try { 5258 for (var k, x = O[Symbol.iterator](); !(_ = (k = x.next()).done); _ = !0) { 5259 var S = k.value; 5260 n.element.classList.remove(S); 5261 } 5262 } catch (e) { 5263 j = !0, P = e; 5264 } finally { 5265 try { 5266 !_ && x.return && x.return(); 5267 } finally { 5268 if (j) throw P; 5269 } 5270 } 5271 n.element.classList.add("jplist-pages-number-" + e.pagesNumber), n.element.classList.add("jplist-items-number-" + e.itemsNumber); 5272 }, u = this.controls[Symbol.iterator](); !(n = (a = u.next()).done); n = !0) l(); 5273 } catch (e) { 5274 o = !0, i = e; 5275 } finally { 5276 try { 5277 !n && u.return && u.return(); 5278 } finally { 5279 if (o) throw i; 5280 } 5281 } 5282 } 5283 } 5284 }, {
5285 key: "pageButtonClick", 5286 value: function value(e, t, r) { 5287 e && e.preventDefault(); 5288 var n = t ? t.getAttribute("data-page") : e.target.getAttribute("data-page"); 5289 this.currentPage = Number(n) || 0, window.jplist && window.jplist.refresh(this.group, r); 5290 } 5291 }, { 5292 key: "selectChange", 5293 value: function value(e, t, r) { 5294 e.preventDefault(); 5295 var n = Number(e.target.value); 5296 if (!isNaN(n)) { 5297 this.itemsPerPage = n; 5298 var o = !0, 5299 i = !1, 5300 a = void 0; 5301 try { 5302 for (var l, u = this.controls[Symbol.iterator](); !(o = (l = u.next()).done); o = !0) { 5303 var s = l.value; 5304 this.updateItemsPerPageSelect(s.itemsPerPageSelects); 5305 } 5306 } catch (e) { 5307 i = !0, a = e; 5308 } finally { 5309 try { 5310 !o && u.return && u.return(); 5311 } finally { 5312 if (i) throw a; 5313 } 5314 } 5315 } 5316 window.jplist && window.jplist.refresh(this.group, r); 5317 } 5318 }, { 5319 key: "restoreFromDeepLink", 5320 value: function value(e) { 5321 if (e.id) { 5322 this.id = e.id; 5323 var t = this.deepLinkParams.find(function (t) { 5324 return t.key === e.id; 5325 }); 5326 if (t) { 5327 var r = t.value.split("-"); 5328 if (2 !== r.length) return; 5329 var n = Number(r[0]), 5330 o = Number(r[1]); 5331 if (isNaN(n) || isNaN(o)) return; 5332 this.currentPage = n, this.itemsPerPage = o; 5333 } 5334 } 5335 } 5336 }, { 5337 key: "getDeepLink", 5338 value: function value() { 5339 return this.id ? this.id + "=" + this.currentPage + "-" + this.itemsPerPage : ""; 5340 } 5341 }], [{ 5342 key: "setPageAttr", 5343 value: function value(e, t, r, n) { 5344 if (e) { 5345 var o = !0, 5346 i = !1, 5347 a = void 0; 5348 try { 5349 for (var l, u = e[Symbol.iterator](); !(o = (l = u.next()).done); o = !0) { 5350 var s = l.value; 5351 s.setAttribute("data-page", t), r ? s.classList.remove(n) : s.classList.add(n); 5352 } 5353 } catch (e) { 5354 i = !0, a = e; 5355 } finally { 5356 try { 5357 !o && u.return && u.return(); 5358 } finally { 5359 if (i) throw a; 5360 } 5361 } 5362 } 5363 } 5364 }, { 5365 key: "bindEventHandler", 5366 value: function value(e, t, r, n) { 5367 if (e) { 5368 var o = !0, 5369 i = !1, 5370 a = void 0; 5371 try { 5372 for (var l, u = function u() { 5373 var e = l.value; 5374 e.addEventListener(t, function (t) { 5375 r(t, e, n); 5376 }); 5377 }, s = e[Symbol.iterator](); !(o = (l = s.next()).done); o = !0) u(); 5378 } catch (e) { 5379 i = !0, a = e; 5380 } finally { 5381 try { 5382 !o && s.return && s.return(); 5383 } finally { 5384 if (i) throw a; 5385 } 5386 } 5387 } 5388 } 5389 }]), t; 5390 }(); 5391 t.default = l; 5392}, function (e, t, r) { 5393 "use strict"; 5394 5395 Object.defineProperty(t, "__esModule", { 5396 value: !0 5397 }); 5398 var n = function () { 5399 function e(e, t) { 5400 for (var r = 0; r < t.length; r++) { 5401 var n = t[r]; 5402 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 5403 } 5404 } 5405 return function (t, r, n) { 5406 return r && e(t.prototype, r), n && e(t, n), t; 5407 }; 5408 }(), 5409 o = l(r(2)), 5410 i = l(r(8)), 5411 a = l(r(6)); 5412 function l(e) { 5413 return e && e.__esModule ? e : { 5414 default: e 5415 }; 5416 } 5417 var u = function (e) { 5418 function t(e, r) { 5419 var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], 5420 o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null; 5421 !function (e, t) { 5422 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 5423 }(this, t); 5424 var i = function (e, t) { 5425 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 5426 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 5427 }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e, r, n, o)); 5428 return i.group = e, i.name = r, i.selected = null, i.id = "", i; 5429 } 5430 return function (e, t) { 5431 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 5432 e.prototype = Object.create(t && t.prototype, { 5433 constructor: { 5434 value: e, 5435 enumerable: !1, 5436 writable: !0, 5437 configurable: !0 5438 } 5439 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 5440 }(t, o.default), n(t, [{ 5441 key: "addControl", 5442 value: function value(e) { 5443 var r = this, 5444 n = function e(t, r, n) { 5445 null === t && (t = Function.prototype); 5446 var o = Object.getOwnPropertyDescriptor(t, r); 5447 if (void 0 === o) { 5448 var i = Object.getPrototypeOf(t); 5449 return null === i ? void 0 : e(i, r, n); 5450 } 5451 if ("value" in o) return o.value; 5452 var a = o.get; 5453 return void 0 !== a ? a.call(n) : void 0; 5454 }(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "addControl", this).call(this, e); 5455 n.dropdown = new a.default(e.element), n.buttons = []; 5456 var o = n.element.querySelectorAll("[data-path]"), 5457 l = !0, 5458 u = !1, 5459 s = void 0; 5460 try { 5461 for (var c, f = function f() { 5462 var e = c.value; 5463 e.setAttribute("data-name", r.name), e.setAttribute("data-group", r.group), e.setAttribute("data-jump", n.jump); 5464 var t = new i.default(e); 5465 n.buttons.push(t), t.element.addEventListener("click", function (e) { 5466 e.preventDefault(), r.selected = t, r.setSelectedButton(n); 5467 var o = !0, 5468 i = !1, 5469 a = void 0; 5470 try { 5471 for (var l, u = r.controls[Symbol.iterator](); !(o = (l = u.next()).done); o = !0) { 5472 var s = l.value; 5473 s.dropdown && s.dropdown.close(); 5474 } 5475 } catch (e) { 5476 i = !0, a = e; 5477 } finally { 5478 try { 5479 !o && u.return && u.return(); 5480 } finally { 5481 if (i) throw a; 5482 } 5483 } 5484 window.jplist && window.jplist.refresh(r.group, t); 5485 }); 5486 }, d = o[Symbol.iterator](); !(l = (c = d.next()).done); l = !0) f(); 5487 } catch (e) { 5488 u = !0, s = e; 5489 } finally { 5490 try { 5491 !l && d.return && d.return(); 5492 } finally { 5493 if (u) throw s; 5494 } 5495 } 5496 if (this.selected = t.getSelectedButton(n.buttons), this.setSelectedButton(n), n.id) { 5497 this.id = n.id; 5498 var p = this.deepLinkParams.find(function (e) { 5499 return e.key === n.id; 5500 }); 5501 if (p) { 5502 var h = n.buttons.find(function (e) { 5503 var t = e.element.getAttribute("data-value"); 5504 return p.value === t ? e : null; 5505 }); 5506 h && (this.selected = h, this.setSelectedButton(n)); 5507 } 5508 } 5509 } 5510 }, {
5511 key: "getSortOptions", 5512 value: function value() { 5513 return this.selected ? this.selected.getSortOptions() : []; 5514 } 5515 }, { 5516 key: "getDeepLink", 5517 value: function value() { 5518 return this.id && this.selected && this.id + "=" + this.selected.element.getAttribute("data-value") || ""; 5519 } 5520 }, { 5521 key: "setSelectedButton", 5522 value: function value(e) { 5523 var t = this, 5524 r = !0, 5525 n = !1, 5526 o = void 0; 5527 try { 5528 for (var i, a = this.controls[Symbol.iterator](); !(r = (i = a.next()).done); r = !0) { 5529 var l = i.value; 5530 if (l.dropdown) { 5531 var u = e.buttons.find(function (e) { 5532 return t.selected.isEqualTo(e); 5533 }); 5534 u && l.dropdown.setPanelsContent(u.element.textContent); 5535 } 5536 } 5537 } catch (e) { 5538 n = !0, o = e; 5539 } finally { 5540 try { 5541 !r && a.return && a.return(); 5542 } finally { 5543 if (n) throw o; 5544 } 5545 } 5546 } 5547 }], [{ 5548 key: "getSelectedButton", 5549 value: function value(e) { 5550 if (e.length <= 0) return null; 5551 var t = !0, 5552 r = !1, 5553 n = void 0; 5554 try { 5555 for (var o, i = e[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 5556 var a = o.value; 5557 if ("true" === a.element.getAttribute("data-selected")) return a; 5558 } 5559 } catch (e) { 5560 r = !0, n = e; 5561 } finally { 5562 try { 5563 !t && i.return && i.return(); 5564 } finally { 5565 if (r) throw n; 5566 } 5567 } 5568 return e[0]; 5569 } 5570 }]), t; 5571 }(); 5572 t.default = u; 5573}, function (e, t, r) { 5574 "use strict"; 5575 5576 Object.defineProperty(t, "__esModule", { 5577 value: !0 5578 }); 5579 var n = function () { 5580 function e(e, t) { 5581 for (var r = 0; r < t.length; r++) { 5582 var n = t[r]; 5583 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 5584 } 5585 } 5586 return function (t, r, n) { 5587 return r && e(t.prototype, r), n && e(t, n), t; 5588 }; 5589 }(), 5590 o = a(r(2)), 5591 i = a(r(8)); 5592 function a(e) { 5593 return e && e.__esModule ? e : { 5594 default: e 5595 }; 5596 } 5597 var l = function (e) { 5598 function t(e, r) { 5599 var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], 5600 o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null; 5601 !function (e, t) { 5602 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 5603 }(this, t); 5604 var i = function (e, t) { 5605 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 5606 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 5607 }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e, r, n, o)); 5608 return i.group = e, i.name = r, i.options = [], i.selected = "", i.id = "", i; 5609 } 5610 return function (e, t) { 5611 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 5612 e.prototype = Object.create(t && t.prototype, { 5613 constructor: { 5614 value: e, 5615 enumerable: !1, 5616 writable: !0, 5617 configurable: !0 5618 } 5619 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 5620 }(t, o.default), n(t, [{ 5621 key: "addControl", 5622 value: function value(e) { 5623 var r = this, 5624 n = function e(t, r, n) { 5625 null === t && (t = Function.prototype); 5626 var o = Object.getOwnPropertyDescriptor(t, r); 5627 if (void 0 === o) { 5628 var i = Object.getPrototypeOf(t); 5629 return null === i ? void 0 : e(i, r, n); 5630 } 5631 if ("value" in o) return o.value; 5632 var a = o.get; 5633 return void 0 !== a ? a.call(n) : void 0; 5634 }(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "addControl", this).call(this, e), 5635 o = n.element.querySelectorAll("option"), 5636 a = !0, 5637 l = !1, 5638 u = void 0; 5639 try { 5640 for (var s, c = function c() { 5641 var e = s.value; 5642 e.setAttribute("data-name", r.name), e.setAttribute("data-group", r.group), r.options.find(function (t) { 5643 return t.element.value === e.value; 5644 }) || r.options.push(new i.default(e)); 5645 }, f = o[Symbol.iterator](); !(a = (s = f.next()).done); a = !0) c(); 5646 } catch (e) { 5647 l = !0, u = e; 5648 } finally { 5649 try { 5650 !a && f.return && f.return(); 5651 } finally { 5652 if (l) throw u; 5653 } 5654 } 5655 if (this.selected = n.element.value, n.id) { 5656 this.id = n.id; 5657 var d = this.deepLinkParams.find(function (e) { 5658 return e.key === n.id; 5659 }); 5660 d && (n.element.value = d.value, this.selected = d.value); 5661 } 5662 n.element.addEventListener("change", function (e) { 5663 e.preventDefault(), r.selected = e.target.value; 5664 var t = !0, 5665 o = !1, 5666 i = void 0; 5667 try { 5668 for (var a, l = r.controls[Symbol.iterator](); !(t = (a = l.next()).done); t = !0) { 5669 a.value.element.value = r.selected; 5670 } 5671 } catch (e) { 5672 o = !0, i = e; 5673 } finally { 5674 try { 5675 !t && l.return && l.return(); 5676 } finally { 5677 if (o) throw i; 5678 } 5679 } 5680 window.jplist && window.jplist.refresh(r.group, n); 5681 }); 5682 } 5683 }, {
5684 key: "getSortOptions", 5685 value: function value() { 5686 var e = this, 5687 t = this.options.find(function (t) { 5688 return t.element.value === e.selected; 5689 }); 5690 return t ? t.getSortOptions() : []; 5691 } 5692 }, { 5693 key: "getDeepLink", 5694 value: function value() { 5695 var e = this, 5696 t = this.options.find(function (t) { 5697 return t.element.value === e.selected; 5698 }); 5699 return this.id ? this.id + "=" + t.element.value : ""; 5700 } 5701 }]), t; 5702 }(); 5703 t.default = l; 5704}, function (e, t, r) { 5705 "use strict"; 5706 5707 Object.defineProperty(t, "__esModule", { 5708 value: !0 5709 }); 5710 var n, 5711 o = function () { 5712 function e(e, t) { 5713 for (var r = 0; r < t.length; r++) { 5714 var n = t[r]; 5715 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 5716 } 5717 } 5718 return function (t, r, n) { 5719 return r && e(t.prototype, r), n && e(t, n), t; 5720 }; 5721 }(), 5722 i = r(2), 5723 a = (n = i) && n.__esModule ? n : { 5724 default: n 5725 }; 5726 var l = function (e) { 5727 function t(e, r) { 5728 var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], 5729 o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null; 5730 !function (e, t) { 5731 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 5732 }(this, t); 5733 var i = function (e, t) { 5734 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 5735 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 5736 }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e, r, n, o)); 5737 return i.group = e, i.name = r, i.checkboxes = [], i; 5738 } 5739 return function (e, t) { 5740 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 5741 e.prototype = Object.create(t && t.prototype, { 5742 constructor: { 5743 value: e, 5744 enumerable: !1, 5745 writable: !0, 5746 configurable: !0 5747 } 5748 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 5749 }(t, a.default), o(t, [{ 5750 key: "addControl", 5751 value: function value(e) { 5752 var r = this, 5753 n = function e(t, r, n) { 5754 null === t && (t = Function.prototype); 5755 var o = Object.getOwnPropertyDescriptor(t, r); 5756 if (void 0 === o) { 5757 var i = Object.getPrototypeOf(t); 5758 return null === i ? void 0 : e(i, r, n); 5759 } 5760 if ("value" in o) return o.value; 5761 var a = o.get; 5762 return void 0 !== a ? a.call(n) : void 0; 5763 }(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "addControl", this).call(this, e); 5764 if (n.selected = n.element.checked, n.id) { 5765 var o = this.deepLinkParams.find(function (e) { 5766 return e.key === n.id; 5767 }); 5768 o && (n.selected = "1" === o.value); 5769 } 5770 this.checkboxes.push(n), this.handleCheckboxes(), n.element.addEventListener("change", function (e) { 5771 e.preventDefault(), n.selected = !n.selected, r.checkboxes.forEach(function (e) { 5772 e.isEqualTo(n) && (e.selected = n.selected); 5773 }), r.handleCheckboxes(), window.jplist && window.jplist.refresh(r.group, n); 5774 }); 5775 } 5776 }, { 5777 key: "handleCheckboxes", 5778 value: function value() { 5779 var e = !0, 5780 t = !1, 5781 r = void 0; 5782 try { 5783 for (var n, o = this.checkboxes[Symbol.iterator](); !(e = (n = o.next()).done); e = !0) { 5784 var i = n.value; 5785 i.selected ? i.element.classList.add("jplist-selected") : i.element.classList.remove("jplist-selected"), i.element.checked = i.selected; 5786 } 5787 } catch (e) { 5788 t = !0, r = e; 5789 } finally { 5790 try { 5791 !e && o.return && o.return(); 5792 } finally { 5793 if (t) throw r; 5794 } 5795 } 5796 } 5797 }, {
5798 key: "getSortOptions", 5799 value: function value() { 5800 var e = [], 5801 t = !1, 5802 r = !0, 5803 n = !1, 5804 o = void 0; 5805 try { 5806 for (var i, a = this.checkboxes[Symbol.iterator](); !(r = (i = a.next()).done); r = !0) { 5807 var l = i.value; 5808 l.selected ? e = e.concat(l.getSortOptions()) : t = !0; 5809 } 5810 } catch (e) { 5811 n = !0, o = e; 5812 } finally { 5813 try { 5814 !r && a.return && a.return(); 5815 } finally { 5816 if (n) throw o; 5817 } 5818 } 5819 return t && (e = e.concat([{ 5820 path: "default" 5821 }])), e; 5822 } 5823 }, { 5824 key: "getDeepLink", 5825 value: function value() { 5826 var e = this.checkboxes.map(function (e) { 5827 return e.id ? e.selected ? e.id + "=1" : e.id + "=0" : ""; 5828 }).filter(function (e) { 5829 return "" !== e; 5830 }); 5831 return Array.from(new Set(e)).join("&"); 5832 } 5833 }]), t; 5834 }(); 5835 t.default = l; 5836}, function (e, t, r) { 5837 "use strict"; 5838 5839 Object.defineProperty(t, "__esModule", { 5840 value: !0 5841 }); 5842 var n, 5843 o = function () { 5844 function e(e, t) { 5845 for (var r = 0; r < t.length; r++) { 5846 var n = t[r]; 5847 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 5848 } 5849 } 5850 return function (t, r, n) { 5851 return r && e(t.prototype, r), n && e(t, n), t; 5852 }; 5853 }(), 5854 i = r(2), 5855 a = (n = i) && n.__esModule ? n : { 5856 default: n 5857 }; 5858 var l = function (e) { 5859 function t(e, r) { 5860 var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], 5861 o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null; 5862 !function (e, t) { 5863 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 5864 }(this, t); 5865 var i = function (e, t) { 5866 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 5867 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 5868 }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e, r, n, o)); 5869 return i.group = e, i.name = r, i.radios = [], i; 5870 } 5871 return function (e, t) { 5872 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 5873 e.prototype = Object.create(t && t.prototype, { 5874 constructor: { 5875 value: e, 5876 enumerable: !1, 5877 writable: !0, 5878 configurable: !0 5879 } 5880 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 5881 }(t, a.default), o(t, [{ 5882 key: "addControl", 5883 value: function value(e) { 5884 var r = this, 5885 n = function e(t, r, n) { 5886 null === t && (t = Function.prototype); 5887 var o = Object.getOwnPropertyDescriptor(t, r); 5888 if (void 0 === o) { 5889 var i = Object.getPrototypeOf(t); 5890 return null === i ? void 0 : e(i, r, n); 5891 } 5892 if ("value" in o) return o.value; 5893 var a = o.get; 5894 return void 0 !== a ? a.call(n) : void 0; 5895 }(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "addControl", this).call(this, e); 5896 if (n.selected = n.element.checked, n.id) { 5897 var o = this.deepLinkParams.find(function (e) { 5898 return e.key === n.id; 5899 }); 5900 o && (n.selected = "1" === o.value); 5901 } 5902 this.radios.push(n), this.handleRadios(), n.element.addEventListener("change", function (e) { 5903 e.preventDefault(); 5904 var t = !0, 5905 o = !1, 5906 i = void 0; 5907 try { 5908 for (var a, l = r.radios[Symbol.iterator](); !(t = (a = l.next()).done); t = !0) { 5909 a.value.selected = !1; 5910 } 5911 } catch (e) { 5912 o = !0, i = e; 5913 } finally { 5914 try { 5915 !t && l.return && l.return(); 5916 } finally { 5917 if (o) throw i; 5918 } 5919 } 5920 n.selected = !0, r.handleRadios(), window.jplist && window.jplist.refresh(r.group, n); 5921 }); 5922 } 5923 }, {
5924 key: "getLastSelectedRadio", 5925 value: function value() { 5926 var e = null, 5927 t = !0, 5928 r = !1, 5929 n = void 0; 5930 try { 5931 for (var o, i = this.radios[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 5932 var a = o.value; 5933 a.selected && (e = a); 5934 } 5935 } catch (e) { 5936 r = !0, n = e; 5937 } finally { 5938 try { 5939 !t && i.return && i.return(); 5940 } finally { 5941 if (r) throw n; 5942 } 5943 } 5944 return e; 5945 } 5946 }, { 5947 key: "handleRadios", 5948 value: function value() { 5949 if (this.radios.length > 0) { 5950 var e = this.getLastSelectedRadio(), 5951 t = !0, 5952 r = !1, 5953 n = void 0; 5954 try { 5955 for (var o, i = this.radios[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 5956 var a = o.value; 5957 a.selected = !1, a.element.classList.remove("jplist-selected"); 5958 } 5959 } catch (e) { 5960 r = !0, n = e; 5961 } finally { 5962 try { 5963 !t && i.return && i.return(); 5964 } finally { 5965 if (r) throw n; 5966 } 5967 } 5968 e && this.radios.forEach(function (t) { 5969 t.isEqualTo(e) && (t.selected = !0, t.element.checked = !0, t.element.classList.add("jplist-selected")); 5970 }); 5971 } 5972 } 5973 }, { 5974 key: "getSortOptions", 5975 value: function value() { 5976 var e = [], 5977 t = this.getLastSelectedRadio(); 5978 return t && (e = e.concat(t.getSortOptions())), e; 5979 } 5980 }, { 5981 key: "getDeepLink", 5982 value: function value() { 5983 var e = this.radios.map(function (e) { 5984 return e.id && e.selected ? e.id + "=1" : ""; 5985 }).filter(function (e) { 5986 return "" !== e; 5987 }); 5988 return Array.from(new Set(e)).join("&"); 5989 } 5990 }]), t; 5991 }(); 5992 t.default = l; 5993}, function (e, t, r) { 5994 "use strict"; 5995 5996 Object.defineProperty(t, "__esModule", { 5997 value: !0 5998 }); 5999 var n, 6000 o = function () { 6001 function e(e, t) { 6002 for (var r = 0; r < t.length; r++) { 6003 var n = t[r]; 6004 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 6005 } 6006 } 6007 return function (t, r, n) { 6008 return r && e(t.prototype, r), n && e(t, n), t; 6009 }; 6010 }(), 6011 i = r(2), 6012 a = (n = i) && n.__esModule ? n : { 6013 default: n 6014 }; 6015 var l = function (e) { 6016 function t(e, r) { 6017 var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : [], 6018 o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : null; 6019 !function (e, t) { 6020 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 6021 }(this, t); 6022 var i = function (e, t) { 6023 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 6024 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 6025 }(this, (t.__proto__ || Object.getPrototypeOf(t)).call(this, e, r, n, o)); 6026 return i.group = e, i.name = r, i.checkboxes = [], i.radios = [], i; 6027 } 6028 return function (e, t) { 6029 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 6030 e.prototype = Object.create(t && t.prototype, { 6031 constructor: { 6032 value: e, 6033 enumerable: !1, 6034 writable: !0, 6035 configurable: !0 6036 } 6037 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 6038 }(t, a.default), o(t, [{ 6039 key: "addControl", 6040 value: function value(e) { 6041 var r = this, 6042 n = function e(t, r, n) { 6043 null === t && (t = Function.prototype); 6044 var o = Object.getOwnPropertyDescriptor(t, r); 6045 if (void 0 === o) { 6046 var i = Object.getPrototypeOf(t); 6047 return null === i ? void 0 : e(i, r, n); 6048 } 6049 if ("value" in o) return o.value; 6050 var a = o.get; 6051 return void 0 !== a ? a.call(n) : void 0; 6052 }(t.prototype.__proto__ || Object.getPrototypeOf(t.prototype), "addControl", this).call(this, e); 6053 if (n.selected = "true" === n.element.getAttribute("data-selected"), n.mode = n.element.getAttribute("data-mode") || "radio", n.id) { 6054 var o = this.deepLinkParams.find(function (e) { 6055 return e.key === n.id; 6056 }); 6057 o && (n.selected = "1" === o.value); 6058 } 6059 "radio" === n.mode && (this.radios.push(n), this.handleRadios()), "checkbox" === n.mode && (this.checkboxes.push(n), this.handleCheckboxes()), n.element.addEventListener("click", function (e) { 6060 if (e.preventDefault(), "checkbox" === n.mode && (n.selected = !n.selected, r.checkboxes.forEac
6060h(function (e) { 6061 e.isEqualTo(n) && (e.selected = n.selected); 6062 }), r.handleCheckboxes()), "radio" === n.mode) { 6063 var t = !0, 6064 o = !1, 6065 i = void 0; 6066 try { 6067 for (var a, l = r.radios[Symbol.iterator](); !(t = (a = l.next()).done); t = !0) { 6068 a.value.selected = !1; 6069 } 6070 } catch (e) { 6071 o = !0, i = e; 6072 } finally { 6073 try { 6074 !t && l.return && l.return(); 6075 } finally { 6076 if (o) throw i; 6077 } 6078 } 6079 n.selected = !0, r.handleRadios(); 6080 } 6081 window.jplist && window.jplist.refresh(r.group, n); 6082 }); 6083 } 6084 }, { 6085 key: "handleCheckboxes", 6086 value: function value() { 6087 var e = !0, 6088 t = !1, 6089 r = void 0; 6090 try { 6091 for (var n, o = this.checkboxes[Symbol.iterator](); !(e = (n = o.next()).done); e = !0) { 6092 var i = n.value; 6093 i.selected ? i.element.classList.add("jplist-selected") : i.element.classList.remove("jplist-selected"); 6094 } 6095 } catch (e) { 6096 t = !0, r = e; 6097 } finally { 6098 try { 6099 !e && o.return && o.return(); 6100 } finally { 6101 if (t) throw r; 6102 } 6103 } 6104 } 6105 }, { 6106 key: "getLastSelectedRadio", 6107 value: function value() { 6108 var e = null, 6109 t = !0, 6110 r = !1, 6111 n = void 0; 6112 try { 6113 for (var o, i = this.radios[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 6114 var a = o.value; 6115 a.selected && (e = a); 6116 } 6117 } catch (e) { 6118 r = !0, n = e; 6119 } finally { 6120 try { 6121 !t && i.return && i.return(); 6122 } finally { 6123 if (r) throw n; 6124 } 6125 } 6126 return e; 6127 } 6128 }, { 6129 key: "handleRadios", 6130 value: function value() { 6131 if (this.radios.length > 0) { 6132 var e = this.getLastSelectedRadio(), 6133 t = !0, 6134 r = !1, 6135 n = void 0; 6136 try { 6137 for (var o, i = this.radios[Symbol.iterator](); !(t = (o = i.next()).done); t = !0) { 6138 var a = o.value; 6139 a.selected = !1, a.element.classList.remove("jplist-selected"); 6140 } 6141 } catch (e) { 6142 r = !0, n = e; 6143 } finally { 6144 try { 6145 !t && i.return && i.return(); 6146 } finally { 6147 if (r) throw n; 6148 } 6149 } 6150 e && this.radios.forEach(function (t) { 6151 t.isEqualTo(e) && (t.selected = !0, t.element.checked = !0, t.element.classList.add("jplist-selected")); 6152 }); 6153 } 6154 } 6155 }, { 6156 key: "getSortOptions", 6157 value: function value() { 6158 var e = [], 6159 t = !1, 6160 r = !0, 6161 n = !1, 6162 o = void 0; 6163 try { 6164 for (var i, a = this.checkboxes[Symbol.iterator](); !(r = (i = a.next()).done); r = !0) { 6165 var l = i.value; 6166 l.selected ? e = e.concat(l.getSortOptions()) : t = !0; 6167 } 6168 } catch (e) { 6169 n = !0, o = e; 6170 } finally { 6171 try { 6172 !r && a.return && a.return(); 6173 } finally { 6174 if (n) throw o; 6175 } 6176 } 6177 t && (e = e.concat([{ 6178 path: "default" 6179 }])); 6180 var u = this.getLastSelectedRadio(); 6181 return u && (e = e.concat(u.getSortOptions())), e; 6182 } 6183 }, { 6184 key: "getDeepLink", 6185 value: function value() { 6186 var e = this.checkboxes.map(function (e) { 6187 return e.id && e.selected ? e.id + "=1" : ""; 6188 }).filter(function (e) { 6189 return "" !== e; 6190 }), 6191 t = this.radios.map(function (e) { 6192 return e.id && e.selected ? e.id + "=1" : ""; 6193 }).filter(function (e) { 6194 return "" !== e; 6195 }), 6196 r = e.concat(t); 6197 return Array.from(new Set(r)).join("&"); 6198 } 6199 }]), t; 6200 }(); 6201 t.default = l; 6202}, function (e, t, r) { 6203 "use strict"; 6204 6205 Object.defineProperty(t, "__esModule", { 6206 value: !0 6207 }); 6208 var n, 6209 o = r(2), 6210 i = (n = o) && n.__esModule ? n : { 6211 default: n 6212 }; 6213 var a = function (e) { 6214 function t() { 6215 return function (e, t) { 6216 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 6217 }(this, t), function (e, t) { 6218 if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 6219 return !t || "object" != _typeof(t) && "function" != typeof t ? e : t; 6220 }(this, (t.__proto__ || Object.getPrototypeOf(t)).apply(this, arguments)); 6221 } 6222 return function (e, t) { 6223 if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + _typeof(t)); 6224 e.prototype = Object.create(t && t.prototype, { 6225 constructor: { 6226 value: e, 6227 enumerable: !1, 6228 writable: !0, 6229 configurable: !0 6230 } 6231 }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t); 6232 }(t, i.default), t; 6233 }(); 6234 t.default = a; 6235}, function (e, t, r) { 6236 "use strict"; 6237 6238 Object.defineProperty(t, "__esModule", { 6239 value: !0 6240 }); 6241 var n = function () { 6242 function e(e, t) { 6243 for (var r = 0; r < t.length; r++) { 6244 var n = t[r]; 6245 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 6246 } 6247 } 6248 return function (t, r, n) { 6249 return r && e(t.prototype, r), n && e(t, n), t; 6250 }; 6251 }(); 6252 var o = function () { 6253 function e() { 6254 !function (e, t) { 6255 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 6256 }(this, e); 6257 } 6258 return n(e, null, [{ 6259 key: "isSupported", 6260 value: function value(e) { 6261 if ("cookies" === e) return !0; 6262 try { 6263 return e in window && null !== window[e]; 6264 } catch (e) { 6265 return !1; 6266 } 6267 } 6268 }, {
6269 key: "set", 6270 value: function value(t, r, n) { 6271 var o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : -1; 6272 if ("cookies" === r) { 6273 var i = encodeURIComponent(t), 6274 a = new Date(); 6275 -1 === (o = Number(o) || -1) ? document.cookie = name + "=" + i + ";path=/;" : (a.setMinutes(a.getMinutes() + o), document.cookie = name + "=" + i + ";path=/; expires=" + a.toUTCString()); 6276 } else e.isSupported(r) && (window[r][n] = t); 6277 } 6278 }, { 6279 key: "get", 6280 value: function value(t, r) { 6281 var n = ""; 6282 if ("cookies" === t) for (var o = document.cookie.split(";"), i = 0; i < o.length; i++) { 6283 var a = o[i].substr(0, o[i].indexOf("=")), 6284 l = o[i].substr(o[i].indexOf("=") + 1); 6285 if ((a = a.replace(/^\s+|\s+$/g, "")) === r) { 6286 n = decodeURIComponent(l); 6287 break; 6288 } 6289 } else e.isSupported(t) && (n = window[t][r] || ""); 6290 return n; 6291 } 6292 }]), e; 6293 }(); 6294 t.default = o; 6295}, function (e, t, r) { 6296 "use strict"; 6297 6298 Object.defineProperty(t, "__esModule", { 6299 value: !0 6300 }); 6301 var n = function () { 6302 function e(e, t) { 6303 for (var r = 0; r < t.length; r++) { 6304 var n = t[r]; 6305 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 6306 } 6307 } 6308 return function (t, r, n) { 6309 return r && e(t.prototype, r), n && e(t, n), t; 6310 }; 6311 }(); 6312 var o = function () { 6313 function e() { 6314 !function (e, t) { 6315 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 6316 }(this, e); 6317 } 6318 return n(e, null, [{ 6319 key: "getParam", 6320 value: function value(e) { 6321 if (!e) return null; 6322 var t = e.split("="); 6323 return t.length < 2 ? null : { 6324 key: t[0].trim().toLowerCase(), 6325 value: t[1].trim().toLowerCase() 6326 }; 6327 } 6328 }, { 6329 key: "getUrlParams", 6330 value: function value(t) { 6331 var r = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "#", 6332 n = new Map(); 6333 if (!t) return n; 6334 var o = window.decodeURIComponent(t.replace(r, "")).trim().toLowerCase(); 6335 if (!o) return n; 6336 var i = o.split("&"), 6337 a = "", 6338 l = !0, 6339 u = !1, 6340 s = void 0; 6341 try { 6342 for (var c, f = i[Symbol.iterator](); !(l = (c = f.next()).done); l = !0) { 6343 var d = c.value, 6344 p = e.getParam(d); 6345 if (p) if ("group" === p.key) a = p.value, n.has(p.value) || n.set(p.value, []);else { 6346 var h = n.get(a); 6347 h && h.push(p), n.set(a, h); 6348 } 6349 } 6350 } catch (e) { 6351 u = !0, s = e; 6352 } finally { 6353 try { 6354 !l && f.return && f.return(); 6355 } finally { 6356 if (u) throw s; 6357 } 6358 } 6359 return n; 6360 } 6361 }]), e; 6362 }(); 6363 t.default = o; 6364}, function (e, t, r) { 6365 "use strict"; 6366 6367 Object.defineProperty(t, "__esModule", { 6368 value: !0 6369 }); 6370 t.default = function e(t, r, n, o) { 6371 !function (e, t) { 6372 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 6373 }(this, e), this.itemsNumber = Number(n) || 0, this.itemsPerPage = Number.isInteger(r) ? Number(r) : this.itemsNumber, 0 === this.itemsPerPage && (this.itemsPerPage = n), this.pagesNumber = 0 === this.itemsPerPage ? 0 : Math.ceil(this.itemsNumber / this.itemsPerPage), this.currentPage = Number(t) || 0, this.currentPage > this.pagesNumber - 1 && (this.currentPage = 0), this.start = this.currentPage * this.itemsPerPage, this.end = this.start + this.itemsPerPage, this.end > this.itemsNumber && (this.end = this.itemsNumber), this.prevPage = this.currentPage <= 0 ? 0 : this.currentPage - 1, this.nextPage = 0 === this.pagesNumber ? 0 : this.currentPage >= this.pagesNumber - 1 ? this.pagesNumber - 1 : this.currentPage + 1, this.range = Number(o) || 10; 6374 var i = Math.ceil((this.range - 1) / 2); 6375 this.rangeStart = this.currentPage - i, this.rangeEnd = Math.min(this.rangeStart + this.range - 1, this.pagesNumber - 1), this.rangeStart <= 0 && (this.rangeStart = 0, this.rangeEnd = Math.min(this.range - 1, this.pagesNumber - 1)), this.rangeEnd >= this.pagesNumber - 1 && (this.rangeStart = Math.max(this.pagesNumber - this.range, 0), this.rangeEnd = this.pagesNumber - 1); 6376 }; 6377}, function (e, t, r) { 6378 "use strict"; 6379 6380 Object.defineProperty(t, "__esModule", { 6381 value: !0 6382 }); 6383 var n = function () { 6384 function e(e, t) { 6385 for (var r = 0; r < t.length; r++) { 6386 var n = t[r]; 6387 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 6388 } 6389 } 6390 return function (t, r, n) { 6391 return r && e(t.prototype, r), n && e(t, n), t; 6392 }; 6393 }(); 6394 var o = function () { 6395 function e() { 6396 !function (e, t) { 6397 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 6398 }(this, e); 6399 } 6400 return n(e, null, [{ 6401 key: "sort", 6402 value: function value(t, r) { 6403 return !r || r.length <= 0 ? (t.sort(function (t, r) { 6404 return e.sortByIndex(t, r); 6405 }), t) : (t.sort(function (t, n) { 6406 return e.sortHelper(t, n, r, 0); 6407 }), t); 6408 } 6409 }, {
6410 key: "sortHelper", 6411 value: function value(t, r, n, o) { 6412 if (!n || n.length <= 0 || o >= n.length) return 0; 6413 var i = 0, 6414 a = n[o]; 6415 if ("default" !== a.path) switch (a.dataType) { 6416 case "number": 6417 i = e.sortNumbers(t, r, a.path, a.order); 6418 break; 6419 case "datetime": 6420 i = e.sortDateTime(t, r, a.path, a.order, a.dateTimeFormat); 6421 break; 6422 default: 6423 i = e.sortText(t, r, a.path, a.order, a.ignoreRegex); 6424 } else i = e.sortByIndex(t, r); 6425 return 0 === i && o + 1 < n.length && (i = e.sortHelper(t, r, n, o + 1)), i; 6426 } 6427 }, { 6428 key: "sortText", 6429 value: function value(e, t) { 6430 var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "", 6431 n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : "asc", 6432 o = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : ""; 6433 if (!e || !t) return 0; 6434 var i = r ? e.querySelector(r) : e, 6435 a = r ? t.querySelector(r) : t; 6436 if (!i || !a) return 0; 6437 var l = i.textContent.trim().toLowerCase(), 6438 u = a.textContent.trim().toLowerCase(); 6439 if (o) { 6440 var s = new RegExp(o, "ig"); 6441 l = l.replace(s, "").trim(), u = u.replace(s, "").trim(); 6442 } 6443 return l === u ? 0 : (n || (n = "asc"), "".localeCompare ? "asc" === n ? l.localeCompare(u) : u.localeCompare(l) : "asc" === n ? l > u ? 1 : -1 : l < u ? 1 : -1); 6444 } 6445 }, { 6446 key: "sortNumbers", 6447 value: function value(e, t) { 6448 var r = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "", 6449 n = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : "asc"; 6450 if (!e || !t) return 0; 6451 var o = r ? e.querySelector(r) : e, 6452 i = r ? t.querySelector(r) : t; 6453 if (!o || !i) return 0; 6454 var a = o.textContent.trim().toLowerCase(), 6455 l = i.textContent.trim().toLowerCase(); 6456 return a = parseFloat(a.replace(/[^-0-9.]+/g, "")), l = parseFloat(l.replace(/[^-0-9.]+/g, "")), isNaN(a) || isNaN(l) ? isNaN(a) && isNaN(l) ? 0 : isNaN(a) ? 1 : -1 : a === l ? 0 : (n || (n = "asc"), "asc" === n ? a - l : l - a); 6457 } 6458 }, { 6459 key: "sortByIndex", 6460 value: function value(e, t) { 6461 if (!e || !t) return 0; 6462 var r = Number(e.jplistIndex), 6463 n = Number(t.jplistIndex); 6464 return isNaN(r) || isNaN(n) ? 0 : r - n; 6465 } 6466 }, { 6467 key: "sortDateTime", 6468 value: function value(t, r) { 6469 var n = arguments.length > 2 && void 0 !== arguments[2] ? arguments[2] : "", 6470 o = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : "asc", 6471 i = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : ""; 6472 if (!t || !r) return 0; 6473 var a = n ? t.querySelector(n) : t, 6474 l = n ? r.querySelector(n) : r; 6475 if (!a || !l) return 0; 6476 var u = a.textContent.trim().toLowerCase(), 6477 s = l.textContent.trim().toLowerCase(), 6478 c = void 0, 6479 f = void 0; 6480 return (i = i.trim()) ? (c = e.getDateFromString(u, i), f = e.getDateFromString(s, i)) : (c = new Date(Date.parse(u)), f = new Date(Date.parse(s))), c.getTime() === f.getTime() ? 0 : (o || (o = "asc"), "asc" === o ? c.getTime() > f.getTime() ? 1 : -1 : c.getTime() < f.getTime() ? 1 : -1); 6481 } 6482 }, { 6483 key: "getDateFromString", 6484 value: function value(t, r) { 6485 r = (r = (r = (r = (r = r.replace(/\./g, "\\.")).replace(/\(/g, "\\(")).replace(/\)/g, "\\)")).replace(/\[/g, "\\[")).replace(/\]/g, "\\]"); 6486 var n = e.getDateWildcardValue(r, "{year}", t); 6487 n = Number(n) || 1900; 6488 var o = e.getDateWildcardValue(r, "{day}", t); 6489 o = Number(o) || 1; 6490 var i = e.getDateWildcardValue(r, "{month}", t); 6491 -1 === (i = e.getMonthByWildcard(i)) && (i = 0); 6492 var a = e.getDateWildcardValue(r, "{hour}", t); 6493 a = Number(a) || 0; 6494 var l = e.getDateWildcardValue(r, "{min}", t); 6495 l = Number(l) || 0; 6496 var u = e.getDateWildcardValue(r, "{sec}", t); 6497 return u = Number(u) || 0, new Date(n, i, o, a, l, u); 6498 } 6499 }, {
6500 key: "getDateWildcardValue", 6501 value: function value(e, t, r) { 6502 var n = null, 6503 o = e.replace(t, "(.*)").replace(/{year}|{month}|{day}|{hour}|{min}|{sec}/g, ".*"), 6504 i = new RegExp(o, "g").exec(r); 6505 return i && i.length > 1 && (n = i[1]), n; 6506 } 6507 }, { 6508 key: "getMonthByWildcard", 6509 value: function value(t) { 6510 t = t ? t.trim().toLowerCase() : ""; 6511 var r = Number(t); 6512 return isNaN(r) ? e.months.findIndex(function (e) { 6513 return e.find(function (e) { 6514 return e.trim() === t; 6515 }); 6516 }) : r - 1 < 0 ? -1 : r - 1; 6517 } 6518 }, { 6519 key: "months", 6520 get: function get() { 6521 return [["january", "jan", "jan."], ["february", "feb", "feb."], ["march", "mar", "mar."], ["april", "apr", "apr."], ["may"], ["june", "jun."], ["july", "jul", "jul."], ["august", "aug", "aug."], ["september", "sep", "sep."], ["october", "oct", "oct."], ["november", "nov", "nov."], ["december", "dec", "dec."]]; 6522 } 6523 }]), e; 6524 }(); 6525 t.default = o; 6526}, function (e, t, r) { 6527 "use strict"; 6528 6529 Object.defineProperty(t, "__esModule", { 6530 value: !0 6531 }); 6532 var n = function () { 6533 return function (e, t) { 6534 if (Array.isArray(e)) return e; 6535 if (Symbol.iterator in Object(e)) return function (e, t) { 6536 var r = [], 6537 n = !0, 6538 o = !1, 6539 i = void 0; 6540 try { 6541 for (var a, l = e[Symbol.iterator](); !(n = (a = l.next()).done) && (r.push(a.value), !t || r.length !== t); n = !0); 6542 } catch (e) { 6543 o = !0, i = e; 6544 } finally { 6545 try { 6546 !n && l.return && l.return(); 6547 } finally { 6548 if (o) throw i; 6549 } 6550 } 6551 return r; 6552 }(e, t); 6553 throw new TypeError("Invalid attempt to destructure non-iterable instance"); 6554 }; 6555 }(), 6556 o = function () { 6557 function e(e, t) { 6558 for (var r = 0; r < t.length; r++) { 6559 var n = t[r]; 6560 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 6561 } 6562 } 6563 return function (t, r, n) { 6564 return r && e(t.prototype, r), n && e(t, n), t; 6565 }; 6566 }(), 6567 i = f(r(43)), 6568 a = f(r(42)), 6569 l = f(r(1)), 6570 u = f(r(41)), 6571 s = f(r(40)), 6572 c = f(r(14)); 6573 function f(e) { 6574 return e && e.__esModule ? e : { 6575 default: e 6576 }; 6577 } 6578 function d(e) { 6579 if (Array.isArray(e)) { 6580 for (var t = 0, r = Array(e.length); t < e.length; t++) r[t] = e[t]; 6581 return r; 6582 } 6583 return Array.from(e); 6584 } 6585 var p = function () { 6586 function e() { 6587 !function (e, t) { 6588 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 6589 }(this, e); 6590 } 6591 return o(e, null, [{ 6592 key: "apply", 6593 value: function value(t, r, o) { 6594 var l = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : "", 6595 u = arguments.length > 4 && void 0 !== arguments[4] ? arguments[4] : void 0; 6596 if (r && o) { 6597 var c = [{ 6598 options: "pathFilterOptions", 6599 name: "pathFilter" 6600 }, { 6601 options: "rangeFilterOptions", 6602 name: "rangeFilter" 6603 }, { 6604 options: "textFilterOptions", 6605 name: "textFilter" 6606 }], 6607 f = !0, 6608 d = !1, 6609 p = void 0; 6610 try { 6611 for (var h, v = o[Symbol.iterator](); !(f = (h = v.next()).done); f = !0) { 6612 var y = n(h.value, 2), 6613 b = y[0], 6614 m = y[1]; 6615 if (l && l === b || !l) { 6616 var g = r.get(b), 6617 w = e.collectControlsOptions(g), 6618 O = !0, 6619 _ = !1, 6620 j = void 0; 6621 try { 6622 for (var P, k = m[Symbol.iterator](); !(O = (P = k.next()).done); O = !0) { 6623 var x = P.value, 6624 S = x.items.length, 6625 C = e.getItemsFragment(x.items); 6626 w.sortOptions && w.sortOptions.length > 0 && (i.default.sort(x.items, w.sortOptions), C = e.getItemsFragment(x.items)); 6627 var E = x.items, 6628 L = !0, 6629 T = !1, 6630 A = void 0; 6631 try { 6632 for (var N, M = c[Symbol.iterator](); !(L = (N = M.next()).done); L = !0) { 6633 var F = N.value, 6634 D = F.options; 6635 if (w[D]) { 6636 var R = e.splitByLogic(w[D]); 6637 for (var B in E = e.handleFilter(E, R.and, "and", F.name), R.or) E = e.handleFilter(E, R.or[B], "or", F.name); 6638 S = E.length, C = e.getItemsFragment(E); 6639 } 6640 } 6641 } catch (e) { 6642 T = !0, A = e; 6643 } finally { 6644 try { 6645 !L && M.return && M.return(); 6646 } finally { 6647 if (T) throw A; 6648 } 6649 } 6650 if (w.paginationOptions) { 6651 var q = new a.default(w.paginationOptions.currentPage, w.paginationOptions.itemsPerPage, E.length, w.paginationOptions.range); 6652 if (g.length > 0) { 6653 var I = !0, 6654 H = !1, 6655 V = void 0; 6656 try { 6657 for (var W, G = g[Symbol.iterator](); !(I = (W = G.next()).done); I = !0) { 6658 var z = W.value; 6659 z.setPaginationOptions && z.setPaginationOptions(q); 6660 } 6661 } catch (e) { 6662 H = !0, V = e; 6663 } finally { 6664 try { 6665 !I && G.return && G.return(); 6666 } finally { 6667 if (H) throw V; 6668 } 6669 } 6670 } 6671 var U = E.slice(q.start, q.end); 6672 S = U.length, C = e.getItemsFragment(U); 6673 } 6674 x.root.appendChild(C), e.sendStateEvent(w, S, g, o, E); 6675 } 6676 } catch (e) { 6677 _ = !0, j = e; 6678 } finally { 6679 try { 6680 !O && k.return && k.return(); 6681 } finally { 6682 if (_) throw j; 6683 } 6684 } 6685 e.jump(g, u); 6686 } 6687 } 6688 } catch (e) { 6689 d = !0, p = e; 6690 } finally { 6691 try { 6692 !f && v.return && v.return(); 6693 } finally { 6694 if (d) throw p; 6695 } 6696 } 6697 t.deepLinking ? e.updateDeepLink(e.getDeepLink(r, o), t.hashStart) : t.storage && s.default.set(e.getDeepLink(r, o), t.storage, t.storageName, t.cookiesExpiration); 6698 } 6699 } 6700 }, {
6701 key: "performFilter", 6702 value: function value(e, t, r) { 6703 switch (r) { 6704 case "textFilter": 6705 return c.default.textFilter(t, e.text, e.path, e.mode, e.ignoreRegex); 6706 case "pathFilter": 6707 return c.default.pathFilter(t, e.path, e.isInverted); 6708 case "rangeFilter": 6709 return c.default.rangeFilter(t, e.path, e.from, e.to, e.min, e.max); 6710 } 6711 return t; 6712 } 6713 }, { 6714 key: "handleFilter", 6715 value: function value(t, r, n, o) { 6716 if (r.length <= 0) return t; 6717 if ("and" === n) { 6718 var i = !0, 6719 a = !1, 6720 l = void 0; 6721 try { 6722 for (var u, s = r[Symbol.iterator](); !(i = (u = s.next()).done); i = !0) { 6723 var c = u.value; 6724 t = e.performFilter(c, t, o); 6725 } 6726 } catch (e) { 6727 a = !0, l = e; 6728 } finally { 6729 try { 6730 !i && s.return && s.return(); 6731 } finally { 6732 if (a) throw l; 6733 } 6734 } 6735 } 6736 if ("or" === n) { 6737 var f = new Set(), 6738 p = !0, 6739 h = !1, 6740 v = void 0; 6741 try { 6742 for (var y, b = r[Symbol.iterator](); !(p = (y = b.next()).done); p = !0) { 6743 var m = y.value, 6744 g = e.performFilter(m, t, o); 6745 f = new Set([].concat(d(f), d(g))); 6746 } 6747 } catch (e) { 6748 h = !0, v = e; 6749 } finally { 6750 try { 6751 !p && b.return && b.return(); 6752 } finally { 6753 if (h) throw v; 6754 } 6755 } 6756 t = Array.from(f); 6757 } 6758 return t; 6759 } 6760 }, { 6761 key: "splitByLogic", 6762 value: function value(e) { 6763 var t = { 6764 and: [], 6765 or: {} 6766 }, 6767 r = !0, 6768 n = !1, 6769 o = void 0; 6770 try { 6771 for (var i, a = e[Symbol.iterator](); !(r = (i = a.next()).done); r = !0) { 6772 var l = i.value, 6773 u = l.or; 6774 u ? void 0 === t.or[u] ? t.or[u] = [l] : t.or[u].push(l) : t.and.push(l); 6775 } 6776 } catch (e) { 6777 n = !0, o = e; 6778 } finally { 6779 try { 6780 !r && a.return && a.return(); 6781 } finally { 6782 if (n) throw o; 6783 } 6784 } 6785 return t; 6786 } 6787 }, { 6788 key: "jump", 6789 value: function value(e) { 6790 var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : void 0; 6791 if (t && t.jump) { 6792 var r = -1; 6793 if ("top" === t.jump) r = 0;else { 6794 var n = document.querySelector(t.jump); 6795 if (!n) return; 6796 var o = n.getBoundingClientRect(); 6797 if (!n.width && !n.height && !n.getClientRects().length) return; 6798 var i = document.clientTop || document.body.clientTop || 0; 6799 r < 0 ? r = o.top + window.pageYOffset - i : o.top + window.pageYOffset - i < r && (r = o.top + window.pageYOffset - i); 6800 } 6801 r >= 0 && window.scroll(0, r); 6802 } 6803 } 6804 }, { 6805 key: "sendStateEvent", 6806 value: function value(e, t, r, n, o) { 6807 if (r) { 6808 var i = new CustomEvent("jplist.state"); 6809 i.jplistState = { 6810 options: e, 6811 itemsNumber: t, 6812 groups: n, 6813 filtered: o 6814 }; 6815 var a = !0, 6816 l = !1, 6817 u = void 0; 6818 try { 6819 for (var s, c = r[Symbol.iterator](); !(a = (s = c.next()).done); a = !0) { 6820 var f = s.value, 6821 d = !0, 6822 p = !1, 6823 h = void 0; 6824 try { 6825 for (var v, y = f.controls[Symbol.iterator](); !(d = (v = y.next()).done); d = !0) { 6826 v.value.element.dispatchEvent(i); 6827 } 6828 } catch (e) { 6829 p = !0, h = e; 6830 } finally { 6831 try { 6832 !d && y.return && y.return(); 6833 } finally { 6834 if (p) throw h; 6835 } 6836 } 6837 } 6838 } catch (e) { 6839 l = !0, u = e; 6840 } finally { 6841 try { 6842 !a && c.return && c.return(); 6843 } finally { 6844 if (l) throw u; 6845 } 6846 } 6847 } 6848 } 6849 }, {
6850 key: "collectControlsOptions", 6851 value: function value(e) { 6852 var t = { 6853 sortOptions: [], 6854 paginationOptions: null, 6855 textFilterOptions: [], 6856 pathFilterOptions: [], 6857 rangeFilterOptions: [] 6858 }; 6859 if (!e) return t; 6860 var r = !0, 6861 n = !1, 6862 o = void 0; 6863 try { 6864 for (var i, a = e[Symbol.iterator](); !(r = (i = a.next()).done); r = !0) { 6865 var l = i.value; 6866 l.getSortOptions && (t.sortOptions = t.sortOptions.concat(l.getSortOptions())), l.getTextFilterOptions && (t.textFilterOptions = t.textFilterOptions.concat(l.getTextFilterOptions())), l.getPathFilterOptions && (t.pathFilterOptions = t.pathFilterOptions.concat(l.getPathFilterOptions())), l.getRangeFilterOptions && (t.rangeFilterOptions = t.rangeFilterOptions.concat(l.getRangeFilterOptions())), l.getPaginationOptions && (t.paginationOptions = l.getPaginationOptions()); 6867 } 6868 } catch (e) { 6869 n = !0, o = e; 6870 } finally { 6871 try { 6872 !r && a.return && a.return(); 6873 } finally { 6874 if (n) throw o; 6875 } 6876 } 6877 return t; 6878 } 6879 }, { 6880 key: "getItemsFragment", 6881 value: function value(e) { 6882 var t = document.createDocumentFragment(), 6883 r = !0, 6884 n = !1, 6885 o = void 0; 6886 try { 6887 for (var i, a = e[Symbol.iterator](); !(r = (i = a.next()).done); r = !0) { 6888 var l = i.value; 6889 t.appendChild(l); 6890 } 6891 } catch (e) { 6892 n = !0, o = e; 6893 } finally { 6894 try { 6895 !r && a.return && a.return(); 6896 } finally { 6897 if (n) throw o; 6898 } 6899 } 6900 return t; 6901 } 6902 }, { 6903 key: "updateDeepLink", 6904 value: function value(e) { 6905 var t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : "#", 6906 r = e.replace(t, "").trim(); 6907 if (r = "" === r ? t : t + r, window.location.hash !== r) { 6908 var n = window.location.href.indexOf(t), 6909 o = void 0; 6910 o = -1 === n ? window.location.href + r : window.location.href.substring(0, n) + r, "replaceState" in window.history ? window.history.replaceState("", "", o) : window.location.replace(o); 6911 } 6912 } 6913 }, { 6914 key: "getDeepLink", 6915 value: function value(e, t) { 6916 var r = [], 6917 n = !0, 6918 o = !1, 6919 i = void 0; 6920 try {
6921 for (var a, l = t.keys()[Symbol.iterator](); !(n = (a = l.next()).done); n = !0) { 6922 var u = a.value, 6923 s = e.get(u), 6924 c = [], 6925 f = !0, 6926 d = !1, 6927 p = void 0; 6928 try { 6929 for (var h, v = s[Symbol.iterator](); !(f = (h = v.next()).done); f = !0) { 6930 var y = h.value.getDeepLink(); 6931 y && c.push(y); 6932 } 6933 } catch (e) { 6934 d = !0, p = e; 6935 } finally { 6936 try { 6937 !f && v.return && v.return(); 6938 } finally { 6939 if (d) throw p; 6940 } 6941 } 6942 c.length > 0 && (r.push("group=" + u), r = r.concat(c)); 6943 } 6944 } catch (e) { 6945 o = !0, i = e; 6946 } finally { 6947 try { 6948 !n && l.return && l.return(); 6949 } finally { 6950 if (o) throw i; 6951 } 6952 } 6953 return r.join("&"); 6954 } 6955 }, { 6956 key: "findGroups", 6957 value: function value(e) { 6958 var t = new Map(); 6959 if (!e) return t; 6960 var r = [].concat(d(e)), 6961 n = !0, 6962 o = !1, 6963 i = void 0; 6964 try { 6965 for (var a, l = r[Symbol.iterator](); !(n = (a = l.next()).done); n = !0) { 6966 var u = a.value, 6967 s = u.getAttribute("data-jplist-group"), 6968 c = []; 6969 t.has(s) && (c = t.get(s)), c.push({ 6970 root: u,
6971 items: [].concat(d(u.querySelectorAll("[data-jplist-item]"))), 6972 fragment: document.createDocumentFragment() 6973 }), t.set(s, c); 6974 } 6975 } catch (e) { 6976 o = !0, i = e; 6977 } finally { 6978 try { 6979 !n && l.return && l.return(); 6980 } finally { 6981 if (o) throw i; 6982 } 6983 } 6984 return t; 6985 } 6986 }, { 6987 key: "findControls", 6988 value: function value(e) { 6989 if (!e) return []; 6990 var t = [], 6991 r = e.querySelectorAll("[data-jplist-control]"); 6992 if (r) { 6993 var n = !0, 6994 o = !1, 6995 i = void 0; 6996 try { 6997 for (var a, u = r[Symbol.iterator](); !(n = (a = u.next()).done); n = !0) { 6998 var s = a.value; 6999 if (s.getAttribute("data-jplist-control")) { 7000 var c = new l.default(s); 7001 t.push(c); 7002 } 7003 } 7004 } catch (e) { 7005 o = !0, i = e; 7006 } finally { 7007 try { 7008 !n && u.return && u.return(); 7009 } finally { 7010 if (o) throw i; 7011 } 7012 } 7013 } 7014 return t; 7015 } 7016 }, { 7017 key: "findControlGroups", 7018 value: function value(e) { 7019 var t = new Map(); 7020 if (e) { 7021 var r = !0, 7022 n = !1, 7023 o = void 0; 7024 try { 7025 for (var i, a = e[Symbol.iterator](); !(r = (i = a.next()).done); r = !0) { 7026 var l = i.value, 7027 u = []; 7028 t.has(l.group) && (u = t.get(l.group)), u.push(l), t.set(l.group, u); 7029 } 7030 } catch (e) { 7031 n = !0, o = e; 7032 } finally { 7033 try { 7034 !r && a.return && a.return(); 7035 } finally { 7036 if (n) throw o; 7037 } 7038 } 7039 } 7040 return t; 7041 } 7042 }, { 7043 key: "findSameNameControls", 7044 value: function value(e, t) { 7045 var r = new Map(); 7046 if (t) { 7047 var n = null; 7048 if (e.deepLinking) n = u.default.getUrlParams(window.location.hash, e.hashStart);else if (e.storage) { 7049 var o = s.default.get(e.storage, e.storageName); 7050 n = u.default.getUrlParams(o, ""); 7051 } 7052 var i = !0, 7053 a = !1, 7054 l = void 0; 7055 try { 7056 for (var c, f = t[Symbol.iterator](); !(i = (c = f.next()).done); i = !0) { 7057 var d = c.value; 7058 if (d.type && window.jplist.controlTypes.has(d.type)) { 7059 var p = window.jplist.controlTypes.get(d.type); 7060 if (p) { 7061 var h = null; 7062 (h = r.has(d.name) ? r.get(d.name) : new p(d.group, d.name, [], n)).addControl(d), r.set(d.name, h); 7063 } 7064 } 7065 } 7066 } catch (e) { 7067 a = !0, l = e; 7068 } finally { 7069 try { 7070 !i && f.return && f.return(); 7071 } finally { 7072 if (a) throw l; 7073 } 7074 } 7075 } 7076 return r; 7077 } 7078 }, { 7079 key: "splitByGroupAndName", 7080 value: function value(t, r) { 7081 var o = new Map(); 7082 if (!r) return o;
7083 var i = e.findControls(r), 7084 a = e.findControlGroups(i), 7085 l = !0, 7086 u = !1, 7087 s = void 0; 7088 try { 7089 for (var c, f = a[Symbol.iterator](); !(l = (c = f.next()).done); l = !0) { 7090 var d = n(c.value, 2), 7091 p = d[0], 7092 h = d[1], 7093 v = e.findSameNameControls(t, h), 7094 y = [], 7095 b = !0, 7096 m = !1, 7097 g = void 0; 7098 try { 7099 for (var w, O = v.values()[Symbol.iterator](); !(b = (w = O.next()).done); b = !0) { 7100 var _ = w.value; 7101 y.push(_); 7102 } 7103 } catch (e) { 7104 m = !0, g = e; 7105 } finally { 7106 try { 7107 !b && O.return && O.return(); 7108 } finally { 7109 if (m) throw g; 7110 } 7111 } 7112 o.set(p, y); 7113 } 7114 } catch (e) { 7115 u = !0, s = e; 7116 } finally { 7117 try { 7118 !l && f.return && f.return(); 7119 } finally { 7120 if (u) throw s; 7121 } 7122 } 7123 return o; 7124 } 7125 }]), e; 7126 }(); 7127 t.default = p; 7128}, function (e, t, r) { 7129 "use strict"; 7130 7131 Object.defineProperty(t, "__esModule", { 7132 value: !0 7133 }); 7134 var n = function () { 7135 return function (e, t) { 7136 if (Array.isArray(e)) return e; 7137 if (Symbol.iterator in Object(e)) return function (e, t) { 7138 var r = [], 7139 n = !0, 7140 o = !1, 7141 i = void 0; 7142 try { 7143 for (var a, l = e[Symbol.iterator](); !(n = (a = l.next()).done) && (r.push(a.value), !t || r.length !== t); n = !0); 7144 } catch (e) { 7145 o = !0, i = e; 7146 } finally { 7147 try { 7148 !n && l.return && l.return(); 7149 } finally { 7150 if (o) throw i; 7151 } 7152 } 7153 return r; 7154 }(e, t); 7155 throw new TypeError("Invalid attempt to destructure non-iterable instance"); 7156 }; 7157 }(), 7158 o = function () { 7159 function e(e, t) { 7160 for (var r = 0; r < t.length; r++) { 7161 var n = t[r]; 7162 n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n); 7163 } 7164 } 7165 return function (t, r, n) { 7166 return r && e(t.prototype, r), n && e(t, n), t; 7167 }; 7168 }(), 7169 i = l(r(44)), 7170 a = l(r(1)); 7171 function l(e) { 7172 return e && e.__esModule ? e : { 7173 default: e 7174 }; 7175 } 7176 function u(e) { 7177 if (Array.isArray(e)) { 7178 for (var t = 0, r = Array(e.length); t < e.length; t++) r[t] = e[t]; 7179 return r; 7180 } 7181 return Array.from(e); 7182 } 7183 var s = function () { 7184 function e() { 7185 !function (e, t) { 7186 if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function"); 7187 }(this, e); 7188 } 7189 return o(e, [{ 7190 key: "init", 7191 value: function value(e) { 7192 this.settings = Object.assign({}, { 7193 storage: "", 7194 storageName: "jplist", 7195 cookiesExpiration: -1, 7196 deepLinking: !1, 7197 hashStart: "#" 7198 }, e), this.controls = i.default.splitByGroupAndName(this.settings, document.body), this.elements = document.querySelectorAll("[data-j
7198plist-group]"), this.groups = i.default.findGroups(this.elements); 7199 for (var t = [].concat(u(document.querySelectorAll("[data-jplist-item]"))), r = 0; r < t.length; r++) t[r].jplistIndex = r; 7200 this.refresh(""); 7201 } 7202 }, { 7203 key: "refresh", 7204 value: function value() { 7205 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : "", 7206 t = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : void 0; 7207 i.default.apply(this.settings, this.controls, this.groups, e, t); 7208 } 7209 }, { 7210 key: "resetControl", 7211 value: function value(e) { 7212 if (e && this.controls) { 7213 var t = !0, 7214 r = !1, 7215 o = void 0; 7216 try { 7217 for (var i, l = this.controls[Symbol.iterator](); !(t = (i = l.next()).done); t = !0) { 7218 var u = n(i.value, 2), 7219 s = u[0], 7220 c = u[1], 7221 f = !0, 7222 d = !1, 7223 p = void 0; 7224 try { 7225 for (var h, v = c[Symbol.iterator](); !(f = (h = v.next()).done); f = !0) { 7226 var y = h.value, 7227 b = y.controls.findIndex(function (t) { 7228 return t.element === e; 7229 }); 7230 if (b >= 0) { 7231 var m = y.controls[b].element, 7232 g = document.createElement("div"); 7233 g.innerHTML = m.initialHTML; 7234 var w = g.firstChild; 7235 return void (m.parentNode && (m.parentNode.replaceChild(w, m), y.controls.splice(b, 1), y.addControl(new a.default(w)), this.refresh(s))); 7236 } 7237 } 7238 } catch (e) { 7239 d = !0, p = e; 7240 } finally { 7241 try { 7242 !f && v.return && v.return(); 7243 } finally { 7244 if (d) throw p; 7245 } 7246 } 7247 } 7248 } catch (e) { 7249 r = !0, o = e; 7250 } finally { 7251 try { 7252 !t && l.return && l.return(); 7253 } finally { 7254 if (r) throw o; 7255 } 7256 } 7257 } 7258 } 7259 }, { 7260 key: "resetControls", 7261 value: function value() { 7262 var e = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : ""; 7263 if (this.controls) { 7264 var t = !0, 7265 r = !1, 7266 o = void 0; 7267 try { 7268 for (var a, l = this.controls[Symbol.iterator](); !(t = (a = l.next()).done); t = !0) { 7269 var u = n(a.value, 2), 7270 s = (u[0], u[1]), 7271 c = !0, 7272 f = !1, 7273 d = void 0; 7274 try { 7275 for (var p, h = s[Symbol.iterator](); !(c = (p = h.next()).done); c = !0) { 7276 var v = p.value, 7277 y = !0, 7278 b = !1, 7279 m = void 0; 7280 try { 7281 for (var g, w = v.controls[Symbol.iterator](); !(y = (g = w.next()).done); y = !0) { 7282 var O = g.value; 7283 O.element && O.element.initialHTML && (O.element.outerHTML = O.element.initialHTML); 7284 } 7285 } catch (e) { 7286 b = !0, m = e; 7287 } finally { 7288 try { 7289 !y && w.return && w.return(); 7290 } finally { 7291 if (b) throw m; 7292 } 7293 } 7294 } 7295 } catch (e) { 7296 f = !0, d = e; 7297 } finally { 7298 try { 7299 !c && h.return && h.return(); 7300 } finally { 7301 if (f) throw d; 7302 } 7303 } 7304 } 7305 } catch (e) { 7306 r = !0, o = e; 7307 } finally { 7308 try { 7309 !t && l.return && l.return(); 7310 } finally { 7311 if (r) throw o; 7312 } 7313 } 7314 } 7315 this.controls = i.default.splitByGroupAndName(this.settings, document.body), this.refresh(e); 7316 } 7317 }, {
7318 key: "resetContent", 7319 value: function value(e) { 7320 var t = !0, 7321 r = !1, 7322 o = void 0; 7323 try { 7324 for (var a, l = this.groups[Symbol.iterator](); !(t = (a = l.next()).done); t = !0) { 7325 var s = n(a.value, 2), 7326 c = (s[0], s[1]), 7327 f = !0, 7328 d = !1, 7329 p = void 0; 7330 try { 7331 for (var h, v = c[Symbol.iterator](); !(f = (h = v.next()).done); f = !0) { 7332 var y = h.value, 7333 b = i.default.getItemsFragment(y.items); 7334 y.root.appendChild(b); 7335 } 7336 } catch (e) { 7337 d = !0, p = e; 7338 } finally { 7339 try { 7340 !f && v.return && v.return(); 7341 } finally { 7342 if (d) throw p; 7343 } 7344 } 7345 } 7346 } catch (e) { 7347 r = !0, o = e; 7348 } finally { 7349 try { 7350 !t && l.return && l.return(); 7351 } finally { 7352 if (r) throw o; 7353 } 7354 } 7355 e && e(this.groups), this.elements = document.querySelectorAll("[data-j
7355plist-group]"), this.groups = i.default.findGroups(this.elements); 7356 for (var m = [].concat(u(document.querySelectorAll("[data-jplist-item]"))), g = 0; g < m.length; g++) m[g].jplistIndex = g; 7357 this.refresh(""); 7358 } 7359 }]), e; 7360 }(); 7361 t.default = s; 7362}, function (e, t, r) { 7363 "use strict"; 7364 7365 var n = S(r(45)), 7366 o = S(r(39)), 7367 i = S(r(38)), 7368 a = S(r(37)), 7369 l = S(r(36)), 7370 u = S(r(35)), 7371 s = S(r(34)), 7372 c = S(r(33)), 7373 f = S(r(30)), 7374 d = S(r(29)), 7375 p = S(r(28)), 7376 h = S(r(27)), 7377 v = S(r(26)), 7378 y = S(r(25)), 7379 b = S(r(24)), 7380 m = S(r(23)), 7381 g = S(r(22)), 7382 w = S(r(21)), 7383 O = S(r(20)), 7384 _ = S(r(18)), 7385 j = S(r(6)), 7386 P = S(r(17)), 7387 k = S(r(16)), 7388 x = S(r(15)); 7389 function S(e) { 7390 return e && e.__esModule ? e : { 7391 default: e 7392 }; 7393 } 7394 !function () { 7395 if ("function" != typeof window.CustomEvent) { 7396 var e = function e(_e, t) { 7397 t = t || { 7398 bubbles: !1, 7399 cancelable: !1, 7400 detail: void 0 7401 }; 7402 var r = document.createEvent("CustomEvent"); 7403 return r.initCustomEvent(_e, t.bubbles, t.cancelable, t.detail), r; 7404 }; 7405 e.prototype = window.Event.prototype, window.CustomEvent = e; 7406 } 7407 window.jplist = window.jplist || {}, window.jplist.controlTypes = window.jplist.controlTypes || new Map([["hidden-sort", o.default], ["sort-buttons", i.default], ["radio-buttons-sort", a.default], ["checkbox-sort", l.default], ["select-sort", u.default], ["dropdown-sort", s.default], ["pagination", c.default], ["textbox-filter", f.default], ["checkbox-text-filter", d.default], ["radio-buttons-text-filter", p.default], ["buttons-text-filter", h.default], ["select-filter", v.default], ["dropdown-filter", g.default], ["checkbox-path-filter", y.default], ["radio-buttons-path-filter", b.default], ["buttons-path-filter", m.default], ["buttons-range-filter", w.default], ["slider-range-filter", O.default], ["no-results", _.default], ["dropdown", j.default], ["layout", P.default], ["reset", k.default], ["counter", x.default]]); 7408 var t = new n.default(); 7409 window.jplist.init = t.init.bind(t), window.jplist.refresh = t.refresh.bind(t), window.jplist.resetControls = t.resetControls.bind(t), window.jplist.resetControl = t.resetControl.bind(t), window.jplist.resetContent = t.resetContent.bind(t); 7410 }(); 7411},, function (e, t) {},,,,, function (e, t) {}]); 7412 7413// vf-local-overrides 7414 7415// Don"t need JS? Then feel free to delete this file. 7416 7417/* 7418 * A note on the Visual Framework and JavaScript: 7419 * The VF is primairly a CSS framework so we"ve included only a minimal amount 7420 * of JS in components and it"s fully optional (just remove the JavaScript selectors 7421 * i.e. `data-vf-js-tabs`). So if you"d rather use Angular or Bootstrap for your 7422 * tabs, the Visual Framework won"t get in the way. 7423 * 7424 * When querying the DOM for elements that should be acted on: 7425 * ð« Don"t: const tabs = document.querySelectorAll(".vf-tabs"); 7426 * â Do: const tabs = document.querySelectorAll("[data-vf-js-tabs]"); 7427 * 7428 * This allows users who would prefer not to have this JS engange on an element 7429 * to drop `data-vf-js-component` and still maintain CSS styling. 7430 */ 7431 7432// // if you need to import any other components" JS to use here 7433// import { vfOthercomponent } from "vf-other-component/vf-other-component"; 7434 7435/** 7436* The global function for this component 7437* @example vfcomponentName(firstPassedVar) 7438* @param {string} [firstPassedVar] - An option to be passed 7439*/ 7440function vfLocalOverrides(firstPassedVar) { 7441 firstPassedVar = firstPassedVar || "defaultVal"; 7442 console.log("vfLocalOverrides invoked with a value of", firstPassedVar); 7443} 7444// 7445// // You should also import it at ./components/vf-core/scripts.js 7446// // import { vfcomponentName } from "../components/raw/vf-component/vf-component.js"; 7447// // And, if needed, invoke it 7448// // vfcomponentName(); 7449 7450vfBanner(); 7451vfTabs(); 7452emblContentHub(); 7453vfLocalOverrides(); 7454var vfGaTrackOptions = { 7455 vfGaTrackPageLoad: true, 7456 vfGaTrackNetwork: {} 7457}; 7458vfGaIndicateLoaded(vfGaTrackOptions);
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.