vendor: 56,870 bytes, lines 1-2003
1(function webpackUniversalModuleDefinition(root, factory) { 2 if(typeof exports === 'object' && typeof module === 'object') 3 module.exports = factory(require("_")); 4 else if(typeof define === 'function' && define.amd) 5 define(["_"], factory); 6 else if(typeof exports === 'object') 7 exports["Library"] = factory(require("_")); 8 else 9 root["Library"] = factory(root["_"]); 10})(self, (__WEBPACK_EXTERNAL_MODULE_lodash__) => { 11return /******/ (() => { // webpackBootstrap 12/******/ var __webpack_modules__ = ({ 13 14/***/ "./node_modules/@splidejs/splide-extension-video/dist/js/splide-extension-video.esm.js" 15/*!*********************************************************************************************!*\ 16 !*** ./node_modules/@splidejs/splide-extension-video/dist/js/splide-extension-video.esm.js ***! 17 \*********************************************************************************************/ 18(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 19 20"use strict"; 21__webpack_require__.r(__webpack_exports__); 22/* harmony export */ __webpack_require__.d(__webpack_exports__, { 23/* harmony export */ Video: () => (/* binding */ Video) 24/* harmony export */ }); 25/* provided dependency */ var Promise = __webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js"); 26/*! 27 * Splide.js 28 * Version : 0.8.0 29 * License : MIT 30 * Copyright: 2022 Naotoshi Fujita 31 */ 32function empty(array) { 33 array.length = 0; 34} 35 36function slice$1(arrayLike, start, end) { 37 return Array.prototype.slice.call(arrayLike, start, end); 38} 39 40function apply$1(func) { 41 return func.bind.apply(func, [null].concat(slice$1(arguments, 1))); 42} 43 44function typeOf$1(type, subject) { 45 return typeof subject === type; 46} 47 48var isArray$1 = Array.isArray; 49apply$1(typeOf$1, "function"); 50apply$1(typeOf$1, "string"); 51apply$1(typeOf$1, "undefined"); 52 53function toArray$1(value) { 54 return isArray$1(value) ? value : [value]; 55} 56 57function forEach$1(values, iteratee) { 58 toArray$1(values).forEach(iteratee); 59} 60 61function includes(array, value) { 62 return array.indexOf(value) > -1; 63} 64 65var ownKeys$1 = Object.keys; 66 67function forOwn$1(object, iteratee, right) { 68 if (object) { 69 var keys = ownKeys$1(object); 70 keys = right ? keys.reverse() : keys; 71 72 for (var i = 0; i < keys.length; i++) { 73 var key = keys[i]; 74 75 if (key !== "__proto__") { 76 if (iteratee(object[key], key) === false) { 77 break; 78 } 79 } 80 } 81 } 82 83 return object; 84} 85 86function assign$1(object) { 87 slice$1(arguments, 1).forEach(function (source) { 88 forOwn$1(source, function (value, key) { 89 object[key] = source[key]; 90 }); 91 }); 92 return object; 93} 94 95var PROJECT_CODE$1 = "splide"; 96 97function EventBinder() { 98 var listeners = []; 99 100 function bind(targets, events, callback, options) { 101 forEachEvent(targets, events, function (target, event, namespace) { 102 var isEventTarget = ("addEventListener" in target); 103 var remover = isEventTarget ? target.removeEventListener.bind(target, event, callback, options) : target["removeListener"].bind(target, callback); 104 isEventTarget ? target.addEventListener(event, callback, options) : target["addListener"](callback); 105 listeners.push([target, event, namespace, callback, remover]); 106 }); 107 } 108 109 function unbind(targets, events, callback) { 110 forEachEvent(targets, events, function (target, event, namespace) { 111 listeners = listeners.filter(function (listener) { 112 if (listener[0] === target && listener[1] === event && listener[2] === namespace && (!callback || listener[3] === callback)) { 113 listener[4](); 114 return false; 115 } 116 117 return true; 118 }); 119 }); 120 } 121 122 function dispatch(target, type, detail) { 123 var e; 124 var bubbles = true; 125 126 if (typeof CustomEvent === "function") { 127 e = new CustomEvent(type, { 128 bubbles: bubbles, 129 detail: detail 130 }); 131 } else { 132 e = document.createEvent("CustomEvent"); 133 e.initCustomEvent(type, bubbles, false, detail); 134 } 135 136 target.dispatchEvent(e); 137 return e; 138 } 139 140 function forEachEvent(targets, events, iteratee) { 141 forEach$1(targets, function (target) { 142 target && forEach$1(events, function (events2) { 143 events2.split(" ").forEach(function (eventNS) { 144 var fragment = eventNS.split("."); 145 iteratee(target, fragment[0], fragment[1]); 146 }); 147 }); 148 }); 149 } 150 151 function destroy() { 152 listeners.forEach(function (data) { 153 data[4](); 154 }); 155 empty(listeners); 156 } 157 158 return { 159 bind: bind, 160 unbind: unbind, 161 dispatch: dispatch, 162 destroy: destroy 163 }; 164} 165 166var EVENT_MOUNTED = "mounted"; 167var EVENT_MOVE = "move"; 168var EVENT_MOVED = "moved"; 169var EVENT_DRAG = "drag"; 170var EVENT_DRAGGING = "dragging"; 171var EVENT_SCROLL = "scroll"; 172var EVENT_SCROLLED = "scrolled"; 173var EVENT_DESTROY = "destroy"; 174 175function EventInterface(Splide2) { 176 var bus = Splide2 ? Splide2.event.bus : document.createDocumentFragment(); 177 var binder = EventBinder(); 178 179 function on(events, callback) { 180 binder.bind(bus, toArray$1(events).join(" "), function (e) { 181 callback.apply(callback, isArray$1(e.detail) ? e.detail : []); 182 }); 183 } 184 185 function emit(event) { 186 binder.dispatch(bus, event, slice$1(arguments, 1)); 187 } 188 189 if (Splide2) { 190 Splide2.event.on(EVENT_DESTROY, binder.destroy); 191 } 192 193 return assign$1(binder, { 194 bus: bus, 195 on: on, 196 off: apply$1(binder.unbind, bus), 197 emit: emit 198 }); 199} 200 201function State(initialState) { 202 var state = initialState; 203 204 function set(value) { 205 state = value; 206 } 207 208 function is(states) { 209 return includes(toArray$1(states), state); 210 } 211 212 return { 213 set: set, 214 is: is 215 }; 216} 217var CLASS_SLIDE = PROJECT_CODE$1 + "__slide"; 218var CLASS_CONTAINER = CLASS_SLIDE + "__container"; 219 220function slice(arrayLike, start, end) { 221 return Array.prototype.slice.call(arrayLike, start, end); 222} 223 224function find(arrayLike, predicate) { 225 return slice(arrayLike).filter(predicate)[0]; 226} 227 228function apply(func) { 229 return func.bind(null, ...slice(arguments, 1)); 230} 231 232function typeOf(type, subject) { 233 return typeof subject === type; 234} 235function isObject(subject) { 236 return !isNull(subject) && typeOf("object", subject); 237} 238const isArray = Array.isArray; 239const isFunction = apply(typeOf, "function"); 240const isString = apply(typeOf, "string"); 241const isUndefined = apply(typeOf, "undefined"); 242function isNull(subject) { 243 return subject === null; 244} 245function isHTMLElement(subject) { 246 return subject instanceof HTMLElement; 247} 248 249function toArray(value) { 250 return isArray(value) ? value : [value]; 251} 252 253function forEach(values, iteratee) { 254 toArray(values).forEach(iteratee); 255} 256 257function toggleClass(elm, classes, add) { 258 if (elm) { 259 forEach(classes, (name) => { 260 if (name) { 261 elm.classList[add ? "add" : "remove"](name); 262 } 263 }); 264 } 265} 266 267function addClass(elm, classes) { 268 toggleClass(elm, isString(classes) ? classes.split(" ") : classes, true); 269} 270 271function append(parent, children) { 272 forEach(children, parent.appendChild.bind(parent)); 273} 274 275function matches(elm, selector) { 276 return isHTMLElement(elm) && (elm["msMatchesSelector"] || elm.matches).call(elm, selector); 277} 278 279function children(parent, selector) { 280 const children2 = parent ? slice(parent.children) : []; 281 return selector ? children2.filter((child) => matches(child, selector)) : children2; 282} 283 284function child(parent, selector) { 285 return selector ? children(parent, selector)[0] : parent.firstElementChild; 286} 287 288const ownKeys = Object.keys; 289 290function forOwn(object, iteratee, right) { 291 if (object) { 292 let keys = ownKeys(object); 293 keys = right ? keys.reverse() : keys; 294 for (let i = 0; i < keys.length; i++) { 295 const key = keys[i]; 296 if (key !== "__proto__") { 297 if (iteratee(object[key], key) === false) { 298 break; 299 } 300 } 301 } 302 } 303 return object; 304} 305 306function assign(object) { 307 slice(arguments, 1).forEach((source) => { 308 forOwn(source, (value, key) => { 309 object[key] = source[key]; 310 }); 311 }); 312 return object; 313} 314 315function merge(object) { 316 slice(arguments, 1).forEach((source) => { 317 forOwn(source, (value, key) => { 318 if (isArray(value)) { 319 object[key] = value.slice(); 320 } else if (isObject(value)) { 321 object[key] = merge({}, isObject(object[key]) ? object[key] : {}, value); 322 } else { 323 object[key] = value; 324 } 325 }); 326 }); 327 return object; 328} 329 330function removeAttribute(elms, attrs) { 331 forEach(elms, (elm) => { 332 forEach(attrs, (attr) => { 333 elm && elm.removeAttribute(attr); 334 }); 335 }); 336} 337 338function setAttribute(elms, attrs, value) { 339 if (isObject(attrs)) { 340 forOwn(attrs, (value2, name) => { 341 setAttribute(elms, name, value2); 342 }); 343 } else { 344 forEach(elms, (elm) => { 345 isNull(value) || value === "" ? removeAttribute(elm, attrs) : elm.setAttribute(attrs, String(value)); 346 }); 347 } 348} 349 350function create(tag, attrs, parent) { 351 const elm = document.createElement(tag); 352 if (attrs) { 353 isString(attrs) ? addClass(elm, attrs) : setAttribute(elm, attrs); 354 } 355 parent && append(parent, elm); 356 return elm; 357} 358 359function style(elm, prop, value) { 360 if (isUndefined(value)) { 361 return getComputedStyle(elm)[prop]; 362 } 363 if (!isNull(value)) { 364 elm.style[prop] = `${value}`; 365 } 366} 367 368function display(elm, display2) { 369 style(elm, "display", display2); 370} 371 372function getAttribute(elm, attr) { 373 return elm.getAttribute(attr); 374} 375 376function hasClass(elm, className) { 377 return elm && elm.classList.contains(className); 378} 379 380function remove(nodes) { 381 forEach(nodes, (node) => { 382 if (node && node.parentNode) { 383 node.parentNode.removeChild(node); 384 } 385 }); 386} 387 388function queryAll(parent, selector) { 389 return selector ? slice(parent.querySelectorAll(selector)) : []; 390} 391 392function removeClass(elm, classes) { 393 toggleClass(elm, classes, false); 394} 395 396const PROJECT_CODE = "splide"; 397 398function error(message) { 399 console.error(`[${PROJECT_CODE}] ${message}`); 400} 401 402const { min, max, floor, ceil, abs } = Math; 403 404function clamp(number, x, y) { 405 const minimum = min(x, y); 406 const maximum = max(x, y); 407 return min(max(minimum, number), maximum); 408} 409 410const CLASS_VIDEO = "splide__video"; 411const CLASS_VIDEO_WRAPPER = `${CLASS_VIDEO}__wrapper`; 412const CLASS_VIDEO_PLAY_BUTTON = `${CLASS_VIDEO}__play`; 413const CLASS_PLAYING = "is-playing"; 414const CLASS_ERROR = "is-error"; 415const CLASS_VIDEO_DISABLED = "is-video-disabled"; 416const MODIFIER_HAS_VIDEO = "--has-video"; 417 418const YOUTUBE_DATA_ATTRIBUTE = "data-splide-youtube"; 419const VIMEO_DATA_ATTRIBUTE = "data-splide-vimeo"; 420const HTML_VIDEO__DATA_ATTRIBUTE = "data-splide-html-video"; 421 422const DEFAULTS = { 423 hideControls: false, 424 loop: false, 425 mute: false, 426 volume: 0.2 427}; 428 429const EVENT_VIDEO_PLAY = "video:play"; 430const EVENT_VIDEO_PAUSE = "video:pause"; 431const EVENT_VIDEO_ENDED = "video:ended"; 432const EVENT_VIDEO_ERROR = "video:error"; 433const EVENT_VIDEO_CLICK = "video:click"; 434 435const NOT_INITIALIZED = 1; 436const INITIALIZING = 2; 437const INITIALIZED = 3; 438const PENDING_PLAY = 4; 439const IDLE = 5; 440const LOADING = 6; 441const PLAY_REQUEST_ABORTED = 7; 442const PLAYING = 8; 443const ERROR = 9; 444 445class AbstractVideoPlayer { 446 constructor(target, videoId, options) { 447 this.state = State(NOT_INITIALIZED); 448 this.event = EventInterface(); 449 this.target = target; 450 this.videoId = videoId; 451 this.options = options || {}; 452 this.onPlay = this.onPlay.bind(this); 453 this.onPause = this.onPause.bind(this); 454 this.onEnded = this.onEnded.bind(this); 455 this.onPlayerReady = this.onPlayerReady.bind(this); 456 this.onError = this.onError.bind(this); 457 } 458 on(events, callback) { 459 this.event.on(events, callback); 460 } 461 play() { 462 const { state } = this; 463 if (state.is(ERROR)) { 464 error("Can not play this video."); 465 return; 466 } 467 this.event.emit("play"); 468 if (state.is(INITIALIZING)) { 469 return state.set(PENDING_PLAY); 470 } 471 if (state.is(INITIALIZED)) { 472 this.player = this.createPlayer(this.videoId); 473 return state.set(PENDING_PLAY); 474 } 475 if (state.is([PENDING_PLAY, PLAYING])) { 476 return; 477 } 478 if (state.is(IDLE)) { 479 state.set(LOADING); 480 this.playVideo(); 481 } 482 } 483 pause() { 484 const { state } = this; 485 if (state.is(ERROR)) { 486 return; 487 } 488 this.event.emit("pause"); 489 if (state.is(PENDING_PLAY)) { 490 return state.set(INITIALIZING); 491 } 492 if (state.is(LOADING)) { 493 return state.set(PLAY_REQUEST_ABORTED); 494 } 495 if (state.is(PLAYING)) { 496 this.pauseVideo(); 497 this.state.set(IDLE); 498 } 499 } 500 isPaused() { 501 return !this.state.is(PLAYING); 502 } 503 destroy() { 504 this.event.destroy(); 505 } 506 onPlayerReady() { 507 const { state } = this; 508 const isPending = state.is(PENDING_PLAY); 509 state.set(IDLE); 510 if (isPending) { 511 this.play(); 512 } 513 } 514 onPlay() { 515 const { state } = this; 516 const aborted = state.is(PLAY_REQUEST_ABORTED); 517 state.set(PLAYING); 518 if (aborted) { 519 this.pause(); 520 } else { 521 this.event.emit("played"); 522 } 523 } 524 onPause() { 525 this.state.set(IDLE); 526 this.event.emit("paused"); 527 } 528 onEnded() { 529 this.state.set(IDLE); 530 this.event.emit("ended"); 531 } 532 onError() { 533 this.state.set(ERROR); 534 this.event.emit("error"); 535 } 536} 537 538class HTMLVideoPlayer extends AbstractVideoPlayer { 539 constructor(target, videoId, options = {}) { 540 super(target, videoId, options); 541 this.state.set(INITIALIZED); 542 } 543 createPlayer(videoId) { 544 const { options, options: { playerOptions = {} } } = this; 545 const player = create("video", { src: videoId }, this.target); 546 const on = player.addEventListener.bind(player); 547 assign(player, { 548 controls: !options.hideControls, 549 loop: options.loop, 550 volume: clamp(options.volume, 0, 1), 551 muted: options.mute 552 }, playerOptions.htmlVideo || {}); 553 on("play", this.onPlay); 554 on("pause", this.onPause); 555 on("ended", this.onEnded); 556 on("loadeddata", this.onPlayerReady); 557 on("error", this.onError); 558 return player; 559 } 560 playVideo() { 561 const promise = this.player.play(); 562 promise && promise.catch(this.onError.bind(this)); 563 } 564 pauseVideo() { 565 this.player.pause(); 566 } 567 onError() { 568 if (this.state.is(PLAY_REQUEST_ABORTED)) { 569 this.state.set(IDLE); 570 } else { 571 super.onError(); 572 } 573 } 574 destroy() { 575 super.destroy(); 576 const { player } = this; 577 const off = player.addEventListener.bind(player); 578 off("play", this.onPlay); 579 off("pause", this.onPause); 580 off("ended", this.onEnded); 581 off("loadeddata", this.onPlayerReady); 582 } 583} 584 585/*! @vimeo/player v2.17.1 | (c) 2022 Vimeo | MIT License | https://github.com/vimeo/player.js */ 586function _classCallCheck(instance, Constructor) { 587 if (!(instance instanceof Constructor)) { 588 throw new TypeError("Cannot call a class as a function"); 589 } 590} 591 592function _defineProperties(target, props) { 593 for (var i = 0; i < props.length; i++) { 594 var descriptor = props[i]; 595 descriptor.enumerable = descriptor.enumerable || false; 596 descriptor.configurable = true; 597 if ("value" in descriptor) descriptor.writable = true; 598 Object.defineProperty(target, descriptor.key, descriptor); 599 } 600} 601 602function _createClass(Constructor, protoProps, staticProps) { 603 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 604 if (staticProps) _defineProperties(Constructor, staticProps); 605 return Constructor; 606} 607 608/** 609 * @module lib/functions 610 */ 611 612/** 613 * Check to see this is a node environment. 614 * @type {Boolean} 615 */ 616 617/* global global */ 618var isNode = typeof __webpack_require__.g !== 'undefined' && {}.toString.call(__webpack_require__.g) === '[object global]'; 619/** 620 * Get the name of the method for a given getter or setter. 621 * 622 * @param {string} prop The name of the property. 623 * @param {string} type Either âgetâ or âsetâ. 624 * @return {string} 625 */ 626 627function getMethodName(prop, type) { 628 if (prop.indexOf(type.toLowerCase()) === 0) { 629 return prop; 630 } 631 632 return "".concat(type.toLowerCase()).concat(prop.substr(0, 1).toUpperCase()).concat(prop.substr(1)); 633} 634/** 635 * Check to see if the object is a DOM Element. 636 * 637 * @param {*} element The object to check. 638 * @return {boolean} 639 */ 640 641function isDomElement(element) { 642 return Boolean(element && element.nodeType === 1 && 'nodeName' in element && element.ownerDocument && element.ownerDocument.defaultView); 643} 644/** 645 * Check to see whether the value is a number. 646 * 647 * @see http://dl.dropboxusercontent.com/u/35146/js/tests/isNumber.html 648 * @param {*} value The value to check. 649 * @param {boolean} integer Check if the value is an integer. 650 * @return {boolean} 651 */ 652 653function isInteger(value) { 654 // eslint-disable-next-line eqeqeq 655 return !isNaN(parseFloat(value)) && isFinite(value) && Math.floor(value) == value; 656} 657/** 658 * Check to see if the URL is a Vimeo url. 659 * 660 * @param {string} url The url string. 661 * @return {boolean} 662 */ 663 664function isVimeoUrl(url) { 665 return /^(https?:)?\/\/((player|www)\.)?vimeo\.com(?=$|\/)/.test(url); 666} 667/** 668 * Check to see if the URL is for a Vimeo embed. 669 * 670 * @param {string} url The url string. 671 * @return {boolean} 672 */ 673 674function isVimeoEmbed(url) { 675 var expr = /^https:\/\/player\.vimeo\.com\/video\/\d+/; 676 return expr.test(url); 677} 678/** 679 * Get the Vimeo URL from an element. 680 * The element must have either a data-vimeo-id or data-vimeo-url attribute. 681 * 682 * @param {object} oEmbedParameters The oEmbed parameters. 683 * @return {string} 684 */ 685 686function getVimeoUrl() { 687 var oEmbedParameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 688 var id = oEmbedParameters.id; 689 var url = oEmbedParameters.url; 690 var idOrUrl = id || url; 691 692 if (!idOrUrl) { 693 throw new Error('An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.'); 694 } 695 696 if (isInteger(idOrUrl)) { 697 return "https://vimeo.com/".concat(idOrUrl); 698 } 699 700 if (isVimeoUrl(idOrUrl)) { 701 return idOrUrl.replace('http:', 'https:'); 702 } 703 704 if (id) { 705 throw new TypeError("\u201C".concat(id, "\u201D is not a valid video id.")); 706 } 707 708 throw new TypeError("\u201C".concat(idOrUrl, "\u201D is not a vimeo.com url.")); 709} 710 711var arrayIndexOfSupport = typeof Array.prototype.indexOf !== 'undefined'; 712var postMessageSupport = typeof window !== 'undefined' && typeof window.postMessage !== 'undefined'; 713 714if (!isNode && (!arrayIndexOfSupport || !postMessageSupport)) { 715 throw new Error('Sorry, the Vimeo Player API is not available in this browser.'); 716} 717 718var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {}; 719 720function createCommonjsModule(fn, module) { 721 return module = { exports: {} }, fn(module, module.exports), module.exports; 722} 723 724/*! 725 * weakmap-polyfill v2.0.4 - ECMAScript6 WeakMap polyfill 726 * https://github.com/polygonplanet/weakmap-polyfill 727 * Copyright (c) 2015-2021 polygonplanet <[email protected]> 728 * @license MIT 729 */ 730(function (self) { 731 732 if (self.WeakMap) { 733 return; 734 } 735 736 var hasOwnProperty = Object.prototype.hasOwnProperty; 737 738 var hasDefine = Object.defineProperty && function () { 739 try { 740 // Avoid IE8's broken Object.defineProperty 741 return Object.defineProperty({}, 'x', { 742 value: 1 743 }).x === 1; 744 } catch (e) {} 745 }(); 746 747 var defineProperty = function (object, name, value) { 748 if (hasDefine) { 749 Object.defineProperty(object, name, { 750 configurable: true, 751 writable: true, 752 value: value 753 }); 754 } else { 755 object[name] = value; 756 } 757 }; 758 759 self.WeakMap = function () { 760 // ECMA-262 23.3 WeakMap Objects 761 function WeakMap() { 762 if (this === void 0) { 763 throw new TypeError("Constructor WeakMap requires 'new'"); 764 } 765 766 defineProperty(this, '_id', genId('_WeakMap')); // ECMA-262 23.3.1.1 WeakMap([iterable]) 767 768 if (arguments.length > 0) { 769 // Currently, WeakMap `iterable` argument is not supported 770 throw new TypeError('WeakMap iterable is not supported'); 771 } 772 } // ECMA-262 23.3.3.2 WeakMap.prototype.delete(key) 773 774 775 defineProperty(WeakMap.prototype, 'delete', function (key) { 776 checkInstance(this, 'delete'); 777 778 if (!isObject(key)) { 779 return false; 780 } 781 782 var entry = key[this._id]; 783 784 if (entry && entry[0] === key) { 785 delete key[this._id]; 786 return true; 787 } 788 789 return false; 790 }); // ECMA-262 23.3.3.3 WeakMap.prototype.get(key) 791 792 defineProperty(WeakMap.prototype, 'get', function (key) { 793 checkInstance(this, 'get'); 794 795 if (!isObject(key)) { 796 return void 0; 797 } 798 799 var entry = key[this._id]; 800 801 if (entry && entry[0] === key) { 802 return entry[1]; 803 } 804 805 return void 0; 806 }); // ECMA-262 23.3.3.4 WeakMap.prototype.has(key) 807 808 defineProperty(WeakMap.prototype, 'has', function (key) { 809 checkInstance(this, 'has'); 810 811 if (!isObject(key)) { 812 return false; 813 } 814 815 var entry = key[this._id]; 816 817 if (entry && entry[0] === key) { 818 return true; 819 } 820 821 return false; 822 }); // ECMA-262 23.3.3.5 WeakMap.prototype.set(key, value) 823 824 defineProperty(WeakMap.prototype, 'set', function (key, value) { 825 checkInstance(this, 'set'); 826 827 if (!isObject(key)) { 828 throw new TypeError('Invalid value used as weak map key'); 829 } 830 831 var entry = key[this._id]; 832 833 if (entry && entry[0] === key) { 834 entry[1] = value; 835 return this; 836 } 837 838 defineProperty(key, this._id, [key, value]); 839 return this; 840 }); 841 842 function checkInstance(x, methodName) { 843 if (!isObject(x) || !hasOwnProperty.call(x, '_id')) { 844 throw new TypeError(methodName + ' method called on incompatible receiver ' + typeof x); 845 } 846 } 847 848 function genId(prefix) { 849 return prefix + '_' + rand() + '.' + rand(); 850 } 851 852 function rand() { 853 return Math.random().toString().substring(2); 854 } 855 856 defineProperty(WeakMap, '_polyfill', true); 857 return WeakMap; 858 }(); 859 860 function isObject(x) { 861 return Object(x) === x; 862 } 863})(typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : commonjsGlobal); 864 865var npo_src = createCommonjsModule(function (module) { 866/*! Native Promise Only 867 v0.8.1 (c) Kyle Simpson 868 MIT License: http://getify.mit-license.org 869*/ 870(function UMD(name, context, definition) { 871 // special form of UMD for polyfilling across evironments 872 context[name] = context[name] || definition(); 873 874 if ( module.exports) { 875 module.exports = context[name]; 876 } 877})("Promise", typeof commonjsGlobal != "undefined" ? commonjsGlobal : commonjsGlobal, function DEF() { 878 879 var builtInProp, 880 cycle, 881 scheduling_queue, 882 ToString = Object.prototype.toString, 883 timer = typeof setImmediate != "undefined" ? function timer(fn) { 884 return setImmediate(fn); 885 } : setTimeout; // dammit, IE8. 886 887 try { 888 Object.defineProperty({}, "x", {}); 889 890 builtInProp = function builtInProp(obj, name, val, config) { 891 return Object.defineProperty(obj, name, { 892 value: val, 893 writable: true, 894 configurable: config !== false 895 }); 896 }; 897 } catch (err) { 898 builtInProp = function builtInProp(obj, name, val) { 899 obj[name] = val; 900 return obj; 901 }; 902 } // Note: using a queue instead of array for efficiency 903 904 905 scheduling_queue = function Queue() { 906 var first, last, item; 907 908 function Item(fn, self) { 909 this.fn = fn; 910 this.self = self; 911 this.next = void 0; 912 } 913 914 return { 915 add: function add(fn, self) { 916 item = new Item(fn, self); 917 918 if (last) { 919 last.next = item; 920 } else { 921 first = item; 922 } 923 924 last = item; 925 item = void 0; 926 }, 927 drain: function drain() { 928 var f = first; 929 first = last = cycle = void 0; 930 931 while (f) { 932 f.fn.call(f.self); 933 f = f.next; 934 } 935 } 936 }; 937 }(); 938 939 function schedule(fn, self) { 940 scheduling_queue.add(fn, self); 941 942 if (!cycle) { 943 cycle = timer(scheduling_queue.drain); 944 } 945 } // promise duck typing 946 947 948 function isThenable(o) { 949 var _then, 950 o_type = typeof o; 951 952 if (o != null && (o_type == "object" || o_type == "function")) { 953 _then = o.then; 954 } 955 956 return typeof _then == "function" ? _then : false; 957 } 958 959 function notify() { 960 for (var i = 0; i < this.chain.length; i++) { 961 notifyIsolated(this, this.state === 1 ? this.chain[i].success : this.chain[i].failure, this.chain[i]); 962 } 963 964 this.chain.length = 0; 965 } // NOTE: This is a separate function to isolate 966 // the `try..catch` so that other code can be 967 // optimized better 968 969 970 function notifyIsolated(self, cb, chain) { 971 var ret, _then; 972 973 try { 974 if (cb === false) { 975 chain.reject(self.msg); 976 } else { 977 if (cb === true) { 978 ret = self.msg; 979 } else { 980 ret = cb.call(void 0, self.msg); 981 } 982 983 if (ret === chain.promise) { 984 chain.reject(TypeError("Promise-chain cycle")); 985 } else if (_then = isThenable(ret)) { 986 _then.call(ret, chain.resolve, chain.reject); 987 } else { 988 chain.resolve(ret); 989 } 990 } 991 } catch (err) { 992 chain.reject(err); 993 } 994 } 995 996 function resolve(msg) { 997 var _then, 998 self = this; // already triggered? 999 1000 1001 if (self.triggered) { 1002 return; 1003 } 1004 1005 self.triggered = true; // unwrap 1006 1007 if (self.def) { 1008 self = self.def; 1009 } 1010 1011 try { 1012 if (_then = isThenable(msg)) { 1013 schedule(function () { 1014 var def_wrapper = new MakeDefWrapper(self); 1015 1016 try { 1017 _then.call(msg, function $resolve$() { 1018 resolve.apply(def_wrapper, arguments); 1019 }, function $reject$() { 1020 reject.apply(def_wrapper, arguments); 1021 }); 1022 } catch (err) { 1023 reject.call(def_wrapper, err); 1024 } 1025 }); 1026 } else { 1027 self.msg = msg; 1028 self.state = 1; 1029 1030 if (self.chain.length > 0) { 1031 schedule(notify, self); 1032 } 1033 } 1034 } catch (err) { 1035 reject.call(new MakeDefWrapper(self), err); 1036 } 1037 } 1038 1039 function reject(msg) { 1040 var self = this; // already triggered? 1041 1042 if (self.triggered) { 1043 return; 1044 } 1045 1046 self.triggered = true; // unwrap 1047 1048 if (self.def) { 1049 self = self.def; 1050 } 1051 1052 self.msg = msg; 1053 self.state = 2; 1054 1055 if (self.chain.length > 0) { 1056 schedule(notify, self); 1057 } 1058 } 1059 1060 function iteratePromises(Constructor, arr, resolver, rejecter) { 1061 for (var idx = 0; idx < arr.length; idx++) { 1062 (function IIFE(idx) { 1063 Constructor.resolve(arr[idx]).then(function $resolver$(msg) { 1064 resolver(idx, msg); 1065 }, rejecter); 1066 })(idx); 1067 } 1068 } 1069 1070 function MakeDefWrapper(self) { 1071 this.def = self; 1072 this.triggered = false; 1073 } 1074 1075 function MakeDef(self) { 1076 this.promise = self; 1077 this.state = 0; 1078 this.triggered = false; 1079 this.chain = []; 1080 this.msg = void 0; 1081 } 1082 1083 function Promise(executor) { 1084 if (typeof executor != "function") { 1085 throw TypeError("Not a function"); 1086 } 1087 1088 if (this.__NPO__ !== 0) { 1089 throw TypeError("Not a promise"); 1090 } // instance shadowing the inherited "brand" 1091 // to signal an already "initialized" promise 1092 1093 1094 this.__NPO__ = 1; 1095 var def = new MakeDef(this); 1096 1097 this["then"] = function then(success, failure) { 1098 var o = { 1099 success: typeof success == "function" ? success : true, 1100 failure: typeof failure == "function" ? failure : false 1101 }; // Note: `then(..)` itself can be borrowed to be used against 1102 // a different promise constructor for making the chained promise, 1103 // by substituting a different `this` binding. 1104 1105 o.promise = new this.constructor(function extractChain(resolve, reject) { 1106 if (typeof resolve != "function" || typeof reject != "function") { 1107 throw TypeError("Not a function"); 1108 } 1109 1110 o.resolve = resolve; 1111 o.reject = reject; 1112 }); 1113 def.chain.push(o); 1114 1115 if (def.state !== 0) { 1116 schedule(notify, def); 1117 } 1118 1119 return o.promise; 1120 }; 1121 1122 this["catch"] = function $catch$(failure) { 1123 return this.then(void 0, failure); 1124 }; 1125 1126 try { 1127 executor.call(void 0, function publicResolve(msg) { 1128 resolve.call(def, msg); 1129 }, function publicReject(msg) { 1130 reject.call(def, msg); 1131 }); 1132 } catch (err) { 1133 reject.call(def, err); 1134 } 1135 } 1136 1137 var PromisePrototype = builtInProp({}, "constructor", Promise, 1138 /*configurable=*/ 1139 false); // Note: Android 4 cannot use `Object.defineProperty(..)` here 1140 1141 Promise.prototype = PromisePrototype; // built-in "brand" to signal an "uninitialized" promise 1142 1143 builtInProp(PromisePrototype, "__NPO__", 0, 1144 /*configurable=*/ 1145 false); 1146 builtInProp(Promise, "resolve", function Promise$resolve(msg) { 1147 var Constructor = this; // spec mandated checks 1148 // note: best "isPromise" check that's practical for now 1149 1150 if (msg && typeof msg == "object" && msg.__NPO__ === 1) { 1151 return msg; 1152 } 1153 1154 return new Constructor(function executor(resolve, reject) { 1155 if (typeof resolve != "function" || typeof reject != "function") { 1156 throw TypeError("Not a function"); 1157 } 1158 1159 resolve(msg); 1160 }); 1161 }); 1162 builtInProp(Promise, "reject", function Promise$reject(msg) { 1163 return new this(function executor(resolve, reject) { 1164 if (typeof resolve != "function" || typeof reject != "function") { 1165 throw TypeError("Not a function"); 1166 } 1167 1168 reject(msg); 1169 }); 1170 }); 1171 builtInProp(Promise, "all", function Promise$all(arr) { 1172 var Constructor = this; // spec mandated checks 1173 1174 if (ToString.call(arr) != "[object Array]") { 1175 return Constructor.reject(TypeError("Not an array")); 1176 } 1177 1178 if (arr.length === 0) { 1179 return Constructor.resolve([]); 1180 } 1181 1182 return new Constructor(function executor(resolve, reject) { 1183 if (typeof resolve != "function" || typeof reject != "function") { 1184 throw TypeError("Not a function"); 1185 } 1186 1187 var len = arr.length, 1188 msgs = Array(len), 1189 count = 0; 1190 iteratePromises(Constructor, arr, function resolver(idx, msg) { 1191 msgs[idx] = msg; 1192 1193 if (++count === len) { 1194 resolve(msgs); 1195 } 1196 }, reject); 1197 }); 1198 }); 1199 builtInProp(Promise, "race", function Promise$race(arr) { 1200 var Constructor = this; // spec mandated checks 1201 1202 if (ToString.call(arr) != "[object Array]") { 1203 return Constructor.reject(TypeError("Not an array")); 1204 } 1205 1206 return new Constructor(function executor(resolve, reject) { 1207 if (typeof resolve != "function" || typeof reject != "function") { 1208 throw TypeError("Not a function"); 1209 } 1210 1211 iteratePromises(Constructor, arr, function resolver(idx, msg) { 1212 resolve(msg); 1213 }, reject); 1214 }); 1215 }); 1216 return Promise; 1217}); 1218}); 1219 1220/** 1221 * @module lib/callbacks 1222 */ 1223var callbackMap = new WeakMap(); 1224/** 1225 * Store a callback for a method or event for a player. 1226 * 1227 * @param {Player} player The player object. 1228 * @param {string} name The method or event name. 1229 * @param {(function(this:Player, *): void|{resolve: function, reject: function})} callback 1230 * The callback to call or an object with resolve and reject functions for a promise. 1231 * @return {void} 1232 */ 1233 1234function storeCallback(player, name, callback) { 1235 var playerCallbacks = callbackMap.get(player.element) || {}; 1236 1237 if (!(name in playerCallbacks)) { 1238 playerCallbacks[name] = []; 1239 } 1240 1241 playerCallbacks[name].push(callback); 1242 callbackMap.set(player.element, playerCallbacks); 1243} 1244/** 1245 * Get the callbacks for a player and event or method. 1246 * 1247 * @param {Player} player The player object. 1248 * @param {string} name The method or event name 1249 * @return {function[]} 1250 */ 1251 1252function getCallbacks(player, name) { 1253 var playerCallbacks = callbackMap.get(player.element) || {}; 1254 return playerCallbacks[name] || []; 1255} 1256/** 1257 * Remove a stored callback for a method or event for a player. 1258 * 1259 * @param {Player} player The player object. 1260 * @param {string} name The method or event name 1261 * @param {function} [callback] The specific callback to remove. 1262 * @return {boolean} Was this the last callback? 1263 */ 1264 1265function removeCallback(player, name, callback) { 1266 var playerCallbacks = callbackMap.get(player.element) || {}; 1267 1268 if (!playerCallbacks[name]) { 1269 return true; 1270 } // If no callback is passed, remove all callbacks for the event 1271 1272 1273 if (!callback) { 1274 playerCallbacks[name] = []; 1275 callbackMap.set(player.element, playerCallbacks); 1276 return true; 1277 } 1278 1279 var index = playerCallbacks[name].indexOf(callback); 1280 1281 if (index !== -1) { 1282 playerCallbacks[name].splice(index, 1); 1283 } 1284 1285 callbackMap.set(player.element, playerCallbacks); 1286 return playerCallbacks[name] && playerCallbacks[name].length === 0; 1287} 1288/** 1289 * Return the first stored callback for a player and event or method. 1290 * 1291 * @param {Player} player The player object. 1292 * @param {string} name The method or event name. 1293 * @return {function} The callback, or false if there were none 1294 */ 1295 1296function shiftCallbacks(player, name) { 1297 var playerCallbacks = getCallbacks(player, name); 1298 1299 if (playerCallbacks.length < 1) { 1300 return false; 1301 } 1302 1303 var callback = playerCallbacks.shift(); 1304 removeCallback(player, name, callback); 1305 return callback; 1306} 1307/** 1308 * Move callbacks associated with an element to another element. 1309 * 1310 * @param {HTMLElement} oldElement The old element. 1311 * @param {HTMLElement} newElement The new element. 1312 * @return {void} 1313 */ 1314 1315function swapCallbacks(oldElement, newElement) { 1316 var playerCallbacks = callbackMap.get(oldElement); 1317 callbackMap.set(newElement, playerCallbacks); 1318 callbackMap.delete(oldElement); 1319} 1320 1321/** 1322 * @module lib/postmessage 1323 */ 1324/** 1325 * Parse a message received from postMessage. 1326 * 1327 * @param {*} data The data received from postMessage. 1328 * @return {object} 1329 */ 1330 1331function parseMessageData(data) { 1332 if (typeof data === 'string') { 1333 try { 1334 data = JSON.parse(data); 1335 } catch (error) { 1336 // If the message cannot be parsed, throw the error as a warning 1337 console.warn(error); 1338 return {}; 1339 } 1340 } 1341 1342 return data; 1343} 1344/** 1345 * Post a message to the specified target. 1346 * 1347 * @param {Player} player The player object to use. 1348 * @param {string} method The API method to call. 1349 * @param {object} params The parameters to send to the player. 1350 * @return {void} 1351 */ 1352 1353function postMessage(player, method, params) { 1354 if (!player.element.contentWindow || !player.element.contentWindow.postMessage) { 1355 return; 1356 } 1357 1358 var message = { 1359 method: method 1360 }; 1361 1362 if (params !== undefined) { 1363 message.value = params; 1364 } // IE 8 and 9 do not support passing messages, so stringify them 1365 1366 1367 var ieVersion = parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/, '$1')); 1368 1369 if (ieVersion >= 8 && ieVersion < 10) { 1370 message = JSON.stringify(message); 1371 } 1372 1373 player.element.contentWindow.postMessage(message, player.origin); 1374} 1375/** 1376 * Parse the data received from a message event. 1377 * 1378 * @param {Player} player The player that received the message. 1379 * @param {(Object|string)} data The message data. Strings will be parsed into JSON. 1380 * @return {void} 1381 */ 1382 1383function processData(player, data) { 1384 data = parseMessageData(data); 1385 var callbacks = []; 1386 var param; 1387 1388 if (data.event) { 1389 if (data.event === 'error') { 1390 var promises = getCallbacks(player, data.data.method); 1391 promises.forEach(function (promise) { 1392 var error = new Error(data.data.message); 1393 error.name = data.data.name; 1394 promise.reject(error); 1395 removeCallback(player, data.data.method, promise); 1396 }); 1397 } 1398 1399 callbacks = getCallbacks(player, "event:".concat(data.event)); 1400 param = data.data; 1401 } else if (data.method) { 1402 var callback = shiftCallbacks(player, data.method); 1403 1404 if (callback) { 1405 callbacks.push(callback); 1406 param = data.value; 1407 } 1408 } 1409 1410 callbacks.forEach(function (callback) { 1411 try { 1412 if (typeof callback === 'function') { 1413 callback.call(player, param); 1414 return; 1415 } 1416 1417 callback.resolve(param); 1418 } catch (e) {// empty 1419 } 1420 }); 1421} 1422 1423/** 1424 * @module lib/embed 1425 */ 1426var oEmbedParameters = ['autopause', 'autoplay', 'background', 'byline', 'color', 'controls', 'dnt', 'height', 'id', 'interactive_params', 'keyboard', 'loop', 'maxheight', 'maxwidth', 'muted', 'playsinline', 'portrait', 'responsive', 'speed', 'texttrack', 'title', 'transparent', 'url', 'width']; 1427/** 1428 * Get the 'data-vimeo'-prefixed attributes from an element as an object. 1429 * 1430 * @param {HTMLElement} element The element. 1431 * @param {Object} [defaults={}] The default values to use. 1432 * @return {Object<string, string>} 1433 */ 1434 1435function getOEmbedParameters(element) { 1436 var defaults = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 1437 return oEmbedParameters.reduce(function (params, param) { 1438 var value = element.getAttribute("data-vimeo-".concat(param)); 1439 1440 if (value || value === '') { 1441 params[param] = value === '' ? 1 : value; 1442 } 1443 1444 return params; 1445 }, defaults); 1446} 1447/** 1448 * Create an embed from oEmbed data inside an element. 1449 * 1450 * @param {object} data The oEmbed data. 1451 * @param {HTMLElement} element The element to put the iframe in. 1452 * @return {HTMLIFrameElement} The iframe embed. 1453 */ 1454 1455function createEmbed(_ref, element) { 1456 var html = _ref.html; 1457 1458 if (!element) { 1459 throw new TypeError('An element must be provided'); 1460 } 1461 1462 if (element.getAttribute('data-vimeo-initialized') !== null) { 1463 return element.querySelector('iframe'); 1464 } 1465 1466 var div = document.createElement('div'); 1467 div.innerHTML = html; 1468 element.appendChild(div.firstChild); 1469 element.setAttribute('data-vimeo-initialized', 'true'); 1470 return element.querySelector('iframe'); 1471} 1472/** 1473 * Make an oEmbed call for the specified URL. 1474 * 1475 * @param {string} videoUrl The vimeo.com url for the video. 1476 * @param {Object} [params] Parameters to pass to oEmbed. 1477 * @param {HTMLElement} element The element. 1478 * @return {Promise} 1479 */ 1480 1481function getOEmbedData(videoUrl) { 1482 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 1483 var element = arguments.length > 2 ? arguments[2] : undefined; 1484 return new Promise(function (resolve, reject) { 1485 if (!isVimeoUrl(videoUrl)) { 1486 throw new TypeError("\u201C".concat(videoUrl, "\u201D is not a vimeo.com url.")); 1487 } 1488 1489 var url = "https://vimeo.com/api/oembed.json?url=".concat(encodeURIComponent(videoUrl)); 1490 1491 for (var param in params) { 1492 if (params.hasOwnProperty(param)) { 1493 url += "&".concat(param, "=").concat(encodeURIComponent(params[param])); 1494 } 1495 } 1496 1497 var xhr = 'XDomainRequest' in window ? new XDomainRequest() : new XMLHttpRequest(); 1498 xhr.open('GET', url, true); 1499 1500 xhr.onload = function () { 1501 if (xhr.status === 404) { 1502 reject(new Error("\u201C".concat(videoUrl, "\u201D was not found."))); 1503 return; 1504 } 1505 1506 if (xhr.status === 403) { 1507 reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable."))); 1508 return; 1509 } 1510 1511 try { 1512 var json = JSON.parse(xhr.responseText); // Check api response for 403 on oembed 1513 1514 if (json.domain_status_code === 403) { 1515 // We still want to create the embed to give users visual feedback 1516 createEmbed(json, element); 1517 reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable."))); 1518 return; 1519 } 1520 1521 resolve(json); 1522 } catch (error) { 1523 reject(error); 1524 } 1525 }; 1526 1527 xhr.onerror = function () { 1528 var status = xhr.status ? " (".concat(xhr.status, ")") : ''; 1529 reject(new Error("There was an error fetching the embed code from Vimeo".concat(status, "."))); 1530 }; 1531 1532 xhr.send(); 1533 }); 1534} 1535/** 1536 * Initialize all embeds within a specific element 1537 * 1538 * @param {HTMLElement} [parent=document] The parent element. 1539 * @return {void} 1540 */ 1541 1542function initializeEmbeds() { 1543 var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 1544 var elements = [].slice.call(parent.querySelectorAll('[data-vimeo-id], [data-vimeo-url]')); 1545 1546 var handleError = function handleError(error) { 1547 if ('console' in window && console.error) { 1548 console.error("There was an error creating an embed: ".concat(error)); 1549 } 1550 }; 1551 1552 elements.forEach(function (element) { 1553 try { 1554 // Skip any that have data-vimeo-defer 1555 if (element.getAttribute('data-vimeo-defer') !== null) { 1556 return; 1557 } 1558 1559 var params = getOEmbedParameters(element); 1560 var url = getVimeoUrl(params); 1561 getOEmbedData(url, params, element).then(function (data) { 1562 return createEmbed(data, element); 1563 }).catch(handleError); 1564 } catch (error) { 1565 handleError(error); 1566 } 1567 }); 1568} 1569/** 1570 * Resize embeds when messaged by the player. 1571 * 1572 * @param {HTMLElement} [parent=document] The parent element. 1573 * @return {void} 1574 */ 1575 1576function resizeEmbeds() { 1577 var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 1578 1579 // Prevent execution if users include the player.js script multiple times. 1580 if (window.VimeoPlayerResizeEmbeds_) { 1581 return; 1582 } 1583 1584 window.VimeoPlayerResizeEmbeds_ = true; 1585 1586 var onMessage = function onMessage(event) { 1587 if (!isVimeoUrl(event.origin)) { 1588 return; 1589 } // 'spacechange' is fired only on embeds with cards 1590 1591 1592 if (!event.data || event.data.event !== 'spacechange') { 1593 return; 1594 } 1595 1596 var iframes = parent.querySelectorAll('iframe'); 1597 1598 for (var i = 0; i < iframes.length; i++) { 1599 if (iframes[i].contentWindow !== event.source) { 1600 continue; 1601 } // Change padding-bottom of the enclosing div to accommodate 1602 // card carousel without distorting aspect ratio 1603 1604 1605 var space = iframes[i].parentElement; 1606 space.style.paddingBottom = "".concat(event.data.data[0].bottom, "px"); 1607 break; 1608 } 1609 }; 1610 1611 window.addEventListener('message', onMessage); 1612} 1613/** 1614 * Add chapters to existing metadata for Google SEO 1615 * 1616 * @param {HTMLElement} [parent=document] The parent element. 1617 * @return {void} 1618 */ 1619 1620function initAppendVideoMetadata() { 1621 var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 1622 1623 // Prevent execution if users include the player.js script multiple times. 1624 if (window.VimeoSeoMetadataAppended) { 1625 return; 1626 } 1627 1628 window.VimeoSeoMetadataAppended = true; 1629 1630 var onMessage = function onMessage(event) { 1631 if (!isVimeoUrl(event.origin)) { 1632 return; 1633 } 1634 1635 var data = parseMessageData(event.data); 1636 1637 if (!data || data.event !== 'ready') { 1638 return; 1639 } 1640 1641 var iframes = parent.querySelectorAll('iframe'); 1642 1643 for (var i = 0; i < iframes.length; i++) { 1644 var iframe = iframes[i]; // Initiate appendVideoMetadata if iframe is a Vimeo embed 1645 1646 var isValidMessageSource = iframe.contentWindow === event.source; 1647 1648 if (isVimeoEmbed(iframe.src) && isValidMessageSource) { 1649 var player = new Player$1(iframe); 1650 player.callMethod('appendVideoMetadata', window.location.href); 1651 } 1652 } 1653 }; 1654 1655 window.addEventListener('message', onMessage); 1656} 1657 1658/* MIT License 1659 1660Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com) 1661 1662Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 1663 1664The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 1665 1666THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 1667Terms */ 1668function initializeScreenfull() { 1669 var fn = function () { 1670 var val; 1671 var fnMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'], // New WebKit 1672 ['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'], // Old WebKit 1673 ['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'], ['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'], ['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']]; 1674 var i = 0; 1675 var l = fnMap.length; 1676 var ret = {}; 1677 1678 for (; i < l; i++) { 1679 val = fnMap[i]; 1680 1681 if (val && val[1] in document) { 1682 for (i = 0; i < val.length; i++) { 1683 ret[fnMap[0][i]] = val[i]; 1684 } 1685 1686 return ret; 1687 } 1688 } 1689 1690 return false; 1691 }(); 1692 1693 var eventNameMap = { 1694 fullscreenchange: fn.fullscreenchange, 1695 fullscreenerror: fn.fullscreenerror 1696 }; 1697 var screenfull = { 1698 request: function request(element) { 1699 return new Promise(function (resolve, reject) { 1700 var onFullScreenEntered = function onFullScreenEntered() { 1701 screenfull.off('fullscreenchange', onFullScreenEntered); 1702 resolve(); 1703 }; 1704 1705 screenfull.on('fullscreenchange', onFullScreenEntered); 1706 element = element || document.documentElement; 1707 var returnPromise = element[fn.requestFullscreen](); 1708 1709 if (returnPromise instanceof Promise) { 1710 returnPromise.then(onFullScreenEntered).catch(reject); 1711 } 1712 }); 1713 }, 1714 exit: function exit() { 1715 return new Promise(function (resolve, reject) { 1716 if (!screenfull.isFullscreen) { 1717 resolve(); 1718 return; 1719 } 1720 1721 var onFullScreenExit = function onFullScreenExit() { 1722 screenfull.off('fullscreenchange', onFullScreenExit); 1723 resolve(); 1724 }; 1725 1726 screenfull.on('fullscreenchange', onFullScreenExit); 1727 var returnPromise = document[fn.exitFullscreen](); 1728 1729 if (returnPromise instanceof Promise) { 1730 returnPromise.then(onFullScreenExit).catch(reject); 1731 } 1732 }); 1733 }, 1734 on: function on(event, callback) { 1735 var eventName = eventNameMap[event]; 1736 1737 if (eventName) { 1738 document.addEventListener(eventName, callback); 1739 } 1740 }, 1741 off: function off(event, callback) { 1742 var eventName = eventNameMap[event]; 1743 1744 if (eventName) { 1745 document.removeEventListener(eventName, callback); 1746 } 1747 } 1748 }; 1749 Object.defineProperties(screenfull, { 1750 isFullscreen: { 1751 get: function get() { 1752 return Boolean(document[fn.fullscreenElement]); 1753 } 1754 }, 1755 element: { 1756 enumerable: true, 1757 get: function get() { 1758 return document[fn.fullscreenElement]; 1759 } 1760 }, 1761 isEnabled: { 1762 enumerable: true, 1763 get: function get() { 1764 // Coerce to boolean in case of old WebKit 1765 return Boolean(document[fn.fullscreenEnabled]); 1766 } 1767 } 1768 }); 1769 return screenfull; 1770} 1771 1772var playerMap = new WeakMap(); 1773var readyMap = new WeakMap(); 1774var screenfull = {}; 1775 1776var Player$1 = /*#__PURE__*/function () { 1777 /** 1778 * Create a Player. 1779 * 1780 * @param {(HTMLIFrameElement|HTMLElement|string|jQuery)} element A reference to the Vimeo 1781 * player iframe, and id, or a jQuery object. 1782 * @param {object} [options] oEmbed parameters to use when creating an embed in the element. 1783 * @return {Player} 1784 */ 1785 function Player(element) { 1786 var _this = this; 1787 1788 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 1789 1790 _classCallCheck(this, Player); 1791 1792 /* global jQuery */ 1793 if (window.jQuery && element instanceof jQuery) { 1794 if (element.length > 1 && window.console && console.warn) { 1795 console.warn('A jQuery object with multiple elements was passed, using the first element.'); 1796 } 1797 1798 element = element[0]; 1799 } // Find an element by ID 1800 1801 1802 if (typeof document !== 'undefined' && typeof element === 'string') { 1803 element = document.getElementById(element); 1804 } // Not an element! 1805 1806 1807 if (!isDomElement(element)) { 1808 throw new TypeError('You must pass either a valid element or a valid id.'); 1809 } // Already initialized an embed in this div, so grab the iframe 1810 1811 1812 if (element.nodeName !== 'IFRAME') { 1813 var iframe = element.querySelector('iframe'); 1814 1815 if (iframe) { 1816 element = iframe; 1817 } 1818 } // iframe url is not a Vimeo url 1819 1820 1821 if (element.nodeName === 'IFRAME' && !isVimeoUrl(element.getAttribute('src') || '')) { 1822 throw new Error('The player element passed isnât a Vimeo embed.'); 1823 } // If there is already a player object in the map, return that 1824 1825 1826 if (playerMap.has(element)) { 1827 return playerMap.get(element); 1828 } 1829 1830 this._window = element.ownerDocument.defaultView; 1831 this.element = element; 1832 this.origin = '*'; 1833 var readyPromise = new npo_src(function (resolve, reject) { 1834 _this._onMessage = function (event) { 1835 if (!isVimeoUrl(event.origin) || _this.element.contentWindow !== event.source) { 1836 return; 1837 } 1838 1839 if (_this.origin === '*') { 1840 _this.origin = event.origin; 1841 } 1842 1843 var data = parseMessageData(event.data); 1844 var isError = data && data.event === 'error'; 1845 var isReadyError = isError && data.data && data.data.method === 'ready'; 1846 1847 if (isReadyError) { 1848 var error = new Error(data.data.message); 1849 error.name = data.data.name; 1850 reject(error); 1851 return; 1852 } 1853 1854 var isReadyEvent = data && data.event === 'ready'; 1855 var isPingResponse = data && data.method === 'ping'; 1856 1857 if (isReadyEvent || isPingResponse) { 1858 _this.element.setAttribute('data-ready', 'true'); 1859 1860 resolve(); 1861 return; 1862 } 1863 1864 processData(_this, data); 1865 }; 1866 1867 _this._window.addEventListener('message', _this._onMessage); 1868 1869 if (_this.element.nodeName !== 'IFRAME') { 1870 var params = getOEmbedParameters(element, options); 1871 var url = getVimeoUrl(params); 1872 getOEmbedData(url, params, element).then(function (data) { 1873 var iframe = createEmbed(data, element); // Overwrite element with the new iframe, 1874 // but store reference to the original element 1875 1876 _this.element = iframe; 1877 _this._originalElement = element; 1878 swapCallbacks(element, iframe); 1879 playerMap.set(_this.element, _this); 1880 return data; 1881 }).catch(reject); 1882 } 1883 }); // Store a copy of this Player in the map 1884 1885 readyMap.set(this, readyPromise); 1886 playerMap.set(this.element, this); // Send a ping to the iframe so the ready promise will be resolved if 1887 // the player is already ready. 1888 1889 if (this.element.nodeName === 'IFRAME') { 1890 postMessage(this, 'ping'); 1891 } 1892 1893 if (screenfull.isEnabled) { 1894 var exitFullscreen = function exitFullscreen() { 1895 return screenfull.exit(); 1896 }; 1897 1898 this.fullscreenchangeHandler = function () { 1899 if (screenfull.isFullscreen) { 1900 storeCallback(_this, 'event:exitFullscreen', exitFullscreen); 1901 } else { 1902 removeCallback(_this, 'event:exitFullscreen', exitFullscreen); 1903 } // eslint-disable-next-line 1904 1905 1906 _this.ready().then(function () { 1907 postMessage(_this, 'fullscreenchange', screenfull.isFullscreen); 1908 }); 1909 }; 1910 1911 screenfull.on('fullscreenchange', this.fullscreenchangeHandler); 1912 } 1913 1914 return this; 1915 } 1916 /** 1917 * Get a promise for a method. 1918 * 1919 * @param {string} name The API method to call. 1920 * @param {Object} [args={}] Arguments to send via postMessage. 1921 * @return {Promise} 1922 */ 1923 1924 1925 _createClass(Player, [{ 1926 key: "callMethod", 1927 value: function callMethod(name) { 1928 var _this2 = this; 1929 1930 var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 1931 return new npo_src(function (resolve, reject) { 1932 // We are storing the resolve/reject handlers to call later, so we 1933 // canât return here. 1934 // eslint-disable-next-line promise/always-return 1935 return _this2.ready().then(function () { 1936 storeCallback(_this2, name, { 1937 resolve: resolve, 1938 reject: reject 1939 }); 1940 postMessage(_this2, name, args); 1941 }).catch(reject); 1942 }); 1943 } 1944 /** 1945 * Get a promise for the value of a player property. 1946 * 1947 * @param {string} name The property name 1948 * @return {Promise} 1949 */ 1950 1951 }, { 1952 key: "get", 1953 value: function get(name) { 1954 var _this3 = this; 1955 1956 return new npo_src(function (resolve, reject) { 1957 name = getMethodName(name, 'get'); // We are storing the resolve/reject handlers to call later, so we 1958 // canât return here. 1959 // eslint-disable-next-line promise/always-return 1960 1961 return _this3.ready().then(function () { 1962 storeCallback(_this3, name, { 1963 resolve: resolve, 1964 reject: reject 1965 }); 1966 postMessage(_this3, name); 1967 }).catch(reject); 1968 }); 1969 } 1970 /** 1971 * Get a promise for setting the value of a player property. 1972 * 1973 * @param {string} name The API method to call. 1974 * @param {mixed} value The value to set. 1975 * @return {Promise} 1976 */ 1977 1978 }, { 1979 key: "set", 1980 value: function set(name, value) { 1981 var _this4 = this; 1982 1983 return new npo_src(function (resolve, reject) { 1984 name = getMethodName(name, 'set'); 1985 1986 if (value === undefined || value === null) { 1987 throw new TypeError('There must be a value to set.'); 1988 } // We are storing the resolve/reject handlers to call later, so we 1989 // canât return here. 1990 // eslint-disable-next-line promise/always-return 1991 1992 1993 return _this4.ready().then(function () { 1994 storeCallback(_this4, name, { 1995 resolve: resolve, 1996 reject: reject 1997 }); 1998 postMessage(_this4, name, value); 1999 }).catch(reject); 2000 }); 2001 } 2002 /** 2003 * Add an event listener for the specified event. Will call the
2004 * callback with a single parameter, `data`, that contains the data for 2005 * that event. 2006 * 2007 * @param {string} eventName The name of the event. 2008 * @param {function(*)} callback The function to call when the event fires. 2009 * @return {void} 2010 */ 2011 2012 }, { 2013 key: "on", 2014 value: function on(eventName, callback) { 2015 if (!eventName) { 2016 throw new TypeError('You must pass an event name.'); 2017 } 2018 2019 if (!callback) { 2020 throw new TypeError('You must pass a callback function.'); 2021 } 2022 2023 if (typeof callback !== 'function') { 2024 throw new TypeError('The callback must be a function.'); 2025 } 2026 2027 var callbacks = getCallbacks(this, "event:".concat(eventName)); 2028 2029 if (callbacks.length === 0) { 2030 this.callMethod('addEventListener', eventName).catch(function () {// Ignore the error. There will be an error event fired that 2031 // will trigger the error callback if they are listening. 2032 }); 2033 } 2034 2035 storeCallback(this, "event:".concat(eventName), callback); 2036 } 2037 /** 2038 * Remove an event listener for the specified event. Will remove all 2039 * listeners for that event if a `callback` isnât passed, or only that 2040 * specific callback if it is passed. 2041 * 2042 * @param {string} eventName The name of the event. 2043 * @param {function} [callback] The specific callback to remove. 2044 * @return {void} 2045 */ 2046 2047 }, { 2048 key: "off", 2049 value: function off(eventName, callback) { 2050 if (!eventName) { 2051 throw new TypeError('You must pass an event name.'); 2052 } 2053 2054 if (callback && typeof callback !== 'function') { 2055 throw new TypeError('The callback must be a function.'); 2056 } 2057 2058 var lastCallback = removeCallback(this, "event:".concat(eventName), callback); // If there are no callbacks left, remove the listener 2059 2060 if (lastCallback) { 2061 this.callMethod('removeEventListener', eventName).catch(function (e) {// Ignore the error. There will be an error event fired that 2062 // will trigger the error callback if they are listening. 2063 }); 2064 } 2065 } 2066 /** 2067 * A promise to load a new video. 2068 *
2069 * @promise LoadVideoPromise 2070 * @fulfill {number} The video with this id or url successfully loaded. 2071 * @reject {TypeError} The id was not a number. 2072 */ 2073 2074 /** 2075 * Load a new video into this embed. The promise will be resolved if 2076 * the video is successfully loaded, or it will be rejected if it could 2077 * not be loaded. 2078 * 2079 * @param {number|string|object} options The id of the video, the url of the video, or an object with embed options. 2080 * @return {LoadVideoPromise} 2081 */ 2082 2083 }, { 2084 key: "loadVideo", 2085 value: function loadVideo(options) { 2086 return this.callMethod('loadVideo', options); 2087 } 2088 /** 2089 * A promise to perform an action when the Player is ready. 2090 * 2091 * @todo document errors 2092 * @promise LoadVideoPromise 2093 * @fulfill {void} 2094 */ 2095 2096 /** 2097 * Trigger a function when the player iframe has initialized. You do not 2098 * need to wait for `ready` to trigger to begin adding event listeners 2099 * or calling other methods. 2100 * 2101 * @return {ReadyPromise} 2102 */ 2103 2104 }, { 2105 key: "ready", 2106 value: function ready() { 2107 var readyPromise = readyMap.get(this) || new npo_src(function (resolve, reject) { 2108 reject(new Error('Unknown player. Probably unloaded.')); 2109 }); 2110 return npo_src.resolve(readyPromise); 2111 } 2112 /** 2113 * A promise to add a cue point to the player. 2114 * 2115 * @promise AddCuePointPromise 2116 * @fulfill {string} The id of the cue point to use for removeCuePoint. 2117 * @reject {RangeError} the time was less than 0 or greater than the 2118 * videoâs duration. 2119 * @reject {UnsupportedError} Cue points are not supported with the current 2120 * player or browser. 2121 */ 2122 2123 /** 2124 * Add a cue point to the player. 2125 * 2126 * @param {number} time The time for the cue point. 2127 * @param {object} [data] Arbitrary data to be returned with the cue point. 2128 * @return {AddCuePointPromise} 2129 */ 2130 2131 }, { 2132 key: "addCuePoint", 2133 value: function addCuePoint(time) { 2134 var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 2135 return this.callMethod('addCuePoint', { 2136 time: time, 2137 data: data 2138 }); 2139 } 2140 /** 2141 * A promise to remove a cue point from the player. 2142 * 2143 * @promise AddCuePointPromise 2144 * @fulfill {string} The id of the cue point that was removed. 2145 * @reject {InvalidCuePoint} The cue point with the specified id was not 2146 * found. 2147 * @reject {UnsupportedError} Cue points are not supported with the current 2148 * player or browser. 2149 */ 2150 2151 /** 2152 * Remove a cue point from the video. 2153 * 2154 * @param {string} id The id of the cue point to remove. 2155 * @return {RemoveCuePointPromise} 2156 */ 2157 2158 }, { 2159 key: "removeCuePoint", 2160 value: function removeCuePoint(id) { 2161 return this.callMethod('removeCuePoint', id); 2162 } 2163 /** 2164 * A representation of a text track on a video. 2165 * 2166 * @typedef {Object} VimeoTextTrack 2167 * @property {string} language The ISO language code. 2168 * @property {string} kind The kind of track it is (captions or subtitles). 2169 * @property {string} label The humanâreadable label for the track. 2170 */ 2171 2172 /** 2173 * A promise to enable a text track. 2174 * 2175 * @promise EnableTextTrackPromise 2176 * @fulfill {VimeoTextTrack} The text track that was enabled. 2177 * @reject {InvalidTrackLanguageError} No track was available with the 2178 * specified language. 2179 * @reject {InvalidTrackError} No track was available with the specified 2180 * language and kind. 2181 */ 2182 2183 /** 2184 * Enable the text track with the specified language, and optionally the 2185 * specified kind (captions or subtitles). 2186 * 2187 * When set via the API, the track language will not change the viewerâs 2188 * stored preference. 2189 * 2190 * @param {string} language The twoâletter language code. 2191 * @param {string} [kind] The kind of track to enable (captions or subtitles). 2192 * @return {EnableTextTrackPromise} 2193 */ 2194 2195 }, { 2196 key: "enableTextTrack", 2197 value: function enableTextTrack(language, kind) { 2198 if (!language) { 2199 throw new TypeError('You must pass a language.'); 2200 } 2201 2202 return this.callMethod('enableTextTrack', { 2203 language: language, 2204 kind: kind 2205 }); 2206 } 2207 /** 2208 * A promise to disable the active text track. 2209 * 2210 * @promise DisableTextTrackPromise 2211 * @fulfill {void} The track was disabled. 2212 */ 2213 2214 /** 2215 * Disable the currently-active text track. 2216 * 2217 * @return {DisableTextTrackPromise} 2218 */ 2219 2220 }, { 2221 key: "disableTextTrack", 2222 value: function disableTextTrack() { 2223 return this.callMethod('disableTextTrack'); 2224 } 2225 /** 2226 * A promise to pause the video. 2227 * 2228 * @promise PausePromise 2229 * @fulfill {void} The video was paused. 2230 */ 2231 2232 /** 2233 * Pause the video if itâs playing. 2234 * 2235 * @return {PausePromise} 2236 */ 2237 2238 }, { 2239 key: "pause", 2240 value: function pause() { 2241 return this.callMethod('pause'); 2242 } 2243 /** 2244 * A promise to play the video. 2245 * 2246 * @promise PlayPromise 2247 * @fulfill {void} The video was played. 2248 */ 2249 2250 /**
vendor: 33,621 bytes, lines 2251-3486
2251 * Play the video if itâs paused. **Note:** on iOS and some other 2252 * mobile devices, you cannot programmatically trigger play. Once the 2253 * viewer has tapped on the play button in the player, however, you 2254 * will be able to use this function. 2255 * 2256 * @return {PlayPromise} 2257 */ 2258 2259 }, { 2260 key: "play", 2261 value: function play() { 2262 return this.callMethod('play'); 2263 } 2264 /** 2265 * Request that the player enters fullscreen. 2266 * @return {Promise} 2267 */ 2268 2269 }, { 2270 key: "requestFullscreen", 2271 value: function requestFullscreen() { 2272 if (screenfull.isEnabled) { 2273 return screenfull.request(this.element); 2274 } 2275 2276 return this.callMethod('requestFullscreen'); 2277 } 2278 /** 2279 * Request that the player exits fullscreen. 2280 * @return {Promise} 2281 */ 2282 2283 }, { 2284 key: "exitFullscreen", 2285 value: function exitFullscreen() { 2286 if (screenfull.isEnabled) { 2287 return screenfull.exit(); 2288 } 2289 2290 return this.callMethod('exitFullscreen'); 2291 } 2292 /** 2293 * Returns true if the player is currently fullscreen. 2294 * @return {Promise} 2295 */ 2296 2297 }, { 2298 key: "getFullscreen", 2299 value: function getFullscreen() { 2300 if (screenfull.isEnabled) { 2301 return npo_src.resolve(screenfull.isFullscreen); 2302 } 2303 2304 return this.get('fullscreen'); 2305 } 2306 /** 2307 * Request that the player enters picture-in-picture. 2308 * @return {Promise} 2309 */ 2310 2311 }, { 2312 key: "requestPictureInPicture", 2313 value: function requestPictureInPicture() { 2314 return this.callMethod('requestPictureInPicture'); 2315 } 2316 /** 2317 * Request that the player exits picture-in-picture. 2318 * @return {Promise} 2319 */ 2320 2321 }, { 2322 key: "exitPictureInPicture", 2323 value: function exitPictureInPicture() { 2324 return this.callMethod('exitPictureInPicture'); 2325 } 2326 /** 2327 * Returns true if the player is currently picture-in-picture. 2328 * @return {Promise} 2329 */ 2330 2331 }, { 2332 key: "getPictureInPicture", 2333 value: function getPictureInPicture() { 2334 return this.get('pictureInPicture'); 2335 } 2336 /** 2337 * A promise to unload the video. 2338 * 2339 * @promise UnloadPromise 2340 * @fulfill {void} The video was unloaded. 2341 */ 2342 2343 /** 2344 * Return the player to its initial state. 2345 * 2346 * @return {UnloadPromise} 2347 */ 2348 2349 }, { 2350 key: "unload", 2351 value: function unload() { 2352 return this.callMethod('unload'); 2353 } 2354 /** 2355 * Cleanup the player and remove it from the DOM 2356 * 2357 * It won't be usable and a new one should be constructed 2358 * in order to do any operations. 2359 * 2360 * @return {Promise} 2361 */ 2362 2363 }, { 2364 key: "destroy", 2365 value: function destroy() { 2366 var _this5 = this; 2367 2368 return new npo_src(function (resolve) { 2369 readyMap.delete(_this5); 2370 playerMap.delete(_this5.element); 2371 2372 if (_this5._originalElement) { 2373 playerMap.delete(_this5._originalElement); 2374 2375 _this5._originalElement.removeAttribute('data-vimeo-initialized'); 2376 } 2377 2378 if (_this5.element && _this5.element.nodeName === 'IFRAME' && _this5.element.parentNode) { 2379 // If we've added an additional wrapper div, remove that from the DOM. 2380 // If not, just remove the iframe element. 2381 if (_this5.element.parentNode.parentNode && _this5._originalElement && _this5._originalElement !== _this5.element.parentNode) { 2382 _this5.element.parentNode.parentNode.removeChild(_this5.element.parentNode); 2383 } else { 2384 _this5.element.parentNode.removeChild(_this5.element); 2385 } 2386 } // If the clip is private there is a case where the element stays the 2387 // div element. Destroy should reset the div and remove the iframe child. 2388 2389 2390 if (_this5.element && _this5.element.nodeName === 'DIV' && _this5.element.parentNode) { 2391 _this5.element.removeAttribute('data-vimeo-initialized'); 2392 2393 var iframe = _this5.element.querySelector('iframe'); 2394 2395 if (iframe && iframe.parentNode) { 2396 // If we've added an additional wrapper div, remove that from the DOM. 2397 // If not, just remove the iframe element. 2398 if (iframe.parentNode.parentNode && _this5._originalElement && _this5._originalElement !== iframe.parentNode) { 2399 iframe.parentNode.parentNode.removeChild(iframe.parentNode); 2400 } else { 2401 iframe.parentNode.removeChild(iframe); 2402 } 2403 } 2404 } 2405 2406 _this5._window.removeEventListener('message', _this5._onMessage); 2407 2408 if (screenfull.isEnabled) { 2409 screenfull.off('fullscreenchange', _this5.fullscreenchangeHandler); 2410 } 2411 2412 resolve(); 2413 }); 2414 } 2415 /** 2416 * A promise to get the autopause behavior of the video. 2417 * 2418 * @promise GetAutopausePromise 2419 * @fulfill {boolean} Whether autopause is turned on or off. 2420 * @reject {UnsupportedError} Autopause is not supported with the current 2421 * player or browser. 2422 */ 2423 2424 /** 2425 * Get the autopause behavior for this player. 2426 * 2427 * @return {GetAutopausePromise} 2428 */ 2429 2430 }, { 2431 key: "getAutopause", 2432 value: function getAutopause() { 2433 return this.get('autopause'); 2434 } 2435 /** 2436 * A promise to set the autopause behavior of the video. 2437 * 2438 * @promise SetAutopausePromise 2439 * @fulfill {boolean} Whether autopause is turned on or off. 2440 * @reject {UnsupportedError} Autopause is not supported with the current 2441 * player or browser. 2442 */ 2443 2444 /** 2445 * Enable or disable the autopause behavior of this player. 2446 * 2447 * By default, when another video is played in the same browser, this 2448 * player will automatically pause. Unless you have a specific reason 2449 * for doing so, we recommend that you leave autopause set to the 2450 * default (`true`). 2451 * 2452 * @param {boolean} autopause 2453 * @return {SetAutopausePromise} 2454 */ 2455 2456 }, { 2457 key: "setAutopause", 2458 value: function setAutopause(autopause) { 2459 return this.set('autopause', autopause); 2460 } 2461 /** 2462 * A promise to get the buffered property of the video. 2463 * 2464 * @promise GetBufferedPromise 2465 * @fulfill {Array} Buffered Timeranges converted to an Array. 2466 */ 2467 2468 /** 2469 * Get the buffered property of the video. 2470 * 2471 * @return {GetBufferedPromise} 2472 */ 2473 2474 }, { 2475 key: "getBuffered", 2476 value: function getBuffered() { 2477 return this.get('buffered'); 2478 } 2479 /** 2480 * @typedef {Object} CameraProperties 2481 * @prop {number} props.yaw - Number between 0 and 360. 2482 * @prop {number} props.pitch - Number between -90 and 90. 2483 * @prop {number} props.roll - Number between -180 and 180. 2484 * @prop {number} props.fov - The field of view in degrees. 2485 */ 2486 2487 /** 2488 * A promise to get the camera properties of the player. 2489 * 2490 * @promise GetCameraPromise 2491 * @fulfill {CameraProperties} The camera properties. 2492 */ 2493 2494 /** 2495 * For 360° videos get the camera properties for this player. 2496 * 2497 * @return {GetCameraPromise} 2498 */ 2499 2500 }, { 2501 key: "getCameraProps", 2502 value: function getCameraProps() { 2503 return this.get('cameraProps'); 2504 } 2505 /** 2506 * A promise to set the camera properties of the player. 2507 * 2508 * @promise SetCameraPromise 2509 * @fulfill {Object} The camera was successfully set. 2510 * @reject {RangeError} The range was out of bounds. 2511 */ 2512 2513 /** 2514 * For 360° videos set the camera properties for this player. 2515 * 2516 * @param {CameraProperties} camera The camera properties 2517 * @return {SetCameraPromise} 2518 */ 2519 2520 }, { 2521 key: "setCameraProps", 2522 value: function setCameraProps(camera) { 2523 return this.set('cameraProps', camera); 2524 } 2525 /** 2526 * A representation of a chapter. 2527 * 2528 * @typedef {Object} VimeoChapter 2529 * @property {number} startTime The start time of the chapter. 2530 * @property {object} title The title of the chapter. 2531 * @property {number} index The place in the order of Chapters. Starts at 1. 2532 */ 2533 2534 /** 2535 * A promise to get chapters for the video. 2536 * 2537 * @promise GetChaptersPromise 2538 * @fulfill {VimeoChapter[]} The chapters for the video. 2539 */ 2540 2541 /** 2542 * Get an array of all the chapters for the video. 2543 * 2544 * @return {GetChaptersPromise} 2545 */ 2546 2547 }, { 2548 key: "getChapters", 2549 value: function getChapters() { 2550 return this.get('chapters'); 2551 } 2552 /** 2553 * A promise to get the currently active chapter. 2554 * 2555 * @promise GetCurrentChaptersPromise 2556 * @fulfill {VimeoChapter|undefined} The current chapter for the video. 2557 */ 2558 2559 /** 2560 * Get the currently active chapter for the video. 2561 * 2562 * @return {GetCurrentChaptersPromise} 2563 */ 2564 2565 }, { 2566 key: "getCurrentChapter", 2567 value: function getCurrentChapter() { 2568 return this.get('currentChapter'); 2569 } 2570 /** 2571 * A promise to get the color of the player. 2572 * 2573 * @promise GetColorPromise 2574 * @fulfill {string} The hex color of the player. 2575 */ 2576 2577 /** 2578 * Get the color for this player. 2579 * 2580 * @return {GetColorPromise} 2581 */ 2582 2583 }, { 2584 key: "getColor", 2585 value: function getColor() { 2586 return this.get('color'); 2587 } 2588 /** 2589 * A promise to set the color of the player. 2590 * 2591 * @promise SetColorPromise 2592 * @fulfill {string} The color was successfully set. 2593 * @reject {TypeError} The string was not a valid hex or rgb color. 2594 * @reject {ContrastError} The color was set, but the contrast is 2595 * outside of the acceptable range. 2596 * @reject {EmbedSettingsError} The owner of the player has chosen to 2597 * use a specific color. 2598 */ 2599 2600 /** 2601 * Set the color of this player to a hex or rgb string. Setting the 2602 * color may fail if the owner of the video has set their embed 2603 * preferences to force a specific color. 2604 * 2605 * @param {string} color The hex or rgb color string to set. 2606 * @return {SetColorPromise} 2607 */ 2608 2609 }, { 2610 key: "setColor", 2611 value: function setColor(color) { 2612 return this.set('color', color); 2613 } 2614 /** 2615 * A representation of a cue point. 2616 * 2617 * @typedef {Object} VimeoCuePoint 2618 * @property {number} time The time of the cue point. 2619 * @property {object} data The data passed when adding the cue point. 2620 * @property {string} id The unique id for use with removeCuePoint. 2621 */ 2622 2623 /** 2624 * A promise to get the cue points of a video. 2625 * 2626 * @promise GetCuePointsPromise 2627 * @fulfill {VimeoCuePoint[]} The cue points added to the video. 2628 * @reject {UnsupportedError} Cue points are not supported with the current 2629 * player or browser. 2630 */ 2631 2632 /** 2633 * Get an array of the cue points added to the video. 2634 * 2635 * @return {GetCuePointsPromise} 2636 */ 2637 2638 }, { 2639 key: "getCuePoints", 2640 value: function getCuePoints() { 2641 return this.get('cuePoints'); 2642 } 2643 /** 2644 * A promise to get the current time of the video. 2645 * 2646 * @promise GetCurrentTimePromise 2647 * @fulfill {number} The current time in seconds. 2648 */ 2649 2650 /** 2651 * Get the current playback position in seconds. 2652 * 2653 * @return {GetCurrentTimePromise} 2654 */ 2655 2656 }, { 2657 key: "getCurrentTime", 2658 value: function getCurrentTime() { 2659 return this.get('currentTime'); 2660 } 2661 /** 2662 * A promise to set the current time of the video. 2663 * 2664 * @promise SetCurrentTimePromise 2665 * @fulfill {number} The actual current time that was set. 2666 * @reject {RangeError} the time was less than 0 or greater than the 2667 * videoâs duration. 2668 */ 2669 2670 /** 2671 * Set the current playback position in seconds. If the player was 2672 * paused, it will remain paused. Likewise, if the player was playing, 2673 * it will resume playing once the video has buffered. 2674 * 2675 * You can provide an accurate time and the player will attempt to seek 2676 * to as close to that time as possible. The exact time will be the 2677 * fulfilled value of the promise. 2678 * 2679 * @param {number} currentTime 2680 * @return {SetCurrentTimePromise} 2681 */ 2682 2683 }, { 2684 key: "setCurrentTime", 2685 value: function setCurrentTime(currentTime) { 2686 return this.set('currentTime', currentTime); 2687 } 2688 /** 2689 * A promise to get the duration of the video. 2690 * 2691 * @promise GetDurationPromise 2692 * @fulfill {number} The duration in seconds. 2693 */ 2694 2695 /** 2696 * Get the duration of the video in seconds. It will be rounded to the 2697 * nearest second before playback begins, and to the nearest thousandth 2698 * of a second after playback begins. 2699 * 2700 * @return {GetDurationPromise} 2701 */ 2702 2703 }, { 2704 key: "getDuration", 2705 value: function getDuration() { 2706 return this.get('duration'); 2707 } 2708 /** 2709 * A promise to get the ended state of the video. 2710 * 2711 * @promise GetEndedPromise 2712 * @fulfill {boolean} Whether or not the video has ended. 2713 */ 2714 2715 /** 2716 * Get the ended state of the video. The video has ended if 2717 * `currentTime === duration`. 2718 * 2719 * @return {GetEndedPromise} 2720 */ 2721 2722 }, { 2723 key: "getEnded", 2724 value: function getEnded() { 2725 return this.get('ended'); 2726 } 2727 /** 2728 * A promise to get the loop state of the player. 2729 * 2730 * @promise GetLoopPromise 2731 * @fulfill {boolean} Whether or not the player is set to loop. 2732 */ 2733 2734 /** 2735 * Get the loop state of the player. 2736 * 2737 * @return {GetLoopPromise} 2738 */ 2739 2740 }, { 2741 key: "getLoop", 2742 value: function getLoop() { 2743 return this.get('loop'); 2744 } 2745 /** 2746 * A promise to set the loop state of the player. 2747 * 2748 * @promise SetLoopPromise 2749 * @fulfill {boolean} The loop state that was set. 2750 */ 2751 2752 /** 2753 * Set the loop state of the player. When set to `true`, the player 2754 * will start over immediately once playback ends. 2755 * 2756 * @param {boolean} loop 2757 * @return {SetLoopPromise} 2758 */ 2759 2760 }, { 2761 key: "setLoop", 2762 value: function setLoop(loop) { 2763 return this.set('loop', loop); 2764 } 2765 /** 2766 * A promise to set the muted state of the player. 2767 * 2768 * @promise SetMutedPromise 2769 * @fulfill {boolean} The muted state that was set. 2770 */ 2771 2772 /** 2773 * Set the muted state of the player. When set to `true`, the player 2774 * volume will be muted. 2775 * 2776 * @param {boolean} muted 2777 * @return {SetMutedPromise} 2778 */ 2779 2780 }, { 2781 key: "setMuted", 2782 value: function setMuted(muted) { 2783 return this.set('muted', muted); 2784 } 2785 /** 2786 * A promise to get the muted state of the player. 2787 * 2788 * @promise GetMutedPromise 2789 * @fulfill {boolean} Whether or not the player is muted. 2790 */ 2791 2792 /** 2793 * Get the muted state of the player. 2794 * 2795 * @return {GetMutedPromise} 2796 */ 2797 2798 }, { 2799 key: "getMuted", 2800 value: function getMuted() { 2801 return this.get('muted'); 2802 } 2803 /** 2804 * A promise to get the paused state of the player. 2805 * 2806 * @promise GetLoopPromise 2807 * @fulfill {boolean} Whether or not the video is paused. 2808 */ 2809 2810 /** 2811 * Get the paused state of the player. 2812 * 2813 * @return {GetLoopPromise} 2814 */ 2815 2816 }, { 2817 key: "getPaused", 2818 value: function getPaused() { 2819 return this.get('paused'); 2820 } 2821 /** 2822 * A promise to get the playback rate of the player. 2823 * 2824 * @promise GetPlaybackRatePromise 2825 * @fulfill {number} The playback rate of the player on a scale from 0.5 to 2. 2826 */ 2827 2828 /** 2829 * Get the playback rate of the player on a scale from `0.5` to `2`. 2830 * 2831 * @return {GetPlaybackRatePromise} 2832 */ 2833 2834 }, { 2835 key: "getPlaybackRate", 2836 value: function getPlaybackRate() { 2837 return this.get('playbackRate'); 2838 } 2839 /** 2840 * A promise to set the playbackrate of the player. 2841 * 2842 * @promise SetPlaybackRatePromise 2843 * @fulfill {number} The playback rate was set. 2844 * @reject {RangeError} The playback rate was less than 0.5 or greater than 2. 2845 */ 2846 2847 /** 2848 * Set the playback rate of the player on a scale from `0.5` to `2`. When set 2849 * via the API, the playback rate will not be synchronized to other 2850 * players or stored as the viewer's preference. 2851 * 2852 * @param {number} playbackRate 2853 * @return {SetPlaybackRatePromise} 2854 */ 2855 2856 }, { 2857 key: "setPlaybackRate", 2858 value: function setPlaybackRate(playbackRate) { 2859 return this.set('playbackRate', playbackRate); 2860 } 2861 /** 2862 * A promise to get the played property of the video. 2863 * 2864 * @promise GetPlayedPromise 2865 * @fulfill {Array} Played Timeranges converted to an Array. 2866 */ 2867 2868 /** 2869 * Get the played property of the video. 2870 * 2871 * @return {GetPlayedPromise} 2872 */ 2873 2874 }, { 2875 key: "getPlayed", 2876 value: function getPlayed() { 2877 return this.get('played'); 2878 } 2879 /** 2880 * A promise to get the qualities available of the current video. 2881 * 2882 * @promise GetQualitiesPromise 2883 * @fulfill {Array} The qualities of the video. 2884 */ 2885 2886 /** 2887 * Get the qualities of the current video. 2888 * 2889 * @return {GetQualitiesPromise} 2890 */ 2891 2892 }, { 2893 key: "getQualities", 2894 value: function getQualities() { 2895 return this.get('qualities'); 2896 } 2897 /** 2898 * A promise to get the current set quality of the video. 2899 * 2900 * @promise GetQualityPromise 2901 * @fulfill {string} The current set quality. 2902 */ 2903 2904 /** 2905 * Get the current set quality of the video. 2906 * 2907 * @return {GetQualityPromise} 2908 */ 2909 2910 }, { 2911 key: "getQuality", 2912 value: function getQuality() { 2913 return this.get('quality'); 2914 } 2915 /** 2916 * A promise to set the video quality. 2917 * 2918 * @promise SetQualityPromise 2919 * @fulfill {number} The quality was set. 2920 * @reject {RangeError} The quality is not available. 2921 */ 2922 2923 /** 2924 * Set a video quality. 2925 * 2926 * @param {string} quality 2927 * @return {SetQualityPromise} 2928 */ 2929 2930 }, { 2931 key: "setQuality", 2932 value: function setQuality(quality) { 2933 return this.set('quality', quality); 2934 } 2935 /** 2936 * A promise to get the seekable property of the video. 2937 * 2938 * @promise GetSeekablePromise 2939 * @fulfill {Array} Seekable Timeranges converted to an Array. 2940 */ 2941 2942 /** 2943 * Get the seekable property of the video. 2944 * 2945 * @return {GetSeekablePromise} 2946 */ 2947 2948 }, { 2949 key: "getSeekable", 2950 value: function getSeekable() { 2951 return this.get('seekable'); 2952 } 2953 /** 2954 * A promise to get the seeking property of the player. 2955 * 2956 * @promise GetSeekingPromise 2957 * @fulfill {boolean} Whether or not the player is currently seeking. 2958 */ 2959 2960 /** 2961 * Get if the player is currently seeking. 2962 * 2963 * @return {GetSeekingPromise} 2964 */ 2965 2966 }, { 2967 key: "getSeeking", 2968 value: function getSeeking() { 2969 return this.get('seeking'); 2970 } 2971 /** 2972 * A promise to get the text tracks of a video. 2973 * 2974 * @promise GetTextTracksPromise 2975 * @fulfill {VimeoTextTrack[]} The text tracks associated with the video. 2976 */ 2977 2978 /** 2979 * Get an array of the text tracks that exist for the video. 2980 * 2981 * @return {GetTextTracksPromise} 2982 */ 2983 2984 }, { 2985 key: "getTextTracks", 2986 value: function getTextTracks() { 2987 return this.get('textTracks'); 2988 } 2989 /** 2990 * A promise to get the embed code for the video. 2991 * 2992 * @promise GetVideoEmbedCodePromise 2993 * @fulfill {string} The `<iframe>` embed code for the video. 2994 */ 2995 2996 /** 2997 * Get the `<iframe>` embed code for the video. 2998 * 2999 * @return {GetVideoEmbedCodePromise} 3000 */ 3001 3002 }, { 3003 key: "getVideoEmbedCode", 3004 value: function getVideoEmbedCode() { 3005 return this.get('videoEmbedCode'); 3006 } 3007 /** 3008 * A promise to get the id of the video. 3009 * 3010 * @promise GetVideoIdPromise 3011 * @fulfill {number} The id of the video. 3012 */ 3013 3014 /** 3015 * Get the id of the video. 3016 * 3017 * @return {GetVideoIdPromise} 3018 */ 3019 3020 }, { 3021 key: "getVideoId", 3022 value: function getVideoId() { 3023 return this.get('videoId'); 3024 } 3025 /** 3026 * A promise to get the title of the video. 3027 * 3028 * @promise GetVideoTitlePromise 3029 * @fulfill {number} The title of the video. 3030 */ 3031 3032 /** 3033 * Get the title of the video. 3034 * 3035 * @return {GetVideoTitlePromise} 3036 */ 3037 3038 }, { 3039 key: "getVideoTitle", 3040 value: function getVideoTitle() { 3041 return this.get('videoTitle'); 3042 } 3043 /** 3044 * A promise to get the native width of the video. 3045 * 3046 * @promise GetVideoWidthPromise 3047 * @fulfill {number} The native width of the video. 3048 */ 3049 3050 /** 3051 * Get the native width of the currentlyâplaying video. The width of 3052 * the highestâresolution available will be used before playback begins. 3053 * 3054 * @return {GetVideoWidthPromise} 3055 */ 3056 3057 }, { 3058 key: "getVideoWidth", 3059 value: function getVideoWidth() { 3060 return this.get('videoWidth'); 3061 } 3062 /** 3063 * A promise to get the native height of the video. 3064 * 3065 * @promise GetVideoHeightPromise 3066 * @fulfill {number} The native height of the video. 3067 */ 3068 3069 /** 3070 * Get the native height of the currentlyâplaying video. The height of 3071 * the highestâresolution available will be used before playback begins. 3072 * 3073 * @return {GetVideoHeightPromise} 3074 */ 3075 3076 }, { 3077 key: "getVideoHeight", 3078 value: function getVideoHeight() { 3079 return this.get('videoHeight'); 3080 } 3081 /** 3082 * A promise to get the vimeo.com url for the video. 3083 * 3084 * @promise GetVideoUrlPromise 3085 * @fulfill {number} The vimeo.com url for the video. 3086 * @reject {PrivacyError} The url isnât available because of the videoâs privacy setting. 3087 */ 3088 3089 /** 3090 * Get the vimeo.com url for the video. 3091 * 3092 * @return {GetVideoUrlPromise} 3093 */ 3094 3095 }, { 3096 key: "getVideoUrl", 3097 value: function getVideoUrl() { 3098 return this.get('videoUrl'); 3099 } 3100 /** 3101 * A promise to get the volume level of the player. 3102 * 3103 * @promise GetVolumePromise 3104 * @fulfill {number} The volume level of the player on a scale from 0 to 1. 3105 */ 3106 3107 /** 3108 * Get the current volume level of the player on a scale from `0` to `1`. 3109 * 3110 * Most mobile devices do not support an independent volume from the 3111 * system volume. In those cases, this method will always return `1`. 3112 * 3113 * @return {GetVolumePromise} 3114 */ 3115 3116 }, { 3117 key: "getVolume", 3118 value: function getVolume() { 3119 return this.get('volume'); 3120 } 3121 /** 3122 * A promise to set the volume level of the player. 3123 * 3124 * @promise SetVolumePromise 3125 * @fulfill {number} The volume was set. 3126 * @reject {RangeError} The volume was less than 0 or greater than 1. 3127 */ 3128 3129 /** 3130 * Set the volume of the player on a scale from `0` to `1`. When set 3131 * via the API, the volume level will not be synchronized to other 3132 * players or stored as the viewerâs preference. 3133 * 3134 * Most mobile devices do not support setting the volume. An error will 3135 * *not* be triggered in that situation. 3136 * 3137 * @param {number} volume 3138 * @return {SetVolumePromise} 3139 */ 3140 3141 }, { 3142 key: "setVolume", 3143 value: function setVolume(volume) { 3144 return this.set('volume', volume); 3145 } 3146 }]); 3147 3148 return Player; 3149}(); // Setup embed only if this is not a node environment 3150 3151 3152if (!isNode) { 3153 screenfull = initializeScreenfull(); 3154 initializeEmbeds(); 3155 resizeEmbeds(); 3156 initAppendVideoMetadata(); 3157} 3158 3159class VimeoPlayer extends AbstractVideoPlayer { 3160 constructor(target, videoId, options = {}) { 3161 super(target, videoId, options); 3162 this.state.set(INITIALIZED); 3163 } 3164 createPlayer(videoId) { 3165 const { options, options: { playerOptions = {} } } = this; 3166 const vimeoOptions = videoId.indexOf("http") === 0 ? { url: videoId } : { id: +videoId }; 3167 const player = new Player$1(this.target, assign(vimeoOptions, { 3168 controls: !options.hideControls, 3169 loop: options.loop, 3170 muted: options.mute 3171 }, playerOptions.vimeo || {})); 3172 player.on("play", this.onPlay); 3173 player.on("pause", this.onPause); 3174 player.on("ended", this.onEnded); 3175 player.ready().then(this.onPlayerReady, this.onError); 3176 if (!player.getMuted()) { 3177 player.setVolume(clamp(options.volume, 0, 1)); 3178 } 3179 return player; 3180 } 3181 playVideo() { 3182 this.player.play().catch(() => { 3183 if (this.state.is(PLAY_REQUEST_ABORTED)) { 3184 this.state.set(IDLE); 3185 } 3186 }); 3187 } 3188 pauseVideo() { 3189 this.player.pause(); 3190 } 3191} 3192 3193const YOUTUBE_API_SRC = "//www.youtube.com/player_api"; 3194class YouTubeIframeAPILoader { 3195 load(callback) { 3196 if (window.YT && isFunction(window.YT.Player)) { 3197 return callback(); 3198 } 3199 this.attachCallback(callback); 3200 if (this.shouldLoad()) { 3201 create("script", { src: `${location.protocol}${YOUTUBE_API_SRC}` }, document.head); 3202 } 3203 } 3204 shouldLoad() { 3205 return !queryAll(document, "script").some((script) => script.src.replace(/^https?:/, "") === YOUTUBE_API_SRC); 3206 } 3207 attachCallback(callback) { 3208 let oldCallback; 3209 if (!isUndefined(window.onYouTubeIframeAPIReady)) { 3210 oldCallback = window.onYouTubeIframeAPIReady; 3211 } 3212 window.onYouTubeIframeAPIReady = () => { 3213 oldCallback && oldCallback(); 3214 callback(); 3215 }; 3216 } 3217} 3218 3219class YouTubePlayer extends AbstractVideoPlayer { 3220 constructor(target, videoId, options = {}) { 3221 super(target, videoId, options); 3222 this.videoId = this.parseVideoId(videoId); 3223 if (this.videoId) { 3224 this.state.set(INITIALIZING); 3225 new YouTubeIframeAPILoader().load(this.onAPIReady.bind(this)); 3226 } 3227 } 3228 onAPIReady() { 3229 const { state } = this; 3230 const isPending = state.is(PENDING_PLAY); 3231 state.set(INITIALIZED); 3232 if (isPending) { 3233 this.play(); 3234 } 3235 } 3236 createPlayer(videoId) { 3237 const { options, options: { playerOptions = {} } } = this; 3238 return new YT.Player(this.target, { 3239 videoId, 3240 host: options.host, 3241 playerVars: assign({ 3242 controls: options.hideControls ? 0 : 1, 3243 iv_load_policy: 3, 3244 loop: options.loop ? 1 : 0, 3245 playlist: options.loop ? videoId : void 0, 3246 rel: 0, 3247 autoplay: 0, 3248 mute: options.mute ? 1 : 0 3249 }, playerOptions.youtube || {}), 3250 events: { 3251 onReady: this.onPlayerReady.bind(this), 3252 onStateChange: this.onPlayerStateChange.bind(this), 3253 onError: this.onError.bind(this) 3254 } 3255 }); 3256 } 3257 onPlayerReady() { 3258 super.onPlayerReady(); 3259 this.player.setVolume(clamp(this.options.volume, 0, 1) * 100); 3260 } 3261 onPlayerStateChange(e) { 3262 const { PLAYING, PAUSED, ENDED } = YT.PlayerState; 3263 switch (true) { 3264 case e.data === PLAYING: 3265 this.onPlay(); 3266 break; 3267 case e.data === PAUSED: 3268 this.onPause(); 3269 break; 3270 case e.data === ENDED: 3271 this.onEnded(); 3272 break; 3273 } 3274 } 3275 playVideo() { 3276 this.player.playVideo(); 3277 } 3278 pauseVideo() { 3279 this.player.pauseVideo(); 3280 } 3281 parseVideoId(id) { 3282 return id.indexOf("http") === 0 ? this.parseUrl(id) : id; 3283 } 3284 parseUrl(url) { 3285 const [, search] = url.split(/[#?]/); 3286 const query = find(search.split("&"), (query2) => query2.indexOf("v=") === 0); 3287 return query && query.replace("v=", ""); 3288 } 3289} 3290 3291const I18N = { 3292 playVideo: "Play Video" 3293}; 3294 3295class PlayerUI { 3296 constructor(Splide2, slide) { 3297 this.event = EventInterface(); 3298 this.Splide = Splide2; 3299 this.slide = slide; 3300 this.container = child(this.slide, `.${CLASS_CONTAINER}`); 3301 this.parent = this.container || this.slide; 3302 this.init(); 3303 this.create(); 3304 this.show(); 3305 this.listen(); 3306 } 3307 init() { 3308 addClass(this.slide, `${CLASS_SLIDE}${MODIFIER_HAS_VIDEO}`); 3309 addClass(this.container, `${CLASS_CONTAINER}${MODIFIER_HAS_VIDEO}`); 3310 } 3311 create() { 3312 this.video = create("div", CLASS_VIDEO, this.parent); 3313 this.playButton = create("button", { 3314 class: CLASS_VIDEO_PLAY_BUTTON, 3315 type: "button", 3316 "aria-label": this.Splide.options.i18n.playVideo || I18N.playVideo 3317 }, this.video); 3318 this.wrapper = create("div", CLASS_VIDEO_WRAPPER, this.video); 3319 this.placeholder = create("div", null, this.wrapper); 3320 } 3321 listen() { 3322 this.parent.addEventListener("click", () => { 3323 this.event.emit("click"); 3324 }); 3325 } 3326 toggleButton(show) { 3327 display(this.playButton, show ? "" : "none"); 3328 } 3329 toggleWrapper(show) { 3330 display(this.wrapper, show ? "" : "none"); 3331 } 3332 getPlaceholder() { 3333 return this.placeholder; 3334 } 3335 hide() { 3336 this.toggleButton(false); 3337 this.toggleWrapper(true); 3338 } 3339 show() { 3340 if (!this.disabled) { 3341 this.toggleButton(true); 3342 } 3343 this.toggleWrapper(false); 3344 } 3345 disable(disabled) { 3346 this.disabled = disabled; 3347 if (disabled) { 3348 this.toggleButton(false); 3349 } 3350 } 3351 on(events, callback) { 3352 this.event.on(events, callback); 3353 } 3354 destroy() { 3355 removeClass(this.slide, `${CLASS_SLIDE}${MODIFIER_HAS_VIDEO}`); 3356 removeClass(this.container, `${CLASS_CONTAINER}${MODIFIER_HAS_VIDEO}`); 3357 remove(this.video); 3358 this.event.destroy(); 3359 } 3360} 3361 3362const VIDEO_PLAYER_MAP = [ 3363 [YOUTUBE_DATA_ATTRIBUTE, YouTubePlayer], 3364 [VIMEO_DATA_ATTRIBUTE, VimeoPlayer], 3365 [HTML_VIDEO__DATA_ATTRIBUTE, HTMLVideoPlayer] 3366]; 3367class Player { 3368 constructor(Splide2, slide) { 3369 this.Splide = Splide2; 3370 this.slide = slide; 3371 this.event = EventInterface(Splide2); 3372 this.options = merge(merge({}, DEFAULTS), this.Splide.options.video); 3373 this.createPlayer(slide); 3374 if (this.player) { 3375 this.listen(); 3376 } 3377 } 3378 createPlayer(slide) { 3379 VIDEO_PLAYER_MAP.forEach(([attr, Constructor]) => { 3380 const id = getAttribute(slide, attr); 3381 if (id) { 3382 this.ui = new PlayerUI(this.Splide, slide); 3383 this.player = new Constructor(this.ui.getPlaceholder(), id, this.options); 3384 this.ui.disable(this.options.disableOverlayUI); 3385 } 3386 }); 3387 } 3388 listen() { 3389 const { player, event } = this; 3390 this.ui.on("click", this.onClick.bind(this)); 3391 player.on("play", this.onPlay.bind(this)); 3392 player.on("played", this.onPlayed.bind(this)); 3393 player.on("pause", this.onPause.bind(this)); 3394 player.on("paused", this.onPaused.bind(this)); 3395 player.on("ended", this.onEnded.bind(this)); 3396 player.on("error", this.onError.bind(this)); 3397 event.on([EVENT_MOVE, EVENT_SCROLL], this.pause.bind(this)); 3398 event.on(EVENT_VIDEO_CLICK, this.onVideoClick.bind(this)); 3399 event.on(EVENT_DRAG, () => { 3400 event.off(EVENT_DRAGGING); 3401 event.on(EVENT_DRAGGING, () => { 3402 this.pause(); 3403 event.off(EVENT_DRAGGING); 3404 }); 3405 }); 3406 if (this.options.autoplay) { 3407 event.on([EVENT_MOUNTED, EVENT_MOVED, EVENT_SCROLLED], this.onAutoplayRequested.bind(this)); 3408 } 3409 } 3410 onClick() { 3411 this.isPaused() ? this.play() : this.pause(); 3412 this.event.emit(EVENT_VIDEO_CLICK, this); 3413 } 3414 onVideoClick(player) { 3415 if (this !== player) { 3416 this.pause(); 3417 } 3418 } 3419 onPlay() { 3420 this.ui.hide(); 3421 } 3422 onPlayed() { 3423 this.ui.hide(); 3424 this.togglePlaying(true); 3425 this.event.emit(EVENT_VIDEO_PLAY, this); 3426 } 3427 onPause() { 3428 this.ui.show(); 3429 } 3430 onPaused() { 3431 this.togglePlaying(false); 3432 this.event.emit(EVENT_VIDEO_PAUSE, this); 3433 } 3434 onEnded() { 3435 this.togglePlaying(false); 3436 this.event.emit(EVENT_VIDEO_ENDED, this); 3437 } 3438 onError() { 3439 addClass(this.slide, CLASS_ERROR); 3440 this.ui.show(); 3441 this.event.emit(EVENT_VIDEO_ERROR, this); 3442 } 3443 onAutoplayRequested() { 3444 const activeSlide = this.Splide.Components.Slides.getAt(this.Splide.index); 3445 if (activeSlide.slide === this.slide) { 3446 this.play(); 3447 } 3448 } 3449 togglePlaying(add) { 3450 toggleClass(this.Splide.root, CLASS_PLAYING, add); 3451 } 3452 play() { 3453 if (this.player && !this.disabled) { 3454 this.player.play(); 3455 } 3456 } 3457 pause() { 3458 if (this.player && !this.disabled) { 3459 this.player.pause(); 3460 } 3461 } 3462 destroy() { 3463 if (this.player) { 3464 this.ui.destroy(); 3465 this.player.destroy(); 3466 } 3467 this.disable(false); 3468 } 3469 disable(disabled) { 3470 this.disabled = disabled; 3471 toggleClass(this.Splide.root, CLASS_VIDEO_DISABLED, disabled); 3472 } 3473 isPaused() { 3474 return this.player.isPaused(); 3475 } 3476} 3477 3478function Video(Splide2, Components2) { 3479 const { on } = EventInterface(Splide2); 3480 const { Slides } = Components2; 3481 const players = {}; 3482 function mount() { 3483 create(); 3484 on("refresh", create); 3485 } 3486 function create() {
3487 Slides.forEach((Slide) => { 3488 const { slide } = Slide; 3489 if (!hasClass(slide, `${CLASS_SLIDE}${MODIFIER_HAS_VIDEO}`)) { 3490 players[Slide.index] = new Player(Splide2, slide); 3491 } 3492 }); 3493 Slides.update(); 3494 } 3495 function destroy() { 3496 forOwn(players, (player) => { 3497 player.destroy(); 3498 }); 3499 } 3500 function play(index = Splide2.index) { 3501 const player = players[index]; 3502 if (player) { 3503 player.play(); 3504 } 3505 } 3506 function pause() { 3507 forOwn(players, (player) => { 3508 player.pause(); 3509 }); 3510 } 3511 function disable(disabled) { 3512 forOwn(players, (player) => { 3513 player.disable(disabled); 3514 }); 3515 } 3516 return { 3517 mount, 3518 destroy, 3519 play, 3520 pause, 3521 disable 3522 }; 3523} 3524 3525 3526 3527 3528/***/ }, 3529 3530/***/ "./node_modules/@splidejs/splide/dist/js/splide.cjs.js" 3531/*!*************************************************************!*\ 3532 !*** ./node_modules/@splidejs/splide/dist/js/splide.cjs.js ***! 3533 \*************************************************************/ 3534(__unused_webpack_module, exports) { 3535 3536"use strict"; 3537/*! 3538 * Splide.js 3539 * Version : 4.1.4 3540 * License : MIT 3541 * Copyright: 2022 Naotoshi Fujita 3542 */ 3543 3544 3545function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } 3546 3547function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } 3548 3549Object.defineProperty(exports, "__esModule", ({ 3550 value: true 3551})); 3552var MEDIA_PREFERS_REDUCED_MOTION = "(prefers-reduced-motion: reduce)"; 3553var CREATED = 1; 3554var MOUNTED = 2; 3555var IDLE = 3; 3556var MOVING = 4; 3557var SCROLLING = 5; 3558var DRAGGING = 6; 3559var DESTROYED = 7; 3560var STATES = { 3561 CREATED: CREATED, 3562 MOUNTED: MOUNTED, 3563 IDLE: IDLE, 3564 MOVING: MOVING, 3565 SCROLLING: SCROLLING, 3566 DRAGGING: DRAGGING, 3567 DESTROYED: DESTROYED 3568}; 3569 3570function empty(array) { 3571 array.length = 0; 3572} 3573 3574function slice(arrayLike, start, end) { 3575 return Array.prototype.slice.call(arrayLike, start, end); 3576} 3577 3578function apply(func) { 3579 return func.bind.apply(func, [null].concat(slice(arguments, 1))); 3580} 3581 3582var nextTick = setTimeout; 3583 3584var noop = function noop() {}; 3585 3586function raf(func) { 3587 return requestAnimationFrame(func); 3588} 3589 3590function typeOf(type, subject) { 3591 return typeof subject === type; 3592} 3593 3594function isObject(subject) { 3595 return !isNull(subject) && typeOf("object", subject); 3596} 3597 3598var isArray = Array.isArray; 3599var isFunction = apply(typeOf, "function"); 3600var isString = apply(typeOf, "string"); 3601var isUndefined = apply(typeOf, "undefined"); 3602 3603function isNull(subject) { 3604 return subject === null; 3605} 3606 3607function isHTMLElement(subject) { 3608 try { 3609 return subject instanceof (subject.ownerDocument.defaultView || window).HTMLElement; 3610 } catch (e) { 3611 return false; 3612 } 3613} 3614 3615function toArray(value) { 3616 return isArray(value) ? value : [value]; 3617} 3618 3619function forEach(values, iteratee) { 3620 toArray(values).forEach(iteratee); 3621} 3622 3623function includes(array, value) { 3624 return array.indexOf(value) > -1; 3625} 3626 3627function push(array, items) { 3628 array.push.apply(array, toArray(items)); 3629 return array; 3630} 3631 3632function toggleClass(elm, classes, add) { 3633 if (elm) { 3634 forEach(classes, function (name) { 3635 if (name) { 3636 elm.classList[add ? "add" : "remove"](name); 3637 } 3638 }); 3639 } 3640} 3641 3642function addClass(elm, classes) { 3643 toggleClass(elm, isString(classes) ? classes.split(" ") : classes, true); 3644} 3645 3646function append(parent, children) { 3647 forEach(children, parent.appendChild.bind(parent)); 3648} 3649 3650function before(nodes, ref) { 3651 forEach(nodes, function (node) { 3652 var parent = (ref || node).parentNode; 3653 3654 if (parent) { 3655 parent.insertBefore(node, ref); 3656 } 3657 }); 3658} 3659 3660function matches(elm, selector) { 3661 return isHTMLElement(elm) && (elm["msMatchesSelector"] || elm.matches).call(elm, selector); 3662} 3663 3664function children(parent, selector) { 3665 var children2 = parent ? slice(parent.children) : []; 3666 return selector ? children2.filter(function (child) { 3667 return matches(child, selector); 3668 }) : children2; 3669} 3670 3671function child(parent, selector) { 3672 return selector ? children(parent, selector)[0] : parent.firstElementChild; 3673} 3674 3675var ownKeys = Object.keys; 3676 3677function forOwn(object, iteratee, right) { 3678 if (object) { 3679 (right ? ownKeys(object).reverse() : ownKeys(object)).forEac
vendor: 100,032 bytes, lines 3679-7320
3679h(function (key) { 3680 key !== "__proto__" && iteratee(object[key], key); 3681 }); 3682 } 3683 3684 return object; 3685} 3686 3687function assign(object) { 3688 slice(arguments, 1).forEach(function (source) { 3689 forOwn(source, function (value, key) { 3690 object[key] = source[key]; 3691 }); 3692 }); 3693 return object; 3694} 3695 3696function merge(object) { 3697 slice(arguments, 1).forEach(function (source) { 3698 forOwn(source, function (value, key) { 3699 if (isArray(value)) { 3700 object[key] = value.slice(); 3701 } else if (isObject(value)) { 3702 object[key] = merge({}, isObject(object[key]) ? object[key] : {}, value); 3703 } else { 3704 object[key] = value; 3705 } 3706 }); 3707 }); 3708 return object; 3709} 3710 3711function omit(object, keys) { 3712 forEach(keys || ownKeys(object), function (key) { 3713 delete object[key]; 3714 }); 3715} 3716 3717function removeAttribute(elms, attrs) { 3718 forEach(elms, function (elm) { 3719 forEach(attrs, function (attr) { 3720 elm && elm.removeAttribute(attr); 3721 }); 3722 }); 3723} 3724 3725function setAttribute(elms, attrs, value) { 3726 if (isObject(attrs)) { 3727 forOwn(attrs, function (value2, name) { 3728 setAttribute(elms, name, value2); 3729 }); 3730 } else { 3731 forEach(elms, function (elm) { 3732 isNull(value) || value === "" ? removeAttribute(elm, attrs) : elm.setAttribute(attrs, String(value)); 3733 }); 3734 } 3735} 3736 3737function create(tag, attrs, parent) { 3738 var elm = document.createElement(tag); 3739 3740 if (attrs) { 3741 isString(attrs) ? addClass(elm, attrs) : setAttribute(elm, attrs); 3742 } 3743 3744 parent && append(parent, elm); 3745 return elm; 3746} 3747 3748function style(elm, prop, value) { 3749 if (isUndefined(value)) { 3750 return getComputedStyle(elm)[prop]; 3751 } 3752 3753 if (!isNull(value)) { 3754 elm.style[prop] = "" + value; 3755 } 3756} 3757 3758function display(elm, display2) { 3759 style(elm, "display", display2); 3760} 3761 3762function focus(elm) { 3763 elm["setActive"] && elm["setActive"]() || elm.focus({ 3764 preventScroll: true 3765 }); 3766} 3767 3768function getAttribute(elm, attr) { 3769 return elm.getAttribute(attr); 3770} 3771 3772function hasClass(elm, className) { 3773 return elm && elm.classList.contains(className); 3774} 3775 3776function rect(target) { 3777 return target.getBoundingClientRect(); 3778} 3779 3780function remove(nodes) { 3781 forEach(nodes, function (node) { 3782 if (node && node.parentNode) { 3783 node.parentNode.removeChild(node); 3784 } 3785 }); 3786} 3787 3788function parseHtml(html) { 3789 return child(new DOMParser().parseFromString(html, "text/html").body); 3790} 3791 3792function prevent(e, stopPropagation) { 3793 e.preventDefault(); 3794 3795 if (stopPropagation) { 3796 e.stopPropagation(); 3797 e.stopImmediatePropagation(); 3798 } 3799} 3800 3801function query(parent, selector) { 3802 return parent && parent.querySelector(selector); 3803} 3804 3805function queryAll(parent, selector) { 3806 return selector ? slice(parent.querySelectorAll(selector)) : []; 3807} 3808 3809function removeClass(elm, classes) { 3810 toggleClass(elm, classes, false); 3811} 3812 3813function timeOf(e) { 3814 return e.timeStamp; 3815} 3816 3817function unit(value) { 3818 return isString(value) ? value : value ? value + "px" : ""; 3819} 3820 3821var PROJECT_CODE = "splide"; 3822var DATA_ATTRIBUTE = "data-" + PROJECT_CODE; 3823 3824function assert(condition, message) { 3825 if (!condition) { 3826 throw new Error("[" + PROJECT_CODE + "] " + (message || "")); 3827 } 3828} 3829 3830var min = Math.min, 3831 max = Math.max, 3832 floor = Math.floor, 3833 ceil = Math.ceil, 3834 abs = Math.abs; 3835 3836function approximatelyEqual(x, y, epsilon) { 3837 return abs(x - y) < epsilon; 3838} 3839 3840function between(number, x, y, exclusive) { 3841 var minimum = min(x, y); 3842 var maximum = max(x, y); 3843 return exclusive ? minimum < number && number < maximum : minimum <= number && number <= maximum; 3844} 3845 3846function clamp(number, x, y) { 3847 var minimum = min(x, y); 3848 var maximum = max(x, y); 3849 return min(max(minimum, number), maximum); 3850} 3851 3852function sign(x) { 3853 return +(x > 0) - +(x < 0); 3854} 3855 3856function camelToKebab(string) { 3857 return string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(); 3858} 3859 3860function format(string, replacements) { 3861 forEach(replacements, function (replacement) { 3862 string = string.replace("%s", "" + replacement); 3863 }); 3864 return string; 3865} 3866 3867function pad(number) { 3868 return number < 10 ? "0" + number : "" + number; 3869} 3870 3871var ids = {}; 3872 3873function uniqueId(prefix) { 3874 return "" + prefix + pad(ids[prefix] = (ids[prefix] || 0) + 1); 3875} 3876 3877function EventBinder() { 3878 var listeners = []; 3879 3880 function bind(targets, events, callback, options) { 3881 forEachEvent(targets, events, function (target, event, namespace) { 3882 var isEventTarget = ("addEventListener" in target); 3883 var remover = isEventTarget ? target.removeEventListener.bind(target, event, callback, options) : target["removeListener"].bind(target, callback); 3884 isEventTarget ? target.addEventListener(event, callback, options) : target["addListener"](callback); 3885 listeners.push([target, event, namespace, callback, remover]); 3886 }); 3887 } 3888 3889 function unbind(targets, events, callback) { 3890 forEachEvent(targets, events, function (target, event, namespace) { 3891 listeners = listeners.filter(function (listener) { 3892 if (listener[0] === target && listener[1] === event && listener[2] === namespace && (!callback || listener[3] === callback)) { 3893 listener[4](); 3894 return false; 3895 } 3896 3897 return true; 3898 }); 3899 }); 3900 } 3901 3902 function dispatch(target, type, detail) { 3903 var e; 3904 var bubbles = true; 3905 3906 if (typeof CustomEvent === "function") { 3907 e = new CustomEvent(type, { 3908 bubbles: bubbles, 3909 detail: detail 3910 }); 3911 } else { 3912 e = document.createEvent("CustomEvent"); 3913 e.initCustomEvent(type, bubbles, false, detail); 3914 } 3915 3916 target.dispatchEvent(e); 3917 return e; 3918 } 3919 3920 function forEachEvent(targets, events, iteratee) { 3921 forEach(targets, function (target) { 3922 target && forEach(events, function (events2) { 3923 events2.split(" ").forEach(function (eventNS) { 3924 var fragment = eventNS.split("."); 3925 iteratee(target, fragment[0], fragment[1]); 3926 }); 3927 }); 3928 }); 3929 } 3930 3931 function destroy() { 3932 listeners.forEach(function (data) { 3933 data[4](); 3934 }); 3935 empty(listeners); 3936 } 3937 3938 return { 3939 bind: bind, 3940 unbind: unbind, 3941 dispatch: dispatch, 3942 destroy: destroy 3943 }; 3944} 3945 3946var EVENT_MOUNTED = "mounted"; 3947var EVENT_READY = "ready"; 3948var EVENT_MOVE = "move"; 3949var EVENT_MOVED = "moved"; 3950var EVENT_CLICK = "click"; 3951var EVENT_ACTIVE = "active"; 3952var EVENT_INACTIVE = "inactive"; 3953var EVENT_VISIBLE = "visible"; 3954var EVENT_HIDDEN = "hidden"; 3955var EVENT_REFRESH = "refresh"; 3956var EVENT_UPDATED = "updated"; 3957var EVENT_RESIZE = "resize"; 3958var EVENT_RESIZED = "resized"; 3959var EVENT_DRAG = "drag"; 3960var EVENT_DRAGGING = "dragging"; 3961var EVENT_DRAGGED = "dragged"; 3962var EVENT_SCROLL = "scroll"; 3963var EVENT_SCROLLED = "scrolled"; 3964var EVENT_OVERFLOW = "overflow"; 3965var EVENT_DESTROY = "destroy"; 3966var EVENT_ARROWS_MOUNTED = "arrows:mounted"; 3967var EVENT_ARROWS_UPDATED = "arrows:updated"; 3968var EVENT_PAGINATION_MOUNTED = "pagination:mounted"; 3969var EVENT_PAGINATION_UPDATED = "pagination:updated"; 3970var EVENT_NAVIGATION_MOUNTED = "navigation:mounted"; 3971var EVENT_AUTOPLAY_PLAY = "autoplay:play"; 3972var EVENT_AUTOPLAY_PLAYING = "autoplay:playing"; 3973var EVENT_AUTOPLAY_PAUSE = "autoplay:pause"; 3974var EVENT_LAZYLOAD_LOADED = "lazyload:loaded"; 3975var EVENT_SLIDE_KEYDOWN = "sk"; 3976var EVENT_SHIFTED = "sh"; 3977var EVENT_END_INDEX_CHANGED = "ei"; 3978 3979function EventInterface(Splide2) { 3980 var bus = Splide2 ? Splide2.event.bus : document.createDocumentFragment(); 3981 var binder = EventBinder(); 3982 3983 function on(events, callback) { 3984 binder.bind(bus, toArray(events).join(" "), function (e) { 3985 callback.apply(callback, isArray(e.detail) ? e.detail : []); 3986 }); 3987 } 3988 3989 function emit(event) { 3990 binder.dispatch(bus, event, slice(arguments, 1)); 3991 } 3992 3993 if (Splide2) { 3994 Splide2.event.on(EVENT_DESTROY, binder.destroy); 3995 } 3996 3997 return assign(binder, { 3998 bus: bus, 3999 on: on, 4000 off: apply(binder.unbind, bus), 4001 emit: emit 4002 }); 4003} 4004 4005function RequestInterval(interval, onInterval, onUpdate, limit) { 4006 var now = Date.now; 4007 var startTime; 4008 var rate = 0; 4009 var id; 4010 var paused = true; 4011 var count = 0; 4012 4013 function update() { 4014 if (!paused) { 4015 rate = interval ? min((now() - startTime) / interval, 1) : 1; 4016 onUpdate && onUpdate(rate); 4017 4018 if (rate >= 1) { 4019 onInterval(); 4020 startTime = now(); 4021 4022 if (limit && ++count >= limit) { 4023 return pause(); 4024 } 4025 } 4026 4027 id = raf(update); 4028 } 4029 } 4030 4031 function start(resume) { 4032 resume || cancel(); 4033 startTime = now() - (resume ? rate * interval : 0); 4034 paused = false; 4035 id = raf(update); 4036 } 4037 4038 function pause() { 4039 paused = true; 4040 } 4041 4042 function rewind() { 4043 startTime = now(); 4044 rate = 0; 4045 4046 if (onUpdate) { 4047 onUpdate(rate); 4048 } 4049 } 4050 4051 function cancel() { 4052 id && cancelAnimationFrame(id); 4053 rate = 0; 4054 id = 0; 4055 paused = true; 4056 } 4057 4058 function set(time) { 4059 interval = time; 4060 } 4061 4062 function isPaused() { 4063 return paused; 4064 } 4065 4066 return { 4067 start: start, 4068 rewind: rewind, 4069 pause: pause, 4070 cancel: cancel, 4071 set: set, 4072 isPaused: isPaused 4073 }; 4074} 4075 4076function State(initialState) { 4077 var state = initialState; 4078 4079 function set(value) { 4080 state = value; 4081 } 4082 4083 function is(states) { 4084 return includes(toArray(states), state); 4085 } 4086 4087 return { 4088 set: set, 4089 is: is 4090 }; 4091} 4092 4093function Throttle(func, duration) { 4094 var interval = RequestInterval(duration || 0, func, null, 1); 4095 return function () { 4096 interval.isPaused() && interval.start(); 4097 }; 4098} 4099 4100function Media(Splide2, Components2, options) { 4101 var state = Splide2.state; 4102 var breakpoints = options.breakpoints || {}; 4103 var reducedMotion = options.reducedMotion || {}; 4104 var binder = EventBinder(); 4105 var queries = []; 4106 4107 function setup() { 4108 var isMin = options.mediaQuery === "min"; 4109 ownKeys(breakpoints).sort(function (n, m) { 4110 return isMin ? +n - +m : +m - +n; 4111 }).forEach(function (key) { 4112 register(breakpoints[key], "(" + (isMin ? "min" : "max") + "-width:" + key + "px)"); 4113 }); 4114 register(reducedMotion, MEDIA_PREFERS_REDUCED_MOTION); 4115 update(); 4116 } 4117 4118 function destroy(completely) { 4119 if (completely) { 4120 binder.destroy(); 4121 } 4122 } 4123 4124 function register(options2, query) { 4125 var queryList = matchMedia(query); 4126 binder.bind(queryList, "change", update); 4127 queries.push([options2, queryList]); 4128 } 4129 4130 function update() { 4131 var destroyed = state.is(DESTROYED); 4132 var direction = options.direction; 4133 var merged = queries.reduce(function (merged2, entry) { 4134 return merge(merged2, entry[1].matches ? entry[0] : {}); 4135 }, {}); 4136 omit(options); 4137 set(merged); 4138 4139 if (options.destroy) { 4140 Splide2.destroy(options.destroy === "completely"); 4141 } else if (destroyed) { 4142 destroy(true); 4143 Splide2.mount(); 4144 } else { 4145 direction !== options.direction && Splide2.refresh(); 4146 } 4147 } 4148 4149 function reduce(enable) { 4150 if (matchMedia(MEDIA_PREFERS_REDUCED_MOTION).matches) { 4151 enable ? merge(options, reducedMotion) : omit(options, ownKeys(reducedMotion)); 4152 } 4153 } 4154 4155 function set(opts, base, notify) { 4156 merge(options, opts); 4157 base && merge(Object.getPrototypeOf(options), opts); 4158 4159 if (notify || !state.is(CREATED)) { 4160 Splide2.emit(EVENT_UPDATED, options); 4161 } 4162 } 4163 4164 return { 4165 setup: setup, 4166 destroy: destroy, 4167 reduce: reduce, 4168 set: set 4169 }; 4170} 4171 4172var ARROW = "Arrow"; 4173var ARROW_LEFT = ARROW + "Left"; 4174var ARROW_RIGHT = ARROW + "Right"; 4175var ARROW_UP = ARROW + "Up"; 4176var ARROW_DOWN = ARROW + "Down"; 4177var LTR = "ltr"; 4178var RTL = "rtl"; 4179var TTB = "ttb"; 4180var ORIENTATION_MAP = { 4181 width: ["height"], 4182 left: ["top", "right"], 4183 right: ["bottom", "left"], 4184 x: ["y"], 4185 X: ["Y"], 4186 Y: ["X"], 4187 ArrowLeft: [ARROW_UP, ARROW_RIGHT], 4188 ArrowRight: [ARROW_DOWN, ARROW_LEFT] 4189}; 4190 4191function Direction(Splide2, Components2, options) { 4192 function resolve(prop, axisOnly, direction) { 4193 direction = direction || options.direction; 4194 var index = direction === RTL && !axisOnly ? 1 : direction === TTB ? 0 : -1; 4195 return ORIENTATION_MAP[prop] && ORIENTATION_MAP[prop][index] || prop.replace(/width|left|right/i, function (match, offset) { 4196 var replacement = ORIENTATION_MAP[match.toLowerCase()][index] || match; 4197 return offset > 0 ? replacement.charAt(0).toUpperCase() + replacement.slice(1) : replacement; 4198 }); 4199 } 4200 4201 function orient(value) { 4202 return value * (options.direction === RTL ? 1 : -1); 4203 } 4204 4205 return { 4206 resolve: resolve, 4207 orient: orient 4208 }; 4209} 4210 4211var ROLE = "role"; 4212var TAB_INDEX = "tabindex"; 4213var DISABLED = "disabled"; 4214var ARIA_PREFIX = "aria-"; 4215var ARIA_CONTROLS = ARIA_PREFIX + "controls"; 4216var ARIA_CURRENT = ARIA_PREFIX + "current"; 4217var ARIA_SELECTED = ARIA_PREFIX + "selected"; 4218var ARIA_LABEL = ARIA_PREFIX + "label"; 4219var ARIA_LABELLEDBY = ARIA_PREFIX + "labelledby"; 4220var ARIA_HIDDEN = ARIA_PREFIX + "hidden"; 4221var ARIA_ORIENTATION = ARIA_PREFIX + "orientation"; 4222var ARIA_ROLEDESCRIPTION = ARIA_PREFIX + "roledescription"; 4223var ARIA_LIVE = ARIA_PREFIX + "live"; 4224var ARIA_BUSY = ARIA_PREFIX + "busy"; 4225var ARIA_ATOMIC = ARIA_PREFIX + "atomic"; 4226var ALL_ATTRIBUTES = [ROLE, TAB_INDEX, DISABLED, ARIA_CONTROLS, ARIA_CURRENT, ARIA_LABEL, ARIA_LABELLEDBY, ARIA_HIDDEN, ARIA_ORIENTATION, ARIA_ROLEDESCRIPTION]; 4227var CLASS_PREFIX = PROJECT_CODE + "__"; 4228var STATUS_CLASS_PREFIX = "is-"; 4229var CLASS_ROOT = PROJECT_CODE; 4230var CLASS_TRACK = CLASS_PREFIX + "track"; 4231var CLASS_LIST = CLASS_PREFIX + "list"; 4232var CLASS_SLIDE = CLASS_PREFIX + "slide"; 4233var CLASS_CLONE = CLASS_SLIDE + "--clone"; 4234var CLASS_CONTAINER = CLASS_SLIDE + "__container"; 4235var CLASS_ARROWS = CLASS_PREFIX + "arrows"; 4236var CLASS_ARROW = CLASS_PREFIX + "arrow"; 4237var CLASS_ARROW_PREV = CLASS_ARROW + "--prev"; 4238var CLASS_ARROW_NEXT = CLASS_ARROW + "--next"; 4239var CLASS_PAGINATION = CLASS_PREFIX + "pagination"; 4240var CLASS_PAGINATION_PAGE = CLASS_PAGINATION + "__page"; 4241var CLASS_PROGRESS = CLASS_PREFIX + "progress"; 4242var CLASS_PROGRESS_BAR = CLASS_PROGRESS + "__bar"; 4243var CLASS_TOGGLE = CLASS_PREFIX + "toggle"; 4244var CLASS_TOGGLE_PLAY = CLASS_TOGGLE + "__play"; 4245var CLASS_TOGGLE_PAUSE = CLASS_TOGGLE + "__pause"; 4246var CLASS_SPINNER = CLASS_PREFIX + "spinner"; 4247var CLASS_SR = CLASS_PREFIX + "sr"; 4248var CLASS_INITIALIZED = STATUS_CLASS_PREFIX + "initialized"; 4249var CLASS_ACTIVE = STATUS_CLASS_PREFIX + "active"; 4250var CLASS_PREV = STATUS_CLASS_PREFIX + "prev"; 4251var CLASS_NEXT = STATUS_CLASS_PREFIX + "next"; 4252var CLASS_VISIBLE = STATUS_CLASS_PREFIX + "visible"; 4253var CLASS_LOADING = STATUS_CLASS_PREFIX + "loading"; 4254var CLASS_FOCUS_IN = STATUS_CLASS_PREFIX + "focus-in"; 4255var CLASS_OVERFLOW = STATUS_CLASS_PREFIX + "overflow"; 4256var STATUS_CLASSES = [CLASS_ACTIVE, CLASS_VISIBLE, CLASS_PREV, CLASS_NEXT, CLASS_LOADING, CLASS_FOCUS_IN, CLASS_OVERFLOW]; 4257var CLASSES = { 4258 slide: CLASS_SLIDE, 4259 clone: CLASS_CLONE, 4260 arrows: CLASS_ARROWS, 4261 arrow: CLASS_ARROW, 4262 prev: CLASS_ARROW_PREV, 4263 next: CLASS_ARROW_NEXT, 4264 pagination: CLASS_PAGINATION, 4265 page: CLASS_PAGINATION_PAGE, 4266 spinner: CLASS_SPINNER 4267}; 4268 4269function closest(from, selector) { 4270 if (isFunction(from.closest)) { 4271 return from.closest(selector); 4272 } 4273 4274 var elm = from; 4275 4276 while (elm && elm.nodeType === 1) { 4277 if (matches(elm, selector)) { 4278 break; 4279 } 4280 4281 elm = elm.parentElement; 4282 } 4283 4284 return elm; 4285} 4286 4287var FRICTION = 5; 4288var LOG_INTERVAL = 200; 4289var POINTER_DOWN_EVENTS = "touchstart mousedown"; 4290var POINTER_MOVE_EVENTS = "touchmove mousemove"; 4291var POINTER_UP_EVENTS = "touchend touchcancel mouseup click"; 4292 4293function Elements(Splide2, Components2, options) { 4294 var _EventInterface = EventInterface(Splide2), 4295 on = _EventInterface.on, 4296 bind = _EventInterface.bind; 4297 4298 var root = Splide2.root; 4299 var i18n = options.i18n; 4300 var elements = {}; 4301 var slides = []; 4302 var rootClasses = []; 4303 var trackClasses = []; 4304 var track; 4305 var list; 4306 var isUsingKey; 4307 4308 function setup() { 4309 collect(); 4310 init(); 4311 update(); 4312 } 4313 4314 function mount() { 4315 on(EVENT_REFRESH, destroy); 4316 on(EVENT_REFRESH, setup); 4317 on(EVENT_UPDATED, update); 4318 bind(document, POINTER_DOWN_EVENTS + " keydown", function (e) { 4319 isUsingKey = e.type === "keydown"; 4320 }, { 4321 capture: true 4322 }); 4323 bind(root, "focusin", function () { 4324 toggleClass(root, CLASS_FOCUS_IN, !!isUsingKey); 4325 }); 4326 } 4327 4328 function destroy(completely) { 4329 var attrs = ALL_ATTRIBUTES.concat("style"); 4330 empty(slides); 4331 removeClass(root, rootClasses); 4332 removeClass(track, trackClasses); 4333 removeAttribute([track, list], attrs); 4334 removeAttribute(root, completely ? attrs : ["style", ARIA_ROLEDESCRIPTION]); 4335 } 4336 4337 function update() { 4338 removeClass(root, rootClasses); 4339 removeClass(track, trackClasses); 4340 rootClasses = getClasses(CLASS_ROOT); 4341 trackClasses = getClasses(CLASS_TRACK); 4342 addClass(root, rootClasses); 4343 addClass(track, trackClasses); 4344 setAttribute(root, ARIA_LABEL, options.label); 4345 setAttribute(root, ARIA_LABELLEDBY, options.labelledby); 4346 } 4347 4348 function collect() { 4349 track = find("." + CLASS_TRACK); 4350 list = child(track, "." + CLASS_LIST); 4351 assert(track && list, "A track/list element is missing."); 4352 push(slides, children(list, "." + CLASS_SLIDE + ":not(." + CLASS_CLONE + ")")); 4353 forOwn({ 4354 arrows: CLASS_ARROWS, 4355 pagination: CLASS_PAGINATION, 4356 prev: CLASS_ARROW_PREV, 4357 next: CLASS_ARROW_NEXT, 4358 bar: CLASS_PROGRESS_BAR, 4359 toggle: CLASS_TOGGLE 4360 }, function (className, key) { 4361 elements[key] = find("." + className); 4362 }); 4363 assign(elements, { 4364 root: root, 4365 track: track, 4366 list: list, 4367 slides: slides 4368 }); 4369 } 4370 4371 function init() { 4372 var id = root.id || uniqueId(PROJECT_CODE); 4373 var role = options.role; 4374 root.id = id; 4375 track.id = track.id || id + "-track"; 4376 list.id = list.id || id + "-list"; 4377 4378 if (!getAttribute(root, ROLE) && root.tagName !== "SECTION" && role) { 4379 setAttribute(root, ROLE, role); 4380 } 4381 4382 setAttribute(root, ARIA_ROLEDESCRIPTION, i18n.carousel); 4383 setAttribute(list, ROLE, "presentation"); 4384 } 4385 4386 function find(selector) { 4387 var elm = query(root, selector); 4388 return elm && closest(elm, "." + CLASS_ROOT) === root ? elm : void 0; 4389 } 4390 4391 function getClasses(base) { 4392 return [base + "--" + options.type, base + "--" + options.direction, options.drag && base + "--draggable", options.isNavigation && base + "--nav", base === CLASS_ROOT && CLASS_ACTIVE]; 4393 } 4394 4395 return assign(elements, { 4396 setup: setup, 4397 mount: mount, 4398 destroy: destroy 4399 }); 4400} 4401 4402var SLIDE = "slide"; 4403var LOOP = "loop"; 4404var FADE = "fade"; 4405 4406function Slide$1(Splide2, index, slideIndex, slide) { 4407 var event = EventInterface(Splide2); 4408 var on = event.on, 4409 emit = event.emit, 4410 bind = event.bind; 4411 var Components = Splide2.Components, 4412 root = Splide2.root, 4413 options = Splide2.options; 4414 var isNavigation = options.isNavigation, 4415 updateOnMove = options.updateOnMove, 4416 i18n = options.i18n, 4417 pagination = options.pagination, 4418 slideFocus = options.slideFocus; 4419 var resolve = Components.Direction.resolve; 4420 var styles = getAttribute(slide, "style"); 4421 var label = getAttribute(slide, ARIA_LABEL); 4422 var isClone = slideIndex > -1; 4423 var container = child(slide, "." + CLASS_CONTAINER); 4424 var destroyed; 4425 4426 function mount() { 4427 if (!isClone) { 4428 slide.id = root.id + "-slide" + pad(index + 1); 4429 setAttribute(slide, ROLE, pagination ? "tabpanel" : "group"); 4430 setAttribute(slide, ARIA_ROLEDESCRIPTION, i18n.slide); 4431 setAttribute(slide, ARIA_LABEL, label || format(i18n.slideLabel, [index + 1, Splide2.length])); 4432 } 4433 4434 listen(); 4435 } 4436 4437 function listen() { 4438 bind(slide, "click", apply(emit, EVENT_CLICK, self)); 4439 bind(slide, "keydown", apply(emit, EVENT_SLIDE_KEYDOWN, self)); 4440 on([EVENT_MOVED, EVENT_SHIFTED, EVENT_SCROLLED], update); 4441 on(EVENT_NAVIGATION_MOUNTED, initNavigation); 4442 4443 if (updateOnMove) { 4444 on(EVENT_MOVE, onMove); 4445 } 4446 } 4447 4448 function destroy() { 4449 destroyed = true; 4450 event.destroy(); 4451 removeClass(slide, STATUS_CLASSES); 4452 removeAttribute(slide, ALL_ATTRIBUTES); 4453 setAttribute(slide, "style", styles); 4454 setAttribute(slide, ARIA_LABEL, label || ""); 4455 } 4456 4457 function initNavigation() { 4458 var controls = Splide2.splides.map(function (target) { 4459 var Slide2 = target.splide.Components.Slides.getAt(index); 4460 return Slide2 ? Slide2.slide.id : ""; 4461 }).join(" "); 4462 setAttribute(slide, ARIA_LABEL, format(i18n.slideX, (isClone ? slideIndex : index) + 1)); 4463 setAttribute(slide, ARIA_CONTROLS, controls); 4464 setAttribute(slide, ROLE, slideFocus ? "button" : ""); 4465 slideFocus && removeAttribute(slide, ARIA_ROLEDESCRIPTION); 4466 } 4467 4468 function onMove() { 4469 if (!destroyed) { 4470 update(); 4471 } 4472 } 4473 4474 function update() { 4475 if (!destroyed) { 4476 var curr = Splide2.index; 4477 updateActivity(); 4478 updateVisibility(); 4479 toggleClass(slide, CLASS_PREV, index === curr - 1); 4480 toggleClass(slide, CLASS_NEXT, index === curr + 1); 4481 } 4482 } 4483 4484 function updateActivity() { 4485 var active = isActive(); 4486 4487 if (active !== hasClass(slide, CLASS_ACTIVE)) { 4488 toggleClass(slide, CLASS_ACTIVE, active); 4489 setAttribute(slide, ARIA_CURRENT, isNavigation && active || ""); 4490 emit(active ? EVENT_ACTIVE : EVENT_INACTIVE, self); 4491 } 4492 } 4493 4494 function updateVisibility() { 4495 var visible = isVisible(); 4496 var hidden = !visible && (!isActive() || isClone); 4497 4498 if (!Splide2.state.is([MOVING, SCROLLING])) { 4499 setAttribute(slide, ARIA_HIDDEN, hidden || ""); 4500 } 4501 4502 setAttribute(queryAll(slide, options.focusableNodes || ""), TAB_INDEX, hidden ? -1 : ""); 4503 4504 if (slideFocus) { 4505 setAttribute(slide, TAB_INDEX, hidden ? -1 : 0); 4506 } 4507 4508 if (visible !== hasClass(slide, CLASS_VISIBLE)) { 4509 toggleClass(slide, CLASS_VISIBLE, visible); 4510 emit(visible ? EVENT_VISIBLE : EVENT_HIDDEN, self); 4511 } 4512 4513 if (!visible && document.activeElement === slide) { 4514 var Slide2 = Components.Slides.getAt(Splide2.index); 4515 Slide2 && focus(Slide2.slide); 4516 } 4517 } 4518 4519 function style$1(prop, value, useContainer) { 4520 style(useContainer && container || slide, prop, value); 4521 } 4522 4523 function isActive() { 4524 var curr = Splide2.index; 4525 return curr === index || options.cloneStatus && curr === slideIndex; 4526 } 4527 4528 function isVisible() { 4529 if (Splide2.is(FADE)) { 4530 return isActive(); 4531 } 4532 4533 var trackRect = rect(Components.Elements.track); 4534 var slideRect = rect(slide); 4535 var left = resolve("left", true); 4536 var right = resolve("right", true); 4537 return floor(trackRect[left]) <= ceil(slideRect[left]) && floor(slideRect[right]) <= ceil(trackRect[right]); 4538 } 4539 4540 function isWithin(from, distance) { 4541 var diff = abs(from - index); 4542 4543 if (!isClone && (options.rewind || Splide2.is(LOOP))) { 4544 diff = min(diff, Splide2.length - diff); 4545 } 4546 4547 return diff <= distance; 4548 } 4549 4550 var self = { 4551 index: index, 4552 slideIndex: slideIndex, 4553 slide: slide, 4554 container: container, 4555 isClone: isClone, 4556 mount: mount, 4557 destroy: destroy, 4558 update: update, 4559 style: style$1, 4560 isWithin: isWithin 4561 }; 4562 return self; 4563} 4564 4565function Slides(Splide2, Components2, options) { 4566 var _EventInterface2 = EventInterface(Splide2), 4567 on = _EventInterface2.on, 4568 emit = _EventInterface2.emit, 4569 bind = _EventInterface2.bind; 4570 4571 var _Components2$Elements = Components2.Elements, 4572 slides = _Components2$Elements.slides, 4573 list = _Components2$Elements.list; 4574 var Slides2 = []; 4575 4576 function mount() { 4577 init(); 4578 on(EVENT_REFRESH, destroy); 4579 on(EVENT_REFRESH, init); 4580 } 4581 4582 function init() { 4583 slides.forEach(function (slide, index) { 4584 register(slide, index, -1); 4585 }); 4586 } 4587 4588 function destroy() { 4589 forEach$1(function (Slide2) { 4590 Slide2.destroy(); 4591 }); 4592 empty(Slides2); 4593 } 4594 4595 function update() { 4596 forEach$1(function (Slide2) { 4597 Slide2.update(); 4598 }); 4599 } 4600 4601 function register(slide, index, slideIndex) { 4602 var object = Slide$1(Splide2, index, slideIndex, slide); 4603 object.mount(); 4604 Slides2.push(object); 4605 Slides2.sort(function (Slide1, Slide2) { 4606 return Slide1.index - Slide2.index; 4607 }); 4608 } 4609 4610 function get(excludeClones) { 4611 return excludeClones ? filter(function (Slide2) { 4612 return !Slide2.isClone; 4613 }) : Slides2; 4614 } 4615 4616 function getIn(page) { 4617 var Controller = Components2.Controller; 4618 var index = Controller.toIndex(page); 4619 var max = Controller.hasFocus() ? 1 : options.perPage; 4620 return filter(function (Slide2) { 4621 return between(Slide2.index, index, index + max - 1); 4622 }); 4623 } 4624 4625 function getAt(index) { 4626 return filter(index)[0]; 4627 } 4628 4629 function add(items, index) { 4630 forEach(items, function (slide) { 4631 if (isString(slide)) { 4632 slide = parseHtml(slide); 4633 } 4634 4635 if (isHTMLElement(slide)) { 4636 var ref = slides[index]; 4637 ref ? before(slide, ref) : append(list, slide); 4638 addClass(slide, options.classes.slide); 4639 observeImages(slide, apply(emit, EVENT_RESIZE)); 4640 } 4641 }); 4642 emit(EVENT_REFRESH); 4643 } 4644 4645 function remove$1(matcher) { 4646 remove(filter(matcher).map(function (Slide2) { 4647 return Slide2.slide; 4648 })); 4649 emit(EVENT_REFRESH); 4650 } 4651 4652 function forEach$1(iteratee, excludeClones) { 4653 get(excludeClones).forEach(iteratee); 4654 } 4655 4656 function filter(matcher) { 4657 return Slides2.filter(isFunction(matcher) ? matcher : function (Slide2) { 4658 return isString(matcher) ? matches(Slide2.slide, matcher) : includes(toArray(matcher), Slide2.index); 4659 }); 4660 } 4661 4662 function style(prop, value, useContainer) { 4663 forEach$1(function (Slide2) { 4664 Slide2.style(prop, value, useContainer); 4665 }); 4666 } 4667 4668 function observeImages(elm, callback) { 4669 var images = queryAll(elm, "img"); 4670 var length = images.length; 4671 4672 if (length) { 4673 images.forEach(function (img) { 4674 bind(img, "load error", function () { 4675 if (! --length) { 4676 callback(); 4677 } 4678 }); 4679 }); 4680 } else { 4681 callback(); 4682 } 4683 } 4684 4685 function getLength(excludeClones) { 4686 return excludeClones ? slides.length : Slides2.length; 4687 } 4688 4689 function isEnough() { 4690 return Slides2.length > options.perPage; 4691 } 4692 4693 return { 4694 mount: mount, 4695 destroy: destroy, 4696 update: update, 4697 register: register, 4698 get: get, 4699 getIn: getIn, 4700 getAt: getAt, 4701 add: add, 4702 remove: remove$1, 4703 forEach: forEach$1, 4704 filter: filter, 4705 style: style, 4706 getLength: getLength, 4707 isEnough: isEnough 4708 }; 4709} 4710 4711function Layout(Splide2, Components2, options) { 4712 var _EventInterface3 = EventInterface(Splide2), 4713 on = _EventInterface3.on, 4714 bind = _EventInterface3.bind, 4715 emit = _EventInterface3.emit; 4716 4717 var Slides = Components2.Slides; 4718 var resolve = Components2.Direction.resolve; 4719 var _Components2$Elements2 = Components2.Elements, 4720 root = _Components2$Elements2.root, 4721 track = _Components2$Elements2.track, 4722 list = _Components2$Elements2.list; 4723 var getAt = Slides.getAt, 4724 styleSlides = Slides.style; 4725 var vertical; 4726 var rootRect; 4727 var overflow; 4728 4729 function mount() { 4730 init(); 4731 bind(window, "resize load", Throttle(apply(emit, EVENT_RESIZE))); 4732 on([EVENT_UPDATED, EVENT_REFRESH], init); 4733 on(EVENT_RESIZE, resize); 4734 } 4735 4736 function init() { 4737 vertical = options.direction === TTB; 4738 style(root, "maxWidth", unit(options.width)); 4739 style(track, resolve("paddingLeft"), cssPadding(false)); 4740 style(track, resolve("paddingRight"), cssPadding(true)); 4741 resize(true); 4742 } 4743 4744 function resize(force) { 4745 var newRect = rect(root); 4746 4747 if (force || rootRect.width !== newRect.width || rootRect.height !== newRect.height) { 4748 style(track, "height", cssTrackHeight()); 4749 styleSlides(resolve("marginRight"), unit(options.gap)); 4750 styleSlides("width", cssSlideWidth()); 4751 styleSlides("height", cssSlideHeight(), true); 4752 rootRect = newRect; 4753 emit(EVENT_RESIZED); 4754 4755 if (overflow !== (overflow = isOverflow())) { 4756 toggleClass(root, CLASS_OVERFLOW, overflow); 4757 emit(EVENT_OVERFLOW, overflow); 4758 } 4759 } 4760 } 4761 4762 function cssPadding(right) { 4763 var padding = options.padding; 4764 var prop = resolve(right ? "right" : "left"); 4765 return padding && unit(padding[prop] || (isObject(padding) ? 0 : padding)) || "0px"; 4766 } 4767 4768 function cssTrackHeight() { 4769 var height = ""; 4770 4771 if (vertical) { 4772 height = cssHeight(); 4773 assert(height, "height or heightRatio is missing."); 4774 height = "calc(" + height + " - " + cssPadding(false) + " - " + cssPadding(true) + ")"; 4775 } 4776 4777 return height; 4778 } 4779 4780 function cssHeight() { 4781 return unit(options.height || rect(list).width * options.heightRatio); 4782 } 4783 4784 function cssSlideWidth() { 4785 return options.autoWidth ? null : unit(options.fixedWidth) || (vertical ? "" : cssSlideSize()); 4786 } 4787 4788 function cssSlideHeight() { 4789 return unit(options.fixedHeight) || (vertical ? options.autoHeight ? null : cssSlideSize() : cssHeight()); 4790 } 4791 4792 function cssSlideSize() { 4793 var gap = unit(options.gap); 4794 return "calc((100%" + (gap && " + " + gap) + ")/" + (options.perPage || 1) + (gap && " - " + gap) + ")"; 4795 } 4796 4797 function listSize() { 4798 return rect(list)[resolve("width")]; 4799 } 4800 4801 function slideSize(index, withoutGap) { 4802 var Slide = getAt(index || 0); 4803 return Slide ? rect(Slide.slide)[resolve("width")] + (withoutGap ? 0 : getGap()) : 0; 4804 } 4805 4806 function totalSize(index, withoutGap) { 4807 var Slide = getAt(index); 4808 4809 if (Slide) { 4810 var right = rect(Slide.slide)[resolve("right")]; 4811 var left = rect(list)[resolve("left")]; 4812 return abs(right - left) + (withoutGap ? 0 : getGap()); 4813 } 4814 4815 return 0; 4816 } 4817 4818 function sliderSize(withoutGap) { 4819 return totalSize(Splide2.length - 1) - totalSize(0) + slideSize(0, withoutGap); 4820 } 4821 4822 function getGap() { 4823 var Slide = getAt(0); 4824 return Slide && parseFloat(style(Slide.slide, resolve("marginRight"))) || 0; 4825 } 4826 4827 function getPadding(right) { 4828 return parseFloat(style(track, resolve("padding" + (right ? "Right" : "Left")))) || 0; 4829 } 4830 4831 function isOverflow() { 4832 return Splide2.is(FADE) || sliderSize(true) > listSize(); 4833 } 4834 4835 return { 4836 mount: mount, 4837 resize: resize, 4838 listSize: listSize, 4839 slideSize: slideSize, 4840 sliderSize: sliderSize, 4841 totalSize: totalSize, 4842 getPadding: getPadding, 4843 isOverflow: isOverflow 4844 }; 4845} 4846 4847var MULTIPLIER = 2; 4848 4849function Clones(Splide2, Components2, options) { 4850 var event = EventInterface(Splide2); 4851 var on = event.on; 4852 var Elements = Components2.Elements, 4853 Slides = Components2.Slides; 4854 var resolve = Components2.Direction.resolve; 4855 var clones = []; 4856 var cloneCount; 4857 4858 function mount() { 4859 on(EVENT_REFRESH, remount); 4860 on([EVENT_UPDATED, EVENT_RESIZE], observe); 4861 4862 if (cloneCount = computeCloneCount()) { 4863 generate(cloneCount); 4864 Components2.Layout.resize(true); 4865 } 4866 } 4867 4868 function remount() { 4869 destroy(); 4870 mount(); 4871 } 4872 4873 function destroy() { 4874 remove(clones); 4875 empty(clones); 4876 event.destroy(); 4877 } 4878 4879 function observe() { 4880 var count = computeCloneCount(); 4881 4882 if (cloneCount !== count) { 4883 if (cloneCount < count || !count) { 4884 event.emit(EVENT_REFRESH); 4885 } 4886 } 4887 } 4888 4889 function generate(count) { 4890 var slides = Slides.get().slice(); 4891 var length = slides.length; 4892 4893 if (length) { 4894 while (slides.length < count) { 4895 push(slides, slides); 4896 } 4897 4898 push(slides.slice(-count), slides.slice(0, count)).forEach(function (Slide, index) { 4899 var isHead = index < count; 4900 var clone = cloneDeep(Slide.slide, index); 4901 isHead ? before(clone, slides[0].slide) : append(Elements.list, clone); 4902 push(clones, clone); 4903 Slides.register(clone, index - count + (isHead ? 0 : length), Slide.index); 4904 }); 4905 } 4906 } 4907 4908 function cloneDeep(elm, index) { 4909 var clone = elm.cloneNode(true); 4910 addClass(clone, options.classes.clone); 4911 clone.id = Splide2.root.id + "-clone" + pad(index + 1); 4912 return clone; 4913 } 4914 4915 function computeCloneCount() { 4916 var clones2 = options.clones; 4917 4918 if (!Splide2.is(LOOP)) { 4919 clones2 = 0; 4920 } else if (isUndefined(clones2)) { 4921 var fixedSize = options[resolve("fixedWidth")] && Components2.Layout.slideSize(0); 4922 var fixedCount = fixedSize && ceil(rect(Elements.track)[resolve("width")] / fixedSize); 4923 clones2 = fixedCount || options[resolve("autoWidth")] && Splide2.length || options.perPage * MULTIPLIER; 4924 } 4925 4926 return clones2; 4927 } 4928 4929 return { 4930 mount: mount, 4931 destroy: destroy 4932 }; 4933} 4934 4935function Move(Splide2, Components2, options) { 4936 var _EventInterface4 = EventInterface(Splide2), 4937 on = _EventInterface4.on, 4938 emit = _EventInterface4.emit; 4939 4940 var set = Splide2.state.set; 4941 var _Components2$Layout = Components2.Layout, 4942 slideSize = _Components2$Layout.slideSize, 4943 getPadding = _Components2$Layout.getPadding, 4944 totalSize = _Components2$Layout.totalSize, 4945 listSize = _Components2$Layout.listSize, 4946 sliderSize = _Components2$Layout.sliderSize; 4947 var _Components2$Directio = Components2.Direction, 4948 resolve = _Components2$Directio.resolve, 4949 orient = _Components2$Directio.orient; 4950 var _Components2$Elements3 = Components2.Elements, 4951 list = _Components2$Elements3.list, 4952 track = _Components2$Elements3.track; 4953 var Transition; 4954 4955 function mount() { 4956 Transition = Components2.Transition; 4957 on([EVENT_MOUNTED, EVENT_RESIZED, EVENT_UPDATED, EVENT_REFRESH], reposition); 4958 } 4959 4960 function reposition() { 4961 if (!Components2.Controller.isBusy()) { 4962 Components2.Scroll.cancel(); 4963 jump(Splide2.index); 4964 Components2.Slides.update(); 4965 } 4966 } 4967 4968 function move(dest, index, prev, callback) { 4969 if (dest !== index && canShift(dest > prev)) { 4970 cancel(); 4971 translate(shift(getPosition(), dest > prev), true); 4972 } 4973 4974 set(MOVING); 4975 emit(EVENT_MOVE, index, prev, dest); 4976 Transition.start(index, function () { 4977 set(IDLE); 4978 emit(EVENT_MOVED, index, prev, dest); 4979 callback && callback(); 4980 }); 4981 } 4982 4983 function jump(index) { 4984 translate(toPosition(index, true)); 4985 } 4986 4987 function translate(position, preventLoop) { 4988 if (!Splide2.is(FADE)) { 4989 var destination = preventLoop ? position : loop(position); 4990 style(list, "transform", "translate" + resolve("X") + "(" + destination + "px)"); 4991 position !== destination && emit(EVENT_SHIFTED); 4992 } 4993 } 4994 4995 function loop(position) { 4996 if (Splide2.is(LOOP)) { 4997 var index = toIndex(position); 4998 var exceededMax = index > Components2.Controller.getEnd(); 4999 var exceededMin = index < 0; 5000 5001 if (exceededMin || exceededMax) { 5002 position = shift(position, exceededMax); 5003 } 5004 } 5005 5006 return position; 5007 } 5008 5009 function shift(position, backwards) { 5010 var excess = position - getLimit(backwards); 5011 var size = sliderSize(); 5012 position -= orient(size * (ceil(abs(excess) / size) || 1)) * (backwards ? 1 : -1); 5013 return position; 5014 } 5015 5016 function cancel() { 5017 translate(getPosition(), true); 5018 Transition.cancel(); 5019 } 5020 5021 function toIndex(position) { 5022 var Slides = Components2.Slides.get(); 5023 var index = 0; 5024 var minDistance = Infinity; 5025 5026 for (var i = 0; i < Slides.length; i++) { 5027 var slideIndex = Slides[i].index; 5028 var distance = abs(toPosition(slideIndex, true) - position); 5029 5030 if (distance <= minDistance) { 5031 minDistance = distance; 5032 index = slideIndex; 5033 } else { 5034 break; 5035 } 5036 } 5037 5038 return index; 5039 } 5040 5041 function toPosition(index, trimming) { 5042 var position = orient(totalSize(index - 1) - offset(index)); 5043 return trimming ? trim(position) : position; 5044 } 5045 5046 function getPosition() { 5047 var left = resolve("left"); 5048 return rect(list)[left] - rect(track)[left] + orient(getPadding(false)); 5049 } 5050 5051 function trim(position) { 5052 if (options.trimSpace && Splide2.is(SLIDE)) { 5053 position = clamp(position, 0, orient(sliderSize(true) - listSize())); 5054 } 5055 5056 return position; 5057 } 5058 5059 function offset(index) { 5060 var focus = options.focus; 5061 return focus === "center" ? (listSize() - slideSize(index, true)) / 2 : +focus * slideSize(index) || 0; 5062 } 5063 5064 function getLimit(max) { 5065 return toPosition(max ? Components2.Controller.getEnd() : 0, !!options.trimSpace); 5066 } 5067 5068 function canShift(backwards) { 5069 var shifted = orient(shift(getPosition(), backwards)); 5070 return backwards ? shifted >= 0 : shifted <= list[resolve("scrollWidth")] - rect(track)[resolve("width")]; 5071 } 5072 5073 function exceededLimit(max, position) { 5074 position = isUndefined(position) ? getPosition() : position; 5075 var exceededMin = max !== true && orient(position) < orient(getLimit(false)); 5076 var exceededMax = max !== false && orient(position) > orient(getLimit(true)); 5077 return exceededMin || exceededMax; 5078 } 5079 5080 return { 5081 mount: mount, 5082 move: move, 5083 jump: jump, 5084 translate: translate, 5085 shift: shift, 5086 cancel: cancel, 5087 toIndex: toIndex, 5088 toPosition: toPosition, 5089 getPosition: getPosition, 5090 getLimit: getLimit, 5091 exceededLimit: exceededLimit, 5092 reposition: reposition 5093 }; 5094} 5095 5096function Controller(Splide2, Components2, options) { 5097 var _EventInterface5 = EventInterface(Splide2), 5098 on = _EventInterface5.on, 5099 emit = _EventInterface5.emit; 5100 5101 var Move = Components2.Move; 5102 var getPosition = Move.getPosition, 5103 getLimit = Move.getLimit, 5104 toPosition = Move.toPosition; 5105 var _Components2$Slides = Components2.Slides, 5106 isEnough = _Components2$Slides.isEnough, 5107 getLength = _Components2$Slides.getLength; 5108 var omitEnd = options.omitEnd; 5109 var isLoop = Splide2.is(LOOP); 5110 var isSlide = Splide2.is(SLIDE); 5111 var getNext = apply(getAdjacent, false); 5112 var getPrev = apply(getAdjacent, true); 5113 var currIndex = options.start || 0; 5114 var endIndex; 5115 var prevIndex = currIndex; 5116 var slideCount; 5117 var perMove; 5118 var perPage; 5119 5120 function mount() { 5121 init(); 5122 on([EVENT_UPDATED, EVENT_REFRESH, EVENT_END_INDEX_CHANGED], init); 5123 on(EVENT_RESIZED, onResized); 5124 } 5125 5126 function init() { 5127 slideCount = getLength(true); 5128 perMove = options.perMove; 5129 perPage = options.perPage; 5130 endIndex = getEnd(); 5131 var index = clamp(currIndex, 0, omitEnd ? endIndex : slideCount - 1); 5132 5133 if (index !== currIndex) { 5134 currIndex = index; 5135 Move.reposition(); 5136 } 5137 } 5138 5139 function onResized() { 5140 if (endIndex !== getEnd()) { 5141 emit(EVENT_END_INDEX_CHANGED); 5142 } 5143 } 5144 5145 function go(control, allowSameIndex, callback) { 5146 if (!isBusy()) { 5147 var dest = parse(control); 5148 var index = loop(dest); 5149 5150 if (index > -1 && (allowSameIndex || index !== currIndex)) { 5151 setIndex(index); 5152 Move.move(dest, index, prevIndex, callback); 5153 } 5154 } 5155 } 5156 5157 function scroll(destination, duration, snap, callback) { 5158 Components2.Scroll.scroll(destination, duration, snap, function () { 5159 var index = loop(Move.toIndex(getPosition())); 5160 setIndex(omitEnd ? min(index, endIndex) : index); 5161 callback && callback(); 5162 }); 5163 } 5164 5165 function parse(control) { 5166 var index = currIndex; 5167 5168 if (isString(control)) { 5169 var _ref = control.match(/([+\-<>])(\d+)?/) || [], 5170 indicator = _ref[1], 5171 number = _ref[2]; 5172 5173 if (indicator === "+" || indicator === "-") { 5174 index = computeDestIndex(currIndex + +("" + indicator + (+number || 1)), currIndex); 5175 } else if (indicator === ">") { 5176 index = number ? toIndex(+number) : getNext(true); 5177 } else if (indicator === "<") { 5178 index = getPrev(true); 5179 } 5180 } else { 5181 index = isLoop ? control : clamp(control, 0, endIndex); 5182 } 5183 5184 return index; 5185 } 5186 5187 function getAdjacent(prev, destination) { 5188 var number = perMove || (hasFocus() ? 1 : perPage); 5189 var dest = computeDestIndex(currIndex + number * (prev ? -1 : 1), currIndex, !(perMove || hasFocus())); 5190 5191 if (dest === -1 && isSlide) { 5192 if (!approximatelyEqual(getPosition(), getLimit(!prev), 1)) { 5193 return prev ? 0 : endIndex; 5194 } 5195 } 5196 5197 return destination ? dest : loop(dest); 5198 } 5199 5200 function computeDestIndex(dest, from, snapPage) { 5201 if (isEnough() || hasFocus()) { 5202 var index = computeMovableDestIndex(dest); 5203 5204 if (index !== dest) { 5205 from = dest; 5206 dest = index; 5207 snapPage = false; 5208 } 5209 5210 if (dest < 0 || dest > endIndex) { 5211 if (!perMove && (between(0, dest, from, true) || between(endIndex, from, dest, true))) { 5212 dest = toIndex(toPage(dest)); 5213 } else { 5214 if (isLoop) { 5215 dest = snapPage ? dest < 0 ? -(slideCount % perPage || perPage) : slideCount : dest; 5216 } else if (options.rewind) { 5217 dest = dest < 0 ? endIndex : 0; 5218 } else { 5219 dest = -1; 5220 } 5221 } 5222 } else { 5223 if (snapPage && dest !== from) { 5224 dest = toIndex(toPage(from) + (dest < from ? -1 : 1)); 5225 } 5226 } 5227 } else { 5228 dest = -1; 5229 } 5230 5231 return dest; 5232 } 5233 5234 function computeMovableDestIndex(dest) { 5235 if (isSlide && options.trimSpace === "move" && dest !== currIndex) { 5236 var position = getPosition(); 5237 5238 while (position === toPosition(dest, true) && between(dest, 0, Splide2.length - 1, !options.rewind)) { 5239 dest < currIndex ? --dest : ++dest; 5240 } 5241 } 5242 5243 return dest; 5244 } 5245 5246 function loop(index) { 5247 return isLoop ? (index + slideCount) % slideCount || 0 : index; 5248 } 5249 5250 function getEnd() { 5251 var end = slideCount - (hasFocus() || isLoop && perMove ? 1 : perPage); 5252 5253 while (omitEnd && end-- > 0) { 5254 if (toPosition(slideCount - 1, true) !== toPosition(end, true)) { 5255 end++; 5256 break; 5257 } 5258 } 5259 5260 return clamp(end, 0, slideCount - 1); 5261 } 5262 5263 function toIndex(page) { 5264 return clamp(hasFocus() ? page : perPage * page, 0, endIndex); 5265 } 5266 5267 function toPage(index) { 5268 return hasFocus() ? min(index, endIndex) : floor((index >= endIndex ? slideCount - 1 : index) / perPage); 5269 } 5270 5271 function toDest(destination) { 5272 var closest = Move.toIndex(destination); 5273 return isSlide ? clamp(closest, 0, endIndex) : closest; 5274 } 5275 5276 function setIndex(index) { 5277 if (index !== currIndex) { 5278 prevIndex = currIndex; 5279 currIndex = index; 5280 } 5281 } 5282 5283 function getIndex(prev) { 5284 return prev ? prevIndex : currIndex; 5285 } 5286 5287 function hasFocus() { 5288 return !isUndefined(options.focus) || options.isNavigation; 5289 } 5290 5291 function isBusy() { 5292 return Splide2.state.is([MOVING, SCROLLING]) && !!options.waitForTransition; 5293 } 5294 5295 return { 5296 mount: mount, 5297 go: go, 5298 scroll: scroll, 5299 getNext: getNext, 5300 getPrev: getPrev, 5301 getAdjacent: getAdjacent, 5302 getEnd: getEnd, 5303 setIndex: setIndex, 5304 getIndex: getIndex, 5305 toIndex: toIndex, 5306 toPage: toPage, 5307 toDest: toDest, 5308 hasFocus: hasFocus, 5309 isBusy: isBusy 5310 }; 5311} 5312 5313var XML_NAME_SPACE = "http://www.w3.org/2000/svg"; 5314var PATH = "m15.5 0.932-4.3 4.38 14.5 14.6-14.5 14.5 4.3 4.4 14.6-14.6 4.4-4.3-4.4-4.4-14.6-14.6z"; 5315var SIZE = 40; 5316 5317function Arrows(Splide2, Components2, options) { 5318 var event = EventInterface(Splide2); 5319 var on = event.on, 5320 bind = event.bind, 5321 emit = event.emit; 5322 var classes = options.classes, 5323 i18n = options.i18n; 5324 var Elements = Components2.Elements, 5325 Controller = Components2.Controller; 5326 var placeholder = Elements.arrows, 5327 track = Elements.track; 5328 var wrapper = placeholder; 5329 var prev = Elements.prev; 5330 var next = Elements.next; 5331 var created; 5332 var wrapperClasses; 5333 var arrows = {}; 5334 5335 function mount() { 5336 init(); 5337 on(EVENT_UPDATED, remount); 5338 } 5339 5340 function remount() { 5341 destroy(); 5342 mount(); 5343 } 5344 5345 function init() { 5346 var enabled = options.arrows; 5347 5348 if (enabled && !(prev && next)) { 5349 createArrows(); 5350 } 5351 5352 if (prev && next) { 5353 assign(arrows, { 5354 prev: prev, 5355 next: next 5356 }); 5357 display(wrapper, enabled ? "" : "none"); 5358 addClass(wrapper, wrapperClasses = CLASS_ARROWS + "--" + options.direction); 5359 5360 if (enabled) { 5361 listen(); 5362 update(); 5363 setAttribute([prev, next], ARIA_CONTROLS, track.id); 5364 emit(EVENT_ARROWS_MOUNTED, prev, next); 5365 } 5366 } 5367 } 5368 5369 function destroy() { 5370 event.destroy(); 5371 removeClass(wrapper, wrapperClasses); 5372 5373 if (created) { 5374 remove(placeholder ? [prev, next] : wrapper); 5375 prev = next = null; 5376 } else { 5377 removeAttribute([prev, next], ALL_ATTRIBUTES); 5378 } 5379 } 5380 5381 function listen() { 5382 on([EVENT_MOUNTED, EVENT_MOVED, EVENT_REFRESH, EVENT_SCROLLED, EVENT_END_INDEX_CHANGED], update); 5383 bind(next, "click", apply(go, ">")); 5384 bind(prev, "click", apply(go, "<")); 5385 } 5386 5387 function go(control) { 5388 Controller.go(control, true); 5389 } 5390 5391 function createArrows() { 5392 wrapper = placeholder || create("div", classes.arrows); 5393 prev = createArrow(true); 5394 next = createArrow(false); 5395 created = true; 5396 append(wrapper, [prev, next]); 5397 !placeholder && before(wrapper, track); 5398 } 5399 5400 function createArrow(prev2) { 5401 var arrow = "<button class=\"" + classes.arrow + " " + (prev2 ? classes.prev : classes.next) + "\" type=\"button\"><svg xmlns=\"" + XML_NAME_SPACE + "\" viewBox=\"0 0 " + SIZE + " " + SIZE + "\" width=\"" + SIZE + "\" height=\"" + SIZE + "\" focusable=\"false\"><path d=\"" + (options.arrowPath || PATH) + "\" />"; 5402 return parseHtml(arrow); 5403 } 5404 5405 function update() { 5406 if (prev && next) { 5407 var index = Splide2.index; 5408 var prevIndex = Controller.getPrev(); 5409 var nextIndex = Controller.getNext(); 5410 var prevLabel = prevIndex > -1 && index < prevIndex ? i18n.last : i18n.prev; 5411 var nextLabel = nextIndex > -1 && index > nextIndex ? i18n.first : i18n.next; 5412 prev.disabled = prevIndex < 0; 5413 next.disabled = nextIndex < 0; 5414 setAttribute(prev, ARIA_LABEL, prevLabel); 5415 setAttribute(next, ARIA_LABEL, nextLabel); 5416 emit(EVENT_ARROWS_UPDATED, prev, next, prevIndex, nextIndex); 5417 } 5418 } 5419 5420 return { 5421 arrows: arrows, 5422 mount: mount, 5423 destroy: destroy, 5424 update: update 5425 }; 5426} 5427 5428var INTERVAL_DATA_ATTRIBUTE = DATA_ATTRIBUTE + "-interval"; 5429 5430function Autoplay(Splide2, Components2, options) { 5431 var _EventInterface6 = EventInterface(Splide2), 5432 on = _EventInterface6.on, 5433 bind = _EventInterface6.bind, 5434 emit = _EventInterface6.emit; 5435 5436 var interval = RequestInterval(options.interval, Splide2.go.bind(Splide2, ">"), onAnimationFrame); 5437 var isPaused = interval.isPaused; 5438 var Elements = Components2.Elements, 5439 _Components2$Elements4 = Components2.Elements, 5440 root = _Components2$Elements4.root, 5441 toggle = _Components2$Elements4.toggle; 5442 var autoplay = options.autoplay; 5443 var hovered; 5444 var focused; 5445 var stopped = autoplay === "pause"; 5446 5447 function mount() { 5448 if (autoplay) { 5449 listen(); 5450 toggle && setAttribute(toggle, ARIA_CONTROLS, Elements.track.id); 5451 stopped || play(); 5452 update(); 5453 } 5454 } 5455 5456 function listen() { 5457 if (options.pauseOnHover) { 5458 bind(root, "mouseenter mouseleave", function (e) { 5459 hovered = e.type === "mouseenter"; 5460 autoToggle(); 5461 }); 5462 } 5463 5464 if (options.pauseOnFocus) { 5465 bind(root, "focusin focusout", function (e) { 5466 focused = e.type === "focusin"; 5467 autoToggle(); 5468 }); 5469 } 5470 5471 if (toggle) { 5472 bind(toggle, "click", function () { 5473 stopped ? play() : pause(true); 5474 }); 5475 } 5476 5477 on([EVENT_MOVE, EVENT_SCROLL, EVENT_REFRESH], interval.rewind); 5478 on(EVENT_MOVE, onMove); 5479 } 5480 5481 function play() { 5482 if (isPaused() && Components2.Slides.isEnough()) { 5483 interval.start(!options.resetProgress); 5484 focused = hovered = stopped = false; 5485 update(); 5486 emit(EVENT_AUTOPLAY_PLAY); 5487 } 5488 } 5489 5490 function pause(stop) { 5491 if (stop === void 0) { 5492 stop = true; 5493 } 5494 5495 stopped = !!stop; 5496 update(); 5497 5498 if (!isPaused()) { 5499 interval.pause(); 5500 emit(EVENT_AUTOPLAY_PAUSE); 5501 } 5502 } 5503 5504 function autoToggle() { 5505 if (!stopped) { 5506 hovered || focused ? pause(false) : play(); 5507 } 5508 } 5509 5510 function update() { 5511 if (toggle) { 5512 toggleClass(toggle, CLASS_ACTIVE, !stopped); 5513 setAttribute(toggle, ARIA_LABEL, options.i18n[stopped ? "play" : "pause"]); 5514 } 5515 } 5516 5517 function onAnimationFrame(rate) { 5518 var bar = Elements.bar; 5519 bar && style(bar, "width", rate * 100 + "%"); 5520 emit(EVENT_AUTOPLAY_PLAYING, rate); 5521 } 5522 5523 function onMove(index) { 5524 var Slide = Components2.Slides.getAt(index); 5525 interval.set(Slide && +getAttribute(Slide.slide, INTERVAL_DATA_ATTRIBUTE) || options.interval); 5526 } 5527 5528 return { 5529 mount: mount, 5530 destroy: interval.cancel, 5531 play: play, 5532 pause: pause, 5533 isPaused: isPaused 5534 }; 5535} 5536 5537function Cover(Splide2, Components2, options) { 5538 var _EventInterface7 = EventInterface(Splide2), 5539 on = _EventInterface7.on; 5540 5541 function mount() { 5542 if (options.cover) { 5543 on(EVENT_LAZYLOAD_LOADED, apply(toggle, true)); 5544 on([EVENT_MOUNTED, EVENT_UPDATED, EVENT_REFRESH], apply(cover, true)); 5545 } 5546 } 5547 5548 function cover(cover2) { 5549 Components2.Slides.forEach(function (Slide) { 5550 var img = child(Slide.container || Slide.slide, "img"); 5551 5552 if (img && img.src) { 5553 toggle(cover2, img, Slide); 5554 } 5555 }); 5556 } 5557 5558 function toggle(cover2, img, Slide) { 5559 Slide.style("background", cover2 ? "center/cover no-repeat url(\"" + img.src + "\")" : "", true); 5560 display(img, cover2 ? "none" : ""); 5561 } 5562 5563 return { 5564 mount: mount, 5565 destroy: apply(cover, false) 5566 }; 5567} 5568 5569var BOUNCE_DIFF_THRESHOLD = 10; 5570var BOUNCE_DURATION = 600; 5571var FRICTION_FACTOR = 0.6; 5572var BASE_VELOCITY = 1.5; 5573var MIN_DURATION = 800; 5574 5575function Scroll(Splide2, Components2, options) { 5576 var _EventInterface8 = EventInterface(Splide2), 5577 on = _EventInterface8.on, 5578 emit = _EventInterface8.emit; 5579 5580 var set = Splide2.state.set; 5581 var Move = Components2.Move; 5582 var getPosition = Move.getPosition, 5583 getLimit = Move.getLimit, 5584 exceededLimit = Move.exceededLimit, 5585 translate = Move.translate; 5586 var isSlide = Splide2.is(SLIDE); 5587 var interval; 5588 var callback; 5589 var friction = 1; 5590 5591 function mount() { 5592 on(EVENT_MOVE, clear); 5593 on([EVENT_UPDATED, EVENT_REFRESH], cancel); 5594 } 5595 5596 function scroll(destination, duration, snap, onScrolled, noConstrain) { 5597 var from = getPosition(); 5598 clear(); 5599 5600 if (snap && (!isSlide || !exceededLimit())) { 5601 var size = Components2.Layout.sliderSize(); 5602 var offset = sign(destination) * size * floor(abs(destination) / size) || 0; 5603 destination = Move.toPosition(Components2.Controller.toDest(destination % size)) + offset; 5604 } 5605 5606 var noDistance = approximatelyEqual(from, destination, 1); 5607 friction = 1; 5608 duration = noDistance ? 0 : duration || max(abs(destination - from) / BASE_VELOCITY, MIN_DURATION); 5609 callback = onScrolled; 5610 interval = RequestInterval(duration, onEnd, apply(update, from, destination, noConstrain), 1); 5611 set(SCROLLING); 5612 emit(EVENT_SCROLL); 5613 interval.start(); 5614 } 5615 5616 function onEnd() { 5617 set(IDLE); 5618 callback && callback(); 5619 emit(EVENT_SCROLLED); 5620 } 5621 5622 function update(from, to, noConstrain, rate) { 5623 var position = getPosition(); 5624 var target = from + (to - from) * easing(rate); 5625 var diff = (target - position) * friction; 5626 translate(position + diff); 5627 5628 if (isSlide && !noConstrain && exceededLimit()) { 5629 friction *= FRICTION_FACTOR; 5630 5631 if (abs(diff) < BOUNCE_DIFF_THRESHOLD) { 5632 scroll(getLimit(exceededLimit(true)), BOUNCE_DURATION, false, callback, true); 5633 } 5634 } 5635 } 5636 5637 function clear() { 5638 if (interval) { 5639 interval.cancel(); 5640 } 5641 } 5642 5643 function cancel() { 5644 if (interval && !interval.isPaused()) { 5645 clear(); 5646 onEnd(); 5647 } 5648 } 5649 5650 function easing(t) { 5651 var easingFunc = options.easingFunc; 5652 return easingFunc ? easingFunc(t) : 1 - Math.pow(1 - t, 4); 5653 } 5654 5655 return { 5656 mount: mount, 5657 destroy: clear, 5658 scroll: scroll, 5659 cancel: cancel 5660 }; 5661} 5662 5663var SCROLL_LISTENER_OPTIONS = { 5664 passive: false, 5665 capture: true 5666}; 5667 5668function Drag(Splide2, Components2, options) { 5669 var _EventInterface9 = EventInterface(Splide2), 5670 on = _EventInterface9.on, 5671 emit = _EventInterface9.emit, 5672 bind = _EventInterface9.bind, 5673 unbind = _EventInterface9.unbind; 5674 5675 var state = Splide2.state; 5676 var Move = Components2.Move, 5677 Scroll = Components2.Scroll, 5678 Controller = Components2.Controller, 5679 track = Components2.Elements.track, 5680 reduce = Components2.Media.reduce; 5681 var _Components2$Directio2 = Components2.Direction, 5682 resolve = _Components2$Directio2.resolve, 5683 orient = _Components2$Directio2.orient; 5684 var getPosition = Move.getPosition, 5685 exceededLimit = Move.exceededLimit; 5686 var basePosition; 5687 var baseEvent; 5688 var prevBaseEvent; 5689 var isFree; 5690 var dragging; 5691 var exceeded = false; 5692 var clickPrevented; 5693 var disabled; 5694 var target; 5695 5696 function mount() { 5697 bind(track, POINTER_MOVE_EVENTS, noop, SCROLL_LISTENER_OPTIONS); 5698 bind(track, POINTER_UP_EVENTS, noop, SCROLL_LISTENER_OPTIONS); 5699 bind(track, POINTER_DOWN_EVENTS, onPointerDown, SCROLL_LISTENER_OPTIONS); 5700 bind(track, "click", onClick, { 5701 capture: true 5702 }); 5703 bind(track, "dragstart", prevent); 5704 on([EVENT_MOUNTED, EVENT_UPDATED], init); 5705 } 5706 5707 function init() { 5708 var drag = options.drag; 5709 disable(!drag); 5710 isFree = drag === "free"; 5711 } 5712 5713 function onPointerDown(e) { 5714 clickPrevented = false; 5715 5716 if (!disabled) { 5717 var isTouch = isTouchEvent(e); 5718 5719 if (isDraggable(e.target) && (isTouch || !e.button)) { 5720 if (!Controller.isBusy()) { 5721 target = isTouch ? track : window; 5722 dragging = state.is([MOVING, SCROLLING]); 5723 prevBaseEvent = null; 5724 bind(target, POINTER_MOVE_EVENTS, onPointerMove, SCROLL_LISTENER_OPTIONS); 5725 bind(target, POINTER_UP_EVENTS, onPointerUp, SCROLL_LISTENER_OPTIONS); 5726 Move.cancel(); 5727 Scroll.cancel(); 5728 save(e); 5729 } else { 5730 prevent(e, true); 5731 } 5732 } 5733 } 5734 } 5735 5736 function onPointerMove(e) { 5737 if (!state.is(DRAGGING)) { 5738 state.set(DRAGGING); 5739 emit(EVENT_DRAG); 5740 } 5741 5742 if (e.cancelable) { 5743 if (dragging) { 5744 Move.translate(basePosition + constrain(diffCoord(e))); 5745 var expired = diffTime(e) > LOG_INTERVAL; 5746 var hasExceeded = exceeded !== (exceeded = exceededLimit()); 5747 5748 if (expired || hasExceeded) { 5749 save(e); 5750 } 5751 5752 clickPrevented = true; 5753 emit(EVENT_DRAGGING); 5754 prevent(e); 5755 } else if (isSliderDirection(e)) { 5756 dragging = shouldStart(e); 5757 prevent(e); 5758 } 5759 } 5760 } 5761 5762 function onPointerUp(e) { 5763 if (state.is(DRAGGING)) { 5764 state.set(IDLE); 5765 emit(EVENT_DRAGGED); 5766 } 5767 5768 if (dragging) { 5769 move(e); 5770 prevent(e); 5771 } 5772 5773 unbind(target, POINTER_MOVE_EVENTS, onPointerMove); 5774 unbind(target, POINTER_UP_EVENTS, onPointerUp); 5775 dragging = false; 5776 } 5777 5778 function onClick(e) { 5779 if (!disabled && clickPrevented) { 5780 prevent(e, true); 5781 } 5782 } 5783 5784 function save(e) { 5785 prevBaseEvent = baseEvent; 5786 baseEvent = e; 5787 basePosition = getPosition(); 5788 } 5789 5790 function move(e) { 5791 var velocity = computeVelocity(e); 5792 var destination = computeDestination(velocity); 5793 var rewind = options.rewind && options.rewindByDrag; 5794 reduce(false); 5795 5796 if (isFree) { 5797 Controller.scroll(destination, 0, options.snap); 5798 } else if (Splide2.is(FADE)) { 5799 Controller.go(orient(sign(velocity)) < 0 ? rewind ? "<" : "-" : rewind ? ">" : "+"); 5800 } else if (Splide2.is(SLIDE) && exceeded && rewind) { 5801 Controller.go(exceededLimit(true) ? ">" : "<"); 5802 } else { 5803 Controller.go(Controller.toDest(destination), true); 5804 } 5805 5806 reduce(true); 5807 } 5808 5809 function shouldStart(e) { 5810 var thresholds = options.dragMinThreshold; 5811 var isObj = isObject(thresholds); 5812 var mouse = isObj && thresholds.mouse || 0; 5813 var touch = (isObj ? thresholds.touch : +thresholds) || 10; 5814 return abs(diffCoord(e)) > (isTouchEvent(e) ? touch : mouse); 5815 } 5816 5817 function isSliderDirection(e) { 5818 return abs(diffCoord(e)) > abs(diffCoord(e, true)); 5819 } 5820 5821 function computeVelocity(e) { 5822 if (Splide2.is(LOOP) || !exceeded) { 5823 var time = diffTime(e); 5824 5825 if (time && time < LOG_INTERVAL) { 5826 return diffCoord(e) / time; 5827 } 5828 } 5829 5830 return 0; 5831 } 5832 5833 function computeDestination(velocity) { 5834 return getPosition() + sign(velocity) * min(abs(velocity) * (options.flickPower || 600), isFree ? Infinity : Components2.Layout.listSize() * (options.flickMaxPages || 1)); 5835 } 5836 5837 function diffCoord(e, orthogonal) { 5838 return coordOf(e, orthogonal) - coordOf(getBaseEvent(e), orthogonal); 5839 } 5840 5841 function diffTime(e) { 5842 return timeOf(e) - timeOf(getBaseEvent(e)); 5843 } 5844 5845 function getBaseEvent(e) { 5846 return baseEvent === e && prevBaseEvent || baseEvent; 5847 } 5848 5849 function coordOf(e, orthogonal) { 5850 return (isTouchEvent(e) ? e.changedTouches[0] : e)["page" + resolve(orthogonal ? "Y" : "X")]; 5851 } 5852 5853 function constrain(diff) { 5854 return diff / (exceeded && Splide2.is(SLIDE) ? FRICTION : 1); 5855 } 5856 5857 function isDraggable(target2) { 5858 var noDrag = options.noDrag; 5859 return !matches(target2, "." + CLASS_PAGINATION_PAGE + ", ." + CLASS_ARROW) && (!noDrag || !matches(target2, noDrag)); 5860 } 5861 5862 function isTouchEvent(e) { 5863 return typeof TouchEvent !== "undefined" && e instanceof TouchEvent; 5864 } 5865 5866 function isDragging() { 5867 return dragging; 5868 } 5869 5870 function disable(value) { 5871 disabled = value; 5872 } 5873 5874 return { 5875 mount: mount, 5876 disable: disable, 5877 isDragging: isDragging 5878 }; 5879} 5880 5881var NORMALIZATION_MAP = { 5882 Spacebar: " ", 5883 Right: ARROW_RIGHT, 5884 Left: ARROW_LEFT, 5885 Up: ARROW_UP, 5886 Down: ARROW_DOWN 5887}; 5888 5889function normalizeKey(key) { 5890 key = isString(key) ? key : key.key; 5891 return NORMALIZATION_MAP[key] || key; 5892} 5893 5894var KEYBOARD_EVENT = "keydown"; 5895 5896function Keyboard(Splide2, Components2, options) { 5897 var _EventInterface10 = EventInterface(Splide2), 5898 on = _EventInterface10.on, 5899 bind = _EventInterface10.bind, 5900 unbind = _EventInterface10.unbind; 5901 5902 var root = Splide2.root; 5903 var resolve = Components2.Direction.resolve; 5904 var target; 5905 var disabled; 5906 5907 function mount() { 5908 init(); 5909 on(EVENT_UPDATED, destroy); 5910 on(EVENT_UPDATED, init); 5911 on(EVENT_MOVE, onMove); 5912 } 5913 5914 function init() { 5915 var keyboard = options.keyboard; 5916 5917 if (keyboard) { 5918 target = keyboard === "global" ? window : root; 5919 bind(target, KEYBOARD_EVENT, onKeydown); 5920 } 5921 } 5922 5923 function destroy() { 5924 unbind(target, KEYBOARD_EVENT); 5925 } 5926 5927 function disable(value) { 5928 disabled = value; 5929 } 5930 5931 function onMove() { 5932 var _disabled = disabled; 5933 disabled = true; 5934 nextTick(function () { 5935 disabled = _disabled; 5936 }); 5937 } 5938 5939 function onKeydown(e) { 5940 if (!disabled) { 5941 var key = normalizeKey(e); 5942 5943 if (key === resolve(ARROW_LEFT)) { 5944 Splide2.go("<"); 5945 } else if (key === resolve(ARROW_RIGHT)) { 5946 Splide2.go(">"); 5947 } 5948 } 5949 } 5950 5951 return { 5952 mount: mount, 5953 destroy: destroy, 5954 disable: disable 5955 }; 5956} 5957 5958var SRC_DATA_ATTRIBUTE = DATA_ATTRIBUTE + "-lazy"; 5959var SRCSET_DATA_ATTRIBUTE = SRC_DATA_ATTRIBUTE + "-srcset"; 5960var IMAGE_SELECTOR = "[" + SRC_DATA_ATTRIBUTE + "], [" + SRCSET_DATA_ATTRIBUTE + "]"; 5961 5962function LazyLoad(Splide2, Components2, options) { 5963 var _EventInterface11 = EventInterface(Splide2), 5964 on = _EventInterface11.on, 5965 off = _EventInterface11.off, 5966 bind = _EventInterface11.bind, 5967 emit = _EventInterface11.emit; 5968 5969 var isSequential = options.lazyLoad === "sequential"; 5970 var events = [EVENT_MOVED, EVENT_SCROLLED]; 5971 var entries = []; 5972 5973 function mount() { 5974 if (options.lazyLoad) { 5975 init(); 5976 on(EVENT_REFRESH, init); 5977 } 5978 } 5979 5980 function init() { 5981 empty(entries); 5982 register(); 5983 5984 if (isSequential) { 5985 loadNext(); 5986 } else { 5987 off(events); 5988 on(events, check); 5989 check(); 5990 } 5991 } 5992 5993 function register() { 5994 Components2.Slides.forEach(function (Slide) { 5995 queryAll(Slide.slide, IMAGE_SELECTOR).forEach(function (img) { 5996 var src = getAttribute(img, SRC_DATA_ATTRIBUTE); 5997 var srcset = getAttribute(img, SRCSET_DATA_ATTRIBUTE); 5998 5999 if (src !== img.src || srcset !== img.srcset) { 6000 var className = options.classes.spinner; 6001 var parent = img.parentElement; 6002 var spinner = child(parent, "." + className) || create("span", className, parent); 6003 entries.push([img, Slide, spinner]); 6004 img.src || display(img, "none"); 6005 } 6006 }); 6007 }); 6008 } 6009 6010 function check() { 6011 entries = entries.filter(function (data) { 6012 var distance = options.perPage * ((options.preloadPages || 1) + 1) - 1; 6013 return data[1].isWithin(Splide2.index, distance) ? load(data) : true; 6014 }); 6015 entries.length || off(events); 6016 } 6017 6018 function load(data) { 6019 var img = data[0]; 6020 addClass(data[1].slide, CLASS_LOADING); 6021 bind(img, "load error", apply(onLoad, data)); 6022 setAttribute(img, "src", getAttribute(img, SRC_DATA_ATTRIBUTE)); 6023 setAttribute(img, "srcset", getAttribute(img, SRCSET_DATA_ATTRIBUTE)); 6024 removeAttribute(img, SRC_DATA_ATTRIBUTE); 6025 removeAttribute(img, SRCSET_DATA_ATTRIBUTE); 6026 } 6027 6028 function onLoad(data, e) { 6029 var img = data[0], 6030 Slide = data[1]; 6031 removeClass(Slide.slide, CLASS_LOADING); 6032 6033 if (e.type !== "error") { 6034 remove(data[2]); 6035 display(img, ""); 6036 emit(EVENT_LAZYLOAD_LOADED, img, Slide); 6037 emit(EVENT_RESIZE); 6038 } 6039 6040 isSequential && loadNext(); 6041 } 6042 6043 function loadNext() { 6044 entries.length && load(entries.shift()); 6045 } 6046 6047 return { 6048 mount: mount, 6049 destroy: apply(empty, entries), 6050 check: check 6051 }; 6052} 6053 6054function Pagination(Splide2, Components2, options) { 6055 var event = EventInterface(Splide2); 6056 var on = event.on, 6057 emit = event.emit, 6058 bind = event.bind; 6059 var Slides = Components2.Slides, 6060 Elements = Components2.Elements, 6061 Controller = Components2.Controller; 6062 var hasFocus = Controller.hasFocus, 6063 getIndex = Controller.getIndex, 6064 go = Controller.go; 6065 var resolve = Components2.Direction.resolve; 6066 var placeholder = Elements.pagination; 6067 var items = []; 6068 var list; 6069 var paginationClasses; 6070 6071 function mount() { 6072 destroy(); 6073 on([EVENT_UPDATED, EVENT_REFRESH, EVENT_END_INDEX_CHANGED], mount); 6074 var enabled = options.pagination; 6075 placeholder && display(placeholder, enabled ? "" : "none"); 6076 6077 if (enabled) { 6078 on([EVENT_MOVE, EVENT_SCROLL, EVENT_SCROLLED], update); 6079 createPagination(); 6080 update(); 6081 emit(EVENT_PAGINATION_MOUNTED, { 6082 list: list, 6083 items: items 6084 }, getAt(Splide2.index)); 6085 } 6086 } 6087 6088 function destroy() { 6089 if (list) { 6090 remove(placeholder ? slice(list.children) : list); 6091 removeClass(list, paginationClasses); 6092 empty(items); 6093 list = null; 6094 } 6095 6096 event.destroy(); 6097 } 6098 6099 function createPagination() { 6100 var length = Splide2.length; 6101 var classes = options.classes, 6102 i18n = options.i18n, 6103 perPage = options.perPage; 6104 var max = hasFocus() ? Controller.getEnd() + 1 : ceil(length / perPage); 6105 list = placeholder || create("ul", classes.pagination, Elements.track.parentElement); 6106 addClass(list, paginationClasses = CLASS_PAGINATION + "--" + getDirection()); 6107 setAttribute(list, ROLE, "tablist"); 6108 setAttribute(list, ARIA_LABEL, i18n.select); 6109 setAttribute(list, ARIA_ORIENTATION, getDirection() === TTB ? "vertical" : ""); 6110 6111 for (var i = 0; i < max; i++) { 6112 var li = create("li", null, list); 6113 var button = create("button", { 6114 class: classes.page, 6115 type: "button" 6116 }, li); 6117 var controls = Slides.getIn(i).map(function (Slide) { 6118 return Slide.slide.id; 6119 }); 6120 var text = !hasFocus() && perPage > 1 ? i18n.pageX : i18n.slideX; 6121 bind(button, "click", apply(onClick, i)); 6122 6123 if (options.paginationKeyboard) { 6124 bind(button, "keydown", apply(onKeydown, i)); 6125 } 6126 6127 setAttribute(li, ROLE, "presentation"); 6128 setAttribute(button, ROLE, "tab"); 6129 setAttribute(button, ARIA_CONTROLS, controls.join(" ")); 6130 setAttribute(button, ARIA_LABEL, format(text, i + 1)); 6131 setAttribute(button, TAB_INDEX, -1); 6132 items.push({ 6133 li: li, 6134 button: button, 6135 page: i 6136 }); 6137 } 6138 } 6139 6140 function onClick(page) { 6141 go(">" + page, true); 6142 } 6143 6144 function onKeydown(page, e) { 6145 var length = items.length; 6146 var key = normalizeKey(e); 6147 var dir = getDirection(); 6148 var nextPage = -1; 6149 6150 if (key === resolve(ARROW_RIGHT, false, dir)) { 6151 nextPage = ++page % length; 6152 } else if (key === resolve(ARROW_LEFT, false, dir)) { 6153 nextPage = (--page + length) % length; 6154 } else if (key === "Home") { 6155 nextPage = 0; 6156 } else if (key === "End") { 6157 nextPage = length - 1; 6158 } 6159 6160 var item = items[nextPage]; 6161 6162 if (item) { 6163 focus(item.button); 6164 go(">" + nextPage); 6165 prevent(e, true); 6166 } 6167 } 6168 6169 function getDirection() { 6170 return options.paginationDirection || options.direction; 6171 } 6172 6173 function getAt(index) { 6174 return items[Controller.toPage(index)]; 6175 } 6176 6177 function update() { 6178 var prev = getAt(getIndex(true)); 6179 var curr = getAt(getIndex()); 6180 6181 if (prev) { 6182 var button = prev.button; 6183 removeClass(button, CLASS_ACTIVE); 6184 removeAttribute(button, ARIA_SELECTED); 6185 setAttribute(button, TAB_INDEX, -1); 6186 } 6187 6188 if (curr) { 6189 var _button = curr.button; 6190 addClass(_button, CLASS_ACTIVE); 6191 setAttribute(_button, ARIA_SELECTED, true); 6192 setAttribute(_button, TAB_INDEX, ""); 6193 } 6194 6195 emit(EVENT_PAGINATION_UPDATED, { 6196 list: list, 6197 items: items 6198 }, prev, curr); 6199 } 6200 6201 return { 6202 items: items, 6203 mount: mount, 6204 destroy: destroy, 6205 getAt: getAt, 6206 update: update 6207 }; 6208} 6209 6210var TRIGGER_KEYS = [" ", "Enter"]; 6211 6212function Sync(Splide2, Components2, options) { 6213 var isNavigation = options.isNavigation, 6214 slideFocus = options.slideFocus; 6215 var events = []; 6216 6217 function mount() { 6218 Splide2.splides.forEach(function (target) { 6219 if (!target.isParent) { 6220 sync(Splide2, target.splide); 6221 sync(target.splide, Splide2); 6222 } 6223 }); 6224 6225 if (isNavigation) { 6226 navigate(); 6227 } 6228 } 6229 6230 function destroy() { 6231 events.forEach(function (event) { 6232 event.destroy(); 6233 }); 6234 empty(events); 6235 } 6236 6237 function remount() { 6238 destroy(); 6239 mount(); 6240 } 6241 6242 function sync(splide, target) { 6243 var event = EventInterface(splide); 6244 event.on(EVENT_MOVE, function (index, prev, dest) { 6245 target.go(target.is(LOOP) ? dest : index); 6246 }); 6247 events.push(event); 6248 } 6249 6250 function navigate() { 6251 var event = EventInterface(Splide2); 6252 var on = event.on; 6253 on(EVENT_CLICK, onClick); 6254 on(EVENT_SLIDE_KEYDOWN, onKeydown); 6255 on([EVENT_MOUNTED, EVENT_UPDATED], update); 6256 events.push(event); 6257 event.emit(EVENT_NAVIGATION_MOUNTED, Splide2.splides); 6258 } 6259 6260 function update() { 6261 setAttribute(Components2.Elements.list, ARIA_ORIENTATION, options.direction === TTB ? "vertical" : ""); 6262 } 6263 6264 function onClick(Slide) { 6265 Splide2.go(Slide.index); 6266 } 6267 6268 function onKeydown(Slide, e) { 6269 if (includes(TRIGGER_KEYS, normalizeKey(e))) { 6270 onClick(Slide); 6271 prevent(e); 6272 } 6273 } 6274 6275 return { 6276 setup: apply(Components2.Media.set, { 6277 slideFocus: isUndefined(slideFocus) ? isNavigation : slideFocus 6278 }, true), 6279 mount: mount, 6280 destroy: destroy, 6281 remount: remount 6282 }; 6283} 6284 6285function Wheel(Splide2, Components2, options) { 6286 var _EventInterface12 = EventInterface(Splide2), 6287 bind = _EventInterface12.bind; 6288 6289 var lastTime = 0; 6290 6291 function mount() { 6292 if (options.wheel) { 6293 bind(Components2.Elements.track, "wheel", onWheel, SCROLL_LISTENER_OPTIONS); 6294 } 6295 } 6296 6297 function onWheel(e) { 6298 if (e.cancelable) { 6299 var deltaY = e.deltaY; 6300 var backwards = deltaY < 0; 6301 var timeStamp = timeOf(e); 6302 6303 var _min = options.wheelMinThreshold || 0; 6304 6305 var sleep = options.wheelSleep || 0; 6306 6307 if (abs(deltaY) > _min && timeStamp - lastTime > sleep) { 6308 Splide2.go(backwards ? "<" : ">"); 6309 lastTime = timeStamp; 6310 } 6311 6312 shouldPrevent(backwards) && prevent(e); 6313 } 6314 } 6315 6316 function shouldPrevent(backwards) { 6317 return !options.releaseWheel || Splide2.state.is(MOVING) || Components2.Controller.getAdjacent(backwards) !== -1; 6318 } 6319 6320 return { 6321 mount: mount 6322 }; 6323} 6324 6325var SR_REMOVAL_DELAY = 90; 6326 6327function Live(Splide2, Components2, options) { 6328 var _EventInterface13 = EventInterface(Splide2), 6329 on = _EventInterface13.on; 6330 6331 var track = Components2.Elements.track; 6332 var enabled = options.live && !options.isNavigation; 6333 var sr = create("span", CLASS_SR); 6334 var interval = RequestInterval(SR_REMOVAL_DELAY, apply(toggle, false)); 6335 6336 function mount() { 6337 if (enabled) { 6338 disable(!Components2.Autoplay.isPaused()); 6339 setAttribute(track, ARIA_ATOMIC, true); 6340 sr.textContent = "\u2026"; 6341 on(EVENT_AUTOPLAY_PLAY, apply(disable, true)); 6342 on(EVENT_AUTOPLAY_PAUSE, apply(disable, false)); 6343 on([EVENT_MOVED, EVENT_SCROLLED], apply(toggle, true)); 6344 } 6345 } 6346 6347 function toggle(active) { 6348 setAttribute(track, ARIA_BUSY, active); 6349 6350 if (active) { 6351 append(track, sr); 6352 interval.start(); 6353 } else { 6354 remove(sr); 6355 interval.cancel(); 6356 } 6357 } 6358 6359 function destroy() { 6360 removeAttribute(track, [ARIA_LIVE, ARIA_ATOMIC, ARIA_BUSY]); 6361 remove(sr); 6362 } 6363 6364 function disable(disabled) { 6365 if (enabled) { 6366 setAttribute(track, ARIA_LIVE, disabled ? "off" : "polite"); 6367 } 6368 } 6369 6370 return { 6371 mount: mount, 6372 disable: disable, 6373 destroy: destroy 6374 }; 6375} 6376 6377var ComponentConstructors = /*#__PURE__*/Object.freeze({ 6378 __proto__: null, 6379 Media: Media, 6380 Direction: Direction, 6381 Elements: Elements, 6382 Slides: Slides, 6383 Layout: Layout, 6384 Clones: Clones, 6385 Move: Move, 6386 Controller: Controller, 6387 Arrows: Arrows, 6388 Autoplay: Autoplay, 6389 Cover: Cover, 6390 Scroll: Scroll, 6391 Drag: Drag, 6392 Keyboard: Keyboard, 6393 LazyLoad: LazyLoad, 6394 Pagination: Pagination, 6395 Sync: Sync, 6396 Wheel: Wheel, 6397 Live: Live 6398}); 6399var I18N = { 6400 prev: "Previous slide", 6401 next: "Next slide", 6402 first: "Go to first slide", 6403 last: "Go to last slide", 6404 slideX: "Go to slide %s", 6405 pageX: "Go to page %s", 6406 play: "Start autoplay", 6407 pause: "Pause autoplay", 6408 carousel: "carousel", 6409 slide: "slide", 6410 select: "Select a slide to show", 6411 slideLabel: "%s of %s" 6412}; 6413var DEFAULTS = { 6414 type: "slide", 6415 role: "region", 6416 speed: 400, 6417 perPage: 1, 6418 cloneStatus: true, 6419 arrows: true, 6420 pagination: true, 6421 paginationKeyboard: true, 6422 interval: 5e3, 6423 pauseOnHover: true, 6424 pauseOnFocus: true, 6425 resetProgress: true, 6426 easing: "cubic-bezier(0.25, 1, 0.5, 1)", 6427 drag: true, 6428 direction: "ltr", 6429 trimSpace: true, 6430 focusableNodes: "a, button, textarea, input, select, iframe", 6431 live: true, 6432 classes: CLASSES, 6433 i18n: I18N, 6434 reducedMotion: { 6435 speed: 0, 6436 rewindSpeed: 0, 6437 autoplay: "pause" 6438 } 6439}; 6440 6441function Fade(Splide2, Components2, options) { 6442 var Slides = Components2.Slides; 6443 6444 function mount() { 6445 EventInterface(Splide2).on([EVENT_MOUNTED, EVENT_REFRESH], init); 6446 } 6447 6448 function init() { 6449 Slides.forEach(function (Slide) { 6450 Slide.style("transform", "translateX(-" + 100 * Slide.index + "%)"); 6451 }); 6452 } 6453 6454 function start(index, done) { 6455 Slides.style("transition", "opacity " + options.speed + "ms " + options.easing); 6456 nextTick(done); 6457 } 6458 6459 return { 6460 mount: mount, 6461 start: start, 6462 cancel: noop 6463 }; 6464} 6465 6466function Slide(Splide2, Components2, options) { 6467 var Move = Components2.Move, 6468 Controller = Components2.Controller, 6469 Scroll = Components2.Scroll; 6470 var list = Components2.Elements.list; 6471 var transition = apply(style, list, "transition"); 6472 var endCallback; 6473 6474 function mount() { 6475 EventInterface(Splide2).bind(list, "transitionend", function (e) { 6476 if (e.target === list && endCallback) { 6477 cancel(); 6478 endCallback(); 6479 } 6480 }); 6481 } 6482 6483 function start(index, done) { 6484 var destination = Move.toPosition(index, true); 6485 var position = Move.getPosition(); 6486 var speed = getSpeed(index); 6487 6488 if (abs(destination - position) >= 1 && speed >= 1) { 6489 if (options.useScroll) { 6490 Scroll.scroll(destination, speed, false, done); 6491 } else { 6492 transition("transform " + speed + "ms " + options.easing); 6493 Move.translate(destination, true); 6494 endCallback = done; 6495 } 6496 } else { 6497 Move.jump(index); 6498 done(); 6499 } 6500 } 6501 6502 function cancel() { 6503 transition(""); 6504 Scroll.cancel(); 6505 } 6506 6507 function getSpeed(index) { 6508 var rewindSpeed = options.rewindSpeed; 6509 6510 if (Splide2.is(SLIDE) && rewindSpeed) { 6511 var prev = Controller.getIndex(true); 6512 var end = Controller.getEnd(); 6513 6514 if (prev === 0 && index >= end || prev >= end && index === 0) { 6515 return rewindSpeed; 6516 } 6517 } 6518 6519 return options.speed; 6520 } 6521 6522 return { 6523 mount: mount, 6524 start: start, 6525 cancel: cancel 6526 }; 6527} 6528 6529var _Splide = /*#__PURE__*/function () { 6530 function _Splide(target, options) { 6531 this.event = EventInterface(); 6532 this.Components = {}; 6533 this.state = State(CREATED); 6534 this.splides = []; 6535 this._o = {}; 6536 this._E = {}; 6537 var root = isString(target) ? query(document, target) : target; 6538 assert(root, root + " is invalid."); 6539 this.root = root; 6540 options = merge({ 6541 label: getAttribute(root, ARIA_LABEL) || "", 6542 labelledby: getAttribute(root, ARIA_LABELLEDBY) || "" 6543 }, DEFAULTS, _Splide.defaults, options || {}); 6544 6545 try { 6546 merge(options, JSON.parse(getAttribute(root, DATA_ATTRIBUTE))); 6547 } catch (e) { 6548 assert(false, "Invalid JSON"); 6549 } 6550 6551 this._o = Object.create(merge({}, options)); 6552 } 6553 6554 var _proto = _Splide.prototype; 6555 6556 _proto.mount = function mount(Extensions, Transition) { 6557 var _this = this; 6558 6559 var state = this.state, 6560 Components2 = this.Components; 6561 assert(state.is([CREATED, DESTROYED]), "Already mounted!"); 6562 state.set(CREATED); 6563 this._C = Components2; 6564 this._T = Transition || this._T || (this.is(FADE) ? Fade : Slide); 6565 this._E = Extensions || this._E; 6566 var Constructors = assign({}, ComponentConstructors, this._E, { 6567 Transition: this._T 6568 }); 6569 forOwn(Constructors, function (Component, key) { 6570 var component = Component(_this, Components2, _this._o); 6571 Components2[key] = component; 6572 component.setup && component.setup(); 6573 }); 6574 forOwn(Components2, function (component) { 6575 component.mount && component.mount(); 6576 }); 6577 this.emit(EVENT_MOUNTED); 6578 addClass(this.root, CLASS_INITIALIZED); 6579 state.set(IDLE); 6580 this.emit(EVENT_READY); 6581 return this; 6582 }; 6583 6584 _proto.sync = function sync(splide) { 6585 this.splides.push({ 6586 splide: splide 6587 }); 6588 splide.splides.push({ 6589 splide: this, 6590 isParent: true 6591 }); 6592 6593 if (this.state.is(IDLE)) { 6594 this._C.Sync.remount(); 6595 6596 splide.Components.Sync.remount(); 6597 } 6598 6599 return this; 6600 }; 6601 6602 _proto.go = function go(control) { 6603 this._C.Controller.go(control); 6604 6605 return this; 6606 }; 6607 6608 _proto.on = function on(events, callback) { 6609 this.event.on(events, callback); 6610 return this; 6611 }; 6612 6613 _proto.off = function off(events) { 6614 this.event.off(events); 6615 return this; 6616 }; 6617 6618 _proto.emit = function emit(event) { 6619 var _this$event; 6620 6621 (_this$event = this.event).emit.apply(_this$event, [event].concat(slice(arguments, 1))); 6622 6623 return this; 6624 }; 6625 6626 _proto.add = function add(slides, index) { 6627 this._C.Slides.add(slides, index); 6628 6629 return this; 6630 }; 6631 6632 _proto.remove = function remove(matcher) { 6633 this._C.Slides.remove(matcher); 6634 6635 return this; 6636 }; 6637 6638 _proto.is = function is(type) { 6639 return this._o.type === type; 6640 }; 6641 6642 _proto.refresh = function refresh() { 6643 this.emit(EVENT_REFRESH); 6644 return this; 6645 }; 6646 6647 _proto.destroy = function destroy(completely) { 6648 if (completely === void 0) { 6649 completely = true; 6650 } 6651 6652 var event = this.event, 6653 state = this.state; 6654 6655 if (state.is(CREATED)) { 6656 EventInterface(this).on(EVENT_READY, this.destroy.bind(this, completely)); 6657 } else { 6658 forOwn(this._C, function (component) { 6659 component.destroy && component.destroy(completely); 6660 }, true); 6661 event.emit(EVENT_DESTROY); 6662 event.destroy(); 6663 completely && empty(this.splides); 6664 state.set(DESTROYED); 6665 } 6666 6667 return this; 6668 }; 6669 6670 _createClass(_Splide, [{ 6671 key: "options", 6672 get: function get() { 6673 return this._o; 6674 }, 6675 set: function set(options) { 6676 this._C.Media.set(options, true, true); 6677 } 6678 }, { 6679 key: "length", 6680 get: function get() { 6681 return this._C.Slides.getLength(true); 6682 } 6683 }, { 6684 key: "index", 6685 get: function get() { 6686 return this._C.Controller.getIndex(); 6687 } 6688 }]); 6689 6690 return _Splide; 6691}(); 6692 6693var Splide = _Splide; 6694Splide.defaults = {}; 6695Splide.STATES = STATES; 6696var CLASS_RENDERED = "is-rendered"; 6697var RENDERER_DEFAULT_CONFIG = { 6698 listTag: "ul", 6699 slideTag: "li" 6700}; 6701 6702var Style = /*#__PURE__*/function () { 6703 function Style(id, options) { 6704 this.styles = {}; 6705 this.id = id; 6706 this.options = options; 6707 } 6708 6709 var _proto2 = Style.prototype; 6710 6711 _proto2.rule = function rule(selector, prop, value, breakpoint) { 6712 breakpoint = breakpoint || "default"; 6713 var selectors = this.styles[breakpoint] = this.styles[breakpoint] || {}; 6714 var styles = selectors[selector] = selectors[selector] || {}; 6715 styles[prop] = value; 6716 }; 6717 6718 _proto2.build = function build() { 6719 var _this2 = this; 6720 6721 var css = ""; 6722 6723 if (this.styles.default) { 6724 css += this.buildSelectors(this.styles.default); 6725 } 6726 6727 Object.keys(this.styles).sort(function (n, m) { 6728 return _this2.options.mediaQuery === "min" ? +n - +m : +m - +n; 6729 }).forEach(function (breakpoint) { 6730 if (breakpoint !== "default") { 6731 css += "@media screen and (max-width: " + breakpoint + "px) {"; 6732 css += _this2.buildSelectors(_this2.styles[breakpoint]); 6733 css += "}"; 6734 } 6735 }); 6736 return css; 6737 }; 6738 6739 _proto2.buildSelectors = function buildSelectors(selectors) { 6740 var _this3 = this; 6741 6742 var css = ""; 6743 forOwn(selectors, function (styles, selector) { 6744 selector = ("#" + _this3.id + " " + selector).trim(); 6745 css += selector + " {"; 6746 forOwn(styles, function (value, prop) { 6747 if (value || value === 0) { 6748 css += prop + ": " + value + ";"; 6749 } 6750 }); 6751 css += "}"; 6752 }); 6753 return css; 6754 }; 6755 6756 return Style; 6757}(); 6758 6759var SplideRenderer = /*#__PURE__*/function () { 6760 function SplideRenderer(contents, options, config, defaults) { 6761 this.slides = []; 6762 this.options = {}; 6763 this.breakpoints = []; 6764 merge(DEFAULTS, defaults || {}); 6765 merge(merge(this.options, DEFAULTS), options || {}); 6766 this.contents = contents; 6767 this.config = assign({}, RENDERER_DEFAULT_CONFIG, config || {}); 6768 this.id = this.config.id || uniqueId("splide"); 6769 this.Style = new Style(this.id, this.options); 6770 this.Direction = Direction(null, null, this.options); 6771 assert(this.contents.length, "Provide at least 1 content."); 6772 this.init(); 6773 } 6774 6775 SplideRenderer.clean = function clean(splide) { 6776 var _EventInterface14 = EventInterface(splide), 6777 on = _EventInterface14.on; 6778 6779 var root = splide.root; 6780 var clones = queryAll(root, "." + CLASS_CLONE); 6781 on(EVENT_MOUNTED, function () { 6782 remove(child(root, "style")); 6783 }); 6784 remove(clones); 6785 }; 6786 6787 var _proto3 = SplideRenderer.prototype; 6788 6789 _proto3.init = function init() { 6790 this.parseBreakpoints(); 6791 this.initSlides(); 6792 this.registerRootStyles(); 6793 this.registerTrackStyles(); 6794 this.registerSlideStyles(); 6795 this.registerListStyles(); 6796 }; 6797 6798 _proto3.initSlides = function initSlides() { 6799 var _this4 = this; 6800 6801 push(this.slides, this.contents.map(function (content, index) { 6802 content = isString(content) ? { 6803 html: content 6804 } : content; 6805 content.styles = content.styles || {}; 6806 content.attrs = content.attrs || {}; 6807 6808 _this4.cover(content); 6809 6810 var classes = _this4.options.classes.slide + " " + (index === 0 ? CLASS_ACTIVE : ""); 6811 assign(content.attrs, { 6812 class: (classes + " " + (content.attrs.class || "")).trim(), 6813 style: _this4.buildStyles(content.styles) 6814 }); 6815 return content; 6816 })); 6817 6818 if (this.isLoop()) { 6819 this.generateClones(this.slides); 6820 } 6821 }; 6822 6823 _proto3.registerRootStyles = function registerRootStyles() { 6824 var _this5 = this; 6825 6826 this.breakpoints.forEach(function (_ref2) { 6827 var width = _ref2[0], 6828 options = _ref2[1]; 6829 6830 _this5.Style.rule(" ", "max-width", unit(options.width), width); 6831 }); 6832 }; 6833 6834 _proto3.registerTrackStyles = function registerTrackStyles() { 6835 var _this6 = this; 6836 6837 var Style2 = this.Style; 6838 var selector = "." + CLASS_TRACK; 6839 this.breakpoints.forEach(function (_ref3) { 6840 var width = _ref3[0], 6841 options = _ref3[1]; 6842 Style2.rule(selector, _this6.resolve("paddingLeft"), _this6.cssPadding(options, false), width); 6843 Style2.rule(selector, _this6.resolve("paddingRight"), _this6.cssPadding(options, true), width); 6844 Style2.rule(selector, "height", _this6.cssTrackHeight(options), width); 6845 }); 6846 }; 6847 6848 _proto3.registerListStyles = function registerListStyles() { 6849 var _this7 = this; 6850 6851 var Style2 = this.Style; 6852 var selector = "." + CLASS_LIST; 6853 this.breakpoints.forEach(function (_ref4) { 6854 var width = _ref4[0], 6855 options = _ref4[1]; 6856 Style2.rule(selector, "transform", _this7.buildTranslate(options), width); 6857 6858 if (!_this7.cssSlideHeight(options)) { 6859 Style2.rule(selector, "aspect-ratio", _this7.cssAspectRatio(options), width); 6860 } 6861 }); 6862 }; 6863 6864 _proto3.registerSlideStyles = function registerSlideStyles() { 6865 var _this8 = this; 6866 6867 var Style2 = this.Style; 6868 var selector = "." + CLASS_SLIDE; 6869 this.breakpoints.forEach(function (_ref5) { 6870 var width = _ref5[0], 6871 options = _ref5[1]; 6872 Style2.rule(selector, "width", _this8.cssSlideWidth(options), width); 6873 Style2.rule(selector, "height", _this8.cssSlideHeight(options) || "100%", width); 6874 Style2.rule(selector, _this8.resolve("marginRight"), unit(options.gap) || "0px", width); 6875 Style2.rule(selector + " > img", "display", options.cover ? "none" : "inline", width); 6876 }); 6877 }; 6878 6879 _proto3.buildTranslate = function buildTranslate(options) { 6880 var _this$Direction = this.Direction, 6881 resolve = _this$Direction.resolve, 6882 orient = _this$Direction.orient; 6883 var values = []; 6884 values.push(this.cssOffsetClones(options)); 6885 values.push(this.cssOffsetGaps(options)); 6886 6887 if (this.isCenter(options)) { 6888 values.push(this.buildCssValue(orient(-50), "%")); 6889 values.push.apply(values, this.cssOffsetCenter(options)); 6890 } 6891 6892 return values.filter(Boolean).map(function (value) { 6893 return "translate" + resolve("X") + "(" + value + ")"; 6894 }).join(" "); 6895 }; 6896 6897 _proto3.cssOffsetClones = function cssOffsetClones(options) { 6898 var _this$Direction2 = this.Direction, 6899 resolve = _this$Direction2.resolve, 6900 orient = _this$Direction2.orient; 6901 var cloneCount = this.getCloneCount(); 6902 6903 if (this.isFixedWidth(options)) { 6904 var _this$parseCssValue = this.parseCssValue(options[resolve("fixedWidth")]), 6905 value = _this$parseCssValue.value, 6906 unit2 = _this$parseCssValue.unit; 6907 6908 return this.buildCssValue(orient(value) * cloneCount, unit2); 6909 } 6910 6911 var percent = 100 * cloneCount / options.perPage; 6912 return orient(percent) + "%"; 6913 }; 6914 6915 _proto3.cssOffsetCenter = function cssOffsetCenter(options) { 6916 var _this$Direction3 = this.Direction, 6917 resolve = _this$Direction3.resolve, 6918 orient = _this$Direction3.orient; 6919 6920 if (this.isFixedWidth(options)) { 6921 var _this$parseCssValue2 = this.parseCssValue(options[resolve("fixedWidth")]), 6922 value = _this$parseCssValue2.value, 6923 unit2 = _this$parseCssValue2.unit; 6924 6925 return [this.buildCssValue(orient(value / 2), unit2)]; 6926 } 6927 6928 var values = []; 6929 var perPage = options.perPage, 6930 gap = options.gap; 6931 values.push(orient(50 / perPage) + "%"); 6932 6933 if (gap) { 6934 var _this$parseCssValue3 = this.parseCssValue(gap), 6935 _value = _this$parseCssValue3.value, 6936 _unit = _this$parseCssValue3.unit; 6937 6938 var gapOffset = (_value / perPage - _value) / 2; 6939 values.push(this.buildCssValue(orient(gapOffset), _unit)); 6940 } 6941 6942 return values; 6943 }; 6944 6945 _proto3.cssOffsetGaps = function cssOffsetGaps(options) { 6946 var cloneCount = this.getCloneCount(); 6947 6948 if (cloneCount && options.gap) { 6949 var orient = this.Direction.orient; 6950 6951 var _this$parseCssValue4 = this.parseCssValue(options.gap), 6952 value = _this$parseCssValue4.value, 6953 unit2 = _this$parseCssValue4.unit; 6954 6955 if (this.isFixedWidth(options)) { 6956 return this.buildCssValue(orient(value * cloneCount), unit2); 6957 } 6958 6959 var perPage = options.perPage; 6960 var gaps = cloneCount / perPage; 6961 return this.buildCssValue(orient(gaps * value), unit2); 6962 } 6963 6964 return ""; 6965 }; 6966 6967 _proto3.resolve = function resolve(prop) { 6968 return camelToKebab(this.Direction.resolve(prop)); 6969 }; 6970 6971 _proto3.cssPadding = function cssPadding(options, right) { 6972 var padding = options.padding; 6973 var prop = this.Direction.resolve(right ? "right" : "left", true); 6974 return padding && unit(padding[prop] || (isObject(padding) ? 0 : padding)) || "0px"; 6975 }; 6976 6977 _proto3.cssTrackHeight = function cssTrackHeight(options) { 6978 var height = ""; 6979 6980 if (this.isVertical()) { 6981 height = this.cssHeight(options); 6982 assert(height, '"height" is missing.'); 6983 height = "calc(" + height + " - " + this.cssPadding(options, false) + " - " + this.cssPadding(options, true) + ")"; 6984 } 6985 6986 return height; 6987 }; 6988 6989 _proto3.cssHeight = function cssHeight(options) { 6990 return unit(options.height); 6991 }; 6992 6993 _proto3.cssSlideWidth = function cssSlideWidth(options) { 6994 return options.autoWidth ? "" : unit(options.fixedWidth) || (this.isVertical() ? "" : this.cssSlideSize(options)); 6995 }; 6996 6997 _proto3.cssSlideHeight = function cssSlideHeight(options) { 6998 return unit(options.fixedHeight) || (this.isVertical() ? options.autoHeight ? "" : this.cssSlideSize(options) : this.cssHeight(options)); 6999 }; 7000 7001 _proto3.cssSlideSize = function cssSlideSize(options) { 7002 var gap = unit(options.gap); 7003 return "calc((100%" + (gap && " + " + gap) + ")/" + (options.perPage || 1) + (gap && " - " + gap) + ")"; 7004 }; 7005 7006 _proto3.cssAspectRatio = function cssAspectRatio(options) { 7007 var heightRatio = options.heightRatio; 7008 return heightRatio ? "" + 1 / heightRatio : ""; 7009 }; 7010 7011 _proto3.buildCssValue = function buildCssValue(value, unit2) { 7012 return "" + value + unit2; 7013 }; 7014 7015 _proto3.parseCssValue = function parseCssValue(value) { 7016 if (isString(value)) { 7017 var number = parseFloat(value) || 0; 7018 var unit2 = value.replace(/\d*(\.\d*)?/, "") || "px"; 7019 return { 7020 value: number, 7021 unit: unit2 7022 }; 7023 } 7024 7025 return { 7026 value: value, 7027 unit: "px" 7028 }; 7029 }; 7030 7031 _proto3.parseBreakpoints = function parseBreakpoints() { 7032 var _this9 = this; 7033 7034 var breakpoints = this.options.breakpoints; 7035 this.breakpoints.push(["default", this.options]); 7036 7037 if (breakpoints) { 7038 forOwn(breakpoints, function (options, width) { 7039 _this9.breakpoints.push([width, merge(merge({}, _this9.options), options)]); 7040 }); 7041 } 7042 }; 7043 7044 _proto3.isFixedWidth = function isFixedWidth(options) { 7045 return !!options[this.Direction.resolve("fixedWidth")]; 7046 }; 7047 7048 _proto3.isLoop = function isLoop() { 7049 return this.options.type === LOOP; 7050 }; 7051 7052 _proto3.isCenter = function isCenter(options) { 7053 if (options.focus === "center") { 7054 if (this.isLoop()) { 7055 return true; 7056 } 7057 7058 if (this.options.type === SLIDE) { 7059 return !this.options.trimSpace; 7060 } 7061 } 7062 7063 return false; 7064 }; 7065 7066 _proto3.isVertical = function isVertical() { 7067 return this.options.direction === TTB; 7068 }; 7069 7070 _proto3.buildClasses = function buildClasses() { 7071 var options = this.options; 7072 return [CLASS_ROOT, CLASS_ROOT + "--" + options.type, CLASS_ROOT + "--" + options.direction, options.drag && CLASS_ROOT + "--draggable", options.isNavigation && CLASS_ROOT + "--nav", CLASS_ACTIVE, !this.config.hidden && CLASS_RENDERED].filter(Boolean).join(" "); 7073 }; 7074 7075 _proto3.buildAttrs = function buildAttrs(attrs) { 7076 var attr = ""; 7077 forOwn(attrs, function (value, key) { 7078 attr += value ? " " + camelToKebab(key) + "=\"" + value + "\"" : ""; 7079 }); 7080 return attr.trim(); 7081 }; 7082 7083 _proto3.buildStyles = function buildStyles(styles) { 7084 var style = ""; 7085 forOwn(styles, function (value, key) { 7086 style += " " + camelToKebab(key) + ":" + value + ";"; 7087 }); 7088 return style.trim(); 7089 }; 7090 7091 _proto3.renderSlides = function renderSlides() { 7092 var _this10 = this; 7093 7094 var tag = this.config.slideTag; 7095 return this.slides.map(function (content) { 7096 return "<" + tag + " " + _this10.buildAttrs(content.attrs) + ">" + (content.html || "") + "</" + tag + ">"; 7097 }).join(""); 7098 }; 7099 7100 _proto3.cover = function cover(content) { 7101 var styles = content.styles, 7102 _content$html = content.html, 7103 html = _content$html === void 0 ? "" : _content$html; 7104 7105 if (this.options.cover && !this.options.lazyLoad) { 7106 var src = html.match(/<img.*?src\s*=\s*(['"])(.+?)\1.*?>/); 7107 7108 if (src && src[2]) { 7109 styles.background = "center/cover no-repeat url('" + src[2] + "')"; 7110 } 7111 } 7112 }; 7113 7114 _proto3.generateClones = function generateClones(contents) { 7115 var classes = this.options.classes; 7116 var count = this.getCloneCount(); 7117 var slides = contents.slice(); 7118 7119 while (slides.length < count) { 7120 push(slides, slides); 7121 } 7122 7123 push(slides.slice(-count).reverse(), slides.slice(0, count)).forEach(function (content, index) { 7124 var attrs = assign({}, content.attrs, { 7125 class: content.attrs.class + " " + classes.clone 7126 }); 7127 var clone = assign({}, content, { 7128 attrs: attrs 7129 }); 7130 index < count ? contents.unshift(clone) : contents.push(clone); 7131 }); 7132 }; 7133 7134 _proto3.getCloneCount = function getCloneCount() { 7135 if (this.isLoop()) { 7136 var options = this.options; 7137 7138 if (options.clones) { 7139 return options.clones; 7140 } 7141 7142 var perPage = max.apply(void 0, this.breakpoints.map(function (_ref6) { 7143 var options2 = _ref6[1]; 7144 return options2.perPage; 7145 })); 7146 return perPage * ((options.flickMaxPages || 1) + 1); 7147 } 7148 7149 return 0; 7150 }; 7151 7152 _proto3.renderArrows = function renderArrows() { 7153 var html = ""; 7154 html += "<div class=\"" + this.options.classes.arrows + "\">"; 7155 html += this.renderArrow(true); 7156 html += this.renderArrow(false); 7157 html += "</div>"; 7158 return html; 7159 }; 7160 7161 _proto3.renderArrow = function renderArrow(prev) { 7162 var _this$options = this.options, 7163 classes = _this$options.classes, 7164 i18n = _this$options.i18n; 7165 var attrs = { 7166 class: classes.arrow + " " + (prev ? classes.prev : classes.next), 7167 type: "button", 7168 ariaLabel: prev ? i18n.prev : i18n.next 7169 }; 7170 return "<button " + this.buildAttrs(attrs) + "><svg xmlns=\"" + XML_NAME_SPACE + "\" viewBox=\"0 0 " + SIZE + " " + SIZE + "\" width=\"" + SIZE + "\" height=\"" + SIZE + "\"><path d=\"" + (this.options.arrowPath || PATH) + "\" /></svg></button>"; 7171 }; 7172 7173 _proto3.html = function html() { 7174 var _this$config = this.config, 7175 rootClass = _this$config.rootClass, 7176 listTag = _this$config.listTag, 7177 arrows = _this$config.arrows, 7178 beforeTrack = _this$config.beforeTrack, 7179 afterTrack = _this$config.afterTrack, 7180 slider = _this$config.slider, 7181 beforeSlider = _this$config.beforeSlider, 7182 afterSlider = _this$config.afterSlider; 7183 var html = ""; 7184 html += "<div id=\"" + this.id + "\" class=\"" + this.buildClasses() + " " + (rootClass || "") + "\">"; 7185 html += "<style>" + this.Style.build() + "</style>"; 7186 7187 if (slider) { 7188 html += beforeSlider || ""; 7189 html += "<div class=\"splide__slider\">"; 7190 } 7191 7192 html += beforeTrack || ""; 7193 7194 if (arrows) { 7195 html += this.renderArrows(); 7196 } 7197 7198 html += "<div class=\"splide__track\">"; 7199 html += "<" + listTag + " class=\"splide__list\">"; 7200 html += this.renderSlides(); 7201 html += "</" + listTag + ">"; 7202 html += "</div>"; 7203 html += afterTrack || ""; 7204 7205 if (slider) { 7206 html += "</div>"; 7207 html += afterSlider || ""; 7208 } 7209 7210 html += "</div>"; 7211 return html; 7212 }; 7213 7214 return SplideRenderer; 7215}(); 7216 7217exports.CLASSES = CLASSES; 7218exports.CLASS_ACTIVE = CLASS_ACTIVE; 7219exports.CLASS_ARROW = CLASS_ARROW; 7220exports.CLASS_ARROWS = CLASS_ARROWS; 7221exports.CLASS_ARROW_NEXT = CLASS_ARROW_NEXT; 7222exports.CLASS_ARROW_PREV = CLASS_ARROW_PREV; 7223exports.CLASS_CLONE = CLASS_CLONE; 7224exports.CLASS_CONTAINER = CLASS_CONTAINER; 7225exports.CLASS_FOCUS_IN = CLASS_FOCUS_IN; 7226exports.CLASS_INITIALIZED = CLASS_INITIALIZED; 7227exports.CLASS_LIST = CLASS_LIST; 7228exports.CLASS_LOADING = CLASS_LOADING; 7229exports.CLASS_NEXT = CLASS_NEXT; 7230exports.CLASS_OVERFLOW = CLASS_OVERFLOW; 7231exports.CLASS_PAGINATION = CLASS_PAGINATION; 7232exports.CLASS_PAGINATION_PAGE = CLASS_PAGINATION_PAGE; 7233exports.CLASS_PREV = CLASS_PREV; 7234exports.CLASS_PROGRESS = CLASS_PROGRESS; 7235exports.CLASS_PROGRESS_BAR = CLASS_PROGRESS_BAR; 7236exports.CLASS_ROOT = CLASS_ROOT; 7237exports.CLASS_SLIDE = CLASS_SLIDE; 7238exports.CLASS_SPINNER = CLASS_SPINNER; 7239exports.CLASS_SR = CLASS_SR; 7240exports.CLASS_TOGGLE = CLASS_TOGGLE; 7241exports.CLASS_TOGGLE_PAUSE = CLASS_TOGGLE_PAUSE; 7242exports.CLASS_TOGGLE_PLAY = CLASS_TOGGLE_PLAY; 7243exports.CLASS_TRACK = CLASS_TRACK; 7244exports.CLASS_VISIBLE = CLASS_VISIBLE; 7245exports.DEFAULTS = DEFAULTS; 7246exports.EVENT_ACTIVE = EVENT_ACTIVE; 7247exports.EVENT_ARROWS_MOUNTED = EVENT_ARROWS_MOUNTED; 7248exports.EVENT_ARROWS_UPDATED = EVENT_ARROWS_UPDATED; 7249exports.EVENT_AUTOPLAY_PAUSE = EVENT_AUTOPLAY_PAUSE; 7250exports.EVENT_AUTOPLAY_PLAY = EVENT_AUTOPLAY_PLAY; 7251exports.EVENT_AUTOPLAY_PLAYING = EVENT_AUTOPLAY_PLAYING; 7252exports.EVENT_CLICK = EVENT_CLICK; 7253exports.EVENT_DESTROY = EVENT_DESTROY; 7254exports.EVENT_DRAG = EVENT_DRAG; 7255exports.EVENT_DRAGGED = EVENT_DRAGGED; 7256exports.EVENT_DRAGGING = EVENT_DRAGGING; 7257exports.EVENT_END_INDEX_CHANGED = EVENT_END_INDEX_CHANGED; 7258exports.EVENT_HIDDEN = EVENT_HIDDEN; 7259exports.EVENT_INACTIVE = EVENT_INACTIVE; 7260exports.EVENT_LAZYLOAD_LOADED = EVENT_LAZYLOAD_LOADED; 7261exports.EVENT_MOUNTED = EVENT_MOUNTED; 7262exports.EVENT_MOVE = EVENT_MOVE; 7263exports.EVENT_MOVED = EVENT_MOVED; 7264exports.EVENT_NAVIGATION_MOUNTED = EVENT_NAVIGATION_MOUNTED; 7265exports.EVENT_OVERFLOW = EVENT_OVERFLOW; 7266exports.EVENT_PAGINATION_MOUNTED = EVENT_PAGINATION_MOUNTED; 7267exports.EVENT_PAGINATION_UPDATED = EVENT_PAGINATION_UPDATED; 7268exports.EVENT_READY = EVENT_READY; 7269exports.EVENT_REFRESH = EVENT_REFRESH; 7270exports.EVENT_RESIZE = EVENT_RESIZE; 7271exports.EVENT_RESIZED = EVENT_RESIZED; 7272exports.EVENT_SCROLL = EVENT_SCROLL; 7273exports.EVENT_SCROLLED = EVENT_SCROLLED; 7274exports.EVENT_SHIFTED = EVENT_SHIFTED; 7275exports.EVENT_SLIDE_KEYDOWN = EVENT_SLIDE_KEYDOWN; 7276exports.EVENT_UPDATED = EVENT_UPDATED; 7277exports.EVENT_VISIBLE = EVENT_VISIBLE; 7278exports.EventBinder = EventBinder; 7279exports.EventInterface = EventInterface; 7280exports.FADE = FADE; 7281exports.LOOP = LOOP; 7282exports.LTR = LTR; 7283exports.RTL = RTL; 7284exports.RequestInterval = RequestInterval; 7285exports.SLIDE = SLIDE; 7286exports.STATUS_CLASSES = STATUS_CLASSES; 7287exports.Splide = Splide; 7288exports.SplideRenderer = SplideRenderer; 7289exports.State = State; 7290exports.TTB = TTB; 7291exports.Throttle = Throttle; 7292exports["default"] = Splide; 7293 7294 7295/***/ }, 7296 7297/***/ "./node_modules/@vimeo/player/dist/player.es.js" 7298/*!******************************************************!*\ 7299 !*** ./node_modules/@vimeo/player/dist/player.es.js ***! 7300 \******************************************************/ 7301(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 7302 7303"use strict"; 7304__webpack_require__.r(__webpack_exports__); 7305/* harmony export */ __webpack_require__.d(__webpack_exports__, { 7306/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__) 7307/* harmony export */ }); 7308/* provided dependency */ var Promise = __webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js"); 7309/*! @vimeo/player v2.29.2 | (c) 2025 Vimeo | MIT License | https://github.com/vimeo/player.js */ 7310function _iterableToArrayLimit(arr, i) { 7311 var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; 7312 if (null != _i) { 7313 var _s, 7314 _e, 7315 _x, 7316 _r, 7317 _arr = [], 7318 _n = !0, 7319 _d = !1; 7320 try {
vendor: 5,090 bytes, lines 7321-7456
7321 if (_x = (_i = _i.call(arr)).next, 0 === i) { 7322 if (Object(_i) !== _i) return; 7323 _n = !1; 7324 } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); 7325 } catch (err) { 7326 _d = !0, _e = err; 7327 } finally { 7328 try { 7329 if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; 7330 } finally { 7331 if (_d) throw _e; 7332 } 7333 } 7334 return _arr; 7335 } 7336} 7337function ownKeys(object, enumerableOnly) { 7338 var keys = Object.keys(object); 7339 if (Object.getOwnPropertySymbols) { 7340 var symbols = Object.getOwnPropertySymbols(object); 7341 enumerableOnly && (symbols = symbols.filter(function (sym) { 7342 return Object.getOwnPropertyDescriptor(object, sym).enumerable; 7343 })), keys.push.apply(keys, symbols); 7344 } 7345 return keys; 7346} 7347function _objectSpread2(target) { 7348 for (var i = 1; i < arguments.length; i++) { 7349 var source = null != arguments[i] ? arguments[i] : {}; 7350 i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { 7351 _defineProperty(target, key, source[key]); 7352 }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { 7353 Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); 7354 }); 7355 } 7356 return target; 7357} 7358function _regeneratorRuntime() { 7359 _regeneratorRuntime = function () { 7360 return exports; 7361 }; 7362 var exports = {}, 7363 Op = Object.prototype, 7364 hasOwn = Op.hasOwnProperty, 7365 defineProperty = Object.defineProperty || function (obj, key, desc) { 7366 obj[key] = desc.value; 7367 }, 7368 $Symbol = "function" == typeof Symbol ? Symbol : {}, 7369 iteratorSymbol = $Symbol.iterator || "@@iterator", 7370 asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", 7371 toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; 7372 function define(obj, key, value) { 7373 return Object.defineProperty(obj, key, { 7374 value: value, 7375 enumerable: !0, 7376 configurable: !0, 7377 writable: !0 7378 }), obj[key]; 7379 } 7380 try { 7381 define({}, ""); 7382 } catch (err) { 7383 define = function (obj, key, value) { 7384 return obj[key] = value; 7385 }; 7386 } 7387 function wrap(innerFn, outerFn, self, tryLocsList) { 7388 var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, 7389 generator = Object.create(protoGenerator.prototype), 7390 context = new Context(tryLocsList || []); 7391 return defineProperty(generator, "_invoke", { 7392 value: makeInvokeMethod(innerFn, self, context) 7393 }), generator; 7394 } 7395 function tryCatch(fn, obj, arg) { 7396 try { 7397 return { 7398 type: "normal", 7399 arg: fn.call(obj, arg) 7400 }; 7401 } catch (err) { 7402 return { 7403 type: "throw", 7404 arg: err 7405 }; 7406 } 7407 } 7408 exports.wrap = wrap; 7409 var ContinueSentinel = {}; 7410 function Generator() {} 7411 function GeneratorFunction() {} 7412 function GeneratorFunctionPrototype() {} 7413 var IteratorPrototype = {}; 7414 define(IteratorPrototype, iteratorSymbol, function () { 7415 return this; 7416 }); 7417 var getProto = Object.getPrototypeOf, 7418 NativeIteratorPrototype = getProto && getProto(getProto(values([]))); 7419 NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); 7420 var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); 7421 function defineIteratorMethods(prototype) { 7422 ["next", "throw", "return"].forEach(function (method) { 7423 define(prototype, method, function (arg) { 7424 return this._invoke(method, arg); 7425 }); 7426 }); 7427 } 7428 function AsyncIterator(generator, PromiseImpl) { 7429 function invoke(method, arg, resolve, reject) { 7430 var record = tryCatch(generator[method], generator, arg); 7431 if ("throw" !== record.type) { 7432 var result = record.arg, 7433 value = result.value; 7434 return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { 7435 invoke("next", value, resolve, reject); 7436 }, function (err) { 7437 invoke("throw", err, resolve, reject); 7438 }) : PromiseImpl.resolve(value).then(function (unwrapped) { 7439 result.value = unwrapped, resolve(result); 7440 }, function (error) { 7441 return invoke("throw", error, resolve, reject); 7442 }); 7443 } 7444 reject(record.arg); 7445 } 7446 var previousPromise; 7447 defineProperty(this, "_invoke", { 7448 value: function (method, arg) { 7449 function callInvokeWithMethodAndArg() { 7450 return new PromiseImpl(function (resolve, reject) { 7451 invoke(method, arg, resolve, reject); 7452 }); 7453 } 7454 return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); 7455 } 7456 });
vendor: 10,458 bytes, lines 7457-7670
7457 } 7458 function makeInvokeMethod(innerFn, self, context) { 7459 var state = "suspendedStart"; 7460 return function (method, arg) { 7461 if ("executing" === state) throw new Error("Generator is already running"); 7462 if ("completed" === state) { 7463 if ("throw" === method) throw arg; 7464 return doneResult(); 7465 } 7466 for (context.method = method, context.arg = arg;;) { 7467 var delegate = context.delegate; 7468 if (delegate) { 7469 var delegateResult = maybeInvokeDelegate(delegate, context); 7470 if (delegateResult) { 7471 if (delegateResult === ContinueSentinel) continue; 7472 return delegateResult; 7473 } 7474 } 7475 if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { 7476 if ("suspendedStart" === state) throw state = "completed", context.arg; 7477 context.dispatchException(context.arg); 7478 } else "return" === context.method && context.abrupt("return", context.arg); 7479 state = "executing"; 7480 var record = tryCatch(innerFn, self, context); 7481 if ("normal" === record.type) { 7482 if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; 7483 return { 7484 value: record.arg, 7485 done: context.done 7486 }; 7487 } 7488 "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); 7489 } 7490 }; 7491 } 7492 function maybeInvokeDelegate(delegate, context) { 7493 var methodName = context.method, 7494 method = delegate.iterator[methodName]; 7495 if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; 7496 var record = tryCatch(method, delegate.iterator, context.arg); 7497 if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; 7498 var info = record.arg; 7499 return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); 7500 } 7501 function pushTryEntry(locs) { 7502 var entry = { 7503 tryLoc: locs[0] 7504 }; 7505 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); 7506 } 7507 function resetTryEntry(entry) { 7508 var record = entry.completion || {}; 7509 record.type = "normal", delete record.arg, entry.completion = record; 7510 } 7511 function Context(tryLocsList) { 7512 this.tryEntries = [{ 7513 tryLoc: "root" 7514 }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); 7515 } 7516 function values(iterable) { 7517 if (iterable) { 7518 var iteratorMethod = iterable[iteratorSymbol]; 7519 if (iteratorMethod) return iteratorMethod.call(iterable); 7520 if ("function" == typeof iterable.next) return iterable; 7521 if (!isNaN(iterable.length)) { 7522 var i = -1, 7523 next = function next() { 7524 for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; 7525 return next.value = undefined, next.done = !0, next; 7526 }; 7527 return next.next = next; 7528 } 7529 } 7530 return { 7531 next: doneResult 7532 }; 7533 } 7534 function doneResult() { 7535 return { 7536 value: undefined, 7537 done: !0 7538 }; 7539 } 7540 return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { 7541 value: GeneratorFunctionPrototype, 7542 configurable: !0 7543 }), defineProperty(GeneratorFunctionPrototype, "constructor", { 7544 value: GeneratorFunction, 7545 configurable: !0 7546 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { 7547 var ctor = "function" == typeof genFun && genFun.constructor; 7548 return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); 7549 }, exports.mark = function (genFun) { 7550 return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; 7551 }, exports.awrap = function (arg) { 7552 return { 7553 __await: arg 7554 }; 7555 }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { 7556 return this; 7557 }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { 7558 void 0 === PromiseImpl && (PromiseImpl = Promise); 7559 var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); 7560 return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { 7561 return result.done ? result.value : iter.next(); 7562 }); 7563 }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { 7564 return this; 7565 }), define(Gp, "toString", function () { 7566 return "[object Generator]"; 7567 }), exports.keys = function (val) { 7568 var object = Object(val), 7569 keys = []; 7570 for (var key in object) keys.push(key); 7571 return keys.reverse(), function next() { 7572 for (; keys.length;) { 7573 var key = keys.pop(); 7574 if (key in object) return next.value = key, next.done = !1, next; 7575 } 7576 return next.done = !0, next; 7577 }; 7578 }, exports.values = values, Context.prototype = { 7579 constructor: Context, 7580 reset: function (skipTempReset) { 7581 if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); 7582 }, 7583 stop: function () { 7584 this.done = !0; 7585 var rootRecord = this.tryEntries[0].completion; 7586 if ("throw" === rootRecord.type) throw rootRecord.arg; 7587 return this.rval; 7588 }, 7589 dispatchException: function (exception) { 7590 if (this.done) throw exception; 7591 var context = this; 7592 function handle(loc, caught) { 7593 return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; 7594 } 7595 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 7596 var entry = this.tryEntries[i], 7597 record = entry.completion; 7598 if ("root" === entry.tryLoc) return handle("end"); 7599 if (entry.tryLoc <= this.prev) { 7600 var hasCatch = hasOwn.call(entry, "catchLoc"), 7601 hasFinally = hasOwn.call(entry, "finallyLoc"); 7602 if (hasCatch && hasFinally) { 7603 if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); 7604 if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); 7605 } else if (hasCatch) { 7606 if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); 7607 } else { 7608 if (!hasFinally) throw new Error("try statement without catch or finally"); 7609 if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); 7610 } 7611 } 7612 } 7613 }, 7614 abrupt: function (type, arg) { 7615 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 7616 var entry = this.tryEntries[i]; 7617 if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { 7618 var finallyEntry = entry; 7619 break; 7620 } 7621 } 7622 finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); 7623 var record = finallyEntry ? finallyEntry.completion : {}; 7624 return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); 7625 }, 7626 complete: function (record, afterLoc) { 7627 if ("throw" === record.type) throw record.arg; 7628 return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; 7629 }, 7630 finish: function (finallyLoc) { 7631 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 7632 var entry = this.tryEntries[i]; 7633 if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; 7634 } 7635 }, 7636 catch: function (tryLoc) { 7637 for (var i = this.tryEntries.length - 1; i >= 0; --i) { 7638 var entry = this.tryEntries[i]; 7639 if (entry.tryLoc === tryLoc) { 7640 var record = entry.completion; 7641 if ("throw" === record.type) { 7642 var thrown = record.arg; 7643 resetTryEntry(entry); 7644 } 7645 return thrown; 7646 } 7647 } 7648 throw new Error("illegal catch attempt"); 7649 }, 7650 delegateYield: function (iterable, resultName, nextLoc) { 7651 return this.delegate = { 7652 iterator: values(iterable), 7653 resultName: resultName, 7654 nextLoc: nextLoc 7655 }, "next" === this.method && (this.arg = undefined), ContinueSentinel; 7656 } 7657 }, exports; 7658} 7659function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { 7660 try { 7661 var info = gen[key](arg); 7662 var value = info.value; 7663 } catch (error) { 7664 reject(error); 7665 return; 7666 } 7667 if (info.done) { 7668 resolve(value); 7669 } else { 7670 Promise.resolve(value).then(_next, _throw);
vendor: 4,377 bytes, lines 7671-7804
7671 } 7672} 7673function _asyncToGenerator(fn) { 7674 return function () { 7675 var self = this, 7676 args = arguments; 7677 return new Promise(function (resolve, reject) { 7678 var gen = fn.apply(self, args); 7679 function _next(value) { 7680 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); 7681 } 7682 function _throw(err) { 7683 asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); 7684 } 7685 _next(undefined); 7686 }); 7687 }; 7688} 7689function _classCallCheck(instance, Constructor) { 7690 if (!(instance instanceof Constructor)) { 7691 throw new TypeError("Cannot call a class as a function"); 7692 } 7693} 7694function _defineProperties(target, props) { 7695 for (var i = 0; i < props.length; i++) { 7696 var descriptor = props[i]; 7697 descriptor.enumerable = descriptor.enumerable || false; 7698 descriptor.configurable = true; 7699 if ("value" in descriptor) descriptor.writable = true; 7700 Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); 7701 } 7702} 7703function _createClass(Constructor, protoProps, staticProps) { 7704 if (protoProps) _defineProperties(Constructor.prototype, protoProps); 7705 if (staticProps) _defineProperties(Constructor, staticProps); 7706 Object.defineProperty(Constructor, "prototype", { 7707 writable: false 7708 }); 7709 return Constructor; 7710} 7711function _defineProperty(obj, key, value) { 7712 key = _toPropertyKey(key); 7713 if (key in obj) { 7714 Object.defineProperty(obj, key, { 7715 value: value, 7716 enumerable: true, 7717 configurable: true, 7718 writable: true 7719 }); 7720 } else { 7721 obj[key] = value; 7722 } 7723 return obj; 7724} 7725function _inherits(subClass, superClass) { 7726 if (typeof superClass !== "function" && superClass !== null) { 7727 throw new TypeError("Super expression must either be null or a function"); 7728 } 7729 subClass.prototype = Object.create(superClass && superClass.prototype, { 7730 constructor: { 7731 value: subClass, 7732 writable: true, 7733 configurable: true 7734 } 7735 }); 7736 Object.defineProperty(subClass, "prototype", { 7737 writable: false 7738 }); 7739 if (superClass) _setPrototypeOf(subClass, superClass); 7740} 7741function _getPrototypeOf(o) { 7742 _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { 7743 return o.__proto__ || Object.getPrototypeOf(o); 7744 }; 7745 return _getPrototypeOf(o); 7746} 7747function _setPrototypeOf(o, p) { 7748 _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { 7749 o.__proto__ = p; 7750 return o; 7751 }; 7752 return _setPrototypeOf(o, p); 7753} 7754function _isNativeReflectConstruct() { 7755 if (typeof Reflect === "undefined" || !Reflect.construct) return false; 7756 if (Reflect.construct.sham) return false; 7757 if (typeof Proxy === "function") return true; 7758 try { 7759 Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); 7760 return true; 7761 } catch (e) { 7762 return false; 7763 } 7764} 7765function _construct(Parent, args, Class) { 7766 if (_isNativeReflectConstruct()) { 7767 _construct = Reflect.construct.bind(); 7768 } else { 7769 _construct = function _construct(Parent, args, Class) { 7770 var a = [null]; 7771 a.push.apply(a, args); 7772 var Constructor = Function.bind.apply(Parent, a); 7773 var instance = new Constructor(); 7774 if (Class) _setPrototypeOf(instance, Class.prototype); 7775 return instance; 7776 }; 7777 } 7778 return _construct.apply(null, arguments); 7779} 7780function _isNativeFunction(fn) { 7781 return Function.toString.call(fn).indexOf("[native code]") !== -1; 7782} 7783function _wrapNativeSuper(Class) { 7784 var _cache = typeof Map === "function" ? new Map() : undefined; 7785 _wrapNativeSuper = function _wrapNativeSuper(Class) { 7786 if (Class === null || !_isNativeFunction(Class)) return Class; 7787 if (typeof Class !== "function") { 7788 throw new TypeError("Super expression must either be null or a function"); 7789 } 7790 if (typeof _cache !== "undefined") { 7791 if (_cache.has(Class)) return _cache.get(Class); 7792 _cache.set(Class, Wrapper); 7793 } 7794 function Wrapper() { 7795 return _construct(Class, arguments, _getPrototypeOf(this).constructor); 7796 } 7797 Wrapper.prototype = Object.create(Class.prototype, { 7798 constructor: { 7799 value: Wrapper, 7800 enumerable: false, 7801 writable: true, 7802 configurable: true 7803 } 7804 });
7805 return _setPrototypeOf(Wrapper, Class); 7806 }; 7807 return _wrapNativeSuper(Class); 7808} 7809function _assertThisInitialized(self) { 7810 if (self === void 0) { 7811 throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); 7812 } 7813 return self; 7814} 7815function _possibleConstructorReturn(self, call) { 7816 if (call && (typeof call === "object" || typeof call === "function")) { 7817 return call; 7818 } else if (call !== void 0) { 7819 throw new TypeError("Derived constructors may only return object or undefined"); 7820 } 7821 return _assertThisInitialized(self); 7822} 7823function _createSuper(Derived) { 7824 var hasNativeReflectConstruct = _isNativeReflectConstruct(); 7825 return function _createSuperInternal() { 7826 var Super = _getPrototypeOf(Derived), 7827 result; 7828 if (hasNativeReflectConstruct) { 7829 var NewTarget = _getPrototypeOf(this).constructor; 7830 result = Reflect.construct(Super, arguments, NewTarget); 7831 } else { 7832 result = Super.apply(this, arguments); 7833 } 7834 return _possibleConstructorReturn(this, result); 7835 }; 7836} 7837function _slicedToArray(arr, i) { 7838 return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); 7839} 7840function _arrayWithHoles(arr) { 7841 if (Array.isArray(arr)) return arr; 7842} 7843function _unsupportedIterableToArray(o, minLen) { 7844 if (!o) return; 7845 if (typeof o === "string") return _arrayLikeToArray(o, minLen); 7846 var n = Object.prototype.toString.call(o).slice(8, -1); 7847 if (n === "Object" && o.constructor) n = o.constructor.name; 7848 if (n === "Map" || n === "Set") return Array.from(o); 7849 if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); 7850} 7851function _arrayLikeToArray(arr, len) { 7852 if (len == null || len > arr.length) len = arr.length; 7853 for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; 7854 return arr2; 7855} 7856function _nonIterableRest() { 7857 throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); 7858} 7859function _toPrimitive(input, hint) { 7860 if (typeof input !== "object" || input === null) return input; 7861 var prim = input[Symbol.toPrimitive]; 7862 if (prim !== undefined) { 7863 var res = prim.call(input, hint || "default"); 7864 if (typeof res !== "object") return res; 7865 throw new TypeError("@@toPrimitive must return a primitive value."); 7866 } 7867 return (hint === "string" ? String : Number)(input); 7868} 7869function _toPropertyKey(arg) { 7870 var key = _toPrimitive(arg, "string"); 7871 return typeof key === "symbol" ? key : String(key); 7872} 7873 7874/** 7875 * @module lib/functions 7876 */ 7877 7878/** 7879 * Check to see this is a Node environment. 7880 * @type {boolean} 7881 */ 7882/* global global */ 7883var isNode = typeof __webpack_require__.g !== 'undefined' && {}.toString.call(__webpack_require__.g) === '[object global]'; 7884 7885/** 7886 * Check to see if this is a Bun environment. 7887 * @see https://bun.sh/guides/util/detect-bun 7888 * @type {boolean} 7889 */ 7890var isBun = typeof Bun !== 'undefined'; 7891 7892/** 7893 * Check to see if this is a Deno environment. 7894 * @see https://docs.deno.com/api/deno/~/Deno 7895 * @type {boolean} 7896 */ 7897var isDeno = typeof Deno !== 'undefined'; 7898 7899/** 7900 * Check if this is a server runtime 7901 * @type {boolean} 7902 */ 7903var isServerRuntime = isNode || isBun || isDeno; 7904 7905/** 7906 * Get the name of the method for a given getter or setter. 7907 * 7908 * @param {string} prop The name of the property. 7909 * @param {string} type Either âgetâ or âsetâ. 7910 * @return {string} 7911 */ 7912function getMethodName(prop, type) { 7913 if (prop.indexOf(type.toLowerCase()) === 0) { 7914 return prop; 7915 } 7916 return "".concat(type.toLowerCase()).concat(prop.substr(0, 1).toUpperCase()).concat(prop.substr(1)); 7917} 7918 7919/** 7920 * Check to see if the object is a DOM Element. 7921 * 7922 * @param {*} element The object to check. 7923 * @return {boolean} 7924 */ 7925function isDomElement(element) { 7926 return Boolean(element && element.nodeType === 1 && 'nodeName' in element && element.ownerDocument && element.ownerDocument.defaultView); 7927} 7928 7929/** 7930 * Check to see whether the value is a number. 7931 * 7932 * @see http://dl.dropboxusercontent.com/u/35146/js/tests/isNumber.html 7933 * @param {*} value The value to check. 7934 * @param {boolean} integer Check if the value is an integer. 7935 * @return {boolean} 7936 */ 7937function isInteger(value) { 7938 // eslint-disable-next-line eqeqeq 7939 return !isNaN(parseFloat(value)) && isFinite(value) && Math.floor(value) == value; 7940} 7941 7942/** 7943 * Check to see if the URL is a Vimeo url. 7944 * 7945 * @param {string} url The url string. 7946 * @return {boolean} 7947 */ 7948function isVimeoUrl(url) { 7949 return /^(https?:)?\/\/((((player|www)\.)?vimeo\.com)|((player\.)?[a-zA-Z0-9-]+\.(videoji\.(hk|cn)|vimeo\.work)))(?=$|\/)/.test(url); 7950} 7951 7952/** 7953 * Check to see if the URL is for a Vimeo embed. 7954 * 7955 * @param {string} url The url string. 7956 * @return {boolean} 7957 */ 7958function isVimeoEmbed(url) { 7959 var expr = /^https:\/\/player\.((vimeo\.com)|([a-zA-Z0-9-]+\.(videoji\.(hk|cn)|vimeo\.work)))\/video\/\d+/; 7960 return expr.test(url); 7961} 7962function getOembedDomain(url) { 7963 var match = (url || '').match(/^(?:https?:)?(?:\/\/)?([^/?]+)/); 7964 var domain = (match && match[1] || '').replace('player.', ''); 7965 var customDomains = ['.videoji.hk', '.vimeo.work', '.videoji.cn']; 7966 for (var _i = 0, _customDomains = customDomains; _i < _customDomains.length; _i++) { 7967 var customDomain = _customDomains[_i]; 7968 if (domain.endsWith(customDomain)) { 7969 return domain; 7970 } 7971 } 7972 return 'vimeo.com'; 7973} 7974 7975/** 7976 * Get the Vimeo URL from an element. 7977 * The element must have either a data-vimeo-id or data-vimeo-url attribute. 7978 * 7979 * @param {object} oEmbedParameters The oEmbed parameters. 7980 * @return {string} 7981 */ 7982function getVimeoUrl() { 7983 var oEmbedParameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 7984 var id = oEmbedParameters.id; 7985 var url = oEmbedParameters.url; 7986 var idOrUrl = id || url; 7987 if (!idOrUrl) { 7988 throw new Error('An id or url must be passed, either in an options object or as a data-vimeo-id or data-vimeo-url attribute.'); 7989 } 7990 if (isInteger(idOrUrl)) { 7991 return "https://vimeo.com/".concat(idOrUrl); 7992 } 7993 if (isVimeoUrl(idOrUrl)) { 7994 return idOrUrl.replace('http:', 'https:'); 7995 } 7996 if (id) { 7997 throw new TypeError("\u201C".concat(id, "\u201D is not a valid video id.")); 7998 } 7999 throw new TypeError("\u201C".concat(idOrUrl, "\u201D is not a vimeo.com url.")); 8000} 8001 8002/* eslint-disable max-params */ 8003/** 8004 * A utility method for attaching and detaching event handlers 8005 * 8006 * @param {EventTarget} target 8007 * @param {string | string[]} eventName 8008 * @param {function} callback 8009 * @param {'addEventListener' | 'on'} onName 8010 * @param {'removeEventListener' | 'off'} offName 8011 * @return {{cancel: (function(): void)}} 8012 */ 8013var subscribe = function subscribe(target, eventName, callback) { 8014 var onName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'addEventListener'; 8015 var offName = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'removeEventListener'; 8016 var eventNames = typeof eventName === 'string' ? [eventName] : eventName;
vendor: 4,397 bytes, lines 8017-8150
8017 eventNames.forEach(function (evName) { 8018 target[onName](evName, callback); 8019 }); 8020 return { 8021 cancel: function cancel() { 8022 return eventNames.forEach(function (evName) { 8023 return target[offName](evName, callback); 8024 }); 8025 } 8026 }; 8027}; 8028var logSurveyLink = function logSurveyLink() { 8029 console.log('\n%cVimeo is looking for feedback!\n%cComplete our survey about the Player SDK: https://t.maze.co/393567477', 'color:#00adef;font-size:1.2em;', 'color:#aaa;font-size:0.8em;'); 8030}; 8031 8032/** 8033 * Find the iframe element that contains a specific source window 8034 * 8035 * @param {Window} sourceWindow The source window to find the iframe for 8036 * @param {Document} [doc=document] The document to search within 8037 * @return {HTMLIFrameElement|null} The iframe element if found, otherwise null 8038 */ 8039function findIframeBySourceWindow(sourceWindow) { 8040 var doc = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : document; 8041 if (!sourceWindow || !doc || typeof doc.querySelectorAll !== 'function') { 8042 return null; 8043 } 8044 var iframes = doc.querySelectorAll('iframe'); 8045 for (var i = 0; i < iframes.length; i++) { 8046 if (iframes[i] && iframes[i].contentWindow === sourceWindow) { 8047 return iframes[i]; 8048 } 8049 } 8050 return null; 8051} 8052 8053var arrayIndexOfSupport = typeof Array.prototype.indexOf !== 'undefined'; 8054var postMessageSupport = typeof window !== 'undefined' && typeof window.postMessage !== 'undefined'; 8055if (!isServerRuntime && (!arrayIndexOfSupport || !postMessageSupport)) { 8056 throw new Error('Sorry, the Vimeo Player API is not available in this browser.'); 8057} 8058 8059var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof __webpack_require__.g !== 'undefined' ? __webpack_require__.g : typeof self !== 'undefined' ? self : {}; 8060 8061function createCommonjsModule(fn, module) { 8062 return module = { exports: {} }, fn(module, module.exports), module.exports; 8063} 8064 8065/*! 8066 * weakmap-polyfill v2.0.4 - ECMAScript6 WeakMap polyfill 8067 * https://github.com/polygonplanet/weakmap-polyfill 8068 * Copyright (c) 2015-2021 polygonplanet <[email protected]> 8069 * @license MIT 8070 */ 8071 8072(function (self) { 8073 8074 if (self.WeakMap) { 8075 return; 8076 } 8077 var hasOwnProperty = Object.prototype.hasOwnProperty; 8078 var hasDefine = Object.defineProperty && function () { 8079 try { 8080 // Avoid IE8's broken Object.defineProperty 8081 return Object.defineProperty({}, 'x', { 8082 value: 1 8083 }).x === 1; 8084 } catch (e) {} 8085 }(); 8086 var defineProperty = function (object, name, value) { 8087 if (hasDefine) { 8088 Object.defineProperty(object, name, { 8089 configurable: true, 8090 writable: true, 8091 value: value 8092 }); 8093 } else { 8094 object[name] = value; 8095 } 8096 }; 8097 self.WeakMap = function () { 8098 // ECMA-262 23.3 WeakMap Objects 8099 function WeakMap() { 8100 if (this === void 0) { 8101 throw new TypeError("Constructor WeakMap requires 'new'"); 8102 } 8103 defineProperty(this, '_id', genId('_WeakMap')); 8104 8105 // ECMA-262 23.3.1.1 WeakMap([iterable]) 8106 if (arguments.length > 0) { 8107 // Currently, WeakMap `iterable` argument is not supported 8108 throw new TypeError('WeakMap iterable is not supported'); 8109 } 8110 } 8111 8112 // ECMA-262 23.3.3.2 WeakMap.prototype.delete(key) 8113 defineProperty(WeakMap.prototype, 'delete', function (key) { 8114 checkInstance(this, 'delete'); 8115 if (!isObject(key)) { 8116 return false; 8117 } 8118 var entry = key[this._id]; 8119 if (entry && entry[0] === key) { 8120 delete key[this._id]; 8121 return true; 8122 } 8123 return false; 8124 }); 8125 8126 // ECMA-262 23.3.3.3 WeakMap.prototype.get(key) 8127 defineProperty(WeakMap.prototype, 'get', function (key) { 8128 checkInstance(this, 'get'); 8129 if (!isObject(key)) { 8130 return void 0; 8131 } 8132 var entry = key[this._id]; 8133 if (entry && entry[0] === key) { 8134 return entry[1]; 8135 } 8136 return void 0; 8137 }); 8138 8139 // ECMA-262 23.3.3.4 WeakMap.prototype.has(key) 8140 defineProperty(WeakMap.prototype, 'has', function (key) { 8141 checkInstance(this, 'has'); 8142 if (!isObject(key)) { 8143 return false; 8144 } 8145 var entry = key[this._id]; 8146 if (entry && entry[0] === key) { 8147 return true; 8148 } 8149 return false; 8150 });
vendor: 20,315 bytes, lines 8151-8797
8151 8152 // ECMA-262 23.3.3.5 WeakMap.prototype.set(key, value) 8153 defineProperty(WeakMap.prototype, 'set', function (key, value) { 8154 checkInstance(this, 'set'); 8155 if (!isObject(key)) { 8156 throw new TypeError('Invalid value used as weak map key'); 8157 } 8158 var entry = key[this._id]; 8159 if (entry && entry[0] === key) { 8160 entry[1] = value; 8161 return this; 8162 } 8163 defineProperty(key, this._id, [key, value]); 8164 return this; 8165 }); 8166 function checkInstance(x, methodName) { 8167 if (!isObject(x) || !hasOwnProperty.call(x, '_id')) { 8168 throw new TypeError(methodName + ' method called on incompatible receiver ' + typeof x); 8169 } 8170 } 8171 function genId(prefix) { 8172 return prefix + '_' + rand() + '.' + rand(); 8173 } 8174 function rand() { 8175 return Math.random().toString().substring(2); 8176 } 8177 defineProperty(WeakMap, '_polyfill', true); 8178 return WeakMap; 8179 }(); 8180 function isObject(x) { 8181 return Object(x) === x; 8182 } 8183})(typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : commonjsGlobal); 8184 8185var npo_src = createCommonjsModule(function (module) { 8186/*! Native Promise Only 8187 v0.8.1 (c) Kyle Simpson 8188 MIT License: http://getify.mit-license.org 8189*/ 8190 8191(function UMD(name, context, definition) { 8192 // special form of UMD for polyfilling across evironments 8193 context[name] = context[name] || definition(); 8194 if (module.exports) { 8195 module.exports = context[name]; 8196 } 8197})("Promise", typeof commonjsGlobal != "undefined" ? commonjsGlobal : commonjsGlobal, function DEF() { 8198 8199 var builtInProp, 8200 cycle, 8201 scheduling_queue, 8202 ToString = Object.prototype.toString, 8203 timer = typeof setImmediate != "undefined" ? function timer(fn) { 8204 return setImmediate(fn); 8205 } : setTimeout; 8206 8207 // dammit, IE8. 8208 try { 8209 Object.defineProperty({}, "x", {}); 8210 builtInProp = function builtInProp(obj, name, val, config) { 8211 return Object.defineProperty(obj, name, { 8212 value: val, 8213 writable: true, 8214 configurable: config !== false 8215 }); 8216 }; 8217 } catch (err) { 8218 builtInProp = function builtInProp(obj, name, val) { 8219 obj[name] = val; 8220 return obj; 8221 }; 8222 } 8223 8224 // Note: using a queue instead of array for efficiency 8225 scheduling_queue = function Queue() { 8226 var first, last, item; 8227 function Item(fn, self) { 8228 this.fn = fn; 8229 this.self = self; 8230 this.next = void 0; 8231 } 8232 return { 8233 add: function add(fn, self) { 8234 item = new Item(fn, self); 8235 if (last) { 8236 last.next = item; 8237 } else { 8238 first = item; 8239 } 8240 last = item; 8241 item = void 0; 8242 }, 8243 drain: function drain() { 8244 var f = first; 8245 first = last = cycle = void 0; 8246 while (f) { 8247 f.fn.call(f.self); 8248 f = f.next; 8249 } 8250 } 8251 }; 8252 }(); 8253 function schedule(fn, self) { 8254 scheduling_queue.add(fn, self); 8255 if (!cycle) { 8256 cycle = timer(scheduling_queue.drain); 8257 } 8258 } 8259 8260 // promise duck typing 8261 function isThenable(o) { 8262 var _then, 8263 o_type = typeof o; 8264 if (o != null && (o_type == "object" || o_type == "function")) { 8265 _then = o.then; 8266 } 8267 return typeof _then == "function" ? _then : false; 8268 } 8269 function notify() { 8270 for (var i = 0; i < this.chain.length; i++) { 8271 notifyIsolated(this, this.state === 1 ? this.chain[i].success : this.chain[i].failure, this.chain[i]); 8272 } 8273 this.chain.length = 0; 8274 } 8275 8276 // NOTE: This is a separate function to isolate 8277 // the `try..catch` so that other code can be 8278 // optimized better 8279 function notifyIsolated(self, cb, chain) { 8280 var ret, _then; 8281 try { 8282 if (cb === false) { 8283 chain.reject(self.msg); 8284 } else { 8285 if (cb === true) { 8286 ret = self.msg; 8287 } else { 8288 ret = cb.call(void 0, self.msg); 8289 } 8290 if (ret === chain.promise) { 8291 chain.reject(TypeError("Promise-chain cycle")); 8292 } else if (_then = isThenable(ret)) { 8293 _then.call(ret, chain.resolve, chain.reject); 8294 } else { 8295 chain.resolve(ret); 8296 } 8297 } 8298 } catch (err) { 8299 chain.reject(err); 8300 } 8301 } 8302 function resolve(msg) { 8303 var _then, 8304 self = this; 8305 8306 // already triggered? 8307 if (self.triggered) { 8308 return; 8309 } 8310 self.triggered = true; 8311 8312 // unwrap 8313 if (self.def) { 8314 self = self.def; 8315 } 8316 try { 8317 if (_then = isThenable(msg)) { 8318 schedule(function () { 8319 var def_wrapper = new MakeDefWrapper(self); 8320 try { 8321 _then.call(msg, function $resolve$() { 8322 resolve.apply(def_wrapper, arguments); 8323 }, function $reject$() { 8324 reject.apply(def_wrapper, arguments); 8325 }); 8326 } catch (err) { 8327 reject.call(def_wrapper, err); 8328 } 8329 }); 8330 } else { 8331 self.msg = msg; 8332 self.state = 1; 8333 if (self.chain.length > 0) { 8334 schedule(notify, self); 8335 } 8336 } 8337 } catch (err) { 8338 reject.call(new MakeDefWrapper(self), err); 8339 } 8340 } 8341 function reject(msg) { 8342 var self = this; 8343 8344 // already triggered? 8345 if (self.triggered) { 8346 return; 8347 } 8348 self.triggered = true; 8349 8350 // unwrap 8351 if (self.def) { 8352 self = self.def; 8353 } 8354 self.msg = msg; 8355 self.state = 2; 8356 if (self.chain.length > 0) { 8357 schedule(notify, self); 8358 } 8359 } 8360 function iteratePromises(Constructor, arr, resolver, rejecter) { 8361 for (var idx = 0; idx < arr.length; idx++) { 8362 (function IIFE(idx) { 8363 Constructor.resolve(arr[idx]).then(function $resolver$(msg) { 8364 resolver(idx, msg); 8365 }, rejecter); 8366 })(idx); 8367 } 8368 } 8369 function MakeDefWrapper(self) { 8370 this.def = self; 8371 this.triggered = false; 8372 } 8373 function MakeDef(self) { 8374 this.promise = self; 8375 this.state = 0; 8376 this.triggered = false; 8377 this.chain = []; 8378 this.msg = void 0; 8379 } 8380 function Promise(executor) { 8381 if (typeof executor != "function") { 8382 throw TypeError("Not a function"); 8383 } 8384 if (this.__NPO__ !== 0) { 8385 throw TypeError("Not a promise"); 8386 } 8387 8388 // instance shadowing the inherited "brand" 8389 // to signal an already "initialized" promise 8390 this.__NPO__ = 1; 8391 var def = new MakeDef(this); 8392 this["then"] = function then(success, failure) { 8393 var o = { 8394 success: typeof success == "function" ? success : true, 8395 failure: typeof failure == "function" ? failure : false 8396 }; 8397 // Note: `then(..)` itself can be borrowed to be used against 8398 // a different promise constructor for making the chained promise, 8399 // by substituting a different `this` binding. 8400 o.promise = new this.constructor(function extractChain(resolve, reject) { 8401 if (typeof resolve != "function" || typeof reject != "function") { 8402 throw TypeError("Not a function"); 8403 } 8404 o.resolve = resolve; 8405 o.reject = reject; 8406 }); 8407 def.chain.push(o); 8408 if (def.state !== 0) { 8409 schedule(notify, def); 8410 } 8411 return o.promise; 8412 }; 8413 this["catch"] = function $catch$(failure) { 8414 return this.then(void 0, failure); 8415 }; 8416 try { 8417 executor.call(void 0, function publicResolve(msg) { 8418 resolve.call(def, msg); 8419 }, function publicReject(msg) { 8420 reject.call(def, msg); 8421 }); 8422 } catch (err) { 8423 reject.call(def, err); 8424 } 8425 } 8426 var PromisePrototype = builtInProp({}, "constructor", Promise, /*configurable=*/false); 8427 8428 // Note: Android 4 cannot use `Object.defineProperty(..)` here 8429 Promise.prototype = PromisePrototype; 8430 8431 // built-in "brand" to signal an "uninitialized" promise 8432 builtInProp(PromisePrototype, "__NPO__", 0, /*configurable=*/false); 8433 builtInProp(Promise, "resolve", function Promise$resolve(msg) { 8434 var Constructor = this; 8435 8436 // spec mandated checks 8437 // note: best "isPromise" check that's practical for now 8438 if (msg && typeof msg == "object" && msg.__NPO__ === 1) { 8439 return msg; 8440 } 8441 return new Constructor(function executor(resolve, reject) { 8442 if (typeof resolve != "function" || typeof reject != "function") { 8443 throw TypeError("Not a function"); 8444 } 8445 resolve(msg); 8446 }); 8447 }); 8448 builtInProp(Promise, "reject", function Promise$reject(msg) { 8449 return new this(function executor(resolve, reject) { 8450 if (typeof resolve != "function" || typeof reject != "function") { 8451 throw TypeError("Not a function"); 8452 } 8453 reject(msg); 8454 }); 8455 }); 8456 builtInProp(Promise, "all", function Promise$all(arr) { 8457 var Constructor = this; 8458 8459 // spec mandated checks 8460 if (ToString.call(arr) != "[object Array]") { 8461 return Constructor.reject(TypeError("Not an array")); 8462 } 8463 if (arr.length === 0) { 8464 return Constructor.resolve([]); 8465 } 8466 return new Constructor(function executor(resolve, reject) { 8467 if (typeof resolve != "function" || typeof reject != "function") { 8468 throw TypeError("Not a function"); 8469 } 8470 var len = arr.length, 8471 msgs = Array(len), 8472 count = 0; 8473 iteratePromises(Constructor, arr, function resolver(idx, msg) { 8474 msgs[idx] = msg; 8475 if (++count === len) { 8476 resolve(msgs); 8477 } 8478 }, reject); 8479 }); 8480 }); 8481 builtInProp(Promise, "race", function Promise$race(arr) { 8482 var Constructor = this; 8483 8484 // spec mandated checks 8485 if (ToString.call(arr) != "[object Array]") { 8486 return Constructor.reject(TypeError("Not an array")); 8487 } 8488 return new Constructor(function executor(resolve, reject) { 8489 if (typeof resolve != "function" || typeof reject != "function") { 8490 throw TypeError("Not a function"); 8491 } 8492 iteratePromises(Constructor, arr, function resolver(idx, msg) { 8493 resolve(msg); 8494 }, reject); 8495 }); 8496 }); 8497 return Promise; 8498}); 8499}); 8500 8501/** 8502 * @module lib/callbacks 8503 */ 8504 8505var callbackMap = new WeakMap(); 8506 8507/** 8508 * Store a callback for a method or event for a player. 8509 * 8510 * @param {Player} player The player object. 8511 * @param {string} name The method or event name. 8512 * @param {(function(this:Player, *): void|{resolve: function, reject: function})} callback 8513 * The callback to call or an object with resolve and reject functions for a promise. 8514 * @return {void} 8515 */ 8516function storeCallback(player, name, callback) { 8517 var playerCallbacks = callbackMap.get(player.element) || {}; 8518 if (!(name in playerCallbacks)) { 8519 playerCallbacks[name] = []; 8520 } 8521 playerCallbacks[name].push(callback); 8522 callbackMap.set(player.element, playerCallbacks); 8523} 8524 8525/** 8526 * Get the callbacks for a player and event or method. 8527 * 8528 * @param {Player} player The player object. 8529 * @param {string} name The method or event name 8530 * @return {function[]} 8531 */ 8532function getCallbacks(player, name) { 8533 var playerCallbacks = callbackMap.get(player.element) || {}; 8534 return playerCallbacks[name] || []; 8535} 8536 8537/** 8538 * Remove a stored callback for a method or event for a player. 8539 * 8540 * @param {Player} player The player object. 8541 * @param {string} name The method or event name 8542 * @param {function} [callback] The specific callback to remove. 8543 * @return {boolean} Was this the last callback? 8544 */ 8545function removeCallback(player, name, callback) { 8546 var playerCallbacks = callbackMap.get(player.element) || {}; 8547 if (!playerCallbacks[name]) { 8548 return true; 8549 } 8550 8551 // If no callback is passed, remove all callbacks for the event 8552 if (!callback) { 8553 playerCallbacks[name] = []; 8554 callbackMap.set(player.element, playerCallbacks); 8555 return true; 8556 } 8557 var index = playerCallbacks[name].indexOf(callback); 8558 if (index !== -1) { 8559 playerCallbacks[name].splice(index, 1); 8560 } 8561 callbackMap.set(player.element, playerCallbacks); 8562 return playerCallbacks[name] && playerCallbacks[name].length === 0; 8563} 8564 8565/** 8566 * Return the first stored callback for a player and event or method. 8567 * 8568 * @param {Player} player The player object. 8569 * @param {string} name The method or event name. 8570 * @return {function} The callback, or false if there were none 8571 */ 8572function shiftCallbacks(player, name) { 8573 var playerCallbacks = getCallbacks(player, name); 8574 if (playerCallbacks.length < 1) { 8575 return false; 8576 } 8577 var callback = playerCallbacks.shift(); 8578 removeCallback(player, name, callback); 8579 return callback; 8580} 8581 8582/** 8583 * Move callbacks associated with an element to another element. 8584 * 8585 * @param {HTMLElement} oldElement The old element. 8586 * @param {HTMLElement} newElement The new element. 8587 * @return {void} 8588 */ 8589function swapCallbacks(oldElement, newElement) { 8590 var playerCallbacks = callbackMap.get(oldElement); 8591 callbackMap.set(newElement, playerCallbacks); 8592 callbackMap.delete(oldElement); 8593} 8594 8595/** 8596 * @module lib/postmessage 8597 */ 8598 8599/** 8600 * Parse a message received from postMessage. 8601 * 8602 * @param {*} data The data received from postMessage. 8603 * @return {object} 8604 */ 8605function parseMessageData(data) { 8606 if (typeof data === 'string') { 8607 try { 8608 data = JSON.parse(data); 8609 } catch (error) { 8610 // If the message cannot be parsed, throw the error as a warning 8611 console.warn(error); 8612 return {}; 8613 } 8614 } 8615 return data; 8616} 8617 8618/** 8619 * Post a message to the specified target. 8620 * 8621 * @param {Player} player The player object to use. 8622 * @param {string} method The API method to call. 8623 * @param {string|number|object|Array|undefined} params The parameters to send to the player. 8624 * @return {void} 8625 */ 8626function postMessage(player, method, params) { 8627 if (!player.element.contentWindow || !player.element.contentWindow.postMessage) { 8628 return; 8629 } 8630 var message = { 8631 method: method 8632 }; 8633 if (params !== undefined) { 8634 message.value = params; 8635 } 8636 8637 // IE 8 and 9 do not support passing messages, so stringify them 8638 var ieVersion = parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/, '$1')); 8639 if (ieVersion >= 8 && ieVersion < 10) { 8640 message = JSON.stringify(message); 8641 } 8642 player.element.contentWindow.postMessage(message, player.origin); 8643} 8644 8645/** 8646 * Parse the data received from a message event. 8647 * 8648 * @param {Player} player The player that received the message. 8649 * @param {(Object|string)} data The message data. Strings will be parsed into JSON. 8650 * @return {void} 8651 */ 8652function processData(player, data) { 8653 data = parseMessageData(data); 8654 var callbacks = []; 8655 var param; 8656 if (data.event) { 8657 if (data.event === 'error') { 8658 var promises = getCallbacks(player, data.data.method); 8659 promises.forEach(function (promise) { 8660 var error = new Error(data.data.message); 8661 error.name = data.data.name; 8662 promise.reject(error); 8663 removeCallback(player, data.data.method, promise); 8664 }); 8665 } 8666 callbacks = getCallbacks(player, "event:".concat(data.event)); 8667 param = data.data; 8668 } else if (data.method) { 8669 var callback = shiftCallbacks(player, data.method); 8670 if (callback) { 8671 callbacks.push(callback); 8672 param = data.value; 8673 } 8674 } 8675 callbacks.forEach(function (callback) { 8676 try { 8677 if (typeof callback === 'function') { 8678 callback.call(player, param); 8679 return; 8680 } 8681 callback.resolve(param); 8682 } catch (e) { 8683 // empty 8684 } 8685 }); 8686} 8687 8688/** 8689 * @module lib/embed 8690 */ 8691var oEmbedParameters = ['airplay', 'audio_tracks', 'audiotrack', 'autopause', 'autoplay', 'background', 'byline', 'cc', 'chapter_id', 'chapters', 'chromecast', 'color', 'colors', 'controls', 'dnt', 'end_time', 'fullscreen', 'height', 'id', 'initial_quality', 'interactive_params', 'keyboard', 'loop', 'maxheight', 'max_quality', 'maxwidth', 'min_quality', 'muted', 'play_button_position', 'playsinline', 'portrait', 'preload', 'progress_bar', 'quality', 'quality_selector', 'responsive', 'skipping_forward', 'speed', 'start_time', 'texttrack', 'thumbnail_id', 'title', 'transcript', 'transparent', 'unmute_button', 'url', 'vimeo_logo', 'volume', 'watch_full_video', 'width']; 8692 8693/** 8694 * Get the 'data-vimeo'-prefixed attributes from an element as an object. 8695 * 8696 * @param {HTMLElement} element The element. 8697 * @param {Object} [defaults={}] The default values to use. 8698 * @return {Object<string, string>} 8699 */ 8700function getOEmbedParameters(element) { 8701 var defaults = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 8702 return oEmbedParameters.reduce(function (params, param) { 8703 var value = element.getAttribute("data-vimeo-".concat(param)); 8704 if (value || value === '') { 8705 params[param] = value === '' ? 1 : value; 8706 } 8707 return params; 8708 }, defaults); 8709} 8710 8711/** 8712 * Create an embed from oEmbed data inside an element. 8713 * 8714 * @param {object} data The oEmbed data. 8715 * @param {HTMLElement} element The element to put the iframe in. 8716 * @return {HTMLIFrameElement} The iframe embed. 8717 */ 8718function createEmbed(_ref, element) { 8719 var html = _ref.html; 8720 if (!element) { 8721 throw new TypeError('An element must be provided'); 8722 } 8723 if (element.getAttribute('data-vimeo-initialized') !== null) { 8724 return element.querySelector('iframe'); 8725 } 8726 var div = document.createElement('div'); 8727 div.innerHTML = html; 8728 element.appendChild(div.firstChild); 8729 element.setAttribute('data-vimeo-initialized', 'true'); 8730 return element.querySelector('iframe'); 8731} 8732 8733/** 8734 * Make an oEmbed call for the specified URL. 8735 * 8736 * @param {string} videoUrl The vimeo.com url for the video. 8737 * @param {Object} [params] Parameters to pass to oEmbed. 8738 * @param {HTMLElement} element The element. 8739 * @return {Promise} 8740 */ 8741function getOEmbedData(videoUrl) { 8742 var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 8743 var element = arguments.length > 2 ? arguments[2] : undefined; 8744 return new Promise(function (resolve, reject) { 8745 if (!isVimeoUrl(videoUrl)) { 8746 throw new TypeError("\u201C".concat(videoUrl, "\u201D is not a vimeo.com url.")); 8747 } 8748 var domain = getOembedDomain(videoUrl); 8749 var url = "https://".concat(domain, "/api/oembed.json?url=").concat(encodeURIComponent(videoUrl)); 8750 for (var param in params) { 8751 if (params.hasOwnProperty(param)) { 8752 url += "&".concat(param, "=").concat(encodeURIComponent(params[param])); 8753 } 8754 } 8755 var xhr = 'XDomainRequest' in window ? new XDomainRequest() : new XMLHttpRequest(); 8756 xhr.open('GET', url, true); 8757 xhr.onload = function () { 8758 if (xhr.status === 404) { 8759 reject(new Error("\u201C".concat(videoUrl, "\u201D was not found."))); 8760 return; 8761 } 8762 if (xhr.status === 403) { 8763 reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable."))); 8764 return; 8765 } 8766 try { 8767 var json = JSON.parse(xhr.responseText); 8768 // Check api response for 403 on oembed 8769 if (json.domain_status_code === 403) { 8770 // We still want to create the embed to give users visual feedback 8771 createEmbed(json, element); 8772 reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable."))); 8773 return; 8774 } 8775 resolve(json); 8776 } catch (error) { 8777 reject(error); 8778 } 8779 }; 8780 xhr.onerror = function () { 8781 var status = xhr.status ? " (".concat(xhr.status, ")") : ''; 8782 reject(new Error("There was an error fetching the embed code from Vimeo".concat(status, "."))); 8783 }; 8784 xhr.send(); 8785 }); 8786} 8787 8788/** 8789 * Initialize all embeds within a specific element 8790 * 8791 * @param {HTMLElement} [parent=document] The parent element. 8792 * @return {void} 8793 */ 8794function initializeEmbeds() { 8795 var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 8796 var elements = [].slice.call(parent.querySelectorAll('[data-vimeo-id], [data-vimeo-url]')); 8797 var handleError = function handleError(error) {
8798 if ('console' in window && console.error) { 8799 console.error("There was an error creating an embed: ".concat(error)); 8800 } 8801 }; 8802 elements.forEach(function (element) { 8803 try { 8804 // Skip any that have data-vimeo-defer 8805 if (element.getAttribute('data-vimeo-defer') !== null) { 8806 return; 8807 } 8808 var params = getOEmbedParameters(element); 8809 var url = getVimeoUrl(params); 8810 getOEmbedData(url, params, element).then(function (data) { 8811 return createEmbed(data, element); 8812 }).catch(handleError); 8813 } catch (error) { 8814 handleError(error); 8815 } 8816 }); 8817} 8818 8819/** 8820 * Resize embeds when messaged by the player. 8821 * 8822 * @param {HTMLElement} [parent=document] The parent element. 8823 * @return {void} 8824 */ 8825function resizeEmbeds() { 8826 var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 8827 // Prevent execution if users include the player.js script multiple times. 8828 if (window.VimeoPlayerResizeEmbeds_) { 8829 return; 8830 } 8831 window.VimeoPlayerResizeEmbeds_ = true; 8832 var onMessage = function onMessage(event) { 8833 if (!isVimeoUrl(event.origin)) { 8834 return; 8835 } 8836 8837 // 'spacechange' is fired only on embeds with cards 8838 if (!event.data || event.data.event !== 'spacechange') { 8839 return; 8840 } 8841 var senderIFrame = event.source ? findIframeBySourceWindow(event.source, parent) : null; 8842 if (senderIFrame) { 8843 // Change padding-bottom of the enclosing div to accommodate 8844 // card carousel without distorting aspect ratio 8845 var space = senderIFrame.parentElement; 8846 space.style.paddingBottom = "".concat(event.data.data[0].bottom, "px"); 8847 } 8848 }; 8849 window.addEventListener('message', onMessage); 8850} 8851 8852/** 8853 * Add chapters to existing metadata for Google SEO 8854 * 8855 * @param {HTMLElement} [parent=document] The parent element. 8856 * @return {void} 8857 */ 8858function initAppendVideoMetadata() { 8859 var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 8860 // Prevent execution if users include the player.js script multiple times. 8861 if (window.VimeoSeoMetadataAppended) { 8862 return; 8863 } 8864 window.VimeoSeoMetadataAppended = true; 8865 var onMessage = function onMessage(event) { 8866 if (!isVimeoUrl(event.origin)) { 8867 return; 8868 } 8869 var data = parseMessageData(event.data); 8870 if (!data || data.event !== 'ready') { 8871 return; 8872 } 8873 var senderIFrame = event.source ? findIframeBySourceWindow(event.source, parent) : null; 8874 8875 // Initiate appendVideoMetadata if iframe is a Vimeo embed 8876 if (senderIFrame && isVimeoEmbed(senderIFrame.src)) { 8877 var player = new Player(senderIFrame); 8878 player.callMethod('appendVideoMetadata', window.location.href); 8879 } 8880 }; 8881 window.addEventListener('message', onMessage); 8882} 8883 8884/** 8885 * Seek to time indicated by vimeo_t query parameter if present in URL 8886 * 8887 * @param {HTMLElement} [parent=document] The parent element. 8888 * @return {void} 8889 */ 8890function checkUrlTimeParam() { 8891 var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document; 8892 // Prevent execution if users include the player.js script multiple times. 8893 if (window.VimeoCheckedUrlTimeParam) { 8894 return; 8895 } 8896 window.VimeoCheckedUrlTimeParam = true; 8897 var handleError = function handleError(error) {
8898 if ('console' in window && console.error) { 8899 console.error("There was an error getting video Id: ".concat(error)); 8900 } 8901 }; 8902 var onMessage = function onMessage(event) { 8903 if (!isVimeoUrl(event.origin)) { 8904 return; 8905 } 8906 var data = parseMessageData(event.data); 8907 if (!data || data.event !== 'ready') { 8908 return; 8909 } 8910 var senderIFrame = event.source ? findIframeBySourceWindow(event.source, parent) : null; 8911 if (senderIFrame && isVimeoEmbed(senderIFrame.src)) { 8912 var player = new Player(senderIFrame); 8913 player.getVideoId().then(function (videoId) { 8914 var matches = new RegExp("[?&]vimeo_t_".concat(videoId, "=([^&#]*)")).exec(window.location.href); 8915 if (matches && matches[1]) { 8916 var sec = decodeURI(matches[1]); 8917 player.setCurrentTime(sec); 8918 } 8919 return; 8920 }).catch(handleError); 8921 } 8922 }; 8923 window.addEventListener('message', onMessage); 8924} 8925 8926/** 8927 * Updates iframe embeds to support DRM content playback by adding the 'encrypted-media' permission 8928 * to the iframe's allow attribute when DRM initialization fails. This function acts as a fallback 8929 * mechanism to enable playback of DRM-protected content in embeds that weren't properly configured. 8930 * 8931 * @return {void} 8932 */ 8933function updateDRMEmbeds() { 8934 if (window.VimeoDRMEmbedsUpdated) { 8935 return; 8936 } 8937 window.VimeoDRMEmbedsUpdated = true; 8938 8939 /** 8940 * Handle message events for DRM initialization failures 8941 * @param {MessageEvent} event - The message event from the iframe 8942 */ 8943 var onMessage = function onMessage(event) { 8944 if (!isVimeoUrl(event.origin)) { 8945 return; 8946 } 8947 var data = parseMessageData(event.data); 8948 if (!data || data.event !== 'drminitfailed') { 8949 return; 8950 } 8951 var senderIFrame = event.source ? findIframeBySourceWindow(event.source) : null; 8952 if (!senderIFrame) { 8953 return; 8954 } 8955 var currentAllow = senderIFrame.getAttribute('allow') || ''; 8956 var allowSupportsDRM = currentAllow.includes('encrypted-media'); 8957 if (!allowSupportsDRM) { 8958 // For DRM playback to successfully occur, the iframe `allow` attribute must include 'encrypted-media'. 8959 // If the video requires DRM but doesn't have the attribute, we try to add on behalf of the embed owner 8960 // as a temporary measure to enable playback until they're able to update their embeds. 8961 senderIFrame.setAttribute('allow', "".concat(currentAllow, "; encrypted-media")); 8962 var currentUrl = new URL(senderIFrame.getAttribute('src')); 8963 8964 // Adding this forces the embed to reload once `allow` has been updated with `encrypted-media`. 8965 currentUrl.searchParams.set('forcereload', 'drm'); 8966 senderIFrame.setAttribute('src', currentUrl.toString()); 8967 return; 8968 } 8969 }; 8970 window.addEventListener('message', onMessage); 8971} 8972 8973/* MIT License 8974 8975Copyright (c) Sindre Sorhus <[email protected]> (sindresorhus.com) 8976 8977Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 8978 8979The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8980 8981THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8982Terms */ 8983 8984function initializeScreenfull() { 8985 var fn = function () { 8986 var val; 8987 var fnMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'], 8988 // New WebKit 8989 ['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'], 8990 // Old WebKit 8991 ['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'], ['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'], ['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']]; 8992 var i = 0; 8993 var l = fnMap.length; 8994 var ret = {}; 8995 for (; i < l; i++) { 8996 val = fnMap[i]; 8997 if (val && val[1] in document) { 8998 for (i = 0; i < val.length; i++) { 8999 ret[fnMap[0][i]] = val[i]; 9000 } 9001 return ret; 9002 } 9003 } 9004 return false; 9005 }(); 9006 var eventNameMap = { 9007 fullscreenchange: fn.fullscreenchange, 9008 fullscreenerror: fn.fullscreenerror 9009 }; 9010 var screenfull = { 9011 request: function request(element) { 9012 return new Promise(function (resolve, reject) { 9013 var onFullScreenEntered = function onFullScreenEntered() { 9014 screenfull.off('fullscreenchange', onFullScreenEntered); 9015 resolve(); 9016 }; 9017 screenfull.on('fullscreenchange', onFullScreenEntered); 9018 element = element || document.documentElement; 9019 var returnPromise = element[fn.requestFullscreen]();
9020 if (returnPromise instanceof Promise) { 9021 returnPromise.then(onFullScreenEntered).catch(reject); 9022 } 9023 }); 9024 }, 9025 exit: function exit() { 9026 return new Promise(function (resolve, reject) { 9027 if (!screenfull.isFullscreen) { 9028 resolve(); 9029 return; 9030 } 9031 var onFullScreenExit = function onFullScreenExit() { 9032 screenfull.off('fullscreenchange', onFullScreenExit); 9033 resolve(); 9034 }; 9035 screenfull.on('fullscreenchange', onFullScreenExit); 9036 var returnPromise = document[fn.exitFullscreen](); 9037 if (returnPromise instanceof Promise) { 9038 returnPromise.then(onFullScreenExit).catch(reject); 9039 } 9040 }); 9041 }, 9042 on: function on(event, callback) { 9043 var eventName = eventNameMap[event]; 9044 if (eventName) { 9045 document.addEventListener(eventName, callback); 9046 } 9047 }, 9048 off: function off(event, callback) { 9049 var eventName = eventNameMap[event]; 9050 if (eventName) { 9051 document.removeEventListener(eventName, callback); 9052 } 9053 } 9054 }; 9055 Object.defineProperties(screenfull, { 9056 isFullscreen: { 9057 get: function get() { 9058 return Boolean(document[fn.fullscreenElement]); 9059 } 9060 }, 9061 element: { 9062 enumerable: true, 9063 get: function get() { 9064 return document[fn.fullscreenElement]; 9065 } 9066 }, 9067 isEnabled: { 9068 enumerable: true, 9069 get: function get() { 9070 // Coerce to boolean in case of old WebKit 9071 return Boolean(document[fn.fullscreenEnabled]); 9072 } 9073 } 9074 }); 9075 return screenfull; 9076} 9077 9078/** @typedef {import('./timing-src-connector.types').PlayerControls} PlayerControls */ 9079/** @typedef {import('timing-object').ITimingObject} TimingObject */ 9080/** @typedef {import('./timing-src-connector.types').TimingSrcConnectorOptions} TimingSrcConnectorOptions */ 9081/** @typedef {(msg: string) => any} Logger */ 9082/** @typedef {import('timing-object').TConnectionState} TConnectionState */ 9083 9084/** 9085 * @type {TimingSrcConnectorOptions} 9086 * 9087 * For details on these properties and their effects, see the typescript definition referenced above. 9088 */ 9089var defaultOptions = { 9090 role: 'viewer', 9091 autoPlayMuted: true, 9092 allowedDrift: 0.3, 9093 maxAllowedDrift: 1, 9094 minCheckInterval: 0.1, 9095 maxRateAdjustment: 0.2, 9096 maxTimeToCatchUp: 1 9097}; 9098 9099/** 9100 * There's a proposed W3C spec for the Timing Object which would introduce a new set of APIs that would simplify time-synchronization tasks for browser applications. 9101 * 9102 * Proposed spec: https://webtiming.github.io/timingobject/ 9103 * V3 Spec: https://timingsrc.readthedocs.io/en/latest/ 9104 * Demuxed talk: https://www.youtube.com/watch?v=cZSjDaGDmX8 9105 * 9106 * This class makes it easy to connect Vimeo.Player to a provided TimingObject via Vimeo.Player.setTimingSrc(myTimingObject, options) and the synchronization will be handled automatically. 9107 * 9108 * There are 5 general responsibilities in TimingSrcConnector: 9109 * 9110 * 1. `updatePlayer()` which sets the player's currentTime, playbackRate and pause/play state based on current state of the TimingObject. 9111 * 2. `updateTimingObject()` which sets the TimingObject's position and velocity from the player's state. 9112 * 3. `playerUpdater` which listens for change events on the TimingObject and will respond by calling updatePlayer. 9113 * 4. `timingObjectUpdater` which listens to the player events of seeked, play and pause and will respond by calling `updateTimingObject()`. 9114 * 5. `maintainPlaybackPosition` this is code that constantly monitors the player to make sure it's always in sync with the TimingObject. This is needed because videos will generally not play with precise time accuracy and there will be some drift which becomes more noticeable over longer periods (as noted in the timing-object spec). More details on this method below. 9115 */ 9116var TimingSrcConnector = /*#__PURE__*/function (_EventTarget) { 9117 _inherits(TimingSrcConnector, _EventTarget); 9118 var _super = _createSuper(TimingSrcConnector); 9119 /** 9120 * @param {PlayerControls} player 9121 * @param {TimingObject} timingObject 9122 * @param {TimingSrcConnectorOptions} options 9123 * @param {Logger} logger 9124 */ 9125 function TimingSrcConnector(_player, timingObject) { 9126 var _this; 9127 var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; 9128 var logger = arguments.length > 3 ? arguments[3] : undefined; 9129 _classCallCheck(this, TimingSrcConnector); 9130 _this = _super.call(this); 9131 _defineProperty(_assertThisInitialized(_this), "logger", void 0); 9132 _defineProperty(_assertThisInitialized(_this), "speedAdjustment", 0); 9133 /** 9134 * @param {PlayerControls} player 9135 * @param {number} newAdjustment 9136 * @return {Promise<void>} 9137 */ 9138 _defineProperty(_assertThisInitialized(_this), "adjustSpeed", /*#__PURE__*/function () { 9139 var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(player, newAdjustment) { 9140 var newPlaybackRate; 9141 return _regeneratorRuntime().wrap(function _callee$(_context) { 9142 while (1) switch (_context.prev = _context.next) { 9143 case 0: 9144 if (!(_this.speedAdjustment === newAdjustment)) { 9145 _context.next = 2; 9146 break; 9147 } 9148 return _context.abrupt("return"); 9149 case 2: 9150 _context.next = 4; 9151 return player.getPlaybackRate(); 9152 case 4: 9153 _context.t0 = _context.sent; 9154 _context.t1 = _this.speedAdjustment; 9155 _context.t2 = _context.t0 - _context.t1;
9156 _context.t3 = newAdjustment; 9157 newPlaybackRate = _context.t2 + _context.t3; 9158 _this.log("New playbackRate: ".concat(newPlaybackRate)); 9159 _context.next = 12; 9160 return player.setPlaybackRate(newPlaybackRate); 9161 case 12: 9162 _this.speedAdjustment = newAdjustment; 9163 case 13: 9164 case "end": 9165 return _context.stop(); 9166 } 9167 }, _callee); 9168 })); 9169 return function (_x, _x2) { 9170 return _ref.apply(this, arguments); 9171 }; 9172 }()); 9173 _this.logger = logger; 9174 _this.init(timingObject, _player, _objectSpread2(_objectSpread2({}, defaultOptions), options)); 9175 return _this; 9176 } 9177 _createClass(TimingSrcConnector, [{ 9178 key: "disconnect", 9179 value: function disconnect() { 9180 this.dispatchEvent(new Event('disconnect')); 9181 } 9182 9183 /** 9184 * @param {TimingObject} timingObject 9185 * @param {PlayerControls} player 9186 * @param {TimingSrcConnectorOptions} options 9187 * @return {Promise<void>} 9188 */ 9189 }, { 9190 key: "init", 9191 value: function () { 9192 var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(timingObject, player, options) { 9193 var _this2 = this; 9194 var playerUpdater, positionSync, timingObjectUpdater; 9195 return _regeneratorRuntime().wrap(function _callee2$(_context2) { 9196 while (1) switch (_context2.prev = _context2.next) { 9197 case 0: 9198 _context2.next = 2; 9199 return this.waitForTOReadyState(timingObject, 'open'); 9200 case 2: 9201 if (!(options.role === 'viewer')) { 9202 _context2.next = 10; 9203 break; 9204 } 9205 _context2.next = 5; 9206 return this.updatePlayer(timingObject, player, options); 9207 case 5: 9208 playerUpdater = subscribe(timingObject, 'change', function () { 9209 return _this2.updatePlayer(timingObject, player, options); 9210 }); 9211 positionSync = this.maintainPlaybackPosition(timingObject, player, options); 9212 this.addEventListener('disconnect', function () { 9213 positionSync.cancel(); 9214 playerUpdater.cancel(); 9215 }); 9216 _context2.next = 14; 9217 break; 9218 case 10: 9219 _context2.next = 12; 9220 return this.updateTimingObject(timingObject, player); 9221 case 12: 9222 timingObjectUpdater = subscribe(player, ['seeked', 'play', 'pause', 'ratechange'], function () { 9223 return _this2.updateTimingObject(timingObject, player); 9224 }, 'on', 'off'); 9225 this.addEventListener('disconnect', function () { 9226 return timingObjectUpdater.cancel(); 9227 }); 9228 case 14: 9229 case "end": 9230 return _context2.stop(); 9231 } 9232 }, _callee2, this); 9233 })); 9234 function init(_x3, _x4, _x5) { 9235 return _init.apply(this, arguments); 9236 } 9237 return init; 9238 }() 9239 /** 9240 * Sets the TimingObject's state to reflect that of the player 9241 * 9242 * @param {TimingObject} timingObject 9243 * @param {PlayerControls} player 9244 * @return {Promise<void>} 9245 */ 9246 }, { 9247 key: "updateTimingObject", 9248 value: function () { 9249 var _updateTimingObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(timingObject, player) { 9250 var _yield$Promise$all, _yield$Promise$all2, position, isPaused, playbackRate; 9251 return _regeneratorRuntime().wrap(function _callee3$(_context3) { 9252 while (1) switch (_context3.prev = _context3.next) { 9253 case 0: 9254 _context3.next = 2; 9255 return Promise.all([player.getCurrentTime(), player.getPaused(), player.getPlaybackRate()]); 9256 case 2: 9257 _yield$Promise$all = _context3.sent; 9258 _yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3); 9259 position = _yield$Promise$all2[0]; 9260 isPaused = _yield$Promise$all2[1]; 9261 playbackRate = _yield$Promise$all2[2]; 9262 timingObject.update({ 9263 position: position,
9264 velocity: isPaused ? 0 : playbackRate 9265 }); 9266 case 8: 9267 case "end": 9268 return _context3.stop(); 9269 } 9270 }, _callee3); 9271 })); 9272 function updateTimingObject(_x6, _x7) { 9273 return _updateTimingObject.apply(this, arguments); 9274 } 9275 return updateTimingObject; 9276 }() 9277 /** 9278 * Sets the player's timing state to reflect that of the TimingObject 9279 * 9280 * @param {TimingObject} timingObject 9281 * @param {PlayerControls} player 9282 * @param {TimingSrcConnectorOptions} options 9283 * @return {Promise<void>} 9284 */ 9285 }, { 9286 key: "updatePlayer", 9287 value: function () { 9288 var _updatePlayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(timingObject, player, options) { 9289 var _timingObject$query, position, velocity; 9290 return _regeneratorRuntime().wrap(function _callee5$(_context5) { 9291 while (1) switch (_context5.prev = _context5.next) { 9292 case 0: 9293 _timingObject$query = timingObject.query(), position = _timingObject$query.position, velocity = _timingObject$query.velocity; 9294 if (typeof position === 'number') { 9295 player.setCurrentTime(position); 9296 } 9297 if (!(typeof velocity === 'number')) { 9298 _context5.next = 25; 9299 break; 9300 } 9301 if (!(velocity === 0)) { 9302 _context5.next = 11; 9303 break; 9304 } 9305 _context5.next = 6; 9306 return player.getPaused(); 9307 case 6: 9308 _context5.t0 = _context5.sent; 9309 if (!(_context5.t0 === false)) { 9310 _context5.next = 9; 9311 break; 9312 } 9313 player.pause(); 9314 case 9: 9315 _context5.next = 25; 9316 break; 9317 case 11: 9318 if (!(velocity > 0)) { 9319 _context5.next = 25; 9320 break; 9321 } 9322 _context5.next = 14; 9323 return player.getPaused(); 9324 case 14: 9325 _context5.t1 = _context5.sent; 9326 if (!(_context5.t1 === true)) { 9327 _context5.next = 19; 9328 break; 9329 } 9330 _context5.next = 18; 9331 return player.play().catch( /*#__PURE__*/function () { 9332 var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err) { 9333 return _regeneratorRuntime().wrap(function _callee4$(_context4) { 9334 while (1) switch (_context4.prev = _context4.next) { 9335 case 0: 9336 if (!(err.name === 'NotAllowedError' && options.autoPlayMuted)) { 9337 _context4.next = 5; 9338 break; 9339 } 9340 _context4.next = 3; 9341 return player.setMuted(true); 9342 case 3: 9343 _context4.next = 5; 9344 return player.play().catch(function (err2) { 9345 return player.allowLogging && console.error('Couldn\'t play the video from TimingSrcConnector. Error:', err2); 9346 }); 9347 case 5: 9348 case "end": 9349 return _context4.stop(); 9350 } 9351 }, _callee4); 9352 })); 9353 return function (_x11) { 9354 return _ref2.apply(this, arguments); 9355 }; 9356 }()); 9357 case 18: 9358 this.updatePlayer(timingObject, player, options); 9359 case 19: 9360 _context5.next = 21; 9361 return player.getPlaybackRate(); 9362 case 21: 9363 _context5.t2 = _context5.sent; 9364 _context5.t3 = velocity; 9365 if (!(_context5.t2 !== _context5.t3)) { 9366 _context5.next = 25; 9367 break; 9368 } 9369 player.setPlaybackRate(velocity); 9370 case 25: 9371 case "end": 9372 return _context5.stop(); 9373 } 9374 }, _callee5, this); 9375 })); 9376 function updatePlayer(_x8, _x9, _x10) { 9377 return _updatePlayer.apply(this, arguments); 9378 } 9379 return updatePlayer; 9380 }() 9381 /** 9382 * Since video players do not play with 100% time precision, we need to closely monitor 9383 * our player to be sure it remains in sync with the TimingObject. 9384 * 9385 * If out of sync, we use the current conditions and the options provided to determine 9386 * whether to re-sync via setting currentTime or adjusting the playbackRate 9387 * 9388 * @param {TimingObject} timingObject 9389 * @param {PlayerControls} player 9390 * @param {TimingSrcConnectorOptions} options 9391 * @return {{cancel: (function(): void)}} 9392 */ 9393 }, { 9394 key: "maintainPlaybackPosition", 9395 value: function maintainPlaybackPosition(timingObject, player, options) { 9396 var _this3 = this; 9397 var allowedDrift = options.allowedDrift, 9398 maxAllowedDrift = options.maxAllowedDrift, 9399 minCheckInterval = options.minCheckInterval, 9400 maxRateAdjustment = options.maxRateAdjustment, 9401 maxTimeToCatchUp = options.maxTimeToCatchUp; 9402 var syncInterval = Math.min(maxTimeToCatchUp, Math.max(minCheckInterval, maxAllowedDrift)) * 1000; 9403 var check = /*#__PURE__*/function () { 9404 var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() { 9405 var diff, diffAbs, min, max, adjustment; 9406 return _regeneratorRuntime().wrap(function _callee6$(_context6) { 9407 while (1) switch (_context6.prev = _context6.next) { 9408 case 0: 9409 _context6.t0 = timingObject.query().velocity === 0; 9410 if (_context6.t0) { 9411 _context6.next = 6; 9412 break; 9413 } 9414 _context6.next = 4; 9415 return player.getPaused(); 9416 case 4: 9417 _context6.t1 = _context6.sent; 9418 _context6.t0 = _context6.t1 === true; 9419 case 6: 9420 if (!_context6.t0) { 9421 _context6.next = 8; 9422 break; 9423 } 9424 return _context6.abrupt("return"); 9425 case 8: 9426 _context6.t2 = timingObject.query().position; 9427 _context6.next = 11; 9428 return player.getCurrentTime(); 9429 case 11: 9430 _context6.t3 = _context6.sent; 9431 diff = _context6.t2 - _context6.t3; 9432 diffAbs = Math.abs(diff); 9433 _this3.log("Drift: ".concat(diff)); 9434 if (!(diffAbs > maxAllowedDrift)) { 9435 _context6.next = 22; 9436 break; 9437 } 9438 _context6.next = 18; 9439 return _this3.adjustSpeed(player, 0); 9440 case 18: 9441 player.setCurrentTime(timingObject.query().position); 9442 _this3.log('Resync by currentTime'); 9443 _context6.next = 29; 9444 break; 9445 case 22: 9446 if (!(diffAbs > allowedDrift)) { 9447 _context6.next = 29; 9448 break; 9449 } 9450 min = diffAbs / maxTimeToCatchUp; 9451 max = maxRateAdjustment; 9452 adjustment = min < max ? (max - min) / 2 : max; 9453 _context6.next = 28; 9454 return _this3.adjustSpeed(player, adjustment * Math.sign(diff)); 9455 case 28: 9456 _this3.log('Resync by playbackRate'); 9457 case 29: 9458 case "end": 9459 return _context6.stop(); 9460 } 9461 }, _callee6); 9462 })); 9463 return function check() { 9464 return _ref3.apply(this, arguments); 9465 }; 9466 }(); 9467 var interval = setInterval(function () { 9468 return check(); 9469 }, syncInterval); 9470 return { 9471 cancel: function cancel() { 9472 return clearInterval(interval); 9473 } 9474 }; 9475 } 9476 9477 /** 9478 * @param {string} msg 9479 */ 9480 }, { 9481 key: "log", 9482 value: function log(msg) { 9483 var _this$logger; 9484 (_this$logger = this.logger) === null || _this$logger === void 0 ? void 0 : _this$logger.call(this, "TimingSrcConnector: ".concat(msg)); 9485 } 9486 }, { 9487 key: "waitForTOReadyState", 9488 value: 9489 /** 9490 * @param {TimingObject} timingObject 9491 * @param {TConnectionState} state 9492 * @return {Promise<void>} 9493 */ 9494 function waitForTOReadyState(timingObject, state) { 9495 return new Promise(function (resolve) { 9496 var check = function check() { 9497 if (timingObject.readyState === state) { 9498 resolve(); 9499 } else { 9500 timingObject.addEventListener('readystatechange', check, { 9501 once: true 9502 }); 9503 } 9504 }; 9505 check(); 9506 }); 9507 } 9508 }]); 9509 return TimingSrcConnector; 9510}( /*#__PURE__*/_wrapNativeSuper(EventTarget)); 9511 9512var playerMap = new WeakMap(); 9513var readyMap = new WeakMap(); 9514var screenfull = {}; 9515var Player = /*#__PURE__*/function () { 9516 /** 9517 * Create a Player. 9518 * 9519 * @param {(HTMLIFrameElement|HTMLElement|string|jQuery)} element A reference to the Vimeo 9520 * player iframe, and id, or a jQuery object. 9521 * @param {object} [options] oEmbed parameters to use when creating an embed in the element. 9522 * @return {Player} 9523 */ 9524 function Player(element) { 9525 var _this = this; 9526 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 9527 _classCallCheck(this, Player); 9528 this.allowLogging = options.logging || options.logging === undefined; 9529 9530 /* global jQuery */ 9531 if (window.jQuery && element instanceof jQuery) { 9532 if (element.length > 1 && window.console && console.warn && this.allowLogging) { 9533 console.warn('A jQuery object with multiple elements was passed, using the first element.'); 9534 } 9535 element = element[0]; 9536 } 9537 9538 // Find an element by ID 9539 if (typeof document !== 'undefined' && typeof element === 'string') { 9540 element = document.getElementById(element); 9541 } 9542 9543 // Not an element! 9544 if (!isDomElement(element)) { 9545 throw new TypeError('You must pass either a valid element or a valid id.'); 9546 } 9547 9548 // Already initialized an embed in this div, so grab the iframe 9549 if (element.nodeName !== 'IFRAME') { 9550 var iframe = element.querySelector('iframe'); 9551 if (iframe) { 9552 element = iframe; 9553 } 9554 } 9555 9556 // iframe url is not a Vimeo url 9557 if (element.nodeName === 'IFRAME' && !isVimeoUrl(element.getAttribute('src') || '')) { 9558 throw new Error('The player element passed isnât a Vimeo embed.'); 9559 } 9560 9561 // If there is already a player object in the map, return that 9562 if (playerMap.has(element)) { 9563 return playerMap.get(element); 9564 } 9565 this._window = element.ownerDocument.defaultView; 9566 this.element = element; 9567 this.origin = '*'; 9568 var readyPromise = new npo_src(function (resolve, reject) { 9569 _this._onMessage = function (event) { 9570 if (!isVimeoUrl(event.origin) || _this.element.contentWindow !== event.source) { 9571 return; 9572 } 9573 if (_this.origin === '*') { 9574 _this.origin = event.origin; 9575 } 9576 var data = parseMessageData(event.data); 9577 var isError = data && data.event === 'error'; 9578 var isReadyError = isError && data.data && data.data.method === 'ready'; 9579 if (isReadyError) { 9580 var error = new Error(data.data.message);
9581 error.name = data.data.name; 9582 reject(error); 9583 return; 9584 } 9585 var isReadyEvent = data && data.event === 'ready'; 9586 var isPingResponse = data && data.method === 'ping'; 9587 if (isReadyEvent || isPingResponse) { 9588 _this.element.setAttribute('data-ready', 'true'); 9589 resolve(); 9590 return; 9591 } 9592 processData(_this, data); 9593 }; 9594 _this._window.addEventListener('message', _this._onMessage); 9595 if (_this.element.nodeName !== 'IFRAME') { 9596 var params = getOEmbedParameters(element, options); 9597 var url = getVimeoUrl(params); 9598 getOEmbedData(url, params, element).then(function (data) { 9599 var iframe = createEmbed(data, element); 9600 // Overwrite element with the new iframe, 9601 // but store reference to the original element 9602 _this.element = iframe; 9603 _this._originalElement = element; 9604 swapCallbacks(element, iframe); 9605 playerMap.set(_this.element, _this); 9606 return data; 9607 }).catch(reject); 9608 } 9609 }); 9610 9611 // Store a copy of this Player in the map 9612 readyMap.set(this, readyPromise); 9613 playerMap.set(this.element, this); 9614 9615 // Send a ping to the iframe so the ready promise will be resolved if 9616 // the player is already ready. 9617 if (this.element.nodeName === 'IFRAME') { 9618 postMessage(this, 'ping'); 9619 } 9620 if (screenfull.isEnabled) { 9621 var exitFullscreen = function exitFullscreen() { 9622 return screenfull.exit(); 9623 }; 9624 this.fullscreenchangeHandler = function () { 9625 if (screenfull.isFullscreen) { 9626 storeCallback(_this, 'event:exitFullscreen', exitFullscreen); 9627 } else { 9628 removeCallback(_this, 'event:exitFullscreen', exitFullscreen); 9629 } 9630 // eslint-disable-next-line 9631 _this.ready().then(function () { 9632 postMessage(_this, 'fullscreenchange', screenfull.isFullscreen); 9633 }); 9634 }; 9635 screenfull.on('fullscreenchange', this.fullscreenchangeHandler); 9636 } 9637 if (this.allowLogging) { 9638 logSurveyLink(); 9639 } 9640 return this; 9641 } 9642 9643 /** 9644 * Check to see if the URL is a Vimeo URL. 9645 * 9646 * @param {string} url The URL string. 9647 * @return {boolean} 9648 */ 9649 _createClass(Player, [{ 9650 key: "callMethod", 9651 value: 9652 /** 9653 * Get a promise for a method. 9654 * 9655 * @param {string} name The API method to call. 9656 * @param {...(string|number|object|Array)} args Arguments to send via postMessage. 9657 * @return {Promise} 9658 */ 9659 function callMethod(name) { 9660 var _this2 = this; 9661 for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { 9662 args[_key - 1] = arguments[_key]; 9663 } 9664 if (name === undefined || name === null) { 9665 throw new TypeError('You must pass a method name.'); 9666 } 9667 return new npo_src(function (resolve, reject) { 9668 // We are storing the resolve/reject handlers to call later, so we 9669 // canât return here. 9670 return _this2.ready().then(function () { 9671 storeCallback(_this2, name, { 9672 resolve: resolve, 9673 reject: reject 9674 }); 9675 if (args.length === 0) { 9676 args = {}; 9677 } else if (args.length === 1) { 9678 args = args[0]; 9679 } 9680 postMessage(_this2, name, args); 9681 }).catch(reject); 9682 }); 9683 } 9684 /** 9685 * Get a promise for the value of a player property. 9686 * 9687 * @param {string} name The property name 9688 * @return {Promise} 9689 */ 9690 }, { 9691 key: "get", 9692 value: function get(name) { 9693 var _this3 = this; 9694 return new npo_src(function (resolve, reject) { 9695 name = getMethodName(name, 'get'); 9696 9697 // We are storing the resolve/reject handlers to call later, so we 9698 // canât return here. 9699 return _this3.ready().then(function () { 9700 storeCallback(_this3, name, { 9701 resolve: resolve, 9702 reject: reject 9703 }); 9704 postMessage(_this3, name); 9705 }).catch(reject); 9706 }); 9707 } 9708 9709 /** 9710 * Get a promise for setting the value of a player property. 9711 * 9712 * @param {string} name The API method to call. 9713 * @param {mixed} value The value to set. 9714 * @return {Promise} 9715 */ 9716 }, { 9717 key: "set", 9718 value: function set(name, value) { 9719 var _this4 = this; 9720 return new npo_src(function (resolve, reject) { 9721 name = getMethodName(name, 'set'); 9722 if (value === undefined || value === null) { 9723 throw new TypeError('There must be a value to set.'); 9724 } 9725 9726 // We are storing the resolve/reject handlers to call later, so we 9727 // canât return here. 9728 return _this4.ready().then(function () { 9729 storeCallback(_this4, name, { 9730 resolve: resolve, 9731 reject: reject 9732 }); 9733 postMessage(_this4, name, value); 9734 }).catch(reject); 9735 }); 9736 } 9737 9738 /** 9739 * Add an event listener for the specified event. Will call the
9740 * callback with a single parameter, `data`, that contains the data for 9741 * that event. 9742 * 9743 * @param {string} eventName The name of the event. 9744 * @param {function(*)} callback The function to call when the event fires. 9745 * @return {void} 9746 */ 9747 }, { 9748 key: "on", 9749 value: function on(eventName, callback) { 9750 if (!eventName) { 9751 throw new TypeError('You must pass an event name.'); 9752 } 9753 if (!callback) { 9754 throw new TypeError('You must pass a callback function.'); 9755 } 9756 if (typeof callback !== 'function') { 9757 throw new TypeError('The callback must be a function.'); 9758 } 9759 var callbacks = getCallbacks(this, "event:".concat(eventName)); 9760 if (callbacks.length === 0) { 9761 this.callMethod('addEventListener', eventName).catch(function () { 9762 // Ignore the error. There will be an error event fired that 9763 // will trigger the error callback if they are listening. 9764 }); 9765 } 9766 storeCallback(this, "event:".concat(eventName), callback); 9767 } 9768 9769 /** 9770 * Remove an event listener for the specified event. Will remove all 9771 * listeners for that event if a `callback` isnât passed, or only that 9772 * specific callback if it is passed. 9773 * 9774 * @param {string} eventName The name of the event. 9775 * @param {function} [callback] The specific callback to remove. 9776 * @return {void} 9777 */ 9778 }, { 9779 key: "off", 9780 value: function off(eventName, callback) { 9781 if (!eventName) { 9782 throw new TypeError('You must pass an event name.'); 9783 } 9784 if (callback && typeof callback !== 'function') { 9785 throw new TypeError('The callback must be a function.'); 9786 } 9787 var lastCallback = removeCallback(this, "event:".concat(eventName), callback); 9788 9789 // If there are no callbacks left, remove the listener 9790 if (lastCallback) { 9791 this.callMethod('removeEventListener', eventName).catch(function (e) { 9792 // Ignore the error. There will be an error event fired that 9793 // will trigger the error callback if they are listening. 9794 }); 9795 } 9796 } 9797 9798 /** 9799 * A promise to load a new video. 9800 *
9801 * @promise LoadVideoPromise 9802 * @fulfill {number} The video with this id or url successfully loaded. 9803 * @reject {TypeError} The id was not a number. 9804 */ 9805 /** 9806 * Load a new video into this embed. The promise will be resolved if 9807 * the video is successfully loaded, or it will be rejected if it could 9808 * not be loaded. 9809 * 9810 * @param {number|string|object} options The id of the video, the url of the video, or an object with embed options. 9811 * @return {LoadVideoPromise} 9812 */ 9813 }, { 9814 key: "loadVideo", 9815 value: function loadVideo(options) { 9816 return this.callMethod('loadVideo', options); 9817 } 9818 9819 /** 9820 * A promise to perform an action when the Player is ready. 9821 * 9822 * @todo document errors 9823 * @promise LoadVideoPromise 9824 * @fulfill {void} 9825 */ 9826 /** 9827 * Trigger a function when the player iframe has initialized. You do not 9828 * need to wait for `ready` to trigger to begin adding event listeners 9829 * or calling other methods. 9830 * 9831 * @return {ReadyPromise} 9832 */ 9833 }, { 9834 key: "ready", 9835 value: function ready() { 9836 var readyPromise = readyMap.get(this) || new npo_src(function (resolve, reject) { 9837 reject(new Error('Unknown player. Probably unloaded.')); 9838 }); 9839 return npo_src.resolve(readyPromise); 9840 } 9841 9842 /** 9843 * A promise to add a cue point to the player. 9844 * 9845 * @promise AddCuePointPromise 9846 * @fulfill {string} The id of the cue point to use for removeCuePoint. 9847 * @reject {RangeError} the time was less than 0 or greater than the 9848 * videoâs duration. 9849 * @reject {UnsupportedError} Cue points are not supported with the current 9850 * player or browser. 9851 */ 9852 /** 9853 * Add a cue point to the player. 9854 * 9855 * @param {number} time The time for the cue point. 9856 * @param {object} [data] Arbitrary data to be returned with the cue point. 9857 * @return {AddCuePointPromise} 9858 */ 9859 }, { 9860 key: "addCuePoint", 9861 value: function addCuePoint(time) { 9862 var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 9863 return this.callMethod('addCuePoint', { 9864 time: time, 9865 data: data 9866 }); 9867 } 9868 9869 /** 9870 * A promise to remove a cue point from the player. 9871 * 9872 * @promise AddCuePointPromise 9873 * @fulfill {string} The id of the cue point that was removed. 9874 * @reject {InvalidCuePoint} The cue point with the specified id was not 9875 * found. 9876 * @reject {UnsupportedError} Cue points are not supported with the current 9877 * player or browser. 9878 */ 9879 /** 9880 * Remove a cue point from the video. 9881 * 9882 * @param {string} id The id of the cue point to remove. 9883 * @return {RemoveCuePointPromise} 9884 */ 9885 }, { 9886 key: "removeCuePoint", 9887 value: function removeCuePoint(id) { 9888 return this.callMethod('removeCuePoint', id); 9889 } 9890 9891 /** 9892 * A representation of a text track on a video. 9893 * 9894 * @typedef {Object} VimeoTextTrack 9895 * @property {string} language The ISO language code. 9896 * @property {string} kind The kind of track it is (captions or subtitles). 9897 * @property {string} label The humanâreadable label for the track. 9898 */ 9899 /** 9900 * A promise to enable a text track. 9901 * 9902 * @promise EnableTextTrackPromise 9903 * @fulfill {VimeoTextTrack} The text track that was enabled. 9904 * @reject {InvalidTrackLanguageError} No track was available with the 9905 * specified language. 9906 * @reject {InvalidTrackError} No track was available with the specified 9907 * language and kind. 9908 */ 9909 /** 9910 * Enable the text track with the specified language, and optionally the 9911 * specified kind (captions or subtitles). 9912 * 9913 * When set via the API, the track language will not change the viewerâs 9914 * stored preference. 9915 * 9916 * @param {string} language The twoâletter language code. 9917 * @param {string} [kind] The kind of track to enable (captions or subtitles). 9918 * @return {EnableTextTrackPromise} 9919 */ 9920 }, { 9921 key: "enableTextTrack", 9922 value: function enableTextTrack(language, kind) { 9923 if (!language) { 9924 throw new TypeError('You must pass a language.'); 9925 } 9926 return this.callMethod('enableTextTrack', { 9927 language: language, 9928 kind: kind 9929 }); 9930 } 9931 9932 /** 9933 * A promise to disable the active text track. 9934 * 9935 * @promise DisableTextTrackPromise 9936 * @fulfill {void} The track was disabled. 9937 */ 9938 /** 9939 * Disable the currently-active text track. 9940 * 9941 * @return {DisableTextTrackPromise} 9942 */ 9943 }, { 9944 key: "disableTextTrack", 9945 value: function disableTextTrack() { 9946 return this.callMethod('disableTextTrack'); 9947 } 9948 9949 /** 9950 * A promise to pause the video. 9951 * 9952 * @promise PausePromise 9953 * @fulfill {void} The video was paused. 9954 */ 9955 /** 9956 * Pause the video if itâs playing. 9957 * 9958 * @return {PausePromise} 9959 */ 9960 }, { 9961 key: "pause", 9962 value: function pause() { 9963 return this.callMethod('pause'); 9964 } 9965 9966 /** 9967 * A promise to play the video. 9968 * 9969 * @promise PlayPromise 9970 * @fulfill {void} The video was played. 9971 */ 9972 /**
vendor: 9,926 bytes, lines 9973-10295
9973 * Play the video if itâs paused. **Note:** on iOS and some other 9974 * mobile devices, you cannot programmatically trigger play. Once the 9975 * viewer has tapped on the play button in the player, however, you 9976 * will be able to use this function. 9977 * 9978 * @return {PlayPromise} 9979 */ 9980 }, { 9981 key: "play", 9982 value: function play() { 9983 return this.callMethod('play'); 9984 } 9985 9986 /** 9987 * Request that the player enters fullscreen. 9988 * @return {Promise} 9989 */ 9990 }, { 9991 key: "requestFullscreen", 9992 value: function requestFullscreen() { 9993 if (screenfull.isEnabled) { 9994 return screenfull.request(this.element); 9995 } 9996 return this.callMethod('requestFullscreen'); 9997 } 9998 9999 /** 10000 * Request that the player exits fullscreen. 10001 * @return {Promise} 10002 */ 10003 }, { 10004 key: "exitFullscreen", 10005 value: function exitFullscreen() { 10006 if (screenfull.isEnabled) { 10007 return screenfull.exit(); 10008 } 10009 return this.callMethod('exitFullscreen'); 10010 } 10011 10012 /** 10013 * Returns true if the player is currently fullscreen. 10014 * @return {Promise} 10015 */ 10016 }, { 10017 key: "getFullscreen", 10018 value: function getFullscreen() { 10019 if (screenfull.isEnabled) { 10020 return npo_src.resolve(screenfull.isFullscreen); 10021 } 10022 return this.get('fullscreen'); 10023 } 10024 10025 /** 10026 * Request that the player enters picture-in-picture. 10027 * @return {Promise} 10028 */ 10029 }, { 10030 key: "requestPictureInPicture", 10031 value: function requestPictureInPicture() { 10032 return this.callMethod('requestPictureInPicture'); 10033 } 10034 10035 /** 10036 * Request that the player exits picture-in-picture. 10037 * @return {Promise} 10038 */ 10039 }, { 10040 key: "exitPictureInPicture", 10041 value: function exitPictureInPicture() { 10042 return this.callMethod('exitPictureInPicture'); 10043 } 10044 10045 /** 10046 * Returns true if the player is currently picture-in-picture. 10047 * @return {Promise} 10048 */ 10049 }, { 10050 key: "getPictureInPicture", 10051 value: function getPictureInPicture() { 10052 return this.get('pictureInPicture'); 10053 } 10054 10055 /** 10056 * A promise to prompt the viewer to initiate remote playback. 10057 * 10058 * @promise RemotePlaybackPromptPromise 10059 * @fulfill {void} 10060 * @reject {NotFoundError} No remote playback device is available. 10061 */ 10062 /** 10063 * Request to prompt the user to initiate remote playback. 10064 * 10065 * @return {RemotePlaybackPromptPromise} 10066 */ 10067 }, { 10068 key: "remotePlaybackPrompt", 10069 value: function remotePlaybackPrompt() { 10070 return this.callMethod('remotePlaybackPrompt'); 10071 } 10072 10073 /** 10074 * A promise to unload the video. 10075 * 10076 * @promise UnloadPromise 10077 * @fulfill {void} The video was unloaded. 10078 */ 10079 /** 10080 * Return the player to its initial state. 10081 * 10082 * @return {UnloadPromise} 10083 */ 10084 }, { 10085 key: "unload", 10086 value: function unload() { 10087 return this.callMethod('unload'); 10088 } 10089 10090 /** 10091 * Cleanup the player and remove it from the DOM 10092 * 10093 * It won't be usable and a new one should be constructed 10094 * in order to do any operations. 10095 * 10096 * @return {Promise} 10097 */ 10098 }, { 10099 key: "destroy", 10100 value: function destroy() { 10101 var _this5 = this; 10102 return new npo_src(function (resolve) { 10103 readyMap.delete(_this5); 10104 playerMap.delete(_this5.element); 10105 if (_this5._originalElement) { 10106 playerMap.delete(_this5._originalElement); 10107 _this5._originalElement.removeAttribute('data-vimeo-initialized'); 10108 } 10109 if (_this5.element && _this5.element.nodeName === 'IFRAME' && _this5.element.parentNode) { 10110 // If we've added an additional wrapper div, remove that from the DOM. 10111 // If not, just remove the iframe element. 10112 if (_this5.element.parentNode.parentNode && _this5._originalElement && _this5._originalElement !== _this5.element.parentNode) { 10113 _this5.element.parentNode.parentNode.removeChild(_this5.element.parentNode); 10114 } else { 10115 _this5.element.parentNode.removeChild(_this5.element); 10116 } 10117 } 10118 10119 // If the clip is private there is a case where the element stays the 10120 // div element. Destroy should reset the div and remove the iframe child. 10121 if (_this5.element && _this5.element.nodeName === 'DIV' && _this5.element.parentNode) { 10122 _this5.element.removeAttribute('data-vimeo-initialized'); 10123 var iframe = _this5.element.querySelector('iframe'); 10124 if (iframe && iframe.parentNode) { 10125 // If we've added an additional wrapper div, remove that from the DOM. 10126 // If not, just remove the iframe element. 10127 if (iframe.parentNode.parentNode && _this5._originalElement && _this5._originalElement !== iframe.parentNode) { 10128 iframe.parentNode.parentNode.removeChild(iframe.parentNode); 10129 } else { 10130 iframe.parentNode.removeChild(iframe); 10131 } 10132 } 10133 } 10134 _this5._window.removeEventListener('message', _this5._onMessage); 10135 if (screenfull.isEnabled) { 10136 screenfull.off('fullscreenchange', _this5.fullscreenchangeHandler); 10137 } 10138 resolve(); 10139 }); 10140 } 10141 10142 /** 10143 * A promise to get the autopause behavior of the video. 10144 * 10145 * @promise GetAutopausePromise 10146 * @fulfill {boolean} Whether autopause is turned on or off. 10147 * @reject {UnsupportedError} Autopause is not supported with the current 10148 * player or browser. 10149 */ 10150 /** 10151 * Get the autopause behavior for this player. 10152 * 10153 * @return {GetAutopausePromise} 10154 */ 10155 }, { 10156 key: "getAutopause", 10157 value: function getAutopause() { 10158 return this.get('autopause'); 10159 } 10160 10161 /** 10162 * A promise to set the autopause behavior of the video. 10163 * 10164 * @promise SetAutopausePromise 10165 * @fulfill {boolean} Whether autopause is turned on or off. 10166 * @reject {UnsupportedError} Autopause is not supported with the current 10167 * player or browser. 10168 */ 10169 /** 10170 * Enable or disable the autopause behavior of this player. 10171 * 10172 * By default, when another video is played in the same browser, this 10173 * player will automatically pause. Unless you have a specific reason 10174 * for doing so, we recommend that you leave autopause set to the 10175 * default (`true`). 10176 * 10177 * @param {boolean} autopause 10178 * @return {SetAutopausePromise} 10179 */ 10180 }, { 10181 key: "setAutopause", 10182 value: function setAutopause(autopause) { 10183 return this.set('autopause', autopause); 10184 } 10185 10186 /** 10187 * A promise to get the buffered property of the video. 10188 * 10189 * @promise GetBufferedPromise 10190 * @fulfill {Array} Buffered Timeranges converted to an Array. 10191 */ 10192 /** 10193 * Get the buffered property of the video. 10194 * 10195 * @return {GetBufferedPromise} 10196 */ 10197 }, { 10198 key: "getBuffered", 10199 value: function getBuffered() { 10200 return this.get('buffered'); 10201 } 10202 10203 /** 10204 * @typedef {Object} CameraProperties 10205 * @prop {number} props.yaw - Number between 0 and 360. 10206 * @prop {number} props.pitch - Number between -90 and 90. 10207 * @prop {number} props.roll - Number between -180 and 180. 10208 * @prop {number} props.fov - The field of view in degrees. 10209 */ 10210 /** 10211 * A promise to get the camera properties of the player. 10212 * 10213 * @promise GetCameraPromise 10214 * @fulfill {CameraProperties} The camera properties. 10215 */ 10216 /** 10217 * For 360° videos get the camera properties for this player. 10218 * 10219 * @return {GetCameraPromise} 10220 */ 10221 }, { 10222 key: "getCameraProps", 10223 value: function getCameraProps() { 10224 return this.get('cameraProps'); 10225 } 10226 10227 /** 10228 * A promise to set the camera properties of the player. 10229 * 10230 * @promise SetCameraPromise 10231 * @fulfill {Object} The camera was successfully set. 10232 * @reject {RangeError} The range was out of bounds. 10233 */ 10234 /** 10235 * For 360° videos set the camera properties for this player. 10236 * 10237 * @param {CameraProperties} camera The camera properties 10238 * @return {SetCameraPromise} 10239 */ 10240 }, { 10241 key: "setCameraProps", 10242 value: function setCameraProps(camera) { 10243 return this.set('cameraProps', camera); 10244 } 10245 10246 /** 10247 * A representation of a chapter. 10248 * 10249 * @typedef {Object} VimeoChapter 10250 * @property {number} startTime The start time of the chapter. 10251 * @property {object} title The title of the chapter. 10252 * @property {number} index The place in the order of Chapters. Starts at 1. 10253 */ 10254 /** 10255 * A promise to get chapters for the video. 10256 * 10257 * @promise GetChaptersPromise 10258 * @fulfill {VimeoChapter[]} The chapters for the video. 10259 */ 10260 /** 10261 * Get an array of all the chapters for the video. 10262 * 10263 * @return {GetChaptersPromise} 10264 */ 10265 }, { 10266 key: "getChapters", 10267 value: function getChapters() { 10268 return this.get('chapters'); 10269 } 10270 10271 /** 10272 * A promise to get the currently active chapter. 10273 * 10274 * @promise GetCurrentChaptersPromise 10275 * @fulfill {VimeoChapter|undefined} The current chapter for the video. 10276 */ 10277 /** 10278 * Get the currently active chapter for the video. 10279 * 10280 * @return {GetCurrentChaptersPromise} 10281 */ 10282 }, { 10283 key: "getCurrentChapter", 10284 value: function getCurrentChapter() { 10285 return this.get('currentChapter'); 10286 } 10287 10288 /** 10289 * A promise to get the accent color of the player. 10290 * 10291 * @promise GetColorPromise 10292 * @fulfill {string} The hex color of the player. 10293 */ 10294 /** 10295 * Get the accent color for this player. Note this is deprecated
10295in place of `getColorTwo`. 10296 * 10297 * @return {GetColorPromise} 10298 */ 10299 }, { 10300 key: "getColor", 10301 value: function getColor() { 10302 return this.get('color'); 10303 } 10304 10305 /** 10306 * A promise to get all colors for the player in an array. 10307 * 10308 * @promise GetColorsPromise 10309 * @fulfill {string[]} The hex colors of the player. 10310 */ 10311 /** 10312 * Get all the colors for this player in an array: [colorOne, colorTwo, colorThree, colorFour] 10313 * 10314 * @return {GetColorPromise} 10315 */ 10316 }, { 10317 key: "getColors", 10318 value: function getColors() { 10319 return npo_src.all([this.get('colorOne'), this.get('colorTwo'), this.get('colorThree'), this.get('colorFour')]); 10320 } 10321 10322 /** 10323 * A promise to set the accent color of the player. 10324 * 10325 * @promise SetColorPromise 10326 * @fulfill {string} The color was successfully set. 10327 * @reject {TypeError} The string was not a valid hex or rgb color. 10328 * @reject {ContrastError} The color was set, but the contrast is 10329 * outside of the acceptable range. 10330 * @reject {EmbedSettingsError} The owner of the player has chosen to 10331 * use a specific color. 10332 */ 10333 /** 10334 * Set the accent color of this player to a hex or rgb string. Setting the 10335 * color may fail if the owner of the video has set their embed 10336 * preferences to force a specific color. 10337 * Note this is deprecated in place of `setColorTwo`. 10338 * 10339 * @param {string} color The hex or rgb color string to set. 10340 * @return {SetColorPromise} 10341 */ 10342 }, { 10343 key: "setColor", 10344 value: function setColor(color) { 10345 return this.set('color', color); 10346 } 10347 10348 /** 10349 * A promise to set all colors for the player. 10350 * 10351 * @promise SetColorsPromise 10352 * @fulfill {string[]} The colors were successfully set. 10353 * @reject {TypeError} The string was not a valid hex or rgb color. 10354 * @reject {ContrastError} The color was set, but the contrast is 10355 * outside of the acceptable range. 10356 * @reject {EmbedSettingsError} The owner of the player has chosen to 10357 * use a specific color. 10358 */ 10359 /** 10360 * Set the colors of this player to a hex or rgb string. Setting the 10361 * color may fail if the owner of the video has set their embed 10362 * preferences to force a specific color. 10363 * The colors should be passed in as an array: [colorOne, colorTwo, colorThree, colorFour]. 10364 * If a color should not be set, the index in the array can be left as null. 10365 * 10366 * @param {string[]} colors Array of the hex or rgb color strings to set. 10367 * @return {SetColorsPromise} 10368 */ 10369 }, { 10370 key: "setColors", 10371 value: function setColors(colors) { 10372 if (!Array.isArray(colors)) { 10373 return new npo_src(function (resolve, reject) { 10374 return reject(new TypeError('Argument must be an array.')); 10375 }); 10376 } 10377 var nullPromise = new npo_src(function (resolve) { 10378 return resolve(null); 10379 }); 10380 var colorPromises = [colors[0] ? this.set('colorOne', colors[0]) : nullPromise, colors[1] ? this.set('colorTwo', colors[1]) : nullPromise, colors[2] ? this.set('colorThree', colors[2]) : nullPromise, colors[3] ? this.set('colorFour', colors[3]) : nullPromise]; 10381 return npo_src.all(colorPromises); 10382 } 10383 10384 /** 10385 * A representation of a cue point. 10386 * 10387 * @typedef {Object} VimeoCuePoint 10388 * @property {number} time The time of the cue point. 10389 * @property {object} data The data passed when adding the cue point. 10390 * @property {string} id The unique id for use with removeCuePoint. 10391 */ 10392 /** 10393 * A promise to get the cue points of a video. 10394 * 10395 * @promise GetCuePointsPromise 10396 * @fulfill {VimeoCuePoint[]} The cue points added to the video. 10397 * @reject {UnsupportedError} Cue points are not supported with the current 10398 * player or browser. 10399 */ 10400 /** 10401 * Get an array of the cue points added to the video. 10402 * 10403 * @return {GetCuePointsPromise} 10404 */ 10405 }, { 10406 key: "getCuePoints", 10407 value: function getCuePoints() { 10408 return this.get('cuePoints'); 10409 } 10410 10411 /** 10412 * A promise to get the current time of the video. 10413 * 10414 * @promise GetCurrentTimePromise 10415 * @fulfill {number} The current time in seconds. 10416 */ 10417 /** 10418 * Get the current playback position in seconds. 10419 * 10420 * @return {GetCurrentTimePromise} 10421 */ 10422 }, { 10423 key: "getCurrentTime", 10424 value: function getCurrentTime() { 10425 return this.get('currentTime'); 10426 } 10427 10428 /** 10429 * A promise to set the current time of the video. 10430 * 10431 * @promise SetCurrentTimePromise 10432 * @fulfill {number} The actual current time that was set. 10433 * @reject {RangeError} the time was less than 0 or greater than the 10434 * videoâs duration. 10435 */ 10436 /** 10437 * Set the current playback position in seconds. If the player was 10438 * paused, it will remain paused. Likewise, if the player was playing, 10439 * it will resume playing once the video has buffered. 10440 * 10441 * You can provide an accurate time and the player will attempt to seek 10442 * to as close to that time as possible. The exact time will be the 10443 * fulfilled value of the promise. 10444 * 10445 * @param {number} currentTime 10446 * @return {SetCurrentTimePromise} 10447 */ 10448 }, { 10449 key: "setCurrentTime", 10450 value: function setCurrentTime(currentTime) { 10451 return this.set('currentTime', currentTime); 10452 } 10453 10454 /** 10455 * A promise to get the duration of the video. 10456 * 10457 * @promise GetDurationPromise 10458 * @fulfill {number} The duration in seconds. 10459 */ 10460 /** 10461 * Get the duration of the video in seconds. It will be rounded to the 10462 * nearest second before playback begins, and to the nearest thousandth 10463 * of a second after playback begins. 10464 * 10465 * @return {GetDurationPromise} 10466 */ 10467 }, { 10468 key: "getDuration", 10469 value: function getDuration() { 10470 return this.get('duration'); 10471 } 10472 10473 /** 10474 * A promise to get the ended state of the video. 10475 * 10476 * @promise GetEndedPromise 10477 * @fulfill {boolean} Whether or not the video has ended. 10478 */ 10479 /** 10480 * Get the ended state of the video. The video has ended if 10481 * `currentTime === duration`. 10482 * 10483 * @return {GetEndedPromise} 10484 */ 10485 }, { 10486 key: "getEnded", 10487 value: function getEnded() { 10488 return this.get('ended'); 10489 } 10490 10491 /** 10492 * A promise to get the loop state of the player. 10493 * 10494 * @promise GetLoopPromise 10495 * @fulfill {boolean} Whether or not the player is set to loop. 10496 */ 10497 /** 10498 * Get the loop state of the player. 10499 * 10500 * @return {GetLoopPromise} 10501 */ 10502 }, { 10503 key: "getLoop", 10504 value: function getLoop() { 10505 return this.get('loop'); 10506 } 10507 10508 /** 10509 * A promise to set the loop state of the player. 10510 * 10511 * @promise SetLoopPromise 10512 * @fulfill {boolean} The loop state that was set. 10513 */ 10514 /** 10515 * Set the loop state of the player. When set to `true`, the player 10516 * will start over immediately once playback ends. 10517 * 10518 * @param {boolean} loop 10519 * @return {SetLoopPromise} 10520 */ 10521 }, { 10522 key: "setLoop", 10523 value: function setLoop(loop) { 10524 return this.set('loop', loop); 10525 } 10526 10527 /** 10528 * A promise to set the muted state of the player. 10529 * 10530 * @promise SetMutedPromise 10531 * @fulfill {boolean} The muted state that was set. 10532 */ 10533 /** 10534 * Set the muted state of the player. When set to `true`, the player 10535 * volume will be muted. 10536 * 10537 * @param {boolean} muted 10538 * @return {SetMutedPromise} 10539 */ 10540 }, { 10541 key: "setMuted", 10542 value: function setMuted(muted) { 10543 return this.set('muted', muted); 10544 } 10545 10546 /** 10547 * A promise to get the muted state of the player. 10548 * 10549 * @promise GetMutedPromise 10550 * @fulfill {boolean} Whether or not the player is muted. 10551 */ 10552 /** 10553 * Get the muted state of the player. 10554 * 10555 * @return {GetMutedPromise} 10556 */ 10557 }, { 10558 key: "getMuted", 10559 value: function getMuted() { 10560 return this.get('muted'); 10561 } 10562 10563 /** 10564 * A promise to get the paused state of the player. 10565 * 10566 * @promise GetLoopPromise 10567 * @fulfill {boolean} Whether or not the video is paused. 10568 */ 10569 /** 10570 * Get the paused state of the player. 10571 * 10572 * @return {GetLoopPromise} 10573 */ 10574 }, { 10575 key: "getPaused", 10576 value: function getPaused() { 10577 return this.get('paused'); 10578 } 10579 10580 /** 10581 * A promise to get the playback rate of the player. 10582 * 10583 * @promise GetPlaybackRatePromise 10584 * @fulfill {number} The playback rate of the player on a scale from 0 to 2. 10585 */ 10586 /** 10587 * Get the playback rate of the player on a scale from `0` to `2`. 10588 * 10589 * @return {GetPlaybackRatePromise} 10590 */ 10591 }, { 10592 key: "getPlaybackRate", 10593 value: function getPlaybackRate() { 10594 return this.get('playbackRate'); 10595 } 10596 10597 /** 10598 * A promise to set the playbackrate of the player. 10599 * 10600 * @promise SetPlaybackRatePromise 10601 * @fulfill {number} The playback rate was set. 10602 * @reject {RangeError} The playback rate was less than 0 or greater than 2. 10603 */ 10604 /** 10605 * Set the playback rate of the player on a scale from `0` to `2`. When set 10606 * via the API, the playback rate will not be synchronized to other 10607 * players or stored as the viewer's preference. 10608 * 10609 * @param {number} playbackRate 10610 * @return {SetPlaybackRatePromise} 10611 */ 10612 }, { 10613 key: "setPlaybackRate", 10614 value: function setPlaybackRate(playbackRate) { 10615 return this.set('playbackRate', playbackRate); 10616 } 10617 10618 /** 10619 * A promise to get the played property of the video. 10620 * 10621 * @promise GetPlayedPromise 10622 * @fulfill {Array} Played Timeranges converted to an Array. 10623 */ 10624 /** 10625 * Get the played property of the video. 10626 * 10627 * @return {GetPlayedPromise} 10628 */ 10629 }, { 10630 key: "getPlayed", 10631 value: function getPlayed() { 10632 return this.get('played'); 10633 } 10634 10635 /** 10636 * A promise to get the qualities available of the current video. 10637 * 10638 * @promise GetQualitiesPromise 10639 * @fulfill {Array} The qualities of the video. 10640 */ 10641 /** 10642 * Get the qualities of the current video. 10643 * 10644 * @return {GetQualitiesPromise} 10645 */ 10646 }, { 10647 key: "getQualities", 10648 value: function getQualities() { 10649 return this.get('qualities'); 10650 } 10651 10652 /** 10653 * A promise to get the current set quality of the video. 10654 * 10655 * @promise GetQualityPromise 10656 * @fulfill {string} The current set quality. 10657 */ 10658 /** 10659 * Get the current set quality of the video. 10660 * 10661 * @return {GetQualityPromise} 10662 */ 10663 }, { 10664 key: "getQuality", 10665 value: function getQuality() { 10666 return this.get('quality'); 10667 } 10668 10669 /** 10670 * A promise to set the video quality. 10671 * 10672 * @promise SetQualityPromise 10673 * @fulfill {number} The quality was set. 10674 * @reject {RangeError} The quality is not available. 10675 */ 10676 /** 10677 * Set a video quality. 10678 * 10679 * @param {string} quality 10680 * @return {SetQualityPromise} 10681 */ 10682 }, { 10683 key: "setQuality", 10684 value: function setQuality(quality) { 10685 return this.set('quality', quality); 10686 } 10687 10688 /** 10689 * A promise to get the remote playback availability. 10690 * 10691 * @promise RemotePlaybackAvailabilityPromise 10692 * @fulfill {boolean} Whether remote playback is available. 10693 */ 10694 /** 10695 * Get the availability of remote playback. 10696 * 10697 * @return {RemotePlaybackAvailabilityPromise} 10698 */ 10699 }, { 10700 key: "getRemotePlaybackAvailability", 10701 value: function getRemotePlaybackAvailability() { 10702 return this.get('remotePlaybackAvailability'); 10703 } 10704 10705 /** 10706 * A promise to get the current remote playback state. 10707 * 10708 * @promise RemotePlaybackStatePromise 10709 * @fulfill {string} The state of the remote playback: connecting, connected, or disconnected. 10710 */ 10711 /** 10712 * Get the current remote playback state. 10713 * 10714 * @return {RemotePlaybackStatePromise} 10715 */ 10716 }, { 10717 key: "getRemotePlaybackState", 10718 value: function getRemotePlaybackState() { 10719 return this.get('remotePlaybackState'); 10720 } 10721 10722 /** 10723 * A promise to get the seekable property of the video. 10724 * 10725 * @promise GetSeekablePromise 10726 * @fulfill {Array} Seekable Timeranges converted to an Array. 10727 */ 10728 /** 10729 * Get the seekable property of the video. 10730 * 10731 * @return {GetSeekablePromise} 10732 */ 10733 }, { 10734 key: "getSeekable", 10735 value: function getSeekable() { 10736 return this.get('seekable'); 10737 } 10738 10739 /** 10740 * A promise to get the seeking property of the player. 10741 * 10742 * @promise GetSeekingPromise 10743 * @fulfill {boolean} Whether or not the player is currently seeking. 10744 */ 10745 /** 10746 * Get if the player is currently seeking. 10747 * 10748 * @return {GetSeekingPromise} 10749 */ 10750 }, { 10751 key: "getSeeking", 10752 value: function getSeeking() { 10753 return this.get('seeking'); 10754 } 10755 10756 /** 10757 * A promise to get the text tracks of a video. 10758 * 10759 * @promise GetTextTracksPromise 10760 * @fulfill {VimeoTextTrack[]} The text tracks associated with the video. 10761 */ 10762 /** 10763 * Get an array of the text tracks that exist for the video. 10764 * 10765 * @return {GetTextTracksPromise} 10766 */ 10767 }, { 10768 key: "getTextTracks", 10769 value: function getTextTracks() { 10770 return this.get('textTracks'); 10771 } 10772 10773 /** 10774 * A promise to get the embed code for the video. 10775 * 10776 * @promise GetVideoEmbedCodePromise 10777 * @fulfill {string} The `<iframe>` embed code for the video. 10778 */ 10779 /** 10780 * Get the `<iframe>` embed code for the video. 10781 * 10782 * @return {GetVideoEmbedCodePromise} 10783 */ 10784 }, { 10785 key: "getVideoEmbedCode", 10786 value: function getVideoEmbedCode() { 10787 return this.get('videoEmbedCode'); 10788 } 10789 10790 /** 10791 * A promise to get the id of the video. 10792 * 10793 * @promise GetVideoIdPromise 10794 * @fulfill {number} The id of the video. 10795 */ 10796 /** 10797 * Get the id of the video. 10798 * 10799 * @return {GetVideoIdPromise} 10800 */ 10801 }, { 10802 key: "getVideoId", 10803 value: function getVideoId() { 10804 return this.get('videoId'); 10805 } 10806 10807 /** 10808 * A promise to get the title of the video. 10809 * 10810 * @promise GetVideoTitlePromise 10811 * @fulfill {number} The title of the video. 10812 */ 10813 /** 10814 * Get the title of the video. 10815 * 10816 * @return {GetVideoTitlePromise} 10817 */ 10818 }, { 10819 key: "getVideoTitle", 10820 value: function getVideoTitle() { 10821 return this.get('videoTitle'); 10822 } 10823 10824 /** 10825 * A promise to get the native width of the video. 10826 * 10827 * @promise GetVideoWidthPromise 10828 * @fulfill {number} The native width of the video. 10829 */ 10830 /** 10831 * Get the native width of the currentlyâplaying video. The width of 10832 * the highestâresolution available will be used before playback begins. 10833 * 10834 * @return {GetVideoWidthPromise} 10835 */ 10836 }, { 10837 key: "getVideoWidth", 10838 value: function getVideoWidth() { 10839 return this.get('videoWidth'); 10840 } 10841 10842 /** 10843 * A promise to get the native height of the video. 10844 * 10845 * @promise GetVideoHeightPromise 10846 * @fulfill {number} The native height of the video. 10847 */ 10848 /** 10849 * Get the native height of the currentlyâplaying video. The height of 10850 * the highestâresolution available will be used before playback begins. 10851 * 10852 * @return {GetVideoHeightPromise} 10853 */ 10854 }, { 10855 key: "getVideoHeight", 10856 value: function getVideoHeight() { 10857 return this.get('videoHeight'); 10858 } 10859 10860 /** 10861 * A promise to get the vimeo.com url for the video. 10862 * 10863 * @promise GetVideoUrlPromise 10864 * @fulfill {number} The vimeo.com url for the video. 10865 * @reject {PrivacyError} The url isnât available because of the videoâs privacy setting.
10866 */ 10867 /** 10868 * Get the vimeo.com url for the video. 10869 * 10870 * @return {GetVideoUrlPromise} 10871 */ 10872 }, { 10873 key: "getVideoUrl", 10874 value: function getVideoUrl() { 10875 return this.get('videoUrl'); 10876 } 10877 10878 /** 10879 * A promise to get the volume level of the player. 10880 * 10881 * @promise GetVolumePromise 10882 * @fulfill {number} The volume level of the player on a scale from 0 to 1. 10883 */ 10884 /** 10885 * Get the current volume level of the player on a scale from `0` to `1`. 10886 * 10887 * Most mobile devices do not support an independent volume from the 10888 * system volume. In those cases, this method will always return `1`. 10889 * 10890 * @return {GetVolumePromise} 10891 */ 10892 }, { 10893 key: "getVolume", 10894 value: function getVolume() { 10895 return this.get('volume'); 10896 } 10897 10898 /** 10899 * A promise to set the volume level of the player. 10900 * 10901 * @promise SetVolumePromise 10902 * @fulfill {number} The volume was set. 10903 * @reject {RangeError} The volume was less than 0 or greater than 1. 10904 */ 10905 /** 10906 * Set the volume of the player on a scale from `0` to `1`. When set 10907 * via the API, the volume level will not be synchronized to other 10908 * players or stored as the viewerâs preference. 10909 * 10910 * Most mobile devices do not support setting the volume. An error will 10911 * *not* be triggered in that situation. 10912 * 10913 * @param {number} volume 10914 * @return {SetVolumePromise} 10915 */ 10916 }, { 10917 key: "setVolume", 10918 value: function setVolume(volume) { 10919 return this.set('volume', volume); 10920 } 10921 10922 /** @typedef {import('timing-object').ITimingObject} TimingObject */ 10923 /** @typedef {import('./lib/timing-src-connector.types').TimingSrcConnectorOptions} TimingSrcConnectorOptions */ 10924 /** @typedef {import('./lib/timing-src-connector').TimingSrcConnector} TimingSrcConnector */ 10925 10926 /** 10927 * Connects a TimingObject to the video player (https://webtiming.github.io/timingobject/) 10928 * 10929 * @param {TimingObject} timingObject 10930 * @param {TimingSrcConnectorOptions} options 10931 * 10932 * @return {Promise<TimingSrcConnector>} 10933 */ 10934 }, { 10935 key: "setTimingSrc", 10936 value: function () { 10937 var _setTimingSrc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(timingObject, options) { 10938 var _this6 = this; 10939 var connector; 10940 return _regeneratorRuntime().wrap(function _callee$(_context) { 10941 while (1) switch (_context.prev = _context.next) { 10942 case 0: 10943 if (timingObject) { 10944 _context.next = 2; 10945 break; 10946 } 10947 throw new TypeError('A Timing Object must be provided.'); 10948 case 2: 10949 _context.next = 4; 10950 return this.ready(); 10951 case 4: 10952 connector = new TimingSrcConnector(this, timingObject, options); 10953 postMessage(this, 'notifyTimingObjectConnect'); 10954 connector.addEventListener('disconnect', function () { 10955 return postMessage(_this6, 'notifyTimingObjectDisconnect'); 10956 }); 10957 return _context.abrupt("return", connector); 10958 case 8: 10959 case "end": 10960 return _context.stop(); 10961 } 10962 }, _callee, this); 10963 })); 10964 function setTimingSrc(_x, _x2) { 10965 return _setTimingSrc.apply(this, arguments); 10966 } 10967 return setTimingSrc; 10968 }() 10969 }], [{ 10970 key: "isVimeoUrl", 10971 value: function isVimeoUrl$1(url) { 10972 return isVimeoUrl(url); 10973 } 10974 }]); 10975 return Player; 10976}(); // Setup embed only if this is not a server runtime 10977if (!isServerRuntime) { 10978 screenfull = initializeScreenfull(); 10979 initializeEmbeds(); 10980 resizeEmbeds(); 10981 initAppendVideoMetadata(); 10982 checkUrlTimeParam(); 10983 updateDRMEmbeds(); 10984} 10985 10986/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Player); 10987 10988 10989/***/ }, 10990 10991/***/ "./node_modules/a11y-dialog/dist/a11y-dialog.esm.js" 10992/*!**********************************************************!*\ 10993 !*** ./node_modules/a11y-dialog/dist/a11y-dialog.esm.js ***! 10994 \**********************************************************/ 10995(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 10996 10997"use strict"; 10998__webpack_require__.r(__webpack_exports__); 10999/* harmony export */ __webpack_require__.d(__webpack_exports__, { 11000/* harmony export */ "default": () => (/* binding */ A11yDialog) 11001/* harmony export */ }); 11002var focusableSelectors = [ 11003 'a[href]:not([tabindex^="-"])', 11004 'area[href]:not([tabindex^="-"])', 11005 'input:not([type="hidden"]):not([type="radio"]):not([disabled]):not([tabindex^="-"])', 11006 'input[type="radio"]:not([disabled]):not([tabindex^="-"])', 11007 'select:not([disabled]):not([tabindex^="-"])', 11008 'textarea:not([disabled]):not([tabindex^="-"])', 11009 'button:not([disabled]):not([tabindex^="-"])', 11010 'iframe:not([tabindex^="-"])', 11011 'audio[controls]:not([tabindex^="-"])', 11012 'video[controls]:not([tabindex^="-"])', 11013 '[contenteditable]:not([tabindex^="-"])',
11014 '[tabindex]:not([tabindex^="-"])', 11015]; 11016 11017var TAB_KEY = 'Tab'; 11018var ESCAPE_KEY = 'Escape'; 11019 11020/** 11021 * Define the constructor to instantiate a dialog 11022 * 11023 * @constructor 11024 * @param {Element} element 11025 */ 11026function A11yDialog(element) { 11027 // Prebind the functions that will be bound in addEventListener and 11028 // removeEventListener to avoid losing references 11029 this._show = this.show.bind(this); 11030 this._hide = this.hide.bind(this); 11031 this._maintainFocus = this._maintainFocus.bind(this); 11032 this._bindKeypress = this._bindKeypress.bind(this); 11033 11034 this.$el = element; 11035 this.shown = false; 11036 this._id = this.$el.getAttribute('data-a11y-dialog') || this.$el.id; 11037 this._previouslyFocused = null; 11038 this._listeners = {}; 11039 11040 // Initialise everything needed for the dialog to work properly 11041 this.create(); 11042} 11043 11044/** 11045 * Set up everything necessary for the dialog to be functioning 11046 * 11047 * @param {(NodeList | Element | string)} targets 11048 * @return {this} 11049 */ 11050A11yDialog.prototype.create = function () { 11051 this.$el.setAttribute('aria-hidden', true); 11052 this.$el.setAttribute('aria-modal', true); 11053 this.$el.setAttribute('tabindex', -1); 11054 11055 if (!this.$el.hasAttribute('role')) { 11056 this.$el.setAttribute('role', 'dialog'); 11057 } 11058 11059 // Keep a collection of dialog openers, each of which will be bound a click 11060 // event listener to open the dialog 11061 this._openers = $$('[data-a11y-dialog-show="' + this._id + '"]'); 11062 this._openers.forEach( 11063 function (opener) { 11064 opener.addEventListener('click', this._show); 11065 }.bind(this) 11066 ); 11067 11068 // Keep a collection of dialog closers, each of which will be bound a click 11069 // event listener to close the dialog 11070 const $el = this.$el; 11071 11072 this._closers = $$('[data-a11y-dialog-hide]', this.$el) 11073 // This filter is necessary in case there are nested dialogs, so that 11074 // only closers from the current dialog are retrieved and effective 11075 .filter(function (closer) { 11076 // Testing for `[aria-modal="true"]` is not enough since this attribute 11077 // and the collect of closers is done at instantation time, when nested 11078 // dialogs might not have yet been instantiated. Note that if the dialogs 11079 // are manually instantiated, this could still fail because none of these 11080 // selectors would match; this would cause closers to close all parent 11081 // dialogs instead of just the current one 11082 return closer.closest('[aria-modal="true"], [data-a11y-dialog]') === $el 11083 }) 11084 .concat($$('[data-a11y-dialog-hide="' + this._id + '"]')); 11085 11086 this._closers.forEach( 11087 function (closer) { 11088 closer.addEventListener('click', this._hide); 11089 }.bind(this) 11090 ); 11091 11092 // Execute all callbacks registered for the `create` event 11093 this._fire('create'); 11094 11095 return this 11096}; 11097 11098/** 11099 * Show the dialog element, disable all the targets (siblings), trap the 11100 * current focus within it, listen for some specific key presses and fire all 11101 * registered callbacks for `show` event 11102 * 11103 * @param {CustomEvent} event 11104 * @return {this} 11105 */ 11106A11yDialog.prototype.show = function (event) { 11107 // If the dialog is already open, abort 11108 if (this.shown) { 11109 return this 11110 } 11111 11112 // Keep a reference to the currently focused element to be able to restore 11113 // it later 11114 this._previouslyFocused = document.activeElement; 11115 11116 // Due to a long lasting bug in Safari, clicking an interactive element (like 11117 // a <button>) does *not* move the focus to that element, which means 11118 // `document.activeElement` is whatever element is currently focused (like an 11119 // <input>), or the <body> element otherwise. We can work around that problem 11120 // by checking whether the focused element is the <body>, and if it, store the 11121 // click event target. 11122 // See: https://bugs.webkit.org/show_bug.cgi?id=22261 11123 const target = event && event.target ? event.target : null; 11124 if (target && Object.is(this._previouslyFocused, document.body)) { 11125 this._previouslyFocused = target; 11126 } 11127 11128 this.$el.removeAttribute('aria-hidden'); 11129 this.shown = true; 11130 11131 // Set the focus to the dialog element 11132 moveFocusToDialog(this.$el); 11133 11134 // Bind a focus event listener to the body element to make sure the focus 11135 // stays trapped inside the dialog while open, and start listening for some 11136 // specific key presses (TAB and ESC) 11137 document.body.addEventListener('focus', this._maintainFocus, true); 11138 document.addEventListener('keydown', this._bindKeypress); 11139 11140 // Execute all callbacks registered for the `show` event 11141 this._fire('show', event); 11142 11143 return this 11144}; 11145 11146/** 11147 * Hide the dialog element, enable all the targets (siblings), restore the 11148 * focus to the previously active element, stop listening for some specific 11149 * key presses and fire all registered callbacks for `hide` event 11150 * 11151 * @param {CustomEvent} event 11152 * @return {this} 11153 */ 11154A11yDialog.prototype.hide = function (event) { 11155 // If the dialog is already closed, abort 11156 if (!this.shown) { 11157 return this 11158 } 11159 11160 this.shown = false; 11161 this.$el.setAttribute('aria-hidden', 'true'); 11162 11163 // If there was a focused element before the dialog was opened (and it has a 11164 // `focus` method), restore the focus back to it 11165 // See: https://github.com/KittyGiraudel/a11y-dialog/issues/108 11166 if (this._previouslyFocused && this._previouslyFocused.focus) { 11167 this._previouslyFocused.focus(); 11168 } 11169 11170 // Remove the focus event listener to the body element and stop listening 11171 // for specific key presses 11172 document.body.removeEventListener('focus', this._maintainFocus, true); 11173 document.removeEventListener('keydown', this._bindKeypress); 11174 11175 // Execute all callbacks registered for the `hide` event 11176 this._fire('hide', event); 11177 11178 return this 11179}; 11180 11181/** 11182 * Destroy the current instance (after making sure the dialog has been hidden) 11183 * and remove all associated listeners from dialog openers and closers 11184 * 11185 * @return {this} 11186 */ 11187A11yDialog.prototype.destroy = function () { 11188 // Hide the dialog to avoid destroying an open instance 11189 this.hide(); 11190 11191 // Remove the click event listener from all dialog openers
11192 this._openers.forEach( 11193 function (opener) { 11194 opener.removeEventListener('click', this._show); 11195 }.bind(this) 11196 ); 11197 11198 // Remove the click event listener from all dialog closers 11199 this._closers.forEach( 11200 function (closer) { 11201 closer.removeEventListener('click', this._hide); 11202 }.bind(this) 11203 ); 11204 11205 // Execute all callbacks registered for the `destroy` event 11206 this._fire('destroy'); 11207 11208 // Keep an object of listener types mapped to callback functions 11209 this._listeners = {}; 11210 11211 return this 11212}; 11213 11214/** 11215 * Register a new callback for the given event type 11216 * 11217 * @param {string} type 11218 * @param {Function} handler 11219 */ 11220A11yDialog.prototype.on = function (type, handler) { 11221 if (typeof this._listeners[type] === 'undefined') { 11222 this._listeners[type] = []; 11223 } 11224 11225 this._listeners[type].push(handler); 11226 11227 return this 11228}; 11229 11230/** 11231 * Unregister an existing callback for the given event type 11232 * 11233 * @param {string} type 11234 * @param {Function} handler 11235 */ 11236A11yDialog.prototype.off = function (type, handler) { 11237 var index = (this._listeners[type] || []).indexOf(handler); 11238 11239 if (index > -1) { 11240 this._listeners[type].splice(index, 1); 11241 } 11242 11243 return this 11244}; 11245 11246/** 11247 * Iterate over all registered handlers for given type and call them all with 11248 * the dialog element as first argument, event as second argument (if any). Also 11249 * dispatch a custom event on the DOM element itself to make it possible to 11250 * react to the lifecycle of auto-instantiated dialogs. 11251 * 11252 * @access private 11253 * @param {string} type 11254 * @param {CustomEvent} event 11255 */ 11256A11yDialog.prototype._fire = function (type, event) { 11257 var listeners = this._listeners[type] || []; 11258 var domEvent = new CustomEvent(type, { detail: event }); 11259 11260 this.$el.dispatchEvent(domEvent); 11261 11262 listeners.forEach( 11263 function (listener) { 11264 listener(this.$el, event); 11265 }.bind(this) 11266 ); 11267}; 11268 11269/** 11270 * Private event handler used when listening to some specific key presses 11271 * (namely ESCAPE and TAB) 11272 * 11273 * @access private 11274 * @param {Event} event 11275 */ 11276A11yDialog.prototype._bindKeypress = function (event) { 11277 // This is an escape hatch in case there are nested dialogs, so the keypresses 11278 // are only reacted to for the most recent one 11279 const focused = document.activeElement; 11280 if (focused && focused.closest('[aria-modal="true"]') !== this.$el) return 11281 11282 // If the dialog is shown and the ESCAPE key is being pressed, prevent any 11283 // further effects from the ESCAPE key and hide the dialog, unless its role 11284 // is 'alertdialog', which should be modal 11285 if ( 11286 this.shown && 11287 event.key === ESCAPE_KEY && 11288 this.$el.getAttribute('role') !== 'alertdialog' 11289 ) { 11290 event.preventDefault(); 11291 this.hide(event); 11292 } 11293 11294 // If the dialog is shown and the TAB key is being pressed, make sure the 11295 // focus stays trapped within the dialog element 11296 if (this.shown && event.key === TAB_KEY) { 11297 trapTabKey(this.$el, event); 11298 } 11299}; 11300 11301/** 11302 * Private event handler used when making sure the focus stays within the 11303 * currently open dialog 11304 * 11305 * @access private 11306 * @param {Event} event 11307 */ 11308A11yDialog.prototype._maintainFocus = function (event) { 11309 // If the dialog is shown and the focus is not within a dialog element (either 11310 // this one or another one in case of nested dialogs) or within an element 11311 // with the `data-a11y-dialog-focus-trap-ignore` attribute, move it back to 11312 // its first focusable child. 11313 // See: https://github.com/KittyGiraudel/a11y-dialog/issues/177 11314 if ( 11315 this.shown && 11316 !event.target.closest('[aria-modal="true"]') && 11317 !event.target.closest('[data-a11y-dialog-ignore-focus-trap]') 11318 ) { 11319 moveFocusToDialog(this.$el); 11320 } 11321}; 11322 11323/** 11324 * Convert a NodeList into an array 11325 * 11326 * @param {NodeList} collection 11327 * @return {Array<Element>} 11328 */ 11329function toArray(collection) { 11330 return Array.prototype.slice.call(collection) 11331} 11332 11333/** 11334 * Query the DOM for nodes matching the given selector, scoped to context (or 11335 * the whole document) 11336 * 11337 * @param {String} selector 11338 * @param {Element} [context = document] 11339 * @return {Array<Element>} 11340 */ 11341function $$(selector, context) { 11342 return toArray((context || document).querySelectorAll(selector)) 11343} 11344 11345/** 11346 * Set the focus to the first element with `autofocus` with the element or the 11347 * element itself 11348 * 11349 * @param {Element} node 11350 */ 11351function moveFocusToDialog(node) { 11352 var focused = node.querySelector('[autofocus]') || node; 11353 11354 focused.focus(); 11355} 11356 11357/** 11358 * Get the focusable children of the given element 11359 * 11360 * @param {Element} node 11361 * @return {Array<Element>} 11362 */ 11363function getFocusableChildren(node) { 11364 return $$(focusableSelectors.join(','), node).filter(function (child) { 11365 return !!( 11366 child.offsetWidth || 11367 child.offsetHeight || 11368 child.getClientRects().length 11369 ) 11370 }) 11371} 11372 11373/** 11374 * Trap the focus inside the given element 11375 * 11376 * @param {Element} node 11377 * @param {Event} event 11378 */ 11379function trapTabKey(node, event) { 11380 var focusableChildren = getFocusableChildren(node); 11381 var focusedItemIndex = focusableChildren.indexOf(document.activeElement); 11382 11383 // If the SHIFT key is being pressed while tabbing (moving backwards) and 11384 // the currently focused item is the first one, move the focus to the last 11385 // focusable item from the dialog element 11386 if (event.shiftKey && focusedItemIndex === 0) { 11387 focusableChildren[focusableChildren.length - 1].focus(); 11388 event.preventDefault(); 11389 // If the SHIFT key is not being pressed (moving forwards) and the currently 11390 // focused item is the last one, move the focus to the first focusable item 11391 // from the dialog element 11392 } else if ( 11393 !event.shiftKey && 11394 focusedItemIndex === focusableChildren.length - 1 11395 ) { 11396 focusableChildren[0].focus(); 11397 event.preventDefault(); 11398 } 11399} 11400 11401function instantiateDialogs() { 11402 $$('[data-a11y-dialog]').forEach(function (node) { 11403 new A11yDialog(node); 11404 }); 11405} 11406 11407if (typeof document !== 'undefined') { 11408 if (document.readyState === 'loading') { 11409 document.addEventListener('DOMContentLoaded', instantiateDialogs); 11410 } else { 11411 if (window.requestAnimationFrame) { 11412 window.requestAnimationFrame(instantiateDialogs); 11413 } else { 11414 window.setTimeout(instantiateDialogs, 16); 11415 } 11416 } 11417} 11418 11419 11420 11421 11422/***/ }, 11423 11424/***/ "./node_modules/css-element-queries/src/ResizeSensor.js" 11425/*!**************************************************************!*\ 11426 !*** ./node_modules/css-element-queries/src/ResizeSensor.js ***! 11427 \**************************************************************/ 11428(module, exports, __webpack_require__) { 11429 11430"use strict"; 11431var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__; 11432 11433/** 11434 * Copyright Marc J. Schmidt. See the LICENSE file at the top-level 11435 * directory of this distribution and at 11436 * https://github.com/marcj/css-element-queries/blob/master/LICENSE. 11437 */ 11438(function (root, factory) { 11439 if (true) { 11440 !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory), 11441 __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? 11442 (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : 11443 __WEBPACK_AMD_DEFINE_FACTORY__), 11444 __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); 11445 } else // removed by dead control flow 11446{} 11447}(typeof window !== 'undefined' ? window : this, function () { 11448 11449 // Make sure it does not throw in a SSR (Server Side Rendering) situation 11450 if (typeof window === "undefined") { 11451 return null; 11452 } 11453 // https://github.com/Semantic-Org/Semantic-UI/issues/3855 11454 // https://github.com/marcj/css-element-queries/issues/257 11455 var globalWindow = typeof window != 'undefined' && window.Math == Math 11456 ? window 11457 : typeof self != 'undefined' && self.Math == Math 11458 ? self 11459 : Function('return this')(); 11460 // Only used for the dirty checking, so the event callback count is limited to max 1 call per fps per sensor. 11461 // In combination with the event based resize sensor this saves cpu time, because the sensor is too fast and 11462 // would generate too many unnecessary events. 11463 var requestAnimationFrame = globalWindow.requestAnimationFrame || 11464 globalWindow.mozRequestAnimationFrame || 11465 globalWindow.webkitRequestAnimationFrame || 11466 function (fn) { 11467 return globalWindow.setTimeout(fn, 20); 11468 }; 11469 11470 var cancelAnimationFrame = globalWindow.cancelAnimationFrame || 11471 globalWindow.mozCancelAnimationFrame || 11472 globalWindow.webkitCancelAnimationFrame || 11473 function (timer) { 11474 globalWindow.clearTimeout(timer); 11475 }; 11476 11477 /** 11478 * Iterate over each of the provided element(s). 11479 * 11480 * @param {HTMLElement|HTMLElement[]} elements 11481 * @param {Function} callback 11482 */ 11483 function forEachElement(elements, callback){ 11484 var elementsType = Object.prototype.toString.call(elements); 11485 var isCollectionTyped = ('[object Array]' === elementsType 11486 || ('[object NodeList]' === elementsType) 11487 || ('[object HTMLCollection]' === elementsType) 11488 || ('[object Object]' === elementsType) 11489 || ('undefined' !== typeof jQuery && elements instanceof jQuery) //jquery 11490 || ('undefined' !== typeof Elements && elements instanceof Elements) //mootools 11491 ); 11492 var i = 0, j = elements.length; 11493 if (isCollectionTyped) { 11494 for (; i < j; i++) { 11495 callback(elements[i]); 11496 } 11497 } else { 11498 callback(elements); 11499 } 11500 } 11501 11502 /** 11503 * Get element size 11504 * @param {HTMLElement} element 11505 * @returns {Object} {width, height} 11506 */ 11507 function getElementSize(element) { 11508 if (!element.getBoundingClientRect) { 11509 return { 11510 width: element.offsetWidth, 11511 height: element.offsetHeight 11512 } 11513 } 11514 11515 var rect = element.getBoundingClientRect(); 11516 return { 11517 width: Math.round(rect.width), 11518 height: Math.round(rect.height) 11519 } 11520 } 11521 11522 /** 11523 * Apply CSS styles to element. 11524 * 11525 * @param {HTMLElement} element 11526 * @param {Object} style 11527 */ 11528 function setStyle(element, style) { 11529 Object.keys(style).forEach(function(key) { 11530 element.style[key] = style[key]; 11531 }); 11532 } 11533 11534 /** 11535 * Class for dimension change detection. 11536 * 11537 * @param {Element|Element[]|Elements|jQuery} element 11538 * @param {Function} callback 11539 * 11540 * @constructor 11541 */ 11542 var ResizeSensor = function(element, callback) { 11543 //Is used when checking in reset() only for invisible elements 11544 var lastAnimationFrameForInvisibleCheck = 0; 11545 11546 /** 11547 * 11548 * @constructor 11549 */ 11550 function EventQueue() { 11551 var q = []; 11552 this.add = function(ev) { 11553 q.push(ev); 11554 }; 11555 11556 var i, j; 11557 this.call = function(sizeInfo) { 11558 for (i = 0, j = q.length; i < j; i++) { 11559 q[i].call(this, sizeInfo); 11560 } 11561 }; 11562 11563 this.remove = function(ev) { 11564 var newQueue = []; 11565 for(i = 0, j = q.length; i < j; i++) { 11566 if(q[i] !== ev) newQueue.push(q[i]); 11567 } 11568 q = newQueue; 11569 }; 11570 11571 this.length = function() { 11572 return q.length; 11573 } 11574 } 11575 11576 /** 11577 * 11578 * @param {HTMLElement} element 11579 * @param {Function} resized 11580 */ 11581 function attachResizeEvent(element, resized) { 11582 if (!element) return; 11583 if (element.resizedAttached) { 11584 element.resizedAttached.add(resized); 11585 return; 11586 } 11587 11588 element.resizedAttached = new EventQueue(); 11589 element.resizedAttached.add(resized); 11590 11591 element.resizeSensor = document.createElement('div'); 11592 element.resizeSensor.dir = 'ltr'; 11593 element.resizeSensor.className = 'resize-sensor'; 11594 11595 var style = { 11596 pointerEvents: 'none', 11597 position: 'absolute', 11598 left: '0px', 11599 top: '0px', 11600 right: '0px', 11601 bottom: '0px', 11602 overflow: 'hidden', 11603 zIndex: '-1', 11604 visibility: 'hidden', 11605 maxWidth: '100%' 11606 }; 11607 var styleChild = { 11608 position: 'absolute', 11609 left: '0px', 11610 top: '0px', 11611 transition: '0s', 11612 }; 11613 11614 setStyle(element.resizeSensor, style); 11615 11616 var expand = document.createElement('div'); 11617 expand.className = 'resize-sensor-expand'; 11618 setStyle(expand, style); 11619 11620 var expandChild = document.createElement('div'); 11621 setStyle(expandChild, styleChild); 11622 expand.appendChild(expandChild); 11623 11624 var shrink = document.createElement('div'); 11625 shrink.className = 'resize-sensor-shrink'; 11626 setStyle(shrink, style); 11627 11628 var shrinkChild = document.createElement('div'); 11629 setStyle(shrinkChild, styleChild); 11630 setStyle(shrinkChild, { width: '200%', height: '200%' }); 11631 shrink.appendChild(shrinkChild); 11632 11633 element.resizeSensor.appendChild(expand); 11634 element.resizeSensor.appendChild(shrink); 11635 element.appendChild(element.resizeSensor); 11636 11637 var computedStyle = window.getComputedStyle(element); 11638 var position = computedStyle ? computedStyle.getPropertyValue('position') : null; 11639 if ('absolute' !== position && 'relative' !== position && 'fixed' !== position && 'sticky' !== position) { 11640 element.style.position = 'relative'; 11641 } 11642 11643 var dirty = false; 11644 11645 //last request animation frame id used in onscroll event 11646 var rafId = 0; 11647 var size = getElementSize(element); 11648 var lastWidth = 0; 11649 var lastHeight = 0; 11650 var initialHiddenCheck = true; 11651 lastAnimationFrameForInvisibleCheck = 0; 11652 11653 var resetExpandShrink = function () { 11654 var width = element.offsetWidth; 11655 var height = element.offsetHeight; 11656 11657 expandChild.style.width = (width + 10) + 'px'; 11658 expandChild.style.height = (height + 10) + 'px'; 11659 11660 expand.scrollLeft = width + 10; 11661 expand.scrollTop = height + 10; 11662 11663 shrink.scrollLeft = width + 10; 11664 shrink.scrollTop = height + 10; 11665 }; 11666 11667 var reset = function() { 11668 // Check if element is hidden 11669 if (initialHiddenCheck) { 11670 var invisible = element.offsetWidth === 0 && element.offsetHeight === 0; 11671 if (invisible) { 11672 // Check in next frame 11673 if (!lastAnimationFrameForInvisibleCheck){ 11674 lastAnimationFrameForInvisibleCheck = requestAnimationFrame(function(){ 11675 lastAnimationFrameForInvisibleCheck = 0; 11676 reset(); 11677 }); 11678 } 11679 11680 return; 11681 } else { 11682 // Stop checking 11683 initialHiddenCheck = false; 11684 } 11685 } 11686 11687 resetExpandShrink(); 11688 }; 11689 element.resizeSensor.resetSensor = reset; 11690 11691 var onResized = function() { 11692 rafId = 0; 11693 11694 if (!dirty) return; 11695 11696 lastWidth = size.width; 11697 lastHeight = size.height; 11698 11699 if (element.resizedAttached) { 11700 element.resizedAttached.call(size); 11701 } 11702 }; 11703 11704
11704 var onScroll = function() { 11705 size = getElementSize(element); 11706 dirty = size.width !== lastWidth || size.height !== lastHeight; 11707 11708 if (dirty && !rafId) { 11709 rafId = requestAnimationFrame(onResized); 11710 } 11711 11712 reset(); 11713 }; 11714 11715 var addEvent = function(el, name, cb) { 11716 if (el.attachEvent) { 11717 el.attachEvent('on' + name, cb); 11718 } else { 11719 el.addEventListener(name, cb); 11720 } 11721 }; 11722 11723 addEvent(expand, 'scroll', onScroll); 11724 addEvent(shrink, 'scroll', onScroll); 11725 11726 // Fix for custom Elements and invisible elements 11727 lastAnimationFrameForInvisibleCheck = requestAnimationFrame(function(){ 11728 lastAnimationFrameForInvisibleCheck = 0; 11729 reset(); 11730 }); 11731 } 11732 11733 forEachElement(element, function(elem){ 11734 attachResizeEvent(elem, callback); 11735 }); 11736 11737 this.detach = function(ev) { 11738 // clean up the unfinished animation frame to prevent a potential endless requestAnimationFrame of reset 11739 if (!lastAnimationFrameForInvisibleCheck) { 11740 cancelAnimationFrame(lastAnimationFrameForInvisibleCheck); 11741 lastAnimationFrameForInvisibleCheck = 0; 11742 } 11743 ResizeSensor.detach(element, ev); 11744 }; 11745 11746 this.reset = function() { 11747 element.resizeSensor.resetSensor(); 11748 }; 11749 }; 11750 11751 ResizeSensor.reset = function(element) { 11752 forEachElement(element, function(elem){ 11753 elem.resizeSensor.resetSensor(); 11754 }); 11755 }; 11756 11757 ResizeSensor.detach = function(element, ev) { 11758 forEachElement(element, function(elem){ 11759 if (!elem) return; 11760 if(elem.resizedAttached && typeof ev === "function"){ 11761 elem.resizedAttached.remove(ev); 11762 if(elem.resizedAttached.length()) return; 11763 } 11764 if (elem.resizeSensor) { 11765 if (elem.contains(elem.resizeSensor)) { 11766 elem.removeChild(elem.resizeSensor); 11767 } 11768 delete elem.resizeSensor; 11769 delete elem.resizedAttached; 11770 } 11771 }); 11772 }; 11773 11774 if (typeof MutationObserver !== "undefined") { 11775 var observer = new MutationObserver(function (mutations) { 11776 for (var i in mutations) { 11777 if (mutations.hasOwnProperty(i)) { 11778 var items = mutations[i].addedNodes; 11779 for (var j = 0; j < items.length; j++) { 11780 if (items[j].resizeSensor) { 11781 ResizeSensor.reset(items[j]); 11782 } 11783 } 11784 } 11785 } 11786 }); 11787 11788 document.addEventListener("DOMContentLoaded", function (event) { 11789 observer.observe(document.body, { 11790 childList: true, 11791 subtree: true, 11792 }); 11793 }); 11794 } 11795 11796 return ResizeSensor; 11797 11798})); 11799 11800 11801/***/ }, 11802 11803/***/ "./node_modules/isomorphic-fetch/fetch-npm-browserify.js" 11804/*!***************************************************************!*\ 11805 !*** ./node_modules/isomorphic-fetch/fetch-npm-browserify.js ***! 11806 \***************************************************************/ 11807(module, __unused_webpack_exports, __webpack_require__) { 11808 11809// the whatwg-fetch polyfill installs the fetch() function 11810// on the global object (window or self) 11811// 11812// Return that as the export for use in Webpack, Browserify etc. 11813__webpack_require__(/*! whatwg-fetch */ "./node_modules/whatwg-fetch/fetch.js"); 11814module.exports = self.fetch.bind(self); 11815 11816 11817/***/ }, 11818 11819/***/ "./node_modules/lodash.debounce/index.js" 11820/*!***********************************************!*\ 11821 !*** ./node_modules/lodash.debounce/index.js ***! 11822 \***********************************************/ 11823(module, __unused_webpack_exports, __webpack_require__) { 11824 11825/** 11826 * lodash (Custom Build) <https://lodash.com/> 11827 * Build: `lodash modularize exports="npm" -o ./` 11828 * Copyright jQuery Foundation and other contributors <https://jquery.org/> 11829 * Released under MIT license <https://lodash.com/license> 11830 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 11831 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 11832 */ 11833 11834/** Used as the `TypeError` message for "Functions" methods. */
vendor: 8,136 bytes, lines 11835-12083
11835var FUNC_ERROR_TEXT = 'Expected a function'; 11836 11837/** Used as references for various `Number` constants. */ 11838var NAN = 0 / 0; 11839 11840/** `Object#toString` result references. */ 11841var symbolTag = '[object Symbol]'; 11842 11843/** Used to match leading and trailing whitespace. */ 11844var reTrim = /^\s+|\s+$/g; 11845 11846/** Used to detect bad signed hexadecimal string values. */ 11847var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; 11848 11849/** Used to detect binary string values. */ 11850var reIsBinary = /^0b[01]+$/i; 11851 11852/** Used to detect octal string values. */ 11853var reIsOctal = /^0o[0-7]+$/i; 11854 11855/** Built-in method references without a dependency on `root`. */ 11856var freeParseInt = parseInt; 11857 11858/** Detect free variable `global` from Node.js. */ 11859var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g; 11860 11861/** Detect free variable `self`. */ 11862var freeSelf = typeof self == 'object' && self && self.Object === Object && self; 11863 11864/** Used as a reference to the global object. */ 11865var root = freeGlobal || freeSelf || Function('return this')(); 11866 11867/** Used for built-in method references. */ 11868var objectProto = Object.prototype; 11869 11870/** 11871 * Used to resolve the 11872 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 11873 * of values. 11874 */ 11875var objectToString = objectProto.toString; 11876 11877/* Built-in method references for those with the same name as other `lodash` methods. */ 11878var nativeMax = Math.max, 11879 nativeMin = Math.min; 11880 11881/** 11882 * Gets the timestamp of the number of milliseconds that have elapsed since 11883 * the Unix epoch (1 January 1970 00:00:00 UTC). 11884 * 11885 * @static 11886 * @memberOf _ 11887 * @since 2.4.0 11888 * @category Date 11889 * @returns {number} Returns the timestamp. 11890 * @example 11891 * 11892 * _.defer(function(stamp) { 11893 * console.log(_.now() - stamp); 11894 * }, _.now()); 11895 * // => Logs the number of milliseconds it took for the deferred invocation. 11896 */ 11897var now = function() { 11898 return root.Date.now(); 11899}; 11900 11901/** 11902 * Creates a debounced function that delays invoking `func` until after `wait` 11903 * milliseconds have elapsed since the last time the debounced function was 11904 * invoked. The debounced function comes with a `cancel` method to cancel 11905 * delayed `func` invocations and a `flush` method to immediately invoke them. 11906 * Provide `options` to indicate whether `func` should be invoked on the 11907 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked 11908 * with the last arguments provided to the debounced function. Subsequent 11909 * calls to the debounced function return the result of the last `func` 11910 * invocation. 11911 * 11912 * **Note:** If `leading` and `trailing` options are `true`, `func` is 11913 * invoked on the trailing edge of the timeout only if the debounced function 11914 * is invoked more than once during the `wait` timeout. 11915 * 11916 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 11917 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 11918 * 11919 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 11920 * for details over the differences between `_.debounce` and `_.throttle`. 11921 * 11922 * @static 11923 * @memberOf _ 11924 * @since 0.1.0 11925 * @category Function 11926 * @param {Function} func The function to debounce. 11927 * @param {number} [wait=0] The number of milliseconds to delay. 11928 * @param {Object} [options={}] The options object. 11929 * @param {boolean} [options.leading=false] 11930 * Specify invoking on the leading edge of the timeout. 11931 * @param {number} [options.maxWait] 11932 * The maximum time `func` is allowed to be delayed before it's invoked. 11933 * @param {boolean} [options.trailing=true] 11934 * Specify invoking on the trailing edge of the timeout. 11935 * @returns {Function} Returns the new debounced function. 11936 * @example 11937 * 11938 * // Avoid costly calculations while the window size is in flux. 11939 * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); 11940 * 11941 * // Invoke `sendMail` when clicked, debouncing subsequent calls. 11942 * jQuery(element).on('click', _.debounce(sendMail, 300, { 11943 * 'leading': true, 11944 * 'trailing': false 11945 * })); 11946 * 11947 * // Ensure `batchLog` is invoked once after 1 second of debounced calls. 11948 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); 11949 * var source = new EventSource('/stream'); 11950 * jQuery(source).on('message', debounced); 11951 * 11952 * // Cancel the trailing debounced invocation. 11953 * jQuery(window).on('popstate', debounced.cancel); 11954 */ 11955function debounce(func, wait, options) { 11956 var lastArgs, 11957 lastThis, 11958 maxWait, 11959 result, 11960 timerId, 11961 lastCallTime, 11962 lastInvokeTime = 0, 11963 leading = false, 11964 maxing = false, 11965 trailing = true; 11966 11967 if (typeof func != 'function') { 11968 throw new TypeError(FUNC_ERROR_TEXT); 11969 } 11970 wait = toNumber(wait) || 0; 11971 if (isObject(options)) { 11972 leading = !!options.leading; 11973 maxing = 'maxWait' in options; 11974 maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; 11975 trailing = 'trailing' in options ? !!options.trailing : trailing; 11976 } 11977 11978 function invokeFunc(time) { 11979 var args = lastArgs, 11980 thisArg = lastThis; 11981 11982 lastArgs = lastThis = undefined; 11983 lastInvokeTime = time; 11984 result = func.apply(thisArg, args); 11985 return result; 11986 } 11987 11988 function leadingEdge(time) { 11989 // Reset any `maxWait` timer. 11990 lastInvokeTime = time; 11991 // Start the timer for the trailing edge. 11992 timerId = setTimeout(timerExpired, wait); 11993 // Invoke the leading edge. 11994 return leading ? invokeFunc(time) : result; 11995 } 11996 11997 function remainingWait(time) { 11998 var timeSinceLastCall = time - lastCallTime, 11999 timeSinceLastInvoke = time - lastInvokeTime, 12000 result = wait - timeSinceLastCall; 12001 12002 return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result; 12003 } 12004 12005 function shouldInvoke(time) { 12006 var timeSinceLastCall = time - lastCallTime, 12007 timeSinceLastInvoke = time - lastInvokeTime; 12008 12009 // Either this is the first call, activity has stopped and we're at the 12010 // trailing edge, the system time has gone backwards and we're treating 12011 // it as the trailing edge, or we've hit the `maxWait` limit. 12012 return (lastCallTime === undefined || (timeSinceLastCall >= wait) || 12013 (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); 12014 } 12015 12016 function timerExpired() { 12017 var time = now(); 12018 if (shouldInvoke(time)) { 12019 return trailingEdge(time); 12020 } 12021 // Restart the timer. 12022 timerId = setTimeout(timerExpired, remainingWait(time)); 12023 } 12024 12025 function trailingEdge(time) { 12026 timerId = undefined; 12027 12028 // Only invoke if we have `lastArgs` which means `func` has been 12029 // debounced at least once. 12030 if (trailing && lastArgs) { 12031 return invokeFunc(time); 12032 } 12033 lastArgs = lastThis = undefined; 12034 return result; 12035 } 12036 12037 function cancel() { 12038 if (timerId !== undefined) { 12039 clearTimeout(timerId); 12040 } 12041 lastInvokeTime = 0; 12042 lastArgs = lastCallTime = lastThis = timerId = undefined; 12043 } 12044 12045 function flush() { 12046 return timerId === undefined ? result : trailingEdge(now()); 12047 } 12048 12049 function debounced() { 12050 var time = now(), 12051 isInvoking = shouldInvoke(time); 12052 12053 lastArgs = arguments; 12054 lastThis = this; 12055 lastCallTime = time; 12056 12057 if (isInvoking) { 12058 if (timerId === undefined) { 12059 return leadingEdge(lastCallTime); 12060 } 12061 if (maxing) { 12062 // Handle invocations in a tight loop. 12063 timerId = setTimeout(timerExpired, wait); 12064 return invokeFunc(lastCallTime); 12065 } 12066 } 12067 if (timerId === undefined) { 12068 timerId = setTimeout(timerExpired, wait); 12069 } 12070 return result; 12071 } 12072 debounced.cancel = cancel; 12073 debounced.flush = flush; 12074 return debounced; 12075} 12076 12077/** 12078 * Checks if `value` is the 12079 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) 12080 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) 12081 * 12082 * @static 12083 * @memberOf _
12084 * @since 0.1.0 12085 * @category Lang 12086 * @param {*} value The value to check. 12087 * @returns {boolean} Returns `true` if `value` is an object, else `false`. 12088 * @example 12089 * 12090 * _.isObject({}); 12091 * // => true 12092 * 12093 * _.isObject([1, 2, 3]); 12094 * // => true 12095 * 12096 * _.isObject(_.noop); 12097 * // => true 12098 * 12099 * _.isObject(null); 12100 * // => false 12101 */ 12102function isObject(value) { 12103 var type = typeof value; 12104 return !!value && (type == 'object' || type == 'function'); 12105} 12106 12107/** 12108 * Checks if `value` is object-like. A value is object-like if it's not `null` 12109 * and has a `typeof` result of "object". 12110 * 12111 * @static 12112 * @memberOf _ 12113 * @since 4.0.0 12114 * @category Lang 12115 * @param {*} value The value to check. 12116 * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 12117 * @example 12118 * 12119 * _.isObjectLike({}); 12120 * // => true 12121 * 12122 * _.isObjectLike([1, 2, 3]); 12123 * // => true 12124 * 12125 * _.isObjectLike(_.noop); 12126 * // => false 12127 * 12128 * _.isObjectLike(null); 12129 * // => false 12130 */ 12131function isObjectLike(value) { 12132 return !!value && typeof value == 'object'; 12133} 12134 12135/** 12136 * Checks if `value` is classified as a `Symbol` primitive or object. 12137 * 12138 * @static 12139 * @memberOf _ 12140 * @since 4.0.0 12141 * @category Lang 12142 * @param {*} value The value to check. 12143 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. 12144 * @example 12145 * 12146 * _.isSymbol(Symbol.iterator); 12147 * // => true 12148 * 12149 * _.isSymbol('abc'); 12150 * // => false 12151 */ 12152function isSymbol(value) { 12153 return typeof value == 'symbol' || 12154 (isObjectLike(value) && objectToString.call(value) == symbolTag); 12155} 12156 12157/** 12158 * Converts `value` to a number. 12159 * 12160 * @static 12161 * @memberOf _ 12162 * @since 4.0.0 12163 * @category Lang 12164 * @param {*} value The value to process. 12165 * @returns {number} Returns the number. 12166 * @example 12167 * 12168 * _.toNumber(3.2); 12169 * // => 3.2 12170 * 12171 * _.toNumber(Number.MIN_VALUE); 12172 * // => 5e-324 12173 * 12174 * _.toNumber(Infinity); 12175 * // => Infinity 12176 * 12177 * _.toNumber('3.2'); 12178 * // => 3.2 12179 */ 12180function toNumber(value) { 12181 if (typeof value == 'number') { 12182 return value; 12183 } 12184 if (isSymbol(value)) { 12185 return NAN; 12186 } 12187 if (isObject(value)) { 12188 var other = typeof value.valueOf == 'function' ? value.valueOf() : value; 12189 value = isObject(other) ? (other + '') : other; 12190 } 12191 if (typeof value != 'string') { 12192 return value === 0 ? value : +value; 12193 } 12194 value = value.replace(reTrim, ''); 12195 var isBinary = reIsBinary.test(value); 12196 return (isBinary || reIsOctal.test(value)) 12197 ? freeParseInt(value.slice(2), isBinary ? 2 : 8) 12198 : (reIsBadHex.test(value) ? NAN : +value); 12199} 12200 12201module.exports = debounce; 12202 12203 12204/***/ }, 12205 12206/***/ "./node_modules/lodash.throttle/index.js" 12207/*!***********************************************!*\ 12208 !*** ./node_modules/lodash.throttle/index.js ***! 12209 \***********************************************/ 12210(module, __unused_webpack_exports, __webpack_require__) { 12211 12212/** 12213 * lodash (Custom Build) <https://lodash.com/> 12214 * Build: `lodash modularize exports="npm" -o ./` 12215 * Copyright jQuery Foundation and other contributors <https://jquery.org/> 12216 * Released under MIT license <https://lodash.com/license> 12217 * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> 12218 * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors 12219 */ 12220 12221/** Used as the `TypeError` message for "Functions" methods. */ 12222var FUNC_ERROR_TEXT = 'Expected a function'; 12223 12224/** Used as references for various `Number` constants. */ 12225var NAN = 0 / 0; 12226 12227/** `Object#toString` result references. */ 12228var symbolTag = '[object Symbol]'; 12229 12230/** Used to match leading and trailing whitespace. */ 12231var reTrim = /^\s+|\s+$/g; 12232 12233/** Used to detect bad signed hexadecimal string values. */ 12234var reIsBadHex = /^[-+]0x[0-9a-f]+$/i; 12235 12236/** Used to detect binary string values. */ 12237var reIsBinary = /^0b[01]+$/i; 12238 12239/** Used to detect octal string values. */ 12240var reIsOctal = /^0o[0-7]+$/i; 12241 12242/** Built-in method references without a dependency on `root`. */ 12243var freeParseInt = parseInt; 12244 12245/** Detect free variable `global` from Node.js. */ 12246var freeGlobal = typeof __webpack_require__.g == 'object' && __webpack_require__.g && __webpack_require__.g.Object === Object && __webpack_require__.g; 12247 12248/** Detect free variable `self`. */ 12249var freeSelf = typeof self == 'object' && self && self.Object === Object && self; 12250 12251/** Used as a reference to the global object. */ 12252var root = freeGlobal || freeSelf || Function('return this')(); 12253 12254/** Used for built-in method references. */ 12255var objectProto = Object.prototype; 12256 12257/** 12258 * Used to resolve the 12259 * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) 12260 * of values. 12261 */ 12262var objectToString = objectProto.toString; 12263 12264/* Built-in method references for those with the same name as other `lodash` methods. */ 12265var nativeMax = Math.max, 12266 nativeMin = Math.min; 12267 12268/** 12269 * Gets the timestamp of the number of milliseconds that have elapsed since 12270 * the Unix epoch (1 January 1970 00:00:00 UTC). 12271 * 12272 * @static 12273 * @memberOf _
vendor: 7,129 bytes, lines 12274-12480
12274 * @since 2.4.0 12275 * @category Date 12276 * @returns {number} Returns the timestamp. 12277 * @example 12278 * 12279 * _.defer(function(stamp) { 12280 * console.log(_.now() - stamp); 12281 * }, _.now()); 12282 * // => Logs the number of milliseconds it took for the deferred invocation. 12283 */ 12284var now = function() { 12285 return root.Date.now(); 12286}; 12287 12288/** 12289 * Creates a debounced function that delays invoking `func` until after `wait` 12290 * milliseconds have elapsed since the last time the debounced function was 12291 * invoked. The debounced function comes with a `cancel` method to cancel 12292 * delayed `func` invocations and a `flush` method to immediately invoke them. 12293 * Provide `options` to indicate whether `func` should be invoked on the 12294 * leading and/or trailing edge of the `wait` timeout. The `func` is invoked 12295 * with the last arguments provided to the debounced function. Subsequent 12296 * calls to the debounced function return the result of the last `func` 12297 * invocation. 12298 * 12299 * **Note:** If `leading` and `trailing` options are `true`, `func` is 12300 * invoked on the trailing edge of the timeout only if the debounced function 12301 * is invoked more than once during the `wait` timeout. 12302 * 12303 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 12304 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 12305 * 12306 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 12307 * for details over the differences between `_.debounce` and `_.throttle`. 12308 * 12309 * @static 12310 * @memberOf _ 12311 * @since 0.1.0 12312 * @category Function 12313 * @param {Function} func The function to debounce. 12314 * @param {number} [wait=0] The number of milliseconds to delay. 12315 * @param {Object} [options={}] The options object. 12316 * @param {boolean} [options.leading=false] 12317 * Specify invoking on the leading edge of the timeout. 12318 * @param {number} [options.maxWait] 12319 * The maximum time `func` is allowed to be delayed before it's invoked. 12320 * @param {boolean} [options.trailing=true] 12321 * Specify invoking on the trailing edge of the timeout. 12322 * @returns {Function} Returns the new debounced function. 12323 * @example 12324 * 12325 * // Avoid costly calculations while the window size is in flux. 12326 * jQuery(window).on('resize', _.debounce(calculateLayout, 150)); 12327 * 12328 * // Invoke `sendMail` when clicked, debouncing subsequent calls. 12329 * jQuery(element).on('click', _.debounce(sendMail, 300, { 12330 * 'leading': true, 12331 * 'trailing': false 12332 * })); 12333 * 12334 * // Ensure `batchLog` is invoked once after 1 second of debounced calls. 12335 * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 }); 12336 * var source = new EventSource('/stream'); 12337 * jQuery(source).on('message', debounced); 12338 * 12339 * // Cancel the trailing debounced invocation. 12340 * jQuery(window).on('popstate', debounced.cancel); 12341 */ 12342function debounce(func, wait, options) { 12343 var lastArgs, 12344 lastThis, 12345 maxWait, 12346 result, 12347 timerId, 12348 lastCallTime, 12349 lastInvokeTime = 0, 12350 leading = false, 12351 maxing = false, 12352 trailing = true; 12353 12354 if (typeof func != 'function') { 12355 throw new TypeError(FUNC_ERROR_TEXT); 12356 } 12357 wait = toNumber(wait) || 0; 12358 if (isObject(options)) { 12359 leading = !!options.leading; 12360 maxing = 'maxWait' in options; 12361 maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait; 12362 trailing = 'trailing' in options ? !!options.trailing : trailing; 12363 } 12364 12365 function invokeFunc(time) { 12366 var args = lastArgs, 12367 thisArg = lastThis; 12368 12369 lastArgs = lastThis = undefined; 12370 lastInvokeTime = time; 12371 result = func.apply(thisArg, args); 12372 return result; 12373 } 12374 12375 function leadingEdge(time) { 12376 // Reset any `maxWait` timer. 12377 lastInvokeTime = time; 12378 // Start the timer for the trailing edge. 12379 timerId = setTimeout(timerExpired, wait); 12380 // Invoke the leading edge. 12381 return leading ? invokeFunc(time) : result; 12382 } 12383 12384 function remainingWait(time) { 12385 var timeSinceLastCall = time - lastCallTime, 12386 timeSinceLastInvoke = time - lastInvokeTime, 12387 result = wait - timeSinceLastCall; 12388 12389 return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result; 12390 } 12391 12392 function shouldInvoke(time) { 12393 var timeSinceLastCall = time - lastCallTime, 12394 timeSinceLastInvoke = time - lastInvokeTime; 12395 12396 // Either this is the first call, activity has stopped and we're at the 12397 // trailing edge, the system time has gone backwards and we're treating 12398 // it as the trailing edge, or we've hit the `maxWait` limit. 12399 return (lastCallTime === undefined || (timeSinceLastCall >= wait) || 12400 (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait)); 12401 } 12402 12403 function timerExpired() { 12404 var time = now(); 12405 if (shouldInvoke(time)) { 12406 return trailingEdge(time); 12407 } 12408 // Restart the timer. 12409 timerId = setTimeout(timerExpired, remainingWait(time)); 12410 } 12411 12412 function trailingEdge(time) { 12413 timerId = undefined; 12414 12415 // Only invoke if we have `lastArgs` which means `func` has been 12416 // debounced at least once. 12417 if (trailing && lastArgs) { 12418 return invokeFunc(time); 12419 } 12420 lastArgs = lastThis = undefined; 12421 return result; 12422 } 12423 12424 function cancel() { 12425 if (timerId !== undefined) { 12426 clearTimeout(timerId); 12427 } 12428 lastInvokeTime = 0; 12429 lastArgs = lastCallTime = lastThis = timerId = undefined; 12430 } 12431 12432 function flush() { 12433 return timerId === undefined ? result : trailingEdge(now()); 12434 } 12435 12436 function debounced() { 12437 var time = now(), 12438 isInvoking = shouldInvoke(time); 12439 12440 lastArgs = arguments; 12441 lastThis = this; 12442 lastCallTime = time; 12443 12444 if (isInvoking) { 12445 if (timerId === undefined) { 12446 return leadingEdge(lastCallTime); 12447 } 12448 if (maxing) { 12449 // Handle invocations in a tight loop. 12450 timerId = setTimeout(timerExpired, wait); 12451 return invokeFunc(lastCallTime); 12452 } 12453 } 12454 if (timerId === undefined) { 12455 timerId = setTimeout(timerExpired, wait); 12456 } 12457 return result; 12458 } 12459 debounced.cancel = cancel; 12460 debounced.flush = flush; 12461 return debounced; 12462} 12463 12464/** 12465 * Creates a throttled function that only invokes `func` at most once per 12466 * every `wait` milliseconds. The throttled function comes with a `cancel` 12467 * method to cancel delayed `func` invocations and a `flush` method to 12468 * immediately invoke them. Provide `options` to indicate whether `func` 12469 * should be invoked on the leading and/or trailing edge of the `wait` 12470 * timeout. The `func` is invoked with the last arguments provided to the 12471 * throttled function. Subsequent calls to the throttled function return the 12472 * result of the last `func` invocation. 12473 * 12474 * **Note:** If `leading` and `trailing` options are `true`, `func` is 12475 * invoked on the trailing edge of the timeout only if the throttled function 12476 * is invoked more than once during the `wait` timeout. 12477 * 12478 * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred 12479 * until to the next tick, similar to `setTimeout` with a timeout of `0`. 12480 *
12481 * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/) 12482 * for details over the differences between `_.throttle` and `_.debounce`. 12483 * 12484 * @static 12485 * @memberOf _ 12486 * @since 0.1.0 12487 * @category Function 12488 * @param {Function} func The function to throttle. 12489 * @param {number} [wait=0] The number of milliseconds to throttle invocations to. 12490 * @param {Object} [options={}] The options object. 12491 * @param {boolean} [options.leading=true] 12492 * Specify invoking on the leading edge of the timeout. 12493 * @param {boolean} [options.trailing=true] 12494 * Specify invoking on the trailing edge of the timeout. 12495 * @returns {Function} Returns the new throttled function. 12496 * @example 12497 * 12498 * // Avoid excessively updating the position while scrolling. 12499 * jQuery(window).on('scroll', _.throttle(updatePosition, 100)); 12500 * 12501 * // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes. 12502 * var throttled = _.throttle(renewToken, 300000, { 'trailing': false }); 12503 * jQuery(element).on('click', throttled); 12504 * 12505 * // Cancel the trailing throttled invocation. 12506 * jQuery(window).on('popstate', throttled.cancel); 12507 */ 12508function throttle(func, wait, options) { 12509 var leading = true, 12510 trailing = true; 12511 12512 if (typeof func != 'function') { 12513 throw new TypeError(FUNC_ERROR_TEXT); 12514 } 12515 if (isObject(options)) { 12516 leading = 'leading' in options ? !!options.leading : leading; 12517 trailing = 'trailing' in options ? !!options.trailing : trailing; 12518 } 12519 return debounce(func, wait, { 12520 'leading': leading, 12521 'maxWait': wait, 12522 'trailing': trailing 12523 }); 12524} 12525 12526/** 12527 * Checks if `value` is the 12528 * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) 12529 * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) 12530 * 12531 * @static 12532 * @memberOf _ 12533 * @since 0.1.0 12534 * @category Lang 12535 * @param {*} value The value to check. 12536 * @returns {boolean} Returns `true` if `value` is an object, else `false`. 12537 * @example 12538 * 12539 * _.isObject({}); 12540 * // => true 12541 * 12542 * _.isObject([1, 2, 3]); 12543 * // => true 12544 * 12545 * _.isObject(_.noop); 12546 * // => true 12547 * 12548 * _.isObject(null); 12549 * // => false 12550 */ 12551function isObject(value) { 12552 var type = typeof value; 12553 return !!value && (type == 'object' || type == 'function'); 12554} 12555 12556/** 12557 * Checks if `value` is object-like. A value is object-like if it's not `null` 12558 * and has a `typeof` result of "object". 12559 * 12560 * @static 12561 * @memberOf _ 12562 * @since 4.0.0 12563 * @category Lang 12564 * @param {*} value The value to check. 12565 * @returns {boolean} Returns `true` if `value` is object-like, else `false`. 12566 * @example 12567 * 12568 * _.isObjectLike({}); 12569 * // => true 12570 * 12571 * _.isObjectLike([1, 2, 3]); 12572 * // => true 12573 * 12574 * _.isObjectLike(_.noop); 12575 * // => false 12576 * 12577 * _.isObjectLike(null); 12578 * // => false 12579 */ 12580function isObjectLike(value) { 12581 return !!value && typeof value == 'object'; 12582} 12583 12584/** 12585 * Checks if `value` is classified as a `Symbol` primitive or object. 12586 * 12587 * @static 12588 * @memberOf _ 12589 * @since 4.0.0 12590 * @category Lang 12591 * @param {*} value The value to check. 12592 * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. 12593 * @example 12594 * 12595 * _.isSymbol(Symbol.iterator); 12596 * // => true 12597 * 12598 * _.isSymbol('abc'); 12599 * // => false 12600 */ 12601function isSymbol(value) { 12602 return typeof value == 'symbol' || 12603 (isObjectLike(value) && objectToString.call(value) == symbolTag); 12604} 12605 12606/** 12607 * Converts `value` to a number. 12608 * 12609 * @static 12610 * @memberOf _ 12611 * @since 4.0.0 12612 * @category Lang 12613 * @param {*} value The value to process. 12614 * @returns {number} Returns the number. 12615 * @example 12616 * 12617 * _.toNumber(3.2); 12618 * // => 3.2 12619 * 12620 * _.toNumber(Number.MIN_VALUE); 12621 * // => 5e-324 12622 * 12623 * _.toNumber(Infinity); 12624 * // => Infinity 12625 * 12626 * _.toNumber('3.2'); 12627 * // => 3.2 12628 */ 12629function toNumber(value) { 12630 if (typeof value == 'number') { 12631 return value; 12632 } 12633 if (isSymbol(value)) { 12634 return NAN; 12635 } 12636 if (isObject(value)) { 12637 var other = typeof value.valueOf == 'function' ? value.valueOf() : value; 12638 value = isObject(other) ? (other + '') : other; 12639 } 12640 if (typeof value != 'string') { 12641 return value === 0 ? value : +value; 12642 } 12643 value = value.replace(reTrim, ''); 12644 var isBinary = reIsBinary.test(value); 12645 return (isBinary || reIsOctal.test(value)) 12646 ? freeParseInt(value.slice(2), isBinary ? 2 : 8) 12647 : (reIsBadHex.test(value) ? NAN : +value); 12648} 12649 12650module.exports = throttle; 12651 12652 12653/***/ }, 12654 12655/***/ "./node_modules/sticky-sidebar/dist/sticky-sidebar.js" 12656/*!************************************************************!*\ 12657 !*** ./node_modules/sticky-sidebar/dist/sticky-sidebar.js ***! 12658 \************************************************************/ 12659(module) { 12660 12661(function (global, factory) { 12662 true ? module.exports = factory() : 12663 0; 12664}(this, (function () { 'use strict'; 12665 12666var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); 12667 12668function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } 12669 12670/** 12671 * Sticky Sidebar JavaScript Plugin. 12672 * @version 3.3.1 12673 * @author Ahmed Bouhuolia <[email protected]> 12674 * @license The MIT License (MIT) 12675 */ 12676var StickySidebar = function () { 12677 12678 // ---------------------------------
vendor: 3,289 bytes, lines 12679-12799
12679 // # Define Constants 12680 // --------------------------------- 12681 // 12682 var EVENT_KEY = '.stickySidebar'; 12683 var DEFAULTS = { 12684 12685 /** 12686 * Additional top spacing of the element when it becomes sticky. 12687 * @type {Numeric|Function} 12688 */ 12689 topSpacing: 0, 12690 12691 /** 12692 * Additional bottom spacing of the element when it becomes sticky. 12693 * @type {Numeric|Function} 12694 */ 12695 bottomSpacing: 0, 12696 12697 /** 12698 * Container sidebar selector to know what the beginning and end of sticky element. 12699 * @type {String|False} 12700 */ 12701 containerSelector: false, 12702 12703 /** 12704 * Inner wrapper selector. 12705 * @type {String} 12706 */ 12707 innerWrapperSelector: '.inner-wrapper-sticky', 12708 12709 /** 12710 * The name of CSS class to apply to elements when they have become stuck. 12711 * @type {String|False} 12712 */ 12713 stickyClass: 'is-affixed', 12714 12715 /** 12716 * Detect when sidebar and its container change height so re-calculate their dimensions. 12717 * @type {Boolean} 12718 */ 12719 resizeSensor: true, 12720 12721 /** 12722 * The sidebar returns to its normal position if its width below this value. 12723 * @type {Numeric} 12724 */ 12725 minWidth: false 12726 }; 12727 12728 // --------------------------------- 12729 // # Class Definition 12730 // --------------------------------- 12731 // 12732 /** 12733 * Sticky Sidebar Class. 12734 * @public 12735 */ 12736 12737 var StickySidebar = function () { 12738 12739 /** 12740 * Sticky Sidebar Constructor. 12741 * @constructor 12742 * @param {HTMLElement|String} sidebar - The sidebar element or sidebar selector. 12743 * @param {Object} options - The options of sticky sidebar. 12744 */ 12745 function StickySidebar(sidebar) { 12746 var _this = this; 12747 12748 var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; 12749 12750 _classCallCheck(this, StickySidebar); 12751 12752 this.options = StickySidebar.extend(DEFAULTS, options); 12753 12754 // Sidebar element query if there's no one, throw error. 12755 this.sidebar = 'string' === typeof sidebar ? document.querySelector(sidebar) : sidebar; 12756 if ('undefined' === typeof this.sidebar) throw new Error("There is no specific sidebar element."); 12757 12758 this.sidebarInner = false; 12759 this.container = this.sidebar.parentElement; 12760 12761 // Current Affix Type of sidebar element. 12762 this.affixedType = 'STATIC'; 12763 this.direction = 'down'; 12764 this.support = { 12765 transform: false, 12766 transform3d: false 12767 }; 12768 12769 this._initialized = false; 12770 this._reStyle = false; 12771 this._breakpoint = false; 12772 this._resizeListeners = []; 12773 12774 // Dimensions of sidebar, container and screen viewport. 12775 this.dimensions = { 12776 translateY: 0, 12777 topSpacing: 0, 12778 lastTopSpacing: 0, 12779 bottomSpacing: 0, 12780 lastBottomSpacing: 0, 12781 sidebarHeight: 0, 12782 sidebarWidth: 0, 12783 containerTop: 0, 12784 containerHeight: 0, 12785 viewportHeight: 0, 12786 viewportTop: 0, 12787 lastViewportTop: 0 12788 }; 12789 12790 // Bind event handlers for referencability. 12791 ['handleEvent'].forEach(function (method) { 12792 _this[method] = _this[method].bind(_this); 12793 }); 12794 12795 // Initialize sticky sidebar for first time. 12796 this.initialize(); 12797 } 12798 12799 /**
12800 * Initializes the sticky sidebar by adding inner wrapper, define its container, 12801 * min-width breakpoint, calculating dimensions, adding helper classes and inline style. 12802 * @private 12803 */ 12804 12805 12806 _createClass(StickySidebar, [{ 12807 key: 'initialize', 12808 value: function initialize() { 12809 var _this2 = this; 12810 12811 this._setSupportFeatures(); 12812 12813 // Get sticky sidebar inner wrapper, if not found, will create one. 12814 if (this.options.innerWrapperSelector) { 12815 this.sidebarInner = this.sidebar.querySelector(this.options.innerWrapperSelector); 12816 12817 if (null === this.sidebarInner) this.sidebarInner = false; 12818 } 12819 12820 if (!this.sidebarInner) { 12821 var wrapper = document.createElement('div'); 12822 wrapper.setAttribute('class', 'inner-wrapper-sticky'); 12823 this.sidebar.appendChild(wrapper); 12824 12825 while (this.sidebar.firstChild != wrapper) { 12826 wrapper.appendChild(this.sidebar.firstChild); 12827 }this.sidebarInner = this.sidebar.querySelector('.inner-wrapper-sticky'); 12828 } 12829 12830 // Container wrapper of the sidebar. 12831 if (this.options.containerSelector) { 12832 var containers = document.querySelectorAll(this.options.containerSelector);
12833 containers = Array.prototype.slice.call(containers); 12834 12835 containers.forEach(function (container, item) { 12836 if (!container.contains(_this2.sidebar)) return; 12837 _this2.container = container; 12838 }); 12839 12840 if (!containers.length) throw new Error("The container does not contains on the sidebar."); 12841 } 12842 12843 // If top/bottom spacing is not function parse value to integer. 12844 if ('function' !== typeof this.options.topSpacing) this.options.topSpacing = parseInt(this.options.topSpacing) || 0; 12845 12846 if ('function' !== typeof this.options.bottomSpacing) this.options.bottomSpacing = parseInt(this.options.bottomSpacing) || 0; 12847 12848 // Breakdown sticky sidebar if screen width below `options.minWidth`. 12849 this._widthBreakpoint(); 12850 12851 // Calculate dimensions of sidebar, container and viewport. 12852 this.calcDimensions(); 12853 12854 // Affix sidebar in proper position. 12855 this.stickyPosition(); 12856 12857 // Bind all events. 12858 this.bindEvents(); 12859
vendor: 15,353 bytes, lines 12860-13282
12860 // Inform other properties the sticky sidebar is initialized. 12861 this._initialized = true; 12862 } 12863 12864 /** 12865 * Bind all events of sticky sidebar plugin. 12866 * @protected 12867 */ 12868 12869 }, { 12870 key: 'bindEvents', 12871 value: function bindEvents() { 12872 window.addEventListener('resize', this, { passive: true, capture: false }); 12873 window.addEventListener('scroll', this, { passive: true, capture: false }); 12874 12875 this.sidebar.addEventListener('update' + EVENT_KEY, this); 12876 12877 if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) { 12878 new ResizeSensor(this.sidebarInner, this.handleEvent); 12879 new ResizeSensor(this.container, this.handleEvent); 12880 } 12881 } 12882 12883 /** 12884 * Handles all events of the plugin. 12885 * @param {Object} event - Event object passed from listener. 12886 */ 12887 12888 }, { 12889 key: 'handleEvent', 12890 value: function handleEvent(event) { 12891 this.updateSticky(event); 12892 } 12893 12894 /** 12895 * Calculates dimensions of sidebar, container and screen viewpoint 12896 * @public 12897 */ 12898 12899 }, { 12900 key: 'calcDimensions', 12901 value: function calcDimensions() { 12902 if (this._breakpoint) return; 12903 var dims = this.dimensions; 12904 12905 // Container of sticky sidebar dimensions. 12906 dims.containerTop = StickySidebar.offsetRelative(this.container).top; 12907 dims.containerHeight = this.container.clientHeight; 12908 dims.containerBottom = dims.containerTop + dims.containerHeight; 12909 12910 // Sidebar dimensions. 12911 dims.sidebarHeight = this.sidebarInner.offsetHeight; 12912 dims.sidebarWidth = this.sidebar.offsetWidth; 12913 12914 // Screen viewport dimensions. 12915 dims.viewportHeight = window.innerHeight; 12916 12917 this._calcDimensionsWithScroll(); 12918 } 12919 12920 /** 12921 * Some dimensions values need to be up-to-date when scrolling the page. 12922 * @private 12923 */ 12924 12925 }, { 12926 key: '_calcDimensionsWithScroll', 12927 value: function _calcDimensionsWithScroll() { 12928 var dims = this.dimensions; 12929 12930 dims.sidebarLeft = StickySidebar.offsetRelative(this.sidebar).left; 12931 12932 dims.viewportTop = document.documentElement.scrollTop || document.body.scrollTop; 12933 dims.viewportBottom = dims.viewportTop + dims.viewportHeight; 12934 dims.viewportLeft = document.documentElement.scrollLeft || document.body.scrollLeft; 12935 12936 dims.topSpacing = this.options.topSpacing; 12937 dims.bottomSpacing = this.options.bottomSpacing; 12938 12939 if ('function' === typeof dims.topSpacing) dims.topSpacing = parseInt(dims.topSpacing(this.sidebar)) || 0; 12940 12941 if ('function' === typeof dims.bottomSpacing) dims.bottomSpacing = parseInt(dims.bottomSpacing(this.sidebar)) || 0; 12942 12943 if ('VIEWPORT-TOP' === this.affixedType) { 12944 // Adjust translate Y in the case decrease top spacing value. 12945 if (dims.topSpacing < dims.lastTopSpacing) { 12946 dims.translateY += dims.lastTopSpacing - dims.topSpacing; 12947 this._reStyle = true; 12948 } 12949 } else if ('VIEWPORT-BOTTOM' === this.affixedType) { 12950 // Adjust translate Y in the case decrease bottom spacing value. 12951 if (dims.bottomSpacing < dims.lastBottomSpacing) { 12952 dims.translateY += dims.lastBottomSpacing - dims.bottomSpacing; 12953 this._reStyle = true; 12954 } 12955 } 12956 12957 dims.lastTopSpacing = dims.topSpacing; 12958 dims.lastBottomSpacing = dims.bottomSpacing; 12959 } 12960 12961 /** 12962 * Determine whether the sidebar is bigger than viewport. 12963 * @public 12964 * @return {Boolean} 12965 */ 12966 12967 }, { 12968 key: 'isSidebarFitsViewport', 12969 value: function isSidebarFitsViewport() { 12970 return this.dimensions.sidebarHeight < this.dimensions.viewportHeight; 12971 } 12972 12973 /** 12974 * Observe browser scrolling direction top and down. 12975 */ 12976 12977 }, { 12978 key: 'observeScrollDir', 12979 value: function observeScrollDir() { 12980 var dims = this.dimensions; 12981 if (dims.lastViewportTop === dims.viewportTop) return; 12982 12983 var furthest = 'down' === this.direction ? Math.min : Math.max; 12984 12985 // If the browser is scrolling not in the same direction. 12986 if (dims.viewportTop === furthest(dims.viewportTop, dims.lastViewportTop)) this.direction = 'down' === this.direction ? 'up' : 'down'; 12987 } 12988 12989 /** 12990 * Gets affix type of sidebar according to current scrollTop and scrollLeft. 12991 * Holds all logical affix of the sidebar when scrolling up and down and when sidebar 12992 * is bigger than viewport and vice versa. 12993 * @public 12994 * @return {String|False} - Proper affix type. 12995 */ 12996 12997 }, { 12998 key: 'getAffixType', 12999 value: function getAffixType() { 13000 var dims = this.dimensions, 13001 affixType = false; 13002 13003 this._calcDimensionsWithScroll(); 13004 13005 var sidebarBottom = dims.sidebarHeight + dims.containerTop; 13006 var colliderTop = dims.viewportTop + dims.topSpacing; 13007 var colliderBottom = dims.viewportBottom - dims.bottomSpacing; 13008 13009 // When browser is scrolling top. 13010 if ('up' === this.direction) { 13011 if (colliderTop <= dims.containerTop) { 13012 dims.translateY = 0; 13013 affixType = 'STATIC'; 13014 } else if (colliderTop <= dims.translateY + dims.containerTop) { 13015 dims.translateY = colliderTop - dims.containerTop; 13016 affixType = 'VIEWPORT-TOP'; 13017 } else if (!this.isSidebarFitsViewport() && dims.containerTop <= colliderTop) { 13018 affixType = 'VIEWPORT-UNBOTTOM'; 13019 } 13020 // When browser is scrolling up. 13021 } else { 13022 // When sidebar element is not bigger than screen viewport. 13023 if (this.isSidebarFitsViewport()) { 13024 13025 if (dims.sidebarHeight + colliderTop >= dims.containerBottom) { 13026 dims.translateY = dims.containerBottom - sidebarBottom; 13027 affixType = 'CONTAINER-BOTTOM'; 13028 } else if (colliderTop >= dims.containerTop) { 13029 dims.translateY = colliderTop - dims.containerTop; 13030 affixType = 'VIEWPORT-TOP'; 13031 } 13032 // When sidebar element is bigger than screen viewport. 13033 } else { 13034 13035 if (dims.containerBottom <= colliderBottom) { 13036 dims.translateY = dims.containerBottom - sidebarBottom; 13037 affixType = 'CONTAINER-BOTTOM'; 13038 } else if (sidebarBottom + dims.translateY <= colliderBottom) { 13039 dims.translateY = colliderBottom - sidebarBottom; 13040 affixType = 'VIEWPORT-BOTTOM'; 13041 } else if (dims.containerTop + dims.translateY <= colliderTop) { 13042 affixType = 'VIEWPORT-UNBOTTOM'; 13043 } 13044 } 13045 } 13046 13047 // Make sure the translate Y is not bigger than container height. 13048 dims.translateY = Math.max(0, dims.translateY); 13049 dims.translateY = Math.min(dims.containerHeight, dims.translateY); 13050 13051 dims.lastViewportTop = dims.viewportTop; 13052 return affixType; 13053 } 13054 13055 /** 13056 * Gets inline style of sticky sidebar wrapper and inner wrapper according 13057 * to its affix type. 13058 * @private 13059 * @param {String} affixType - Affix type of sticky sidebar. 13060 * @return {Object} 13061 */ 13062 13063 }, { 13064 key: '_getStyle', 13065 value: function _getStyle(affixType) { 13066 if ('undefined' === typeof affixType) return; 13067 13068 var style = { inner: {}, outer: {} }; 13069 var dims = this.dimensions; 13070 13071 switch (affixType) { 13072 case 'VIEWPORT-TOP': 13073 style.inner = { position: 'fixed', top: dims.topSpacing, 13074 left: dims.sidebarLeft - dims.viewportLeft, width: dims.sidebarWidth }; 13075 break; 13076 case 'VIEWPORT-BOTTOM': 13077 style.inner = { position: 'fixed', top: 'auto', left: dims.sidebarLeft, 13078 bottom: dims.bottomSpacing, width: dims.sidebarWidth }; 13079 break; 13080 case 'CONTAINER-BOTTOM': 13081 case 'VIEWPORT-UNBOTTOM': 13082 var translate = this._getTranslate(0, dims.translateY + 'px'); 13083 13084 if (translate) style.inner = { transform: translate };else style.inner = { position: 'absolute', top: dims.translateY, width: dims.sidebarWidth }; 13085 break; 13086 } 13087 13088 switch (affixType) { 13089 case 'VIEWPORT-TOP': 13090 case 'VIEWPORT-BOTTOM': 13091 case 'VIEWPORT-UNBOTTOM': 13092 case 'CONTAINER-BOTTOM': 13093 style.outer = { height: dims.sidebarHeight, position: 'relative' }; 13094 break; 13095 } 13096 13097 style.outer = StickySidebar.extend({ height: '', position: '' }, style.outer); 13098 style.inner = StickySidebar.extend({ position: 'relative', top: '', left: '', 13099 bottom: '', width: '', transform: this._getTranslate() }, style.inner); 13100 13101 return style; 13102 } 13103 13104 /** 13105 * Cause the sidebar to be sticky according to affix type by adding inline 13106 * style, adding helper class and trigger events. 13107 * @function 13108 * @protected 13109 * @param {string} force - Update sticky sidebar position by force. 13110 */ 13111 13112 }, { 13113 key: 'stickyPosition', 13114 value: function stickyPosition(force) { 13115 if (this._breakpoint) return; 13116 13117 force = this._reStyle || force || false; 13118 13119 var affixType = this.getAffixType(); 13120 var style = this._getStyle(affixType); 13121 13122 if ((this.affixedType != affixType || force) && affixType) { 13123 var affixEvent = 'affix.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY; 13124 StickySidebar.eventTrigger(this.sidebar, affixEvent); 13125 13126 if ('STATIC' === affixType) StickySidebar.removeClass(this.sidebar, this.options.stickyClass);else StickySidebar.addClass(this.sidebar, this.options.stickyClass); 13127 13128 for (var key in style.outer) { 13129 this.sidebar.style[key] = style.outer[key]; 13130 } 13131 13132 for (var _key in style.inner) { 13133 var _unit2 = 'number' === typeof style.inner[_key] ? 'px' : ''; 13134 this.sidebarInner.style[_key] = style.inner[_key] + _unit2; 13135 } 13136 13137 var affixedEvent = 'affixed.' + affixType.toLowerCase().replace('viewport-', '') + EVENT_KEY; 13138 StickySidebar.eventTrigger(this.sidebar, affixedEvent); 13139 } else { 13140 if (this._initialized) this.sidebarInner.style.left = style.inner.left; 13141 } 13142 13143 this.affixedType = affixType; 13144 } 13145 13146 /** 13147 * Breakdown sticky sidebar when window width is below `options.minWidth` value. 13148 * @protected 13149 */ 13150 13151 }, { 13152 key: '_widthBreakpoint', 13153 value: function _widthBreakpoint() { 13154 13155 if (window.innerWidth <= this.options.minWidth) { 13156 this._breakpoint = true; 13157 this.affixedType = 'STATIC'; 13158 13159 this.sidebar.removeAttribute('style'); 13160 StickySidebar.removeClass(this.sidebar, this.options.stickyClass); 13161 this.sidebarInner.removeAttribute('style'); 13162 } else { 13163 this._breakpoint = false; 13164 } 13165 } 13166 13167 /** 13168 * Switches between functions stack for each event type, if there's no 13169 * event, it will re-initialize sticky sidebar. 13170 * @public 13171 */ 13172 13173 }, { 13174 key: 'updateSticky', 13175 value: function updateSticky() { 13176 var _this3 = this; 13177 13178 var event = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; 13179 13180 if (this._running) return; 13181 this._running = true; 13182 13183 (function (eventType) { 13184 13185 requestAnimationFrame(function () { 13186 switch (eventType) { 13187 // When browser is scrolling and re-calculate just dimensions 13188 // within scroll. 13189 case 'scroll': 13190 _this3._calcDimensionsWithScroll(); 13191 _this3.observeScrollDir(); 13192 _this3.stickyPosition(); 13193 break; 13194 13195 // When browser is resizing or there's no event, observe width 13196 // breakpoint and re-calculate dimensions. 13197 case 'resize': 13198 default: 13199 _this3._widthBreakpoint(); 13200 _this3.calcDimensions(); 13201 _this3.stickyPosition(true); 13202 break; 13203 } 13204 _this3._running = false; 13205 }); 13206 })(event.type); 13207 } 13208 13209 /** 13210 * Set browser support features to the public property. 13211 * @private 13212 */ 13213 13214 }, { 13215 key: '_setSupportFeatures', 13216 value: function _setSupportFeatures() { 13217 var support = this.support; 13218 13219 support.transform = StickySidebar.supportTransform(); 13220 support.transform3d = StickySidebar.supportTransform(true); 13221 } 13222 13223 /** 13224 * Get translate value, if the browser supports transfrom3d, it will adopt it. 13225 * and the same with translate. if browser doesn't support both return false. 13226 * @param {Number} y - Value of Y-axis. 13227 * @param {Number} x - Value of X-axis. 13228 * @param {Number} z - Value of Z-axis. 13229 * @return {String|False} 13230 */ 13231 13232 }, { 13233 key: '_getTranslate', 13234 value: function _getTranslate() { 13235 var y = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; 13236 var x = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; 13237 var z = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0; 13238 13239 if (this.support.transform3d) return 'translate3d(' + y + ', ' + x + ', ' + z + ')';else if (this.support.translate) return 'translate(' + y + ', ' + x + ')';else return false; 13240 } 13241 13242 /** 13243 * Destroy sticky sidebar plugin. 13244 * @public 13245 */ 13246 13247 }, { 13248 key: 'destroy', 13249 value: function destroy() { 13250 window.removeEventListener('resize', this, { caption: false }); 13251 window.removeEventListener('scroll', this, { caption: false }); 13252 13253 this.sidebar.classList.remove(this.options.stickyClass); 13254 this.sidebar.style.minHeight = ''; 13255 13256 this.sidebar.removeEventListener('update' + EVENT_KEY, this); 13257 13258 var styleReset = { inner: {}, outer: {} }; 13259 13260 styleReset.inner = { position: '', top: '', left: '', bottom: '', width: '', transform: '' }; 13261 styleReset.outer = { height: '', position: '' }; 13262 13263 for (var key in styleReset.outer) { 13264 this.sidebar.style[key] = styleReset.outer[key]; 13265 }for (var _key2 in styleReset.inner) { 13266 this.sidebarInner.style[_key2] = styleReset.inner[_key2]; 13267 }if (this.options.resizeSensor && 'undefined' !== typeof ResizeSensor) { 13268 ResizeSensor.detach(this.sidebarInner, this.handleEvent); 13269 ResizeSensor.detach(this.container, this.handleEvent); 13270 } 13271 } 13272 13273 /** 13274 * Determine if the browser supports CSS transform feature. 13275 * @function 13276 * @static 13277 * @param {Boolean} transform3d - Detect transform with translate3d. 13278 * @return {String} 13279 */ 13280 13281 }], [{ 13282 key: 'supportTransform',
vendor: 4,160 bytes, lines 13283-13423
13283 value: function supportTransform(transform3d) { 13284 var result = false, 13285 property = transform3d ? 'perspective' : 'transform', 13286 upper = property.charAt(0).toUpperCase() + property.slice(1), 13287 prefixes = ['Webkit', 'Moz', 'O', 'ms'], 13288 support = document.createElement('support'), 13289 style = support.style; 13290 13291 (property + ' ' + prefixes.join(upper + ' ') + upper).split(' ').forEach(function (property, i) { 13292 if (style[property] !== undefined) { 13293 result = property; 13294 return false; 13295 } 13296 }); 13297 return result; 13298 } 13299 13300 /** 13301 * Trigger custom event. 13302 * @static 13303 * @param {DOMObject} element - Target element on the DOM. 13304 * @param {String} eventName - Event name. 13305 * @param {Object} data - 13306 */ 13307 13308 }, { 13309 key: 'eventTrigger', 13310 value: function eventTrigger(element, eventName, data) { 13311 try { 13312 var event = new CustomEvent(eventName, { detail: data }); 13313 } catch (e) { 13314 var event = document.createEvent('CustomEvent'); 13315 event.initCustomEvent(eventName, true, true, data); 13316 } 13317 element.dispatchEvent(event); 13318 } 13319 13320 /** 13321 * Extend options object with defaults. 13322 * @function 13323 * @static 13324 */ 13325 13326 }, { 13327 key: 'extend', 13328 value: function extend(defaults, options) { 13329 var results = {}; 13330 for (var key in defaults) { 13331 if ('undefined' !== typeof options[key]) results[key] = options[key];else results[key] = defaults[key]; 13332 } 13333 return results; 13334 } 13335 13336 /** 13337 * Get current coordinates left and top of specific element. 13338 * @static 13339 */ 13340 13341 }, { 13342 key: 'offsetRelative', 13343 value: function offsetRelative(element) { 13344 var result = { left: 0, top: 0 }; 13345 13346 do { 13347 var offsetTop = element.offsetTop; 13348 var offsetLeft = element.offsetLeft; 13349 13350 if (!isNaN(offsetTop)) result.top += offsetTop; 13351 13352 if (!isNaN(offsetLeft)) result.left += offsetLeft; 13353 13354 element = 'BODY' === element.tagName ? element.parentElement : element.offsetParent; 13355 } while (element); 13356 return result; 13357 } 13358 13359 /** 13360 * Add specific class name to specific element. 13361 * @static 13362 * @param {ObjectDOM} element 13363 * @param {String} className 13364 */ 13365 13366 }, { 13367 key: 'addClass', 13368 value: function addClass(element, className) { 13369 if (!StickySidebar.hasClass(element, className)) { 13370 if (element.classList) element.classList.add(className);else element.className += ' ' + className; 13371 } 13372 } 13373 13374 /** 13375 * Remove specific class name to specific element 13376 * @static 13377 * @param {ObjectDOM} element 13378 * @param {String} className 13379 */ 13380 13381 }, { 13382 key: 'removeClass', 13383 value: function removeClass(element, className) { 13384 if (StickySidebar.hasClass(element, className)) { 13385 if (element.classList) element.classList.remove(className);else element.className = element.className.replace(new RegExp('(^|\\b)' + className.split(' ').join('|') + '(\\b|$)', 'gi'), ' '); 13386 } 13387 } 13388 13389 /** 13390 * Determine weather the element has specific class name. 13391 * @static 13392 * @param {ObjectDOM} element 13393 * @param {String} className 13394 */ 13395 13396 }, { 13397 key: 'hasClass', 13398 value: function hasClass(element, className) { 13399 if (element.classList) return element.classList.contains(className);else return new RegExp('(^| )' + className + '( |$)', 'gi').test(element.className); 13400 } 13401 }]); 13402 13403 return StickySidebar; 13404 }(); 13405 13406 return StickySidebar; 13407}(); 13408 13409// Global 13410// ------------------------- 13411window.StickySidebar = StickySidebar; 13412 13413return StickySidebar; 13414 13415}))); 13416 13417//# sourceMappingURL=sticky-sidebar.js.map 13418 13419 13420/***/ }, 13421 13422/***/ "./Static/javascript/helpers/disableTabbableChildren.ts" 13423/*!**************************************************************!*\
13424 !*** ./Static/javascript/helpers/disableTabbableChildren.ts ***! 13425 \**************************************************************/ 13426(__unused_webpack_module, exports) { 13427 13428"use strict"; 13429 13430Object.defineProperty(exports, "__esModule", ({ value: true })); 13431exports.disableTabbableChildren = void 0; 13432function disableTabbableChildren(parent) { 13433 var tabbableChildren = [].slice.call(parent.querySelectorAll('a, button, input, select, textarea')); 13434 tabbableChildren.forEach(function (child) { 13435 child.tabIndex = -1; 13436 }); 13437} 13438exports.disableTabbableChildren = disableTabbableChildren; 13439 13440 13441/***/ }, 13442 13443/***/ "./Static/javascript/helpers/enableTabbableChildren.ts" 13444/*!*************************************************************!*\ 13445 !*** ./Static/javascript/helpers/enableTabbableChildren.ts ***! 13446 \*************************************************************/ 13447(__unused_webpack_module, exports) { 13448 13449"use strict"; 13450 13451Object.defineProperty(exports, "__esModule", ({ value: true })); 13452exports.enableTabbableChildren = void 0; 13453function enableTabbableChildren(parent) { 13454 var tabbableChildren = [].slice.call(parent.querySelectorAll('a, button, input, select, textarea')); 13455 tabbableChildren.forEach(function (child) { 13456 child.tabIndex = null; 13457 }); 13458} 13459exports.enableTabbableChildren = enableTabbableChildren; 13460 13461 13462/***/ }, 13463 13464/***/ "./Static/javascript/helpers/getHeightOfHidden.ts" 13465/*!********************************************************!*\ 13466 !*** ./Static/javascript/helpers/getHeightOfHidden.ts ***! 13467 \********************************************************/ 13468(__unused_webpack_module, exports) { 13469 13470"use strict"; 13471 13472Object.defineProperty(exports, "__esModule", ({ value: true })); 13473exports.getHeightOfHidden = void 0; 13474function getHeightOfHidden(element) { 13475 var el = element; 13476 var parentStyles = el.parentElement.getAttribute('style'); 13477 var selfStyles = el.getAttribute('style'); 13478 el.parentElement.setAttribute('style', 'position: relative !important; width: 100% !important;'); 13479 el.setAttribute('style', 'opacity: 0 !important; height: auto !important; position: absolute !important;'); 13480 var elementHeight = element.offsetHeight; 13481 if (selfStyles) { 13482 el.setAttribute('style', selfStyles); 13483 } 13484 else { 13485 el.removeAttribute('style'); 13486 } 13487 if (parentStyles) { 13488 el.parentElement.setAttribute('style', parentStyles); 13489 } 13490 else { 13491 el.parentElement.removeAttribute('style'); 13492 } 13493 return elementHeight; 13494} 13495exports.getHeightOfHidden = getHeightOfHidden; 13496 13497 13498/***/ }, 13499 13500/***/ "./Static/javascript/helpers/lockBody.ts" 13501/*!***********************************************!*\ 13502 !*** ./Static/javascript/helpers/lockBody.ts ***! 13503 \***********************************************/ 13504(__unused_webpack_module, exports) { 13505 13506"use strict"; 13507 13508Object.defineProperty(exports, "__esModule", ({ value: true })); 13509exports.unlockBody = exports.lockBody = void 0; 13510function lockBody() { 13511 var scrollPosition = window.pageYOffset; 13512 var bodyStyles = document.body.style.cssText; 13513 // Use position: fixed to prevent scroll jumping when overflow is hidden 13514 document.body.style.overflow = 'hidden'; 13515 document.body.style.position = 'fixed'; 13516 document.body.style.top = "-".concat(scrollPosition, "px"); 13517 document.body.style.width = '100%'; 13518 // Pause navigation scroll handling while body is locked 13519 var mainNav = window.mainNavigation; 13520 if (mainNav) { 13521 mainNav.scrollLocked = true; 13522 } 13523 return { scrollPosition: scrollPosition, cssText: bodyStyles }; 13524} 13525exports.lockBody = lockBody; 13526function unlockBody(state) { 13527 // Handle legacy string format for backwards compatibility 13528 if (typeof state === 'string') { 13529 document.body.style.cssText = state || ''; 13530 return; 13531 } 13532 // Restore original styles 13533 document.body.style.cssText = state.cssText || ''; 13534 // Update navigation state before restoring scroll position 13535 var mainNav = window.mainNavigation; 13536 if (mainNav) { 13537 // Set lastScrollPosition to match where we're scrolling to 13538 mainNav.lastScrollPosition = state.scrollPosition; 13539 // Resume scroll handling 13540 mainNav.scrollLocked = false; 13541 } 13542 // Restore scroll position 13543 window.scrollTo(0, state.scrollPosition); 13544} 13545exports.unlockBody = unlockBody; 13546 13547 13548/***/ }, 13549 13550/***/ "./Static/javascript/helpers/waitForImages.ts" 13551/*!****************************************************!*\ 13552 !*** ./Static/javascript/helpers/waitForImages.ts ***! 13553 \****************************************************/ 13554(__unused_webpack_module, exports, __webpack_require__) { 13555 13556"use strict"; 13557/* provided dependency */ var Promise = __webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js"); 13558 13559Object.defineProperty(exports, "__esModule", ({ value: true })); 13560exports.waitForImages = void 0; 13561function waitForImages(containerElement) { 13562 var images = Array.from(containerElement.querySelectorAll('img')); 13563 if (images.length === 0) { 13564 return Promise.resolve(); 13565 } 13566 var imagePromises = images.map(function (image) { 13567 return new Promise(function (resolve) { 13568 if (image.complete) { 13569 resolve(); 13570 return; 13571 } 13572 var handleLoadComplete = function () { 13573 image.removeEventListener('load', handleLoadComplete); 13574 image.removeEventListener('error', handleLoadComplete); 13575 resolve(); 13576 }; 13577 image.addEventListener('load', handleLoadComplete); 13578 image.addEventListener('error', handleLoadComplete); 13579 }); 13580 });
13581 return Promise.all(imagePromises).then(function () { }); 13582} 13583exports.waitForImages = waitForImages; 13584 13585 13586/***/ }, 13587 13588/***/ "./Static/javascript/index.ts" 13589/*!************************************!*\ 13590 !*** ./Static/javascript/index.ts ***! 13591 \************************************/ 13592(__unused_webpack_module, exports, __webpack_require__) { 13593 13594"use strict"; 13595 13596var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 13597 if (k2 === undefined) k2 = k; 13598 var desc = Object.getOwnPropertyDescriptor(m, k); 13599 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 13600 desc = { enumerable: true, get: function() { return m[k]; } }; 13601 } 13602 Object.defineProperty(o, k2, desc); 13603}) : (function(o, m, k, k2) { 13604 if (k2 === undefined) k2 = k; 13605 o[k2] = m[k]; 13606})); 13607var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 13608 Object.defineProperty(o, "default", { enumerable: true, value: v }); 13609}) : function(o, v) { 13610 o["default"] = v; 13611}); 13612var __importStar = (this && this.__importStar) || function (mod) { 13613 if (mod && mod.__esModule) return mod; 13614 var result = {}; 13615 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 13616 __setModuleDefault(result, mod); 13617 return result; 13618}; 13619Object.defineProperty(exports, "__esModule", ({ value: true })); 13620var show_hide_password_1 = __webpack_require__(/*! ./modules/show-hide-password */ "./Static/javascript/modules/show-hide-password.ts"); 13621var svg_loader_1 = __webpack_require__(/*! ./modules/svg-loader */ "./Static/javascript/modules/svg-loader.ts"); 13622var revealPanel_1 = __webpack_require__(/*! ./modules/revealPanel */ "./Static/javascript/modules/revealPanel.ts"); 13623var accordion_1 = __webpack_require__(/*! ./modules/accordion */ "./Static/javascript/modules/accordion.ts"); 13624var tabs_1 = __webpack_require__(/*! ./modules/tabs */ "./Static/javascript/modules/tabs.ts"); 13625var mainNavigation_1 = __webpack_require__(/*! ./modules/mainNavigation */ "./Static/javascript/modules/mainNavigation.ts"); 13626var google_translate_1 = __webpack_require__(/*! ./modules/google-translate */ "./Static/javascript/modules/google-translate.ts"); 13627var YouTubeIframeLoader = __importStar(__webpack_require__(/*! youtube-iframe */ "./node_modules/youtube-iframe/index.js")); 13628__webpack_require__(/*! ./modules/promo-interface */ "./Static/javascript/modules/promo-interface.ts"); 13629__webpack_require__(/*! ./modules/sticky-sidebar-component */ "./Static/javascript/modules/sticky-sidebar-component.ts"); 13630var gallery_1 = __webpack_require__(/*! ./modules/gallery */ "./Static/javascript/modules/gallery.ts"); 13631var quickDonate_1 = __webpack_require__(/*! ./modules/quickDonate */ "./Static/javascript/modules/quickDonate.ts"); 13632var headerVideo_1 = __webpack_require__(/*! ./modules/headerVideo */ "./Static/javascript/modules/headerVideo.ts"); 13633var videoItem_1 = __webpack_require__(/*! ./modules/videoItem */ "./Static/javascript/modules/videoItem.ts"); 13634var throttle = __webpack_require__(/*! lodash.throttle */ "./node_modules/lodash.throttle/index.js"); 13635var debounce = __webpack_require__(/*! lodash.debounce */ "./node_modules/lodash.debounce/index.js"); 13636var alert_banner_1 = __webpack_require__(/*! ./modules/alert-banner */ "./Static/javascript/modules/alert-banner.ts"); 13637var a11y_modal_1 = __webpack_require__(/*! ./modules/a11y-modal */ "./Static/javascript/modules/a11y-modal.ts"); 13638var login_state_1 = __webpack_require__(/*! ./modules/login-state */ "./Static/javascript/modules/login-state.ts"); 13639var eventRsvpCancel_1 = __webpack_require__(/*! ./modules/eventRsvpCancel */ "./Static/javascript/modules/eventRsvpCancel.ts"); 13640var exchangeCartCleanup_1 = __webpack_require__(/*! ./tnew/exchangeCartCleanup */ "./Static/javascript/tnew/exchangeCartCleanup.ts"); 13641new svg_loader_1.SvgSprite('/Static/img/adage-sprite.svg'); 13642new google_translate_1.GoogleTranslate(); 13643(0, show_hide_password_1.showHidePassword)(); 13644var navigationInit = function () { 13645 if (mainNavigation_1.mainNavigation) 13646 mainNavigation_1.mainNavigation.init(); 13647 document.addEventListener('scroll', throttle(function () { 13648 if (mainNavigation_1.mainNavigation) 13649 mainNavigation_1.mainNavigation.scrollHandler(); 13650 }, 10)); 13651 window.addEventListener('resize', debounce(function () { 13652 if (mainNavigation_1.mainNavigation) 13653 mainNavigation_1.mainNavigation.resizeHandler(); 13654 }, 50)); 13655}; 13656var initializeGenericComponents = function () { 13657 navigationInit(); 13658 new alert_banner_1.AlertBanner(); 13659 (0, login_state_1.loginState)(); 13660 // Initialize all a11y-dialog modals with body scroll locking 13661 (0, a11y_modal_1.initModals)(); 13662 // Event RSVP landing page: SA cancel confirm buttons (no-op on other pages) 13663 (0, eventRsvpCancel_1.initEventRsvpCancel)();
13664 // TNEW exchange cart cleanup: zero out exchanged-out credit prices and hide 13665 // contributions on the cart page (no-op on other pages). Deferred to 13666 // DOMContentLoaded because global.js runs mid-body, BEFORE TNEW's inline 13667 // `orderDataModel` script lower on the page that the exchange gate reads. 13668 if (document.readyState === 'loading') { 13669 document.addEventListener('DOMContentLoaded', exchangeCartCleanup_1.initExchangeCartCleanup); 13670 } 13671 else { 13672 (0, exchangeCartCleanup_1.initExchangeCartCleanup)(); 13673 } 13674 var panels = [].slice.call(document.querySelectorAll('[data-panel]')); 13675 panels.forEach(function (panel) { 13676 new revealPanel_1.RevealPanel(panel); 13677 }); 13678 var accordions = [].slice.call(document.querySelectorAll('[data-accordion-list]')); 13679 accordions.forEach(function (accordionEl) { 13680 var oneOpenAtATime = accordionEl.getAttribute('data-one-open-at-a-time') == "true"; 13681 new accordion_1.Accordion({ container: accordionEl, oneOpenAtATime: oneOpenAtATime }); 13682 }); 13683 var tabEls = Array.prototype.slice.call(document.querySelectorAll('[data-tabs-container]')); 13684 tabEls.forEach(function (tabEl) { 13685 new tabs_1.Tabs({ container: tabEl }); 13686 }); 13687 // Gallery Init 13688 document.addEventListener('DOMContentLoaded', function () { 13689 var galleryClass = 'gallery'; 13690 var galleries = Array.prototype.slice.call(document.querySelectorAll('[data-gallery]')); 13691 galleries.forEach(function (gallery, index) { 13692 gallery.classList.add("".concat(galleryClass, "-").concat(index)); 13693 new gallery_1.Gallery(gallery); 13694 }); 13695 }); 13696 var quickDonateBlocks = [].slice.call(document.querySelectorAll('[data-quick-donate]')); 13697 quickDonateBlocks.forEach(function (block) { 13698 new quickDonate_1.QuickDonate(block); 13699 }); 13700 // Header videos 13701 var headerVideoContainers = Array.prototype.slice.call(document.querySelectorAll('[data-header-video-container]')); 13702 headerVideoContainers.forEach(function (HeaderVideoContainer) { 13703 new headerVideo_1.HeaderVideo(HeaderVideoContainer); 13704 }); 13705 // Videos 13706 var videoItems = Array.prototype.slice.call(document.querySelectorAll('[data-video-item]:not([data-video-type=youtube])')); 13707 var youtubeVideoItems = Array.prototype.slice.call(document.querySelectorAll('[data-video-item][data-video-type=youtube]')); 13708 videoItems.forEach(function (videoItem) { 13709 new videoItem_1.VideoItem(videoItem); 13710 }); 13711 YouTubeIframeLoader.load(function (YT) { 13712 youtubeVideoItems.forEach(function (youtubeVideoItem) { 13713 var iframe = youtubeVideoItem.querySelector('[data-youtube-id]'); 13714 var ytvideoPlayer = new YT.Player(iframe.getAttribute('id'), { 13715 height: '390', 13716 width: '640', 13717 videoId: iframe.getAttribute('data-youtube-id'), 13718 events: { 13719 onReady: function () { 13720 new videoItem_1.VideoItem(youtubeVideoItem, ytvideoPlayer); 13721 } 13722 } 13723 }); 13724 }); 13725 }); 13726}; 13727initializeGenericComponents(); 13728 13729 13730/***/ }, 13731 13732/***/ "./Static/javascript/modules/a11y-modal.ts" 13733/*!*************************************************!*\ 13734 !*** ./Static/javascript/modules/a11y-modal.ts ***! 13735 \*************************************************/ 13736(__unused_webpack_module, exports, __webpack_require__) { 13737 13738"use strict"; 13739 13740var __importDefault = (this && this.__importDefault) || function (mod) { 13741 return (mod && mod.__esModule) ? mod : { "default": mod }; 13742}; 13743Object.defineProperty(exports, "__esModule", ({ value: true })); 13744exports.initModals = void 0; 13745var a11y_dialog_1 = __importDefault(__webpack_require__(/*! a11y-dialog */ "./node_modules/a11y-dialog/dist/a11y-dialog.esm.js")); 13746var lockBody_1 = __webpack_require__(/*! ../helpers/lockBody */ "./Static/javascript/helpers/lockBody.ts"); 13747/** 13748 * Initialize all modal dialogs on the page with body scroll locking. 13749 * Uses a11y-dialog's built-in trigger handling via data-a11y-dialog-show attributes. 13750 */ 13751function initModals() { 13752 var modalContainers = document.querySelectorAll('.modal-container');
13753 modalContainers.forEach(function (container) { 13754 var bodyLockState = null; 13755 var dialog = new a11y_dialog_1.default(container); 13756 dialog.on('show', function () { 13757 bodyLockState = (0, lockBody_1.lockBody)(); 13758 }); 13759 dialog.on('hide', function () { 13760 if (bodyLockState) { 13761 (0, lockBody_1.unlockBody)(bodyLockState); 13762 bodyLockState = null; 13763 } 13764 }); 13765 }); 13766} 13767exports.initModals = initModals; 13768 13769 13770/***/ }, 13771 13772/***/ "./Static/javascript/modules/accordion.ts" 13773/*!************************************************!*\ 13774 !*** ./Static/javascript/modules/accordion.ts ***! 13775 \************************************************/ 13776(__unused_webpack_module, exports, __webpack_require__) { 13777 13778"use strict"; 13779 13780Object.defineProperty(exports, "__esModule", ({ value: true })); 13781exports.Accordion = void 0; 13782var enableTabbableChildren_1 = __webpack_require__(/*! ../helpers/enableTabbableChildren */ "./Static/javascript/helpers/enableTabbableChildren.ts"); 13783var disableTabbableChildren_1 = __webpack_require__(/*! ../helpers/disableTabbableChildren */ "./Static/javascript/helpers/disableTabbableChildren.ts"); 13784var lodash_1 = __webpack_require__(/*! lodash */ "lodash"); 13785var Accordion = /** @class */ (function () { 13786 function Accordion(options) { 13787 var _this = this; 13788 this.options = { 13789 oneOpenAtATime: true 13790 }; 13791 (0, lodash_1.assign)(this.options, options); 13792 this.container = this.options.container; 13793 this.panels = [].slice.call(this.container.querySelectorAll('[role="region"]')); 13794 this.triggers = [].slice.call(this.container.querySelectorAll('[aria-controls]')); 13795 this.container.addEventListener('keydown', this.handleKeydown.bind(this)); 13796 this.triggers.forEach(function (trigger) { 13797 trigger.addEventListener('click', _this.accordionClick.bind(_this)); 13798 }); 13799 this.panels.forEach(function (panel) { 13800 (0, disableTabbableChildren_1.disableTabbableChildren)(panel); 13801 }); 13802 } 13803 Accordion.prototype.accordionClick = function (e) { 13804 this.activePanel = this.container.querySelector("#".concat(e.currentTarget.getAttribute('aria-controls'))); 13805 this.activeTrigger = e.currentTarget; 13806 this.toggleActivePanel(); 13807 if (this.options.oneOpenAtATime) { 13808 this.closeInactivePanels(); 13809 } 13810 }; 13811 Accordion.prototype.toggleActivePanel = function () { 13812 if (this.activeTrigger.getAttribute('aria-expanded') === 'true') { 13813 this.closePanel(this.activeTrigger, this.activePanel); 13814 } 13815 else { 13816 this.openPanel(this.activeTrigger, this.activePanel); 13817 } 13818 if (this.options.oneOpenAtATime) { 13819 this.closeInactivePanels(); 13820 } 13821 }; 13822 Accordion.prototype.closeInactivePanels = function () { 13823 var _this = this; 13824 this.triggers.forEach(function (trigger) { 13825 if (trigger !== _this.activeTrigger) { 13826 var curPanel = _this.container.querySelector("#".concat(trigger.getAttribute('aria-controls'))); 13827 _this.closePanel(trigger, curPanel); 13828 } 13829 }); 13830 }; 13831 Accordion.prototype.openPanel = function (trigger, panel) { 13832 trigger.setAttribute('aria-expanded', 'true'); 13833 panel.setAttribute('aria-hidden', 'false'); 13834 (0, enableTabbableChildren_1.enableTabbableChildren)(panel); 13835 trigger.closest('li').classList.add('active'); 13836 }; 13837 Accordion.prototype.closePanel = function (trigger, panel) { 13838 trigger.setAttribute('aria-expanded', 'false'); 13839 panel.setAttribute('aria-hidden', 'true'); 13840 trigger.closest('li').classList.remove('active'); 13841 (0, disableTabbableChildren_1.disableTabbableChildren)(panel); 13842 }; 13843 Accordion.prototype.handleKeydown = function (e) { 13844 var _this = this; 13845 var key = e.which.toString(); 13846 var target = e.target; 13847 var ctrlModifier = (e.ctrlKey && key.match(/33|34/)); 13848 if (target.hasAttribute('aria-controls')) { 13849 if (key.match(/38|40/) || ctrlModifier) { 13850 var index = this.triggers.indexOf(target); 13851 var direction = (key.match(/34|40/)) ? 1 : -1; 13852 var length = this.triggers.length; 13853 var newIndex = (index + length + direction) % length; 13854 this.triggers[newIndex].focus(); 13855 e.preventDefault(); 13856 } 13857 else if (key.match(/35|36/)) { 13858 // 35 = End, 36 = Home keyboard operations 13859 switch (key) { 13860 // Go to first accordion 13861 case '36':
13862 this.triggers[0].focus(); 13863 break; 13864 // Go to last accordion 13865 case '35': 13866 this.triggers[this.triggers.length - 1].focus(); 13867 break; 13868 } 13869 e.preventDefault(); 13870 } 13871 } 13872 else if (ctrlModifier) { 13873 // Control + Page Up/ Page Down keyboard operations 13874 // Catches events that happen inside of panels 13875 this.panels.forEach(function (panel, index) { 13876 if (panel.contains(target)) { 13877 _this.triggers[index].focus(); 13878 e.preventDefault(); 13879 } 13880 }); 13881 } 13882 }; 13883 return Accordion; 13884}()); 13885exports.Accordion = Accordion; 13886 13887 13888/***/ }, 13889 13890/***/ "./Static/javascript/modules/alert-banner.ts" 13891/*!***************************************************!*\ 13892 !*** ./Static/javascript/modules/alert-banner.ts ***! 13893 \***************************************************/ 13894(__unused_webpack_module, exports) { 13895 13896"use strict"; 13897 13898Object.defineProperty(exports, "__esModule", ({ value: true })); 13899exports.AlertBanner = void 0; 13900var AlertBanner = /** @class */ (function () { 13901 function AlertBanner() { 13902 var closeButton = document.getElementById("hide-banner"); 13903 if (!closeButton) 13904 return; 13905 closeButton.addEventListener("click", function (e) { 13906 var banner = document.getElementById("site-banner"); 13907 if (!banner) 13908 return; 13909 banner.classList.add("visually-hidden"); 13910 var cookieContent = banner.getAttribute("date-updated"); 13911 if (cookieContent) { 13912 setCookie(cookieContent); 13913 } 13914 }); 13915 } 13916 return AlertBanner; 13917}()); 13918exports.AlertBanner = AlertBanner; 13919function setCookie(guid) { 13920 var cName = "site_alert_banner"; 13921 var expires = new Date(); 13922 expires.setDate(expires.getDate() + 1); 13923 var cookie = "".concat(cName, "=").concat(guid, "; expires=").concat(expires.toUTCString(), "; path=/"); 13924 document.cookie = cookie; 13925} 13926 13927 13928/***/ }, 13929 13930/***/ "./Static/javascript/modules/eventRsvpCancel.ts" 13931/*!******************************************************!*\ 13932 !*** ./Static/javascript/modules/eventRsvpCancel.ts ***! 13933 \******************************************************/ 13934(__unused_webpack_module, exports, __webpack_require__) { 13935 13936"use strict"; 13937/* provided dependency */ var Promise = __webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js"); 13938 13939// Wires up the Event RSVP landing page's status-change buttons. 13940// 13941// Cancel (SA via SP 122, elevated via SP 119): the button sits inside an a11y-dialog modal 13942// already initialized site-wide by initModals(). Clicking POSTs to the matching endpoint and, 13943// on success, reloads the page so the cancelled reservation reappears as reservable. 13944// 13945// Re-reserve (elevated only): not modal-gated, since nothing is destroyed. SP 119 answers this 13946// direction with the reservation form's URL rather than flipping the status, so the POST returns 13947// a query string which we append to the reservation page and navigate to. 13948var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { 13949 function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 13950 return new (P || (P = Promise))(function (resolve, reject) { 13951 function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } 13952 function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } 13953 function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } 13954 step((generator = generator.apply(thisArg, _arguments || [])).next()); 13955 }); 13956}; 13957var __generator = (this && this.__generator) || function (thisArg, body) { 13958 var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; 13959 return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; 13960 function verb(n) { return function (v) { return step([n, v]); }; } 13961 function step(op) { 13962 if (f) throw new TypeError("Generator is already executing."); 13963 while (g && (g = 0, op[0] && (_ = 0)), _) try {
13964 if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; 13965 if (y = 0, t) op = [op[0] & 2, t.value]; 13966 switch (op[0]) { 13967 case 0: case 1: t = op; break; 13968 case 4: _.label++; return { value: op[1], done: false }; 13969 case 5: _.label++; y = op[1]; op = [0]; continue; 13970 case 7: op = _.ops.pop(); _.trys.pop(); continue; 13971 default: 13972 if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } 13973 if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } 13974 if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } 13975 if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } 13976 if (t[2]) _.ops.pop(); 13977 _.trys.pop(); continue; 13978 } 13979 op = body.call(thisArg, _); 13980 } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } 13981 if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; 13982 } 13983}; 13984Object.defineProperty(exports, "__esModule", ({ value: true })); 13985exports.initEventRsvpCancel = void 0; 13986var SA_ENDPOINT = '/api/EventRsvp/CancelSa'; 13987var ELEVATED_ENDPOINT = '/api/EventRsvp/CancelElevated'; 13988var REACTIVATE_ENDPOINT = '/api/EventRsvp/ReactivateElevated'; 13989var GENERIC_ERROR = "We couldn't cancel your reservation. Please try again."; 13990// Resolves the POST endpoint + body for a cancel button, or null if it carries no valid id. 13991function resolveCancelRequest(button) { 13992 var saNo = parseInt(button.getAttribute('data-cancel-sa') || '', 10); 13993 if (saNo) 13994 return { url: SA_ENDPOINT, body: { sa_no: saNo } }; 13995 var evexNo = parseInt(button.getAttribute('data-cancel-evex') || '', 10); 13996 if (evexNo) { 13997 // new_status comes from SP 115's button_url (19 for elevated, where SA uses 13). Sent 13998 // through rather than hardcoded server-side; 0 lets the server fall back to config. 13999 var newStatus = parseInt(button.getAttribute('data-cancel-new-status') || '', 10); 14000 return { 14001 url: ELEVATED_ENDPOINT, 14002 body: { evex_no: evexNo, new_status: isNaN(newStatus) ? 0 : newStatus }, 14003 }; 14004 } 14005 return null; 14006} 14007function cancelReservation(button) { 14008 var _a, _b; 14009 return __awaiter(this, void 0, Promise, function () { 14010 var request, errorEl, response, data, _c; 14011 return __generator(this, function (_d) { 14012 switch (_d.label) { 14013 case 0: 14014 request = resolveCancelRequest(button); 14015 if (!request) 14016 return [2 /*return*/]; 14017 errorEl = (_b = ((_a = button.closest('.event-rsvp-cancel-modal__content')) !== null && _a !== void 0 ? _a : button.parentElement)) === null || _b === void 0 ? void 0 : _b.querySelector('.event-rsvp-cancel-modal__error'); 14018 button.disabled = true; 14019 if (errorEl) { 14020 errorEl.hidden = true; 14021 errorEl.textContent = ''; 14022 } 14023 _d.label = 1; 14024 case 1: 14025 _d.trys.push([1, 5, , 6]); 14026 return [4 /*yield*/, fetch(request.url, { 14027 method: 'POST', 14028 headers: { 'Content-Type': 'application/json' }, 14029 body: JSON.stringify(request.body), 14030 })]; 14031 case 2: 14032 response = _d.sent(); 14033 if (!response.ok) return [3 /*break*/, 4]; 14034 return [4 /*yield*/, response.json()]; 14035 case 3: 14036 data = _d.sent(); 14037 if (data && data.success) { 14038 window.location.reload(); 14039 return [2 /*return*/]; 14040 } 14041 _d.label = 4; 14042 case 4: throw new Error('Cancel failed'); 14043 case 5: 14044 _c = _d.sent(); 14045 button.disabled = false; 14046 if (errorEl) { 14047 errorEl.textContent = GENERIC_ERROR; 14048 errorEl.hidden = false; 14049 } 14050 return [3 /*break*/, 6]; 14051 case 6: return [2 /*return*/]; 14052 } 14053 }); 14054 });
14055} 14056// Re-reserving a cancelled elevated invitation. SP 119 answers with the reservation form's URL 14057// instead of flipping the status, so we resolve that server-side and then navigate to the form â 14058// the patron still has to submit it for the reservation to exist. 14059function reactivateReservation(button) { 14060 var _a; 14061 return __awaiter(this, void 0, Promise, function () { 14062 var evexNo, newStatus, base, errorEl, response, data, returnUrl, sep, _b; 14063 return __generator(this, function (_c) { 14064 switch (_c.label) { 14065 case 0: 14066 evexNo = parseInt(button.getAttribute('data-reactivate-evex') || '', 10); 14067 if (!evexNo) 14068 return [2 /*return*/]; 14069 newStatus = parseInt(button.getAttribute('data-reactivate-new-status') || '', 10); 14070 base = button.getAttribute('data-reactivate-base') || ''; 14071 errorEl = (_a = button.parentElement) === null || _a === void 0 ? void 0 : _a.querySelector('.event-rsvp-cancel-modal__error'); 14072 button.disabled = true; 14073 if (errorEl) { 14074 errorEl.hidden = true; 14075 errorEl.textContent = ''; 14076 } 14077 _c.label = 1; 14078 case 1: 14079 _c.trys.push([1, 5, , 6]); 14080 return [4 /*yield*/, fetch(REACTIVATE_ENDPOINT, { 14081 method: 'POST', 14082 headers: { 'Content-Type': 'application/json' }, 14083 body: JSON.stringify({ 14084 evex_no: evexNo, 14085 new_status: isNaN(newStatus) ? 0 : newStatus, 14086 }), 14087 })]; 14088 case 2: 14089 response = _c.sent(); 14090 if (!response.ok) return [3 /*break*/, 4]; 14091 return [4 /*yield*/, response.json()]; 14092 case 3: 14093 data = _c.sent(); 14094 if (data && data.success && data.query && base) { 14095 returnUrl = encodeURIComponent(window.location.pathname); 14096 sep = data.query.indexOf('?') === 0 ? '&' : '?'; 14097 window.location.assign("".concat(base).concat(data.query).concat(sep, "returnUrl=").concat(returnUrl)); 14098 return [2 /*return*/]; 14099 } 14100 _c.label = 4; 14101 case 4: throw new Error('Reactivate failed'); 14102 case 5: 14103 _b = _c.sent(); 14104 button.disabled = false; 14105 if (errorEl) { 14106 errorEl.textContent = GENERIC_ERROR; 14107 errorEl.hidden = false; 14108 } 14109 return [3 /*break*/, 6]; 14110 case 6: return [2 /*return*/]; 14111 } 14112 }); 14113 }); 14114} 14115function initEventRsvpCancel() { 14116 var cancelButtons = Array.prototype.slice.call(document.querySelectorAll('[data-cancel-sa], [data-cancel-evex]')); 14117 cancelButtons.forEach(function (button) { 14118 button.addEventListener('click', function () { 14119 void cancelReservation(button); 14120 }); 14121 }); 14122 var reactivateButtons = Array.prototype.slice.call(document.querySelectorAll('[data-reactivate-evex]')); 14123 reactivateButtons.forEach(function (button) { 14124 button.addEventListener('click', function () { 14125 void reactivateReservation(button); 14126 }); 14127 }); 14128} 14129exports.initEventRsvpCancel = initEventRsvpCancel; 14130 14131 14132/***/ }, 14133 14134/***/ "./Static/javascript/modules/gallery.ts" 14135/*!**********************************************!*\ 14136 !*** ./Static/javascript/modules/gallery.ts ***! 14137 \**********************************************/ 14138(__unused_webpack_module, exports, __webpack_require__) { 14139 14140"use strict"; 14141 14142var __assign = (this && this.__assign) || function () { 14143 __assign = Object.assign || function(t) { 14144 for (var s, i = 1, n = arguments.length; i < n; i++) { 14145 s = arguments[i]; 14146 for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) 14147 t[p] = s[p]; 14148 } 14149 return t; 14150 }; 14151 return __assign.apply(this, arguments); 14152}; 14153var __importDefault = (this && this.__importDefault) || function (mod) { 14154 return (mod && mod.__esModule) ? mod : { "default": mod }; 14155}; 14156Object.defineProperty(exports, "__esModule", ({ value: true })); 14157exports.Gallery = void 0; 14158var splide_1 = __importDefault(__webpack_require__(/*! @splidejs/splide */ "./node_modules/@splidejs/splide/dist/js/splide.cjs.js")); 14159var splide_extension_video_1 = __webpack_require__(/*! @splidejs/splide-extension-video */ "./node_modules/@splidejs/splide-extension-video/dist/js/splide-extension-video.esm.js"); 14160var splide_transition_1 = __webpack_require__(/*! ./splide-transition */ "./Static/javascript/modules/splide-transition.ts"); 14161var commonGalleryOptions = { 14162 accessibility: true, 14163 drag: false, 14164 // @ts-ignore 14165 pagination: true, 14166 // @ts-ignore 14167 slideFocus: false, 14168 easing: 'linear', 14169 speed: 600, 14170 interval: 5000, 14171 focus: 0, 14172 omitEnd: true, 14173 gap: '2rem',
14174 padding: { 14175 left: '0rem', 14176 right: '0rem' 14177 }, 14178 arrows: true, 14179 keyboard: 'focused', 14180 video: { 14181 // setting to true is currently required due to a bug in the splide video extension creating 14182 // the embed url with an empty "playlist" parameter which break YouTube embed link 14183 loop: true 14184 }, 14185 classes: { 14186 pagination: 'splide__pagination gallery-pagination gallery-pagination-nums', 14187 page: 'splide__pagination__page gallery-page' 14188 }, 14189}; 14190var galleryOptions = function (perPage) { return ({ 14191 perPage: perPage, 14192 perMove: 1, 14193 breakpoints: { 14194 1280: { 14195 perPage: Math.max(1, Math.floor(perPage / 2)), 14196 perMove: 1, 14197 gap: '1.5rem', 14198 }, 14199 767: { 14200 perPage: 1, 14201 perMove: 1, 14202 gap: '1rem', 14203 } 14204 }, 14205 updateOnMove: true, 14206 autoHeight: true, 14207 type: 'slide', 14208}); }; 14209var quoteGalleryOptions = function (perPage) { return ({ 14210 perPage: perPage, 14211 perMove: 1, 14212 breakpoints: { 14213 1280: { 14214 perPage: Math.max(1, Math.floor(perPage / 2)), 14215 perMove: 1, 14216 gap: '2.5rem' 14217 }, 14218 767: { 14219 perPage: 1, 14220 perMove: 1, 14221 gap: '1.5rem' 14222 } 14223 }, 14224 updateOnMove: true, 14225 autoHeight: true, 14226 type: 'slide', 14227}); }; 14228var Gallery = /** @class */ (function () { 14229 function Gallery(element) { 14230 var _this = this; 14231 this.arrowDisplay = function () { 14232 var galleryArrows = _this.gallery.Components.Arrows.arrows; 14233 if (galleryArrows.next && galleryArrows.prev) { 14234 var arrowsShouldBeHidden = galleryArrows.next.hasAttribute('disabled') && galleryArrows.prev.hasAttribute('disabled'); 14235 galleryArrows.next.hidden = arrowsShouldBeHidden; 14236 galleryArrows.prev.hidden = arrowsShouldBeHidden; 14237 } 14238 }; 14239 this.setGalleryOptions = function () { 14240 var optionsToUse = galleryOptions; 14241 var defaultPerPage = _this.galleryType === "quote" ? 2 : 4; 14242 var parsedPerPage = _this.galleryElement != null ? parseInt(_this.galleryElement.getAttribute('data-grid-size')) : NaN; 14243 var perPage = Number.isFinite(parsedPerPage) && parsedPerPage > 0 ? parsedPerPage : defaultPerPage; 14244 if (_this.galleryType === "quote") { 14245 optionsToUse = quoteGalleryOptions(perPage); 14246 } 14247 else { 14248 optionsToUse = galleryOptions(perPage); 14249 } 14250 var autoPlayOptions = { 14251 autoplay: _this.autoStart.toString(), 14252 interval: _this.setInterval.toString() 14253 }; 14254 _this.galleryOptions = __assign(__assign(__assign({}, commonGalleryOptions), autoPlayOptions), optionsToUse); 14255 }; 14256 this.handleBreakpointChange = function () { 14257 var perPage = _this.gallery.options.perPage; 14258 var currentIndex = _this.gallery.index; 14259 var totalSlides = _this.gallery.length; 14260 // Snap to nearest valid page boundary if needed 14261 if (perPage > 1) { 14262 var remainder = currentIndex % perPage; 14263 if (remainder !== 0) { 14264 // Calculate nearest page boundary 14265 var currentPage = Math.floor(currentIndex / perPage); 14266 var lastPage = Math.floor((totalSlides - 1) / perPage); 14267 var targetPage = Math.min(currentPage, lastPage); 14268 var targetIndex = targetPage * perPage; 14269 // Snap instantly without animation 14270 var originalSpeed_1 = _this.gallery.options.speed; 14271 _this.gallery.options.speed = 0; 14272 _this.gallery.go(targetIndex); 14273 setTimeout(function () { 14274 _this.gallery.options.speed = originalSpeed_1; 14275 }, 0); 14276 } 14277 } 14278 }; 14279 this.galleryElement = element; 14280 this.galleryType = element.getAttribute('data-gallery-type'); 14281 this.autoStart = element.getAttribute('data-autoplay') != null ? element.getAttribute('data-autoplay') : ""; 14282 // This needs to be set to a obscenely large number due to an interval bug with Splide 14283 this.setInterval = element.getAttribute('data-interval') != null ? element.getAttribute('data-interval') : "1000000"; 14284 this.setGalleryOptions();
14285 this.gallery = new splide_1.default(element, this.galleryOptions); 14286 this.gallery.on('mounted', function () { 14287 _this.arrowDisplay(); 14288 setTimeout(function () { 14289 var playButtons = Array.prototype.slice.call(_this.gallery.root.querySelectorAll('.media-gallery-item .splide__slide__container--has-video')); 14290 playButtons.forEach(function (playButton) { 14291 var slide = playButton.closest('.splide__slide'); 14292 var slideTarget = slide.querySelector('[data-gallery-video]'); 14293 slideTarget.append(playButton); 14294 }); 14295 }, 1000); //Forgive me, but no event to listen to find out when the playbuttons are loaded. Splide also isn't respecting the splide__slide__container for the playbutton target so I had to do it manually here :( 14296 }); 14297 this.pageWidth = document.documentElement.offsetWidth; 14298 this.gallery.on('resized', function () { 14299 // page width check prevents the carousel from resetting after a few seconds on load, when a resize is called from elsewhere 14300 var currentPageWidth = _this.pageWidth; 14301 _this.pageWidth = document.documentElement.offsetWidth; 14302 if (currentPageWidth != _this.pageWidth) { 14303 _this.arrowDisplay(); 14304 _this.handleBreakpointChange(); 14305 } 14306 }); 14307 this.gallery.on('move', function () { 14308 _this.gallery.root.classList.add('moving'); 14309 }); 14310 this.gallery.on('moved', function () { 14311 _this.gallery.root.classList.remove('moving'); 14312 }); 14313 this.gallery.on('video:play', function () { 14314 var videoSelector = ".is-playing .is-active .splide__video__wrapper"; 14315 var playingVideoElement = document.querySelector("".concat(videoSelector, " video")) || document.querySelector("".concat(videoSelector, " iframe")); 14316 if (playingVideoElement) { 14317 playingVideoElement.setAttribute('title', playingVideoElement.closest('[data-video-title]').getAttribute('data-video-title')); 14318 } 14319 }); 14320 this.gallery.mount({ Video: splide_extension_video_1.Video }, splide_transition_1.MyTransition); 14321 } 14322 return Gallery; 14323}()); 14324exports.Gallery = Gallery; 14325 14326 14327/***/ }, 14328 14329/***/ "./Static/javascript/modules/google-translate.ts" 14330/*!*******************************************************!*\ 14331 !*** ./Static/javascript/modules/google-translate.ts ***! 14332 \*******************************************************/ 14333(__unused_webpack_module, exports) { 14334 14335"use strict"; 14336 14337Object.defineProperty(exports, "__esModule", ({ value: true })); 14338exports.GoogleTranslate = void 0; 14339var GoogleTranslate = /** @class */ (function () { 14340 function GoogleTranslate() { 14341 this.COOKIE_NAME = 'googtrans'; 14342 this.initializeTranslateInputListeners(); 14343 this.initializeLangMutationObserver(); 14344 } 14345 GoogleTranslate.prototype.onLanguageChange = function (e) { 14346 var select = e.target; 14347 var selectedLanguage = (select === null || select === void 0 ? void 0 : select.value) || 'en'; 14348 this.updateState(selectedLanguage); 14349 location.reload(); 14350 }; 14351 GoogleTranslate.prototype.initializeTranslateInputListeners = function () { 14352 var translateSelect = document.querySelector('[data-translate-select]'); 14353 this.translateElement = translateSelect; 14354 if (translateSelect) { 14355 var self = this; 14356 translateSelect.addEventListener('change', this.onLanguageChange.bind(self)); 14357 } 14358 }; 14359 // Observes the mutation of the 'lang' attribute on the <html> element 14360 // and upon a change, it updates the google translate form element to reflect the language change. 14361 // 14362 // This is important because the user can modify the lang of the page through UI which we don't have 14363 // event listeners set up for. 14364 // 14365 GoogleTranslate.prototype.initializeLangMutationObserver = function () { 14366 var _this = this; 14367 // If no translate element was found, then we don't need to observe the 14368 if (!this.translateElement) { 14369 return; 14370 } 14371 // Select the node that will be observed for mutations 14372 var htmlRoot = document.getElementsByTagName('html')[0]; 14373 // Options for the observer (which mutations to observe) 14374 var config = { attributes: true }; 14375 // Callback function to execute when mutations are observed 14376 var callback = function (mutationList, observer) { 14377 var _a; 14378 var _loop_1 = function (mutation) { 14379 var type = mutation.type, attributeName = mutation.attributeName, target = mutation.target; 14380 var newLang = (_a = target === null || target === void 0 ? void 0 : target.getAttribute('lang')) !== null && _a !== void 0 ? _a : 'en'; 14381 if (type === 'attributes' && attributeName === 'lang') { 14382 var languageOptions = _this.translateElement.querySelectorAll('input');
14383 Array.from(languageOptions).forEach(function (languageOption) { 14384 languageOption.checked = languageOption.value.endsWith(newLang); 14385 }); 14386 } 14387 }; 14388 for (var _i = 0, mutationList_1 = mutationList; _i < mutationList_1.length; _i++) { 14389 var mutation = mutationList_1[_i]; 14390 _loop_1(mutation); 14391 } 14392 }; 14393 // Create an observer instance linked to the callback function 14394 var observer = new MutationObserver(callback); 14395 // Start observing the target node for configured mutations 14396 observer.observe(htmlRoot, config); 14397 }; 14398 // Cookie modifying code within is loosely taken from the JS that comes with Google Translate plugin 14399 // because it targets and modifies multiple cookies on page load, which have to be accounted for 14400 // when the user chooses a language from the dropdown. 14401 GoogleTranslate.prototype.updateState = function (selectedLanguage) { 14402 var newCookie = this.COOKIE_NAME; 14403 if (selectedLanguage && selectedLanguage !== 'en') { 14404 newCookie += ('=/en/' + selectedLanguage); 14405 } 14406 else { 14407 var time = new Date(); 14408 time.setTime(time.getTime() - 1); 14409 newCookie += '=none;expires=' + time.toUTCString(); 14410 } 14411 // update default domain, e.g, centertheatregroup-dev.adagetech.net 14412 newCookie += ';path=/'; 14413 document.cookie = newCookie; 14414 // update potential base domain 14415 var hostnameParts = window.location.hostname.split('.'); 14416 // e.g, [centertheatregroup-dev, adagetech, net] 14417 var baseDomain = (hostnameParts.length <= 2 14418 ? hostnameParts 14419 : hostnameParts.slice(hostnameParts.length - 2, hostnameParts.length)).join('.'); 14420 try { 14421 document.cookie = newCookie + ';domain=' + baseDomain; 14422 } 14423 catch (d) { } 14424 }; 14425 return GoogleTranslate; 14426}()); 14427exports.GoogleTranslate = GoogleTranslate; 14428 14429 14430/***/ }, 14431 14432/***/ "./Static/javascript/modules/headerVideo.ts" 14433/*!**************************************************!*\ 14434 !*** ./Static/javascript/modules/headerVideo.ts ***! 14435 \**************************************************/ 14436(__unused_webpack_module, exports, __webpack_require__) { 14437 14438"use strict"; 14439 14440var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { 14441 if (k2 === undefined) k2 = k; 14442 var desc = Object.getOwnPropertyDescriptor(m, k); 14443 if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { 14444 desc = { enumerable: true, get: function() { return m[k]; } }; 14445 } 14446 Object.defineProperty(o, k2, desc); 14447}) : (function(o, m, k, k2) { 14448 if (k2 === undefined) k2 = k; 14449 o[k2] = m[k]; 14450})); 14451var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { 14452 Object.defineProperty(o, "default", { enumerable: true, value: v }); 14453}) : function(o, v) { 14454 o["default"] = v; 14455}); 14456var __importStar = (this && this.__importStar) || function (mod) { 14457 if (mod && mod.__esModule) return mod; 14458 var result = {}; 14459 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); 14460 __setModuleDefault(result, mod); 14461 return result; 14462}; 14463var __importDefault = (this && this.__importDefault) || function (mod) { 14464 return (mod && mod.__esModule) ? mod : { "default": mod }; 14465}; 14466Object.defineProperty(exports, "__esModule", ({ value: true })); 14467exports.HeaderVideo = void 0; 14468var debounce = __webpack_require__(/*! lodash.debounce */ "./node_modules/lodash.debounce/index.js"); 14469var YouTubeIframeLoader = __importStar(__webpack_require__(/*! youtube-iframe */ "./node_modules/youtube-iframe/index.js")); 14470var player_1 = __importDefault(__webpack_require__(/*! @vimeo/player */ "./node_modules/@vimeo/player/dist/player.es.js")); 14471var VideoType; 14472(function (VideoType) { 14473 VideoType["NATIVE"] = "native"; 14474 VideoType["VIMEO"] = "vimeo"; 14475 VideoType["YOUTUBE"] = "youtube"; 14476 VideoType["NONE"] = "none"; 14477})(VideoType || (VideoType = {})); 14478var HeaderVideo = /** @class */ (function () { 14479 function HeaderVideo(container) { 14480 this.container = container; 14481 this.videoEdgeOffset = 0; 14482 this.videoWrapper = this.container.querySelector('[data-header-video-wrapper]'); 14483 var videoType = this.videoWrapper.getAttribute("data-video-type"); 14484 switch (videoType.toLowerCase()) { 14485 case VideoType.NATIVE: 14486 this.videoType = VideoType.NATIVE; 14487 break; 14488 case VideoType.YOUTUBE: 14489 this.videoType = VideoType.YOUTUBE; 14490 this.videoEdgeOffset = 480; // vertical offset to hide the youtube title and branding 14491 break; 14492 case VideoType.VIMEO: 14493 this.videoType = VideoType.VIMEO; 14494 break; 14495 default: 14496 this.videoType = VideoType.NONE; 14497 } 14498 this.imageFallback = this.container.querySelector('[data-header-video-image]'); 14499 this.content = this.container.querySelector('[data-header-video-content]'); 14500 this.breakpoint = parseInt(this.container.getAttribute('data-breakpoint')); 14501 if (this.videoType === VideoType.NONE) { 14502 // there's no video 14503 this.switchToImage(); 14504 } 14505 else if (window.outerWidth < this.breakpoint) { 14506 this.switchToImage(); 14507 } 14508 else { 14509 this.initializeVideo(); 14510 } 14511 } 14512 HeaderVideo.prototype.initializeVideo = function () { 14513 var _this = this; 14514 this.video = this.container.querySelector('[data-header-video]'); 14515 var controls = { 14516 pauseButton: this.container.querySelector('[data-header-video-pause]'), 14517 playButton: this.container.querySelector('[data-header-video-play]'), 14518 muteButton: this.container.querySelector('[data-header-video-mute]'), 14519 unmuteButton: this.container.querySelector('[data-header-video-unmute]') 14520 }; 14521 this.controls = controls;
14522 this.overlay = this.container.querySelector('[data-header-video-overlay]'); 14523 // Recalculate video size 14524 this.setDimensions(); 14525 window.addEventListener('resize', debounce(function () { 14526 _this.setDimensions(); 14527 if (window.outerWidth < _this.breakpoint) { 14528 _this.switchToImage(); 14529 } 14530 }, 50)); 14531 this.videoEndTime = parseInt(this.video.getAttribute('data-video-end')) || null; 14532 this.videoStartTime = parseInt(this.video.getAttribute('data-video-start')) || 0; 14533 if (!this.video.src) { 14534 // Youtube initialization and handlers 14535 if (this.videoType === VideoType.YOUTUBE) { 14536 this.initYoutubeVideo(); 14537 } 14538 // Native video initialization 14539 if (this.videoType === VideoType.NATIVE) { 14540 this.initNativeVideo(); 14541 } 14542 // Vimeo video initialization 14543 if (this.videoType === VideoType.VIMEO) { 14544 this.initVimeoVideo(); 14545 } 14546 } 14547 }; 14548 HeaderVideo.prototype.initNativeVideo = function () { 14549 var _this = this; 14550 this.video = this.video; 14551 var videoSource = this.video.querySelector('source'); 14552 if (videoSource) { 14553 videoSource.src = videoSource.getAttribute('data-src'); 14554 this.videoObject = this.video; 14555 this.videoObject.addEventListener('loadeddata', function () { 14556 var playPromise = _this.videoObject.play(); 14557 if (playPromise !== undefined) { 14558 playPromise.then(function () { 14559 // Autoplay is working 14560 }).catch(function (error) { 14561 // Autoplay is blocked 14562 _this.autoplayBlocked(true); 14563 }); 14564 } 14565 else 14566 _this.switchToImage(); 14567 }); 14568 this.videoObject.load(); 14569 this.showVideoAndAttachControls(); 14570 } 14571 }; 14572 HeaderVideo.prototype.initYoutubeVideo = function () { 14573 var _this = this; 14574 var videoPlayer; 14575 YouTubeIframeLoader.load(function (YT) { 14576 _this.video.src = _this.video.getAttribute('data-src'); 14577 videoPlayer = new YT.Player(_this.video.id, { 14578 events: { 14579 'onReady': _this.ytVideoLoaded.bind(_this), 14580 'onStateChange': _this.ytOnPlayerStateChange.bind(_this), 14581 } 14582 }); 14583 _this.videoObject = videoPlayer; 14584 }); 14585 }; 14586 HeaderVideo.prototype.initVimeoVideo = function () { 14587 var _this = this; 14588 this.video.src = this.video.getAttribute('data-src'); 14589 var vimeoPlayer = new player_1.default(this.video, {}); 14590 vimeoPlayer.on('loaded', function () { 14591 vimeoPlayer.play().then(function () { 14592 // Video is playing 14593 vimeoPlayer.setVolume(0).then(function (volume) { 14594 _this.showVideoAndAttachControls(); 14595 }); 14596 }).catch(function (error) { 14597 // Video had an error or was blocked 14598 _this.autoplayBlocked(true); 14599 }); 14600 }); 14601 this.videoObject = vimeoPlayer; 14602 }; 14603 HeaderVideo.prototype.showVideoAndAttachControls = function () { 14604 this.imageFallback.setAttribute('aria-hidden', 'true'); 14605 this.videoWrapper.removeAttribute('aria-hidden'); 14606 this.container.setAttribute('data-header-video-container', 'video'); 14607 this.attachControls(); 14608 }; 14609 HeaderVideo.prototype.attachControls = function () { 14610 this.controls.pauseButton.classList.remove('hide'); 14611 this.controls.pauseButton.addEventListener('click', this.playPause.bind(this)); 14612 this.controls.playButton.addEventListener('click', this.playPause.bind(this)); 14613 this.overlay.addEventListener('click', this.playPause.bind(this)); 14614 if (this.controls.unmuteButton) { 14615 this.controls.unmuteButton.classList.remove('hide'); 14616 this.controls.muteButton.addEventListener('click', this.muteUnmute.bind(this)); 14617 this.controls.unmuteButton.addEventListener('click', this.muteUnmute.bind(this)); 14618 } 14619 }; 14620 HeaderVideo.prototype.playPause = function () { 14621 var _this = this; 14622 // Youtube Play and Pause 14623 if (this.videoType === VideoType.YOUTUBE) { 14624 var playerState = this.videoObject.getPlayerState(); 14625 // == 1 means it's playing 14626 if (playerState == 1) { 14627 this.videoObject.pauseVideo(); 14628 this.setControlVisibility(this.controls.pauseButton, this.controls.playButton); 14629 } 14630 else { 14631 this.videoObject.playVideo(); 14632 this.setControlVisibility(this.controls.playButton, this.controls.pauseButton); 14633 } 14634 } 14635 // Native Play and Pause 14636 if (this.videoType === VideoType.NATIVE) { 14637 if (this.videoObject.paused) { 14638 this.videoObject.play(); 14639 this.setControlVisibility(this.controls.playButton, this.controls.pauseButton); 14640 } 14641 else { 14642 this.videoObject.pause(); 14643 this.setControlVisibility(this.controls.pauseButton, this.controls.playButton); 14644 } 14645 } 14646 // Vimeo Play and Pause 14647 if (this.videoType === VideoType.VIMEO) { 14648 this.videoObject.getPaused().then(function (paused) { 14649 if (paused) { 14650 _this.videoObject.play(); 14651 _this.setControlVisibility(_this.controls.playButton, _this.controls.pauseButton); 14652 } 14653 else { 14654 _this.videoObject.pause(); 14655 _this.setControlVisibility(_this.controls.pauseButton, _this.controls.playButton); 14656 } 14657 }); 14658 } 14659 }; 14660 HeaderVideo.prototype.muteUnmute = function () { 14661 var _this = this; 14662 // Youtube Mute and Unmute 14663 if (this.videoType === VideoType.YOUTUBE) { 14664 var isMuted = this.videoObject.isMuted(); 14665 if (isMuted) {
14666 this.videoObject.unMute(); 14667 this.setControlVisibility(this.controls.unmuteButton, this.controls.muteButton); 14668 } 14669 else { 14670 this.videoObject.mute(); 14671 this.setControlVisibility(this.controls.muteButton, this.controls.unmuteButton); 14672 } 14673 } 14674 // Native Mute and Unmute 14675 if (this.videoType === VideoType.NATIVE) { 14676 if (this.videoObject.muted) { 14677 this.videoObject.muted = false; 14678 this.setControlVisibility(this.controls.unmuteButton, this.controls.muteButton); 14679 } 14680 else { 14681 this.videoObject.muted = true; 14682 this.setControlVisibility(this.controls.muteButton, this.controls.unmuteButton); 14683 } 14684 } 14685 // Vimeo Mute and Unmute 14686 if (this.videoType === VideoType.VIMEO) { 14687 this.videoObject.getVolume().then(function (volume) { 14688 if (volume > 0) { 14689 _this.videoObject.setVolume(0).then(function (volume) { 14690 _this.setControlVisibility(_this.controls.muteButton, _this.controls.unmuteButton); 14691 }); 14692 } 14693 else { 14694 _this.videoObject.setVolume(1).then(function (volume) { 14695 _this.setControlVisibility(_this.controls.unmuteButton, _this.controls.muteButton); 14696 }); 14697 } 14698 }); 14699 } 14700 }; 14701 HeaderVideo.prototype.setDimensions = function () { 14702 var headerWidth = this.container.offsetWidth; 14703 var headerHeight = this.container.offsetHeight; 14704 this.video.style.width = "".concat(Math.max(headerWidth, (headerHeight * 16 / 9)), "px"); 14705 this.video.style.height = "".concat(Math.max((headerHeight + this.videoEdgeOffset), (headerWidth * 9 / 16)), "px"); 14706 }; 14707 HeaderVideo.prototype.autoplayBlocked = function (allowManualPlay, isYouTube) { 14708 if (isYouTube) { 14709 this.ytSetDuration(); 14710 } 14711 if (allowManualPlay) { 14712 this.switchToImage(); 14713 this.imageFallback.addEventListener('click', this.imageFallbackPlayback.bind(this)); 14714 } 14715 else { 14716 this.switchToImage(); 14717 } 14718 }; 14719 HeaderVideo.prototype.imageFallbackPlayback = function () { 14720 this.showVideoAndAttachControls(); 14721 this.playPause(); 14722 }; 14723 HeaderVideo.prototype.switchToImage = function () { 14724 this.imageFallback.removeAttribute('aria-hidden'); 14725 this.videoWrapper.setAttribute('aria-hidden', 'true'); 14726 this.container.setAttribute('data-header-video-container', 'image'); 14727 if (this.content) { 14728 this.content.setAttribute('data-hero-no-video', ''); 14729 } 14730 }; 14731 HeaderVideo.prototype.setControlVisibility = function (thingToHide, thingToShow) { 14732 thingToHide.classList.add('hide'); 14733 thingToShow.classList.remove('hide'); 14734 thingToShow.focus(); 14735 }; 14736 HeaderVideo.prototype.ytVideoLoaded = function () { 14737 if (this.videoObject) { 14738 var playerState = this.videoObject.getPlayerState(); 14739 if (playerState === 5) { 14740 // autoplay is blocked abort abort 14741 this.autoplayBlocked(true, true); 14742 } 14743 else { 14744 this.ytSetDuration(); 14745 this.showVideoAndAttachControls(); 14746 } 14747 } 14748 }; 14749 HeaderVideo.prototype.ytSetDuration = function () { 14750 var duration = this.videoObject.getDuration(); 14751 this.videoEndTime = this.videoEndTime ? Math.min(this.videoEndTime, duration) : duration; 14752 this.videoStartTime = this.videoEndTime > this.videoStartTime ? this.videoStartTime : 0; 14753 }; 14754 HeaderVideo.prototype.ytSetTimeChecker = function () { 14755 if (this.videoObject) { 14756 var playerState = this.videoObject.getPlayerState(); 14757 if (playerState === 1) { // playing 14758 clearInterval(this.endTimeChecker); 14759 this.endTimeChecker = setInterval(this.ytCheckForEnd.bind(this), 1000); 14760 } 14761 else if (playerState === 0) { // ended
14762 this.videoObject.seekTo(this.videoStartTime); 14763 this.videoObject.playVideo(); 14764 } 14765 else { 14766 clearInterval(this.endTimeChecker); 14767 } 14768 } 14769 }; 14770 HeaderVideo.prototype.ytCheckForEnd = function () { 14771 var curTime = this.videoObject.getCurrentTime(); 14772 if (curTime >= this.videoEndTime) { 14773 this.videoObject.seekTo(this.videoStartTime); 14774 } 14775 }; 14776 HeaderVideo.prototype.ytOnPlayerStateChange = function (e) { 14777 this.ytSetTimeChecker(); 14778 }; 14779 return HeaderVideo; 14780}()); 14781exports.HeaderVideo = HeaderVideo; 14782 14783 14784/***/ }, 14785 14786/***/ "./Static/javascript/modules/login-state.ts" 14787/*!**************************************************!*\ 14788 !*** ./Static/javascript/modules/login-state.ts ***! 14789 \**************************************************/ 14790(__unused_webpack_module, exports) { 14791 14792"use strict"; 14793 14794Object.defineProperty(exports, "__esModule", ({ value: true })); 14795exports.loginState = void 0; 14796function loginState() { 14797 var nav = document.querySelector('nav.utility[data-login-api-base]'); 14798 if (!nav) 14799 return; 14800 var loggedOut = document.querySelector('[data-login-state="logged-out"]'); 14801 var loggedIn = document.querySelector('[data-login-state="logged-in"]'); 14802 var applyState = function (isLoggedIn) { 14803 if (loggedOut) 14804 loggedOut.hidden = isLoggedIn; 14805 if (loggedIn) 14806 loggedIn.hidden = !isLoggedIn; 14807 }; 14808 var base = nav.getAttribute('data-login-api-base') || ''; 14809 // On TNEW pages (base is populated), read login state from TNEW's own DOM 14810 // instead of cross-origin fetching the Umbraco API. Browsers with third-party 14811 // cookie blocking (Chrome Tracking Protection, Safari ITP, Firefox TCP) strip 14812 // the session cookie from the cross-site fetch even with SameSite=None, so the 14813 // API returns anonymous for logged-in users. TNEW server-renders the BEM 14814 // modifier class `--logged-in` on its account panel; fall back to the presence 14815 // of a logout link in case TNEW's markup changes. 14816 if (base) { 14817 var tnewLoggedIn = !!document.querySelector('.tn-utility-nav-account-section--logged-in') || 14818 !!document.querySelector('a[href*="/account/logout"]'); 14819 applyState(tnewLoggedIn); 14820 return; 14821 } 14822 fetch("".concat(base, "/umbraco/api/loginstate/isloggedin"), { 14823 credentials: 'include', 14824 headers: { 'Accept': 'application/json' } 14825 }) 14826 .then(function (response) { return response.ok ? response.json() : false; }) 14827 .then(function (isLoggedIn) { return applyState(isLoggedIn); }) 14828 .catch(function () { 14829 if (loggedOut) 14830 loggedOut.hidden = false; 14831 }); 14832} 14833exports.loginState = loginState; 14834 14835 14836/***/ }, 14837 14838/***/ "./Static/javascript/modules/mainNavigation.ts" 14839/*!*****************************************************!*\ 14840 !*** ./Static/javascript/modules/mainNavigation.ts ***! 14841 \*****************************************************/ 14842(__unused_webpack_module, exports, __webpack_require__) { 14843 14844"use strict"; 14845 14846Object.defineProperty(exports, "__esModule", ({ value: true })); 14847exports.mainNavigation = void 0; 14848var lockBody_1 = __webpack_require__(/*! ../helpers/lockBody */ "./Static/javascript/helpers/lockBody.ts"); 14849var waitForImages_1 = __webpack_require__(/*! ../helpers/waitForImages */ "./Static/javascript/helpers/waitForImages.ts"); 14850// Static strings 14851var openMenuClass = 'nav-menu-is-open'; 14852var navLoadedClass = 'nav-has-loaded'; 14853var menuSlideStateAttribute = 'data-nav-expanded'; 14854var navId = "navContainer"; 14855var menuId = "nav-mobile-menu"; 14856var breadCrumbId = "breadcrumbs"; 14857var megaNavOpenAttribute = 'data-mega-nav-open'; 14858var searchId = "navSearch"; 14859var MainNavigation = /** @class */ (function () { 14860 function MainNavigation(navigation) { 14861 var _this = this; 14862 var _a; 14863 this.init = function () { 14864 _this.menuTrigger.addEventListener('click', function () { 14865 if (_this.menuIsOpen) { 14866 _this.closeMenu(); 14867 } 14868 else { 14869 if (_this.searchIsOpen) { 14870 _this.closeSearch(); 14871 } 14872 _this.openMenu(); 14873 } 14874 }); 14875 _this.searchTrigger.addEventListener('click', function () { 14876 if (_this.menuIsOpen) { 14877 _this.closeMenu(); 14878 _this.openSearch(); 14879 } 14880 else if (_this.searchIsOpen) { 14881 _this.closeSearch(); 14882 } 14883 else { 14884 _this.closeAllSubMenus(); 14885 _this.openSearch(); 14886 } 14887 }); 14888 document.body.addEventListener('keyup', function (e) { 14889 if (e.which === 27) { 14890 if (_this.menuIsOpen) { // Escape key 14891 _this.closeMenu(); 14892 _this.menuTrigger.focus(); 14893 } 14894 if (_this.subNavsOpen) { // Escape key 14895 _this.closeAllSubMenus(); 14896 } 14897 } 14898 if (e.which == 9) { // Tab key. Show nav if tabbed into, or close menu if tabbed out of. 14899 var focusInNav = _this.container.contains(document.activeElement); 14900 if (focusInNav && !_this.navIsShowing) { 14901 _this.slideDown(); 14902 } 14903 if (!focusInNav && _this.menuIsOpen) { 14904 _this.closeMenu(); 14905 } 14906 } 14907 }); 14908 // Setup on page load 14909 _this.closeMenu(); 14910 _this.setPageOffset(); 14911 _this.slideDown(); 14912 // wait for the site logo to load, then set the nav height again 14913 (0, waitForImages_1.waitForImages)(_this.container) 14914 .then(function () { 14915 _this.setPageOffset(); 14916 }); 14917 }; 14918 this.closeAllSubMenus = function () { 14919 var openSubMenus = _this.navItemTriggers.filter(function (navItemTrigger) { return navItemTrigger.getAttribute('aria-expanded') === 'true'; });
14920 openSubMenus.forEach(function (subMenuTrigger) { 14921 _this.closeSubnavPanel(subMenuTrigger); 14922 }); 14923 _this.subNavsOpen = false; 14924 }; 14925 this.detectOutsideSubmenuClick = function (e) { 14926 if (_this.subNavsOpen && !_this.menuIsOpen) { //If a submenu is open but it's not in a mobile menu 14927 if (!e.target.closest("[data-nav-sub]")) { 14928 _this.closeAllSubMenus(); 14929 } 14930 } 14931 }; 14932 this.openSubnavPanel = function (trigger) { 14933 _this.closeAllSubMenus(); 14934 var panelToOpen = document.querySelector("#".concat(trigger.getAttribute('aria-controls'))); 14935 panelToOpen.inert = false; 14936 trigger.setAttribute('aria-expanded', 'true'); 14937 _this.subNavsOpen = true; 14938 document.addEventListener("click", _this.detectOutsideSubmenuClick.bind(_this)); 14939 _this.htmlElement.setAttribute(megaNavOpenAttribute, 'true'); 14940 }; 14941 this.closeSubnavPanel = function (trigger) { 14942 var panelToClose = document.querySelector("#".concat(trigger.getAttribute('aria-controls'))); 14943 panelToClose.inert = true; 14944 trigger.setAttribute('aria-expanded', 'false'); 14945 _this.subNavsOpen = false; 14946 document.removeEventListener("click", _this.detectOutsideSubmenuClick.bind(_this)); 14947 _this.htmlElement.setAttribute(megaNavOpenAttribute, 'false'); 14948 }; 14949 this.handleTriggerClick = function (trigger) { 14950 var triggerIsOpen = trigger.getAttribute('aria-expanded') == 'true'; 14951 if (!triggerIsOpen) { 14952 if (_this.searchIsOpen) { 14953 _this.closeSearch(); 14954 } 14955 _this.openSubnavPanel(trigger); 14956 } 14957 else { 14958 _this.closeSubnavPanel(trigger); 14959 } 14960 }; 14961 this.slideDown = function () { 14962 _this.navIsShowing = true; 14963 _this.htmlElement.setAttribute(menuSlideStateAttribute, 'true'); 14964 _this.setCssVariables(); 14965 }; 14966 this.slideUp = function () { 14967 _this.navIsShowing = false; 14968 _this.htmlElement.setAttribute(menuSlideStateAttribute, 'false'); 14969 _this.setCssVariables(); 14970 }; 14971 this.openMenu = function () { 14972 _this.menuPanel.setAttribute('aria-hidden', 'false'); 14973 _this.menuTrigger.setAttribute('aria-expanded', 'true'); 14974 _this.enableTabbableChildren(); 14975 _this.menuIsOpen = true; 14976 _this.existingBodyStyles = (0, lockBody_1.lockBody)(); 14977 _this.container.classList.add(openMenuClass); 14978 }; 14979 this.closeMenu = function () { 14980 _this.menuPanel.setAttribute('aria-hidden', 'true'); 14981 _this.menuTrigger.setAttribute('aria-expanded', 'false'); 14982 _this.disableTabbableChildren(); 14983 _this.menuIsOpen = false; 14984 if (_this.existingBodyStyles) { 14985 (0, lockBody_1.unlockBody)(_this.existingBodyStyles); 14986 _this.existingBodyStyles = null; 14987 } 14988 _this.container.classList.remove(openMenuClass); 14989 _this.setPageOffset(); 14990 }; 14991 this.openSearch = function () { 14992 _this.searchIsOpen = true; 14993 _this.searchPanel.setAttribute('aria-hidden', 'false'); 14994 _this.searchTrigger.setAttribute('aria-expanded', 'true'); 14995 console.log(_this.searchInput); 14996 setTimeout(function () { 14997 var _a; 14998 (_a = _this.searchInput) === null || _a === void 0 ? void 0 : _a.focus(); 14999 }, 0); 15000 }; 15001 this.closeSearch = function () { 15002 _this.searchIsOpen = false; 15003 _this.searchPanel.setAttribute('aria-hidden', 'true'); 15004 _this.searchTrigger.setAttribute('aria-expanded', 'false'); 15005 }; 15006 this.enableTabbableChildren = function () {
15007 _this.menuFocusableChildren.forEach(function (child) { 15008 child.tabIndex = 0; 15009 }); 15010 }; 15011 this.disableTabbableChildren = function () { 15012 _this.menuFocusableChildren.forEach(function (child) { 15013 child.tabIndex = -1; 15014 }); 15015 }; 15016 this.setPageOffset = function () { 15017 if (!_this.hasLoaded) { 15018 _this.container.classList.add(navLoadedClass); 15019 _this.hasLoaded = true; 15020 } 15021 _this.setCssVariables(); 15022 }; 15023 this.scrollHandler = function () { 15024 // Skip scroll handling when body is locked (modal open) 15025 if (_this.scrollLocked) { 15026 return; 15027 } 15028 if (_this.hasLoaded) { 15029 var currentPosition = window.pageYOffset; 15030 var delta = currentPosition - _this.lastScrollPosition; 15031 _this.lastScrollPosition = currentPosition; 15032 if (_this.navIsShowing) { 15033 if (delta > 0 && currentPosition > _this.currentNavHeight && !_this.menuIsOpen) { 15034 _this.slideUp(); 15035 } 15036 } 15037 else if (delta < 0 || currentPosition < _this.currentNavHeight) { 15038 _this.slideDown(); 15039 } 15040 } 15041 }; 15042 this.getElementHeight = function (element) { 15043 return element ? element.offsetHeight : 0; 15044 }; 15045 this.resizeHandler = function () { 15046 _this.setPageOffset(); 15047 }; 15048 this.setCssVariables = function () { 15049 document.documentElement.style.setProperty('--nav-clearance', "".concat(_this.navIsShowing ? _this.currentNavHeight : _this.currentNavHeight, "px")); 15050 document.documentElement.style.setProperty('--breadcrumbs-offset', "".concat(_this.getElementHeight(_this.breadcrumbs), "px")); 15051 }; 15052 this.htmlElement = document.documentElement; 15053 this.container = navigation; 15054 this.menuTrigger = this.container.querySelector("[aria-controls=\"".concat(menuId, "\"]")); 15055 this.menuPanel = document.querySelector("#".concat(menuId)); 15056 this.menuFocusableChildren = [].slice.call(this.menuPanel.querySelectorAll('button, a, input')); 15057 this.breadcrumbs = document.querySelector("#".concat(breadCrumbId)); 15058 this.menuIsOpen = false; 15059 this.navIsShowing = true; 15060 this.hasLoaded = false; 15061 this.existingBodyStyles = null; 15062 this.navSearchCloseBtn = null; 15063 this.searchPanel = document.querySelector("#".concat(searchId)); 15064 this.searchIsOpen = false; 15065 this.searchTrigger = this.container.querySelector('[data-search-trigger]'); 15066 this.searchInput = (_a = this.searchPanel) === null || _a === void 0 ? void 0 : _a.querySelector('input[name="q"]'); 15067 this.navItemTriggers = [].slice.call(this.container.querySelectorAll('[data-nav-button]')); 15068 // Intercept on-page links so that the offset recalculates before the browser reaches it 15069 // This makes sure that the target is always comfortably visible below the nav 15070 this.onPageAnchorLinks = [].slice.call(document.querySelectorAll('a[href^="#"]')); 15071 this.onPageAnchorLinks.forEach(function (link) { 15072 link.addEventListener('click', function (e) { 15073 e.preventDefault(); 15074 var hash = link.getAttribute('href'); 15075 var target = document.querySelector(hash); 15076 if (target) { 15077 if (_this.navIsShowing && target.offsetTop > window.pageYOffset) { 15078 _this.slideUp(); 15079 } 15080 else if (!_this.navIsShowing && target.offsetTop < window.pageYOffset) { 15081 _this.slideDown(); 15082 } 15083 setTimeout(function () { 15084 target.scrollIntoView(true); 15085 target.focus(); 15086 window.location.hash = hash; 15087 }, 0); 15088 } 15089 }); 15090 });
15091 this.navItemTriggers.forEach(function (trigger) { 15092 trigger.addEventListener('click', function () { return _this.handleTriggerClick(trigger); }); 15093 }); 15094 this.subNavsOpen = false; 15095 this.scrollLocked = false; 15096 this.setCssVariables(); 15097 } 15098 Object.defineProperty(MainNavigation.prototype, "currentNavHeight", { 15099 get: function () { 15100 return this.container.offsetHeight; 15101 }, 15102 enumerable: false, 15103 configurable: true 15104 }); 15105 return MainNavigation; 15106}()); 15107var mainNavigation = null; 15108exports.mainNavigation = mainNavigation; 15109var navContainer = document.querySelector("#".concat(navId)); 15110if (navContainer) { 15111 exports.mainNavigation = mainNavigation = new MainNavigation(navContainer); 15112 window.mainNavigation = mainNavigation; 15113} 15114 15115 15116/***/ }, 15117 15118/***/ "./Static/javascript/modules/promo-interface.ts" 15119/*!******************************************************!*\ 15120 !*** ./Static/javascript/modules/promo-interface.ts ***! 15121 \******************************************************/ 15122() { 15123 15124var PromoInterface = /** @class */ (function () { 15125 function PromoInterface(container) { 15126 var _this = this; 15127 this.container = container; 15128 this.trigger = container.querySelector('[data-promo-entry]'); 15129 this.panel = container.querySelector('[data-promo-input]'); 15130 this.hasError = this.trigger.classList.contains('hide'); 15131 if (!this.hasError) { 15132 this.trigger.addEventListener('click', function () { 15133 _this.trigger.classList.add('hide'); 15134 _this.panel.classList.remove('hide'); 15135 }); 15136 } 15137 } 15138 return PromoInterface; 15139}()); 15140var promoEls = [].slice.call(document.querySelectorAll('[data-promo]')); 15141promoEls.forEach(function (promoEl) { 15142 new PromoInterface(promoEl); 15143}); 15144 15145 15146/***/ }, 15147 15148/***/ "./Static/javascript/modules/quickDonate.ts" 15149/*!**************************************************!*\ 15150 !*** ./Static/javascript/modules/quickDonate.ts ***! 15151 \**************************************************/ 15152(__unused_webpack_module, exports) { 15153 15154"use strict"; 15155 15156Object.defineProperty(exports, "__esModule", ({ value: true })); 15157exports.QuickDonate = void 0; 15158var QuickDonate = /** @class */ (function () { 15159 function QuickDonate(block) { 15160 var _this = this; 15161 this.init = function () { 15162 _this.initRadioListeners(); 15163 _this.handleCustomAmountField(); 15164 _this.donationInput.addEventListener('change', function (e) { 15165 _this.customRadio.value = _this.donationInput.value; 15166 }); 15167 }; 15168 this.handleCustomAmountField = function () { 15169 if (_this.customRadio.checked) { 15170 _this.donationInput.parentElement.setAttribute("aria-hidden", "false"); 15171 _this.donationInput.focus(); 15172 } 15173 else { 15174 _this.donationInput.parentElement.setAttribute("aria-hidden", "true"); 15175 } 15176 }; 15177 this.initRadioListeners = function () { 15178 var allRadios = Array.prototype.slice.call(document.querySelectorAll('input[name="amount"]')); 15179 allRadios.forEach(function (radio) { 15180 if (radio.checked) { 15181 _this.donationInput.value = radio.value; 15182 } 15183 radio.addEventListener('change', function () { 15184 allRadios.forEach(function (radio_) { 15185 if (radio_.checked) { 15186 _this.donationInput.value = radio_.value; 15187 _this.handleCustomAmountField(); 15188 } 15189 }); 15190 }); 15191 }); 15192 }; 15193 this.blockEl = block; 15194 this.donationInput = block.querySelector('[data-donate-input]'); 15195 this.donateUrl = block.querySelector('#settings_DonatePage_Url').value; 15196 this.fundId = block.querySelector('#settings_FundID').value; 15197 this.customRadio = block.querySelector('[data-custom-radio]'); 15198 this.init(); 15199 } 15200 return QuickDonate; 15201}()); 15202exports.QuickDonate = QuickDonate; 15203 15204 15205/***/ }, 15206 15207/***/ "./Static/javascript/modules/revealPanel.ts" 15208/*!**************************************************!*\ 15209 !*** ./Static/javascript/modules/revealPanel.ts ***! 15210 \**************************************************/ 15211(__unused_webpack_module, exports, __webpack_require__) { 15212 15213"use strict"; 15214 15215Object.defineProperty(exports, "__esModule", ({ value: true })); 15216exports.RevealPanel = void 0; 15217var enableTabbableChildren_1 = __webpack_require__(/*! ../helpers/enableTabbableChildren */ "./Static/javascript/helpers/enableTabbableChildren.ts"); 15218var disableTabbableChildren_1 = __webpack_require__(/*! ../helpers/
15218disableTabbableChildren */ "./Static/javascript/helpers/disableTabbableChildren.ts"); 15219var getHeightOfHidden_1 = __webpack_require__(/*! ../helpers/getHeightOfHidden */ "./Static/javascript/helpers/getHeightOfHidden.ts"); 15220var lodash_1 = __webpack_require__(/*! lodash */ "lodash"); 15221var transitionSpeed = 300; 15222var defaultPanelAttribute = 'data-panel'; 15223var openClass = 'opened'; 15224var RevealPanel = /** @class */ (function () { 15225 function RevealPanel(panel) { 15226 var _this = this; 15227 var _a; 15228 var panelId = typeof panel == 'string' ? panel : panel.id; 15229 this.panel = document.querySelector("#".concat(panelId)); 15230 this.triggers = [].slice.call(document.querySelectorAll("[aria-controls=\"".concat(panelId, "\"]"))); 15231 this.childPanels = [].slice.call(this.panel.querySelectorAll("[".concat(defaultPanelAttribute, "]"))); 15232 this.clearInputsOnClose = ((_a = this.panel.getAttribute('data-clear-inputs-on-close')) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'true'; 15233 this.isOpen = false; 15234 this.openHandlers = []; 15235 this.closeHandlers = []; 15236 this.afterCloseHandlers = []; 15237 if (this.clearInputsOnClose) { 15238 // We're not getting select elements here, because there's much more logic at play for state/country select states and we don't need to make them blank 15239 this.inputChildren = [].slice.call(this.panel.querySelectorAll('input, textarea')); 15240 } 15241 window.addEventListener('resize', (0, lodash_1.debounce)(function () { 15242 _this.setPanelHeight(); 15243 }, 100)); 15244 this.triggers.forEach(function (trigger) { 15245 if (!trigger.matches('input[type="checkbox"] + label, input[type="radio"] + label, input[type="checkbox"] + input[type="hidden"] + label, input[type="radio"] + input[type="hidden"] + label')) { 15246 _this.initButtonTrigger(trigger); 15247 } 15248 else { 15249 _this.initRadioOrCheckboxTrigger(trigger); 15250 } 15251 }); 15252 } 15253 RevealPanel.prototype.initButtonTrigger = function (trigger) { 15254 trigger.addEventListener('click', this.triggerClick.bind(this)); 15255 this.initClosedPanel(); 15256 }; 15257 RevealPanel.prototype.initRadioOrCheckboxTrigger = function (trigger) { 15258 var _this = this; 15259 var triggerInput = trigger.previousElementSibling; 15260 if (triggerInput.getAttribute('type') == 'hidden') { 15261 triggerInput = triggerInput.previousElementSibling; 15262 } 15263 var inputGroup = [].slice.call(document.querySelectorAll("[type=\"radio\"][name=\"".concat(triggerInput.name, "\"], [type=\"checkbox\"][name=\"").concat(triggerInput.name, "\"]"))); 15264 if (triggerInput.checked) { 15265 this.initOpenPanel(); 15266 } 15267 else { 15268 this.initClosedPanel(); 15269 } 15270 inputGroup.forEach(function (inputInGroup) { 15271 inputInGroup.addEventListener('change', function () { 15272 if (triggerInput.checked) { 15273 if (!_this.isOpen) { 15274 _this.openPanel(); 15275 } 15276 } 15277 else { 15278 if (_this.isOpen) { 15279 _this.closePanel(); 15280 } 15281 } 15282 }); 15283 }); 15284 }; 15285 RevealPanel.prototype.initOpenPanel = function () { 15286 var _this = this; 15287 setTimeout(function () { 15288 _this.setPanelHeight(); 15289 _this.openPanel(); 15290 }, 0); 15291 }; 15292 RevealPanel.prototype.initClosedPanel = function () { 15293 var _this = this; 15294 setTimeout(function () { 15295 _this.setPanelHeight(); 15296 _this.closePanel(); 15297 }, 0); 15298 }; 15299 RevealPanel.prototype.on = function (event, handler) { 15300 switch (event) { 15301 case "open": 15302 return this.openHandlers.push(handler); 15303 case "close": 15304 return this.closeHandlers.push(handler); 15305 case "afterClose": 15306 return this.afterCloseHandlers.push(handler); 15307 } 15308 }; 15309 RevealPanel.prototype.setPanelHeight = function (childPanel) { 15310 if (childPanel) { 15311 var childPanelHeight = (0, getHeightOfHidden_1.getHeightOfHidden)(childPanel); 15312 childPanel.style.height = "".concat(childPanelHeight, "px"); 15313 } 15314 else { 15315 var panelHeight = (0, getHeightOfHidden_1.getHeightOfHidden)(this.panel); 15316 this.panel.style.height = "".concat(panelHeight, "px"); 15317 } 15318 }; 15319 RevealPanel.prototype.triggerClick = function (e) { 15320 if (this.isOpen) { 15321 this.closePanel(); 15322 } 15323 else {
15324 this.openPanel(); 15325 } 15326 }; 15327 RevealPanel.prototype.openPanel = function () { 15328 var _this = this; 15329 var handleOpen = function () { 15330 if (_this.isOpen) { 15331 _this.panel.style.overflow = 'visible'; 15332 _this.childPanels.forEach(function (childPanel) { 15333 _this.setPanelHeight(childPanel); 15334 }); 15335 _this.panel.classList.add(openClass); 15336 } 15337 }; 15338 setTimeout(function () { 15339 handleOpen(); 15340 if (_this.openHandlers.length > 0) { 15341 _this.openHandlers.forEach(function (handler) { 15342 requestAnimationFrame(handler.bind(_this)); 15343 }); 15344 } 15345 }, transitionSpeed); 15346 this.triggers.forEach(function (trigger) { 15347 trigger.setAttribute('aria-expanded', 'true'); 15348 }); 15349 this.panel.setAttribute('aria-hidden', 'false'); 15350 (0, enableTabbableChildren_1.enableTabbableChildren)(this.panel); 15351 this.isOpen = true; 15352 }; 15353 RevealPanel.prototype.closePanel = function () { 15354 var _this = this; 15355 this.panel.classList.remove(openClass); 15356 if (this.clearInputsOnClose) { 15357 this.clearChildInputs(); 15358 } 15359 if (this.closeHandlers.length > 0) { 15360 this.closeHandlers.forEach(function (handler) { 15361 handler(); 15362 }); 15363 } 15364 requestAnimationFrame(function () { 15365 _this.panel.style.overflow = ''; 15366 _this.triggers.forEach(function (trigger) { 15367 trigger.setAttribute('aria-expanded', 'false'); 15368 }); 15369 _this.panel.setAttribute('aria-hidden', 'true'); 15370 (0, disableTabbableChildren_1.disableTabbableChildren)(_this.panel); 15371 _this.isOpen = false; 15372 }); 15373 if (this.afterCloseHandlers.length > 0) { 15374 this.afterCloseHandlers.forEach(function (handler) { 15375 setTimeout(function () { 15376 requestAnimationFrame(handler.bind(_this)); 15377 }, transitionSpeed); 15378 }); 15379 } 15380 }; 15381 RevealPanel.prototype.clearChildInputs = function () { 15382 this.inputChildren.forEach(function (field) { 15383 var changeEvent = new Event('change'); 15384 var fieldType = field.getAttribute('type'); 15385 if (fieldType == 'radio' || fieldType == 'checkbox') { 15386 field.checked = false; 15387 } 15388 else if (fieldType != 'hidden') { 15389 field.value = ''; 15390 } 15391 field.dispatchEvent(changeEvent); 15392 }); 15393 }; 15394 return RevealPanel; 15395}()); 15396exports.RevealPanel = RevealPanel; 15397 15398 15399/***/ }, 15400 15401/***/ "./Static/javascript/modules/show-hide-password.ts" 15402/*!*********************************************************!*\ 15403 !*** ./Static/javascript/modules/show-hide-password.ts ***! 15404 \*********************************************************/ 15405(__unused_webpack_module, exports) { 15406 15407"use strict"; 15408 15409Object.defineProperty(exports, "__esModule", ({ value: true })); 15410exports.showHidePassword = void 0; 15411var showHidePassword = function () { 15412 var passwordToggles = [].slice.call(document.querySelectorAll('[data-password-input]')); 15413 passwordToggles.forEach(function (toggleContainer) { 15414 var passwordToggle = toggleContainer.querySelector('button'); 15415 var passwordInput = toggleContainer.querySelector('input[type="password"]'); 15416 if (passwordToggle && passwordInput) { 15417 var showText_1 = passwordToggle.getAttribute('data-password-input-show'); 15418 var hideText_1 = passwordToggle.getAttribute('data-password-input-hide'); 15419 var checked_1 = false; 15420 passwordToggle.addEventListener('click', function () { 15421 if (!checked_1) { 15422 passwordInput.type = 'text'; 15423 passwordToggle.setAttribute('aria-label', hideText_1); 15424 passwordToggle.setAttribute('aria-pressed', 'true'); 15425 } 15426 else { 15427 passwordInput.type = 'password'; 15428 passwordToggle.setAttribute('aria-label', showText_1); 15429 passwordToggle.setAttribute('aria-pressed', 'false'); 15430 } 15431 checked_1 = !checked_1; 15432 }); 15433 } 15434 });
15435}; 15436exports.showHidePassword = showHidePassword; 15437 15438 15439/***/ }, 15440 15441/***/ "./Static/javascript/modules/splide-transition.ts" 15442/*!********************************************************!*\ 15443 !*** ./Static/javascript/modules/splide-transition.ts ***! 15444 \********************************************************/ 15445(__unused_webpack_module, exports, __webpack_require__) { 15446 15447"use strict"; 15448 15449Object.defineProperty(exports, "__esModule", ({ value: true })); 15450exports.MyTransition = void 0; 15451var splide_1 = __webpack_require__(/*! @splidejs/splide */ "./node_modules/@splidejs/splide/dist/js/splide.cjs.js"); 15452//https://splidejs.com/guides/transition/ for docs 15453function MyTransition(Splide, Components) { 15454 var bind = (0, splide_1.EventInterface)(Splide).bind; 15455 var Move = Components.Move; 15456 var list = Components.Elements.list; 15457 var endCallback; 15458 function mount() { 15459 bind(list, 'transitionend', function (e) { 15460 if (e.target === list && endCallback) { 15461 // Removes the transition property 15462 cancel(); 15463 // Calls the `done` callback 15464 endCallback(); 15465 } 15466 }); 15467 } 15468 function start(index, done) { 15469 // Converts the index to the position 15470 var destination = Move.toPosition(index, true); 15471 // Applies the CSS transition 15472 list.style.transition = 'transform 300ms cubic-bezier(.44,.65,.07,1.01)'; 15473 // Moves the carousel to the destination. 15474 Move.translate(destination); 15475 // Keeps the callback to invoke later. 15476 endCallback = done; 15477 } 15478 function cancel() { 15479 list.style.transition = ''; 15480 } 15481 return { 15482 mount: mount, 15483 start: start, 15484 cancel: cancel, 15485 }; 15486} 15487exports.MyTransition = MyTransition; 15488 15489 15490/***/ }, 15491 15492/***/ "./Static/javascript/modules/sticky-sidebar-component.ts" 15493/*!***************************************************************!*\ 15494 !*** ./Static/javascript/modules/sticky-sidebar-component.ts ***! 15495 \***************************************************************/ 15496(__unused_webpack_module, exports, __webpack_require__) { 15497 15498"use strict"; 15499 15500var __importDefault = (this && this.__importDefault) || function (mod) { 15501 return (mod && mod.__esModule) ? mod : { "default": mod }; 15502}; 15503Object.defineProperty(exports, "__esModule", ({ value: true })); 15504exports.StickySidebarComponent = void 0; 15505// Resize Sensor will ensure the sticky sidebar is able to update itself when the browser is resized 15506__webpack_require__(/*! css-element-queries/src/ResizeSensor.js */ "./node_modules/css-element-queries/src/ResizeSensor.js"); 15507var sticky_sidebar_js_1 = __importDefault(__webpack_require__(/*! sticky-sidebar/dist/sticky-sidebar.js */ "./node_modules/sticky-sidebar/dist/sticky-sidebar.js")); 15508var StickySidebarComponent = /** @class */ (function () { 15509 function StickySidebarComponent(sidebar) { 15510 var _this = this; 15511 this.topMargin = parseInt(sidebar.getAttribute('data-margin-top')); 15512 this.bottomMargin = parseInt(sidebar.getAttribute('data-margin-bottom')); 15513 this.breakpoint = parseInt(sidebar.getAttribute('data-sticky-for')); 15514 this.updateStickySidebar = this.updateStickySidebar.bind(this); 15515 this.stickySidebar = new sticky_sidebar_js_1.default("#".concat(sidebar.id), { 15516 containerSelector: '[data-sticky-container]', 15517 innerWrapperSelector: '[data-sticky-inner]', 15518 topSpacing: this.topMargin, 15519 bottomSpacing: this.bottomMargin, 15520 minWidth: this.breakpoint 15521 }); 15522 // Update it after a beat, in case anything needs to finish loading 15523 window.requestAnimationFrame(function () { 15524 _this.updateStickySidebar(); 15525 }); 15526 } 15527 StickySidebarComponent.prototype.updateStickySidebar = function () { 15528 if (this.stickySidebar) { 15529 this.stickySidebar.updateSticky(); 15530 } 15531 }; 15532 return StickySidebarComponent; 15533}()); 15534exports.StickySidebarComponent = StickySidebarComponent; 15535var stickyContainerEls = [].slice.call(document.querySelectorAll('[data-sticky-el]'));
15536stickyContainerEls.forEach(function (stickyEl) { 15537 new StickySidebarComponent(stickyEl); 15538}); 15539 15540 15541/***/ }, 15542 15543/***/ "./Static/javascript/modules/svg-loader.ts" 15544/*!*************************************************!*\ 15545 !*** ./Static/javascript/modules/svg-loader.ts ***! 15546 \*************************************************/ 15547(__unused_webpack_module, exports, __webpack_require__) { 15548 15549"use strict"; 15550 15551Object.defineProperty(exports, "__esModule", ({ value: true })); 15552exports.SvgSprite = void 0; 15553(__webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js").polyfill)(); 15554__webpack_require__(/*! isomorphic-fetch */ "./node_modules/isomorphic-fetch/fetch-npm-browserify.js"); 15555var SvgSprite = /** @class */ (function () { 15556 function SvgSprite(svgURL) { 15557 var _this = this; 15558 var url = svgURL; 15559 // Override the svg path in the view 15560 var urlOverride = document.querySelector('#svgSpriteUrl'); 15561 if (urlOverride) 15562 url = urlOverride.value; 15563 var sprite = document.querySelector('#svgSprite'); 15564 if (!sprite) { 15565 window.fetch(url) 15566 .then(function (response) { 15567 if (response.status !== 200) { 15568 throw "SVG sprite load failed. Status code: " + response.status; 15569 } 15570 else { 15571 return response.text(); 15572 } 15573 }) 15574 .then(function (svg) { return _this.injectSvg(svg); }); 15575 } 15576 } 15577 SvgSprite.prototype.injectSvg = function (data) { 15578 if (data !== undefined) { 15579 var newDiv = document.createElement('div'); 15580 newDiv.innerHTML = data; 15581 document.body.insertBefore(newDiv, document.body.childNodes[0]); 15582 } 15583 }; 15584 return SvgSprite; 15585}()); 15586exports.SvgSprite = SvgSprite; 15587 15588 15589/***/ }, 15590 15591/***/ "./Static/javascript/modules/tabs.ts" 15592/*!*******************************************!*\ 15593 !*** ./Static/javascript/modules/tabs.ts ***! 15594 \*******************************************/ 15595(__unused_webpack_module, exports) { 15596 15597"use strict"; 15598 15599Object.defineProperty(exports, "__esModule", ({ value: true })); 15600exports.Tabs = void 0; 15601var Tabs = /** @class */ (function () { 15602 function Tabs(options) { 15603 var _this = this; 15604 // Most of this is from the WAI-ARIA Authoring Guide and revised for TS https://www.w3.org/TR/wai-aria-practices-1.1/examples/tabs/tabs-1/tabs.html 15605 this.options = options; 15606 this.container = options.container; 15607 this.delay = this.determineDelay(); 15608 this.tabs = [].slice.call(this.container.querySelectorAll('[role="tab"]')); 15609 this.panels = [].slice.call(this.container.querySelectorAll('[role="tabpanel"]')); 15610 var hasPagination = this.container.getAttribute('data-tabs-pagination') == "true"; 15611 this.tabSwitchHandlers = []; 15612 // For easy reference 15613 this.keys = { 15614 end: 35, 15615 home: 36, 15616 left: 37, 15617 right: 39 15618 }; 15619 // Add or substract depending on key pressed 15620 this.direction = { 15621 37: -1, 15622 39: 1 15623 }; 15624 // Bind listeners
15625 this.tabs.forEach(function (tab) { 15626 tab.addEventListener('click', _this.clickEventListener.bind(_this)); 15627 tab.addEventListener('keydown', _this.keydownEventListener.bind(_this)); 15628 tab.addEventListener('keyup', _this.keyupEventListener.bind(_this)); 15629 }); 15630 if (hasPagination) { 15631 this.attachPagination(); 15632 } 15633 } 15634 Tabs.prototype.on = function (event, handler) { 15635 switch (event) { 15636 case "tabSwitch": 15637 return this.tabSwitchHandlers.push(handler); 15638 } 15639 }; 15640 Tabs.prototype.attachPagination = function () { 15641 var _this = this; 15642 this.panels.forEach(function (panel, index) { 15643 var buttonContainer = document.createElement('div'); 15644 buttonContainer.className = "adage-block tabs-pagination"; 15645 if (index > 0) { 15646 // attach previous button 15647 var nextButton = _this.duplicateTabForPagination(_this.tabs[index - 1], "previous"); 15648 buttonContainer.appendChild(nextButton); 15649 } 15650 if (index < (_this.panels.length - 1)) { 15651 // attach next button 15652 var nextButton = _this.duplicateTabForPagination(_this.tabs[index + 1], "next"); 15653 buttonContainer.appendChild(nextButton); 15654 } 15655 panel.appendChild(buttonContainer); 15656 }); 15657 }; 15658 Tabs.prototype.duplicateTabForPagination = function (tab, suffix) { 15659 var newButton = tab.cloneNode(true); 15660 newButton.setAttribute('data-related-tab', newButton.id); 15661 newButton.id = "".concat(newButton.id, "_").concat(suffix); 15662 newButton.removeAttribute('aria-setsize'); 15663 newButton.removeAttribute('aria-posinset'); 15664 newButton.removeAttribute('role'); 15665 newButton.removeAttribute('aria-selected'); 15666 newButton.removeAttribute('tabindex'); 15667 newButton.className = "tabs-pagination-btn"; 15668 newButton.addEventListener('click', this.clickEventListener.bind(this)); 15669 var buttonWrapper = document.createElement('div'); 15670 buttonWrapper.className = "tabs-pagination-".concat(suffix); 15671 buttonWrapper.appendChild(newButton); 15672 return buttonWrapper; 15673 }; 15674 // When a tab is clicked, activateTab is fired to activate it 15675 Tabs.prototype.clickEventListener = function (event) { 15676 var tab = event.target; 15677 if (tab.getAttribute('data-related-tab')) { 15678 tab = this.container.querySelector('#' + tab.getAttribute('data-related-tab')); 15679 } 15680 this.activateTab(tab, false); 15681 }; 15682 // Handle keydown on tabs 15683 Tabs.prototype.keydownEventListener = function (event) { 15684 var key = event.keyCode; 15685 switch (key) { 15686 case this.keys.end: 15687 event.preventDefault(); 15688 // Activate last tab 15689 this.activateTab(this.tabs[this.tabs.length - 1], true); 15690 break; 15691 case this.keys.home: 15692 event.preventDefault(); 15693 // Activate first tab 15694 this.activateTab(this.tabs[0], true); 15695 break; 15696 } 15697 }; 15698 // Handle keyup on tabs 15699 Tabs.prototype.keyupEventListener = function (event) { 15700 var key = event.keyCode; 15701 switch (key) { 15702 case this.keys.left: 15703 case this.keys.right: 15704 this.switchTabOnArrowPress(event); 15705 break; 15706 } 15707 }; 15708 // Either focus the next, previous, first, or last tab 15709 // depening on key pressed 15710 Tabs.prototype.switchTabOnArrowPress = function (event) { 15711 var _this = this; 15712 var pressed = event.keyCode;
15713 this.tabs.forEach(function (tab) { 15714 tab.addEventListener('focus', _this.focusEventHandler.bind(_this)); 15715 }); 15716 if (this.direction[pressed]) { 15717 var target = event.target; 15718 var index = parseInt(target.getAttribute('aria-posinset')) - 1; 15719 if (index !== undefined) { 15720 if (this.tabs[index + this.direction[pressed]]) { 15721 this.tabs[index + this.direction[pressed]].focus(); 15722 } 15723 else if (pressed === this.keys.left || pressed === this.keys.up) { 15724 this.focusLastTab(); 15725 } 15726 else if (pressed === this.keys.right || pressed == this.keys.down) { 15727 this.focusFirstTab(); 15728 } 15729 } 15730 } 15731 }; 15732 // Activates any given tab panel 15733 Tabs.prototype.activateTab = function (tab, setFocus) { 15734 var _this = this; 15735 setFocus = setFocus || true; 15736 // Deactivate all other tabs 15737 this.deactivateTabs(); 15738 // Remove tabindex attribute 15739 tab.removeAttribute('tabindex'); 15740 // Set the tab as selected 15741 tab.setAttribute('aria-selected', 'true'); 15742 // Get the value of aria-controls (which is an ID) 15743 var controls = tab.getAttribute('aria-controls'); 15744 // Remove hidden attribute from tab panel to make it visible 15745 document.getElementById(controls).removeAttribute('hidden'); 15746 // Set focus when required 15747 if (setFocus) { 15748 tab.focus(); 15749 } 15750 if (this.tabSwitchHandlers) { 15751 this.tabSwitchHandlers.forEach(function (handler) { 15752 setTimeout(handler.bind(_this), 0); 15753 }); 15754 } 15755 }; 15756 // Deactivate all tabs and tab panels 15757 Tabs.prototype.deactivateTabs = function () { 15758 var _this = this;
15759 this.tabs.forEach(function (tab) { 15760 tab.setAttribute('tabindex', '-1'); 15761 tab.setAttribute('aria-selected', 'false'); 15762 tab.removeEventListener('focus', _this.focusEventHandler.bind(_this)); 15763 }); 15764 this.panels.forEach(function (panel) { 15765 panel.setAttribute('hidden', 'hidden'); 15766 }); 15767 }; 15768 // Make a guess 15769 Tabs.prototype.focusFirstTab = function () { 15770 this.tabs[0].focus(); 15771 }; 15772 // Make a guess 15773 Tabs.prototype.focusLastTab = function () { 15774 this.tabs[this.tabs.length - 1].focus(); 15775 }; 15776 // Determine whether there should be a delay 15777 // when user navigates with the arrow keys 15778 Tabs.prototype.determineDelay = function () { 15779 var hasDelay = this.container.hasAttribute('data-delay'); 15780 var delay = 0; 15781 if (hasDelay) { 15782 var delayValue = parseInt(this.container.getAttribute('data-delay')); 15783 if (delayValue) { 15784 delay = delayValue; 15785 } 15786 else { 15787 // If no value is specified, default to 300ms 15788 delay = 300; 15789 } 15790 } 15791 return delay; 15792 }; 15793 // 15794 Tabs.prototype.focusEventHandler = function (event) { 15795 var target = event.target; 15796 setTimeout(this.checkTabFocus.bind(this), this.delay, target); 15797 }; 15798 // Only activate tab on focus if it still has focus after the delay 15799 Tabs.prototype.checkTabFocus = function (target) { 15800 var focused = document.activeElement; 15801 if (target === focused) { 15802 this.activateTab(target, false); 15803 } 15804 }; 15805 Tabs.prototype.getActiveTabPanel = function () { 15806 var _this = this; 15807 var selected = this.panels[0];
15808 this.tabs.forEach(function (tab, index) { 15809 if (_this.tabs[index].getAttribute('aria-selected') == 'true') { 15810 selected = _this.panels[index]; 15811 } 15812 }); 15813 return selected; 15814 }; 15815 Tabs.prototype.getActiveTabIndex = function () { 15816 var _this = this; 15817 var selected = 0; 15818 this.tabs.forEach(function (tab, index) { 15819 if (_this.tabs[index].getAttribute('aria-selected') == 'true') { 15820 selected = index; 15821 } 15822 }); 15823 return selected; 15824 }; 15825 return Tabs; 15826}()); 15827exports.Tabs = Tabs; 15828 15829 15830/***/ }, 15831 15832/***/ "./Static/javascript/modules/videoItem.ts" 15833/*!************************************************!*\ 15834 !*** ./Static/javascript/modules/videoItem.ts ***! 15835 \************************************************/ 15836(__unused_webpack_module, exports, __webpack_require__) { 15837 15838"use strict"; 15839 15840var __importDefault = (this && this.__importDefault) || function (mod) { 15841 return (mod && mod.__esModule) ? mod : { "default": mod }; 15842}; 15843Object.defineProperty(exports, "__esModule", ({ value: true })); 15844exports.VideoItem = void 0; 15845var player_1 = __importDefault(__webpack_require__(/*! @vimeo/player */ "./node_modules/@vimeo/player/dist/player.es.js")); 15846var VideoType; 15847(function (VideoType) { 15848 VideoType["NATIVE"] = "native"; 15849 VideoType["VIMEO"] = "vimeo"; 15850 VideoType["YOUTUBE"] = "youtube"; 15851 VideoType["NONE"] = "none"; 15852})(VideoType || (VideoType = {})); 15853var VideoItem = /** @class */ (function () { 15854 function VideoItem(container, youtubeVideoPlayer) { 15855 if (youtubeVideoPlayer) 15856 this.youtubeVideoPlayer = youtubeVideoPlayer; 15857 this.container = container; 15858 this.video = this.youtubeVideoPlayer ? this.container.querySelector('iframe') : this.container.querySelector('[data-video]'); 15859 this.videoType = this.container.getAttribute('data-video-type'); 15860 this.videoSrc = this.video.getAttribute('data-src'); 15861 this.playButton = this.container.querySelector('[data-video-play]'); 15862 this.initializeVideo(); 15863 } 15864 VideoItem.prototype.playPause = function () { 15865 var _this = this; 15866 // Youtube Play and Pause 15867 if (this.videoType == VideoType.YOUTUBE) { 15868 var playerState = this.videoObject.getPlayerState(); 15869 //// == 1 means it's playing 15870 if (playerState == 1) { 15871 this.videoObject.pauseVideo(); 15872 } 15873 else { 15874 this.videoObject.playVideo(); 15875 if (this.videoObject.isMuted()) 15876 this.videoObject.unMute(); 15877 } 15878 } 15879 // Native Play and Pause 15880 if (this.videoType == VideoType.NATIVE) { 15881 if (this.videoObject.paused) { 15882 this.videoObject.play(); 15883 } 15884 else { 15885 this.videoObject.pause(); 15886 } 15887 this.videoObject.controls = true; 15888 } 15889 // Vimeo Play and Pause 15890 if (this.videoType == VideoType.VIMEO) { 15891 this.videoObject.getPaused().then(function (paused) { 15892 if (paused) { 15893 _this.videoObject.play(); 15894 } 15895 else { 15896 _this.videoObject.pause(); 15897 } 15898 }); 15899 } 15900 this.container.classList.add('media-item-playing'); 15901 }; 15902 VideoItem.prototype.initializeVideo = function () { 15903 if (!this.video.src) { 15904 // Native video initialization 15905 if (this.videoType == VideoType.NATIVE) { 15906 this.video = this.video; 15907 var videoSource = this.video.querySelector('source'); 15908 if (videoSource) { 15909 videoSource.src = this.videoSrc; 15910 this.videoObject = this.video; 15911 this.videoObject.load(); 15912 this.videoObject.controls = false; 15913 } 15914 } 15915 // Vimeo video initialization 15916 if (this.videoType == VideoType.VIMEO) { 15917 this.video.src = this.videoSrc; 15918 var vimeoPlayer = new player_1.default(this.video, {}); 15919 this.videoObject = vimeoPlayer; 15920 } 15921 } 15922 else { 15923 // Youtube initialization and handlers 15924 if (this.videoType == VideoType.YOUTUBE) { 15925 this.videoObject = this.youtubeVideoPlayer; 15926 } 15927 } 15928 //Activate Playbutton 15929 this.playButton.addEventListener('click', this.playPause.bind(this)); 15930 }; 15931 return VideoItem; 15932}()); 15933exports.VideoItem = VideoItem; 15934 15935 15936/***/ }, 15937 15938/***/ "./Static/javascript/tnew/exchangeCartCleanup.ts" 15939/*!*******************************************************!*\ 15940 !*** ./Static/javascript/tnew/exchangeCartCleanup.ts ***! 15941 \*******************************************************/ 15942(__unused_webpack_module, exports, __webpack_require__) { 15943 15944"use strict"; 15945 15946Object.defineProperty(exports, "__esModule", ({ value: true })); 15947exports.initExchangeCartCleanup = void 0; 15948var rewriteCreditText_1 = __webpack_require__(/*! ./rewriteCreditText */ "./Static/javascript/tnew/rewriteCreditText.ts"); 15949var CART_MARKER = '.tn-cart-component'; 15950var PRICE_SELECTOR = [ 15951 '.tn-cart-item-summary__property--price-total', 15952 '.tn-cart-item-detail__list-item--price', 15953 '.tn-cart-totals__value', 15954].join(', '); 15955var CONTRIBUTIONS_SELECTOR = '.tn-cart__section--contributions'; 15956// TNEW renders the cart as data in an inline <script>: `var orderDataModel = {...};`. 15957// Parse it to gate on a REAL exchange signal (a negative-price line item = an 15958// exchanged-out credit) instead of trusting display text. Returns null if the model 15959// is absent or unparseable (â caller does nothing, leaving the cart untouched). 15960function readOrderModel() { 15961 var scripts = Array.from(document.querySelectorAll('script:not([src])')); 15962 for (var _i = 0, scripts_1 = scripts; _i < scripts_1.length; _i++) { 15963 var script = scripts_1[_i]; 15964 var text = script.textContent || ''; 15965 var match = text.match(/var\s+orderDataModel\s*=\s*(\{[\s\S]*?\});/);
15966 if (match) { 15967 try { 15968 return JSON.parse(match[1]); 15969 } 15970 catch (_a) { 15971 return null; 15972 } 15973 } 15974 } 15975 return null; 15976} 15977function isExchangeCart(model) { 15978 var _a; 15979 return !!((_a = model === null || model === void 0 ? void 0 : model.cartItems) === null || _a === void 0 ? void 0 : _a.some(function (item) { return typeof item.price === 'number' && item.price < 0; })); 15980} 15981// Rewrite only the price TEXT NODE in each cell so the sr-only "Price:" label survives. 15982function zeroCreditPrices() { 15983 document.querySelectorAll(PRICE_SELECTOR).forEach(function (cell) { 15984 cell.childNodes.forEach(function (node) { 15985 if (node.nodeType === Node.TEXT_NODE && node.nodeValue) { 15986 var updated = (0, rewriteCreditText_1.rewriteCreditText)(node.nodeValue); 15987 if (updated !== node.nodeValue) { 15988 node.nodeValue = updated; 15989 } 15990 } 15991 }); 15992 }); 15993} 15994function hideContributions() { 15995 document.querySelectorAll(CONTRIBUTIONS_SELECTOR).forEach(function (el) { 15996 el.style.display = 'none'; 15997 }); 15998} 15999function initExchangeCartCleanup() { 16000 // Guard: only ever act on a TNEW cart page. 16001 if (!document.querySelector(CART_MARKER)) 16002 return; 16003 // Gate: only act when the cart data confirms an exchange (a credit line item). 16004 if (!isExchangeCart(readOrderModel())) 16005 return; 16006 zeroCreditPrices(); 16007 hideContributions(); 16008} 16009exports.initExchangeCartCleanup = initExchangeCartCleanup; 16010 16011 16012/***/ }, 16013 16014/***/ "./Static/javascript/tnew/rewriteCreditText.ts" 16015/*!*****************************************************!*\ 16016 !*** ./Static/javascript/tnew/rewriteCreditText.ts ***! 16017 \*****************************************************/ 16018(__unused_webpack_module, exports) { 16019 16020"use strict"; 16021 16022Object.defineProperty(exports, "__esModule", ({ value: true })); 16023exports.rewriteCreditText = void 0; 16024// Rewrites parenthetical (negative) dollar amounts to $0.00, leaving other text untouched. 16025// Examples: 16026// "($70.00)" -> "$0.00" 16027// "\n($1,070.00)\n" -> "\n$0.00\n" (surrounding whitespace preserved) 16028// "$240.00" -> "$240.00" (unchanged) 16029// "Subtotal" -> "Subtotal" (unchanged) 16030var PARENTHETICAL_PRICE = /\(\$[\d,]+\.\d{2}\)/g; 16031function rewriteCreditText(text) { 16032 return text.replace(PARENTHETICAL_PRICE, '$0.00'); 16033} 16034exports.rewriteCreditText = rewriteCreditText; 16035 16036 16037/***/ }, 16038 16039/***/ "./node_modules/whatwg-fetch/fetch.js" 16040/*!********************************************!*\ 16041 !*** ./node_modules/whatwg-fetch/fetch.js ***! 16042 \********************************************/ 16043(__unused_webpack_module, __webpack_exports__, __webpack_require__) { 16044 16045"use strict"; 16046__webpack_require__.r(__webpack_exports__); 16047/* harmony export */ __webpack_require__.d(__webpack_exports__, { 16048/* harmony export */ DOMException: () => (/* binding */ DOMException), 16049/* harmony export */ Headers: () => (/* binding */ Headers), 16050/* harmony export */ Request: () => (/* binding */ Request), 16051/* harmony export */ Response: () => (/* binding */ Response), 16052/* harmony export */ fetch: () => (/* binding */ fetch) 16053/* harmony export */ }); 16054/* provided dependency */ var Promise = __webpack_require__(/*! es6-promise */ "./node_modules/es6-promise/dist/es6-promise.js"); 16055/* eslint-disable no-prototype-builtins */ 16056var g = 16057 (typeof globalThis !== 'undefined' && globalThis) || 16058 (typeof self !== 'undefined' && self) || 16059 // eslint-disable-next-line no-undef 16060 (typeof __webpack_require__.g !== 'undefined' && __webpack_require__.g) || 16061 {} 16062 16063var support = { 16064 searchParams: 'URLSearchParams' in g, 16065 iterable: 'Symbol' in g && 'iterator' in Symbol, 16066 blob: 16067 'FileReader' in g && 16068 'Blob' in g && 16069 (function() { 16070 try { 16071 new Blob() 16072 return true 16073 } catch (e) { 16074 return false 16075 } 16076 })(), 16077 formData: 'FormData' in g, 16078 arrayBuffer: 'ArrayBuffer' in g 16079} 16080 16081function isDataView(obj) { 16082 return obj && DataView.prototype.isPrototypeOf(obj) 16083} 16084 16085if (support.arrayBuffer) { 16086 var viewClasses = [ 16087 '[object Int8Array]', 16088 '[object Uint8Array]', 16089 '[object Uint8ClampedArray]', 16090 '[object Int16Array]', 16091 '[object Uint16Array]', 16092 '[object Int32Array]', 16093 '[object Uint32Array]', 16094 '[object Float32Array]',
vendor: 14,346 bytes, lines 16095-16581
16095 '[object Float64Array]' 16096 ] 16097 16098 var isArrayBufferView = 16099 ArrayBuffer.isView || 16100 function(obj) { 16101 return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1 16102 } 16103} 16104 16105function normalizeName(name) { 16106 if (typeof name !== 'string') { 16107 name = String(name) 16108 } 16109 if (/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(name) || name === '') { 16110 throw new TypeError('Invalid character in header field name: "' + name + '"') 16111 } 16112 return name.toLowerCase() 16113} 16114 16115function normalizeValue(value) { 16116 if (typeof value !== 'string') { 16117 value = String(value) 16118 } 16119 return value 16120} 16121 16122// Build a destructive iterator for the value list 16123function iteratorFor(items) { 16124 var iterator = { 16125 next: function() { 16126 var value = items.shift() 16127 return {done: value === undefined, value: value} 16128 } 16129 } 16130 16131 if (support.iterable) { 16132 iterator[Symbol.iterator] = function() { 16133 return iterator 16134 } 16135 } 16136 16137 return iterator 16138} 16139 16140function Headers(headers) { 16141 this.map = {} 16142 16143 if (headers instanceof Headers) { 16144 headers.forEach(function(value, name) { 16145 this.append(name, value) 16146 }, this) 16147 } else if (Array.isArray(headers)) { 16148 headers.forEach(function(header) { 16149 if (header.length != 2) { 16150 throw new TypeError('Headers constructor: expected name/value pair to be length 2, found' + header.length) 16151 } 16152 this.append(header[0], header[1]) 16153 }, this) 16154 } else if (headers) { 16155 Object.getOwnPropertyNames(headers).forEach(function(name) { 16156 this.append(name, headers[name]) 16157 }, this) 16158 } 16159} 16160 16161Headers.prototype.append = function(name, value) { 16162 name = normalizeName(name) 16163 value = normalizeValue(value) 16164 var oldValue = this.map[name] 16165 this.map[name] = oldValue ? oldValue + ', ' + value : value 16166} 16167 16168Headers.prototype['delete'] = function(name) { 16169 delete this.map[normalizeName(name)] 16170} 16171 16172Headers.prototype.get = function(name) { 16173 name = normalizeName(name) 16174 return this.has(name) ? this.map[name] : null 16175} 16176 16177Headers.prototype.has = function(name) { 16178 return this.map.hasOwnProperty(normalizeName(name)) 16179} 16180 16181Headers.prototype.set = function(name, value) { 16182 this.map[normalizeName(name)] = normalizeValue(value) 16183} 16184 16185Headers.prototype.forEach = function(callback, thisArg) { 16186 for (var name in this.map) { 16187 if (this.map.hasOwnProperty(name)) { 16188 callback.call(thisArg, this.map[name], name, this) 16189 } 16190 } 16191} 16192 16193Headers.prototype.keys = function() { 16194 var items = [] 16195 this.forEach(function(value, name) { 16196 items.push(name) 16197 }) 16198 return iteratorFor(items) 16199} 16200 16201Headers.prototype.values = function() { 16202 var items = [] 16203 this.forEach(function(value) { 16204 items.push(value) 16205 }) 16206 return iteratorFor(items) 16207} 16208 16209Headers.prototype.entries = function() { 16210 var items = [] 16211 this.forEach(function(value, name) { 16212 items.push([name, value]) 16213 }) 16214 return iteratorFor(items) 16215} 16216 16217if (support.iterable) { 16218 Headers.prototype[Symbol.iterator] = Headers.prototype.entries 16219} 16220 16221function consumed(body) { 16222 if (body._noBody) return 16223 if (body.bodyUsed) { 16224 return Promise.reject(new TypeError('Already read')) 16225 } 16226 body.bodyUsed = true 16227} 16228 16229function fileReaderReady(reader) { 16230 return new Promise(function(resolve, reject) { 16231 reader.onload = function() { 16232 resolve(reader.result) 16233 } 16234 reader.onerror = function() { 16235 reject(reader.error) 16236 } 16237 }) 16238} 16239 16240function readBlobAsArrayBuffer(blob) { 16241 var reader = new FileReader() 16242 var promise = fileReaderReady(reader) 16243 reader.readAsArrayBuffer(blob) 16244 return promise 16245} 16246 16247function readBlobAsText(blob) { 16248 var reader = new FileReader() 16249 var promise = fileReaderReady(reader) 16250 var match = /charset=([A-Za-z0-9_-]+)/.exec(blob.type) 16251 var encoding = match ? match[1] : 'utf-8' 16252 reader.readAsText(blob, encoding) 16253 return promise 16254} 16255 16256function readArrayBufferAsText(buf) { 16257 var view = new Uint8Array(buf) 16258 var chars = new Array(view.length) 16259 16260 for (var i = 0; i < view.length; i++) { 16261 chars[i] = String.fromCharCode(view[i]) 16262 } 16263 return chars.join('') 16264} 16265 16266function bufferClone(buf) { 16267 if (buf.slice) { 16268 return buf.slice(0) 16269 } else { 16270 var view = new Uint8Array(buf.byteLength) 16271 view.set(new Uint8Array(buf)) 16272 return view.buffer 16273 } 16274} 16275 16276function Body() { 16277 this.bodyUsed = false 16278 16279 this._initBody = function(body) { 16280 /* 16281 fetch-mock wraps the Response object in an ES6 Proxy to 16282 provide useful test harness features such as flush. However, on 16283 ES5 browsers without fetch or Proxy support pollyfills must be used; 16284 the proxy-pollyfill is unable to proxy an attribute unless it exists 16285 on the object before the Proxy is created. This change ensures 16286 Response.bodyUsed exists on the instance, while maintaining the 16287 semantic of setting Request.bodyUsed in the constructor before 16288 _initBody is called. 16289 */ 16290 // eslint-disable-next-line no-self-assign 16291 this.bodyUsed = this.bodyUsed 16292 this._bodyInit = body 16293 if (!body) { 16294 this._noBody = true; 16295 this._bodyText = '' 16296 } else if (typeof body === 'string') { 16297 this._bodyText = body 16298 } else if (support.blob && Blob.prototype.isPrototypeOf(body)) { 16299 this._bodyBlob = body 16300 } else if (support.formData && FormData.prototype.isPrototypeOf(body)) { 16301 this._bodyFormData = body 16302 } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { 16303 this._bodyText = body.toString() 16304 } else if (support.arrayBuffer && support.blob && isDataView(body)) { 16305 this._bodyArrayBuffer = bufferClone(body.buffer) 16306 // IE 10-11 can't handle a DataView body. 16307 this._bodyInit = new Blob([this._bodyArrayBuffer]) 16308 } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) { 16309 this._bodyArrayBuffer = bufferClone(body) 16310 } else { 16311 this._bodyText = body = Object.prototype.toString.call(body) 16312 } 16313 16314 if (!this.headers.get('content-type')) { 16315 if (typeof body === 'string') { 16316 this.headers.set('content-type', 'text/plain;charset=UTF-8') 16317 } else if (this._bodyBlob && this._bodyBlob.type) { 16318 this.headers.set('content-type', this._bodyBlob.type) 16319 } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) { 16320 this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8') 16321 } 16322 } 16323 } 16324 16325 if (support.blob) { 16326 this.blob = function() { 16327 var rejected = consumed(this) 16328 if (rejected) { 16329 return rejected 16330 } 16331 16332 if (this._bodyBlob) { 16333 return Promise.resolve(this._bodyBlob) 16334 } else if (this._bodyArrayBuffer) { 16335 return Promise.resolve(new Blob([this._bodyArrayBuffer])) 16336 } else if (this._bodyFormData) { 16337 throw new Error('could not read FormData body as blob') 16338 } else { 16339 return Promise.resolve(new Blob([this._bodyText])) 16340 } 16341 } 16342 } 16343 16344 this.arrayBuffer = function() { 16345 if (this._bodyArrayBuffer) { 16346 var isConsumed = consumed(this) 16347 if (isConsumed) { 16348 return isConsumed 16349 } else if (ArrayBuffer.isView(this._bodyArrayBuffer)) { 16350 return Promise.resolve( 16351 this._bodyArrayBuffer.buffer.slice( 16352 this._bodyArrayBuffer.byteOffset, 16353 this._bodyArrayBuffer.byteOffset + this._bodyArrayBuffer.byteLength 16354 ) 16355 ) 16356 } else { 16357 return Promise.resolve(this._bodyArrayBuffer) 16358 } 16359 } else if (support.blob) { 16360 return this.blob().then(readBlobAsArrayBuffer) 16361 } else { 16362 throw new Error('could not read as ArrayBuffer') 16363 } 16364 } 16365 16366 this.text = function() { 16367 var rejected = consumed(this) 16368 if (rejected) { 16369 return rejected 16370 } 16371 16372 if (this._bodyBlob) { 16373 return readBlobAsText(this._bodyBlob) 16374 } else if (this._bodyArrayBuffer) { 16375 return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer)) 16376 } else if (this._bodyFormData) { 16377 throw new Error('could not read FormData body as text') 16378 } else { 16379 return Promise.resolve(this._bodyText) 16380 } 16381 } 16382 16383 if (support.formData) { 16384 this.formData = function() { 16385 return this.text().then(decode) 16386 } 16387 } 16388 16389 this.json = function() { 16390 return this.text().then(JSON.parse) 16391 } 16392 16393 return this 16394} 16395 16396// HTTP methods whose capitalization should be normalized 16397var methods = ['CONNECT', 'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PATCH', 'POST', 'PUT', 'TRACE'] 16398 16399function normalizeMethod(method) { 16400 var upcased = method.toUpperCase() 16401 return methods.indexOf(upcased) > -1 ? upcased : method 16402} 16403 16404function Request(input, options) { 16405 if (!(this instanceof Request)) { 16406 throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.') 16407 } 16408 16409 options = options || {} 16410 var body = options.body 16411 16412 if (input instanceof Request) { 16413 if (input.bodyUsed) { 16414 throw new TypeError('Already read') 16415 } 16416 this.url = input.url 16417 this.credentials = input.credentials 16418 if (!options.headers) { 16419 this.headers = new Headers(input.headers) 16420 } 16421 this.method = input.method 16422 this.mode = input.mode 16423 this.signal = input.signal 16424 if (!body && input._bodyInit != null) { 16425 body = input._bodyInit 16426 input.bodyUsed = true 16427 } 16428 } else { 16429 this.url = String(input) 16430 } 16431 16432 this.credentials = options.credentials || this.credentials || 'same-origin' 16433 if (options.headers || !this.headers) { 16434 this.headers = new Headers(options.headers) 16435 } 16436 this.method = normalizeMethod(options.method || this.method || 'GET') 16437 this.mode = options.mode || this.mode || null 16438 this.signal = options.signal || this.signal || (function () { 16439 if ('AbortController' in g) { 16440 var ctrl = new AbortController(); 16441 return ctrl.signal; 16442 } 16443 }()); 16444 this.referrer = null 16445 16446 if ((this.method === 'GET' || this.method === 'HEAD') && body) { 16447 throw new TypeError('Body not allowed for GET or HEAD requests') 16448 } 16449 this._initBody(body) 16450 16451 if (this.method === 'GET' || this.method === 'HEAD') { 16452 if (options.cache === 'no-store' || options.cache === 'no-cache') { 16453 // Search for a '_' parameter in the query string 16454 var reParamSearch = /([?&])_=[^&]*/ 16455 if (reParamSearch.test(this.url)) { 16456 // If it already exists then set the value with the current time 16457 this.url = this.url.replace(reParamSearch, '$1_=' + new Date().getTime()) 16458 } else { 16459 // Otherwise add a new '_' parameter to the end with the current time 16460 var reQueryString = /\?/ 16461 this.url += (reQueryString.test(this.url) ? '&' : '?') + '_=' + new Date().getTime() 16462 } 16463 } 16464 } 16465} 16466 16467Request.prototype.clone = function() { 16468 return new Request(this, {body: this._bodyInit}) 16469} 16470 16471function decode(body) { 16472 var form = new FormData() 16473 body 16474 .trim() 16475 .split('&') 16476 .forEach(function(bytes) { 16477 if (bytes) { 16478 var split = bytes.split('=') 16479 var name = split.shift().replace(/\+/g, ' ') 16480 var value = split.join('=').replace(/\+/g, ' ') 16481 form.append(decodeURIComponent(name), decodeURIComponent(value)) 16482 } 16483 }) 16484 return form 16485} 16486 16487function parseHeaders(rawHeaders) { 16488 var headers = new Headers() 16489 // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space 16490 // https://tools.ietf.org/html/rfc7230#section-3.2 16491 var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ') 16492 // Avoiding split via regex to work around a common IE11 bug with the core-js 3.6.0 regex polyfill 16493 // https://github.com/github/fetch/issues/748 16494 // https://github.com/zloirock/core-js/issues/751 16495 preProcessedHeaders 16496 .split('\r') 16497 .map(function(header) { 16498 return header.indexOf('\n') === 0 ? header.substr(1, header.length) : header 16499 }) 16500 .forEach(function(line) { 16501 var parts = line.split(':') 16502 var key = parts.shift().trim() 16503 if (key) { 16504 var value = parts.join(':').trim() 16505 try { 16506 headers.append(key, value) 16507 } catch (error) { 16508 console.warn('Response ' + error.message) 16509 } 16510 } 16511 }) 16512 return headers 16513} 16514 16515Body.call(Request.prototype) 16516 16517function Response(bodyInit, options) { 16518 if (!(this instanceof Response)) { 16519 throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.') 16520 } 16521 if (!options) { 16522 options = {} 16523 } 16524 16525 this.type = 'default' 16526 this.status = options.status === undefined ? 200 : options.status 16527 if (this.status < 200 || this.status > 599) { 16528 throw new RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].") 16529 } 16530 this.ok = this.status >= 200 && this.status < 300 16531 this.statusText = options.statusText === undefined ? '' : '' + options.statusText 16532 this.headers = new Headers(options.headers) 16533 this.url = options.url || '' 16534 this._initBody(bodyInit) 16535} 16536 16537Body.call(Response.prototype) 16538 16539Response.prototype.clone = function() { 16540 return new Response(this._bodyInit, { 16541 status: this.status, 16542 statusText: this.statusText, 16543 headers: new Headers(this.headers), 16544 url: this.url 16545 }) 16546} 16547 16548Response.error = function() { 16549 var response = new Response(null, {status: 200, statusText: ''}) 16550 response.ok = false 16551 response.status = 0 16552 response.type = 'error' 16553 return response 16554} 16555 16556var redirectStatuses = [301, 302, 303, 307, 308] 16557 16558Response.redirect = function(url, status) { 16559 if (redirectStatuses.indexOf(status) === -1) { 16560 throw new RangeError('Invalid status code') 16561 } 16562 16563 return new Response(null, {status: status, headers: {location: url}}) 16564} 16565 16566var DOMException = g.DOMException 16567try { 16568 new DOMException() 16569} catch (err) { 16570 DOMException = function(message, name) { 16571 this.message = message 16572 this.name = name 16573 var error = Error(message) 16574 this.stack = error.stack 16575 } 16576 DOMException.prototype = Object.create(Error.prototype) 16577 DOMException.prototype.constructor = DOMException 16578} 16579 16580function fetch(input, init) { 16581 return new Promise(function(resolve, reject) {
16582 var request = new Request(input, init) 16583 16584 if (request.signal && request.signal.aborted) { 16585 return reject(new DOMException('Aborted', 'AbortError')) 16586 } 16587 16588 var xhr = new XMLHttpRequest() 16589 16590 function abortXhr() { 16591 xhr.abort() 16592 } 16593 16594 xhr.onload = function() { 16595 var options = { 16596 statusText: xhr.statusText, 16597 headers: parseHeaders(xhr.getAllResponseHeaders() || '') 16598 } 16599 // This check if specifically for when a user fetches a file locally from the file system 16600 // Only if the status is out of a normal range 16601 if (request.url.indexOf('file://') === 0 && (xhr.status < 200 || xhr.status > 599)) { 16602 options.status = 200; 16603 } else { 16604 options.status = xhr.status; 16605 } 16606 options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL') 16607 var body = 'response' in xhr ? xhr.response : xhr.responseText 16608 setTimeout(function() { 16609 resolve(new Response(body, options)) 16610 }, 0) 16611 } 16612 16613 xhr.onerror = function() { 16614 setTimeout(function() { 16615 reject(new TypeError('Network request failed')) 16616 }, 0) 16617 } 16618 16619 xhr.ontimeout = function() { 16620 setTimeout(function() { 16621 reject(new TypeError('Network request timed out')) 16622 }, 0) 16623 } 16624 16625 xhr.onabort = function() { 16626 setTimeout(function() { 16627 reject(new DOMException('Aborted', 'AbortError')) 16628 }, 0) 16629 } 16630 16631 function fixUrl(url) { 16632 try { 16633 return url === '' && g.location.href ? g.location.href : url 16634 } catch (e) { 16635 return url 16636 } 16637 } 16638 16639 xhr.open(request.method, fixUrl(request.url), true) 16640 16641 if (request.credentials === 'include') { 16642 xhr.withCredentials = true 16643 } else if (request.credentials === 'omit') { 16644 xhr.withCredentials = false 16645 } 16646 16647 if ('responseType' in xhr) { 16648 if (support.blob) { 16649 xhr.responseType = 'blob' 16650 } else if ( 16651 support.arrayBuffer 16652 ) { 16653 xhr.responseType = 'arraybuffer' 16654 } 16655 } 16656 16657 if (init && typeof init.headers === 'object' && !(init.headers instanceof Headers || (g.Headers && init.headers instanceof g.Headers))) { 16658 var names = []; 16659 Object.getOwnPropertyNames(init.headers).forEach(function(name) { 16660 names.push(normalizeName(name)) 16661 xhr.setRequestHeader(name, normalizeValue(init.headers[name])) 16662 }) 16663 request.headers.forEach(function(value, name) { 16664 if (names.indexOf(name) === -1) { 16665 xhr.setRequestHeader(name, value) 16666 } 16667 }) 16668 } else { 16669 request.headers.forEach(function(value, name) { 16670 xhr.setRequestHeader(name, value) 16671 }) 16672 } 16673 16674 if (request.signal) { 16675 request.signal.addEventListener('abort', abortXhr) 16676 16677 xhr.onreadystatechange = function() { 16678 // DONE (success or failure) 16679 if (xhr.readyState === 4) { 16680 request.signal.removeEventListener('abort', abortXhr) 16681 } 16682 } 16683 } 16684 16685 xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit) 16686 }) 16687} 16688 16689fetch.polyfill = true 16690 16691if (!g.fetch) { 16692 g.fetch = fetch 16693 g.Headers = Headers 16694 g.Request = Request 16695 g.Response = Response 16696} 16697 16698 16699/***/ }, 16700 16701/***/ "./node_modules/youtube-iframe/index.js" 16702/*!**********************************************!*\ 16703 !*** ./node_modules/youtube-iframe/index.js ***! 16704 \**********************************************/ 16705(module) { 16706 16707(function(window) { 16708 var YouTubeIframeLoader = { 16709 src: 'https://www.youtube.com/iframe_api', 16710 loading: false, 16711 loaded: false, 16712 listeners: [], 16713 16714 load: function(callback) { 16715 var _this = this; 16716 this.listeners.push(callback); 16717 16718 if(this.loaded) { 16719 setTimeout(function() { 16720 _this.done(); 16721 }); 16722 return; 16723 } 16724 16725 if(this.loading) { 16726 return; 16727 } 16728 16729 this.loading = true; 16730 16731 window.onYouTubeIframeAPIReady = function() { 16732 _this.loaded = true; 16733 _this.done(); 16734 }; 16735 16736 var script = document.createElement('script'); 16737 script.type = 'text/javascript'; 16738 script.src = this.src; 16739 document.body.appendChild(script); 16740 }, 16741 16742 done: function() { 16743 delete window.onYouTubeIframeAPIReady; 16744 16745 while(this.listeners.length) { 16746 this.listeners.pop()(window.YT); 16747 } 16748 } 16749 }; 16750 16751 if( true && module.exports) { 16752 module.exports = YouTubeIframeLoader; 16753 } else { 16754 window.YouTubeIframeLoader = YouTubeIframeLoader; 16755 } 16756}(window)); 16757 16758 16759/***/ }, 16760 16761/***/ "lodash" 16762/*!********************!*\ 16763 !*** external "_" ***! 16764 \********************/ 16765(module) { 16766 16767"use strict"; 16768module.exports = __WEBPACK_EXTERNAL_MODULE_lodash__; 16769 16770/***/ } 16771 16772/******/ }); 16773/************************************************************************/ 16774/******/ // The module cache 16775/******/ var __webpack_module_cache__ = {}; 16776/******/ 16777/******/ // The require function 16778/******/ function __webpack_require__(moduleId) { 16779/******/ // Check if module is in cache 16780/******/ var cachedModule = __webpack_module_cache__[moduleId]; 16781/******/ if (cachedModule !== undefined) { 16782/******/ return cachedModule.exports; 16783/******/ } 16784/******/ // Create a new module (and put it into the cache) 16785/******/ var module = __webpack_module_cache__[moduleId] = { 16786/******/ // no module.id needed 16787/******/ // no module.loaded needed 16788/******/ exports: {} 16789/******/ }; 16790/******/ 16791/******/ // Execute the module function 16792/******/ if (!(moduleId in __webpack_modules__)) { 16793/******/ delete __webpack_module_cache__[moduleId]; 16794/******/ var e = new Error("Cannot find module '" + moduleId + "'"); 16795/******/ e.code = 'MODULE_NOT_FOUND'; 16796/******/ throw e; 16797/******/ } 16798/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__); 16799/******/ 16800/******/ // Return the exports of the module 16801/******/ return module.exports; 16802/******/ } 16803/******/ 16804/******/ // expose the modules object (__webpack_modules__) 16805/******/ __webpack_require__.m = __webpack_modules__; 16806/******/ 16807/************************************************************************/ 16808/******/ /* webpack/runtime/chunk loaded */ 16809/******/ (() => { 16810/******/ var deferred = []; 16811/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => { 16812/******/ if(chunkIds) { 16813/******/ priority = priority || 0; 16814/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1]; 16815/******/ deferred[i] = [chunkIds, fn, priority]; 16816/******/ return; 16817/******/ } 16818/******/ var notFulfilled = Infinity;
vendor: 5,249 bytes, lines 16819-16945
16819/******/ for (var i = 0; i < deferred.length; i++) { 16820/******/ var [chunkIds, fn, priority] = deferred[i]; 16821/******/ var fulfilled = true; 16822/******/ for (var j = 0; j < chunkIds.length; j++) { 16823/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) { 16824/******/ chunkIds.splice(j--, 1); 16825/******/ } else { 16826/******/ fulfilled = false; 16827/******/ if(priority < notFulfilled) notFulfilled = priority; 16828/******/ } 16829/******/ } 16830/******/ if(fulfilled) { 16831/******/ deferred.splice(i--, 1) 16832/******/ var r = fn(); 16833/******/ if (r !== undefined) result = r; 16834/******/ } 16835/******/ } 16836/******/ return result; 16837/******/ }; 16838/******/ })(); 16839/******/ 16840/******/ /* webpack/runtime/define property getters */ 16841/******/ (() => { 16842/******/ // define getter functions for harmony exports 16843/******/ __webpack_require__.d = (exports, definition) => { 16844/******/ for(var key in definition) { 16845/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { 16846/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); 16847/******/ } 16848/******/ } 16849/******/ }; 16850/******/ })(); 16851/******/ 16852/******/ /* webpack/runtime/global */ 16853/******/ (() => { 16854/******/ __webpack_require__.g = (function() { 16855/******/ if (typeof globalThis === 'object') return globalThis; 16856/******/ try { 16857/******/ return this || new Function('return this')(); 16858/******/ } catch (e) { 16859/******/ if (typeof window === 'object') return window; 16860/******/ } 16861/******/ })(); 16862/******/ })(); 16863/******/ 16864/******/ /* webpack/runtime/hasOwnProperty shorthand */ 16865/******/ (() => { 16866/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) 16867/******/ })(); 16868/******/ 16869/******/ /* webpack/runtime/make namespace object */ 16870/******/ (() => { 16871/******/ // define __esModule on exports 16872/******/ __webpack_require__.r = (exports) => { 16873/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { 16874/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); 16875/******/ } 16876/******/ Object.defineProperty(exports, '__esModule', { value: true }); 16877/******/ }; 16878/******/ })(); 16879/******/ 16880/******/ /* webpack/runtime/jsonp chunk loading */ 16881/******/ (() => { 16882/******/ // no baseURI 16883/******/ 16884/******/ // object to store loaded and loading chunks 16885/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched 16886/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded 16887/******/ var installedChunks = { 16888/******/ "global": 0 16889/******/ }; 16890/******/ 16891/******/ // no chunk on demand loading 16892/******/ 16893/******/ // no prefetching 16894/******/ 16895/******/ // no preloaded 16896/******/ 16897/******/ // no HMR 16898/******/ 16899/******/ // no HMR manifest 16900/******/ 16901/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0); 16902/******/ 16903/******/ // install a JSONP callback for chunk loading 16904/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => { 16905/******/ var [chunkIds, moreModules, runtime] = data; 16906/******/ // add "moreModules" to the modules object, 16907/******/ // then flag all "chunkIds" as loaded and fire callback 16908/******/ var moduleId, chunkId, i = 0; 16909/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) { 16910/******/ for(moduleId in moreModules) { 16911/******/ if(__webpack_require__.o(moreModules, moduleId)) { 16912/******/ __webpack_require__.m[moduleId] = moreModules[moduleId]; 16913/******/ } 16914/******/ } 16915/******/ if(runtime) var result = runtime(__webpack_require__); 16916/******/ } 16917/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data); 16918/******/ for(;i < chunkIds.length; i++) { 16919/******/ chunkId = chunkIds[i]; 16920/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) { 16921/******/ installedChunks[chunkId][0](); 16922/******/ } 16923/******/ installedChunks[chunkId] = 0; 16924/******/ } 16925/******/ return __webpack_require__.O(result); 16926/******/ } 16927/******/ 16928/******/ var chunkLoadingGlobal = self["webpackChunkLibrary"] = self["webpackChunkLibrary"] || []; 16929/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0)); 16930/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal)); 16931/******/ })(); 16932/******/ 16933/************************************************************************/ 16934/******/ 16935/******/ // startup 16936/******/ // Load entry module and return exports 16937/******/ // This entry module depends on other loaded chunks and execution need to be delayed 16938/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["common"], () => (__webpack_require__("./Static/javascript/index.ts"))) 16939/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__); 16940/******/ 16941/******/ return __webpack_exports__; 16942/******/ })() 16943; 16944}); 16945//# sourceMappingURL=global.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.