@iamproperty/components 2.1.0 → 2.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/assets/.DS_Store +0 -0
  2. package/assets/css/core.min.css +1 -1
  3. package/assets/css/core.min.css.map +1 -1
  4. package/assets/css/style.min.css +1 -1
  5. package/assets/css/style.min.css.map +1 -1
  6. package/assets/js/main.js +5 -0
  7. package/assets/js/modules/modal.js +19 -1
  8. package/assets/js/modules/table.js +4 -0
  9. package/assets/js/modules/youtubevideo.js +145 -0
  10. package/assets/js/scripts.bundle.js +181 -623
  11. package/assets/js/scripts.bundle.js.map +1 -1
  12. package/assets/js/scripts.bundle.min.js +3 -3
  13. package/assets/js/scripts.bundle.min.js.map +1 -1
  14. package/assets/sass/_corefiles.scss +2 -2
  15. package/assets/sass/_functions/utilities.scss +41 -1
  16. package/assets/sass/_functions/variables.scss +74 -21
  17. package/assets/sass/components/accordion.scss +1 -0
  18. package/assets/sass/components/header.scss +1 -1
  19. package/assets/sass/elements/container.scss +104 -16
  20. package/assets/sass/elements/lists.scss +5 -0
  21. package/assets/sass/elements/type.scss +22 -7
  22. package/assets/sass/foundations/brand.scss +10 -0
  23. package/assets/sass/foundations/circles.scss +18 -11
  24. package/assets/sass/foundations/media.scss +47 -0
  25. package/assets/sass/foundations/reboot.scss +13 -3
  26. package/assets/sass/foundations/root.scss +4 -1
  27. package/dist/components.common.js +539 -5703
  28. package/dist/components.common.js.map +1 -1
  29. package/dist/components.css +1 -1
  30. package/dist/components.css.map +1 -1
  31. package/dist/components.umd.js +539 -5703
  32. package/dist/components.umd.js.map +1 -1
  33. package/dist/components.umd.min.js +1 -1
  34. package/dist/components.umd.min.js.map +1 -1
  35. package/package.json +36 -37
  36. package/src/components/Accordion/AccordionItem.vue +2 -2
  37. package/src/components/Card/Card.vue +1 -1
  38. package/src/components/Header/Header.vue +2 -2
  39. package/src/components/Nav/Nav.vue +1 -1
  40. package/src/components/Tabs/Tabs.vue +12 -8
  41. package/src/elements/Table/README.md +7 -0
  42. package/src/foundations/YoutubeVideo/README.md +11 -0
  43. package/src/foundations/YoutubeVideo/YoutubeVideo.vue +24 -0
  44. package/src/index.js +1 -0
  45. package/assets/img/.DS_Store +0 -0
  46. package/assets/sass/.DS_Store +0 -0
  47. package/assets/sass/elements/media.scss +0 -3
  48. package/assets/svg/.DS_Store +0 -0
  49. package/assets/svg/flat/.DS_Store +0 -0
@@ -1,6 +1,6 @@
1
1
  /*!
2
- * Bootstrap v2.1.0
3
- * Copyright 2011-2021 [object Object]
2
+ * Bootstrap v2.2.0
3
+ * Copyright 2011-2022 [object Object]
4
4
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
5
5
  */
