1// modules are defined as an array 2// [ module function, map of requires ] 3// 4// map of requires is short require name -> numeric require 5// 6// anything defined in a previous bundle is accessed via the 7// orig method which is the require for previous bundles 8 9(function ( 10 modules, 11 entry, 12 mainEntry, 13 parcelRequireName, 14 externals, 15 distDir, 16 publicUrl, 17 devServer 18) { 19 /* eslint-disable no-undef */ 20 var globalObject = 21 typeof globalThis !== 'undefined' 22 ? globalThis 23 : typeof self !== 'undefined' 24 ? self 25 : typeof window !== 'undefined' 26 ? window 27 : typeof global !== 'undefined' 28 ? global 29 : {}; 30 /* eslint-enable no-undef */ 31 32 // Save the require from previous bundle to this closure if any 33 var previousRequire = 34 typeof globalObject[parcelRequireName] === 'function' && 35 globalObject[parcelRequireName]; 36 37 var importMap = previousRequire.i || {}; 38 var cache = previousRequire.cache || {}; 39 // Do not use `require` to prevent Webpack from trying to bundle this call 40 var nodeRequire = 41 typeof module !== 'undefined' && 42 typeof module.require === 'function' && 43 module.require.bind(module); 44 45 function newRequire(name, jumped) { 46 if (!cache[name]) { 47 if (!modules[name]) { 48 if (externals[name]) { 49 return externals[name]; 50 } 51 // if we cannot find the module within our internal map or 52 // cache jump to the current global require ie. the last bundle 53 // that was added to the page. 54 var currentRequire = 55 typeof globalObject[parcelRequireName] === 'function' && 56 globalObject[parcelRequireName]; 57 if (!jumped && currentRequire) { 58 return currentRequire(name, true); 59 } 60 61 // If there are other bundles on this page the require from the 62 // previous one is saved to 'previousRequire'. Repeat this as 63 // many times as there are bundles until the module is found or 64 // we exhaust the require chain. 65 if (previousRequire) { 66 return previousRequire(name, true); 67 } 68 69 // Try the node require function if it exists. 70 if (nodeRequire && typeof name === 'string') { 71 return nodeRequire(name); 72 } 73
74 var err = new Error("Cannot find module '" + name + "'"); 75 err.code = 'MODULE_NOT_FOUND'; 76 throw err; 77 } 78 79 localRequire.resolve = resolve; 80 localRequire.cache = {}; 81 82 var module = (cache[name] = new newRequire.Module(name)); 83 84 modules[name][0].call( 85 module.exports, 86 localRequire, 87 module, 88 module.exports, 89 globalObject 90 ); 91 } 92 93 return cache[name].exports; 94 95 function localRequire(x) { 96 var res = localRequire.resolve(x); 97 return res === false ? {} : newRequire(res); 98 } 99 100 function resolve(x) { 101 var id = modules[name][1][x]; 102 return id != null ? id : x; 103 } 104 } 105 106 function Module(moduleName) { 107 this.id = moduleName; 108 this.bundle = newRequire; 109 this.require = nodeRequire; 110 this.exports = {}; 111 } 112 113 newRequire.isParcelRequire = true; 114 newRequire.Module = Module; 115 newRequire.modules = modules; 116 newRequire.cache = cache; 117 newRequire.parent = previousRequire; 118 newRequire.distDir = distDir; 119 newRequire.publicUrl = publicUrl; 120 newRequire.devServer = devServer; 121 newRequire.i = importMap; 122 newRequire.register = function (id, exports) { 123 modules[id] = [ 124 function (require, module) { 125 module.exports = exports; 126 }, 127 {}, 128 ]; 129 }; 130 131 // Only insert newRequire.load when it is actually used. 132 // The code in this file is linted against ES5, so dynamic import is not allowed. 133 // INSERT_LOAD_HERE 134 135 Object.defineProperty(newRequire, 'root', { 136 get: function () { 137 return globalObject[parcelRequireName]; 138 }, 139 }); 140 141 globalObject[parcelRequireName] = newRequire; 142 143 for (var i = 0; i < entry.length; i++) { 144 newRequire(entry[i]); 145 } 146 147 if (mainEntry) { 148 // Expose entry point to Node, AMD or browser globals 149 // Based on https://github.com/ForbesLindesay/umd/blob/master/template.js 150 var mainExports = newRequire(mainEntry); 151 152 // CommonJS 153 if (typeof exports === 'object' && typeof module !== 'undefined') { 154 module.exports = mainExports; 155 156 // RequireJS 157 } else if (typeof define === 'function' && define.amd) { 158 define(function () { 159 return mainExports; 160 }); 161 } 162 } 163})({"f6qko":[function(require,module,exports,__globalThis) { 164var global = arguments[3]; 165var HMR_HOST = null; 166var HMR_PORT = 1234; 167var HMR_SERVER_PORT = 1234; 168var HMR_SECURE = false; 169var HMR_ENV_HASH = "916932b22e4085ab"; 170var HMR_USE_SSE = false; 171module.bundle.HMR_BUNDLE_ID = "f2a1789deb5d78e0"; 172"use strict"; 173/* global HMR_HOST, HMR_PORT, HMR_SERVER_PORT, HMR_ENV_HASH, HMR_SECURE, HMR_USE_SSE, chrome, browser, __parcel__import__, __parcel__importScripts__, ServiceWorkerGlobalScope */ /*:: 174import type { 175 HMRAsset, 176 HMRMessage, 177} from '@parcel/reporter-dev-server/src/HMRServer.js'; 178interface ParcelRequire { 179 (string): mixed; 180 cache: {|[string]: ParcelModule|}; 181 hotData: {|[string]: mixed|}; 182 Module: any; 183 parent: ?ParcelRequire; 184 isParcelRequire: true; 185 modules: {|[string]: [Function, {|[string]: string|}]|}; 186 HMR_BUNDLE_ID: string; 187 root: ParcelRequire; 188} 189interface ParcelModule { 190 hot: {| 191 data: mixed, 192 accept(cb: (Function) => void): void, 193 dispose(cb: (mixed) => void): void, 194 // accept(deps: Array<string> | string, cb: (Function) => void): void, 195 // decline(): void, 196 _acceptCallbacks: Array<(Function) => void>, 197 _disposeCallbacks: Array<(mixed) => void>, 198 |}; 199} 200interface ExtensionContext { 201 runtime: {| 202 reload(): void, 203 getURL(url: string): string; 204 getManifest(): {manifest_version: number, ...}; 205 |}; 206} 207declare var module: {bundle: ParcelRequire, ...}; 208declare var HMR_HOST: string; 209declare var HMR_PORT: string; 210declare var HMR_SERVER_PORT: string; 211declare var HMR_ENV_HASH: string; 212declare var HMR_SECURE: boolean; 213declare var HMR_USE_SSE: boolean; 214declare var chrome: ExtensionContext; 215declare var browser: ExtensionContext; 216declare var __parcel__import__: (string) => Promise<void>; 217declare var __parcel__importScripts__: (string) => Promise<void>; 218declare var globalThis: typeof self; 219declare var ServiceWorkerGlobalScope: Object; 220*/ var OVERLAY_ID = '__parcel__error__overlay__'; 221var OldModule = module.bundle.Module; 222function Module(moduleName) { 223 OldModule.call(this, moduleName); 224 this.hot = { 225 data: module.bundle.hotData[moduleName], 226 _acceptCallbacks: [], 227 _disposeCallbacks: [], 228 accept: function(fn) { 229 this._acceptCallbacks.push(fn || function() {}); 230 }, 231 dispose: function(fn) { 232 this._disposeCallbacks.push(fn); 233 } 234 }; 235 module.bundle.hotData[moduleName] = undefined; 236} 237module.bundle.Module = Module; 238module.bundle.hotData = {}; 239var checkedAssets /*: {|[string]: boolean|} */ , disposedAssets /*: {|[string]: boolean|} */ , assetsToDispose /*: Array<[ParcelRequire, string]>
239 */ , assetsToAccept /*: Array<[ParcelRequire, string]> */ , bundleNotFound = false; 240function getHostname() { 241 return HMR_HOST || (typeof location !== 'undefined' && location.protocol.indexOf('http') === 0 ? location.hostname : 'localhost'); 242} 243function getPort() { 244 return HMR_PORT || (typeof location !== 'undefined' ? location.port : HMR_SERVER_PORT); 245} 246// eslint-disable-next-line no-redeclare 247let WebSocket = globalThis.WebSocket; 248if (!WebSocket && typeof module.bundle.root === 'function') try { 249 // eslint-disable-next-line no-global-assign 250 WebSocket = module.bundle.root('ws'); 251} catch { 252// ignore. 253} 254var hostname = getHostname(); 255var port = getPort(); 256var protocol = HMR_SECURE || typeof location !== 'undefined' && location.protocol === 'https:' && ![ 257 'localhost', 258 '127.0.0.1', 259 '0.0.0.0' 260].includes(hostname) ? 'wss' : 'ws'; 261// eslint-disable-next-line no-redeclare 262var parent = module.bundle.parent; 263if (!parent || !parent.isParcelRequire) { 264 // Web extension context 265 var extCtx = typeof browser === 'undefined' ? typeof chrome === 'undefined' ? null : chrome : browser; 266 // Safari doesn't support sourceURL in error stacks. 267 // eval may also be disabled via CSP, so do a quick check. 268 var supportsSourceURL = false; 269 try { 270 (0, eval)('throw new Error("test"); //# sourceURL=test.js'); 271 } catch (err) { 272 supportsSourceURL = err.stack.includes('test.js'); 273 } 274 var ws; 275 if (HMR_USE_SSE) ws = new EventSource('/__parcel_hmr'); 276 else try { 277 // If we're running in the dev server's node runner, listen for messages on the parent port. 278 let { workerData, parentPort } = module.bundle.root('node:worker_threads') /*: any*/ ; 279 if (workerData !== null && workerData !== void 0 && workerData.__parcel) { 280 parentPort.on('message', async (message)=>{ 281 try { 282 await handleMessage(message); 283 parentPort.postMessage('updated'); 284 } catch { 285 parentPort.postMessage('restart'); 286 } 287 }); 288 // After the bundle has finished running, notify the dev server that the HMR update is complete. 289 queueMicrotask(()=>parentPort.postMessage('ready')); 290 } 291 } catch { 292 if (typeof WebSocket !== 'undefined') try { 293 ws = new WebSocket(protocol + '://' + hostname + (port ? ':' + port : '') + '/'); 294 } catch (err) { 295 // Ignore cloudflare workers error. 296 if (err.message && !err.message.includes('Disallowed operation called within global scope')) console.error(err.message); 297 } 298 } 299 if (ws) { 300 // $FlowFixMe 301 ws.onmessage = async function(event /*: {data: string, ...} */ ) { 302 var data /*: HMRMessage */ = JSON.parse(event.data); 303 await handleMessage(data); 304 }; 305 if (ws instanceof WebSocket) { 306 ws.onerror = function(e) { 307 if (e.message) console.error(e.message); 308 }; 309 ws.onclose = function() { 310 console.warn("[parcel] \uD83D\uDEA8 Connection to the HMR server was lost"); 311 }; 312 } 313 } 314} 315async function handleMessage(data /*: HMRMessage */ ) { 316 checkedAssets = {} /*: {|[string]: boolean|} */ ; 317 disposedAssets = {} /*: {|[string]: boolean|} */ ; 318 assetsToAccept = []; 319 assetsToDispose = []; 320 bundleNotFound = false; 321 if (data.type === 'reload') fullReload(); 322 else if (data.type === 'update') { 323 // Remove error overlay if there is one 324 if (typeof document !== 'undefined') removeErrorOverlay(); 325 let assets = data.assets; 326 // Handle HMR Update 327 let handled = assets.every((asset)=>{ 328 return asset.type === 'css' || asset.type === 'js' && hmrAcceptCheck(module.bundle.root, asset.id, asset.depsByBundle); 329 }); 330 // Dispatch a custom event in case a bundle was not found. This might mean 331 // an asset on the server changed and we should reload the page. This event 332 // gives the client an opportunity to refresh without losing state 333 // (e.g. via React Server Components). If e.preventDefault() is not called, 334 // we will trigger a full page reload. 335 if (handled && bundleNotFound && assets.some((a)=>a.envHash !== HMR_ENV_HASH) && typeof window !== 'undefined' && typeof CustomEvent !== 'undefined') handled = !window.dispatchEvent(new CustomEvent('parcelhmrreload', { 336 cancelable: true 337 })); 338 if (handled) { 339 console.clear(); 340 // Dispatch custom event so other runtimes (e.g React Refresh) are aware. 341 if (typeof window !== 'undefined' && typeof CustomEvent !== 'undefined') window.dispatchEvent(new CustomEvent('parcelhmraccept')); 342 await hmrApplyUpdates(assets); 343 hmrDisposeQueue(); 344 // Run accept callbacks. This will also re-execute other disposed assets in topological order. 345 let processedAssets = {}; 346 for(let i = 0; i < assetsToAccept.length; i++){ 347 let id = assetsToAccept[i][1]; 348 if (!processedAssets[id]) { 349 hmrAccept(assetsToAccept[i][0], id); 350 processedAssets[id] = true; 351 } 352 } 353 } else fullReload(); 354 } 355 if (data.type === 'error') { 356 // Log parcel errors to console 357 for (let ansiDiagnostic of data.diagnostics.ansi){ 358 let stack = ansiDiagnostic.codeframe ? ansiDiagnostic.codeframe : ansiDiagnostic.stack; 359 console.error("\uD83D\uDEA8 [parcel]: " + ansiDiagnostic.message + '\n' + stack + '\n\n' + ansiDiagnostic.hints.join('\n')); 360 } 361 if (typeof document !== 'undefined') { 362 // Render the fancy html overlay 363 removeErrorOverlay();
vendor: 9,701 bytes, lines 364-578
364 var overlay = createErrorOverlay(data.diagnostics.html); 365 // $FlowFixMe 366 document.body.appendChild(overlay); 367 } 368 } 369} 370function removeErrorOverlay() { 371 var overlay = document.getElementById(OVERLAY_ID); 372 if (overlay) { 373 overlay.remove(); 374 console.log("[parcel] \u2728 Error resolved"); 375 } 376} 377function createErrorOverlay(diagnostics) { 378 var overlay = document.createElement('div'); 379 overlay.id = OVERLAY_ID; 380 let errorHTML = '<div style="background: black; opacity: 0.85; font-size: 16px; color: white; position: fixed; height: 100%; width: 100%; top: 0px; left: 0px; padding: 30px; font-family: Menlo, Consolas, monospace; z-index: 9999;">'; 381 for (let diagnostic of diagnostics){ 382 let stack = diagnostic.frames.length ? diagnostic.frames.reduce((p, frame)=>{ 383 return `${p} 384<a href="${protocol === 'wss' ? 'https' : 'http'}://${hostname}:${port}/__parcel_launch_editor?file=${encodeURIComponent(frame.location)}" style="text-decoration: underline; color: #888" onclick="fetch(this.href); return false">${frame.location}</a> 385${frame.code}`; 386 }, '') : diagnostic.stack; 387 errorHTML += ` 388 <div> 389 <div style="font-size: 18px; font-weight: bold; margin-top: 20px;"> 390 \u{1F6A8} ${diagnostic.message} 391 </div> 392 <pre>${stack}</pre> 393 <div> 394 ${diagnostic.hints.map((hint)=>"<div>\uD83D\uDCA1 " + hint + '</div>').join('')} 395 </div> 396 ${diagnostic.documentation ? `<div>\u{1F4DD} <a style="color: violet" href="${diagnostic.documentation}" target="_blank">Learn more</a></div>` : ''} 397 </div> 398 `; 399 } 400 errorHTML += '</div>'; 401 overlay.innerHTML = errorHTML; 402 return overlay; 403} 404function fullReload() { 405 if (typeof location !== 'undefined' && 'reload' in location) location.reload(); 406 else if (typeof extCtx !== 'undefined' && extCtx && extCtx.runtime && extCtx.runtime.reload) extCtx.runtime.reload(); 407 else try { 408 let { workerData, parentPort } = module.bundle.root('node:worker_threads') /*: any*/ ; 409 if (workerData !== null && workerData !== void 0 && workerData.__parcel) parentPort.postMessage('restart'); 410 } catch (err) { 411 console.error("[parcel] \u26A0\uFE0F An HMR update was not accepted. Please restart the process."); 412 } 413} 414function getParents(bundle, id) /*: Array<[ParcelRequire, string]> */ { 415 var modules = bundle.modules; 416 if (!modules) return []; 417 var parents = []; 418 var k, d, dep; 419 for(k in modules)for(d in modules[k][1]){ 420 dep = modules[k][1][d]; 421 if (dep === id || Array.isArray(dep) && dep[dep.length - 1] === id) parents.push([ 422 bundle, 423 k 424 ]); 425 } 426 if (bundle.parent) parents = parents.concat(getParents(bundle.parent, id)); 427 return parents; 428} 429function updateLink(link) { 430 var href = link.getAttribute('href'); 431 if (!href) return; 432 var newLink = link.cloneNode(); 433 newLink.onload = function() { 434 if (link.parentNode !== null) // $FlowFixMe 435 link.parentNode.removeChild(link); 436 }; 437 newLink.setAttribute('href', // $FlowFixMe 438 href.split('?')[0] + '?' + Date.now()); 439 // $FlowFixMe 440 link.parentNode.insertBefore(newLink, link.nextSibling); 441} 442var cssTimeout = null; 443function reloadCSS() { 444 if (cssTimeout || typeof document === 'undefined') return; 445 cssTimeout = setTimeout(function() { 446 var links = document.querySelectorAll('link[rel="stylesheet"]'); 447 for(var i = 0; i < links.length; i++){ 448 // $FlowFixMe[incompatible-type] 449 var href /*: string */ = links[i].getAttribute('href'); 450 var hostname = getHostname(); 451 var servedFromHMRServer = hostname === 'localhost' ? new RegExp('^(https?:\\/\\/(0.0.0.0|127.0.0.1)|localhost):' + getPort()).test(href) : href.indexOf(hostname + ':' + getPort()); 452 var absolute = /^https?:\/\//i.test(href) && href.indexOf(location.origin) !== 0 && !servedFromHMRServer; 453 if (!absolute) updateLink(links[i]); 454 } 455 cssTimeout = null; 456 }, 50); 457} 458function hmrDownload(asset) { 459 if (asset.type === 'js') { 460 if (typeof document !== 'undefined') { 461 let script = document.createElement('script'); 462 script.src = asset.url + '?t=' + Date.now(); 463 if (asset.outputFormat === 'esmodule') script.type = 'module'; 464 return new Promise((resolve, reject)=>{ 465 var _document$head; 466 script.onload = ()=>resolve(script); 467 script.onerror = reject; 468 (_document$head = document.head) === null || _document$head === void 0 || _document$head.appendChild(script); 469 }); 470 } else if (typeof importScripts === 'function') { 471 // Worker scripts 472 if (asset.outputFormat === 'esmodule') return import(asset.url + '?t=' + Date.now()); 473 else return new Promise((resolve, reject)=>{ 474 try { 475 importScripts(asset.url + '?t=' + Date.now()); 476 resolve(); 477 } catch (err) { 478 reject(err); 479 } 480 }); 481 } 482 } 483} 484async function hmrApplyUpdates(assets) { 485 global.parcelHotUpdate = Object.create(null); 486 let scriptsToRemove; 487 try { 488 // If sourceURL comments aren't supported in eval, we need to load 489 // the update from the dev server over HTTP so that stack traces 490 // are correct in errors/logs. This is much slower than eval, so 491 // we only do it if needed (currently just Safari). 492 // https://bugs.webkit.org/show_bug.cgi?id=137297 493 // This path is also taken if a CSP disallows eval. 494 if (!supportsSourceURL) { 495 let promises = assets.map((asset)=>{ 496 var _hmrDownload; 497 return (_hmrDownload = hmrDownload(asset)) === null || _hmrDownload === void 0 ? void 0 : _hmrDownload.catch((err)=>{ 498 // Web extension fix 499 if (extCtx && extCtx.runtime && extCtx.runtime.getManifest().manifest_version == 3 && typeof ServiceWorkerGlobalScope != 'undefined' && global instanceof ServiceWorkerGlobalScope) { 500 extCtx.runtime.reload(); 501 return; 502 } 503 throw err; 504 }); 505 }); 506 scriptsToRemove = await Promise.all(promises); 507 } 508 assets.forEach(function(asset) { 509 hmrApply(module.bundle.root, asset); 510 }); 511 } finally{ 512 delete global.parcelHotUpdate; 513 if (scriptsToRemove) scriptsToRemove.forEach((script)=>{ 514 if (script) { 515 var _document$head2; 516 (_document$head2 = document.head) === null || _document$head2 === void 0 || _document$head2.removeChild(script); 517 } 518 }); 519 } 520} 521function hmrApply(bundle /*: ParcelRequire */ , asset /*: HMRAsset */ ) { 522 var modules = bundle.modules; 523 if (!modules) return; 524 if (asset.type === 'css') reloadCSS(); 525 else if (asset.type === 'js') { 526 let deps = asset.depsByBundle[bundle.HMR_BUNDLE_ID]; 527 if (deps) { 528 if (modules[asset.id]) { 529 // Remove dependencies that are removed and will become orphaned. 530 // This is necessary so that if the asset is added back again, the cache is gone, and we prevent a full page reload. 531 let oldDeps = modules[asset.id][1]; 532 for(let dep in oldDeps)if (!deps[dep] || deps[dep] !== oldDeps[dep]) { 533 let id = oldDeps[dep]; 534 let parents = getParents(module.bundle.root, id); 535 if (parents.length === 1) hmrDelete(module.bundle.root, id); 536 } 537 } 538 if (supportsSourceURL) // Global eval. We would use `new Function` here but browser 539 // support for source maps is better with eval. 540 (0, eval)(asset.output); 541 // $FlowFixMe 542 let fn = global.parcelHotUpdate[asset.id]; 543 modules[asset.id] = [ 544 fn, 545 deps 546 ]; 547 } 548 // Always traverse to the parent bundle, even if we already replaced the asset in this bundle. 549 // This is required in case modules are duplicated. We need to ensure all instances have the updated code. 550 if (bundle.parent) hmrApply(bundle.parent, asset); 551 } 552} 553function hmrDelete(bundle, id) { 554 let modules = bundle.modules; 555 if (!modules) return; 556 if (modules[id]) { 557 // Collect dependencies that will become orphaned when this module is deleted. 558 let deps = modules[id][1]; 559 let orphans = []; 560 for(let dep in deps){ 561 let parents = getParents(module.bundle.root, deps[dep]); 562 if (parents.length === 1) orphans.push(deps[dep]); 563 } 564 // Delete the module. This must be done before deleting dependencies in case of circular dependencies. 565 delete modules[id]; 566 delete bundle.cache[id]; 567 // Now delete the orphans. 568 orphans.forEach((id)=>{ 569 hmrDelete(module.bundle.root, id); 570 }); 571 } else if (bundle.parent) hmrDelete(bundle.parent, id); 572} 573function hmrAcceptCheck(bundle /*: ParcelRequire */ , id /*: string */ , depsByBundle /*: ?{ [string]: { [string]: string } }*/ ) { 574 checkedAssets = {}; 575 if (hmrAcceptCheckOne(bundle, id, depsByBundle)) return true; 576 // Traverse parents breadth first. All possible ancestries must accept the HMR update, or we'll reload. 577 let parents = getParents(module.bundle.root, id); 578 let accepted = false;
579 while(parents.length > 0){ 580 let v = parents.shift(); 581 let a = hmrAcceptCheckOne(v[0], v[1], null); 582 if (a) // If this parent accepts, stop traversing upward, but still consider siblings. 583 accepted = true; 584 else if (a !== null) { 585 // Otherwise, queue the parents in the next level upward. 586 let p = getParents(module.bundle.root, v[1]); 587 if (p.length === 0) { 588 // If there are no parents, then we've reached an entry without accepting. Reload. 589 accepted = false; 590 break; 591 } 592 parents.push(...p); 593 } 594 } 595 return accepted; 596} 597function hmrAcceptCheckOne(bundle /*: ParcelRequire */ , id /*: string */ , depsByBundle /*: ?{ [string]: { [string]: string } }*/ ) { 598 var modules = bundle.modules; 599 if (!modules) return; 600 if (depsByBundle && !depsByBundle[bundle.HMR_BUNDLE_ID]) { 601 // If we reached the root bundle without finding where the asset should go, 602 // there's nothing to do. Mark as "accepted" so we don't reload the page. 603 if (!bundle.parent) { 604 bundleNotFound = true; 605 return true; 606 } 607 return hmrAcceptCheckOne(bundle.parent, id, depsByBundle); 608 } 609 if (checkedAssets[id]) return null; 610 checkedAssets[id] = true; 611 var cached = bundle.cache[id]; 612 if (!cached) return true; 613 assetsToDispose.push([ 614 bundle, 615 id 616 ]); 617 if (cached && cached.hot && cached.hot._acceptCallbacks.length) { 618 assetsToAccept.push([ 619 bundle, 620 id 621 ]); 622 return true; 623 } 624 return false; 625} 626function hmrDisposeQueue() { 627 // Dispose all old assets. 628 for(let i = 0; i < assetsToDispose.length; i++){ 629 let id = assetsToDispose[i][1]; 630 if (!disposedAssets[id]) { 631 hmrDispose(assetsToDispose[i][0], id); 632 disposedAssets[id] = true; 633 } 634 } 635 assetsToDispose = []; 636} 637function hmrDispose(bundle /*: ParcelRequire */ , id /*: string */ ) { 638 var cached = bundle.cache[id]; 639 bundle.hotData[id] = {}; 640 if (cached && cached.hot) cached.hot.data = bundle.hotData[id]; 641 if (cached && cached.hot && cached.hot._disposeCallbacks.length) cached.hot._disposeCallbacks.forEach(function(cb) { 642 cb(bundle.hotData[id]); 643 }); 644 delete bundle.cache[id]; 645} 646function hmrAccept(bundle /*: ParcelRequire */ , id /*: string */ ) { 647 // Execute the module. 648 bundle(id); 649 // Run the accept callbacks in the new version of the module. 650 var cached = bundle.cache[id]; 651 if (cached && cached.hot && cached.hot._acceptCallbacks.length) { 652 let assetsToAlsoAccept = []; 653 cached.hot._acceptCallbacks.forEach(function(cb) { 654 let additionalAssets = cb(function() { 655 return getParents(module.bundle.root, id); 656 }); 657 if (Array.isArray(additionalAssets) && additionalAssets.length) assetsToAlsoAccept.push(...additionalAssets); 658 }); 659 if (assetsToAlsoAccept.length) { 660 let handled = assetsToAlsoAccept.every(function(a) { 661 return hmrAcceptCheck(a[0], a[1]); 662 }); 663 if (!handled) return fullReload(); 664 hmrDisposeQueue(); 665 } 666 } 667} 668 669},{}],"3Jb1R":[function(require,module,exports,__globalThis) { 670// Functions 671var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 672var _smoothScroll = require("./functions/smoothScroll"); 673var _urlParams = require("./functions/urlParams"); 674var _fadeInOnScroll = require("./components/fadeInOnScroll"); 675var _atreemoSignup = require("./functions/atreemoSignup"); 676var _otWidget = require("./functions/otWidget"); 677var _otWidgetDefault = parcelHelpers.interopDefault(_otWidget); 678// Components 679var _popups = require("./components/popups"); 680var _popupNav = require("./components/popupNav"); 681var _header = require("./components/header"); 682var _footer = require("./components/footer"); 683var _preloader = require("./components/preloader"); 684var _imageSlider = require("./components/imageSlider"); 685var _cptListFilter = require("./components/cptListFilter"); 686var _hotelStyleBookingWidget = require("./components/hotelStyleBookingWidget"); 687var _toggleVideoButton = require("./components/toggleVideoButton"); 688var _tripleSeat = require("./components/tripleSeat"); 689var _contactaNewsletter = require("./components/contactaNewsletter"); 690var _menus = require("./components/menus"); 691// Helpers 692var _accessibility = require("./helpers/accessibility"); 693var _accessibleHeader = require("./helpers/accessibleHeader"); 694var _inlineVideoAutoplay = require("./helpers/inlineVideoAutoplay"); 695// Modules 696var _amenities = require("./modules/amenities"); 697var _boxPromos = require("./modules/boxPromos"); 698var _cards = require("./modules/cards"); 699var _cardSlider = require("./modules/cardSlider"); 700var _contactForm = require("./modules/contactForm"); 701var _contentOverImage = require("./modules/contentOverImage"); 702var _discover = require("./modules/discover"); 703var _eventSpaceList = require("./modules/eventSpaceList"); 704var _enquiryHub = require("./modules/enquiryHub"); 705var _faqs = require("./modules/faqs"); 706var _heroSlider = require("./modules/heroSlider"); 707var _homepageHero = require("./modules/homepageHero"); 708var _imageCollage = require("./modules/imageCollage"); 709var _imageContent = require("./modules/imageContent"); 710var _imageAccordion = require("./modules/imageAccordion"); 711var _imageSlider1 = require("./modules/imageSlider"); 712var _fullWidthMedia = require("./modules/fullWidthMedia"); 713var _embedVideo = require("./modules/embedVideo"); 714var _imageCardSlider = require("./modules/imageCardSlider"); 715var _locationsList = require("./modules/locationsList"); 716var _map = require("./modules/map"); 717var _menus1 = require("./modules/menus"); 718var _newsletterSignup = require("./modules/newsletterSignup"); 719var _postFeed = require("./modules/postFeed"); 720var _privateEventSpacesFeed = require("./modules/privateEventSpacesFeed"); 721var _promo = require("./modules/promo"); 722var _promoSlider = require("./modules/promoSlider"); 723var _testimonials = require("./modules/testimonials"); 724var _videoPlayer = require("./modules/videoPlayer"); 725var _privateDiningFilter = require("./modules/privateDiningFilter"); 726var _whatsOnFilter = require("./modules/whatsOnFilter"); 727var _menuFilter = require("./modules/menuFilter"); 728var _whatsOnCarousel = require("./modules/whatsOnCarousel"); 729var _eventSpacesCarousel = require("./modules/eventSpacesCarousel"); 730var _featureImage = require("./modules/featureImage"); 731var _mediaContentCarousel = require("./modules/mediaContentCarousel"); 732var _openingTimes = require("./modules/openingTimes"); 733var _gallery = require("./modules/gallery"); 734var _whatsOnList = require("./modules/whatsOnList");
735var _galleryCarousel = require("./modules/galleryCarousel"); 736var _centeredSlider = require("./modules/centeredSlider"); 737var _forms = require("./modules/forms"); 738var _locationContact = require("./modules/locationContact"); 739// Import main scss file here. This will compile to a css file in the dist folder 740// This also captures any CSS imported from JS modules (like swiper, etc.) 741var _styleScss = require("../sass/style.scss"); 742console.log('index.js loaded'); 743// Initialize OpenTable Booking Widget 744document.addEventListener('DOMContentLoaded', function() { 745 const bookingWidgetElement = document.querySelector('.popup .ignite-ot-booking-widget'); 746 if (bookingWidgetElement) new (0, _otWidgetDefault.default)(bookingWidgetElement); 747 const bookingModuleWidgetElement = document.querySelector('.m__booking-widget .ignite-ot-booking-widget'); 748 if (bookingModuleWidgetElement) new (0, _otWidgetDefault.default)(bookingModuleWidgetElement); 749}); 750 751},{"./functions/smoothScroll":"lADeD","./functions/urlParams":"5MG5H","./components/fadeInOnScroll":"lJfcL","./functions/atreemoSignup":"bxTwH","./functions/otWidget":"hkiht","./components/popups":"gP0kv","./components/popupNav":"3FuKQ","./components/header":"fIAws","./components/footer":"fEqXE","./components/preloader":"hEA9a","./components/imageSlider":"bEdN3","./components/cptListFilter":"kGLxk","./components/hotelStyleBookingWidget":"feFWD","./components/toggleVideoButton":"hx4nO","./components/tripleSeat":"5pbeH","./components/contactaNewsletter":"3N5yu","./components/menus":"dbewR","./helpers/accessibility":"7yMoe","./helpers/accessibleHeader":"lpWJw","./helpers/inlineVideoAutoplay":"8Bvtw","./modules/amenities":"519ys","./modules/boxPromos":"dQjSJ","./modules/cards":"aDfqn","./modules/cardSlider":"eM5Pn","./modules/contactForm":"dI0Bd","./modules/contentOverImage":"163pq","./modules/discover":"8WNuZ","./modules/eventSpaceList":"gwnME","./modules/enquiryHub":"8DQ5N","./modules/faqs":"dC83E","./modules/heroSlider":"2QDve","./modules/homepageHero":"dBpQ5","./modules/imageCollage":"8ZRf4","./modules/imageContent":"bUj21","./modules/imageAccordion":"eQP6q","./modules/imageSlider":"aqVKu","./modules/fullWidthMedia":"k4XTB","./modules/imageCardSlider":"e8afY","./modules/locationsList":"9xble","./modules/map":"j6klG","./modules/menus":"d9BDo","./modules/newsletterSignup":"bFutZ","./modules/postFeed":"2CPjp","./modules/privateEventSpacesFeed":"6jgcn","./modules/promo":"6zDmW","./modules/promoSlider":"k3KvY","./modules/testimonials":"ccvLW","./modules/videoPlayer":"hC2sc","./modules/privateDiningFilter":"if2jl","./modules/whatsOnFilter":"eLvLI","./modules/menuFilter":"gMcjh","./modules/whatsOnCarousel":"fCeLb","./modules/eventSpacesCarousel":"2mgEt","./modules/featureImage":"bxpuE","./modules/mediaContentCarousel":"9lGDV","./modules/openingTimes":"adPtX","./modules/gallery":"03av8","./modules/whatsOnList":"841n2","./modules/galleryCarousel":"k5AjB","./modules/centeredSlider":"8KrgO","./modules/forms":"e1oHA","./modules/locationContact":"jrpBE","../sass/style.scss":"e5w6v","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU","./modules/embedVideo":"afjA0"}],"lADeD":[function(require,module,exports,__globalThis) { 752var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 753parcelHelpers.defineInteropFlag(exports); 754parcelHelpers.export(exports, "lenis", ()=>lenis); 755parcelHelpers.export(exports, "stopSmoothScroll", ()=>stopSmoothScroll); 756parcelHelpers.export(exports, "startSmoothScroll", ()=>startSmoothScroll); 757var _lenis = require("@studio-freight/lenis"); 758var _lenisDefault = parcelHelpers.interopDefault(_lenis); 759const lenis = new (0, _lenisDefault.default)({ 760 duration: 1.2, 761 easing: (t)=>Math.min(1, 1.001 - Math.pow(2, -10 * t)), 762 direction: 'vertical', 763 gestureDirection: 'vertical', 764 smooth: true, 765 mouseMultiplier: 1, 766 smoothTouch: false, 767 touchMultiplier: 2, 768 infinite: false 769}); 770// Get scroll value 771// lenis.on('scroll', ({ scroll, limit, velocity, direction, progress }) => { 772// console.log({ scroll, limit, velocity, direction, progress }); 773// }); 774function raf(time) { 775 lenis.raf(time); 776 requestAnimationFrame(raf); 777} 778requestAnimationFrame(raf); 779const stopSmoothScroll = (lenis)=>lenis.stop(); 780const startSmoothScroll = (lenis)=>lenis.start(); 781 782},{"@studio-freight/lenis":"fhIHr","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"fhIHr":[function(require,module,exports,__globalThis) { 783var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 784parcelHelpers.defineInteropFlag(exports); 785parcelHelpers.export(exports, "default", ()=>Lenis); 786function t(t, e, i) { 787 return Math.max(t, Math.min(e, i)); 788} 789class Animate { 790 advance(e) { 791 if (!this.isRunning) return; 792 let i = !1; 793 if (this.lerp) this.value = (s = this.value, o = this.to, n = 60 * this.lerp, r = e, function(t, e, i) { 794 return (1 - i) * t + i * e; 795 }(s, o, 1 - Math.exp(-n * r))), Math.round(this.value) === this.to && (this.value = this.to, i = !0); 796 else { 797 this.currentTime += e; 798 const s = t(0, this.currentTime / this.duration, 1); 799 i = s >= 1; 800 const o = i ? 1 : this.easing(s); 801 this.value = this.from + (this.to - this.from) * o; 802 } 803 var s, o, n, r; 804 this.onUpdate?.(this.value, i), i && this.stop(); 805 } 806 stop() { 807 this.isRunning = !1; 808 } 809 fromTo(t, e, { lerp: i = .1, duration: s = 1, easing: o = (t)=>t, onStart: n, onUpdate: r }) { 810 this.from = this.value = t, this.to = e, this.lerp = i, this.duration = s, this.easing = o, this.currentTime = 0, this.isRunning = !0, n?.(), this.onUpdate = r; 811 } 812} 813class Dimensions { 814 constructor({ wrapper: t, content: e, autoResize: i = !0, debounce: s = 250 } = {}){ 815 this.wrapper = t, this.content = e, i && (this.debouncedResize = function(t, e) { 816 let i; 817 return function() { 818 let s = arguments, o = this; 819 clearTimeout(i), i = setTimeout(function() { 820 t.apply(o, s); 821 }, e); 822 }; 823 }(this.resize, s), this.wrapper === window ? window.addEventListener("resize", this.debouncedResize, !1) : (this.wrapperResizeObserver = new ResizeObserver(this.debouncedResize), this.wrapperResizeObserver.observe(this.wrapper)), this.contentResizeObserver = new ResizeObserver(this.debouncedResize), this.contentResizeObserver.observe(this.content)), this.resize(); 824 } 825 destroy() { 826 this.wrapperResizeObserver?.disconnect(), this.contentResizeObserver?.disconnect(), window.removeEventListener("resize", this.debouncedResize, !1); 827 } 828 resize = ()=>{ 829 this.onWrapperResize(), this.onContentResize(); 830 }; 831 onWrapperResize = ()=>{ 832 this.wrapper === window ? (this.width = window.innerWidth, this.height = window.innerHeight) : (this.width = this.wrapper.clientWidth, this.height = this.wrapper.clientHeight); 833 }; 834 onContentResize = ()=>{ 835 this.wrapper === window ? (this.scrollHeight = this.content.scrollHeight, this.scrollWidth = this.content.scrollWidth) : (this.scrollHeight = this.wrapper.scrollHeight, this.scrollWidth = this.wrapper.scrollWidth); 836 }; 837 get limit() { 838 return { 839 x: this.scrollWidth - this.width, 840 y: this.scrollHeight - this.height 841 }; 842 } 843} 844class Emitter { 845 constructor(){ 846 this.events = {}; 847 } 848 emit(t, ...e) { 849 let i = this.events[t] || []; 850 for(let t = 0, s = i.length; t < s; t++)i[t](...e); 851 } 852 on(t, e) { 853 return this.events[t]?.push(e) || (this.events[t] = [ 854 e 855 ]), ()=>{ 856 this.events[t] = this.events[t]?.filter((t)=>e !== t); 857 }; 858 } 859 off(t, e) { 860 this.events[t] = this.events[t]?.filter((t)=>e !== t); 861 } 862 destroy() { 863 this.events = {}; 864 } 865} 866const e = 100 / 6; 867class VirtualScroll { 868 constructor(t, { wheelMultiplier: e = 1, touchMultiplier: i = 1 }){ 869 this.element = t, this.wheelMultiplier = e, this.touchMultiplier = i, this.touchStart = { 870 x: null, 871 y: null 872 }, this.emitter = new Emitter, window.addEventListener("resize", this.onWindowResize, !1), this.onWindowResize(), this.element.addEventListener("wheel", this.onWheel, { 873 passive: !1 874 }), this.element.addEventListener("touchstart", this.onTouchStart, { 875 passive: !1 876 }), this.element.addEventListener("touchmove", this.onTouchMove, { 877 passive: !1 878 }), this.element.addEventListener("touchend", this.onTouchEnd, { 879 passive: !1 880 }); 881 } 882 on(t, e) { 883 return this.emitter.on(t, e); 884 } 885 destroy() { 886 this.emitter.destroy(), window.removeEventListener("resize", this.onWindowResize, !1), this.element.removeEventListener("wheel", this.onWheel, { 887 passive: !1 888 }), this.element.removeEventListener("touchstart", this.onTouchStart, { 889 passive: !1 890 }), this.element.removeEventListener("touchmove", this.onTouchMove, { 891 passive: !1 892 }), this.element.removeEventListener("touchend", this.onTouchEnd, { 893 passive: !1 894 }); 895 } 896 onTouchStart = (t)=>{ 897 const { clientX: e, clientY: i } = t.targetTouches ? t.targetTouches[0] : t; 898 this.touchStart.x = e, this.touchStart.y = i, this.lastDelta = { 899 x: 0, 900 y: 0 901 }, this.emitter.emit("scroll", { 902 deltaX: 0, 903 deltaY: 0, 904 event: t 905 }); 906 }; 907 onTouchMove = (t)=>{ 908 const { clientX: e, clientY: i } = t.targetTouches ? t.targetTouches[0] : t, s = -(e - this.touchStart.x) * this.touchMultiplier, o = -(i - this.touchStart.y) * this.touchMultiplier; 909 this.touchStart.x = e, this.touchStart.y = i, this.lastDelta = { 910 x: s, 911 y: o 912 }, this.emitter.emit("scroll", { 913 deltaX: s, 914 deltaY: o, 915 event: t 916 }); 917 }; 918 onTouchEnd = (t)=>{ 919 this.emitter.emit("scroll", { 920 deltaX: this.lastDelta.x, 921 deltaY: this.lastDelta.y, 922 event: t 923 }); 924 }; 925 onWheel = (t)=>{ 926 let { deltaX: i, deltaY: s, deltaMode: o } = t; 927 i *= 1 === o ? e : 2 === o ? this.windowWidth : 1, s *= 1 === o ? e : 2 === o ? this.windowHeight : 1, i *= this.wheelMultiplier, s *= this.wheelMultiplier, this.emitter.emit("scroll", { 928 deltaX: i, 929 deltaY: s, 930 event: t 931 }); 932 }; 933 onWindowResize = ()=>{ 934 this.windowWidth = window.innerWidth, this.windowHeight = window.innerHeight; 935 }; 936} 937class Lenis { 938 constructor({ wrapper: t = window, content: e = document.documentElement, wheelEventsTarget: i = t, eventsTarget: s = i, smoothWheel: o = !0, syncTouch: n = !1, syncTouchLerp: r = .075, touchInertiaMultiplier: l = 35, duration: h, easing: a = (t)=>Math.min(1, 1.001 - Math.pow(2, -10 * t)), lerp: c = !h && .1, infinite: d = !1, orientation: p = "vertical", gestureOrientation: u = "vertical", touchMultiplier: m = 1, wheelMultiplier: v = 1, autoResize: g = !0, __experimental__naiveDimensions: S = !1 } = {}){ 939 this.__isSmooth = !1, this.__isScrolling = !1, this.__isStopped = !1, this.__isLocked
vendor: 4,555 bytes, lines 939-1016
939= !1, this.onVirtualScroll = ({ deltaX: t, deltaY: e, event: i })=>{ 940 if (i.ctrlKey) return; 941 const s = i.type.includes("touch"), o = i.type.includes("wheel"); 942 if (this.options.syncTouch && s && "touchstart" === i.type && !this.isStopped && !this.isLocked) return void this.reset(); 943 const n = 0 === t && 0 === e, r = "vertical" === this.options.gestureOrientation && 0 === e || "horizontal" === this.options.gestureOrientation && 0 === t; 944 if (n || r) return; 945 let l = i.composedPath(); 946 if (l = l.slice(0, l.indexOf(this.rootElement)), l.find((t)=>{ 947 var e, i, n, r, l; 948 return (null === (e = t.hasAttribute) || void 0 === e ? void 0 : e.call(t, "data-lenis-prevent")) || s && (null === (i = t.hasAttribute) || void 0 === i ? void 0 : i.call(t, "data-lenis-prevent-touch")) || o && (null === (n = t.hasAttribute) || void 0 === n ? void 0 : n.call(t, "data-lenis-prevent-wheel")) || (null === (r = t.classList) || void 0 === r ? void 0 : r.contains("lenis")) && !(null === (l = t.classList) || void 0 === l ? void 0 : l.contains("lenis-stopped")); 949 })) return; 950 if (this.isStopped || this.isLocked) return void i.preventDefault(); 951 if (this.isSmooth = this.options.syncTouch && s || this.options.smoothWheel && o, !this.isSmooth) return this.isScrolling = !1, void this.animate.stop(); 952 i.preventDefault(); 953 let h = e; 954 "both" === this.options.gestureOrientation ? h = Math.abs(e) > Math.abs(t) ? e : t : "horizontal" === this.options.gestureOrientation && (h = t); 955 const a = s && this.options.syncTouch, c = s && "touchend" === i.type && Math.abs(h) > 5; 956 c && (h = this.velocity * this.options.touchInertiaMultiplier), this.scrollTo(this.targetScroll + h, Object.assign({ 957 programmatic: !1 958 }, a ? { 959 lerp: c ? this.options.syncTouchLerp : 1 960 } : { 961 lerp: this.options.lerp, 962 duration: this.options.duration, 963 easing: this.options.easing 964 })); 965 }, this.onNativeScroll = ()=>{ 966 if (!this.__preventNextScrollEvent && !this.isScrolling) { 967 const t = this.animatedScroll; 968 this.animatedScroll = this.targetScroll = this.actualScroll, this.velocity = 0, this.direction = Math.sign(this.animatedScroll - t), this.emit(); 969 } 970 }, window.lenisVersion = "1.0.42", t !== document.documentElement && t !== document.body || (t = window), this.options = { 971 wrapper: t, 972 content: e, 973 wheelEventsTarget: i, 974 eventsTarget: s, 975 smoothWheel: o, 976 syncTouch: n, 977 syncTouchLerp: r, 978 touchInertiaMultiplier: l, 979 duration: h, 980 easing: a, 981 lerp: c, 982 infinite: d, 983 gestureOrientation: u, 984 orientation: p, 985 touchMultiplier: m, 986 wheelMultiplier: v, 987 autoResize: g, 988 __experimental__naiveDimensions: S 989 }, this.animate = new Animate, this.emitter = new Emitter, this.dimensions = new Dimensions({ 990 wrapper: t, 991 content: e, 992 autoResize: g 993 }), this.toggleClassName("lenis", !0), this.velocity = 0, this.isLocked = !1, this.isStopped = !1, this.isSmooth = n || o, this.isScrolling = !1, this.targetScroll = this.animatedScroll = this.actualScroll, this.options.wrapper.addEventListener("scroll", this.onNativeScroll, !1), this.virtualScroll = new VirtualScroll(s, { 994 touchMultiplier: m, 995 wheelMultiplier: v 996 }), this.virtualScroll.on("scroll", this.onVirtualScroll); 997 } 998 destroy() { 999 this.emitter.destroy(), this.options.wrapper.removeEventListener("scroll", this.onNativeScroll, !1), this.virtualScroll.destroy(), this.dimensions.destroy(), this.toggleClassName("lenis", !1), this.toggleClassName("lenis-smooth", !1), this.toggleClassName("lenis-scrolling", !1), this.toggleClassName("lenis-stopped", !1), this.toggleClassName("lenis-locked", !1); 1000 } 1001 on(t, e) { 1002 return this.emitter.on(t, e); 1003 } 1004 off(t, e) { 1005 return this.emitter.off(t, e); 1006 } 1007 setScroll(t) { 1008 this.isHorizontal ? this.rootElement.scrollLeft = t : this.rootElement.scrollTop = t; 1009 } 1010 resize() { 1011 this.dimensions.resize(); 1012 } 1013 emit() { 1014 this.emitter.emit("scroll", this); 1015 } 1016 reset() {
1017 this.isLocked = !1, this.isScrolling = !1, this.animatedScroll = this.targetScroll = this.actualScroll, this.velocity = 0, this.animate.stop(); 1018 } 1019 start() { 1020 this.isStopped && (this.isStopped = !1, this.reset()); 1021 } 1022 stop() { 1023 this.isStopped || (this.isStopped = !0, this.animate.stop(), this.reset()); 1024 } 1025 raf(t) { 1026 const e = t - (this.time || t); 1027 this.time = t, this.animate.advance(.001 * e); 1028 } 1029 scrollTo(e, { offset: i = 0, immediate: s = !1, lock: o = !1, duration: n = this.options.duration, easing: r = this.options.easing, lerp: l = !n && this.options.lerp, onComplete: h, force: a = !1, programmatic: c = !0 } = {}) { 1030 if (!this.isStopped && !this.isLocked || a) { 1031 if ([ 1032 "top", 1033 "left", 1034 "start" 1035 ].includes(e)) e = 0; 1036 else if ([ 1037 "bottom", 1038 "right", 1039 "end" 1040 ].includes(e)) e = this.limit; 1041 else { 1042 let t; 1043 if ("string" == typeof e ? t = document.querySelector(e) : (null == e ? void 0 : e.nodeType) && (t = e), t) { 1044 if (this.options.wrapper !== window) { 1045 const t = this.options.wrapper.getBoundingClientRect(); 1046 i -= this.isHorizontal ? t.left : t.top; 1047 } 1048 const s = t.getBoundingClientRect(); 1049 e = (this.isHorizontal ? s.left : s.top) + this.animatedScroll; 1050 } 1051 } 1052 if ("number" == typeof e) { 1053 if (e += i, e = Math.round(e), this.options.infinite ? c && (this.targetScroll = this.animatedScroll = this.scroll) : e = t(0, e, this.limit), s) return this.animatedScroll = this.targetScroll = e, this.setScroll(this.scroll), this.reset(), void (null == h || h(this)); 1054 if (!c) { 1055 if (e === this.targetScroll) return; 1056 this.targetScroll = e; 1057 } 1058 this.animate.fromTo(this.animatedScroll, e, { 1059 duration: n, 1060 easing: r, 1061 lerp: l, 1062 onStart: ()=>{ 1063 o && (this.isLocked = !0), this.isScrolling = !0; 1064 }, 1065 onUpdate: (t, e)=>{ 1066 this.isScrolling = !0, this.velocity = t - this.animatedScroll, this.direction = Math.sign(this.velocity), this.animatedScroll = t, this.setScroll(this.scroll), c && (this.targetScroll = t), e || this.emit(), e && (this.reset(), this.emit(), null == h || h(this), this.__preventNextScrollEvent = !0, requestAnimationFrame(()=>{ 1067 delete this.__preventNextScrollEvent; 1068 })); 1069 } 1070 }); 1071 } 1072 } 1073 } 1074 get rootElement() { 1075 return this.options.wrapper === window ? document.documentElement : this.options.wrapper; 1076 } 1077 get limit() { 1078 return this.options.__experimental__naiveDimensions ? this.isHorizontal ? this.rootElement.scrollWidth - this.rootElement.clientWidth : this.rootElement.scrollHeight - this.rootElement.clientHeight : this.dimensions.limit[this.isHorizontal ? "x" : "y"]; 1079 } 1080 get isHorizontal() { 1081 return "horizontal" === this.options.orientation; 1082 } 1083 get actualScroll() { 1084 return this.isHorizontal ? this.rootElement.scrollLeft : this.rootElement.scrollTop; 1085 } 1086 get scroll() { 1087 var t, e; 1088 return this.options.infinite ? (t = this.animatedScroll, e = this.limit, (t % e + e) % e) : this.animatedScroll; 1089 } 1090 get progress() { 1091 return 0 === this.limit ? 1 : this.scroll / this.limit; 1092 } 1093 get isSmooth() { 1094 return this.__isSmooth; 1095 } 1096 set isSmooth(t) { 1097 this.__isSmooth !== t && (this.__isSmooth = t, this.toggleClassName("lenis-smooth", t)); 1098 } 1099 get isScrolling() { 1100 return this.__isScrolling; 1101 } 1102 set isScrolling(t) { 1103 this.__isScrolling !== t && (this.__isScrolling = t, this.toggleClassName("lenis-scrolling", t)); 1104 } 1105 get isStopped() { 1106 return this.__isStopped; 1107 } 1108 set isStopped(t) { 1109 this.__isStopped !== t && (this.__isStopped = t, this.toggleClassName("lenis-stopped", t)); 1110 } 1111 get isLocked() { 1112 return this.__isLocked; 1113 } 1114 set isLocked(t) {
1115 this.__isLocked !== t && (this.__isLocked = t, this.toggleClassName("lenis-locked", t)); 1116 } 1117 get className() { 1118 let t = "lenis"; 1119 return this.isStopped && (t += " lenis-stopped"), this.isLocked && (t += " lenis-locked"), this.isScrolling && (t += " lenis-scrolling"), this.isSmooth && (t += " lenis-smooth"), t; 1120 } 1121 toggleClassName(t, e) { 1122 this.rootElement.classList.toggle(t, e), this.emitter.emit("className change", this); 1123 } 1124} 1125 1126},{"@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"5oERU":[function(require,module,exports,__globalThis) { 1127exports.interopDefault = function(a) { 1128 return a && a.__esModule ? a : { 1129 default: a 1130 }; 1131}; 1132exports.defineInteropFlag = function(a) { 1133 Object.defineProperty(a, '__esModule', { 1134 value: true 1135 }); 1136}; 1137exports.exportAll = function(source, dest) { 1138 Object.keys(source).forEach(function(key) { 1139 if (key === 'default' || key === '__esModule' || Object.prototype.hasOwnProperty.call(dest, key)) return; 1140 Object.defineProperty(dest, key, { 1141 enumerable: true, 1142 get: function() { 1143 return source[key]; 1144 } 1145 }); 1146 }); 1147 return dest; 1148}; 1149exports.export = function(dest, destName, get) { 1150 Object.defineProperty(dest, destName, { 1151 enumerable: true, 1152 get: get 1153 }); 1154}; 1155 1156},{}],"5MG5H":[function(require,module,exports,__globalThis) { 1157var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 1158var _gsap = require("gsap"); 1159var _gsapDefault = parcelHelpers.interopDefault(_gsap); 1160var _scrollToPlugin = require("gsap/ScrollToPlugin"); 1161var _popups = require("../components/popups"); 1162var _utilities = require("../helpers/utilities"); 1163var _popupGallerySlider = require("../components/popupGallerySlider"); 1164var _accessibility = require("../helpers/accessibility"); 1165const urlParams = ()=>{ 1166 // Initial setup of link listeners 1167 setupLinkListeners(); 1168 // Check for URL params on load 1169 setTimeout(()=>{ 1170 handleURLParamsFunctionality(window.location.href); 1171 }, 750); 1172}; 1173const setupLinkListeners = ()=>{ 1174 let allATags = document.querySelectorAll('a'); 1175 allATags.forEach((aTag)=>{ 1176 let linkHref = aTag.getAttribute('href'); 1177 if (linkHref && linkHref.indexOf('#') !== -1) // Check if the event listener is already attached 1178 { 1179 if (!aTag.classList.contains('listener-attached')) { 1180 aTag.addEventListener('click', handleLinkClick); 1181 aTag.classList.add('listener-attached'); 1182 // Add accessibility attributes if it's a popup trigger 1183 const hashValue = linkHref.split('#')[1]?.split(':')[0]; 1184 const popupTriggers = [ 1185 'book', 1186 'restaurant-booking', 1187 'newsletter', 1188 'event-spaces-enquiry', 1189 'main-nav', 1190 'amenities-popup', 1191 'gallery-popup', 1192 'embed-popup', 1193 'menu-dietary-filters', 1194 'menu-filters', 1195 'popup' 1196 ]; 1197 if (hashValue && popupTriggers.includes(hashValue)) (0, _accessibility.fixPopupButtonAccessibility)(aTag); 1198 } 1199 } 1200 }); 1201}; 1202const handleLinkClick = (event)=>{ 1203 event.preventDefault(); 1204 let targetEl = event.target.closest('a').getAttribute('href'); 1205 let triggerEl = event.target.closest('a').getAttribute('data-tabid'); 1206 handleURLParamsFunctionality(targetEl, event, triggerEl); 1207 return false; 1208}; 1209async function handleURLParamsFunctionality(href, event, triggerEl = null) { 1210 if (href.indexOf('#') != -1) { 1211 // Check if the link has a # 1212 const hashRaw = href.split('#')[1]; 1213 const hashValue = hashRaw.split(':'); 1214 if (hashValue[0] === 'book') // Shortcut to open booking widget 1215 // Open the reservations popup 1216 (0, _popups.openPopup)('#reservations', triggerEl); 1217 else if (hashValue[0] === 'restaurant-booking') (0, _popups.openPopup)('#restaurant-reservations', triggerEl); 1218 else if (hashValue[0] === 'newsletter') (0, _popups.openPopup)('#
1218newsletter', triggerEl); 1219 else if (hashValue[0] === 'event-spaces-enquiry') (0, _popups.openPopup)('#event-spaces-enquiry', triggerEl); 1220 else if (hashValue[0] === 'main-nav') (0, _popups.openPopup)('#main-nav', triggerEl); 1221 else if (hashValue[0] === 'amenities-popup') { 1222 const popup = document.querySelector('#amenities-popup'); 1223 const popupRoomId = popup.dataset.roomId; 1224 if (hashValue[1] && hashValue[1] !== popupRoomId) { 1225 // Data in the popup is not loaded for the room id being passed in, so fetch the data and load it 1226 const popupContentElem = popup.querySelector('.js-amenities-popup-content'); 1227 const loader = popup.querySelector('.js-amenities-popup-loader'); 1228 // Hide the popup container 1229 popupContentElem.classList.add('hidden'); 1230 // Show the loader 1231 loader.classList.remove('hidden'); 1232 // Open the amenities popup 1233 (0, _popups.openPopup)('#amenities-popup', triggerEl); 1234 // Fetch the amenities data 1235 const formData = new FormData(); 1236 formData.append('roomId', hashValue[1]); 1237 formData.append('action', 'getPopupAmenitiesData'); 1238 const data = await (0, _utilities.postRequest)(formData); 1239 if (data) { 1240 // Update the amenities popup with the new data 1241 popupContentElem.innerHTML = data.popupContent; 1242 // Update the popup room id 1243 popup.dataset.roomId = hashValue[1]; 1244 setTimeout(()=>{ 1245 // Hide the loader once the amenities data is loaded 1246 loader.classList.add('hidden'); 1247 // Show the popup container 1248 popupContentElem.classList.remove('hidden'); 1249 }, 400); 1250 // Recall the setupLinkListeners function to handle any additional URL param buttons 1251 setupLinkListeners(); 1252 } else console.error('Error fetching amenities data.'); 1253 } 1254 // Data in the popup is already loaded for the room id being passed in, so just open the popup 1255 (0, _popups.openPopup)('#amenities-popup', triggerEl); 1256 } else if (hashValue[0] === 'gallery-popup') { 1257 const popup = document.querySelector('#gallery-popup'); 1258 const popupGalleryId = popup.dataset.galleryId; 1259 if (hashValue[1] && hashValue[1] !== popupGalleryId || hashValue[1] == 'gallery') { 1260 // Data in the popup is not loaded for the gallery id being passed in, so fetch the data and load it 1261 const popupContentElem = popup.querySelector('.js-gallery-popup-content'); 1262 const loader = popup.querySelector('.js-gallery-popup-loader'); 1263 // Hide the popup container 1264 popupContentElem.classList.add('hidden'); 1265 // Show the loader 1266 loader.classList.remove('hidden'); 1267 // Open the gallery popup 1268 //openPopup('#gallery-popup'); 1269 // Fetch the gallery items 1270 const formData = new FormData(); 1271 if (hashValue[1] === 'gallery') { 1272 // Get the current category filter 1273 const filterButtons = document.querySelectorAll('.m__gallery__filter-bar__item'); 1274 const currentCategoryFilter = Array.from(filterButtons).findIndex((btn)=>btn.classList.contains('active')); 1275 formData.append('galleryFilter', currentCategoryFilter); 1276 const pageId = document.getElementById('js-body')?.dataset.page; 1277 formData.append('pageId', pageId); 1278 } else formData.append('galleryId', hashValue[1]); 1279 formData.append('action', 'getPopupGalleryItems'); 1280 const data = await (0, _utilities.postRequest)(formData); 1281 if (data) { 1282 // Update the gallery popup with the new items 1283 popupContentElem.innerHTML = data.popupContent; 1284 // Update the popup gallery id 1285 popup.dataset.galleryId = hashValue[1]; 1286 // Initialise the gallery slider 1287 const slider = popup.querySelector('.js-popup-gallery-slider'); 1288 (0, _popupGallerySlider.initPopupGallerySlider)(slider); 1289 setTimeout(()=>{ 1290 // Hide the loader once the gallery items are loaded 1291 loader.classList.add('hidden'); 1292 // Show the popup container 1293 popupContentElem.classList.remove('hidden'); 1294 // Set focus on the previous navigation button after gallery popup loads 1295 const prevNavBtn = popupContentElem.querySelector('.js-popup-gallery-nav-prev'); 1296 if (prevNavBtn) prevNavBtn.focus(); 1297 }, 400); 1298 // go to the selected gallery item 1299 if (hashValue[1] == 'gallery' && event) { 1300 // Get the clicked link element 1301 const clickedLink = event.target.closest('.m__gallery__grid__item-link'); 1302 if (clickedLink) { 1303 // Get all gallery item links 1304 const allGalleryLinks = Array.from(document.querySelectorAll('.m__gallery__grid__item-link')).filter((link)=>link.parentElement.style.display !== 'none'); 1305 // Find the index of the clicked element 1306 const index = Array.from(allGalleryLinks).indexOf(clickedLink) + 1; 1307 // Navigate to the gallery item at this index in the Swiper slider 1308 if (slider && slider.swiper) slider.swiper.slideTo(index); 1309 } 1310 } 1311 } else console.error('Error fetching gallery data.'); 1312 } 1313 // Data in the popup is already loaded for the gallery id being passed in, so just open the popup 1314 (0, _popups.openPopup)('#gallery-popup', triggerEl); 1315 } else if (hashValue[0] === 'embed-popup') { 1316 const popup = document.querySelector('#embed-popup'); 1317 const postId = popup.dataset.postId; 1318 if (hashValue[1] && hashValue[1] !== postId) { 1319 // Data in the popup is not loaded for the post id being passed in, so fetch the data and load it 1320 const popupContentElem = popup.querySelector('.js-embed-popup-content'); 1321 const loader = popup.querySelector('.js-embed-popup-loader'); 1322 // Hide the popup container 1323 popupContentElem.classList.add('hidden'); 1324 // Show the loader 1325 loader.classList.remove('hidden'); 1326 // Open the embed popup 1327 (0, _popups.openPopup)('#embed-popup', triggerEl); 1328 // Fetch the embed code 1329 const formData = new FormData(); 1330 formData.append('postId', hashValue[1]); 1331 formData.append('action', 'getPopupEmbedCode'); 1332 const data = await (0, _utilities.postRequest)(formData); 1333 if (data) { 1334 // Update the embed popup with the new embed code 1335 popupContentElem.innerHTML = data.popupContent; 1336 // Update the popup post id 1337 popup.dataset.postId = hashValue[1]; 1338 setTimeout(()=>{ 1339 // Hide the loader once the embed code is loaded 1340 loader.classList.add('hidden'); 1341 // Show the popup container 1342 popupContentElem.classList.remove('hidden'); 1343 }, 400); 1344 } else console.error('Error fetching embed code.'); 1345 } 1346 // Data in the popup is already loaded for the post id being passed in, so just open the popup 1347 (0, _popups.openPopup)('#embed-popup', triggerEl); 1348 } else if (hashValue[0] === 'scrollTo') { 1349 // Scroll to the element! 1350 let elementToScrollTo = document.querySelector('#' + hashValue[1]); 1351 if (elementToScrollTo) { 1352 locationPageSubnavs = document.querySelectorAll('.m__lsubnav'); 1353 if (locationPageSubnavs) { 1354 document.querySelector('body').classList.remove('js-popup-active');
1355 locationPageSubnavs.forEach((subnav)=>{ 1356 subnav.classList.remove('open'); 1357 }); 1358 } 1359 (0, _gsapDefault.default).registerPlugin((0, _scrollToPlugin.ScrollToPlugin)); 1360 (0, _gsapDefault.default).to(window, { 1361 duration: 1, 1362 scrollTo: elementToScrollTo 1363 }); 1364 } 1365 } else if (hashValue[0] == 'popup') // Open a custom popup 1366 { 1367 if (hashValue[1] != null && hashValue[1] > '') (0, _popups.openPopup)('#' + hashValue[1], triggerEl); 1368 } else return false; 1369 } 1370} 1371urlParams(); 1372 1373},{"gsap":"33IqQ","gsap/ScrollToPlugin":"kNbRi","../components/popups":"gP0kv","../helpers/utilities":"dH8qc","../components/popupGallerySlider":"1NO9a","../helpers/accessibility":"7yMoe","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"33IqQ":[function(require,module,exports,__globalThis) { 1374var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 1375parcelHelpers.defineInteropFlag(exports); 1376parcelHelpers.export(exports, "gsap", ()=>gsapWithCSS); 1377parcelHelpers.export(exports, "default", ()=>gsapWithCSS); 1378parcelHelpers.export(exports, "CSSPlugin", ()=>(0, _csspluginJs.CSSPlugin)); 1379parcelHelpers.export(exports, "TweenMax", ()=>TweenMaxWithCSS); 1380parcelHelpers.export(exports, "TweenLite", ()=>(0, _gsapCoreJs.TweenLite)); 1381parcelHelpers.export(exports, "TimelineMax", ()=>(0, _gsapCoreJs.TimelineMax)); 1382parcelHelpers.export(exports, "TimelineLite", ()=>(0, _gsapCoreJs.TimelineLite)); 1383parcelHelpers.export(exports, "Power0", ()=>(0, _gsapCoreJs.Power0)); 1384parcelHelpers.export(exports, "Power1", ()=>(0, _gsapCoreJs.Power1)); 1385parcelHelpers.export(exports, "Power2", ()=>(0, _gsapCoreJs.Power2)); 1386parcelHelpers.export(exports, "Power3", ()=>(0, _gsapCoreJs.Power3)); 1387parcelHelpers.export(exports, "Power4", ()=>(0, _gsapCoreJs.Power4)); 1388parcelHelpers.export(exports, "Linear", ()=>(0, _gsapCoreJs.Linear)); 1389parcelHelpers.export(exports, "Quad", ()=>(0, _gsapCoreJs.Quad)); 1390parcelHelpers.export(exports, "Cubic", ()=>(0, _gsapCoreJs.Cubic)); 1391parcelHelpers.export(exports, "Quart", ()=>(0, _gsapCoreJs.Quart)); 1392parcelHelpers.export(exports, "Quint", ()=>(0, _gsapCoreJs.Quint)); 1393parcelHelpers.export(exports, "Strong", ()=>(0, _gsapCoreJs.Strong)); 1394parcelHelpers.export(exports, "Elastic", ()=>(0, _gsapCoreJs.Elastic)); 1395parcelHelpers.export(exports, "Back", ()=>(0, _gsapCoreJs.Back)); 1396parcelHelpers.export(exports, "SteppedEase", ()=>(0, _gsapCoreJs.SteppedEase)); 1397parcelHelpers.export(exports, "Bounce", ()=>(0, _gsapCoreJs.Bounce)); 1398parcelHelpers.export(exports, "Sine", ()=>(0, _gsapCoreJs.Sine)); 1399parcelHelpers.export(exports, "Expo", ()=>(0, _gsapCoreJs.Expo)); 1400parcelHelpers.export(exports, "Circ", ()=>(0, _gsapCoreJs.Circ)); 1401var _gsapCoreJs = require("./gsap-core.js"); 1402var _csspluginJs = require("./CSSPlugin.js"); 1403var gsapWithCSS = (0, _gsapCoreJs.gsap).registerPlugin((0, _csspluginJs.CSSPlugin)) || (0, _gsapCoreJs.gsap), // to protect from tree shaking 1404TweenMaxWithCSS = gsapWithCSS.core.Tween; 1405 1406},{"./gsap-core.js":"gljYa","./CSSPlugin.js":"ds5Ep","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"gljYa":[function(require,module,exports,__globalThis) { 1407var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 1408parcelHelpers.defineInteropFlag(exports); 1409parcelHelpers.export(exports, "GSCache", ()=>GSCache); 1410parcelHelpers.export(exports, "Animation", ()=>Animation); 1411parcelHelpers.export(exports, "Timeline", ()=>Timeline); 1412parcelHelpers.export(exports, "Tween", ()=>Tween); 1413parcelHelpers.export(exports, "PropTween", ()=>PropTween); 1414parcelHelpers.export(exports, "gsap", ()=>gsap); 1415parcelHelpers.export(exports, "Power0", ()=>Power0); 1416parcelHelpers.export(exports, "Power1", ()=>Power1); 1417parcelHelpers.export(exports, "Power2", ()=>Power2); 1418parcelHelpers.export(exports, "Power3", ()=>Power3); 1419parcelHelpers.export(exports, "Power4", ()=>Power4); 1420parcelHelpers.export(exports, "Linear", ()=>Linear); 1421parcelHelpers.export(exports, "Quad", ()=>Quad); 1422parcelHelpers.export(exports, "Cubic", ()=>Cubic); 1423parcelHelpers.export(exports, "Quart", ()=>Quart); 1424parcelHelpers.export(exports, "Quint", ()=>Quint); 1425parcelHelpers.export(exports, "Strong", ()=>Strong); 1426parcelHelpers.export(exports, "Elastic", ()=>Elastic); 1427parcelHelpers.export(exports, "Back", ()=>Back); 1428parcelHelpers.export(exports, "SteppedEase", ()=>SteppedEase); 1429parcelHelpers.export(exports, "Bounce", ()=>
vendor: 5,758 bytes, lines 1429-1527
1429Bounce); 1430parcelHelpers.export(exports, "Sine", ()=>Sine); 1431parcelHelpers.export(exports, "Expo", ()=>Expo); 1432parcelHelpers.export(exports, "Circ", ()=>Circ); 1433parcelHelpers.export(exports, "TweenMax", ()=>Tween) //export some internal methods/orojects for use in CSSPlugin so that we can externalize that file and allow custom builds that exclude it. 1434; 1435parcelHelpers.export(exports, "TweenLite", ()=>Tween); 1436parcelHelpers.export(exports, "TimelineMax", ()=>Timeline); 1437parcelHelpers.export(exports, "TimelineLite", ()=>Timeline); 1438parcelHelpers.export(exports, "default", ()=>gsap); 1439parcelHelpers.export(exports, "wrap", ()=>wrap); 1440parcelHelpers.export(exports, "wrapYoyo", ()=>wrapYoyo); 1441parcelHelpers.export(exports, "distribute", ()=>distribute); 1442parcelHelpers.export(exports, "random", ()=>random); 1443parcelHelpers.export(exports, "snap", ()=>snap); 1444parcelHelpers.export(exports, "normalize", ()=>normalize); 1445parcelHelpers.export(exports, "getUnit", ()=>getUnit); 1446parcelHelpers.export(exports, "clamp", ()=>clamp); 1447parcelHelpers.export(exports, "splitColor", ()=>splitColor); 1448parcelHelpers.export(exports, "toArray", ()=>toArray); 1449parcelHelpers.export(exports, "selector", ()=>selector); 1450parcelHelpers.export(exports, "mapRange", ()=>mapRange); 1451parcelHelpers.export(exports, "pipe", ()=>pipe); 1452parcelHelpers.export(exports, "unitize", ()=>unitize); 1453parcelHelpers.export(exports, "interpolate", ()=>interpolate); 1454parcelHelpers.export(exports, "shuffle", ()=>shuffle); 1455parcelHelpers.export(exports, "_getProperty", ()=>_getProperty); 1456parcelHelpers.export(exports, "_numExp", ()=>_numExp); 1457parcelHelpers.export(exports, "_numWithUnitExp", ()=>_numWithUnitExp); 1458parcelHelpers.export(exports, "_isString", ()=>_isString); 1459parcelHelpers.export(exports, "_isUndefined", ()=>_isUndefined); 1460parcelHelpers.export(exports, "_renderComplexString", ()=>_renderComplexString); 1461parcelHelpers.export(exports, "_relExp", ()=>_relExp); 1462parcelHelpers.export(exports, "_setDefaults", ()=>_setDefaults); 1463parcelHelpers.export(exports, "_removeLinkedListItem", ()=>_removeLinkedListItem); 1464parcelHelpers.export(exports, "_forEachName", ()=>_forEachName); 1465parcelHelpers.export(exports, "_sortPropTweensByPriority", ()=>_sortPropTweensByPriority); 1466parcelHelpers.export(exports, "_colorStringFilter", ()=>_colorStringFilter); 1467parcelHelpers.export(exports, "_replaceRandom", ()=>_replaceRandom); 1468parcelHelpers.export(exports, "_checkPlugin", ()=>_checkPlugin); 1469parcelHelpers.export(exports, "_plugins", ()=>_plugins); 1470parcelHelpers.export(exports, "_ticker", ()=>_ticker); 1471parcelHelpers.export(exports, "_config", ()=>_config); 1472parcelHelpers.export(exports, "_roundModifier", ()=>_roundModifier); 1473parcelHelpers.export(exports, "_round", ()=>_round); 1474parcelHelpers.export(exports, "_missingPlugin", ()=>_missingPlugin); 1475parcelHelpers.export(exports, "_getSetter", ()=>_getSetter); 1476parcelHelpers.export(exports, "_getCache", ()=>_getCache); 1477parcelHelpers.export(exports, "_colorExp", ()=>_colorExp); 1478parcelHelpers.export(exports, "_parseRelative", ()=>_parseRelative); 1479function _assertThisInitialized(self) { 1480 if (self === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 1481 return self; 1482} 1483function _inheritsLoose(subClass, superClass) { 1484 subClass.prototype = Object.create(superClass.prototype); 1485 subClass.prototype.constructor = subClass; 1486 subClass.__proto__ = superClass; 1487} 1488/*! 1489 * GSAP 3.13.0 1490 * https://gsap.com 1491 * 1492 * @license Copyright 2008-2025, GreenSock. All rights reserved. 1493 * Subject to the terms at https://gsap.com/standard-license 1494 * @author: Jack Doyle, [email protected] 1495*/ /* eslint-disable */ var _config = { 1496 autoSleep: 120, 1497 force3D: "auto", 1498 nullTargetWarn: 1, 1499 units: { 1500 lineHeight: "" 1501 } 1502}, _defaults = { 1503 duration: .5, 1504 overwrite: false, 1505 delay: 0 1506}, _suppressOverwrites, _reverting, _context, _bigNum = 1e8, _tinyNum = 1 / _bigNum, _2PI = Math.PI * 2, _HALF_PI = _2PI / 4, _gsID = 0, _sqrt = Math.sqrt, _cos = Math.cos, _sin = Math.sin, _isString = function _isString(value) { 1507 return typeof value === "string"; 1508}, _isFunction = function _isFunction(value) { 1509 return typeof value === "function"; 1510}, _isNumber = function _isNumber(value) { 1511 return typeof value === "number"; 1512}, _isUndefined = function _isUndefined(value) { 1513 return typeof value === "undefined"; 1514}, _isObject = function _isObject(value) { 1515 return typeof value === "object"; 1516}, _isNotFalse = function _isNotFalse(value) { 1517 return value !== false; 1518}, _windowExists = function _windowExists() { 1519 return typeof window !== "undefined"; 1520}, _isFuncOrString = function _isFuncOrString(value) { 1521 return _isFunction(value) || _isString(value); 1522}, _isTypedArray = typeof ArrayBuffer === "function" && ArrayBuffer.isView || function() {}, // note: IE10 has ArrayBuffer, but NOT ArrayBuffer.isView(). 1523_isArray = Array.isArray, _strictNumExp = /(?:-?\.?\d|\.)+/gi, //only numbers (including negatives and decimals) but NOT relative values. 1524_numExp = /[-+=.]*\d+[.e\-+]*\d*[e\-+]*\d*/g, //finds any numbers, including ones that start with += or -=, negative numbers, and ones in scientific notation like 1e-8. 1525_numWithUnitExp = /[-+=.]*\d+[.e-]*\d*[a-z%]*/g, _complexStringNumExp = /[-+=.]*\d+\.?\d*(?:e-|e\+)?\d*/gi, //duplicate so that while we're looping through matches from exec(), it doesn't contaminate the lastIndex of _numExp which we use to search for colors too. 1526_relExp = /[+-]=-?[.\d]+/, _delimitedValueExp = /[^,'"\[\]\s]+/gi, // previously /[#\-+.]*\b[a-z\d\-=+%.]+/gi but didn't catch special characters. 1527_unitExp = /^[+\-=e\s\d]*\d+[.\d]*([a-z]*|%)\s*$/i, _globalTimeline, _win, _coreInitted, _doc, _globals = {}, _installScope = {}, _coreReady, _install = function _install(scope) {
vendor: 30,274 bytes, lines 1528-1963
1528 return (_installScope = _merge(scope, _globals)) && gsap; 1529}, _missingPlugin = function _missingPlugin(property, value) { 1530 return console.warn("Invalid property", property, "set to", value, "Missing plugin? gsap.registerPlugin()"); 1531}, _warn = function _warn(message, suppress) { 1532 return !suppress && console.warn(message); 1533}, _addGlobal = function _addGlobal(name, obj) { 1534 return name && (_globals[name] = obj) && _installScope && (_installScope[name] = obj) || _globals; 1535}, _emptyFunc = function _emptyFunc() { 1536 return 0; 1537}, _startAtRevertConfig = { 1538 suppressEvents: true, 1539 isStart: true, 1540 kill: false 1541}, _revertConfigNoKill = { 1542 suppressEvents: true, 1543 kill: false 1544}, _revertConfig = { 1545 suppressEvents: true 1546}, _reservedProps = {}, _lazyTweens = [], _lazyLookup = {}, _lastRenderedFrame, _plugins = {}, _effects = {}, _nextGCFrame = 30, _harnessPlugins = [], _callbackNames = "", _harness = function _harness(targets) { 1547 var target = targets[0], harnessPlugin, i; 1548 _isObject(target) || _isFunction(target) || (targets = [ 1549 targets 1550 ]); 1551 if (!(harnessPlugin = (target._gsap || {}).harness)) { 1552 // find the first target with a harness. We assume targets passed into an animation will be of similar type, meaning the same kind of harness can be used for them all (performance optimization) 1553 i = _harnessPlugins.length; 1554 while(i-- && !_harnessPlugins[i].targetTest(target)); 1555 harnessPlugin = _harnessPlugins[i]; 1556 } 1557 i = targets.length; 1558 while(i--)targets[i] && (targets[i]._gsap || (targets[i]._gsap = new GSCache(targets[i], harnessPlugin))) || targets.splice(i, 1); 1559 return targets; 1560}, _getCache = function _getCache(target) { 1561 return target._gsap || _harness(toArray(target))[0]._gsap; 1562}, _getProperty = function _getProperty(target, property, v) { 1563 return (v = target[property]) && _isFunction(v) ? target[property]() : _isUndefined(v) && target.getAttribute && target.getAttribute(property) || v; 1564}, _forEachName = function _forEachName(names, func) { 1565 return (names = names.split(",")).forEach(func) || names; 1566}, //split a comma-delimited list of names into an array, then run a forEach() function and return the split array (this is just a way to consolidate/shorten some code). 1567_round = function _round(value) { 1568 return Math.round(value * 100000) / 100000 || 0; 1569}, _roundPrecise = function _roundPrecise(value) { 1570 return Math.round(value * 10000000) / 10000000 || 0; 1571}, // increased precision mostly for timing values. 1572_parseRelative = function _parseRelative(start, value) { 1573 var operator = value.charAt(0), end = parseFloat(value.substr(2)); 1574 start = parseFloat(start); 1575 return operator === "+" ? start + end : operator === "-" ? start - end : operator === "*" ? start * end : start / end; 1576}, _arrayContainsAny = function _arrayContainsAny(toSearch, toFind) { 1577 //searches one array to find matches for any of the items in the toFind array. As soon as one is found, it returns true. It does NOT return all the matches; it's simply a boolean search. 1578 var l = toFind.length, i = 0; 1579 for(; toSearch.indexOf(toFind[i]) < 0 && ++i < l;); 1580 return i < l; 1581}, _lazyRender = function _lazyRender() { 1582 var l = _lazyTweens.length, a = _lazyTweens.slice(0), i, tween; 1583 _lazyLookup = {}; 1584 _lazyTweens.length = 0; 1585 for(i = 0; i < l; i++){ 1586 tween = a[i]; 1587 tween && tween._lazy && (tween.render(tween._lazy[0], tween._lazy[1], true)._lazy = 0); 1588 } 1589}, _isRevertWorthy = function _isRevertWorthy(animation) { 1590 return !!(animation._initted || animation._startAt || animation.add); 1591}, _lazySafeRender = function _lazySafeRender(animation, time, suppressEvents, force) { 1592 _lazyTweens.length && !_reverting && _lazyRender(); 1593 animation.render(time, suppressEvents, force || !!(_reverting && time < 0 && _isRevertWorthy(animation))); 1594 _lazyTweens.length && !_reverting && _lazyRender(); //in case rendering caused any tweens to lazy-init, we should render them because typically when someone calls seek() or time() or progress(), they expect an immediate render. 1595}, _numericIfPossible = function _numericIfPossible(value) { 1596 var n = parseFloat(value); 1597 return (n || n === 0) && (value + "").match(_delimitedValueExp).length < 2 ? n : _isString(value) ? value.trim() : value; 1598}, _passThrough = function _passThrough(p) { 1599 return p; 1600}, _setDefaults = function _setDefaults(obj, defaults) { 1601 for(var p in defaults)p in obj || (obj[p] = defaults[p]); 1602 return obj; 1603}, _setKeyframeDefaults = function _setKeyframeDefaults(excludeDuration) { 1604 return function(obj, defaults) { 1605 for(var p in defaults)p in obj || p === "duration" && excludeDuration || p === "ease" || (obj[p] = defaults[p]); 1606 }; 1607}, _merge = function _merge(base, toMerge) { 1608 for(var p in toMerge)base[p] = toMerge[p]; 1609 return base; 1610}, _mergeDeep = function _mergeDeep(base, toMerge) { 1611 for(var p in toMerge)p !== "__proto__" && p !== "constructor" && p !== "prototype" && (base[p] = _isObject(toMerge[p]) ? _mergeDeep(base[p] || (base[p] = {}), toMerge[p]) : toMerge[p]); 1612 return base; 1613}, _copyExcluding = function _copyExcluding(obj, excluding) { 1614 var copy = {}, p; 1615 for(p in obj)p in excluding || (copy[p] = obj[p]); 1616 return copy; 1617}, _inheritDefaults = function _inheritDefaults(vars) { 1618 var parent = vars.parent || _globalTimeline, func = vars.keyframes ? _setKeyframeDefaults(_isArray(vars.keyframes)) : _setDefaults; 1619 if (_isNotFalse(vars.inherit)) while(parent){ 1620 func(vars, parent.vars.defaults); 1621 parent = parent.parent || parent._dp; 1622 } 1623 return vars; 1624}, _arraysMatch = function _arraysMatch(a1, a2) { 1625 var i = a1.length, match = i === a2.length; 1626 while(match && i-- && a1[i] === a2[i]); 1627 return i < 0; 1628}, _addLinkedListItem = function _addLinkedListItem(parent, child, firstProp, lastProp, sortBy) { 1629 if (firstProp === void 0) firstProp = "_first"; 1630 if (lastProp === void 0) lastProp = "_last"; 1631 var prev = parent[lastProp], t; 1632 if (sortBy) { 1633 t = child[sortBy]; 1634 while(prev && prev[sortBy] > t)prev = prev._prev; 1635 } 1636 if (prev) { 1637 child._next = prev._next; 1638 prev._next = child; 1639 } else { 1640 child._next = parent[firstProp]; 1641 parent[firstProp] = child; 1642 } 1643 if (child._next) child._next._prev = child; 1644 else parent[lastProp] = child; 1645 child._prev = prev; 1646 child.parent = child._dp = parent; 1647 return child; 1648}, _removeLinkedListItem = function _removeLinkedListItem(parent, child, firstProp, lastProp) { 1649 if (firstProp === void 0) firstProp = "_first"; 1650 if (lastProp === void 0) lastProp = "_last"; 1651 var prev = child._prev, next = child._next; 1652 if (prev) prev._next = next; 1653 else if (parent[firstProp] === child) parent[firstProp] = next; 1654 if (next) next._prev = prev; 1655 else if (parent[lastProp] === child) parent[lastProp] = prev; 1656 child._next = child._prev = child.parent = null; // don't delete the _dp just so we can revert if necessary. But parent should be null to indicate the item isn't in a linked list. 1657}, _removeFromParent = function _removeFromParent(child, onlyIfParentHasAutoRemove) { 1658 child.parent && (!onlyIfParentHasAutoRemove || child.parent.autoRemoveChildren) && child.parent.remove && child.parent.remove(child); 1659 child._act = 0; 1660}, _uncache = function _uncache(animation, child) { 1661 if (animation && (!child || child._end > animation._dur || child._start < 0)) { 1662 // performance optimization: if a child animation is passed in we should only uncache if that child EXTENDS the animation (its end time is beyond the end) 1663 var a = animation; 1664 while(a){ 1665 a._dirty = 1; 1666 a = a.parent; 1667 } 1668 } 1669 return animation; 1670}, _recacheAncestors = function _recacheAncestors(animation) { 1671 var parent = animation.parent; 1672 while(parent && parent.parent){ 1673 //sometimes we must force a re-sort of all children and update the duration/totalDuration of all ancestor timelines immediately in case, for example, in the middle of a render loop, one tween alters another tween's timeScale which shoves its startTime before 0, forcing the parent timeline to shift around and shiftChildren() which could affect that next tween's render (startTime). Doesn't matter for the root timeline though. 1674 parent._dirty = 1; 1675 parent.totalDuration(); 1676 parent = parent.parent; 1677 } 1678 return animation; 1679}, _rewindStartAt = function _rewindStartAt(tween, totalTime, suppressEvents, force) { 1680 return tween._startAt && (_reverting ? tween._startAt.revert(_revertConfigNoKill) : tween.vars.immediateRender && !tween.vars.autoRevert || tween._startAt.render(totalTime, true, force)); 1681}, _hasNoPausedAncestors = function _hasNoPausedAncestors(animation) { 1682 return !animation || animation._ts && _hasNoPausedAncestors(animation.parent); 1683}, _elapsedCycleDuration = function _elapsedCycleDuration(animation) { 1684 return animation._repeat ? _animationCycle(animation._tTime, animation = animation.duration() + animation._rDelay) * animation : 0; 1685}, // feed in the totalTime and cycleDuration and it'll return the cycle (iteration minus 1) and if the playhead is exactly at the very END, it will NOT bump up to the next cycle. 1686_animationCycle = function _animationCycle(tTime, cycleDuration) { 1687 var whole = Math.floor(tTime = _roundPrecise(tTime / cycleDuration)); 1688 return tTime && whole === tTime ? whole - 1 : whole; 1689}, _parentToChildTotalTime = function _parentToChildTotalTime(parentTime, child) { 1690 return (parentTime - child._start) * child._ts + (child._ts >= 0 ? 0 : child._dirty ? child.totalDuration() : child._tDur); 1691}, _setEnd = function _setEnd(animation) { 1692 return animation._end = _roundPrecise(animation._start + (animation._tDur / Math.abs(animation._ts || animation._rts || _tinyNum) || 0)); 1693}, _alignPlayhead = function _alignPlayhead(animation, totalTime) { 1694 // adjusts the animation's _start and _end according to the provided totalTime (only if the parent's smoothChildTiming is true and the animation isn't paused). It doesn't do any rendering or forcing things back into parent timelines, etc. - that's what totalTime() is for. 1695 var parent = animation._dp; 1696 if (parent && parent.smoothChildTiming && animation._ts) { 1697 animation._start = _roundPrecise(parent._time - (animation._ts > 0 ? totalTime / animation._ts : ((animation._dirty ? animation.totalDuration() : animation._tDur) - totalTime) / -animation._ts)); 1698 _setEnd(animation); 1699 parent._dirty || _uncache(parent, animation); //for performance improvement. If the parent's cache is already dirty, it already took care of marking the ancestors as dirty too, so skip the function call here. 1700 } 1701 return animation; 1702}, /* 1703_totalTimeToTime = (clampedTotalTime, duration, repeat, repeatDelay, yoyo) => { 1704 let cycleDuration = duration + repeatDelay, 1705 time = _round(clampedTotalTime % cycleDuration); 1706 if (time > duration) { 1707 time = duration; 1708 } 1709 return (yoyo && (~~(clampedTotalTime / cycleDuration) & 1)) ? duration - time : time; 1710}, 1711*/ _postAddChecks = function _postAddChecks(timeline, child) { 1712 var t; 1713 if (child._time || !child._dur && child._initted || child._start < timeline._time && (child._dur || !child.add)) { 1714 // in case, for example, the _start is moved on a tween that has already rendered, or if it's being inserted into a timeline BEFORE where the playhead is currently. Imagine it's at its end state, then the startTime is moved WAY later (after the end of this timeline), it should render at its beginning. Special case: if it's a timeline (has .add() method) and no duration, we can skip rendering because the user may be populating it AFTER adding it to a parent timeline (unconventional, but possible, and we wouldn't want it to get removed if the parent's autoRemoveChildren is true). 1715 t = _parentToChildTotalTime(timeline.rawTime(), child); 1716 if (!child._dur || _clamp(0, child.totalDuration(), t) - child._tTime > _tinyNum) child.render(t, true); 1717 } //if the timeline has already ended but the inserted tween/timeline extends the duration, we should enable this timeline again so that it renders properly. We should also align the playhead with the parent timeline's when appropriate. 1718 if (_uncache(timeline, child)._dp && timeline._initted && timeline._time >= timeline._dur && timeline._ts) { 1719 //in case any of the ancestors had completed but should now be enabled... 1720 if (timeline._dur < timeline.duration()) { 1721 t = timeline; 1722 while(t._dp){ 1723 t.rawTime() >= 0 && t.totalTime(t._tTime); //moves the timeline (shifts its startTime) if necessary, and also enables it. If it's currently zero, though, it may not be scheduled to render until later so there's no need to force it to align with the current playhead position. Only move to catch up with the playhead. 1724 t = t._dp; 1725 } 1726 } 1727 timeline._zTime = -_tinyNum; // helps ensure that the next render() will be forced (crossingStart = true in render()), even if the duration hasn't changed (we're adding a child which would need to get rendered). Definitely an edge case. Note: we MUST do this AFTER the loop above where the totalTime() might trigger a render() because this _addToTimeline() method gets called from the Animation constructor, BEFORE tweens even record their targets, etc. so we wouldn't want things to get triggered in the wrong order. 1728 } 1729}, _addToTimeline = function _addToTimeline(timeline, child, position, skipChecks) { 1730 child.parent && _removeFromParent(child); 1731 child._start = _roundPrecise((_isNumber(position) ? position : position || timeline !== _globalTimeline ? _parsePosition(timeline, position, child) : timeline._time) + child._delay); 1732 child._end = _roundPrecise(child._start + (child.totalDuration() / Math.abs(child.timeScale()) || 0)); 1733 _addLinkedListItem(timeline, child, "_first", "_last", timeline._sort ? "_start" : 0); 1734 _isFromOrFromStart(child) || (timeline._recent = child); 1735 skipChecks || _postAddChecks(timeline, child); 1736 timeline._ts < 0 && _alignPlayhead(timeline, timeline._tTime); // if the timeline is reversed and the new child makes it longer, we may need to adjust the parent's _start (push it back) 1737 return timeline; 1738}, _scrollTrigger = function _scrollTrigger(animation, trigger) { 1739 return (_globals.ScrollTrigger || _missingPlugin("scrollTrigger", trigger)) && _globals.ScrollTrigger.create(trigger, animation); 1740}, _attemptInitTween = function _attemptInitTween(tween, time, force, suppressEvents, tTime) { 1741 _initTween(tween, time, tTime); 1742 if (!tween._initted) return 1; 1743 if (!force && tween._pt && !_reverting && (tween._dur && tween.vars.lazy !== false || !tween._dur && tween.vars.lazy) && _lastRenderedFrame !== _ticker.frame) { 1744 _lazyTweens.push(tween); 1745 tween._lazy = [ 1746 tTime, 1747 suppressEvents 1748 ]; 1749 return 1; 1750 } 1751}, _parentPlayheadIsBeforeStart = function _parentPlayheadIsBeforeStart(_ref) { 1752 var parent = _ref.parent; 1753 return parent && parent._ts && parent._initted && !parent._lock && (parent.rawTime() < 0 || _parentPlayheadIsBeforeStart(parent)); 1754}, // check parent's _lock because when a timeline repeats/yoyos and does its artificial wrapping, we shouldn't force the ratio back to 0 1755_isFromOrFromStart = function _isFromOrFromStart(_ref2) { 1756 var data = _ref2.data; 1757 return data === "isFromStart" || data === "isStart"; 1758}, _renderZeroDurationTween = function _renderZeroDurationTween(tween, totalTime, suppressEvents, force) { 1759 var prevRatio = tween.ratio, ratio = totalTime < 0 || !totalTime && (!tween._start && _parentPlayheadIsBeforeStart(tween) && !(!tween._initted && _isFromOrFromStart(tween)) || (tween._ts < 0 || tween._dp._ts < 0) && !_isFromOrFromStart(tween)) ? 0 : 1, // if the tween or its parent is reversed and the totalTime is 0, we should go to a ratio of 0. Edge case: if a from() or fromTo() stagger tween is placed later in a timeline, the "startAt" zero-duration tween could initially render at a time when the parent timeline's playhead is technically BEFORE where this tween is, so make sure that any "from" and "fromTo" startAt tweens are rendered the first time at a ratio of 1. 1760 repeatDelay = tween._rDelay, tTime = 0, pt, iteration, prevIteration; 1761 if (repeatDelay && tween._repeat) { 1762 // in case there's a zero-duration tween that has a repeat with a repeatDelay 1763 tTime = _clamp(0, tween._tDur, totalTime); 1764 iteration = _animationCycle(tTime, repeatDelay); 1765 tween._yoyo && iteration & 1 && (ratio = 1 - ratio); 1766 if (iteration !== _animationCycle(tween._tTime, repeatDelay)) { 1767 // if iteration changed 1768 prevRatio = 1 - ratio; 1769 tween.vars.repeatRefresh && tween._initted && tween.invalidate(); 1770 } 1771 } 1772 if (ratio !== prevRatio || _reverting || force || tween._zTime === _tinyNum || !totalTime && tween._zTime) { 1773 if (!tween._initted && _attemptInitTween(tween, totalTime, force, suppressEvents, tTime)) // if we render the very beginning (time == 0) of a fromTo(), we must force the render (normal tweens wouldn't need to render at a time of 0 when the prevTime was also 0). This is also mandatory to make sure overwriting kicks in immediately. 1774 return; 1775 prevIteration = tween._zTime; 1776 tween._zTime = totalTime || (suppressEvents ? _tinyNum : 0); // when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration tween, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. 1777 suppressEvents || (suppressEvents = totalTime && !prevIteration); // if it was rendered previously at exactly 0 (_zTime) and now the playhead is moving away, DON'T fire callbacks otherwise they'll seem like duplicates. 1778 tween.ratio = ratio; 1779 tween._from && (ratio = 1 - ratio); 1780 tween._time = 0; 1781 tween._tTime = tTime; 1782 pt = tween._pt; 1783 while(pt){ 1784 pt.r(ratio, pt.d); 1785 pt = pt._next; 1786 } 1787 totalTime < 0 && _rewindStartAt(tween, totalTime, suppressEvents, true); 1788 tween._onUpdate && !suppressEvents && _callback(tween, "onUpdate"); 1789 tTime && tween._repeat && !suppressEvents && tween.parent && _callback(tween, "onRepeat"); 1790 if ((totalTime >= tween._tDur || totalTime < 0) && tween.ratio === ratio) { 1791 ratio && _removeFromParent(tween, 1); 1792 if (!suppressEvents && !_reverting) { 1793 _callback(tween, ratio ? "onComplete" : "onReverseComplete", true); 1794 tween._prom && tween._prom(); 1795 } 1796 } 1797 } else if (!tween._zTime) tween._zTime = totalTime; 1798}, _findNextPauseTween = function _findNextPauseTween(animation, prevTime, time) { 1799 var child; 1800 if (time > prevTime) { 1801 child = animation._first; 1802 while(child && child._start <= time){ 1803 if (child.data === "isPause" && child._start > prevTime) return child; 1804 child = child._next; 1805 } 1806 } else { 1807 child = animation._last; 1808 while(child && child._start >= time){ 1809 if (child.data === "isPause" && child._start < prevTime) return child; 1810 child = child._prev; 1811 } 1812 } 1813}, _setDuration = function _setDuration(animation, duration, skipUncache, leavePlayhead) { 1814 var repeat = animation._repeat, dur = _roundPrecise(duration) || 0, totalProgress = animation._tTime / animation._tDur; 1815 totalProgress && !leavePlayhead && (animation._time *= dur / animation._dur); 1816 animation._dur = dur; 1817 animation._tDur = !repeat ? dur : repeat < 0 ? 1e10 : _roundPrecise(dur * (repeat + 1) + animation._rDelay * repeat); 1818 totalProgress > 0 && !leavePlayhead && _alignPlayhead(animation, animation._tTime = animation._tDur * totalProgress); 1819 animation.parent && _setEnd(animation); 1820 skipUncache || _uncache(animation.parent, animation); 1821 return animation; 1822}, _onUpdateTotalDuration = function _onUpdateTotalDuration(animation) { 1823 return animation instanceof Timeline ? _uncache(animation) : _setDuration(animation, animation._dur); 1824}, _zeroPosition = { 1825 _start: 0, 1826 endTime: _emptyFunc, 1827 totalDuration: _emptyFunc 1828}, _parsePosition = function _parsePosition(animation, position, percentAnimation) { 1829 var labels = animation.labels, recent = animation._recent || _zeroPosition, clippedDuration = animation.duration() >= _bigNum ? recent.endTime(false) : animation._dur, //in case there's a child that infinitely repeats, users almost never intend for the insertion point of a new child to be based on a SUPER long value like that so we clip it and assume the most recently-added child's endTime should be used instead. 1830 i, offset, isPercent; 1831 if (_isString(position) && (isNaN(position) || position in labels)) { 1832 //if the string is a number like "1", check to see if there's a label with that name, otherwise interpret it as a number (absolute value). 1833 offset = position.charAt(0); 1834 isPercent = position.substr(-1) === "%"; 1835 i = position.indexOf("="); 1836 if (offset === "<" || offset === ">") { 1837 i >= 0 && (position = position.replace(/=/, "")); 1838 return (offset === "<" ? recent._start : recent.endTime(recent._repeat >= 0)) + (parseFloat(position.substr(1)) || 0) * (isPercent ? (i < 0 ? recent : percentAnimation).totalDuration() / 100 : 1); 1839 } 1840 if (i < 0) { 1841 position in labels || (labels[position] = clippedDuration); 1842 return labels[position]; 1843 } 1844 offset = parseFloat(position.charAt(i - 1) + position.substr(i + 1)); 1845 if (isPercent && percentAnimation) offset = offset / 100 * (_isArray(percentAnimation) ? percentAnimation[0] : percentAnimation).totalDuration(); 1846 return i > 1 ? _parsePosition(animation, position.substr(0, i - 1), percentAnimation) + offset : clippedDuration + offset; 1847 } 1848 return position == null ? clippedDuration : +position; 1849}, _createTweenType = function _createTweenType(type, params, timeline) { 1850 var isLegacy = _isNumber(params[1]), varsIndex = (isLegacy ? 2 : 1) + (type < 2 ? 0 : 1), vars = params[varsIndex], irVars, parent; 1851 isLegacy && (vars.duration = params[1]); 1852 vars.parent = timeline; 1853 if (type) { 1854 irVars = vars; 1855 parent = timeline; 1856 while(parent && !("immediateRender" in irVars)){ 1857 // inheritance hasn't happened yet, but someone may have set a default in an ancestor timeline. We could do vars.immediateRender = _isNotFalse(_inheritDefaults(vars).immediateRender) but that'd exact a slight performance penalty because _inheritDefaults() also runs in the Tween constructor. We're paying a small kb price here to gain speed. 1858 irVars = parent.vars.defaults || {}; 1859 parent = _isNotFalse(parent.vars.inherit) && parent.parent; 1860 } 1861 vars.immediateRender = _isNotFalse(irVars.immediateRender); 1862 type < 2 ? vars.runBackwards = 1 : vars.startAt = params[varsIndex - 1]; // "from" vars 1863 } 1864 return new Tween(params[0], vars, params[varsIndex + 1]); 1865}, _conditionalReturn = function _conditionalReturn(value, func) { 1866 return value || value === 0 ? func(value) : func; 1867}, _clamp = function _clamp(min, max, value) { 1868 return value < min ? min : value > max ? max : value; 1869}, getUnit = function getUnit(value, v) { 1870 return !_isString(value) || !(v = _unitExp.exec(value)) ? "" : v[1]; 1871}, // note: protect against padded numbers as strings, like "100.100". That shouldn't return "00" as the unit. If it's numeric, return no unit. 1872clamp = function clamp(min, max, value) { 1873 return _conditionalReturn(value, function(v) { 1874 return _clamp(min, max, v); 1875 }); 1876}, _slice = [].slice, _isArrayLike = function _isArrayLike(value, nonEmpty) { 1877 return value && _isObject(value) && "length" in value && (!nonEmpty && !value.length || value.length - 1 in value && _isObject(value[0])) && !value.nodeType && value !== _win; 1878}, _flatten = function _flatten(ar, leaveStrings, accumulator) { 1879 if (accumulator === void 0) accumulator = []; 1880 return ar.forEach(function(value) { 1881 var _accumulator; 1882 return _isString(value) && !leaveStrings || _isArrayLike(value, 1) ? (_accumulator = accumulator).push.apply(_accumulator, toArray(value)) : accumulator.push(value); 1883 }) || accumulator; 1884}, //takes any value and returns an array. If it's a string (and leaveStrings isn't true), it'll use document.querySelectorAll() and convert that to an array. It'll also accept iterables like jQuery objects. 1885toArray = function toArray(value, scope, leaveStrings) { 1886 return _context && !scope && _context.selector ? _context.selector(value) : _isString(value) && !leaveStrings && (_coreInitted || !_wake()) ? _slice.call((scope || _doc).querySelectorAll(value), 0) : _isArray(value) ? _flatten(value, leaveStrings) : _isArrayLike(value) ? _slice.call(value, 0) : value ? [ 1887 value 1888 ] : []; 1889}, selector = function selector(value) { 1890 value = toArray(value)[0] || _warn("Invalid scope") || {}; 1891 return function(v) { 1892 var el = value.current || value.nativeElement || value; 1893 return toArray(v, el.querySelectorAll ? el : el === value ? _warn("Invalid scope") || _doc.createElement("div") : value); 1894 }; 1895}, shuffle = function shuffle(a) { 1896 return a.sort(function() { 1897 return .5 - Math.random(); 1898 }); 1899}, // alternative that's a bit faster and more reliably diverse but bigger: for (let j, v, i = a.length; i; j = (Math.random() * i) | 0, v = a[--i], a[i] = a[j], a[j] = v); return a; 1900//for distributing values across an array. Can accept a number, a function or (most commonly) a function which can contain the following properties: {base, amount, from, ease, grid, axis, length, each}. Returns a function that expects the following parameters: index, target, array. Recognizes the following 1901distribute = function distribute(v) { 1902 if (_isFunction(v)) return v; 1903 var vars = _isObject(v) ? v : { 1904 each: v 1905 }, //n:1 is just to indicate v was a number; we leverage that later to set v according to the length we get. If a number is passed in, we treat it like the old stagger value where 0.1, for example, would mean that things would be distributed with 0.1 between each element in the array rather than a total "amount" that's chunked out among them all. 1906 ease = _parseEase(vars.ease), from = vars.from || 0, base = parseFloat(vars.base) || 0, cache = {}, isDecimal = from > 0 && from < 1, ratios = isNaN(from) || isDecimal, axis = vars.axis, ratioX = from, ratioY = from; 1907 if (_isString(from)) ratioX = ratioY = ({ 1908 center: .5, 1909 edges: .5, 1910 end: 1 1911 })[from] || 0; 1912 else if (!isDecimal && ratios) { 1913 ratioX = from[0]; 1914 ratioY = from[1]; 1915 } 1916 return function(i, target, a) { 1917 var l = (a || vars).length, distances = cache[l], originX, originY, x, y, d, j, max, min, wrapAt; 1918 if (!distances) { 1919 wrapAt = vars.grid === "auto" ? 0 : (vars.grid || [ 1920 1, 1921 _bigNum 1922 ])[1]; 1923 if (!wrapAt) { 1924 max = -_bigNum; 1925 while(max < (max = a[wrapAt++].getBoundingClientRect().left) && wrapAt < l); 1926 wrapAt < l && wrapAt--; 1927 } 1928 distances = cache[l] = []; 1929 originX = ratios ? Math.min(wrapAt, l) * ratioX - .5 : from % wrapAt; 1930 originY = wrapAt === _bigNum ? 0 : ratios ? l * ratioY / wrapAt - .5 : from / wrapAt | 0; 1931 max = 0; 1932 min = _bigNum; 1933 for(j = 0; j < l; j++){ 1934 x = j % wrapAt - originX; 1935 y = originY - (j / wrapAt | 0); 1936 distances[j] = d = !axis ? _sqrt(x * x + y * y) : Math.abs(axis === "y" ? y : x); 1937 d > max && (max = d); 1938 d < min && (min = d); 1939 } 1940 from === "random" && shuffle(distances); 1941 distances.max = max - min; 1942 distances.min = min; 1943 distances.v = l = (parseFloat(vars.amount) || parseFloat(vars.each) * (wrapAt > l ? l - 1 : !axis ? Math.max(wrapAt, l / wrapAt) : axis === "y" ? l / wrapAt : wrapAt) || 0) * (from === "edges" ? -1 : 1); 1944 distances.b = l < 0 ? base - l : base; 1945 distances.u = getUnit(vars.amount || vars.each) || 0; //unit 1946 ease = ease && l < 0 ? _invertEase(ease) : ease; 1947 } 1948 l = (distances[i] - distances.min) / distances.max || 0; 1949 return _roundPrecise(distances.b + (ease ? ease(l) : l) * distances.v) + distances.u; //round in order to work around floating point errors 1950 }; 1951}, _roundModifier = function _roundModifier(v) { 1952 //pass in 0.1 get a function that'll round to the nearest tenth, or 5 to round to the closest 5, or 0.001 to the closest 1000th, etc. 1953 var p = Math.pow(10, ((v + "").split(".")[1] || "").length); //to avoid floating point math errors (like 24 * 0.1 == 2.4000000000000004), we chop off at a specific number of decimal places (much faster than toFixed()) 1954 return function(raw) { 1955 var n = _roundPrecise(Math.round(parseFloat(raw) / v) * v * p); 1956 return (n - n % 1) / p + (_isNumber(raw) ? 0 : getUnit(raw)); // n - n % 1 replaces Math.floor() in order to handle negative values properly. For example, Math.floor(-150.00000000000003) is 151! 1957 }; 1958}, snap = function snap(snapTo, value) { 1959 var isArray = _isArray(snapTo), radius, is2D; 1960 if (!isArray && _isObject(snapTo)) { 1961 radius = isArray = snapTo.radius || _bigNum; 1962 if (snapTo.values) { 1963 snapTo = toArray(snapTo.values);
vendor: 5,132 bytes, lines 1964-2061
1964 if (is2D = !_isNumber(snapTo[0])) radius *= radius; //performance optimization so we don't have to Math.sqrt() in the loop. 1965 } else snapTo = _roundModifier(snapTo.increment); 1966 } 1967 return _conditionalReturn(value, !isArray ? _roundModifier(snapTo) : _isFunction(snapTo) ? function(raw) { 1968 is2D = snapTo(raw); 1969 return Math.abs(is2D - raw) <= radius ? is2D : raw; 1970 } : function(raw) { 1971 var x = parseFloat(is2D ? raw.x : raw), y = parseFloat(is2D ? raw.y : 0), min = _bigNum, closest = 0, i = snapTo.length, dx, dy; 1972 while(i--){ 1973 if (is2D) { 1974 dx = snapTo[i].x - x; 1975 dy = snapTo[i].y - y; 1976 dx = dx * dx + dy * dy; 1977 } else dx = Math.abs(snapTo[i] - x); 1978 if (dx < min) { 1979 min = dx; 1980 closest = i; 1981 } 1982 } 1983 closest = !radius || min <= radius ? snapTo[closest] : raw; 1984 return is2D || closest === raw || _isNumber(raw) ? closest : closest + getUnit(raw); 1985 }); 1986}, random = function random(min, max, roundingIncrement, returnFunction) { 1987 return _conditionalReturn(_isArray(min) ? !max : roundingIncrement === true ? (roundingIncrement = 0, false) : !returnFunction, function() { 1988 return _isArray(min) ? min[~~(Math.random() * min.length)] : (roundingIncrement = roundingIncrement || 1e-5, returnFunction = roundingIncrement < 1 ? Math.pow(10, (roundingIncrement + "").length - 2) : 1) && Math.floor(Math.round((min - roundingIncrement / 2 + Math.random() * (max - min + roundingIncrement * .99)) / roundingIncrement) * roundingIncrement * returnFunction) / returnFunction; 1989 }); 1990}, pipe = function pipe() { 1991 for(var _len = arguments.length, functions = new Array(_len), _key = 0; _key < _len; _key++)functions[_key] = arguments[_key]; 1992 return function(value) { 1993 return functions.reduce(function(v, f) { 1994 return f(v); 1995 }, value); 1996 }; 1997}, unitize = function unitize(func, unit) { 1998 return function(value) { 1999 return func(parseFloat(value)) + (unit || getUnit(value)); 2000 }; 2001}, normalize = function normalize(min, max, value) { 2002 return mapRange(min, max, 0, 1, value); 2003}, _wrapArray = function _wrapArray(a, wrapper, value) { 2004 return _conditionalReturn(value, function(index) { 2005 return a[~~wrapper(index)]; 2006 }); 2007}, wrap = function wrap(min, max, value) { 2008 // NOTE: wrap() CANNOT be an arrow function! A very odd compiling bug causes problems (unrelated to GSAP). 2009 var range = max - min; 2010 return _isArray(min) ? _wrapArray(min, wrap(0, min.length), max) : _conditionalReturn(value, function(value) { 2011 return (range + (value - min) % range) % range + min; 2012 }); 2013}, wrapYoyo = function wrapYoyo(min, max, value) { 2014 var range = max - min, total = range * 2; 2015 return _isArray(min) ? _wrapArray(min, wrapYoyo(0, min.length - 1), max) : _conditionalReturn(value, function(value) { 2016 value = (total + (value - min) % total) % total || 0; 2017 return min + (value > range ? total - value : value); 2018 }); 2019}, _replaceRandom = function _replaceRandom(value) { 2020 //replaces all occurrences of random(...) in a string with the calculated random value. can be a range like random(-100, 100, 5) or an array like random([0, 100, 500]) 2021 var prev = 0, s = "", i, nums, end, isArray; 2022 while(~(i = value.indexOf("random(", prev))){ 2023 end = value.indexOf(")", i); 2024 isArray = value.charAt(i + 7) === "["; 2025 nums = value.substr(i + 7, end - i - 7).match(isArray ? _delimitedValueExp : _strictNumExp); 2026 s += value.substr(prev, i - prev) + random(isArray ? nums : +nums[0], isArray ? 0 : +nums[1], +nums[2] || 1e-5); 2027 prev = end + 1; 2028 } 2029 return s + value.substr(prev, value.length - prev); 2030}, mapRange = function mapRange(inMin, inMax, outMin, outMax, value) { 2031 var inRange = inMax - inMin, outRange = outMax - outMin; 2032 return _conditionalReturn(value, function(value) { 2033 return outMin + ((value - inMin) / inRange * outRange || 0); 2034 }); 2035}, interpolate = function interpolate(start, end, progress, mutate) { 2036 var func = isNaN(start + end) ? 0 : function(p) { 2037 return (1 - p) * start + p * end; 2038 }; 2039 if (!func) { 2040 var isString = _isString(start), master = {}, p, i, interpolators, l, il; 2041 progress === true && (mutate = 1) && (progress = null); 2042 if (isString) { 2043 start = { 2044 p: start 2045 }; 2046 end = { 2047 p: end 2048 }; 2049 } else if (_isArray(start) && !_isArray(end)) { 2050 interpolators = []; 2051 l = start.length; 2052 il = l - 2; 2053 for(i = 1; i < l; i++)interpolators.push(interpolate(start[i - 1], start[i])); //build the interpolators up front as a performance optimization so that when the function is called many times, it can just reuse them. 2054 l--; 2055 func = function func(p) { 2056 p *= l; 2057 var i = Math.min(il, ~~p); 2058 return interpolators[i](p - i); 2059 }; 2060 progress = end; 2061 }
vendor: 16,660 bytes, lines 2061-2458
2061 else if (!mutate) start = _merge(_isArray(start) ? [] : {}, start); 2062 if (!interpolators) { 2063 for(p in end)_addPropTween.call(master, start, p, "get", end[p]); 2064 func = function func(p) { 2065 return _renderPropTweens(p, master) || (isString ? start.p : start); 2066 }; 2067 } 2068 } 2069 return _conditionalReturn(progress, func); 2070}, _getLabelInDirection = function _getLabelInDirection(timeline, fromTime, backward) { 2071 //used for nextLabel() and previousLabel() 2072 var labels = timeline.labels, min = _bigNum, p, distance, label; 2073 for(p in labels){ 2074 distance = labels[p] - fromTime; 2075 if (distance < 0 === !!backward && distance && min > (distance = Math.abs(distance))) { 2076 label = p; 2077 min = distance; 2078 } 2079 } 2080 return label; 2081}, _callback = function _callback(animation, type, executeLazyFirst) { 2082 var v = animation.vars, callback = v[type], prevContext = _context, context = animation._ctx, params, scope, result; 2083 if (!callback) return; 2084 params = v[type + "Params"]; 2085 scope = v.callbackScope || animation; 2086 executeLazyFirst && _lazyTweens.length && _lazyRender(); //in case rendering caused any tweens to lazy-init, we should render them because typically when a timeline finishes, users expect things to have rendered fully. Imagine an onUpdate on a timeline that reports/checks tweened values. 2087 context && (_context = context); 2088 result = params ? callback.apply(scope, params) : callback.call(scope); 2089 _context = prevContext; 2090 return result; 2091}, _interrupt = function _interrupt(animation) { 2092 _removeFromParent(animation); 2093 animation.scrollTrigger && animation.scrollTrigger.kill(!!_reverting); 2094 animation.progress() < 1 && _callback(animation, "onInterrupt"); 2095 return animation; 2096}, _quickTween, _registerPluginQueue = [], _createPlugin = function _createPlugin(config) { 2097 if (!config) return; 2098 config = !config.name && config["default"] || config; // UMD packaging wraps things oddly, so for example MotionPathHelper becomes {MotionPathHelper:MotionPathHelper, default:MotionPathHelper}. 2099 if (_windowExists() || config.headless) { 2100 // edge case: some build tools may pass in a null/undefined value 2101 var name = config.name, isFunc = _isFunction(config), Plugin = name && !isFunc && config.init ? function() { 2102 this._props = []; 2103 } : config, //in case someone passes in an object that's not a plugin, like CustomEase 2104 instanceDefaults = { 2105 init: _emptyFunc, 2106 render: _renderPropTweens, 2107 add: _addPropTween, 2108 kill: _killPropTweensOf, 2109 modifier: _addPluginModifier, 2110 rawVars: 0 2111 }, statics = { 2112 targetTest: 0, 2113 get: 0, 2114 getSetter: _getSetter, 2115 aliases: {}, 2116 register: 0 2117 }; 2118 _wake(); 2119 if (config !== Plugin) { 2120 if (_plugins[name]) return; 2121 _setDefaults(Plugin, _setDefaults(_copyExcluding(config, instanceDefaults), statics)); //static methods 2122 _merge(Plugin.prototype, _merge(instanceDefaults, _copyExcluding(config, statics))); //instance methods 2123 _plugins[Plugin.prop = name] = Plugin; 2124 if (config.targetTest) { 2125 _harnessPlugins.push(Plugin); 2126 _reservedProps[name] = 1; 2127 } 2128 name = (name === "css" ? "CSS" : name.charAt(0).toUpperCase() + name.substr(1)) + "Plugin"; //for the global name. "motionPath" should become MotionPathPlugin 2129 } 2130 _addGlobal(name, Plugin); 2131 config.register && config.register(gsap, Plugin, PropTween); 2132 } else _registerPluginQueue.push(config); 2133}, /* 2134 * -------------------------------------------------------------------------------------- 2135 * COLORS 2136 * -------------------------------------------------------------------------------------- 2137 */ _255 = 255, _colorLookup = { 2138 aqua: [ 2139 0, 2140 _255, 2141 _255 2142 ], 2143 lime: [ 2144 0, 2145 _255, 2146 0 2147 ], 2148 silver: [ 2149 192, 2150 192, 2151 192 2152 ], 2153 black: [ 2154 0, 2155 0, 2156 0 2157 ], 2158 maroon: [ 2159 128, 2160 0, 2161 0 2162 ], 2163 teal: [ 2164 0, 2165 128, 2166 128 2167 ], 2168 blue: [ 2169 0, 2170 0, 2171 _255 2172 ], 2173 navy: [ 2174 0, 2175 0, 2176 128 2177 ], 2178 white: [ 2179 _255, 2180 _255, 2181 _255 2182 ], 2183 olive: [ 2184 128, 2185 128, 2186 0 2187 ], 2188 yellow: [ 2189 _255, 2190 _255, 2191 0 2192 ], 2193 orange: [ 2194 _255, 2195 165, 2196 0 2197 ], 2198 gray: [ 2199 128, 2200 128, 2201 128 2202 ], 2203 purple: [ 2204 128, 2205 0, 2206 128 2207 ], 2208 green: [ 2209 0, 2210 128, 2211 0 2212 ], 2213 red: [ 2214 _255, 2215 0, 2216 0 2217 ], 2218 pink: [ 2219 _255, 2220 192, 2221 203 2222 ], 2223 cyan: [ 2224 0, 2225 _255, 2226 _255 2227 ], 2228 transparent: [ 2229 _255, 2230 _255, 2231 _255, 2232 0 2233 ] 2234}, // possible future idea to replace the hard-coded color name values - put this in the ticker.wake() where we set the _doc: 2235// let ctx = _doc.createElement("canvas").getContext("2d"); 2236// _forEachName("aqua,lime,silver,black,maroon,teal,blue,navy,white,olive,yellow,orange,gray,purple,green,red,pink,cyan", color => {ctx.fillStyle = color; _colorLookup[color] = splitColor(ctx.fillStyle)}); 2237_hue = function _hue(h, m1, m2) { 2238 h += h < 0 ? 1 : h > 1 ? -1 : 0; 2239 return (h * 6 < 1 ? m1 + (m2 - m1) * h * 6 : h < .5 ? m2 : h * 3 < 2 ? m1 + (m2 - m1) * (2 / 3 - h) * 6 : m1) * _255 + .5 | 0; 2240}, splitColor = function splitColor(v, toHSL, forceAlpha) { 2241 var a = !v ? _colorLookup.black : _isNumber(v) ? [ 2242 v >> 16, 2243 v >> 8 & _255, 2244 v & _255 2245 ] : 0, r, g, b, h, s, l, max, min, d, wasHSL; 2246 if (!a) { 2247 if (v.substr(-1) === ",") //sometimes a trailing comma is included and we should chop it off (typically from a comma-delimited list of values like a textShadow:"2px 2px 2px blue, 5px 5px 5px rgb(255,0,0)" - in this example "blue," has a trailing comma. We could strip it out inside parseComplex() but we'd need to do it to the beginning and ending values plus it wouldn't provide protection from other potential scenarios like if the user passes in a similar value. 2248 v = v.substr(0, v.length - 1); 2249 if (_colorLookup[v]) a = _colorLookup[v]; 2250 else if (v.charAt(0) === "#") { 2251 if (v.length < 6) { 2252 //for shorthand like #9F0 or #9F0F (could have alpha) 2253 r = v.charAt(1); 2254 g = v.charAt(2); 2255 b = v.charAt(3); 2256 v = "#" + r + r + g + g + b + b + (v.length === 5 ? v.charAt(4) + v.charAt(4) : ""); 2257 } 2258 if (v.length === 9) { 2259 // hex with alpha, like #fd5e53ff 2260 a = parseInt(v.substr(1, 6), 16); 2261 return [ 2262 a >> 16, 2263 a >> 8 & _255, 2264 a & _255, 2265 parseInt(v.substr(7), 16) / 255 2266 ]; 2267 } 2268 v = parseInt(v.substr(1), 16); 2269 a = [ 2270 v >> 16, 2271 v >> 8 & _255, 2272 v & _255 2273 ]; 2274 } else if (v.substr(0, 3) === "hsl") { 2275 a = wasHSL = v.match(_strictNumExp); 2276 if (!toHSL) { 2277 h = +a[0] % 360 / 360; 2278 s = +a[1] / 100; 2279 l = +a[2] / 100; 2280 g = l <= .5 ? l * (s + 1) : l + s - l * s; 2281 r = l * 2 - g; 2282 a.length > 3 && (a[3] *= 1); //cast as number 2283 a[0] = _hue(h + 1 / 3, r, g); 2284 a[1] = _hue(h, r, g); 2285 a[2] = _hue(h - 1 / 3, r, g); 2286 } else if (~v.indexOf("=")) { 2287 //if relative values are found, just return the raw strings with the relative prefixes in place. 2288 a = v.match(_numExp); 2289 forceAlpha && a.length < 4 && (a[3] = 1); 2290 return a; 2291 } 2292 } else a = v.match(_strictNumExp) || _colorLookup.transparent; 2293 a = a.map(Number); 2294 } 2295 if (toHSL && !wasHSL) { 2296 r = a[0] / _255; 2297 g = a[1] / _255; 2298 b = a[2] / _255; 2299 max = Math.max(r, g, b); 2300 min = Math.min(r, g, b); 2301 l = (max + min) / 2; 2302 if (max === min) h = s = 0; 2303 else { 2304 d = max - min; 2305 s = l > 0.5 ? d / (2 - max - min) : d / (max + min); 2306 h = max === r ? (g - b) / d + (g < b ? 6 : 0) : max === g ? (b - r) / d + 2 : (r - g) / d + 4; 2307 h *= 60; 2308 } 2309 a[0] = ~~(h + .5); 2310 a[1] = ~~(s * 100 + .5); 2311 a[2] = ~~(l * 100 + .5); 2312 } 2313 forceAlpha && a.length < 4 && (a[3] = 1); 2314 return a; 2315}, _colorOrderData = function _colorOrderData(v) { 2316 // strips out the colors from the string, finds all the numeric slots (with units) and returns an array of those. The Array also has a "c" property which is an Array of the index values where the colors belong. This is to help work around issues where there's a mis-matched order of color/numeric data like drop-shadow(#f00 0px 1px 2px) and drop-shadow(0x 1px 2px #f00). This is basically a helper function used in _formatColors() 2317 var values = [], c = [], i = -1; 2318 v.split(_colorExp).forEach(function(v) { 2319 var a = v.match(_numWithUnitExp) || []; 2320 values.push.apply(values, a); 2321 c.push(i += a.length + 1); 2322 }); 2323 values.c = c; 2324 return values; 2325}, _formatColors = function _formatColors(s, toHSL, orderMatchData) { 2326 var result = "", colors = (s + result).match(_colorExp), type = toHSL ? "hsla(" : "rgba(", i = 0, c, shell, d, l; 2327 if (!colors) return s; 2328 colors = colors.map(function(color) { 2329 return (color = splitColor(color, toHSL, 1)) && type + (toHSL ? color[0] + "," + color[1] + "%," + color[2] + "%," + color[3] : color.join(",")) + ")"; 2330 }); 2331 if (orderMatchData) { 2332 d = _colorOrderData(s); 2333 c = orderMatchData.c; 2334 if (c.join(result) !== d.c.join(result)) { 2335 shell = s.replace(_colorExp, "1").split(_numWithUnitExp); 2336 l = shell.length - 1; 2337 for(; i < l; i++)result += shell[i] + (~c.indexOf(i) ? colors.shift() || type + "0,0,0,0)" : (d.length ? d : colors.length ? colors : orderMatchData).shift()); 2338 } 2339 } 2340 if (!shell) { 2341 shell = s.split(_colorExp); 2342 l = shell.length - 1; 2343 for(; i < l; i++)result += shell[i] + colors[i]; 2344 } 2345 return result + shell[l]; 2346}, _colorExp = function() { 2347 var s = "(?:\\b(?:(?:rgb|rgba|hsl|hsla)\\(.+?\\))|\\B#(?:[0-9a-f]{3,4}){1,2}\\b", //we'll dynamically build this Regular Expression to conserve file size. After building it, it will be able to find rgb(), rgba(), # (hexadecimal), and named color values like red, blue, purple, etc., 2348 p; 2349 for(p in _colorLookup)s += "|" + p + "\\b"; 2350 return new RegExp(s + ")", "gi"); 2351}(), _hslExp = /hsl[a]?\(/, _colorStringFilter = function _colorStringFilter(a) { 2352 var combined = a.join(" "), toHSL; 2353 _colorExp.lastIndex = 0; 2354 if (_colorExp.test(combined)) { 2355 toHSL = _hslExp.test(combined); 2356 a[1] = _formatColors(a[1], toHSL); 2357 a[0] = _formatColors(a[0], toHSL, _colorOrderData(a[1])); // make sure the order of numbers/colors match with the END value. 2358 return true; 2359 } 2360}, /* 2361 * -------------------------------------------------------------------------------------- 2362 * TICKER 2363 * -------------------------------------------------------------------------------------- 2364 */ _tickerActive, _ticker = function() { 2365 var _getTime = Date.now, _lagThreshold = 500, _adjustedLag = 33, _startTime = _getTime(), _lastUpdate = _startTime, _gap = 1000 / 240, _nextTime = _gap, _listeners = [], _id, _req, _raf, _self, _delta, _i, _tick = function _tick(v) { 2366 var elapsed = _getTime() - _lastUpdate, manual = v === true, overlap, dispatch, time, frame; 2367 (elapsed > _lagThreshold || elapsed < 0) && (_startTime += elapsed - _adjustedLag); 2368 _lastUpdate += elapsed; 2369 time = _lastUpdate - _startTime; 2370 overlap = time - _nextTime; 2371 if (overlap > 0 || manual) { 2372 frame = ++_self.frame; 2373 _delta = time - _self.time * 1000; 2374 _self.time = time = time / 1000; 2375 _nextTime += overlap + (overlap >= _gap ? 4 : _gap - overlap); 2376 dispatch = 1; 2377 } 2378 manual || (_id = _req(_tick)); //make sure the request is made before we dispatch the "tick" event so that timing is maintained. Otherwise, if processing the "tick" requires a bunch of time (like 15ms) and we're using a setTimeout() that's based on 16.7ms, it'd technically take 31.7ms between frames otherwise. 2379 if (dispatch) for(_i = 0; _i < _listeners.length; _i++)// use _i and check _listeners.length instead of a variable because a listener could get removed during the loop, and if that happens to an element less than the current index, it'd throw things off in the loop. 2380 _listeners[_i](time, _delta, frame, v); 2381 }; 2382 _self = { 2383 time: 0, 2384 frame: 0, 2385 tick: function tick() { 2386 _tick(true); 2387 }, 2388 deltaRatio: function deltaRatio(fps) { 2389 return _delta / (1000 / (fps || 60)); 2390 }, 2391 wake: function wake() { 2392 if (_coreReady) { 2393 if (!_coreInitted && _windowExists()) { 2394 _win = _coreInitted = window; 2395 _doc = _win.document || {}; 2396 _globals.gsap = gsap; 2397 (_win.gsapVersions || (_win.gsapVersions = [])).push(gsap.version); 2398 _install(_installScope || _win.GreenSockGlobals || !_win.gsap && _win || {}); 2399 _registerPluginQueue.forEach(_createPlugin); 2400 } 2401 _raf = typeof requestAnimationFrame !== "undefined" && requestAnimationFrame; 2402 _id && _self.sleep(); 2403 _req = _raf || function(f) { 2404 return setTimeout(f, _nextTime - _self.time * 1000 + 1 | 0); 2405 }; 2406 _tickerActive = 1; 2407 _tick(2); 2408 } 2409 }, 2410 sleep: function sleep() { 2411 (_raf ? cancelAnimationFrame : clearTimeout)(_id); 2412 _tickerActive = 0; 2413 _req = _emptyFunc; 2414 }, 2415 lagSmoothing: function lagSmoothing(threshold, adjustedLag) { 2416 _lagThreshold = threshold || Infinity; // zero should be interpreted as basically unlimited 2417 _adjustedLag = Math.min(adjustedLag || 33, _lagThreshold); 2418 }, 2419 fps: function fps(_fps) { 2420 _gap = 1000 / (_fps || 240); 2421 _nextTime = _self.time * 1000 + _gap; 2422 }, 2423 add: function add(callback, once, prioritize) { 2424 var func = once ? function(t, d, f, v) { 2425 callback(t, d, f, v); 2426 _self.remove(func); 2427 } : callback; 2428 _self.remove(callback); 2429 _listeners[prioritize ? "unshift" : "push"](func); 2430 _wake(); 2431 return func; 2432 }, 2433 remove: function remove(callback, i) { 2434 ~(i = _listeners.indexOf(callback)) && _listeners.splice(i, 1) && _i >= i && _i--; 2435 }, 2436 _listeners: _listeners 2437 }; 2438 return _self; 2439}(), _wake = function _wake() { 2440 return !_tickerActive && _ticker.wake(); 2441}, //also ensures the core classes are initialized. 2442/* 2443* ------------------------------------------------- 2444* EASING 2445* ------------------------------------------------- 2446*/ _easeMap = {}, _customEaseExp = /^[\d.\-M][\d.\-,\s]/, _quotesExp = /["']/g, _parseObjectInString = function _parseObjectInString(value) { 2447 //takes a string like "{wiggles:10, type:anticipate})" and turns it into a real object. Notice it ends in ")" and includes the {} wrappers. This is because we only use this function for parsing ease configs and prioritized optimization rather than reusability. 2448 var obj = {}, split = value.substr(1, value.length - 3).split(":"), key = split[0], i = 1, l = split.length, index, val, parsedVal; 2449 for(; i < l; i++){ 2450 val = split[i]; 2451 index = i !== l - 1 ? val.lastIndexOf(",") : val.length; 2452 parsedVal = val.substr(0, index); 2453 obj[key] = isNaN(parsedVal) ? parsedVal.replace(_quotesExp, "").trim() : +parsedVal; 2454 key = val.substr(index + 1).trim(); 2455 } 2456 return obj; 2457}, _valueInParentheses = function _valueInParentheses(value) { 2458 var open = value.indexOf("(") + 1, close = value.indexOf(")"), nested = value.indexOf("(", open
vendor: 5,255 bytes, lines 2458-2558
2458); 2459 return value.substring(open, ~nested && nested < close ? value.indexOf(")", close + 1) : close); 2460}, _configEaseFromString = function _configEaseFromString(name) { 2461 //name can be a string like "elastic.out(1,0.5)", and pass in _easeMap as obj and it'll parse it out and call the actual function like _easeMap.Elastic.easeOut.config(1,0.5). It will also parse custom ease strings as long as CustomEase is loaded and registered (internally as _easeMap._CE). 2462 var split = (name + "").split("("), ease = _easeMap[split[0]]; 2463 return ease && split.length > 1 && ease.config ? ease.config.apply(null, ~name.indexOf("{") ? [ 2464 _parseObjectInString(split[1]) 2465 ] : _valueInParentheses(name).split(",").map(_numericIfPossible)) : _easeMap._CE && _customEaseExp.test(name) ? _easeMap._CE("", name) : ease; 2466}, _invertEase = function _invertEase(ease) { 2467 return function(p) { 2468 return 1 - ease(1 - p); 2469 }; 2470}, // allow yoyoEase to be set in children and have those affected when the parent/ancestor timeline yoyos. 2471_propagateYoyoEase = function _propagateYoyoEase(timeline, isYoyo) { 2472 var child = timeline._first, ease; 2473 while(child){ 2474 if (child instanceof Timeline) _propagateYoyoEase(child, isYoyo); 2475 else if (child.vars.yoyoEase && (!child._yoyo || !child._repeat) && child._yoyo !== isYoyo) { 2476 if (child.timeline) _propagateYoyoEase(child.timeline, isYoyo); 2477 else { 2478 ease = child._ease; 2479 child._ease = child._yEase; 2480 child._yEase = ease; 2481 child._yoyo = isYoyo; 2482 } 2483 } 2484 child = child._next; 2485 } 2486}, _parseEase = function _parseEase(ease, defaultEase) { 2487 return !ease ? defaultEase : (_isFunction(ease) ? ease : _easeMap[ease] || _configEaseFromString(ease)) || defaultEase; 2488}, _insertEase = function _insertEase(names, easeIn, easeOut, easeInOut) { 2489 if (easeOut === void 0) easeOut = function easeOut(p) { 2490 return 1 - easeIn(1 - p); 2491 }; 2492 if (easeInOut === void 0) easeInOut = function easeInOut(p) { 2493 return p < .5 ? easeIn(p * 2) / 2 : 1 - easeIn((1 - p) * 2) / 2; 2494 }; 2495 var ease = { 2496 easeIn: easeIn, 2497 easeOut: easeOut, 2498 easeInOut: easeInOut 2499 }, lowercaseName; 2500 _forEachName(names, function(name) { 2501 _easeMap[name] = _globals[name] = ease; 2502 _easeMap[lowercaseName = name.toLowerCase()] = easeOut; 2503 for(var p in ease)_easeMap[lowercaseName + (p === "easeIn" ? ".in" : p === "easeOut" ? ".out" : ".inOut")] = _easeMap[name + "." + p] = ease[p]; 2504 }); 2505 return ease; 2506}, _easeInOutFromOut = function _easeInOutFromOut(easeOut) { 2507 return function(p) { 2508 return p < .5 ? (1 - easeOut(1 - p * 2)) / 2 : .5 + easeOut((p - .5) * 2) / 2; 2509 }; 2510}, _configElastic = function _configElastic(type, amplitude, period) { 2511 var p1 = amplitude >= 1 ? amplitude : 1, //note: if amplitude is < 1, we simply adjust the period for a more natural feel. Otherwise the math doesn't work right and the curve starts at 1. 2512 p2 = (period || (type ? .3 : .45)) / (amplitude < 1 ? amplitude : 1), p3 = p2 / _2PI * (Math.asin(1 / p1) || 0), easeOut = function easeOut(p) { 2513 return p === 1 ? 1 : p1 * Math.pow(2, -10 * p) * _sin((p - p3) * p2) + 1; 2514 }, ease = type === "out" ? easeOut : type === "in" ? function(p) { 2515 return 1 - easeOut(1 - p); 2516 } : _easeInOutFromOut(easeOut); 2517 p2 = _2PI / p2; //precalculate to optimize 2518 ease.config = function(amplitude, period) { 2519 return _configElastic(type, amplitude, period); 2520 }; 2521 return ease; 2522}, _configBack = function _configBack(type, overshoot) { 2523 if (overshoot === void 0) overshoot = 1.70158; 2524 var easeOut = function easeOut(p) { 2525 return p ? --p * p * ((overshoot + 1) * p + overshoot) + 1 : 0; 2526 }, ease = type === "out" ? easeOut : type === "in" ? function(p) { 2527 return 1 - easeOut(1 - p); 2528 } : _easeInOutFromOut(easeOut); 2529 ease.config = function(overshoot) { 2530 return _configBack(type, overshoot); 2531 }; 2532 return ease; 2533}; // a cheaper (kb and cpu) but more mild way to get a parameterized weighted ease by feeding in a value between -1 (easeIn) and 1 (easeOut) where 0 is linear. 2534// _weightedEase = ratio => { 2535// let y = 0.5 + ratio / 2; 2536// return p => (2 * (1 - p) * p * y + p * p); 2537// }, 2538// a stronger (but more expensive kb/cpu) parameterized weighted ease that lets you feed in a value between -1 (easeIn) and 1 (easeOut) where 0 is linear. 2539// _weightedEaseStrong = ratio => { 2540// ratio = .5 + ratio / 2; 2541// let o = 1 / 3 * (ratio < .5 ? ratio : 1 - ratio), 2542// b = ratio - o, 2543// c = ratio + o; 2544// return p => p === 1 ? p : 3 * b * (1 - p) * (1 - p) * p + 3 * c * (1 - p) * p * p + p * p * p; 2545// }; 2546_forEachName("Linear,Quad,Cubic,Quart,Quint,Strong", function(name, i) { 2547 var power = i < 5 ? i + 1 : i; 2548 _insertEase(name + ",Power" + (power - 1), i ? function(p) { 2549 return Math.pow(p, power); 2550 } : function(p) { 2551 return p; 2552 }, function(p) { 2553 return 1 - Math.pow(1 - p, power); 2554 }, function(p) { 2555 return p < .5 ? Math.pow(p * 2, power) / 2 : 1 - Math.pow((1 - p) * 2, power) / 2; 2556 }); 2557}); 2558_easeMap.Linear.easeNone = _easeMap.none = _easeMap.Linear.easeIn;
vendor: 5,272 bytes, lines 2559-2646
2559_insertEase("Elastic", _configElastic("in"), _configElastic("out"), _configElastic()); 2560(function(n, c) { 2561 var n1 = 1 / c, n2 = 2 * n1, n3 = 2.5 * n1, easeOut = function easeOut(p) { 2562 return p < n1 ? n * p * p : p < n2 ? n * Math.pow(p - 1.5 / c, 2) + .75 : p < n3 ? n * (p -= 2.25 / c) * p + .9375 : n * Math.pow(p - 2.625 / c, 2) + .984375; 2563 }; 2564 _insertEase("Bounce", function(p) { 2565 return 1 - easeOut(1 - p); 2566 }, easeOut); 2567})(7.5625, 2.75); 2568_insertEase("Expo", function(p) { 2569 return Math.pow(2, 10 * (p - 1)) * p + p * p * p * p * p * p * (1 - p); 2570}); // previously 2 ** (10 * (p - 1)) but that doesn't end up with the value quite at the right spot so we do a blended ease to ensure it lands where it should perfectly. 2571_insertEase("Circ", function(p) { 2572 return -(_sqrt(1 - p * p) - 1); 2573}); 2574_insertEase("Sine", function(p) { 2575 return p === 1 ? 1 : -_cos(p * _HALF_PI) + 1; 2576}); 2577_insertEase("Back", _configBack("in"), _configBack("out"), _configBack()); 2578_easeMap.SteppedEase = _easeMap.steps = _globals.SteppedEase = { 2579 config: function config(steps, immediateStart) { 2580 if (steps === void 0) steps = 1; 2581 var p1 = 1 / steps, p2 = steps + (immediateStart ? 0 : 1), p3 = immediateStart ? 1 : 0, max = 1 - _tinyNum; 2582 return function(p) { 2583 return ((p2 * _clamp(0, max, p) | 0) + p3) * p1; 2584 }; 2585 } 2586}; 2587_defaults.ease = _easeMap["quad.out"]; 2588_forEachName("onComplete,onUpdate,onStart,onRepeat,onReverseComplete,onInterrupt", function(name) { 2589 return _callbackNames += name + "," + name + "Params,"; 2590}); 2591var GSCache = function GSCache(target, harness) { 2592 this.id = _gsID++; 2593 target._gsap = this; 2594 this.target = target; 2595 this.harness = harness; 2596 this.get = harness ? harness.get : _getProperty; 2597 this.set = harness ? harness.getSetter : _getSetter; 2598}; 2599var Animation = /*#__PURE__*/ function() { 2600 function Animation(vars) { 2601 this.vars = vars; 2602 this._delay = +vars.delay || 0; 2603 if (this._repeat = vars.repeat === Infinity ? -2 : vars.repeat || 0) { 2604 // TODO: repeat: Infinity on a timeline's children must flag that timeline internally and affect its totalDuration, otherwise it'll stop in the negative direction when reaching the start. 2605 this._rDelay = vars.repeatDelay || 0; 2606 this._yoyo = !!vars.yoyo || !!vars.yoyoEase; 2607 } 2608 this._ts = 1; 2609 _setDuration(this, +vars.duration, 1, 1); 2610 this.data = vars.data; 2611 if (_context) { 2612 this._ctx = _context; 2613 _context.data.push(this); 2614 } 2615 _tickerActive || _ticker.wake(); 2616 } 2617 var _proto = Animation.prototype; 2618 _proto.delay = function delay(value) { 2619 if (value || value === 0) { 2620 this.parent && this.parent.smoothChildTiming && this.startTime(this._start + value - this._delay); 2621 this._delay = value; 2622 return this; 2623 } 2624 return this._delay; 2625 }; 2626 _proto.duration = function duration(value) { 2627 return arguments.length ? this.totalDuration(this._repeat > 0 ? value + (value + this._rDelay) * this._repeat : value) : this.totalDuration() && this._dur; 2628 }; 2629 _proto.totalDuration = function totalDuration(value) { 2630 if (!arguments.length) return this._tDur; 2631 this._dirty = 0; 2632 return _setDuration(this, this._repeat < 0 ? value : (value - this._repeat * this._rDelay) / (this._repeat + 1)); 2633 }; 2634 _proto.totalTime = function totalTime(_totalTime, suppressEvents) { 2635 _wake(); 2636 if (!arguments.length) return this._tTime; 2637 var parent = this._dp; 2638 if (parent && parent.smoothChildTiming && this._ts) { 2639 _alignPlayhead(this, _totalTime); 2640 !parent._dp || parent.parent || _postAddChecks(parent, this); // edge case: if this is a child of a timeline that already completed, for example, we must re-activate the parent. 2641 //in case any of the ancestor timelines had completed but should now be enabled, we should reset their totalTime() which will also ensure that they're lined up properly and enabled. Skip for animations that are on the root (wasteful). Example: a TimelineLite.exportRoot() is performed when there's a paused tween on the root, the export will not complete until that tween is unpaused, but imagine a child gets restarted later, after all [unpaused] tweens have completed. The start of that child would get pushed out, but one of the ancestors may have completed. 2642 while(parent && parent.parent){ 2643 if (parent.parent._time !== parent._start + (parent._ts >= 0 ? parent._tTime / parent._ts : (parent.totalDuration() - parent._tTime) / -parent._ts)) parent.totalTime(parent._tTime, true); 2644 parent = parent.parent; 2645 } 2646 if (!this.parent && this._dp.autoRemoveChildren && (this._ts > 0 && _totalTime < this._tDur || this._ts < 0 && _totalTime > 0 || !this._tDur && !_totalTime)) //if the animation doesn't have a parent, put it back into its last parent (recorded as _dp for exactly cases like this). Limit to parents with autoRemoveChildren (like globalTimeline) so that if the user manually removes an animation from a timeline and then alters its playhead, it doesn't get added back in.
vendor: 8,264 bytes, lines 2647-2734
2647 _addToTimeline(this._dp, this, this._start - this._delay); 2648 } 2649 if (this._tTime !== _totalTime || !this._dur && !suppressEvents || this._initted && Math.abs(this._zTime) === _tinyNum || !_totalTime && !this._initted && (this.add || this._ptLookup)) { 2650 // check for _ptLookup on a Tween instance to ensure it has actually finished being instantiated, otherwise if this.reverse() gets called in the Animation constructor, it could trigger a render() here even though the _targets weren't populated, thus when _init() is called there won't be any PropTweens (it'll act like the tween is non-functional) 2651 this._ts || (this._pTime = _totalTime); // otherwise, if an animation is paused, then the playhead is moved back to zero, then resumed, it'd revert back to the original time at the pause 2652 //if (!this._lock) { // avoid endless recursion (not sure we need this yet or if it's worth the performance hit) 2653 // this._lock = 1; 2654 _lazySafeRender(this, _totalTime, suppressEvents); // this._lock = 0; 2655 //} 2656 } 2657 return this; 2658 }; 2659 _proto.time = function time(value, suppressEvents) { 2660 return arguments.length ? this.totalTime(Math.min(this.totalDuration(), value + _elapsedCycleDuration(this)) % (this._dur + this._rDelay) || (value ? this._dur : 0), suppressEvents) : this._time; // note: if the modulus results in 0, the playhead could be exactly at the end or the beginning, and we always defer to the END with a non-zero value, otherwise if you set the time() to the very end (duration()), it would render at the START! 2661 }; 2662 _proto.totalProgress = function totalProgress(value, suppressEvents) { 2663 return arguments.length ? this.totalTime(this.totalDuration() * value, suppressEvents) : this.totalDuration() ? Math.min(1, this._tTime / this._tDur) : this.rawTime() >= 0 && this._initted ? 1 : 0; 2664 }; 2665 _proto.progress = function progress(value, suppressEvents) { 2666 return arguments.length ? this.totalTime(this.duration() * (this._yoyo && !(this.iteration() & 1) ? 1 - value : value) + _elapsedCycleDuration(this), suppressEvents) : this.duration() ? Math.min(1, this._time / this._dur) : this.rawTime() > 0 ? 1 : 0; 2667 }; 2668 _proto.iteration = function iteration(value, suppressEvents) { 2669 var cycleDuration = this.duration() + this._rDelay; 2670 return arguments.length ? this.totalTime(this._time + (value - 1) * cycleDuration, suppressEvents) : this._repeat ? _animationCycle(this._tTime, cycleDuration) + 1 : 1; 2671 } // potential future addition: 2672 ; 2673 _proto.timeScale = function timeScale(value, suppressEvents) { 2674 if (!arguments.length) return this._rts === -_tinyNum ? 0 : this._rts; // recorded timeScale. Special case: if someone calls reverse() on an animation with timeScale of 0, we assign it -_tinyNum to remember it's reversed. 2675 if (this._rts === value) return this; 2676 var tTime = this.parent && this._ts ? _parentToChildTotalTime(this.parent._time, this) : this._tTime; // make sure to do the parentToChildTotalTime() BEFORE setting the new _ts because the old one must be used in that calculation. 2677 // future addition? Up side: fast and minimal file size. Down side: only works on this animation; if a timeline is reversed, for example, its childrens' onReverse wouldn't get called. 2678 //(+value < 0 && this._rts >= 0) && _callback(this, "onReverse", true); 2679 // prioritize rendering where the parent's playhead lines up instead of this._tTime because there could be a tween that's animating another tween's timeScale in the same rendering loop (same parent), thus if the timeScale tween renders first, it would alter _start BEFORE _tTime was set on that tick (in the rendering loop), effectively freezing it until the timeScale tween finishes. 2680 this._rts = +value || 0; 2681 this._ts = this._ps || value === -_tinyNum ? 0 : this._rts; // _ts is the functional timeScale which would be 0 if the animation is paused. 2682 this.totalTime(_clamp(-Math.abs(this._delay), this.totalDuration(), tTime), suppressEvents !== false); 2683 _setEnd(this); // if parent.smoothChildTiming was false, the end time didn't get updated in the _alignPlayhead() method, so do it here. 2684 return _recacheAncestors(this); 2685 }; 2686 _proto.paused = function paused(value) { 2687 if (!arguments.length) return this._ps; 2688 // possible future addition - if an animation is removed from its parent and then .restart() or .play() or .resume() is called, perhaps we should force it back into the globalTimeline but be careful because what if it's already at its end? We don't want it to just persist forever and not get released for GC. 2689 // !this.parent && !value && this._tTime < this._tDur && this !== _globalTimeline && _globalTimeline.add(this); 2690 if (this._ps !== value) { 2691 this._ps = value; 2692 if (value) { 2693 this._pTime = this._tTime || Math.max(-this._delay, this.rawTime()); // if the pause occurs during the delay phase, make sure that's factored in when resuming. 2694 this._ts = this._act = 0; // _ts is the functional timeScale, so a paused tween would effectively have a timeScale of 0. We record the "real" timeScale as _rts (recorded time scale) 2695 } else { 2696 _wake(); 2697 this._ts = this._rts; //only defer to _pTime (pauseTime) if tTime is zero. Remember, someone could pause() an animation, then scrub the playhead and resume(). If the parent doesn't have smoothChildTiming, we render at the rawTime() because the startTime won't get updated. 2698 this.totalTime(this.parent && !this.parent.smoothChildTiming ? this.rawTime() : this._tTime || this._pTime, this.progress() === 1 && Math.abs(this._zTime) !== _tinyNum && (this._tTime -= _tinyNum)); // edge case: animation.progress(1).pause().play() wouldn't render again because the playhead is already at the end, but the call to totalTime() below will add it back to its parent...and not remove it again (since removing only happens upon rendering at a new time). Offsetting the _tTime slightly is done simply to cause the final render in totalTime() that'll pop it off its timeline (if autoRemoveChildren is true, of course). Check to make sure _zTime isn't -_tinyNum to avoid an edge case where the playhead is pushed to the end but INSIDE a tween/callback, the timeline itself is paused thus halting rendering and leaving a few unrendered. When resuming, it wouldn't render those otherwise. 2699 } 2700 } 2701 return this; 2702 }; 2703 _proto.startTime = function startTime(value) { 2704 if (arguments.length) { 2705 this._start = value; 2706 var parent = this.parent || this._dp; 2707 parent && (parent._sort || !this.parent) && _addToTimeline(parent, this, value - this._delay); 2708 return this; 2709 } 2710 return this._start; 2711 }; 2712 _proto.endTime = function endTime(includeRepeats) { 2713 return this._start + (_isNotFalse(includeRepeats) ? this.totalDuration() : this.duration()) / Math.abs(this._ts || 1); 2714 }; 2715 _proto.rawTime = function rawTime(wrapRepeats) { 2716 var parent = this.parent || this._dp; // _dp = detached parent 2717 return !parent ? this._tTime : wrapRepeats && (!this._ts || this._repeat && this._time && this.totalProgress() < 1) ? this._tTime % (this._dur + this._rDelay) : !this._ts ? this._tTime : _parentToChildTotalTime(parent.rawTime(wrapRepeats), this); 2718 }; 2719 _proto.revert = function revert(config) { 2720 if (config === void 0) config = _revertConfig; 2721 var prevIsReverting = _reverting; 2722 _reverting = config; 2723 if (_isRevertWorthy(this)) { 2724 this.timeline && this.timeline.revert(config); 2725 this.totalTime(-0.01, config.suppressEvents); 2726 } 2727 this.data !== "nested" && config.kill !== false && this.kill(); 2728 _reverting = prevIsReverting; 2729 return this; 2730 }; 2731 _proto.globalTime = function globalTime(rawTime) { 2732 var animation = this, time = arguments.length ? rawTime : animation.rawTime(); 2733 while(animation){ 2734 time = animation._start + time / (Math.abs(animation._ts) || 1
vendor: 2,649 bytes, lines 2734-2791
2734); 2735 animation = animation._dp; 2736 } 2737 return !this.parent && this._sat ? this._sat.globalTime(rawTime) : time; // the _startAt tweens for .fromTo() and .from() that have immediateRender should always be FIRST in the timeline (important for context.revert()). "_sat" stands for _startAtTween, referring to the parent tween that created the _startAt. We must discern if that tween had immediateRender so that we can know whether or not to prioritize it in revert(). 2738 }; 2739 _proto.repeat = function repeat(value) { 2740 if (arguments.length) { 2741 this._repeat = value === Infinity ? -2 : value; 2742 return _onUpdateTotalDuration(this); 2743 } 2744 return this._repeat === -2 ? Infinity : this._repeat; 2745 }; 2746 _proto.repeatDelay = function repeatDelay(value) { 2747 if (arguments.length) { 2748 var time = this._time; 2749 this._rDelay = value; 2750 _onUpdateTotalDuration(this); 2751 return time ? this.time(time) : this; 2752 } 2753 return this._rDelay; 2754 }; 2755 _proto.yoyo = function yoyo(value) { 2756 if (arguments.length) { 2757 this._yoyo = value; 2758 return this; 2759 } 2760 return this._yoyo; 2761 }; 2762 _proto.seek = function seek(position, suppressEvents) { 2763 return this.totalTime(_parsePosition(this, position), _isNotFalse(suppressEvents)); 2764 }; 2765 _proto.restart = function restart(includeDelay, suppressEvents) { 2766 this.play().totalTime(includeDelay ? -this._delay : 0, _isNotFalse(suppressEvents)); 2767 this._dur || (this._zTime = -_tinyNum); // ensures onComplete fires on a zero-duration animation that gets restarted. 2768 return this; 2769 }; 2770 _proto.play = function play(from, suppressEvents) { 2771 from != null && this.seek(from, suppressEvents); 2772 return this.reversed(false).paused(false); 2773 }; 2774 _proto.reverse = function reverse(from, suppressEvents) { 2775 from != null && this.seek(from || this.totalDuration(), suppressEvents); 2776 return this.reversed(true).paused(false); 2777 }; 2778 _proto.pause = function pause(atTime, suppressEvents) { 2779 atTime != null && this.seek(atTime, suppressEvents); 2780 return this.paused(true); 2781 }; 2782 _proto.resume = function resume() { 2783 return this.paused(false); 2784 }; 2785 _proto.reversed = function reversed(value) { 2786 if (arguments.length) { 2787 !!value !== this.reversed() && this.timeScale(-this._rts || (value ? -_tinyNum : 0)); // in case timeScale is zero, reversing would have no effect so we use _tinyNum. 2788 return this; 2789 } 2790 return this._rts < 0; 2791 };
vendor: 9,931 bytes, lines 2792-2958
2792 _proto.invalidate = function invalidate() { 2793 this._initted = this._act = 0; 2794 this._zTime = -_tinyNum; 2795 return this; 2796 }; 2797 _proto.isActive = function isActive() { 2798 var parent = this.parent || this._dp, start = this._start, rawTime; 2799 return !!(!parent || this._ts && this._initted && parent.isActive() && (rawTime = parent.rawTime(true)) >= start && rawTime < this.endTime(true) - _tinyNum); 2800 }; 2801 _proto.eventCallback = function eventCallback(type, callback, params) { 2802 var vars = this.vars; 2803 if (arguments.length > 1) { 2804 if (!callback) delete vars[type]; 2805 else { 2806 vars[type] = callback; 2807 params && (vars[type + "Params"] = params); 2808 type === "onUpdate" && (this._onUpdate = callback); 2809 } 2810 return this; 2811 } 2812 return vars[type]; 2813 }; 2814 _proto.then = function then(onFulfilled) { 2815 var self = this; 2816 return new Promise(function(resolve) { 2817 var f = _isFunction(onFulfilled) ? onFulfilled : _passThrough, _resolve = function _resolve() { 2818 var _then = self.then; 2819 self.then = null; // temporarily null the then() method to avoid an infinite loop (see https://github.com/greensock/GSAP/issues/322) 2820 _isFunction(f) && (f = f(self)) && (f.then || f === self) && (self.then = _then); 2821 resolve(f); 2822 self.then = _then; 2823 }; 2824 if (self._initted && self.totalProgress() === 1 && self._ts >= 0 || !self._tTime && self._ts < 0) _resolve(); 2825 else self._prom = _resolve; 2826 }); 2827 }; 2828 _proto.kill = function kill() { 2829 _interrupt(this); 2830 }; 2831 return Animation; 2832}(); 2833_setDefaults(Animation.prototype, { 2834 _time: 0, 2835 _start: 0, 2836 _end: 0, 2837 _tTime: 0, 2838 _tDur: 0, 2839 _dirty: 0, 2840 _repeat: 0, 2841 _yoyo: false, 2842 parent: null, 2843 _initted: false, 2844 _rDelay: 0, 2845 _ts: 1, 2846 _dp: 0, 2847 ratio: 0, 2848 _zTime: -_tinyNum, 2849 _prom: 0, 2850 _ps: false, 2851 _rts: 1 2852}); 2853var Timeline = /*#__PURE__*/ function(_Animation) { 2854 _inheritsLoose(Timeline, _Animation); 2855 function Timeline(vars, position) { 2856 var _this; 2857 if (vars === void 0) vars = {}; 2858 _this = _Animation.call(this, vars) || this; 2859 _this.labels = {}; 2860 _this.smoothChildTiming = !!vars.smoothChildTiming; 2861 _this.autoRemoveChildren = !!vars.autoRemoveChildren; 2862 _this._sort = _isNotFalse(vars.sortChildren); 2863 _globalTimeline && _addToTimeline(vars.parent || _globalTimeline, _assertThisInitialized(_this), position); 2864 vars.reversed && _this.reverse(); 2865 vars.paused && _this.paused(true); 2866 vars.scrollTrigger && _scrollTrigger(_assertThisInitialized(_this), vars.scrollTrigger); 2867 return _this; 2868 } 2869 var _proto2 = Timeline.prototype; 2870 _proto2.to = function to(targets, vars, position) { 2871 _createTweenType(0, arguments, this); 2872 return this; 2873 }; 2874 _proto2.from = function from(targets, vars, position) { 2875 _createTweenType(1, arguments, this); 2876 return this; 2877 }; 2878 _proto2.fromTo = function fromTo(targets, fromVars, toVars, position) { 2879 _createTweenType(2, arguments, this); 2880 return this; 2881 }; 2882 _proto2.set = function set(targets, vars, position) { 2883 vars.duration = 0; 2884 vars.parent = this; 2885 _inheritDefaults(vars).repeatDelay || (vars.repeat = 0); 2886 vars.immediateRender = !!vars.immediateRender; 2887 new Tween(targets, vars, _parsePosition(this, position), 1); 2888 return this; 2889 }; 2890 _proto2.call = function call(callback, params, position) { 2891 return _addToTimeline(this, Tween.delayedCall(0, callback, params), position); 2892 } //ONLY for backward compatibility! Maybe delete? 2893 ; 2894 _proto2.staggerTo = function staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) { 2895 vars.duration = duration; 2896 vars.stagger = vars.stagger || stagger; 2897 vars.onComplete = onCompleteAll; 2898 vars.onCompleteParams = onCompleteAllParams; 2899 vars.parent = this; 2900 new Tween(targets, vars, _parsePosition(this, position)); 2901 return this; 2902 }; 2903 _proto2.staggerFrom = function staggerFrom(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams) { 2904 vars.runBackwards = 1; 2905 _inheritDefaults(vars).immediateRender = _isNotFalse(vars.immediateRender); 2906 return this.staggerTo(targets, duration, vars, stagger, position, onCompleteAll, onCompleteAllParams); 2907 }; 2908 _proto2.staggerFromTo = function staggerFromTo(targets, duration, fromVars, toVars, stagger, position, onCompleteAll, onCompleteAllParams) { 2909 toVars.startAt = fromVars; 2910 _inheritDefaults(toVars).immediateRender = _isNotFalse(toVars.immediateRender); 2911 return this.staggerTo(targets, duration, toVars, stagger, position, onCompleteAll, onCompleteAllParams); 2912 }; 2913 _proto2.render = function render(totalTime, suppressEvents, force) { 2914 var prevTime = this._time, tDur = this._dirty ? this.totalDuration() : this._tDur, dur = this._dur, tTime = totalTime <= 0 ? 0 : _roundPrecise(totalTime), // if a paused timeline is resumed (or its _start is updated for another reason...which rounds it), that could result in the playhead shifting a **tiny** amount and a zero-duration child at that spot may get rendered at a different ratio, like its totalTime in render() may be 1e-17 instead of 0, for example. 2915 crossingStart = this._zTime < 0 !== totalTime < 0 && (this._initted || !dur), time, child, next, iteration, cycleDuration, prevPaused, pauseTween, timeScale, prevStart, prevIteration, yoyo, isYoyo; 2916 this !== _globalTimeline && tTime > tDur && totalTime >= 0 && (tTime = tDur); 2917 if (tTime !== this._tTime || force || crossingStart) { 2918 if (prevTime !== this._time && dur) { 2919 //if totalDuration() finds a child with a negative startTime and smoothChildTiming is true, things get shifted around internally so we need to adjust the time accordingly. For example, if a tween starts at -30 we must shift EVERYTHING forward 30 seconds and move this timeline's startTime backward by 30 seconds so that things align with the playhead (no jump). 2920 tTime += this._time - prevTime; 2921 totalTime += this._time - prevTime; 2922 } 2923 time = tTime; 2924 prevStart = this._start; 2925 timeScale = this._ts; 2926 prevPaused = !timeScale; 2927 if (crossingStart) { 2928 dur || (prevTime = this._zTime); //when the playhead arrives at EXACTLY time 0 (right on top) of a zero-duration timeline, we need to discern if events are suppressed so that when the playhead moves again (next time), it'll trigger the callback. If events are NOT suppressed, obviously the callback would be triggered in this render. Basically, the callback should fire either when the playhead ARRIVES or LEAVES this exact spot, not both. Imagine doing a timeline.seek(0) and there's a callback that sits at 0. Since events are suppressed on that seek() by default, nothing will fire, but when the playhead moves off of that position, the callback should fire. This behavior is what people intuitively expect. 2929 (totalTime || !suppressEvents) && (this._zTime = totalTime); 2930 } 2931 if (this._repeat) { 2932 //adjust the time for repeats and yoyos 2933 yoyo = this._yoyo; 2934 cycleDuration = dur + this._rDelay; 2935 if (this._repeat < -1 && totalTime < 0) return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force); 2936 time = _roundPrecise(tTime % cycleDuration); //round to avoid floating point errors. (4 % 0.8 should be 0 but some browsers report it as 0.79999999!) 2937 if (tTime === tDur) { 2938 // the tDur === tTime is for edge cases where there's a lengthy decimal on the duration and it may reach the very end but the time is rendered as not-quite-there (remember, tDur is rounded to 4 decimals whereas dur isn't) 2939 iteration = this._repeat; 2940 time = dur; 2941 } else { 2942 prevIteration = _roundPrecise(tTime / cycleDuration); // full decimal version of iterations, not the previous iteration (we're reusing prevIteration variable for efficiency) 2943 iteration = ~~prevIteration; 2944 if (iteration && iteration === prevIteration) { 2945 time = dur; 2946 iteration--; 2947 } 2948 time > dur && (time = dur); 2949 } 2950 prevIteration = _animationCycle(this._tTime, cycleDuration); 2951 !prevTime && this._tTime && prevIteration !== iteration && this._tTime - prevIteration * cycleDuration - this._dur <= 0 && (prevIteration = iteration); // edge case - if someone does addPause() at the very beginning of a repeating timeline, that pause is technically at the same spot as the end which causes this._time to get set to 0 when the totalTime would normally place the playhead at the end. See https://gsap.com/forums/topic/23823-closing-nav-animation-not-working-on-ie-and-iphone-6-maybe-other-older-browser/?tab=comments#comment-113005 also, this._tTime - prevIteration * cycleDuration - this._dur <= 0 just checks to make sure it wasn't previously in the "repeatDelay" portion 2952 if (yoyo && iteration & 1) { 2953 time = dur - time; 2954 isYoyo = 1; 2955 } 2956 /* 2957 make sure children at the end/beginning of the timeline are rendered properly. If, for example, 2958 a 3-second long timeline rendered at 2.9 seconds previously, and now renders at 3.2 seconds (which
2959 would get translated to 2.8 seconds if the timeline yoyos or 0.2 seconds if it just repeats), there 2960 could be a callback or a short tween that's at 2.95 or 3 seconds in which wouldn't render. So 2961 we need to push the timeline to the end (and/or beginning depending on its yoyo value). Also we must 2962 ensure that zero-duration tweens at the very beginning or end of the Timeline work. 2963 */ if (iteration !== prevIteration && !this._lock) { 2964 var rewinding = yoyo && prevIteration & 1, doesWrap = rewinding === (yoyo && iteration & 1); 2965 iteration < prevIteration && (rewinding = !rewinding); 2966 prevTime = rewinding ? 0 : tTime % dur ? dur : tTime; // if the playhead is landing exactly at the end of an iteration, use that totalTime rather than only the duration, otherwise it'll skip the 2nd render since it's effectively at the same time. 2967 this._lock = 1; 2968 this.render(prevTime || (isYoyo ? 0 : _roundPrecise(iteration * cycleDuration)), suppressEvents, !dur)._lock = 0; 2969 this._tTime = tTime; // if a user gets the iteration() inside the onRepeat, for example, it should be accurate. 2970 !suppressEvents && this.parent && _callback(this, "onRepeat"); 2971 this.vars.repeatRefresh && !isYoyo && (this.invalidate()._lock = 1); 2972 if (prevTime && prevTime !== this._time || prevPaused !== !this._ts || this.vars.onRepeat && !this.parent && !this._act) // if prevTime is 0 and we render at the very end, _time will be the end, thus won't match. So in this edge case, prevTime won't match _time but that's okay. If it gets killed in the onRepeat, eject as well. 2973 return this; 2974 dur = this._dur; // in case the duration changed in the onRepeat 2975 tDur = this._tDur; 2976 if (doesWrap) { 2977 this._lock = 2; 2978 prevTime = rewinding ? dur : -0.0001; 2979 this.render(prevTime, true); 2980 this.vars.repeatRefresh && !isYoyo && this.invalidate(); 2981 } 2982 this._lock = 0; 2983 if (!this._ts && !prevPaused) return this; 2984 //in order for yoyoEase to work properly when there's a stagger, we must swap out the ease in each sub-tween. 2985 _propagateYoyoEase(this, isYoyo); 2986 } 2987 } 2988 if (this._hasPause && !this._forcing && this._lock < 2) { 2989 pauseTween = _findNextPauseTween(this, _roundPrecise(prevTime), _roundPrecise(time)); 2990 if (pauseTween) tTime -= time - (time = pauseTween._start); 2991 } 2992 this._tTime = tTime; 2993 this._time = time; 2994 this._act = !timeScale; //as long as it's not paused, force it to be active so that if the user renders independent of the parent timeline, it'll be forced to re-render on the next tick. 2995 if (!this._initted) { 2996 this._onUpdate = this.vars.onUpdate; 2997 this._initted = 1; 2998 this._zTime = totalTime; 2999 prevTime = 0; // upon init, the playhead should always go forward;
2999 someone could invalidate() a completed timeline and then if they restart(), that would make child tweens render in reverse order which could lock in the wrong starting values if they build on each other, like tl.to(obj, {x: 100}).to(obj, {x: 0}). 3000 } 3001 if (!prevTime && tTime && !suppressEvents && !prevIteration) { 3002 _callback(this, "onStart"); 3003 if (this._tTime !== tTime) // in case the onStart triggered a render at a different spot, eject. Like if someone did animation.pause(0.5) or something inside the onStart. 3004 return this; 3005 } 3006 if (time >= prevTime && totalTime >= 0) { 3007 child = this._first; 3008 while(child){ 3009 next = child._next; 3010 if ((child._act || time >= child._start) && child._ts && pauseTween !== child) { 3011 if (child.parent !== this) // an extreme edge case - the child's render could do something like kill() the "next" one in the linked list, or reparent it. In that case we must re-initiate the whole render to be safe. 3012 return this.render(totalTime, suppressEvents, force); 3013 child.render(child._ts > 0 ? (time - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (time - child._start) * child._ts, suppressEvents, force); 3014 if (time !== this._time || !this._ts && !prevPaused) { 3015 //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete 3016 pauseTween = 0; 3017 next && (tTime += this._zTime = -_tinyNum); // it didn't finish rendering, so flag zTime as negative so that the next time render() is called it'll be forced (to render any remaining children) 3018 break; 3019 } 3020 } 3021 child = next; 3022 } 3023 } else { 3024 child = this._last; 3025 var adjustedTime = totalTime < 0 ? totalTime : time; //when the playhead goes backward beyond the start of this timeline, we must pass that information down to the child animations so that zero-duration tweens know whether to render their starting or ending values. 3026 while(child){ 3027 next = child._prev; 3028 if ((child._act || adjustedTime <= child._end) && child._ts && pauseTween !== child) { 3029 if (child.parent !== this) // an extreme edge case - the child's render could do something like kill() the "next" one in the linked list, or reparent it. In that case we must re-initiate the whole render to be safe. 3030 return this.render(totalTime, suppressEvents, force); 3031 child.render(child._ts > 0 ? (adjustedTime - child._start) * child._ts : (child._dirty ? child.totalDuration() : child._tDur) + (adjustedTime - child._start) * child._ts, suppressEvents, force || _reverting && _isRevertWorthy(child)); // if reverting, we should always force renders of initted tweens (but remember that .fromTo() or .from() may have a _startAt but not _initted yet). If, for example, a .fromTo() tween with a stagger (which creates an internal timeline) gets reverted BEFORE some of its child tweens render for the first time, it may not properly trigger them to revert. 3032 if (time !== this._time || !this._ts && !prevPaused) { 3033 //in case a tween pauses or seeks the timeline when rendering, like inside of an onUpdate/onComplete 3034 pauseTween = 0; 3035 next && (tTime += this._zTime = adjustedTime ? -_tinyNum : _tinyNum); // it didn't finish rendering, so adjust zTime so that so that the next time render() is called it'll be forced (to render any remaining children) 3036 break; 3037 } 3038 } 3039 child = next; 3040 } 3041 } 3042 if (pauseTween && !suppressEvents) { 3043 this.pause(); 3044 pauseTween.render(time >= prevTime ? 0 : -_tinyNum)._zTime = time >= prevTime ? 1 : -1;
3045 if (this._ts) { 3046 //the callback resumed playback! So since we may have held back the playhead due to where the pause is positioned, go ahead and jump to where it's SUPPOSED to be (if no pause happened). 3047 this._start = prevStart; //if the pause was at an earlier time and the user resumed in the callback, it could reposition the timeline (changing its startTime), throwing things off slightly, so we make sure the _start doesn't shift. 3048 _setEnd(this); 3049 return this.render(totalTime, suppressEvents, force); 3050 } 3051 } 3052 this._onUpdate && !suppressEvents && _callback(this, "onUpdate", true); 3053 if (tTime === tDur && this._tTime >= this.totalDuration() || !tTime && prevTime) { 3054 if (prevStart === this._start || Math.abs(timeScale) !== Math.abs(this._ts)) { 3055 if (!this._lock) { 3056 // remember, a child's callback may alter this timeline's playhead or timeScale which is why we need to add some of these checks. 3057 (totalTime || !dur) && (tTime === tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1); // don't remove if the timeline is reversed and the playhead isn't at 0, otherwise tl.progress(1).reverse() won't work. Only remove if the playhead is at the end and timeScale is positive, or if the playhead is at 0 and the timeScale is negative. 3058 if (!suppressEvents && !(totalTime < 0 && !prevTime) && (tTime || prevTime || !tDur)) { 3059 _callback(this, tTime === tDur && totalTime >= 0 ? "onComplete" : "onReverseComplete", true); 3060 this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom(); 3061 } 3062 } 3063 } 3064 } 3065 } 3066 return this; 3067 }; 3068 _proto2.add = function add(child, position) { 3069 var _this2 = this; 3070 _isNumber(position) || (position = _parsePosition(this, position, child)); 3071 if (!(child instanceof Animation)) { 3072 if (_isArray(child)) { 3073 child.forEach(function(obj) { 3074 return _this2.add(obj, position); 3075 }); 3076 return this; 3077 } 3078 if (_isString(child)) return this.addLabel(child, position); 3079 if (_isFunction(child)) child = Tween.delayedCall(0, child); 3080 else return this; 3081 } 3082 return this !== child ? _addToTimeline(this, child, position) : this; //don't allow a timeline to be added to itself as a child! 3083 }; 3084 _proto2.getChildren = function getChildren(nested, tweens, timelines, ignoreBeforeTime) { 3085 if (nested === void 0) nested = true; 3086 if (tweens === void 0) tweens = true; 3087 if (timelines === void 0) timelines = true; 3088 if (ignoreBeforeTime === void 0) ignoreBeforeTime = -_bigNum; 3089 var a = [], child = this._first; 3090 while(child){ 3091 if (child._start >= ignoreBeforeTime) { 3092 if (child instanceof Tween) tweens && a.push(child); 3093 else { 3094 timelines && a.push(child); 3095 nested && a.push.apply(a, child.getChildren(true, tweens, timelines)); 3096 } 3097 } 3098 child = child._next; 3099 } 3100 return a; 3101 }; 3102 _proto2.getById = function getById(id) { 3103 var animations = this.getChildren(1, 1, 1), i = animations.length; 3104 while(i--){ 3105 if (animations[i].vars.id === id) return animations[i]; 3106 } 3107 }; 3108 _proto2.remove = function remove(child) { 3109 if (_isString(child)) return this.removeLabel(child); 3110 if (_isFunction(child)) return this.killTweensOf(child); 3111 child.parent === this && _removeLinkedListItem(this, child); 3112 if (child === this._recent) this._recent = this._last; 3113 return _uncache(this); 3114 }; 3115 _proto2.totalTime = function totalTime(_totalTime2, suppressEvents) { 3116 if (!arguments.length) return this._tTime; 3117 this._forcing = 1; 3118 if (!this._dp && this._ts) //special case for the global timeline (or any other that has no parent or detached parent). 3119 this._start = _roundPrecise(_ticker.time - (this._ts > 0 ? _totalTime2 / this._ts : (this.totalDuration() - _totalTime2) / -this._ts
vendor: 9,373 bytes, lines 3119-3310
3119)); 3120 _Animation.prototype.totalTime.call(this, _totalTime2, suppressEvents); 3121 this._forcing = 0; 3122 return this; 3123 }; 3124 _proto2.addLabel = function addLabel(label, position) { 3125 this.labels[label] = _parsePosition(this, position); 3126 return this; 3127 }; 3128 _proto2.removeLabel = function removeLabel(label) { 3129 delete this.labels[label]; 3130 return this; 3131 }; 3132 _proto2.addPause = function addPause(position, callback, params) { 3133 var t = Tween.delayedCall(0, callback || _emptyFunc, params); 3134 t.data = "isPause"; 3135 this._hasPause = 1; 3136 return _addToTimeline(this, t, _parsePosition(this, position)); 3137 }; 3138 _proto2.removePause = function removePause(position) { 3139 var child = this._first; 3140 position = _parsePosition(this, position); 3141 while(child){ 3142 if (child._start === position && child.data === "isPause") _removeFromParent(child); 3143 child = child._next; 3144 } 3145 }; 3146 _proto2.killTweensOf = function killTweensOf(targets, props, onlyActive) { 3147 var tweens = this.getTweensOf(targets, onlyActive), i = tweens.length; 3148 while(i--)_overwritingTween !== tweens[i] && tweens[i].kill(targets, props); 3149 return this; 3150 }; 3151 _proto2.getTweensOf = function getTweensOf(targets, onlyActive) { 3152 var a = [], parsedTargets = toArray(targets), child = this._first, isGlobalTime = _isNumber(onlyActive), // a number is interpreted as a global time. If the animation spans 3153 children; 3154 while(child){ 3155 if (child instanceof Tween) { 3156 if (_arrayContainsAny(child._targets, parsedTargets) && (isGlobalTime ? (!_overwritingTween || child._initted && child._ts) && child.globalTime(0) <= onlyActive && child.globalTime(child.totalDuration()) > onlyActive : !onlyActive || child.isActive())) // note: if this is for overwriting, it should only be for tweens that aren't paused and are initted. 3157 a.push(child); 3158 } else if ((children = child.getTweensOf(parsedTargets, onlyActive)).length) a.push.apply(a, children); 3159 child = child._next; 3160 } 3161 return a; 3162 } // potential future feature - targets() on timelines 3163 ; 3164 _proto2.tweenTo = function tweenTo(position, vars) { 3165 vars = vars || {}; 3166 var tl = this, endTime = _parsePosition(tl, position), _vars = vars, startAt = _vars.startAt, _onStart = _vars.onStart, onStartParams = _vars.onStartParams, immediateRender = _vars.immediateRender, initted, tween = Tween.to(tl, _setDefaults({ 3167 ease: vars.ease || "none", 3168 lazy: false, 3169 immediateRender: false, 3170 time: endTime, 3171 overwrite: "auto", 3172 duration: vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()) || _tinyNum, 3173 onStart: function onStart() { 3174 tl.pause(); 3175 if (!initted) { 3176 var duration = vars.duration || Math.abs((endTime - (startAt && "time" in startAt ? startAt.time : tl._time)) / tl.timeScale()); 3177 tween._dur !== duration && _setDuration(tween, duration, 0, 1).render(tween._time, true, true); 3178 initted = 1; 3179 } 3180 _onStart && _onStart.apply(tween, onStartParams || []); //in case the user had an onStart in the vars - we don't want to overwrite it. 3181 } 3182 }, vars)); 3183 return immediateRender ? tween.render(0) : tween; 3184 }; 3185 _proto2.tweenFromTo = function tweenFromTo(fromPosition, toPosition, vars) { 3186 return this.tweenTo(toPosition, _setDefaults({ 3187 startAt: { 3188 time: _parsePosition(this, fromPosition) 3189 } 3190 }, vars)); 3191 }; 3192 _proto2.recent = function recent() { 3193 return this._recent; 3194 }; 3195 _proto2.nextLabel = function nextLabel(afterTime) { 3196 if (afterTime === void 0) afterTime = this._time; 3197 return _getLabelInDirection(this, _parsePosition(this, afterTime)); 3198 }; 3199 _proto2.previousLabel = function previousLabel(beforeTime) { 3200 if (beforeTime === void 0) beforeTime = this._time; 3201 return _getLabelInDirection(this, _parsePosition(this, beforeTime), 1); 3202 }; 3203 _proto2.currentLabel = function currentLabel(value) { 3204 return arguments.length ? this.seek(value, true) : this.previousLabel(this._time + _tinyNum); 3205 }; 3206 _proto2.shiftChildren = function shiftChildren(amount, adjustLabels, ignoreBeforeTime) { 3207 if (ignoreBeforeTime === void 0) ignoreBeforeTime = 0; 3208 var child = this._first, labels = this.labels, p; 3209 while(child){ 3210 if (child._start >= ignoreBeforeTime) { 3211 child._start += amount; 3212 child._end += amount; 3213 } 3214 child = child._next; 3215 } 3216 if (adjustLabels) { 3217 for(p in labels)if (labels[p] >= ignoreBeforeTime) labels[p] += amount; 3218 } 3219 return _uncache(this); 3220 }; 3221 _proto2.invalidate = function invalidate(soft) { 3222 var child = this._first; 3223 this._lock = 0; 3224 while(child){ 3225 child.invalidate(soft); 3226 child = child._next; 3227 } 3228 return _Animation.prototype.invalidate.call(this, soft); 3229 }; 3230 _proto2.clear = function clear(includeLabels) { 3231 if (includeLabels === void 0) includeLabels = true; 3232 var child = this._first, next; 3233 while(child){ 3234 next = child._next; 3235 this.remove(child); 3236 child = next; 3237 } 3238 this._dp && (this._time = this._tTime = this._pTime = 0); 3239 includeLabels && (this.labels = {}); 3240 return _uncache(this); 3241 }; 3242 _proto2.totalDuration = function totalDuration(value) { 3243 var max = 0, self = this, child = self._last, prevStart = _bigNum, prev, start, parent; 3244 if (arguments.length) return self.timeScale((self._repeat < 0 ? self.duration() : self.totalDuration()) / (self.reversed() ? -value : value)); 3245 if (self._dirty) { 3246 parent = self.parent; 3247 while(child){ 3248 prev = child._prev; //record it here in case the tween changes position in the sequence... 3249 child._dirty && child.totalDuration(); //could change the tween._startTime, so make sure the animation's cache is clean before analyzing it. 3250 start = child._start; 3251 if (start > prevStart && self._sort && child._ts && !self._lock) { 3252 //in case one of the tweens shifted out of order, it needs to be re-inserted into the correct position in the sequence 3253 self._lock = 1; //prevent endless recursive calls - there are methods that get triggered that check duration/totalDuration when we add(). 3254 _addToTimeline(self, child, start - child._delay, 1)._lock = 0; 3255 } else prevStart = start; 3256 if (start < 0 && child._ts) { 3257 //children aren't allowed to have negative startTimes unless smoothChildTiming is true, so adjust here if one is found. 3258 max -= start; 3259 if (!parent && !self._dp || parent && parent.smoothChildTiming) { 3260 self._start += start / self._ts; 3261 self._time -= start; 3262 self._tTime -= start; 3263 } 3264 self.shiftChildren(-start, false, -Infinity); 3265 prevStart = 0; 3266 } 3267 child._end > max && child._ts && (max = child._end); 3268 child = prev; 3269 } 3270 _setDuration(self, self === _globalTimeline && self._time > max ? self._time : max, 1, 1); 3271 self._dirty = 0; 3272 } 3273 return self._tDur; 3274 }; 3275 Timeline.updateRoot = function updateRoot(time) { 3276 if (_globalTimeline._ts) { 3277 _lazySafeRender(_globalTimeline, _parentToChildTotalTime(time, _globalTimeline)); 3278 _lastRenderedFrame = _ticker.frame; 3279 } 3280 if (_ticker.frame >= _nextGCFrame) { 3281 _nextGCFrame += _config.autoSleep || 120; 3282 var child = _globalTimeline._first; 3283 if (!child || !child._ts) { 3284 if (_config.autoSleep && _ticker._listeners.length < 2) { 3285 while(child && !child._ts)child = child._next; 3286 child || _ticker.sleep(); 3287 } 3288 } 3289 } 3290 }; 3291 return Timeline; 3292}(Animation); 3293_setDefaults(Timeline.prototype, { 3294 _lock: 0, 3295 _hasPause: 0, 3296 _forcing: 0 3297}); 3298var _addComplexStringPropTween = function _addComplexStringPropTween(target, prop, start, end, setter, stringFilter, funcParam) { 3299 //note: we call _addComplexStringPropTween.call(tweenInstance...) to ensure that it's scoped properly. We may call it from within a plugin too, thus "this" would refer to the plugin. 3300 var pt = new PropTween(this._pt, target, prop, 0, 1, _renderComplexString, null, setter), index = 0, matchIndex = 0, result, startNums, color, endNum, chunk, startNum, hasRandom, a; 3301 pt.b = start; 3302 pt.e = end; 3303 start += ""; //ensure values are strings 3304 end += ""; 3305 if (hasRandom = ~end.indexOf("random(")) end = _replaceRandom(end); 3306 if (stringFilter) { 3307 a = [ 3308 start, 3309 end 3310 ];
vendor: 5,755 bytes, lines 3311-3381
3311 stringFilter(a, target, prop); //pass an array with the starting and ending values and let the filter do whatever it needs to the values. 3312 start = a[0]; 3313 end = a[1]; 3314 } 3315 startNums = start.match(_complexStringNumExp) || []; 3316 while(result = _complexStringNumExp.exec(end)){ 3317 endNum = result[0]; 3318 chunk = end.substring(index, result.index); 3319 if (color) color = (color + 1) % 5; 3320 else if (chunk.substr(-5) === "rgba(") color = 1; 3321 if (endNum !== startNums[matchIndex++]) { 3322 startNum = parseFloat(startNums[matchIndex - 1]) || 0; //these nested PropTweens are handled in a special way - we'll never actually call a render or setter method on them. We'll just loop through them in the parent complex string PropTween's render method. 3323 pt._pt = { 3324 _next: pt._pt, 3325 p: chunk || matchIndex === 1 ? chunk : ",", 3326 //note: SVG spec allows omission of comma/space when a negative sign is wedged between two numbers, like 2.5-5.3 instead of 2.5,-5.3 but when tweening, the negative value may switch to positive, so we insert the comma just in case. 3327 s: startNum, 3328 c: endNum.charAt(1) === "=" ? _parseRelative(startNum, endNum) - startNum : parseFloat(endNum) - startNum, 3329 m: color && color < 4 ? Math.round : 0 3330 }; 3331 index = _complexStringNumExp.lastIndex; 3332 } 3333 } 3334 pt.c = index < end.length ? end.substring(index, end.length) : ""; //we use the "c" of the PropTween to store the final part of the string (after the last number) 3335 pt.fp = funcParam; 3336 if (_relExp.test(end) || hasRandom) pt.e = 0; //if the end string contains relative values or dynamic random(...) values, delete the end it so that on the final render we don't actually set it to the string with += or -= characters (forces it to use the calculated value). 3337 this._pt = pt; //start the linked list with this new PropTween. Remember, we call _addComplexStringPropTween.call(tweenInstance...) to ensure that it's scoped properly. We may call it from within a plugin too, thus "this" would refer to the plugin. 3338 return pt; 3339}, _addPropTween = function _addPropTween(target, prop, start, end, index, targets, modifier, stringFilter, funcParam, optional) { 3340 _isFunction(end) && (end = end(index || 0, target, targets)); 3341 var currentValue = target[prop], parsedStart = start !== "get" ? start : !_isFunction(currentValue) ? currentValue : funcParam ? target[prop.indexOf("set") || !_isFunction(target["get" + prop.substr(3)]) ? prop : "get" + prop.substr(3)](funcParam) : target[prop](), setter = !_isFunction(currentValue) ? _setterPlain : funcParam ? _setterFuncWithParam : _setterFunc, pt; 3342 if (_isString(end)) { 3343 if (~end.indexOf("random(")) end = _replaceRandom(end); 3344 if (end.charAt(1) === "=") { 3345 pt = _parseRelative(parsedStart, end) + (getUnit(parsedStart) || 0); 3346 if (pt || pt === 0) // to avoid isNaN, like if someone passes in a value like "!= whatever" 3347 end = pt; 3348 } 3349 } 3350 if (!optional || parsedStart !== end || _forceAllPropTweens) { 3351 if (!isNaN(parsedStart * end) && end !== "") { 3352 // fun fact: any number multiplied by "" is evaluated as the number 0! 3353 pt = new PropTween(this._pt, target, prop, +parsedStart || 0, end - (parsedStart || 0), typeof currentValue === "boolean" ? _renderBoolean : _renderPlain, 0, setter); 3354 funcParam && (pt.fp = funcParam); 3355 modifier && pt.modifier(modifier, this, target); 3356 return this._pt = pt; 3357 } 3358 !currentValue && !(prop in target) && _missingPlugin(prop, end); 3359 return _addComplexStringPropTween.call(this, target, prop, parsedStart, end, setter, stringFilter || _config.stringFilter, funcParam); 3360 } 3361}, //creates a copy of the vars object and processes any function-based values (putting the resulting values directly into the copy) as well as strings with "random()" in them. It does NOT process relative values. 3362_processVars = function _processVars(vars, index, target, targets, tween) { 3363 _isFunction(vars) && (vars = _parseFuncOrString(vars, tween, index, target, targets)); 3364 if (!_isObject(vars) || vars.style && vars.nodeType || _isArray(vars) || _isTypedArray(vars)) return _isString(vars) ? _parseFuncOrString(vars, tween, index, target, targets) : vars; 3365 var copy = {}, p; 3366 for(p in vars)copy[p] = _parseFuncOrString(vars[p], tween, index, target, targets); 3367 return copy; 3368}, _checkPlugin = function _checkPlugin(property, vars, tween, index, target, targets) { 3369 var plugin, pt, ptLookup, i; 3370 if (_plugins[property] && (plugin = new _plugins[property]()).init(target, plugin.rawVars ? vars[property] : _processVars(vars[property], index, target, targets, tween), tween, index, targets) !== false) { 3371 tween._pt = pt = new PropTween(tween._pt, target, property, 0, 1, plugin.render, plugin, 0, plugin.priority); 3372 if (tween !== _quickTween) { 3373 ptLookup = tween._ptLookup[tween._targets.indexOf(target)]; //note: we can't use tween._ptLookup[index] because for staggered tweens, the index from the fullTargets array won't match what it is in each individual tween that spawns from the stagger. 3374 i = plugin._props.length; 3375 while(i--)ptLookup[plugin._props[i]] = pt; 3376 } 3377 } 3378 return plugin; 3379}, _overwritingTween, //store a reference temporarily so we can avoid overwriting itself. 3380_forceAllPropTweens, _initTween = function _initTween(tween, time, tTime) { 3381 var vars = tween.vars, ease = vars.ease, startAt = vars.startAt, immediateRender = vars.immediateRender, lazy = vars.lazy, onUpdate = vars.onUp
vendor: 5,002 bytes, lines 3381-3430
3381date, runBackwards = vars.runBackwards, yoyoEase = vars.yoyoEase, keyframes = vars.keyframes, autoRevert = vars.autoRevert, dur = tween._dur, prevStartAt = tween._startAt, targets = tween._targets, parent = tween.parent, fullTargets = parent && parent.data === "nested" ? parent.vars.targets : targets, autoOverwrite = tween._overwrite === "auto" && !_suppressOverwrites, tl = tween.timeline, cleanVars, i, p, pt, target, hasPriority, gsData, harness, plugin, ptLookup, index, harnessVars, overwritten; 3382 tl && (!keyframes || !ease) && (ease = "none"); 3383 tween._ease = _parseEase(ease, _defaults.ease); 3384 tween._yEase = yoyoEase ? _invertEase(_parseEase(yoyoEase === true ? ease : yoyoEase, _defaults.ease)) : 0; 3385 if (yoyoEase && tween._yoyo && !tween._repeat) { 3386 //there must have been a parent timeline with yoyo:true that is currently in its yoyo phase, so flip the eases. 3387 yoyoEase = tween._yEase; 3388 tween._yEase = tween._ease; 3389 tween._ease = yoyoEase; 3390 } 3391 tween._from = !tl && !!vars.runBackwards; //nested timelines should never run backwards - the backwards-ness is in the child tweens. 3392 if (!tl || keyframes && !vars.stagger) { 3393 //if there's an internal timeline, skip all the parsing because we passed that task down the chain. 3394 harness = targets[0] ? _getCache(targets[0]).harness : 0; 3395 harnessVars = harness && vars[harness.prop]; //someone may need to specify CSS-specific values AND non-CSS values, like if the element has an "x" property plus it's a standard DOM element. We allow people to distinguish by wrapping plugin-specific stuff in a css:{} object for example. 3396 cleanVars = _copyExcluding(vars, _reservedProps); 3397 if (prevStartAt) { 3398 prevStartAt._zTime < 0 && prevStartAt.progress(1); // in case it's a lazy startAt that hasn't rendered yet. 3399 time < 0 && runBackwards && immediateRender && !autoRevert ? prevStartAt.render(-1, true) : prevStartAt.revert(runBackwards && dur ? _revertConfigNoKill : _startAtRevertConfig); // if it's a "startAt" (not "from()" or runBackwards: true), we only need to do a shallow revert (keep transforms cached in CSSPlugin) 3400 // don't just _removeFromParent(prevStartAt.render(-1, true)) because that'll leave inline styles. We're creating a new _startAt for "startAt" tweens that re-capture things to ensure that if the pre-tween values changed since the tween was created, they're recorded. 3401 prevStartAt._lazy = 0; 3402 } 3403 if (startAt) { 3404 _removeFromParent(tween._startAt = Tween.set(targets, _setDefaults({ 3405 data: "isStart", 3406 overwrite: false, 3407 parent: parent, 3408 immediateRender: true, 3409 lazy: !prevStartAt && _isNotFalse(lazy), 3410 startAt: null, 3411 delay: 0, 3412 onUpdate: onUpdate && function() { 3413 return _callback(tween, "onUpdate"); 3414 }, 3415 stagger: 0 3416 }, startAt))); //copy the properties/values into a new object to avoid collisions, like var to = {x:0}, from = {x:500}; timeline.fromTo(e, from, to).fromTo(e, to, from); 3417 tween._startAt._dp = 0; // don't allow it to get put back into root timeline! Like when revert() is called and totalTime() gets set. 3418 tween._startAt._sat = tween; // used in globalTime(). _sat stands for _startAtTween 3419 time < 0 && (_reverting || !immediateRender && !autoRevert) && tween._startAt.revert(_revertConfigNoKill); // rare edge case, like if a render is forced in the negative direction of a non-initted tween. 3420 if (immediateRender) { 3421 if (dur && time <= 0 && tTime <= 0) { 3422 // check tTime here because in the case of a yoyo tween whose playhead gets pushed to the end like tween.progress(1), we should allow it through so that the onComplete gets fired properly. 3423 time && (tween._zTime = time); 3424 return; //we skip initialization here so that overwriting doesn't occur until the tween actually begins. Otherwise, if you create several immediateRender:true tweens of the same target/properties to drop into a Timeline, the last one created would overwrite the first ones because they didn't get placed into the timeline yet before the first render occurs and kicks in overwriting. 3425 } 3426 } 3427 } else if (runBackwards && dur) //from() tweens must be handled uniquely: their beginning values must be rendered but we don't want overwriting to occur yet (when time is still 0). Wait until the tween actually begins before doing all the routines like overwriting. At that time, we should render at the END of the tween to ensure that things initialize correctly (remember, from() tweens go backwards) 3428 { 3429 if (!prevStartAt) { 3430 time && (immediateRender = false); //in rare cases (like if a from() tween runs and then is invali
vendor: 13,532 bytes, lines 3430-3601
3430date()-ed), immediateRender could be true but the initial forced-render gets skipped, so there's no need to force the render in this context when the _time is greater than 0 3431 p = _setDefaults({ 3432 overwrite: false, 3433 data: "isFromStart", 3434 //we tag the tween with as "isFromStart" so that if [inside a plugin] we need to only do something at the very END of a tween, we have a way of identifying this tween as merely the one that's setting the beginning values for a "from()" tween. For example, clearProps in CSSPlugin should only get applied at the very END of a tween and without this tag, from(...{height:100, clearProps:"height", delay:1}) would wipe the height at the beginning of the tween and after 1 second, it'd kick back in. 3435 lazy: immediateRender && !prevStartAt && _isNotFalse(lazy), 3436 immediateRender: immediateRender, 3437 //zero-duration tweens render immediately by default, but if we're not specifically instructed to render this tween immediately, we should skip this and merely _init() to record the starting values (rendering them immediately would push them to completion which is wasteful in that case - we'd have to render(-1) immediately after) 3438 stagger: 0, 3439 parent: parent //ensures that nested tweens that had a stagger are handled properly, like gsap.from(".class", {y: gsap.utils.wrap([-100,100]), stagger: 0.5}) 3440 }, cleanVars); 3441 harnessVars && (p[harness.prop] = harnessVars); // in case someone does something like .from(..., {css:{}}) 3442 _removeFromParent(tween._startAt = Tween.set(targets, p)); 3443 tween._startAt._dp = 0; // don't allow it to get put back into root timeline! 3444 tween._startAt._sat = tween; // used in globalTime() 3445 time < 0 && (_reverting ? tween._startAt.revert(_revertConfigNoKill) : tween._startAt.render(-1, true)); 3446 tween._zTime = time; 3447 if (!immediateRender) _initTween(tween._startAt, _tinyNum, _tinyNum); //ensures that the initial values are recorded 3448 else if (!time) return; 3449 } 3450 } 3451 tween._pt = tween._ptCache = 0; 3452 lazy = dur && _isNotFalse(lazy) || lazy && !dur; 3453 for(i = 0; i < targets.length; i++){ 3454 target = targets[i]; 3455 gsData = target._gsap || _harness(targets)[i]._gsap; 3456 tween._ptLookup[i] = ptLookup = {}; 3457 _lazyLookup[gsData.id] && _lazyTweens.length && _lazyRender(); //if other tweens of the same target have recently initted but haven't rendered yet, we've got to force the render so that the starting values are correct (imagine populating a timeline with a bunch of sequential tweens and then jumping to the end) 3458 index = fullTargets === targets ? i : fullTargets.indexOf(target); 3459 if (harness && (plugin = new harness()).init(target, harnessVars || cleanVars, tween, index, fullTargets) !== false) { 3460 tween._pt = pt = new PropTween(tween._pt, target, plugin.name, 0, 1, plugin.render, plugin, 0, plugin.priority); 3461 plugin._props.forEach(function(name) { 3462 ptLookup[name] = pt; 3463 }); 3464 plugin.priority && (hasPriority = 1); 3465 } 3466 if (!harness || harnessVars) { 3467 for(p in cleanVars)if (_plugins[p] && (plugin = _checkPlugin(p, cleanVars, tween, index, target, fullTargets))) plugin.priority && (hasPriority = 1); 3468 else ptLookup[p] = pt = _addPropTween.call(tween, target, p, "get", cleanVars[p], index, fullTargets, 0, vars.stringFilter); 3469 } 3470 tween._op && tween._op[i] && tween.kill(target, tween._op[i]); 3471 if (autoOverwrite && tween._pt) { 3472 _overwritingTween = tween; 3473 _globalTimeline.killTweensOf(target, ptLookup, tween.globalTime(time)); // make sure the overwriting doesn't overwrite THIS tween!!! 3474 overwritten = !tween.parent; 3475 _overwritingTween = 0; 3476 } 3477 tween._pt && lazy && (_lazyLookup[gsData.id] = 1); 3478 } 3479 hasPriority && _sortPropTweensByPriority(tween); 3480 tween._onInit && tween._onInit(tween); //plugins like RoundProps must wait until ALL of the PropTweens are instantiated. In the plugin's init() function, it sets the _onInit on the tween instance. May not be pretty/intuitive, but it's fast and keeps file size down. 3481 } 3482 tween._onUpdate = onUpdate; 3483 tween._initted = (!tween._op || tween._pt) && !overwritten; // if overwrittenProps resulted in the entire tween being killed, do NOT flag it as initted or else it may render for one tick. 3484 keyframes && time <= 0 && tl.render(_bigNum, true, true); // if there's a 0% keyframe, it'll render in the "before" state for any staggered/delayed animations thus when the following tween initializes, it'll use the "before" state instead of the "after" state as the initial values. 3485}, _updatePropTweens = function _updatePropTweens(tween, property, value, start, startIsRelative, ratio, time, skipRecursion) { 3486 var ptCache = (tween._pt && tween._ptCache || (tween._ptCache = {}))[property], pt, rootPT, lookup, i; 3487 if (!ptCache) { 3488 ptCache = tween._ptCache[property] = []; 3489 lookup = tween._ptLookup; 3490 i = tween._targets.length; 3491 while(i--){ 3492 pt = lookup[i][property]; 3493 if (pt && pt.d && pt.d._pt) { 3494 // it's a plugin, so find the nested PropTween 3495 pt = pt.d._pt; 3496 while(pt && pt.p !== property && pt.fp !== property)// "fp" is functionParam for things like setting CSS variables which require .setProperty("--var-name", value) 3497 pt = pt._next; 3498 } 3499 if (!pt) { 3500 // there is no PropTween associated with that property, so we must FORCE one to be created and ditch out of this 3501 // if the tween has other properties that already rendered at new positions, we'd normally have to rewind to put them back like tween.render(0, true) before forcing an _initTween(), but that can create another edge case like tweening a timeline's progress would trigger onUpdates to fire which could move other things around. It's better to just inform users that .resetTo() should ONLY be used for tweens that already have that property. For example, you can't gsap.to(...{ y: 0 }) and then tween.restTo("x", 200) for example. 3502 _forceAllPropTweens = 1; // otherwise, when we _addPropTween() and it finds no change between the start and end values, it skips creating a PropTween (for efficiency...why tween when there's no difference?) but in this case we NEED that PropTween created so we can edit it. 3503 tween.vars[property] = "+=0"; 3504 _initTween(tween, time); 3505 _forceAllPropTweens = 0; 3506 return skipRecursion ? _warn(property + " not eligible for reset") : 1; // if someone tries to do a quickTo() on a special property like borderRadius which must get split into 4 different properties, that's not eligible for .resetTo(). 3507 } 3508 ptCache.push(pt); 3509 } 3510 } 3511 i = ptCache.length; 3512 while(i--){ 3513 rootPT = ptCache[i]; 3514 pt = rootPT._pt || rootPT; // complex values may have nested PropTweens. We only accommodate the FIRST value. 3515 pt.s = (start || start === 0) && !startIsRelative ? start : pt.s + (start || 0) + ratio * pt.c; 3516 pt.c = value - pt.s; 3517 rootPT.e && (rootPT.e = _round(value) + getUnit(rootPT.e)); // mainly for CSSPlugin (end value) 3518 rootPT.b && (rootPT.b = pt.s + getUnit(rootPT.b)); // (beginning value) 3519 } 3520}, _addAliasesToVars = function _addAliasesToVars(targets, vars) { 3521 var harness = targets[0] ? _getCache(targets[0]).harness : 0, propertyAliases = harness && harness.aliases, copy, p, i, aliases; 3522 if (!propertyAliases) return vars; 3523 copy = _merge({}, vars); 3524 for(p in propertyAliases)if (p in copy) { 3525 aliases = propertyAliases[p].split(","); 3526 i = aliases.length; 3527 while(i--)copy[aliases[i]] = copy[p]; 3528 } 3529 return copy; 3530}, // parses multiple formats, like {"0%": {x: 100}, {"50%": {x: -20}} and { x: {"0%": 100, "50%": -20} }, and an "ease" can be set on any object. We populate an "allProps" object with an Array for each property, like {x: [{}, {}], y:[{}, {}]} with data for each property tween. The objects have a "t" (time), "v", (value), and "e" (ease) property. This allows us to piece together a timeline later. 3531_parseKeyframe = function _parseKeyframe(prop, obj, allProps, easeEach) { 3532 var ease = obj.ease || easeEach || "power1.inOut", p, a; 3533 if (_isArray(obj)) { 3534 a = allProps[prop] || (allProps[prop] = []); // t = time (out of 100), v = value, e = ease 3535 obj.forEach(function(value, i) { 3536 return a.push({ 3537 t: i / (obj.length - 1) * 100, 3538 v: value, 3539 e: ease 3540 }); 3541 }); 3542 } else for(p in obj){ 3543 a = allProps[p] || (allProps[p] = []); 3544 p === "ease" || a.push({ 3545 t: parseFloat(prop), 3546 v: obj[p], 3547 e: ease 3548 }); 3549 } 3550}, _parseFuncOrString = function _parseFuncOrString(value, tween, i, target, targets) { 3551 return _isFunction(value) ? value.call(tween, i, target, targets) : _isString(value) && ~value.indexOf("random(") ? _replaceRandom(value) : value; 3552}, _staggerTweenProps = _callbackNames + "repeat,repeatDelay,yoyo,repeatRefresh,yoyoEase,autoRevert", _staggerPropsToSkip = {}; 3553_forEachName(_staggerTweenProps + ",id,stagger,delay,duration,paused,scrollTrigger", function(name) { 3554 return _staggerPropsToSkip[name] = 1; 3555}); 3556var Tween = /*#__PURE__*/ function(_Animation2) { 3557 _inheritsLoose(Tween, _Animation2); 3558 function Tween(targets, vars, position, skipInherit) { 3559 var _this3; 3560 if (typeof vars === "number") { 3561 position.duration = vars; 3562 vars = position; 3563 position = null; 3564 } 3565 _this3 = _Animation2.call(this, skipInherit ? vars : _inheritDefaults(vars)) || this; 3566 var _this3$vars = _this3.vars, duration = _this3$vars.duration, delay = _this3$vars.delay, immediateRender = _this3$vars.immediateRender, stagger = _this3$vars.stagger, overwrite = _this3$vars.overwrite, keyframes = _this3$vars.keyframes, defaults = _this3$vars.defaults, scrollTrigger = _this3$vars.scrollTrigger, yoyoEase = _this3$vars.yoyoEase, parent = vars.parent || _globalTimeline, parsedTargets = (_isArray(targets) || _isTypedArray(targets) ? _isNumber(targets[0]) : "length" in vars) ? [ 3567 targets 3568 ] : toArray(targets), tl, i, copy, l, p, curTarget, staggerFunc, staggerVarsToMerge; 3569 _this3._targets = parsedTargets.length ? _harness(parsedTargets) : _warn("GSAP target " + targets + " not found. https://gsap.com", !_config.nullTargetWarn) || []; 3570 _this3._ptLookup = []; //PropTween lookup. An array containing an object for each target, having keys for each tweening property 3571 _this3._overwrite = overwrite; 3572 if (keyframes || stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) { 3573 vars = _this3.vars; 3574 tl = _this3.timeline = new Timeline({ 3575 data: "nested", 3576 defaults: defaults || {}, 3577 targets: parent && parent.data === "nested" ? parent.vars.targets : parsedTargets 3578 }); // we need to store the targets because for staggers and keyframes, we end up creating an individual tween for each but function-based values need to know the index and the whole Array of targets. 3579 tl.kill(); 3580 tl.parent = tl._dp = _assertThisInitialized(_this3); 3581 tl._start = 0; 3582 if (stagger || _isFuncOrString(duration) || _isFuncOrString(delay)) { 3583 l = parsedTargets.length; 3584 staggerFunc = stagger && distribute(stagger); 3585 if (_isObject(stagger)) { 3586 //users can pass in callbacks like onStart/onComplete in the stagger object. These should fire with each individual tween. 3587 for(p in stagger)if (~_staggerTweenProps.indexOf(p)) { 3588 staggerVarsToMerge || (staggerVarsToMerge = {}); 3589 staggerVarsToMerge[p] = stagger[p]; 3590 } 3591 } 3592 for(i = 0; i < l; i++){ 3593 copy = _copyExcluding(vars, _staggerPropsToSkip); 3594 copy.stagger = 0; 3595 yoyoEase && (copy.yoyoEase = yoyoEase); 3596 staggerVarsToMerge && _merge(copy, staggerVarsToMerge); 3597 curTarget = parsedTargets[i]; //don't just copy duration or delay because if they're a string or function, we'd end up in an infinite loop because _isFuncOrString() would evaluate as true in the child tweens, entering this loop, etc. So we parse the value straight from vars and default to 0. 3598 copy.duration = +_parseFuncOrString(duration, _assertThisInitialized(_this3), i, curTarget, parsedTargets); 3599 copy.delay = (+_parseFuncOrString(delay, _assertThisInitialized(_this3), i, curTarget, parsedTargets) || 0) - _this3._delay; 3600 if (!stagger && l === 1 && copy.delay) { 3601 // if someone does delay:"random(1, 5)", repeat:-1, for example, the delay
vendor: 7,742 bytes, lines 3601-3712
3601shouldn't be inside the repeat. 3602 _this3._delay = delay = copy.delay; 3603 _this3._start += delay; 3604 copy.delay = 0; 3605 } 3606 tl.to(curTarget, copy, staggerFunc ? staggerFunc(i, curTarget, parsedTargets) : 0); 3607 tl._ease = _easeMap.none; 3608 } 3609 tl.duration() ? duration = delay = 0 : _this3.timeline = 0; // if the timeline's duration is 0, we don't need a timeline internally! 3610 } else if (keyframes) { 3611 _inheritDefaults(_setDefaults(tl.vars.defaults, { 3612 ease: "none" 3613 })); 3614 tl._ease = _parseEase(keyframes.ease || vars.ease || "none"); 3615 var time = 0, a, kf, v; 3616 if (_isArray(keyframes)) { 3617 keyframes.forEach(function(frame) { 3618 return tl.to(parsedTargets, frame, ">"); 3619 }); 3620 tl.duration(); // to ensure tl._dur is cached because we tap into it for performance purposes in the render() method. 3621 } else { 3622 copy = {}; 3623 for(p in keyframes)p === "ease" || p === "easeEach" || _parseKeyframe(p, keyframes[p], copy, keyframes.easeEach); 3624 for(p in copy){ 3625 a = copy[p].sort(function(a, b) { 3626 return a.t - b.t; 3627 }); 3628 time = 0; 3629 for(i = 0; i < a.length; i++){ 3630 kf = a[i]; 3631 v = { 3632 ease: kf.e, 3633 duration: (kf.t - (i ? a[i - 1].t : 0)) / 100 * duration 3634 }; 3635 v[p] = kf.v; 3636 tl.to(parsedTargets, v, time); 3637 time += v.duration; 3638 } 3639 } 3640 tl.duration() < duration && tl.to({}, { 3641 duration: duration - tl.duration() 3642 }); // in case keyframes didn't go to 100% 3643 } 3644 } 3645 duration || _this3.duration(duration = tl.duration()); 3646 } else _this3.timeline = 0; //speed optimization, faster lookups (no going up the prototype chain) 3647 if (overwrite === true && !_suppressOverwrites) { 3648 _overwritingTween = _assertThisInitialized(_this3); 3649 _globalTimeline.killTweensOf(parsedTargets); 3650 _overwritingTween = 0; 3651 } 3652 _addToTimeline(parent, _assertThisInitialized(_this3), position); 3653 vars.reversed && _this3.reverse(); 3654 vars.paused && _this3.paused(true); 3655 if (immediateRender || !duration && !keyframes && _this3._start === _roundPrecise(parent._time) && _isNotFalse(immediateRender) && _hasNoPausedAncestors(_assertThisInitialized(_this3)) && parent.data !== "nested") { 3656 _this3._tTime = -_tinyNum; //forces a render without having to set the render() "force" parameter to true because we want to allow lazying by default (using the "force" parameter always forces an immediate full render) 3657 _this3.render(Math.max(0, -delay) || 0); //in case delay is negative 3658 } 3659 scrollTrigger && _scrollTrigger(_assertThisInitialized(_this3), scrollTrigger); 3660 return _this3; 3661 } 3662 var _proto3 = Tween.prototype; 3663 _proto3.render = function render(totalTime, suppressEvents, force) { 3664 var prevTime = this._time, tDur = this._tDur, dur = this._dur, isNegative = totalTime < 0, tTime = totalTime > tDur - _tinyNum && !isNegative ? tDur : totalTime < _tinyNum ? 0 : totalTime, time, pt, iteration, cycleDuration, prevIteration, isYoyo, ratio, timeline, yoyoEase; 3665 if (!dur) _renderZeroDurationTween(this, totalTime, suppressEvents, force); 3666 else if (tTime !== this._tTime || !totalTime || force || !this._initted && this._tTime || this._startAt && this._zTime < 0 !== isNegative || this._lazy) { 3667 // this senses if we're crossing over the start time, in which case we must record _zTime and force the render, but we do it in this lengthy conditional way for performance reasons (usually we can skip the calculations): this._initted && (this._zTime < 0) !== (totalTime < 0) 3668 time = tTime; 3669 timeline = this.timeline; 3670 if (this._repeat) { 3671 //adjust the time for repeats and yoyos 3672 cycleDuration = dur + this._rDelay; 3673 if (this._repeat < -1 && isNegative) return this.totalTime(cycleDuration * 100 + totalTime, suppressEvents, force); 3674 time = _roundPrecise(tTime % cycleDuration); //round to avoid floating point errors. (4 % 0.8 should be 0 but some browsers report it as 0.79999999!) 3675 if (tTime === tDur) { 3676 // the tDur === tTime is for edge cases where there's a lengthy decimal on the duration and it may reach the very end but the time is rendered as not-quite-there (remember, tDur is rounded to 4 decimals whereas dur isn't) 3677 iteration = this._repeat; 3678 time = dur; 3679 } else { 3680 prevIteration = _roundPrecise(tTime / cycleDuration); // full decimal version of iterations, not the previous iteration (we're reusing prevIteration variable for efficiency) 3681 iteration = ~~prevIteration; 3682 if (iteration && iteration === prevIteration) { 3683 time = dur; 3684 iteration--; 3685 } else if (time > dur) time = dur; 3686 } 3687 isYoyo = this._yoyo && iteration & 1; 3688 if (isYoyo) { 3689 yoyoEase = this._yEase; 3690 time = dur - time; 3691 } 3692 prevIteration = _animationCycle(this._tTime, cycleDuration); 3693 if (time === prevTime && !force && this._initted && iteration === prevIteration) { 3694 //could be during the repeatDelay part. No need to render and fire callbacks. 3695 this._tTime = tTime; 3696 return this; 3697 } 3698 if (iteration !== prevIteration) { 3699 timeline && this._yEase && _propagateYoyoEase(timeline, isYoyo); //repeatRefresh functionality 3700 if (this.vars.repeatRefresh && !isYoyo && !this._lock && time !== cycleDuration && this._initted) { 3701 // this._time will === cycleDuration when we render at EXACTLY the end of an iteration. Without this condition, it'd often do the repeatRefresh render TWICE (again on the very next tick). 3702 this._lock = force = 1; //force, otherwise if lazy is true, the _attemptInitTween() will return and we'll jump out and get caught bouncing on each tick. 3703 this.render(_roundPrecise(cycleDuration * iteration), true).invalidate()._lock = 0; 3704 } 3705 } 3706 } 3707 if (!this._initted) { 3708 if (_attemptInitTween(this, isNegative ? totalTime : time, force, suppressEvents, tTime)) { 3709 this._tTime = 0; // in constructor if immediateRender is true, we set _tTime to -_tinyNum to have the playhead cross the starting point but we can't leave _tTime as a negative number. 3710 return this; 3711 } 3712 if (prevTime !== this._time && !(force && this.vars.repeatRefresh && iteration !== prevIteration)) // rare edge case - during initialization, an onUpdate in the _startAt (.fromTo()) might force this tween to render at a different spot in
3712which case we should ditch this render() call so that it doesn't revert the values. But we also don't want to dump if we're doing a repeatRefresh render! 3713 return this; 3714 if (dur !== this._dur) // while initting, a plugin like InertiaPlugin might alter the duration, so rerun from the start to ensure everything renders as it should. 3715 return this.render(totalTime, suppressEvents, force); 3716 } 3717 this._tTime = tTime; 3718 this._time = time; 3719 if (!this._act && this._ts) { 3720 this._act = 1; //as long as it's not paused, force it to be active so that if the user renders independent of the parent timeline, it'll be forced to re-render on the next tick. 3721 this._lazy = 0; 3722 } 3723 this.ratio = ratio = (yoyoEase || this._ease)(time / dur); 3724 if (this._from) this.ratio = ratio = 1 - ratio; 3725 if (!prevTime && tTime && !suppressEvents && !prevIteration) { 3726 _callback(this, "onStart"); 3727 if (this._tTime !== tTime) // in case the onStart triggered a render at a different spot, eject. Like if someone did animation.pause(0.5) or something inside the onStart. 3728 return this; 3729 } 3730 pt = this._pt; 3731 while(pt){ 3732 pt.r(ratio, pt.d); 3733 pt = pt._next; 3734 } 3735 timeline && timeline.render(totalTime < 0 ? totalTime : timeline._dur * timeline._ease(time / this._dur), suppressEvents, force) || this._startAt && (this._zTime = totalTime); 3736 if (this._onUpdate && !suppressEvents) { 3737 isNegative && _rewindStartAt(this, totalTime, suppressEvents, force); //note: for performance reasons, we tuck this conditional logic inside less traveled areas (most tweens don't have an onUpdate). We'd just have it at the end before the onComplete, but the values should be updated before any onUpdate is called, so we ALSO put it here and then if it's not called, we do so later near the onComplete. 3738 _callback(this, "onUpdate"); 3739 } 3740 this._repeat && iteration !== prevIteration && this.vars.onRepeat && !suppressEvents && this.parent && _callback(this, "onRepeat"); 3741 if ((tTime === this._tDur || !tTime) && this._tTime === tTime) { 3742 isNegative && !this._onUpdate && _rewindStartAt(this, totalTime, true, true); 3743 (totalTime || !dur) && (tTime === this._tDur && this._ts > 0 || !tTime && this._ts < 0) && _removeFromParent(this, 1); // don't remove if we're rendering at exactly a time of 0, as there could be autoRevert values that should get set on the next tick (if the playhead goes backward beyond the startTime, negative totalTime). Don't remove if the timeline is reversed and the playhead isn't at 0, otherwise tl.progress(1).reverse() won't work. Only remove if the playhead is at the end and timeScale is positive, or if the playhead is at 0 and the timeScale is negative. 3744 if (!suppressEvents && !(isNegative && !prevTime) && (tTime || prevTime || isYoyo)) { 3745 // if prevTime and tTime are zero, we shouldn't fire the onReverseComplete. This could happen if you gsap.to(... {paused:true}).play(); 3746 _callback(this, tTime === tDur ? "onComplete" : "onReverseComplete", true); 3747 this._prom && !(tTime < tDur && this.timeScale() > 0) && this._prom(); 3748 } 3749 } 3750 } 3751 return this; 3752 }; 3753 _proto3.targets = function targets() { 3754 return this._targets; 3755 };
vendor: 8,816 bytes, lines 3756-3904
3756 _proto3.invalidate = function invalidate(soft) { 3757 // "soft" gives us a way to clear out everything EXCEPT the recorded pre-"from" portion of from() tweens. Otherwise, for example, if you tween.progress(1).render(0, true true).invalidate(), the "from" values would persist and then on the next render, the from() tweens would initialize and the current value would match the "from" values, thus animate from the same value to the same value (no animation). We tap into this in ScrollTrigger's refresh() where we must push a tween to completion and then back again but honor its init state in case the tween is dependent on another tween further up on the page. 3758 (!soft || !this.vars.runBackwards) && (this._startAt = 0); 3759 this._pt = this._op = this._onUpdate = this._lazy = this.ratio = 0; 3760 this._ptLookup = []; 3761 this.timeline && this.timeline.invalidate(soft); 3762 return _Animation2.prototype.invalidate.call(this, soft); 3763 }; 3764 _proto3.resetTo = function resetTo(property, value, start, startIsRelative, skipRecursion) { 3765 _tickerActive || _ticker.wake(); 3766 this._ts || this.play(); 3767 var time = Math.min(this._dur, (this._dp._time - this._start) * this._ts), ratio; 3768 this._initted || _initTween(this, time); 3769 ratio = this._ease(time / this._dur); // don't just get tween.ratio because it may not have rendered yet. 3770 // possible future addition to allow an object with multiple values to update, like tween.resetTo({x: 100, y: 200}); At this point, it doesn't seem worth the added kb given the fact that most users will likely opt for the convenient gsap.quickTo() way of interacting with this method. 3771 // if (_isObject(property)) { // performance optimization 3772 // for (p in property) { 3773 // if (_updatePropTweens(this, p, property[p], value ? value[p] : null, start, ratio, time)) { 3774 // return this.resetTo(property, value, start, startIsRelative); // if a PropTween wasn't found for the property, it'll get forced with a re-initialization so we need to jump out and start over again. 3775 // } 3776 // } 3777 // } else { 3778 if (_updatePropTweens(this, property, value, start, startIsRelative, ratio, time, skipRecursion)) return this.resetTo(property, value, start, startIsRelative, 1); // if a PropTween wasn't found for the property, it'll get forced with a re-initialization so we need to jump out and start over again. 3779 //} 3780 _alignPlayhead(this, 0); 3781 this.parent || _addLinkedListItem(this._dp, this, "_first", "_last", this._dp._sort ? "_start" : 0); 3782 return this.render(0); 3783 }; 3784 _proto3.kill = function kill(targets, vars) { 3785 if (vars === void 0) vars = "all"; 3786 if (!targets && (!vars || vars === "all")) { 3787 this._lazy = this._pt = 0; 3788 this.parent ? _interrupt(this) : this.scrollTrigger && this.scrollTrigger.kill(!!_reverting); 3789 return this; 3790 } 3791 if (this.timeline) { 3792 var tDur = this.timeline.totalDuration(); 3793 this.timeline.killTweensOf(targets, vars, _overwritingTween && _overwritingTween.vars.overwrite !== true)._first || _interrupt(this); // if nothing is left tweening, interrupt. 3794 this.parent && tDur !== this.timeline.totalDuration() && _setDuration(this, this._dur * this.timeline._tDur / tDur, 0, 1); // if a nested tween is killed that changes the duration, it should affect this tween's duration. We must use the ratio, though, because sometimes the internal timeline is stretched like for keyframes where they don't all add up to whatever the parent tween's duration was set to. 3795 return this; 3796 } 3797 var parsedTargets = this._targets, killingTargets = targets ? toArray(targets) : parsedTargets, propTweenLookup = this._ptLookup, firstPT = this._pt, overwrittenProps, curLookup, curOverwriteProps, props, p, pt, i; 3798 if ((!vars || vars === "all") && _arraysMatch(parsedTargets, killingTargets)) { 3799 vars === "all" && (this._pt = 0); 3800 return _interrupt(this); 3801 } 3802 overwrittenProps = this._op = this._op || []; 3803 if (vars !== "all") { 3804 //so people can pass in a comma-delimited list of property names 3805 if (_isString(vars)) { 3806 p = {}; 3807 _forEachName(vars, function(name) { 3808 return p[name] = 1; 3809 }); 3810 vars = p; 3811 } 3812 vars = _addAliasesToVars(parsedTargets, vars); 3813 } 3814 i = parsedTargets.length; 3815 while(i--)if (~killingTargets.indexOf(parsedTargets[i])) { 3816 curLookup = propTweenLookup[i]; 3817 if (vars === "all") { 3818 overwrittenProps[i] = vars; 3819 props = curLookup; 3820 curOverwriteProps = {}; 3821 } else { 3822 curOverwriteProps = overwrittenProps[i] = overwrittenProps[i] || {}; 3823 props = vars; 3824 } 3825 for(p in props){ 3826 pt = curLookup && curLookup[p]; 3827 if (pt) { 3828 if (!("kill" in pt.d) || pt.d.kill(p) === true) _removeLinkedListItem(this, pt, "_pt"); 3829 delete curLookup[p]; 3830 } 3831 if (curOverwriteProps !== "all") curOverwriteProps[p] = 1; 3832 } 3833 } 3834 this._initted && !this._pt && firstPT && _interrupt(this); //if all tweening properties are killed, kill the tween. Without this line, if there's a tween with multiple targets and then you killTweensOf() each target individually, the tween would technically still remain active and fire its onComplete even though there aren't any more properties tweening. 3835 return this; 3836 }; 3837 Tween.to = function to(targets, vars) { 3838 return new Tween(targets, vars, arguments[2]); 3839 }; 3840 Tween.from = function from(targets, vars) { 3841 return _createTweenType(1, arguments); 3842 }; 3843 Tween.delayedCall = function delayedCall(delay, callback, params, scope) { 3844 return new Tween(callback, 0, { 3845 immediateRender: false, 3846 lazy: false, 3847 overwrite: false, 3848 delay: delay, 3849 onComplete: callback, 3850 onReverseComplete: callback, 3851 onCompleteParams: params, 3852 onReverseCompleteParams: params, 3853 callbackScope: scope 3854 }); // we must use onReverseComplete too for things like timeline.add(() => {...}) which should be triggered in BOTH directions (forward and reverse) 3855 }; 3856 Tween.fromTo = function fromTo(targets, fromVars, toVars) { 3857 return _createTweenType(2, arguments); 3858 }; 3859 Tween.set = function set(targets, vars) { 3860 vars.duration = 0; 3861 vars.repeatDelay || (vars.repeat = 0); 3862 return new Tween(targets, vars); 3863 }; 3864 Tween.killTweensOf = function killTweensOf(targets, props, onlyActive) { 3865 return _globalTimeline.killTweensOf(targets, props, onlyActive); 3866 }; 3867 return Tween; 3868}(Animation); 3869_setDefaults(Tween.prototype, { 3870 _targets: [], 3871 _lazy: 0, 3872 _startAt: 0, 3873 _op: 0, 3874 _onInit: 0 3875}); //add the pertinent timeline methods to Tween instances so that users can chain conveniently and create a timeline automatically. (removed due to concerns that it'd ultimately add to more confusion especially for beginners) 3876// _forEachName("to,from,fromTo,set,call,add,addLabel,addPause", name => { 3877// Tween.prototype[name] = function() { 3878// let tl = new Timeline(); 3879// return _addToTimeline(tl, this)[name].apply(tl, toArray(arguments)); 3880// } 3881// }); 3882//for backward compatibility. Leverage the timeline calls. 3883_forEachName("staggerTo,staggerFrom,staggerFromTo", function(name) { 3884 Tween[name] = function() { 3885 var tl = new Timeline(), params = _slice.call(arguments, 0); 3886 params.splice(name === "staggerFromTo" ? 5 : 4, 0, 0); 3887 return tl[name].apply(tl, params); 3888 }; 3889}); 3890/* 3891 * -------------------------------------------------------------------------------------- 3892 * PROPTWEEN 3893 * -------------------------------------------------------------------------------------- 3894 */ var _setterPlain = function _setterPlain(target, property, value) { 3895 return target[property] = value; 3896}, _setterFunc = function _setterFunc(target, property, value) { 3897 return target[property](value); 3898}, _setterFuncWithParam = function _setterFuncWithParam(target, property, value, data) { 3899 return target[property](data.fp, value); 3900}, _setterAttribute = function _setterAttribute(target, property, value) { 3901 return target.setAttribute(property, value); 3902}, _getSetter = function _getSetter(target, property) { 3903 return _isFunction(target[property]) ? _setterFunc : _isUndefined(target[property]) && target.setAttribute ? _setterAttribute : _setterPlain; 3904}
3904, _renderPlain = function _renderPlain(ratio, data) { 3905 return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 1000000) / 1000000, data); 3906}, _renderBoolean = function _renderBoolean(ratio, data) { 3907 return data.set(data.t, data.p, !!(data.s + data.c * ratio), data); 3908}, _renderComplexString = function _renderComplexString(ratio, data) { 3909 var pt = data._pt, s = ""; 3910 if (!ratio && data.b) //b = beginning string 3911 s = data.b; 3912 else if (ratio === 1 && data.e) //e = ending string 3913 s = data.e; 3914 else { 3915 while(pt){ 3916 s = pt.p + (pt.m ? pt.m(pt.s + pt.c * ratio) : Math.round((pt.s + pt.c * ratio) * 10000) / 10000) + s; //we use the "p" property for the text inbetween (like a suffix). And in the context of a complex string, the modifier (m) is typically just Math.round(), like for RGB colors. 3917 pt = pt._next; 3918 } 3919 s += data.c; //we use the "c" of the PropTween to store the final chunk of non-numeric text. 3920 } 3921 data.set(data.t, data.p, s, data); 3922}, _renderPropTweens = function _renderPropTweens(ratio, data) { 3923 var pt = data._pt; 3924 while(pt){ 3925 pt.r(ratio, pt.d); 3926 pt = pt._next; 3927 } 3928}, _addPluginModifier = function _addPluginModifier(modifier, tween, target, property) { 3929 var pt = this._pt, next; 3930 while(pt){ 3931 next = pt._next; 3932 pt.p === property && pt.modifier(modifier, tween, target); 3933 pt = next; 3934 } 3935}, _killPropTweensOf = function _killPropTweensOf(property) { 3936 var pt = this._pt, hasNonDependentRemaining, next; 3937 while(pt){ 3938 next = pt._next; 3939 if (pt.p === property && !pt.op || pt.op === property) _removeLinkedListItem(this, pt, "_pt"); 3940 else if (!pt.dep) hasNonDependentRemaining = 1; 3941 pt = next; 3942 } 3943 return !hasNonDependentRemaining; 3944}, _setterWithModifier = function _setterWithModifier(target, property, value, data) { 3945 data.mSet(target, property, data.m.call(data.tween, value, data.mt), data); 3946}, _sortPropTweensByPriority = function _sortPropTweensByPriority(parent) { 3947 var pt = parent._pt, next, pt2, first, last; //sorts the PropTween linked list in order of priority because some plugins need to do their work after ALL of the PropTweens were created (like RoundPropsPlugin and ModifiersPlugin) 3948 while(pt){ 3949 next = pt._next; 3950 pt2 = first; 3951 while(pt2 && pt2.pr > pt.pr)pt2 = pt2._next; 3952 if (pt._prev = pt2 ? pt2._prev : last) pt._prev._next = pt; 3953 else first = pt; 3954 if (pt._next = pt2) pt2._prev = pt; 3955 else last = pt; 3956 pt = next; 3957 } 3958 parent._pt = first; 3959}; //PropTween key: t = target, p = prop, r = renderer, d = data, s = start, c = change, op = overwriteProperty (ONLY populated when it's different than p), pr = priority, _next/_prev for the linked list siblings, set = setter, m = modifier, mSet = modifierSetter (the original setter, before a modifier was added) 3960var PropTween = /*#__PURE__*/ function() { 3961 function PropTween(next, target, prop, start, change, renderer, data, setter, priority) { 3962 this.t = target; 3963 this.s = start; 3964 this.c = change; 3965 this.p = prop; 3966 this.r = renderer || _renderPlain; 3967 this.d = data || this; 3968 this.set = setter || _setterPlain; 3969 this.pr = priority || 0; 3970 this._next = next; 3971 if (next) next._prev = this; 3972 } 3973 var _proto4 = PropTween.prototype; 3974 _proto4.modifier = function modifier(func, tween, target) { 3975 this.mSet = this.mSet || this.set; //in case it was already set (a PropTween can only have one modifier) 3976 this.set = _setterWithModifier; 3977 this.m = func; 3978 this.mt = target; //modifier target 3979 this.tween = tween; 3980 }; 3981 return PropTween; 3982}(); //Initialization tasks 3983_forEachName(_callbackNames + "parent,duration,ease,delay,overwrite,runBackwards,startAt,yoyo,immediateRender,repeat,repeatDelay,data,paused,reversed,lazy,callbackScope,stringFilter,id,yoyoEase,stagger,inherit,repeatRefresh,keyframes,autoRevert,scrollTrigger", function(name) { 3984 return _reservedProps[name] = 1; 3985}); 3986_globals.TweenMax = _globals.TweenLite = Tween; 3987_globals.TimelineLite = _globals.TimelineMax = Timeline; 3988_globalTimeline = new Timeline({ 3989 sortChildren: false, 3990 defaults: _defaults, 3991 autoRemoveChildren: true, 3992 id: "root", 3993 smoothChildTiming: true 3994}); 3995_config.stringFilter = _colorStringFilter; 3996var _media = [], _listeners = {}, _emptyArray = [], _lastMediaTime = 0, _contextID = 0, _dispatch = function _dispatch(type) { 3997 return (_listeners[type] || _emptyArray).map(function(f) { 3998 return f(); 3999 }); 4000}, _onMediaChange = function _onMediaChange() { 4001 var time = Date.now(), matches = []; 4002 if (time - _lastMediaTime > 2) { 4003 _dispatch("matchMediaInit");
vendor: 4,658 bytes, lines 4004-4104
4004 _media.forEach(function(c) { 4005 var queries = c.queries, conditions = c.conditions, match, p, anyMatch, toggled; 4006 for(p in queries){ 4007 match = _win.matchMedia(queries[p]).matches; // Firefox doesn't update the "matches" property of the MediaQueryList object correctly - it only does so as it calls its change handler - so we must re-create a media query here to ensure it's accurate. 4008 match && (anyMatch = 1); 4009 if (match !== conditions[p]) { 4010 conditions[p] = match; 4011 toggled = 1; 4012 } 4013 } 4014 if (toggled) { 4015 c.revert(); 4016 anyMatch && matches.push(c); 4017 } 4018 }); 4019 _dispatch("matchMediaRevert"); 4020 matches.forEach(function(c) { 4021 return c.onMatch(c, function(func) { 4022 return c.add(null, func); 4023 }); 4024 }); 4025 _lastMediaTime = time; 4026 _dispatch("matchMedia"); 4027 } 4028}; 4029var Context = /*#__PURE__*/ function() { 4030 function Context(func, scope) { 4031 this.selector = scope && selector(scope); 4032 this.data = []; 4033 this._r = []; // returned/cleanup functions 4034 this.isReverted = false; 4035 this.id = _contextID++; // to work around issues that frameworks like Vue cause by making things into Proxies which make it impossible to do something like _media.indexOf(this) because "this" would no longer refer to the Context instance itself - it'd refer to a Proxy! We needed a way to identify the context uniquely 4036 func && this.add(func); 4037 } 4038 var _proto5 = Context.prototype; 4039 _proto5.add = function add(name, func, scope) { 4040 // possible future addition if we need the ability to add() an animation to a context and for whatever reason cannot create that animation inside of a context.add(() => {...}) function. 4041 // if (name && _isFunction(name.revert)) { 4042 // this.data.push(name); 4043 // return (name._ctx = this); 4044 // } 4045 if (_isFunction(name)) { 4046 scope = func; 4047 func = name; 4048 name = _isFunction; 4049 } 4050 var self = this, f = function f() { 4051 var prev = _context, prevSelector = self.selector, result; 4052 prev && prev !== self && prev.data.push(self); 4053 scope && (self.selector = selector(scope)); 4054 _context = self; 4055 result = func.apply(self, arguments); 4056 _isFunction(result) && self._r.push(result); 4057 _context = prev; 4058 self.selector = prevSelector; 4059 self.isReverted = false; 4060 return result; 4061 }; 4062 self.last = f; 4063 return name === _isFunction ? f(self, function(func) { 4064 return self.add(null, func); 4065 }) : name ? self[name] = f : f; 4066 }; 4067 _proto5.ignore = function ignore(func) { 4068 var prev = _context; 4069 _context = null; 4070 func(this); 4071 _context = prev; 4072 }; 4073 _proto5.getTweens = function getTweens() { 4074 var a = []; 4075 this.data.forEach(function(e) { 4076 return e instanceof Context ? a.push.apply(a, e.getTweens()) : e instanceof Tween && !(e.parent && e.parent.data === "nested") && a.push(e); 4077 }); 4078 return a; 4079 }; 4080 _proto5.clear = function clear() { 4081 this._r.length = this.data.length = 0; 4082 }; 4083 _proto5.kill = function kill(revert, matchMedia) { 4084 var _this4 = this; 4085 if (revert) (function() { 4086 var tweens = _this4.getTweens(), i = _this4.data.length, t; 4087 while(i--){ 4088 // Flip plugin tweens are very different in that they should actually be pushed to their end. The plugin replaces the timeline's .revert() method to do exactly that. But we also need to remove any of those nested tweens inside the flip timeline so that they don't get individually reverted. 4089 t = _this4.data[i]; 4090 if (t.data === "isFlip") { 4091 t.revert(); 4092 t.getChildren(true, true, false).forEach(function(tween) { 4093 return tweens.splice(tweens.indexOf(tween), 1); 4094 }); 4095 } 4096 } // save as an object so that we can cache the globalTime for each tween to optimize performance during the sort 4097 tweens.map(function(t) { 4098 return { 4099 g: t._dur || t._delay || t._sat && !t._sat.vars.immediateRender ? t.globalTime(0) : -Infinity, 4100 t: t 4101 }; 4102 }).sort(function(a, b) { 4103 return b.g - a.g || -Infinity; 4104 }
4104).forEach(function(o) { 4105 return o.t.revert(revert); 4106 }); // note: all of the _startAt tweens should be reverted in reverse order that they were created, and they'll all have the same globalTime (-1) so the " || -1" in the sort keeps the order properly. 4107 i = _this4.data.length; 4108 while(i--){ 4109 // make sure we loop backwards so that, for example, SplitTexts that were created later on the same element get reverted first 4110 t = _this4.data[i]; 4111 if (t instanceof Timeline) { 4112 if (t.data !== "nested") { 4113 t.scrollTrigger && t.scrollTrigger.revert(); 4114 t.kill(); // don't revert() the timeline because that's duplicating efforts since we already reverted all the tweens 4115 } 4116 } else !(t instanceof Tween) && t.revert && t.revert(revert); 4117 } 4118 _this4._r.forEach(function(f) { 4119 return f(revert, _this4); 4120 }); 4121 _this4.isReverted = true; 4122 })(); 4123 else this.data.forEach(function(e) { 4124 return e.kill && e.kill(); 4125 }); 4126 this.clear(); 4127 if (matchMedia) { 4128 var i = _media.length; 4129 while(i--)// previously, we checked _media.indexOf(this), but some frameworks like Vue enforce Proxy objects that make it impossible to get the proper result that way, so we must use a unique ID number instead. 4130 _media[i].id === this.id && _media.splice(i, 1); 4131 } 4132 } // killWithCleanup() { 4133 ; 4134 _proto5.revert = function revert(config) { 4135 this.kill(config || {}); 4136 }; 4137 return Context; 4138}(); 4139var MatchMedia = /*#__PURE__*/ function() { 4140 function MatchMedia(scope) { 4141 this.contexts = []; 4142 this.scope = scope; 4143 _context && _context.data.push(this); 4144 } 4145 var _proto6 = MatchMedia.prototype; 4146 _proto6.add = function add(conditions, func, scope) { 4147 _isObject(conditions) || (conditions = { 4148 matches: conditions 4149 }); 4150 var context = new Context(0, scope || this.scope), cond = context.conditions = {}, mq, p, active; 4151 _context && !context.selector && (context.selector = _context.selector); // in case a context is created inside a context. Like a gsap.matchMedia() that's inside a scoped gsap.context() 4152 this.contexts.push(context); 4153 func = context.add("onMatch", func); 4154 context.queries = conditions; 4155 for(p in conditions)if (p === "all") active = 1; 4156 else { 4157 mq = _win.matchMedia(conditions[p]); 4158 if (mq) { 4159 _media.indexOf(context) < 0 && _media.push(context); 4160 (cond[p] = mq.matches) && (active = 1); 4161 mq.addListener ? mq.addListener(_onMediaChange) : mq.addEventListener("change", _onMediaChange); 4162 } 4163 } 4164 active && func(context, function(f) { 4165 return context.add(null, f); 4166 }); 4167 return this; 4168 } // refresh() { 4169 ; 4170 _proto6.revert = function revert(config) { 4171 this.kill(config || {}); 4172 }; 4173 _proto6.kill = function kill(revert) {
vendor: 7,994 bytes, lines 4174-4364
4174 this.contexts.forEach(function(c) { 4175 return c.kill(revert, true); 4176 }); 4177 }; 4178 return MatchMedia; 4179}(); 4180/* 4181 * -------------------------------------------------------------------------------------- 4182 * GSAP 4183 * -------------------------------------------------------------------------------------- 4184 */ var _gsap = { 4185 registerPlugin: function registerPlugin() { 4186 for(var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++)args[_key2] = arguments[_key2]; 4187 args.forEach(function(config) { 4188 return _createPlugin(config); 4189 }); 4190 }, 4191 timeline: function timeline(vars) { 4192 return new Timeline(vars); 4193 }, 4194 getTweensOf: function getTweensOf(targets, onlyActive) { 4195 return _globalTimeline.getTweensOf(targets, onlyActive); 4196 }, 4197 getProperty: function getProperty(target, property, unit, uncache) { 4198 _isString(target) && (target = toArray(target)[0]); //in case selector text or an array is passed in 4199 var getter = _getCache(target || {}).get, format = unit ? _passThrough : _numericIfPossible; 4200 unit === "native" && (unit = ""); 4201 return !target ? target : !property ? function(property, unit, uncache) { 4202 return format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache)); 4203 } : format((_plugins[property] && _plugins[property].get || getter)(target, property, unit, uncache)); 4204 }, 4205 quickSetter: function quickSetter(target, property, unit) { 4206 target = toArray(target); 4207 if (target.length > 1) { 4208 var setters = target.map(function(t) { 4209 return gsap.quickSetter(t, property, unit); 4210 }), l = setters.length; 4211 return function(value) { 4212 var i = l; 4213 while(i--)setters[i](value); 4214 }; 4215 } 4216 target = target[0] || {}; 4217 var Plugin = _plugins[property], cache = _getCache(target), p = cache.harness && (cache.harness.aliases || {})[property] || property, // in case it's an alias, like "rotate" for "rotation". 4218 setter = Plugin ? function(value) { 4219 var p = new Plugin(); 4220 _quickTween._pt = 0; 4221 p.init(target, unit ? value + unit : value, _quickTween, 0, [ 4222 target 4223 ]); 4224 p.render(1, p); 4225 _quickTween._pt && _renderPropTweens(1, _quickTween); 4226 } : cache.set(target, p); 4227 return Plugin ? setter : function(value) { 4228 return setter(target, p, unit ? value + unit : value, cache, 1); 4229 }; 4230 }, 4231 quickTo: function quickTo(target, property, vars) { 4232 var _setDefaults2; 4233 var tween = gsap.to(target, _setDefaults((_setDefaults2 = {}, _setDefaults2[property] = "+=0.1", _setDefaults2.paused = true, _setDefaults2.stagger = 0, _setDefaults2), vars || {})), func = function func(value, start, startIsRelative) { 4234 return tween.resetTo(property, value, start, startIsRelative); 4235 }; 4236 func.tween = tween; 4237 return func; 4238 }, 4239 isTweening: function isTweening(targets) { 4240 return _globalTimeline.getTweensOf(targets, true).length > 0; 4241 }, 4242 defaults: function defaults(value) { 4243 value && value.ease && (value.ease = _parseEase(value.ease, _defaults.ease)); 4244 return _mergeDeep(_defaults, value || {}); 4245 }, 4246 config: function config(value) { 4247 return _mergeDeep(_config, value || {}); 4248 }, 4249 registerEffect: function registerEffect(_ref3) { 4250 var name = _ref3.name, effect = _ref3.effect, plugins = _ref3.plugins, defaults = _ref3.defaults, extendTimeline = _ref3.extendTimeline; 4251 (plugins || "").split(",").forEach(function(pluginName) { 4252 return pluginName && !_plugins[pluginName] && !_globals[pluginName] && _warn(name + " effect requires " + pluginName + " plugin."); 4253 }); 4254 _effects[name] = function(targets, vars, tl) { 4255 return effect(toArray(targets), _setDefaults(vars || {}, defaults), tl); 4256 }; 4257 if (extendTimeline) Timeline.prototype[name] = function(targets, vars, position) { 4258 return this.add(_effects[name](targets, _isObject(vars) ? vars : (position = vars) && {}, this), position); 4259 }; 4260 }, 4261 registerEase: function registerEase(name, ease) { 4262 _easeMap[name] = _parseEase(ease); 4263 }, 4264 parseEase: function parseEase(ease, defaultEase) { 4265 return arguments.length ? _parseEase(ease, defaultEase) : _easeMap; 4266 }, 4267 getById: function getById(id) { 4268 return _globalTimeline.getById(id); 4269 }, 4270 exportRoot: function exportRoot(vars, includeDelayedCalls) { 4271 if (vars === void 0) vars = {}; 4272 var tl = new Timeline(vars), child, next; 4273 tl.smoothChildTiming = _isNotFalse(vars.smoothChildTiming); 4274 _globalTimeline.remove(tl); 4275 tl._dp = 0; //otherwise it'll get re-activated when adding children and be re-introduced into _globalTimeline's linked list (then added to itself). 4276 tl._time = tl._tTime = _globalTimeline._time; 4277 child = _globalTimeline._first; 4278 while(child){ 4279 next = child._next; 4280 if (includeDelayedCalls || !(!child._dur && child instanceof Tween && child.vars.onComplete === child._targets[0])) _addToTimeline(tl, child, child._start - child._delay); 4281 child = next; 4282 } 4283 _addToTimeline(_globalTimeline, tl, 0); 4284 return tl; 4285 }, 4286 context: function context(func, scope) { 4287 return func ? new Context(func, scope) : _context; 4288 }, 4289 matchMedia: function matchMedia(scope) { 4290 return new MatchMedia(scope); 4291 }, 4292 matchMediaRefresh: function matchMediaRefresh() { 4293 return _media.forEach(function(c) { 4294 var cond = c.conditions, found, p; 4295 for(p in cond)if (cond[p]) { 4296 cond[p] = false; 4297 found = 1; 4298 } 4299 found && c.revert(); 4300 }) || _onMediaChange(); 4301 }, 4302 addEventListener: function addEventListener(type, callback) { 4303 var a = _listeners[type] || (_listeners[type] = []); 4304 ~a.indexOf(callback) || a.push(callback); 4305 }, 4306 removeEventListener: function removeEventListener(type, callback) { 4307 var a = _listeners[type], i = a && a.indexOf(callback); 4308 i >= 0 && a.splice(i, 1); 4309 }, 4310 utils: { 4311 wrap: wrap, 4312 wrapYoyo: wrapYoyo, 4313 distribute: distribute, 4314 random: random, 4315 snap: snap, 4316 normalize: normalize, 4317 getUnit: getUnit, 4318 clamp: clamp, 4319 splitColor: splitColor, 4320 toArray: toArray, 4321 selector: selector, 4322 mapRange: mapRange, 4323 pipe: pipe, 4324 unitize: unitize, 4325 interpolate: interpolate, 4326 shuffle: shuffle 4327 }, 4328 install: _install, 4329 effects: _effects, 4330 ticker: _ticker, 4331 updateRoot: Timeline.updateRoot, 4332 plugins: _plugins, 4333 globalTimeline: _globalTimeline, 4334 core: { 4335 PropTween: PropTween, 4336 globals: _addGlobal, 4337 Tween: Tween, 4338 Timeline: Timeline, 4339 Animation: Animation, 4340 getCache: _getCache, 4341 _removeLinkedListItem: _removeLinkedListItem, 4342 reverting: function reverting() { 4343 return _reverting; 4344 }, 4345 context: function context(toAdd) { 4346 if (toAdd && _context) { 4347 _context.data.push(toAdd); 4348 toAdd._ctx = _context; 4349 } 4350 return _context; 4351 }, 4352 suppressOverwrites: function suppressOverwrites(value) { 4353 return _suppressOverwrites = value; 4354 } 4355 } 4356}; 4357_forEachName("to,from,fromTo,delayedCall,set,killTweensOf", function(name) { 4358 return _gsap[name] = Tween[name]; 4359}); 4360_ticker.add(Timeline.updateRoot); 4361_quickTween = _gsap.to({}, { 4362 duration: 0 4363}); // ---- EXTRA PLUGINS -------------------------------------------------------- 4364var _getPluginPropTween = function _getPluginPropTween(plugin, prop
4364) { 4365 var pt = plugin._pt; 4366 while(pt && pt.p !== prop && pt.op !== prop && pt.fp !== prop)pt = pt._next; 4367 return pt; 4368}, _addModifiers = function _addModifiers(tween, modifiers) { 4369 var targets = tween._targets, p, i, pt; 4370 for(p in modifiers){ 4371 i = targets.length; 4372 while(i--){ 4373 pt = tween._ptLookup[i][p]; 4374 if (pt && (pt = pt.d)) { 4375 if (pt._pt) // is a plugin 4376 pt = _getPluginPropTween(pt, p); 4377 pt && pt.modifier && pt.modifier(modifiers[p], tween, targets[i], p); 4378 } 4379 } 4380 } 4381}, _buildModifierPlugin = function _buildModifierPlugin(name, modifier) { 4382 return { 4383 name: name, 4384 headless: 1, 4385 rawVars: 1, 4386 //don't pre-process function-based values or "random()" strings. 4387 init: function init(target, vars, tween) { 4388 tween._onInit = function(tween) { 4389 var temp, p; 4390 if (_isString(vars)) { 4391 temp = {}; 4392 _forEachName(vars, function(name) { 4393 return temp[name] = 1; 4394 }); //if the user passes in a comma-delimited list of property names to roundProps, like "x,y", we round to whole numbers. 4395 vars = temp; 4396 } 4397 if (modifier) { 4398 temp = {}; 4399 for(p in vars)temp[p] = modifier(vars[p]); 4400 vars = temp; 4401 } 4402 _addModifiers(tween, vars); 4403 }; 4404 } 4405 }; 4406}; //register core plugins 4407var gsap = _gsap.registerPlugin({ 4408 name: "attr", 4409 init: function init(target, vars, tween, index, targets) { 4410 var p, pt, v; 4411 this.tween = tween; 4412 for(p in vars){ 4413 v = target.getAttribute(p) || ""; 4414 pt = this.add(target, "setAttribute", (v || 0) + "", vars[p], index, targets, 0, 0, p); 4415 pt.op = p; 4416 pt.b = v; // record the beginning value so we can revert() 4417 this._props.push(p); 4418 } 4419 }, 4420 render: function render(ratio, data) { 4421 var pt = data._pt; 4422 while(pt){ 4423 _reverting ? pt.set(pt.t, pt.p, pt.b, pt) : pt.r(ratio, pt.d); // if reverting, go back to the original (pt.b) 4424 pt = pt._next; 4425 } 4426 } 4427}, { 4428 name: "endArray", 4429 headless: 1, 4430 init: function init(target, value) { 4431 var i = value.length; 4432 while(i--)this.add(target, i, target[i] || 0, value[i], 0, 0, 0, 0, 0, 1); 4433 } 4434}, _buildModifierPlugin("roundProps", _roundModifier), _buildModifierPlugin("modifiers"), _buildModifierPlugin("snap", snap)) || _gsap; //to prevent the core plugins from being dropped via aggressive tree shaking, we must include them in the variable declaration in this way. 4435Tween.version = Timeline.version = gsap.version = "3.13.0"; 4436_coreReady = 1; 4437_windowExists() && _wake(); 4438var Power0 = _easeMap.Power0, Power1 = _easeMap.Power1, Power2 = _easeMap.Power2, Power3 = _easeMap.Power3, Power4 = _easeMap.Power4, Linear = _easeMap.Linear, Quad = _easeMap.Quad, Cubic = _easeMap.Cubic, Quart = _easeMap.Quart, Quint = _easeMap.Quint, Strong = _easeMap.Strong, Elastic = _easeMap.Elastic, Back = _easeMap.Back, SteppedEase = _easeMap.SteppedEase, Bounce = _easeMap.Bounce, Sine = _easeMap.Sine, Expo = _easeMap.Expo, Circ = _easeMap.Circ; 4439 4440},{"@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"ds5Ep":[function(require,module,exports,__globalThis) { 4441/*! 4442 * CSSPlugin 3.13.0 4443 * https://gsap.com 4444 * 4445 * Copyright 2008-2025, GreenSock. All rights reserved. 4446 * Subject to the terms at https://gsap.com/standard-license 4447 * @author: Jack Doyle, [email protected] 4448*/ /* eslint-disable */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 4449parcelHelpers.defineInteropFlag(exports); 4450parcelHelpers.export(exports, "CSSPlugin", ()=>CSSPlugin); 4451parcelHelpers.export(exports, "default", ()=>CSSPlugin); 4452parcelHelpers.export(exports, "_getBBox", ()=>_getBBox); 4453parcelHelpers.export(exports, "_createElement", ()=>_createElement); 4454parcelHelpers.export(exports, "checkPrefix", ()=>_checkPropPrefix); 4455var _gsapCoreJs = require("./gsap-core.js"); 4456var _win, _doc, _docElement, _pluginInitted, _tempDiv, _tempDivStyler, _recentSetterPlugin, _reverting, _windowExists = function _windowExists() { 4457 return typeof window !== "undefined"; 4458}, _transformProps = {}, _RAD2DEG = 180 / Math.PI, _DEG2RAD = Math.PI / 180, _atan2 = Math.atan2, _bigNum = 1e8, _capsExp = /([A-Z])/g, _horizontalExp = /(left|right|width|margin|padding|x)/i, _complexExp = /[\
vendor: 15,334 bytes, lines 4458-4682
4458s,\(]\S/, _propertyAliases = { 4459 autoAlpha: "opacity,visibility", 4460 scale: "scaleX,scaleY", 4461 alpha: "opacity" 4462}, _renderCSSProp = function _renderCSSProp(ratio, data) { 4463 return data.set(data.t, data.p, Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data); 4464}, _renderPropWithEnd = function _renderPropWithEnd(ratio, data) { 4465 return data.set(data.t, data.p, ratio === 1 ? data.e : Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u, data); 4466}, _renderCSSPropWithBeginning = function _renderCSSPropWithBeginning(ratio, data) { 4467 return data.set(data.t, data.p, ratio ? Math.round((data.s + data.c * ratio) * 10000) / 10000 + data.u : data.b, data); 4468}, //if units change, we need a way to render the original unit/value when the tween goes all the way back to the beginning (ratio:0) 4469_renderRoundedCSSProp = function _renderRoundedCSSProp(ratio, data) { 4470 var value = data.s + data.c * ratio; 4471 data.set(data.t, data.p, ~~(value + (value < 0 ? -0.5 : .5)) + data.u, data); 4472}, _renderNonTweeningValue = function _renderNonTweeningValue(ratio, data) { 4473 return data.set(data.t, data.p, ratio ? data.e : data.b, data); 4474}, _renderNonTweeningValueOnlyAtEnd = function _renderNonTweeningValueOnlyAtEnd(ratio, data) { 4475 return data.set(data.t, data.p, ratio !== 1 ? data.b : data.e, data); 4476}, _setterCSSStyle = function _setterCSSStyle(target, property, value) { 4477 return target.style[property] = value; 4478}, _setterCSSProp = function _setterCSSProp(target, property, value) { 4479 return target.style.setProperty(property, value); 4480}, _setterTransform = function _setterTransform(target, property, value) { 4481 return target._gsap[property] = value; 4482}, _setterScale = function _setterScale(target, property, value) { 4483 return target._gsap.scaleX = target._gsap.scaleY = value; 4484}, _setterScaleWithRender = function _setterScaleWithRender(target, property, value, data, ratio) { 4485 var cache = target._gsap; 4486 cache.scaleX = cache.scaleY = value; 4487 cache.renderTransform(ratio, cache); 4488}, _setterTransformWithRender = function _setterTransformWithRender(target, property, value, data, ratio) { 4489 var cache = target._gsap; 4490 cache[property] = value; 4491 cache.renderTransform(ratio, cache); 4492}, _transformProp = "transform", _transformOriginProp = _transformProp + "Origin", _saveStyle = function _saveStyle(property, isNotCSS) { 4493 var _this = this; 4494 var target = this.target, style = target.style, cache = target._gsap; 4495 if (property in _transformProps && style) { 4496 this.tfm = this.tfm || {}; 4497 if (property !== "transform") { 4498 property = _propertyAliases[property] || property; 4499 ~property.indexOf(",") ? property.split(",").forEach(function(a) { 4500 return _this.tfm[a] = _get(target, a); 4501 }) : this.tfm[property] = cache.x ? cache[property] : _get(target, property); // note: scale would map to "scaleX,scaleY", thus we loop and apply them both. 4502 property === _transformOriginProp && (this.tfm.zOrigin = cache.zOrigin); 4503 } else return _propertyAliases.transform.split(",").forEach(function(p) { 4504 return _saveStyle.call(_this, p, isNotCSS); 4505 }); 4506 if (this.props.indexOf(_transformProp) >= 0) return; 4507 if (cache.svg) { 4508 this.svgo = target.getAttribute("data-svg-origin"); 4509 this.props.push(_transformOriginProp, isNotCSS, ""); 4510 } 4511 property = _transformProp; 4512 } 4513 (style || isNotCSS) && this.props.push(property, isNotCSS, style[property]); 4514}, _removeIndependentTransforms = function _removeIndependentTransforms(style) { 4515 if (style.translate) { 4516 style.removeProperty("translate"); 4517 style.removeProperty("scale"); 4518 style.removeProperty("rotate"); 4519 } 4520}, _revertStyle = function _revertStyle() { 4521 var props = this.props, target = this.target, style = target.style, cache = target._gsap, i, p; 4522 for(i = 0; i < props.length; i += 3){ 4523 // stored like this: property, isNotCSS, value 4524 if (!props[i + 1]) props[i + 2] ? style[props[i]] = props[i + 2] : style.removeProperty(props[i].substr(0, 2) === "--" ? props[i] : props[i].replace(_capsExp, "-$1").toLowerCase()); 4525 else if (props[i + 1] === 2) // non-CSS value (function-based) 4526 target[props[i]](props[i + 2]); 4527 else // non-CSS value (not function-based) 4528 target[props[i]] = props[i + 2]; 4529 } 4530 if (this.tfm) { 4531 for(p in this.tfm)cache[p] = this.tfm[p]; 4532 if (cache.svg) { 4533 cache.renderTransform(); 4534 target.setAttribute("data-svg-origin", this.svgo || ""); 4535 } 4536 i = _reverting(); 4537 if ((!i || !i.isStart) && !style[_transformProp]) { 4538 _removeIndependentTransforms(style); 4539 if (cache.zOrigin && style[_transformOriginProp]) { 4540 style[_transformOriginProp] += " " + cache.zOrigin + "px"; // since we're uncaching, we must put the zOrigin back into the transformOrigin so that we can pull it out accurately when we parse again. Otherwise, we'd lose the z portion of the origin since we extract it to protect from Safari bugs. 4541 cache.zOrigin = 0; 4542 cache.renderTransform(); 4543 } 4544 cache.uncache = 1; // if it's a startAt that's being reverted in the _initTween() of the core, we don't need to uncache transforms. This is purely a performance optimization. 4545 } 4546 } 4547}, _getStyleSaver = function _getStyleSaver(target, properties) { 4548 var saver = { 4549 target: target, 4550 props: [], 4551 revert: _revertStyle, 4552 save: _saveStyle 4553 }; 4554 target._gsap || (0, _gsapCoreJs.gsap).core.getCache(target); // just make sure there's a _gsap cache defined because we read from it in _saveStyle() and it's more efficient to just check it here once. 4555 properties && target.style && target.nodeType && properties.split(",").forEach(function(p) { 4556 return saver.save(p); 4557 }); // make sure it's a DOM node too. 4558 return saver; 4559}, _supports3D, _createElement = function _createElement(type, ns) { 4560 var e = _doc.createElementNS ? _doc.createElementNS((ns || "http://www.w3.org/1999/xhtml").replace(/^https/, "http"), type) : _doc.createElement(type); //some servers swap in https for http in the namespace which can break things, making "style" inaccessible. 4561 return e && e.style ? e : _doc.createElement(type); //some environments won't allow access to the element's style when created with a namespace in which case we default to the standard createElement() to work around the issue. Also note that when GSAP is embedded directly inside an SVG file, createElement() won't allow access to the style object in Firefox (see https://gsap.com/forums/topic/20215-problem-using-tweenmax-in-standalone-self-containing-svg-file-err-cannot-set-property-csstext-of-undefined/). 4562}, _getComputedProperty = function _getComputedProperty(target, property, skipPrefixFallback) { 4563 var cs = getComputedStyle(target); 4564 return cs[property] || cs.getPropertyValue(property.replace(_capsExp, "-$1").toLowerCase()) || cs.getPropertyValue(property) || !skipPrefixFallback && _getComputedProperty(target, _checkPropPrefix(property) || property, 1) || ""; //css variables may not need caps swapped out for dashes and lowercase. 4565}, _prefixes = "O,Moz,ms,Ms,Webkit".split(","), _checkPropPrefix = function _checkPropPrefix(property, element, preferPrefix) { 4566 var e = element || _tempDiv, s = e.style, i = 5; 4567 if (property in s && !preferPrefix) return property; 4568 property = property.charAt(0).toUpperCase() + property.substr(1); 4569 while(i-- && !(_prefixes[i] + property in s)); 4570 return i < 0 ? null : (i === 3 ? "ms" : i >= 0 ? _prefixes[i] : "") + property; 4571}, _initCore = function _initCore() { 4572 if (_windowExists() && window.document) { 4573 _win = window; 4574 _doc = _win.document; 4575 _docElement = _doc.documentElement; 4576 _tempDiv = _createElement("div") || { 4577 style: {} 4578 }; 4579 _tempDivStyler = _createElement("div"); 4580 _transformProp = _checkPropPrefix(_transformProp); 4581 _transformOriginProp = _transformProp + "Origin"; 4582 _tempDiv.style.cssText = "border-width:0;line-height:0;position:absolute;padding:0"; //make sure to override certain properties that may contaminate measurements, in case the user has overreaching style sheets. 4583 _supports3D = !!_checkPropPrefix("perspective"); 4584 _reverting = (0, _gsapCoreJs.gsap).core.reverting; 4585 _pluginInitted = 1; 4586 } 4587}, _getReparentedCloneBBox = function _getReparentedCloneBBox(target) { 4588 //works around issues in some browsers (like Firefox) that don't correctly report getBBox() on SVG elements inside a <defs> element and/or <mask>. We try creating an SVG, adding it to the documentElement and toss the element in there so that it's definitely part of the rendering tree, then grab the bbox and if it works, we actually swap out the original getBBox() method for our own that does these extra steps whenever getBBox is needed. This helps ensure that performance is optimal (only do all these extra steps when absolutely necessary...most elements don't need it). 4589 var owner = target.ownerSVGElement, svg = _createElement("svg", owner && owner.getAttribute("xmlns") || "http://www.w3.org/2000/svg"), clone = target.cloneNode(true), bbox; 4590 clone.style.display = "block"; 4591 svg.appendChild(clone); 4592 _docElement.appendChild(svg); 4593 try { 4594 bbox = clone.getBBox(); 4595 } catch (e) {} 4596 svg.removeChild(clone); 4597 _docElement.removeChild(svg); 4598 return bbox; 4599}, _getAttributeFallbacks = function _getAttributeFallbacks(target, attributesArray) { 4600 var i = attributesArray.length; 4601 while(i--){ 4602 if (target.hasAttribute(attributesArray[i])) return target.getAttribute(attributesArray[i]); 4603 } 4604}, _getBBox = function _getBBox(target) { 4605 var bounds, cloned; 4606 try { 4607 bounds = target.getBBox(); //Firefox throws errors if you try calling getBBox() on an SVG element that's not rendered (like in a <symbol> or <defs>). https://bugzilla.mozilla.org/show_bug.cgi?id=612118 4608 } catch (error) { 4609 bounds = _getReparentedCloneBBox(target); 4610 cloned = 1; 4611 } 4612 bounds && (bounds.width || bounds.height) || cloned || (bounds = _getReparentedCloneBBox(target)); //some browsers (like Firefox) misreport the bounds if the element has zero width and height (it just assumes it's at x:0, y:0), thus we need to manually grab the position in that case. 4613 return bounds && !bounds.width && !bounds.x && !bounds.y ? { 4614 x: +_getAttributeFallbacks(target, [ 4615 "x", 4616 "cx", 4617 "x1" 4618 ]) || 0, 4619 y: +_getAttributeFallbacks(target, [ 4620 "y", 4621 "cy", 4622 "y1" 4623 ]) || 0, 4624 width: 0, 4625 height: 0 4626 } : bounds; 4627}, _isSVG = function _isSVG(e) { 4628 return !!(e.getCTM && (!e.parentNode || e.ownerSVGElement) && _getBBox(e)); 4629}, //reports if the element is an SVG on which getBBox() actually works 4630_removeProperty = function _removeProperty(target, property) { 4631 if (property) { 4632 var style = target.style, first2Chars; 4633 if (property in _transformProps && property !== _transformOriginProp) property = _transformProp; 4634 if (style.removeProperty) { 4635 first2Chars = property.substr(0, 2); 4636 if (first2Chars === "ms" || property.substr(0, 6) === "webkit") //Microsoft and some Webkit browsers don't conform to the standard of capitalizing the first prefix character, so we adjust so that when we prefix the caps with a dash, it's correct (otherwise it'd be "ms-transform" instead of "-ms-transform" for IE9, for example) 4637 property = "-" + property; 4638 style.removeProperty(first2Chars === "--" ? property : property.replace(_capsExp, "-$1").toLowerCase()); 4639 } else //note: old versions of IE use "removeAttribute()" instead of "removeProperty()" 4640 style.removeAttribute(property); 4641 } 4642}, _addNonTweeningPT = function _addNonTweeningPT(plugin, target, property, beginning, end, onlySetAtEnd) { 4643 var pt = new (0, _gsapCoreJs.PropTween)(plugin._pt, target, property, 0, 1, onlySetAtEnd ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue); 4644 plugin._pt = pt; 4645 pt.b = beginning; 4646 pt.e = end; 4647 plugin._props.push(property); 4648 return pt; 4649}, _nonConvertibleUnits = { 4650 deg: 1, 4651 rad: 1, 4652 turn: 1 4653}, _nonStandardLayouts = { 4654 grid: 1, 4655 flex: 1 4656}, //takes a single value like 20px and converts it to the unit specified, like "%", returning only the numeric amount. 4657_convertToUnit = function _convertToUnit(target, property, value, unit) { 4658 var curValue = parseFloat(value) || 0, curUnit = (value + "").trim().substr((curValue + "").length) || "px", // some browsers leave extra whitespace at the beginning of CSS variables, hence the need to trim() 4659 style = _tempDiv.style, horizontal = _horizontalExp.test(property), isRootSVG = target.tagName.toLowerCase() === "svg", measureProperty = (isRootSVG ? "client" : "offset") + (horizontal ? "Width" : "Height"), amount = 100, toPixels = unit === "px", toPercent = unit === "%", px, parent, cache, isSVG; 4660 if (unit === curUnit || !curValue || _nonConvertibleUnits[unit] || _nonConvertibleUnits[curUnit]) return curValue; 4661 curUnit !== "px" && !toPixels && (curValue = _convertToUnit(target, property, value, "px")); 4662 isSVG = target.getCTM && _isSVG(target); 4663 if ((toPercent || curUnit === "%") && (_transformProps[property] || ~property.indexOf("adius"))) { 4664 px = isSVG ? target.getBBox()[horizontal ? "width" : "height"] : target[measureProperty]; 4665 return (0, _gsapCoreJs._round)(toPercent ? curValue / px * amount : curValue / 100 * px); 4666 } 4667 style[horizontal ? "width" : "height"] = amount + (toPixels ? curUnit : unit); 4668 parent = unit !== "rem" && ~property.indexOf("adius") || unit === "em" && target.appendChild && !isRootSVG ? target : target.parentNode; 4669 if (isSVG) parent = (target.ownerSVGElement || {}).parentNode; 4670 if (!parent || parent === _doc || !parent.appendChild) parent = _doc.body; 4671 cache = parent._gsap; 4672 if (cache && toPercent && cache.width && horizontal && cache.time === (0, _gsapCoreJs._ticker).time && !cache.uncache) return (0, _gsapCoreJs._round)(curValue / cache.width * amount); 4673 else { 4674 if (toPercent && (property === "height" || property === "width")) { 4675 // if we're dealing with width/height that's inside a container with padding and/or it's a flexbox/grid container, we must apply it to the target itself rather than the _tempDiv in order to ensure complete accuracy, factoring in the parent's padding. 4676 var v = target.style[property]; 4677 target.style[property] = amount + unit; 4678 px = target[measureProperty]; 4679 v ? target.style[property] = v : _removeProperty(target, property); 4680 } else { 4681 (toPercent || curUnit === "%") && !_nonStandardLayouts[_getComputedProperty(parent, "display")] && (style.position = _getComputedProperty(target, "position")); 4682 parent === target && (style.position = "static"); // like for borderRadius, if it's a % we must have it relative to the target itself but that may not have position: relative or position: absolute in
4682which case it'd go up the chain until it finds its offsetParent (bad). position: static protects against that. 4683 parent.appendChild(_tempDiv); 4684 px = _tempDiv[measureProperty]; 4685 parent.removeChild(_tempDiv); 4686 style.position = "absolute"; 4687 } 4688 if (horizontal && toPercent) { 4689 cache = (0, _gsapCoreJs._getCache)(parent); 4690 cache.time = (0, _gsapCoreJs._ticker).time; 4691 cache.width = parent[measureProperty]; 4692 } 4693 } 4694 return (0, _gsapCoreJs._round)(toPixels ? px * curValue / amount : px && curValue ? amount / px * curValue : 0); 4695}, _get = function _get(target, property, unit, uncache) { 4696 var value; 4697 _pluginInitted || _initCore(); 4698 if (property in _propertyAliases && property !== "transform") { 4699 property = _propertyAliases[property]; 4700 if (~property.indexOf(",")) property = property.split(",")[0]; 4701 } 4702 if (_transformProps[property] && property !== "transform") { 4703 value = _parseTransform(target, uncache); 4704 value = property !== "transformOrigin" ? value[property] : value.svg ? value.origin : _firstTwoOnly(_getComputedProperty(target, _transformOriginProp)) + " " + value.zOrigin + "px"; 4705 } else { 4706 value = target.style[property]; 4707 if (!value || value === "auto" || uncache || ~(value + "").indexOf("calc(")) value = _specialProps[property] && _specialProps[property](target, property, unit) || _getComputedProperty(target, property) || (0, _gsapCoreJs._getProperty)(target, property) || (property === "opacity" ? 1 : 0); // note: some browsers, like Firefox, don't report borderRadius correctly! Instead, it only reports every corner like borderTopLeftRadius 4708 } 4709 return unit && !~(value + "").trim().indexOf(" ") ? _convertToUnit(target, property, value, unit) + unit : value; 4710}, _tweenComplexCSSString = function _tweenComplexCSSString(target, prop, start, end) { 4711 // note: we call _tweenComplexCSSString.call(pluginInstance...) to ensure that it's scoped properly. We may call it from within a plugin too, thus "this" would refer to the plugin. 4712 if (!start || start === "none") { 4713 // some browsers like Safari actually PREFER the prefixed property and mis-report the unprefixed value like clipPath (BUG). In other words, even though clipPath exists in the style ("clipPath" in target.style) and it's set in the CSS properly (along with -webkit-clip-path), Safari reports clipPath as "none" whereas WebkitClipPath reports accurately like "ellipse(100% 0% at 50% 0%)", so in this case we must SWITCH to using the prefixed property instead. See https://gsap.com/forums/topic/18310-clippath-doesnt-work-on-ios/ 4714 var p = _checkPropPrefix(prop, target, 1), s = p && _getComputedProperty(target, p, 1); 4715 if (s && s !== start) { 4716 prop = p; 4717 start = s; 4718 } else if (prop === "borderColor") start = _getComputedProperty(target, "borderTopColor"); // Firefox bug: always reports "borderColor" as "", so we must fall back to borderTopColor. See https://gsap.com/forums/topic/24583-how-to-return-colors-that-i-had-after-reverse/ 4719 } 4720 var pt = new (0, _gsapCoreJs.PropTween)(this._pt, target.style, prop, 0, 1, (0, _gsapCoreJs._renderComplexString)), index = 0, matchIndex = 0, a, result, startValues, startNum, color, startValue, endValue, endNum, chunk, endUnit, startUnit, endValues; 4721 pt.b = start; 4722 pt.e = end; 4723 start += ""; // ensure values are strings 4724 end += ""; 4725 if (end.substring(0, 6) === "var(--") end = _getComputedProperty(target, end.substring(4, end.indexOf(")"))); 4726 if (end === "auto") { 4727 startValue = target.style[prop]; 4728 target.style[prop] = end; 4729 end = _getComputedProperty(target, prop) || end; 4730 startValue ? target.style[prop] = startValue : _removeProperty(target, prop); 4731 } 4732 a = [ 4733 start, 4734 end 4735 ]; 4736 (0, _gsapCoreJs._colorStringFilter)(a); // pass an array with the starting and ending values and let the filter do whatever it needs to the values. If colors are found, it returns true and then we must match where the color shows up order-wise because for things like boxShadow, sometimes the browser provides the computed values with the color FIRST, but the user provides it with the color LAST, so flip them if necessary. Same for drop-shadow(). 4737 start = a[0]; 4738 end = a[1]; 4739 startValues = start.match((0, _gsapCoreJs._numWithUnitExp)) || []; 4740 endValues = end.match((0, _gsapCoreJs._numWithUnitExp)) || []; 4741 if (endValues.length) { 4742 while(result = (0, _gsapCoreJs._numWithUnitExp).exec(end)){ 4743 endValue = result[0]; 4744 chunk = end.substring(index, result.index); 4745 if (color) color = (color + 1) % 5; 4746 else if (chunk.substr(-5) === "rgba(" || chunk.substr(-5) === "hsla(") color = 1; 4747 if (endValue !== (startValue = startValues[matchIndex++] || "")) { 4748 startNum = parseFloat(startValue) || 0; 4749 startUnit = startValue.substr((startNum + "").length); 4750 endValue.charAt(1) === "=" && (endValue = (0, _gsapCoreJs._parseRelative)(startNum, endValue) + startUnit); 4751 endNum = parseFloat(endValue); 4752 endUnit = endValue.substr((endNum + "").length); 4753 index = (0, _gsapCoreJs._numWithUnitExp).lastIndex - endUnit.length; 4754 if (!endUnit) { 4755 //if something like "perspective:300" is passed in and we must add a unit to the end 4756 endUnit = endUnit || (0, _gsapCoreJs._config).units[prop] || startUnit; 4757 if (index === end.length) { 4758 end += endUnit; 4759 pt.e += endUnit; 4760 } 4761 } 4762 if (startUnit !== endUnit) startNum = _convertToUnit(target, prop, startValue, endUnit) || 0; 4763 // these nested PropTweens are handled in a special way - we'll never actually call a render or setter method on them. We'll just loop through them in the parent complex string PropTween's render method. 4764 pt._pt = { 4765 _next: pt._pt, 4766 p: chunk || matchIndex === 1 ? chunk : ",",
vendor: 7,461 bytes, lines 4767-4883
4767 //note: SVG spec allows omission of comma/space when a negative sign is wedged between two numbers, like 2.5-5.3 instead of 2.5,-5.3 but when tweening, the negative value may switch to positive, so we insert the comma just in case. 4768 s: startNum, 4769 c: endNum - startNum, 4770 m: color && color < 4 || prop === "zIndex" ? Math.round : 0 4771 }; 4772 } 4773 } 4774 pt.c = index < end.length ? end.substring(index, end.length) : ""; //we use the "c" of the PropTween to store the final part of the string (after the last number) 4775 } else pt.r = prop === "display" && end === "none" ? _renderNonTweeningValueOnlyAtEnd : _renderNonTweeningValue; 4776 (0, _gsapCoreJs._relExp).test(end) && (pt.e = 0); //if the end string contains relative values or dynamic random(...) values, delete the end it so that on the final render we don't actually set it to the string with += or -= characters (forces it to use the calculated value). 4777 this._pt = pt; //start the linked list with this new PropTween. Remember, we call _tweenComplexCSSString.call(pluginInstance...) to ensure that it's scoped properly. We may call it from within another plugin too, thus "this" would refer to the plugin. 4778 return pt; 4779}, _keywordToPercent = { 4780 top: "0%", 4781 bottom: "100%", 4782 left: "0%", 4783 right: "100%", 4784 center: "50%" 4785}, _convertKeywordsToPercentages = function _convertKeywordsToPercentages(value) { 4786 var split = value.split(" "), x = split[0], y = split[1] || "50%"; 4787 if (x === "top" || x === "bottom" || y === "left" || y === "right") { 4788 //the user provided them in the wrong order, so flip them 4789 value = x; 4790 x = y; 4791 y = value; 4792 } 4793 split[0] = _keywordToPercent[x] || x; 4794 split[1] = _keywordToPercent[y] || y; 4795 return split.join(" "); 4796}, _renderClearProps = function _renderClearProps(ratio, data) { 4797 if (data.tween && data.tween._time === data.tween._dur) { 4798 var target = data.t, style = target.style, props = data.u, cache = target._gsap, prop, clearTransforms, i; 4799 if (props === "all" || props === true) { 4800 style.cssText = ""; 4801 clearTransforms = 1; 4802 } else { 4803 props = props.split(","); 4804 i = props.length; 4805 while(--i > -1){ 4806 prop = props[i]; 4807 if (_transformProps[prop]) { 4808 clearTransforms = 1; 4809 prop = prop === "transformOrigin" ? _transformOriginProp : _transformProp; 4810 } 4811 _removeProperty(target, prop); 4812 } 4813 } 4814 if (clearTransforms) { 4815 _removeProperty(target, _transformProp); 4816 if (cache) { 4817 cache.svg && target.removeAttribute("transform"); 4818 style.scale = style.rotate = style.translate = "none"; 4819 _parseTransform(target, 1); // force all the cached values back to "normal"/identity, otherwise if there's another tween that's already set to render transforms on this element, it could display the wrong values. 4820 cache.uncache = 1; 4821 _removeIndependentTransforms(style); 4822 } 4823 } 4824 } 4825}, // note: specialProps should return 1 if (and only if) they have a non-zero priority. It indicates we need to sort the linked list. 4826_specialProps = { 4827 clearProps: function clearProps(plugin, target, property, endValue, tween) { 4828 if (tween.data !== "isFromStart") { 4829 var pt = plugin._pt = new (0, _gsapCoreJs.PropTween)(plugin._pt, target, property, 0, 0, _renderClearProps); 4830 pt.u = endValue; 4831 pt.pr = -10; 4832 pt.tween = tween; 4833 plugin._props.push(property); 4834 return 1; 4835 } 4836 } 4837}, /* 4838 * -------------------------------------------------------------------------------------- 4839 * TRANSFORMS 4840 * -------------------------------------------------------------------------------------- 4841 */ _identity2DMatrix = [ 4842 1, 4843 0, 4844 0, 4845 1, 4846 0, 4847 0 4848], _rotationalProperties = {}, _isNullTransform = function _isNullTransform(value) { 4849 return value === "matrix(1, 0, 0, 1, 0, 0)" || value === "none" || !value; 4850}, _getComputedTransformMatrixAsArray = function _getComputedTransformMatrixAsArray(target) { 4851 var matrixString = _getComputedProperty(target, _transformProp); 4852 return _isNullTransform(matrixString) ? _identity2DMatrix : matrixString.substr(7).match((0, _gsapCoreJs._numExp)).map((0, _gsapCoreJs._round)); 4853}, _getMatrix = function _getMatrix(target, force2D) { 4854 var cache = target._gsap || (0, _gsapCoreJs._getCache)(target), style = target.style, matrix = _getComputedTransformMatrixAsArray(target), parent, nextSibling, temp, addedToDOM; 4855 if (cache.svg && target.getAttribute("transform")) { 4856 temp = target.transform.baseVal.consolidate().matrix; //ensures that even complex values like "translate(50,60) rotate(135,0,0)" are parsed because it mashes it into a matrix. 4857 matrix = [ 4858 temp.a, 4859 temp.b, 4860 temp.c, 4861 temp.d, 4862 temp.e, 4863 temp.f 4864 ]; 4865 return matrix.join(",") === "1,0,0,1,0,0" ? _identity2DMatrix : matrix; 4866 } else if (matrix === _identity2DMatrix && !target.offsetParent && target !== _docElement && !cache.svg) { 4867 //note: if offsetParent is null, that means the element isn't in the normal document flow, like if it has display:none or one of its ancestors has display:none). Firefox returns null for getComputedStyle() if the element is in an iframe that has display:none. https://bugzilla.mozilla.org/show_bug.cgi?id=548397 4868 //browsers don't report transforms accurately unless the element is in the DOM and has a display value that's not "none". Firefox and Microsoft browsers have a partial bug where they'll report transforms even if display:none BUT not any percentage-based values like translate(-50%, 8px) will be reported as if it's translate(0, 8px). 4869 temp = style.display; 4870 style.display = "block"; 4871 parent = target.parentNode; 4872 if (!parent || !target.offsetParent && !target.getBoundingClientRect().width) { 4873 // note: in 3.3.0 we switched target.offsetParent to _doc.body.contains(target) to avoid [sometimes unnecessary] MutationObserver calls but that wasn't adequate because there are edge cases where nested position: fixed elements need to get reparented to accurately sense transforms. See https://github.com/greensock/GSAP/issues/388 and https://github.com/greensock/GSAP/issues/375. Note: position: fixed elements report a null offsetParent but they could also be invisible because they're in an ancestor with display: none, so we check getBoundingClientRect(). We only want to alter the DOM if we absolutely have to because it can cause iframe content to reload, like a Vimeo video. 4874 addedToDOM = 1; //flag 4875 nextSibling = target.nextElementSibling; 4876 _docElement.appendChild(target); //we must add it to the DOM in order to get values properly 4877 } 4878 matrix = _getComputedTransformMatrixAsArray(target); 4879 temp ? style.display = temp : _removeProperty(target, "display"); 4880 if (addedToDOM) nextSibling ? parent.insertBefore(target, nextSibling) : parent ? parent.appendChild(target) : _docElement.removeChild(target); 4881 } 4882 return force2D && matrix.length > 6 ? [ 4883 matrix[0],
vendor: 8,689 bytes, lines 4884-5029
4884 matrix[1], 4885 matrix[4], 4886 matrix[5], 4887 matrix[12], 4888 matrix[13] 4889 ] : matrix; 4890}, _applySVGOrigin = function _applySVGOrigin(target, origin, originIsAbsolute, smooth, matrixArray, pluginToAddPropTweensTo) { 4891 var cache = target._gsap, matrix = matrixArray || _getMatrix(target, true), xOriginOld = cache.xOrigin || 0, yOriginOld = cache.yOrigin || 0, xOffsetOld = cache.xOffset || 0, yOffsetOld = cache.yOffset || 0, a = matrix[0], b = matrix[1], c = matrix[2], d = matrix[3], tx = matrix[4], ty = matrix[5], originSplit = origin.split(" "), xOrigin = parseFloat(originSplit[0]) || 0, yOrigin = parseFloat(originSplit[1]) || 0, bounds, determinant, x, y; 4892 if (!originIsAbsolute) { 4893 bounds = _getBBox(target); 4894 xOrigin = bounds.x + (~originSplit[0].indexOf("%") ? xOrigin / 100 * bounds.width : xOrigin); 4895 yOrigin = bounds.y + (~(originSplit[1] || originSplit[0]).indexOf("%") ? yOrigin / 100 * bounds.height : yOrigin); // if (!("xOrigin" in cache) && (xOrigin || yOrigin)) { // added in 3.12.3, reverted in 3.12.4; requires more exploration 4896 // xOrigin -= bounds.x; 4897 // yOrigin -= bounds.y; 4898 // } 4899 } else if (matrix !== _identity2DMatrix && (determinant = a * d - b * c)) { 4900 //if it's zero (like if scaleX and scaleY are zero), skip it to avoid errors with dividing by zero. 4901 x = xOrigin * (d / determinant) + yOrigin * (-c / determinant) + (c * ty - d * tx) / determinant; 4902 y = xOrigin * (-b / determinant) + yOrigin * (a / determinant) - (a * ty - b * tx) / determinant; 4903 xOrigin = x; 4904 yOrigin = y; // theory: we only had to do this for smoothing and it assumes that the previous one was not originIsAbsolute. 4905 } 4906 if (smooth || smooth !== false && cache.smooth) { 4907 tx = xOrigin - xOriginOld; 4908 ty = yOrigin - yOriginOld; 4909 cache.xOffset = xOffsetOld + (tx * a + ty * c) - tx; 4910 cache.yOffset = yOffsetOld + (tx * b + ty * d) - ty; 4911 } else cache.xOffset = cache.yOffset = 0; 4912 cache.xOrigin = xOrigin; 4913 cache.yOrigin = yOrigin; 4914 cache.smooth = !!smooth; 4915 cache.origin = origin; 4916 cache.originIsAbsolute = !!originIsAbsolute; 4917 target.style[_transformOriginProp] = "0px 0px"; //otherwise, if someone sets an origin via CSS, it will likely interfere with the SVG transform attribute ones (because remember, we're baking the origin into the matrix() value). 4918 if (pluginToAddPropTweensTo) { 4919 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOrigin", xOriginOld, xOrigin); 4920 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOrigin", yOriginOld, yOrigin); 4921 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "xOffset", xOffsetOld, cache.xOffset); 4922 _addNonTweeningPT(pluginToAddPropTweensTo, cache, "yOffset", yOffsetOld, cache.yOffset); 4923 } 4924 target.setAttribute("data-svg-origin", xOrigin + " " + yOrigin); 4925}, _parseTransform = function _parseTransform(target, uncache) { 4926 var cache = target._gsap || new (0, _gsapCoreJs.GSCache)(target); 4927 if ("x" in cache && !uncache && !cache.uncache) return cache; 4928 var style = target.style, invertedScaleX = cache.scaleX < 0, px = "px", deg = "deg", cs = getComputedStyle(target), origin = _getComputedProperty(target, _transformOriginProp) || "0", x, y, z, scaleX, scaleY, rotation, rotationX, rotationY, skewX, skewY, perspective, xOrigin, yOrigin, matrix, angle, cos, sin, a, b, c, d, a12, a22, t1, t2, t3, a13, a23, a33, a42, a43, a32; 4929 x = y = z = rotation = rotationX = rotationY = skewX = skewY = perspective = 0; 4930 scaleX = scaleY = 1; 4931 cache.svg = !!(target.getCTM && _isSVG(target)); 4932 if (cs.translate) { 4933 // accommodate independent transforms by combining them into normal ones. 4934 if (cs.translate !== "none" || cs.scale !== "none" || cs.rotate !== "none") style[_transformProp] = (cs.translate !== "none" ? "translate3d(" + (cs.translate + " 0 0").split(" ").slice(0, 3).join(", ") + ") " : "") + (cs.rotate !== "none" ? "rotate(" + cs.rotate + ") " : "") + (cs.scale !== "none" ? "scale(" + cs.scale.split(" ").join(",") + ") " : "") + (cs[_transformProp] !== "none" ? cs[_transformProp] : ""); 4935 style.scale = style.rotate = style.translate = "none"; 4936 } 4937 matrix = _getMatrix(target, cache.svg); 4938 if (cache.svg) { 4939 if (cache.uncache) { 4940 // if cache.uncache is true (and maybe if origin is 0,0), we need to set element.style.transformOrigin = (cache.xOrigin - bbox.x) + "px " + (cache.yOrigin - bbox.y) + "px". Previously we let the data-svg-origin stay instead, but when introducing revert(), it complicated things. 4941 t2 = target.getBBox(); 4942 origin = cache.xOrigin - t2.x + "px " + (cache.yOrigin - t2.y) + "px"; 4943 t1 = ""; 4944 } else t1 = !uncache && target.getAttribute("data-svg-origin"); // Remember, to work around browser inconsistencies we always force SVG elements' transformOrigin to 0,0 and offset the translation accordingly. 4945 _applySVGOrigin(target, t1 || origin, !!t1 || cache.originIsAbsolute, cache.smooth !== false, matrix); 4946 } 4947 xOrigin = cache.xOrigin || 0; 4948 yOrigin = cache.yOrigin || 0; 4949 if (matrix !== _identity2DMatrix) { 4950 a = matrix[0]; //a11 4951 b = matrix[1]; //a21 4952 c = matrix[2]; //a31 4953 d = matrix[3]; //a41 4954 x = a12 = matrix[4]; 4955 y = a22 = matrix[5]; //2D matrix 4956 if (matrix.length === 6) { 4957 scaleX = Math.sqrt(a * a + b * b); 4958 scaleY = Math.sqrt(d * d + c * c); 4959 rotation = a || b ? _atan2(b, a) * _RAD2DEG : 0; //note: if scaleX is 0, we cannot accurately measure rotation. Same for skewX with a scaleY of 0. Therefore, we default to the previously recorded value (or zero if that doesn't exist). 4960 skewX = c || d ? _atan2(c, d) * _RAD2DEG + rotation : 0; 4961 skewX && (scaleY *= Math.abs(Math.cos(skewX * _DEG2RAD))); 4962 if (cache.svg) { 4963 x -= xOrigin - (xOrigin * a + yOrigin * c); 4964 y -= yOrigin - (xOrigin * b + yOrigin * d); 4965 } //3D matrix 4966 } else { 4967 a32 = matrix[6]; 4968 a42 = matrix[7]; 4969 a13 = matrix[8]; 4970 a23 = matrix[9]; 4971 a33 = matrix[10]; 4972 a43 = matrix[11]; 4973 x = matrix[12]; 4974 y = matrix[13]; 4975 z = matrix[14]; 4976 angle = _atan2(a32, a33); 4977 rotationX = angle * _RAD2DEG; //rotationX 4978 if (angle) { 4979 cos = Math.cos(-angle); 4980 sin = Math.sin(-angle); 4981 t1 = a12 * cos + a13 * sin; 4982 t2 = a22 * cos + a23 * sin; 4983 t3 = a32 * cos + a33 * sin; 4984 a13 = a12 * -sin + a13 * cos; 4985 a23 = a22 * -sin + a23 * cos; 4986 a33 = a32 * -sin + a33 * cos; 4987 a43 = a42 * -sin + a43 * cos; 4988 a12 = t1; 4989 a22 = t2; 4990 a32 = t3; 4991 } //rotationY 4992 angle = _atan2(-c, a33); 4993 rotationY = angle * _RAD2DEG; 4994 if (angle) { 4995 cos = Math.cos(-angle); 4996 sin = Math.sin(-angle); 4997 t1 = a * cos - a13 * sin; 4998 t2 = b * cos - a23 * sin; 4999 t3 = c * cos - a33 * sin; 5000 a43 = d * sin + a43 * cos; 5001 a = t1; 5002 b = t2; 5003 c = t3; 5004 } //rotationZ 5005 angle = _atan2(b, a); 5006 rotation = angle * _RAD2DEG; 5007 if (angle) { 5008 cos = Math.cos(angle); 5009 sin = Math.sin(angle); 5010 t1 = a * cos + b * sin; 5011 t2 = a12 * cos + a22 * sin; 5012 b = b * cos - a * sin; 5013 a22 = a22 * cos - a12 * sin; 5014 a = t1; 5015 a12 = t2; 5016 } 5017 if (rotationX && Math.abs(rotationX) + Math.abs(rotation) > 359.9) { 5018 //when rotationY is set, it will often be parsed as 180 degrees different than it should be, and rotationX and rotation both being 180 (it looks the same), so we adjust for that here. 5019 rotationX = rotation = 0; 5020 rotationY = 180 - rotationY; 5021 } 5022 scaleX = (0, _gsapCoreJs._round)(Math.sqrt(a * a + b * b + c * c)); 5023 scaleY = (0, _gsapCoreJs._round)(Math.sqrt(a22 * a22 + a32 * a32)); 5024 angle = _atan2(a12, a22); 5025 skewX = Math.abs(angle) > 0.0002 ? angle * _RAD2DEG : 0; 5026 perspective = a43 ? 1 / (a43 < 0 ? -a43 : a43) : 0; 5027 } 5028 if (cache.svg) { 5029 //sense if there are CSS transforms applied on an SVG element in which case we must over
5029write them when rendering. The transform attribute is more reliable cross-browser, but we can't just remove the CSS ones because they may be applied in a CSS rule somewhere (not just inline). 5030 t1 = target.getAttribute("transform"); 5031 cache.forceCSS = target.setAttribute("transform", "") || !_isNullTransform(_getComputedProperty(target, _transformProp)); 5032 t1 && target.setAttribute("transform", t1); 5033 } 5034 } 5035 if (Math.abs(skewX) > 90 && Math.abs(skewX) < 270) { 5036 if (invertedScaleX) { 5037 scaleX *= -1; 5038 skewX += rotation <= 0 ? 180 : -180; 5039 rotation += rotation <= 0 ? 180 : -180; 5040 } else { 5041 scaleY *= -1; 5042 skewX += skewX <= 0 ? 180 : -180; 5043 } 5044 } 5045 uncache = uncache || cache.uncache; 5046 cache.x = x - ((cache.xPercent = x && (!uncache && cache.xPercent || (Math.round(target.offsetWidth / 2) === Math.round(-x) ? -50 : 0))) ? target.offsetWidth * cache.xPercent / 100 : 0) + px; 5047 cache.y = y - ((cache.yPercent = y && (!uncache && cache.yPercent || (Math.round(target.offsetHeight / 2) === Math.round(-y) ? -50 : 0))) ? target.offsetHeight * cache.yPercent / 100 : 0) + px; 5048 cache.z = z + px; 5049 cache.scaleX = (0, _gsapCoreJs._round)(scaleX); 5050 cache.scaleY = (0, _gsapCoreJs._round)(scaleY); 5051 cache.rotation = (0, _gsapCoreJs._round)(rotation) + deg; 5052 cache.rotationX = (0, _gsapCoreJs._round)(rotationX) + deg; 5053 cache.rotationY = (0, _gsapCoreJs._round)(rotationY) + deg; 5054 cache.skewX = skewX + deg; 5055 cache.skewY = skewY + deg; 5056 cache.transformPerspective = perspective + px; 5057 if (cache.zOrigin = parseFloat(origin.split(" ")[2]) || !uncache && cache.zOrigin || 0) style[_transformOriginProp] = _firstTwoOnly(origin); 5058 cache.xOffset = cache.yOffset = 0; 5059 cache.force3D = (0, _gsapCoreJs._config).force3D; 5060 cache.renderTransform = cache.svg ? _renderSVGTransforms : _supports3D ? _renderCSSTransforms : _renderNon3DTransforms; 5061 cache.uncache = 0; 5062 return cache; 5063}, _firstTwoOnly = function _firstTwoOnly(value) { 5064 return (value = value.split(" "))[0] + " " + value[1]; 5065}, //for handling transformOrigin values, stripping out the 3rd dimension 5066_addPxTranslate = function _addPxTranslate(target, start, value) { 5067 var unit = (0, _gsapCoreJs.getUnit)(start); 5068 return (0, _gsapCoreJs._round)(parseFloat(start) + parseFloat(_convertToUnit(target, "x", value + "px", unit))) + unit; 5069}, _renderNon3DTransforms = function _renderNon3DTransforms(ratio, cache) { 5070 cache.z = "0px"; 5071 cache.rotationY = cache.rotationX = "0deg"; 5072 cache.force3D = 0; 5073 _renderCSSTransforms(ratio, cache); 5074}, _zeroDeg = "0deg", _zeroPx = "0px", _endParenthesis = ") ", _renderCSSTransforms = function _renderCSSTransforms(ratio, cache) { 5075 var _ref = cache || this, xPercent = _ref.xPercent, yPercent = _ref.yPercent, x = _ref.x, y = _ref.y, z = _ref.z, rotation = _ref.rotation, rotationY = _ref.rotationY, rotationX = _ref.rotationX, skewX = _ref.skewX, skewY = _ref.skewY, scaleX = _ref.scaleX, scaleY = _ref.scaleY, transformPerspective = _ref.transformPerspective, force3D = _ref.force3D, target = _ref.target, zOrigin = _ref.zOrigin, transforms = "", use3D = force3D === "auto" && ratio && ratio !== 1 || force3D === true; // Safari has a bug that causes it not to render 3D transform-origin values properly, so we force the z origin to 0, record it in the cache, and then do the math here to offset the translate values accordingly (basically do the 3D transform-origin part manually) 5076 if (zOrigin && (rotationX !== _zeroDeg || rotationY !== _zeroDeg)) { 5077 var angle = parseFloat(rotationY) * _DEG2RAD, a13 = Math.sin(angle), a33 = Math.cos(angle), cos; 5078 angle = parseFloat(rotationX) * _DEG2RAD; 5079 cos = Math.cos(angle); 5080 x = _addPxTranslate(target, x, a13 * cos * -zOrigin); 5081 y = _addPxTranslate(target, y, -Math.sin(angle) * -zOrigin); 5082 z = _addPxTranslate(target, z, a33 * cos * -zOrigin + zOrigin); 5083 } 5084 if (transformPerspective !== _zeroPx) transforms += "perspective(" + transformPerspective + _endParenthesis; 5085 if (xPercent || yPercent) transforms += "translate(" + xPercent + "%, " + yPercent + "%) "; 5086 if (use3D || x !== _zeroPx || y !== _zeroPx || z !== _zeroPx) transforms += z !== _zeroPx || use3D ? "translate3d(" + x + ", " + y + ", " + z + ") " : "translate(" + x + ", " + y + _endParenthesis; 5087 if (rotation !== _zeroDeg) transforms += "rotate(" + rotation + _endParenthesis; 5088 if (rotationY !== _zeroDeg) transforms += "rotateY(" + rotationY + _endParenthesis; 5089 if (rotationX !== _zeroDeg) transforms += "rotateX(" + rotationX + _endParenthesis;
5090 if (skewX !== _zeroDeg || skewY !== _zeroDeg) transforms += "skew(" + skewX + ", " + skewY + _endParenthesis; 5091 if (scaleX !== 1 || scaleY !== 1) transforms += "scale(" + scaleX + ", " + scaleY + _endParenthesis; 5092 target.style[_transformProp] = transforms || "translate(0, 0)"; 5093}, _renderSVGTransforms = function _renderSVGTransforms(ratio, cache) { 5094 var _ref2 = cache || this, xPercent = _ref2.xPercent, yPercent = _ref2.yPercent, x = _ref2.x, y = _ref2.y, rotation = _ref2.rotation, skewX = _ref2.skewX, skewY = _ref2.skewY, scaleX = _ref2.scaleX, scaleY = _ref2.scaleY, target = _ref2.target, xOrigin = _ref2.xOrigin, yOrigin = _ref2.yOrigin, xOffset = _ref2.xOffset, yOffset = _ref2.yOffset, forceCSS = _ref2.forceCSS, tx = parseFloat(x), ty = parseFloat(y), a11, a21, a12, a22, temp; 5095 rotation = parseFloat(rotation); 5096 skewX = parseFloat(skewX); 5097 skewY = parseFloat(skewY); 5098 if (skewY) { 5099 //for performance reasons, we combine all skewing into the skewX and rotation values. Remember, a skewY of 10 degrees looks the same as a rotation of 10 degrees plus a skewX of 10 degrees. 5100 skewY = parseFloat(skewY); 5101 skewX += skewY; 5102 rotation += skewY; 5103 } 5104 if (rotation || skewX) { 5105 rotation *= _DEG2RAD; 5106 skewX *= _DEG2RAD; 5107 a11 = Math.cos(rotation) * scaleX; 5108 a21 = Math.sin(rotation) * scaleX; 5109 a12 = Math.sin(rotation - skewX) * -scaleY; 5110 a22 = Math.cos(rotation - skewX) * scaleY; 5111 if (skewX) { 5112 skewY *= _DEG2RAD; 5113 temp = Math.tan(skewX - skewY); 5114 temp = Math.sqrt(1 + temp * temp); 5115 a12 *= temp; 5116 a22 *= temp; 5117 if (skewY) { 5118 temp = Math.tan(skewY); 5119 temp = Math.sqrt(1 + temp * temp); 5120 a11 *= temp; 5121 a21 *= temp; 5122 } 5123 } 5124 a11 = (0, _gsapCoreJs._round)(a11); 5125 a21 = (0, _gsapCoreJs._round)(a21); 5126 a12 = (0, _gsapCoreJs._round)(a12); 5127 a22 = (0, _gsapCoreJs._round)(a22); 5128 } else { 5129 a11 = scaleX; 5130 a22 = scaleY; 5131 a21 = a12 = 0; 5132 } 5133 if (tx && !~(x + "").indexOf("px") || ty && !~(y + "").indexOf("px")) { 5134 tx = _convertToUnit(target, "x", x, "px"); 5135 ty = _convertToUnit(target, "y", y, "px"); 5136 } 5137 if (xOrigin || yOrigin || xOffset || yOffset) { 5138 tx = (0, _gsapCoreJs._round)(tx + xOrigin - (xOrigin * a11 + yOrigin * a12) + xOffset); 5139 ty = (0, _gsapCoreJs._round)(ty + yOrigin - (xOrigin * a21 + yOrigin * a22) + yOffset); 5140 } 5141 if (xPercent || yPercent) { 5142 //The SVG spec doesn't support percentage-based translation in the "transform" attribute, so we merge it into the translation to simulate it. 5143 temp = target.getBBox(); 5144 tx = (0, _gsapCoreJs._round)(tx + xPercent / 100 * temp.width); 5145 ty = (0, _gsapCoreJs._round)(ty + yPercent / 100 * temp.height); 5146 } 5147 temp = "matrix(" + a11 + "," + a21 + "," + a12 + "," + a22 + "," + tx + "," + ty + ")"; 5148 target.setAttribute("transform", temp); 5149 forceCSS && (target.style[_transformProp] = temp); //some browsers prioritize CSS transforms over the transform attribute. When we sense that the user has CSS transforms applied, we must overwrite them this way (otherwise some browser simply won't render the transform attribute changes!) 5150}, _addRotationalPropTween = function _addRotationalPropTween(plugin, target, property, startNum, endValue) { 5151 var cap = 360, isString = (0, _gsapCoreJs._isString)(endValue), endNum = parseFloat(endValue) * (isString && ~endValue.indexOf("rad") ? _RAD2DEG : 1), change = endNum - startNum, finalValue = startNum + change + "deg", direction, pt; 5152 if (isString) { 5153 direction = endValue.split("_")[1]; 5154 if (direction === "short") { 5155 change %= cap; 5156 if (change !== change % (cap / 2)) change += change < 0 ? cap : -cap; 5157 } 5158 if (direction === "cw" && change < 0) change = (change + cap * _bigNum) % cap - ~~(change / cap) * cap; 5159 else if (direction === "ccw" && change > 0) change = (change - cap * _bigNum) % cap - ~~(change / cap) * cap; 5160 } 5161 plugin._pt = pt = new (0, _gsapCoreJs.PropTween)(plugin._pt, target, property, startNum, change, _renderPropWithEnd); 5162 pt.e = finalValue; 5163 pt.u = "deg"; 5164 plugin._props.push(property); 5165 return pt; 5166}, _assign = function _assign(target, source) { 5167 // Internet Explorer doesn't have Object.assign(), so we recreate it here. 5168 for(var p in source)target[p] = source[p]; 5169 return target; 5170}, _addRawTransformPTs = function _addRawTransformPTs(plugin, transforms, target) { 5171 //for handling cases where someone passes in a whole transform string, like transform: "scale(2, 3) rotate(20deg) translateY(30em)" 5172 var startCache = _assign({}, target._gsap), exclude = "perspective,force3D,transformOrigin,svgOrigin", style = target.style, endCache, p, startValue, endValue, startNum, endNum, startUnit, endUnit; 5173 if (startCache.svg) { 5174 startValue = target.getAttribute("transform"); 5175 target.setAttribute("transform", ""); 5176 style[_transformProp] = transforms; 5177 endCache = _parseTransform(target, 1); 5178 _removeProperty(target, _transformProp); 5179 target.setAttribute("transform", startValue); 5180 } else { 5181 startValue = getComputedStyle(target)[_transformProp]; 5182 style[_transformProp] = transforms; 5183 endCache = _parseTransform(target, 1); 5184 style[_transformProp] = startValue; 5185 } 5186 for(p in _transformProps){ 5187 startValue = startCache[p]; 5188 endValue = endCache[p]; 5189 if (startValue !== endValue && exclude.indexOf(p) < 0) { 5190 //tweening to no perspective gives very unintuitive results - just keep the same perspective in that case. 5191 startUnit = (0, _gsapCoreJs.getUnit)(startValue); 5192 endUnit = (0, _gsapCoreJs.getUnit)(endValue); 5193 startNum = startUnit !== endUnit ? _convertToUnit(target, p, startValue, endUnit) : parseFloat(startValue); 5194 endNum = parseFloat(endValue); 5195 plugin._pt = new (0, _gsapCoreJs.PropTween)(plugin._pt, endCache, p, startNum, endNum - startNum, _renderCSSProp); 5196 plugin._pt.u = endUnit || 0; 5197 plugin._props.push(p); 5198 } 5199 } 5200 _assign(endCache, startCache); 5201}; // handle splitting apart padding, margin, borderWidth, and borderRadius into their 4 components. Firefox, for example, won't report borderRadius correctly - it will only do borderTopLeftRadius and the other corners. We also want to handle paddingTop, marginLeft, borderRightWidth, etc.
5202(0, _gsapCoreJs._forEachName)("padding,margin,Width,Radius", function(name, index) { 5203 var t = "Top", r = "Right", b = "Bottom", l = "Left", props = (index < 3 ? [ 5204 t, 5205 r, 5206 b, 5207 l 5208 ] : [ 5209 t + l, 5210 t + r, 5211 b + r, 5212 b + l 5213 ]).map(function(side) { 5214 return index < 2 ? name + side : "border" + side + name; 5215 }); 5216 _specialProps[index > 1 ? "border" + name : name] = function(plugin, target, property, endValue, tween) { 5217 var a, vars; 5218 if (arguments.length < 4) { 5219 // getter, passed target, property, and unit (from _get()) 5220 a = props.map(function(prop) { 5221 return _get(plugin, prop, property); 5222 }); 5223 vars = a.join(" "); 5224 return vars.split(a[0]).length === 5 ? a[0] : vars; 5225 } 5226 a = (endValue + "").split(" "); 5227 vars = {}; 5228 props.forEach(function(prop, i) { 5229 return vars[prop] = a[i] = a[i] || a[(i - 1) / 2 | 0]; 5230 }); 5231 plugin.init(target, vars, tween); 5232 }; 5233}); 5234var CSSPlugin = { 5235 name: "css", 5236 register: _initCore, 5237 targetTest: function targetTest(target) { 5238 return target.style && target.nodeType; 5239 }, 5240 init: function init(target, vars, tween, index, targets) { 5241 var props = this._props, style = target.style, startAt = tween.vars.startAt, startValue, endValue, endNum, startNum, type, specialProp, p, startUnit, endUnit, relative, isTransformRelated, transformPropTween, cache, smooth, hasPriority, inlineProps; 5242 _pluginInitted || _initCore(); // we may call init() multiple times on the same plugin instance, like when adding special properties, so make sure we don't overwrite the revert data or inlineProps 5243 this.styles = this.styles || _getStyleSaver(target); 5244 inlineProps = this.styles.props; 5245 this.tween = tween; 5246 for(p in vars){ 5247 if (p === "autoRound") continue; 5248 endValue = vars[p]; 5249 if ((0, _gsapCoreJs._plugins)[p] && (0, _gsapCoreJs._checkPlugin)(p, vars, tween, index, target, targets)) continue; 5250 type = typeof endValue; 5251 specialProp = _specialProps[p]; 5252 if (type === "function") { 5253 endValue = endValue.call(tween, index, target, targets); 5254 type = typeof endValue; 5255 } 5256 if (type === "string" && ~endValue.indexOf("random(")) endValue = (0, _gsapCoreJs._replaceRandom)(endValue); 5257 if (specialProp) specialProp(this, target, p, endValue, tween) && (hasPriority = 1); 5258 else if (p.substr(0, 2) === "--") { 5259 //CSS variable 5260 startValue = (getComputedStyle(target).getPropertyValue(p) + "").trim(); 5261 endValue += ""; 5262 (0, _gsapCoreJs._colorExp).lastIndex = 0; 5263 if (!(0, _gsapCoreJs._colorExp).test(startValue)) { 5264 // colors don't have units 5265 startUnit = (0, _gsapCoreJs.getUnit)(startValue); 5266 endUnit = (0, _gsapCoreJs.getUnit)(endValue); 5267 } 5268 endUnit ? startUnit !== endUnit && (startValue = _convertToUnit(target, p, startValue, endUnit) + endUnit) : startUnit && (endValue += startUnit); 5269 this.add(style, "setProperty", startValue, endValue, index, targets, 0, 0, p); 5270 props.push(p); 5271 inlineProps.push(p, 0, style[p]); 5272 } else if (type !== "undefined") { 5273 if (startAt && p in startAt) { 5274 // in case someone hard-codes a complex value as the start, like top: "calc(2vh / 2)". Without this, it'd use the computed value (always in px) 5275 startValue = typeof startAt[p] === "function" ? startAt[p].call(tween, index, target, targets) : startAt[p]; 5276 (0, _gsapCoreJs._isString)(startValue) && ~startValue.indexOf("random(") && (startValue = (0, _gsapCoreJs._replaceRandom)(startValue)); 5277 (0, _gsapCoreJs.getUnit)(startValue + "") || startValue === "auto" || (startValue += (0, _gsapCoreJs._config).units[p] || (0, _gsapCoreJs.getUnit)(_get(target, p)) || ""); // for cases when someone passes in a unitless value like {x: 100}; if we try setting translate(100, 0px) it won't work. 5278 (startValue + "").charAt(1) === "=" && (startValue = _get(target, p)); // can't work with relative values 5279 } else startValue = _get(target, p); 5280 startNum = parseFloat(startValue); 5281 relative = type === "string" && endValue.charAt(1) === "=" && endValue.substr(0, 2); 5282 relative && (endValue = endValue.substr(2)); 5283 endNum = parseFloat(endValue); 5284 if (p in _propertyAliases) { 5285 if (p === "autoAlpha") { 5286 //special case where we control the visibility along with opacity. We still allow the opacity value to pass through and get tweened. 5287 if (startNum === 1 && _get(target, "visibility") === "hidden" && endNum) //if visibility is initially set to "hidden", we should interpret that as intent to make opacity 0 (a convenience) 5288 startNum = 0; 5289 inlineProps.push("visibility", 0, style.visibility); 5290 _addNonTweeningPT(this, style, "visibility", startNum ? "inherit" : "hidden", endNum ? "inherit" : "hidden", !endNum); 5291 } 5292 if (p !== "scale" && p !== "transform") { 5293 p = _propertyAliases[p]; 5294 ~p.indexOf(",") && (p = p.split(",")[0]); 5295 } 5296 }
5297 isTransformRelated = p in _transformProps; //--- TRANSFORM-RELATED --- 5298 if (isTransformRelated) { 5299 this.styles.save(p); 5300 if (type === "string" && endValue.substring(0, 6) === "var(--") { 5301 endValue = _getComputedProperty(target, endValue.substring(4, endValue.indexOf(")"))); 5302 endNum = parseFloat(endValue); 5303 } 5304 if (!transformPropTween) { 5305 cache = target._gsap; 5306 cache.renderTransform && !vars.parseTransform || _parseTransform(target, vars.parseTransform); // if, for example, gsap.set(... {transform:"translateX(50vw)"}), the _get() call doesn't parse the transform, thus cache.renderTransform won't be set yet so force the parsing of the transform here. 5307 smooth = vars.smoothOrigin !== false && cache.smooth; 5308 transformPropTween = this._pt = new (0, _gsapCoreJs.PropTween)(this._pt, style, _transformProp, 0, 1, cache.renderTransform, cache, 0, -1); //the first time through, create the rendering PropTween so that it runs LAST (in the linked list, we keep adding to the beginning) 5309 transformPropTween.dep = 1; //flag it as dependent so that if things get killed/overwritten and this is the only PropTween left, we can safely kill the whole tween. 5310 } 5311 if (p === "scale") { 5312 this._pt = new (0, _gsapCoreJs.PropTween)(this._pt, cache, "scaleY", cache.scaleY, (relative ? (0, _gsapCoreJs._parseRelative)(cache.scaleY, relative + endNum) : endNum) - cache.scaleY || 0, _renderCSSProp); 5313 this._pt.u = 0; 5314 props.push("scaleY", p); 5315 p += "X"; 5316 } else if (p === "transformOrigin") { 5317 inlineProps.push(_transformOriginProp, 0, style[_transformOriginProp]); 5318 endValue = _convertKeywordsToPercentages(endValue); //in case something like "left top" or "bottom right" is passed in. Convert to percentages. 5319 if (cache.svg) _applySVGOrigin(target, endValue, 0, smooth, 0, this); 5320 else { 5321 endUnit = parseFloat(endValue.split(" ")[2]) || 0; //handle the zOrigin separately! 5322 endUnit !== cache.zOrigin && _addNonTweeningPT(this, cache, "zOrigin", cache.zOrigin, endUnit); 5323 _addNonTweeningPT(this, style, p, _firstTwoOnly(startValue), _firstTwoOnly(endValue)); 5324 } 5325 continue; 5326 } else if (p === "svgOrigin") { 5327 _applySVGOrigin(target, endValue, 1, smooth, 0, this); 5328 continue; 5329 } else if (p in _rotationalProperties) { 5330 _addRotationalPropTween(this, cache, p, startNum, relative ? (0, _gsapCoreJs._parseRelative)(startNum, relative + endValue) : endValue); 5331 continue; 5332 } else if (p === "smoothOrigin") { 5333 _addNonTweeningPT(this, cache, "smooth", cache.smooth, endValue); 5334 continue; 5335 } else if (p === "force3D") { 5336 cache[p] = endValue; 5337 continue; 5338 } else if (p === "transform") { 5339 _addRawTransformPTs(this, endValue, target); 5340 continue; 5341 } 5342 } else if (!(p in style)) p = _checkPropPrefix(p) || p; 5343 if (isTransformRelated || (endNum || endNum === 0) && (startNum || startNum === 0) && !_complexExp.test(endValue) && p in style) { 5344 startUnit = (startValue + "").substr((startNum + "").length); 5345 endNum || (endNum = 0); // protect against NaN 5346 endUnit = (0, _gsapCoreJs.getUnit)(endValue) || (p in (0, _gsapCoreJs._config).units ? (0, _gsapCoreJs._config).units[p] : startUnit); 5347 startUnit !== endUnit && (startNum = _convertToUnit(target, p, startValue, endUnit)); 5348 this._pt = new (0, _gsapCoreJs.PropTween)(this._pt, isTransformRelated ? cache : style, p, startNum, (relative ? (0, _gsapCoreJs._parseRelative)(startNum, relative + endNum) : endNum) - startNum,
vendor: 10,455 bytes, lines 5348-5533
5348!isTransformRelated && (endUnit === "px" || p === "zIndex") && vars.autoRound !== false ? _renderRoundedCSSProp : _renderCSSProp); 5349 this._pt.u = endUnit || 0; 5350 if (startUnit !== endUnit && endUnit !== "%") { 5351 //when the tween goes all the way back to the beginning, we need to revert it to the OLD/ORIGINAL value (with those units). We record that as a "b" (beginning) property and point to a render method that handles that. (performance optimization) 5352 this._pt.b = startValue; 5353 this._pt.r = _renderCSSPropWithBeginning; 5354 } 5355 } else if (!(p in style)) { 5356 if (p in target) //maybe it's not a style - it could be a property added directly to an element in which case we'll try to animate that. 5357 this.add(target, p, startValue || target[p], relative ? relative + endValue : endValue, index, targets); 5358 else if (p !== "parseTransform") { 5359 (0, _gsapCoreJs._missingPlugin)(p, endValue); 5360 continue; 5361 } 5362 } else _tweenComplexCSSString.call(this, target, p, startValue, relative ? relative + endValue : endValue); 5363 isTransformRelated || (p in style ? inlineProps.push(p, 0, style[p]) : typeof target[p] === "function" ? inlineProps.push(p, 2, target[p]()) : inlineProps.push(p, 1, startValue || target[p])); 5364 props.push(p); 5365 } 5366 } 5367 hasPriority && (0, _gsapCoreJs._sortPropTweensByPriority)(this); 5368 }, 5369 render: function render(ratio, data) { 5370 if (data.tween._time || !_reverting()) { 5371 var pt = data._pt; 5372 while(pt){ 5373 pt.r(ratio, pt.d); 5374 pt = pt._next; 5375 } 5376 } else data.styles.revert(); 5377 }, 5378 get: _get, 5379 aliases: _propertyAliases, 5380 getSetter: function getSetter(target, property, plugin) { 5381 //returns a setter function that accepts target, property, value and applies it accordingly. Remember, properties like "x" aren't as simple as target.style.property = value because they've got to be applied to a proxy object and then merged into a transform string in a renderer. 5382 var p = _propertyAliases[property]; 5383 p && p.indexOf(",") < 0 && (property = p); 5384 return property in _transformProps && property !== _transformOriginProp && (target._gsap.x || _get(target, "x")) ? plugin && _recentSetterPlugin === plugin ? property === "scale" ? _setterScale : _setterTransform : (_recentSetterPlugin = plugin || {}, property === "scale" ? _setterScaleWithRender : _setterTransformWithRender) : target.style && !(0, _gsapCoreJs._isUndefined)(target.style[property]) ? _setterCSSStyle : ~property.indexOf("-") ? _setterCSSProp : (0, _gsapCoreJs._getSetter)(target, property); 5385 }, 5386 core: { 5387 _removeProperty: _removeProperty, 5388 _getMatrix: _getMatrix 5389 } 5390}; 5391(0, _gsapCoreJs.gsap).utils.checkPrefix = _checkPropPrefix; 5392(0, _gsapCoreJs.gsap).core.getStyleSaver = _getStyleSaver; 5393(function(positionAndScale, rotation, others, aliases) { 5394 var all = (0, _gsapCoreJs._forEachName)(positionAndScale + "," + rotation + "," + others, function(name) { 5395 _transformProps[name] = 1; 5396 }); 5397 (0, _gsapCoreJs._forEachName)(rotation, function(name) { 5398 (0, _gsapCoreJs._config).units[name] = "deg"; 5399 _rotationalProperties[name] = 1; 5400 }); 5401 _propertyAliases[all[13]] = positionAndScale + "," + rotation; 5402 (0, _gsapCoreJs._forEachName)(aliases, function(name) { 5403 var split = name.split(":"); 5404 _propertyAliases[split[1]] = all[split[0]]; 5405 }); 5406})("x,y,z,scale,scaleX,scaleY,xPercent,yPercent", "rotation,rotationX,rotationY,skewX,skewY", "transform,transformOrigin,svgOrigin,force3D,smoothOrigin,transformPerspective", "0:translateX,1:translateY,2:translateZ,8:rotate,8:rotationZ,8:rotateZ,9:rotateX,10:rotateY"); 5407(0, _gsapCoreJs._forEachName)("x,y,z,top,right,bottom,left,width,height,fontSize,padding,margin,perspective", function(name) { 5408 (0, _gsapCoreJs._config).units[name] = "px"; 5409}); 5410(0, _gsapCoreJs.gsap).registerPlugin(CSSPlugin); 5411 5412},{"./gsap-core.js":"gljYa","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"kNbRi":[function(require,module,exports,__globalThis) { 5413/*! 5414 * ScrollToPlugin 3.13.0 5415 * https://gsap.com 5416 * 5417 * @license Copyright 2008-2025, GreenSock. All rights reserved. 5418 * Subject to the terms at https://gsap.com/standard-license 5419 * @author: Jack Doyle, [email protected] 5420*/ /* eslint-disable */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 5421parcelHelpers.defineInteropFlag(exports); 5422parcelHelpers.export(exports, "ScrollToPlugin", ()=>ScrollToPlugin); 5423parcelHelpers.export(exports, "default", ()=>ScrollToPlugin); 5424var gsap, _coreInitted, _window, _docEl, _body, _toArray, _config, ScrollTrigger, _windowExists = function _windowExists() { 5425 return typeof window !== "undefined"; 5426}, _getGSAP = function _getGSAP() { 5427 return gsap || _windowExists() && (gsap = window.gsap) && gsap.registerPlugin && gsap; 5428}, _isString = function _isString(value) { 5429 return typeof value === "string"; 5430}, _isFunction = function _isFunction(value) { 5431 return typeof value === "function"; 5432}, _max = function _max(element, axis) { 5433 var dim = axis === "x" ? "Width" : "Height", scroll = "scroll" + dim, client = "client" + dim; 5434 return element === _window || element === _docEl || element === _body ? Math.max(_docEl[scroll], _body[scroll]) - (_window["inner" + dim] || _docEl[client] || _body[client]) : element[scroll] - element["offset" + dim]; 5435}, _buildGetter = function _buildGetter(e, axis) { 5436 //pass in an element and an axis ("x" or "y") and it'll return a getter function for the scroll position of that element (like scrollTop or scrollLeft, although if the element is the window, it'll use the pageXOffset/pageYOffset or the documentElement's scrollTop/scrollLeft or document.body's. Basically this streamlines things and makes a very fast getter across browsers. 5437 var p = "scroll" + (axis === "x" ? "Left" : "Top"); 5438 if (e === _window) { 5439 if (e.pageXOffset != null) p = "page" + axis.toUpperCase() + "Offset"; 5440 else e = _docEl[p] != null ? _docEl : _body; 5441 } 5442 return function() { 5443 return e[p]; 5444 }; 5445}, _clean = function _clean(value, index, target, targets) { 5446 _isFunction(value) && (value = value(index, target, targets)); 5447 if (typeof value !== "object") return _isString(value) && value !== "max" && value.charAt(1) !== "=" ? { 5448 x: value, 5449 y: value 5450 } : { 5451 y: value 5452 }; //if we don't receive an object as the parameter, assume the user intends "y". 5453 else if (value.nodeType) return { 5454 y: value, 5455 x: value 5456 }; 5457 else { 5458 var result = {}, p; 5459 for(p in value)result[p] = p !== "onAutoKill" && _isFunction(value[p]) ? value[p](index, target, targets) : value[p]; 5460 return result; 5461 } 5462}, _getOffset = function _getOffset(element, container) { 5463 element = _toArray(element)[0]; 5464 if (!element || !element.getBoundingClientRect) return console.warn("scrollTo target doesn't exist. Using 0") || { 5465 x: 0, 5466 y: 0 5467 }; 5468 var rect = element.getBoundingClientRect(), isRoot = !container || container === _window || container === _body, cRect = isRoot ? { 5469 top: _docEl.clientTop - (_window.pageYOffset || _docEl.scrollTop || _body.scrollTop || 0), 5470 left: _docEl.clientLeft - (_window.pageXOffset || _docEl.scrollLeft || _body.scrollLeft || 0) 5471 } : container.getBoundingClientRect(), offsets = { 5472 x: rect.left - cRect.left, 5473 y: rect.top - cRect.top 5474 }; 5475 if (!isRoot && container) { 5476 //only add the current scroll position if it's not the window/body. 5477 offsets.x += _buildGetter(container, "x")(); 5478 offsets.y += _buildGetter(container, "y")(); 5479 } 5480 return offsets; 5481}, _parseVal = function _parseVal(value, target, axis, currentVal, offset) { 5482 return !isNaN(value) && typeof value !== "object" ? parseFloat(value) - offset : _isString(value) && value.charAt(1) === "=" ? parseFloat(value.substr(2)) * (value.charAt(0) === "-" ? -1 : 1) + currentVal - offset : value === "max" ? _max(target, axis) - offset : Math.min(_max(target, axis), _getOffset(value, target)[axis] - offset); 5483}, _initCore = function _initCore() { 5484 gsap = _getGSAP(); 5485 if (_windowExists() && gsap && typeof document !== "undefined" && document.body) { 5486 _window = window; 5487 _body = document.body; 5488 _docEl = document.documentElement; 5489 _toArray = gsap.utils.toArray; 5490 gsap.config({ 5491 autoKillThreshold: 7 5492 }); 5493 _config = gsap.config(); 5494 _coreInitted = 1; 5495 } 5496}; 5497var ScrollToPlugin = { 5498 version: "3.13.0", 5499 name: "scrollTo", 5500 rawVars: 1, 5501 register: function register(core) { 5502 gsap = core; 5503 _initCore(); 5504 }, 5505 init: function init(target, value, tween, index, targets) { 5506 _coreInitted || _initCore(); 5507 var data = this, snapType = gsap.getProperty(target, "scrollSnapType"); 5508 data.isWin = target === _window; 5509 data.target = target; 5510 data.tween = tween; 5511 value = _clean(value, index, target, targets); 5512 data.vars = value; 5513 data.autoKill = !!("autoKill" in value ? value : _config).autoKill; 5514 data.getX = _buildGetter(target, "x"); 5515 data.getY = _buildGetter(target, "y"); 5516 data.x = data.xPrev = data.getX(); 5517 data.y = data.yPrev = data.getY(); 5518 ScrollTrigger || (ScrollTrigger = gsap.core.globals().ScrollTrigger); 5519 gsap.getProperty(target, "scrollBehavior") === "smooth" && gsap.set(target, { 5520 scrollBehavior: "auto" 5521 }); 5522 if (snapType && snapType !== "none") { 5523 // disable scroll snapping to avoid strange behavior 5524 data.snap = 1; 5525 data.snapInline = target.style.scrollSnapType; 5526 target.style.scrollSnapType = "none"; 5527 } 5528 if (value.x != null) { 5529 data.add(data, "x", data.x, _parseVal(value.x, target, "x", data.x, value.offsetX || 0), index, targets); 5530 data._props.push("scrollTo_x"); 5531 } else data.skipX = 1; 5532 if (value.y != null) { 5533 data.add(data, "y", data.y, _parseVal(value.y, target, "y", data.y, value.offsetY || 0
5533), index, targets); 5534 data._props.push("scrollTo_y"); 5535 } else data.skipY = 1; 5536 }, 5537 render: function render(ratio, data) { 5538 var pt = data._pt, target = data.target, tween = data.tween, autoKill = data.autoKill, xPrev = data.xPrev, yPrev = data.yPrev, isWin = data.isWin, snap = data.snap, snapInline = data.snapInline, x, y, yDif, xDif, threshold; 5539 while(pt){ 5540 pt.r(ratio, pt.d); 5541 pt = pt._next; 5542 } 5543 x = isWin || !data.skipX ? data.getX() : xPrev; 5544 y = isWin || !data.skipY ? data.getY() : yPrev; 5545 yDif = y - yPrev; 5546 xDif = x - xPrev; 5547 threshold = _config.autoKillThreshold; 5548 if (data.x < 0) //can't scroll to a position less than 0! Might happen if someone uses a Back.easeOut or Elastic.easeOut when scrolling back to the top of the page (for example) 5549 data.x = 0; 5550 if (data.y < 0) data.y = 0; 5551 if (autoKill) { 5552 //note: iOS has a bug that throws off the scroll by several pixels, so we need to check if it's within 7 pixels of the previous one that we set instead of just looking for an exact match. 5553 if (!data.skipX && (xDif > threshold || xDif < -threshold) && x < _max(target, "x")) data.skipX = 1; //if the user scrolls separately, we should stop tweening! 5554 if (!data.skipY && (yDif > threshold || yDif < -threshold) && y < _max(target, "y")) data.skipY = 1; //if the user scrolls separately, we should stop tweening! 5555 if (data.skipX && data.skipY) { 5556 tween.kill(); 5557 data.vars.onAutoKill && data.vars.onAutoKill.apply(tween, data.vars.onAutoKillParams || []); 5558 } 5559 } 5560 if (isWin) _window.scrollTo(!data.skipX ? data.x : x, !data.skipY ? data.y : y); 5561 else { 5562 data.skipY || (target.scrollTop = data.y); 5563 data.skipX || (target.scrollLeft = data.x); 5564 } 5565 if (snap && (ratio === 1 || ratio === 0)) { 5566 y = target.scrollTop; 5567 x = target.scrollLeft; 5568 snapInline ? target.style.scrollSnapType = snapInline : target.style.removeProperty("scroll-snap-type"); 5569 target.scrollTop = y + 1; // bug in Safari causes the element to totally reset its scroll position when scroll-snap-type changes, so we need to set it to a slightly different value and then back again to work around this bug. 5570 target.scrollLeft = x + 1; 5571 target.scrollTop = y; 5572 target.scrollLeft = x; 5573 } 5574 data.xPrev = data.x; 5575 data.yPrev = data.y;
5576 ScrollTrigger && ScrollTrigger.update(); 5577 }, 5578 kill: function kill(property) { 5579 var both = property === "scrollTo", i = this._props.indexOf(property); 5580 if (both || property === "scrollTo_x") this.skipX = 1; 5581 if (both || property === "scrollTo_y") this.skipY = 1; 5582 i > -1 && this._props.splice(i, 1); 5583 return !this._props.length; 5584 } 5585}; 5586ScrollToPlugin.max = _max; 5587ScrollToPlugin.getOffset = _getOffset; 5588ScrollToPlugin.buildGetter = _buildGetter; 5589ScrollToPlugin.config = function(vars) { 5590 _config || _initCore() || (_config = gsap.config()); // in case the window hasn't been defined yet. 5591 for(var p in vars)_config[p] = vars[p]; 5592}; 5593_getGSAP() && gsap.registerPlugin(ScrollToPlugin); 5594 5595},{"@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"gP0kv":[function(require,module,exports,__globalThis) { 5596var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 5597parcelHelpers.defineInteropFlag(exports); 5598parcelHelpers.export(exports, "closePopup", ()=>closePopup); 5599parcelHelpers.export(exports, "openPopup", ()=>openPopup); 5600var _swiperBundle = require("swiper/swiper-bundle"); 5601var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 5602var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 5603var _utilitiesJs = require("../helpers/utilities.js"); 5604var _accessibility = require("../helpers/accessibility"); 5605let focusTrap = null; 5606let globalTriggerElement = null; // Store the element that opened the popup 5607let resetReservationsBookingFlow = ()=>{}; 5608let applyReservationsPopupOpenState = ()=>{}; 5609const openOT = ()=>{ 5610 const otButtons = document.querySelectorAll('.js__open-ot'); 5611 if (otButtons) otButtons.forEach((otButton)=>{ 5612 otButton.addEventListener('click', (event)=>{ 5613 event.preventDefault(); 5614 let otUrl = 'https://www.opentable.com/restref/client/?rid=' + otButton.dataset.rid + '&restref=' + otButton.dataset.rid; 5615 window.open(otUrl, '_blank'); 5616 }); 5617 }); 5618}; 5619const closePopupsButtonWatcher = ()=>{ 5620 //Close popup 5621 const closePopupLinksOnPage = document.querySelectorAll('.js-close-popups'); //Get all popup links on page 5622 if (closePopupLinksOnPage.length > 0) //Check if there are any links first 5623 closePopupLinksOnPage.forEach((closePopupLink)=>{ 5624 //Loop through each and give it a onclick event listener 5625 closePopupLink.addEventListener('click', (event)=>{ 5626 event.preventDefault(); //Stop the link firing normally ! 5627 // Pause all video elements 5628 const videoElements = document.querySelectorAll('.popup video'); 5629 if (videoElements.length > 0) videoElements.forEach((videoElement)=>{ 5630 videoElement.pause(); 5631 videoElement.muted = true; 5632 }); 5633 closeAllPopups(); 5634 document.querySelector('body').classList.remove('js-popup-active'); 5635 document.querySelector('body').dataset.popup = ''; 5636 document.querySelector('body').dataset.popupType = ''; 5637 document.querySelector('body').dataset.popupStyle = ''; 5638 if (document.querySelector('.header__main-logo').style.opacity == '0') { 5639 document.querySelector('.header__main-logo').style.opacity = '1'; 5640 document.querySelector('.header__main-logo').style.pointerEvents = 'auto'; 5641 } 5642 if (document.querySelector('.header__main-buttons').style.opacity == '0') { 5643 document.querySelector('.header__main-buttons').style.opacity = '1'; 5644 document.querySelector('.header__main-buttons').style.pointerEvents = 'auto'; 5645 } 5646 }); 5647 }); 5648 //Close popup on esc key press 5649 document.addEventListener('keyup', (event)=>{ 5650 if (event.key === 'Escape') { 5651 if (document.querySelector('.popup.active')) { 5652 // Pause all video elements 5653 const videoElements = document.querySelectorAll('.popup video'); 5654 if (videoElements.length > 0) videoElements.forEach((videoElement)=>{ 5655 videoElement.pause(); 5656 videoElement.muted = true; 5657 }); 5658 closeAllPopups(); 5659 closePopup(); 5660 } 5661 } 5662 }); 5663 // Close main nav popup if screen size goes above 992px 5664 mobileOnlyPopupCloseWatcher(); 5665 window.addEventListener('resize', mobileOnlyPopupCloseWatcher); 5666}; 5667function mobileOnlyPopupCloseWatcher() { 5668 if (window.innerWidth >= 992) { 5669 // Close main nav popup 5670 closePopup('#main-nav'); 5671 // Close menu dietary filters popup 5672 closePopup('#menu-dietary-filters'); 5673 } 5674} 5675const closePopup = (popupId = null)=>{ 5676 if (popupId) { 5677 const popup = document.querySelector(popupId); 5678 if (popup) { 5679 popup.classList.remove('active'); 5680 // add inert attribute to popup 5681 popup.setAttribute('inert', ''); 5682 // change aria-hidden attribute to true 5683 popup.setAttribute('aria-hidden', 'true'); 5684 // Update aria-expanded on buttons that trigger this popup 5685 updatePopupButtonsAriaExpanded(popupId, false); 5686 } 5687 } 5688 console.log(globalTriggerElement); 5689 // Restore focus to the trigger element 5690 const focusTriggerElement = document.querySelector(`[data-tabid="${globalTriggerElement}"]`); 5691 if (focusTriggerElement) focusTriggerElement.focus(); 5692 // cleanup focus trap 5693 if (focusTrap) cleanupFocusTrap(); 5694 document.querySelector('body').classList.remove('js-popup-active'); 5695 document.querySelector('body').dataset.popup = ''; 5696 document.querySelector('body').dataset.popupType = ''; 5697 document.querySelector('body').dataset.popupStyle = ''; 5698}; 5699const openPopup = (targetPopupID, triggerElement = null)=>{ 5700 // Store the trigger element for focus restoration 5701 if (triggerElement) globalTriggerElement = triggerElement; 5702 console.log(globalTriggerElement); 5703 var targetPopup = document.querySelector(targetPopupID); //Select the popup 5704 if (targetPopup) { 5705 //Check we have a valid target popup 5706 //Scroll to the top of the page 5707 const jsBody = document.querySelector('#js-body'); 5708 // remove inert attribute from target popup 5709 targetPopup.removeAttribute('inert'); 5710 // change aria-hidden attribute to false 5711 targetPopup.setAttribute('aria-hidden', 'false'); 5712 // Update aria-expanded on buttons that trigger this popup 5713 updatePopupButtonsAriaExpanded(targetPopupID, true); 5714 // focus on target popup 5715 // const focusable elements = targetPopup.querySelectorAll('button, input, textarea, select, a'); 5716 if (targetPopupID == '#main-nav' && document.querySelector('body').classList.contains('js-popup-active')) { 5717 //If target popup is the main nav, and there's already a popup active, this is a click on the hamburger so treat it as the close button 5718 closeAllPopups(); 5719 closePopup(); 5720 } else { 5721 //Otherwise open the popup as normal 5722 closeAllPopups(); //Make sure no popups are currently open 5723 targetPopup.classList.add('active'); //Activate the popup! 5724 document.querySelector('body').classList.add('js-popup-active');
5724 //Add class to body to show popup is open 5725 document.querySelector('body').dataset.popup = targetPopupID; 5726 if (targetPopupID == '#gallery-popup' || targetPopupID == '#amenities-popup') { 5727 document.querySelector('.header__main-logo').style.opacity = '0'; 5728 document.querySelector('.header__main-buttons').style.opacity = '0'; 5729 document.querySelector('.header__main-logo').style.pointerEvents = 'none'; 5730 document.querySelector('.header__main-buttons').style.pointerEvents = 'none'; 5731 } 5732 let popupType; 5733 let popupStyle = 'full'; 5734 switch(targetPopupID){ 5735 case '#main-nav': 5736 popupType = 'main-nav'; 5737 break; 5738 case '#reservations': 5739 popupType = 'reservations'; 5740 break; 5741 case '#menu-dietary-filters': 5742 popupType = 'menu-dietary-filters'; 5743 break; 5744 case '#menu-filters': 5745 popupType = 'menu-filters'; 5746 break; 5747 case '#newsletter': 5748 popupType = 'newsletter'; 5749 break; 5750 case '#restaurant-reservations': 5751 popupType = 'restaurant-reservations'; 5752 break; 5753 case '#event-spaces-enquiry': 5754 popupType = 'event-spaces-enquiry'; 5755 break; 5756 case '#amenities-popup': 5757 popupType = 'amenities'; 5758 break; 5759 case '#gallery-popup': 5760 popupType = 'gallery'; 5761 break; 5762 case '#embed-popup': 5763 popupType = 'embed'; 5764 break; 5765 default: 5766 popupType = 'custom-popup'; 5767 } 5768 if (popupType == 'custom-popup') popupStyle = document.querySelector(targetPopupID).classList.contains('custom-popup--narrow') ? 'narrow' : 'full'; 5769 if (targetPopupID === '#reservations') applyReservationsPopupOpenState(triggerElement); 5770 const focusableElements = targetPopup.querySelectorAll('button, input:not([type="hidden"]), textarea, select, a, [tabindex]:not([tabindex="-1"])'); 5771 if (focusableElements.length > 0) focusableElements[0].focus(); 5772 focusTrap = trapFocusDynamic(targetPopup); 5773 document.querySelector('body').dataset.popupType = popupType; 5774 document.querySelector('body').dataset.popupStyle = popupStyle; 5775 // Update the header popup trigger text to say close 5776 const headerPopupTrigger = document.querySelector('.js-header-popup-trigger'); 5777 if (headerPopupTrigger) headerPopupTrigger.textContent = 'Close'; 5778 } 5779 } else console.warn('Missing Popup: ' + targetPopupID); 5780}; 5781const closeAllPopups = ()=>{ 5782 var openPopups = document.querySelectorAll('.popup.active'); 5783 if (openPopups.length > 0) openPopups.forEach((openPopup)=>{ 5784 // add inert attribute to popup 5785 openPopup.setAttribute('inert', ''); 5786 // change aria-hidden attribute to true 5787 openPopup.setAttribute('aria-hidden', 'true'); 5788 openPopup.classList.remove('active'); 5789 // Update aria-expanded on buttons that trigger this popup 5790 const popupId = '#' + openPopup.id; 5791 updatePopupButtonsAriaExpanded(popupId, false); 5792 // cleanup focus trap 5793 if (focusTrap) cleanupFocusTrap(); 5794 }); 5795 // Update the header popup trigger text to say menu 5796 const headerPopupTrigger = document.querySelector('.js-header-popup-trigger'); 5797 if (headerPopupTrigger) headerPopupTrigger.textContent = 'Menu'; 5798 const focusTriggerElement = document.querySelector(`[data-tabid="${globalTriggerElement}"]`); 5799 if (focusTriggerElement) focusTriggerElement.focus(); 5800}; 5801const triggerCustomPopups = ()=>{ 5802 //Function to launch any custom popups 5803 let customPopups = document.querySelectorAll('.popup.custom-popup'); 5804 if (customPopups.length > 0) //Check if there are any links first 5805 customPopups.forEach((customPopup)=>{ 5806 let displayType = customPopup.dataset.type, displayPages = customPopup.dataset.pages, displayPeriod = customPopup.dataset.period, currentPageID = document.querySelector('#js-body').dataset.page, triggerPopup = false;
5807 console.log(displayType, displayPages, displayPeriod, currentPageID); 5808 if (displayType != 'trigger') { 5809 //Ignore if manually triggered 5810 //First check if the visitor already has the cookie, or if the popup is set to always display 5811 if (displayPeriod == 0) triggerPopup = true; 5812 else { 5813 let hasCookie = (0, _utilitiesJs.getCookie)(customPopup.getAttribute('id')); 5814 if (hasCookie) ; 5815 else triggerPopup = true; 5816 } 5817 //If we're in the trigger period, check to see if we're on the right page 5818 if (triggerPopup) { 5819 //No point continuing if they failed the period check! 5820 if (displayType == 'all') triggerPopup = true; 5821 else if (displayType == 'exclude' && !displayPages.includes(currentPageID) && currentPageID != '') triggerPopup = true; 5822 else if (displayType == 'include' && displayPages.includes(currentPageID) && currentPageID != '') triggerPopup = true; 5823 else triggerPopup = false; 5824 } 5825 if (triggerPopup) { 5826 //Show the popup and add a cookie if needed 5827 openPopup('#' + customPopup.getAttribute('id')); 5828 if (displayPeriod >
5828 0) (0, _utilitiesJs.setCookie)(customPopup.getAttribute('id'), true, displayPeriod); 5829 } 5830 } 5831 }); 5832}; 5833// Helper function to update aria-expanded on popup trigger buttons 5834const updatePopupButtonsAriaExpanded = (popupId, isExpanded)=>{ 5835 // Map popup IDs to their corresponding href patterns 5836 const popupMap = { 5837 '#reservations': '#book', 5838 '#restaurant-reservations': '#restaurant-booking', 5839 '#newsletter': '#newsletter', 5840 '#event-spaces-enquiry': '#event-spaces-enquiry', 5841 '#main-nav': '#main-nav', 5842 '#amenities-popup': '#amenities-popup', 5843 '#gallery-popup': '#gallery-popup', 5844 '#embed-popup': '#embed-popup', 5845 '#menu-dietary-filters': '#menu-dietary-filters', 5846 '#menu-filters': '#menu-filters' 5847 }; 5848 const hrefPattern = popupMap[popupId] || popupId; 5849 // Find all buttons/links that trigger this popup 5850 const triggerButtons = document.querySelectorAll(`a[href^="${hrefPattern}"]`); 5851 triggerButtons.forEach((button)=>{ 5852 button.setAttribute('aria-expanded', isExpanded ? 'true' : 'false'); 5853 }); 5854 // Also handle custom popup buttons with #popup: prefix 5855 if (!popupMap[popupId]) { 5856 const customPopupButtons = document.querySelectorAll(`a[href*="#popup:${popupId.replace('#', '')}"]`); 5857 customPopupButtons.forEach((button)=>{ 5858 button.setAttribute('aria-expanded', isExpanded ? 'true' : 'false'); 5859 }); 5860 } 5861}; 5862// Initialize accessibility attributes on all popup trigger buttons 5863const initPopupButtonsAccessibility = ()=>{ 5864 const popupTriggerSelectors = [ 5865 'a[href^="#book"]', 5866 'a[href^="#restaurant-booking"]', 5867 'a[href^="#newsletter"]', 5868 'a[href^="#event-spaces-enquiry"]', 5869 'a[href^="#main-nav"]', 5870 'a[href^="#amenities-popup"]', 5871 'a[href^="#gallery-popup"]', 5872 'a[href^="#embed-popup"]', 5873 'a[href^="#menu-dietary-filters"]', 5874 'a[href^="#menu-filters"]', 5875 'a[href*="#popup:"]' 5876 ]; 5877 popupTriggerSelectors.forEach((selector)=>{ 5878 const buttons = document.querySelectorAll(selector); 5879 buttons.forEach((button)=>{ 5880 (0, _accessibility.fixPopupButtonAccessibility)(button); 5881 }); 5882 }); 5883}; 5884// Initialize on load 5885initPopupButtonsAccessibility(); 5886const trapFocusDynamic = (popup)=>{ 5887 const handleKeyDown = (e)=>{ 5888 if (e.key !== 'Tab') return; 5889 // Always re-query visible focusable elements 5890 const focusableSelectors = 'a, button, input:not([type="hidden"]), textarea, select, [tabindex]:not([tabindex="-1"])'; 5891 const focusableEls = Array.from(popup.querySelectorAll(focusableSelectors)).filter((el)=>!el.disabled && el.offsetParent !== null); 5892 if (!focusableEls.length) return; 5893 const firstEl = focusableEls[0]; 5894 const lastEl = focusableEls[focusableEls.length - 1]; 5895 if (e.shiftKey) { 5896 if (document.activeElement === firstEl) { 5897 e.preventDefault(); 5898 lastEl.focus(); 5899 } 5900 } else if (document.activeElement === lastEl) { 5901 e.preventDefault(); 5902 firstEl.focus(); 5903 } 5904 }; 5905 popup.addEventListener('keydown', handleKeyDown); 5906 // Return cleanup function 5907 return ()=>{ 5908 popup.removeEventListener('keydown', handleKeyDown); 5909 }; 5910}; 5911const cleanupFocusTrap = ()=>{ 5912 if (focusTrap) { 5913 focusTrap(); // Call the cleanup function to remove event listener 5914 focusTrap = null; 5915 } 5916}; 5917const FOCUSABLE_IN_DOCUMENT_SELECTOR = 'button:not([disabled]), input:not([type="hidden"]):not([disabled]), textarea:not([disabled]), select:not([disabled]), a[href], [tabindex]:not([tabindex="-1"])'; 5918/** 5919 * Focus the first visible focusable element inside an iframe when same-origin; 5920 * otherwise focus the iframe element so keyboard entry can reach embedded content. 5921 */ const focusFirstFocusableInIframe = (iframeEl)=>{ 5922 try { 5923 const doc = iframeEl.contentDocument || iframeEl.contentWindow?.document; 5924 if (!doc?.body) { 5925 iframeEl.focus(); 5926 return; 5927 } 5928 const candidates = doc.querySelectorAll(FOCUSABLE_IN_DOCUMENT_SELECTOR); 5929 for (const el of candidates){ 5930 if (el.disabled) continue; 5931 if (el.offsetParent === null && el.tagName !== 'BODY' && el.tagName !== 'HTML') continue; 5932 if (typeof el.focus === 'function') { 5933 el.focus(); 5934 return; 5935 } 5936 }
5937 iframeEl.focus(); 5938 } catch { 5939 iframeEl.focus(); 5940 } 5941}; 5942const initReservationsSevenroomsIframe = ()=>{ 5943 const popup = document.querySelector('#reservations'); 5944 if (!popup) return; 5945 const select = popup.querySelector('.js-loc-dropdown-container'); 5946 const iframe = popup.querySelector('.js-booking-sevenrooms-iframe'); 5947 const stepSelect = popup.querySelector('.js-booking-step-select'); 5948 const stepIframe = popup.querySelector('.js-booking-step-iframe'); 5949 const loader = popup.querySelector('.js-booking-iframe-loader'); 5950 const backBtn = popup.querySelector('.js-booking-back'); 5951 if (!select || !iframe || !stepSelect || !stepIframe || !loader || !backBtn) return; 5952 let iframeLoadToken = 0; 5953 const hideBookingLoader = ()=>{ 5954 loader.hidden = true; 5955 }; 5956 const showBookingLoader = ()=>{ 5957 loader.hidden = false; 5958 }; 5959 const showSelectStep = ()=>{ 5960 iframeLoadToken += 1; 5961 hideBookingLoader(); 5962 stepSelect.hidden = false; 5963 stepIframe.hidden = true; 5964 backBtn.hidden = true; 5965 iframe.removeAttribute('src'); 5966 select.value = ''; 5967 }; 5968 const showIframeStep = (url)=>{ 5969 iframeLoadToken += 1; 5970 const token = iframeLoadToken; 5971 stepSelect.hidden = true; 5972 stepIframe.hidden = false; 5973 backBtn.hidden = false; 5974 showBookingLoader(); 5975 let safetyTimeoutId = null; 5976 const clearSafetyTimeout = ()=>{ 5977 if (safetyTimeoutId !== null) { 5978 window.clearTimeout(safetyTimeoutId); 5979 safetyTimeoutId = null; 5980 } 5981 }; 5982 const onIframeLoad = ()=>{ 5983 if (token !== iframeLoadToken) return; 5984 clearSafetyTimeout(); 5985 hideBookingLoader(); 5986 requestAnimationFrame(()=>focusFirstFocusableInIframe(iframe)); 5987 }; 5988 const onIframeError = ()=>{ 5989 if (token !== iframeLoadToken) return; 5990 clearSafetyTimeout(); 5991 hideBookingLoader(); 5992 requestAnimationFrame(()=>backBtn.focus()); 5993 }; 5994 // Attach before setting src â fast/cached loads (common when third-party cookies 5995 // are blocked) can fire `load` synchronously and would be missed otherwise. 5996 iframe.addEventListener('load', onIframeLoad, { 5997 once: true 5998 }); 5999 iframe.addEventListener('error', onIframeError, { 6000 once: true 6001 }); 6002 iframe.src = url; 6003 safetyTimeoutId = window.setTimeout(()=>{ 6004 if (token !== iframeLoadToken) return; 6005 hideBookingLoader(); 6006 }, 15000); 6007 }; 6008 resetReservationsBookingFlow = showSelectStep; 6009 applyReservationsPopupOpenState = (triggerElement)=>{ 6010 let directUrl; 6011 if (triggerElement && typeof triggerElement === 'string') { 6012 const el = document.querySelector(`[data-tabid="${triggerElement}"]`); 6013 directUrl = el?.dataset?.sevenroomsSrc; 6014 } else if (triggerElement?.dataset?.sevenroomsSrc) directUrl = triggerElement.dataset.sevenroomsSrc; 6015 if (directUrl) showIframeStep(directUrl); 6016 else showSelectStep(); 6017 }; 6018 select.addEventListener('change', ()=>{ 6019 const opt = select.selectedOptions[0]; 6020 const url = opt?.dataset?.sevenroomsSrc; 6021 if (url) showIframeStep(url); 6022 }); 6023 backBtn.addEventListener('click', (e)=>{ 6024 e.preventDefault(); 6025 showSelectStep(); 6026 requestAnimationFrame(()=>select.focus()); 6027 }); 6028}; 6029closePopupsButtonWatcher(); 6030triggerCustomPopups(); 6031openOT(); 6032initReservationsSevenroomsIframe(); 6033 6034},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","../helpers/utilities.js":"dH8qc","../helpers/accessibility":"7yMoe","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"8HSYe":[function(require,module,exports,__globalThis) { 6035/** 6036 * Swiper 8.4.7 6037 * Most modern mobile touch slider and framework with hardware accelerated transitions 6038 * https://swiperjs.com 6039 * 6040 * Copyright 2014-2023 Vladimir Kharlampidi 6041 * 6042 * Released under the MIT License 6043 * 6044 * Released on: January 30, 2023 6045 */ (function(global, factory) { 6046 module.exports = factory(); 6047})(this, function() { 6048 'use strict'; 6049 /** 6050 * SSR Window 4.0.2 6051 * Better handling for window object in SSR environment 6052 * https://github.com/nolimits4web/ssr-window 6053 * 6054 * Copyright 2021, Vladimir Kharlampidi 6055 * 6056 * Licensed under MIT 6057 * 6058 * Released on: December 13, 2021 6059 */ /* eslint-disable no-param-reassign */ function isObject$1(obj) { 6060 return obj !== null && typeof obj === 'object' && 'constructor' in obj && obj.constructor === Object; 6061 }
vendor: 4,467 bytes, lines 6062-6227
6062 function extend$1(target, src) { 6063 if (target === void 0) target = {}; 6064 if (src === void 0) src = {}; 6065 Object.keys(src).forEach((key)=>{ 6066 if (typeof target[key] === 'undefined') target[key] = src[key]; 6067 else if (isObject$1(src[key]) && isObject$1(target[key]) && Object.keys(src[key]).length > 0) extend$1(target[key], src[key]); 6068 }); 6069 } 6070 const ssrDocument = { 6071 body: {}, 6072 addEventListener () {}, 6073 removeEventListener () {}, 6074 activeElement: { 6075 blur () {}, 6076 nodeName: '' 6077 }, 6078 querySelector () { 6079 return null; 6080 }, 6081 querySelectorAll () { 6082 return []; 6083 }, 6084 getElementById () { 6085 return null; 6086 }, 6087 createEvent () { 6088 return { 6089 initEvent () {} 6090 }; 6091 }, 6092 createElement () { 6093 return { 6094 children: [], 6095 childNodes: [], 6096 style: {}, 6097 setAttribute () {}, 6098 getElementsByTagName () { 6099 return []; 6100 } 6101 }; 6102 }, 6103 createElementNS () { 6104 return {}; 6105 }, 6106 importNode () { 6107 return null; 6108 }, 6109 location: { 6110 hash: '', 6111 host: '', 6112 hostname: '', 6113 href: '', 6114 origin: '', 6115 pathname: '', 6116 protocol: '', 6117 search: '' 6118 } 6119 }; 6120 function getDocument() { 6121 const doc = typeof document !== 'undefined' ? document : {}; 6122 extend$1(doc, ssrDocument); 6123 return doc; 6124 } 6125 const ssrWindow = { 6126 document: ssrDocument, 6127 navigator: { 6128 userAgent: '' 6129 }, 6130 location: { 6131 hash: '', 6132 host: '', 6133 hostname: '', 6134 href: '', 6135 origin: '', 6136 pathname: '', 6137 protocol: '', 6138 search: '' 6139 }, 6140 history: { 6141 replaceState () {}, 6142 pushState () {}, 6143 go () {}, 6144 back () {} 6145 }, 6146 CustomEvent: function CustomEvent() { 6147 return this; 6148 }, 6149 addEventListener () {}, 6150 removeEventListener () {}, 6151 getComputedStyle () { 6152 return { 6153 getPropertyValue () { 6154 return ''; 6155 } 6156 }; 6157 }, 6158 Image () {}, 6159 Date () {}, 6160 screen: {}, 6161 setTimeout () {}, 6162 clearTimeout () {}, 6163 matchMedia () { 6164 return {}; 6165 }, 6166 requestAnimationFrame (callback) { 6167 if (typeof setTimeout === 'undefined') { 6168 callback(); 6169 return null; 6170 } 6171 return setTimeout(callback, 0); 6172 }, 6173 cancelAnimationFrame (id) { 6174 if (typeof setTimeout === 'undefined') return; 6175 clearTimeout(id); 6176 } 6177 }; 6178 function getWindow() { 6179 const win = typeof window !== 'undefined' ? window : {}; 6180 extend$1(win, ssrWindow); 6181 return win; 6182 } 6183 /** 6184 * Dom7 4.0.4 6185 * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API 6186 * https://framework7.io/docs/dom7.html 6187 * 6188 * Copyright 2022, Vladimir Kharlampidi 6189 * 6190 * Licensed under MIT 6191 * 6192 * Released on: January 11, 2022 6193 */ /* eslint-disable no-proto */ function makeReactive(obj) { 6194 const proto = obj.__proto__; 6195 Object.defineProperty(obj, '__proto__', { 6196 get () { 6197 return proto; 6198 }, 6199 set (value) { 6200 proto.__proto__ = value; 6201 } 6202 }); 6203 } 6204 class Dom7 extends Array { 6205 constructor(items){ 6206 if (typeof items === 'number') super(items); 6207 else { 6208 super(...items || []); 6209 makeReactive(this); 6210 } 6211 } 6212 } 6213 function arrayFlat(arr) { 6214 if (arr === void 0) arr = []; 6215 const res = []; 6216 arr.forEach((el)=>{ 6217 if (Array.isArray(el)) res.push(...arrayFlat(el)); 6218 else res.push(el); 6219 }); 6220 return res; 6221 } 6222 function arrayFilter(arr, callback) { 6223 return Array.prototype.filter.call(arr, callback); 6224 } 6225 function arrayUnique(arr) { 6226 const uniqueArray = []; 6227 for(let i = 0; i < arr.length;
6227 i += 1)if (uniqueArray.indexOf(arr[i]) === -1) uniqueArray.push(arr[i]); 6228 return uniqueArray; 6229 } 6230 function qsa(selector, context) { 6231 if (typeof selector !== 'string') return [ 6232 selector 6233 ]; 6234 const a = []; 6235 const res = context.querySelectorAll(selector); 6236 for(let i = 0; i < res.length; i += 1)a.push(res[i]); 6237 return a; 6238 } 6239 function $(selector, context) { 6240 const window1 = getWindow(); 6241 const document1 = getDocument(); 6242 let arr = []; 6243 if (!context && selector instanceof Dom7) return selector; 6244 if (!selector) return new Dom7(arr); 6245 if (typeof selector === 'string') { 6246 const html = selector.trim(); 6247 if (html.indexOf('<') >= 0 && html.indexOf('>') >= 0) { 6248 let toCreate = 'div'; 6249 if (html.indexOf('<li') === 0) toCreate = 'ul'; 6250 if (html.indexOf('<tr') === 0) toCreate = 'tbody'; 6251 if (html.indexOf('<td') === 0 || html.indexOf('<th') === 0) toCreate = 'tr'; 6252 if (html.indexOf('<tbody') === 0) toCreate = 'table'; 6253 if (html.indexOf('<option') === 0) toCreate = 'select'; 6254 const tempParent = document1.createElement(toCreate); 6255 tempParent.innerHTML = html; 6256 for(let i = 0; i < tempParent.childNodes.length; i += 1)arr.push(tempParent.childNodes[i]); 6257 } else arr = qsa(selector.trim(), context || document1); 6258 // arr = qsa(selector, document); 6259 } else if (selector.nodeType || selector === window1 || selector === document1) arr.push(selector); 6260 else if (Array.isArray(selector)) { 6261 if (selector instanceof Dom7) return selector; 6262 arr = selector; 6263 } 6264 return new Dom7(arrayUnique(arr)); 6265 } 6266 $.fn = Dom7.prototype; // eslint-disable-next-line 6267 function addClass() { 6268 for(var _len = arguments.length, classes = new Array(_len), _key = 0; _key < _len; _key++)classes[_key] = arguments[_key]; 6269 const classNames = arrayFlat(classes.map((c)=>c.split(' '))); 6270 this.forEach((el)=>{ 6271 el.classList.add(...classNames); 6272 }); 6273 return this; 6274 } 6275 function removeClass() { 6276 for(var _len2 = arguments.length, classes = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++)classes[_key2] = arguments[_key2]; 6277 const classNames = arrayFlat(classes.map((c)=>c.split(' '))); 6278 this.forEach((el)=>{ 6279 el.classList.remove(...classNames); 6280 }); 6281 return this; 6282 } 6283 function toggleClass() { 6284 for(var _len3 = arguments.length, classes = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++)classes[_key3] = arguments[_key3]; 6285 const classNames = arrayFlat(classes.map((c)=>c.split(' '))); 6286 this.forEach((el)=>{ 6287 classNames.forEach((className)=>{ 6288 el.classList.toggle(className); 6289 }); 6290 }); 6291 } 6292 function hasClass() { 6293 for(var _len4 = arguments.length, classes = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++)classes[_key4] = arguments[_key4]; 6294 const classNames = arrayFlat(classes.map((c)=>c.split(' '))); 6295 return arrayFilter(this, (el)=>{ 6296 return classNames.filter((className)=>el.classList.contains(className)).length > 0; 6297 }).length > 0; 6298 } 6299 function attr(attrs, value) { 6300 if (arguments.length === 1 && typeof attrs === 'string') { 6301 // Get attr 6302 if (this[0]) return this[0].getAttribute(attrs); 6303 return undefined; 6304 } // Set attrs 6305 for(let i = 0; i < this.length; i += 1){ 6306 if (arguments.length === 2) // String 6307 this[i].setAttribute(attrs, value); 6308 else // Object 6309 for(const attrName in attrs){ 6310 this[i][attrName] = attrs[attrName]; 6311 this[i].setAttribute(attrName, attrs[attrName]); 6312 } 6313 } 6314 return this; 6315 } 6316 function removeAttr(attr) { 6317 for(let i = 0; i < this.length; i += 1)this[i].removeAttribute(attr); 6318 return this; 6319 } 6320 function transform(transform) { 6321 for(let i = 0; i < this.length; i += 1)this[i].style.transform = transform; 6322 return this; 6323 } 6324 function transition$1(duration) { 6325 for(let i = 0; i < this.length; i += 1)this[i].style.transitionDuration = typeof duration !== 'string' ? `${duration}ms` : duration; 6326 return this; 6327 } 6328 function on() { 6329 for(var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++)args[_key5] = arguments[_key5]; 6330 let [eventType, targetSelector, listener, capture] = args; 6331 if (typeof args[1] === 'function') { 6332 [eventType, listener, capture] = args; 6333 targetSelector = undefined; 6334 } 6335 if (!capture) capture = false;
6336 function handleLiveEvent(e) { 6337 const target = e.target; 6338 if (!target) return; 6339 const eventData = e.target.dom7EventData || []; 6340 if (eventData.indexOf(e) < 0) eventData.unshift(e); 6341 if ($(target).is(targetSelector)) listener.apply(target, eventData); 6342 else { 6343 const parents = $(target).parents(); // eslint-disable-line 6344 for(let k = 0; k < parents.length; k += 1)if ($(parents[k]).is(targetSelector)) listener.apply(parents[k], eventData); 6345 } 6346 } 6347 function handleEvent(e) { 6348 const eventData = e && e.target ? e.target.dom7EventData || [] : []; 6349 if (eventData.indexOf(e) < 0) eventData.unshift(e); 6350 listener.apply(this, eventData); 6351 } 6352 const events = eventType.split(' '); 6353 let j; 6354 for(let i = 0; i < this.length; i += 1){ 6355 const el = this[i]; 6356 if (!targetSelector) for(j = 0; j < events.length; j += 1){ 6357 const event1 = events[j]; 6358 if (!el.dom7Listeners) el.dom7Listeners = {}; 6359 if (!el.dom7Listeners[event1]) el.dom7Listeners[event1] = []; 6360 el.dom7Listeners[event1].push({ 6361 listener, 6362 proxyListener: handleEvent 6363 }); 6364 el.addEventListener(event1, handleEvent, capture); 6365 } 6366 else // Live events 6367 for(j = 0; j < events.length; j += 1){ 6368 const event1 = events[j]; 6369 if (!el.dom7LiveListeners) el.dom7LiveListeners = {}; 6370 if (!el.dom7LiveListeners[event1]) el.dom7LiveListeners[event1] = []; 6371 el.dom7LiveListeners[event1].push({ 6372 listener, 6373 proxyListener: handleLiveEvent 6374 }); 6375 el.addEventListener(event1, handleLiveEvent, capture); 6376 } 6377 } 6378 return this; 6379 } 6380 function off() { 6381 for(var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++)args[_key6] = arguments[_key6]; 6382 let [eventType, targetSelector, listener, capture] = args; 6383 if (typeof args[1] === 'function') { 6384 [eventType, listener, capture] = args; 6385 targetSelector = undefined; 6386 } 6387 if (!capture) capture = false; 6388 const events = eventType.split(' '); 6389 for(let i = 0; i < events.length; i += 1){ 6390 const event1 = events[i]; 6391 for(let j = 0; j < this.length; j += 1){ 6392 const el = this[j]; 6393 let handlers; 6394 if (!targetSelector && el.dom7Listeners) handlers = el.dom7Listeners[event1]; 6395 else if (targetSelector && el.dom7LiveListeners) handlers = el.dom7LiveListeners[event1]; 6396 if (handlers && handlers.length) for(let k = handlers.length - 1; k >= 0; k -= 1){ 6397 const handler = handlers[k]; 6398 if (listener && handler.listener === listener) { 6399 el.removeEventListener(event1, handler.proxyListener, capture); 6400 handlers.splice(k, 1); 6401 } else if (listener && handler.listener && handler.listener.dom7proxy && handler.listener.dom7proxy === listener) { 6402 el.removeEventListener(event1, handler.proxyListener, capture); 6403 handlers.splice(k, 1); 6404 } else if (!listener) { 6405 el.removeEventListener(event1, handler.proxyListener, capture); 6406 handlers.splice(k, 1); 6407 } 6408 } 6409 } 6410 } 6411 return this; 6412 } 6413 function trigger() { 6414 const window1 = getWindow(); 6415 for(var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++)args[_key9] = arguments[_key9]; 6416 const events = args[0].split(' '); 6417 const eventData = args[1]; 6418 for(let i = 0; i < events.length; i += 1){ 6419 const event1 = events[i]; 6420 for(let j = 0; j < this.length; j += 1){ 6421 const el = this[j]; 6422 if (window1.CustomEvent) { 6423 const evt = new window1.CustomEvent(event1, { 6424 detail: eventData, 6425 bubbles: true, 6426 cancelable: true 6427 }); 6428 el.dom7EventData = args.filter((data, dataIndex)=>dataIndex > 0); 6429 el.dispatchEvent(evt); 6430 el.dom7EventData = []; 6431 delete el.dom7EventData; 6432 } 6433 } 6434 } 6435 return this; 6436 } 6437 function transitionEnd$1(callback) { 6438 const dom = this; 6439 function fireCallBack(e) { 6440 if (e.target !== this) return; 6441 callback.call(this, e); 6442 dom.off('transitionend', fireCallBack); 6443 } 6444 if (callback) dom.on('transitionend', fireCallBack); 6445 return this; 6446 } 6447 function outerWidth(includeMargins) { 6448 if (this.length > 0) { 6449 if (includeMargins) { 6450 const styles = this.styles(); 6451 return this[0].offsetWidth + parseFloat(styles.getPropertyValue('margin-right')) + parseFloat(styles.getPropertyValue('margin-left')); 6452 } 6453 return this[0].offsetWidth; 6454 } 6455 return null; 6456 } 6457 function outerHeight(includeMargins) { 6458 if (this.length > 0) { 6459 if (includeMargins) { 6460 const styles = this.styles(); 6461 return this[0].offsetHeight + parseFloat(styles.getPropertyValue('margin-top')) + parseFloat(styles.getPropertyValue('margin-bottom')); 6462 } 6463 return this[0].offsetHeight; 6464 } 6465 return null; 6466 } 6467 function offset() { 6468 if (this.length > 0) { 6469 const window1 = getWindow(); 6470 const document1 = getDocument(); 6471 const el = this[0]; 6472 const box = el.getBoundingClientRect(); 6473 const body = document1.body; 6474 const clientTop = el.clientTop || body.clientTop || 0; 6475 const clientLeft = el.clientLeft || body.clientLeft || 0; 6476 const scrollTop = el === window1 ? window1.scrollY : el.scrollTop; 6477 const scrollLeft = el === window1 ? window1.scrollX : el.scrollLeft; 6478 return { 6479 top: box.top + scrollTop - clientTop, 6480 left: box.left + scrollLeft - clientLeft 6481 }; 6482 } 6483 return null; 6484 } 6485 function styles() { 6486 const window1 = getWindow(); 6487 if (this[0]) return window1.getComputedStyle(this[0], null); 6488 return {}; 6489 } 6490 function css(props, value) { 6491 const window1 = getWindow(); 6492 let i; 6493 if (arguments.length === 1) { 6494 if (typeof props === 'string') { 6495 // .css('width') 6496 if (this[0]) return window1.getComputedStyle(this[0], null).getPropertyValue(props); 6497 } else { 6498 // .css({ width: '100px' }) 6499 for(i = 0; i < this.length; i += 1)for(const prop in props)this[i].style[prop] = props[prop]; 6500 return this; 6501 } 6502 } 6503 if (arguments.length === 2 && typeof props === 'string') { 6504 // .css('width', '100px') 6505 for(i = 0; i < this.length; i += 1)this[i].style[props] = value; 6506 return this; 6507 } 6508 return this; 6509 } 6510 function each(callback) { 6511 if (!callback) return this; 6512 this.forEach((el, index)=>{ 6513 callback.apply(el, [ 6514 el, 6515 index 6516 ]); 6517 }); 6518 return this; 6519 } 6520 function filter(callback) { 6521 const result = arrayFilter(this, callback); 6522 return $(result); 6523 } 6524 function html(html) { 6525 if (typeof html === 'undefined') return this[0] ? this[0].innerHTML : null; 6526 for(let i = 0; i < this.length; i += 1)this[i].innerHTML = html; 6527 return this; 6528 } 6529 function text(text) { 6530 if (typeof text === 'undefined') return this[0] ? this[0].textContent.trim() : null; 6531 for(let i = 0; i < this.length; i += 1)this[i].textContent = text; 6532 return this; 6533 } 6534 function is(selector) { 6535 const window1 = getWindow(); 6536 const document1 = getDocument(); 6537 const el = this[0]; 6538 let compareWith; 6539 let i; 6540 if (!el || typeof selector === 'undefined') return false;
6541 if (typeof selector === 'string') { 6542 if (el.matches) return el.matches(selector); 6543 if (el.webkitMatchesSelector) return el.webkitMatchesSelector(selector); 6544 if (el.msMatchesSelector) return el.msMatchesSelector(selector); 6545 compareWith = $(selector); 6546 for(i = 0; i < compareWith.length; i += 1){ 6547 if (compareWith[i] === el) return true; 6548 } 6549 return false; 6550 } 6551 if (selector === document1) return el === document1; 6552 if (selector === window1) return el === window1; 6553 if (selector.nodeType || selector instanceof Dom7) { 6554 compareWith = selector.nodeType ? [ 6555 selector 6556 ] : selector; 6557 for(i = 0; i < compareWith.length; i += 1){ 6558 if (compareWith[i] === el) return true; 6559 } 6560 return false; 6561 } 6562 return false; 6563 } 6564 function index() { 6565 let child = this[0]; 6566 let i; 6567 if (child) { 6568 i = 0; // eslint-disable-next-line 6569 while((child = child.previousSibling) !== null)if (child.nodeType === 1) i += 1; 6570 return i; 6571 } 6572 return undefined; 6573 } 6574 function eq(index) { 6575 if (typeof index === 'undefined') return this; 6576 const length = this.length; 6577 if (index > length - 1) return $([]); 6578 if (index < 0) { 6579 const returnIndex = length + index; 6580 if (returnIndex < 0) return $([]); 6581 return $([ 6582 this[returnIndex] 6583 ]); 6584 } 6585 return $([ 6586 this[index] 6587 ]); 6588 } 6589 function append() { 6590 let newChild; 6591 const document1 = getDocument(); 6592 for(let k = 0; k < arguments.length; k += 1){ 6593 newChild = k < 0 || arguments.length <= k ? undefined : arguments[k]; 6594 for(let i = 0; i < this.length; i += 1){ 6595 if (typeof newChild === 'string') { 6596 const tempDiv = document1.createElement('div'); 6597 tempDiv.innerHTML = newChild; 6598 while(tempDiv.firstChild)this[i].appendChild(tempDiv.firstChild); 6599 } else if (newChild instanceof Dom7) for(let j = 0; j < newChild.length; j += 1)this[i].appendChild(newChild[j]); 6600 else this[i].appendChild(newChild); 6601 } 6602 } 6603 return this; 6604 } 6605 function prepend(newChild) { 6606 const document1 = getDocument(); 6607 let i; 6608 let j; 6609 for(i = 0; i < this.length; i += 1){ 6610 if (typeof newChild === 'string') { 6611 const tempDiv = document1.createElement('div'); 6612 tempDiv.innerHTML = newChild; 6613 for(j = tempDiv.childNodes.length - 1; j >= 0; j -= 1)this[i].insertBefore(tempDiv.childNodes[j], this[i].childNodes[0]); 6614 } else if (newChild instanceof Dom7) for(j = 0; j < newChild.length; j += 1)this[i].insertBefore(newChild[j], this[i].childNodes[0]); 6615 else this[i].insertBefore(newChild, this[i].childNodes[0]); 6616 } 6617 return this; 6618 } 6619 function next(selector) { 6620 if (this.length > 0) { 6621 if (selector) { 6622 if (this[0].nextElementSibling && $(this[0].nextElementSibling).is(selector)) return $([ 6623 this[0].nextElementSibling 6624 ]); 6625 return $([]); 6626 } 6627 if (this[0].nextElementSibling) return $([ 6628 this[0].nextElementSibling 6629 ]); 6630 return $([]); 6631 } 6632 return $([]); 6633 } 6634 function nextAll(selector) { 6635 const nextEls = []; 6636 let el = this[0]; 6637 if (!el) return $([]); 6638 while(el.nextElementSibling){ 6639 const next = el.nextElementSibling; // eslint-disable-line 6640 if (selector) { 6641 if ($(next).is(selector)) nextEls.push(next); 6642 } else nextEls.push(next); 6643 el = next; 6644 } 6645 return $(nextEls); 6646 } 6647 function prev(selector) { 6648 if (this.length > 0) { 6649 const el = this[0]; 6650 if (selector) { 6651 if (el.previousElementSibling && $(el.previousElementSibling).is(selector)) return $([ 6652 el.previousElementSibling 6653 ]); 6654 return $([]); 6655 } 6656 if (el.previousElementSibling) return $([ 6657 el.previousElementSibling 6658 ]); 6659 return $([]); 6660 } 6661 return $([]); 6662 } 6663 function prevAll(selector) { 6664 const prevEls = []; 6665 let el = this[0]; 6666 if (!el) return $([]); 6667 while(el.previousElementSibling){ 6668 const prev = el.previousElementSibling; // eslint-disable-line 6669 if (selector) { 6670 if ($(prev).is(selector)) prevEls.push(prev); 6671 } else prevEls.push(prev); 6672 el = prev; 6673 } 6674 return $(prevEls); 6675 } 6676 function parent(selector) { 6677 const parents = []; // eslint-disable-line 6678 for(let i = 0; i < this.length; i += 1)if (this[i].parentNode !== null) { 6679 if (selector) { 6680 if ($(this[i].parentNode).is(selector)) parents.push(this[i].parentNode); 6681 } else parents.push(this[i].parentNode); 6682 } 6683 return $(parents); 6684 } 6685 function parents(selector) { 6686 const parents = []; // eslint-disable-line 6687 for(let i = 0; i < this.length; i += 1){ 6688 let parent = this[i].parentNode; // eslint-disable-line 6689 while(parent){ 6690 if (selector) { 6691 if ($(parent).is(selector)) parents.push(parent); 6692 } else parents.push(parent); 6693 parent = parent.parentNode; 6694 } 6695 } 6696 return $(parents); 6697 } 6698 function closest(selector) { 6699 let closest = this; // eslint-disable-line 6700 if (typeof selector === 'undefined') return $([]);
6701 if (!closest.is(selector)) closest = closest.parents(selector).eq(0); 6702 return closest; 6703 } 6704 function find(selector) { 6705 const foundElements = []; 6706 for(let i = 0; i < this.length; i += 1){ 6707 const found = this[i].querySelectorAll(selector); 6708 for(let j = 0; j < found.length; j += 1)foundElements.push(found[j]); 6709 } 6710 return $(foundElements); 6711 } 6712 function children(selector) { 6713 const children = []; // eslint-disable-line 6714 for(let i = 0; i < this.length; i += 1){ 6715 const childNodes = this[i].children; 6716 for(let j = 0; j < childNodes.length; j += 1)if (!selector || $(childNodes[j]).is(selector)) children.push(childNodes[j]); 6717 } 6718 return $(children); 6719 } 6720 function remove() { 6721 for(let i = 0; i < this.length; i += 1)if (this[i].parentNode) this[i].parentNode.removeChild(this[i]); 6722 return this; 6723 } 6724 const Methods = { 6725 addClass, 6726 removeClass, 6727 hasClass, 6728 toggleClass, 6729 attr, 6730 removeAttr, 6731 transform, 6732 transition: transition$1, 6733 on, 6734 off, 6735 trigger, 6736 transitionEnd: transitionEnd$1, 6737 outerWidth, 6738 outerHeight, 6739 styles, 6740 offset, 6741 css, 6742 each, 6743 html, 6744 text, 6745 is, 6746 index, 6747 eq, 6748 append, 6749 prepend, 6750 next, 6751 nextAll, 6752 prev, 6753 prevAll, 6754 parent, 6755 parents, 6756 closest, 6757 find, 6758 children, 6759 filter, 6760 remove 6761 }; 6762 Object.keys(Methods).forEach((methodName)=>{ 6763 Object.defineProperty($.fn, methodName, { 6764 value: Methods[methodName], 6765 writable: true 6766 }); 6767 }); 6768 function deleteProps(obj) { 6769 const object = obj; 6770 Object.keys(object).forEach((key)=>{ 6771 try { 6772 object[key] = null; 6773 } catch (e) {} 6774 try { 6775 delete object[key]; 6776 } catch (e) {} 6777 }); 6778 } 6779 function nextTick(callback, delay) { 6780 if (delay === void 0) delay = 0; 6781 return setTimeout(callback, delay); 6782 } 6783 function now() { 6784 return Date.now(); 6785 } 6786 function getComputedStyle$1(el) { 6787 const window1 = getWindow(); 6788 let style; 6789 if (window1.getComputedStyle) style = window1.getComputedStyle(el, null); 6790 if (!style && el.currentStyle) style = el.currentStyle; 6791 if (!style) style = el.style; 6792 return style; 6793 } 6794 function getTranslate(el, axis) { 6795 if (axis === void 0) axis = 'x'; 6796 const window1 = getWindow(); 6797 let matrix; 6798 let curTransform; 6799 let transformMatrix; 6800 const curStyle = getComputedStyle$1(el); 6801 if (window1.WebKitCSSMatrix) { 6802 curTransform = curStyle.transform || curStyle.webkitTransform; 6803 if (curTransform.split(',').length > 6) curTransform = curTransform.split(', ').map((a)=>a.replace(',', '.')).join(', '); 6804 // Some old versions of Webkit choke when 'none' is passed; pass 6805 // empty string instead in this case 6806 transformMatrix = new window1.WebKitCSSMatrix(curTransform === 'none' ? '' : curTransform); 6807 } else { 6808 transformMatrix = curStyle.MozTransform || curStyle.OTransform || curStyle.MsTransform || curStyle.msTransform || curStyle.transform || curStyle.getPropertyValue('transform').replace('translate(', 'matrix(1, 0, 0, 1,'); 6809 matrix = transformMatrix.toString().split(','); 6810 } 6811 if (axis === 'x') { 6812 // Latest Chrome and webkits Fix 6813 if (window1.WebKitCSSMatrix) curTransform = transformMatrix.m41; // Crazy IE10 Matrix 6814 else if (matrix.length === 16) curTransform = parseFloat(matrix[12]); // Normal Browsers 6815 else curTransform = parseFloat(matrix[4]); 6816 } 6817 if (axis === 'y') { 6818 // Latest Chrome and webkits Fix 6819 if (window1.WebKitCSSMatrix) curTransform = transformMatrix.m42; // Crazy IE10 Matrix 6820 else if (matrix.length === 16) curTransform = parseFloat(matrix[13]); // Normal Browsers 6821 else curTransform = parseFloat(matrix[5]); 6822 } 6823 return curTransform || 0; 6824 } 6825 function isObject(o) { 6826 return typeof o === 'object' && o !== null && o.constructor && Ob
6826ject.prototype.toString.call(o).slice(8, -1) === 'Object'; 6827 } 6828 function isNode(node) { 6829 // eslint-disable-next-line 6830 if (typeof window !== 'undefined' && typeof window.HTMLElement !== 'undefined') return node instanceof HTMLElement; 6831 return node && (node.nodeType === 1 || node.nodeType === 11); 6832 } 6833 function extend() { 6834 const to = Object(arguments.length <= 0 ? undefined : arguments[0]); 6835 const noExtend = [ 6836 '__proto__', 6837 'constructor', 6838 'prototype' 6839 ]; 6840 for(let i = 1; i < arguments.length; i += 1){ 6841 const nextSource = i < 0 || arguments.length <= i ? undefined : arguments[i]; 6842 if (nextSource !== undefined && nextSource !== null && !isNode(nextSource)) { 6843 const keysArray = Object.keys(Object(nextSource)).filter((key)=>noExtend.indexOf(key) < 0); 6844 for(let nextIndex = 0, len = keysArray.length; nextIndex < len; nextIndex += 1){ 6845 const nextKey = keysArray[nextIndex]; 6846 const desc = Object.getOwnPropertyDescriptor(nextSource, nextKey); 6847 if (desc !== undefined && desc.enumerable) { 6848 if (isObject(to[nextKey]) && isObject(nextSource[nextKey])) { 6849 if (nextSource[nextKey].__swiper__) to[nextKey] = nextSource[nextKey]; 6850 else extend(to[nextKey], nextSource[nextKey]); 6851 } else if (!isObject(to[nextKey]) && isObject(nextSource[nextKey])) { 6852 to[nextKey] = {}; 6853 if (nextSource[nextKey].__swiper__) to[nextKey] = nextSource[nextKey]; 6854 else extend(to[nextKey], nextSource[nextKey]); 6855 } else to[nextKey] = nextSource[nextKey]; 6856 } 6857 } 6858 } 6859 } 6860 return to; 6861 } 6862 function setCSSProperty(el, varName, varValue) { 6863 el.style.setProperty(varName, varValue); 6864 } 6865 function animateCSSModeScroll(_ref) { 6866 let { swiper, targetPosition, side } = _ref; 6867 const window1 = getWindow(); 6868 const startPosition = -swiper.translate; 6869 let startTime = null; 6870 let time; 6871 const duration = swiper.params.speed; 6872 swiper.wrapperEl.style.scrollSnapType = 'none'; 6873 window1.cancelAnimationFrame(swiper.cssModeFrameID); 6874 const dir = targetPosition > startPosition ? 'next' : 'prev'; 6875 const isOutOfBound = (current, target)=>{ 6876 return dir === 'next' && current >= target || dir === 'prev' && current <= target; 6877 }; 6878 const animate = ()=>{ 6879 time = new Date().getTime(); 6880 if (startTime === null) startTime = time; 6881 const progress = Math.max(Math.min((time - startTime) / duration, 1), 0); 6882 const easeProgress = 0.5 - Math.cos(progress * Math.PI) / 2; 6883 let currentPosition = startPosition + easeProgress * (targetPosition - startPosition); 6884 if (isOutOfBound(currentPosition, targetPosition)) currentPosition = targetPosition; 6885 swiper.wrapperEl.scrollTo({ 6886 [side]: currentPosition 6887 }); 6888 if (isOutOfBound(currentPosition, targetPosition)) { 6889 swiper.wrapperEl.style.overflow = 'hidden'; 6890 swiper.wrapperEl.style.scrollSnapType = ''; 6891 setTimeout(()=>{ 6892 swiper.wrapperEl.style.overflow = ''; 6893 swiper.wrapperEl.scrollTo({ 6894 [side]: currentPosition 6895 }); 6896 }); 6897 window1.cancelAnimationFrame(swiper.cssModeFrameID); 6898 return; 6899 } 6900 swiper.cssModeFrameID = window1.requestAnimationFrame(animate); 6901 }; 6902 animate(); 6903 } 6904 let support; 6905 function calcSupport() { 6906 const window1 = getWindow(); 6907 const document1 = getDocument(); 6908 return { 6909 smoothScroll: document1.documentElement && 'scrollBehavior' in document1.documentElement.style, 6910 touch: !!('ontouchstart' in window1 || window1.DocumentTouch && document1 instanceof window1.DocumentTouch), 6911 passiveListener: function checkPassiveListener() { 6912 let supportsPassive = false;
vendor: 7,701 bytes, lines 6913-7100
6913 try { 6914 const opts = Object.defineProperty({}, 'passive', { 6915 // eslint-disable-next-line 6916 get () { 6917 supportsPassive = true; 6918 } 6919 }); 6920 window1.addEventListener('testPassiveListener', null, opts); 6921 } catch (e) {} 6922 return supportsPassive; 6923 }(), 6924 gestures: function checkGestures() { 6925 return 'ongesturestart' in window1; 6926 }() 6927 }; 6928 } 6929 function getSupport() { 6930 if (!support) support = calcSupport(); 6931 return support; 6932 } 6933 let deviceCached; 6934 function calcDevice(_temp) { 6935 let { userAgent } = _temp === void 0 ? {} : _temp; 6936 const support = getSupport(); 6937 const window1 = getWindow(); 6938 const platform = window1.navigator.platform; 6939 const ua = userAgent || window1.navigator.userAgent; 6940 const device = { 6941 ios: false, 6942 android: false 6943 }; 6944 const screenWidth = window1.screen.width; 6945 const screenHeight = window1.screen.height; 6946 const android = ua.match(/(Android);?[\s\/]+([\d.]+)?/); // eslint-disable-line 6947 let ipad = ua.match(/(iPad).*OS\s([\d_]+)/); 6948 const ipod = ua.match(/(iPod)(.*OS\s([\d_]+))?/); 6949 const iphone = !ipad && ua.match(/(iPhone\sOS|iOS)\s([\d_]+)/); 6950 const windows = platform === 'Win32'; 6951 let macos = platform === 'MacIntel'; // iPadOs 13 fix 6952 const iPadScreens = [ 6953 '1024x1366', 6954 '1366x1024', 6955 '834x1194', 6956 '1194x834', 6957 '834x1112', 6958 '1112x834', 6959 '768x1024', 6960 '1024x768', 6961 '820x1180', 6962 '1180x820', 6963 '810x1080', 6964 '1080x810' 6965 ]; 6966 if (!ipad && macos && support.touch && iPadScreens.indexOf(`${screenWidth}x${screenHeight}`) >= 0) { 6967 ipad = ua.match(/(Version)\/([\d.]+)/); 6968 if (!ipad) ipad = [ 6969 0, 6970 1, 6971 '13_0_0' 6972 ]; 6973 macos = false; 6974 } // Android 6975 if (android && !windows) { 6976 device.os = 'android'; 6977 device.android = true; 6978 } 6979 if (ipad || iphone || ipod) { 6980 device.os = 'ios'; 6981 device.ios = true; 6982 } // Export object 6983 return device; 6984 } 6985 function getDevice(overrides) { 6986 if (overrides === void 0) overrides = {}; 6987 if (!deviceCached) deviceCached = calcDevice(overrides); 6988 return deviceCached; 6989 } 6990 let browser; 6991 function calcBrowser() { 6992 const window1 = getWindow(); 6993 function isSafari() { 6994 const ua = window1.navigator.userAgent.toLowerCase(); 6995 return ua.indexOf('safari') >= 0 && ua.indexOf('chrome') < 0 && ua.indexOf('android') < 0; 6996 } 6997 return { 6998 isSafari: isSafari(), 6999 isWebView: /(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(window1.navigator.userAgent) 7000 }; 7001 } 7002 function getBrowser() { 7003 if (!browser) browser = calcBrowser(); 7004 return browser; 7005 } 7006 function Resize(_ref) { 7007 let { swiper, on, emit } = _ref; 7008 const window1 = getWindow(); 7009 let observer = null; 7010 let animationFrame = null; 7011 const resizeHandler = ()=>{ 7012 if (!swiper || swiper.destroyed || !swiper.initialized) return; 7013 emit('beforeResize'); 7014 emit('resize'); 7015 }; 7016 const createObserver = ()=>{ 7017 if (!swiper || swiper.destroyed || !swiper.initialized) return; 7018 observer = new ResizeObserver((entries)=>{ 7019 animationFrame = window1.requestAnimationFrame(()=>{ 7020 const { width, height } = swiper; 7021 let newWidth = width; 7022 let newHeight = height; 7023 entries.forEach((_ref2)=>{ 7024 let { contentBoxSize, contentRect, target } = _ref2; 7025 if (target && target !== swiper.el) return; 7026 newWidth = contentRect ? contentRect.width : (contentBoxSize[0] || contentBoxSize).inlineSize; 7027 newHeight = contentRect ? contentRect.height : (contentBoxSize[0] || contentBoxSize).blockSize; 7028 }); 7029 if (newWidth !== width || newHeight !== height) resizeHandler(); 7030 }); 7031 }); 7032 observer.observe(swiper.el); 7033 }; 7034 const removeObserver = ()=>{ 7035 if (animationFrame) window1.cancelAnimationFrame(animationFrame); 7036 if (observer && observer.unobserve && swiper.el) { 7037 observer.unobserve(swiper.el); 7038 observer = null; 7039 } 7040 }; 7041 const orientationChangeHandler = ()=>{ 7042 if (!swiper || swiper.destroyed || !swiper.initialized) return; 7043 emit('orientationchange'); 7044 }; 7045 on('init', ()=>{ 7046 if (swiper.params.resizeObserver && typeof window1.ResizeObserver !== 'undefined') { 7047 createObserver(); 7048 return; 7049 } 7050 window1.addEventListener('resize', resizeHandler); 7051 window1.addEventListener('orientationchange', orientationChangeHandler); 7052 }); 7053 on('destroy', ()=>{ 7054 removeObserver(); 7055 window1.removeEventListener('resize', resizeHandler); 7056 window1.removeEventListener('orientationchange', orientationChangeHandler); 7057 }); 7058 } 7059 function Observer(_ref) { 7060 let { swiper, extendParams, on, emit } = _ref; 7061 const observers = []; 7062 const window1 = getWindow(); 7063 const attach = function(target, options) { 7064 if (options === void 0) options = {}; 7065 const ObserverFunc = window1.MutationObserver || window1.WebkitMutationObserver; 7066 const observer = new ObserverFunc((mutations)=>{ 7067 // The observerUpdate event should only be triggered 7068 // once despite the number of mutations. Additional 7069 // triggers are redundant and are very costly 7070 if (mutations.length === 1) { 7071 emit('observerUpdate', mutations[0]); 7072 return; 7073 } 7074 const observerUpdate = function observerUpdate() { 7075 emit('observerUpdate', mutations[0]); 7076 }; 7077 if (window1.requestAnimationFrame) window1.requestAnimationFrame(observerUpdate); 7078 else window1.setTimeout(observerUpdate, 0); 7079 }); 7080 observer.observe(target, { 7081 attributes: typeof options.attributes === 'undefined' ? true : options.attributes, 7082 childList: typeof options.childList === 'undefined' ? true : options.childList, 7083 characterData: typeof options.characterData === 'undefined' ? true : options.characterData 7084 }); 7085 observers.push(observer); 7086 }; 7087 const init = ()=>{ 7088 if (!swiper.params.observer) return; 7089 if (swiper.params.observeParents) { 7090 const containerParents = swiper.$el.parents(); 7091 for(let i = 0; i < containerParents.length; i += 1)attach(containerParents[i]); 7092 } // Observe container 7093 attach(swiper.$el[0], { 7094 childList: swiper.params.observeSlideChildren 7095 }); // Observe wrapper 7096 attach(swiper.$wrapperEl[0], { 7097 attributes: false 7098 }); 7099 }; 7100 const destroy = ()=>{
7101 observers.forEach((observer)=>{ 7102 observer.disconnect(); 7103 }); 7104 observers.splice(0, observers.length); 7105 }; 7106 extendParams({ 7107 observer: false, 7108 observeParents: false, 7109 observeSlideChildren: false 7110 }); 7111 on('init', init); 7112 on('destroy', destroy); 7113 } 7114 /* eslint-disable no-underscore-dangle */ var eventsEmitter = { 7115 on (events, handler, priority) { 7116 const self = this; 7117 if (!self.eventsListeners || self.destroyed) return self; 7118 if (typeof handler !== 'function') return self; 7119 const method = priority ? 'unshift' : 'push'; 7120 events.split(' ').forEach((event1)=>{ 7121 if (!self.eventsListeners[event1]) self.eventsListeners[event1] = []; 7122 self.eventsListeners[event1][method](handler); 7123 }); 7124 return self; 7125 }, 7126 once (events, handler, priority) { 7127 const self = this; 7128 if (!self.eventsListeners || self.destroyed) return self; 7129 if (typeof handler !== 'function') return self; 7130 function onceHandler() { 7131 self.off(events, onceHandler); 7132 if (onceHandler.__emitterProxy) delete onceHandler.__emitterProxy; 7133 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key]; 7134 handler.apply(self, args); 7135 } 7136 onceHandler.__emitterProxy = handler; 7137 return self.on(events, onceHandler, priority); 7138 }, 7139 onAny (handler, priority) { 7140 const self = this; 7141 if (!self.eventsListeners || self.destroyed) return self; 7142 if (typeof handler !== 'function') return self; 7143 const method = priority ? 'unshift' : 'push'; 7144 if (self.eventsAnyListeners.indexOf(handler) < 0) self.eventsAnyListeners[method](handler); 7145 return self; 7146 }, 7147 offAny (handler) { 7148 const self = this; 7149 if (!self.eventsListeners || self.destroyed) return self; 7150 if (!self.eventsAnyListeners) return self; 7151 const index = self.eventsAnyListeners.indexOf(handler); 7152 if (index >= 0) self.eventsAnyListeners.splice(index, 1); 7153 return self; 7154 }, 7155 off (events, handler) { 7156 const self = this; 7157 if (!self.eventsListeners || self.destroyed) return self; 7158 if (!self.eventsListeners) return self; 7159 events.split(' ').forEach((event1)=>{ 7160 if (typeof handler === 'undefined') self.eventsListeners[event1] = []; 7161 else if (self.eventsListeners[event1]) self.eventsListeners[event1].forEach((eventHandler, index)=>{ 7162 if (eventHandler === handler || eventHandler.__emitterProxy && eventHandler.__emitterProxy === handler) self.eventsListeners[event1].splice(index, 1); 7163 }); 7164 }); 7165 return self; 7166 }, 7167 emit () { 7168 const self = this; 7169 if (!self.eventsListeners || self.destroyed) return self; 7170 if (!self.eventsListeners) return self; 7171 let events; 7172 let data; 7173 let context; 7174 for(var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++)args[_key2] = arguments[_key2]; 7175 if (typeof args[0] === 'string' || Array.isArray(args[0])) { 7176 events = args[0]; 7177 data = args.slice(1, args.length); 7178 context = self; 7179 } else { 7180 events = args[0].events; 7181 data = args[0].data; 7182 context = args[0].context || self; 7183 } 7184 data.unshift(context); 7185 const eventsArray = Array.isArray(events) ? events : events.split(' '); 7186 eventsArray.forEach((event1)=>{ 7187 if (self.eventsAnyListeners && self.eventsAnyListeners.length) self.eventsAnyListeners.forEach((eventHandler)=>{ 7188 eventHandler.apply(context, [ 7189 event1, 7190 ...data 7191 ]); 7192 }); 7193 if (self.eventsListeners && self.eventsListeners[event1]) self.eventsListeners[event1].forEac
7193h((eventHandler)=>{ 7194 eventHandler.apply(context, data); 7195 }); 7196 }); 7197 return self; 7198 } 7199 }; 7200 function updateSize() { 7201 const swiper = this; 7202 let width; 7203 let height; 7204 const $el = swiper.$el; 7205 if (typeof swiper.params.width !== 'undefined' && swiper.params.width !== null) width = swiper.params.width; 7206 else width = $el[0].clientWidth; 7207 if (typeof swiper.params.height !== 'undefined' && swiper.params.height !== null) height = swiper.params.height; 7208 else height = $el[0].clientHeight; 7209 if (width === 0 && swiper.isHorizontal() || height === 0 && swiper.isVertical()) return; 7210 // Subtract paddings 7211 width = width - parseInt($el.css('padding-left') || 0, 10) - parseInt($el.css('padding-right') || 0, 10); 7212 height = height - parseInt($el.css('padding-top') || 0, 10) - parseInt($el.css('padding-bottom') || 0, 10); 7213 if (Number.isNaN(width)) width = 0; 7214 if (Number.isNaN(height)) height = 0; 7215 Object.assign(swiper, { 7216 width, 7217 height, 7218 size: swiper.isHorizontal() ? width : height 7219 }); 7220 } 7221 function updateSlides() { 7222 const swiper = this; 7223 function getDirectionLabel(property) { 7224 if (swiper.isHorizontal()) return property; 7225 // prettier-ignore 7226 return ({ 7227 'width': 'height', 7228 'margin-top': 'margin-left', 7229 'margin-bottom ': 'margin-right', 7230 'margin-left': 'margin-top', 7231 'margin-right': 'margin-bottom', 7232 'padding-left': 'padding-top', 7233 'padding-right': 'padding-bottom', 7234 'marginRight': 'marginBottom' 7235 })[property]; 7236 } 7237 function getDirectionPropertyValue(node, label) { 7238 return parseFloat(node.getPropertyValue(getDirectionLabel(label)) || 0); 7239 } 7240 const params = swiper.params; 7241 const { $wrapperEl, size: swiperSize, rtlTranslate: rtl, wrongRTL } = swiper; 7242 const isVirtual = swiper.virtual && params.virtual.enabled; 7243 const previousSlidesLength = isVirtual ? swiper.virtual.slides.length : swiper.slides.length; 7244 const slides = $wrapperEl.children(`.${swiper.params.slideClass}`); 7245 const slidesLength = isVirtual ? swiper.virtual.slides.length : slides.length; 7246 let snapGrid = []; 7247 const slidesGrid = []; 7248 const slidesSizesGrid = []; 7249 let offsetBefore = params.slidesOffsetBefore; 7250 if (typeof offsetBefore === 'function') offsetBefore = params.slidesOffsetBefore.call(swiper); 7251 let offsetAfter = params.slidesOffsetAfter; 7252 if (typeof offsetAfter === 'function') offsetAfter = params.slidesOffsetAfter.call(swiper); 7253 const previousSnapGridLength = swiper.snapGrid.length; 7254 const previousSlidesGridLength = swiper.slidesGrid.length; 7255 let spaceBetween = params.spaceBetween; 7256 let slidePosition = -offsetBefore; 7257 let prevSlideSize = 0; 7258 let index = 0; 7259 if (typeof swiperSize === 'undefined') return; 7260 if (typeof spaceBetween === 'string' && spaceBetween.indexOf('%') >= 0) spaceBetween = parseFloat(spaceBetween.replace('%', '')) / 100 * swiperSize; 7261 swiper.virtualSize = -spaceBetween; // reset margins 7262 if (rtl) slides.css({ 7263 marginLeft: '', 7264 marginBottom: '', 7265 marginTop: '' 7266 }); 7267 else slides.css({ 7268 marginRight: '', 7269 marginBottom: '', 7270 marginTop: '' 7271 }); // reset cssMode offsets 7272 if (params.centeredSlides && params.cssMode) { 7273 setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-before', ''); 7274 setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-after', ''); 7275 } 7276 const gridEnabled = params.grid && params.grid.rows > 1 && swiper.grid; 7277 if (gridEnabled) swiper.grid.initSlides(slidesLength); 7278 // Calc slides 7279 let slideSize; 7280 const shouldResetSlideSize = params.slidesPerView === 'auto' && params.breakpoints && Object.keys(params.breakpoints).filter((key)=>{ 7281 return typeof params.breakpoints[key].slidesPerView !== 'undefined'; 7282 }).length > 0; 7283 for(let i = 0; i < slidesLength; i += 1){ 7284 slideSize = 0; 7285 const slide = slides.eq(i); 7286 if (gridEnabled) swiper.grid.updateSlide(i, slide, slidesLength, getDirectionLabel); 7287 if (slide.css('display') === 'none') continue; // eslint-disable-line 7288 if (params.slidesPerView === 'auto') { 7289 if (shouldResetSlideSize) slides[i].style[getDirectionLabel('width')] = ``; 7290 const slideStyles = getComputedStyle(slide[0]); 7291 const currentTransform = slide[0].style.transform; 7292 const currentWebKitTransform = slide[0].style.webkitTransform; 7293 if (currentTransform) slide[0].style.transform = 'none'; 7294 if (currentWebKitTransform) slide[0].style.webkitTransform = 'none'; 7295 if (params.roundLengths) slideSize = swiper.isHorizontal() ? slide.outerWidth(true) : slide.outerHeight(true); 7296 else { 7297 // eslint-disable-next-line 7298 const width = getDirectionPropertyValue(slideStyles, 'width'); 7299 const paddingLeft = getDirectionPropertyValue(slideStyles, 'padding-left'); 7300 const paddingRight = getDirectionPropertyValue(slideStyles, 'padding-right'); 7301 const marginLeft = getDirectionPropertyValue(slideStyles, 'margin-left'); 7302 const marginRight = getDirectionPropertyValue(slideStyles, 'margin-right'); 7303 const boxSizing = slideStyles.getPropertyValue('box-sizing'); 7304 if (boxSizing && boxSizing === 'border-box') slideSize = width + marginLeft + marginRight; 7305 else { 7306 const { clientWidth, offsetWidth } = slide[0]; 7307 slideSize = width + paddingLeft + paddingRight + marginLeft + marginRight + (offsetWidth - clientWidth); 7308 } 7309 } 7310 if (currentTransform) slide[0].style.transform = currentTransform; 7311 if (currentWebKitTransform) slide[0].style.webkitTransform = currentWebKitTransform; 7312 if (params.roundLengths) slideSize = Math.floor(slideSize); 7313 } else { 7314 slideSize = (swiperSize - (params.slidesPerView - 1) * spaceBetween) / params.slidesPerView; 7315 if (params.roundLengths) slideSize = Math.floor(slideSize); 7316 if (slides[i]) slides[i].style[getDirectionLabel('width')] = `${slideSize}px`; 7317 } 7318 if (slides[i]) slides[i].swiperSlideSize = slideSize; 7319 slidesSizesGrid.push(slideSize); 7320 if (params.centeredSlides) { 7321 slidePosition = slidePosition + slideSize / 2 + prevSlideSize / 2 + spaceBetween; 7322 if (prevSlideSize === 0 && i !== 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; 7323 if (i === 0) slidePosition = slidePosition - swiperSize / 2 - spaceBetween; 7324 if (Math.abs(slidePosition) < 0.001) slidePosition = 0; 7325 if (params.roundLengths) slidePosition = Math.floor(slidePosition); 7326 if (index % params.slidesPerGroup === 0) snapGrid.push(slidePosition); 7327 slidesGrid.push(slidePosition); 7328 } else { 7329 if (params.roundLengths) slidePosition = Math.floor(slidePosition); 7330 if ((index - Math.min(swiper.params.slidesPerGroupSkip, index)) % swiper.params.slidesPerGroup === 0) snapGrid.push(slidePosition); 7331 slidesGrid.push(slidePosition); 7332 slidePosition = slidePosition + slideSize + spaceBetween; 7333 } 7334 swiper.virtualSize += slideSize + spaceBetween; 7335 prevSlideSize = slideSize; 7336 index += 1; 7337 } 7338 swiper.virtualSize = Math.max(swiper.virtualSize, swiperSize) + offsetAfter; 7339 if (rtl && wrongRTL && (params.effect === 'slide' || params.effect === 'coverflow')) $wrapperEl.css({ 7340 width: `${swiper.virtualSize + params.spaceBetween}px` 7341 }); 7342 if (params.setWrapperSize) $wrapperEl.css({ 7343 [getDirectionLabel('width')]: `${swiper.virtualSize + params.spaceBetween}px` 7344 }); 7345 if (gridEnabled) swiper.grid.updateWrapperSize(slideSize, snapGrid, getDirectionLabel); 7346 // Remove last grid elements depending on width 7347 if (!params.centeredSlides) { 7348 const newSlidesGrid = []; 7349 for(let i = 0; i < snapGrid.length; i += 1){ 7350 let slidesGridItem = snapGrid[i]; 7351 if (params.roundLengths) slidesGridItem = Math.floor(slidesGridItem);
7352 if (snapGrid[i] <= swiper.virtualSize - swiperSize) newSlidesGrid.push(slidesGridItem); 7353 } 7354 snapGrid = newSlidesGrid; 7355 if (Math.floor(swiper.virtualSize - swiperSize) - Math.floor(snapGrid[snapGrid.length - 1]) > 1) snapGrid.push(swiper.virtualSize - swiperSize); 7356 } 7357 if (snapGrid.length === 0) snapGrid = [ 7358 0 7359 ]; 7360 if (params.spaceBetween !== 0) { 7361 const key = swiper.isHorizontal() && rtl ? 'marginLeft' : getDirectionLabel('marginRight'); 7362 slides.filter((_, slideIndex)=>{ 7363 if (!params.cssMode) return true; 7364 if (slideIndex === slides.length - 1) return false; 7365 return true; 7366 }).css({ 7367 [key]: `${spaceBetween}px` 7368 }); 7369 } 7370 if (params.centeredSlides && params.centeredSlidesBounds) { 7371 let allSlidesSize = 0; 7372 slidesSizesGrid.forEach((slideSizeValue)=>{ 7373 allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0); 7374 }); 7375 allSlidesSize -= params.spaceBetween; 7376 const maxSnap = allSlidesSize - swiperSize; 7377 snapGrid = snapGrid.map((snap)=>{ 7378 if (snap < 0) return -offsetBefore; 7379 if (snap > maxSnap) return maxSnap + offsetAfter; 7380 return snap; 7381 }); 7382 } 7383 if (params.centerInsufficientSlides) { 7384 let allSlidesSize = 0; 7385 slidesSizesGrid.forEach((slideSizeValue)=>{ 7386 allSlidesSize += slideSizeValue + (params.spaceBetween ? params.spaceBetween : 0); 7387 }); 7388 allSlidesSize -= params.spaceBetween; 7389 if (allSlidesSize < swiperSize) { 7390 const allSlidesOffset = (swiperSize - allSlidesSize) / 2; 7391 snapGrid.forEach((snap, snapIndex)=>{ 7392 snapGrid[snapIndex] = snap - allSlidesOffset; 7393 }); 7394 slidesGrid.forEach((snap, snapIndex)=>{ 7395 slidesGrid[snapIndex] = snap + allSlidesOffset; 7396 }); 7397 } 7398 } 7399 Object.assign(swiper, { 7400 slides, 7401 snapGrid, 7402 slidesGrid, 7403 slidesSizesGrid 7404 }); 7405 if (params.centeredSlides && params.cssMode && !params.centeredSlidesBounds) { 7406 setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-before', `${-snapGrid[0]}px`); 7407 setCSSProperty(swiper.wrapperEl, '--swiper-centered-offset-after', `${swiper.size / 2 - slidesSizesGrid[slidesSizesGrid.length - 1] / 2}px`); 7408 const addToSnapGrid = -swiper.snapGrid[0]; 7409 const addToSlidesGrid = -swiper.slidesGrid[0]; 7410 swiper.snapGrid = swiper.snapGrid.map((v)=>v + addToSnapGrid); 7411 swiper.slidesGrid = swiper.slidesGrid.map((v)=>v + addToSlidesGrid); 7412 } 7413 if (slidesLength !== previousSlidesLength) swiper.emit('slidesLengthChange'); 7414 if (snapGrid.length !== previousSnapGridLength) { 7415 if (swiper.params.watchOverflow) swiper.checkOverflow(); 7416 swiper.emit('snapGridLengthChange'); 7417 } 7418 if (slidesGrid.length !== previousSlidesGridLength) swiper.emit('slidesGridLengthChange'); 7419 if (params.watchSlidesProgress) swiper.updateSlidesOffset(); 7420 if (!isVirtual && !params.cssMode && (params.effect === 'slide' || params.effect === 'fade')) { 7421 const backFaceHiddenClass = `${params.containerModifierClass}backface-hidden`; 7422 const hasClassBackfaceClassAdded = swiper.$el.hasClass(backFaceHiddenClass); 7423 if (slidesLength <= params.maxBackfaceHiddenSlides) { 7424 if (!hasClassBackfaceClassAdded) swiper.$el.addClass(backFaceHiddenClass); 7425 } else if (hasClassBackfaceClassAdded) swiper.$el.removeClass(backFaceHiddenClass); 7426 } 7427 } 7428 function updateAutoHeight(speed) { 7429 const swiper = this; 7430 const activeSlides = []; 7431 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 7432 let newHeight = 0; 7433 let i; 7434 if (typeof speed === 'number') swiper.setTransition(speed); 7435 else if (speed === true) swiper.setTransition(swiper.params.speed); 7436 const getSlideByIndex = (index)=>{ 7437 if (isVirtual) return swiper.slides.filter((el)=>parseInt(el.getAttribute('data-swiper-slide-index'), 10) === index)[0]; 7438 return swiper.slides.eq(index)[0]; 7439 }; // Find slides currently in view 7440 if (swiper.params.slidesPerView !== 'auto' && swiper.params.slidesPerView > 1) { 7441 if (swiper.params.centeredSlides) (swiper.visibleSlides || $([])).each((slide)=>{ 7442 activeSlides.push(slide); 7443 }); 7444 else for(i = 0;
7444 i < Math.ceil(swiper.params.slidesPerView); i += 1){ 7445 const index = swiper.activeIndex + i; 7446 if (index > swiper.slides.length && !isVirtual) break; 7447 activeSlides.push(getSlideByIndex(index)); 7448 } 7449 } else activeSlides.push(getSlideByIndex(swiper.activeIndex)); 7450 // Find new height from highest slide in view 7451 for(i = 0; i < activeSlides.length; i += 1)if (typeof activeSlides[i] !== 'undefined') { 7452 const height = activeSlides[i].offsetHeight; 7453 newHeight = height > newHeight ? height : newHeight; 7454 } 7455 // Update Height 7456 if (newHeight || newHeight === 0) swiper.$wrapperEl.css('height', `${newHeight}px`); 7457 } 7458 function updateSlidesOffset() { 7459 const swiper = this; 7460 const slides = swiper.slides; 7461 for(let i = 0; i < slides.length; i += 1)slides[i].swiperSlideOffset = swiper.isHorizontal() ? slides[i].offsetLeft : slides[i].offsetTop; 7462 } 7463 function updateSlidesProgress(translate) { 7464 if (translate === void 0) translate = this && this.translate || 0; 7465 const swiper = this; 7466 const params = swiper.params; 7467 const { slides, rtlTranslate: rtl, snapGrid } = swiper; 7468 if (slides.length === 0) return; 7469 if (typeof slides[0].swiperSlideOffset === 'undefined') swiper.updateSlidesOffset(); 7470 let offsetCenter = -translate; 7471 if (rtl) offsetCenter = translate; // Visible Slides 7472 slides.removeClass(params.slideVisibleClass); 7473 swiper.visibleSlidesIndexes = []; 7474 swiper.visibleSlides = []; 7475 for(let i = 0; i < slides.length; i += 1){ 7476 const slide = slides[i]; 7477 let slideOffset = slide.swiperSlideOffset; 7478 if (params.cssMode && params.centeredSlides) slideOffset -= slides[0].swiperSlideOffset; 7479 const slideProgress = (offsetCenter + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + params.spaceBetween); 7480 const originalSlideProgress = (offsetCenter - snapGrid[0] + (params.centeredSlides ? swiper.minTranslate() : 0) - slideOffset) / (slide.swiperSlideSize + params.spaceBetween); 7481 const slideBefore = -(offsetCenter - slideOffset); 7482 const slideAfter = slideBefore + swiper.slidesSizesGrid[i]; 7483 const isVisible = slideBefore >= 0 && slideBefore < swiper.size - 1 || slideAfter > 1 && slideAfter <= swiper.size || slideBefore <= 0 && slideAfter >= swiper.size; 7484 if (isVisible) { 7485 swiper.visibleSlides.push(slide); 7486 swiper.visibleSlidesIndexes.push(i); 7487 slides.eq(i).addClass(params.slideVisibleClass); 7488 } 7489 slide.progress = rtl ? -slideProgress : slideProgress; 7490 slide.originalProgress = rtl ? -originalSlideProgress : originalSlideProgress; 7491 } 7492 swiper.visibleSlides = $(swiper.visibleSlides); 7493 } 7494 function updateProgress(translate) { 7495 const swiper = this; 7496 if (typeof translate === 'undefined') { 7497 const multiplier = swiper.rtlTranslate ? -1 : 1; // eslint-disable-next-line 7498 translate = swiper && swiper.translate && swiper.translate * multiplier || 0; 7499 } 7500 const params = swiper.params; 7501 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 7502 let { progress, isBeginning, isEnd } = swiper; 7503 const wasBeginning = isBeginning; 7504 const wasEnd = isEnd; 7505 if (translatesDiff === 0) { 7506 progress = 0; 7507 isBeginning = true; 7508 isEnd = true; 7509 } else { 7510 progress = (translate - swiper.minTranslate()) / translatesDiff; 7511 isBeginning = progress <= 0; 7512 isEnd = progress >= 1; 7513 } 7514 Object.assign(swiper, { 7515 progress, 7516 isBeginning, 7517 isEnd 7518 }); 7519 if (params.watchSlidesProgress || params.centeredSlides && params.autoHeight) swiper.updateSlidesProgress(translate); 7520 if (isBeginning && !wasBeginning) swiper.emit('reachBeginning toEdge'); 7521 if (isEnd && !wasEnd) swiper.emit('reachEnd toEdge'); 7522 if (wasBeginning && !isBeginning || wasEnd && !isEnd) swiper.emit('fromEdge'); 7523 swiper.emit('progress', progress); 7524 } 7525 function updateSlidesClasses() { 7526 const swiper = this; 7527 const { slides, params, $wrapperEl, activeIndex, realIndex } = swiper; 7528 const isVirtual = swiper.virtual && params.virtual.enabled; 7529 slides.removeClass(`${params.slideActiveClass} ${params.slideNextClass} ${params.slidePrevClass} ${params.slideDuplicateActiveClass} ${params.slideDuplicateNextClass} ${params.slideDuplicatePrevClass}`); 7530 let activeSlide; 7531 if (isVirtual) activeSlide = swiper.$wrapperEl.find(`.${params.slideClass}[data-swiper-slide-index="${activeIndex}"]`); 7532 else activeSlide = slides.eq(activeIndex); 7533 // Active classes 7534 activeSlide.addClass(params.slideActiveClass); 7535 if (params.loop) { 7536 // Duplicate to all looped slides 7537 if (activeSlide.hasClass(params.slideDuplicateClass)) $wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${realIndex}"]`).addClass(params.slideDuplicateActiveClass); 7538 else $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${realIndex}"]`).addClass(params.slideDuplicateActiveClass); 7539 } // Next Slide 7540 let nextSlide = activeSlide.nextAll(`.${params.slideClass}`).eq(0).addClass(params.slideNextClass); 7541 if (params.loop && nextSlide.length === 0) { 7542 nextSlide = slides.eq(0); 7543 nextSlide.addClass(params.slideNextClass); 7544 } // Prev Slide 7545 let prevSlide = activeSlide.prevAll(`.${params.slideClass}`).eq(0).addClass(params.slidePrevClass); 7546 if (params.loop && prevSlide.length === 0) { 7547 prevSlide = slides.eq(-1); 7548 prevSlide.addClass(params.slidePrevClass); 7549 } 7550 if (params.loop) { 7551 // Duplicate to all looped slides 7552 if (nextSlide.hasClass(params.slideDuplicateClass)) $wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${nextSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicateNextClass); 7553 else $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${nextSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicateNextClass); 7554 if (prevSlide.hasClass(params.slideDuplicateClass)) $wrapperEl.children(`.${params.slideClass}:not(.${params.slideDuplicateClass})[data-swiper-slide-index="${prevSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicatePrevClass); 7555 else $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass}[data-swiper-slide-index="${prevSlide.attr('data-swiper-slide-index')}"]`).addClass(params.slideDuplicatePrevClass); 7556 } 7557 swiper.emitSlidesClasses(); 7558 } 7559 function updateActiveIndex(newActiveIndex) { 7560 const swiper = this; 7561 const translate = swiper.rtlTranslate ? swiper.translate : -swi
7561per.translate; 7562 const { slidesGrid, snapGrid, params, activeIndex: previousIndex, realIndex: previousRealIndex, snapIndex: previousSnapIndex } = swiper; 7563 let activeIndex = newActiveIndex; 7564 let snapIndex; 7565 if (typeof activeIndex === 'undefined') { 7566 for(let i = 0; i < slidesGrid.length; i += 1){ 7567 if (typeof slidesGrid[i + 1] !== 'undefined') { 7568 if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1] - (slidesGrid[i + 1] - slidesGrid[i]) / 2) activeIndex = i; 7569 else if (translate >= slidesGrid[i] && translate < slidesGrid[i + 1]) activeIndex = i + 1; 7570 } else if (translate >= slidesGrid[i]) activeIndex = i; 7571 } // Normalize slideIndex 7572 if (params.normalizeSlideIndex) { 7573 if (activeIndex < 0 || typeof activeIndex === 'undefined') activeIndex = 0; 7574 } 7575 } 7576 if (snapGrid.indexOf(translate) >= 0) snapIndex = snapGrid.indexOf(translate); 7577 else { 7578 const skip = Math.min(params.slidesPerGroupSkip, activeIndex); 7579 snapIndex = skip + Math.floor((activeIndex - skip) / params.slidesPerGroup); 7580 } 7581 if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; 7582 if (activeIndex === previousIndex) { 7583 if (snapIndex !== previousSnapIndex) { 7584 swiper.snapIndex = snapIndex; 7585 swiper.emit('snapIndexChange'); 7586 } 7587 return; 7588 } // Get real index 7589 const realIndex = parseInt(swiper.slides.eq(activeIndex).attr('data-swiper-slide-index') || activeIndex, 10); 7590 Object.assign(swiper, { 7591 snapIndex, 7592 realIndex, 7593 previousIndex, 7594 activeIndex 7595 }); 7596 swiper.emit('activeIndexChange'); 7597 swiper.emit('snapIndexChange'); 7598 if (previousRealIndex !== realIndex) swiper.emit('realIndexChange'); 7599 if (swiper.initialized || swiper.params.runCallbacksOnInit) swiper.emit('slideChange'); 7600 } 7601 function updateClickedSlide(e) { 7602 const swiper = this; 7603 const params = swiper.params; 7604 const slide = $(e).closest(`.${params.slideClass}`)[0]; 7605 let slideFound = false; 7606 let slideIndex; 7607 if (slide) { 7608 for(let i = 0; i < swiper.slides.length; i += 1)if (swiper.slides[i] === slide) { 7609 slideFound = true; 7610 slideIndex = i; 7611 break; 7612 } 7613 } 7614 if (slide && slideFound) { 7615 swiper.clickedSlide = slide; 7616 if (swiper.virtual && swiper.params.virtual.enabled) swiper.clickedIndex = parseInt($(slide).attr('data-swiper-slide-index'), 10); 7617 else swiper.clickedIndex = slideIndex; 7618 } else { 7619 swiper.clickedSlide = undefined; 7620 swiper.clickedIndex = undefined; 7621 return; 7622 } 7623 if (params.slideToClickedSlide && swiper.clickedIndex !== undefined && swiper.clickedIndex !== swiper.activeIndex) swiper.slideToClickedSlide(); 7624 } 7625 var update = { 7626 updateSize, 7627 updateSlides, 7628 updateAutoHeight, 7629 updateSlidesOffset, 7630 updateSlidesProgress, 7631 updateProgress, 7632 updateSlidesClasses, 7633 updateActiveIndex, 7634 updateClickedSlide 7635 }; 7636 function getSwiperTranslate(axis) { 7637 if (axis === void 0) axis = this.isHorizontal() ? 'x' : 'y'; 7638 const swiper = this; 7639 const { params, rtlTranslate: rtl, translate, $wrapperEl } = swiper; 7640 if (params.virtualTranslate) return rtl ? -translate : translate; 7641 if (params.cssMode) return translate; 7642 let currentTranslate = getTranslate($wrapperEl[0], axis); 7643 if (rtl) currentTranslate = -currentTranslate; 7644 return currentTranslate || 0; 7645 } 7646 function setTranslate(translate, byController) { 7647 const swiper = this; 7648 const { rtlTranslate: rtl, params, $wrapperEl, wrapperEl, progress } = swiper; 7649 let x = 0; 7650 let y = 0; 7651 const z = 0; 7652 if (swiper.isHorizontal()) x = rtl ? -translate : translate; 7653 else y = translate; 7654 if (params.roundLengths) { 7655 x = Math.floor(x); 7656 y = Math.floor(y); 7657 } 7658 if (params.cssMode) wrapperEl[swiper.isHorizontal() ? 'scrollLeft' : 'scrollTop'] = swiper.isHorizontal() ? -x : -y; 7659 else if (!params.virtualTranslate) $wrapperEl.transform(`translate3d(${x}px, ${y}px, ${z}px)`); 7660 swiper.previousTranslate = swiper.translate; 7661 swiper.translate = swiper.isHorizontal() ? x : y; // Check if we need to update progress 7662 let newProgress; 7663 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 7664 if (translatesDiff === 0) newProgress = 0; 7665 else newProgress = (translate - swiper.minTranslate()) / translatesDiff; 7666 if (newProgress !== progress) swiper.updateProgress(translate); 7667 swiper.emit('setTranslate', swiper.translate, byController); 7668 } 7669 function minTranslate() { 7670 return -this.snapGrid[0]; 7671 } 7672 function maxTranslate() { 7673 return -this.snapGrid[this.snapGrid.length - 1]; 7674 } 7675 function translateTo(translate, speed, runCallbacks, translateBounds, internal) { 7676 if (translate === void 0) translate = 0; 7677 if (speed === void 0) speed = this.params.speed; 7678 if (runCallbacks === void 0) runCallbacks = true; 7679 if (translateBounds === void 0) translateBounds = true; 7680 const swiper = this; 7681 const { params, wrapperEl } = swiper; 7682 if (swiper.animating && params.preventInteractionOnTransition) return false;
7683 const minTranslate = swiper.minTranslate(); 7684 const maxTranslate = swiper.maxTranslate(); 7685 let newTranslate; 7686 if (translateBounds && translate > minTranslate) newTranslate = minTranslate; 7687 else if (translateBounds && translate < maxTranslate) newTranslate = maxTranslate; 7688 else newTranslate = translate; // Update progress 7689 swiper.updateProgress(newTranslate); 7690 if (params.cssMode) { 7691 const isH = swiper.isHorizontal(); 7692 if (speed === 0) wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = -newTranslate; 7693 else { 7694 if (!swiper.support.smoothScroll) { 7695 animateCSSModeScroll({ 7696 swiper, 7697 targetPosition: -newTranslate, 7698 side: isH ? 'left' : 'top' 7699 }); 7700 return true; 7701 } 7702 wrapperEl.scrollTo({ 7703 [isH ? 'left' : 'top']: -newTranslate, 7704 behavior: 'smooth' 7705 }); 7706 } 7707 return true; 7708 } 7709 if (speed === 0) { 7710 swiper.setTransition(0); 7711 swiper.setTranslate(newTranslate); 7712 if (runCallbacks) { 7713 swiper.emit('beforeTransitionStart', speed, internal); 7714 swiper.emit('transitionEnd'); 7715 } 7716 } else { 7717 swiper.setTransition(speed); 7718 swiper.setTranslate(newTranslate); 7719 if (runCallbacks) { 7720 swiper.emit('beforeTransitionStart', speed, internal); 7721 swiper.emit('transitionStart'); 7722 } 7723 if (!swiper.animating) { 7724 swiper.animating = true; 7725 if (!swiper.onTranslateToWrapperTransitionEnd) swiper.onTranslateToWrapperTransitionEnd = function transitionEnd(e) { 7726 if (!swiper || swiper.destroyed) return; 7727 if (e.target !== this) return; 7728 swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); 7729 swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd); 7730 swiper.onTranslateToWrapperTransitionEnd = null; 7731 delete swiper.onTranslateToWrapperTransitionEnd; 7732 if (runCallbacks) swiper.emit('transitionEnd'); 7733 }; 7734 swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onTranslateToWrapperTransitionEnd); 7735 swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onTranslateToWrapperTransitionEnd); 7736 } 7737 } 7738 return true; 7739 } 7740 var translate = { 7741 getTranslate: getSwiperTranslate, 7742 setTranslate, 7743 minTranslate, 7744 maxTranslate, 7745 translateTo 7746 }; 7747 function setTransition(duration, byController) { 7748 const swiper = this; 7749 if (!swiper.params.cssMode) swiper.$wrapperEl.transition(duration); 7750 swiper.emit('setTransition', duration, byController); 7751 } 7752 function transitionEmit(_ref) { 7753 let { swiper, runCallbacks, direction, step } = _ref; 7754 const { activeIndex, previousIndex } = swiper; 7755 let dir = direction; 7756 if (!dir) { 7757 if (activeIndex > previousIndex) dir = 'next'; 7758 else if (activeIndex < previousIndex) dir = 'prev'; 7759 else dir = 'reset'; 7760 } 7761 swiper.emit(`transition${step}`); 7762 if (runCallbacks && activeIndex !== previousIndex) { 7763 if (dir === 'reset') { 7764 swiper.emit(`slideResetTransition${step}`); 7765 return; 7766 } 7767 swiper.emit(`slideChangeTransition${step}`); 7768 if (dir === 'next') swiper.emit(`slideNextTransition${step}`); 7769 else swiper.emit(`slidePrevTransition${step}`); 7770 } 7771 } 7772 function transitionStart(runCallbacks, direction) { 7773 if (runCallbacks === void 0) runCallbacks = true; 7774 const swiper = this; 7775 const { params } = swiper; 7776 if (params.cssMode) return; 7777 if (params.autoHeight) swiper.updateAutoHeight(); 7778 transitionEmit({ 7779 swiper, 7780 runCallbacks, 7781 direction, 7782 step: 'Start' 7783 }); 7784 } 7785 function transitionEnd(runCallbacks, direction) { 7786 if (runCallbacks === void 0) runCallbacks = true; 7787 const swiper = this; 7788 const { params } = swiper; 7789 swiper.animating = false;
7790 if (params.cssMode) return; 7791 swiper.setTransition(0); 7792 transitionEmit({ 7793 swiper, 7794 runCallbacks, 7795 direction, 7796 step: 'End' 7797 }); 7798 } 7799 var transition = { 7800 setTransition, 7801 transitionStart, 7802 transitionEnd 7803 }; 7804 function slideTo(index, speed, runCallbacks, internal, initial) { 7805 if (index === void 0) index = 0; 7806 if (speed === void 0) speed = this.params.speed; 7807 if (runCallbacks === void 0) runCallbacks = true; 7808 if (typeof index !== 'number' && typeof index !== 'string') throw new Error(`The 'index' argument cannot have type other than 'number' or 'string'. [${typeof index}] given.`); 7809 if (typeof index === 'string') { 7810 /** 7811 * The `index` argument converted from `string` to `number`. 7812 * @type {number} 7813 */ const indexAsNumber = parseInt(index, 10); 7814 /** 7815 * Determines whether the `index` argument is a valid `number` 7816 * after being converted from the `string` type. 7817 * @type {boolean} 7818 */ const isValidNumber = isFinite(indexAsNumber); 7819 if (!isValidNumber) throw new Error(`The passed-in 'index' (string) couldn't be converted to 'number'. [${index}] given.`); 7820 // Knowing that the converted `index` is a valid number, 7821 // we can update the original argument's value. 7822 index = indexAsNumber; 7823 } 7824 const swiper = this; 7825 let slideIndex = index; 7826 if (slideIndex < 0) slideIndex = 0; 7827 const { params, snapGrid, slidesGrid, previousIndex, activeIndex, rtlTranslate: rtl, wrapperEl, enabled } = swiper; 7828 if (swiper.animating && params.preventInteractionOnTransition || !enabled && !internal && !initial) return false; 7829 const skip = Math.min(swiper.params.slidesPerGroupSkip, slideIndex); 7830 let snapIndex = skip + Math.floor((slideIndex - skip) / swiper.params.slidesPerGroup); 7831 if (snapIndex >= snapGrid.length) snapIndex = snapGrid.length - 1; 7832 const translate = -snapGrid[snapIndex]; // Normalize slideIndex 7833 if (params.normalizeSlideIndex) for(let i = 0; i < slidesGrid.length; i += 1){ 7834 const normalizedTranslate = -Math.floor(translate * 100); 7835 const normalizedGrid = Math.floor(slidesGrid[i] * 100); 7836 const normalizedGridNext = Math.floor(slidesGrid[i + 1] * 100); 7837 if (typeof slidesGrid[i + 1] !== 'undefined') { 7838 if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext - (normalizedGridNext - normalizedGrid) / 2) slideIndex = i; 7839 else if (normalizedTranslate >= normalizedGrid && normalizedTranslate < normalizedGridNext) slideIndex = i + 1; 7840 } else if (normalizedTranslate >= normalizedGrid) slideIndex = i; 7841 } 7842 // Directions locks 7843 if (swiper.initialized && slideIndex !== activeIndex) { 7844 if (!swiper.allowSlideNext && translate < swiper.translate && translate < swiper.minTranslate()) return false; 7845 if (!swiper.allowSlidePrev && translate > swiper.translate && translate > swiper.maxTranslate()) { 7846 if ((activeIndex || 0) !== slideIndex) return false; 7847 } 7848 } 7849 if (slideIndex !== (previousIndex || 0) && runCallbacks) swiper.emit('beforeSlideChangeStart'); 7850 // Update progress 7851 swiper.updateProgress(translate); 7852 let direction; 7853 if (slideIndex > activeIndex) direction = 'next'; 7854 else if (slideIndex < activeIndex) direction = 'prev'; 7855 else direction = 'reset'; // Update Index 7856 if (rtl && -translate === swiper.translate || !rtl && translate === swiper.translate) { 7857 swiper.updateActiveIndex(slideIndex); // Update Height 7858 if (params.autoHeight) swiper.updateAutoHeight(); 7859 swiper.updateSlidesClasses(); 7860 if (params.effect !== 'slide') swiper.setTranslate(translate); 7861 if (direction !== 'reset') { 7862 swiper.transitionStart(runCallbacks, direction); 7863 swiper.transitionEnd(runCallbacks, direction); 7864 } 7865 return false;
7866 } 7867 if (params.cssMode) { 7868 const isH = swiper.isHorizontal(); 7869 const t = rtl ? translate : -translate; 7870 if (speed === 0) { 7871 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 7872 if (isVirtual) { 7873 swiper.wrapperEl.style.scrollSnapType = 'none'; 7874 swiper._immediateVirtual = true; 7875 } 7876 wrapperEl[isH ? 'scrollLeft' : 'scrollTop'] = t; 7877 if (isVirtual) requestAnimationFrame(()=>{ 7878 swiper.wrapperEl.style.scrollSnapType = ''; 7879 swiper._swiperImmediateVirtual = false; 7880 }); 7881 } else { 7882 if (!swiper.support.smoothScroll) { 7883 animateCSSModeScroll({ 7884 swiper, 7885 targetPosition: t, 7886 side: isH ? 'left' : 'top' 7887 }); 7888 return true; 7889 } 7890 wrapperEl.scrollTo({ 7891 [isH ? 'left' : 'top']: t, 7892 behavior: 'smooth' 7893 }); 7894 } 7895 return true; 7896 } 7897 swiper.setTransition(speed); 7898 swiper.setTranslate(translate); 7899 swiper.updateActiveIndex(slideIndex); 7900 swiper.updateSlidesClasses(); 7901 swiper.emit('beforeTransitionStart', speed, internal); 7902 swiper.transitionStart(runCallbacks, direction); 7903 if (speed === 0) swiper.transitionEnd(runCallbacks, direction); 7904 else if (!swiper.animating) { 7905 swiper.animating = true; 7906 if (!swiper.onSlideToWrapperTransitionEnd) swiper.onSlideToWrapperTransitionEnd = function transitionEnd(e) { 7907 if (!swiper || swiper.destroyed) return; 7908 if (e.target !== this) return; 7909 swiper.$wrapperEl[0].removeEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); 7910 swiper.$wrapperEl[0].removeEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd); 7911 swiper.onSlideToWrapperTransitionEnd = null; 7912 delete swiper.onSlideToWrapperTransitionEnd; 7913 swiper.transitionEnd(runCallbacks, direction); 7914 }; 7915 swiper.$wrapperEl[0].addEventListener('transitionend', swiper.onSlideToWrapperTransitionEnd); 7916 swiper.$wrapperEl[0].addEventListener('webkitTransitionEnd', swiper.onSlideToWrapperTransitionEnd); 7917 } 7918 return true; 7919 } 7920 function slideToLoop(index, speed, runCallbacks, internal) { 7921 if (index === void 0) index = 0; 7922 if (speed === void 0) speed = this.params.speed; 7923 if (runCallbacks === void 0) runCallbacks = true; 7924 if (typeof index === 'string') { 7925 /** 7926 * The `index` argument converted from `string` to `number`. 7927 * @type {number} 7928 */ const indexAsNumber = parseInt(index, 10); 7929 /** 7930 * Determines whether the `index` argument is a valid `number` 7931 * after being converted from the `string` type. 7932 * @type {boolean} 7933 */ const isValidNumber = isFinite(indexAsNumber); 7934 if (!isValidNumber) throw new Error(`The passed-in 'index' (string) couldn't be converted to 'number'. [${index}] given.`); 7935 // Knowing that the converted `index` is a valid number, 7936 // we can update the original argument's value. 7937 index = indexAsNumber; 7938 } 7939 const swiper = this; 7940 let newIndex = index; 7941 if (swiper.params.loop) newIndex += swiper.loopedSlides; 7942 return swiper.slideTo(newIndex, speed, runCallbacks, internal); 7943 } 7944 /* eslint no-unused-vars: "off" */ function slideNext(speed, runCallbacks, internal) { 7945 if (speed === void 0) speed = this.params.speed; 7946 if (runCallbacks === void 0) runCallbacks = true; 7947 const swiper = this; 7948 const { animating, enabled, params } = swiper; 7949 if (!enabled) return swiper; 7950 let perGroup = params.slidesPerGroup; 7951 if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) perGroup = Math.max(swiper.slidesPerViewDynamic('current', true), 1); 7952 const increment = swiper.activeIndex < params.slidesPerGroupSkip ? 1 : perGroup; 7953 if (params.loop) { 7954 if (animating && params.loopPreventsSlide) return false;
vendor: 14,420 bytes, lines 7955-8217
7955 swiper.loopFix(); // eslint-disable-next-line 7956 swiper._clientLeft = swiper.$wrapperEl[0].clientLeft; 7957 } 7958 if (params.rewind && swiper.isEnd) return swiper.slideTo(0, speed, runCallbacks, internal); 7959 return swiper.slideTo(swiper.activeIndex + increment, speed, runCallbacks, internal); 7960 } 7961 /* eslint no-unused-vars: "off" */ function slidePrev(speed, runCallbacks, internal) { 7962 if (speed === void 0) speed = this.params.speed; 7963 if (runCallbacks === void 0) runCallbacks = true; 7964 const swiper = this; 7965 const { params, animating, snapGrid, slidesGrid, rtlTranslate, enabled } = swiper; 7966 if (!enabled) return swiper; 7967 if (params.loop) { 7968 if (animating && params.loopPreventsSlide) return false; 7969 swiper.loopFix(); // eslint-disable-next-line 7970 swiper._clientLeft = swiper.$wrapperEl[0].clientLeft; 7971 } 7972 const translate = rtlTranslate ? swiper.translate : -swiper.translate; 7973 function normalize(val) { 7974 if (val < 0) return -Math.floor(Math.abs(val)); 7975 return Math.floor(val); 7976 } 7977 const normalizedTranslate = normalize(translate); 7978 const normalizedSnapGrid = snapGrid.map((val)=>normalize(val)); 7979 let prevSnap = snapGrid[normalizedSnapGrid.indexOf(normalizedTranslate) - 1]; 7980 if (typeof prevSnap === 'undefined' && params.cssMode) { 7981 let prevSnapIndex; 7982 snapGrid.forEach((snap, snapIndex)=>{ 7983 if (normalizedTranslate >= snap) // prevSnap = snap; 7984 prevSnapIndex = snapIndex; 7985 }); 7986 if (typeof prevSnapIndex !== 'undefined') prevSnap = snapGrid[prevSnapIndex > 0 ? prevSnapIndex - 1 : prevSnapIndex]; 7987 } 7988 let prevIndex = 0; 7989 if (typeof prevSnap !== 'undefined') { 7990 prevIndex = slidesGrid.indexOf(prevSnap); 7991 if (prevIndex < 0) prevIndex = swiper.activeIndex - 1; 7992 if (params.slidesPerView === 'auto' && params.slidesPerGroup === 1 && params.slidesPerGroupAuto) { 7993 prevIndex = prevIndex - swiper.slidesPerViewDynamic('previous', true) + 1; 7994 prevIndex = Math.max(prevIndex, 0); 7995 } 7996 } 7997 if (params.rewind && swiper.isBeginning) { 7998 const lastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1; 7999 return swiper.slideTo(lastIndex, speed, runCallbacks, internal); 8000 } 8001 return swiper.slideTo(prevIndex, speed, runCallbacks, internal); 8002 } 8003 /* eslint no-unused-vars: "off" */ function slideReset(speed, runCallbacks, internal) { 8004 if (speed === void 0) speed = this.params.speed; 8005 if (runCallbacks === void 0) runCallbacks = true; 8006 const swiper = this; 8007 return swiper.slideTo(swiper.activeIndex, speed, runCallbacks, internal); 8008 } 8009 /* eslint no-unused-vars: "off" */ function slideToClosest(speed, runCallbacks, internal, threshold) { 8010 if (speed === void 0) speed = this.params.speed; 8011 if (runCallbacks === void 0) runCallbacks = true; 8012 if (threshold === void 0) threshold = 0.5; 8013 const swiper = this; 8014 let index = swiper.activeIndex; 8015 const skip = Math.min(swiper.params.slidesPerGroupSkip, index); 8016 const snapIndex = skip + Math.floor((index - skip) / swiper.params.slidesPerGroup); 8017 const translate = swiper.rtlTranslate ? swiper.translate : -swiper.translate; 8018 if (translate >= swiper.snapGrid[snapIndex]) { 8019 // The current translate is on or after the current snap index, so the choice 8020 // is between the current index and the one after it. 8021 const currentSnap = swiper.snapGrid[snapIndex]; 8022 const nextSnap = swiper.snapGrid[snapIndex + 1]; 8023 if (translate - currentSnap > (nextSnap - currentSnap) * threshold) index += swiper.params.slidesPerGroup; 8024 } else { 8025 // The current translate is before the current snap index, so the choice 8026 // is between the current index and the one before it. 8027 const prevSnap = swiper.snapGrid[snapIndex - 1]; 8028 const currentSnap = swiper.snapGrid[snapIndex]; 8029 if (translate - prevSnap <= (currentSnap - prevSnap) * threshold) index -= swiper.params.slidesPerGroup; 8030 } 8031 index = Math.max(index, 0); 8032 index = Math.min(index, swiper.slidesGrid.length - 1); 8033 return swiper.slideTo(index, speed, runCallbacks, internal); 8034 } 8035 function slideToClickedSlide() { 8036 const swiper = this; 8037 const { params, $wrapperEl } = swiper; 8038 const slidesPerView = params.slidesPerView === 'auto' ? swiper.slidesPerViewDynamic() : params.slidesPerView; 8039 let slideToIndex = swiper.clickedIndex; 8040 let realIndex; 8041 if (params.loop) { 8042 if (swiper.animating) return; 8043 realIndex = parseInt($(swiper.clickedSlide).attr('data-swiper-slide-index'), 10); 8044 if (params.centeredSlides) { 8045 if (slideToIndex < swiper.loopedSlides - slidesPerView / 2 || slideToIndex > swiper.slides.length - swiper.loopedSlides + slidesPerView / 2) { 8046 swiper.loopFix(); 8047 slideToIndex = $wrapperEl.children(`.${params.slideClass}[data-swiper-slide-index="${realIndex}"]:not(.${params.slideDuplicateClass})`).eq(0).index(); 8048 nextTick(()=>{ 8049 swiper.slideTo(slideToIndex); 8050 }); 8051 } else swiper.slideTo(slideToIndex); 8052 } else if (slideToIndex > swiper.slides.length - slidesPerView) { 8053 swiper.loopFix(); 8054 slideToIndex = $wrapperEl.children(`.${params.slideClass}[data-swiper-slide-index="${realIndex}"]:not(.${params.slideDuplicateClass})`).eq(0).index(); 8055 nextTick(()=>{ 8056 swiper.slideTo(slideToIndex); 8057 }); 8058 } else swiper.slideTo(slideToIndex); 8059 } else swiper.slideTo(slideToIndex); 8060 } 8061 var slide = { 8062 slideTo, 8063 slideToLoop, 8064 slideNext, 8065 slidePrev, 8066 slideReset, 8067 slideToClosest, 8068 slideToClickedSlide 8069 }; 8070 function loopCreate() { 8071 const swiper = this; 8072 const document1 = getDocument(); 8073 const { params, $wrapperEl } = swiper; // Remove duplicated slides 8074 const $selector = $wrapperEl.children().length > 0 ? $($wrapperEl.children()[0].parentNode) : $wrapperEl; 8075 $selector.children(`.${params.slideClass}.${params.slideDuplicateClass}`).remove(); 8076 let slides = $selector.children(`.${params.slideClass}`); 8077 if (params.loopFillGroupWithBlank) { 8078 const blankSlidesNum = params.slidesPerGroup - slides.length % params.slidesPerGroup; 8079 if (blankSlidesNum !== params.slidesPerGroup) { 8080 for(let i = 0; i < blankSlidesNum; i += 1){ 8081 const blankNode = $(document1.createElement('div')).addClass(`${params.slideClass} ${params.slideBlankClass}`); 8082 $selector.append(blankNode); 8083 } 8084 slides = $selector.children(`.${params.slideClass}`); 8085 } 8086 } 8087 if (params.slidesPerView === 'auto' && !params.loopedSlides) params.loopedSlides = slides.length; 8088 swiper.loopedSlides = Math.ceil(parseFloat(params.loopedSlides || params.slidesPerView, 10)); 8089 swiper.loopedSlides += params.loopAdditionalSlides; 8090 if (swiper.loopedSlides > slides.length && swiper.params.loopedSlidesLimit) swiper.loopedSlides = slides.length; 8091 const prependSlides = []; 8092 const appendSlides = []; 8093 slides.each((el, index)=>{ 8094 const slide = $(el); 8095 slide.attr('data-swiper-slide-index', index); 8096 }); 8097 for(let i = 0; i < swiper.loopedSlides; i += 1){ 8098 const index = i - Math.floor(i / slides.length) * slides.length; 8099 appendSlides.push(slides.eq(index)[0]); 8100 prependSlides.unshift(slides.eq(slides.length - index - 1)[0]); 8101 } 8102 for(let i = 0; i < appendSlides.length; i += 1)$selector.append($(appendSlides[i].cloneNode(true)).addClass(params.slideDuplicateClass)); 8103 for(let i = prependSlides.length - 1; i >= 0; i -= 1)$selector.prepend($(prependSlides[i].cloneNode(true)).addClass(params.slideDuplicateClass)); 8104 } 8105 function loopFix() { 8106 const swiper = this; 8107 swiper.emit('beforeLoopFix'); 8108 const { activeIndex, slides, loopedSlides, allowSlidePrev, allowSlideNext, snapGrid, rtlTranslate: rtl } = swiper; 8109 let newIndex; 8110 swiper.allowSlidePrev = true; 8111 swiper.allowSlideNext = true; 8112 const snapTranslate = -snapGrid[activeIndex]; 8113 const diff = snapTranslate - swiper.getTranslate(); // Fix For Negative Oversliding 8114 if (activeIndex < loopedSlides) { 8115 newIndex = slides.length - loopedSlides * 3 + activeIndex; 8116 newIndex += loopedSlides; 8117 const slideChanged = swiper.slideTo(newIndex, 0, false, true); 8118 if (slideChanged && diff !== 0) swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff); 8119 } else if (activeIndex >= slides.length - loopedSlides) { 8120 // Fix For Positive Oversliding 8121 newIndex = -slides.length + activeIndex + loopedSlides; 8122 newIndex += loopedSlides; 8123 const slideChanged = swiper.slideTo(newIndex, 0, false, true); 8124 if (slideChanged && diff !== 0) swiper.setTranslate((rtl ? -swiper.translate : swiper.translate) - diff); 8125 } 8126 swiper.allowSlidePrev = allowSlidePrev; 8127 swiper.allowSlideNext = allowSlideNext; 8128 swiper.emit('loopFix'); 8129 } 8130 function loopDestroy() { 8131 const swiper = this; 8132 const { $wrapperEl, params, slides } = swiper; 8133 $wrapperEl.children(`.${params.slideClass}.${params.slideDuplicateClass},.${params.slideClass}.${params.slideBlankClass}`).remove(); 8134 slides.removeAttr('data-swiper-slide-index'); 8135 } 8136 var loop = { 8137 loopCreate, 8138 loopFix, 8139 loopDestroy 8140 }; 8141 function setGrabCursor(moving) { 8142 const swiper = this; 8143 if (swiper.support.touch || !swiper.params.simulateTouch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return; 8144 const el = swiper.params.touchEventsTarget === 'container' ? swiper.el : swiper.wrapperEl; 8145 el.style.cursor = 'move'; 8146 el.style.cursor = moving ? 'grabbing' : 'grab'; 8147 } 8148 function unsetGrabCursor() { 8149 const swiper = this; 8150 if (swiper.support.touch || swiper.params.watchOverflow && swiper.isLocked || swiper.params.cssMode) return; 8151 swiper[swiper.params.touchEventsTarget === 'container' ? 'el' : 'wrapperEl'].style.cursor = ''; 8152 } 8153 var grabCursor = { 8154 setGrabCursor, 8155 unsetGrabCursor 8156 }; 8157 function closestElement(selector, base) { 8158 if (base === void 0) base = this; 8159 function __closestFrom(el) { 8160 if (!el || el === getDocument() || el === getWindow()) return null; 8161 if (el.assignedSlot) el = el.assignedSlot; 8162 const found = el.closest(selector); 8163 if (!found && !el.getRootNode) return null; 8164 return found || __closestFrom(el.getRootNode().host); 8165 } 8166 return __closestFrom(base); 8167 } 8168 function onTouchStart(event1) { 8169 const swiper = this; 8170 const document1 = getDocument(); 8171 const window1 = getWindow(); 8172 const data = swiper.touchEventsData; 8173 const { params, touches, enabled } = swiper; 8174 if (!enabled) return; 8175 if (swiper.animating && params.preventInteractionOnTransition) return; 8176 if (!swiper.animating && params.cssMode && params.loop) swiper.loopFix(); 8177 let e = event1; 8178 if (e.originalEvent) e = e.originalEvent; 8179 let $targetEl = $(e.target); 8180 if (params.touchEventsTarget === 'wrapper') { 8181 if (!$targetEl.closest(swiper.wrapperEl).length) return; 8182 } 8183 data.isTouchEvent = e.type === 'touchstart'; 8184 if (!data.isTouchEvent && 'which' in e && e.which === 3) return; 8185 if (!data.isTouchEvent && 'button' in e && e.button > 0) return; 8186 if (data.isTouched && data.isMoved) return; // change target el for shadow root component 8187 const swipingClassHasValue = !!params.noSwipingClass && params.noSwipingClass !== ''; // eslint-disable-next-line 8188 const eventPath = event1.composedPath ? event1.composedPath() : event1.path; 8189 if (swipingClassHasValue && e.target && e.target.shadowRoot && eventPath) $targetEl = $(eventPath[0]); 8190 const noSwipingSelector = params.noSwipingSelector ? params.noSwipingSelector : `.${params.noSwipingClass}`; 8191 const isTargetShadow = !!(e.target && e.target.shadowRoot); // use closestElement for shadow root element to get the actual closest for nested shadow root element 8192 if (params.noSwiping && (isTargetShadow ? closestElement(noSwipingSelector, $targetEl[0]) : $targetEl.closest(noSwipingSelector)[0])) { 8193 swiper.allowClick = true; 8194 return; 8195 } 8196 if (params.swipeHandler) { 8197 if (!$targetEl.closest(params.swipeHandler)[0]) return; 8198 } 8199 touches.currentX = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX; 8200 touches.currentY = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY; 8201 const startX = touches.currentX; 8202 const startY = touches.currentY; // Do NOT start if iOS edge swipe is detected. Otherwise iOS app cannot swipe-to-go-back anymore 8203 const edgeSwipeDetection = params.edgeSwipeDetection || params.iOSEdgeSwipeDetection; 8204 const edgeSwipeThreshold = params.edgeSwipeThreshold || params.iOSEdgeSwipeThreshold; 8205 if (edgeSwipeDetection && (startX <= edgeSwipeThreshold || startX >= window1.innerWidth - edgeSwipeThreshold)) { 8206 if (edgeSwipeDetection === 'prevent') event1.preventDefault(); 8207 else return; 8208 } 8209 Object.assign(data, { 8210 isTouched: true, 8211 isMoved: false, 8212 allowTouchCallbacks: true, 8213 isScrolling: undefined, 8214 startMoving: undefined 8215 }); 8216 touches.startX = startX; 8217 touches.startY = startY;
8218 data.touchStartTime = now(); 8219 swiper.allowClick = true; 8220 swiper.updateSize(); 8221 swiper.swipeDirection = undefined; 8222 if (params.threshold > 0) data.allowThresholdMove = false; 8223 if (e.type !== 'touchstart') { 8224 let preventDefault = true; 8225 if ($targetEl.is(data.focusableElements)) { 8226 preventDefault = false; 8227 if ($targetEl[0].nodeName === 'SELECT') data.isTouched = false; 8228 } 8229 if (document1.activeElement && $(document1.activeElement).is(data.focusableElements) && document1.activeElement !== $targetEl[0]) document1.activeElement.blur(); 8230 const shouldPreventDefault = preventDefault && swiper.allowTouchMove && params.touchStartPreventDefault; 8231 if ((params.touchStartForcePreventDefault || shouldPreventDefault) && !$targetEl[0].isContentEditable) e.preventDefault(); 8232 } 8233 if (swiper.params.freeMode && swiper.params.freeMode.enabled && swiper.freeMode && swiper.animating && !params.cssMode) swiper.freeMode.onTouchStart(); 8234 swiper.emit('touchStart', e); 8235 } 8236 function onTouchMove(event1) { 8237 const document1 = getDocument(); 8238 const swiper = this; 8239 const data = swiper.touchEventsData; 8240 const { params, touches, rtlTranslate: rtl, enabled } = swiper; 8241 if (!enabled) return; 8242 let e = event1; 8243 if (e.originalEvent) e = e.originalEvent; 8244 if (!data.isTouched) { 8245 if (data.startMoving && data.isScrolling) swiper.emit('touchMoveOpposite', e); 8246 return; 8247 } 8248 if (data.isTouchEvent && e.type !== 'touchmove') return; 8249 const targetTouch = e.type === 'touchmove' && e.targetTouches && (e.targetTouches[0] || e.changedTouches[0]); 8250 const pageX = e.type === 'touchmove' ? targetTouch.pageX : e.pageX; 8251 const pageY = e.type === 'touchmove' ? targetTouch.pageY : e.pageY; 8252 if (e.preventedByNestedSwiper) { 8253 touches.startX = pageX; 8254 touches.startY = pageY; 8255 return; 8256 } 8257 if (!swiper.allowTouchMove) { 8258 if (!$(e.target).is(data.focusableElements)) swiper.allowClick = false; 8259 if (data.isTouched) { 8260 Object.assign(touches, { 8261 startX: pageX, 8262 startY: pageY, 8263 currentX: pageX, 8264 currentY: pageY 8265 }); 8266 data.touchStartTime = now(); 8267 } 8268 return; 8269 } 8270 if (data.isTouchEvent && params.touchReleaseOnEdges && !params.loop) { 8271 if (swiper.isVertical()) // Vertical 8272 { 8273 if (pageY < touches.startY && swiper.translate <= swiper.maxTranslate() || pageY > touches.startY && swiper.translate >= swiper.minTranslate()) { 8274 data.isTouched = false; 8275 data.isMoved = false; 8276 return; 8277 } 8278 } else if (pageX < touches.startX && swiper.translate <= swiper.maxTranslate() || pageX > touches.startX && swiper.translate >= swiper.minTranslate()) return; 8279 } 8280 if (data.isTouchEvent && document1.activeElement) { 8281 if (e.target === document1.activeElement && $(e.target).is(data.focusableElements)) { 8282 data.isMoved = true; 8283 swiper.allowClick = false; 8284 return; 8285 } 8286 } 8287 if (data.allowTouchCallbacks) swiper.emit('touchMove', e); 8288 if (e.targetTouches && e.targetTouches.length > 1) return; 8289 touches.currentX = pageX; 8290 touches.currentY = pageY; 8291 const diffX = touches.currentX - touches.startX; 8292 const diffY = touches.currentY - touches.startY; 8293 if (swiper.params.threshold && Math.sqrt(diffX ** 2 + diffY ** 2) < swiper.params.threshold) return; 8294 if (typeof data.isScrolling === 'undefined') { 8295 let touchAngle; 8296 if (swiper.isHorizontal() && touches.currentY === touches.startY || swiper.isVertical() && touches.currentX === touches.startX) data.isScrolling = false;
8297 else // eslint-disable-next-line 8298 if (diffX * diffX + diffY * diffY >= 25) { 8299 touchAngle = Math.atan2(Math.abs(diffY), Math.abs(diffX)) * 180 / Math.PI; 8300 data.isScrolling = swiper.isHorizontal() ? touchAngle > params.touchAngle : 90 - touchAngle > params.touchAngle; 8301 } 8302 } 8303 if (data.isScrolling) swiper.emit('touchMoveOpposite', e); 8304 if (typeof data.startMoving === 'undefined') { 8305 if (touches.currentX !== touches.startX || touches.currentY !== touches.startY) data.startMoving = true; 8306 } 8307 if (data.isScrolling) { 8308 data.isTouched = false; 8309 return; 8310 } 8311 if (!data.startMoving) return; 8312 swiper.allowClick = false; 8313 if (!params.cssMode && e.cancelable) e.preventDefault(); 8314 if (params.touchMoveStopPropagation && !params.nested) e.stopPropagation(); 8315 if (!data.isMoved) { 8316 if (params.loop && !params.cssMode) swiper.loopFix(); 8317 data.startTranslate = swiper.getTranslate(); 8318 swiper.setTransition(0); 8319 if (swiper.animating) swiper.$wrapperEl.trigger('webkitTransitionEnd transitionend'); 8320 data.allowMomentumBounce = false; // Grab Cursor 8321 if (params.grabCursor && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) swiper.setGrabCursor(true); 8322 swiper.emit('sliderFirstMove', e); 8323 } 8324 swiper.emit('sliderMove', e); 8325 data.isMoved = true; 8326 let diff = swiper.isHorizontal() ? diffX : diffY; 8327 touches.diff = diff; 8328 diff *= params.touchRatio; 8329 if (rtl) diff = -diff; 8330 swiper.swipeDirection = diff > 0 ? 'prev' : 'next'; 8331 data.currentTranslate = diff + data.startTranslate; 8332 let disableParentSwiper = true; 8333 let resistanceRatio = params.resistanceRatio; 8334 if (params.touchReleaseOnEdges) resistanceRatio = 0; 8335 if (diff > 0 && data.currentTranslate > swiper.minTranslate()) { 8336 disableParentSwiper = false;
8337 if (params.resistance) data.currentTranslate = swiper.minTranslate() - 1 + (-swiper.minTranslate() + data.startTranslate + diff) ** resistanceRatio; 8338 } else if (diff < 0 && data.currentTranslate < swiper.maxTranslate()) { 8339 disableParentSwiper = false; 8340 if (params.resistance) data.currentTranslate = swiper.maxTranslate() + 1 - (swiper.maxTranslate() - data.startTranslate - diff) ** resistanceRatio; 8341 } 8342 if (disableParentSwiper) e.preventedByNestedSwiper = true; 8343 // Directions locks 8344 if (!swiper.allowSlideNext && swiper.swipeDirection === 'next' && data.currentTranslate < data.startTranslate) data.currentTranslate = data.startTranslate; 8345 if (!swiper.allowSlidePrev && swiper.swipeDirection === 'prev' && data.currentTranslate > data.startTranslate) data.currentTranslate = data.startTranslate; 8346 if (!swiper.allowSlidePrev && !swiper.allowSlideNext) data.currentTranslate = data.startTranslate; 8347 // Threshold 8348 if (params.threshold > 0) { 8349 if (Math.abs(diff) > params.threshold || data.allowThresholdMove) { 8350 if (!data.allowThresholdMove) { 8351 data.allowThresholdMove = true; 8352 touches.startX = touches.currentX; 8353 touches.startY = touches.currentY; 8354 data.currentTranslate = data.startTranslate; 8355 touches.diff = swiper.isHorizontal() ? touches.currentX - touches.startX : touches.currentY - touches.startY; 8356 return; 8357 } 8358 } else { 8359 data.currentTranslate = data.startTranslate; 8360 return; 8361 } 8362 } 8363 if (!params.followFinger || params.cssMode) return; // Update active index in free mode 8364 if (params.freeMode && params.freeMode.enabled && swiper.freeMode || params.watchSlidesProgress) { 8365 swiper.updateActiveIndex(); 8366 swiper.updateSlidesClasses(); 8367 } 8368 if (swiper.params.freeMode && params.freeMode.enabled && swiper.freeMode) swiper.freeMode.onTouchMove(); 8369 // Update progress 8370 swiper.updateProgress(data.currentTranslate); // Update translate 8371 swiper.setTranslate(data.currentTranslate); 8372 } 8373 function onTouchEnd(event1) { 8374 const swiper = this; 8375 const data = swiper.touchEventsData; 8376 const { params, touches, rtlTranslate: rtl, slidesGrid, enabled } = swiper; 8377 if (!enabled) return; 8378 let e = event1; 8379 if (e.originalEvent) e = e.originalEvent; 8380 if (data.allowTouchCallbacks) swiper.emit('touchEnd', e); 8381 data.allowTouchCallbacks = false; 8382 if (!data.isTouched) { 8383 if (data.isMoved && params.grabCursor) swiper.setGrabCursor(false); 8384 data.isMoved = false; 8385 data.startMoving = false; 8386 return; 8387 } // Return Grab Cursor 8388 if (params.grabCursor && data.isMoved && data.isTouched && (swiper.allowSlideNext === true || swiper.allowSlidePrev === true)) swiper.setGrabCursor(false); 8389 // Time diff 8390 const touchEndTime = now(); 8391 const timeDiff = touchEndTime - data.touchStartTime; // Tap, doubleTap, Click 8392 if (swiper.allowClick) { 8393 const pathTree = e.path || e.composedPath && e.composedPath(); 8394 swiper.updateClickedSlide(pathTree && pathTree[0] || e.target); 8395 swiper.emit('tap click', e); 8396 if (timeDiff < 300 && touchEndTime - data.lastClickTime < 300) swiper.emit('doubleTap doubleClick', e); 8397 } 8398 data.lastClickTime = now(); 8399 nextTick(()=>{ 8400 if (!swiper.destroyed) swiper.allowClick = true; 8401 }); 8402 if (!data.isTouched || !data.isMoved || !swiper.swipeDirection || touches.diff === 0 || data.currentTranslate === data.startTranslate) { 8403 data.isTouched = false; 8404 data.isMoved = false; 8405 data.startMoving = false; 8406 return; 8407 } 8408 data.isTouched = false; 8409 data.isMoved = false; 8410 data.startMoving = false; 8411 let currentPos; 8412 if (params.followFinger) currentPos = rtl ? swiper.translate : -swi
8412per.translate; 8413 else currentPos = -data.currentTranslate; 8414 if (params.cssMode) return; 8415 if (swiper.params.freeMode && params.freeMode.enabled) { 8416 swiper.freeMode.onTouchEnd({ 8417 currentPos 8418 }); 8419 return; 8420 } // Find current slide 8421 let stopIndex = 0; 8422 let groupSize = swiper.slidesSizesGrid[0]; 8423 for(let i = 0; i < slidesGrid.length; i += i < params.slidesPerGroupSkip ? 1 : params.slidesPerGroup){ 8424 const increment = i < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; 8425 if (typeof slidesGrid[i + increment] !== 'undefined') { 8426 if (currentPos >= slidesGrid[i] && currentPos < slidesGrid[i + increment]) { 8427 stopIndex = i; 8428 groupSize = slidesGrid[i + increment] - slidesGrid[i]; 8429 } 8430 } else if (currentPos >= slidesGrid[i]) { 8431 stopIndex = i; 8432 groupSize = slidesGrid[slidesGrid.length - 1] - slidesGrid[slidesGrid.length - 2]; 8433 } 8434 } 8435 let rewindFirstIndex = null; 8436 let rewindLastIndex = null; 8437 if (params.rewind) { 8438 if (swiper.isBeginning) rewindLastIndex = swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual ? swiper.virtual.slides.length - 1 : swiper.slides.length - 1; 8439 else if (swiper.isEnd) rewindFirstIndex = 0; 8440 } // Find current slide size 8441 const ratio = (currentPos - slidesGrid[stopIndex]) / groupSize; 8442 const increment = stopIndex < params.slidesPerGroupSkip - 1 ? 1 : params.slidesPerGroup; 8443 if (timeDiff > params.longSwipesMs) { 8444 // Long touches 8445 if (!params.longSwipes) { 8446 swiper.slideTo(swiper.activeIndex); 8447 return; 8448 } 8449 if (swiper.swipeDirection === 'next') { 8450 if (ratio >= params.longSwipesRatio) swiper.slideTo(params.rewind && swiper.isEnd ? rewindFirstIndex : stopIndex + increment); 8451 else swiper.slideTo(stopIndex); 8452 } 8453 if (swiper.swipeDirection === 'prev') { 8454 if (ratio > 1 - params.longSwipesRatio) swiper.slideTo(stopIndex + increment); 8455 else if (rewindLastIndex !== null && ratio < 0 && Math.abs(ratio) > params.longSwipesRatio) swiper.slideTo(rewindLastIndex); 8456 else swiper.slideTo(stopIndex); 8457 } 8458 } else { 8459 // Short swipes 8460 if (!params.shortSwipes) { 8461 swiper.slideTo(swiper.activeIndex); 8462 return; 8463 } 8464 const isNavButtonTarget = swiper.navigation && (e.target === swiper.navigation.nextEl || e.target === swiper.navigation.prevEl); 8465 if (!isNavButtonTarget) { 8466 if (swiper.swipeDirection === 'next') swiper.slideTo(rewindFirstIndex !== null ? rewindFirstIndex : stopIndex + increment); 8467 if (swiper.swipeDirection === 'prev') swiper.slideTo(rewindLastIndex !== null ? rewindLastIndex : stopIndex); 8468 } else if (e.target === swiper.navigation.nextEl) swiper.slideTo(stopIndex + increment); 8469 else swiper.slideTo(stopIndex); 8470 } 8471 } 8472 function onResize() { 8473 const swiper = this; 8474 const { params, el } = swiper; 8475 if (el && el.offsetWidth === 0) return; // Breakpoints 8476 if (params.breakpoints) swiper.setBreakpoint(); 8477 // Save locks 8478 const { allowSlideNext, allowSlidePrev, snapGrid } = swiper; // Disable locks on resize 8479 swiper.allowSlideNext = true; 8480 swiper.allowSlidePrev = true; 8481 swiper.updateSize(); 8482 swiper.updateSlides(); 8483 swiper.updateSlidesClasses(); 8484 if ((params.slidesPerView === 'auto' || params.slidesPerView > 1) && swiper.isEnd && !swiper.isBeginning && !swiper.params.centeredSlides) swiper.slideTo(swiper.slides.length - 1, 0, false, true); 8485 else swiper.slideTo(swiper.activeIndex, 0, false, true); 8486 if (swiper.autoplay && swiper.autoplay.running && swiper.autoplay.paused) swiper.autoplay.run(); 8487 // Return locks after resize 8488 swiper.allowSlidePrev = allowSlidePrev; 8489 swiper.allowSlideNext = allowSlideNext; 8490 if (swiper.params.watchOverflow && snapGrid !== swiper.snapGrid) swiper.checkOverflow(); 8491 } 8492 function onClick(e) { 8493 const swiper = this; 8494 if (!swiper.enabled) return; 8495 if (!swiper.allowClick) { 8496 if (swiper.params.preventClicks) e.preventDefault(); 8497 if (swiper.params.preventClicksPropagation && swiper.animating) { 8498 e.stopPropagation(); 8499 e.stopImmediatePropagation(); 8500 } 8501 } 8502 } 8503 function onScroll() { 8504 const swiper = this; 8505 const { wrapperEl, rtlTranslate, enabled } = swiper; 8506 if (!enabled) return; 8507 swiper.previousTranslate = swiper.translate; 8508 if (swiper.isHorizontal()) swiper.translate = -wrapperEl.scrollLeft; 8509 else swiper.translate = -wrapperEl.scrollTop; 8510 // eslint-disable-next-line 8511 if (swiper.translate === 0) swiper.translate = 0; 8512 swiper.updateActiveIndex(); 8513 swiper.updateSlidesClasses(); 8514 let newProgress; 8515 const translatesDiff = swiper.maxTranslate() - swiper.minTranslate(); 8516 if (translatesDiff === 0) newProgress = 0; 8517 else newProgress = (swiper.translate - swiper.minTranslate()) / translatesDiff; 8518 if (newProgress !== swiper.progress) swiper.updateProgress(rtlTranslate ? -swiper.translate : swiper.translate); 8519 swiper.emit('setTranslate', swiper.translate, false); 8520 } 8521 let dummyEventAttached = false;
8522 function dummyEventListener() {} 8523 const events = (swiper, method)=>{ 8524 const document1 = getDocument(); 8525 const { params, touchEvents, el, wrapperEl, device, support } = swiper; 8526 const capture = !!params.nested; 8527 const domMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; 8528 const swiperMethod = method; // Touch Events 8529 if (!support.touch) { 8530 el[domMethod](touchEvents.start, swiper.onTouchStart, false); 8531 document1[domMethod](touchEvents.move, swiper.onTouchMove, capture); 8532 document1[domMethod](touchEvents.end, swiper.onTouchEnd, false); 8533 } else { 8534 const passiveListener = touchEvents.start === 'touchstart' && support.passiveListener && params.passiveListeners ? { 8535 passive: true, 8536 capture: false 8537 } : false; 8538 el[domMethod](touchEvents.start, swiper.onTouchStart, passiveListener); 8539 el[domMethod](touchEvents.move, swiper.onTouchMove, support.passiveListener ? { 8540 passive: false, 8541 capture 8542 } : capture); 8543 el[domMethod](touchEvents.end, swiper.onTouchEnd, passiveListener); 8544 if (touchEvents.cancel) el[domMethod](touchEvents.cancel, swiper.onTouchEnd, passiveListener); 8545 } // Prevent Links Clicks 8546 if (params.preventClicks || params.preventClicksPropagation) el[domMethod]('click', swiper.onClick, true); 8547 if (params.cssMode) wrapperEl[domMethod]('scroll', swiper.onScroll); 8548 // Resize handler 8549 if (params.updateOnWindowResize) swiper[swiperMethod](device.ios || device.android ? 'resize orientationchange observerUpdate' : 'resize observerUpdate', onResize, true); 8550 else swiper[swiperMethod]('observerUpdate', onResize, true); 8551 }; 8552 function attachEvents() { 8553 const swiper = this; 8554 const document1 = getDocument(); 8555 const { params, support } = swiper; 8556 swiper.onTouchStart = onTouchStart.bind(swiper); 8557 swiper.onTouchMove = onTouchMove.bind(swiper); 8558 swiper.onTouchEnd = onTouchEnd.bind(swiper); 8559 if (params.cssMode) swiper.onScroll = onScroll.bind(swiper); 8560 swiper.onClick = onClick.bind(swiper); 8561 if (support.touch && !dummyEventAttached) { 8562 document1.addEventListener('touchstart', dummyEventListener); 8563 dummyEventAttached = true; 8564 } 8565 events(swiper, 'on'); 8566 } 8567 function detachEvents() { 8568 const swiper = this; 8569 events(swiper, 'off'); 8570 } 8571 var events$1 = { 8572 attachEvents, 8573 detachEvents 8574 }; 8575 const isGridEnabled = (swiper, params)=>{ 8576 return swiper.grid && params.grid && params.grid.rows > 1; 8577 }; 8578 function setBreakpoint() { 8579 const swiper = this; 8580 const { activeIndex, initialized, loopedSlides = 0, params, $el } = swiper; 8581 const breakpoints = params.breakpoints; 8582 if (!breakpoints || breakpoints && Object.keys(breakpoints).length === 0) return; // Get breakpoint for window width and update parameters 8583 const breakpoint = swiper.getBreakpoint(breakpoints, swiper.params.breakpointsBase, swiper.el); 8584 if (!breakpoint || swiper.currentBreakpoint === breakpoint) return; 8585 const breakpointOnlyParams = breakpoint in breakpoints ? breakpoints[breakpoint] : undefined; 8586 const breakpointParams = breakpointOnlyParams || swiper.originalParams; 8587 const wasMultiRow = isGridEnabled(swiper, params); 8588 const isMultiRow = isGridEnabled(swiper, breakpointParams); 8589 const wasEnabled = params.enabled; 8590 if (wasMultiRow && !isMultiRow) { 8591 $el.removeClass(`${params.containerModifierClass}grid ${params.containerModifierClass}grid-column`); 8592 swiper.emitContainerClasses(); 8593 } else if (!wasMultiRow && isMultiRow) { 8594 $el.addClass(`${params.containerModifierClass}grid`); 8595 if (breakpointParams.grid.fill && breakpointParams.grid.fill === 'column' || !breakpointParams.grid.fill && params.grid.fill === 'column') $el.addClass(`${params.containerModifierClass}grid-column`); 8596 swiper.emitContainerClasses(); 8597 } // Toggle navigation, pagination, scrollbar 8598 [ 8599 'navigation', 8600 'pagination', 8601 'scrollbar' 8602 ].forEach((prop)=>{ 8603 const wasModuleEnabled = params[prop] && params[prop].enabled; 8604 const isModuleEnabled = breakpointParams[prop] && breakpointParams[prop].enabled; 8605 if (wasModuleEnabled && !isModuleEnabled) swiper[prop].disable(); 8606 if (!wasModuleEnabled && isModuleEnabled) swiper[prop].enable(); 8607 }); 8608 const directionChanged = breakpointParams.direction && breakpointParams.direction !== params.direction; 8609 const needsReLoop = params.loop && (breakpointParams.slidesPerView !== params.slidesPerView || directionChanged); 8610 if (directionChanged && initialized) swiper.changeDirection(); 8611 extend(swiper.params, breakpointParams); 8612 const isEnabled = swiper.params.enabled; 8613 Object.assign(swiper, { 8614 allowTouchMove: swiper.params.allowTouchMove, 8615 allowSlideNext: swiper.params.allowSlideNext, 8616 allowSlidePrev: swiper.params.allowSlidePrev 8617 }); 8618 if (wasEnabled && !isEnabled) swiper.disable(); 8619 else if (!wasEnabled && isEnabled) swiper.enable(); 8620 swiper.currentBreakpoint = breakpoint; 8621 swiper.emit('_beforeBreakpoint', breakpointParams); 8622 if (needsReLoop && initialized) { 8623 swiper.loopDestroy(); 8624 swiper.loopCreate(); 8625 swiper.updateSlides(); 8626 swiper.slideTo(activeIndex - loopedSlides + swiper.loopedSlides, 0, false); 8627 } 8628 swiper.emit('breakpoint', breakpointParams); 8629 }
vendor: 4,594 bytes, lines 8630-8755
8630 function getBreakpoint(breakpoints, base, containerEl) { 8631 if (base === void 0) base = 'window'; 8632 if (!breakpoints || base === 'container' && !containerEl) return undefined; 8633 let breakpoint = false; 8634 const window1 = getWindow(); 8635 const currentHeight = base === 'window' ? window1.innerHeight : containerEl.clientHeight; 8636 const points = Object.keys(breakpoints).map((point)=>{ 8637 if (typeof point === 'string' && point.indexOf('@') === 0) { 8638 const minRatio = parseFloat(point.substr(1)); 8639 const value = currentHeight * minRatio; 8640 return { 8641 value, 8642 point 8643 }; 8644 } 8645 return { 8646 value: point, 8647 point 8648 }; 8649 }); 8650 points.sort((a, b)=>parseInt(a.value, 10) - parseInt(b.value, 10)); 8651 for(let i = 0; i < points.length; i += 1){ 8652 const { point, value } = points[i]; 8653 if (base === 'window') { 8654 if (window1.matchMedia(`(min-width: ${value}px)`).matches) breakpoint = point; 8655 } else if (value <= containerEl.clientWidth) breakpoint = point; 8656 } 8657 return breakpoint || 'max'; 8658 } 8659 var breakpoints = { 8660 setBreakpoint, 8661 getBreakpoint 8662 }; 8663 function prepareClasses(entries, prefix) { 8664 const resultClasses = []; 8665 entries.forEach((item)=>{ 8666 if (typeof item === 'object') Object.keys(item).forEach((classNames)=>{ 8667 if (item[classNames]) resultClasses.push(prefix + classNames); 8668 }); 8669 else if (typeof item === 'string') resultClasses.push(prefix + item); 8670 }); 8671 return resultClasses; 8672 } 8673 function addClasses() { 8674 const swiper = this; 8675 const { classNames, params, rtl, $el, device, support } = swiper; // prettier-ignore 8676 const suffixes = prepareClasses([ 8677 'initialized', 8678 params.direction, 8679 { 8680 'pointer-events': !support.touch 8681 }, 8682 { 8683 'free-mode': swiper.params.freeMode && params.freeMode.enabled 8684 }, 8685 { 8686 'autoheight': params.autoHeight 8687 }, 8688 { 8689 'rtl': rtl 8690 }, 8691 { 8692 'grid': params.grid && params.grid.rows > 1 8693 }, 8694 { 8695 'grid-column': params.grid && params.grid.rows > 1 && params.grid.fill === 'column' 8696 }, 8697 { 8698 'android': device.android 8699 }, 8700 { 8701 'ios': device.ios 8702 }, 8703 { 8704 'css-mode': params.cssMode 8705 }, 8706 { 8707 'centered': params.cssMode && params.centeredSlides 8708 }, 8709 { 8710 'watch-progress': params.watchSlidesProgress 8711 } 8712 ], params.containerModifierClass); 8713 classNames.push(...suffixes); 8714 $el.addClass([ 8715 ...classNames 8716 ].join(' ')); 8717 swiper.emitContainerClasses(); 8718 } 8719 function removeClasses() { 8720 const swiper = this; 8721 const { $el, classNames } = swiper; 8722 $el.removeClass(classNames.join(' ')); 8723 swiper.emitContainerClasses(); 8724 } 8725 var classes = { 8726 addClasses, 8727 removeClasses 8728 }; 8729 function loadImage(imageEl, src, srcset, sizes, checkForComplete, callback) { 8730 const window1 = getWindow(); 8731 let image; 8732 function onReady() { 8733 if (callback) callback(); 8734 } 8735 const isPicture = $(imageEl).parent('picture')[0]; 8736 if (!isPicture && (!imageEl.complete || !checkForComplete)) { 8737 if (src) { 8738 image = new window1.Image(); 8739 image.onload = onReady; 8740 image.onerror = onReady; 8741 if (sizes) image.sizes = sizes; 8742 if (srcset) image.srcset = srcset; 8743 if (src) image.src = src; 8744 } else onReady(); 8745 } else // image already loaded... 8746 onReady(); 8747 } 8748 function preloadImages() { 8749 const swiper = this; 8750 swiper.imagesToLoad = swiper.$el.find('img'); 8751 function onReady() { 8752 if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper.destroyed) return; 8753 if (swiper.imagesLoaded !== undefined) swiper.imagesLoaded += 1; 8754 if (swiper.imagesLoaded === swiper.imagesToLoad.length) { 8755 if (swiper.params.updateOnImagesReady) swiper.update(
8755); 8756 swiper.emit('imagesReady'); 8757 } 8758 } 8759 for(let i = 0; i < swiper.imagesToLoad.length; i += 1){ 8760 const imageEl = swiper.imagesToLoad[i]; 8761 swiper.loadImage(imageEl, imageEl.currentSrc || imageEl.getAttribute('src'), imageEl.srcset || imageEl.getAttribute('srcset'), imageEl.sizes || imageEl.getAttribute('sizes'), true, onReady); 8762 } 8763 } 8764 var images = { 8765 loadImage, 8766 preloadImages 8767 }; 8768 function checkOverflow() { 8769 const swiper = this; 8770 const { isLocked: wasLocked, params } = swiper; 8771 const { slidesOffsetBefore } = params; 8772 if (slidesOffsetBefore) { 8773 const lastSlideIndex = swiper.slides.length - 1; 8774 const lastSlideRightEdge = swiper.slidesGrid[lastSlideIndex] + swiper.slidesSizesGrid[lastSlideIndex] + slidesOffsetBefore * 2; 8775 swiper.isLocked = swiper.size > lastSlideRightEdge; 8776 } else swiper.isLocked = swiper.snapGrid.length === 1; 8777 if (params.allowSlideNext === true) swiper.allowSlideNext = !swiper.isLocked; 8778 if (params.allowSlidePrev === true) swiper.allowSlidePrev = !swiper.isLocked; 8779 if (wasLocked && wasLocked !== swiper.isLocked) swiper.isEnd = false; 8780 if (wasLocked !== swiper.isLocked) swiper.emit(swiper.isLocked ? 'lock' : 'unlock'); 8781 } 8782 var checkOverflow$1 = { 8783 checkOverflow 8784 }; 8785 var defaults = { 8786 init: true, 8787 direction: 'horizontal', 8788 touchEventsTarget: 'wrapper', 8789 initialSlide: 0, 8790 speed: 300, 8791 cssMode: false, 8792 updateOnWindowResize: true, 8793 resizeObserver: true, 8794 nested: false, 8795 createElements: false, 8796 enabled: true, 8797 focusableElements: 'input, select, option, textarea, button, video, label', 8798 // Overrides 8799 width: null, 8800 height: null, 8801 // 8802 preventInteractionOnTransition: false, 8803 // ssr 8804 userAgent: null, 8805 url: null, 8806 // To support iOS's swipe-to-go-back gesture (when being used in-app). 8807 edgeSwipeDetection: false, 8808 edgeSwipeThreshold: 20, 8809 // Autoheight 8810 autoHeight: false, 8811 // Set wrapper width 8812 setWrapperSize: false, 8813 // Virtual Translate 8814 virtualTranslate: false, 8815 // Effects 8816 effect: 'slide', 8817 // 'slide' or 'fade' or 'cube' or 'coverflow' or 'flip'
8818 // Breakpoints 8819 breakpoints: undefined, 8820 breakpointsBase: 'window', 8821 // Slides grid 8822 spaceBetween: 0, 8823 slidesPerView: 1, 8824 slidesPerGroup: 1, 8825 slidesPerGroupSkip: 0, 8826 slidesPerGroupAuto: false, 8827 centeredSlides: false, 8828 centeredSlidesBounds: false, 8829 slidesOffsetBefore: 0, 8830 // in px 8831 slidesOffsetAfter: 0, 8832 // in px 8833 normalizeSlideIndex: true, 8834 centerInsufficientSlides: false, 8835 // Disable swiper and hide navigation when container not overflow 8836 watchOverflow: true, 8837 // Round length 8838 roundLengths: false, 8839 // Touches 8840 touchRatio: 1, 8841 touchAngle: 45, 8842 simulateTouch: true, 8843 shortSwipes: true, 8844 longSwipes: true, 8845 longSwipesRatio: 0.5, 8846 longSwipesMs: 300, 8847 followFinger: true, 8848 allowTouchMove: true, 8849 threshold: 0, 8850 touchMoveStopPropagation: false, 8851 touchStartPreventDefault: true, 8852 touchStartForcePreventDefault: false, 8853 touchReleaseOnEdges: false, 8854 // Unique Navigation Elements 8855 uniqueNavElements: true, 8856 // Resistance 8857 resistance: true, 8858 resistanceRatio: 0.85, 8859 // Progress 8860 watchSlidesProgress: false, 8861 // Cursor 8862 grabCursor: false, 8863 // Clicks 8864 preventClicks: true, 8865 preventClicksPropagation: true, 8866 slideToClickedSlide: false, 8867 // Images 8868 preloadImages: true, 8869 updateOnImagesReady: true, 8870 // loop 8871 loop: false, 8872 loopAdditionalSlides: 0, 8873 loopedSlides: null, 8874 loopedSlidesLimit: true, 8875 loopFillGroupWithBlank: false, 8876 loopPreventsSlide: true, 8877 // rewind 8878 rewind: false, 8879 // Swiping/no swiping 8880 allowSlidePrev: true, 8881 allowSlideNext: true, 8882 swipeHandler: null, 8883 // '.swipe-handler', 8884 noSwiping: true, 8885 noSwipingClass: 'swiper-no-swiping', 8886 noSwipingSelector: null, 8887 // Passive Listeners 8888 passiveListeners: true, 8889 maxBackfaceHiddenSlides: 10, 8890 // NS 8891 containerModifierClass: 'swiper-', 8892 // NEW 8893 slideClass: 'swiper-slide', 8894 slideBlankClass: 'swiper-slide-invisible-blank', 8895 slideActiveClass: 'swiper-slide-active', 8896 slideDuplicateActiveClass: 'swiper-slide-duplicate-active', 8897 slideVisibleClass: 'swiper-slide-visible', 8898 slideDuplicateClass: 'swiper-slide-duplicate', 8899 slideNextClass: 'swiper-slide-next', 8900 slideDuplicateNextClass: 'swiper-slide-duplicate-next', 8901 slidePrevClass: 'swiper-slide-prev', 8902 slideDuplicatePrevClass: 'swiper-slide-duplicate-prev', 8903 wrapperClass: 'swiper-wrapper', 8904 // Callbacks 8905 runCallbacksOnInit: true, 8906 // Internals 8907 _emitClasses: false 8908 }; 8909 function moduleExtendParams(params, allModulesParams) { 8910 return function extendParams(obj) { 8911 if (obj === void 0) obj = {}; 8912 const moduleParamName = Object.keys(obj)[0]; 8913 const moduleParams = obj[moduleParamName]; 8914 if (typeof moduleParams !== 'object' || moduleParams === null) { 8915 extend(allModulesParams, obj); 8916 return; 8917 } 8918 if ([ 8919 'navigation', 8920 'pagination', 8921 'scrollbar' 8922 ].indexOf(moduleParamName) >= 0 && params[moduleParamName] === true) params[moduleParamName] = { 8923 auto: true 8924 }; 8925 if (!(moduleParamName in params && 'enabled' in moduleParams)) { 8926 extend(allModulesParams, obj); 8927 return; 8928 } 8929 if (params[moduleParamName] === true) params[moduleParamName] = { 8930 enabled: true 8931 }; 8932 if (typeof params[moduleParamName] === 'object' && !('enabled' in params[moduleParamName])) params[moduleParamName].enabled = true; 8933 if (!params[moduleParamName]) params[moduleParamName] = { 8934 enabled: false 8935 }; 8936 extend(allModulesParams, obj); 8937 }; 8938 } 8939 /* eslint no-param-reassign: "off" */ const prototypes = { 8940 eventsEmitter, 8941 update, 8942 translate, 8943 transition, 8944 slide, 8945 loop, 8946 grabCursor, 8947 events: events$1, 8948 breakpoints, 8949 checkOverflow: checkOverflow$1, 8950 classes, 8951 images 8952 }; 8953 const extendedDefaults = {}; 8954 class Swiper { 8955 constructor(){ 8956 let el; 8957 let params; 8958 for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++)args[_key] = arguments[_key];
8959 if (args.length === 1 && args[0].constructor && Object.prototype.toString.call(args[0]).slice(8, -1) === 'Object') params = args[0]; 8960 else [el, params] = args; 8961 if (!params) params = {}; 8962 params = extend({}, params); 8963 if (el && !params.el) params.el = el; 8964 if (params.el && $(params.el).length > 1) { 8965 const swipers = []; 8966 $(params.el).each((containerEl)=>{ 8967 const newParams = extend({}, params, { 8968 el: containerEl 8969 }); 8970 swipers.push(new Swiper(newParams)); 8971 }); // eslint-disable-next-line no-constructor-return 8972 return swipers; 8973 } // Swiper Instance 8974 const swiper = this; 8975 swiper.__swiper__ = true; 8976 swiper.support = getSupport(); 8977 swiper.device = getDevice({ 8978 userAgent: params.userAgent 8979 }); 8980 swiper.browser = getBrowser(); 8981 swiper.eventsListeners = {}; 8982 swiper.eventsAnyListeners = []; 8983 swiper.modules = [ 8984 ...swiper.__modules__ 8985 ]; 8986 if (params.modules && Array.isArray(params.modules)) swiper.modules.push(...params.modules); 8987 const allModulesParams = {}; 8988 swiper.modules.forEach((mod)=>{ 8989 mod({ 8990 swiper, 8991 extendParams: moduleExtendParams(params, allModulesParams), 8992 on: swiper.on.bind(swiper), 8993 once: swiper.once.bind(swiper), 8994 off: swiper.off.bind(swiper), 8995 emit: swiper.emit.bind(swiper) 8996 }); 8997 }); // Extend defaults with modules params 8998 const swiperParams = extend({}, defaults, allModulesParams); // Extend defaults with passed params 8999 swiper.params = extend({}, swiperParams, extendedDefaults, params); 9000 swiper.originalParams = extend({}, swiper.params); 9001 swiper.passedParams = extend({}, params); // add event listeners 9002 if (swiper.params && swiper.params.on) Object.keys(swiper.params.on).forEac
vendor: 4,107 bytes, lines 9002-9110
9002h((eventName)=>{ 9003 swiper.on(eventName, swiper.params.on[eventName]); 9004 }); 9005 if (swiper.params && swiper.params.onAny) swiper.onAny(swiper.params.onAny); 9006 // Save Dom lib 9007 swiper.$ = $; // Extend Swiper 9008 Object.assign(swiper, { 9009 enabled: swiper.params.enabled, 9010 el, 9011 // Classes 9012 classNames: [], 9013 // Slides 9014 slides: $(), 9015 slidesGrid: [], 9016 snapGrid: [], 9017 slidesSizesGrid: [], 9018 // isDirection 9019 isHorizontal () { 9020 return swiper.params.direction === 'horizontal'; 9021 }, 9022 isVertical () { 9023 return swiper.params.direction === 'vertical'; 9024 }, 9025 // Indexes 9026 activeIndex: 0, 9027 realIndex: 0, 9028 // 9029 isBeginning: true, 9030 isEnd: false, 9031 // Props 9032 translate: 0, 9033 previousTranslate: 0, 9034 progress: 0, 9035 velocity: 0, 9036 animating: false, 9037 // Locks 9038 allowSlideNext: swiper.params.allowSlideNext, 9039 allowSlidePrev: swiper.params.allowSlidePrev, 9040 // Touch Events 9041 touchEvents: function touchEvents() { 9042 const touch = [ 9043 'touchstart', 9044 'touchmove', 9045 'touchend', 9046 'touchcancel' 9047 ]; 9048 const desktop = [ 9049 'pointerdown', 9050 'pointermove', 9051 'pointerup' 9052 ]; 9053 swiper.touchEventsTouch = { 9054 start: touch[0], 9055 move: touch[1], 9056 end: touch[2], 9057 cancel: touch[3] 9058 }; 9059 swiper.touchEventsDesktop = { 9060 start: desktop[0], 9061 move: desktop[1], 9062 end: desktop[2] 9063 }; 9064 return swiper.support.touch || !swiper.params.simulateTouch ? swiper.touchEventsTouch : swiper.touchEventsDesktop; 9065 }(), 9066 touchEventsData: { 9067 isTouched: undefined, 9068 isMoved: undefined, 9069 allowTouchCallbacks: undefined, 9070 touchStartTime: undefined, 9071 isScrolling: undefined, 9072 currentTranslate: undefined, 9073 startTranslate: undefined, 9074 allowThresholdMove: undefined, 9075 // Form elements to match 9076 focusableElements: swiper.params.focusableElements, 9077 // Last click time 9078 lastClickTime: now(), 9079 clickTimeout: undefined, 9080 // Velocities 9081 velocities: [], 9082 allowMomentumBounce: undefined, 9083 isTouchEvent: undefined, 9084 startMoving: undefined 9085 }, 9086 // Clicks 9087 allowClick: true, 9088 // Touches 9089 allowTouchMove: swiper.params.allowTouchMove, 9090 touches: { 9091 startX: 0, 9092 startY: 0, 9093 currentX: 0, 9094 currentY: 0, 9095 diff: 0 9096 }, 9097 // Images 9098 imagesToLoad: [], 9099 imagesLoaded: 0 9100 }); 9101 swiper.emit('_swiper'); // Init 9102 if (swiper.params.init) swiper.init(); 9103 // Return app instance 9104 // eslint-disable-next-line no-constructor-return 9105 return swiper; 9106 } 9107 enable() { 9108 const swiper = this; 9109 if (swiper.enabled) return; 9110 swiper.enabled = true;
9111 if (swiper.params.grabCursor) swiper.setGrabCursor(); 9112 swiper.emit('enable'); 9113 } 9114 disable() { 9115 const swiper = this; 9116 if (!swiper.enabled) return; 9117 swiper.enabled = false; 9118 if (swiper.params.grabCursor) swiper.unsetGrabCursor(); 9119 swiper.emit('disable'); 9120 } 9121 setProgress(progress, speed) { 9122 const swiper = this; 9123 progress = Math.min(Math.max(progress, 0), 1); 9124 const min = swiper.minTranslate(); 9125 const max = swiper.maxTranslate(); 9126 const current = (max - min) * progress + min; 9127 swiper.translateTo(current, typeof speed === 'undefined' ? 0 : speed); 9128 swiper.updateActiveIndex(); 9129 swiper.updateSlidesClasses(); 9130 } 9131 emitContainerClasses() { 9132 const swiper = this; 9133 if (!swiper.params._emitClasses || !swiper.el) return; 9134 const cls = swiper.el.className.split(' ').filter((className)=>{ 9135 return className.indexOf('swiper') === 0 || className.indexOf(swiper.params.containerModifierClass) === 0; 9136 }); 9137 swiper.emit('_containerClasses', cls.join(' ')); 9138 } 9139 getSlideClasses(slideEl) { 9140 const swiper = this; 9141 if (swiper.destroyed) return ''; 9142 return slideEl.className.split(' ').filter((className)=>{ 9143 return className.indexOf('swiper-slide') === 0 || className.indexOf(swiper.params.slideClass) === 0; 9144 }).join(' '); 9145 } 9146 emitSlidesClasses() { 9147 const swiper = this; 9148 if (!swiper.params._emitClasses || !swiper.el) return; 9149 const updates = []; 9150 swiper.slides.each((slideEl)=>{ 9151 const classNames = swiper.getSlideClasses(slideEl); 9152 updates.push({ 9153 slideEl, 9154 classNames 9155 }); 9156 swiper.emit('_slideClass', slideEl, classNames); 9157 }); 9158 swiper.emit('_slideClasses', updates); 9159 } 9160 slidesPerViewDynamic(view, exact) { 9161 if (view === void 0) view = 'current'; 9162 if (exact === void 0) exact = false; 9163 const swiper = this; 9164 const { params, slides, slidesGrid, slidesSizesGrid, size: swiperSize, activeIndex } = swiper; 9165 let spv = 1; 9166 if (params.centeredSlides) { 9167 let slideSize = slides[activeIndex].swiperSlideSize; 9168 let breakLoop; 9169 for(let i = activeIndex + 1; i < slides.length; i += 1)if (slides[i] && !breakLoop) { 9170 slideSize += slides[i].swiperSlideSize; 9171 spv += 1; 9172 if (slideSize > swiperSize) breakLoop = true; 9173 } 9174 for(let i = activeIndex - 1; i >= 0; i -= 1)if (slides[i] && !breakLoop) { 9175 slideSize += slides[i].swiperSlideSize; 9176 spv += 1; 9177 if (slideSize > swiperSize) breakLoop = true; 9178 } 9179 } else { 9180 // eslint-disable-next-line 9181 if (view === 'current') for(let i = activeIndex + 1; i < slides.length; i += 1){ 9182 const slideInView = exact ? slidesGrid[i] + slidesSizesGrid[i] - slidesGrid[activeIndex] < swiperSize : slidesGrid[i] - slidesGrid[activeIndex] < swiperSize; 9183 if (slideInView) spv += 1; 9184 } 9185 else // previous 9186 for(let i = activeIndex - 1; i >= 0; i -= 1){ 9187 const slideInView = slidesGrid[activeIndex] - slidesGrid[i] < swiperSize; 9188 if (slideInView) spv += 1; 9189 } 9190 } 9191 return spv; 9192 } 9193 update() { 9194 const swiper = this; 9195 if (!swiper || swiper.destroyed) return; 9196 const { snapGrid, params } = swiper; // Breakpoints 9197 if (params.breakpoints) swiper.setBreakpoint(); 9198 swiper.updateSize(); 9199 swiper.updateSlides(); 9200 swiper.updateProgress(); 9201 swiper.updateSlidesClasses(); 9202 function setTranslate() { 9203 const translateValue = swiper.rtlTranslate ? swiper.translate * -1 : swiper.translate; 9204 const newTranslate = Math.min(Math.max(translateValue, swiper.maxTranslate()), swiper.minTranslate()); 9205 swiper.setTranslate(newTranslate); 9206 swiper.updateActiveIndex(); 9207 swiper.updateSlidesClasses(); 9208 } 9209 let translated; 9210 if (swiper.params.freeMode && swiper.params.freeMode.enabled) { 9211 setTranslate(); 9212 if (swiper.params.autoHeight) swiper.updateAutoHeight(); 9213 } else { 9214 if ((swiper.params.slidesPerView === 'auto' || swiper.params.slidesPerView > 1) && swiper.isEnd && !swiper.params.centeredSlides) translated = swiper.slideTo(swiper.slides.length - 1, 0, false, true); 9215 else translated = swiper.slideTo(swiper.activeIndex, 0, false, true); 9216 if (!translated) setTranslate(); 9217 } 9218 if (params.watchOverflow && snapGrid !== swiper.snapGrid) swiper.checkOverflow(); 9219 swiper.emit('update'); 9220 } 9221 changeDirection(newDirection, needUpdate) { 9222 if (needUpdate === void 0) needUpdate = true; 9223 const swiper = this; 9224 const currentDirection = swiper.params.direction; 9225 if (!newDirection) // eslint-disable-next-line 9226 newDirection = currentDirection === 'horizontal' ? 'vertical' : 'horizontal'; 9227 if (newDirection === currentDirection || newDirection !== 'horizontal' && newDirection !== 'vertical') return swiper; 9228 swiper.$el.removeClass(`${swiper.params.containerModifierClass}${currentDirection}`).addClass(`${swiper.params.containerModifierClass}${newDirection}`); 9229 swiper.emitContainerClasses(); 9230 swiper.params.direction = newDirection; 9231 swiper.slides.each((slideEl)=>{ 9232 if (newDirection === 'vertical') slideEl.style.width = ''; 9233 else slideEl.style.height = ''; 9234 }); 9235 swiper.emit('changeDirection');
9236 if (needUpdate) swiper.update(); 9237 return swiper; 9238 } 9239 changeLanguageDirection(direction) { 9240 const swiper = this; 9241 if (swiper.rtl && direction === 'rtl' || !swiper.rtl && direction === 'ltr') return; 9242 swiper.rtl = direction === 'rtl'; 9243 swiper.rtlTranslate = swiper.params.direction === 'horizontal' && swiper.rtl; 9244 if (swiper.rtl) { 9245 swiper.$el.addClass(`${swiper.params.containerModifierClass}rtl`); 9246 swiper.el.dir = 'rtl'; 9247 } else { 9248 swiper.$el.removeClass(`${swiper.params.containerModifierClass}rtl`); 9249 swiper.el.dir = 'ltr'; 9250 } 9251 swiper.update(); 9252 } 9253 mount(el) { 9254 const swiper = this; 9255 if (swiper.mounted) return true; // Find el 9256 const $el = $(el || swiper.params.el); 9257 el = $el[0]; 9258 if (!el) return false; 9259 el.swiper = swiper; 9260 const getWrapperSelector = ()=>{ 9261 return `.${(swiper.params.wrapperClass || '').trim().split(' ').join('.')}`; 9262 }; 9263 const getWrapper = ()=>{ 9264 if (el && el.shadowRoot && el.shadowRoot.querySelector) { 9265 const res = $(el.shadowRoot.querySelector(getWrapperSelector())); // Children needs to return slot items 9266 res.children = (options)=>$el.children(options); 9267 return res; 9268 } 9269 if (!$el.children) return $($el).children(getWrapperSelector()); 9270 return $el.children(getWrapperSelector()); 9271 }; // Find Wrapper 9272 let $wrapperEl = getWrapper(); 9273 if ($wrapperEl.length === 0 && swiper.params.createElements) { 9274 const document1 = getDocument(); 9275 const wrapper = document1.createElement('div'); 9276 $wrapperEl = $(wrapper); 9277 wrapper.className = swiper.params.wrapperClass; 9278 $el.append(wrapper); 9279 $el.children(`.${swiper.params.slideClass}`).each((slideEl)=>{ 9280 $wrapperEl.append(slideEl); 9281 }); 9282 } 9283 Object.assign(swiper, { 9284 $el, 9285 el, 9286 $wrapperEl, 9287 wrapperEl: $wrapperEl[0], 9288 mounted: true, 9289 // RTL 9290 rtl: el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl', 9291 rtlTranslate: swiper.params.direction === 'horizontal' && (el.dir.toLowerCase() === 'rtl' || $el.css('direction') === 'rtl'), 9292 wrongRTL: $wrapperEl.css('display') === '-webkit-box' 9293 }); 9294 return true; 9295 } 9296 init(el) { 9297 const swiper = this; 9298 if (swiper.initialized) return swiper; 9299 const mounted = swiper.mount(el); 9300 if (mounted === false) return swiper; 9301 swiper.emit('beforeInit'); // Set breakpoint 9302 if (swiper.params.breakpoints) swiper.setBreakpoint(); 9303 // Add Classes 9304 swiper.addClasses(); // Create loop 9305 if (swiper.params.loop) swiper.loopCreate(); 9306 // Update size 9307 swiper.updateSize(); // Update slides 9308 swiper.updateSlides(); 9309 if (swiper.params.watchOverflow) swiper.checkOverflow(); 9310 // Set Grab Cursor 9311 if (swiper.params.grabCursor && swiper.enabled) swiper.setGrabCursor(); 9312 if (swiper.params.preloadImages) swiper.preloadImages(); 9313 // Slide To Initial Slide 9314 if (swiper.params.loop) swiper.slideTo(swiper.params.initialSlide + swiper.loopedSlides, 0, swiper.params.runCallbacksOnInit, false, true); 9315 else swiper.slideTo(swiper.params.initialSlide, 0, swiper.params.runCallbacksOnInit, false, true); 9316 // Attach events 9317 swiper.attachEvents(); // Init Flag 9318 swiper.initialized = true; // Emit 9319 swiper.emit('init'); 9320 swiper.emit('afterInit'); 9321 return swiper; 9322 } 9323 destroy(deleteInstance, cleanStyles) { 9324 if (deleteInstance === void 0) deleteInstance = true; 9325 if (cleanStyles === void 0) cleanStyles = true; 9326 const swiper = this; 9327 const { params, $el, $wrapperEl, slides } = swiper; 9328 if (typeof swiper.params === 'undefined' || swiper.destroyed) return null; 9329 swiper.emit('beforeDestroy'); // Init Flag 9330 swiper.initialized = false; // Detach events 9331 swiper.detachEvents(); // Destroy loop 9332 if (params.loop) swiper.loopDestroy(); 9333 // Cleanup styles 9334 if (cleanStyles) { 9335 swiper.removeClasses(); 9336 $el.removeAttr('style'); 9337 $wrapperEl.removeAttr('style'); 9338 if (slides && slides.length) slides.removeClass([ 9339 params.slideVisibleClass, 9340 params.slideActiveClass, 9341 params.slideNextClass, 9342 params.slidePrevClass 9343 ].join(' ')).removeAttr('style').removeAttr('data-swiper-slide-index'); 9344 } 9345 swiper.emit('destroy'); // Detach emitter events
9346 Object.keys(swiper.eventsListeners).forEach((eventName)=>{ 9347 swiper.off(eventName); 9348 }); 9349 if (deleteInstance !== false) { 9350 swiper.$el[0].swiper = null; 9351 deleteProps(swiper); 9352 } 9353 swiper.destroyed = true; 9354 return null; 9355 } 9356 static extendDefaults(newDefaults) { 9357 extend(extendedDefaults, newDefaults); 9358 } 9359 static get extendedDefaults() { 9360 return extendedDefaults; 9361 } 9362 static get defaults() { 9363 return defaults; 9364 } 9365 static installModule(mod) { 9366 if (!Swiper.prototype.__modules__) Swiper.prototype.__modules__ = []; 9367 const modules = Swiper.prototype.__modules__; 9368 if (typeof mod === 'function' && modules.indexOf(mod) < 0) modules.push(mod); 9369 } 9370 static use(module1) { 9371 if (Array.isArray(module1)) { 9372 module1.forEach((m)=>Swiper.installModule(m)); 9373 return Swiper; 9374 } 9375 Swiper.installModule(module1); 9376 return Swiper; 9377 } 9378 } 9379 Object.keys(prototypes).forEach((prototypeGroup)=>{ 9380 Object.keys(prototypes[prototypeGroup]).forEach((protoMethod)=>{ 9381 Swiper.prototype[protoMethod] = prototypes[prototypeGroup][protoMethod]; 9382 }); 9383 }); 9384 Swiper.use([ 9385 Resize, 9386 Observer 9387 ]); 9388 function Virtual(_ref) { 9389 let { swiper, extendParams, on, emit } = _ref; 9390 extendParams({ 9391 virtual: { 9392 enabled: false, 9393 slides: [], 9394 cache: true, 9395 renderSlide: null, 9396 renderExternal: null, 9397 renderExternalUpdate: true, 9398 addSlidesBefore: 0, 9399 addSlidesAfter: 0 9400 } 9401 }); 9402 let cssModeTimeout; 9403 swiper.virtual = { 9404 cache: {}, 9405 from: undefined, 9406 to: undefined, 9407 slides: [], 9408 offset: 0, 9409 slidesGrid: [] 9410 };
9411 function renderSlide(slide, index) { 9412 const params = swiper.params.virtual; 9413 if (params.cache && swiper.virtual.cache[index]) return swiper.virtual.cache[index]; 9414 const $slideEl = params.renderSlide ? $(params.renderSlide.call(swiper, slide, index)) : $(`<div class="${swiper.params.slideClass}" data-swiper-slide-index="${index}">${slide}</div>`); 9415 if (!$slideEl.attr('data-swiper-slide-index')) $slideEl.attr('data-swiper-slide-index', index); 9416 if (params.cache) swiper.virtual.cache[index] = $slideEl; 9417 return $slideEl; 9418 } 9419 function update(force) { 9420 const { slidesPerView, slidesPerGroup, centeredSlides } = swiper.params; 9421 const { addSlidesBefore, addSlidesAfter } = swiper.params.virtual; 9422 const { from: previousFrom, to: previousTo, slides, slidesGrid: previousSlidesGrid, offset: previousOffset } = swiper.virtual; 9423 if (!swiper.params.cssMode) swiper.updateActiveIndex(); 9424 const activeIndex = swiper.activeIndex || 0; 9425 let offsetProp; 9426 if (swiper.rtlTranslate) offsetProp = 'right'; 9427 else offsetProp = swiper.isHorizontal() ? 'left' : 'top'; 9428 let slidesAfter; 9429 let slidesBefore; 9430 if (centeredSlides) { 9431 slidesAfter = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesAfter; 9432 slidesBefore = Math.floor(slidesPerView / 2) + slidesPerGroup + addSlidesBefore; 9433 } else { 9434 slidesAfter = slidesPerView + (slidesPerGroup - 1) + addSlidesAfter; 9435 slidesBefore = slidesPerGroup + addSlidesBefore; 9436 } 9437 const from = Math.max((activeIndex || 0) - slidesBefore, 0); 9438 const to = Math.min((activeIndex || 0) + slidesAfter, slides.length - 1); 9439 const offset = (swiper.slidesGrid[from] || 0) - (swiper.slidesGrid[0] || 0); 9440 Object.assign(swiper.virtual, { 9441 from, 9442 to, 9443 offset, 9444 slidesGrid: swiper.slidesGrid 9445 }); 9446 function onRendered() { 9447 swiper.updateSlides(); 9448 swiper.updateProgress(); 9449 swiper.updateSlidesClasses(); 9450 if (swiper.lazy && swiper.params.lazy.enabled) swiper.lazy.load(); 9451 emit('virtualUpdate'); 9452 } 9453 if (previousFrom === from && previousTo === to && !force) { 9454 if (swiper.slidesGrid !== previousSlidesGrid && offset !== previousOffset) swiper.slides.css(offsetProp, `${offset}px`); 9455 swiper.updateProgress(); 9456 emit('virtualUpdate'); 9457 return; 9458 } 9459 if (swiper.params.virtual.renderExternal) { 9460 swiper.params.virtual.renderExternal.call(swiper, { 9461 offset, 9462 from, 9463 to, 9464 slides: function getSlides() { 9465 const slidesToRender = []; 9466 for(let i = from; i <= to; i += 1)slidesToRender.push(slides[i]); 9467 return slidesToRender; 9468 }() 9469 }); 9470 if (swiper.params.virtual.renderExternalUpdate) onRendered(); 9471 else emit('virtualUpdate'); 9472 return; 9473 } 9474 const prependIndexes = []; 9475 const appendIndexes = []; 9476 if (force) swiper.$wrapperEl.find(`.${swiper.params.slideClass}`).remove(); 9477 else { 9478 for(let i = previousFrom; i <= previousTo; i += 1)if (i < from || i > to) swiper.$wrapperEl.find(`.${swiper.params.slideClass}[data-swiper-slide-index="${i}"]`).remove(); 9479 } 9480 for(let i = 0; i < slides.length; i += 1)if (i >= from && i <= to) { 9481 if (typeof previousTo === 'undefined' || force) appendIndexes.push(i); 9482 else { 9483 if (i > previousTo) appendIndexes.push(i); 9484 if (i < previousFrom) prependIndexes.push(i); 9485 } 9486 }
9487 appendIndexes.forEach((index)=>{ 9488 swiper.$wrapperEl.append(renderSlide(slides[index], index)); 9489 }); 9490 prependIndexes.sort((a, b)=>b - a).forEach((index)=>{ 9491 swiper.$wrapperEl.prepend(renderSlide(slides[index], index)); 9492 }); 9493 swiper.$wrapperEl.children('.swiper-slide').css(offsetProp, `${offset}px`); 9494 onRendered(); 9495 } 9496 function appendSlide(slides) { 9497 if (typeof slides === 'object' && 'length' in slides) { 9498 for(let i = 0; i < slides.length; i += 1)if (slides[i]) swiper.virtual.slides.push(slides[i]); 9499 } else swiper.virtual.slides.push(slides); 9500 update(true); 9501 } 9502 function prependSlide(slides) { 9503 const activeIndex = swiper.activeIndex; 9504 let newActiveIndex = activeIndex + 1; 9505 let numberOfNewSlides = 1; 9506 if (Array.isArray(slides)) { 9507 for(let i = 0; i < slides.length; i += 1)if (slides[i]) swiper.virtual.slides.unshift(slides[i]); 9508 newActiveIndex = activeIndex + slides.length; 9509 numberOfNewSlides = slides.length; 9510 } else swiper.virtual.slides.unshift(slides); 9511 if (swiper.params.virtual.cache) { 9512 const cache = swiper.virtual.cache; 9513 const newCache = {}; 9514 Object.keys(cache).forEach((cachedIndex)=>{ 9515 const $cachedEl = cache[cachedIndex]; 9516 const cachedElIndex = $cachedEl.attr('data-swiper-slide-index'); 9517 if (cachedElIndex) $cachedEl.attr('data-swiper-slide-index', parseInt(cachedElIndex, 10) + numberOfNewSlides); 9518 newCache[parseInt(cachedIndex, 10) + numberOfNewSlides] = $cachedEl; 9519 }); 9520 swiper.virtual.cache = newCache; 9521 } 9522 update(true); 9523 swiper.slideTo(newActiveIndex, 0); 9524 } 9525 function removeSlide(slidesIndexes) { 9526 if (typeof slidesIndexes === 'undefined' || slidesIndexes === null) return; 9527 let activeIndex = swiper.activeIndex; 9528 if (Array.isArray(slidesIndexes)) for(let i = slidesIndexes.length - 1; i >= 0; i -= 1){ 9529 swiper.virtual.slides.splice(slidesIndexes[i], 1); 9530 if (swiper.params.virtual.cache) delete swiper.virtual.cache[slidesIndexes[i]]; 9531 if (slidesIndexes[i] < activeIndex) activeIndex -= 1; 9532 activeIndex = Math.max(activeIndex, 0); 9533 } 9534 else { 9535 swiper.virtual.slides.splice(slidesIndexes, 1); 9536 if (swiper.params.virtual.cache) delete swiper.virtual.cache[slidesIndexes]; 9537 if (slidesIndexes < activeIndex) activeIndex -= 1; 9538 activeIndex = Math.max(activeIndex, 0); 9539 } 9540 update(true); 9541 swiper.slideTo(activeIndex, 0); 9542 } 9543 function removeAllSlides() { 9544 swiper.virtual.slides = []; 9545 if (swiper.params.virtual.cache) swiper.virtual.cache = {}; 9546 update(true); 9547 swiper.slideTo(0, 0); 9548 } 9549 on('beforeInit', ()=>{ 9550 if (!swiper.params.virtual.enabled) return; 9551 swiper.virtual.slides = swiper.params.virtual.slides; 9552 swiper.classNames.push(`${swiper.params.containerModifierClass}virtual`); 9553 swiper.params.watchSlidesProgress = true; 9554 swiper.originalParams.watchSlidesProgress = true; 9555 if (!swiper.params.initialSlide) update(); 9556 }); 9557 on('setTranslate', ()=>{ 9558 if (!swiper.params.virtual.enabled) return; 9559 if (swiper.params.cssMode && !swiper._immediateVirtual) { 9560 clearTimeout(cssModeTimeout); 9561 cssModeTimeout = setTimeout(()=>{ 9562 update(); 9563 }, 100); 9564 } else update(); 9565 }); 9566 on('init update resize', ()=>{ 9567 if (!swiper.params.virtual.enabled) return; 9568 if (swiper.params.cssMode) setCSSProperty(swiper.wrapperEl, '--swiper-virtual-size', `${swiper.virtualSize}px`); 9569 }); 9570 Object.assign(swiper.virtual, { 9571 appendSlide, 9572 prependSlide, 9573 removeSlide, 9574 removeAllSlides, 9575 update 9576 }); 9577 } 9578 /* eslint-disable consistent-return */ function Keyboard(_ref) { 9579 let { swiper, extendParams, on, emit } = _ref; 9580 const document1 = getDocument(); 9581 const window1 = getWindow(); 9582 swiper.keyboard = { 9583 enabled: false 9584 }; 9585 extendParams({ 9586 keyboard: { 9587 enabled: false, 9588 onlyInViewport: true, 9589 pageUpDown: true 9590 } 9591 }); 9592 function handle(event1) { 9593 if (!swiper.enabled) return; 9594 const { rtlTranslate: rtl } = swiper; 9595 let e = event1; 9596 if (e.originalEvent) e = e.originalEvent; // jquery fix
vendor: 4,191 bytes, lines 9597-9672
9597 const kc = e.keyCode || e.charCode; 9598 const pageUpDown = swiper.params.keyboard.pageUpDown; 9599 const isPageUp = pageUpDown && kc === 33; 9600 const isPageDown = pageUpDown && kc === 34; 9601 const isArrowLeft = kc === 37; 9602 const isArrowRight = kc === 39; 9603 const isArrowUp = kc === 38; 9604 const isArrowDown = kc === 40; // Directions locks 9605 if (!swiper.allowSlideNext && (swiper.isHorizontal() && isArrowRight || swiper.isVertical() && isArrowDown || isPageDown)) return false; 9606 if (!swiper.allowSlidePrev && (swiper.isHorizontal() && isArrowLeft || swiper.isVertical() && isArrowUp || isPageUp)) return false; 9607 if (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) return undefined; 9608 if (document1.activeElement && document1.activeElement.nodeName && (document1.activeElement.nodeName.toLowerCase() === 'input' || document1.activeElement.nodeName.toLowerCase() === 'textarea')) return undefined; 9609 if (swiper.params.keyboard.onlyInViewport && (isPageUp || isPageDown || isArrowLeft || isArrowRight || isArrowUp || isArrowDown)) { 9610 let inView = false; // Check that swiper should be inside of visible area of window 9611 if (swiper.$el.parents(`.${swiper.params.slideClass}`).length > 0 && swiper.$el.parents(`.${swiper.params.slideActiveClass}`).length === 0) return undefined; 9612 const $el = swiper.$el; 9613 const swiperWidth = $el[0].clientWidth; 9614 const swiperHeight = $el[0].clientHeight; 9615 const windowWidth = window1.innerWidth; 9616 const windowHeight = window1.innerHeight; 9617 const swiperOffset = swiper.$el.offset(); 9618 if (rtl) swiperOffset.left -= swiper.$el[0].scrollLeft; 9619 const swiperCoord = [ 9620 [ 9621 swiperOffset.left, 9622 swiperOffset.top 9623 ], 9624 [ 9625 swiperOffset.left + swiperWidth, 9626 swiperOffset.top 9627 ], 9628 [ 9629 swiperOffset.left, 9630 swiperOffset.top + swiperHeight 9631 ], 9632 [ 9633 swiperOffset.left + swiperWidth, 9634 swiperOffset.top + swiperHeight 9635 ] 9636 ]; 9637 for(let i = 0; i < swiperCoord.length; i += 1){ 9638 const point = swiperCoord[i]; 9639 if (point[0] >= 0 && point[0] <= windowWidth && point[1] >= 0 && point[1] <= windowHeight) { 9640 if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line 9641 inView = true; 9642 } 9643 } 9644 if (!inView) return undefined; 9645 } 9646 if (swiper.isHorizontal()) { 9647 if (isPageUp || isPageDown || isArrowLeft || isArrowRight) { 9648 if (e.preventDefault) e.preventDefault(); 9649 else e.returnValue = false; 9650 } 9651 if ((isPageDown || isArrowRight) && !rtl || (isPageUp || isArrowLeft) && rtl) swiper.slideNext(); 9652 if ((isPageUp || isArrowLeft) && !rtl || (isPageDown || isArrowRight) && rtl) swiper.slidePrev(); 9653 } else { 9654 if (isPageUp || isPageDown || isArrowUp || isArrowDown) { 9655 if (e.preventDefault) e.preventDefault(); 9656 else e.returnValue = false; 9657 } 9658 if (isPageDown || isArrowDown) swiper.slideNext(); 9659 if (isPageUp || isArrowUp) swiper.slidePrev(); 9660 } 9661 emit('keyPress', kc); 9662 return undefined; 9663 } 9664 function enable() { 9665 if (swiper.keyboard.enabled) return; 9666 $(document1).on('keydown', handle); 9667 swiper.keyboard.enabled = true; 9668 } 9669 function disable() { 9670 if (!swiper.keyboard.enabled) return; 9671 $(document1).off('keydown', handle); 9672 swiper.keyboard.enabled = false;
9673 } 9674 on('init', ()=>{ 9675 if (swiper.params.keyboard.enabled) enable(); 9676 }); 9677 on('destroy', ()=>{ 9678 if (swiper.keyboard.enabled) disable(); 9679 }); 9680 Object.assign(swiper.keyboard, { 9681 enable, 9682 disable 9683 }); 9684 } 9685 /* eslint-disable consistent-return */ function Mousewheel(_ref) { 9686 let { swiper, extendParams, on, emit } = _ref; 9687 const window1 = getWindow(); 9688 extendParams({ 9689 mousewheel: { 9690 enabled: false, 9691 releaseOnEdges: false, 9692 invert: false, 9693 forceToAxis: false, 9694 sensitivity: 1, 9695 eventsTarget: 'container', 9696 thresholdDelta: null, 9697 thresholdTime: null 9698 } 9699 }); 9700 swiper.mousewheel = { 9701 enabled: false 9702 }; 9703 let timeout; 9704 let lastScrollTime = now(); 9705 let lastEventBeforeSnap; 9706 const recentWheelEvents = []; 9707 function normalize(e) { 9708 // Reasonable defaults 9709 const PIXEL_STEP = 10; 9710 const LINE_HEIGHT = 40; 9711 const PAGE_HEIGHT = 800; 9712 let sX = 0; 9713 let sY = 0; // spinX, spinY 9714 let pX = 0; 9715 let pY = 0; // pixelX, pixelY 9716 // Legacy 9717 if ('detail' in e) sY = e.detail; 9718 if ('wheelDelta' in e) sY = -e.wheelDelta / 120; 9719 if ('wheelDeltaY' in e) sY = -e.wheelDeltaY / 120; 9720 if ('wheelDeltaX' in e) sX = -e.wheelDeltaX / 120; 9721 // side scrolling on FF with DOMMouseScroll 9722 if ('axis' in e && e.axis === e.HORIZONTAL_AXIS) { 9723 sX = sY; 9724 sY = 0; 9725 } 9726 pX = sX * PIXEL_STEP; 9727 pY = sY * PIXEL_STEP; 9728 if ('deltaY' in e) pY = e.deltaY; 9729 if ('deltaX' in e) pX = e.deltaX; 9730 if (e.shiftKey && !pX) { 9731 // if user scrolls with shift he wants horizontal scroll 9732 pX = pY; 9733 pY = 0; 9734 } 9735 if ((pX || pY) && e.deltaMode) { 9736 if (e.deltaMode === 1) { 9737 // delta in LINE units 9738 pX *= LINE_HEIGHT; 9739 pY *= LINE_HEIGHT; 9740 } else { 9741 // delta in PAGE units 9742 pX *= PAGE_HEIGHT; 9743 pY *= PAGE_HEIGHT; 9744 } 9745 } // Fall-back if spin cannot be determined 9746 if (pX && !sX) sX = pX < 1 ? -1 : 1; 9747 if (pY && !sY) sY = pY < 1 ? -1 : 1; 9748 return { 9749 spinX: sX, 9750 spinY: sY, 9751 pixelX: pX, 9752 pixelY: pY 9753 }; 9754 } 9755 function handleMouseEnter() { 9756 if (!swiper.enabled) return; 9757 swiper.mouseEntered = true; 9758 } 9759 function handleMouseLeave() { 9760 if (!swiper.enabled) return; 9761 swiper.mouseEntered = false; 9762 } 9763 function animateSlider(newEvent) { 9764 if (swiper.params.mousewheel.thresholdDelta && newEvent.delta < swiper.params.mousewheel.thresholdDelta) // Prevent if delta of wheel scroll delta is below configured threshold 9765 return false; 9766 if (swiper.params.mousewheel.thresholdTime && now() - lastScrollTime < swiper.params.mousewheel.thresholdTime) // Prevent if time between scrolls is below configured threshold 9767 return false; 9768 // If the movement is NOT big enough and 9769 // if the last time the user scrolled was too close to the current one (avoid continuously triggering the slider): 9770 // Don't go any further (avoid insignificant scroll movement). 9771 if (newEvent.delta >= 6 && now() - lastScrollTime < 60) // Return false as a default 9772 return true; 9773 // If user is scrolling towards the end: 9774 // If the slider hasn't hit the latest slide or 9775 // if the slider is a loop and 9776 // if the slider isn't moving right now: 9777 // Go to next slide and 9778 // emit a scroll event. 9779 // Else (the user is scrolling towards the beginning) and 9780 // if the slider hasn't hit the first slide or 9781 // if the slider is a loop and 9782 // if the slider isn't moving right now: 9783 // Go to prev slide and 9784 // emit a scroll event. 9785 if (newEvent.direction < 0) { 9786 if ((!swiper.isEnd || swiper.params.loop) && !swiper.animating) { 9787 swiper.slideNext(); 9788 emit('scroll', newEvent.raw); 9789 } 9790 } else if ((!swiper.isBeginning || swiper.params.loop) && !swiper.animating) { 9791 swiper.slidePrev(); 9792 emit('scroll', newEvent.raw); 9793 } // If you got here is because an animation has been triggered so store the current time 9794 lastScrollTime = new window1.Date().getTime(); // Return false as a default 9795 return false;
9796 } 9797 function releaseScroll(newEvent) { 9798 const params = swiper.params.mousewheel; 9799 if (newEvent.direction < 0) { 9800 if (swiper.isEnd && !swiper.params.loop && params.releaseOnEdges) // Return true to animate scroll on edges 9801 return true; 9802 } else if (swiper.isBeginning && !swiper.params.loop && params.releaseOnEdges) // Return true to animate scroll on edges 9803 return true; 9804 return false; 9805 } 9806 function handle(event1) { 9807 let e = event1; 9808 let disableParentSwiper = true; 9809 if (!swiper.enabled) return; 9810 const params = swiper.params.mousewheel; 9811 if (swiper.params.cssMode) e.preventDefault(); 9812 let target = swiper.$el; 9813 if (swiper.params.mousewheel.eventsTarget !== 'container') target = $(swiper.params.mousewheel.eventsTarget); 9814 if (!swiper.mouseEntered && !target[0].contains(e.target) && !params.releaseOnEdges) return true; 9815 if (e.originalEvent) e = e.originalEvent; // jquery fix 9816 let delta = 0; 9817 const rtlFactor = swiper.rtlTranslate ? -1 : 1; 9818 const data = normalize(e); 9819 if (params.forceToAxis) { 9820 if (swiper.isHorizontal()) { 9821 if (Math.abs(data.pixelX) > Math.abs(data.pixelY)) delta = -data.pixelX * rtlFactor; 9822 else return true; 9823 } else if (Math.abs(data.pixelY) > Math.abs(data.pixelX)) delta = -data.pixelY; 9824 else return true; 9825 } else delta = Math.abs(data.pixelX) > Math.abs(data.pixelY) ? -data.pixelX * rtlFactor : -data.pixelY; 9826 if (delta === 0) return true; 9827 if (params.invert) delta = -delta; // Get the scroll positions 9828 let positions = swiper.getTranslate() + delta * params.sensitivity; 9829 if (positions >= swiper.minTranslate()) positions = swiper.minTranslate(); 9830 if (positions <= swiper.maxTranslate()) positions = swiper.maxTranslate(); // When loop is true: 9831 // the disableParentSwiper will be true. 9832 // When loop is false: 9833 // if the scroll positions is not on edge, 9834 // then the disableParentSwiper will be true. 9835 // if the scroll on edge positions, 9836 // then the disableParentSwiper will be false. 9837 disableParentSwiper = swiper.params.loop ? true : !(positions === swiper.minTranslate() || positions === swiper.maxTranslate()); 9838 if (disableParentSwiper && swiper.params.nested) e.stopPropagation(); 9839 if (!swiper.params.freeMode || !swiper.params.freeMode.enabled) { 9840 // Register the new event in a variable which stores the relevant data 9841 const newEvent = { 9842 time: now(), 9843 delta: Math.abs(delta), 9844 direction: Math.sign(delta), 9845 raw: event1 9846 }; // Keep the most recent events 9847 if (recentWheelEvents.length >= 2) recentWheelEvents.shift(); // only store the last N events 9848 const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; 9849 recentWheelEvents.push(newEvent); // If there is at least one previous recorded event: 9850 // If direction has changed or 9851 // if the scroll is quicker than the previous one: 9852 // Animate the slider. 9853 // Else (this is the first time the wheel is moved): 9854 // Animate the slider. 9855 if (prevEvent) { 9856 if (newEvent.direction !== prevEvent.direction || newEvent.delta > prevEvent.delta || newEvent.time > prevEvent.time + 150) animateSlider(newEvent); 9857 } else animateSlider(newEvent); 9858 // If it's time to release the scroll: 9859 // Return now so you don't hit the preventDefault. 9860 if (releaseScroll(newEvent)) return true; 9861 } else { 9862 // Freemode or scrollContainer: 9863 // If we recently snapped after a momentum scroll, then ignore wheel events 9864 // to give time for the deceleration to finish. Stop ignoring after 500 msecs 9865 // or if it's a new scroll (larger delta or inverse sign as last event before 9866 // an end-of-momentum snap). 9867 const newEvent = { 9868 time: now(), 9869 delta: Math.abs(delta), 9870 direction: Math.sign(delta) 9871 }; 9872 const ignoreWheelEvents = lastEventBeforeSnap && newEvent.time < lastEventBeforeSnap.time + 500 && newEvent.delta <= lastEventBeforeSnap.delta && newEvent.direction === lastEventBeforeSnap.direction; 9873 if (!ignoreWheelEvents) { 9874 lastEventBeforeSnap = undefined; 9875 if (swiper.params.loop) swiper.loopFix(); 9876 let position = swiper.getTranslate() + delta * params.sensitivity; 9877 const wasBeginning = swiper.isBeginning; 9878 const wasEnd = swiper.isEnd; 9879 if (position >= swiper.minTranslate()) position = swiper.minTranslate(); 9880 if (position <= swiper.maxTranslate()) position = swiper.maxTranslate(); 9881 swiper.setTransition(0); 9882 swiper.setTranslate(position); 9883 swiper.updateProgress(); 9884 swiper.updateActiveIndex(); 9885 swiper.updateSlidesClasses(); 9886 if (!wasBeginning && swiper.isBeginning || !wasEnd && swiper.isEnd) swiper.updateSlidesClasses(); 9887 if (swiper.params.freeMode.sticky) { 9888 // When wheel scrolling starts with sticky (aka snap) enabled, then detect 9889 // the end of a momentum scroll by storing recent (N=15?) wheel events. 9890 // 1. do all N events have decreasing or same (
9890absolute value) delta? 9891 // 2. did all N events arrive in the last M (M=500?) msecs? 9892 // 3. does the earliest event have an (absolute value) delta that's 9893 // at least P (P=1?) larger than the most recent event's delta? 9894 // 4. does the latest event have a delta that's smaller than Q (Q=6?) pixels? 9895 // If 1-4 are "yes" then we're near the end of a momentum scroll deceleration. 9896 // Snap immediately and ignore remaining wheel events in this scroll. 9897 // See comment above for "remaining wheel events in this scroll" determination. 9898 // If 1-4 aren't satisfied, then wait to snap until 500ms after the last event. 9899 clearTimeout(timeout); 9900 timeout = undefined; 9901 if (recentWheelEvents.length >= 15) recentWheelEvents.shift(); // only store the last N events 9902 const prevEvent = recentWheelEvents.length ? recentWheelEvents[recentWheelEvents.length - 1] : undefined; 9903 const firstEvent = recentWheelEvents[0]; 9904 recentWheelEvents.push(newEvent); 9905 if (prevEvent && (newEvent.delta > prevEvent.delta || newEvent.direction !== prevEvent.direction)) // Increasing or reverse-sign delta means the user started scrolling again. Clear the wheel event log. 9906 recentWheelEvents.splice(0); 9907 else if (recentWheelEvents.length >= 15 && newEvent.time - firstEvent.time < 500 && firstEvent.delta - newEvent.delta >= 1 && newEvent.delta <= 6) { 9908 // We're at the end of the deceleration of a momentum scroll, so there's no need 9909 // to wait for more events. Snap ASAP on the next tick. 9910 // Also, because there's some remaining momentum we'll bias the snap in the 9911 // direction of the ongoing scroll because it's better UX for the scroll to snap 9912 // in the same direction as the scroll instead of reversing to snap. Therefore, 9913 // if it's already scrolled more than 20% in the current direction, keep going. 9914 const snapToThreshold = delta > 0 ? 0.8 : 0.2; 9915 lastEventBeforeSnap = newEvent; 9916 recentWheelEvents.splice(0); 9917 timeout = nextTick(()=>{ 9918 swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); 9919 }, 0); // no delay; move on next tick 9920 } 9921 if (!timeout) // if we get here, then we haven't detected the end of a momentum scroll, so 9922 // we'll consider a scroll "complete" when there haven't been any wheel events 9923 // for 500ms. 9924 timeout = nextTick(()=>{ 9925 const snapToThreshold = 0.5; 9926 lastEventBeforeSnap = newEvent; 9927 recentWheelEvents.splice(0); 9928 swiper.slideToClosest(swiper.params.speed, true, undefined, snapToThreshold); 9929 }, 500); 9930 } // Emit event 9931 if (!ignoreWheelEvents) emit('scroll', e); // Stop autoplay 9932 if (swiper.params.autoplay && swiper.params.autoplayDisableOnInteraction) swiper.autoplay.stop(); // Return page scroll on edge positions 9933 if (position === swiper.minTranslate() || position === swiper.maxTranslate()) return true; 9934 } 9935 } 9936 if (e.preventDefault) e.preventDefault(); 9937 else e.returnValue = false; 9938 return false; 9939 } 9940 function events(method) { 9941 let target = swiper.$el; 9942 if (swiper.params.mousewheel.eventsTarget !== 'container') target = $(swiper.params.mousewheel.eventsTarget); 9943 target[method]('mouseenter', handleMouseEnter); 9944 target[method]('mouseleave', handleMouseLeave); 9945 target[method]('wheel', handle); 9946 } 9947 function enable() { 9948 if (swiper.params.cssMode) { 9949 swiper.wrapperEl.removeEventListener('wheel', handle); 9950 return true; 9951 } 9952 if (swiper.mousewheel.enabled) return false;
9953 events('on'); 9954 swiper.mousewheel.enabled = true; 9955 return true; 9956 } 9957 function disable() { 9958 if (swiper.params.cssMode) { 9959 swiper.wrapperEl.addEventListener(event, handle); 9960 return true; 9961 } 9962 if (!swiper.mousewheel.enabled) return false; 9963 events('off'); 9964 swiper.mousewheel.enabled = false; 9965 return true; 9966 } 9967 on('init', ()=>{ 9968 if (!swiper.params.mousewheel.enabled && swiper.params.cssMode) disable(); 9969 if (swiper.params.mousewheel.enabled) enable(); 9970 }); 9971 on('destroy', ()=>{ 9972 if (swiper.params.cssMode) enable(); 9973 if (swiper.mousewheel.enabled) disable(); 9974 }); 9975 Object.assign(swiper.mousewheel, { 9976 enable, 9977 disable 9978 }); 9979 } 9980 function createElementIfNotDefined(swiper, originalParams, params, checkProps) { 9981 const document1 = getDocument(); 9982 if (swiper.params.createElements) Object.keys(checkProps).forEach((key)=>{ 9983 if (!params[key] && params.auto === true) { 9984 let element = swiper.$el.children(`.${checkProps[key]}`)[0]; 9985 if (!element) { 9986 element = document1.createElement('div'); 9987 element.className = checkProps[key]; 9988 swiper.$el.append(element); 9989 } 9990 params[key] = element; 9991 originalParams[key] = element; 9992 } 9993 }); 9994 return params; 9995 } 9996 function Navigation(_ref) { 9997 let { swiper, extendParams, on, emit } = _ref; 9998 extendParams({ 9999 navigation: { 10000 nextEl: null, 10001 prevEl: null, 10002 hideOnClick: false, 10003 disabledClass: 'swiper-button-disabled', 10004 hiddenClass: 'swiper-button-hidden', 10005 lockClass: 'swiper-button-lock', 10006 navigationDisabledClass: 'swiper-navigation-disabled' 10007 } 10008 }); 10009 swiper.navigation = { 10010 nextEl: null, 10011 $nextEl: null, 10012 prevEl: null, 10013 $prevEl: null 10014 }; 10015 function getEl(el) { 10016 let $el; 10017 if (el) { 10018 $el = $(el); 10019 if (swiper.params.uniqueNavElements && typeof el === 'string' && $el.length > 1 && swiper.$el.find(el).length === 1) $el = swiper.$el.find(el); 10020 } 10021 return $el; 10022 } 10023 function toggleEl($el, disabled) { 10024 const params = swiper.params.navigation; 10025 if ($el && $el.length > 0) { 10026 $el[disabled ? 'addClass' : 'removeClass'](params.disabledClass); 10027 if ($el[0] && $el[0].tagName === 'BUTTON') $el[0].disabled = disabled; 10028 if (swiper.params.watchOverflow && swiper.enabled) $el[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass); 10029 } 10030 } 10031 function update() { 10032 // Update Navigation Buttons 10033 if (swiper.params.loop) return; 10034 const { $nextEl, $prevEl } = swiper.navigation; 10035 toggleEl($prevEl, swiper.isBeginning && !swiper.params.rewind); 10036 toggleEl($nextEl, swiper.isEnd && !swiper.params.rewind); 10037 } 10038 function onPrevClick(e) { 10039 e.preventDefault(); 10040 if (swiper.isBeginning && !swiper.params.loop && !swiper.params.rewind) return; 10041 swiper.slidePrev(); 10042 emit('navigationPrev'); 10043 } 10044 function onNextClick(e) { 10045 e.preventDefault(); 10046 if (swiper.isEnd && !swiper.params.loop && !swiper.params.rewind) return; 10047 swiper.slideNext(); 10048 emit('navigationNext'); 10049 } 10050 function init() { 10051 const params = swiper.params.navigation; 10052 swiper.params.navigation = createElementIfNotDefined(swiper, swiper.originalParams.navigation, swiper.params.navigation, { 10053 nextEl: 'swiper-button-next', 10054 prevEl: 'swiper-button-prev' 10055 }); 10056 if (!(params.nextEl || params.prevEl)) return; 10057 const $nextEl = getEl(params.nextEl); 10058 const $prevEl = getEl(params.prevEl); 10059 if ($nextEl && $nextEl.length > 0) $nextEl.on('click', onNextClick); 10060 if ($prevEl && $prevEl.length > 0) $prevEl.on('click', onPrevClick); 10061 Object.assign(swiper.navigation, { 10062 $nextEl, 10063 nextEl: $nextEl && $nextEl[0], 10064 $prevEl, 10065 prevEl: $prevEl && $prevEl[0] 10066 }); 10067 if (!swiper.enabled) { 10068 if ($nextEl) $nextEl.addClass(params.lockClass); 10069 if ($prevEl) $prevEl.addClass(params.lockClass); 10070 } 10071 } 10072 function destroy() { 10073 const { $nextEl, $prevEl } = swiper.navigation; 10074 if ($nextEl && $nextEl.length) { 10075 $nextEl.off('click', onNextClick); 10076 $nextEl.removeClass(swiper.params.navigation.disabledClass); 10077 } 10078 if ($prevEl && $prevEl.length) { 10079 $prevEl.off('click', onPrevClick); 10080 $prevEl.removeClass(swiper.params.navigation.disabledClass); 10081 } 10082 } 10083 on('init', ()=>{ 10084 if (swiper.params.navigation.enabled === false) // eslint-disable-next-line 10085 disable(); 10086 else { 10087 init(); 10088 update(); 10089 } 10090 }); 10091 on('toEdge fromEdge lock unlock', ()=>{ 10092 update(); 10093 }); 10094 on('destroy', ()=>{ 10095 destroy(); 10096 }); 10097 on('enable disable', ()=>{ 10098 const { $nextEl, $prevEl } = swiper.navigation; 10099 if ($nextEl) $nextEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass); 10100 if ($prevEl) $prevEl[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.navigation.lockClass); 10101 }); 10102 on('click', (_s, e)=>{ 10103 const { $nextEl, $prevEl } = swiper.navigation; 10104 const targetEl = e.target; 10105 if (swiper.params.navigation.hideOnClick && !$(targetEl).is($prevEl) && !$(targetEl).is($nextEl)) { 10106 if (swiper.pagination && swiper.params.pagination && swiper.params.pagination.clickable && (swiper.pagination.el === targetEl || swiper.pagination.el.contains(targetEl))) return; 10107 let isHidden; 10108 if ($nextEl) isHidden = $nextEl.hasClass(swiper.params.navigation.hiddenClass); 10109 else if ($prevEl) isHidden = $prevEl.hasClass(swiper.params.navigation.hiddenClass); 10110 if (isHidden === true) emit('navigationShow');
10111 else emit('navigationHide'); 10112 if ($nextEl) $nextEl.toggleClass(swiper.params.navigation.hiddenClass); 10113 if ($prevEl) $prevEl.toggleClass(swiper.params.navigation.hiddenClass); 10114 } 10115 }); 10116 const enable = ()=>{ 10117 swiper.$el.removeClass(swiper.params.navigation.navigationDisabledClass); 10118 init(); 10119 update(); 10120 }; 10121 const disable = ()=>{ 10122 swiper.$el.addClass(swiper.params.navigation.navigationDisabledClass); 10123 destroy(); 10124 }; 10125 Object.assign(swiper.navigation, { 10126 enable, 10127 disable, 10128 update, 10129 init, 10130 destroy 10131 }); 10132 } 10133 function classesToSelector(classes) { 10134 if (classes === void 0) classes = ''; 10135 return `.${classes.trim().replace(/([\.:!\/])/g, '\\$1') // eslint-disable-line 10136 .replace(/ /g, '.')}`; 10137 } 10138 function Pagination(_ref) { 10139 let { swiper, extendParams, on, emit } = _ref; 10140 const pfx = 'swiper-pagination'; 10141 extendParams({ 10142 pagination: { 10143 el: null, 10144 bulletElement: 'span', 10145 clickable: false, 10146 hideOnClick: false, 10147 renderBullet: null, 10148 renderProgressbar: null, 10149 renderFraction: null, 10150 renderCustom: null, 10151 progressbarOpposite: false, 10152 type: 'bullets', 10153 // 'bullets' or 'progressbar' or 'fraction' or 'custom' 10154 dynamicBullets: false, 10155 dynamicMainBullets: 1, 10156 formatFractionCurrent: (number)=>number, 10157 formatFractionTotal: (number)=>number, 10158 bulletClass: `${pfx}-bullet`, 10159 bulletActiveClass: `${pfx}-bullet-active`, 10160 modifierClass: `${pfx}-`, 10161 currentClass: `${pfx}-current`, 10162 totalClass: `${pfx}-total`, 10163 hiddenClass: `${pfx}-hidden`, 10164 progressbarFillClass: `${pfx}-progressbar-fill`, 10165 progressbarOppositeClass: `${pfx}-progressbar-opposite`, 10166 clickableClass: `${pfx}-clickable`, 10167 lockClass: `${pfx}-lock`, 10168 horizontalClass: `${pfx}-horizontal`, 10169 verticalClass: `${pfx}-vertical`, 10170 paginationDisabledClass: `${pfx}-disabled` 10171 } 10172 }); 10173 swiper.pagination = { 10174 el: null, 10175 $el: null, 10176 bullets: [] 10177 }; 10178 let bulletSize; 10179 let dynamicBulletIndex = 0; 10180 function isPaginationDisabled() { 10181 return !swiper.params.pagination.el || !swiper.pagination.el || !swiper.pagination.$el || swiper.pagination.$el.length === 0; 10182 } 10183 function setSideBullets($bulletEl, position) { 10184 const { bulletActiveClass } = swiper.params.pagination; 10185 $bulletEl[position]().addClass(`${bulletActiveClass}-${position}`)[position]().addClass(`${bulletActiveClass}-${position}-${position}`); 10186 } 10187 function update() { 10188 // Render || Update Pagination bullets/items 10189 const rtl = swiper.rtl; 10190 const params = swiper.params.pagination; 10191 if (isPaginationDisabled()) return; 10192 const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; 10193 const $el = swiper.pagination.$el; // Current/Total 10194 let current; 10195 const total = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length; 10196 if (swiper.params.loop) { 10197 current = Math.ceil((swiper.activeIndex - swiper.loopedSlides) / swiper.params.slidesPerGroup); 10198 if (current > slidesLength - 1 - swiper.loopedSlides * 2) current -= slidesLength - swiper.loopedSlides * 2; 10199 if (current > total - 1) current -= total; 10200 if (current < 0 && swiper.params.paginationType !== 'bullets') current = total + current; 10201 } else if (typeof swiper.snapIndex !== 'undefined') current = swiper.snapIndex; 10202 else current = swiper.activeIndex || 0; 10203 // Types 10204 if (params.type === 'bullets' && swiper.pagination.bullets && swiper.pagination.bullets.length > 0) { 10205 const bullets = swiper.pagination.bullets; 10206 let firstIndex; 10207 let lastIndex; 10208 let midIndex; 10209 if (params.dynamicBullets) { 10210 bulletSize = bullets.eq(0)[swiper.isHorizontal() ? 'outerWidth' : 'outerHeight'](true); 10211 $el.css(swiper.isHorizontal() ? 'width' : 'height', `${bulletSize * (params.dynamicMainBullets + 4)}px`); 10212 if (params.dynamicMainBullets > 1 && swiper.previousIndex !== undefined) { 10213 dynamicBulletIndex += current - (swiper.previousIndex - swiper.loopedSlides || 0); 10214 if (dynamicBulletIndex > params.dynamicMainBullets - 1) dynamicBulletIndex = params.dynamicMainBullets - 1; 10215 else if (dynamicBulletIndex < 0) dynamicBulletIndex = 0; 10216 } 10217 firstIndex = Math.max(current - dynamicBulletIndex, 0); 10218 lastIndex = firstIndex + (Math.min(bullets.length, params.dynamicMainBullets) - 1); 10219 midIndex = (lastIndex + firstIndex) / 2; 10220 } 10221 bullets.removeClass([ 10222 '',
10223 '-next', 10224 '-next-next', 10225 '-prev', 10226 '-prev-prev', 10227 '-main' 10228 ].map((suffix)=>`${params.bulletActiveClass}${suffix}`).join(' ')); 10229 if ($el.length > 1) bullets.each((bullet)=>{ 10230 const $bullet = $(bullet); 10231 const bulletIndex = $bullet.index(); 10232 if (bulletIndex === current) $bullet.addClass(params.bulletActiveClass); 10233 if (params.dynamicBullets) { 10234 if (bulletIndex >= firstIndex && bulletIndex <= lastIndex) $bullet.addClass(`${params.bulletActiveClass}-main`); 10235 if (bulletIndex === firstIndex) setSideBullets($bullet, 'prev'); 10236 if (bulletIndex === lastIndex) setSideBullets($bullet, 'next'); 10237 } 10238 }); 10239 else { 10240 const $bullet = bullets.eq(current); 10241 const bulletIndex = $bullet.index(); 10242 $bullet.addClass(params.bulletActiveClass); 10243 if (params.dynamicBullets) { 10244 const $firstDisplayedBullet = bullets.eq(firstIndex); 10245 const $lastDisplayedBullet = bullets.eq(lastIndex); 10246 for(let i = firstIndex; i <= lastIndex; i += 1)bullets.eq(i).addClass(`${params.bulletActiveClass}-main`); 10247 if (swiper.params.loop) { 10248 if (bulletIndex >= bullets.length) { 10249 for(let i = params.dynamicMainBullets; i >= 0; i -= 1)bullets.eq(bullets.length - i).addClass(`${params.bulletActiveClass}-main`); 10250 bullets.eq(bullets.length - params.dynamicMainBullets - 1).addClass(`${params.bulletActiveClass}-prev`); 10251 } else { 10252 setSideBullets($firstDisplayedBullet, 'prev'); 10253 setSideBullets($lastDisplayedBullet, 'next'); 10254 } 10255 } else { 10256 setSideBullets($firstDisplayedBullet, 'prev'); 10257 setSideBullets($lastDisplayedBullet, 'next'); 10258 } 10259 } 10260 } 10261 if (params.dynamicBullets) { 10262 const dynamicBulletsLength = Math.min(bullets.length, params.dynamicMainBullets + 4); 10263 const bulletsOffset = (bulletSize * dynamicBulletsLength - bulletSize) / 2 - midIndex * bulletSize; 10264 const offsetProp = rtl ? 'right' : 'left'; 10265 bullets.css(swiper.isHorizontal() ? offsetProp : 'top', `${bulletsOffset}px`); 10266 } 10267 } 10268 if (params.type === 'fraction') { 10269 $el.find(classesToSelector(params.currentClass)).text(params.formatFractionCurrent(current + 1)); 10270 $el.find(classesToSelector(params.totalClass)).text(params.formatFractionTotal(total)); 10271 } 10272 if (params.type === 'progressbar') { 10273 let progressbarDirection; 10274 if (params.progressbarOpposite) progressbarDirection = swiper.isHorizontal() ? 'vertical' : 'horizontal'; 10275 else progressbarDirection = swiper.isHorizontal() ? 'horizontal' : 'vertical'; 10276 const scale = (current + 1) / total; 10277 let scaleX = 1; 10278 let scaleY = 1; 10279 if (progressbarDirection === 'horizontal') scaleX = scale; 10280 else scaleY = scale; 10281 $el.find(classesToSelector(params.progressbarFillClass)).transform(`translate3d(0,0,0) scaleX(${scaleX}) scaleY(${scaleY})`).transition(swiper.params.speed); 10282 } 10283 if (params.type === 'custom' && params.renderCustom) { 10284 $el.html(params.renderCustom(swiper, current + 1, total)); 10285 emit('paginationRender', $el[0]); 10286 } else emit('paginationUpdate', $el[0]); 10287 if (swiper.params.watchOverflow && swiper.enabled) $el[swiper.isLocked ? 'addClass' : 'removeClass'](params.lockClass); 10288 } 10289 function render() { 10290 // Render Container 10291 const params = swiper.params.pagination; 10292 if (isPaginationDisabled()) return; 10293 const slidesLength = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.slides.length : swiper.slides.length; 10294 const $el = swiper.pagination.$el; 10295 let paginationHTML = ''; 10296 if (params.type === 'bullets') { 10297 let numberOfBullets = swiper.params.loop ? Math.ceil((slidesLength - swiper.loopedSlides * 2) / swiper.params.slidesPerGroup) : swiper.snapGrid.length; 10298 if (swiper.params.freeMode && swiper.params.freeMode.enabled && !swiper.params.loop && numberOfBullets > slidesLength) numberOfBullets = slidesLength; 10299 for(let i = 0; i < numberOfBullets; i += 1)if (params.renderBullet) paginationHTML += params.renderBullet.call(swi
10299per, i, params.bulletClass); 10300 else paginationHTML += `<${params.bulletElement} class="${params.bulletClass}"></${params.bulletElement}>`; 10301 $el.html(paginationHTML); 10302 swiper.pagination.bullets = $el.find(classesToSelector(params.bulletClass)); 10303 } 10304 if (params.type === 'fraction') { 10305 if (params.renderFraction) paginationHTML = params.renderFraction.call(swiper, params.currentClass, params.totalClass); 10306 else paginationHTML = `<span class="${params.currentClass}"></span>` + ' / ' + `<span class="${params.totalClass}"></span>`; 10307 $el.html(paginationHTML); 10308 } 10309 if (params.type === 'progressbar') { 10310 if (params.renderProgressbar) paginationHTML = params.renderProgressbar.call(swiper, params.progressbarFillClass); 10311 else paginationHTML = `<span class="${params.progressbarFillClass}"></span>`; 10312 $el.html(paginationHTML); 10313 } 10314 if (params.type !== 'custom') emit('paginationRender', swiper.pagination.$el[0]); 10315 } 10316 function init() { 10317 swiper.params.pagination = createElementIfNotDefined(swiper, swiper.originalParams.pagination, swiper.params.pagination, { 10318 el: 'swiper-pagination' 10319 }); 10320 const params = swiper.params.pagination; 10321 if (!params.el) return; 10322 let $el = $(params.el); 10323 if ($el.length === 0) return; 10324 if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1) { 10325 $el = swiper.$el.find(params.el); // check if it belongs to another nested Swiper 10326 if ($el.length > 1) $el = $el.filter((el)=>{ 10327 if ($(el).parents('.swiper')[0] !== swiper.el) return false; 10328 return true; 10329 }); 10330 } 10331 if (params.type === 'bullets' && params.clickable) $el.addClass(params.clickableClass); 10332 $el.addClass(params.modifierClass + params.type); 10333 $el.addClass(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 10334 if (params.type === 'bullets' && params.dynamicBullets) { 10335 $el.addClass(`${params.modifierClass}${params.type}-dynamic`); 10336 dynamicBulletIndex = 0; 10337 if (params.dynamicMainBullets < 1) params.dynamicMainBullets = 1; 10338 } 10339 if (params.type === 'progressbar' && params.progressbarOpposite) $el.addClass(params.progressbarOppositeClass); 10340 if (params.clickable) $el.on('click', classesToSelector(params.bulletClass), function onClick(e) { 10341 e.preventDefault(); 10342 let index = $(this).index() * swiper.params.slidesPerGroup; 10343 if (swiper.params.loop) index += swiper.loopedSlides; 10344 swiper.slideTo(index); 10345 }); 10346 Object.assign(swiper.pagination, { 10347 $el, 10348 el: $el[0] 10349 }); 10350 if (!swiper.enabled) $el.addClass(params.lockClass); 10351 } 10352 function destroy() { 10353 const params = swiper.params.pagination; 10354 if (isPaginationDisabled()) return; 10355 const $el = swiper.pagination.$el; 10356 $el.removeClass(params.hiddenClass); 10357 $el.removeClass(params.modifierClass + params.type); 10358 $el.removeClass(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 10359 if (swiper.pagination.bullets && swiper.pagination.bullets.removeClass) swiper.pagination.bullets.removeClass(params.bulletActiveClass); 10360 if (params.clickable) $el.off('click', classesToSelector(params.bulletClass)); 10361 } 10362 on('init', ()=>{ 10363 if (swiper.params.pagination.enabled === false) // eslint-disable-next-line 10364 disable(); 10365 else { 10366 init(); 10367 render(); 10368 update(); 10369 } 10370 }); 10371 on('activeIndexChange', ()=>{ 10372 if (swiper.params.loop) update(); 10373 else if (typeof swiper.snapIndex === 'undefined') update(
10373); 10374 }); 10375 on('snapIndexChange', ()=>{ 10376 if (!swiper.params.loop) update(); 10377 }); 10378 on('slidesLengthChange', ()=>{ 10379 if (swiper.params.loop) { 10380 render(); 10381 update(); 10382 } 10383 }); 10384 on('snapGridLengthChange', ()=>{ 10385 if (!swiper.params.loop) { 10386 render(); 10387 update(); 10388 } 10389 }); 10390 on('destroy', ()=>{ 10391 destroy(); 10392 }); 10393 on('enable disable', ()=>{ 10394 const { $el } = swiper.pagination; 10395 if ($el) $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.pagination.lockClass); 10396 }); 10397 on('lock unlock', ()=>{ 10398 update(); 10399 }); 10400 on('click', (_s, e)=>{ 10401 const targetEl = e.target; 10402 const { $el } = swiper.pagination; 10403 if (swiper.params.pagination.el && swiper.params.pagination.hideOnClick && $el && $el.length > 0 && !$(targetEl).hasClass(swiper.params.pagination.bulletClass)) { 10404 if (swiper.navigation && (swiper.navigation.nextEl && targetEl === swiper.navigation.nextEl || swiper.navigation.prevEl && targetEl === swiper.navigation.prevEl)) return; 10405 const isHidden = $el.hasClass(swiper.params.pagination.hiddenClass); 10406 if (isHidden === true) emit('paginationShow'); 10407 else emit('paginationHide'); 10408 $el.toggleClass(swiper.params.pagination.hiddenClass); 10409 } 10410 }); 10411 const enable = ()=>{ 10412 swiper.$el.removeClass(swiper.params.pagination.paginationDisabledClass); 10413 if (swiper.pagination.$el) swiper.pagination.$el.removeClass(swiper.params.pagination.paginationDisabledClass); 10414 init(); 10415 render(); 10416 update(); 10417 }; 10418 const disable = ()=>{ 10419 swiper.$el.addClass(swiper.params.pagination.paginationDisabledClass); 10420 if (swiper.pagination.$el) swiper.pagination.$el.addClass(swiper.params.pagination.paginationDisabledClass); 10421 destroy(); 10422 }; 10423 Object.assign(swiper.pagination, { 10424 enable, 10425 disable, 10426 render, 10427 update, 10428 init, 10429 destroy 10430 }); 10431 } 10432 function Scrollbar(_ref) { 10433 let { swiper, extendParams, on, emit } = _ref; 10434 const document1 = getDocument(); 10435 let isTouched = false; 10436 let timeout = null; 10437 let dragTimeout = null; 10438 let dragStartPos; 10439 let dragSize; 10440 let trackSize; 10441 let divider; 10442 extendParams({ 10443 scrollbar: { 10444 el: null, 10445 dragSize: 'auto', 10446 hide: false, 10447 draggable: false, 10448 snapOnRelease: true, 10449 lockClass: 'swiper-scrollbar-lock', 10450 dragClass: 'swiper-scrollbar-drag', 10451 scrollbarDisabledClass: 'swiper-scrollbar-disabled', 10452 horizontalClass: `swiper-scrollbar-horizontal`, 10453 verticalClass: `swiper-scrollbar-vertical` 10454 } 10455 }); 10456 swiper.scrollbar = { 10457 el: null, 10458 dragEl: null, 10459 $el: null, 10460 $dragEl: null 10461 }; 10462 function setTranslate() { 10463 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 10464 const { scrollbar, rtlTranslate: rtl, progress } = swiper; 10465 const { $dragEl, $el } = scrollbar; 10466 const params = swiper.params.scrollbar; 10467 let newSize = dragSize; 10468 let newPos = (trackSize - dragSize) * progress; 10469 if (rtl) { 10470 newPos = -newPos; 10471 if (newPos > 0) { 10472 newSize = dragSize - newPos; 10473 newPos = 0; 10474 } else if (-newPos + dragSize > trackSize) newSize = trackSize + newPos; 10475 } else if (newPos < 0) { 10476 newSize = dragSize + newPos; 10477 newPos = 0; 10478 } else if (newPos + dragSize > trackSize) newSize = trackSize - newPos; 10479 if (swiper.isHorizontal()) { 10480 $dragEl.transform(`translate3d(${newPos}px, 0, 0)`); 10481 $dragEl[0].style.width = `${newSize}px`; 10482 } else { 10483 $dragEl.transform(`translate3d(0px, ${newPos}px, 0)`); 10484 $dragEl[0].style.height = `${newSize}px`; 10485 } 10486 if (params.hide) { 10487 clearTimeout(timeout); 10488 $el[0].style.opacity = 1; 10489 timeout = setTimeout(()=>{ 10490 $el[0].style.opacity = 0; 10491 $el.transition(400); 10492 }, 1000); 10493 } 10494 } 10495 function setTransition(duration) { 10496 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 10497 swiper.scrollbar.$dragEl.transition(duration); 10498 } 10499 function updateSize() { 10500 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 10501 const { scrollbar } = swiper; 10502 const { $dragEl, $el } = scrollbar; 10503 $dragEl[0].style.width = ''; 10504 $dragEl[0].style.height = ''; 10505 trackSize = swiper.isHorizontal() ? $el[0].offsetWidth : $el[0].offsetHeight; 10506 divider = swiper.size / (swiper.virtualSize + swiper.params.slidesOffsetBefore - (swiper.params.centeredSlides ? swiper.snapGrid[0] : 0)); 10507 if (swiper.params.scrollbar.dragSize === 'auto') dragSize = trackSize * divider; 10508 else dragSize = parseInt(swiper.params.scrollbar.dragSize, 10); 10509 if (swiper.isHorizontal()) $dragEl[0].style.width = `${dragSize}px`; 10510 else $dragEl[0].style.height = `${dragSize}px`; 10511 if (divider >= 1) $el[0].style.display = 'none'; 10512 else $el[0].style.display = ''; 10513 if (swiper.params.scrollbar.hide) $el[0].style.opacity = 0; 10514 if (swiper.params.watchOverflow && swiper.enabled) scrollbar.$el[swiper.isLocked ? 'addClass' : 'removeClass'](swiper.params.scrollbar.lockClass); 10515 } 10516 function getPointerPosition(e) { 10517 if (swiper.isHorizontal()) return e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].clientX : e.clientX; 10518 return e.type === 'touchstart' || e.type === 'touchmove' ? e.targetTouches[0].clientY : e.clientY; 10519 } 10520 function setDragPosition(e) { 10521 const { scrollbar, rtlTranslate: rtl } = swiper; 10522 const { $el } = scrollbar; 10523 let positionRatio; 10524 positionRatio = (getPointerPosition(e) - $el.offset()[swiper.isHorizontal() ? 'left' : 'top'] - (dragStartPos !== null ? dragStartPos : dragSize / 2)) / (trackSize - dragSize); 10525 positionRatio = Math.max(Math.min(positionRatio, 1), 0); 10526 if (rtl) positionRatio = 1 - positionRatio; 10527 const position = swiper.minTranslate() + (swiper.maxTranslate() - swiper.minTranslate()) * positionRatio; 10528 swiper.updateProgress(position); 10529 swiper.setTranslate(position); 10530 swiper.updateActiveIndex(); 10531 swiper.updateSlidesClasses(); 10532 } 10533 function onDragStart(e) { 10534 const params = swiper.params.scrollbar; 10535 const { scrollbar, $wrapperEl } = swiper; 10536 const { $el, $dragEl } = scrollbar; 10537 isTouched = true; 10538 dragStartPos = e.target === $dragEl[0] || e.target === $dragEl ? getPointerPosition(e) - e.target.getBoundingClientRect()[swiper.isHorizontal() ? 'left' : 'top'] : null; 10539 e.preventDefault(); 10540 e.stopPropagation(); 10541 $wrapperEl.transition(100); 10542 $dragEl.transition(100); 10543 setDragPosition(e); 10544 clearTimeout(dragTimeout); 10545 $el.transition(0); 10546 if (params.hide) $el.css('opacity', 1); 10547 if (swiper.params.cssMode) swiper.$wrapperEl.css('scroll-snap-type', 'none'); 10548 emit('scrollbarDragStart', e); 10549 } 10550 function onDragMove(e) { 10551 const { scrollbar, $wrapperEl } = swiper; 10552 const { $el, $dragEl } = scrollbar; 10553 if (!isTouched) return; 10554 if (e.preventDefault) e.preventDefault(); 10555 else e.returnValue = false;
10556 setDragPosition(e); 10557 $wrapperEl.transition(0); 10558 $el.transition(0); 10559 $dragEl.transition(0); 10560 emit('scrollbarDragMove', e); 10561 } 10562 function onDragEnd(e) { 10563 const params = swiper.params.scrollbar; 10564 const { scrollbar, $wrapperEl } = swiper; 10565 const { $el } = scrollbar; 10566 if (!isTouched) return; 10567 isTouched = false; 10568 if (swiper.params.cssMode) { 10569 swiper.$wrapperEl.css('scroll-snap-type', ''); 10570 $wrapperEl.transition(''); 10571 } 10572 if (params.hide) { 10573 clearTimeout(dragTimeout); 10574 dragTimeout = nextTick(()=>{ 10575 $el.css('opacity', 0); 10576 $el.transition(400); 10577 }, 1000); 10578 } 10579 emit('scrollbarDragEnd', e); 10580 if (params.snapOnRelease) swiper.slideToClosest(); 10581 } 10582 function events(method) { 10583 const { scrollbar, touchEventsTouch, touchEventsDesktop, params, support } = swiper; 10584 const $el = scrollbar.$el; 10585 if (!$el) return; 10586 const target = $el[0]; 10587 const activeListener = support.passiveListener && params.passiveListeners ? { 10588 passive: false, 10589 capture: false 10590 } : false; 10591 const passiveListener = support.passiveListener && params.passiveListeners ? { 10592 passive: true, 10593 capture: false 10594 } : false; 10595 if (!target) return; 10596 const eventMethod = method === 'on' ? 'addEventListener' : 'removeEventListener'; 10597 if (!support.touch) { 10598 target[eventMethod](touchEventsDesktop.start, onDragStart, activeListener); 10599 document1[eventMethod](touchEventsDesktop.move, onDragMove, activeListener); 10600 document1[eventMethod](touchEventsDesktop.end, onDragEnd, passiveListener); 10601 } else { 10602 target[eventMethod](touchEventsTouch.start, onDragStart, activeListener); 10603 target[eventMethod](touchEventsTouch.move, onDragMove, activeListener); 10604 target[eventMethod](touchEventsTouch.end, onDragEnd, passiveListener); 10605 } 10606 } 10607 function enableDraggable() { 10608 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 10609 events('on'); 10610 } 10611 function disableDraggable() { 10612 if (!swiper.params.scrollbar.el || !swiper.scrollbar.el) return; 10613 events('off'); 10614 } 10615 function init() { 10616 const { scrollbar, $el: $swiperEl } = swiper; 10617 swiper.params.scrollbar = createElementIfNotDefined(swiper, swiper.originalParams.scrollbar, swiper.params.scrollbar, { 10618 el: 'swiper-scrollbar' 10619 }); 10620 const params = swiper.params.scrollbar; 10621 if (!params.el) return; 10622 let $el = $(params.el); 10623 if (swiper.params.uniqueNavElements && typeof params.el === 'string' && $el.length > 1 && $swiperEl.find(params.el).length === 1) $el = $swiperEl.find(params.el); 10624 $el.addClass(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 10625 let $dragEl = $el.find(`.${swiper.params.scrollbar.dragClass}`); 10626 if ($dragEl.length === 0) { 10627 $dragEl = $(`<div class="${swiper.params.scrollbar.dragClass}"></div>`); 10628 $el.append($dragEl); 10629 } 10630 Object.assign(scrollbar, { 10631 $el, 10632 el: $el[0], 10633 $dragEl, 10634 dragEl: $dragEl[0] 10635 }); 10636 if (params.draggable) enableDraggable(); 10637 if ($el) $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.scrollbar.lockClass); 10638 } 10639 function destroy() { 10640 const params = swiper.params.scrollbar; 10641 const $el = swiper.scrollbar.$el; 10642 if ($el) $el.removeClass(swiper.isHorizontal() ? params.horizontalClass : params.verticalClass); 10643 disableDraggable(); 10644 } 10645 on('init', ()=>{ 10646 if (swiper.params.scrollbar.enabled === false) // eslint-disable-next-line 10647 disable(); 10648 else { 10649 init(); 10650 updateSize(); 10651 setTranslate(); 10652 } 10653 }); 10654 on('update resize observerUpdate lock unlock', ()=>{ 10655 updateSize(); 10656 }); 10657 on('setTranslate', ()=>{ 10658 setTranslate(); 10659 }); 10660 on('setTransition', (_s, duration)=>{ 10661 setTransition(duration); 10662 }); 10663 on('enable disable', ()=>{ 10664 const { $el } = swiper.scrollbar; 10665 if ($el) $el[swiper.enabled ? 'removeClass' : 'addClass'](swiper.params.scrollbar.lockClass); 10666 }); 10667 on('destroy', ()=>{ 10668 destroy(); 10669 }); 10670 const enable = ()=>{ 10671 swiper.$el.removeClass(swiper.params.scrollbar.scrollbarDisabledClass); 10672 if (swiper.scrollbar.$el) swiper.scrollbar.$el.removeClass(swiper.params.scrollbar.scrollbarDisabledClass); 10673 init(); 10674 updateSize(); 10675 setTranslate(); 10676 }; 10677 const disable = ()=>{ 10678 swiper.$el.addClass(swiper.params.scrollbar.scrollbarDisabledClass); 10679 if (swiper.scrollbar.$el) swiper.scrollbar.$el.addClass(swiper.params.scrollbar.scrollbarDisabledClass); 10680 destroy(); 10681 }; 10682 Object.assign(swiper.scrollbar, { 10683 enable, 10684 disable, 10685 updateSize, 10686 setTranslate, 10687 init, 10688 destroy 10689 }); 10690 } 10691 function Parallax(_ref) { 10692 let { swiper, extendParams, on } = _ref; 10693 extendParams({ 10694 parallax: { 10695 enabled: false 10696 } 10697 }); 10698 const setTransform = (el, progress)=>{ 10699 const { rtl } = swiper; 10700 const $el = $(el); 10701 const rtlFactor = rtl ? -1 : 1; 10702 const p = $el.attr('data-swiper-parallax') || '0'; 10703 let x = $el.attr('data-swiper-parallax-x'); 10704 let y = $el.attr('data-swiper-parallax-y'); 10705 const scale = $el.attr('data-swiper-parallax-scale'); 10706 const opacity = $el.attr('data-swiper-parallax-opacity'); 10707 if (x || y) { 10708 x = x || '0'; 10709 y = y || '0'; 10710 } else if (swiper.isHorizontal()) { 10711 x = p; 10712 y = '0'; 10713 } else { 10714 y = p; 10715 x = '0'; 10716 } 10717 if (x.indexOf('%') >= 0) x = `${parseInt(x, 10) * progress * rtlFactor}%`; 10718 else x = `${x * progress * rtlFactor}px`;
10719 if (y.indexOf('%') >= 0) y = `${parseInt(y, 10) * progress}%`; 10720 else y = `${y * progress}px`; 10721 if (typeof opacity !== 'undefined' && opacity !== null) { 10722 const currentOpacity = opacity - (opacity - 1) * (1 - Math.abs(progress)); 10723 $el[0].style.opacity = currentOpacity; 10724 } 10725 if (typeof scale === 'undefined' || scale === null) $el.transform(`translate3d(${x}, ${y}, 0px)`); 10726 else { 10727 const currentScale = scale - (scale - 1) * (1 - Math.abs(progress)); 10728 $el.transform(`translate3d(${x}, ${y}, 0px) scale(${currentScale})`); 10729 } 10730 }; 10731 const setTranslate = ()=>{ 10732 const { $el, slides, progress, snapGrid } = swiper; 10733 $el.children('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each((el)=>{ 10734 setTransform(el, progress); 10735 }); 10736 slides.each((slideEl, slideIndex)=>{ 10737 let slideProgress = slideEl.progress; 10738 if (swiper.params.slidesPerGroup > 1 && swiper.params.slidesPerView !== 'auto') slideProgress += Math.ceil(slideIndex / 2) - progress * (snapGrid.length - 1); 10739 slideProgress = Math.min(Math.max(slideProgress, -1), 1); 10740 $(slideEl).find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each((el)=>{ 10741 setTransform(el, slideProgress); 10742 }); 10743 }); 10744 }; 10745 const setTransition = function(duration) { 10746 if (duration === void 0) duration = swiper.params.speed; 10747 const { $el } = swiper; 10748 $el.find('[data-swiper-parallax], [data-swiper-parallax-x], [data-swiper-parallax-y], [data-swiper-parallax-opacity], [data-swiper-parallax-scale]').each((parallaxEl)=>{ 10749 const $parallaxEl = $(parallaxEl); 10750 let parallaxDuration = parseInt($parallaxEl.attr('data-swiper-parallax-duration'), 10) || duration; 10751 if (duration === 0) parallaxDuration = 0; 10752 $parallaxEl.transition(parallaxDuration); 10753 }); 10754 }; 10755 on('beforeInit', ()=>{ 10756 if (!swiper.params.parallax.enabled) return; 10757 swiper.params.watchSlidesProgress = true; 10758 swiper.originalParams.watchSlidesProgress = true; 10759 }); 10760 on('init', ()=>{ 10761 if (!swiper.params.parallax.enabled) return; 10762 setTranslate(); 10763 }); 10764 on('setTranslate', ()=>{ 10765 if (!swiper.params.parallax.enabled) return; 10766 setTranslate(); 10767 }); 10768 on('setTransition', (_swiper, duration)=>{ 10769 if (!swiper.params.parallax.enabled) return; 10770 setTransition(duration); 10771 }); 10772 } 10773 function Zoom(_ref) { 10774 let { swiper, extendParams, on, emit } = _ref; 10775 const window1 = getWindow(); 10776 extendParams({ 10777 zoom: { 10778 enabled: false, 10779 maxRatio: 3, 10780 minRatio: 1, 10781 toggle: true, 10782 containerClass: 'swiper-zoom-container', 10783 zoomedSlideClass: 'swiper-slide-zoomed' 10784 } 10785 }); 10786 swiper.zoom = { 10787 enabled: false 10788 }; 10789 let currentScale = 1; 10790 let isScaling = false; 10791 let gesturesEnabled; 10792 let fakeGestureTouched; 10793 let fakeGestureMoved; 10794 const gesture = { 10795 $slideEl: undefined, 10796 slideWidth: undefined, 10797 slideHeight: undefined, 10798 $imageEl: undefined, 10799 $imageWrapEl: undefined, 10800 maxRatio: 3 10801 }; 10802 const image = { 10803 isTouched: undefined, 10804 isMoved: undefined, 10805 currentX: undefined, 10806 currentY: undefined, 10807 minX: undefined, 10808 minY: undefined, 10809 maxX: undefined, 10810 maxY: undefined, 10811 width: undefined, 10812 height: undefined, 10813 startX: undefined, 10814 startY: undefined, 10815 touchesStart: {}, 10816 touchesCurrent: {} 10817 }; 10818 const velocity = { 10819 x: undefined, 10820 y: undefined, 10821 prevPositionX: undefined, 10822 prevPositionY: undefined, 10823 prevTime: undefined 10824 }; 10825 let scale = 1; 10826 Object.defineProperty(swiper.zoom, 'scale', { 10827 get () { 10828 return scale; 10829 }, 10830 set (value) { 10831 if (scale !== value) { 10832 const imageEl = gesture.$imageEl ? gesture.$imageEl[0] : undefined; 10833 const slideEl = gesture.$slideEl ? gesture.$slideEl[0] : undefined; 10834 emit('zoomChange', value, imageEl, slideEl); 10835 } 10836 scale = value; 10837 } 10838 }); 10839 function getDistanceBetweenTouches(e) { 10840 if (e.targetTouches.length < 2) return 1; 10841 const x1 = e.targetTouches[0].pageX; 10842 const y1 = e.targetTouches[0].pageY; 10843 const x2 = e.targetTouches[1].pageX; 10844 const y2 = e.targetTouches[1].pageY; 10845 const distance = Math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2); 10846 return distance; 10847 } // Events 10848 function onGestureStart(e) { 10849 const support = swiper.support; 10850 const params = swiper.params.zoom; 10851 fakeGestureTouched = false;
vendor: 9,840 bytes, lines 10852-11007
10852 fakeGestureMoved = false; 10853 if (!support.gestures) { 10854 if (e.type !== 'touchstart' || e.type === 'touchstart' && e.targetTouches.length < 2) return; 10855 fakeGestureTouched = true; 10856 gesture.scaleStart = getDistanceBetweenTouches(e); 10857 } 10858 if (!gesture.$slideEl || !gesture.$slideEl.length) { 10859 gesture.$slideEl = $(e.target).closest(`.${swiper.params.slideClass}`); 10860 if (gesture.$slideEl.length === 0) gesture.$slideEl = swiper.slides.eq(swiper.activeIndex); 10861 gesture.$imageEl = gesture.$slideEl.find(`.${params.containerClass}`).eq(0).find('picture, img, svg, canvas, .swiper-zoom-target').eq(0); 10862 gesture.$imageWrapEl = gesture.$imageEl.parent(`.${params.containerClass}`); 10863 gesture.maxRatio = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio; 10864 if (gesture.$imageWrapEl.length === 0) { 10865 gesture.$imageEl = undefined; 10866 return; 10867 } 10868 } 10869 if (gesture.$imageEl) gesture.$imageEl.transition(0); 10870 isScaling = true; 10871 } 10872 function onGestureChange(e) { 10873 const support = swiper.support; 10874 const params = swiper.params.zoom; 10875 const zoom = swiper.zoom; 10876 if (!support.gestures) { 10877 if (e.type !== 'touchmove' || e.type === 'touchmove' && e.targetTouches.length < 2) return; 10878 fakeGestureMoved = true; 10879 gesture.scaleMove = getDistanceBetweenTouches(e); 10880 } 10881 if (!gesture.$imageEl || gesture.$imageEl.length === 0) { 10882 if (e.type === 'gesturechange') onGestureStart(e); 10883 return; 10884 } 10885 if (support.gestures) zoom.scale = e.scale * currentScale; 10886 else zoom.scale = gesture.scaleMove / gesture.scaleStart * currentScale; 10887 if (zoom.scale > gesture.maxRatio) zoom.scale = gesture.maxRatio - 1 + (zoom.scale - gesture.maxRatio + 1) ** 0.5; 10888 if (zoom.scale < params.minRatio) zoom.scale = params.minRatio + 1 - (params.minRatio - zoom.scale + 1) ** 0.5; 10889 gesture.$imageEl.transform(`translate3d(0,0,0) scale(${zoom.scale})`); 10890 } 10891 function onGestureEnd(e) { 10892 const device = swiper.device; 10893 const support = swiper.support; 10894 const params = swiper.params.zoom; 10895 const zoom = swiper.zoom; 10896 if (!support.gestures) { 10897 if (!fakeGestureTouched || !fakeGestureMoved) return; 10898 if (e.type !== 'touchend' || e.type === 'touchend' && e.changedTouches.length < 2 && !device.android) return; 10899 fakeGestureTouched = false; 10900 fakeGestureMoved = false; 10901 } 10902 if (!gesture.$imageEl || gesture.$imageEl.length === 0) return; 10903 zoom.scale = Math.max(Math.min(zoom.scale, gesture.maxRatio), params.minRatio); 10904 gesture.$imageEl.transition(swiper.params.speed).transform(`translate3d(0,0,0) scale(${zoom.scale})`); 10905 currentScale = zoom.scale; 10906 isScaling = false; 10907 if (zoom.scale === 1) gesture.$slideEl = undefined; 10908 } 10909 function onTouchStart(e) { 10910 const device = swiper.device; 10911 if (!gesture.$imageEl || gesture.$imageEl.length === 0) return; 10912 if (image.isTouched) return; 10913 if (device.android && e.cancelable) e.preventDefault(); 10914 image.isTouched = true; 10915 image.touchesStart.x = e.type === 'touchstart' ? e.targetTouches[0].pageX : e.pageX; 10916 image.touchesStart.y = e.type === 'touchstart' ? e.targetTouches[0].pageY : e.pageY; 10917 } 10918 function onTouchMove(e) { 10919 const zoom = swiper.zoom; 10920 if (!gesture.$imageEl || gesture.$imageEl.length === 0) return; 10921 swiper.allowClick = false; 10922 if (!image.isTouched || !gesture.$slideEl) return; 10923 if (!image.isMoved) { 10924 image.width = gesture.$imageEl[0].offsetWidth; 10925 image.height = gesture.$imageEl[0].offsetHeight; 10926 image.startX = getTranslate(gesture.$imageWrapEl[0], 'x') || 0; 10927 image.startY = getTranslate(gesture.$imageWrapEl[0], 'y') || 0; 10928 gesture.slideWidth = gesture.$slideEl[0].offsetWidth; 10929 gesture.slideHeight = gesture.$slideEl[0].offsetHeight; 10930 gesture.$imageWrapEl.transition(0); 10931 } // Define if we need image drag 10932 const scaledWidth = image.width * zoom.scale; 10933 const scaledHeight = image.height * zoom.scale; 10934 if (scaledWidth < gesture.slideWidth && scaledHeight < gesture.slideHeight) return; 10935 image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0); 10936 image.maxX = -image.minX; 10937 image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0); 10938 image.maxY = -image.minY; 10939 image.touchesCurrent.x = e.type === 'touchmove' ? e.targetTouches[0].pageX : e.pageX; 10940 image.touchesCurrent.y = e.type === 'touchmove' ? e.targetTouches[0].pageY : e.pageY; 10941 if (!image.isMoved && !isScaling) { 10942 if (swiper.isHorizontal() && (Math.floor(image.minX) === Math.floor(image.startX) && image.touchesCurrent.x < image.touchesStart.x || Math.floor(image.maxX) === Math.floor(image.startX) && image.touchesCurrent.x > image.touchesStart.x)) { 10943 image.isTouched = false; 10944 return; 10945 } 10946 if (!swiper.isHorizontal() && (Math.floor(image.minY) === Math.floor(image.startY) && image.touchesCurrent.y < image.touchesStart.y || Math.floor(image.maxY) === Math.floor(image.startY) && image.touchesCurrent.y > image.touchesStart.y)) { 10947 image.isTouched = false; 10948 return; 10949 } 10950 } 10951 if (e.cancelable) e.preventDefault(); 10952 e.stopPropagation(); 10953 image.isMoved = true; 10954 image.currentX = image.touchesCurrent.x - image.touchesStart.x + image.startX; 10955 image.currentY = image.touchesCurrent.y - image.touchesStart.y + image.startY; 10956 if (image.currentX < image.minX) image.currentX = image.minX + 1 - (image.minX - image.currentX + 1) ** 0.8; 10957 if (image.currentX > image.maxX) image.currentX = image.maxX - 1 + (image.currentX - image.maxX + 1) ** 0.8; 10958 if (image.currentY < image.minY) image.currentY = image.minY + 1 - (image.minY - image.currentY + 1) ** 0.8; 10959 if (image.currentY > image.maxY) image.currentY = image.maxY - 1 + (image.currentY - image.maxY + 1) ** 0.8; 10960 // Velocity 10961 if (!velocity.prevPositionX) velocity.prevPositionX = image.touchesCurrent.x; 10962 if (!velocity.prevPositionY) velocity.prevPositionY = image.touchesCurrent.y; 10963 if (!velocity.prevTime) velocity.prevTime = Date.now(); 10964 velocity.x = (image.touchesCurrent.x - velocity.prevPositionX) / (Date.now() - velocity.prevTime) / 2; 10965 velocity.y = (image.touchesCurrent.y - velocity.prevPositionY) / (Date.now() - velocity.prevTime) / 2; 10966 if (Math.abs(image.touchesCurrent.x - velocity.prevPositionX) < 2) velocity.x = 0; 10967 if (Math.abs(image.touchesCurrent.y - velocity.prevPositionY) < 2) velocity.y = 0; 10968 velocity.prevPositionX = image.touchesCurrent.x; 10969 velocity.prevPositionY = image.touchesCurrent.y; 10970 velocity.prevTime = Date.now(); 10971 gesture.$imageWrapEl.transform(`translate3d(${image.currentX}px, ${image.currentY}px,0)`); 10972 } 10973 function onTouchEnd() { 10974 const zoom = swiper.zoom; 10975 if (!gesture.$imageEl || gesture.$imageEl.length === 0) return; 10976 if (!image.isTouched || !image.isMoved) { 10977 image.isTouched = false; 10978 image.isMoved = false; 10979 return; 10980 } 10981 image.isTouched = false; 10982 image.isMoved = false; 10983 let momentumDurationX = 300; 10984 let momentumDurationY = 300; 10985 const momentumDistanceX = velocity.x * momentumDurationX; 10986 const newPositionX = image.currentX + momentumDistanceX; 10987 const momentumDistanceY = velocity.y * momentumDurationY; 10988 const newPositionY = image.currentY + momentumDistanceY; // Fix duration 10989 if (velocity.x !== 0) momentumDurationX = Math.abs((newPositionX - image.currentX) / velocity.x); 10990 if (velocity.y !== 0) momentumDurationY = Math.abs((newPositionY - image.currentY) / velocity.y); 10991 const momentumDuration = Math.max(momentumDurationX, momentumDurationY); 10992 image.currentX = newPositionX; 10993 image.currentY = newPositionY; // Define if we need image drag 10994 const scaledWidth = image.width * zoom.scale; 10995 const scaledHeight = image.height * zoom.scale; 10996 image.minX = Math.min(gesture.slideWidth / 2 - scaledWidth / 2, 0); 10997 image.maxX = -image.minX; 10998 image.minY = Math.min(gesture.slideHeight / 2 - scaledHeight / 2, 0); 10999 image.maxY = -image.minY; 11000 image.currentX = Math.max(Math.min(image.currentX, image.maxX), image.minX); 11001 image.currentY = Math.max(Math.min(image.currentY, image.maxY), image.minY); 11002 gesture.$imageWrapEl.transition(momentumDuration).transform(`translate3d(${image.currentX}px, ${image.currentY}px,0)`); 11003 } 11004 function onTransitionEnd() { 11005 const zoom = swiper.zoom; 11006 if (gesture.$slideEl && swiper.previousIndex !== swiper.activeIndex) { 11007 if (gesture.$imageEl) gesture.$imageEl.transform('translate3d(0,
110070,0) scale(1)'); 11008 if (gesture.$imageWrapEl) gesture.$imageWrapEl.transform('translate3d(0,0,0)'); 11009 zoom.scale = 1; 11010 currentScale = 1; 11011 gesture.$slideEl = undefined; 11012 gesture.$imageEl = undefined; 11013 gesture.$imageWrapEl = undefined; 11014 } 11015 } 11016 function zoomIn(e) { 11017 const zoom = swiper.zoom; 11018 const params = swiper.params.zoom; 11019 if (!gesture.$slideEl) { 11020 if (e && e.target) gesture.$slideEl = $(e.target).closest(`.${swiper.params.slideClass}`); 11021 if (!gesture.$slideEl) { 11022 if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) gesture.$slideEl = swiper.$wrapperEl.children(`.${swiper.params.slideActiveClass}`); 11023 else gesture.$slideEl = swiper.slides.eq(swiper.activeIndex); 11024 } 11025 gesture.$imageEl = gesture.$slideEl.find(`.${params.containerClass}`).eq(0).find('picture, img, svg, canvas, .swiper-zoom-target').eq(0); 11026 gesture.$imageWrapEl = gesture.$imageEl.parent(`.${params.containerClass}`); 11027 } 11028 if (!gesture.$imageEl || gesture.$imageEl.length === 0 || !gesture.$imageWrapEl || gesture.$imageWrapEl.length === 0) return; 11029 if (swiper.params.cssMode) { 11030 swiper.wrapperEl.style.overflow = 'hidden'; 11031 swiper.wrapperEl.style.touchAction = 'none'; 11032 } 11033 gesture.$slideEl.addClass(`${params.zoomedSlideClass}`); 11034 let touchX; 11035 let touchY; 11036 let offsetX; 11037 let offsetY; 11038 let diffX; 11039 let diffY; 11040 let translateX; 11041 let translateY; 11042 let imageWidth; 11043 let imageHeight; 11044 let scaledWidth; 11045 let scaledHeight; 11046 let translateMinX; 11047 let translateMinY; 11048 let translateMaxX; 11049 let translateMaxY; 11050 let slideWidth; 11051 let slideHeight; 11052 if (typeof image.touchesStart.x === 'undefined' && e) { 11053 touchX = e.type === 'touchend' ? e.changedTouches[0].pageX : e.pageX; 11054 touchY = e.type === 'touchend' ? e.changedTouches[0].pageY : e.pageY; 11055 } else { 11056 touchX = image.touchesStart.x; 11057 touchY = image.touchesStart.y; 11058 } 11059 zoom.scale = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio; 11060 currentScale = gesture.$imageWrapEl.attr('data-swiper-zoom') || params.maxRatio; 11061 if (e) { 11062 slideWidth = gesture.$slideEl[0].offsetWidth; 11063 slideHeight = gesture.$slideEl[0].offsetHeight; 11064 offsetX = gesture.$slideEl.offset().left + window1.scrollX; 11065 offsetY = gesture.$slideEl.offset().top + window1.scrollY; 11066 diffX = offsetX + slideWidth / 2 - touchX; 11067 diffY = offsetY + slideHeight / 2 - touchY; 11068 imageWidth = gesture.$imageEl[0].offsetWidth; 11069 imageHeight = gesture.$imageEl[0].offsetHeight; 11070 scaledWidth = imageWidth * zoom.scale; 11071 scaledHeight = imageHeight * zoom.scale; 11072 translateMinX = Math.min(slideWidth / 2 - scaledWidth / 2, 0); 11073 translateMinY = Math.min(slideHeight / 2 - scaledHeight / 2, 0); 11074 translateMaxX = -translateMinX; 11075 translateMaxY = -translateMinY; 11076 translateX = diffX * zoom.scale; 11077 translateY = diffY * zoom.scale; 11078 if (translateX < translateMinX) translateX = translateMinX; 11079 if (translateX > translateMaxX) translateX = translateMaxX; 11080 if (translateY < translateMinY) translateY = translateMinY; 11081 if (translateY > translateMaxY) translateY = translateMaxY; 11082 } else { 11083 translateX = 0; 11084 translateY = 0; 11085 } 11086 gesture.$imageWrapEl.transition(300).transform(`translate3d(${translateX}px, ${translateY}px,0)`); 11087 gesture.$imageEl.transition(300).transform(`translate3d(0,
110870,0) scale(${zoom.scale})`); 11088 } 11089 function zoomOut() { 11090 const zoom = swiper.zoom; 11091 const params = swiper.params.zoom; 11092 if (!gesture.$slideEl) { 11093 if (swiper.params.virtual && swiper.params.virtual.enabled && swiper.virtual) gesture.$slideEl = swiper.$wrapperEl.children(`.${swiper.params.slideActiveClass}`); 11094 else gesture.$slideEl = swiper.slides.eq(swiper.activeIndex); 11095 gesture.$imageEl = gesture.$slideEl.find(`.${params.containerClass}`).eq(0).find('picture, img, svg, canvas, .swiper-zoom-target').eq(0); 11096 gesture.$imageWrapEl = gesture.$imageEl.parent(`.${params.containerClass}`); 11097 } 11098 if (!gesture.$imageEl || gesture.$imageEl.length === 0 || !gesture.$imageWrapEl || gesture.$imageWrapEl.length === 0) return; 11099 if (swiper.params.cssMode) { 11100 swiper.wrapperEl.style.overflow = ''; 11101 swiper.wrapperEl.style.touchAction = ''; 11102 } 11103 zoom.scale = 1; 11104 currentScale = 1; 11105 gesture.$imageWrapEl.transition(300).transform('translate3d(0,0,0)'); 11106 gesture.$imageEl.transition(300).transform('translate3d(0,0,0) scale(1)'); 11107 gesture.$slideEl.removeClass(`${params.zoomedSlideClass}`); 11108 gesture.$slideEl = undefined; 11109 } // Toggle Zoom 11110 function zoomToggle(e) { 11111 const zoom = swiper.zoom; 11112 if (zoom.scale && zoom.scale !== 1) // Zoom Out 11113 zoomOut(); 11114 else // Zoom In 11115 zoomIn(e); 11116 } 11117 function getListeners() { 11118 const support = swiper.support; 11119 const passiveListener = swiper.touchEvents.start === 'touchstart' && support.passiveListener && swiper.params.passiveListeners ? { 11120 passive: true, 11121 capture: false 11122 } : false; 11123 const activeListenerWithCapture = support.passiveListener ? { 11124 passive: false, 11125 capture: true 11126 } : true; 11127 return { 11128 passiveListener, 11129 activeListenerWithCapture 11130 }; 11131 } 11132 function getSlideSelector() { 11133 return `.${swiper.params.slideClass}`; 11134 } 11135 function toggleGestures(method) { 11136 const { passiveListener } = getListeners(); 11137 const slideSelector = getSlideSelector(); 11138 swiper.$wrapperEl[method]('gesturestart', slideSelector, onGestureStart, passiveListener); 11139 swiper.$wrapperEl[method]('gesturechange', slideSelector, onGestureChange, passiveListener); 11140 swiper.$wrapperEl[method]('gestureend', slideSelector, onGestureEnd, passiveListener); 11141 } 11142 function enableGestures() { 11143 if (gesturesEnabled) return; 11144 gesturesEnabled = true; 11145 toggleGestures('on'); 11146 } 11147 function disableGestures() { 11148 if (!gesturesEnabled) return; 11149 gesturesEnabled = false; 11150 toggleGestures('off'); 11151 } // Attach/Detach Events 11152 function enable() { 11153 const zoom = swiper.zoom; 11154 if (zoom.enabled) return; 11155 zoom.enabled = true; 11156 const support = swiper.support; 11157 const { passiveListener, activeListenerWithCapture } = getListeners(); 11158 const slideSelector = getSlideSelector(); // Scale image 11159 if (support.gestures) { 11160 swiper.$wrapperEl.on(swiper.touchEvents.start, enableGestures, passiveListener); 11161 swiper.$wrapperEl.on(swiper.touchEvents.end, disableGestures, passiveListener); 11162 } else if (swiper.touchEvents.start === 'touchstart') { 11163 swiper.$wrapperEl.on(swiper.touchEvents.start, slideSelector, onGestureStart, passiveListener); 11164 swiper.$wrapperEl.on(swiper.touchEvents.move, slideSelector, onGestureChange, activeListenerWithCapture); 11165 swiper.$wrapperEl.on(swiper.touchEvents.end, slideSelector, onGestureEnd, passiveListener); 11166 if (swiper.touchEvents.cancel) swiper.$wrapperEl.on(swiper.touchEvents.cancel, slideSelector, onGestureEnd, passiveListener); 11167 } // Move image 11168 swiper.$wrapperEl.on(swiper.touchEvents.move, `.${swiper.params.zoom.containerClass}`, onTouchMove, activeListenerWithCapture); 11169 } 11170 function disable() { 11171 const zoom = swiper.zoom; 11172 if (!zoom.enabled) return; 11173 const support = swiper.support; 11174 zoom.enabled = false;
11175 const { passiveListener, activeListenerWithCapture } = getListeners(); 11176 const slideSelector = getSlideSelector(); // Scale image 11177 if (support.gestures) { 11178 swiper.$wrapperEl.off(swiper.touchEvents.start, enableGestures, passiveListener); 11179 swiper.$wrapperEl.off(swiper.touchEvents.end, disableGestures, passiveListener); 11180 } else if (swiper.touchEvents.start === 'touchstart') { 11181 swiper.$wrapperEl.off(swiper.touchEvents.start, slideSelector, onGestureStart, passiveListener); 11182 swiper.$wrapperEl.off(swiper.touchEvents.move, slideSelector, onGestureChange, activeListenerWithCapture); 11183 swiper.$wrapperEl.off(swiper.touchEvents.end, slideSelector, onGestureEnd, passiveListener); 11184 if (swiper.touchEvents.cancel) swiper.$wrapperEl.off(swiper.touchEvents.cancel, slideSelector, onGestureEnd, passiveListener); 11185 } // Move image 11186 swiper.$wrapperEl.off(swiper.touchEvents.move, `.${swiper.params.zoom.containerClass}`, onTouchMove, activeListenerWithCapture); 11187 } 11188 on('init', ()=>{ 11189 if (swiper.params.zoom.enabled) enable(); 11190 }); 11191 on('destroy', ()=>{ 11192 disable(); 11193 }); 11194 on('touchStart', (_s, e)=>{ 11195 if (!swiper.zoom.enabled) return; 11196 onTouchStart(e); 11197 }); 11198 on('touchEnd', (_s, e)=>{ 11199 if (!swiper.zoom.enabled) return; 11200 onTouchEnd(); 11201 }); 11202 on('doubleTap', (_s, e)=>{ 11203 if (!swiper.animating && swiper.params.zoom.enabled && swiper.zoom.enabled && swiper.params.zoom.toggle) zoomToggle(e); 11204 }); 11205 on('transitionEnd', ()=>{ 11206 if (swiper.zoom.enabled && swiper.params.zoom.enabled) onTransitionEnd(); 11207 }); 11208 on('slideChange', ()=>{ 11209 if (swiper.zoom.enabled && swiper.params.zoom.enabled && swiper.params.cssMode) onTransitionEnd(); 11210 }); 11211 Object.assign(swiper.zoom, { 11212 enable, 11213 disable, 11214 in: zoomIn, 11215 out: zoomOut, 11216 toggle: zoomToggle 11217 }); 11218 } 11219 function Lazy(_ref) { 11220 let { swiper, extendParams, on, emit } = _ref; 11221 extendParams({ 11222 lazy: { 11223 checkInView: false, 11224 enabled: false, 11225 loadPrevNext: false, 11226 loadPrevNextAmount: 1, 11227 loadOnTransitionStart: false, 11228 scrollingElement: '', 11229 elementClass: 'swiper-lazy', 11230 loadingClass: 'swiper-lazy-loading', 11231 loadedClass: 'swiper-lazy-loaded', 11232 preloaderClass: 'swiper-lazy-preloader' 11233 } 11234 }); 11235 swiper.lazy = {}; 11236 let scrollHandlerAttached = false; 11237 let initialImageLoaded = false; 11238 function loadInSlide(index, loadInDuplicate) { 11239 if (loadInDuplicate === void 0) loadInDuplicate = true; 11240 const params = swiper.params.lazy; 11241 if (typeof index === 'undefined') return; 11242 if (swiper.slides.length === 0) return; 11243 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 11244 const $slideEl = isVirtual ? swiper.$wrapperEl.children(`.${swiper.params.slideClass}[data-swiper-slide-index="${index}"]`) : swiper.slides.eq(index); 11245 const $images = $slideEl.find(`.${params.elementClass}:not(.${params.loadedClass}):not(.${params.loadingClass})`); 11246 if ($slideEl.hasClass(params.elementClass) && !$slideEl.hasClass(params.loadedClass) && !$slideEl.hasClass(params.loadingClass)) $images.push($slideEl[0]); 11247 if ($images.length === 0) return; 11248 $images.each((imageEl)=>{ 11249 const $imageEl = $(imageEl); 11250 $imageEl.addClass(params.loadingClass); 11251 const background = $imageEl.attr('data-background'); 11252 const src = $imageEl.attr('data-src'); 11253 const srcset = $imageEl.attr('data-srcset'); 11254 const sizes = $imageEl.attr('data-sizes'); 11255 const $pictureEl = $imageEl.parent('picture'); 11256 swiper.loadImage($imageEl[0], src || background, srcset, sizes, false, ()=>{ 11257 if (typeof swiper === 'undefined' || swiper === null || !swiper || swiper && !swiper.params || swiper.destroyed) return; 11258 if (background) { 11259 $imageEl.css('background-image', `url("${background}")`); 11260 $imageEl.removeAttr('data-background'); 11261 } else { 11262 if (srcset) { 11263 $imageEl.attr('srcset', srcset); 11264 $imageEl.removeAttr('data-srcset'); 11265 } 11266 if (sizes) { 11267 $imageEl.attr('sizes', sizes); 11268 $imageEl.removeAttr('data-sizes'); 11269 } 11270 if ($pictureEl.length) $pictureEl.children('source').each((sourceEl)=>{ 11271 const $source = $(sourceEl); 11272 if ($source.attr('data-srcset')) { 11273 $source.attr('srcset', $source.attr('data-srcset')); 11274 $source.removeAttr('data-srcset'); 11275 } 11276 }); 11277 if (src) { 11278 $imageEl.attr('src', src); 11279 $imageEl.removeAttr('data-src'); 11280 } 11281 } 11282 $imageEl.addClass(params.loadedClass).removeClass(params.loadingClass); 11283 $slideEl.find(`.${params.preloaderClass}`).remove();
11284 if (swiper.params.loop && loadInDuplicate) { 11285 const slideOriginalIndex = $slideEl.attr('data-swiper-slide-index'); 11286 if ($slideEl.hasClass(swiper.params.slideDuplicateClass)) { 11287 const originalSlide = swiper.$wrapperEl.children(`[data-swiper-slide-index="${slideOriginalIndex}"]:not(.${swiper.params.slideDuplicateClass})`); 11288 loadInSlide(originalSlide.index(), false); 11289 } else { 11290 const duplicatedSlide = swiper.$wrapperEl.children(`.${swiper.params.slideDuplicateClass}[data-swiper-slide-index="${slideOriginalIndex}"]`); 11291 loadInSlide(duplicatedSlide.index(), false); 11292 } 11293 } 11294 emit('lazyImageReady', $slideEl[0], $imageEl[0]); 11295 if (swiper.params.autoHeight) swiper.updateAutoHeight(); 11296 }); 11297 emit('lazyImageLoad', $slideEl[0], $imageEl[0]); 11298 }); 11299 } 11300 function load() { 11301 const { $wrapperEl, params: swiperParams, slides, activeIndex } = swiper; 11302 const isVirtual = swiper.virtual && swiperParams.virtual.enabled; 11303 const params = swiperParams.lazy; 11304 let slidesPerView = swiperParams.slidesPerView; 11305 if (slidesPerView === 'auto') slidesPerView = 0; 11306 function slideExist(index) { 11307 if (isVirtual) { 11308 if ($wrapperEl.children(`.${swiperParams.slideClass}[data-swiper-slide-index="${index}"]`).length) return true; 11309 } else if (slides[index]) return true; 11310 return false; 11311 } 11312 function slideIndex(slideEl) { 11313 if (isVirtual) return $(slideEl).attr('data-swiper-slide-index'); 11314 return $(slideEl).index(); 11315 } 11316 if (!initialImageLoaded) initialImageLoaded = true; 11317 if (swiper.params.watchSlidesProgress) $wrapperEl.children(`.${swiperParams.slideVisibleClass}`).each((slideEl)=>{ 11318 const index = isVirtual ? $(slideEl).attr('data-swiper-slide-index') : $(slideEl).index(); 11319 loadInSlide(index); 11320 }); 11321 else if (slidesPerView > 1) { 11322 for(let i = activeIndex; i < activeIndex + slidesPerView; i += 1)if (slideExist(i)) loadInSlide(i); 11323 } else loadInSlide(activeIndex); 11324 if (params.loadPrevNext) { 11325 if (slidesPerView > 1 || params.loadPrevNextAmount && params.loadPrevNextAmount > 1) { 11326 const amount = params.loadPrevNextAmount; 11327 const spv = Math.ceil(slidesPerView); 11328 const maxIndex = Math.min(activeIndex + spv + Math.max(amount, spv), slides.length); 11329 const minIndex = Math.max(activeIndex - Math.max(spv, amount), 0); // Next Slides 11330 for(let i = activeIndex + spv; i < maxIndex; i += 1)if (slideExist(i)) loadInSlide(i); 11331 // Prev Slides 11332 for(let i = minIndex; i < activeIndex; i += 1)if (slideExist(i)) loadInSlide(i); 11333 } else { 11334 const nextSlide = $wrapperEl.children(`.${swiperParams.slideNextClass}`); 11335 if (nextSlide.length > 0) loadInSlide(slideIndex(nextSlide)); 11336 const prevSlide = $wrapperEl.children(`.${swiperParams.slidePrevClass}`); 11337 if (prevSlide.length > 0) loadInSlide(slideIndex(prevSlide)); 11338 } 11339 } 11340 } 11341 function checkInViewOnLoad() { 11342 const window1 = getWindow(); 11343 if (!swiper || swiper.destroyed) return; 11344 const $scrollElement = swiper.params.lazy.scrollingElement ? $(swiper.params.lazy.scrollingElement) : $(window1); 11345 const isWindow = $scrollElement[0] === window1; 11346 const scrollElementWidth = isWindow ? window1.innerWidth : $scrollElement[0].offsetWidth; 11347 const scrollElementHeight = isWindow ? window1.innerHeight : $scrollElement[0].offsetHeight; 11348 const swiperOffset = swiper.$el.offset(); 11349 const { rtlTranslate: rtl } = swiper; 11350 let inView = false;
11351 if (rtl) swiperOffset.left -= swiper.$el[0].scrollLeft; 11352 const swiperCoord = [ 11353 [ 11354 swiperOffset.left, 11355 swiperOffset.top 11356 ], 11357 [ 11358 swiperOffset.left + swiper.width, 11359 swiperOffset.top 11360 ], 11361 [ 11362 swiperOffset.left, 11363 swiperOffset.top + swiper.height 11364 ], 11365 [ 11366 swiperOffset.left + swiper.width, 11367 swiperOffset.top + swiper.height 11368 ] 11369 ]; 11370 for(let i = 0; i < swiperCoord.length; i += 1){ 11371 const point = swiperCoord[i]; 11372 if (point[0] >= 0 && point[0] <= scrollElementWidth && point[1] >= 0 && point[1] <= scrollElementHeight) { 11373 if (point[0] === 0 && point[1] === 0) continue; // eslint-disable-line 11374 inView = true; 11375 } 11376 } 11377 const passiveListener = swiper.touchEvents.start === 'touchstart' && swiper.support.passiveListener && swiper.params.passiveListeners ? { 11378 passive: true, 11379 capture: false 11380 } : false; 11381 if (inView) { 11382 load(); 11383 $scrollElement.off('scroll', checkInViewOnLoad, passiveListener); 11384 } else if (!scrollHandlerAttached) { 11385 scrollHandlerAttached = true; 11386 $scrollElement.on('scroll', checkInViewOnLoad, passiveListener); 11387 } 11388 } 11389 on('beforeInit', ()=>{ 11390 if (swiper.params.lazy.enabled && swiper.params.preloadImages) swiper.params.preloadImages = false; 11391 }); 11392 on('init', ()=>{ 11393 if (swiper.params.lazy.enabled) { 11394 if (swiper.params.lazy.checkInView) checkInViewOnLoad(); 11395 else load(); 11396 } 11397 }); 11398 on('scroll', ()=>{ 11399 if (swiper.params.freeMode && swiper.params.freeMode.enabled && !swiper.params.freeMode.sticky) load(); 11400 }); 11401 on('scrollbarDragMove resize _freeModeNoMomentumRelease', ()=>{ 11402 if (swiper.params.lazy.enabled) { 11403 if (swiper.params.lazy.checkInView) checkInViewOnLoad(); 11404 else load(); 11405 } 11406 }); 11407 on('transitionStart', ()=>{ 11408 if (swiper.params.lazy.enabled) { 11409 if (swiper.params.lazy.loadOnTransitionStart || !swiper.params.lazy.loadOnTransitionStart && !initialImageLoaded) { 11410 if (swiper.params.lazy.checkInView) checkInViewOnLoad(); 11411 else load(); 11412 } 11413 } 11414 }); 11415 on('transitionEnd', ()=>{ 11416 if (swiper.params.lazy.enabled && !swiper.params.lazy.loadOnTransitionStart) { 11417 if (swiper.params.lazy.checkInView) checkInViewOnLoad(); 11418 else load(); 11419 } 11420 }); 11421 on('slideChange', ()=>{ 11422 const { lazy, cssMode, watchSlidesProgress, touchReleaseOnEdges, resistanceRatio } = swiper.params; 11423 if (lazy.enabled && (cssMode || watchSlidesProgress && (touchReleaseOnEdges || resistanceRatio === 0))) load(); 11424 }); 11425 on('destroy', ()=>{ 11426 if (!swiper.$el) return; 11427 swiper.$el.find(`.${swiper.params.lazy.loadingClass}`).removeClass(swiper.params.lazy.loadingClass); 11428 }); 11429 Object.assign(swiper.lazy, { 11430 load, 11431 loadInSlide 11432 }); 11433 } 11434 /* eslint no-bitwise: ["error", { "allow": [">>"] }] */ function Controller(_ref) { 11435 let { swiper, extendParams, on } = _ref; 11436 extendParams({ 11437 controller: { 11438 control: undefined, 11439 inverse: false, 11440 by: 'slide' // or 'container' 11441 } 11442 }); 11443 swiper.controller = { 11444 control: undefined 11445 }; 11446 function LinearSpline(x, y) { 11447 const binarySearch = function search() { 11448 let maxIndex; 11449 let minIndex; 11450 let guess; 11451 return (array, val)=>{ 11452 minIndex = -1; 11453 maxIndex = array.length; 11454 while(maxIndex - minIndex > 1){
11455 guess = maxIndex + minIndex >> 1; 11456 if (array[guess] <= val) minIndex = guess; 11457 else maxIndex = guess; 11458 } 11459 return maxIndex; 11460 }; 11461 }(); 11462 this.x = x; 11463 this.y = y; 11464 this.lastIndex = x.length - 1; // Given an x value (x2), return the expected y2 value: 11465 // (x1,y1) is the known point before given value, 11466 // (x3,y3) is the known point after given value. 11467 let i1; 11468 let i3; 11469 this.interpolate = function interpolate(x2) { 11470 if (!x2) return 0; // Get the indexes of x1 and x3 (the array indexes before and after given x2): 11471 i3 = binarySearch(this.x, x2); 11472 i1 = i3 - 1; // We have our indexes i1 & i3, so we can calculate already: 11473 // y2 := ((x2âx1) à (y3ây1)) ÷ (x3âx1) + y1 11474 return (x2 - this.x[i1]) * (this.y[i3] - this.y[i1]) / (this.x[i3] - this.x[i1]) + this.y[i1]; 11475 }; 11476 return this; 11477 } // xxx: for now i will just save one spline function to to 11478 function getInterpolateFunction(c) { 11479 if (!swiper.controller.spline) swiper.controller.spline = swiper.params.loop ? new LinearSpline(swiper.slidesGrid, c.slidesGrid) : new LinearSpline(swiper.snapGrid, c.snapGrid); 11480 } 11481 function setTranslate(_t, byController) { 11482 const controlled = swiper.controller.control; 11483 let multiplier; 11484 let controlledTranslate; 11485 const Swiper = swiper.constructor; 11486 function setControlledTranslate(c) { 11487 // this will create an Interpolate function based on the snapGrids 11488 // x is the Grid of the scrolled scroller and y will be the controlled scroller 11489 // it makes sense to create this only once and recall it for the interpolation 11490 // the function does a lot of value caching for performance 11491 const translate = swiper.rtlTranslate ? -swiper.translate : swiper.translate; 11492 if (swiper.params.controller.by === 'slide') { 11493 getInterpolateFunction(c); // i am not sure why the values have to be multiplicated this way, tried to invert the snapGrid 11494 // but it did not work out 11495 controlledTranslate = -swiper.controller.spline.interpolate(-translate); 11496 } 11497 if (!controlledTranslate || swiper.params.controller.by === 'container') { 11498 multiplier = (c.maxTranslate() - c.minTranslate()) / (swiper.maxTranslate() - swiper.minTranslate()); 11499 controlledTranslate = (translate - swiper.minTranslate()) * multiplier + c.minTranslate(); 11500 } 11501 if (swiper.params.controller.inverse) controlledTranslate = c.maxTranslate() - controlledTranslate; 11502 c.updateProgress(controlledTranslate); 11503 c.setTranslate(controlledTranslate, swiper); 11504 c.updateActiveIndex(); 11505 c.updateSlidesClasses(); 11506 } 11507 if (Array.isArray(controlled)) { 11508 for(let i = 0; i < controlled.length; i += 1)if (controlled[i] !== byController && controlled[i] instanceof Swiper) setControlledTranslate(controlled[i]); 11509 } else if (controlled instanceof Swiper && byController !== controlled) setControlledTranslate(controlled); 11510 } 11511 function setTransition(duration, byController) { 11512 const Swiper = swiper.constructor; 11513 const controlled = swiper.controller.control; 11514 let i; 11515 function setControlledTransition(c) { 11516 c.setTransition(duration, swiper); 11517 if (duration !== 0) { 11518 c.transitionStart(); 11519 if (c.params.autoHeight) nextTick(()=>{ 11520 c.updateAutoHeight(); 11521 }); 11522 c.$wrapperEl.transitionEnd(()=>{ 11523 if (!controlled) return; 11524 if (c.params.loop && swiper.params.controller.by === 'slide') c.loopFix(); 11525 c.transitionEnd(); 11526 }); 11527 } 11528 } 11529 if (Array.isArray(controlled)) { 11530 for(i = 0; i < controlled.length; i += 1)if (controlled[i] !== byController && controlled[i] instanceof Swiper) setControlledTransition(controlled[i]); 11531 } else if (controlled instanceof Swiper && byController !== controlled) setControlledTransition(controlled); 11532 } 11533 function removeSpline() { 11534 if (!swiper.controller.control) return; 11535 if (swiper.controller.spline) { 11536 swiper.controller.spline = undefined; 11537 delete swiper.controller.spline; 11538 } 11539 } 11540 on('beforeInit', ()=>{ 11541 swiper.controller.control = swiper.params.controller.control; 11542 }); 11543 on('update', ()=>{ 11544 removeSpline(); 11545 }); 11546 on('resize', ()=>{ 11547 removeSpline(); 11548 }); 11549 on('observerUpdate', ()=>{ 11550 removeSpline(); 11551 }); 11552 on('setTranslate', (_s, translate, byController)=>{ 11553 if (!swiper.controller.control) return; 11554 swiper.controller.setTranslate(translate, byController); 11555 }); 11556 on('setTransition', (_s, duration, byController)=>{ 11557 if (!swiper.controller.control) return; 11558 swiper.controller.setTransition(duration, byController); 11559 }); 11560 Object.assign(swiper.controller, { 11561 setTranslate, 11562 setTransition 11563 }); 11564 } 11565 function A11y(_ref) { 11566 let { swiper, extendParams, on } = _ref; 11567 extendParams({ 11568 a11y: { 11569 enabled: true, 11570 notificationClass: 'swiper-notification', 11571 prevSlideMessage: 'Previous slide', 11572 nextSlideMessage: 'Next slide', 11573 firstSlideMessage: 'This is the first slide', 11574 lastSlideMessage: 'This is the last slide', 11575 paginationBulletMessage: 'Go to slide {{index}}', 11576 slideLabelMessage: '{{index}} / {{slidesLength}}', 11577 containerMessage: null, 11578 containerRoleDescriptionMessage: null, 11579 itemRoleDescriptionMessage: null, 11580 slideRole: 'group', 11581 id: null 11582 } 11583 }); 11584 swiper.a11y = {
11585 clicked: false 11586 }; 11587 let liveRegion = null; 11588 function notify(message) { 11589 const notification = liveRegion; 11590 if (notification.length === 0) return; 11591 notification.html(''); 11592 notification.html(message); 11593 } 11594 function getRandomNumber(size) { 11595 if (size === void 0) size = 16; 11596 const randomChar = ()=>Math.round(16 * Math.random()).toString(16); 11597 return 'x'.repeat(size).replace(/x/g, randomChar); 11598 } 11599 function makeElFocusable($el) { 11600 $el.attr('tabIndex', '0'); 11601 } 11602 function makeElNotFocusable($el) { 11603 $el.attr('tabIndex', '-1'); 11604 } 11605 function addElRole($el, role) { 11606 $el.attr('role', role); 11607 } 11608 function addElRoleDescription($el, description) { 11609 $el.attr('aria-roledescription', description); 11610 } 11611 function addElControls($el, controls) { 11612 $el.attr('aria-controls', controls); 11613 } 11614 function addElLabel($el, label) { 11615 $el.attr('aria-label', label); 11616 } 11617 function addElId($el, id) { 11618 $el.attr('id', id); 11619 } 11620 function addElLive($el, live) { 11621 $el.attr('aria-live', live); 11622 } 11623 function disableEl($el) { 11624 $el.attr('aria-disabled', true); 11625 } 11626 function enableEl($el) { 11627 $el.attr('aria-disabled', false); 11628 } 11629 function onEnterOrSpaceKey(e) { 11630 if (e.keyCode !== 13 && e.keyCode !== 32) return; 11631 const params = swiper.params.a11y; 11632 const $targetEl = $(e.target); 11633 if (swiper.navigation && swiper.navigation.$nextEl && $targetEl.is(swiper.navigation.$nextEl)) { 11634 if (!(swiper.isEnd && !swiper.params.loop)) swiper.slideNext(); 11635 if (swiper.isEnd) notify(params.lastSlideMessage); 11636 else notify(params.nextSlideMessage); 11637 } 11638 if (swiper.navigation && swiper.navigation.$prevEl && $targetEl.is(swiper.navigation.$prevEl)) { 11639 if (!(swiper.isBeginning && !swiper.params.loop)) swiper.slidePrev(); 11640 if (swiper.isBeginning) notify(params.firstSlideMessage); 11641 else notify(params.prevSlideMessage); 11642 } 11643 if (swiper.pagination && $targetEl.is(classesToSelector(swiper.params.pagination.bulletClass))) $targetEl[0].click(); 11644 } 11645 function updateNavigation() { 11646 if (swiper.params.loop || swiper.params.rewind || !swiper.navigation) return; 11647 const { $nextEl, $prevEl } = swiper.navigation; 11648 if ($prevEl && $prevEl.length > 0) { 11649 if (swiper.isBeginning) { 11650 disableEl($prevEl); 11651 makeElNotFocusable($prevEl); 11652 } else { 11653 enableEl($prevEl); 11654 makeElFocusable($prevEl); 11655 } 11656 } 11657 if ($nextEl && $nextEl.length > 0) { 11658 if (swiper.isEnd) { 11659 disableEl($nextEl); 11660 makeElNotFocusable($nextEl); 11661 } else { 11662 enableEl($nextEl); 11663 makeElFocusable($nextEl); 11664 } 11665 } 11666 } 11667 function hasPagination() { 11668 return swiper.pagination && swiper.pagination.bullets && swiper.pagination.bullets.length; 11669 } 11670 function hasClickablePagination() { 11671 return hasPagination() && swiper.params.pagination.clickable; 11672 } 11673 function updatePagination() { 11674 const params = swiper.params.a11y; 11675 if (!hasPagination()) return; 11676 swiper.pagination.bullets.each((bulletEl)=>{ 11677 const $bulletEl = $(bulletEl); 11678 if (swiper.params.pagination.clickable) { 11679 makeElFocusable($bulletEl); 11680 if (!swiper.params.pagination.renderBullet) { 11681 addElRole($bulletEl, 'button'); 11682 addElLabel($bulletEl, params.paginationBulletMessage.replace(/\{\{index\}\}/, $bulletEl.index() + 1)); 11683 } 11684 } 11685 if ($bulletEl.is(`.${swiper.params.pagination.bulletActiveClass}`)) $bulletEl.attr('aria-current', 'true'); 11686 else $bulletEl.removeAttr('aria-current'); 11687 }); 11688 } 11689 const initNavEl = ($el, wrapperId, message)=>{ 11690 makeElFocusable($el); 11691 if ($el[0].tagName !== 'BUTTON') { 11692 addElRole($el, 'button'); 11693 $el.on('keydown', onEnterOrSpaceKey); 11694 } 11695 addElLabel($el, message); 11696 addElControls($el, wrapperId); 11697 }; 11698 const handlePointerDown = ()=>{ 11699 swiper.a11y.clicked = true; 11700 }; 11701 const handlePointerUp = ()=>{ 11702 requestAnimationFrame(()=>{ 11703 requestAnimationFrame(()=>{ 11704 if (!swiper.destroyed) swiper.a11y.clicked = false;
11705 }); 11706 }); 11707 }; 11708 const handleFocus = (e)=>{ 11709 if (swiper.a11y.clicked) return; 11710 const slideEl = e.target.closest(`.${swiper.params.slideClass}`); 11711 if (!slideEl || !swiper.slides.includes(slideEl)) return; 11712 const isActive = swiper.slides.indexOf(slideEl) === swiper.activeIndex; 11713 const isVisible = swiper.params.watchSlidesProgress && swiper.visibleSlides && swiper.visibleSlides.includes(slideEl); 11714 if (isActive || isVisible) return; 11715 if (e.sourceCapabilities && e.sourceCapabilities.firesTouchEvents) return; 11716 if (swiper.isHorizontal()) swiper.el.scrollLeft = 0; 11717 else swiper.el.scrollTop = 0; 11718 swiper.slideTo(swiper.slides.indexOf(slideEl), 0); 11719 }; 11720 const initSlides = ()=>{ 11721 const params = swiper.params.a11y; 11722 if (params.itemRoleDescriptionMessage) addElRoleDescription($(swiper.slides), params.itemRoleDescriptionMessage); 11723 if (params.slideRole) addElRole($(swiper.slides), params.slideRole); 11724 const slidesLength = swiper.params.loop ? swiper.slides.filter((el)=>!el.classList.contains(swiper.params.slideDuplicateClass)).length : swiper.slides.length; 11725 if (params.slideLabelMessage) swiper.slides.each((slideEl, index)=>{ 11726 const $slideEl = $(slideEl); 11727 const slideIndex = swiper.params.loop ? parseInt($slideEl.attr('data-swiper-slide-index'), 10) : index; 11728 const ariaLabelMessage = params.slideLabelMessage.replace(/\{\{index\}\}/, slideIndex + 1).replace(/\{\{slidesLength\}\}/, slidesLength); 11729 addElLabel($slideEl, ariaLabelMessage); 11730 }); 11731 }; 11732 const init = ()=>{ 11733 const params = swiper.params.a11y; 11734 swiper.$el.append(liveRegion); // Container 11735 const $containerEl = swiper.$el; 11736 if (params.containerRoleDescriptionMessage) addElRoleDescription($containerEl, params.containerRoleDescriptionMessage); 11737 if (params.containerMessage) addElLabel($containerEl, params.containerMessage); 11738 // Wrapper 11739 const $wrapperEl = swiper.$wrapperEl; 11740 const wrapperId = params.id || $wrapperEl.attr('id') || `swiper-wrapper-${getRandomNumber(16)}`; 11741 const live = swiper.params.autoplay && swiper.params.autoplay.enabled ? 'off' : 'polite'; 11742 addElId($wrapperEl, wrapperId); 11743 addElLive($wrapperEl, live); // Slide 11744 initSlides(); // Navigation 11745 let $nextEl; 11746 let $prevEl; 11747 if (swiper.navigation && swiper.navigation.$nextEl) $nextEl = swiper.navigation.$nextEl; 11748 if (swiper.navigation && swiper.navigation.$prevEl) $prevEl = swiper.navigation.$prevEl; 11749 if ($nextEl && $nextEl.length) initNavEl($nextEl, wrapperId, params.nextSlideMessage); 11750 if ($prevEl && $prevEl.length) initNavEl($prevEl, wrapperId, params.prevSlideMessage); 11751 // Pagination 11752 if (hasClickablePagination()) swiper.pagination.$el.on('keydown', classesToSelector(swiper.params.pagination.bulletClass), onEnterOrSpaceKey); 11753 // Tab focus 11754 swiper.$el.on('focus', handleFocus, true); 11755 swiper.$el.on('pointerdown', handlePointerDown, true); 11756 swiper.$el.on('pointerup', handlePointerUp, true); 11757 }; 11758 function destroy() { 11759 if (liveRegion && liveRegion.length > 0) liveRegion.remove(); 11760 let $nextEl; 11761 let $prevEl; 11762 if (swiper.navigation && swiper.navigation.$nextEl) $nextEl = swiper.navigation.$nextEl; 11763 if (swiper.navigation && swiper.navigation.$prevEl) $prevEl = swiper.navigation.$prevEl; 11764 if ($nextEl) $nextEl.off('keydown', onEnterOrSpaceKey); 11765 if ($prevEl) $prevEl.off('keydown', onEnterOrSpaceKey); 11766 // Pagination 11767 if (hasClickablePagination()) swiper.pagination.$el.off('keydown', classesToSelector(swiper.params.pagination.bulletClass), onEnterOrSpaceKey); 11768 // Tab focus 11769 swiper.$el.off('focus', handleFocus, true); 11770 swiper.$el.off('pointerdown', handlePointerDown, true); 11771 swiper.$el.off('pointerup', handlePointerUp, true); 11772 } 11773 on('beforeInit', ()=>{ 11774 liveRegion = $(`<span class="${swiper.params.a11y.notificationClass}
11774" aria-live="assertive" aria-atomic="true"></span>`); 11775 }); 11776 on('afterInit', ()=>{ 11777 if (!swiper.params.a11y.enabled) return; 11778 init(); 11779 }); 11780 on('slidesLengthChange snapGridLengthChange slidesGridLengthChange', ()=>{ 11781 if (!swiper.params.a11y.enabled) return; 11782 initSlides(); 11783 }); 11784 on('fromEdge toEdge afterInit lock unlock', ()=>{ 11785 if (!swiper.params.a11y.enabled) return; 11786 updateNavigation(); 11787 }); 11788 on('paginationUpdate', ()=>{ 11789 if (!swiper.params.a11y.enabled) return; 11790 updatePagination(); 11791 }); 11792 on('destroy', ()=>{ 11793 if (!swiper.params.a11y.enabled) return; 11794 destroy(); 11795 }); 11796 } 11797 function History(_ref) { 11798 let { swiper, extendParams, on } = _ref; 11799 extendParams({ 11800 history: { 11801 enabled: false, 11802 root: '', 11803 replaceState: false, 11804 key: 'slides', 11805 keepQuery: false 11806 } 11807 }); 11808 let initialized = false; 11809 let paths = {}; 11810 const slugify = (text)=>{ 11811 return text.toString().replace(/\s+/g, '-').replace(/[^\w-]+/g, '').replace(/--+/g, '-').replace(/^-+/, '').replace(/-+$/, ''); 11812 }; 11813 const getPathValues = (urlOverride)=>{ 11814 const window1 = getWindow(); 11815 let location; 11816 if (urlOverride) location = new URL(urlOverride); 11817 else location = window1.location; 11818 const pathArray = location.pathname.slice(1).split('/').filter((part)=>part !== ''); 11819 const total = pathArray.length; 11820 const key = pathArray[total - 2]; 11821 const value = pathArray[total - 1]; 11822 return { 11823 key, 11824 value 11825 }; 11826 }; 11827 const setHistory = (key, index)=>{ 11828 const window1 = getWindow(); 11829 if (!initialized || !swiper.params.history.enabled) return; 11830 let location; 11831 if (swiper.params.url) location = new URL(swiper.params.url); 11832 else location = window1.location; 11833 const slide = swiper.slides.eq(index); 11834 let value = slugify(slide.attr('data-history')); 11835 if (swiper.params.history.root.length > 0) { 11836 let root = swiper.params.history.root; 11837 if (root[root.length - 1] === '/') root = root.slice(0, root.length - 1); 11838 value = `${root}/${key}/${value}`; 11839 } else if (!location.pathname.includes(key)) value = `${key}/${value}`; 11840 if (swiper.params.history.keepQuery) value += location.search; 11841 const currentState = window1.history.state; 11842 if (currentState && currentState.value === value) return; 11843 if (swiper.params.history.replaceState) window1.history.replaceState({ 11844 value 11845 }, null, value); 11846 else window1.history.pushState({ 11847 value 11848 }, null, value); 11849 }; 11850 const scrollToSlide = (speed, value, runCallbacks)=>{ 11851 if (value) for(let i = 0, length = swiper.slides.length; i < length; i += 1){ 11852 const slide = swiper.slides.eq(i); 11853 const slideHistory = slugify(slide.attr('data-history')); 11854 if (slideHistory === value && !slide.hasClass(swiper.params.slideDuplicateClass)) { 11855 const index = slide.index(); 11856 swiper.slideTo(index, speed, runCallbacks); 11857 } 11858 } 11859 else swiper.slideTo(0, speed, runCallbacks); 11860 }; 11861 const setHistoryPopState = ()=>{ 11862 paths = getPathValues(swiper.params.url); 11863 scrollToSlide(swiper.params.speed, paths.value, false); 11864 }; 11865 const init = ()=>{ 11866 const window1 = getWindow(); 11867 if (!swiper.params.history) return; 11868 if (!window1.history || !window1.history.pushState) { 11869 swiper.params.history.enabled = false; 11870 swiper.params.hashNavigation.enabled = true; 11871 return; 11872 } 11873 initialized = true; 11874 paths = getPathValues(swiper.params.url); 11875 if (!paths.key && !paths.value) return; 11876 scrollToSlide(0, paths.value, swiper.params.runCallbacksOnInit); 11877 if (!swiper.params.history.replaceState) window1.addEventListener('popstate', setHistoryPopState); 11878 }; 11879 const destroy = ()=>{ 11880 const window1 = getWindow(); 11881 if (!swiper.params.history.replaceState) window1.removeEventListener('popstate', setHistoryPopState); 11882 }; 11883 on('init', ()=>{ 11884 if (swiper.params.history.enabled) init(); 11885 }); 11886 on('destroy', ()=>{ 11887 if (swiper.params.history.enabled) destroy(); 11888 }); 11889 on('transitionEnd _freeModeNoMomentumRelease', ()=>{ 11890 if (initialized) setHistory(swiper.params.history.key, swiper.activeIndex); 11891 }); 11892 on('slideChange', ()=>{ 11893 if (initialized && swiper.params.cssMode) setHistory(swiper.params.history.key, swiper.activeIndex); 11894 }); 11895 } 11896 function HashNavigation(_ref) { 11897 let { swiper, extendParams, emit, on } = _ref; 11898 let initialized = false;
11899 const document1 = getDocument(); 11900 const window1 = getWindow(); 11901 extendParams({ 11902 hashNavigation: { 11903 enabled: false, 11904 replaceState: false, 11905 watchState: false 11906 } 11907 }); 11908 const onHashChange = ()=>{ 11909 emit('hashChange'); 11910 const newHash = document1.location.hash.replace('#', ''); 11911 const activeSlideHash = swiper.slides.eq(swiper.activeIndex).attr('data-hash'); 11912 if (newHash !== activeSlideHash) { 11913 const newIndex = swiper.$wrapperEl.children(`.${swiper.params.slideClass}[data-hash="${newHash}"]`).index(); 11914 if (typeof newIndex === 'undefined') return; 11915 swiper.slideTo(newIndex); 11916 } 11917 }; 11918 const setHash = ()=>{ 11919 if (!initialized || !swiper.params.hashNavigation.enabled) return; 11920 if (swiper.params.hashNavigation.replaceState && window1.history && window1.history.replaceState) { 11921 window1.history.replaceState(null, null, `#${swiper.slides.eq(swiper.activeIndex).attr('data-hash')}` || ''); 11922 emit('hashSet'); 11923 } else { 11924 const slide = swiper.slides.eq(swiper.activeIndex); 11925 const hash = slide.attr('data-hash') || slide.attr('data-history'); 11926 document1.location.hash = hash || ''; 11927 emit('hashSet'); 11928 } 11929 }; 11930 const init = ()=>{ 11931 if (!swiper.params.hashNavigation.enabled || swiper.params.history && swiper.params.history.enabled) return; 11932 initialized = true; 11933 const hash = document1.location.hash.replace('#', ''); 11934 if (hash) { 11935 const speed = 0; 11936 for(let i = 0, length = swiper.slides.length; i < length; i += 1){ 11937 const slide = swiper.slides.eq(i); 11938 const slideHash = slide.attr('data-hash') || slide.attr('data-history'); 11939 if (slideHash === hash && !slide.hasClass(swiper.params.slideDuplicateClass)) { 11940 const index = slide.index(); 11941 swiper.slideTo(index, speed, swiper.params.runCallbacksOnInit, true); 11942 } 11943 } 11944 } 11945 if (swiper.params.hashNavigation.watchState) $(window1).on('hashchange', onHashChange); 11946 }; 11947 const destroy = ()=>{ 11948 if (swiper.params.hashNavigation.watchState) $(window1).off('hashchange', onHashChange); 11949 }; 11950 on('init', ()=>{ 11951 if (swiper.params.hashNavigation.enabled) init(); 11952 }); 11953 on('destroy', ()=>{ 11954 if (swiper.params.hashNavigation.enabled) destroy(); 11955 }); 11956 on('transitionEnd _freeModeNoMomentumRelease', ()=>{ 11957 if (initialized) setHash(); 11958 }); 11959 on('slideChange', ()=>{ 11960 if (initialized && swiper.params.cssMode) setHash(); 11961 }); 11962 } 11963 /* eslint no-underscore-dangle: "off" */ function Autoplay(_ref) { 11964 let { swiper, extendParams, on, emit } = _ref; 11965 let timeout; 11966 swiper.autoplay = { 11967 running: false, 11968 paused: false 11969 }; 11970 extendParams({ 11971 autoplay: { 11972 enabled: false, 11973 delay: 3000, 11974 waitForTransition: true, 11975 disableOnInteraction: true, 11976 stopOnLastSlide: false, 11977 reverseDirection: false, 11978 pauseOnMouseEnter: false 11979 } 11980 }); 11981 function run() { 11982 if (!swiper.size) { 11983 swiper.autoplay.running = false; 11984 swiper.autoplay.paused = false; 11985 return; 11986 } 11987 const $activeSlideEl = swiper.slides.eq(swiper.activeIndex); 11988 let delay = swiper.params.autoplay.delay; 11989 if ($activeSlideEl.attr('data-swiper-autoplay')) delay = $activeSlideEl.attr('data-swiper-autoplay') || swiper.params.autoplay.delay; 11990 clearTimeout(timeout); 11991 timeout = nextTick(()=>{ 11992 let autoplayResult; 11993 if (swiper.params.autoplay.reverseDirection) { 11994 if (swiper.params.loop) { 11995 swiper.loopFix(); 11996 autoplayResult = swiper.slidePrev(swiper.params.speed, true, true); 11997 emit('autoplay'); 11998 } else if (!swiper.isBeginning) { 11999 autoplayResult = swiper.slidePrev(swiper.params.speed, true, true); 12000 emit('autoplay'); 12001 } else if (!swiper.params.autoplay.stopOnLastSlide) { 12002 autoplayResult = swiper.slideTo(swiper.slides.length - 1, swiper.params.speed, true, true); 12003 emit('autoplay'); 12004 } else stop(); 12005 } else if (swiper.params.loop) { 12006 swiper.loopFix(); 12007 autoplayResult = swiper.slideNext(swiper.params.speed, true, true); 12008 emit('autoplay'); 12009 } else if (!swiper.isEnd) { 12010 autoplayResult = swiper.slideNext(swiper.params.speed, true, true); 12011 emit('autoplay'); 12012 } else if (!swiper.params.autoplay.stopOnLastSlide) { 12013 autoplayResult = swiper.slideTo(0, swiper.params.speed, true, true); 12014 emit('autoplay'); 12015 } else stop(); 12016 if (swiper.params.cssMode && swiper.autoplay.running) run(); 12017 else if (autoplayResult === false) run(); 12018 }, delay); 12019 } 12020 function start() { 12021 if (typeof timeout !== 'undefined') return false;
12022 if (swiper.autoplay.running) return false; 12023 swiper.autoplay.running = true; 12024 emit('autoplayStart'); 12025 run(); 12026 return true; 12027 } 12028 function stop() { 12029 if (!swiper.autoplay.running) return false; 12030 if (typeof timeout === 'undefined') return false; 12031 if (timeout) { 12032 clearTimeout(timeout); 12033 timeout = undefined; 12034 } 12035 swiper.autoplay.running = false; 12036 emit('autoplayStop'); 12037 return true; 12038 } 12039 function pause(speed) { 12040 if (!swiper.autoplay.running) return; 12041 if (swiper.autoplay.paused) return; 12042 if (timeout) clearTimeout(timeout); 12043 swiper.autoplay.paused = true; 12044 if (speed === 0 || !swiper.params.autoplay.waitForTransition) { 12045 swiper.autoplay.paused = false; 12046 run(); 12047 } else [ 12048 'transitionend', 12049 'webkitTransitionEnd' 12050 ].forEach((event1)=>{ 12051 swiper.$wrapperEl[0].addEventListener(event1, onTransitionEnd); 12052 }); 12053 } 12054 function onVisibilityChange() { 12055 const document1 = getDocument(); 12056 if (document1.visibilityState === 'hidden' && swiper.autoplay.running) pause(); 12057 if (document1.visibilityState === 'visible' && swiper.autoplay.paused) { 12058 run(); 12059 swiper.autoplay.paused = false; 12060 } 12061 } 12062 function onTransitionEnd(e) { 12063 if (!swiper || swiper.destroyed || !swiper.$wrapperEl) return; 12064 if (e.target !== swiper.$wrapperEl[0]) return; 12065 [ 12066 'transitionend', 12067 'webkitTransitionEnd' 12068 ].forEach((event1)=>{ 12069 swiper.$wrapperEl[0].removeEventListener(event1, onTransitionEnd); 12070 }); 12071 swiper.autoplay.paused = false; 12072 if (!swiper.autoplay.running) stop(); 12073 else run(); 12074 } 12075 function onMouseEnter() { 12076 if (swiper.params.autoplay.disableOnInteraction) stop(); 12077 else { 12078 emit('autoplayPause'); 12079 pause(); 12080 } 12081 [ 12082 'transitionend', 12083 'webkitTransitionEnd' 12084 ].forEach((event1)=>{ 12085 swiper.$wrapperEl[0].removeEventListener(event1, onTransitionEnd); 12086 }); 12087 } 12088 function onMouseLeave() { 12089 if (swiper.params.autoplay.disableOnInteraction) return; 12090 swiper.autoplay.paused = false; 12091 emit('autoplayResume'); 12092 run(); 12093 } 12094 function attachMouseEvents() { 12095 if (swiper.params.autoplay.pauseOnMouseEnter) { 12096 swiper.$el.on('mouseenter', onMouseEnter); 12097 swiper.$el.on('mouseleave', onMouseLeave); 12098 } 12099 } 12100 function detachMouseEvents() { 12101 swiper.$el.off('mouseenter', onMouseEnter); 12102 swiper.$el.off('mouseleave', onMouseLeave); 12103 } 12104 on('init', ()=>{ 12105 if (swiper.params.autoplay.enabled) { 12106 start(); 12107 const document1 = getDocument(); 12108 document1.addEventListener('visibilitychange', onVisibilityChange); 12109 attachMouseEvents(); 12110 } 12111 }); 12112 on('beforeTransitionStart', (_s, speed, internal)=>{ 12113 if (swiper.autoplay.running) { 12114 if (internal || !swiper.params.autoplay.disableOnInteraction) swiper.autoplay.pause(speed); 12115 else stop(); 12116 } 12117 }); 12118 on('sliderFirstMove', ()=>{ 12119 if (swiper.autoplay.running) { 12120 if (swiper.params.autoplay.disableOnInteraction) stop(); 12121 else pause(); 12122 } 12123 }); 12124 on('touchEnd', ()=>{ 12125 if (swiper.params.cssMode && swiper.autoplay.paused && !swiper.params.autoplay.disableOnInteraction) run(); 12126 }); 12127 on('destroy', ()=>{ 12128 detachMouseEvents(); 12129 if (swiper.autoplay.running) stop(); 12130 const document1 = getDocument(); 12131 document1.removeEventListener('visibilitychange', onVisibilityChange); 12132 }); 12133 Object.assign(swiper.autoplay, { 12134 pause, 12135 run, 12136 start, 12137 stop 12138 }); 12139 } 12140 function Thumb(_ref) { 12141 let { swiper, extendParams, on } = _ref; 12142 extendParams({ 12143 thumbs: { 12144 swiper: null, 12145 multipleActiveThumbs: true, 12146 autoScrollOffset: 0, 12147 slideThumbActiveClass: 'swiper-slide-thumb-active', 12148 thumbsContainerClass: 'swiper-thumbs' 12149 } 12150 }); 12151 let initialized = false;
12152 let swiperCreated = false; 12153 swiper.thumbs = { 12154 swiper: null 12155 }; 12156 function onThumbClick() { 12157 const thumbsSwiper = swiper.thumbs.swiper; 12158 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 12159 const clickedIndex = thumbsSwiper.clickedIndex; 12160 const clickedSlide = thumbsSwiper.clickedSlide; 12161 if (clickedSlide && $(clickedSlide).hasClass(swiper.params.thumbs.slideThumbActiveClass)) return; 12162 if (typeof clickedIndex === 'undefined' || clickedIndex === null) return; 12163 let slideToIndex; 12164 if (thumbsSwiper.params.loop) slideToIndex = parseInt($(thumbsSwiper.clickedSlide).attr('data-swiper-slide-index'), 10); 12165 else slideToIndex = clickedIndex; 12166 if (swiper.params.loop) { 12167 let currentIndex = swiper.activeIndex; 12168 if (swiper.slides.eq(currentIndex).hasClass(swiper.params.slideDuplicateClass)) { 12169 swiper.loopFix(); // eslint-disable-next-line 12170 swiper._clientLeft = swiper.$wrapperEl[0].clientLeft; 12171 currentIndex = swiper.activeIndex; 12172 } 12173 const prevIndex = swiper.slides.eq(currentIndex).prevAll(`[data-swiper-slide-index="${slideToIndex}"]`).eq(0).index(); 12174 const nextIndex = swiper.slides.eq(currentIndex).nextAll(`[data-swiper-slide-index="${slideToIndex}"]`).eq(0).index(); 12175 if (typeof prevIndex === 'undefined') slideToIndex = nextIndex; 12176 else if (typeof nextIndex === 'undefined') slideToIndex = prevIndex; 12177 else if (nextIndex - currentIndex < currentIndex - prevIndex) slideToIndex = nextIndex; 12178 else slideToIndex = prevIndex; 12179 } 12180 swiper.slideTo(slideToIndex); 12181 } 12182 function init() { 12183 const { thumbs: thumbsParams } = swiper.params; 12184 if (initialized) return false; 12185 initialized = true; 12186 const SwiperClass = swiper.constructor; 12187 if (thumbsParams.swiper instanceof SwiperClass) { 12188 swiper.thumbs.swiper = thumbsParams.swiper; 12189 Object.assign(swiper.thumbs.swiper.originalParams, { 12190 watchSlidesProgress: true, 12191 slideToClickedSlide: false 12192 }); 12193 Object.assign(swiper.thumbs.swiper.params, { 12194 watchSlidesProgress: true, 12195 slideToClickedSlide: false 12196 }); 12197 } else if (isObject(thumbsParams.swiper)) { 12198 const thumbsSwiperParams = Object.assign({}, thumbsParams.swiper); 12199 Object.assign(thumbsSwiperParams, { 12200 watchSlidesProgress: true, 12201 slideToClickedSlide: false 12202 }); 12203 swiper.thumbs.swiper = new SwiperClass(thumbsSwiperParams); 12204 swiperCreated = true; 12205 } 12206 swiper.thumbs.swiper.$el.addClass(swiper.params.thumbs.thumbsContainerClass); 12207 swiper.thumbs.swiper.on('tap', onThumbClick); 12208 return true; 12209 } 12210 function update(initial) { 12211 const thumbsSwiper = swiper.thumbs.swiper; 12212 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 12213 const slidesPerView = thumbsSwiper.params.slidesPerView === 'auto' ? thumbsSwiper.slidesPerViewDynamic() : thumbsSwiper.params.slidesPerView; // Activate thumbs 12214 let thumbsToActivate = 1; 12215 const thumbActiveClass = swiper.params.thumbs.slideThumbActiveClass; 12216 if (swiper.params.slidesPerView > 1 && !swiper.params.centeredSlides) thumbsToActivate = swiper.params.slidesPerView; 12217 if (!swiper.params.thumbs.multipleActiveThumbs) thumbsToActivate = 1; 12218 thumbsToActivate = Math.floor(thumbsToActivate); 12219 thumbsSwiper.slides.removeClass(thumbActiveClass); 12220 if (thumbsSwiper.params.loop || thumbsSwiper.params.virtual && thumbsSwiper.params.virtual.enabled) for(let i = 0; i < thumbsToActivate; i += 1)thumbsSwiper.$wrapperEl.children(`[data-swiper-slide-index="${swiper.realIndex + i}"]`).addClass(thumbActiveClass); 12221 else for(let i = 0; i < thumbsToActivate;
12221 i += 1)thumbsSwiper.slides.eq(swiper.realIndex + i).addClass(thumbActiveClass); 12222 const autoScrollOffset = swiper.params.thumbs.autoScrollOffset; 12223 const useOffset = autoScrollOffset && !thumbsSwiper.params.loop; 12224 if (swiper.realIndex !== thumbsSwiper.realIndex || useOffset) { 12225 let currentThumbsIndex = thumbsSwiper.activeIndex; 12226 let newThumbsIndex; 12227 let direction; 12228 if (thumbsSwiper.params.loop) { 12229 if (thumbsSwiper.slides.eq(currentThumbsIndex).hasClass(thumbsSwiper.params.slideDuplicateClass)) { 12230 thumbsSwiper.loopFix(); // eslint-disable-next-line 12231 thumbsSwiper._clientLeft = thumbsSwiper.$wrapperEl[0].clientLeft; 12232 currentThumbsIndex = thumbsSwiper.activeIndex; 12233 } // Find actual thumbs index to slide to 12234 const prevThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).prevAll(`[data-swiper-slide-index="${swiper.realIndex}"]`).eq(0).index(); 12235 const nextThumbsIndex = thumbsSwiper.slides.eq(currentThumbsIndex).nextAll(`[data-swiper-slide-index="${swiper.realIndex}"]`).eq(0).index(); 12236 if (typeof prevThumbsIndex === 'undefined') newThumbsIndex = nextThumbsIndex; 12237 else if (typeof nextThumbsIndex === 'undefined') newThumbsIndex = prevThumbsIndex; 12238 else if (nextThumbsIndex - currentThumbsIndex === currentThumbsIndex - prevThumbsIndex) newThumbsIndex = thumbsSwiper.params.slidesPerGroup > 1 ? nextThumbsIndex : currentThumbsIndex; 12239 else if (nextThumbsIndex - currentThumbsIndex < currentThumbsIndex - prevThumbsIndex) newThumbsIndex = nextThumbsIndex; 12240 else newThumbsIndex = prevThumbsIndex; 12241 direction = swiper.activeIndex > swiper.previousIndex ? 'next' : 'prev'; 12242 } else { 12243 newThumbsIndex = swiper.realIndex; 12244 direction = newThumbsIndex > swiper.previousIndex ? 'next' : 'prev'; 12245 } 12246 if (useOffset) newThumbsIndex += direction === 'next' ? autoScrollOffset : -1 * autoScrollOffset; 12247 if (thumbsSwiper.visibleSlidesIndexes && thumbsSwiper.visibleSlidesIndexes.indexOf(newThumbsIndex) < 0) { 12248 if (thumbsSwiper.params.centeredSlides) { 12249 if (newThumbsIndex > currentThumbsIndex) newThumbsIndex = newThumbsIndex - Math.floor(slidesPerView / 2) + 1; 12250 else newThumbsIndex = newThumbsIndex + Math.floor(slidesPerView / 2) - 1; 12251 } else newThumbsIndex > currentThumbsIndex && thumbsSwiper.params.slidesPerGroup; 12252 thumbsSwiper.slideTo(newThumbsIndex, initial ? 0 : undefined); 12253 } 12254 } 12255 } 12256 on('beforeInit', ()=>{ 12257 const { thumbs } = swiper.params; 12258 if (!thumbs || !thumbs.swiper) return; 12259 init(); 12260 update(true); 12261 }); 12262 on('slideChange update resize observerUpdate', ()=>{ 12263 update(); 12264 }); 12265 on('setTransition', (_s, duration)=>{ 12266 const thumbsSwiper = swiper.thumbs.swiper; 12267 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 12268 thumbsSwiper.setTransition(duration); 12269 }); 12270 on('beforeDestroy', ()=>{ 12271 const thumbsSwiper = swiper.thumbs.swiper; 12272 if (!thumbsSwiper || thumbsSwiper.destroyed) return; 12273 if (swiperCreated) thumbsSwiper.destroy(); 12274 }); 12275 Object.assign(swiper.thumbs, { 12276 init, 12277 update 12278 }); 12279 } 12280 function freeMode(_ref) { 12281 let { swiper, extendParams, emit, once } = _ref; 12282 extendParams({ 12283 freeMode: { 12284 enabled: false, 12285 momentum: true, 12286 momentumRatio: 1, 12287 momentumBounce: true, 12288 momentumBounceRatio: 1, 12289 momentumVelocityRatio: 1, 12290 sticky: false, 12291 minimumVelocity: 0.02 12292 } 12293 }); 12294 function onTouchStart() { 12295 const translate = swiper.getTranslate(); 12296 swiper.setTranslate(translate); 12297 swiper.setTransition(0); 12298 swiper.touchEventsData.velocities.length = 0; 12299 swiper.freeMode.onTouchEnd({ 12300 currentPos: swiper.rtl ? swiper.translate : -swi
12300per.translate 12301 }); 12302 } 12303 function onTouchMove() { 12304 const { touchEventsData: data, touches } = swiper; // Velocity 12305 if (data.velocities.length === 0) data.velocities.push({ 12306 position: touches[swiper.isHorizontal() ? 'startX' : 'startY'], 12307 time: data.touchStartTime 12308 }); 12309 data.velocities.push({ 12310 position: touches[swiper.isHorizontal() ? 'currentX' : 'currentY'], 12311 time: now() 12312 }); 12313 } 12314 function onTouchEnd(_ref2) { 12315 let { currentPos } = _ref2; 12316 const { params, $wrapperEl, rtlTranslate: rtl, snapGrid, touchEventsData: data } = swiper; // Time diff 12317 const touchEndTime = now(); 12318 const timeDiff = touchEndTime - data.touchStartTime; 12319 if (currentPos < -swiper.minTranslate()) { 12320 swiper.slideTo(swiper.activeIndex); 12321 return; 12322 } 12323 if (currentPos > -swiper.maxTranslate()) { 12324 if (swiper.slides.length < snapGrid.length) swiper.slideTo(snapGrid.length - 1); 12325 else swiper.slideTo(swiper.slides.length - 1); 12326 return; 12327 } 12328 if (params.freeMode.momentum) { 12329 if (data.velocities.length > 1) { 12330 const lastMoveEvent = data.velocities.pop(); 12331 const velocityEvent = data.velocities.pop(); 12332 const distance = lastMoveEvent.position - velocityEvent.position; 12333 const time = lastMoveEvent.time - velocityEvent.time; 12334 swiper.velocity = distance / time; 12335 swiper.velocity /= 2; 12336 if (Math.abs(swiper.velocity) < params.freeMode.minimumVelocity) swiper.velocity = 0; 12337 // this implies that the user stopped moving a finger then released. 12338 // There would be no events with distance zero, so the last event is stale. 12339 if (time > 150 || now() - lastMoveEvent.time > 300) swiper.velocity = 0; 12340 } else swiper.velocity = 0; 12341 swiper.velocity *= params.freeMode.momentumVelocityRatio; 12342 data.velocities.length = 0; 12343 let momentumDuration = 1000 * params.freeMode.momentumRatio; 12344 const momentumDistance = swiper.velocity * momentumDuration; 12345 let newPosition = swiper.translate + momentumDistance; 12346 if (rtl) newPosition = -newPosition; 12347 let doBounce = false; 12348 let afterBouncePosition; 12349 const bounceAmount = Math.abs(swiper.velocity) * 20 * params.freeMode.momentumBounceRatio; 12350 let needsLoopFix; 12351 if (newPosition < swiper.maxTranslate()) { 12352 if (params.freeMode.momentumBounce) { 12353 if (newPosition + swiper.maxTranslate() < -bounceAmount) newPosition = swiper.maxTranslate() - bounceAmount; 12354 afterBouncePosition = swiper.maxTranslate(); 12355 doBounce = true; 12356 data.allowMomentumBounce = true; 12357 } else newPosition = swiper.maxTranslate(); 12358 if (params.loop && params.centeredSlides) needsLoopFix = true; 12359 } else if (newPosition > swiper.minTranslate()) { 12360 if (params.freeMode.momentumBounce) { 12361 if (newPosition - swiper.minTranslate() > bounceAmount) newPosition = swiper.minTranslate() + bounceAmount; 12362 afterBouncePosition = swiper.minTranslate(); 12363 doBounce = true; 12364 data.allowMomentumBounce = true; 12365 } else newPosition = swiper.minTranslate(); 12366 if (params.loop && params.centeredSlides) needsLoopFix = true; 12367 } else if (params.freeMode.sticky) { 12368 let nextSlide; 12369 for(let j = 0; j < snapGrid.length; j += 1)if (snapGrid[j] > -newPosition) { 12370 nextSlide = j; 12371 break; 12372 } 12373 if (Math.abs(snapGrid[nextSlide] - newPosition) < Math.abs(snapGrid[nextSlide - 1] - newPosition) || swiper.swipeDirection === 'next') newPosition = snapGrid[nextSlide]; 12374 else newPosition = snapGrid[nextSlide - 1]; 12375 newPosition = -newPosition; 12376 } 12377 if (needsLoopFix) once('transitionEnd', ()=>{ 12378 swiper.loopFix(); 12379 }); 12380 // Fix duration 12381 if (swiper.velocity !== 0) { 12382 if (rtl) momentumDuration = Math.abs((-newPosition - swiper.translate) / swiper.velocity); 12383 else momentumDuration = Math.abs((newPosition - swiper.translate) / swiper.velocity); 12384 if (params.freeMode.sticky) { 12385 // If freeMode.sticky is active and the user ends a swipe with a slow-velocity 12386 // event, then durations can be 20+ seconds to slide one (or zero!) slides. 12387 // It's easy to see this when simulating touch with mouse events. To fix this, 12388 // limit single-slide swipes to the default slide duration. This also has the 12389 // nice side effect of matching slide speed if the user stopped moving before 12390 // lifting finger or mouse vs. moving slowly before lifting the finger/mouse. 12391 // For faster swipes, also apply limits (albeit higher ones). 12392 const moveDistance = Math.abs((rtl ? -newPosition : newPosition) - swiper.translate); 12393 const currentSlideSize = swiper.slidesSizesGrid[swiper.activeIndex]; 12394 if (moveDistance < currentSlideSize) momentumDuration = params.speed; 12395 else if (moveDistance < 2 * currentSlideSize) momentumDuration = params.speed * 1.5; 12396 else momentumDuration = params.speed * 2.5; 12397 } 12398 } else if (params.freeMode.sticky) { 12399 swiper.slideToClosest(); 12400 return; 12401 } 12402 if (params.freeMode.momentumBounce && doBounce) { 12403 swiper.updateProgress(afterBouncePosition); 12404 swiper.setTransition(momentumDuration); 12405 swiper.setTranslate(newPosition); 12406 swiper.transitionStart(true, swiper.swipeDirection); 12407 swiper.animating = true; 12408 $wrapperEl.transitionEnd(()=>{ 12409 if (!swiper || swiper.destroyed || !data.allowMomentumBounce) return; 12410 emit('momentumBounce'); 12411 swiper.setTransition(params.speed); 12412 setTimeout(()=>{ 12413 swiper.setTranslate(afterBouncePosition); 12414 $wrapperEl.transitionEnd(()=>{ 12415 if (!swiper || swiper.destroyed) return; 12416 swiper.transitionEnd(); 12417 }); 12418 }, 0); 12419 }); 12420 } else if (swiper.velocity) { 12421 emit('_freeModeNoMomentumRelease'); 12422 swiper.updateProgress(newPosition); 12423 swiper.setTransition(momentumDuration); 12424 swiper.setTranslate(newPosition); 12425 swiper.transitionStart(true, swiper.swipeDirection); 12426 if (!swiper.animating) { 12427 swiper.animating = true; 12428 $wrapperEl.transitionEnd(()=>{ 12429 if (!swiper || swiper.destroyed) return; 12430 swiper.transitionEnd(); 12431 }); 12432 } 12433 } else swiper.updateProgress(newPosition); 12434 swiper.updateActiveIndex(); 12435 swiper.updateSlidesClasses(); 12436 } else if (params.freeMode.sticky) { 12437 swiper.slideToClosest(); 12438 return; 12439 } else if (params.freeMode) emit('_freeModeNoMomentumRelease'); 12440 if (!params.freeMode.momentum || timeDiff >= params.longSwipesMs) { 12441 swiper.updateProgress(); 12442 swiper.updateActiveIndex(); 12443 swiper.updateSlidesClasses(); 12444 } 12445 } 12446 Object.assign(swiper, { 12447 freeMode: { 12448 onTouchStart, 12449 onTouchMove, 12450 onTouchEnd 12451 } 12452 }); 12453 } 12454 function Grid(_ref) { 12455 let { swiper, extendParams } = _ref; 12456 extendParams({ 12457 grid: { 12458 rows: 1, 12459 fill: 'column' 12460 } 12461 });
12462 let slidesNumberEvenToRows; 12463 let slidesPerRow; 12464 let numFullColumns; 12465 const initSlides = (slidesLength)=>{ 12466 const { slidesPerView } = swiper.params; 12467 const { rows, fill } = swiper.params.grid; 12468 slidesPerRow = slidesNumberEvenToRows / rows; 12469 numFullColumns = Math.floor(slidesLength / rows); 12470 if (Math.floor(slidesLength / rows) === slidesLength / rows) slidesNumberEvenToRows = slidesLength; 12471 else slidesNumberEvenToRows = Math.ceil(slidesLength / rows) * rows; 12472 if (slidesPerView !== 'auto' && fill === 'row') slidesNumberEvenToRows = Math.max(slidesNumberEvenToRows, slidesPerView * rows); 12473 }; 12474 const updateSlide = (i, slide, slidesLength, getDirectionLabel)=>{ 12475 const { slidesPerGroup, spaceBetween } = swiper.params; 12476 const { rows, fill } = swiper.params.grid; // Set slides order 12477 let newSlideOrderIndex; 12478 let column; 12479 let row; 12480 if (fill === 'row' && slidesPerGroup > 1) { 12481 const groupIndex = Math.floor(i / (slidesPerGroup * rows)); 12482 const slideIndexInGroup = i - rows * slidesPerGroup * groupIndex; 12483 const columnsInGroup = groupIndex === 0 ? slidesPerGroup : Math.min(Math.ceil((slidesLength - groupIndex * rows * slidesPerGroup) / rows), slidesPerGroup); 12484 row = Math.floor(slideIndexInGroup / columnsInGroup); 12485 column = slideIndexInGroup - row * columnsInGroup + groupIndex * slidesPerGroup; 12486 newSlideOrderIndex = column + row * slidesNumberEvenToRows / rows; 12487 slide.css({ 12488 '-webkit-order': newSlideOrderIndex, 12489 order: newSlideOrderIndex 12490 }); 12491 } else if (fill === 'column') { 12492 column = Math.floor(i / rows); 12493 row = i - column * rows; 12494 if (column > numFullColumns || column === numFullColumns && row === rows - 1) { 12495 row += 1; 12496 if (row >= rows) { 12497 row = 0; 12498 column += 1; 12499 } 12500 } 12501 } else { 12502 row = Math.floor(i / slidesPerRow); 12503 column = i - row * slidesPerRow; 12504 } 12505 slide.css(getDirectionLabel('margin-top'), row !== 0 ? spaceBetween && `${spaceBetween}px` : ''); 12506 }; 12507 const updateWrapperSize = (slideSize, snapGrid, getDirectionLabel)=>{ 12508 const { spaceBetween, centeredSlides, roundLengths } = swiper.params; 12509 const { rows } = swiper.params.grid; 12510 swiper.virtualSize = (slideSize + spaceBetween) * slidesNumberEvenToRows; 12511 swiper.virtualSize = Math.ceil(swiper.virtualSize / rows) - spaceBetween; 12512 swiper.$wrapperEl.css({ 12513 [getDirectionLabel('width')]: `${swiper.virtualSize + spaceBetween}px` 12514 }); 12515 if (centeredSlides) { 12516 snapGrid.splice(0, snapGrid.length); 12517 const newSlidesGrid = []; 12518 for(let i = 0; i < snapGrid.length; i += 1){ 12519 let slidesGridItem = snapGrid[i]; 12520 if (roundLengths) slidesGridItem = Math.floor(slidesGridItem); 12521 if (snapGrid[i] < swiper.virtualSize + snapGrid[0]) newSlidesGrid.push(slidesGridItem); 12522 } 12523 snapGrid.push(...newSlidesGrid); 12524 } 12525 }; 12526 swiper.grid = { 12527 initSlides, 12528 updateSlide, 12529 updateWrapperSize 12530 }; 12531 } 12532 function appendSlide(slides) { 12533 const swiper = this; 12534 const { $wrapperEl, params } = swiper; 12535 if (params.loop) swiper.loopDestroy(); 12536 if (typeof slides === 'object' && 'length' in slides) { 12537 for(let i = 0; i < slides.length; i += 1)if (slides[i]) $wrapperEl.append(slides[i]); 12538 } else $wrapperEl.append(slides); 12539 if (params.loop) swiper.loopCreate(); 12540 if (!params.observer) swiper.update(); 12541 } 12542 function prependSlide(slides) { 12543 const swiper = this; 12544 const { params, $wrapperEl, activeIndex } = swiper; 12545 if (params.loop) swiper.loopDestroy(); 12546 let newActiveIndex = activeIndex + 1; 12547 if (typeof slides === 'object' && 'length' in slides) { 12548 for(let i = 0; i < slides.length;
12548 i += 1)if (slides[i]) $wrapperEl.prepend(slides[i]); 12549 newActiveIndex = activeIndex + slides.length; 12550 } else $wrapperEl.prepend(slides); 12551 if (params.loop) swiper.loopCreate(); 12552 if (!params.observer) swiper.update(); 12553 swiper.slideTo(newActiveIndex, 0, false); 12554 } 12555 function addSlide(index, slides) { 12556 const swiper = this; 12557 const { $wrapperEl, params, activeIndex } = swiper; 12558 let activeIndexBuffer = activeIndex; 12559 if (params.loop) { 12560 activeIndexBuffer -= swiper.loopedSlides; 12561 swiper.loopDestroy(); 12562 swiper.slides = $wrapperEl.children(`.${params.slideClass}`); 12563 } 12564 const baseLength = swiper.slides.length; 12565 if (index <= 0) { 12566 swiper.prependSlide(slides); 12567 return; 12568 } 12569 if (index >= baseLength) { 12570 swiper.appendSlide(slides); 12571 return; 12572 } 12573 let newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + 1 : activeIndexBuffer; 12574 const slidesBuffer = []; 12575 for(let i = baseLength - 1; i >= index; i -= 1){ 12576 const currentSlide = swiper.slides.eq(i); 12577 currentSlide.remove(); 12578 slidesBuffer.unshift(currentSlide); 12579 } 12580 if (typeof slides === 'object' && 'length' in slides) { 12581 for(let i = 0; i < slides.length; i += 1)if (slides[i]) $wrapperEl.append(slides[i]); 12582 newActiveIndex = activeIndexBuffer > index ? activeIndexBuffer + slides.length : activeIndexBuffer; 12583 } else $wrapperEl.append(slides); 12584 for(let i = 0; i < slidesBuffer.length; i += 1)$wrapperEl.append(slidesBuffer[i]); 12585 if (params.loop) swiper.loopCreate(); 12586 if (!params.observer) swiper.update(); 12587 if (params.loop) swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false); 12588 else swiper.slideTo(newActiveIndex, 0, false); 12589 } 12590 function removeSlide(slidesIndexes) { 12591 const swiper = this; 12592 const { params, $wrapperEl, activeIndex } = swiper; 12593 let activeIndexBuffer = activeIndex; 12594 if (params.loop) { 12595 activeIndexBuffer -= swiper.loopedSlides; 12596 swiper.loopDestroy(); 12597 swiper.slides = $wrapperEl.children(`.${params.slideClass}`); 12598 } 12599 let newActiveIndex = activeIndexBuffer; 12600 let indexToRemove; 12601 if (typeof slidesIndexes === 'object' && 'length' in slidesIndexes) { 12602 for(let i = 0; i < slidesIndexes.length; i += 1){ 12603 indexToRemove = slidesIndexes[i]; 12604 if (swiper.slides[indexToRemove]) swiper.slides.eq(indexToRemove).remove(); 12605 if (indexToRemove < newActiveIndex) newActiveIndex -= 1; 12606 } 12607 newActiveIndex = Math.max(newActiveIndex, 0); 12608 } else { 12609 indexToRemove = slidesIndexes; 12610 if (swiper.slides[indexToRemove]) swiper.slides.eq(indexToRemove).remove(); 12611 if (indexToRemove < newActiveIndex) newActiveIndex -= 1; 12612 newActiveIndex = Math.max(newActiveIndex, 0); 12613 } 12614 if (params.loop) swiper.loopCreate(); 12615 if (!params.observer) swiper.update(); 12616 if (params.loop) swiper.slideTo(newActiveIndex + swiper.loopedSlides, 0, false); 12617 else swiper.slideTo(newActiveIndex, 0, false); 12618 } 12619 function removeAllSlides() { 12620 const swiper = this; 12621 const slidesIndexes = []; 12622 for(let i = 0; i < swiper.slides.length; i += 1)slidesIndexes.push(i); 12623 swiper.removeSlide(slidesIndexes); 12624 } 12625 function Manipulation(_ref) { 12626 let { swiper } = _ref; 12627 Object.assign(swiper, { 12628 appendSlide: appendSlide.bind(swiper), 12629 prependSlide: prependSlide.bind(swiper), 12630 addSlide: addSlide.bind(swiper), 12631 removeSlide: removeSlide.bind(swiper), 12632 removeAllSlides: removeAllSlides.bind(swiper) 12633 }); 12634 } 12635 function effectInit(params) { 12636 const { effect, swiper, on, setTranslate, setTransition, overwriteParams, perspective, recreateShadows, getEffectParams } = params; 12637 on('beforeInit', ()=>{ 12638 if (swiper.params.effect !== effect) return; 12639 swiper.classNames.push(`${swiper.params.containerModifierClass}${effect}`); 12640 if (perspective && perspective()) swiper.classNames.push(`${swiper.params.containerModifierClass}3d`); 12641 const overwriteParamsResult = overwriteParams ? overwriteParams() : {}; 12642 Object.assign(swiper.params, overwriteParamsResult); 12643 Object.assign(swiper.originalParams, overwriteParamsResult); 12644 }); 12645 on('setTranslate', ()=>{ 12646 if (swiper.params.effect !== effect) return; 12647 setTranslate(); 12648 }); 12649 on('setTransition', (_s, duration)=>{ 12650 if (swiper.params.effect !== effect) return; 12651 setTransition(duration); 12652 }); 12653 on('transitionEnd', ()=>{ 12654 if (swiper.params.effect !== effect) return; 12655 if (recreateShadows) { 12656 if (!getEffectParams || !getEffectParams().slideShadows) return; // remove shadows 12657 swiper.slides.each((slideEl)=>{ 12658 const $slideEl = swiper.$(slideEl); 12659 $slideEl.find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').remove(); 12660 }); // create new one 12661 recreateShadows(); 12662 } 12663 }); 12664 let requireUpdateOnVirtual; 12665 on('virtualUpdate', ()=>{ 12666 if (swiper.params.effect !== effect) return; 12667 if (!swiper.slides.length) requireUpdateOnVirtual = true; 12668 requestAnimationFrame(()=>{ 12669 if (requireUpdateOnVirtual && swiper.slides && swiper.slides.length) { 12670 setTranslate(); 12671 requireUpdateOnVirtual = false;
12672 } 12673 }); 12674 }); 12675 } 12676 function effectTarget(effectParams, $slideEl) { 12677 if (effectParams.transformEl) return $slideEl.find(effectParams.transformEl).css({ 12678 'backface-visibility': 'hidden', 12679 '-webkit-backface-visibility': 'hidden' 12680 }); 12681 return $slideEl; 12682 } 12683 function effectVirtualTransitionEnd(_ref) { 12684 let { swiper, duration, transformEl, allSlides } = _ref; 12685 const { slides, activeIndex, $wrapperEl } = swiper; 12686 if (swiper.params.virtualTranslate && duration !== 0) { 12687 let eventTriggered = false; 12688 let $transitionEndTarget; 12689 if (allSlides) $transitionEndTarget = transformEl ? slides.find(transformEl) : slides; 12690 else $transitionEndTarget = transformEl ? slides.eq(activeIndex).find(transformEl) : slides.eq(activeIndex); 12691 $transitionEndTarget.transitionEnd(()=>{ 12692 if (eventTriggered) return; 12693 if (!swiper || swiper.destroyed) return; 12694 eventTriggered = true; 12695 swiper.animating = false; 12696 const triggerEvents = [ 12697 'webkitTransitionEnd', 12698 'transitionend' 12699 ]; 12700 for(let i = 0; i < triggerEvents.length; i += 1)$wrapperEl.trigger(triggerEvents[i]); 12701 }); 12702 } 12703 } 12704 function EffectFade(_ref) { 12705 let { swiper, extendParams, on } = _ref; 12706 extendParams({ 12707 fadeEffect: { 12708 crossFade: false, 12709 transformEl: null 12710 } 12711 }); 12712 const setTranslate = ()=>{ 12713 const { slides } = swiper; 12714 const params = swiper.params.fadeEffect; 12715 for(let i = 0; i < slides.length; i += 1){ 12716 const $slideEl = swiper.slides.eq(i); 12717 const offset = $slideEl[0].swiperSlideOffset; 12718 let tx = -offset; 12719 if (!swiper.params.virtualTranslate) tx -= swiper.translate; 12720 let ty = 0; 12721 if (!swiper.isHorizontal()) { 12722 ty = tx; 12723 tx = 0; 12724 } 12725 const slideOpacity = swiper.params.fadeEffect.crossFade ? Math.max(1 - Math.abs($slideEl[0].progress), 0) : 1 + Math.min(Math.max($slideEl[0].progress, -1), 0); 12726 const $targetEl = effectTarget(params, $slideEl); 12727 $targetEl.css({ 12728 opacity: slideOpacity 12729 }).transform(`translate3d(${tx}px, ${ty}px, 0px)`); 12730 } 12731 }; 12732 const setTransition = (duration)=>{ 12733 const { transformEl } = swiper.params.fadeEffect; 12734 const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; 12735 $transitionElements.transition(duration); 12736 effectVirtualTransitionEnd({ 12737 swiper, 12738 duration, 12739 transformEl, 12740 allSlides: true 12741 }); 12742 }; 12743 effectInit({ 12744 effect: 'fade', 12745 swiper, 12746 on, 12747 setTranslate, 12748 setTransition, 12749 overwriteParams: ()=>({ 12750 slidesPerView: 1, 12751 slidesPerGroup: 1, 12752 watchSlidesProgress: true, 12753 spaceBetween: 0, 12754 virtualTranslate: !swiper.params.cssMode 12755 }) 12756 }); 12757 } 12758 function EffectCube(_ref) { 12759 let { swiper, extendParams, on } = _ref; 12760 extendParams({ 12761 cubeEffect: { 12762 slideShadows: true, 12763 shadow: true, 12764 shadowOffset: 20, 12765 shadowScale: 0.94 12766 } 12767 }); 12768 const createSlideShadows = ($slideEl, progress, isHorizontal)=>{ 12769 let shadowBefore = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top'); 12770 let shadowAfter = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom'); 12771 if (shadowBefore.length === 0) { 12772 shadowBefore = $(`<div class="swiper-slide-shadow-${isHorizontal ? 'left' : 'top'}"></div>`); 12773 $slideEl.append(shadowBefore); 12774 } 12775 if (shadowAfter.length === 0) { 12776 shadowAfter = $(`<div class="swiper-slide-shadow-${isHorizontal ? 'right' : 'bottom'}"></div>`); 12777 $slideEl.append(shadowAfter); 12778 } 12779 if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0); 12780 if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0); 12781 }; 12782 const recreateShadows = ()=>{ 12783 // create new ones 12784 const isHorizontal = swiper.isHorizontal(); 12785 swiper.slides.each((slideEl)=>{ 12786 const progress = Math.max(Math.min(slideEl.progress, 1), -1); 12787 createSlideShadows($(slideEl), progress, isHorizontal); 12788 }); 12789 }; 12790 const setTranslate = ()=>{ 12791 const { $el, $wrapperEl, slides, width: swiperWidth, height: swiperHeight, rtlTranslate: rtl, size: swiperSize, browser } = swiper; 12792 const params = swiper.params.cubeEffect; 12793 const isHorizontal = swiper.isHorizontal(); 12794 const isVirtual = swiper.virtual && swiper.params.virtual.enabled; 12795 let wrapperRotate = 0; 12796 let $cubeShadowEl; 12797 if (params.shadow) { 12798 if (isHorizontal) { 12799 $cubeShadowEl = $wrapperEl.find('.swiper-cube-shadow'); 12800 if ($cubeShadowEl.length === 0) {
12801 $cubeShadowEl = $('<div class="swiper-cube-shadow"></div>'); 12802 $wrapperEl.append($cubeShadowEl); 12803 } 12804 $cubeShadowEl.css({ 12805 height: `${swiperWidth}px` 12806 }); 12807 } else { 12808 $cubeShadowEl = $el.find('.swiper-cube-shadow'); 12809 if ($cubeShadowEl.length === 0) { 12810 $cubeShadowEl = $('<div class="swiper-cube-shadow"></div>'); 12811 $el.append($cubeShadowEl); 12812 } 12813 } 12814 } 12815 for(let i = 0; i < slides.length; i += 1){ 12816 const $slideEl = slides.eq(i); 12817 let slideIndex = i; 12818 if (isVirtual) slideIndex = parseInt($slideEl.attr('data-swiper-slide-index'), 10); 12819 let slideAngle = slideIndex * 90; 12820 let round = Math.floor(slideAngle / 360); 12821 if (rtl) { 12822 slideAngle = -slideAngle; 12823 round = Math.floor(-slideAngle / 360); 12824 } 12825 const progress = Math.max(Math.min($slideEl[0].progress, 1), -1); 12826 let tx = 0; 12827 let ty = 0; 12828 let tz = 0; 12829 if (slideIndex % 4 === 0) { 12830 tx = -round * 4 * swiperSize; 12831 tz = 0; 12832 } else if ((slideIndex - 1) % 4 === 0) { 12833 tx = 0; 12834 tz = -round * 4 * swiperSize; 12835 } else if ((slideIndex - 2) % 4 === 0) { 12836 tx = swiperSize + round * 4 * swiperSize; 12837 tz = swiperSize; 12838 } else if ((slideIndex - 3) % 4 === 0) { 12839 tx = -swiperSize; 12840 tz = 3 * swiperSize + swiperSize * 4 * round; 12841 } 12842 if (rtl) tx = -tx; 12843 if (!isHorizontal) { 12844 ty = tx; 12845 tx = 0; 12846 } 12847 const transform = `rotateX(${isHorizontal ? 0 : -slideAngle}deg) rotateY(${isHorizontal ? slideAngle : 0}deg) translate3d(${tx}px, ${ty}px, ${tz}px)`; 12848 if (progress <= 1 && progress > -1) { 12849 wrapperRotate = slideIndex * 90 + progress * 90; 12850 if (rtl) wrapperRotate = -slideIndex * 90 - progress * 90; 12851 } 12852 $slideEl.transform(transform); 12853 if (params.slideShadows) createSlideShadows($slideEl, progress, isHorizontal); 12854 } 12855 $wrapperEl.css({ 12856 '-webkit-transform-origin': `50% 50% -${swiperSize / 2}px`, 12857 'transform-origin': `50% 50% -${swiperSize / 2}px` 12858 }); 12859 if (params.shadow) { 12860 if (isHorizontal) $cubeShadowEl.transform(`translate3d(0px, ${swiperWidth / 2 + params.shadowOffset}px, ${-swiperWidth / 2}px) rotateX(90deg) rotateZ(0deg) scale(${params.shadowScale})`); 12861 else { 12862 const shadowAngle = Math.abs(wrapperRotate) - Math.floor(Math.abs(wrapperRotate) / 90) * 90; 12863 const multiplier = 1.5 - (Math.sin(shadowAngle * 2 * Math.PI / 360) / 2 + Math.cos(shadowAngle * 2 * Math.PI / 360) / 2); 12864 const scale1 = params.shadowScale; 12865 const scale2 = params.shadowScale / multiplier; 12866 const offset = params.shadowOffset; 12867 $cubeShadowEl.transform(`scale3d(${scale1}, 1, ${scale2}) translate3d(0px, ${swiperHeight / 2 + offset}px, ${-swiperHeight / 2 / scale2}px) rotateX(-90deg)`); 12868 } 12869 } 12870 const zFactor = browser.isSafari || browser.isWebView ? -swiperSize / 2 : 0; 12871 $wrapperEl.transform(`translate3d(0px,0,${zFactor}px) rotateX(${swiper.isHorizontal() ? 0 : wrapperRotate}deg) rotateY(${swiper.isHorizontal() ? -wrapperRotate : 0}deg)`); 12872 $wrapperEl[0].style.setProperty('--swiper-cube-translate-z', `${zFactor}px`); 12873 }; 12874 const setTransition = (duration)=>{ 12875 const { $el, slides } = swiper; 12876 slides.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration); 12877 if (swiper.params.cubeEffect.shadow && !swiper.isHorizontal()) $el.find('.swiper-cube-shadow').transition(duration); 12878 }; 12879 effectInit({ 12880 effect: 'cube', 12881 swiper, 12882 on, 12883 setTranslate, 12884 setTransition, 12885 recreateShadows, 12886 getEffectParams: ()=>swiper.params.cubeEffect, 12887 perspective: ()=>true, 12888 overwriteParams: ()=>({ 12889 slidesPerView: 1, 12890 slidesPerGroup: 1, 12891 watchSlidesProgress: true, 12892 resistanceRatio: 0, 12893 spaceBetween: 0, 12894 centeredSlides: false, 12895 virtualTranslate: true 12896 }) 12897 }); 12898 } 12899 function createShadow(params, $slideEl, side) { 12900 const shadowClass = `swiper-slide-shadow${side ? `-${side}` : ''}`; 12901 const $shadowContainer = params.transformEl ? $slideEl.find(params.transformEl) : $slideEl; 12902 let $shadowEl = $shadowContainer.children(`.${shadowClass}`); 12903 if (!$shadowEl.length) { 12904 $shadowEl = $(`<div class="swiper-slide-shadow${side ? `-${side}` : ''}"></div>`); 12905 $shadowContainer.append($shadowEl); 12906 } 12907 return $shadowEl; 12908 } 12909 function EffectFlip(_ref) { 12910 let { swiper, extendParams, on } = _ref; 12911 extendParams({ 12912 flipEffect: { 12913 slideShadows: true, 12914 limitRotation: true, 12915 transformEl: null 12916 } 12917 }); 12918 const createSlideShadows = ($slideEl, progress, params)=>{ 12919 let shadowBefore = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top'); 12920 let shadowAfter = swiper.isHorizontal() ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom'); 12921 if (shadowBefore.length === 0) shadowBefore = createShadow(params, $slideEl, swiper.isHorizontal() ? 'left' : 'top'); 12922 if (shadowAfter.length === 0) shadowAfter = createShadow(params, $slideEl, swiper.isHorizontal() ? 'right' : 'bottom'); 12923 if (shadowBefore.length) shadowBefore[0].style.opacity = Math.max(-progress, 0); 12924 if (shadowAfter.length) shadowAfter[0].style.opacity = Math.max(progress, 0); 12925 }; 12926 const recreateShadows = ()=>{ 12927 // Set shadows 12928 const params = swiper.params.flipEffect; 12929 swiper.slides.each((slideEl)=>{ 12930 const $slideEl = $(slideEl); 12931 let progress = $slideEl[0].progress; 12932 if (swiper.params.flipEffect.limitRotation) progress = Math.max(Math.min(slideEl.progress, 1), -1); 12933 createSlideShadows($slideEl, progress, params); 12934 }); 12935 }; 12936 const setTranslate = ()=>{ 12937 const { slides, rtlTranslate: rtl } = swiper; 12938 const params = swiper.params.flipEffect; 12939 for(let i = 0; i < slides.length; i += 1){ 12940 const $slideEl = slides.eq(i); 12941 let progress = $slideEl[0].progress; 12942 if (swiper.params.flipEffect.limitRotation) progress = Math.max(Math.min($slideEl[0].progress, 1), -1); 12943 const offset = $slideEl[0].swiperSlideOffset; 12944 const rotate = -180 * progress; 12945 let rotateY = rotate; 12946 let rotateX = 0; 12947 let tx = swiper.params.cssMode ? -offset - swiper.translate : -offset; 12948 let ty = 0; 12949 if (!swiper.isHorizontal()) { 12950 ty = tx; 12951 tx = 0; 12952 rotateX = -rotateY; 12953 rotateY = 0; 12954 } else if (rtl) rotateY = -rotateY; 12955 $slideEl[0].style.zIndex = -Math.abs(Math.round(progress)) + slides.length; 12956 if (params.slideShadows) createSlideShadows($slideEl, progress, params); 12957 const transform = `translate3d(${tx}px, ${ty}px, 0px) rotateX(${rotateX}deg) rotateY(${rotateY}deg)`; 12958 const $targetEl = effectTarget(params, $slideEl); 12959 $targetEl.transform(transform); 12960 } 12961 }; 12962 const setTransition = (duration)=>{ 12963 const { transformEl } = swiper.params.flipEffect; 12964 const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; 12965 $transitionElements.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration); 12966 effectVirtualTransitionEnd({ 12967 swiper, 12968 duration, 12969 transformEl 12970 }); 12971 }; 12972 effectInit({ 12973 effect: 'flip', 12974 swiper, 12975 on, 12976 setTranslate, 12977 setTransition, 12978 recreateShadows, 12979 getEffectParams: ()=>swiper.params.flipEffect, 12980 perspective: ()=>true, 12981 overwriteParams: ()=>({ 12982 slidesPerView: 1, 12983 slidesPerGroup: 1, 12984 watchSlidesProgress: true, 12985 spaceBetween: 0, 12986 virtualTranslate: !swiper.params.cssMode 12987 }) 12988 }); 12989 } 12990 function EffectCoverflow(_ref) { 12991 let { swiper, extendParams, on } = _ref; 12992 extendParams({ 12993 coverflowEffect: { 12994 rotate: 50, 12995 stretch: 0, 12996 depth: 100, 12997 scale: 1, 12998 modifier: 1, 12999 slideShadows: true, 13000 transformEl: null 13001 } 13002 }); 13003 const setTranslate = ()=>{ 13004 const { width: swiperWidth, height: swiperHeight, slides, slidesSizesGrid } = swiper; 13005 const params = swiper.params.coverflowEffect; 13006 const isHorizontal = swiper.isHorizontal(); 13007 const transform = swiper.translate; 13008 const center = isHorizontal ? -transform + swiperWidth / 2 : -transform + swiperHeight / 2; 13009 const rotate = isHorizontal ? params.rotate : -params.rotate; 13010 const translate = params.depth; // Each slide offset from center 13011 for(let i = 0, length = slides.length; i < length; i += 1){ 13012 const $slideEl = slides.eq(i); 13013 const slideSize = slidesSizesGrid[i]; 13014 const slideOffset = $slideEl[0].swiperSlideOffset; 13015 const centerOffset = (center - slideOffset - slideSize / 2) / slideSize; 13016 const offsetMultiplier = typeof params.modifier === 'function' ? params.modifier(centerOffset) : centerOffset * params.modifier; 13017 let rotateY = isHorizontal ? rotate * offsetMultiplier : 0; 13018 let rotateX = isHorizontal ? 0 : rotate * offsetMultiplier; // var rotateZ = 0 13019 let translateZ = -translate * Math.abs(offsetMultiplier); 13020 let stretch = params.stretch; // Allow percentage to make a relative stretch for responsive sliders 13021 if (typeof stretch === 'string' && stretch.indexOf('%') !== -1) stretch = parseFloat(params.stretch) / 100 * slideSize; 13022 let translateY = isHorizontal ? 0 : stretch * offsetMultiplier; 13023 let translateX = isHorizontal ? stretch * offsetMultiplier : 0; 13024 let scale = 1 - (1 - params.scale) * Math.abs(offsetMultiplier); // Fix for ultra small values 13025 if (Math.abs(translateX) < 0.001) translateX = 0; 13026 if (Math.abs(translateY) < 0.001) translateY = 0; 13027 if (Math.abs(translateZ) < 0.001) translateZ = 0; 13028 if (Math.abs(rotateY) < 0.001) rotateY = 0; 13029 if (Math.abs(rotateX) < 0.001) rotateX = 0; 13030 if (Math.abs(scale) < 0.001) scale = 0; 13031 const slideTransform = `translate3d(${translateX}px,${translateY}px,${translateZ}px) rotateX(${rotateX}deg) rotateY(${rotateY}deg) scale(${scale})`; 13032 const $targetEl = effectTarget(params, $slideEl); 13033 $targetEl.transform(slideTransform); 13034 $slideEl[0].style.zIndex = -Math.abs(Math.round(offsetMultiplier)) + 1; 13035 if (params.slideShadows) { 13036 // Set shadows 13037 let $shadowBeforeEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-left') : $slideEl.find('.swiper-slide-shadow-top'); 13038 let $shadowAfterEl = isHorizontal ? $slideEl.find('.swiper-slide-shadow-right') : $slideEl.find('.swiper-slide-shadow-bottom'); 13039 if ($shadowBeforeEl.length === 0) $shadowBeforeEl = createShadow(params, $slideEl, isHorizontal ? 'left' : 'top'); 13040 if ($shadowAfterEl.length === 0) $shadowAfterEl = createShadow(params, $slideEl, isHorizontal ? 'right' : 'bottom'); 13041 if ($shadowBeforeEl.length) $shadowBeforeEl[0].style.opacity = offsetMultiplier > 0 ? offsetMultiplier : 0; 13042 if ($shadowAfterEl.length) $shadowAfterEl[0].style.opacity = -offsetMultiplier > 0 ? -offsetMultiplier : 0; 13043 } 13044 } 13045 }; 13046 const setTransition = (duration)=>{ 13047 const { transformEl } = swiper.params.coverflowEffect; 13048 const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; 13049 $transitionElements.transition(duration).find('.swiper-slide-shadow-top, .swiper-slide-shadow-right, .swiper-slide-shadow-bottom, .swiper-slide-shadow-left').transition(duration); 13050 }; 13051 effectInit({ 13052 effect: 'coverflow', 13053 swiper, 13054 on, 13055 setTranslate, 13056 setTransition, 13057 perspective: ()=>true, 13058 overwriteParams: ()=>({ 13059 watchSlidesProgress: true 13060 }) 13061 }); 13062 } 13063 function EffectCreative(_ref) { 13064 let { swiper, extendParams, on } = _ref; 13065 extendParams({ 13066 creativeEffect: { 13067 transformEl: null, 13068 limitProgress: 1, 13069 shadowPerProgress: false, 13070 progressMultiplier: 1, 13071 perspective: true, 13072 prev: { 13073 translate: [ 13074 0, 13075 0, 13076 0 13077 ], 13078 rotate: [ 13079 0, 13080 0, 13081 0 13082 ], 13083 opacity: 1, 13084 scale: 1 13085 }, 13086 next: { 13087 translate: [ 13088 0, 13089 0, 13090 0 13091 ], 13092 rotate: [ 13093 0, 13094 0, 13095 0 13096 ], 13097 opacity: 1, 13098 scale: 1 13099 } 13100 } 13101 }); 13102 const getTranslateValue = (value)=>{ 13103 if (typeof value === 'string') return value; 13104 return `${value}px`; 13105 }; 13106 const setTranslate = ()=>{ 13107 const { slides, $wrapperEl, slidesSizesGrid } = swiper; 13108 const params = swiper.params.creativeEffect; 13109 const { progressMultiplier: multiplier } = params; 13110 const isCenteredSlides = swiper.params.centeredSlides; 13111 if (isCenteredSlides) { 13112 const margin = slidesSizesGrid[0] / 2 - swiper.params.slidesOffsetBefore || 0; 13113 $wrapperEl.transform(`translateX(calc(50% - ${margin}px))`); 13114 } 13115 for(let i = 0; i < slides.length; i += 1){ 13116 const $slideEl = slides.eq(i); 13117 const slideProgress = $slideEl[0].progress; 13118 const progress = Math.min(Math.max($slideEl[0].progress, -params.limitProgress), params.limitProgress); 13119 let originalProgress = progress; 13120 if (!isCenteredSlides) originalProgress = Math.min(Math.max($slideEl[0].originalProgress, -params.limitProgress),
13120params.limitProgress); 13121 const offset = $slideEl[0].swiperSlideOffset; 13122 const t = [ 13123 swiper.params.cssMode ? -offset - swiper.translate : -offset, 13124 0, 13125 0 13126 ]; 13127 const r = [ 13128 0, 13129 0, 13130 0 13131 ]; 13132 let custom = false; 13133 if (!swiper.isHorizontal()) { 13134 t[1] = t[0]; 13135 t[0] = 0; 13136 } 13137 let data = { 13138 translate: [ 13139 0, 13140 0, 13141 0 13142 ], 13143 rotate: [ 13144 0, 13145 0, 13146 0 13147 ], 13148 scale: 1, 13149 opacity: 1 13150 }; 13151 if (progress < 0) { 13152 data = params.next; 13153 custom = true; 13154 } else if (progress > 0) { 13155 data = params.prev; 13156 custom = true; 13157 } // set translate 13158 t.forEach((value, index)=>{ 13159 t[index] = `calc(${value}px + (${getTranslateValue(data.translate[index])} * ${Math.abs(progress * multiplier)}))`; 13160 }); // set rotates 13161 r.forEach((value, index)=>{ 13162 r[index] = data.rotate[index] * Math.abs(progress * multiplier); 13163 }); 13164 $slideEl[0].style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length; 13165 const translateString = t.join(', '); 13166 const rotateString = `rotateX(${r[0]}deg) rotateY(${r[1]}deg) rotateZ(${r[2]}deg)`; 13167 const scaleString = originalProgress < 0 ? `scale(${1 + (1 - data.scale) * originalProgress * multiplier})` : `scale(${1 - (1 - data.scale) * originalProgress * multiplier})`; 13168 const opacityString = originalProgress < 0 ? 1 + (1 - data.opacity) * originalProgress * multiplier : 1 - (1 - data.opacity) * originalProgress * multiplier; 13169 const transform = `translate3d(${translateString}) ${rotateString} ${scaleString}`; // Set shadows 13170 if (custom && data.shadow || !custom) { 13171 let $shadowEl = $slideEl.children('.swiper-slide-shadow'); 13172 if ($shadowEl.length === 0 && data.shadow) $shadowEl = createShadow(params, $slideEl); 13173 if ($shadowEl.length) { 13174 const shadowOpacity = params.shadowPerProgress ? progress * (1 / params.limitProgress) : progress; 13175 $shadowEl[0].style.opacity = Math.min(Math.max(Math.abs(shadowOpacity), 0), 1); 13176 } 13177 } 13178 const $targetEl = effectTarget(params, $slideEl); 13179 $targetEl.transform(transform).css({ 13180 opacity: opacityString 13181 }); 13182 if (data.origin) $targetEl.css('transform-origin', data.origin); 13183 } 13184 }; 13185 const setTransition = (duration)=>{ 13186 const { transformEl } = swiper.params.creativeEffect; 13187 const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; 13188 $transitionElements.transition(duration).find('.swiper-slide-shadow').transition(duration); 13189 effectVirtualTransitionEnd({ 13190 swiper, 13191 duration, 13192 transformEl, 13193 allSlides: true 13194 }); 13195 }; 13196 effectInit({ 13197 effect: 'creative', 13198 swiper, 13199 on, 13200 setTranslate, 13201 setTransition, 13202 perspective: ()=>swiper.params.creativeEffect.perspective, 13203 overwriteParams: ()=>({ 13204 watchSlidesProgress: true, 13205 virtualTranslate: !swiper.params.cssMode 13206 }) 13207 }); 13208 } 13209 function EffectCards(_ref) { 13210 let { swiper, extendParams, on } = _ref; 13211 extendParams({ 13212 cardsEffect: { 13213 slideShadows: true, 13214 transformEl: null, 13215 rotate: true, 13216 perSlideRotate: 2, 13217 perSlideOffset: 8 13218 } 13219 }); 13220 const setTranslate = ()=>{ 13221 const { slides, activeIndex } = swiper; 13222 const params = swiper.params.cardsEffect; 13223 const { startTranslate, isTouched } = swiper.touchEventsData; 13224 const currentTranslate = swiper.translate; 13225 for(let i = 0; i < slides.length; i += 1){ 13226 const $slideEl = slides.eq(i); 13227 const slideProgress = $slideEl[0].progress; 13228 const progress = Math.min(Math.max(slideProgress, -4), 4); 13229 let offset = $slideEl[0].swiperSlideOffset; 13230 if (swiper.params.centeredSlides && !swiper.params.cssMode) swiper.$wrapperEl.transform(`translateX(${swiper.minTranslate()}px)`); 13231 if (swiper.params.centeredSlides && swiper.params.cssMode) offset -= slides[0].swiperSlideOffset; 13232 let tX = swiper.params.cssMode ? -offset - swiper.translate : -offset; 13233 let tY = 0; 13234 const tZ = -100 * Math.abs(progress); 13235 let scale = 1; 13236 let rotate = -params.perSlideRotate * progress; 13237 let tXAdd = params.perSlideOffset - Math.abs(progress) * 0.75; 13238 const slideIndex = swiper.virtual && swiper.params.virtual.enabled ? swiper.virtual.from + i : i; 13239 const isSwipeToNext = (slideIndex === activeIndex || slideIndex === activeIndex - 1) && progress > 0 && progress < 1 && (isTouched || swiper.params.cssMode) && currentTranslate < startTranslate; 13240 const isSwipeToPrev = (slideIndex === activeIndex || slideIndex === activeIndex + 1) && progress < 0 && progress > -1 && (isTouched || swiper.params.cssMode) && currentTranslate > startTranslate; 13241 if (isSwipeToNext || isSwipeToPrev) { 13242 const subProgress = (1 - Math.abs((Math.abs(progress) - 0.5) / 0.5)) ** 0.5; 13243 rotate += -28 * progress * subProgress; 13244 scale += -0.5 * subProgress; 13245 tXAdd += 96 * subProgress; 13246 tY = `${-25 * subProgress * Math.abs(progress)}%`; 13247 } 13248 if (progress < 0) // next 13249 tX = `calc(${tX}px + (${tXAdd * Math.abs(progress)}%))`;
13250 else if (progress > 0) // prev 13251 tX = `calc(${tX}px + (-${tXAdd * Math.abs(progress)}%))`; 13252 else tX = `${tX}px`; 13253 if (!swiper.isHorizontal()) { 13254 const prevY = tY; 13255 tY = tX; 13256 tX = prevY; 13257 } 13258 const scaleString = progress < 0 ? `${1 + (1 - scale) * progress}` : `${1 - (1 - scale) * progress}`; 13259 const transform = ` 13260 translate3d(${tX}, ${tY}, ${tZ}px) 13261 rotateZ(${params.rotate ? rotate : 0}deg) 13262 scale(${scaleString}) 13263 `; 13264 if (params.slideShadows) { 13265 // Set shadows 13266 let $shadowEl = $slideEl.find('.swiper-slide-shadow'); 13267 if ($shadowEl.length === 0) $shadowEl = createShadow(params, $slideEl); 13268 if ($shadowEl.length) $shadowEl[0].style.opacity = Math.min(Math.max((Math.abs(progress) - 0.5) / 0.5, 0), 1); 13269 } 13270 $slideEl[0].style.zIndex = -Math.abs(Math.round(slideProgress)) + slides.length; 13271 const $targetEl = effectTarget(params, $slideEl); 13272 $targetEl.transform(transform); 13273 } 13274 }; 13275 const setTransition = (duration)=>{ 13276 const { transformEl } = swiper.params.cardsEffect; 13277 const $transitionElements = transformEl ? swiper.slides.find(transformEl) : swiper.slides; 13278 $transitionElements.transition(duration).find('.swiper-slide-shadow').transition(duration); 13279 effectVirtualTransitionEnd({ 13280 swiper, 13281 duration, 13282 transformEl 13283 }); 13284 }; 13285 effectInit({ 13286 effect: 'cards', 13287 swiper, 13288 on, 13289 setTranslate, 13290 setTransition, 13291 perspective: ()=>true, 13292 overwriteParams: ()=>({ 13293 watchSlidesProgress: true, 13294 virtualTranslate: !swiper.params.cssMode 13295 }) 13296 }); 13297 } 13298 // Swiper Class 13299 const modules = [ 13300 Virtual, 13301 Keyboard, 13302 Mousewheel, 13303 Navigation, 13304 Pagination, 13305 Scrollbar, 13306 Parallax, 13307 Zoom, 13308 Lazy, 13309 Controller, 13310 A11y, 13311 History, 13312 HashNavigation, 13313 Autoplay, 13314 Thumb, 13315 freeMode, 13316 Grid, 13317 Manipulation, 13318 EffectFade, 13319 EffectCube, 13320 EffectFlip, 13321 EffectCoverflow, 13322 EffectCreative, 13323 EffectCards 13324 ]; 13325 Swiper.use(modules); 13326 return Swiper; 13327}); 13328 13329},{}],"4ZDmT":[function() {},{}],"dH8qc":[function(require,module,exports,__globalThis) { 13330var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 13331parcelHelpers.defineInteropFlag(exports); 13332parcelHelpers.export(exports, "isMobile", ()=>isMobile); 13333parcelHelpers.export(exports, "isTablet", ()=>isTablet); 13334parcelHelpers.export(exports, "isDesktop", ()=>isDesktop); 13335parcelHelpers.export(exports, "deviceTypeByWidth", ()=>deviceTypeByWidth); 13336parcelHelpers.export(exports, "getOffsetTop", ()=>getOffsetTop); 13337parcelHelpers.export(exports, "getURLParameter", ()=>getURLParameter); 13338parcelHelpers.export(exports, "isWoocommerceUrl", ()=>isWoocommerceUrl); 13339parcelHelpers.export(exports, "isAdminUrl", ()=>isAdminUrl); 13340parcelHelpers.export(exports, "setCookie", ()=>setCookie); 13341parcelHelpers.export(exports, "getCookie", ()=>getCookie); 13342parcelHelpers.export(exports, "eraseCookie", ()=>eraseCookie); 13343parcelHelpers.export(exports, "postRequest", ()=>postRequest); 13344parcelHelpers.export(exports, "decodedString", ()=>decodedString); 13345parcelHelpers.export(exports, "usingMobileDevice", ()=>usingMobileDevice); 13346var _uaParserJs = require("ua-parser-js"); 13347const isMobile = ()=>window.innerWidth < 768; 13348const isTablet = ()=>window.innerWidth >= 768 && window.innerWidth < 1199; 13349const isDesktop = ()=>window.innerWidth >= 1200; 13350const deviceTypeByWidth = ()=>{ 13351 if (isMobile()) return 'mobile'; 13352 if (isTablet()) return 'tablet'; 13353 if (isDesktop()) return 'desktop'; 13354}; 13355const getOffsetTop = function(elem) { 13356 // Set our distance placeholder 13357 var distance = 0; 13358 // Loop up the DOM 13359 if (elem.offsetParent) do { 13360 distance += elem.offsetTop; 13361 elem = elem.offsetParent; 13362 }while (elem); 13363 // Return our distance 13364 return distance < 0 ? 0 : distance; 13365}; 13366const getURLParameter = (sParam)=>{ 13367 const sPageURL = window.location.search.substring(1); 13368 const sURLVariables = sPageURL.split('&'); 13369 for(let i = 0; i < sURLVariables.length; i++){ 13370 const sParameterName = sURLVariables[i].split('='); 13371 if (sParameterName[0] == sParam) return sParameterName[1]; 13372 } 13373}; 13374const isWoocommerceUrl = (url = '')=>{ 13375 const urlHasSubstring = (substring)=>url.indexOf(substring) > -1; 13376 const substrings = [ 13377 '/checkout', 13378 '/cart', 13379 '/product/', 13380 'gifts/account' 13381 ]; 13382 return substrings.some(urlHasSubstring); 13383}; 13384const isAdminUrl = (url = '')=>{ 13385 const urlHasSubstring = (substring)=>url.indexOf(substring) > -1; 13386 const substrings = [ 13387 '/wp-admin' 13388 ]; 13389 return substrings.some(urlHasSubstring); 13390};
13391const setCookie = (name, value, days)=>{ 13392 var expires = ""; 13393 if (days) { 13394 var date = new Date(); 13395 date.setTime(date.getTime() + days * 86400000); 13396 expires = "; expires=" + date.toUTCString(); 13397 } 13398 document.cookie = name + "=" + (value || "") + expires + "; path=/"; 13399}; 13400const getCookie = (name)=>{ 13401 var nameEQ = name + "="; 13402 var ca = document.cookie.split(';'); 13403 for(var i = 0; i < ca.length; i++){ 13404 var c = ca[i]; 13405 while(c.charAt(0) == ' ')c = c.substring(1, c.length); 13406 if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); 13407 } 13408 return null; 13409}; 13410const eraseCookie = (name)=>{ 13411 document.cookie = name + '=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;'; 13412}; 13413const postRequest = async function(data) { 13414 const response = await fetch(igniteJsVars.ajaxurl, { 13415 method: "POST", 13416 body: data 13417 }); 13418 if (!response.ok) throw new Error(`[${response.status}] ${response.statusText}`); 13419 const responseJson = await response.json(); 13420 return responseJson; 13421}; 13422const decodedString = (encodedString)=>{ 13423 const textarea = document.createElement('textarea'); 13424 textarea.innerHTML = encodedString; 13425 return textarea.value; 13426}; 13427const usingMobileDevice = ()=>{ 13428 const { device } = (0, _uaParserJs.UAParser)(navigator.userAgent); 13429 let isMobile = false; 13430 switch(device.type){ 13431 case 'console': 13432 case 'embedded': 13433 case 'mobile': 13434 case 'smarttv': 13435 case 'tablet': 13436 case 'wearable': 13437 case 'xr': 13438 isMobile = true; 13439 break; 13440 default: 13441 isMobile = false; 13442 } 13443 return isMobile; 13444}; 13445function setFullHeight() { 13446 document.documentElement.style.setProperty('--vh', `${window.screen.height * 0.01}px`); 13447// const vh = getComputedStyle(document.documentElement) 13448// .getPropertyValue('--vh') 13449// .trim(); 13450// document.querySelectorAll('.popup').forEach((popup) => { 13451// let heading = popup.querySelector('h2[data-vh-readout]'); 13452// if (!heading) { 13453// heading = document.createElement('h2'); 13454// heading.setAttribute('data-vh-readout', ''); 13455// popup.prepend(heading); 13456// } 13457// heading.textContent = vh; 13458// }); 13459} 13460window.addEventListener('resize', setFullHeight); 13461setFullHeight(); 13462 13463},{"ua-parser-js":"4G4Hm","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4G4Hm":[function(require,module,exports,__globalThis) { 13464/* UAParser.js v2.0.4 13465 Copyright © 2012-2025 Faisal Salman <[email protected]> 13466 AGPLv3 License */ ((i, l)=>{ 13467 function I(i) { 13468 for(var e = {}, t = 0; t < i.length; t++)e[i[t].toUpperCase()] = i[t]; 13469 return e; 13470 } 13471 var U = 500, P = "user-agent", w = "", B = "?", R = "function", n = "undefined", c = "object", L = "string", u = "browser", h = "cpu", p = "device", m = "engine", f = "os", g = "result", v = "name", k = "type", x = "vendor", y = "version", C = "architecture", G = "major", S = "model", W = "console", _ = "mobile", r = "tablet", e = "smarttv", t = "wearable", N = "xr", F = "embedded", D = "inapp", $ = "brands", q = "formFactors", X = "fullVersionList", z = "platform", Y = "platformVersion", Q = "bitness", o = "sec-ch-ua", Z = o + "-full-version-list", K = o + "-arch", J = o + "-" + Q, ii = o + "-form-factors", ei = o + "-" + _, ti = o + "-" + S, oi = o + "-" + z, ri = oi + "-version", ai = [ 13472 $, 13473 X, 13474 _, 13475 S, 13476 z, 13477 Y, 13478 C, 13479 q, 13480 Q 13481 ], si = "Amazon", a = "Apple", ni = "ASUS", wi = "BlackBerry", s = "Google", bi = "Huawei", di = "Lenovo", li = "Microsoft", ci = "Motorola", ui = "Nvidia", hi = "OnePlus", pi = "OPPO", mi = "Samsung", fi = "Sony", gi = "Xiaomi", vi = "Zebra", ki = "Chromium", b = "Chromecast", xi = "Edge", yi = "Firefox", d = "Opera", Ci = "Facebook", T = "Mobile ", Si = " Browser", _i = "Windows", qi = typeof i !== n, A = qi && i.navigator ? i.navigator : l, H = A && A.userAgentData ? A.userAgentData : l, zi = function(i, e) { 13482 if (typeof i === c && 0 < i.length) { 13483 for(var t in i)if (j(e) == j(i[t])) return !0; 13484 return !1; 13485 } 13486 return !!O(i) && j(e) == j(i); 13487 }, Ti = function(i, e) {
13488 for(var t in i)return /^(browser|cpu|device|engine|os)$/.test(t) || !!e && Ti(i[t]); 13489 }, O = function(i) { 13490 return typeof i === L; 13491 }, Ai = function(i) { 13492 if (!i) return l; 13493 for(var e, t = [], o = Oi(/\\?\"/g, i).split(","), r = 0; r < o.length; r++)-1 < o[r].indexOf(";") ? (e = Mi(o[r]).split(";v="), t[r] = { 13494 brand: e[0], 13495 version: e[1] 13496 }) : t[r] = Mi(o[r]); 13497 return t; 13498 }, j = function(i) { 13499 return O(i) ? i.toLowerCase() : i; 13500 }, Hi = function(i) { 13501 return O(i) ? Oi(/[^\d\.]/g, i).split(".")[0] : l; 13502 }, M = function(i) { 13503 for(var e in i){ 13504 e = i[e]; 13505 typeof e == c && 2 == e.length ? this[e[0]] = e[1] : this[e] = l; 13506 } 13507 return this; 13508 }, Oi = function(i, e) { 13509 return O(e) ? e.replace(i, w) : e; 13510 }, ji = function(i) { 13511 return Oi(/\\?\"/g, i); 13512 }, Mi = function(i, e) { 13513 if (O(i)) return i = Oi(/^\s\s*/, i), typeof e === n ? i : i.substring(0, U); 13514 }, Ei = function(i, e) { 13515 if (i && e) for(var t, o, r, a, s, n = 0; n < e.length && !a;){ 13516 for(var w = e[n], b = e[n + 1], d = t = 0; d < w.length && !a && w[d];)if (a = w[d++].exec(i)) for(o = 0; o < b.length; o++)s = a[++t], typeof (r = b[o]) === c && 0 < r.length ? 2 === r.length ? typeof r[1] == R ? this[r[0]] = r[1].call(this, s) : this[r[0]] = r[1] : 3 <= r.length && (typeof r[1] !== R || r[1].exec && r[1].test ? 3 == r.length ? this[r[0]] = s ? s.replace(r[1], r[2]) : l : 4 == r.length ? this[r[0]] = s ? r[3].call(this, s.replace(r[1], r[2])) : l : 4 < r.length && (this[r[0]] = s ? r[3].apply(this, [ 13517 s.replace(r[1], r[2]) 13518 ].concat(r.slice(4))) : l) : 3 < r.length ? this[r[0]] = s ? r[1].apply(this, r.slice(2)) : l : this[r[0]] = s ? r[1].call(this, s, r[2]) : l) : this[r] = s || l; 13519 n += 2; 13520 } 13521 }, E = function(i, e) { 13522 for(var t in e)if (typeof e[t] === c && 0 < e[t].length) { 13523 for(var o = 0; o < e[t].length; o++)if (zi(e[t][o], i)) return t === B ? l : t; 13524 } else if (zi(e[t], i)) return t === B ? l : t; 13525 return e.hasOwnProperty("*") ? e["*"] : i; 13526 }, Vi = { 13527 ME: "4.90", 13528 "NT 3.51": "3.51", 13529 "NT 4.0": "4.0", 13530 2e3: [ 13531 "5.0", 13532 "5.01" 13533 ], 13534 XP: [ 13535 "5.1", 13536 "5.2" 13537 ], 13538 Vista: "6.0", 13539 7: "6.1", 13540 8: "6.2", 13541 8.1: "6.3", 13542 10: [ 13543 "6.4", 13544 "10.0" 13545 ], 13546 NT: "" 13547 }, Ii = { 13548 embedded: "Automotive", 13549 mobile: "Mobile", 13550 tablet: [ 13551 "Tablet", 13552 "EInk" 13553 ], 13554 smarttv: "TV", 13555 wearable: "Watch", 13556 xr: [ 13557 "VR", 13558 "XR" 13559 ], 13560 "?": [ 13561 "Desktop", 13562 "Unknown" 13563 ], 13564 "*": l 13565 }, Ui = { 13566 Chrome: "Google Chrome", 13567 Edge: "Microsoft Edge", 13568 "Edge WebView2": "Microsoft Edge WebView2", 13569 "Chrome WebView": "Android WebView", 13570 "Chrome Headless": "HeadlessChrome", 13571 "Huawei Browser": "HuaweiBrowser", 13572 "MIUI Browser": "Miui Browser", 13573 "Opera Mobi": "OperaMobile", 13574 Yandex: "YaBrowser" 13575 }, Pi = { 13576 browser: [ 13577 [ 13578 /\b(?:crmo|crios)\/([\w\.]+)/i 13579 ], 13580 [ 13581 y, 13582 [ 13583 v, 13584 T + "Chrome" 13585 ] 13586 ], 13587 [ 13588 /webview.+edge\/([\w\.]+)/i 13589 ], 13590 [ 13591 y, 13592 [ 13593 v, 13594 xi + " WebView" 13595 ] 13596 ], 13597 [ 13598 /edg(?:e|ios|a)?\/([\w\.]+)/i 13599 ], 13600 [ 13601 y, 13602 [ 13603 v, 13604 "Edge" 13605 ] 13606 ], 13607 [ 13608 /(opera mini)\/([-\w\.]+)/i, 13609 /(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i, 13610 /(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i 13611 ], 13612 [ 13613 v, 13614 y 13615 ], 13616 [ 13617 /opios[\/ ]+([\w\.]+)/i 13618 ], 13619 [ 13620 y, 13621 [ 13622 v, 13623 d + " Mini" 13624 ] 13625 ], 13626 [ 13627 /\bop(?:rg)?x\/([\w\.]+)/i 13628 ], 13629 [ 13630 y, 13631 [ 13632 v, 13633 d + " GX" 13634 ] 13635 ], 13636 [ 13637 /\bopr\/([\w\.]+)/i 13638 ], 13639 [ 13640 y, 13641 [ 13642 v, 13643 d 13644 ] 13645 ], 13646 [ 13647 /\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i 13648 ], 13649 [ 13650 y, 13651 [ 13652 v, 13653 "Baidu" 13654 ] 13655 ], 13656 [ 13657 /\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i 13658 ], 13659 [ 13660 y, 13661 [ 13662 v, 13663 "Maxthon" 13664 ] 13665 ], 13666 [ 13667 /(kindle)\/([\w\.]+)/i, 13668 /(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i, 13669 /(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i, 13670 /(?:ms|\()(ie) ([\w\.]+)/i, 13671 /(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon|otter|dooble|(?:lg |qute)browser)\/([-\w\.]+)/i, 13672 /(heytap|ovi|115|surf)browser\/([\d\.]+)/i, 13673 /(ecosia|weibo)(?:__| \w+@)([\d\.]+)/i 13674 ], 13675 [ 13676 v, 13677 y 13678 ], 13679 [ 13680 /quark(?:pc)?\/([-\w\.]+)/i 13681 ], 13682 [ 13683 y, 13684 [ 13685 v, 13686 "Quark" 13687 ] 13688 ], 13689 [ 13690 /\bddg\/([\w\.]+)/i 13691 ], 13692 [ 13693 y, 13694 [ 13695 v, 13696 "DuckDuckGo" 13697 ] 13698 ], 13699 [ 13700 /(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i 13701 ], 13702 [ 13703 y, 13704 [ 13705 v, 13706 "UCBrowser" 13707 ] 13708 ], 13709 [ 13710 /microm.+\bqbcore\/([\w\.]+)/i, 13711 /\bqbcore\/([\w\.]+).+microm/i, 13712 /micromessenger\/([\w\.]+)/i 13713 ], 13714 [ 13715 y, 13716 [ 13717 v, 13718 "WeChat" 13719 ] 13720 ], 13721 [ 13722 /konqueror\/([\w\.]+)/i 13723 ], 13724 [ 13725 y, 13726 [ 13727 v, 13728 "Konqueror" 13729 ] 13730 ], 13731 [ 13732 /trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i 13733 ], 13734 [ 13735 y, 13736 [ 13737 v, 13738 "IE" 13739 ] 13740 ], 13741 [ 13742 /ya(?:search)?browser\/([\w\.]+)/i 13743 ], 13744 [ 13745 y, 13746 [ 13747 v, 13748 "Yandex" 13749 ] 13750 ], 13751 [ 13752 /slbrowser\/([\w\.]+)/i 13753 ], 13754 [ 13755 y, 13756 [ 13757 v, 13758 "Smart " + di + Si 13759 ] 13760 ], 13761 [ 13762 /(avast|avg)\/([\w\.]+)/i 13763 ], 13764 [ 13765 [ 13766 v,
vendor: 10,944 bytes, lines 13767-14239
13767 /(.+)/, 13768 "$1 Secure" + Si 13769 ], 13770 y 13771 ], 13772 [ 13773 /\bfocus\/([\w\.]+)/i 13774 ], 13775 [ 13776 y, 13777 [ 13778 v, 13779 yi + " Focus" 13780 ] 13781 ], 13782 [ 13783 /\bopt\/([\w\.]+)/i 13784 ], 13785 [ 13786 y, 13787 [ 13788 v, 13789 d + " Touch" 13790 ] 13791 ], 13792 [ 13793 /coc_coc\w+\/([\w\.]+)/i 13794 ], 13795 [ 13796 y, 13797 [ 13798 v, 13799 "Coc Coc" 13800 ] 13801 ], 13802 [ 13803 /dolfin\/([\w\.]+)/i 13804 ], 13805 [ 13806 y, 13807 [ 13808 v, 13809 "Dolphin" 13810 ] 13811 ], 13812 [ 13813 /coast\/([\w\.]+)/i 13814 ], 13815 [ 13816 y, 13817 [ 13818 v, 13819 d + " Coast" 13820 ] 13821 ], 13822 [ 13823 /miuibrowser\/([\w\.]+)/i 13824 ], 13825 [ 13826 y, 13827 [ 13828 v, 13829 "MIUI" + Si 13830 ] 13831 ], 13832 [ 13833 /fxios\/([\w\.-]+)/i 13834 ], 13835 [ 13836 y, 13837 [ 13838 v, 13839 T + yi 13840 ] 13841 ], 13842 [ 13843 /\bqihoobrowser\/?([\w\.]*)/i 13844 ], 13845 [ 13846 y, 13847 [ 13848 v, 13849 "360" 13850 ] 13851 ], 13852 [ 13853 /\b(qq)\/([\w\.]+)/i 13854 ], 13855 [ 13856 [ 13857 v, 13858 /(.+)/, 13859 "$1Browser" 13860 ], 13861 y 13862 ], 13863 [ 13864 /(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i 13865 ], 13866 [ 13867 [ 13868 v, 13869 /(.+)/, 13870 "$1" + Si 13871 ], 13872 y 13873 ], 13874 [ 13875 /samsungbrowser\/([\w\.]+)/i 13876 ], 13877 [ 13878 y, 13879 [ 13880 v, 13881 mi + " Internet" 13882 ] 13883 ], 13884 [ 13885 /metasr[\/ ]?([\d\.]+)/i 13886 ], 13887 [ 13888 y, 13889 [ 13890 v, 13891 "Sogou Explorer" 13892 ] 13893 ], 13894 [ 13895 /(sogou)mo\w+\/([\d\.]+)/i 13896 ], 13897 [ 13898 [ 13899 v, 13900 "Sogou Mobile" 13901 ], 13902 y 13903 ], 13904 [ 13905 /(electron)\/([\w\.]+) safari/i, 13906 /(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i, 13907 /m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i 13908 ], 13909 [ 13910 v, 13911 y 13912 ], 13913 [ 13914 /(lbbrowser|rekonq)/i 13915 ], 13916 [ 13917 v 13918 ], 13919 [ 13920 /ome\/([\w\.]+) \w* ?(iron) saf/i, 13921 /ome\/([\w\.]+).+qihu (360)[es]e/i 13922 ], 13923 [ 13924 y, 13925 v 13926 ], 13927 [ 13928 /((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i 13929 ], 13930 [ 13931 [ 13932 v, 13933 Ci 13934 ], 13935 y, 13936 [ 13937 k, 13938 D 13939 ] 13940 ], 13941 [ 13942 /(kakao(?:talk|story))[\/ ]([\w\.]+)/i, 13943 /(naver)\(.*?(\d+\.[\w\.]+).*\)/i, 13944 /(daum)apps[\/ ]([\w\.]+)/i, 13945 /safari (line)\/([\w\.]+)/i, 13946 /\b(line)\/([\w\.]+)\/iab/i, 13947 /(alipay)client\/([\w\.]+)/i, 13948 /(twitter)(?:and| f.+e\/([\w\.]+))/i, 13949 /(instagram|snapchat|klarna)[\/ ]([-\w\.]+)/i 13950 ], 13951 [ 13952 v, 13953 y, 13954 [ 13955 k, 13956 D 13957 ] 13958 ], 13959 [ 13960 /\bgsa\/([\w\.]+) .*safari\//i 13961 ], 13962 [ 13963 y, 13964 [ 13965 v, 13966 "GSA" 13967 ], 13968 [ 13969 k, 13970 D 13971 ] 13972 ], 13973 [ 13974 /musical_ly(?:.+app_?version\/|_)([\w\.]+)/i 13975 ], 13976 [ 13977 y, 13978 [ 13979 v, 13980 "TikTok" 13981 ], 13982 [ 13983 k, 13984 D 13985 ] 13986 ], 13987 [ 13988 /\[(linkedin)app\]/i 13989 ], 13990 [ 13991 v, 13992 [ 13993 k, 13994 D 13995 ] 13996 ], 13997 [ 13998 /(chromium)[\/ ]([-\w\.]+)/i 13999 ], 14000 [ 14001 v, 14002 y 14003 ], 14004 [ 14005 /headlesschrome(?:\/([\w\.]+)| )/i 14006 ], 14007 [ 14008 y, 14009 [ 14010 v, 14011 "Chrome Headless" 14012 ] 14013 ], 14014 [ 14015 /wv\).+chrome\/([\w\.]+).+edgw\//i 14016 ], 14017 [ 14018 y, 14019 [ 14020 v, 14021 xi + " WebView2" 14022 ] 14023 ], 14024 [ 14025 / wv\).+(chrome)\/([\w\.]+)/i 14026 ], 14027 [ 14028 [ 14029 v, 14030 "Chrome WebView" 14031 ], 14032 y 14033 ], 14034 [ 14035 /droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i 14036 ], 14037 [ 14038 y, 14039 [ 14040 v, 14041 "Android" + Si 14042 ] 14043 ], 14044 [ 14045 /chrome\/([\w\.]+) mobile/i 14046 ], 14047 [ 14048 y, 14049 [ 14050 v, 14051 T + "Chrome" 14052 ] 14053 ], 14054 [ 14055 /(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i 14056 ], 14057 [ 14058 v, 14059 y 14060 ], 14061 [ 14062 /version\/([\w\.\,]+) .*mobile(?:\/\w+ | ?)safari/i 14063 ], 14064 [ 14065 y, 14066 [ 14067 v, 14068 T + "Safari" 14069 ] 14070 ], 14071 [ 14072 /iphone .*mobile(?:\/\w+ | ?)safari/i 14073 ], 14074 [ 14075 [ 14076 v, 14077 T + "Safari" 14078 ] 14079 ], 14080 [ 14081 /version\/([\w\.\,]+) .*(safari)/i 14082 ], 14083 [ 14084 y, 14085 v 14086 ], 14087 [ 14088 /webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i 14089 ], 14090 [ 14091 v, 14092 [ 14093 y, 14094 "1" 14095 ] 14096 ], 14097 [ 14098 /(webkit|khtml)\/([\w\.]+)/i 14099 ], 14100 [ 14101 v, 14102 y 14103 ], 14104 [ 14105 /(?:mobile|tablet);.*(firefox)\/([\w\.-]+)/i 14106 ], 14107 [ 14108 [ 14109 v, 14110 T + yi 14111 ], 14112 y 14113 ], 14114 [ 14115 /(navigator|netscape\d?)\/([-\w\.]+)/i 14116 ], 14117 [ 14118 [ 14119 v, 14120 "Netscape" 14121 ], 14122 y 14123 ], 14124 [ 14125 /(wolvic|librewolf)\/([\w\.]+)/i 14126 ], 14127 [ 14128 v, 14129 y 14130 ], 14131 [ 14132 /mobile vr; rv:([\w\.]+)\).+firefox/i 14133 ], 14134 [ 14135 y, 14136 [ 14137 v, 14138 yi + " Reality" 14139 ] 14140 ], 14141 [ 14142 /ekiohf.+(flow)\/([\w\.]+)/i, 14143 /(swiftfox)/i, 14144 /(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i, 14145 /(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i, 14146 /(firefox)\/([\w\.]+)/i, 14147 /(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i, 14148 /(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i, 14149 /\b(links) \(([\w\.]+)/i 14150 ], 14151 [ 14152 v, 14153 [ 14154 y, 14155 /_/g, 14156 "." 14157 ] 14158 ], 14159 [ 14160 /(cobalt)\/([\w\.]+)/i 14161 ], 14162 [ 14163 v, 14164 [ 14165 y, 14166 /[^\d\.]+./, 14167 w 14168 ] 14169 ] 14170 ], 14171 cpu: [ 14172 [ 14173 /\b((amd|x|x86[-_]?|wow|win)64)\b/i 14174 ], 14175 [ 14176 [ 14177 C, 14178 "amd64" 14179 ] 14180 ], 14181 [ 14182 /(ia32(?=;))/i, 14183 /\b((i[346]|x)86)(pc)?\b/i 14184 ], 14185 [ 14186 [ 14187 C, 14188 "ia32" 14189 ] 14190 ], 14191 [ 14192 /\b(aarch64|arm(v?[89]e?l?|_?64))\b/i 14193 ], 14194 [ 14195 [ 14196 C, 14197 "arm64" 14198 ] 14199 ], 14200 [ 14201 /\b(arm(v[67])?ht?n?[fl]p?)\b/i 14202 ], 14203 [ 14204 [ 14205 C, 14206 "armhf" 14207 ] 14208 ], 14209 [ 14210 /( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i 14211 ], 14212 [ 14213 [ 14214 C, 14215 "arm" 14216 ] 14217 ], 14218 [ 14219 /((ppc|powerpc)(64)?)( mac|;|\))/i 14220 ], 14221 [ 14222 [ 14223 C, 14224 /ower/, 14225 w, 14226 j 14227 ] 14228 ], 14229 [ 14230 / sun4\w[;\)]/i 14231 ], 14232 [ 14233 [ 14234 C, 14235 "sparc" 14236 ] 14237 ], 14238 [ 14239 /\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;
vendor: 4,557 bytes, lines 14239-14415
14239|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i 14240 ], 14241 [ 14242 [ 14243 C, 14244 j 14245 ] 14246 ] 14247 ], 14248 device: [ 14249 [ 14250 /\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i 14251 ], 14252 [ 14253 S, 14254 [ 14255 x, 14256 mi 14257 ], 14258 [ 14259 k, 14260 r 14261 ] 14262 ], 14263 [ 14264 /\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i, 14265 /samsung[- ]((?!sm-[lr]|browser)[-\w]+)/i, 14266 /sec-(sgh\w+)/i 14267 ], 14268 [ 14269 S, 14270 [ 14271 x, 14272 mi 14273 ], 14274 [ 14275 k, 14276 _ 14277 ] 14278 ], 14279 [ 14280 /(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i 14281 ], 14282 [ 14283 S, 14284 [ 14285 x, 14286 a 14287 ], 14288 [ 14289 k, 14290 _ 14291 ] 14292 ], 14293 [ 14294 /\((ipad);[-\w\),; ]+apple/i, 14295 /applecoremedia\/[\w\.]+ \((ipad)/i, 14296 /\b(ipad)\d\d?,\d\d?[;\]].+ios/i 14297 ], 14298 [ 14299 S, 14300 [ 14301 x, 14302 a 14303 ], 14304 [ 14305 k, 14306 r 14307 ] 14308 ], 14309 [ 14310 /(macintosh);/i 14311 ], 14312 [ 14313 S, 14314 [ 14315 x, 14316 a 14317 ] 14318 ], 14319 [ 14320 /\b(sh-?[altvz]?\d\d[a-ekm]?)/i 14321 ], 14322 [ 14323 S, 14324 [ 14325 x, 14326 "Sharp" 14327 ], 14328 [ 14329 k, 14330 _ 14331 ] 14332 ], 14333 [ 14334 /\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i 14335 ], 14336 [ 14337 S, 14338 [ 14339 x, 14340 "Honor" 14341 ], 14342 [ 14343 k, 14344 r 14345 ] 14346 ], 14347 [ 14348 /honor([-\w ]+)[;\)]/i 14349 ], 14350 [ 14351 S, 14352 [ 14353 x, 14354 "Honor" 14355 ], 14356 [ 14357 k, 14358 _ 14359 ] 14360 ], 14361 [ 14362 /\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i 14363 ], 14364 [ 14365 S, 14366 [ 14367 x, 14368 bi 14369 ], 14370 [ 14371 k, 14372 r 14373 ] 14374 ], 14375 [ 14376 /(?:huawei)([-\w ]+)[;\)]/i, 14377 /\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i 14378 ], 14379 [ 14380 S, 14381 [ 14382 x, 14383 bi 14384 ], 14385 [ 14386 k, 14387 _ 14388 ] 14389 ], 14390 [ 14391 /oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i, 14392 /\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i 14393 ], 14394 [ 14395 [ 14396 S, 14397 /_/g, 14398 " " 14399 ], 14400 [ 14401 x, 14402 gi 14403 ], 14404 [ 14405 k, 14406 r 14407 ] 14408 ], 14409 [ 14410 /\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i, 14411 /\b; (\w+) build\/hm\1/i, 14412 /\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i, 14413 /\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i, 14414 /oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i, 14415 /\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,
vendor: 35,181 bytes, lines 14416-15960
14416 / ([\w ]+) miui\/v?\d/i 14417 ], 14418 [ 14419 [ 14420 S, 14421 /_/g, 14422 " " 14423 ], 14424 [ 14425 x, 14426 gi 14427 ], 14428 [ 14429 k, 14430 _ 14431 ] 14432 ], 14433 [ 14434 /droid.+; (cph2[3-6]\d[13579]|((gm|hd)19|(ac|be|in|kb)20|(d[en]|eb|le|mt)21|ne22)[0-2]\d|p[g-k]\w[1m]10)\b/i, 14435 /(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i 14436 ], 14437 [ 14438 S, 14439 [ 14440 x, 14441 hi 14442 ], 14443 [ 14444 k, 14445 _ 14446 ] 14447 ], 14448 [ 14449 /; (\w+) bui.+ oppo/i, 14450 /\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i 14451 ], 14452 [ 14453 S, 14454 [ 14455 x, 14456 pi 14457 ], 14458 [ 14459 k, 14460 _ 14461 ] 14462 ], 14463 [ 14464 /\b(opd2(\d{3}a?))(?: bui|\))/i 14465 ], 14466 [ 14467 S, 14468 [ 14469 x, 14470 E, 14471 { 14472 OnePlus: [ 14473 "203", 14474 "304", 14475 "403", 14476 "404", 14477 "413", 14478 "415" 14479 ], 14480 "*": pi 14481 } 14482 ], 14483 [ 14484 k, 14485 r 14486 ] 14487 ], 14488 [ 14489 /(vivo (5r?|6|8l?|go|one|s|x[il]?[2-4]?)[\w\+ ]*)(?: bui|\))/i 14490 ], 14491 [ 14492 S, 14493 [ 14494 x, 14495 "BLU" 14496 ], 14497 [ 14498 k, 14499 _ 14500 ] 14501 ], 14502 [ 14503 /; vivo (\w+)(?: bui|\))/i, 14504 /\b(v[12]\d{3}\w?[at])(?: bui|;)/i 14505 ], 14506 [ 14507 S, 14508 [ 14509 x, 14510 "Vivo" 14511 ], 14512 [ 14513 k, 14514 _ 14515 ] 14516 ], 14517 [ 14518 /\b(rmx[1-3]\d{3})(?: bui|;|\))/i 14519 ], 14520 [ 14521 S, 14522 [ 14523 x, 14524 "Realme" 14525 ], 14526 [ 14527 k, 14528 _ 14529 ] 14530 ], 14531 [ 14532 /(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i, 14533 /lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i 14534 ], 14535 [ 14536 S, 14537 [ 14538 x, 14539 di 14540 ], 14541 [ 14542 k, 14543 r 14544 ] 14545 ], 14546 [ 14547 /lenovo[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i 14548 ], 14549 [ 14550 S, 14551 [ 14552 x, 14553 di 14554 ], 14555 [ 14556 k, 14557 _ 14558 ] 14559 ], 14560 [ 14561 /\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i, 14562 /\bmot(?:orola)?[- ]([\w\s]+)(\)| bui)/i, 14563 /((?:moto(?! 360)[-\w\(\) ]+|xt\d{3,4}[cgkosw\+]?[-\d]*|nexus 6)(?= bui|\)))/i 14564 ], 14565 [ 14566 S, 14567 [ 14568 x, 14569 ci 14570 ], 14571 [ 14572 k, 14573 _ 14574 ] 14575 ], 14576 [ 14577 /\b(mz60\d|xoom[2 ]{0,2}) build\//i 14578 ], 14579 [ 14580 S, 14581 [ 14582 x, 14583 ci 14584 ], 14585 [ 14586 k, 14587 r 14588 ] 14589 ], 14590 [ 14591 /((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i 14592 ], 14593 [ 14594 S, 14595 [ 14596 x, 14597 "LG" 14598 ], 14599 [ 14600 k, 14601 r 14602 ] 14603 ], 14604 [ 14605 /(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i, 14606 /\blg[-e;\/ ]+(?!.*(?:browser|netcast|android tv|watch|webos))(\w+)/i, 14607 /\blg-?([\d\w]+) bui/i 14608 ], 14609 [ 14610 S, 14611 [ 14612 x, 14613 "LG" 14614 ], 14615 [ 14616 k, 14617 _ 14618 ] 14619 ], 14620 [ 14621 /(nokia) (t[12][01])/i 14622 ], 14623 [ 14624 x, 14625 S, 14626 [ 14627 k, 14628 r 14629 ] 14630 ], 14631 [ 14632 /(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i, 14633 /nokia[-_ ]?(([-\w\. ]*))/i 14634 ], 14635 [ 14636 [ 14637 S, 14638 /_/g, 14639 " " 14640 ], 14641 [ 14642 k, 14643 _ 14644 ], 14645 [ 14646 x, 14647 "Nokia" 14648 ] 14649 ], 14650 [ 14651 /(pixel (c|tablet))\b/i 14652 ], 14653 [ 14654 S, 14655 [ 14656 x, 14657 s 14658 ], 14659 [ 14660 k, 14661 r 14662 ] 14663 ], 14664 [ 14665 /droid.+;(?: google)? (g(01[13]a|020[aem]|025[jn]|1b60|1f8f|2ybb|4s1m|576d|5nz6|8hhn|8vou|a02099|c15s|d1yq|e2ae|ec77|gh2x|kv4x|p4bc|pj41|r83y|tt9q|ur25|wvk6)|pixel[\d ]*a?( pro)?( xl)?( fold)?( \(5g\))?)( bui|\))/i 14666 ], 14667 [ 14668 S, 14669 [ 14670 x, 14671 s 14672 ], 14673 [ 14674 k, 14675 _ 14676 ] 14677 ], 14678 [ 14679 /(google) (pixelbook( go)?)/i 14680 ], 14681 [ 14682 x, 14683 S 14684 ], 14685 [ 14686 /droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-\w\w\d\d)(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i 14687 ], 14688 [ 14689 S, 14690 [ 14691 x, 14692 fi 14693 ], 14694 [ 14695 k, 14696 _ 14697 ] 14698 ], 14699 [ 14700 /sony tablet [ps]/i, 14701 /\b(?:sony)?sgp\w+(?: bui|\))/i 14702 ], 14703 [ 14704 [ 14705 S, 14706 "Xperia Tablet" 14707 ], 14708 [ 14709 x, 14710 fi 14711 ], 14712 [ 14713 k, 14714 r 14715 ] 14716 ], 14717 [ 14718 /(alexa)webm/i, 14719 /(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i, 14720 /(kf[a-z]+)( bui|\)).+silk\//i 14721 ], 14722 [ 14723 S, 14724 [ 14725 x, 14726 si 14727 ], 14728 [ 14729 k, 14730 r 14731 ] 14732 ], 14733 [ 14734 /((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i 14735 ], 14736 [ 14737 [ 14738 S, 14739 /(.+)/g, 14740 "Fire Phone $1" 14741 ], 14742 [ 14743 x, 14744 si 14745 ], 14746 [ 14747 k, 14748 _ 14749 ] 14750 ], 14751 [ 14752 /(playbook);[-\w\),; ]+(rim)/i 14753 ], 14754 [ 14755 S, 14756 x, 14757 [ 14758 k, 14759 r 14760 ] 14761 ], 14762 [ 14763 /\b((?:bb[a-f]|st[hv])100-\d)/i, 14764 /\(bb10; (\w+)/i 14765 ], 14766 [ 14767 S, 14768 [ 14769 x, 14770 wi 14771 ], 14772 [ 14773 k, 14774 _ 14775 ] 14776 ], 14777 [ 14778 /(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i 14779 ], 14780 [ 14781 S, 14782 [ 14783 x, 14784 ni 14785 ], 14786 [ 14787 k, 14788 r 14789 ] 14790 ], 14791 [ 14792 / (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i 14793 ], 14794 [ 14795 S, 14796 [ 14797 x, 14798 ni 14799 ], 14800 [ 14801 k, 14802 _ 14803 ] 14804 ], 14805 [ 14806 /(nexus 9)/i 14807 ], 14808 [ 14809 S, 14810 [ 14811 x, 14812 "HTC" 14813 ], 14814 [ 14815 k, 14816 r 14817 ] 14818 ], 14819 [ 14820 /(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i, 14821 /(zte)[- ]([\w ]+?)(?: bui|\/|\))/i, 14822 /(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i 14823 ], 14824 [ 14825 x, 14826 [ 14827 S, 14828 /_/g, 14829 " " 14830 ], 14831 [ 14832 k, 14833 _ 14834 ] 14835 ], 14836 [ 14837 /tcl (xess p17aa)/i, 14838 /droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])(_\w(\w|\w\w))?(\)| bui)/i 14839 ], 14840 [ 14841 S, 14842 [ 14843 x, 14844 "TCL" 14845 ], 14846 [ 14847 k, 14848 r 14849 ] 14850 ], 14851 [ 14852 /droid [\w\.]+; (418(?:7d|8v)|5087z|5102l|61(?:02[dh]|25[adfh]|27[ai]|56[dh]|59k|65[ah])|a509dl|t(?:43(?:0w|1[adepqu])|50(?:6d|7[adju])|6(?:09dl|10k|12b|71[efho]|76[hjk])|7(?:66[ahju]|67[hw]|7[045][bh]|71[hk]|73o|76[ho]|79w|81[hks]?|82h|90[bhsy]|99b)|810[hs]))(_\w(\w|\w\w))?(\)| bui)/i 14853 ], 14854 [ 14855 S, 14856 [ 14857 x, 14858 "TCL" 14859 ], 14860 [ 14861 k, 14862 _ 14863 ] 14864 ], 14865 [ 14866 /(itel) ((\w+))/i 14867 ], 14868 [ 14869 [ 14870 x, 14871 j 14872 ], 14873 S, 14874 [ 14875 k, 14876 E, 14877 { 14878 tablet: [ 14879 "p10001l", 14880 "w7001" 14881 ], 14882 "*": "mobile" 14883 } 14884 ] 14885 ], 14886 [ 14887 /droid.+; ([ab][1-7]-?[0178a]\d\d?)/i 14888 ], 14889 [ 14890 S, 14891 [ 14892 x, 14893 "Acer" 14894 ], 14895 [ 14896 k, 14897 r 14898 ] 14899 ], 14900 [ 14901 /droid.+; (m[1-5] note) bui/i, 14902 /\bmz-([-\w]{2,})/i 14903 ], 14904 [ 14905 S, 14906 [ 14907 x, 14908 "Meizu" 14909 ], 14910 [ 14911 k, 14912 _ 14913 ] 14914 ], 14915 [ 14916 /; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i 14917 ], 14918 [ 14919 S, 14920 [ 14921 x, 14922 "Ulefone" 14923 ], 14924 [ 14925 k, 14926 _ 14927 ] 14928 ], 14929 [ 14930 /; (energy ?\w+)(?: bui|\))/i, 14931 /; energizer ([\w ]+)(?: bui|\))/i 14932 ], 14933 [ 14934 S, 14935 [ 14936 x, 14937 "Energizer" 14938 ], 14939 [ 14940 k, 14941 _ 14942 ] 14943 ], 14944 [ 14945 /; cat (b35);/i, 14946 /; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i 14947 ], 14948 [ 14949 S, 14950 [ 14951 x, 14952 "Cat" 14953 ], 14954 [ 14955 k, 14956 _ 14957 ] 14958 ], 14959 [ 14960 /((?:new )?andromax[\w- ]+)(?: bui|\))/i 14961 ], 14962 [ 14963 S, 14964 [ 14965 x, 14966 "Smartfren" 14967 ], 14968 [ 14969 k, 14970 _ 14971 ] 14972 ], 14973 [ 14974 /droid.+; (a(in)?(0(15|59|6[35])|142)p?)/i 14975 ], 14976 [ 14977 S, 14978 [ 14979 x, 14980 "Nothing" 14981 ], 14982 [ 14983 k, 14984 _ 14985 ] 14986 ], 14987 [ 14988 /; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i, 14989 /archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i 14990 ], 14991 [ 14992 S, 14993 [ 14994 x, 14995 "Archos" 14996 ], 14997 [ 14998 k, 14999 r 15000 ] 15001 ], 15002 [ 15003 /archos ([\w ]+)( b|\))/i, 15004 /; (ac[3-6]\d\w{2,8})( b|\))/i 15005 ], 15006 [ 15007 S, 15008 [ 15009 x, 15010 "Archos" 15011 ], 15012 [ 15013 k, 15014 _ 15015 ] 15016 ], 15017 [ 15018 /; (n159v)/i 15019 ], 15020 [ 15021 S, 15022 [ 15023 x, 15024 "HMD" 15025 ], 15026 [ 15027 k, 15028 _ 15029 ] 15030 ], 15031 [ 15032 /(imo) (tab \w+)/i, 15033 /(infinix|tecno) (x1101b?|p904|dp(7c|8d|10a)( pro)?|p70[1-3]a?|p904|t1101)/i 15034 ], 15035 [ 15036 x, 15037 S, 15038 [ 15039 k, 15040 r 15041 ] 15042 ], 15043 [ 15044 /(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|tecno|micromax|advan)[-_ ]?([-\w]*)/i, 15045 /; (blu|hmd|imo|infinix|lava|oneplus|tcl)[_ ]([\w\+ ]+?)(?: bui|\)|; r)/i, 15046 /(hp) ([\w ]+\w)/i, 15047 /(microsoft); (lumia[\w ]+)/i, 15048 /(oppo) ?([\w ]+) bui/i 15049 ], 15050 [ 15051 x, 15052 S, 15053 [ 15054 k, 15055 _ 15056 ] 15057 ], 15058 [ 15059 /(kobo)\s(ereader|touch)/i, 15060 /(hp).+(touchpad(?!.+tablet)|tablet)/i, 15061 /(kindle)\/([\w\.]+)/i 15062 ], 15063 [ 15064 x, 15065 S, 15066 [ 15067 k, 15068 r 15069 ] 15070 ], 15071 [ 15072 /(surface duo)/i 15073 ], 15074 [ 15075 S, 15076 [ 15077 x, 15078 li 15079 ], 15080 [ 15081 k, 15082 r 15083 ] 15084 ], 15085 [ 15086 /droid [\d\.]+; (fp\du?)(?: b|\))/i 15087 ], 15088 [ 15089 S, 15090 [ 15091 x, 15092 "Fairphone" 15093 ], 15094 [ 15095 k, 15096 _ 15097 ] 15098 ], 15099 [ 15100 /((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i 15101 ], 15102 [ 15103 S, 15104 [ 15105 x, 15106 ui 15107 ], 15108 [ 15109 k, 15110 r 15111 ] 15112 ], 15113 [ 15114 /(sprint) (\w+)/i 15115 ], 15116 [ 15117 x, 15118 S, 15119 [ 15120 k, 15121 _ 15122 ] 15123 ], 15124 [ 15125 /(kin\.[onetw]{3})/i 15126 ], 15127 [ 15128 [ 15129 S, 15130 /\./g, 15131 " " 15132 ], 15133 [ 15134 x, 15135 li 15136 ], 15137 [ 15138 k, 15139 _ 15140 ] 15141 ], 15142 [ 15143 /droid.+; ([c6]+|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i 15144 ], 15145 [ 15146 S, 15147 [ 15148 x, 15149 vi 15150 ], 15151 [ 15152 k, 15153 r 15154 ] 15155 ], 15156 [ 15157 /droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i 15158 ], 15159 [ 15160 S, 15161 [ 15162 x, 15163 vi 15164 ], 15165 [ 15166 k, 15167 _ 15168 ] 15169 ], 15170 [ 15171 /smart-tv.+(samsung)/i 15172 ], 15173 [ 15174 x, 15175 [ 15176 k, 15177 e 15178 ] 15179 ], 15180 [ 15181 /hbbtv.+maple;(\d+)/i 15182 ], 15183 [ 15184 [ 15185 S, 15186 /^/, 15187 "SmartTV" 15188 ], 15189 [ 15190 x, 15191 mi 15192 ], 15193 [ 15194 k, 15195 e 15196 ] 15197 ], 15198 [ 15199 /(vizio)(?: |.+model\/)(\w+-\w+)/i, 15200 /tcast.+(lg)e?. ([-\w]+)/i 15201 ], 15202 [ 15203 x, 15204 S, 15205 [ 15206 k, 15207 e 15208 ] 15209 ], 15210 [ 15211 /(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i 15212 ], 15213 [ 15214 [ 15215 x, 15216 "LG" 15217 ], 15218 [ 15219 k, 15220 e 15221 ] 15222 ], 15223 [ 15224 /(apple) ?tv/i 15225 ], 15226 [ 15227 x, 15228 [ 15229 S, 15230 a + " TV" 15231 ], 15232 [ 15233 k, 15234 e 15235 ] 15236 ], 15237 [ 15238 /crkey.*devicetype\/chromecast/i 15239 ], 15240 [ 15241 [ 15242 S, 15243 b + " Third Generation" 15244 ], 15245 [ 15246 x, 15247 s 15248 ], 15249 [ 15250 k, 15251 e 15252 ] 15253 ], 15254 [ 15255 /crkey.*devicetype\/([^/]*)/i 15256 ], 15257 [ 15258 [ 15259 S, 15260 /^/, 15261 "Chromecast " 15262 ], 15263 [ 15264 x, 15265 s 15266 ], 15267 [ 15268 k, 15269 e 15270 ] 15271 ], 15272 [ 15273 /fuchsia.*crkey/i 15274 ], 15275 [ 15276 [ 15277 S, 15278 b + " Nest Hub" 15279 ], 15280 [ 15281 x, 15282 s 15283 ], 15284 [ 15285 k, 15286 e 15287 ] 15288 ], 15289 [ 15290 /crkey/i 15291 ], 15292 [ 15293 [ 15294 S, 15295 b 15296 ], 15297 [ 15298 x, 15299 s 15300 ], 15301 [ 15302 k, 15303 e 15304 ] 15305 ], 15306 [ 15307 /(portaltv)/i 15308 ], 15309 [ 15310 S, 15311 [ 15312 x, 15313 Ci 15314 ], 15315 [ 15316 k, 15317 e 15318 ] 15319 ], 15320 [ 15321 /droid.+aft(\w+)( bui|\))/i 15322 ], 15323 [ 15324 S, 15325 [ 15326 x, 15327 si 15328 ], 15329 [ 15330 k, 15331 e 15332 ] 15333 ], 15334 [ 15335 /(shield \w+ tv)/i 15336 ], 15337 [ 15338 S, 15339 [ 15340 x, 15341 ui 15342 ], 15343 [ 15344 k, 15345 e 15346 ] 15347 ], 15348 [ 15349 /\(dtv[\);].+(aquos)/i, 15350 /(aquos-tv[\w ]+)\)/i 15351 ], 15352 [ 15353 S, 15354 [ 15355 x, 15356 "Sharp" 15357 ], 15358 [ 15359 k, 15360 e 15361 ] 15362 ], 15363 [ 15364 /(bravia[\w ]+)( bui|\))/i 15365 ], 15366 [ 15367 S, 15368 [ 15369 x, 15370 fi 15371 ], 15372 [ 15373 k, 15374 e 15375 ] 15376 ], 15377 [ 15378 /(mi(tv|box)-?\w+) bui/i 15379 ], 15380 [ 15381 S, 15382 [ 15383 x, 15384 gi 15385 ], 15386 [ 15387 k, 15388 e 15389 ] 15390 ], 15391 [ 15392 /Hbbtv.*(technisat) (.*);/i 15393 ], 15394 [ 15395 x, 15396 S, 15397 [ 15398 k, 15399 e 15400 ] 15401 ], 15402 [ 15403 /\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i, 15404 /hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i 15405 ], 15406 [ 15407 [ 15408 x, 15409 /.+\/(\w+)/, 15410 "$1", 15411 E, 15412 { 15413 LG: "lge" 15414 } 15415 ], 15416 [ 15417 S, 15418 Mi 15419 ], 15420 [ 15421 k, 15422 e 15423 ] 15424 ], 15425 [ 15426 /droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i 15427 ], 15428 [ 15429 S, 15430 [ 15431 k, 15432 e 15433 ] 15434 ], 15435 [ 15436 /\b(android tv|smart[- ]?tv|opera tv|tv; rv:|large screen[\w ]+safari)\b/i 15437 ], 15438 [ 15439 [ 15440 k, 15441 e 15442 ] 15443 ], 15444 [ 15445 /(playstation \w+)/i 15446 ], 15447 [ 15448 S, 15449 [ 15450 x, 15451 fi 15452 ], 15453 [ 15454 k, 15455 W 15456 ] 15457 ], 15458 [ 15459 /\b(xbox(?: one)?(?!; xbox))[\); ]/i 15460 ], 15461 [ 15462 S, 15463 [ 15464 x, 15465 li 15466 ], 15467 [ 15468 k, 15469 W 15470 ] 15471 ], 15472 [ 15473 /(ouya)/i, 15474 /(nintendo) (\w+)/i, 15475 /(retroid) (pocket ([^\)]+))/i 15476 ], 15477 [ 15478 x, 15479 S, 15480 [ 15481 k, 15482 W 15483 ] 15484 ], 15485 [ 15486 /droid.+; (shield)( bui|\))/i 15487 ], 15488 [ 15489 S, 15490 [ 15491 x, 15492 ui 15493 ], 15494 [ 15495 k, 15496 W 15497 ] 15498 ], 15499 [ 15500 /\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i 15501 ], 15502 [ 15503 S, 15504 [ 15505 x, 15506 mi 15507 ], 15508 [ 15509 k, 15510 t 15511 ] 15512 ], 15513 [ 15514 /((pebble))app/i, 15515 /(asus|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i 15516 ], 15517 [ 15518 x, 15519 S, 15520 [ 15521 k, 15522 t 15523 ] 15524 ], 15525 [ 15526 /(ow(?:19|20)?we?[1-3]{1,3})/i 15527 ], 15528 [ 15529 S, 15530 [ 15531 x, 15532 pi 15533 ], 15534 [ 15535 k, 15536 t 15537 ] 15538 ], 15539 [ 15540 /(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i 15541 ], 15542 [ 15543 S, 15544 [ 15545 x, 15546 a 15547 ], 15548 [ 15549 k, 15550 t 15551 ] 15552 ], 15553 [ 15554 /(opwwe\d{3})/i 15555 ], 15556 [ 15557 S, 15558 [ 15559 x, 15560 hi 15561 ], 15562 [ 15563 k, 15564 t 15565 ] 15566 ], 15567 [ 15568 /(moto 360)/i 15569 ], 15570 [ 15571 S, 15572 [ 15573 x, 15574 ci 15575 ], 15576 [ 15577 k, 15578 t 15579 ] 15580 ], 15581 [ 15582 /(smartwatch 3)/i 15583 ], 15584 [ 15585 S, 15586 [ 15587 x, 15588 fi 15589 ], 15590 [ 15591 k, 15592 t 15593 ] 15594 ], 15595 [ 15596 /(g watch r)/i 15597 ], 15598 [ 15599 S, 15600 [ 15601 x, 15602 "LG" 15603 ], 15604 [ 15605 k, 15606 t 15607 ] 15608 ], 15609 [ 15610 /droid.+; (wt63?0{2,3})\)/i 15611 ], 15612 [ 15613 S, 15614 [ 15615 x, 15616 vi 15617 ], 15618 [ 15619 k, 15620 t 15621 ] 15622 ], 15623 [ 15624 /droid.+; (glass) \d/i 15625 ], 15626 [ 15627 S, 15628 [ 15629 x, 15630 s 15631 ], 15632 [ 15633 k, 15634 N 15635 ] 15636 ], 15637 [ 15638 /(pico) (4|neo3(?: link|pro)?)/i 15639 ], 15640 [ 15641 x, 15642 S, 15643 [ 15644 k, 15645 N 15646 ] 15647 ], 15648 [ 15649 /(quest( \d| pro)?s?).+vr/i 15650 ], 15651 [ 15652 S, 15653 [ 15654 x, 15655 Ci 15656 ], 15657 [ 15658 k, 15659 N 15660 ] 15661 ], 15662 [ 15663 /mobile vr; rv.+firefox/i 15664 ], 15665 [ 15666 [ 15667 k, 15668 N 15669 ] 15670 ], 15671 [ 15672 /(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i 15673 ], 15674 [ 15675 x, 15676 [ 15677 k, 15678 F 15679 ] 15680 ], 15681 [ 15682 /(aeobc)\b/i 15683 ], 15684 [ 15685 S, 15686 [ 15687 x, 15688 si 15689 ], 15690 [ 15691 k, 15692 F 15693 ] 15694 ], 15695 [ 15696 /(homepod).+mac os/i 15697 ], 15698 [ 15699 S, 15700 [ 15701 x, 15702 a 15703 ], 15704 [ 15705 k, 15706 F 15707 ] 15708 ], 15709 [ 15710 /windows iot/i 15711 ], 15712 [ 15713 [ 15714 k, 15715 F 15716 ] 15717 ], 15718 [ 15719 /droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+?(mobile|vr|\d) safari/i 15720 ], 15721 [ 15722 S, 15723 [ 15724 k, 15725 E, 15726 { 15727 mobile: "Mobile", 15728 xr: "VR", 15729 "*": r 15730 } 15731 ] 15732 ], 15733 [ 15734 /\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i 15735 ], 15736 [ 15737 [ 15738 k, 15739 r 15740 ] 15741 ], 15742 [ 15743 /(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i 15744 ], 15745 [ 15746 [ 15747 k, 15748 _ 15749 ] 15750 ], 15751 [ 15752 /droid .+?; ([\w\. -]+)( bui|\))/i 15753 ], 15754 [ 15755 S, 15756 [ 15757 x, 15758 "Generic" 15759 ] 15760 ] 15761 ], 15762 engine: [ 15763 [ 15764 /windows.+ edge\/([\w\.]+)/i 15765 ], 15766 [ 15767 y, 15768 [ 15769 v, 15770 xi + "HTML" 15771 ] 15772 ], 15773 [ 15774 /(arkweb)\/([\w\.]+)/i 15775 ], 15776 [ 15777 v, 15778 y 15779 ], 15780 [ 15781 /webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i 15782 ], 15783 [ 15784 y, 15785 [ 15786 v, 15787 "Blink" 15788 ] 15789 ], 15790 [ 15791 /(presto)\/([\w\.]+)/i, 15792 /(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i, 15793 /ekioh(flow)\/([\w\.]+)/i, 15794 /(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i, 15795 /(icab)[\/ ]([23]\.[\d\.]+)/i, 15796 /\b(libweb)/i 15797 ], 15798 [ 15799 v, 15800 y 15801 ], 15802 [ 15803 /ladybird\//i 15804 ], 15805 [ 15806 [ 15807 v, 15808 "LibWeb" 15809 ] 15810 ], 15811 [ 15812 /rv\:([\w\.]{1,9})\b.+(gecko)/i 15813 ], 15814 [ 15815 y, 15816 v 15817 ] 15818 ], 15819 os: [ 15820 [ 15821 /(windows nt) (6\.[23]); arm/i 15822 ], 15823 [ 15824 [ 15825 v, 15826 /N/, 15827 "R" 15828 ], 15829 [ 15830 y, 15831 E, 15832 Vi 15833 ] 15834 ], 15835 [ 15836 /(windows (?:phone|mobile|iot))(?: os)?[\/ ]?([\d\.]*( se)?)/i, 15837 /(windows)[\/ ](1[01]|2000|3\.1|7|8(\.1)?|9[58]|me|server 20\d\d( r2)?|vista|xp)/i 15838 ], 15839 [ 15840 v, 15841 y 15842 ], 15843 [ 15844 /windows nt ?([\d\.\)]*)(?!.+xbox)/i, 15845 /\bwin(?=3| ?9|n)(?:nt| 9x )?([\d\.;]*)/i 15846 ], 15847 [ 15848 [ 15849 y, 15850 /(;|\))/g, 15851 "", 15852 E, 15853 Vi 15854 ], 15855 [ 15856 v, 15857 _i 15858 ] 15859 ], 15860 [ 15861 /(windows ce)\/?([\d\.]*)/i 15862 ], 15863 [ 15864 v, 15865 y 15866 ], 15867 [ 15868 /[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i, 15869 /(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i, 15870 /cfnetwork\/.+darwin/i 15871 ], 15872 [ 15873 [ 15874 y, 15875 /_/g, 15876 "." 15877 ], 15878 [ 15879 v, 15880 "iOS" 15881 ] 15882 ], 15883 [ 15884 /(mac os x) ?([\w\. ]*)/i, 15885 /(macintosh|mac_powerpc\b)(?!.+(haiku|morphos))/i 15886 ], 15887 [ 15888 [ 15889 v, 15890 "macOS" 15891 ], 15892 [ 15893 y, 15894 /_/g, 15895 "." 15896 ] 15897 ], 15898 [ 15899 /android ([\d\.]+).*crkey/i 15900 ], 15901 [ 15902 y, 15903 [ 15904 v, 15905 b + " Android" 15906 ] 15907 ], 15908 [ 15909 /fuchsia.*crkey\/([\d\.]+)/i 15910 ], 15911 [ 15912 y, 15913 [ 15914 v, 15915 b + " Fuchsia" 15916 ] 15917 ], 15918 [ 15919 /crkey\/([\d\.]+).*devicetype\/smartspeaker/i 15920 ], 15921 [ 15922 y, 15923 [ 15924 v, 15925 b + " SmartSpeaker" 15926 ] 15927 ], 15928 [ 15929 /linux.*crkey\/([\d\.]+)/i 15930 ], 15931 [ 15932 y, 15933 [ 15934 v, 15935 b + " Linux" 15936 ] 15937 ], 15938 [ 15939 /crkey\/([\d\.]+)/i 15940 ], 15941 [ 15942 y, 15943 [ 15944 v, 15945 b 15946 ] 15947 ], 15948 [ 15949 /droid ([\w\.]+)\b.+(android[- ]x86)/i 15950 ], 15951 [ 15952 y, 15953 v 15954 ], 15955 [ 15956 /(ubuntu) ([\w\.]+) like android/i 15957 ], 15958 [ 15959 [ 15960 v,
vendor: 4,243 bytes, lines 15961-16107
15961 /(.+)/, 15962 "$1 Touch" 15963 ], 15964 y 15965 ], 15966 [ 15967 /(harmonyos)[\/ ]?([\d\.]*)/i, 15968 /(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen)\w*[-\/\.; ]?([\d\.]*)/i 15969 ], 15970 [ 15971 v, 15972 y 15973 ], 15974 [ 15975 /\(bb(10);/i 15976 ], 15977 [ 15978 y, 15979 [ 15980 v, 15981 wi 15982 ] 15983 ], 15984 [ 15985 /(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i 15986 ], 15987 [ 15988 y, 15989 [ 15990 v, 15991 "Symbian" 15992 ] 15993 ], 15994 [ 15995 /mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i 15996 ], 15997 [ 15998 y, 15999 [ 16000 v, 16001 yi + " OS" 16002 ] 16003 ], 16004 [ 16005 /\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i, 16006 /webos(?:[ \/]?|\.tv-20(?=2[2-9]))(\d[\d\.]*)/i 16007 ], 16008 [ 16009 y, 16010 [ 16011 v, 16012 "webOS" 16013 ] 16014 ], 16015 [ 16016 /web0s;.+?(?:chr[o0]me|safari)\/(\d+)/i 16017 ], 16018 [ 16019 [ 16020 y, 16021 E, 16022 { 16023 25: "120", 16024 24: "108", 16025 23: "94", 16026 22: "87", 16027 6: "79", 16028 5: "68", 16029 4: "53", 16030 3: "38", 16031 2: "538", 16032 1: "537", 16033 "*": "TV" 16034 } 16035 ], 16036 [ 16037 v, 16038 "webOS" 16039 ] 16040 ], 16041 [ 16042 /watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i 16043 ], 16044 [ 16045 y, 16046 [ 16047 v, 16048 "watchOS" 16049 ] 16050 ], 16051 [ 16052 /(cros) [\w]+(?:\)| ([\w\.]+)\b)/i 16053 ], 16054 [ 16055 [ 16056 v, 16057 "Chrome OS" 16058 ], 16059 y 16060 ], 16061 [ 16062 /panasonic;(viera)/i, 16063 /(netrange)mmh/i, 16064 /(nettv)\/(\d+\.[\w\.]+)/i, 16065 /(nintendo|playstation) (\w+)/i, 16066 /(xbox); +xbox ([^\);]+)/i, 16067 /(pico) .+os([\w\.]+)/i, 16068 /\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i, 16069 /linux.+(mint)[\/\(\) ]?([\w\.]*)/i, 16070 /(mageia|vectorlinux|fuchsia|arcaos|arch(?= ?linux))[;l ]([\d\.]*)/i, 16071 /([kxln]?ubuntu|debian|suse|opensuse|gentoo|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire|knoppix)(?: gnu[\/ ]linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i, 16072 /((?:open)?solaris)[-\/ ]?([\w\.]*)/i, 16073 /\b(aix)[; ]([1-9\.]{0,4})/i, 16074 /(hurd|linux|morphos)(?: (?:arm|x86|ppc)\w*| ?)([\w\.]*)/i, 16075 /(gnu) ?([\w\.]*)/i, 16076 /\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i, 16077 /(haiku) ?(r\d)?/i 16078 ], 16079 [ 16080 v, 16081 y 16082 ], 16083 [ 16084 /(sunos) ?([\d\.]*)/i 16085 ], 16086 [ 16087 [ 16088 v, 16089 "Solaris" 16090 ], 16091 y 16092 ], 16093 [ 16094 /\b(beos|os\/2|amigaos|openvms|hp-ux|serenityos)/i, 16095 /(unix) ?([\w\.]*)/i 16096 ], 16097 [ 16098 v, 16099 y 16100 ] 16101 ] 16102 }, Bi = (d = { 16103 init: {}, 16104 isIgnore: {}, 16105 isIgnoreRgx: {}, 16106 toString: {} 16107 }
vendor: 4,921 bytes, lines 16107-16306
16107, M.call(d.init, [ 16108 [ 16109 u, 16110 [ 16111 v, 16112 y, 16113 G, 16114 k 16115 ] 16116 ], 16117 [ 16118 h, 16119 [ 16120 C 16121 ] 16122 ], 16123 [ 16124 p, 16125 [ 16126 k, 16127 S, 16128 x 16129 ] 16130 ], 16131 [ 16132 m, 16133 [ 16134 v, 16135 y 16136 ] 16137 ], 16138 [ 16139 f, 16140 [ 16141 v, 16142 y 16143 ] 16144 ] 16145 ]), M.call(d.isIgnore, [ 16146 [ 16147 u, 16148 [ 16149 y, 16150 G 16151 ] 16152 ], 16153 [ 16154 m, 16155 [ 16156 y 16157 ] 16158 ], 16159 [ 16160 f, 16161 [ 16162 y 16163 ] 16164 ] 16165 ]), M.call(d.isIgnoreRgx, [ 16166 [ 16167 u, 16168 / ?browser$/i 16169 ], 16170 [ 16171 f, 16172 / ?os$/i 16173 ] 16174 ]), M.call(d.toString, [ 16175 [ 16176 u, 16177 [ 16178 v, 16179 y 16180 ] 16181 ], 16182 [ 16183 h, 16184 [ 16185 C 16186 ] 16187 ], 16188 [ 16189 p, 16190 [ 16191 x, 16192 S 16193 ] 16194 ], 16195 [ 16196 m, 16197 [ 16198 v, 16199 y 16200 ] 16201 ], 16202 [ 16203 f, 16204 [ 16205 v, 16206 y 16207 ] 16208 ] 16209 ]), d), Ri = function(e, i) { 16210 var t = Bi.init[i], o = Bi.isIgnore[i] || 0, r = Bi.isIgnoreRgx[i] || 0, a = Bi.toString[i] || 0; 16211 function s() { 16212 M.call(this, t); 16213 } 16214 return s.prototype.getItem = function() { 16215 return e; 16216 }, s.prototype.withClientHints = function() { 16217 return H ? H.getHighEntropyValues(ai).then(function(i) { 16218 return e.setCH(new Li(i, !1)).parseCH().get(); 16219 }) : e.parseCH().get(); 16220 }, s.prototype.withFeatureCheck = function() { 16221 return e.detectFeature().get(); 16222 }, i != g && (s.prototype.is = function(i) { 16223 var e, t = !1; 16224 for(e in this)if (this.hasOwnProperty(e) && !zi(o, e) && j(r ? Oi(r, this[e]) : this[e]) == j(r ? Oi(r, i) : i)) { 16225 if (t = !0, i != n) break; 16226 } else if (i == n && t) { 16227 t = !t; 16228 break; 16229 } 16230 return t; 16231 }, s.prototype.toString = function() { 16232 var i, e = w; 16233 for(i in a)typeof this[a[i]] !== n && (e += (e ? " " : w) + this[a[i]]); 16234 return e || n; 16235 }), H || (s.prototype.then = function(i) { 16236 function e() { 16237 for(var i in t)t.hasOwnProperty(i) && (this[i] = t[i]); 16238 } 16239 var t = this, o = (e.prototype = { 16240 is: s.prototype.is, 16241 toString: s.prototype.toString 16242 }, new e); 16243 return i(o), o; 16244 }), new s; 16245 }; 16246 function Li(i, e) { 16247 if (i = i || {}, M.call(this, ai), e) M.call(this, [ 16248 [ 16249 $, 16250 Ai(i[o]) 16251 ], 16252 [ 16253 X, 16254 Ai(i[Z]) 16255 ], 16256 [ 16257 _, 16258 /\?1/.test(i[ei]) 16259 ], 16260 [ 16261 S, 16262 ji(i[ti]) 16263 ], 16264 [ 16265 z, 16266 ji(i[oi]) 16267 ], 16268 [ 16269 Y, 16270 ji(i[ri]) 16271 ], 16272 [ 16273 C, 16274 ji(i[K]) 16275 ], 16276 [ 16277 q, 16278 Ai(i[ii]) 16279 ], 16280 [ 16281 Q, 16282 ji(i[J]) 16283 ] 16284 ]); 16285 else for(var t in i)this.hasOwnProperty(t) && typeof i[t] !== n && (this[t] = i[t]); 16286 } 16287 function Gi(i, e, t, o) { 16288 return this.get = function(i) { 16289 return i ? this.data.hasOwnProperty(i) ? this.data[i] : l : this.data; 16290 }, this.set = function(i, e) { 16291 return this.data[i] = e, this; 16292 }, this.setCH = function(i) { 16293 return this.uaCH = i, this; 16294 }, this.detectFeature = function() { 16295 if (A && A.userAgent == this.ua) switch(this.itemType){ 16296 case u: 16297 A.brave && typeof A.brave.isBrave == R && this.set(v, "Brave"); 16298 break; 16299 case p: 16300 !this.get(k) && H && H[_] && this.set(k, _), "Macintosh" == this.get(S) && A && typeof A.standalone !== n && A.maxTouchPoints && 2 < A.maxTouchPoints && this.set(S, "iPad").set(k, r); 16301 break; 16302 case f: 16303 !this.get(v) && H && H[z] && this.set(v, H[z]); 16304 break; 16305 case g: 16306 var e = this.data, i = function(i) {
16307 return e[i].getItem().detectFeature().get(); 16308 }; 16309 this.set(u, i(u)).set(h, i(h)).set(p, i(p)).set(m, i(m)).set(f, i(f)); 16310 } 16311 return this; 16312 }, this.parseUA = function() { 16313 return this.itemType != g && Ei.call(this.data, this.ua, this.rgxMap), this.itemType == u && this.set(G, Hi(this.get(y))), this; 16314 }, this.parseCH = function() { 16315 var i, e = this.uaCH, t = this.rgxMap; 16316 switch(this.itemType){ 16317 case u: 16318 case m: 16319 var o, r = e[X] || e[$]; 16320 if (r) for(var a in r){ 16321 var s = r[a].brand || r[a], a = r[a].version; 16322 this.itemType == u && !/not.a.brand/i.test(s) && (!o || /Chrom/.test(o) && s != ki || o == xi && /WebView2/.test(s)) && (s = E(s, Ui), (o = this.get(v)) && !/Chrom/.test(o) && /Chrom/.test(s) || this.set(v, s).set(y, a).set(G, Hi(a)), o = s), this.itemType == m && s == ki && this.set(y, a); 16323 } 16324 break; 16325 case h: 16326 var n = e[C]; 16327 n && ("64" == e[Q] && (n += "64"), Ei.call(this.data, n + ";", t)); 16328 break; 16329 case p: 16330 if (e[_] && this.set(k, _), e[S] && (this.set(S, e[S]), this.get(k) && this.get(x) || (Ei.call(n = {}, "droid 9; " + e[S] + ")", t), !this.get(k) && n.type && this.set(k, n.type), !this.get(x) && n.vendor && this.set(x, n.vendor))), e[q]) { 16331 if ("string" != typeof e[q]) for(var w = 0; !i && w < e[q].length;)i = E(e[q][w++], Ii); 16332 else i = E(e[q], Ii); 16333 this.set(k, i); 16334 } 16335 break; 16336 case f: 16337 var b, n = e[z]; 16338 n && (b = e[Y], n == _i && (b = 13 <= parseInt(Hi(b), 10) ? "11" : "10"), this.set(v, n).set(y, b)), this.get(v) == _i && "Xbox" == e[S] && this.set(v, "Xbox").set(y, l); 16339 break; 16340 case g: 16341 var d = this.data, n = function(i) { 16342 return d[i].getItem().setCH(e).parseCH().get(); 16343 }; 16344 this.set(u, n(u)).set(h, n(h)).set(p, n(p)).set(m, n(m)).set(f, n(f)); 16345 } 16346 return this; 16347 }, M.call(this, [ 16348 [ 16349 "itemType", 16350 i 16351 ], 16352 [ 16353 "ua", 16354 e 16355 ], 16356 [ 16357 "uaCH", 16358 o 16359 ], 16360 [ 16361 "rgxMap", 16362 t 16363 ], 16364 [ 16365 "data", 16366 Ri(this, i) 16367 ] 16368 ]), this; 16369 } 16370 function V(i, e, t) { 16371 var o, r, a, s, n; 16372 return typeof i === c ? (e = Ti(i, !0) ? (typeof e === c && (t = e), i) : (t = i, l), i = l) : typeof i !== L || Ti(e, !0) || (t = e, e = l), t && typeof t.append === R && (o = {}, t.forEach(function(i, e) { 16373 o[e] = i; 16374 }), t = o), this instanceof V ? (r = typeof i === L ? i : t && t[P] ? t[P] : A && A.userAgent ? A.userAgent : w, a = new Li(t, !0), s = e ? ((i, e)=>{ 16375 var t, o = {}, r = e; 16376 if (!Ti(e)) for(var a in r = {}, e)for(var s in e[a])r[s] = e[a][s].concat(r[s] || []); 16377 for(t in i)o[t] = r[t] && r[t].length % 2 == 0 ? r[t].concat(i[t]) : i[t]; 16378 return o; 16379 })(Pi, e) : Pi, M.call(this, [ 16380 [ 16381 "getBrowser", 16382 (n = function(i) { 16383 return i == g ? function() { 16384 return new Gi(i, r, s, a).set("ua", r).set(u, this.getBrowser()).set(h, this.getCPU()).set(p, this.getDevice()).set(m, this.getEngine()).set(f, this.getOS()).get(); 16385 } : function() { 16386 return new Gi(i, r, s[i], a).parseUA().get(); 16387 }; 16388 })(u) 16389 ], 16390 [ 16391 "getCPU", 16392 n(h) 16393 ], 16394 [ 16395 "getDevice", 16396 n(p) 16397 ], 16398 [ 16399 "getEngine", 16400 n(m) 16401 ], 16402 [ 16403 "getOS", 16404 n(f) 16405 ], 16406 [ 16407 "getResult", 16408 n(g) 16409 ], 16410 [ 16411 "getUA", 16412 function() { 16413 return r; 16414 } 16415 ], 16416 [ 16417 "setUA", 16418 function(i) { 16419 return O(i) && (r = i.length > U ? Mi(i, U) : i), this; 16420 } 16421 ] 16422 ]).setUA(r), this) : new V(i, e, t).getResult(); 16423 } 16424 V.VERSION = "2.0.4", V.BROWSER = I([ 16425 v, 16426 y, 16427 G, 16428 k 16429 ]), V.CPU = I([ 16430 C 16431 ]), V.DEVICE = I([ 16432 S, 16433 x, 16434 k, 16435 W, 16436 _, 16437 e, 16438 r, 16439 t, 16440 F 16441 ]), V.ENGINE = V.OS = I([ 16442 v, 16443 y 16444 ]), "object" !== n ? (exports = "object" !== n && module.exports ? module.exports = V : exp
16444orts).UAParser = V : typeof define === R && define.amd ? define(function() { 16445 return V; 16446 }) : qi && (i.UAParser = V); 16447 var Wi, Ni = qi && (i.jQuery || i.Zepto); 16448 Ni && !Ni.ua && (Wi = new V, Ni.ua = Wi.getResult(), Ni.ua.get = function() { 16449 return Wi.getUA(); 16450 }, Ni.ua.set = function(i) { 16451 Wi.setUA(i); 16452 var e, t = Wi.getResult(); 16453 for(e in t)Ni.ua[e] = t[e]; 16454 }); 16455})("object" == typeof window ? window : this); 16456 16457},{}],"7yMoe":[function(require,module,exports,__globalThis) { 16458var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 16459parcelHelpers.defineInteropFlag(exports); 16460parcelHelpers.export(exports, "fixChoicesJsAccessibility", ()=>fixChoicesJsAccessibility); 16461parcelHelpers.export(exports, "removeChoicesJsSingleListAriaSelected", ()=>removeChoicesJsSingleListAriaSelected); 16462parcelHelpers.export(exports, "fixPopupButtonAccessibility", ()=>fixPopupButtonAccessibility); 16463parcelHelpers.export(exports, "enhanceLinkAccessibility", ()=>enhanceLinkAccessibility); 16464const fixChoicesJsAccessibility = (choicesContainer, ariaLabel)=>{ 16465 if (!choicesContainer) return; 16466 // Set the role attribute to combobox 16467 choicesContainer.setAttribute('role', 'combobox'); 16468 choicesContainer.setAttribute('aria-label', ariaLabel); 16469}; 16470const removeChoicesJsSingleListAriaSelected = (choicesContainer)=>{ 16471 if (!choicesContainer) return; 16472 // Remove aria-selected from all items in the visible single selection area 16473 const singleList = choicesContainer.querySelector('.choices__list--single'); 16474 if (singleList) { 16475 const itemsWithAriaSelected = singleList.querySelectorAll('[aria-selected]'); 16476 itemsWithAriaSelected.forEach((item)=>{ 16477 item.removeAttribute('aria-selected'); 16478 }); 16479 } 16480}; 16481const fixPopupButtonAccessibility = (popupButton)=>{ 16482 if (!popupButton) return; 16483 popupButton.setAttribute('role', 'button'); 16484 popupButton.setAttribute('aria-haspopup', 'dialog'); 16485 popupButton.setAttribute('aria-expanded', 'false'); 16486}; 16487const skipLinkstoMain = document.querySelectorAll('.skip-link-to-main'); 16488const skipLinkstoTop = document.querySelectorAll('.skip-link-to-top'); 16489if (skipLinkstoMain) skipLinkstoMain.forEach((link)=>{ 16490 link.addEventListener('click', function(e) { 16491 goToElement(e, '#main'); 16492 }); 16493}); 16494if (skipLinkstoTop) skipLinkstoTop.forEach((link)=>{ 16495 link.addEventListener('click', function(e) { 16496 goToElement(e, '#top'); 16497 }); 16498}); 16499function goToElement(e, element) { 16500 e.preventDefault(); 16501 const elementToFocus = document.querySelector(element); 16502 if (elementToFocus) { 16503 elementToFocus.focus(); 16504 elementToFocus.scrollIntoView({ 16505 behavior: 'smooth', 16506 block: 'start' 16507 }); 16508 } 16509} 16510// form custom validation 16511const form = document.querySelectorAll('.js-custom-validation-form'); 16512if (form) form.forEach((form)=>{ 16513 // Add custom validity messages and ARIA attributes to all inputs 16514 const inputs = form.querySelectorAll('input, select, textarea'); 16515 inputs.forEach((input)=>{ 16516 // Get the associated label text 16517 const label = form.querySelector(`label[for="${input.id}"]`); 16518 const labelText = label ? label.textContent.replace('*', '').trim() : ''; 16519 // Add aria-label for better screen reader support 16520 if (labelText && !input.getAttribute('aria-label')) input.setAttribute('aria-label', labelText); 16521 // Listen for invalid event (triggered when validation fails) 16522 input.addEventListener('invalid', function(e) { 16523 // Set custom validation message based on input type 16524 if (input.validity.valueMissing) { 16525 if (input.type === 'checkbox') input.setCustomValidity(`Please check: ${labelText}`); 16526 else if (input.type === 'date') input.setCustomValidity(`Please select a date for ${labelText}`); 16527 else if (input.tagName.toLowerCase() === 'select') input.setCustomValidity(`Please select a value for ${labelText}`); 16528 else input.setCustomValidity(`${labelText} is required. Please fill in this field.`); 16529 } else if (input.validity.typeMismatch) { 16530 if (input.type === 'email') input.setCustomValidity(`Please enter a valid email address for ${labelText}`); 16531 else input.setCustomValidity(`Please enter a valid ${labelText}`); 16532 } else if (input.validity.patternMismatch) input.setCustomValidity(`${labelText}
16532 format is invalid`); 16533 else input.setCustomValidity(`Please enter a valid ${labelText}`); 16534 // Add aria-invalid attribute 16535 input.setAttribute('aria-invalid', 'true'); 16536 }); 16537 // Clear custom message when user starts typing 16538 input.addEventListener('input', function() { 16539 input.setCustomValidity(''); 16540 input.removeAttribute('aria-invalid'); 16541 }); 16542 // Also clear on change (for selects) 16543 input.addEventListener('change', function() { 16544 input.setCustomValidity(''); 16545 input.removeAttribute('aria-invalid'); 16546 }); 16547 }); 16548}); 16549const enhanceLinkAccessibility = ()=>{ 16550 const links = document.querySelectorAll('a[href]'); 16551 const currentDomain = window.location.hostname; 16552 links.forEach((link)=>{ 16553 const href = link.getAttribute('href'); 16554 if (!href) return; 16555 // Detect PDF 16556 const isPDF = /\.pdf$/i.test(href); 16557 // Detect new tab 16558 const opensInNewTab = link.getAttribute('target') === '_blank' || link.getAttribute('target') === '_new'; 16559 // Detect external link (different domain) 16560 let isExternal = false; 16561 try { 16562 // Only check for external if it's an absolute URL 16563 if (/^https?:\/\//i.test(href)) { 16564 const linkURL = new URL(href); 16565 const linkDomain = linkURL.hostname; 16566 // Remove www. prefix for comparison 16567 const normalizedCurrentDomain = currentDomain.replace(/^www\./i, ''); 16568 const normalizedLinkDomain = linkDomain.replace(/^www\./i, ''); 16569 isExternal = normalizedLinkDomain !== normalizedCurrentDomain; 16570 } 16571 } catch (e) { 16572 // If URL parsing fails, assume it's not external 16573 isExternal = false; 16574 } 16575 // Skip if none of the conditions apply 16576 if (!isPDF && !opensInNewTab && !isExternal) return; 16577 // Get existing aria-label 16578 const existingLabel = link.getAttribute('aria-label') || ''; 16579 // Check if labels are already present to avoid duplication 16580 const hasPDFLabel = /\(PDF\)/i.test(existingLabel); 16581 const hasNewTabLabel = /\(opens in new tab\)/i.test(existingLabel); 16582 const hasExternalLabel = /\(opens external site\)|\(external link\)/i.test(existingLabel); 16583 // If already has all needed labels, skip 16584 const needsPDFLabel = isPDF && !hasPDFLabel; 16585 const needsNewTabLabel = opensInNewTab && !hasNewTabLabel; 16586 const needsExternalLabel = isExternal && !hasExternalLabel; 16587 if (!needsPDFLabel && !needsNewTabLabel && !needsExternalLabel) return; 16588 // Get base text (remove existing indicators if present) 16589 let baseText = existingLabel.replace(/\s*\(PDF\)\s*/gi, ' ').replace(/\s*\(opens in new tab\)\s*/gi, ' ').replace(/\s*\(opens external site\)\s*/gi, ' ').replace(/\s*\(external link\)\s*/gi, ' ').trim(); 16590 // If no base text from aria-label, use link text or title 16591 if (!baseText) baseText = link.textContent.trim() || link.getAttribute('title') || ''; 16592 // Build new aria-label 16593 const labelParts = []; 16594 // Add the base label 16595 if (baseText) labelParts.push(baseText); 16596 // Add PDF indicator 16597 if (isPDF) labelParts.push('(PDF)'); 16598 // Add external site indicator 16599 if (isExternal) labelParts.push('(opens external site)'); 16600 // Add new tab indicator 16601 if (opensInNewTab) labelParts.push('(opens in new tab)'); 16602 // Set the new aria-label 16603 if (labelParts.length > 0) link.setAttribute('aria-label', labelParts.join(' ')); 16604 }); 16605}; 16606// Run enhanceLinkAccessibility 2 seconds after page load for accessibility labelling. 16607window.addEventListener('DOMContentLoaded', ()=>{ 16608 setTimeout(()=>{ 16609 enhanceLinkAccessibility(); 16610 }, 2000); 16611}); 16612 16613},{"@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"1NO9a":[function(require,module,exports,__globalThis) { 16614var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 16615parcelHelpers.defineInteropFlag(exports); 16616parcelHelpers.export(exports, "initPopupGallerySlider", ()=>initPopupGallerySlider); 16617var _swiperBundle = require("swiper/swiper-bundle"); 16618var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 16619var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 16620const initPopupGallerySlider = (slider)=>{ 16621 if (slider) { 16622 const gallerySwiper = new (0, _swiperBundleDefault.default)(slider, { 16623 slidesPerView: 1, 16624 loop: true, 16625 shortSwipes: true, 16626 keyboard: { 16627 enabled: true, 16628 onlyInViewport: true 16629 }, 16630 a11y: true, 16631 pagination: { 16632 el: '.swiper-pagination' 16633 }, 16634 navigation: { 16635 nextEl: '.js-popup-gallery-nav-next', 16636 prevEl: '.js-popup-gallery-nav-prev' 16637 } 16638 }); 16639 } 16640}; 16641 16642},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"lJfcL":[function(require,module,exports,__globalThis) { 16643var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 16644parcelHelpers.defineInteropFlag(exports); 16645parcelHelpers.export(exports, "fadeInOnScroll", ()=>fadeInOnScroll); 16646const isMobile = ()=>window.innerWidth < 768; 16647const isTablet = ()=>window.innerWidth >= 768 && window.innerWidth < 992; 16648const isDesktop = ()=>window.innerWidth >= 992; 16649const fadeInOnScroll = ()=>{ 16650 const selectorsToObserve = [ 16651 '.js-fade-up', 16652 '.js-fade-left', 16653 '.js-fade-right', 16654 '.js-fade-in' 16655 ]; 16656 if (useFadeInEffects()) { 16657 const observer = new IntersectionObserver((entries)=>{
16658 entries.forEach((entry)=>{ 16659 if (entry.isIntersecting) // Add class to elements when they enter the viewport 16660 entry.target.classList.add('is-intersecting'); 16661 }); 16662 }); 16663 selectorsToObserve.forEach((selector)=>{ 16664 const selectors = document.querySelectorAll(selector); 16665 selectors.forEach((selector)=>observer.observe(selector)); 16666 }); 16667 } else // If intersection observer not supported, just show everything on page load 16668 selectorsToObserve.forEach((selector)=>{ 16669 const selectors = document.querySelectorAll(selector); 16670 selectors.forEach((selector)=>selector.classList.add('is-intersecting')); 16671 }); 16672}; 16673const useFadeInEffects = ()=>!!window.IntersectionObserver && !isMobile(); 16674fadeInOnScroll(); 16675 16676},{"@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"bxTwH":[function(require,module,exports,__globalThis) { 16677var _utilities = require("../helpers/utilities"); 16678const atreemoSignup = ()=>{ 16679 const forms = document.querySelectorAll('.js-atreemo-signup-form'); 16680 if (forms) forms.forEach((form)=>{ 16681 form.addEventListener('submit', (e)=>{ 16682 e.preventDefault(); 16683 if (typeof igniteJsVars.recaptchaSiteKey === 'string') grecaptcha.ready(function() { 16684 grecaptcha.execute(igniteJsVars.recaptchaSiteKey, { 16685 action: 'newsletterSignupForm' 16686 }).then(function(token) { 16687 atreemoFormSubmitActions(form, token); 16688 }); 16689 }); 16690 else atreemoFormSubmitActions(form); 16691 }); 16692 }); 16693}; 16694const atreemoFormSubmitActions = async (form, token = null)=>{ 16695 const formData = new FormData(form); 16696 const parentElement = form.closest('.c-signup-form__wrapper'); 16697 // Show the loading state 16698 const loaderIcon = parentElement.querySelector('.js-loader-icon'); 16699 loaderIcon.classList.remove('hidden'); 16700 form.classList.add('hidden'); 16701 // Add the action and recaptcha token to the form data 16702 formData.append('action', 'ajaxCreateAtreemoUser'); 16703 formData.append('recaptchaToken', token); 16704 // Send the form data to the server 16705 const response = await (0, _utilities.postRequest)(formData); 16706 const { status, heading, message, data } = response; 16707 // Update the popup heading and message 16708 const headingElement = parentElement.querySelector('.c-signup-form__intro-title'); 16709 const messageElement = parentElement.querySelector('.c-signup-form__intro-copy'); 16710 headingElement.textContent = heading; 16711 messageElement.textContent = message; 16712 // Show the heading and message 16713 headingElement.classList.remove('hidden'); 16714 messageElement.classList.remove('hidden'); 16715 // Hide the loader icon 16716 loaderIcon.classList.add('hidden'); 16717}; 16718atreemoSignup(); 16719 16720},{"../helpers/utilities":"dH8qc"}],"hkiht":[function(require,module,exports,__globalThis) { 16721var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 16722parcelHelpers.defineInteropFlag(exports); 16723var _moment = require("moment"); 16724var _momentDefault = parcelHelpers.interopDefault(_moment); 16725class igOtBooking { 16726 constructor(igOtBookingWidgetElement){ 16727 this.bwElement = igOtBookingWidgetElement; //Target element for this instance of the code 16728 this.debugMode = true; 16729 console.log('igOtBooking inits'); 16730 // Define Global Variables 16731 this.restaurantRid; 16732 this.partySize; 16733 this.startDateTime; 16734 this.cardRequired; 16735 this.attributes; 16736 this.reservationAttribute; 16737 this.reservationToken; 16738 this.availabilityType; 16739 this.experiences; 16740 this.chosenExperience = 'not-set'; 16741 this.chosenExperienceName = 'not-set'; 16742 this.chosenExperienceCost = 'not-set'; 16743 this.addOnData = []; 16744 this.reset = false; 16745 this.buttonActive = false, this.submitted = false; 16746 this.bookingWidget(); 16747 } 16748 bookingWidget() { 16749 // Init global functions 16750 this.backBtn(); 16751 this.handleAccordians(); 16752 this.getGuestsAndTimes(); 16753 this.resetBookingWidgetClose(); 16754 const bookATable = this.bwElement.querySelector('#book-a-table'); 16755 let restaurantRidError, partySizeError, dateError, timeError; 16756 bookATable.addEventListener('click', (e)=>{ 16757 e.preventDefault(); 16758 window.dataLayer.push({ 16759 'event': 'click_to_book' 16760 }); 16761 // Set variables 16762 this.restaurantRid = this.bwElement.querySelector('#restaurant_rid').value; 16763 this.partySize = this.bwElement.querySelector('#party_size').value; 16764 let date = this.bwElement.querySelector('#date').value; 16765 let time = this.bwElement.querySelector('#time').value; 16766 this.startDateTime = date + 'T' + time; 16767 let anyError = false;
16768 if (this.partySize > 8) { 16769 this.maxGuestsPopup(); 16770 return; 16771 } 16772 if (!anyError && (this.restaurantRid == '' || this.restaurantRid == null)) { 16773 anyError = true; 16774 restaurantRidError = true; 16775 this.errorPopup('Please select a restaurant'); 16776 } else restaurantRidError = false; 16777 if (!anyError && (this.partySize == '' || this.partySize == null)) { 16778 anyError = true; 16779 partySizeError = true; 16780 this.errorPopup('Please select your number of guests'); 16781 } else partySizeError = false; 16782 if (!anyError && date == '') { 16783 anyError = true; 16784 dateError = true; 16785 this.errorPopup('Please select a date'); 16786 } else dateError = false; 16787 if (!anyError && (time == '' || time == null)) { 16788 anyError = true; 16789 timeError = true; 16790 this.errorPopup('Please select a time'); 16791 } else timeError = false; 16792 let timeNow = (0, _momentDefault.default)().local().format('YYYYMMDDHHmm'); 16793 let requestedTime = date + ' ' + time; 16794 let momentObj = (0, _momentDefault.default)(requestedTime, 'YYYY-MM-DD HH:mm'); 16795 let requestedTimeFormat = momentObj.format('YYYYMMDDHHmm'); 16796 if (!anyError && timeNow >= requestedTimeFormat) { 16797 anyError = true; 16798 timeError = true; 16799 this.errorPopup('Your choosen time is in the past'); 16800 } else timeError = false; 16801 if (restaurantRidError == false && partySizeError == false && dateError == false && timeError == false) { 16802 if (this.debugMode) console.log('Requesting check_opentable_availability...'); 16803 this.bwElement.classList.add('loading'); 16804 fetch('https://wordpress-1513716-5815621.cloudwaysapps.com/wp-json/route/check-opentable-availability', { 16805 method: 'POST', 16806 credentials: 'same-origin', 16807 headers: { 16808 'Content-Type': 'application/x-www-form-urlencoded' 16809 }, 16810 body: JSON.stringify({ 16811 restaurantRid: this.restaurantRid, 16812 partySize: this.partySize, 16813 startDateTime: this.startDateTime 16814 }) 16815 }).then((response)=>response.json()).then((data)=>{ 16816 this.bwElement.classList.remove('loading'); 16817 if (data.availability == true) { 16818 this.selectTableType(data); 16819 this.bwElement.querySelector('#booking-type-screen .back-btn').dataset.screen = 'availability-search-screen'; 16820 } else if (data.other_availability) { 16821 let otherAvailabilityContent = ''; 16822 let otherAvailability = false; 16823 data.other_availability.forEach(addAvailabilityTiles); 16824 function addAvailabilityTiles(item, index, arr) { 16825 let otherAvailabilityTime = item.time.split('T'); 16826 let timeNow = (0, _momentDefault.default)().format('YYYYMMDDHHmm'); 16827 let availabilityTime = otherAvailabilityTime[0] + ' ' + otherAvailabilityTime[1]; 16828 let momentObj = (0, _momentDefault.default)(availabilityTime, 'YYYY-MM-DD HH:mm'); 16829 let availabilityTimeFormat = momentObj.format('YYYYMMDDHHmm'); 16830 let tableTypeText = 'Standard'; 16831 if (item.attributes == 'default') tableTypeText = 'Standard'; 16832 else tableTypeText = item.attributes; 16833 if (timeNow < availabilityTimeFormat) { 16834 otherAvailabilityContent += '<div class="availability-button rounded-corners f__headline-h6" data-experiences="' + item.experiences + '" data-availabilitytype="' + item.availability_type + '" data-reservationattribute="' + item.attributes + '" data-card="' + item.card + '" data-time="' + item.time + '">' + otherAvailabilityTime[1] + '</br>' + tableTypeText + '</div>'; 16835 otherAvailability = true; 16836 } 16837 } 16838 if (otherAvailability) { 16839 this.showBookingScreen('other-availability-screen'); 16840 this.bwElement.querySelector('.other-availability-list').innerHTML = otherAvailabilityContent; 16841 this.bwElement.querySelector('#booking-type-screen .back-btn').dataset.screen = 'other-availability-screen'; 16842 this.newAvailabilitySelect(); 16843 } else this.errorPopup('', 'Unfortunately, no availability matches your current search.'); 16844 } else this.errorPopup('', 'Unfortunately, no availability matches your current search.'); 16845 }).catch((error)=>{ 16846 this.bwElement.classList.remove('loading'); 16847 console.error(error); 16848 }); 16849 } else console.log('error'); 16850 }); 16851 } 16852 errorPopup = (content, title = 'Apologies, an error has occurred with your booking.')=>{ 16853 this.bwElement.querySelector('#ot-error-popup.ot-error-popup').classList.add('active'); 16854 this.bwElement.querySelector('#ot-error-popup .ot-error-popup__title').innerHTML = title; 16855 this.bwElement.querySelector('#ot-error-popup .ot-error-popup__content').innerHTML = content; 16856 const bookingScreens = this.bwElement.querySelectorAll('.booking-screen'); 16857 bookingScreens.forEach((bookingScreen)=>{ 16858 bookingScreen.classList.add('blur'); 16859 }); 16860 this.bwElement.querySelector('#ot-steps').classList.add('blur'); 16861 this.bwElement.querySelector('#ot-error-popup .ot-error-popup__close').addEventListener('click', (e)=>{ 16862 e.preventDefault(); 16863 this.bwElement.querySelector('#ot-error-popup.ot-error-popup').classList.remove('active'); 16864 bookingScreens.forEach((bookingScreen)=>{ 16865 bookingScreen.classList.remove('blur'); 16866 }); 16867 this.bwElement.querySelector('#ot-steps').classList.remove('blur'); 16868 }); 16869 }; 16870 maxGuestsPopup = ()=>{ 16871 this.bwElement.querySelector('#ot-max-guests-popup.ot-error-popup').classList.add('active'); 16872 const bookingScreens = this.bwElement.querySelectorAll('.booking-screen'); 16873 bookingScreens.forEach((bookingScreen)=>{ 16874 bookingScreen.classList.add('blur'); 16875 }); 16876 this.bwElement.querySelector('#ot-steps').classList.add('blur'); 16877 this.bwElement.querySelector('#ot-max-guests-popup .ot-error-popup__close').addEventListener('click', (e)=>{ 16878 e.preventDefault(); 16879 this.bwElement.querySelector('#ot-max-guests-popup.ot-error-popup').classList.remove('active'); 16880 bookingScreens.forEach((bookingScreen)=>{ 16881 bookingScreen.classList.remove('blur'); 16882 }); 16883 this.bwElement.querySelector('#ot-steps').classList.remove('blur'); 16884 }); 16885 }; 16886 newAvailabilitySelect = ()=>{ 16887 const availabilityButtons = this.bwElement.querySelectorAll('.availability-button'); 16888 const reserveNewTime = this.bwElement.querySelector('#reserve-new-time'); 16889 const availabilityMessage = this.bwElement.querySelector('.availability-message'); 16890 availabilityMessage.querySelector('.non-available-time').innerText = (0, _momentDefault.default)(this.startDateTime).format('HH:mm[,] Do MMMM'); 16891 availabilityButtons.forEach((availabilityButton)=>{ 16892 availabilityButton.addEventListener('click', (e)=>{ 16893 e.preventDefault(); 16894 availabilityButtons.forEach((availabilityButton)=>{ 16895 availabilityButton.classList.remove('active'); 16896 }); 16897 e.currentTarget.classList.add('active'); 16898 // Update global variables 16899 this.startDateTime = e.currentTarget.dataset.time; 16900 this.cardRequired = e.currentTarget.dataset.card; 16901 this.reservationAttribute = e.currentTarget.dataset.reservationattribute; 16902 this.availabilityType = e.currentTarget.dataset.availabilitytype; 16903 this.experiences = e.currentTarget.dataset.experiences; 16904 reserveNewTime.classList.remove('disabled'); 16905 }); 16906 }); 16907 reserveNewTime.addEventListener('click', (e)=>{ 16908 e.preventDefault(); 16909 let otherAvailabilityTime = this.startDateTime.split('T'); 16910 let timeNow = (0, _momentDefault.default)().format('YYYYMMDDHHmm'); 16911 let availabilityTime = otherAvailabilityTime[0] + ' ' + otherAvailabilityTime[1]; 16912 let momentObj = (0, _momentDefault.default)(availabilityTime, 'YYYY-MM-DD HH:mm'); 16913 let availabilityTimeFormat = momentObj.format('YYYYMMDDHHmm'); 16914 if (timeNow < availabilityTimeFormat) { 16915 this.bwElement.querySelector('#your-details-screen .back-btn').dataset.screen = 'availability-search-screen'; 16916 if (this.availabilityType.includes('Experience')) this.selectExperienceType(); 16917 else this.createOpentableSlotLock(); 16918 } else this.errorPopup('Your choosen time is in the past'); 16919 }, { 16920 once: true 16921 }); 16922 }; 16923 selectTableType = (data)=>{ 16924 let tableTypes = data.times_available, tableTypesContent = '', tableTypeText = 'Standard';
16925 tableTypes.forEach((item, index, arr)=>{ 16926 if (item.attributes == 'default') tableTypeText = 'Standard'; 16927 else tableTypeText = item.attributes; 16928 if (document.body.dataset.theme === 'group') tableTypesContent += '<div class="grid grid-cols-2 items-center mb-[20px] pb-[20px]" style="border-bottom: 1px solid rgba(0, 0, 0, 0.12);">\ 16929 <h5 class="f__headline-h5">' + tableTypeText + '</h5>\ 16930 <div class="flex justify-end">\ 16931 <div id="select_table" data-experiences="' + item.experiences + '" data-availabilitytype="' + item.availability_type + '" data-reservationattribute="' + item.attributes + '" data-card="' + item.card + '" class="igOtBw-button btn btn--small">\ 16932 <span>Select</span>\ 16933 </div>\ 16934 </div>\ 16935 </div>'; 16936 else tableTypesContent += '<div class="grid grid-cols-2 items-center mb-[20px] pb-[20px]" style="border-bottom: 1px solid rgba(0, 0, 0, 0.12);">\ 16937 <h5 class="f__headline-h5">' + tableTypeText + '</h5>\ 16938 <div class="flex justify-end">\ 16939 <div id="select_table" data-experiences="' + item.experiences + '" data-availabilitytype="' + item.availability_type + '" data-reservationattribute="' + item.attributes + '" data-card="' + item.card + '" class="igOtBw-button button ' + this.bwElement.dataset.buttonHoverStyle + '">\ 16940 <span class="button__text-wrapper">\ 16941 <span class="button__text">Select</span>\ 16942 </span>\ 16943 </div>\ 16944 </div>\ 16945 </div>'; 16946 }); 16947 this.bwElement.querySelector('.table-types').innerHTML = tableTypesContent; 16948 const bookingScreens = this.bwElement.querySelectorAll('.booking-screen'); 16949 bookingScreens.forEach((bookingScreen)=>{ 16950 bookingScreen.classList.remove('active'); 16951 }); 16952 this.bwElement.querySelector('#booking-type-screen').classList.add('active'); 16953 const bookingSteps = this.bwElement.querySelectorAll('.ot-step'); 16954 bookingSteps.forEach((bookingStep)=>{ 16955 bookingStep.classList.remove('active'); 16956 }); 16957 this.bwElement.querySelector('#step-2').classList.add('active'); 16958 const restaurantSelect = this.bwElement.querySelector('#restaurant_rid'); 16959 const restaurantText = restaurantSelect.options[restaurantSelect.selectedIndex].text; 16960 this.bwElement.querySelector('#booking-type-screen .booking-details__location').innerText = restaurantText; 16961 const dateTime = this.startDateTime.split('T'); 16962 const formatDate = (0, _momentDefault.default)(this.startDateTime).format('dddd, MMMM D'); 16963 this.bwElement.querySelector('#booking-type-screen .booking-details__info--time').innerText = dateTime[1]; 16964 this.bwElement.querySelector('#booking-type-screen .booking-details__info--date').innerText = formatDate; 16965 this.bwElement.querySelector('#booking-type-screen .booking-details__info--guests').innerText = this.partySize + ' Guests'; 16966 const selectTableButtons = this.bwElement.querySelectorAll('.table-types .igOtBw-button'); 16967 selectTableButtons.forEach((selectTableButton)=>{ 16968 selectTableButton.addEventListener('click', (e)=>{ 16969 e.preventDefault(); 16970 this.reservationAttribute = e.currentTarget.dataset.reservationattribute; 16971 this.cardRequired = e.currentTarget.dataset.card; 16972 this.availabilityType = e.currentTarget.dataset.availabilitytype; 16973 this.experiences = e.currentTarget.dataset.experiences; 16974 this.bwElement.querySelector('#your-details-screen .back-btn').dataset.screen = 'booking-type-screen'; 16975 if (this.availabilityType.includes('Experience')) this.selectExperienceType(); 16976 else this.createOpentableSlotLock(); 16977 }); 16978 }); 16979 }; 16980 selectExperienceType = ()=>{ 16981 if (this.debugMode) { 16982 console.log('Requesting get_opentable_experiences...'); 16983 console.log('availabilityType'); 16984 console.log(this.availabilityType); 16985 } 16986 const dateTime = this.startDateTime.split('T'); 16987 const formatDate = (0, _momentDefault.default)(this.startDateTime).format('dddd, MMMM D'); 16988 this.bwElement.querySelector('#experiences-screen .booking-details__info--time').innerText = dateTime[1]; 16989 this.bwElement.querySelector('#experiences-screen .booking-details__info--date').innerText = formatDate; 16990 this.bwElement.querySelector('#experiences-screen .booking-details__info--guests').innerText = this.partySize + ' Guests'; 16991 let tableTypeText = 'Standard;'; 16992 if (this.reservationAttribute == 'default') tableTypeText = 'Standard'; 16993 else tableTypeText = this.reservationAttribute; 16994 this.bwElement.querySelector('#experiences-screen .booking-details__info--type').innerText = tableTypeText; 16995 this.bwElement.classList.add('loading'); 16996 fetch('https://wordpress-1513716-5815621.cloudwaysapps.com/w
16996p-json/route/get-opentable-experiences', { 16997 method: 'POST', 16998 credentials: 'same-origin', 16999 headers: { 17000 'Content-Type': 'application/x-www-form-urlencoded' 17001 }, 17002 body: JSON.stringify({ 17003 restaurantRid: this.restaurantRid, 17004 experiences: this.experiences 17005 }) 17006 }).then((response)=>response.json()).then((data)=>{ 17007 this.bwElement.classList.remove('loading'); 17008 console.log(data); 17009 let experienceContent = ''; 17010 data.forEach((item, index, arr)=>{ 17011 let cost = ''; 17012 if (item.min_unit_amount !== null) cost = (item.min_unit_amount / item.multiplier).toFixed(2); 17013 let experienceButton = ''; 17014 if (document.body.dataset.theme === 'group') experienceButton = '<div id="add_experience" data-addon="' + item.add_ons + '" data-cost="' + cost + '" data-cardrequired="' + item.pre_payment_required + '" data-experience="' + item.id + ',' + item.version + '" data-experiencename="' + item.name + '" class="igOtBw-button btn btn--small ' + this.bwElement.dataset.buttonHoverStyle + '"><span>Add</span></div>'; 17015 else experienceButton = '<div id="add_experience" data-addon="' + item.add_ons + '" data-cost="' + cost + '" data-cardrequired="' + item.pre_payment_required + '" data-experience="' + item.id + ',' + item.version + '" data-experiencename="' + item.name + '" class="igOtBw-button button ' + this.bwElement.dataset.buttonHoverStyle + '">\ 17016 <span class="button__text-wrapper">\ 17017 <span class="button__text button__text">Add</span>\ 17018 </span>\ 17019 </div>'; 17020 experienceContent += '<div class="experience-tile flex justify-between items-center mb-[20px] pb-[20px]" style="border-bottom: 1px solid rgba(0, 0, 0, 0.12);">\ 17021 <div class="experience-tile__content pr-[30px]">\ 17022 <h5 class="f__headline-h5">' + item.name + '</h5>\ 17023 <p class="f__paragraph-regular">' + item.description + '</p>\ 17024 </div>' + experienceButton + '</div>'; 17025 }); 17026 this.bwElement.querySelector('#experiences-screen .experiences').innerHTML = experienceContent; 17027 if (this.availabilityType == 'Experience') this.bwElement.querySelector('#experiences-screen #skip-to-standard').style.display = 'none'; 17028 this.showBookingScreen('experiences-screen'); 17029 this.addExperienceButton(); 17030 this.skipToStandardButton(); 17031 }).catch((error)=>{ 17032 this.bwElement.classList.remove('loading'); 17033 console.error(error); 17034 }); 17035 }; 17036 addExperienceButton = ()=>{ 17037 const experienceButtons = this.bwElement.querySelectorAll('.experience-tile .igOtBw-button'); 17038 experienceButtons.forEach((experienceButton)=>{ 17039 experienceButton.addEventListener('click', (e)=>{ 17040 e.preventDefault(); 17041 this.chosenExperience = e.currentTarget.dataset.experience; 17042 this.chosenExperienceName = e.currentTarget.dataset.experiencename; 17043 this.chosenExperienceCost = e.currentTarget.dataset.cost; 17044 if (e.currentTarget.dataset.cardrequired == true || e.currentTarget.dataset.cardrequired == 'true') this.cardRequired = true; 17045 // DISABLED ADD ONS FOR NOW 17046 // if(e.currentTarget.dataset.addon == 'true') { 17047 // this.selectAddOn(); 17048 // } else { 17049 // this.createOpentableSlotLock(); 17050 // } 17051 this.createOpentableSlotLock(); 17052 }); 17053 }); 17054 }; 17055 selectAddOn = ()=>{ 17056 if (this.debugMode) console.log('Requesting get_opentable_experiences...'); 17057 this.bwElement.classList.add('loading'); 17058 fetch('https://wordpress-1513716-5815621.cloudwaysapps.com/wp-json/route/get-opentable-experiences', { 17059 method: 'POST', 17060 credentials: 'same-origin', 17061 headers: { 17062 'Content-Type': 'application/x-www-form-urlencoded' 17063 }, 17064 body: JSON.stringify({ 17065 restaurantRid: this.restaurantRid, 17066 experiences: this.experiences 17067 }) 17068 }).then((response)=>response.json()).then((data)=>{ 17069 this.bwElement.classList.remove('loading'); 17070 let addOnContent = ''; 17071 let chosenExperienceId = this.chosenExperience.split(','); 17072 data.forEach(addOnTiles); 17073 function addOnTiles(item, index, arr) { 17074 if (item.id == chosenExperienceId[0]) { 17075 item.add_on.forEach(tiles); 17076 function tiles(item, index, arr) { 17077 addOnContent += '<div class="add-on-tile"><h4>' + item.name + '</h4>\ 17078 <input id="' + item.id + '" type="hidden" name="add-on-qty" value="1"/>\ 17079 <div class="qty-counter">\ 17080 <p>Quantity</p>\
17081 <span data-addonid="' + item.id + '" data-max="' + item.max_per_reservation + '" data-index="' + index + '" data-type="decrease" class="qty-button disabled decrease">-</span>\ 17082 <div id="' + index + '" class="qty-tracker">1</div>\ 17083 <span data-addonid="' + item.id + '" data-max="' + item.max_per_reservation + '" data-index="' + index + '" data-type="increase" class="qty-button increase">+</span>\ 17084 </div>\ 17085 <div class="button-container">\ 17086 <div data-addonid="' + item.id + '" data-type="add" class="igOtBw-button">Add</div>\ 17087 <div data-addonid="' + item.id + '" data-type="remove" class="igOtBw-button disabled">Remove</div></div>\ 17088 </div>'; 17089 } 17090 } 17091 } 17092 this.bwElement.querySelector('#add-ons-screen .add-ons').innerHTML = addOnContent; 17093 this.showBookingScreen('add-ons-screen'); 17094 this.qtyCounter(); 17095 this.addAddOnButton(); 17096 this.skipToStandardButton(); 17097 this.proceedToDetailsButtons(); 17098 }).catch((error)=>{ 17099 this.bwElement.classList.remove('loading'); 17100 console.error(error); 17101 }); 17102 }; 17103 qtyCounter = ()=>{ 17104 const qtyCounterButtons = this.bwElement.querySelectorAll('.qty-button'); 17105 qtyCounterButtons.forEach((qtyCounterButton)=>{ 17106 qtyCounterButton.addEventListener('click', (e)=>{ 17107 e.preventDefault(); 17108 let addOnQty; 17109 if (e.currentTarget.dataset.type == 'increase') { 17110 addOnQty = parseInt(this.bwElement.querySelector('#' + e.currentTarget.dataset.addonid).value); 17111 addOnQty = addOnQty += 1; 17112 if (e.currentTarget.dataset.max == addOnQty) e.currentTarget.classList.add('disabled'); 17113 if (addOnQty > 1) e.currentTarget.parentElement.querySelector('.qty-button.decrease').classList.remove('disabled'); 17114 this.bwElement.querySelector('#' + e.currentTarget.dataset.index).innerHTML = addOnQty; 17115 } 17116 if (e.currentTarget.dataset.type == 'decrease') { 17117 addOnQty = parseInt(this.bwElement.querySelector('#' + e.currentTarget.dataset.addonid).value); 17118 addOnQty = addOnQty -= 1; 17119 if (addOnQty == 1) e.currentTarget.classList.add('disabled'); 17120 if (e.currentTarget.dataset.max < 20) e.currentTarget.parentElement.querySelector('.qty-button.increase').classList.remove('disabled'); 17121 this.bwElement.querySelector('#' + e.currentTarget.dataset.index).innerHTML = addOnQty; 17122 } 17123 this.bwElement.querySelector('#' + e.currentTarget.dataset.addonid).value = addOnQty; 17124 }); 17125 }); 17126 }; 17127 addAddOnButton = ()=>{ 17128 const addOnButtons = this.bwElement.querySelectorAll('.add-on-tile .igOtBw-button'); 17129 addOnButtons.forEach((addOnButton)=>{ 17130 addOnButton.addEventListener('click', (e)=>{ 17131 e.preventDefault(); 17132 let addOnQty; 17133 //this.bwElement.querySelector('#add-ons-screen #skip-to-standard').style.display = "none"; 17134 this.bwElement.querySelector('#add-ons-screen #proceed-to-details').style.display = 'block'; 17135 if (e.currentTarget.dataset.type == 'add') { 17136 addOnQty = parseInt(this.bwElement.querySelector('#' + e.currentTarget.dataset.addonid).value); 17137 let addOnDataPush = {}; 17138 addOnDataPush['id'] = e.currentTarget.dataset.addonid; 17139 addOnDataPush['qty'] = addOnQty; 17140 this.addOnData.push(addOnDataPush); 17141 e.currentTarget.classList.add('disabled'); 17142 e.currentTarget.nextElementSibling.classList.remove('disabled'); 17143 } 17144 if (e.currentTarget.dataset.type == 'remove') { 17145 this.addOnData = this.addOnData.filter(function(item) { 17146 return item.id != e.currentTarget.dataset.add
17146onid; 17147 }); 17148 e.currentTarget.classList.add('disabled'); 17149 e.currentTarget.previousElementSibling.classList.remove('disabled'); 17150 } 17151 }); 17152 }); 17153 }; 17154 proceedToDetailsButtons = ()=>{ 17155 const proceedToDetails = this.bwElement.querySelector('#proceed-to-details'); 17156 proceedToDetails.addEventListener('click', (e)=>{ 17157 e.preventDefault(); 17158 this.createOpentableSlotLock(); 17159 }, { 17160 once: true 17161 }); 17162 }; 17163 skipToStandardButton = ()=>{ 17164 const skipToStandard = this.bwElement.querySelector('#skip-to-standard'); 17165 skipToStandard.addEventListener('click', (e)=>{ 17166 e.preventDefault(); 17167 this.createOpentableSlotLock(); 17168 }, { 17169 once: true 17170 }); 17171 }; 17172 createOpentableSlotLock = ()=>{ 17173 if (this.debugMode) console.log('Requesting create_reservation_slot_lock...'); 17174 this.bwElement.classList.add('loading'); 17175 fetch('https://wordpress-1513716-5815621.cloudwaysapps.com/wp-json/route/create-reservation-slot-lock', { 17176 method: 'POST', 17177 credentials: 'same-origin', 17178 headers: { 17179 'Content-Type': 'application/x-www-form-urlencoded' 17180 }, 17181 body: JSON.stringify({ 17182 restaurantRid: this.restaurantRid, 17183 partySize: this.partySize, 17184 startDateTime: this.startDateTime, 17185 reservationAttribute: this.reservationAttribute, 17186 experience: this.chosenExperience 17187 }) 17188 }).then((response)=>response.json()).then((data)=>{ 17189 this.bwElement.classList.remove('loading'); 17190 var fiveMinutes = 300, display = this.bwElement.querySelector('#countdown-time'); 17191 this.startTimer(fiveMinutes, display); 17192 this.reservationToken = data.token; 17193 this.createOpentableReservation(); 17194 }).catch((error)=>{ 17195 this.bwElement.classList.remove('loading'); 17196 console.error(error); 17197 }); 17198 }; 17199 createOpentableReservation = ()=>{ 17200 if (this.cardRequired == 'true' || this.cardRequired == true) this.cardRequired = true; 17201 if (this.cardRequired == true) this.bwElement.querySelector('#card-details').style.display = 'block'; 17202 else this.bwElement.querySelector('#card-details').style.display = 'none'; 17203 this.showBookingScreen('your-details-screen'); 17204 const restaurantSelect = this.bwElement.querySelector('#restaurant_rid'); 17205 let restaurantText = restaurantSelect.options[restaurantSelect.selectedIndex].text; 17206 if (this.chosenExperienceName !== 'not-set') { 17207 restaurantText = restaurantText + ' - ' + this.chosenExperienceName; 17208 this.bwElement.querySelector('#experience-details').style.display = 'block'; 17209 this.bwElement.querySelector('#experience-title').innerText = this.chosenExperienceName; 17210 let totalCost = this.chosenExperienceCost * this.partySize; 17211 this.bwElement.querySelector('#experience-total').innerText = "\xa3" + totalCost; 17212 this.bwElement.querySelector('#experience-breakdown').innerText = this.partySize + "x \xa3" + this.chosenExperienceCost; 17213 if (totalCost == 0) { 17214 this.bwElement.querySelector('#experience-total').style.display = 'none'; 17215 this.bwElement.querySelector('#experience-breakdown').style.display = 'none'; 17216 } else { 17217 this.bwElement.querySelector('#experience-total').style.display = 'block'; 17218 this.bwElement.querySelector('#experience-breakdown').style.display = 'block'; 17219 } 17220 } else this.bwElement.querySelector('#experience-details').style.display = 'none'; 17221 this.bwElement.querySelector('#your-details-screen .booking-details__location').innerText = restaurantText; 17222 const dateTime = this.startDateTime.split('T'); 17223 const formatDate = (0, _momentDefault.default)(this.startDateTime).format('dddd, MMMM D'); 17224 this.bwElement.querySelector('#your-details-screen .booking-details__info--time').innerText = dateTime[1]; 17225 this.bwElement.querySelector('#your-details-screen .booking-details__info--date').innerText = formatDate; 17226 this.bwElement.querySelector('#your-details-screen .booking-details__info--guests').innerText = this.partySize + ' Guests'; 17227 let tableTypeText = 'Standard;'; 17228 if (this.reservationAttribute == 'default') tableTypeText = 'Standard'; 17229 else tableTypeText = this.reservationAttribute; 17230 this.bwElement.querySelector('#your-details-screen .booking-details__info--type').innerText = tableTypeText; 17231 const confirmBooking = this.bwElement.querySelector('#confirm-booking'); 17232 if (this.reset != true) { 17233 this.buttonActive = true; 17234 this.submitted = false;
17235 confirmBooking.addEventListener('click', (e)=>{ 17236 e.preventDefault(); 17237 // const reservationsPopup = document.querySelector('#reservations .popup__wrapper'); 17238 // reservationsPopup.scrollIntoView({ behavior: 'smooth', block: 'start' }); 17239 this.bwElement.scrollIntoView({ 17240 behavior: 'smooth', 17241 block: 'start' 17242 }); 17243 const firstName = this.bwElement.querySelector('#first_name').value; 17244 const lastName = this.bwElement.querySelector('#last_name').value; 17245 const emailAddress = this.bwElement.querySelector('#email_address').value; 17246 const telephoneNumber = this.bwElement.querySelector('#telephone_number').value; 17247 const countryCode = this.bwElement.querySelector('#country_code').value; 17248 const notes = this.bwElement.querySelector('#additional_notes').value; 17249 let firstNameError = false, lastNameError = false, emailAddressError = false, telephoneNumberError = false, creditCardError = false, anyError = false; 17250 if (!anyError && (firstName == '' || firstName == null)) { 17251 anyError = true; 17252 firstNameError = true; 17253 this.errorPopup('Please enter your first name'); 17254 } else firstNameError = false; 17255 if (!anyError && (lastName == '' || lastName == null)) { 17256 anyError = true; 17257 lastNameError = true; 17258 this.errorPopup('Please enter your last name'); 17259 } else lastNameError = false; 17260 if (!anyError) { 17261 const emailPattern = /^[^\s@]+@[^\s@]+\.[^\s@]+$/; 17262 if (emailAddress === '' || emailAddress === null) { 17263 anyError = true; 17264 emailAddressError = true; 17265 this.errorPopup('Please enter your email address'); 17266 } else if (!emailPattern.test(emailAddress)) { 17267 anyError = true; 17268 emailAddressError = true; 17269 this.errorPopup('Please enter a valid email address'); 17270 } else emailAddressError = false; 17271 } 17272 if (!anyError) { 17273 if (telephoneNumber === '' || telephoneNumber === null) { 17274 anyError = true; 17275 telephoneNumberError = true; 17276 this.errorPopup('Please enter your phone number'); 17277 } else if (isNaN(telephoneNumber) || !/^\d+$/.test(telephoneNumber)) { 17278 anyError = true; 17279 telephoneNumberError = true; 17280 this.errorPopup('Please enter a valid phone number containing only digits'); 17281 } else telephoneNumberError = false; 17282 } 17283 //Compile any selected allergens into a string 17284 const allergens = this.bwElement.querySelectorAll('input[name="allergen"]'); 17285 let allergensNote = ''; 17286 allergens.forEach((allergen)=>{ 17287 if (allergen.checked) allergensNote += allergen.value + ' '; 17288 }); 17289 //Compile any selected occasions into a string 17290 const occasions = this.bwElement.querySelectorAll('input[name="occasion"]'); 17291 let occasionsNote = ''; 17292 occasions.forEach((occasion)=>{ 17293 if (occasion.checked) occasionsNote += occasion.value + ' '; 17294 }); 17295 const promoCode = this.bwElement.querySelector('#promo_code').value; 17296 let specialRequest = ''; 17297 if (notes && allergensNote) specialRequest = 'Allergens: ' + allergensNote + ' - Notes: ' + notes; 17298 else if (notes && !allergensNote) specialRequest = notes; 17299 else if (!notes && allergensNote) specialRequest = 'Allergens: ' + allergensNote; 17300 else specialRequest = notes; 17301 if (promoCode) specialRequest = specialRequest + ' - Promo Code: ' + promoCode; 17302 if (occasionsNote) specialRequest = specialRequest + ' - Occasions: ' + occasionsNote; 17303 const emailOptIn = this.bwElement.querySelector('input[name="email-opt-in"]');
17304 let restaurantEmailMarketingOptIn = 'false'; 17305 if (emailOptIn.checked) restaurantEmailMarketingOptIn = 'true'; 17306 let cardNumber = 'not-required'; 17307 let expMonth = 'not-required'; 17308 let expYear = 'not-required'; 17309 let cvc = 'not-required'; 17310 let creditCardRequired = 'false'; 17311 if (this.cardRequired === true) { 17312 cardNumber = this.bwElement.querySelector('#card_number').value.replace(/\s+/g, ''); 17313 expMonth = this.bwElement.querySelector('#exp_month').value; 17314 expYear = this.bwElement.querySelector('#exp_year').value; 17315 cvc = this.bwElement.querySelector('#cvc').value; 17316 creditCardRequired = 'true'; 17317 if (cardNumber == '' || expYear == '' || cvc == '') { 17318 creditCardError = true; 17319 this.errorPopup('Please enter your card details'); 17320 } else creditCardError = false; 17321 } else { 17322 creditCardRequired = 'false'; 17323 creditCardError = false; 17324 } 17325 if (firstNameError == false && lastNameError == false && emailAddressError == false && telephoneNumberError == false && creditCardError == false && this.submitted == false) { 17326 this.submitted = true; 17327 if (this.debugMode) console.log('Requesting create_opentable_reservation...'); 17328 this.bwElement.classList.add('loading'); 17329 let reservationData = JSON.stringify({ 17330 restaurantRid: this.restaurantRid, 17331 reservationToken: this.reservationToken, 17332 reservationAttribute: this.reservationAttribute, 17333 experience: this.chosenExperience, 17334 addon: JSON.stringify(this.addOnData), 17335 cardRequired: creditCardRequired, 17336 firstName: firstName, 17337 lastName: lastName, 17338 emailAddress: emailAddress, 17339 telephoneNumber: telephoneNumber, 17340 countryCode: countryCode, 17341 specialRequest: specialRequest, 17342 restaurantEmailMarketingOptIn: restaurantEmailMarketingOptIn, 17343 cardNumber: cardNumber, 17344 expMonth: expMonth, 17345 expYear: expYear, 17346 cvc: cvc 17347 }); 17348 const makeReservation = (reservationData)=>{ 17349 fetch('https://wordpress-1513716-5815621.cloudwaysapps.com/wp-json/route/create-opentable-reservation', { 17350 method: 'POST', 17351 credentials: 'same-origin', 17352 headers: { 17353 'Content-Type': 'application/x-www-form-urlencoded' 17354 }, 17355 body: reservationData 17356 }).then((response)=>response.json()).then((data)=>{ 17357 console.log(data.error); 17358 if (data.error) { 17359 if (data.error == 'DinerHasOverlappingReservations - Request violated business rule: DinerHasOverlappingReservations') { 17360 this.bwElement.classList.remove('loading'); 17361 this.errorPopup('Overlapping Reservation Already Exists. Please contact us directly if this error persists.'); 17362 } else if (data.error.includes('IllegalPhoneNumberLength')) { 17363 this.bwElement.classList.remove('loading'); 17364 this.errorPopup('Your phone number is not the correct length, please check and try again'); 17365 } else if (data.error.includes('[Email] Email address')) { 17366 this.bwElement.classList.remove('loading'); 17367 this.errorPopup('Email address is not in the correct format, please check and try again'); 17368 } else if (data.error == 'ValidationError - illegal CreditCard Token = null') { 17369 this.bwElement.classList.remove('loading'); 17370 this.errorPopup('Incorrect card details, please try again.'); 17371 } else if (data.error == 'CreditCardTokenSCARequired - SCAForPayment') { 17372 this.bwElement.classList.add('loading'); 17373 var stripe = Stripe(data.connected_account_pk); 17374 var self = this;
17375 stripe.confirmCardPayment(data.client_secret, { 17376 }).then(function(result) { 17377 if (result.paymentIntent) { 17378 reservationData = JSON.parse(reservationData); 17379 reservationData.token = data.stripe_token; 17380 reservationData.last4 = data.last4; 17381 reservationData.paymentMethod = data.payment_method; 17382 reservationData.paymentIntent = result.paymentIntent.id; 17383 reservationData.cardRequired = 'sca-payment'; 17384 reservationData = JSON.stringify(reservationData); 17385 makeReservation(reservationData); 17386 } 17387 if (result.error) { 17388 self.bwElement.classList.remove('loading'); 17389 self.errorPopup(result.error.message); 17390 } 17391 }); 17392 } else if (data.error == 'CreditCardTokenSCARequired - SCAForCardVault - SCA required') { 17393 this.bwElement.classList.add('loading'); 17394 var stripe = Stripe(data.connected_account_pk); 17395 var self = this; 17396 stripe.confirmCardSetup(data.client_secret, { 17397 }).then(function(result) { 17398 if (result.setupIntent) { 17399 reservationData = JSON.parse(reservationData); 17400 reservationData.token = data.stripe_token; 17401 reservationData.last4 = data.last4; 17402 reservationData.paymentMethod = data.payment_method; 17403 reservationData.setupIntent = result.setupIntent.id; 17404 reservationData.cardRequired = 'sca-setup'; 17405 reservationData = JSON.stringify(reservationData); 17406 makeReservation(reservationData); 17407 } 17408 if (result.error) { 17409 self.bwElement.classList.remove('loading'); 17410 self.errorPopup(result.error.message); 17411 } 17412 }); 17413 } else { 17414 this.bwElement.classList.remove('loading'); 17415 this.errorPopup(data.error); 17416 } 17417 this.submitted = false; 17418 } else { 17419 this.bwElement.classList.remove('loading'); 17420 //Succesful booking! Show booking confirmation screen 17421 this.showBookingScreen('confirmation-screen'); 17422 window.dataLayer.push({ 17423 'event': 'booking_complete' 17424 }); 17425 const formatDate = (0, _momentDefault.default)(data.date_time).format('dddd, MMMM D'); 17426 const formatTime = (0, _momentDefault.default)(data.date_time).format('HH:mm'); 17427 const manageURL = document.createElement('a'); 17428 manageURL.href = data.manage_reservation_url; 17429 manageURL.classList.add(document.body.dataset.theme === 'group' ? 'btn' : 'button', 'igOtBw-button', this.bwElement.dataset.buttonHoverStyle); 17430 if (document.body.dataset.theme === 'group') manageURL.innerHTML = `
17431 <span>Manage Reservation</span>`; 17432 else manageURL.innerHTML = ` 17433 <span class="button__text-wrapper"> 17434 <span class="button__text">Manage Reservation</span> 17435 </span>`; 17436 this.bwElement.querySelector('#message').querySelector('.confirmation-info__copy').innerText = data.message; 17437 this.bwElement.querySelector('#confirmation_number').querySelector('.confirmation-info__copy').innerText = data.confirmation_number; 17438 this.bwElement.querySelector('#confirmation_date_time').querySelector('.confirmation-info__copy').innerText = formatDate.concat(' - ', formatTime); 17439 this.bwElement.querySelector('#comfirmation_party_size').querySelector('.confirmation-info__copy').innerText = data.party_size; 17440 if (data.notes !== '') this.bwElement.querySelector('#notes').querySelector('.confirmation-info__copy').innerText = data.notes; 17441 else this.bwElement.querySelector('#notes').style.display = 'none'; 17442 let manageURLContainer = this.bwElement.querySelector('#manage_reservation_url'); 17443 manageURLContainer.replaceChild(manageURL, manageURLContainer.firstChild); 17444 //Add watcher on reset button 17445 this.bwElement.querySelector('#confirmation-reset').addEventListener('click', (e)=>{ 17446 e.preventDefault(); 17447 this.resetBookingWidget(); 17448 }); 17449 } 17450 }).catch((error)=>{ 17451 this.bwElement.classList.remove('loading'); 17452 console.error(error); 17453 this.submitted = false; 17454 }); 17455 }; 17456 makeReservation(reservationData); 17457 } 17458 }); 17459 } 17460 }; 17461 showBookingScreen = (screen)=>{ 17462 const bookingScreens = this.bwElement.querySelectorAll('.booking-screen'); 17463 bookingScreens.forEach((bookingScreen)=>{ 17464 bookingScreen.classList.remove('active'); 17465 }); 17466 this.bwElement.querySelector('#' + screen).classList.add('active'); 17467 const bookingSteps = this.bwElement.querySelectorAll('.ot-step'); 17468 bookingSteps.forEach((bookingStep)=>{ 17469 bookingStep.classList.remove('active'); 17470 }); 17471 let stepNumber = ''; 17472 if (screen == 'availability-search-screen' || screen == 'other-availability-screen') stepNumber = 'step-1'; 17473 else if (screen == 'booking-type-screen') stepNumber = 'step-2'; 17474 else if (screen == 'experiences-screen' || screen == 'add-ons-screen') stepNumber = 'step-3'; 17475 else if (screen == 'your-details-screen') { 17476 stepNumber = 'step-4'; 17477 // Get credit card message 17478 const formData = new FormData(); 17479 formData.append('restaurantRid', this.restaurantRid); 17480 formData.append('action', 'get_guests_and_times'); 17481 const restaurantData = new URLSearchParams(formData); 17482 fetch(igniteJsVars.ajaxurl, { 17483 method: 'POST', 17484 credentials: 'same-origin', 17485 headers: { 17486 'Content-Type': 'application/x-www-form-urlencoded', 17487 'Cache-Control': 'no-cache' 17488 }, 17489 body: restaurantData 17490 }).then((response)=>response.json()).then((data)=>{ 17491 // this.bwElement.querySelector('#card-details-message').innerText = data.credit_card_message; 17492 }).catch((error)=>{ 17493 console.error(error); 17494 }); 17495 this.bwElement.scrollIntoView({ 17496 behavior: 'smooth', 17497 block: 'start' 17498 }); 17499 } else if (screen == 'confirmation-screen') stepNumber = false;
17500 if (stepNumber) { 17501 this.bwElement.querySelector('#ot-steps').style.display = 'flex'; 17502 this.bwElement.querySelector('#' + stepNumber).classList.add('active'); 17503 } else this.bwElement.querySelector('#ot-steps').style.display = 'none'; 17504 }; 17505 backBtn = ()=>{ 17506 const backBtns = this.bwElement.querySelectorAll('.back-btn'); 17507 backBtns.forEach((backBtn)=>{ 17508 backBtn.addEventListener('click', (e)=>{ 17509 e.preventDefault(); 17510 this.showBookingScreen(e.currentTarget.dataset.screen); 17511 if (e.currentTarget.dataset.screen == 'availability-search-screen') { 17512 // reset all variables if we return back to first screen 17513 this.restaurantRid = ''; 17514 this.partySize = ''; 17515 this.startDateTime = ''; 17516 this.cardRequired = ''; 17517 this.attributes = ''; 17518 this.reservationAttribute = ''; 17519 this.availabilityType = ''; 17520 this.experiences = ''; 17521 this.chosenExperience = 'not-set'; 17522 this.chosenExperienceName = 'not-set'; 17523 this.addOnData = []; 17524 if (this.buttonActive == true) this.reset = true; 17525 this.bwElement.scrollIntoView({ 17526 behavior: 'smooth', 17527 block: 'start' 17528 }); 17529 } 17530 if (e.currentTarget.dataset.screen == 'booking-type-screen') { 17531 this.experiences = ''; 17532 this.chosenExperience = 'not-set'; 17533 this.chosenExperienceName = 'not-set'; 17534 this.addOnData = []; 17535 if (this.buttonActive == true) this.reset = true; 17536 this.bwElement.scrollIntoView({ 17537 behavior: 'smooth', 17538 block: 'start' 17539 }); 17540 } 17541 if (e.currentTarget.dataset.screen == 'experiences-screen') { 17542 this.experiences = ''; 17543 this.chosenExperience = 'not-set'; 17544 this.chosenExperienceName = 'not-set'; 17545 this.addOnData = []; 17546 this.bwElement.scrollIntoView({ 17547 behavior: 'smooth', 17548 block: 'start' 17549 }); 17550 } 17551 }); 17552 }); 17553 }; 17554 handleAccordians = ()=>{ 17555 //Function to handle opening and closing of the allergen & tags/occasions accordian toggles 17556 let accordianToggles = this.bwElement.querySelectorAll('.js__ot-widget-accordian-toggle'); 17557 if (accordianToggles) accordianToggles.forEach((toggle)=>{ 17558 toggle.addEventListener('click', (e)=>{ 17559 e.preventDefault(); 17560 if (toggle.dataset.accordian) { 17561 let targetAccordian = this.bwElement.querySelector('[data-accordian="' + toggle.dataset.accordian + '"].js__ot-widget-accordian'); 17562 if (targetAccordian) { 17563 //Toggle the accordian element 17564 if (targetAccordian.classList.contains('active')) targetAccordian.classList.remove('active'); 17565 else targetAccordian.classList.add('active'); 17566 //Toggle the trigger element too 17567 if (toggle.classList.contains('active')) toggle.classList.remove('active'); 17568 else toggle.classList.add('active'); 17569 } 17570 } 17571 }); 17572 }); 17573 }; 17574 resetBookingWidgetClose = ()=>{ 17575 const closeButtons = document.querySelectorAll('.js__close-popups'); 17576 closeButtons.forEach((button)=>{ 17577 button.addEventListener('click', ()=>{ 17578 this.resetBookingWidget(); 17579 }); 17580 }); 17581 }; 17582 getGuestsAndTimes = ()=>{ 17583 const restaurantSelect = this.bwElement.querySelector('#restaurant_rid'); 17584 // Define the change handler function 17585 const handleRestaurantChange = (e)=>{ 17586 e.preventDefault(); 17587 console.log('getGuestsAndTimes'); 17588 const restaurantRidSelect = e.target.value; 17589 const formData = new FormData(); 17590 formData.append('restaurantRid', restaurantRidSelect); 17591 formData.append('action', 'get_guests_and_times'); 17592 const restaurantData = new URLSearchParams(formData); 17593 if (this.debugMode) console.log('Requesting get_guests_and_times...'); 17594 this.bwElement.classList.add('loading'); 17595 fetch(igniteJsVars.ajaxurl, { 17596 method: 'POST', 17597 credentials: 'same-origin', 17598 headers: { 17599 'Content-Type': 'application/x-www-form-urlencoded', 17600 'Cache-Control': 'no-cache' 17601 }, 17602 body: restaurantData 17603 }).then((response)=>response.json()).then((data)=>{ 17604 this.bwElement.classList.remove('loading'); 17605 // Update number of guests 17606 const partySizeSelect = this.bwElement.querySelector('#party_size'); 17607 while(partySizeSelect.options.length > 0)partySizeSelect.remove(0); 17608 for(let i = data.min_guests; i <= data.max_guests; i++){ 17609 let partySizeOption = new Option(i, i); 17610 partySizeSelect.add(partySizeOption, undefined); 17611 } 17612 // Update time slots 17613 const timeSelect = this.bwElement.querySelector('#time'); 17614 //Remove the default timeslotes 17615 while(timeSelect.options.length > 0)timeSelect.remove(0); 17616 //Loop through each timeslot sent over 17617 let currentTimeCheck = false;
17618 data.time_slots.forEach((timeSlot)=>{ 17619 let isCurrentTime = false, today = new Date(), hourToCheck = timeSlot.split(':')[0]; 17620 //Check to see if it's the 'current' time 17621 if (hourToCheck > today.getHours() && !currentTimeCheck) { 17622 isCurrentTime = true; 17623 currentTimeCheck = true; 17624 } else isCurrentTime = false; 17625 let timeSlotOption = new Option(timeSlot, timeSlot, isCurrentTime, isCurrentTime); 17626 timeSelect.add(timeSlotOption); 17627 }); 17628 this.bwElement.querySelector('#party_size').classList.remove('disabled'); 17629 this.bwElement.querySelector('#date').classList.remove('disabled'); 17630 this.bwElement.querySelector('#time').classList.remove('disabled'); 17631 }).catch((error)=>{ 17632 this.bwElement.classList.remove('loading'); 17633 console.error(error); 17634 }); 17635 }; 17636 // Add the event listener 17637 restaurantSelect.addEventListener('change', handleRestaurantChange); 17638 // Check if there's only one option in the restaurant dropdown 17639 if (restaurantSelect.options.length === 2) { 17640 // Preselect the only available option (skip the first option which is likely the default) 17641 restaurantSelect.selectedIndex = 1; 17642 // Trigger the change event to execute the rest of the logic 17643 restaurantSelect.dispatchEvent(new Event('change')); 17644 } 17645 }; 17646 startTimer = (duration, display)=>{ 17647 var start = Date.now(), diff, minutes, seconds; 17648 var timer = setInterval(()=>{ 17649 diff = duration - ((Date.now() - start) / 1000 | 0); 17650 minutes = diff / 60 | 0; 17651 seconds = diff % 60 | 0; 17652 minutes = minutes < 10 ? '0' + minutes : minutes; 17653 seconds = seconds < 10 ? '0' + seconds : seconds; 17654 display.textContent = minutes + ':' + seconds; 17655 let confirmationScreen = this.bwElement.querySelector('#confirmation-screen'); 17656 let experiencesScreen = this.bwElement.querySelector('#experiences-screen'); 17657 let bookingTypeScreen = this.bwElement.querySelector('#booking-type-screen'); 17658 let otherAvailabilityScreen = this.bwElement.querySelector('#other-availability-screen'); 17659 let availabilitySearchScreen = this.bwElement.querySelector('#availability-search-screen'); 17660 if (confirmationScreen.classList.contains('active') || experiencesScreen.classList.contains('active') || experiencesScreen.classList.contains('active') || otherAvailabilityScreen.classList.contains('active') || availabilitySearchScreen.classList.contains('active')) { 17661 clearInterval(timer); 17662 this.addOnData = []; 17663 } 17664 if (diff <= 0) { 17665 start = Date.now() + 1000; 17666 this.reset = true; 17667 clearInterval(timer); 17668 this.addOnData = []; 17669 this.showBookingScreen('availability-search-screen'); 17670 } 17671 }, 1000); 17672 }; 17673 //Reset widget to initial state 17674 resetBookingWidget = ()=>{ 17675 const bookingScreens = this.bwElement.querySelectorAll('.booking-screen'); 17676 bookingScreens.forEach((bookingScreen)=>{ 17677 bookingScreen.classList.remove('active'); 17678 }); 17679 // Reset HTML elements 17680 this.bwElement.querySelector('#availability-search-screen').classList.add('active'); 17681 this.bwElement.querySelector('#ot-steps').style.display = 'flex'; 17682 this.bwElement.querySelector('#step-1').classList.add('active'); 17683 this.bwElement.querySelector('#step-2').classList.remove('active'); 17684 this.bwElement.querySelector('#step-3').classList.remove('active'); 17685 this.bwElement.querySelector('#step-4').classList.remove('active'); 17686 this.bwElement.querySelector('.js-ot-title').style.display = 'block'; 17687 this.bwElement.querySelector('.js-ot-text').style.display = 'block'; 17688 const resetForm = ()=>{ 17689 const inputsToReset = [ 17690 'restaurant_rid', 17691 'party_size', 17692 'time', 17693 'first_name', 17694 'last_name', 17695 'telephone_number', 17696 'email_address', 17697 'card_number', 17698 'exp_year', 17699 'exp_month', 17700 'cvc' 17701 ]; 17702 const today = new Date(); 17703 inputsToReset.forEach((inputId)=>{ 17704 const inputElement = this.bwElement.querySelector('#' + inputId); 17705 if (inputId == 'party_size' || inputId == 'time') { 17706 inputElement.innerHTML = '<option value="" disabled selected>Please select</option>'; 17707 inputElement.classList.add('disabled'); 17708 } else if (inputId == 'exp_month') inputElement.value = '1'; 17709 else if (inputId == 'exp_year') inputElement.value = today.getFullYear(); 17710 else inputElement.value = ''; 17711 }); 17712 const formattedDate = `${today.getFullYear()}-${('0' + (today.getMonth() + 1)).slice(-2)}-${('0' + today.getDate()).slice(-2)}`; 17713 const dateInput = this.bwElement.querySelector('#date'); 17714 dateInput.value = formattedDate; 17715 dateInput.classList.add('disabled'); 17716 }; 17717 this.bwElement.scrollIntoView({ 17718 behavior: 'smooth', 17719 block: 'start' 17720 }); 17721 resetForm(); 17722 // reset all variables as we return back to first screen 17723 this.restaurantRid = ''; 17724 this.partySize = ''; 17725 this.startDateTime = ''; 17726 this.cardRequired = ''; 17727 this.attributes = ''; 17728 this.reservationAttribute = ''; 17729 this.availabilityType = ''; 17730 this.experiences = ''; 17731 this.chosenExperience = 'not-set'; 17732 this.chosenExperienceName = 'not-set'; 17733 this.addOnData = []; 17734 this.submitted = false;
17735 if (this.buttonActive == true) this.reset = true; 17736 }; 17737} //end igOtBooking Classa 17738exports.default = igOtBooking; 17739 17740},{"moment":"hSU6n","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"hSU6n":[function(require,module,exports,__globalThis) { 17741//! moment.js 17742(function(global, factory) { 17743 module.exports = factory(); 17744})(this, function() { 17745 'use strict'; 17746 var hookCallback; 17747 function hooks() { 17748 return hookCallback.apply(null, arguments); 17749 } 17750 // This is done to register the method called with moment() 17751 // without creating circular dependencies. 17752 function setHookCallback(callback) { 17753 hookCallback = callback; 17754 } 17755 function isArray(input) { 17756 return input instanceof Array || Object.prototype.toString.call(input) === '[object Array]'; 17757 } 17758 function isObject(input) { 17759 // IE8 will treat undefined and null as object if it wasn't for 17760 // input != null 17761 return input != null && Object.prototype.toString.call(input) === '[object Object]'; 17762 } 17763 function isObjectEmpty(obj) { 17764 if (Object.getOwnPropertyNames) return Object.getOwnPropertyNames(obj).length === 0; 17765 else { 17766 var k; 17767 for(k in obj){ 17768 if (obj.hasOwnProperty(k)) return false; 17769 } 17770 return true; 17771 } 17772 } 17773 function isUndefined(input) { 17774 return input === void 0; 17775 } 17776 function isNumber(input) { 17777 return typeof input === 'number' || Object.prototype.toString.call(input) === '[object Number]'; 17778 } 17779 function isDate(input) { 17780 return input instanceof Date || Object.prototype.toString.call(input) === '[object Date]'; 17781 } 17782 function map(arr, fn) { 17783 var res = [], i; 17784 for(i = 0; i < arr.length; ++i)res.push(fn(arr[i], i)); 17785 return res; 17786 } 17787 function hasOwnProp(a, b) { 17788 return Object.prototype.hasOwnProperty.call(a, b); 17789 } 17790 function extend(a, b) { 17791 for(var i in b)if (hasOwnProp(b, i)) a[i] = b[i]; 17792 if (hasOwnProp(b, 'toString')) a.toString = b.toString; 17793 if (hasOwnProp(b, 'valueOf')) a.valueOf = b.valueOf; 17794 return a; 17795 } 17796 function createUTC(input, format, locale, strict) { 17797 return createLocalOrUTC(input, format, locale, strict, true).utc(); 17798 } 17799 function defaultParsingFlags() { 17800 // We need to deep clone this object. 17801 return { 17802 empty: false, 17803 unusedTokens: [], 17804 unusedInput: [], 17805 overflow: -2, 17806 charsLeftOver: 0, 17807 nullInput: false, 17808 invalidMonth: null, 17809 invalidFormat: false, 17810 userInvalidated: false, 17811 iso: false, 17812 parsedDateParts: [], 17813 meridiem: null, 17814 rfc2822: false, 17815 weekdayMismatch: false 17816 }; 17817 } 17818 function getParsingFlags(m) { 17819 if (m._pf == null) m._pf = defaultParsingFlags(); 17820 return m._pf; 17821 } 17822 var some; 17823 if (Array.prototype.some) some = Array.prototype.some; 17824 else some = function(fun) { 17825 var t = Object(this); 17826 var len = t.length >>> 0; 17827 for(var i = 0; i < len; i++){ 17828 if (i in t && fun.call(this, t[i], i, t)) return true; 17829 } 17830 return false; 17831 }; 17832 function isValid(m) { 17833 if (m._isValid == null) { 17834 var flags = getParsingFlags(m); 17835 var parsedParts = some.call(flags.parsedDateParts, function(i) { 17836 return i != null; 17837 }); 17838 var isNowValid = !isNaN(m._d.getTime()) && flags.overflow < 0 && !flags.empty && !flags.invalidMonth && !flags.invalidWeekday && !flags.weekdayMismatch && !flags.nullInput && !flags.invalidFormat && !flags.userInvalidated && (!flags.meridiem || flags.meridiem && parsedParts); 17839 if (m._strict) isNowValid = isNowValid && flags.charsLeftOver === 0 && flags.unusedTokens.length === 0 && flags.bigHour === undefined; 17840 if (Object.isFrozen == null || !Object.isFrozen(m)) m._isValid = isNowValid; 17841 else return isNowValid; 17842 } 17843 return m._isValid; 17844 } 17845 function createInvalid(flags) { 17846 var m = createUTC(NaN); 17847 if (flags != null) extend(getParsingFlags(m), flags); 17848 else getParsingFlags(m).userInvalidated = true; 17849 return m; 17850 } 17851 // Plugins that add properties should also add the key here (null value), 17852 // so we can properly clone ourselves. 17853 var momentProperties = hooks.momentProperties = []; 17854 function copyConfig(to, from) { 17855 var i, prop, val; 17856 if (!isUndefined(from._isAMomentObject)) to._isAMomentObject = from._isAMomentObject; 17857 if (!isUndefined(from._i)) to._i = from._i; 17858 if (!isUndefined(from._f)) to._f = from._f; 17859 if (!isUndefined(from._l)) to._l = from._l; 17860 if (!isUndefined(from._strict)) to._strict = from._strict; 17861 if (!isUndefined(from._tzm)) to._tzm = from._tzm; 17862 if (!isUndefined(from._isUTC)) to._isUTC = from._isUTC; 17863 if (!isUndefined(from._offset)) to._offset = from._offset; 17864 if (!isUndefined(from._pf)) to._pf = getParsingFlags(from); 17865 if (!isUndefined(from._locale)) to._locale = from._locale; 17866 if (momentProperties.length > 0) for(i = 0; i < momentProperties.length; i++){ 17867 prop = momentProperties[i]; 17868 val = from[prop]; 17869 if (!isUndefined(val)) to[prop] = val; 17870 } 17871 return to; 17872 } 17873 var updateInProgress = false;
17874 // Moment prototype object 17875 function Moment(config) { 17876 copyConfig(this, config); 17877 this._d = new Date(config._d != null ? config._d.getTime() : NaN); 17878 if (!this.isValid()) this._d = new Date(NaN); 17879 // Prevent infinite loop in case updateOffset creates new moment 17880 // objects. 17881 if (updateInProgress === false) { 17882 updateInProgress = true; 17883 hooks.updateOffset(this); 17884 updateInProgress = false; 17885 } 17886 } 17887 function isMoment(obj) { 17888 return obj instanceof Moment || obj != null && obj._isAMomentObject != null; 17889 } 17890 function absFloor(number) { 17891 if (number < 0) // -0 -> 0 17892 return Math.ceil(number) || 0; 17893 else return Math.floor(number); 17894 } 17895 function toInt(argumentForCoercion) { 17896 var coercedNumber = +argumentForCoercion, value = 0; 17897 if (coercedNumber !== 0 && isFinite(coercedNumber)) value = absFloor(coercedNumber); 17898 return value; 17899 } 17900 // compare two arrays, return the number of differences 17901 function compareArrays(array1, array2, dontConvert) { 17902 var len = Math.min(array1.length, array2.length), lengthDiff = Math.abs(array1.length - array2.length), diffs = 0, i; 17903 for(i = 0; i < len; i++)if (dontConvert && array1[i] !== array2[i] || !dontConvert && toInt(array1[i]) !== toInt(array2[i])) diffs++; 17904 return diffs + lengthDiff; 17905 } 17906 function warn(msg) { 17907 if (hooks.suppressDeprecationWarnings === false && typeof console !== 'undefined' && console.warn) console.warn('Deprecation warning: ' + msg); 17908 } 17909 function deprecate(msg, fn) { 17910 var firstTime = true; 17911 return extend(function() { 17912 if (hooks.deprecationHandler != null) hooks.deprecationHandler(null, msg); 17913 if (firstTime) { 17914 var args = []; 17915 var arg; 17916 for(var i = 0; i < arguments.length; i++){ 17917 arg = ''; 17918 if (typeof arguments[i] === 'object') { 17919 arg += '\n[' + i + '] '; 17920 for(var key in arguments[0])arg += key + ': ' + arguments[0][key] + ', '; 17921 arg = arg.slice(0, -2); // Remove trailing comma and space 17922 } else arg = arguments[i]; 17923 args.push(arg); 17924 } 17925 warn(msg + '\nArguments: ' + Array.prototype.slice.call(args).join('') + '\n' + new Error().stack); 17926 firstTime = false; 17927 } 17928 return fn.apply(this, arguments); 17929 }, fn); 17930 } 17931 var deprecations = {}; 17932 function deprecateSimple(name, msg) { 17933 if (hooks.deprecationHandler != null) hooks.deprecationHandler(name, msg); 17934 if (!deprecations[name]) { 17935 warn(msg); 17936 deprecations[name] = true; 17937 } 17938 } 17939 hooks.suppressDeprecationWarnings = false; 17940 hooks.deprecationHandler = null; 17941 function isFunction(input) { 17942 return input instanceof Function || Object.prototype.toString.call(input) === '[object Function]'; 17943 } 17944 function set(config) { 17945 var prop, i; 17946 for(i in config){ 17947 prop = config[i]; 17948 if (isFunction(prop)) this[i] = prop; 17949 else this['_' + i] = prop; 17950 } 17951 this._config = config; 17952 // Lenient ordinal parsing accepts just a number in addition to 17953 // number + (possibly) stuff coming from _dayOfMonthOrdinalParse. 17954 // TODO: Remove "ordinalParse" fallback in next major release. 17955 this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + '|' + /\d{1,2}/.source); 17956 } 17957 function mergeConfigs(parentConfig, childConfig) { 17958 var res = extend({}, parentConfig), prop; 17959 for(prop in childConfig)if (hasOwnProp(childConfig, prop)) { 17960 if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) { 17961 res[prop] = {}; 17962 extend(res[prop], parentConfig[prop]); 17963 extend(res[prop], childConfig[prop]); 17964 } else if (childConfig[prop] != null) res[prop] = childConfig[prop]; 17965 else delete res[prop]; 17966 } 17967 for(prop in parentConfig)if (hasOwnProp(parentConfig, prop) && !hasOwnProp(childConfig, prop) && isObject(parentConfig[prop])) // make sure changes to properties don't modify parent config 17968 res[prop] = extend({}, res[prop]); 17969 return res; 17970 } 17971 function Locale(config) { 17972 if (config != null) this.set(config); 17973 } 17974 var keys; 17975 if (Object.keys) keys = Object.keys; 17976 else keys = function(obj) { 17977 var i, res = []; 17978 for(i in obj)if (hasOwnProp(obj, i)) res.push(i); 17979 return res; 17980 }; 17981 var defaultCalendar = { 17982 sameDay: '[Today at] LT', 17983 nextDay: '[Tomorrow at] LT', 17984 nextWeek: 'dddd [at] LT', 17985 lastDay: '[Yesterday at] LT', 17986 lastWeek: '[Last] dddd [at] LT', 17987 sameElse: 'L' 17988 }; 17989 function calendar(key, mom, now) { 17990 var output = this._calendar[key] || this._calendar['sameElse']; 17991 return isFunction(output) ? output.call(mom, now) : output; 17992 } 17993 var defaultLongDateFormat = { 17994 LTS: 'h:mm:ss A', 17995 LT: 'h:mm A', 17996 L: 'MM/DD/YYYY', 17997 LL: 'MMMM D, YYYY', 17998 LLL: 'MMMM D, YYYY h:mm A', 17999 LLLL: 'dddd, MMMM D, YYYY h:mm A' 18000 }; 18001 function longDateFormat(key) { 18002 var format = this._longDateFormat[key], formatUpper = this._longDateFormat[key.toUpperCase()]; 18003 if (format || !formatUpper) return format; 18004 this._longDateFormat[key] = formatUpper.replace(/MMMM|MM|DD|dddd/g, function(val) { 18005 return val.slice(1); 18006 }); 18007 return this._longDateFormat[key]; 18008 } 18009 var defaultInvalidDate = 'Invalid date';
vendor: 12,822 bytes, lines 18010-18351
18010 function invalidDate() { 18011 return this._invalidDate; 18012 } 18013 var defaultOrdinal = '%d'; 18014 var defaultDayOfMonthOrdinalParse = /\d{1,2}/; 18015 function ordinal(number) { 18016 return this._ordinal.replace('%d', number); 18017 } 18018 var defaultRelativeTime = { 18019 future: 'in %s', 18020 past: '%s ago', 18021 s: 'a few seconds', 18022 ss: '%d seconds', 18023 m: 'a minute', 18024 mm: '%d minutes', 18025 h: 'an hour', 18026 hh: '%d hours', 18027 d: 'a day', 18028 dd: '%d days', 18029 M: 'a month', 18030 MM: '%d months', 18031 y: 'a year', 18032 yy: '%d years' 18033 }; 18034 function relativeTime(number, withoutSuffix, string, isFuture) { 18035 var output = this._relativeTime[string]; 18036 return isFunction(output) ? output(number, withoutSuffix, string, isFuture) : output.replace(/%d/i, number); 18037 } 18038 function pastFuture(diff, output) { 18039 var format = this._relativeTime[diff > 0 ? 'future' : 'past']; 18040 return isFunction(format) ? format(output) : format.replace(/%s/i, output); 18041 } 18042 var aliases = {}; 18043 function addUnitAlias(unit, shorthand) { 18044 var lowerCase = unit.toLowerCase(); 18045 aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit; 18046 } 18047 function normalizeUnits(units) { 18048 return typeof units === 'string' ? aliases[units] || aliases[units.toLowerCase()] : undefined; 18049 } 18050 function normalizeObjectUnits(inputObject) { 18051 var normalizedInput = {}, normalizedProp, prop; 18052 for(prop in inputObject)if (hasOwnProp(inputObject, prop)) { 18053 normalizedProp = normalizeUnits(prop); 18054 if (normalizedProp) normalizedInput[normalizedProp] = inputObject[prop]; 18055 } 18056 return normalizedInput; 18057 } 18058 var priorities = {}; 18059 function addUnitPriority(unit, priority) { 18060 priorities[unit] = priority; 18061 } 18062 function getPrioritizedUnits(unitsObj) { 18063 var units = []; 18064 for(var u in unitsObj)units.push({ 18065 unit: u, 18066 priority: priorities[u] 18067 }); 18068 units.sort(function(a, b) { 18069 return a.priority - b.priority; 18070 }); 18071 return units; 18072 } 18073 function zeroFill(number, targetLength, forceSign) { 18074 var absNumber = '' + Math.abs(number), zerosToFill = targetLength - absNumber.length, sign = number >= 0; 18075 return (sign ? forceSign ? '+' : '' : '-') + Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) + absNumber; 18076 } 18077 var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|YYYYYY|YYYYY|YYYY|YY|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g; 18078 var localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g; 18079 var formatFunctions = {}; 18080 var formatTokenFunctions = {}; 18081 // token: 'M' 18082 // padded: ['MM', 2] 18083 // ordinal: 'Mo' 18084 // callback: function () { this.month() + 1 } 18085 function addFormatToken(token, padded, ordinal, callback) { 18086 var func = callback; 18087 if (typeof callback === 'string') func = function() { 18088 return this[callback](); 18089 }; 18090 if (token) formatTokenFunctions[token] = func; 18091 if (padded) formatTokenFunctions[padded[0]] = function() { 18092 return zeroFill(func.apply(this, arguments), padded[1], padded[2]); 18093 }; 18094 if (ordinal) formatTokenFunctions[ordinal] = function() { 18095 return this.localeData().ordinal(func.apply(this, arguments), token); 18096 }; 18097 } 18098 function removeFormattingTokens(input) { 18099 if (input.match(/\[[\s\S]/)) return input.replace(/^\[|\]$/g, ''); 18100 return input.replace(/\\/g, ''); 18101 } 18102 function makeFormatFunction(format) { 18103 var array = format.match(formattingTokens), i, length; 18104 for(i = 0, length = array.length; i < length; i++)if (formatTokenFunctions[array[i]]) array[i] = formatTokenFunctions[array[i]]; 18105 else array[i] = removeFormattingTokens(array[i]); 18106 return function(mom) { 18107 var output = '', i; 18108 for(i = 0; i < length; i++)output += isFunction(array[i]) ? array[i].call(mom, format) : array[i]; 18109 return output; 18110 }; 18111 } 18112 // format date using native date object 18113 function formatMoment(m, format) { 18114 if (!m.isValid()) return m.localeData().invalidDate(); 18115 format = expandFormat(format, m.localeData()); 18116 formatFunctions[format] = formatFunctions[format] || makeFormatFunction(format); 18117 return formatFunctions[format](m); 18118 } 18119 function expandFormat(format, locale) { 18120 var i = 5; 18121 function replaceLongDateFormatTokens(input) { 18122 return locale.longDateFormat(input) || input; 18123 } 18124 localFormattingTokens.lastIndex = 0; 18125 while(i >= 0 && localFormattingTokens.test(format)){ 18126 format = format.replace(localFormattingTokens, replaceLongDateFormatTokens); 18127 localFormattingTokens.lastIndex = 0; 18128 i -= 1; 18129 } 18130 return format; 18131 } 18132 var match1 = /\d/; // 0 - 9 18133 var match2 = /\d\d/; // 00 - 99 18134 var match3 = /\d{3}/; // 000 - 999 18135 var match4 = /\d{4}/; // 0000 - 9999 18136 var match6 = /[+-]?\d{6}/; // -999999 - 999999 18137 var match1to2 = /\d\d?/; // 0 - 99 18138 var match3to4 = /\d\d\d\d?/; // 999 - 9999 18139 var match5to6 = /\d\d\d\d\d\d?/; // 99999 - 999999 18140 var match1to3 = /\d{1,3}/; // 0 - 999 18141 var match1to4 = /\d{1,4}/; // 0 - 9999 18142 var match1to6 = /[+-]?\d{1,6}/; // -999999 - 999999 18143 var matchUnsigned = /\d+/; // 0 - inf 18144 var matchSigned = /[+-]?\d+/; // -inf - inf 18145 var matchOffset = /Z|[+-]\d\d:?\d\d/gi; // +00:00 -00:00 +0000 -0000 or Z 18146 var matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi; // +00 -00 +00:00 -00:00 +0000 -0000 or Z 18147 var matchTimestamp = /[+-]?\d+(\.\d{1,3})?/; // 123456789 123456789.123 18148 // any word (or two) characters or numbers including two/three word month in arabic. 18149 // includes scottish gaelic two word and hyphenated months 18150 var matchWord = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i; 18151 var regexes = {}; 18152 function addRegexToken(token, regex, strictRegex) { 18153 regexes[token] = isFunction(regex) ? regex : function(isStrict, localeData) { 18154 return isStrict && strictRegex ? strictRegex : regex; 18155 }; 18156 } 18157 function getParseRegexForToken(token, config) { 18158 if (!hasOwnProp(regexes, token)) return new RegExp(unescapeFormat(token)); 18159 return regexes[token](config._strict, config._locale); 18160 } 18161 // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript 18162 function unescapeFormat(s) { 18163 return regexEscape(s.replace('\\', '').replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function(matched, p1, p2, p3, p4) { 18164 return p1 || p2 || p3 || p4; 18165 })); 18166 } 18167 function regexEscape(s) { 18168 return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&'); 18169 } 18170 var tokens = {}; 18171 function addParseToken(token, callback) { 18172 var i, func = callback; 18173 if (typeof token === 'string') token = [ 18174 token 18175 ]; 18176 if (isNumber(callback)) func = function(input, array) { 18177 array[callback] = toInt(input); 18178 }; 18179 for(i = 0; i < token.length; i++)tokens[token[i]] = func; 18180 } 18181 function addWeekParseToken(token, callback) { 18182 addParseToken(token, function(input, array, config, token) { 18183 config._w = config._w || {}; 18184 callback(input, config._w, config, token); 18185 }); 18186 } 18187 function addTimeToArrayFromToken(token, input, config) { 18188 if (input != null && hasOwnProp(tokens, token)) tokens[token](input, config._a, config, token); 18189 } 18190 var YEAR = 0; 18191 var MONTH = 1; 18192 var DATE = 2; 18193 var HOUR = 3; 18194 var MINUTE = 4; 18195 var SECOND = 5; 18196 var MILLISECOND = 6; 18197 var WEEK = 7; 18198 var WEEKDAY = 8; 18199 // FORMATTING 18200 addFormatToken('Y', 0, 0, function() { 18201 var y = this.year(); 18202 return y <= 9999 ? '' + y : '+' + y; 18203 }); 18204 addFormatToken(0, [ 18205 'YY', 18206 2 18207 ], 0, function() { 18208 return this.year() % 100; 18209 }); 18210 addFormatToken(0, [ 18211 'YYYY', 18212 4 18213 ], 0, 'year'); 18214 addFormatToken(0, [ 18215 'YYYYY', 18216 5 18217 ], 0, 'year'); 18218 addFormatToken(0, [ 18219 'YYYYYY', 18220 6, 18221 true 18222 ], 0, 'year'); 18223 // ALIASES 18224 addUnitAlias('year', 'y'); 18225 // PRIORITIES 18226 addUnitPriority('year', 1); 18227 // PARSING 18228 addRegexToken('Y', matchSigned); 18229 addRegexToken('YY', match1to2, match2); 18230 addRegexToken('YYYY', match1to4, match4); 18231 addRegexToken('YYYYY', match1to6, match6); 18232 addRegexToken('YYYYYY', match1to6, match6); 18233 addParseToken([ 18234 'YYYYY', 18235 'YYYYYY' 18236 ], YEAR); 18237 addParseToken('YYYY', function(input, array) { 18238 array[YEAR] = input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input); 18239 }); 18240 addParseToken('YY', function(input, array) { 18241 array[YEAR] = hooks.parseTwoDigitYear(input); 18242 }); 18243 addParseToken('Y', function(input, array) { 18244 array[YEAR] = parseInt(input, 10); 18245 }); 18246 // HELPERS 18247 function daysInYear(year) { 18248 return isLeapYear(year) ? 366 : 365; 18249 } 18250 function isLeapYear(year) { 18251 return year % 4 === 0 && year % 100 !== 0 || year % 400 === 0; 18252 } 18253 // HOOKS 18254 hooks.parseTwoDigitYear = function(input) { 18255 return toInt(input) + (toInt(input) > 68 ? 1900 : 2000); 18256 }; 18257 // MOMENTS 18258 var getSetYear = makeGetSet('FullYear', true); 18259 function getIsLeapYear() { 18260 return isLeapYear(this.year()); 18261 } 18262 function makeGetSet(unit, keepTime) { 18263 return function(value) { 18264 if (value != null) { 18265 set$1(this, unit, value); 18266 hooks.updateOffset(this, keepTime); 18267 return this; 18268 } else return get(this, unit); 18269 }; 18270 } 18271 function get(mom, unit) { 18272 return mom.isValid() ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]() : NaN; 18273 } 18274 function set$1(mom, unit, value) { 18275 if (mom.isValid() && !isNaN(value)) { 18276 if (unit === 'FullYear' && isLeapYear(mom.year()) && mom.month() === 1 && mom.date() === 29) mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value, mom.month(), daysInMonth(value, mom.month())); 18277 else mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value); 18278 } 18279 } 18280 // MOMENTS 18281 function stringGet(units) { 18282 units = normalizeUnits(units); 18283 if (isFunction(this[units])) return this[units](); 18284 return this; 18285 } 18286 function stringSet(units, value) { 18287 if (typeof units === 'object') { 18288 units = normalizeObjectUnits(units); 18289 var prioritized = getPrioritizedUnits(units); 18290 for(var i = 0; i < prioritized.length; i++)this[prioritized[i].unit](units[prioritized[i].unit]); 18291 } else { 18292 units = normalizeUnits(units); 18293 if (isFunction(this[units])) return this[units](value); 18294 } 18295 return this; 18296 } 18297 function mod(n, x) { 18298 return (n % x + x) % x; 18299 } 18300 var indexOf; 18301 if (Array.prototype.indexOf) indexOf = Array.prototype.indexOf; 18302 else indexOf = function(o) { 18303 // I know 18304 var i; 18305 for(i = 0; i < this.length; ++i){ 18306 if (this[i] === o) return i; 18307 } 18308 return -1; 18309 }; 18310 function daysInMonth(year, month) { 18311 if (isNaN(year) || isNaN(month)) return NaN; 18312 var modMonth = mod(month, 12); 18313 year += (month - modMonth) / 12; 18314 return modMonth === 1 ? isLeapYear(year) ? 29 : 28 : 31 - modMonth % 7 % 2; 18315 } 18316 // FORMATTING 18317 addFormatToken('M', [ 18318 'MM', 18319 2 18320 ], 'Mo', function() { 18321 return this.month() + 1; 18322 }); 18323 addFormatToken('MMM', 0, 0, function(format) { 18324 return this.localeData().monthsShort(this, format); 18325 }); 18326 addFormatToken('MMMM', 0, 0, function(format) { 18327 return this.localeData().months(this, format); 18328 }); 18329 // ALIASES 18330 addUnitAlias('month', 'M'); 18331 // PRIORITY 18332 addUnitPriority('month', 8); 18333 // PARSING 18334 addRegexToken('M', match1to2); 18335 addRegexToken('MM', match1to2, match2); 18336 addRegexToken('MMM', function(isStrict, locale) { 18337 return locale.monthsShortRegex(isStrict); 18338 }); 18339 addRegexToken('MMMM', function(isStrict, locale) { 18340 return locale.monthsRegex(isStrict); 18341 }); 18342 addParseToken([ 18343 'M', 18344 'MM' 18345 ], function(input, array) { 18346 array[MONTH] = toInt(input) - 1; 18347 }); 18348 addParseToken([ 18349 'MMM', 18350 'MMMM' 18351 ], function(input, array, config, token) {
vendor: 10,682 bytes, lines 18352-18594
18352 var month = config._locale.monthsParse(input, token, config._strict); 18353 // if we didn't find a month name, mark the date as invalid. 18354 if (month != null) array[MONTH] = month; 18355 else getParsingFlags(config).invalidMonth = input; 18356 }); 18357 // LOCALES 18358 var MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/; 18359 var defaultLocaleMonths = 'January_February_March_April_May_June_July_August_September_October_November_December'.split('_'); 18360 function localeMonths(m, format) { 18361 if (!m) return isArray(this._months) ? this._months : this._months['standalone']; 18362 return isArray(this._months) ? this._months[m.month()] : this._months[(this._months.isFormat || MONTHS_IN_FORMAT).test(format) ? 'format' : 'standalone'][m.month()]; 18363 } 18364 var defaultLocaleMonthsShort = 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'); 18365 function localeMonthsShort(m, format) { 18366 if (!m) return isArray(this._monthsShort) ? this._monthsShort : this._monthsShort['standalone']; 18367 return isArray(this._monthsShort) ? this._monthsShort[m.month()] : this._monthsShort[MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'][m.month()]; 18368 } 18369 function handleStrictParse(monthName, format, strict) { 18370 var i, ii, mom, llc = monthName.toLocaleLowerCase(); 18371 if (!this._monthsParse) { 18372 // this is not used 18373 this._monthsParse = []; 18374 this._longMonthsParse = []; 18375 this._shortMonthsParse = []; 18376 for(i = 0; i < 12; ++i){ 18377 mom = createUTC([ 18378 2000, 18379 i 18380 ]); 18381 this._shortMonthsParse[i] = this.monthsShort(mom, '').toLocaleLowerCase(); 18382 this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase(); 18383 } 18384 } 18385 if (strict) { 18386 if (format === 'MMM') { 18387 ii = indexOf.call(this._shortMonthsParse, llc); 18388 return ii !== -1 ? ii : null; 18389 } else { 18390 ii = indexOf.call(this._longMonthsParse, llc); 18391 return ii !== -1 ? ii : null; 18392 } 18393 } else if (format === 'MMM') { 18394 ii = indexOf.call(this._shortMonthsParse, llc); 18395 if (ii !== -1) return ii; 18396 ii = indexOf.call(this._longMonthsParse, llc); 18397 return ii !== -1 ? ii : null; 18398 } else { 18399 ii = indexOf.call(this._longMonthsParse, llc); 18400 if (ii !== -1) return ii; 18401 ii = indexOf.call(this._shortMonthsParse, llc); 18402 return ii !== -1 ? ii : null; 18403 } 18404 } 18405 function localeMonthsParse(monthName, format, strict) { 18406 var i, mom, regex; 18407 if (this._monthsParseExact) return handleStrictParse.call(this, monthName, format, strict); 18408 if (!this._monthsParse) { 18409 this._monthsParse = []; 18410 this._longMonthsParse = []; 18411 this._shortMonthsParse = []; 18412 } 18413 // TODO: add sorting 18414 // Sorting makes sure if one month (or abbr) is a prefix of another 18415 // see sorting in computeMonthsParse 18416 for(i = 0; i < 12; i++){ 18417 // make the regex if we don't have it already 18418 mom = createUTC([ 18419 2000, 18420 i 18421 ]); 18422 if (strict && !this._longMonthsParse[i]) { 18423 this._longMonthsParse[i] = new RegExp('^' + this.months(mom, '').replace('.', '') + '$', 'i'); 18424 this._shortMonthsParse[i] = new RegExp('^' + this.monthsShort(mom, '').replace('.', '') + '$', 'i'); 18425 } 18426 if (!strict && !this._monthsParse[i]) { 18427 regex = '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, ''); 18428 this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i'); 18429 } 18430 // test the regex 18431 if (strict && format === 'MMMM' && this._longMonthsParse[i].test(monthName)) return i; 18432 else if (strict && format === 'MMM' && this._shortMonthsParse[i].test(monthName)) return i; 18433 else if (!strict && this._monthsParse[i].test(monthName)) return i; 18434 } 18435 } 18436 // MOMENTS 18437 function setMonth(mom, value) { 18438 var dayOfMonth; 18439 if (!mom.isValid()) // No op 18440 return mom; 18441 if (typeof value === 'string') { 18442 if (/^\d+$/.test(value)) value = toInt(value); 18443 else { 18444 value = mom.localeData().monthsParse(value); 18445 // TODO: Another silent failure? 18446 if (!isNumber(value)) return mom; 18447 } 18448 } 18449 dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value)); 18450 mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth); 18451 return mom; 18452 } 18453 function getSetMonth(value) { 18454 if (value != null) { 18455 setMonth(this, value); 18456 hooks.updateOffset(this, true); 18457 return this; 18458 } else return get(this, 'Month'); 18459 } 18460 function getDaysInMonth() { 18461 return daysInMonth(this.year(), this.month()); 18462 } 18463 var defaultMonthsShortRegex = matchWord; 18464 function monthsShortRegex(isStrict) { 18465 if (this._monthsParseExact) { 18466 if (!hasOwnProp(this, '_monthsRegex')) computeMonthsParse.call(this); 18467 if (isStrict) return this._monthsShortStrictRegex; 18468 else return this._monthsShortRegex; 18469 } else { 18470 if (!hasOwnProp(this, '_monthsShortRegex')) this._monthsShortRegex = defaultMonthsShortRegex; 18471 return this._monthsShortStrictRegex && isStrict ? this._monthsShortStrictRegex : this._monthsShortRegex; 18472 } 18473 } 18474 var defaultMonthsRegex = matchWord; 18475 function monthsRegex(isStrict) { 18476 if (this._monthsParseExact) { 18477 if (!hasOwnProp(this, '_monthsRegex')) computeMonthsParse.call(this); 18478 if (isStrict) return this._monthsStrictRegex; 18479 else return this._monthsRegex; 18480 } else { 18481 if (!hasOwnProp(this, '_monthsRegex')) this._monthsRegex = defaultMonthsRegex; 18482 return this._monthsStrictRegex && isStrict ? this._monthsStrictRegex : this._monthsRegex; 18483 } 18484 } 18485 function computeMonthsParse() { 18486 function cmpLenRev(a, b) { 18487 return b.length - a.length; 18488 } 18489 var shortPieces = [], longPieces = [], mixedPieces = [], i, mom; 18490 for(i = 0; i < 12; i++){ 18491 // make the regex if we don't have it already 18492 mom = createUTC([ 18493 2000, 18494 i 18495 ]); 18496 shortPieces.push(this.monthsShort(mom, '')); 18497 longPieces.push(this.months(mom, '')); 18498 mixedPieces.push(this.months(mom, '')); 18499 mixedPieces.push(this.monthsShort(mom, '')); 18500 } 18501 // Sorting makes sure if one month (or abbr) is a prefix of another it 18502 // will match the longer piece. 18503 shortPieces.sort(cmpLenRev); 18504 longPieces.sort(cmpLenRev); 18505 mixedPieces.sort(cmpLenRev); 18506 for(i = 0; i < 12; i++){ 18507 shortPieces[i] = regexEscape(shortPieces[i]); 18508 longPieces[i] = regexEscape(longPieces[i]); 18509 } 18510 for(i = 0; i < 24; i++)mixedPieces[i] = regexEscape(mixedPieces[i]); 18511 this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); 18512 this._monthsShortRegex = this._monthsRegex; 18513 this._monthsStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); 18514 this._monthsShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); 18515 } 18516 function createDate(y, m, d, h, M, s, ms) { 18517 // can't just apply() to create a date: 18518 // https://stackoverflow.com/q/181348 18519 var date = new Date(y, m, d, h, M, s, ms); 18520 // the date constructor remaps years 0-99 to 1900-1999 18521 if (y < 100 && y >= 0 && isFinite(date.getFullYear())) date.setFullYear(y); 18522 return date; 18523 } 18524 function createUTCDate(y) { 18525 var date = new Date(Date.UTC.apply(null, arguments)); 18526 // the Date.UTC function remaps years 0-99 to 1900-1999 18527 if (y < 100 && y >= 0 && isFinite(date.getUTCFullYear())) date.setUTCFullYear(y); 18528 return date; 18529 } 18530 // start-of-first-week - start-of-year 18531 function firstWeekOffset(year, dow, doy) { 18532 var fwd = 7 + dow - doy, // first-week day local weekday -- which local weekday is fwd 18533 fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7; 18534 return -fwdlw + fwd - 1; 18535 } 18536 // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday 18537 function dayOfYearFromWeeks(year, week, weekday, dow, doy) { 18538 var localWeekday = (7 + weekday - dow) % 7, weekOffset = firstWeekOffset(year, dow, doy), dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset, resYear, resDayOfYear; 18539 if (dayOfYear <= 0) { 18540 resYear = year - 1; 18541 resDayOfYear = daysInYear(resYear) + dayOfYear; 18542 } else if (dayOfYear > daysInYear(year)) { 18543 resYear = year + 1; 18544 resDayOfYear = dayOfYear - daysInYear(year); 18545 } else { 18546 resYear = year; 18547 resDayOfYear = dayOfYear; 18548 } 18549 return { 18550 year: resYear, 18551 dayOfYear: resDayOfYear 18552 }; 18553 } 18554 function weekOfYear(mom, dow, doy) { 18555 var weekOffset = firstWeekOffset(mom.year(), dow, doy), week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1, resWeek, resYear; 18556 if (week < 1) { 18557 resYear = mom.year() - 1; 18558 resWeek = week + weeksInYear(resYear, dow, doy); 18559 } else if (week > weeksInYear(mom.year(), dow, doy)) { 18560 resWeek = week - weeksInYear(mom.year(), dow, doy); 18561 resYear = mom.year() + 1; 18562 } else { 18563 resYear = mom.year(); 18564 resWeek = week; 18565 } 18566 return { 18567 week: resWeek, 18568 year: resYear 18569 }; 18570 } 18571 function weeksInYear(year, dow, doy) { 18572 var weekOffset = firstWeekOffset(year, dow, doy), weekOffsetNext = firstWeekOffset(year + 1, dow, doy); 18573 return (daysInYear(year) - weekOffset + weekOffsetNext) / 7; 18574 } 18575 // FORMATTING 18576 addFormatToken('w', [ 18577 'ww', 18578 2 18579 ], 'wo', 'week'); 18580 addFormatToken('W', [ 18581 'WW', 18582 2 18583 ], 'Wo', 'isoWeek'); 18584 // ALIASES 18585 addUnitAlias('week', 'w'); 18586 addUnitAlias('isoWeek', 'W'); 18587 // PRIORITIES 18588 addUnitPriority('week', 5); 18589 addUnitPriority('isoWeek', 5); 18590 // PARSING 18591 addRegexToken('w', match1to2); 18592 addRegexToken('ww', match1to2, match2); 18593 addRegexToken('W', match1to2); 18594 addRegexToken('WW', match1to2, match2);
vendor: 2,134 bytes, lines 18595-18660
18595 addWeekParseToken([ 18596 'w', 18597 'ww', 18598 'W', 18599 'WW' 18600 ], function(input, week, config, token) { 18601 week[token.substr(0, 1)] = toInt(input); 18602 }); 18603 // HELPERS 18604 // LOCALES 18605 function localeWeek(mom) { 18606 return weekOfYear(mom, this._week.dow, this._week.doy).week; 18607 } 18608 var defaultLocaleWeek = { 18609 dow: 0, 18610 doy: 6 // The week that contains Jan 1st is the first week of the year. 18611 }; 18612 function localeFirstDayOfWeek() { 18613 return this._week.dow; 18614 } 18615 function localeFirstDayOfYear() { 18616 return this._week.doy; 18617 } 18618 // MOMENTS 18619 function getSetWeek(input) { 18620 var week = this.localeData().week(this); 18621 return input == null ? week : this.add((input - week) * 7, 'd'); 18622 } 18623 function getSetISOWeek(input) { 18624 var week = weekOfYear(this, 1, 4).week; 18625 return input == null ? week : this.add((input - week) * 7, 'd'); 18626 } 18627 // FORMATTING 18628 addFormatToken('d', 0, 'do', 'day'); 18629 addFormatToken('dd', 0, 0, function(format) { 18630 return this.localeData().weekdaysMin(this, format); 18631 }); 18632 addFormatToken('ddd', 0, 0, function(format) { 18633 return this.localeData().weekdaysShort(this, format); 18634 }); 18635 addFormatToken('dddd', 0, 0, function(format) { 18636 return this.localeData().weekdays(this, format); 18637 }); 18638 addFormatToken('e', 0, 0, 'weekday'); 18639 addFormatToken('E', 0, 0, 'isoWeekday'); 18640 // ALIASES 18641 addUnitAlias('day', 'd'); 18642 addUnitAlias('weekday', 'e'); 18643 addUnitAlias('isoWeekday', 'E'); 18644 // PRIORITY 18645 addUnitPriority('day', 11); 18646 addUnitPriority('weekday', 11); 18647 addUnitPriority('isoWeekday', 11); 18648 // PARSING 18649 addRegexToken('d', match1to2); 18650 addRegexToken('e', match1to2); 18651 addRegexToken('E', match1to2); 18652 addRegexToken('dd', function(isStrict, locale) { 18653 return locale.weekdaysMinRegex(isStrict); 18654 }); 18655 addRegexToken('ddd', function(isStrict, locale) { 18656 return locale.weekdaysShortRegex(isStrict); 18657 }); 18658 addRegexToken('dddd', function(isStrict, locale) { 18659 return locale.weekdaysRegex(isStrict); 18660 });
18661 addWeekParseToken([ 18662 'dd', 18663 'ddd', 18664 'dddd' 18665 ], function(input, week, config, token) { 18666 var weekday = config._locale.weekdaysParse(input, token, config._strict); 18667 // if we didn't get a weekday name, mark the date as invalid 18668 if (weekday != null) week.d = weekday; 18669 else getParsingFlags(config).invalidWeekday = input; 18670 }); 18671 addWeekParseToken([ 18672 'd', 18673 'e', 18674 'E' 18675 ], function(input, week, config, token) { 18676 week[token] = toInt(input); 18677 }); 18678 // HELPERS 18679 function parseWeekday(input, locale) { 18680 if (typeof input !== 'string') return input; 18681 if (!isNaN(input)) return parseInt(input, 10); 18682 input = locale.weekdaysParse(input); 18683 if (typeof input === 'number') return input; 18684 return null; 18685 } 18686 function parseIsoWeekday(input, locale) { 18687 if (typeof input === 'string') return locale.weekdaysParse(input) % 7 || 7; 18688 return isNaN(input) ? null : input; 18689 } 18690 // LOCALES 18691 var defaultLocaleWeekdays = 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'); 18692 function localeWeekdays(m, format) { 18693 if (!m) return isArray(this._weekdays) ? this._weekdays : this._weekdays['standalone']; 18694 return isArray(this._weekdays) ? this._weekdays[m.day()] : this._weekdays[this._weekdays.isFormat.test(format) ? 'format' : 'standalone'][m.day()]; 18695 } 18696 var defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'); 18697 function localeWeekdaysShort(m) { 18698 return m ? this._weekdaysShort[m.day()] : this._weekdaysShort; 18699 } 18700 var defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'); 18701 function localeWeekdaysMin(m) { 18702 return m ? this._weekdaysMin[m.day()] : this._weekdaysMin; 18703 } 18704 function handleStrictParse$1(weekdayName, format, strict) { 18705 var i, ii, mom, llc = weekdayName.toLocaleLowerCase(); 18706 if (!this._weekdaysParse) { 18707 this._weekdaysParse = []; 18708 this._shortWeekdaysParse = []; 18709 this._minWeekdaysParse = []; 18710 for(i = 0; i < 7; ++i){ 18711 mom = createUTC([ 18712 2000, 18713 1 18714 ]).day(i); 18715 this._minWeekdaysParse[i] = this.weekdaysMin(mom, '').toLocaleLowerCase(); 18716 this._shortWeekdaysParse[i] = this.weekdaysShort(mom, '').toLocaleLowerCase(); 18717 this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase(); 18718 } 18719 } 18720 if (strict) { 18721 if (format === 'dddd') { 18722 ii = indexOf.call(this._weekdaysParse, llc); 18723 return ii !== -1 ? ii : null; 18724 } else if (format === 'ddd') { 18725 ii = indexOf.call(this._shortWeekdaysParse, llc); 18726 return ii !== -1 ? ii : null; 18727 } else { 18728 ii = indexOf.call(this._minWeekdaysParse, llc); 18729 return ii !== -1 ? ii : null; 18730 } 18731 } else { 18732 if (format === 'dddd') { 18733 ii = indexOf.call(this._weekdaysParse, llc); 18734 if (ii !== -1) return ii; 18735 ii = indexOf.call(this._shortWeekdaysParse, llc); 18736 if (ii !== -1) return ii; 18737 ii = indexOf.call(this._minWeekdaysParse, llc); 18738 return ii !== -1 ? ii : null; 18739 } else if (format === 'ddd') { 18740 ii = indexOf.call(this._shortWeekdaysParse, llc); 18741 if (ii !== -1) return ii; 18742 ii = indexOf.call(this._weekdaysParse, llc); 18743 if (ii !== -1) return ii; 18744 ii = indexOf.call(this._minWeekdaysParse, llc); 18745 return ii !== -1 ? ii : null; 18746 } else { 18747 ii = indexOf.call(this._minWeekdaysParse, llc); 18748 if (ii !== -1) return ii; 18749 ii = indexOf.call(this._weekdaysParse, llc); 18750 if (ii !== -1) return ii; 18751 ii = indexOf.call(this._shortWeekdaysParse, llc); 18752 return ii !== -1 ? ii : null; 18753 } 18754 } 18755 } 18756 function localeWeekdaysParse(weekdayName, format, strict) { 18757 var i, mom, regex; 18758 if (this._weekdaysParseExact) return handleStrictParse$1.call(this, weekdayName, format, strict); 18759 if (!this._weekdaysParse) { 18760 this._weekdaysParse = []; 18761 this._minWeekdaysParse = []; 18762 this._shortWeekdaysParse = []; 18763 this._fullWeekdaysParse = []; 18764 } 18765 for(i = 0; i < 7; i++){ 18766 // make the regex if we don't have it already 18767 mom = createUTC([ 18768 2000, 18769 1 18770 ]).day(i); 18771 if (strict && !this._fullWeekdaysParse[i]) { 18772 this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i'); 18773 this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i'); 18774 this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i'); 18775 } 18776 if (!this._weekdaysParse[i]) { 18777 regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, ''); 18778 this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i'); 18779 } 18780 // test the regex 18781 if (strict && format === 'dddd' && this._fullWeekdaysParse[i].test(weekdayName)) return i; 18782 else if (strict && format === 'ddd' && this._shortWeekdaysParse[i].test(weekdayName)) return i; 18783 else if (strict && format === 'dd' && this._minWeekdaysParse[i].test(weekdayName)) return i; 18784 else if (!strict && this._weekdaysParse[i].test(weekdayName)) return i; 18785 } 18786 } 18787 // MOMENTS 18788 function getSetDayOfWeek(input) { 18789 if (!this.isValid()) return input != null ? this : NaN; 18790 var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); 18791 if (input != null) { 18792 input = parseWeekday(input, this.localeData()); 18793 return this.add(input - day, 'd'); 18794 } else return day; 18795 } 18796 function getSetLocaleDayOfWeek(input) { 18797 if (!this.isValid()) return input != null ? this : NaN; 18798 var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7; 18799 return input == null ? weekday : this.add(input - weekday, 'd'); 18800 } 18801 function getSetISODayOfWeek(input) { 18802 if (!this.isValid()) return input != null ? this : NaN; 18803 // behaves the same as moment#day except 18804 // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6) 18805 // as a setter, sunday should belong to the previous week. 18806 if (input != null) { 18807 var weekday = parseIsoWeekday(input, this.localeData()); 18808 return this.day(this.day() % 7 ? weekday : weekday - 7); 18809 } else return this.day() || 7; 18810 } 18811 var defaultWeekdaysRegex = matchWord; 18812 function weekdaysRegex(isStrict) { 18813 if (this._weekdaysParseExact) { 18814 if (!hasOwnProp(this, '_weekdaysRegex')) computeWeekdaysParse.call(this); 18815 if (isStrict) return this._weekdaysStrictRegex; 18816 else return this._weekdaysRegex; 18817 } else { 18818 if (!hasOwnProp(this, '_weekdaysRegex')) this._weekdaysRegex = defaultWeekdaysRegex; 18819 return this._weekdaysStrictRegex && isStrict ? this._weekdaysStrictRegex : this._weekdaysRegex; 18820 } 18821 } 18822 var defaultWeekdaysShortRegex = matchWord; 18823 function weekdaysShortRegex(isStrict) { 18824 if (this._weekdaysParseExact) { 18825 if (!hasOwnProp(this, '_weekdaysRegex')) computeWeekdaysParse.call(this); 18826 if (isStrict) return this._weekdaysShortStrictRegex; 18827 else return this._weekdaysShortRegex; 18828 } else { 18829 if (!hasOwnProp(this, '_weekdaysShortRegex')) this._weekdaysShortRegex = defaultWeekdaysShortRegex; 18830 return this._weekdaysShortStrictRegex && isStrict ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex; 18831 } 18832 } 18833 var defaultWeekdaysMinRegex = matchWord; 18834 function weekdaysMinRegex(isStrict) { 18835 if (this._weekdaysParseExact) { 18836 if (!hasOwnProp(this, '_weekdaysRegex')) computeWeekdaysParse.call(this); 18837 if (isStrict) return this._weekdaysMinStrictRegex; 18838 else return this._weekdaysMinRegex; 18839 } else { 18840 if (!hasOwnProp(this, '_weekdaysMinRegex')) this._weekdaysMinRegex = defaultWeekdaysMinRegex; 18841 return this._weekdaysMinStrictRegex && isStrict ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex; 18842 } 18843 } 18844 function computeWeekdaysParse() { 18845 function cmpLenRev(a, b) { 18846 return b.length - a.length; 18847 } 18848 var minPieces = [], shortPieces = [], longPieces = [], mixedPieces = [], i, mom, minp, shortp, longp; 18849 for(i = 0; i < 7; i++){ 18850 // make the regex if we don't have it already 18851 mom = createUTC([ 18852 2000, 18853 1 18854 ]).day(i); 18855 minp = this.weekdaysMin(mom, ''); 18856 shortp = this.weekdaysShort(mom, ''); 18857 longp = this.weekdays(mom, ''); 18858 minPieces.push(minp); 18859 shortPieces.push(shortp); 18860 longPieces.push(longp); 18861 mixedPieces.push(minp); 18862 mixedPieces.push(shortp); 18863 mixedPieces.push(longp); 18864 } 18865 // Sorting makes sure if one weekday (or abbr) is a prefix of another it 18866 // will match the longer piece. 18867 minPieces.sort(cmpLenRev); 18868 shortPieces.sort(cmpLenRev); 18869 longPieces.sort(cmpLenRev); 18870 mixedPieces.sort(cmpLenRev); 18871 for(i = 0; i < 7; i++){ 18872 shortPieces[i] = regexEscape(shortPieces[i]); 18873 longPieces[i] = regexEscape(longPieces[i]); 18874 mixedPieces[i] = regexEscape(mixedPieces[i]); 18875 } 18876 this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i'); 18877 this._weekdaysShortRegex = this._weekdaysRegex; 18878 this._weekdaysMinRegex = this._weekdaysRegex; 18879 this._weekdaysStrictRegex = new RegExp('^(' + longPieces.join('|') + ')', 'i'); 18880 this._weekdaysShortStrictRegex = new RegExp('^(' + shortPieces.join('|') + ')', 'i'); 18881 this._weekdaysMinStrictRegex = new RegExp('^(' + minPieces.join('|') + ')', 'i'); 18882 } 18883 // FORMATTING 18884 function hFormat() { 18885 return this.hours() % 12 || 12; 18886 } 18887 function kFormat() { 18888 return this.hours() || 24; 18889 } 18890 addFormatToken('H', [ 18891 'HH', 18892 2 18893 ], 0, 'hour'); 18894 addFormatToken('h', [ 18895 'hh', 18896 2 18897 ], 0, hFormat); 18898 addFormatToken('k', [ 18899 'kk', 18900 2 18901 ], 0, kFormat); 18902 addFormatToken('hmm', 0, 0, function() { 18903 return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2); 18904 }); 18905 addFormatToken('hmmss', 0, 0, function() { 18906 return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2); 18907 }); 18908 addFormatToken('Hmm', 0, 0, function() { 18909 return '' + this.hours() + zeroFill(this.minutes(), 2); 18910 }); 18911 addFormatToken('Hmmss', 0, 0, function() { 18912 return '' + this.hours() + zeroFill(this.minutes(), 2) + zeroFill(this.seconds(), 2); 18913 }); 18914 function meridiem(token, lowercase) { 18915 addFormatToken(token, 0, 0, function() { 18916 return this.localeData().meridiem(this.hours(), this.minutes(), lowercase); 18917 }); 18918 } 18919 meridiem('a', true); 18920 meridiem('A', false); 18921 // ALIASES 18922 addUnitAlias('hour', 'h'); 18923 // PRIORITY 18924 addUnitPriority('hour', 13); 18925 // PARSING 18926 function matchMeridiem(isStrict, locale) { 18927 return locale._meridiemParse; 18928 } 18929 addRegexToken('a', matchMeridiem); 18930 addRegexToken('A', matchMeridiem); 18931 addRegexToken('H', match1to2); 18932 addRegexToken('h', match1to2); 18933 addRegexToken('k', match1to2); 18934 addRegexToken('HH', match1to2, match2); 18935 addRegexToken('hh', match1to2, match2); 18936 addRegexToken('kk', match1to2, match2); 18937 addRegexToken('hmm', match3to4); 18938 addRegexToken('hmmss', match5to6); 18939 addRegexToken('Hmm', match3to4); 18940 addRegexToken('Hmmss', match5to6); 18941 addParseToken([ 18942 'H', 18943 'HH'
18944 ], HOUR); 18945 addParseToken([ 18946 'k', 18947 'kk' 18948 ], function(input, array, config) { 18949 var kInput = toInt(input); 18950 array[HOUR] = kInput === 24 ? 0 : kInput; 18951 }); 18952 addParseToken([ 18953 'a', 18954 'A' 18955 ], function(input, array, config) { 18956 config._isPm = config._locale.isPM(input); 18957 config._meridiem = input; 18958 }); 18959 addParseToken([ 18960 'h', 18961 'hh' 18962 ], function(input, array, config) { 18963 array[HOUR] = toInt(input); 18964 getParsingFlags(config).bigHour = true; 18965 }); 18966 addParseToken('hmm', function(input, array, config) { 18967 var pos = input.length - 2; 18968 array[HOUR] = toInt(input.substr(0, pos)); 18969 array[MINUTE] = toInt(input.substr(pos)); 18970 getParsingFlags(config).bigHour = true; 18971 }); 18972 addParseToken('hmmss', function(input, array, config) { 18973 var pos1 = input.length - 4; 18974 var pos2 = input.length - 2; 18975 array[HOUR] = toInt(input.substr(0, pos1)); 18976 array[MINUTE] = toInt(input.substr(pos1, 2)); 18977 array[SECOND] = toInt(input.substr(pos2)); 18978 getParsingFlags(config).bigHour = true; 18979 }); 18980 addParseToken('Hmm', function(input, array, config) { 18981 var pos = input.length - 2; 18982 array[HOUR] = toInt(input.substr(0, pos)); 18983 array[MINUTE] = toInt(input.substr(pos)); 18984 }); 18985 addParseToken('Hmmss', function(input, array, config) { 18986 var pos1 = input.length - 4; 18987 var pos2 = input.length - 2; 18988 array[HOUR] = toInt(input.substr(0, pos1)); 18989 array[MINUTE] = toInt(input.substr(pos1, 2)); 18990 array[SECOND] = toInt(input.substr(pos2)); 18991 }); 18992 // LOCALES 18993 function localeIsPM(input) { 18994 // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays 18995 // Using charAt should be more compatible. 18996 return (input + '').toLowerCase().charAt(0) === 'p'; 18997 } 18998 var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i; 18999 function localeMeridiem(hours, minutes, isLower) { 19000 if (hours > 11) return isLower ? 'pm' : 'PM'; 19001 else return isLower ? 'am' : 'AM'; 19002 } 19003 // MOMENTS 19004 // Setting the hour should keep the time, because the user explicitly 19005 // specified which hour they want. So trying to maintain the same hour (in 19006 // a new timezone) makes sense. Adding/subtracting hours does not follow 19007 // this rule. 19008 var getSetHour = makeGetSet('Hours', true); 19009 var baseConfig = { 19010 calendar: defaultCalendar, 19011 longDateFormat: defaultLongDateFormat, 19012 invalidDate: defaultInvalidDate, 19013 ordinal: defaultOrdinal, 19014 dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse, 19015 relativeTime: defaultRelativeTime, 19016 months: defaultLocaleMonths, 19017 monthsShort: defaultLocaleMonthsShort, 19018 week: defaultLocaleWeek, 19019 weekdays: defaultLocaleWeekdays, 19020 weekdaysMin: defaultLocaleWeekdaysMin, 19021 weekdaysShort: defaultLocaleWeekdaysShort, 19022 meridiemParse: defaultLocaleMeridiemParse 19023 }; 19024 // internal storage for locale config files 19025 var locales = {}; 19026 var localeFamilies = {}; 19027 var globalLocale; 19028 function normalizeLocale(key) { 19029 return key ? key.toLowerCase().replace('_', '-') : key; 19030 } 19031 // pick the locale from the array 19032 // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each 19033 // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root 19034 function chooseLocale(names) { 19035 var i = 0, j, next, locale, split; 19036 while(i < names.length){ 19037 split = normalizeLocale(names[i]).split('-'); 19038 j = split.length; 19039 next = normalizeLocale(names[i + 1]); 19040 next = next ? next.split('-') : null; 19041 while(j > 0){ 19042 locale = loadLocale(split.slice(0, j).join('-')); 19043 if (locale) return locale; 19044 if (next && next.length >= j && compareArrays(split, next, true) >= j - 1) break; 19045 j--; 19046 } 19047 i++; 19048 } 19049 return globalLocale; 19050 } 19051 function loadLocale(name) { 19052 var oldLocale = null; 19053 // TODO: Find a better way to register and load all the locales in Node 19054 if (!locales[name] && true && module && module.exports) try { 19055 oldLocale = globalLocale._abbr; 19056 var aliasedRequire = undefined; 19057 aliasedRequire('./locale/' + name); 19058 getSetGlobalLocale(oldLocale); 19059 } catch (e) {} 19060 return locales[name]; 19061 } 19062 // This function will load locale and then set the global locale. If 19063 // no arguments are passed in, it will simply return the current global 19064 // locale key. 19065 function getSetGlobalLocale(key, values) { 19066 var data; 19067 if (key) { 19068 if (isUndefined(values)) data = getLocale(key); 19069 else data = defineLocale(key, values); 19070 if (data) // moment.duration._locale = moment._locale = data; 19071 globalLocale = data; 19072 else if (typeof console !== 'undefined' && console.warn) //warn user if arguments are passed but the locale could not be set 19073 console.warn('Locale ' + key + ' not found. Did you forget to load it?'); 19074 } 19075 return globalLocale._abbr; 19076 } 19077 function defineLocale(name, config) { 19078 if (config !== null) { 19079 var locale, parentConfig = baseConfig; 19080 config.abbr = name; 19081 if (locales[name] != null) { 19082 deprecateSimple('defineLocaleOverride', "use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."); 19083 parentConfig = locales[name]._config; 19084 } else if (config.parentLocale != null) { 19085 if (locales[config.parentLocale] != null) parentConfig = locales[config.parentLocale]._config; 19086 else { 19087 locale = loadLocale(config.parentLocale); 19088 if (locale != null) parentConfig = locale._config; 19089 else { 19090 if (!localeFamilies[config.parentLocale]) localeFamilies[config.parentLocale] = []; 19091 localeFamilies[config.parentLocale].push({ 19092 name: name, 19093 config: config 19094 }); 19095 return null; 19096 } 19097 } 19098 } 19099 locales[name] = new Locale(mergeConfigs(parentConfig, config)); 19100 if (localeFamilies[name]) localeFamilies[name].forEach(function(x) { 19101 defineLocale(x.name, x.config); 19102 }); 19103 // backwards compat for now: also set the locale 19104 // make sure we set the locale AFTER all child locales have been 19105 // created, so we won't end up with the child locale set. 19106 getSetGlobalLocale(name); 19107 return locales[name]; 19108 } else { 19109 // useful for testing 19110 delete locales[name]; 19111 return null; 19112 } 19113 } 19114 function updateLocale(name, config) { 19115 if (config != null) { 19116 var locale, tmpLocale, parentConfig = baseConfig; 19117 // MERGE 19118 tmpLocale = loadLocale(name); 19119 if (tmpLocale != null) parentConfig = tmpLocale._config; 19120 config = mergeConfigs(parentConfig, config); 19121 locale = new Locale(config); 19122 locale.parentLocale = locales[name]; 19123 locales[name] = locale; 19124 // backwards compat for now: also set the locale 19125 getSetGlobalLocale(name); 19126 } else // pass null for config to unupdate, useful for tests 19127 if (locales[name] != null) { 19128 if (locales[name].parentLocale != null) locales[name] = locales[name].parentLocale; 19129 else if (locales[name] != null) delete locales[name]; 19130 } 19131 return locales[name]; 19132 } 19133 // returns locale data 19134 function getLocale(key) { 19135 var locale; 19136 if (key && key._locale && key._locale._abbr) key = key._locale._abbr; 19137 if (!key) return globalLocale; 19138 if (!isArray(key)) { 19139 //short-circuit everything else 19140 locale = loadLocale(key); 19141 if (locale) return locale; 19142 key = [ 19143 key 19144 ]; 19145 } 19146 return chooseLocale(key); 19147 } 19148 function listLocales() { 19149 return keys(locales); 19150 } 19151 function checkOverflow(m) { 19152 var overflow; 19153 var a = m._a; 19154 if (a && getParsingFlags(m).overflow === -2) { 19155 overflow = a[MONTH] < 0 || a[MONTH] > 11 ? MONTH : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH]) ? DATE : a[HOUR] < 0 || a[HOUR] > 24 || a[HOUR] === 24 && (a[MINUTE] !== 0 || a[SECOND] !== 0 || a[MILLISECOND] !== 0) ? HOUR : a[MINUTE] < 0 || a[MINUTE] > 59 ? MINUTE : a[SECOND] < 0 || a[SECOND] > 59 ? SECOND : a[MILLISECOND] < 0 || a[MILLISECOND] > 999 ? MILLISECOND : -1; 19156 if (getParsingFlags(m)._overflowDayOfYear && (overflow < YEAR || overflow > DATE)) overflow = DATE; 19157 if (getParsingFlags(m)._overflowWeeks && overflow === -1) overflow = WEEK; 19158 if (getParsingFlags(m)._overflowWeekday && overflow === -1) overflow = WEEKDAY; 19159 getParsingFlags(m).overflow = overflow; 19160 } 19161 return m; 19162 } 19163 // Pick the first defined of two or three arguments. 19164 function defaults(a, b, c) { 19165 if (a != null) return a; 19166 if (b != null) return b; 19167 return c; 19168 } 19169 function currentDateArray(config) { 19170 // hooks is actually the exported moment object 19171 var nowValue = new Date(hooks.now()); 19172 if (config._useUTC) return [ 19173 nowValue.getUTCFullYear(), 19174 nowValue.getUTCMonth(), 19175 nowValue.getUTCDate() 19176 ]; 19177 return [ 19178 nowValue.getFullYear(), 19179 nowValue.getMonth(), 19180 nowValue.getDate() 19181 ]; 19182 } 19183 // convert an array to a date. 19184 // the array should mirror the parameters below 19185 // note: all values past the year are optional and will default to the lowest possible value. 19186 // [year, month, day , hour, minute, second, millisecond] 19187 function configFromArray(config) { 19188 var i, date, input = [], currentDate, expectedWeekday, yearToUse; 19189 if (config._d) return; 19190 currentDate = currentDateArray(config); 19191 //compute day of the year from weeks and weekdays 19192 if (config._w && config._a[DATE] == null && config._a[MONTH] == null) dayOfYearFromWeekInfo(config); 19193 //if the day of the year is set, figure out what it is 19194 if (config._dayOfYear != null) { 19195 yearToUse = defaults(config._a[YEAR], currentDate[YEAR]); 19196 if (config._dayOfYear > daysInYear(yearToUse) || config._dayOfYear === 0) getParsingFlags(config)._overflowDayOfYear = true; 19197 date = createUTCDate(yearToUse, 0, config._dayOfYear); 19198 config._a[MONTH] = date.getUTCMonth(); 19199 config._a[DATE] = date.getUTCDate(); 19200 } 19201 // Default to current date. 19202 // * if no year, month, day of month are given, default to today 19203 // * if day of month is given, default month and year 19204 // * if month is given, default only year 19205 // * if year is given, don't default anything 19206 for(i = 0; i < 3 && config._a[i] == null;
19206 ++i)config._a[i] = input[i] = currentDate[i]; 19207 // Zero out whatever was not defaulted, including time 19208 for(; i < 7; i++)config._a[i] = input[i] = config._a[i] == null ? i === 2 ? 1 : 0 : config._a[i]; 19209 // Check for 24:00:00.000 19210 if (config._a[HOUR] === 24 && config._a[MINUTE] === 0 && config._a[SECOND] === 0 && config._a[MILLISECOND] === 0) { 19211 config._nextDay = true; 19212 config._a[HOUR] = 0; 19213 } 19214 config._d = (config._useUTC ? createUTCDate : createDate).apply(null, input); 19215 expectedWeekday = config._useUTC ? config._d.getUTCDay() : config._d.getDay(); 19216 // Apply timezone offset from input. The actual utcOffset can be changed 19217 // with parseZone. 19218 if (config._tzm != null) config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); 19219 if (config._nextDay) config._a[HOUR] = 24; 19220 // check for mismatching day of week 19221 if (config._w && typeof config._w.d !== 'undefined' && config._w.d !== expectedWeekday) getParsingFlags(config).weekdayMismatch = true; 19222 } 19223 function dayOfYearFromWeekInfo(config) { 19224 var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow; 19225 w = config._w; 19226 if (w.GG != null || w.W != null || w.E != null) { 19227 dow = 1; 19228 doy = 4; 19229 // TODO: We need to take the current isoWeekYear, but that depends on 19230 // how we interpret now (local, utc, fixed offset). So create 19231 // a now version of current config (take local/utc/offset flags, and 19232 // create now). 19233 weekYear = defaults(w.GG, config._a[YEAR], weekOfYear(createLocal(), 1, 4).year); 19234 week = defaults(w.W, 1); 19235 weekday = defaults(w.E, 1); 19236 if (weekday < 1 || weekday > 7) weekdayOverflow = true; 19237 } else { 19238 dow = config._locale._week.dow; 19239 doy = config._locale._week.doy; 19240 var curWeek = weekOfYear(createLocal(), dow, doy); 19241 weekYear = defaults(w.gg, config._a[YEAR], curWeek.year); 19242 // Default to current week. 19243 week = defaults(w.w, curWeek.week); 19244 if (w.d != null) { 19245 // weekday -- low day numbers are considered next week 19246 weekday = w.d; 19247 if (weekday < 0 || weekday > 6) weekdayOverflow = true; 19248 } else if (w.e != null) { 19249 // local weekday -- counting starts from begining of week 19250 weekday = w.e + dow; 19251 if (w.e < 0 || w.e > 6) weekdayOverflow = true; 19252 } else // default to begining of week 19253 weekday = dow; 19254 } 19255 if (week < 1 || week > weeksInYear(weekYear, dow, doy)) getParsingFlags(config)._overflowWeeks = true; 19256 else if (weekdayOverflow != null) getParsingFlags(config)._overflowWeekday = true; 19257 else { 19258 temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy); 19259 config._a[YEAR] = temp.year; 19260 config._dayOfYear = temp.dayOfYear; 19261 } 19262 } 19263 // iso 8601 regex 19264 // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00) 19265 var extendedIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; 19266 var basicIsoRegex = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([\+\-]\d\d(?::?\d\d)?|\s*Z)?)?$/; 19267 var tzRegex = /Z|[+-]\d\d(?::?\d\d)?/; 19268 var isoDates = [ 19269 [ 19270 'YYYYYY-MM-DD', 19271 /[+-]\d{6}-\d\d-\d\d/ 19272 ], 19273 [ 19274 'YYYY-MM-DD', 19275 /\d{4}-\d\d-\d\d/ 19276 ], 19277 [ 19278 'GGGG-[W]WW-E', 19279 /\d{4}-W\d\d-\d/ 19280 ], 19281 [ 19282 'GGGG-[W]WW', 19283 /\d{4}-W\d\d/, 19284 false 19285 ], 19286 [ 19287 'YYYY-DDD', 19288 /\d{4}-\d{3}/ 19289 ], 19290 [ 19291 'YYYY-MM', 19292 /\d{4}-\d\d/, 19293 false 19294 ], 19295 [ 19296 'YYYYYYMMDD', 19297 /[+-]\d{10}/ 19298 ], 19299 [ 19300 'YYYYMMDD', 19301 /\d{8}/ 19302 ], 19303 // YYYYMM is NOT allowed by the standard 19304 [ 19305 'GGGG[W]WWE', 19306 /\d{4}W\d{3}/ 19307 ], 19308 [ 19309 'GGGG[W]WW', 19310 /\d{4}W\d{2}/, 19311 false 19312 ], 19313 [ 19314 'YYYYDDD', 19315 /\d{7}/ 19316 ] 19317 ]; 19318 // iso time formats and regexes 19319 var isoTimes = [ 19320 [ 19321 'HH:mm:ss.SSSS', 19322 /\d\d:\d\d:\d\d\.\d+/ 19323 ], 19324 [ 19325 'HH:mm:ss,SSSS', 19326 /\d\d:\d\d:\d\d,\d+/ 19327 ], 19328 [ 19329 'HH:mm:ss', 19330 /\d\d:\d\d:\d\d/ 19331 ], 19332 [ 19333 'HH:mm', 19334 /\d\d:\d\d/ 19335 ], 19336 [ 19337 'HHmmss.SSSS', 19338 /\d\d\d\d\d\d\.\d+/ 19339 ], 19340 [ 19341 'HHmmss,SSSS', 19342 /\d\d\d\d\d\d,\d+/ 19343 ], 19344 [ 19345 'HHmmss', 19346 /\d\d\d\d\d\d/ 19347 ], 19348 [ 19349 'HHmm', 19350 /\d\d\d\d/ 19351 ], 19352 [ 19353 'HH', 19354 /\d\d/ 19355 ] 19356 ]; 19357 var aspNetJsonRegex = /^\/?Date\((\-?\d+)/i; 19358 // date from iso format 19359 function configFromISO(config) { 19360 var i, l, string = config._i, match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string), allowTime, dateFormat, timeFormat, tzFormat; 19361 if (match) { 19362 getParsingFlags(config).iso = true; 19363 for(i = 0, l = isoDates.length; i < l; i++)if (isoDates[i][1].exec(match[1])) { 19364 dateFormat = isoDates[i][0]; 19365 allowTime = isoDates[i][2] !== false; 19366 break; 19367 } 19368 if (dateFormat == null) { 19369 config._isValid = false;
19370 return; 19371 } 19372 if (match[3]) { 19373 for(i = 0, l = isoTimes.length; i < l; i++)if (isoTimes[i][1].exec(match[3])) { 19374 // match[2] should be 'T' or space 19375 timeFormat = (match[2] || ' ') + isoTimes[i][0]; 19376 break; 19377 } 19378 if (timeFormat == null) { 19379 config._isValid = false; 19380 return; 19381 } 19382 } 19383 if (!allowTime && timeFormat != null) { 19384 config._isValid = false; 19385 return; 19386 } 19387 if (match[4]) { 19388 if (tzRegex.exec(match[4])) tzFormat = 'Z'; 19389 else { 19390 config._isValid = false; 19391 return; 19392 } 19393 } 19394 config._f = dateFormat + (timeFormat || '') + (tzFormat || ''); 19395 configFromStringAndFormat(config); 19396 } else config._isValid = false; 19397 } 19398 // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3 19399 var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/; 19400 function extractFromRFC2822Strings(yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) { 19401 var result = [ 19402 untruncateYear(yearStr), 19403 defaultLocaleMonthsShort.indexOf(monthStr), 19404 parseInt(dayStr, 10), 19405 parseInt(hourStr, 10), 19406 parseInt(minuteStr, 10) 19407 ]; 19408 if (secondStr) result.push(parseInt(secondStr, 10)); 19409 return result; 19410 } 19411 function untruncateYear(yearStr) { 19412 var year = parseInt(yearStr, 10); 19413 if (year <= 49) return 2000 + year; 19414 else if (year <= 999) return 1900 + year; 19415 return year; 19416 } 19417 function preprocessRFC2822(s) { 19418 // Remove comments and folding whitespace and replace multiple-spaces with a single space 19419 return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, ''); 19420 } 19421 function checkWeekday(weekdayStr, parsedInput, config) { 19422 if (weekdayStr) { 19423 // TODO: Replace the vanilla JS Date object with an indepentent day-of-week check. 19424 var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr), weekdayActual = new Date(parsedInput[0], parsedInput[1], parsedInput[2]).getDay(); 19425 if (weekdayProvided !== weekdayActual) { 19426 getParsingFlags(config).weekdayMismatch = true; 19427 config._isValid = false; 19428 return false; 19429 } 19430 } 19431 return true; 19432 } 19433 var obsOffsets = { 19434 UT: 0, 19435 GMT: 0, 19436 EDT: -240, 19437 EST: -300, 19438 CDT: -300, 19439 CST: -360, 19440 MDT: -360, 19441 MST: -420, 19442 PDT: -420, 19443 PST: -480 19444 }; 19445 function calculateOffset(obsOffset, militaryOffset, numOffset) { 19446 if (obsOffset) return obsOffsets[obsOffset]; 19447 else if (militaryOffset) // the only allowed military tz is Z 19448 return 0; 19449 else { 19450 var hm = parseInt(numOffset, 10); 19451 var m = hm % 100, h = (hm - m) / 100; 19452 return h * 60 + m; 19453 } 19454 } 19455 // date and time from ref 2822 format 19456 function configFromRFC2822(config) { 19457 var match = rfc2822.exec(preprocessRFC2822(config._i)); 19458 if (match) { 19459 var parsedArray = extractFromRFC2822Strings(match[4], match[3], match[2], match[5], match[6], match[7]); 19460 if (!checkWeekday(match[1], parsedArray, config)) return; 19461 config._a = parsedArray; 19462 config._tzm = calculateOffset(match[8], match[9], match[10]); 19463 config._d = createUTCDate.apply(null, config._a); 19464 config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm); 19465 getParsingFlags(config).rfc2822 = true; 19466 } else config._isValid = false; 19467 } 19468 // date from iso format or fallback 19469 function configFromString(config) { 19470 var matched = aspNetJsonRegex.exec(config._i); 19471 if (matched !== null) { 19472 config._d = new Date(+matched[1]); 19473 return; 19474 } 19475 configFromISO(config); 19476 if (config._isValid === false) delete config._isValid; 19477 else return; 19478 configFromRFC2822(config); 19479 if (config._isValid === false) delete config._isValid; 19480 else return; 19481 // Final attempt, use Input Fallback 19482 hooks.createFromInputFallback(config); 19483 } 19484 hooks.createFromInputFallback = deprecate("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.", function(config) { 19485 config._d = new Date(config._i + (config._useUTC ? ' UTC' : '')); 19486 }); 19487 // constant that refers to the ISO standard 19488 hooks.ISO_8601 = function() {}; 19489 // constant that refers to the RFC 2822 form 19490 hooks.RFC_2822 = function() {};
19491 // date from string and format string 19492 function configFromStringAndFormat(config) { 19493 // TODO: Move this to another part of the creation flow to prevent circular deps 19494 if (config._f === hooks.ISO_8601) { 19495 configFromISO(config); 19496 return; 19497 } 19498 if (config._f === hooks.RFC_2822) { 19499 configFromRFC2822(config); 19500 return; 19501 } 19502 config._a = []; 19503 getParsingFlags(config).empty = true; 19504 // This array is used to make a Date, either with `new Date` or `Date.UTC` 19505 var string = '' + config._i, i, parsedInput, tokens, token, skipped, stringLength = string.length, totalParsedInputLength = 0; 19506 tokens = expandFormat(config._f, config._locale).match(formattingTokens) || []; 19507 for(i = 0; i < tokens.length; i++){ 19508 token = tokens[i]; 19509 parsedInput = (string.match(getParseRegexForToken(token, config)) || [])[0]; 19510 // console.log('token', token, 'parsedInput', parsedInput, 19511 // 'regex', getParseRegexForToken(token, config)); 19512 if (parsedInput) { 19513 skipped = string.substr(0, string.indexOf(parsedInput)); 19514 if (skipped.length > 0) getParsingFlags(config).unusedInput.push(skipped); 19515 string = string.slice(string.indexOf(parsedInput) + parsedInput.length); 19516 totalParsedInputLength += parsedInput.length; 19517 } 19518 // don't parse if it's not a known token 19519 if (formatTokenFunctions[token]) { 19520 if (parsedInput) getParsingFlags(config).empty = false; 19521 else getParsingFlags(config).unusedTokens.push(token); 19522 addTimeToArrayFromToken(token, parsedInput, config); 19523 } else if (config._strict && !parsedInput) getParsingFlags(config).unusedTokens.push(token); 19524 } 19525 // add remaining unparsed input length to the string 19526 getParsingFlags(config).charsLeftOver = stringLength - totalParsedInputLength; 19527 if (string.length > 0) getParsingFlags(config).unusedInput.push(string); 19528 // clear _12h flag if hour is <= 12 19529 if (config._a[HOUR] <= 12 && getParsingFlags(config).bigHour === true && config._a[HOUR] > 0) getParsingFlags(config).bigHour = undefined; 19530 getParsingFlags(config).parsedDateParts = config._a.slice(0); 19531 getParsingFlags(config).meridiem = config._meridiem; 19532 // handle meridiem 19533 config._a[HOUR] = meridiemFixWrap(config._locale, config._a[HOUR], config._meridiem); 19534 configFromArray(config); 19535 checkOverflow(config); 19536 } 19537 function meridiemFixWrap(locale, hour, meridiem) { 19538 var isPm; 19539 if (meridiem == null) // nothing to do 19540 return hour; 19541 if (locale.meridiemHour != null) return locale.meridiemHour(hour, meridiem); 19542 else if (locale.isPM != null) { 19543 // Fallback 19544 isPm = locale.isPM(meridiem); 19545 if (isPm && hour < 12) hour += 12; 19546 if (!isPm && hour === 12) hour = 0; 19547 return hour; 19548 } else // this is not supposed to happen 19549 return hour; 19550 } 19551 // date from string and array of format strings 19552 function configFromStringAndArray(config) { 19553 var tempConfig, bestMoment, scoreToBeat, i, currentScore; 19554 if (config._f.length === 0) { 19555 getParsingFlags(config).invalidFormat = true; 19556 config._d = new Date(NaN); 19557 return; 19558 } 19559 for(i = 0; i < config._f.length; i++){ 19560 currentScore = 0; 19561 tempConfig = copyConfig({}, config); 19562 if (config._useUTC != null) tempConfig._useUTC = config._useUTC; 19563 tempConfig._f = config._f[i]; 19564 configFromStringAndFormat(tempConfig); 19565 if (!isValid(tempConfig)) continue; 19566 // if there is any input that was not parsed add a penalty for that format 19567 currentScore += getParsingFlags(tempConfig).charsLeftOver; 19568 //or tokens 19569 currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10; 19570 getParsingFlags(tempConfig).score = currentScore; 19571 if (scoreToBeat == null || currentScore < scoreToBeat) { 19572 scoreToBeat = currentScore; 19573 bestMoment = tempConfig; 19574 } 19575 } 19576 extend(config, bestMoment || tempConfig); 19577 } 19578 function configFromObject(config) { 19579 if (config._d) return; 19580 var i = normalizeObjectUnits(config._i); 19581 config._a = map([ 19582 i.year, 19583 i.month, 19584 i.day || i.date, 19585 i.hour, 19586 i.minute, 19587 i.second, 19588 i.millisecond 19589 ], function(obj) { 19590 return obj && parseInt(obj, 10); 19591 }); 19592 configFromArray(config); 19593 } 19594 function createFromConfig(config) { 19595 var res = new Moment(checkOverflow(prepareConfig(config))); 19596 if (res._nextDay) { 19597 // Adding is smart enough around DST 19598 res.add(1, 'd'); 19599 res._nextDay = undefined; 19600 } 19601 return res; 19602 } 19603 function prepareConfig(config) { 19604 var input = config._i, format = config._f; 19605 config._locale = config._locale || getLocale(config._l); 19606 if (input === null || format === undefined && input === '') return createInvalid({ 19607 nullInput: true 19608 }); 19609 if (typeof input === 'string') config._i = input = config._locale.preparse(input); 19610 if (isMoment(input)) return new Moment(checkOverflow(input)); 19611 else if (isDate(input)) config._d = input; 19612 else if (isArray(format)) configFromStringAndArray(config); 19613 else if (format) configFromStringAndFormat(config); 19614 else configFromInput(config); 19615 if (!isValid(config)) config._d = null; 19616 return config; 19617 } 19618 function configFromInput(config) { 19619 var input = config._i; 19620 if (isUndefined(input)) config._d = new Date(hooks.now()); 19621 else if (isDate(input)) config._d = new Date(input.valueOf()); 19622 else if (typeof input === 'string') configFromString(config); 19623 else if (isArray(input)) { 19624 config._a = map(input.slice(0), function(obj) { 19625 return parseInt(obj, 10); 19626 }); 19627 configFromArray(config); 19628 } else if (isObject(input)) configFromObject(config); 19629 else if (isNumber(input)) // from milliseconds 19630 config._d = new Date(input); 19631 else hooks.createFromInputFallback(config); 19632 }
19633 function createLocalOrUTC(input, format, locale, strict, isUTC) { 19634 var c = {}; 19635 if (locale === true || locale === false) { 19636 strict = locale; 19637 locale = undefined; 19638 } 19639 if (isObject(input) && isObjectEmpty(input) || isArray(input) && input.length === 0) input = undefined; 19640 // object construction must be done this way. 19641 // https://github.com/moment/moment/issues/1423 19642 c._isAMomentObject = true; 19643 c._useUTC = c._isUTC = isUTC; 19644 c._l = locale; 19645 c._i = input; 19646 c._f = format; 19647 c._strict = strict; 19648 return createFromConfig(c); 19649 } 19650 function createLocal(input, format, locale, strict) { 19651 return createLocalOrUTC(input, format, locale, strict, false); 19652 } 19653 var prototypeMin = deprecate('moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/', function() { 19654 var other = createLocal.apply(null, arguments); 19655 if (this.isValid() && other.isValid()) return other < this ? this : other; 19656 else return createInvalid(); 19657 }); 19658 var prototypeMax = deprecate('moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/', function() { 19659 var other = createLocal.apply(null, arguments); 19660 if (this.isValid() && other.isValid()) return other > this ? this : other; 19661 else return createInvalid(); 19662 }); 19663 // Pick a moment m from moments so that m[fn](other) is true for all 19664 // other. This relies on the function fn to be transitive. 19665 // 19666 // moments should either be an array of moment objects or an array, whose 19667 // first element is an array of moment objects. 19668 function pickBy(fn, moments) { 19669 var res, i; 19670 if (moments.length === 1 && isArray(moments[0])) moments = moments[0]; 19671 if (!moments.length) return createLocal(); 19672 res = moments[0]; 19673 for(i = 1; i < moments.length; ++i)if (!moments[i].isValid() || moments[i][fn](res)) res = moments[i]; 19674 return res; 19675 } 19676 // TODO: Use [].sort instead? 19677 function min() { 19678 var args = [].slice.call(arguments, 0); 19679 return pickBy('isBefore', args); 19680 } 19681 function max() { 19682 var args = [].slice.call(arguments, 0); 19683 return pickBy('isAfter', args); 19684 } 19685 var now = function() { 19686 return Date.now ? Date.now() : +new Date(); 19687 }; 19688 var ordering = [ 19689 'year', 19690 'quarter', 19691 'month', 19692 'week', 19693 'day', 19694 'hour', 19695 'minute', 19696 'second', 19697 'millisecond' 19698 ]; 19699 function isDurationValid(m) { 19700 for(var key in m){ 19701 if (!(indexOf.call(ordering, key) !== -1 && (m[key] == null || !isNaN(m[key])))) return false; 19702 } 19703 var unitHasDecimal = false; 19704 for(var i = 0; i < ordering.length; ++i)if (m[ordering[i]]) { 19705 if (unitHasDecimal) return false; // only allow non-integers for smallest unit 19706 if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) unitHasDecimal = true; 19707 } 19708 return true; 19709 } 19710 function isValid$1() { 19711 return this._isValid; 19712 } 19713 function createInvalid$1() { 19714 return createDuration(NaN); 19715 } 19716 function Duration(duration) { 19717 var normalizedInput = normalizeObjectUnits(duration), years = normalizedInput.year || 0, quarters = normalizedInput.quarter || 0, months = normalizedInput.month || 0, weeks = normalizedInput.week || 0, days = normalizedInput.day || 0, hours = normalizedInput.hour || 0, minutes = normalizedInput.minute || 0, seconds = normalizedInput.second || 0, milliseconds = normalizedInput.millisecond || 0; 19718 this._isValid = isDurationValid(normalizedInput); 19719 // representation for dateAddRemove 19720 this._milliseconds = +milliseconds + seconds * 1e3 + // 1000 19721 minutes * 6e4 + // 1000 * 60 19722 hours * 3600000; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978 19723 // Because of dateAddRemove treats 24 hours as different from a 19724 // day when working around DST, we need to store them separately 19725 this._days = +days + weeks * 7; 19726 // It is impossible to translate months into days without knowing 19727 // which months you are are talking about, so we have to store 19728 // it separately. 19729 this._months = +months + quarters * 3 + years * 12; 19730 this._data = {}; 19731 this._locale = getLocale(); 19732 this._bubble(); 19733 } 19734 function isDuration(obj) { 19735 return obj instanceof Duration; 19736 } 19737 function absRound(number) { 19738 if (number < 0) return Math.round(-1 * number) * -1; 19739 else return Math.round(number); 19740 } 19741 // FORMATTING 19742 function offset(token, separator) { 19743 addFormatToken(token, 0, 0, function() { 19744 var offset = this.utcOffset(); 19745 var sign = '+'; 19746 if (offset < 0) { 19747 offset = -offset; 19748 sign = '-'; 19749 } 19750 return sign + zeroFill(~~(offset / 60), 2) + separator + zeroFill(~~offset % 60, 2); 19751 }); 19752 } 19753 offset('Z', ':'); 19754 offset('ZZ', ''); 19755 // PARSING 19756 addRegexToken('Z', matchShortOffset); 19757 addRegexToken('ZZ', matchShortOffset); 19758 addParseToken([ 19759 'Z', 19760 'ZZ' 19761 ], function(input, array, config) { 19762 config._useUTC = true; 19763 config._tzm = offsetFromString(matchShortOffset, input); 19764 }); 19765 // HELPERS 19766 // timezone chunker 19767 // '+10:00' > ['10', '00'] 19768 // '-1530' > ['-15', '30'] 19769 var chunkOffset = /([\+\-]|\d\d)/gi; 19770 function offsetFromString(matcher, string) { 19771 var matches = (string || '').match(matcher); 19772 if (matches === null) return null; 19773 var chunk = matches[matches.length - 1] || []; 19774 var parts = (chunk + '').match(chunkOffset) || [
19775 '-', 19776 0, 19777 0 19778 ]; 19779 var minutes = +(parts[1] * 60) + toInt(parts[2]); 19780 return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes; 19781 } 19782 // Return a moment from input, that is local/utc/zone equivalent to model. 19783 function cloneWithOffset(input, model) { 19784 var res, diff; 19785 if (model._isUTC) { 19786 res = model.clone(); 19787 diff = (isMoment(input) || isDate(input) ? input.valueOf() : createLocal(input).valueOf()) - res.valueOf(); 19788 // Use low-level api, because this fn is low-level api. 19789 res._d.setTime(res._d.valueOf() + diff); 19790 hooks.updateOffset(res, false); 19791 return res; 19792 } else return createLocal(input).local(); 19793 } 19794 function getDateOffset(m) { 19795 // On Firefox.24 Date#getTimezoneOffset returns a floating point. 19796 // https://github.com/moment/moment/pull/1871 19797 return -Math.round(m._d.getTimezoneOffset() / 15) * 15; 19798 } 19799 // HOOKS 19800 // This function will be called whenever a moment is mutated. 19801 // It is intended to keep the offset in sync with the timezone. 19802 hooks.updateOffset = function() {}; 19803 // MOMENTS 19804 // keepLocalTime = true means only change the timezone, without 19805 // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]--> 19806 // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset 19807 // +0200, so we adjust the time as needed, to be valid. 19808 // 19809 // Keeping the time actually adds/subtracts (one hour) 19810 // from the actual represented time. That is why we call updateOffset 19811 // a second time. In case it wants us to change the offset again 19812 // _changeInProgress == true case, then we have to adjust, because 19813 // there is no such time in the given timezone. 19814 function getSetOffset(input, keepLocalTime, keepMinutes) { 19815 var offset = this._offset || 0, localAdjust; 19816 if (!this.isValid()) return input != null ? this : NaN; 19817 if (input != null) { 19818 if (typeof input === 'string') { 19819 input = offsetFromString(matchShortOffset, input); 19820 if (input === null) return this; 19821 } else if (Math.abs(input) < 16 && !keepMinutes) input = input * 60; 19822 if (!this._isUTC && keepLocalTime) localAdjust = getDateOffset(this); 19823 this._offset = input; 19824 this._isUTC = true; 19825 if (localAdjust != null) this.add(localAdjust, 'm'); 19826 if (offset !== input) { 19827 if (!keepLocalTime || this._changeInProgress) addSubtract(this, createDuration(input - offset, 'm'), 1, false); 19828 else if (!this._changeInProgress) { 19829 this._changeInProgress = true; 19830 hooks.updateOffset(this, true); 19831 this._changeInProgress = null; 19832 } 19833 } 19834 return this; 19835 } else return this._isUTC ? offset : getDateOffset(this); 19836 } 19837 function getSetZone(input, keepLocalTime) { 19838 if (input != null) { 19839 if (typeof input !== 'string') input = -input; 19840 this.utcOffset(input, keepLocalTime); 19841 return this; 19842 } else return -this.utcOffset(); 19843 } 19844 function setOffsetToUTC(keepLocalTime) { 19845 return this.utcOffset(0, keepLocalTime); 19846 } 19847 function setOffsetToLocal(keepLocalTime) { 19848 if (this._isUTC) { 19849 this.utcOffset(0, keepLocalTime); 19850 this._isUTC = false; 19851 if (keepLocalTime) this.subtract(getDateOffset(this), 'm'); 19852 } 19853 return this; 19854 } 19855 function setOffsetToParsedOffset() { 19856 if (this._tzm != null) this.utcOffset(this._tzm, false, true); 19857 else if (typeof this._i === 'string') { 19858 var tZone = offsetFromString(matchOffset, this._i); 19859 if (tZone != null) this.utcOffset(tZone); 19860 else this.utcOffset(0, true); 19861 } 19862 return this; 19863 } 19864 function hasAlignedHourOffset(input) { 19865 if (!this.isValid()) return false; 19866 input = input ? createLocal(input).utcOffset() : 0; 19867 return (this.utcOffset() - input) % 60 === 0; 19868 } 19869 function isDaylightSavingTime() { 19870 return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset(); 19871 } 19872 function isDaylightSavingTimeShifted() { 19873 if (!isUndefined(this._isDSTShifted)) return this._isDSTShifted; 19874 var c = {}; 19875 copyConfig(c, this); 19876 c = prepareConfig(c); 19877 if (c._a) { 19878 var other = c._isUTC ? createUTC(c._a) : createLocal(c._a); 19879 this._isDSTShifted = this.isValid() && compareArrays(c._a, other.toArray()) > 0; 19880 } else this._isDSTShifted = false;
19881 return this._isDSTShifted; 19882 } 19883 function isLocal() { 19884 return this.isValid() ? !this._isUTC : false; 19885 } 19886 function isUtcOffset() { 19887 return this.isValid() ? this._isUTC : false; 19888 } 19889 function isUtc() { 19890 return this.isValid() ? this._isUTC && this._offset === 0 : false; 19891 } 19892 // ASP.NET json date format regex 19893 var aspNetRegex = /^(\-|\+)?(?:(\d*)[. ])?(\d+)\:(\d+)(?:\:(\d+)(\.\d*)?)?$/; 19894 // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html 19895 // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere 19896 // and further modified to allow for strings containing both week and day 19897 var isoRegex = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; 19898 function createDuration(input, key) { 19899 var duration = input, // matching against regexp is expensive, do it on demand 19900 match = null, sign, ret, diffRes; 19901 if (isDuration(input)) duration = { 19902 ms: input._milliseconds, 19903 d: input._days, 19904 M: input._months 19905 }; 19906 else if (isNumber(input)) { 19907 duration = {}; 19908 if (key) duration[key] = input; 19909 else duration.milliseconds = input; 19910 } else if (!!(match = aspNetRegex.exec(input))) { 19911 sign = match[1] === '-' ? -1 : 1; 19912 duration = { 19913 y: 0, 19914 d: toInt(match[DATE]) * sign, 19915 h: toInt(match[HOUR]) * sign, 19916 m: toInt(match[MINUTE]) * sign, 19917 s: toInt(match[SECOND]) * sign, 19918 ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign // the millisecond decimal point is included in the match 19919 }; 19920 } else if (!!(match = isoRegex.exec(input))) { 19921 sign = match[1] === '-' ? -1 : match[1] === '+' ? 1 : 1; 19922 duration = { 19923 y: parseIso(match[2], sign), 19924 M: parseIso(match[3], sign), 19925 w: parseIso(match[4], sign), 19926 d: parseIso(match[5], sign), 19927 h: parseIso(match[6], sign), 19928 m: parseIso(match[7], sign), 19929 s: parseIso(match[8], sign) 19930 }; 19931 } else if (duration == null) duration = {}; 19932 else if (typeof duration === 'object' && ('from' in duration || 'to' in duration)) { 19933 diffRes = momentsDifference(createLocal(duration.from), createLocal(duration.to)); 19934 duration = {}; 19935 duration.ms = diffRes.milliseconds; 19936 duration.M = diffRes.months; 19937 } 19938 ret = new Duration(duration); 19939 if (isDuration(input) && hasOwnProp(input, '_locale')) ret._locale = input._locale; 19940 return ret; 19941 } 19942 createDuration.fn = Duration.prototype; 19943 createDuration.invalid = createInvalid$1; 19944 function parseIso(inp, sign) { 19945 // We'd normally use ~~inp for this, but unfortunately it also 19946 // converts floats to ints. 19947 // inp may be undefined, so careful calling replace on it. 19948 var res = inp && parseFloat(inp.replace(',', '.')); 19949 // apply sign while we're at it 19950 return (isNaN(res) ? 0 : res) * sign; 19951 } 19952 function positiveMomentsDifference(base, other) { 19953 var res = { 19954 milliseconds: 0, 19955 months: 0 19956 }; 19957 res.months = other.month() - base.month() + (other.year() - base.year()) * 12; 19958 if (base.clone().add(res.months, 'M').isAfter(other)) --res.months; 19959 res.milliseconds = +other - +base.clone().add(res.months, 'M'); 19960 return res; 19961 } 19962 function momentsDifference(base, other) { 19963 var res; 19964 if (!(base.isValid() && other.isValid())) return { 19965 milliseconds: 0, 19966 months: 0 19967 }; 19968 other = cloneWithOffset(other, base); 19969 if (base.isBefore(other)) res = positiveMomentsDifference(base, other); 19970 else { 19971 res = positiveMomentsDifference(other, base); 19972 res.milliseconds = -res.milliseconds; 19973 res.months = -res.months; 19974 } 19975 return res; 19976 } 19977 // TODO: remove 'name' arg after deprecation is removed 19978 function createAdder(direction, name) { 19979 return function(val, period) { 19980 var dur, tmp; 19981 //invert the arguments, but complain about it 19982 if (period !== null && !isNaN(+period)) { 19983 deprecateSimple(name, 'moment().' + name + '(period, number) is deprecated. Please use moment().' + name + '(number, period). ' + 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'); 19984 tmp = val; 19985 val = period; 19986 period = tmp; 19987 } 19988 val = typeof val === 'string' ? +val : val; 19989 dur = createDuration(val, period); 19990 addSubtract(this, dur, direction); 19991 return this; 19992 }; 19993 } 19994 function addSubtract(mom, duration, isAdding, updateOffset) { 19995 var milliseconds = duration._milliseconds, days = absRound(duration._days), months = absRound(duration._months); 19996 if (!mom.isValid()) // No op 19997 return; 19998 updateOffset = updateOffset == null ? true : updateOffset; 19999 if (months) setMonth(mom, get(mom, 'Month') + months * isAdding); 20000 if (days) set$1(mom, 'Date', get(mom, 'Date') + days * isAdding); 20001 if (milliseconds) mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding); 20002 if (updateOffset) hooks.updateOffset(mom, days || months); 20003 } 20004 var add = createAdder(1, 'add'); 20005 var subtract = createAdder(-1, 'subtract'); 20006 function getCalendarFormat(myMoment, now) { 20007 var diff = myMoment.diff(now, 'days', true); 20008 return diff < -6 ? 'sameElse' : diff < -1 ? 'lastWeek' : diff < 0 ? 'lastDay' : diff < 1 ? 'sameDay' : diff < 2 ? 'nextDay' : diff < 7 ? 'nextWeek' : 'sameElse'; 20009 } 20010 function calendar$1(time, formats) { 20011 // We want to compare the start of today, vs this. 20012 // Getting start-of-today depends on whether we're local/utc/offset or not. 20013 var now = time || createLocal(), sod = cloneWithOffset(now, this).startOf('day'), format = hooks.calendarFormat(this, sod) || 'sameElse'; 20014 var output = formats && (isFunction(formats[format]) ? formats[format].call(this, now) : formats[format]);
20015 return this.format(output || this.localeData().calendar(format, this, createLocal(now))); 20016 } 20017 function clone() { 20018 return new Moment(this); 20019 } 20020 function isAfter(input, units) { 20021 var localInput = isMoment(input) ? input : createLocal(input); 20022 if (!(this.isValid() && localInput.isValid())) return false; 20023 units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); 20024 if (units === 'millisecond') return this.valueOf() > localInput.valueOf(); 20025 else return localInput.valueOf() < this.clone().startOf(units).valueOf(); 20026 } 20027 function isBefore(input, units) { 20028 var localInput = isMoment(input) ? input : createLocal(input); 20029 if (!(this.isValid() && localInput.isValid())) return false; 20030 units = normalizeUnits(!isUndefined(units) ? units : 'millisecond'); 20031 if (units === 'millisecond') return this.valueOf() < localInput.valueOf(); 20032 else return this.clone().endOf(units).valueOf() < localInput.valueOf(); 20033 } 20034 function isBetween(from, to, units, inclusivity) { 20035 inclusivity = inclusivity || '()'; 20036 return (inclusivity[0] === '(' ? this.isAfter(from, units) : !this.isBefore(from, units)) && (inclusivity[1] === ')' ? this.isBefore(to, units) : !this.isAfter(to, units)); 20037 } 20038 function isSame(input, units) { 20039 var localInput = isMoment(input) ? input : createLocal(input), inputMs; 20040 if (!(this.isValid() && localInput.isValid())) return false; 20041 units = normalizeUnits(units || 'millisecond'); 20042 if (units === 'millisecond') return this.valueOf() === localInput.valueOf(); 20043 else { 20044 inputMs = localInput.valueOf(); 20045 return this.clone().startOf(units).valueOf() <= inputMs && inputMs <= this.clone().endOf(units).valueOf(); 20046 } 20047 } 20048 function isSameOrAfter(input, units) { 20049 return this.isSame(input, units) || this.isAfter(input, units); 20050 } 20051 function isSameOrBefore(input, units) { 20052 return this.isSame(input, units) || this.isBefore(input, units); 20053 } 20054 function diff(input, units, asFloat) { 20055 var that, zoneDelta, output; 20056 if (!this.isValid()) return NaN; 20057 that = cloneWithOffset(input, this); 20058 if (!that.isValid()) return NaN; 20059 zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4; 20060 units = normalizeUnits(units); 20061 switch(units){ 20062 case 'year': 20063 output = monthDiff(this, that) / 12; 20064 break; 20065 case 'month': 20066 output = monthDiff(this, that); 20067 break; 20068 case 'quarter': 20069 output = monthDiff(this, that) / 3; 20070 break; 20071 case 'second': 20072 output = (this - that) / 1e3; 20073 break; // 1000 20074 case 'minute': 20075 output = (this - that) / 6e4; 20076 break; // 1000 * 60 20077 case 'hour': 20078 output = (this - that) / 36e5; 20079 break; // 1000 * 60 * 60 20080 case 'day': 20081 output = (this - that - zoneDelta) / 864e5; 20082 break; // 1000 * 60 * 60 * 24, negate dst 20083 case 'week': 20084 output = (this - that - zoneDelta) / 6048e5; 20085 break; // 1000 * 60 * 60 * 24 * 7, negate dst 20086 default: 20087 output = this - that; 20088 } 20089 return asFloat ? output : absFloor(output); 20090 } 20091 function monthDiff(a, b) { 20092 // difference in months 20093 var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()), // b is in (anchor - 1 month, anchor + 1 month) 20094 anchor = a.clone().add(wholeMonthDiff, 'months'), anchor2, adjust; 20095 if (b - anchor < 0) { 20096 anchor2 = a.clone().add(wholeMonthDiff - 1, 'months'); 20097 // linear across the month 20098 adjust = (b - anchor) / (anchor - anchor2); 20099 } else { 20100 anchor2 = a.clone().add(wholeMonthDiff + 1, 'months'); 20101 // linear across the month 20102 adjust = (b - anchor) / (anchor2 - anchor); 20103 } 20104 //check for negative zero, return zero if negative zero 20105 return -(wholeMonthDiff + adjust) || 0; 20106 } 20107 hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ'; 20108 hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]'; 20109 function toString() { 20110 return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ'); 20111 } 20112 function toISOString(keepOffset) { 20113 if (!this.isValid()) return null; 20114 var utc = keepOffset !== true; 20115 var m = utc ? this.clone().utc() : this; 20116 if (m.year() < 0 || m.year() > 9999) return formatMoment(m, utc ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'); 20117 if (isFunction(Date.prototype.toISOString)) { 20118 // native implementation is ~50x faster, use it when we can 20119 if (utc) return this.toDate().toISOString(); 20120 else return new Date(this.valueOf() + this.utcOffset() * 60000).toISOString().replace('Z', formatMoment(m, 'Z')); 20121 } 20122 return formatMoment(m, utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'); 20123 } 20124 /** 20125 * Return a human readable representation of a moment that can 20126 * also be evaluated to get a new moment which is the same 20127 * 20128 * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects 20129 */ function inspect() {
20130 if (!this.isValid()) return 'moment.invalid(/* ' + this._i + ' */)'; 20131 var func = 'moment'; 20132 var zone = ''; 20133 if (!this.isLocal()) { 20134 func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone'; 20135 zone = 'Z'; 20136 } 20137 var prefix = '[' + func + '("]'; 20138 var year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY'; 20139 var datetime = '-MM-DD[T]HH:mm:ss.SSS'; 20140 var suffix = zone + '[")]'; 20141 return this.format(prefix + year + datetime + suffix); 20142 } 20143 function format(inputString) { 20144 if (!inputString) inputString = this.isUtc() ? hooks.defaultFormatUtc : hooks.defaultFormat; 20145 var output = formatMoment(this, inputString); 20146 return this.localeData().postformat(output); 20147 } 20148 function from(time, withoutSuffix) { 20149 if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) return createDuration({ 20150 to: this, 20151 from: time 20152 }).locale(this.locale()).humanize(!withoutSuffix); 20153 else return this.localeData().invalidDate(); 20154 } 20155 function fromNow(withoutSuffix) { 20156 return this.from(createLocal(), withoutSuffix); 20157 } 20158 function to(time, withoutSuffix) { 20159 if (this.isValid() && (isMoment(time) && time.isValid() || createLocal(time).isValid())) return createDuration({ 20160 from: this, 20161 to: time 20162 }).locale(this.locale()).humanize(!withoutSuffix); 20163 else return this.localeData().invalidDate(); 20164 } 20165 function toNow(withoutSuffix) { 20166 return this.to(createLocal(), withoutSuffix); 20167 } 20168 // If passed a locale key, it will set the locale for this 20169 // instance. Otherwise, it will return the locale configuration 20170 // variables for this instance. 20171 function locale(key) { 20172 var newLocaleData; 20173 if (key === undefined) return this._locale._abbr; 20174 else { 20175 newLocaleData = getLocale(key); 20176 if (newLocaleData != null) this._locale = newLocaleData; 20177 return this; 20178 } 20179 } 20180 var lang = deprecate('moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.', function(key) { 20181 if (key === undefined) return this.localeData(); 20182 else return this.locale(key); 20183 }); 20184 function localeData() { 20185 return this._locale; 20186 } 20187 function startOf(units) { 20188 units = normalizeUnits(units); 20189 // the following switch intentionally omits break keywords 20190 // to utilize falling through the cases. 20191 switch(units){ 20192 case 'year': 20193 this.month(0); 20194 /* falls through */ case 'quarter': 20195 case 'month': 20196 this.date(1); 20197 /* falls through */ case 'week': 20198 case 'isoWeek': 20199 case 'day': 20200 case 'date': 20201 this.hours(0); 20202 /* falls through */ case 'hour': 20203 this.minutes(0); 20204 /* falls through */ case 'minute': 20205 this.seconds(0); 20206 /* falls through */ case 'second': 20207 this.milliseconds(0); 20208 } 20209 // weeks are a special case 20210 if (units === 'week') this.weekday(0); 20211 if (units === 'isoWeek') this.isoWeekday(1); 20212 // quarters are also special 20213 if (units === 'quarter') this.month(Math.floor(this.month() / 3) * 3); 20214 return this; 20215 } 20216 function endOf(units) { 20217 units = normalizeUnits(units); 20218 if (units === undefined || units === 'millisecond') return this; 20219 // 'date' is an alias for 'day', so it should be considered as such. 20220 if (units === 'date') units = 'day'; 20221 return this.startOf(units).add(1, units === 'isoWeek' ? 'week' : units).subtract(1, 'ms'); 20222 } 20223 function valueOf() { 20224 return this._d.valueOf() - (this._offset || 0) * 60000; 20225 } 20226 function unix() { 20227 return Math.floor(this.valueOf() / 1000); 20228 } 20229 function toDate() { 20230 return new Date(this.valueOf()); 20231 } 20232 function toArray() { 20233 var m = this; 20234 return [ 20235 m.year(), 20236 m.month(), 20237 m.date(), 20238 m.hour(), 20239 m.minute(), 20240 m.second(), 20241 m.millisecond() 20242 ]; 20243 } 20244 function toObject() { 20245 var m = this; 20246 return { 20247 years: m.year(), 20248 months: m.month(), 20249 date: m.date(), 20250 hours: m.hours(), 20251 minutes: m.minutes(), 20252 seconds: m.seconds(), 20253 milliseconds: m.milliseconds() 20254 }; 20255 } 20256 function toJSON() { 20257 // new Date(NaN).toJSON() === null 20258 return this.isValid() ? this.toISOString() : null; 20259 } 20260 function isValid$2() { 20261 return isValid(this); 20262 } 20263 function parsingFlags() { 20264 return extend({}, getParsingFlags(this)); 20265 }
vendor: 1,453 bytes, lines 20266-20315
20266 function invalidAt() { 20267 return getParsingFlags(this).overflow; 20268 } 20269 function creationData() { 20270 return { 20271 input: this._i, 20272 format: this._f, 20273 locale: this._locale, 20274 isUTC: this._isUTC, 20275 strict: this._strict 20276 }; 20277 } 20278 // FORMATTING 20279 addFormatToken(0, [ 20280 'gg', 20281 2 20282 ], 0, function() { 20283 return this.weekYear() % 100; 20284 }); 20285 addFormatToken(0, [ 20286 'GG', 20287 2 20288 ], 0, function() { 20289 return this.isoWeekYear() % 100; 20290 }); 20291 function addWeekYearFormatToken(token, getter) { 20292 addFormatToken(0, [ 20293 token, 20294 token.length 20295 ], 0, getter); 20296 } 20297 addWeekYearFormatToken('gggg', 'weekYear'); 20298 addWeekYearFormatToken('ggggg', 'weekYear'); 20299 addWeekYearFormatToken('GGGG', 'isoWeekYear'); 20300 addWeekYearFormatToken('GGGGG', 'isoWeekYear'); 20301 // ALIASES 20302 addUnitAlias('weekYear', 'gg'); 20303 addUnitAlias('isoWeekYear', 'GG'); 20304 // PRIORITY 20305 addUnitPriority('weekYear', 1); 20306 addUnitPriority('isoWeekYear', 1); 20307 // PARSING 20308 addRegexToken('G', matchSigned); 20309 addRegexToken('g', matchSigned); 20310 addRegexToken('GG', match1to2, match2); 20311 addRegexToken('gg', match1to2, match2); 20312 addRegexToken('GGGG', match1to4, match4); 20313 addRegexToken('gggg', match1to4, match4); 20314 addRegexToken('GGGGG', match1to6, match6); 20315 addRegexToken('ggggg', match1to6, match6);
vendor: 21,144 bytes, lines 20316-20929
20316 addWeekParseToken([ 20317 'gggg', 20318 'ggggg', 20319 'GGGG', 20320 'GGGGG' 20321 ], function(input, week, config, token) { 20322 week[token.substr(0, 2)] = toInt(input); 20323 }); 20324 addWeekParseToken([ 20325 'gg', 20326 'GG' 20327 ], function(input, week, config, token) { 20328 week[token] = hooks.parseTwoDigitYear(input); 20329 }); 20330 // MOMENTS 20331 function getSetWeekYear(input) { 20332 return getSetWeekYearHelper.call(this, input, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy); 20333 } 20334 function getSetISOWeekYear(input) { 20335 return getSetWeekYearHelper.call(this, input, this.isoWeek(), this.isoWeekday(), 1, 4); 20336 } 20337 function getISOWeeksInYear() { 20338 return weeksInYear(this.year(), 1, 4); 20339 } 20340 function getWeeksInYear() { 20341 var weekInfo = this.localeData()._week; 20342 return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy); 20343 } 20344 function getSetWeekYearHelper(input, week, weekday, dow, doy) { 20345 var weeksTarget; 20346 if (input == null) return weekOfYear(this, dow, doy).year; 20347 else { 20348 weeksTarget = weeksInYear(input, dow, doy); 20349 if (week > weeksTarget) week = weeksTarget; 20350 return setWeekAll.call(this, input, week, weekday, dow, doy); 20351 } 20352 } 20353 function setWeekAll(weekYear, week, weekday, dow, doy) { 20354 var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy), date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear); 20355 this.year(date.getUTCFullYear()); 20356 this.month(date.getUTCMonth()); 20357 this.date(date.getUTCDate()); 20358 return this; 20359 } 20360 // FORMATTING 20361 addFormatToken('Q', 0, 'Qo', 'quarter'); 20362 // ALIASES 20363 addUnitAlias('quarter', 'Q'); 20364 // PRIORITY 20365 addUnitPriority('quarter', 7); 20366 // PARSING 20367 addRegexToken('Q', match1); 20368 addParseToken('Q', function(input, array) { 20369 array[MONTH] = (toInt(input) - 1) * 3; 20370 }); 20371 // MOMENTS 20372 function getSetQuarter(input) { 20373 return input == null ? Math.ceil((this.month() + 1) / 3) : this.month((input - 1) * 3 + this.month() % 3); 20374 } 20375 // FORMATTING 20376 addFormatToken('D', [ 20377 'DD', 20378 2 20379 ], 'Do', 'date'); 20380 // ALIASES 20381 addUnitAlias('date', 'D'); 20382 // PRIORITY 20383 addUnitPriority('date', 9); 20384 // PARSING 20385 addRegexToken('D', match1to2); 20386 addRegexToken('DD', match1to2, match2); 20387 addRegexToken('Do', function(isStrict, locale) { 20388 // TODO: Remove "ordinalParse" fallback in next major release. 20389 return isStrict ? locale._dayOfMonthOrdinalParse || locale._ordinalParse : locale._dayOfMonthOrdinalParseLenient; 20390 }); 20391 addParseToken([ 20392 'D', 20393 'DD' 20394 ], DATE); 20395 addParseToken('Do', function(input, array) { 20396 array[DATE] = toInt(input.match(match1to2)[0]); 20397 }); 20398 // MOMENTS 20399 var getSetDayOfMonth = makeGetSet('Date', true); 20400 // FORMATTING 20401 addFormatToken('DDD', [ 20402 'DDDD', 20403 3 20404 ], 'DDDo', 'dayOfYear'); 20405 // ALIASES 20406 addUnitAlias('dayOfYear', 'DDD'); 20407 // PRIORITY 20408 addUnitPriority('dayOfYear', 4); 20409 // PARSING 20410 addRegexToken('DDD', match1to3); 20411 addRegexToken('DDDD', match3); 20412 addParseToken([ 20413 'DDD', 20414 'DDDD' 20415 ], function(input, array, config) { 20416 config._dayOfYear = toInt(input); 20417 }); 20418 // HELPERS 20419 // MOMENTS 20420 function getSetDayOfYear(input) { 20421 var dayOfYear = Math.round((this.clone().startOf('day') - this.clone().startOf('year')) / 864e5) + 1; 20422 return input == null ? dayOfYear : this.add(input - dayOfYear, 'd'); 20423 } 20424 // FORMATTING 20425 addFormatToken('m', [ 20426 'mm', 20427 2 20428 ], 0, 'minute'); 20429 // ALIASES 20430 addUnitAlias('minute', 'm'); 20431 // PRIORITY 20432 addUnitPriority('minute', 14); 20433 // PARSING 20434 addRegexToken('m', match1to2); 20435 addRegexToken('mm', match1to2, match2); 20436 addParseToken([ 20437 'm', 20438 'mm' 20439 ], MINUTE); 20440 // MOMENTS 20441 var getSetMinute = makeGetSet('Minutes', false); 20442 // FORMATTING 20443 addFormatToken('s', [ 20444 'ss', 20445 2 20446 ], 0, 'second'); 20447 // ALIASES 20448 addUnitAlias('second', 's'); 20449 // PRIORITY 20450 addUnitPriority('second', 15); 20451 // PARSING 20452 addRegexToken('s', match1to2); 20453 addRegexToken('ss', match1to2, match2); 20454 addParseToken([ 20455 's', 20456 'ss' 20457 ], SECOND); 20458 // MOMENTS 20459 var getSetSecond = makeGetSet('Seconds', false); 20460 // FORMATTING 20461 addFormatToken('S', 0, 0, function() { 20462 return ~~(this.millisecond() / 100); 20463 }); 20464 addFormatToken(0, [ 20465 'SS', 20466 2 20467 ], 0, function() { 20468 return ~~(this.millisecond() / 10); 20469 }); 20470 addFormatToken(0, [ 20471 'SSS', 20472 3 20473 ], 0, 'millisecond'); 20474 addFormatToken(0, [ 20475 'SSSS', 20476 4 20477 ], 0, function() { 20478 return this.millisecond() * 10; 20479 }); 20480 addFormatToken(0, [ 20481 'SSSSS', 20482 5 20483 ], 0, function() { 20484 return this.millisecond() * 100; 20485 }); 20486 addFormatToken(0, [ 20487 'SSSSSS', 20488 6 20489 ], 0, function() { 20490 return this.millisecond() * 1000; 20491 }); 20492 addFormatToken(0, [ 20493 'SSSSSSS', 20494 7 20495 ], 0, function() { 20496 return this.millisecond() * 10000; 20497 }); 20498 addFormatToken(0, [ 20499 'SSSSSSSS', 20500 8 20501 ], 0, function() { 20502 return this.millisecond() * 100000; 20503 }); 20504 addFormatToken(0, [ 20505 'SSSSSSSSS', 20506 9 20507 ], 0, function() { 20508 return this.millisecond() * 1000000; 20509 }); 20510 // ALIASES 20511 addUnitAlias('millisecond', 'ms'); 20512 // PRIORITY 20513 addUnitPriority('millisecond', 16); 20514 // PARSING 20515 addRegexToken('S', match1to3, match1); 20516 addRegexToken('SS', match1to3, match2); 20517 addRegexToken('SSS', match1to3, match3); 20518 var token; 20519 for(token = 'SSSS'; token.length <= 9; token += 'S')addRegexToken(token, matchUnsigned); 20520 function parseMs(input, array) { 20521 array[MILLISECOND] = toInt(('0.' + input) * 1000); 20522 } 20523 for(token = 'S'; token.length <= 9; token += 'S')addParseToken(token, parseMs); 20524 // MOMENTS 20525 var getSetMillisecond = makeGetSet('Milliseconds', false); 20526 // FORMATTING 20527 addFormatToken('z', 0, 0, 'zoneAbbr'); 20528 addFormatToken('zz', 0, 0, 'zoneName'); 20529 // MOMENTS 20530 function getZoneAbbr() { 20531 return this._isUTC ? 'UTC' : ''; 20532 } 20533 function getZoneName() { 20534 return this._isUTC ? 'Coordinated Universal Time' : ''; 20535 } 20536 var proto = Moment.prototype; 20537 proto.add = add; 20538 proto.calendar = calendar$1; 20539 proto.clone = clone; 20540 proto.diff = diff; 20541 proto.endOf = endOf; 20542 proto.format = format; 20543 proto.from = from; 20544 proto.fromNow = fromNow; 20545 proto.to = to; 20546 proto.toNow = toNow; 20547 proto.get = stringGet; 20548 proto.invalidAt = invalidAt; 20549 proto.isAfter = isAfter; 20550 proto.isBefore = isBefore; 20551 proto.isBetween = isBetween; 20552 proto.isSame = isSame; 20553 proto.isSameOrAfter = isSameOrAfter; 20554 proto.isSameOrBefore = isSameOrBefore; 20555 proto.isValid = isValid$2; 20556 proto.lang = lang; 20557 proto.locale = locale; 20558 proto.localeData = localeData; 20559 proto.max = prototypeMax; 20560 proto.min = prototypeMin; 20561 proto.parsingFlags = parsingFlags; 20562 proto.set = stringSet; 20563 proto.startOf = startOf; 20564 proto.subtract = subtract; 20565 proto.toArray = toArray; 20566 proto.toObject = toObject; 20567 proto.toDate = toDate; 20568 proto.toISOString = toISOString; 20569 proto.inspect = inspect; 20570 proto.toJSON = toJSON; 20571 proto.toString = toString; 20572 proto.unix = unix; 20573 proto.valueOf = valueOf; 20574 proto.creationData = creationData; 20575 proto.year = getSetYear; 20576 proto.isLeapYear = getIsLeapYear; 20577 proto.weekYear = getSetWeekYear; 20578 proto.isoWeekYear = getSetISOWeekYear; 20579 proto.quarter = proto.quarters = getSetQuarter; 20580 proto.month = getSetMonth; 20581 proto.daysInMonth = getDaysInMonth; 20582 proto.week = proto.weeks = getSetWeek; 20583 proto.isoWeek = proto.isoWeeks = getSetISOWeek; 20584 proto.weeksInYear = getWeeksInYear; 20585 proto.isoWeeksInYear = getISOWeeksInYear; 20586 proto.date = getSetDayOfMonth; 20587 proto.day = proto.days = getSetDayOfWeek; 20588 proto.weekday = getSetLocaleDayOfWeek; 20589 proto.isoWeekday = getSetISODayOfWeek; 20590 proto.dayOfYear = getSetDayOfYear; 20591 proto.hour = proto.hours = getSetHour; 20592 proto.minute = proto.minutes = getSetMinute; 20593 proto.second = proto.seconds = getSetSecond; 20594 proto.millisecond = proto.milliseconds = getSetMillisecond; 20595 proto.utcOffset = getSetOffset; 20596 proto.utc = setOffsetToUTC; 20597 proto.local = setOffsetToLocal; 20598 proto.parseZone = setOffsetToParsedOffset; 20599 proto.hasAlignedHourOffset = hasAlignedHourOffset; 20600 proto.isDST = isDaylightSavingTime; 20601 proto.isLocal = isLocal; 20602 proto.isUtcOffset = isUtcOffset; 20603 proto.isUtc = isUtc; 20604 proto.isUTC = isUtc; 20605 proto.zoneAbbr = getZoneAbbr; 20606 proto.zoneName = getZoneName; 20607 proto.dates = deprecate('dates accessor is deprecated. Use date instead.', getSetDayOfMonth); 20608 proto.months = deprecate('months accessor is deprecated. Use month instead', getSetMonth); 20609 proto.years = deprecate('years accessor is deprecated. Use year instead', getSetYear); 20610 proto.zone = deprecate('moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/', getSetZone); 20611 proto.isDSTShifted = deprecate('isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information', isDaylightSavingTimeShifted); 20612 function createUnix(input) { 20613 return createLocal(input * 1000); 20614 } 20615 function createInZone() { 20616 return createLocal.apply(null, arguments).parseZone(); 20617 } 20618 function preParsePostFormat(string) { 20619 return string; 20620 } 20621 var proto$1 = Locale.prototype; 20622 proto$1.calendar = calendar; 20623 proto$1.longDateFormat = longDateFormat; 20624 proto$1.invalidDate = invalidDate; 20625 proto$1.ordinal = ordinal; 20626 proto$1.preparse = preParsePostFormat; 20627 proto$1.postformat = preParsePostFormat; 20628 proto$1.relativeTime = relativeTime; 20629 proto$1.pastFuture = pastFuture; 20630 proto$1.set = set; 20631 proto$1.months = localeMonths; 20632 proto$1.monthsShort = localeMonthsShort; 20633 proto$1.monthsParse = localeMonthsParse; 20634 proto$1.monthsRegex = monthsRegex; 20635 proto$1.monthsShortRegex = monthsShortRegex; 20636 proto$1.week = localeWeek; 20637 proto$1.firstDayOfYear = localeFirstDayOfYear; 20638 proto$1.firstDayOfWeek = localeFirstDayOfWeek; 20639 proto$1.weekdays = localeWeekdays; 20640 proto$1.weekdaysMin = localeWeekdaysMin; 20641 proto$1.weekdaysShort = localeWeekdaysShort; 20642 proto$1.weekdaysParse = localeWeekdaysParse; 20643 proto$1.weekdaysRegex = weekdaysRegex; 20644 proto$1.weekdaysShortRegex = weekdaysShortRegex; 20645 proto$1.weekdaysMinRegex = weekdaysMinRegex; 20646 proto$1.isPM = localeIsPM; 20647 proto$1.meridiem = localeMeridiem; 20648 function get$1(format, index, field, setter) { 20649 var locale = getLocale(); 20650 var utc = createUTC().set(setter, index); 20651 return locale[field](utc, format); 20652 } 20653 function listMonthsImpl(format, index, field) { 20654 if (isNumber(format)) { 20655 index = format; 20656 format = undefined; 20657 } 20658 format = format || ''; 20659 if (index != null) return get$1(format, index, field, 'month'); 20660 var i; 20661 var out = []; 20662 for(i = 0; i < 12; i++)out[i] = get$1(format, i, field, 'month'); 20663 return out; 20664 } 20665 // () 20666 // (5) 20667 // (fmt, 5) 20668 // (fmt) 20669 // (true) 20670 // (true, 5) 20671 // (true, fmt, 5) 20672 // (true, fmt) 20673 function listWeekdaysImpl(localeSorted, format, index, field) { 20674 if (typeof localeSorted === 'boolean') { 20675 if (isNumber(format)) { 20676 index = format; 20677 format = undefined; 20678 } 20679 format = format || ''; 20680 } else { 20681 format = localeSorted; 20682 index = format; 20683 localeSorted = false; 20684 if (isNumber(format)) { 20685 index = format; 20686 format = undefined; 20687 } 20688 format = format || ''; 20689 } 20690 var locale = getLocale(), shift = localeSorted ? locale._week.dow : 0; 20691 if (index != null) return get$1(format, (index + shift) % 7, field, 'day'); 20692 var i; 20693 var out = []; 20694 for(i = 0; i < 7; i++)out[i] = get$1(format, (i + shift) % 7, field, 'day'); 20695 return out; 20696 } 20697 function listMonths(format, index) { 20698 return listMonthsImpl(format, index, 'months'); 20699 } 20700 function listMonthsShort(format, index) { 20701 return listMonthsImpl(format, index, 'monthsShort'); 20702 } 20703 function listWeekdays(localeSorted, format, index) { 20704 return listWeekdaysImpl(localeSorted, format, index, 'weekdays'); 20705 } 20706 function listWeekdaysShort(localeSorted, format, index) { 20707 return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort'); 20708 } 20709 function listWeekdaysMin(localeSorted, format, index) { 20710 return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin'); 20711 } 20712 getSetGlobalLocale('en', { 20713 dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, 20714 ordinal: function(number) { 20715 var b = number % 10, output = toInt(number % 100 / 10) === 1 ? 'th' : b === 1 ? 'st' : b === 2 ? 'nd' : b === 3 ? 'rd' : 'th'; 20716 return number + output; 20717 } 20718 }); 20719 // Side effect imports 20720 hooks.lang = deprecate('moment.lang is deprecated. Use moment.locale instead.', getSetGlobalLocale); 20721 hooks.langData = deprecate('moment.langData is deprecated. Use moment.localeData instead.', getLocale); 20722 var mathAbs = Math.abs; 20723 function abs() { 20724 var data = this._data; 20725 this._milliseconds = mathAbs(this._milliseconds); 20726 this._days = mathAbs(this._days); 20727 this._months = mathAbs(this._months); 20728 data.milliseconds = mathAbs(data.milliseconds); 20729 data.seconds = mathAbs(data.seconds); 20730 data.minutes = mathAbs(data.minutes); 20731 data.hours = mathAbs(data.hours); 20732 data.months = mathAbs(data.months); 20733 data.years = mathAbs(data.years); 20734 return this; 20735 } 20736 function addSubtract$1(duration, input, value, direction) { 20737 var other = createDuration(input, value); 20738 duration._milliseconds += direction * other._milliseconds; 20739 duration._days += direction * other._days; 20740 duration._months += direction * other._months; 20741 return duration._bubble(); 20742 } 20743 // supports only 2.0-style add(1, 's') or add(duration) 20744 function add$1(input, value) { 20745 return addSubtract$1(this, input, value, 1); 20746 } 20747 // supports only 2.0-style subtract(1, 's') or subtract(duration) 20748 function subtract$1(input, value) { 20749 return addSubtract$1(this, input, value, -1); 20750 } 20751 function absCeil(number) { 20752 if (number < 0) return Math.floor(number); 20753 else return Math.ceil(number); 20754 } 20755 function bubble() { 20756 var milliseconds = this._milliseconds; 20757 var days = this._days; 20758 var months = this._months; 20759 var data = this._data; 20760 var seconds, minutes, hours, years, monthsFromDays; 20761 // if we have a mix of positive and negative values, bubble down first 20762 // check: https://github.com/moment/moment/issues/2166 20763 if (!(milliseconds >= 0 && days >= 0 && months >= 0 || milliseconds <= 0 && days <= 0 && months <= 0)) { 20764 milliseconds += absCeil(monthsToDays(months) + days) * 864e5; 20765 days = 0; 20766 months = 0; 20767 } 20768 // The following code bubbles up values, see the tests for 20769 // examples of what that means. 20770 data.milliseconds = milliseconds % 1000; 20771 seconds = absFloor(milliseconds / 1000); 20772 data.seconds = seconds % 60; 20773 minutes = absFloor(seconds / 60); 20774 data.minutes = minutes % 60; 20775 hours = absFloor(minutes / 60); 20776 data.hours = hours % 24; 20777 days += absFloor(hours / 24); 20778 // convert days to months 20779 monthsFromDays = absFloor(daysToMonths(days)); 20780 months += monthsFromDays; 20781 days -= absCeil(monthsToDays(monthsFromDays)); 20782 // 12 months -> 1 year 20783 years = absFloor(months / 12); 20784 months %= 12; 20785 data.days = days; 20786 data.months = months; 20787 data.years = years; 20788 return this; 20789 } 20790 function daysToMonths(days) { 20791 // 400 years have 146097 days (taking into account leap year rules) 20792 // 400 years have 12 months === 4800 20793 return days * 4800 / 146097; 20794 } 20795 function monthsToDays(months) { 20796 // the reverse of daysToMonths 20797 return months * 146097 / 4800; 20798 } 20799 function as(units) { 20800 if (!this.isValid()) return NaN; 20801 var days; 20802 var months; 20803 var milliseconds = this._milliseconds; 20804 units = normalizeUnits(units); 20805 if (units === 'month' || units === 'year') { 20806 days = this._days + milliseconds / 864e5; 20807 months = this._months + daysToMonths(days); 20808 return units === 'month' ? months : months / 12; 20809 } else { 20810 // handle milliseconds separately because of floating point math errors (issue #1867) 20811 days = this._days + Math.round(monthsToDays(this._months)); 20812 switch(units){ 20813 case 'week': 20814 return days / 7 + milliseconds / 6048e5; 20815 case 'day': 20816 return days + milliseconds / 864e5; 20817 case 'hour': 20818 return days * 24 + milliseconds / 36e5; 20819 case 'minute': 20820 return days * 1440 + milliseconds / 6e4; 20821 case 'second': 20822 return days * 86400 + milliseconds / 1000; 20823 // Math.floor prevents floating point math errors here 20824 case 'millisecond': 20825 return Math.floor(days * 864e5) + milliseconds; 20826 default: 20827 throw new Error('Unknown unit ' + units); 20828 } 20829 } 20830 } 20831 // TODO: Use this.as('ms')? 20832 function valueOf$1() { 20833 if (!this.isValid()) return NaN; 20834 return this._milliseconds + this._days * 864e5 + this._months % 12 * 2592e6 + toInt(this._months / 12) * 31536e6; 20835 } 20836 function makeAs(alias) { 20837 return function() { 20838 return this.as(alias); 20839 }; 20840 } 20841 var asMilliseconds = makeAs('ms'); 20842 var asSeconds = makeAs('s'); 20843 var asMinutes = makeAs('m'); 20844 var asHours = makeAs('h'); 20845 var asDays = makeAs('d'); 20846 var asWeeks = makeAs('w'); 20847 var asMonths = makeAs('M'); 20848 var asYears = makeAs('y'); 20849 function clone$1() { 20850 return createDuration(this); 20851 } 20852 function get$2(units) { 20853 units = normalizeUnits(units); 20854 return this.isValid() ? this[units + 's']() : NaN; 20855 } 20856 function makeGetter(name) { 20857 return function() { 20858 return this.isValid() ? this._data[name] : NaN; 20859 }; 20860 } 20861 var milliseconds = makeGetter('milliseconds'); 20862 var seconds = makeGetter('seconds'); 20863 var minutes = makeGetter('minutes'); 20864 var hours = makeGetter('hours'); 20865 var days = makeGetter('days'); 20866 var months = makeGetter('months'); 20867 var years = makeGetter('years'); 20868 function weeks() { 20869 return absFloor(this.days() / 7); 20870 } 20871 var round = Math.round; 20872 var thresholds = { 20873 ss: 44, 20874 s: 45, 20875 m: 45, 20876 h: 22, 20877 d: 26, 20878 M: 11 // months to year 20879 }; 20880 // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize 20881 function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) { 20882 return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture); 20883 } 20884 function relativeTime$1(posNegDuration, withoutSuffix, locale) { 20885 var duration = createDuration(posNegDuration).abs(); 20886 var seconds = round(duration.as('s')); 20887 var minutes = round(duration.as('m')); 20888 var hours = round(duration.as('h')); 20889 var days = round(duration.as('d')); 20890 var months = round(duration.as('M')); 20891 var years = round(duration.as('y')); 20892 var a = seconds <= thresholds.ss && [ 20893 's', 20894 seconds 20895 ] || seconds < thresholds.s && [ 20896 'ss', 20897 seconds 20898 ] || minutes <= 1 && [ 20899 'm' 20900 ] || minutes < thresholds.m && [ 20901 'mm', 20902 minutes 20903 ] || hours <= 1 && [ 20904 'h' 20905 ] || hours < thresholds.h && [ 20906 'hh', 20907 hours 20908 ] || days <= 1 && [ 20909 'd' 20910 ] || days < thresholds.d && [ 20911 'dd', 20912 days 20913 ] || months <= 1 && [ 20914 'M' 20915 ] || months < thresholds.M && [ 20916 'MM', 20917 months 20918 ] || years <= 1 && [ 20919 'y' 20920 ] || [ 20921 'yy', 20922 years 20923 ]; 20924 a[2] = withoutSuffix; 20925 a[3] = +posNegDuration > 0; 20926 a[4] = locale; 20927 return substituteTimeAgo.apply(null, a); 20928 } 20929 // This function allows you to set the rounding function for relative time strings
20930 function getSetRelativeTimeRounding(roundingFunction) { 20931 if (roundingFunction === undefined) return round; 20932 if (typeof roundingFunction === 'function') { 20933 round = roundingFunction; 20934 return true; 20935 } 20936 return false; 20937 } 20938 // This function allows you to set a threshold for relative time strings 20939 function getSetRelativeTimeThreshold(threshold, limit) { 20940 if (thresholds[threshold] === undefined) return false; 20941 if (limit === undefined) return thresholds[threshold]; 20942 thresholds[threshold] = limit; 20943 if (threshold === 's') thresholds.ss = limit - 1; 20944 return true; 20945 } 20946 function humanize(withSuffix) { 20947 if (!this.isValid()) return this.localeData().invalidDate(); 20948 var locale = this.localeData(); 20949 var output = relativeTime$1(this, !withSuffix, locale); 20950 if (withSuffix) output = locale.pastFuture(+this, output); 20951 return locale.postformat(output); 20952 } 20953 var abs$1 = Math.abs; 20954 function sign(x) { 20955 return (x > 0) - (x < 0) || +x; 20956 } 20957 function toISOString$1() { 20958 // for ISO strings we do not use the normal bubbling rules: 20959 // * milliseconds bubble up until they become hours 20960 // * days do not bubble at all 20961 // * months bubble up until they become years 20962 // This is because there is no context-free conversion between hours and days 20963 // (think of clock changes) 20964 // and also not between days and months (28-31 days per month) 20965 if (!this.isValid()) return this.localeData().invalidDate(); 20966 var seconds = abs$1(this._milliseconds) / 1000; 20967 var days = abs$1(this._days); 20968 var months = abs$1(this._months); 20969 var minutes, hours, years; 20970 // 3600 seconds -> 60 minutes -> 1 hour 20971 minutes = absFloor(seconds / 60); 20972 hours = absFloor(minutes / 60); 20973 seconds %= 60; 20974 minutes %= 60; 20975 // 12 months -> 1 year 20976 years = absFloor(months / 12); 20977 months %= 12; 20978 // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js 20979 var Y = years; 20980 var M = months; 20981 var D = days; 20982 var h = hours; 20983 var m = minutes; 20984 var s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : ''; 20985 var total = this.asSeconds(); 20986 if (!total) // this is the same as C#'s (Noda) and python (isodate)... 20987 // but not other JS (goog.date) 20988 return 'P0D'; 20989 var totalSign = total < 0 ? '-' : ''; 20990 var ymSign = sign(this._months) !== sign(total) ? '-' : ''; 20991 var daysSign = sign(this._days) !== sign(total) ? '-' : ''; 20992 var hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : ''; 20993 return totalSign + 'P' + (Y ? ymSign + Y + 'Y' : '') + (M ? ymSign + M + 'M' : '') + (D ? daysSign + D + 'D' : '') + (h || m || s ? 'T' : '') + (h ? hmsSign + h + 'H' : '') + (m ? hmsSign + m + 'M' : '') + (s ? hmsSign + s + 'S' : ''); 20994 } 20995 var proto$2 = Duration.prototype; 20996 proto$2.isValid = isValid$1; 20997 proto$2.abs = abs; 20998 proto$2.add = add$1; 20999 proto$2.subtract = subtract$1; 21000 proto$2.as = as; 21001 proto$2.asMilliseconds = asMilliseconds; 21002 proto$2.asSeconds = asSeconds; 21003 proto$2.asMinutes = asMinutes; 21004 proto$2.asHours = asHours; 21005 proto$2.asDays = asDays; 21006 proto$2.asWeeks = asWeeks; 21007 proto$2.asMonths = asMonths; 21008 proto$2.asYears = asYears; 21009 proto$2.valueOf = valueOf$1; 21010 proto$2._bubble = bubble; 21011 proto$2.clone = clone$1; 21012 proto$2.get = get$2; 21013 proto$2.milliseconds = milliseconds; 21014 proto$2.seconds = seconds; 21015 proto$2.minutes = minutes; 21016 proto$2.hours = hours; 21017 proto$2.days = days; 21018 proto$2.weeks = weeks; 21019 proto$2.months = months; 21020 proto$2.years = years; 21021 proto$2.humanize = humanize; 21022 proto$2.toISOString = toISOString$1; 21023 proto$2.toString = toISOString$1; 21024 proto$2.toJSON = toISOString$1; 21025 proto$2.locale = locale; 21026 proto$2.localeData = localeData; 21027 proto$2.toIsoString = deprecate('toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)', toISOString$1); 21028 proto$2.lang = lang; 21029 // Side effect imports 21030 // FORMATTING 21031 addFormatToken('X', 0, 0, 'unix'); 21032 addFormatToken('x', 0, 0, 'valueOf'); 21033 // PARSING 21034 addRegexToken('x', matchSigned); 21035 addRegexToken('X', matchTimestamp); 21036 addParseToken('X', function(input, array, config) { 21037 config._d = new Date(parseFloat(input, 10) * 1000); 21038 }); 21039 addParseToken('x', function(input, array, config) { 21040 config._d = new Date(toInt(input)); 21041 }); 21042 // Side effect imports 21043 hooks.version = '2.22.2'; 21044 setHookCallback(createLocal); 21045 hooks.fn = proto; 21046 hooks.min = min; 21047 hooks.max = max; 21048 hooks.now = now; 21049 hooks.utc = createUTC; 21050 hooks.unix = createUnix; 21051 hooks.months = listMonths; 21052 hooks.isDate = isDate; 21053 hooks.locale = getSetGlobalLocale; 21054 hooks.invalid = createInvalid; 21055 hooks.duration = createDuration; 21056 hooks.isMoment = isMoment; 21057 hooks.weekdays = listWeekdays; 21058 hooks.parseZone = createInZone; 21059 hooks.localeData = getLocale; 21060 hooks.isDuration = isDuration; 21061 hooks.monthsShort = listMonthsShort; 21062 hooks.weekdaysMin = listWeekdaysMin; 21063 hooks.defineLocale = defineLocale; 21064 hooks.updateLocale = updateLocale; 21065 hooks.locales = listLocales; 21066 hooks.weekdaysShort = listWeekdaysShort; 21067 hooks.normalizeUnits = normalizeUnits; 21068 hooks.relativeTimeRounding = getSetRelativeTimeRounding; 21069 hooks.relativeTimeThreshold = getSetRelativeTimeThreshold; 21070 hooks.calendarFormat = getCalendarFormat; 21071 hooks.prototype = proto; 21072 // currently HTML5 input type only supports 24-hour formats 21073 hooks.HTML5_FMT = { 21074 DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', 21075 DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', 21076 DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', 21077 DATE: 'YYYY-MM-DD', 21078 TIME: 'HH:mm', 21079 TIME_SECONDS: 'HH:mm:ss', 21080 TIME_MS: 'HH:mm:ss.SSS', 21081 WEEK: 'YYYY-[W]WW', 21082 MONTH: 'YYYY-MM' // <input type="month" /> 21083 }; 21084 return hooks; 21085}); 21086 21087},{}],"3FuKQ":[function(require,module,exports,__globalThis) { 21088/** 21089 * Popup Navigation Hover Functionality 21090 * Handles hover states for navigation links and their corresponding images 21091 */ function initPopupNav() { 21092 const navLinks = document.querySelectorAll('.js-nav-link'); 21093 const navImages = document.querySelectorAll('.main-nav__image'); 21094 const initialImage = document.querySelector('.main-nav__image[data-item="99999"]'); 21095 if (navLinks.length === 0 || navImages.length === 0) return; 21096 function showImage(itemIndex) { 21097 // Hide all images first
21098 navImages.forEach((image)=>{ 21099 image.classList.remove('active'); 21100 image.style.opacity = '0'; 21101 }); 21102 // Show the corresponding image 21103 const targetImage = document.querySelector(`.main-nav__image[data-item="${itemIndex}"]`); 21104 if (targetImage) { 21105 targetImage.classList.add('active'); 21106 targetImage.style.opacity = '1'; 21107 } 21108 } 21109 function showInitialImage() { 21110 // Hide all images first 21111 navImages.forEach((image)=>{ 21112 image.classList.remove('active'); 21113 image.style.opacity = '0'; 21114 }); 21115 // Show the initial image 21116 if (initialImage) { 21117 initialImage.classList.add('active'); 21118 initialImage.style.opacity = '1'; 21119 } 21120 } 21121 function updateLinkOpacity(hoveredItemIndex) { 21122 navLinks.forEach((link)=>{ 21123 const linkItemIndex = link.getAttribute('data-item'); 21124 if (hoveredItemIndex === null) // When no link is hovered, all links have full opacity 21125 link.style.opacity = '1'; 21126 else if (linkItemIndex !== hoveredItemIndex) // Set non-hovered links to 0.6 opacity 21127 link.style.opacity = '0.4'; 21128 else // Set hovered link to full opacity 21129 link.style.opacity = '1'; 21130 }); 21131 } 21132 function handleLinkHover(e) { 21133 const link = e.currentTarget; 21134 const itemIndex = link.getAttribute('data-item'); 21135 if (itemIndex !== null) { 21136 showImage(itemIndex); 21137 updateLinkOpacity(itemIndex); 21138 } 21139 } 21140 function handleLinkLeave(e) { 21141 // Show initial image when leaving a link 21142 showInitialImage(); 21143 // Reset all links to 0.6 opacity 21144 updateLinkOpacity(null); 21145 } 21146 // Add hover events to navigation links only 21147 navLinks.forEach((link)=>{ 21148 link.addEventListener('mouseenter', handleLinkHover); 21149 link.addEventListener('mouseleave', handleLinkLeave); 21150 }); 21151 // Initialize all links to 0.6 opacity on page load 21152 updateLinkOpacity(null); 21153} 21154// Initialize when DOM is ready 21155document.addEventListener('DOMContentLoaded', initPopupNav); 21156 21157},{}],"fIAws":[function(require,module,exports,__globalThis) { 21158var _windowScrollRaf = require("../helpers/windowScrollRaf"); 21159/** 21160 * Header scroll functionality 21161 * Removes transparent-header class and adds filled-header class when scrolling past 100px 21162 * Only applies changes if header doesn't already have filled-header class 21163 * On mobile (screen width < 768px), header always has filled-header class 21164 */ // Track if header originally had filled-header class 21165let headerOriginallyFilled = false; 21166function handleHeaderScroll() { 21167 const header = document.querySelector('.header'); 21168 const igniteModules = document.querySelector('.ignite-modules'); 21169 if (!header) return; 21170 // Check if screen width is smaller than 768px (mobile) 21171 const isMobile = window.innerWidth < 1200; 21172 // On mobile, always ensure filled-header class and show filled logo 21173 if (isMobile) { 21174 if (!header.classList.contains('filled-header')) header.classList.add('filled-header'); 21175 if (header.classList.contains('transparent-header')) header.classList.remove('transparent-header'); 21176 const popupLogos = document.querySelectorAll('.popup-header__main-logo img'); 21177 if (popupLogos) popupLogos.forEach((logo)=>{ 21178 logo.classList.remove('lg:max-w-[220px]'); 21179 logo.classList.remove('lg:max-h-[100px]'); 21180 }); 21181 // Add pt-[80px] to ignite-modules on mobile 21182 if (igniteModules && !igniteModules.classList.contains('pt-[80px]')) igniteModules.classList.add('pt-[80px]'); 21183 return; // Exit early for mobile 21184 } else if (igniteModules && igniteModules.classList.contains('pt-[80px]') && !header.classList.contains('filled-header')) igniteModules.classList.remove('pt-[80px]'); 21185 let scrollYPos = 100; 21186 if (document.querySelector('.theme-luxury')) scrollYPos = 30; 21187 // Check scroll position for desktop 21188 if (window.scrollY > scrollYPos) // Only add filled-header if it wasn't originally there 21189 { 21190 if (!headerOriginallyFilled && !header.classList.contains('filled-header')) { 21191 // Remove transparent-header if it exists 21192 if (header.classList.contains('transparent-header')) header.classList.remove('transparent-header');
21193 // Add filled-header 21194 header.classList.add('filled-header'); 21195 const popupHeader = document.querySelectorAll('.popup-header'); 21196 popupHeader.forEach((header)=>{ 21197 header.classList.add('filled-header'); 21198 }); 21199 const popupLogos = document.querySelectorAll('.popup-header__main-logo img'); 21200 if (popupLogos) popupLogos.forEach((logo)=>{ 21201 logo.classList.remove('lg:max-w-[220px]'); 21202 logo.classList.remove('lg:max-h-[100px]'); 21203 }); 21204 } 21205 } else // When scrolling back up (to top of page), remove filled-header and add transparent-header back 21206 // But only if it wasn't originally filled 21207 if (!headerOriginallyFilled && header.classList.contains('filled-header')) { 21208 header.classList.remove('filled-header'); 21209 // Add transparent-header back when we remove filled-header 21210 header.classList.add('transparent-header'); 21211 const popupHeader = document.querySelectorAll('.popup-header'); 21212 popupHeader.forEach((header)=>{ 21213 header.classList.remove('filled-header'); 21214 }); 21215 const popupLogos = document.querySelectorAll('.popup-header__main-logo img'); 21216 if (popupLogos) popupLogos.forEach((logo)=>{ 21217 logo.classList.add('lg:max-w-[220px]'); 21218 logo.classList.add('lg:max-h-[100px]'); 21219 }); 21220 } 21221} 21222// Initialize header scroll functionality when DOM is ready 21223function initHeaderScroll() { 21224 const header = document.querySelector('.header'); 21225 if (header) // Check if header originally had filled-header class 21226 headerOriginallyFilled = header.classList.contains('filled-header'); 21227 (0, _windowScrollRaf.subscribeWindowScrollRAF)(handleHeaderScroll); 21228 handleHeaderScroll(); 21229} 21230// Run when DOM is ready 21231if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', initHeaderScroll); 21232else // DOM is already ready 21233initHeaderScroll(); 21234// Open dropdown and update ARIA attributes 21235function openDropdown(linkDropdown) { 21236 linkDropdown.classList.add('active'); 21237 linkDropdown.setAttribute('aria-expanded', 'true'); 21238} 21239// Close dropdown and update ARIA attributes 21240function closeDropdown(linkDropdown) { 21241 linkDropdown.classList.remove('active'); 21242 linkDropdown.setAttribute('aria-expanded', 'false'); 21243} 21244// Hover on link-dropdown 21245function handleLinkDropdownHover(event) { 21246 const linkDropdown = event.currentTarget; 21247 openDropdown(linkDropdown); 21248} 21249function handleLinkDropdownLeave(event) { 21250 const linkDropdown = event.currentTarget; 21251 closeDropdown(linkDropdown); 21252} 21253function handleLinkDropdownFocusOut(event) { 21254 const linkDropdown = event.currentTarget; 21255 // Check if the new focus target is within the dropdown 21256 // If relatedTarget is null or not contained within the dropdown, close it 21257 if (!event.relatedTarget || !linkDropdown.contains(event.relatedTarget)) closeDropdown(linkDropdown); 21258} 21259// Handle keyboard interactions for accessibility 21260function handleLinkDropdownKeydown(event) { 21261 const linkDropdown = event.currentTarget; 21262 const isExpanded = linkDropdown.getAttribute('aria-expanded') === 'true'; 21263 switch(event.key){ 21264 case 'Enter': 21265 case ' ': 21266 event.preventDefault(); 21267 if (isExpanded) closeDropdown(linkDropdown); 21268 else { 21269 openDropdown(linkDropdown); 21270 // Focus first menu item 21271 const firstMenuItem = linkDropdown.querySelector('.header__main-nav-item__dropdown-link'); 21272 if (firstMenuItem) setTimeout(()=>firstMenuItem.focus(), 0); 21273 } 21274 break; 21275 case 'Escape': 21276 if (isExpanded) { 21277 event.preventDefault(); 21278 closeDropdown(linkDropdown); 21279 linkDropdown.focus(); 21280 } 21281 break; 21282 case 'ArrowDown': 21283 if (!isExpanded) { 21284 event.preventDefault(); 21285 openDropdown(linkDropdown); 21286 // Focus first menu item 21287 const firstMenuItem = linkDropdown.querySelector('.header__main-nav-item__dropdown-link'); 21288 if (firstMenuItem) setTimeout(()=>firstMenuItem.focus(), 0); 21289 } 21290 break; 21291 case 'ArrowUp': 21292 if (isExpanded) { 21293 event.preventDefault(); 21294 // Focus last menu item 21295 const menuItems = linkDropdown.querySelectorAll('.header__main-nav-item__dropdown-link'); 21296 if (menuItems.length > 0) menuItems[menuItems.length - 1].focus(); 21297 } 21298 break; 21299 } 21300} 21301// Handle keyboard navigation within dropdown menu 21302function handleMenuItemKeydown(event) { 21303 const menuItem = event.currentTarget; 21304 const dropdown = menuItem.closest('.header__main-nav-item--dropdown'); 21305 const menuItems = Array.from(dropdown.querySelectorAll('.header__main-nav-item__dropdown-link')); 21306 const currentIndex = menuItems.indexOf(menuItem); 21307 switch(event.key){ 21308 case 'ArrowDown': 21309 event.preventDefault(); 21310 if (currentIndex < menuItems.length - 1) menuItems[currentIndex + 1].focus(); 21311 break; 21312 case 'ArrowUp': 21313 event.preventDefault(); 21314 if (currentIndex > 0) menuItems[currentIndex - 1].focus(); 21315 else // Return to button 21316 dropdown.focus(); 21317 break; 21318 case 'Escape': 21319 event.preventDefault(); 21320 closeDropdown(dropdown); 21321 dropdown.focus(); 21322 break; 21323 case 'Tab': 21324 // Allow natural tab behavior, but close dropdown when tabbing out 21325 const isShiftTab = event.shiftKey; 21326 if (!isShiftTab && currentIndex === menuItems.length - 1) // Tabbing out of last item 21327 closeDropdown(dropdown); 21328 else if (isShiftTab && currentIndex === 0) // Shift+tabbing out of first item 21329 closeDropdown(dropdown); 21330 break; 21331 } 21332} 21333// Add event listeners to link-dropdown for hover and keyboard 21334function initLinkDropdowns() { 21335 const linkDropdowns = document.querySelectorAll('.header__main-nav-item--dropdown'); 21336 if (linkDropdowns) linkDropdowns.forEach((linkDropdown)=>{ 21337 // Mouse events 21338 linkDropdown.addEventListener('mouseenter', handleLinkDropdownHover); 21339 linkDropdown.addEventListener('mouseleave', handleLinkDropdownLeave); 21340 // Focus events 21341 linkDropdown.addEventListener('focus', handleLinkDropdownHover); 21342 linkDropdown.addEventListener('focusout', handleLinkDropdownFocusOut); 21343 // Keyboard events 21344 linkDropdown.addEventListener('keydown', handleLinkDropdownKeydown); 21345 // Add keyboard navigation to menu items 21346 const menuItems = linkDropdown.querySelectorAll('.header__main-nav-item__dropdown-link');
21347 menuItems.forEach((menuItem)=>{ 21348 menuItem.addEventListener('keydown', handleMenuItemKeydown); 21349 }); 21350 }); 21351} 21352// Initialize dropdown hover functionality when DOM is ready 21353if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', initLinkDropdowns); 21354else // DOM is already ready 21355initLinkDropdowns(); 21356 21357},{"../helpers/windowScrollRaf":"gJWEk"}],"gJWEk":[function(require,module,exports,__globalThis) { 21358/** 21359 * Single passive window scroll + resize listener, coalesced with requestAnimationFrame. 21360 * Multiple subscribers share one listener pair and at most one rAF per frame. 21361 */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 21362parcelHelpers.defineInteropFlag(exports); 21363/** 21364 * @param {() => void} fn 21365 * @returns {() => void} unsubscribe 21366 */ parcelHelpers.export(exports, "subscribeWindowScrollRAF", ()=>subscribeWindowScrollRAF); 21367const subscribers = new Set(); 21368let rafId = null; 21369let attached = false; 21370function flush() { 21371 rafId = null; 21372 const fns = Array.from(subscribers); 21373 for(let i = 0; i < fns.length; i++)fns[i](); 21374 if (subscribers.size === 0) detach(); 21375} 21376function onWindowEvent() { 21377 if (rafId !== null) return; 21378 rafId = requestAnimationFrame(flush); 21379} 21380function attach() { 21381 if (attached) return; 21382 window.addEventListener('scroll', onWindowEvent, { 21383 passive: true 21384 }); 21385 window.addEventListener('resize', onWindowEvent, { 21386 passive: true 21387 }); 21388 attached = true; 21389} 21390function detach() { 21391 if (rafId !== null) { 21392 cancelAnimationFrame(rafId); 21393 rafId = null; 21394 } 21395 if (!attached) return; 21396 window.removeEventListener('scroll', onWindowEvent, { 21397 passive: true 21398 }); 21399 window.removeEventListener('resize', onWindowEvent, { 21400 passive: true 21401 }); 21402 attached = false; 21403} 21404function subscribeWindowScrollRAF(fn) { 21405 subscribers.add(fn); 21406 attach(); 21407 return function unsubscribe() { 21408 subscribers.delete(fn); 21409 if (subscribers.size === 0) detach(); 21410 }; 21411} 21412 21413},{"@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"fEqXE":[function(require,module,exports,__globalThis) { 21414var _popups = require("./popups"); 21415const footerNewsletterTrigger = ()=>{ 21416 const newsletterForm = document.querySelector('.footer__newsletter-form'); 21417 let newsletterButton = newsletterForm.querySelector('.button'); 21418 if (newsletterForm) { 21419 const emailInput = newsletterForm.querySelector('input[name="footerNewsletterEmail"]'); 21420 newsletterButton.addEventListener('click', (e)=>{ 21421 e.preventDefault(); 21422 // Find the email field in the newsletter popup 21423 const popupEmailElement = document.querySelector('#newsletter .email-holder input'); 21424 if (popupEmailElement) { 21425 popupEmailElement.value = emailInput.value; 21426 if (emailInput.value && emailInput.value !== '') popupEmailElement.setAttribute('data-filled', 'true'); 21427 } 21428 (0, _popups.openPopup)('#newsletter'); 21429 }); 21430 } 21431}; 21432const footerAccordionToggle = ()=>{ 21433 const accordionToggles = document.querySelectorAll('.footer__accordion-toggle'); 21434 if (accordionToggles.length > 0) { 21435 // Initialize accordion state based on screen size 21436 const initializeAccordionState = ()=>{ 21437 accordionToggles.forEach((toggle, index)=>{ 21438 // Find the content by going up to the parent div and then finding the next sibling 21439 const toggleContainer = toggle.closest('.footer__accordion-container'); 21440 const content = toggleContainer ? toggleContainer.nextElementSibling : null; 21441 if (content && content.classList.contains('footer__accordion-content')) { 21442 if (window.innerWidth >= 768) { 21443 content.classList.remove('footer__accordion-content--hidden'); 21444 toggle.classList.remove('is-open'); 21445 } else { 21446 // Always hide on mobile unless explicitly opened 21447 content.classList.add('footer__accordion-content--hidden'); 21448 toggle.classList.remove('is-open'); 21449 } 21450 } 21451 }); 21452 }; 21453 // Initialize on page load with a small delay to ensure DOM is ready 21454 setTimeout(initializeAccordionState, 100); 21455 const getAccordionContent = (toggleEl)=>{ 21456 const toggleContainer = toggleEl.closest('.footer__accordion-container'); 21457 const content = toggleContainer ? toggleContainer.nextElementSibling : null; 21458 return content && content.classList.contains('footer__accordion-content') ? content : null; 21459 }; 21460 const closeAllAccordions = ()=>{
21461 accordionToggles.forEach((t)=>{ 21462 t.classList.remove('is-open'); 21463 const content = getAccordionContent(t); 21464 if (content) content.classList.add('footer__accordion-content--hidden'); 21465 }); 21466 }; 21467 // Handle accordion clicks (only one open at a time on mobile) 21468 accordionToggles.forEach((toggle)=>{ 21469 toggle.addEventListener('click', ()=>{ 21470 if (window.innerWidth < 768) { 21471 const content = getAccordionContent(toggle); 21472 if (!content) return; 21473 const wasOpen = toggle.classList.contains('is-open'); 21474 closeAllAccordions(); 21475 if (!wasOpen) { 21476 toggle.classList.add('is-open'); 21477 content.classList.remove('footer__accordion-content--hidden'); 21478 } 21479 } 21480 }); 21481 }); 21482 // Handle window resize 21483 window.addEventListener('resize', initializeAccordionState); 21484 } 21485}; 21486footerNewsletterTrigger(); 21487footerAccordionToggle(); 21488 21489},{"./popups":"gP0kv"}],"hEA9a":[function(require,module,exports,__globalThis) { 21490const FRAME_HOLD_MS = 150; 21491const FADE_MS = 180; 21492const FINAL_HOLD_MS = 110; 21493const PRELOADER_COOKIE = 'kricket_preloader_seen'; 21494const ONE_DAY_SEC = 86400; 21495const sleep = (ms)=>new Promise((r)=>setTimeout(r, ms)); 21496const getCookie = (name)=>{ 21497 const m = document.cookie.match(new RegExp(`(?:^|; )${name.replace(/([.$?*|{}()[\]\\/+^])/g, '\\$1')}=([^;]*)`)); 21498 return m ? decodeURIComponent(m[1]) : ''; 21499}; 21500const setPreloaderSeenCookie = ()=>{ 21501 const secure = location.protocol === 'https:' ? '; Secure' : ''; 21502 document.cookie = `${PRELOADER_COOKIE}=1; Max-Age=${ONE_DAY_SEC}; Path=/; SameSite=Lax${secure}`; 21503}; 21504const waitForOpacityTransition = (el, fallbackMs = 900)=>Promise.race([ 21505 new Promise((resolve)=>{ 21506 const done = (e)=>{ 21507 if (e.target !== el || e.propertyName !== 'opacity') return; 21508 el.removeEventListener('transitionend', done); 21509 resolve(); 21510 }; 21511 el.addEventListener('transitionend', done); 21512 }), 21513 sleep(fallbackMs) 21514 ]); 21515const waitWindowLoad = ()=>new Promise((resolve)=>{ 21516 if (document.readyState === 'complete') { 21517 resolve(); 21518 return; 21519 } 21520 window.addEventListener('load', ()=>resolve(), { 21521 once: true 21522 }); 21523 }); 21524const initPreloader = ()=>{ 21525 const root = document.querySelector('[data-preloader]'); 21526 if (!root) return; 21527 if (getCookie(PRELOADER_COOKIE)) { 21528 root.remove(); 21529 return; 21530 } 21531 // Inline script normally adds .m__preloader--active; fallback if JS order/caching differs. 21532 if (!root.classList.contains('m__preloader--active')) { 21533 root.classList.add('m__preloader--active'); 21534 root.setAttribute('aria-busy', 'true'); 21535 root.setAttribute('aria-hidden', 'false'); 21536 } 21537 const frames = [ 21538 ...root.querySelectorAll('.js-preloader-frame') 21539 ]; 21540 if (!frames.length) return; 21541 const reducedMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches; 21542 const hold = reducedMotion ? 0 : FRAME_HOLD_MS; 21543 const fade = reducedMotion ? 0 : FADE_MS; 21544 const finalHold = reducedMotion ? 0 : FINAL_HOLD_MS; 21545 const showFrame = async (index)=>{ 21546 frames.forEach((el, i)=>{ 21547 el.classList.remove('m__preloader__frame--visible', 'm__preloader__frame--under'); 21548 if (i < index) el.classList.add('m__preloader__frame--under'); 21549 }); 21550 const frame = frames[index]; 21551 frame.classList.add('m__preloader__frame--visible'); 21552 const isInitialFirstFrame = index === 0; 21553 if (fade > 0 && !isInitialFirstFrame) await waitForOpacityTransition(frame); 21554 if (hold > 0) await sleep(hold); 21555 }; 21556 const runSequence = async ()=>{ 21557 if (reducedMotion) { 21558 const last = frames.length - 1; 21559 frames.forEach((el, i)=>{ 21560 el.classList.toggle('m__preloader__frame--under', i < last); 21561 el.classList.toggle('m__preloader__frame--visible', i === last); 21562 }); 21563 return; 21564 } 21565 for(let i = 0; i < frames.length; i += 1)await showFrame(i); 21566 if (finalHold > 0) await sleep(finalHold); 21567 }; 21568 const finish = async ()=>{ 21569 setPreloaderSeenCookie(); 21570 root.classList.add('m__preloader--is-done'); 21571 root.setAttribute('aria-busy', 'false'); 21572 await waitForOpacityTransition(root, reducedMotion ? 50 : 900); 21573 root.setAttribute('aria-hidden', 'true'); 21574 }; 21575 (async ()=>{ 21576 await runSequence(); 21577 await waitWindowLoad(); 21578 await finish(); 21579 })(); 21580}; 21581if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', initPreloader); 21582else initPreloader(); 21583 21584},{}],"bEdN3":[function(require,module,exports,__globalThis) { 21585var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 21586var _swiperBundle = require("swiper/swiper-bundle"); 21587var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 21588var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 21589const imageSlider = ()=>{ 21590 const moduleSliders = document.querySelectorAll('.module .js-image-slider'); 21591 const popupSliders = document.querySelectorAll('.popup .js-image-slider');
21592 if (moduleSliders) moduleSliders.forEach((slider)=>{ 21593 const parentModuleElement = slider.closest('.module'); 21594 const parentModule = parentModuleElement.dataset.module; 21595 initImgSlider(slider, parentModuleElement, parentModule); 21596 }); 21597 if (popupSliders) popupSliders.forEach((slider)=>{ 21598 const parentPopupElement = slider.closest('.popup'); 21599 const parentPopup = parentPopupElement.dataset.popup; 21600 initImgSlider(slider, parentPopupElement, parentPopup); 21601 }); 21602}; 21603const initImgSlider = (slider, parentModuleElement, parentModule)=>{ 21604 const args = getSliderArgs(parentModule, slider); 21605 const imageSwiper = new (0, _swiperBundleDefault.default)(slider, args); 21606 const sliderContainer = slider.closest('.e__img-slider-container'); 21607 const prevArrow = sliderContainer.querySelector('.e__img-slider__nav-prev') ? sliderContainer.querySelector('.e__img-slider__nav-prev') : null; 21608 const nextArrow = sliderContainer.querySelector('.e__img-slider__nav-next') ? sliderContainer.querySelector('.e__img-slider__nav-next') : null; 21609 if (prevArrow) prevArrow.addEventListener('click', ()=>{ 21610 imageSwiper.slidePrev(); 21611 }); 21612 if (nextArrow) nextArrow.addEventListener('click', ()=>{ 21613 imageSwiper.slideNext(); 21614 }); 21615}; 21616const getSliderArgs = (type, elem)=>{ 21617 switch(type){ 21618 case 'hero': 21619 case 'promoSlider': 21620 case 'contentOverImage': 21621 case 'imageWithCard': 21622 return { 21623 loop: true, 21624 speed: 800, 21625 autoplay: { 21626 delay: 4000, 21627 disableOnInteraction: false 21628 }, 21629 effect: 'fade', 21630 fadeEffect: { 21631 crossFade: true 21632 }, 21633 keyboard: { 21634 enabled: true, 21635 onlyInViewport: true 21636 }, 21637 a11y: true 21638 }; 21639 case 'cm-rows': 21640 return { 21641 loop: true, 21642 speed: 800, 21643 autoplay: false, 21644 a11y: true 21645 }; 21646 case 'custom-popup': 21647 return { 21648 loop: true, 21649 speed: 800, 21650 autoplay: { 21651 delay: 3000, 21652 disableOnInteraction: false 21653 }, 21654 a11y: true 21655 }; 21656 default: 21657 return {}; 21658 } 21659}; 21660imageSlider(); 21661 21662},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"kGLxk":[function(require,module,exports,__globalThis) { 21663/** 21664 * CPT List Filters 21665 * Handles filtering of CPT list cards based on multiple criteria 21666 */ // Choices.js 21667var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 21668var _choicesJs = require("choices.js"); 21669var _choicesJsDefault = parcelHelpers.interopDefault(_choicesJs); 21670var _choicesCss = require("../../../../node_modules/choices.js/public/assets/styles/choices.css"); 21671const cptListModules = document.querySelectorAll('.cpt-list'); 21672if (cptListModules) cptListModules.forEach((module)=>{ 21673 const filterBar = module.querySelector('.cpt-list__filter-bar'); 21674 if (filterBar) { 21675 const cards = module.querySelectorAll('.cpt-list__card'); 21676 const resetButton = filterBar.querySelector('.js-filter-reset'); 21677 const cptName = module.getAttribute('data-cpt-name'); 21678 console.log(cptName); 21679 const noResultsMessage = module.getAttribute('data-no-results-message'); 21680 let activeFilters = {}; 21681 // Initialize filter selects 21682 const selects = filterBar.querySelectorAll('select'); 21683 selects.forEach((select)=>{ 21684 // //If Choices.js is present and not already initialized 21685 // const choicesInstance = new Choices(select, {
21686 // removeItemButton: false, 21687 // searchEnabled: false, 21688 // itemSelectText: '', 21689 // shouldSort: false, 21690 // position: 'bottom', 21691 // placeholder: true 21692 // }); 21693 // // Reset to default after selection is made 21694 // select.addEventListener('change', function(event) { 21695 // const selectedValue = this.value; 21696 // // Reset to the first option (empty value) 21697 // setTimeout(() => { 21698 // choicesInstance.setChoiceByValue(''); 21699 // }, 10); 21700 // }); 21701 // // Force Choices.js to always show the first option as selected 21702 // select.addEventListener('choice', function(event) { 21703 // // After selection, clear the selected value 21704 // setTimeout(() => { 21705 // select.value = ''; 21706 // // Also update Choices.js UI to reflect the placeholder only 21707 // choicesInstance.setChoiceByValue(choicesInstance.options[0].text); 21708 // }, 10); 21709 // }); 21710 select.addEventListener('change', (e)=>{ 21711 const filterName = e.target.name; 21712 const filterValue = e.target.value; 21713 if (filterValue) { 21714 // Check if this value is already selected before adding 21715 const isDuplicate = activeFilters[filterName] && activeFilters[filterName].some((filter)=>filter.value === filterValue); 21716 if (!isDuplicate) addFilter(filterName, filterValue, e.target.options[e.target.selectedIndex].text); 21717 // Reset select to allow multiple selections 21718 e.target.value = ''; 21719 } 21720 applyFilters(); 21721 }); 21722 }); 21723 function addFilter(filterName, filterValue, filterLabel) { 21724 // Initialize array for this filter type if it doesn't exist 21725 if (!activeFilters[filterName]) activeFilters[filterName] = []; 21726 // Check if this value is already selected 21727 const existingFilter = activeFilters[filterName].find((filter)=>filter.value === filterValue); 21728 if (!existingFilter) activeFilters[filterName].push({ 21729 value: filterValue, 21730 label: filterLabel 21731 }); 21732 updateFilterTags(); 21733 } 21734 function removeFilter(filterName, filterValue) { 21735 if (activeFilters[filterName]) { 21736 activeFilters[filterName] = activeFilters[filterName].filter((filter)=>filter.value !== filterValue); 21737 // Remove the filter type entirely if no values remain 21738 if (activeFilters[filterName].length === 0) delete activeFilters[filterName]; 21739 } 21740 updateFilterTags(); 21741 } 21742 function updateFilterTags() { 21743 // Remove existing filter tags within this module only 21744 const existingTags = filterBar.parentElement.querySelectorAll('.filter-tag'); 21745 existingTags.forEach((tag)=>tag.remove()); 21746 // Create filter tags container if it doesn't exist 21747 let tagsContainer = filterBar.parentElement.querySelector('.filter-tags-container'); 21748 if (!tagsContainer) { 21749 tagsContainer = document.createElement('div'); 21750 tagsContainer.className = 'filter-tags-container'; 21751 // Insert after the filter bar 21752 filterBar.parentNode.insertBefore(tagsContainer, filterBar.nextSibling); 21753 } 21754 // Add new filter tags 21755 Object.keys(activeFilters).forEach((filterName)=>{ 21756 activeFilters[filterName].forEach((filter)=>{ 21757 const tag = createFilterTag(filterName, filter.value, filter.label); 21758 tagsContainer.appendChild(tag); 21759 }); 21760 }); 21761 updateFilterAnnouncement(); 21762 } 21763 function updateFilterAnnouncement() { 21764 const announcement = filterBar.parentElement.querySelector('.m__eslist__filter-announcement'); 21765 if (announcement) { 21766 const filtersLength = Object.keys(activeFilters).length; 21767 if (filtersLength > 0) { 21768 const filtersApplied = Object.keys(activeFilters).map((filterName)=>activeFilters[filterName].map((filter)=>filter.label).join(', ')).join(', '); 21769 if (filtersLength === 1) announcement.textContent = '1 filter applied: ' + filtersApplied; 21770 else announcement.textContent = filtersLength + ' filters applied: ' + filtersApplied; 21771 } else announcement.textContent = 'No filters applied'; 21772 } 21773 } 21774 function createFilterTag(filterName, filterValue, filterLabel) { 21775 const tag = document.createElement('div'); 21776 tag.className = 'filter-tag'; 21777 tag.innerHTML = `
21778 <span class="f__paragraph-regular">${filterLabel}</span> 21779 <button class="remove-filter" data-filter="${filterName}" data-value="${filterValue}" aria-label="Remove filter ${filterLabel}"> 21780 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"> 21781 <line x1="18" y1="6" x2="6" y2="18"></line> 21782 <line x1="6" y1="6" x2="18" y2="18"></line> 21783 </svg> 21784 </button> 21785 `; 21786 // Add click handler to remove filter 21787 const removeBtn = tag.querySelector('.remove-filter'); 21788 removeBtn.addEventListener('click', (e)=>{ 21789 e.stopPropagation(); 21790 removeFilter(filterName, filterValue); 21791 applyFilters(); 21792 }); 21793 return tag; 21794 } 21795 function applyFilters() { 21796 cards.forEach((card)=>{ 21797 let shouldShow = true; 21798 // Check each active filter type 21799 Object.keys(activeFilters).forEach((filterName)=>{ 21800 const filterValues = activeFilters[filterName].map((filter)=>filter.value); 21801 const cardValues = getCardFilterValues(card, filterName); 21802 // Card should show if it matches ANY of the selected values for this filter type 21803 // Check if any of the card's values match any of the selected filter values 21804 if (cardValues && cardValues.length > 0) { 21805 const hasMatch = cardValues.some((cardValue)=>filterValues.includes(cardValue)); 21806 if (!hasMatch) shouldShow = false; 21807 } else // If card has no values for this filter type, hide it 21808 shouldShow = false; 21809 }); 21810 // Show/hide card using CSS 21811 if (shouldShow) { 21812 card.style.display = 'block'; 21813 card.style.opacity = '1'; 21814 } else { 21815 card.style.display = 'none'; 21816 card.style.opacity = '0'; 21817 } 21818 }); 21819 // Update card count or show "no results" message 21820 updateResultsCount(); 21821 } 21822 function getCardFilterValues(card, filterName) { 21823 // Map filter names to data attributes 21824 let filterMap = {}; 21825 switch(cptName){ 21826 case 'rooms': 21827 filterMap = { 21828 'room-num-guests-filter': 'data-room-num-guests', 21829 'room-type-filter': 'data-room-type', 21830 'room-bed-size-filter': 'data-room-bed-size' 21831 }; 21832 break; 21833 case 'offers': 21834 filterMap = { 21835 'offer-type-filter': 'data-offer-type' 21836 }; 21837 break; 21838 case 'whats-on': 21839 filterMap = { 21840 'whats-on-event-type-filter': 'data-whats-on-event-type', 21841 'whats-on-location-filter': 'data-whats-on-location' 21842 }; 21843 break; 21844 case 'event-spaces': 21845 filterMap = { 21846 'event-space-event-type-filter': 'data-event-space-event-type', 21847 'event-space-party-size-filter': 'data-event-space-party-size' 21848 }; 21849 break; 21850 case 'newsfeed': 21851 filterMap = { 21852 'news-type-filter': 'data-news-type' 21853 }; 21854 break; 21855 case 'menus': 21856 filterMap = { 21857 'menu-type-filter': 'data-menu-type', 21858 'dietary-requirement-filter': 'data-dietary-requirement' 21859 }; 21860 break; 21861 } 21862 const dataAttr = filterMap[filterName]; 21863 if (dataAttr) { 21864 const value = card.getAttribute(dataAttr); 21865 if (value) // Split space-separated values into array and trim whitespace 21866 return value.split(' ').map((v)=>v.trim()).filter((v)=>v.length > 0); 21867 } 21868 return []; 21869 } 21870 function updateResultsCount() { 21871 const visibleCards = Array.from(cards).filter((card)=>card.style.display !== 'none'); 21872 // You can add logic here to show count or "no results" message 21873 if (visibleCards.length === 0) showNoResults(); 21874 else hideNoResults(); 21875 } 21876 function showNoResults() { 21877 let noResults = filterBar.parentElement.querySelector('.no-results'); 21878 if (!noResults) { 21879 noResults = document.createElement('div'); 21880 noResults.className = 'no-results text-center py-8 text-gray-500'; 21881 noResults.innerHTML = '<p>' + noResultsMessage + '</p>'; 21882 filterBar.parentElement.appendChild(noResults); 21883 } 21884 noResults.style.display = 'block'; 21885 } 21886 function hideNoResults() { 21887 const noResults = filterBar.parentElement.querySelector('.no-results'); 21888 if (noResults) noResults.style.display = 'none'; 21889 } 21890 function resetAllFilters() { 21891 // Clear active filters 21892 activeFilters = {}; 21893 // Reset all selects 21894 const selects = filterBar.querySelectorAll('select');
21895 selects.forEach((select)=>{ 21896 select.value = ''; 21897 }); 21898 // Show all cards 21899 showAllCards(); 21900 // Update filter tags 21901 updateFilterTags(); 21902 } 21903 function showAllCards() { 21904 cards.forEach((card)=>{ 21905 card.style.display = 'block'; 21906 card.style.opacity = '1'; 21907 }); 21908 hideNoResults(); 21909 } 21910 // Initialize reset button 21911 const resetButtons = filterBar.querySelectorAll('.js-filter-reset'); 21912 resetButtons.forEach((resetButton)=>{ 21913 resetButton.addEventListener('click', ()=>resetAllFilters()); 21914 }); 21915 } 21916}); 21917 21918},{"choices.js":"cVxV3","../../../../node_modules/choices.js/public/assets/styles/choices.css":"eN4G5","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"cVxV3":[function(require,module,exports,__globalThis) { 21919/*! choices.js v10.2.0 | © 2022 Josh Johnson | https://github.com/jshjohnson/Choices#readme */ (function webpackUniversalModuleDefinition(root, factory) { 21920 module.exports = factory(); 21921})(window, function() { 21922 return /******/ function() { 21923 /******/ "use strict"; 21924 /******/ var __webpack_modules__ = { 21925 /***/ 282: /***/ function(__unused_webpack_module, exports, __webpack_require__) { 21926 Object.defineProperty(exports, "__esModule", { 21927 value: true 21928 }); 21929 exports.clearChoices = exports.activateChoices = exports.filterChoices = exports.addChoice = void 0; 21930 var constants_1 = __webpack_require__(883); 21931 var addChoice = function(_a) { 21932 var value = _a.value, label = _a.label, id = _a.id, groupId = _a.groupId, disabled = _a.disabled, elementId = _a.elementId, customProperties = _a.customProperties, placeholder = _a.placeholder, keyCode = _a.keyCode; 21933 return { 21934 type: constants_1.ACTION_TYPES.ADD_CHOICE, 21935 value: value, 21936 label: label, 21937 id: id, 21938 groupId: groupId, 21939 disabled: disabled, 21940 elementId: elementId, 21941 customProperties: customProperties, 21942 placeholder: placeholder, 21943 keyCode: keyCode 21944 }; 21945 }; 21946 exports.addChoice = addChoice; 21947 var filterChoices = function(results) { 21948 return { 21949 type: constants_1.ACTION_TYPES.FILTER_CHOICES, 21950 results: results 21951 }; 21952 }; 21953 exports.filterChoices = filterChoices; 21954 var activateChoices = function(active) { 21955 if (active === void 0) active = true; 21956 return { 21957 type: constants_1.ACTION_TYPES.ACTIVATE_CHOICES, 21958 active: active 21959 }; 21960 }; 21961 exports.activateChoices = activateChoices; 21962 var clearChoices = function() { 21963 return { 21964 type: constants_1.ACTION_TYPES.CLEAR_CHOICES 21965 }; 21966 }; 21967 exports.clearChoices = clearChoices; 21968 /***/ }, 21969 /***/ 783: /***/ function(__unused_webpack_module, exports, __webpack_require__) { 21970 Object.defineProperty(exports, "__esModule", { 21971 value: true 21972 }); 21973 exports.addGroup = void 0; 21974 var constants_1 = __webpack_require__(883); 21975 var addGroup = function(_a) { 21976 var value = _a.value, id = _a.id, active = _a.active, disabled = _a.disabled; 21977 return { 21978 type: constants_1.ACTION_TYPES.ADD_GROUP, 21979 value: value, 21980 id: id, 21981 active: active, 21982 disabled: disabled 21983 }; 21984 }; 21985 exports.addGroup = addGroup; 21986 /***/ }, 21987 /***/ 464: /***/ function(__unused_webpack_module, exports, __webpack_require__) { 21988 Object.defineProperty(exports, "__esModule", { 21989 value: true 21990 }); 21991 exports.highlightItem = exports.removeItem = exports.addItem = void 0; 21992 var constants_1 = __webpack_require__(883); 21993 var addItem = function(_a) { 21994 var value = _a.value, label = _a.label, id = _a.id, choiceId = _a.choiceId, groupId = _a.groupId, customProperties = _a.customProperties, placeholder = _a.placeholder, keyCode = _a.keyCode; 21995 return { 21996 type: constants_1.ACTION_TYPES.ADD_ITEM, 21997 value: value, 21998 label: label, 21999 id: id, 22000 choiceId: choiceId, 22001 groupId: groupId, 22002 customProperties: customProperties, 22003 placeholder: placeholder, 22004 keyCode: keyCode 22005 }; 22006 }; 22007 exports.addItem = addItem; 22008 var removeItem = function(id, choiceId) { 22009 return { 22010 type: constants_1.ACTION_TYPES.REMOVE_ITEM, 22011 id: id, 22012 choiceId: choiceId 22013 }; 22014 }; 22015 exports.removeItem = removeItem; 22016 var highlightItem = function(id, highlighted) { 22017 return { 22018 type: constants_1.ACTION_TYPES.HIGHLIGHT_ITEM, 22019 id: id, 22020 highlighted: highlighted 22021 }; 22022 }; 22023 exports.highlightItem = highlightItem; 22024 /***/ }, 22025 /***/ 137: /***/ function(__unused_webpack_module, exports, __webpack_require__) { 22026 Object.defineProperty(exports, "__esModule", { 22027 value: true 22028 }); 22029 exports.setIsLoading = exports.resetTo = exports.clearAll = void 0; 22030 var constants_1 = __webpack_require__(883); 22031 var clearAll = function() { 22032 return { 22033 type: constants_1.ACTION_TYPES.CLEAR_ALL 22034 }; 22035 }; 22036 exports.clearAll = clearAll; 22037 var resetTo = function(state) { 22038 return { 22039 type: constants_1.ACTION_TYPES.RESET_TO, 22040 state: state 22041 }; 22042 }; 22043 exports.resetTo = resetTo; 22044 var setIsLoading = function(isLoading) { 22045 return { 22046 type: constants_1.ACTION_TYPES.SET_IS_LOADING, 22047 isLoading: isLoading 22048 }; 22049 }; 22050 exports.setIsLoading = setIsLoading; 22051 /***/ }, 22052 /***/ 373: /***/ function(__unused_webpack_module, exports, __webpack_require__) { 22053 var __spreadArray = this && this.__spreadArray || function(to, from, pack) { 22054 if (pack || arguments.length === 2) { 22055 for(var i = 0, l = from.length, ar; i < l; i++)if (ar || !(i in from)) { 22056 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 22057 ar[i] = from[i]; 22058 } 22059 } 22060 return to.concat(ar || Array.prototype.slice.call(from)); 22061 }; 22062 var __importDefault = this && this.__importDefault || function(mod) { 22063 return mod && mod.__esModule ? mod : { 22064 "default": mod 22065 }; 22066 }; 22067 Object.defineProperty(exports, "__esModule", { 22068 value: true 22069 }); 22070 var deepmerge_1 = __importDefault(__webpack_require__(996)); 22071 /* eslint-disable @typescript-eslint/no-explicit-any */ var fuse_js_1 = __importDefault(__webpack_require__(221)); 22072 var choices_1 = __webpack_require__(282); 22073 var groups_1 = __webpack_require__(783); 22074 var items_1 = __webpack_require__(464); 22075 var misc_1 = __webpack_require__(137); 22076 var components_1 = __webpack_require__(520); 22077 var constants_1 = __webpack_require__(883); 22078 var defaults_1 = __webpack_require__(789); 22079 var utils_1 = __webpack_require__(799); 22080 var reducers_1 = __webpack_require__(655); 22081 var store_1 = __importDefault(__webpack_require__(744)); 22082 var templates_1 = __importDefault(__webpack_require__(686)); 22083 /** @see {@link http://browserhacks.com/#hack-acea075d0ac6954f275a70023906050c} */ var IS_IE11 = '-ms-scroll-limit' in document.documentElement.style && '-ms-ime-align' in document.documentElement.style; 22084 var USER_DEFAULTS = {}; 22085 /** 22086 * Choices 22087 * @author Josh Johnson<[email protected]>
22088 */ var Choices = /** @class */ function() { 22089 function Choices(element, userConfig) { 22090 if (element === void 0) element = '[data-choice]'; 22091 if (userConfig === void 0) userConfig = {}; 22092 var _this = this; 22093 if (userConfig.allowHTML === undefined) console.warn('Deprecation warning: allowHTML will default to false in a future release. To render HTML in Choices, you will need to set it to true. Setting allowHTML will suppress this message.'); 22094 this.config = deepmerge_1.default.all([ 22095 defaults_1.DEFAULT_CONFIG, 22096 Choices.defaults.options, 22097 userConfig 22098 ], // When merging array configs, replace with a copy of the userConfig array, 22099 // instead of concatenating with the default array 22100 { 22101 arrayMerge: function(_, sourceArray) { 22102 return __spreadArray([], sourceArray, true); 22103 } 22104 }); 22105 var invalidConfigOptions = (0, utils_1.diff)(this.config, defaults_1.DEFAULT_CONFIG); 22106 if (invalidConfigOptions.length) console.warn('Unknown config option(s) passed', invalidConfigOptions.join(', ')); 22107 var passedElement = typeof element === 'string' ? document.querySelector(element) : element; 22108 if (!(passedElement instanceof HTMLInputElement || passedElement instanceof HTMLSelectElement)) throw TypeError('Expected one of the following types text|select-one|select-multiple'); 22109 this._isTextElement = passedElement.type === constants_1.TEXT_TYPE; 22110 this._isSelectOneElement = passedElement.type === constants_1.SELECT_ONE_TYPE; 22111 this._isSelectMultipleElement = passedElement.type === constants_1.SELECT_MULTIPLE_TYPE; 22112 this._isSelectElement = this._isSelectOneElement || this._isSelectMultipleElement; 22113 this.config.searchEnabled = this._isSelectMultipleElement || this.config.searchEnabled; 22114 if (![ 22115 'auto', 22116 'always' 22117 ].includes("".concat(this.config.renderSelectedChoices))) this.config.renderSelectedChoices = 'auto'; 22118 if (userConfig.addItemFilter && typeof userConfig.addItemFilter !== 'function') { 22119 var re = userConfig.addItemFilter instanceof RegExp ? userConfig.addItemFilter : new RegExp(userConfig.addItemFilter); 22120 this.config.addItemFilter = re.test.bind(re); 22121 } 22122 if (this._isTextElement) this.passedElement = new components_1.WrappedInput({ 22123 element: passedElement, 22124 classNames: this.config.classNames, 22125 delimiter: this.config.delimiter 22126 }); 22127 else this.passedElement = new components_1.WrappedSelect({ 22128 element: passedElement, 22129 classNames: this.config.classNames, 22130 template: function(data) { 22131 return _this._templates.option(data); 22132 } 22133 }); 22134 this.initialised = false; 22135 this._store = new store_1.default(); 22136 this._initialState = reducers_1.defaultState; 22137 this._currentState = reducers_1.defaultState; 22138 this._prevState = reducers_1.defaultState; 22139 this._currentValue = ''; 22140 this._canSearch = !!this.config.searchEnabled; 22141 this._isScrollingOnIe = false; 22142 this._highlightPosition = 0; 22143 this._wasTap = true; 22144 this._placeholderValue = this._generatePlaceholderValue(); 22145 this._baseId = (0, utils_1.generateId)(this.passedElement.element, 'choices-'); 22146 /** 22147 * setting direction in cases where it's explicitly set on passedElement 22148 * or when calculated direction is different from the document 22149 */ this._direction = this.passedElement.dir; 22150 if (!this._direction) { 22151 var elementDirection = window.getComputedStyle(this.passedElement.element).direction; 22152 var documentDirection = window.getComputedStyle(document.documentElement).direction; 22153 if (elementDirection !== documentDirection) this._direction = elementDirection; 22154 } 22155 this._idNames = { 22156 itemChoice: 'item-choice' 22157 }; 22158 if (this._isSelectElement) { 22159 // Assign preset groups from passed element 22160 this._presetGroups = this.passedElement.optionGroups; 22161 // Assign preset options from passed element 22162 this._presetOptions = this.passedElement.options; 22163 } 22164 // Assign preset choices from passed object 22165 this._presetChoices = this.config.choices; 22166 // Assign preset items from passed object first 22167 this._presetItems = this.config.items; 22168 // Add any values passed from attribute 22169 if (this.passedElement.value && this._isTextElement) { 22170 var splitValues = this.passedElement.value.split(this.config.delimiter); 22171 this._presetItems = this._presetItems.concat(splitValues); 22172 } 22173 // Create array of choices from option elements 22174 if (this.passedElement.options) this.passedElement.options.forEach(function(option) { 22175 _this._presetChoices.push({ 22176 value: option.value, 22177 label: option.innerHTML, 22178 selected: !!option.selected, 22179 disabled: option.disabled || option.parentNode.disabled, 22180 placeholder: option.value === '' || option.hasAttribute('placeholder'), 22181 customProperties: (0, utils_1.parseCustomProperties)(option.dataset.customProperties) 22182 }); 22183 }); 22184 this._render = this._render.bind(this); 22185 this._onFocus = this._onFocus.bind(this); 22186 this._onBlur = this._onBlur.bind(this); 22187 this._onKeyUp = this._onKeyUp.bind(this); 22188 this._onKeyDown = this._onKeyDown.bind(this); 22189 this._onClick = this._onClick.bind(this); 22190 this._onTouchMove = this._onTouchMove.bind(this); 22191 this._onTouchEnd = this._onTouchEnd.bind(this); 22192 this._onMouseDown = this._onMouseDown.bind(this); 22193 this._onMouseOver = this._onMouseOver.bind(this); 22194 this._onFormReset = this._onFormReset.bind(this); 22195 this._onSelectKey = this._onSelectKey.bind(this); 22196 this._onEnterKey = this._onEnterKey.bind(this); 22197 this._onEscapeKey = this._onEscapeKey.bind(this); 22198 this._onDirectionKey = this._onDirectionKey.bind(this); 22199 this._onDeleteKey = this._onDeleteKey.bind(this); 22200 // If element has already been initialised with Choices, fail silently 22201 if (this.passedElement.isActive) { 22202 if (!this.config.silent) console.warn('Trying to initialise Choices on element already initialised', { 22203 element: element 22204 });
22205 this.initialised = true; 22206 return; 22207 } 22208 // Let's go 22209 this.init(); 22210 } 22211 Object.defineProperty(Choices, "defaults", { 22212 get: function() { 22213 return Object.preventExtensions({ 22214 get options () { 22215 return USER_DEFAULTS; 22216 }, 22217 get templates () { 22218 return templates_1.default; 22219 } 22220 }); 22221 }, 22222 enumerable: false, 22223 configurable: true 22224 }); 22225 Choices.prototype.init = function() { 22226 if (this.initialised) return; 22227 this._createTemplates(); 22228 this._createElements(); 22229 this._createStructure(); 22230 this._store.subscribe(this._render); 22231 this._render(); 22232 this._addEventListeners(); 22233 var shouldDisable = !this.config.addItems || this.passedElement.element.hasAttribute('disabled'); 22234 if (shouldDisable) this.disable(); 22235 this.initialised = true; 22236 var callbackOnInit = this.config.callbackOnInit; 22237 // Run callback if it is a function 22238 if (callbackOnInit && typeof callbackOnInit === 'function') callbackOnInit.call(this); 22239 }; 22240 Choices.prototype.destroy = function() { 22241 if (!this.initialised) return; 22242 this._removeEventListeners(); 22243 this.passedElement.reveal(); 22244 this.containerOuter.unwrap(this.passedElement.element); 22245 this.clearStore(); 22246 if (this._isSelectElement) this.passedElement.options = this._presetOptions; 22247 this._templates = templates_1.default; 22248 this.initialised = false; 22249 }; 22250 Choices.prototype.enable = function() { 22251 if (this.passedElement.isDisabled) this.passedElement.enable(); 22252 if (this.containerOuter.isDisabled) { 22253 this._addEventListeners(); 22254 this.input.enable(); 22255 this.containerOuter.enable(); 22256 } 22257 return this; 22258 }; 22259 Choices.prototype.disable = function() { 22260 if (!this.passedElement.isDisabled) this.passedElement.disable(); 22261 if (!this.containerOuter.isDisabled) { 22262 this._removeEventListeners(); 22263 this.input.disable(); 22264 this.containerOuter.disable(); 22265 } 22266 return this; 22267 }; 22268 Choices.prototype.highlightItem = function(item, runEvent) { 22269 if (runEvent === void 0) runEvent = true; 22270 if (!item || !item.id) return this; 22271 var id = item.id, _a = item.groupId, groupId = _a === void 0 ? -1 : _a, _b = item.value, value = _b === void 0 ? '' : _b, _c = item.label, label = _c === void 0 ? '' : _c; 22272 var group = groupId >= 0 ? this._store.getGroupById(groupId) : null; 22273 this._store.dispatch((0, items_1.highlightItem)(id, true)); 22274 if (runEvent) this.passedElement.triggerEvent(constants_1.EVENTS.highlightItem, { 22275 id: id, 22276 value: value, 22277 label: label, 22278 groupValue: group && group.value ? group.value : null 22279 }); 22280 return this; 22281 }; 22282 Choices.prototype.unhighlightItem = function(item) { 22283 if (!item || !item.id) return this; 22284 var id = item.id, _a = item.groupId, groupId = _a === void 0 ? -1 : _a, _b = item.value, value = _b === void 0 ? '' : _b, _c = item.label, label = _c === void 0 ? '' : _c; 22285 var group = groupId >= 0 ? this._store.getGroupById(groupId) : null; 22286 this._store.dispatch((0, items_1.highlightItem)(id, false)); 22287 this.passedElement.triggerEvent(constants_1.EVENTS.highlightItem, { 22288 id: id, 22289 value: value, 22290 label: label, 22291 groupValue: group && group.value ? group.value : null 22292 }); 22293 return this; 22294 }; 22295 Choices.prototype.highlightAll = function() { 22296 var _this = this;
22297 this._store.items.forEach(function(item) { 22298 return _this.highlightItem(item); 22299 }); 22300 return this; 22301 }; 22302 Choices.prototype.unhighlightAll = function() { 22303 var _this = this; 22304 this._store.items.forEach(function(item) { 22305 return _this.unhighlightItem(item); 22306 }); 22307 return this; 22308 }; 22309 Choices.prototype.removeActiveItemsByValue = function(value) { 22310 var _this = this; 22311 this._store.activeItems.filter(function(item) { 22312 return item.value === value; 22313 }).forEach(function(item) { 22314 return _this._removeItem(item); 22315 }); 22316 return this; 22317 }; 22318 Choices.prototype.removeActiveItems = function(excludedId) { 22319 var _this = this; 22320 this._store.activeItems.filter(function(_a) { 22321 var id = _a.id; 22322 return id !== excludedId; 22323 }
22323).forEach(function(item) { 22324 return _this._removeItem(item); 22325 }); 22326 return this; 22327 }; 22328 Choices.prototype.removeHighlightedItems = function(runEvent) { 22329 var _this = this; 22330 if (runEvent === void 0) runEvent = false; 22331 this._store.highlightedActiveItems.forEach(function(item) { 22332 _this._removeItem(item); 22333 // If this action was performed by the user 22334 // trigger the event 22335 if (runEvent) _this._triggerChange(item.value); 22336 }); 22337 return this; 22338 }; 22339 Choices.prototype.showDropdown = function(preventInputFocus) { 22340 var _this = this; 22341 if (this.dropdown.isActive) return this; 22342 requestAnimationFrame(function() { 22343 _this.dropdown.show(); 22344 _this.containerOuter.open(_this.dropdown.distanceFromTopWindow); 22345 if (!preventInputFocus && _this._canSearch) _this.input.focus(); 22346 _this.passedElement.triggerEvent(constants_1.EVENTS.showDropdown, {}); 22347 }); 22348 return this; 22349 }; 22350 Choices.prototype.hideDropdown = function(preventInputBlur) { 22351 var _this = this; 22352 if (!this.dropdown.isActive) return this; 22353 requestAnimationFrame(function() { 22354 _this.dropdown.hide(); 22355 _this.containerOuter.close(); 22356 if (!preventInputBlur && _this._canSearch) { 22357 _this.input.removeActiveDescendant(); 22358 _this.input.blur(); 22359 } 22360 _this.passedElement.triggerEvent(constants_1.EVENTS.hideDropdown, {}); 22361 }); 22362 return this; 22363 }; 22364 Choices.prototype.getValue = function(valueOnly) { 22365 if (valueOnly === void 0) valueOnly = false; 22366 var values = this._store.activeItems.reduce(function(selectedItems, item) { 22367 var itemValue = valueOnly ? item.value : item; 22368 selectedItems.push(itemValue); 22369 return selectedItems; 22370 }, []); 22371 return this._isSelectOneElement ? values[0] : values; 22372 }; 22373 Choices.prototype.setValue = function(items) { 22374 var _this = this; 22375 if (!this.initialised) return this; 22376 items.forEach(function(value) { 22377 return _this._setChoiceOrItem(value); 22378 }); 22379 return this; 22380 }; 22381 Choices.prototype.setChoiceByValue = function(value) { 22382 var _this = this; 22383 if (!this.initialised || this._isTextElement) return this; 22384 // If only one value has been passed, convert to array 22385 var choiceValue = Array.isArray(value) ? value : [ 22386 value 22387 ]; 22388 // Loop through each value and 22389 choiceValue.forEach(function(val) { 22390 return _this._findAndSelectChoiceByValue(val); 22391 }); 22392 return this; 22393 }; 22394 /** 22395 * Set choices of select input via an array of objects (or function that returns array of object or promise of it), 22396 * a value field name and a label field name. 22397 * This behaves the same as passing items via the choices option but can be called after initialising Choices. 22398 * This can also be used to add groups of choices (see example 2); Optionally pass a true `replaceChoices` value to remove any existing choices. 22399 * Optionally pass a `customProperties` object to add additional data to your choices (useful when searching/filter
22399ing etc). 22400 * 22401 * **Input types affected:** select-one, select-multiple 22402 * 22403 * @example 22404 * ```js 22405 * const example = new Choices(element); 22406 * 22407 * example.setChoices([ 22408 * {value: 'One', label: 'Label One', disabled: true}, 22409 * {value: 'Two', label: 'Label Two', selected: true}, 22410 * {value: 'Three', label: 'Label Three'}, 22411 * ], 'value', 'label', false); 22412 * ``` 22413 * 22414 * @example 22415 * ```js 22416 * const example = new Choices(element); 22417 * 22418 * example.setChoices(async () => { 22419 * try { 22420 * const items = await fetch('/items'); 22421 * return items.json() 22422 * } catch(err) { 22423 * console.error(err) 22424 * } 22425 * }); 22426 * ``` 22427 * 22428 * @example 22429 * ```js 22430 * const example = new Choices(element); 22431 * 22432 * example.setChoices([{ 22433 * label: 'Group one', 22434 * id: 1, 22435 * disabled: false, 22436 * choices: [ 22437 * {value: 'Child One', label: 'Child One', selected: true}, 22438 * {value: 'Child Two', label: 'Child Two', disabled: true}, 22439 * {value: 'Child Three', label: 'Child Three'}, 22440 * ] 22441 * }, 22442 * { 22443 * label: 'Group two', 22444 * id: 2, 22445 * disabled: false, 22446 * choices: [ 22447 * {value: 'Child Four', label: 'Child Four', disabled: true}, 22448 * {value: 'Child Five', label: 'Child Five'}, 22449 * {value: 'Child Six', label: 'Child Six', customProperties: { 22450 * description: 'Custom description about child six', 22451 * random: 'Another random custom property' 22452 * }}, 22453 * ] 22454 * }], 'value', 'label', false); 22455 * ``` 22456 */ Choices.prototype.setChoices = function(choicesArrayOrFetcher, value, label, replaceChoices) { 22457 var _this = this; 22458 if (choicesArrayOrFetcher === void 0) choicesArrayOrFetcher = []; 22459 if (value === void 0) value = 'value'; 22460 if (label === void 0) label = 'label'; 22461 if (replaceChoices === void 0) replaceChoices = false; 22462 if (!this.initialised) throw new ReferenceError("setChoices was called on a non-initialized instance of Choices"); 22463 if (!this._isSelectElement) throw new TypeError("setChoices can't be used with INPUT based Choices"); 22464 if (typeof value !== 'string' || !value) throw new TypeError("value parameter must be a name of 'value' field in passed objects"); 22465 // Clear choices if needed 22466 if (replaceChoices) this.clearChoices(); 22467 if (typeof choicesArrayOrFetcher === 'function') { 22468 // it's a choices fetcher function 22469 var fetcher_1 = choicesArrayOrFetcher(this); 22470 if (typeof Promise === 'function' && fetcher_1 instanceof Promise) // that's a promise 22471 // eslint-disable-next-line no-promise-executor-return 22472 return new Promise(function(resolve) { 22473 return requestAnimationFrame(resolve); 22474 }).then(function() { 22475 return _this._handleLoadingState(true); 22476 }).then(function() { 22477 return fetcher_1; 22478 }).then(function(data) { 22479 return _this.setChoices(data, value, label, replaceChoices); 22480 }).catch(function(err) { 22481 if (!_this.config.silent) console.error(err); 22482 }).then(function() { 22483 return _this._handleLoadingState(false); 22484 }).then(function() { 22485 return _this; 22486 }); 22487 // function returned something else than promise, let's check if it's an array of choices 22488 if (!Array.isArray(fetcher_1)) throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof fetcher_1)); 22489 // recursion with results, it's sync and choices were cleared already 22490 return this.setChoices(fetcher_1, value, label, false); 22491 } 22492 if (!Array.isArray(choicesArrayOrFetcher)) throw new TypeError(".setChoices must be called either with array of choices with a function resulting into Promise of array of choices"); 22493 this.containerOuter.removeLoadingState(); 22494 this._startLoading(); 22495 choicesArrayOrFetcher.forEach(function(groupOrChoice) { 22496 if (groupOrChoice.choices) _this._addGroup({ 22497 id: groupOrChoice.id ? parseInt("".concat(groupOrChoice.id), 10) : null, 22498 group: groupOrChoice, 22499 valueKey: value, 22500 labelKey: label 22501 }); 22502 else { 22503 var choice = groupOrChoice; 22504 _this._addChoice({ 22505 value: choice[value], 22506 label: choice[label], 22507 isSelected: !!choice.selected, 22508 isDisabled: !!choice.disabled,
22509 placeholder: !!choice.placeholder, 22510 customProperties: choice.customProperties 22511 }); 22512 } 22513 }); 22514 this._stopLoading(); 22515 return this; 22516 }; 22517 Choices.prototype.clearChoices = function() { 22518 this._store.dispatch((0, choices_1.clearChoices)()); 22519 return this; 22520 }; 22521 Choices.prototype.clearStore = function() { 22522 this._store.dispatch((0, misc_1.clearAll)()); 22523 return this; 22524 }; 22525 Choices.prototype.clearInput = function() { 22526 var shouldSetInputWidth = !this._isSelectOneElement; 22527 this.input.clear(shouldSetInputWidth); 22528 if (!this._isTextElement && this._canSearch) { 22529 this._isSearching = false; 22530 this._store.dispatch((0, choices_1.activateChoices)(true)); 22531 } 22532 return this; 22533 }; 22534 Choices.prototype._render = function() { 22535 if (this._store.isLoading()) return; 22536 this._currentState = this._store.state; 22537 var stateChanged = this._currentState.choices !== this._prevState.choices || this._currentState.groups !== this._prevState.groups || this._currentState.items !== this._prevState.items; 22538 var shouldRenderChoices = this._isSelectElement; 22539 var shouldRenderItems = this._currentState.items !== this._prevState.items; 22540 if (!stateChanged) return; 22541 if (shouldRenderChoices) this._renderChoices(); 22542 if (shouldRenderItems) this._renderItems(); 22543 this._prevState = this._currentState; 22544 }; 22545 Choices.prototype._renderChoices = function() { 22546 var _this = this; 22547 var _a = this._store, activeGroups = _a.activeGroups, activeChoices = _a.activeChoices; 22548 var choiceListFragment = document.createDocumentFragment(); 22549 this.choiceList.clear(); 22550 if (this.config.resetScrollPosition) requestAnimationFrame(function() { 22551 return _this.choiceList.scrollToTop(); 22552 }); 22553 // If we have grouped options 22554 if (activeGroups.length >= 1 && !this._isSearching) { 22555 // If we have a placeholder choice along with groups 22556 var activePlaceholders = activeChoices.filter(function(activeChoice) { 22557 return activeChoice.placeholder === true && activeChoice.groupId === -1; 22558 }); 22559 if (activePlaceholders.length >= 1) choiceListFragment = this._createChoicesFragment(activePlaceholders, choiceListFragment); 22560 choiceListFragment = this._createGroupsFragment(activeGroups, activeChoices, choiceListFragment); 22561 } else if (activeChoices.length >= 1) choiceListFragment = this._createChoicesFragment(activeChoices, choiceListFragment);
22562 // If we have choices to show 22563 if (choiceListFragment.childNodes && choiceListFragment.childNodes.length > 0) { 22564 var activeItems = this._store.activeItems; 22565 var canAddItem = this._canAddItem(activeItems, this.input.value); 22566 // ...and we can select them 22567 if (canAddItem.response) { 22568 // ...append them and highlight the first choice 22569 this.choiceList.append(choiceListFragment); 22570 this._highlightChoice(); 22571 } else { 22572 var notice = this._getTemplate('notice', canAddItem.notice); 22573 this.choiceList.append(notice); 22574 } 22575 } else { 22576 // Otherwise show a notice 22577 var dropdownItem = void 0; 22578 var notice = void 0; 22579 if (this._isSearching) { 22580 notice = typeof this.config.noResultsText === 'function' ? this.config.noResultsText() : this.config.noResultsText; 22581 dropdownItem = this._getTemplate('notice', notice, 'no-results'); 22582 } else { 22583 notice = typeof this.config.noChoicesText === 'function' ? this.config.noChoicesText() : this.config.noChoicesText; 22584 dropdownItem = this._getTemplate('notice', notice, 'no-choices'); 22585 } 22586 this.choiceList.append(dropdownItem); 22587 } 22588 }; 22589 Choices.prototype._renderItems = function() { 22590 var activeItems = this._store.activeItems || []; 22591 this.itemList.clear(); 22592 // Create a fragment to store our list items 22593 // (so we don't have to update the DOM for each item) 22594 var itemListFragment = this._createItemsFragment(activeItems); 22595 // If we have items to add, append them 22596 if (itemListFragment.childNodes) this.itemList.append(itemListFragment); 22597 }; 22598 Choices.prototype._createGroupsFragment = function(groups, choices, fragment) { 22599 var _this = this; 22600 if (fragment === void 0) fragment = document.createDocumentFragment(); 22601 var getGroupChoices = function(group) { 22602 return choices.filter(function(choice) { 22603 if (_this._isSelectOneElement) return choice.groupId === group.id; 22604 return choice.groupId === group.id && (_this.config.renderSelectedChoices === 'always' || !choice.selected); 22605 }); 22606 }; 22607 // If sorting is enabled, filter groups 22608 if (this.config.shouldSort) groups.sort(this.config.sorter); 22609 groups.forEach(function(group) { 22610 var groupChoices = getGroupChoices(group); 22611 if (groupChoices.length >= 1) { 22612 var dropdownGroup = _this._getTemplate('choiceGroup', group); 22613 fragment.appendChild(dropdownGroup); 22614 _this._createChoicesFragment(groupChoices, fragment, true); 22615 } 22616 }); 22617 return fragment; 22618 }; 22619 Choices.prototype._createChoicesFragment = function(choices, fragment, withinGroup) { 22620 var _this = this; 22621 if (fragment === void 0) fragment = document.createDocumentFragment(); 22622 if (withinGroup === void 0) withinGroup = false; 22623 // Create a fragment to store our list items (so we don't have to update the DOM for each item) 22624 var _a = this.config, renderSelectedChoices = _a.renderSelectedChoices, searchResultLimit = _a.searchResultLimit, renderChoiceLimit = _a.renderChoiceLimit; 22625 var filter = this._isSearching ? utils_1.sortByScore : this.config.sorter; 22626 var appendChoice = function(choice) { 22627 var shouldRender = renderSelectedChoices === 'auto' ? _this._isSelectOneElement || !choice.selected : true; 22628 if (shouldRender) { 22629 var dropdownItem = _this._getTemplate('choice', choice, _this.config.itemSelectText); 22630 fragment.appendChild(dropdownItem); 22631 } 22632 }; 22633 var rendererableChoices = choices; 22634 if (renderSelectedChoices === 'auto' && !this._isSelectOneElement) rendererableChoices = choices.filter(function(choice) { 22635 return !choice.selected; 22636 }); 22637 // Split array into placeholders and "normal" choices 22638 var _b = rendererableChoices.reduce(function(acc, choice) { 22639 if (choice.placeholder) acc.placeholderChoices.push(choice); 22640 else acc.normalChoices.push(choice); 22641 return acc; 22642 }, { 22643 placeholderChoices: [], 22644 normalChoices: [] 22645 }), placeholderChoices = _b.placeholderChoices, normalChoices = _b.normalChoices; 22646 // If sorting is enabled or the user is searching, filter choices 22647 if (this.config.shouldSort || this._isSearching) normalChoices.sort(filter); 22648 var choiceLimit = rendererableChoices.length; 22649 // Prepend placeholeder 22650 var sortedChoices = this._isSelectOneElement ? __spreadArray(__spreadArray([], placeholderChoices, true), normalChoices, true) : normalChoices; 22651 if (this._isSearching) choiceLimit = searchResultLimit; 22652 else if (renderChoiceLimit && renderChoiceLimit > 0 && !withinGroup) choiceLimit = renderChoiceLimit; 22653 // Add each choice to dropdown within range 22654 for(var i = 0; i < choiceLimit; i += 1)if (sortedChoices[i]) appendChoice(sortedChoices[i]); 22655 return fragment; 22656 }; 22657 Choices.prototype._createItemsFragment = function(items, fragment) { 22658 var _this = this; 22659 if (fragment === void 0) fragment = document.createDocumentFragment(); 22660 // Create fragment to add elements to 22661 var _a = this.config, shouldSortItems = _a.shouldSortItems, sorter = _a.sorter, removeItemButton = _a.removeItemButton; 22662 // If sorting is enabled, filter items 22663 if (shouldSortItems && !this._isSelectOneElement) items.sort(sorter); 22664 if (this._isTextElement) // Update the value of the hidden input 22665 this.passedElement.value = items.map(function(_a) { 22666 var value = _a.value; 22667 return value; 22668 }).join(this.config.delimiter); 22669 else // Update the options of the hidden input 22670 this.passedElement.options = items; 22671 var addItemToFragment = function(item) { 22672 // Create new list element 22673 var listItem = _this._getTemplate('item', item, removeItemButton); 22674 // Append it to list 22675 fragment.appendChild(listItem); 22676 }; 22677 // Add each list item to list
22678 items.forEach(addItemToFragment); 22679 return fragment; 22680 }; 22681 Choices.prototype._triggerChange = function(value) { 22682 if (value === undefined || value === null) return; 22683 this.passedElement.triggerEvent(constants_1.EVENTS.change, { 22684 value: value 22685 }); 22686 }; 22687 Choices.prototype._selectPlaceholderChoice = function(placeholderChoice) { 22688 this._addItem({ 22689 value: placeholderChoice.value, 22690 label: placeholderChoice.label, 22691 choiceId: placeholderChoice.id, 22692 groupId: placeholderChoice.groupId, 22693 placeholder: placeholderChoice.placeholder 22694 }); 22695 this._triggerChange(placeholderChoice.value); 22696 }; 22697 Choices.prototype._handleButtonAction = function(activeItems, element) { 22698 if (!activeItems || !element || !this.config.removeItems || !this.config.removeItemButton) return; 22699 var itemId = element.parentNode && element.parentNode.dataset.id; 22700 var itemToRemove = itemId && activeItems.find(function(item) { 22701 return item.id === parseInt(itemId, 10); 22702 }); 22703 if (!itemToRemove) return; 22704 // Remove item associated with button 22705 this._removeItem(itemToRemove); 22706 this._triggerChange(itemToRemove.value); 22707 if (this._isSelectOneElement && this._store.placeholderChoice) this._selectPlaceholderChoice(this._store.placeholderChoice); 22708 }; 22709 Choices.prototype._handleItemAction = function(activeItems, element, hasShiftKey) { 22710 var _this = this; 22711 if (hasShiftKey === void 0) hasShiftKey = false; 22712 if (!activeItems || !element || !this.config.removeItems || this._isSelectOneElement) return; 22713 var passedId = element.dataset.id; 22714 // We only want to select one item with a click 22715 // so we deselect any items that aren't the target 22716 // unless shift is being pressed 22717 activeItems.forEach(function(item) { 22718 if (item.id === parseInt("".concat(passedId), 10) && !item.highlighted) _this.highlightItem(item); 22719 else if (!hasShiftKey && item.highlighted) _this.unhighlightItem(item); 22720 }); 22721 // Focus input as without focus, a user cannot do anything with a 22722 // highlighted item 22723 this.input.focus(); 22724 }; 22725 Choices.prototype._handleChoiceAction = function(activeItems, element) { 22726 if (!activeItems || !element) return; 22727 // If we are clicking on an option 22728 var id = element.dataset.id; 22729 var choice = id && this._store.getChoiceById(id); 22730 if (!choice) return; 22731 var passedKeyCode = activeItems[0] && activeItems[0].keyCode ? activeItems[0].keyCode : undefined; 22732 var hasActiveDropdown = this.dropdown.isActive; 22733 // Update choice keyCode 22734 choice.keyCode = passedKeyCode; 22735 this.passedElement.triggerEvent(constants_1.EVENTS.choice, { 22736 choice: choice 22737 }); 22738 if (!choice.selected && !choice.disabled) { 22739 var canAddItem = this._canAddItem(activeItems, choice.value); 22740 if (canAddItem.response) { 22741 this._addItem({ 22742 value: choice.value, 22743 label: choice.label, 22744 choiceId: choice.id, 22745 groupId: choice.groupId, 22746 customProperties: choice.customProperties, 22747 placeholder: choice.placeholder, 22748 keyCode: choice.keyCode 22749 }); 22750 this._triggerChange(choice.value); 22751 } 22752 } 22753 this.clearInput(); 22754 // We want to close the dropdown if we are dealing with a single select box 22755 if (hasActiveDropdown && this._isSelectOneElement) { 22756 this.hideDropdown(true); 22757 this.containerOuter.focus(); 22758 } 22759 }; 22760 Choices.prototype._handleBackspace = function(activeItems) { 22761 if (!this.config.removeItems || !activeItems) return; 22762 var lastItem = activeItems[activeItems.length - 1]; 22763 var hasHighlightedItems = activeItems.some(function(item) { 22764 return item.highlighted; 22765 }); 22766 // If editing the last item is allowed and there are not other selected items, 22767 // we can edit the item value. Otherwise if we can remove items, remove all selected items 22768 if (this.config.editItems && !hasHighlightedItems && lastItem) { 22769 this.input.value = lastItem.value; 22770 this.input.setWidth(); 22771 this._removeItem(lastItem); 22772 this._triggerChange(lastItem.value); 22773 } else { 22774 if (!hasHighlightedItems) // Highlight last item if none already highlighted 22775 this.highlightItem(lastItem, false); 22776 this.removeHighlightedItems(true); 22777 } 22778 }; 22779 Choices.prototype._startLoading = function() { 22780 this._store.dispatch((0, misc_1.setIsLoading)(true)); 22781 }; 22782 Choices.prototype._stopLoading = function() { 22783 this._store.dispatch((0, misc_1.setIsLoading)(false)); 22784 }; 22785 Choices.prototype._handleLoadingState = function(setLoading) { 22786 if (setLoading === void 0) setLoading = true; 22787 var placeholderItem = this.itemList.getChild(".".concat(this.config.classNames.placeholder)); 22788 if (setLoading) { 22789 this.disable(); 22790 this.containerOuter.addLoadingState(); 22791 if (this._isSelectOneElement) { 22792 if (!placeholderItem) { 22793 placeholderItem = this._getTemplate('placeholder', this.config.loadingText); 22794 if (placeholderItem) this.itemList.append(placeholderItem); 22795 } else placeholderItem.innerHTML = this.config.loadingText; 22796 } else this.input.placeholder = this.config.loadingText; 22797 } else { 22798 this.enable(); 22799 this.containerOuter.removeLoadingState(); 22800 if (this._isSelectOneElement) { 22801 if (placeholderItem) placeholderItem.innerHTML = this._placeholderValue || ''; 22802 } else this.input.placeholder = this._placeholderValue || ''; 22803 } 22804 }; 22805 Choices.prototype._handleSearch = function(value) { 22806 if (!this.input.isFocussed) return; 22807 var choices = this._store.choices; 22808 var _a = this.config, searchFloor = _a.searchFloor, searchChoices = _a.searchChoices; 22809 var hasUnactiveChoices = choices.some(function(option) { 22810 return !option.active; 22811 }); 22812 // Check that we have a value to search and the input was an alphanumeric character 22813 if (value !== null && typeof value !== 'undefined' && value.length >= searchFloor) { 22814 var resultCount = searchChoices ? this._searchChoices(value) : 0; 22815 // Trigger search event 22816 this.passedElement.triggerEvent(constants_1.EVENTS.search, { 22817 value: value, 22818 resultCount: resultCount 22819 }); 22820 } else if (hasUnactiveChoices) { 22821 // Otherwise reset choices to active 22822 this._isSearching = false;
vendor: 11,313 bytes, lines 22823-22983
22823 this._store.dispatch((0, choices_1.activateChoices)(true)); 22824 } 22825 }; 22826 Choices.prototype._canAddItem = function(activeItems, value) { 22827 var canAddItem = true; 22828 var notice = typeof this.config.addItemText === 'function' ? this.config.addItemText(value) : this.config.addItemText; 22829 if (!this._isSelectOneElement) { 22830 var isDuplicateValue = (0, utils_1.existsInArray)(activeItems, value); 22831 if (this.config.maxItemCount > 0 && this.config.maxItemCount <= activeItems.length) { 22832 // If there is a max entry limit and we have reached that limit 22833 // don't update 22834 canAddItem = false; 22835 notice = typeof this.config.maxItemText === 'function' ? this.config.maxItemText(this.config.maxItemCount) : this.config.maxItemText; 22836 } 22837 if (!this.config.duplicateItemsAllowed && isDuplicateValue && canAddItem) { 22838 canAddItem = false; 22839 notice = typeof this.config.uniqueItemText === 'function' ? this.config.uniqueItemText(value) : this.config.uniqueItemText; 22840 } 22841 if (this._isTextElement && this.config.addItems && canAddItem && typeof this.config.addItemFilter === 'function' && !this.config.addItemFilter(value)) { 22842 canAddItem = false; 22843 notice = typeof this.config.customAddItemText === 'function' ? this.config.customAddItemText(value) : this.config.customAddItemText; 22844 } 22845 } 22846 return { 22847 response: canAddItem, 22848 notice: notice 22849 }; 22850 }; 22851 Choices.prototype._searchChoices = function(value) { 22852 var newValue = typeof value === 'string' ? value.trim() : value; 22853 var currentValue = typeof this._currentValue === 'string' ? this._currentValue.trim() : this._currentValue; 22854 if (newValue.length < 1 && newValue === "".concat(currentValue, " ")) return 0; 22855 // If new value matches the desired length and is not the same as the current value with a space 22856 var haystack = this._store.searchableChoices; 22857 var needle = newValue; 22858 var options = Object.assign(this.config.fuseOptions, { 22859 keys: __spreadArray([], this.config.searchFields, true), 22860 includeMatches: true 22861 }); 22862 var fuse = new fuse_js_1.default(haystack, options); 22863 var results = fuse.search(needle); // see https://github.com/krisk/Fuse/issues/303 22864 this._currentValue = newValue; 22865 this._highlightPosition = 0; 22866 this._isSearching = true; 22867 this._store.dispatch((0, choices_1.filterChoices)(results)); 22868 return results.length; 22869 }; 22870 Choices.prototype._addEventListeners = function() { 22871 var documentElement = document.documentElement; 22872 // capture events - can cancel event processing or propagation 22873 documentElement.addEventListener('touchend', this._onTouchEnd, true); 22874 this.containerOuter.element.addEventListener('keydown', this._onKeyDown, true); 22875 this.containerOuter.element.addEventListener('mousedown', this._onMouseDown, true); 22876 // passive events - doesn't call `preventDefault` or `stopPropagation` 22877 documentElement.addEventListener('click', this._onClick, { 22878 passive: true 22879 }); 22880 documentElement.addEventListener('touchmove', this._onTouchMove, { 22881 passive: true 22882 }); 22883 this.dropdown.element.addEventListener('mouseover', this._onMouseOver, { 22884 passive: true 22885 }); 22886 if (this._isSelectOneElement) { 22887 this.containerOuter.element.addEventListener('focus', this._onFocus, { 22888 passive: true 22889 }); 22890 this.containerOuter.element.addEventListener('blur', this._onBlur, { 22891 passive: true 22892 }); 22893 } 22894 this.input.element.addEventListener('keyup', this._onKeyUp, { 22895 passive: true 22896 }); 22897 this.input.element.addEventListener('focus', this._onFocus, { 22898 passive: true 22899 }); 22900 this.input.element.addEventListener('blur', this._onBlur, { 22901 passive: true 22902 }); 22903 if (this.input.element.form) this.input.element.form.addEventListener('reset', this._onFormReset, { 22904 passive: true 22905 }); 22906 this.input.addEventListeners(); 22907 }; 22908 Choices.prototype._removeEventListeners = function() { 22909 var documentElement = document.documentElement; 22910 documentElement.removeEventListener('touchend', this._onTouchEnd, true); 22911 this.containerOuter.element.removeEventListener('keydown', this._onKeyDown, true); 22912 this.containerOuter.element.removeEventListener('mousedown', this._onMouseDown, true); 22913 documentElement.removeEventListener('click', this._onClick); 22914 documentElement.removeEventListener('touchmove', this._onTouchMove); 22915 this.dropdown.element.removeEventListener('mouseover', this._onMouseOver); 22916 if (this._isSelectOneElement) { 22917 this.containerOuter.element.removeEventListener('focus', this._onFocus); 22918 this.containerOuter.element.removeEventListener('blur', this._onBlur); 22919 } 22920 this.input.element.removeEventListener('keyup', this._onKeyUp); 22921 this.input.element.removeEventListener('focus', this._onFocus); 22922 this.input.element.removeEventListener('blur', this._onBlur); 22923 if (this.input.element.form) this.input.element.form.removeEventListener('reset', this._onFormReset); 22924 this.input.removeEventListeners(); 22925 }; 22926 Choices.prototype._onKeyDown = function(event) { 22927 var keyCode = event.keyCode; 22928 var activeItems = this._store.activeItems; 22929 var hasFocusedInput = this.input.isFocussed; 22930 var hasActiveDropdown = this.dropdown.isActive; 22931 var hasItems = this.itemList.hasChildren(); 22932 var keyString = String.fromCharCode(keyCode); 22933 // eslint-disable-next-line no-control-regex 22934 var wasPrintableChar = /[^\x00-\x1F]/.test(keyString); 22935 var BACK_KEY = constants_1.KEY_CODES.BACK_KEY, DELETE_KEY = constants_1.KEY_CODES.DELETE_KEY, ENTER_KEY = constants_1.KEY_CODES.ENTER_KEY, A_KEY = constants_1.KEY_CODES.A_KEY, ESC_KEY = constants_1.KEY_CODES.ESC_KEY, UP_KEY = constants_1.KEY_CODES.UP_KEY, DOWN_KEY = constants_1.KEY_CODES.DOWN_KEY, PAGE_UP_KEY = constants_1.KEY_CODES.PAGE_UP_KEY, PAGE_DOWN_KEY = constants_1.KEY_CODES.PAGE_DOWN_KEY; 22936 if (!this._isTextElement && !hasActiveDropdown && wasPrintableChar) { 22937 this.showDropdown(); 22938 if (!this.input.isFocussed) /* 22939 We update the input value with the pressed key as 22940 the input was not focussed at the time of key press 22941 therefore does not have the value of the key. 22942 */ this.input.value += event.key.toLowerCase(); 22943 } 22944 switch(keyCode){ 22945 case A_KEY: 22946 return this._onSelectKey(event, hasItems); 22947 case ENTER_KEY: 22948 return this._onEnterKey(event, activeItems, hasActiveDropdown); 22949 case ESC_KEY: 22950 return this._onEscapeKey(hasActiveDropdown); 22951 case UP_KEY: 22952 case PAGE_UP_KEY: 22953 case DOWN_KEY: 22954 case PAGE_DOWN_KEY: 22955 return this._onDirectionKey(event, hasActiveDropdown); 22956 case DELETE_KEY: 22957 case BACK_KEY: 22958 return this._onDeleteKey(event, activeItems, hasFocusedInput); 22959 default: 22960 } 22961 }; 22962 Choices.prototype._onKeyUp = function(_a) { 22963 var target = _a.target, keyCode = _a.keyCode; 22964 var value = this.input.value; 22965 var activeItems = this._store.activeItems; 22966 var canAddItem = this._canAddItem(activeItems, value); 22967 var backKey = constants_1.KEY_CODES.BACK_KEY, deleteKey = constants_1.KEY_CODES.DELETE_KEY; 22968 // We are typing into a text input and have a value, we want to show a dropdown 22969 // notice. Otherwise hide the dropdown 22970 if (this._isTextElement) { 22971 var canShowDropdownNotice = canAddItem.notice && value; 22972 if (canShowDropdownNotice) { 22973 var dropdownItem = this._getTemplate('notice', canAddItem.notice); 22974 this.dropdown.element.innerHTML = dropdownItem.outerHTML; 22975 this.showDropdown(true); 22976 } else this.hideDropdown(true); 22977 } else { 22978 var wasRemovalKeyCode = keyCode === backKey || keyCode === deleteKey; 22979 var userHasRemovedValue = wasRemovalKeyCode && target && !target.value; 22980 var canReactivateChoices = !this._isTextElement && this._isSearching; 22981 var canSearch = this._canSearch && canAddItem.response; 22982 if (userHasRemovedValue && canReactivateChoices) { 22983 this._isSearching = false;
22984 this._store.dispatch((0, choices_1.activateChoices)(true)); 22985 } else if (canSearch) this._handleSearch(this.input.rawValue); 22986 } 22987 this._canSearch = this.config.searchEnabled; 22988 }; 22989 Choices.prototype._onSelectKey = function(event, hasItems) { 22990 var ctrlKey = event.ctrlKey, metaKey = event.metaKey; 22991 var hasCtrlDownKeyPressed = ctrlKey || metaKey; 22992 // If CTRL + A or CMD + A have been pressed and there are items to select 22993 if (hasCtrlDownKeyPressed && hasItems) { 22994 this._canSearch = false; 22995 var shouldHightlightAll = this.config.removeItems && !this.input.value && this.input.element === document.activeElement; 22996 if (shouldHightlightAll) this.highlightAll(); 22997 } 22998 }; 22999 Choices.prototype._onEnterKey = function(event, activeItems, hasActiveDropdown) { 23000 var target = event.target; 23001 var enterKey = constants_1.KEY_CODES.ENTER_KEY; 23002 var targetWasButton = target && target.hasAttribute('data-button'); 23003 if (this._isTextElement && target && target.value) { 23004 var value = this.input.value; 23005 var canAddItem = this._canAddItem(activeItems, value); 23006 if (canAddItem.response) { 23007 this.hideDropdown(true); 23008 this._addItem({ 23009 value: value 23010 }); 23011 this._triggerChange(value); 23012 this.clearInput(); 23013 } 23014 } 23015 if (targetWasButton) { 23016 this._handleButtonAction(activeItems, target); 23017 event.preventDefault(); 23018 } 23019 if (hasActiveDropdown) { 23020 var highlightedChoice = this.dropdown.getChild(".".concat(this.config.classNames.highlightedState)); 23021 if (highlightedChoice) { 23022 // add enter keyCode value 23023 if (activeItems[0]) activeItems[0].keyCode = enterKey; // eslint-disable-line no-param-reassign 23024 this._handleChoiceAction(activeItems, highlightedChoice); 23025 } 23026 event.preventDefault(); 23027 } else if (this._isSelectOneElement) { 23028 this.showDropdown(); 23029 event.preventDefault(); 23030 } 23031 }; 23032 Choices.prototype._onEscapeKey = function(hasActiveDropdown) { 23033 if (hasActiveDropdown) { 23034 this.hideDropdown(true); 23035 this.containerOuter.focus(); 23036 } 23037 }; 23038 Choices.prototype._onDirectionKey = function(event, hasActiveDropdown) { 23039 var keyCode = event.keyCode, metaKey = event.metaKey; 23040 var downKey = constants_1.KEY_CODES.DOWN_KEY, pageUpKey = constants_1.KEY_CODES.PAGE_UP_KEY, pageDownKey = constants_1.KEY_CODES.PAGE_DOWN_KEY; 23041 // If up or down key is pressed, traverse through options 23042 if (hasActiveDropdown || this._isSelectOneElement) { 23043 this.showDropdown(); 23044 this._canSearch = false; 23045 var directionInt = keyCode === downKey || keyCode === pageDownKey ? 1 : -1; 23046 var skipKey = metaKey || keyCode === pageDownKey || keyCode === pageUpKey; 23047 var selectableChoiceIdentifier = '[data-choice-selectable]'; 23048 var nextEl = void 0; 23049 if (skipKey) { 23050 if (directionInt > 0) nextEl = this.dropdown.element.querySelector("".concat(selectableChoiceIdentifier, ":last-of-type")); 23051 else nextEl = this.dropdown.element.querySelector(selectableChoiceIdentifier); 23052 } else { 23053 var currentEl = this.dropdown.element.querySelector(".".concat(this.config.classNames.highlightedState)); 23054 if (currentEl) nextEl = (0, utils_1.getAdjacentEl)(currentEl, selectableChoiceIdentifier, directionInt); 23055 else nextEl = this.dropdown.element.querySelector(selectableChoiceIdentifier); 23056 } 23057 if (nextEl) { 23058 // We prevent default to stop the cursor moving 23059 // when pressing the arrow 23060 if (!(0, utils_1.isScrolledIntoView)(nextEl, this.choiceList.element, directionInt)) this.choiceList.scrollToChildElement(nextEl, directionInt); 23061 this._highlightChoice(nextEl); 23062 } 23063 // Prevent default to maintain cursor position whilst 23064 // traversing dropdown options 23065 event.preventDefault(); 23066 } 23067 }; 23068 Choices.prototype._onDeleteKey = function(event, activeItems, hasFocusedInput) { 23069 var target = event.target; 23070 // If backspace or delete key is pressed and the input has no value 23071 if (!this._isSelectOneElement && !target.value && hasFocusedInput) { 23072 this._handleBackspace(activeItems); 23073 event.preventDefault(); 23074 } 23075 }; 23076 Choices.prototype._onTouchMove = function() { 23077 if (this._wasTap) this._wasTap = false;
23078 }; 23079 Choices.prototype._onTouchEnd = function(event) { 23080 var target = (event || event.touches[0]).target; 23081 var touchWasWithinContainer = this._wasTap && this.containerOuter.element.contains(target); 23082 if (touchWasWithinContainer) { 23083 var containerWasExactTarget = target === this.containerOuter.element || target === this.containerInner.element; 23084 if (containerWasExactTarget) { 23085 if (this._isTextElement) this.input.focus(); 23086 else if (this._isSelectMultipleElement) this.showDropdown(); 23087 } 23088 // Prevents focus event firing 23089 event.stopPropagation(); 23090 } 23091 this._wasTap = true; 23092 }; 23093 /** 23094 * Handles mousedown event in capture mode for containetOuter.element 23095 */ Choices.prototype._onMouseDown = function(event) { 23096 var target = event.target; 23097 if (!(target instanceof HTMLElement)) return; 23098 // If we have our mouse down on the scrollbar and are on IE11... 23099 if (IS_IE11 && this.choiceList.element.contains(target)) { 23100 // check if click was on a scrollbar area 23101 var firstChoice = this.choiceList.element.firstElementChild; 23102 var isOnScrollbar = this._direction === 'ltr' ? event.offsetX >= firstChoice.offsetWidth : event.offsetX < firstChoice.offsetLeft; 23103 this._isScrollingOnIe = isOnScrollbar; 23104 } 23105 if (target === this.input.element) return; 23106 var item = target.closest('[data-button],[data-item],[data-choice]'); 23107 if (item instanceof HTMLElement) { 23108 var hasShiftKey = event.shiftKey; 23109 var activeItems = this._store.activeItems; 23110 var dataset = item.dataset; 23111 if ('button' in dataset) this._handleButtonAction(activeItems, item); 23112 else if ('item' in dataset) this._handleItemAction(activeItems, item, hasShiftKey); 23113 else if ('choice' in dataset) this._handleChoiceAction(activeItems, item); 23114 } 23115 event.preventDefault(); 23116 }; 23117 /** 23118 * Handles mouseover event over this.dropdown 23119 * @param {MouseEvent} event 23120 */ Choices.prototype._onMouseOver = function(_a) { 23121 var target = _a.target; 23122 if (target instanceof HTMLElement && 'choice' in target.dataset) this._highlightChoice(target); 23123 }; 23124 Choices.prototype._onClick = function(_a) { 23125 var target = _a.target; 23126 var clickWasWithinContainer = this.containerOuter.element.contains(target); 23127 if (clickWasWithinContainer) { 23128 if (!this.dropdown.isActive && !this.containerOuter.isDisabled) { 23129 if (this._isTextElement) { 23130 if (document.activeElement !== this.input.element) this.input.focus(); 23131 } else { 23132 this.showDropdown(); 23133 this.containerOuter.focus(); 23134 } 23135 } else if (this._isSelectOneElement && target !== this.input.element && !this.dropdown.element.contains(target)) this.hideDropdown(); 23136 } else { 23137 var hasHighlightedItems = this._store.highlightedActiveItems.length > 0; 23138 if (hasHighlightedItems) this.unhighlightAll(); 23139 this.containerOuter.removeFocusState(); 23140 this.hideDropdown(true); 23141 } 23142 }; 23143 Choices.prototype._onFocus = function(_a) { 23144 var _b; 23145 var _this = this; 23146 var target = _a.target; 23147 var focusWasWithinContainer = target && this.containerOuter.element.contains(target); 23148 if (!focusWasWithinContainer) return; 23149 var focusActions = (_b = {}, _b[constants_1.TEXT_TYPE] = function() { 23150 if (target === _this.input.element) _this.containerOuter.addFocusState(); 23151 }, _b[constants_1.SELECT_ONE_TYPE] = function() { 23152 _this.containerOuter.addFocusState(); 23153 if (target === _this.input.element) _this.showDropdown(true); 23154 }, _b[constants_1.SELECT_MULTIPLE_TYPE] = function() { 23155 if (target === _this.input.element) { 23156 _this.showDropdown(true); 23157 // If element is a select box, the focused element is the container and the dropdown 23158 // isn't already open, focus and show dropdown 23159 _this.containerOuter.addFocusState(); 23160 } 23161 }, _b); 23162 focusActions[this.passedElement.element.type](); 23163 }; 23164 Choices.prototype._onBlur = function(_a) { 23165 var _b; 23166 var _this = this; 23167 var target = _a.target; 23168 var blurWasWithinContainer = target && this.containerOuter.element.contains(target); 23169 if (blurWasWithinContainer && !this._isScrollingOnIe) { 23170 var activeItems = this._store.activeItems; 23171 var hasHighlightedItems_1 = activeItems.some(function(item) { 23172 return item.highlighted; 23173 }); 23174 var blurActions = (_b = {}, _b[constants_1.TEXT_TYPE] = function() { 23175 if (target === _this.input.element) { 23176 _this.containerOuter.removeFocusState(); 23177 if (hasHighlightedItems_1) _this.unhighlightAll(); 23178 _this.hideDropdown(true); 23179 } 23180 }, _b[constants_1.SELECT_ONE_TYPE] = function() { 23181 _this.containerOuter.removeFocusState(); 23182 if (target === _this.input.element || target === _this.containerOuter.element && !_this._canSearch) _this.hideDropdown(true); 23183 }, _b[constants_1.SELECT_MULTIPLE_TYPE] = function() { 23184 if (target === _this.input.element) { 23185 _this.containerOuter.removeFocusState(); 23186 _this.hideDropdown(true); 23187 if (hasHighlightedItems_1) _this.unhighlightAll(); 23188 } 23189 }, _b); 23190 blurActions[this.passedElement.element.type](); 23191 } else { 23192 // On IE11, clicking the scollbar blurs our input and thus 23193 // closes the dropdown. To stop this, we refocus our input
23194 // if we know we are on IE *and* are scrolling. 23195 this._isScrollingOnIe = false; 23196 this.input.element.focus(); 23197 } 23198 }; 23199 Choices.prototype._onFormReset = function() { 23200 this._store.dispatch((0, misc_1.resetTo)(this._initialState)); 23201 }; 23202 Choices.prototype._highlightChoice = function(el) { 23203 var _this = this; 23204 if (el === void 0) el = null; 23205 var choices = Array.from(this.dropdown.element.querySelectorAll('[data-choice-selectable]')); 23206 if (!choices.length) return; 23207 var passedEl = el; 23208 var highlightedChoices = Array.from(this.dropdown.element.querySelectorAll(".".concat(this.config.classNames.highlightedState))); 23209 // Remove any highlighted choices 23210 highlightedChoices.forEach(function(choice) { 23211 choice.classList.remove(_this.config.classNames.highlightedState); 23212 choice.setAttribute('aria-selected', 'false'); 23213 }); 23214 if (passedEl) this._highlightPosition = choices.indexOf(passedEl); 23215 else { 23216 // Highlight choice based on last known highlight location 23217 if (choices.length > this._highlightPosition) // If we have an option to highlight 23218 passedEl = choices[this._highlightPosition]; 23219 else // Otherwise highlight the option before 23220 passedEl = choices[choices.length - 1]; 23221 if (!passedEl) passedEl = choices[0]; 23222 } 23223 passedEl.classList.add(this.config.classNames.highlightedState); 23224 passedEl.setAttribute('aria-selected', 'true'); 23225 this.passedElement.triggerEvent(constants_1.EVENTS.highlightChoice, { 23226 el: passedEl 23227 }); 23228 if (this.dropdown.isActive) { 23229 // IE11 ignores aria-label and blocks virtual keyboard 23230 // if aria-activedescendant is set without a dropdown 23231 this.input.setActiveDescendant(passedEl.id); 23232 this.containerOuter.setActiveDescendant(passedEl.id); 23233 } 23234 }; 23235 Choices.prototype._addItem = function(_a) { 23236 var value = _a.value, _b = _a.label, label = _b === void 0 ? null : _b, _c = _a.choiceId, choiceId = _c === void 0 ? -1 : _c, _d = _a.groupId, groupId = _d === void 0 ? -1 : _d, _e = _a.customProperties, customProperties = _e === void 0 ? {} : _e, _f = _a.placeholder, placeholder = _f === void 0 ? false : _f, _g = _a.keyCode, keyCode = _g === void 0 ? -1 : _g; 23237 var passedValue = typeof value === 'string' ? value.trim() : value; 23238 var items = this._store.items; 23239 var passedLabel = label || passedValue; 23240 var passedOptionId = choiceId || -1; 23241 var group = groupId >= 0 ? this._store.getGroupById(groupId) : null; 23242 var id = items ? items.length + 1 : 1; 23243 // If a prepended value has been passed, prepend it 23244 if (this.config.prependValue) passedValue = this.config.prependValue + passedValue.toString(); 23245 // If an appended value has been passed, append it 23246 if (this.config.appendValue) passedValue += this.config.appendValue.toString(); 23247 this._store.dispatch((0, items_1.addItem)({ 23248 value: passedValue, 23249 label: passedLabel, 23250 id: id, 23251 choiceId: passedOptionId, 23252 groupId: groupId, 23253 customProperties: customProperties, 23254 placeholder: placeholder, 23255 keyCode: keyCode 23256 })); 23257 if (this._isSelectOneElement) this.removeActiveItems(id); 23258 // Trigger change event 23259 this.passedElement.triggerEvent(constants_1.EVENTS.addItem, { 23260 id: id, 23261 value: passedValue, 23262 label: passedLabel, 23263 customProperties: customProperties, 23264 groupValue: group && group.value ? group.value : null, 23265 keyCode: keyCode 23266 }); 23267 }; 23268 Choices.prototype._removeItem = function(item) { 23269 var id = item.id, value = item.value, label = item.label, customProperties = item.customProperties, choiceId = item.choiceId, groupId = item.groupId; 23270 var group = groupId && groupId >= 0 ? this._store.getGroupById(groupId) : null; 23271 if (!id || !choiceId) return; 23272 this._store.dispatch((0, items_1.removeItem)(id, choiceId)); 23273 this.passedElement.triggerEvent(constants_1.EVENTS.removeItem, { 23274 id: id, 23275 value: value, 23276 label: label, 23277 customProperties: customProperties, 23278 groupValue: group && group.value ? group.value : null 23279 }); 23280 }; 23281 Choices.prototype._addChoice = function(_a) { 23282 var value = _a.value, _b = _a.label, label = _b === void 0 ? null : _b, _c = _a.isSelected, isSelected = _c === void 0 ? false : _c, _d = _a.isDisabled, isDisabled = _d === void 0 ? false : _d, _e = _a.groupId, groupId = _e === void 0 ? -1 : _e, _f = _a.customProperties, customProperties = _f === void 0 ? {}
23282 : _f, _g = _a.placeholder, placeholder = _g === void 0 ? false : _g, _h = _a.keyCode, keyCode = _h === void 0 ? -1 : _h; 23283 if (typeof value === 'undefined' || value === null) return; 23284 // Generate unique id 23285 var choices = this._store.choices; 23286 var choiceLabel = label || value; 23287 var choiceId = choices ? choices.length + 1 : 1; 23288 var choiceElementId = "".concat(this._baseId, "-").concat(this._idNames.itemChoice, "-").concat(choiceId); 23289 this._store.dispatch((0, choices_1.addChoice)({ 23290 id: choiceId, 23291 groupId: groupId, 23292 elementId: choiceElementId, 23293 value: value, 23294 label: choiceLabel, 23295 disabled: isDisabled, 23296 customProperties: customProperties, 23297 placeholder: placeholder, 23298 keyCode: keyCode 23299 })); 23300 if (isSelected) this._addItem({ 23301 value: value, 23302 label: choiceLabel, 23303 choiceId: choiceId, 23304 customProperties: customProperties, 23305 placeholder: placeholder, 23306 keyCode: keyCode 23307 }); 23308 }; 23309 Choices.prototype._addGroup = function(_a) { 23310 var _this = this; 23311 var group = _a.group, id = _a.id, _b = _a.valueKey, valueKey = _b === void 0 ? 'value' : _b, _c = _a.labelKey, labelKey = _c === void 0 ? 'label' : _c; 23312 var groupChoices = (0, utils_1.isType)('Object', group) ? group.choices : Array.from(group.getElementsByTagName('OPTION')); 23313 var groupId = id || Math.floor(new Date().valueOf() * Math.random()); 23314 var isDisabled = group.disabled ? group.disabled : false; 23315 if (groupChoices) { 23316 this._store.dispatch((0, groups_1.addGroup)({ 23317 value: group.label, 23318 id: groupId, 23319 active: true, 23320 disabled: isDisabled 23321 })); 23322 var addGroupChoices = function(choice) { 23323 var isOptDisabled = choice.disabled || choice.parentNode && choice.parentNode.disabled; 23324 _this._addChoice({ 23325 value: choice[valueKey], 23326 label: (0, utils_1.isType)('Object', choice) ? choice[labelKey] : choice.innerHTML, 23327 isSelected: choice.selected, 23328 isDisabled: isOptDisabled, 23329 groupId: groupId, 23330 customProperties: choice.customProperties, 23331 placeholder: choice.placeholder 23332 }); 23333 }; 23334 groupChoices.forEach(addGroupChoices); 23335 } else this._store.dispatch((0, groups_1.addGroup)({ 23336 value: group.label, 23337 id: group.id, 23338 active: false, 23339 disabled: group.disabled 23340 })); 23341 }; 23342 Choices.prototype._getTemplate = function(template) { 23343 var _a; 23344 var args = []; 23345 for(var _i = 1; _i < arguments.length; _i++)args[_i - 1] = arguments[_i]; 23346 return (_a = this._templates[template]).call.apply(_a, __spreadArray([ 23347 this, 23348 this.config 23349 ], args, false)); 23350 }; 23351 Choices.prototype._createTemplates = function() { 23352 var callbackOnCreateTemplates = this.config.callbackOnCreateTemplates; 23353 var userTemplates = {}; 23354 if (callbackOnCreateTemplates && typeof callbackOnCreateTemplates === 'function') userTemplates = callbackOnCreateTemplates.call(this, utils_1.strToEl); 23355 this._templates = (0, deepmerge_1.default)(templates_1.default, userTemplates); 23356 }; 23357 Choices.prototype._createElements = function() { 23358 this.containerOuter = new components_1.Container({ 23359 element: this._getTemplate('containerOuter', this._direction, this._isSelectElement, this._isSelectOneElement, this.config.searchEnabled, this.passedElement.element.type, this.config.labelId), 23360 classNames: this.config.classNames, 23361 type: this.passedElement.element.type, 23362 position: this.config.position 23363 }); 23364 this.containerInner = new components_1.Container({ 23365 element: this._getTemplate('containerInner'), 23366 classNames: this.config.classNames, 23367 type: this.passedElement.element.type, 23368 position: this.config.position 23369 }); 23370 this.input = new components_1.Input({ 23371 element: this._getTemplate('input', this._placeholderValue), 23372 classNames: this.config.classNames, 23373 type: this.passedElement.element.type, 23374 preventPaste: !this.config.paste 23375 }); 23376 this.choiceList = new components_1.List({ 23377 element: this._getTemplate('choiceList', this._isSelectOneElement) 23378 }); 23379 this.itemList = new components_1.List({ 23380 element: this._getTemplate('itemList', this._isSelectOneElement) 23381 }); 23382 this.dropdown = new components_1.Dropdown({ 23383 element: this._getTemplate('dropdown'), 23384 classNames: this.config.classNames, 23385 type: this.passedElement.element.type 23386 }); 23387 }; 23388 Choices.prototype._createStructure = function() { 23389 // Hide original element 23390 this.passedElement.conceal(); 23391 // Wrap input in container preserving DOM ordering 23392 this.containerInner.wrap(this.passedElement.element); 23393 // Wrapper inner container with outer container 23394 this.containerOuter.wrap(this.containerInner.element); 23395 if (this._isSelectOneElement) this.input.placeholder = this.config.searchPlaceholderValue || ''; 23396 else if (this._placeholderValue) { 23397 this.input.placeholder = this._placeholderValue; 23398 this.input.setWidth(); 23399 } 23400 this.containerOuter.element.appendChild(this.containerInner.element); 23401 this.containerOuter.element.appendChild(this.dropdown.element); 23402 this.containerInner.element.appendChild(this.itemList.element); 23403 if (!this._isTextElement) this.dropdown.element.appendChild(this.choiceList.element); 23404 if (!this._isSelectOneElement) this.containerInner.element.appendChild(this.input.element); 23405 else if (this.config.searchEnabled) this.dropdown.element.insertBefore(this.input.element, this.dropdown.element.firstChild); 23406 if (this._isSelectElement) { 23407 this._highlightPosition = 0; 23408 this._isSearching = false;
23409 this._startLoading(); 23410 if (this._presetGroups.length) this._addPredefinedGroups(this._presetGroups); 23411 else this._addPredefinedChoices(this._presetChoices); 23412 this._stopLoading(); 23413 } 23414 if (this._isTextElement) this._addPredefinedItems(this._presetItems); 23415 }; 23416 Choices.prototype._addPredefinedGroups = function(groups) { 23417 var _this = this; 23418 // If we have a placeholder option 23419 var placeholderChoice = this.passedElement.placeholderOption; 23420 if (placeholderChoice && placeholderChoice.parentNode && placeholderChoice.parentNode.tagName === 'SELECT') this._addChoice({ 23421 value: placeholderChoice.value, 23422 label: placeholderChoice.innerHTML, 23423 isSelected: placeholderChoice.selected, 23424 isDisabled: placeholderChoice.disabled, 23425 placeholder: true 23426 }); 23427 groups.forEach(function(group) { 23428 return _this._addGroup({ 23429 group: group, 23430 id: group.id || null 23431 }); 23432 }); 23433 }; 23434 Choices.prototype._addPredefinedChoices = function(choices) { 23435 var _this = this; 23436 // If sorting is enabled or the user is searching, filter choices 23437 if (this.config.shouldSort) choices.sort(this.config.sorter); 23438 var hasSelectedChoice = choices.some(function(choice) { 23439 return choice.selected; 23440 }); 23441 var firstEnabledChoiceIndex = choices.findIndex(function(choice) { 23442 return choice.disabled === undefined || !choice.disabled; 23443 }); 23444 choices.forEach(function(choice, index) { 23445 var _a = choice.value, value = _a === void 0 ? '' : _a, label = choice.label, customProperties = choice.customProperties, placeholder = choice.placeholder; 23446 if (_this._isSelectElement) { 23447 // If the choice is actually a group 23448 if (choice.choices) _this._addGroup({ 23449 group: choice, 23450 id: choice.id || null 23451 }); 23452 else { 23453 /** 23454 * If there is a selected choice already or the choice is not the first in 23455 * the array, add each choice normally. 23456 * 23457 * Otherwise we pre-select the first enabled choice in the array ("select-one" only) 23458 */ var shouldPreselect = _this._isSelectOneElement && !hasSelectedChoice && index === firstEnabledChoiceIndex; 23459 var isSelected = shouldPreselect ? true : choice.selected; 23460 var isDisabled = choice.disabled; 23461 _this._addChoice({ 23462 value: value, 23463 label: label, 23464 isSelected: !!isSelected, 23465 isDisabled: !!isDisabled, 23466 placeholder: !!placeholder, 23467 customProperties: customProperties 23468 }); 23469 } 23470 } else _this._addChoice({ 23471 value: value, 23472 label: label, 23473 isSelected: !!choice.selected, 23474 isDisabled: !!choice.disabled,
23475 placeholder: !!choice.placeholder, 23476 customProperties: customProperties 23477 }); 23478 }); 23479 }; 23480 Choices.prototype._addPredefinedItems = function(items) { 23481 var _this = this; 23482 items.forEach(function(item) { 23483 if (typeof item === 'object' && item.value) _this._addItem({ 23484 value: item.value, 23485 label: item.label, 23486 choiceId: item.id, 23487 customProperties: item.customProperties, 23488 placeholder: item.placeholder 23489 }); 23490 if (typeof item === 'string') _this._addItem({ 23491 value: item 23492 }); 23493 }); 23494 }; 23495 Choices.prototype._setChoiceOrItem = function(item) { 23496 var _this = this; 23497 var itemType = (0, utils_1.getType)(item).toLowerCase(); 23498 var handleType = { 23499 object: function() { 23500 if (!item.value) return; 23501 // If we are dealing with a select input, we need to create an option first 23502 // that is then selected. For text inputs we can just add items normally. 23503 if (!_this._isTextElement) _this._addChoice({ 23504 value: item.value, 23505 label: item.label, 23506 isSelected: true, 23507 isDisabled: false, 23508 customProperties: item.customProperties, 23509 placeholder: item.placeholder 23510 }); 23511 else _this._addItem({ 23512 value: item.value, 23513 label: item.label, 23514 choiceId: item.id, 23515 customProperties: item.customProperties, 23516 placeholder: item.placeholder 23517 }); 23518 }, 23519 string: function() { 23520 if (!_this._isTextElement) _this._addChoice({ 23521 value: item, 23522 label: item, 23523 isSelected: true, 23524 isDisabled: false 23525 }); 23526 else _this._addItem({ 23527 value: item 23528 }); 23529 } 23530 }; 23531 handleType[itemType](); 23532 }; 23533 Choices.prototype._findAndSelectChoiceByValue = function(value) { 23534 var _this = this; 23535 var choices = this._store.choices; 23536 // Check 'value' property exists and the choice isn't already selected 23537 var foundChoice = choices.find(function(choice) { 23538 return _this.config.valueComparer(choice.value, value); 23539 }); 23540 if (foundChoice && !foundChoice.selected) this._addItem({ 23541 value: foundChoice.value, 23542 label: foundChoice.label, 23543 choiceId: foundChoice.id, 23544 groupId: foundChoice.groupId, 23545 customProperties: foundChoice.customProperties, 23546 placeholder: foundChoice.placeholder, 23547 keyCode: foundChoice.keyCode 23548 }); 23549 }; 23550 Choices.prototype._generatePlaceholderValue = function() { 23551 if (this._isSelectElement && this.passedElement.placeholderOption) { 23552 var placeholderOption = this.passedElement.placeholderOption; 23553 return placeholderOption ? placeholderOption.text : null; 23554 } 23555 var _a = this.config, placeholder = _a.placeholder, placeholderValue = _a.placeholderValue; 23556 var dataset = this.passedElement.element.dataset; 23557 if (placeholder) { 23558 if (placeholderValue) return placeholderValue; 23559 if (dataset.placeholder) return dataset.placeholder; 23560 } 23561 return null; 23562 }; 23563 return Choices; 23564 }(); 23565 exports["default"] = Choices; 23566 /***/ }, 23567 /***/ 613: /***/ function(__unused_webpack_module, exports, __webpack_require__) { 23568 Object.defineProperty(exports, "__esModule", { 23569 value: true 23570 }); 23571 var utils_1 = __webpack_require__(799); 23572 var constants_1 = __webpack_require__(883); 23573 var Container = /** @class */ function() { 23574 function Container(_a) { 23575 var element = _a.element, type = _a.type, classNames = _a.classNames, position = _a.position; 23576 this.element = element; 23577 this.classNames = classNames; 23578 this.type = type; 23579 this.position = position; 23580 this.isOpen = false;
23581 this.isFlipped = false; 23582 this.isFocussed = false; 23583 this.isDisabled = false; 23584 this.isLoading = false; 23585 this._onFocus = this._onFocus.bind(this); 23586 this._onBlur = this._onBlur.bind(this); 23587 } 23588 Container.prototype.addEventListeners = function() { 23589 this.element.addEventListener('focus', this._onFocus); 23590 this.element.addEventListener('blur', this._onBlur); 23591 }; 23592 Container.prototype.removeEventListeners = function() { 23593 this.element.removeEventListener('focus', this._onFocus); 23594 this.element.removeEventListener('blur', this._onBlur); 23595 }; 23596 /** 23597 * Determine whether container should be flipped based on passed 23598 * dropdown position 23599 */ Container.prototype.shouldFlip = function(dropdownPos) { 23600 if (typeof dropdownPos !== 'number') return false; 23601 // If flip is enabled and the dropdown bottom position is 23602 // greater than the window height flip the dropdown. 23603 var shouldFlip = false; 23604 if (this.position === 'auto') shouldFlip = !window.matchMedia("(min-height: ".concat(dropdownPos + 1, "px)")).matches; 23605 else if (this.position === 'top') shouldFlip = true; 23606 return shouldFlip; 23607 }; 23608 Container.prototype.setActiveDescendant = function(activeDescendantID) { 23609 this.element.setAttribute('aria-activedescendant', activeDescendantID); 23610 }; 23611 Container.prototype.removeActiveDescendant = function() { 23612 this.element.removeAttribute('aria-activedescendant'); 23613 }; 23614 Container.prototype.open = function(dropdownPos) { 23615 this.element.classList.add(this.classNames.openState); 23616 this.element.setAttribute('aria-expanded', 'true'); 23617 this.isOpen = true; 23618 if (this.shouldFlip(dropdownPos)) { 23619 this.element.classList.add(this.classNames.flippedState); 23620 this.isFlipped = true; 23621 } 23622 }; 23623 Container.prototype.close = function() { 23624 this.element.classList.remove(this.classNames.openState); 23625 this.element.setAttribute('aria-expanded', 'false'); 23626 this.removeActiveDescendant(); 23627 this.isOpen = false; 23628 // A dropdown flips if it does not have space within the page 23629 if (this.isFlipped) { 23630 this.element.classList.remove(this.classNames.flippedState); 23631 this.isFlipped = false; 23632 } 23633 }; 23634 Container.prototype.focus = function() { 23635 if (!this.isFocussed) this.element.focus(); 23636 }; 23637 Container.prototype.addFocusState = function() { 23638 this.element.classList.add(this.classNames.focusState); 23639 }; 23640 Container.prototype.removeFocusState = function() { 23641 this.element.classList.remove(this.classNames.focusState); 23642 }; 23643 Container.prototype.enable = function() { 23644 this.element.classList.remove(this.classNames.disabledState); 23645 this.element.removeAttribute('aria-disabled'); 23646 if (this.type === constants_1.SELECT_ONE_TYPE) this.element.setAttribute('tabindex', '0'); 23647 this.isDisabled = false; 23648 }; 23649 Container.prototype.disable = function() { 23650 this.element.classList.add(this.classNames.disabledState); 23651 this.element.setAttribute('aria-disabled', 'true');
vendor: 8,749 bytes, lines 23652-23817
23652 if (this.type === constants_1.SELECT_ONE_TYPE) this.element.setAttribute('tabindex', '-1'); 23653 this.isDisabled = true; 23654 }; 23655 Container.prototype.wrap = function(element) { 23656 (0, utils_1.wrap)(element, this.element); 23657 }; 23658 Container.prototype.unwrap = function(element) { 23659 if (this.element.parentNode) { 23660 // Move passed element outside this element 23661 this.element.parentNode.insertBefore(element, this.element); 23662 // Remove this element 23663 this.element.parentNode.removeChild(this.element); 23664 } 23665 }; 23666 Container.prototype.addLoadingState = function() { 23667 this.element.classList.add(this.classNames.loadingState); 23668 this.element.setAttribute('aria-busy', 'true'); 23669 this.isLoading = true; 23670 }; 23671 Container.prototype.removeLoadingState = function() { 23672 this.element.classList.remove(this.classNames.loadingState); 23673 this.element.removeAttribute('aria-busy'); 23674 this.isLoading = false; 23675 }; 23676 Container.prototype._onFocus = function() { 23677 this.isFocussed = true; 23678 }; 23679 Container.prototype._onBlur = function() { 23680 this.isFocussed = false; 23681 }; 23682 return Container; 23683 }(); 23684 exports["default"] = Container; 23685 /***/ }, 23686 /***/ 217: /***/ function(__unused_webpack_module, exports) { 23687 Object.defineProperty(exports, "__esModule", { 23688 value: true 23689 }); 23690 var Dropdown = /** @class */ function() { 23691 function Dropdown(_a) { 23692 var element = _a.element, type = _a.type, classNames = _a.classNames; 23693 this.element = element; 23694 this.classNames = classNames; 23695 this.type = type; 23696 this.isActive = false; 23697 } 23698 Object.defineProperty(Dropdown.prototype, "distanceFromTopWindow", { 23699 /** 23700 * Bottom position of dropdown in viewport coordinates 23701 */ get: function() { 23702 return this.element.getBoundingClientRect().bottom; 23703 }, 23704 enumerable: false, 23705 configurable: true 23706 }); 23707 Dropdown.prototype.getChild = function(selector) { 23708 return this.element.querySelector(selector); 23709 }; 23710 /** 23711 * Show dropdown to user by adding active state class 23712 */ Dropdown.prototype.show = function() { 23713 this.element.classList.add(this.classNames.activeState); 23714 this.element.setAttribute('aria-expanded', 'true'); 23715 this.isActive = true; 23716 return this; 23717 }; 23718 /** 23719 * Hide dropdown from user 23720 */ Dropdown.prototype.hide = function() { 23721 this.element.classList.remove(this.classNames.activeState); 23722 this.element.setAttribute('aria-expanded', 'false'); 23723 this.isActive = false; 23724 return this; 23725 }; 23726 return Dropdown; 23727 }(); 23728 exports["default"] = Dropdown; 23729 /***/ }, 23730 /***/ 520: /***/ function(__unused_webpack_module, exports, __webpack_require__) { 23731 var __importDefault = this && this.__importDefault || function(mod) { 23732 return mod && mod.__esModule ? mod : { 23733 "default": mod 23734 }; 23735 }; 23736 Object.defineProperty(exports, "__esModule", { 23737 value: true 23738 }); 23739 exports.WrappedSelect = exports.WrappedInput = exports.List = exports.Input = exports.Container = exports.Dropdown = void 0; 23740 var dropdown_1 = __importDefault(__webpack_require__(217)); 23741 exports.Dropdown = dropdown_1.default; 23742 var container_1 = __importDefault(__webpack_require__(613)); 23743 exports.Container = container_1.default; 23744 var input_1 = __importDefault(__webpack_require__(11)); 23745 exports.Input = input_1.default; 23746 var list_1 = __importDefault(__webpack_require__(624)); 23747 exports.List = list_1.default; 23748 var wrapped_input_1 = __importDefault(__webpack_require__(541)); 23749 exports.WrappedInput = wrapped_input_1.default; 23750 var wrapped_select_1 = __importDefault(__webpack_require__(982)); 23751 exports.WrappedSelect = wrapped_select_1.default; 23752 /***/ }, 23753 /***/ 11: /***/ function(__unused_webpack_module, exports, __webpack_require__) { 23754 Object.defineProperty(exports, "__esModule", { 23755 value: true 23756 }); 23757 var utils_1 = __webpack_require__(799); 23758 var constants_1 = __webpack_require__(883); 23759 var Input = /** @class */ function() { 23760 function Input(_a) { 23761 var element = _a.element, type = _a.type, classNames = _a.classNames, preventPaste = _a.preventPaste; 23762 this.element = element; 23763 this.type = type; 23764 this.classNames = classNames; 23765 this.preventPaste = preventPaste; 23766 this.isFocussed = this.element.isEqualNode(document.activeElement); 23767 this.isDisabled = element.disabled; 23768 this._onPaste = this._onPaste.bind(this); 23769 this._onInput = this._onInput.bind(this); 23770 this._onFocus = this._onFocus.bind(this); 23771 this._onBlur = this._onBlur.bind(this); 23772 } 23773 Object.defineProperty(Input.prototype, "placeholder", { 23774 set: function(placeholder) { 23775 this.element.placeholder = placeholder; 23776 }, 23777 enumerable: false, 23778 configurable: true 23779 }); 23780 Object.defineProperty(Input.prototype, "value", { 23781 get: function() { 23782 return (0, utils_1.sanitise)(this.element.value); 23783 }, 23784 set: function(value) { 23785 this.element.value = value; 23786 }, 23787 enumerable: false, 23788 configurable: true 23789 }); 23790 Object.defineProperty(Input.prototype, "rawValue", { 23791 get: function() { 23792 return this.element.value; 23793 }, 23794 enumerable: false, 23795 configurable: true 23796 }); 23797 Input.prototype.addEventListeners = function() { 23798 this.element.addEventListener('paste', this._onPaste); 23799 this.element.addEventListener('input', this._onInput, { 23800 passive: true 23801 }); 23802 this.element.addEventListener('focus', this._onFocus, { 23803 passive: true 23804 }); 23805 this.element.addEventListener('blur', this._onBlur, { 23806 passive: true 23807 }); 23808 }; 23809 Input.prototype.removeEventListeners = function() { 23810 this.element.removeEventListener('input', this._onInput); 23811 this.element.removeEventListener('paste', this._onPaste); 23812 this.element.removeEventListener('focus', this._onFocus); 23813 this.element.removeEventListener('blur', this._onBlur); 23814 }; 23815 Input.prototype.enable = function() { 23816 this.element.removeAttribute('disabled'); 23817 this.isDisabled = false;
23818 }; 23819 Input.prototype.disable = function() { 23820 this.element.setAttribute('disabled', ''); 23821 this.isDisabled = true; 23822 }; 23823 Input.prototype.focus = function() { 23824 if (!this.isFocussed) this.element.focus(); 23825 }; 23826 Input.prototype.blur = function() { 23827 if (this.isFocussed) this.element.blur(); 23828 }; 23829 Input.prototype.clear = function(setWidth) { 23830 if (setWidth === void 0) setWidth = true; 23831 if (this.element.value) this.element.value = ''; 23832 if (setWidth) this.setWidth(); 23833 return this; 23834 }; 23835 /** 23836 * Set the correct input width based on placeholder 23837 * value or input value 23838 */ Input.prototype.setWidth = function() { 23839 // Resize input to contents or placeholder 23840 var _a = this.element, style = _a.style, value = _a.value, placeholder = _a.placeholder; 23841 style.minWidth = "".concat(placeholder.length + 1, "ch"); 23842 style.width = "".concat(value.length + 1, "ch"); 23843 }; 23844 Input.prototype.setActiveDescendant = function(activeDescendantID) { 23845 this.element.setAttribute('aria-activedescendant', activeDescendantID); 23846 }; 23847 Input.prototype.removeActiveDescendant = function() { 23848 this.element.removeAttribute('aria-activedescendant'); 23849 }; 23850 Input.prototype._onInput = function() { 23851 if (this.type !== constants_1.SELECT_ONE_TYPE) this.setWidth(); 23852 }; 23853 Input.prototype._onPaste = function(event) { 23854 if (this.preventPaste) event.preventDefault(); 23855 }; 23856 Input.prototype._onFocus = function() { 23857 this.isFocussed = true; 23858 }; 23859 Input.prototype._onBlur = function() { 23860 this.isFocussed = false; 23861 }; 23862 return Input; 23863 }(); 23864 exports["default"] = Input; 23865 /***/ }, 23866 /***/ 624: /***/ function(__unused_webpack_module, exports, __webpack_require__) { 23867 Object.defineProperty(exports, "__esModule", { 23868 value: true 23869 }); 23870 var constants_1 = __webpack_require__(883); 23871 var List = /** @class */ function() { 23872 function List(_a) { 23873 var element = _a.element; 23874 this.element = element; 23875 this.scrollPos = this.element.scrollTop; 23876 this.height = this.element.offsetHeight; 23877 } 23878 List.prototype.clear = function() { 23879 this.element.innerHTML = ''; 23880 }; 23881 List.prototype.append = function(node) { 23882 this.element.appendChild(node); 23883 }; 23884 List.prototype.getChild = function(selector) { 23885 return this.element.querySelector(selector); 23886 }; 23887 List.prototype.hasChildren = function() { 23888 return this.element.hasChildNodes(); 23889 }; 23890 List.prototype.scrollToTop = function() { 23891 this.element.scrollTop = 0; 23892 }; 23893 List.prototype.scrollToChildElement = function(element, direction) { 23894 var _this = this; 23895 if (!element) return; 23896 var listHeight = this.element.offsetHeight; 23897 // Scroll position of dropdown 23898 var listScrollPosition = this.element.scrollTop + listHeight; 23899 var elementHeight = element.offsetHeight; 23900 // Distance from bottom of element to top of parent 23901 var elementPos = element.offsetTop + elementHeight; 23902 // Difference between the element and scroll position 23903 var destination = direction > 0 ? this.element.scrollTop + elementPos - listScrollPosition : element.offsetTop; 23904 requestAnimationFrame(function() { 23905 _this._animateScroll(destination, direction); 23906 }); 23907 }; 23908 List.prototype._scrollDown = function(scrollPos, strength, destination) { 23909 var easing = (destination - scrollPos) / strength; 23910 var distance = easing > 1 ? easing : 1; 23911 this.element.scrollTop = scrollPos + distance; 23912 }; 23913 List.prototype._scrollUp = function(scrollPos, strength, destination) { 23914 var easing = (scrollPos - destination) / strength; 23915 var distance = easing > 1 ? easing : 1; 23916 this.element.scrollTop = scrollPos - distance; 23917 }; 23918 List.prototype._animateScroll = function(destination, direction) { 23919 var _this = this; 23920 var strength = constants_1.SCROLLING_SPEED; 23921 var choiceListScrollTop = this.element.scrollTop; 23922 var continueAnimation = false;
23923 if (direction > 0) { 23924 this._scrollDown(choiceListScrollTop, strength, destination); 23925 if (choiceListScrollTop < destination) continueAnimation = true; 23926 } else { 23927 this._scrollUp(choiceListScrollTop, strength, destination); 23928 if (choiceListScrollTop > destination) continueAnimation = true; 23929 } 23930 if (continueAnimation) requestAnimationFrame(function() { 23931 _this._animateScroll(destination, direction); 23932 }); 23933 }; 23934 return List; 23935 }(); 23936 exports["default"] = List; 23937 /***/ }, 23938 /***/ 730: /***/ function(__unused_webpack_module, exports, __webpack_require__) { 23939 Object.defineProperty(exports, "__esModule", { 23940 value: true 23941 }); 23942 var utils_1 = __webpack_require__(799); 23943 var WrappedElement = /** @class */ function() { 23944 function WrappedElement(_a) { 23945 var element = _a.element, classNames = _a.classNames; 23946 this.element = element; 23947 this.classNames = classNames; 23948 if (!(element instanceof HTMLInputElement) && !(element instanceof HTMLSelectElement)) throw new TypeError('Invalid element passed'); 23949 this.isDisabled = false; 23950 } 23951 Object.defineProperty(WrappedElement.prototype, "isActive", { 23952 get: function() { 23953 return this.element.dataset.choice === 'active'; 23954 }, 23955 enumerable: false, 23956 configurable: true 23957 }); 23958 Object.defineProperty(WrappedElement.prototype, "dir", { 23959 get: function() { 23960 return this.element.dir; 23961 }, 23962 enumerable: false, 23963 configurable: true 23964 }); 23965 Object.defineProperty(WrappedElement.prototype, "value", { 23966 get: function() { 23967 return this.element.value; 23968 }, 23969 set: function(value) { 23970 // you must define setter here otherwise it will be readonly property 23971 this.element.value = value; 23972 }, 23973 enumerable: false, 23974 configurable: true 23975 }); 23976 WrappedElement.prototype.conceal = function() { 23977 // Hide passed input 23978 this.element.classList.add(this.classNames.input); 23979 this.element.hidden = true; 23980 // Remove element from tab index 23981 this.element.tabIndex = -1; 23982 // Backup original styles if any 23983 var origStyle = this.element.getAttribute('style'); 23984 if (origStyle) this.element.setAttribute('data-choice-orig-style', origStyle); 23985 this.element.setAttribute('data-choice', 'active'); 23986 }; 23987 WrappedElement.prototype.reveal = function() { 23988 // Reinstate passed element 23989 this.element.classList.remove(this.classNames.input); 23990 this.element.hidden = false; 23991 this.element.removeAttribute('tabindex'); 23992 // Recover original styles if any 23993 var origStyle = this.element.getAttribute('data-choice-orig-style'); 23994 if (origStyle) { 23995 this.element.removeAttribute('data-choice-orig-style'); 23996 this.element.setAttribute('style', origStyle); 23997 } else this.element.removeAttribute('style'); 23998 this.element.removeAttribute('data-choice'); 23999 // Re-assign values - this is weird, I know 24000 // @todo Figure out why we need to do this 24001 this.element.value = this.element.value; // eslint-disable-line no-self-assign 24002 }; 24003 WrappedElement.prototype.enable = function() { 24004 this.element.removeAttribute('disabled'); 24005 this.element.disabled = false;
vendor: 8,275 bytes, lines 24006-24162
24006 this.isDisabled = false; 24007 }; 24008 WrappedElement.prototype.disable = function() { 24009 this.element.setAttribute('disabled', ''); 24010 this.element.disabled = true; 24011 this.isDisabled = true; 24012 }; 24013 WrappedElement.prototype.triggerEvent = function(eventType, data) { 24014 (0, utils_1.dispatchEvent)(this.element, eventType, data); 24015 }; 24016 return WrappedElement; 24017 }(); 24018 exports["default"] = WrappedElement; 24019 /***/ }, 24020 /***/ 541: /***/ function(__unused_webpack_module, exports, __webpack_require__) { 24021 var __extends = this && this.__extends || function() { 24022 var extendStatics = function(d, b) { 24023 extendStatics = Object.setPrototypeOf || ({ 24024 __proto__: [] 24025 }) instanceof Array && function(d, b) { 24026 d.__proto__ = b; 24027 } || function(d, b) { 24028 for(var p in b)if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 24029 }; 24030 return extendStatics(d, b); 24031 }; 24032 return function(d, b) { 24033 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 24034 extendStatics(d, b); 24035 function __() { 24036 this.constructor = d; 24037 } 24038 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 24039 }; 24040 }(); 24041 var __importDefault = this && this.__importDefault || function(mod) { 24042 return mod && mod.__esModule ? mod : { 24043 "default": mod 24044 }; 24045 }; 24046 Object.defineProperty(exports, "__esModule", { 24047 value: true 24048 }); 24049 var wrapped_element_1 = __importDefault(__webpack_require__(730)); 24050 var WrappedInput = /** @class */ function(_super) { 24051 __extends(WrappedInput, _super); 24052 function WrappedInput(_a) { 24053 var element = _a.element, classNames = _a.classNames, delimiter = _a.delimiter; 24054 var _this = _super.call(this, { 24055 element: element, 24056 classNames: classNames 24057 }) || this; 24058 _this.delimiter = delimiter; 24059 return _this; 24060 } 24061 Object.defineProperty(WrappedInput.prototype, "value", { 24062 get: function() { 24063 return this.element.value; 24064 }, 24065 set: function(value) { 24066 this.element.setAttribute('value', value); 24067 this.element.value = value; 24068 }, 24069 enumerable: false, 24070 configurable: true 24071 }); 24072 return WrappedInput; 24073 }(wrapped_element_1.default); 24074 exports["default"] = WrappedInput; 24075 /***/ }, 24076 /***/ 982: /***/ function(__unused_webpack_module, exports, __webpack_require__) { 24077 var __extends = this && this.__extends || function() { 24078 var extendStatics = function(d, b) { 24079 extendStatics = Object.setPrototypeOf || ({ 24080 __proto__: [] 24081 }) instanceof Array && function(d, b) { 24082 d.__proto__ = b; 24083 } || function(d, b) { 24084 for(var p in b)if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; 24085 }; 24086 return extendStatics(d, b); 24087 }; 24088 return function(d, b) { 24089 if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 24090 extendStatics(d, b); 24091 function __() { 24092 this.constructor = d; 24093 } 24094 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); 24095 }; 24096 }(); 24097 var __importDefault = this && this.__importDefault || function(mod) { 24098 return mod && mod.__esModule ? mod : { 24099 "default": mod 24100 }; 24101 }; 24102 Object.defineProperty(exports, "__esModule", { 24103 value: true 24104 }); 24105 var wrapped_element_1 = __importDefault(__webpack_require__(730)); 24106 var WrappedSelect = /** @class */ function(_super) { 24107 __extends(WrappedSelect, _super); 24108 function WrappedSelect(_a) { 24109 var element = _a.element, classNames = _a.classNames, template = _a.template; 24110 var _this = _super.call(this, { 24111 element: element, 24112 classNames: classNames 24113 }) || this; 24114 _this.template = template; 24115 return _this; 24116 } 24117 Object.defineProperty(WrappedSelect.prototype, "placeholderOption", { 24118 get: function() { 24119 return this.element.querySelector('option[value=""]') || // Backward compatibility layer for the non-standard placeholder attribute supported in older versions. 24120 this.element.querySelector('option[placeholder]'); 24121 }, 24122 enumerable: false, 24123 configurable: true 24124 }); 24125 Object.defineProperty(WrappedSelect.prototype, "optionGroups", { 24126 get: function() { 24127 return Array.from(this.element.getElementsByTagName('OPTGROUP')); 24128 }, 24129 enumerable: false, 24130 configurable: true 24131 }); 24132 Object.defineProperty(WrappedSelect.prototype, "options", { 24133 get: function() { 24134 return Array.from(this.element.options); 24135 }, 24136 set: function(options) { 24137 var _this = this; 24138 var fragment = document.createDocumentFragment(); 24139 var addOptionToFragment = function(data) { 24140 // Create a standard select option 24141 var option = _this.template(data); 24142 // Append it to fragment 24143 fragment.appendChild(option); 24144 }; 24145 // Add each list item to list 24146 options.forEach(function(optionData) { 24147 return addOptionToFragment(optionData); 24148 }); 24149 this.appendDocFragment(fragment); 24150 }, 24151 enumerable: false, 24152 configurable: true 24153 }); 24154 WrappedSelect.prototype.appendDocFragment = function(fragment) { 24155 this.element.innerHTML = ''; 24156 this.element.appendChild(fragment); 24157 }; 24158 return WrappedSelect; 24159 }(wrapped_element_1.default); 24160 exports["default"] = WrappedSelect; 24161 /***/ }, 24162 /***/ 883: /***/ function(__unused_webpack_module, exports
24162) { 24163 Object.defineProperty(exports, "__esModule", { 24164 value: true 24165 }); 24166 exports.SCROLLING_SPEED = exports.SELECT_MULTIPLE_TYPE = exports.SELECT_ONE_TYPE = exports.TEXT_TYPE = exports.KEY_CODES = exports.ACTION_TYPES = exports.EVENTS = void 0; 24167 exports.EVENTS = { 24168 showDropdown: 'showDropdown', 24169 hideDropdown: 'hideDropdown', 24170 change: 'change', 24171 choice: 'choice', 24172 search: 'search', 24173 addItem: 'addItem', 24174 removeItem: 'removeItem', 24175 highlightItem: 'highlightItem', 24176 highlightChoice: 'highlightChoice', 24177 unhighlightItem: 'unhighlightItem' 24178 }; 24179 exports.ACTION_TYPES = { 24180 ADD_CHOICE: 'ADD_CHOICE', 24181 FILTER_CHOICES: 'FILTER_CHOICES', 24182 ACTIVATE_CHOICES: 'ACTIVATE_CHOICES', 24183 CLEAR_CHOICES: 'CLEAR_CHOICES', 24184 ADD_GROUP: 'ADD_GROUP', 24185 ADD_ITEM: 'ADD_ITEM', 24186 REMOVE_ITEM: 'REMOVE_ITEM', 24187 HIGHLIGHT_ITEM: 'HIGHLIGHT_ITEM', 24188 CLEAR_ALL: 'CLEAR_ALL', 24189 RESET_TO: 'RESET_TO', 24190 SET_IS_LOADING: 'SET_IS_LOADING' 24191 }; 24192 exports.KEY_CODES = { 24193 BACK_KEY: 46, 24194 DELETE_KEY: 8, 24195 ENTER_KEY: 13, 24196 A_KEY: 65, 24197 ESC_KEY: 27, 24198 UP_KEY: 38, 24199 DOWN_KEY: 40, 24200 PAGE_UP_KEY: 33, 24201 PAGE_DOWN_KEY: 34 24202 }; 24203 exports.TEXT_TYPE = 'text'; 24204 exports.SELECT_ONE_TYPE = 'select-one'; 24205 exports.SELECT_MULTIPLE_TYPE = 'select-multiple'; 24206 exports.SCROLLING_SPEED = 4; 24207 /***/ }, 24208 /***/ 789: /***/ function(__unused_webpack_module, exports, __webpack_require__) { 24209 Object.defineProperty(exports, "__esModule", { 24210 value: true 24211 }); 24212 exports.DEFAULT_CONFIG = exports.DEFAULT_CLASSNAMES = void 0; 24213 var utils_1 = __webpack_require__(799); 24214 exports.DEFAULT_CLASSNAMES = { 24215 containerOuter: 'choices', 24216 containerInner: 'choices__inner', 24217 input: 'choices__input', 24218 inputCloned: 'choices__input--cloned', 24219 list: 'choices__list', 24220 listItems: 'choices__list--multiple', 24221 listSingle: 'choices__list--single', 24222 listDropdown: 'choices__list--dropdown', 24223 item: 'choices__item', 24224 itemSelectable: 'choices__item--selectable', 24225 itemDisabled: 'choices__item--disabled', 24226 itemChoice: 'choices__item--choice', 24227 placeholder: 'choices__placeholder', 24228 group: 'choices__group', 24229 groupHeading: 'choices__heading', 24230 button: 'choices__button', 24231 activeState: 'is-active', 24232 focusState: 'is-focused', 24233 openState: 'is-open', 24234 disabledState: 'is-disabled', 24235 highlightedState: 'is-highlighted', 24236 selectedState: 'is-selected', 24237 flippedState: 'is-flipped', 24238 loadingState: 'is-loading', 24239 noResults: 'has-no-results', 24240 noChoices: 'has-no-choices' 24241 }; 24242 exports.DEFAULT_CONFIG = { 24243 items: [], 24244 choices: [], 24245 silent: false, 24246 renderChoiceLimit: -1, 24247 maxItemCount: -1, 24248 addItems: true, 24249 addItemFilter: null, 24250 removeItems: true,
vendor: 8,899 bytes, lines 24251-24429
24251 removeItemButton: false, 24252 editItems: false, 24253 allowHTML: true, 24254 duplicateItemsAllowed: true, 24255 delimiter: ',', 24256 paste: true, 24257 searchEnabled: true, 24258 searchChoices: true, 24259 searchFloor: 1, 24260 searchResultLimit: 4, 24261 searchFields: [ 24262 'label', 24263 'value' 24264 ], 24265 position: 'auto', 24266 resetScrollPosition: true, 24267 shouldSort: true, 24268 shouldSortItems: false, 24269 sorter: utils_1.sortByAlpha, 24270 placeholder: true, 24271 placeholderValue: null, 24272 searchPlaceholderValue: null, 24273 prependValue: null, 24274 appendValue: null, 24275 renderSelectedChoices: 'auto', 24276 loadingText: 'Loading...', 24277 noResultsText: 'No results found', 24278 noChoicesText: 'No choices to choose from', 24279 itemSelectText: 'Press to select', 24280 uniqueItemText: 'Only unique values can be added', 24281 customAddItemText: 'Only values matching specific conditions can be added', 24282 addItemText: function(value) { 24283 return "Press Enter to add <b>\"".concat((0, utils_1.sanitise)(value), "\"</b>"); 24284 }, 24285 maxItemText: function(maxItemCount) { 24286 return "Only ".concat(maxItemCount, " values can be added"); 24287 }, 24288 valueComparer: function(value1, value2) { 24289 return value1 === value2; 24290 }, 24291 fuseOptions: { 24292 includeScore: true 24293 }, 24294 labelId: '', 24295 callbackOnInit: null, 24296 callbackOnCreateTemplates: null, 24297 classNames: exports.DEFAULT_CLASSNAMES 24298 }; 24299 /***/ }, 24300 /***/ 18: /***/ function(__unused_webpack_module, exports) { 24301 Object.defineProperty(exports, "__esModule", { 24302 value: true 24303 }); 24304 /***/ }, 24305 /***/ 978: /***/ function(__unused_webpack_module, exports) { 24306 /* eslint-disable @typescript-eslint/no-explicit-any */ Object.defineProperty(exports, "__esModule", { 24307 value: true 24308 }); 24309 /***/ }, 24310 /***/ 948: /***/ function(__unused_webpack_module, exports) { 24311 Object.defineProperty(exports, "__esModule", { 24312 value: true 24313 }); 24314 /***/ }, 24315 /***/ 359: /***/ function(__unused_webpack_module, exports) { 24316 Object.defineProperty(exports, "__esModule", { 24317 value: true 24318 }); 24319 /***/ }, 24320 /***/ 285: /***/ function(__unused_webpack_module, exports) { 24321 Object.defineProperty(exports, "__esModule", { 24322 value: true 24323 }); 24324 /***/ }, 24325 /***/ 533: /***/ function(__unused_webpack_module, exports) { 24326 /* eslint-disable @typescript-eslint/no-explicit-any */ Object.defineProperty(exports, "__esModule", { 24327 value: true 24328 }); 24329 /***/ }, 24330 /***/ 187: /***/ function(__unused_webpack_module, exports, __webpack_require__) { 24331 var __createBinding = this && this.__createBinding || (Object.create ? function(o, m, k, k2) { 24332 if (k2 === undefined) k2 = k; 24333 var desc = Object.getOwnPropertyDescriptor(m, k); 24334 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = { 24335 enumerable: true, 24336 get: function() { 24337 return m[k]; 24338 } 24339 }; 24340 Object.defineProperty(o, k2, desc); 24341 } : function(o, m, k, k2) { 24342 if (k2 === undefined) k2 = k; 24343 o[k2] = m[k]; 24344 }); 24345 var __exportStar = this && this.__exportStar || function(m, exports) { 24346 for(var p in m)if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); 24347 }; 24348 Object.defineProperty(exports, "__esModule", { 24349 value: true 24350 }); 24351 __exportStar(__webpack_require__(18), exports); 24352 __exportStar(__webpack_require__(978), exports); 24353 __exportStar(__webpack_require__(948), exports); 24354 __exportStar(__webpack_require__(359), exports); 24355 __exportStar(__webpack_require__(285), exports); 24356 __exportStar(__webpack_require__(533), exports); 24357 __exportStar(__webpack_require__(287), exports); 24358 __exportStar(__webpack_require__(132), exports); 24359 __exportStar(__webpack_require__(837), exports); 24360 __exportStar(__webpack_require__(598), exports); 24361 __exportStar(__webpack_require__(369), exports); 24362 __exportStar(__webpack_require__(37), exports); 24363 __exportStar(__webpack_require__(47), exports); 24364 __exportStar(__webpack_require__(923), exports); 24365 __exportStar(__webpack_require__(876), exports); 24366 /***/ }, 24367 /***/ 287: /***/ function(__unused_webpack_module, exports) { 24368 Object.defineProperty(exports, "__esModule", { 24369 value: true 24370 }); 24371 /***/ }, 24372 /***/ 132: /***/ function(__unused_webpack_module, exports) { 24373 Object.defineProperty(exports, "__esModule", { 24374 value: true 24375 }); 24376 /***/ }, 24377 /***/ 837: /***/ function(__unused_webpack_module, exports) { 24378 Object.defineProperty(exports, "__esModule", { 24379 value: true 24380 }); 24381 /***/ }, 24382 /***/ 598: /***/ function(__unused_webpack_module, exports) { 24383 Object.defineProperty(exports, "__esModule", { 24384 value: true 24385 }); 24386 /***/ }, 24387 /***/ 37: /***/ function(__unused_webpack_module, exports) { 24388 Object.defineProperty(exports, "__esModule", { 24389 value: true 24390 }); 24391 /***/ }, 24392 /***/ 369: /***/ function(__unused_webpack_module, exports) { 24393 Object.defineProperty(exports, "__esModule", { 24394 value: true 24395 }); 24396 /***/ }, 24397 /***/ 47: /***/ function(__unused_webpack_module, exports) { 24398 Object.defineProperty(exports, "__esModule", { 24399 value: true 24400 }); 24401 /***/ }, 24402 /***/ 923: /***/ function(__unused_webpack_module, exports) { 24403 Object.defineProperty(exports, "__esModule", { 24404 value: true 24405 }); 24406 /***/ }, 24407 /***/ 876: /***/ function(__unused_webpack_module, exports) { 24408 Object.defineProperty(exports, "__esModule", { 24409 value: true 24410 }); 24411 /***/ }, 24412 /***/ 799: /***/ function(__unused_webpack_module, exports) { 24413 /* eslint-disable @typescript-eslint/no-explicit-any */ Object.defineProperty(exports, "__esModule", { 24414 value: true 24415 }); 24416 exports.parseCustomProperties = exports.diff = exports.cloneObject = exports.existsInArray = exports.dispatchEvent = exports.sortByScore = exports.sortByAlpha = exports.strToEl = exports.sanitise = exports.isScrolledIntoView = exports.getAdjacentEl = exports.wrap = exports.isType = exports.getType = exports.generateId = exports.generateChars = exports.getRandomNumber = void 0; 24417 var getRandomNumber = function(min, max) { 24418 return Math.floor(Math.random() * (max - min) + min); 24419 }; 24420 exports.getRandomNumber = getRandomNumber; 24421 var generateChars = function(length) { 24422 return Array.from({ 24423 length: length 24424 }, function() { 24425 return (0, exports.getRandomNumber)(0, 36).toString(36); 24426 }).join(''); 24427 }; 24428 exports.generateChars = generateChars; 24429 var generateId = function(element, prefix) {
24430 var id = element.id || element.name && "".concat(element.name, "-").concat((0, exports.generateChars)(2)) || (0, exports.generateChars)(4); 24431 id = id.replace(/(:|\.|\[|\]|,)/g, ''); 24432 id = "".concat(prefix, "-").concat(id); 24433 return id; 24434 }; 24435 exports.generateId = generateId; 24436 var getType = function(obj) { 24437 return Object.prototype.toString.call(obj).slice(8, -1); 24438 }; 24439 exports.getType = getType; 24440 var isType = function(type, obj) { 24441 return obj !== undefined && obj !== null && (0, exports.getType)(obj) === type; 24442 }; 24443 exports.isType = isType; 24444 var wrap = function(element, wrapper) { 24445 if (wrapper === void 0) wrapper = document.createElement('div'); 24446 if (element.parentNode) { 24447 if (element.nextSibling) element.parentNode.insertBefore(wrapper, element.nextSibling); 24448 else element.parentNode.appendChild(wrapper); 24449 } 24450 return wrapper.appendChild(element); 24451 }; 24452 exports.wrap = wrap; 24453 var getAdjacentEl = function(startEl, selector, direction) { 24454 if (direction === void 0) direction = 1; 24455 var prop = "".concat(direction > 0 ? 'next' : 'previous', "ElementSibling"); 24456 var sibling = startEl[prop]; 24457 while(sibling){ 24458 if (sibling.matches(selector)) return sibling; 24459 sibling = sibling[prop]; 24460 } 24461 return sibling; 24462 }; 24463 exports.getAdjacentEl = getAdjacentEl; 24464 var isScrolledIntoView = function(element, parent, direction) { 24465 if (direction === void 0) direction = 1; 24466 if (!element) return false; 24467 var isVisible; 24468 if (direction > 0) // In view from bottom 24469 isVisible = parent.scrollTop + parent.offsetHeight >= element.offsetTop + element.offsetHeight; 24470 else // In view from top 24471 isVisible = element.offsetTop >= parent.scrollTop; 24472 return isVisible; 24473 }; 24474 exports.isScrolledIntoView = isScrolledIntoView; 24475 var sanitise = function(value) { 24476 if (typeof value !== 'string') return value; 24477 return value.replace(/&/g, '&').replace(/>/g, '>').replace(/</g, '<').replace(/"/g, '"'); 24478 }; 24479 exports.sanitise = sanitise; 24480 exports.strToEl = function() { 24481 var tmpEl = document.createElement('div'); 24482 return function(str) { 24483 var cleanedInput = str.trim(); 24484 tmpEl.innerHTML = cleanedInput; 24485 var firldChild = tmpEl.children[0]; 24486 while(tmpEl.firstChild)tmpEl.removeChild(tmpEl.firstChild); 24487 return firldChild; 24488 }; 24489 }(); 24490 var sortByAlpha = function(_a, _b) { 24491 var value = _a.value, _c = _a.label, label = _c === void 0 ? value : _c; 24492 var value2 = _b.value, _d = _b.label, label2 = _d === void 0 ? value2 : _d; 24493 return label.localeCompare(label2, [], { 24494 sensitivity: 'base', 24495 ignorePunctuation: true, 24496 numeric: true 24497 }); 24498 }; 24499 exports.sortByAlpha = sortByAlpha; 24500 var sortByScore = function(a, b) { 24501 var _a = a.score, scoreA = _a === void 0 ? 0 : _a; 24502 var _b = b.score, scoreB = _b === void 0 ? 0 : _b; 24503 return scoreA - scoreB; 24504 }; 24505 exports.sortByScore = sortByScore; 24506 var dispatchEvent = function(element, type, customArgs) { 24507 if (customArgs === void 0) customArgs = null; 24508 var event = new CustomEvent(type, { 24509 detail: customArgs, 24510 bubbles: true, 24511 cancelable: true 24512 }); 24513 return element.dispatchEvent(event); 24514 }; 24515 exports.dispatchEvent = dispatchEvent; 24516 var existsInArray = function(array, value, key) { 24517 if (key === void 0) key = 'value'; 24518 return array.some(function(item) { 24519 if (typeof value === 'string') return item[key] === value.trim(); 24520 return item[key] === value; 24521 }); 24522 }; 24523 exports.existsInArray = existsInArray; 24524 var cloneObject = function(obj) { 24525 return JSON.parse(JSON.stringify(obj)); 24526 }; 24527 exports.cloneObject = cloneObject; 24528 /** 24529 * Returns an array of keys present on the first but missing on the second object 24530 */ var diff = function(a, b) { 24531 var aKeys = Object.keys(a).sort(); 24532 var bKeys = Object.keys(b).sort(); 24533 return aKeys.filter(function(i) { 24534 return bKeys.indexOf(i) < 0; 24535 }); 24536 }; 24537 exports.diff = diff; 24538 var parseCustomProperties = function(customProperties) { 24539 if (typeof customProperties !== 'undefined') try { 24540 return JSON.parse(customProperties); 24541 } catch (e) { 24542 return customProperties; 24543 } 24544 return {}; 24545 }; 24546 exports.parseCustomProperties = parseCustomProperties; 24547 /***/ }, 24548 /***/ 273: /***/ function(__unused_webpack_module, exports
24548) { 24549 var __spreadArray = this && this.__spreadArray || function(to, from, pack) { 24550 if (pack || arguments.length === 2) { 24551 for(var i = 0, l = from.length, ar; i < l; i++)if (ar || !(i in from)) { 24552 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 24553 ar[i] = from[i]; 24554 } 24555 } 24556 return to.concat(ar || Array.prototype.slice.call(from)); 24557 }; 24558 Object.defineProperty(exports, "__esModule", { 24559 value: true 24560 }); 24561 exports.defaultState = void 0; 24562 exports.defaultState = []; 24563 function choices(state, action) { 24564 if (state === void 0) state = exports.defaultState; 24565 if (action === void 0) action = {}; 24566 switch(action.type){ 24567 case 'ADD_CHOICE': 24568 var addChoiceAction = action; 24569 var choice = { 24570 id: addChoiceAction.id, 24571 elementId: addChoiceAction.elementId, 24572 groupId: addChoiceAction.groupId, 24573 value: addChoiceAction.value, 24574 label: addChoiceAction.label || addChoiceAction.value, 24575 disabled: addChoiceAction.disabled || false, 24576 selected: false, 24577 active: true, 24578 score: 9999, 24579 customProperties: addChoiceAction.customProperties, 24580 placeholder: addChoiceAction.placeholder || false 24581 }; 24582 /* 24583 A disabled choice appears in the choice dropdown but cannot be selected 24584 A selected choice has been added to the passed input's value (added as an item) 24585 An active choice appears within the choice dropdown 24586 */ return __spreadArray(__spreadArray([], state, true), [ 24587 choice 24588 ], false); 24589 case 'ADD_ITEM': 24590 var addItemAction_1 = action; 24591 // When an item is added and it has an associated choice, 24592 // we want to disable it so it can't be chosen again 24593 if (addItemAction_1.choiceId > -1) return state.map(function(obj) { 24594 var choice = obj; 24595 if (choice.id === parseInt("".concat(addItemAction_1.choiceId), 10)) choice.selected = true; 24596 return choice; 24597 }); 24598 return state; 24599 case 'REMOVE_ITEM': 24600 var removeItemAction_1 = action; 24601 // When an item is removed and it has an associated choice, 24602 // we want to re-enable it so it can be chosen again 24603 if (removeItemAction_1.choiceId && removeItemAction_1.choiceId > -1) return state.map(function(obj) { 24604 var choice = obj; 24605 if (choice.id === parseInt("".concat(removeItemAction_1.choiceId), 10)) choice.selected = false; 24606 return choice; 24607 }); 24608 return state; 24609 case 'FILTER_CHOICES': 24610 var filterChoicesAction_1 = action; 24611 return state.map(function(obj) { 24612 var choice = obj; 24613 // Set active state based on whether choice is 24614 // within filtered results 24615 choice.active = filterChoicesAction_1.results.some(function(_a) { 24616 var item = _a.item, score = _a.score; 24617 if (item.id === choice.id) { 24618 choice.score = score; 24619 return true; 24620 } 24621 return false;
24622 }); 24623 return choice; 24624 }); 24625 case 'ACTIVATE_CHOICES': 24626 var activateChoicesAction_1 = action; 24627 return state.map(function(obj) { 24628 var choice = obj; 24629 choice.active = activateChoicesAction_1.active; 24630 return choice; 24631 }); 24632 case 'CLEAR_CHOICES': 24633 return exports.defaultState; 24634 default: 24635 return state; 24636 } 24637 } 24638 exports["default"] = choices; 24639 /***/ }, 24640 /***/ 871: /***/ function(__unused_webpack_module, exports) { 24641 var __spreadArray = this && this.__spreadArray || function(to, from, pack) { 24642 if (pack || arguments.length === 2) { 24643 for(var i = 0, l = from.length, ar; i < l; i++)if (ar || !(i in from)) { 24644 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 24645 ar[i] = from[i]; 24646 } 24647 } 24648 return to.concat(ar || Array.prototype.slice.call(from)); 24649 }; 24650 Object.defineProperty(exports, "__esModule", { 24651 value: true 24652 }); 24653 exports.defaultState = void 0; 24654 exports.defaultState = []; 24655 function groups(state, action) { 24656 if (state === void 0) state = exports.defaultState; 24657 if (action === void 0) action = {}; 24658 switch(action.type){ 24659 case 'ADD_GROUP': 24660 var addGroupAction = action; 24661 return __spreadArray(__spreadArray([], state, true), [ 24662 { 24663 id: addGroupAction.id, 24664 value: addGroupAction.value, 24665 active: addGroupAction.active, 24666 disabled: addGroupAction.disabled 24667 } 24668 ], false); 24669 case 'CLEAR_CHOICES': 24670 return []; 24671 default: 24672 return state; 24673 } 24674 } 24675 exports["default"] = groups; 24676 /***/ }, 24677 /***/ 655: /***/ function(__unused_webpack_module, exports, __webpack_require__) { 24678 var __importDefault = this && this.__importDefault || function(mod) { 24679 return mod && mod.__esModule ? mod : { 24680 "default": mod 24681 }; 24682 }; 24683 Object.defineProperty(exports, "__esModule", { 24684 value: true 24685 }); 24686 exports.defaultState = void 0; 24687 var redux_1 = __webpack_require__(791); 24688 var items_1 = __importDefault(__webpack_require__(52)); 24689 var groups_1 = __importDefault(__webpack_require__(871)); 24690 var choices_1 = __importDefault(__webpack_require__(273)); 24691 var loading_1 = __importDefault(__webpack_require__(502)); 24692 var utils_1 = __webpack_require__(799); 24693 exports.defaultState = { 24694 groups: [], 24695 items: [], 24696 choices: [], 24697 loading: false 24698 }; 24699 var appReducer = (0, redux_1.combineReducers)({ 24700 items: items_1.default, 24701 groups: groups_1.default, 24702 choices: choices_1.default, 24703 loading: loading_1.default 24704 }); 24705 var rootReducer = function(passedState, action) { 24706 var state = passedState; 24707 // If we are clearing all items, groups and options we reassign 24708 // state and then pass that state to our proper reducer. This isn't 24709 // mutating our actual state 24710 // See: http://stackoverflow.com/a/35641992 24711 if (action.type === 'CLEAR_ALL') state = exports.defaultState; 24712 else if (action.type === 'RESET_TO') return (0, utils_1.cloneObject)(action.state); 24713 return appReducer(state, action); 24714 }; 24715 exports["default"] = rootReducer; 24716 /***/ }, 24717 /***/ 52: /***/ function(__unused_webpack_module, exports
vendor: 11,909 bytes, lines 24717-24970
24717) { 24718 var __spreadArray = this && this.__spreadArray || function(to, from, pack) { 24719 if (pack || arguments.length === 2) { 24720 for(var i = 0, l = from.length, ar; i < l; i++)if (ar || !(i in from)) { 24721 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 24722 ar[i] = from[i]; 24723 } 24724 } 24725 return to.concat(ar || Array.prototype.slice.call(from)); 24726 }; 24727 Object.defineProperty(exports, "__esModule", { 24728 value: true 24729 }); 24730 exports.defaultState = void 0; 24731 exports.defaultState = []; 24732 function items(state, action) { 24733 if (state === void 0) state = exports.defaultState; 24734 if (action === void 0) action = {}; 24735 switch(action.type){ 24736 case 'ADD_ITEM': 24737 var addItemAction = action; 24738 // Add object to items array 24739 var newState = __spreadArray(__spreadArray([], state, true), [ 24740 { 24741 id: addItemAction.id, 24742 choiceId: addItemAction.choiceId, 24743 groupId: addItemAction.groupId, 24744 value: addItemAction.value, 24745 label: addItemAction.label, 24746 active: true, 24747 highlighted: false, 24748 customProperties: addItemAction.customProperties, 24749 placeholder: addItemAction.placeholder || false, 24750 keyCode: null 24751 } 24752 ], false); 24753 return newState.map(function(obj) { 24754 var item = obj; 24755 item.highlighted = false; 24756 return item; 24757 }); 24758 case 'REMOVE_ITEM': 24759 // Set item to inactive 24760 return state.map(function(obj) { 24761 var item = obj; 24762 if (item.id === action.id) item.active = false; 24763 return item; 24764 }); 24765 case 'HIGHLIGHT_ITEM': 24766 var highlightItemAction_1 = action; 24767 return state.map(function(obj) { 24768 var item = obj; 24769 if (item.id === highlightItemAction_1.id) item.highlighted = highlightItemAction_1.highlighted; 24770 return item; 24771 }); 24772 default: 24773 return state; 24774 } 24775 } 24776 exports["default"] = items; 24777 /***/ }, 24778 /***/ 502: /***/ function(__unused_webpack_module, exports) { 24779 Object.defineProperty(exports, "__esModule", { 24780 value: true 24781 }); 24782 exports.defaultState = void 0; 24783 exports.defaultState = false; 24784 var general = function(state, action) { 24785 if (state === void 0) state = exports.defaultState; 24786 if (action === void 0) action = {}; 24787 switch(action.type){ 24788 case 'SET_IS_LOADING': 24789 return action.isLoading; 24790 default: 24791 return state; 24792 } 24793 }; 24794 exports["default"] = general; 24795 /***/ }, 24796 /***/ 744: /***/ function(__unused_webpack_module, exports, __webpack_require__) { 24797 var __spreadArray = this && this.__spreadArray || function(to, from, pack) { 24798 if (pack || arguments.length === 2) { 24799 for(var i = 0, l = from.length, ar; i < l; i++)if (ar || !(i in from)) { 24800 if (!ar) ar = Array.prototype.slice.call(from, 0, i); 24801 ar[i] = from[i]; 24802 } 24803 } 24804 return to.concat(ar || Array.prototype.slice.call(from)); 24805 }; 24806 var __importDefault = this && this.__importDefault || function(mod) { 24807 return mod && mod.__esModule ? mod : { 24808 "default": mod 24809 }; 24810 }; 24811 Object.defineProperty(exports, "__esModule", { 24812 value: true 24813 }); 24814 /* eslint-disable @typescript-eslint/no-explicit-any */ var redux_1 = __webpack_require__(791); 24815 var index_1 = __importDefault(__webpack_require__(655)); 24816 var Store = /** @class */ function() { 24817 function Store() { 24818 this._store = (0, redux_1.createStore)(index_1.default, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()); 24819 } 24820 /** 24821 * Subscribe store to function call (wrapped Redux method) 24822 */ Store.prototype.subscribe = function(onChange) { 24823 this._store.subscribe(onChange); 24824 }; 24825 /** 24826 * Dispatch event to store (wrapped Redux method) 24827 */ Store.prototype.dispatch = function(action) { 24828 this._store.dispatch(action); 24829 }; 24830 Object.defineProperty(Store.prototype, "state", { 24831 /** 24832 * Get store object (wrapping Redux method) 24833 */ get: function() { 24834 return this._store.getState(); 24835 }, 24836 enumerable: false, 24837 configurable: true 24838 }); 24839 Object.defineProperty(Store.prototype, "items", { 24840 /** 24841 * Get items from store 24842 */ get: function() { 24843 return this.state.items; 24844 }, 24845 enumerable: false, 24846 configurable: true 24847 }); 24848 Object.defineProperty(Store.prototype, "activeItems", { 24849 /** 24850 * Get active items from store 24851 */ get: function() { 24852 return this.items.filter(function(item) { 24853 return item.active === true; 24854 }); 24855 }, 24856 enumerable: false, 24857 configurable: true 24858 }); 24859 Object.defineProperty(Store.prototype, "highlightedActiveItems", { 24860 /** 24861 * Get highlighted items from store 24862 */ get: function() { 24863 return this.items.filter(function(item) { 24864 return item.active && item.highlighted; 24865 }); 24866 }, 24867 enumerable: false, 24868 configurable: true 24869 }); 24870 Object.defineProperty(Store.prototype, "choices", { 24871 /** 24872 * Get choices from store 24873 */ get: function() { 24874 return this.state.choices; 24875 }, 24876 enumerable: false, 24877 configurable: true 24878 }); 24879 Object.defineProperty(Store.prototype, "activeChoices", { 24880 /** 24881 * Get active choices from store 24882 */ get: function() { 24883 return this.choices.filter(function(choice) { 24884 return choice.active === true; 24885 }); 24886 }, 24887 enumerable: false, 24888 configurable: true 24889 }); 24890 Object.defineProperty(Store.prototype, "selectableChoices", { 24891 /** 24892 * Get selectable choices from store 24893 */ get: function() { 24894 return this.choices.filter(function(choice) { 24895 return choice.disabled !== true; 24896 }); 24897 }, 24898 enumerable: false, 24899 configurable: true 24900 }); 24901 Object.defineProperty(Store.prototype, "searchableChoices", { 24902 /** 24903 * Get choices that can be searched (excluding placeholders) 24904 */ get: function() { 24905 return this.selectableChoices.filter(function(choice) { 24906 return choice.placeholder !== true; 24907 }); 24908 }, 24909 enumerable: false, 24910 configurable: true 24911 }); 24912 Object.defineProperty(Store.prototype, "placeholderChoice", { 24913 /** 24914 * Get placeholder choice from store 24915 */ get: function() { 24916 return __spreadArray([], this.choices, true).reverse().find(function(choice) { 24917 return choice.placeholder === true; 24918 }); 24919 }, 24920 enumerable: false, 24921 configurable: true 24922 }); 24923 Object.defineProperty(Store.prototype, "groups", { 24924 /** 24925 * Get groups from store 24926 */ get: function() { 24927 return this.state.groups; 24928 }, 24929 enumerable: false, 24930 configurable: true 24931 }); 24932 Object.defineProperty(Store.prototype, "activeGroups", { 24933 /** 24934 * Get active groups from store 24935 */ get: function() { 24936 var _a = this, groups = _a.groups, choices = _a.choices; 24937 return groups.filter(function(group) { 24938 var isActive = group.active === true && group.disabled === false; 24939 var hasActiveOptions = choices.some(function(choice) { 24940 return choice.active === true && choice.disabled === false; 24941 }); 24942 return isActive && hasActiveOptions; 24943 }, []); 24944 }, 24945 enumerable: false, 24946 configurable: true 24947 }); 24948 /** 24949 * Get loading state from store 24950 */ Store.prototype.isLoading = function() { 24951 return this.state.loading; 24952 }; 24953 /** 24954 * Get single choice by it's ID 24955 */ Store.prototype.getChoiceById = function(id) { 24956 return this.activeChoices.find(function(choice) { 24957 return choice.id === parseInt(id, 10); 24958 }); 24959 }; 24960 /** 24961 * Get group by group id 24962 */ Store.prototype.getGroupById = function(id) { 24963 return this.groups.find(function(group) { 24964 return group.id === id; 24965 }); 24966 }; 24967 return Store; 24968 }(); 24969 exports["default"] = Store; 24970 /***/ },
24971 /***/ 686: /***/ function(__unused_webpack_module, exports) { 24972 /** 24973 * Helpers to create HTML elements used by Choices 24974 * Can be overridden by providing `callbackOnCreateTemplates` option 24975 */ Object.defineProperty(exports, "__esModule", { 24976 value: true 24977 }); 24978 var templates = { 24979 containerOuter: function(_a, dir, isSelectElement, isSelectOneElement, searchEnabled, passedElementType, labelId) { 24980 var containerOuter = _a.classNames.containerOuter; 24981 var div = Object.assign(document.createElement('div'), { 24982 className: containerOuter 24983 }); 24984 div.dataset.type = passedElementType; 24985 if (dir) div.dir = dir; 24986 if (isSelectOneElement) div.tabIndex = 0; 24987 if (isSelectElement) { 24988 div.setAttribute('role', searchEnabled ? 'combobox' : 'listbox'); 24989 if (searchEnabled) div.setAttribute('aria-autocomplete', 'list'); 24990 } 24991 div.setAttribute('aria-haspopup', 'true'); 24992 div.setAttribute('aria-expanded', 'false'); 24993 if (labelId) div.setAttribute('aria-labelledby', labelId); 24994 return div; 24995 }, 24996 containerInner: function(_a) { 24997 var containerInner = _a.classNames.containerInner; 24998 return Object.assign(document.createElement('div'), { 24999 className: containerInner 25000 }); 25001 }, 25002 itemList: function(_a, isSelectOneElement) { 25003 var _b = _a.classNames, list = _b.list, listSingle = _b.listSingle, listItems = _b.listItems; 25004 return Object.assign(document.createElement('div'), { 25005 className: "".concat(list, " ").concat(isSelectOneElement ? listSingle : listItems) 25006 }); 25007 }, 25008 placeholder: function(_a, value) { 25009 var _b; 25010 var allowHTML = _a.allowHTML, placeholder = _a.classNames.placeholder; 25011 return Object.assign(document.createElement('div'), (_b = { 25012 className: placeholder 25013 }, _b[allowHTML ? 'innerHTML' : 'innerText'] = value, _b)); 25014 }, 25015 item: function(_a, _b, removeItemButton) { 25016 var _c, _d; 25017 var allowHTML = _a.allowHTML, _e = _a.classNames, item = _e.item, button = _e.button, highlightedState = _e.highlightedState, itemSelectable = _e.itemSelectable, placeholder = _e.placeholder; 25018 var id = _b.id, value = _b.value, label = _b.label, customProperties = _b.customProperties, active = _b.active, disabled = _b.disabled, highlighted = _b.highlighted, isPlaceholder = _b.placeholder; 25019 var div = Object.assign(document.createElement('div'), (_c = { 25020 className: item 25021 }, _c[allowHTML ? 'innerHTML' : 'innerText'] = label, _c)); 25022 Object.assign(div.dataset, { 25023 item: '', 25024 id: id, 25025 value: value, 25026 customProperties: customProperties 25027 }); 25028 if (active) div.setAttribute('aria-selected', 'true'); 25029 if (disabled) div.setAttribute('aria-disabled', 'true'); 25030 if (isPlaceholder) div.classList.add(placeholder); 25031 div.classList.add(highlighted ? highlightedState : itemSelectable); 25032 if (removeItemButton) { 25033 if (disabled) div.classList.remove(itemSelectable); 25034 div.dataset.deletable = ''; 25035 /** @todo This MUST be localizable, not hardcoded! */ var REMOVE_ITEM_TEXT = 'Remove item'; 25036 var removeButton = Object.assign(document.createElement('button'), (_d = { 25037 type: 'button', 25038 className: button 25039 }, _d[allowHTML ? 'innerHTML' : 'innerText'] = REMOVE_ITEM_TEXT, _d)); 25040 removeButton.setAttribute('aria-label', "".concat(REMOVE_ITEM_TEXT, ": '").concat(value, "'")); 25041 removeButton.dataset.button = ''; 25042 div.appendChild(removeButton); 25043 } 25044 return div; 25045 }, 25046 choiceList: function(_a, isSelectOneElement) { 25047 var list = _a.classNames.list; 25048 var div = Object.assign(document.createElement('div'), { 25049 className: list 25050 }); 25051 if (!isSelectOneElement) div.setAttribute('aria-multiselectable', 'true'); 25052 div.setAttribute('role', 'listbox'); 25053 return div; 25054 }, 25055 choiceGroup: function(_a, _b) { 25056 var _c; 25057 var allowHTML = _a.allowHTML, _d = _a.classNames, group = _d.group, groupHeading = _d.groupHeading, itemDisabled = _d.itemDisabled; 25058 var id = _b.id, value = _b.value, disabled = _b.disabled; 25059 var div = Object.assign(document.createElement('div'), { 25060 className: "".concat(group, " ").concat(disabled ? itemDisabled : '') 25061 }); 25062 div.setAttribute('role', 'group'); 25063 Object.assign(div.dataset, { 25064 group: '', 25065 id: id, 25066 value: value 25067 }); 25068 if (disabled) div.setAttribute('aria-disabled', 'true'); 25069 div.appendChild(Object.assign(document.createElement('div'), (_c = { 25070 className: groupHeading 25071 }, _c[allowHTML ? 'innerHTML' : 'innerText'] = value, _c))); 25072 return div; 25073 }, 25074 choice: function(_a, _b, selectText) { 25075 var _c; 25076 var allowHTML = _a.allowHTML, _d = _a.classNames, item = _d.item, itemChoice = _d.itemChoice, itemSelectable = _d.itemSelectable, selectedState = _d.selectedState, itemDisabled = _d.itemDisabled, placeholder = _d.placeholder; 25077 var id = _b.id, value = _b.value, label = _b.label, groupId = _b.groupId, elementId = _b.elementId, isDisabled = _b.disabled, isSelected = _b.selected, isPlaceholder = _b.placeholder; 25078 var div = Object.assign(document.createElement('div'), (_c = { 25079 id: elementId 25080 }, _c[allowHTML ? 'innerHTML' : 'innerText'] = label, _c.className = "".concat(item, " ").concat(itemChoice), _c)); 25081 if (isSelected) div.classList.add(selectedState); 25082 if (isPlaceholder) div.classList.add(placeholder); 25083 div.setAttribute('role', groupId && groupId > 0 ? 'treeitem' : 'option'); 25084 Object.assign(div.dataset, { 25085 choice: '', 25086 id: id, 25087 value: value, 25088 selectText: selectText 25089 }); 25090 if (isDisabled) { 25091 div.classList.add(itemDisabled); 25092 div.dataset.choiceDisabled = ''; 25093 div.setAttribute('aria-disabled', 'true'); 25094 } else { 25095 div.classList.add(itemSelectable); 25096 div.dataset.choiceSelectable = ''; 25097 } 25098 return div; 25099 }, 25100 input: function(_a, placeholderValue) { 25101 var _b = _a.classNames, input = _b.input, inputCloned = _b.inputCloned; 25102 var inp = Object.assign(document.createElement('input'), { 25103 type: 'search', 25104 name: 'search_terms', 25105 className: "".concat(input, " ").concat(inputCloned), 25106 autocomplete: 'off', 25107 autocapitalize: 'off',
25108 spellcheck: false 25109 }); 25110 inp.setAttribute('role', 'textbox'); 25111 inp.setAttribute('aria-autocomplete', 'list'); 25112 inp.setAttribute('aria-label', placeholderValue); 25113 return inp; 25114 }, 25115 dropdown: function(_a) { 25116 var _b = _a.classNames, list = _b.list, listDropdown = _b.listDropdown; 25117 var div = document.createElement('div'); 25118 div.classList.add(list, listDropdown); 25119 div.setAttribute('aria-expanded', 'false'); 25120 return div; 25121 }, 25122 notice: function(_a, innerText, type) { 25123 var _b; 25124 var allowHTML = _a.allowHTML, _c = _a.classNames, item = _c.item, itemChoice = _c.itemChoice, noResults = _c.noResults, noChoices = _c.noChoices; 25125 if (type === void 0) type = ''; 25126 var classes = [ 25127 item, 25128 itemChoice 25129 ]; 25130 if (type === 'no-choices') classes.push(noChoices); 25131 else if (type === 'no-results') classes.push(noResults); 25132 return Object.assign(document.createElement('div'), (_b = {}, _b[allowHTML ? 'innerHTML' : 'innerText'] = innerText, _b.className = classes.join(' '), _b)); 25133 }, 25134 option: function(_a) { 25135 var label = _a.label, value = _a.value, customProperties = _a.customProperties, active = _a.active, disabled = _a.disabled; 25136 var opt = new Option(label, value, false, active); 25137 if (customProperties) opt.dataset.customProperties = "".concat(customProperties); 25138 opt.disabled = !!disabled; 25139 return opt; 25140 } 25141 }; 25142 exports["default"] = templates; 25143 /***/ }, 25144 /***/ 996: /***/ function(module1) { 25145 var isMergeableObject = function isMergeableObject(value) { 25146 return isNonNullObject(value) && !isSpecial(value); 25147 }; 25148 function isNonNullObject(value) { 25149 return !!value && typeof value === 'object'; 25150 } 25151 function isSpecial(value) { 25152 var stringValue = Object.prototype.toString.call(value); 25153 return stringValue === '[object RegExp]' || stringValue === '[object Date]' || isReactElement(value); 25154 } 25155 // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25 25156 var canUseSymbol = typeof Symbol === 'function' && Symbol.for; 25157 var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7; 25158 function isReactElement(value) { 25159 return value.$$typeof === REACT_ELEMENT_TYPE; 25160 } 25161 function emptyTarget(val) { 25162 return Array.isArray(val) ? [] : {}; 25163 } 25164 function cloneUnlessOtherwiseSpecified(value, options) { 25165 return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value; 25166 } 25167 function defaultArrayMerge(target, source, options) { 25168 return target.concat(source).map(function(element) { 25169 return cloneUnlessOtherwiseSpecified(element, options); 25170 }); 25171 } 25172 function getMergeFunction(key, options) { 25173 if (!options.customMerge) return deepmerge; 25174 var customMerge = options.customMerge(key); 25175 return typeof customMerge === 'function' ? customMerge : deepmerge; 25176 } 25177 function getEnumerableOwnPropertySymbols(target) { 25178 return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) { 25179 return target.propertyIsEnumerable(symbol); 25180 }) : []; 25181 } 25182 function getKeys(target) { 25183 return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target)); 25184 } 25185 function propertyIsOnObject(object, property) { 25186 try { 25187 return property in object; 25188 } catch (_) { 25189 return false;
25190 } 25191 } 25192 // Protects from prototype poisoning and unexpected merging up the prototype chain. 25193 function propertyIsUnsafe(target, key) { 25194 return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet, 25195 && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain, 25196 && Object.propertyIsEnumerable.call(target, key) // and also unsafe if they're nonenumerable. 25197 ); 25198 } 25199 function mergeObject(target, source, options) { 25200 var destination = {}; 25201 if (options.isMergeableObject(target)) getKeys(target).forEach(function(key) { 25202 destination[key] = cloneUnlessOtherwiseSpecified(target[key], options); 25203 }); 25204 getKeys(source).forEach(function(key) { 25205 if (propertyIsUnsafe(target, key)) return; 25206 if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) destination[key] = getMergeFunction(key, options)(target[key], source[key], options); 25207 else destination[key] = cloneUnlessOtherwiseSpecified(source[key], options); 25208 }); 25209 return destination; 25210 } 25211 function deepmerge(target, source, options) { 25212 options = options || {}; 25213 options.arrayMerge = options.arrayMerge || defaultArrayMerge; 25214 options.isMergeableObject = options.isMergeableObject || isMergeableObject; 25215 // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge() 25216 // implementations can use it. The caller may not replace it. 25217 options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified; 25218 var sourceIsArray = Array.isArray(source); 25219 var targetIsArray = Array.isArray(target); 25220 var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray; 25221 if (!sourceAndTargetTypesMatch) return cloneUnlessOtherwiseSpecified(source, options); 25222 else if (sourceIsArray) return options.arrayMerge(target, source, options); 25223 else return mergeObject(target, source, options); 25224 } 25225 deepmerge.all = function deepmergeAll(array, options) { 25226 if (!Array.isArray(array)) throw new Error('first argument should be an array'); 25227 return array.reduce(function(prev, next) { 25228 return deepmerge(prev, next, options); 25229 }, {}); 25230 }; 25231 var deepmerge_1 = deepmerge; 25232 module1.exports = deepmerge_1; 25233 /***/ }, 25234 /***/ 221: /***/ function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 25235 __webpack_require__.r(__webpack_exports__); 25236 /* harmony export */ __webpack_require__.d(__webpack_exports__, { 25237 /* harmony export */ "default": function() { 25238 return /* binding */ Fuse; 25239 } 25240 }); 25241 /** 25242 * Fuse.js v6.6.2 - Lightweight fuzzy-search (http://fusejs.io) 25243 * 25244 * Copyright (c) 2022 Kiro Risk (http://kiro.me) 25245 * All Rights Reserved. Apache Software License 2.0 25246 * 25247 * http://www.apache.org/licenses/LICENSE-2.0 25248 */ function isArray(value) { 25249 return !Array.isArray ? getTag(value) === '[object Array]' : Array.isArray(value); 25250 } 25251 // Adapted from: https://github.com/lodash/lodash/blob/master/.internal/baseToString.js 25252 const INFINITY = 1 / 0; 25253 function baseToString(value) { 25254 // Exit early for strings to avoid a performance hit in some environments. 25255 if (typeof value == 'string') return value; 25256 let result = value + ''; 25257 return result == '0' && 1 / value == -INFINITY ? '-0' : result; 25258 } 25259 function toString(value) { 25260 return value == null ? '' : baseToString(value); 25261 } 25262 function isString(value) { 25263 return typeof value === 'string'; 25264 } 25265 function isNumber(value) { 25266 return typeof value === 'number'; 25267 } 25268 // Adapted from: https://github.com/lodash/lodash/blob/master/isBoolean.js 25269 function isBoolean(value) { 25270 return value === true || value === false || isObjectLike(value) && getTag(value) == '[object Boolean]'; 25271 } 25272 function isObject(value) { 25273 return typeof value === 'object'; 25274 } 25275 // Checks if `value` is object-like. 25276 function isObjectLike(value) { 25277 return isObject(value) && value !== null; 25278 } 25279 function isDefined(value) { 25280 return value !== undefined && value !== null; 25281 } 25282 function isBlank(value) { 25283 return !value.trim().length; 25284 } 25285 // Gets the `toStringTag` of `value`. 25286 // Adapted from: https://github.com/lodash/lodash/blob/master/.internal/getTag.js 25287 function getTag(value) { 25288 return value == null ? value === undefined ? '[object Undef
25288ined]' : '[object Null]' : Object.prototype.toString.call(value); 25289 } 25290 const EXTENDED_SEARCH_UNAVAILABLE = 'Extended search is not available'; 25291 const INCORRECT_INDEX_TYPE = "Incorrect 'index' type"; 25292 const LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY = (key)=>`Invalid value for key ${key}`; 25293 const PATTERN_LENGTH_TOO_LARGE = (max)=>`Pattern length exceeds max of ${max}.`; 25294 const MISSING_KEY_PROPERTY = (name)=>`Missing ${name} property in key`; 25295 const INVALID_KEY_WEIGHT_VALUE = (key)=>`Property 'weight' in key '${key}' must be a positive integer`; 25296 const hasOwn = Object.prototype.hasOwnProperty; 25297 class KeyStore { 25298 constructor(keys){ 25299 this._keys = []; 25300 this._keyMap = {}; 25301 let totalWeight = 0; 25302 keys.forEach((key)=>{ 25303 let obj = createKey(key); 25304 totalWeight += obj.weight; 25305 this._keys.push(obj); 25306 this._keyMap[obj.id] = obj; 25307 totalWeight += obj.weight; 25308 }); 25309 // Normalize weights so that their sum is equal to 1 25310 this._keys.forEach((key)=>{ 25311 key.weight /= totalWeight; 25312 }); 25313 } 25314 get(keyId) { 25315 return this._keyMap[keyId]; 25316 } 25317 keys() { 25318 return this._keys; 25319 } 25320 toJSON() { 25321 return JSON.stringify(this._keys); 25322 } 25323 } 25324 function createKey(key) { 25325 let path = null; 25326 let id = null; 25327 let src = null; 25328 let weight = 1; 25329 let getFn = null; 25330 if (isString(key) || isArray(key)) { 25331 src = key; 25332 path = createKeyPath(key); 25333 id = createKeyId(key); 25334 } else { 25335 if (!hasOwn.call(key, 'name')) throw new Error(MISSING_KEY_PROPERTY('name')); 25336 const name = key.name; 25337 src = name; 25338 if (hasOwn.call(key, 'weight')) { 25339 weight = key.weight; 25340 if (weight <= 0) throw new Error(INVALID_KEY_WEIGHT_VALUE(name)); 25341 } 25342 path = createKeyPath(name); 25343 id = createKeyId(name); 25344 getFn = key.getFn; 25345 } 25346 return { 25347 path, 25348 id, 25349 weight, 25350 src, 25351 getFn 25352 }; 25353 } 25354 function createKeyPath(key) { 25355 return isArray(key) ? key : key.split('.'); 25356 } 25357 function createKeyId(key) { 25358 return isArray(key) ? key.join('.') : key; 25359 } 25360 function get(obj, path) { 25361 let list = []; 25362 let arr = false; 25363 const deepGet = (obj, path, index)=>{ 25364 if (!isDefined(obj)) return; 25365 if (!path[index]) // If there's no path left, we've arrived at the object we care about. 25366 list.push(obj); 25367 else { 25368 let key = path[index]; 25369 const value = obj[key]; 25370 if (!isDefined(value)) return; 25371 // If we're at the last value in the path, and if it's a string/number/bool, 25372 // add it to the list 25373 if (index === path.length - 1 && (isString(value) || isNumber(value) || isBoolean(value))) list.push(toString(value)); 25374 else if (isArray(value)) { 25375 arr = true; 25376 // Search each item in the array. 25377 for(let i = 0, len = value.length; i < len; i += 1)deepGet(value[i], path, index + 1); 25378 } else if (path.length) // An object. Recurse further. 25379 deepGet(value, path, index + 1); 25380 } 25381 }; 25382 // Backwards compatibility (since path used to be a string) 25383 deepGet(obj, isString(path) ? path.split('.') : path, 0); 25384 return arr ? list : list[0]; 25385 } 25386 const MatchOptions = { 25387 // Whether the matches should be included in the result set. When `true`, each record in the result 25388 // set will include the indices of the matched characters. 25389 // These can consequently be used for highlighting purposes. 25390 includeMatches: false, 25391 // When `true`, the matching function will continue to the end of a search pattern even if 25392 // a perfect match has already been located in the string. 25393 findAllMatches: false, 25394 // Minimum number of characters that must be matched before a result is considered a match 25395 minMatchCharLength: 1 25396 }; 25397 const BasicOptions = { 25398 // When `true`, the algorithm continues searching to the end of the input even if a perfect 25399 // match is found before the end of the same input. 25400 isCaseSensitive: false, 25401 // When true, the matching function will continue to the end of a search pattern even if 25402 includeScore: false, 25403 // List of properties that will be searched. This also supports nested properties. 25404 keys: [], 25405 // Whether to sort the result list, by score 25406 shouldSort: true, 25407 // Default sort function: sort by ascending score, ascending index 25408 sortFn: (a, b)=>a.score === b.score ? a.idx < b.idx ? -1 : 1 : a.score < b.score ? -1 : 1 25409 }; 25410 const FuzzyOptions = { 25411 // Approximately where in the text is the pattern expected to be found? 25412 location: 0, 25413 // At what point does the match algorithm give up. A threshold of '0.0' requires a perfect match 25414 // (of both letters and location), a threshold of '1.0' would match anything. 25415 threshold: 0.6, 25416 // Determines how close the match must be to the fuzzy location (specified above). 25417 // An exact letter match which is 'distance' characters away from the fuzzy location 25418 // would score as a complete mismatch. A distance of '0' requires the match be at 25419 // the exact location specified, a threshold of '1000' would require a perfect match 25420 // to be within 800 characters of the fuzzy location to be found using a 0.8 threshold. 25421 distance: 100 25422 }; 25423 const AdvancedOptions = { 25424 // When `true`, it enables the use of unix-like search commands 25425 useExtendedSearch: false, 25426 // The get function to use when fetching an object's properties. 25427 // The default will search nested paths *ie foo.bar.baz* 25428 getFn: get, 25429 // When `true`, search will ignore `location` and `distance`, so it won't matter 25430 // where in the string the pattern appears. 25431 // More info: https://fusejs.io/concepts/scoring-theory.html#fuzziness-score 25432 ignoreLocation: false, 25433 // When `true`, the calculation for the relevance score (used for sorting) will 25434 // ignore the field-length norm. 25435 // More info: https://fusejs.io/concepts/scoring-theory.html#field-length-norm 25436 ignoreFieldNorm: false, 25437 // The weight to determine how much field length norm effects scoring. 25438 fieldNormWeight: 1 25439 }; 25440 var Config = { 25441 ...BasicOptions, 25442 ...MatchOptions, 25443 ...FuzzyOptions, 25444 ...AdvancedOptions 25445 }; 25446 const SPACE = /[^ ]+/g; 25447 // Field-length norm: the shorter the field, the higher the weight. 25448 // Set to 3 decimals to reduce index size. 25449 function norm(weight = 1, mantissa = 3) { 25450 const cache = new Map(); 25451 const m = Math.pow(10, mantissa); 25452 return { 25453 get (value) { 25454 const numTokens = value.match(SPACE).length; 25455 if (cache.has(numTokens)) return cache.get(numTokens); 25456 // Default function is 1/sqrt(x), weight makes that variable 25457 const norm = 1 / Math.pow(numTokens, 0.5 * weight); 25458 // In place of `toFixed(mantissa)`, for faster computation 25459 const n = parseFloat(Math.round(norm * m) / m); 25460 cache.set(numTokens, n); 25461 return n; 25462 }, 25463 clear () { 25464 cache.clear(); 25465 } 25466 }; 25467 } 25468 class FuseIndex { 25469 constructor({ getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}){ 25470 this.norm = norm(fieldNormWeight, 3); 25471 this.getFn = getFn; 25472 this.isCreated = false;
vendor: 12,384 bytes, lines 25473-25705
25473 this.setIndexRecords(); 25474 } 25475 setSources(docs = []) { 25476 this.docs = docs; 25477 } 25478 setIndexRecords(records = []) { 25479 this.records = records; 25480 } 25481 setKeys(keys = []) { 25482 this.keys = keys; 25483 this._keysMap = {}; 25484 keys.forEach((key, idx)=>{ 25485 this._keysMap[key.id] = idx; 25486 }); 25487 } 25488 create() { 25489 if (this.isCreated || !this.docs.length) return; 25490 this.isCreated = true; 25491 // List is Array<String> 25492 if (isString(this.docs[0])) this.docs.forEach((doc, docIndex)=>{ 25493 this._addString(doc, docIndex); 25494 }); 25495 else // List is Array<Object> 25496 this.docs.forEach((doc, docIndex)=>{ 25497 this._addObject(doc, docIndex); 25498 }); 25499 this.norm.clear(); 25500 } 25501 // Adds a doc to the end of the index 25502 add(doc) { 25503 const idx = this.size(); 25504 if (isString(doc)) this._addString(doc, idx); 25505 else this._addObject(doc, idx); 25506 } 25507 // Removes the doc at the specified index of the index 25508 removeAt(idx) { 25509 this.records.splice(idx, 1); 25510 // Change ref index of every subsquent doc 25511 for(let i = idx, len = this.size(); i < len; i += 1)this.records[i].i -= 1; 25512 } 25513 getValueForItemAtKeyId(item, keyId) { 25514 return item[this._keysMap[keyId]]; 25515 } 25516 size() { 25517 return this.records.length; 25518 } 25519 _addString(doc, docIndex) { 25520 if (!isDefined(doc) || isBlank(doc)) return; 25521 let record = { 25522 v: doc, 25523 i: docIndex, 25524 n: this.norm.get(doc) 25525 }; 25526 this.records.push(record); 25527 } 25528 _addObject(doc, docIndex) { 25529 let record = { 25530 i: docIndex, 25531 $: {} 25532 }; 25533 // Iterate over every key (i.e, path), and fetch the value at that key 25534 this.keys.forEach((key, keyIndex)=>{ 25535 let value = key.getFn ? key.getFn(doc) : this.getFn(doc, key.path); 25536 if (!isDefined(value)) return; 25537 if (isArray(value)) { 25538 let subRecords = []; 25539 const stack = [ 25540 { 25541 nestedArrIndex: -1, 25542 value 25543 } 25544 ]; 25545 while(stack.length){ 25546 const { nestedArrIndex, value } = stack.pop(); 25547 if (!isDefined(value)) continue; 25548 if (isString(value) && !isBlank(value)) { 25549 let subRecord = { 25550 v: value, 25551 i: nestedArrIndex, 25552 n: this.norm.get(value) 25553 }; 25554 subRecords.push(subRecord); 25555 } else if (isArray(value)) value.forEach((item, k)=>{ 25556 stack.push({ 25557 nestedArrIndex: k, 25558 value: item 25559 }); 25560 }); 25561 } 25562 record.$[keyIndex] = subRecords; 25563 } else if (isString(value) && !isBlank(value)) { 25564 let subRecord = { 25565 v: value, 25566 n: this.norm.get(value) 25567 }; 25568 record.$[keyIndex] = subRecord; 25569 } 25570 }); 25571 this.records.push(record); 25572 } 25573 toJSON() { 25574 return { 25575 keys: this.keys, 25576 records: this.records 25577 }; 25578 } 25579 } 25580 function createIndex(keys, docs, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) { 25581 const myIndex = new FuseIndex({ 25582 getFn, 25583 fieldNormWeight 25584 }); 25585 myIndex.setKeys(keys.map(createKey)); 25586 myIndex.setSources(docs); 25587 myIndex.create(); 25588 return myIndex; 25589 } 25590 function parseIndex(data, { getFn = Config.getFn, fieldNormWeight = Config.fieldNormWeight } = {}) { 25591 const { keys, records } = data; 25592 const myIndex = new FuseIndex({ 25593 getFn, 25594 fieldNormWeight 25595 }); 25596 myIndex.setKeys(keys); 25597 myIndex.setIndexRecords(records); 25598 return myIndex; 25599 } 25600 function computeScore$1(pattern, { errors = 0, currentLocation = 0, expectedLocation = 0, distance = Config.distance, ignoreLocation = Config.ignoreLocation } = {}) { 25601 const accuracy = errors / pattern.length; 25602 if (ignoreLocation) return accuracy; 25603 const proximity = Math.abs(expectedLocation - currentLocation); 25604 if (!distance) // Dodge divide by zero error. 25605 return proximity ? 1.0 : accuracy; 25606 return accuracy + proximity / distance; 25607 } 25608 function convertMaskToIndices(matchmask = [], minMatchCharLength = Config.minMatchCharLength) { 25609 let indices = []; 25610 let start = -1; 25611 let end = -1; 25612 let i = 0; 25613 for(let len = matchmask.length; i < len; i += 1){ 25614 let match = matchmask[i]; 25615 if (match && start === -1) start = i; 25616 else if (!match && start !== -1) { 25617 end = i - 1; 25618 if (end - start + 1 >= minMatchCharLength) indices.push([ 25619 start, 25620 end 25621 ]); 25622 start = -1; 25623 } 25624 } 25625 // (i-1 - start) + 1 => i - start 25626 if (matchmask[i - 1] && i - start >= minMatchCharLength) indices.push([ 25627 start, 25628 i - 1 25629 ]); 25630 return indices; 25631 } 25632 // Machine word size 25633 const MAX_BITS = 32; 25634 function search(text, pattern, patternAlphabet, { location = Config.location, distance = Config.distance, threshold = Config.threshold, findAllMatches = Config.findAllMatches, minMatchCharLength = Config.minMatchCharLength, includeMatches = Config.includeMatches, ignoreLocation = Config.ignoreLocation } = {}) { 25635 if (pattern.length > MAX_BITS) throw new Error(PATTERN_LENGTH_TOO_LARGE(MAX_BITS)); 25636 const patternLen = pattern.length; 25637 // Set starting location at beginning text and initialize the alphabet. 25638 const textLen = text.length; 25639 // Handle the case when location > text.length 25640 const expectedLocation = Math.max(0, Math.min(location, textLen)); 25641 // Highest score beyond which we give up. 25642 let currentThreshold = threshold; 25643 // Is there a nearby exact match? (speedup) 25644 let bestLocation = expectedLocation; 25645 // Performance: only computer matches when the minMatchCharLength > 1 25646 // OR if `includeMatches` is true. 25647 const computeMatches = minMatchCharLength > 1 || includeMatches; 25648 // A mask of the matches, used for building the indices 25649 const matchMask = computeMatches ? Array(textLen) : []; 25650 let index; 25651 // Get all exact matches, here for speed up 25652 while((index = text.indexOf(pattern, bestLocation)) > -1){ 25653 let score = computeScore$1(pattern, { 25654 currentLocation: index, 25655 expectedLocation, 25656 distance, 25657 ignoreLocation 25658 }); 25659 currentThreshold = Math.min(score, currentThreshold); 25660 bestLocation = index + patternLen; 25661 if (computeMatches) { 25662 let i = 0; 25663 while(i < patternLen){ 25664 matchMask[index + i] = 1; 25665 i += 1; 25666 } 25667 } 25668 } 25669 // Reset the best location 25670 bestLocation = -1; 25671 let lastBitArr = []; 25672 let finalScore = 1; 25673 let binMax = patternLen + textLen; 25674 const mask = 1 << patternLen - 1; 25675 for(let i = 0; i < patternLen; i += 1){ 25676 // Scan for the best match; each iteration allows for one more error. 25677 // Run a binary search to determine how far from the match location we can stray 25678 // at this error level. 25679 let binMin = 0; 25680 let binMid = binMax; 25681 while(binMin < binMid){ 25682 const score = computeScore$1(pattern, { 25683 errors: i, 25684 currentLocation: expectedLocation + binMid, 25685 expectedLocation, 25686 distance, 25687 ignoreLocation 25688 }); 25689 if (score <= currentThreshold) binMin = binMid; 25690 else binMax = binMid; 25691 binMid = Math.floor((binMax - binMin) / 2 + binMin); 25692 } 25693 // Use the result from this iteration as the maximum for the next. 25694 binMax = binMid; 25695 let start = Math.max(1, expectedLocation - binMid + 1); 25696 let finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen; 25697 // Initialize the bit array 25698 let bitArr = Array(finish + 2); 25699 bitArr[finish + 1] = (1 << i) - 1; 25700 for(let j = finish; j >= start; j -= 1){ 25701 let currentLocation = j - 1; 25702 let charMatch = patternAlphabet[text.charAt(currentLocation)]; 25703 if (computeMatches) // Speed up: quick bool to int conversion (i.e, `charMatch ? 1 : 0`) 25704 matchMask[currentLocation] = +!!charMatch; 25705 // First pass: exact match
25706 bitArr[j] = (bitArr[j + 1] << 1 | 1) & charMatch; 25707 // Subsequent passes: fuzzy match 25708 if (i) bitArr[j] |= (lastBitArr[j + 1] | lastBitArr[j]) << 1 | 1 | lastBitArr[j + 1]; 25709 if (bitArr[j] & mask) { 25710 finalScore = computeScore$1(pattern, { 25711 errors: i, 25712 currentLocation, 25713 expectedLocation, 25714 distance, 25715 ignoreLocation 25716 }); 25717 // This match will almost certainly be better than any existing match. 25718 // But check anyway. 25719 if (finalScore <= currentThreshold) { 25720 // Indeed it is 25721 currentThreshold = finalScore; 25722 bestLocation = currentLocation; 25723 // Already passed `loc`, downhill from here on in. 25724 if (bestLocation <= expectedLocation) break; 25725 // When passing `bestLocation`, don't exceed our current distance from `expectedLocation`. 25726 start = Math.max(1, 2 * expectedLocation - bestLocation); 25727 } 25728 } 25729 } 25730 // No hope for a (better) match at greater error levels. 25731 const score = computeScore$1(pattern, { 25732 errors: i + 1, 25733 currentLocation: expectedLocation, 25734 expectedLocation, 25735 distance, 25736 ignoreLocation 25737 }); 25738 if (score > currentThreshold) break; 25739 lastBitArr = bitArr; 25740 } 25741 const result = { 25742 isMatch: bestLocation >= 0, 25743 // Count exact matches (those with a score of 0) to be "almost" exact 25744 score: Math.max(0.001, finalScore) 25745 }; 25746 if (computeMatches) { 25747 const indices = convertMaskToIndices(matchMask, minMatchCharLength); 25748 if (!indices.length) result.isMatch = false; 25749 else if (includeMatches) result.indices = indices; 25750 } 25751 return result; 25752 } 25753 function createPatternAlphabet(pattern) { 25754 let mask = {}; 25755 for(let i = 0, len = pattern.length; i < len; i += 1){ 25756 const char = pattern.charAt(i); 25757 mask[char] = (mask[char] || 0) | 1 << len - i - 1; 25758 } 25759 return mask; 25760 } 25761 class BitapSearch { 25762 constructor(pattern, { location = Config.location, threshold = Config.threshold, distance = Config.distance, includeMatches = Config.includeMatches, findAllMatches = Config.findAllMatches, minMatchCharLength = Config.minMatchCharLength, isCaseSensitive = Config.isCaseSensitive, ignoreLocation = Config.ignoreLocation } = {}){ 25763 this.options = { 25764 location, 25765 threshold, 25766 distance, 25767 includeMatches, 25768 findAllMatches, 25769 minMatchCharLength, 25770 isCaseSensitive, 25771 ignoreLocation 25772 }; 25773 this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase(); 25774 this.chunks = []; 25775 if (!this.pattern.length) return; 25776 const addChunk = (pattern, startIndex)=>{ 25777 this.chunks.push({ 25778 pattern, 25779 alphabet: createPatternAlphabet(pattern), 25780 startIndex 25781 }); 25782 }; 25783 const len = this.pattern.length; 25784 if (len > MAX_BITS) { 25785 let i = 0; 25786 const remainder = len % MAX_BITS; 25787 const end = len - remainder; 25788 while(i < end){ 25789 addChunk(this.pattern.substr(i, MAX_BITS), i); 25790 i += MAX_BITS; 25791 } 25792 if (remainder) { 25793 const startIndex = len - MAX_BITS; 25794 addChunk(this.pattern.substr(startIndex), startIndex); 25795 } 25796 }
25796 else addChunk(this.pattern, 0); 25797 } 25798 searchIn(text) { 25799 const { isCaseSensitive, includeMatches } = this.options; 25800 if (!isCaseSensitive) text = text.toLowerCase(); 25801 // Exact match 25802 if (this.pattern === text) { 25803 let result = { 25804 isMatch: true, 25805 score: 0 25806 }; 25807 if (includeMatches) result.indices = [ 25808 [ 25809 0, 25810 text.length - 1 25811 ] 25812 ]; 25813 return result; 25814 } 25815 // Otherwise, use Bitap algorithm 25816 const { location, distance, threshold, findAllMatches, minMatchCharLength, ignoreLocation } = this.options; 25817 let allIndices = []; 25818 let totalScore = 0; 25819 let hasMatches = false; 25820 this.chunks.forEach(({ pattern, alphabet, startIndex })=>{ 25821 const { isMatch, score, indices } = search(text, pattern, alphabet, { 25822 location: location + startIndex, 25823 distance, 25824 threshold, 25825 findAllMatches, 25826 minMatchCharLength, 25827 includeMatches, 25828 ignoreLocation 25829 }); 25830 if (isMatch) hasMatches = true;
vendor: 16,602 bytes, lines 25831-26204
25831 totalScore += score; 25832 if (isMatch && indices) allIndices = [ 25833 ...allIndices, 25834 ...indices 25835 ]; 25836 }); 25837 let result = { 25838 isMatch: hasMatches, 25839 score: hasMatches ? totalScore / this.chunks.length : 1 25840 }; 25841 if (hasMatches && includeMatches) result.indices = allIndices; 25842 return result; 25843 } 25844 } 25845 class BaseMatch { 25846 constructor(pattern){ 25847 this.pattern = pattern; 25848 } 25849 static isMultiMatch(pattern) { 25850 return getMatch(pattern, this.multiRegex); 25851 } 25852 static isSingleMatch(pattern) { 25853 return getMatch(pattern, this.singleRegex); 25854 } 25855 search() {} 25856 } 25857 function getMatch(pattern, exp) { 25858 const matches = pattern.match(exp); 25859 return matches ? matches[1] : null; 25860 } 25861 // Token: 'file 25862 class ExactMatch extends BaseMatch { 25863 constructor(pattern){ 25864 super(pattern); 25865 } 25866 static get type() { 25867 return 'exact'; 25868 } 25869 static get multiRegex() { 25870 return /^="(.*)"$/; 25871 } 25872 static get singleRegex() { 25873 return /^=(.*)$/; 25874 } 25875 search(text) { 25876 const isMatch = text === this.pattern; 25877 return { 25878 isMatch, 25879 score: isMatch ? 0 : 1, 25880 indices: [ 25881 0, 25882 this.pattern.length - 1 25883 ] 25884 }; 25885 } 25886 } 25887 // Token: !fire 25888 class InverseExactMatch extends BaseMatch { 25889 constructor(pattern){ 25890 super(pattern); 25891 } 25892 static get type() { 25893 return 'inverse-exact'; 25894 } 25895 static get multiRegex() { 25896 return /^!"(.*)"$/; 25897 } 25898 static get singleRegex() { 25899 return /^!(.*)$/; 25900 } 25901 search(text) { 25902 const index = text.indexOf(this.pattern); 25903 const isMatch = index === -1; 25904 return { 25905 isMatch, 25906 score: isMatch ? 0 : 1, 25907 indices: [ 25908 0, 25909 text.length - 1 25910 ] 25911 }; 25912 } 25913 } 25914 // Token: ^file 25915 class PrefixExactMatch extends BaseMatch { 25916 constructor(pattern){ 25917 super(pattern); 25918 } 25919 static get type() { 25920 return 'prefix-exact'; 25921 } 25922 static get multiRegex() { 25923 return /^\^"(.*)"$/; 25924 } 25925 static get singleRegex() { 25926 return /^\^(.*)$/; 25927 } 25928 search(text) { 25929 const isMatch = text.startsWith(this.pattern); 25930 return { 25931 isMatch, 25932 score: isMatch ? 0 : 1, 25933 indices: [ 25934 0, 25935 this.pattern.length - 1 25936 ] 25937 }; 25938 } 25939 } 25940 // Token: !^fire 25941 class InversePrefixExactMatch extends BaseMatch { 25942 constructor(pattern){ 25943 super(pattern); 25944 } 25945 static get type() { 25946 return 'inverse-prefix-exact'; 25947 } 25948 static get multiRegex() { 25949 return /^!\^"(.*)"$/; 25950 } 25951 static get singleRegex() { 25952 return /^!\^(.*)$/; 25953 } 25954 search(text) { 25955 const isMatch = !text.startsWith(this.pattern); 25956 return { 25957 isMatch, 25958 score: isMatch ? 0 : 1, 25959 indices: [ 25960 0, 25961 text.length - 1 25962 ] 25963 }; 25964 } 25965 } 25966 // Token: .file$ 25967 class SuffixExactMatch extends BaseMatch { 25968 constructor(pattern){ 25969 super(pattern); 25970 } 25971 static get type() { 25972 return 'suffix-exact'; 25973 } 25974 static get multiRegex() { 25975 return /^"(.*)"\$$/; 25976 } 25977 static get singleRegex() { 25978 return /^(.*)\$$/; 25979 } 25980 search(text) { 25981 const isMatch = text.endsWith(this.pattern); 25982 return { 25983 isMatch, 25984 score: isMatch ? 0 : 1, 25985 indices: [ 25986 text.length - this.pattern.length, 25987 text.length - 1 25988 ] 25989 }; 25990 } 25991 } 25992 // Token: !.file$ 25993 class InverseSuffixExactMatch extends BaseMatch { 25994 constructor(pattern){ 25995 super(pattern); 25996 } 25997 static get type() { 25998 return 'inverse-suffix-exact'; 25999 } 26000 static get multiRegex() { 26001 return /^!"(.*)"\$$/; 26002 } 26003 static get singleRegex() { 26004 return /^!(.*)\$$/; 26005 } 26006 search(text) { 26007 const isMatch = !text.endsWith(this.pattern); 26008 return { 26009 isMatch, 26010 score: isMatch ? 0 : 1, 26011 indices: [ 26012 0, 26013 text.length - 1 26014 ] 26015 }; 26016 } 26017 } 26018 class FuzzyMatch extends BaseMatch { 26019 constructor(pattern, { location = Config.location, threshold = Config.threshold, distance = Config.distance, includeMatches = Config.includeMatches, findAllMatches = Config.findAllMatches, minMatchCharLength = Config.minMatchCharLength, isCaseSensitive = Config.isCaseSensitive, ignoreLocation = Config.ignoreLocation } = {}){ 26020 super(pattern); 26021 this._bitapSearch = new BitapSearch(pattern, { 26022 location, 26023 threshold, 26024 distance, 26025 includeMatches, 26026 findAllMatches, 26027 minMatchCharLength, 26028 isCaseSensitive, 26029 ignoreLocation 26030 }); 26031 } 26032 static get type() { 26033 return 'fuzzy'; 26034 } 26035 static get multiRegex() { 26036 return /^"(.*)"$/; 26037 } 26038 static get singleRegex() { 26039 return /^(.*)$/; 26040 } 26041 search(text) { 26042 return this._bitapSearch.searchIn(text); 26043 } 26044 } 26045 // Token: 'file 26046 class IncludeMatch extends BaseMatch { 26047 constructor(pattern){ 26048 super(pattern); 26049 } 26050 static get type() { 26051 return 'include'; 26052 } 26053 static get multiRegex() { 26054 return /^'"(.*)"$/; 26055 } 26056 static get singleRegex() { 26057 return /^'(.*)$/; 26058 } 26059 search(text) { 26060 let location = 0; 26061 let index; 26062 const indices = []; 26063 const patternLen = this.pattern.length; 26064 // Get all exact matches 26065 while((index = text.indexOf(this.pattern, location)) > -1){ 26066 location = index + patternLen; 26067 indices.push([ 26068 index, 26069 location - 1 26070 ]); 26071 } 26072 const isMatch = !!indices.length; 26073 return { 26074 isMatch, 26075 score: isMatch ? 0 : 1, 26076 indices 26077 }; 26078 } 26079 } 26080 // âOrder is important. DO NOT CHANGE. 26081 const searchers = [ 26082 ExactMatch, 26083 IncludeMatch, 26084 PrefixExactMatch, 26085 InversePrefixExactMatch, 26086 InverseSuffixExactMatch, 26087 SuffixExactMatch, 26088 InverseExactMatch, 26089 FuzzyMatch 26090 ]; 26091 const searchersLen = searchers.length; 26092 // Regex to split by spaces, but keep anything in quotes together 26093 const SPACE_RE = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/; 26094 const OR_TOKEN = '|'; 26095 // Return a 2D array representation of the query, for simpler parsing. 26096 // Example: 26097 // "^core go$ | rb$ | py$ xy$" => [["^core", "go$"], ["rb$"], ["py$", "xy$"]] 26098 function parseQuery(pattern, options = {}) { 26099 return pattern.split(OR_TOKEN).map((item)=>{ 26100 let query = item.trim().split(SPACE_RE).filter((item)=>item && !!item.trim()); 26101 let results = []; 26102 for(let i = 0, len = query.length; i < len; i += 1){ 26103 const queryItem = query[i]; 26104 // 1. Handle multiple query match (i.e, once that are quoted, like `"hello world"`) 26105 let found = false; 26106 let idx = -1; 26107 while(!found && ++idx < searchersLen){ 26108 const searcher = searchers[idx]; 26109 let token = searcher.isMultiMatch(queryItem); 26110 if (token) { 26111 results.push(new searcher(token, options)); 26112 found = true; 26113 } 26114 } 26115 if (found) continue; 26116 // 2. Handle single query matches (i.e, once that are *not* quoted) 26117 idx = -1; 26118 while(++idx < searchersLen){ 26119 const searcher = searchers[idx]; 26120 let token = searcher.isSingleMatch(queryItem); 26121 if (token) { 26122 results.push(new searcher(token, options)); 26123 break; 26124 } 26125 } 26126 } 26127 return results; 26128 }); 26129 } 26130 // These extended matchers can return an array of matches, as opposed 26131 // to a singl match 26132 const MultiMatchSet = new Set([ 26133 FuzzyMatch.type, 26134 IncludeMatch.type 26135 ]); 26136 /** 26137 * Command-like searching 26138 * ====================== 26139 * 26140 * Given multiple search terms delimited by spaces.e.g. `^jscript .python$ ruby !java`, 26141 * search in a given text. 26142 * 26143 * Search syntax: 26144 * 26145 * | Token | Match type | Description | 26146 * | ----------- | -------------------------- | -------------------------------------- | 26147 * | `jscript` | fuzzy-match | Items that fuzzy match `jscript` | 26148 * | `=scheme` | exact-match | Items that are `scheme` | 26149 * | `'python` | include-match | Items that include `python` | 26150 * | `!ruby` | inverse-exact-match | Items that do not include `ruby` | 26151 * | `^java` | prefix-exact-match | Items that start with `java` | 26152 * | `!^earlang` | inverse-prefix-exact-match | Items that do not start with `earlang` | 26153 * | `.js$` | suffix-exact-match | Items that end with `.js` | 26154 * | `!.go$` | inverse-suffix-exact-match | Items that do not end with `.go` | 26155 * 26156 * A single pipe character acts as an OR operator. For example, the following 26157 * query matches entries that start with `core` and end with either`go`, `rb`, 26158 * or`py`. 26159 * 26160 * ``` 26161 * ^core go$ | rb$ | py$ 26162 * ``` 26163 */ class ExtendedSearch { 26164 constructor(pattern, { isCaseSensitive = Config.isCaseSensitive, includeMatches = Config.includeMatches, minMatchCharLength = Config.minMatchCharLength, ignoreLocation = Config.ignoreLocation, findAllMatches = Config.findAllMatches, location = Config.location, threshold = Config.threshold, distance = Config.distance } = {}){ 26165 this.query = null; 26166 this.options = { 26167 isCaseSensitive, 26168 includeMatches, 26169 minMatchCharLength, 26170 findAllMatches, 26171 ignoreLocation, 26172 location, 26173 threshold, 26174 distance 26175 }; 26176 this.pattern = isCaseSensitive ? pattern : pattern.toLowerCase(); 26177 this.query = parseQuery(this.pattern, this.options); 26178 } 26179 static condition(_, options) { 26180 return options.useExtendedSearch; 26181 } 26182 searchIn(text) { 26183 const query = this.query; 26184 if (!query) return { 26185 isMatch: false, 26186 score: 1 26187 }; 26188 const { includeMatches, isCaseSensitive } = this.options; 26189 text = isCaseSensitive ? text : text.toLowerCase(); 26190 let numMatches = 0; 26191 let allIndices = []; 26192 let totalScore = 0; 26193 // ORs 26194 for(let i = 0, qLen = query.length; i < qLen; i += 1){ 26195 const searchers = query[i]; 26196 // Reset indices 26197 allIndices.length = 0; 26198 numMatches = 0; 26199 // ANDs 26200 for(let j = 0, pLen = searchers.length; j < pLen; j += 1){ 26201 const searcher = searchers[j]; 26202 const { isMatch, indices, score } = searcher.search(text); 26203 if (isMatch) { 26204 numMatches += 1;
26205 totalScore += score; 26206 if (includeMatches) { 26207 const type = searcher.constructor.type; 26208 if (MultiMatchSet.has(type)) allIndices = [ 26209 ...allIndices, 26210 ...indices 26211 ]; 26212 else allIndices.push(indices); 26213 } 26214 } else { 26215 totalScore = 0; 26216 numMatches = 0; 26217 allIndices.length = 0; 26218 break; 26219 } 26220 } 26221 // OR condition, so if TRUE, return 26222 if (numMatches) { 26223 let result = { 26224 isMatch: true, 26225 score: totalScore / numMatches 26226 }; 26227 if (includeMatches) result.indices = allIndices; 26228 return result; 26229 } 26230 } 26231 // Nothing was matched 26232 return { 26233 isMatch: false, 26234 score: 1 26235 }; 26236 } 26237 } 26238 const registeredSearchers = []; 26239 function register(...args) { 26240 registeredSearchers.push(...args); 26241 } 26242 function createSearcher(pattern, options) { 26243 for(let i = 0, len = registeredSearchers.length; i < len; i += 1){ 26244 let searcherClass = registeredSearchers[i]; 26245 if (searcherClass.condition(pattern, options)) return new searcherClass(pattern, options); 26246 } 26247 return new BitapSearch(pattern, options); 26248 } 26249 const LogicalOperator = { 26250 AND: '$and', 26251 OR: '$or' 26252 }; 26253 const KeyType = { 26254 PATH: '$path', 26255 PATTERN: '$val' 26256 }; 26257 const isExpression = (query)=>!!(query[LogicalOperator.AND] || query[LogicalOperator.OR]); 26258 const isPath = (query)=>!!query[KeyType.PATH]; 26259 const isLeaf = (query)=>!isArray(query) && isObject(query) && !isExpression(query); 26260 const convertToExplicit = (query)=>({ 26261 [LogicalOperator.AND]: Object.keys(query).map((key)=>({ 26262 [key]: query[key] 26263 })) 26264 }); 26265 // When `auto` is `true`, the parse function will infer and initialize and add 26266 // the appropriate `Searcher` instance 26267 function parse(query, options, { auto = true } = {}) { 26268 const next = (query)=>{ 26269 let keys = Object.keys(query); 26270 const isQueryPath = isPath(query); 26271 if (!isQueryPath && keys.length > 1 && !isExpression(query)) return next(convertToExplicit(query)); 26272 if (isLeaf(query)) { 26273 const key = isQueryPath ? query[KeyType.PATH] : keys[0]; 26274 const pattern = isQueryPath ? query[KeyType.PATTERN] : query[key]; 26275 if (!isString(pattern)) throw new Error(LOGICAL_SEARCH_INVALID_QUERY_FOR_KEY(key)); 26276 const obj = { 26277 keyId: createKeyId(key), 26278 pattern 26279 }; 26280 if (auto) obj.searcher = createSearcher(pattern, options); 26281 return obj; 26282 } 26283 let node = { 26284 children: [], 26285 operator: keys[0] 26286 }; 26287 keys.forEach((key)=>{ 26288 const value = query[key]; 26289 if (isArray(value)) value.forEach((item)=>{ 26290 node.children.push(next(item)); 26291 }); 26292 }); 26293 return node; 26294 }; 26295 if (!isExpression(query)) query = convertToExplicit(query); 26296 return next(query); 26297 } 26298 // Practical scoring function 26299 function computeScore(results, { ignoreFieldNorm = Config.ignoreFieldNorm }) {
26300 results.forEach((result)=>{ 26301 let totalScore = 1; 26302 result.matches.forEach(({ key, norm, score })=>{ 26303 const weight = key ? key.weight : null; 26304 totalScore *= Math.pow(score === 0 && weight ? Number.EPSILON : score, (weight || 1) * (ignoreFieldNorm ? 1 : norm)); 26305 }); 26306 result.score = totalScore; 26307 }); 26308 } 26309 function transformMatches(result, data) { 26310 const matches = result.matches; 26311 data.matches = []; 26312 if (!isDefined(matches)) return; 26313 matches.forEach((match)=>{ 26314 if (!isDefined(match.indices) || !match.indices.length) return; 26315 const { indices, value } = match; 26316 let obj = { 26317 indices, 26318 value 26319 }; 26320 if (match.key) obj.key = match.key.src; 26321 if (match.idx > -1) obj.refIndex = match.idx; 26322 data.matches.push(obj); 26323 }); 26324 } 26325 function transformScore(result, data) { 26326 data.score = result.score; 26327 } 26328 function format(results, docs, { includeMatches = Config.includeMatches, includeScore = Config.includeScore } = {}) { 26329 const transformers = []; 26330 if (includeMatches) transformers.push(transformMatches); 26331 if (includeScore) transformers.push(transformScore); 26332 return results.map((result)=>{ 26333 const { idx } = result; 26334 const data = { 26335 item: docs[idx], 26336 refIndex: idx 26337 }; 26338 if (transformers.length) transformers.forEach((transformer)=>{ 26339 transformer(result, data); 26340 }); 26341 return data; 26342 }); 26343 } 26344 class Fuse { 26345 constructor(docs, options = {}, index){ 26346 this.options = { 26347 ...Config, 26348 ...options 26349 }; 26350 this.options.useExtendedSearch; 26351 this._keyStore = new KeyStore(this.options.keys); 26352 this.setCollection(docs, index); 26353 } 26354 setCollection(docs, index) { 26355 this._docs = docs; 26356 if (index && !(index instanceof FuseIndex)) throw new Error(INCORRECT_INDEX_TYPE); 26357 this._myIndex = index || createIndex(this.options.keys, this._docs, { 26358 getFn: this.options.getFn, 26359 fieldNormWeight: this.options.fieldNormWeight 26360 }); 26361 } 26362 add(doc) { 26363 if (!isDefined(doc)) return; 26364 this._docs.push(doc); 26365 this._myIndex.add(doc); 26366 } 26367 remove(predicate = ()=>false) { 26368 const results = []; 26369 for(let i = 0, len = this._docs.length; i < len; i += 1){ 26370 const doc = this._docs[i]; 26371 if (predicate(doc, i)) { 26372 this.removeAt(i); 26373 i -= 1; 26374 len -= 1; 26375 results.push(doc); 26376 } 26377 } 26378 return results; 26379 } 26380 removeAt(idx) { 26381 this._docs.splice(idx, 1); 26382 this._myIndex.removeAt(idx); 26383 } 26384 getIndex() { 26385 return this._myIndex; 26386 } 26387 search(query, { limit = -1 } = {}) { 26388 const { includeMatches, includeScore, shouldSort, sortFn, ignoreFieldNorm } = this.options; 26389 let results = isString(query) ? isString(this._docs[0]) ? this._searchStringList(query) : this._searchObjectList(query) : this._searchLogical(query); 26390 computeScore(results, { 26391 ignoreFieldNorm 26392 }); 26393 if (shouldSort) results.sort(sortFn); 26394 if (isNumber(limit) && limit > -1) results = results.slice(0, limit); 26395 return format(results, this._docs, { 26396 includeMatches, 26397 includeScore 26398 }); 26399 } 26400 _searchStringList(query) { 26401 const searcher = createSearcher(query, this.options); 26402 const { records } = this._myIndex; 26403 const results = []; 26404 // Iterate over every string in the index 26405 records.forEach(({ v: text, i: idx, n: norm })=>{ 26406 if (!isDefined(text)) return; 26407 const { isMatch, score, indices } = searcher.searchIn(text); 26408 if (isMatch) results.push({ 26409 item: text, 26410 idx, 26411 matches: [ 26412 { 26413 score, 26414 value: text, 26415 norm, 26416 indices 26417 } 26418 ] 26419 }); 26420 }); 26421 return results; 26422 } 26423 _searchLogical(query) { 26424 const expression = parse(query, this.options); 26425 const evaluate = (node, item, idx)=>{ 26426 if (!node.children) { 26427 const { keyId, searcher }
26427 = node; 26428 const matches = this._findMatches({ 26429 key: this._keyStore.get(keyId), 26430 value: this._myIndex.getValueForItemAtKeyId(item, keyId), 26431 searcher 26432 }); 26433 if (matches && matches.length) return [ 26434 { 26435 idx, 26436 item, 26437 matches 26438 } 26439 ]; 26440 return []; 26441 } 26442 const res = []; 26443 for(let i = 0, len = node.children.length; i < len; i += 1){ 26444 const child = node.children[i]; 26445 const result = evaluate(child, item, idx); 26446 if (result.length) res.push(...result); 26447 else if (node.operator === LogicalOperator.AND) return []; 26448 } 26449 return res; 26450 }; 26451 const records = this._myIndex.records; 26452 const resultMap = {}; 26453 const results = []; 26454 records.forEach(({ $: item, i: idx })=>{ 26455 if (isDefined(item)) { 26456 let expResults = evaluate(expression, item, idx); 26457 if (expResults.length) { 26458 // Dedupe when adding 26459 if (!resultMap[idx]) { 26460 resultMap[idx] = { 26461 idx, 26462 item, 26463 matches: [] 26464 }; 26465 results.push(resultMap[idx]); 26466 } 26467 expResults.forEach(({ matches })=>{ 26468 resultMap[idx].matches.push(...matches); 26469 }); 26470 } 26471 } 26472 }); 26473 return results; 26474 } 26475 _searchObjectList(query) { 26476 const searcher = createSearcher(query, this.options); 26477 const { keys, records } = this._myIndex; 26478 const results = []; 26479 // List is Array<Object> 26480 records.forEach(({ $: item, i: idx })=>{ 26481 if (!isDefined(item)) return; 26482 let matches = []; 26483 // Iterate over every key (i.e, path), and fetch the value at that key 26484 keys.forEach((key, keyIndex)=>{ 26485 matches.push(...this._findMatches({ 26486 key, 26487 value: item[keyIndex], 26488 searcher 26489 })); 26490 }); 26491 if (matches.length) results.push({ 26492 idx, 26493 item, 26494 matches 26495 }); 26496 }); 26497 return results; 26498 } 26499 _findMatches({ key, value, searcher }) { 26500 if (!isDefined(value)) return []; 26501 let matches = []; 26502 if (isArray(value)) value.forEach(({ v: text, i: idx, n: norm })=>{ 26503 if (!isDefined(text)) return; 26504 const { isMatch, score, indices } = searcher.searchIn(text); 26505 if (isMatch) matches.push({ 26506 score, 26507 key, 26508 value: text, 26509 idx, 26510 norm, 26511 indices 26512 }); 26513 }); 26514 else { 26515 const { v: text, n: norm } = value; 26516 const { isMatch, score, indices } = searcher.searchIn(text); 26517 if (isMatch) matches.push({ 26518 score, 26519 key, 26520 value: text, 26521 norm, 26522 indices 26523 }); 26524 } 26525 return matches; 26526 } 26527 } 26528 Fuse.version = '6.6.2'; 26529 Fuse.createIndex = createIndex; 26530 Fuse.parseIndex = parseIndex; 26531 Fuse.config = Config; 26532 Fuse.parseQuery = parse; 26533 register(ExtendedSearch); 26534 /***/ },
vendor: 4,151 bytes, lines 26535-26611
26535 /***/ 791: /***/ function(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 26536 // ESM COMPAT FLAG 26537 __webpack_require__.r(__webpack_exports__); 26538 // EXPORTS 26539 __webpack_require__.d(__webpack_exports__, { 26540 "__DO_NOT_USE__ActionTypes": function() { 26541 return /* binding */ ActionTypes; 26542 }, 26543 "applyMiddleware": function() { 26544 return /* binding */ applyMiddleware; 26545 }, 26546 "bindActionCreators": function() { 26547 return /* binding */ bindActionCreators; 26548 }, 26549 "combineReducers": function() { 26550 return /* binding */ combineReducers; 26551 }, 26552 "compose": function() { 26553 return /* binding */ compose; 26554 }, 26555 "createStore": function() { 26556 return /* binding */ createStore; 26557 }, 26558 "legacy_createStore": function() { 26559 return /* binding */ legacy_createStore; 26560 } 26561 }); 26562 function _typeof(obj) { 26563 "@babel/helpers - typeof"; 26564 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj) { 26565 return typeof obj; 26566 } : function(obj) { 26567 return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; 26568 }, _typeof(obj); 26569 } 26570 function _toPrimitive(input, hint) { 26571 if (_typeof(input) !== "object" || input === null) return input; 26572 var prim = input[Symbol.toPrimitive]; 26573 if (prim !== undefined) { 26574 var res = prim.call(input, hint || "default"); 26575 if (_typeof(res) !== "object") return res; 26576 throw new TypeError("@@toPrimitive must return a primitive value."); 26577 } 26578 return (hint === "string" ? String : Number)(input); 26579 } 26580 function _toPropertyKey(arg) { 26581 var key = _toPrimitive(arg, "string"); 26582 return _typeof(key) === "symbol" ? key : String(key); 26583 } 26584 function _defineProperty(obj, key, value) { 26585 key = _toPropertyKey(key); 26586 if (key in obj) Object.defineProperty(obj, key, { 26587 value: value, 26588 enumerable: true, 26589 configurable: true, 26590 writable: true 26591 }); 26592 else obj[key] = value; 26593 return obj; 26594 } 26595 function ownKeys(object, enumerableOnly) { 26596 var keys = Object.keys(object); 26597 if (Object.getOwnPropertySymbols) { 26598 var symbols = Object.getOwnPropertySymbols(object); 26599 enumerableOnly && (symbols = symbols.filter(function(sym) { 26600 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 26601 })), keys.push.apply(keys, symbols); 26602 } 26603 return keys; 26604 } 26605 function _objectSpread2(target) { 26606 for(var i = 1; i < arguments.length; i++){ 26607 var source = null != arguments[i] ? arguments[i] : {}; 26608 i % 2 ? ownKeys(Object(source), !0).forEach(function(key) { 26609 _defineProperty(target, key, source[key]); 26610 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) { 26611 Object.defineProperty(target, key, Ob
26611ject.getOwnPropertyDescriptor(source, key)); 26612 }); 26613 } 26614 return target; 26615 } 26616 /** 26617 * Adapted from React: https://github.com/facebook/react/blob/master/packages/shared/formatProdErrorMessage.js 26618 * 26619 * Do not require this module directly! Use normal throw error calls. These messages will be replaced with error codes 26620 * during build. 26621 * @param {number} code 26622 */ function formatProdErrorMessage(code) { 26623 return "Minified Redux error #" + code + "; visit https://redux.js.org/Errors?code=" + code + " for the full message or " + 'use the non-minified dev environment for full errors. '; 26624 } 26625 // Inlined version of the `symbol-observable` polyfill 26626 var $$observable = function() { 26627 return typeof Symbol === 'function' && Symbol.observable || '@@observable'; 26628 }(); 26629 /** 26630 * These are private action types reserved by Redux. 26631 * For any unknown actions, you must return the current state. 26632 * If the current state is undefined, you must return the initial state. 26633 * Do not reference these action types directly in your code. 26634 */ var randomString = function randomString() { 26635 return Math.random().toString(36).substring(7).split('').join('.'); 26636 }; 26637 var ActionTypes = { 26638 INIT: "@@redux/INIT" + randomString(), 26639 REPLACE: "@@redux/REPLACE" + randomString(), 26640 PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() { 26641 return "@@redux/PROBE_UNKNOWN_ACTION" + randomString(); 26642 } 26643 }; 26644 /** 26645 * @param {any} obj The object to inspect. 26646 * @returns {boolean} True if the argument appears to be a plain object. 26647 */ function isPlainObject(obj) { 26648 if (typeof obj !== 'object' || obj === null) return false; 26649 var proto = obj; 26650 while(Object.getPrototypeOf(proto) !== null)proto = Object.getPrototypeOf(proto); 26651 return Object.getPrototypeOf(obj) === proto; 26652 } 26653 // Inlined / shortened version of `kindOf` from https://github.com/jonschlinkert/kind-of 26654 function miniKindOf(val) { 26655 if (val === void 0) return 'undefined'; 26656 if (val === null) return 'null'; 26657 var type = typeof val; 26658 switch(type){ 26659 case 'boolean': 26660 case 'string': 26661 case 'number': 26662 case 'symbol': 26663 case 'function': 26664 return type; 26665 } 26666 if (Array.isArray(val)) return 'array'; 26667 if (isDate(val)) return 'date'; 26668 if (isError(val)) return 'error'; 26669 var constructorName = ctorName(val); 26670 switch(constructorName){ 26671 case 'Symbol': 26672 case 'Promise': 26673 case 'WeakMap': 26674 case 'WeakSet': 26675 case 'Map': 26676 case 'Set': 26677 return constructorName; 26678 } // other 26679 return type.slice(8, -1).toLowerCase().replace(/\s/g, ''); 26680 } 26681 function ctorName(val) { 26682 return typeof val.constructor === 'function' ? val.constructor.name : null; 26683 } 26684 function isError(val) { 26685 return val instanceof Error || typeof val.message === 'string' && val.constructor && typeof val.constructor.stackTraceLimit === 'number'; 26686 } 26687 function isDate(val) { 26688 if (val instanceof Date) return true; 26689 return typeof val.toDateString === 'function' && typeof val.getDate === 'function' && typeof val.setDate === 'function'; 26690 } 26691 function kindOf(val) { 26692 var typeOfVal = typeof val; 26693 return typeOfVal; 26694 } 26695 /** 26696 * @deprecated 26697 * 26698 * **We recommend using the `configureStore` method 26699 * of the `@reduxjs/toolkit` package**, which replaces `createStore`. 26700 * 26701 * Redux Toolkit is our recommended approach for writing Redux logic today, 26702 * including store setup, reducers, data fetching, and more. 26703 * 26704 * **For more details, please read this Redux docs page:** 26705 * **https://redux.js.org/introduction/why-rtk-is-redux-today** 26706 * 26707 * `configureStore` from Redux Toolkit is an improved version of `createStore` that 26708 * simplifies setup and helps avoid common bugs. 26709 * 26710 * You should not be using the `redux` core package by itself today, except for learning purposes. 26711 * The `createStore` method from the core `redux` package will not be removed, but we encourage 26712 * all users to migrate to using Redux Toolkit for all Redux code. 26713 * 26714 * If you want to use `createStore` without this visual deprecation warning, use 26715 * the `legacy_createStore` import instead: 26716 * 26717 * `import { legacy_createStore as createStore} from 'redux'` 26718 * 26719 */ function createStore(reducer, preloadedState, enhancer) { 26720 var _ref2; 26721 if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') throw new Error(formatProdErrorMessage(0)); 26722 if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') { 26723 enhancer = preloadedState; 26724 preloadedState = undefined; 26725 } 26726 if (typeof enhancer !== 'undefined') { 26727 if (typeof enhancer !== 'function') throw new Error(formatProdErrorMessage(1)); 26728 return enhancer(createStore)(reducer, preloadedState); 26729 } 26730 if (typeof reducer !== 'function') throw new Error(formatProdErrorMessage(2)); 26731 var currentReducer = reducer; 26732 var currentState = preloadedState; 26733 var currentListeners = []; 26734 var nextListeners = currentListeners; 26735 var isDispatching = false;
26736 /** 26737 * This makes a shallow copy of currentListeners so we can use 26738 * nextListeners as a temporary list while dispatching. 26739 * 26740 * This prevents any bugs around consumers calling 26741 * subscribe/unsubscribe in the middle of a dispatch. 26742 */ function ensureCanMutateNextListeners() { 26743 if (nextListeners === currentListeners) nextListeners = currentListeners.slice(); 26744 } 26745 /** 26746 * Reads the state tree managed by the store. 26747 * 26748 * @returns {any} The current state tree of your application. 26749 */ function getState() { 26750 if (isDispatching) throw new Error(formatProdErrorMessage(3)); 26751 return currentState; 26752 } 26753 /** 26754 * Adds a change listener. It will be called any time an action is dispatched, 26755 * and some part of the state tree may potentially have changed. You may then 26756 * call `getState()` to read the current state tree inside the callback. 26757 * 26758 * You may call `dispatch()` from a change listener, with the following 26759 * caveats: 26760 * 26761 * 1. The subscriptions are snapshotted just before every `dispatch()` call. 26762 * If you subscribe or unsubscribe while the listeners are being invoked, this 26763 * will not have any effect on the `dispatch()` that is currently in progress. 26764 * However, the next `dispatch()` call, whether nested or not, will use a more 26765 * recent snapshot of the subscription list. 26766 * 26767 * 2. The listener should not expect to see all state changes, as the state 26768 * might have been updated multiple times during a nested `dispatch()` before 26769 * the listener is called. It is, however, guaranteed that all subscribers 26770 * registered before the `dispatch()` started will be called with the latest 26771 * state by the time it exits. 26772 * 26773 * @param {Function} listener A callback to be invoked on every dispatch. 26774 * @returns {Function} A function to remove this change listener. 26775 */ function subscribe(listener) { 26776 if (typeof listener !== 'function') throw new Error(formatProdErrorMessage(4)); 26777 if (isDispatching) throw new Error(formatProdErrorMessage(5)); 26778 var isSubscribed = true; 26779 ensureCanMutateNextListeners(); 26780 nextListeners.push(listener); 26781 return function unsubscribe() { 26782 if (!isSubscribed) return; 26783 if (isDispatching) throw new Error(formatProdErrorMessage(6)); 26784 isSubscribed = false; 26785 ensureCanMutateNextListeners(); 26786 var index = nextListeners.indexOf(listener); 26787 nextListeners.splice(index, 1); 26788 currentListeners = null; 26789 }; 26790 } 26791 /** 26792 * Dispatches an action. It is the only way to trigger a state change. 26793 * 26794 * The `reducer` function, used to create the store, will be called with the 26795 * current state tree and the given `action`. Its return value will 26796 * be considered the **next** state of the tree, and the change listeners 26797 * will be notified. 26798 * 26799 * The base implementation only supports plain object actions. If you want to 26800 * dispatch a Promise, an Observable, a thunk, or something else, you need to 26801 * wrap your store creating function into the corresponding middleware. For 26802 * example, see the documentation for the `redux-thunk` package. Even the 26803 * middleware will eventually dispatch plain object actions using this method. 26804 * 26805 * @param {Object} action A plain object representing âwhat changedâ. It is 26806 * a good idea to keep actions serializable so you can record and replay user 26807 * sessions, or use the time travelling `redux-devtools`. An action must have 26808 * a `type` property which may not be `undefined`. It is a good idea to use 26809 * string constants for action types. 26810 * 26811 * @returns {Object} For convenience, the same action object you dispatched. 26812 * 26813 * Note that, if you use a custom middleware, it may wrap `dispatch()` to 26814 * return something else (for example, a Promise you can await). 26815 */ function dispatch(action) { 26816 if (!isPlainObject(action)) throw new Error(formatProdErrorMessage(7)); 26817 if (typeof action.type === 'undefined') throw new Error(formatProdErrorMessage(8)); 26818 if (isDispatching) throw new Error(formatProdErrorMessage(9)); 26819 try { 26820 isDispatching = true; 26821 currentState = currentReducer(currentState, action); 26822 } finally{ 26823 isDispatching = false;
26824 } 26825 var listeners = currentListeners = nextListeners; 26826 for(var i = 0; i < listeners.length; i++){ 26827 var listener = listeners[i]; 26828 listener(); 26829 } 26830 return action; 26831 } 26832 /** 26833 * Replaces the reducer currently used by the store to calculate the state. 26834 * 26835 * You might need this if your app implements code splitting and you want to 26836 * load some of the reducers dynamically. You might also need this if you 26837 * implement a hot reloading mechanism for Redux. 26838 * 26839 * @param {Function} nextReducer The reducer for the store to use instead. 26840 * @returns {void} 26841 */ function replaceReducer(nextReducer) { 26842 if (typeof nextReducer !== 'function') throw new Error(formatProdErrorMessage(10)); 26843 currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT. 26844 // Any reducers that existed in both the new and old rootReducer 26845 // will receive the previous state. This effectively populates 26846 // the new state tree with any relevant data from the old one. 26847 dispatch({ 26848 type: ActionTypes.REPLACE 26849 }); 26850 } 26851 /** 26852 * Interoperability point for observable/reactive libraries. 26853 * @returns {observable} A minimal observable of state changes. 26854 * For more information, see the observable proposal: 26855 * https://github.com/tc39/proposal-observable 26856 */ function observable() { 26857 var _ref; 26858 var outerSubscribe = subscribe; 26859 return _ref = { 26860 /** 26861 * The minimal observable subscription method. 26862 * @param {Object} observer Any object that can be used as an observer. 26863 * The observer object should have a `next` method. 26864 * @returns {subscription} An object with an `unsubscribe` method that can 26865 * be used to unsubscribe the observable from the store, and prevent further 26866 * emission of values from the observable. 26867 */ subscribe: function subscribe(observer) { 26868 if (typeof observer !== 'object' || observer === null) throw new Error(formatProdErrorMessage(11)); 26869 function observeState() { 26870 if (observer.next) observer.next(getState()); 26871 } 26872 observeState(); 26873 var unsubscribe = outerSubscribe(observeState); 26874 return { 26875 unsubscribe: unsubscribe 26876 }; 26877 } 26878 }, _ref[$$observable] = function() { 26879 return this; 26880 }, _ref; 26881 } // When a store is created, an "INIT" action is dispatched so that every 26882 // reducer returns their initial state. This effectively populates 26883 // the initial state tree. 26884 dispatch({ 26885 type: ActionTypes.INIT 26886 }); 26887 return _ref2 = { 26888 dispatch: dispatch, 26889 subscribe: subscribe, 26890 getState: getState, 26891 replaceReducer: replaceReducer 26892 }, _ref2[$$observable] = observable, _ref2; 26893 } 26894 /** 26895 * Creates a Redux store that holds the state tree. 26896 * 26897 * **We recommend using `configureStore` from the 26898 * `@reduxjs/toolkit` package**, which replaces `createStore`: 26899 * **https://redux.js.org/introduction/why-rtk-is-redux-today** 26900 * 26901 * The only way to change the data in the store is to call `dispatch()` on it. 26902 *
26903 * There should only be a single store in your app. To specify how different 26904 * parts of the state tree respond to actions, you may combine several reducers 26905 * into a single reducer function by using `combineReducers`. 26906 * 26907 * @param {Function} reducer A function that returns the next state tree, given 26908 * the current state tree and the action to handle. 26909 * 26910 * @param {any} [preloadedState] The initial state. You may optionally specify it 26911 * to hydrate the state from the server in universal apps, or to restore a 26912 * previously serialized user session. 26913 * If you use `combineReducers` to produce the root reducer function, this must be 26914 * an object with the same shape as `combineReducers` keys. 26915 * 26916 * @param {Function} [enhancer] The store enhancer. You may optionally specify it 26917 * to enhance the store with third-party capabilities such as middleware, 26918 * time travel, persistence, etc. The only store enhancer that ships with Redux 26919 * is `applyMiddleware()`. 26920 * 26921 * @returns {Store} A Redux store that lets you read the state, dispatch actions 26922 * and subscribe to changes. 26923 */ var legacy_createStore = createStore; 26924 /** 26925 * Prints a warning in the console if it exists. 26926 * 26927 * @param {String} message The warning message. 26928 * @returns {void} 26929 */ function warning(message) { 26930 /* eslint-disable no-console */ if (typeof console !== 'undefined' && typeof console.error === 'function') console.error(message); 26931 /* eslint-enable no-console */ try { 26932 // This error was thrown as a convenience so that if you enable 26933 // "break on all exceptions" in your console, 26934 // it would pause the execution at this line. 26935 throw new Error(message); 26936 } catch (e) {} // eslint-disable-line no-empty 26937 } 26938 function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unex
26938pectedKeyCache) { 26939 var reducerKeys = Object.keys(reducers); 26940 var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer'; 26941 if (reducerKeys.length === 0) return "Store does not have a valid reducer. Make sure the argument passed to combineReducers is an object whose values are reducers."; 26942 if (!isPlainObject(inputState)) return "The " + argumentName + " has unexpected type of \"" + kindOf(inputState) + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\""); 26943 var unexpectedKeys = Object.keys(inputState).filter(function(key) { 26944 return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key]; 26945 }); 26946 unexpectedKeys.forEach(function(key) { 26947 unexpectedKeyCache[key] = true; 26948 }); 26949 if (action && action.type === ActionTypes.REPLACE) return; 26950 if (unexpectedKeys.length > 0) return "Unexpected " + (unexpectedKeys.length > 1 ? 'keys' : 'key') + " " + ("\"" + unexpectedKeys.join('", "') + "\" found in " + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ("\"" + reducerKeys.join('", "') + "\". Unexpected keys will be ignored."); 26951 } 26952 function assertReducerShape(reducers) { 26953 Object.keys(reducers).forEach(function(key) { 26954 var reducer = reducers[key]; 26955 var initialState = reducer(undefined, { 26956 type: ActionTypes.INIT 26957 }); 26958 if (typeof initialState === 'undefined') throw new Error(formatProdErrorMessage(12)); 26959 if (typeof reducer(undefined, { 26960 type: ActionTypes.PROBE_UNKNOWN_ACTION() 26961 }) === 'undefined') throw new Error(formatProdErrorMessage(13)); 26962 }); 26963 } 26964 /** 26965 * Turns an object whose values are different reducer functions, into a single 26966 * reducer function. It will call every child reducer, and gather their results 26967 * into a single state object, whose keys correspond to the keys of the passed 26968 * reducer functions. 26969 * 26970 * @param {Object} reducers An object whose values correspond to different 26971 * reducer functions that need to be combined into one. One handy way to obtain 26972 * it is to use ES6 `import * as reducers` syntax. The reducers may never return 26973 * undefined for any action. Instead, they should return their initial state 26974 * if the state passed to them was undefined, and the current state for any 26975 * unrecognized action. 26976 * 26977 * @returns {Function} A reducer function that invokes every reducer inside the 26978 * passed object, and builds a state object with the same shape. 26979 */ function combineReducers(reducers) { 26980 var reducerKeys = Object.keys(reducers); 26981 var finalReducers = {}; 26982 for(var i = 0; i < reducerKeys.length; i++){ 26983 var key = reducerKeys[i]; 26984 if (typeof reducers[key] === 'function') finalReducers[key] = reducers[key]; 26985 } 26986 var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same 26987 // keys multiple times. 26988 var unexpectedKeyCache; 26989 var shapeAssertionError; 26990 try { 26991 assertReducerShape(finalReducers); 26992 } catch (e) { 26993 shapeAssertionError = e; 26994 } 26995 return function combination(state, action) { 26996 if (state === void 0) state = {}; 26997 if (shapeAssertionError) throw shapeAssertionError; 26998 var warningMessage; 26999 var hasChanged = false;
27000 var nextState = {}; 27001 for(var _i = 0; _i < finalReducerKeys.length; _i++){ 27002 var _key = finalReducerKeys[_i]; 27003 var reducer = finalReducers[_key]; 27004 var previousStateForKey = state[_key]; 27005 var nextStateForKey = reducer(previousStateForKey, action); 27006 if (typeof nextStateForKey === 'undefined') { 27007 var actionType = action && action.type; 27008 throw new Error(formatProdErrorMessage(14)); 27009 } 27010 nextState[_key] = nextStateForKey; 27011 hasChanged = hasChanged || nextStateForKey !== previousStateForKey; 27012 } 27013 hasChanged = hasChanged || finalReducerKeys.length !== Object.keys(state).length; 27014 return hasChanged ? nextState : state; 27015 }; 27016 } 27017 function bindActionCreator(actionCreator, dispatch) { 27018 return function() { 27019 return dispatch(actionCreator.apply(this, arguments)); 27020 }; 27021 } 27022 /** 27023 * Turns an object whose values are action creators, into an object with the 27024 * same keys, but with every function wrapped into a `dispatch` call so they 27025 * may be invoked directly. This is just a convenience method, as you can call 27026 * `store.dispatch(MyActionCreators.doSomething())` yourself just fine. 27027 * 27028 * For convenience, you can also pass an action creator as the first argument, 27029 * and get a dispatch wrapped function in return. 27030 * 27031 * @param {Function|Object} actionCreators An object whose values are action 27032 * creator functions. One handy way to obtain it is to use ES6 `import * as` 27033 * syntax. You may also pass a single function. 27034 * 27035 * @param {Function} dispatch The `dispatch` function available on your Redux 27036 * store. 27037 * 27038 * @returns {Function|Object} The object mimicking the original object, but with 27039 * every action creator wrapped into the `dispatch` call. If you passed a 27040 * function as `actionCreators`, the return value will also be a single 27041 * function. 27042 */ function bindActionCreators(actionCreators, dispatch) { 27043 if (typeof actionCreators === 'function') return bindActionCreator(actionCreators, dispatch); 27044 if (typeof actionCreators !== 'object' || actionCreators === null) throw new Error(formatProdErrorMessage(16)); 27045 var boundActionCreators = {}; 27046 for(var key in actionCreators){ 27047 var actionCreator = actionCreators[key]; 27048 if (typeof actionCreator === 'function') boundActionCreators[key] = bindActionCreator(actionCreator, dispatch); 27049 } 27050 return boundActionCreators; 27051 } 27052 /** 27053 * Composes single-argument functions from right to left. The rightmost 27054 * function can take multiple arguments as it provides the signature for 27055 * the resulting composite function. 27056 * 27057 * @param {...Function} funcs The functions to compose. 27058 * @returns {Function} A function obtained by composing the argument functions 27059 * from right to left. For example, compose(f, g, h) is identical to doing 27060 * (...args) => f(g(h(...args))). 27061 */ function compose() { 27062 for(var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++)funcs[_key] = arguments[_key]; 27063 if (funcs.length === 0) return function(arg) { 27064 return arg; 27065 }; 27066 if (funcs.length === 1) return funcs[0]; 27067 return funcs.reduce(function(a, b) { 27068 return function() { 27069 return a(b.apply(void 0, arguments)); 27070 }; 27071 }); 27072 } 27073 /** 27074 * Creates a store enhancer that applies middleware to the dispatch method 27075 * of the Redux store. This is handy for a variety of tasks, such as expressing 27076 * asynchronous actions in a concise manner, or logging every action payload. 27077 * 27078 * See `redux-thunk` package as an example of the Redux middleware. 27079 * 27080 * Because middleware is potentially asynchronous, this should be the first 27081 * store enhancer in the composition chain. 27082 *
27083 * Note that each middleware will be given the `dispatch` and `getState` functions 27084 * as named arguments. 27085 * 27086 * @param {...Function} middlewares The middleware chain to be applied. 27087 * @returns {Function} A store enhancer applying the middleware. 27088 */ function applyMiddleware() { 27089 for(var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++)middlewares[_key] = arguments[_key]; 27090 return function(createStore) { 27091 return function() { 27092 var store = createStore.apply(void 0, arguments); 27093 var _dispatch = function dispatch() { 27094 throw new Error(formatProdErrorMessage(15)); 27095 }; 27096 var middlewareAPI = { 27097 getState: store.getState, 27098 dispatch: function dispatch() { 27099 return _dispatch.apply(void 0, arguments); 27100 } 27101 }; 27102 var chain = middlewares.map(function(middleware) { 27103 return middleware(middlewareAPI); 27104 }); 27105 _dispatch = compose.apply(void 0, chain)(store.dispatch); 27106 return _objectSpread2(_objectSpread2({}, store), {}, { 27107 dispatch: _dispatch 27108 }); 27109 }; 27110 }; 27111 } 27112 /* 27113 * This is a dummy function to check if the function name has been altered by minification. 27114 * If the function has been minified and NODE_ENV !== 'production', warn the user. 27115 */ function isCrushed() {} 27116 /***/ } 27117 }; 27118 /************************************************************************/ /******/ // The module cache 27119 /******/ var __webpack_module_cache__ = {}; 27120 /******/ /******/ // The require function 27121 /******/ function __webpack_require__(moduleId) { 27122 /******/ // Check if module is in cache 27123 /******/ var cachedModule = __webpack_module_cache__[moduleId]; 27124 /******/ if (cachedModule !== undefined) /******/ return cachedModule.exports; 27125 /******/ // Create a new module (and put it into the cache) 27126 /******/ var module1 = __webpack_module_cache__[moduleId] = { 27127 /******/ // no module.id needed 27128 /******/ // no module.loaded needed 27129 /******/ exports: {} 27130 }; 27131 /******/ /******/ // Execute the module function 27132 /******/ __webpack_modules__[moduleId].call(module1.exports, module1, module1.exports, __webpack_require__); 27133 /******/ /******/ // Return the exports of the module 27134 /******/ return module1.exports; 27135 /******/ } 27136 /******/ /************************************************************************/ /******/ /* webpack/runtime/compat get default export */ /******/ !function() { 27137 /******/ // getDefaultExport function for compatibility with non-harmony modules 27138 /******/ __webpack_require__.n = function(module1) { 27139 /******/ var getter = module1 && module1.__esModule ? /******/ function() { 27140 return module1['default']; 27141 } : /******/ function() { 27142 return module1; 27143 }; 27144 /******/ __webpack_require__.d(getter, { 27145 a: getter 27146 }); 27147 /******/ return getter; 27148 /******/ }; 27149 /******/ }(); 27150 /******/ /******/ /* webpack/runtime/define property getters */ /******/ !function() { 27151 /******/ // define getter functions for harmony exports 27152 /******/ __webpack_require__.d = function(exports, definition) { 27153 /******/ for(var key in definition)/******/ if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) /******/ Object.defineProperty(exports, key, { 27154 enumerable: true, 27155 get: definition[key] 27156 }); 27157 /******/ }; 27158 /******/ }(); 27159 /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ !function() { 27160 /******/ __webpack_require__.o = function(obj, prop) { 27161 return Object.prototype.hasOwnProperty.call(obj, prop); 27162 }; 27163 /******/ }(); 27164 /******/ /******/ /* webpack/runtime/make namespace object */ /******/ !function() { 27165 /******/ // define __esModule on exports 27166 /******/ __webpack_require__.r = function(exports) { 27167 /******/ if (typeof Symbol !== 'undefined' && Symbol.toStringTag) /******/ Object.defineProperty(exports, Symbol.toStringTag, { 27168 value: 'Module' 27169 }); 27170 /******/ Object.defineProperty(exports, '__esModule', { 27171 value: true 27172 }); 27173 /******/ }; 27174 /******/ }(); 27175 /******/ /************************************************************************/ var __webpack_exports__ = {}; 27176 // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk. 27177 !function() { 27178 /* harmony import */ var _scripts_choices__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(373); 27179 /* harmony import */ var _scripts_choices__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/ __webpack_require__.n(_scripts_choices__WEBPACK_IMPORTED_MODULE_0__); 27180 /* harmony import */ var _scripts_interfaces__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(187); 27181 /* harmony import */ var _scripts_interfaces__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/ __webpack_require__.n(_scripts_interfaces__WEBPACK_IMPORTED_MODULE_1__); 27182 /* harmony import */ var _scripts_constants__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(883); 27183 /* harmony import */ var _scripts_defaults__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(789); 27184 /* harmony import */ var _scripts_templates__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(686); 27185 /* harmony default export */ __webpack_exports__["default"] = _scripts_choices__WEBPACK_IMPORTED_MODULE_0___default(); 27186 }(); 27187 __webpack_exports__ = __webpack_exports__["default"]; 27188 /******/ return __webpack_exports__; 27189 /******/ }(); 27190}); 27191 27192},{}],"eN4G5":[function() {},{}],"feFWD":[function(require,module,exports,__globalThis) { 27193// flatpickr 27194var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 27195var _flatpickr = require("flatpickr"); 27196var _flatpickrDefault = parcelHelpers.interopDefault(_flatpickr); 27197var _flatpickrCss = require("flatpickr/dist/flatpickr.css"); 27198// Choices.js 27199var _choicesJs = require("choices.js"); 27200var _choicesJsDefault = parcelHelpers.interopDefault(_choicesJs); 27201var _choicesCss = require("../../../../node_modules/choices.js/public/assets/styles/choices.css"); 27202var _accessibility = require("../helpers/accessibility"); 27203function initLocationChoices(bookingWidget) { 27204 const locationSelect = bookingWidget.querySelector('.js-hsbw-location'); 27205 if (locationSelect) { 27206 // Destroy existing Choices instance if present 27207 if (locationSelect.choicesInstance) locationSelect.choicesInstance.destroy(); 27208 const choices = new (0, _choicesJsDefault.default)(locationSelect, { 27209 searchEnabled: false,
27210 allowHTML: false, 27211 itemSelectText: '', 27212 classNames: { 27213 containerOuter: 'choices c-hsbw__location-choices' 27214 }, 27215 shouldSort: false 27216 }); 27217 // Set the role attribute to combobox 27218 const choicesContainer = choices.containerOuter.element; 27219 (0, _accessibility.fixChoicesJsAccessibility)(choicesContainer, 'Select a room type'); 27220 (0, _accessibility.removeChoicesJsSingleListAriaSelected)(choicesContainer); 27221 choices.passedElement.element.addEventListener('change', function(e) { 27222 let errorElement = e.target.closest('.c-hsbw__field'); 27223 if (errorElement) errorElement.classList.remove('error'); 27224 }); 27225 choices.passedElement.element.addEventListener('showDropdown', function() { 27226 const parentElement = choices.passedElement.element.closest('.c-hsbw__field-input-wrapper'); 27227 parentElement.classList.add('active'); 27228 }); 27229 choices.passedElement.element.addEventListener('hideDropdown', function() { 27230 const parentElement = choices.passedElement.element.closest('.c-hsbw__field-input-wrapper'); 27231 parentElement.classList.remove('active'); 27232 }); 27233 // Store the instance for potential future destruction 27234 locationSelect.choicesInstance = choices; 27235 } 27236} 27237function initBookkinDatePicker(bookingWidget) { 27238 const datePicker = bookingWidget.querySelector('.js-hsbw-datepicker'); 27239 if (datePicker) { 27240 // Clear any placeholder text that might cause parsing issues 27241 if (datePicker.value === 'Select check in/check out' || datePicker.value === 'Select Date Range') datePicker.value = ''; 27242 // Set default dates to today and tomorrow 27243 const today = new Date(); 27244 const tomorrow = new Date(today); 27245 tomorrow.setDate(tomorrow.getDate() + 1); 27246 const flatpickrInstance = new (0, _flatpickrDefault.default)(datePicker, { 27247 mode: 'range', 27248 dateFormat: 'd M Y', 27249 placeholder: 'Select check in/check out', 27250 allowInput: false, 27251 clickOpens: true, 27252 defaultDate: [ 27253 today, 27254 tomorrow 27255 ], 27256 onChange: function(selectedDates, dateStr, instance) { 27257 if (selectedDates.length === 2) { 27258 const startDate = selectedDates[0]; 27259 const endDate = selectedDates[1]; 27260 const startDateTimestamp = Math.round(new Date(startDate).getTime() / 1000); 27261 const endDateTimestamp = Math.round(new Date(endDate).getTime() / 1000); 27262 datePicker.setAttribute('data-start-date-timestamp', startDateTimestamp); 27263 datePicker.setAttribute('data-end-date-timestamp', endDateTimestamp); 27264 // Set the input value to "Day Month Year - Day Month Year" 27265 const formattedRange = `${instance.formatDate(startDate, 'd M Y')} - ${instance.formatDate(endDate, 'd M Y')}`; 27266 instance.input.value = formattedRange; 27267 } 27268 }, 27269 onOpen: function(selectedDates, dateStr, instance) { 27270 datePicker.parentElement.classList.add('active'); 27271 }, 27272 onClose: function(selectedDates, dateStr, instance) { 27273 datePicker.parentElement.classList.remove('active'); 27274 } 27275 }); 27276 // Set the initial display value and timestamps for today and tomorrow 27277 const formattedRange = `${flatpickrInstance.formatDate(today, 'd M Y')} - ${flatpickrInstance.formatDate(tomorrow, 'd M Y')}`; 27278 datePicker.value = formattedRange; 27279 datePicker.setAttribute('data-start-date-timestamp', Math.round(today.getTime() / 1000)); 27280 datePicker.setAttribute('data-end-date-timestamp', Math.round(tomorrow.getTime() / 1000)); 27281 return datePicker; 27282 } 27283 return null; 27284} 27285const initBookingWidget = (bookingWidget)=>{ 27286 // Initialize the location choices 27287 initLocationChoices(bookingWidget); 27288 // Initialize the booking date picker 27289 initBookkinDatePicker(bookingWidget); 27290 // Setup the rooms/adults/children desktop dropdown panel 27291 initGuestsDropdown(bookingWidget); 27292 // Add booking panel number input controls 27293 initNumberInputControls(bookingWidget); 27294 // Booking widget submission logic 27295 bookingWidgetSubmitHandler(bookingWidget); 27296}; 27297function initGuestsDropdown(bookingWidget) { 27298 createRoom(bookingWidget, 1); 27299 updateGuestsText(bookingWidget); 27300 // Toggle the guests dropdown 27301 const guestsToggle = bookingWidget.querySelector('.js-hsbw-guests-toggle'); 27302 if (guestsToggle) guestsToggle.addEventListener('click', function(e) { 27303 e.preventDefault(); 27304 bookingWidget.classList.toggle('has-guests-dropdown'); 27305 }); 27306 // Hide the guests dropdown when clicking off 27307 bookingWidget.addEventListener('click', function(e) { 27308 let targetIsGuestsDropdown = false;
27309 const target = e.target; 27310 const classesToIgnore = [ 27311 'c-hsbw__guests-dropdown', 27312 'js-hsbw-guests-toggle' 27313 ]; 27314 classesToIgnore.forEach((className)=>{ 27315 if (target.classList.contains(className) || target.closest(`.${className}`)) targetIsGuestsDropdown = true; 27316 }); 27317 if (!targetIsGuestsDropdown) bookingWidget.classList.remove('has-guests-dropdown'); 27318 }); 27319 // Remove room from dropdown 27320 bookingWidget.addEventListener('click', function(e) { 27321 if (e.target.classList.contains('js-hsbw-room-remove')) { 27322 e.preventDefault(); 27323 const roomNum = e.target.getAttribute('data-room'); 27324 const roomElement = bookingWidget.querySelector(`.c-hsbw__room[data-room="${roomNum}"]`); 27325 if (roomElement) roomElement.remove(); 27326 updateRoomIndeces(bookingWidget); 27327 updateGuestsText(bookingWidget); 27328 } 27329 }); 27330 function updateRoomIndeces(bookingWidget) { 27331 const rooms = bookingWidget.querySelectorAll('.c-hsbw__room'); 27332 rooms.forEach((room, index)=>{ 27333 // Update room title 27334 const roomTitleSpan = room.querySelector('.c-hsbw__room-title span'); 27335 if (roomTitleSpan) roomTitleSpan.innerText = `Room ${index + 1}`; 27336 // Update adults/children inputs 27337 }); 27338 } 27339 // Increment no of guests input 27340 bookingWidget.addEventListener('click', function(e) { 27341 if (e.target.classList.contains('js-hsbw-guest-plus')) { 27342 e.preventDefault(); 27343 const numInput = e.target.parentElement.querySelector('input[type=number]'); 27344 if (numInput) { 27345 const currVal = parseFloat(numInput.value); 27346 if (currVal < 8) numInput.value = currVal + 1; 27347 } 27348 updateGuestsText(bookingWidget); 27349 } 27350 }); 27351 // Decrement no of guests input 27352 bookingWidget.addEventListener('click', function(e) { 27353 if (e.target.classList.contains('js-hsbw-guest-minus')) { 27354 e.preventDefault(); 27355 const numInput = e.target.parentElement.querySelector('input[type=number]'); 27356 if (numInput) { 27357 const currVal = parseFloat(numInput.value); 27358 if (numInput.getAttribute('name') === 'adults[]' && currVal > 1) numInput.value = currVal - 1; 27359 else if (numInput.getAttribute('name') === 'children[]' && currVal > 0) numInput.value = currVal - 1; 27360 } 27361 updateGuestsText(bookingWidget); 27362 } 27363 }); 27364 // Add room button 27365 const addRoomButton = bookingWidget.querySelector('.js-hsbw-add-room'); 27366 if (addRoomButton) addRoomButton.addEventListener('click', function(e) { 27367 e.preventDefault(); 27368 const roomNum = bookingWidget.querySelectorAll('.c-hsbw__room').length + 1; 27369 createRoom(bookingWidget, roomNum); 27370 updateGuestsText(bookingWidget); 27371 // Scroll guests dropdown container to bottom 27372 const dropdown = bookingWidget.querySelector('.js-hsbw-guests-dropdown'); 27373 if (dropdown && typeof gsap !== 'undefined') gsap.to(dropdown, { 27374 scrollTop: dropdown.scrollHeight, 27375 duration: 0.8 27376 }); 27377 }); 27378 // Done button 27379 const guestsDoneButton = bookingWidget.querySelector('.js-hsbw-guests-done'); 27380 if (guestsDoneButton) guestsDoneButton.addEventListener('click', function(e) { 27381 e.preventDefault(); 27382 bookingWidget.classList.remove('has-guests-dropdown'); 27383 }); 27384 function updateGuestsText(bookingWidget) { 27385 const rooms = bookingWidget.querySelectorAll('.c-hsbw__room'); 27386 const totalRooms = rooms.length; 27387 let totalAdults = 0; 27388 let totalChildren = 0; 27389 rooms.forEach((room)=>{ 27390 const adultsInput = room.querySelector('input[name="adults[]"]'); 27391 const childrenInput = room.querySelector('input[name="children[]"]'); 27392 if (adultsInput) totalAdults += parseFloat(adultsInput.value); 27393 if (childrenInput) totalChildren += parseFloat(childrenInput.value); 27394 }); 27395 let guestsText = `${totalRooms} Rooms, ${totalAdults} Adults`; 27396 if (totalChildren > 0) guestsText += `, ${totalChildren} Children`; 27397 const guestsToggle = bookingWidget.querySelector('.js-hsbw-guests-toggle'); 27398 if (guestsToggle) guestsToggle.innerText = guestsText; 27399 } 27400 function createRoom(bookingWidget, num) { 27401 if (!num) { 27402 console.warn('No room number provided'); 27403 return; 27404 } 27405 const room = document.createElement('div'); 27406 room.classList.add('c-hsbw__room'); 27407 room.setAttribute('data-room', num); 27408 const removeButton = num == 1 ? '' : `<button class="c-hsbw__room-remove js-hsbw-room-remove" type="button" data-room="${num}">Remove</button>`; 27409 room.innerHTML = ` 27410 <div class="c-hsbw__room-title "> 27411 <span class="f__headline-h5">Room ${num}</span> 27412 ${removeButton} 27413 </div> 27414 <div class="c-hsbw__room-settings"> 27415 <div class="c-hsbw__room-adults | d-flex align-items-center justify-content-between"> 27416 <span class="c-hsbw__room-guest-type-text f__paragraph-small">No. of Adults</span> 27417 <div class="c-hsbw__room-num-input"> 27418 <button class="c-hsbw__room-minus js-hsbw-guest-minus" type="button">-</button> 27419 <input class="f__paragraph-small" type="number" name="adults[]" value="2" min="1" max="8"> 27420 <button class="c-hsbw__room-plus js-hsbw-guest-plus" type="button">+</button> 27421 </div>
27422 </div> 27423 <div class="c-hsbw__room-children | d-flex align-items-center justify-content-between"> 27424 <div class="d-flex flex-column"> 27425 <span class="c-hsbw__room-guest-type-text">No. of Children <span class="c-hsbw__room-small-text">Up to 12 years</span></span> 27426 </div> 27427 <div class="c-hsbw__room-num-input"> 27428 <button class="c-hsbw__room-minus js-hsbw-guest-minus" type="button">-</button> 27429 <input class="f__paragraph-small" type="number" name="children[]" value="0" min="0" max="8"> 27430 <button class="c-hsbw__room-plus js-hsbw-guest-plus" type="button">+</button> 27431 </div> 27432 </div> 27433 </div>`; 27434 // Append room element to div 27435 const guestsDropdown = bookingWidget.querySelector('.js-hsbw-guests-dropdown'); 27436 const addRoomElement = bookingWidget.querySelector('.c-hsbw__guests-dropdown__add-room'); 27437 if (guestsDropdown && addRoomElement) guestsDropdown.insertBefore(room, addRoomElement); 27438 } 27439} 27440// Helper function to serialize form data like jQuery's serializeArray 27441function serializeForm(form) { 27442 const formData = new FormData(form); 27443 const serialized = []; 27444 for (const [name, value] of formData.entries())serialized.push({ 27445 name, 27446 value 27447 }); 27448 return serialized; 27449} 27450function bookingWidgetSubmitHandler() { 27451 // Submit the booking widget from a custom button 27452 const submitButtons = document.querySelectorAll('.js-hsbw-submit'); 27453 submitButtons.forEach((button)=>{ 27454 button.addEventListener('click', function(e) { 27455 e.preventDefault(); 27456 //if button has class 'clicked' then prevent form submission 27457 //VWO JS code will submit the form after it's actions are complete 27458 if (button.classList.contains('vwo-clicked')) return; 27459 const form = button.closest('.js-hsbw-form'); 27460 if (form) { 27461 // Trigger submit event 27462 const submitEvent = new Event('submit', { 27463 bubbles: true, 27464 cancelable: true 27465 }); 27466 form.dispatchEvent(submitEvent); 27467 } 27468 }); 27469 }); 27470 // Build the Raddisson booking URL when the form is submitted 27471 const bookingForms = document.querySelectorAll('.js-hsbw-form'); 27472 bookingForms.forEach((form)=>{ 27473 form.addEventListener('submit', function(e) { 27474 e.preventDefault(); 27475 // Reset errors on new submission 27476 let hasError = false; 27477 const invalidElements = form.querySelectorAll('.js-hsbw-invalid'); 27478 const errorElements = form.querySelectorAll('.error'); 27479 invalidElements.forEach((el)=>el.style.display = 'none'); 27480 errorElements.forEach((el)=>el.classList.remove('error')); 27481 // Get the location of the booking form 27482 let bookingLocation; 27483 if (form.classList.contains('header-booking-form')) bookingLocation = 'header'; 27484 else if (form.classList.contains('mobile-booking-form')) bookingLocation = 'mobile'; 27485 else bookingLocation = 'module'; 27486 // Get start/end date from datepicker 27487 let startDate, endDate; 27488 let datepicker; 27489 // Use the correct datepicker based on the location of the form 27490 if (bookingLocation === 'header') datepicker = form.querySelector('.datepicker-header'); 27491 else if (bookingLocation === 'mobile') datepicker = form.querySelector('.datepicker-mobile'); 27492 else datepicker = form.querySelector('.datepicker-module'); 27493 const startDateTimestamp = datepicker.getAttribute('data-start-date-timestamp'); 27494 const endDateTimestamp = datepicker.getAttribute('data-end-date-timestamp'); 27495 // Check if the dates are valid 27496 if (!startDateTimestamp || !endDateTimestamp) { 27497 hasError = true; 27498 const datepickerElement = form.querySelector('.js-hsbw-datepicker'); 27499 if (datepickerElement) datepickerElement.classList.add('error'); 27500 } 27501 // Check if the location field is empty 27502 const locationSelect = form.querySelector('.js-hsbw-location'); 27503 console.log('locationSelect', locationSelect.value); 27504 if (locationSelect && !locationSelect.value) { 27505 hasError = true; 27506 const selectricElement = form.querySelector('.c-hsbw__field--location'); 27507 if (selectricElement) selectricElement.classList.add('error'); 27508 } 27509 // If there are any errors, prevent form submission 27510 if (hasError) { 27511 e.preventDefault(); 27512 const invalidElements = form.querySelectorAll('.js-hsbw-invalid'); 27513 console.log(invalidElements);
27514 invalidElements.forEach((el)=>el.style.display = 'block'); 27515 return false; 27516 } 27517 // Convert timestamps to date objects 27518 startDate = new Date(startDateTimestamp * 1000); 27519 endDate = new Date(endDateTimestamp * 1000); 27520 // Format the date objects into strings for the query string 27521 const startDateObject = { 27522 year: startDate.getFullYear(), 27523 month: startDate.getMonth() + 1 < 10 ? '0' + (startDate.getMonth() + 1) : startDate.getMonth() + 1, 27524 day: startDate.getDate() < 10 ? '0' + startDate.getDate() : startDate.getDate() 27525 }; 27526 const endDateObject = { 27527 year: endDate.getFullYear(), 27528 month: endDate.getMonth() + 1 < 10 ? '0' + (endDate.getMonth() + 1) : endDate.getMonth() + 1, 27529 day: endDate.getDate() < 10 ? '0' + endDate.getDate() : endDate.getDate() 27530 }; 27531 const startDateFormatted = startDateObject.year + ' ' + startDateObject.month + ' ' + startDateObject.day; 27532 const endDateFormatted = endDateObject.year + ' ' + endDateObject.month + ' ' + endDateObject.day; 27533 // Set the hidden date fields 27534 const checkInField = form.querySelector('.js-hsbw-check-in'); 27535 const checkOutField = form.querySelector('.js-hsbw-check-out'); 27536 if (checkInField) checkInField.value = startDateFormatted.replace(/ /gi, '-'); 27537 if (checkOutField) checkOutField.value = endDateFormatted.replace(/ /gi, '-'); 27538 // Get the form data and build the query string 27539 let queryString = ''; 27540 const formArray = serializeForm(form); 27541 const roomData = []; 27542 let dateParams = ''; 27543 let otherParams = ''; 27544 // First collect all form data 27545 formArray.forEach(function(field) { 27546 if (field.name == 'hsbw_datepicker') return; 27547 // Group room-related data 27548 if (field.name === 'adults[]' || field.name === 'children[]') { 27549 if (field.name === 'adults[]') roomData.push({ 27550 adults: field.value 27551 }); 27552 else roomData[roomData.length - 1].children = field.value; 27553 } else if (field.name === 'checkInDate' || field.name === 'checkOutDate' || field.name === 'roomType') // Add date and hotel params first 27554 dateParams += field.name + '=' + field.value + '&'; 27555 else // Add other params to the end 27556 otherParams += field.name + '=' + field.value + '&'; 27557 }); 27558 // Build room-related query string 27559 let roomParams = ''; 27560 roomData.forEach((room)=>{ 27561 roomParams += 'adults%5B%5D=' + room.adults + '&'; 27562 roomParams += 'children%5B%5D=' + (room.children || 0) + '&'; 27563 if (room.children && room.children > 0) { 27564 const ages = new Array(parseInt(room.children)).fill(6).join('%2C'); 27565 roomParams += 'aoc%5B%5D=' + ages + '&'; 27566 } 27567 }); 27568 // Combine all query parameters in the desired order 27569 queryString = dateParams + roomParams + otherParams; 27570 // Extract data for tracking event 27571 let roomType = ''; 27572 let totalAdults = 0; 27573 let totalChildren = 0; 27574 // Get hotel code from form data 27575 const roomTypeField = formArray.find((field)=>field.name === 'roomType'); 27576 if (roomTypeField) roomType = roomTypeField.value; 27577 // Calculate total adults, children, and rooms from room data 27578 const totalRooms = roomData.length; 27579 roomData.forEach((room)=>{ 27580 totalAdults += parseInt(room.adults) || 0; 27581 totalChildren += parseInt(room.children) || 0; 27582 }); 27583 // Open the booking URL in a new tab 27584 const url = form.getAttribute('action') + queryString; 27585 window.open(url, '_blank').focus(); 27586 return true; 27587 }); 27588 }); 27589} 27590/** 27591 * Add number input controls used in the booking panel module 27592 */ function initNumberInputControls(bookingWidget) { 27593 bookingWidget.addEventListener('click', function(e) { 27594 if (e.target.classList.contains('js-number-input-plus')) { 27595 e.preventDefault(); 27596 const numInput = e.target.parentElement.querySelector('input[type=number]'); 27597 if (numInput) { 27598 const currVal = parseFloat(numInput.value); 27599 if (currVal < 8) numInput.value = currVal + 1; 27600 } 27601 } 27602 if (e.target.classList.contains('js-number-input-minus')) { 27603 e.preventDefault(); 27604 const numInput = e.target.parentElement.querySelector('input[type=number]'); 27605 if (numInput) { 27606 const currVal = parseFloat(numInput.value); 27607 if (currVal > 0) numInput.value = currVal - 1; 27608 } 27609 } 27610 }); 27611} 27612// Get all the instances of the booking widget 27613const bookingWidgets = document.querySelectorAll('.js-hsbw'); 27614if (bookingWidgets.length >
27614 0) bookingWidgets.forEach((bookingWidget)=>{ 27615 initBookingWidget(bookingWidget); 27616}); 27617 27618},{"flatpickr":"kJbte","flatpickr/dist/flatpickr.css":"1B36y","choices.js":"cVxV3","../../../../node_modules/choices.js/public/assets/styles/choices.css":"eN4G5","../helpers/accessibility":"7yMoe","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"kJbte":[function(require,module,exports,__globalThis) { 27619var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 27620parcelHelpers.defineInteropFlag(exports); 27621var _options = require("./types/options"); 27622var _default = require("./l10n/default"); 27623var _defaultDefault = parcelHelpers.interopDefault(_default); 27624var _utils = require("./utils"); 27625var _dom = require("./utils/dom"); 27626var _dates = require("./utils/dates"); 27627var _formatting = require("./utils/formatting"); 27628var _polyfills = require("./utils/polyfills"); 27629var __assign = undefined && undefined.__assign || function() { 27630 __assign = Object.assign || function(t) { 27631 for(var s, i = 1, n = arguments.length; i < n; i++){ 27632 s = arguments[i]; 27633 for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; 27634 } 27635 return t; 27636 }; 27637 return __assign.apply(this, arguments); 27638};
27639var __spreadArrays = undefined && undefined.__spreadArrays || function() { 27640 for(var s = 0, i = 0, il = arguments.length; i < il; i++)s += arguments[i].length; 27641 for(var r = Array(s), k = 0, i = 0; i < il; i++)for(var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)r[k] = a[j]; 27642 return r; 27643}; 27644var DEBOUNCED_CHANGE_MS = 300; 27645function FlatpickrInstance(element, instanceConfig) { 27646 var self = { 27647 config: __assign(__assign({}, (0, _options.defaults)), flatpickr.defaultConfig), 27648 l10n: (0, _defaultDefault.default) 27649 }; 27650 self.parseDate = (0, _dates.createDateParser)({ 27651 config: self.config, 27652 l10n: self.l10n 27653 }); 27654 self._handlers = []; 27655 self.pluginElements = []; 27656 self.loadedPlugins = []; 27657 self._bind = bind; 27658 self._setHoursFromDate = setHoursFromDate; 27659 self._positionCalendar = positionCalendar; 27660 self.changeMonth = changeMonth; 27661 self.changeYear = changeYear; 27662 self.clear = clear; 27663 self.close = close; 27664 self.onMouseOver = onMouseOver; 27665 self._createElement = (0, _dom.createElement); 27666 self.createDay = createDay; 27667 self.destroy = destroy; 27668 self.isEnabled = isEnabled; 27669 self.jumpToDate = jumpToDate; 27670 self.updateValue = updateValue; 27671 self.open = open; 27672 self.redraw = redraw; 27673 self.set = set; 27674 self.setDate = setDate; 27675 self.toggle = toggle; 27676 function setupHelperFunctions() { 27677 self.utils = { 27678 getDaysInMonth: function(month, yr) { 27679 if (month === void 0) month = self.currentMonth; 27680 if (yr === void 0) yr = self.currentYear; 27681 if (month === 1 && (yr % 4 === 0 && yr % 100 !== 0 || yr % 400 === 0)) return 29; 27682 return self.l10n.daysInMonth[month]; 27683 } 27684 }; 27685 } 27686 function init() { 27687 self.element = self.input = element; 27688 self.isOpen = false; 27689 parseConfig(); 27690 setupLocale(); 27691 setupInputs(); 27692 setupDates(); 27693 setupHelperFunctions(); 27694 if (!self.isMobile) build(); 27695 bindEvents(); 27696 if (self.selectedDates.length || self.config.noCalendar) { 27697 if (self.config.enableTime) setHoursFromDate(self.config.noCalendar ? self.latestSelectedDateObj : undefined); 27698 updateValue(false); 27699 } 27700 setCalendarWidth(); 27701 var isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); 27702 if (!self.isMobile && isSafari) positionCalendar(); 27703 triggerEvent("onReady"); 27704 } 27705 function getClosestActiveElement() { 27706 var _a; 27707 return ((_a = self.calendarContainer) === null || _a === void 0 ? void 0 : _a.getRootNode()).activeElement || document.activeElement; 27708 } 27709 function bindToInstance(fn) { 27710 return fn.bind(self); 27711 } 27712 function setCalendarWidth() { 27713 var config = self.config; 27714 if (config.weekNumbers === false && config.showMonths === 1) return; 27715 else if (config.noCalendar !== true) window.requestAnimationFrame(function() { 27716 if (self.calendarContainer !== undefined) { 27717 self.calendarContainer.style.visibility = "hidden"; 27718 self.calendarContainer.style.display = "block"; 27719 } 27720 if (self.daysContainer !== undefined) { 27721 var daysWidth = (self.days.offsetWidth + 1) * config.showMonths; 27722 self.daysContainer.style.width = daysWidth + "px"; 27723 self.calendarContainer.style.width = daysWidth + (self.weekWrapper !== undefined ? self.weekWrapper.offsetWidth : 0) + "px"; 27724 self.calendarContainer.style.removeProperty("visibility"); 27725 self.calendarContainer.style.removeProperty("display"); 27726 } 27727 }); 27728 } 27729 function updateTime(e) { 27730 if (self.selectedDates.length === 0) { 27731 var defaultDate = self.config.minDate === undefined || (0, _dates.compareDates)(new Date(), self.config.minDate) >= 0 ? new Date() : new Date(self.config.minDate.getTime()); 27732 var defaults = (0, _dates.getDefaultHours)(self.config); 27733 defaultDate.setHours(defaults.hours, defaults.minutes, defaults.seconds, defaultDate.getMilliseconds()); 27734 self.selectedDates = [ 27735 defaultDate 27736 ]; 27737 self.latestSelectedDateObj = defaultDate; 27738 } 27739 if (e !== undefined && e.type !== "blur") timeWrapper(e); 27740 var prevValue = self._input.value; 27741 setHoursFromInputs();
27742 updateValue(); 27743 if (self._input.value !== prevValue) self._debouncedChange(); 27744 } 27745 function ampm2military(hour, amPM) { 27746 return hour % 12 + 12 * (0, _utils.int)(amPM === self.l10n.amPM[1]); 27747 } 27748 function military2ampm(hour) { 27749 switch(hour % 24){ 27750 case 0: 27751 case 12: 27752 return 12; 27753 default: 27754 return hour % 12; 27755 } 27756 } 27757 function setHoursFromInputs() { 27758 if (self.hourElement === undefined || self.minuteElement === undefined) return; 27759 var hours = (parseInt(self.hourElement.value.slice(-2), 10) || 0) % 24, minutes = (parseInt(self.minuteElement.value, 10) || 0) % 60, seconds = self.secondElement !== undefined ? (parseInt(self.secondElement.value, 10) || 0) % 60 : 0; 27760 if (self.amPM !== undefined) hours = ampm2military(hours, self.amPM.textContent); 27761 var limitMinHours = self.config.minTime !== undefined || self.config.minDate && self.minDateHasTime && self.latestSelectedDateObj && (0, _dates.compareDates)(self.latestSelectedDateObj, self.config.minDate, true) === 0; 27762 var limitMaxHours = self.config.maxTime !== undefined || self.config.maxDate && self.maxDateHasTime && self.latestSelectedDateObj && (0, _dates.compareDates)(self.latestSelectedDateObj, self.config.maxDate, true) === 0; 27763 if (self.config.maxTime !== undefined && self.config.minTime !== undefined && self.config.minTime > self.config.maxTime) { 27764 var minBound = (0, _dates.calculateSecondsSinceMidnight)(self.config.minTime.getHours(), self.config.minTime.getMinutes(), self.config.minTime.getSeconds()); 27765 var maxBound = (0, _dates.calculateSecondsSinceMidnight)(self.config.maxTime.getHours(), self.config.maxTime.getMinutes(), self.config.maxTime.getSeconds()); 27766 var currentTime = (0, _dates.calculateSecondsSinceMidnight)(hours, minutes, seconds); 27767 if (currentTime > maxBound && currentTime < minBound) { 27768 var result = (0, _dates.parseSeconds)(minBound); 27769 hours = result[0]; 27770 minutes = result[1]; 27771 seconds = result[2]; 27772 } 27773 } else { 27774 if (limitMaxHours) { 27775 var maxTime = self.config.maxTime !== undefined ? self.config.maxTime : self.config.maxDate; 27776 hours = Math.min(hours, maxTime.getHours()); 27777 if (hours === maxTime.getHours()) minutes = Math.min(minutes, maxTime.getMinutes()); 27778 if (minutes === maxTime.getMinutes()) seconds = Math.min(seconds, maxTime.getSeconds()); 27779 } 27780 if (limitMinHours) { 27781 var minTime = self.config.minTime !== undefined ? self.config.minTime : self.config.minDate; 27782 hours = Math.max(hours, minTime.getHours()); 27783 if (hours === minTime.getHours() && minutes < minTime.getMinutes()) minutes = minTime.getMinutes(); 27784 if (minutes === minTime.getMinutes()) seconds = Math.max(seconds, minTime.getSeconds()); 27785 } 27786 } 27787 setHours(hours, minutes, seconds); 27788 } 27789 function setHoursFromDate(dateObj) { 27790 var date = dateObj || self.latestSelectedDateObj; 27791 if (date && date instanceof Date) setHours(date.getHours(), date.getMinutes(), date.getSeconds()); 27792 } 27793 function setHours(hours, minutes, seconds) { 27794 if (self.latestSelectedDateObj !== undefined) self.latestSelectedDateObj.setHours(hours % 24, minutes, seconds || 0, 0); 27795 if (!self.hourElement || !self.minuteElement || self.isMobile) return; 27796 self.hourElement.value = (0, _utils.pad)(!self.config.time_24hr ? (12 + hours) % 12 + 12 * (0, _utils.int)(hours % 12 === 0) : hours); 27797 self.minuteElement.value = (0, _utils.pad)(minutes); 27798 if (self.amPM !== undefined) self.amPM.textContent = self.l10n.amPM[(0, _utils.int)(hours >= 12)]; 27799 if (self.secondElement !== undefined) self.secondElement.value = (0, _utils.pad)(seconds); 27800 } 27801 function onYearInput(event) { 27802 var eventTarget = (0, _dom.getEventTarget)(event); 27803 var year = parseInt(eventTarget.value) + (event.delta || 0); 27804 if (year / 1000 > 1 || event.key === "Enter" && !/[^\d]/.test(year.toString())) changeYear(year); 27805 } 27806 function bind(element, event, handler, options) { 27807 if (event instanceof Array) return event.forEach(function(ev) { 27808 return bind(element, ev, handler, options); 27809 }); 27810 if (element instanceof Array) return element.forEach(function(el) { 27811 return bind(el, event, handler, options); 27812 }); 27813 element.addEventListener(event, handler, options); 27814 self._handlers.push({ 27815 remove: function() { 27816 return element.removeEventListener(event, handler, options); 27817 } 27818 }); 27819 } 27820 function triggerChange() { 27821 triggerEvent("onChange"); 27822 } 27823 function bindEvents() { 27824 if (self.config.wrap) [ 27825 "open", 27826 "close", 27827 "toggle", 27828 "clear" 27829 ].forEach(function(evt) { 27830 Array.prototype.forEach.call(self.element.querySelectorAll("[data-" + evt + "]"), function(el) { 27831 return bind(el, "click", self[evt]); 27832 }); 27833 }); 27834 if (self.isMobile) { 27835 setupMobile(); 27836 return; 27837 } 27838 var debouncedResize = (0, _utils.debounce)(onResize, 50); 27839 self._debouncedChange = (0, _utils.debounce)(triggerChange, DEBOUNCED_CHANGE_MS); 27840 if (self.daysContainer && !/iPhone|iPad|iPod/i.test(navigator.userAgent)) bind(self.daysContainer, "mouseover", function(e) { 27841 if (self.config.mode === "range") onMouseOver((0, _dom.getEventTarget)(e)); 27842 }); 27843 bind(self._input, "keydown", onKeyDown); 27844 if (self.calendarContainer !== undefined) bind(self.calendarContainer, "keydown", onKeyDown); 27845 if (!self.config.inline && !self.config.static) bind(window, "resize", debouncedResize); 27846 if (window.ontouchstart !== undefined) bind(window.document, "touchstart", documentClick); 27847 else bind(window.document, "mousedown", documentClick); 27848 bind(window.document, "focus", documentClick, { 27849 capture: true 27850 }); 27851 if (self.config.clickOpens === true) {
27852 bind(self._input, "focus", self.open); 27853 bind(self._input, "click", self.open); 27854 } 27855 if (self.daysContainer !== undefined) { 27856 bind(self.monthNav, "click", onMonthNavClick); 27857 bind(self.monthNav, [ 27858 "keyup", 27859 "increment" 27860 ], onYearInput); 27861 bind(self.daysContainer, "click", selectDate); 27862 } 27863 if (self.timeContainer !== undefined && self.minuteElement !== undefined && self.hourElement !== undefined) { 27864 var selText = function(e) { 27865 return (0, _dom.getEventTarget)(e).select(); 27866 }; 27867 bind(self.timeContainer, [ 27868 "increment" 27869 ], updateTime); 27870 bind(self.timeContainer, "blur", updateTime, { 27871 capture: true 27872 }); 27873 bind(self.timeContainer, "click", timeIncrement); 27874 bind([ 27875 self.hourElement, 27876 self.minuteElement 27877 ], [ 27878 "focus", 27879 "click" 27880 ], selText); 27881 if (self.secondElement !== undefined) bind(self.secondElement, "focus", function() { 27882 return self.secondElement && self.secondElement.select(); 27883 }); 27884 if (self.amPM !== undefined) bind(self.amPM, "click", function(e) { 27885 updateTime(e); 27886 }); 27887 } 27888 if (self.config.allowInput) bind(self._input, "blur", onBlur); 27889 } 27890 function jumpToDate(jumpDate, triggerChange) { 27891 var jumpTo = jumpDate !== undefined ? self.parseDate(jumpDate) : self.latestSelectedDateObj || (self.config.minDate && self.config.minDate > self.now ? self.config.minDate : self.config.maxDate && self.config.maxDate < self.now ? self.config.maxDate : self.now); 27892 var oldYear = self.currentYear; 27893 var oldMonth = self.currentMonth; 27894 try { 27895 if (jumpTo !== undefined) { 27896 self.currentYear = jumpTo.getFullYear(); 27897 self.currentMonth = jumpTo.getMonth(); 27898 } 27899 } catch (e) { 27900 e.message = "Invalid date supplied: " + jumpTo; 27901 self.config.errorHandler(e); 27902 } 27903 if (triggerChange && self.currentYear !== oldYear) { 27904 triggerEvent("onYearChange"); 27905 buildMonthSwitch(); 27906 } 27907 if (triggerChange && (self.currentYear !== oldYear || self.currentMonth !== oldMonth)) triggerEvent("onMonthChange"); 27908 self.redraw(); 27909 } 27910 function timeIncrement(e) { 27911 var eventTarget = (0, _dom.getEventTarget)(e); 27912 if (~eventTarget.className.indexOf("arrow")) incrementNumInput(e, eventTarget.classList.contains("arrowUp") ? 1 : -1); 27913 } 27914 function incrementNumInput(e, delta, inputElem) { 27915 var target = e && (0, _dom.getEventTarget)(e); 27916 var input = inputElem || target && target.parentNode && target.parentNode.firstChild; 27917 var event = createEvent("increment"); 27918 event.delta = delta; 27919 input && input.dispatchEvent(event); 27920 } 27921 function build() { 27922 var fragment = window.document.createDocumentFragment(); 27923 self.calendarContainer = (0, _dom.createElement)("div", "flatpickr-calendar"); 27924 self.calendarContainer.tabIndex = -1; 27925 if (!self.config.noCalendar) { 27926 fragment.appendChild(buildMonthNav()); 27927 self.innerContainer = (0, _dom.createElement)("div", "flatpickr-innerContainer"); 27928 if (self.config.weekNumbers) { 27929 var _a = buildWeeks(), weekWrapper = _a.weekWrapper, weekNumbers = _a.weekNumbers; 27930 self.innerContainer.appendChild(weekWrapper); 27931 self.weekNumbers = weekNumbers; 27932 self.weekWrapper = weekWrapper; 27933 } 27934 self.rContainer = (0, _dom.createElement)("div", "flatpickr-rContainer"); 27935 self.rContainer.appendChild(buildWeekdays()); 27936 if (!self.daysContainer) { 27937 self.daysContainer = (0, _dom.createElement)("div", "flatpickr-days"); 27938 self.daysContainer.tabIndex = -1; 27939 } 27940 buildDays(); 27941 self.rContainer.appendChild(self.daysContainer); 27942 self.innerContainer.appendChild(self.rContainer); 27943 fragment.appendChild(self.innerContainer); 27944 } 27945 if (self.config.enableTime) fragment.appendChild(buildTime()); 27946 (0, _dom.toggleClass)(self.calendarContainer, "rangeMode", self.config.mode === "range"); 27947 (0, _dom.toggleClass)(self.calendarContainer, "animate", self.config.animate === true); 27948 (0, _dom.toggleClass)(self.calendarContainer, "multiMonth", self.config.showMonths > 1); 27949 self.calendarContainer.appendChild(fragment); 27950 var customAppend = self.config.appendTo !== undefined && self.config.appendTo.nodeType !== undefined; 27951 if (self.config.inline || self.config.static) { 27952 self.calendarContainer.classList.add(self.config.inline ? "inline" : "static"); 27953 if (self.config.inline) { 27954 if (!customAppend && self.element.parentNode) self.element.parentNode.insertBefore(self.calendarContainer, self._input.nextSibling); 27955 else if (self.config.appendTo !== undefined) self.config.appendTo.appendChild(self.calendarContainer); 27956 } 27957 if (self.config.static) { 27958 var wrapper = (0, _dom.createElement)("div", "flatpickr-wrapper"); 27959 if (self.element.parentNode) self.element.parentNode.insertBefore(wrapper, self.element); 27960 wrapper.appendChild(self.element); 27961 if (self.altInput) wrapper.appendChild(self.altInput); 27962 wrapper.appendChild(self.calendarContainer); 27963 } 27964 } 27965 if (!self.config.static && !self.config.inline) (self.config.appendTo !== undefined ? self.config.appendTo : window.document.body).appendChild(self.calendarContainer); 27966 } 27967 function createDay(className, date, _dayNumber, i) { 27968 var dateIsEnabled = isEnabled(date, true), dayElement = (0, _dom.createElement)("span", className, date.getDate().toString()); 27969 dayElement.dateObj = date; 27970 dayElement.$i = i; 27971 dayElement.setAttribute("aria-label", self.formatDate(date, self.config.ariaDateFormat)); 27972 if (className.indexOf("hidden") === -1 && (0, _dates.compareDates)(date, self.now) === 0) { 27973 self.todayDateElem = dayElement; 27974 dayElement.classList.add("today"); 27975 dayElement.setAttribute("aria-current", "date"); 27976 } 27977 if (dateIsEnabled) { 27978 dayElement.tabIndex = -1; 27979 if (isDateSelected(date)) { 27980 dayElement.classList.add("selected"); 27981 self.selectedDateElem = dayElement; 27982 if (self.config.mode === "range") { 27983 (0, _dom.toggleClass)(dayElement, "startRange", self.selectedDates[0] && (0, _dates.compareDates)(date, self.selectedDates[0], true) === 0); 27984 (0, _dom.toggleClass)(dayElement, "endRange", self.selectedDates[1] && (0, _dates.compareDates)(date, self.selectedDates[1], true) === 0); 27985 if (className === "nextMonthDay") dayElement.classList.add("inRange"); 27986 } 27987 } 27988 } else dayElement.classList.add("flatpickr-disabled"); 27989 if (self.config.mode === "range") { 27990 if (isDateInRange(date) && !isDateSelected(date)) dayElement.classList.add("inRange"); 27991 } 27992 if (self.weekNumbers && self.config.showMonths === 1 && className !== "prevMonthDay" && i % 7 === 6) self.weekNumbers.insertAdjacentHTML("beforeend", "<span class='flatpickr-day'>" + self.config.getWeek(date) + "</span>"); 27993 triggerEvent("onDayCreate", dayElement); 27994 return dayElement; 27995 } 27996 function focusOnDayElem(targetNode) { 27997 targetNode.focus(); 27998 if (self.config.mode === "range") onMouseOver(targetNode); 27999 } 28000 function getFirstAvailableDay(delta) { 28001 var startMonth = delta > 0 ? 0 : self.config.showMonths - 1; 28002 var endMonth = delta > 0 ? self.config.showMonths : -1; 28003 for(var m = startMonth; m != endMonth; m += delta){
28004 var month = self.daysContainer.children[m]; 28005 var startIndex = delta > 0 ? 0 : month.children.length - 1; 28006 var endIndex = delta > 0 ? month.children.length : -1; 28007 for(var i = startIndex; i != endIndex; i += delta){ 28008 var c = month.children[i]; 28009 if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj)) return c; 28010 } 28011 } 28012 return undefined; 28013 } 28014 function getNextAvailableDay(current, delta) { 28015 var givenMonth = current.className.indexOf("Month") === -1 ? current.dateObj.getMonth() : self.currentMonth; 28016 var endMonth = delta > 0 ? self.config.showMonths : -1; 28017 var loopDelta = delta > 0 ? 1 : -1; 28018 for(var m = givenMonth - self.currentMonth; m != endMonth; m += loopDelta){ 28019 var month = self.daysContainer.children[m]; 28020 var startIndex = givenMonth - self.currentMonth === m ? current.$i + delta : delta < 0 ? month.children.length - 1 : 0; 28021 var numMonthDays = month.children.length; 28022 for(var i = startIndex; i >= 0 && i < numMonthDays && i != (delta > 0 ? numMonthDays : -1); i += loopDelta){ 28023 var c = month.children[i]; 28024 if (c.className.indexOf("hidden") === -1 && isEnabled(c.dateObj) && Math.abs(current.$i - i) >= Math.abs(delta)) return focusOnDayElem(c); 28025 } 28026 } 28027 self.changeMonth(loopDelta); 28028 focusOnDay(getFirstAvailableDay(loopDelta), 0); 28029 return undefined; 28030 } 28031 function focusOnDay(current, offset) { 28032 var activeElement = getClosestActiveElement(); 28033 var dayFocused = isInView(activeElement || document.body); 28034 var startElem = current !== undefined ? current : dayFocused ? activeElement : self.selectedDateElem !== undefined && isInView(self.selectedDateElem) ? self.selectedDateElem : self.todayDateElem !== undefined && isInView(self.todayDateElem) ? self.todayDateElem : getFirstAvailableDay(offset > 0 ? 1 : -1); 28035 if (startElem === undefined) self._input.focus(); 28036 else if (!dayFocused) focusOnDayElem(startElem); 28037 else getNextAvailableDay(startElem, offset); 28038 } 28039 function buildMonthDays(year, month) { 28040 var firstOfMonth = (new Date(year, month, 1).getDay() - self.l10n.firstDayOfWeek + 7) % 7; 28041 var prevMonthDays = self.utils.getDaysInMonth((month - 1 + 12) % 12, year); 28042 var daysInMonth = self.utils.getDaysInMonth(month, year), days = window.document.createDocumentFragment(), isMultiMonth = self.config.showMonths > 1, prevMonthDayClass = isMultiMonth ? "prevMonthDay hidden" : "prevMonthDay", nextMonthDayClass = isMultiMonth ? "nextMonthDay hidden" : "nextMonthDay"; 28043 var dayNumber = prevMonthDays + 1 - firstOfMonth, dayIndex = 0; 28044 for(; dayNumber <= prevMonthDays; dayNumber++, dayIndex++)days.appendChild(createDay("flatpickr-day " + prevMonthDayClass, new Date(year, month - 1, dayNumber), dayNumber, dayIndex)); 28045 for(dayNumber = 1; dayNumber <= daysInMonth; dayNumber++, dayIndex++)days.appendChild(createDay("flatpickr-day", new Date(year, month, dayNumber), dayNumber, dayIndex)); 28046 for(var dayNum = daysInMonth + 1; dayNum <= 42 - firstOfMonth && (self.config.showMonths === 1 || dayIndex % 7 !== 0); dayNum++, dayIndex++)days.appendChild(createDay("flatpickr-day " + nextMonthDayClass, new Date(year, month + 1, dayNum % daysInMonth), dayNum, dayIndex)); 28047 var dayContainer = (0, _dom.createElement)("div", "dayContainer"); 28048 dayContainer.appendChild(days); 28049 return dayContainer; 28050 } 28051 function buildDays() { 28052 if (self.daysContainer === undefined) return; 28053 (0, _dom.clearNode)(self.daysContainer); 28054 if (self.weekNumbers) (0, _dom.clearNode)(self.weekNumbers); 28055 var frag = document.createDocumentFragment(); 28056 for(var i = 0; i < self.config.showMonths; i++){ 28057 var d = new Date(self.currentYear, self.currentMonth, 1); 28058 d.setMonth(self.currentMonth + i); 28059 frag.appendChild(buildMonthDays(d.getFullYear(), d.getMonth())); 28060 } 28061 self.daysContainer.appendChild(frag); 28062 self.days = self.daysContainer.firstChild; 28063 if (self.config.mode === "range" && self.selectedDates.length === 1) onMouseOver(); 28064 } 28065 function buildMonthSwitch() { 28066 if (self.config.showMonths > 1 || self.config.monthSelectorType !== "dropdown") return; 28067 var shouldBuildMonth = function(month) { 28068 if (self.config.minDate !== undefined && self.currentYear === self.config.minDate.getFullYear() && month < self.config.minDate.getMonth()) return false;
28069 return !(self.config.maxDate !== undefined && self.currentYear === self.config.maxDate.getFullYear() && month > self.config.maxDate.getMonth()); 28070 }; 28071 self.monthsDropdownContainer.tabIndex = -1; 28072 self.monthsDropdownContainer.innerHTML = ""; 28073 for(var i = 0; i < 12; i++){ 28074 if (!shouldBuildMonth(i)) continue; 28075 var month = (0, _dom.createElement)("option", "flatpickr-monthDropdown-month"); 28076 month.value = new Date(self.currentYear, i).getMonth().toString(); 28077 month.textContent = (0, _formatting.monthToStr)(i, self.config.shorthandCurrentMonth, self.l10n); 28078 month.tabIndex = -1; 28079 if (self.currentMonth === i) month.selected = true; 28080 self.monthsDropdownContainer.appendChild(month); 28081 } 28082 } 28083 function buildMonth() { 28084 var container = (0, _dom.createElement)("div", "flatpickr-month"); 28085 var monthNavFragment = window.document.createDocumentFragment(); 28086 var monthElement; 28087 if (self.config.showMonths > 1 || self.config.monthSelectorType === "static") monthElement = (0, _dom.createElement)("span", "cur-month"); 28088 else { 28089 self.monthsDropdownContainer = (0, _dom.createElement)("select", "flatpickr-monthDropdown-months"); 28090 self.monthsDropdownContainer.setAttribute("aria-label", self.l10n.monthAriaLabel); 28091 bind(self.monthsDropdownContainer, "change", function(e) { 28092 var target = (0, _dom.getEventTarget)(e); 28093 var selectedMonth = parseInt(target.value, 10); 28094 self.changeMonth(selectedMonth - self.currentMonth); 28095 triggerEvent("onMonthChange"); 28096 }); 28097 buildMonthSwitch(); 28098 monthElement = self.monthsDropdownContainer; 28099 } 28100 var yearInput = (0, _dom.createNumberInput)("cur-year", { 28101 tabindex: "-1" 28102 }); 28103 var yearElement = yearInput.getElementsByTagName("input")[0]; 28104 yearElement.setAttribute("aria-label", self.l10n.yearAriaLabel); 28105 if (self.config.minDate) yearElement.setAttribute("min", self.config.minDate.getFullYear().toString()); 28106 if (self.config.maxDate) { 28107 yearElement.setAttribute("max", self.config.maxDate.getFullYear().toString()); 28108 yearElement.disabled = !!self.config.minDate && self.config.minDate.getFullYear() === self.config.maxDate.getFullYear(); 28109 } 28110 var currentMonth = (0, _dom.createElement)("div", "flatpickr-current-month"); 28111 currentMonth.appendChild(monthElement); 28112 currentMonth.appendChild(yearInput); 28113 monthNavFragment.appendChild(currentMonth); 28114 container.appendChild(monthNavFragment); 28115 return { 28116 container: container, 28117 yearElement: yearElement, 28118 monthElement: monthElement 28119 }; 28120 } 28121 function buildMonths() { 28122 (0, _dom.clearNode)(self.monthNav); 28123 self.monthNav.appendChild(self.prevMonthNav); 28124 if (self.config.showMonths) { 28125 self.yearElements = []; 28126 self.monthElements = []; 28127 } 28128 for(var m = self.config.showMonths; m--;){ 28129 var month = buildMonth(); 28130 self.yearElements.push(month.yearElement); 28131 self.monthElements.push(month.monthElement); 28132 self.monthNav.appendChild(month.container); 28133 } 28134 self.monthNav.appendChild(self.nextMonthNav); 28135 } 28136 function buildMonthNav() { 28137 self.monthNav = (0, _dom.createElement)("div", "flatpickr-months"); 28138 self.yearElements = []; 28139 self.monthElements = []; 28140 self.prevMonthNav = (0, _dom.createElement)("span", "flatpickr-prev-month"); 28141 self.prevMonthNav.innerHTML = self.config.prevArrow; 28142 self.nextMonthNav = (0, _dom.createElement)("span", "flatpickr-next-month"); 28143 self.nextMonthNav.innerHTML = self.config.nextArrow; 28144 buildMonths(); 28145 Object.defineProperty(self, "_hidePrevMonthArrow", { 28146 get: function() { 28147 return self.__hidePrevMonthArrow; 28148 }, 28149 set: function(bool) { 28150 if (self.__hidePrevMonthArrow !== bool) { 28151 (0, _dom.toggleClass)(self.prevMonthNav, "flatpickr-disabled", bool); 28152 self.__hidePrevMonthArrow = bool; 28153 } 28154 } 28155 }); 28156 Object.defineProperty(self, "_hideNextMonthArrow", { 28157 get: function() { 28158 return self.__hideNextMonthArrow; 28159 }, 28160 set: function(bool) { 28161 if (self.__hideNextMonthArrow !== bool) { 28162 (0, _dom.toggleClass)(self.nextMonthNav, "flatpickr-disabled", bool); 28163 self.__hideNextMonthArrow = bool; 28164 } 28165 } 28166 }); 28167 self.currentYearElement = self.yearElements[0]; 28168 updateNavigationCurrentMonth(); 28169 return self.monthNav; 28170 } 28171 function buildTime() { 28172 self.calendarContainer.classList.add("hasTime"); 28173 if (self.config.noCalendar) self.calendarContainer.classList.add("noCalendar"); 28174 var defaults = (0, _dates.getDefaultHours)(self.config); 28175 self.timeContainer = (0, _dom.createElement)("div", "flatpickr-time"); 28176 self.timeContainer.tabIndex = -1; 28177 var separator = (0, _dom.createElement)("span", "flatpickr-time-separator", ":"); 28178 var hourInput = (0, _dom.createNumberInput)("flatpickr-hour", { 28179 "aria-label": self.l10n.hourAriaLabel 28180 }); 28181 self.hourElement = hourInput.getElementsByTagName("input")[0]; 28182 var minuteInput = (0, _dom.createNumberInput)("flatpickr-minute", { 28183 "aria-label": self.l10n.minuteAriaLabel 28184 }); 28185 self.minuteElement = minuteInput.getElementsByTagName("input")[0]; 28186 self.hourElement.tabIndex = self.minuteElement.tabIndex = -1; 28187 self.hourElement.value = (0, _utils.pad)(self.latestSelectedDateObj ? self.latestSelectedDateObj.getHours() : self.config.time_24hr ? defaults.hours : military2ampm(defaults.hours)); 28188 self.minuteElement.value = (0, _utils.pad)(self.latestSelectedDateObj ? self.latestSelectedDateObj.getMinutes() : defaults.minutes); 28189 self.hourElement.setAttribute("step", self.config.hourIncrement.toString()); 28190 self.minuteElement.setAttribute("step", self.config.minuteIncrement.toString()); 28191 self.hourElement.setAttribute("min", self.config.time_24hr ? "0" : "1"); 28192 self.hourElement.setAttribute("max", self.config.time_24hr ? "23" : "12"); 28193 self.hourElement.setAttribute("maxlength", "2"); 28194 self.minuteElement.setAttribute("min", "0"); 28195 self.minuteElement.setAttribute("max", "59"); 28196 self.minuteElement.setAttribute("maxlength", "2");
28197 self.timeContainer.appendChild(hourInput); 28198 self.timeContainer.appendChild(separator); 28199 self.timeContainer.appendChild(minuteInput); 28200 if (self.config.time_24hr) self.timeContainer.classList.add("time24hr"); 28201 if (self.config.enableSeconds) { 28202 self.timeContainer.classList.add("hasSeconds"); 28203 var secondInput = (0, _dom.createNumberInput)("flatpickr-second"); 28204 self.secondElement = secondInput.getElementsByTagName("input")[0]; 28205 self.secondElement.value = (0, _utils.pad)(self.latestSelectedDateObj ? self.latestSelectedDateObj.getSeconds() : defaults.seconds); 28206 self.secondElement.setAttribute("step", self.minuteElement.getAttribute("step")); 28207 self.secondElement.setAttribute("min", "0"); 28208 self.secondElement.setAttribute("max", "59"); 28209 self.secondElement.setAttribute("maxlength", "2"); 28210 self.timeContainer.appendChild((0, _dom.createElement)("span", "flatpickr-time-separator", ":")); 28211 self.timeContainer.appendChild(secondInput); 28212 } 28213 if (!self.config.time_24hr) { 28214 self.amPM = (0, _dom.createElement)("span", "flatpickr-am-pm", self.l10n.amPM[(0, _utils.int)((self.latestSelectedDateObj ? self.hourElement.value : self.config.defaultHour) > 11)]); 28215 self.amPM.title = self.l10n.toggleTitle; 28216 self.amPM.tabIndex = -1; 28217 self.timeContainer.appendChild(self.amPM); 28218 } 28219 return self.timeContainer; 28220 } 28221 function buildWeekdays() { 28222 if (!self.weekdayContainer) self.weekdayContainer = (0, _dom.createElement)("div", "flatpickr-weekdays"); 28223 else (0, _dom.clearNode)(self.weekdayContainer); 28224 for(var i = self.config.showMonths; i--;){ 28225 var container = (0, _dom.createElement)("div", "flatpickr-weekdaycontainer"); 28226 self.weekdayContainer.appendChild(container); 28227 } 28228 updateWeekdays(); 28229 return self.weekdayContainer; 28230 } 28231 function updateWeekdays() { 28232 if (!self.weekdayContainer) return; 28233 var firstDayOfWeek = self.l10n.firstDayOfWeek; 28234 var weekdays = __spreadArrays(self.l10n.weekdays.shorthand); 28235 if (firstDayOfWeek > 0 && firstDayOfWeek < weekdays.length) weekdays = __spreadArrays(weekdays.splice(firstDayOfWeek, weekdays.length), weekdays.splice(0, firstDayOfWeek)); 28236 for(var i = self.config.showMonths; i--;)self.weekdayContainer.children[i].innerHTML = "\n <span class='flatpickr-weekday'>\n " + weekdays.join("</span><span class='flatpickr-weekday'>") + "\n </span>\n "; 28237 } 28238 function buildWeeks() { 28239 self.calendarContainer.classList.add("hasWeeks"); 28240 var weekWrapper = (0, _dom.createElement)("div", "flatpickr-weekwrapper"); 28241 weekWrapper.appendChild((0, _dom.createElement)("span", "flatpickr-weekday", self.l10n.weekAbbreviation)); 28242 var weekNumbers = (0, _dom.createElement)("div", "flatpickr-weeks"); 28243 weekWrapper.appendChild(weekNumbers); 28244 return { 28245 weekWrapper: weekWrapper, 28246 weekNumbers: weekNumbers 28247 }; 28248 } 28249 function changeMonth(value, isOffset) { 28250 if (isOffset === void 0) isOffset = true; 28251 var delta = isOffset ? value : value - self.currentMonth; 28252 if (delta < 0 && self._hidePrevMonthArrow === true || delta > 0 && self._hideNextMonthArrow === true) return; 28253 self.currentMonth += delta; 28254 if (self.currentMonth < 0 || self.currentMonth > 11) { 28255 self.currentYear += self.currentMonth > 11 ? 1 : -1; 28256 self.currentMonth = (self.currentMonth + 12) % 12; 28257 triggerEvent("onYearChange"); 28258 buildMonthSwitch(); 28259 } 28260 buildDays(); 28261 triggerEvent("onMonthChange"); 28262 updateNavigationCurrentMonth(); 28263 } 28264 function clear(triggerChangeEvent, toInitial) { 28265 if (triggerChangeEvent === void 0) triggerChangeEvent = true; 28266 if (toInitial === void 0) toInitial = true; 28267 self.input.value = ""; 28268 if (self.altInput !== undefined) self.altInput.value = ""; 28269 if (self.mobileInput !== undefined) self.mobileInput.value = ""; 28270 self.selectedDates = []; 28271 self.latestSelectedDateObj = undefined; 28272 if (toInitial === true) { 28273 self.currentYear = self._initialDate.getFullYear(); 28274 self.currentMonth = self._initialDate.getMonth(); 28275 } 28276 if (self.config.enableTime === true) { 28277 var _a = (0, _dates.getDefaultHours)(self.config), hours = _a.hours, minutes = _a.minutes, seconds = _a.seconds; 28278 setHours(hours, minutes, seconds); 28279 } 28280 self.redraw(); 28281 if (triggerChangeEvent) triggerEvent("onChange"); 28282 } 28283 function close() { 28284 self.isOpen = false;
28285 if (!self.isMobile) { 28286 if (self.calendarContainer !== undefined) self.calendarContainer.classList.remove("open"); 28287 if (self._input !== undefined) self._input.classList.remove("active"); 28288 } 28289 triggerEvent("onClose"); 28290 } 28291 function destroy() { 28292 if (self.config !== undefined) triggerEvent("onDestroy"); 28293 for(var i = self._handlers.length; i--;)self._handlers[i].remove(); 28294 self._handlers = []; 28295 if (self.mobileInput) { 28296 if (self.mobileInput.parentNode) self.mobileInput.parentNode.removeChild(self.mobileInput); 28297 self.mobileInput = undefined; 28298 } else if (self.calendarContainer && self.calendarContainer.parentNode) { 28299 if (self.config.static && self.calendarContainer.parentNode) { 28300 var wrapper = self.calendarContainer.parentNode; 28301 wrapper.lastChild && wrapper.removeChild(wrapper.lastChild); 28302 if (wrapper.parentNode) { 28303 while(wrapper.firstChild)wrapper.parentNode.insertBefore(wrapper.firstChild, wrapper); 28304 wrapper.parentNode.removeChild(wrapper); 28305 } 28306 } else self.calendarContainer.parentNode.removeChild(self.calendarContainer); 28307 } 28308 if (self.altInput) { 28309 self.input.type = "text"; 28310 if (self.altInput.parentNode) self.altInput.parentNode.removeChild(self.altInput); 28311 delete self.altInput; 28312 } 28313 if (self.input) { 28314 self.input.type = self.input._type; 28315 self.input.classList.remove("flatpickr-input"); 28316 self.input.removeAttribute("readonly"); 28317 } 28318 [ 28319 "_showTimeInput", 28320 "latestSelectedDateObj", 28321 "_hideNextMonthArrow", 28322 "_hidePrevMonthArrow", 28323 "__hideNextMonthArrow", 28324 "__hidePrevMonthArrow", 28325 "isMobile", 28326 "isOpen", 28327 "selectedDateElem", 28328 "minDateHasTime", 28329 "maxDateHasTime", 28330 "days", 28331 "daysContainer", 28332 "_input", 28333 "_positionElement", 28334 "innerContainer", 28335 "rContainer", 28336 "monthNav", 28337 "todayDateElem", 28338 "calendarContainer", 28339 "weekdayContainer", 28340 "prevMonthNav", 28341 "nextMonthNav", 28342 "monthsDropdownContainer", 28343 "currentMonthElement", 28344 "currentYearElement", 28345 "navigationCurrentMonth", 28346 "selectedDateElem", 28347 "config" 28348 ].forEach(function(k) { 28349 try { 28350 delete self[k]; 28351 } catch (_) {} 28352 }); 28353 } 28354 function isCalendarElem(elem) { 28355 return self.calendarContainer.contains(elem); 28356 } 28357 function documentClick(e) { 28358 if (self.isOpen && !self.config.inline) { 28359 var eventTarget_1 = (0, _dom.getEventTarget)(e); 28360 var isCalendarElement = isCalendarElem(eventTarget_1); 28361 var isInput = eventTarget_1 === self.input || eventTarget_1 === self.altInput || self.element.contains(eventTarget_1) || e.path && e.path.indexOf && (~e.path.indexOf(self.input) || ~e.path.indexOf(self.altInput)); 28362 var lostFocus = !isInput && !isCalendarElement && !isCalendarElem(e.relatedTarget); 28363 var isIgnored = !self.config.ignoredFocusElements.some(function(elem) { 28364 return elem.contains(eventTarget_1); 28365 }); 28366 if (lostFocus && isIgnored) { 28367 if (self.config.allowInput) self.setDate(self._input.value, false, self.config.altInput ? self.config.altFormat : self.config.dateFormat); 28368 if (self.timeContainer !== undefined && self.minuteElement !== undefined && self.hourElement !== undefined && self.input.value !== "" && self.input.value !== undefined) updateTime(); 28369 self.close(); 28370 if (self.config && self.config.mode === "range" && self.selectedDates.length === 1) self.clear(false); 28371 } 28372 } 28373 } 28374 function changeYear(newYear) { 28375 if (!newYear || self.config.minDate && newYear < self.config.minDate.getFullYear() || self.config.maxDate && newYear > self.config.maxDate.getFullYear()) return; 28376 var newYearNum = newYear, isNewYear = self.currentYear !== newYearNum; 28377 self.currentYear = newYearNum || self.currentYear; 28378 if (self.config.maxDate && self.currentYear === self.config.maxDate.getFullYear()) self.currentMonth = Math.min(self.config.maxDate.getMonth(), self.currentMonth); 28379 else if (self.config.minDate && self.currentYear === self.config.minDate.getFullYear()) self.currentMonth = Math.max(self.config.minDate.getMonth(), self.currentMonth); 28380 if (isNewYear) { 28381 self.redraw(); 28382 triggerEvent("onYearChange"); 28383 buildMonthSwitch(); 28384 } 28385 } 28386 function isEnabled(date, timeless) { 28387 var _a; 28388 if (timeless === void 0) timeless = true; 28389 var dateToCheck = self.parseDate(date, undefined, timeless); 28390 if (self.config.minDate && dateToCheck && (0, _dates.compareDates)(dateToCheck, self.config.minDate, timeless !== undefined ? timeless : !self.minDateHasTime) < 0 || self.config.maxDate && dateToCheck && (0, _dates.compareDates)(dateToCheck, self.config.maxDate, timeless !== undefined ? timeless : !self.maxDateHasTime) > 0) return false;
vendor: 6,333 bytes, lines 28391-28509
28391 if (!self.config.enable && self.config.disable.length === 0) return true; 28392 if (dateToCheck === undefined) return false; 28393 var bool = !!self.config.enable, array = (_a = self.config.enable) !== null && _a !== void 0 ? _a : self.config.disable; 28394 for(var i = 0, d = void 0; i < array.length; i++){ 28395 d = array[i]; 28396 if (typeof d === "function" && d(dateToCheck)) return bool; 28397 else if (d instanceof Date && dateToCheck !== undefined && d.getTime() === dateToCheck.getTime()) return bool; 28398 else if (typeof d === "string") { 28399 var parsed = self.parseDate(d, undefined, true); 28400 return parsed && parsed.getTime() === dateToCheck.getTime() ? bool : !bool; 28401 } else if (typeof d === "object" && dateToCheck !== undefined && d.from && d.to && dateToCheck.getTime() >= d.from.getTime() && dateToCheck.getTime() <= d.to.getTime()) return bool; 28402 } 28403 return !bool; 28404 } 28405 function isInView(elem) { 28406 if (self.daysContainer !== undefined) return elem.className.indexOf("hidden") === -1 && elem.className.indexOf("flatpickr-disabled") === -1 && self.daysContainer.contains(elem); 28407 return false; 28408 } 28409 function onBlur(e) { 28410 var isInput = e.target === self._input; 28411 var valueChanged = self._input.value.trimEnd() !== getDateStr(); 28412 if (isInput && valueChanged && !(e.relatedTarget && isCalendarElem(e.relatedTarget))) self.setDate(self._input.value, true, e.target === self.altInput ? self.config.altFormat : self.config.dateFormat); 28413 } 28414 function onKeyDown(e) { 28415 var eventTarget = (0, _dom.getEventTarget)(e); 28416 var isInput = self.config.wrap ? element.contains(eventTarget) : eventTarget === self._input; 28417 var allowInput = self.config.allowInput; 28418 var allowKeydown = self.isOpen && (!allowInput || !isInput); 28419 var allowInlineKeydown = self.config.inline && isInput && !allowInput; 28420 if (e.keyCode === 13 && isInput) { 28421 if (allowInput) { 28422 self.setDate(self._input.value, true, eventTarget === self.altInput ? self.config.altFormat : self.config.dateFormat); 28423 self.close(); 28424 return eventTarget.blur(); 28425 } else self.open(); 28426 } else if (isCalendarElem(eventTarget) || allowKeydown || allowInlineKeydown) { 28427 var isTimeObj = !!self.timeContainer && self.timeContainer.contains(eventTarget); 28428 switch(e.keyCode){ 28429 case 13: 28430 if (isTimeObj) { 28431 e.preventDefault(); 28432 updateTime(); 28433 focusAndClose(); 28434 } else selectDate(e); 28435 break; 28436 case 27: 28437 e.preventDefault(); 28438 focusAndClose(); 28439 break; 28440 case 8: 28441 case 46: 28442 if (isInput && !self.config.allowInput) { 28443 e.preventDefault(); 28444 self.clear(); 28445 } 28446 break; 28447 case 37: 28448 case 39: 28449 if (!isTimeObj && !isInput) { 28450 e.preventDefault(); 28451 var activeElement = getClosestActiveElement(); 28452 if (self.daysContainer !== undefined && (allowInput === false || activeElement && isInView(activeElement))) { 28453 var delta_1 = e.keyCode === 39 ? 1 : -1; 28454 if (!e.ctrlKey) focusOnDay(undefined, delta_1); 28455 else { 28456 e.stopPropagation(); 28457 changeMonth(delta_1); 28458 focusOnDay(getFirstAvailableDay(1), 0); 28459 } 28460 } 28461 } else if (self.hourElement) self.hourElement.focus(); 28462 break; 28463 case 38: 28464 case 40: 28465 e.preventDefault(); 28466 var delta = e.keyCode === 40 ? 1 : -1; 28467 if (self.daysContainer && eventTarget.$i !== undefined || eventTarget === self.input || eventTarget === self.altInput) { 28468 if (e.ctrlKey) { 28469 e.stopPropagation(); 28470 changeYear(self.currentYear - delta); 28471 focusOnDay(getFirstAvailableDay(1), 0); 28472 } else if (!isTimeObj) focusOnDay(undefined, delta * 7); 28473 } else if (eventTarget === self.currentYearElement) changeYear(self.currentYear - delta); 28474 else if (self.config.enableTime) { 28475 if (!isTimeObj && self.hourElement) self.hourElement.focus(); 28476 updateTime(e); 28477 self._debouncedChange(); 28478 } 28479 break; 28480 case 9: 28481 if (isTimeObj) { 28482 var elems = [ 28483 self.hourElement, 28484 self.minuteElement, 28485 self.secondElement, 28486 self.amPM 28487 ].concat(self.pluginElements).filter(function(x) { 28488 return x; 28489 }); 28490 var i = elems.indexOf(eventTarget); 28491 if (i !== -1) { 28492 var target = elems[i + (e.shiftKey ? -1 : 1)]; 28493 e.preventDefault(); 28494 (target || self._input).focus(); 28495 } 28496 } else if (!self.config.noCalendar && self.daysContainer && self.daysContainer.contains(eventTarget) && e.shiftKey) { 28497 e.preventDefault(); 28498 self._input.focus(); 28499 } 28500 break; 28501 default: 28502 break; 28503 } 28504 } 28505 if (self.amPM !== undefined && eventTarget === self.amPM) switch(e.key){ 28506 case self.l10n.amPM[0].charAt(0): 28507 case self.l10n.amPM[0].charAt(0).toLowerCase(): 28508 self.amPM.textContent = self.l10n.amPM[0]; 28509 setHoursFromInputs();
28510 updateValue(); 28511 break; 28512 case self.l10n.amPM[1].charAt(0): 28513 case self.l10n.amPM[1].charAt(0).toLowerCase(): 28514 self.amPM.textContent = self.l10n.amPM[1]; 28515 setHoursFromInputs(); 28516 updateValue(); 28517 break; 28518 } 28519 if (isInput || isCalendarElem(eventTarget)) triggerEvent("onKeyDown", e); 28520 } 28521 function onMouseOver(elem, cellClass) { 28522 if (cellClass === void 0) cellClass = "flatpickr-day"; 28523 if (self.selectedDates.length !== 1 || elem && (!elem.classList.contains(cellClass) || elem.classList.contains("flatpickr-disabled"))) return; 28524 var hoverDate = elem ? elem.dateObj.getTime() : self.days.firstElementChild.dateObj.getTime(), initialDate = self.parseDate(self.selectedDates[0], undefined, true).getTime(), rangeStartDate = Math.min(hoverDate, self.selectedDates[0].getTime()), rangeEndDate = Math.max(hoverDate, self.selectedDates[0].getTime()); 28525 var containsDisabled = false; 28526 var minRange = 0, maxRange = 0; 28527 for(var t = rangeStartDate; t < rangeEndDate; t += (0, _dates.duration).DAY)if (!isEnabled(new Date(t), true)) { 28528 containsDisabled = containsDisabled || t > rangeStartDate && t < rangeEndDate; 28529 if (t < initialDate && (!minRange || t > minRange)) minRange = t; 28530 else if (t > initialDate && (!maxRange || t < maxRange)) maxRange = t; 28531 } 28532 var hoverableCells = Array.from(self.rContainer.querySelectorAll("*:nth-child(-n+" + self.config.showMonths + ") > ." + cellClass)); 28533 hoverableCells.forEach(function(dayElem) { 28534 var date = dayElem.dateObj; 28535 var timestamp = date.getTime(); 28536 var outOfRange = minRange > 0 && timestamp < minRange || maxRange > 0 && timestamp > maxRange; 28537 if (outOfRange) { 28538 dayElem.classList.add("notAllowed"); 28539 [ 28540 "inRange", 28541 "startRange", 28542 "endRange" 28543 ].forEach(function(c) { 28544 dayElem.classList.remove(c); 28545 }); 28546 return; 28547 } else if (containsDisabled && !outOfRange) return; 28548 [ 28549 "startRange", 28550 "inRange", 28551 "endRange", 28552 "notAllowed" 28553 ].forEach(function(c) { 28554 dayElem.classList.remove(c); 28555 }); 28556 if (elem !== undefined) { 28557 elem.classList.add(hoverDate <= self.selectedDates[0].getTime() ? "startRange" : "endRange"); 28558 if (initialDate < hoverDate && timestamp === initialDate) dayElem.classList.add("startRange"); 28559 else if (initialDate > hoverDate && timestamp === initialDate) dayElem.classList.add("endRange"); 28560 if (timestamp >= minRange && (maxRange === 0 || timestamp <= maxRange) && (0, _dates.isBetween)(timestamp, initialDate, hoverDate)) dayElem.classList.add("inRange"); 28561 } 28562 }); 28563 } 28564 function onResize() { 28565 if (self.isOpen && !self.config.static && !self.config.inline) positionCalendar(); 28566 } 28567 function open(e, positionElement) { 28568 if (positionElement === void 0) positionElement = self._positionElement; 28569 if (self.isMobile === true) { 28570 if (e) { 28571 e.preventDefault(); 28572 var eventTarget = (0, _dom.getEventTarget)(e); 28573 if (eventTarget) eventTarget.blur(); 28574 } 28575 if (self.mobileInput !== undefined) { 28576 self.mobileInput.focus(); 28577 self.mobileInput.click(); 28578 } 28579 triggerEvent("onOpen"); 28580 return; 28581 } else if (self._input.disabled || self.config.inline) return; 28582 var wasOpen = self.isOpen; 28583 self.isOpen = true; 28584 if (!wasOpen) { 28585 self.calendarContainer.classList.add("open"); 28586 self._input.classList.add("active"); 28587 triggerEvent("onOpen"); 28588 positionCalendar(positionElement); 28589 } 28590 if (self.config.enableTime === true && self.config.noCalendar === true) { 28591 if (self.config.allowInput === false && (e === undefined || !self.timeContainer.contains(e.relatedTarget))) setTimeout(function() { 28592 return self.hourElement.select(); 28593 }, 50); 28594 } 28595 } 28596 function minMaxDateSetter(type) { 28597 return function(date) { 28598 var dateObj = self.config["_" + type + "Date"] = self.parseDate(date, self.config.dateFormat); 28599 var inverseDateObj = self.config["_" + (type === "min" ? "max" : "min") + "Date"]; 28600 if (dateObj !== undefined) self[type === "min" ? "minDateHasTime" : "maxDateHasTime"] = dateObj.getHours() > 0 || dateObj.getMinutes() > 0 || dateObj.getSeconds() > 0; 28601 if (self.selectedDates) { 28602 self.selectedDates = self.selectedDates.filter(function(d) { 28603 return isEnabled(d); 28604 }); 28605 if (!self.selectedDates.length && type === "min") setHoursFromDate(dateObj);
vendor: 2,481 bytes, lines 28606-28660
28606 updateValue(); 28607 } 28608 if (self.daysContainer) { 28609 redraw(); 28610 if (dateObj !== undefined) self.currentYearElement[type] = dateObj.getFullYear().toString(); 28611 else self.currentYearElement.removeAttribute(type); 28612 self.currentYearElement.disabled = !!inverseDateObj && dateObj !== undefined && inverseDateObj.getFullYear() === dateObj.getFullYear(); 28613 } 28614 }; 28615 } 28616 function parseConfig() { 28617 var boolOpts = [ 28618 "wrap", 28619 "weekNumbers", 28620 "allowInput", 28621 "allowInvalidPreload", 28622 "clickOpens", 28623 "time_24hr", 28624 "enableTime", 28625 "noCalendar", 28626 "altInput", 28627 "shorthandCurrentMonth", 28628 "inline", 28629 "static", 28630 "enableSeconds", 28631 "disableMobile" 28632 ]; 28633 var userConfig = __assign(__assign({}, JSON.parse(JSON.stringify(element.dataset || {}))), instanceConfig); 28634 var formats = {}; 28635 self.config.parseDate = userConfig.parseDate; 28636 self.config.formatDate = userConfig.formatDate; 28637 Object.defineProperty(self.config, "enable", { 28638 get: function() { 28639 return self.config._enable; 28640 }, 28641 set: function(dates) { 28642 self.config._enable = parseDateRules(dates); 28643 } 28644 }); 28645 Object.defineProperty(self.config, "disable", { 28646 get: function() { 28647 return self.config._disable; 28648 }, 28649 set: function(dates) { 28650 self.config._disable = parseDateRules(dates); 28651 } 28652 }); 28653 var timeMode = userConfig.mode === "time"; 28654 if (!userConfig.dateFormat && (userConfig.enableTime || timeMode)) { 28655 var defaultDateFormat = flatpickr.defaultConfig.dateFormat || (0, _options.defaults).dateFormat; 28656 formats.dateFormat = userConfig.noCalendar || timeMode ? "H:i" + (userConfig.enableSeconds ? ":S" : "") : defaultDateFormat + " H:i" + (userConfig.enableSeconds ? ":S" : ""); 28657 } 28658 if (userConfig.altInput && (userConfig.enableTime || timeMode) && !userConfig.altFormat) { 28659 var defaultAltFormat = flatpickr.defaultConfig.altFormat || (0, _options.defaults).altFormat; 28660 formats.altFormat = userConfig.noCalendar || timeMode ? "h:i" + (userConfig.enableSeconds ? ":S K" : " K") : defaultAltFormat + (" h:i"
28660+ (userConfig.enableSeconds ? ":S" : "") + " K"); 28661 } 28662 Object.defineProperty(self.config, "minDate", { 28663 get: function() { 28664 return self.config._minDate; 28665 }, 28666 set: minMaxDateSetter("min") 28667 }); 28668 Object.defineProperty(self.config, "maxDate", { 28669 get: function() { 28670 return self.config._maxDate; 28671 }, 28672 set: minMaxDateSetter("max") 28673 }); 28674 var minMaxTimeSetter = function(type) { 28675 return function(val) { 28676 self.config[type === "min" ? "_minTime" : "_maxTime"] = self.parseDate(val, "H:i:S"); 28677 }; 28678 }; 28679 Object.defineProperty(self.config, "minTime", { 28680 get: function() { 28681 return self.config._minTime; 28682 }, 28683 set: minMaxTimeSetter("min") 28684 }); 28685 Object.defineProperty(self.config, "maxTime", { 28686 get: function() { 28687 return self.config._maxTime; 28688 }, 28689 set: minMaxTimeSetter("max") 28690 }); 28691 if (userConfig.mode === "time") { 28692 self.config.noCalendar = true; 28693 self.config.enableTime = true; 28694 } 28695 Object.assign(self.config, formats, userConfig); 28696 for(var i = 0; i < boolOpts.length; i++)self.config[boolOpts[i]] = self.config[boolOpts[i]] === true || self.config[boolOpts[i]] === "true"; 28697 (0, _options.HOOKS).filter(function(hook) { 28698 return self.config[hook] !== undefined; 28699 }
28699).forEach(function(hook) { 28700 self.config[hook] = (0, _utils.arrayify)(self.config[hook] || []).map(bindToInstance); 28701 }); 28702 self.isMobile = !self.config.disableMobile && !self.config.inline && self.config.mode === "single" && !self.config.disable.length && !self.config.enable && !self.config.weekNumbers && /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent); 28703 for(var i = 0; i < self.config.plugins.length; i++){ 28704 var pluginConf = self.config.plugins[i](self) || {}; 28705 for(var key in pluginConf){ 28706 if ((0, _options.HOOKS).indexOf(key) > -1) self.config[key] = (0, _utils.arrayify)(pluginConf[key]).map(bindToInstance).concat(self.config[key]); 28707 else if (typeof userConfig[key] === "undefined") self.config[key] = pluginConf[key]; 28708 } 28709 } 28710 if (!userConfig.altInputClass) self.config.altInputClass = getInputElem().className + " " + self.config.altInputClass; 28711 triggerEvent("onParseConfig"); 28712 } 28713 function getInputElem() { 28714 return self.config.wrap ? element.querySelector("[data-input]") : element; 28715 } 28716 function setupLocale() { 28717 if (typeof self.config.locale !== "object" && typeof flatpickr.l10ns[self.config.locale] === "undefined") self.config.errorHandler(new Error("flatpickr: invalid locale " + self.config.locale)); 28718 self.l10n = __assign(__assign({}, flatpickr.l10ns.default), typeof self.config.locale === "object" ? self.config.locale : self.config.locale !== "default" ? flatpickr.l10ns[self.config.locale] : undefined); 28719 (0, _formatting.tokenRegex).D = "(" + self.l10n.weekdays.shorthand.join("|") + ")"; 28720 (0, _formatting.tokenRegex).l = "(" + self.l10n.weekdays.longhand.join("|") + ")"; 28721 (0, _formatting.tokenRegex).M = "(" + self.l10n.months.shorthand.join("|") + ")"; 28722 (0, _formatting.tokenRegex).F = "(" + self.l10n.months.longhand.join("|") + ")"; 28723 (0, _formatting.tokenRegex).K = "(" + self.l10n.amPM[0] + "|" + self.l10n.amPM[1] + "|" + self.l10n.amPM[0].toLowerCase() + "|" + self.l10n.amPM[1].toLowerCase() + ")"; 28724 var userConfig = __assign(__assign({}, instanceConfig), JSON.parse(JSON.stringify(element.dataset || {}))); 28725 if (userConfig.time_24hr === undefined && flatpickr.defaultConfig.time_24hr === undefined) self.config.time_24hr = self.l10n.time_24hr; 28726 self.formatDate = (0, _dates.createDateFormatter)(self); 28727 self.parseDate = (0, _dates.createDateParser)({ 28728 config: self.config, 28729 l10n: self.l10n 28730 }); 28731 } 28732 function positionCalendar(customPositionElement) { 28733 if (typeof self.config.position === "function") return void self.config.position(self, customPositionElement); 28734 if (self.calendarContainer === undefined) return; 28735 triggerEvent("onPreCalendarPosition"); 28736 var positionElement = customPositionElement || self._positionElement; 28737 var calendarHeight = Array.prototype.reduce.call(self.calendarContainer.children, function(acc, child) { 28738 return acc + child.offsetHeight; 28739 }, 0), calendarWidth = self.calendarContainer.offsetWidth, configPos = self.config.position.split(" "), configPosVertical = configPos[0], configPosHorizontal = configPos.length > 1 ? configPos[1] : null, inputBounds = positionElement.getBoundingClientRect(), distanceFromBottom = window.innerHeight - inputBounds.bottom, showOnTop = configPosVertical === "above" || configPosVertical !== "below" && distanceFromBottom < calendarHeight && inputBounds.top > calendarHeight; 28740 var top = window.pageYOffset + inputBounds.top + (!showOnTop ? positionElement.offsetHeight + 2 : -calendarHeight - 2); 28741 (0, _dom.toggleClass)(self.calendarContainer, "arrowTop", !showOnTop); 28742 (0, _dom.toggleClass)(self.calendarContainer, "arrowBottom", showOnTop); 28743 if (self.config.inline) return; 28744 var left = window.pageXOffset + inputBounds.left; 28745 var isCenter = false; 28746 var isRight = false; 28747 if (configPosHorizontal === "center") { 28748 left -= (calendarWidth - inputBounds.width) / 2; 28749 isCenter = true; 28750 } else if (configPosHorizontal === "right") { 28751 left -= calendarWidth - inputBounds.width; 28752 isRight = true; 28753 } 28754 (0, _dom.toggleClass)(self.calendarContainer, "arrowLeft", !isCenter && !isRight); 28755 (0, _dom.toggleClass)(self.calendarContainer, "arrowCenter", isCenter); 28756 (0, _dom.toggleClass)(self.calendarContainer, "arrowRight", isRight); 28757 var right = window.document.body.offsetWidth - (window.pageXOffset + inputBounds.right); 28758 var rightMost = left + calendarWidth > window.document.body.offsetWidth; 28759 var centerMost = right + calendarWidth > window.document.body.offsetWidth; 28760 (0, _dom.toggleClass)(self.calendarContainer, "rightMost", rightMost); 28761 if (self.config.static) return; 28762 self.calendarContainer.style.top = top + "px"; 28763 if (!rightMost) { 28764 self.calendarContainer.style.left = left + "px"; 28765 self.calendarContainer.style.right = "auto"; 28766 } else if (!centerMost) { 28767 self.calendarContainer.style.left = "auto"; 28768 self.calendarContainer.style.right = right + "px"; 28769 } else { 28770 var doc = getDocumentStyleSheet(); 28771 if (doc === undefined) return; 28772 var bodyWidth = window.document.body.offsetWidth; 28773 var centerLeft = Math.max(0, bodyWidth / 2 - calendarWidth / 2); 28774 var centerBefore = ".flatpickr-calendar.centerMost:before"; 28775 var centerAfter = ".flatpickr-calendar.centerMost:after"; 28776 var centerIndex = doc.cssRules.length; 28777 var centerStyle = "{left:" + inputBounds.left + "px;right:auto;}"; 28778 (0, _dom.toggleClass)(self.calendarContainer, "rightMost", false); 28779 (0, _dom.toggleClass)(self.calendarContainer, "centerMost", true); 28780 doc.insertRule(centerBefore + "," + centerAfter + centerStyle, centerIndex); 28781 self.calendarContainer.style.left = centerLeft + "px"; 28782 self.calendarContainer.style.right = "auto"; 28783 } 28784 } 28785 function getDocumentStyleSheet() { 28786 var editableSheet = null; 28787 for(var i = 0; i < document.styleSheets.length; i++){ 28788 var sheet = document.styleSheets[i]; 28789 if (!sheet.cssRules) continue; 28790 try { 28791 sheet.cssRules; 28792 } catch (err) { 28793 continue; 28794 } 28795 editableSheet = sheet; 28796 break; 28797 } 28798 return editableSheet != null ? editableSheet : createStyleSheet(); 28799 } 28800 function createStyleSheet() { 28801 var style = document.createElement("style"); 28802 document.head.appendChild(style); 28803 return style.sheet; 28804 } 28805 function redraw() { 28806 if (self.config.noCalendar || self.isMobile) return; 28807 buildMonthSwitch(); 28808 updateNavigationCurrentMonth(); 28809 buildDays(); 28810 } 28811 function focusAndClose() { 28812 self._input.focus(); 28813 if (window.navigator.userAgent.indexOf("MSIE") !== -1 || navigator.msMaxTouchPoints !== undefined) setTimeout(self.close, 0); 28814 else self.close(); 28815 } 28816 function selectDate(e) { 28817 e.preventDefault(); 28818 e.stopPropagation(); 28819 var isSelectable = function(day) { 28820 return day.classList && day.classList.contains("flatpickr-day") && !day.classList.contains("flatpickr-disabled") && !day.classList.contains("notAllowed"); 28821 }; 28822 var t = (0, _dom.findParent)((0, _dom.getEventTarget)(e), isSelectable); 28823 if (t === undefined) return; 28824 var target = t; 28825 var selectedDate = self.latestSelectedDateObj = new Date(target.dateObj.getTime()); 28826 var shouldChangeMonth = (selectedDate.getMonth() < self.currentMonth || selectedDate.getMonth() > self.currentMonth + self.config.showMonths - 1) && self.config.mode !== "range"; 28827 self.selectedDateElem = target; 28828 if (self.config.mode === "single") self.selectedDates = [ 28829 selectedDate 28830 ]; 28831 else if (self.config.mode === "multiple") { 28832 var selectedIndex = isDateSelected(selectedDate); 28833 if (selectedIndex) self.selectedDates.splice(parseInt(selectedIndex), 1); 28834 else self.selectedDates.push(selectedDate); 28835 } else if (self.config.mode === "range") { 28836 if (self.selectedDates.length === 2) self.clear(false, false); 28837 self.latestSelectedDateObj = selectedDate; 28838 self.selectedDates.push(selectedDate); 28839 if ((0, _dates.compareDates)(selectedDate, self.selectedDates[0], true) !== 0) self.selectedDates.sort(function(a, b) { 28840 return a.getTime() - b.getTime(); 28841 }); 28842 } 28843 setHoursFromInputs(); 28844 if (shouldChangeMonth) { 28845 var isNewYear = self.currentYear !== selectedDate.getFullYear(); 28846 self.currentYear = selectedDate.getFullYear(); 28847 self.currentMonth = selectedDate.getMonth(); 28848 if (isNewYear) { 28849 triggerEvent("onYearChange"); 28850 buildMonthSwitch(); 28851 } 28852 triggerEvent("onMonthChange"); 28853 } 28854 updateNavigationCurrentMonth(); 28855 buildDays();
28856 updateValue(); 28857 if (!shouldChangeMonth && self.config.mode !== "range" && self.config.showMonths === 1) focusOnDayElem(target); 28858 else if (self.selectedDateElem !== undefined && self.hourElement === undefined) self.selectedDateElem && self.selectedDateElem.focus(); 28859 if (self.hourElement !== undefined) self.hourElement !== undefined && self.hourElement.focus(); 28860 if (self.config.closeOnSelect) { 28861 var single = self.config.mode === "single" && !self.config.enableTime; 28862 var range = self.config.mode === "range" && self.selectedDates.length === 2 && !self.config.enableTime; 28863 if (single || range) focusAndClose(); 28864 } 28865 triggerChange(); 28866 } 28867 var CALLBACKS = { 28868 locale: [ 28869 setupLocale, 28870 updateWeekdays 28871 ], 28872 showMonths: [ 28873 buildMonths, 28874 setCalendarWidth, 28875 buildWeekdays 28876 ], 28877 minDate: [ 28878 jumpToDate 28879 ], 28880 maxDate: [ 28881 jumpToDate 28882 ], 28883 positionElement: [ 28884 updatePositionElement 28885 ], 28886 clickOpens: [ 28887 function() { 28888 if (self.config.clickOpens === true) {
28889 bind(self._input, "focus", self.open); 28890 bind(self._input, "click", self.open); 28891 } else { 28892 self._input.removeEventListener("focus", self.open); 28893 self._input.removeEventListener("click", self.open); 28894 } 28895 } 28896 ] 28897 }; 28898 function set(option, value) { 28899 if (option !== null && typeof option === "object") { 28900 Object.assign(self.config, option); 28901 for(var key in option)if (CALLBACKS[key] !== undefined) CALLBACKS[key].forEach(function(x) { 28902 return x(); 28903 }); 28904 } else { 28905 self.config[option] = value; 28906 if (CALLBACKS[option] !== undefined) CALLBACKS[option].forEach(function(x) { 28907 return x(); 28908 }); 28909 else if ((0, _options.HOOKS).indexOf(option) > -1) self.config[option] = (0, _utils.arrayify)(value); 28910 } 28911 self.redraw(); 28912 updateValue(true); 28913 } 28914 function setSelectedDate(inputDate, format) { 28915 var dates = []; 28916 if (inputDate instanceof Array) dates = inputDate.map(function(d) { 28917 return self.parseDate(d, format); 28918 }); 28919 else if (inputDate instanceof Date || typeof inputDate === "number") dates = [ 28920 self.parseDate(inputDate, format) 28921 ]; 28922 else if (typeof inputDate === "string") switch(self.config.mode){ 28923 case "single": 28924 case "time": 28925 dates = [ 28926 self.parseDate(inputDate, format) 28927 ]; 28928 break; 28929 case "multiple": 28930 dates = inputDate.split(self.config.conjunction).map(function(date) { 28931 return self.parseDate(date, format); 28932 }); 28933 break; 28934 case "range": 28935 dates = inputDate.split(self.l10n.rangeSeparator).map(function(date) { 28936 return self.parseDate(date, format); 28937 }); 28938 break; 28939 default: 28940 break; 28941 } 28942 else self.config.errorHandler(new Error("Invalid date supplied: " + JSON.stringify(inputDate))); 28943 self.selectedDates = self.config.allowInvalidPreload ? dates : dates.filter(function(d) { 28944 return d instanceof Date && isEnabled(d, false); 28945 }); 28946 if (self.config.mode === "range") self.selectedDates.sort(function(a, b) { 28947 return a.getTime() - b.getTime(); 28948 }); 28949 } 28950 function setDate(date, triggerChange, format) { 28951 if (triggerChange === void 0) triggerChange = false; 28952 if (format === void 0) format = self.config.dateFormat; 28953 if (date !== 0 && !date || date instanceof Array && date.length === 0) return self.clear(triggerChange); 28954 setSelectedDate(date, format); 28955 self.latestSelectedDateObj = self.selectedDates[self.selectedDates.length - 1]; 28956 self.redraw(); 28957 jumpToDate(undefined, triggerChange); 28958 setHoursFromDate(); 28959 if (self.selectedDates.length === 0) self.clear(false); 28960 updateValue(triggerChange); 28961 if (triggerChange) triggerEvent("onChange"); 28962 } 28963 function parseDateRules(arr) { 28964 return arr.slice().map(function(rule) { 28965 if (typeof rule === "string" || typeof rule === "number" || rule instanceof Date) return self.parseDate(rule, undefined, true); 28966 else if (rule && typeof rule === "object" && rule.from && rule.to) return { 28967 from: self.parseDate(rule.from, undefined), 28968 to: self.parseDate(rule.to, undefined) 28969 }; 28970 return rule; 28971 }).filter(function(x) { 28972 return x; 28973 }); 28974 } 28975 function setupDates() { 28976 self.selectedDates = []; 28977 self.now = self.parseDate(self.config.now) || new Date(); 28978 var preloadedDate = self.config.defaultDate || ((self.input.nodeName === "INPUT" || self.input.nodeName === "TEXTAREA") && self.input.placeholder && self.input.value === self.input.placeholder ? null : self.input.value); 28979 if (preloadedDate) setSelectedDate(preloadedDate, self.config.dateFormat); 28980 self._initialDate = self.selectedDates.length > 0 ? self.selectedDates[0] : self.config.minDate && self.config.minDate.getTime() > self.now.getTime() ? self.config.minDate : self.config.maxDate && self.config.maxDate.getTime() < self.now.getTime() ? self.config.maxDate : self.now; 28981 self.currentYear = self._initialDate.getFullYear(); 28982 self.currentMonth = self._initialDate.getMonth(); 28983 if (self.selectedDates.length > 0) self.latestSelectedDateObj = self.selectedDates[0]; 28984 if (self.config.minTime !== undefined) self.config.minTime = self.parseDate(self.config.minTime, "H:i"); 28985 if (self.config.maxTime !== undefined) self.config.maxTime = self.parseDate(self.config.maxTime, "H:i"); 28986 self.minDateHasTime = !!self.config.minDate && (self.config.minDate.getHours() > 0 || self.config.minDate.getMinutes() > 0 || self.config.minDate.getSeconds() > 0); 28987 self.maxDateHasTime = !!self.config.maxDate && (self.config.maxDate.getHours() > 0 || self.config.maxDate.getMinutes() > 0 || self.config.maxDate.getSeconds() > 0); 28988 } 28989 function setupInputs() { 28990 self.input = getInputElem(); 28991 if (!self.input) { 28992 self.config.errorHandler(new Error("Invalid input element specified")); 28993 return; 28994 } 28995 self.input._type = self.input.type; 28996 self.input.type = "text"; 28997 self.input.classList.add("flatpickr-input"); 28998 self._input = self.input; 28999 if (self.config.altInput) { 29000 self.altInput = (0, _dom.createElement)(self.input.nodeName, self.config.altInputClass); 29001 self._input = self.altInput; 29002 self.altInput.placeholder = self.input.placeholder; 29003 self.altInput.disabled = self.input.disabled; 29004 self.altInput.required = self.input.required; 29005 self.altInput.tabIndex = self.input.tabIndex; 29006 self.altInput.type = "text"; 29007 self.input.setAttribute("type", "hidden"); 29008 if (!self.config.static && self.input.parentNode) self.input.parentNode.insertBefore(self.altInput, self.input.nextSibling); 29009 }
29010 if (!self.config.allowInput) self._input.setAttribute("readonly", "readonly"); 29011 updatePositionElement(); 29012 } 29013 function updatePositionElement() { 29014 self._positionElement = self.config.positionElement || self._input; 29015 } 29016 function setupMobile() { 29017 var inputType = self.config.enableTime ? self.config.noCalendar ? "time" : "datetime-local" : "date"; 29018 self.mobileInput = (0, _dom.createElement)("input", self.input.className + " flatpickr-mobile"); 29019 self.mobileInput.tabIndex = 1; 29020 self.mobileInput.type = inputType; 29021 self.mobileInput.disabled = self.input.disabled; 29022 self.mobileInput.required = self.input.required; 29023 self.mobileInput.placeholder = self.input.placeholder; 29024 self.mobileFormatStr = inputType === "datetime-local" ? "Y-m-d\\TH:i:S" : inputType === "date" ? "Y-m-d" : "H:i:S"; 29025 if (self.selectedDates.length > 0) self.mobileInput.defaultValue = self.mobileInput.value = self.formatDate(self.selectedDates[0], self.mobileFormatStr); 29026 if (self.config.minDate) self.mobileInput.min = self.formatDate(self.config.minDate, "Y-m-d"); 29027 if (self.config.maxDate) self.mobileInput.max = self.formatDate(self.config.maxDate, "Y-m-d"); 29028 if (self.input.getAttribute("step")) self.mobileInput.step = String(self.input.getAttribute("step")); 29029 self.input.type = "hidden"; 29030 if (self.altInput !== undefined) self.altInput.type = "hidden"; 29031 try { 29032 if (self.input.parentNode) self.input.parentNode.insertBefore(self.mobileInput, self.input.nextSibling); 29033 } catch (_a) {} 29034 bind(self.mobileInput, "change", function(e) { 29035 self.setDate((0, _dom.getEventTarget)(e).value, false, self.mobileFormatStr); 29036 triggerEvent("onChange"); 29037 triggerEvent("onClose"); 29038 }); 29039 } 29040 function toggle(e) { 29041 if (self.isOpen === true) return self.close(); 29042 self.open(e); 29043 } 29044 function triggerEvent(event, data) { 29045 if (self.config === undefined) return; 29046 var hooks = self.config[event]; 29047 if (hooks !== undefined && hooks.length > 0) for(var i = 0; hooks[i] && i < hooks.length; i++)hooks[i](self.selectedDates, self.input.value, self, data); 29048 if (event === "onChange") { 29049 self.input.dispatchEvent(createEvent("change")); 29050 self.input.dispatchEvent(createEvent("input")); 29051 } 29052 } 29053 function createEvent(name) { 29054 var e = document.createEvent("Event"); 29055 e.initEvent(name, true, true); 29056 return e; 29057 } 29058 function isDateSelected(date) { 29059 for(var i = 0; i < self.selectedDates.length; i++){ 29060 var selectedDate = self.selectedDates[i]; 29061 if (selectedDate instanceof Date && (0, _dates.compareDates)(selectedDate, date) === 0) return "" + i; 29062 } 29063 return false; 29064 } 29065 function isDateInRange(date) { 29066 if (self.config.mode !== "range" || self.selectedDates.length < 2) return false; 29067 return (0, _dates.compareDates)(date, self.selectedDates[0]) >= 0 && (0, _dates.compareDates)(date, self.selectedDates[1]) <= 0; 29068 } 29069 function updateNavigationCurrentMonth() { 29070 if (self.config.noCalendar || self.isMobile || !self.monthNav) return; 29071 self.yearElements.forEach(function(yearElement, i) { 29072 var d = new Date(self.currentYear, self.currentMonth, 1); 29073 d.setMonth(self.currentMonth + i); 29074 if (self.config.showMonths > 1 || self.config.monthSelectorType === "static") self.monthElements[i].textContent = (0, _formatting.monthToStr)(d.getMonth(), self.config.shorthandCurrentMonth, self.l10n) + " "; 29075 else self.monthsDropdownContainer.value = d.getMonth().toString(); 29076 yearElement.value = d.getFullYear().toString(); 29077 }); 29078 self._hidePrevMonthArrow = self.config.minDate !== undefined && (self.currentYear === self.config.minDate.getFullYear() ? self.currentMonth <= self.config.minDate.getMonth() : self.currentYear < self.config.minDate.getFullYear()); 29079 self._hideNextMonthArrow = self.config.maxDate !== undefined && (self.currentYear === self.config.maxDate.getFullYear() ? self.currentMonth + 1 > self.config.maxDate.getMonth() : self.currentYear >
29079 self.config.maxDate.getFullYear()); 29080 } 29081 function getDateStr(specificFormat) { 29082 var format = specificFormat || (self.config.altInput ? self.config.altFormat : self.config.dateFormat); 29083 return self.selectedDates.map(function(dObj) { 29084 return self.formatDate(dObj, format); 29085 }).filter(function(d, i, arr) { 29086 return self.config.mode !== "range" || self.config.enableTime || arr.indexOf(d) === i; 29087 }).join(self.config.mode !== "range" ? self.config.conjunction : self.l10n.rangeSeparator); 29088 } 29089 function updateValue(triggerChange) { 29090 if (triggerChange === void 0) triggerChange = true; 29091 if (self.mobileInput !== undefined && self.mobileFormatStr) self.mobileInput.value = self.latestSelectedDateObj !== undefined ? self.formatDate(self.latestSelectedDateObj, self.mobileFormatStr) : ""; 29092 self.input.value = getDateStr(self.config.dateFormat); 29093 if (self.altInput !== undefined) self.altInput.value = getDateStr(self.config.altFormat); 29094 if (triggerChange !== false) triggerEvent("onValueUpdate"); 29095 } 29096 function onMonthNavClick(e) { 29097 var eventTarget = (0, _dom.getEventTarget)(e); 29098 var isPrevMonth = self.prevMonthNav.contains(eventTarget); 29099 var isNextMonth = self.nextMonthNav.contains(eventTarget); 29100 if (isPrevMonth || isNextMonth) changeMonth(isPrevMonth ? -1 : 1); 29101 else if (self.yearElements.indexOf(eventTarget) >= 0) eventTarget.select(); 29102 else if (eventTarget.classList.contains("arrowUp")) self.changeYear(self.currentYear + 1); 29103 else if (eventTarget.classList.contains("arrowDown")) self.changeYear(self.currentYear - 1); 29104 } 29105 function timeWrapper(e) { 29106 e.preventDefault(); 29107 var isKeyDown = e.type === "keydown", eventTarget = (0, _dom.getEventTarget)(e), input = eventTarget; 29108 if (self.amPM !== undefined && eventTarget === self.amPM) self.amPM.textContent = self.l10n.amPM[(0, _utils.int)(self.amPM.textContent === self.l10n.amPM[0])]; 29109 var min = parseFloat(input.getAttribute("min")), max = parseFloat(input.getAttribute("max")), step = parseFloat(input.getAttribute("step")), curValue = parseInt(input.value, 10), delta = e.delta || (isKeyDown ? e.which === 38 ? 1 : -1 : 0); 29110 var newValue = curValue + step * delta; 29111 if (typeof input.value !== "undefined" && input.value.length === 2) { 29112 var isHourElem = input === self.hourElement, isMinuteElem = input === self.minuteElement; 29113 if (newValue < min) { 29114 newValue = max + newValue + (0, _utils.int)(!isHourElem) + ((0, _utils.int)(isHourElem) && (0, _utils.int)(!self.amPM)); 29115 if (isMinuteElem) incrementNumInput(undefined, -1, self.hourElement); 29116 } else if (newValue > max) { 29117 newValue = input === self.hourElement ? newValue - max - (0, _utils.int)(!self.amPM) : min; 29118 if (isMinuteElem) incrementNumInput(undefined, 1, self.hourElement); 29119 } 29120 if (self.amPM && isHourElem && (step === 1 ? newValue + curValue === 23 : Math.abs(newValue - curValue) > step)) self.amPM.textContent = self.l10n.amPM[(0, _utils.int)(self.amPM.textContent === self.l10n.amPM[0])]; 29121 input.value = (0, _utils.pad)(newValue); 29122 } 29123 } 29124 init(); 29125 return self; 29126} 29127function _flatpickr(nodeList, config) { 29128 var nodes = Array.prototype.slice.call(nodeList).filter(function(x) { 29129 return x instanceof HTMLElement; 29130 }); 29131 var instances = []; 29132 for(var i = 0; i < nodes.length; i++){ 29133 var node = nodes[i]; 29134 try { 29135 if (node.getAttribute("data-fp-omit") !== null) continue; 29136 if (node._flatpickr !== undefined) { 29137 node._flatpickr.destroy(); 29138 node._flatpickr = undefined; 29139 } 29140 node._flatpickr = FlatpickrInstance(node, config || {}); 29141 instances.push(node._flatpickr); 29142 } catch (e) { 29143 console.error(e); 29144 } 29145 } 29146 return instances.length === 1 ? instances[0] : instances; 29147} 29148if (typeof HTMLElement !== "undefined" && typeof HTMLCollection !== "undefined" && typeof NodeList !== "undefined") { 29149 HTMLCollection.prototype.flatpickr = NodeList.prototype.flatpickr = function(config) { 29150 return _flatpickr(this, config); 29151 }; 29152 HTMLElement.prototype.flatpickr = function(config) { 29153 return _flatpickr([ 29154 this 29155 ], config); 29156 }; 29157} 29158var flatpickr = function(selector, config) { 29159 if (typeof selector === "string") return _flatpickr(window.document.querySelectorAll(selector), config); 29160 else if (selector instanceof Node) return _flatpickr([ 29161 selector
29162 ], config); 29163 else return _flatpickr(selector, config); 29164}; 29165flatpickr.defaultConfig = {}; 29166flatpickr.l10ns = { 29167 en: __assign({}, (0, _defaultDefault.default)), 29168 default: __assign({}, (0, _defaultDefault.default)) 29169}; 29170flatpickr.localize = function(l10n) { 29171 flatpickr.l10ns.default = __assign(__assign({}, flatpickr.l10ns.default), l10n); 29172}; 29173flatpickr.setDefaults = function(config) { 29174 flatpickr.defaultConfig = __assign(__assign({}, flatpickr.defaultConfig), config); 29175}; 29176flatpickr.parseDate = (0, _dates.createDateParser)({}); 29177flatpickr.formatDate = (0, _dates.createDateFormatter)({}); 29178flatpickr.compareDates = (0, _dates.compareDates); 29179if (typeof jQuery !== "undefined" && typeof jQuery.fn !== "undefined") jQuery.fn.flatpickr = function(config) { 29180 return _flatpickr(this, config); 29181}; 29182Date.prototype.fp_incr = function(days) { 29183 return new Date(this.getFullYear(), this.getMonth(), this.getDate() + (typeof days === "string" ? parseInt(days, 10) : days)); 29184}; 29185if (typeof window !== "undefined") window.flatpickr = flatpickr; 29186exports.default = flatpickr; 29187 29188},{"./types/options":"KwWqH","./l10n/default":"eLxe7","./utils":"ex98D","./utils/dom":"kBSML","./utils/dates":"gFzVN","./utils/formatting":"FWHF7","./utils/polyfills":"jig0D","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"KwWqH":[function(require,module,exports,__globalThis) { 29189var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 29190parcelHelpers.defineInteropFlag(exports); 29191parcelHelpers.export(exports, "HOOKS", ()=>HOOKS); 29192parcelHelpers.export(exports, "defaults", ()=>defaults); 29193var HOOKS = [ 29194 "onChange", 29195 "onClose", 29196 "onDayCreate", 29197 "onDestroy", 29198 "onKeyDown", 29199 "onMonthChange", 29200 "onOpen", 29201 "onParseConfig", 29202 "onReady", 29203 "onValueUpdate", 29204 "onYearChange", 29205 "onPreCalendarPosition" 29206]; 29207var defaults = { 29208 _disable: [], 29209 allowInput: false, 29210 allowInvalidPreload: false, 29211 altFormat: "F j, Y", 29212 altInput: false, 29213 altInputClass: "form-control input", 29214 animate: typeof window === "object" && window.navigator.userAgent.indexOf("MSIE") === -1, 29215 ariaDateFormat: "F j, Y", 29216 autoFillDefaultTime: true, 29217 clickOpens: true, 29218 closeOnSelect: true, 29219 conjunction: ", ", 29220 dateFormat: "Y-m-d", 29221 defaultHour: 12, 29222 defaultMinute: 0, 29223 defaultSeconds: 0, 29224 disable: [], 29225 disableMobile: false, 29226 enableSeconds: false, 29227 enableTime: false, 29228 errorHandler: function(err) { 29229 return typeof console !== "undefined" && console.warn(err); 29230 }, 29231 getWeek: function(givenDate) { 29232 var date = new Date(givenDate.getTime()); 29233 date.setHours(0, 0, 0, 0); 29234 date.setDate(date.getDate() + 3 - (date.getDay() + 6) % 7); 29235 var week1 = new Date(date.getFullYear(), 0, 4); 29236 return 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000 - 3 + (week1.getDay() + 6) % 7) / 7); 29237 }, 29238 hourIncrement: 1, 29239 ignoredFocusElements: [], 29240 inline: false, 29241 locale: "default", 29242 minuteIncrement: 5, 29243 mode: "single", 29244 monthSelectorType: "dropdown", 29245 nextArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M13.207 8.472l-7.854 7.854-0.707-0.707 7.146-7.146-7.146-7.148 0.707-0.707 7.854 7.854z' /></svg>", 29246 noCalendar: false, 29247 now: new Date(), 29248 onChange: [], 29249 onClose: [], 29250 onDayCreate: [], 29251 onDestroy: [], 29252 onKeyDown: [], 29253 onMonthChange: [], 29254 onOpen: [], 29255 onParseConfig: [], 29256 onReady: [], 29257 onValueUpdate: [], 29258 onYearChange: [], 29259 onPreCalendarPosition: [], 29260 plugins: [], 29261 position: "auto", 29262 positionElement: undefined, 29263 prevArrow: "<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' viewBox='0 0 17 17'><g></g><path d='M5.207 8.471l7.146 7.147-0.707 0.707-7.853-7.854 7.854-7.853 0.707 0.707-7.147 7.146z' /></svg>", 29264 shorthandCurrentMonth: false, 29265 showMonths: 1, 29266 static: false, 29267 time_24hr: false, 29268 weekNumbers: false, 29269 wrap: false 29270}; 29271 29272},{"@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"eLxe7":[function(require,module,exports,__globalThis) { 29273var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 29274parcelHelpers.defineInteropFlag(exports); 29275parcelHelpers.export(exports, "english", ()=>english); 29276var english = { 29277 weekdays: { 29278 shorthand: [ 29279 "Sun", 29280 "Mon", 29281 "Tue", 29282 "Wed", 29283 "Thu", 29284 "Fri", 29285 "Sat" 29286 ], 29287 longhand: [ 29288 "Sunday", 29289 "Monday", 29290 "Tuesday", 29291 "Wednesday", 29292 "Thursday", 29293 "Friday", 29294 "Saturday" 29295 ] 29296 }, 29297 months: { 29298 shorthand: [ 29299 "Jan", 29300 "Feb", 29301 "Mar", 29302 "Apr", 29303 "May", 29304 "Jun", 29305 "Jul", 29306 "Aug", 29307 "Sep", 29308 "Oct", 29309 "Nov", 29310 "Dec" 29311 ], 29312 longhand: [ 29313 "January", 29314 "February", 29315 "March", 29316 "April", 29317 "May", 29318 "June", 29319 "July", 29320 "August", 29321 "September", 29322 "October", 29323 "November", 29324 "December" 29325 ] 29326 }, 29327 daysInMonth: [ 29328 31, 29329 28, 29330 31, 29331 30, 29332 31, 29333 30, 29334 31, 29335 31, 29336 30, 29337 31, 29338 30, 29339 31 29340 ], 29341 firstDayOfWeek: 0, 29342 ordinal: function(nth) { 29343 var s = nth % 100; 29344 if (s > 3 && s < 21) return "th"; 29345 switch(s % 10){ 29346 case 1: 29347 return "st"; 29348 case 2: 29349 return "nd"; 29350 case 3: 29351 return "rd"; 29352 default: 29353 return "th"; 29354 } 29355 }, 29356 rangeSeparator: " to ", 29357 weekAbbreviation: "Wk", 29358 scrollTitle: "Scroll to increment", 29359 toggleTitle: "Click to toggle", 29360 amPM: [ 29361 "AM", 29362 "PM" 29363 ], 29364 yearAriaLabel: "Year", 29365 monthAriaLabel: "Month", 29366 hourAriaLabel: "Hour", 29367 minuteAriaLabel: "Minute", 29368 time_24hr: false 29369}; 29370exports.default = english; 29371 29372},{"@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"ex98D":[function(require,module,exports,__globalThis) { 29373var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 29374parcelHelpers.defineInteropFlag(exports); 29375parcelHelpers.export(exports, "pad", ()=>pad); 29376parcelHelpers.export(exports, "int", ()=>int); 29377parcelHelpers.export(exports, "debounce", ()=>debounce); 29378parcelHelpers.export(exports, "arrayify", ()=>arrayify); 29379var pad = function(number, length) { 29380 if (length === void 0) length = 2; 29381 return ("000" + number).slice(length * -1); 29382}; 29383var int = function(bool) { 29384 return bool === true ? 1 : 0; 29385}; 29386function debounce(fn, wait) { 29387 var t; 29388 return function() { 29389 var _this = this; 29390 var args = arguments; 29391 clearTimeout(t); 29392 t = setTimeout(function() { 29393 return fn.apply(_this, args); 29394 }, wait); 29395 }; 29396} 29397var arrayify = function(obj) { 29398 return obj instanceof Array ? obj : [ 29399 obj 29400 ]; 29401}; 29402 29403},{"@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"kBSML":[function(require,module,exports,__globalThis) { 29404var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 29405parcelHelpers.defineInteropFlag(exports); 29406parcelHelpers.export(exports, "toggleClass", ()=>toggleClass); 29407parcelHelpers.export(exports, "createElement", ()=>createElement); 29408parcelHelpers.export(exports, "clearNode", ()=>clearNode); 29409parcelHelpers.export(exports, "findParent", ()=>findParent); 29410parcelHelpers.export(exports, "createNumberInput", ()=>createNumberInput); 29411parcelHelpers.export(exports, "getEventTarget", ()=>getEventTarget); 29412function toggleClass(elem, className, bool) { 29413 if (bool === true) return elem.classList.add(className); 29414 elem.classList.remove(className); 29415} 29416function createElement(tag, className, content) { 29417 var e = window.document.createElement(tag); 29418 className = className || ""; 29419 content = content || ""; 29420 e.className = className; 29421 if (content !== undefined) e.textContent = content; 29422 return e; 29423} 29424function clearNode(node) { 29425 while(node.firstChild)node.removeChild(node.firstChild); 29426} 29427function findParent(node, condition) { 29428 if (condition(node)) return node; 29429 else if (node.parentNode) return findParent(node.parentNode, condition); 29430 return undefined; 29431} 29432function createNumberInput(inputClassName, opts) { 29433 var wrapper = createElement("div", "numInputWrapper"), numInput = createElement("input", "numInput " + inputClassName), arrowUp = createElement("span", "arrowUp"), arrowDown = createElement("span", "arrowDown"); 29434 if (navigator.userAgent.indexOf("MSIE 9.0") === -1) numInput.type = "number"; 29435 else { 29436 numInput.type = "text"; 29437 numInput.pattern = "\\d*"; 29438 } 29439 if (opts !== undefined) for(var key in opts)numInput.setAttribute(key, opts[key]); 29440 wrapper.appendChild(numInput); 29441 wrapper.appendChild(arrowUp); 29442 wrapper.appendChild(arrowDown); 29443 return wrapper; 29444} 29445function getEventTarget(event) { 29446 try { 29447 if (typeof event.composedPath === "function") { 29448 var path = event.composedPath(); 29449 return path[0]; 29450 } 29451 return event.target; 29452 } catch (error) { 29453 return event.target; 29454 } 29455} 29456 29457},{"@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"gFzVN":[function(require,module,exports,__globalThis) { 29458var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 29459parcelHelpers.defineInteropFlag(exports); 29460parcelHelpers.export(exports, "createDateFormatter", ()=>createDateFormatter); 29461parcelHelpers.export(exports, "createDateParser", ()=>createDateParser); 29462parcelHelpers.export(exports, "compareDates", ()=>compareDates); 29463parcelHelpers.export(exports, "compareTimes", ()=>compareTimes); 29464parcelHelpers.export(exports, "isBetween", ()=>isBetween); 29465parcelHelpers.export(exports, "calculateSecondsSinceMidnight", ()=>calculateSecondsSinceMidnight); 29466parcelHelpers.export(exports, "parseSeconds", ()=>parseSeconds); 29467parcelHelpers.export(exports, "duration", ()=>duration); 29468parcelHelpers.export(exports, "getDefaultHours", ()=>getDefaultHours); 29469var _formatting = require("./formatting"); 29470var _options = require("../types/options"); 29471var _default = require("../l10n/default"); 29472var createDateFormatter = function(_a) { 29473 var _b = _a.config, config = _b === void 0 ? (0, _options.defaults) : _b, _c = _a.l10n, l10n = _c === void 0 ? (0, _default.english) : _c, _d = _a.isMobile, isMobile = _d === void 0 ? false : _d; 29474 return function(dateObj, frmt, overrideLocale) { 29475 var locale = overrideLocale || l10n; 29476 if (config.formatDate !== undefined && !isMobile) return config.formatDate(dateObj, frmt, locale); 29477 return frmt.split("").map(function(c, i, arr) { 29478 return (0, _formatting.formats)[c] && arr[i - 1] !== "\\" ? (0, _formatting.formats)[c](dateObj, locale, config) : c !== "\\" ? c : ""; 29479 }).join(""); 29480 }; 29481}; 29482var createDateParser = function(_a) { 29483 var _b = _a.config, config = _b === void 0 ? (0, _options.defaults) : _b, _c = _a.l10n, l10n = _c === void 0 ? (0, _default.english) : _c; 29484 return function(date, givenFormat, timeless, customLocale) { 29485 if (date !== 0 && !date) return undefined; 29486 var locale = customLocale || l10n; 29487 var parsedDate; 29488 var dateOrig = date; 29489 if (date instanceof Date) parsedDate = new Date(date.getTime()); 29490 else if (typeof date !== "string" && date.toFixed !== undefined) parsedDate = new Date(date); 29491 else if (typeof date === "string") { 29492 var format = givenFormat || (config || (0, _options.defaults)).dateFormat; 29493 var datestr = String(date).trim(); 29494 if (datestr === "today") { 29495 parsedDate = new Date(); 29496 timeless = true; 29497 } else if (config && config.parseDate) parsedDate = config.parseDate(date, format); 29498 else if (/Z$/.test(datestr) || /GMT$/.test(datestr)) parsedDate = new Date(date); 29499 else { 29500 var matched = void 0, ops = []; 29501 for(var i = 0, matchIndex = 0, regexStr = ""; i < format.length; i++){ 29502 var token = format[i]; 29503 var isBackSlash = token === "\\"; 29504 var escaped = format[i - 1] === "\\" || isBackSlash; 29505 if ((0, _formatting.tokenRegex)[token] && !escaped) { 29506 regexStr += (0, _formatting.tokenRegex)[token]; 29507 var match = new RegExp(regexStr).exec(date); 29508 if (match && (matched = true)) ops[token !== "Y" ? "push" : "unshift"]({ 29509 fn: (0, _formatting.revFormat)[token], 29510 val: match[++matchIndex] 29511 }); 29512 } else if (!isBackSlash) regexStr += "."; 29513 } 29514 parsedDate = !config || !config.noCalendar ? new Date(new Date().getFullYear(), 0, 1, 0, 0, 0, 0) : new Date(new Date().setHours(0, 0, 0, 0)); 29515 ops.forEach(function(_a) { 29516 var fn = _a.fn, val = _a.val; 29517 return parsedDate = fn(parsedDate, val, locale) || parsedDate; 29518 }); 29519 parsedDate = matched ? parsedDate : undefined; 29520 } 29521 } 29522 if (!(parsedDate instanceof Date && !isNaN(parsedDate.getTime()))) { 29523 config.errorHandler(new Error("Invalid date provided: " + dateOrig)); 29524 return undefined; 29525 } 29526 if (timeless === true) parsedDate.setHours(0, 0, 0, 0); 29527 return parsedDate; 29528 }; 29529}; 29530function compareDates(date1, date2, timeless) { 29531 if (timeless === void 0) timeless = true; 29532 if (timeless !== false) return new Date(date1.getTime()).setHours(0, 0, 0, 0) - new Date(date2.getTime()).setHours(0, 0, 0, 0); 29533 return date1.getTime() - date2.getTime(); 29534} 29535function compareTimes(date1, date2) { 29536 return 3600 * (date1.getHours() - date2.getHours()) + 60 * (date1.getMinutes() - date2.getMinutes()) + date1.getSeconds() - date2.getSeconds(); 29537} 29538var isBetween = function(ts, ts1, ts2) { 29539 return ts > Math.min(ts1, ts2) && ts < Math.max(ts1, ts2); 29540}; 29541var calculateSecondsSinceMidnight = function(hours, minutes, seconds) { 29542 return hours * 3600 + minutes * 60 + seconds; 29543}; 29544var parseSeconds = function(secondsSinceMidnight) { 29545 var hours = Math.floor(secondsSinceMidnight / 3600), minutes = (secondsSinceMidnight - hours * 3600) / 60; 29546 return [ 29547 hours, 29548 minutes, 29549 secondsSinceMidnight - hours * 3600 - minutes * 60 29550 ]; 29551}; 29552var duration = { 29553 DAY: 86400000 29554}; 29555function getDefaultHours(config) { 29556 var hours = config.defaultHour; 29557 var minutes = config.defaultMinute; 29558 var seconds = config.defaultSeconds; 29559 if (config.minDate !== undefined) { 29560 var minHour = config.minDate.getHours(); 29561 var minMinutes = config.minDate.getMinutes(); 29562 var minSeconds = config.minDate.getSeconds(); 29563 if (hours < minHour) hours = minHour; 29564 if (hours === minHour && minutes < minMinutes) minutes = minMinutes; 29565 if (hours === minHour && minutes === minMinutes && seconds < minSeconds) seconds = config.minDate.getSeconds(); 29566 } 29567 if (config.maxDate !== undefined) { 29568 var maxHr = config.maxDate.getHours(); 29569 var maxMinutes = config.maxDate.getMinutes(); 29570 hours = Math.min(hours, maxHr); 29571 if (hours === maxHr) minutes = Math.min(maxMinutes, minutes); 29572 if (hours === maxHr && minutes === maxMinutes) seconds = config.maxDate.getSeconds(); 29573 } 29574 return { 29575 hours: hours, 29576 minutes: minutes, 29577 seconds: seconds 29578 }; 29579} 29580 29581},{"./formatting":"FWHF7","../types/options":"KwWqH","../l10n/default":"eLxe7","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"FWHF7":[function(require,module,exports,__globalThis) { 29582var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 29583parcelHelpers.defineInteropFlag(exports); 29584parcelHelpers.export(exports, "monthToStr", ()=>monthToStr); 29585parcelHelpers.export(exports, "revFormat", ()=>revFormat); 29586parcelHelpers.export(exports, "tokenRegex", ()=>tokenRegex); 29587parcelHelpers.export(exports, "formats", ()=>formats); 29588var _utils = require(
29588"../utils"); 29589var doNothing = function() { 29590 return undefined; 29591}; 29592var monthToStr = function(monthNumber, shorthand, locale) { 29593 return locale.months[shorthand ? "shorthand" : "longhand"][monthNumber]; 29594}; 29595var revFormat = { 29596 D: doNothing, 29597 F: function(dateObj, monthName, locale) { 29598 dateObj.setMonth(locale.months.longhand.indexOf(monthName)); 29599 }, 29600 G: function(dateObj, hour) { 29601 dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour)); 29602 }, 29603 H: function(dateObj, hour) { 29604 dateObj.setHours(parseFloat(hour)); 29605 }, 29606 J: function(dateObj, day) { 29607 dateObj.setDate(parseFloat(day)); 29608 }, 29609 K: function(dateObj, amPM, locale) { 29610 dateObj.setHours(dateObj.getHours() % 12 + 12 * (0, _utils.int)(new RegExp(locale.amPM[1], "i").test(amPM))); 29611 }, 29612 M: function(dateObj, shortMonth, locale) { 29613 dateObj.setMonth(locale.months.shorthand.indexOf(shortMonth)); 29614 }, 29615 S: function(dateObj, seconds) { 29616 dateObj.setSeconds(parseFloat(seconds)); 29617 }, 29618 U: function(_, unixSeconds) { 29619 return new Date(parseFloat(unixSeconds) * 1000); 29620 }, 29621 W: function(dateObj, weekNum, locale) { 29622 var weekNumber = parseInt(weekNum); 29623 var date = new Date(dateObj.getFullYear(), 0, 2 + (weekNumber - 1) * 7, 0, 0, 0, 0); 29624 date.setDate(date.getDate() - date.getDay() + locale.firstDayOfWeek); 29625 return date; 29626 }, 29627 Y: function(dateObj, year) { 29628 dateObj.setFullYear(parseFloat(year)); 29629 }, 29630 Z: function(_, ISODate) { 29631 return new Date(ISODate); 29632 }, 29633 d: function(dateObj, day) { 29634 dateObj.setDate(parseFloat(day)); 29635 }, 29636 h: function(dateObj, hour) { 29637 dateObj.setHours((dateObj.getHours() >= 12 ? 12 : 0) + parseFloat(hour)); 29638 }, 29639 i: function(dateObj, minutes) { 29640 dateObj.setMinutes(parseFloat(minutes)); 29641 }, 29642 j: function(dateObj, day) { 29643 dateObj.setDate(parseFloat(day)); 29644 }, 29645 l: doNothing, 29646 m: function(dateObj, month) { 29647 dateObj.setMonth(parseFloat(month) - 1); 29648 }, 29649 n: function(dateObj, month) { 29650 dateObj.setMonth(parseFloat(month) - 1); 29651 }, 29652 s: function(dateObj, seconds) { 29653 dateObj.setSeconds(parseFloat(seconds)); 29654 }, 29655 u: function(_, unixMillSeconds) { 29656 return new Date(parseFloat(unixMillSeconds)); 29657 }, 29658 w: doNothing, 29659 y: function(dateObj, year) { 29660 dateObj.setFullYear(2000 + parseFloat(year)); 29661 } 29662}; 29663var tokenRegex = { 29664 D: "", 29665 F: "", 29666 G: "(\\d\\d|\\d)", 29667 H: "(\\d\\d|\\d)", 29668 J: "(\\d\\d|\\d)\\w+", 29669 K: "", 29670 M: "", 29671 S: "(\\d\\d|\\d)", 29672 U: "(.+)", 29673 W: "(\\d\\d|\\d)", 29674 Y: "(\\d{4})", 29675 Z: "(.+)", 29676 d: "(\\d\\d|\\d)", 29677 h: "(\\d\\d|\\d)", 29678 i: "(\\d\\d|\\d)", 29679 j: "(\\d\\d|\\d)", 29680 l: "", 29681 m: "(\\d\\d|\\d)", 29682 n: "(\\d\\d|\\d)", 29683 s: "(\\d\\d|\\d)", 29684 u: "(.+)", 29685 w: "(\\d\\d|\\d)", 29686 y: "(\\d{2})" 29687}; 29688var formats = { 29689 Z: function(date) { 29690 return date.toISOString(); 29691 }, 29692 D: function(date, locale, options) { 29693 return locale.weekdays.shorthand[formats.w(date, locale, options)]; 29694 }, 29695 F: function(date, locale, options) { 29696 return monthToStr(formats.n(date, locale, options) - 1, false, locale); 29697 }, 29698 G: function(date, locale, options) { 29699 return (0, _utils.pad)(formats.h(date, locale, options)); 29700 }, 29701 H: function(date) { 29702 return (0, _utils.pad)(date.getHours()); 29703 }, 29704 J: function(date, locale) { 29705 return locale.ordinal !== undefined ? date.getDate() + locale.ordinal(date.getDate()) : date.getDate(); 29706 }, 29707 K: function(date, locale) { 29708 return locale.amPM[(0, _utils.int)(date.getHours() > 11)]; 29709 }, 29710 M: function(date, locale) { 29711 return monthToStr(date.getMonth(), true, locale); 29712 }, 29713 S: function(date) { 29714 return (0, _utils.pad)(date.getSeconds()); 29715 }, 29716 U: function(date) { 29717 return date.getTime() / 1000; 29718 }, 29719 W: function(date, _, options) { 29720 return options.getWeek(date); 29721 }, 29722 Y: function(date) { 29723 return (0, _utils.pad)(date.getFullYear(), 4); 29724 }, 29725 d: function(date) { 29726 return (0, _utils.pad)(date.getDate()); 29727 }, 29728 h: function(date) { 29729 return date.getHours() % 12 ? date.getHours() % 12 : 12; 29730 }, 29731 i: function(date) { 29732 return (0, _utils.pad)(date.getMinutes()); 29733 }, 29734 j: function(date) { 29735 return date.getDate(); 29736 }, 29737 l: function(date, locale) { 29738 return locale.weekdays.longhand[date.getDay()]; 29739 }, 29740 m: function(date) { 29741 return (0, _utils.pad)(date.getMonth() + 1); 29742 }, 29743 n: function(date) { 29744 return date.getMonth() + 1; 29745 }, 29746 s: function(date) { 29747 return date.getSeconds(); 29748 }, 29749 u: function(date) { 29750 return date.getTime(); 29751 }, 29752 w: function(date) { 29753 return date.getDay(); 29754 }, 29755 y: function(date) { 29756 return String(date.getFullYear()).substring(2); 29757 } 29758}; 29759 29760},{"../utils":"ex98D","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"jig0D":[function(require,module,exports,__globalThis) { 29761"use strict"; 29762if (typeof Object.assign !== "function") Object.assign = function(target) { 29763 var args = []; 29764 for(var _i = 1; _i < arguments.length; _i++)args[_i - 1] = arguments[_i]; 29765 if (!target) throw TypeError("Cannot convert undefined or null to object"); 29766 var _loop_1 = function(source) { 29767 if (source) Object.keys(source).forEach(function(key) { 29768 return target[key] = source[key]; 29769 }); 29770 }; 29771 for(var _a = 0, args_1 = args; _a < args_1.length; _a++){ 29772 var source = args_1[_a]; 29773 _loop_1(source); 29774 } 29775 return target; 29776}; 29777 29778},{}],"1B36y":[function() {},{}],"eN4G5":[function() {},{}],"hx4nO":[function(require,module,exports,__globalThis) { 29779const toggleVideoButton = document.querySelectorAll('.c__toggle-video-button'); 29780document.addEventListener('DOMContentLoaded', ()=>{ 29781 toggleVideoButton.forEach((button)=>{ 29782 video = button.parentElement.querySelector('video'); 29783 initializeToggleVideoButton(button, video); 29784 }); 29785 if (toggleVideoButton) toggleVideoButton.forEach((button)=>{ 29786 button.addEventListener('click', ()=>{ 29787 const video1 = button.parentElement.querySelector('video'); 29788 toggleVideo(button, video1); 29789 }); 29790 }); 29791}); 29792function toggleVideo(button, video1) { 29793 // Current state of the vieo when the button is clicked 29794 const isVideoPlaying = !video1.paused; 29795 if (isVideoPlaying) { 29796 // if the video is playing, pause it 29797 video1.pause(); 29798 setToggleVideoButtonToPaused(button); 29799 } else { 29800 // if the video is paused, play it 29801 video1.play(); 29802 setToggleVideoButtonToPlaying(button); 29803 } 29804} 29805function initializeToggleVideoButton(button, video1) { 29806 // For some of the modules move the position of the button to the parent of the parent element 29807 if (video1.parentElement.classList.contains('m__coimg__background-video')) // move the button to the parent of the parent element 29808 video1.parentElement.parentElement.appendChild(button); 29809} 29810function setToggleVideoButtonToPlaying(button) { 29811 button.classList.remove('c__toggle-video-button--paused'); 29812 button.classList.add('c__toggle-video-button--playing'); 29813 button.setAttribute('aria-label', 'Pause video'); 29814 button.setAttribute('aria-pressed', 'true'); 29815} 29816function setToggleVideoButtonToPaused(button) { 29817 button.classList.add('c__toggle-video-button--paused'); 29818 button.classList.remove('c__toggle-video-button--playing'); 29819 button.setAttribute('aria-label', 'Play video'); 29820 button.setAttribute('aria-pressed', 'false'); 29821} 29822 29823},{}],"5pbeH":[function(require,module,exports,__globalThis) { 29824const tripleseatForms = document.querySelectorAll('#tripleseat_embed_form'); 29825/** When the shared jQuery UI datepicker opens from the Tripleseat form, move focus into the popup for keyboard / SR users. */ function focusTripleseatDatepickerPopup() { 29826 const dp = document.getElementById('ui-datepicker-div'); 29827 if (!dp || window.getComputedStyle(dp).display === 'none') return; 29828 const active = document.activeElement; 29829 if (!active?.closest('#tripleseat_embed_form')) return; 29830 const focusTarget = dp.querySelector('select.ui-datepicker-month, select.ui-datepicker-year') || dp.querySelector('a.ui-datepicker-prev') || dp.querySelector('a.ui-datepicker-next') || dp.querySelector('.ui-datepicker-calendar td a');
29831 if (focusTarget && typeof focusTarget.focus === 'function') focusTarget.focus({ 29832 preventScroll: true 29833 }); 29834} 29835function attachTripleseatDatepickerFocusObserver() { 29836 const scheduleFocus = ()=>{ 29837 requestAnimationFrame(()=>{ 29838 setTimeout(focusTripleseatDatepickerPopup, 0); 29839 }); 29840 }; 29841 const observeDiv = (datepickerDiv)=>{ 29842 const observer = new MutationObserver(()=>{ 29843 if (window.getComputedStyle(datepickerDiv).display !== 'none') scheduleFocus(); 29844 }); 29845 observer.observe(datepickerDiv, { 29846 attributes: true, 29847 attributeFilter: [ 29848 'style', 29849 'class' 29850 ] 29851 }); 29852 }; 29853 let datepickerDiv = document.getElementById('ui-datepicker-div'); 29854 if (datepickerDiv) { 29855 observeDiv(datepickerDiv); 29856 return; 29857 } 29858 const bodyObserver = new MutationObserver(()=>{ 29859 datepickerDiv = document.getElementById('ui-datepicker-div'); 29860 if (datepickerDiv) { 29861 bodyObserver.disconnect(); 29862 observeDiv(datepickerDiv); 29863 } 29864 }); 29865 bodyObserver.observe(document.body, { 29866 childList: true, 29867 subtree: true 29868 }); 29869} 29870if (tripleseatForms?.length) { 29871 tripleseatForms.forEach((form)=>{ 29872 // Get all input, textarea, and select elements, including hidden fields like lead_event_date 29873 const inputs = form.querySelectorAll('input, textarea, select'); 29874 inputs.forEach((input)=>{ 29875 const updateInputState = ()=>{ 29876 // For hidden fields and others, set data-filled if their value is non-empty 29877 if (input.value && input.value !== '') input.setAttribute('data-filled', 'true'); 29878 else input.removeAttribute('data-filled'); 29879 }; 29880 // Register on input/change except for hidden fields, which only need change 29881 if (input.type === 'hidden') input.addEventListener('change', updateInputState); 29882 else { 29883 input.addEventListener('input', updateInputState); 29884 input.addEventListener('change', updateInputState); 29885 } 29886 // Update on load (for autofilled values) 29887 updateInputState(); 29888 }); 29889 }); 29890 attachTripleseatDatepickerFocusObserver(); 29891} 29892 29893},{}],"3N5yu":[function(require,module,exports,__globalThis) { 29894/** 29895 * Floating labels for Sprout/Contacta newsletter embed match Tripleseat: 29896 * inputs get data-filled when they have a value so CSS :has([data-filled]) keeps labels floated. 29897 * The embed mounts inside #newsletter after load â observe subtree for injected forms. 29898 */ const NEWSLETTER_HOST_SELECTOR = '#newsletter'; 29899const CONTACTA_FORM_SELECTOR = '.contacta-webform-form'; 29900function attachFloatingFilledListeners(form) { 29901 if (form.dataset.kricketContactaFilled) return; 29902 form.dataset.kricketContactaFilled = 'true'; 29903 const inputs = form.querySelectorAll('input, textarea, select'); 29904 inputs.forEach((input)=>{ 29905 const updateInputState = ()=>{ 29906 if (input.type === 'hidden') { 29907 if (input.value && input.value !== '') input.setAttribute('data-filled', 'true'); 29908 else input.removeAttribute('data-filled'); 29909 return; 29910 } 29911 let filled = false; 29912 if (input.tagName === 'SELECT') filled = input.value !== '' && input.value != null; 29913 else filled = Boolean(input.value && String(input.value).trim() !== ''); 29914 if (filled) input.setAttribute('data-filled', 'true'); 29915 else input.removeAttribute('data-filled'); 29916 }; 29917 if (input.type === 'hidden') input.addEventListener('change', updateInputState); 29918 else { 29919 input.addEventListener('input', updateInputState); 29920 input.addEventListener('change', updateInputState); 29921 } 29922 updateInputState(); 29923 }); 29924} 29925function scanContactaForms(root) { 29926 root.querySelectorAll(CONTACTA_FORM_SELECTOR).forEach(attachFloatingFilledListeners); 29927} 29928function initContactaNewsletterFloatingLabels() { 29929 const host = document.querySelector(NEWSLETTER_HOST_SELECTOR); 29930 if (!host) return; 29931 scanContactaForms(host); 29932 const observer = new MutationObserver(()=>{ 29933 scanContactaForms(host); 29934 }); 29935 observer.observe(host, { 29936 childList: true, 29937 subtree: true 29938 }); 29939} 29940initContactaNewsletterFloatingLabels(); 29941 29942},{}],"dbewR":[function(require,module,exports,__globalThis) { 29943var _windowScrollRaf = require("../helpers/windowScrollRaf"); 29944const TITLE_DETAIL_ICON_SRC = '/wp-content/themes/kricket/library/images/icons/title-detail-icon.svg'; 29945const LOCATION_FILTERS_WRAP_CLASS = 'mpw__filter-wrap'; 29946const MENU_PDF_WRAP_SELECTOR = '.mpw__filter-wrap .mpw__menu-pdf-wrap'; 29947const MENU_PDF_WRAP_PARENT_CLASS = 'mpw__menu-pdf-parent'; 29948const MPW_BUTTON_SELECTOR = '.mpw__button'; 29949const MPW_BUTTON_OUTLINE_CLASSES = [ 29950 'button-outlined--white', 29951 'button-outlined--red' 29952]; 29953const MENUS_LIST_MENU_BUTTONS_CLASS = 'menus-list__menu-buttons'; 29954const MENUS_SELECTOR_TOP_EXTRA_PX = 40; 29955/** Matches Tailwind-style `md` breakpoint: extra inset only from this width up */ const MENUS_SELECTOR_EXTRA_TOP_MIN_WIDTH = 768; 29956const MENUS_SELECTOR_STICKY_SELECTOR = '.m__menus .menus-selector, .m__menus .menus__categories-desktop, .m__menus .menus__categories-mobile'; 29957const updateMenusSelectorStickyTop = ()=>{ 29958 const header = document.querySelector('.header'); 29959 const wrap = document.querySelector(`.m__menus .${LOCATION_FILTERS_WRAP_CLASS}`); 29960 const menusSelectors = document.querySelectorAll(MENUS_SELECTOR_STICKY_SELECTOR); 29961 if (menusSelectors.length === 0) return; 29962 const headerH = header ? header.offsetHeight : 0; 29963 const wrapH = wrap ? wrap.offsetHeight : 0; 29964 const baseTop = headerH + wrapH; 29965 const extra = window.innerWidth >= MENUS_SELECTOR_EXTRA_TOP_MIN_WIDTH ? MENUS_SELECTOR_TOP_EXTRA_PX : 0; 29966 const top = baseTop + extra;
29967 menusSelectors.forEach((el)=>{ 29968 el.style.top = `${top}px`; 29969 }); 29970}; 29971let menusSelectorObserversAttached = false; 29972const attachMenusSelectorTopObserversOnce = ()=>{ 29973 if (menusSelectorObserversAttached) return; 29974 const menusRoot = document.querySelector('.m__menus'); 29975 if (!menusRoot) return; 29976 menusSelectorObserversAttached = true; 29977 (0, _windowScrollRaf.subscribeWindowScrollRAF)(updateMenusSelectorStickyTop); 29978 const ro = new ResizeObserver(()=>updateMenusSelectorStickyTop()); 29979 ro.observe(menusRoot); 29980 const header = document.querySelector('.header'); 29981 if (header) ro.observe(header); 29982 window.addEventListener('load', updateMenusSelectorStickyTop, { 29983 once: true 29984 }); 29985}; 29986// const wrapLocationSelectorAndFilters = () => { 29987// const root = document.querySelector('.m__menus'); 29988// const locationSelector = root?.querySelector('.location-selector'); 29989// const filtersEl = root?.querySelector('.filters'); 29990// if (!locationSelector || !filtersEl) return; 29991// const existingWrap = 29992// locationSelector.closest(`.${LOCATION_FILTERS_WRAP_CLASS}`) || 29993// filtersEl.closest(`.${LOCATION_FILTERS_WRAP_CLASS}`); 29994// if (existingWrap?.contains(locationSelector) && existingWrap.contains(filtersEl)) return; 29995// const parentLoc = locationSelector.parentNode; 29996// const parentFil = filtersEl.parentNode; 29997// if (!parentLoc || parentLoc !== parentFil) return; 29998// const ordered = [locationSelector, filtersEl].sort((a, b) => { 29999// const pos = a.compareDocumentPosition(b); 30000// if (pos & Node.DOCUMENT_POSITION_FOLLOWING) return -1; 30001// if (pos & Node.DOCUMENT_POSITION_PRECEDING) return 1; 30002// return 0; 30003// }); 30004// const wrap = document.createElement('div'); 30005// wrap.className = `${LOCATION_FILTERS_WRAP_CLASS} relative`; 30006// parentLoc.insertBefore(wrap, ordered[0]); 30007// ordered.forEach((el) => wrap.appendChild(el)); 30008// }; 30009const prependMenusTitleDetailIcon = (container)=>{ 30010 if (container.querySelector('.js-menus-title-detail-icon')) return; 30011 const img = document.createElement('img'); 30012 img.className = 'js-menus-title-detail-icon | block w-[16px] h-[25px] absolute -top-[12px] left-1/2 -translate-x-1/2 pointer-events-none'; 30013 img.src = TITLE_DETAIL_ICON_SRC; 30014 img.alt = ''; 30015 img.setAttribute('aria-hidden', 'true'); 30016 container.prepend(img); 30017}; 30018const appendMenusTitleDetailIcons = ()=>{ 30019 document.querySelectorAll('.m__menus .menu__card__content').forEach(prependMenusTitleDetailIcon); 30020 document.querySelectorAll('.m__menus .section--promo').forEach(prependMenusTitleDetailIcon); 30021}; 30022const tagMenuPdfWrapParents = ()=>{ 30023 document.querySelectorAll(`.m__menus ${MENU_PDF_WRAP_SELECTOR}`).forEach((el)=>{ 30024 const parent = el.parentElement; 30025 if (parent && !parent.classList.contains(MENU_PDF_WRAP_PARENT_CLASS)) parent.classList.add(MENU_PDF_WRAP_PARENT_CLASS); 30026 }); 30027}; 30028const applyMpwButtonClasses = ()=>{ 30029 document.querySelectorAll(`.m__menus ${MPW_BUTTON_SELECTOR}`).forEach((el)=>{ 30030 el.classList.remove(...MPW_BUTTON_OUTLINE_CLASSES); 30031 el.classList.add('button'); 30032 if (el.closest(`.${LOCATION_FILTERS_WRAP_CLASS}`)) el.classList.add('button-outlined--white'); 30033 else if (el.closest(`.${MENUS_LIST_MENU_BUTTONS_CLASS}`)) el.classList.add('button-outlined--red'); 30034 }); 30035}; 30036let menusDecorationsObserverAttached = false; 30037const syncMenusDecorations = ()=>{ 30038 //wrapLocationSelectorAndFilters(); 30039 tagMenuPdfWrapParents(); 30040 applyMpwButtonClasses(); 30041 appendMenusTitleDetailIcons(); 30042 updateMenusSelectorStickyTop(); 30043 requestAnimationFrame(()=>requestAnimationFrame(updateMenusSelectorStickyTop)); 30044 attachMenusSelectorTopObserversOnce(); 30045}; 30046const initMenusDecorations = ()=>{ 30047 syncMenusDecorations(); 30048 const menusRoot = document.querySelector('.m__menus'); 30049 if (menusRoot && !menusDecorationsObserverAttached) { 30050 menusDecorationsObserverAttached = true; 30051 new MutationObserver(()=>syncMenusDecorations()).observe(menusRoot, { 30052 childList: true, 30053 subtree: true 30054 }); 30055 } 30056}; 30057if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', initMenusDecorations); 30058else initMenusDecorations(); 30059 30060},{"../helpers/windowScrollRaf":"gJWEk"}],"lpWJw":[function(require,module,exports,__globalThis) { 30061/** 30062 * Accessible Headers - Adjusts heading hierarchy within ignite-modules 30063 * 30064 * This function ensures proper heading hierarchy by: 30065 * 1. Checking if there's an h1 tag within ignite-modules 30066 * 2. If no h1 exists, converts the first h2 to h1 30067 * 3. Then converts the first h3 to h2 30068 * 30069 * This helps maintain proper document structure for screen readers and SEO 30070 */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 30071parcelHelpers.defineInteropFlag(exports); 30072function adjustHeadingHierarchy() { 30073 console.log('adjustHeadingHierarchy'); 30074 const igniteModules = document.querySelector('.ignite-modules'); 30075 if (!igniteModules) { 30076 console.warn('ignite-modules container not found'); 30077 return; 30078 } 30079 // Check if there's already an h1 within ignite-modules 30080 const existingH1 = igniteModules.querySelector('h1'); 30081 if (existingH1) { 30082 console.log('H1 found, no adjustment needed'); 30083 return; 30084 } 30085 // Find the first h2 and convert it to h1 30086 const firstH2 = igniteModules.querySelector('h2'); 30087 if (firstH2) { 30088 const h1Element = document.createElement('h1'); 30089 // Copy all attributes from h2 to h1
30090 Array.from(firstH2.attributes).forEach((attr)=>{ 30091 h1Element.setAttribute(attr.name, attr.value); 30092 }); 30093 // Copy the content 30094 h1Element.innerHTML = firstH2.innerHTML; 30095 // Replace h2 with h1 30096 firstH2.parentNode.replaceChild(h1Element, firstH2); 30097 console.log('Converted first h2 to h1'); 30098 } 30099 // Find the first h3 and convert it to h2 30100 const firstH3 = igniteModules.querySelector('h3'); 30101 if (firstH3) { 30102 const h2Element = document.createElement('h2'); 30103 // Copy all attributes from h3 to h2 30104 Array.from(firstH3.attributes).forEach((attr)=>{ 30105 h2Element.setAttribute(attr.name, attr.value); 30106 }); 30107 // Copy the content 30108 h2Element.innerHTML = firstH3.innerHTML; 30109 // Replace h3 with h2 30110 firstH3.parentNode.replaceChild(h2Element, firstH3); 30111 console.log('Converted first h3 to h2'); 30112 } 30113} 30114// Run the function when DOM is loaded 30115document.addEventListener('DOMContentLoaded', adjustHeadingHierarchy); 30116// Also run it after a short delay to catch dynamically loaded content 30117setTimeout(adjustHeadingHierarchy, 100); 30118// Export for potential manual triggering 30119exports.default = adjustHeadingHierarchy; 30120 30121},{"@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"8Bvtw":[function(require,module,exports,__globalThis) { 30122/** 30123 * iOS Safari and many Android browsers enforce muted inline playback for autoplay. 30124 * Setting properties in JS and retrying play() after metadata/load fixes most failures. 30125 * Retries after window load (preloader / late decode) and on resize for responsive variants. 30126 */ function isVideoDisplayed(video) { 30127 const style = window.getComputedStyle(video); 30128 if (style.display === 'none' || style.visibility === 'hidden' || Number(style.opacity) === 0) return false; 30129 const rect = video.getBoundingClientRect(); 30130 return rect.width > 0 && rect.height > 0; 30131} 30132function tryPlay(video) { 30133 video.muted = true; 30134 video.defaultMuted = true; 30135 video.playsInline = true; 30136 video.setAttribute('muted', ''); 30137 video.setAttribute('playsinline', ''); 30138 video.setAttribute('webkit-playsinline', ''); 30139 const attempt = ()=>{ 30140 const p = video.play(); 30141 if (p !== undefined && typeof p.catch === 'function') p.catch(()=>{}); 30142 }; 30143 attempt(); 30144 requestAnimationFrame(()=>{ 30145 requestAnimationFrame(attempt); 30146 }); 30147 [ 30148 'loadedmetadata', 30149 'loadeddata', 30150 'canplay', 30151 'canplaythrough' 30152 ].forEach((evt)=>{ 30153 video.addEventListener(evt, attempt, { 30154 once: true 30155 }); 30156 }); 30157} 30158function retryDisplayedVideos() { 30159 document.querySelectorAll('video.js-inline-video-autoplay').forEach((video)=>{ 30160 if (video.classList.contains('js-hover-video')) return; 30161 if (isVideoDisplayed(video)) tryPlay(video); 30162 }); 30163} 30164let resizeRaf = null; 30165function scheduleRetryDisplayedVideos() { 30166 if (resizeRaf !== null) return; 30167 resizeRaf = requestAnimationFrame(()=>{ 30168 resizeRaf = null; 30169 retryDisplayedVideos(); 30170 }); 30171} 30172function bindVideo(video) { 30173 if (video.classList.contains('js-hover-video')) return; 30174 if (video.dataset.inlineAutoplayBound === '1') return; 30175 video.dataset.inlineAutoplayBound = '1'; 30176 if (isVideoDisplayed(video)) tryPlay(video); 30177 if ('IntersectionObserver' in window) { 30178 const io = new IntersectionObserver((entries)=>{ 30179 entries.forEach((entry)=>{ 30180 if (entry.isIntersecting && entry.target.paused) tryPlay(entry.target); 30181 }); 30182 }, { 30183 threshold: 0.01, 30184 rootMargin: '0px 0px 10% 0px' 30185 }); 30186 io.observe(video); 30187 } 30188} 30189function initInlineVideoAutoplay() { 30190 document.querySelectorAll('video.js-inline-video-autoplay').forEach(bindVideo); 30191 window.addEventListener('resize', scheduleRetryDisplayedVideos, { 30192 passive: true 30193 }); 30194 window.addEventListener('orientationchange', scheduleRetryDisplayedVideos, { 30195 passive: true 30196 }); 30197 window.addEventListener('load', ()=>retryDisplayedVideos(), { 30198 once: true 30199 }); 30200 document.addEventListener('visibilitychange', ()=>{ 30201 if (!document.hidden) retryDisplayedVideos(); 30202 }, {
30203 passive: true 30204 }); 30205 const preloader = document.querySelector('[data-preloader]'); 30206 if (preloader && !preloader.classList.contains('m__preloader--is-done')) { 30207 const obs = new MutationObserver(()=>{ 30208 if (preloader.classList.contains('m__preloader--is-done')) { 30209 retryDisplayedVideos(); 30210 obs.disconnect(); 30211 } 30212 }); 30213 obs.observe(preloader, { 30214 attributes: true, 30215 attributeFilter: [ 30216 'class' 30217 ] 30218 }); 30219 } 30220} 30221if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', initInlineVideoAutoplay); 30222else initInlineVideoAutoplay(); 30223 30224},{}],"519ys":[function(require,module,exports,__globalThis) { 30225var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 30226var _swiperBundle = require("swiper/swiper-bundle"); 30227var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 30228var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 30229const amenitiesModules = document.querySelectorAll('.m__amenities'); 30230amenitiesModules.forEach((amenitiesModule)=>{ 30231 const showAllBtns = amenitiesModule.querySelectorAll('.m__amenities__show-all'); 30232 const showAllLabels = amenitiesModule.querySelectorAll('.m__amenities__show-all-label'); 30233 const showAllIcons = amenitiesModule.querySelectorAll('.m__amenities__show-all-icon'); 30234 const amenitiesList = amenitiesModule.querySelector('.m__amenities__list'); 30235 const amenityItems = amenitiesModule.querySelectorAll('.m__amenities__item'); 30236 const moduleType = amenitiesModule.dataset.moduleType; 30237 if (showAllBtns.length === 0 || !amenitiesList || amenityItems.length === 0) return; 30238 let isExpanded = false; 30239 let isInitialLoad = true; 30240 if (showAllLabels.length > 0) { 30241 const originalLabel1 = showAllLabels[0].textContent; 30242 } 30243 // Function to get number of columns based on viewport width 30244 function getColumnsPerRow() { 30245 const width = window.innerWidth; 30246 if (width >= 1400) return 7; // xxl 30247 if (width >= 1200) return 6; // xl 30248 if (width >= 992) return 5; // lg 30249 if (width >= 768) return 4; // md 30250 if (width >= 576) return 3; // sm 30251 if (width >= 390) return 2; // xsm 30252 return 1; // mobile 30253 } 30254 // Function to get first row height by getting the height of the first element in the list 30255 function getFirstRowHeight() { 30256 const firstItem = amenitiesList.children[0]; 30257 const firstItemHeight = firstItem.offsetHeight; 30258 return firstItemHeight; 30259 } 30260 // Function to hide items beyond first row 30261 function updateVisibility() { 30262 const firstRowHeight = getFirstRowHeight(); 30263 // Capture current height before making any changes 30264 const currentHeight = amenitiesList.scrollHeight; 30265 // Set current height to lock it before changing display state 30266 if (!isInitialLoad) amenitiesList.style.height = currentHeight + 'px'; 30267 // Use requestAnimationFrame to ensure height is locked before changing display 30268 requestAnimationFrame(()=>{ 30269 let targetHeight; 30270 if (isExpanded) targetHeight = currentHeight; 30271 else targetHeight = firstRowHeight; 30272 amenitiesList.style.height = targetHeight + 'px'; 30273 }); 30274 // Update label text for all buttons
30275 if (isExpanded) showAllLabels.forEach((label)=>label.textContent = 'Show Less'); 30276 else showAllLabels.forEach((label)=>label.textContent = originalLabel); 30277 // Update icons 30278 if (isExpanded) showAllIcons.forEach((icon)=>icon.classList.add('m__amenities__show-all-icon--active')); 30279 else showAllIcons.forEach((icon)=>icon.classList.remove('m__amenities__show-all-icon--active')); 30280 } 30281 // Initial setup 30282 if (moduleType === 'dropdown') updateVisibility(); 30283 // Click handler for all show-all buttons 30284 showAllBtns.forEach((btn)=>{ 30285 btn.addEventListener('click', ()=>{ 30286 if (btn.dataset.showAllType === 'dropdown') { 30287 isExpanded = !isExpanded; 30288 updateVisibility(); 30289 } 30290 }); 30291 }); 30292 // Update on window resize 30293 if (moduleType === 'dropdown') { 30294 let resizeTimer; 30295 window.addEventListener('resize', ()=>{ 30296 clearTimeout(resizeTimer); 30297 resizeTimer = setTimeout(()=>{ 30298 updateVisibility(); 30299 }, 250); 30300 }); 30301 } 30302 //Loop through each amenity list and initialise swiper 30303 const amenitiesSwiper = amenitiesModule.querySelector('.m__amenities__list--popup'); 30304 const thisASwiper = new (0, _swiperBundleDefault.default)(amenitiesSwiper, { 30305 slidesPerView: 1.6, 30306 spaceBetween: 20, 30307 centeredSlides: false, 30308 loop: false, 30309 arrows: false, 30310 dots: false, 30311 breakpoints: { 30312 1200: { 30313 slidesPerView: 7, 30314 spaceBetween: 30 30315 }, 30316 1024: { 30317 slidesPerView: 6, 30318 spaceBetween: 25 30319 }, 30320 768: { 30321 slidesPerView: 3.2, 30322 spaceBetween: 20 30323 }, 30324 450: { 30325 slidesPerView: 2.6, 30326 spaceBetween: 20 30327 } 30328 } 30329 }); 30330}); 30331 30332},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"dQjSJ":[function(require,module,exports,__globalThis) { 30333var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 30334var _gsap = require("gsap"); 30335var _gsapDefault = parcelHelpers.interopDefault(_gsap); 30336var _windowScrollRaf = require("../helpers/windowScrollRaf"); 30337function initBoxPromos() { 30338 const module = document.querySelector('.m__bpromos'); 30339 if (!module) return; 30340 const promoBoxes = module.querySelectorAll('.m__bpromos__box'); 30341 // Only animate the first two items 30342 if (promoBoxes.length < 2) return; 30343 if (!window.matchMedia('(min-width: 768px)').matches) return; 30344 const firstItem = promoBoxes[0]; 30345 const secondItem = promoBoxes[1]; 30346 // Initial positions: first 200px down, second 300px down 30347 const initialPositions = { 30348 first: 200, 30349 second: 300 30350 }; 30351 // Set initial positions 30352 (0, _gsapDefault.default).set(firstItem, { 30353 y: initialPositions.first 30354 }); 30355 (0, _gsapDefault.default).set(secondItem, { 30356 y: initialPositions.second 30357 }); 30358 let hasAnimated = false; 30359 let unsubscribeScroll = null; 30360 function runReveal() { 30361 (0, _gsapDefault.default).to([ 30362 firstItem, 30363 secondItem 30364 ], { 30365 y: 0, 30366 duration: 1.2, 30367 ease: 'power3.out', 30368 stagger: 0.2 30369 }); 30370 } 30371 function tryReveal() { 30372 if (hasAnimated) return; 30373 const moduleRect = module.getBoundingClientRect(); 30374 const windowHeight = window.innerHeight; 30375 // Fully above viewport (restored scroll / deep link): IntersectionObserver never fires 30376 const moduleFullyAboveViewport = moduleRect.bottom <= 0; 30377 const overlapTop = Math.max(0, moduleRect.top); 30378 const overlapBottom = Math.min(windowHeight, moduleRect.bottom); 30379 const visibleHeight = Math.max(0, overlapBottom - overlapTop); 30380 const h = moduleRect.height; 30381 const halfOrMoreVisible = h > 0 && visibleHeight >= h * 0.5; 30382 if (!moduleFullyAboveViewport && !halfOrMoreVisible) return; 30383 hasAnimated = true; 30384 runReveal(); 30385 if (unsubscribeScroll) { 30386 unsubscribeScroll(); 30387 unsubscribeScroll = null; 30388 } 30389 } 30390 unsubscribeScroll = (0, _windowScrollRaf.subscribeWindowScrollRAF)(tryReveal); 30391 tryReveal(); 30392 requestAnimationFrame(()=>tryReveal()); 30393} 30394// Initialize when DOM is ready 30395if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', initBoxPromos); 30396else initBoxPromos(); 30397 30398},{"gsap":"33IqQ","../helpers/windowScrollRaf":"gJWEk","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"aDfqn":[function(require,module,exports,__globalThis) { 30399var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 30400var _swiperBundle = require("swiper/swiper-bundle"); 30401var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 30402var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 30403const cardModules = document.querySelectorAll('.m__cards[data-theme="location"]');
30404cardModules.forEach((cardModule)=>{ 30405 //Loop through each card slider and initialise swiper and buttons 30406 const cardSwiper = cardModule.querySelector('.swiper'); 30407 const thisSwiper = new (0, _swiperBundleDefault.default)(cardSwiper, { 30408 slidesPerView: 1, 30409 spaceBetween: 40, 30410 centeredSlides: false, 30411 loop: true, 30412 shortSwipes: true, 30413 keyboard: { 30414 enabled: true, 30415 onlyInViewport: true 30416 }, 30417 breakpoints: { 30418 1200: { 30419 slidesPerView: 3, 30420 spaceBetween: 44 30421 }, 30422 768: { 30423 slidesPerView: 2, 30424 spaceBetween: 40 30425 } 30426 } 30427 }); 30428 let thisCSliderNextArrow = cardModule.querySelector('.js-cards__swiper-next'); 30429 let thisCSliderPrevArrow = cardModule.querySelector('.js-cards__swiper-prev'); 30430 //Move to next slide if 'next' arrow clicked 30431 if (thisCSliderNextArrow) thisCSliderNextArrow.addEventListener('click', (event)=>{ 30432 thisSwiper.slideNext(); 30433 }); 30434 if (thisCSliderPrevArrow) thisCSliderPrevArrow.addEventListener('click', (event)=>{ 30435 thisSwiper.slidePrev(); 30436 }); 30437}); 30438 30439},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"eM5Pn":[function(require,module,exports,__globalThis) { 30440var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 30441var _swiperBundle = require("swiper/swiper-bundle"); 30442var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 30443var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 30444const cardSliderModules = document.querySelectorAll('.m__cslider[data-theme="location"]'); 30445cardSliderModules.forEach((cardSliderModule)=>{ 30446 //Loop through each card slider and initialise swiper and buttons 30447 const cardSliderSwiper = cardSliderModule.querySelector('.swiper'); 30448 const thisCSwiper = new (0, _swiperBundleDefault.default)(cardSliderSwiper, { 30449 slidesPerView: 1, 30450 centeredSlides: false, 30451 loop: true, 30452 shortSwipes: true, 30453 keyboard: { 30454 enabled: true, 30455 onlyInViewport: true 30456 }, 30457 breakpoints: { 30458 1200: { 30459 slidesPerView: 3, 30460 spaceBetween: 44 30461 }, 30462 768: { 30463 slidesPerView: 2, 30464 spaceBetween: 40 30465 } 30466 } 30467 }); 30468 let thisCSliderNextArrow = cardSliderModule.querySelector('.js-cslider__swiper-next'); 30469 let thisCSliderPrevArrow = cardSliderModule.querySelector('.js-cslider__swiper-prev'); 30470 //Move to next slide if 'next' arrow clicked 30471 if (thisCSliderNextArrow) thisCSliderNextArrow.addEventListener('click', (event)=>{ 30472 thisCSwiper.slideNext(); 30473 }); 30474 if (thisCSliderPrevArrow) thisCSliderPrevArrow.addEventListener('click', (event)=>{ 30475 thisCSwiper.slidePrev(); 30476 }); 30477}); 30478 30479},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"dI0Bd":[function(require,module,exports,__globalThis) { 30480const contactFormContainers = document.querySelectorAll('.e__form-container'); 30481if (contactFormContainers) contactFormContainers.forEach((formSection)=>{ 30482 // Handle select fields to add data-filled attribute when a value is selected 30483 const hiddenInputs = formSection.querySelectorAll('.e__form-hidden-input'); 30484 hiddenInputs.forEach((hiddenInput)=>{ 30485 const updateHiddenInputState = ()=>{ 30486 if (hiddenInput.value && hiddenInput.value !== '') hiddenInput.setAttribute('data-filled', 'true'); 30487 else hiddenInput.removeAttribute('data-filled'); 30488 }; 30489 hiddenInput.addEventListener('change', updateHiddenInputState); 30490 updateHiddenInputState(); 30491 }); 30492 const textInputs = formSection.querySelectorAll('.e__form-input'); 30493 textInputs.forEach((input)=>{ 30494 const updateInputState = ()=>{ 30495 if (input.value && input.value !== '') input.setAttribute('data-filled', 'true'); 30496 else input.removeAttribute('data-filled'); 30497 }; 30498 input.addEventListener('input', updateInputState); 30499 input.addEventListener('change', updateInputState); 30500 updateInputState(); 30501 }); 30502}); 30503const LOG_PREFIX = '[Kricket contact form]'; 30504const logContactForm = (...args)=>{ 30505 console.log(LOG_PREFIX, ...args); 30506}; 30507const kricketContactForms = document.querySelectorAll('form.js-contact-form__form');
30508kricketContactForms.forEach((form)=>{ 30509 form.addEventListener('submit', async (e)=>{ 30510 e.preventDefault(); 30511 logContactForm('submit fired'); 30512 if (!form.checkValidity()) { 30513 logContactForm('blocked: HTML5 validation failed (checkValidity)'); 30514 form.reportValidity(); 30515 return; 30516 } 30517 if (typeof igniteJsVars === 'undefined' || !igniteJsVars.ajaxurl) { 30518 logContactForm('blocked: igniteJsVars missing or ajaxurl empty', { 30519 hasIgniteJsVars: typeof igniteJsVars !== 'undefined', 30520 ajaxurl: typeof igniteJsVars !== 'undefined' ? igniteJsVars.ajaxurl : undefined 30521 }); 30522 return; 30523 } 30524 const container = form.closest('.m__contact-form__form-container'); 30525 const successEl = container && container.querySelector('.m__contact-form__success'); 30526 const failEl = container && container.querySelector('.m__contact-form__fail'); 30527 const submitBtn = form.querySelector('.js-contact-form__submit'); 30528 if (submitBtn) submitBtn.disabled = true; 30529 const formData = new FormData(form); 30530 logContactForm('FormData action field:', formData.get('action')); 30531 const siteKey = igniteJsVars.recaptchaSiteKey; 30532 if (siteKey) { 30533 if (typeof grecaptcha === 'undefined') { 30534 logContactForm('FAIL path: recaptcha site key set but grecaptcha is undefined (script blocked or not loaded)'); 30535 if (failEl) failEl.classList.remove('hidden'); 30536 if (submitBtn) submitBtn.disabled = false; 30537 return; 30538 } 30539 try { 30540 await new Promise((resolve)=>{ 30541 grecaptcha.ready(resolve); 30542 }); 30543 const token = await grecaptcha.execute(siteKey, { 30544 action: 'contact_form' 30545 }); 30546 formData.append('recaptcha', token); 30547 logContactForm('reCAPTCHA token received, length:', token ? token.length : 0); 30548 } catch (recaptchaErr) { 30549 logContactForm('FAIL path: reCAPTCHA error', recaptchaErr); 30550 if (failEl) failEl.classList.remove('hidden'); 30551 if (submitBtn) submitBtn.disabled = false; 30552 return; 30553 } 30554 } else logContactForm('reCAPTCHA skipped (no recaptchaSiteKey in igniteJsVars)'); 30555 try { 30556 const response = await fetch(igniteJsVars.ajaxurl, { 30557 method: 'POST', 30558 body: formData, 30559 credentials: 'same-origin' 30560 }); 30561 const rawText = await response.text(); 30562 logContactForm('HTTP', response.status, response.statusText, 'url:', igniteJsVars.ajaxurl); 30563 let data; 30564 try { 30565 data = JSON.parse(rawText); 30566 } catch (parseErr) { 30567 logContactForm('FAIL path: response is not JSON. First 500 chars:', rawText.slice(0, 500)); 30568 if (failEl) failEl.classList.remove('hidden'); 30569 if (submitBtn) submitBtn.disabled = false; 30570 return; 30571 } 30572 logContactForm('parsed response:', data); 30573 if (data && data.success) { 30574 logContactForm('SUCCESS'); 30575 form.classList.add('hidden'); 30576 if (successEl) successEl.classList.remove('hidden'); 30577 if (failEl) failEl.classList.add('hidden'); 30578 } else { 30579 logContactForm('FAIL path: data.success is falsy (server returned error). Full payload:', data); 30580 if (failEl) failEl.classList.remove('hidden'); 30581 if (successEl) successEl.classList.add('hidden'); 30582 } 30583 } catch (err) { 30584 logContactForm('FAIL path: fetch/exception', err); 30585 if (failEl) failEl.classList.remove('hidden'); 30586 } 30587 if (submitBtn) submitBtn.disabled = false; 30588 }); 30589}); 30590 30591},{}],"163pq":[function(require,module,exports,__globalThis) { 30592var _windowScrollRaf = require("../helpers/windowScrollRaf"); 30593const BP_MD = '(min-width: 768px)';
30594const CONTENT_PINNED_CLASS = 'm__coimg__content--pinned-bottom'; 30595function getHeaderHeight() { 30596 const header = document.querySelector('.header'); 30597 return header ? header.offsetHeight : 0; 30598} 30599function initContentOverImage() { 30600 const modules = document.querySelectorAll('[data-module="contentOverImage"]'); 30601 if (!modules.length) return; 30602 const desktopMq = window.matchMedia(BP_MD); 30603 const states = []; 30604 let headerHeight = getHeaderHeight(); 30605 let lastScrollY = window.scrollY; 30606 let scrollInitialized = false; 30607 let unsubscribeScroll = null; 30608 /** 30609 * Distance from containerâs top padding inner edge to the content box top. 30610 * Uses computed `top` when itâs a pixel length; otherwise sums offsetTop to the container (transform ignored). 30611 */ function getContentTopDistanceFromContainer(containerEl, contentEl) { 30612 const st = getComputedStyle(contentEl); 30613 const topStr = st.top; 30614 if (topStr && topStr !== 'auto' && !/%/.test(topStr)) { 30615 const px = parseFloat(topStr); 30616 if (Number.isFinite(px)) return Math.max(0, px); 30617 } 30618 let y = 0; 30619 let el = contentEl; 30620 while(el && el !== containerEl){ 30621 y += el.offsetTop; 30622 el = el.offsetParent; 30623 } 30624 if (el !== containerEl) return 0; 30625 const mt = parseFloat(getComputedStyle(contentEl).marginTop) || 0; 30626 return Math.max(0, y + mt); 30627 } 30628 function computeTravelPx(containerEl, contentEl) { 30629 const cs = getComputedStyle(containerEl); 30630 const pt = parseFloat(cs.paddingTop) || 0; 30631 const pb = parseFloat(cs.paddingBottom) || 0; 30632 const inner = containerEl.clientHeight - pt - pb; 30633 const h = contentEl.offsetHeight; 30634 const topDist = getContentTopDistanceFromContainer(containerEl, contentEl); 30635 const bottomInset = pb > 0 ? pb : topDist; 30636 return Math.max(0, inner - topDist - h - bottomInset); 30637 } 30638 function setContentTravel(state) { 30639 if (!state.content.isConnected) return; 30640 if (!desktopMq.matches) { 30641 state.content.style.removeProperty('--coimg-travel'); 30642 return; 30643 } 30644 const travel = computeTravelPx(state.container, state.content); 30645 state.content.style.setProperty('--coimg-travel', `${travel}px`); 30646 } 30647 function attachScrollIfNeeded() { 30648 const needs = desktopMq.matches && states.some((s)=>s.module.isConnected); 30649 if (needs && !unsubscribeScroll) unsubscribeScroll = (0, _windowScrollRaf.subscribeWindowScrollRAF)(updateAll); 30650 else if (!needs && unsubscribeScroll) { 30651 unsubscribeScroll(); 30652 unsubscribeScroll = null; 30653 } 30654 } 30655 function updateAll() { 30656 const scrollY = window.scrollY; 30657 const delta = scrollY - lastScrollY; 30658 lastScrollY = scrollY; 30659 const innerH = window.innerHeight; 30660 const hh = headerHeight; 30661 for(let i = 0; i < states.length; i++){ 30662 const s = states[i]; 30663 if (!s.module.isConnected || !s.container.isConnected) continue; 30664 if (!desktopMq.matches) continue; 30665 const rect = s.container.getBoundingClientRect(); 30666 const content = s.content; 30667 let pinnedBottom = s.pinnedBottom; 30668 if (!scrollInitialized) pinnedBottom = rect.top <= hh; 30669 else if (delta > 0) { 30670 if (rect.top <= hh) pinnedBottom = true; 30671 } else if (delta < 0) { 30672 if (rect.bottom >= innerH - 0.5) pinnedBottom = false; 30673 } 30674 if (pinnedBottom !== s.pinnedBottom) { 30675 s.pinnedBottom = pinnedBottom; 30676 content.classList.toggle(CONTENT_PINNED_CLASS, pinnedBottom); 30677 } 30678 } 30679 scrollInitialized = true; 30680 } 30681 function onResizeAndHeader() { 30682 headerHeight = getHeaderHeight(); 30683 lastScrollY = window.scrollY; 30684 scrollInitialized = false; 30685 for(let i = 0; i < states.length; i++)setContentTravel(states[i]); 30686 updateAll(); 30687 } 30688 const header = document.querySelector('.header'); 30689 const headerRo = header && new ResizeObserver(()=>{ 30690 headerHeight = getHeaderHeight(); 30691 updateAll(); 30692 }); 30693 for(let i = 0; i < modules.length; i++){ 30694 const moduleEl = modules[i];
30695 const container = moduleEl.querySelector('.m__coimg__container'); 30696 const content = moduleEl.querySelector('.m__coimg__content'); 30697 if (!container || !content) continue; 30698 const state = { 30699 module: moduleEl, 30700 container, 30701 content, 30702 pinnedBottom: false 30703 }; 30704 states.push(state); 30705 const containerRo = new ResizeObserver(onResizeAndHeader); 30706 containerRo.observe(container); 30707 const contentRo = new ResizeObserver(onResizeAndHeader); 30708 contentRo.observe(content); 30709 } 30710 if (headerRo && header) headerRo.observe(header); 30711 window.addEventListener('resize', onResizeAndHeader, { 30712 passive: true 30713 }); 30714 function onBreakpointChange() { 30715 if (!desktopMq.matches) { 30716 scrollInitialized = false; 30717 for(let i = 0; i < states.length; i++){ 30718 states[i].pinnedBottom = false; 30719 states[i].content.classList.remove(CONTENT_PINNED_CLASS); 30720 setContentTravel(states[i]); 30721 } 30722 } else { 30723 lastScrollY = window.scrollY; 30724 scrollInitialized = false; 30725 for(let j = 0; j < states.length; j++)setContentTravel(states[j]); 30726 } 30727 attachScrollIfNeeded(); 30728 updateAll(); 30729 } 30730 desktopMq.addEventListener('change', onBreakpointChange); 30731 attachScrollIfNeeded(); 30732 for(let i = 0; i < states.length; i++)setContentTravel(states[i]); 30733 lastScrollY = window.scrollY; 30734 scrollInitialized = false; 30735 updateAll(); 30736 /* First layout pass: travel + scroll state after fonts / images */ requestAnimationFrame(()=>{ 30737 for(let j = 0; j < states.length; j++)setContentTravel(states[j]); 30738 lastScrollY = window.scrollY; 30739 scrollInitialized = false; 30740 updateAll(); 30741 }); 30742} 30743if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', initContentOverImage); 30744else initContentOverImage(); 30745 30746},{"../helpers/windowScrollRaf":"gJWEk"}],"8WNuZ":[function(require,module,exports,__globalThis) { 30747var _vanilla = require("@masonry-grid/vanilla"); 30748function clearArticleAspectVars(root) { 30749 root.querySelectorAll('.m__discover__article').forEach((el)=>{ 30750 el.style.removeProperty('--width'); 30751 el.style.removeProperty('--height'); 30752 }); 30753} 30754function stripMasonryItemStyles(el) { 30755 el.style.removeProperty('transform'); 30756 el.style.removeProperty('order'); 30757} 30758/** 30759 * Measured box as high-precision custom properties (library uses parseFloat; CSS aspect-ratio accepts decimals). 30760 */ function applyInlineAspectRatios(grid) { 30761 grid.querySelectorAll('.m__discover__article').forEach((el)=>{ 30762 const rect = el.getBoundingClientRect(); 30763 const w = Math.max(0.001, rect.width); 30764 const h = Math.max(0.001, rect.height); 30765 el.style.setProperty('--width', w.toFixed(4)); 30766 el.style.setProperty('--height', h.toFixed(4)); 30767 }); 30768} 30769/** Column count from computed grid-template-columns. */ function gridColumnCount(grid) { 30770 const t = getComputedStyle(grid).gridTemplateColumns; 30771 if (!t || t === 'none') return 1; 30772 return t.split(/\s+/).filter(Boolean).length; 30773} 30774function layoutKey(grid) { 30775 const w = grid.getBoundingClientRect().width; 30776 /* 0.25px buckets: fewer missed updates than integer px, less noise than raw subpixels */ const wKey = (Math.round(w * 4) / 4).toFixed(2); 30777 return `${wKey}:${gridColumnCount(grid)}`; 30778} 30779/** Type: empty slug = all types. Location: empty = all locations except location-dependant articles; otherwise article must include that location ID. */ function discoverArticleMatches(el, typeSlug, locationId) { 30780 const types = (el.getAttribute('data-discovery-types') || '').trim().split(/\s+/).filter(Boolean); 30781 const locs = (el.getAttribute('data-discovery-locations') || '').split(',').map((s)=>s.trim()).filter(Boolean); 30782 const locationDependant = el.getAttribute('data-location-dependant') === '1'; 30783 const typeOk = !typeSlug || types.length > 0 && types.includes(typeSlug); 30784 const selectedLoc = String(locationId ?? '').trim(); 30785 const locOk = selectedLoc === '' ? !locationDependant : locs.length > 0 && locs.includes(selectedLoc); 30786 return typeOk && locOk; 30787} 30788function initDiscoverMasonry() { 30789 const grid = document.getElementById('discover-grid'); 30790 if (!grid) return; 30791 const section = grid.closest('.m__discover'); 30792 let masonryInstance = null; 30793 let resizeRaf = 0; 30794 let lastLayoutKey = ''; 30795 let layoutGen = 0; 30796 let layoutIdle = false;
30797 let mediaRelayoutRaf = 0; 30798 /** Off-grid pool so RegularMasonryGrid only sees visible items (hidden nodes were still laid out and broke height/aspect). */ let filterHiddenHolder = null; 30799 function showDiscoverLoader() { 30800 if (!section) return; 30801 section.classList.add('m__discover--layout-loading'); 30802 section.setAttribute('aria-busy', 'true'); 30803 } 30804 function hideDiscoverLoader() { 30805 if (!section) return; 30806 section.classList.remove('m__discover--layout-loading'); 30807 section.removeAttribute('aria-busy'); 30808 } 30809 function maybeHideDiscoverLoader() { 30810 if (layoutIdle) hideDiscoverLoader(); 30811 } 30812 function scheduleRelayoutOnMediaLoad(root) { 30813 const relayout = ()=>{ 30814 cancelAnimationFrame(mediaRelayoutRaf); 30815 mediaRelayoutRaf = requestAnimationFrame(()=>{ 30816 lastLayoutKey = ''; 30817 scheduleLayoutIfNeeded(); 30818 }); 30819 }; 30820 root.querySelectorAll('img').forEach((img)=>{ 30821 if (img.complete) return; 30822 img.addEventListener('load', relayout, { 30823 once: true 30824 }); 30825 img.addEventListener('error', relayout, { 30826 once: true 30827 }); 30828 }); 30829 root.querySelectorAll('video').forEach((video)=>{ 30830 if (video.readyState >= HTMLMediaElement.HAVE_CURRENT_DATA) return; 30831 video.addEventListener('loadeddata', relayout, { 30832 once: true 30833 }); 30834 video.addEventListener('error', relayout, { 30835 once: true 30836 }); 30837 }); 30838 } 30839 function completeLayout(gen) { 30840 requestAnimationFrame(()=>{ 30841 if (gen !== layoutGen) return; 30842 requestAnimationFrame(()=>{ 30843 if (gen !== layoutGen) return; 30844 layoutIdle = true; 30845 maybeHideDiscoverLoader(); 30846 }); 30847 }); 30848 } 30849 function getFilterHiddenHolder() { 30850 if (!filterHiddenHolder && section) { 30851 filterHiddenHolder = document.createElement('div'); 30852 filterHiddenHolder.className = 'm__discover__filter-hidden-pool'; 30853 filterHiddenHolder.setAttribute('aria-hidden', 'true'); 30854 /* Descendants must not be focusable while off-grid; inert is removed implicitly when nodes are moved back into the grid. */ filterHiddenHolder.inert = true; 30855 filterHiddenHolder.style.cssText = 'position:absolute;width:0;height:0;overflow:hidden;clip:rect(0,0,0,0);pointer-events:none'; 30856 section.appendChild(filterHiddenHolder); 30857 } 30858 return filterHiddenHolder; 30859 } 30860 function layout(showLoader = true) { 30861 const gen = ++layoutGen; 30862 layoutIdle = false; 30863 if (showLoader) showDiscoverLoader(); 30864 if (masonryInstance) { 30865 masonryInstance.destroy(); 30866 masonryInstance = null; 30867 } 30868 clearArticleAspectVars(grid); 30869 if (filterHiddenHolder) clearArticleAspectVars(filterHiddenHolder); 30870 grid.offsetWidth; 30871 requestAnimationFrame(()=>{ 30872 if (gen !== layoutGen) return; 30873 requestAnimationFrame(()=>{ 30874 if (gen !== layoutGen) return; 30875 applyInlineAspectRatios(grid); 30876 grid.offsetWidth; 30877 requestAnimationFrame(()=>{ 30878 if (gen !== layoutGen) return; 30879 masonryInstance = new (0, _vanilla.RegularMasonryGrid)(grid); 30880 completeLayout(gen); 30881 }); 30882 }); 30883 }); 30884 } 30885 function scheduleLayoutIfNeeded() { 30886 cancelAnimationFrame(resizeRaf); 30887 resizeRaf = requestAnimationFrame(()=>{ 30888 const key = layoutKey(grid); 30889 if (key === lastLayoutKey) return; 30890 lastLayoutKey = key; 30891 layout(false); 30892 }); 30893 } 30894 function refreshLayoutAfterFilter() { 30895 cancelAnimationFrame(resizeRaf); 30896 lastLayoutKey = ''; 30897 layout(true); 30898 } 30899 function initDiscoverFilters() { 30900 if (!section) return; 30901 const items = [ 30902 ...grid.querySelectorAll('.m__discover__article--filterable') 30903 ]; 30904 if (!items.length) return;
30905 items.forEach((el, i)=>{ 30906 if (!el.dataset.discoverOrder) el.dataset.discoverOrder = String(i); 30907 }); 30908 items.sort((a, b)=>Number(a.dataset.discoverOrder) - Number(b.dataset.discoverOrder)); 30909 const introEl = grid.querySelector('.m__discover__article:not(.m__discover__article--filterable)'); 30910 const holder = getFilterHiddenHolder(); 30911 const locationSelect = section.querySelector('select[name="discovery_location_filter"]'); 30912 const allTypeBtn = section.querySelector('.m__discover__filter-all'); 30913 const typeBtns = section.querySelectorAll('.m__discover__filter-type'); 30914 let selectedTypeSlug = ''; 30915 if (locationSelect) { 30916 const raw = new URLSearchParams(window.location.search).get('location'); 30917 if (raw != null && String(raw).trim() !== '') { 30918 const q = String(raw).trim(); 30919 const qLower = q.toLowerCase(); 30920 const opts = [ 30921 ...locationSelect.options 30922 ]; 30923 const bySlug = opts.find((o)=>{ 30924 const slug = (o.getAttribute('data-location-slug') || '').toLowerCase(); 30925 return slug && slug === qLower; 30926 }); 30927 const byId = opts.find((o)=>o.value !== '' && o.value === q); 30928 const match = bySlug || byId; 30929 if (match) locationSelect.value = match.value; 30930 } 30931 } 30932 let selectedLocationId = locationSelect ? locationSelect.value : ''; 30933 function setTypeButtonState(activeSlug) { 30934 if (allTypeBtn) { 30935 const allOn = activeSlug === ''; 30936 allTypeBtn.classList.toggle('is-active', allOn); 30937 allTypeBtn.setAttribute('aria-pressed', allOn ? 'true' : 'false'); 30938 } 30939 typeBtns.forEach((btn)=>{ 30940 const slug = btn.getAttribute('data-discovery-type') || ''; 30941 const on = slug === activeSlug && activeSlug !== ''; 30942 btn.classList.toggle('is-active', on); 30943 btn.setAttribute('aria-pressed', on ? 'true' : 'false'); 30944 }); 30945 } 30946 const articleTypeRaw = new URLSearchParams(window.location.search).get('article-type'); 30947 if (articleTypeRaw != null && String(articleTypeRaw).trim() !== '') { 30948 const qLower = String(articleTypeRaw).trim().toLowerCase(); 30949 const matchBtn = [ 30950 ...typeBtns 30951 ].find((btn)=>{ 30952 const slug = (btn.getAttribute('data-discovery-type') || '').toLowerCase(); 30953 return slug && slug === qLower; 30954 }); 30955 if (matchBtn) selectedTypeSlug = matchBtn.getAttribute('data-discovery-type') || ''; 30956 } 30957 setTypeButtonState(selectedTypeSlug); 30958 function syncFilterableDomToGrid() { 30959 if (!introEl) return; 30960 const anchor = introEl; 30961 let ref = anchor; 30962 for (const el of items){ 30963 const show = discoverArticleMatches(el, selectedTypeSlug, selectedLocationId); 30964 if (show) { 30965 ref.after(el); 30966 ref = el; 30967 stripMasonryItemStyles(el); 30968 } else { 30969 stripMasonryItemStyles(el); 30970 holder.appendChild(el); 30971 } 30972 } 30973 } 30974 function apply() { 30975 if (masonryInstance) { 30976 masonryInstance.destroy(); 30977 masonryInstance = null; 30978 } 30979 syncFilterableDomToGrid(); 30980 refreshLayoutAfterFilter(); 30981 } 30982 if (allTypeBtn) allTypeBtn.addEventListener('click', ()=>{ 30983 selectedTypeSlug = ''; 30984 setTypeButtonState(''); 30985 if (locationSelect) { 30986 locationSelect.value = ''; 30987 selectedLocationId = ''; 30988 } 30989 apply(); 30990 }); 30991 typeBtns.forEach((btn)=>{ 30992 btn.addEventListener('click', ()=>{ 30993 const slug = btn.getAttribute('data-discovery-type') || ''; 30994 selectedTypeSlug = slug; 30995 setTypeButtonState(slug); 30996 apply(); 30997 }); 30998 }); 30999 if (locationSelect) locationSelect.addEventListener('change', ()=>{ 31000 selectedLocationId = locationSelect.value; 31001 apply(); 31002 }); 31003 apply(); 31004 } 31005 const fontsReady = document.fonts ? document.fonts.ready : Promise.resolve(); 31006 initDiscoverFilters();
31007 const ro = new ResizeObserver(()=>scheduleLayoutIfNeeded()); 31008 ro.observe(grid); 31009 scheduleRelayoutOnMediaLoad(section); 31010 fontsReady.then(()=>{ 31011 lastLayoutKey = ''; 31012 scheduleLayoutIfNeeded(); 31013 }); 31014} 31015if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', initDiscoverMasonry); 31016else initDiscoverMasonry(); 31017 31018},{"@masonry-grid/vanilla":"gi8pw"}],"gi8pw":[function(require,module,exports,__globalThis) { 31019var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 31020parcelHelpers.defineInteropFlag(exports); 31021parcelHelpers.export(exports, "BalancedMasonryGrid", ()=>M); 31022parcelHelpers.export(exports, "BaseMasonryGrid", ()=>x); 31023parcelHelpers.export(exports, "MasonryGrid", ()=>w); 31024parcelHelpers.export(exports, "RegularMasonryGrid", ()=>C); 31025function B(p, r, e) { 31026 if (p.length > 0) { 31027 if (p[0].target === r) return p[0].contentRect.width; 31028 if (p.length === 2 && p[1].target === r) return p[1].contentRect.width; 31029 } 31030 return e; 31031} 31032class x { 31033 constructor(r){ 31034 this.container = r; 31035 const e = getComputedStyle(r), a = document.createElement("div"); 31036 r.append(a); 31037 const l = new ResizeObserver((s)=>{ 31038 const t = B(s, r, this.containerWidth), m = B(s, a, this.frameWidth); 31039 let i = this.gap; 31040 if ((i === -1 || m !== this.frameWidth) && (i = parseFloat(e.gap), isNaN(i) && (i = 0)), i === this.gap && t === this.containerWidth && m === this.frameWidth) return; 31041 this.containerWidth = t, this.frameWidth = m; 31042 const f = Math.round((t + i) / (m + i)); 31043 if (this.columnsCount === f && i === this.gap) { 31044 n(), this.resizeHeight(), o(); 31045 return; 31046 } 31047 this.gap = i, this.columnsCount = f, n(), this.reflow(), o(); 31048 }), h = new MutationObserver(()=>{ 31049 n(), r.append(a), this.columnsCount > 0 && this.reflow(!0), o(); 31050 }), o = ()=>{ 31051 h.observe(r, { 31052 childList: !0, 31053 attributeFilter: [ 31054 "style" 31055 ], 31056 subtree: !0 31057 }); 31058 }, n = ()=>{ 31059 h.disconnect(); 31060 }; 31061 this.marker = a, this.mutationObserver = h, this.resizeObserver = l, l.observe(r), l.observe(a), o(); 31062 } 31063 /** 31064 * Grid gap value in pixels. 31065 * -1 means that the gap is not calculated or set. 31066 */ gap = -1; 31067 /** 31068 * Width of the frame in pixels. 31069 * -1 means that the width is not calculated or set. 31070 */ frameWidth = -1; 31071 /** 31072 * Width of the container in pixels. 31073 * -1 means that the width is not calculated or set. 31074 */ containerWidth = -1; 31075 /** 31076 * Number of columns in the grid. 31077 * -1 means that the number of columns is not calculated or set. 31078 */ columnsCount = -1; 31079 /** 31080 * Aspect ratio of the container. 31081 * -1 means that the aspect ratio is not calculated or set. 31082 */ containerAspectRatio = -1; 31083 /** 31084 * Map of frames positions. 31085 * Key is the frame element, value is the FramePosition object. 31086 */ framesPositionsMap = /* @__PURE__ */ new WeakMap(); 31087 /** 31088 * Resize observer to observe changes in the container and marker size. 31089 */ resizeObserver; 31090 /** 31091 * Mutation observer to observe changes in the container's children. 31092 */ mutationObserver; 31093 /** 31094 * Marker element to observe column width changes. 31095 */ marker; 31096 /** 31097 * Resize the height of the container based on the current width and aspect ratio. 31098 * If the aspect ratio is not set, the height will be removed. 31099 * Aspect ratio should be set while reflowing the grid. 31100 */ resizeHeight() { 31101 const { container: r, containerAspectRatio: e } = this; 31102 e !== -1 ? r.style.height = `${this.containerWidth * e}px` : r.style.removeProperty("height"); 31103 } 31104 /** 31105 * Get the aspect ratio of the frame based on its width and height. 31106 * @param element - The frame element to calculate the aspect ratio for. 31107 * @returns The aspect ratio of the frame as a number (height / width). 31108 */ getFrameAspectRatio(r) { 31109 const e = parseFloat(r.style.getPropertyValue("--width")); 31110 return parseFloat(r.style.getPropertyValue("--height")) / e; 31111 } 31112 /** 31113 * Get the position of the frame in the grid. 31114 * @param element - The frame element to get the position for. 31115 * @param i - The real index of the frame in the grid. 31116 * @param offset - The offset from the top of the container in pixels.
31117 * @returns An object containing the position of the frame in the grid. 31118 */ getFramePosition(r, e, a) { 31119 const { gap: l, columnsCount: h, frameWidth: o } = this, n = this.getFrameAspectRatio(r), s = n * o, t = a + s + (e >= h ? l : 0); 31120 return { 31121 aspectRatio: n, 31122 realIndex: e, 31123 virtualIndex: e, 31124 height: s, 31125 realBottom: t, 31126 virtualBottom: t, 31127 width: o 31128 }; 31129 } 31130 /** 31131 * Get the position of the frame in the grid and cache it. 31132 * @param element - The frame element to get the position for. 31133 * @param i - The real index of the frame in the grid. 31134 * @param offset - The offset from the top of the container in pixels. 31135 * @returns An object containing the position of the frame in the grid. 31136 */ getFramePositionAndCache(r, e, a) { 31137 const l = this.getFramePosition(r, e, a); 31138 return this.framesPositionsMap.set(r, l), l; 31139 } 31140 /** 31141 * Get the cached position of the frame in the grid and scale it to the current frame width. 31142 * If the frame position is not cached or the index does not match, return null. 31143 * @param element - The frame element to get the position for. 31144 * @param i - The real index of the frame in the grid. 31145 * @returns An object containing the scaled position of the frame in the grid or null if not found. 31146 */ getCachedScaledFramePosition(r, e, a) { 31147 const { frameWidth: l } = this, h = this.getFrameAspectRatio(r), o = this.framesPositionsMap.get(r); 31148 if (!o || o.realIndex !== e || o.virtualIndex >= a || o.aspectRatio !== h) return null; 31149 const n = l / o.width; 31150 return o.height *= n, o.realBottom *= n, o.virtualBottom *= n, o.width = l, o; 31151 } 31152 /** 31153 * Destroy the MasonryGrid instance. 31154 */ destroy() { 31155 const { resizeObserver: r, mutationObserver: e, marker: a, container: l, framesPositionsMap: h } = this; 31156 r.disconnect(), e.disconnect(), a.remove(); 31157 const o = l.children; 31158 l.style.removeProperty("height"); 31159 for(let n = 0, s, t = o.length; n < t; n++)s = o[n], s.style.removeProperty("transform"), s.style.removeProperty("order"), h.delete(s); 31160 } 31161} 31162class M extends x { 31163 bufferA = []; 31164 bufferB = []; 31165 /** 31166 * Balance row with previous. 31167 * Current implementation stacks row with previous to have minimal possible height. 31168 * @param positions - Virtual positions of the frames in the grid. 31169 * @param start - Start index of the row to balance. 31170 * @param end - End index of the row to balance. 31171 */ balanceRow(r, e, a) { 31172 const { columnsCount: l, bufferA: h, bufferB: o } = this, n = a - e + 1; 31173 h.length = n, o.length = n; 31174 for(let s = 0, t = e; t <= a; s++, t++)h[s] = r[t - l], o[s] = r[t]; 31175 h.sort((s, t)=>t.virtualBottom - s.virtualBottom), o.sort((s, t)=>s.height - t.height); 31176 for(let s = 0, t = e, m = 0; t <= a; s++, t++)m = h[s].virtualIndex + l, r[m] = o[s], o[s].virtualIndex = m; 31177 } 31178 reflow(r = !1) { 31179 const { columnsCount: e } = this; 31180 if (r && e === 1) return; 31181 const { container: a, marker: l } = this, h = a.children, o = h.length - 1, n = o - 1, s = Array(o); 31182 let t = -1, m = r; 31183 l.style.order = String(o); 31184 for(let i = 0, f, u = 0, g = 0, c; i < o; i++){ 31185 if (f = h[i], e === 1) { 31186 f.style.removeProperty("transform"), f.style.removeProperty("order"); 31187 continue; 31188 } 31189 if (i % e === 0 && (g = u), m) { 31190 const v = this.getCachedScaledFramePosition(f, i, o); 31191 if (v) c = v, s[c.virtualIndex] = c; 31192 else { 31193 m = !1; 31194 const y = i - i % e; 31195 for(let d = y, P; d < i; d++)P = h[d], c = this.getFramePositionAndCache(P, d, g), s[d] = c; 31196 } 31197 } 31198 if (m) u = Math.max(u, c.realBottom), t = Math.max(t, c.virtualBottom); 31199 else if (c = this.getFramePositionAndCache(f, i, g), s[i] = c, i >= e && ((i + 1) % e === 0 || i === n)) { 31200 const v = i - i % e, y = i; 31201 this.balanceRow(s, v, y); 31202 for(let d = v; d <= y; d++){ 31203 c = s[d], f = h[c.realIndex], f.style.order = String(c.virtualIndex); 31204 const P = s[d - e], b = g - P.virtualBottom; 31205 if (b !== 0) { 31206 const R = b * 100 / c.height * -1; 31207 f.style.transform = `translateY(${R}%)`, c.virtualBottom -= b; 31208 } else f.style.removeProperty("transform"); 31209 u = Math.max(u, c.realBottom), t = Math.max(t, c.virtualBottom); 31210 } 31211 } else i < e && (f.style.order = String(i), f.style.removeProperty("transform"), f.style.removeProperty("order"), u = Math.max(u, c.realBottom), t = Math.max(t, c.virtualBottom)); 31212 } 31213 t === -1 ? (a.style.removeProperty("height"), this.containerAspectRatio = -1) : (a.style.height = `${t}px`, this.containerAspectRatio = t / this.containerWidth); 31214 } 31215 destroy() { 31216 super.destroy(), this.bufferA.length = 0, this.bufferB.length = 0; 31217 } 31218} 31219class C extends x { 31220 reflow(r = !1) { 31221 const { columnsCount: e } = this; 31222 if (r && e === 1) return; 31223 const { container: a, framesPositionsMap: l } = this, h = a.children, o = h.length - 1; 31224 let n = -1, s = r; 31225 for(let t = 0, m, i = 0, f = 0, u; t < o; t++){ 31226 if (m = h[t], e === 1) { 31227 m.style.removeProperty("transform"); 31228 continue; 31229 } 31230 if (t % e === 0 && (f = i), s) { 31231 const g = this.getCachedScaledFramePosition(m, t, o); 31232 g ? u = g : s = !1; 31233 } 31234 if (!s) { 31235 if (u = this.getFramePositionAndCache(m, t, f), t >= e) { 31236 const g = l.get(h[t - e]), c = f - g.virtualBottom; 31237 if (c !== 0) { 31238 const v = c * 100 / u.height * -1; 31239 m.style.transform = `translateY(${v}%)`, u.virtualBottom -= c; 31240 } else m.style.removeProperty("transform"); 31241 } else m.style.removeProperty("transform"); 31242 } 31243 i = Math.max(i, u.realBottom), n = Math.max(n, u.virtualBottom); 31244 } 31245 n === -1 ? (a.style.removeProperty("height"), this.containerAspectRatio = -1) : (a.style.height = `${n}px`, this.containerAspectRatio = n / this.containerWidth); 31246 } 31247} 31248const w = C; 31249 31250},{"@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"gwnME":[function(require,module,exports,__globalThis) { 31251/** 31252 * Event spaces list: filter cards by location (ACF) and party size (taxonomy), 31253 * matching discover-style dropdown behaviour (single selection, combined AND logic). 31254 */ function cardMatches(el, locationId, partySlug) { 31255 const locs = (el.getAttribute('data-event-space-locations') || '').split(',').map((s)=>
31255s.trim()).filter(Boolean); 31256 const parties = (el.getAttribute('data-event-space-party-size') || '').trim().split(/\s+/).filter(Boolean); 31257 const selectedLoc = String(locationId ?? '').trim(); 31258 const locOk = selectedLoc === '' || locs.length > 0 && locs.includes(selectedLoc); 31259 const selectedParty = String(partySlug ?? '').trim(); 31260 const partyOk = selectedParty === '' || parties.length > 0 && parties.includes(selectedParty); 31261 return locOk && partyOk; 31262} 31263function initEventSpaceListFilters(section) { 31264 const listRoot = section.querySelector('.cpt-list__list-items'); 31265 const cards = listRoot ? [ 31266 ...listRoot.querySelectorAll('.cpt-list__card') 31267 ] : []; 31268 if (!cards.length) return; 31269 const locationSelect = section.querySelector('select[name="event_space_location_filter"]'); 31270 const partySelect = section.querySelector('select[name="event_space_party_size_filter"]'); 31271 const allBtn = section.querySelector('.m__eslist__filter-all'); 31272 const noResultsMessage = section.getAttribute('data-no-results-message') || 'No spaces match your selected filters.'; 31273 let noResultsEl = section.querySelector('.m__eslist__no-results'); 31274 function ensureNoResultsEl() { 31275 if (!noResultsEl && listRoot && listRoot.parentElement) { 31276 noResultsEl = document.createElement('div'); 31277 noResultsEl.className = 'm__eslist__no-results no-results text-center py-8'; 31278 noResultsEl.setAttribute('hidden', ''); 31279 noResultsEl.innerHTML = `<p class="f__paragraph-regular text-red">${noResultsMessage}</p>`; 31280 listRoot.parentElement.insertBefore(noResultsEl, listRoot.nextSibling); 31281 } 31282 return noResultsEl; 31283 } 31284 function applyLocationFromUrl() { 31285 if (!locationSelect) return false; 31286 const raw = new URLSearchParams(window.location.search).get('location'); 31287 if (raw == null || String(raw).trim() === '') return false; 31288 const q = String(raw).trim(); 31289 const qLower = q.toLowerCase(); 31290 const opts = [ 31291 ...locationSelect.options 31292 ]; 31293 const bySlug = opts.find((o)=>{ 31294 const slug = (o.getAttribute('data-location-slug') || '').toLowerCase(); 31295 return slug && slug === qLower; 31296 }); 31297 const byId = opts.find((o)=>o.value !== '' && o.value === q); 31298 const match = bySlug || byId; 31299 if (match) { 31300 locationSelect.value = match.value; 31301 return true; 31302 } 31303 return false; 31304 } 31305 function applyPartyFromUrl() { 31306 if (!partySelect) return false; 31307 const raw = new URLSearchParams(window.location.search).get('party_size'); 31308 if (raw == null || String(raw).trim() === '') return false; 31309 const qLower = String(raw).trim().toLowerCase(); 31310 const opts = [ 31311 ...partySelect.options 31312 ]; 31313 const match = opts.find((o)=>{ 31314 if (!o.value) return false; 31315 return o.value.toLowerCase() === qLower; 31316 }); 31317 if (match) { 31318 partySelect.value = match.value; 31319 return true; 31320 } 31321 return false; 31322 } 31323 function apply() { 31324 let visible = 0; 31325 cards.forEach((card)=>{ 31326 const loc = locationSelect ? locationSelect.value : ''; 31327 const party = partySelect ? partySelect.value : ''; 31328 const show = cardMatches(card, loc, party); 31329 card.hidden = !show; 31330 card.style.display = show ? '' : 'none'; 31331 if (show) visible += 1; 31332 }); 31333 const nr = ensureNoResultsEl(); 31334 if (nr) { 31335 if (visible === 0) { 31336 nr.removeAttribute('hidden'); 31337 nr.style.display = 'block'; 31338 } else { 31339 nr.setAttribute('hidden', ''); 31340 nr.style.display = 'none'; 31341 } 31342 } 31343 if (allBtn) { 31344 const allOn = (!locationSelect || locationSelect.value === '') && (!partySelect || partySelect.value === ''); 31345 allBtn.classList.toggle('is-active', allOn); 31346 allBtn.setAttribute('aria-pressed', allOn ? 'true' : 'false'); 31347 } 31348 } 31349 if (locationSelect) locationSelect.addEventListener('change', apply); 31350 if (partySelect) partySelect.addEventListener('change', apply); 31351 if (allBtn) allBtn.addEventListener('click', ()=>{ 31352 if (locationSelect) locationSelect.value = ''; 31353 if (partySelect) partySelect.value = ''; 31354 apply(); 31355 }); 31356 applyLocationFromUrl(); 31357 applyPartyFromUrl(); 31358 apply(); 31359 section.classList.remove('loading'); 31360}
31361function init() { 31362 document.querySelectorAll('.m__eslist[data-cpt-name="event-spaces"]').forEach(initEventSpaceListFilters); 31363} 31364if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', init); 31365else init(); 31366 31367},{}],"8DQ5N":[function(require,module,exports,__globalThis) { 31368var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 31369var _swiperBundle = require("swiper/swiper-bundle"); 31370var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 31371var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 31372const enquiryHubModules = document.querySelectorAll('.m__enquiry-hub'); 31373enquiryHubModules.forEach((enquiryHubModule)=>{ 31374 const enquiryHubSwiper = enquiryHubModule.querySelector('.m__enquiry-hub__categories'); 31375 const thisESwiper = new (0, _swiperBundleDefault.default)(enquiryHubSwiper, { 31376 slidesPerView: 3, 31377 spaceBetween: 20, 31378 centeredSlides: false, 31379 loop: false, 31380 arrows: false, 31381 breakpoints: { 31382 1200: { 31383 slidesPerView: 3, 31384 spaceBetween: 30 31385 }, 31386 768: { 31387 slidesPerView: 2.2, 31388 spaceBetween: 20 31389 }, 31390 300: { 31391 slidesPerView: 1.2, 31392 spaceBetween: 20 31393 } 31394 } 31395 }); 31396}); 31397 31398},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"dC83E":[function(require,module,exports,__globalThis) { 31399var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 31400var _choicesJs = require("choices.js"); 31401var _choicesJsDefault = parcelHelpers.interopDefault(_choicesJs); 31402var _accessibility = require("../helpers/accessibility"); 31403// Init Mobile Dropdown Filter 31404const mobileFilter = document.querySelector('.m__faqs__filter-dropdown'); 31405let choices; 31406if (mobileFilter) { 31407 const options = { 31408 searchEnabled: false, 31409 placeholder: true 31410 }; 31411 choices = new (0, _choicesJsDefault.default)(mobileFilter, options); 31412 // Set the role attribute to combobox 31413 const choicesContainer = choices.containerOuter.element; 31414 (0, _accessibility.removeChoicesJsSingleListAriaSelected)(choicesContainer); 31415 (0, _accessibility.fixChoicesJsAccessibility)(choicesContainer, 'Filter FAQs by category'); 31416 // Fix on change 31417 choices.passedElement.element.addEventListener('change', (0, _accessibility.removeChoicesJsSingleListAriaSelected)); 31418 // Set the first option as selected by default 31419 const allChoices = choices._currentState.choices; 31420 const firstOption = allChoices.find((choice)=>!choice.placeholder); 31421 if (firstOption) { 31422 choices.setChoiceByValue(firstOption.value); 31423 (0, _accessibility.removeChoicesJsSingleListAriaSelected)(choicesContainer); 31424 // Trigger the filter for the first category 31425 const filterElem = document.querySelector(`.js-faqs-filter[data-filter="${firstOption.value}"]`); 31426 if (filterElem) filterElem.click(); 31427 } 31428 choices.passedElement.element.addEventListener('change', (event)=>{ 31429 // Filter FAQs 31430 const filterElem = document.querySelector(`.js-faqs-filter[data-filter="${event.detail.value}"]`); 31431 if (filterElem) filterElem.click(); 31432 }, false); 31433} 31434// Toggle FAQs Questions 31435const questions = document.querySelectorAll('.js-faqs-question'); 31436if (questions) questions.forEach((question)=>{ 31437 question.addEventListener('click', (e)=>{ 31438 e.preventDefault(); 31439 const answer = question.nextElementSibling; 31440 const isShowing = question.classList.contains('showing'); 31441 if (isShowing) { 31442 // Closing - animate out 31443 answer.style.maxHeight = answer.scrollHeight + 'px'; 31444 // Force reflow 31445 answer.offsetHeight; 31446 answer.style.maxHeight = '0'; 31447 answer.classList.remove('showing'); 31448 question.classList.remove('showing'); 31449 question.setAttribute('aria-expanded', 'false'); 31450 } else { 31451 // Opening - animate in 31452 answer.style.maxHeight = '0'; 31453 answer.classList.add('showing'); 31454 question.classList.add('showing'); 31455 answer.hidden = false;
31456 answer.style.maxHeight = answer.scrollHeight + 'px'; 31457 question.setAttribute('aria-expanded', 'true'); 31458 } 31459 // Reset max-height after animation completes 31460 setTimeout(()=>{ 31461 if (answer.classList.contains('showing')) answer.style.maxHeight = 'none'; 31462 else answer.hidden = true; 31463 }, 300); 31464 }); 31465 question.addEventListener('keydown', (e)=>{ 31466 if (e.key === 'Enter' || e.key === ' ') { 31467 e.preventDefault(); 31468 question.click(); 31469 } 31470 }); 31471}); 31472const filterFaqByCategory = (e, filterElem, scrollToCategory = true)=>{ 31473 const categoryHeading = document.querySelector('.m__faqs__category-heading'); 31474 if (e !== null) e.preventDefault(); 31475 if (!filterElem || filterElem === null) return; 31476 if (filterElem.classList.contains('active')) { 31477 faqItems.forEach((item)=>{ 31478 item.classList.remove('hidden'); 31479 }); 31480 filterElem.classList.remove('active'); 31481 categoryHeading.classList.remove('active'); 31482 } else { 31483 const filterId = parseInt(filterElem.getAttribute('data-filter'), 10); 31484 faqItems.forEach((item)=>{ 31485 let categoryIds = []; 31486 try { 31487 categoryIds = JSON.parse(item.getAttribute('data-categories') || '[]'); 31488 } catch (error) { 31489 categoryIds = []; 31490 } 31491 const categoryIdsAsInts = categoryIds.map((id)=>parseInt(id, 10)); 31492 if (!categoryIdsAsInts.includes(filterId)) item.classList.add('hidden'); 31493 else item.classList.remove('hidden'); 31494 }); 31495 filters.forEach((filterElemInner)=>{ 31496 filterElemInner.classList.remove('active'); 31497 }); 31498 filterElem.classList.add('active'); 31499 // Update category heading 31500 categoryHeading.textContent = filterElem.textContent; 31501 categoryHeading.classList.add('active'); 31502 } 31503 // Scroll to top of sticky elem 31504 if (window.outerWidth > 991) { 31505 const filterContainer = document.querySelector('.m__faqs__filter-container--desktop'); 31506 const filterContainerRect = filterContainer.getBoundingClientRect(); 31507 if (filterContainer) { 31508 const headerScrolled = parseInt(getComputedStyle(document.documentElement).getPropertyValue('--hh-scrolled')); 31509 const y = filterContainerRect.top - 32 + window.scrollY - headerScrolled; 31510 if (scrollToCategory) window.scroll({ 31511 top: y 31512 }); 31513 } 31514 } 31515}; 31516// FAQs Filters 31517const filters = document.querySelectorAll('.js-faqs-filter'); 31518const faqItems = document.querySelectorAll('.m__faqs__item'); 31519if (filters) { 31520 filters.forEach((filterElem)=>{ 31521 filterElem.addEventListener('click', (e)=>{ 31522 filterFaqByCategory(e, filterElem); 31523 }); 31524 }); 31525 filterFaqByCategory(null, filters[0], false); 31526} 31527// FAQs reset 31528const resetFiltersElem = document.querySelector('.js-reset-faqs-cats'); 31529if (resetFiltersElem) resetFiltersElem.addEventListener('click', (e)=>{ 31530 e.preventDefault(); 31531 filters.forEach((filterElem)=>{ 31532 filterElem.classList.remove('active'); 31533 }); 31534 faqItems.forEach((item)=>{ 31535 item.classList.remove('hidden'); 31536 }); 31537 choices.setChoiceByValue('0'); 31538}); 31539 31540},{"choices.js":"cVxV3","../helpers/accessibility":"7yMoe","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"2QDve":[function(require,module,exports,__globalThis) { 31541var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 31542var _swiperBundle = require("swiper/swiper-bundle"); 31543var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 31544var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 31545const heroSliders = document.querySelectorAll('.js-hero-slider'); 31546if (heroSliders) heroSliders.forEach((heroSlider)=>{ 31547 const slideVideos = heroSlider.querySelectorAll('.js-hero-slider-video'); 31548 const heroSwiper = new (0, _swiperBundleDefault.default)(heroSlider, { 31549 loop: true, 31550 speed: 800, 31551 autoplay: { 31552 delay: 4000, 31553 disableOnInteraction: false 31554 }, 31555 effect: 'fade', 31556 fadeEffect: { 31557 crossFade: true 31558 }, 31559 keyboard: { 31560 enabled: true, 31561 onlyInViewport: true 31562 }, 31563 a11y: true 31564 }); 31565 heroSwiper.on('slideChange', function() { 31566 slideVideos.forEach((slideVideo)=>{ 31567 slideVideo.pause(); 31568 slideVideo.currentTime = 0; 31569 slideVideo.load(); 31570 }); 31571 // Check for any videos on the slide and make sure they're lazy-loaded (Had a bug with intersection observer not being triggered due to how swiper loads items) 31572 const slideVideo = heroSwiper.slides[heroSwiper.activeIndex].querySelector("video"); 31573 if (slideVideo) { 31574 if (!slideVideo.currentTime > 0) { 31575 slideVideo.load(); 31576 slideVideoTimeout = setTimeout(()=>{ 31577 slideVideo.play(); 31578 }, 1000); 31579 } 31580 } 31581 }); 31582 let thisHSliderNextArrow = heroSlider.querySelector('.js-hero-slider__swiper-next'); 31583 let thisHSliderPrevArrow = heroSlider.querySelector('.js-hero-slider__swiper-prev'); 31584 //Move to next slide if 'next' arrow clicked 31585 if (thisHSliderNextArrow) thisHSliderNextArrow.addEventListener('click', (event)=>{ 31586 heroSwiper.slideNext(); 31587 }); 31588 if (thisHSliderPrevArrow) thisHSliderPrevArrow.addEventListener('click', (event)=>{ 31589 heroSwiper.slidePrev(); 31590 }); 31591}); 31592 31593},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"dBpQ5":[function(require,module,exports,__globalThis) { 31594var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 31595var _gsap = require("gsap"); 31596var _gsapDefault = parcelHelpers.interopDefault(_gsap); 31597var _windowScrollRaf = require("../helpers/windowScrollRaf"); 31598function initHomepageHero() { 31599 const heroModule = document.querySelector('.m__homepage-hero'); 31600 const video = document.querySelector('.js-hero-video'); 31601 const logo = document.querySelector('.m__homepage-hero__logo'); 31602 const content = document.querySelector('.m__homepage-hero__content'); 31603 const desktopMediaQuery = window.matchMedia('(min-width: 992px)'); 31604 if (!heroModule || !video || !logo) return; 31605 let hasAnimated = false;
31606 const elementsToAnimate = [ 31607 logo 31608 ]; 31609 if (content) elementsToAnimate.push(content); 31610 function handleScroll() { 31611 if (!desktopMediaQuery.matches) { 31612 hasAnimated = false; 31613 (0, _gsapDefault.default).killTweensOf(elementsToAnimate); 31614 (0, _gsapDefault.default).set(elementsToAnimate, { 31615 y: 0 31616 }); 31617 return; 31618 } 31619 const videoRect = video.getBoundingClientRect(); 31620 const videoTop = videoRect.top; 31621 // Animate as soon as the video top edge reaches the viewport top (or passes it) 31622 if (videoTop <= 0 && !hasAnimated) { 31623 hasAnimated = true; 31624 const moduleHeight = heroModule.offsetHeight; 31625 (0, _gsapDefault.default).to(elementsToAnimate, { 31626 y: moduleHeight, 31627 duration: 1.3, 31628 ease: 'power1.in' 31629 }); 31630 } else if (videoTop > 0 && hasAnimated) { 31631 hasAnimated = false; 31632 (0, _gsapDefault.default).to(elementsToAnimate, { 31633 y: 0, 31634 duration: 1.6, 31635 ease: 'power1.in' 31636 }); 31637 } 31638 } 31639 (0, _windowScrollRaf.subscribeWindowScrollRAF)(handleScroll); 31640 handleScroll(); 31641} 31642// Initialize when DOM is ready 31643if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', initHomepageHero); 31644else initHomepageHero(); 31645 31646},{"gsap":"33IqQ","../helpers/windowScrollRaf":"gJWEk","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}
31646],"8ZRf4":[function(require,module,exports,__globalThis) { 31647var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 31648var _gsap = require("gsap"); 31649var _gsapDefault = parcelHelpers.interopDefault(_gsap); 31650var _windowScrollRaf = require("../helpers/windowScrollRaf"); 31651function initImageCollage() { 31652 const module = document.querySelector('[data-module="imageCollageWithContent"]'); 31653 if (!module) return; 31654 const mediaItems = module.querySelectorAll('.m__icc__media__item'); 31655 if (mediaItems.length < 2) return; 31656 const firstItem = mediaItems[0]; 31657 const lastItem = mediaItems[mediaItems.length - 1]; 31658 const firstItemInitialY = 230; 31659 const lastItemInitialY = -230; 31660 firstItem.style.transform = ''; 31661 lastItem.style.transform = ''; 31662 (0, _gsapDefault.default).set(firstItem, { 31663 y: firstItemInitialY 31664 }); 31665 (0, _gsapDefault.default).set(lastItem, { 31666 y: lastItemInitialY 31667 }); 31668 const maxMovement = 400; 31669 const triggerOffset = 80; 31670 let wasInScrollRange = false; 31671 let rafId = null; 31672 function updateCollage() { 31673 const moduleRect = module.getBoundingClientRect(); 31674 const moduleTop = moduleRect.top; 31675 const moduleHeight = moduleRect.height; 31676 const inRange = moduleTop <= triggerOffset; 31677 if (inRange) { 31678 if (!wasInScrollRange) (0, _gsapDefault.default).killTweensOf([ 31679 firstItem, 31680 lastItem 31681 ]); 31682 wasInScrollRange = true; 31683 const scrolledPast = triggerOffset - moduleTop; 31684 const progress = Math.min(1, scrolledPast / Math.max(moduleHeight, 1)); 31685 const firstItemY = firstItemInitialY - progress * maxMovement; 31686 const lastItemY = lastItemInitialY + progress * maxMovement; 31687 (0, _gsapDefault.default).set(firstItem, { 31688 y: firstItemY 31689 }); 31690 (0, _gsapDefault.default).set(lastItem, { 31691 y: lastItemY 31692 }); 31693 return; 31694 } 31695 if (wasInScrollRange) { 31696 (0, _gsapDefault.default).killTweensOf([ 31697 firstItem, 31698 lastItem 31699 ]); 31700 (0, _gsapDefault.default).to(firstItem, { 31701 y: firstItemInitialY, 31702 duration: 0.3, 31703 ease: 'power2.out' 31704 }); 31705 (0, _gsapDefault.default).to(lastItem, { 31706 y: lastItemInitialY, 31707 duration: 0.3, 31708 ease: 'power2.out' 31709 }); 31710 } 31711 wasInScrollRange = false; 31712 } 31713 (0, _windowScrollRaf.subscribeWindowScrollRAF)(updateCollage); 31714 updateCollage(); 31715} 31716if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', initImageCollage); 31717else initImageCollage(); 31718 31719},{"gsap":"33IqQ","../helpers/windowScrollRaf":"gJWEk","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"bUj21":[function(require,module,exports,__globalThis) { 31720var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 31721var _gsap = require("gsap"); 31722var _gsapDefault = parcelHelpers.interopDefault(_gsap); 31723var _windowScrollRaf = require("../helpers/windowScrollRaf"); 31724function initImageContent() { 31725 const moduleEls = document.querySelectorAll('.js-image-animation'); 31726 if (!moduleEls.length) return; 31727 const desktopMediaQuery = window.matchMedia('(min-width: 992px)'); 31728 const entries = []; 31729 let unsubscribeScroll = null; 31730 function onSharedScrollResize() { 31731 for(let i = 0; i < entries.length; i++)entries[i].tryTrigger(); 31732 } 31733 function syncSharedListeners() { 31734 const needsListeners = entries.some((e)=>e.isPendingScroll()); 31735 if (needsListeners && !unsubscribeScroll) unsubscribeScroll = (0, _windowScrollRaf.subscribeWindowScrollRAF)(onSharedScrollResize); 31736 else if (!needsListeners && unsubscribeScroll) { 31737 unsubscribeScroll(); 31738 unsubscribeScroll = null; 31739 } 31740 } 31741 function onBreakpointChange() { 31742 for(let i = 0; i < entries.length; i++)if (desktopMediaQuery.matches) entries[i].applyDesktop(); 31743 else entries[i].applyMobile(); 31744 } 31745 for(let i = 0; i < moduleEls.length; i++){ 31746 const module = moduleEls[i]; 31747 const media = module.querySelector('.m__iwcard__media'); 31748 if (!media) continue; 31749 const isLeft = media.classList.contains('m__iwcard__media--left'); 31750 const isRight = media.classList.contains('m__iwcard__media--right'); 31751 let initialRotation; 31752 let initialX; 31753 if (isRight) { 31754 initialRotation = -7; 31755 initialX = -40; 31756 } else if (isLeft) { 31757 initialRotation = 7; 31758 initialX = 40; 31759 } else { 31760 initialRotation = -7; 31761 initialX = -40; 31762 } 31763 let hasAnimated = false;
31764 const entry = { 31765 isPendingScroll () { 31766 return desktopMediaQuery.matches && !hasAnimated; 31767 }, 31768 tryTrigger () { 31769 if (hasAnimated || !desktopMediaQuery.matches) return; 31770 const triggerY = window.innerHeight * 0.5; 31771 if (module.getBoundingClientRect().top <= triggerY) { 31772 hasAnimated = true; 31773 (0, _gsapDefault.default).to(media, { 31774 rotation: 0, 31775 x: 0, 31776 scale: 1, 31777 duration: 0.85, 31778 ease: 'power2.out' 31779 }); 31780 syncSharedListeners(); 31781 } 31782 }, 31783 applyDesktop () { 31784 (0, _gsapDefault.default).killTweensOf(media); 31785 (0, _gsapDefault.default).set(media, { 31786 rotation: initialRotation, 31787 x: initialX, 31788 scale: 0.7 31789 }); 31790 hasAnimated = false; 31791 syncSharedListeners(); 31792 entry.tryTrigger(); 31793 }, 31794 applyMobile () { 31795 hasAnimated = false; 31796 (0, _gsapDefault.default).killTweensOf(media); 31797 (0, _gsapDefault.default).set(media, { 31798 rotation: 0, 31799 x: 0, 31800 scale: 1 31801 }); 31802 syncSharedListeners(); 31803 } 31804 }; 31805 entries.push(entry); 31806 } 31807 if (!entries.length) return; 31808 desktopMediaQuery.addEventListener('change', onBreakpointChange); 31809 for(let i = 0; i < entries.length; i++)if (desktopMediaQuery.matches) entries[i].applyDesktop(); 31810 else entries[i].applyMobile(); 31811} 31812if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', initImageContent); 31813else initImageContent(); 31814 31815},{"gsap":"33IqQ","../helpers/windowScrollRaf":"gJWEk","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"eQP6q":[function(require,module,exports,__globalThis) { 31816// Handle any image accordions 31817const imageAccordions = document.querySelectorAll('.js-image-accordion'); 31818if (imageAccordions.length) { 31819 // Initialize the first accordion as open with proper height 31820 const firstAccordion = imageAccordions[0]; 31821 if (firstAccordion && firstAccordion.classList.contains('open')) { 31822 const firstWrapper = firstAccordion.querySelector('.js-image-accordion-wrapper'); 31823 if (firstWrapper) firstWrapper.style.maxHeight = `${firstWrapper.scrollHeight}px`; 31824 } 31825 imageAccordions.forEach((imageAccordion)=>{ 31826 const accordionTrigger = imageAccordion.querySelector('.js-image-accordion-trigger'); 31827 const accordionWrapper = imageAccordion.querySelector('.js-image-accordion-wrapper'); 31828 if (accordionWrapper) accordionWrapper.addEventListener('transitionend', ()=>{ 31829 if (imageAccordion.classList.contains('open')) accordionWrapper.style.maxHeight = 'none'; 31830 }); 31831 if (accordionTrigger) accordionTrigger.addEventListener('click', (e)=>{ 31832 e.preventDefault(); 31833 const isCurrentlyOpen = imageAccordion.classList.contains('open'); 31834 if (isCurrentlyOpen) { 31835 imageAccordion.classList.remove('open'); 31836 if (accordionWrapper) { 31837 const currentHeight = accordionWrapper.scrollHeight; 31838 accordionWrapper.style.maxHeight = `${currentHeight}px`; 31839 requestAnimationFrame(()=>{ 31840 accordionWrapper.style.maxHeight = '0px'; 31841 }); 31842 accordionTrigger.setAttribute('aria-expanded', 'false'); 31843 setTimeout(()=>{ 31844 if (!accordionWrapper.parentElement.classList.contains('open')) accordionWrapper.hidden = true; 31845 }, 1000); 31846 } 31847 } else { 31848 imageAccordions.forEach((loopAccordion)=>{ 31849 loopAccordion.classList.remove('open'); 31850 const wrapper = loopAccordion.querySelector('.js-image-accordion-wrapper'); 31851 const trigger = loopAccordion.querySelector('.js-image-accordion-trigger'); 31852 if (trigger) trigger.setAttribute('aria-expanded', 'false'); 31853 if (wrapper) { 31854 const currentHeight = wrapper.scrollHeight; 31855 wrapper.style.maxHeight = `${currentHeight}px`; 31856 requestAnimationFrame(()=>{ 31857 wrapper.style.maxHeight = '0px'; 31858 }); 31859 setTimeout(()=>{ 31860 if (!wrapper.parentElement.classList.contains('open')) wrapper.hidden = true; 31861 }, 1000); 31862 } 31863 }); 31864 setTimeout(()=>{ 31865 imageAccordion.classList.add('open'); 31866 accordionTrigger.setAttribute('aria-expanded', 'true'); 31867 if (accordionWrapper) { 31868 accordionWrapper.hidden = false;
31869 accordionWrapper.style.maxHeight = '0px'; 31870 requestAnimationFrame(()=>{ 31871 accordionWrapper.style.maxHeight = `${accordionWrapper.scrollHeight}px`; 31872 }); 31873 } 31874 }, 50); 31875 } 31876 }); 31877 }); 31878} 31879 31880},{}],"aqVKu":[function(require,module,exports,__globalThis) { 31881var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 31882var _swiperBundle = require("swiper/swiper-bundle"); 31883var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 31884var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 31885const imageSliderModules = document.querySelectorAll('.m__islider'); 31886if (imageSliderModules) imageSliderModules.forEach((imageSliderModule)=>{ 31887 const slides = imageSliderModule.querySelectorAll('.m__islider__slide'); 31888 const slideVideos = imageSliderModule.querySelectorAll('.js-islider-video'); 31889 if (slides.length > 1) { 31890 // Initialise the slider 31891 const iSwiper = new (0, _swiperBundleDefault.default)(imageSliderModule.querySelector('.m__islider__swiper-wrapper .swiper'), { 31892 slidesPerView: 1, 31893 loop: true, 31894 shortSwipes: true, 31895 keyboard: { 31896 enabled: true, 31897 onlyInViewport: true 31898 } 31899 }); 31900 let isliderNextArrow = imageSliderModule.querySelector('.js-islider__swiper-next'); 31901 let isliderPrevArrow = imageSliderModule.querySelector('.js-islider__swiper-prev'); 31902 // Updates when a slide changes 31903 iSwiper.on('slideChange', function() { 31904 // Stop all videos from playing 31905 slideVideos.forEach((slideVideo)=>{ 31906 slideVideo.pause(); 31907 slideVideo.currentTime = 0; 31908 slideVideo.load(); 31909 }); 31910 // Check for any videos on the slide and make sure they're lazy-loaded (Had a bug with intersection observer not being triggered due to how swiper loads items) 31911 let slideVideo = iSwiper.slides[iSwiper.activeIndex].querySelector('video'); 31912 if (slideVideo) { 31913 if (!slideVideo.currentTime > 0) { 31914 // Only reload video if it isn't already playing 31915 slideVideo.load(); 31916 slideVideoTimeout = setTimeout(()=>{ 31917 slideVideo.play(); 31918 }, 1000); 31919 } 31920 } 31921 }); 31922 // Move to next slide if 'prev' arrow clicked 31923 if (isliderPrevArrow) isliderPrevArrow.addEventListener('click', (event)=>{ 31924 let prevSlide = iSwiper.activeIndex - 1; 31925 if (prevSlide < 0) prevSlide = iSwiper.slides.length; // Set to the last slide 31926 iSwiper.slideTo(prevSlide); 31927 }); 31928 // Move to next slide if 'next' arrow clicked 31929 if (isliderNextArrow) isliderNextArrow.addEventListener('click', (event)=>{ 31930 let nextSlide = iSwiper.activeIndex + 1; 31931 if (nextSlide >= iSwiper.slides.length) nextSlide = 0; // Return to start! 31932 iSwiper.slideTo(nextSlide); 31933 }); 31934 } 31935}); 31936 31937},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"k4XTB":[function(require,module,exports,__globalThis) { 31938var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 31939var _swiperBundle = require("swiper/swiper-bundle"); 31940var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 31941var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 31942const imageSliderModules = document.querySelectorAll('.m__full-width-media'); 31943if (imageSliderModules) imageSliderModules.forEach((imageSliderModule)=>{ 31944 const slides = imageSliderModule.querySelectorAll('.m__full-width-media__slide'); 31945 const slideVideos = imageSliderModule.querySelectorAll('.js-islider-video'); 31946 if (slides.length > 1) { 31947 // Initialise the slider 31948 const iSwiper = new (0, _swiperBundleDefault.default)(imageSliderModule.querySelector('.m__full-width-media__swiper-wrapper .swiper'), { 31949 slidesPerView: 1, 31950 loop: true, 31951 shortSwipes: true, 31952 keyboard: { 31953 enabled: true, 31954 onlyInViewport: true 31955 } 31956 }); 31957 let fullWidthMediaNextArrow = imageSliderModule.querySelector('.js-full-width-media__swiper-next'); 31958 let fullWidthMediaPrevArrow = imageSliderModule.querySelector('.js-full-width-media__swiper-prev'); 31959 // Updates when a slide changes 31960 iSwiper.on('slideChange', function() { 31961 // Stop all videos from playing 31962 slideVideos.forEach((slideVideo)=>{ 31963 slideVideo.pause(); 31964 slideVideo.currentTime = 0; 31965 slideVideo.load(); 31966 }); 31967 // Check for any videos on the slide and make sure they're lazy-loaded (Had a bug with intersection observer not being triggered due to how swiper loads items) 31968 let slideVideo = iSwiper.slides[iSwiper.activeIndex].querySelector('video'); 31969 if (slideVideo) { 31970 if (!slideVideo.currentTime > 0) { 31971 // Only reload video if it isn't already playing 31972 slideVideo.load(); 31973 slideVideoTimeout = setTimeout(()=>{ 31974 slideVideo.play(); 31975 }, 1000); 31976 } 31977 } 31978 }); 31979 // Move to next slide if 'prev' arrow clicked 31980 if (fullWidthMediaPrevArrow) fullWidthMediaPrevArrow.addEventListener('click', (event)=>{ 31981 let prevSlide = iSwiper.activeIndex - 1; 31982 if (prevSlide < 0) prevSlide = iSwiper.slides.length; // Set to the last slide 31983 iSwiper.slideTo(prevSlide); 31984 }); 31985 // Move to next slide if 'next' arrow clicked 31986 if (fullWidthMediaNextArrow) fullWidthMediaNextArrow.addEventListener('click', (event)=>{ 31987 let nextSlide = iSwiper.activeIndex + 1; 31988 if (nextSlide >= iSwiper.slides.length) nextSlide = 0;
31988 // Return to start! 31989 iSwiper.slideTo(nextSlide); 31990 }); 31991 } 31992}); 31993 31994},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"e8afY":[function(require,module,exports,__globalThis) { 31995var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 31996var _swiperBundle = require("swiper/swiper-bundle"); 31997var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 31998var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 31999var _gsap = require("gsap"); 32000var _gsapDefault = parcelHelpers.interopDefault(_gsap); 32001const iwCardSliderModules = document.querySelectorAll('.m__iwcard'); 32002iwCardSliderModules.forEach((moduleElem)=>{ 32003 //Loop through each card slider and initialise swiper and buttons 32004 const contentSlider = moduleElem.querySelector('.m__iwcard__content-slider'); 32005 const imageSlider = moduleElem.querySelector('.m__iwcard__image-slider'); 32006 if (contentSlider && imageSlider) { 32007 const contentSwiper = initImageCardContentSlider(contentSlider); 32008 const imageSwiper = initImageCardImageSlider(imageSlider); 32009 let nextArrow = moduleElem.querySelector('.js-iwcard__swiper-next'); 32010 let prevArrow = moduleElem.querySelector('.js-iwcard__swiper-prev'); 32011 //Move to next slide if 'next' arrow clicked 32012 if (nextArrow) nextArrow.addEventListener('click', (event)=>{ 32013 animateImageCardContentSlider(contentSwiper, imageSwiper, 'next', nextArrow, prevArrow); 32014 }); 32015 if (prevArrow) prevArrow.addEventListener('click', (event)=>{ 32016 animateImageCardContentSlider(contentSwiper, imageSwiper, 'prev', nextArrow, prevArrow); 32017 }); 32018 } 32019}); 32020function initImageCardContentSlider(slider) { 32021 const swiper = new (0, _swiperBundleDefault.default)(slider, { 32022 slidesPerView: 1, 32023 centeredSlides: false, 32024 shortSwipes: true, 32025 keyboard: { 32026 enabled: true, 32027 onlyInViewport: true 32028 }, 32029 speed: 0, 32030 allowTouchMove: false, 32031 draggable: false 32032 }); 32033 return swiper; 32034} 32035function initImageCardImageSlider(slider) { 32036 const swiper = new (0, _swiperBundleDefault.default)(slider, { 32037 loop: true, 32038 effect: 'creative', 32039 creativeEffect: { 32040 prev: { 32041 translate: [ 32042 '-30%', 32043 0, 32044 -1 32045 ] 32046 }, 32047 next: { 32048 translate: [ 32049 '100%', 32050 0, 32051 0 32052 ] 32053 } 32054 }, 32055 speed: 700, 32056 allowTouchMove: false, 32057 draggable: false 32058 }); 32059 return swiper; 32060} 32061function animateImageCardContentSlider(slider, imageSwiper, direction, nextArrow, prevArrow) { 32062 const currentSlide = slider.slides[slider.activeIndex]; 32063 let newSlideIndex = direction === 'next' ? slider.activeIndex + 1 : slider.activeIndex - 1; 32064 let newSlide = slider.slides[newSlideIndex]; 32065 if (!newSlide) { 32066 if (direction === 'next') newSlide = slider.slides[0]; 32067 else newSlide = slider.slides[slider.slides.length - 1]; 32068 newSlideIndex = direction === 'next' ? 0 : slider.slides.length - 1; 32069 } 32070 const currentSlideAnimationElements = currentSlide.querySelectorAll('.js-slide-animation-element'); 32071 const currentSlideAnimationElementsLarge = currentSlide.querySelectorAll('.js-slide-animation-element-large'); 32072 const newSlideAnimationElements = newSlide.querySelectorAll('.js-slide-animation-element'); 32073 const newSlideAnimationElementsLarge = newSlide.querySelectorAll('.js-slide-animation-element-large'); 32074 (0, _gsapDefault.default).set(newSlideAnimationElements, { 32075 y: direction === 'next' ? '100%' : '-100%', 32076 opacity: 0 32077 }); 32078 (0, _gsapDefault.default).set(newSlideAnimationElementsLarge, { 32079 y: direction === 'next' ? '35%' : '-35%', 32080 opacity: 0 32081 }); 32082 const tl = (0, _gsapDefault.default).timeline({ 32083 onStart: ()=>{
32084 // Add classes to disable pointer events and cursor on the button 32085 nextArrow.classList.add('pointer-events-none', 'cursor-not-allowed'); 32086 prevArrow.classList.add('pointer-events-none', 'cursor-not-allowed'); 32087 // Slide the image swiper 32088 if (direction === 'next') imageSwiper.slideNext(); 32089 else imageSwiper.slidePrev(); 32090 }, 32091 onComplete: ()=>{ 32092 // Remove classes to enable pointer events and cursor on the button 32093 nextArrow.classList.remove('pointer-events-none', 'cursor-not-allowed'); 32094 prevArrow.classList.remove('pointer-events-none', 'cursor-not-allowed'); 32095 } 32096 }); 32097 tl.addLabel('currentSlideAnimateOut'); 32098 tl.to(currentSlideAnimationElements, { 32099 y: direction === 'next' ? '-100%' : '100%', 32100 opacity: 0, 32101 duration: 0.3, 32102 onComplete: ()=>{ 32103 slider.slideTo(newSlideIndex); 32104 } 32105 }, 'currentSlideAnimateOut'); 32106 tl.to(currentSlideAnimationElementsLarge, { 32107 y: direction === 'next' ? '-35%' : '35%', 32108 opacity: 0, 32109 duration: 0.3, 32110 onComplete: ()=>{ 32111 slider.slideTo(newSlideIndex); 32112 } 32113 }, 'currentSlideAnimateOut'); 32114 tl.addLabel('newSlideAnimateIn'); 32115 tl.to(newSlideAnimationElements, { 32116 y: '0%', 32117 opacity: 1, 32118 duration: 0.3 32119 }, 'newSlideAnimateIn'); 32120 tl.to(newSlideAnimationElementsLarge, { 32121 y: '0%', 32122 opacity: 1, 32123 duration: 0.3 32124 }, 'newSlideAnimateIn'); 32125} 32126 32127},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","gsap":"33IqQ","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"9xble":[function(require,module,exports,__globalThis) { 32128var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 32129var _gsap = require("gsap"); 32130var _gsapDefault = parcelHelpers.interopDefault(_gsap); 32131var _windowScrollRaf = require("../helpers/windowScrollRaf"); 32132var _swiperBundle = require("swiper/swiper-bundle"); 32133var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 32134var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 32135const locationsListModules = document.querySelectorAll('.m__llist'); 32136locationsListModules.forEach((locationsListModule)=>{ 32137 const locationsListSwiper = locationsListModule.querySelector('.m__llist__locations--slider'); 32138 const thisLocationsListSwiper = new (0, _swiperBundleDefault.default)(locationsListSwiper, { 32139 slidesPerView: 1.2, 32140 spaceBetween: 20, 32141 centeredSlides: false, 32142 loop: true 32143 }); 32144}); 32145function initLocationsList() { 32146 const module = document.querySelector('.m__llist'); 32147 if (!module) return; 32148 const locationCards = module.querySelectorAll('.m__llist__card'); 32149 if (locationCards.length === 0) return; 32150 if (!window.matchMedia('(min-width: 768px)').matches) return; 32151 // First three items for staggered animation 32152 const firstThreeItems = Array.from(locationCards).slice(0, 3); 32153 // Remaining items (4th and beyond) for simultaneous animation 32154 const remainingItems = Array.from(locationCards).slice(3); 32155 // Initial positions for first three: first 200px down, second 300px down, third 400px down 32156 if (firstThreeItems.length >= 1) (0, _gsapDefault.default).set(firstThreeItems[0], { 32157 y: 200 32158 }); 32159 if (firstThreeItems.length >= 2) (0, _gsapDefault.default).set(firstThreeItems[1], { 32160 y: 300 32161 }); 32162 if (firstThreeItems.length >= 3) (0, _gsapDefault.default).set(firstThreeItems[2], { 32163 y: 400 32164 }); 32165 // Set all remaining items to start at 400px down 32166 remainingItems.forEach((item)=>{ 32167 (0, _gsapDefault.default).set(item, { 32168 y: 400 32169 }); 32170 }); 32171 let hasAnimated = false; 32172 let unsubscribeScroll = null; 32173 function runReveal() { 32174 if (firstThreeItems.length > 0) (0, _gsapDefault.default).to(firstThreeItems, { 32175 y: 0, 32176 duration: 1.2, 32177 ease: 'power3.out', 32178 stagger: 0.2 32179 }); 32180 if (remainingItems.length > 0) (0, _gsapDefault.default).to(remainingItems, { 32181 y: 0, 32182 duration: 1.2, 32183 ease: 'power3.out' 32184 }); 32185 } 32186 function tryReveal() { 32187 if (hasAnimated) return; 32188 const moduleRect = module.getBoundingClientRect(); 32189 const windowHeight = window.innerHeight; 32190 const moduleTop = moduleRect.top; 32191 const moduleBottom = moduleRect.bottom; 32192 const visibleTop = Math.max(0, windowHeight - moduleTop); 32193 const visibleBottom = Math.max(0, moduleBottom); 32194 const visibleHeight = Math.min(visibleTop, visibleBottom, moduleRect.height); 32195 // List is fully above the viewport (restored scroll / anchor below): never hits visible threshold 32196 const listFullyAboveViewport = moduleRect.bottom <= 0; 32197 if (!listFullyAboveViewport && visibleHeight < 400) return; 32198 hasAnimated = true; 32199 runReveal(); 32200 if (unsubscribeScroll) { 32201 unsubscribeScroll(); 32202 unsubscribeScroll = null; 32203 } 32204 } 32205 unsubscribeScroll = (0, _windowScrollRaf.subscribeWindowScrollRAF)(tryReveal); 32206 tryReveal(); 32207 // Scroll restoration can apply after first paint; re-check once layout has settled 32208 requestAnimationFrame(()=>tryReveal()); 32209} 32210function initLocationsListHoverVideos() { 32211 document.querySelectorAll('.m__llist .m__llist__card').forEach((card)=>{ 32212 const video = card.querySelector('video.js-hover-video'); 32213 if (!video) return; 32214 if (card.dataset.hoverVideoBound === '1') return; 32215 card.dataset.hoverVideoBound = '1'; 32216 video.pause(); 32217 card.addEventListener('mouseenter', ()=>{ 32218 const p = video.play(); 32219 if (p !== undefined && typeof p.catch === 'function') p.catch(()=>{}); 32220 }); 32221 card.addEventListener('mouseleave', ()=>{ 32222 video.pause(); 32223 }); 32224 }); 32225} 32226// Initialize when DOM is ready 32227if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', ()=>{ 32228 initLocationsList(); 32229 initLocationsListHoverVideos(); 32230}); 32231else { 32232 initLocationsList(); 32233 initLocationsListHoverVideos(); 32234} 32235 32236},{"gsap":"33IqQ","../helpers/windowScrollRaf":"gJWEk","swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"j6klG":[function(require,module,exports,__globalThis) { 32237var _jsApiLoader = require("@googlemaps/js-api-loader"); 32238// Function to calculate and apply dynamic padding to map content 32239function calculateMapContentPadding() { 32240 // Only apply padding on screen sizes larger than 992px (lg breakpoint) 32241 if (window.innerWidth <= 992) { 32242 // Reset padding on smaller screens 32243 const mapModules = document.querySelectorAll('.m__map');
32244 mapModules.forEach(function(mapModule) { 32245 const contentElement = mapModule.querySelector('.m__map__content'); 32246 if (contentElement) contentElement.style.paddingTop = ''; 32247 }); 32248 return; 32249 } 32250 const mapModules = document.querySelectorAll('.m__map'); 32251 mapModules.forEach(function(mapModule) { 32252 const mapElement = mapModule.querySelector('.m__map__map'); 32253 const contentElement = mapModule.querySelector('.m__map__content'); 32254 if (mapElement && contentElement) { 32255 // Get the heights 32256 const mapHeight = mapElement.offsetHeight; 32257 const contentHeight = contentElement.offsetHeight; 32258 // Calculate padding: (map height - content height) / 2 32259 // Use Math.max to ensure we don't get negative padding 32260 const paddingTop = Math.max(0, (mapHeight - contentHeight) / 2); 32261 // Apply the padding 32262 contentElement.style.paddingTop = paddingTop + 'px'; 32263 } 32264 }); 32265} 32266// Get all map objects on the page 32267const jsMaps = [].slice.call(document.querySelectorAll('.js-map')); 32268// Only init maps when they scroll into view 32269if ("IntersectionObserver" in window) { 32270 let lazyMapObserver; 32271 lazyMapObserver = new IntersectionObserver(function(entries, observer) { 32272 entries.forEach(function(map) { 32273 if (map.isIntersecting) { 32274 // Set Google API credentials 32275 const googleLoader = new (0, _jsApiLoader.Loader)({ 32276 apiKey: "AIzaSyCC0nJSV1K42Cxhx4raqVXHiRWr9hfOSQk", 32277 version: "weekly", 32278 libraries: [ 32279 "places" 32280 ] 32281 }); 32282 // Get map display coordinates from element data attributes, otherwise default to London 32283 const mapLocation = { 32284 lat: parseFloat(map.target.dataset.lat) || 51.5320501, 32285 lng: parseFloat(map.target.dataset.lng) || -0.124512 32286 }; 32287 //Get API code from Google 32288 googleLoader.load().then((google)=>{ 32289 // Configure Map 32290 const mapArgs = { 32291 zoom: 16, 32292 mapTypeId: google.maps.MapTypeId.ROADMAP, 32293 center: mapLocation, 32294 zoomControl: true, 32295 mapTypeControl: false, 32296 scaleControl: false, 32297 streetViewControl: true, 32298 rotateControl: false, 32299 fullscreenControl: false 32300 }; 32301 // Init map object 32302 const mapObject = new google.maps.Map(map.target, mapArgs); 32303 // Add a marker to be super clear 32304 const mapMarker = new google.maps.Marker({ 32305 position: mapLocation, 32306 map: mapObject 32307 }); 32308 }).catch((e)=>{ 32309 // do something 32310 }); 32311 // Remove this map from the observer, as it's now loaded in 32312 lazyMapObserver.unobserve(map.target); 32313 } 32314 }); 32315 }); 32316 if (lazyMapObserver) jsMaps.forEach(function(jsMap) { 32317 lazyMapObserver.observe(jsMap); 32318 }); 32319} 32320// Handle any map accordians 32321const mapAccordians = document.querySelectorAll('.js-map-accordian'); 32322if (mapAccordians) { 32323 // Initialize the first accordion as open with proper height 32324 const firstAccordian = mapAccordians[0]; 32325 if (firstAccordian && firstAccordian.classList.contains('open')) { 32326 const firstWrapper = firstAccordian.querySelector('.js-map-accordian-wrapper'); 32327 if (firstWrapper) { 32328 // For the first open accordion, set the height immediately without animation 32329 firstWrapper.style.maxHeight = 'none'; 32330 const naturalHeight = firstWrapper.scrollHeight; 32331 firstWrapper.style.maxHeight = naturalHeight + 'px'; 32332 } 32333 } 32334 mapAccordians.forEach(function(mapAccordian) { 32335 const accordianTrigger = mapAccordian.querySelector('.js-map-accordian-trigger'); 32336 const accordianWrapper = mapAccordian.querySelector('.js-map-accordian-wrapper'); 32337 // Add transition end listener for smooth height handling 32338 if (accordianWrapper) accordianWrapper.addEventListener('transitionend', function() { 32339 // After transition completes, set maxHeight to 'none' for open accordions 32340 // This allows content to expand naturally if it changes size 32341 if (mapAccordian.classList.contains('open')) accordianWrapper.style.maxHeight = 'none'; 32342 }); 32343 if (accordianTrigger) accordianTrigger.addEventListener('click', (e)=>{ 32344 e.preventDefault(); 32345 const isCurrentlyOpen = mapAccordian.classList.contains('open'); 32346 // Only proceed if we're actually changing state 32347 if (isCurrentlyOpen) { 32348 // Close this accordion with smooth animation 32349 mapAccordian.classList.remove('open'); 32350 if (accordianWrapper) { 32351 // Get current height before closing to ensure smooth animation 32352 const currentHeight = accordianWrapper.scrollHeight; 32353 accordianWrapper.style.maxHeight = currentHeight + 'px'; 32354 // Use requestAnimationFrame to ensure the current height is set before animating to 0 32355 requestAnimationFrame(()=>{ 32356 accordianWrapper.style.maxHeight = '0px'; 32357 }); 32358 accordianTrigger.setAttribute('aria-expanded', 'false'); 32359 // add hidden attribute to the wrapper after the animation has completed 32360 setTimeout(()=>{ 32361 if (!accordianWrapper.parentElement.classList.contains('open')) accordianWrapper.hidden = true; 32362 }, 1000); 32363 } 32364 } else { 32365 // Close all accordions first with smooth animation 32366 mapAccordians.forEach(function(loopAccordian) { 32367 loopAccordian.classList.remove('open'); 32368 const wrapper = loopAccordian.querySelector('.js-map-accordian-wrapper'); 32369 const trigger = loopAccordian.querySelector('.js-map-accordian-trigger'); 32370 if (trigger) trigger.setAttribute('aria-expanded', 'false'); 32371 if (wrapper) { 32372 // Get current height before closing to ensure smooth animation 32373 const currentHeight = wrapper.scrollHeight; 32374 wrapper.style.maxHeight = currentHeight + 'px'; 32375 // Use requestAnimationFrame to ensure smooth transition to 0 32376 requestAnimationFrame(()=>{ 32377 wrapper.style.maxHeight = '0px'; 32378 }); 32379 // add hidden attribute to the wrapper after the animation has completed 32380 setTimeout(()=>{ 32381 if (!wrapper.parentElement.classList.contains('open')) wrapper.hidden = true; 32382 }, 1000); 32383 } 32384 }); 32385 // Small delay to allow closing animations to start before opening the new one 32386 setTimeout(()=>{ 32387 // Open this accordion with smooth animation 32388 mapAccordian.classList.add('open'); 32389 if (accordianTrigger) accordianTrigger.setAttribute('aria-expanded', 'true'); 32390 if (accordianWrapper) { 32391 accordianWrapper.hidden = false;
32392 // First set to 0 to ensure smooth animation from closed state 32393 accordianWrapper.style.maxHeight = '0px'; 32394 // Use requestAnimationFrame to ensure the 0 height is applied before animating 32395 requestAnimationFrame(()=>{ 32396 // Now animate to the natural height 32397 accordianWrapper.style.maxHeight = accordianWrapper.scrollHeight + 'px'; 32398 }); 32399 } 32400 }, 50); // Small delay to ensure smooth transition 32401 } 32402 }); 32403 }); 32404} 32405// Initialize padding calculation when DOM is ready 32406document.addEventListener('DOMContentLoaded', function() { 32407 // Small delay to ensure all elements are properly rendered 32408 setTimeout(calculateMapContentPadding, 100); 32409}); 32410// Recalculate padding on window resize 32411window.addEventListener('resize', function() { 32412 // Debounce the resize event 32413 clearTimeout(window.resizeTimeout); 32414 window.resizeTimeout = setTimeout(calculateMapContentPadding, 250); 32415}); // Note: Padding is now only calculated on initial load and window resize 32416 // This prevents unnecessary recalculations during accordion interactions 32417 32418},{"@googlemaps/js-api-loader":"dURxI"}],"dURxI":[function(require,module,exports,__globalThis) { 32419/****************************************************************************** 32420Copyright (c) Microsoft Corporation. 32421 32422Permission to use, copy, modify, and/or distribute this software for any 32423purpose with or without fee is hereby granted. 32424 32425THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 32426REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 32427AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 32428INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 32429LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 32430OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 32431PERFORMANCE OF THIS SOFTWARE. 32432***************************************************************************** */ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 32433parcelHelpers.defineInteropFlag(exports); 32434parcelHelpers.export(exports, "DEFAULT_ID", ()=>DEFAULT_ID); 32435parcelHelpers.export(exports, "Loader", ()=>Loader); 32436parcelHelpers.export(exports, "LoaderStatus", ()=>LoaderStatus); 32437function __awaiter(thisArg, _arguments, P, generator) { 32438 function adopt(value) { 32439 return value instanceof P ? value : new P(function(resolve) { 32440 resolve(value); 32441 }); 32442 } 32443 return new (P || (P = Promise))(function(resolve, reject) { 32444 function fulfilled(value) { 32445 try { 32446 step(generator.next(value)); 32447 } catch (e) { 32448 reject(e); 32449 } 32450 } 32451 function rejected(value) { 32452 try { 32453 step(generator["throw"](value)); 32454 } catch (e) { 32455 reject(e); 32456 } 32457 } 32458 function step(result) { 32459 result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); 32460 } 32461 step((generator = generator.apply(thisArg, _arguments || [])).next()); 32462 }); 32463} 32464typeof SuppressedError === "function" && SuppressedError; 32465function getDefaultExportFromCjs(x) { 32466 return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x; 32467} 32468var fastDeepEqual; 32469var hasRequiredFastDeepEqual; 32470function requireFastDeepEqual() { 32471 if (hasRequiredFastDeepEqual) return fastDeepEqual; 32472 hasRequiredFastDeepEqual = 1; 32473 // do not edit .js files directly - edit src/index.jst 32474 fastDeepEqual = function equal(a, b) { 32475 if (a === b) return true; 32476 if (a && b && typeof a == 'object' && typeof b == 'object') { 32477 if (a.constructor !== b.constructor) return false; 32478 var length, i, keys; 32479 if (Array.isArray(a)) { 32480 length = a.length; 32481 if (length != b.length) return false;
32482 for(i = length; i-- !== 0;)if (!equal(a[i], b[i])) return false; 32483 return true; 32484 } 32485 if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags; 32486 if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf(); 32487 if (a.toString !== Object.prototype.toString) return a.toString() === b.toString(); 32488 keys = Object.keys(a); 32489 length = keys.length; 32490 if (length !== Object.keys(b).length) return false; 32491 for(i = length; i-- !== 0;)if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false; 32492 for(i = length; i-- !== 0;){ 32493 var key = keys[i]; 32494 if (!equal(a[key], b[key])) return false; 32495 } 32496 return true; 32497 } 32498 // true if both NaN, false otherwise 32499 return a !== a && b !== b; 32500 }; 32501 return fastDeepEqual; 32502} 32503var fastDeepEqualExports = requireFastDeepEqual(); 32504var isEqual = /*@__PURE__*/ getDefaultExportFromCjs(fastDeepEqualExports); 32505/** 32506 * Copyright 2019 Google LLC. All Rights Reserved. 32507 * 32508 * Licensed under the Apache License, Version 2.0 (the "License"); 32509 * you may not use this file except in compliance with the License. 32510 * You may obtain a copy of the License at. 32511 * 32512 * Http://www.apache.org/licenses/LICENSE-2.0. 32513 * 32514 * Unless required by applicable law or agreed to in writing, software 32515 * distributed under the License is distributed on an "AS IS" BASIS, 32516 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 32517 * See the License for the specific language governing permissions and 32518 * limitations under the License. 32519 */ const DEFAULT_ID = "__googleMapsScriptId"; 32520/** 32521 * The status of the [[Loader]]. 32522 */ var LoaderStatus; 32523(function(LoaderStatus) { 32524 LoaderStatus[LoaderStatus["INITIALIZED"] = 0] = "INITIALIZED"; 32525 LoaderStatus[LoaderStatus["LOADING"] = 1] = "LOADING"; 32526 LoaderStatus[LoaderStatus["SUCCESS"] = 2] = "SUCCESS"; 32527 LoaderStatus[LoaderStatus["FAILURE"] = 3] = "FAILURE"; 32528})(LoaderStatus || (LoaderStatus = {})); 32529/** 32530 * [[Loader]] makes it easier to add Google Maps JavaScript API to your application 32531 * dynamically using 32532 * [Promises](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). 32533 * It works by dynamically creating and appending a script node to the the 32534 * document head and wrapping the callback function so as to return a promise. 32535 * 32536 * ``` 32537 * const loader = new Loader({ 32538 * apiKey: "", 32539 * version: "weekly", 32540 * libraries: ["places"] 32541 * }); 32542 * 32543 * loader.load().then((google) => { 32544 * const map = new google.maps.Map(...) 32545 * }) 32546 * ``` 32547 */ class Loader { 32548 /** 32549 * Creates an instance of Loader using [[LoaderOptions]]. No defaults are set 32550 * using this library, instead the defaults are set by the Google Maps 32551 * JavaScript API server. 32552 * 32553 * ``` 32554 * const loader = Loader({apiKey, version: 'weekly', libraries: ['places']}); 32555 * ``` 32556 */ constructor({ apiKey, authReferrerPolicy, channel, client, id = DEFAULT_ID, language, libraries = [], mapIds, nonce, region, retries = 3, url = "https://maps.googleapis.com/maps/api/js", version }){ 32557 this.callbacks = []; 32558 this.done = false; 32559 this.loading = false; 32560 this.errors = []; 32561 this.apiKey = apiKey; 32562 this.authReferrerPolicy = authReferrerPolicy; 32563 this.channel = channel; 32564 this.client = client; 32565 this.id = id || DEFAULT_ID; // Do not allow empty string 32566 this.language = language; 32567 this.libraries = libraries; 32568 this.mapIds = mapIds; 32569 this.nonce = nonce; 32570 this.region = region; 32571 this.retries = retries; 32572 this.url = url; 32573 this.version = version; 32574 if (Loader.instance) { 32575 if (!isEqual(this.options, Loader.instance.options)) throw new Error(`Loader must not be called again with different options. ${JSON.stringify(this.options)} !== ${JSON.stringify(Loader.instance.options)}`); 32576 return Loader.instance; 32577 } 32578 Loader.instance = this; 32579 } 32580 get options() { 32581 return { 32582 version: this.version, 32583 apiKey: this.apiKey, 32584 channel: this.channel, 32585 client: this.client, 32586 id: this.id, 32587 libraries: this.libraries, 32588 language: this.language, 32589 region: this.region, 32590 mapIds: this.mapIds, 32591 nonce: this.nonce, 32592 url: this.url, 32593 authReferrerPolicy: this.authReferrerPolicy 32594 }; 32595 } 32596 get status() { 32597 if (this.errors.length) return LoaderStatus.FAILURE; 32598 if (this.done) return LoaderStatus.SUCCESS; 32599 if (this.loading) return LoaderStatus.LOADING; 32600 return LoaderStatus.INITIALIZED; 32601 } 32602 get failed() { 32603 return this.done && !this.loading && this.errors.length >= this.retries + 1; 32604 } 32605 /** 32606 * CreateUrl returns the Google Maps JavaScript API script url given the [[LoaderOptions]]. 32607 * 32608 * @ignore 32609 * @deprecated 32610 */ createUrl() { 32611 let url = this.url; 32612 url += `?callback=__googleMapsCallback&loading=async`; 32613 if (this.apiKey) url += `&key=${this.apiKey}`; 32614 if (this.channel) url += `&channel=${this.channel}`; 32615 if (this.client) url += `&client=${this.client}`; 32616 if (this.libraries.length > 0) url += `&libraries=${this.libraries.join(",")}`; 32617 if (this.language) url += `&language=${this.language}`; 32618 if (this.region) url += `®ion=${this.region}`; 32619 if (this.version) url += `&v=${this.version}`; 32620 if (this.mapIds) url += `&map_ids=${this.mapIds.join(",")}`; 32621 if (this.authReferrerPolicy) url += `&auth_referrer_policy=${this.authReferrerPolicy}`; 32622 return url; 32623 } 32624 deleteScript() { 32625 const script = document.getElementById(this.id); 32626 if (script) script.remove(); 32627 } 32628 /** 32629 * Load the Google Maps JavaScript API script and return a Promise. 32630 * @deprecated, use importLibrary() instead. 32631 */ load() { 32632 return this.loadPromise(); 32633 } 32634 /** 32635 * Load the Google Maps JavaScript API script and return a Promise. 32636 * 32637 * @ignore 32638 * @deprecated, use importLibrary() instead. 32639 */ loadPromise() { 32640 return new Promise((resolve, reject)=>{ 32641 this.loadCallback((err)=>{ 32642 if (!err) resolve(window.google); 32643 else reject(err.error); 32644 }); 32645 }); 32646 } 32647 importLibrary(name) { 32648 this.execute(); 32649 return google.maps.importLibrary(name); 32650 } 32651 /** 32652 * Load the Google Maps JavaScript API script with a callback. 32653 * @deprecated, use importLibrary() instead. 32654 */ loadCallback(fn) { 32655 this.callbacks.push(fn); 32656 this.execute(); 32657 } 32658 /** 32659 * Set the script on document. 32660 */ setScript() { 32661 var _a, _b; 32662 if (document.getElementById(this.id)) { 32663 // TODO wrap onerror callback for cases where the script was loaded elsewhere 32664 this.callback(); 32665 return; 32666 } 32667 const params = { 32668 key: this.apiKey, 32669 channel: this.channel, 32670 client: this.client, 32671 libraries: this.libraries.length && this.libraries, 32672 v: this.version, 32673 mapIds: this.mapIds, 32674 language: this.language, 32675 region: this.region, 32676 authReferrerPolicy: this.authReferrerPolicy 32677 }; 32678 // keep the URL minimal:
32679 Object.keys(params).forEach(// eslint-disable-next-line @typescript-eslint/no-explicit-any 32680 (key)=>!params[key] && delete params[key]); 32681 if (!((_b = (_a = window === null || window === void 0 ? void 0 : window.google) === null || _a === void 0 ? void 0 : _a.maps) === null || _b === void 0 ? void 0 : _b.importLibrary)) // tweaked copy of https://developers.google.com/maps/documentation/javascript/load-maps-js-api#dynamic-library-import 32682 // which also sets the base url, the id, and the nonce 32683 /* eslint-disable */ ((g)=>{ 32684 // @ts-ignore 32685 let h, a, k, p = "The Google Maps JavaScript API", c = "google", l = "importLibrary", q = "__ib__", m = document, b = window; 32686 // @ts-ignore 32687 b = b[c] || (b[c] = {}); 32688 // @ts-ignore 32689 const d = b.maps || (b.maps = {}), r = new Set(), e = new URLSearchParams(), u = ()=>// @ts-ignore 32690 h || (h = new Promise((f, n)=>__awaiter(this, void 0, void 0, function*() { 32691 var _a; 32692 yield a = m.createElement("script"); 32693 a.id = this.id; 32694 e.set("libraries", [ 32695 ...r 32696 ] + ""); 32697 // @ts-ignore 32698 for(k in g)e.set(k.replace(/[A-Z]/g, (t)=>"_" + t[0].toLowerCase()), g[k]); 32699 e.set("callback", c + ".maps." + q); 32700 a.src = this.url + `?` + e; 32701 d[q] = f; 32702 a.onerror = ()=>h = n(Error(p + " could not load.")); 32703 // @ts-ignore 32704 a.nonce = this.nonce || ((_a = m.querySelector("script[nonce]")) === null || _a === void 0 ? void 0 : _a.nonce) || ""; 32705 m.head.append(a); 32706 }))); 32707 // @ts-ignore 32708 d[l] ? console.warn(p + " only loads once. Ignoring:", g) : d[l] = (f, ...n)=>r.add(f) && u().then(()=>d[l](f, ...n)); 32709 })(params); 32710 // While most libraries populate the global namespace when loaded via bootstrap params, 32711 // this is not the case for "marker" when used with the inline bootstrap loader 32712 // (and maybe others in the future). So ensure there is an importLibrary for each: 32713 const libraryPromises = this.libraries.map((library)=>this.importLibrary(library)); 32714 // ensure at least one library, to kick off loading... 32715 if (!libraryPromises.length) libraryPromises.push(this.importLibrary("core")); 32716 Promise.all(libraryPromises).then(()=>this.callback(), (error)=>{ 32717 const event = new ErrorEvent("error", { 32718 error 32719 }); // for backwards compat 32720 this.loadErrorCallback(event); 32721 }); 32722 } 32723 /** 32724 * Reset the loader state. 32725 */ reset() { 32726 this.deleteScript(); 32727 this.done = false; 32728 this.loading = false; 32729 this.errors = []; 32730 this.onerrorEvent = null; 32731 } 32732 resetIfRetryingFailed() { 32733 if (this.failed) this.reset(); 32734 } 32735 loadErrorCallback(e) { 32736 this.errors.push(e); 32737 if (this.errors.length <= this.retries) { 32738 const delay = this.errors.length * Math.pow(2, this.errors.length); 32739 console.error(`Failed to load Google Maps script, retrying in ${delay} ms.`); 32740 setTimeout(()=>{ 32741 this.deleteScript(); 32742 this.setScript(); 32743 }, delay); 32744 } else { 32745 this.onerrorEvent = e; 32746 this.callback(); 32747 } 32748 } 32749 callback() { 32750 this.done = true; 32751 this.loading = false; 32752 this.callbacks.forEach((cb)=>{ 32753 cb(this.onerrorEvent); 32754 }); 32755 this.callbacks = []; 32756 } 32757 execute() { 32758 this.resetIfRetryingFailed(); 32759 if (this.loading) // do nothing but wait 32760 return; 32761 if (this.done) this.callback(); 32762 else { 32763 // short circuit and warn if google.maps is already loaded 32764 if (window.google && window.google.maps && window.google.maps.version) { 32765 console.warn("Google Maps already loaded outside @googlemaps/js-api-loader. This may result in undesirable behavior as options and script parameters may not match."); 32766 this.callback(); 32767 return; 32768 } 32769 this.loading = true; 32770 this.setScript(); 32771 } 32772 } 32773} 32774 32775},{"@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"d9BDo":[function(require,module,exports,__globalThis) { 32776var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 32777parcelHelpers.defineInteropFlag(exports); 32778parcelHelpers.export(exports, "moduleMenus", ()=>moduleMenus); 32779parcelHelpers.export(exports, "initLocationsDropdown", ()=>initLocationsDropdown); 32780parcelHelpers.export(exports, "GetURLParameter", ()=>GetURLParameter); 32781parcelHelpers.export(exports, "mobileDietaryFilterToggle", ()=>mobileDietaryFilterToggle); 32782parcelHelpers.export(exports, "menuFilter", ()=>menuFilter); 32783parcelHelpers.export(exports, "getOffsetTop", ()=>getOffsetTop); 32784parcelHelpers.export(exports, "toggleMenusSubcats", ()=>toggleMenusSubcats); 32785parcelHelpers.export(exports, "scrollToCat", ()=>scrollToCat); 32786parcelHelpers.export(exports, "scrollToMenuTop", ()=>scrollToMenuTop); 32787parcelHelpers.export(exports, "filterMenuType", ()=>filterMenuType); 32788parcelHelpers.export(exports, "menuLocation", ()=>menuLocation); 32789var _choicesJs = require("choices.js"); 32790var _choicesJsDefault = parcelHelpers.interopDefault(_choicesJs); 32791var _choicesCss = require("../../../../node_modules/choices.js/public/assets/styles/choices.css"); 32792let categoriesDisplay = 'all'; 32793const moduleMenus = ()=>{ 32794 let menuModules = document.querySelector('.m__menus'); 32795 if (menuModules) { 32796 let categoriesDisplay = menuModules.querySelector('.menu').getAttribute('data-categories-display'); 32797 initLocationsDropdown(); 32798 mobileDietaryFilterToggle(); 32799 menuFilter(); 32800 toggleMenusSubcats(categoriesDisplay); 32801 scrollToCat(); 32802 filterMenuType(); 32803 } 32804}; 32805const initLocationsDropdown = ()=>{ 32806 const locationsDropdown = document.getElementById('menu_location'); 32807 const locationFilter = GetURLParameter('menu-location'); 32808 if (locationFilter) for(let i = 0; i < locationsDropdown.length; i++){ 32809 const locationName = locationsDropdown[i].getAttribute('data-location'); 32810 if (locationFilter === locationName) { 32811 // Set as seleted 32812 locationsDropdown[i].setAttribute('selected', ''); 32813 // Load the filtered locations menu 32814 let loadingIcon = document.querySelector('.js-menu-loading'); 32815 let locationId = locationsDropdown[i].value; 32816 menuLocation(loadingIcon, locationId); 32817 } 32818 } 32819 if (locationsDropdown) { 32820 let choicesConfig = { 32821 itemSelectText: '', 32822 shouldSort: false, 32823 searchEnabled: false 32824 }; 32825 const locationChoices = new (0, _choicesJsDefault.default)(locationsDropdown, choicesConfig); 32826 } 32827}; 32828const GetURLParameter = (sParam)=>{ 32829 var sPageURL = window.location.search.substring(1); 32830 var sURLVariables = sPageURL.split('&'); 32831 for(var i = 0; i < sURLVariables.length; i++){ 32832 var sParameterName = sURLVariables[i].split('='); 32833 if (sParameterName[0] == sParam) return sParameterName[1]; 32834 } 32835}; 32836const mobileDietaryFilterToggle = ()=>{ 32837 let dietaryFilterToggle = document.querySelector('.js-mobile-filter-toggle'); 32838 if (dietaryFilterToggle) dietaryFilterToggle.addEventListener('click', (e)=>{ 32839 const dietaryFilterContainer = document.querySelector('.js-dietary-filter-container'); 32840 if (dietaryFilterContainer) dietaryFilterContainer.classList.toggle('show'); 32841 }); 32842}; 32843const menuFilter = ()=>{ 32844 const menuModules = document.querySelectorAll('.menu.module');
32845 if (menuModules.length) menuModules.forEach((menuModule)=>{ 32846 let menuItemsContainer = menuModule.querySelector('.menu__items-container'); 32847 let menuFilters = menuModule.querySelector('.menu__filters'); 32848 let menuFilterPanel = menuModule.querySelector('.menu__filter-panel'); 32849 let menuFilterOffset = menuFilters.offsetTop; 32850 let menuCustomHeaderOffset = menuModule.dataset.customOffset; 32851 let scrollTop = 0; 32852 document.querySelectorAll('.menu-subcat').forEach((menuSubcat)=>{ 32853 let menuSubcatScroll = menuSubcat.getAttribute('data-subcat-scroll'); 32854 let menuSubcatOffset = menuSubcat.offsetTop; 32855 if (scrollTop > menuSubcatOffset) { 32856 document.querySelectorAll('.menu__filter-menu-cats li').forEach((filterMenuCats)=>{ 32857 filterMenuCats.classList.remove('active'); 32858 }); 32859 document.querySelectorAll('[data-menu-subcat="' + menuSubcatScroll + '"]').forEach((menuSubcats)=>{ 32860 menuSubcats.classList.add('active'); 32861 }); 32862 } 32863 }); 32864 document.querySelectorAll('.js-open-menu-filter').forEach((openFilter)=>{ 32865 openFilter.addEventListener('click', (e)=>{ 32866 e.preventDefault(); 32867 const menuFilterPanel = document.querySelector('.menu__filter-panel'); 32868 const body = document.querySelector('body'); 32869 document.querySelector('.menu__filter-panel').classList.add('is-active'); 32870 document.querySelector('.menu__filter-panel__overlay').classList.add('is-active'); 32871 }); 32872 }); 32873 document.querySelectorAll('.js-close-menu-filter').forEach((openFilter)=>{ 32874 openFilter.addEventListener('click', (e)=>{ 32875 e.preventDefault(); 32876 const menuFilterPanel = document.querySelector('.menu__filter-panel'); 32877 const body = document.querySelector('body'); 32878 document.querySelector('.menu__filter-panel').classList.remove('is-active'); 32879 document.querySelector('.menu__filter-panel__overlay').classList.remove('is-active'); 32880 }); 32881 }); 32882 // Menu location change 32883 const menuLocationSelect = document.querySelector('#menu_location'); 32884 menuLocationSelect.addEventListener('change', (event1)=>{ 32885 event1.preventDefault(); 32886 let loadingIcon = document.querySelector('.js-menu-loading'), locationId = event1.target.value; 32887 menuLocation(loadingIcon, locationId); 32888 }); 32889 const allergenFilters = document.querySelectorAll('input[name="allergens_filter"]'); 32890 allergenFilters.forEach((allergenFilter)=>{ 32891 allergenFilter.addEventListener('change', (event1)=>{ 32892 event1.preventDefault(); 32893 filterMenuItemsByDietaryRequirement(); 32894 }); 32895 }); 32896 /* let location = GetURLParameter('location-id'); 32897 32898 if (location) { 32899 const loadingIcon = document.querySelector('.js-menu-loading'); 32900 32901 menuLocationSelect.value(location).selectric('refresh'); 32902 32903 menuLocation(loadingIcon, location); 32904 } */ }); 32905}; 32906menuFilter(); 32907function filterMenuItemsByDietaryRequirement() { 32908 const allergenFilters = document.querySelectorAll('input[name="allergens_filter"]'); 32909 let filterChecked = 0; 32910 allergenFilters.forEach((allergenFilter)=>{ 32911 if (allergenFilter.checked) { 32912 allergenFilter.parentElement.classList.add('active'); 32913 filterChecked++; 32914 document.querySelectorAll('.menu-cat .menu-item').forEach((menuItems)=>{ 32915 menuItems.classList.remove('hidden'); 32916 if (menuItems.classList.contains(allergenFilter.value)) ; 32917 else menuItems.classList.add('hidden'); 32918 }); 32919 document.querySelectorAll('.menu-subcat').forEach((menuSubcat)=>{ 32920 menuSubcat.classList.remove('hidden'); 32921 if (menuSubcat.classList.contains(allergenFilter.value)) ; 32922 else menuSubcat.classList.add('hidden'); 32923 }); 32924 } else allergenFilter.parentElement.classList.remove('active'); 32925 if (filterChecked == 0) { 32926 document.querySelectorAll('.menu-cat .menu-item').forEach((menuItems)=>{ 32927 menuItems.classList.remove('hidden'); 32928 }); 32929 document.querySelectorAll('.menu-subcat').forEach((menuSubcat)=>{ 32930 menuSubcat.classList.remove('hidden'); 32931 }); 32932 } 32933 }); 32934} 32935const getOffsetTop = (element)=>{ 32936 let offsetTop = 0; 32937 while(element){ 32938 offsetTop += element.offsetTop; 32939 element = element.offsetParent; 32940 } 32941 return offsetTop; 32942}; 32943const toggleMenusSubcats = (categoriesDisplay)=>{ 32944 const triggers = document.querySelectorAll('.js-menu-filter-subcats-toggle'); 32945 const menusContainer = document.querySelector('.js-menu-category-container'); 32946 const filterPanel = document.querySelector('.menu__filter-panel');
32947 if (triggers) triggers.forEach((trigger)=>{ 32948 trigger.addEventListener('click', (e)=>{ 32949 e.preventDefault(); 32950 const isMobile = filterPanel.classList.contains('is-active'); 32951 if (categoriesDisplay === 'one') { 32952 if (trigger.getAttribute('data-menu-id') === menusContainer.getAttribute('data-menu-id') || isMobile && trigger.classList.contains('js-menu-filter-subcats-toggle--has-subcategories')) toggleSubcatsDisplay(trigger); 32953 else { 32954 removeActiveSubcatsClass(triggers); 32955 // Update menusContainer data-menu-id attribute 32956 menusContainer.setAttribute('data-menu-id', trigger.getAttribute('data-menu-id')); 32957 const loadingIcon = document.querySelector('.js-menu-category-loading'); 32958 // Fade out the current menu items 32959 menusContainer.classList.add('fade-out'); 32960 setTimeout(()=>{ 32961 // Scroll back to top of new menu 32962 scrollToMenuTop(); 32963 // Show the loading icon 32964 loadingIcon.classList.add('is-active'); 32965 //Close the popup 32966 if (isMobile) { 32967 filterPanel.classList.remove('is-active'); 32968 document.querySelector('.menu__filter-panel__overlay').classList.remove('is-active'); 32969 } 32970 }, 400); 32971 setTimeout(()=>{ 32972 // Load in clicked on menu items via ajax 32973 const getFetchData = ()=>{ 32974 const formData = new FormData(); 32975 formData.append('location_id', document.getElementById('menu_location').value); 32976 formData.append('menu_id', trigger.getAttribute('data-menu-id')); 32977 formData.append('action', 'create_menu_category_ajax'); 32978 const ajaxData = new URLSearchParams(formData); 32979 return ajaxData; 32980 }; 32981 const data = getFetchData(); 32982 fetch(window.igMenusAjaxUrl, { 32983 method: 'POST', 32984 credentials: 'same-origin', 32985 headers: { 32986 'Content-Type': 'application/x-www-form-urlencoded', 32987 'Cache-Control': 'no-cache' 32988 }, 32989 body: data 32990 }).then((response)=>response.text()).then((data)=>{ 32991 menusContainer.innerHTML = data; 32992 loadingIcon.classList.remove('is-active'); 32993 // Re-run the dietary requirements filter functionality 32994 filterMenuItemsByDietaryRequirement(); 32995 // Fade In new menu items 32996 menusContainer.classList.remove('fade-out'); 32997 // Show menu sub categories when not on mobile 32998 if (!isMobile) { 32999 if (trigger.nextElementSibling) trigger.nextElementSibling.classList.add('active'); 33000 } 33001 }).catch((error)=>{ 33002 loadingIcon.classList.remove('is-active'); 33003 console.error(error); 33004 }); 33005 }, 425); 33006 // Trigger the active menu class 33007 trigger.classList.add('active'); 33008 } 33009 } else toggleSubcatsDisplay(trigger); 33010 }); 33011 }); 33012}; 33013function toggleSubcatsDisplay(trigger) { 33014 // Trigger the active menu class 33015 trigger.classList.toggle('active'); 33016 // Show menu sub categories 33017 if (trigger.nextElementSibling) trigger.nextElementSibling.classList.toggle('active'); 33018} 33019function removeActiveSubcatsClass(triggers) {
33020 triggers.forEach((trigger)=>{ 33021 trigger.classList.remove('active'); 33022 if (trigger.nextElementSibling) { 33023 trigger.nextElementSibling.classList.remove('active'); 33024 const subCats = trigger.nextElementSibling.querySelectorAll('.menu__filter-menu-cat'); 33025 if (subCats) subCats.forEach((cat)=>{ 33026 cat.classList.remove('active'); 33027 }); 33028 } 33029 }); 33030} 33031const scrollToCat = ()=>{ 33032 const triggers = document.querySelectorAll('.js-menu-filter-subcats-toggle'); 33033 const menuFilterCats = document.querySelectorAll('.menu__filter-menu-cats .menu__filter-menu-cat'); 33034 const menusContainer = document.querySelector('.js-menu-category-container'); 33035 const filterPanel = document.querySelector('.menu__filter-panel'); 33036 menuFilterCats.forEach((menuFilterCat)=>{ 33037 menuFilterCat.addEventListener('click', (e)=>{ 33038 e.preventDefault(); 33039 const isMobile = filterPanel.classList.contains('is-active'); 33040 const subCat = e.currentTarget.getAttribute('data-menu-subcat'); 33041 menuFilterCats.forEach((filterCats)=>{ 33042 filterCats.classList.remove('active'); 33043 }); 33044 e.currentTarget.classList.add('active'); 33045 // If on mobile check if menu needs to be loaded in first 33046 if (isMobile) { 33047 const menuID = menuFilterCat.getAttribute('data-menu-id'); 33048 if (menuID != menusContainer.getAttribute('data-menu-id')) { 33049 removeActiveSubcatsClass(triggers); 33050 const trigger = document.querySelector('.js-menu-filter-subcats-toggle[data-menu-id="' + menuID + '"]'); 33051 toggleSubcatsDisplay(trigger); 33052 // Update menusContainer data-menu-id attribute 33053 menusContainer.setAttribute('data-menu-id', menuID); 33054 const loadingIcon = document.querySelector('.js-menu-category-loading'); 33055 // Fade out the current menu items 33056 menusContainer.classList.add('fade-out'); 33057 // Show the loading icon 33058 loadingIcon.classList.add('is-active'); 33059 setTimeout(()=>{ 33060 //Close the popup 33061 filterPanel.classList.remove('is-active'); 33062 document.querySelector('.menu__filter-panel__overlay').classList.remove('is-active'); 33063 }, 400); 33064 setTimeout(()=>{ 33065 // Load in clicked on menu items via ajax 33066 const getFetchData = ()=>{ 33067 const formData = new FormData(); 33068 formData.append('location_id', document.getElementById('menu_location').value); 33069 formData.append('menu_id', menuID); 33070 formData.append('action', 'create_menu_category_ajax'); 33071 const ajaxData = new URLSearchParams(formData); 33072 return ajaxData; 33073 }; 33074 const data = getFetchData(); 33075 fetch(window.igMenusAjaxUrl, { 33076 method: 'POST', 33077 credentials: 'same-origin', 33078 headers: { 33079 'Content-Type': 'application/x-www-form-urlencoded', 33080 'Cache-Control': 'no-cache' 33081 }, 33082 body: data 33083 }).then((response)=>response.text()).then((data)=>{ 33084 menusContainer.innerHTML = data; 33085 loadingIcon.classList.remove('is-active'); 33086 // Re-run the dietary requirements filter functionality 33087 filterMenuItemsByDietaryRequirement(); 33088 // Fade In new menu items 33089 menusContainer.classList.remove('fade-out'); 33090 }).then((data)=>{ 33091 window.scrollTo({ 33092 top: getSubcatTopPos(subCat), 33093 behavior: 'smooth' 33094 }); 33095 }).catch((error)=>{ 33096 loadingIcon.classList.remove('is-active'); 33097 console.error(error); 33098 }); 33099 }, 425); 33100 } else { 33101 filterPanel.classList.remove('is-active'); 33102 document.querySelector('.menu__filter-panel__overlay').classList.remove('is-active'); 33103 window.scrollTo({ 33104 top: getSubcatTopPos(subCat), 33105 behavior: 'smooth' 33106 }); 33107 } 33108 } else window.scrollTo({ 33109 top: getSubcatTopPos(subCat), 33110 behavior: 'smooth' 33111 }); 33112 }); 33113 }); 33114}; 33115function getSubcatTopPos(subCat) { 33116 const menuFilters = document.querySelector('.menu__filters'); 33117 let menuFiltersStyles = window.getComputedStyle(menuFilters); 33118 let menuFiltersmargin = parseFloat(menuFiltersStyles['marginTop']) + parseFloat(menuFiltersStyles['marginBottom']);
33119 let menuFiltersHeight = Math.ceil(menuFilters.offsetHeight + menuFiltersmargin); 33120 const subCatItems = document.querySelector('[data-subcat-scroll="' + subCat + '"]'); 33121 const subCatItemsOffset = getOffsetTop(subCatItems) - menuFiltersHeight - 75; 33122 return subCatItemsOffset; 33123} 33124scrollToCat(); 33125const scrollToMenuTop = ()=>{ 33126 const menuFilters = document.querySelector('.menu__filters'); 33127 let menuFiltersStyles = window.getComputedStyle(menuFilters); 33128 let menuFiltersmargin = parseFloat(menuFiltersStyles['marginTop']) + parseFloat(menuFiltersStyles['marginBottom']); 33129 let menuFiltersHeight = Math.ceil(menuFilters.offsetHeight + menuFiltersmargin); 33130 let headerHeight = Math.ceil(document.querySelector('.header').offsetHeight); 33131 menuFiltersHeight = menuFiltersHeight + headerHeight; 33132 const menuItems = document.querySelector('.menu__items'); 33133 const menuItemsOffset = menuItems.getBoundingClientRect().top + window.scrollY; 33134 const scrollToMenu = menuItemsOffset - menuFiltersHeight; 33135 window.scrollTo({ 33136 top: scrollToMenu, 33137 behavior: 'instant' 33138 }); 33139}; 33140const filterMenuType = ()=>{ 33141 const menuFilterOptions = document.querySelectorAll('.menu__filter-panel .js-menu-filter-option'); 33142 let loadingIcon = document.querySelector('.js-menu-loading'); 33143 menuFilterOptions.forEach((menuFilterOption)=>{ 33144 menuFilterOption.addEventListener('click', (e)=>{ 33145 const filterPanel = document.querySelector('.menu__filter-panel'); 33146 if (filterPanel.classList.contains('is-active')) { 33147 filterPanel.classList.remove('is-active'); 33148 document.querySelector('.menu__filter-panel__overlay').classList.remove('is-active'); 33149 } 33150 const menuFilterOptionsActive = document.querySelectorAll('.menu__filter-panel .js-menu-filter-option.active'); 33151 menuFilterOptionsActive.forEach((filterOption)=>{ 33152 filterOption.classList.remove('active'); 33153 let filterContainerClose = document.getElementById(filterOption.dataset.container); 33154 filterContainerClose.style.height = '0px'; 33155 setTimeout(function() { 33156 filterContainerClose.classList.remove('active'); 33157 }, 500); 33158 }); 33159 e.currentTarget.classList.add('active'); 33160 let filterContainer = document.getElementById(e.currentTarget.dataset.container); 33161 filterContainer.classList.add('active'); 33162 filterContainer.style.height = 'auto'; 33163 let height = filterContainer.clientHeight + 'px'; 33164 filterContainer.style.height = height; 33165 filterContainer.style.height = '0px'; 33166 setTimeout(function() { 33167 filterContainer.style.height = height; 33168 }, 0); 33169 const container = document.querySelector('.js-menu-category-container'), loadingIcon = document.querySelector('.js-menu-category-loading'), menuCatTitle = event.currentTarget.getAttribute('data-menu-cat'); 33170 const getFetchData = ()=>{ 33171 const formData = new FormData(); 33172 formData.append('location_id', document.getElementById('menu_location').value); 33173 formData.append('menu_id', container.getAttribute('data-menu-id')); 33174 formData.append('cat_title', menuCatTitle); 33175 formData.append('action', 'create_menu_category_ajax'); 33176 const ajaxData = new URLSearchParams(formData); 33177 return ajaxData; 33178 }; 33179 const data = getFetchData(); 33180 fetch(window.igMenusAjaxUrl, { 33181 method: 'POST', 33182 credentials: 'same-origin', 33183 headers: { 33184 'Content-Type': 'application/x-www-form-urlencoded', 33185 'Cache-Control': 'no-cache' 33186 }, 33187 body: data 33188 }).then((response)=>response.text()).then((data)=>{ 33189 container.innerHTML = data; 33190 loadingIcon.classList.remove('is-active'); 33191 scrollToMenuTop(); 33192 }).catch((error)=>{ 33193 loadingIcon.classList.remove('is-active'); 33194 console.error(error); 33195 }); 33196 }); 33197 }); 33198}; 33199filterMenuType(); 33200const menuLocation = (loadingIcon, locationId)=>{ 33201 const categoriesDisplay = document.querySelector('.m__menus .menu').getAttribute('data-categories-display'); 33202 const filterFormData = new FormData(); 33203 filterFormData.append('id', locationId); 33204 filterFormData.append('categories_display', categoriesDisplay); 33205 filterFormData.append('action', 'get_menu_filters'); 33206 const filterData = new URLSearchParams(filterFormData); 33207 const filterPanelcontainer = document.querySelector('.menu__filter-panel .menu__filter-menu
33207-cats'); 33208 loadingIcon.classList.add('is-active'); 33209 document.querySelector('.js-menu-items-container').classList.add('loading'); 33210 fetch(window.igMenusAjaxUrl, { 33211 method: 'POST', 33212 credentials: 'same-origin', 33213 headers: { 33214 'Content-Type': 'application/x-www-form-urlencoded', 33215 'Cache-Control': 'no-cache' 33216 }, 33217 body: filterData 33218 }).then((response)=>response.text()).then((data)=>{ 33219 filterPanelcontainer.innerHTML = data; 33220 scrollToCat(); 33221 filterMenuType(); 33222 toggleMenusSubcats(categoriesDisplay); 33223 }).catch((error)=>{ 33224 loadingIcon.classList.remove('is-active'); 33225 document.querySelector('.js-menu-items-container').classList.remove('loading'); 33226 console.error(error); 33227 }); 33228 // Then gather menu data 33229 const menuFormData = new FormData(); 33230 menuFormData.append('id', locationId); 33231 menuFormData.append('categories_display', categoriesDisplay); 33232 menuFormData.append('action', 'get_menu_items'); 33233 const menuData = new URLSearchParams(menuFormData); 33234 const menuCategorycontainer = document.querySelector('.js-menu-category-container'); 33235 fetch(window.igMenusAjaxUrl, { 33236 method: 'POST', 33237 credentials: 'same-origin', 33238 headers: { 33239 'Content-Type': 'application/x-www-form-urlencoded', 33240 'Cache-Control': 'no-cache' 33241 }, 33242 body: menuData 33243 }).then((response)=>response.text()).then((data)=>{ 33244 menuCategorycontainer.innerHTML = data; 33245 // Update container data-menu-id attribute with the first menu id so that the ajax works properly after a new menu has been loaded in 33246 const newFirstMenuID = document.querySelector('.js-menu-filter-subcats-toggle').getAttribute('data-menu-id'); 33247 menuCategorycontainer.setAttribute('data-menu-id', newFirstMenuID); 33248 loadingIcon.classList.remove('is-active'); 33249 document.querySelector('.js-menu-items-container').classList.remove('loading'); 33250 scrollToMenuTop(); 33251 }).catch((error)=>{ 33252 loadingIcon.classList.remove('is-active'); 33253 document.querySelector('.js-menu-items-container').classList.remove('loading'); 33254 console.error(error); 33255 }); 33256}; 33257 33258},{"choices.js":"cVxV3","../../../../node_modules/choices.js/public/assets/styles/choices.css":"eN4G5","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"eN4G5":[function() {},{}],"bFutZ":[function(require,module,exports,__globalThis) { 33259var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 33260var _validator = require("validator"); 33261var _validatorDefault = parcelHelpers.interopDefault(_validator); 33262const newsletterModules = document.querySelectorAll('.m__newsletter'); 33263if (newsletterModules) newsletterModules.forEach((mod)=>{ 33264 const newsletterSignupForm = mod.querySelector('.js-newsletter__form'); 33265 if (newsletterSignupForm) newsletterSignupForm.addEventListener('submit', (e)=>{ 33266 e.preventDefault(); 33267 newsletterSignupForm.classList.add('submitting'); 33268 setTimeout(()=>{ 33269 newsletterSignupForm.classList.add('hidden'); 33270 }, 400); 33271 grecaptcha.ready(function() { 33272 grecaptcha.execute(igniteRecaptchaKey, { 33273 action: 'newsletterSignup' 33274 }).then(function(token) { 33275 let formData = new FormData(newsletterSignupForm); 33276 let isFormValid = true; 33277 //Reset any errors 33278 for (var [key, value] of formData.entries())if (key != 'locations' && key != 'events') { 33279 let inputToCheck = document.querySelector('#' + key); 33280 if (inputToCheck.required) inputToCheck.classList.remove('error'); 33281 } 33282 //Check for any required fields left blank 33283 for (var [key, value] of formData.entries()){ 33284 const inputToCheck = document.querySelector('#' + key); 33285 if (!value || value == '' || value == '#') { 33286 if (inputToCheck.required) { 33287 isFormValid = false;
33288 inputToCheck.classList.add('error'); 33289 if (key == 'BrandID') alert('Please select a location'); 33290 } 33291 } else { 33292 if (inputToCheck.type == 'email') { 33293 if (!(0, _validatorDefault.default).isEmail(value)) { 33294 isFormValid = false; 33295 inputToCheck.classList.add('error'); 33296 } 33297 } else if (inputToCheck.type == 'text') { 33298 if (!(0, _validatorDefault.default).isAlphanumeric(value)) { 33299 isFormValid = false; 33300 inputToCheck.classList.add('error'); 33301 } 33302 } 33303 } 33304 } 33305 //Pass through the recaptcha token 33306 formData.append('recaptcha', token); 33307 if (isFormValid) fetch(igniteAjax.ajaxurl, { 33308 method: 'POST', 33309 body: formData 33310 }).then((response)=>response.json()).then((data)=>{ 33311 if (data.ResponseStatus) mod.querySelector('.m__newsletter__success').classList.remove('hidden'); 33312 else mod.querySelector('.m__newsletter__fail').classList.remove('hidden'); 33313 }).catch((error)=>{ 33314 mod.querySelector('.m__newsletter__fail').classList.remove('hidden'); 33315 }); 33316 }); 33317 }); 33318 }); 33319}); 33320const newsletterSubmitButton = document.querySelector('.js-signup'); 33321const newsletterSignupForm = document.querySelector('#newsletter-signup-form'); 33322const newsletterThankyou = document.querySelector('#js-newsletter-thankyou'); 33323const popup = document.querySelector('.popup#newsletter'); 33324if (newsletterSubmitButton && newsletterSignupForm) newsletterSignupForm.addEventListener('submit', (event)=>{ 33325 event.preventDefault(); 33326 newsletterSignupForm.classList.add('submitting'); 33327 grecaptcha.ready(function() { 33328 grecaptcha.execute(igniteRecaptchaKey, { 33329 action: 'newsletterSignupForm' 33330 }).then(function(token) { 33331 const formData = new FormData(newsletterSignupForm); 33332 let isFormValid = true; 33333 //Reset any errors 33334 for (var [key, value] of formData.entries())if (key != 'locations' && key != 'events') { 33335 const inputToCheck = document.querySelector('#' + key); 33336 if (inputToCheck.required) inputToCheck.classList.remove('error'); 33337 } 33338 //Check for any required fields left blank 33339 for (var [key, value] of formData.entries()){ 33340 const inputToCheck = document.querySelector('#' + key); 33341 if (!value || value == '' || value == '#') { 33342 if (inputToCheck.required) { 33343 isFormValid = false; 33344 inputToCheck.classList.add('error'); 33345 if (key == 'BrandID') alert('Please select a location'); 33346 } 33347 } else { 33348 if (inputToCheck.type == 'email') { 33349 if (!(0, _validatorDefault.default).isEmail(value)) { 33350 isFormValid = false; 33351 inputToCheck.classList.add('error'); 33352 } 33353 } else if (inputToCheck.type == 'text') { 33354 if (!(0, _validatorDefault.default).isAlphanumeric(value)) { 33355 isFormValid = false; 33356 inputToCheck.classList.add('error'); 33357 } 33358 } 33359 } 33360 } 33361 //Pass through the recaptcha token 33362 formData.append('recaptcha', token); 33363 if (isFormValid) fetch(igniteAjax.ajaxurl, { 33364 method: 'POST', 33365 body: formData 33366 }).then((response)=>response.json()).then((data)=>{ 33367 newsletterSignupForm.classList.remove('submitting'); 33368 if (data.ResponseStatus) { 33369 popup.querySelector('.popup__title').classList.add('hidden'); 33370 newsletterSignupForm.classList.add('hidden'); 33371 newsletterThankyou.classList.remove('hidden'); 33372 } else { 33373 newsletterSignupForm.classList.remove('hidden'); 33374 newsletterThankyou.classList.add('hidden'); 33375 } 33376 }).catch((error)=>{ 33377 console.error(error); 33378 newsletterSignupForm.classList.remove('submitting'); 33379 }); 33380 }); 33381 }); 33382}); 33383 33384},{"validator":"h72Oj","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"h72Oj":[function(require,module,exports,__globalThis) { 33385"use strict"; 33386function _typeof(o) { 33387 "@babel/helpers - typeof"; 33388 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { 33389 return typeof o; 33390 } : function(o) { 33391 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 33392 }, _typeof(o); 33393} 33394Object.defineProperty(exports, "__esModule", { 33395 value: true 33396}); 33397exports.default = void 0; 33398var _toDate = _interopRequireDefault(require("b10fe806c1d95257")); 33399var _toFloat = _interopRequireDefault(require("904819e5ea643bef")); 33400var _toInt = _interopRequireDefault(require("22c9d1505c2d1fc3"));
33401var _toBoolean = _interopRequireDefault(require("e0a5af27c12b2c5e")); 33402var _equals = _interopRequireDefault(require("df6a0b6bd84e19b4")); 33403var _contains = _interopRequireDefault(require("e2f527afb12190b0")); 33404var _matches = _interopRequireDefault(require("d7cf83c49d7fa32f")); 33405var _isEmail = _interopRequireDefault(require("73acc2ba6f501a7f")); 33406var _isURL = _interopRequireDefault(require("7cc96999cdc491f6")); 33407var _isMACAddress = _interopRequireDefault(require("91309703df115c6")); 33408var _isIP = _interopRequireDefault(require("8d2f5af297d16217")); 33409var _isIPRange = _interopRequireDefault(require("6e4eace52f632262")); 33410var _isFQDN = _interopRequireDefault(require("1219b49fc6cacab9")); 33411var _isDate = _interopRequireDefault(require("befc3dab9b151a88")); 33412var _isTime = _interopRequireDefault(require("ec526ea97a56e412")); 33413var _isBoolean = _interopRequireDefault(require("a3a022398582f68")); 33414var _isLocale = _interopRequireDefault(require("8e765fdc6039f514")); 33415var _isAbaRouting = _interopRequireDefault(require("d61bbfe7e2e66c71")); 33416var _isAlpha = _interopRequireWildcard(require("752765732ee21c04")); 33417var _isAlphanumeric = _interopRequireWildcard(require("939913da4be78270")); 33418var _isNumeric = _interopRequireDefault(require("b32016933f0604cd")); 33419var _isPassportNumber = _interopRequireWildcard(require("f24514c574ef5174")); 33420var _isPort = _interopRequireDefault(require("a3b9b492f47016b1")); 33421var _isLowercase = _interopRequireDefault(require("8ca5f357d13579ae")); 33422var _isUppercase = _interopRequireDefault(require("57290c395d90e9e1")); 33423var _isIMEI = _interopRequireDefault(require("2b3e24162ae2fcc4")); 33424var _isAscii = _interopRequireDefault(require("6af1ce2eb4cb2855")); 33425var _isFullWidth = _interopRequireDefault(require("a47be535f6075d89")); 33426var _isHalfWidth = _interopRequireDefault(require("eef79b677b4d3a47")); 33427var _isVariableWidth = _interopRequireDefault(require("34b89671f36a7e6c")); 33428var _isMultibyte = _interopRequireDefault(require("8c10c7728b073c57")); 33429var _isSemVer = _interopRequireDefault(require("f81e871eee57051f")); 33430var _isSurrogatePair = _interopRequireDefault(require("1b903d3ad0f8db90")); 33431var _isInt = _interopRequireDefault(require("20afde36edb727c0")); 33432var _isFloat = _interopRequireWildcard(require("26779d512565dc66")); 33433var _isDecimal = _interopRequireDefault(require("df62e7a0ab08fe5c")); 33434var _isHexadecimal = _interopRequireDefault(require("e09b4815b82a6fa5")); 33435var _isOctal = _interopRequireDefault(require("db9c20ed62cf8b83")); 33436var _isDivisibleBy = _interopRequireDefault(require("ea2557066cb998fd")); 33437var _isHexColor = _interopRequireDefault(require("f2e98624db0f1d3a")); 33438var _isRgbColor = _interopRequireDefault(require("1ac5e66aef101809")); 33439var _isHSL = _interopRequireDefault(require("d63b18a1ffb2f873")); 33440var _isISRC = _interopRequireDefault(require("b761b41c2a22a4c")); 33441var _isIBAN = _interopRequireWildcard(require("1474925e6c78b080")); 33442var _isBIC = _interopRequireDefault(require("5f702bfdeaac1ce7")); 33443var _isMD = _interopRequireDefault(require("94155f1dd48161aa")); 33444var _isHash = _interopRequireDefault(require("136460343d65b33b")); 33445var _isJWT = _interopRequireDefault(require("c84165da89e1d7dc")); 33446var _isJSON = _interopRequireDefault(require("4b2533eb7fa4f841")); 33447var _isEmpty = _interopRequireDefault(require("61b139f71e9bf24a")); 33448var _isLength = _interopRequireDefault(require("f14362267ed484f3")); 33449var _isByteLength = _interopRequireDefault(require("d2e7ce5d1a66c2af")); 33450var _isULID = _interopRequireDefault(require("595ce509b1afc12e")); 33451var _isUUID = _interopRequireDefault(require("e04856beee56d70")); 33452var _isMongoId = _interopRequireDefault(require("8582f245235fd570")); 33453var _isAfter = _interopRequireDefault(require("38440f282a879a28")); 33454var _isBefore = _interopRequireDefault(require("b530a3c08a2c51b8")); 33455var _isIn = _interopRequireDefault(require("72a50fd794aa3073")); 33456var _isLuhnNumber = _interopRequireDefault(require("47ff8310016d83ea")); 33457var _isCreditCard = _interopRequireDefault(require("ba1ceeca74a3e817")); 33458var _isIdentityCard = _interopRequireDefault(require("858463bab92c710f")); 33459var _isEAN = _interopRequireDefault(require("f68159fe837e362b")); 33460var _isISIN = _interopRequireDefault(require("7dbda028ea6b742d")); 33461var _isISBN = _interopRequireDefault(require("7c94026d50601268")); 33462var _isISSN = _interopRequireDefault(require("71e63739b51dba75")); 33463var _isTaxID = _interopRequireDefault(require("ab77331adcaaf0d6")); 33464var _isMobilePhone = _interopRequireWildcard(require("2313c49333962ef0")); 33465var _isEthereumAddress = _interopRequireDefault(require("1ea0c275d18ce3e5")); 33466var _isCurrency = _interopRequireDefault(require("de6a83eab060bec5")); 33467var _isBtcAddress = _interopRequireDefault(require("ab08ca66d9afd375")); 33468var _isISO = require("c4e797f261d4103c"); 33469var _isISO2 = _interopRequireDefault(require("57ddbfb43a466c6c")); 33470var _isISO3 = _interopRequireDefault(require("b9e0ef98f72ec644")); 33471var _isRFC = _interopRequireDefault(require("704555bc8cf425e5")); 33472var _isISO4 = _interopRequireDefault(require("41af2e43d6f75ccf")); 33473var _isISO31661Alpha = _interopRequireDefault(require("a4ed258f67afd89a")); 33474var _isISO31661Alpha2 = _interopRequireDefault(require("2ca72dbaf0f6b784")); 33475var _isISO31661Numeric = _interopRequireDefault(require("7b24277644928452")); 33476var _isISO5 = _interopRequireDefault(require("c4b0f529774f4dee")); 33477var _isBase = _interopRequireDefault(require("3e794622f61caa75")); 33478var _isBase2 = _interopRequireDefault(require("43c060b0c5b6666c")); 33479var _isBase3 = _interopRequireDefault(require("7e6b000c25e65107")); 33480var _isDataURI = _interopRequireDefault(require("e9ea15b8d1ad7666")); 33481var _isMagnetURI = _interopRequireDefault(require("63f9ca5884eaf1a9")); 33482var _isMailtoURI = _interopRequireDefault(require("adb3f66c462bf2e9")); 33483var _isMimeType = _interopRequireDefault(require("ead2e0dae8858eb6")); 33484var _isLatLong = _interopRequireDefault(require("943c68afc1f5e3fb")); 33485var _isPostalCode = _interopRequireWildcard(require("337fc01d18b5d9a1")); 33486var _ltrim = _interopRequireDefault(require("8e8b3ff8c8b3be15")); 33487var _rtrim = _interopRequireDefault(require("2262c3ab640e83e1")); 33488var _trim = _interopRequireDefault(require("4ed20b257cccd153")); 33489var _escape = _interopRequireDefault(require("ac5bde86531aa937")); 33490var _unescape = _interopRequireDefault(require("2cfb4a825383e754")); 33491var _stripLow = _interopRequireDefault(require("2e66e0b0ad386340")); 33492var _whitelist = _interopRequireDefault(require("8984f13126c4be3d")); 33493var _blacklist = _interopRequireDefault(require("a5ed790bd0c52ebc")); 33494var _isWhitelisted = _interopRequireDefault(require("27fe339771c0d202")); 33495var _normalizeEmail = _interopRequireDefault(require("f0de5432f43d6408")); 33496var _isSlug = _interopRequireDefault(require("cc7c18b6c6bfc763")); 33497var _isLicensePlate = _interopRequireDefault(require("cf2ac5417f4a7f77")); 33498var _isStrongPassword = _interopRequireDefault(require("1f8b1a814d1f08cd")); 33499var _isVAT = _interopRequireDefault(require("b2c0124f6355fe4f")); 33500function _interopRequireWildcard(e, t) { 33501 if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); 33502 return (_interopRequireWildcard = function _interopRequireWildcard(e, t) {
33503 if (!t && e && e.__esModule) return e; 33504 var o, i, f = { 33505 __proto__: null, 33506 default: e 33507 }; 33508 if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; 33509 if (o = t ? n : r) { 33510 if (o.has(e)) return o.get(e); 33511 o.set(e, f); 33512 } 33513 for(var _t in e)"default" !== _t && ({}).hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); 33514 return f; 33515 })(e, t); 33516} 33517function _interopRequireDefault(e) { 33518 return e && e.__esModule ? e : { 33519 default: e 33520 }; 33521} 33522var version = '13.15.15'; 33523var validator = { 33524 version: version, 33525 toDate: _toDate.default, 33526 toFloat: _toFloat.default, 33527 toInt: _toInt.default, 33528 toBoolean: _toBoolean.default, 33529 equals: _equals.default, 33530 contains: _contains.default, 33531 matches: _matches.default, 33532 isEmail: _isEmail.default, 33533 isURL: _isURL.default, 33534 isMACAddress: _isMACAddress.default, 33535 isIP: _isIP.default, 33536 isIPRange: _isIPRange.default, 33537 isFQDN: _isFQDN.default, 33538 isBoolean: _isBoolean.default, 33539 isIBAN: _isIBAN.default, 33540 isBIC: _isBIC.default, 33541 isAbaRouting: _isAbaRouting.default, 33542 isAlpha: _isAlpha.default, 33543 isAlphaLocales: _isAlpha.locales, 33544 isAlphanumeric: _isAlphanumeric.default, 33545 isAlphanumericLocales: _isAlphanumeric.locales, 33546 isNumeric: _isNumeric.default, 33547 isPassportNumber: _isPassportNumber.default, 33548 passportNumberLocales: _isPassportNumber.locales, 33549 isPort: _isPort.default, 33550 isLowercase: _isLowercase.default, 33551 isUppercase: _isUppercase.default, 33552 isAscii: _isAscii.default, 33553 isFullWidth: _isFullWidth.default, 33554 isHalfWidth: _isHalfWidth.default, 33555 isVariableWidth: _isVariableWidth.default, 33556 isMultibyte: _isMultibyte.default, 33557 isSemVer: _isSemVer.default, 33558 isSurrogatePair: _isSurrogatePair.default, 33559 isInt: _isInt.default, 33560 isIMEI: _isIMEI.default, 33561 isFloat: _isFloat.default, 33562 isFloatLocales: _isFloat.locales, 33563 isDecimal: _isDecimal.default, 33564 isHexadecimal: _isHexadecimal.default, 33565 isOctal: _isOctal.default, 33566 isDivisibleBy: _isDivisibleBy.default, 33567 isHexColor: _isHexColor.default, 33568 isRgbColor: _isRgbColor.default, 33569 isHSL: _isHSL.default, 33570 isISRC: _isISRC.default, 33571 isMD5: _isMD.default, 33572 isHash: _isHash.default, 33573 isJWT: _isJWT.default, 33574 isJSON: _isJSON.default, 33575 isEmpty: _isEmpty.default, 33576 isLength: _isLength.default, 33577 isLocale: _isLocale.default, 33578 isByteLength: _isByteLength.default, 33579 isULID: _isULID.default, 33580 isUUID: _isUUID.default, 33581 isMongoId: _isMongoId.default, 33582 isAfter: _isAfter.default, 33583 isBefore: _isBefore.default, 33584 isIn: _isIn.default, 33585 isLuhnNumber: _isLuhnNumber.default, 33586 isCreditCard: _isCreditCard.default, 33587 isIdentityCard: _isIdentityCard.default, 33588 isEAN: _isEAN.default, 33589 isISIN: _isISIN.default, 33590 isISBN: _isISBN.default, 33591 isISSN: _isISSN.default, 33592 isMobilePhone: _isMobilePhone.default, 33593 isMobilePhoneLocales: _isMobilePhone.locales, 33594 isPostalCode: _isPostalCode.default, 33595 isPostalCodeLocales: _isPostalCode.locales, 33596 isEthereumAddress: _isEthereumAddress.default, 33597 isCurrency: _isCurrency.default, 33598 isBtcAddress: _isBtcAddress.default, 33599 isISO6346: _isISO.isISO6346, 33600 isFreightContainerID: _isISO.isFreightContainerID, 33601 isISO6391: _isISO2.default, 33602 isISO8601: _isISO3.default, 33603 isISO15924: _isISO4.default, 33604 isRFC3339: _isRFC.default, 33605 isISO31661Alpha2: _isISO31661Alpha.default, 33606 isISO31661Alpha3: _isISO31661Alpha2.default, 33607 isISO31661Numeric: _isISO31661Numeric.default, 33608 isISO4217: _isISO5.default, 33609 isBase32: _isBase.default, 33610 isBase58: _isBase2.default, 33611 isBase64: _isBase3.default, 33612 isDataURI: _isDataURI.default, 33613 isMagnetURI: _isMagnetURI.default, 33614 isMailtoURI: _isMailtoURI.default, 33615 isMimeType: _isMimeType.default, 33616 isLatLong: _isLatLong.default, 33617 ltrim: _ltrim.default, 33618 rtrim: _rtrim.default, 33619 trim: _trim.default, 33620 escape: _escape.default, 33621 unescape: _unescape.default, 33622 stripLow: _stripLow.default, 33623 whitelist: _whitelist.default,
33624 blacklist: _blacklist.default, 33625 isWhitelisted: _isWhitelisted.default, 33626 normalizeEmail: _normalizeEmail.default, 33627 toString: toString, 33628 isSlug: _isSlug.default, 33629 isStrongPassword: _isStrongPassword.default, 33630 isTaxID: _isTaxID.default, 33631 isDate: _isDate.default, 33632 isTime: _isTime.default, 33633 isLicensePlate: _isLicensePlate.default, 33634 isVAT: _isVAT.default, 33635 ibanLocales: _isIBAN.locales 33636}; 33637var _default = exports.default = validator; 33638module.exports = exports.default; 33639module.exports.default = exports.default; 33640 33641},{"b10fe806c1d95257":"8bnlE","904819e5ea643bef":"bVJYg","22c9d1505c2d1fc3":"bKpuS","e0a5af27c12b2c5e":"coRnB","df6a0b6bd84e19b4":"8ZGrw","e2f527afb12190b0":"3f1Lg","d7cf83c49d7fa32f":"hzYWF","73acc2ba6f501a7f":"grSJW","7cc96999cdc491f6":"fSsZn","91309703df115c6":"eqhwS","8d2f5af297d16217":"4XTlO","6e4eace52f632262":"1wb11","1219b49fc6cacab9":"1UWMj","befc3dab9b151a88":"5brQk","ec526ea97a56e412":"iAI8C","a3a022398582f68":"bf4vU","8e765fdc6039f514":"dAGFU","d61bbfe7e2e66c71":"1AzRL","752765732ee21c04":"bivQJ","939913da4be78270":"gA1aZ","b32016933f0604cd":"eM4vX","f24514c574ef5174":"ifADU","a3b9b492f47016b1":"5tdoB","8ca5f357d13579ae":"5bmdn","57290c395d90e9e1":"iqQKh","2b3e24162ae2fcc4":"4oaAZ","6af1ce2eb4cb2855":"6RJdV","a47be535f6075d89":"jOJQE","eef79b677b4d3a47":"bDWyR","34b89671f36a7e6c":"350pT","8c10c7728b073c57":"49VS5","f81e871eee57051f":"jF9PT","1b903d3ad0f8db90":"lqBmi","20afde36edb727c0":"bTWDC","26779d512565dc66":"j0Vy9","df62e7a0ab08fe5c":"7rUFg","e09b4815b82a6fa5":"lxVTo","db9c20ed62cf8b83":"25WR1","ea2557066cb998fd":"2pfdH","f2e98624db0f1d3a":"lza2J","1ac5e66aef101809":"9crOE","d63b18a1ffb2f873":"1a2xz","b761b41c2a22a4c":"enrCZ","1474925e6c78b080":"a8GAq","5f702bfdeaac1ce7":"4oTj2","94155f1dd48161aa":"hqOY6","136460343d65b33b":"bgcDX","c84165da89e1d7dc":"1LSZn","4b2533eb7fa4f841":"dwk7J","61b139f71e9bf24a":"a9Js5","f14362267ed484f3":"1xRTi","d2e7ce5d1a66c2af":"Ym6IZ","595ce509b1afc12e":"gU4kV","e04856beee56d70":"58CmQ","8582f245235fd570":"duuYZ","38440f282a879a28":"4udlt","b530a3c08a2c51b8":"1vB4a","72a50fd794aa3073":"1mcSQ","47ff8310016d83ea":"95c9l","ba1ceeca74a3e817":"kYTFv","858463bab92c710f":"k9T9k","f68159fe837e362b":"kUtFa","7dbda028ea6b742d":"lkwai","7c94026d50601268":"7omN2","71e63739b51dba75":"9BnK8","ab77331adcaaf0d6":"jhUTi","2313c49333962ef0":"tvY2I","1ea0c275d18ce3e5":"iWisa","de6a83eab060bec5":"hdRnR","ab08ca66d9afd375":"evb1P","c4e797f261d4103c":"f9nZ5","57ddbfb43a466c6c":"6DkiI","b9e0ef98f72ec644":"55IEy","704555bc8cf425e5":"41ESR","41af2e43d6f75ccf":"cWUoW","a4ed258f67afd89a":"kDcj4","2ca72dbaf0f6b784":"e1jat","7b24277644928452":"hg2fV","c4b0f529774f4dee":"cc8c3","3e794622f61caa75":"8qsqX","43c060b0c5b6666c":"awbN2","7e6b000c25e65107":"4WAWr","e9ea15b8d1ad7666":"94buX","63f9ca5884eaf1a9":"6mBpE","adb3f66c462bf2e9":"k3lqQ","ead2e0dae8858eb6":"kjN2F","943c68afc1f5e3fb":"4O5Zc","337fc01d18b5d9a1":"dZL6c","8e8b3ff8c8b3be15":"5IXxZ","2262c3ab640e83e1":"kWGps","4ed20b257cccd153":"3oaqH","ac5bde86531aa937":"jDxC2","2cfb4a825383e754":"dNLK0","2e66e0b0ad386340":"6PwsC","8984f13126c4be3d":"4sUBe","a5ed790bd0c52ebc":"behwk","27fe339771c0d202":"8688D","f0de5432f43d6408":"1WHxZ","cc7c18b6c6bfc763":"fKO3v","cf2ac5417f4a7f77":"9FuN1","1f8b1a814d1f08cd":"b4gwm","b2c0124f6355fe4f":"d4Bdg"}],"8bnlE":[function(require,module,exports,__globalThis) { 33642"use strict"; 33643Object.defineProperty(exports, "__esModule", { 33644 value: true 33645}); 33646exports.default = toDate; 33647var _assertString = _interopRequireDefault(require("9003e7317103d051")); 33648function _interopRequireDefault(e) { 33649 return e && e.__esModule ? e : { 33650 default: e 33651 }; 33652} 33653function toDate(date) { 33654 (0, _assertString.default)(date); 33655 date = Date.parse(date); 33656 return !isNaN(date) ? new Date(date) : null; 33657} 33658module.exports = exports.default; 33659module.exports.default = exports.default; 33660 33661},{"9003e7317103d051":"fQT2o"}],"fQT2o":[function(require,module,exports,__globalThis) { 33662"use strict"; 33663Object.defineProperty(exports, "__esModule", { 33664 value: true 33665}); 33666exports.default = assertString; 33667function assertString(input) { 33668 if (input === undefined || input === null) throw new TypeError("Expected a string but received a ".concat(input)); 33669 if (input.constructor.name !== 'String') throw new TypeError("Expected a string but received a ".concat(input.constructor.name)); 33670} 33671module.exports = exports.default; 33672module.exports.default = exports.default; 33673 33674},{}],"bVJYg":[function(require,module,exports,__globalThis) { 33675"use strict"; 33676Object.defineProperty(exports, "__esModule", { 33677 value: true 33678}); 33679exports.default = toFloat; 33680var _isFloat = _interopRequireDefault(require("9b0d8b1a332f4ae0")); 33681function _interopRequireDefault(e) {
33682 return e && e.__esModule ? e : { 33683 default: e 33684 }; 33685} 33686function toFloat(str) { 33687 if (!(0, _isFloat.default)(str)) return NaN; 33688 return parseFloat(str); 33689} 33690module.exports = exports.default; 33691module.exports.default = exports.default; 33692 33693},{"9b0d8b1a332f4ae0":"j0Vy9"}],"j0Vy9":[function(require,module,exports,__globalThis) { 33694"use strict"; 33695Object.defineProperty(exports, "__esModule", { 33696 value: true 33697}); 33698exports.default = isFloat; 33699exports.locales = void 0; 33700var _assertString = _interopRequireDefault(require("e15bcf079e8ac12a")); 33701var _nullUndefinedCheck = _interopRequireDefault(require("46afa82c919c21c")); 33702var _alpha = require("24fcd40e646e749a"); 33703function _interopRequireDefault(e) { 33704 return e && e.__esModule ? e : { 33705 default: e 33706 }; 33707} 33708function isFloat(str, options) { 33709 (0, _assertString.default)(str); 33710 options = options || {}; 33711 var float = new RegExp("^(?:[-+])?(?:[0-9]+)?(?:\\".concat(options.locale ? _alpha.decimal[options.locale] : '.', "[0-9]*)?(?:[eE][\\+\\-]?(?:[0-9]+))?$")); 33712 if (str === '' || str === '.' || str === ',' || str === '-' || str === '+') return false; 33713 var value = parseFloat(str.replace(',', '.')); 33714 return float.test(str) && (!options.hasOwnProperty('min') || (0, _nullUndefinedCheck.default)(options.min) || value >= options.min) && (!options.hasOwnProperty('max') || (0, _nullUndefinedCheck.default)(options.max) || value <= options.max) && (!options.hasOwnProperty('lt') || (0, _nullUndefinedCheck.default)(options.lt) || value < options.lt) && (!options.hasOwnProperty('gt') || (0, _nullUndefinedCheck.default)(options.gt) || value > options.gt); 33715} 33716var locales = exports.locales = Object.keys(_alpha.decimal); 33717 33718},{"e15bcf079e8ac12a":"fQT2o","46afa82c919c21c":"eADR8","24fcd40e646e749a":"hjTvb"}],"eADR8":[function(require,module,exports,__globalThis) { 33719"use strict"; 33720Object.defineProperty(exports, "__esModule", { 33721 value: true 33722}); 33723exports.default = isNullOrUndefined; 33724function isNullOrUndefined(value) { 33725 return value === null || value === undefined; 33726} 33727module.exports = exports.default; 33728module.exports.default = exports.default; 33729 33730},{}],"hjTvb":[function(require,module,exports,__globalThis) { 33731"use strict"; 33732Object.defineProperty(exports, "__esModule", { 33733 value: true 33734}); 33735exports.farsiLocales = exports.englishLocales = exports.dotDecimal = exports.decimal = exports.commaDecimal = exports.bengaliLocales = exports.arabicLocales = exports.alphanumeric = exports.alpha = void 0; 33736var alpha = exports.alpha = { 33737 'en-US': /^[A-Z]+$/i, 33738 'az-AZ': /^[A-VXYZÃÆÄİıÃÅÃ]+$/i, 33739 'bg-BG': /^[Ð-Я]+$/i, 33740 'cs-CZ': /^[A-ZÃÄÄÃÄÃÅÃÅŠŤÃŮÎ]+$/i, 33741 'da-DK': /^[A-ZÃÃà ]+$/i, 33742 'de-DE': /^[A-ZÃÃÃÃ]+$/i, 33743 'el-GR': /^[Î-Ï]+$/i, 33744 'es-ES': /^[A-ZÃÃÃÃÃÃÃ]+$/i, 33745 'fa-IR': /^[Ø§Ø¨Ù¾ØªØ«Ø¬ÚØØ®Ø¯Ø°Ø±Ø²ÚØ³Ø´ØµØ¶Ø·Ø¸Ø¹ØºÙÙÚ©Ú¯ÙÙ ÙÙÙÛ]+$/i, 33746 'fi-FI': /^[A-Zà ÃÃ]+$/i, 33747 'fr-FR': /^[A-ZÃÃÃÃÃÃÃÃÃÃÃÅÃÃß]+$/i, 33748 'it-IT': /^[A-ZÃÃÃÃÃÃÃÃ]+$/i, 33749 'ja-JP': /^[ã-ãã¡-ã¶ï½¦-ï¾ä¸-é¾ ã¼ã»ãã]+$/i, 33750 'nb-NO': /^[A-ZÃÃà ]+$/i, 33751 'nl-NL': /^[A-ZÃÃÃÃÃÃÃÃ]+$/i, 33752 'nn-NO': /^[A-ZÃÃà ]+$/i, 33753 'hu-HU': /^[A-ZÃÃÃÃÃÅÃÃŰ]+$/i, 33754 'pl-PL': /^[A-ZÄÄÄÅÅÅÃŻŹ]+$/i, 33755 'pt-PT': /^[A-ZÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ]+$/i, 33756 'ru-RU': /^[Ð-ЯÐ]+$/i, 33757 'kk-KZ': /^[Ð-ЯÐ\u04D8\u04B0\u0406\u04A2\u0492\u04AE\u049A\u04E8\u04BA]+$/i, 33758 'sl-SI': /^[A-ZÄÄÄŠŽ]+$/i, 33759 'sk-SK': /^[A-ZÃÄÄÃÃÅÊŤÃÃŽĹÅĽÃÃ]+$/i, 33760 'sr-RS@latin': /^[A-ZÄÄŽŠÄ]+$/i, 33761 'sr-RS': /^[Ð-ЯÐÐÐÐÐÐ]+$/i, 33762 'sv-SE': /^[A-Zà ÃÃ]+$/i, 33763 'th-TH': /^[à¸-à¹\s]+$/i, 33764 'tr-TR': /^[A-ZÃÄİıÃÅÃ]+$/i, 33765 'uk-UA': /^[Ð-ЩЬЮЯÐIÐÒÑ]+$/i, 33766 'vi-VN': /^[A-ZÃÃẠẢÃÃẦẤẬẨẪÄẰẮẶẲẴÄÃÃẸẺẼÃá»áº¾á»á»á»ÃÃá»á»Ä¨ÃÃá»á»ÃÃá»á»á»á»á»Æ á»á»á»¢á»á» ÃÃỤỦŨƯỪỨỰỬỮỲÃỴỶỸ]+$/i, 33767 'ko-KR': /^[ã±-ã ã -ã £ê°-í£]*$/, 33768 'ku-IQ': /^[Ø¦Ø§Ø¨Ù¾ØªØ¬ÚØØ®Ø¯Ø±ÚØ²ÚسشعغÙÚ¤ÙÚ©Ú¯ÙÚµÙ ÙÙÛÚ¾ÛÛÛÙØ·Ø¤Ø«Ø¢Ø¥Ø£Ùضصةظذ]+$/i, 33769 ar: /^[Ø¡Ø¢Ø£Ø¤Ø¥Ø¦Ø§Ø¨Ø©ØªØ«Ø¬ØØ®Ø¯Ø°Ø±Ø²Ø³Ø´ØµØ¶Ø·Ø¸Ø¹ØºÙÙÙÙÙ ÙÙÙÙÙÙÙÙÙÙÙÙÙÙ°]+$/, 33770 he: /^[×-ת]+$/, 33771 fa: /^['Ø¢Ø§Ø¡Ø£Ø¤Ø¦Ø¨Ù¾ØªØ«Ø¬ÚØØ®Ø¯Ø°Ø±Ø²ÚØ³Ø´ØµØ¶Ø·Ø¸Ø¹ØºÙÙÚ©Ú¯ÙÙ ÙÙÙØ©Û']+$/i, 33772 bn: /^['à¦à¦à¦à¦à¦ à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦ ডঢণতথদধনপফবà¦à¦®à¦¯à¦°à¦²à¦¶à¦·à¦¸à¦¹à¦¼à¦½à¦¾à¦¿à§à§à§à§à§à§à§à§à§à§à§à§à§à§à§à§ ৡৢৣৰৱ৲৳৴৵৶৷৸৹৺৻']+$/, 33773 eo: /^[ABCÄD-GÄHĤIJÄ´K-PRSÅTUŬVZ]+$/i, 33774 'hi-IN': /^[\u0900-\u0961]+[\u0972-\u097F]*$/i, 33775 'si-LK': /^[\u0D80-\u0DFF]+$/ 33776};
33777var alphanumeric = exports.alphanumeric = { 33778 'en-US': /^[0-9A-Z]+$/i, 33779 'az-AZ': /^[0-9A-VXYZÃÆÄİıÃÅÃ]+$/i, 33780 'bg-BG': /^[0-9Ð-Я]+$/i, 33781 'cs-CZ': /^[0-9A-ZÃÄÄÃÄÃÅÃÅŠŤÃŮÎ]+$/i, 33782 'da-DK': /^[0-9A-ZÃÃà ]+$/i, 33783 'de-DE': /^[0-9A-ZÃÃÃÃ]+$/i, 33784 'el-GR': /^[0-9Î-Ï]+$/i, 33785 'es-ES': /^[0-9A-ZÃÃÃÃÃÃÃ]+$/i, 33786 'fi-FI': /^[0-9A-Zà ÃÃ]+$/i, 33787 'fr-FR': /^[0-9A-ZÃÃÃÃÃÃÃÃÃÃÃÅÃÃß]+$/i, 33788 'it-IT': /^[0-9A-ZÃÃÃÃÃÃÃÃ]+$/i, 33789 'ja-JP': /^[0-9ï¼-ï¼ã-ãã¡-ã¶ï½¦-ï¾ä¸-é¾ ã¼ã»ãã]+$/i, 33790 'hu-HU': /^[0-9A-ZÃÃÃÃÃÅÃÃŰ]+$/i, 33791 'nb-NO': /^[0-9A-ZÃÃà ]+$/i, 33792 'nl-NL': /^[0-9A-ZÃÃÃÃÃÃÃÃ]+$/i, 33793 'nn-NO': /^[0-9A-ZÃÃà ]+$/i, 33794 'pl-PL': /^[0-9A-ZÄÄÄÅÅÅÃŻŹ]+$/i, 33795 'pt-PT': /^[0-9A-ZÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃ]+$/i, 33796 'ru-RU': /^[0-9Ð-ЯÐ]+$/i, 33797 'kk-KZ': /^[0-9Ð-ЯÐ\u04D8\u04B0\u0406\u04A2\u0492\u04AE\u049A\u04E8\u04BA]+$/i, 33798 'sl-SI': /^[0-9A-ZÄÄÄŠŽ]+$/i, 33799 'sk-SK': /^[0-9A-ZÃÄÄÃÃÅÊŤÃÃŽĹÅĽÃÃ]+$/i, 33800 'sr-RS@latin': /^[0-9A-ZÄÄŽŠÄ]+$/i, 33801 'sr-RS': /^[0-9Ð-ЯÐÐÐÐÐÐ]+$/i, 33802 'sv-SE': /^[0-9A-Zà ÃÃ]+$/i, 33803 'th-TH': /^[à¸-à¹\s]+$/i, 33804 'tr-TR': /^[0-9A-ZÃÄİıÃÅÃ]+$/i, 33805 'uk-UA': /^[0-9Ð-ЩЬЮЯÐIÐÒÑ]+$/i, 33806 'ko-KR': /^[0-9ã±-ã ã -ã £ê°-í£]*$/, 33807 'ku-IQ': /^[٠١٢٣٤٥٦٧٨٩0-9Ø¦Ø§Ø¨Ù¾ØªØ¬ÚØØ®Ø¯Ø±ÚØ²ÚسشعغÙÚ¤ÙÚ©Ú¯ÙÚµÙ ÙÙÛÚ¾ÛÛÛÙØ·Ø¤Ø«Ø¢Ø¥Ø£Ùضصةظذ]+$/i, 33808 'vi-VN': /^[0-9A-ZÃÃẠẢÃÃẦẤẬẨẪÄẰẮẶẲẴÄÃÃẸẺẼÃá»áº¾á»á»á»ÃÃá»á»Ä¨ÃÃá»á»ÃÃá»á»á»á»á»Æ á»á»á»¢á»á» ÃÃỤỦŨƯỪỨỰỬỮỲÃỴỶỸ]+$/i, 33809 ar: /^[٠١٢٣٤٥٦٧٨٩0-9Ø¡Ø¢Ø£Ø¤Ø¥Ø¦Ø§Ø¨Ø©ØªØ«Ø¬ØØ®Ø¯Ø°Ø±Ø²Ø³Ø´ØµØ¶Ø·Ø¸Ø¹ØºÙÙÙÙÙ ÙÙÙÙÙÙÙÙÙÙÙÙÙÙ°]+$/, 33810 he: /^[0-9×-ת]+$/, 33811 fa: /^['0-9Ø¢Ø§Ø¡Ø£Ø¤Ø¦Ø¨Ù¾ØªØ«Ø¬ÚØØ®Ø¯Ø°Ø±Ø²ÚØ³Ø´ØµØ¶Ø·Ø¸Ø¹ØºÙÙÚ©Ú¯ÙÙ ÙÙÙØ©ÛÛ±Û²Û³Û´ÛµÛ¶Û·Û¸Û¹Û°']+$/i, 33812 bn: /^['à¦à¦à¦à¦à¦ à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦à¦ ডঢণতথদধনপফবà¦à¦®à¦¯à¦°à¦²à¦¶à¦·à¦¸à¦¹à¦¼à¦½à¦¾à¦¿à§à§à§à§à§à§à§à§à§à§à§à§à§à§à§à§ ৡৢৣ০১২৩৪৫৬à§à§®à§¯à§°à§±à§²à§³à§´à§µà§¶à§·à§¸à§¹à§ºà§»']+$/, 33813 eo: /^[0-9ABCÄD-GÄHĤIJÄ´K-PRSÅTUŬVZ]+$/i, 33814 'hi-IN': /^[\u0900-\u0963]+[\u0966-\u097F]*$/i, 33815 'si-LK': /^[0-9\u0D80-\u0DFF]+$/ 33816}; 33817var decimal = exports.decimal = { 33818 'en-US': '.', 33819 ar: "\u066B" 33820}; 33821var englishLocales = exports.englishLocales = [ 33822 'AU', 33823 'GB', 33824 'HK', 33825 'IN', 33826 'NZ', 33827 'ZA', 33828 'ZM' 33829]; 33830for(var locale, i = 0; i < englishLocales.length; i++){ 33831 locale = "en-".concat(englishLocales[i]); 33832 alpha[locale] = alpha['en-US']; 33833 alphanumeric[locale] = alphanumeric['en-US']; 33834 decimal[locale] = decimal['en-US']; 33835} 33836// Source: http://www.localeplanet.com/java/ 33837var arabicLocales = exports.arabicLocales = [ 33838 'AE', 33839 'BH', 33840 'DZ', 33841 'EG', 33842 'IQ', 33843 'JO', 33844 'KW', 33845 'LB', 33846 'LY', 33847 'MA', 33848 'QM', 33849 'QA', 33850 'SA', 33851 'SD', 33852 'SY', 33853 'TN', 33854 'YE' 33855]; 33856for(var _locale, _i = 0; _i < arabicLocales.length; _i++){ 33857 _locale = "ar-".concat(arabicLocales[_i]); 33858 alpha[_locale] = alpha.ar; 33859 alphanumeric[_locale] = alphanumeric.ar; 33860 decimal[_locale] = decimal.ar; 33861} 33862var farsiLocales = exports.farsiLocales = [ 33863 'IR', 33864 'AF' 33865]; 33866for(var _locale2, _i2 = 0; _i2 < farsiLocales.length; _i2++){ 33867 _locale2 = "fa-".concat(farsiLocales[_i2]); 33868 alphanumeric[_locale2] = alphanumeric.fa; 33869 decimal[_locale2] = decimal.ar; 33870} 33871var bengaliLocales = exports.bengaliLocales = [ 33872 'BD', 33873 'IN' 33874]; 33875for(var _locale3, _i3 = 0; _i3 < bengaliLocales.length; _i3++){ 33876 _locale3 = "bn-".concat(bengaliLocales[_i3]); 33877 alpha[_locale3] = alpha.bn; 33878 alphanumeric[_locale3] = alphanumeric.bn; 33879 decimal[_locale3] = decimal['en-US']; 33880} 33881// Source: https://en.wikipedia.org/wiki/Decimal_mark 33882var dotDecimal = exports.dotDecimal = [ 33883 'ar-EG', 33884 'ar-LB', 33885 'ar-LY' 33886]; 33887var commaDecimal = exports.commaDecimal = [ 33888 'bg-BG', 33889 'cs-CZ', 33890 'da-DK', 33891 'de-DE', 33892 'el-GR', 33893 'en-ZM', 33894 'eo', 33895 'es-ES', 33896 'fr-CA', 33897 'fr-FR', 33898 'id-ID', 33899 'it-IT', 33900 'ku-IQ', 33901 'hi-IN', 33902 'hu-HU', 33903 'nb-NO', 33904 'nn-NO', 33905 'nl-NL', 33906 'pl-PL', 33907 'pt-PT', 33908 'ru-RU', 33909 'kk-KZ', 33910 'si-LK', 33911 'sl-SI', 33912 'sr-RS@latin', 33913 'sr-RS', 33914 'sv-SE', 33915 'tr-TR', 33916 'uk-UA', 33917 'vi-VN' 33918]; 33919for(var _i4 = 0; _i4 < dotDecimal.length; _i4++)decimal[dotDecimal[_i4]] = decimal['en-US']; 33920for(var _i5 = 0; _i5 < commaDecimal.length; _i5++)decimal[commaDecimal[_i5]] = ','; 33921alpha['fr-CA'] = alpha['fr-FR']; 33922alphanumeric['fr-CA'] = alphanumeric['fr-FR']; 33923alpha['pt-BR'] = alpha['pt-PT']; 33924alphanumeric['pt-BR'] = alphanumeric['pt-PT']; 33925decimal['pt-BR'] = decimal['pt-PT']; 33926// see #862 33927alpha['pl-Pl'] = alpha['pl-PL']; 33928alphanumeric['pl-Pl'] = alphanumeric['pl-PL']; 33929decimal['pl-Pl'] = decimal['pl-PL']; 33930// see #1455 33931alpha['fa-AF'] = alpha.fa; 33932 33933},{}],"bKpuS":[function(require,module,exports,__globalThis) { 33934"use strict"; 33935Object.defineProperty(exports, "__esModule", { 33936 value: true 33937}); 33938exports.default = toInt; 33939var _assertString = _interopRequireDefault(require("844cad00cd361a98")); 33940function _interopRequireDefault(e) {
33941 return e && e.__esModule ? e : { 33942 default: e 33943 }; 33944} 33945function toInt(str, radix) { 33946 (0, _assertString.default)(str); 33947 return parseInt(str, radix || 10); 33948} 33949module.exports = exports.default; 33950module.exports.default = exports.default; 33951 33952},{"844cad00cd361a98":"fQT2o"}],"coRnB":[function(require,module,exports,__globalThis) { 33953"use strict"; 33954Object.defineProperty(exports, "__esModule", { 33955 value: true 33956}); 33957exports.default = toBoolean; 33958var _assertString = _interopRequireDefault(require("a1a6c79778bf962b")); 33959function _interopRequireDefault(e) { 33960 return e && e.__esModule ? e : { 33961 default: e 33962 }; 33963} 33964function toBoolean(str, strict) { 33965 (0, _assertString.default)(str); 33966 if (strict) return str === '1' || /^true$/i.test(str); 33967 return str !== '0' && !/^false$/i.test(str) && str !== ''; 33968} 33969module.exports = exports.default; 33970module.exports.default = exports.default; 33971 33972},{"a1a6c79778bf962b":"fQT2o"}],"8ZGrw":[function(require,module,exports,__globalThis) { 33973"use strict"; 33974Object.defineProperty(exports, "__esModule", { 33975 value: true 33976}); 33977exports.default = equals; 33978var _assertString = _interopRequireDefault(require("d1a5c332af02b5b8")); 33979function _interopRequireDefault(e) { 33980 return e && e.__esModule ? e : { 33981 default: e 33982 }; 33983} 33984function equals(str, comparison) { 33985 (0, _assertString.default)(str); 33986 return str === comparison; 33987} 33988module.exports = exports.default; 33989module.exports.default = exports.default; 33990 33991},{"d1a5c332af02b5b8":"fQT2o"}],"3f1Lg":[function(require,module,exports,__globalThis) { 33992"use strict"; 33993Object.defineProperty(exports, "__esModule", { 33994 value: true 33995}); 33996exports.default = contains; 33997var _assertString = _interopRequireDefault(require("3e51aa762dc8c667")); 33998var _toString = _interopRequireDefault(require("3cd4f952bd2883fe")); 33999var _merge = _interopRequireDefault(require("cc59373485c7be91")); 34000function _interopRequireDefault(e) { 34001 return e && e.__esModule ? e : { 34002 default: e 34003 }; 34004} 34005var defaultContainsOptions = { 34006 ignoreCase: false, 34007 minOccurrences: 1 34008}; 34009function contains(str, elem, options) { 34010 (0, _assertString.default)(str); 34011 options = (0, _merge.default)(options, defaultContainsOptions); 34012 if (options.ignoreCase) return str.toLowerCase().split((0, _toString.default)(elem).toLowerCase()).length > options.minOccurrences; 34013 return str.split((0, _toString.default)(elem)).length > options.minOccurrences; 34014} 34015module.exports = exports.default; 34016module.exports.default = exports.default; 34017 34018},{"3e51aa762dc8c667":"fQT2o","3cd4f952bd2883fe":"2wZ8V","cc59373485c7be91":"bRDoK"}],"2wZ8V":[function(require,module,exports,__globalThis) { 34019"use strict"; 34020Object.defineProperty(exports, "__esModule", { 34021 value: true 34022}); 34023exports.default = toString; 34024function _typeof(o) { 34025 "@babel/helpers - typeof"; 34026 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { 34027 return typeof o; 34028 } : function(o) { 34029 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 34030 }, _typeof(o); 34031} 34032function toString(input) { 34033 if (_typeof(input) === 'object' && input !== null) { 34034 if (typeof input.toString === 'function') input = input.toString(); 34035 else input = '[object Object]'; 34036 } else if (input === null || typeof input === 'undefined' || isNaN(input) && !input.length) input = ''; 34037 return String(input); 34038} 34039module.exports = exports.default; 34040module.exports.default = exports.default; 34041 34042},{}],"bRDoK":[function(require,module,exports,__globalThis) { 34043"use strict"; 34044Object.defineProperty(exports, "__esModule", { 34045 value: true 34046}); 34047exports.default = merge; 34048function merge() { 34049 var obj = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 34050 var defaults = arguments.length > 1 ? arguments[1] : undefined; 34051 for(var key in defaults)if (typeof obj[key] === 'undefined') obj[key] = defaults[key]; 34052 return obj; 34053} 34054module.exports = exports.default; 34055module.exports.default = exports.default; 34056 34057},{}],"hzYWF":[function(require,module,exports,__globalThis) { 34058"use strict"; 34059Object.defineProperty(exports, "__esModule", { 34060 value: true 34061}); 34062exports.default = matches; 34063var _assertString = _interopRequireDefault(require("d910f8373decde92")); 34064function _interopRequireDefault(e) {
34065 return e && e.__esModule ? e : { 34066 default: e 34067 }; 34068} 34069function matches(str, pattern, modifiers) { 34070 (0, _assertString.default)(str); 34071 if (Object.prototype.toString.call(pattern) !== '[object RegExp]') pattern = new RegExp(pattern, modifiers); 34072 return !!str.match(pattern); 34073} 34074module.exports = exports.default; 34075module.exports.default = exports.default; 34076 34077},{"d910f8373decde92":"fQT2o"}],"grSJW":[function(require,module,exports,__globalThis) { 34078"use strict"; 34079Object.defineProperty(exports, "__esModule", { 34080 value: true 34081}); 34082exports.default = isEmail; 34083var _assertString = _interopRequireDefault(require("70466717dea49b4a")); 34084var _checkHost = _interopRequireDefault(require("22b10d1616a26ea")); 34085var _isByteLength = _interopRequireDefault(require("652948654aa86386")); 34086var _isFQDN = _interopRequireDefault(require("6e220cda7afcfeb4")); 34087var _isIP = _interopRequireDefault(require("270d6e12f02c594c")); 34088var _merge = _interopRequireDefault(require("8c581d289b6709d2")); 34089function _interopRequireDefault(e) { 34090 return e && e.__esModule ? e : { 34091 default: e 34092 }; 34093} 34094var default_email_options = { 34095 allow_display_name: false, 34096 allow_underscores: false, 34097 require_display_name: false, 34098 allow_utf8_local_part: true, 34099 require_tld: true, 34100 blacklisted_chars: '', 34101 ignore_max_length: false, 34102 host_blacklist: [], 34103 host_whitelist: [] 34104}; 34105/* eslint-disable max-len */ /* eslint-disable no-control-regex */ var splitNameAddress = /^([^\x00-\x1F\x7F-\x9F\cX]+)</i; 34106var emailUserPart = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~]+$/i; 34107var gmailUserPart = /^[a-z\d]+$/; 34108var quotedEmailUser = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f]))*$/i; 34109var emailUserUtf8Part = /^[a-z\d!#\$%&'\*\+\-\/=\?\^_`{\|}~\u00A1-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]+$/i; 34110var quotedEmailUserUtf8 = /^([\s\x01-\x08\x0b\x0c\x0e-\x1f\x7f\x21\x23-\x5b\x5d-\x7e\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]|(\\[\x01-\x09\x0b\x0c\x0d-\x7f\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))*$/i; 34111var defaultMaxEmailLength = 254; 34112/* eslint-enable max-len */ /* eslint-enable no-control-regex */ /** 34113 * Validate display name according to the RFC2822: https://tools.ietf.org/html/rfc2822#appendix-A.1.2 34114 * @param {String} display_name 34115 */ function validateDisplayName(display_name) { 34116 var display_name_without_quotes = display_name.replace(/^"(.+)"$/, '$1'); 34117 // display name with only spaces is not valid 34118 if (!display_name_without_quotes.trim()) return false; 34119 // check whether display name contains illegal character 34120 var contains_illegal = /[\.";<>]/.test(display_name_without_quotes); 34121 if (contains_illegal) { 34122 // if contains illegal characters, 34123 // must to be enclosed in double-quotes, otherwise it's not a valid display name 34124 if (display_name_without_quotes === display_name) return false; 34125 // the quotes in display name must start with character symbol \ 34126 var all_start_with_back_slash = display_name_without_quotes.split('"').length === display_name_without_quotes.split('\\"').length; 34127 if (!all_start_with_back_slash) return false; 34128 } 34129 return true; 34130} 34131function isEmail(str, options) { 34132 (0, _assertString.default)(str); 34133 options = (0, _merge.default)(options, default_email_options); 34134 if (options.require_display_name || options.allow_display_name) { 34135 var display_email = str.match(splitNameAddress); 34136 if (display_email) { 34137 var display_name = display_email[1]; 34138 // Remove display name and angle brackets to get email address 34139 // Can be done in the regex but will introduce a ReDOS (See #1597 for more info) 34140 str = str.replace(display_name, '').replace(/(^<|>$)/g, ''); 34141 // sometimes need to trim the last space to get the display name 34142 // because there may be a space between display name and email address 34143 // eg. myname <[email protected]> 34144 // the display name is `myname` instead of `myname `, so need to trim the last space 34145 if (display_name.endsWith(' ')) display_name = display_name.slice(0, -1); 34146 if (!validateDisplayName(display_name)) return false;
34147 } else if (options.require_display_name) return false; 34148 } 34149 if (!options.ignore_max_length && str.length > defaultMaxEmailLength) return false; 34150 var parts = str.split('@'); 34151 var domain = parts.pop(); 34152 var lower_domain = domain.toLowerCase(); 34153 if (options.host_blacklist.length > 0 && (0, _checkHost.default)(lower_domain, options.host_blacklist)) return false; 34154 if (options.host_whitelist.length > 0 && !(0, _checkHost.default)(lower_domain, options.host_whitelist)) return false; 34155 var user = parts.join('@'); 34156 if (options.domain_specific_validation && (lower_domain === 'gmail.com' || lower_domain === 'googlemail.com')) { 34157 /* 34158 Previously we removed dots for gmail addresses before validating. 34159 This was removed because it allows `[email protected]` 34160 to be reported as valid, but it is not. 34161 Gmail only normalizes single dots, removing them from here is pointless, 34162 should be done in normalizeEmail 34163 */ user = user.toLowerCase(); 34164 // Removing sub-address from username before gmail validation 34165 var username = user.split('+')[0]; 34166 // Dots are not included in gmail length restriction 34167 if (!(0, _isByteLength.default)(username.replace(/\./g, ''), { 34168 min: 6, 34169 max: 30 34170 })) return false; 34171 var _user_parts = username.split('.'); 34172 for(var i = 0; i < _user_parts.length; i++){ 34173 if (!gmailUserPart.test(_user_parts[i])) return false; 34174 } 34175 } 34176 if (options.ignore_max_length === false && (!(0, _isByteLength.default)(user, { 34177 max: 64 34178 }) || !(0, _isByteLength.default)(domain, { 34179 max: 254 34180 }))) return false; 34181 if (!(0, _isFQDN.default)(domain, { 34182 require_tld: options.require_tld, 34183 ignore_max_length: options.ignore_max_length, 34184 allow_underscores: options.allow_underscores 34185 })) { 34186 if (!options.allow_ip_domain) return false; 34187 if (!(0, _isIP.default)(domain)) { 34188 if (!domain.startsWith('[') || !domain.endsWith(']')) return false; 34189 var noBracketdomain = domain.slice(1, -1); 34190 if (noBracketdomain.length === 0 || !(0, _isIP.default)(noBracketdomain)) return false; 34191 } 34192 } 34193 if (options.blacklisted_chars) { 34194 if (user.search(new RegExp("[".concat(options.blacklisted_chars, "]+"), 'g')) !== -1) return false; 34195 } 34196 if (user[0] === '"' && user[user.length - 1] === '"') { 34197 user = user.slice(1, user.length - 1); 34198 return options.allow_utf8_local_part ? quotedEmailUserUtf8.test(user) : quotedEmailUser.test(user); 34199 } 34200 var pattern = options.allow_utf8_local_part ? emailUserUtf8Part : emailUserPart; 34201 var user_parts = user.split('.'); 34202 for(var _i = 0; _i < user_parts.length; _i++){ 34203 if (!pattern.test(user_parts[_i])) return false; 34204 } 34205 return true; 34206} 34207module.exports = exports.default; 34208module.exports.default = exports.default; 34209 34210},{"70466717dea49b4a":"fQT2o","22b10d1616a26ea":"jTX5D","652948654aa86386":"Ym6IZ","6e220cda7afcfeb4":"1UWMj","270d6e12f02c594c":"4XTlO","8c581d289b6709d2":"bRDoK"}],"jTX5D":[function(require,module,exports,__globalThis) { 34211"use strict"; 34212Object.defineProperty(exports, "__esModule", { 34213 value: true 34214}); 34215exports.default = checkHost; 34216function isRegExp(obj) { 34217 return Object.prototype.toString.call(obj) === '[object RegExp]'; 34218} 34219function checkHost(host, matches) { 34220 for(var i = 0; i < matches.length; i++){ 34221 var match = matches[i]; 34222 if (host === match || isRegExp(match) && match.test(host)) return true; 34223 } 34224 return false; 34225} 34226module.exports = exports.default; 34227module.exports.default = exports.default; 34228 34229},{}],"Ym6IZ":[function(require,module,exports,__globalThis) { 34230"use strict"; 34231Object.defineProperty(exports, "__esModule", { 34232 value: true 34233}); 34234exports.default = isByteLength; 34235var _assertString = _interopRequireDefault(require("8709d4cd1991bf25")); 34236function _interopRequireDefault(e) { 34237 return e && e.__esModule ? e : { 34238 default: e 34239 }; 34240} 34241function _typeof(o) { 34242 "@babel/helpers - typeof"; 34243 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { 34244 return typeof o; 34245 } : function(o) { 34246 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 34247 }, _typeof(o); 34248} 34249/* eslint-disable prefer-rest-params */ function isByteLength(str, options) { 34250 (0, _assertString.default)(str); 34251 var min; 34252 var max; 34253 if (_typeof(options) === 'object') { 34254 min = options.min || 0; 34255 max = options.max; 34256 } else { 34257 // backwards compatibility: isByteLength(str, min [, max]) 34258 min = arguments[1]; 34259 max = arguments[2]; 34260 } 34261 var len = encodeURI(str).split(/%..|./).length - 1; 34262 return len >= min && (typeof max === 'undefined' || len <= max); 34263} 34264module.exports = exports.default; 34265module.exports.default = exports.default; 34266 34267},{"8709d4cd1991bf25":"fQT2o"}],"1UWMj":[function(require,module,exports,__globalThis) { 34268"use strict"; 34269Object.defineProperty(exports, "__esModule", { 34270 value: true 34271}); 34272exports.default = isFQDN; 34273var _assertString = _interopRequireDefault(require("9ef49c576c3eb32d")); 34274var _merge = _interopRequireDefault(require("f628cd123e86515c")); 34275function _interopRequireDefault(e) {
34276 return e && e.__esModule ? e : { 34277 default: e 34278 }; 34279} 34280var default_fqdn_options = { 34281 require_tld: true, 34282 allow_underscores: false, 34283 allow_trailing_dot: false, 34284 allow_numeric_tld: false, 34285 allow_wildcard: false, 34286 ignore_max_length: false 34287}; 34288function isFQDN(str, options) { 34289 (0, _assertString.default)(str); 34290 options = (0, _merge.default)(options, default_fqdn_options); 34291 /* Remove the optional trailing dot before checking validity */ if (options.allow_trailing_dot && str[str.length - 1] === '.') str = str.substring(0, str.length - 1); 34292 /* Remove the optional wildcard before checking validity */ if (options.allow_wildcard === true && str.indexOf('*.') === 0) str = str.substring(2); 34293 var parts = str.split('.'); 34294 var tld = parts[parts.length - 1]; 34295 if (options.require_tld) { 34296 // disallow fqdns without tld 34297 if (parts.length < 2) return false; 34298 if (!options.allow_numeric_tld && !/^([a-z\u00A1-\u00A8\u00AA-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]{2,}|xn[a-z0-9-]{2,})$/i.test(tld)) return false; 34299 // disallow spaces 34300 if (/\s/.test(tld)) return false; 34301 } 34302 // reject numeric TLDs 34303 if (!options.allow_numeric_tld && /^\d+$/.test(tld)) return false; 34304 return parts.every(function(part) { 34305 if (part.length > 63 && !options.ignore_max_length) return false; 34306 if (!/^[a-z_\u00a1-\uffff0-9-]+$/i.test(part)) return false; 34307 // disallow full-width chars 34308 if (/[\uff01-\uff5e]/.test(part)) return false; 34309 // disallow parts starting or ending with hyphen 34310 if (/^-|-$/.test(part)) return false; 34311 if (!options.allow_underscores && /_/.test(part)) return false; 34312 return true; 34313 }); 34314} 34315module.exports = exports.default; 34316module.exports.default = exports.default; 34317 34318},{"9ef49c576c3eb32d":"fQT2o","f628cd123e86515c":"bRDoK"}],"4XTlO":[function(require,module,exports,__globalThis) { 34319"use strict"; 34320Object.defineProperty(exports, "__esModule", { 34321 value: true 34322}); 34323exports.default = isIP; 34324var _assertString = _interopRequireDefault(require("35aed34e3042a858")); 34325function _interopRequireDefault(e) { 34326 return e && e.__esModule ? e : { 34327 default: e 34328 }; 34329} 34330function _typeof(o) { 34331 "@babel/helpers - typeof"; 34332 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { 34333 return typeof o; 34334 } : function(o) { 34335 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 34336 }, _typeof(o); 34337} 34338/** 3433911.3. Examples 34340 34341 The following addresses 34342 34343 fe80::1234 (on the 1st link of the node) 34344 ff02::5678 (on the 5th link of the node) 34345 ff08::9abc (on the 10th organization of the node) 34346 34347 would be represented as follows: 34348 34349 fe80::1234%1 34350 ff02::5678%5 34351 ff08::9abc%10 34352 34353 (Here we assume a natural translation from a zone index to the 34354 <zone_id> part, where the Nth zone of any scope is translated into 34355 "N".) 34356 34357 If we use interface names as <zone_id>, those addresses could also be 34358 represented as follows: 34359 34360 fe80::1234%ne0 34361 ff02::5678%pvc1.3 34362 ff08::9abc%interface10 34363 34364 where the interface "ne0" belongs to the 1st link, "pvc1.3" belongs 34365 to the 5th link, and "interface10" belongs to the 10th organization. 34366 * * */ var IPv4SegmentFormat = '(?:[0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'; 34367var IPv4AddressFormat = "(".concat(IPv4SegmentFormat, "[.]){3}").concat(IPv4SegmentFormat); 34368var IPv4AddressRegExp = new RegExp("^".concat(IPv4AddressFormat, "$")); 34369var IPv6SegmentFormat = '(?:[0-9a-fA-F]{1,4})'; 34370var IPv6AddressRegExp = new RegExp('^(' + "(?:".concat(IPv6SegmentFormat, ":){7}(?:").concat(IPv6SegmentFormat, "|:)|") + "(?:".concat(IPv6SegmentFormat, ":){6}(?:").concat(IPv4AddressFormat, "|:").concat(IPv6SegmentFormat, "|:)|") + "(?:".concat(IPv6SegmentFormat, ":){5}(?::").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,2}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){4}(?:(:").concat(IPv6SegmentFormat, "){0,1}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,3}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){3}(?:(:").concat(IPv6SegmentFormat, "){0,2}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,4}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){2}(?:(:").concat(IPv6SegmentFormat, "){0,3}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,5}|:)|") + "(?:".concat(IPv6SegmentFormat, ":){1}(?:(:").concat(IPv6SegmentFormat, "){0,4}:").concat(IPv4AddressFormat, "|(:").concat(IPv6SegmentFormat, "){1,6}|:)|") + "(?::((?::".concat(IPv6SegmentFormat, "){0,5}:").concat(IPv4AddressFormat, "|(?::").concat(IPv6SegmentFormat, "){1,7}|:))") + ')(%[0-9a-zA-Z.]{1,})?$'); 34371function isIP(ipAddress) { 34372 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 34373 (0, _assertString.default)(ipAddress); 34374 // accessing 'arguments' for backwards compatibility: isIP(ipAddress [, version]
34374) 34375 // eslint-disable-next-line prefer-rest-params 34376 var version = (_typeof(options) === 'object' ? options.version : arguments[1]) || ''; 34377 if (!version) return isIP(ipAddress, { 34378 version: 4 34379 }) || isIP(ipAddress, { 34380 version: 6 34381 }); 34382 if (version.toString() === '4') return IPv4AddressRegExp.test(ipAddress); 34383 if (version.toString() === '6') return IPv6AddressRegExp.test(ipAddress); 34384 return false; 34385} 34386module.exports = exports.default; 34387module.exports.default = exports.default; 34388 34389},{"35aed34e3042a858":"fQT2o"}],"fSsZn":[function(require,module,exports,__globalThis) { 34390"use strict"; 34391Object.defineProperty(exports, "__esModule", { 34392 value: true 34393}); 34394exports.default = isURL; 34395var _assertString = _interopRequireDefault(require("8a7ec28029711837")); 34396var _checkHost = _interopRequireDefault(require("c212a0682f4baf5b")); 34397var _includesString = _interopRequireDefault(require("56106d65a3b06b86")); 34398var _isFQDN = _interopRequireDefault(require("5dcdad4f58bfb9c9")); 34399var _isIP = _interopRequireDefault(require("138e1db08b22dcdd")); 34400var _merge = _interopRequireDefault(require("342189f79ec30088")); 34401function _interopRequireDefault(e) { 34402 return e && e.__esModule ? e : { 34403 default: e 34404 }; 34405} 34406function _slicedToArray(r, e) { 34407 return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); 34408} 34409function _nonIterableRest() { 34410 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 34411} 34412function _unsupportedIterableToArray(r, a) { 34413 if (r) { 34414 if ("string" == typeof r) return _arrayLikeToArray(r, a); 34415 var t = ({}).toString.call(r).slice(8, -1); 34416 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; 34417 } 34418} 34419function _arrayLikeToArray(r, a) { 34420 (null == a || a > r.length) && (a = r.length); 34421 for(var e = 0, n = Array(a); e < a; e++)n[e] = r[e]; 34422 return n; 34423} 34424function _iterableToArrayLimit(r, l) { 34425 var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; 34426 if (null != t) { 34427 var e, n, i, u, a = [], f = !0, o = !1; 34428 try { 34429 if (i = (t = t.call(r)).next, 0 === l) { 34430 if (Object(t) !== t) return; 34431 f = !1; 34432 } else for(; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); 34433 } catch (r) { 34434 o = !0, n = r; 34435 } finally{ 34436 try { 34437 if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; 34438 } finally{ 34439 if (o) throw n; 34440 } 34441 } 34442 return a; 34443 } 34444} 34445function _arrayWithHoles(r) { 34446 if (Array.isArray(r)) return r; 34447} 34448/* 34449options for isURL method 34450 34451protocols - valid protocols can be modified with this option. 34452require_tld - If set to false isURL will not check if the URL's host includes a top-level domain. 34453require_protocol - if set to true isURL will return false if protocol is not present in the URL. 34454require_host - if set to false isURL will not check if host is present in the URL. 34455require_port - if set to true isURL will check if port is present in the URL. 34456require_valid_protocol - isURL will check if the URL's protocol is present in the protocols option. 34457allow_underscores - if set to true, the validator will allow underscores in the URL. 34458host_whitelist - if set to an array of strings or regexp, and the domain matches none of the strings 34459 defined in it, the validation fails. 34460host_blacklist - if set to an array of strings or regexp, and the domain matches any of the strings 34461 defined in it, the validation fails. 34462allow_trailing_dot - if set to true, the validator will allow the domain to end with 34463 a `.` character. 34464allow_protocol_relative_urls - if set to true protocol relative URLs will be allowed. 34465allow_fragments - if set to false isURL will return false if fragments are present. 34466allow_query_components - if set to false isURL will return false if query components are present. 34467disallow_auth - if set to true, the validator will fail if the URL contains an authentication 34468 component, e.g. `http://username:[email protected]` 34469validate_length - if set to false isURL will skip string length validation. `max_allowed_length` 34470 will be ignored if this is set as `false`. 34471max_allowed_length - if set, isURL will not allow URLs longer than the specified value (default is 34472 2084 that IE maximum URL length). 34473 34474*/ var default_url_options = { 34475 protocols: [ 34476 'http', 34477 'https', 34478 'ftp' 34479 ], 34480 require_tld: true, 34481 require_protocol: false, 34482 require_host: true, 34483 require_port: false, 34484 require_valid_protocol: true, 34485 allow_underscores: false, 34486 allow_trailing_dot: false, 34487 allow_protocol_relative_urls: false, 34488 allow_fragments: true, 34489 allow_query_components: true, 34490 validate_length: true, 34491 max_allowed_length: 2084 34492}; 34493var wrapped_ipv6 = /^\[([^\]]+)\](?::([0-9]+))?$/; 34494function isURL(url, options) { 34495 (0, _assertString.default)(url); 34496 if (!url || /[\s<>]/.test(url)) return false;
34497 if (url.indexOf('mailto:') === 0) return false; 34498 options = (0, _merge.default)(options, default_url_options); 34499 if (options.validate_length && url.length > options.max_allowed_length) return false; 34500 if (!options.allow_fragments && (0, _includesString.default)(url, '#')) return false; 34501 if (!options.allow_query_components && ((0, _includesString.default)(url, '?') || (0, _includesString.default)(url, '&'))) return false; 34502 var protocol, auth, host, hostname, port, port_str, split, ipv6; 34503 split = url.split('#'); 34504 url = split.shift(); 34505 split = url.split('?'); 34506 url = split.shift(); 34507 split = url.split('://'); 34508 if (split.length > 1) { 34509 protocol = split.shift().toLowerCase(); 34510 if (options.require_valid_protocol && options.protocols.indexOf(protocol) === -1) return false; 34511 } else if (options.require_protocol) return false; 34512 else if (url.slice(0, 2) === '//') { 34513 if (!options.allow_protocol_relative_urls) return false; 34514 split[0] = url.slice(2); 34515 } 34516 url = split.join('://'); 34517 if (url === '') return false; 34518 split = url.split('/'); 34519 url = split.shift(); 34520 if (url === '' && !options.require_host) return true; 34521 split = url.split('@'); 34522 if (split.length > 1) { 34523 if (options.disallow_auth) return false; 34524 if (split[0] === '') return false; 34525 auth = split.shift(); 34526 if (auth.indexOf(':') >= 0 && auth.split(':').length > 2) return false; 34527 var _auth$split = auth.split(':'), _auth$split2 = _slicedToArray(_auth$split, 2), user = _auth$split2[0], password = _auth$split2[1]; 34528 if (user === '' && password === '') return false; 34529 } 34530 hostname = split.join('@'); 34531 port_str = null; 34532 ipv6 = null; 34533 var ipv6_match = hostname.match(wrapped_ipv6); 34534 if (ipv6_match) { 34535 host = ''; 34536 ipv6 = ipv6_match[1]; 34537 port_str = ipv6_match[2] || null; 34538 } else { 34539 split = hostname.split(':'); 34540 host = split.shift(); 34541 if (split.length) port_str = split.join(':'); 34542 } 34543 if (port_str !== null && port_str.length > 0) { 34544 port = parseInt(port_str, 10); 34545 if (!/^[0-9]+$/.test(port_str) || port <= 0 || port > 65535) return false; 34546 } else if (options.require_port) return false; 34547 if (options.host_whitelist) return (0, _checkHost.default)(host, options.host_whitelist); 34548 if (host === '' && !options.require_host) return true; 34549 if (!(0, _isIP.default)(host) && !(0, _isFQDN.default)(host, options) && (!ipv6 || !(0, _isIP.default)(ipv6, 6))) return false; 34550 host = host || ipv6; 34551 if (options.host_blacklist && (0, _checkHost.default)(host, options.host_blacklist)) return false; 34552 return true; 34553} 34554module.exports = exports.default; 34555module.exports.default = exports.default; 34556 34557},{"8a7ec28029711837":"fQT2o","c212a0682f4baf5b":"jTX5D","56106d65a3b06b86":"3FdGd","5dcdad4f58bfb9c9":"1UWMj","138e1db08b22dcdd":"4XTlO","342189f79ec30088":"bRDoK"}],"3FdGd":[function(require,module,exports,__globalThis) { 34558"use strict"; 34559Object.defineProperty(exports, "__esModule", { 34560 value: true 34561}); 34562exports.default = void 0; 34563var includes = function includes(str, val) { 34564 return str.indexOf(val) !== -1; 34565}; 34566var _default = exports.default = includes; 34567module.exports = exports.default; 34568module.exports.default = exports.default; 34569 34570},{}],"eqhwS":[function(require,module,exports,__globalThis) { 34571"use strict"; 34572Object.defineProperty(exports, "__esModule", { 34573 value: true 34574}); 34575exports.default = isMACAddress; 34576var _assertString = _interopRequireDefault(require("79312c853868713f")); 34577function _interopRequireDefault(e) { 34578 return e && e.__esModule ? e : { 34579 default: e 34580 }; 34581} 34582var macAddress48 = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){4}([0-9a-fA-F]{2})$/; 34583var macAddress48NoSeparators = /^([0-9a-fA-F]){12}$/; 34584var macAddress48WithDots = /^([0-9a-fA-F]{4}\.){2}([0-9a-fA-F]{4})$/; 34585var macAddress64 = /^(?:[0-9a-fA-F]{2}([-:\s]))([0-9a-fA-F]{2}\1){6}([0-9a-fA-F]{2})$/; 34586var macAddress64NoSeparators = /^([0-9a-fA-F]){16}$/; 34587var macAddress64WithDots = /^([0-9a-fA-F]{4}\.){3}([0-9a-fA-F]{4})$/; 34588function isMACAddress(str, options) { 34589 (0, _assertString.default)(str); 34590 if (options !== null && options !== void 0 && options.eui) options.eui = String(options.eui); 34591 /** 34592 * @deprecated `no_colons` TODO: remove it in the next major 34593 */ if (options !== null && options !== void 0 && options.no_colons || options !== null && options !== void 0 && options.no_separators) { 34594 if (options.eui === '48') return macAddress48NoSeparators.test(str); 34595 if (options.eui === '64') return macAddress64NoSeparators.test(str); 34596 return macAddress48NoSeparators.test(str) || macAddress64NoSeparators.test(str); 34597 } 34598 if ((options === null || options === void 0 ? void 0 : options.eui) === '48') return macAddress48.test(str) || macAddress48WithDots.test(str); 34599 if ((options === null || options === void 0 ? void 0 : options.eui) === '64') return macAddress64.test(str) || macAddress64WithDots.test(str); 34600 return isMACAddress(str, { 34601 eui: '48' 34602 }) || isMACAddress(str, { 34603 eui: '64' 34604 }); 34605} 34606module.exports = exports.default; 34607module.exports.default = exports.default; 34608 34609},{"79312c853868713f":"fQT2o"}],"1wb11":[function(require,module,exports,__globalThis) { 34610"use strict"; 34611Object.defineProperty(exports, "__esModule", { 34612 value: true 34613}); 34614exports.default = isIPRange; 34615var _assertString = _interopRequireDefault(require("49e430a37cae71ba")); 34616var _isIP = _interopRequireDefault(require("92f9021554c592ab")); 34617function _interopRequireDefault(e) {
34618 return e && e.__esModule ? e : { 34619 default: e 34620 }; 34621} 34622var subnetMaybe = /^\d{1,3}$/; 34623var v4Subnet = 32; 34624var v6Subnet = 128; 34625function isIPRange(str) { 34626 var version = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : ''; 34627 (0, _assertString.default)(str); 34628 var parts = str.split('/'); 34629 // parts[0] -> ip, parts[1] -> subnet 34630 if (parts.length !== 2) return false; 34631 if (!subnetMaybe.test(parts[1])) return false; 34632 // Disallow preceding 0 i.e. 01, 02, ... 34633 if (parts[1].length > 1 && parts[1].startsWith('0')) return false; 34634 var isValidIP = (0, _isIP.default)(parts[0], version); 34635 if (!isValidIP) return false; 34636 // Define valid subnet according to IP's version 34637 var expectedSubnet = null; 34638 switch(String(version)){ 34639 case '4': 34640 expectedSubnet = v4Subnet; 34641 break; 34642 case '6': 34643 expectedSubnet = v6Subnet; 34644 break; 34645 default: 34646 expectedSubnet = (0, _isIP.default)(parts[0], '6') ? v6Subnet : v4Subnet; 34647 } 34648 return parts[1] <= expectedSubnet && parts[1] >= 0; 34649} 34650module.exports = exports.default; 34651module.exports.default = exports.default; 34652 34653},{"49e430a37cae71ba":"fQT2o","92f9021554c592ab":"4XTlO"}],"5brQk":[function(require,module,exports,__globalThis) { 34654"use strict"; 34655Object.defineProperty(exports, "__esModule", { 34656 value: true 34657}); 34658exports.default = isDate; 34659var _merge = _interopRequireDefault(require("21ec486863c5ab2")); 34660function _interopRequireDefault(e) { 34661 return e && e.__esModule ? e : { 34662 default: e 34663 }; 34664} 34665function _slicedToArray(r, e) { 34666 return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); 34667} 34668function _nonIterableRest() { 34669 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 34670} 34671function _iterableToArrayLimit(r, l) { 34672 var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; 34673 if (null != t) { 34674 var e, n, i, u, a = [], f = !0, o = !1; 34675 try { 34676 if (i = (t = t.call(r)).next, 0 === l) { 34677 if (Object(t) !== t) return; 34678 f = !1; 34679 } else for(; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); 34680 } catch (r) { 34681 o = !0, n = r; 34682 } finally{ 34683 try { 34684 if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; 34685 } finally{ 34686 if (o) throw n; 34687 } 34688 } 34689 return a; 34690 } 34691} 34692function _arrayWithHoles(r) { 34693 if (Array.isArray(r)) return r; 34694} 34695function _createForOfIteratorHelper(r, e) { 34696 var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; 34697 if (!t) { 34698 if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { 34699 t && (r = t); 34700 var _n = 0, F = function F() {}; 34701 return { 34702 s: F, 34703 n: function n() { 34704 return _n >= r.length ? { 34705 done: !0 34706 } : { 34707 done: !1, 34708 value: r[_n++] 34709 }; 34710 }, 34711 e: function e(r) { 34712 throw r; 34713 }, 34714 f: F 34715 }; 34716 } 34717 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 34718 } 34719 var o, a = !0, u = !1; 34720 return { 34721 s: function s() { 34722 t = t.call(r); 34723 }, 34724 n: function n() { 34725 var r = t.next(); 34726 return a = r.done, r; 34727 }, 34728 e: function e(r) { 34729 u = !0, o = r; 34730 }, 34731 f: function f() { 34732 try { 34733 a || null == t.return || t.return(); 34734 } finally{ 34735 if (u) throw o; 34736 } 34737 } 34738 }; 34739} 34740function _unsupportedIterableToArray(r, a) { 34741 if (r) { 34742 if ("string" == typeof r) return _arrayLikeToArray(r, a); 34743 var t = ({}).toString.call(r).slice(8, -1); 34744 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; 34745 } 34746} 34747function _arrayLikeToArray(r, a) { 34748 (null == a || a > r.length) && (a = r.length); 34749 for(var e = 0, n = Array(a); e < a; e++)n[e] = r[e]; 34750 return n; 34751} 34752var default_date_options = { 34753 format: 'YYYY/MM/DD', 34754 delimiters: [ 34755 '/',
34756 '-' 34757 ], 34758 strictMode: false 34759}; 34760function isValidFormat(format) { 34761 return /(^(y{4}|y{2})[.\/-](m{1,2})[.\/-](d{1,2})$)|(^(m{1,2})[.\/-](d{1,2})[.\/-]((y{4}|y{2})$))|(^(d{1,2})[.\/-](m{1,2})[.\/-]((y{4}|y{2})$))/gi.test(format); 34762} 34763function zip(date, format) { 34764 var zippedArr = [], len = Math.max(date.length, format.length); 34765 for(var i = 0; i < len; i++)zippedArr.push([ 34766 date[i], 34767 format[i] 34768 ]); 34769 return zippedArr; 34770} 34771function isDate(input, options) { 34772 if (typeof options === 'string') // Allow backward compatibility for old format isDate(input [, format]) 34773 options = (0, _merge.default)({ 34774 format: options 34775 }, default_date_options); 34776 else options = (0, _merge.default)(options, default_date_options); 34777 if (typeof input === 'string' && isValidFormat(options.format)) { 34778 if (options.strictMode && input.length !== options.format.length) return false; 34779 var formatDelimiter = options.delimiters.find(function(delimiter) { 34780 return options.format.indexOf(delimiter) !== -1; 34781 }); 34782 var dateDelimiter = options.strictMode ? formatDelimiter : options.delimiters.find(function(delimiter) { 34783 return input.indexOf(delimiter) !== -1; 34784 }); 34785 var dateAndFormat = zip(input.split(dateDelimiter), options.format.toLowerCase().split(formatDelimiter)); 34786 var dateObj = {}; 34787 var _iterator = _createForOfIteratorHelper(dateAndFormat), _step; 34788 try { 34789 for(_iterator.s(); !(_step = _iterator.n()).done;){ 34790 var _step$value = _slicedToArray(_step.value, 2), dateWord = _step$value[0], formatWord = _step$value[1]; 34791 if (!dateWord || !formatWord || dateWord.length !== formatWord.length) return false; 34792 dateObj[formatWord.charAt(0)] = dateWord; 34793 } 34794 } catch (err) { 34795 _iterator.e(err); 34796 } finally{ 34797 _iterator.f(); 34798 } 34799 var fullYear = dateObj.y; 34800 // Check if the year starts with a hyphen 34801 if (fullYear.startsWith('-')) return false; // Hyphen before year is not allowed 34802 if (dateObj.y.length === 2) { 34803 var parsedYear = parseInt(dateObj.y, 10); 34804 if (isNaN(parsedYear)) return false; 34805 var currentYearLastTwoDigits = new Date().getFullYear() % 100; 34806 if (parsedYear < currentYearLastTwoDigits) fullYear = "20".concat(dateObj.y); 34807 else fullYear = "19".concat(dateObj.y); 34808 } 34809 var month = dateObj.m; 34810 if (dateObj.m.length === 1) month = "0".concat(dateObj.m); 34811 var day = dateObj.d; 34812 if (dateObj.d.length === 1) day = "0".concat(dateObj.d); 34813 return new Date("".concat(fullYear, "-").concat(month, "-").concat(day, "T00:00:00.000Z")).getUTCDate() === +dateObj.d; 34814 } 34815 if (!options.strictMode) return Object.prototype.toString.call(input) === '[object Date]' && isFinite(input); 34816 return false; 34817} 34818module.exports = exports.default; 34819module.exports.default = exports.default; 34820 34821},{"21ec486863c5ab2":"bRDoK"}],"iAI8C":[function(require,module,exports,__globalThis) { 34822"use strict"; 34823Object.defineProperty(exports, "__esModule", { 34824 value: true 34825}); 34826exports.default = isTime; 34827var _merge = _interopRequireDefault(require("26fc1ee165383c3f")); 34828function _interopRequireDefault(e) { 34829 return e && e.__esModule ? e : { 34830 default: e 34831 }; 34832} 34833var default_time_options = { 34834 hourFormat: 'hour24', 34835 mode: 'default' 34836}; 34837var formats = { 34838 hour24: { 34839 default: /^([01]?[0-9]|2[0-3]):([0-5][0-9])$/, 34840 withSeconds: /^([01]?[0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9])$/, 34841 withOptionalSeconds: /^([01]?[0-9]|2[0-3]):([0-5][0-9])(?::([0-5][0-9]))?$/ 34842 }, 34843 hour12: { 34844 default: /^(0?[1-9]|1[0-2]):([0-5][0-9]) (A|P)M$/, 34845 withSeconds: /^(0?[1-9]|1[0-2]):([0-5][0-9]):([0-5][0-9]) (A|P)M$/, 34846 withOptionalSeconds: /^(0?[1-9]|1[0-2]):([0-5][0-9])(?::([0-5][0-9]))? (A|P)M$/ 34847 } 34848}; 34849function isTime(input, options) { 34850 options = (0, _merge.default)(options, default_time_options); 34851 if (typeof input !== 'string') return false;
34852 return formats[options.hourFormat][options.mode].test(input); 34853} 34854module.exports = exports.default; 34855module.exports.default = exports.default; 34856 34857},{"26fc1ee165383c3f":"bRDoK"}],"bf4vU":[function(require,module,exports,__globalThis) { 34858"use strict"; 34859Object.defineProperty(exports, "__esModule", { 34860 value: true 34861}); 34862exports.default = isBoolean; 34863var _assertString = _interopRequireDefault(require("e4a745c2125b138a")); 34864var _includesArray = _interopRequireDefault(require("3b53954d00e4ce85")); 34865function _interopRequireDefault(e) { 34866 return e && e.__esModule ? e : { 34867 default: e 34868 }; 34869} 34870var defaultOptions = { 34871 loose: false 34872}; 34873var strictBooleans = [ 34874 'true', 34875 'false', 34876 '1', 34877 '0' 34878]; 34879var looseBooleans = [].concat(strictBooleans, [ 34880 'yes', 34881 'no' 34882]); 34883function isBoolean(str) { 34884 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultOptions; 34885 (0, _assertString.default)(str); 34886 if (options.loose) return (0, _includesArray.default)(looseBooleans, str.toLowerCase()); 34887 return (0, _includesArray.default)(strictBooleans, str); 34888} 34889module.exports = exports.default; 34890module.exports.default = exports.default; 34891 34892},{"e4a745c2125b138a":"fQT2o","3b53954d00e4ce85":"iWyrT"}],"iWyrT":[function(require,module,exports,__globalThis) { 34893"use strict"; 34894Object.defineProperty(exports, "__esModule", { 34895 value: true 34896}); 34897exports.default = void 0; 34898var includes = function includes(arr, val) { 34899 return arr.some(function(arrVal) { 34900 return val === arrVal; 34901 }); 34902}; 34903var _default = exports.default = includes; 34904module.exports = exports.default; 34905module.exports.default = exports.default; 34906 34907},{}],"dAGFU":[function(require,module,exports,__globalThis) { 34908"use strict"; 34909Object.defineProperty(exports, "__esModule", { 34910 value: true 34911}); 34912exports.default = isLocale; 34913var _assertString = _interopRequireDefault(require("cbb9231b4b7081aa")); 34914function _interopRequireDefault(e) { 34915 return e && e.__esModule ? e : { 34916 default: e 34917 }; 34918} 34919/* 34920 = 3ALPHA ; selected ISO 639 codes 34921 *2("-" 3ALPHA) ; permanently reserved 34922 */ var extlang = '([A-Za-z]{3}(-[A-Za-z]{3}){0,2})'; 34923/* 34924 = 2*3ALPHA ; shortest ISO 639 code 34925 ["-" extlang] ; sometimes followed by 34926 ; extended language subtags 34927 / 4ALPHA ; or reserved for future use 34928 / 5*8ALPHA ; or registered language subtag 34929 */ var language = "(([a-zA-Z]{2,3}(-".concat(extlang, ")?)|([a-zA-Z]{5,8}))"); 34930/* 34931 = 4ALPHA ; ISO 15924 code 34932 */ var script = '([A-Za-z]{4})'; 34933/* 34934 = 2ALPHA ; ISO 3166-1 code 34935 / 3DIGIT ; UN M.49 code 34936 */ var region = '([A-Za-z]{2}|\\d{3})'; 34937/* 34938 = 5*8alphanum ; registered variants 34939 / (DIGIT 3alphanum) 34940 */ var variant = '([A-Za-z0-9]{5,8}|(\\d[A-Z-a-z0-9]{3}))'; 34941/* 34942 = DIGIT ; 0 - 9 34943 / %x41-57 ; A - W 34944 / %x59-5A ; Y - Z 34945 / %x61-77 ; a - w 34946 / %x79-7A ; y - z 34947 */ var singleton = '(\\d|[A-W]|[Y-Z]|[a-w]|[y-z])'; 34948/* 34949 = singleton 1*("-" (2*8alphanum)) 34950 ; Single alphanumerics 34951 ; "x" reserved for private use 34952 */ var extension = "(".concat(singleton, "(-[A-Za-z0-9]{2,8})+)"); 34953/* 34954 = "x" 1*("-" (1*8alphanum)) 34955 */ var privateuse = '(x(-[A-Za-z0-9]{1,8})+)'; 34956// irregular tags do not match the 'langtag' production and would not 34957// otherwise be considered 'well-formed'. These tags are all valid, but
34958// most are deprecated in favor of more modern subtags or subtag combination 34959var irregular = "((en-GB-oed)|(i-ami)|(i-bnn)|(i-default)|(i-enochian)|(i-hak)|(i-klingon)|(i-lux)|(i-mingo)|(i-navajo)|(i-pwn)|(i-tao)|(i-tay)|(i-tsu)|(sgn-BE-FR)|(sgn-BE-NL)|(sgn-CH-DE))"; 34960// regular tags match the 'langtag' production, but their subtags are not 34961// extended language or variant subtags: their meaning is defined by 34962// their registration and all of these are deprecated in favor of a more 34963// modern subtag or sequence of subtags 34964var regular = "((art-lojban)|(cel-gaulish)|(no-bok)|(no-nyn)|(zh-guoyu)|(zh-hakka)|(zh-min)|(zh-min-nan)|(zh-xiang))"; 34965/* 34966 = irregular ; non-redundant tags registered 34967 / regular ; during the RFC 3066 era 34968 34969 */ var grandfathered = "(".concat(irregular, "|").concat(regular, ")"); 34970/* 34971 RFC 5646 defines delimitation of subtags via a hyphen: 34972 34973 "Subtag" refers to a specific section of a tag, delimited by a 34974 hyphen, such as the subtags 'zh', 'Hant', and 'CN' in the tag "zh- 34975 Hant-CN". Examples of subtags in this document are enclosed in 34976 single quotes ('Hant') 34977 34978 However, we need to add "_" to maintain the existing behaviour. 34979 */ var delimiter = '(-|_)'; 34980/* 34981 = language 34982 ["-" script] 34983 ["-" region] 34984 *("-" variant) 34985 *("-" extension) 34986 ["-" privateuse] 34987 */ var langtag = "".concat(language, "(").concat(delimiter).concat(script, ")?(").concat(delimiter).concat(region, ")?(").concat(delimiter).concat(variant, ")*(").concat(delimiter).concat(extension, ")*(").concat(delimiter).concat(privateuse, ")?"); 34988/* 34989 Regex implementation based on BCP RFC 5646 34990 Tags for Identifying Languages 34991 https://www.rfc-editor.org/rfc/rfc5646.html 34992 */ var languageTagRegex = new RegExp("(^".concat(privateuse, "$)|(^").concat(grandfathered, "$)|(^").concat(langtag, "$)")); 34993function isLocale(str) { 34994 (0, _assertString.default)(str); 34995 return languageTagRegex.test(str); 34996} 34997module.exports = exports.default; 34998module.exports.default = exports.default; 34999 35000},{"cbb9231b4b7081aa":"fQT2o"}],"1AzRL":[function(require,module,exports,__globalThis) { 35001"use strict"; 35002Object.defineProperty(exports, "__esModule", { 35003 value: true 35004}); 35005exports.default = isAbaRouting; 35006var _assertString = _interopRequireDefault(require("b1d6075922e8c95")); 35007function _interopRequireDefault(e) { 35008 return e && e.__esModule ? e : { 35009 default: e 35010 }; 35011} 35012// http://www.brainjar.com/js/validation/ 35013// https://www.aba.com/news-research/research-analysis/routing-number-policy-procedures 35014// series reserved for future use are excluded 35015var isRoutingReg = /^(?!(1[3-9])|(20)|(3[3-9])|(4[0-9])|(5[0-9])|(60)|(7[3-9])|(8[1-9])|(9[0-2])|(9[3-9]))[0-9]{9}$/; 35016function isAbaRouting(str) { 35017 (0, _assertString.default)(str); 35018 if (!isRoutingReg.test(str)) return false; 35019 var checkSumVal = 0; 35020 for(var i = 0; i < str.length; i++){ 35021 if (i % 3 === 0) checkSumVal += str[i] * 3; 35022 else if (i % 3 === 1) checkSumVal += str[i] * 7; 35023 else checkSumVal += str[i] * 1; 35024 } 35025 return checkSumVal % 10 === 0; 35026} 35027module.exports = exports.default; 35028module.exports.default = exports.default; 35029 35030},{"b1d6075922e8c95":"fQT2o"}],"bivQJ":[function(require,module,exports,__globalThis) { 35031"use strict"; 35032Object.defineProperty(exports, "__esModule", { 35033 value: true 35034}); 35035exports.default = isAlpha; 35036exports.locales = void 0; 35037var _assertString = _interopRequireDefault(require("3de6ada39536fbf2")); 35038var _alpha = require("d4074828d7de2cf"); 35039function _interopRequireDefault(e) { 35040 return e && e.__esModule ? e : { 35041 default: e 35042 }; 35043} 35044function isAlpha(_str) { 35045 var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US'; 35046 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 35047 (0, _assertString.default)(_str); 35048 var str = _str; 35049 var ignore = options.ignore; 35050 if (ignore) { 35051 if (ignore instanceof RegExp) str = str.replace(ignore, ''); 35052 else if (typeof ignore === 'string') str = str.replace(new RegExp("[".concat(ignore.replace(/[-[\]{}()*+?.,\\^$|#\\s]/g, '\\$&'), "]"), 'g'), ''); // escape regex for ignore 35053 else throw new Error('ignore should be instance of a String or RegExp'); 35054 } 35055 if (locale in _alpha.alpha) return _alpha.alpha[locale].test(str); 35056 throw new Error("Invalid locale '".concat(locale, "'")); 35057}
35058var locales = exports.locales = Object.keys(_alpha.alpha); 35059 35060},{"3de6ada39536fbf2":"fQT2o","d4074828d7de2cf":"hjTvb"}],"gA1aZ":[function(require,module,exports,__globalThis) { 35061"use strict"; 35062Object.defineProperty(exports, "__esModule", { 35063 value: true 35064}); 35065exports.default = isAlphanumeric; 35066exports.locales = void 0; 35067var _assertString = _interopRequireDefault(require("520f6a53265a5a16")); 35068var _alpha = require("ed60b4f95488eea0"); 35069function _interopRequireDefault(e) { 35070 return e && e.__esModule ? e : { 35071 default: e 35072 }; 35073} 35074function isAlphanumeric(_str) { 35075 var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US'; 35076 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 35077 (0, _assertString.default)(_str); 35078 var str = _str; 35079 var ignore = options.ignore; 35080 if (ignore) { 35081 if (ignore instanceof RegExp) str = str.replace(ignore, ''); 35082 else if (typeof ignore === 'string') str = str.replace(new RegExp("[".concat(ignore.replace(/[-[\]{}()*+?.,\\^$|#\\s]/g, '\\$&'), "]"), 'g'), ''); // escape regex for ignore 35083 else throw new Error('ignore should be instance of a String or RegExp'); 35084 } 35085 if (locale in _alpha.alphanumeric) return _alpha.alphanumeric[locale].test(str); 35086 throw new Error("Invalid locale '".concat(locale, "'")); 35087} 35088var locales = exports.locales = Object.keys(_alpha.alphanumeric); 35089 35090},{"520f6a53265a5a16":"fQT2o","ed60b4f95488eea0":"hjTvb"}],"eM4vX":[function(require,module,exports,__globalThis) { 35091"use strict"; 35092Object.defineProperty(exports, "__esModule", { 35093 value: true 35094}); 35095exports.default = isNumeric; 35096var _assertString = _interopRequireDefault(require("e19f95f48f597618")); 35097var _alpha = require("730cce541a5e2944"); 35098function _interopRequireDefault(e) { 35099 return e && e.__esModule ? e : { 35100 default: e 35101 }; 35102} 35103var numericNoSymbols = /^[0-9]+$/; 35104function isNumeric(str, options) { 35105 (0, _assertString.default)(str); 35106 if (options && options.no_symbols) return numericNoSymbols.test(str); 35107 return new RegExp("^[+-]?([0-9]*[".concat((options || {}).locale ? _alpha.decimal[options.locale] : '.', "])?[0-9]+$")).test(str); 35108} 35109module.exports = exports.default; 35110module.exports.default = exports.default; 35111 35112},{"e19f95f48f597618":"fQT2o","730cce541a5e2944":"hjTvb"}],"ifADU":[function(require,module,exports,__globalThis) { 35113"use strict"; 35114Object.defineProperty(exports, "__esModule", { 35115 value: true 35116}); 35117exports.default = isPassportNumber; 35118exports.locales = void 0; 35119var _assertString = _interopRequireDefault(require("714539f615d17435")); 35120function _interopRequireDefault(e) { 35121 return e && e.__esModule ? e : { 35122 default: e 35123 }; 35124} 35125/** 35126 * Reference: 35127 * https://en.wikipedia.org/ -- Wikipedia 35128 * https://docs.microsoft.com/en-us/microsoft-365/compliance/eu-passport-number -- EU Passport Number 35129 * https://countrycode.org/ -- Country Codes 35130 */ var passportRegexByCountryCode = { 35131 AM: /^[A-Z]{2}\d{7}$/, 35132 // ARMENIA 35133 AR: /^[A-Z]{3}\d{6}$/, 35134 // ARGENTINA 35135 AT: /^[A-Z]\d{7}$/, 35136 // AUSTRIA 35137 AU: /^[A-Z]\d{7}$/, 35138 // AUSTRALIA 35139 AZ: /^[A-Z]{1}\d{8}$/, 35140 // AZERBAIJAN 35141 BE: /^[A-Z]{2}\d{6}$/, 35142 // BELGIUM 35143 BG: /^\d{9}$/, 35144 // BULGARIA 35145 BR: /^[A-Z]{2}\d{6}$/, 35146 // BRAZIL 35147 BY: /^[A-Z]{2}\d{7}$/, 35148 // BELARUS 35149 CA: /^[A-Z]{2}\d{6}$|^[A-Z]\d{6}[A-Z]{2}$/, 35150 // CANADA 35151 CH: /^[A-Z]\d{7}$/, 35152 // SWITZERLAND 35153 CN: /^G\d{8}$|^E(?![IO])[A-Z0-9]\d{7}$/, 35154 // CHINA [G=Ordinary, E=Electronic] followed by 8-digits, or E followed by any UPPERCASE letter (except I and O) followed by 7 digits 35155 CY: /^[A-Z](\d{6}|\d{8})$/, 35156 // CYPRUS 35157 CZ: /^\d{8}$/, 35158 // CZECH REPUBLIC 35159 DE: /^[CFGHJKLMNPRTVWXYZ0-9]{9}$/, 35160 // GERMANY 35161 DK: /^\d{9}$/, 35162 // DENMARK 35163 DZ: /^\d{9}$/, 35164 // ALGERIA 35165 EE: /^([A-Z]\d{7}|[A-Z]{2}\d{7})$/, 35166 // ESTONIA (K followed by 7-digits), e-passports have 2 UPPERCASE followed by 7 digits 35167 ES: /^[A-Z0-9]{2}([A-Z0-9]?)\d{6}$/, 35168 // SPAIN 35169 FI: /^[A-Z]{2}\d{7}$/, 35170 // FINLAND 35171 FR: /^\d{2}[A-Z]{2}\d{5}$/, 35172 // FRANCE 35173 GB: /^\d{9}$/, 35174 // UNITED KINGDOM 35175 GR: /^[A-Z]{2}\d{7}$/, 35176 // GREECE 35177 HR: /^\d{9}$/, 35178 // CROATIA 35179 HU: /^[A-Z]{2}(\d{6}|\d{7})$/, 35180 // HUNGARY 35181 IE: /^[A-Z0-9]{2}\d{7}$/, 35182 // IRELAND 35183 IN: /^[A-Z]{1}-?\d{7}$/, 35184 // INDIA 35185 ID: /^[A-C]\d{7}$/, 35186 // INDONESIA 35187 IR: /^[A-Z]\d{8}$/, 35188 // IRAN 35189 IS: /^(A)\d{7}$/, 35190 // ICELAND 35191 IT: /^[A-Z0-9]{2}\d{7}$/, 35192 // ITALY 35193 JM: /^[Aa]\d{7}$/, 35194 // JAMAICA 35195 JP: /^[A-Z]{2}\d{7}$/, 35196 // JAPAN 35197 KR: /^[MS]\d{8}$/, 35198 // SOUTH KOREA, REPUBLIC OF KOREA, [S=PS Passports, M=PM Passports] 35199 KZ: /^[a-zA-Z]\d{7}$/, 35200 // KAZAKHSTAN 35201 LI: /^[a-zA-Z]\d{5}$/, 35202 // LIECHTENSTEIN 35203 LT: /^[A-Z0-9]{8}$/, 35204 // LITHUANIA 35205 LU: /^[A-Z0-9]{8}$/, 35206 // LUXEMBURG 35207 LV: /^[A-Z0-9]{2}\d{7}$/, 35208 // LATVIA 35209 LY: /^[A-Z0-9]{8}$/, 35210 // LIBYA 35211 MT: /^\d{7}$/, 35212 // MALTA 35213 MZ: /^([A-Z]{2}\d{7})|(\d{2}[A-Z]{2}\d{5})$/, 35214 // MOZAMBIQUE 35215 MY: /^[AHK]\d{8}$/, 35216 // MALAYSIA 35217 MX: /^\d{10,11}$/, 35218 // MEXICO 35219 NL: /^[A-Z]{2}[A-Z0-9]{6}\d$/, 35220 // NETHERLANDS 35221 NZ: /^([Ll]([Aa]|[Dd]|[Ff]|[Hh])|[Ee]([Aa]|[Pp])|[Nn])\d{6}$/, 35222 // NEW ZEALAND 35223 PH: /^([A-Z](\d{6}|\d{7}[A-Z]))|([A-Z]{2}(\d{6}|\d{7}))$/, 35224 // PHILIPPINES 35225 PK: /^[A-Z]{2}\d{7}$/, 35226 // PAKISTAN 35227 PL: /^[A-Z]{2}\d{7}$/, 35228 // POLAND 35229 PT: /^[A-Z]\d{6}$/, 35230 // PORTUGAL 35231 RO: /^\d{8,9}$/, 35232 // ROMANIA 35233 RU: /^\d{9}$/, 35234 // RUSSIAN FEDERATION 35235 SE: /^\d{8}$/, 35236 // SWEDEN 35237 SL: /^(P)[A-Z]\d{7}$/, 35238 // SLOVENIA 35239 SK: /^[0-9A-Z]\d{7}$/, 35240 // SLOVAKIA 35241 TH: /^[A-Z]{1,2}\d{6,7}$/, 35242 // THAILAND 35243 TR: /^[A-Z]\d{8}$/, 35244 // TURKEY 35245 UA: /^[A-Z]{2}\d{6}$/, 35246 // UKRAINE 35247 US: /^\d{9}$|^[A-Z]\d{8}$/, 35248 // UNITED STATES 35249 ZA: /^[TAMD]\d{8}$/ // SOUTH AFRICA 35250};
35251var locales = exports.locales = Object.keys(passportRegexByCountryCode); 35252/** 35253 * Check if str is a valid passport number 35254 * relative to provided ISO Country Code. 35255 * 35256 * @param {string} str 35257 * @param {string} countryCode 35258 * @return {boolean} 35259 */ function isPassportNumber(str, countryCode) { 35260 (0, _assertString.default)(str); 35261 /** Remove All Whitespaces, Convert to UPPERCASE */ var normalizedStr = str.replace(/\s/g, '').toUpperCase(); 35262 return countryCode.toUpperCase() in passportRegexByCountryCode && passportRegexByCountryCode[countryCode].test(normalizedStr); 35263} 35264 35265},{"714539f615d17435":"fQT2o"}],"5tdoB":[function(require,module,exports,__globalThis) { 35266"use strict"; 35267Object.defineProperty(exports, "__esModule", { 35268 value: true 35269}); 35270exports.default = isPort; 35271var _isInt = _interopRequireDefault(require("ceb270b40401a418")); 35272function _interopRequireDefault(e) { 35273 return e && e.__esModule ? e : { 35274 default: e 35275 }; 35276} 35277function isPort(str) { 35278 return (0, _isInt.default)(str, { 35279 allow_leading_zeroes: false, 35280 min: 0, 35281 max: 65535 35282 }); 35283} 35284module.exports = exports.default; 35285module.exports.default = exports.default; 35286 35287},{"ceb270b40401a418":"bTWDC"}],"bTWDC":[function(require,module,exports,__globalThis) { 35288"use strict"; 35289Object.defineProperty(exports, "__esModule", { 35290 value: true 35291}); 35292exports.default = isInt; 35293var _assertString = _interopRequireDefault(require("8ebbd5ce24100927")); 35294var _nullUndefinedCheck = _interopRequireDefault(require("f715a2f919224c3b")); 35295function _interopRequireDefault(e) { 35296 return e && e.__esModule ? e : { 35297 default: e 35298 }; 35299} 35300var int = /^(?:[-+]?(?:0|[1-9][0-9]*))$/; 35301var intLeadingZeroes = /^[-+]?[0-9]+$/; 35302function isInt(str, options) { 35303 (0, _assertString.default)(str); 35304 options = options || {}; 35305 // Get the regex to use for testing, based on whether 35306 // leading zeroes are allowed or not. 35307 var regex = options.allow_leading_zeroes === false ? int : intLeadingZeroes; 35308 // Check min/max/lt/gt 35309 var minCheckPassed = !options.hasOwnProperty('min') || (0, _nullUndefinedCheck.default)(options.min) || str >= options.min; 35310 var maxCheckPassed = !options.hasOwnProperty('max') || (0, _nullUndefinedCheck.default)(options.max) || str <= options.max; 35311 var ltCheckPassed = !options.hasOwnProperty('lt') || (0, _nullUndefinedCheck.default)(options.lt) || str < options.lt; 35312 var gtCheckPassed = !options.hasOwnProperty('gt') || (0, _nullUndefinedCheck.default)(options.gt) || str > options.gt; 35313 return regex.test(str) && minCheckPassed && maxCheckPassed && ltCheckPassed && gtCheckPassed; 35314} 35315module.exports = exports.default; 35316module.exports.default = exports.default; 35317 35318},{"8ebbd5ce24100927":"fQT2o","f715a2f919224c3b":"eADR8"}],"5bmdn":[function(require,module,exports,__globalThis) { 35319"use strict"; 35320Object.defineProperty(exports, "__esModule", { 35321 value: true 35322}); 35323exports.default = isLowercase; 35324var _assertString = _interopRequireDefault(require("1ee2c8d2c7e88eed")); 35325function _interopRequireDefault(e) { 35326 return e && e.__esModule ? e : { 35327 default: e 35328 }; 35329} 35330function isLowercase(str) { 35331 (0, _assertString.default)(str); 35332 return str === str.toLowerCase(); 35333} 35334module.exports = exports.default; 35335module.exports.default = exports.default; 35336 35337},{"1ee2c8d2c7e88eed":"fQT2o"}],"iqQKh":[function(require,module,exports,__globalThis) { 35338"use strict"; 35339Object.defineProperty(exports, "__esModule", { 35340 value: true 35341}); 35342exports.default = isUppercase; 35343var _assertString = _interopRequireDefault(require("f417d115d27f6ed3")); 35344function _interopRequireDefault(e) { 35345 return e && e.__esModule ? e : { 35346 default: e 35347 }; 35348} 35349function isUppercase(str) { 35350 (0, _assertString.default)(str); 35351 return str === str.toUpperCase(); 35352} 35353module.exports = exports.default; 35354module.exports.default = exports.default; 35355 35356},{"f417d115d27f6ed3":"fQT2o"}],"4oaAZ":[function(require,module,exports,__globalThis) { 35357"use strict"; 35358Object.defineProperty(exports, "__esModule", { 35359 value: true 35360}); 35361exports.default = isIMEI; 35362var _assertString = _interopRequireDefault(require("8bbb7aca98af1f13")); 35363function _interopRequireDefault(e) {
35364 return e && e.__esModule ? e : { 35365 default: e 35366 }; 35367} 35368var imeiRegexWithoutHyphens = /^[0-9]{15}$/; 35369var imeiRegexWithHyphens = /^\d{2}-\d{6}-\d{6}-\d{1}$/; 35370function isIMEI(str, options) { 35371 (0, _assertString.default)(str); 35372 options = options || {}; 35373 // default regex for checking imei is the one without hyphens 35374 var imeiRegex = imeiRegexWithoutHyphens; 35375 if (options.allow_hyphens) imeiRegex = imeiRegexWithHyphens; 35376 if (!imeiRegex.test(str)) return false; 35377 str = str.replace(/-/g, ''); 35378 var sum = 0, mul = 2, l = 14; 35379 for(var i = 0; i < l; i++){ 35380 var digit = str.substring(l - i - 1, l - i); 35381 var tp = parseInt(digit, 10) * mul; 35382 if (tp >= 10) sum += tp % 10 + 1; 35383 else sum += tp; 35384 if (mul === 1) mul += 1; 35385 else mul -= 1; 35386 } 35387 var chk = (10 - sum % 10) % 10; 35388 if (chk !== parseInt(str.substring(14, 15), 10)) return false; 35389 return true; 35390} 35391module.exports = exports.default; 35392module.exports.default = exports.default; 35393 35394},{"8bbb7aca98af1f13":"fQT2o"}],"6RJdV":[function(require,module,exports,__globalThis) { 35395"use strict"; 35396Object.defineProperty(exports, "__esModule", { 35397 value: true 35398}); 35399exports.default = isAscii; 35400var _assertString = _interopRequireDefault(require("f8e3ff0e3e37b31b")); 35401function _interopRequireDefault(e) { 35402 return e && e.__esModule ? e : { 35403 default: e 35404 }; 35405} 35406/* eslint-disable no-control-regex */ var ascii = /^[\x00-\x7F]+$/; 35407/* eslint-enable no-control-regex */ function isAscii(str) { 35408 (0, _assertString.default)(str); 35409 return ascii.test(str); 35410} 35411module.exports = exports.default; 35412module.exports.default = exports.default; 35413 35414},{"f8e3ff0e3e37b31b":"fQT2o"}],"jOJQE":[function(require,module,exports,__globalThis) { 35415"use strict"; 35416Object.defineProperty(exports, "__esModule", { 35417 value: true 35418}); 35419exports.default = isFullWidth; 35420exports.fullWidth = void 0; 35421var _assertString = _interopRequireDefault(require("4b21a4c150410eb7")); 35422function _interopRequireDefault(e) { 35423 return e && e.__esModule ? e : { 35424 default: e 35425 }; 35426} 35427var fullWidth = exports.fullWidth = /[^\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/; 35428function isFullWidth(str) { 35429 (0, _assertString.default)(str); 35430 return fullWidth.test(str); 35431} 35432 35433},{"4b21a4c150410eb7":"fQT2o"}],"bDWyR":[function(require,module,exports,__globalThis) { 35434"use strict"; 35435Object.defineProperty(exports, "__esModule", { 35436 value: true 35437}); 35438exports.default = isHalfWidth; 35439exports.halfWidth = void 0; 35440var _assertString = _interopRequireDefault(require("37381c2b4f6926f4")); 35441function _interopRequireDefault(e) { 35442 return e && e.__esModule ? e : { 35443 default: e 35444 }; 35445} 35446var halfWidth = exports.halfWidth = /[\u0020-\u007E\uFF61-\uFF9F\uFFA0-\uFFDC\uFFE8-\uFFEE0-9a-zA-Z]/; 35447function isHalfWidth(str) { 35448 (0, _assertString.default)(str); 35449 return halfWidth.test(str); 35450} 35451 35452},{"37381c2b4f6926f4":"fQT2o"}],"350pT":[function(require,module,exports,__globalThis) { 35453"use strict"; 35454Object.defineProperty(exports, "__esModule", { 35455 value: true 35456}); 35457exports.default = isVariableWidth; 35458var _assertString = _interopRequireDefault(require("e68b882a4d50d00f")); 35459var _isFullWidth = require("486edb07b731fb47"); 35460var _isHalfWidth = require("5e30555678e0f073"); 35461function _interopRequireDefault(e) { 35462 return e && e.__esModule ? e : { 35463 default: e 35464 }; 35465} 35466function isVariableWidth(str) { 35467 (0, _assertString.default)(str); 35468 return _isFullWidth.fullWidth.test(str) && _isHalfWidth.halfWidth.test(str); 35469} 35470module.exports = exports.default; 35471module.exports.default = exports.default; 35472 35473},{"e68b882a4d50d00f":"fQT2o","486edb07b731fb47":"jOJQE","5e30555678e0f073":"bDWyR"}],"49VS5":[function(require,module,exports,__globalThis) { 35474"use strict"; 35475Object.defineProperty(exports, "__esModule", { 35476 value: true 35477}); 35478exports.default = isMultibyte; 35479var _assertString = _interopRequireDefault(require("33484d2fae22c942")); 35480function _interopRequireDefault(e) { 35481 return e && e.__esModule ? e : { 35482 default: e 35483 }; 35484} 35485/* eslint-disable no-control-regex */ var multibyte = /[^\x00-\x7F]/; 35486/* eslint-enable no-control-regex */ function isMultibyte(str) { 35487 (0, _assertString.default)(str); 35488 return multibyte.test(str); 35489} 35490module.exports = exports.default; 35491module.exports.default = exports.default; 35492 35493},{"33484d2fae22c942":"fQT2o"}],"jF9PT":[function(require,module,exports,__globalThis) { 35494"use strict"; 35495Object.defineProperty(exports, "__esModule", { 35496 value: true 35497}); 35498exports.default = isSemVer; 35499var _assertString = _interopRequireDefault(require("33759b3f8439f352")); 35500var _multilineRegex = _interopRequireDefault(require("98d1c477d4f11dd9")); 35501function _interopRequireDefault(e) {
35502 return e && e.__esModule ? e : { 35503 default: e 35504 }; 35505} 35506/** 35507 * Regular Expression to match 35508 * semantic versioning (SemVer) 35509 * built from multi-line, multi-parts regexp 35510 * Reference: https://semver.org/ 35511 */ var semanticVersioningRegex = (0, _multilineRegex.default)([ 35512 '^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)', 35513 '(?:-((?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-z-][0-9a-z-]*))*))', 35514 '?(?:\\+([0-9a-z-]+(?:\\.[0-9a-z-]+)*))?$' 35515], 'i'); 35516function isSemVer(str) { 35517 (0, _assertString.default)(str); 35518 return semanticVersioningRegex.test(str); 35519} 35520module.exports = exports.default; 35521module.exports.default = exports.default; 35522 35523},{"33759b3f8439f352":"fQT2o","98d1c477d4f11dd9":"1vRlT"}],"1vRlT":[function(require,module,exports,__globalThis) { 35524"use strict"; 35525Object.defineProperty(exports, "__esModule", { 35526 value: true 35527}); 35528exports.default = multilineRegexp; 35529/** 35530 * Build RegExp object from an array 35531 * of multiple/multi-line regexp parts 35532 * 35533 * @param {string[]} parts 35534 * @param {string} flags 35535 * @return {object} - RegExp object 35536 */ function multilineRegexp(parts, flags) { 35537 var regexpAsStringLiteral = parts.join(''); 35538 return new RegExp(regexpAsStringLiteral, flags); 35539} 35540module.exports = exports.default; 35541module.exports.default = exports.default; 35542 35543},{}],"lqBmi":[function(require,module,exports,__globalThis) { 35544"use strict"; 35545Object.defineProperty(exports, "__esModule", { 35546 value: true 35547}); 35548exports.default = isSurrogatePair; 35549var _assertString = _interopRequireDefault(require("b613f192d52b05f1")); 35550function _interopRequireDefault(e) { 35551 return e && e.__esModule ? e : { 35552 default: e 35553 }; 35554} 35555var surrogatePair = /[\uD800-\uDBFF][\uDC00-\uDFFF]/; 35556function isSurrogatePair(str) { 35557 (0, _assertString.default)(str); 35558 return surrogatePair.test(str); 35559} 35560module.exports = exports.default; 35561module.exports.default = exports.default; 35562 35563},{"b613f192d52b05f1":"fQT2o"}],"7rUFg":[function(require,module,exports,__globalThis) { 35564"use strict"; 35565Object.defineProperty(exports, "__esModule", { 35566 value: true 35567}); 35568exports.default = isDecimal; 35569var _merge = _interopRequireDefault(require("ba000004315aa430")); 35570var _assertString = _interopRequireDefault(require("836c7d5280428cba")); 35571var _includesArray = _interopRequireDefault(require("90b800336fb8cf33")); 35572var _alpha = require("798092a5626c7220"); 35573function _interopRequireDefault(e) { 35574 return e && e.__esModule ? e : { 35575 default: e 35576 }; 35577} 35578function decimalRegExp(options) { 35579 var regExp = new RegExp("^[-+]?([0-9]+)?(\\".concat(_alpha.decimal[options.locale], "[0-9]{").concat(options.decimal_digits, "})").concat(options.force_decimal ? '' : '?', "$")); 35580 return regExp; 35581} 35582var default_decimal_options = { 35583 force_decimal: false, 35584 decimal_digits: '1,', 35585 locale: 'en-US' 35586}; 35587var blacklist = [ 35588 '', 35589 '-', 35590 '+' 35591]; 35592function isDecimal(str, options) { 35593 (0, _assertString.default)(str); 35594 options = (0, _merge.default)(options, default_decimal_options); 35595 if (options.locale in _alpha.decimal) return !(0, _includesArray.default)(blacklist, str.replace(/ /g, '')) && decimalRegExp(options).test(str); 35596 throw new Error("Invalid locale '".concat(options.locale, "'")); 35597} 35598module.exports = exports.default; 35599module.exports.default = exports.default; 35600 35601},{"ba000004315aa430":"bRDoK","836c7d5280428cba":"fQT2o","90b800336fb8cf33":"iWyrT","798092a5626c7220":"hjTvb"}],"lxVTo":[function(require,module,exports,__globalThis) { 35602"use strict"; 35603Object.defineProperty(exports, "__esModule", { 35604 value: true 35605}); 35606exports.default = isHexadecimal; 35607var _assertString = _interopRequireDefault(require("85ad369b649033ec")); 35608function _interopRequireDefault(e) { 35609 return e && e.__esModule ? e : { 35610 default: e 35611 }; 35612} 35613var hexadecimal = /^(0x|0h)?[0-9A-F]+$/i; 35614function isHexadecimal(str) { 35615 (0, _assertString.default)(str); 35616 return hexadecimal.test(str); 35617} 35618module.exports = exports.default; 35619module.exports.default = exports.default; 35620 35621},{"85ad369b649033ec":"fQT2o"}],"25WR1":[function(require,module,exports,__globalThis) { 35622"use strict"; 35623Object.defineProperty(exports, "__esModule", { 35624 value: true 35625}); 35626exports.default = isOctal; 35627var _assertString = _interopRequireDefault(require("f6469bb3e63d39a")); 35628function _interopRequireDefault(e) {
35629 return e && e.__esModule ? e : { 35630 default: e 35631 }; 35632} 35633var octal = /^(0o)?[0-7]+$/i; 35634function isOctal(str) { 35635 (0, _assertString.default)(str); 35636 return octal.test(str); 35637} 35638module.exports = exports.default; 35639module.exports.default = exports.default; 35640 35641},{"f6469bb3e63d39a":"fQT2o"}],"2pfdH":[function(require,module,exports,__globalThis) { 35642"use strict"; 35643Object.defineProperty(exports, "__esModule", { 35644 value: true 35645}); 35646exports.default = isDivisibleBy; 35647var _assertString = _interopRequireDefault(require("9a6c24154d57117f")); 35648var _toFloat = _interopRequireDefault(require("d19aeb34bda3b837")); 35649function _interopRequireDefault(e) { 35650 return e && e.__esModule ? e : { 35651 default: e 35652 }; 35653} 35654function isDivisibleBy(str, num) { 35655 (0, _assertString.default)(str); 35656 return (0, _toFloat.default)(str) % parseInt(num, 10) === 0; 35657} 35658module.exports = exports.default; 35659module.exports.default = exports.default; 35660 35661},{"9a6c24154d57117f":"fQT2o","d19aeb34bda3b837":"bVJYg"}],"lza2J":[function(require,module,exports,__globalThis) { 35662"use strict"; 35663Object.defineProperty(exports, "__esModule", { 35664 value: true 35665}); 35666exports.default = isHexColor; 35667var _assertString = _interopRequireDefault(require("f649663ed99a258c")); 35668function _interopRequireDefault(e) { 35669 return e && e.__esModule ? e : { 35670 default: e 35671 }; 35672} 35673var hexcolor = /^#?([0-9A-F]{3}|[0-9A-F]{4}|[0-9A-F]{6}|[0-9A-F]{8})$/i; 35674function isHexColor(str) { 35675 (0, _assertString.default)(str); 35676 return hexcolor.test(str); 35677} 35678module.exports = exports.default; 35679module.exports.default = exports.default; 35680 35681},{"f649663ed99a258c":"fQT2o"}],"9crOE":[function(require,module,exports,__globalThis) { 35682"use strict"; 35683Object.defineProperty(exports, "__esModule", { 35684 value: true 35685}); 35686exports.default = isRgbColor; 35687var _assertString = _interopRequireDefault(require("15ec9a5279ab3c75")); 35688function _interopRequireDefault(e) { 35689 return e && e.__esModule ? e : { 35690 default: e 35691 }; 35692} 35693function _typeof(o) { 35694 "@babel/helpers - typeof"; 35695 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { 35696 return typeof o; 35697 } : function(o) { 35698 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 35699 }, _typeof(o); 35700} /* eslint-disable prefer-rest-params */ 35701var rgbColor = /^rgb\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){2}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\)$/; 35702var rgbaColor = /^rgba\((([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]),){3}(0?\.\d\d?|1(\.0)?|0(\.0)?)\)$/; 35703var rgbColorPercent = /^rgb\((([0-9]%|[1-9][0-9]%|100%),){2}([0-9]%|[1-9][0-9]%|100%)\)$/; 35704var rgbaColorPercent = /^rgba\((([0-9]%|[1-9][0-9]%|100%),){3}(0?\.\d\d?|1(\.0)?|0(\.0)?)\)$/; 35705var startsWithRgb = /^rgba?/; 35706function isRgbColor(str, options) { 35707 (0, _assertString.default)(str); 35708 // default options to true for percent and false for spaces 35709 var allowSpaces = false; 35710 var includePercentValues = true; 35711 if (_typeof(options) !== 'object') { 35712 if (arguments.length >= 2) includePercentValues = arguments[1]; 35713 } else { 35714 allowSpaces = options.allowSpaces !== undefined ? options.allowSpaces : allowSpaces; 35715 includePercentValues = options.includePercentValues !== undefined ? options.includePercentValues : includePercentValues; 35716 } 35717 if (allowSpaces) { 35718 // make sure it starts with continous rgba? without spaces before stripping 35719 if (!startsWithRgb.test(str)) return false; 35720 // strip all whitespace 35721 str = str.replace(/\s/g, ''); 35722 } 35723 if (!includePercentValues) return rgbColor.test(str) || rgbaColor.test(str); 35724 return rgbColor.test(str) || rgbaColor.test(str) || rgbColorPercent.test(str) || rgbaColorPercent.test(str); 35725} 35726module.exports = exports.default; 35727module.exports.default = exports.default; 35728 35729},{"15ec9a5279ab3c75":"fQT2o"}],"1a2xz":[function(require,module,exports,__globalThis) { 35730"use strict"; 35731Object.defineProperty(exports, "__esModule", { 35732 value: true 35733}); 35734exports.default = isHSL; 35735var _assertString = _interopRequireDefault(require("59f30491d05ba1cf")); 35736function _interopRequireDefault(e) {
35737 return e && e.__esModule ? e : { 35738 default: e 35739 }; 35740} 35741var hslComma = /^hsla?\(((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?))(deg|grad|rad|turn)?(,(\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%){2}(,((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%?))?\)$/i; 35742var hslSpace = /^hsla?\(((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?))(deg|grad|rad|turn)?(\s(\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%){2}\s?(\/\s((\+|\-)?([0-9]+(\.[0-9]+)?(e(\+|\-)?[0-9]+)?|\.[0-9]+(e(\+|\-)?[0-9]+)?)%?)\s?)?\)$/i; 35743function isHSL(str) { 35744 (0, _assertString.default)(str); 35745 // Strip duplicate spaces before calling the validation regex (See #1598 for more info) 35746 var strippedStr = str.replace(/\s+/g, ' ').replace(/\s?(hsla?\(|\)|,)\s?/ig, '$1'); 35747 if (strippedStr.indexOf(',') !== -1) return hslComma.test(strippedStr); 35748 return hslSpace.test(strippedStr); 35749} 35750module.exports = exports.default; 35751module.exports.default = exports.default; 35752 35753},{"59f30491d05ba1cf":"fQT2o"}],"enrCZ":[function(require,module,exports,__globalThis) { 35754"use strict"; 35755Object.defineProperty(exports, "__esModule", { 35756 value: true 35757}); 35758exports.default = isISRC; 35759var _assertString = _interopRequireDefault(require("b9b27d76af9c95dc")); 35760function _interopRequireDefault(e) { 35761 return e && e.__esModule ? e : { 35762 default: e 35763 }; 35764} 35765// see http://isrc.ifpi.org/en/isrc-standard/code-syntax 35766var isrc = /^[A-Z]{2}[0-9A-Z]{3}\d{2}\d{5}$/; 35767function isISRC(str) { 35768 (0, _assertString.default)(str); 35769 return isrc.test(str); 35770} 35771module.exports = exports.default; 35772module.exports.default = exports.default; 35773 35774},{"b9b27d76af9c95dc":"fQT2o"}],"a8GAq":[function(require,module,exports,__globalThis) { 35775"use strict"; 35776Object.defineProperty(exports, "__esModule", { 35777 value: true 35778}); 35779exports.default = isIBAN; 35780exports.locales = void 0; 35781var _assertString = _interopRequireDefault(require("dc8c49b753cc6388")); 35782var _includesArray = _interopRequireDefault(require("4872734283a3219c")); 35783function _interopRequireDefault(e) { 35784 return e && e.__esModule ? e : { 35785 default: e 35786 }; 35787} 35788/** 35789 * List of country codes with 35790 * corresponding IBAN regular expression 35791 * Reference: https://en.wikipedia.org/wiki/International_Bank_Account_Number 35792 */ var ibanRegexThroughCountryCode = { 35793 AD: /^(AD[0-9]{2})\d{8}[A-Z0-9]{12}$/, 35794 AE: /^(AE[0-9]{2})\d{3}\d{16}$/, 35795 AL: /^(AL[0-9]{2})\d{8}[A-Z0-9]{16}$/, 35796 AT: /^(AT[0-9]{2})\d{16}$/, 35797 AZ: /^(AZ[0-9]{2})[A-Z0-9]{4}\d{20}$/, 35798 BA: /^(BA[0-9]{2})\d{16}$/, 35799 BE: /^(BE[0-9]{2})\d{12}$/, 35800 BG: /^(BG[0-9]{2})[A-Z]{4}\d{6}[A-Z0-9]{8}$/, 35801 BH: /^(BH[0-9]{2})[A-Z]{4}[A-Z0-9]{14}$/, 35802 BR: /^(BR[0-9]{2})\d{23}[A-Z]{1}[A-Z0-9]{1}$/, 35803 BY: /^(BY[0-9]{2})[A-Z0-9]{4}\d{20}$/, 35804 CH: /^(CH[0-9]{2})\d{5}[A-Z0-9]{12}$/, 35805 CR: /^(CR[0-9]{2})\d{18}$/, 35806 CY: /^(CY[0-9]{2})\d{8}[A-Z0-9]{16}$/, 35807 CZ: /^(CZ[0-9]{2})\d{20}$/, 35808 DE: /^(DE[0-9]{2})\d{18}$/, 35809 DK: /^(DK[0-9]{2})\d{14}$/, 35810 DO: /^(DO[0-9]{2})[A-Z]{4}\d{20}$/, 35811 DZ: /^(DZ\d{24})$/, 35812 EE: /^(EE[0-9]{2})\d{16}$/, 35813 EG: /^(EG[0-9]{2})\d{25}$/, 35814 ES: /^(ES[0-9]{2})\d{20}$/, 35815 FI: /^(FI[0-9]{2})\d{14}$/, 35816 FO: /^(FO[0-9]{2})\d{14}$/, 35817 FR: /^(FR[0-9]{2})\d{10}[A-Z0-9]{11}\d{2}$/, 35818 GB: /^(GB[0-9]{2})[A-Z]{4}\d{14}$/, 35819 GE: /^(GE[0-9]{2})[A-Z0-9]{2}\d{16}$/, 35820 GI: /^(GI[0-9]{2})[A-Z]{4}[A-Z0-9]{15}$/, 35821 GL: /^(GL[0-9]{2})\d{14}$/, 35822 GR: /^(GR[0-9]{2})\d{7}[A-Z0-9]{16}$/, 35823 GT: /^(GT[0-9]{2})[A-Z0-9]{4}[A-Z0-9]{20}$/, 35824 HR: /^(HR[0-9]{2})\d{17}$/, 35825 HU: /^(HU[0-9]{2})\d{24}$/, 35826 IE: /^(IE[0-9]{2})[A-Z]{4}\d{14}$/, 35827 IL: /^(IL[0-9]{2})\d{19}$/, 35828 IQ: /^(IQ[0-9]{2})[A-Z]{4}\d{15}$/, 35829 IR: /^(IR[0-9]{2})0\d{2}0\d{18}$/, 35830 IS: /^(IS[0-9]{2})\d{22}$/, 35831 IT: /^(IT[0-9]{2})[A-Z]{1}\d{10}[A-Z0-9]{12}$/, 35832 JO: /^(JO[0-9]{2})[A-Z]{4}\d{22}$/, 35833 KW: /^(KW[0-9]{2})[A-Z]{4}[A-Z0-9]{22}$/, 35834 KZ: /^(KZ[0-9]{2})\d{3}[A-Z0-9]{13}$/, 35835 LB: /^(LB[0-9]{2})\d{4}[A-Z0-9]{20}$/, 35836 LC: /^(LC[0-9]{2})[A-Z]{4}[A-Z0-9]{24}$/, 35837 LI: /^(LI[0-9]{2})\d{5}[A-Z0-9]{12}$/, 35838 LT: /^(LT[0-9]{2})\d{16}$/, 35839 LU: /^(LU[0-9]{2})\d{3}[A-Z0-9]{13}$/,
35840 LV: /^(LV[0-9]{2})[A-Z]{4}[A-Z0-9]{13}$/, 35841 MA: /^(MA[0-9]{26})$/, 35842 MC: /^(MC[0-9]{2})\d{10}[A-Z0-9]{11}\d{2}$/, 35843 MD: /^(MD[0-9]{2})[A-Z0-9]{20}$/, 35844 ME: /^(ME[0-9]{2})\d{18}$/, 35845 MK: /^(MK[0-9]{2})\d{3}[A-Z0-9]{10}\d{2}$/, 35846 MR: /^(MR[0-9]{2})\d{23}$/, 35847 MT: /^(MT[0-9]{2})[A-Z]{4}\d{5}[A-Z0-9]{18}$/, 35848 MU: /^(MU[0-9]{2})[A-Z]{4}\d{19}[A-Z]{3}$/, 35849 MZ: /^(MZ[0-9]{2})\d{21}$/, 35850 NL: /^(NL[0-9]{2})[A-Z]{4}\d{10}$/, 35851 NO: /^(NO[0-9]{2})\d{11}$/, 35852 PK: /^(PK[0-9]{2})[A-Z0-9]{4}\d{16}$/, 35853 PL: /^(PL[0-9]{2})\d{24}$/, 35854 PS: /^(PS[0-9]{2})[A-Z]{4}[A-Z0-9]{21}$/, 35855 PT: /^(PT[0-9]{2})\d{21}$/, 35856 QA: /^(QA[0-9]{2})[A-Z]{4}[A-Z0-9]{21}$/, 35857 RO: /^(RO[0-9]{2})[A-Z]{4}[A-Z0-9]{16}$/, 35858 RS: /^(RS[0-9]{2})\d{18}$/, 35859 SA: /^(SA[0-9]{2})\d{2}[A-Z0-9]{18}$/, 35860 SC: /^(SC[0-9]{2})[A-Z]{4}\d{20}[A-Z]{3}$/, 35861 SE: /^(SE[0-9]{2})\d{20}$/, 35862 SI: /^(SI[0-9]{2})\d{15}$/, 35863 SK: /^(SK[0-9]{2})\d{20}$/, 35864 SM: /^(SM[0-9]{2})[A-Z]{1}\d{10}[A-Z0-9]{12}$/, 35865 SV: /^(SV[0-9]{2})[A-Z0-9]{4}\d{20}$/, 35866 TL: /^(TL[0-9]{2})\d{19}$/, 35867 TN: /^(TN[0-9]{2})\d{20}$/, 35868 TR: /^(TR[0-9]{2})\d{5}[A-Z0-9]{17}$/, 35869 UA: /^(UA[0-9]{2})\d{6}[A-Z0-9]{19}$/, 35870 VA: /^(VA[0-9]{2})\d{18}$/, 35871 VG: /^(VG[0-9]{2})[A-Z]{4}\d{16}$/, 35872 XK: /^(XK[0-9]{2})\d{16}$/ 35873}; 35874/** 35875 * Check if the country codes passed are valid using the 35876 * ibanRegexThroughCountryCode as a reference 35877 * 35878 * @param {array} countryCodeArray 35879 * @return {boolean} 35880 */ function hasOnlyValidCountryCodes(countryCodeArray) { 35881 var countryCodeArrayFilteredWithObjectIbanCode = countryCodeArray.filter(function(countryCode) { 35882 return !(countryCode in ibanRegexThroughCountryCode); 35883 }); 35884 if (countryCodeArrayFilteredWithObjectIbanCode.length > 0) return false; 35885 return true; 35886} 35887/** 35888 * Check whether string has correct universal IBAN format 35889 * The IBAN consists of up to 34 alphanumeric characters, as follows: 35890 * Country Code using ISO 3166-1 alpha-2, two letters 35891 * check digits, two digits and 35892 * Basic Bank Account Number (BBAN), up to 30 alphanumeric characters. 35893 * NOTE: Permitted IBAN characters are: digits [0-9] and the 26 latin alphabetic [A-Z] 35894 * 35895 * @param {string} str - string under validation 35896 * @param {object} options - object to pass the countries to be either whitelisted or blacklisted 35897 * @return {boolean} 35898 */ function hasValidIbanFormat(str, options) {
35899 // Strip white spaces and hyphens 35900 var strippedStr = str.replace(/[\s\-]+/gi, '').toUpperCase(); 35901 var isoCountryCode = strippedStr.slice(0, 2).toUpperCase(); 35902 var isoCountryCodeInIbanRegexCodeObject = isoCountryCode in ibanRegexThroughCountryCode; 35903 if (options.whitelist) { 35904 if (!hasOnlyValidCountryCodes(options.whitelist)) return false; 35905 var isoCountryCodeInWhiteList = (0, _includesArray.default)(options.whitelist, isoCountryCode); 35906 if (!isoCountryCodeInWhiteList) return false; 35907 } 35908 if (options.blacklist) { 35909 var isoCountryCodeInBlackList = (0, _includesArray.default)(options.blacklist, isoCountryCode); 35910 if (isoCountryCodeInBlackList) return false; 35911 } 35912 return isoCountryCodeInIbanRegexCodeObject && ibanRegexThroughCountryCode[isoCountryCode].test(strippedStr); 35913} 35914/** 35915 * Check whether string has valid IBAN Checksum 35916 * by performing basic mod-97 operation and 35917 * the remainder should equal 1 35918 * -- Start by rearranging the IBAN by moving the four initial characters to the end of the string 35919 * -- Replace each letter in the string with two digits, A -> 10, B = 11, Z = 35 35920 * -- Interpret the string as a decimal integer and 35921 * -- compute the remainder on division by 97 (mod 97) 35922 * Reference: https://en.wikipedia.org/wiki/International_Bank_Account_Number 35923 * 35924 * @param {string} str 35925 * @return {boolean} 35926 */ function hasValidIbanChecksum(str) { 35927 var strippedStr = str.replace(/[^A-Z0-9]+/gi, '').toUpperCase(); // Keep only digits and A-Z latin alphabetic 35928 var rearranged = strippedStr.slice(4) + strippedStr.slice(0, 4); 35929 var alphaCapsReplacedWithDigits = rearranged.replace(/[A-Z]/g, function(char) { 35930 return char.charCodeAt(0) - 55; 35931 }); 35932 var remainder = alphaCapsReplacedWithDigits.match(/\d{1,7}/g).reduce(function(acc, value) { 35933 return Number(acc + value) % 97; 35934 }, ''); 35935 return remainder === 1; 35936} 35937function isIBAN(str) { 35938 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 35939 (0, _assertString.default)(str); 35940 return hasValidIbanFormat(str, options) && hasValidIbanChecksum(str); 35941} 35942var locales = exports.locales = Object.keys(ibanRegexThroughCountryCode); 35943 35944},{"dc8c49b753cc6388":"fQT2o","4872734283a3219c":"iWyrT"}],"4oTj2":[function(require,module,exports,__globalThis) { 35945"use strict"; 35946Object.defineProperty(exports, "__esModule", { 35947 value: true 35948}); 35949exports.default = isBIC; 35950var _assertString = _interopRequireDefault(require("d2180d3c377d0b4a")); 35951var _isISO31661Alpha = require("6c0405a7c16e731c"); 35952function _interopRequireDefault(e) { 35953 return e && e.__esModule ? e : { 35954 default: e 35955 }; 35956} 35957// https://en.wikipedia.org/wiki/ISO_9362 35958var isBICReg = /^[A-Za-z]{6}[A-Za-z0-9]{2}([A-Za-z0-9]{3})?$/; 35959function isBIC(str) { 35960 (0, _assertString.default)(str); 35961 // toUpperCase() should be removed when a new major version goes out that changes 35962 // the regex to [A-Z] (per the spec). 35963 var countryCode = str.slice(4, 6).toUpperCase(); 35964 if (!_isISO31661Alpha.CountryCodes.has(countryCode) && countryCode !== 'XK') return false; 35965 return isBICReg.test(str); 35966} 35967module.exports = exports.default; 35968module.exports.default = exports.default; 35969 35970},{"d2180d3c377d0b4a":"fQT2o","6c0405a7c16e731c":"kDcj4"}],"kDcj4":[function(require,module,exports,__globalThis) { 35971"use strict"; 35972Object.defineProperty(exports, "__esModule", { 35973 value: true 35974}); 35975exports.CountryCodes = void 0; 35976exports.default = isISO31661Alpha2; 35977var _assertString = _interopRequireDefault(require("e41d8cb7b90fd66a")); 35978function _interopRequireDefault(e) { 35979 return e && e.__esModule ? e : { 35980 default: e 35981 }; 35982} 35983// from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2 35984var validISO31661Alpha2CountriesCodes = new Set([ 35985 'AD', 35986 'AE', 35987 'AF', 35988 'AG', 35989 'AI', 35990 'AL', 35991 'AM', 35992 'AO', 35993 'AQ', 35994 'AR', 35995 'AS', 35996 'AT', 35997 'AU', 35998 'AW', 35999 'AX', 36000 'AZ', 36001 'BA', 36002 'BB', 36003 'BD', 36004 'BE', 36005 'BF', 36006 'BG', 36007 'BH', 36008 'BI', 36009 'BJ', 36010 'BL', 36011 'BM', 36012 'BN', 36013 'BO', 36014 'BQ', 36015 'BR', 36016 'BS', 36017 'BT', 36018 'BV', 36019 'BW', 36020 'BY', 36021 'BZ', 36022 'CA', 36023 'CC', 36024 'CD', 36025 'CF', 36026 'CG', 36027 'CH', 36028 'CI', 36029 'CK', 36030 'CL', 36031 'CM', 36032 'CN', 36033 'CO', 36034 'CR', 36035 'CU', 36036 'CV', 36037 'CW', 36038 'CX', 36039 'CY', 36040 'CZ', 36041 'DE', 36042 'DJ', 36043 'DK', 36044 'DM', 36045 'DO', 36046 'DZ', 36047 'EC', 36048 'EE', 36049 'EG', 36050 'EH', 36051 'ER', 36052 'ES', 36053 'ET', 36054 'FI', 36055 'FJ', 36056 'FK', 36057 'FM', 36058 'FO', 36059 'FR', 36060 'GA', 36061 'GB', 36062 'GD', 36063 'GE', 36064 'GF', 36065 'GG', 36066 'GH', 36067 'GI', 36068 'GL', 36069 'GM', 36070 'GN', 36071 'GP', 36072 'GQ', 36073 'GR', 36074 'GS', 36075 'GT', 36076 'GU', 36077 'GW', 36078 'GY', 36079 'HK', 36080 'HM', 36081 'HN', 36082 'HR', 36083 'HT', 36084 'HU', 36085 'ID', 36086 'IE', 36087 'IL', 36088 'IM', 36089 'IN', 36090 'IO', 36091 'IQ', 36092 'IR', 36093 'IS', 36094 'IT', 36095 'JE', 36096 'JM', 36097 'JO', 36098 'JP', 36099 'KE',
36100 'KG', 36101 'KH', 36102 'KI', 36103 'KM', 36104 'KN', 36105 'KP', 36106 'KR', 36107 'KW', 36108 'KY', 36109 'KZ', 36110 'LA', 36111 'LB', 36112 'LC', 36113 'LI', 36114 'LK', 36115 'LR', 36116 'LS', 36117 'LT', 36118 'LU', 36119 'LV', 36120 'LY', 36121 'MA', 36122 'MC', 36123 'MD', 36124 'ME', 36125 'MF', 36126 'MG', 36127 'MH', 36128 'MK', 36129 'ML', 36130 'MM', 36131 'MN', 36132 'MO', 36133 'MP', 36134 'MQ', 36135 'MR', 36136 'MS', 36137 'MT', 36138 'MU', 36139 'MV', 36140 'MW', 36141 'MX', 36142 'MY', 36143 'MZ', 36144 'NA', 36145 'NC', 36146 'NE', 36147 'NF', 36148 'NG', 36149 'NI', 36150 'NL', 36151 'NO', 36152 'NP', 36153 'NR', 36154 'NU', 36155 'NZ', 36156 'OM', 36157 'PA', 36158 'PE', 36159 'PF', 36160 'PG', 36161 'PH', 36162 'PK', 36163 'PL', 36164 'PM', 36165 'PN', 36166 'PR', 36167 'PS', 36168 'PT', 36169 'PW', 36170 'PY', 36171 'QA', 36172 'RE', 36173 'RO', 36174 'RS', 36175 'RU', 36176 'RW', 36177 'SA', 36178 'SB', 36179 'SC', 36180 'SD', 36181 'SE', 36182 'SG', 36183 'SH', 36184 'SI', 36185 'SJ', 36186 'SK', 36187 'SL', 36188 'SM', 36189 'SN', 36190 'SO', 36191 'SR', 36192 'SS', 36193 'ST', 36194 'SV', 36195 'SX', 36196 'SY', 36197 'SZ', 36198 'TC', 36199 'TD', 36200 'TF', 36201 'TG', 36202 'TH', 36203 'TJ', 36204 'TK', 36205 'TL', 36206 'TM', 36207 'TN', 36208 'TO', 36209 'TR', 36210 'TT', 36211 'TV', 36212 'TW', 36213 'TZ', 36214 'UA', 36215 'UG', 36216 'UM', 36217 'US', 36218 'UY', 36219 'UZ', 36220 'VA', 36221 'VC', 36222 'VE', 36223 'VG', 36224 'VI', 36225 'VN', 36226 'VU', 36227 'WF', 36228 'WS', 36229 'YE', 36230 'YT', 36231 'ZA', 36232 'ZM', 36233 'ZW' 36234]); 36235function isISO31661Alpha2(str) { 36236 (0, _assertString.default)(str); 36237 return validISO31661Alpha2CountriesCodes.has(str.toUpperCase()); 36238} 36239var CountryCodes = exports.CountryCodes = validISO31661Alpha2CountriesCodes; 36240 36241},{"e41d8cb7b90fd66a":"fQT2o"}],"hqOY6":[function(require,module,exports,__globalThis) { 36242"use strict"; 36243Object.defineProperty(exports, "__esModule", { 36244 value: true 36245}); 36246exports.default = isMD5; 36247var _assertString = _interopRequireDefault(require("c755e3f2ef1c985a")); 36248function _interopRequireDefault(e) { 36249 return e && e.__esModule ? e : { 36250 default: e 36251 }; 36252} 36253var md5 = /^[a-f0-9]{32}$/; 36254function isMD5(str) { 36255 (0, _assertString.default)(str); 36256 return md5.test(str); 36257} 36258module.exports = exports.default; 36259module.exports.default = exports.default; 36260 36261},{"c755e3f2ef1c985a":"fQT2o"}],"bgcDX":[function(require,module,exports,__globalThis) { 36262"use strict"; 36263Object.defineProperty(exports, "__esModule", { 36264 value: true 36265}); 36266exports.default = isHash; 36267var _assertString = _interopRequireDefault(require("318b64cc266b5945")); 36268function _interopRequireDefault(e) { 36269 return e && e.__esModule ? e : { 36270 default: e 36271 }; 36272} 36273var lengths = { 36274 md5: 32, 36275 md4: 32, 36276 sha1: 40, 36277 sha256: 64, 36278 sha384: 96, 36279 sha512: 128, 36280 ripemd128: 32, 36281 ripemd160: 40, 36282 tiger128: 32, 36283 tiger160: 40, 36284 tiger192: 48, 36285 crc32: 8, 36286 crc32b: 8 36287}; 36288function isHash(str, algorithm) { 36289 (0, _assertString.default)(str); 36290 var hash = new RegExp("^[a-fA-F0-9]{".concat(lengths[algorithm], "}$")); 36291 return hash.test(str); 36292} 36293module.exports = exports.default; 36294module.exports.default = exports.default; 36295 36296},{"318b64cc266b5945":"fQT2o"}],"1LSZn":[function(require,module,exports,__globalThis) { 36297"use strict"; 36298Object.defineProperty(exports, "__esModule", { 36299 value: true 36300}); 36301exports.default = isJWT; 36302var _assertString = _interopRequireDefault(require("d0b86a9a84ca2198")); 36303var _isBase = _interopRequireDefault(require("2746967ea24563e0")); 36304function _interopRequireDefault(e) { 36305 return e && e.__esModule ? e : { 36306 default: e 36307 }; 36308} 36309function isJWT(str) { 36310 (0, _assertString.default)(str); 36311 var dotSplit = str.split('.'); 36312 var len = dotSplit.length; 36313 if (len !== 3) return false; 36314 return dotSplit.reduce(function(acc, currElem) { 36315 return acc && (0, _isBase.default)(currElem, { 36316 urlSafe: true 36317 }); 36318 }, true); 36319} 36320module.exports = exports.default; 36321module.exports.default = exports.default; 36322 36323},{"d0b86a9a84ca2198":"fQT2o","2746967ea24563e0":"4WAWr"}],"4WAWr":[function(require,module,exports,__globalThis) { 36324"use strict"; 36325Object.defineProperty(exports, "__esModule", { 36326 value: true 36327}); 36328exports.default = isBase64; 36329var _assertString = _interopRequireDefault(require("8e44c374ff4c971d")); 36330var _merge = _interopRequireDefault(require("cfc93884c3e723dd")); 36331function _interopRequireDefault(e) {
36332 return e && e.__esModule ? e : { 36333 default: e 36334 }; 36335} 36336var base64WithPadding = /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$/; 36337var base64WithoutPadding = /^[A-Za-z0-9+/]+$/; 36338var base64UrlWithPadding = /^(?:[A-Za-z0-9_-]{4})*(?:[A-Za-z0-9_-]{2}==|[A-Za-z0-9_-]{3}=|[A-Za-z0-9_-]{4})$/; 36339var base64UrlWithoutPadding = /^[A-Za-z0-9_-]+$/; 36340function isBase64(str, options) { 36341 var _options; 36342 (0, _assertString.default)(str); 36343 options = (0, _merge.default)(options, { 36344 urlSafe: false, 36345 padding: !((_options = options) !== null && _options !== void 0 && _options.urlSafe) 36346 }); 36347 if (str === '') return true; 36348 var regex; 36349 if (options.urlSafe) regex = options.padding ? base64UrlWithPadding : base64UrlWithoutPadding; 36350 else regex = options.padding ? base64WithPadding : base64WithoutPadding; 36351 return (!options.padding || str.length % 4 === 0) && regex.test(str); 36352} 36353module.exports = exports.default; 36354module.exports.default = exports.default; 36355 36356},{"8e44c374ff4c971d":"fQT2o","cfc93884c3e723dd":"bRDoK"}],"dwk7J":[function(require,module,exports,__globalThis) { 36357"use strict"; 36358Object.defineProperty(exports, "__esModule", { 36359 value: true 36360}); 36361exports.default = isJSON; 36362var _assertString = _interopRequireDefault(require("9c0272646c6c578b")); 36363var _includesArray = _interopRequireDefault(require("5441987867815109")); 36364var _merge = _interopRequireDefault(require("ef7c216ff7a82269")); 36365function _interopRequireDefault(e) { 36366 return e && e.__esModule ? e : { 36367 default: e 36368 }; 36369} 36370function _typeof(o) { 36371 "@babel/helpers - typeof"; 36372 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { 36373 return typeof o; 36374 } : function(o) { 36375 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 36376 }, _typeof(o); 36377} 36378var default_json_options = { 36379 allow_primitives: false 36380}; 36381function isJSON(str, options) { 36382 (0, _assertString.default)(str); 36383 try { 36384 options = (0, _merge.default)(options, default_json_options); 36385 var primitives = []; 36386 if (options.allow_primitives) primitives = [ 36387 null, 36388 false, 36389 true 36390 ]; 36391 var obj = JSON.parse(str); 36392 return (0, _includesArray.default)(primitives, obj) || !!obj && _typeof(obj) === 'object'; 36393 } catch (e) {} 36394 return false; 36395} 36396module.exports = exports.default; 36397module.exports.default = exports.default; 36398 36399},{"9c0272646c6c578b":"fQT2o","5441987867815109":"iWyrT","ef7c216ff7a82269":"bRDoK"}],"a9Js5":[function(require,module,exports,__globalThis) { 36400"use strict"; 36401Object.defineProperty(exports, "__esModule", { 36402 value: true 36403}); 36404exports.default = isEmpty; 36405var _assertString = _interopRequireDefault(require("f94a6139bb13a8ea")); 36406var _merge = _interopRequireDefault(require("184be28420881903")); 36407function _interopRequireDefault(e) { 36408 return e && e.__esModule ? e : { 36409 default: e 36410 }; 36411} 36412var default_is_empty_options = { 36413 ignore_whitespace: false 36414}; 36415function isEmpty(str, options) { 36416 (0, _assertString.default)(str); 36417 options = (0, _merge.default)(options, default_is_empty_options); 36418 return (options.ignore_whitespace ? str.trim().length : str.length) === 0; 36419} 36420module.exports = exports.default; 36421module.exports.default = exports.default; 36422 36423},{"f94a6139bb13a8ea":"fQT2o","184be28420881903":"bRDoK"}],"1xRTi":[function(require,module,exports,__globalThis) { 36424"use strict"; 36425Object.defineProperty(exports, "__esModule", { 36426 value: true 36427}); 36428exports.default = isLength; 36429var _assertString = _interopRequireDefault(require("6b47bc2ed334a900")); 36430function _interopRequireDefault(e) { 36431 return e && e.__esModule ? e : { 36432 default: e 36433 }; 36434} 36435function _typeof(o) { 36436 "@babel/helpers - typeof"; 36437 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { 36438 return typeof o; 36439 } : function(o) { 36440 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 36441 }, _typeof(o); 36442} 36443/* eslint-disable prefer-rest-params */ function isLength(str, options) { 36444 (0, _assertString.default)(str); 36445 var min; 36446 var max; 36447 if (_typeof(options) === 'object') { 36448 min = options.min || 0; 36449 max = options.max; 36450 } else { 36451 // backwards compatibility: isLength(str, min [, max]) 36452 min = arguments[1] || 0; 36453 max = arguments[2]; 36454 } 36455 var presentationSequences = str.match(/(\uFE0F|\uFE0E)/g) || []; 36456 var surrogatePairs = str.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g) || []; 36457 var len = str.length - presentationSequences.length - surrogatePairs.length; 36458 var isInsideRange = len >= min && (typeof max === 'undefined' || len <= max); 36459 if (isInsideRange && Array.isArray(options === null || options === void 0 ? void 0 : options.discreteLengths)) return options.discreteLengths.some(function(discreteLen) { 36460 return discreteLen === len; 36461 }); 36462 return isInsideRange; 36463} 36464module.exports = exports.default; 36465module.exports.default = exports.default; 36466 36467},{"6b47bc2ed334a900":"fQT2o"}],"gU4kV":[function(require,module,exports,__globalThis) { 36468"use strict"; 36469Object.defineProperty(exports, "__esModule", { 36470 value: true 36471}); 36472exports.default = isULID; 36473var _assertString = _interopRequireDefault(require("9eaf8992439c991f")); 36474function _interopRequireDefault(e) {
36475 return e && e.__esModule ? e : { 36476 default: e 36477 }; 36478} 36479function isULID(str) { 36480 (0, _assertString.default)(str); 36481 return /^[0-7][0-9A-HJKMNP-TV-Z]{25}$/i.test(str); 36482} 36483module.exports = exports.default; 36484module.exports.default = exports.default; 36485 36486},{"9eaf8992439c991f":"fQT2o"}],"58CmQ":[function(require,module,exports,__globalThis) { 36487"use strict"; 36488Object.defineProperty(exports, "__esModule", { 36489 value: true 36490}); 36491exports.default = isUUID; 36492var _assertString = _interopRequireDefault(require("973e2ef767c2afa9")); 36493function _interopRequireDefault(e) { 36494 return e && e.__esModule ? e : { 36495 default: e 36496 }; 36497} 36498var uuid = { 36499 1: /^[0-9A-F]{8}-[0-9A-F]{4}-1[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, 36500 2: /^[0-9A-F]{8}-[0-9A-F]{4}-2[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, 36501 3: /^[0-9A-F]{8}-[0-9A-F]{4}-3[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, 36502 4: /^[0-9A-F]{8}-[0-9A-F]{4}-4[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, 36503 5: /^[0-9A-F]{8}-[0-9A-F]{4}-5[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, 36504 6: /^[0-9A-F]{8}-[0-9A-F]{4}-6[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, 36505 7: /^[0-9A-F]{8}-[0-9A-F]{4}-7[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, 36506 8: /^[0-9A-F]{8}-[0-9A-F]{4}-8[0-9A-F]{3}-[89AB][0-9A-F]{3}-[0-9A-F]{12}$/i, 36507 nil: /^00000000-0000-0000-0000-000000000000$/i, 36508 max: /^ffffffff-ffff-ffff-ffff-ffffffffffff$/i, 36509 loose: /^[0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12}$/i, 36510 // From https://github.com/uuidjs/uuid/blob/main/src/regex.js 36511 all: /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/i 36512}; 36513function isUUID(str, version) { 36514 (0, _assertString.default)(str); 36515 if (version === undefined || version === null) version = 'all'; 36516 return version in uuid ? uuid[version].test(str) : false; 36517} 36518module.exports = exports.default; 36519module.exports.default = exports.default; 36520 36521},{"973e2ef767c2afa9":"fQT2o"}],"duuYZ":[function(require,module,exports,__globalThis) { 36522"use strict"; 36523Object.defineProperty(exports, "__esModule", { 36524 value: true 36525}); 36526exports.default = isMongoId; 36527var _assertString = _interopRequireDefault(require("d869e7f0c5cb701e")); 36528var _isHexadecimal = _interopRequireDefault(require("16f83f29c7928fec")); 36529function _interopRequireDefault(e) { 36530 return e && e.__esModule ? e : { 36531 default: e 36532 }; 36533} 36534function isMongoId(str) { 36535 (0, _assertString.default)(str); 36536 return (0, _isHexadecimal.default)(str) && str.length === 24; 36537} 36538module.exports = exports.default; 36539module.exports.default = exports.default; 36540 36541},{"d869e7f0c5cb701e":"fQT2o","16f83f29c7928fec":"lxVTo"}],"4udlt":[function(require,module,exports,__globalThis) { 36542"use strict"; 36543Object.defineProperty(exports, "__esModule", { 36544 value: true 36545}); 36546exports.default = isAfter; 36547var _toDate = _interopRequireDefault(require("e164ca231e30adf6")); 36548function _interopRequireDefault(e) { 36549 return e && e.__esModule ? e : { 36550 default: e 36551 }; 36552} 36553function _typeof(o) { 36554 "@babel/helpers - typeof"; 36555 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { 36556 return typeof o; 36557 } : function(o) { 36558 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 36559 }, _typeof(o); 36560} 36561function isAfter(date, options) { 36562 // For backwards compatibility: 36563 // isAfter(str [, date]), i.e. `options` could be used as argument for the legacy `date` 36564 var comparisonDate = (_typeof(options) === 'object' ? options.comparisonDate : options) || Date().toString(); 36565 var comparison = (0, _toDate.default)(comparisonDate); 36566 var original = (0, _toDate.default)(date); 36567 return !!(original && comparison && original > comparison); 36568} 36569module.exports = exports.default; 36570module.exports.default = exports.default; 36571 36572},{"e164ca231e30adf6":"8bnlE"}],"1vB4a":[function(require,module,exports,__globalThis) { 36573"use strict"; 36574Object.defineProperty(exports, "__esModule", { 36575 value: true 36576}); 36577exports.default = isBefore; 36578var _toDate = _interopRequireDefault(require("a53ce262ac376887")); 36579function _interopRequireDefault(e) {
36580 return e && e.__esModule ? e : { 36581 default: e 36582 }; 36583} 36584function _typeof(o) { 36585 "@babel/helpers - typeof"; 36586 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { 36587 return typeof o; 36588 } : function(o) { 36589 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 36590 }, _typeof(o); 36591} 36592function isBefore(date, options) { 36593 // For backwards compatibility: 36594 // isBefore(str [, date]), i.e. `options` could be used as argument for the legacy `date` 36595 var comparisonDate = (_typeof(options) === 'object' ? options.comparisonDate : options) || Date().toString(); 36596 var comparison = (0, _toDate.default)(comparisonDate); 36597 var original = (0, _toDate.default)(date); 36598 return !!(original && comparison && original < comparison); 36599} 36600module.exports = exports.default; 36601module.exports.default = exports.default; 36602 36603},{"a53ce262ac376887":"8bnlE"}],"1mcSQ":[function(require,module,exports,__globalThis) { 36604"use strict"; 36605Object.defineProperty(exports, "__esModule", { 36606 value: true 36607}); 36608exports.default = isIn; 36609var _assertString = _interopRequireDefault(require("1e5f07e2cd279106")); 36610var _toString = _interopRequireDefault(require("26a576c3ed31db1f")); 36611function _interopRequireDefault(e) { 36612 return e && e.__esModule ? e : { 36613 default: e 36614 }; 36615} 36616function _typeof(o) { 36617 "@babel/helpers - typeof"; 36618 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { 36619 return typeof o; 36620 } : function(o) { 36621 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 36622 }, _typeof(o); 36623} 36624function isIn(str, options) { 36625 (0, _assertString.default)(str); 36626 var i; 36627 if (Object.prototype.toString.call(options) === '[object Array]') { 36628 var array = []; 36629 for(i in options)// https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes 36630 // istanbul ignore else 36631 if (({}).hasOwnProperty.call(options, i)) array[i] = (0, _toString.default)(options[i]); 36632 return array.indexOf(str) >= 0; 36633 } else if (_typeof(options) === 'object') return options.hasOwnProperty(str); 36634 else if (options && typeof options.indexOf === 'function') return options.indexOf(str) >= 0; 36635 return false; 36636} 36637module.exports = exports.default; 36638module.exports.default = exports.default; 36639 36640},{"1e5f07e2cd279106":"fQT2o","26a576c3ed31db1f":"2wZ8V"}],"95c9l":[function(require,module,exports,__globalThis) { 36641"use strict"; 36642Object.defineProperty(exports, "__esModule", { 36643 value: true 36644}); 36645exports.default = isLuhnNumber; 36646var _assertString = _interopRequireDefault(require("939e6ef1ca2e993c")); 36647function _interopRequireDefault(e) { 36648 return e && e.__esModule ? e : { 36649 default: e 36650 }; 36651} 36652function isLuhnNumber(str) { 36653 (0, _assertString.default)(str); 36654 var sanitized = str.replace(/[- ]+/g, ''); 36655 var sum = 0; 36656 var digit; 36657 var tmpNum; 36658 var shouldDouble; 36659 for(var i = sanitized.length - 1; i >= 0; i--){ 36660 digit = sanitized.substring(i, i + 1); 36661 tmpNum = parseInt(digit, 10); 36662 if (shouldDouble) { 36663 tmpNum *= 2; 36664 if (tmpNum >= 10) sum += tmpNum % 10 + 1; 36665 else sum += tmpNum; 36666 } else sum += tmpNum; 36667 shouldDouble = !shouldDouble; 36668 } 36669 return !!(sum % 10 === 0 ? sanitized : false); 36670} 36671module.exports = exports.default; 36672module.exports.default = exports.default; 36673 36674},{"939e6ef1ca2e993c":"fQT2o"}],"kYTFv":[function(require,module,exports,__globalThis) { 36675"use strict"; 36676Object.defineProperty(exports, "__esModule", { 36677 value: true 36678}); 36679exports.default = isCreditCard; 36680var _assertString = _interopRequireDefault(require("104f85f43b1730c2")); 36681var _isLuhnNumber = _interopRequireDefault(require("6743c1d01cccf7b5")); 36682function _interopRequireDefault(e) { 36683 return e && e.__esModule ? e : { 36684 default: e 36685 }; 36686} 36687var cards = { 36688 amex: /^3[47][0-9]{13}$/, 36689 dinersclub: /^3(?:0[0-5]|[68][0-9])[0-9]{11}$/, 36690 discover: /^6(?:011|5[0-9][0-9])[0-9]{12,15}$/,
36691 jcb: /^(?:2131|1800|35\d{3})\d{11}$/, 36692 mastercard: /^5[1-5][0-9]{2}|(222[1-9]|22[3-9][0-9]|2[3-6][0-9]{2}|27[01][0-9]|2720)[0-9]{12}$/, 36693 // /^[25][1-7][0-9]{14}$/; 36694 unionpay: /^(6[27][0-9]{14}|^(81[0-9]{14,17}))$/, 36695 visa: /^(?:4[0-9]{12})(?:[0-9]{3,6})?$/ 36696}; 36697var allCards = function() { 36698 var tmpCardsArray = []; 36699 for(var cardProvider in cards)// istanbul ignore else 36700 if (cards.hasOwnProperty(cardProvider)) tmpCardsArray.push(cards[cardProvider]); 36701 return tmpCardsArray; 36702}(); 36703function isCreditCard(card) { 36704 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 36705 (0, _assertString.default)(card); 36706 var provider = options.provider; 36707 var sanitized = card.replace(/[- ]+/g, ''); 36708 if (provider && provider.toLowerCase() in cards) { 36709 // specific provider in the list 36710 if (!cards[provider.toLowerCase()].test(sanitized)) return false; 36711 } else if (provider && !(provider.toLowerCase() in cards)) /* specific provider not in the list */ throw new Error("".concat(provider, " is not a valid credit card provider.")); 36712 else if (!allCards.some(function(cardProvider) { 36713 return cardProvider.test(sanitized); 36714 })) // no specific provider 36715 return false; 36716 return (0, _isLuhnNumber.default)(card); 36717} 36718module.exports = exports.default; 36719module.exports.default = exports.default; 36720 36721},{"104f85f43b1730c2":"fQT2o","6743c1d01cccf7b5":"95c9l"}],"k9T9k":[function(require,module,exports,__globalThis) { 36722"use strict"; 36723Object.defineProperty(exports, "__esModule", { 36724 value: true 36725}); 36726exports.default = isIdentityCard; 36727var _assertString = _interopRequireDefault(require("82ebad56c1e929ba")); 36728var _includesArray = _interopRequireDefault(require("8afb0c42219eca75")); 36729var _isInt = _interopRequireDefault(require("a1cec04ff91509b3")); 36730function _interopRequireDefault(e) { 36731 return e && e.__esModule ? e : { 36732 default: e 36733 }; 36734} 36735var validators = { 36736 PL: function PL(str) { 36737 (0, _assertString.default)(str); 36738 var weightOfDigits = { 36739 1: 1, 36740 2: 3, 36741 3: 7, 36742 4: 9, 36743 5: 1, 36744 6: 3, 36745 7: 7, 36746 8: 9, 36747 9: 1, 36748 10: 3, 36749 11: 0 36750 }; 36751 if (str != null && str.length === 11 && (0, _isInt.default)(str, { 36752 allow_leading_zeroes: true 36753 })) { 36754 var digits = str.split('').slice(0, -1); 36755 var sum = digits.reduce(function(acc, digit, index) { 36756 return acc + Number(digit) * weightOfDigits[index + 1]; 36757 }, 0); 36758 var modulo = sum % 10; 36759 var lastDigit = Number(str.charAt(str.length - 1)); 36760 if (modulo === 0 && lastDigit === 0 || lastDigit === 10 - modulo) return true; 36761 } 36762 return false; 36763 }, 36764 ES: function ES(str) { 36765 (0, _assertString.default)(str); 36766 var DNI = /^[0-9X-Z][0-9]{7}[TRWAGMYFPDXBNJZSQVHLCKE]$/; 36767 var charsValue = { 36768 X: 0, 36769 Y: 1, 36770 Z: 2 36771 }; 36772 var controlDigits = [ 36773 'T', 36774 'R', 36775 'W', 36776 'A', 36777 'G', 36778 'M', 36779 'Y', 36780 'F', 36781 'P', 36782 'D', 36783 'X', 36784 'B', 36785 'N', 36786 'J', 36787 'Z', 36788 'S', 36789 'Q', 36790 'V', 36791 'H', 36792 'L', 36793 'C', 36794 'K', 36795 'E' 36796 ]; 36797 // sanitize user input 36798 var sanitized = str.trim().toUpperCase(); 36799 // validate the data structure 36800 if (!DNI.test(sanitized)) return false; 36801 // validate the control digit 36802 var number = sanitized.slice(0, -1).replace(/[X,Y,Z]/g, function(char) { 36803 return charsValue[char]; 36804 }); 36805 return sanitized.endsWith(controlDigits[number % 23]); 36806 }, 36807 FI: function FI(str) { 36808 // https://dvv.fi/en/personal-identity-code#:~:text=control%20character%20for%20a-,personal,-identity%20code%20calculated 36809 (0, _assertString.default)(str); 36810 if (str.length !== 11) return false;
vendor: 13,899 bytes, lines 36811-37306
36811 if (!str.match(/^\d{6}[\-A\+]\d{3}[0-9ABCDEFHJKLMNPRSTUVWXY]{1}$/)) return false; 36812 var checkDigits = '0123456789ABCDEFHJKLMNPRSTUVWXY'; 36813 var idAsNumber = parseInt(str.slice(0, 6), 10) * 1000 + parseInt(str.slice(7, 10), 10); 36814 var remainder = idAsNumber % 31; 36815 var checkDigit = checkDigits[remainder]; 36816 return checkDigit === str.slice(10, 11); 36817 }, 36818 IN: function IN(str) { 36819 var DNI = /^[1-9]\d{3}\s?\d{4}\s?\d{4}$/; 36820 // multiplication table 36821 var d = [ 36822 [ 36823 0, 36824 1, 36825 2, 36826 3, 36827 4, 36828 5, 36829 6, 36830 7, 36831 8, 36832 9 36833 ], 36834 [ 36835 1, 36836 2, 36837 3, 36838 4, 36839 0, 36840 6, 36841 7, 36842 8, 36843 9, 36844 5 36845 ], 36846 [ 36847 2, 36848 3, 36849 4, 36850 0, 36851 1, 36852 7, 36853 8, 36854 9, 36855 5, 36856 6 36857 ], 36858 [ 36859 3, 36860 4, 36861 0, 36862 1, 36863 2, 36864 8, 36865 9, 36866 5, 36867 6, 36868 7 36869 ], 36870 [ 36871 4, 36872 0, 36873 1, 36874 2, 36875 3, 36876 9, 36877 5, 36878 6, 36879 7, 36880 8 36881 ], 36882 [ 36883 5, 36884 9, 36885 8, 36886 7, 36887 6, 36888 0, 36889 4, 36890 3, 36891 2, 36892 1 36893 ], 36894 [ 36895 6, 36896 5, 36897 9, 36898 8, 36899 7, 36900 1, 36901 0, 36902 4, 36903 3, 36904 2 36905 ], 36906 [ 36907 7, 36908 6, 36909 5, 36910 9, 36911 8, 36912 2, 36913 1, 36914 0, 36915 4, 36916 3 36917 ], 36918 [ 36919 8, 36920 7, 36921 6, 36922 5, 36923 9, 36924 3, 36925 2, 36926 1, 36927 0, 36928 4 36929 ], 36930 [ 36931 9, 36932 8, 36933 7, 36934 6, 36935 5, 36936 4, 36937 3, 36938 2, 36939 1, 36940 0 36941 ] 36942 ]; 36943 // permutation table 36944 var p = [ 36945 [ 36946 0, 36947 1, 36948 2, 36949 3, 36950 4, 36951 5, 36952 6, 36953 7, 36954 8, 36955 9 36956 ], 36957 [ 36958 1, 36959 5, 36960 7, 36961 6, 36962 2, 36963 8, 36964 3, 36965 0, 36966 9, 36967 4 36968 ], 36969 [ 36970 5, 36971 8, 36972 0, 36973 3, 36974 7, 36975 9, 36976 6, 36977 1, 36978 4, 36979 2 36980 ], 36981 [ 36982 8, 36983 9, 36984 1, 36985 6, 36986 0, 36987 4, 36988 3, 36989 5, 36990 2, 36991 7 36992 ], 36993 [ 36994 9, 36995 4, 36996 5, 36997 3, 36998 1, 36999 2, 37000 6, 37001 8, 37002 7, 37003 0 37004 ], 37005 [ 37006 4, 37007 2, 37008 8, 37009 6, 37010 5, 37011 7, 37012 3, 37013 9, 37014 0, 37015 1 37016 ], 37017 [ 37018 2, 37019 7, 37020 9, 37021 3, 37022 8, 37023 0, 37024 6, 37025 4, 37026 1, 37027 5 37028 ], 37029 [ 37030 7, 37031 0, 37032 4, 37033 6, 37034 9, 37035 1, 37036 3, 37037 2, 37038 5, 37039 8 37040 ] 37041 ]; 37042 // sanitize user input 37043 var sanitized = str.trim(); 37044 // validate the data structure 37045 if (!DNI.test(sanitized)) return false; 37046 var c = 0; 37047 var invertedArray = sanitized.replace(/\s/g, '').split('').map(Number).reverse(); 37048 invertedArray.forEach(function(val, i) { 37049 c = d[c][p[i % 8][val]]; 37050 }); 37051 return c === 0; 37052 }, 37053 IR: function IR(str) { 37054 if (!str.match(/^\d{10}$/)) return false; 37055 str = "0000".concat(str).slice(str.length - 6); 37056 if (parseInt(str.slice(3, 9), 10) === 0) return false; 37057 var lastNumber = parseInt(str.slice(9, 10), 10); 37058 var sum = 0; 37059 for(var i = 0; i < 9; i++)sum += parseInt(str.slice(i, i + 1), 10) * (10 - i); 37060 sum %= 11; 37061 return sum < 2 && lastNumber === sum || sum >= 2 && lastNumber === 11 - sum; 37062 }, 37063 IT: function IT(str) { 37064 if (str.length !== 9) return false; 37065 if (str === 'CA00000AA') return false; // https://it.wikipedia.org/wiki/Carta_d%27identit%C3%A0_elettronica_italiana 37066 return str.search(/C[A-Z]\d{5}[A-Z]{2}/i) > -1; 37067 }, 37068 NO: function NO(str) { 37069 var sanitized = str.trim(); 37070 if (isNaN(Number(sanitized))) return false; 37071 if (sanitized.length !== 11) return false; 37072 if (sanitized === '00000000000') return false; 37073 // https://no.wikipedia.org/wiki/F%C3%B8dselsnummer 37074 var f = sanitized.split('').map(Number); 37075 var k1 = (11 - (3 * f[0] + 7 * f[1] + 6 * f[2] + 1 * f[3] + 8 * f[4] + 9 * f[5] + 4 * f[6] + 5 * f[7] + 2 * f[8]) % 11) % 11; 37076 var k2 = (11 - (5 * f[0] + 4 * f[1] + 3 * f[2] + 2 * f[3] + 7 * f[4] + 6 * f[5] + 5 * f[6] + 4 * f[7] + 3 * f[8] + 2 * k1) % 11) % 11; 37077 if (k1 !== f[9] || k2 !== f[10]) return false; 37078 return true; 37079 }, 37080 TH: function TH(str) { 37081 if (!str.match(/^[1-8]\d{12}$/)) return false; 37082 // validate check digit 37083 var sum = 0; 37084 for(var i = 0; i < 12; i++)sum += parseInt(str[i], 10) * (13 - i); 37085 return str[12] === ((11 - sum % 11) % 10).toString(); 37086 }, 37087 LK: function LK(str) { 37088 var old_nic = /^[1-9]\d{8}[vx]$/i; 37089 var new_nic = /^[1-9]\d{11}$/i; 37090 if (str.length === 10 && old_nic.test(str)) return true; 37091 else if (str.length === 12 && new_nic.test(str)) return true; 37092 return false; 37093 }, 37094 'he-IL': function heIL(str) { 37095 var DNI = /^\d{9}$/; 37096 // sanitize user input 37097 var sanitized = str.trim(); 37098 // validate the data structure 37099 if (!DNI.test(sanitized)) return false; 37100 var id = sanitized; 37101 var sum = 0, incNum; 37102 for(var i = 0; i < id.length; i++){ 37103 incNum = Number(id[i]) * (i % 2 + 1); // Multiply number by 1 or 2 37104 sum += incNum > 9 ? incNum - 9 : incNum; // Sum the digits up and add to total 37105 } 37106 return sum % 10 === 0; 37107 }, 37108 'ar-LY': function arLY(str) { 37109 // Libya National Identity Number NIN is 12 digits, the first digit is either 1 or 2 37110 var NIN = /^(1|2)\d{11}$/; 37111 // sanitize user input 37112 var sanitized = str.trim(); 37113 // validate the data structure 37114 if (!NIN.test(sanitized)) return false; 37115 return true; 37116 }, 37117 'ar-TN': function arTN(str) { 37118 var DNI = /^\d{8}$/; 37119 // sanitize user input 37120 var sanitized = str.trim(); 37121 // validate the data structure 37122 if (!DNI.test(sanitized)) return false; 37123 return true; 37124 }, 37125 'zh-CN': function zhCN(str) { 37126 var provincesAndCities = [ 37127 '11', 37128 // å京 37129 '12', 37130 // 天津 37131 '13', 37132 // æ²³å 37133 '14', 37134 // 山西 37135 '15', 37136 // å èå¤ 37137 '21', 37138 // è¾½å® 37139 '22', 37140 // åæ 37141 '23', 37142 // é»é¾æ± 37143 '31', 37144 // 䏿µ· 37145 '32', 37146 // æ±è 37147 '33', 37148 // æµæ± 37149 '34', 37150 // å®å¾½ 37151 '35', 37152 // ç¦å»º 37153 '36', 37154 // æ±è¥¿ 37155 '37', 37156 // å±±ä¸ 37157 '41', 37158 // æ²³å 37159 '42', 37160 // æ¹å 37161 '43', 37162 // æ¹å 37163 '44', 37164 // å¹¿ä¸ 37165 '45', 37166 // 广西 37167 '46', 37168 // æµ·å 37169 '50', 37170 // éåº 37171 '51', 37172 // åå· 37173 '52', 37174 // è´µå· 37175 '53', 37176 // äºå 37177 '54', 37178 // 西è 37179 '61', 37180 // é西 37181 '62', 37182 // çè 37183 '63', 37184 // éæµ· 37185 '64', 37186 // å®å¤ 37187 '65', 37188 // æ°ç 37189 '71', 37190 // å°æ¹¾ 37191 '81', 37192 // 馿¸¯ 37193 '82', 37194 // æ¾³é¨ 37195 '91' // å½å¤ 37196 ]; 37197 var powers = [ 37198 '7', 37199 '9', 37200 '10', 37201 '5', 37202 '8', 37203 '4', 37204 '2', 37205 '1', 37206 '6', 37207 '3', 37208 '7', 37209 '9', 37210 '10', 37211 '5', 37212 '8', 37213 '4', 37214 '2' 37215 ]; 37216 var parityBit = [ 37217 '1', 37218 '0', 37219 'X', 37220 '9', 37221 '8', 37222 '7', 37223 '6', 37224 '5', 37225 '4', 37226 '3', 37227 '2' 37228 ]; 37229 var checkAddressCode = function checkAddressCode(addressCode) { 37230 return (0, _includesArray.default)(provincesAndCities, addressCode); 37231 }; 37232 var checkBirthDayCode = function checkBirthDayCode(birDayCode) { 37233 var yyyy = parseInt(birDayCode.substring(0, 4), 10); 37234 var mm = parseInt(birDayCode.substring(4, 6), 10); 37235 var dd = parseInt(birDayCode.substring(6), 10); 37236 var xdata = new Date(yyyy, mm - 1, dd); 37237 if (xdata > new Date()) return false; 37238 else if (xdata.getFullYear() === yyyy && xdata.getMonth() === mm - 1 && xdata.getDate() === dd) return true; 37239 return false; 37240 }; 37241 var getParityBit = function getParityBit(idCardNo) { 37242 var id17 = idCardNo.substring(0, 17); 37243 var power = 0; 37244 for(var i = 0; i < 17; i++)power += parseInt(id17.charAt(i), 10) * parseInt(powers[i], 10); 37245 var mod = power % 11; 37246 return parityBit[mod]; 37247 }; 37248 var checkParityBit = function checkParityBit(idCardNo) { 37249 return getParityBit(idCardNo) === idCardNo.charAt(17).toUpperCase(); 37250 }; 37251 var check15IdCardNo = function check15IdCardNo(idCardNo) { 37252 var check = /^[1-9]\d{7}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}$/.test(idCardNo); 37253 if (!check) return false; 37254 var addressCode = idCardNo.substring(0, 2); 37255 check = checkAddressCode(addressCode); 37256 if (!check) return false; 37257 var birDayCode = "19".concat(idCardNo.substring(6, 12)); 37258 check = checkBirthDayCode(birDayCode); 37259 if (!check) return false; 37260 return true; 37261 }; 37262 var check18IdCardNo = function check18IdCardNo(idCardNo) { 37263 var check = /^[1-9]\d{5}[1-9]\d{3}((0[1-9])|(1[0-2]))((0[1-9])|([1-2][0-9])|(3[0-1]))\d{3}(\d|x|X)$/.test(idCardNo); 37264 if (!check) return false; 37265 var addressCode = idCardNo.substring(0, 2); 37266 check = checkAddressCode(addressCode); 37267 if (!check) return false; 37268 var birDayCode = idCardNo.substring(6, 14); 37269 check = checkBirthDayCode(birDayCode); 37270 if (!check) return false; 37271 return checkParityBit(idCardNo); 37272 }; 37273 var checkIdCardNo = function checkIdCardNo(idCardNo) { 37274 var check = /^\d{15}|(\d{17}(\d|x|X))$/.test(idCardNo); 37275 if (!check) return false; 37276 if (idCardNo.length === 15) return check15IdCardNo(idCardNo); 37277 return check18IdCardNo(idCardNo); 37278 }; 37279 return checkIdCardNo(str); 37280 }, 37281 'zh-HK': function zhHK(str) { 37282 // sanitize user input 37283 str = str.trim(); 37284 // HKID number starts with 1 or 2 letters, followed by 6 digits, 37285 // then a checksum contained in square / round brackets or nothing 37286 var regexHKID = /^[A-Z]{1,2}[0-9]{6}((\([0-9A]\))|(\[[0-9A]\])|([0-9A]))$/; 37287 var regexIsDigit = /^[0-9]$/; 37288 // convert the user input to all uppercase and apply regex 37289 str = str.toUpperCase(); 37290 if (!regexHKID.test(str)) return false; 37291 str = str.replace(/\[|\]|\(|\)/g, ''); 37292 if (str.length === 8) str = "3".concat(str); 37293 var checkSumVal = 0; 37294 for(var i = 0; i <= 7; i++){ 37295 var convertedChar = void 0; 37296 if (!regexIsDigit.test(str[i])) convertedChar = (str[i].charCodeAt(0) - 55) % 11; 37297 else convertedChar = str[i]; 37298 checkSumVal += convertedChar * (9 - i); 37299 } 37300 checkSumVal %= 11; 37301 var checkSumConverted; 37302 if (checkSumVal === 0) checkSumConverted = '0'; 37303 else if (checkSumVal === 1) checkSumConverted = 'A'; 37304 else checkSumConverted = String(11 - checkSumVal); 37305 if (checkSumConverted === str[str.length - 1]) return true; 37306 return false;
37307 }, 37308 'zh-TW': function zhTW(str) { 37309 var ALPHABET_CODES = { 37310 A: 10, 37311 B: 11, 37312 C: 12, 37313 D: 13, 37314 E: 14, 37315 F: 15, 37316 G: 16, 37317 H: 17, 37318 I: 34, 37319 J: 18, 37320 K: 19, 37321 L: 20, 37322 M: 21, 37323 N: 22, 37324 O: 35, 37325 P: 23, 37326 Q: 24, 37327 R: 25, 37328 S: 26, 37329 T: 27, 37330 U: 28, 37331 V: 29, 37332 W: 32, 37333 X: 30, 37334 Y: 31, 37335 Z: 33 37336 }; 37337 var sanitized = str.trim().toUpperCase(); 37338 if (!/^[A-Z][0-9]{9}$/.test(sanitized)) return false; 37339 return Array.from(sanitized).reduce(function(sum, number, index) { 37340 if (index === 0) { 37341 var code = ALPHABET_CODES[number]; 37342 return code % 10 * 9 + Math.floor(code / 10); 37343 } 37344 if (index === 9) return (10 - sum % 10 - Number(number)) % 10 === 0; 37345 return sum + Number(number) * (9 - index); 37346 }, 0); 37347 }, 37348 PK: function PK(str) { 37349 // Pakistani National Identity Number CNIC is 13 digits 37350 var CNIC = /^[1-7][0-9]{4}-[0-9]{7}-[1-9]$/; 37351 // sanitize user input 37352 var sanitized = str.trim(); 37353 // validate the data structure 37354 return CNIC.test(sanitized); 37355 } 37356}; 37357function isIdentityCard(str, locale) { 37358 (0, _assertString.default)(str); 37359 if (locale in validators) return validators[locale](str); 37360 else if (locale === 'any') { 37361 for(var key in validators)// https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes 37362 // istanbul ignore else 37363 if (validators.hasOwnProperty(key)) { 37364 var validator = validators[key]; 37365 if (validator(str)) return true; 37366 } 37367 return false; 37368 } 37369 throw new Error("Invalid locale '".concat(locale, "'")); 37370} 37371module.exports = exports.default; 37372module.exports.default = exports.default; 37373 37374},{"82ebad56c1e929ba":"fQT2o","8afb0c42219eca75":"iWyrT","a1cec04ff91509b3":"bTWDC"}],"kUtFa":[function(require,module,exports,__globalThis) { 37375"use strict"; 37376Object.defineProperty(exports, "__esModule", { 37377 value: true 37378}); 37379exports.default = isEAN; 37380var _assertString = _interopRequireDefault(require("5e5bfe9eefacdfc1")); 37381function _interopRequireDefault(e) { 37382 return e && e.__esModule ? e : { 37383 default: e 37384 }; 37385} 37386/** 37387 * The most commonly used EAN standard is 37388 * the thirteen-digit EAN-13, while the 37389 * less commonly used 8-digit EAN-8 barcode was 37390 * introduced for use on small packages. 37391 * Also EAN/UCC-14 is used for Grouping of individual 37392 * trade items above unit level(Intermediate, Carton or Pallet). 37393 * For more info about EAN-14 checkout: https://www.gtin.info/itf-14-barcodes/ 37394 * EAN consists of: 37395 * GS1 prefix, manufacturer code, product code and check digit 37396 * Reference: https://en.wikipedia.org/wiki/International_Article_Number 37397 * Reference: https://www.gtin.info/ 37398 */ /** 37399 * Define EAN Lengths; 8 for EAN-8; 13 for EAN-13; 14 for EAN-14 37400 * and Regular Expression for valid EANs (EAN-8, EAN-13, EAN-14), 37401 * with exact numeric matching of 8 or 13 or 14 digits [0-9] 37402 */ var LENGTH_EAN_8 = 8; 37403var LENGTH_EAN_14 = 14; 37404var validEanRegex = /^(\d{8}|\d{13}|\d{14})$/; 37405/** 37406 * Get position weight given: 37407 * EAN length and digit index/position 37408 * 37409 * @param {number} length 37410 * @param {number} index 37411 * @return {number} 37412 */ function getPositionWeightThroughLengthAndIndex(length, index) { 37413 if (length === LENGTH_EAN_8 || length === LENGTH_EAN_14) return index % 2 === 0 ? 3 : 1; 37414 return index % 2 === 0 ? 1 : 3; 37415} 37416/** 37417 * Calculate EAN Check Digit 37418 * Reference: https://en.wikipedia.org/wiki/International_Article_Number#Calculation_of_checksum_digit 37419 * 37420 * @param {string} ean 37421 * @return {number} 37422 */ function calculateCheckDigit(ean) { 37423 var checksum = ean.slice(0, -1).split('').map(function(char, index) { 37424 return Number(char) * getPositionWeightThroughLengthAndIndex(ean.length, index); 37425 }).reduce(function(acc, partialSum) { 37426 return acc + partialSum; 37427 }, 0); 37428 var remainder = 10 - checksum % 10; 37429 return remainder < 10 ? remainder : 0; 37430} 37431/** 37432 * Check if string is valid EAN: 37433 * Matches EAN-8/EAN-13/EAN-14 regex 37434 * Has valid check digit. 37435 * 37436 * @param {string} str 37437 * @return {boolean} 37438 */ function isEAN(str) { 37439 (0, _assertString.default)(str); 37440 var actualCheckDigit = Number(str.slice(-1)); 37441 return validEanRegex.test(str) && actualCheckDigit === calculateCheckDigit(str); 37442} 37443module.exports = exports.default; 37444module.exports.default = exports.default; 37445 37446},{"5e5bfe9eefacdfc1":"fQT2o"}],"lkwai":[function(require,module,exports,__globalThis) { 37447"use strict"; 37448Object.defineProperty(exports, "__esModule", { 37449 value: true 37450}); 37451exports.default = isISIN; 37452var _assertString = _interopRequireDefault(require("f7031d3698358d1")); 37453function _interopRequireDefault(e) {
37454 return e && e.__esModule ? e : { 37455 default: e 37456 }; 37457} 37458var isin = /^[A-Z]{2}[0-9A-Z]{9}[0-9]$/; 37459// this link details how the check digit is calculated: 37460// https://www.isin.org/isin-format/. it is a little bit 37461// odd in that it works with digits, not numbers. in order 37462// to make only one pass through the ISIN characters, the 37463// each alpha character is handled as 2 characters within 37464// the loop. 37465function isISIN(str) { 37466 (0, _assertString.default)(str); 37467 if (!isin.test(str)) return false; 37468 var double = true; 37469 var sum = 0; 37470 // convert values 37471 for(var i = str.length - 2; i >= 0; i--)if (str[i] >= 'A' && str[i] <= 'Z') { 37472 var value = str[i].charCodeAt(0) - 55; 37473 var lo = value % 10; 37474 var hi = Math.trunc(value / 10); 37475 // letters have two digits, so handle the low order 37476 // and high order digits separately. 37477 for(var _i = 0, _arr = [ 37478 lo, 37479 hi 37480 ]; _i < _arr.length; _i++){ 37481 var digit = _arr[_i]; 37482 if (double) { 37483 if (digit >= 5) sum += 1 + (digit - 5) * 2; 37484 else sum += digit * 2; 37485 } else sum += digit; 37486 double = !double; 37487 } 37488 } else { 37489 var _digit = str[i].charCodeAt(0) - '0'.charCodeAt(0); 37490 if (double) { 37491 if (_digit >= 5) sum += 1 + (_digit - 5) * 2; 37492 else sum += _digit * 2; 37493 } else sum += _digit; 37494 double = !double; 37495 } 37496 var check = Math.trunc((sum + 9) / 10) * 10 - sum; 37497 return +str[str.length - 1] === check; 37498} 37499module.exports = exports.default; 37500module.exports.default = exports.default; 37501 37502},{"f7031d3698358d1":"fQT2o"}],"7omN2":[function(require,module,exports,__globalThis) { 37503"use strict"; 37504Object.defineProperty(exports, "__esModule", { 37505 value: true 37506}); 37507exports.default = isISBN; 37508var _assertString = _interopRequireDefault(require("1bb174860ea3a502")); 37509function _interopRequireDefault(e) { 37510 return e && e.__esModule ? e : { 37511 default: e 37512 }; 37513} 37514var possibleIsbn10 = /^(?:[0-9]{9}X|[0-9]{10})$/; 37515var possibleIsbn13 = /^(?:[0-9]{13})$/; 37516var factor = [ 37517 1, 37518 3 37519]; 37520function isISBN(isbn, options) { 37521 (0, _assertString.default)(isbn); 37522 // For backwards compatibility: 37523 // isISBN(str [, version]), i.e. `options` could be used as argument for the legacy `version` 37524 var version = String((options === null || options === void 0 ? void 0 : options.version) || options); 37525 if (!(options !== null && options !== void 0 && options.version || options)) return isISBN(isbn, { 37526 version: 10 37527 }) || isISBN(isbn, { 37528 version: 13 37529 }); 37530 var sanitizedIsbn = isbn.replace(/[\s-]+/g, ''); 37531 var checksum = 0; 37532 if (version === '10') { 37533 if (!possibleIsbn10.test(sanitizedIsbn)) return false; 37534 for(var i = 0; i < version - 1; i++)checksum += (i + 1) * sanitizedIsbn.charAt(i); 37535 if (sanitizedIsbn.charAt(9) === 'X') checksum += 100; 37536 else checksum += 10 * sanitizedIsbn.charAt(9); 37537 if (checksum % 11 === 0) return true; 37538 } else if (version === '13') { 37539 if (!possibleIsbn13.test(sanitizedIsbn)) return false; 37540 for(var _i = 0; _i < 12; _i++)checksum += factor[_i % 2] * sanitizedIsbn.charAt(_i); 37541 if (sanitizedIsbn.charAt(12) - (10 - checksum % 10) % 10 === 0) return true; 37542 } 37543 return false; 37544} 37545module.exports = exports.default; 37546module.exports.default = exports.default; 37547 37548},{"1bb174860ea3a502":"fQT2o"}],"9BnK8":[function(require,module,exports,__globalThis) { 37549"use strict"; 37550Object.defineProperty(exports, "__esModule", { 37551 value: true 37552}); 37553exports.default = isISSN; 37554var _assertString = _interopRequireDefault(require("fef463073848d898")); 37555function _interopRequireDefault(e) { 37556 return e && e.__esModule ? e : { 37557 default: e 37558 }; 37559} 37560var issn = '^\\d{4}-?\\d{3}[\\dX]$'; 37561function isISSN(str) { 37562 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 37563 (0, _assertString.default)(str); 37564 var testIssn = issn; 37565 testIssn = options.require_hyphen ? testIssn.replace('?', '') : testIssn; 37566 testIssn = options.case_sensitive ? new RegExp(testIssn) : new RegExp(testIssn, 'i'); 37567 if (!testIssn.test(str)) return false;
37568 var digits = str.replace('-', '').toUpperCase(); 37569 var checksum = 0; 37570 for(var i = 0; i < digits.length; i++){ 37571 var digit = digits[i]; 37572 checksum += (digit === 'X' ? 10 : +digit) * (8 - i); 37573 } 37574 return checksum % 11 === 0; 37575} 37576module.exports = exports.default; 37577module.exports.default = exports.default; 37578 37579},{"fef463073848d898":"fQT2o"}],"jhUTi":[function(require,module,exports,__globalThis) { 37580"use strict"; 37581function _typeof(o) { 37582 "@babel/helpers - typeof"; 37583 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { 37584 return typeof o; 37585 } : function(o) { 37586 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 37587 }, _typeof(o); 37588} 37589Object.defineProperty(exports, "__esModule", { 37590 value: true 37591}); 37592exports.default = isTaxID; 37593var _assertString = _interopRequireDefault(require("79f64cb44c2530a")); 37594var algorithms = _interopRequireWildcard(require("c14e0a9edffe0e65")); 37595var _isDate = _interopRequireDefault(require("5ed6659e234b0708")); 37596function _interopRequireWildcard(e, t) { 37597 if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); 37598 return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { 37599 if (!t && e && e.__esModule) return e; 37600 var o, i, f = { 37601 __proto__: null, 37602 default: e 37603 }; 37604 if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; 37605 if (o = t ? n : r) { 37606 if (o.has(e)) return o.get(e); 37607 o.set(e, f); 37608 }
37609 for(var _t in e)"default" !== _t && ({}).hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); 37610 return f; 37611 })(e, t); 37612} 37613function _interopRequireDefault(e) { 37614 return e && e.__esModule ? e : { 37615 default: e 37616 }; 37617} 37618function _toConsumableArray(r) { 37619 return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); 37620} 37621function _nonIterableSpread() { 37622 throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 37623} 37624function _unsupportedIterableToArray(r, a) { 37625 if (r) { 37626 if ("string" == typeof r) return _arrayLikeToArray(r, a); 37627 var t = ({}).toString.call(r).slice(8, -1); 37628 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; 37629 } 37630} 37631function _iterableToArray(r) { 37632 if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); 37633} 37634function _arrayWithoutHoles(r) { 37635 if (Array.isArray(r)) return _arrayLikeToArray(r); 37636} 37637function _arrayLikeToArray(r, a) { 37638 (null == a || a > r.length) && (a = r.length); 37639 for(var e = 0, n = Array(a); e < a; e++)n[e] = r[e]; 37640 return n; 37641} 37642/** 37643 * TIN Validation 37644 * Validates Tax Identification Numbers (TINs) from the US, EU member states and the United Kingdom. 37645 * 37646 * EU-UK: 37647 * National TIN validity is calculated using public algorithms as made available by DG TAXUD. 37648 * 37649 * See `https://ec.europa.eu/taxation_customs/tin/specs/FS-TIN%20Algorithms-Public.docx` for more information. 37650 * 37651 * US: 37652 * An Employer Identification Number (EIN), also known as a Federal Tax Identification Number, 37653 * is used to identify a business entity. 37654 * 37655 * NOTES: 37656 * - Prefix 47 is being reserved for future use 37657 * - Prefixes 26, 27, 45, 46 and 47 were previously assigned by the Philadelphia campus. 37658 * 37659 * See `http://www.irs.gov/Businesses/Small-Businesses-&-Self-Employed/How-EINs-are-Assigned-and-Valid-EIN-Prefixes` 37660 * for more information. 37661 */ // Locale functions 37662/* 37663 * bg-BG validation function 37664 * (Edinen graždanski nomer (EGN/ÐÐÐ), persons only) 37665 * Checks if birth date (first six digits) is valid and calculates check (last) digit 37666 */ function bgBgCheck(tin) { 37667 // Extract full year, normalize month and check birth date validity 37668 var century_year = tin.slice(0, 2); 37669 var month = parseInt(tin.slice(2, 4), 10); 37670 if (month > 40) { 37671 month -= 40; 37672 century_year = "20".concat(century_year); 37673 } else if (month > 20) { 37674 month -= 20; 37675 century_year = "18".concat(century_year); 37676 } else century_year = "19".concat(century_year); 37677 if (month < 10) month = "0".concat(month); 37678 var date = "".concat(century_year, "/").concat(month, "/").concat(tin.slice(4, 6)); 37679 if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) return false; 37680 // split digits into an array for further processing 37681 var digits = tin.split('').map(function(a) { 37682 return parseInt(a, 10); 37683 }); 37684 // Calculate checksum by multiplying digits with fixed values 37685 var multip_lookup = [ 37686 2, 37687 4, 37688 8, 37689 5, 37690 10, 37691 9, 37692 7, 37693 3, 37694 6 37695 ]; 37696 var checksum = 0; 37697 for(var i = 0; i < multip_lookup.length; i++)checksum += digits[i] * multip_lookup[i]; 37698 checksum = checksum % 11 === 10 ? 0 : checksum % 11; 37699 return checksum === digits[9]; 37700} 37701/** 37702 * Check if an input is a valid Canadian SIN (Social Insurance Number) 37703 * 37704 * The Social Insurance Number (SIN) is a 9 digit number that 37705 * you need to work in Canada or to have access to government programs and benefits. 37706 * 37707 * https://en.wikipedia.org/wiki/Social_Insurance_Number 37708 * https://www.canada.ca/en/employment-social-development/services/sin.html 37709 * https://www.codercrunch.com/challenge/819302488/sin-validator 37710 * 37711 * @param {string} input 37712 * @return {boolean} 37713 */ function isCanadianSIN(input) { 37714 var digitsArray = input.split(''); 37715 var even = digitsArray.filter(function(_, idx) { 37716 return idx % 2; 37717 }).map(function(i) { 37718 return Number(i) * 2; 37719 }).join('').split(''); 37720 var total = digitsArray.filter(function(_, idx) { 37721 return !(idx % 2); 37722 }).concat(even).map(function(i) { 37723 return Number(i); 37724 }).reduce(function(acc, cur) { 37725 return acc + cur; 37726 }); 37727 return total % 10 === 0; 37728} 37729/* 37730 * cs-CZ validation function 37731 * (Rodné ÄÃslo (RÄ), persons only) 37732 * Checks if birth date (first six digits) is valid and divisibility by 11 37733 * Material not in DG TAXUD document sourced from: 37734 * -`https://lorenc.info/3MA381/overeni-spravnosti-rodneho-cisla.htm` 37735 * -`https://www.mvcr.cz/clanek/rady-a-sluzby-dokumenty-rodne-cislo.aspx` 37736 */ function csCzCheck(tin) { 37737 tin = tin.replace(/\W/, ''); 37738 // Extract full year from TIN length 37739 var full_year = parseInt(tin.slice(0, 2), 10); 37740 if (tin.length === 10) { 37741 if (full_year < 54) full_year = "20".concat(full_year); 37742 else full_year = "19".concat(full_year); 37743 } else { 37744 if (tin.slice(6) === '000') return false;
37745 // Three-zero serial not assigned before 1954 37746 if (full_year < 54) full_year = "19".concat(full_year); 37747 else return false; // No 18XX years seen in any of the resources 37748 } 37749 // Add missing zero if needed 37750 if (full_year.length === 3) full_year = [ 37751 full_year.slice(0, 2), 37752 '0', 37753 full_year.slice(2) 37754 ].join(''); 37755 // Extract month from TIN and normalize 37756 var month = parseInt(tin.slice(2, 4), 10); 37757 if (month > 50) month -= 50; 37758 if (month > 20) { 37759 // Month-plus-twenty was only introduced in 2004 37760 if (parseInt(full_year, 10) < 2004) return false; 37761 month -= 20; 37762 } 37763 if (month < 10) month = "0".concat(month); 37764 // Check date validity 37765 var date = "".concat(full_year, "/").concat(month, "/").concat(tin.slice(4, 6)); 37766 if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) return false; 37767 // Verify divisibility by 11 37768 if (tin.length === 10) { 37769 if (parseInt(tin, 10) % 11 !== 0) { 37770 // Some numbers up to and including 1985 are still valid if 37771 // check (last) digit equals 0 and modulo of first 9 digits equals 10 37772 var checkdigit = parseInt(tin.slice(0, 9), 10) % 11; 37773 if (parseInt(full_year, 10) < 1986 && checkdigit === 10) { 37774 if (parseInt(tin.slice(9), 10) !== 0) return false; 37775 } else return false; 37776 } 37777 } 37778 return true; 37779} 37780/* 37781 * de-AT validation function 37782 * (Abgabenkontonummer, persons/entities) 37783 * Verify TIN validity by calling luhnCheck() 37784 */ function deAtCheck(tin) { 37785 return algorithms.luhnCheck(tin); 37786} 37787/* 37788 * de-DE validation function 37789 * (Steueridentifikationsnummer (Steuer-IdNr.), persons only) 37790 * Tests for single duplicate/triplicate value, then calculates ISO 7064 check (last) digit 37791 * Partial implementation of spec (same result with both algorithms always) 37792 */ function deDeCheck(tin) { 37793 // Split digits into an array for further processing 37794 var digits = tin.split('').map(function(a) { 37795 return parseInt(a, 10); 37796 }); 37797 // Fill array with strings of number positions 37798 var occurrences = []; 37799 for(var i = 0; i < digits.length - 1; i++){ 37800 occurrences.push(''); 37801 for(var j = 0; j < digits.length - 1; j++)if (digits[i] === digits[j]) occurrences[i] += j; 37802 } 37803 // Remove digits with one occurrence and test for only one duplicate/triplicate 37804 occurrences = occurrences.filter(function(a) { 37805 return a.length > 1; 37806 }); 37807 if (occurrences.length !== 2 && occurrences.length !== 3) return false; 37808 // In case of triplicate value only two digits are allowed next to each other 37809 if (occurrences[0].length === 3) { 37810 var trip_locations = occurrences[0].split('').map(function(a) { 37811 return parseInt(a, 10); 37812 }); 37813 var recurrent = 0; // Amount of neighbor occurrences 37814 for(var _i = 0; _i < trip_locations.length - 1; _i++)if (trip_locations[_i] + 1 === trip_locations[_i + 1]) recurrent += 1; 37815 if (recurrent === 2) return false; 37816 } 37817 return algorithms.iso7064Check(tin); 37818} 37819/* 37820 * dk-DK validation function 37821 * (CPR-nummer (personnummer), persons only) 37822 * Checks if birth date (first six digits) is valid and assigned to century (seventh) digit, 37823 * and calculates check (last) digit 37824 */ function dkDkCheck(tin) { 37825 tin = tin.replace(/\W/, ''); 37826 // Extract year, check if valid for given century digit and add century 37827 var year = parseInt(tin.slice(4, 6), 10); 37828 var century_digit = tin.slice(6, 7); 37829 switch(century_digit){ 37830 case '0': 37831 case '1': 37832 case '2': 37833 case '3': 37834 year = "19".concat(year); 37835 break; 37836 case '4': 37837 case '9': 37838 if (year < 37) year = "20".concat(year); 37839 else year = "19".concat(year); 37840 break; 37841 default: 37842 if (year < 37) year = "20".concat(year); 37843 else if (year > 58) year = "18".concat(year); 37844 else return false; 37845 break; 37846 } 37847 // Add missing zero if needed 37848 if (year.length === 3) year = [ 37849 year.slice(0, 2), 37850 '0', 37851 year.slice(2) 37852 ].join(''); 37853 // Check date validity 37854 var date = "".concat(year, "/").concat(tin.slice(2, 4), "/").concat(tin.slice(0, 2)); 37855 if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) return false;
37856 // Split digits into an array for further processing 37857 var digits = tin.split('').map(function(a) { 37858 return parseInt(a, 10); 37859 }); 37860 var checksum = 0; 37861 var weight = 4; 37862 // Multiply by weight and add to checksum 37863 for(var i = 0; i < 9; i++){ 37864 checksum += digits[i] * weight; 37865 weight -= 1; 37866 if (weight === 1) weight = 7; 37867 } 37868 checksum %= 11; 37869 if (checksum === 1) return false; 37870 return checksum === 0 ? digits[9] === 0 : digits[9] === 11 - checksum; 37871} 37872/* 37873 * el-CY validation function 37874 * (Arithmos Forologikou Mitroou (AFM/ÎΦÎ), persons only) 37875 * Verify TIN validity by calculating ASCII value of check (last) character 37876 */ function elCyCheck(tin) { 37877 // split digits into an array for further processing 37878 var digits = tin.slice(0, 8).split('').map(function(a) { 37879 return parseInt(a, 10); 37880 }); 37881 var checksum = 0; 37882 // add digits in even places 37883 for(var i = 1; i < digits.length; i += 2)checksum += digits[i]; 37884 // add digits in odd places 37885 for(var _i2 = 0; _i2 < digits.length; _i2 += 2)if (digits[_i2] < 2) checksum += 1 - digits[_i2]; 37886 else { 37887 checksum += 2 * (digits[_i2] - 2) + 5; 37888 if (digits[_i2] > 4) checksum += 2; 37889 } 37890 return String.fromCharCode(checksum % 26 + 65) === tin.charAt(8); 37891} 37892/* 37893 * el-GR validation function 37894 * (Arithmos Forologikou Mitroou (AFM/ÎΦÎ), persons/entities) 37895 * Verify TIN validity by calculating check (last) digit 37896 * Algorithm not in DG TAXUD document- sourced from: 37897 * - `http://epixeirisi.gr/%CE%9A%CE%A1%CE%99%CE%A3%CE%99%CE%9C%CE%91-%CE%98%CE%95%CE%9C%CE%91%CE%A4%CE%91-%CE%A6%CE%9F%CE%A1%CE%9F%CE%9B%CE%9F%CE%93%CE%99%CE%91%CE%A3-%CE%9A%CE%91%CE%99-%CE%9B%CE%9F%CE%93%CE%99%CE%A3%CE%A4%CE%99%CE%9A%CE%97%CE%A3/23791/%CE%91%CF%81%CE%B9%CE%B8%CE%BC%CF%8C%CF%82-%CE%A6%CE%BF%CF%81%CE%BF%CE%BB%CE%BF%CE%B3%CE%B9%CE%BA%CE%BF%CF%8D-%CE%9C%CE%B7%CF%84%CF%81%CF%8E%CE%BF%CF%85` 37898 */ function elGrCheck(tin) { 37899 // split digits into an array for further processing 37900 var digits = tin.split('').map(function(a) { 37901 return parseInt(a, 10); 37902 }); 37903 var checksum = 0; 37904 for(var i = 0; i < 8; i++)checksum += digits[i] * Math.pow(2, 8 - i); 37905 return checksum % 11 % 10 === digits[8]; 37906} 37907/* 37908 * en-GB validation function (should go here if needed) 37909 * (National Insurance Number (NINO) or Unique Taxpayer Reference (UTR), 37910 * persons/entities respectively) 37911 */ /* 37912 * en-IE validation function 37913 * (Personal Public Service Number (PPS No), persons only) 37914 * Verify TIN validity by calculating check (second to last) character 37915 */ function enIeCheck(tin) { 37916 var checksum = algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 7).map(function(a) { 37917 return parseInt(a, 10); 37918 }), 8); 37919 if (tin.length === 9 && tin[8] !== 'W') checksum += (tin[8].charCodeAt(0) - 64) * 9; 37920 checksum %= 23; 37921 if (checksum === 0) return tin[7].toUpperCase() === 'W'; 37922 return tin[7].toUpperCase() === String.fromCharCode(64 + checksum); 37923} 37924// Valid US IRS campus prefixes 37925var enUsCampusPrefix = { 37926 andover: [ 37927 '10', 37928 '12' 37929 ], 37930 atlanta: [ 37931 '60', 37932 '67' 37933 ], 37934 austin: [ 37935 '50', 37936 '53' 37937 ], 37938 brookhaven: [ 37939 '01', 37940 '02', 37941 '03', 37942 '04', 37943 '05', 37944 '06', 37945 '11', 37946 '13', 37947 '14', 37948 '16', 37949 '21', 37950 '22', 37951 '23', 37952 '25', 37953 '34', 37954 '51', 37955 '52', 37956 '54', 37957 '55', 37958 '56', 37959 '57', 37960 '58', 37961 '59', 37962 '65' 37963 ], 37964 cincinnati: [ 37965 '30', 37966 '32', 37967 '35', 37968 '36', 37969 '37', 37970 '38', 37971 '61' 37972 ], 37973 fresno: [ 37974 '15', 37975 '24' 37976 ], 37977 internet: [ 37978 '20', 37979 '26', 37980 '27', 37981 '45', 37982 '46', 37983 '47' 37984 ], 37985 kansas: [ 37986 '40', 37987 '44' 37988 ], 37989 memphis: [ 37990 '94', 37991 '95' 37992 ], 37993 ogden: [ 37994 '80', 37995 '90' 37996 ], 37997 philadelphia: [ 37998 '33', 37999 '39', 38000 '41', 38001 '42', 38002 '43', 38003 '46', 38004 '48', 38005 '62', 38006 '63', 38007 '64', 38008 '66', 38009 '68', 38010 '71', 38011 '72', 38012 '73', 38013 '74', 38014 '75', 38015 '76', 38016 '77', 38017 '81', 38018 '82', 38019 '83', 38020 '84', 38021 '85', 38022 '86', 38023 '87', 38024 '88', 38025 '91', 38026 '92', 38027 '93', 38028 '98', 38029 '99' 38030 ], 38031 sba: [ 38032 '31' 38033 ] 38034}; 38035// Return an array of all US IRS campus prefixes 38036function enUsGetPrefixes() { 38037 var prefixes = []; 38038 for(var location in enUsCampusPrefix)// https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes 38039 // istanbul ignore else 38040 if (enUsCampusPrefix.hasOwnProperty(location)) prefixes.push.apply(
38040prefixes, _toConsumableArray(enUsCampusPrefix[location])); 38041 return prefixes; 38042} 38043/* 38044 * en-US validation function 38045 * Verify that the TIN starts with a valid IRS campus prefix 38046 */ function enUsCheck(tin) { 38047 return enUsGetPrefixes().indexOf(tin.slice(0, 2)) !== -1; 38048} 38049/* 38050 * es-AR validation function 38051 * Clave Ãnica de Identificación Tributaria (CUIT/CUIL) 38052 * Sourced from: 38053 * - https://servicioscf.afip.gob.ar/publico/abc/ABCpaso2.aspx?id_nivel1=3036&id_nivel2=3040&p=Conceptos%20b%C3%A1sicos 38054 * - https://es.wikipedia.org/wiki/Clave_%C3%9Anica_de_Identificaci%C3%B3n_Tributaria 38055 */ function esArCheck(tin) { 38056 var accum = 0; 38057 var digits = tin.split(''); 38058 var digit = parseInt(digits.pop(), 10); 38059 for(var i = 0; i < digits.length; i++)accum += digits[9 - i] * (2 + i % 6); 38060 var verif = 11 - accum % 11; 38061 if (verif === 11) verif = 0; 38062 else if (verif === 10) verif = 9; 38063 return digit === verif; 38064} 38065/* 38066 * es-ES validation function 38067 * (Documento Nacional de Identidad (DNI) 38068 * or Número de Identificación de Extranjero (NIE), persons only) 38069 * Verify TIN validity by calculating check (last) character 38070 */ function esEsCheck(tin) { 38071 // Split characters into an array for further processing 38072 var chars = tin.toUpperCase().split(''); 38073 // Replace initial letter if needed 38074 if (isNaN(parseInt(chars[0], 10)) && chars.length > 1) { 38075 var lead_replace = 0; 38076 switch(chars[0]){ 38077 case 'Y': 38078 lead_replace = 1; 38079 break; 38080 case 'Z': 38081 lead_replace = 2; 38082 break; 38083 default: 38084 } 38085 chars.splice(0, 1, lead_replace); 38086 // Fill with zeros if smaller than proper 38087 } else while(chars.length < 9)chars.unshift(0); 38088 // Calculate checksum and check according to lookup 38089 var lookup = [ 38090 'T', 38091 'R', 38092 'W', 38093 'A', 38094 'G', 38095 'M', 38096 'Y', 38097 'F', 38098 'P', 38099 'D', 38100 'X', 38101 'B', 38102 'N', 38103 'J', 38104 'Z', 38105 'S', 38106 'Q', 38107 'V', 38108 'H', 38109 'L', 38110 'C', 38111 'K', 38112 'E' 38113 ]; 38114 chars = chars.join(''); 38115 var checksum = parseInt(chars.slice(0, 8), 10) % 23; 38116 return chars[8] === lookup[checksum]; 38117} 38118/* 38119 * et-EE validation function 38120 * (Isikukood (IK), persons only) 38121 * Checks if birth date (century digit and six following) is valid and calculates check (last) digit 38122 * Material not in DG TAXUD document sourced from: 38123 * - `https://www.oecd.org/tax/automatic-exchange/crs-implementation-and-assistance/tax-identification-numbers/Estonia-TIN.pdf` 38124 */ function etEeCheck(tin) { 38125 // Extract year and add century 38126 var full_year = tin.slice(1, 3); 38127 var century_digit = tin.slice(0, 1); 38128 switch(century_digit){ 38129 case '1': 38130 case '2': 38131 full_year = "18".concat(full_year); 38132 break; 38133 case '3': 38134 case '4': 38135 full_year = "19".concat(full_year); 38136 break; 38137 default: 38138 full_year = "20".concat(full_year); 38139 break; 38140 } 38141 // Check date validity 38142 var date = "".concat(full_year, "/").concat(tin.slice(3, 5), "/").concat(tin.slice(5, 7)); 38143 if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) return false; 38144 // Split digits into an array for further processing 38145 var digits = tin.split('').map(function(a) { 38146 return parseInt(a, 10); 38147 }); 38148 var checksum = 0; 38149 var weight = 1; 38150 // Multiply by weight and add to checksum 38151 for(var i = 0; i < 10; i++){ 38152 checksum += digits[i] * weight; 38153 weight += 1; 38154 if (weight === 10) weight = 1; 38155 } 38156 // Do again if modulo 11 of checksum is 10 38157 if (checksum % 11 === 10) { 38158 checksum = 0; 38159 weight = 3; 38160 for(var _i3 = 0; _i3 < 10; _i3++){ 38161 checksum += digits[_i3] * weight; 38162 weight += 1; 38163 if (weight === 10) weight = 1; 38164 } 38165 if (checksum % 11 === 10) return digits[10] === 0; 38166 } 38167 return checksum % 11 === digits[10]; 38168} 38169/* 38170 * fi-FI validation function 38171 * (Henkilötunnus (HETU), persons only) 38172 * Checks if birth date (first six digits plus century symbol) is valid 38173 * and calculates check (last) digit 38174 */ function fiFiCheck(tin) { 38175 // Extract year and add century 38176 var full_year = tin.slice(4, 6); 38177 var century_symbol = tin.slice(6, 7); 38178 switch(century_symbol){ 38179 case '+': 38180 full_year = "18".concat(full_year); 38181 break; 38182 case '-': 38183 full_year = "19".concat(full_year); 38184 break; 38185 default: 38186 full_year = "20".concat(full_year); 38187 break; 38188 } 38189 // Check date validity 38190 var date = "".concat(full_year, "/").concat(tin.slice(2, 4), "/").concat(tin.slice(0, 2)); 38191 if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) return false;
38192 // Calculate check character 38193 var checksum = parseInt(tin.slice(0, 6) + tin.slice(7, 10), 10) % 31; 38194 if (checksum < 10) return checksum === parseInt(tin.slice(10), 10); 38195 checksum -= 10; 38196 var letters_lookup = [ 38197 'A', 38198 'B', 38199 'C', 38200 'D', 38201 'E', 38202 'F', 38203 'H', 38204 'J', 38205 'K', 38206 'L', 38207 'M', 38208 'N', 38209 'P', 38210 'R', 38211 'S', 38212 'T', 38213 'U', 38214 'V', 38215 'W', 38216 'X', 38217 'Y' 38218 ]; 38219 return letters_lookup[checksum] === tin.slice(10); 38220} 38221/* 38222 * fr/nl-BE validation function 38223 * (Numéro national (N.N.), persons only) 38224 * Checks if birth date (first six digits) is valid and calculates check (last two) digits 38225 */ function frBeCheck(tin) { 38226 // Zero month/day value is acceptable 38227 if (tin.slice(2, 4) !== '00' || tin.slice(4, 6) !== '00') { 38228 // Extract date from first six digits of TIN 38229 var date = "".concat(tin.slice(0, 2), "/").concat(tin.slice(2, 4), "/").concat(tin.slice(4, 6)); 38230 if (!(0, _isDate.default)(date, 'YY/MM/DD')) return false; 38231 } 38232 var checksum = 97 - parseInt(tin.slice(0, 9), 10) % 97; 38233 var checkdigits = parseInt(tin.slice(9, 11), 10); 38234 if (checksum !== checkdigits) { 38235 checksum = 97 - parseInt("2".concat(tin.slice(0, 9)), 10) % 97; 38236 if (checksum !== checkdigits) return false; 38237 } 38238 return true; 38239} 38240/* 38241 * fr-FR validation function 38242 * (Numéro fiscal de référence (numéro SPI), persons only) 38243 * Verify TIN validity by calculating check (last three) digits 38244 */ function frFrCheck(tin) { 38245 tin = tin.replace(/\s/g, ''); 38246 var checksum = parseInt(tin.slice(0, 10), 10) % 511; 38247 var checkdigits = parseInt(tin.slice(10, 13), 10); 38248 return checksum === checkdigits; 38249} 38250/* 38251 * fr/lb-LU validation function 38252 * (numéro dâidentification personnelle, persons only) 38253 * Verify birth date validity and run Luhn and Verhoeff checks 38254 */ function frLuCheck(tin) { 38255 // Extract date and check validity 38256 var date = "".concat(tin.slice(0, 4), "/").concat(tin.slice(4, 6), "/").concat(tin.slice(6, 8)); 38257 if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) return false; 38258 // Run Luhn check 38259 if (!algorithms.luhnCheck(tin.slice(0, 12))) return false; 38260 // Remove Luhn check digit and run Verhoeff check 38261 return algorithms.verhoeffCheck("".concat(tin.slice(0, 11)).concat(tin[12])); 38262} 38263/* 38264 * hr-HR validation function 38265 * (Osobni identifikacijski broj (OIB), persons/entities) 38266 * Verify TIN validity by calling iso7064Check(digits) 38267 */ function hrHrCheck(tin) { 38268 return algorithms.iso7064Check(tin); 38269} 38270/* 38271 * hu-HU validation function 38272 * (AdóazonosÃtó jel, persons only) 38273 * Verify TIN validity by calculating check (last) digit 38274 */ function huHuCheck(tin) { 38275 // split digits into an array for further processing 38276 var digits = tin.split('').map(function(a) { 38277 return parseInt(a, 10); 38278 }); 38279 var checksum = 8; 38280 for(var i = 1; i < 9; i++)checksum += digits[i] * (i + 1); 38281 return checksum % 11 === digits[9]; 38282} 38283/* 38284 * lt-LT validation function (should go here if needed) 38285 * (Asmens kodas, persons/entities respectively) 38286 * Current validation check is alias of etEeCheck- same format applies 38287 */ /* 38288 * it-IT first/last name validity check 38289 * Accepts it-IT TIN-encoded names as a three-element character array and checks their validity 38290 * Due to lack of clarity between resources ("Are only Italian consonants used? 38291 * What happens if a person has X in their name?" etc.) only two test conditions 38292 * have been implemented: 38293 * Vowels may only be followed by other vowels or an X character 38294 * and X characters after vowels may only be followed by other X characters. 38295 */ function itItNameCheck(name) { 38296 // true at the first occurrence of a vowel 38297 var vowelflag = false; 38298 // true at the first occurrence of an X AFTER vowel 38299 // (to properly handle last names with X as consonant) 38300 var xflag = false; 38301 for(var i = 0; i < 3; i++){ 38302 if (!vowelflag && /[AEIOU]/.test(name[i])) vowelflag = true; 38303 else if (!xflag && vowelflag && name[i] === 'X') xflag = true; 38304 else if (i > 0) { 38305 if (vowelflag && !xflag) { 38306 if (!/[AEIOU]/.test(name[i])) return false;
38307 } 38308 if (xflag) { 38309 if (!/X/.test(name[i])) return false; 38310 } 38311 } 38312 } 38313 return true; 38314} 38315/* 38316 * it-IT validation function 38317 * (Codice fiscale (TIN-IT), persons only) 38318 * Verify name, birth date and codice catastale validity 38319 * and calculate check character. 38320 * Material not in DG-TAXUD document sourced from: 38321 * `https://en.wikipedia.org/wiki/Italian_fiscal_code` 38322 */ function itItCheck(tin) { 38323 // Capitalize and split characters into an array for further processing 38324 var chars = tin.toUpperCase().split(''); 38325 // Check first and last name validity calling itItNameCheck() 38326 if (!itItNameCheck(chars.slice(0, 3))) return false; 38327 if (!itItNameCheck(chars.slice(3, 6))) return false; 38328 // Convert letters in number spaces back to numbers if any 38329 var number_locations = [ 38330 6, 38331 7, 38332 9, 38333 10, 38334 12, 38335 13, 38336 14 38337 ]; 38338 var number_replace = { 38339 L: '0', 38340 M: '1', 38341 N: '2', 38342 P: '3', 38343 Q: '4', 38344 R: '5', 38345 S: '6', 38346 T: '7', 38347 U: '8', 38348 V: '9' 38349 }; 38350 for(var _i4 = 0, _number_locations = number_locations; _i4 < _number_locations.length; _i4++){ 38351 var i = _number_locations[_i4]; 38352 if (chars[i] in number_replace) chars.splice(i, 1, number_replace[chars[i]]); 38353 } 38354 // Extract month and day, and check date validity 38355 var month_replace = { 38356 A: '01', 38357 B: '02', 38358 C: '03', 38359 D: '04', 38360 E: '05', 38361 H: '06', 38362 L: '07', 38363 M: '08', 38364 P: '09', 38365 R: '10', 38366 S: '11', 38367 T: '12' 38368 }; 38369 var month = month_replace[chars[8]]; 38370 var day = parseInt(chars[9] + chars[10], 10); 38371 if (day > 40) day -= 40; 38372 if (day < 10) day = "0".concat(day); 38373 var date = "".concat(chars[6]).concat(chars[7], "/").concat(month, "/").concat(day); 38374 if (!(0, _isDate.default)(date, 'YY/MM/DD')) return false; 38375 // Calculate check character by adding up even and odd characters as numbers 38376 var checksum = 0; 38377 for(var _i5 = 1; _i5 < chars.length - 1; _i5 += 2){ 38378 var char_to_int = parseInt(chars[_i5], 10); 38379 if (isNaN(char_to_int)) char_to_int = chars[_i5].charCodeAt(0) - 65; 38380 checksum += char_to_int; 38381 } 38382 var odd_convert = { 38383 // Maps of characters at odd places 38384 A: 1, 38385 B: 0, 38386 C: 5, 38387 D: 7, 38388 E: 9, 38389 F: 13, 38390 G: 15, 38391 H: 17, 38392 I: 19, 38393 J: 21, 38394 K: 2, 38395 L: 4, 38396 M: 18, 38397 N: 20, 38398 O: 11, 38399 P: 3, 38400 Q: 6, 38401 R: 8, 38402 S: 12, 38403 T: 14, 38404 U: 16, 38405 V: 10, 38406 W: 22, 38407 X: 25, 38408 Y: 24, 38409 Z: 23, 38410 0: 1, 38411 1: 0 38412 }; 38413 for(var _i6 = 0; _i6 < chars.length - 1; _i6 += 2){ 38414 var _char_to_int = 0; 38415 if (chars[_i6] in odd_convert) _char_to_int = odd_convert[chars[_i6]]; 38416 else { 38417 var multiplier = parseInt(chars[_i6], 10); 38418 _char_to_int = 2 * multiplier + 1; 38419 if (multiplier > 4) _char_to_int += 2; 38420 } 38421 checksum += _char_to_int; 38422 } 38423 if (String.fromCharCode(65 + checksum % 26) !== chars[15]) return false; 38424 return true; 38425} 38426/* 38427 * lv-LV validation function 38428 * (Personas kods (PK), persons only) 38429 * Check validity of birth date and calculate check (last) digit 38430 * Support only for old format numbers (not starting with '32', issued before 2017/07/01) 38431 * Material not in DG TAXUD document sourced from: 38432 * `https://boot.ritakafija.lv/forums/index.php?/topic/88314-personas-koda-algoritms-%C4%8Deksumma/` 38433 */ function lvLvCheck(tin) { 38434 tin = tin.replace(/\W/, ''); 38435 // Extract date from TIN 38436 var day = tin.slice(0, 2); 38437 if (day !== '32') { 38438 // No date/checksum check if new format 38439 var month = tin.slice(2, 4); 38440 if (month !== '00') { 38441 // No date check if unknown month 38442 var full_year = tin.slice(4, 6); 38443 switch(tin[6]){ 38444 case '0': 38445 full_year = "18".concat(full_year); 38446 break; 38447 case '1': 38448 full_year = "19".concat(full_year); 38449 break; 38450 default: 38451 full_year = "20".concat(full_year); 38452 break; 38453 } 38454 // Check date validity 38455 var date = "".concat(full_year, "/").concat(tin.slice(2, 4), "/").concat(day); 38456 if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) return false;
38457 } 38458 // Calculate check digit 38459 var checksum = 1101; 38460 var multip_lookup = [ 38461 1, 38462 6, 38463 3, 38464 7, 38465 9, 38466 10, 38467 5, 38468 8, 38469 4, 38470 2 38471 ]; 38472 for(var i = 0; i < tin.length - 1; i++)checksum -= parseInt(tin[i], 10) * multip_lookup[i]; 38473 return parseInt(tin[10], 10) === checksum % 11; 38474 } 38475 return true; 38476} 38477/* 38478 * mt-MT validation function 38479 * (Identity Card Number or Unique Taxpayer Reference, persons/entities) 38480 * Verify Identity Card Number structure (no other tests found) 38481 */ function mtMtCheck(tin) { 38482 if (tin.length !== 9) { 38483 // No tests for UTR 38484 var chars = tin.toUpperCase().split(''); 38485 // Fill with zeros if smaller than proper 38486 while(chars.length < 8)chars.unshift(0); 38487 // Validate format according to last character 38488 switch(tin[7]){ 38489 case 'A': 38490 case 'P': 38491 if (parseInt(chars[6], 10) === 0) return false; 38492 break; 38493 default: 38494 var first_part = parseInt(chars.join('').slice(0, 5), 10); 38495 if (first_part > 32000) return false; 38496 var second_part = parseInt(chars.join('').slice(5, 7), 10); 38497 if (first_part === second_part) return false; 38498 } 38499 } 38500 return true; 38501} 38502/* 38503 * nl-NL validation function 38504 * (Burgerservicenummer (BSN) or Rechtspersonen Samenwerkingsverbanden Informatie Nummer (RSIN), 38505 * persons/entities respectively) 38506 * Verify TIN validity by calculating check (last) digit (variant of MOD 11) 38507 */ function nlNlCheck(tin) { 38508 return algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 8).map(function(a) { 38509 return parseInt(a, 10); 38510 }), 9) % 11 === parseInt(tin[8], 10); 38511} 38512/* 38513 * pl-PL validation function 38514 * (Powszechny Elektroniczny System Ewidencji LudnoÅci (PESEL) 38515 * or Numer identyfikacji podatkowej (NIP), persons/entities) 38516 * Verify TIN validity by validating birth date (PESEL) and calculating check (last) digit 38517 */ function plPlCheck(tin) { 38518 // NIP 38519 if (tin.length === 10) { 38520 // Calculate last digit by multiplying with lookup 38521 var lookup = [ 38522 6, 38523 5, 38524 7, 38525 2, 38526 3, 38527 4, 38528 5, 38529 6, 38530 7 38531 ]; 38532 var _checksum = 0; 38533 for(var i = 0; i < lookup.length; i++)_checksum += parseInt(tin[i], 10) * lookup[i]; 38534 _checksum %= 11; 38535 if (_checksum === 10) return false; 38536 return _checksum === parseInt(tin[9], 10); 38537 } 38538 // PESEL 38539 // Extract full year using month 38540 var full_year = tin.slice(0, 2); 38541 var month = parseInt(tin.slice(2, 4), 10); 38542 if (month > 80) { 38543 full_year = "18".concat(full_year); 38544 month -= 80; 38545 } else if (month > 60) { 38546 full_year = "22".concat(full_year); 38547 month -= 60; 38548 } else if (month > 40) { 38549 full_year = "21".concat(full_year); 38550 month -= 40; 38551 } else if (month > 20) { 38552 full_year = "20".concat(full_year); 38553 month -= 20; 38554 } else full_year = "19".concat(full_year); 38555 // Add leading zero to month if needed 38556 if (month < 10) month = "0".concat(month); 38557 // Check date validity 38558 var date = "".concat(full_year, "/").concat(month, "/").concat(tin.slice(4, 6)); 38559 if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) return false; 38560 // Calculate last digit by multiplying with odd one-digit numbers except 5 38561 var checksum = 0; 38562 var multiplier = 1; 38563 for(var _i7 = 0; _i7 < tin.length - 1; _i7++){ 38564 checksum += parseInt(tin[_i7], 10) * multiplier % 10; 38565 multiplier += 2; 38566 if (multiplier > 10) multiplier = 1; 38567 else if (multiplier === 5) multiplier += 2; 38568 } 38569 checksum = 10 - checksum % 10; 38570 return checksum === parseInt(tin[10], 10); 38571} 38572/* 38573* pt-BR validation function 38574* (Cadastro de Pessoas FÃsicas (CPF, persons) 38575* Cadastro Nacional de Pessoas JurÃdicas (CNPJ, entities) 38576* Both inputs will be validated 38577*/ function ptBrCheck(tin) { 38578 if (tin.length === 11) { 38579 var _sum; 38580 var remainder; 38581 _sum = 0;
38582 if (// Reject known invalid CPFs 38583 tin === '11111111111' || tin === '22222222222' || tin === '33333333333' || tin === '44444444444' || tin === '55555555555' || tin === '66666666666' || tin === '77777777777' || tin === '88888888888' || tin === '99999999999' || tin === '00000000000') return false; 38584 for(var i = 1; i <= 9; i++)_sum += parseInt(tin.substring(i - 1, i), 10) * (11 - i); 38585 remainder = _sum * 10 % 11; 38586 if (remainder === 10) remainder = 0; 38587 if (remainder !== parseInt(tin.substring(9, 10), 10)) return false; 38588 _sum = 0; 38589 for(var _i8 = 1; _i8 <= 10; _i8++)_sum += parseInt(tin.substring(_i8 - 1, _i8), 10) * (12 - _i8); 38590 remainder = _sum * 10 % 11; 38591 if (remainder === 10) remainder = 0; 38592 if (remainder !== parseInt(tin.substring(10, 11), 10)) return false; 38593 return true; 38594 } 38595 if (// Reject know invalid CNPJs 38596 tin === '00000000000000' || tin === '11111111111111' || tin === '22222222222222' || tin === '33333333333333' || tin === '44444444444444' || tin === '55555555555555' || tin === '66666666666666' || tin === '77777777777777' || tin === '88888888888888' || tin === '99999999999999') return false; 38597 var length = tin.length - 2; 38598 var identifiers = tin.substring(0, length); 38599 var verificators = tin.substring(length); 38600 var sum = 0; 38601 var pos = length - 7; 38602 for(var _i9 = length; _i9 >= 1; _i9--){ 38603 sum += identifiers.charAt(length - _i9) * pos; 38604 pos -= 1; 38605 if (pos < 2) pos = 9; 38606 } 38607 var result = sum % 11 < 2 ? 0 : 11 - sum % 11; 38608 if (result !== parseInt(verificators.charAt(0), 10)) return false; 38609 length += 1; 38610 identifiers = tin.substring(0, length); 38611 sum = 0; 38612 pos = length - 7; 38613 for(var _i0 = length; _i0 >= 1; _i0--){ 38614 sum += identifiers.charAt(length - _i0) * pos; 38615 pos -= 1; 38616 if (pos < 2) pos = 9; 38617 } 38618 result = sum % 11 < 2 ? 0 : 11 - sum % 11; 38619 if (result !== parseInt(verificators.charAt(1), 10)) return false; 38620 return true; 38621} 38622/* 38623 * pt-PT validation function 38624 * (Número de identificação fiscal (NIF), persons/entities) 38625 * Verify TIN validity by calculating check (last) digit (variant of MOD 11) 38626 */ function ptPtCheck(tin) { 38627 var checksum = 11 - algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 8).map(function(a) { 38628 return parseInt(a, 10); 38629 }), 9) % 11; 38630 if (checksum > 9) return parseInt(tin[8], 10) === 0; 38631 return checksum === parseInt(tin[8], 10); 38632} 38633/* 38634 * ro-RO validation function 38635 * (Cod Numeric Personal (CNP) or Cod de înregistrare fiscalÄ (CIF), 38636 * persons only) 38637 * Verify CNP validity by calculating check (last) digit (test not found for CIF) 38638 * Material not in DG TAXUD document sourced from: 38639 * `https://en.wikipedia.org/wiki/National_identification_number#Romania` 38640 */ function roRoCheck(tin) { 38641 if (tin.slice(0, 4) !== '9000') { 38642 // No test found for this format 38643 // Extract full year using century digit if possible 38644 var full_year = tin.slice(1, 3); 38645 switch(tin[0]){ 38646 case '1': 38647 case '2': 38648 full_year = "19".concat(full_year); 38649 break; 38650 case '3': 38651 case '4': 38652 full_year = "18".concat(full_year); 38653 break; 38654 case '5': 38655 case '6': 38656 full_year = "20".concat(full_year); 38657 break; 38658 default: 38659 } 38660 // Check date validity 38661 var date = "".concat(full_year, "/").concat(tin.slice(3, 5), "/").concat(tin.slice(5, 7)); 38662 if (date.length === 8) { 38663 if (!(0, _isDate.default)(date, 'YY/MM/DD')) return false; 38664 } else if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) return false; 38665 // Calculate check digit 38666 var digits = tin.split('').map(function(a) { 38667 return parseInt(a, 10); 38668 }); 38669 var multipliers = [ 38670 2, 38671 7, 38672 9, 38673 1, 38674 4, 38675 6, 38676 3, 38677 5, 38678 8, 38679 2, 38680 7, 38681 9 38682 ]; 38683 var checksum = 0; 38684 for(var i = 0; i < multipliers.length; i++)checksum += digits[i] * multipliers[i]; 38685 if (checksum % 11 === 10) return digits[12] === 1; 38686 return digits[12] === checksum % 11; 38687 } 38688 return true; 38689} 38690/* 38691 * sk-SK validation function 38692 * (Rodné ÄÃslo (RÄ) or bezvýznamové identifikaÄné ÄÃslo (BIÄ), persons only) 38693 * Checks validity of pre-1954 birth numbers (rodné ÄÃslo) only 38694 * Due to the introduction of the pseudo-random BIÄ it is not possible to test 38695 * post-1954 birth numbers without knowing whether they are BIÄ or RÄ beforehand 38696 */ function skSkCheck(tin) { 38697 if (tin.length === 9) { 38698 tin = tin.replace(/\W/, ''); 38699 if (tin.slice(6) === '000') return false;
38700 // Three-zero serial not assigned before 1954 38701 // Extract full year from TIN length 38702 var full_year = parseInt(tin.slice(0, 2), 10); 38703 if (full_year > 53) return false; 38704 if (full_year < 10) full_year = "190".concat(full_year); 38705 else full_year = "19".concat(full_year); 38706 // Extract month from TIN and normalize 38707 var month = parseInt(tin.slice(2, 4), 10); 38708 if (month > 50) month -= 50; 38709 if (month < 10) month = "0".concat(month); 38710 // Check date validity 38711 var date = "".concat(full_year, "/").concat(month, "/").concat(tin.slice(4, 6)); 38712 if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) return false; 38713 } 38714 return true; 38715} 38716/* 38717 * sl-SI validation function 38718 * (DavÄna Å¡tevilka, persons/entities) 38719 * Verify TIN validity by calculating check (last) digit (variant of MOD 11) 38720 */ function slSiCheck(tin) { 38721 var checksum = 11 - algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 7).map(function(a) { 38722 return parseInt(a, 10); 38723 }), 8) % 11; 38724 if (checksum === 10) return parseInt(tin[7], 10) === 0; 38725 return checksum === parseInt(tin[7], 10); 38726} 38727/* 38728 * sv-SE validation function 38729 * (Personnummer or samordningsnummer, persons only) 38730 * Checks validity of birth date and calls luhnCheck() to validate check (last) digit 38731 */ function svSeCheck(tin) { 38732 // Make copy of TIN and normalize to two-digit year form 38733 var tin_copy = tin.slice(0); 38734 if (tin.length > 11) tin_copy = tin_copy.slice(2); 38735 // Extract date of birth 38736 var full_year = ''; 38737 var month = tin_copy.slice(2, 4); 38738 var day = parseInt(tin_copy.slice(4, 6), 10); 38739 if (tin.length > 11) full_year = tin.slice(0, 4); 38740 else { 38741 full_year = tin.slice(0, 2); 38742 if (tin.length === 11 && day < 60) { 38743 // Extract full year from centenarian symbol 38744 // Should work just fine until year 10000 or so 38745 var current_year = new Date().getFullYear().toString(); 38746 var current_century = parseInt(current_year.slice(0, 2), 10); 38747 current_year = parseInt(current_year, 10); 38748 if (tin[6] === '-') { 38749 if (parseInt("".concat(current_century).concat(full_year), 10) > current_year) full_year = "".concat(current_century - 1).concat(full_year); 38750 else full_year = "".concat(current_century).concat(full_year); 38751 } else { 38752 full_year = "".concat(current_century - 1).concat(full_year); 38753 if (current_year - parseInt(full_year, 10) < 100) return false; 38754 } 38755 } 38756 } 38757 // Normalize day and check date validity 38758 if (day > 60) day -= 60; 38759 if (day < 10) day = "0".concat(day); 38760 var date = "".concat(full_year, "/").concat(month, "/").concat(day); 38761 if (date.length === 8) { 38762 if (!(0, _isDate.default)(date, 'YY/MM/DD')) return false; 38763 } else if (!(0, _isDate.default)(date, 'YYYY/MM/DD')) return false; 38764 return algorithms.luhnCheck(tin.replace(/\W/, '')); 38765} 38766/** 38767 * uk-UA validation function 38768 * Verify TIN validity by calculating check (last) digit (variant of MOD 11) 38769 */ function ukUaCheck(tin) { 38770 // Calculate check digit 38771 var digits = tin.split('').map(function(a) { 38772 return parseInt(a, 10); 38773 }); 38774 var multipliers = [ 38775 -1, 38776 5, 38777 7, 38778 9, 38779 4, 38780 6, 38781 10, 38782 5, 38783 7 38784 ]; 38785 var checksum = 0; 38786 for(var i = 0; i < multipliers.length; i++)checksum += digits[i] * multipliers[i]; 38787 return checksum % 11 === 10 ? digits[9] === 0 : digits[9] === checksum % 11; 38788} 38789// Locale lookup objects 38790/* 38791 * Tax id regex formats for various locales 38792 * 38793 * Where not explicitly specified in DG-TAXUD document both 38794 * uppercase and lowercase letters are acceptable. 38795 */ var taxIdFormat = { 38796 'bg-BG': /^\d{10}$/, 38797 'cs-CZ': /^\d{6}\/{0,1}\d{3,4}$/, 38798 'de-AT': /^\d{9}$/, 38799 'de-DE': /^[1-9]\d{10}$/, 38800 'dk-DK': /^\d{6}-{0,1}\d{4}$/, 38801 'el-CY': /^[09]\d{7}[A-Z]$/, 38802 'el-GR': /^([0-4]|[7-9])\d{8}$/, 38803 'en-CA': /^\d{9}$/, 38804 'en-GB': /^\d{10}$|^(?!GB|NK|TN|ZZ)(?![DFIQUV])[A-Z](?![DFIQUVO])[A-Z]\d{6}[ABCD ]$/i, 38805 'en-IE': /^\d{7}[A-W][A-IW]{0,1}$/i, 38806 'en-US': /^\d{2}[- ]{0,1}\d{7}$/, 38807 'es-AR': /(20|23|24|27|30|33|34)[0-9]{8}[0-9]/, 38808 'es-ES': /^(\d{0,8}|[XYZKLM]\d{7})[A-HJ-NP-TV-Z]$/i, 38809 'et-EE': /^[1-6]\d{6}(00[1-9]|0[1-9][0-9]|[1-6][0-9]{2}|70[0-9]|710)\d$/, 38810 'fi-FI': /^\d{6}[-+A]\d{3}[0-9A-FHJ-NPR-Y]$/i, 38811 'fr-BE': /^\d{11}$/, 38812 'fr-FR': /^[0-3]\d{12}$|^[0-3]\d\s\d{2}(\s\d{3}){3}$/, 38813 // Conforms both to official spec and provided example 38814 'fr-LU': /^\d{13}$/,
38815 'hr-HR': /^\d{11}$/, 38816 'hu-HU': /^8\d{9}$/, 38817 'it-IT': /^[A-Z]{6}[L-NP-V0-9]{2}[A-EHLMPRST][L-NP-V0-9]{2}[A-ILMZ][L-NP-V0-9]{3}[A-Z]$/i, 38818 'lv-LV': /^\d{6}-{0,1}\d{5}$/, 38819 // Conforms both to DG TAXUD spec and original research 38820 'mt-MT': /^\d{3,7}[APMGLHBZ]$|^([1-8])\1\d{7}$/i, 38821 'nl-NL': /^\d{9}$/, 38822 'pl-PL': /^\d{10,11}$/, 38823 'pt-BR': /(?:^\d{11}$)|(?:^\d{14}$)/, 38824 'pt-PT': /^\d{9}$/, 38825 'ro-RO': /^\d{13}$/, 38826 'sk-SK': /^\d{6}\/{0,1}\d{3,4}$/, 38827 'sl-SI': /^[1-9]\d{7}$/, 38828 'sv-SE': /^(\d{6}[-+]{0,1}\d{4}|(18|19|20)\d{6}[-+]{0,1}\d{4})$/, 38829 'uk-UA': /^\d{10}$/ 38830}; 38831// taxIdFormat locale aliases 38832taxIdFormat['lb-LU'] = taxIdFormat['fr-LU']; 38833taxIdFormat['lt-LT'] = taxIdFormat['et-EE']; 38834taxIdFormat['nl-BE'] = taxIdFormat['fr-BE']; 38835taxIdFormat['fr-CA'] = taxIdFormat['en-CA']; 38836// Algorithmic tax id check functions for various locales 38837var taxIdCheck = { 38838 'bg-BG': bgBgCheck, 38839 'cs-CZ': csCzCheck, 38840 'de-AT': deAtCheck, 38841 'de-DE': deDeCheck, 38842 'dk-DK': dkDkCheck, 38843 'el-CY': elCyCheck, 38844 'el-GR': elGrCheck, 38845 'en-CA': isCanadianSIN, 38846 'en-IE': enIeCheck, 38847 'en-US': enUsCheck, 38848 'es-AR': esArCheck, 38849 'es-ES': esEsCheck, 38850 'et-EE': etEeCheck, 38851 'fi-FI': fiFiCheck, 38852 'fr-BE': frBeCheck, 38853 'fr-FR': frFrCheck, 38854 'fr-LU': frLuCheck, 38855 'hr-HR': hrHrCheck, 38856 'hu-HU': huHuCheck, 38857 'it-IT': itItCheck, 38858 'lv-LV': lvLvCheck, 38859 'mt-MT': mtMtCheck, 38860 'nl-NL': nlNlCheck, 38861 'pl-PL': plPlCheck, 38862 'pt-BR': ptBrCheck, 38863 'pt-PT': ptPtCheck, 38864 'ro-RO': roRoCheck, 38865 'sk-SK': skSkCheck, 38866 'sl-SI': slSiCheck, 38867 'sv-SE': svSeCheck, 38868 'uk-UA': ukUaCheck 38869}; 38870// taxIdCheck locale aliases 38871taxIdCheck['lb-LU'] = taxIdCheck['fr-LU']; 38872taxIdCheck['lt-LT'] = taxIdCheck['et-EE']; 38873taxIdCheck['nl-BE'] = taxIdCheck['fr-BE']; 38874taxIdCheck['fr-CA'] = taxIdCheck['en-CA']; 38875// Regexes for locales where characters should be omitted before checking format 38876var allsymbols = /[-\\\/!@#$%\^&\*\(\)\+\=\[\]]+/g; 38877var sanitizeRegexes = { 38878 'de-AT': allsymbols, 38879 'de-DE': /[\/\\]/g, 38880 'fr-BE': allsymbols 38881}; 38882// sanitizeRegexes locale aliases 38883sanitizeRegexes['nl-BE'] = sanitizeRegexes['fr-BE']; 38884/* 38885 * Validator function 38886 * Return true if the passed string is a valid tax identification number 38887 * for the specified locale. 38888 * Throw an error exception if the locale is not supported. 38889 */ function isTaxID(str) { 38890 var locale = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'en-US'; 38891 (0, _assertString.default)(str); 38892 // Copy TIN to avoid replacement if sanitized 38893 var strcopy = str.slice(0); 38894 if (locale in taxIdFormat) { 38895 if (locale in sanitizeRegexes) strcopy = strcopy.replace(sanitizeRegexes[locale], ''); 38896 if (!taxIdFormat[locale].test(strcopy)) return false; 38897 if (locale in taxIdCheck) return taxIdCheck[locale](strcopy); 38898 // Fallthrough; not all locales have algorithmic checks 38899 return true; 38900 } 38901 throw new Error("Invalid locale '".concat(locale, "'")); 38902} 38903module.exports = exports.default; 38904module.exports.default = exports.default; 38905 38906},{"79f64cb44c2530a":"fQT2o","c14e0a9edffe0e65":"gZTPm","5ed6659e234b0708":"5brQk"}],"gZTPm":[function(require,module,exports,__globalThis) { 38907"use strict"; 38908Object.defineProperty(exports, "__esModule", { 38909 value: true 38910}); 38911exports.iso7064Check = iso7064Check; 38912exports.luhnCheck = luhnCheck; 38913exports.reverseMultiplyAndSum = reverseMultiplyAndSum; 38914exports.verhoeffCheck = verhoeffCheck; 38915/** 38916 * Algorithmic validation functions 38917 * May be used as is or implemented in the workflow of other validators. 38918 */ /* 38919 * ISO 7064 validation function 38920 * Called with a string of numbers (incl. check digit) 38921 * to validate according to ISO 7064 (MOD 11, 10). 38922 */ function iso7064Check(str) { 38923 var checkvalue = 10; 38924 for(var i = 0; i < str.length - 1; i++)checkvalue = (parseInt(str[i], 10) + checkvalue) % 10 === 0 ? 9 : (parseInt(str[i], 10) + checkvalue) % 10 * 2 % 11; 38925 checkvalue = checkvalue === 1 ? 0 : 11 - checkvalue; 38926 return checkvalue === parseInt(str[10], 10); 38927} 38928/* 38929 * Luhn (mod 10) validation function 38930 * Called with a string of numbers (incl. check digit) 38931 * to validate according to the Luhn algorithm. 38932 */ function luhnCheck(str) { 38933 var checksum = 0; 38934 var second = false;
38935 for(var i = str.length - 1; i >= 0; i--){ 38936 if (second) { 38937 var product = parseInt(str[i], 10) * 2; 38938 if (product > 9) // sum digits of product and add to checksum 38939 checksum += product.toString().split('').map(function(a) { 38940 return parseInt(a, 10); 38941 }).reduce(function(a, b) { 38942 return a + b; 38943 }, 0); 38944 else checksum += product; 38945 } else checksum += parseInt(str[i], 10); 38946 second = !second; 38947 } 38948 return checksum % 10 === 0; 38949} 38950/* 38951 * Reverse TIN multiplication and summation helper function 38952 * Called with an array of single-digit integers and a base multiplier 38953 * to calculate the sum of the digits multiplied in reverse. 38954 * Normally used in variations of MOD 11 algorithmic checks. 38955 */ function reverseMultiplyAndSum(digits, base) { 38956 var total = 0; 38957 for(var i = 0; i < digits.length; i++)total += digits[i] * (base - i); 38958 return total; 38959} 38960/* 38961 * Verhoeff validation helper function 38962 * Called with a string of numbers 38963 * to validate according to the Verhoeff algorithm. 38964 */ function verhoeffCheck(str) { 38965 var d_table = [ 38966 [ 38967 0, 38968 1, 38969 2, 38970 3, 38971 4, 38972 5, 38973 6, 38974 7, 38975 8, 38976 9 38977 ], 38978 [ 38979 1, 38980 2, 38981 3, 38982 4, 38983 0, 38984 6, 38985 7, 38986 8, 38987 9, 38988 5 38989 ], 38990 [ 38991 2, 38992 3, 38993 4, 38994 0, 38995 1, 38996 7, 38997 8, 38998 9, 38999 5, 39000 6 39001 ], 39002 [ 39003 3, 39004 4, 39005 0, 39006 1, 39007 2, 39008 8, 39009 9, 39010 5, 39011 6, 39012 7 39013 ], 39014 [ 39015 4, 39016 0, 39017 1, 39018 2, 39019 3, 39020 9, 39021 5, 39022 6, 39023 7, 39024 8 39025 ], 39026 [ 39027 5, 39028 9, 39029 8, 39030 7, 39031 6, 39032 0, 39033 4, 39034 3, 39035 2, 39036 1 39037 ], 39038 [ 39039 6, 39040 5, 39041 9, 39042 8, 39043 7, 39044 1, 39045 0, 39046 4, 39047 3, 39048 2 39049 ], 39050 [ 39051 7, 39052 6, 39053 5, 39054 9, 39055 8, 39056 2, 39057 1, 39058 0, 39059 4, 39060 3 39061 ], 39062 [ 39063 8, 39064 7, 39065 6, 39066 5, 39067 9, 39068 3, 39069 2, 39070 1, 39071 0, 39072 4 39073 ], 39074 [ 39075 9, 39076 8, 39077 7, 39078 6, 39079 5, 39080 4, 39081 3, 39082 2, 39083 1, 39084 0 39085 ] 39086 ]; 39087 var p_table = [ 39088 [ 39089 0, 39090 1, 39091 2, 39092 3, 39093 4, 39094 5, 39095 6, 39096 7, 39097 8, 39098 9 39099 ], 39100 [ 39101 1, 39102 5, 39103 7, 39104 6, 39105 2, 39106 8, 39107 3, 39108 0, 39109 9, 39110 4 39111 ], 39112 [ 39113 5, 39114 8, 39115 0, 39116 3, 39117 7, 39118 9, 39119 6, 39120 1, 39121 4, 39122 2 39123 ], 39124 [ 39125 8, 39126 9, 39127 1, 39128 6, 39129 0, 39130 4, 39131 3, 39132 5, 39133 2, 39134 7 39135 ], 39136 [ 39137 9, 39138 4, 39139 5, 39140 3, 39141 1, 39142 2, 39143 6, 39144 8, 39145 7, 39146 0 39147 ], 39148 [ 39149 4, 39150 2, 39151 8, 39152 6, 39153 5, 39154 7, 39155 3, 39156 9, 39157 0, 39158 1 39159 ], 39160 [ 39161 2, 39162 7, 39163 9, 39164 3, 39165 8, 39166 0, 39167 6, 39168 4, 39169 1, 39170 5 39171 ], 39172 [ 39173 7, 39174 0, 39175 4, 39176 6, 39177 9, 39178 1, 39179 3, 39180 2, 39181 5, 39182 8 39183 ] 39184 ]; 39185 // Copy (to prevent replacement) and reverse 39186 var str_copy = str.split('').reverse().join(''); 39187 var checksum = 0; 39188 for(var i = 0; i < str_copy.length; i++)checksum = d_table[checksum][p_table[i % 8][parseInt(str_copy[i], 10)]]; 39189 return checksum === 0; 39190} 39191 39192},{}],"tvY2I":[function(require,module,exports,__globalThis) { 39193"use strict"; 39194Object.defineProperty(exports, "__esModule", { 39195 value: true 39196}); 39197exports.default = isMobilePhone; 39198exports.locales = void 0; 39199var _assertString = _interopRequireDefault(require("597548b071f799d0")); 39200function _interopRequireDefault(e) {
39201 return e && e.__esModule ? e : { 39202 default: e 39203 }; 39204} 39205/* eslint-disable max-len */ var phones = { 39206 'am-AM': /^(\+?374|0)(33|4[134]|55|77|88|9[13-689])\d{6}$/, 39207 'ar-AE': /^((\+?971)|0)?5[024568]\d{7}$/, 39208 'ar-BH': /^(\+?973)?(3|6)\d{7}$/, 39209 'ar-DZ': /^(\+?213|0)(5|6|7)\d{8}$/, 39210 'ar-LB': /^(\+?961)?((3|81)\d{6}|7\d{7})$/, 39211 'ar-EG': /^((\+?20)|0)?1[0125]\d{8}$/, 39212 'ar-IQ': /^(\+?964|0)?7[0-9]\d{8}$/, 39213 'ar-JO': /^(\+?962|0)?7[789]\d{7}$/, 39214 'ar-KW': /^(\+?965)([569]\d{7}|41\d{6})$/, 39215 'ar-LY': /^((\+?218)|0)?(9[1-6]\d{7}|[1-8]\d{7,9})$/, 39216 'ar-MA': /^(?:(?:\+|00)212|0)[5-7]\d{8}$/, 39217 'ar-OM': /^((\+|00)968)?([79][1-9])\d{6}$/, 39218 'ar-PS': /^(\+?970|0)5[6|9](\d{7})$/, 39219 'ar-SA': /^(!?(\+?966)|0)?5\d{8}$/, 39220 'ar-SD': /^((\+?249)|0)?(9[012369]|1[012])\d{7}$/, 39221 'ar-SY': /^(!?(\+?963)|0)?9\d{8}$/, 39222 'ar-TN': /^(\+?216)?[2459]\d{7}$/, 39223 'az-AZ': /^(\+994|0)(10|5[015]|7[07]|99)\d{7}$/, 39224 'bs-BA': /^((((\+|00)3876)|06))((([0-3]|[5-6])\d{6})|(4\d{7}))$/, 39225 'be-BY': /^(\+?375)?(24|25|29|33|44)\d{7}$/, 39226 'bg-BG': /^(\+?359|0)?8[789]\d{7}$/, 39227 'bn-BD': /^(\+?880|0)1[13456789][0-9]{8}$/, 39228 'ca-AD': /^(\+376)?[346]\d{5}$/, 39229 'cs-CZ': /^(\+?420)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/, 39230 'da-DK': /^(\+?45)?\s?\d{2}\s?\d{2}\s?\d{2}\s?\d{2}$/, 39231 'de-DE': /^((\+49|0)1)(5[0-25-9]\d|6([23]|0\d?)|7([0-57-9]|6\d))\d{7,9}$/, 39232 'de-AT': /^(\+43|0)\d{1,4}\d{3,12}$/, 39233 'de-CH': /^(\+41|0)([1-9])\d{1,9}$/, 39234 'de-LU': /^(\+352)?((6\d1)\d{6})$/, 39235 'dv-MV': /^(\+?960)?(7[2-9]|9[1-9])\d{5}$/, 39236 'el-GR': /^(\+?30|0)?6(8[5-9]|9(?![26])[0-9])\d{7}$/, 39237 'el-CY': /^(\+?357?)?(9(9|7|6|5|4)\d{6})$/, 39238 'en-AI': /^(\+?1|0)264(?:2(35|92)|4(?:6[1-2]|76|97)|5(?:3[6-9]|8[1-4])|7(?:2(4|9)|72))\d{4}$/, 39239 'en-AU': /^(\+?61|0)4\d{8}$/, 39240 'en-AG': /^(?:\+1|1)268(?:464|7(?:1[3-9]|[28]\d|3[0246]|64|7[0-689]))\d{4}$/, 39241 'en-BM': /^(\+?1)?441(((3|7)\d{6}$)|(5[0-3][0-9]\d{4}$)|(59\d{5}$))/, 39242 'en-BS': /^(\+?1[-\s]?|0)?\(?242\)?[-\s]?\d{3}[-\s]?\d{4}$/, 39243 'en-GB': /^(\+?44|0)7[1-9]\d{8}$/, 39244 'en-GG': /^(\+?44|0)1481\d{6}$/, 39245 'en-GH': /^(\+233|0)(20|50|24|54|27|57|26|56|23|53|28|55|59)\d{7}$/, 39246 'en-GY': /^(\+592|0)6\d{6}$/, 39247 'en-HK': /^(\+?852[-\s]?)?[456789]\d{3}[-\s]?\d{4}$/, 39248 'en-MO': /^(\+?853[-\s]?)?[6]\d{3}[-\s]?\d{4}$/, 39249 'en-IE': /^(\+?353|0)8[356789]\d{7}$/, 39250 'en-IN': /^(\+?91|0)?[6789]\d{9}$/, 39251 'en-JM': /^(\+?876)?\d{7}$/, 39252 'en-KE': /^(\+?254|0)(7|1)\d{8}$/, 39253 'fr-CF': /^(\+?236| ?)(70|75|77|72|21|22)\d{6}$/, 39254 'en-SS': /^(\+?211|0)(9[1257])\d{7}$/, 39255 'en-KI': /^((\+686|686)?)?( )?((6|7)(2|3|8)[0-9]{6})$/, 39256 'en-KN': /^(?:\+1|1)869(?:46\d|48[89]|55[6-8]|66\d|76[02-7])\d{4}$/, 39257 'en-LS': /^(\+?266)(22|28|57|58|59|27|52)\d{6}$/, 39258 'en-MT': /^(\+?356|0)?(99|79|77|21|27|22|25)[0-9]{6}$/, 39259 'en-MU': /^(\+?230|0)?\d{8}$/, 39260 'en-MW': /^(\+?265|0)(((77|88|31|99|98|21)\d{7})|(((111)|1)\d{6})|(32000\d{4}))$/, 39261 'en-NA': /^(\+?264|0)(6|8)\d{7}$/, 39262 'en-NG': /^(\+?234|0)?[789]\d{9}$/, 39263 'en-NZ': /^(\+?64|0)[28]\d{7,9}$/, 39264 'en-PG': /^(\+?675|0)?(7\d|8[18])\d{6}$/, 39265 'en-PK': /^((00|\+)?92|0)3[0-6]\d{8}$/, 39266 'en-PH': /^(09|\+639)\d{9}$/, 39267 'en-RW': /^(\+?250|0)?[7]\d{8}$/, 39268 'en-SG': /^(\+65)?[3689]\d{7}$/, 39269 'en-SL': /^(\+?232|0)\d{8}$/, 39270 'en-TZ': /^(\+?255|0)?[67]\d{8}$/, 39271 'en-UG': /^(\+?256|0)?[7]\d{8}$/, 39272 'en-US': /^((\+1|1)?( |-)?)?(\([2-9][0-9]{2}\)|[2-9][0-9]{2})( |-)?([2-9][0-9]{2}( |-)?[0-9]{4})$/, 39273 'en-ZA': /^(\+?27|0)\d{9}$/, 39274 'en-ZM': /^(\+?26)?0[79][567]\d{7}$/, 39275 'en-ZW': /^(\+263)[0-9]{9}$/, 39276 'en-BW': /^(\+?267)?(7[1-8]{1})\d{6}$/, 39277 'es-AR': /^\+?549(11|[2368]\d)\d{8}$/, 39278 'es-BO': /^(\+?591)?(6|7)\d{7}$/, 39279 'es-CO': /^(\+?57)?3(0(0|1|2|4|5)|1\d|2[0-4]|5(0|1))\d{7}$/, 39280 'es-CL': /^(\+?56|0)[2-9]\d{1}\d{7}$/, 39281 'es-CR': /^(\+506)?[2-8]\d{7}$/, 39282 'es-CU': /^(\+53|0053)?5\d{7}$/, 39283 'es-DO': /^(\+?1)?8[024]9\d{7}$/, 39284 'es-HN': /^(\+?504)?[9|8|3|2]\d{7}$/, 39285 'es-EC': /^(\+?593|0)([2-7]|9[2-9])\d{7}$/, 39286 'es-ES': /^(\+?34)?[6|7]\d{8}$/, 39287 'es-GT': /^(\+?502)?[2|6|7]\d{7}$/, 39288 'es-PE': /^(\+?51)?9\d{8}$/, 39289 'es-MX': /^(\+?52)?(1|01)?\d{10,11}$/, 39290 'es-NI': /^(\+?505)\d{7,8}$/, 39291 'es-PA': /^(\+?507)\d{7,8}$/, 39292 'es-PY': /^(\+?595|0)9[9876]\d{7}$/, 39293 'es-SV': /^(\+?503)?[67]\d{7}$/, 39294 'es-UY': /^(\+598|0)9[1-9][\d]{6}$/, 39295 'es-VE': /^(\+?58)?(2|4)\d{9}$/, 39296 'et-EE': /^(\+?372)?\s?(5|8[1-4])\s?([0-9]\s?){6,7}$/, 39297 'fa-IR': /^(\+?98[\-\s]?|0)9[0-39]\d[\-\s]?\d{3}[\-\s]?\d{4}$/, 39298 'fi-FI': /^(\+?358|0)\s?(4[0-6]|50)\s?(\d\s?){4,8}$/, 39299 'fj-FJ': /^(\+?679)?\s?\d{3}\s?\d{4}$/, 39300 'fo-FO': /^(\+?298)?\s?\d{2}\s?\d{2}\s?\d{2}$/, 39301 'fr-BF': /^(\+226|0)[67]\d{7}$/, 39302 'fr-BJ': /^(\+229)\d{8}$/, 39303 'fr-CD': /^(\+?243|0)?(8|9)\d{8}$/, 39304 'fr-CM': /^(\+?237)6[0-9]{8}$/, 39305 'fr-FR': /^(\+?33|0)[67]\d{8}$/, 39306 'fr-GF': /^(\+?594|0|00594)[67]\d{8}$/, 39307 'fr-GP': /^(\+?590|0|00590)[67]\d{8}$/, 39308 'fr-MQ': /^(\+?596|0|00596)[67]\d{8}$/, 39309 'fr-PF': /^(\+?689)?8[789]\d{6}$/, 39310 'fr-RE': /^(\+?262|0|00262)[67]\d{8}$/, 39311 'fr-WF': /^(\+681)?\d{6}$/, 39312 'he-IL': /^(\+972|0)([23489]|5[012345689]|77)[1-9]\d{6}$/, 39313 'hu-HU': /^(\+?36|06)(20|30|31|50|70)\d{7}$/, 39314 'id-ID': /^(\+?62|0)8(1[123456789]|2[1238]|3[1238]|5[12356789]|7[78]|9[56789]|8[123456789])([\s?|\d]{5,11})$/, 39315 'ir-IR': /^(\+98|0)?9\d{9}$/, 39316 'it-IT': /^(\+?39)?\s?3\d{2} ?\d{6,7}$/, 39317 'it-SM': /^((\+378)|(0549)|(\+390549)|(\+3780549))?6\d{5,9}$/, 39318 'ja-JP': /^(\+81[ \-]?(\(0\))?|0)[6789]0[ \-]?\d{4}[ \-]?\d{4}$/, 39319 'ka-GE': /^(\+?995)?(79\d{7}|5\d{8})$/, 39320 'kk-KZ': /^(\+?7|8)?7\d{9}$/, 39321 'kl-GL': /^(\+?299)?\s?\d{2}\s?\d{2}\s?\d{2}$/, 39322 'ko-KR': /^((\+?82)[ \-]?)?0?1([0|1|6|7|8|9]{1})[ \-]?\d{3,4}[ \-]?\d{4}$/,
39323 'ky-KG': /^(\+996\s?)?(22[0-9]|50[0-9]|55[0-9]|70[0-9]|75[0-9]|77[0-9]|880|990|995|996|997|998)\s?\d{3}\s?\d{3}$/, 39324 'lt-LT': /^(\+370|8)\d{8}$/, 39325 'lv-LV': /^(\+?371)2\d{7}$/, 39326 'mg-MG': /^((\+?261|0)(2|3)\d)?\d{7}$/, 39327 'mn-MN': /^(\+|00|011)?976(77|81|88|91|94|95|96|99)\d{6}$/, 39328 'my-MM': /^(\+?959|09|9)(2[5-7]|3[1-2]|4[0-5]|6[6-9]|7[5-9]|9[6-9])[0-9]{7}$/, 39329 'ms-MY': /^(\+?60|0)1(([0145](-|\s)?\d{7,8})|([236-9](-|\s)?\d{7}))$/, 39330 'mz-MZ': /^(\+?258)?8[234567]\d{7}$/, 39331 'nb-NO': /^(\+?47)?[49]\d{7}$/, 39332 'ne-NP': /^(\+?977)?9[78]\d{8}$/, 39333 'nl-BE': /^(\+?32|0)4\d{8}$/, 39334 'nl-NL': /^(((\+|00)?31\(0\))|((\+|00)?31)|0)6{1}\d{8}$/, 39335 'nl-AW': /^(\+)?297(56|59|64|73|74|99)\d{5}$/, 39336 'nn-NO': /^(\+?47)?[49]\d{7}$/, 39337 'pl-PL': /^(\+?48)? ?([5-8]\d|45) ?\d{3} ?\d{2} ?\d{2}$/, 39338 'pt-BR': /^((\+?55\ ?[1-9]{2}\ ?)|(\+?55\ ?\([1-9]{2}\)\ ?)|(0[1-9]{2}\ ?)|(\([1-9]{2}\)\ ?)|([1-9]{2}\ ?))((\d{4}\-?\d{4})|(9[1-9]{1}\d{3}\-?\d{4}))$/, 39339 'pt-PT': /^(\+?351)?9[1236]\d{7}$/, 39340 'pt-AO': /^(\+?244)?9\d{8}$/, 39341 'ro-MD': /^(\+?373|0)((6(0|1|2|6|7|8|9))|(7(6|7|8|9)))\d{6}$/, 39342 'ro-RO': /^(\+?40|0)\s?7\d{2}(\/|\s|\.|-)?\d{3}(\s|\.|-)?\d{3}$/, 39343 'ru-RU': /^(\+?7|8)?9\d{9}$/, 39344 'si-LK': /^(?:0|94|\+94)?(7(0|1|2|4|5|6|7|8)( |-)?)\d{7}$/, 39345 'sl-SI': /^(\+386\s?|0)(\d{1}\s?\d{3}\s?\d{2}\s?\d{2}|\d{2}\s?\d{3}\s?\d{3})$/, 39346 'sk-SK': /^(\+?421)? ?[1-9][0-9]{2} ?[0-9]{3} ?[0-9]{3}$/, 39347 'so-SO': /^(\+?252|0)((6[0-9])\d{7}|(7[1-9])\d{7})$/, 39348 'sq-AL': /^(\+355|0)6[2-9]\d{7}$/, 39349 'sr-RS': /^(\+3816|06)[- \d]{5,9}$/, 39350 'sv-SE': /^(\+?46|0)[\s\-]?7[\s\-]?[02369]([\s\-]?\d){7}$/, 39351 'tg-TJ': /^(\+?992)?[5][5]\d{7}$/, 39352 'th-TH': /^(\+66|66|0)\d{9}$/, 39353 'tr-TR': /^(\+?90|0)?5\d{9}$/, 39354 'tk-TM': /^(\+993|993|8)\d{8}$/, 39355 'uk-UA': /^(\+?38)?0(50|6[36-8]|7[357]|9[1-9])\d{7}$/, 39356 'uz-UZ': /^(\+?998)?(6[125-79]|7[1-69]|88|9\d)\d{7}$/, 39357 'vi-VN': /^((\+?84)|0)((3([2-9]))|(5([25689]))|(7([0|6-9]))|(8([1-9]))|(9([0-9])))([0-9]{7})$/, 39358 'zh-CN': /^((\+|00)86)?(1[3-9]|9[28])\d{9}$/, 39359 'zh-TW': /^(\+?886\-?|0)?9\d{8}$/, 39360 'dz-BT': /^(\+?975|0)?(17|16|77|02)\d{6}$/, 39361 'ar-YE': /^(((\+|00)9677|0?7)[0137]\d{7}|((\+|00)967|0)[1-7]\d{6})$/, 39362 'ar-EH': /^(\+?212|0)[\s\-]?(5288|5289)[\s\-]?\d{5}$/, 39363 'fa-AF': /^(\+93|0)?(2{1}[0-8]{1}|[3-5]{1}[0-4]{1})(\d{7})$/, 39364 'mk-MK': /^(\+?389|0)?((?:2[2-9]\d{6}|(?:3[1-4]|4[2-8])\d{6}|500\d{5}|5[2-9]\d{6}|7[0-9][2-9]\d{5}|8[1-9]\d{6}|800\d{5}|8009\d{4}))$/ 39365}; 39366/* eslint-enable max-len */ // aliases 39367phones['en-CA'] = phones['en-US']; 39368phones['fr-CA'] = phones['en-CA']; 39369phones['fr-BE'] = phones['nl-BE']; 39370phones['zh-HK'] = phones['en-HK']; 39371phones['zh-MO'] = phones['en-MO']; 39372phones['ga-IE'] = phones['en-IE']; 39373phones['fr-CH'] = phones['de-CH']; 39374phones['it-CH'] = phones['fr-CH']; 39375function isMobilePhone(str, locale, options) { 39376 (0, _assertString.default)(str); 39377 if (options && options.strictMode && !str.startsWith('+')) return false; 39378 if (Array.isArray(locale)) return locale.some(function(key) { 39379 // https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes 39380 // istanbul ignore else 39381 if (phones.hasOwnProperty(key)) { 39382 var phone = phones[key]; 39383 if (phone.test(str)) return true; 39384 } 39385 return false; 39386 }); 39387 else if (locale in phones) return phones[locale].test(str); 39388 else if (!locale || locale === 'any') { 39389 for(var key in phones)// istanbul ignore else 39390 if (phones.hasOwnProperty(key)) { 39391 var phone = phones[key]; 39392 if (phone.test(str)) return true; 39393 } 39394 return false; 39395 } 39396 throw new Error("Invalid locale '".concat(locale, "'")); 39397} 39398var locales = exports.locales = Object.keys(phones); 39399 39400},{"597548b071f799d0":"fQT2o"}],"iWisa":[function(require,module,exports,__globalThis) { 39401"use strict"; 39402Object.defineProperty(exports, "__esModule", { 39403 value: true 39404}); 39405exports.default = isEthereumAddress; 39406var _assertString = _interopRequireDefault(require("de3278395f450524")); 39407function _interopRequireDefault(e) {
39408 return e && e.__esModule ? e : { 39409 default: e 39410 }; 39411} 39412var eth = /^(0x)[0-9a-f]{40}$/i; 39413function isEthereumAddress(str) { 39414 (0, _assertString.default)(str); 39415 return eth.test(str); 39416} 39417module.exports = exports.default; 39418module.exports.default = exports.default; 39419 39420},{"de3278395f450524":"fQT2o"}],"hdRnR":[function(require,module,exports,__globalThis) { 39421"use strict"; 39422Object.defineProperty(exports, "__esModule", { 39423 value: true 39424}); 39425exports.default = isCurrency; 39426var _merge = _interopRequireDefault(require("467cb2454d92d9c5")); 39427var _assertString = _interopRequireDefault(require("77391667839297f8")); 39428function _interopRequireDefault(e) { 39429 return e && e.__esModule ? e : { 39430 default: e 39431 }; 39432} 39433function currencyRegex(options) { 39434 var decimal_digits = "\\d{".concat(options.digits_after_decimal[0], "}"); 39435 options.digits_after_decimal.forEach(function(digit, index) { 39436 if (index !== 0) decimal_digits = "".concat(decimal_digits, "|\\d{").concat(digit, "}"); 39437 }); 39438 var symbol = "(".concat(options.symbol.replace(/\W/, function(m) { 39439 return "\\".concat(m); 39440 }), ")").concat(options.require_symbol ? '' : '?'), negative = '-?', whole_dollar_amount_without_sep = '[1-9]\\d*', whole_dollar_amount_with_sep = "[1-9]\\d{0,2}(\\".concat(options.thousands_separator, "\\d{3})*"), valid_whole_dollar_amounts = [ 39441 '0', 39442 whole_dollar_amount_without_sep, 39443 whole_dollar_amount_with_sep 39444 ], whole_dollar_amount = "(".concat(valid_whole_dollar_amounts.join('|'), ")?"), decimal_amount = "(\\".concat(options.decimal_separator, "(").concat(decimal_digits, "))").concat(options.require_decimal ? '' : '?'); 39445 var pattern = whole_dollar_amount + (options.allow_decimal || options.require_decimal ? decimal_amount : ''); 39446 // default is negative sign before symbol, but there are two other options (besides parens) 39447 if (options.allow_negatives && !options.parens_for_negatives) { 39448 if (options.negative_sign_after_digits) pattern += negative; 39449 else if (options.negative_sign_before_digits) pattern = negative + pattern; 39450 } 39451 // South African Rand, for example, uses R 123 (space) and R-123 (no space) 39452 if (options.allow_negative_sign_placeholder) pattern = "( (?!\\-))?".concat(pattern); 39453 else if (options.allow_space_after_symbol) pattern = " ?".concat(pattern); 39454 else if (options.allow_space_after_digits) pattern += '( (?!$))?'; 39455 if (options.symbol_after_digits) pattern += symbol; 39456 else pattern = symbol + pattern; 39457 if (options.allow_negatives) { 39458 if (options.parens_for_negatives) pattern = "(\\(".concat(pattern, "\\)|").concat(pattern, ")"); 39459 else if (!(options.negative_sign_before_digits || options.negative_sign_after_digits)) pattern = negative + pattern; 39460 } 39461 // ensure there's a dollar and/or decimal amount, and that 39462 // it doesn't start with a space or a negative sign followed by a space 39463 return new RegExp("^(?!-? )(?=.*\\d)".concat(pattern, "$")); 39464} 39465var default_currency_options = { 39466 symbol: '$', 39467 require_symbol: false, 39468 allow_space_after_symbol: false, 39469 symbol_after_digits: false, 39470 allow_negatives: true, 39471 parens_for_negatives: false, 39472 negative_sign_before_digits: false, 39473 negative_sign_after_digits: false, 39474 allow_negative_sign_placeholder: false, 39475 thousands_separator: ',', 39476 decimal_separator: '.', 39477 allow_decimal: true, 39478 require_decimal: false,
39479 digits_after_decimal: [ 39480 2 39481 ], 39482 allow_space_after_digits: false 39483}; 39484function isCurrency(str, options) { 39485 (0, _assertString.default)(str); 39486 options = (0, _merge.default)(options, default_currency_options); 39487 return currencyRegex(options).test(str); 39488} 39489module.exports = exports.default; 39490module.exports.default = exports.default; 39491 39492},{"467cb2454d92d9c5":"bRDoK","77391667839297f8":"fQT2o"}],"evb1P":[function(require,module,exports,__globalThis) { 39493"use strict"; 39494Object.defineProperty(exports, "__esModule", { 39495 value: true 39496}); 39497exports.default = isBtcAddress; 39498var _assertString = _interopRequireDefault(require("9e0eb8d87a25b3b2")); 39499function _interopRequireDefault(e) { 39500 return e && e.__esModule ? e : { 39501 default: e 39502 }; 39503} 39504var bech32 = /^(bc1|tb1|bc1p|tb1p)[ac-hj-np-z02-9]{39,58}$/; 39505var base58 = /^(1|2|3|m)[A-HJ-NP-Za-km-z1-9]{25,39}$/; 39506function isBtcAddress(str) { 39507 (0, _assertString.default)(str); 39508 return bech32.test(str) || base58.test(str); 39509} 39510module.exports = exports.default; 39511module.exports.default = exports.default; 39512 39513},{"9e0eb8d87a25b3b2":"fQT2o"}],"f9nZ5":[function(require,module,exports,__globalThis) { 39514"use strict"; 39515Object.defineProperty(exports, "__esModule", { 39516 value: true 39517}); 39518exports.isFreightContainerID = void 0; 39519exports.isISO6346 = isISO6346; 39520var _assertString = _interopRequireDefault(require("e78e39ae95a9b398")); 39521function _interopRequireDefault(e) { 39522 return e && e.__esModule ? e : { 39523 default: e 39524 }; 39525} 39526// https://en.wikipedia.org/wiki/ISO_6346 39527// according to ISO6346 standard, checksum digit is mandatory for freight container but recommended 39528// for other container types (J and Z) 39529var isISO6346Str = /^[A-Z]{3}(U[0-9]{7})|([J,Z][0-9]{6,7})$/; 39530var isDigit = /^[0-9]$/; 39531function isISO6346(str) { 39532 (0, _assertString.default)(str); 39533 str = str.toUpperCase(); 39534 if (!isISO6346Str.test(str)) return false; 39535 if (str.length === 11) { 39536 var sum = 0; 39537 for(var i = 0; i < str.length - 1; i++)if (!isDigit.test(str[i])) { 39538 var convertedCode = void 0; 39539 var letterCode = str.charCodeAt(i) - 55; 39540 if (letterCode < 11) convertedCode = letterCode; 39541 else if (letterCode >= 11 && letterCode <= 20) convertedCode = 12 + letterCode % 11; 39542 else if (letterCode >= 21 && letterCode <= 30) convertedCode = 23 + letterCode % 21; 39543 else convertedCode = 34 + letterCode % 31; 39544 sum += convertedCode * Math.pow(2, i); 39545 } else sum += str[i] * Math.pow(2, i); 39546 var checkSumDigit = sum % 11; 39547 if (checkSumDigit === 10) checkSumDigit = 0; 39548 return Number(str[str.length - 1]) === checkSumDigit; 39549 } 39550 return true; 39551} 39552var isFreightContainerID = exports.isFreightContainerID = isISO6346; 39553 39554},{"e78e39ae95a9b398":"fQT2o"}],"6DkiI":[function(require,module,exports,__globalThis) { 39555"use strict"; 39556Object.defineProperty(exports, "__esModule", { 39557 value: true 39558}); 39559exports.default = isISO6391; 39560var _assertString = _interopRequireDefault(require("a302ab81c2caac4d")); 39561function _interopRequireDefault(e) { 39562 return e && e.__esModule ? e : { 39563 default: e 39564 }; 39565} 39566var isISO6391Set = new Set([ 39567 'aa', 39568 'ab', 39569 'ae', 39570 'af', 39571 'ak', 39572 'am', 39573 'an', 39574 'ar', 39575 'as', 39576 'av', 39577 'ay', 39578 'az', 39579 'az', 39580 'ba', 39581 'be', 39582 'bg', 39583 'bh', 39584 'bi', 39585 'bm', 39586 'bn', 39587 'bo', 39588 'br', 39589 'bs', 39590 'ca', 39591 'ce', 39592 'ch', 39593 'co', 39594 'cr', 39595 'cs', 39596 'cu', 39597 'cv', 39598 'cy', 39599 'da', 39600 'de', 39601 'dv', 39602 'dz', 39603 'ee', 39604 'el', 39605 'en', 39606 'eo', 39607 'es', 39608 'et', 39609 'eu', 39610 'fa', 39611 'ff', 39612 'fi', 39613 'fj', 39614 'fo', 39615 'fr', 39616 'fy', 39617 'ga', 39618 'gd', 39619 'gl', 39620 'gn', 39621 'gu', 39622 'gv', 39623 'ha', 39624 'he', 39625 'hi', 39626 'ho', 39627 'hr', 39628 'ht', 39629 'hu', 39630 'hy', 39631 'hz', 39632 'ia', 39633 'id', 39634 'ie', 39635 'ig', 39636 'ii', 39637 'ik', 39638 'io', 39639 'is', 39640 'it', 39641 'iu', 39642 'ja', 39643 'jv', 39644 'ka', 39645 'kg', 39646 'ki', 39647 'kj', 39648 'kk', 39649 'kl', 39650 'km', 39651 'kn', 39652 'ko', 39653 'kr', 39654 'ks', 39655 'ku', 39656 'kv', 39657 'kw', 39658 'ky', 39659 'la', 39660 'lb', 39661 'lg', 39662 'li', 39663 'ln', 39664 'lo', 39665 'lt', 39666 'lu', 39667 'lv', 39668 'mg', 39669 'mh', 39670 'mi', 39671 'mk', 39672 'ml', 39673 'mn', 39674 'mr', 39675 'ms', 39676 'mt', 39677 'my',
39678 'na', 39679 'nb', 39680 'nd', 39681 'ne', 39682 'ng', 39683 'nl', 39684 'nn', 39685 'no', 39686 'nr', 39687 'nv', 39688 'ny', 39689 'oc', 39690 'oj', 39691 'om', 39692 'or', 39693 'os', 39694 'pa', 39695 'pi', 39696 'pl', 39697 'ps', 39698 'pt', 39699 'qu', 39700 'rm', 39701 'rn', 39702 'ro', 39703 'ru', 39704 'rw', 39705 'sa', 39706 'sc', 39707 'sd', 39708 'se', 39709 'sg', 39710 'si', 39711 'sk', 39712 'sl', 39713 'sm', 39714 'sn', 39715 'so', 39716 'sq', 39717 'sr', 39718 'ss', 39719 'st', 39720 'su', 39721 'sv', 39722 'sw', 39723 'ta', 39724 'te', 39725 'tg', 39726 'th', 39727 'ti', 39728 'tk', 39729 'tl', 39730 'tn', 39731 'to', 39732 'tr', 39733 'ts', 39734 'tt', 39735 'tw', 39736 'ty', 39737 'ug', 39738 'uk', 39739 'ur', 39740 'uz', 39741 've', 39742 'vi', 39743 'vo', 39744 'wa', 39745 'wo', 39746 'xh', 39747 'yi', 39748 'yo', 39749 'za', 39750 'zh', 39751 'zu' 39752]); 39753function isISO6391(str) { 39754 (0, _assertString.default)(str); 39755 return isISO6391Set.has(str); 39756} 39757module.exports = exports.default; 39758module.exports.default = exports.default; 39759 39760},{"a302ab81c2caac4d":"fQT2o"}],"55IEy":[function(require,module,exports,__globalThis) { 39761"use strict"; 39762Object.defineProperty(exports, "__esModule", { 39763 value: true 39764}); 39765exports.default = isISO8601; 39766var _assertString = _interopRequireDefault(require("c2dd34a89f8d77d3")); 39767function _interopRequireDefault(e) { 39768 return e && e.__esModule ? e : { 39769 default: e 39770 }; 39771} 39772/* eslint-disable max-len */ // from http://goo.gl/0ejHHW 39773var iso8601 = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T\s]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; 39774// same as above, except with a strict 'T' separator between date and time 39775var iso8601StrictSeparator = /^([\+-]?\d{4}(?!\d{2}\b))((-?)((0[1-9]|1[0-2])(\3([12]\d|0[1-9]|3[01]))?|W([0-4]\d|5[0-3])(-?[1-7])?|(00[1-9]|0[1-9]\d|[12]\d{2}|3([0-5]\d|6[1-6])))([T]((([01]\d|2[0-3])((:?)[0-5]\d)?|24:?00)([\.,]\d+(?!:))?)?(\17[0-5]\d([\.,]\d+)?)?([zZ]|([\+-])([01]\d|2[0-3]):?([0-5]\d)?)?)?)?$/; 39776/* eslint-enable max-len */ var isValidDate = function isValidDate(str) { 39777 // str must have passed the ISO8601 check 39778 // this check is meant to catch invalid dates 39779 // like 2009-02-31 39780 // first check for ordinal dates 39781 var ordinalMatch = str.match(/^(\d{4})-?(\d{3})([ T]{1}\.*|$)/); 39782 if (ordinalMatch) { 39783 var oYear = Number(ordinalMatch[1]); 39784 var oDay = Number(ordinalMatch[2]); 39785 // if is leap year 39786 if (oYear % 4 === 0 && oYear % 100 !== 0 || oYear % 400 === 0) return oDay <= 366; 39787 return oDay <= 365; 39788 } 39789 var match = str.match(/(\d{4})-?(\d{0,2})-?(\d*)/).map(Number); 39790 var year = match[1]; 39791 var month = match[2]; 39792 var day = match[3]; 39793 var monthString = month ? "0".concat(month).slice(-2) : month; 39794 var dayString = day ? "0".concat(day).slice(-2) : day; 39795 // create a date object and compare 39796 var d = new Date("".concat(year, "-").concat(monthString || '01', "-").concat(dayString || '01')); 39797 if (month && day) return d.getUTCFullYear() === year && d.getUTCMonth() + 1 === month && d.getUTCDate() === day; 39798 return true; 39799}; 39800function isISO8601(str) { 39801 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 39802 (0, _assertString.default)(str); 39803 var check = options.strictSeparator ? iso8601StrictSeparator.test(str) : iso8601.test(str); 39804 if (check && options.strict) return isValidDate(str); 39805 return check; 39806} 39807module.exports = exports.default; 39808module.exports.default = exports.default; 39809 39810},{"c2dd34a89f8d77d3":"fQT2o"}],"41ESR":[function(require,module,exports,__globalThis) { 39811"use strict"; 39812Object.defineProperty(exports, "__esModule", { 39813 value: true 39814}); 39815exports.default = isRFC3339; 39816var _assertString = _interopRequireDefault(require("86cfcd153590f9be")); 39817function _interopRequireDefault(e) { 39818 return e && e.__esModule ? e : { 39819 default: e 39820 }; 39821} 39822/* Based on https://tools.ietf.org/html/rfc3339#section-5.6 */ var dateFullYear = /[0-9]{4}/; 39823var dateMonth = /(0[1-9]|1[0-2])/; 39824var dateMDay = /([12]\d|0[1-9]|3[01])/; 39825var timeHour = /([01][0-9]|2[0-3])/; 39826var timeMinute = /[0-5][0-9]/; 39827var timeSecond = /([0-5][0-9]|60)/; 39828var timeSecFrac = /(\.[0-9]+)?/; 39829var timeNumOffset = new RegExp("[-+]".concat(timeHour.source, ":").concat(timeMinute.source)); 39830var timeOffset = new RegExp("([zZ]|".concat(timeNumOffset.source, ")")); 39831var partialTime = new RegExp("".concat(timeHour.source, ":").concat(timeMinute.source, ":").concat(timeSecond.source).concat(timeSecFrac.source)); 39832var fullDate = new RegExp("".concat(dateFullYear.source, "-").concat(dateMonth.source, "-").concat(dateMDay.source)); 39833var fullTime = new RegExp("".concat(partialTime.source).concat(timeOffset.source)); 39834var rfc3339 = new RegExp("^".concat(fullDate.source, "[ tT]").concat(fullTime.source, "$")); 39835function isRFC3339(str) { 39836 (0, _assertString.default)(str); 39837 return rfc3339.test(str); 39838} 39839module.exports = exports.default; 39840module.exports.default = exports.default; 39841 39842},{"86cfcd153590f9be":"fQT2o"}],"cWUoW":[function(require,module,exports,__globalThis) { 39843"use strict"; 39844Object.defineProperty(exports, "__esModule", { 39845 value: true 39846}); 39847exports.ScriptCodes = void 0;
39848exports.default = isISO15924; 39849var _assertString = _interopRequireDefault(require("4f626e18e5c55d5b")); 39850function _interopRequireDefault(e) { 39851 return e && e.__esModule ? e : { 39852 default: e 39853 }; 39854} 39855// from https://www.unicode.org/iso15924/iso15924-codes.html 39856var validISO15924Codes = new Set([ 39857 'Adlm', 39858 'Afak', 39859 'Aghb', 39860 'Ahom', 39861 'Arab', 39862 'Aran', 39863 'Armi', 39864 'Armn', 39865 'Avst', 39866 'Bali', 39867 'Bamu', 39868 'Bass', 39869 'Batk', 39870 'Beng', 39871 'Bhks', 39872 'Blis', 39873 'Bopo', 39874 'Brah', 39875 'Brai', 39876 'Bugi', 39877 'Buhd', 39878 'Cakm', 39879 'Cans', 39880 'Cari', 39881 'Cham', 39882 'Cher', 39883 'Chis', 39884 'Chrs', 39885 'Cirt', 39886 'Copt', 39887 'Cpmn', 39888 'Cprt', 39889 'Cyrl', 39890 'Cyrs', 39891 'Deva', 39892 'Diak', 39893 'Dogr', 39894 'Dsrt', 39895 'Dupl', 39896 'Egyd', 39897 'Egyh', 39898 'Egyp', 39899 'Elba', 39900 'Elym', 39901 'Ethi', 39902 'Gara', 39903 'Geok', 39904 'Geor', 39905 'Glag', 39906 'Gong', 39907 'Gonm', 39908 'Goth', 39909 'Gran', 39910 'Grek', 39911 'Gujr', 39912 'Gukh', 39913 'Guru', 39914 'Hanb', 39915 'Hang', 39916 'Hani', 39917 'Hano', 39918 'Hans', 39919 'Hant', 39920 'Hatr', 39921 'Hebr', 39922 'Hira', 39923 'Hluw', 39924 'Hmng', 39925 'Hmnp', 39926 'Hrkt', 39927 'Hung', 39928 'Inds', 39929 'Ital', 39930 'Jamo', 39931 'Java', 39932 'Jpan', 39933 'Jurc', 39934 'Kali', 39935 'Kana', 39936 'Kawi',
39937 'Khar', 39938 'Khmr', 39939 'Khoj', 39940 'Kitl', 39941 'Kits', 39942 'Knda', 39943 'Kore', 39944 'Kpel', 39945 'Krai', 39946 'Kthi', 39947 'Lana', 39948 'Laoo', 39949 'Latf', 39950 'Latg', 39951 'Latn', 39952 'Leke', 39953 'Lepc', 39954 'Limb', 39955 'Lina', 39956 'Linb', 39957 'Lisu', 39958 'Loma', 39959 'Lyci', 39960 'Lydi', 39961 'Mahj', 39962 'Maka', 39963 'Mand', 39964 'Mani', 39965 'Marc', 39966 'Maya', 39967 'Medf', 39968 'Mend', 39969 'Merc', 39970 'Mero', 39971 'Mlym', 39972 'Modi', 39973 'Mong', 39974 'Moon', 39975 'Mroo', 39976 'Mtei', 39977 'Mult', 39978 'Mymr', 39979 'Nagm', 39980 'Nand', 39981 'Narb', 39982 'Nbat', 39983 'Newa', 39984 'Nkdb', 39985 'Nkgb', 39986 'Nkoo', 39987 'Nshu', 39988 'Ogam', 39989 'Olck', 39990 'Onao', 39991 'Orkh', 39992 'Orya', 39993 'Osge', 39994 'Osma', 39995 'Ougr', 39996 'Palm', 39997 'Pauc', 39998 'Pcun', 39999 'Pelm', 40000 'Perm', 40001 'Phag', 40002 'Phli', 40003 'Phlp', 40004 'Phlv', 40005 'Phnx', 40006 'Plrd', 40007 'Piqd', 40008 'Prti', 40009 'Psin', 40010 'Qaaa', 40011 'Qaab', 40012 'Qaac', 40013 'Qaad', 40014 'Qaae', 40015 'Qaaf', 40016 'Qaag', 40017 'Qaah', 40018 'Qaai', 40019 'Qaaj', 40020 'Qaak', 40021 'Qaal', 40022 'Qaam', 40023 'Qaan', 40024 'Qaao', 40025 'Qaap', 40026 'Qaaq', 40027 'Qaar', 40028 'Qaas', 40029 'Qaat', 40030 'Qaau', 40031 'Qaav', 40032 'Qaaw', 40033 'Qaax', 40034 'Qaay', 40035 'Qaaz', 40036 'Qaba', 40037 'Qabb', 40038 'Qabc', 40039 'Qabd', 40040 'Qabe', 40041 'Qabf', 40042 'Qabg', 40043 'Qabh', 40044 'Qabi', 40045 'Qabj', 40046 'Qabk', 40047 'Qabl', 40048 'Qabm', 40049 'Qabn', 40050 'Qabo', 40051 'Qabp', 40052 'Qabq', 40053 'Qabr', 40054 'Qabs', 40055 'Qabt', 40056 'Qabu', 40057 'Qabv', 40058 'Qabw', 40059 'Qabx', 40060 'Ranj', 40061 'Rjng', 40062 'Rohg', 40063 'Roro', 40064 'Runr', 40065 'Samr', 40066 'Sara', 40067 'Sarb', 40068 'Saur', 40069 'Sgnw', 40070 'Shaw', 40071 'Shrd', 40072 'Shui', 40073 'Sidd', 40074 'Sidt', 40075 'Sind', 40076 'Sinh', 40077 'Sogd', 40078 'Sogo', 40079 'Sora', 40080 'Soyo', 40081 'Sund', 40082 'Sunu', 40083 'Sylo', 40084 'Syrc', 40085 'Syre', 40086 'Syrj', 40087 'Syrn', 40088 'Tagb', 40089 'Takr', 40090 'Tale', 40091 'Talu', 40092 'Taml', 40093 'Tang', 40094 'Tavt', 40095 'Tayo', 40096 'Telu', 40097 'Teng', 40098 'Tfng', 40099 'Tglg', 40100 'Thaa', 40101 'Thai', 40102 'Tibt', 40103 'Tirh', 40104 'Tnsa', 40105 'Todr', 40106 'Tols', 40107 'Toto', 40108 'Tutg', 40109 'Ugar', 40110 'Vaii', 40111 'Visp', 40112 'Vith', 40113 'Wara', 40114 'Wcho', 40115 'Wole', 40116 'Xpeo', 40117 'Xsux', 40118 'Yezi', 40119 'Yiii', 40120 'Zanb', 40121 'Zinh', 40122 'Zmth', 40123 'Zsye', 40124 'Zsym', 40125 'Zxxx', 40126 'Zyyy', 40127 'Zzzz' 40128]); 40129function isISO15924(str) { 40130 (0, _assertString.default)(str); 40131 return validISO15924Codes.has(str); 40132} 40133var ScriptCodes = exports.ScriptCodes = validISO15924Codes; 40134 40135},{"4f626e18e5c55d5b":"fQT2o"}],"e1jat":[function(require,module,exports,__globalThis) { 40136"use strict"; 40137Object.defineProperty(exports, "__esModule", { 40138 value: true 40139}); 40140exports.default = isISO31661Alpha3; 40141var _assertString = _interopRequireDefault(require("b66458f65eaeb7a8")); 40142function _interopRequireDefault(e) { 40143 return e && e.__esModule ? e : { 40144 default: e 40145 }; 40146} 40147// from https://en.wikipedia.org/wiki/ISO_3166-1_alpha-3 40148var validISO31661Alpha3CountriesCodes = new Set([ 40149 'AFG', 40150 'ALA', 40151 'ALB', 40152 'DZA', 40153 'ASM', 40154 'AND', 40155 'AGO', 40156 'AIA', 40157 'ATA', 40158 'ATG', 40159 'ARG', 40160 'ARM', 40161 'ABW', 40162 'AUS', 40163 'AUT', 40164 'AZE', 40165 'BHS', 40166 'BHR', 40167 'BGD', 40168 'BRB', 40169 'BLR', 40170 'BEL', 40171 'BLZ', 40172 'BEN', 40173 'BMU', 40174 'BTN', 40175 'BOL', 40176 'BES', 40177 'BIH', 40178 'BWA', 40179 'BVT', 40180 'BRA', 40181 'IOT', 40182 'BRN', 40183 'BGR', 40184 'BFA', 40185 'BDI', 40186 'KHM', 40187 'CMR', 40188 'CAN', 40189 'CPV', 40190 'CYM', 40191 'CAF', 40192 'TCD', 40193 'CHL', 40194 'CHN', 40195 'CXR', 40196 'CCK', 40197 'COL', 40198 'COM', 40199 'COG', 40200 'COD', 40201 'COK', 40202 'CRI', 40203 'CIV', 40204 'HRV', 40205 'CUB', 40206 'CUW', 40207 'CYP', 40208 'CZE', 40209 'DNK', 40210 'DJI', 40211 'DMA', 40212 'DOM', 40213 'ECU', 40214 'EGY', 40215 'SLV', 40216 'GNQ', 40217 'ERI', 40218 'EST', 40219 'ETH', 40220 'FLK', 40221 'FRO', 40222 'FJI', 40223 'FIN', 40224 'FRA', 40225 'GUF', 40226 'PYF', 40227 'ATF', 40228 'GAB', 40229 'GMB', 40230 'GEO', 40231 'DEU', 40232 'GHA', 40233 'GIB', 40234 'GRC', 40235 'GRL', 40236 'GRD', 40237 'GLP', 40238 'GUM', 40239 'GTM', 40240 'GGY', 40241 'GIN', 40242 'GNB', 40243 'GUY', 40244 'HTI', 40245 'HMD', 40246 'VAT', 40247 'HND', 40248 'HKG', 40249 'HUN', 40250 'ISL', 40251 'IND', 40252 'IDN', 40253 'IRN', 40254 'IRQ', 40255 'IRL', 40256 'IMN', 40257 'ISR', 40258 'ITA', 40259 'JAM', 40260 'JPN', 40261 'JEY', 40262 'JOR',
40263 'KAZ', 40264 'KEN', 40265 'KIR', 40266 'PRK', 40267 'KOR', 40268 'KWT', 40269 'KGZ', 40270 'LAO', 40271 'LVA', 40272 'LBN', 40273 'LSO', 40274 'LBR', 40275 'LBY', 40276 'LIE', 40277 'LTU', 40278 'LUX', 40279 'MAC', 40280 'MKD', 40281 'MDG', 40282 'MWI', 40283 'MYS', 40284 'MDV', 40285 'MLI', 40286 'MLT', 40287 'MHL', 40288 'MTQ', 40289 'MRT', 40290 'MUS', 40291 'MYT', 40292 'MEX', 40293 'FSM', 40294 'MDA', 40295 'MCO', 40296 'MNG', 40297 'MNE', 40298 'MSR', 40299 'MAR', 40300 'MOZ', 40301 'MMR', 40302 'NAM', 40303 'NRU', 40304 'NPL', 40305 'NLD', 40306 'NCL', 40307 'NZL', 40308 'NIC', 40309 'NER', 40310 'NGA', 40311 'NIU', 40312 'NFK', 40313 'MNP', 40314 'NOR', 40315 'OMN', 40316 'PAK', 40317 'PLW', 40318 'PSE', 40319 'PAN', 40320 'PNG', 40321 'PRY', 40322 'PER', 40323 'PHL', 40324 'PCN', 40325 'POL', 40326 'PRT', 40327 'PRI', 40328 'QAT', 40329 'REU', 40330 'ROU', 40331 'RUS', 40332 'RWA', 40333 'BLM', 40334 'SHN', 40335 'KNA', 40336 'LCA', 40337 'MAF', 40338 'SPM', 40339 'VCT', 40340 'WSM', 40341 'SMR', 40342 'STP', 40343 'SAU', 40344 'SEN', 40345 'SRB', 40346 'SYC', 40347 'SLE', 40348 'SGP', 40349 'SXM', 40350 'SVK', 40351 'SVN', 40352 'SLB', 40353 'SOM', 40354 'ZAF', 40355 'SGS', 40356 'SSD', 40357 'ESP', 40358 'LKA', 40359 'SDN', 40360 'SUR', 40361 'SJM', 40362 'SWZ', 40363 'SWE', 40364 'CHE', 40365 'SYR', 40366 'TWN', 40367 'TJK', 40368 'TZA', 40369 'THA', 40370 'TLS', 40371 'TGO', 40372 'TKL', 40373 'TON', 40374 'TTO', 40375 'TUN', 40376 'TUR', 40377 'TKM', 40378 'TCA', 40379 'TUV', 40380 'UGA', 40381 'UKR', 40382 'ARE', 40383 'GBR', 40384 'USA', 40385 'UMI', 40386 'URY', 40387 'UZB', 40388 'VUT', 40389 'VEN', 40390 'VNM', 40391 'VGB', 40392 'VIR', 40393 'WLF', 40394 'ESH', 40395 'YEM', 40396 'ZMB', 40397 'ZWE' 40398]); 40399function isISO31661Alpha3(str) { 40400 (0, _assertString.default)(str); 40401 return validISO31661Alpha3CountriesCodes.has(str.toUpperCase()); 40402} 40403module.exports = exports.default; 40404module.exports.default = exports.default; 40405 40406},{"b66458f65eaeb7a8":"fQT2o"}],"hg2fV":[function(require,module,exports,__globalThis) { 40407"use strict"; 40408Object.defineProperty(exports, "__esModule", { 40409 value: true 40410}); 40411exports.default = isISO31661Numeric; 40412var _assertString = _interopRequireDefault(require("36aab58536f7bd34")); 40413function _interopRequireDefault(e) { 40414 return e && e.__esModule ? e : { 40415 default: e 40416 }; 40417} 40418// from https://en.wikipedia.org/wiki/ISO_3166-1_numeric 40419var validISO31661NumericCountriesCodes = new Set([ 40420 '004', 40421 '008', 40422 '010', 40423 '012', 40424 '016', 40425 '020', 40426 '024', 40427 '028', 40428 '031', 40429 '032', 40430 '036', 40431 '040', 40432 '044', 40433 '048', 40434 '050', 40435 '051', 40436 '052', 40437 '056', 40438 '060', 40439 '064', 40440 '068', 40441 '070', 40442 '072', 40443 '074', 40444 '076', 40445 '084', 40446 '086', 40447 '090', 40448 '092', 40449 '096', 40450 '100', 40451 '104', 40452 '108', 40453 '112', 40454 '116', 40455 '120', 40456 '124', 40457 '132', 40458 '136', 40459 '140', 40460 '144', 40461 '148', 40462 '152', 40463 '156', 40464 '158', 40465 '162', 40466 '166', 40467 '170', 40468 '174', 40469 '175', 40470 '178', 40471 '180', 40472 '184', 40473 '188', 40474 '191', 40475 '192', 40476 '196', 40477 '203', 40478 '204', 40479 '208', 40480 '212', 40481 '214', 40482 '218', 40483 '222', 40484 '226', 40485 '231', 40486 '232', 40487 '233', 40488 '234', 40489 '238', 40490 '239', 40491 '242', 40492 '246', 40493 '248', 40494 '250', 40495 '254', 40496 '258', 40497 '260', 40498 '262', 40499 '266', 40500 '268', 40501 '270', 40502 '275', 40503 '276', 40504 '288', 40505 '292', 40506 '296', 40507 '300', 40508 '304', 40509 '308', 40510 '312', 40511 '316', 40512 '320', 40513 '324', 40514 '328', 40515 '332', 40516 '334', 40517 '336', 40518 '340', 40519 '344', 40520 '348', 40521 '352', 40522 '356', 40523 '360', 40524 '364', 40525 '368', 40526 '372', 40527 '376', 40528 '380', 40529 '384', 40530 '388', 40531 '392', 40532 '398', 40533 '400', 40534 '404', 40535 '408', 40536 '410', 40537 '414', 40538 '417', 40539 '418', 40540 '422', 40541 '426', 40542 '428', 40543 '430', 40544 '434', 40545 '438', 40546 '440', 40547 '442', 40548 '446', 40549 '450', 40550 '454', 40551 '458', 40552 '462', 40553 '466', 40554 '470', 40555 '474', 40556 '478', 40557 '480', 40558 '484', 40559 '492', 40560 '496', 40561 '498', 40562 '499', 40563 '500', 40564 '504', 40565 '508', 40566 '512', 40567 '516', 40568 '520', 40569 '524', 40570 '528', 40571 '531', 40572 '533', 40573 '534', 40574 '535', 40575 '540', 40576 '548', 40577 '554', 40578 '558', 40579 '562', 40580 '566', 40581 '570', 40582 '574', 40583 '578', 40584 '580', 40585 '581', 40586 '583', 40587 '584', 40588 '585', 40589 '586', 40590 '591', 40591 '598', 40592 '600', 40593 '604', 40594 '608', 40595 '612', 40596 '616', 40597 '620', 40598 '624', 40599 '626', 40600 '630', 40601 '634', 40602 '638', 40603 '642', 40604 '643', 40605 '646', 40606 '652', 40607 '654', 40608 '659', 40609 '660', 40610 '662', 40611 '663', 40612 '666', 40613 '670', 40614 '674', 40615 '678', 40616 '682', 40617 '686', 40618 '688', 40619 '690', 40620 '694', 40621 '702', 40622 '703', 40623 '704', 40624 '705', 40625 '706', 40626 '710', 40627 '716', 40628 '724', 40629 '728', 40630 '729', 40631 '732', 40632 '740', 40633 '744', 40634 '748', 40635 '752', 40636 '756', 40637 '760', 40638 '762', 40639 '764', 40640 '768', 40641 '772', 40642 '776', 40643 '780', 40644 '784', 40645 '788', 40646 '792', 40647 '795', 40648 '796', 40649 '798', 40650 '800', 40651 '804', 40652 '807', 40653 '818', 40654 '826', 40655 '831', 40656 '832', 40657 '833', 40658 '834', 40659 '840', 40660 '850', 40661 '854', 40662 '858', 40663 '860', 40664 '862', 40665 '876', 40666 '882', 40667 '887', 40668 '894' 40669]); 40670function isISO31661Numeric(str) { 40671 (0, _assertString.default)(str); 40672 return validISO31661NumericCountriesCodes.has(str); 40673} 40674module.exports = exports.default; 40675module.exports.default = exports.default; 40676 40677},{"36aab58536f7bd34":"fQT2o"}],"cc8c3":[function(require,module,exports,__globalThis) { 40678"use strict"; 40679Object.defineProperty(exports, "__esModule", { 40680 value: true 40681}); 40682exports.CurrencyCodes = void 0; 40683exports.default = isISO4217; 40684var _assertString = _interopRequireDefault(require("d9fda19acb9c39e8")); 40685function _interopRequireDefault(e) {
40686 return e && e.__esModule ? e : { 40687 default: e 40688 }; 40689} 40690// from https://en.wikipedia.org/wiki/ISO_4217 40691var validISO4217CurrencyCodes = new Set([ 40692 'AED', 40693 'AFN', 40694 'ALL', 40695 'AMD', 40696 'ANG', 40697 'AOA', 40698 'ARS', 40699 'AUD', 40700 'AWG', 40701 'AZN', 40702 'BAM', 40703 'BBD', 40704 'BDT', 40705 'BGN', 40706 'BHD', 40707 'BIF', 40708 'BMD', 40709 'BND', 40710 'BOB', 40711 'BOV', 40712 'BRL', 40713 'BSD', 40714 'BTN', 40715 'BWP', 40716 'BYN', 40717 'BZD', 40718 'CAD', 40719 'CDF', 40720 'CHE', 40721 'CHF', 40722 'CHW', 40723 'CLF', 40724 'CLP', 40725 'CNY', 40726 'COP', 40727 'COU', 40728 'CRC', 40729 'CUP', 40730 'CVE', 40731 'CZK', 40732 'DJF', 40733 'DKK', 40734 'DOP', 40735 'DZD', 40736 'EGP', 40737 'ERN', 40738 'ETB', 40739 'EUR', 40740 'FJD', 40741 'FKP', 40742 'GBP', 40743 'GEL', 40744 'GHS', 40745 'GIP', 40746 'GMD', 40747 'GNF', 40748 'GTQ', 40749 'GYD', 40750 'HKD', 40751 'HNL', 40752 'HTG', 40753 'HUF', 40754 'IDR', 40755 'ILS', 40756 'INR', 40757 'IQD', 40758 'IRR', 40759 'ISK', 40760 'JMD', 40761 'JOD', 40762 'JPY', 40763 'KES', 40764 'KGS', 40765 'KHR', 40766 'KMF', 40767 'KPW', 40768 'KRW', 40769 'KWD', 40770 'KYD', 40771 'KZT', 40772 'LAK', 40773 'LBP', 40774 'LKR', 40775 'LRD', 40776 'LSL', 40777 'LYD', 40778 'MAD', 40779 'MDL', 40780 'MGA', 40781 'MKD', 40782 'MMK', 40783 'MNT', 40784 'MOP', 40785 'MRU', 40786 'MUR', 40787 'MVR', 40788 'MWK', 40789 'MXN', 40790 'MXV', 40791 'MYR', 40792 'MZN', 40793 'NAD', 40794 'NGN', 40795 'NIO', 40796 'NOK', 40797 'NPR', 40798 'NZD', 40799 'OMR', 40800 'PAB', 40801 'PEN', 40802 'PGK', 40803 'PHP', 40804 'PKR', 40805 'PLN', 40806 'PYG', 40807 'QAR', 40808 'RON', 40809 'RSD', 40810 'RUB', 40811 'RWF', 40812 'SAR', 40813 'SBD', 40814 'SCR', 40815 'SDG', 40816 'SEK', 40817 'SGD', 40818 'SHP', 40819 'SLE', 40820 'SLL', 40821 'SOS', 40822 'SRD', 40823 'SSP', 40824 'STN', 40825 'SVC', 40826 'SYP', 40827 'SZL', 40828 'THB', 40829 'TJS', 40830 'TMT', 40831 'TND', 40832 'TOP', 40833 'TRY', 40834 'TTD', 40835 'TWD', 40836 'TZS', 40837 'UAH', 40838 'UGX', 40839 'USD', 40840 'USN', 40841 'UYI', 40842 'UYU', 40843 'UYW', 40844 'UZS', 40845 'VED', 40846 'VES', 40847 'VND', 40848 'VUV', 40849 'WST', 40850 'XAF', 40851 'XAG', 40852 'XAU', 40853 'XBA', 40854 'XBB', 40855 'XBC', 40856 'XBD', 40857 'XCD', 40858 'XDR', 40859 'XOF', 40860 'XPD', 40861 'XPF', 40862 'XPT', 40863 'XSU', 40864 'XTS', 40865 'XUA', 40866 'XXX', 40867 'YER', 40868 'ZAR', 40869 'ZMW', 40870 'ZWL' 40871]); 40872function isISO4217(str) { 40873 (0, _assertString.default)(str); 40874 return validISO4217CurrencyCodes.has(str.toUpperCase()); 40875} 40876var CurrencyCodes = exports.CurrencyCodes = validISO4217CurrencyCodes; 40877 40878},{"d9fda19acb9c39e8":"fQT2o"}],"8qsqX":[function(require,module,exports,__globalThis) { 40879"use strict"; 40880Object.defineProperty(exports, "__esModule", { 40881 value: true 40882}); 40883exports.default = isBase32; 40884var _assertString = _interopRequireDefault(require("e04b5f9108e14f5")); 40885var _merge = _interopRequireDefault(require("fb36489dbb8d1a3")); 40886function _interopRequireDefault(e) { 40887 return e && e.__esModule ? e : { 40888 default: e 40889 }; 40890} 40891var base32 = /^[A-Z2-7]+=*$/; 40892var crockfordBase32 = /^[A-HJKMNP-TV-Z0-9]+$/; 40893var defaultBase32Options = { 40894 crockford: false 40895}; 40896function isBase32(str, options) { 40897 (0, _assertString.default)(str); 40898 options = (0, _merge.default)(options, defaultBase32Options); 40899 if (options.crockford) return crockfordBase32.test(str); 40900 var len = str.length; 40901 if (len % 8 === 0 && base32.test(str)) return true; 40902 return false; 40903} 40904module.exports = exports.default; 40905module.exports.default = exports.default; 40906 40907},{"e04b5f9108e14f5":"fQT2o","fb36489dbb8d1a3":"bRDoK"}],"awbN2":[function(require,module,exports,__globalThis) { 40908"use strict"; 40909Object.defineProperty(exports, "__esModule", { 40910 value: true 40911}); 40912exports.default = isBase58; 40913var _assertString = _interopRequireDefault(require("891939a40323820e")); 40914function _interopRequireDefault(e) { 40915 return e && e.__esModule ? e : { 40916 default: e 40917 }; 40918} 40919// Accepted chars - 123456789ABCDEFGH JKLMN PQRSTUVWXYZabcdefghijk mnopqrstuvwxyz 40920var base58Reg = /^[A-HJ-NP-Za-km-z1-9]*$/; 40921function isBase58(str) { 40922 (0, _assertString.default)(str); 40923 if (base58Reg.test(str)) return true; 40924 return false; 40925} 40926module.exports = exports.default; 40927module.exports.default = exports.default; 40928 40929},{"891939a40323820e":"fQT2o"}],"94buX":[function(require,module,exports,__globalThis) { 40930"use strict"; 40931Object.defineProperty(exports, "__esModule", { 40932 value: true 40933}); 40934exports.default = isDataURI; 40935var _assertString = _interopRequireDefault(require("5760d2b424323bd7")); 40936function _interopRequireDefault(e) {
40937 return e && e.__esModule ? e : { 40938 default: e 40939 }; 40940} 40941var validMediaType = /^[a-z]+\/[a-z0-9\-\+\._]+$/i; 40942var validAttribute = /^[a-z\-]+=[a-z0-9\-]+$/i; 40943var validData = /^[a-z0-9!\$&'\(\)\*\+,;=\-\._~:@\/\?%\s]*$/i; 40944function isDataURI(str) { 40945 (0, _assertString.default)(str); 40946 var data = str.split(','); 40947 if (data.length < 2) return false; 40948 var attributes = data.shift().trim().split(';'); 40949 var schemeAndMediaType = attributes.shift(); 40950 if (schemeAndMediaType.slice(0, 5) !== 'data:') return false; 40951 var mediaType = schemeAndMediaType.slice(5); 40952 if (mediaType !== '' && !validMediaType.test(mediaType)) return false; 40953 for(var i = 0; i < attributes.length; i++){ 40954 if (!(i === attributes.length - 1 && attributes[i].toLowerCase() === 'base64') && !validAttribute.test(attributes[i])) return false; 40955 } 40956 for(var _i = 0; _i < data.length; _i++){ 40957 if (!validData.test(data[_i])) return false; 40958 } 40959 return true; 40960} 40961module.exports = exports.default; 40962module.exports.default = exports.default; 40963 40964},{"5760d2b424323bd7":"fQT2o"}],"6mBpE":[function(require,module,exports,__globalThis) { 40965"use strict"; 40966Object.defineProperty(exports, "__esModule", { 40967 value: true 40968}); 40969exports.default = isMagnetURI; 40970var _assertString = _interopRequireDefault(require("cabcc420a1ff2c36")); 40971function _interopRequireDefault(e) { 40972 return e && e.__esModule ? e : { 40973 default: e 40974 }; 40975} 40976var magnetURIComponent = /(?:^magnet:\?|[^?&]&)xt(?:\.1)?=urn:(?:(?:aich|bitprint|btih|ed2k|ed2khash|kzhash|md5|sha1|tree:tiger):[a-z0-9]{32}(?:[a-z0-9]{8})?|btmh:1220[a-z0-9]{64})(?:$|&)/i; 40977function isMagnetURI(url) { 40978 (0, _assertString.default)(url); 40979 if (url.indexOf('magnet:?') !== 0) return false; 40980 return magnetURIComponent.test(url); 40981} 40982module.exports = exports.default; 40983module.exports.default = exports.default; 40984 40985},{"cabcc420a1ff2c36":"fQT2o"}],"k3lqQ":[function(require,module,exports,__globalThis) { 40986"use strict"; 40987Object.defineProperty(exports, "__esModule", { 40988 value: true 40989}); 40990exports.default = isMailtoURI; 40991var _trim = _interopRequireDefault(require("f4809b7c7e1a248c")); 40992var _isEmail = _interopRequireDefault(require("27c073114104de4f")); 40993var _assertString = _interopRequireDefault(require("d850f5a577aacd7b")); 40994function _interopRequireDefault(e) { 40995 return e && e.__esModule ? e : { 40996 default: e 40997 }; 40998} 40999function _slicedToArray(r, e) { 41000 return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); 41001} 41002function _nonIterableRest() { 41003 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 41004} 41005function _iterableToArrayLimit(r, l) { 41006 var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; 41007 if (null != t) { 41008 var e, n, i, u, a = [], f = !0, o = !1; 41009 try { 41010 if (i = (t = t.call(r)).next, 0 === l) { 41011 if (Object(t) !== t) return; 41012 f = !1; 41013 } else for(; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); 41014 } catch (r) { 41015 o = !0, n = r; 41016 } finally{ 41017 try { 41018 if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; 41019 } finally{ 41020 if (o) throw n; 41021 } 41022 } 41023 return a; 41024 } 41025} 41026function _arrayWithHoles(r) { 41027 if (Array.isArray(r)) return r; 41028} 41029function _createForOfIteratorHelper(r, e) { 41030 var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; 41031 if (!t) { 41032 if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { 41033 t && (r = t); 41034 var _n = 0, F = function F() {}; 41035 return { 41036 s: F, 41037 n: function n() { 41038 return _n >= r.length ? { 41039 done: !0 41040 } : { 41041 done: !1, 41042 value: r[_n++] 41043 }; 41044 }, 41045 e: function e(r) { 41046 throw r; 41047 }, 41048 f: F 41049 }; 41050 } 41051 throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 41052 } 41053 var o, a = !0, u = !1; 41054 return { 41055 s: function s() { 41056 t = t.call(r); 41057 }, 41058 n: function n() { 41059 var r = t.next(); 41060 return a = r.done, r; 41061 }, 41062 e: function e(r) { 41063 u = !0, o = r; 41064 }, 41065 f: function f() { 41066 try { 41067 a || null == t.return || t.return(); 41068 } finally{ 41069 if (u) throw o; 41070 } 41071 } 41072 }; 41073} 41074function _unsupportedIterableToArray(r, a) { 41075 if (r) { 41076 if ("string" == typeof r) return _arrayLikeToArray(r, a); 41077 var t = ({}).toString.call(r).slice(8, -1); 41078 return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; 41079 } 41080} 41081function _arrayLikeToArray(r, a) { 41082 (null == a || a > r.length) && (a = r.length); 41083 for(var e = 0, n = Array(a); e < a; e++)n[e] = r[e]; 41084 return n; 41085} 41086function parseMailtoQueryString(queryString) { 41087 var allowedParams = new Set([ 41088 'subject', 41089 'body', 41090 'cc', 41091 'bcc' 41092 ]), query = { 41093 cc: '', 41094 bcc: '' 41095 }; 41096 var isParseFailed = false;
41097 var queryParams = queryString.split('&'); 41098 if (queryParams.length > 4) return false; 41099 var _iterator = _createForOfIteratorHelper(queryParams), _step; 41100 try { 41101 for(_iterator.s(); !(_step = _iterator.n()).done;){ 41102 var q = _step.value; 41103 var _q$split = q.split('='), _q$split2 = _slicedToArray(_q$split, 2), key = _q$split2[0], value = _q$split2[1]; 41104 // checked for invalid and duplicated query params 41105 if (key && !allowedParams.has(key)) { 41106 isParseFailed = true; 41107 break; 41108 } 41109 if (value && (key === 'cc' || key === 'bcc')) query[key] = value; 41110 if (key) allowedParams.delete(key); 41111 } 41112 } catch (err) { 41113 _iterator.e(err); 41114 } finally{ 41115 _iterator.f(); 41116 } 41117 return isParseFailed ? false : query; 41118} 41119function isMailtoURI(url, options) { 41120 (0, _assertString.default)(url); 41121 if (url.indexOf('mailto:') !== 0) return false; 41122 var _url$replace$split = url.replace('mailto:', '').split('?'), _url$replace$split2 = _slicedToArray(_url$replace$split, 2), to = _url$replace$split2[0], _url$replace$split2$ = _url$replace$split2[1], queryString = _url$replace$split2$ === void 0 ? '' : _url$replace$split2$; 41123 if (!to && !queryString) return true; 41124 var query = parseMailtoQueryString(queryString); 41125 if (!query) return false; 41126 return "".concat(to, ",").concat(query.cc, ",").concat(query.bcc).split(',').every(function(email) { 41127 email = (0, _trim.default)(email, ' '); 41128 if (email) return (0, _isEmail.default)(email, options); 41129 return true; 41130 }); 41131} 41132module.exports = exports.default; 41133module.exports.default = exports.default; 41134 41135},{"f4809b7c7e1a248c":"3oaqH","27c073114104de4f":"grSJW","d850f5a577aacd7b":"fQT2o"}],"3oaqH":[function(require,module,exports,__globalThis) { 41136"use strict"; 41137Object.defineProperty(exports, "__esModule", { 41138 value: true 41139}); 41140exports.default = trim; 41141var _rtrim = _interopRequireDefault(require("b763567f82768552")); 41142var _ltrim = _interopRequireDefault(require("f1918674a32c3c86")); 41143function _interopRequireDefault(e) { 41144 return e && e.__esModule ? e : { 41145 default: e 41146 }; 41147} 41148function trim(str, chars) { 41149 return (0, _rtrim.default)((0, _ltrim.default)(str, chars), chars); 41150} 41151module.exports = exports.default; 41152module.exports.default = exports.default; 41153 41154},{"b763567f82768552":"kWGps","f1918674a32c3c86":"5IXxZ"}],"kWGps":[function(require,module,exports,__globalThis) { 41155"use strict"; 41156Object.defineProperty(exports, "__esModule", { 41157 value: true 41158}); 41159exports.default = rtrim; 41160var _assertString = _interopRequireDefault(require("3f937b9787a0d737")); 41161function _interopRequireDefault(e) { 41162 return e && e.__esModule ? e : { 41163 default: e 41164 }; 41165} 41166function rtrim(str, chars) { 41167 (0, _assertString.default)(str); 41168 if (chars) { 41169 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping 41170 var pattern = new RegExp("[".concat(chars.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), "]+$"), 'g'); 41171 return str.replace(pattern, ''); 41172 } 41173 // Use a faster and more safe than regex trim method https://blog.stevenlevithan.com/archives/faster-trim-javascript 41174 var strIndex = str.length - 1; 41175 while(/\s/.test(str.charAt(strIndex)))strIndex -= 1; 41176 return str.slice(0, strIndex + 1); 41177} 41178module.exports = exports.default; 41179module.exports.default = exports.default; 41180 41181},{"3f937b9787a0d737":"fQT2o"}],"5IXxZ":[function(require,module,exports,__globalThis) { 41182"use strict"; 41183Object.defineProperty(exports, "__esModule", { 41184 value: true 41185}); 41186exports.default = ltrim; 41187var _assertString = _interopRequireDefault(require("2f24039d4dd740d3")); 41188function _interopRequireDefault(e) { 41189 return e && e.__esModule ? e : { 41190 default: e 41191 }; 41192} 41193function ltrim(str, chars) { 41194 (0, _assertString.default)(str); 41195 // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions#Escaping 41196 var pattern = chars ? new RegExp("^[".concat(chars.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'), "]+"), 'g') : /^\s+/g; 41197 return str.replace(pattern, ''); 41198} 41199module.exports = exports.default; 41200module.exports.default = exports.default; 41201 41202},{"2f24039d4dd740d3":"fQT2o"}],"kjN2F":[function(require,module,exports,__globalThis) { 41203"use strict"; 41204Object.defineProperty(exports, "__esModule", { 41205 value: true 41206}); 41207exports.default = isMimeType; 41208var _assertString = _interopRequireDefault(require("b1a5323c59cce3b7")); 41209function _interopRequireDefault(e) {
41210 return e && e.__esModule ? e : { 41211 default: e 41212 }; 41213} 41214/* 41215 Checks if the provided string matches to a correct Media type format (MIME type) 41216 41217 This function only checks is the string format follows the 41218 established rules by the according RFC specifications. 41219 This function supports 'charset' in textual media types 41220 (https://tools.ietf.org/html/rfc6657). 41221 41222 This function does not check against all the media types listed 41223 by the IANA (https://www.iana.org/assignments/media-types/media-types.xhtml) 41224 because of lightness purposes : it would require to include 41225 all these MIME types in this library, which would weigh it 41226 significantly. This kind of effort maybe is not worth for the use that 41227 this function has in this entire library. 41228 41229 More information in the RFC specifications : 41230 - https://tools.ietf.org/html/rfc2045 41231 - https://tools.ietf.org/html/rfc2046 41232 - https://tools.ietf.org/html/rfc7231#section-3.1.1.1 41233 - https://tools.ietf.org/html/rfc7231#section-3.1.1.5 41234*/ // Match simple MIME types 41235// NB : 41236// Subtype length must not exceed 100 characters. 41237// This rule does not comply to the RFC specs (what is the max length ?). 41238var mimeTypeSimple = /^(application|audio|font|image|message|model|multipart|text|video)\/[a-zA-Z0-9\.\-\+_]{1,100}$/i; // eslint-disable-line max-len 41239// Handle "charset" in "text/*" 41240var mimeTypeText = /^text\/[a-zA-Z0-9\.\-\+]{1,100};\s?charset=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?$/i; // eslint-disable-line max-len 41241// Handle "boundary" in "multipart/*" 41242var mimeTypeMultipart = /^multipart\/[a-zA-Z0-9\.\-\+]{1,100}(;\s?(boundary|charset)=("[a-zA-Z0-9\.\-\+\s]{0,70}"|[a-zA-Z0-9\.\-\+]{0,70})(\s?\([a-zA-Z0-9\.\-\+\s]{1,20}\))?){0,2}$/i; // eslint-disable-line max-len 41243function isMimeType(str) { 41244 (0, _assertString.default)(str); 41245 return mimeTypeSimple.test(str) || mimeTypeText.test(str) || mimeTypeMultipart.test(str); 41246} 41247module.exports = exports.default; 41248module.exports.default = exports.default; 41249 41250},{"b1a5323c59cce3b7":"fQT2o"}],"4O5Zc":[function(require,module,exports,__globalThis) { 41251"use strict"; 41252Object.defineProperty(exports, "__esModule", { 41253 value: true 41254}); 41255exports.default = isLatLong; 41256var _assertString = _interopRequireDefault(require("42ca4ce670edd2c0")); 41257var _merge = _interopRequireDefault(require("f246bd175997c1b5")); 41258var _includesString = _interopRequireDefault(require("f77d42149400282e")); 41259function _interopRequireDefault(e) { 41260 return e && e.__esModule ? e : { 41261 default: e 41262 }; 41263} 41264var lat = /^\(?[+-]?(90(\.0+)?|[1-8]?\d(\.\d+)?)$/; 41265var long = /^\s?[+-]?(180(\.0+)?|1[0-7]\d(\.\d+)?|\d{1,2}(\.\d+)?)\)?$/; 41266var latDMS = /^(([1-8]?\d)\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|90\D+0\D+0)\D+[NSns]?$/i; 41267var longDMS = /^\s*([1-7]?\d{1,2}\D+([1-5]?\d|60)\D+([1-5]?\d|60)(\.\d+)?|180\D+0\D+0)\D+[EWew]?$/i; 41268var defaultLatLongOptions = { 41269 checkDMS: false 41270}; 41271function isLatLong(str, options) { 41272 (0, _assertString.default)(str); 41273 options = (0, _merge.default)(options, defaultLatLongOptions); 41274 if (!(0, _includesString.default)(str, ',')) return false; 41275 var pair = str.split(','); 41276 if (pair[0].startsWith('(') && !pair[1].endsWith(')') || pair[1].endsWith(')') && !pair[0].startsWith('(')) return false; 41277 if (options.checkDMS) return latDMS.test(pair[0]) && longDMS.test(pair[1]); 41278 return lat.test(pair[0]) && long.test(pair[1]); 41279} 41280module.exports = exports.default; 41281module.exports.default = exports.default; 41282 41283},{"42ca4ce670edd2c0":"fQT2o","f246bd175997c1b5":"bRDoK","f77d42149400282e":"3FdGd"}],"dZL6c":[function(require,module,exports,__globalThis) { 41284"use strict"; 41285Object.defineProperty(exports, "__esModule", { 41286 value: true 41287}); 41288exports.default = isPostalCode; 41289exports.locales = void 0; 41290var _assertString = _interopRequireDefault(require("af33e209d16f8276")); 41291function _interopRequireDefault(e) { 41292 return e && e.__esModule ? e : { 41293 default: e 41294 }; 41295} 41296// common patterns 41297var threeDigit = /^\d{3}$/; 41298var fourDigit = /^\d{4}$/; 41299var fiveDigit = /^\d{5}$/; 41300var sixDigit = /^\d{6}$/; 41301var patterns = { 41302 AD: /^AD\d{3}$/, 41303 AT: fourDigit, 41304 AU: fourDigit, 41305 AZ: /^AZ\d{4}$/, 41306 BA: /^([7-8]\d{4}$)/, 41307 BD: /^([1-8][0-9]{3}|9[0-4][0-9]{2})$/, 41308 BE: fourDigit, 41309 BG: fourDigit, 41310 BR: /^\d{5}-?\d{3}$/, 41311 BY: /^2[1-4]\d{4}$/, 41312 CA: /^[ABCEGHJKLMNPRSTVXY]\d[ABCEGHJ-NPRSTV-Z][\s\-]?\d[ABCEGHJ-NPRSTV-Z]\d$/i, 41313 CH: fourDigit, 41314 CN: /^(0[1-7]|1[012356]|2[0-7]|3[0-6]|4[0-7]|5[1-7]|6[1-7]|7[1-5]|8[1345]|9[09])\d{4}$/, 41315 CO: /^(05|08|11|13|15|17|18|19|20|23|25|27|41|44|47|50|52|54|63|66|68|70|73|76|81|85|86|88|91|94|95|97|99)(\d{4})$/, 41316 CZ: /^\d{3}\s?\d{2}$/, 41317 DE: fiveDigit, 41318 DK: fourDigit, 41319 DO: fiveDigit, 41320 DZ: fiveDigit, 41321 EE: fiveDigit, 41322 ES: /^(5[0-2]{1}|[0-4]{1}\d{1})\d{3}$/, 41323 FI: fiveDigit, 41324 FR: /^(?:(?:0[1-9]|[1-8]\d|9[0-5])\d{3}|97[1-46]\d{2})$/, 41325 GB: /^(gir\s?0aa|[a-z]{1,2}\d[\da-z]?\s?(\d[a-z]{2})?)$/i, 41326 GR: /^\d{3}\s?\d{2}$/, 41327 HR: /^([1-5]\d{4}$)/, 41328 HT: /^HT\d{4}$/, 41329 HU: fourDigit, 41330 ID: fiveDigit, 41331 IE: /^(?!.*(?:o))[A-Za-z]\d[\dw]\s\w{4}$/i, 41332 IL: /^(\d{5}|\d{7})$/, 41333 IN: /^((?!10|29|35|54|55|65|66|86|87|88|89)[1-9][0-9]{5})$/, 41334 IR: /^(?!(\d)\1{3})[13-9]{4}[1346-9][013-9]{5}$/, 41335 IS: threeDigit, 41336 IT: fiveDigit, 41337 JP: /^\d{3}\-\d{4}$/, 41338 KE: fiveDigit, 41339 KR: /^(\d{5}|\d{6})$/, 41340 LI: /^(948[5-9]|949[0-7])$/, 41341 LT: /^LT\-\d{5}$/, 41342 LU: fourDigit, 41343 LV: /^LV\-\d{4}$/, 41344 LK: fiveDigit, 41345 MG: threeDigit, 41346 MX: fiveDigit, 41347 MT: /^[A-Za-z]{3}\s{0,1}\d{4}$/, 41348 MY: fiveDigit, 41349 NL: /^[1-9]\d{3}\s?(?!sa|sd|ss)[a-z]{2}$/i, 41350 NO: fourDigit, 41351 NP: /^(10|21|22|32|33|34|44|45|56|57)\d{3}$|^(977)$/i, 41352 NZ: fourDigit,
41353 // https://www.pakpost.gov.pk/postcodes.php 41354 PK: fiveDigit, 41355 PL: /^\d{2}\-\d{3}$/, 41356 PR: /^00[679]\d{2}([ -]\d{4})?$/, 41357 PT: /^\d{4}\-\d{3}?$/, 41358 RO: sixDigit, 41359 RU: sixDigit, 41360 SA: fiveDigit, 41361 SE: /^[1-9]\d{2}\s?\d{2}$/, 41362 SG: sixDigit, 41363 SI: fourDigit, 41364 SK: /^\d{3}\s?\d{2}$/, 41365 TH: fiveDigit, 41366 TN: fourDigit, 41367 TW: /^\d{3}(\d{2,3})?$/, 41368 UA: fiveDigit, 41369 US: /^\d{5}(-\d{4})?$/, 41370 ZA: fourDigit, 41371 ZM: fiveDigit 41372}; 41373var locales = exports.locales = Object.keys(patterns); 41374function isPostalCode(str, locale) { 41375 (0, _assertString.default)(str); 41376 if (locale in patterns) return patterns[locale].test(str); 41377 else if (locale === 'any') { 41378 for(var key in patterns)// https://github.com/gotwarlost/istanbul/blob/master/ignoring-code-for-coverage.md#ignoring-code-for-coverage-purposes 41379 // istanbul ignore else 41380 if (patterns.hasOwnProperty(key)) { 41381 var pattern = patterns[key]; 41382 if (pattern.test(str)) return true; 41383 } 41384 return false; 41385 } 41386 throw new Error("Invalid locale '".concat(locale, "'")); 41387} 41388 41389},{"af33e209d16f8276":"fQT2o"}],"jDxC2":[function(require,module,exports,__globalThis) { 41390"use strict"; 41391Object.defineProperty(exports, "__esModule", { 41392 value: true 41393}); 41394exports.default = escape; 41395var _assertString = _interopRequireDefault(require("4f2ad27482ad15a0")); 41396function _interopRequireDefault(e) { 41397 return e && e.__esModule ? e : { 41398 default: e 41399 }; 41400} 41401function escape(str) { 41402 (0, _assertString.default)(str); 41403 return str.replace(/&/g, '&').replace(/"/g, '"').replace(/'/g, ''').replace(/</g, '<').replace(/>/g, '>').replace(/\//g, '/').replace(/\\/g, '\').replace(/`/g, '`'); 41404} 41405module.exports = exports.default; 41406module.exports.default = exports.default; 41407 41408},{"4f2ad27482ad15a0":"fQT2o"}],"dNLK0":[function(require,module,exports,__globalThis) { 41409"use strict"; 41410Object.defineProperty(exports, "__esModule", { 41411 value: true 41412}); 41413exports.default = unescape; 41414var _assertString = _interopRequireDefault(require("9bb1978633a49334")); 41415function _interopRequireDefault(e) { 41416 return e && e.__esModule ? e : { 41417 default: e 41418 }; 41419} 41420function unescape(str) { 41421 (0, _assertString.default)(str); 41422 return str.replace(/"/g, '"').replace(/'/g, "'").replace(/</g, '<').replace(/>/g, '>').replace(///g, '/').replace(/\/g, '\\').replace(/`/g, '`').replace(/&/g, '&'); 41423// & replacement has to be the last one to prevent 41424// bugs with intermediate strings containing escape sequences 41425// See: https://github.com/validatorjs/validator.js/issues/1827 41426} 41427module.exports = exports.default; 41428module.exports.default = exports.default; 41429 41430},{"9bb1978633a49334":"fQT2o"}],"6PwsC":[function(require,module,exports,__globalThis) { 41431"use strict"; 41432Object.defineProperty(exports, "__esModule", { 41433 value: true 41434}); 41435exports.default = stripLow; 41436var _assertString = _interopRequireDefault(require("e657450d3bf6e2e5")); 41437var _blacklist = _interopRequireDefault(require("adf963296d8f7393")); 41438function _interopRequireDefault(e) { 41439 return e && e.__esModule ? e : { 41440 default: e 41441 }; 41442} 41443function stripLow(str, keep_new_lines) { 41444 (0, _assertString.default)(str); 41445 var chars = keep_new_lines ? '\\x00-\\x09\\x0B\\x0C\\x0E-\\x1F\\x7F' : '\\x00-\\x1F\\x7F'; 41446 return (0, _blacklist.default)(str, chars); 41447} 41448module.exports = exports.default; 41449module.exports.default = exports.default; 41450 41451},{"e657450d3bf6e2e5":"fQT2o","adf963296d8f7393":"behwk"}],"behwk":[function(require,module,exports,__globalThis) { 41452"use strict"; 41453Object.defineProperty(exports, "__esModule", { 41454 value: true 41455}); 41456exports.default = blacklist; 41457var _assertString = _interopRequireDefault(require("da17f86bfd8f9f06")); 41458function _interopRequireDefault(e) { 41459 return e && e.__esModule ? e : { 41460 default: e 41461 }; 41462} 41463function blacklist(str, chars) { 41464 (0, _assertString.default)(str); 41465 return str.replace(new RegExp("[".concat(chars, "]+"), 'g'), ''); 41466} 41467module.exports = exports.default; 41468module.exports.default = exports.default; 41469 41470},{"da17f86bfd8f9f06":"fQT2o"}],"4sUBe":[function(require,module,exports,__globalThis) { 41471"use strict"; 41472Object.defineProperty(exports, "__esModule", { 41473 value: true 41474}); 41475exports.default = whitelist; 41476var _assertString = _interopRequireDefault(require("fd66d8d8bf0ad43")); 41477function _interopRequireDefault(e) {
41478 return e && e.__esModule ? e : { 41479 default: e 41480 }; 41481} 41482function whitelist(str, chars) { 41483 (0, _assertString.default)(str); 41484 return str.replace(new RegExp("[^".concat(chars, "]+"), 'g'), ''); 41485} 41486module.exports = exports.default; 41487module.exports.default = exports.default; 41488 41489},{"fd66d8d8bf0ad43":"fQT2o"}],"8688D":[function(require,module,exports,__globalThis) { 41490"use strict"; 41491Object.defineProperty(exports, "__esModule", { 41492 value: true 41493}); 41494exports.default = isWhitelisted; 41495var _assertString = _interopRequireDefault(require("5e47d1f865a8d574")); 41496function _interopRequireDefault(e) { 41497 return e && e.__esModule ? e : { 41498 default: e 41499 }; 41500} 41501function isWhitelisted(str, chars) { 41502 (0, _assertString.default)(str); 41503 for(var i = str.length - 1; i >= 0; i--){ 41504 if (chars.indexOf(str[i]) === -1) return false; 41505 } 41506 return true; 41507} 41508module.exports = exports.default; 41509module.exports.default = exports.default; 41510 41511},{"5e47d1f865a8d574":"fQT2o"}],"1WHxZ":[function(require,module,exports,__globalThis) { 41512"use strict"; 41513Object.defineProperty(exports, "__esModule", { 41514 value: true 41515}); 41516exports.default = normalizeEmail; 41517var _merge = _interopRequireDefault(require("3d767513579b6391")); 41518function _interopRequireDefault(e) { 41519 return e && e.__esModule ? e : { 41520 default: e 41521 }; 41522} 41523var default_normalize_email_options = { 41524 // The following options apply to all email addresses 41525 // Lowercases the local part of the email address. 41526 // Please note this may violate RFC 5321 as per http://stackoverflow.com/a/9808332/192024). 41527 // The domain is always lowercased, as per RFC 1035 41528 all_lowercase: true, 41529 // The following conversions are specific to GMail 41530 // Lowercases the local part of the GMail address (known to be case-insensitive) 41531 gmail_lowercase: true, 41532 // Removes dots from the local part of the email address, as that's ignored by GMail 41533 gmail_remove_dots: true, 41534 // Removes the subaddress (e.g. "+foo") from the email address 41535 gmail_remove_subaddress: true, 41536 // Conversts the googlemail.com domain to gmail.com 41537 gmail_convert_googlemaildotcom: true, 41538 // The following conversions are specific to Outlook.com / Windows Live / Hotmail 41539 // Lowercases the local part of the Outlook.com address (known to be case-insensitive) 41540 outlookdotcom_lowercase: true, 41541 // Removes the subaddress (e.g. "+foo") from the email address 41542 outlookdotcom_remove_subaddress: true, 41543 // The following conversions are specific to Yahoo 41544 // Lowercases the local part of the Yahoo address (known to be case-insensitive) 41545 yahoo_lowercase: true, 41546 // Removes the subaddress (e.g. "-foo") from the email address 41547 yahoo_remove_subaddress: true, 41548 // The following conversions are specific to Yandex 41549 // Lowercases the local part of the Yandex address (known to be case-insensitive) 41550 yandex_lowercase: true, 41551 // all yandex domains are equal, this explicitly sets the domain to 'yandex.ru' 41552 yandex_convert_yandexru: true, 41553 // The following conversions are specific to iCloud 41554 // Lowercases the local part of the iCloud address (known to be case-insensitive) 41555 icloud_lowercase: true, 41556 // Removes the subaddress (e.g. "+foo") from the email address 41557 icloud_remove_subaddress: true 41558}; 41559// List of domains used by iCloud 41560var icloud_domains = [ 41561 'icloud.com', 41562 'me.com' 41563]; 41564// List of domains used by Outlook.com and its predecessors 41565// This list is likely incomplete. 41566// Partial reference: 41567// https://blogs.office.com/2013/04/17/outlook-com-gets-two-step-verification-sign-in-by-alias-and-new-international-domains/ 41568var outlookdotcom_domains = [ 41569 'hotmail.at', 41570 'hotmail.be', 41571 'hotmail.ca', 41572 'hotmail.cl', 41573 'hotmail.co.il', 41574 'hotmail.co.nz', 41575 'hotmail.co.th', 41576 'hotmail.co.uk', 41577 'hotmail.com', 41578 'hotmail.com.ar', 41579 'hotmail.com.au', 41580 'hotmail.com.br', 41581 'hotmail.com.gr', 41582 'hotmail.com.mx', 41583 'hotmail.com.pe', 41584 'hotmail.com.tr', 41585 'hotmail.com.vn', 41586 'hotmail.cz', 41587 'hotmail.de', 41588 'hotmail.dk', 41589 'hotmail.es', 41590 'hotmail.fr', 41591 'hotmail.hu', 41592 'hotmail.id', 41593 'hotmail.ie', 41594 'hotmail.in', 41595 'hotmail.it', 41596 'hotmail.jp', 41597 'hotmail.kr', 41598 'hotmail.lv', 41599 'hotmail.my', 41600 'hotmail.ph', 41601 'hotmail.pt', 41602 'hotmail.sa', 41603 'hotmail.sg', 41604 'hotmail.sk', 41605 'live.be', 41606 'live.co.uk', 41607 'live.com', 41608 'live.com.ar', 41609 'live.com.mx', 41610 'live.de', 41611 'live.es', 41612 'live.eu', 41613 'live.fr', 41614 'live.it', 41615 'live.nl', 41616 'msn.com', 41617 'outlook.at', 41618 'outlook.be', 41619 'outlook.cl', 41620 'outlook.co.il', 41621 'outlook.co.nz', 41622 'outlook.co.th', 41623 'outlook.com', 41624 'outlook.com.ar', 41625 'outlook.com.au', 41626 'outlook.com.br', 41627 'outlook.com.gr', 41628 'outlook.com.pe', 41629 'outlook.com.tr', 41630 'outlook.com.vn', 41631 'outlook.cz', 41632 'outlook.de', 41633 'outlook.dk', 41634 'outlook.es', 41635 'outlook.fr', 41636 'outlook.hu', 41637 'outlook.id', 41638 'outlook.ie', 41639 'outlook.in', 41640 'outlook.it', 41641 'outlook.jp', 41642 'outlook.kr', 41643 'outlook.lv', 41644 'outlook.my', 41645 'outlook.ph', 41646 'outlook.pt', 41647 'outlook.sa', 41648 'outlook.sg', 41649 'outlook.sk', 41650 'passport.com' 41651]; 41652// List of domains used by Yahoo Mail 41653// This list is likely incomplete 41654var yahoo_domains = [ 41655 'rocketmail.com', 41656 'yahoo.ca', 41657 'yahoo.co.uk', 41658 'yahoo.com', 41659 'yahoo.de', 41660 'yahoo.fr', 41661 'yahoo.in', 41662 'yahoo.it', 41663 'ymail.com' 41664]; 41665// List of domains used by yandex.ru 41666var yandex_domains = [ 41667 'yandex.ru', 41668 'yandex.ua', 41669 'yandex.kz', 41670 'yandex.com', 41671 'yandex.by', 41672 'ya.ru' 41673]; 41674// replace single dots, but not multiple consecutive dots 41675function dotsReplacer(match) { 41676 if (match.length > 1) return match; 41677 return ''; 41678} 41679function normalizeEmail(email, options) { 41680 options = (0, _merge.default)(options, default_normalize_email_options); 41681 var raw_parts = email.split('@'); 41682 var domain = raw_parts.pop(); 41683 var user = raw_parts.join('@'); 41684 var parts = [ 41685 user, 41686 domain 41687 ]; 41688 // The domain is always lowercased, as it's case-insensitive per RFC 1035 41689 parts[1] = parts[1].toLowerCase(); 41690 if (parts[1] === 'gmail.com' || parts[1] === 'googlemail.com') { 41691 // Address is GMail 41692 if (options.gmail_remove_subaddress) parts[0] = parts[0].split('+')[0]; 41693 if (options.gmail_remove_dots) // this does not replace consecutive dots like [email protected] 41694 parts[0] = parts[0].replace(/\.+/g, dotsReplacer); 41695 if (!parts[0].length) return false;
41696 if (options.all_lowercase || options.gmail_lowercase) parts[0] = parts[0].toLowerCase(); 41697 parts[1] = options.gmail_convert_googlemaildotcom ? 'gmail.com' : parts[1]; 41698 } else if (icloud_domains.indexOf(parts[1]) >= 0) { 41699 // Address is iCloud 41700 if (options.icloud_remove_subaddress) parts[0] = parts[0].split('+')[0]; 41701 if (!parts[0].length) return false; 41702 if (options.all_lowercase || options.icloud_lowercase) parts[0] = parts[0].toLowerCase(); 41703 } else if (outlookdotcom_domains.indexOf(parts[1]) >= 0) { 41704 // Address is Outlook.com 41705 if (options.outlookdotcom_remove_subaddress) parts[0] = parts[0].split('+')[0]; 41706 if (!parts[0].length) return false; 41707 if (options.all_lowercase || options.outlookdotcom_lowercase) parts[0] = parts[0].toLowerCase(); 41708 } else if (yahoo_domains.indexOf(parts[1]) >= 0) { 41709 // Address is Yahoo 41710 if (options.yahoo_remove_subaddress) { 41711 var components = parts[0].split('-'); 41712 parts[0] = components.length > 1 ? components.slice(0, -1).join('-') : components[0]; 41713 } 41714 if (!parts[0].length) return false; 41715 if (options.all_lowercase || options.yahoo_lowercase) parts[0] = parts[0].toLowerCase(); 41716 } else if (yandex_domains.indexOf(parts[1]) >= 0) { 41717 if (options.all_lowercase || options.yandex_lowercase) parts[0] = parts[0].toLowerCase(); 41718 parts[1] = options.yandex_convert_yandexru ? 'yandex.ru' : parts[1]; 41719 } else if (options.all_lowercase) // Any other address 41720 parts[0] = parts[0].toLowerCase(); 41721 return parts.join('@'); 41722} 41723module.exports = exports.default; 41724module.exports.default = exports.default; 41725 41726},{"3d767513579b6391":"bRDoK"}],"fKO3v":[function(require,module,exports,__globalThis) { 41727"use strict"; 41728Object.defineProperty(exports, "__esModule", { 41729 value: true 41730}); 41731exports.default = isSlug; 41732var _assertString = _interopRequireDefault(require("ab92b84ab8fd18a8")); 41733function _interopRequireDefault(e) { 41734 return e && e.__esModule ? e : { 41735 default: e 41736 }; 41737} 41738var charsetRegex = /^[^\s-_](?!.*?[-_]{2,})[a-z0-9-\\][^\s]*[^-_\s]$/; 41739function isSlug(str) { 41740 (0, _assertString.default)(str); 41741 return charsetRegex.test(str); 41742} 41743module.exports = exports.default; 41744module.exports.default = exports.default; 41745 41746},{"ab92b84ab8fd18a8":"fQT2o"}],"9FuN1":[function(require,module,exports,__globalThis) { 41747"use strict"; 41748Object.defineProperty(exports, "__esModule", { 41749 value: true 41750}); 41751exports.default = isLicensePlate; 41752var _assertString = _interopRequireDefault(require("b2df968a48112117")); 41753function _interopRequireDefault(e) { 41754 return e && e.__esModule ? e : { 41755 default: e 41756 }; 41757} 41758var validators = { 41759 'cs-CZ': function csCZ(str) { 41760 return /^(([ABCDEFHIJKLMNPRSTUVXYZ]|[0-9])-?){5,8}$/.test(str); 41761 }, 41762 'de-DE': function deDE(str) { 41763 return /^((A|AA|AB|AC|AE|AH|AK|AM|AN|AÃ|AP|AS|AT|AU|AW|AZ|B|BA|BB|BC|BE|BF|BH|BI|BK|BL|BM|BN|BO|BÃ|BS|BT|BZ|C|CA|CB|CE|CO|CR|CW|D|DA|DD|DE|DH|DI|DL|DM|DN|DO|DU|DW|DZ|E|EA|EB|ED|EE|EF|EG|EH|EI|EL|EM|EN|ER|ES|EU|EW|F|FB|FD|FF|FG|FI|FL|FN|FO|FR|FS|FT|FÃ|FW|FZ|G|GA|GC|GD|GE|GF|GG|GI|GK|GL|GM|GN|GÃ|GP|GR|GS|GT|GÃ|GV|GW|GZ|H|HA|HB|HC|HD|HE|HF|HG|HH|HI|HK|HL|HM|HN|HO|HP|HR|HS|HU|HV|HX|HY|HZ|IK|IL|IN|IZ|J|JE|JL|K|KA|KB|KC|KE|KF|KG|KH|KI|KK|KL|KM|KN|KO|KR|KS|KT|KU|KW|KY|L|LA|LB|LC|LD|LF|LG|LH|LI|LL|LM|LN|LÃ|LP|LR|LU|M|MA|MB|MC|MD|ME|MG|MH|MI|MK|ML|MM|MN|MO|MQ|MR|MS|MÃ|MW|MY|MZ|N|NB|ND|NE|NF|NH|NI|NK|NM|NÃ|NP|NR|NT|NU|NW|NY|NZ|OA|OB|OC|OD|OE|OF|OG|OH|OK|OL|OP|OS|OZ|P|PA|PB|PE|PF|PI|PL|PM|PN|PR|PS|PW|PZ|R|RA|RC|RD|RE|RG|RH|RI|RL|RM|RN|RO|RP|RS|RT|RU|RV|RW|RZ|S|SB|SC|SE|SG|SI|SK|SL|SM|SN|SO|SP|SR|ST|SU|SW|SY|SZ|TE|TF|TG|TO|TP|TR|TS|TT|TÃ|ÃB|UE|UH|UL|UM|UN|V|VB|VG|VK|VR|VS|W|WA|WB|WE|WF|WI|WK|WL|WM|WN|WO|WR|WS|WT|WÃ|WW|WZ|Z|ZE|ZI|ZP|ZR|ZW|ZZ)[- ]?[A-Z]{1,2}[- ]?\d{1,4}|(ABG|ABI|AIB|AIC|ALF|ALZ|ANA|ANG|ANK|APD|ARN|ART|ASL|ASZ|AUR|AZE|BAD|BAR|BBG|BCH|BED|BER|BGD|BGL|BID|BIN|BIR|BIT|BIW|BKS|BLB|BLK|BNA|BOG|BOH|BOR|BOT|BRA|BRB|BRG|BRK|BRL|BRV|BSB|BSK|BTF|BÃD|BUL|BÃR|BÃS|BÃZ|CAS|CHA|CLP|CLZ|COC|COE|CUX|DAH|DAN|DAU|DBR|DEG|DEL|DGF|DIL|DIN|DIZ|DKB|DLG|DON|DUD|DÃW|EBE|EBN|EBS|ECK|EIC|EIL|EIN|EIS|EMD|EMS|ERB|ERH|ERK|ERZ|ESB|ESW|FDB|FDS|FEU|FFB|FKB|FLÃ|FOR|FRG|FRI|FRW|FTL|FÃS|GAN|GAP|GDB|GEL|GEO|GER|GHA|GHC|GLA|GMN|GNT|GOA|GOH|GRA|GRH|GRI|GRM|GRZ|GTH|GUB|GUN|GV
41763M|HAB|HAL|HAM|HAS|HBN|HBS|HCH|HDH|HDL|HEB|HEF|HEI|HER|HET|HGN|HGW|HHM|HIG|HIP|HMÃ|HOG|HOH|HOL|HOM|HOR|HÃS|HOT|HRO|HSK|HST|HVL|HWI|IGB|ILL|JÃL|KEH|KEL|KEM|KIB|KLE|KLZ|KÃN|KÃT|KÃZ|KRU|KÃN|KUS|KYF|LAN|LAU|LBS|LBZ|LDK|LDS|LEO|LER|LEV|LIB|LIF|LIP|LÃB|LOS|LRO|LSZ|LÃN|LUP|LWL|MAB|MAI|MAK|MAL|MED|MEG|MEI|MEK|MEL|MER|MET|MGH|MGN|MHL|MIL|MKK|MOD|MOL|MON|MOS|MSE|MSH|MSP|MST|MTK|MTL|MÃB|MÃR|MYK|MZG|NAB|NAI|NAU|NDH|NEA|NEB|NEC|NEN|NES|NEW|NMB|NMS|NOH|NOL|NOM|NOR|NVP|NWM|OAL|OBB|OBG|OCH|OHA|ÃHR|OHV|OHZ|OPR|OSL|OVI|OVL|OVP|PAF|PAN|PAR|PCH|PEG|PIR|PLÃ|PRÃ|QFT|QLB|RDG|REG|REH|REI|RID|RIE|ROD|ROF|ROK|ROL|ROS|ROT|ROW|RSL|RÃD|RÃG|SAB|SAD|SAN|SAW|SBG|SBK|SCZ|SDH|SDL|SDT|SEB|SEE|SEF|SEL|SFB|SFT|SGH|SHA|SHG|SHK|SHL|SIG|SIM|SLE|SLF|SLK|SLN|SLS|SLÃ|SLZ|SMÃ|SOB|SOG|SOK|SÃM|SON|SPB|SPN|SRB|SRO|STA|STB|STD|STE|STL|SUL|SÃW|SWA|SZB|TBB|TDO|TET|TIR|TÃL|TUT|UEM|UER|UFF|USI|VAI|VEC|VER|VIB|VIE|VIT|VOH|WAF|WAK|WAN|WAR|WAT|WBS|WDA|WEL|WEN|WER|WES|WHV|WIL|WIS|WIT|WIZ|WLG|WMS|WND|WOB|WOH|WOL|WOR|WOS|WRN|WSF|WST|WSW|WTL|WTM|WUG|WÃM|WUN|WUR|WZL|ZEL|ZIG)[- ]?(([A-Z][- ]?\d{1,4})|([A-Z]{2}[- ]?\d{1,3})))[- ]?(E|H)?$/.test(str); 41764 }, 41765 'de-LI': function deLI(str) { 41766 return /^FL[- ]?\d{1,5}[UZ]?$/.test(str); 41767 }, 41768 'en-IN': function enIN(str) { 41769 return /^[A-Z]{2}[ -]?[0-9]{1,2}(?:[ -]?[A-Z])(?:[ -]?[A-Z]*)?[ -]?[0-9]{4}$/.test(str); 41770 }, 41771 'en-SG': function enSG(str) { 41772 return /^[A-Z]{3}[ -]?[\d]{4}[ -]?[A-Z]{1}$/.test(str); 41773 }, 41774 'es-AR': function esAR(str) { 41775 return /^(([A-Z]{2} ?[0-9]{3} ?[A-Z]{2})|([A-Z]{3} ?[0-9]{3}))$/.test(str); 41776 }, 41777 'fi-FI': function fiFI(str) { 41778 return /^(?=.{4,7})(([A-Z]{1,3}|[0-9]{1,3})[\s-]?([A-Z]{1,3}|[0-9]{1,5}))$/.test(str); 41779 }, 41780 'hu-HU': function huHU(str) { 41781 return /^((((?!AAA)(([A-NPRSTVZWXY]{1})([A-PR-Z]{1})([A-HJ-NPR-Z]))|(A[ABC]I)|A[ABC]O|A[A-W]Q|BPI|BPO|UCO|UDO|XAO)-(?!000)\d{3})|(M\d{6})|((CK|DT|CD|HC|H[ABEFIKLMNPRSTVX]|MA|OT|R[A-Z]) \d{2}-\d{2})|(CD \d{3}-\d{3})|(C-(C|X) \d{4})|(X-(A|B|C) \d{4})|(([EPVZ]-\d{5}))|(S A[A-Z]{2} \d{2})|(SP \d{2}-\d{2}))$/.test(str); 41782 }, 41783 'pt-BR': function ptBR(str) { 41784 return /^[A-Z]{3}[ -]?[0-9][A-Z][0-9]{2}|[A-Z]{3}[ -]?[0-9]{4}$/.test(str); 41785 }, 41786 'pt-PT': function ptPT(str) { 41787 return /^(([A-Z]{2}[ -·]?[0-9]{2}[ -·]?[0-9]{2})|([0-9]{2}[ -·]?[A-Z]{2}[ -·]?[0-9]{2})|([0-9]{2}[ -·]?[0-9]{2}[ -·]?[A-Z]{2})|([A-Z]{2}[ -·]?[0-9]{2}[ -·]?[A-Z]{2}))$/.test(str); 41788 }, 41789 'sq-AL': function sqAL(str) { 41790 return /^[A-Z]{2}[- ]?((\d{3}[- ]?(([A-Z]{2})|T))|(R[- ]?\d{3}))$/.test(str); 41791 }, 41792 'sv-SE': function svSE(str) { 41793 return /^[A-HJ-PR-UW-Z]{3} ?[\d]{2}[A-HJ-PR-UW-Z1-9]$|(^[A-Zà Ãà ]{2,7}$)/.test(str.trim()); 41794 }, 41795 'en-PK': function enPK(str) { 41796 return /(^[A-Z]{2}((\s|-){0,1})[0-9]{3,4}((\s|-)[0-9]{2}){0,1}$)|(^[A-Z]{3}((\s|-){0,1})[0-9]{3,4}((\s|-)[0-9]{2}){0,1}$)|(^[A-Z]{4}((\s|-){0,1})[0-9]{3,4}((\s|-)[0-9]{2}){0,1}$)|(^[A-Z]((\s|-){0,1})[0-9]{4}((\s|-)[0-9]{2}){0,1}$)/.test(str.trim()); 41797 } 41798}; 41799function isLicensePlate(str, locale) { 41800 (0, _assertString.default)(str); 41801 if (locale in validators) return validators[locale](str); 41802 else if (locale === 'any') { 41803 for(var key in validators){ 41804 /* eslint guard-for-in: 0 */ var validator = validators[key]; 41805 if (validator(str)) return true; 41806 } 41807 return false; 41808 } 41809 throw new Error("Invalid locale '".concat(locale, "'")); 41810} 41811module.exports = exports.default; 41812module.exports.default = exports.default; 41813 41814},{"b2df968a48112117":"fQT2o"}],"b4gwm":[function(require,module,exports,__globalThis) { 41815"use strict"; 41816Object.defineProperty(exports, "__esModule", { 41817 value: true 41818}); 41819exports.default = isStrongPassword; 41820var _merge = _interopRequireDefault(require("29e06d90a75827ea")); 41821var _assertString = _interopRequireDefault(require("d596cf5949cba1e2")); 41822function _interopRequireDefault(e) { 41823 return e && e.__esModule ? e : { 41824 default: e 41825 }; 41826} 41827var upperCaseRegex = /^[A-Z]$/; 41828var lowerCaseRegex = /^[a-z]$/; 41829var numberRegex = /^[0-9]$/; 41830var symbolRegex = /^[-#!$@£%^&*()_+|~=`{}\[\]:";'<>?,.\/\\ ]$/; 41831var defaultOptions = { 41832 minLength: 8, 41833 minLowercase: 1, 41834 minUppercase: 1, 41835 minNumbers: 1, 41836 minSymbols: 1, 41837 returnScore: false, 41838 pointsPerUnique: 1, 41839 pointsPerRepeat: 0.5, 41840 pointsForContainingLower: 10, 41841 pointsForContainingUpper: 10, 41842 pointsForContainingNumber: 10, 41843 pointsForContainingSymbol: 10 41844}; 41845/* Counts number of occurrences of each char in a string 41846 * could be moved to util/ ? 41847*/ function countChars(str) { 41848 var result = {};
41849 Array.from(str).forEach(function(char) { 41850 var curVal = result[char]; 41851 if (curVal) result[char] += 1; 41852 else result[char] = 1; 41853 }); 41854 return result; 41855} 41856/* Return information about a password */ function analyzePassword(password) { 41857 var charMap = countChars(password); 41858 var analysis = { 41859 length: password.length, 41860 uniqueChars: Object.keys(charMap).length, 41861 uppercaseCount: 0, 41862 lowercaseCount: 0, 41863 numberCount: 0, 41864 symbolCount: 0 41865 }; 41866 Object.keys(charMap).forEach(function(char) { 41867 /* istanbul ignore else */ if (upperCaseRegex.test(char)) analysis.uppercaseCount += charMap[char]; 41868 else if (lowerCaseRegex.test(char)) analysis.lowercaseCount += charMap[char]; 41869 else if (numberRegex.test(char)) analysis.numberCount += charMap[char]; 41870 else if (symbolRegex.test(char)) analysis.symbolCount += charMap[char]; 41871 }); 41872 return analysis; 41873} 41874function scorePassword(analysis, scoringOptions) { 41875 var points = 0; 41876 points += analysis.uniqueChars * scoringOptions.pointsPerUnique; 41877 points += (analysis.length - analysis.uniqueChars) * scoringOptions.pointsPerRepeat; 41878 if (analysis.lowercaseCount > 0) points += scoringOptions.pointsForContainingLower; 41879 if (analysis.uppercaseCount > 0) points += scoringOptions.pointsForContainingUpper; 41880 if (analysis.numberCount > 0) points += scoringOptions.pointsForContainingNumber; 41881 if (analysis.symbolCount > 0) points += scoringOptions.pointsForContainingSymbol; 41882 return points; 41883} 41884function isStrongPassword(str) { 41885 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; 41886 (0, _assertString.default)(str); 41887 var analysis = analyzePassword(str); 41888 options = (0, _merge.default)(options || {}, defaultOptions); 41889 if (options.returnScore) return scorePassword(analysis, options); 41890 return analysis.length >= options.minLength && analysis.lowercaseCount >= options.minLowercase && analysis.uppercaseCount >= options.minUppercase && analysis.numberCount >= options.minNumbers && analysis.symbolCount >= options.minSymbols; 41891} 41892module.exports = exports.default; 41893module.exports.default = exports.default; 41894 41895},{"29e06d90a75827ea":"bRDoK","d596cf5949cba1e2":"fQT2o"}],"d4Bdg":[function(require,module,exports,__globalThis) { 41896"use strict"; 41897function _typeof(o) { 41898 "@babel/helpers - typeof"; 41899 return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) { 41900 return typeof o; 41901 } : function(o) { 41902 return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; 41903 }, _typeof(o); 41904} 41905Object.defineProperty(exports, "__esModule", { 41906 value: true 41907}); 41908exports.default = isVAT; 41909exports.vatMatchers = void 0; 41910var _assertString = _interopRequireDefault(require("bef829e803e114f9")); 41911var algorithms = _interopRequireWildcard(require("83803936e2b74d1f")); 41912function _interopRequireWildcard(e, t) { 41913 if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); 41914 return (_interopRequireWildcard = function _interopRequireWildcard(e, t) { 41915 if (!t && e && e.__esModule) return e; 41916 var o, i, f = { 41917 __proto__: null, 41918 default: e 41919 }; 41920 if (null === e || "object" != _typeof(e) && "function" != typeof e) return f; 41921 if (o = t ? n : r) { 41922 if (o.has(e)) return o.get(e); 41923 o.set(e, f); 41924 }
41925 for(var _t in e)"default" !== _t && ({}).hasOwnProperty.call(e, _t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, _t)) && (i.get || i.set) ? o(f, _t, i) : f[_t] = e[_t]); 41926 return f; 41927 })(e, t); 41928} 41929function _interopRequireDefault(e) { 41930 return e && e.__esModule ? e : { 41931 default: e 41932 }; 41933} 41934var AU = function AU(str) { 41935 var match = str.match(/^(AU)?(\d{11})$/); 41936 if (!match) return false; 41937 // @see {@link https://abr.business.gov.au/Help/AbnFormat} 41938 var weights = [ 41939 10, 41940 1, 41941 3, 41942 5, 41943 7, 41944 9, 41945 11, 41946 13, 41947 15, 41948 17, 41949 19 41950 ]; 41951 str = str.replace(/^AU/, ''); 41952 var ABN = (parseInt(str.slice(0, 1), 10) - 1).toString() + str.slice(1); 41953 var total = 0; 41954 for(var i = 0; i < 11; i++)total += weights[i] * ABN.charAt(i); 41955 return total !== 0 && total % 89 === 0; 41956}; 41957var CH = function CH(str) { 41958 // @see {@link https://www.ech.ch/de/ech/ech-0097/5.2.0} 41959 var hasValidCheckNumber = function hasValidCheckNumber(digits) { 41960 var lastDigit = digits.pop(); // used as check number 41961 var weights = [ 41962 5, 41963 4, 41964 3, 41965 2, 41966 7, 41967 6, 41968 5, 41969 4 41970 ]; 41971 var calculatedCheckNumber = (11 - digits.reduce(function(acc, el, idx) { 41972 return acc + el * weights[idx]; 41973 }, 0) % 11) % 11; 41974 return lastDigit === calculatedCheckNumber; 41975 }; 41976 // @see {@link https://www.estv.admin.ch/estv/de/home/mehrwertsteuer/uid/mwst-uid-nummer.html} 41977 return /^(CHE[- ]?)?(\d{9}|(\d{3}\.\d{3}\.\d{3})|(\d{3} \d{3} \d{3})) ?(TVA|MWST|IVA)?$/.test(str) && hasValidCheckNumber(str.match(/\d/g).map(function(el) { 41978 return +el; 41979 })); 41980}; 41981var PT = function PT(str) { 41982 var match = str.match(/^(PT)?(\d{9})$/); 41983 if (!match) return false; 41984 var tin = match[2]; 41985 var checksum = 11 - algorithms.reverseMultiplyAndSum(tin.split('').slice(0, 8).map(function(a) { 41986 return parseInt(a, 10); 41987 }), 9) % 11; 41988 if (checksum > 9) return parseInt(tin[8], 10) === 0; 41989 return checksum === parseInt(tin[8], 10); 41990}; 41991var vatMatchers = exports.vatMatchers = { 41992 /** 41993 * European Union VAT identification numbers 41994 */ AT: function AT(str) { 41995 return /^(AT)?U\d{8}$/.test(str); 41996 }, 41997 BE: function BE(str) { 41998 return /^(BE)?\d{10}$/.test(str); 41999 }, 42000 BG: function BG(str) { 42001 return /^(BG)?\d{9,10}$/.test(str); 42002 }, 42003 HR: function HR(str) { 42004 return /^(HR)?\d{11}$/.test(str); 42005 }, 42006 CY: function CY(str) { 42007 return /^(CY)?\w{9}$/.test(str); 42008 }, 42009 CZ: function CZ(str) { 42010 return /^(CZ)?\d{8,10}$/.test(str); 42011 }, 42012 DK: function DK(str) { 42013 return /^(DK)?\d{8}$/.test(str); 42014 }, 42015 EE: function EE(str) { 42016 return /^(EE)?\d{9}$/.test(str); 42017 }, 42018 FI: function FI(str) { 42019 return /^(FI)?\d{8}$/.test(str); 42020 }, 42021 FR: function FR(str) { 42022 return /^(FR)?\w{2}\d{9}$/.test(str); 42023 }, 42024 DE: function DE(str) { 42025 return /^(DE)?\d{9}$/.test(str); 42026 }, 42027 EL: function EL(str) { 42028 return /^(EL)?\d{9}$/.test(str); 42029 }, 42030 HU: function HU(str) { 42031 return /^(HU)?\d{8}$/.test(str); 42032 }, 42033 IE: function IE(str) { 42034 return /^(IE)?\d{7}\w{1}(W)?$/.test(str); 42035 }, 42036 IT: function IT(str) { 42037 return /^(IT)?\d{11}$/.test(str); 42038 }, 42039 LV: function LV(str) { 42040 return /^(LV)?\d{11}$/.test(str); 42041 }, 42042 LT: function LT(str) { 42043 return /^(LT)?\d{9,12}$/.test(str); 42044 }, 42045 LU: function LU(str) { 42046 return /^(LU)?\d{8}$/.test(str); 42047 }, 42048 MT: function MT(str) { 42049 return /^(MT)?\d{8}$/.test(str); 42050 }, 42051 NL: function NL(str) { 42052 return /^(NL)?\d{9}B\d{2}$/.test(str); 42053 }, 42054 PL: function PL(str) { 42055 return /^(PL)?(\d{10}|(\d{3}-\d{3}-\d{2}-\d{2})|(\d{3}-\d{2}-\d{2}-\d{3}))$/.test(str); 42056 }, 42057 PT: PT, 42058 RO: function RO(str) { 42059 return /^(RO)?\d{2,10}$/.test(str); 42060 }, 42061 SK: function SK(str) { 42062 return /^(SK)?\d{10}$/.test(str); 42063 }, 42064 SI: function SI(str) { 42065 return /^(SI)?\d{8}$/.test(str); 42066 }, 42067 ES: function ES(str) { 42068 return /^(ES)?\w\d{7}[A-Z]$/.test(str); 42069 }, 42070 SE: function SE(str) { 42071 return /^(SE)?\d{12}$/.test(str); 42072 }, 42073 /** 42074 * VAT numbers of non-EU countries 42075 */ AL: function AL(str) { 42076 return /^(AL)?\w{9}[A-Z]$/.test(str); 42077 }, 42078 MK: function MK(str) { 42079 return /^(MK)?\d{13}$/.test(str); 42080 }, 42081 AU: AU, 42082 BY: function BY(str) { 42083 return /^(УÐÐ )?\d{9}$/.test(str); 42084 }, 42085 CA: function CA(str) { 42086 return /^(CA)?\d{9}$/.test(str); 42087 }, 42088 IS: function IS(str) { 42089 return /^(IS)?\d{5,6}$/.test(str); 42090 }, 42091 IN: function IN(str) { 42092 return /^(IN)?\d{15}$/.test(str); 42093 }, 42094 ID: function ID(str) { 42095 return /^(ID)?(\d{15}|(\d{2}.\d{3}.\d{3}.\d{1}-\d{3}.\d{3}))$/.test(str); 42096 }, 42097 IL: function IL(str) { 42098 return /^(IL)?\d{9}$/.test(str); 42099 }, 42100 KZ: function KZ(str) { 42101 return /^(KZ)?\d{12}$/.test(str); 42102 }, 42103 NZ: function NZ(str) { 42104 return /^(NZ)?\d{9}$/.test(str); 42105 }, 42106 NG: function NG(str) { 42107 return /^(NG)?(\d{12}|(\d{8}-\d{4}))$/.test(str); 42108 }, 42109 NO: function NO(str) { 42110 return /^(NO)?\d{9}MVA$/.test(str); 42111 }, 42112 PH: function PH(str) { 42113 return /^(PH)?(\d{12}|\d{3} \d{3} \d{3} \d{3})$/.test(str); 42114 }, 42115 RU: function RU(str) { 42116 return /^(RU)?(\d{10}|\d{12})$/.test(str); 42117 }, 42118 SM: function SM(str) { 42119 return /^(SM)?\d{5}$/.test(str); 42120 }, 42121 SA: function SA(str) { 42122 return /^(SA)?\d{15}$/.test(str); 42123 }, 42124 RS: function RS(str) { 42125 return /^(RS)?\d{9}$/.test(str); 42126 }, 42127 CH: CH, 42128 TR: function TR(str) { 42129 return /^(TR)?\d{10}$/.test(str); 42130 }, 42131 UA: function UA(str) { 42132 return /^(UA)?\d{12}$/.test(str); 42133 }, 42134 GB: function GB(str) { 42135 return /^GB((\d{3} \d{4} ([0-8][0-9]|9[0-6]))|(\d{9} \d{3})|(((GD[0-4])|(HA[5-9]))[0-9]{2}))$/.test(str); 42136 }, 42137 UZ: function UZ(str) { 42138 return /^(UZ)?\d{9}$/.test(str); 42139 }, 42140 /** 42141 * VAT numbers of Latin American countries 42142 */ AR: function AR(str) { 42143 return /^(AR)?\d{11}$/.test(str); 42144 }, 42145 BO: function BO(str) { 42146 return /^(BO)?\d{7}$/.test(str); 42147 }, 42148 BR: function BR(str) { 42149 return /^(BR)?((\d{2}.\d{3}.\d{3}\/\d{4}-\d{2})|(\d{3}.\d{3}.\d{3}-\d{2}))$/.test(str); 42150 }, 42151 CL: function CL(str) { 42152 return /^(CL)?\d{8}-\d{1}$/.test(str); 42153 }, 42154 CO: function CO(str) { 42155 return /^(CO)?\d{10}$/.test(str); 42156 }, 42157 CR: function CR(str) { 42158 return /^(CR)?\d{9,12}$/.test(str); 42159 }, 42160 EC: function EC(str) { 42161 return /^(EC)?\d{13}$/.test(str); 42162 }, 42163 SV: function SV(str) { 42164 return /^(SV)?\d{4}-\d{6}-\d{3}-\d{1}$/.test(str); 42165 }, 42166 GT: function GT(str) { 42167 return /^(GT)?\d{7}-\d{1}$/.test(str); 42168 }, 42169 HN: function HN(str) { 42170 return /^(HN)?$/.test(str); 42171 }, 42172 MX: function MX(str) { 42173 return /^(MX)?\w{3,4}\d{6}\w{3}$/.test(str); 42174 }, 42175 NI: function NI(str) { 42176 return /^(NI)?\d{3}-\d{6}-\d{4}\w{1}$/.test(str); 42177 }, 42178 PA: function PA(str) { 42179 return /^(PA)?$/.test(str); 42180 }, 42181 PY: function PY(str) { 42182 return /^(PY)?\d{6,8}-\d{1}$/.test(str); 42183 }, 42184 PE: function PE(str) { 42185 return /^(PE)?\d{11}$/.test(str); 42186 }, 42187 DO: function DO(str) { 42188 return /^(DO)?(\d{11}|(\d{3}-\d{7}-\d{1})|[1,4,5]{1}\d{8}|([1,4,5]{1})-\d{2}-\d{5}-\d{1})$/.test(str); 42189 }, 42190 UY: function UY(str) { 42191 return /^(UY)?\d{12}$/.test(str); 42192 }, 42193 VE: function VE(str) { 42194 return /^(VE)?[J,G,V,E]{1}-(\d{9}|(\d{8}-\d{1}))$/.test(str); 42195 } 42196}; 42197function isVAT(str, countryCode) { 42198 (0, _assertString.default)(str); 42199 (0, _assertString.default)(countryCode); 42200 if (countryCode in vatMatchers) return vatMatchers[countryCode](str); 42201 throw new Error("Invalid country code: '".concat(countryCode, "'")); 42202} 42203 42204},{"bef829e803e114f9":"fQT2o","83803936e2b74d1f":"gZTPm"}],"2CPjp":[function(require,module,exports,__globalThis) { 42205// Get all the category triggers 42206const catTriggers = document.querySelectorAll('.js-post-cat-trigger');
42207if (catTriggers) catTriggers.forEach((trigger)=>{ 42208 trigger.addEventListener('click', (e)=>{ 42209 e.preventDefault(); 42210 // If the trigger is already active, don't do anything 42211 if (trigger.classList.contains('active')) return; 42212 const section = trigger.closest('.m__post-feed'); 42213 const cat = trigger.dataset.cat; 42214 // Update the active trigger 42215 updateActiveCatTrigger(section, cat); 42216 // Filter the posts based on the category 42217 filterPosts(section, cat); 42218 }); 42219}); 42220// Load more posts 42221const loadMoreButtons = document.querySelectorAll('.js-load-more-posts'); 42222if (loadMoreButtons) loadMoreButtons.forEach((button)=>{ 42223 button.addEventListener('click', (e)=>{ 42224 e.preventDefault(); 42225 loadMorePosts(button); 42226 }); 42227}); 42228// Reset posts 42229const resetFiltersTriggers = document.querySelectorAll('.js-post-reset__trigger'); 42230if (resetFiltersTriggers) resetFiltersTriggers.forEach((trigger)=>{ 42231 trigger.addEventListener('click', (e)=>{ 42232 e.preventDefault(); 42233 resetPosts(trigger); 42234 }); 42235}); 42236const updateActiveCatTrigger = (section, cat)=>{ 42237 const catTriggers = section.querySelectorAll('.js-post-cat-trigger'); 42238 if (catTriggers) // Update the active trigger 42239 catTriggers.forEach((trigger)=>{ 42240 if (trigger.dataset.cat === cat) // Add active class to the clicked trigger 42241 trigger.classList.add('active'); 42242 else // Remove active class from non clicked triggers 42243 trigger.classList.remove('active'); 42244 }); 42245}; 42246const filterPosts = (section, cat = null, type = 'filter')=>{ 42247 const posts = section.querySelectorAll('.js-post-card'); 42248 if (posts) { 42249 // Hide all posts 42250 posts.forEach((post)=>{ 42251 post.classList.add('hidden'); 42252 }); 42253 // Show posts that match the category 42254 let index = 0; 42255 posts.forEach((post)=>{ 42256 let showPost = true; 42257 if (cat) { 42258 const postCats = JSON.parse(post.dataset.cats); 42259 showPost = postCats.some((item)=>cat.includes(item)); 42260 } 42261 if (showPost) { 42262 if (index <= 8) post.classList.remove('hidden'); 42263 if (type === 'filter') // Don't increment the index if the type is loadMore so that all the remaining posts are shown 42264 index++; 42265 } 42266 }); 42267 // Show or hide the load more button 42268 const showLoadMoreButton = type === 'loadMore' ? false : index > 9;
42269 const loadMoreButtonContainer = section.querySelector('.js-load-more-posts-btn-container'); 42270 if (showLoadMoreButton) loadMoreButtonContainer.classList.remove('hidden'); 42271 else loadMoreButtonContainer.classList.add('hidden'); 42272 } 42273}; 42274const loadMorePosts = (button)=>{ 42275 const section = button.closest('.m__post-feed'); 42276 const catElem = section.querySelector('.js-post-cat-trigger.active'); 42277 const cat = catElem ? catElem.dataset.cat : null; 42278 filterPosts(section, cat, 'loadMore'); 42279}; 42280const resetPosts = (trigger)=>{ 42281 const section = trigger.closest('.m__post-feed'); 42282 const cat = 'all'; 42283 // Update the active trigger 42284 updateActiveCatTrigger(section, cat); 42285 // Run the filterPosts function with the all category to reset these posts 42286 filterPosts(section, cat); 42287}; 42288 42289},{}],"6jgcn":[function(require,module,exports,__globalThis) { 42290var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 42291var _choicesJs = require("choices.js"); 42292var _choicesJsDefault = parcelHelpers.interopDefault(_choicesJs); 42293const privateEventSpacesModules = document.querySelectorAll('.m__spaces-feed'); 42294if (privateEventSpacesModules) privateEventSpacesModules.forEach((module)=>{ 42295 const occasionFilterEl = module.querySelector('#occasionFilter'); 42296 const locationFilterEl = module.querySelector('#locationFilter'); 42297 const capacityFilterEl = module.querySelector('#capacityFilter'); 42298 const spacesCards = module.querySelectorAll('.js-spaces-card'); 42299 const resetFilters = module.querySelectorAll('.js-reset-filters'); 42300 const spacesCardsGrid = module.querySelector('.m__spaces-feed__grid'); 42301 const noSpacesFoundMessage = module.querySelector('.m__spaces-feed__none-found');
42302 const loadMoreButton = module.querySelector('.js-load-more-spaces'); 42303 if (occasionFilterEl && locationFilterEl && capacityFilterEl) { 42304 const choicesConfig = { 42305 itemSelectText: '', 42306 shouldSort: false, 42307 searchEnabled: false 42308 }; 42309 const occasionFilter = new (0, _choicesJsDefault.default)(occasionFilterEl, choicesConfig); 42310 const locationFilter = new (0, _choicesJsDefault.default)(locationFilterEl, choicesConfig); 42311 const capacityFilter = new (0, _choicesJsDefault.default)(capacityFilterEl, choicesConfig); 42312 const filterDropdowns = [ 42313 occasionFilterEl, 42314 locationFilterEl, 42315 capacityFilterEl 42316 ]; 42317 filterDropdowns.forEach((filterDropdown)=>{ 42318 filterDropdown.addEventListener("change", (event)=>{ 42319 loadMoreButton.parentElement.classList.add('hidden'); 42320 const currentCapacityFilter = capacityFilterEl.value; 42321 const currentOccasionFilter = occasionFilterEl.value; 42322 const currentLocationFilter = locationFilterEl.value; 42323 let hiddenCardCount = 0; 42324 // Reset no spaces found message 42325 spacesCardsGrid.classList.remove('ig-hidden'); 42326 noSpacesFoundMessage.classList.add('hidden'); 42327 spacesCards.forEach((card)=>{ 42328 card.classList.remove('hidden'); 42329 const brandArr = JSON.parse(card.dataset.brand); 42330 const matchesBrand = brandArr.some((item)=>currentOccasionFilter.includes(item)); 42331 if (currentOccasionFilter != 0 && !matchesBrand) { 42332 card.classList.add('hidden'); 42333 hiddenCardCount++; 42334 } else if (currentLocationFilter != 0 && card.dataset.location != currentLocationFilter) { 42335 card.classList.add('hidden'); 42336 hiddenCardCount++; 42337 } else if (currentCapacityFilter != 0 && parseInt(card.dataset.capacity) < currentCapacityFilter) { 42338 card.classList.add('hidden'); 42339 hiddenCardCount++; 42340 } 42341 }); 42342 // Show the no spaces found message 42343 if (hiddenCardCount == spacesCards.length) { 42344 spacesCardsGrid.classList.add('ig-hidden'); 42345 noSpacesFoundMessage.classList.remove('hidden'); 42346 } 42347 // Reset the filters 42348 if (currentLocationFilter != 0 || currentOccasionFilter != 0) resetFilters.forEach((resetFilter)=>{ 42349 resetFilter.classList.remove('active'); 42350 }); 42351 else resetFilters.forEach((resetFilter)=>{ 42352 resetFilter.classList.add('active'); 42353 }); 42354 }); 42355 }); 42356 resetFilters.forEach((resetFilter)=>{ 42357 resetFilter.addEventListener('click', (event)=>{ 42358 event.target.classList.add('active'); 42359 spacesCardsGrid.classList.remove('ig-hidden'); 42360 noSpacesFoundMessage.classList.add('hidden'); 42361 occasionFilter.setChoiceByValue('0'); 42362 locationFilter.setChoiceByValue('0'); 42363 capacityFilter.setChoiceByValue('0'); 42364 spacesCards.forEach((card)=>{ 42365 card.classList.remove('hidden'); 42366 }); 42367 }); 42368 }); 42369 loadMoreButton.addEventListener('click', (event)=>{ 42370 const currentCapacityFilter = capacityFilterEl.value; 42371 const currentOccasionFilter = occasionFilter.getValue(true); 42372 const currentLocationFilter = locationFilterEl.value; 42373 spacesCards.forEach((card)=>{ 42374 const brandArr = JSON.parse(card.dataset.brand); 42375 const matchesBrand = brandArr.some((item)=>currentOccasionFilter.includes(item)); 42376 if (currentOccasionFilter == 0 || matchesBrand) card.classList.remove('hidden'); 42377 }); 42378 event.target.parentElement.classList.add('hidden'); 42379 }); 42380 } 42381}); 42382 42383},{"choices.js":"cVxV3","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"6zDmW":[function(require,module,exports,__globalThis) { 42384var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 42385parcelHelpers.defineInteropFlag(exports); 42386parcelHelpers.export(exports, "promo", ()=>promo); 42387var _swiperBundle = require("swiper/swiper-bundle"); 42388var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 42389var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 42390const promo = ()=>{ 42391 const promoModules = document.querySelectorAll('.m__promo');
42392 if (promoModules) promoModules.forEach((mod)=>{ 42393 const slider = mod.querySelector('.js-promo-swiper'); 42394 if (slider) { 42395 const sliderSlides = slider.querySelectorAll('.m__promo__highlight-slide'); 42396 const sliderVideos = slider.querySelectorAll('.js-promo-swiper-video'); 42397 // Trigger the first video on page load 42398 if (sliderVideos.length > 0) { 42399 for(var source in sliderVideos[0].children){ 42400 var videoSource = sliderVideos[0].children[source]; 42401 if (typeof videoSource.tagName === "string" && videoSource.tagName === "SOURCE" && videoSource.dataset.src) videoSource.src = videoSource.dataset.src; 42402 } 42403 sliderVideos[0].load(); 42404 sliderVideos[0].play(); 42405 } 42406 if (sliderSlides.length > 1) { 42407 // Initialise the slider 42408 const promoSwiper = new (0, _swiperBundleDefault.default)(slider, { 42409 centeredSlides: true, 42410 slidesPerView: 1, 42411 loop: true, 42412 effect: "fade", 42413 speed: 1500, 42414 fadeEffect: { 42415 crossFade: true 42416 }, 42417 autoplay: { 42418 delay: 3000, 42419 disableOnInteraction: true 42420 }, 42421 keyboard: { 42422 enabled: true, 42423 onlyInViewport: true 42424 } 42425 }); 42426 let sliderNextArrow = mod.querySelector('.js-promo-swiper-next'); 42427 let sliderPrevArrow = mod.querySelector('.js-promo-swiper-prev'); 42428 promoSwiper.on('slideChange', function() { 42429 // Stop all videos from playing 42430 sliderVideos.forEach((slideVideo)=>{ 42431 slideVideo.pause(); 42432 slideVideo.currentTime = 0; 42433 slideVideo.load(); 42434 }); 42435 // Check for any videos on the slide and make sure they're lazy-loaded 42436 let slideVideo = promoSwiper.slides[promoSwiper.activeIndex].querySelector("video"); 42437 if (slideVideo) { 42438 if (!slideVideo.currentTime > 0) { 42439 for(var source in slideVideo.children){ 42440 var videoSource = slideVideo.children[source]; 42441 if (typeof videoSource.tagName === "string" && videoSource.tagName === "SOURCE" && videoSource.dataset.src) videoSource.src = videoSource.dataset.src; 42442 } 42443 slideVideo.load(); 42444 slideVideoTimeout = setTimeout(()=>{ 42445 slideVideo.play(); 42446 }, 1000); 42447 } 42448 } 42449 }); 42450 // Move to the previous slide if 'prev' arrow clicked 42451 if (sliderPrevArrow) sliderPrevArrow.addEventListener('click', (event)=>{ 42452 let prevSlide = promoSwiper.activeIndex - 1; 42453 if (prevSlide < 0) prevSlide = promoSwiper.slides.length; // Set to the last slide 42454 promoSwiper.slideTo(prevSlide); 42455 }); 42456 // Move to the next slide if 'next' arrow clicked 42457 if (sliderNextArrow) sliderNextArrow.addEventListener('click', (event)=>{ 42458 let nextSlide = promoSwiper.activeIndex + 1; 42459 if (nextSlide >= promoSwiper.slides.length) nextSlide = 0; // Return to start! 42460 promoSwiper.slideTo(nextSlide); 42461 }); 42462 } 42463 } 42464 }); 42465}; 42466 42467},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"k3KvY":[function(require,module,exports,__globalThis) { 42468var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 42469var _swiperBundle = require("swiper/swiper-bundle"); 42470var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 42471var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 42472const promoSliderModules = document.querySelectorAll('.m__pslider');
42473if (promoSliderModules) promoSliderModules.forEach((promoSliderModule)=>{ 42474 const promoSliderSlides = promoSliderModule.querySelectorAll('.m__pslider__swiper-slide '); 42475 const slideVideos = promoSliderModule.querySelectorAll('.js-pslider-video'); 42476 if (promoSliderSlides.length > 1) { 42477 // Initialise the slider 42478 const swiperElem = promoSliderModule.querySelector('.m__pslider__swiper-wrapper .swiper'); 42479 const pSwiper = new (0, _swiperBundleDefault.default)(swiperElem, { 42480 centeredSlides: true, 42481 slidesPerView: 1, 42482 rewind: true, 42483 shortSwipes: true, 42484 loop: false, 42485 keyboard: { 42486 enabled: true, 42487 onlyInViewport: true 42488 } 42489 }); 42490 const psliderNavItems = promoSliderModule.querySelectorAll('.js-pslider-nav-item'); 42491 const psliderNextArrow = promoSliderModule.querySelector('.js-pslider__swiper-next'); 42492 const psliderPrevArrow = promoSliderModule.querySelector('.js-pslider__swiper-prev'); 42493 psliderPrevArrow.classList.add('hidden'); 42494 // Updates when a slide changes 42495 pSwiper.on('slideChange', function() { 42496 // Change selected 'nav' item when the slide changes 42497 psliderNavItems.forEach((navItem)=>{ 42498 if (navItem.getAttribute('data-slide-index') == pSwiper.realIndex) navItem.classList.add('active'); 42499 else navItem.classList.remove('active'); 42500 }); 42501 // Stop all videos from playing 42502 slideVideos.forEach((slideVideo)=>{ 42503 slideVideo.pause(); 42504 slideVideo.currentTime = 0; 42505 slideVideo.load(); 42506 }); 42507 // Check for any videos on the slide and make sure they're lazy-loaded (Had a bug with intersection observer not being triggered due to how swiper loads items) 42508 const slideVideo = pSwiper.slides[pSwiper.activeIndex].querySelector('video'); 42509 if (slideVideo) { 42510 if (!slideVideo.currentTime > 0) { 42511 // Only reload video if it isn't already playing 42512 slideVideo.load(); 42513 slideVideoTimeout = setTimeout(()=>{ 42514 slideVideo.play(); 42515 }, 1000); 42516 } 42517 } 42518 // Hide next arrow if this is the last slide 42519 if (pSwiper.isEnd) psliderNextArrow.classList.add('hidden'); 42520 else psliderNextArrow.classList.remove('hidden'); 42521 if (pSwiper.activeIndex == 0) psliderPrevArrow.classList.add('hidden'); 42522 else psliderPrevArrow.classList.remove('hidden'); 42523 }); 42524 // Move to next slide if 'prev' arrow clicked 42525 if (psliderPrevArrow) psliderPrevArrow.addEventListener('click', (event)=>{ 42526 const prevSlide = pSwiper.activeIndex - 1; 42527 if (prevSlide < 0) prevSlide = pSwiper.slides.length; // Set to the last slide 42528 pSwiper.slideTo(prevSlide); 42529 }); 42530 // Move to next slide if 'next' arrow clicked 42531 if (psliderNextArrow) psliderNextArrow.addEventListener('click', (event)=>{ 42532 const nextSlide = pSwiper.activeIndex + 1; 42533 if (nextSlide >= pSwiper.slides.length) nextSlide = 0; //Return to start! 42534 pSwiper.slideTo(nextSlide); 42535 }); 42536 // Update displated slide if 'nav' item clicked 42537 psliderNavItems.forEach((navItem)=>{ 42538 navItem.addEventListener('click', (event)=>{ 42539 pSwiper.slideTo(navItem.getAttribute('data-slide-index')); 42540 }); 42541 }); 42542 } else // Only 1 slide - don't power up swiper and just manually add the active class (doing a foreach here juuuust in case) 42543 promoSliderSlides.forEach((slide)=>{ 42544 slide.classList.add('swiper-slide-active'); 42545 }); 42546}); 42547 42548},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"ccvLW":[function(require,module,exports,__globalThis) { 42549var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 42550var _swiperBundle = require("swiper/swiper-bundle"); 42551var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 42552var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 42553var _gsap = require("gsap"); 42554var _gsapDefault = parcelHelpers.interopDefault(_gsap); 42555const testimonialModules = document.querySelectorAll('.m__testimonials');
42556testimonialModules.forEach((moduleElem)=>{ 42557 //Loop through each card slider and initialise swiper and buttons 42558 const quoteSlider = moduleElem.querySelector('.js-testimonials-swiper'); 42559 const attributeesSlider = moduleElem.querySelector('.js-testimonials-swiper-names'); 42560 if (quoteSlider && attributeesSlider) { 42561 const quoteSwiper = initTestimonialsQuoteSlider(quoteSlider); 42562 const attributeesSwiper = initTestimonialsAttributeesSlider(attributeesSlider); 42563 let nextArrow = moduleElem.querySelector('.js-tslider__swiper-next'); 42564 let prevArrow = moduleElem.querySelector('.js-tslider__swiper-prev'); 42565 //Move to next slide if 'next' arrow clicked 42566 if (nextArrow) nextArrow.addEventListener('click', (event)=>{ 42567 animateTestimonialAttributeesSlide(attributeesSwiper, quoteSwiper, 'next', nextArrow, prevArrow); 42568 }); 42569 if (prevArrow) prevArrow.addEventListener('click', (event)=>{ 42570 animateTestimonialAttributeesSlide(attributeesSwiper, quoteSwiper, 'prev', nextArrow, prevArrow); 42571 }); 42572 } 42573}); 42574function initTestimonialsQuoteSlider(slider) { 42575 const swiper = new (0, _swiperBundleDefault.default)(slider, { 42576 loop: true, 42577 effect: 'creative', 42578 creativeEffect: { 42579 prev: { 42580 translate: [ 42581 '-100%', 42582 0, 42583 -1 42584 ], 42585 opacity: 0.5 42586 }, 42587 next: { 42588 translate: [ 42589 '100%', 42590 0, 42591 0 42592 ], 42593 opacity: 1 42594 } 42595 }, 42596 speed: 600, 42597 allowTouchMove: false, 42598 draggable: false 42599 }); 42600 return swiper; 42601} 42602function initTestimonialsAttributeesSlider(slider) { 42603 const swiper = new (0, _swiperBundleDefault.default)(slider, { 42604 slidesPerView: 1, 42605 centeredSlides: false, 42606 shortSwipes: true, 42607 keyboard: { 42608 enabled: true, 42609 onlyInViewport: true 42610 }, 42611 speed: 0, 42612 allowTouchMove: false, 42613 draggable: false 42614 }); 42615 return swiper; 42616} 42617function animateTestimonialAttributeesSlide(slider, quoteSwiper, direction, nextArrow, prevArrow) { 42618 const currentSlide = slider.slides[slider.activeIndex]; 42619 let newSlideIndex = direction === 'next' ? slider.activeIndex + 1 : slider.activeIndex - 1; 42620 let newSlide = slider.slides[newSlideIndex]; 42621 if (!newSlide) { 42622 if (direction === 'next') newSlide = slider.slides[0]; 42623 else newSlide = slider.slides[slider.slides.length - 1]; 42624 newSlideIndex = direction === 'next' ? 0 : slider.slides.length - 1; 42625 } 42626 const currentSlideAnimationElements = currentSlide.querySelectorAll('.js-slide-animation-element'); 42627 const currentSlideAnimationElementsLarge = currentSlide.querySelectorAll('.js-slide-animation-element-large'); 42628 const newSlideAnimationElements = newSlide.querySelectorAll('.js-slide-animation-element'); 42629 const newSlideAnimationElementsLarge = newSlide.querySelectorAll('.js-slide-animation-element-large'); 42630 (0, _gsapDefault.default).set(newSlideAnimationElements, { 42631 y: direction === 'next' ? '100%' : '-100%', 42632 opacity: 0 42633 }); 42634 (0, _gsapDefault.default).set(newSlideAnimationElementsLarge, { 42635 y: direction === 'next' ? '35%' : '-35%', 42636 opacity: 0 42637 }); 42638 const tl = (0, _gsapDefault.default).timeline({ 42639 onStart: ()=>{ 42640 // Add classes to disable pointer events and cursor on the button 42641 nextArrow.classList.add('pointer-events-none', 'cursor-not-allowed'); 42642 prevArrow.classList.add('pointer-events-none', 'cursor-not-allowed'); 42643 // Slide the image swiper 42644 if (direction === 'next') quoteSwiper.slideNext(); 42645 else quoteSwiper.slidePrev(); 42646 }, 42647 onComplete: ()=>{ 42648 // Remove classes to enable pointer events and cursor on the button 42649 nextArrow.classList.remove('pointer-events-none', 'cursor-not-allowed'); 42650 prevArrow.classList.remove('pointer-events-none', 'cursor-not-allowed'); 42651 } 42652 }); 42653 tl.addLabel('currentSlideAnimateOut'); 42654 tl.to(currentSlideAnimationElements, { 42655 y: direction === 'next' ? '-100%' : '100%', 42656 opacity: 0, 42657 duration: 0.3, 42658 onComplete: ()=>{ 42659 slider.slideTo(newSlideIndex); 42660 } 42661 }, 'currentSlideAnimateOut'); 42662 tl.to(currentSlideAnimationElementsLarge, { 42663 y: direction === 'next' ? '-35%' : '35%', 42664 opacity: 0, 42665 duration: 0.3, 42666 onComplete: ()=>{ 42667 slider.slideTo(newSlideIndex); 42668 } 42669 }, 'currentSlideAnimateOut'); 42670 tl.addLabel('newSlideAnimateIn'); 42671 tl.to(newSlideAnimationElements, { 42672 y: '0%', 42673 opacity: 1, 42674 duration: 0.3 42675 }, 'newSlideAnimateIn'); 42676 tl.to(newSlideAnimationElementsLarge, { 42677 y: '0%', 42678 opacity: 1, 42679 duration: 0.3 42680 }, 'newSlideAnimateIn'); 42681} 42682 42683},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","gsap":"33IqQ","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"hC2sc":[function(require,module,exports,__globalThis) { 42684const videoPlayers = document.querySelectorAll('.js-video-player');
42685if (videoPlayers) videoPlayers.forEach((videoPlayer)=>{ 42686 for(var source in videoPlayer.children){ 42687 var videoSource = videoPlayer.children[source]; 42688 if (typeof videoSource.tagName === 'string' && videoSource.tagName === 'SOURCE' && videoSource.dataset.src) videoSource.src = videoSource.dataset.src; 42689 } 42690 videoPlayer.load(); 42691 const videoPlayerToggle = document.querySelector('.js-toggle-video'); 42692 if (videoPlayerToggle) videoPlayerToggle.addEventListener('click', (event)=>{ 42693 if (videoPlayer.paused) { 42694 videoPlayer.play(); 42695 videoPlayerToggle.classList.add('ig-hidden'); 42696 } else { 42697 videoPlayer.pause(); 42698 videoPlayerToggle.classList.remove('ig-hidden'); 42699 } 42700 }); 42701}); 42702 42703},{}],"if2jl":[function(require,module,exports,__globalThis) { 42704/** 42705 * Private Dining Filters 42706 * Handles filtering of private dining cards based on multiple criteria 42707 */ const privateDiningFilterModules = document.querySelectorAll('.m__plist__filter-bar'); 42708if (privateDiningFilterModules) privateDiningFilterModules.forEach((filterBar)=>{ 42709 const cards = document.querySelectorAll('.m__plist__card'); 42710 const resetButton = filterBar.querySelector('.js-filter-reset'); 42711 let activeFilters = {}; 42712 // Initialize filter selects 42713 const selects = filterBar.querySelectorAll('select'); 42714 selects.forEach((select)=>{ 42715 select.addEventListener('change', (e)=>{ 42716 const filterName = e.target.name; 42717 const filterValue = e.target.value; 42718 if (filterValue) { 42719 // Check if this value is already selected before adding 42720 const isDuplicate = activeFilters[filterName] && activeFilters[filterName].some((filter)=>filter.value === filterValue); 42721 if (!isDuplicate) addFilter(filterName, filterValue, e.target.options[e.target.selectedIndex].text); 42722 // Reset select to allow multiple selections 42723 e.target.value = ''; 42724 } 42725 applyFilters(); 42726 }); 42727 }); 42728 function addFilter(filterName, filterValue, filterLabel) { 42729 // Initialize array for this filter type if it doesn't exist 42730 if (!activeFilters[filterName]) activeFilters[filterName] = []; 42731 // Check if this value is already selected 42732 const existingFilter = activeFilters[filterName].find((filter)=>filter.value === filterValue); 42733 if (!existingFilter) activeFilters[filterName].push({ 42734 value: filterValue, 42735 label: filterLabel 42736 }); 42737 updateFilterTags(); 42738 } 42739 function removeFilter(filterName, filterValue) { 42740 if (activeFilters[filterName]) { 42741 activeFilters[filterName] = activeFilters[filterName].filter((filter)=>filter.value !== filterValue); 42742 // Remove the filter type entirely if no values remain 42743 if (activeFilters[filterName].length === 0) delete activeFilters[filterName]; 42744 } 42745 updateFilterTags(); 42746 } 42747 function updateFilterTags() { 42748 // Remove existing filter tags within this module only 42749 const existingTags = filterBar.parentElement.querySelectorAll('.filter-tag'); 42750 existingTags.forEach((tag)=>tag.remove()); 42751 // Create filter tags container if it doesn't exist 42752 let tagsContainer = filterBar.parentElement.querySelector('.filter-tags-container'); 42753 if (!tagsContainer) { 42754 tagsContainer = document.createElement('div'); 42755 tagsContainer.className = 'filter-tags-container flex flex-wrap gap-2 w-full'; 42756 // Insert after the filter bar 42757 filterBar.parentNode.insertBefore(tagsContainer, filterBar.nextSibling); 42758 } 42759 // Add new filter tags 42760 Object.keys(activeFilters).forEach((filterName)=>{ 42761 activeFilters[filterName].forEach((filter)=>{ 42762 const tag = createFilterTag(filterName, filter.value, filter.label); 42763 tagsContainer.appendChild(tag); 42764 }); 42765 }); 42766 } 42767 function createFilterTag(filterName, filterValue, filterLabel) { 42768 const tag = document.createElement('div'); 42769 tag.className = 'filter-tag bg-[#FDF9F4] px-3 py-2 rounded-[4px] text-sm flex items-center gap-2 cursor-pointer hover:bg-gray-100 transition-colors border border-[#999]'; 42770 tag.innerHTML = `
42771 <span class="f__paragraph-regular !text-black !text-[15px] !leading-normal">${filterLabel}</span> 42772 <button class="remove-filter pt-[4px]" data-filter="${filterName}" data-value="${filterValue}"> 42773 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> 42774 <line x1="18" y1="6" x2="6" y2="18"></line> 42775 <line x1="6" y1="6" x2="18" y2="18"></line> 42776 </svg> 42777 </button> 42778 `; 42779 // Add click handler to remove filter 42780 const removeBtn = tag.querySelector('.remove-filter'); 42781 removeBtn.addEventListener('click', (e)=>{ 42782 e.stopPropagation(); 42783 removeFilter(filterName, filterValue); 42784 applyFilters(); 42785 }); 42786 return tag; 42787 } 42788 function applyFilters() { 42789 cards.forEach((card)=>{ 42790 let shouldShow = true; 42791 // Check each active filter type 42792 Object.keys(activeFilters).forEach((filterName)=>{ 42793 const filterValues = activeFilters[filterName].map((filter)=>filter.value); 42794 const cardValues = getCardFilterValues(card, filterName); 42795 // Card should show if it matches ANY of the selected values for this filter type 42796 // Check if any of the card's values match any of the selected filter values 42797 if (cardValues && cardValues.length > 0) { 42798 const hasMatch = cardValues.some((cardValue)=>filterValues.includes(cardValue)); 42799 if (!hasMatch) shouldShow = false; 42800 } else // If card has no values for this filter type, hide it 42801 shouldShow = false; 42802 }); 42803 // Show/hide card using CSS 42804 if (shouldShow) { 42805 card.style.display = 'block'; 42806 card.style.opacity = '1'; 42807 } else { 42808 card.style.display = 'none'; 42809 card.style.opacity = '0'; 42810 } 42811 }); 42812 // Update card count or show "no results" message 42813 updateResultsCount(); 42814 } 42815 function getCardFilterValues(card, filterName) { 42816 // Map filter names to data attributes 42817 const filterMap = { 42818 'event-type-filter': 'data-event-type', 42819 'area-type-filter': 'data-area-type', 42820 'number-of-guests-filter': 'data-number-of-guests', 42821 'region-filter': 'data-region' 42822 }; 42823 const dataAttr = filterMap[filterName]; 42824 if (dataAttr) { 42825 const value = card.getAttribute(dataAttr); 42826 if (value) // Split space-separated values into array and trim whitespace 42827 return value.split(' ').map((v)=>v.trim()).filter((v)=>v.length > 0); 42828 } 42829 return []; 42830 } 42831 function updateResultsCount() { 42832 const visibleCards = Array.from(cards).filter((card)=>card.style.display !== 'none'); 42833 // You can add logic here to show count or "no results" message 42834 if (visibleCards.length === 0) showNoResults(); 42835 else hideNoResults(); 42836 } 42837 function showNoResults() { 42838 let noResults = filterBar.parentElement.querySelector('.no-results'); 42839 if (!noResults) { 42840 noResults = document.createElement('div'); 42841 noResults.className = 'no-results text-center py-8 text-gray-500'; 42842 noResults.innerHTML = '<p>No private dining options match your selected filters.</p>'; 42843 filterBar.parentElement.appendChild(noResults); 42844 } 42845 noResults.style.display = 'block'; 42846 } 42847 function hideNoResults() { 42848 const noResults = filterBar.parentElement.querySelector('.no-results'); 42849 if (noResults) noResults.style.display = 'none'; 42850 } 42851 function resetAllFilters() { 42852 // Clear active filters 42853 activeFilters = {}; 42854 // Reset all selects 42855 const selects = filterBar.querySelectorAll('select'); 42856 selects.forEach((select)=>{ 42857 select.value = ''; 42858 }); 42859 // Show all cards 42860 showAllCards(); 42861 // Update filter tags 42862 updateFilterTags(); 42863 } 42864 function showAllCards() { 42865 cards.forEach((card)=>{ 42866 card.style.display = 'block'; 42867 card.style.opacity = '1'; 42868 }); 42869 hideNoResults(); 42870 } 42871 // Initialize reset button 42872 const resetButtons = filterBar.querySelectorAll('.js-filter-reset'); 42873 resetButtons.forEach((resetButton)=>{ 42874 resetButton.addEventListener('click', ()=>resetAllFilters()); 42875 }); 42876}); 42877 42878},{}],"eLvLI":[function(require,module,exports,__globalThis) { 42879/** 42880 * What's On Filters 42881 * Handles filtering of what's on event cards based on multiple criteria 42882 */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 42883var _flatpickr = require("flatpickr"); 42884var _flatpickrDefault = parcelHelpers.interopDefault(_flatpickr); 42885var _flatpickrCss = require("flatpickr/dist/flatpickr.css"); 42886const whatsOnFilterModules = document.querySelectorAll('.m__wlist__filter-bar');
42887if (whatsOnFilterModules) whatsOnFilterModules.forEach((filterBar)=>{ 42888 const cards = document.querySelectorAll('.m__wlist__card'); 42889 const resetButton = filterBar.querySelector('.js-filter-reset'); 42890 let activeFilters = {}; 42891 // Initialize filter selects 42892 const selects = filterBar.querySelectorAll('select'); 42893 selects.forEach((select)=>{ 42894 select.addEventListener('change', (e)=>{ 42895 const filterName = e.target.name; 42896 const filterValue = e.target.value; 42897 if (filterValue) { 42898 // Check if this value is already selected before adding 42899 const isDuplicate = activeFilters[filterName] && activeFilters[filterName].some((filter)=>filter.value === filterValue); 42900 if (!isDuplicate) addFilter(filterName, filterValue, e.target.options[e.target.selectedIndex].text); 42901 // Reset select to allow multiple selections 42902 e.target.value = ''; 42903 } 42904 applyFilters(); 42905 }); 42906 }); 42907 // Initialize date range picker 42908 const dateInput = filterBar.querySelector('#date-range-filter'); 42909 if (dateInput) { 42910 const datePicker = (0, _flatpickrDefault.default)(dateInput, { 42911 mode: 'range', 42912 dateFormat: 'd/m/Y', 42913 placeholder: 'Select Date Range', 42914 allowInput: false, 42915 clickOpens: true, 42916 onChange: function(selectedDates, dateStr, instance) { 42917 if (selectedDates.length === 2) { 42918 // Clear any existing date filter 42919 if (activeFilters['date-filter']) delete activeFilters['date-filter']; 42920 // Add new date range filter 42921 const startDate = selectedDates[0]; 42922 const endDate = selectedDates[1]; 42923 const filterLabel = `${startDate.toLocaleDateString('en-GB')} - ${endDate.toLocaleDateString('en-GB')}`; 42924 console.log(`${startDate.getTime()}_${endDate.getTime()}`); 42925 addFilter('date-filter', `${startDate.getTime()}_${endDate.getTime()}`, filterLabel); 42926 applyFilters(); 42927 } 42928 }, 42929 onClear: function() { 42930 // Remove date filter when cleared 42931 if (activeFilters['date-filter']) { 42932 delete activeFilters['date-filter']; 42933 updateFilterTags(); 42934 applyFilters(); 42935 } 42936 } 42937 }); 42938 } 42939 function addFilter(filterName, filterValue, filterLabel) { 42940 // Initialize array for this filter type if it doesn't exist 42941 if (!activeFilters[filterName]) activeFilters[filterName] = []; 42942 // Check if this value is already selected 42943 const existingFilter = activeFilters[filterName].find((filter)=>filter.value === filterValue); 42944 if (!existingFilter) activeFilters[filterName].push({ 42945 value: filterValue, 42946 label: filterLabel 42947 }); 42948 updateFilterTags(); 42949 } 42950 function removeFilter(filterName, filterValue) { 42951 if (activeFilters[filterName]) { 42952 activeFilters[filterName] = activeFilters[filterName].filter((filter)=>filter.value !== filterValue); 42953 // Remove the filter type entirely if no values remain 42954 if (activeFilters[filterName].length === 0) { 42955 delete activeFilters[filterName]; 42956 // Clear datepicker if date filter is removed 42957 if (filterName === 'date-filter') { 42958 const dateInput = filterBar.querySelector('#date-range-filter'); 42959 if (dateInput && dateInput._flatpickr) dateInput._flatpickr.clear(); 42960 } 42961 } 42962 } 42963 updateFilterTags(); 42964 } 42965 function updateFilterTags() { 42966 // Remove existing filter tags within this module only 42967 const existingTags = filterBar.parentElement.querySelectorAll('.filter-tag'); 42968 existingTags.forEach((tag)=>tag.remove()); 42969 // Create filter tags container if it doesn't exist 42970 let tagsContainer = filterBar.parentElement.querySelector('.filter-tags-container'); 42971 if (!tagsContainer) { 42972 tagsContainer = document.createElement('div'); 42973 tagsContainer.className = 'filter-tags-container flex flex-wrap gap-2 mt-4 w-full'; 42974 // Insert after the filter bar 42975 filterBar.parentNode.insertBefore(tagsContainer, filterBar.nextSibling); 42976 } 42977 // Add new filter tags
42978 Object.keys(activeFilters).forEach((filterName)=>{ 42979 activeFilters[filterName].forEach((filter)=>{ 42980 const tag = createFilterTag(filterName, filter.value, filter.label); 42981 tagsContainer.appendChild(tag); 42982 }); 42983 }); 42984 } 42985 function createFilterTag(filterName, filterValue, filterLabel) { 42986 const tag = document.createElement('div'); 42987 tag.className = 'filter-tag bg-[#FDF9F4] px-3 py-2 rounded-[4px] text-sm flex items-center gap-2 cursor-pointer hover:bg-gray-100 transition-colors border border-[#999]'; 42988 tag.innerHTML = ` 42989 <span class="f__paragraph-regular !text-black !text-[15px] !leading-normal">${filterLabel}</span> 42990 <button class="remove-filter pt-[4px]" data-filter="${filterName}" data-value="${filterValue}"> 42991 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> 42992 <line x1="18" y1="6" x2="6" y2="18"></line> 42993 <line x1="6" y1="6" x2="18" y2="18"></line> 42994 </svg> 42995 </button> 42996 `; 42997 // Add click handler to remove filter 42998 const removeBtn = tag.querySelector('.remove-filter'); 42999 removeBtn.addEventListener('click', (e)=>{ 43000 e.stopPropagation(); 43001 removeFilter(filterName, filterValue); 43002 applyFilters(); 43003 }); 43004 return tag; 43005 } 43006 function applyFilters() { 43007 cards.forEach((card)=>{ 43008 let shouldShow = true; 43009 // Check each active filter type 43010 Object.keys(activeFilters).forEach((filterName)=>{ 43011 if (filterName === 'date-filter') { 43012 // Handle date filtering 43013 const dateFilter = activeFilters[filterName][0]; // Should only be one date filter 43014 if (dateFilter) { 43015 const [startTime, endTime] = dateFilter.value.split('_').map(Number); 43016 const eventDates = getAllEventDatesFromCard(card); 43017 if (eventDates.length > 0) { 43018 // Check if ANY of the event dates fall within the selected range 43019 const hasDateInRange = eventDates.some((eventDate)=>{ 43020 const eventTime = eventDate.getTime(); 43021 return eventTime >= startTime && eventTime <= endTime; 43022 }); 43023 if (!hasDateInRange) shouldShow = false; 43024 } else // If no dates found, hide the card 43025 shouldShow = false; 43026 } 43027 } else { 43028 // Handle other filters (location, category) 43029 const filterValues = activeFilters[filterName].map((filter)=>filter.value); 43030 const cardValues = getCardFilterValues(card, filterName); 43031 // Card should show if it matches ANY of the selected values for this filter type 43032 // AND if the card has any of the selected filter values 43033 if (cardValues.length > 0 && !filterValues.some((filterValue)=>cardValues.includes(filterValue))) shouldShow = false; 43034 } 43035 }); 43036 // Show/hide card using CSS 43037 if (shouldShow) { 43038 card.style.display = 'block'; 43039 card.style.opacity = '1'; 43040 } else { 43041 card.style.display = 'none'; 43042 card.style.opacity = '0'; 43043 } 43044 }); 43045 // Update card count or show "no results" message 43046 updateResultsCount(); 43047 } 43048 function getCardFilterValues(card, filterName) { 43049 // Handle date filtering separately 43050 if (filterName === 'date-filter') return [ 43051 'date' 43052 ]; // Return a placeholder to indicate this card should be checked for dates 43053 // Map filter names to data attributes 43054 // This will dynamically work with any taxonomy-based filter 43055 const filterNameParts = filterName.split('-'); 43056 const taxonomyName = filterNameParts.slice(0, -1).join('-'); // Remove 'filter' suffix 43057 const dataAttr = `data-${taxonomyName}`; 43058 const cardValue = card.getAttribute(dataAttr); 43059 // If the card has a value, split it by spaces to handle multiple values 43060 if (cardValue) return cardValue.split(' ').filter((value)=>value.trim() !== ''); 43061 return []; 43062 } 43063 function getEventDateFromCard(card) { 43064 // Look for the event date in the card content 43065 const dateElement = card.querySelector('.m__wlist__card-subtitle--date'); 43066 if (dateElement) { 43067 const dateText = dateElement.textContent.trim(); 43068 // Parse the date text (format: "15/08/2025" or similar) 43069 const dateMatch = dateText.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/); 43070 if (dateMatch) { 43071 const [, day, month, year] = dateMatch; 43072 return new Date(parseInt(year), parseInt(month) - 1, parseInt(day)); 43073 } 43074 } 43075 return null; 43076 } 43077 function getAllEventDatesFromCard(card) { 43078 const dates = []; 43079 // Check if we have individual dates from grouped events 43080 const individualDatesAttr = card.getAttribute('data-individual-dates'); 43081 if (individualDatesAttr) { 43082 const individualDates = individualDatesAttr.split('|');
43083 individualDates.forEach((dateStr)=>{ 43084 const dateMatch = dateStr.match(/(\d{1,2})\/(\d{1,2})\/(\d{4})/); 43085 if (dateMatch) { 43086 const [, day, month, year] = dateMatch; 43087 dates.push(new Date(parseInt(year), parseInt(month) - 1, parseInt(day))); 43088 } 43089 }); 43090 } else { 43091 // Fallback to single date from display 43092 const singleDate = getEventDateFromCard(card); 43093 if (singleDate) dates.push(singleDate); 43094 } 43095 return dates; 43096 } 43097 function updateResultsCount() { 43098 const visibleCards = Array.from(cards).filter((card)=>card.style.display !== 'none'); 43099 // You can add logic here to show count or "no results" message 43100 if (visibleCards.length === 0) showNoResults(); 43101 else hideNoResults(); 43102 } 43103 function showNoResults() { 43104 let noResults = filterBar.parentElement.querySelector('.no-results'); 43105 if (!noResults) { 43106 noResults = document.createElement('div'); 43107 noResults.className = 'no-results text-center py-8 text-gray-500'; 43108 noResults.innerHTML = '<p>No events match your selected filters.</p>'; 43109 filterBar.parentElement.appendChild(noResults); 43110 } 43111 noResults.style.display = 'block'; 43112 } 43113 function hideNoResults() { 43114 const noResults = filterBar.parentElement.querySelector('.no-results'); 43115 if (noResults) noResults.style.display = 'none'; 43116 } 43117 function resetAllFilters() { 43118 // Clear active filters 43119 activeFilters = {}; 43120 // Reset all selects 43121 const selects = filterBar.querySelectorAll('select'); 43122 selects.forEach((select)=>{ 43123 select.value = ''; 43124 }); 43125 // Reset date picker 43126 const dateInput = filterBar.querySelector('#date-range-filter'); 43127 if (dateInput && dateInput._flatpickr) dateInput._flatpickr.clear(); 43128 // Show all cards 43129 showAllCards(); 43130 // Update filter tags 43131 updateFilterTags(); 43132 } 43133 function showAllCards() { 43134 cards.forEach((card)=>{ 43135 card.style.display = 'block'; 43136 card.style.opacity = '1'; 43137 }); 43138 hideNoResults(); 43139 } 43140 // Initialize reset button 43141 if (resetButton) resetButton.addEventListener('click', ()=>resetAllFilters()); 43142}); 43143 43144},{"flatpickr":"kJbte","flatpickr/dist/flatpickr.css":"1B36y","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"1B36y":[function() {},{}],"gMcjh":[function(require,module,exports,__globalThis) { 43145/** 43146 * Menu List Filters 43147 * Handles filtering of menu cards based on multiple criteria 43148 */ const menuFilterModules = document.querySelectorAll('.m__mlist__filter-bar'); 43149if (menuFilterModules) menuFilterModules.forEach((filterBar)=>{ 43150 const cards = document.querySelectorAll('.m__mlist__card'); 43151 const resetButton = document.querySelector('.js-filter-reset'); 43152 let activeFilters = {}; 43153 // Initialize filter selects 43154 const selects = filterBar.querySelectorAll('select'); 43155 selects.forEach((select)=>{ 43156 select.addEventListener('change', (e)=>{ 43157 const filterName = e.target.name; 43158 const filterValue = e.target.value; 43159 if (filterValue) { 43160 // Check if this value is already selected before adding 43161 const isDuplicate = activeFilters[filterName] && activeFilters[filterName].some((filter)=>filter.value === filterValue); 43162 if (!isDuplicate) addFilter(filterName, filterValue, e.target.options[e.target.selectedIndex].text); 43163 // Reset select to allow multiple selections 43164 e.target.value = ''; 43165 } 43166 applyFilters(); 43167 }); 43168 }); 43169 function addFilter(filterName, filterValue, filterLabel) { 43170 // Initialize array for this filter type if it doesn't exist 43171 if (!activeFilters[filterName]) activeFilters[filterName] = []; 43172 // Check if this value is already selected 43173 const existingFilter = activeFilters[filterName].find((filter)=>filter.value === filterValue); 43174 if (!existingFilter) activeFilters[filterName].push({ 43175 value: filterValue, 43176 label: filterLabel 43177 }); 43178 updateFilterTags(); 43179 } 43180 function removeFilter(filterName, filterValue) { 43181 if (activeFilters[filterName]) { 43182 activeFilters[filterName] = activeFilters[filterName].filter((filter)=>filter.value !== filterValue); 43183 // Remove the filter type entirely if no values remain 43184 if (activeFilters[filterName].length === 0) delete activeFilters[filterName]; 43185 } 43186 updateFilterTags(); 43187 } 43188 function updateFilterTags() { 43189 // Remove existing filter tags within this module only 43190 const existingTags = filterBar.parentElement.querySelectorAll('.filter-tag');
43191 existingTags.forEach((tag)=>tag.remove()); 43192 // Create filter tags container if it doesn't exist 43193 let tagsContainer = filterBar.parentElement.querySelector('.filter-tags-container'); 43194 if (!tagsContainer) { 43195 tagsContainer = document.createElement('div'); 43196 tagsContainer.className = 'filter-tags-container flex flex-wrap gap-2 mt-4 w-full'; 43197 // Insert after the filter bar 43198 filterBar.parentNode.insertBefore(tagsContainer, filterBar.nextSibling); 43199 } 43200 // Add new filter tags 43201 Object.keys(activeFilters).forEach((filterName)=>{ 43202 activeFilters[filterName].forEach((filter)=>{ 43203 const tag = createFilterTag(filterName, filter.value, filter.label); 43204 tagsContainer.appendChild(tag); 43205 }); 43206 }); 43207 } 43208 function createFilterTag(filterName, filterValue, filterLabel) { 43209 const tag = document.createElement('div'); 43210 tag.className = 'filter-tag bg-[#FDF9F4] px-3 py-2 rounded-[4px] text-sm flex items-center gap-2 cursor-pointer hover:bg-gray-100 transition-colors border border-[#999]'; 43211 tag.innerHTML = ` 43212 <span class="f__paragraph-regular text-black !text-[15px] !leading-normal">${filterLabel}</span> 43213 <button class="remove-filter pt-[4px]" data-filter="${filterName}" data-value="${filterValue}"> 43214 <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> 43215 <line x1="18" y1="6" x2="6" y2="18"></line> 43216 <line x1="6" y1="6" x2="18" y2="18"></line> 43217 </svg> 43218 </button> 43219 `; 43220 // Add click handler to remove filter 43221 const removeBtn = tag.querySelector('.remove-filter'); 43222 removeBtn.addEventListener('click', (e)=>{ 43223 e.stopPropagation(); 43224 removeFilter(filterName, filterValue); 43225 applyFilters(); 43226 }); 43227 return tag; 43228 } 43229 function applyFilters() { 43230 cards.forEach((card)=>{ 43231 let shouldShow = true; 43232 // Check each active filter type 43233 Object.keys(activeFilters).forEach((filterName)=>{ 43234 const filterValues = activeFilters[filterName].map((filter)=>filter.value); 43235 const cardValues = getCardFilterValues(card, filterName); 43236 // Card should show if it matches ANY of the selected values for this filter type 43237 // Check if any of the card's values match any of the selected filter values 43238 if (cardValues && cardValues.length > 0) { 43239 const hasMatch = cardValues.some((cardValue)=>filterValues.includes(cardValue)); 43240 if (!hasMatch) shouldShow = false; 43241 } else // If card has no values for this filter type, hide it 43242 shouldShow = false; 43243 }); 43244 // Show/hide card using CSS 43245 if (shouldShow) { 43246 card.style.display = 'block'; 43247 card.style.opacity = '1'; 43248 } else { 43249 card.style.display = 'none'; 43250 card.style.opacity = '0'; 43251 } 43252 }); 43253 // Update card count or show "no results" message 43254 updateResultsCount(); 43255 } 43256 function getCardFilterValues(card, filterName) { 43257 // Map filter names to data attributes based on taxonomy names 43258 // The filter names are in format: taxonomy-name-filter 43259 // The data attributes are in format: data-taxonomy-name 43260 const dataAttr = 'data-' + filterName.replace('-filter', ''); 43261 const value = card.getAttribute(dataAttr); 43262 if (value) // Split space-separated values into array and trim whitespace 43263 return value.split(' ').map((v)=>v.trim()).filter((v)=>v.length > 0); 43264 return []; 43265 } 43266 function updateResultsCount() { 43267 const visibleCards = Array.from(cards).filter((card)=>card.style.display !== 'none'); 43268 // You can add logic here to show count or "no results" message 43269 if (visibleCards.length === 0) showNoResults(); 43270 else hideNoResults(); 43271 } 43272 function showNoResults() { 43273 let noResults = filterBar.parentElement.querySelector('.no-results'); 43274 if (!noResults) { 43275 noResults = document.createElement('div'); 43276 noResults.className = 'no-results text-center py-8 text-gray-500'; 43277 noResults.innerHTML = '<p>No menu items match your selected filters.</p>'; 43278 filterBar.parentElement.appendChild(noResults); 43279 } 43280 noResults.style.display = 'block'; 43281 } 43282 function hideNoResults() { 43283 const noResults = filterBar.parentElement.querySelector('.no-results'); 43284 if (noResults) noResults.style.display = 'none'; 43285 } 43286 function resetAllFilters() { 43287 // Clear active filters 43288 activeFilters = {}; 43289 // Reset all selects 43290 const selects = filterBar.querySelectorAll('select');
43291 selects.forEach((select)=>{ 43292 select.value = ''; 43293 }); 43294 // Show all cards 43295 showAllCards(); 43296 // Update filter tags 43297 updateFilterTags(); 43298 } 43299 function showAllCards() { 43300 cards.forEach((card)=>{ 43301 card.style.display = 'block'; 43302 card.style.opacity = '1'; 43303 }); 43304 hideNoResults(); 43305 } 43306 // Initialize reset button 43307 if (resetButton) resetButton.addEventListener('click', ()=>resetAllFilters()); 43308}); 43309 43310},{}],"fCeLb":[function(require,module,exports,__globalThis) { 43311var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 43312var _swiperBundle = require("swiper/swiper-bundle"); 43313var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 43314var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 43315var _gsap = require("gsap"); 43316var _gsapDefault = parcelHelpers.interopDefault(_gsap); 43317const whatsOnCarouselModules = document.querySelectorAll('.m__whatson-carousel'); 43318whatsOnCarouselModules.forEach((whatsOnCarouselModule)=>{ 43319 //Loop through each card slider and initialise swiper and buttons 43320 const whatsOnCarouselSwiper = whatsOnCarouselModule.querySelector('.swiper'); 43321 const scrollingLine = whatsOnCarouselModule.querySelector('.m__whatson-carousel__scrolling-line-inner'); 43322 const whatsOnCarouselNextArrow = whatsOnCarouselModule.querySelector('.js-whatson-carousel__swiper-next'); 43323 const whatsOnCarouselPrevArrow = whatsOnCarouselModule.querySelector('.js-whatson-carousel__swiper-prev'); 43324 const swiper = new (0, _swiperBundleDefault.default)(whatsOnCarouselSwiper, { 43325 autoHeight: true, 43326 slidesPerView: 1.15, 43327 slidesPerGroup: 1, 43328 spaceBetween: 30, 43329 centeredSlides: false, 43330 loop: false, 43331 shortSwipes: true, 43332 keyboard: { 43333 enabled: true, 43334 onlyInViewport: true 43335 }, 43336 breakpoints: { 43337 1800: { 43338 slidesPerView: 3.2, 43339 spaceBetween: 30 43340 }, 43341 1200: { 43342 slidesPerView: 2.2, 43343 spaceBetween: 30 43344 }, 43345 992: { 43346 slidesPerView: 1.8, 43347 spaceBetween: 30 43348 }, 43349 768: { 43350 slidesPerView: 1.6, 43351 spaceBetween: 30 43352 } 43353 } 43354 }); 43355 // Update scrolling line based on swiper progress 43356 if (scrollingLine) { 43357 swiper.on('progress', function(progress) { 43358 const slidesPerView = swiper.params.slidesPerView; 43359 const totalSlides = swiper.slides.length; 43360 const viewPerTotal = slidesPerView / totalSlides; 43361 const viewProgress = progress.progress; 43362 const currentProgress = viewPerTotal + (1 - viewPerTotal) * viewProgress; 43363 scrollingLine.style.width = currentProgress * 100 + '%'; 43364 }); 43365 swiper.on('setTransition', function(duration) { 43366 scrollingLine.style.transition = duration + 'ms'; 43367 }); 43368 } 43369 //Move to next slide if 'next' arrow clicked 43370 if (whatsOnCarouselNextArrow) whatsOnCarouselNextArrow.addEventListener('click', (event)=>{ 43371 swiper.slideNext(); 43372 }); 43373 if (whatsOnCarouselPrevArrow) whatsOnCarouselPrevArrow.addEventListener('click', (event)=>{ 43374 swiper.slidePrev(); 43375 }); 43376 // Equalize heights of elements within a parent element 43377 function equalizeHeights(parentElement, selector) { 43378 const elements = parentElement.querySelectorAll(selector); 43379 // Reset heights 43380 elements.forEach((el)=>{ 43381 el.style.height = 'auto'; 43382 }); 43383 // Find and apply max height 43384 const heights = Array.from(elements).map((el)=>el.offsetHeight); 43385 const maxHeight = Math.max(...heights); 43386 elements.forEach((el)=>{ 43387 el.style.height = maxHeight + 'px'; 43388 }); 43389 } 43390 // Equalize heights of card title and excerpt 43391 function equalizeCardHeights(parentNode) { 43392 equalizeHeights(parentNode, '.m__whatson-carousel__card-title'); 43393 equalizeHeights(parentNode, '.m__whatson-carousel__card-excerpt'); 43394 } 43395 // Staggered animation for first three cards 43396 const carouselCards = whatsOnCarouselModule.querySelectorAll('.m__whatson-carousel__card'); 43397 if (carouselCards.length >= 3) { 43398 const firstItem = carouselCards[0]; 43399 const secondItem = carouselCards[1]; 43400 const thirdItem = carouselCards[2]; 43401 // Initial positions: first 200px down, second 300px down, third 400px down 43402 const initialPositions = { 43403 first: 200, 43404 second: 300, 43405 third: 400 43406 }; 43407 // Set initial positions 43408 (0, _gsapDefault.default).set(firstItem, { 43409 y: initialPositions.first 43410 }); 43411 (0, _gsapDefault.default).set(secondItem, { 43412 y: initialPositions.second 43413 }); 43414 (0, _gsapDefault.default).set(thirdItem, { 43415 y: initialPositions.third 43416 }); 43417 let hasAnimated = false;
43418 // Use IntersectionObserver to detect when module comes into view 43419 const observer = new IntersectionObserver((entries)=>{ 43420 entries.forEach((entry)=>{ 43421 // Check if module is in view and hasn't been animated yet 43422 if (entry.isIntersecting && !hasAnimated) { 43423 hasAnimated = true; 43424 // Animate all three items up to their final position (y: 0) 43425 (0, _gsapDefault.default).to([ 43426 firstItem, 43427 secondItem, 43428 thirdItem 43429 ], { 43430 y: 0, 43431 duration: 1.2, 43432 ease: 'power3.out', 43433 stagger: 0.2 // Stagger the animations by 0.2s 43434 }); 43435 // Stop observing once animation has triggered 43436 observer.unobserve(whatsOnCarouselModule); 43437 } 43438 }); 43439 }, { 43440 threshold: 0.5, 43441 rootMargin: '0px' 43442 }); 43443 observer.observe(whatsOnCarouselModule); 43444 } 43445}); 43446 43447},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","gsap":"33IqQ","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"2mgEt":[function(require,module,exports,__globalThis) { 43448var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 43449var _swiperBundle = require("swiper/swiper-bundle"); 43450var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 43451var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 43452var _gsap = require("gsap"); 43453var _gsapDefault = parcelHelpers.interopDefault(_gsap); 43454const eventSpacesCarouselModules = document.querySelectorAll('.m__event-spaces-carousel'); 43455eventSpacesCarouselModules.forEach((eventSpacesCarouselModule)=>{ 43456 //Loop through each card slider and initialise swiper and buttons 43457 const eventSpacesCarouselSwiper = eventSpacesCarouselModule.querySelector('.swiper'); 43458 const scrollingLine = eventSpacesCarouselModule.querySelector('.m__event-spaces-carousel__scrolling-line-inner'); 43459 const eventSpacesCarouselNextArrow = eventSpacesCarouselModule.querySelector('.js-event-spaces-carousel__swiper-next'); 43460 const eventSpacesCarouselPrevArrow = eventSpacesCarouselModule.querySelector('.js-event-spaces-carousel__swiper-prev'); 43461 const swiper = new (0, _swiperBundleDefault.default)(eventSpacesCarouselSwiper, { 43462 autoHeight: true, 43463 slidesPerView: 1.15, 43464 slidesPerGroup: 1, 43465 spaceBetween: 30, 43466 centeredSlides: false, 43467 loop: false, 43468 shortSwipes: false, 43469 keyboard: { 43470 enabled: true, 43471 onlyInViewport: true 43472 }, 43473 breakpoints: { 43474 1800: { 43475 slidesPerView: 3.2, 43476 spaceBetween: 30 43477 }, 43478 1200: { 43479 slidesPerView: 2.2, 43480 spaceBetween: 30 43481 }, 43482 992: { 43483 slidesPerView: 1.8, 43484 spaceBetween: 30 43485 }, 43486 768: { 43487 slidesPerView: 1.6, 43488 spaceBetween: 30 43489 } 43490 } 43491 }); 43492 // Update scrolling line based on swiper progress 43493 if (scrollingLine) { 43494 swiper.on('progress', function(progress) { 43495 const slidesPerView = swiper.params.slidesPerView; 43496 const totalSlides = swiper.slides.length; 43497 const viewPerTotal = slidesPerView / totalSlides; 43498 const viewProgress = progress.progress; 43499 const currentProgress = viewPerTotal + (1 - viewPerTotal) * viewProgress; 43500 scrollingLine.style.width = currentProgress * 100 + '%'; 43501 }); 43502 swiper.on('setTransition', function(duration) { 43503 scrollingLine.style.transition = duration + 'ms'; 43504 }); 43505 } 43506 //Move to next slide if 'next' arrow clicked 43507 if (eventSpacesCarouselNextArrow) eventSpacesCarouselNextArrow.addEventListener('click', (event)=>{ 43508 swiper.slideNext(); 43509 }); 43510 if (eventSpacesCarouselPrevArrow) eventSpacesCarouselPrevArrow.addEventListener('click', (event)=>{ 43511 swiper.slidePrev(); 43512 }); 43513 // Equalize heights of elements within a parent element 43514 function equalizeHeights(parentElement, selector) { 43515 const elements = parentElement.querySelectorAll(selector); 43516 // Reset heights
43517 elements.forEach((el)=>{ 43518 el.style.height = 'auto'; 43519 }); 43520 // Find and apply max height 43521 const heights = Array.from(elements).map((el)=>el.offsetHeight); 43522 const maxHeight = Math.max(...heights); 43523 elements.forEach((el)=>{ 43524 el.style.height = maxHeight + 'px'; 43525 }); 43526 } 43527 // Equalize heights of card title and excerpt 43528 function equalizeCardHeights(parentNode) { 43529 equalizeHeights(parentNode, '.m__event-spaces-carousel__card-title'); 43530 equalizeHeights(parentNode, '.m__event-spaces-carousel__card-excerpt'); 43531 } 43532 // Staggered animation for first three cards 43533 const carouselCards = eventSpacesCarouselModule.querySelectorAll('.m__event-spaces-carousel__card'); 43534 if (carouselCards.length >= 3) { 43535 const firstItem = carouselCards[0]; 43536 const secondItem = carouselCards[1]; 43537 const thirdItem = carouselCards[2]; 43538 // Initial positions: first 200px down, second 300px down, third 400px down 43539 const initialPositions = { 43540 first: 200, 43541 second: 300, 43542 third: 400 43543 }; 43544 // Set initial positions 43545 (0, _gsapDefault.default).set(firstItem, { 43546 y: initialPositions.first 43547 }); 43548 (0, _gsapDefault.default).set(secondItem, { 43549 y: initialPositions.second 43550 }); 43551 (0, _gsapDefault.default).set(thirdItem, { 43552 y: initialPositions.third 43553 }); 43554 let hasAnimated = false; 43555 // Use IntersectionObserver to detect when module comes into view 43556 const observer = new IntersectionObserver((entries)=>{ 43557 entries.forEach((entry)=>{ 43558 // Check if module is in view and hasn't been animated yet 43559 if (entry.isIntersecting && !hasAnimated) { 43560 hasAnimated = true; 43561 // Animate all three items up to their final position (y: 0) 43562 (0, _gsapDefault.default).to([ 43563 firstItem, 43564 secondItem, 43565 thirdItem 43566 ], { 43567 y: 0, 43568 duration: 1.2, 43569 ease: 'power3.out', 43570 stagger: 0.2 // Stagger the animations by 0.2s 43571 }); 43572 // Stop observing once animation has triggered 43573 observer.unobserve(eventSpacesCarouselModule); 43574 } 43575 }); 43576 }, { 43577 threshold: 0.5, 43578 rootMargin: '0px' 43579 }); 43580 observer.observe(eventSpacesCarouselModule); 43581 } 43582}); 43583 43584},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","gsap":"33IqQ","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"bxpuE":[function(require,module,exports,__globalThis) { 43585var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 43586var _gsap = require("gsap"); 43587var _gsapDefault = parcelHelpers.interopDefault(_gsap); 43588var _scrollTrigger = require("gsap/ScrollTrigger"); 43589(0, _gsapDefault.default).registerPlugin((0, _scrollTrigger.ScrollTrigger)); 43590const MODULE_SEL = '[data-module="featureImageWithSupportingImage"]'; 43591const SUPPORTING_SEL = '.js-supporting-image'; 43592const INITIAL_SEL = '.m__fisi__media__item__initial'; 43593const FADE_SEL = '.m__fisi__media__item__fade'; 43594const DELTA = 100; 43595const BP_LG = '(min-width: 1024px)'; 43596function getHeaderOffset() { 43597 const header = document.querySelector('.header'); 43598 return header ? header.offsetHeight : 0; 43599} 43600/** 43601 * Height used for scroll slack â excludes section padding (`py-*`) so travel matches content only. 43602 */ function getModuleContentHeight(section) { 43603 const mediaWrap = section.querySelector('.m__fisi__media'); 43604 if (mediaWrap) return mediaWrap.offsetHeight; 43605 const cs = getComputedStyle(section); 43606 const pt = parseFloat(cs.paddingTop) || 0; 43607 const pb = parseFloat(cs.paddingBottom) || 0; 43608 const bt = parseFloat(cs.borderTopWidth) || 0; 43609 const bb = parseFloat(cs.borderBottomWidth) || 0; 43610 return section.offsetHeight - pt - pb - bt - bb; 43611} 43612/** 43613 * Mirrors the reference site: scroll distance from layout slack, Y travel adds DELTA. 43614 */ function computeScrollDistance(section, supportingEl) { 43615 const slack = getModuleContentHeight(section) - supportingEl.offsetHeight; 43616 return Math.max(1, slack - DELTA); 43617} 43618function refreshAfterImages(section) { 43619 const imgs = section.querySelectorAll(`${SUPPORTING_SEL} img`); 43620 const pending = [ 43621 ...imgs 43622 ].filter((img)=>!img.complete).map((img)=>new Promise((resolve)=>{ 43623 img.addEventListener('load', resolve, { 43624 once: true 43625 }); 43626 img.addEventListener('error', resolve, { 43627 once: true 43628 }); 43629 })); 43630 return pending.length ? Promise.all(pending).then(()=>(0, _scrollTrigger.ScrollTrigger).refresh()) : Promise.resolve(); 43631} 43632let bodyResizeObserver; 43633function scheduleScrollTriggerRefresh(reason) { 43634 requestAnimationFrame(()=>{ 43635 requestAnimationFrame(()=>{ 43636 (0, _scrollTrigger.ScrollTrigger).refresh(); 43637 console.log('[featureImage] ScrollTrigger.refresh()', reason, "\u2014 scrollY", Math.round(window.scrollY)); 43638 }); 43639 }); 43640} 43641function attachBodyResizeRefresh() { 43642 if (typeof ResizeObserver === 'undefined' || !document.body) return; 43643 let timer; 43644 bodyResizeObserver = new ResizeObserver(()=>{ 43645 clearTimeout(timer); 43646 timer = setTimeout(()=>scheduleScrollTriggerRefresh('ResizeObserver(body)'), 200); 43647 }); 43648 bodyResizeObserver.observe(document.body); 43649} 43650function initFeatureImageWithSupportingImage() { 43651 const sections = document.querySelectorAll(MODULE_SEL); 43652 if (!sections.length) return; 43653 const mm = (0, _gsapDefault.default).matchMedia(); 43654 mm.add(BP_LG, ()=>{ 43655 const headerPx = getHeaderOffset(); 43656 sections.forEach((section, moduleIndex)=>{ 43657 const supportingWrap = section.querySelector(SUPPORTING_SEL); 43658 const initialMedia = section.querySelector(INITIAL_SEL); 43659 const fadeMedia = section.querySelector(FADE_SEL); 43660 if (!supportingWrap || !initialMedia || !fadeMedia) return; 43661 (0, _gsapDefault.default).set(fadeMedia, { 43662 opacity: 0 43663 }); 43664 (0, _gsapDefault.default).set(initialMedia, { 43665 opacity: 1 43666 }); 43667 const scrollDistance = computeScrollDistance(section, supportingWrap); 43668 const yTarget = scrollDistance + DELTA; 43669 const rect = section.getBoundingClientRect(); 43670 const docTop = rect.top + window.scrollY; 43671 console.log('[featureImage] module', moduleIndex, 'at init', { 43672 documentTopPx: Math.round(docTop), 43673 viewportTopPx: Math.round(rect.top), 43674 scrollY: Math.round(window.scrollY), 43675 headerStartPx: headerPx,
43676 scrollDistancePx: scrollDistance, 43677 yTargetPx: yTarget 43678 }); 43679 let lastScrollLog = 0; 43680 const tl = (0, _gsapDefault.default).timeline({ 43681 scrollTrigger: { 43682 trigger: section, 43683 start: `top ${headerPx}px`, 43684 end: `+=${scrollDistance}`, 43685 scrub: true, 43686 invalidateOnRefresh: true, 43687 onUpdate (self) { 43688 const now = Date.now(); 43689 if (now - lastScrollLog < 250) return; 43690 lastScrollLog = now; 43691 const r = section.getBoundingClientRect(); 43692 console.log('[featureImage] module', moduleIndex, 'while scrolling', { 43693 viewportTopPx: Math.round(r.top), 43694 documentTopPx: Math.round(r.top + window.scrollY), 43695 scrollY: Math.round(window.scrollY), 43696 stProgress: self.progress.toFixed(3) 43697 }); 43698 } 43699 } 43700 }); 43701 tl.to(supportingWrap, { 43702 y: yTarget, 43703 duration: 1, 43704 ease: 'none' 43705 }, 0).to(initialMedia, { 43706 opacity: 0, 43707 duration: 0.5, 43708 ease: 'none' 43709 }, '<+0.5').to(fadeMedia, { 43710 opacity: 1, 43711 duration: 0.5, 43712 ease: 'none' 43713 }, '<'); 43714 }); 43715 sections.forEach((section)=>{ 43716 refreshAfterImages(section); 43717 }); 43718 scheduleScrollTriggerRefresh('after creating triggers'); 43719 if (!bodyResizeObserver) attachBodyResizeRefresh(); 43720 }); 43721/* Below lg the supporting column is not shown â crossfade only on large screens. */ } 43722/** 43723 * Build ScrollTriggers after window load so positions match post-image layout (DOMContentLoaded is often ~1000px+ off). 43724 */ function bootFeatureImageWithSupportingImage() { 43725 function run() { 43726 initFeatureImageWithSupportingImage(); 43727 } 43728 if (document.readyState === 'complete') run(); 43729 else window.addEventListener('load', run, { 43730 once: true 43731 }); 43732} 43733bootFeatureImageWithSupportingImage(); 43734if (document.fonts?.ready) document.fonts.ready.then(()=>scheduleScrollTriggerRefresh('document.fonts.ready')); 43735 43736},{"gsap":"33IqQ","gsap/ScrollTrigger":"5ubnS","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"5ubnS":[function(require,module,exports,__globalThis) { 43737/*! 43738 * ScrollTrigger 3.13.0 43739 * https://gsap.com 43740 * 43741 * @license Copyright 2008-2025, GreenSock. All rights reserved. 43742 * Subject to the terms at https://gsap.com/standard-license 43743 * @author: Jack Doyle, [email protected] 43744*/ /* eslint-disable */ var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 43745parcelHelpers.defineInteropFlag(exports); 43746parcelHelpers.export(exports, "ScrollTrigger", ()=>ScrollTrigger); 43747parcelHelpers.export(exports, "default", ()=>ScrollTrigger); 43748var _observerJs = require("./Observer.js"); 43749var gsap, _coreInitted, _win, _doc, _docEl, _body, _root, _resizeDelay, _toArray, _clamp, _time2, _syncInterval, _refreshing, _pointerIsDown, _transformProp, _i, _prevWidth, _prevHeight, _autoRefresh, _sort, _suppressOverwrites, _ignoreResize, _normalizer, _ignoreMobileResize, _baseScreenHeight, _baseScreenWidth, _fixIOSBug, _context, _scrollRestoration, _div100vh, _100vh, _isReverted, _clampingMax, _limitCallbacks, // if true, we'll only trigger callbacks if the active state toggles, so if you scroll immediately past both the start and end positions of a ScrollTrigger (thus inactive to inactive), neither its onEnter nor onLeave will be called. This is useful during startup. 43750_startup = 1, _getTime = Date.now, _time1 = _getTime(), _lastScrollTime = 0, _enabled = 0, _parseClamp = function _parseClamp(value, type, self) { 43751 var clamp = _isString(value) && (value.substr(0, 6) === "clamp(" || value.indexOf("max") > -1); 43752 self["_" + type + "Clamp"] = clamp; 43753 return clamp ? value.substr(6, value.length - 7) : value; 43754}, _keepClamp = function _keepClamp(value, clamp) { 43755 return clamp && (!_isString(value) || value.substr(0, 6) !== "clamp(") ? "clamp(" + value + ")" : value; 43756}, _rafBugFix = function _rafBugFix() { 43757 return _enabled && requestAnimationFrame(_rafBugFix); 43758}, // in some browsers (like Firefox), screen repaints weren't consistent unless we had SOMETHING queued up in requestAnimationFrame()! So this just creates a super simple loop to keep it alive and smooth out repaints. 43759_pointerDownHandler = function _pointerDownHandler() { 43760 return _pointerIsDown = 1; 43761}, _pointerUpHandler = function _pointerUpHandler() { 43762 return _pointerIsDown = 0; 43763}, _passThrough = function _passThrough(v) { 43764 return v; 43765}, _round = function _round(value) { 43766 return Math.round(value * 100000) / 100000 || 0; 43767}, _windowExists = function _windowExists() { 43768 return typeof window !== "undefined"; 43769}, _getGSAP = function _getGSAP() { 43770 return gsap || _windowExists() && (gsap = window.gsap) && gsap.registerPlugin && gsap; 43771}, _isViewport = function _isViewport(e) { 43772 return !!~_root.indexOf(e); 43773}, _getViewportDimension = function _getViewportDimension(dimensionProperty) { 43774 return (dimensionProperty === "Height" ? _100vh : _win["inner" + dimensionProperty]) || _docEl["client" + dimensionProperty] || _body["client" + dimensionProperty]; 43775}, _getBoundsFunc = function _getBoundsFunc(element) { 43776 return (0, _observerJs._getProxyProp)(element, "getBoundingClientRect") || (_isViewport(element) ? function() { 43777 _winOffsets.width = _win.innerWidth; 43778 _winOffsets.height = _100vh; 43779 return _winOffsets; 43780 } : function() { 43781 return _getBounds(element); 43782 }); 43783}, _getSizeFunc = function _getSizeFunc(scroller, isViewport, _ref) { 43784 var d = _ref.d, d2 = _ref.d2, a = _ref.a; 43785 return (a = (0, _observerJs._getProxyProp)(scroller, "getBoundingClientRect")) ? function() { 43786 return a()[d]; 43787 } : function() { 43788 return (isViewport ? _getViewportDimension(d2) : scroller["client" + d2]) || 0; 43789 }; 43790}, _getOffsetsFunc = function _getOffsetsFunc(element, isViewport) { 43791 return !isViewport || ~(0, _observerJs._proxies).indexOf(element) ? _getBoundsFunc(element) : function() { 43792 return _winOffsets; 43793 }; 43794}, _maxScroll = function _maxScroll(element, _ref2) { 43795 var s = _ref2.s, d2 = _ref2.d2, d = _ref2.d, a = _ref2.a; 43796 return Math.max(0, (s = "scroll" + d2, a = (0, _observerJs._getProxyProp)(element, s)) ? a() - _getBoundsFunc(element)()[d] : _isViewport(element) ? (_docEl[s] || _body[s]) - _getViewportDimension(d2) : element[s] - element["offset" + d2]); 43797}, _iterateAutoRefresh = function _iterateAutoRefresh(func, events) { 43798 for(var i = 0; i < _autoRefresh.length;
vendor: 7,009 bytes, lines 43798-43929
43798 i += 3)(!events || ~events.indexOf(_autoRefresh[i + 1])) && func(_autoRefresh[i], _autoRefresh[i + 1], _autoRefresh[i + 2]); 43799}, _isString = function _isString(value) { 43800 return typeof value === "string"; 43801}, _isFunction = function _isFunction(value) { 43802 return typeof value === "function"; 43803}, _isNumber = function _isNumber(value) { 43804 return typeof value === "number"; 43805}, _isObject = function _isObject(value) { 43806 return typeof value === "object"; 43807}, _endAnimation = function _endAnimation(animation, reversed, pause) { 43808 return animation && animation.progress(reversed ? 0 : 1) && pause && animation.pause(); 43809}, _callback = function _callback(self, func) { 43810 if (self.enabled) { 43811 var result = self._ctx ? self._ctx.add(function() { 43812 return func(self); 43813 }) : func(self); 43814 result && result.totalTime && (self.callbackAnimation = result); 43815 } 43816}, _abs = Math.abs, _left = "left", _top = "top", _right = "right", _bottom = "bottom", _width = "width", _height = "height", _Right = "Right", _Left = "Left", _Top = "Top", _Bottom = "Bottom", _padding = "padding", _margin = "margin", _Width = "Width", _Height = "Height", _px = "px", _getComputedStyle = function _getComputedStyle(element) { 43817 return _win.getComputedStyle(element); 43818}, _makePositionable = function _makePositionable(element) { 43819 // if the element already has position: absolute or fixed, leave that, otherwise make it position: relative 43820 var position = _getComputedStyle(element).position; 43821 element.style.position = position === "absolute" || position === "fixed" ? position : "relative"; 43822}, _setDefaults = function _setDefaults(obj, defaults) { 43823 for(var p in defaults)p in obj || (obj[p] = defaults[p]); 43824 return obj; 43825}, _getBounds = function _getBounds(element, withoutTransforms) { 43826 var tween = withoutTransforms && _getComputedStyle(element)[_transformProp] !== "matrix(1, 0, 0, 1, 0, 0)" && gsap.to(element, { 43827 x: 0, 43828 y: 0, 43829 xPercent: 0, 43830 yPercent: 0, 43831 rotation: 0, 43832 rotationX: 0, 43833 rotationY: 0, 43834 scale: 1, 43835 skewX: 0, 43836 skewY: 0 43837 }).progress(1), bounds = element.getBoundingClientRect(); 43838 tween && tween.progress(0).kill(); 43839 return bounds; 43840}, _getSize = function _getSize(element, _ref3) { 43841 var d2 = _ref3.d2; 43842 return element["offset" + d2] || element["client" + d2] || 0; 43843}, _getLabelRatioArray = function _getLabelRatioArray(timeline) { 43844 var a = [], labels = timeline.labels, duration = timeline.duration(), p; 43845 for(p in labels)a.push(labels[p] / duration); 43846 return a; 43847}, _getClosestLabel = function _getClosestLabel(animation) { 43848 return function(value) { 43849 return gsap.utils.snap(_getLabelRatioArray(animation), value); 43850 }; 43851}, _snapDirectional = function _snapDirectional(snapIncrementOrArray) { 43852 var snap = gsap.utils.snap(snapIncrementOrArray), a = Array.isArray(snapIncrementOrArray) && snapIncrementOrArray.slice(0).sort(function(a, b) { 43853 return a - b; 43854 }); 43855 return a ? function(value, direction, threshold) { 43856 if (threshold === void 0) threshold = 1e-3; 43857 var i; 43858 if (!direction) return snap(value); 43859 if (direction > 0) { 43860 value -= threshold; // to avoid rounding errors. If we're too strict, it might snap forward, then immediately again, and again. 43861 for(i = 0; i < a.length; i++){ 43862 if (a[i] >= value) return a[i]; 43863 } 43864 return a[i - 1]; 43865 } else { 43866 i = a.length; 43867 value += threshold; 43868 while(i--){ 43869 if (a[i] <= value) return a[i]; 43870 } 43871 } 43872 return a[0]; 43873 } : function(value, direction, threshold) { 43874 if (threshold === void 0) threshold = 1e-3; 43875 var snapped = snap(value); 43876 return !direction || Math.abs(snapped - value) < threshold || snapped - value < 0 === direction < 0 ? snapped : snap(direction < 0 ? value - snapIncrementOrArray : value + snapIncrementOrArray); 43877 }; 43878}, _getLabelAtDirection = function _getLabelAtDirection(timeline) { 43879 return function(value, st) { 43880 return _snapDirectional(_getLabelRatioArray(timeline))(value, st.direction); 43881 }; 43882}, _multiListener = function _multiListener(func, element, types, callback) { 43883 return types.split(",").forEach(function(type) { 43884 return func(element, type, callback); 43885 }); 43886}, _addListener = function _addListener(element, type, func, nonPassive, capture) { 43887 return element.addEventListener(type, func, { 43888 passive: !nonPassive, 43889 capture: !!capture 43890 }); 43891}, _removeListener = function _removeListener(element, type, func, capture) { 43892 return element.removeEventListener(type, func, !!capture); 43893}, _wheelListener = function _wheelListener(func, el, scrollFunc) { 43894 scrollFunc = scrollFunc && scrollFunc.wheelHandler; 43895 if (scrollFunc) { 43896 func(el, "wheel", scrollFunc); 43897 func(el, "touchmove", scrollFunc); 43898 } 43899}, _markerDefaults = { 43900 startColor: "green", 43901 endColor: "red", 43902 indent: 0, 43903 fontSize: "16px", 43904 fontWeight: "normal" 43905}, _defaults = { 43906 toggleActions: "play", 43907 anticipatePin: 0 43908}, _keywords = { 43909 top: 0, 43910 left: 0, 43911 center: 0.5, 43912 bottom: 1, 43913 right: 1 43914}, _offsetToPx = function _offsetToPx(value, size) { 43915 if (_isString(value)) { 43916 var eqIndex = value.indexOf("="), relative = ~eqIndex ? +(value.charAt(eqIndex - 1) + 1) * parseFloat(value.substr(eqIndex + 1)) : 0; 43917 if (~eqIndex) { 43918 value.indexOf("%") > eqIndex && (relative *= size / 100); 43919 value = value.substr(0, eqIndex - 1); 43920 } 43921 value = relative + (value in _keywords ? _keywords[value] * size : ~value.indexOf("%") ? parseFloat(value) * size / 100 : parseFloat(value) || 0); 43922 } 43923 return value; 43924}, _createMarker = function _createMarker(type, name, container, direction, _ref4, offset, matchWidthEl, containerAnimation) { 43925 var startColor = _ref4.startColor, endColor = _ref4.endColor, fontSize = _ref4.fontSize, indent = _ref4.indent, fontWeight = _ref4.fontWeight; 43926 var e = _doc.createElement("div"), useFixedPosition = _isViewport(container) || (0, _observerJs._getProxyProp)(container, "pinType") === "fixed", isScroller = type.indexOf("scroller") !== -1, parent = useFixedPosition ? _body : container, isStart = type.indexOf("start") !== -1, color = isStart ? startColor : endColor, css = "border-color:" + color + ";font-size:" + fontSize + ";color:" + color + ";font-weight:" + fontWeight + ";pointer-events:none;white-space:nowrap;font-family:sans-serif,Arial;z-index:1000;padding:4px 8px;border-width:0;border-style:solid;"; 43927 css += "position:" + ((isScroller || containerAnimation) && useFixedPosition ? "fixed;" : "absolute;"); 43928 (isScroller || containerAnimation || !useFixedPosition) && (css += (direction === (0, _observerJs._vertical) ? _right : _bottom) + ":" + (offset + parseFloat(indent)) + "px;"); 43929 matchWidthEl && (css += "box-sizing:border-box;text-align:left;
vendor: 4,748 bytes, lines 43929-43996
43929width:" + matchWidthEl.offsetWidth + "px;"); 43930 e._isStart = isStart; 43931 e.setAttribute("class", "gsap-marker-" + type + (name ? " marker-" + name : "")); 43932 e.style.cssText = css; 43933 e.innerText = name || name === 0 ? type + "-" + name : type; 43934 parent.children[0] ? parent.insertBefore(e, parent.children[0]) : parent.appendChild(e); 43935 e._offset = e["offset" + direction.op.d2]; 43936 _positionMarker(e, 0, direction, isStart); 43937 return e; 43938}, _positionMarker = function _positionMarker(marker, start, direction, flipped) { 43939 var vars = { 43940 display: "block" 43941 }, side = direction[flipped ? "os2" : "p2"], oppositeSide = direction[flipped ? "p2" : "os2"]; 43942 marker._isFlipped = flipped; 43943 vars[direction.a + "Percent"] = flipped ? -100 : 0; 43944 vars[direction.a] = flipped ? "1px" : 0; 43945 vars["border" + side + _Width] = 1; 43946 vars["border" + oppositeSide + _Width] = 0; 43947 vars[direction.p] = start + "px"; 43948 gsap.set(marker, vars); 43949}, _triggers = [], _ids = {}, _rafID, _sync = function _sync() { 43950 return _getTime() - _lastScrollTime > 34 && (_rafID || (_rafID = requestAnimationFrame(_updateAll))); 43951}, _onScroll = function _onScroll() { 43952 // previously, we tried to optimize performance by batching/deferring to the next requestAnimationFrame(), but discovered that Safari has a few bugs that make this unworkable (especially on iOS). See https://codepen.io/GreenSock/pen/16c435b12ef09c38125204818e7b45fc?editors=0010 and https://codepen.io/GreenSock/pen/JjOxYpQ/3dd65ccec5a60f1d862c355d84d14562?editors=0010 and https://codepen.io/GreenSock/pen/ExbrPNa/087cef197dc35445a0951e8935c41503?editors=0010 43953 if (!_normalizer || !_normalizer.isPressed || _normalizer.startX > _body.clientWidth) { 43954 // if the user is dragging the scrollbar, allow it. 43955 (0, _observerJs._scrollers).cache++; 43956 if (_normalizer) _rafID || (_rafID = requestAnimationFrame(_updateAll)); 43957 else _updateAll(); // Safari in particular (on desktop) NEEDS the immediate update rather than waiting for a requestAnimationFrame() whereas iOS seems to benefit from waiting for the requestAnimationFrame() tick, at least when normalizing. See https://codepen.io/GreenSock/pen/qBYozqO?editors=0110 43958 _lastScrollTime || _dispatch("scrollStart"); 43959 _lastScrollTime = _getTime(); 43960 } 43961}, _setBaseDimensions = function _setBaseDimensions() { 43962 _baseScreenWidth = _win.innerWidth; 43963 _baseScreenHeight = _win.innerHeight; 43964}, _onResize = function _onResize(force) { 43965 (0, _observerJs._scrollers).cache++; 43966 (force === true || !_refreshing && !_ignoreResize && !_doc.fullscreenElement && !_doc.webkitFullscreenElement && (!_ignoreMobileResize || _baseScreenWidth !== _win.innerWidth || Math.abs(_win.innerHeight - _baseScreenHeight) > _win.innerHeight * 0.25)) && _resizeDelay.restart(true); 43967}, // ignore resizes triggered by refresh() 43968_listeners = {}, _emptyArray = [], _softRefresh = function _softRefresh() { 43969 return _removeListener(ScrollTrigger, "scrollEnd", _softRefresh) || _refreshAll(true); 43970}, _dispatch = function _dispatch(type) { 43971 return _listeners[type] && _listeners[type].map(function(f) { 43972 return f(); 43973 }) || _emptyArray; 43974}, _savedStyles = [], // when ScrollTrigger.saveStyles() is called, the inline styles are recorded in this Array in a sequential format like [element, cssText, gsCache, media]. This keeps it very memory-efficient and fast to iterate through. 43975_revertRecorded = function _revertRecorded(media) { 43976 for(var i = 0; i < _savedStyles.length; i += 5)if (!media || _savedStyles[i + 4] && _savedStyles[i + 4].query === media) { 43977 _savedStyles[i].style.cssText = _savedStyles[i + 1]; 43978 _savedStyles[i].getBBox && _savedStyles[i].setAttribute("transform", _savedStyles[i + 2] || ""); 43979 _savedStyles[i + 3].uncache = 1; 43980 } 43981}, _revertAll = function _revertAll(kill, media) { 43982 var trigger; 43983 for(_i = 0; _i < _triggers.length; _i++){ 43984 trigger = _triggers[_i]; 43985 if (trigger && (!media || trigger._ctx === media)) { 43986 if (kill) trigger.kill(1); 43987 else trigger.revert(true, true); 43988 } 43989 } 43990 _isReverted = true; 43991 media && _revertRecorded(media); 43992 media || _dispatch("revert"); 43993}, _clearScrollMemory = function _clearScrollMemory(scrollRestoration, force) { 43994 // zero-out all the recorded scroll positions. Don't use _triggers because if, for example, .matchMedia() is used to create some ScrollTriggers and then the user resizes and it removes ALL ScrollTriggers, and then go back to a size where there are ScrollTriggers, it would have kept the position(s) saved from the initial state. 43995 (0, _observerJs._scrollers).cache++; 43996 (force || !_refreshingAll) && (0, _observerJs._scrollers).forEac
vendor: 2,686 bytes, lines 43996-44045
43996h(function(obj) { 43997 return _isFunction(obj) && obj.cacheID++ && (obj.rec = 0); 43998 }); 43999 _isString(scrollRestoration) && (_win.history.scrollRestoration = _scrollRestoration = scrollRestoration); 44000}, _refreshingAll, _refreshID = 0, _queueRefreshID, _queueRefreshAll = function _queueRefreshAll() { 44001 // we don't want to call _refreshAll() every time we create a new ScrollTrigger (for performance reasons) - it's better to batch them. Some frameworks dynamically load content and we can't rely on the window's "load" or "DOMContentLoaded" events to trigger it. 44002 if (_queueRefreshID !== _refreshID) { 44003 var id = _queueRefreshID = _refreshID; 44004 requestAnimationFrame(function() { 44005 return id === _refreshID && _refreshAll(true); 44006 }); 44007 } 44008}, _refresh100vh = function _refresh100vh() { 44009 _body.appendChild(_div100vh); 44010 _100vh = !_normalizer && _div100vh.offsetHeight || _win.innerHeight; 44011 _body.removeChild(_div100vh); 44012}, _hideAllMarkers = function _hideAllMarkers(hide) { 44013 return _toArray(".gsap-marker-start, .gsap-marker-end, .gsap-marker-scroller-start, .gsap-marker-scroller-end").forEach(function(el) { 44014 return el.style.display = hide ? "none" : "block"; 44015 }); 44016}, _refreshAll = function _refreshAll(force, skipRevert) { 44017 _docEl = _doc.documentElement; // some frameworks like Astro may cache the <body> and replace it during routing, so we'll just re-record the _docEl and _body for safety (otherwise, the markers may not get added properly). 44018 _body = _doc.body; 44019 _root = [ 44020 _win, 44021 _doc, 44022 _docEl, 44023 _body 44024 ]; 44025 if (_lastScrollTime && !force && !_isReverted) { 44026 _addListener(ScrollTrigger, "scrollEnd", _softRefresh); 44027 return; 44028 } 44029 _refresh100vh(); 44030 _refreshingAll = ScrollTrigger.isRefreshing = true; 44031 (0, _observerJs._scrollers).forEach(function(obj) { 44032 return _isFunction(obj) && ++obj.cacheID && (obj.rec = obj()); 44033 }); // force the clearing of the cache because some browsers take a little while to dispatch the "scroll" event and the user may have changed the scroll position and then called ScrollTrigger.refresh() right away 44034 var refreshInits = _dispatch("refreshInit"); 44035 _sort && ScrollTrigger.sort(); 44036 skipRevert || _revertAll(); 44037 (0, _observerJs._scrollers).forEach(function(obj) { 44038 if (_isFunction(obj)) { 44039 obj.smooth && (obj.target.style.scrollBehavior = "auto"); // smooth scrolling interferes 44040 obj(0); 44041 } 44042 }); 44043 _triggers.slice(0).forEach(function(t) { 44044 return t.refresh(); 44045 }); // don't loop with _i because during a refresh() someone could call ScrollTrigger.update(
vendor: 4,695 bytes, lines 44045-44156
44045) which would iterate through _i resulting in a skip. 44046 _isReverted = false; 44047 _triggers.forEach(function(t) { 44048 // nested pins (pinnedContainer) with pinSpacing may expand the container, so we must accommodate that here. 44049 if (t._subPinOffset && t.pin) { 44050 var prop = t.vars.horizontal ? "offsetWidth" : "offsetHeight", original = t.pin[prop]; 44051 t.revert(true, 1); 44052 t.adjustPinSpacing(t.pin[prop] - original); 44053 t.refresh(); 44054 } 44055 }); 44056 _clampingMax = 1; // pinSpacing might be propping a page open, thus when we .setPositions() to clamp a ScrollTrigger's end we should leave the pinSpacing alone. That's what this flag is for. 44057 _hideAllMarkers(true); 44058 _triggers.forEach(function(t) { 44059 // the scroller's max scroll position may change after all the ScrollTriggers refreshed (like pinning could push it down), so we need to loop back and correct any with end: "max". Same for anything with a clamped end 44060 var max = _maxScroll(t.scroller, t._dir), endClamp = t.vars.end === "max" || t._endClamp && t.end > max, startClamp = t._startClamp && t.start >= max; 44061 (endClamp || startClamp) && t.setPositions(startClamp ? max - 1 : t.start, endClamp ? Math.max(startClamp ? max : t.start + 1, max) : t.end, true); 44062 }); 44063 _hideAllMarkers(false); 44064 _clampingMax = 0; 44065 refreshInits.forEach(function(result) { 44066 return result && result.render && result.render(-1); 44067 }); // if the onRefreshInit() returns an animation (typically a gsap.set()), revert it. This makes it easy to put things in a certain spot before refreshing for measurement purposes, and then put things back. 44068 (0, _observerJs._scrollers).forEach(function(obj) { 44069 if (_isFunction(obj)) { 44070 obj.smooth && requestAnimationFrame(function() { 44071 return obj.target.style.scrollBehavior = "smooth"; 44072 }); 44073 obj.rec && obj(obj.rec); 44074 } 44075 }); 44076 _clearScrollMemory(_scrollRestoration, 1); 44077 _resizeDelay.pause(); 44078 _refreshID++; 44079 _refreshingAll = 2; 44080 _updateAll(2); 44081 _triggers.forEach(function(t) { 44082 return _isFunction(t.vars.onRefresh) && t.vars.onRefresh(t); 44083 }); 44084 _refreshingAll = ScrollTrigger.isRefreshing = false; 44085 _dispatch("refresh"); 44086}, _lastScroll = 0, _direction = 1, _primary, _updateAll = function _updateAll(force) { 44087 if (force === 2 || !_refreshingAll && !_isReverted) { 44088 // _isReverted could be true if, for example, a matchMedia() is in the process of executing. We don't want to update during the time everything is reverted. 44089 ScrollTrigger.isUpdating = true; 44090 _primary && _primary.update(0); // ScrollSmoother uses refreshPriority -9999 to become the primary that gets updated before all others because it affects the scroll position. 44091 var l = _triggers.length, time = _getTime(), recordVelocity = time - _time1 >= 50, scroll = l && _triggers[0].scroll(); 44092 _direction = _lastScroll > scroll ? -1 : 1; 44093 _refreshingAll || (_lastScroll = scroll); 44094 if (recordVelocity) { 44095 if (_lastScrollTime && !_pointerIsDown && time - _lastScrollTime > 200) { 44096 _lastScrollTime = 0; 44097 _dispatch("scrollEnd"); 44098 } 44099 _time2 = _time1; 44100 _time1 = time; 44101 } 44102 if (_direction < 0) { 44103 _i = l; 44104 while(_i-- > 0)_triggers[_i] && _triggers[_i].update(0, recordVelocity); 44105 _direction = 1; 44106 } else for(_i = 0; _i < l; _i++)_triggers[_i] && _triggers[_i].update(0, recordVelocity); 44107 ScrollTrigger.isUpdating = false; 44108 } 44109 _rafID = 0; 44110}, _propNamesToCopy = [ 44111 _left, 44112 _top, 44113 _bottom, 44114 _right, 44115 _margin + _Bottom, 44116 _margin + _Right, 44117 _margin + _Top, 44118 _margin + _Left, 44119 "display", 44120 "flexShrink", 44121 "float", 44122 "zIndex", 44123 "gridColumnStart", 44124 "gridColumnEnd", 44125 "gridRowStart", 44126 "gridRowEnd", 44127 "gridArea", 44128 "justifySelf", 44129 "alignSelf", 44130 "placeSelf", 44131 "order" 44132], _stateProps = _propNamesToCopy.concat([ 44133 _width, 44134 _height, 44135 "boxSizing", 44136 "max" + _Width, 44137 "max" + _Height, 44138 "position", 44139 _margin, 44140 _padding, 44141 _padding + _Top, 44142 _padding + _Right, 44143 _padding + _Bottom, 44144 _padding + _Left 44145]), _swapPinOut = function _swapPinOut(pin, spacer, state) { 44146 _setState(state); 44147 var cache = pin._gsap; 44148 if (cache.spacerIsNative) _setState(cache.spacerState); 44149 else if (pin._gsap.swappedIn) { 44150 var parent = spacer.parentNode; 44151 if (parent) { 44152 parent.insertBefore(pin, spacer); 44153 parent.removeChild(spacer); 44154 } 44155 } 44156 pin._gsap.swappedIn = false;
vendor: 9,733 bytes, lines 44157-44308
44157}, _swapPinIn = function _swapPinIn(pin, spacer, cs, spacerState) { 44158 if (!pin._gsap.swappedIn) { 44159 var i = _propNamesToCopy.length, spacerStyle = spacer.style, pinStyle = pin.style, p; 44160 while(i--){ 44161 p = _propNamesToCopy[i]; 44162 spacerStyle[p] = cs[p]; 44163 } 44164 spacerStyle.position = cs.position === "absolute" ? "absolute" : "relative"; 44165 cs.display === "inline" && (spacerStyle.display = "inline-block"); 44166 pinStyle[_bottom] = pinStyle[_right] = "auto"; 44167 spacerStyle.flexBasis = cs.flexBasis || "auto"; 44168 spacerStyle.overflow = "visible"; 44169 spacerStyle.boxSizing = "border-box"; 44170 spacerStyle[_width] = _getSize(pin, (0, _observerJs._horizontal)) + _px; 44171 spacerStyle[_height] = _getSize(pin, (0, _observerJs._vertical)) + _px; 44172 spacerStyle[_padding] = pinStyle[_margin] = pinStyle[_top] = pinStyle[_left] = "0"; 44173 _setState(spacerState); 44174 pinStyle[_width] = pinStyle["max" + _Width] = cs[_width]; 44175 pinStyle[_height] = pinStyle["max" + _Height] = cs[_height]; 44176 pinStyle[_padding] = cs[_padding]; 44177 if (pin.parentNode !== spacer) { 44178 pin.parentNode.insertBefore(spacer, pin); 44179 spacer.appendChild(pin); 44180 } 44181 pin._gsap.swappedIn = true; 44182 } 44183}, _capsExp = /([A-Z])/g, _setState = function _setState(state) { 44184 if (state) { 44185 var style = state.t.style, l = state.length, i = 0, p, value; 44186 (state.t._gsap || gsap.core.getCache(state.t)).uncache = 1; // otherwise transforms may be off 44187 for(; i < l; i += 2){ 44188 value = state[i + 1]; 44189 p = state[i]; 44190 if (value) style[p] = value; 44191 else if (style[p]) style.removeProperty(p.replace(_capsExp, "-$1").toLowerCase()); 44192 } 44193 } 44194}, _getState = function _getState(element) { 44195 // returns an Array with alternating values like [property, value, property, value] and a "t" property pointing to the target (element). Makes it fast and cheap. 44196 var l = _stateProps.length, style = element.style, state = [], i = 0; 44197 for(; i < l; i++)state.push(_stateProps[i], style[_stateProps[i]]); 44198 state.t = element; 44199 return state; 44200}, _copyState = function _copyState(state, override, omitOffsets) { 44201 var result = [], l = state.length, i = omitOffsets ? 8 : 0, // skip top, left, right, bottom if omitOffsets is true 44202 p; 44203 for(; i < l; i += 2){ 44204 p = state[i]; 44205 result.push(p, p in override ? override[p] : state[i + 1]); 44206 } 44207 result.t = state.t; 44208 return result; 44209}, _winOffsets = { 44210 left: 0, 44211 top: 0 44212}, // // potential future feature (?) Allow users to calculate where a trigger hits (scroll position) like getScrollPosition("#id", "top bottom") 44213// _getScrollPosition = (trigger, position, {scroller, containerAnimation, horizontal}) => { 44214// scroller = _getTarget(scroller || _win); 44215// let direction = horizontal ? _horizontal : _vertical, 44216// isViewport = _isViewport(scroller); 44217// _getSizeFunc(scroller, isViewport, direction); 44218// return _parsePosition(position, _getTarget(trigger), _getSizeFunc(scroller, isViewport, direction)(), direction, _getScrollFunc(scroller, direction)(), 0, 0, 0, _getOffsetsFunc(scroller, isViewport)(), isViewport ? 0 : parseFloat(_getComputedStyle(scroller)["border" + direction.p2 + _Width]) || 0, 0, containerAnimation ? containerAnimation.duration() : _maxScroll(scroller), containerAnimation); 44219// }, 44220_parsePosition = function _parsePosition(value, trigger, scrollerSize, direction, scroll, marker, markerScroller, self, scrollerBounds, borderWidth, useFixedPosition, scrollerMax, containerAnimation, clampZeroProp) { 44221 _isFunction(value) && (value = value(self)); 44222 if (_isString(value) && value.substr(0, 3) === "max") value = scrollerMax + (value.charAt(4) === "=" ? _offsetToPx("0" + value.substr(3), scrollerSize) : 0); 44223 var time = containerAnimation ? containerAnimation.time() : 0, p1, p2, element; 44224 containerAnimation && containerAnimation.seek(0); 44225 isNaN(value) || (value = +value); // convert a string number like "45" to an actual number 44226 if (!_isNumber(value)) { 44227 _isFunction(trigger) && (trigger = trigger(self)); 44228 var offsets = (value || "0").split(" "), bounds, localOffset, globalOffset, display; 44229 element = (0, _observerJs._getTarget)(trigger, self) || _body; 44230 bounds = _getBounds(element) || {}; 44231 if ((!bounds || !bounds.left && !bounds.top) && _getComputedStyle(element).display === "none") { 44232 // if display is "none", it won't report getBoundingClientRect() properly 44233 display = element.style.display; 44234 element.style.display = "block"; 44235 bounds = _getBounds(element); 44236 display ? element.style.display = display : element.style.removeProperty("display"); 44237 } 44238 localOffset = _offsetToPx(offsets[0], bounds[direction.d]); 44239 globalOffset = _offsetToPx(offsets[1] || "0", scrollerSize); 44240 value = bounds[direction.p] - scrollerBounds[direction.p] - borderWidth + localOffset + scroll - globalOffset; 44241 markerScroller && _positionMarker(markerScroller, globalOffset, direction, scrollerSize - globalOffset < 20 || markerScroller._isStart && globalOffset > 20); 44242 scrollerSize -= scrollerSize - globalOffset; // adjust for the marker 44243 } else { 44244 containerAnimation && (value = gsap.utils.mapRange(containerAnimation.scrollTrigger.start, containerAnimation.scrollTrigger.end, 0, scrollerMax, value)); 44245 markerScroller && _positionMarker(markerScroller, scrollerSize, direction, true); 44246 } 44247 if (clampZeroProp) { 44248 self[clampZeroProp] = value || -0.001; 44249 value < 0 && (value = 0); 44250 } 44251 if (marker) { 44252 var position = value + scrollerSize, isStart = marker._isStart; 44253 p1 = "scroll" + direction.d2; 44254 _positionMarker(marker, position, direction, isStart && position > 20 || !isStart && (useFixedPosition ? Math.max(_body[p1], _docEl[p1]) : marker.parentNode[p1]) <= position + 1); 44255 if (useFixedPosition) { 44256 scrollerBounds = _getBounds(markerScroller); 44257 useFixedPosition && (marker.style[direction.op.p] = scrollerBounds[direction.op.p] - direction.op.m - marker._offset + _px); 44258 } 44259 } 44260 if (containerAnimation && element) { 44261 p1 = _getBounds(element); 44262 containerAnimation.seek(scrollerMax); 44263 p2 = _getBounds(element); 44264 containerAnimation._caScrollDist = p1[direction.p] - p2[direction.p]; 44265 value = value / containerAnimation._caScrollDist * scrollerMax; 44266 } 44267 containerAnimation && containerAnimation.seek(time); 44268 return containerAnimation ? value : Math.round(value); 44269}, _prefixExp = /(webkit|moz|length|cssText|inset)/i, _reparent = function _reparent(element, parent, top, left) { 44270 if (element.parentNode !== parent) { 44271 var style = element.style, p, cs; 44272 if (parent === _body) { 44273 element._stOrig = style.cssText; // record original inline styles so we can revert them later 44274 cs = _getComputedStyle(element); 44275 for(p in cs)// must copy all relevant styles to ensure that nothing changes visually when we reparent to the <body>. Skip the vendor prefixed ones. 44276 if (!+p && !_prefixExp.test(p) && cs[p] && typeof style[p] === "string" && p !== "0") style[p] = cs[p]; 44277 style.top = top; 44278 style.left = left; 44279 } else style.cssText = element._stOrig; 44280 gsap.core.getCache(element).uncache = 1; 44281 parent.appendChild(element); 44282 } 44283}, _interruptionTracker = function _interruptionTracker(getValueFunc, initialValue, onInterrupt) { 44284 var last1 = initialValue, last2 = last1; 44285 return function(value) { 44286 var current = Math.round(getValueFunc()); // round because in some [very uncommon] Windows environments, scroll can get reported with decimals even though it was set without. 44287 if (current !== last1 && current !== last2 && Math.abs(current - last1) > 3 && Math.abs(current - last2) > 3) { 44288 // if the user scrolls, kill the tween. iOS Safari intermittently misreports the scroll position, it may be the most recently-set one or the one before that! When Safari is zoomed (CMD-+), it often misreports as 1 pixel off too! So if we set the scroll position to 125, for example, it'll actually report it as 124. 44289 value = current; 44290 onInterrupt && onInterrupt(); 44291 } 44292 last2 = last1; 44293 last1 = Math.round(value); 44294 return last1; 44295 }; 44296}, _shiftMarker = function _shiftMarker(marker, direction, value) { 44297 var vars = {}; 44298 vars[direction.p] = "+=" + value; 44299 gsap.set(marker, vars); 44300}, // _mergeAnimations = animations => { 44301// let tl = gsap.timeline({smoothChildTiming: true}).startTime(Math.min(...animations.map(a => a.globalTime(0)))); 44302// animations.forEach(a => {let time = a.totalTime(); tl.add(a); a.totalTime(time); }); 44303// tl.smoothChildTiming = false; 44304// return tl; 44305// }, 44306// returns a function that can be used to tween the scroll position in the direction provided, and when doing so it'll add a .tween property to the FUNCTION itself, and remove it when the tween completes or gets killed. This gives us a way to have multiple ScrollTriggers use a central function for any given scroller and see if there's a scroll tween running (which would affect if/how things get updated) 44307_getTweenCreator = function _getTweenCreator(scroller, direction) { 44308 var getScroll = (0, _observerJs._getScrollFunc)(scroller, direction), prop = "_scroll" + direction.p2, // add a tweenable property to the scroller that's a getter/setter function, like _scrollTop or _scrollLeft. This way, if someone does gsap.killTweensOf(scroller) it'll
vendor: 4,340 bytes, lines 44308-44368
44308kill the scroll tween. 44309 getTween = function getTween(scrollTo, vars, initialValue, change1, change2) { 44310 var tween = getTween.tween, onComplete = vars.onComplete, modifiers = {}; 44311 initialValue = initialValue || getScroll(); 44312 var checkForInterruption = _interruptionTracker(getScroll, initialValue, function() { 44313 tween.kill(); 44314 getTween.tween = 0; 44315 }); 44316 change2 = change1 && change2 || 0; // if change1 is 0, we set that to the difference and ignore change2. Otherwise, there would be a compound effect. 44317 change1 = change1 || scrollTo - initialValue; 44318 tween && tween.kill(); 44319 vars[prop] = scrollTo; 44320 vars.inherit = false; 44321 vars.modifiers = modifiers; 44322 modifiers[prop] = function() { 44323 return checkForInterruption(initialValue + change1 * tween.ratio + change2 * tween.ratio * tween.ratio); 44324 }; 44325 vars.onUpdate = function() { 44326 (0, _observerJs._scrollers).cache++; 44327 getTween.tween && _updateAll(); // if it was interrupted/killed, like in a context.revert(), don't force an updateAll() 44328 }; 44329 vars.onComplete = function() { 44330 getTween.tween = 0; 44331 onComplete && onComplete.call(tween); 44332 }; 44333 tween = getTween.tween = gsap.to(scroller, vars); 44334 return tween; 44335 }; 44336 scroller[prop] = getScroll; 44337 getScroll.wheelHandler = function() { 44338 return getTween.tween && getTween.tween.kill() && (getTween.tween = 0); 44339 }; 44340 _addListener(scroller, "wheel", getScroll.wheelHandler); // Windows machines handle mousewheel scrolling in chunks (like "3 lines per scroll") meaning the typical strategy for cancelling the scroll isn't as sensitive. It's much more likely to match one of the previous 2 scroll event positions. So we kill any snapping as soon as there's a wheel event. 44341 ScrollTrigger.isTouch && _addListener(scroller, "touchmove", getScroll.wheelHandler); 44342 return getTween; 44343}; 44344var ScrollTrigger = /*#__PURE__*/ function() { 44345 function ScrollTrigger(vars, animation) { 44346 _coreInitted || ScrollTrigger.register(gsap) || console.warn("Please gsap.registerPlugin(ScrollTrigger)"); 44347 _context(this); 44348 this.init(vars, animation); 44349 } 44350 var _proto = ScrollTrigger.prototype; 44351 _proto.init = function init(vars, animation) { 44352 this.progress = this.start = 0; 44353 this.vars && this.kill(true, true); // in case it's being initted again 44354 if (!_enabled) { 44355 this.update = this.refresh = this.kill = _passThrough; 44356 return; 44357 } 44358 vars = _setDefaults(_isString(vars) || _isNumber(vars) || vars.nodeType ? { 44359 trigger: vars 44360 } : vars, _defaults); 44361 var _vars = vars, onUpdate = _vars.onUpdate, toggleClass = _vars.toggleClass, id = _vars.id, onToggle = _vars.onToggle, onRefresh = _vars.onRefresh, scrub = _vars.scrub, trigger = _vars.trigger, pin = _vars.pin, pinSpacing = _vars.pinSpacing, invalidateOnRefresh = _vars.invalidateOnRefresh, anticipatePin = _vars.anticipatePin, onScrubComplete = _vars.onScrubComplete, onSnapComplete = _vars.onSnapComplete, once = _vars.once, snap = _vars.snap, pinReparent = _vars.pinReparent, pinSpacer = _vars.pinSpacer, containerAnimation = _vars.containerAnimation, fastScrollEnd = _vars.fastScrollEnd, preventOverlaps = _vars.preventOverlaps, direction = vars.horizontal || vars.containerAnimation && vars.horizontal !== false ? (0, _observerJs._horizontal) : (0, _observerJs._vertical), isToggle = !scrub && scrub !== 0, scroller = (0, _observerJs._getTarget)(vars.scroller || _win), scrollerCache = gsap.core.getCache(scroller), isViewport = _isViewport(scroller), useFixedPosition = ("pinType" in vars ? vars.pinType : (0, _observerJs._getProxyProp)(scroller, "pinType") || isViewport && "fixed") === "fixed", callbacks = [ 44362 vars.onEnter, 44363 vars.onLeave, 44364 vars.onEnterBack, 44365 vars.onLeaveBack 44366 ], toggleActions = isToggle && vars.toggleActions.split(" "), markers = "markers" in vars ? vars.markers : _defaults.markers, borderWidth = isViewport ? 0 : parseFloat(_getComputedStyle(scroller)["border" + direction.p2 + _Width]) || 0, self = this, onRefreshInit = vars.onRefreshInit && function() { 44367 return vars.onRefreshInit(self); 44368 }
44368, getScrollerSize = _getSizeFunc(scroller, isViewport, direction), getScrollerOffsets = _getOffsetsFunc(scroller, isViewport), lastSnap = 0, lastRefresh = 0, prevProgress = 0, scrollFunc = (0, _observerJs._getScrollFunc)(scroller, direction), tweenTo, pinCache, snapFunc, scroll1, scroll2, start, end, markerStart, markerEnd, markerStartTrigger, markerEndTrigger, markerVars, executingOnRefresh, change, pinOriginalState, pinActiveState, pinState, spacer, offset, pinGetter, pinSetter, pinStart, pinChange, spacingStart, spacerState, markerStartSetter, pinMoves, markerEndSetter, cs, snap1, snap2, scrubTween, scrubSmooth, snapDurClamp, snapDelayedCall, prevScroll, prevAnimProgress, caMarkerSetter, customRevertReturn; // for the sake of efficiency, _startClamp/_endClamp serve like a truthy value indicating that clamping was enabled on the start/end, and ALSO store the actual pre-clamped numeric value. We tap into that in ScrollSmoother for speed effects. So for example, if start="clamp(top bottom)" results in a start of -100 naturally, it would get clamped to 0 but -100 would be stored in _startClamp. 44369 self._startClamp = self._endClamp = false; 44370 self._dir = direction; 44371 anticipatePin *= 45; 44372 self.scroller = scroller; 44373 self.scroll = containerAnimation ? containerAnimation.time.bind(containerAnimation) : scrollFunc; 44374 scroll1 = scrollFunc(); 44375 self.vars = vars; 44376 animation = animation || vars.animation; 44377 if ("refreshPriority" in vars) { 44378 _sort = 1; 44379 vars.refreshPriority === -9999 && (_primary = self); // used by ScrollSmoother 44380 } 44381 scrollerCache.tweenScroll = scrollerCache.tweenScroll || { 44382 top: _getTweenCreator(scroller, (0, _observerJs._vertical)), 44383 left: _getTweenCreator(scroller, (0, _observerJs._horizontal)) 44384 }; 44385 self.tweenTo = tweenTo = scrollerCache.tweenScroll[direction.p]; 44386 self.scrubDuration = function(value) { 44387 scrubSmooth = _isNumber(value) && value; 44388 if (!scrubSmooth) { 44389 scrubTween && scrubTween.progress(1).kill(); 44390 scrubTween = 0; 44391 } else scrubTween ? scrubTween.duration(value) : scrubTween = gsap.to(animation, { 44392 ease: "expo", 44393 totalProgress: "+=0", 44394 inherit: false, 44395 duration: scrubSmooth, 44396 paused: true, 44397 onComplete: function onComplete() { 44398 return onScrubComplete && onScrubComplete(self); 44399 } 44400 }); 44401 }; 44402 if (animation) { 44403 animation.vars.lazy = false; 44404 animation._initted && !self.isReverted || animation.vars.immediateRender !== false && vars.immediateRender !== false && animation.duration() && animation.render(0, true, true); // special case: if this ScrollTrigger gets re-initted, a from() tween with a stagger could get initted initially and then reverted on the re-init which means it'll need to get rendered again here to properly display things. Otherwise, See https://gsap.com/forums/topic/36777-scrollsmoother-splittext-nextjs/ and https://codepen.io/GreenSock/pen/eYPyPpd?editors=0010 44405 self.animation = animation.pause(); 44406 animation.scrollTrigger = self; 44407 self.scrubDuration(scrub); 44408 snap1 = 0; 44409 id || (id = animation.vars.id); 44410 } 44411 if (snap) { 44412 // TODO: potential idea: use legitimate CSS scroll snapping by pushing invisible elements into the DOM that serve as snap positions, and toggle the document.scrollingElement.style.scrollSnapType onToggle. See https://codepen.io/GreenSock/pen/JjLrgWM for a quick proof of concept. 44413 if (!_isObject(snap) || snap.push) snap = { 44414 snapTo: snap 44415 }; 44416 "scrollBehavior" in _body.style && gsap.set(isViewport ? [ 44417 _body, 44418 _docEl 44419 ] : scroller, { 44420 scrollBehavior: "auto" 44421 }); // smooth scrolling doesn't work with snap.
vendor: 2,930 bytes, lines 44422-44448
44422 (0, _observerJs._scrollers).forEach(function(o) { 44423 return _isFunction(o) && o.target === (isViewport ? _doc.scrollingElement || _docEl : scroller) && (o.smooth = false); 44424 }); // note: set smooth to false on both the vertical and horizontal scroll getters/setters 44425 snapFunc = _isFunction(snap.snapTo) ? snap.snapTo : snap.snapTo === "labels" ? _getClosestLabel(animation) : snap.snapTo === "labelsDirectional" ? _getLabelAtDirection(animation) : snap.directional !== false ? function(value, st) { 44426 return _snapDirectional(snap.snapTo)(value, _getTime() - lastRefresh < 500 ? 0 : st.direction); 44427 } : gsap.utils.snap(snap.snapTo); 44428 snapDurClamp = snap.duration || { 44429 min: 0.1, 44430 max: 2 44431 }; 44432 snapDurClamp = _isObject(snapDurClamp) ? _clamp(snapDurClamp.min, snapDurClamp.max) : _clamp(snapDurClamp, snapDurClamp); 44433 snapDelayedCall = gsap.delayedCall(snap.delay || scrubSmooth / 2 || 0.1, function() { 44434 var scroll = scrollFunc(), refreshedRecently = _getTime() - lastRefresh < 500, tween = tweenTo.tween; 44435 if ((refreshedRecently || Math.abs(self.getVelocity()) < 10) && !tween && !_pointerIsDown && lastSnap !== scroll) { 44436 var progress = (scroll - start) / change, totalProgress = animation && !isToggle ? animation.totalProgress() : progress, velocity = refreshedRecently ? 0 : (totalProgress - snap2) / (_getTime() - _time2) * 1000 || 0, change1 = gsap.utils.clamp(-progress, 1 - progress, _abs(velocity / 2) * velocity / 0.185), naturalEnd = progress + (snap.inertia === false ? 0 : change1), endValue, endScroll, _snap = snap, onStart = _snap.onStart, _onInterrupt = _snap.onInterrupt, _onComplete = _snap.onComplete; 44437 endValue = snapFunc(naturalEnd, self); 44438 _isNumber(endValue) || (endValue = naturalEnd); // in case the function didn't return a number, fall back to using the naturalEnd 44439 endScroll = Math.max(0, Math.round(start + endValue * change)); 44440 if (scroll <= end && scroll >= start && endScroll !== scroll) { 44441 if (tween && !tween._initted && tween.data <= _abs(endScroll - scroll)) // there's an overlapping snap! So we must figure out which one is closer and let that tween live. 44442 return; 44443 if (snap.inertia === false) change1 = endValue - progress; 44444 tweenTo(endScroll, { 44445 duration: snapDurClamp(_abs(Math.max(_abs(naturalEnd - totalProgress), _abs(endValue - totalProgress)) * 0.185 / velocity / 0.05 || 0)), 44446 ease: snap.ease || "power3", 44447 data: _abs(endScroll - scroll), 44448 // record the distance so that if another snap tween occurs (conflict) we
44448can prioritize the closest snap. 44449 onInterrupt: function onInterrupt() { 44450 return snapDelayedCall.restart(true) && _onInterrupt && _onInterrupt(self); 44451 }, 44452 onComplete: function onComplete() { 44453 self.update(); 44454 lastSnap = scrollFunc(); 44455 if (animation && !isToggle) // the resolution of the scrollbar is limited, so we should correct the scrubbed animation's playhead at the end to match EXACTLY where it was supposed to snap 44456 scrubTween ? scrubTween.resetTo("totalProgress", endValue, animation._tTime / animation._tDur) : animation.progress(endValue); 44457 snap1 = snap2 = animation && !isToggle ? animation.totalProgress() : self.progress; 44458 onSnapComplete && onSnapComplete(self); 44459 _onComplete && _onComplete(self); 44460 } 44461 }, scroll, change1 * change, endScroll - scroll - change1 * change); 44462 onStart && onStart(self, tweenTo.tween); 44463 } 44464 } else if (self.isActive && lastSnap !== scroll) snapDelayedCall.restart(true); 44465 }).pause(); 44466 } 44467 id && (_ids[id] = self); 44468 trigger = self.trigger = (0, _observerJs._getTarget)(trigger || pin !== true && pin); // if a trigger has some kind of scroll-related effect applied that could contaminate the "y" or "x" position (like a ScrollSmoother effect), we needed a way to temporarily revert it, so we use the stRevert property of the gsCache. It can return another function that we'll call at the end so it can return to its normal state. 44469 customRevertReturn = trigger && trigger._gsap && trigger._gsap.stRevert; 44470 customRevertReturn && (customRevertReturn = customRevertReturn(self)); 44471 pin = pin === true ? trigger : (0, _observerJs._getTarget)(pin); 44472 _isString(toggleClass) && (toggleClass = { 44473 targets: trigger, 44474 className: toggleClass 44475 }); 44476 if (pin) { 44477 pinSpacing === false || pinSpacing === _margin || (pinSpacing = !pinSpacing && pin.parentNode && pin.parentNode.style && _getComputedStyle(pin.parentNode).display === "flex" ? false : _padding); // if the parent is display: flex, don't apply pinSpacing by default. We should check that pin.parentNode is an element (not shadow dom window) 44478 self.pin = pin; 44479 pinCache = gsap.core.getCache(pin); 44480 if (!pinCache.spacer) { 44481 // record the spacer and pinOriginalState on the cache in case someone tries pinning the same element with MULTIPLE ScrollTriggers - we don't want to have multiple spacers or record the "original" pin state after it has already been affected by another ScrollTrigger. 44482 if (pinSpacer) { 44483 pinSpacer = (0, _observerJs._getTarget)(pinSpacer); 44484 pinSpacer && !pinSpacer.nodeType && (pinSpacer = pinSpacer.current || pinSpacer.nativeElement); // for React & Angular 44485 pinCache.spacerIsNative = !!pinSpacer; 44486 pinSpacer && (pinCache.spacerState = _getState(pinSpacer)); 44487 } 44488 pinCache.spacer = spacer = pinSpacer || _doc.createElement("div"); 44489 spacer.classList.add("pin-spacer"); 44490 id && spacer.classList.add("pin-spacer-" + id); 44491 pinCache.pinState = pinOriginalState = _getState(pin); 44492 } else pinOriginalState = pinCache.pinState; 44493 vars.force3D !== false && gsap.set(pin, { 44494 force3D: true 44495 }); 44496 self.spacer = spacer = pinCache.spacer; 44497 cs = _getComputedStyle(pin); 44498 spacingStart = cs[pinSpacing + direction.os2]; 44499 pinGetter = gsap.getProperty(pin); 44500 pinSetter = gsap.quickSetter(pin, direction.a, _px); // pin.firstChild && !_maxScroll(pin, direction) && (pin.style.overflow = "hidden"); // protects from collapsing margins, but can have unintended consequences as demonstrated here: https://codepen.io/GreenSock/pen/1e42c7a73bfa409d2cf1e184e7a4248d so it was removed in favor of just telling people to set up their CSS to avoid the collapsing margins (overflow: hidden | auto is just one option. Another is border-top: 1px solid transparent). 44501 _swapPinIn(pin, spacer, cs);
vendor: 10,454 bytes, lines 44502-44639
44502 pinState = _getState(pin); 44503 } 44504 if (markers) { 44505 markerVars = _isObject(markers) ? _setDefaults(markers, _markerDefaults) : _markerDefaults; 44506 markerStartTrigger = _createMarker("scroller-start", id, scroller, direction, markerVars, 0); 44507 markerEndTrigger = _createMarker("scroller-end", id, scroller, direction, markerVars, 0, markerStartTrigger); 44508 offset = markerStartTrigger["offset" + direction.op.d2]; 44509 var content = (0, _observerJs._getTarget)((0, _observerJs._getProxyProp)(scroller, "content") || scroller); 44510 markerStart = this.markerStart = _createMarker("start", id, content, direction, markerVars, offset, 0, containerAnimation); 44511 markerEnd = this.markerEnd = _createMarker("end", id, content, direction, markerVars, offset, 0, containerAnimation); 44512 containerAnimation && (caMarkerSetter = gsap.quickSetter([ 44513 markerStart, 44514 markerEnd 44515 ], direction.a, _px)); 44516 if (!useFixedPosition && !((0, _observerJs._proxies).length && (0, _observerJs._getProxyProp)(scroller, "fixedMarkers") === true)) { 44517 _makePositionable(isViewport ? _body : scroller); 44518 gsap.set([ 44519 markerStartTrigger, 44520 markerEndTrigger 44521 ], { 44522 force3D: true 44523 }); 44524 markerStartSetter = gsap.quickSetter(markerStartTrigger, direction.a, _px); 44525 markerEndSetter = gsap.quickSetter(markerEndTrigger, direction.a, _px); 44526 } 44527 } 44528 if (containerAnimation) { 44529 var oldOnUpdate = containerAnimation.vars.onUpdate, oldParams = containerAnimation.vars.onUpdateParams; 44530 containerAnimation.eventCallback("onUpdate", function() { 44531 self.update(0, 0, 1); 44532 oldOnUpdate && oldOnUpdate.apply(containerAnimation, oldParams || []); 44533 }); 44534 } 44535 self.previous = function() { 44536 return _triggers[_triggers.indexOf(self) - 1]; 44537 }; 44538 self.next = function() { 44539 return _triggers[_triggers.indexOf(self) + 1]; 44540 }; 44541 self.revert = function(revert, temp) { 44542 if (!temp) return self.kill(true); 44543 // for compatibility with gsap.context() and gsap.matchMedia() which call revert() 44544 var r = revert !== false || !self.enabled, prevRefreshing = _refreshing; 44545 if (r !== self.isReverted) { 44546 if (r) { 44547 prevScroll = Math.max(scrollFunc(), self.scroll.rec || 0); // record the scroll so we can revert later (repositioning/pinning things can affect scroll position). In the static refresh() method, we first record all the scroll positions as a reference. 44548 prevProgress = self.progress; 44549 prevAnimProgress = animation && animation.progress(); 44550 } 44551 markerStart && [ 44552 markerStart, 44553 markerEnd, 44554 markerStartTrigger, 44555 markerEndTrigger 44556 ].forEach(function(m) { 44557 return m.style.display = r ? "none" : "block"; 44558 }); 44559 if (r) { 44560 _refreshing = self; 44561 self.update(r); // make sure the pin is back in its original position so that all the measurements are correct. do this BEFORE swapping the pin out 44562 } 44563 if (pin && (!pinReparent || !self.isActive)) { 44564 if (r) _swapPinOut(pin, spacer, pinOriginalState); 44565 else _swapPinIn(pin, spacer, _getComputedStyle(pin), spacerState); 44566 } 44567 r || self.update(r); // when we're restoring, the update should run AFTER swapping the pin into its pin-spacer. 44568 _refreshing = prevRefreshing; // restore. We set it to true during the update() so that things fire properly in there. 44569 self.isReverted = r; 44570 } 44571 }; 44572 self.refresh = function(soft, force, position, pinOffset) { 44573 // position is typically only defined if it's coming from setPositions() - it's a way to skip the normal parsing. pinOffset is also only from setPositions() and is mostly related to fancy stuff we need to do in ScrollSmoother with effects 44574 if ((_refreshing || !self.enabled) && !force) return; 44575 if (pin && soft && _lastScrollTime) { 44576 _addListener(ScrollTrigger, "scrollEnd", _softRefresh); 44577 return; 44578 } 44579 !_refreshingAll && onRefreshInit && onRefreshInit(self); 44580 _refreshing = self; 44581 if (tweenTo.tween && !position) { 44582 // we skip this if a position is passed in because typically that's from .setPositions() and it's best to allow in-progress snapping to continue. 44583 tweenTo.tween.kill(); 44584 tweenTo.tween = 0; 44585 } 44586 scrubTween && scrubTween.pause(); 44587 if (invalidateOnRefresh && animation) { 44588 animation.revert({ 44589 kill: false 44590 }).invalidate(); 44591 animation.getChildren && animation.getChildren(true, true, false).forEach(function(t) { 44592 return t.vars.immediateRender && t.render(0, true, true); 44593 }); // any from() or fromTo() tweens inside a timeline should render immediately (well, unless they have immediateRender: false) 44594 } 44595 self.isReverted || self.revert(true, true); 44596 self._subPinOffset = false; // we'll set this to true in the sub-pins if we find any 44597 var size = getScrollerSize(), scrollerBounds = getScrollerOffsets(), max = containerAnimation ? containerAnimation.duration() : _maxScroll(scroller, direction), isFirstRefresh = change <= 0.01 || !change, offset = 0, otherPinOffset = pinOffset || 0, parsedEnd = _isObject(position) ? position.end : vars.end, parsedEndTrigger = vars.endTrigger || trigger, parsedStart = _isObject(position) ? position.start : vars.start || (vars.start === 0 || !trigger ? 0 : pin ? "0 0" : "0 100%"), pinnedContainer = self.pinnedContainer = vars.pinnedContainer && (0, _observerJs._getTarget)(vars.pinnedContainer, self), triggerIndex = trigger && Math.max(0, _triggers.indexOf(self)) || 0, i = triggerIndex, cs, bounds, scroll, isVertical, override, curTrigger, curPin, oppositeScroll, initted, revertedPins, forcedOverflow, markerStartOffset, markerEndOffset; 44598 if (markers && _isObject(position)) { 44599 // if we alter the start/end positions with .setPositions(), it generally feeds in absolute NUMBERS which don't convey information about where to line up the markers, so to keep it intuitive, we record how far the trigger positions shift after applying the new numbers and then offset by that much in the opposite direction. We do the same to the associated trigger markers too of course. 44600 markerStartOffset = gsap.getProperty(markerStartTrigger, direction.p); 44601 markerEndOffset = gsap.getProperty(markerEndTrigger, direction.p); 44602 } 44603 while(i-- > 0){ 44604 // user might try to pin the same element more than once, so we must find any prior triggers with the same pin, revert them, and determine how long they're pinning so that we can offset things appropriately. Make sure we revert from last to first so that things "rewind" properly. 44605 curTrigger = _triggers[i]; 44606 curTrigger.end || curTrigger.refresh(0, 1) || (_refreshing = self); // if it's a timeline-based trigger that hasn't been fully initialized yet because it's waiting for 1 tick, just force the refresh() here, otherwise if it contains a pin that's supposed to affect other ScrollTriggers further down the page, they won't be adjusted properly. 44607 curPin = curTrigger.pin; 44608 if (curPin && (curPin === trigger || curPin === pin || curPin === pinnedContainer) && !curTrigger.isReverted) { 44609 revertedPins || (revertedPins = []); 44610 revertedPins.unshift(curTrigger); // we'll revert from first to last to make sure things reach their end state properly 44611 curTrigger.revert(true, true); 44612 } 44613 if (curTrigger !== _triggers[i]) { 44614 // in case it got removed. 44615 triggerIndex--; 44616 i--; 44617 } 44618 } 44619 _isFunction(parsedStart) && (parsedStart = parsedStart(self)); 44620 parsedStart = _parseClamp(parsedStart, "start", self); 44621 start = _parsePosition(parsedStart, trigger, size, direction, scrollFunc(), markerStart, markerStartTrigger, self, scrollerBounds, borderWidth, useFixedPosition, max, containerAnimation, self._startClamp && "_startClamp") || (pin ? -0.001 : 0); 44622 _isFunction(parsedEnd) && (parsedEnd = parsedEnd(self)); 44623 if (_isString(parsedEnd) && !parsedEnd.indexOf("+=")) { 44624 if (~parsedEnd.indexOf(" ")) parsedEnd = (_isString(parsedStart) ? parsedStart.split(" ")[0] : "") + parsedEnd; 44625 else { 44626 offset = _offsetToPx(parsedEnd.substr(2), size); 44627 parsedEnd = _isString(parsedStart) ? parsedStart : (containerAnimation ? gsap.utils.mapRange(0, containerAnimation.duration(), containerAnimation.scrollTrigger.start, containerAnimation.scrollTrigger.end, start) : start) + offset; // _parsePosition won't factor in the offset if the start is a number, so do it here. 44628 parsedEndTrigger = trigger; 44629 } 44630 } 44631 parsedEnd = _parseClamp(parsedEnd, "end", self); 44632 end = Math.max(start, _parsePosition(parsedEnd || (parsedEndTrigger ? "100% 0" : max), parsedEndTrigger, size, direction, scrollFunc() + offset, markerEnd, markerEndTrigger, self, scrollerBounds, borderWidth, useFixedPosition, max, containerAnimation, self._endClamp && "_endClamp")) || -0.001; 44633 offset = 0; 44634 i = triggerIndex; 44635 while(i--){ 44636 curTrigger = _triggers[i]; 44637 curPin = curTrigger.pin; 44638 if (curPin && curTrigger.start - curTrigger._pinPush <= start && !containerAnimation && curTrigger.end > 0) { 44639 cs = curTrigger.end - (self._startClamp ? Math.max(0, curTr
44639igger.start) : curTrigger.start); 44640 if ((curPin === trigger && curTrigger.start - curTrigger._pinPush < start || curPin === pinnedContainer) && isNaN(parsedStart)) // numeric start values shouldn't be offset at all - treat them as absolute 44641 offset += cs * (1 - curTrigger.progress); 44642 curPin === pin && (otherPinOffset += cs); 44643 } 44644 } 44645 start += offset; 44646 end += offset; 44647 self._startClamp && (self._startClamp += offset); 44648 if (self._endClamp && !_refreshingAll) { 44649 self._endClamp = end || -0.001; 44650 end = Math.min(end, _maxScroll(scroller, direction)); 44651 } 44652 change = end - start || (start -= 0.01) && 0.001; 44653 if (isFirstRefresh) // on the very first refresh(), the prevProgress couldn't have been accurate yet because the start/end were never calculated, so we set it here. Before 3.11.5, it could lead to an inaccurate scroll position restoration with snapping. 44654 prevProgress = gsap.utils.clamp(0, 1, gsap.utils.normalize(start, end, prevScroll)); 44655 self._pinPush = otherPinOffset; 44656 if (markerStart && offset) { 44657 // offset the markers if necessary 44658 cs = {}; 44659 cs[direction.a] = "+=" + offset; 44660 pinnedContainer && (cs[direction.p] = "-=" + scrollFunc()); 44661 gsap.set([ 44662 markerStart, 44663 markerEnd 44664 ], cs); 44665 } 44666 if (pin && !(_clampingMax && self.end >= _maxScroll(scroller, direction))) { 44667 cs = _getComputedStyle(pin); 44668 isVertical = direction === (0, _observerJs._vertical); 44669 scroll = scrollFunc(); // recalculate because the triggers can affect the scroll 44670 pinStart = parseFloat(pinGetter(direction.a)) + otherPinOffset; 44671 if (!max && end > 1) { 44672 // makes sure the scroller has a scrollbar, otherwise if something has width: 100%, for example, it would be too big (exclude the scrollbar). See https://gsap.com/forums/topic/25182-scrolltrigger-width-of-page-increase-where-markers-are-set-to-false/ 44673 forcedOverflow = (isViewport ? _doc.scrollingElement || _docEl : scroller).style; 44674 forcedOverflow = { 44675 style: forcedOverflow, 44676 value: forcedOverflow["overflow" + direction.a.toUpperCase()] 44677 }; 44678 if (isViewport && _getComputedStyle(_body)["overflow" + direction.a.toUpperCase()] !== "scroll") // avoid an extra scrollbar if BOTH <html> and <body> have overflow set to "scroll" 44679 forcedOverflow.style["overflow" + direction.a.toUpperCase()] = "scroll"; 44680 } 44681 _swapPinIn(pin, spacer, cs); 44682 pinState = _getState(pin); // transforms will interfere with the top/left/right/bottom placement, so remove them temporarily. getBoundingClientRect() factors in transforms. 44683 bounds = _getBounds(pin, true); 44684 oppositeScroll = useFixedPosition && (0, _observerJs._getScrollFunc)(scroller, isVertical ? (0, _observerJs._horizontal) : (0, _observerJs._vertical))(); 44685 if (pinSpacing) { 44686 spacerState = [ 44687 pinSpacing + direction.os2, 44688 change + otherPinOffset + _px 44689 ]; 44690 spacerState.t = spacer; 44691 i = pinSpacing === _padding ? _getSize(pin, direction) + change + otherPinOffset : 0; 44692 if (i) { 44693 spacerState.push(direction.d, i + _px); // for box-sizing: border-box (must include padding). 44694 spacer.style.flexBasis !== "auto" && (spacer.style.flexBasis = i + _px); 44695 } 44696 _setState(spacerState); 44697 if (pinnedContainer) // in ScrollTrigger.refresh(), we need to re-evaluate the pinContainer's size because this pinSpacing may stretch it out, but we can't just add the exact distance because depending on layout, it may not push things down or it may only do so partially.
vendor: 10,970 bytes, lines 44698-44828
44698 _triggers.forEach(function(t) { 44699 if (t.pin === pinnedContainer && t.vars.pinSpacing !== false) t._subPinOffset = true; 44700 }); 44701 useFixedPosition && scrollFunc(prevScroll); 44702 } else { 44703 i = _getSize(pin, direction); 44704 i && spacer.style.flexBasis !== "auto" && (spacer.style.flexBasis = i + _px); 44705 } 44706 if (useFixedPosition) { 44707 override = { 44708 top: bounds.top + (isVertical ? scroll - start : oppositeScroll) + _px, 44709 left: bounds.left + (isVertical ? oppositeScroll : scroll - start) + _px, 44710 boxSizing: "border-box", 44711 position: "fixed" 44712 }; 44713 override[_width] = override["max" + _Width] = Math.ceil(bounds.width) + _px; 44714 override[_height] = override["max" + _Height] = Math.ceil(bounds.height) + _px; 44715 override[_margin] = override[_margin + _Top] = override[_margin + _Right] = override[_margin + _Bottom] = override[_margin + _Left] = "0"; 44716 override[_padding] = cs[_padding]; 44717 override[_padding + _Top] = cs[_padding + _Top]; 44718 override[_padding + _Right] = cs[_padding + _Right]; 44719 override[_padding + _Bottom] = cs[_padding + _Bottom]; 44720 override[_padding + _Left] = cs[_padding + _Left]; 44721 pinActiveState = _copyState(pinOriginalState, override, pinReparent); 44722 _refreshingAll && scrollFunc(0); 44723 } 44724 if (animation) { 44725 // the animation might be affecting the transform, so we must jump to the end, check the value, and compensate accordingly. Otherwise, when it becomes unpinned, the pinSetter() will get set to a value that doesn't include whatever the animation did. 44726 initted = animation._initted; // if not, we must invalidate() after this step, otherwise it could lock in starting values prematurely. 44727 _suppressOverwrites(1); 44728 animation.render(animation.duration(), true, true); 44729 pinChange = pinGetter(direction.a) - pinStart + change + otherPinOffset; 44730 pinMoves = Math.abs(change - pinChange) > 1; 44731 useFixedPosition && pinMoves && pinActiveState.splice(pinActiveState.length - 2, 2); // transform is the last property/value set in the state Array. Since the animation is controlling that, we should omit it. 44732 animation.render(0, true, true); 44733 initted || animation.invalidate(true); 44734 animation.parent || animation.totalTime(animation.totalTime()); // if, for example, a toggleAction called play() and then refresh() happens and when we render(1) above, it would cause the animation to complete and get removed from its parent, so this makes sure it gets put back in. 44735 _suppressOverwrites(0); 44736 } else pinChange = change; 44737 forcedOverflow && (forcedOverflow.value ? forcedOverflow.style["overflow" + direction.a.toUpperCase()] = forcedOverflow.value : forcedOverflow.style.removeProperty("overflow-" + direction.a)); 44738 } else if (trigger && scrollFunc() && !containerAnimation) { 44739 // it may be INSIDE a pinned element, so walk up the tree and look for any elements with _pinOffset to compensate because anything with pinSpacing that's already scrolled would throw off the measurements in getBoundingClientRect() 44740 bounds = trigger.parentNode; 44741 while(bounds && bounds !== _body){ 44742 if (bounds._pinOffset) { 44743 start -= bounds._pinOffset; 44744 end -= bounds._pinOffset; 44745 } 44746 bounds = bounds.parentNode; 44747 } 44748 } 44749 revertedPins && revertedPins.forEach(function(t) { 44750 return t.revert(false, true); 44751 }); 44752 self.start = start; 44753 self.end = end; 44754 scroll1 = scroll2 = _refreshingAll ? prevScroll : scrollFunc(); // reset velocity 44755 if (!containerAnimation && !_refreshingAll) { 44756 scroll1 < prevScroll && scrollFunc(prevScroll); 44757 self.scroll.rec = 0; 44758 } 44759 self.revert(false, true); 44760 lastRefresh = _getTime(); 44761 if (snapDelayedCall) { 44762 lastSnap = -1; // just so snapping gets re-enabled, clear out any recorded last value 44763 // self.isActive && scrollFunc(start + change * prevProgress); // previously this line was here to ensure that when snapping kicks in, it's from the previous progress but in some cases that's not desirable, like an all-page ScrollTrigger when new content gets added to the page, that'd totally change the progress. 44764 snapDelayedCall.restart(true); 44765 } 44766 _refreshing = 0; 44767 animation && isToggle && (animation._initted || prevAnimProgress) && animation.progress() !== prevAnimProgress && animation.progress(prevAnimProgress || 0, true).render(animation.time(), true, true); // must force a re-render because if saveStyles() was used on the target(s), the styles could have been wiped out during the refresh(). 44768 if (isFirstRefresh || prevProgress !== self.progress || containerAnimation || invalidateOnRefresh || animation && !animation._initted) { 44769 // ensures that the direction is set properly (when refreshing, progress is set back to 0 initially, then back again to wherever it needs to be) and that callbacks are triggered. 44770 animation && !isToggle && (animation._initted || prevProgress || animation.vars.immediateRender !== false) && animation.totalProgress(containerAnimation && start < -0.001 && !prevProgress ? gsap.utils.normalize(start, end, 0) : prevProgress, true); // to avoid issues where animation callbacks like onStart aren't triggered. 44771 self.progress = isFirstRefresh || (scroll1 - start) / change === prevProgress ? 0 : prevProgress; 44772 } 44773 pin && pinSpacing && (spacer._pinOffset = Math.round(self.progress * pinChange)); 44774 scrubTween && scrubTween.invalidate(); 44775 if (!isNaN(markerStartOffset)) { 44776 // numbers were passed in for the position which are absolute, so instead of just putting the markers at the very bottom of the viewport, we figure out how far they shifted down (it's safe to assume they were originally positioned in closer relation to the trigger element with values like "top", "center", a percentage or whatever, so we offset that much in the opposite direction to basically revert them to the relative position thy were at previously. 44777 markerStartOffset -= gsap.getProperty(markerStartTrigger, direction.p); 44778 markerEndOffset -= gsap.getProperty(markerEndTrigger, direction.p); 44779 _shiftMarker(markerStartTrigger, direction, markerStartOffset); 44780 _shiftMarker(markerStart, direction, markerStartOffset - (pinOffset || 0)); 44781 _shiftMarker(markerEndTrigger, direction, markerEndOffset); 44782 _shiftMarker(markerEnd, direction, markerEndOffset - (pinOffset || 0)); 44783 } 44784 isFirstRefresh && !_refreshingAll && self.update(); // edge case - when you reload a page when it's already scrolled down, some browsers fire a "scroll" event before DOMContentLoaded, triggering an updateAll(). If we don't update the self.progress as part of refresh(), then when it happens next, it may record prevProgress as 0 when it really shouldn't, potentially causing a callback in an animation to fire again. 44785 if (onRefresh && !_refreshingAll && !executingOnRefresh) { 44786 // when refreshing all, we do extra work to correct pinnedContainer sizes and ensure things don't exceed the maxScroll, so we should do all the refreshes at the end after all that work so that the start/end values are corrected. 44787 executingOnRefresh = true; 44788 onRefresh(self); 44789 executingOnRefresh = false; 44790 } 44791 }; 44792 self.getVelocity = function() { 44793 return (scrollFunc() - scroll2) / (_getTime() - _time2) * 1000 || 0; 44794 }; 44795 self.endAnimation = function() { 44796 _endAnimation(self.callbackAnimation); 44797 if (animation) scrubTween ? scrubTween.progress(1) : !animation.paused() ? _endAnimation(animation, animation.reversed()) : isToggle || _endAnimation(animation, self.direction < 0, 1); 44798 }; 44799 self.labelToScroll = function(label) { 44800 return animation && animation.labels && (start || self.refresh() || start) + animation.labels[label] / animation.duration() * change || 0; 44801 }; 44802 self.getTrailing = function(name) { 44803 var i = _triggers.indexOf(self), a = self.direction > 0 ? _triggers.slice(0, i).reverse() : _triggers.slice(i + 1); 44804 return (_isString(name) ? a.filter(function(t) { 44805 return t.vars.preventOverlaps === name; 44806 }) : a).filter(function(t) { 44807 return self.direction > 0 ? t.end <= start : t.start >= end; 44808 }); 44809 }; 44810 self.update = function(reset, recordVelocity, forceFake) { 44811 if (containerAnimation && !forceFake && !reset) return; 44812 var scroll = _refreshingAll === true ? prevScroll : self.scroll(), p = reset ? 0 : (scroll - start) / change, clipped = p < 0 ? 0 : p > 1 ? 1 : p || 0, prevProgress = self.progress, isActive, wasActive, toggleState, action, stateChanged, toggled, isAtMax, isTakingAction; 44813 if (recordVelocity) { 44814 scroll2 = scroll1; 44815 scroll1 = containerAnimation ? scrollFunc() : scroll; 44816 if (snap) { 44817 snap2 = snap1; 44818 snap1 = animation && !isToggle ? animation.totalProgress() : clipped; 44819 } 44820 } // anticipate the pinning a few ticks ahead of time based on velocity to avoid a visual glitch due to the fact that most browsers do scrolling on a separate thread (not synced with requestAnimationFrame). 44821 if (anticipatePin && pin && !_refreshing && !_startup && _lastScrollTime) { 44822 if (!clipped && start < scroll + (scroll - scroll2) / (_getTime() - _time2) * anticipatePin) clipped = 0.0001; 44823 else if (clipped === 1 && end > scroll + (scroll - scroll2) / (_getTime() - _time2) * anticipatePin) clipped = 0.9999; 44824 } 44825 if (clipped !== prevProgress && self.enabled) { 44826 isActive = self.isActive = !!clipped && clipped < 1; 44827 wasActive = !!prevProgress && prevProgress < 1; 44828 toggled = isActive !== wasActive;
44829 stateChanged = toggled || !!clipped !== !!prevProgress; // could go from start all the way to end, thus it didn't toggle but it did change state in a sense (may need to fire a callback) 44830 self.direction = clipped > prevProgress ? 1 : -1; 44831 self.progress = clipped; 44832 if (stateChanged && !_refreshing) { 44833 toggleState = clipped && !prevProgress ? 0 : clipped === 1 ? 1 : prevProgress === 1 ? 2 : 3; // 0 = enter, 1 = leave, 2 = enterBack, 3 = leaveBack (we prioritize the FIRST encounter, thus if you scroll really fast past the onEnter and onLeave in one tick, it'd prioritize onEnter. 44834 if (isToggle) { 44835 action = !toggled && toggleActions[toggleState + 1] !== "none" && toggleActions[toggleState + 1] || toggleActions[toggleState]; // if it didn't toggle, that means it shot right past and since we prioritize the "enter" action, we should switch to the "leave" in this case (but only if one is defined) 44836 isTakingAction = animation && (action === "complete" || action === "reset" || action in animation); 44837 } 44838 } 44839 preventOverlaps && (toggled || isTakingAction) && (isTakingAction || scrub || !animation) && (_isFunction(preventOverlaps) ? preventOverlaps(self) : self.getTrailing(preventOverlaps).forEach(function(t) { 44840 return t.endAnimation(); 44841 })); 44842 if (!isToggle) { 44843 if (scrubTween && !_refreshing && !_startup) { 44844 scrubTween._dp._time - scrubTween._start !== scrubTween._time && scrubTween.render(scrubTween._dp._time - scrubTween._start); // if there's a scrub on both the container animation and this one (or a ScrollSmoother), the update order would cause this one not to have rendered yet, so it wouldn't make any progress before we .restart() it heading toward the new progress so it'd appear stuck thus we force a render here. 44845 if (scrubTween.resetTo) scrubTween.resetTo("totalProgress", clipped, animation._tTime / animation._tDur); 44846 else { 44847 // legacy support (courtesy), before 3.10.0 44848 scrubTween.vars.totalProgress = clipped; 44849 scrubTween.invalidate().restart(); 44850 } 44851 } else if (animation) animation.totalProgress(clipped, !!(_refreshing && (lastRefresh || reset))); 44852 } 44853 if (pin) { 44854 reset && pinSpacing && (spacer.style[pinSpacing + direction.os2] = spacingStart); 44855 if (!useFixedPosition) pinSetter(_round(pinStart + pinChange * clipped)); 44856 else if (stateChanged) { 44857 isAtMax = !reset && clipped > prevProgress && end + 1 > scroll && scroll + 1 >= _maxScroll(scroller, direction); // if it's at the VERY end of the page, don't switch away from position: fixed because it's pointless and it could cause a brief flash when the user scrolls back up (when it gets pinned again) 44858 if (pinReparent) { 44859 if (!reset && (isActive || isAtMax)) { 44860 var bounds = _getBounds(pin, true), _offset = scroll - start; 44861 _reparent(pin, _body, bounds.top + (direction === (0, _observerJs._vertical) ? _offset : 0) + _px, bounds.left + (direction === (0, _observerJs._vertical) ? 0 : _offset) + _px); 44862 } else _reparent(pin, spacer); 44863 } 44864 _setState(isActive || isAtMax ? pinActiveState : pinState); 44865 pinMoves && clipped < 1 && isActive || pinSetter(pinStart + (clipped === 1 && !isAtMax ? pinChange : 0)); 44866 } 44867 } 44868 snap && !tweenTo.tween && !_refreshing && !_startup && snapDelayedCall.restart(true); 44869 toggleClass && (toggled || once && clipped && (clipped < 1 || !_limitCallbacks)) && _toArray(toggleClass.targets).forEac
vendor: 4,498 bytes, lines 44869-44934
44869h(function(el) { 44870 return el.classList[isActive || once ? "add" : "remove"](toggleClass.className); 44871 }); // classes could affect positioning, so do it even if reset or refreshing is true. 44872 onUpdate && !isToggle && !reset && onUpdate(self); 44873 if (stateChanged && !_refreshing) { 44874 if (isToggle) { 44875 if (isTakingAction) { 44876 if (action === "complete") animation.pause().totalProgress(1); 44877 else if (action === "reset") animation.restart(true).pause(); 44878 else if (action === "restart") animation.restart(true); 44879 else animation[action](); 44880 } 44881 onUpdate && onUpdate(self); 44882 } 44883 if (toggled || !_limitCallbacks) { 44884 // on startup, the page could be scrolled and we don't want to fire callbacks that didn't toggle. For example onEnter shouldn't fire if the ScrollTrigger isn't actually entered. 44885 onToggle && toggled && _callback(self, onToggle); 44886 callbacks[toggleState] && _callback(self, callbacks[toggleState]); 44887 once && (clipped === 1 ? self.kill(false, 1) : callbacks[toggleState] = 0); // a callback shouldn't be called again if once is true. 44888 if (!toggled) { 44889 // it's possible to go completely past, like from before the start to after the end (or vice-versa) in which case BOTH callbacks should be fired in that order 44890 toggleState = clipped === 1 ? 1 : 3; 44891 callbacks[toggleState] && _callback(self, callbacks[toggleState]); 44892 } 44893 } 44894 if (fastScrollEnd && !isActive && Math.abs(self.getVelocity()) > (_isNumber(fastScrollEnd) ? fastScrollEnd : 2500)) { 44895 _endAnimation(self.callbackAnimation); 44896 scrubTween ? scrubTween.progress(1) : _endAnimation(animation, action === "reverse" ? 1 : !clipped, 1); 44897 } 44898 } else if (isToggle && onUpdate && !_refreshing) onUpdate(self); 44899 } // update absolutely-positioned markers (only if the scroller isn't the viewport) 44900 if (markerEndSetter) { 44901 var n = containerAnimation ? scroll / containerAnimation.duration() * (containerAnimation._caScrollDist || 0) : scroll; 44902 markerStartSetter(n + (markerStartTrigger._isFlipped ? 1 : 0)); 44903 markerEndSetter(n); 44904 } 44905 caMarkerSetter && caMarkerSetter(-scroll / containerAnimation.duration() * (containerAnimation._caScrollDist || 0)); 44906 }; 44907 self.enable = function(reset, refresh) { 44908 if (!self.enabled) { 44909 self.enabled = true; 44910 _addListener(scroller, "resize", _onResize); 44911 isViewport || _addListener(scroller, "scroll", _onScroll); 44912 onRefreshInit && _addListener(ScrollTrigger, "refreshInit", onRefreshInit); 44913 if (reset !== false) { 44914 self.progress = prevProgress = 0; 44915 scroll1 = scroll2 = lastSnap = scrollFunc(); 44916 } 44917 refresh !== false && self.refresh(); 44918 } 44919 }; 44920 self.getTween = function(snap) { 44921 return snap && tweenTo ? tweenTo.tween : scrubTween; 44922 }; 44923 self.setPositions = function(newStart, newEnd, keepClamp, pinOffset) { 44924 // doesn't persist after refresh()! Intended to be a way to override values that were set during refresh(), like you could set it in onRefresh() 44925 if (containerAnimation) { 44926 // convert ratios into scroll positions. Remember, start/end values on ScrollTriggers that have a containerAnimation refer to the time (in seconds), NOT scroll positions. 44927 var st = containerAnimation.scrollTrigger, duration = containerAnimation.duration(), _change = st.end - st.start; 44928 newStart = st.start + _change * newStart / duration; 44929 newEnd = st.start + _change * newEnd / duration; 44930 } 44931 self.refresh(false, false, { 44932 start: _keepClamp(newStart, keepClamp && !!self._startClamp), 44933 end: _keepClamp(newEnd, keepClamp && !!self._endClamp) 44934 }, pinOffset);
vendor: 5,063 bytes, lines 44935-45014
44935 self.update(); 44936 }; 44937 self.adjustPinSpacing = function(amount) { 44938 if (spacerState && amount) { 44939 var i = spacerState.indexOf(direction.d) + 1; 44940 spacerState[i] = parseFloat(spacerState[i]) + amount + _px; 44941 spacerState[1] = parseFloat(spacerState[1]) + amount + _px; 44942 _setState(spacerState); 44943 } 44944 }; 44945 self.disable = function(reset, allowAnimation) { 44946 if (self.enabled) { 44947 reset !== false && self.revert(true, true); 44948 self.enabled = self.isActive = false; 44949 allowAnimation || scrubTween && scrubTween.pause(); 44950 prevScroll = 0; 44951 pinCache && (pinCache.uncache = 1); 44952 onRefreshInit && _removeListener(ScrollTrigger, "refreshInit", onRefreshInit); 44953 if (snapDelayedCall) { 44954 snapDelayedCall.pause(); 44955 tweenTo.tween && tweenTo.tween.kill() && (tweenTo.tween = 0); 44956 } 44957 if (!isViewport) { 44958 var i = _triggers.length; 44959 while(i--){ 44960 if (_triggers[i].scroller === scroller && _triggers[i] !== self) return; //don't remove the listeners if there are still other triggers referencing it. 44961 } 44962 _removeListener(scroller, "resize", _onResize); 44963 isViewport || _removeListener(scroller, "scroll", _onScroll); 44964 } 44965 } 44966 }; 44967 self.kill = function(revert, allowAnimation) { 44968 self.disable(revert, allowAnimation); 44969 scrubTween && !allowAnimation && scrubTween.kill(); 44970 id && delete _ids[id]; 44971 var i = _triggers.indexOf(self); 44972 i >= 0 && _triggers.splice(i, 1); 44973 i === _i && _direction > 0 && _i--; // if we're in the middle of a refresh() or update(), splicing would cause skips in the index, so adjust... 44974 // if no other ScrollTrigger instances of the same scroller are found, wipe out any recorded scroll position. Otherwise, in a single page application, for example, it could maintain scroll position when it really shouldn't. 44975 i = 0; 44976 _triggers.forEach(function(t) { 44977 return t.scroller === self.scroller && (i = 1); 44978 }); 44979 i || _refreshingAll || (self.scroll.rec = 0); 44980 if (animation) { 44981 animation.scrollTrigger = null; 44982 revert && animation.revert({ 44983 kill: false 44984 }); 44985 allowAnimation || animation.kill(); 44986 } 44987 markerStart && [ 44988 markerStart, 44989 markerEnd, 44990 markerStartTrigger, 44991 markerEndTrigger 44992 ].forEach(function(m) { 44993 return m.parentNode && m.parentNode.removeChild(m); 44994 }); 44995 _primary === self && (_primary = 0); 44996 if (pin) { 44997 pinCache && (pinCache.uncache = 1); 44998 i = 0; 44999 _triggers.forEach(function(t) { 45000 return t.pin === pin && i++; 45001 }); 45002 i || (pinCache.spacer = 0); // if there aren't any more ScrollTriggers with the same pin, remove the spacer, otherwise it could be contaminated with old/stale values if the user re-creates a ScrollTrigger for the same element. 45003 } 45004 vars.onKill && vars.onKill(self); 45005 }; 45006 _triggers.push(self); 45007 self.enable(false, false); 45008 customRevertReturn && customRevertReturn(self); 45009 if (animation && animation.add && !change) { 45010 // if the animation is a timeline, it may not have been populated yet, so it wouldn't render at the proper place on the first refresh(), thus we should schedule one for the next tick. If "change" is defined, we know it must be re-enabling, thus we can refresh() right away. 45011 var updateFunc = self.update; // some browsers may fire a scroll event BEFORE a tick elapses and/or the DOMContentLoaded fires. So there's a chance update() will be called BEFORE a refresh() has happened on a Timeline-attached ScrollTrigger which means the start/end won't be calculated yet. We don't want to add conditional logic inside the update() method (like check to see if end is defined and if not, force a refresh()) because that's a function that gets hit a LOT (performance). So we swap out the real update() method for this one that'll re-attach it the first time it gets called and of course forces a refresh(). 45012 self.update = function() { 45013 self.update = updateFunc; 45014 (0, _observerJs._scrollers).cache++; // otherwise a cached scroll position may get used in the refresh() in a very rare scenario, like if ScrollTriggers are created inside a DOMContentLoaded event and the queued requestAnimationFrame() fires beforehand. See https://gsap.com/community/forums/topic/41267-scrolltrigger-breaks-on-refresh-when-u
45014sing-domcontentloaded/ 45015 start || end || self.refresh(); 45016 }; 45017 gsap.delayedCall(0.01, self.update); 45018 change = 0.01; 45019 start = end = 0; 45020 } else self.refresh(); 45021 pin && _queueRefreshAll(); // pinning could affect the positions of other things, so make sure we queue a full refresh() 45022 }; 45023 ScrollTrigger.register = function register(core) { 45024 if (!_coreInitted) { 45025 gsap = core || _getGSAP(); 45026 _windowExists() && window.document && ScrollTrigger.enable(); 45027 _coreInitted = _enabled; 45028 } 45029 return _coreInitted; 45030 }; 45031 ScrollTrigger.defaults = function defaults(config) { 45032 if (config) for(var p in config)_defaults[p] = config[p]; 45033 return _defaults; 45034 }; 45035 ScrollTrigger.disable = function disable(reset, kill) { 45036 _enabled = 0; 45037 _triggers.forEach(function(trigger) { 45038 return trigger[kill ? "kill" : "disable"](reset); 45039 }); 45040 _removeListener(_win, "wheel", _onScroll); 45041 _removeListener(_doc, "scroll", _onScroll); 45042 clearInterval(_syncInterval); 45043 _removeListener(_doc, "touchcancel", _passThrough); 45044 _removeListener(_body, "touchstart", _passThrough); 45045 _multiListener(_removeListener, _doc, "pointerdown,touchstart,mousedown", _pointerDownHandler); 45046 _multiListener(_removeListener, _doc, "pointerup,touchend,mouseup", _pointerUpHandler); 45047 _resizeDelay.kill(); 45048 _iterateAutoRefresh(_removeListener); 45049 for(var i = 0; i < (0, _observerJs._scrollers).length; i += 3){ 45050 _wheelListener(_removeListener, (0, _observerJs._scrollers)[i], (0, _observerJs._scrollers)[i + 1]); 45051 _wheelListener(_removeListener, (0, _observerJs._scrollers)[i], (0, _observerJs._scrollers)[i + 2]); 45052 } 45053 }; 45054 ScrollTrigger.enable = function enable() { 45055 _win = window; 45056 _doc = document; 45057 _docEl = _doc.documentElement; 45058 _body = _doc.body; 45059 if (gsap) { 45060 _toArray = gsap.utils.toArray; 45061 _clamp = gsap.utils.clamp; 45062 _context = gsap.core.context || _passThrough; 45063 _suppressOverwrites = gsap.core.suppressOverwrites || _passThrough; 45064 _scrollRestoration = _win.history.scrollRestoration || "auto"; 45065 _lastScroll = _win.pageYOffset || 0; 45066 gsap.core.globals("ScrollTrigger", ScrollTrigger); // must register the global manually because in Internet Explorer, functions (classes) don't have a "name" property. 45067 if (_body) { 45068 _enabled = 1; 45069 _div100vh = document.createElement("div"); // to solve mobile browser address bar show/hide resizing, we shouldn't rely on window.innerHeight. Instead, use a <div> with its height set to 100vh and measure that since that's what the scrolling is based on anyway and it's not affected by address bar showing/hiding. 45070 _div100vh.style.height = "100vh"; 45071 _div100vh.style.position = "absolute"; 45072 _refresh100vh(); 45073 _rafBugFix(); 45074 (0, _observerJs.Observer).register(gsap); // isTouch is 0 if no touch, 1 if ONLY touch, and 2 if it can accommodate touch but also other types like mouse/pointer. 45075 ScrollTrigger.isTouch = (0, _observerJs.Observer).isTouch; 45076 _fixIOSBug = (0, _observerJs.Observer).isTouch && /(iPad|iPhone|iPod|Mac)/g.test(navigator.userAgent); // since 2017, iOS has had a bug that causes event.clientX/Y to be inaccurate when a scroll occurs, thus we must alternate ignoring every other touchmove event to work around it. See https://bugs.webkit.org/show_bug.cgi?id=181954 and https://codepen.io/GreenSock/pen/ExbrPNa/087cef197dc35445a0951e8935c41503 45077 _ignoreMobileResize = (0, _observerJs.Observer).isTouch === 1; 45078 _addListener(_win, "wheel", _onScroll); // mostly for 3rd party smooth scrolling libraries. 45079 _root = [ 45080 _win, 45081 _doc, 45082 _docEl, 45083 _body 45084 ]; 45085 if (gsap.matchMedia) { 45086 ScrollTrigger.matchMedia = function(vars) { 45087 var mm = gsap.matchMedia(), p; 45088 for(p in vars)mm.add(p, vars[p]); 45089 return mm; 45090 }; 45091 gsap.addEventListener("matchMediaInit", function() { 45092 return _revertAll(); 45093 }); 45094 gsap.addEventListener("matchMediaRevert", function() { 45095 return _revertRecorded(); 45096 }); 45097 gsap.addEventListener("matchMedia", function() { 45098 _refreshAll(0, 1); 45099 _dispatch("matchMedia"); 45100 }); 45101 gsap.matchMedia().add("(orientation: portrait)", function() { 45102 // when orientation changes, we should take new base measurements for the ignoreMobileResize feature. 45103 _setBaseDimensions(); 45104 return _setBaseDimensions; 45105 }); 45106 } else console.warn("Requires GSAP 3.11.0 or later"); 45107 _setBaseDimensions(); 45108 _addListener(_doc, "scroll", _onScroll); // some browsers (like Chrome), the window stops dispatching scroll events on the window if you scroll really fast, but it's consistent on the document! 45109 var bodyHasStyle = _body.hasAttribute("style"), bodyStyle = _body.style, border = bodyStyle.borderTopStyle, AnimationProto = gsap.core.Animation.prototype, bounds, i; 45110 AnimationProto.revert || Object.defineProperty(AnimationProto, "revert", { 45111 value: function value() { 45112 return this.time(-0.01, true); 45113 } 45114 }); // only for backwards compatibility (Animation.revert() was added after 3.10.4) 45115 bodyStyle.borderTopStyle = "solid"; // works around an issue where a margin of a child element could throw off the bounds of the _body, making it seem like there's a margin when there actually isn't. The border ensures that the bounds are accurate. 45116 bounds = _getBounds(_body); 45117 (0, _observerJs._vertical).m = Math.round(bounds.top + (0, _observerJs._vertical).sc()) || 0; // accommodate the offset of the <body> caused by margins and/or padding 45118 (0, _observerJs._horizontal).m = Math.round(bounds.left + (0, _observerJs._horizontal).sc()) || 0; 45119 border ? bodyStyle.borderTopStyle = border : bodyStyle.removeProperty("border-top-style"); 45120 if (!bodyHasStyle) { 45121 // SSR frameworks like Next.js complain if this attribute gets added.
45122 _body.setAttribute("style", ""); // it's not enough to just removeAttribute() - we must first set it to empty, otherwise Next.js complains. 45123 _body.removeAttribute("style"); 45124 } // TODO: (?) maybe move to leveraging the velocity mechanism in Observer and skip intervals. 45125 _syncInterval = setInterval(_sync, 250); 45126 gsap.delayedCall(0.5, function() { 45127 return _startup = 0; 45128 }); 45129 _addListener(_doc, "touchcancel", _passThrough); // some older Android devices intermittently stop dispatching "touchmove" events if we don't listen for "touchcancel" on the document. 45130 _addListener(_body, "touchstart", _passThrough); //works around Safari bug: https://gsap.com/forums/topic/21450-draggable-in-iframe-on-mobile-is-buggy/ 45131 _multiListener(_addListener, _doc, "pointerdown,touchstart,mousedown", _pointerDownHandler); 45132 _multiListener(_addListener, _doc, "pointerup,touchend,mouseup", _pointerUpHandler); 45133 _transformProp = gsap.utils.checkPrefix("transform"); 45134 _stateProps.push(_transformProp); 45135 _coreInitted = _getTime(); 45136 _resizeDelay = gsap.delayedCall(0.2, _refreshAll).pause(); 45137 _autoRefresh = [ 45138 _doc, 45139 "visibilitychange", 45140 function() { 45141 var w = _win.innerWidth, h = _win.innerHeight; 45142 if (_doc.hidden) { 45143 _prevWidth = w; 45144 _prevHeight = h; 45145 } else if (_prevWidth !== w || _prevHeight !== h) _onResize(); 45146 }, 45147 _doc, 45148 "DOMContentLoaded", 45149 _refreshAll, 45150 _win, 45151 "load", 45152 _refreshAll, 45153 _win, 45154 "resize", 45155 _onResize 45156 ]; 45157 _iterateAutoRefresh(_addListener); 45158 _triggers.forEach(function(trigger) { 45159 return trigger.enable(0, 1); 45160 }); 45161 for(i = 0; i < (0, _observerJs._scrollers).length; i += 3){ 45162 _wheelListener(_removeListener, (0, _observerJs._scrollers)[i], (0, _observerJs._scrollers)[i + 1]); 45163 _wheelListener(_removeListener, (0, _observerJs._scrollers)[i], (0, _observerJs._scrollers)[i + 2]); 45164 } 45165 } 45166 } 45167 }; 45168 ScrollTrigger.config = function config(vars) { 45169 "limitCallbacks" in vars && (_limitCallbacks = !!vars.limitCallbacks); 45170 var ms = vars.syncInterval; 45171 ms && clearInterval(_syncInterval) || (_syncInterval = ms) && setInterval(_sync, ms); 45172 "ignoreMobileResize" in vars && (_ignoreMobileResize = ScrollTrigger.isTouch === 1 && vars.ignoreMobileResize); 45173 if ("autoRefreshEvents" in vars) { 45174 _iterateAutoRefresh(_removeListener) || _iterateAutoRefresh(_addListener, vars.autoRefreshEvents || "none"); 45175 _ignoreResize = (vars.autoRefreshEvents + "").indexOf("resize") === -1; 45176 } 45177 }; 45178 ScrollTrigger.scrollerProxy = function scrollerProxy(target, vars) { 45179 var t = (0, _observerJs._getTarget)(target), i = (0, _observerJs._scrollers).indexOf(t), isViewport = _isViewport(t); 45180 if (~i) (0, _observerJs._scrollers).splice(i, isViewport ? 6 : 2); 45181 if (vars) isViewport ? (0, _observerJs._proxies).unshift(_win, vars, _body, vars, _docEl, vars) : (0, _observerJs._proxies).unshift(t, vars); 45182 }; 45183 ScrollTrigger.clearMatchMedia = function clearMatchMedia(query) { 45184 _triggers.forEach(function(t) { 45185 return t._ctx && t._ctx.query === query && t._ctx.kill(true, true); 45186 }); 45187 }; 45188 ScrollTrigger.isInViewport = function isInViewport(element, ratio, horizontal) { 45189 var bounds = (_isString(element) ? (0, _observerJs._getTarget)(element) : element).getBoundingClientRect(), offset = bounds[horizontal ? _width : _height] * ratio || 0; 45190 return horizontal ? bounds.right - offset > 0 && bounds.left + offset < _win.innerWidth : bounds.bottom - offset > 0 && bounds.top + offset < _win.innerHeight; 45191 }; 45192 ScrollTrigger.positionInViewport = function positionInViewport(element, referencePoint, horizontal) { 45193 _isString(element) && (element = (0, _observerJs._getTarget)(element)); 45194 var bounds = element.getBoundingClientRect(), size = bounds[horizontal ? _width : _height], offset = referencePoint == null ? size / 2 : referencePoint in _keywords ? _keywords[referencePoint] * size : ~referencePoint.indexOf("%") ? parseFloat(referencePoint) * size / 100 : parseFloat(referencePoint) || 0; 45195 return horizontal ? (bounds.left + offset) / _win.innerWidth : (bounds.top + offset) / _win.innerHeight; 45196 }; 45197 ScrollTrigger.killAll = function killAll(allowListeners) {
vendor: 6,558 bytes, lines 45198-45325
45198 _triggers.slice(0).forEach(function(t) { 45199 return t.vars.id !== "ScrollSmoother" && t.kill(); 45200 }); 45201 if (allowListeners !== true) { 45202 var listeners = _listeners.killAll || []; 45203 _listeners = {}; 45204 listeners.forEach(function(f) { 45205 return f(); 45206 }); 45207 } 45208 }; 45209 return ScrollTrigger; 45210}(); 45211ScrollTrigger.version = "3.13.0"; 45212ScrollTrigger.saveStyles = function(targets) { 45213 return targets ? _toArray(targets).forEach(function(target) { 45214 // saved styles are recorded in a consecutive alternating Array, like [element, cssText, transform attribute, cache, matchMedia, ...] 45215 if (target && target.style) { 45216 var i = _savedStyles.indexOf(target); 45217 i >= 0 && _savedStyles.splice(i, 5); 45218 _savedStyles.push(target, target.style.cssText, target.getBBox && target.getAttribute("transform"), gsap.core.getCache(target), _context()); 45219 } 45220 }) : _savedStyles; 45221}; 45222ScrollTrigger.revert = function(soft, media) { 45223 return _revertAll(!soft, media); 45224}; 45225ScrollTrigger.create = function(vars, animation) { 45226 return new ScrollTrigger(vars, animation); 45227}; 45228ScrollTrigger.refresh = function(safe) { 45229 return safe ? _onResize(true) : (_coreInitted || ScrollTrigger.register()) && _refreshAll(true); 45230}; 45231ScrollTrigger.update = function(force) { 45232 return ++(0, _observerJs._scrollers).cache && _updateAll(force === true ? 2 : 0); 45233}; 45234ScrollTrigger.clearScrollMemory = _clearScrollMemory; 45235ScrollTrigger.maxScroll = function(element, horizontal) { 45236 return _maxScroll(element, horizontal ? (0, _observerJs._horizontal) : (0, _observerJs._vertical)); 45237}; 45238ScrollTrigger.getScrollFunc = function(element, horizontal) { 45239 return (0, _observerJs._getScrollFunc)((0, _observerJs._getTarget)(element), horizontal ? (0, _observerJs._horizontal) : (0, _observerJs._vertical)); 45240}; 45241ScrollTrigger.getById = function(id) { 45242 return _ids[id]; 45243}; 45244ScrollTrigger.getAll = function() { 45245 return _triggers.filter(function(t) { 45246 return t.vars.id !== "ScrollSmoother"; 45247 }); 45248}; // it's common for people to ScrollTrigger.getAll(t => t.kill()) on page routes, for example, and we don't want it to ruin smooth scrolling by killing the main ScrollSmoother one. 45249ScrollTrigger.isScrolling = function() { 45250 return !!_lastScrollTime; 45251}; 45252ScrollTrigger.snapDirectional = _snapDirectional; 45253ScrollTrigger.addEventListener = function(type, callback) { 45254 var a = _listeners[type] || (_listeners[type] = []); 45255 ~a.indexOf(callback) || a.push(callback); 45256}; 45257ScrollTrigger.removeEventListener = function(type, callback) { 45258 var a = _listeners[type], i = a && a.indexOf(callback); 45259 i >= 0 && a.splice(i, 1); 45260}; 45261ScrollTrigger.batch = function(targets, vars) { 45262 var result = [], varsCopy = {}, interval = vars.interval || 0.016, batchMax = vars.batchMax || 1e9, proxyCallback = function proxyCallback(type, callback) { 45263 var elements = [], triggers = [], delay = gsap.delayedCall(interval, function() { 45264 callback(elements, triggers); 45265 elements = []; 45266 triggers = []; 45267 }).pause(); 45268 return function(self) { 45269 elements.length || delay.restart(true); 45270 elements.push(self.trigger); 45271 triggers.push(self); 45272 batchMax <= elements.length && delay.progress(1); 45273 }; 45274 }, p; 45275 for(p in vars)varsCopy[p] = p.substr(0, 2) === "on" && _isFunction(vars[p]) && p !== "onRefreshInit" ? proxyCallback(p, vars[p]) : vars[p]; 45276 if (_isFunction(batchMax)) { 45277 batchMax = batchMax(); 45278 _addListener(ScrollTrigger, "refresh", function() { 45279 return batchMax = vars.batchMax(); 45280 }); 45281 } 45282 _toArray(targets).forEach(function(target) { 45283 var config = {}; 45284 for(p in varsCopy)config[p] = varsCopy[p]; 45285 config.trigger = target; 45286 result.push(ScrollTrigger.create(config)); 45287 }); 45288 return result; 45289}; // to reduce file size. clamps the scroll and also returns a duration multiplier so that if the scroll gets chopped shorter, the duration gets curtailed as well (otherwise if you're very close to the top of the page, for example, and swipe up really fast, it'll suddenly slow down and take a long time to reach the top). 45290var _clampScrollAndGetDurationMultiplier = function _clampScrollAndGetDurationMultiplier(scrollFunc, current, end, max) { 45291 current > max ? scrollFunc(max) : current < 0 && scrollFunc(0); 45292 return end > max ? (max - current) / (end - current) : end < 0 ? current / (current - end) : 1; 45293}, _allowNativePanning = function _allowNativePanning(target, direction) { 45294 if (direction === true) target.style.removeProperty("touch-action"); 45295 else target.style.touchAction = direction === true ? "auto" : direction ? "pan-" + direction + ((0, _observerJs.Observer).isTouch ? " pinch-zoom" : "") : "none"; // note: Firefox doesn't support it pinch-zoom properly, at least in addition to a pan-x or pan-y. 45296 target === _docEl && _allowNativePanning(_body, direction); 45297}, _overflow = { 45298 auto: 1, 45299 scroll: 1 45300}, _nestedScroll = function _nestedScroll(_ref5) { 45301 var event = _ref5.event, target = _ref5.target, axis = _ref5.axis; 45302 var node = (event.changedTouches ? event.changedTouches[0] : event).target, cache = node._gsap || gsap.core.getCache(node), time = _getTime(), cs; 45303 if (!cache._isScrollT || time - cache._isScrollT > 2000) { 45304 // cache for 2 seconds to improve performance. 45305 while(node && node !== _body && (node.scrollHeight <= node.clientHeight && node.scrollWidth <= node.clientWidth || !(_overflow[(cs = _getComputedStyle(node)).overflowY] || _overflow[cs.overflowX])))node = node.parentNode; 45306 cache._isScroll = node && node !== target && !_isViewport(node) && (_overflow[(cs = _getComputedStyle(node)).overflowY] || _overflow[cs.overflowX]); 45307 cache._isScrollT = time; 45308 } 45309 if (cache._isScroll || axis === "x") { 45310 event.stopPropagation(); 45311 event._gsapAllow = true; 45312 } 45313}, // capture events on scrollable elements INSIDE the <body> and allow those by calling stopPropagation() when we find a scrollable ancestor 45314_inputObserver = function _inputObserver(target, type, inputs, nested) { 45315 return (0, _observerJs.Observer).create({ 45316 target: target, 45317 capture: true, 45318 debounce: false, 45319 lockAxis: true, 45320 type: type, 45321 onWheel: nested = nested && _nestedScroll, 45322 onPress: nested, 45323 onDrag: nested, 45324 onScroll: nested, 45325 onEnable: function onEnable() {
45326 return inputs && _addListener(_doc, (0, _observerJs.Observer).eventTypes[0], _captureInputs, false, true); 45327 }, 45328 onDisable: function onDisable() { 45329 return _removeListener(_doc, (0, _observerJs.Observer).eventTypes[0], _captureInputs, true); 45330 } 45331 }); 45332}, _inputExp = /(input|label|select|textarea)/i, _inputIsFocused, _captureInputs = function _captureInputs(e) { 45333 var isInput = _inputExp.test(e.target.tagName); 45334 if (isInput || _inputIsFocused) { 45335 e._gsapAllow = true; 45336 _inputIsFocused = isInput; 45337 } 45338}, _getScrollNormalizer = function _getScrollNormalizer(vars) { 45339 _isObject(vars) || (vars = {}); 45340 vars.preventDefault = vars.isNormalizer = vars.allowClicks = true; 45341 vars.type || (vars.type = "wheel,touch"); 45342 vars.debounce = !!vars.debounce; 45343 vars.id = vars.id || "normalizer"; 45344 var _vars2 = vars, normalizeScrollX = _vars2.normalizeScrollX, momentum = _vars2.momentum, allowNestedScroll = _vars2.allowNestedScroll, onRelease = _vars2.onRelease, self, maxY, target = (0, _observerJs._getTarget)(vars.target) || _docEl, smoother = gsap.core.globals().ScrollSmoother, smootherInstance = smoother && smoother.get(), content = _fixIOSBug && (vars.content && (0, _observerJs._getTarget)(vars.content) || smootherInstance && vars.content !== false && !smootherInstance.smooth() && smootherInstance.content()), scrollFuncY = (0, _observerJs._getScrollFunc)(target, (0, _observerJs._vertical)), scrollFuncX = (0, _observerJs._getScrollFunc)(target, (0, _observerJs._horizontal)), scale = 1, initialScale = ((0, _observerJs.Observer).isTouch && _win.visualViewport ? _win.visualViewport.scale * _win.visualViewport.width : _win.outerWidth) / _win.innerWidth, wheelRefresh = 0, resolveMomentumDuration = _isFunction(momentum) ? function() { 45345 return momentum(self); 45346 } : function() { 45347 return momentum || 2.8; 45348 }, lastRefreshID, skipTouchMove, inputObserver = _inputObserver(target, vars.type, true, allowNestedScroll), resumeTouchMove = function resumeTouchMove() { 45349 return skipTouchMove = false; 45350 }, scrollClampX = _passThrough, scrollClampY = _passThrough, updateClamps = function updateClamps() { 45351 maxY = _maxScroll(target, (0, _observerJs._vertical)); 45352 scrollClampY = _clamp(_fixIOSBug ? 1 : 0, maxY); 45353 normalizeScrollX && (scrollClampX = _clamp(0, _maxScroll(target, (0, _observerJs._horizontal)))); 45354 lastRefreshID = _refreshID; 45355 }, removeContentOffset = function removeContentOffset() { 45356 content._gsap.y = _round(parseFloat(content._gsap.y) + scrollFuncY.offset) + "px"; 45357 content.style.transform = "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, " + parseFloat(content._gsap.y) + ", 0, 1)"; 45358 scrollFuncY.offset = scrollFuncY.cacheID = 0; 45359 }, ignoreDrag = function ignoreDrag() { 45360 if (skipTouchMove) { 45361 requestAnimationFrame(resumeTouchMove); 45362 var offset = _round(self.deltaY / 2), scroll = scrollClampY(scrollFuncY.v - offset); 45363 if (content && scroll !== scrollFuncY.v + scrollFuncY.offset) { 45364 scrollFuncY.offset = scroll - scrollFuncY.v; 45365 var y = _round((parseFloat(content && content._gsap.y) || 0) - scrollFuncY.offset); 45366 content.style.transform = "matrix3d(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, " + y + ", 0, 1)"; 45367 content._gsap.y = y + "px"; 45368 scrollFuncY.cacheID = (0, _observerJs._scrollers).cache; 45369 _updateAll(); 45370 } 45371 return true; 45372 } 45373 scrollFuncY.offset && removeContentOffset(); 45374 skipTouchMove = true; 45375 }, tween, startScrollX, startScrollY, onStopDelayedCall, onResize = function onResize() { 45376 // if the window resizes, like on an iPhone which Apple FORCES the address bar to show/hide even if we event.preventDefault(), it may be scrolling too far now that the address bar is showing, so we must dynamically adjust the momentum tween. 45377 updateClamps(); 45378 if (tween.isActive() && tween.vars.scrollY > maxY) scrollFuncY() > maxY ? tween.progress(1) && scrollFuncY(maxY) : tween.resetTo("scrollY", maxY); 45379 }; 45380 content && gsap.set(content, { 45381 y: "+=0" 45382 }); // to ensure there's a cache (element._gsap) 45383 vars.ignoreCheck = function(e) { 45384 return _fixIOSBug && e.type === "touchmove" && ignoreDrag(e) || scale > 1.05 && e.type !== "touchstart" || self.isGesturing || e.touches && e.touches.length > 1; 45385 }; 45386 vars.onPress = function() { 45387 skipTouchMove = false;
vendor: 5,441 bytes, lines 45388-45482
45388 var prevScale = scale; 45389 scale = _round((_win.visualViewport && _win.visualViewport.scale || 1) / initialScale); 45390 tween.pause(); 45391 prevScale !== scale && _allowNativePanning(target, scale > 1.01 ? true : normalizeScrollX ? false : "x"); 45392 startScrollX = scrollFuncX(); 45393 startScrollY = scrollFuncY(); 45394 updateClamps(); 45395 lastRefreshID = _refreshID; 45396 }; 45397 vars.onRelease = vars.onGestureStart = function(self, wasDragging) { 45398 scrollFuncY.offset && removeContentOffset(); 45399 if (!wasDragging) onStopDelayedCall.restart(true); 45400 else { 45401 (0, _observerJs._scrollers).cache++; // make sure we're pulling the non-cached value 45402 // alternate algorithm: durX = Math.min(6, Math.abs(self.velocityX / 800)), dur = Math.max(durX, Math.min(6, Math.abs(self.velocityY / 800))); dur = dur * (0.4 + (1 - _power4In(dur / 6)) * 0.6)) * (momentumSpeed || 1) 45403 var dur = resolveMomentumDuration(), currentScroll, endScroll; 45404 if (normalizeScrollX) { 45405 currentScroll = scrollFuncX(); 45406 endScroll = currentScroll + dur * 0.05 * -self.velocityX / 0.227; // the constant .227 is from power4(0.05). velocity is inverted because scrolling goes in the opposite direction. 45407 dur *= _clampScrollAndGetDurationMultiplier(scrollFuncX, currentScroll, endScroll, _maxScroll(target, (0, _observerJs._horizontal))); 45408 tween.vars.scrollX = scrollClampX(endScroll); 45409 } 45410 currentScroll = scrollFuncY(); 45411 endScroll = currentScroll + dur * 0.05 * -self.velocityY / 0.227; // the constant .227 is from power4(0.05) 45412 dur *= _clampScrollAndGetDurationMultiplier(scrollFuncY, currentScroll, endScroll, _maxScroll(target, (0, _observerJs._vertical))); 45413 tween.vars.scrollY = scrollClampY(endScroll); 45414 tween.invalidate().duration(dur).play(0.01); 45415 if (_fixIOSBug && tween.vars.scrollY >= maxY || currentScroll >= maxY - 1) // iOS bug: it'll show the address bar but NOT fire the window "resize" event until the animation is done but we must protect against overshoot so we leverage an onUpdate to do so. 45416 gsap.to({}, { 45417 onUpdate: onResize, 45418 duration: dur 45419 }); 45420 } 45421 onRelease && onRelease(self); 45422 }; 45423 vars.onWheel = function() { 45424 tween._ts && tween.pause(); 45425 if (_getTime() - wheelRefresh > 1000) { 45426 // after 1 second, refresh the clamps otherwise that'll only happen when ScrollTrigger.refresh() is called or for touch-scrolling. 45427 lastRefreshID = 0; 45428 wheelRefresh = _getTime(); 45429 } 45430 }; 45431 vars.onChange = function(self, dx, dy, xArray, yArray) { 45432 _refreshID !== lastRefreshID && updateClamps(); 45433 dx && normalizeScrollX && scrollFuncX(scrollClampX(xArray[2] === dx ? startScrollX + (self.startX - self.x) : scrollFuncX() + dx - xArray[1])); // for more precision, we track pointer/touch movement from the start, otherwise it'll drift. 45434 if (dy) { 45435 scrollFuncY.offset && removeContentOffset(); 45436 var isTouch = yArray[2] === dy, y = isTouch ? startScrollY + self.startY - self.y : scrollFuncY() + dy - yArray[1], yClamped = scrollClampY(y); 45437 isTouch && y !== yClamped && (startScrollY += yClamped - y); 45438 scrollFuncY(yClamped); 45439 } 45440 (dy || dx) && _updateAll(); 45441 }; 45442 vars.onEnable = function() { 45443 _allowNativePanning(target, normalizeScrollX ? false : "x"); 45444 ScrollTrigger.addEventListener("refresh", onResize); 45445 _addListener(_win, "resize", onResize); 45446 if (scrollFuncY.smooth) { 45447 scrollFuncY.target.style.scrollBehavior = "auto"; 45448 scrollFuncY.smooth = scrollFuncX.smooth = false; 45449 } 45450 inputObserver.enable(); 45451 }; 45452 vars.onDisable = function() { 45453 _allowNativePanning(target, true); 45454 _removeListener(_win, "resize", onResize); 45455 ScrollTrigger.removeEventListener("refresh", onResize); 45456 inputObserver.kill(); 45457 }; 45458 vars.lockAxis = vars.lockAxis !== false; 45459 self = new (0, _observerJs.Observer)(vars); 45460 self.iOS = _fixIOSBug; // used in the Observer getCachedScroll() function to work around an iOS bug that wreaks havoc with TouchEvent.clientY if we allow scroll to go all the way back to 0. 45461 _fixIOSBug && !scrollFuncY() && scrollFuncY(1); // iOS bug causes event.clientY values to freak out (wildly inaccurate) if the scroll position is exactly 0. 45462 _fixIOSBug && gsap.ticker.add(_passThrough); // prevent the ticker from sleeping 45463 onStopDelayedCall = self._dc; 45464 tween = gsap.to(self, { 45465 ease: "power4", 45466 paused: true, 45467 inherit: false, 45468 scrollX: normalizeScrollX ? "+=0.1" : "+=0", 45469 scrollY: "+=0.1", 45470 modifiers: { 45471 scrollY: _interruptionTracker(scrollFuncY, scrollFuncY(), function() { 45472 return tween.pause(); 45473 }) 45474 }, 45475 onUpdate: _updateAll, 45476 onComplete: onStopDelayedCall.vars.onComplete 45477 }); // we need the modifier to sense if the scroll position is altered outside of the momentum tween (like with a scrollTo tween) so we can pause() it to prevent conflicts. 45478 return self; 45479}; 45480ScrollTrigger.sort = function(func) { 45481 if (_isFunction(func)) return _triggers.sort(func); 45482 var scroll = _win.pageYOffset || 0;
45483 ScrollTrigger.getAll().forEach(function(t) { 45484 return t._sortY = t.trigger ? scroll + t.trigger.getBoundingClientRect().top : t.start + _win.innerHeight; 45485 }); 45486 return _triggers.sort(func || function(a, b) { 45487 return (a.vars.refreshPriority || 0) * -1000000 + (a.vars.containerAnimation ? 1e6 : a._sortY) - ((b.vars.containerAnimation ? 1e6 : b._sortY) + (b.vars.refreshPriority || 0) * -1000000); 45488 }); // anything with a containerAnimation should refresh last. 45489}; 45490ScrollTrigger.observe = function(vars) { 45491 return new (0, _observerJs.Observer)(vars); 45492}; 45493ScrollTrigger.normalizeScroll = function(vars) { 45494 if (typeof vars === "undefined") return _normalizer; 45495 if (vars === true && _normalizer) return _normalizer.enable(); 45496 if (vars === false) { 45497 _normalizer && _normalizer.kill(); 45498 _normalizer = vars; 45499 return; 45500 } 45501 var normalizer = vars instanceof (0, _observerJs.Observer) ? vars : _getScrollNormalizer(vars); 45502 _normalizer && _normalizer.target === normalizer.target && _normalizer.kill(); 45503 _isViewport(normalizer.target) && (_normalizer = normalizer); 45504 return normalizer; 45505}; 45506ScrollTrigger.core = { 45507 // smaller file size way to leverage in ScrollSmoother and Observer 45508 _getVelocityProp: (0, _observerJs._getVelocityProp), 45509 _inputObserver: _inputObserver, 45510 _scrollers: (0, _observerJs._scrollers), 45511 _proxies: (0, _observerJs._proxies), 45512 bridge: { 45513 // when normalizeScroll sets the scroll position (ss = setScroll) 45514 ss: function ss() { 45515 _lastScrollTime || _dispatch("scrollStart"); 45516 _lastScrollTime = _getTime(); 45517 }, 45518 // a way to get the _refreshing value in Observer 45519 ref: function ref() { 45520 return _refreshing; 45521 } 45522 } 45523}; 45524_getGSAP() && gsap.registerPlugin(ScrollTrigger); 45525 45526},{"./Observer.js":"3lZzo","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"3lZzo":[function(require,module,exports,__globalThis) { 45527var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 45528parcelHelpers.defineInteropFlag(exports); 45529parcelHelpers.export(exports, "Observer", ()=>Observer); 45530parcelHelpers.export(exports, "default", ()=>Observer); 45531parcelHelpers.export(exports, "_isViewport", ()=>_isViewport); 45532parcelHelpers.export(exports, "_scrollers", ()=>_scrollers); 45533parcelHelpers.export(exports, "_getScrollFunc", ()=>_getScrollFunc); 45534parcelHelpers.export(exports, "_getProxyProp", ()=>_getProxyProp); 45535parcelHelpers.export(exports, "_proxies", ()=>_proxies); 45536parcelHelpers.export(exports, "_getVelocityProp", ()=>_getVelocityProp); 45537parcelHelpers.export(exports, "_vertical", ()=>_vertical); 45538parcelHelpers.export(exports, "_horizontal", ()=>_horizontal); 45539parcelHelpers.export(exports, "_getTarget", ()=>_getTarget); 45540function _defineProperties(target, props) { 45541 for(var i = 0; i < props.length; i++){ 45542 var descriptor = props[i]; 45543 descriptor.enumerable = descriptor.enumerable || false; 45544 descriptor.configurable = true; 45545 if ("value" in descriptor) descriptor.writable = true; 45546 Object.defineProperty(target, descriptor.key, descriptor); 45547 } 45548} 45549function _createClass(Constructor, protoProps, staticProps) { 45550 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 45551 if (staticProps) _defineProperties(Constructor, staticProps); 45552 return Constructor; 45553} 45554/*! 45555 * Observer 3.13.0 45556 * https://gsap.com 45557 * 45558 * @license Copyright 2008-2025, GreenSock. All rights reserved. 45559 * Subject to the terms at https://gsap.com/standard-license 45560 * @author: Jack Doyle, [email protected] 45561*/ /* eslint-disable */ var gsap, _coreInitted, _clamp, _win, _doc, _docEl, _body, _isTouch, _pointerType, ScrollTrigger, _root, _normalizer, _eventTypes, _context, _getGSAP = function _getGSAP() { 45562 return gsap || typeof window !== "undefined" && (gsap = window.gsap) && gsap.registerPlugin && gsap; 45563}, _startup = 1, _observers = [], _scrollers = [], _proxies = [], _getTime = Date.now, _bridge = function _bridge(name, value) { 45564 return value; 45565}, _integrate = function _integrate() { 45566 var core = ScrollTrigger.core, data = core.bridge || {}, scrollers = core._scrollers, proxies = core._proxies; 45567 scrollers.push.apply(scrollers, _scrollers);
vendor: 4,712 bytes, lines 45568-45648
45568 proxies.push.apply(proxies, _proxies); 45569 _scrollers = scrollers; 45570 _proxies = proxies; 45571 _bridge = function _bridge(name, value) { 45572 return data[name](value); 45573 }; 45574}, _getProxyProp = function _getProxyProp(element, property) { 45575 return ~_proxies.indexOf(element) && _proxies[_proxies.indexOf(element) + 1][property]; 45576}, _isViewport = function _isViewport(el) { 45577 return !!~_root.indexOf(el); 45578}, _addListener = function _addListener(element, type, func, passive, capture) { 45579 return element.addEventListener(type, func, { 45580 passive: passive !== false, 45581 capture: !!capture 45582 }); 45583}, _removeListener = function _removeListener(element, type, func, capture) { 45584 return element.removeEventListener(type, func, !!capture); 45585}, _scrollLeft = "scrollLeft", _scrollTop = "scrollTop", _onScroll = function _onScroll() { 45586 return _normalizer && _normalizer.isPressed || _scrollers.cache++; 45587}, _scrollCacheFunc = function _scrollCacheFunc(f, doNotCache) { 45588 var cachingFunc = function cachingFunc(value) { 45589 // since reading the scrollTop/scrollLeft/pageOffsetY/pageOffsetX can trigger a layout, this function allows us to cache the value so it only gets read fresh after a "scroll" event fires (or while we're refreshing because that can lengthen the page and alter the scroll position). when "soft" is true, that means don't actually set the scroll, but cache the new value instead (useful in ScrollSmoother) 45590 if (value || value === 0) { 45591 _startup && (_win.history.scrollRestoration = "manual"); // otherwise the new position will get overwritten by the browser onload. 45592 var isNormalizing = _normalizer && _normalizer.isPressed; 45593 value = cachingFunc.v = Math.round(value) || (_normalizer && _normalizer.iOS ? 1 : 0); //TODO: iOS Bug: if you allow it to go to 0, Safari can start to report super strange (wildly inaccurate) touch positions! 45594 f(value); 45595 cachingFunc.cacheID = _scrollers.cache; 45596 isNormalizing && _bridge("ss", value); // set scroll (notify ScrollTrigger so it can dispatch a "scrollStart" event if necessary 45597 } else if (doNotCache || _scrollers.cache !== cachingFunc.cacheID || _bridge("ref")) { 45598 cachingFunc.cacheID = _scrollers.cache; 45599 cachingFunc.v = f(); 45600 } 45601 return cachingFunc.v + cachingFunc.offset; 45602 }; 45603 cachingFunc.offset = 0; 45604 return f && cachingFunc; 45605}, _horizontal = { 45606 s: _scrollLeft, 45607 p: "left", 45608 p2: "Left", 45609 os: "right", 45610 os2: "Right", 45611 d: "width", 45612 d2: "Width", 45613 a: "x", 45614 sc: _scrollCacheFunc(function(value) { 45615 return arguments.length ? _win.scrollTo(value, _vertical.sc()) : _win.pageXOffset || _doc[_scrollLeft] || _docEl[_scrollLeft] || _body[_scrollLeft] || 0; 45616 }) 45617}, _vertical = { 45618 s: _scrollTop, 45619 p: "top", 45620 p2: "Top", 45621 os: "bottom", 45622 os2: "Bottom", 45623 d: "height", 45624 d2: "Height", 45625 a: "y", 45626 op: _horizontal, 45627 sc: _scrollCacheFunc(function(value) { 45628 return arguments.length ? _win.scrollTo(_horizontal.sc(), value) : _win.pageYOffset || _doc[_scrollTop] || _docEl[_scrollTop] || _body[_scrollTop] || 0; 45629 }) 45630}, _getTarget = function _getTarget(t, self) { 45631 return (self && self._ctx && self._ctx.selector || gsap.utils.toArray)(t)[0] || (typeof t === "string" && gsap.config().nullTargetWarn !== false ? console.warn("Element not found:", t) : null); 45632}, _isWithin = function _isWithin(element, list) { 45633 // check if the element is in the list or is a descendant of an element in the list. 45634 var i = list.length; 45635 while(i--){ 45636 if (list[i] === element || list[i].contains(element)) return true; 45637 } 45638 return false; 45639}, _getScrollFunc = function _getScrollFunc(element, _ref) { 45640 var s = _ref.s, sc = _ref.sc; 45641 // we store the scroller functions in an alternating sequenced Array like [element, verticalScrollFunc, horizontalScrollFunc, ...] so that we can minimize memory, maximize performance, and we also record the last position as a ".rec" property in order to revert to that after refreshing to ensure things don't shift around. 45642 _isViewport(element) && (element = _doc.scrollingElement || _docEl); 45643 var i = _scrollers.indexOf(element), offset = sc === _vertical.sc ? 1 : 2; 45644 !~i && (i = _scrollers.push(element) - 1); 45645 _scrollers[i + offset] || _addListener(element, "scroll", _onScroll); // clear the cache when a scroll occurs 45646 var prev = _scrollers[i + offset], func = prev || (_scrollers[i + offset] = _scrollCacheFunc(_getProxyProp(element, s), true) || (_isViewport(element) ? sc : _scrollCacheFunc(function(value) { 45647 return arguments.length ? element[s] = value : element[s]; 45648 }
vendor: 6,828 bytes, lines 45648-45751
45648))); 45649 func.target = element; 45650 prev || (func.smooth = gsap.getProperty(element, "scrollBehavior") === "smooth"); // only set it the first time (don't reset every time a scrollFunc is requested because perhaps it happens during a refresh() when it's disabled in ScrollTrigger. 45651 return func; 45652}, _getVelocityProp = function _getVelocityProp(value, minTimeRefresh, useDelta) { 45653 var v1 = value, v2 = value, t1 = _getTime(), t2 = t1, min = minTimeRefresh || 50, dropToZeroTime = Math.max(500, min * 3), update = function update(value, force) { 45654 var t = _getTime(); 45655 if (force || t - t1 > min) { 45656 v2 = v1; 45657 v1 = value; 45658 t2 = t1; 45659 t1 = t; 45660 } else if (useDelta) v1 += value; 45661 else // not totally necessary, but makes it a bit more accurate by adjusting the v1 value according to the new slope. This way we're not just ignoring the incoming data. Removing for now because it doesn't seem to make much practical difference and it's probably not worth the kb. 45662 v1 = v2 + (value - v2) / (t - t2) * (t1 - t2); 45663 }, reset = function reset() { 45664 v2 = v1 = useDelta ? 0 : v1; 45665 t2 = t1 = 0; 45666 }, getVelocity = function getVelocity(latestValue) { 45667 var tOld = t2, vOld = v2, t = _getTime(); 45668 (latestValue || latestValue === 0) && latestValue !== v1 && update(latestValue); 45669 return t1 === t2 || t - t2 > dropToZeroTime ? 0 : (v1 + (useDelta ? vOld : -vOld)) / ((useDelta ? t : t1) - tOld) * 1000; 45670 }; 45671 return { 45672 update: update, 45673 reset: reset, 45674 getVelocity: getVelocity 45675 }; 45676}, _getEvent = function _getEvent(e, preventDefault) { 45677 preventDefault && !e._gsapAllow && e.preventDefault(); 45678 return e.changedTouches ? e.changedTouches[0] : e; 45679}, _getAbsoluteMax = function _getAbsoluteMax(a) { 45680 var max = Math.max.apply(Math, a), min = Math.min.apply(Math, a); 45681 return Math.abs(max) >= Math.abs(min) ? max : min; 45682}, _setScrollTrigger = function _setScrollTrigger() { 45683 ScrollTrigger = gsap.core.globals().ScrollTrigger; 45684 ScrollTrigger && ScrollTrigger.core && _integrate(); 45685}, _initCore = function _initCore(core) { 45686 gsap = core || _getGSAP(); 45687 if (!_coreInitted && gsap && typeof document !== "undefined" && document.body) { 45688 _win = window; 45689 _doc = document; 45690 _docEl = _doc.documentElement; 45691 _body = _doc.body; 45692 _root = [ 45693 _win, 45694 _doc, 45695 _docEl, 45696 _body 45697 ]; 45698 _clamp = gsap.utils.clamp; 45699 _context = gsap.core.context || function() {}; 45700 _pointerType = "onpointerenter" in _body ? "pointer" : "mouse"; // isTouch is 0 if no touch, 1 if ONLY touch, and 2 if it can accommodate touch but also other types like mouse/pointer. 45701 _isTouch = Observer.isTouch = _win.matchMedia && _win.matchMedia("(hover: none), (pointer: coarse)").matches ? 1 : "ontouchstart" in _win || navigator.maxTouchPoints > 0 || navigator.msMaxTouchPoints > 0 ? 2 : 0; 45702 _eventTypes = Observer.eventTypes = ("ontouchstart" in _docEl ? "touchstart,touchmove,touchcancel,touchend" : !("onpointerdown" in _docEl) ? "mousedown,mousemove,mouseup,mouseup" : "pointerdown,pointermove,pointercancel,pointerup").split(","); 45703 setTimeout(function() { 45704 return _startup = 0; 45705 }, 500); 45706 _setScrollTrigger(); 45707 _coreInitted = 1; 45708 } 45709 return _coreInitted; 45710}; 45711_horizontal.op = _vertical; 45712_scrollers.cache = 0; 45713var Observer = /*#__PURE__*/ function() { 45714 function Observer(vars) { 45715 this.init(vars); 45716 } 45717 var _proto = Observer.prototype; 45718 _proto.init = function init(vars) { 45719 _coreInitted || _initCore(gsap) || console.warn("Please gsap.registerPlugin(Observer)"); 45720 ScrollTrigger || _setScrollTrigger(); 45721 var tolerance = vars.tolerance, dragMinimum = vars.dragMinimum, type = vars.type, target = vars.target, lineHeight = vars.lineHeight, debounce = vars.debounce, preventDefault = vars.preventDefault, onStop = vars.onStop, onStopDelay = vars.onStopDelay, ignore = vars.ignore, wheelSpeed = vars.wheelSpeed, event = vars.event, onDragStart = vars.onDragStart, onDragEnd = vars.onDragEnd, onDrag = vars.onDrag, onPress = vars.onPress, onRelease = vars.onRelease, onRight = vars.onRight, onLeft = vars.onLeft, onUp = vars.onUp, onDown = vars.onDown, onChangeX = vars.onChangeX, onChangeY = vars.onChangeY, onChange = vars.onChange, onToggleX = vars.onToggleX, onToggleY = vars.onToggleY, onHover = vars.onHover, onHoverEnd = vars.onHoverEnd, onMove = vars.onMove, ignoreCheck = vars.ignoreCheck, isNormalizer = vars.isNormalizer, onGestureStart = vars.onGestureStart, onGestureEnd = vars.onGestureEnd, onWheel = vars.onWheel, onEnable = vars.onEnable, onDisable = vars.onDisable, onClick = vars.onClick, scrollSpeed = vars.scrollSpeed, capture = vars.capture, allowClicks = vars.allowClicks, lockAxis = vars.lockAxis, onLockAxis = vars.onLockAxis; 45722 this.target = target = _getTarget(target) || _docEl; 45723 this.vars = vars; 45724 ignore && (ignore = gsap.utils.toArray(ignore)); 45725 tolerance = tolerance || 1e-9; 45726 dragMinimum = dragMinimum || 0; 45727 wheelSpeed = wheelSpeed || 1; 45728 scrollSpeed = scrollSpeed || 1; 45729 type = type || "wheel,touch,pointer"; 45730 debounce = debounce !== false; 45731 lineHeight || (lineHeight = parseFloat(_win.getComputedStyle(_body).lineHeight) || 22); // note: browser may report "normal", so default to 22. 45732 var id, onStopDelayedCall, dragged, moved, wheeled, locked, axis, self = this, prevDeltaX = 0, prevDeltaY = 0, passive = vars.passive || !preventDefault && vars.passive !== false, scrollFuncX = _getScrollFunc(target, _horizontal), scrollFuncY = _getScrollFunc(target, _vertical), scrollX = scrollFuncX(), scrollY = scrollFuncY(), limitToTouch = ~type.indexOf("touch") && !~type.indexOf("pointer") && _eventTypes[0] === "pointerdown", // for devices that accommodate mouse events and touch events, we need to distinguish. 45733 isViewport = _isViewport(target), ownerDoc = target.ownerDocument || _doc, deltaX = [ 45734 0, 45735 0, 45736 0 45737 ], // wheel, scroll, pointer/touch 45738 deltaY = [ 45739 0, 45740 0, 45741 0 45742 ], onClickTime = 0, clickCapture = function clickCapture() { 45743 return onClickTime = _getTime(); 45744 }, _ignoreCheck = function _ignoreCheck(e, isPointerOrTouch) { 45745 return (self.event = e) && ignore && _isWithin(e.target, ignore) || isPointerOrTouch && limitToTouch && e.pointerType !== "touch" || ignoreCheck && ignoreCheck(e, isPointerOrTouch); 45746 }, onStopFunc = function onStopFunc() { 45747 self._vx.reset(); 45748 self._vy.reset(); 45749 onStopDelayedCall.pause(); 45750 onStop && onStop(self); 45751 }
vendor: 6,854 bytes, lines 45751-45851
45751, update = function update() { 45752 var dx = self.deltaX = _getAbsoluteMax(deltaX), dy = self.deltaY = _getAbsoluteMax(deltaY), changedX = Math.abs(dx) >= tolerance, changedY = Math.abs(dy) >= tolerance; 45753 onChange && (changedX || changedY) && onChange(self, dx, dy, deltaX, deltaY); // in ScrollTrigger.normalizeScroll(), we need to know if it was touch/pointer so we need access to the deltaX/deltaY Arrays before we clear them out. 45754 if (changedX) { 45755 onRight && self.deltaX > 0 && onRight(self); 45756 onLeft && self.deltaX < 0 && onLeft(self); 45757 onChangeX && onChangeX(self); 45758 onToggleX && self.deltaX < 0 !== prevDeltaX < 0 && onToggleX(self); 45759 prevDeltaX = self.deltaX; 45760 deltaX[0] = deltaX[1] = deltaX[2] = 0; 45761 } 45762 if (changedY) { 45763 onDown && self.deltaY > 0 && onDown(self); 45764 onUp && self.deltaY < 0 && onUp(self); 45765 onChangeY && onChangeY(self); 45766 onToggleY && self.deltaY < 0 !== prevDeltaY < 0 && onToggleY(self); 45767 prevDeltaY = self.deltaY; 45768 deltaY[0] = deltaY[1] = deltaY[2] = 0; 45769 } 45770 if (moved || dragged) { 45771 onMove && onMove(self); 45772 if (dragged) { 45773 onDragStart && dragged === 1 && onDragStart(self); 45774 onDrag && onDrag(self); 45775 dragged = 0; 45776 } 45777 moved = false; 45778 } 45779 locked && (locked = false, true) && onLockAxis && onLockAxis(self); 45780 if (wheeled) { 45781 onWheel(self); 45782 wheeled = false; 45783 } 45784 id = 0; 45785 }, onDelta = function onDelta(x, y, index) { 45786 deltaX[index] += x; 45787 deltaY[index] += y; 45788 self._vx.update(x); 45789 self._vy.update(y); 45790 debounce ? id || (id = requestAnimationFrame(update)) : update(); 45791 }, onTouchOrPointerDelta = function onTouchOrPointerDelta(x, y) { 45792 if (lockAxis && !axis) { 45793 self.axis = axis = Math.abs(x) > Math.abs(y) ? "x" : "y"; 45794 locked = true; 45795 } 45796 if (axis !== "y") { 45797 deltaX[2] += x; 45798 self._vx.update(x, true); // update the velocity as frequently as possible instead of in the debounced function so that very quick touch-scrolls (flicks) feel natural. If it's the mouse/touch/pointer, force it so that we get snappy/accurate momentum scroll. 45799 } 45800 if (axis !== "x") { 45801 deltaY[2] += y; 45802 self._vy.update(y, true); 45803 } 45804 debounce ? id || (id = requestAnimationFrame(update)) : update(); 45805 }, _onDrag = function _onDrag(e) { 45806 if (_ignoreCheck(e, 1)) return; 45807 e = _getEvent(e, preventDefault); 45808 var x = e.clientX, y = e.clientY, dx = x - self.x, dy = y - self.y, isDragging = self.isDragging; 45809 self.x = x; 45810 self.y = y; 45811 if (isDragging || (dx || dy) && (Math.abs(self.startX - x) >= dragMinimum || Math.abs(self.startY - y) >= dragMinimum)) { 45812 dragged = isDragging ? 2 : 1; // dragged: 0 = not dragging, 1 = first drag, 2 = normal drag 45813 isDragging || (self.isDragging = true); 45814 onTouchOrPointerDelta(dx, dy); 45815 } 45816 }, _onPress = self.onPress = function(e) { 45817 if (_ignoreCheck(e, 1) || e && e.button) return; 45818 self.axis = axis = null; 45819 onStopDelayedCall.pause(); 45820 self.isPressed = true; 45821 e = _getEvent(e); // note: may need to preventDefault(?) Won't side-scroll on iOS Safari if we do, though. 45822 prevDeltaX = prevDeltaY = 0; 45823 self.startX = self.x = e.clientX; 45824 self.startY = self.y = e.clientY; 45825 self._vx.reset(); // otherwise the t2 may be stale if the user touches and flicks super fast and releases in less than 2 requestAnimationFrame ticks, causing velocity to be 0. 45826 self._vy.reset(); 45827 _addListener(isNormalizer ? target : ownerDoc, _eventTypes[1], _onDrag, passive, true); 45828 self.deltaX = self.deltaY = 0; 45829 onPress && onPress(self); 45830 }, _onRelease = self.onRelease = function(e) { 45831 if (_ignoreCheck(e, 1)) return; 45832 _removeListener(isNormalizer ? target : ownerDoc, _eventTypes[1], _onDrag, true); 45833 var isTrackingDrag = !isNaN(self.y - self.startY), wasDragging = self.isDragging, isDragNotClick = wasDragging && (Math.abs(self.x - self.startX) > 3 || Math.abs(self.y - self.startY) > 3), // some touch devices need some wiggle room in terms of sensing clicks - the finger may move a few pixels. 45834 eventData = _getEvent(e); 45835 if (!isDragNotClick && isTrackingDrag) { 45836 self._vx.reset(); 45837 self._vy.reset(); //if (preventDefault && allowClicks && self.isPressed) { // check isPressed because in a rare edge case, the inputObserver in ScrollTrigger may stopPropagation() on the press/drag, so the onRelease may get fired without the onPress/onDrag ever getting called, thus it could trigger a click to occur on a link after scroll-dragging it. 45838 if (preventDefault && allowClicks) gsap.delayedCall(0.08, function() { 45839 // some browsers (like Firefox) won't trust script-generated clicks, so if the user tries to click on a video to play it, for example, it simply won't work. Since a regular "click" event will most likely be generated anyway (one that has its isTrusted flag set to true), we must slightly delay our script-generated click so that the "real"/trusted one is prioritized. Remember, when there are duplicate events in quick succession, we suppress all but the first one. Some browsers don't even trigger the "real" one at all, so our synthetic one is a safety valve that ensures that no matter what, a click event does get dispatched. 45840 if (_getTime() - onClickTime > 300 && !e.defaultPrevented) { 45841 if (e.target.click) //some browsers (like mobile Safari) don't properly trigger the click event 45842 e.target.click(); 45843 else if (ownerDoc.createEvent) { 45844 var syntheticEvent = ownerDoc.createEvent("MouseEvents"); 45845 syntheticEvent.initMouseEvent("click", true, true, _win, 1, eventData.screenX, eventData.screenY, eventData.clientX, eventData.clientY, false, false, false, false, 0, null); 45846 e.target.dispatchEvent(syntheticEvent); 45847 } 45848 } 45849 }); 45850 } 45851 self.isDragging = self.isGesturing = self.isPressed = false;
vendor: 5,822 bytes, lines 45852-45950
45852 onStop && wasDragging && !isNormalizer && onStopDelayedCall.restart(true); 45853 dragged && update(); // in case debouncing, we don't want onDrag to fire AFTER onDragEnd(). 45854 onDragEnd && wasDragging && onDragEnd(self); 45855 onRelease && onRelease(self, isDragNotClick); 45856 }, _onGestureStart = function _onGestureStart(e) { 45857 return e.touches && e.touches.length > 1 && (self.isGesturing = true) && onGestureStart(e, self.isDragging); 45858 }, _onGestureEnd = function _onGestureEnd() { 45859 return self.isGesturing = false, onGestureEnd(self); 45860 }, onScroll = function onScroll(e) { 45861 if (_ignoreCheck(e)) return; 45862 var x = scrollFuncX(), y = scrollFuncY(); 45863 onDelta((x - scrollX) * scrollSpeed, (y - scrollY) * scrollSpeed, 1); 45864 scrollX = x; 45865 scrollY = y; 45866 onStop && onStopDelayedCall.restart(true); 45867 }, _onWheel = function _onWheel(e) { 45868 if (_ignoreCheck(e)) return; 45869 e = _getEvent(e, preventDefault); 45870 onWheel && (wheeled = true); 45871 var multiplier = (e.deltaMode === 1 ? lineHeight : e.deltaMode === 2 ? _win.innerHeight : 1) * wheelSpeed; 45872 onDelta(e.deltaX * multiplier, e.deltaY * multiplier, 0); 45873 onStop && !isNormalizer && onStopDelayedCall.restart(true); 45874 }, _onMove = function _onMove(e) { 45875 if (_ignoreCheck(e)) return; 45876 var x = e.clientX, y = e.clientY, dx = x - self.x, dy = y - self.y; 45877 self.x = x; 45878 self.y = y; 45879 moved = true; 45880 onStop && onStopDelayedCall.restart(true); 45881 (dx || dy) && onTouchOrPointerDelta(dx, dy); 45882 }, _onHover = function _onHover(e) { 45883 self.event = e; 45884 onHover(self); 45885 }, _onHoverEnd = function _onHoverEnd(e) { 45886 self.event = e; 45887 onHoverEnd(self); 45888 }, _onClick = function _onClick(e) { 45889 return _ignoreCheck(e) || _getEvent(e, preventDefault) && onClick(self); 45890 }; 45891 onStopDelayedCall = self._dc = gsap.delayedCall(onStopDelay || 0.25, onStopFunc).pause(); 45892 self.deltaX = self.deltaY = 0; 45893 self._vx = _getVelocityProp(0, 50, true); 45894 self._vy = _getVelocityProp(0, 50, true); 45895 self.scrollX = scrollFuncX; 45896 self.scrollY = scrollFuncY; 45897 self.isDragging = self.isGesturing = self.isPressed = false; 45898 _context(this); 45899 self.enable = function(e) { 45900 if (!self.isEnabled) { 45901 _addListener(isViewport ? ownerDoc : target, "scroll", _onScroll); 45902 type.indexOf("scroll") >= 0 && _addListener(isViewport ? ownerDoc : target, "scroll", onScroll, passive, capture); 45903 type.indexOf("wheel") >= 0 && _addListener(target, "wheel", _onWheel, passive, capture); 45904 if (type.indexOf("touch") >= 0 && _isTouch || type.indexOf("pointer") >= 0) { 45905 _addListener(target, _eventTypes[0], _onPress, passive, capture); 45906 _addListener(ownerDoc, _eventTypes[2], _onRelease); 45907 _addListener(ownerDoc, _eventTypes[3], _onRelease); 45908 allowClicks && _addListener(target, "click", clickCapture, true, true); 45909 onClick && _addListener(target, "click", _onClick); 45910 onGestureStart && _addListener(ownerDoc, "gesturestart", _onGestureStart); 45911 onGestureEnd && _addListener(ownerDoc, "gestureend", _onGestureEnd); 45912 onHover && _addListener(target, _pointerType + "enter", _onHover); 45913 onHoverEnd && _addListener(target, _pointerType + "leave", _onHoverEnd); 45914 onMove && _addListener(target, _pointerType + "move", _onMove); 45915 } 45916 self.isEnabled = true; 45917 self.isDragging = self.isGesturing = self.isPressed = moved = dragged = false; 45918 self._vx.reset(); 45919 self._vy.reset(); 45920 scrollX = scrollFuncX(); 45921 scrollY = scrollFuncY(); 45922 e && e.type && _onPress(e); 45923 onEnable && onEnable(self); 45924 } 45925 return self; 45926 }; 45927 self.disable = function() { 45928 if (self.isEnabled) { 45929 // only remove the _onScroll listener if there aren't any others that rely on the functionality. 45930 _observers.filter(function(o) { 45931 return o !== self && _isViewport(o.target); 45932 }).length || _removeListener(isViewport ? ownerDoc : target, "scroll", _onScroll); 45933 if (self.isPressed) { 45934 self._vx.reset(); 45935 self._vy.reset(); 45936 _removeListener(isNormalizer ? target : ownerDoc, _eventTypes[1], _onDrag, true); 45937 } 45938 _removeListener(isViewport ? ownerDoc : target, "scroll", onScroll, capture); 45939 _removeListener(target, "wheel", _onWheel, capture); 45940 _removeListener(target, _eventTypes[0], _onPress, capture); 45941 _removeListener(ownerDoc, _eventTypes[2], _onRelease); 45942 _removeListener(ownerDoc, _eventTypes[3], _onRelease); 45943 _removeListener(target, "click", clickCapture, true); 45944 _removeListener(target, "click", _onClick); 45945 _removeListener(ownerDoc, "gesturestart", _onGestureStart); 45946 _removeListener(ownerDoc, "gestureend", _onGestureEnd); 45947 _removeListener(target, _pointerType + "enter", _onHover); 45948 _removeListener(target, _pointerType + "leave", _onHoverEnd); 45949 _removeListener(target, _pointerType + "move", _onMove); 45950 self.isEnabled = self.isPressed = self.isDragging = false;
45951 onDisable && onDisable(self); 45952 } 45953 }; 45954 self.kill = self.revert = function() { 45955 self.disable(); 45956 var i = _observers.indexOf(self); 45957 i >= 0 && _observers.splice(i, 1); 45958 _normalizer === self && (_normalizer = 0); 45959 }; 45960 _observers.push(self); 45961 isNormalizer && _isViewport(target) && (_normalizer = self); 45962 self.enable(event); 45963 }; 45964 _createClass(Observer, [ 45965 { 45966 key: "velocityX", 45967 get: function get() { 45968 return this._vx.getVelocity(); 45969 } 45970 }, 45971 { 45972 key: "velocityY", 45973 get: function get() { 45974 return this._vy.getVelocity(); 45975 } 45976 } 45977 ]); 45978 return Observer; 45979}(); 45980Observer.version = "3.13.0"; 45981Observer.create = function(vars) { 45982 return new Observer(vars); 45983}; 45984Observer.register = _initCore; 45985Observer.getAll = function() { 45986 return _observers.slice(); 45987}; 45988Observer.getById = function(id) { 45989 return _observers.filter(function(o) { 45990 return o.vars.id === id; 45991 })[0]; 45992}; 45993_getGSAP() && gsap.registerPlugin(Observer); 45994 45995},{"@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"9lGDV":[function(require,module,exports,__globalThis) { 45996var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 45997var _swiperBundle = require("swiper/swiper-bundle"); 45998var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 45999var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 46000const mediaContentCarouselModules = document.querySelectorAll('.m__mcc'); 46001mediaContentCarouselModules.forEach((mediaContentCarouselModule)=>{ 46002 //Loop through each card slider and initialise swiper and buttons 46003 const mediaContentCarouselMediaSwiper = mediaContentCarouselModule.querySelector('.m__mcc__media-slider.swiper'); 46004 const mediaContentCarouselContentSwiper = mediaContentCarouselModule.querySelector('.m__mcc__content-slider.swiper'); 46005 const mediaContentCarouselNextArrow = mediaContentCarouselModule.querySelector('.js-mcc__swiper-next'); 46006 const mediaContentCarouselPrevArrow = mediaContentCarouselModule.querySelector('.js-mcc__swiper-prev'); 46007 const mediaContentCarouselMediaSwiperInstance = new (0, _swiperBundleDefault.default)(mediaContentCarouselMediaSwiper, { 46008 slidesPerView: 1, 46009 spaceBetween: 10, 46010 centeredSlides: false, 46011 loop: true, 46012 shortSwipes: true, 46013 speed: 750, 46014 keyboard: { 46015 enabled: true, 46016 onlyInViewport: true 46017 }, 46018 allowTouchMove: false, 46019 breakpoints: { 46020 768: { 46021 slidesPerView: 1.3, 46022 spaceBetween: 10 46023 }, 46024 992: { 46025 slidesPerView: 1.7, 46026 spaceBetween: 15 46027 }, 46028 1200: { 46029 slidesPerView: 2.15, 46030 spaceBetween: 10 46031 } 46032 } 46033 }); 46034 const mediaContentCarouselContentSwiperInstance = new (0, _swiperBundleDefault.default)(mediaContentCarouselContentSwiper, { 46035 effect: 'fade', 46036 fadeEffect: { 46037 crossFade: true 46038 }, 46039 slidesPerView: 1, 46040 centeredSlides: false, 46041 loop: true, 46042 speed: 750, 46043 allowTouchMove: false, 46044 shortSwipes: true, 46045 keyboard: { 46046 enabled: true, 46047 onlyInViewport: true 46048 } 46049 }); 46050 //Move to next slide if 'next' arrow clicked 46051 if (mediaContentCarouselNextArrow) mediaContentCarouselNextArrow.addEventListener('click', (event)=>{ 46052 mediaContentCarouselContentSwiperInstance.slideNext(); 46053 mediaContentCarouselMediaSwiperInstance.slideNext(); 46054 }); 46055 if (mediaContentCarouselPrevArrow) mediaContentCarouselPrevArrow.addEventListener('click', (event)=>{ 46056 mediaContentCarouselContentSwiperInstance.slidePrev(); 46057 mediaContentCarouselMediaSwiperInstance.slidePrev(); 46058 }); 46059 // Truncate text to 255 characters on mobile only (< 768px) and restore on de
46059sktop 46060 function updateParagraphTruncation() { 46061 const paragraphs = mediaContentCarouselModule.querySelectorAll('.m__mcc__copy p'); 46062 paragraphs.forEach((paragraph)=>{ 46063 // Save original text if not already saved 46064 if (!paragraph.hasAttribute('data-original-text')) paragraph.setAttribute('data-original-text', paragraph.textContent); 46065 const originalText = paragraph.getAttribute('data-original-text'); 46066 if (window.innerWidth < 768) { 46067 if (originalText.length > 255) paragraph.textContent = originalText.substring(0, 255) + '...'; 46068 else paragraph.textContent = originalText; 46069 } else // Restore original text on desktop 46070 paragraph.textContent = originalText; 46071 }); 46072 } 46073 // Initial truncation on load 46074 updateParagraphTruncation(); 46075 // Update truncation on resize 46076 window.addEventListener('resize', updateParagraphTruncation); 46077}); 46078 46079},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"adPtX":[function(require,module,exports,__globalThis) { 46080var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 46081var _swiperBundle = require("swiper/swiper-bundle"); 46082var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 46083var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 46084const openingTimesModules = document.querySelectorAll('.m__opening-times'); 46085openingTimesModules.forEach((openingTimesModule)=>{ 46086 const openingTimesSwiper = openingTimesModule.querySelector('.m__opening-times__details'); 46087 const slides = [ 46088 ...openingTimesSwiper.querySelectorAll('.swiper-slide') 46089 ]; 46090 const activeTodayIndex = slides.findIndex((slide)=>slide.classList.contains('active-today')); 46091 const hasActiveToday = activeTodayIndex >= 0; 46092 const initialSlide = hasActiveToday ? activeTodayIndex : 0; 46093 const thisOSwiper = new (0, _swiperBundleDefault.default)(openingTimesSwiper, { 46094 slidesPerView: 1, 46095 spaceBetween: 20, 46096 centeredSlides: hasActiveToday, 46097 initialSlide, 46098 loop: false, 46099 arrows: false, 46100 dots: false, 46101 autoHeight: false, 46102 freeMode: { 46103 enabled: true, 46104 sticky: true 46105 }, 46106 breakpoints: { 46107 1200: { 46108 slidesPerView: 7, 46109 spaceBetween: 30, 46110 centeredSlides: false 46111 }, 46112 1024: { 46113 slidesPerView: 5, 46114 spaceBetween: 25 46115 }, 46116 768: { 46117 slidesPerView: 4, 46118 spaceBetween: 20 46119 }, 46120 450: { 46121 slidesPerView: 3, 46122 spaceBetween: 20 46123 }, 46124 300: { 46125 slidesPerView: 2, 46126 spaceBetween: 20 46127 } 46128 }, 46129 on: { 46130 init (swiper) { 46131 if (hasActiveToday) swiper.slideTo(activeTodayIndex, 0); 46132 } 46133 } 46134 }); 46135}); 46136 46137},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"03av8":[function(require,module,exports,__globalThis) { 46138const galleryModules = document.querySelectorAll('.m__gallery'); 46139galleryModules.forEach((galleryModule)=>{ 46140 const filterButtons = galleryModule.querySelectorAll('.m__gallery__filter-bar__item'); 46141 const gridItems = galleryModule.querySelectorAll('.m__gallery__grid__item'); 46142 // Add click event listeners to filter buttons 46143 filterButtons.forEach((button)=>{ 46144 button.addEventListener('click', ()=>{ 46145 const filterValue = button.getAttribute('data-filter'); 46146 // Update active state on buttons 46147 filterButtons.forEach((btn)=>btn.classList.remove('active')); 46148 button.classList.add('active'); 46149 // Filter grid items 46150 gridItems.forEach((item)=>{ 46151 const itemFilter = item.getAttribute('data-filter'); 46152 if (filterValue === 'all' || itemFilter === filterValue) item.style.display = ''; 46153 else item.style.display = 'none'; 46154 }); 46155 }); 46156 }); 46157}); 46158 46159},{}],"841n2":[function(require,module,exports,__globalThis) { 46160var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 46161var _swiperBundle = require("swiper/swiper-bundle"); 46162var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 46163var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 46164const whatsOnListModules = document.querySelectorAll('.m__wlist');
46165whatsOnListModules.forEach((whatsOnListModule)=>{ 46166 //Loop through whats on list slider and initialise swiper and buttons 46167 const whatsOnListSwiper = whatsOnListModule.querySelector('.cpt-list__list.swiper'); 46168 const whatsOnListNextArrow = whatsOnListModule.querySelector('.js-wlist__swiper-next'); 46169 const whatsOnListPrevArrow = whatsOnListModule.querySelector('.js-wlist__swiper-prev'); 46170 let whatsOnListSwiperInstance = null; 46171 const initSwiper = ()=>{ 46172 if (window.innerWidth <= 768 && !whatsOnListSwiperInstance) whatsOnListSwiperInstance = new (0, _swiperBundleDefault.default)(whatsOnListSwiper, { 46173 slidesPerView: 1, 46174 spaceBetween: 0, 46175 centeredSlides: false, 46176 loop: true, 46177 shortSwipes: true, 46178 speed: 750, 46179 keyboard: { 46180 enabled: true, 46181 onlyInViewport: true 46182 }, 46183 allowTouchMove: true 46184 }); 46185 else if (window.innerWidth > 768 && whatsOnListSwiperInstance) { 46186 whatsOnListSwiperInstance.destroy(true, true); 46187 whatsOnListSwiperInstance = null; 46188 } 46189 }; 46190 //Move to next slide if 'next' arrow clicked 46191 if (whatsOnListNextArrow) whatsOnListNextArrow.addEventListener('click', (event)=>{ 46192 whatsOnListSwiperInstance.slideNext(); 46193 }); 46194 if (whatsOnListPrevArrow) whatsOnListPrevArrow.addEventListener('click', (event)=>{ 46195 whatsOnListSwiperInstance.slidePrev(); 46196 }); 46197 // Initialize on load 46198 initSwiper(); 46199 // Re-initialize on resize 46200 window.addEventListener('resize', initSwiper); 46201}); 46202 46203},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"k5AjB":[function(require,module,exports,__globalThis) { 46204var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 46205var _swiperBundle = require("swiper/swiper-bundle"); 46206var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 46207var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 46208const galleryCarouselModules = document.querySelectorAll('.m__gallery-carousel'); 46209galleryCarouselModules.forEach((galleryCarouselModule)=>{ 46210 const galleryCarouselSwiper = galleryCarouselModule.querySelector('.swiper'); 46211 const galleryCarouselSwiperInstance = new (0, _swiperBundleDefault.default)(galleryCarouselSwiper, { 46212 slidesPerView: 1, 46213 spaceBetween: 15, 46214 autoplay: { 46215 delay: 0, 46216 disableOnInteraction: false, 46217 pauseOnMouseEnter: false 46218 }, 46219 loop: true, 46220 shortSwipes: true, 46221 autoHeight: false, 46222 speed: 5000, 46223 freeMode: { 46224 enabled: true, 46225 momentum: false 46226 }, 46227 allowTouchMove: false, 46228 breakpoints: { 46229 1024: { 46230 slidesPerView: 2.2, 46231 spaceBetween: 15, 46232 speed: 4500 46233 }, 46234 1200: { 46235 slidesPerView: 3.4, 46236 spaceBetween: 15, 46237 speed: 4000 46238 }, 46239 1400: { 46240 slidesPerView: 3.8, 46241 spaceBetween: 15, 46242 speed: 3000 46243 }, 46244 1600: { 46245 slidesPerView: 4.2, 46246 spaceBetween: 15, 46247 speed: 3000 46248 } 46249 }, 46250 on: { 46251 init: function() { 46252 const wrapper = this.wrapperEl; 46253 wrapper.style.transitionTimingFunction = 'linear'; 46254 }, 46255 slideChange: function() { 46256 const wrapper = this.wrapperEl; 46257 wrapper.style.transitionTimingFunction = 'linear'; 46258 } 46259 } 46260 }); 46261}); 46262 46263},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"8KrgO":[function(require,module,exports,__globalThis) { 46264var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 46265var _swiperBundle = require("swiper/swiper-bundle"); 46266var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 46267var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 46268const centeredSliderModules = document.querySelectorAll('.m__centered-slider');
46269centeredSliderModules.forEach((centeredSliderModule)=>{ 46270 const centeredSliderSwiper = centeredSliderModule.querySelector('.swiper'); 46271 const centeredSliderSwiperInstance = new (0, _swiperBundleDefault.default)(centeredSliderSwiper, { 46272 effect: 'slide', 46273 grabCursor: true, 46274 centeredSlides: true, 46275 slidesPerView: 3, 46276 spaceBetween: 0, 46277 loop: true, 46278 speed: 600, 46279 slideToClickedSlide: true, 46280 navigation: { 46281 nextEl: '.m__centered-slider__swiper-arrow--next', 46282 prevEl: '.m__centered-slider__swiper-arrow--prev' 46283 }, 46284 breakpoints: { 46285 320: { 46286 slidesPerView: 1 46287 }, 46288 768: { 46289 slidesPerView: 2 46290 }, 46291 1024: { 46292 slidesPerView: 2.8 46293 } 46294 } 46295 }); 46296}); 46297 46298},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"e1oHA":[function(require,module,exports,__globalThis) { 46299class Forms { 46300 constructor(form){ 46301 this.form = form; 46302 this.inputRows = this.form.querySelectorAll('.m__contact-form__row'); 46303 console.log(this.inputRows); 46304 this.init(); 46305 } 46306 init() { 46307 if (this.inputRows.length > 0) this.inputRows.forEach((row)=>{ 46308 row.addEventListener('click', (event)=>{ 46309 row.classList.add('has-focus'); 46310 }); 46311 }); 46312 } 46313} // window.addEventListener('load', () => { 46314 // if (document.querySelectorAll('.theme-luxury .m__contact-form')) { 46315 // document.querySelectorAll('.theme-luxury .m__contact-form').forEach(form => { 46316 // new Forms(form); 46317 // }); 46318 // } 46319 // }); 46320 46321},{}],"jrpBE":[function(require,module,exports,__globalThis) { 46322var parcelHelpers = require("@parcel/transformer-js/src/esmodule-helpers.js"); 46323var _swiperBundle = require("swiper/swiper-bundle"); 46324var _swiperBundleDefault = parcelHelpers.interopDefault(_swiperBundle); 46325var _swiperBundleMinCss = require("swiper/swiper-bundle.min.css"); 46326const locationContactModules = document.querySelectorAll('.m__location-contact'); 46327locationContactModules.forEach((locationContactModule)=>{ 46328 const locationContactSwiper = locationContactModule.querySelector('.m__location-contact__whats-on--slider'); 46329 const thisLocationContactSwiper = new (0, _swiperBundleDefault.default)(locationContactSwiper, { 46330 slidesPerView: 1.2, 46331 spaceBetween: 20, 46332 centeredSlides: false, 46333 loop: false, 46334 arrows: false 46335 }); 46336}); 46337 46338},{"swiper/swiper-bundle":"8HSYe","swiper/swiper-bundle.min.css":"4ZDmT","@parcel/transformer-js/src/esmodule-helpers.js":"5oERU"}],"4ZDmT":[function() {},{}],"e5w6v":[function() {},{}],"afjA0":[function(require,module,exports,__globalThis) { 46339function showEmbedShield(embed) { 46340 const shield = embed.querySelector('.js-embed-video-shield'); 46341 if (!shield) return; 46342 shield.style.display = 'block'; 46343 shield.removeAttribute('aria-hidden'); 46344 shield.tabIndex = 0; 46345} 46346function enableEmbedControls(embed) { 46347 if (!embed) return; 46348 embed.classList.add('is-interactive'); 46349 const iframe = embed.querySelector('.js-embed-video-iframe'); 46350 const shield = embed.querySelector('.js-embed-video-shield'); 46351 if (iframe) iframe.style.pointerEvents = 'auto'; 46352 if (shield) { 46353 shield.style.display = 'none'; 46354 shield.setAttribute('aria-hidden', 'true'); 46355 shield.tabIndex = -1; 46356 } 46357} 46358function disableEmbedControls(embed) { 46359 if (!embed || !embed.classList.contains('is-interactive')) return; 46360 embed.classList.remove('is-interactive'); 46361 const iframe = embed.querySelector('.js-embed-video-iframe'); 46362 if (iframe) iframe.style.pointerEvents = 'none'; 46363 showEmbedShield(embed); 46364} 46365function activateEmbedVideo(embed) { 46366 if (embed.classList.contains('is-active')) return; 46367 const iframe = embed.querySelector('.js-embed-video-iframe'); 46368 const trigger = embed.querySelector('.js-embed-video-trigger'); 46369 if (!iframe) return; 46370 const src = iframe.getAttribute('data-src'); 46371 if (!src) return; 46372 try { 46373 const url = new URL(src, window.location.href); 46374 url.searchParams.set('autoplay', '1'); 46375 iframe.src = url.href; 46376 } catch (error) { 46377 const separator = src.includes('?') ? '&' : '?'; 46378 iframe.src = `${src}${separator}autoplay=1`; 46379 } 46380 embed.classList.add('is-active'); 46381 showEmbedShield(embed); 46382 if (trigger) { 46383 trigger.setAttribute('aria-hidden', 'true'); 46384 trigger.tabIndex = -1; 46385 } 46386} 46387function initEmbedVideos(root = document) {
46388 root.querySelectorAll('.js-embed-video').forEach((embed)=>{ 46389 if (embed.dataset.embedBound === '1') return; 46390 embed.dataset.embedBound = '1'; 46391 const trigger = embed.querySelector('.js-embed-video-trigger'); 46392 if (!trigger) return; 46393 trigger.addEventListener('click', (event)=>{ 46394 event.preventDefault(); 46395 activateEmbedVideo(embed); 46396 }); 46397 }); 46398} 46399document.addEventListener('click', (event)=>{ 46400 const trigger = event.target.closest('.js-embed-video-trigger'); 46401 if (trigger) { 46402 const embed = trigger.closest('.js-embed-video'); 46403 if (!embed) return; 46404 event.preventDefault(); 46405 activateEmbedVideo(embed); 46406 return; 46407 } 46408 const shield = event.target.closest('.js-embed-video-shield'); 46409 if (shield) { 46410 event.preventDefault(); 46411 enableEmbedControls(shield.closest('.js-embed-video')); 46412 return; 46413 } 46414 document.querySelectorAll('.js-embed-video.is-interactive').forEach((embed)=>{ 46415 if (!embed.contains(event.target)) disableEmbedControls(embed); 46416 }); 46417}); 46418document.addEventListener('wheel', (event)=>{ 46419 const embed = event.target.closest('.js-embed-video.is-interactive'); 46420 if (embed) disableEmbedControls(embed); 46421}, { 46422 passive: true 46423}); 46424function upgradeYoutubePosterQuality(trigger) { 46425 const style = trigger.getAttribute('style') || ''; 46426 const match = style.match(/vi\/([^/'"]+)\/maxresdefault\.jpg/); 46427 if (!match) return; 46428 const poster = new Image(); 46429 poster.onload = function onPosterLoad() { 46430 if (this.naturalWidth <= 120) trigger.style.backgroundImage = `url('https://img.youtube.com/vi/${match[1]}/sddefault.jpg')`; 46431 }; 46432 poster.src = `https://img.youtube.com/vi/${match[1]}/maxresdefault.jpg`; 46433} 46434document.querySelectorAll('.js-embed-video-trigger.m__full-width-media__embed-poster--has-image').forEach(upgradeYoutubePosterQuality); 46435if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', ()=>initEmbedVideos()); 46436else initEmbedVideos(); 46437 46438},{}]},["f6qko","3Jb1R"], "3Jb1R", "parcelRequire778d", {}) 46439 46440//# sourceMappingURL=index.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.