6
6
  (function (factory) {
@@ -8,96 +8,6 @@
8
8
  factory();
9
9
  })((function () { 'use strict';
10
10
 
11
- var TO_STRING_TAG_SUPPORT = require('../internals/to-string-tag-support');
12
- var redefine$1 = require('../internals/redefine');
13
- var toString$3 = require('../internals/object-to-string');
14
-
15
- // `Object.prototype.toString` method
16
- // https://tc39.es/ecma262/#sec-object.prototype.tostring
17
- if (!TO_STRING_TAG_SUPPORT) {
18
- redefine$1(Object.prototype, 'toString', toString$3, { unsafe: true });
19
- }
20
-
21
- var global$1 = require('../internals/global');
22
- var DOMIterables = require('../internals/dom-iterables');
23
- var DOMTokenListPrototype = require('../internals/dom-token-list-prototype');
24
- var forEach = require('../internals/array-for-each');
25
- var createNonEnumerableProperty = require('../internals/create-non-enumerable-property');
26
-
27
- var handlePrototype = function (CollectionPrototype) {
28
- // some Chrome versions have non-configurable methods on DOMTokenList
29
- if (CollectionPrototype && CollectionPrototype.forEach !== forEach) try {
30
- createNonEnumerableProperty(CollectionPrototype, 'forEach', forEach);
31
- } catch (error) {
32
- CollectionPrototype.forEach = forEach;
33
- }
34
- };
35
-
36
- for (var COLLECTION_NAME in DOMIterables) {
37
- if (DOMIterables[COLLECTION_NAME]) {
38
- handlePrototype(global$1[COLLECTION_NAME] && global$1[COLLECTION_NAME].prototype);
39
- }
40
- }
41
-
42
- handlePrototype(DOMTokenListPrototype);
43
-
44
- var $$7 = require('../internals/export');
45
- var from = require('../internals/array-from');
46
- var checkCorrectnessOfIteration = require('../internals/check-correctness-of-iteration');
47
-
48
- var INCORRECT_ITERATION = !checkCorrectnessOfIteration(function (iterable) {
49
- // eslint-disable-next-line es/no-array-from -- required for testing
50
- Array.from(iterable);
51
- });
52
-
53
- // `Array.from` method
54
- // https://tc39.es/ecma262/#sec-array.from
55
- $$7({ target: 'Array', stat: true, forced: INCORRECT_ITERATION }, {
56
- from: from
57
- });
58
-
59
- var charAt = require('../internals/string-multibyte').charAt;
60
- var toString$2 = require('../internals/to-string');
61
- var InternalStateModule = require('../internals/internal-state');
62
- var defineIterator = require('../internals/define-iterator');
63
-
64
- var STRING_ITERATOR = 'String Iterator';
65
- var setInternalState = InternalStateModule.set;
66
- var getInternalState = InternalStateModule.getterFor(STRING_ITERATOR);
67
-
68
- // `String.prototype[@@iterator]` method
69
- // https://tc39.es/ecma262/#sec-string.prototype-@@iterator
70
- defineIterator(String, 'String', function (iterated) {
71
- setInternalState(this, {
72
- type: STRING_ITERATOR,
73
- string: toString$2(iterated),
74
- index: 0
75
- });
76
- // `%StringIteratorPrototype%.next` method
77
- // https://tc39.es/ecma262/#sec-%stringiteratorprototype%.next
78
- }, function next() {
79
- var state = getInternalState(this);
80
- var string = state.string;
81
- var index = state.index;
82
- var point;
83
- if (index >= string.length) return { value: undefined, done: true };
84
- point = charAt(string, index);
85
- state.index += point.length;
86
- return { value: point, done: false };
87
- });
88
-
89
- var $$6 = require('../internals/export');
90
- var $padStart = require('../internals/string-pad').start;
91
- var WEBKIT_BUG = require('../internals/string-pad-webkit-bug');
92
-
93
- // `String.prototype.padStart` method
94
- // https://tc39.es/ecma262/#sec-string.prototype.padstart
95
- $$6({ target: 'String', proto: true, forced: WEBKIT_BUG }, {
96
- padStart: function padStart(maxLength /* , fillString = ' ' */) {
97
- return $padStart(this, maxLength, arguments.length > 1 ? arguments[1] : undefined);
98
- }
99
- });
100
-
101
11
  /**
102
12
  * Global helper functions to help maintain and enhance framework elements.
103
13
  * @module Helpers
@@ -107,7 +17,7 @@
107
17
  * Add global classes used by the CSS and later JavaScript.
108
18
  * @param {HTMLElement} body Dom element, this doesn't have to be the body but it is recommended.
109
19
  */
110
- var addBodyClasses = function addBodyClasses(body) {
20
+ var addBodyClasses = body => {
111
21
  body.classList.add("js-enabled");
112
22
 
113
23
  if (navigator.userAgent.indexOf('MSIE') !== -1 || navigator.appVersion.indexOf('Trident/') > 0) {
@@ -122,9 +32,9 @@
122
32
  */
123
33
 
124
34
 
125
- var checkElements = function checkElements(element) {
35
+ var checkElements = element => {
126
36
  // Tables
127
- Array.from(element.querySelectorAll('table')).forEach(function (table, index) {
37
+ Array.from(element.querySelectorAll('table')).forEach((table, index) => {
128
38
  tableStacked(table);
129
39
  tableWrap(table);
130
40
  });
@@ -135,7 +45,7 @@
135
45
  */
136
46
 
137
47
 
138
- var tableWrap = function tableWrap(table) {
48
+ var tableWrap = table => {
139
49
  if (!table.parentNode.classList.contains('table__wrapper')) {
140
50
  var tableHTML = table.outerHTML;
141
51
  table.outerHTML = "<div class=\"table__wrapper\">".concat(tableHTML, "</div>");
@@ -147,12 +57,12 @@
147
57
  */
148
58
 
149
59
 
150
- var tableStacked = function tableStacked(table) {
60
+ var tableStacked = table => {
151
61
  var colHeadings = Array.from(table.querySelectorAll('thead th'));
152
62
  var colRows = Array.from(table.querySelectorAll('tbody tr'));
153
- colRows.forEach(function (row, index) {
63
+ colRows.forEach((row, index) => {
154
64
  var cells = Array.from(row.querySelectorAll('th, td'));
155
- cells.forEach(function (cell, cellIndex) {
65
+ cells.forEach((cell, cellIndex) => {
156
66
  var heading = colHeadings[cellIndex];
157
67
 
158
68
  if (typeof heading != "undefined") {
@@ -172,73 +82,10 @@
172
82
  !isNaN(parseFloat(str)); // ...and ensure strings of whitespace fail
173
83
  };
174
84
 
175
- var zeroPad = function zeroPad(num, places) {
176
- return String(num).padStart(places, '0');
177
- };
178
-
179
- function _arrayWithHoles(arr) {
180
- if (Array.isArray(arr)) return arr;
181
- }
182
-
183
- function _iterableToArrayLimit(arr, i) {
184
- var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
185
-
186
- if (_i == null) return;
187
- var _arr = [];
188
- var _n = true;
189
- var _d = false;
190
-
191
- var _s, _e;
192
-
193
- try {
194
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
195
- _arr.push(_s.value);
196
-
197
- if (i && _arr.length === i) break;
198
- }
199
- } catch (err) {
200
- _d = true;
201
- _e = err;
202
- } finally {
203
- try {
204
- if (!_n && _i["return"] != null) _i["return"]();
205
- } finally {
206
- if (_d) throw _e;
207
- }
208
- }
209
-
210
- return _arr;
211
- }
212
-
213
- function _arrayLikeToArray(arr, len) {
214
- if (len == null || len > arr.length) len = arr.length;
85
+ var zeroPad = (num, places) => String(num).padStart(places, '0');
215
86
 
216
- for (var i = 0, arr2 = new Array(len); i < len; i++) {
217
- arr2[i] = arr[i];
218
- }
219
-
220
- return arr2;
221
- }
222
-
223
- function _unsupportedIterableToArray(o, minLen) {
224
- if (!o) return;
225
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
226
- var n = Object.prototype.toString.call(o).slice(8, -1);
227
- if (n === "Object" && o.constructor) n = o.constructor.name;
228
- if (n === "Map" || n === "Set") return Array.from(o);
229
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
230
- }
231
-
232
- function _nonIterableRest() {
233
- throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
234
- }
235
-
236
- function _slicedToArray(arr, i) {
237
- return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
238
- }
239
-
240
- var navbar = function navbar(element) {
241
- Array.from(element.querySelectorAll('details')).forEach(function (detail, index) {
87
+ var navbar = element => {
88
+ Array.from(element.querySelectorAll('details')).forEach((detail, index) => {
242
89
  detail.addEventListener('mouseenter', function (e) {
243
90
  if (window.matchMedia('(min-width: 62em)').matches) detail.setAttribute('open', 'true');
244
91
  }, false);
@@ -246,10 +93,8 @@
246
93
  if (window.matchMedia('(min-width: 62em)').matches) detail.removeAttribute('open');
247
94
  }, false);
248
95
  });
249
- var observer = new IntersectionObserver(function (_ref) {
250
- var _ref2 = _slicedToArray(_ref, 1),
251
- e = _ref2[0];
252
-
96
+ var observer = new IntersectionObserver(_ref => {
97
+ var [e] = _ref;
253
98
  return e.target.classList.toggle("is-stuck", e.intersectionRatio < 1);
254
99
  }, {
255
100
  threshold: [1]
@@ -257,416 +102,8 @@
257
102
  observer.observe(element);
258
103
  };
259
104
 
260
- function _typeof(obj) {
261
- "@babel/helpers - typeof";
262
-
263
- if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
264
- _typeof = function _typeof(obj) {
265
- return typeof obj;
266
- };
267
- } else {
268
- _typeof = function _typeof(obj) {
269
- return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj;
270
- };
271
- }
272
-
273
- return _typeof(obj);
274
- }
275
-
276
- var uncurryThis$3 = require('../internals/function-uncurry-this');
277
- var PROPER_FUNCTION_NAME = require('../internals/function-name').PROPER;
278
- var redefine = require('../internals/redefine');
279
- var anObject$1 = require('../internals/an-object');
280
- var isPrototypeOf = require('../internals/object-is-prototype-of');
281
- var $toString = require('../internals/to-string');
282
- var fails$4 = require('../internals/fails');
283
- var regExpFlags = require('../internals/regexp-flags');
284
-
285
- var TO_STRING = 'toString';
286
- var RegExpPrototype = RegExp.prototype;
287
- var n$ToString = RegExpPrototype[TO_STRING];
288
- var getFlags = uncurryThis$3(regExpFlags);
289
-
290
- var NOT_GENERIC = fails$4(function () { return n$ToString.call({ source: 'a', flags: 'b' }) != '/a/b'; });
291
- // FF44- RegExp#toString has a wrong name
292
- var INCORRECT_NAME = PROPER_FUNCTION_NAME && n$ToString.name != TO_STRING;
293
-
294
- // `RegExp.prototype.toString` method
295
- // https://tc39.es/ecma262/#sec-regexp.prototype.tostring
296
- if (NOT_GENERIC || INCORRECT_NAME) {
297
- redefine(RegExp.prototype, TO_STRING, function toString() {
298
- var R = anObject$1(this);
299
- var p = $toString(R.source);
300
- var rf = R.flags;
301
- var f = $toString(rf === undefined && isPrototypeOf(RegExpPrototype, R) && !('flags' in RegExpPrototype) ? getFlags(R) : rf);
302
- return '/' + p + '/' + f;
303
- }, { unsafe: true });
304
- }
305
-
306
- var $$5 = require('../internals/export');
307
- var uncurryThis$2 = require('../internals/function-uncurry-this');
308
- var aCallable = require('../internals/a-callable');
309
- var toObject$2 = require('../internals/to-object');
310
- var lengthOfArrayLike$1 = require('../internals/length-of-array-like');
311
- var toString$1 = require('../internals/to-string');
312
- var fails$3 = require('../internals/fails');
313
- var internalSort = require('../internals/array-sort');
314
- var arrayMethodIsStrict$1 = require('../internals/array-method-is-strict');
315
- var FF = require('../internals/engine-ff-version');
316
- var IE_OR_EDGE = require('../internals/engine-is-ie-or-edge');
317
- var V8 = require('../internals/engine-v8-version');
318
- var WEBKIT = require('../internals/engine-webkit-version');
319
-
320
- var test = [];
321
- var un$Sort = uncurryThis$2(test.sort);
322
- var push$1 = uncurryThis$2(test.push);
323
-
324
- // IE8-
325
- var FAILS_ON_UNDEFINED = fails$3(function () {
326
- test.sort(undefined);
327
- });
328
- // V8 bug
329
- var FAILS_ON_NULL = fails$3(function () {
330
- test.sort(null);
331
- });
332
- // Old WebKit
333
- var STRICT_METHOD$1 = arrayMethodIsStrict$1('sort');
334
-
335
- var STABLE_SORT = !fails$3(function () {
336
- // feature detection can be too slow, so check engines versions
337
- if (V8) return V8 < 70;
338
- if (FF && FF > 3) return;
339
- if (IE_OR_EDGE) return true;
340
- if (WEBKIT) return WEBKIT < 603;
341
-
342
- var result = '';
343
- var code, chr, value, index;
344
-
345
- // generate an array with more 512 elements (Chakra and old V8 fails only in this case)
346
- for (code = 65; code < 76; code++) {
347
- chr = String.fromCharCode(code);
348
-
349
- switch (code) {
350
- case 66: case 69: case 70: case 72: value = 3; break;
351
- case 68: case 71: value = 4; break;
352
- default: value = 2;
353
- }
354
-
355
- for (index = 0; index < 47; index++) {
356
- test.push({ k: chr + index, v: value });
357
- }
358
- }
359
-
360
- test.sort(function (a, b) { return b.v - a.v; });
361
-
362
- for (index = 0; index < test.length; index++) {
363
- chr = test[index].k.charAt(0);
364
- if (result.charAt(result.length - 1) !== chr) result += chr;
365
- }
366
-
367
- return result !== 'DGBEFHACIJK';
368
- });
369
-
370
- var FORCED$1 = FAILS_ON_UNDEFINED || !FAILS_ON_NULL || !STRICT_METHOD$1 || !STABLE_SORT;
371
-
372
- var getSortCompare = function (comparefn) {
373
- return function (x, y) {
374
- if (y === undefined) return -1;
375
- if (x === undefined) return 1;
376
- if (comparefn !== undefined) return +comparefn(x, y) || 0;
377
- return toString$1(x) > toString$1(y) ? 1 : -1;
378
- };
379
- };
380
-
381
- // `Array.prototype.sort` method
382
- // https://tc39.es/ecma262/#sec-array.prototype.sort
383
- $$5({ target: 'Array', proto: true, forced: FORCED$1 }, {
384
- sort: function sort(comparefn) {
385
- if (comparefn !== undefined) aCallable(comparefn);
386
-
387
- var array = toObject$2(this);
388
-
389
- if (STABLE_SORT) return comparefn === undefined ? un$Sort(array) : un$Sort(array, comparefn);
390
-
391
- var items = [];
392
- var arrayLength = lengthOfArrayLike$1(array);
393
- var itemsLength, index;
394
-
395
- for (index = 0; index < arrayLength; index++) {
396
- if (index in array) push$1(items, array[index]);
397
- }
398
-
399
- internalSort(items, getSortCompare(comparefn));
400
-
401
- itemsLength = items.length;
402
- index = 0;
403
-
404
- while (index < itemsLength) array[index] = items[index++];
405
- while (index < arrayLength) delete array[index++];
406
-
407
- return array;
408
- }
409
- });
410
-
411
- var $$4 = require('../internals/export');
412
- var global = require('../internals/global');
413
- var fails$2 = require('../internals/fails');
414
- var isArray = require('../internals/is-array');
415
- var isObject = require('../internals/is-object');
416
- var toObject$1 = require('../internals/to-object');
417
- var lengthOfArrayLike = require('../internals/length-of-array-like');
418
- var createProperty = require('../internals/create-property');
419
- var arraySpeciesCreate = require('../internals/array-species-create');
420
- var arrayMethodHasSpeciesSupport$1 = require('../internals/array-method-has-species-support');
421
- var wellKnownSymbol$1 = require('../internals/well-known-symbol');
422
- var V8_VERSION = require('../internals/engine-v8-version');
423
-
424
- var IS_CONCAT_SPREADABLE = wellKnownSymbol$1('isConcatSpreadable');
425
- var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
426
- var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
427
- var TypeError$1 = global.TypeError;
428
-
429
- // We can't use this feature detection in V8 since it causes
430
- // deoptimization and serious performance degradation
431
- // https://github.com/zloirock/core-js/issues/679
432
- var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails$2(function () {
433
- var array = [];
434
- array[IS_CONCAT_SPREADABLE] = false;
435
- return array.concat()[0] !== array;
436
- });
437
-
438
- var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport$1('concat');
439
-
440
- var isConcatSpreadable = function (O) {
441
- if (!isObject(O)) return false;
442
- var spreadable = O[IS_CONCAT_SPREADABLE];
443
- return spreadable !== undefined ? !!spreadable : isArray(O);
444
- };
445
-
446
- var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
447
-
448
- // `Array.prototype.concat` method
449
- // https://tc39.es/ecma262/#sec-array.prototype.concat
450
- // with adding support of @@isConcatSpreadable and @@species
451
- $$4({ target: 'Array', proto: true, forced: FORCED }, {
452
- // eslint-disable-next-line no-unused-vars -- required for `.length`
453
- concat: function concat(arg) {
454
- var O = toObject$1(this);
455
- var A = arraySpeciesCreate(O, 0);
456
- var n = 0;
457
- var i, k, length, len, E;
458
- for (i = -1, length = arguments.length; i < length; i++) {
459
- E = i === -1 ? O : arguments[i];
460
- if (isConcatSpreadable(E)) {
461
- len = lengthOfArrayLike(E);
462
- if (n + len > MAX_SAFE_INTEGER) throw TypeError$1(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
463
- for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
464
- } else {
465
- if (n >= MAX_SAFE_INTEGER) throw TypeError$1(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
466
- createProperty(A, n++, E);
467
- }
468
- }
469
- A.length = n;
470
- return A;
471
- }
472
- });
473
-
474
- var $$3 = require('../internals/export');
475
- var uncurryThis$1 = require('../internals/function-uncurry-this');
476
- var IndexedObject = require('../internals/indexed-object');
477
- var toIndexedObject = require('../internals/to-indexed-object');
478
- var arrayMethodIsStrict = require('../internals/array-method-is-strict');
479
-
480
- var un$Join = uncurryThis$1([].join);
481
-
482
- var ES3_STRINGS = IndexedObject != Object;
483
- var STRICT_METHOD = arrayMethodIsStrict('join', ',');
484
-
485
- // `Array.prototype.join` method
486
- // https://tc39.es/ecma262/#sec-array.prototype.join
487
- $$3({ target: 'Array', proto: true, forced: ES3_STRINGS || !STRICT_METHOD }, {
488
- join: function join(separator) {
489
- return un$Join(toIndexedObject(this), separator === undefined ? ',' : separator);
490
- }
491
- });
492
-
493
- var $$2 = require('../internals/export');
494
- var $map = require('../internals/array-iteration').map;
495
- var arrayMethodHasSpeciesSupport = require('../internals/array-method-has-species-support');
496
-
497
- var HAS_SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('map');
498
-
499
- // `Array.prototype.map` method
500
- // https://tc39.es/ecma262/#sec-array.prototype.map
501
- // with adding support of @@species
502
- $$2({ target: 'Array', proto: true, forced: !HAS_SPECIES_SUPPORT }, {
503
- map: function map(callbackfn /* , thisArg */) {
504
- return $map(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
505
- }
506
- });
507
-
508
- var $$1 = require('../internals/export');
509
- var toObject = require('../internals/to-object');
510
- var nativeKeys = require('../internals/object-keys');
511
- var fails$1 = require('../internals/fails');
512
-
513
- var FAILS_ON_PRIMITIVES = fails$1(function () { nativeKeys(1); });
514
-
515
- // `Object.keys` method
516
- // https://tc39.es/ecma262/#sec-object.keys
517
- $$1({ target: 'Object', stat: true, forced: FAILS_ON_PRIMITIVES }, {
518
- keys: function keys(it) {
519
- return nativeKeys(toObject(it));
520
- }
521
- });
522
-
523
- var $ = require('../internals/export');
524
- var exec = require('../internals/regexp-exec');
525
-
526
- // `RegExp.prototype.exec` method
527
- // https://tc39.es/ecma262/#sec-regexp.prototype.exec
528
- $({ target: 'RegExp', proto: true, forced: /./.exec !== exec }, {
529
- exec: exec
530
- });
531
-
532
- var apply = require('../internals/function-apply');
533
- var call = require('../internals/function-call');
534
- var uncurryThis = require('../internals/function-uncurry-this');
535
- var fixRegExpWellKnownSymbolLogic = require('../internals/fix-regexp-well-known-symbol-logic');
536
- var fails = require('../internals/fails');
537
- var anObject = require('../internals/an-object');
538
- var isCallable = require('../internals/is-callable');
539
- var toIntegerOrInfinity = require('../internals/to-integer-or-infinity');
540
- var toLength = require('../internals/to-length');
541
- var toString = require('../internals/to-string');
542
- var requireObjectCoercible = require('../internals/require-object-coercible');
543
- var advanceStringIndex = require('../internals/advance-string-index');
544
- var getMethod = require('../internals/get-method');
545
- var getSubstitution = require('../internals/get-substitution');
546
- var regExpExec = require('../internals/regexp-exec-abstract');
547
- var wellKnownSymbol = require('../internals/well-known-symbol');
548
-
549
- var REPLACE = wellKnownSymbol('replace');
550
- var max = Math.max;
551
- var min = Math.min;
552
- var concat = uncurryThis([].concat);
553
- var push = uncurryThis([].push);
554
- var stringIndexOf = uncurryThis(''.indexOf);
555
- var stringSlice = uncurryThis(''.slice);
556
-
557
- var maybeToString = function (it) {
558
- return it === undefined ? it : String(it);
559
- };
560
-
561
- // IE <= 11 replaces $0 with the whole match, as if it was $&
562
- // https://stackoverflow.com/questions/6024666/getting-ie-to-replace-a-regex-with-the-literal-string-0
563
- var REPLACE_KEEPS_$0 = (function () {
564
- // eslint-disable-next-line regexp/prefer-escape-replacement-dollar-char -- required for testing
565
- return 'a'.replace(/./, '$0') === '$0';
566
- })();
567
-
568
- // Safari <= 13.0.3(?) substitutes nth capture where n>m with an empty string
569
- var REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE = (function () {
570
- if (/./[REPLACE]) {
571
- return /./[REPLACE]('a', '$0') === '';
572
- }
573
- return false;
574
- })();
575
-
576
- var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
577
- var re = /./;
578
- re.exec = function () {
579
- var result = [];
580
- result.groups = { a: '7' };
581
- return result;
582
- };
583
- // eslint-disable-next-line regexp/no-useless-dollar-replacements -- false positive
584
- return ''.replace(re, '$<a>') !== '7';
585
- });
586
-
587
- // @@replace logic
588
- fixRegExpWellKnownSymbolLogic('replace', function (_, nativeReplace, maybeCallNative) {
589
- var UNSAFE_SUBSTITUTE = REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE ? '$' : '$0';
590
-
591
- return [
592
- // `String.prototype.replace` method
593
- // https://tc39.es/ecma262/#sec-string.prototype.replace
594
- function replace(searchValue, replaceValue) {
595
- var O = requireObjectCoercible(this);
596
- var replacer = searchValue == undefined ? undefined : getMethod(searchValue, REPLACE);
597
- return replacer
598
- ? call(replacer, searchValue, O, replaceValue)
599
- : call(nativeReplace, toString(O), searchValue, replaceValue);
600
- },
601
- // `RegExp.prototype[@@replace]` method
602
- // https://tc39.es/ecma262/#sec-regexp.prototype-@@replace
603
- function (string, replaceValue) {
604
- var rx = anObject(this);
605
- var S = toString(string);
606
-
607
- if (
608
- typeof replaceValue == 'string' &&
609
- stringIndexOf(replaceValue, UNSAFE_SUBSTITUTE) === -1 &&
610
- stringIndexOf(replaceValue, '$<') === -1
611
- ) {
612
- var res = maybeCallNative(nativeReplace, rx, S, replaceValue);
613
- if (res.done) return res.value;
614
- }
615
-
616
- var functionalReplace = isCallable(replaceValue);
617
- if (!functionalReplace) replaceValue = toString(replaceValue);
618
-
619
- var global = rx.global;
620
- if (global) {
621
- var fullUnicode = rx.unicode;
622
- rx.lastIndex = 0;
623
- }
624
- var results = [];
625
- while (true) {
626
- var result = regExpExec(rx, S);
627
- if (result === null) break;
628
-
629
- push(results, result);
630
- if (!global) break;
631
-
632
- var matchStr = toString(result[0]);
633
- if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
634
- }
635
-
636
- var accumulatedResult = '';
637
- var nextSourcePosition = 0;
638
- for (var i = 0; i < results.length; i++) {
639
- result = results[i];
640
-
641
- var matched = toString(result[0]);
642
- var position = max(min(toIntegerOrInfinity(result.index), S.length), 0);
643
- var captures = [];
644
- // NOTE: This is equivalent to
645
- // captures = result.slice(1).map(maybeToString)
646
- // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
647
- // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
648
- // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
649
- for (var j = 1; j < result.length; j++) push(captures, maybeToString(result[j]));
650
- var namedCaptures = result.groups;
651
- if (functionalReplace) {
652
- var replacerArgs = concat([matched], captures, position, S);
653
- if (namedCaptures !== undefined) push(replacerArgs, namedCaptures);
654
- var replacement = toString(apply(replaceValue, undefined, replacerArgs));
655
- } else {
656
- replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
657
- }
658
- if (position >= nextSourcePosition) {
659
- accumulatedResult += stringSlice(S, nextSourcePosition, position) + replacement;
660
- nextSourcePosition = position + matched.length;
661
- }
662
- }
663
- return accumulatedResult + stringSlice(S, nextSourcePosition);
664
- }
665
- ];
666
- }, !REPLACE_SUPPORTS_NAMED_GROUPS || !REPLACE_KEEPS_$0 || REGEXP_REPLACE_SUBSTITUTES_UNDEFINED_CAPTURE);
667
-
668
105
  function table(tableElement) {
669
- if (_typeof(tableElement) != "object") return false;
106
+ if (typeof tableElement != "object") return false;
670
107
  var thead = tableElement.querySelector('thead');
671
108
  var tbody = tableElement.querySelector('tbody');
672
109
  var storedData = tbody.cloneNode(true);
@@ -680,7 +117,7 @@
680
117
  var sortTable = function sortTable(sortBy, sort) {
681
118
  // Create an array from the table rows, the index created is then used to sort the array
682
119
  var tableArr = [];
683
- Array.from(tbody.querySelectorAll('tr')).forEach(function (tableRow, index) {
120
+ Array.from(tbody.querySelectorAll('tr')).forEach((tableRow, index) => {
684
121
  var rowIndex = tableRow.querySelector('td[data-label="' + sortBy + '"], th[data-label="' + sortBy + '"]').textContent;
685
122
  if (isNumeric(rowIndex)) rowIndex = zeroPad(rowIndex, 10);
686
123
  var dataRow = {
@@ -690,14 +127,12 @@
690
127
  tableArr.push(dataRow);
691
128
  }); // Sort array
692
129
 
693
- tableArr.sort(function (a, b) {
694
- return a.index > b.index ? 1 : -1;
695
- }); // Reverse if descending
130
+ tableArr.sort((a, b) => a.index > b.index ? 1 : -1); // Reverse if descending
696
131
 
697
132
  if (sort == "descending") tableArr = tableArr.reverse(); // Create a string to return and populate the tbody
698
133
 
699
134
  var strTbody = '';
700
- tableArr.forEach(function (tableRow, index) {
135
+ tableArr.forEach((tableRow, index) => {
701
136
  strTbody += tableRow.row.outerHTML;
702
137
  });
703
138
  tbody.innerHTML = strTbody; // Dispatch the sortable event
@@ -712,7 +147,7 @@
712
147
  // Get current sort order
713
148
  var sort = target.getAttribute('aria-sort') == "ascending" ? "descending" : "ascending"; // unset sort attributes
714
149
 
715
- Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach(function (col, index) {
150
+ Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach((col, index) => {
716
151
  col.setAttribute('aria-sort', 'none');
717
152
  }); // Set the sort order attribute
718
153
 
@@ -722,7 +157,7 @@
722
157
  tableElement.setAttribute('data-sortBy', target.textContent); // Sort the table
723
158
 
724
159
  sortTable(target.textContent, sort);
725
- Array.from(tableElement.querySelectorAll('tr[draggable]')).forEach(function (tableRow, index) {
160
+ Array.from(tableElement.querySelectorAll('tr[draggable]')).forEach((tableRow, index) => {
726
161
  tableRow.removeAttribute('draggable');
727
162
  });
728
163
  break;
@@ -732,7 +167,7 @@
732
167
 
733
168
  if (tableElement.getAttribute('data-sortBy')) {
734
169
  var sort = tableElement.getAttribute('data-sort') == "ascending" ? "descending" : "ascending";
735
- Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach(function (col, index) {
170
+ Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach((col, index) => {
736
171
  if (col.textContent == tableElement.getAttribute('data-sortBy')) {
737
172
  col.setAttribute('aria-sort', sort);
738
173
  col.click();
@@ -753,8 +188,8 @@
753
188
  var filterColumns = Array.from(tableElement.querySelectorAll('th[data-filterable]')); // Populate a list of searchable terms from the cells of the columns that could be used as a filter
754
189
 
755
190
  var searchableTerms = {};
756
- filterColumns.forEach(function (columnHeading, index) {
757
- Array.from(tableElement.querySelectorAll('td[data-label="' + columnHeading.textContent + '"]')).forEach(function (label, index) {
191
+ filterColumns.forEach((columnHeading, index) => {
192
+ Array.from(tableElement.querySelectorAll('td[data-label="' + columnHeading.textContent + '"]')).forEach((label, index) => {
758
193
  searchableTerms[label.textContent] = label.textContent;
759
194
  });
760
195
  }); // Create the form
@@ -763,11 +198,7 @@
763
198
 
764
199
  var checkboxClass = filterColumns.length == 1 ? "d-none" : "d-sm-flex"; // Hide controls when only one filter is chosen
765
200
 
766
- form.innerHTML = "<div class=\"col-sm-6 col-md-4 pb-3\">\n <div class=\"form-control__wrapper form-control-inline mb-0\">\n <label for=\"".concat(randID, "_filter\" class=\"form-label\">").concat(filterTitle, ":</label>\n <input type=\"search\" name=\"").concat(randID, "_filter\" id=\"").concat(randID, "_filter\" class=\"form-control form-control-sm\" placeholder=\"\" list=\"").concat(randID, "_list\" />\n </div>\n <datalist id=\"").concat(randID, "_list\">\n ").concat(Object.keys(searchableTerms).map(function (term) {
767
- return "<option value=\"".concat(term, "\"></option>");
768
- }).join(""), "\n </datalist>\n</div>\n<div class=\"col-md-8 align-items-center pb-3 ").concat(checkboxClass, "\">\n ").concat("<span class=\"pe-3 text-nowrap h5 mb-0\">Filter by: </span>" + filterColumns.map(function (column) {
769
- return "<div class=\"form-check pe-3 mt-0 mb-0\"><input class=\"form-check-input\" type=\"checkbox\" id=\"".concat(randID, "_").concat(column.textContent.replace(' ', '_').toLowerCase(), "\" checked=\"checked\" /><label class=\"form-check-label text-nowrap\" for=\"").concat(randID, "_").concat(column.textContent.replace(' ', '_').toLowerCase(), "\">").concat(column.textContent, "</label></div>");
770
- }).join(""), "\n</div>"); // Add before the actual table
201
+ form.innerHTML = "<div class=\"col-sm-6 col-md-4 pb-3\">\n <div class=\"form-control__wrapper form-control-inline mb-0\">\n <label for=\"".concat(randID, "_filter\" class=\"form-label\">").concat(filterTitle, ":</label>\n <input type=\"search\" name=\"").concat(randID, "_filter\" id=\"").concat(randID, "_filter\" class=\"form-control form-control-sm\" placeholder=\"\" list=\"").concat(randID, "_list\" />\n </div>\n <datalist id=\"").concat(randID, "_list\">\n ").concat(Object.keys(searchableTerms).map(term => "<option value=\"".concat(term, "\"></option>")).join(""), "\n </datalist>\n</div>\n<div class=\"col-md-8 align-items-center pb-3 ").concat(checkboxClass, "\">\n ").concat("<span class=\"pe-3 text-nowrap h5 mb-0\">Filter by: </span>" + filterColumns.map(column => "<div class=\"form-check pe-3 mt-0 mb-0\"><input class=\"form-check-input\" type=\"checkbox\" id=\"".concat(randID, "_").concat(column.textContent.replace(' ', '_').toLowerCase(), "\" checked=\"checked\" /><label class=\"form-check-label text-nowrap\" for=\"").concat(randID, "_").concat(column.textContent.replace(' ', '_').toLowerCase(), "\">").concat(column.textContent, "</label></div>")).join(""), "\n</div>"); // Add before the actual table
771
202
 
772
203
  tableElement.prepend(form);
773
204
  };
@@ -775,10 +206,10 @@
775
206
  var filterTable = function filterTable(searchTerm) {
776
207
  // Create an array of rows that match the search term
777
208
  var tableArr = [];
778
- Array.from(storedData.querySelectorAll('tr')).forEach(function (tableRow, index) {
209
+ Array.from(storedData.querySelectorAll('tr')).forEach((tableRow, index) => {
779
210
  // We want one long search string per row including each filterable table cell
780
211
  var rowSearchString = '';
781
- Array.from(tableElement.querySelectorAll('[type="checkbox"]:checked + label')).forEach(function (label, index) {
212
+ Array.from(tableElement.querySelectorAll('[type="checkbox"]:checked + label')).forEach((label, index) => {
782
213
  rowSearchString += tableRow.querySelector('td[data-label="' + label.textContent + '"]').textContent + ' | ';
783
214
  }); // Check if the table row search string contains the search term
784
215
 
@@ -791,7 +222,7 @@
791
222
  }); // Create a string to return and populate the tbody
792
223
 
793
224
  var strTbody = '';
794
- tableArr.forEach(function (tableRow, index) {
225
+ tableArr.forEach((tableRow, index) => {
795
226
  strTbody += tableRow.row.outerHTML;
796
227
  });
797
228
  tbody.innerHTML = strTbody; // Dispatch the filter event.
@@ -802,21 +233,19 @@
802
233
  var createFilterList = function createFilterList() {
803
234
  // Check which options are checked
804
235
  var filterOptions = [];
805
- Array.from(tableElement.querySelectorAll('[type="checkbox"]:checked + label')).forEach(function (label, index) {
236
+ Array.from(tableElement.querySelectorAll('[type="checkbox"]:checked + label')).forEach((label, index) => {
806
237
  filterOptions.push(label.textContent);
807
238
  }); // Build up the list of searchable terms
808
239
 
809
240
  var searchableTerms = [];
810
- filterOptions.forEach(function (option, index) {
811
- Array.from(tableElement.querySelectorAll('td[data-label="' + option + '"]')).forEach(function (label, index) {
241
+ filterOptions.forEach((option, index) => {
242
+ Array.from(tableElement.querySelectorAll('td[data-label="' + option + '"]')).forEach((label, index) => {
812
243
  searchableTerms[label.textContent] = label.textContent;
813
244
  });
814
245
  }); // Rebuild the list
815
246
 
816
247
  var dataList = tableElement.querySelector('datalist');
817
- dataList.innerHTML = Object.keys(searchableTerms).map(function (term) {
818
- return "<option value=\"".concat(term, "\"></option>");
819
- }).join("");
248
+ dataList.innerHTML = Object.keys(searchableTerms).map(term => "<option value=\"".concat(term, "\"></option>")).join("");
820
249
  }; // On page load check if filters are needed
821
250
 
822
251
 
@@ -958,7 +387,7 @@
958
387
 
959
388
 
960
389
  var setReorderRows = function setReorderRows() {
961
- Array.from(tbody.querySelectorAll('tr')).forEach(function (tableRow, index) {
390
+ Array.from(tbody.querySelectorAll('tr')).forEach((tableRow, index) => {
962
391
  // Create column if not already created
963
392
  if (tableRow.querySelector('[data-label="Order"]') == null) {
964
393
  var orderColumn = document.createElement('th');
@@ -987,7 +416,7 @@
987
416
  for (var target = e.target; target && target != this; target = target.parentNode) {
988
417
  if (target.matches('.table-order-reset')) {
989
418
  // unset sort attributes
990
- Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach(function (col, index) {
419
+ Array.from(tableElement.querySelectorAll('[data-sortable]')).forEach((col, index) => {
991
420
  col.setAttribute('aria-sort', 'none');
992
421
  }); // Save the sort options on the table element so that it can be re-sorted later
993
422
 
@@ -995,7 +424,7 @@
995
424
  tableElement.removeAttribute('data-sortBy'); // Sort the table
996
425
 
997
426
  sortTable('Order', 'ascending');
998
- Array.from(tableElement.querySelectorAll('tbody tr')).forEach(function (tableRow, index) {
427
+ Array.from(tableElement.querySelectorAll('tbody tr')).forEach((tableRow, index) => {
999
428
  tableRow.setAttribute('draggable', 'true');
1000
429
  });
1001
430
  break;
@@ -1036,7 +465,7 @@
1036
465
  draggedRow.parentNode.removeChild(draggedRow);
1037
466
  if (draggedRow.getAttribute('data-order') > target.getAttribute('data-order')) target.parentNode.insertBefore(draggedRow, target);else target.parentNode.insertBefore(draggedRow, target.nextElementSibling); // Re label the rows
1038
467
 
1039
- Array.from(tbody.querySelectorAll('tr')).forEach(function (tableRowOrder, index) {
468
+ Array.from(tbody.querySelectorAll('tr')).forEach((tableRowOrder, index) => {
1040
469
  tableRowOrder.classList.remove('tr--dragging');
1041
470
  tableRowOrder.classList.remove('tr--dropable');
1042
471
  tableRowOrder.querySelector('th').innerHTML = index + 1;
@@ -1094,10 +523,10 @@
1094
523
  if (!accordionElement.classList.contains('accordion--keep-open')) {
1095
524
  var details = accordionElement.querySelectorAll(":scope > details"); // Add the onclick listeners.
1096
525
 
1097
- details.forEach(function (targetDetail) {
1098
- targetDetail.addEventListener("click", function () {
526
+ details.forEach(targetDetail => {
527
+ targetDetail.addEventListener("click", () => {
1099
528
  // Close all the details that are not targetDetail.
1100
- details.forEach(function (detail) {
529
+ details.forEach(detail => {
1101
530
  if (detail !== targetDetail) {
1102
531
  detail.removeAttribute("open");
1103
532
  }
@@ -1195,7 +624,7 @@
1195
624
  var scrollLeft = carouselInner.scrollLeft;
1196
625
  var targetSlide = Math.round(scrollLeft / scrollWidth * itemCount) + 1;
1197
626
  var lastItemOffset = carouselElement.querySelector('.carousel__item:last-child').offsetLeft;
1198
- Array.from(carouselElement.querySelectorAll('.carousel__controls a')).forEach(function (link, index) {
627
+ Array.from(carouselElement.querySelectorAll('.carousel__controls a')).forEach((link, index) => {
1199
628
  link.classList.remove('active');
1200
629
  });
1201
630
  carouselElement.querySelector('.control-' + targetSlide).classList.add('active'); // Disable the previous button
@@ -1210,7 +639,7 @@
1210
639
  for (var target = e.target; target && target != this; target = target.parentNode) {
1211
640
  if (target.matches('.carousel__controls a')) {
1212
641
  e.preventDefault();
1213
- Array.from(carouselElement.querySelectorAll('.carousel__controls a')).forEach(function (link, index) {
642
+ Array.from(carouselElement.querySelectorAll('.carousel__controls a')).forEach((link, index) => {
1214
643
  link.classList.remove('active');
1215
644
  });
1216
645
  target.classList.add('active');
@@ -1251,17 +680,17 @@
1251
680
  var min = parseInt(inputWrapper.querySelector('[data-min] select,[data-min] input').value);
1252
681
  var max = parseInt(inputWrapper.querySelector('[data-max] select,[data-max] input').value); // Set attributes for input fields
1253
682
 
1254
- Array.from(inputWrapper.querySelectorAll('[data-min] input')).forEach(function (input, index) {
683
+ Array.from(inputWrapper.querySelectorAll('[data-min] input')).forEach((input, index) => {
1255
684
  input.setAttribute('max', max);
1256
685
  });
1257
- Array.from(inputWrapper.querySelectorAll('[data-max] input')).forEach(function (input, index) {
686
+ Array.from(inputWrapper.querySelectorAll('[data-max] input')).forEach((input, index) => {
1258
687
  input.setAttribute('min', min);
1259
688
  }); // Hide select options if they are higher or lower than the min and max values
1260
689
 
1261
- Array.from(inputWrapper.querySelectorAll('[data-min] select option')).forEach(function (option, index) {
690
+ Array.from(inputWrapper.querySelectorAll('[data-min] select option')).forEach((option, index) => {
1262
691
  if (parseInt(option.getAttribute('value')) > max) option.classList.add('d-none');else option.classList.remove('d-none');
1263
692
  });
1264
- Array.from(inputWrapper.querySelectorAll('[data-max] select option')).forEach(function (option, index) {
693
+ Array.from(inputWrapper.querySelectorAll('[data-max] select option')).forEach((option, index) => {
1265
694
  if (parseInt(option.getAttribute('value')) < min) option.classList.add('d-none');else option.classList.remove('d-none');
1266
695
  });
1267
696
  }, false);
@@ -1270,42 +699,171 @@
1270
699
 
1271
700
  function form(formElement) {
1272
701
  // Check for input range groups
1273
- Array.from(formElement.querySelectorAll('[data-input-range]')).forEach(function (arrayElement, index) {
702
+ Array.from(formElement.querySelectorAll('[data-input-range]')).forEach((arrayElement, index) => {
1274
703
  inputRange(arrayElement);
1275
704
  });
1276
705
  }
1277
706
 
707
+ /**
708
+ * Integrate YouTube videos as a way of hosting videos without the overhead and worry surrounding hosting vides. i.e. file sizes, performance and accessibility.
709
+ */
710
+ class youtubeVideo {
711
+ /** @param {HTMLElement} embed dom element */
712
+ constructor(embed) {
713
+ var createEmbed = this.createEmbed; // If the scripts is already loaded then lets just create the embed
714
+
715
+ if (document.body.classList.contains('youtubeLoaded')) {
716
+ embed.addEventListener('click', function (e) {
717
+ // loop parent nodes from the target to the delegation node
718
+ for (var target = e.target; target && target != this; target = target.parentNode) {
719
+ if (target.matches('a:not([data-modal-youtube]')) {
720
+ e.preventDefault();
721
+ createEmbed(embed, target);
722
+ break;
723
+ }
724
+ }
725
+ }, false);
726
+ } else {
727
+ this.loadScripts(embed, this.createEmbed);
728
+ }
729
+ }
730
+ /**
731
+ * Load the YouTube scripts before trying to create the embed
732
+ * @param {HTMLElement} embed dom element
733
+ * @param {Function} createEmbed function to create the embed after script loaded.
734
+ */
735
+
736
+
737
+ loadScripts(embed, createEmbed) {
738
+ return new Promise((resolve, reject) => {
739
+ var image = new Image();
740
+
741
+ image.onload = function () {
742
+ // This code loads the IFrame Player API code asynchronously.
743
+ var tag = document.createElement('script');
744
+ tag.src = "https://www.youtube.com/iframe_api";
745
+ var firstScriptTag = document.getElementsByTagName('script')[0];
746
+ firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
747
+ document.body.classList.add('youtubeLoaded');
748
+ resolve(true); // script has loaded, you can now use it safely
749
+
750
+ tag.onload = () => {
751
+ embed.addEventListener('click', function (e) {
752
+ // loop parent nodes from the target to the delegation node
753
+ for (var target = e.target; target && target != this; target = target.parentNode) {
754
+ if (target.matches('a:not([data-modal-youtube]')) {
755
+ e.preventDefault();
756
+ createEmbed(embed, target);
757
+ break;
758
+ }
759
+ }
760
+ }, false);
761
+ };
762
+ };
763
+
764
+ image.onerror = function () {
765
+ reject(false);
766
+ };
767
+
768
+ image.src = "https://youtube.com/favicon.ico";
769
+ });
770
+ }
771
+ /**
772
+ * Create the YouTube embed after the user has clicked on it.
773
+ * @param {HTMLElement} embed dom element
774
+ */
775
+
776
+
777
+ createEmbed(embed, target) {
778
+ // If there is more than one video lets make sure there is only one playing at a time.
779
+ if (typeof window.player != "undefined" && typeof window.player.pauseVideo == "function") window.player.pauseVideo();
780
+ var video_id = target.getAttribute('data-id');
781
+ var link_id = target.getAttribute('id'); // create an id to pass t the script if one isn't present
782
+
783
+ if (typeof link_id == 'undefined' || link_id == null) {
784
+ var randLetter = String.fromCharCode(65 + Math.floor(Math.random() * 26));
785
+ link_id = randLetter + Date.now();
786
+ target.setAttribute('id', link_id);
787
+ } // This function creates an <iframe> (and YouTube player) after the API code downloads.
788
+
789
+
790
+ function onYouTubeIframeAPIReady() {
791
+ window.player = new YT.Player(link_id, {
792
+ height: '100%',
793
+ width: '100%',
794
+ videoId: video_id,
795
+ playerVars: {
796
+ 'modestbranding': 1,
797
+ 'playsinline': 1,
798
+ 'rel': 0,
799
+ 'showinfo': 0
800
+ },
801
+ events: {
802
+ 'onReady': onPlayerReady,
803
+ 'onStateChange': onPlayerStateChange
804
+ }
805
+ });
806
+ }
807
+
808
+ onYouTubeIframeAPIReady(); // The API will call this function when the video player is ready.
809
+
810
+ function onPlayerReady(event) {
811
+ // Play the video straight away
812
+ event.target.playVideo();
813
+ } // The API calls this function when the player's state changes.
814
+ // The function indicates that when playing a video (state=1)
815
+
816
+
817
+ var done = false;
818
+
819
+ function onPlayerStateChange(event) {
820
+ if (event.data == YT.PlayerState.PLAYING && !done) {
821
+ var link = document.getElementById(link_id);
822
+ link.classList.add('player-ready');
823
+ done = true;
824
+ }
825
+ }
826
+ }
827
+
828
+ }
829
+
830
+ // Bootstrap modules
831
+
1278
832
  document.addEventListener("DOMContentLoaded", function () {
1279
833
  addBodyClasses(document.body);
1280
834
  checkElements(document.body);
1281
835
  console.log('test.js'); // ANav
1282
836
 
1283
- Array.from(document.querySelectorAll('.nav')).forEach(function (arrayElement, index) {
837
+ Array.from(document.querySelectorAll('.nav')).forEach((arrayElement, index) => {
1284
838
  navbar(arrayElement);
1285
839
  }); // Advanced tables
1286
840
 
1287
- Array.from(document.querySelectorAll('.table__wrapper')).forEach(function (arrayElement, index) {
841
+ Array.from(document.querySelectorAll('.table__wrapper')).forEach((arrayElement, index) => {
1288
842
  table(arrayElement);
1289
843
  }); // Accordions
1290
844
 
1291
- Array.from(document.querySelectorAll('.accordion')).forEach(function (arrayElement, index) {
845
+ Array.from(document.querySelectorAll('.accordion')).forEach((arrayElement, index) => {
1292
846
  accordion(arrayElement);
1293
847
  }); // Testimonial
1294
848
 
1295
- Array.from(document.querySelectorAll('.testimonial')).forEach(function (arrayElement, index) {
849
+ Array.from(document.querySelectorAll('.testimonial')).forEach((arrayElement, index) => {
1296
850
  testimonial(arrayElement);
1297
851
  }); // Carousel
1298
852
 
1299
- Array.from(document.querySelectorAll('.carousel')).forEach(function (arrayElement, index) {
853
+ Array.from(document.querySelectorAll('.carousel')).forEach((arrayElement, index) => {
1300
854
  carousel(arrayElement);
1301
855
  }); // Form
1302
856
 
1303
- Array.from(document.querySelectorAll('form')).forEach(function (arrayElement, index) {
857
+ Array.from(document.querySelectorAll('form')).forEach((arrayElement, index) => {
1304
858
  form(arrayElement);
1305
859
  }); // Modal
1306
860
 
1307
- Array.from(document.querySelectorAll('.modal')).forEach(function (arrayElement, index) {
861
+ Array.from(document.querySelectorAll('.modal')).forEach((arrayElement, index) => {
1308
862
  modal(arrayElement);
863
+ }); // YouTube videos
864
+
865
+ Array.from(document.querySelectorAll('.youtube-embed')).forEach((arrayElement, index) => {
866
+ new youtubeVideo(arrayElement);
1309
867
  });
1310
868
  });
1311
869