j1-template 2024.3.24 → 2024.3.25

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 (168) hide show
  1. checksums.yaml +4 -4
  2. data/assets/data/apps/amplitudehtml +1147 -0
  3. data/assets/data/apps/gallery.html +342 -0
  4. data/assets/data/{masonry.html → apps/masonry.html} +22 -9
  5. data/assets/data/apps/swiper.html +901 -0
  6. data/assets/data/masonry_app.html +521 -0
  7. data/assets/theme/j1/modules/lightGallery/css/theme/uno/uno.css +21 -13
  8. data/assets/theme/j1/modules/lightGallery/css/theme/uno/uno.min.css +1 -2
  9. data/assets/theme/j1/modules/lightGallery/js/lightgallery.js +14 -13
  10. data/assets/theme/j1/modules/lightGallery/js/lightgallery.min.js +1 -1
  11. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.js +265 -226
  12. data/assets/theme/j1/modules/lightGallery/js/plugins/lg-video.min.js +1 -1
  13. data/assets/theme/j1/modules/videojs/css/themes/uno.css +12 -2
  14. data/assets/theme/j1/modules/videojs/css/videojs.css +2 -3
  15. data/assets/theme/j1/modules/videojs/css/videojs.min.css +1 -1
  16. data/assets/theme/j1/modules/videojs/plugins/controls/zoom/css/zoom.css +55 -55
  17. data/assets/theme/j1/modules/videojs/plugins/controls/zoom/css/zoom.min.css +2 -1
  18. data/assets/theme/j1/modules/videojs/plugins/controls/zoom/js/zoom.js +590 -382
  19. data/assets/theme/j1/modules/videojs/plugins/controls/zoom/js/zoom.min.js +1 -1
  20. data/assets/theme/j1/modules/videojs/plugins/j1_core/template.min.js +31 -0
  21. data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/{simple.html → index.html} +11 -10
  22. data/assets/theme/j1/modules/videojs/plugins/players/dm/js/dailymotion.0.js +647 -0
  23. data/assets/theme/j1/modules/videojs/plugins/players/dm/js/dailymotion.1.js +653 -0
  24. data/assets/theme/j1/modules/videojs/plugins/players/vm/!examples/{player → iframe_api}/index.html +3 -3
  25. data/assets/theme/j1/modules/videojs/plugins/players/vm/!examples/{index.html → videojs_api/index.html} +7 -3
  26. data/assets/theme/j1/modules/videojs/plugins/players/vm/api/js/v2.21.0/vimeo.js +3562 -0
  27. data/assets/theme/j1/modules/videojs/plugins/players/vm/api/js/v2.21.0/vimeo.min.js +36 -0
  28. data/assets/theme/j1/modules/videojs/plugins/players/vm/api/js/vimeo.js +451 -1849
  29. data/assets/theme/j1/modules/videojs/plugins/players/vm/api/js/vimeo.min.js +2 -14
  30. data/assets/theme/j1/modules/videojs/plugins/players/vm/js/LICENSE +21 -0
  31. data/assets/theme/j1/modules/videojs/plugins/players/vm/js/README.md +54 -0
  32. data/assets/theme/j1/modules/videojs/plugins/players/vm/js/old/vimeo.js +666 -0
  33. data/assets/theme/j1/modules/videojs/plugins/players/vm/js/old/vimeo.min.js +28 -0
  34. data/assets/theme/j1/modules/videojs/plugins/players/vm/js/vimeo.js +2318 -548
  35. data/assets/theme/j1/modules/videojs/plugins/players/vm/js/vimeo.min.js +12 -18
  36. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/{simple.html → index.html} +15 -6
  37. data/assets/theme/j1/modules/videojs/plugins/players/yt/js/youtube.js +12 -5
  38. data/assets/theme/j1/modules/videojs/plugins/players/yt/js/youtube.min.js +1 -1
  39. data/lib/j1/version.rb +1 -1
  40. data/lib/starter_web/Gemfile +1 -1
  41. data/lib/starter_web/README.md +5 -5
  42. data/lib/starter_web/_config.yml +2 -2
  43. data/lib/starter_web/_data/blocks/banner.yml +1 -1
  44. data/lib/starter_web/_data/j1_config.yml +1 -1
  45. data/lib/starter_web/_data/layouts/home.yml +1 -1
  46. data/lib/starter_web/_data/modules/authentication.yml +1 -2
  47. data/lib/starter_web/_data/modules/defaults/masonry.yml +1 -1
  48. data/lib/starter_web/_data/modules/gallery.yml +35 -24
  49. data/lib/starter_web/_data/modules/log4javascript.yml +1 -1
  50. data/lib/starter_web/_data/modules/masonry.yml +30 -14
  51. data/lib/starter_web/_data/modules/navigator.yml +1 -1
  52. data/lib/starter_web/_data/modules/navigator_menu.yml +12 -8
  53. data/lib/starter_web/_data/templates/feed.xml +1 -1
  54. data/lib/starter_web/_plugins/asciidoctor/dailymotion-block.rb +206 -24
  55. data/lib/starter_web/_plugins/index/lunr.rb +1 -1
  56. data/lib/starter_web/assets/image/module/attic/1920x1280/admin-dashboard-bootstrap.jpg +0 -0
  57. data/lib/starter_web/assets/image/module/attic/1920x1280/alexander-redl.jpg +0 -0
  58. data/lib/starter_web/assets/image/module/attic/1920x1280/alexander-shatov.jpg +0 -0
  59. data/lib/starter_web/assets/image/module/attic/1920x1280/alexey-ruban.jpg +0 -0
  60. data/lib/starter_web/assets/image/module/attic/1920x1280/andrea-badino.jpg +0 -0
  61. data/lib/starter_web/assets/image/module/attic/1920x1280/bootstrap-modal.jpg +0 -0
  62. data/lib/starter_web/assets/image/module/attic/1920x1280/bp-miller.jpg +0 -0
  63. data/lib/starter_web/assets/image/module/attic/1920x1280/brad-neathery.jpg +0 -0
  64. data/lib/starter_web/assets/image/module/attic/1920x1280/brigitta-schneiter.jpg +0 -0
  65. data/lib/starter_web/assets/image/module/attic/1920x1280/build-with-gemini.jpg +0 -0
  66. data/lib/starter_web/assets/image/module/attic/1920x1280/clem-onojeghuo.jpg +0 -0
  67. data/lib/starter_web/assets/image/module/attic/1920x1280/eleni-afiontzi.jpg +0 -0
  68. data/lib/starter_web/assets/image/module/attic/1920x1280/fly-d.jpg +0 -0
  69. data/lib/starter_web/assets/image/module/attic/1920x1280/guillaume-bolduc.jpg +0 -0
  70. data/lib/starter_web/assets/image/module/attic/1920x1280/ideas-start-here-1920x1280.jpg +0 -0
  71. data/lib/starter_web/assets/image/module/attic/1920x1280/isaac-davis.jpg +0 -0
  72. data/lib/starter_web/assets/image/module/attic/1920x1280/j1-launch.jpg +0 -0
  73. data/lib/starter_web/assets/image/module/attic/1920x1280/j1-mockup.jpg +0 -0
  74. data/lib/starter_web/assets/image/module/attic/1920x1280/john-schnobrich-2.jpg +0 -0
  75. data/lib/starter_web/assets/image/module/attic/1920x1280/josep-martins.jpg +0 -0
  76. data/lib/starter_web/assets/image/module/attic/1920x1280/josh-liu.jpg +0 -0
  77. data/lib/starter_web/assets/image/module/attic/1920x1280/kelly-sikkemal.jpg +0 -0
  78. data/lib/starter_web/assets/image/module/attic/1920x1280/kira-auf-der-heide.jpg +0 -0
  79. data/lib/starter_web/assets/image/module/attic/1920x1280/kristopher-roller.jpg +0 -0
  80. data/lib/starter_web/assets/image/module/attic/1920x1280/markus-spiske.jpg +0 -0
  81. data/lib/starter_web/assets/image/module/attic/1920x1280/martin-sanchez.jpg +0 -0
  82. data/lib/starter_web/assets/image/module/attic/1920x1280/material_symbols.jpg +0 -0
  83. data/lib/starter_web/assets/image/module/attic/1920x1280/matthaeus.jpg +0 -0
  84. data/lib/starter_web/assets/image/module/attic/1920x1280/melanie-deziel.jpg +0 -0
  85. data/lib/starter_web/assets/image/module/attic/1920x1280/nasa.jpg +0 -0
  86. data/lib/starter_web/assets/image/module/attic/1920x1280/quino-al-2.jpg +0 -0
  87. data/lib/starter_web/assets/image/module/attic/1920x1280/stories-ink-tattoo-care.jpg +0 -0
  88. data/lib/starter_web/assets/image/module/attic/1920x1280/towfiqu-barbhuiya.jpg +0 -0
  89. data/lib/starter_web/collections/posts/public/featured/_posts/0000-00-00-welcome-to-j1.adoc.erb +1 -1
  90. data/lib/starter_web/collections/posts/public/featured/_posts/2022-02-01-about-j1.adoc +2 -2
  91. data/lib/starter_web/collections/posts/public/featured/_posts/2023-10-18-url-types.adoc +2 -2
  92. data/lib/starter_web/config.ru +1 -1
  93. data/lib/starter_web/dot.gitattributes +1 -1
  94. data/lib/starter_web/index.html +8 -8
  95. data/lib/starter_web/package.json +1 -1
  96. data/lib/starter_web/pages/public/about/features.adoc +5 -5
  97. data/lib/starter_web/pages/public/about/reporting_issues.adoc +5 -5
  98. data/lib/starter_web/pages/public/about/site.adoc +14 -10
  99. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/000_intro.adoc +1 -1
  100. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/100_converter.adoc +1 -1
  101. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/200_themes.adoc +1 -1
  102. data/lib/starter_web/pages/public/asciidoc_skeletons/documentation/documentation.adoc +1 -1
  103. data/lib/starter_web/pages/public/asciidoc_skeletons/multi-document/multi.adoc +1 -1
  104. data/lib/starter_web/pages/public/asciidoc_skeletons/simple-document/simple.adoc +1 -1
  105. data/lib/starter_web/pages/public/blog/navigator/archive/allview.html +1 -1
  106. data/lib/starter_web/pages/public/blog/navigator/archive/categoryview.html +1 -1
  107. data/lib/starter_web/pages/public/blog/navigator/archive/dateview.html +1 -1
  108. data/lib/starter_web/pages/public/blog/navigator/archive/tagview.html +1 -1
  109. data/lib/starter_web/pages/public/blog/navigator/index.html +1 -1
  110. data/lib/starter_web/pages/public/learn/bookshelf/article_previewer/viewer_biography.adoc +1 -1
  111. data/lib/starter_web/pages/public/learn/bookshelf/article_previewer/viewer_fantasy.adoc +1 -1
  112. data/lib/starter_web/pages/public/learn/bookshelf/article_previewer/viewer_romance.adoc +1 -1
  113. data/lib/starter_web/pages/public/learn/bookshelf/jekyll_collections.adoc +1 -1
  114. data/lib/starter_web/pages/public/learn/bookshelf/viewer_all_books.adoc +1 -1
  115. data/lib/starter_web/pages/public/learn/where_to_go.adoc +1 -1
  116. data/lib/starter_web/pages/public/legal/en/100_copyright.adoc +3 -3
  117. data/lib/starter_web/pages/public/legal/en/200_impress.adoc +3 -3
  118. data/lib/starter_web/pages/public/legal/en/300_privacy.adoc +3 -3
  119. data/lib/starter_web/pages/public/legal/en/400_comment_policy.adoc +3 -3
  120. data/lib/starter_web/pages/public/panels/intro_panel/panel.adoc +1 -4
  121. data/lib/starter_web/pages/public/plans/plans.adoc +1 -1
  122. data/lib/starter_web/pages/public/tools/previewer/preview_bootstrap_theme.adoc +1 -1
  123. data/lib/starter_web/pages/public/tools/tester/videojs_macro_tester.adoc +116 -43
  124. data/lib/starter_web/pages/public/tour/_includes/documents/419_advanced_modals_demo.asciidoc +1 -1
  125. data/lib/starter_web/pages/public/tour/video_data.adoc +28 -22
  126. metadata +25 -49
  127. data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/dailymotion-controls.html +0 -18
  128. data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/dailymotion-javascript.html +0 -28
  129. data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/dailymotion-playlist.html +0 -19
  130. data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/global-parameters.html +0 -30
  131. data/assets/theme/j1/modules/videojs/plugins/players/dm/!examples/switch.html +0 -39
  132. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/global-parameters.html +0 -34
  133. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/switch.html +0 -39
  134. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/youtube-controls.html +0 -20
  135. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/youtube-javascript.html +0 -29
  136. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/youtube-list.html +0 -21
  137. data/assets/theme/j1/modules/videojs/plugins/players/yt/!examples/youtube-playlist.html +0 -21
  138. data/lib/starter_web/assets/image/module/attic/1920x1280/j1-content-mockup-2.jpg +0 -0
  139. data/lib/starter_web/assets/image/module/attic/1920x1280/j1-content-mockup-3.jpg +0 -0
  140. data/lib/starter_web/assets/image/module/attic/1920x1280/j1-starter-mockup-1.jpg +0 -0
  141. data/lib/starter_web/assets/image/module/attic/admin-dashboard-bootstrap-1280x600.jpg +0 -0
  142. data/lib/starter_web/assets/image/module/attic/alice-donovan-rouse-2.jpg +0 -0
  143. data/lib/starter_web/assets/image/module/attic/building-blocks-1920x1280.jpg +0 -0
  144. data/lib/starter_web/assets/image/module/attic/christina-1920x1280.jpg +0 -0
  145. data/lib/starter_web/assets/image/module/attic/franck-1920x1280.jpg +0 -0
  146. data/lib/starter_web/assets/image/module/attic/giammarco-boscaro-1920x1280.jpg +0 -0
  147. data/lib/starter_web/assets/image/module/attic/jessica-ruscello-1920x1280.jpg +0 -0
  148. data/lib/starter_web/assets/image/module/attic/joanna-kosinska-1920x1280.jpg +0 -0
  149. data/lib/starter_web/assets/image/module/attic/leon-1920x1280.jpg +0 -0
  150. data/lib/starter_web/assets/image/module/attic/lianhao-1920x1280.jpg +0 -0
  151. data/lib/starter_web/assets/image/module/attic/library-1920x1280.jpg +0 -0
  152. data/lib/starter_web/assets/image/module/attic/markus-krisetya-1920x1280.jpg +0 -0
  153. data/lib/starter_web/assets/image/module/attic/markus-spiske-1920x1280.jpg +0 -0
  154. data/lib/starter_web/assets/image/module/attic/markus-spiske4-1920x1280.jpg +0 -0
  155. data/lib/starter_web/assets/image/module/attic/matthaeus-1920x1280.jpg +0 -0
  156. data/lib/starter_web/assets/image/module/attic/matthew-dockery-1920x1280.jpg +0 -0
  157. data/lib/starter_web/assets/image/module/attic/no-time-1920x1280.jpg +0 -0
  158. data/lib/starter_web/assets/image/module/attic/rirri-1920x1280.jpg +0 -0
  159. data/lib/starter_web/assets/image/module/attic/shubham-dhage-1920x1280.jpg +0 -0
  160. data/lib/starter_web/assets/image/module/attic/shutterstock_sponsor-1920x1280.jpg +0 -0
  161. data/lib/starter_web/assets/image/module/attic/sigmund-1920x1280.jpg +0 -0
  162. data/lib/starter_web/assets/image/module/attic/szabo-viktor-1920x1280.jpg +0 -0
  163. data/lib/starter_web/assets/image/module/attic/themes-1920x1280-bw.jpg +0 -0
  164. data/lib/starter_web/assets/image/module/attic/tldr-1920x800.jpg +0 -0
  165. data/lib/starter_web/assets/image/module/attic/vladislav-klapin-1920x1280.jpg +0 -0
  166. data/lib/starter_web/assets/image/module/attic/yellow-cactus-1920x1280.jpg +0 -0
  167. /data/assets/theme/j1/modules/videojs/plugins/players/vm/{LICENSE → js/old/LICENSE} +0 -0
  168. /data/assets/theme/j1/modules/videojs/plugins/players/vm/{README.md → js/old/README.md} +0 -0
@@ -0,0 +1,3562 @@
1
+ /*
2
+ # -----------------------------------------------------------------------------
3
+ # ~/assets/theme/j1/modules/videojs/plugins/players/vm/api/js/vimeo.js
4
+ # Vimeo Player API (modified version)
5
+ #
6
+ # Product/Info:
7
+ # https://jekyll.one
8
+ # https://github.com/vimeo/player.js
9
+ #
10
+ # Copyright (C) Vimeo 2024
11
+ # Copyright (C) 2023-2025 Juergen Adams
12
+ #
13
+ # J1 Theme is licensed under MIT License.
14
+ # See: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE
15
+ # -----------------------------------------------------------------------------
16
+ # NOTE:
17
+ # Namespace changed from "Vimeo" to "VM" to not conflict with the
18
+ # namespace used by the VideoJS plugin which is "Vimeo" as well.
19
+ # -----------------------------------------------------------------------------
20
+ */
21
+
22
+ /*! @vimeo/player v2.21.0 | (c) 2024 Vimeo | MIT License | https://github.com/vimeo/player.js */
23
+
24
+ (function (global, factory) {
25
+ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
26
+ typeof define === 'function' && define.amd ? define(factory) :
27
+ (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.VM = global.VM || {}, global.VM.Player = factory()));
28
+ }(this, (function () { 'use strict';
29
+
30
+ function ownKeys(object, enumerableOnly) {
31
+ var keys = Object.keys(object);
32
+ if (Object.getOwnPropertySymbols) {
33
+ var symbols = Object.getOwnPropertySymbols(object);
34
+ enumerableOnly && (symbols = symbols.filter(function (sym) {
35
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
36
+ })), keys.push.apply(keys, symbols);
37
+ }
38
+ return keys;
39
+ }
40
+ function _objectSpread2(target) {
41
+ for (var i = 1; i < arguments.length; i++) {
42
+ var source = null != arguments[i] ? arguments[i] : {};
43
+ i % 2 ? ownKeys(Object(source), !0).forEach(function (key) {
44
+ _defineProperty(target, key, source[key]);
45
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) {
46
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
47
+ });
48
+ }
49
+ return target;
50
+ }
51
+ function _regeneratorRuntime() {
52
+ _regeneratorRuntime = function () {
53
+ return exports;
54
+ };
55
+ var exports = {},
56
+ Op = Object.prototype,
57
+ hasOwn = Op.hasOwnProperty,
58
+ defineProperty = Object.defineProperty || function (obj, key, desc) {
59
+ obj[key] = desc.value;
60
+ },
61
+ $Symbol = "function" == typeof Symbol ? Symbol : {},
62
+ iteratorSymbol = $Symbol.iterator || "@@iterator",
63
+ asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator",
64
+ toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
65
+ function define(obj, key, value) {
66
+ return Object.defineProperty(obj, key, {
67
+ value: value,
68
+ enumerable: !0,
69
+ configurable: !0,
70
+ writable: !0
71
+ }), obj[key];
72
+ }
73
+ try {
74
+ define({}, "");
75
+ } catch (err) {
76
+ define = function (obj, key, value) {
77
+ return obj[key] = value;
78
+ };
79
+ }
80
+ function wrap(innerFn, outerFn, self, tryLocsList) {
81
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator,
82
+ generator = Object.create(protoGenerator.prototype),
83
+ context = new Context(tryLocsList || []);
84
+ return defineProperty(generator, "_invoke", {
85
+ value: makeInvokeMethod(innerFn, self, context)
86
+ }), generator;
87
+ }
88
+ function tryCatch(fn, obj, arg) {
89
+ try {
90
+ return {
91
+ type: "normal",
92
+ arg: fn.call(obj, arg)
93
+ };
94
+ } catch (err) {
95
+ return {
96
+ type: "throw",
97
+ arg: err
98
+ };
99
+ }
100
+ }
101
+ exports.wrap = wrap;
102
+ var ContinueSentinel = {};
103
+ function Generator() {}
104
+ function GeneratorFunction() {}
105
+ function GeneratorFunctionPrototype() {}
106
+ var IteratorPrototype = {};
107
+ define(IteratorPrototype, iteratorSymbol, function () {
108
+ return this;
109
+ });
110
+ var getProto = Object.getPrototypeOf,
111
+ NativeIteratorPrototype = getProto && getProto(getProto(values([])));
112
+ NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
113
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
114
+ function defineIteratorMethods(prototype) {
115
+ ["next", "throw", "return"].forEach(function (method) {
116
+ define(prototype, method, function (arg) {
117
+ return this._invoke(method, arg);
118
+ });
119
+ });
120
+ }
121
+ function AsyncIterator(generator, PromiseImpl) {
122
+ function invoke(method, arg, resolve, reject) {
123
+ var record = tryCatch(generator[method], generator, arg);
124
+ if ("throw" !== record.type) {
125
+ var result = record.arg,
126
+ value = result.value;
127
+ return value && "object" == typeof value && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) {
128
+ invoke("next", value, resolve, reject);
129
+ }, function (err) {
130
+ invoke("throw", err, resolve, reject);
131
+ }) : PromiseImpl.resolve(value).then(function (unwrapped) {
132
+ result.value = unwrapped, resolve(result);
133
+ }, function (error) {
134
+ return invoke("throw", error, resolve, reject);
135
+ });
136
+ }
137
+ reject(record.arg);
138
+ }
139
+ var previousPromise;
140
+ defineProperty(this, "_invoke", {
141
+ value: function (method, arg) {
142
+ function callInvokeWithMethodAndArg() {
143
+ return new PromiseImpl(function (resolve, reject) {
144
+ invoke(method, arg, resolve, reject);
145
+ });
146
+ }
147
+ return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
148
+ }
149
+ });
150
+ }
151
+ function makeInvokeMethod(innerFn, self, context) {
152
+ var state = "suspendedStart";
153
+ return function (method, arg) {
154
+ if ("executing" === state) throw new Error("Generator is already running");
155
+ if ("completed" === state) {
156
+ if ("throw" === method) throw arg;
157
+ return doneResult();
158
+ }
159
+ for (context.method = method, context.arg = arg;;) {
160
+ var delegate = context.delegate;
161
+ if (delegate) {
162
+ var delegateResult = maybeInvokeDelegate(delegate, context);
163
+ if (delegateResult) {
164
+ if (delegateResult === ContinueSentinel) continue;
165
+ return delegateResult;
166
+ }
167
+ }
168
+ if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) {
169
+ if ("suspendedStart" === state) throw state = "completed", context.arg;
170
+ context.dispatchException(context.arg);
171
+ } else "return" === context.method && context.abrupt("return", context.arg);
172
+ state = "executing";
173
+ var record = tryCatch(innerFn, self, context);
174
+ if ("normal" === record.type) {
175
+ if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue;
176
+ return {
177
+ value: record.arg,
178
+ done: context.done
179
+ };
180
+ }
181
+ "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg);
182
+ }
183
+ };
184
+ }
185
+ function maybeInvokeDelegate(delegate, context) {
186
+ var methodName = context.method,
187
+ method = delegate.iterator[methodName];
188
+ 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;
189
+ var record = tryCatch(method, delegate.iterator, context.arg);
190
+ if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
191
+ var info = record.arg;
192
+ 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);
193
+ }
194
+ function pushTryEntry(locs) {
195
+ var entry = {
196
+ tryLoc: locs[0]
197
+ };
198
+ 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
199
+ }
200
+ function resetTryEntry(entry) {
201
+ var record = entry.completion || {};
202
+ record.type = "normal", delete record.arg, entry.completion = record;
203
+ }
204
+ function Context(tryLocsList) {
205
+ this.tryEntries = [{
206
+ tryLoc: "root"
207
+ }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0);
208
+ }
209
+ function values(iterable) {
210
+ if (iterable) {
211
+ var iteratorMethod = iterable[iteratorSymbol];
212
+ if (iteratorMethod) return iteratorMethod.call(iterable);
213
+ if ("function" == typeof iterable.next) return iterable;
214
+ if (!isNaN(iterable.length)) {
215
+ var i = -1,
216
+ next = function next() {
217
+ for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next;
218
+ return next.value = undefined, next.done = !0, next;
219
+ };
220
+ return next.next = next;
221
+ }
222
+ }
223
+ return {
224
+ next: doneResult
225
+ };
226
+ }
227
+ function doneResult() {
228
+ return {
229
+ value: undefined,
230
+ done: !0
231
+ };
232
+ }
233
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", {
234
+ value: GeneratorFunctionPrototype,
235
+ configurable: !0
236
+ }), defineProperty(GeneratorFunctionPrototype, "constructor", {
237
+ value: GeneratorFunction,
238
+ configurable: !0
239
+ }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) {
240
+ var ctor = "function" == typeof genFun && genFun.constructor;
241
+ return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
242
+ }, exports.mark = function (genFun) {
243
+ return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
244
+ }, exports.awrap = function (arg) {
245
+ return {
246
+ __await: arg
247
+ };
248
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () {
249
+ return this;
250
+ }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) {
251
+ void 0 === PromiseImpl && (PromiseImpl = Promise);
252
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
253
+ return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) {
254
+ return result.done ? result.value : iter.next();
255
+ });
256
+ }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () {
257
+ return this;
258
+ }), define(Gp, "toString", function () {
259
+ return "[object Generator]";
260
+ }), exports.keys = function (val) {
261
+ var object = Object(val),
262
+ keys = [];
263
+ for (var key in object) keys.push(key);
264
+ return keys.reverse(), function next() {
265
+ for (; keys.length;) {
266
+ var key = keys.pop();
267
+ if (key in object) return next.value = key, next.done = !1, next;
268
+ }
269
+ return next.done = !0, next;
270
+ };
271
+ }, exports.values = values, Context.prototype = {
272
+ constructor: Context,
273
+ reset: function (skipTempReset) {
274
+ 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);
275
+ },
276
+ stop: function () {
277
+ this.done = !0;
278
+ var rootRecord = this.tryEntries[0].completion;
279
+ if ("throw" === rootRecord.type) throw rootRecord.arg;
280
+ return this.rval;
281
+ },
282
+ dispatchException: function (exception) {
283
+ if (this.done) throw exception;
284
+ var context = this;
285
+ function handle(loc, caught) {
286
+ return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught;
287
+ }
288
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
289
+ var entry = this.tryEntries[i],
290
+ record = entry.completion;
291
+ if ("root" === entry.tryLoc) return handle("end");
292
+ if (entry.tryLoc <= this.prev) {
293
+ var hasCatch = hasOwn.call(entry, "catchLoc"),
294
+ hasFinally = hasOwn.call(entry, "finallyLoc");
295
+ if (hasCatch && hasFinally) {
296
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
297
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
298
+ } else if (hasCatch) {
299
+ if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0);
300
+ } else {
301
+ if (!hasFinally) throw new Error("try statement without catch or finally");
302
+ if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc);
303
+ }
304
+ }
305
+ }
306
+ },
307
+ abrupt: function (type, arg) {
308
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
309
+ var entry = this.tryEntries[i];
310
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
311
+ var finallyEntry = entry;
312
+ break;
313
+ }
314
+ }
315
+ finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
316
+ var record = finallyEntry ? finallyEntry.completion : {};
317
+ return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
318
+ },
319
+ complete: function (record, afterLoc) {
320
+ if ("throw" === record.type) throw record.arg;
321
+ 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;
322
+ },
323
+ finish: function (finallyLoc) {
324
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
325
+ var entry = this.tryEntries[i];
326
+ if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
327
+ }
328
+ },
329
+ catch: function (tryLoc) {
330
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
331
+ var entry = this.tryEntries[i];
332
+ if (entry.tryLoc === tryLoc) {
333
+ var record = entry.completion;
334
+ if ("throw" === record.type) {
335
+ var thrown = record.arg;
336
+ resetTryEntry(entry);
337
+ }
338
+ return thrown;
339
+ }
340
+ }
341
+ throw new Error("illegal catch attempt");
342
+ },
343
+ delegateYield: function (iterable, resultName, nextLoc) {
344
+ return this.delegate = {
345
+ iterator: values(iterable),
346
+ resultName: resultName,
347
+ nextLoc: nextLoc
348
+ }, "next" === this.method && (this.arg = undefined), ContinueSentinel;
349
+ }
350
+ }, exports;
351
+ }
352
+ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
353
+ try {
354
+ var info = gen[key](arg);
355
+ var value = info.value;
356
+ } catch (error) {
357
+ reject(error);
358
+ return;
359
+ }
360
+ if (info.done) {
361
+ resolve(value);
362
+ } else {
363
+ Promise.resolve(value).then(_next, _throw);
364
+ }
365
+ }
366
+ function _asyncToGenerator(fn) {
367
+ return function () {
368
+ var self = this,
369
+ args = arguments;
370
+ return new Promise(function (resolve, reject) {
371
+ var gen = fn.apply(self, args);
372
+ function _next(value) {
373
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
374
+ }
375
+ function _throw(err) {
376
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
377
+ }
378
+ _next(undefined);
379
+ });
380
+ };
381
+ }
382
+ function _classCallCheck(instance, Constructor) {
383
+ if (!(instance instanceof Constructor)) {
384
+ throw new TypeError("Cannot call a class as a function");
385
+ }
386
+ }
387
+ function _defineProperties(target, props) {
388
+ for (var i = 0; i < props.length; i++) {
389
+ var descriptor = props[i];
390
+ descriptor.enumerable = descriptor.enumerable || false;
391
+ descriptor.configurable = true;
392
+ if ("value" in descriptor) descriptor.writable = true;
393
+ Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);
394
+ }
395
+ }
396
+ function _createClass(Constructor, protoProps, staticProps) {
397
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
398
+ if (staticProps) _defineProperties(Constructor, staticProps);
399
+ Object.defineProperty(Constructor, "prototype", {
400
+ writable: false
401
+ });
402
+ return Constructor;
403
+ }
404
+ function _defineProperty(obj, key, value) {
405
+ key = _toPropertyKey(key);
406
+ if (key in obj) {
407
+ Object.defineProperty(obj, key, {
408
+ value: value,
409
+ enumerable: true,
410
+ configurable: true,
411
+ writable: true
412
+ });
413
+ } else {
414
+ obj[key] = value;
415
+ }
416
+ return obj;
417
+ }
418
+ function _inherits(subClass, superClass) {
419
+ if (typeof superClass !== "function" && superClass !== null) {
420
+ throw new TypeError("Super expression must either be null or a function");
421
+ }
422
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
423
+ constructor: {
424
+ value: subClass,
425
+ writable: true,
426
+ configurable: true
427
+ }
428
+ });
429
+ Object.defineProperty(subClass, "prototype", {
430
+ writable: false
431
+ });
432
+ if (superClass) _setPrototypeOf(subClass, superClass);
433
+ }
434
+ function _getPrototypeOf(o) {
435
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) {
436
+ return o.__proto__ || Object.getPrototypeOf(o);
437
+ };
438
+ return _getPrototypeOf(o);
439
+ }
440
+ function _setPrototypeOf(o, p) {
441
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
442
+ o.__proto__ = p;
443
+ return o;
444
+ };
445
+ return _setPrototypeOf(o, p);
446
+ }
447
+ function _isNativeReflectConstruct() {
448
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
449
+ if (Reflect.construct.sham) return false;
450
+ if (typeof Proxy === "function") return true;
451
+ try {
452
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {}));
453
+ return true;
454
+ } catch (e) {
455
+ return false;
456
+ }
457
+ }
458
+ function _construct(Parent, args, Class) {
459
+ if (_isNativeReflectConstruct()) {
460
+ _construct = Reflect.construct.bind();
461
+ } else {
462
+ _construct = function _construct(Parent, args, Class) {
463
+ var a = [null];
464
+ a.push.apply(a, args);
465
+ var Constructor = Function.bind.apply(Parent, a);
466
+ var instance = new Constructor();
467
+ if (Class) _setPrototypeOf(instance, Class.prototype);
468
+ return instance;
469
+ };
470
+ }
471
+ return _construct.apply(null, arguments);
472
+ }
473
+ function _isNativeFunction(fn) {
474
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
475
+ }
476
+ function _wrapNativeSuper(Class) {
477
+ var _cache = typeof Map === "function" ? new Map() : undefined;
478
+ _wrapNativeSuper = function _wrapNativeSuper(Class) {
479
+ if (Class === null || !_isNativeFunction(Class)) return Class;
480
+ if (typeof Class !== "function") {
481
+ throw new TypeError("Super expression must either be null or a function");
482
+ }
483
+ if (typeof _cache !== "undefined") {
484
+ if (_cache.has(Class)) return _cache.get(Class);
485
+ _cache.set(Class, Wrapper);
486
+ }
487
+ function Wrapper() {
488
+ return _construct(Class, arguments, _getPrototypeOf(this).constructor);
489
+ }
490
+ Wrapper.prototype = Object.create(Class.prototype, {
491
+ constructor: {
492
+ value: Wrapper,
493
+ enumerable: false,
494
+ writable: true,
495
+ configurable: true
496
+ }
497
+ });
498
+ return _setPrototypeOf(Wrapper, Class);
499
+ };
500
+ return _wrapNativeSuper(Class);
501
+ }
502
+ function _assertThisInitialized(self) {
503
+ if (self === void 0) {
504
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
505
+ }
506
+ return self;
507
+ }
508
+ function _possibleConstructorReturn(self, call) {
509
+ if (call && (typeof call === "object" || typeof call === "function")) {
510
+ return call;
511
+ } else if (call !== void 0) {
512
+ throw new TypeError("Derived constructors may only return object or undefined");
513
+ }
514
+ return _assertThisInitialized(self);
515
+ }
516
+ function _createSuper(Derived) {
517
+ var hasNativeReflectConstruct = _isNativeReflectConstruct();
518
+ return function _createSuperInternal() {
519
+ var Super = _getPrototypeOf(Derived),
520
+ result;
521
+ if (hasNativeReflectConstruct) {
522
+ var NewTarget = _getPrototypeOf(this).constructor;
523
+ result = Reflect.construct(Super, arguments, NewTarget);
524
+ } else {
525
+ result = Super.apply(this, arguments);
526
+ }
527
+ return _possibleConstructorReturn(this, result);
528
+ };
529
+ }
530
+ function _toPrimitive(input, hint) {
531
+ if (typeof input !== "object" || input === null) return input;
532
+ var prim = input[Symbol.toPrimitive];
533
+ if (prim !== undefined) {
534
+ var res = prim.call(input, hint || "default");
535
+ if (typeof res !== "object") return res;
536
+ throw new TypeError("@@toPrimitive must return a primitive value.");
537
+ }
538
+ return (hint === "string" ? String : Number)(input);
539
+ }
540
+ function _toPropertyKey(arg) {
541
+ var key = _toPrimitive(arg, "string");
542
+ return typeof key === "symbol" ? key : String(key);
543
+ }
544
+
545
+ /**
546
+ * @module lib/functions
547
+ */
548
+
549
+ /**
550
+ * Check to see this is a node environment.
551
+ * @type {Boolean}
552
+ */
553
+ /* global global */
554
+ var isNode = typeof global !== 'undefined' && {}.toString.call(global) === '[object global]';
555
+
556
+ /**
557
+ * Get the name of the method for a given getter or setter.
558
+ *
559
+ * @param {string} prop The name of the property.
560
+ * @param {string} type Either “get” or “set”.
561
+ * @return {string}
562
+ */
563
+ function getMethodName(prop, type) {
564
+ if (prop.indexOf(type.toLowerCase()) === 0) {
565
+ return prop;
566
+ }
567
+ return "".concat(type.toLowerCase()).concat(prop.substr(0, 1).toUpperCase()).concat(prop.substr(1));
568
+ }
569
+
570
+ /**
571
+ * Check to see if the object is a DOM Element.
572
+ *
573
+ * @param {*} element The object to check.
574
+ * @return {boolean}
575
+ */
576
+ function isDomElement(element) {
577
+ return Boolean(element && element.nodeType === 1 && 'nodeName' in element && element.ownerDocument && element.ownerDocument.defaultView);
578
+ }
579
+
580
+ /**
581
+ * Check to see whether the value is a number.
582
+ *
583
+ * @see http://dl.dropboxusercontent.com/u/35146/js/tests/isNumber.html
584
+ * @param {*} value The value to check.
585
+ * @param {boolean} integer Check if the value is an integer.
586
+ * @return {boolean}
587
+ */
588
+ function isInteger(value) {
589
+ // eslint-disable-next-line eqeqeq
590
+ return !isNaN(parseFloat(value)) && isFinite(value) && Math.floor(value) == value;
591
+ }
592
+
593
+ /**
594
+ * Check to see if the URL is a Vimeo url.
595
+ *
596
+ * @param {string} url The url string.
597
+ * @return {boolean}
598
+ */
599
+ function isVimeoUrl(url) {
600
+ return /^(https?:)?\/\/((player|www)\.)?vimeo\.com(?=$|\/)/.test(url);
601
+ }
602
+
603
+ /**
604
+ * Check to see if the URL is for a Vimeo embed.
605
+ *
606
+ * @param {string} url The url string.
607
+ * @return {boolean}
608
+ */
609
+ function isVimeoEmbed(url) {
610
+ var expr = /^https:\/\/player\.vimeo\.com\/video\/\d+/;
611
+ return expr.test(url);
612
+ }
613
+
614
+ /**
615
+ * Get the Vimeo URL from an element.
616
+ * The element must have either a data-vimeo-id or data-vimeo-url attribute.
617
+ *
618
+ * @param {object} oEmbedParameters The oEmbed parameters.
619
+ * @return {string}
620
+ */
621
+ function getVimeoUrl() {
622
+ var oEmbedParameters = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
623
+ var id = oEmbedParameters.id;
624
+ var url = oEmbedParameters.url;
625
+ var idOrUrl = id || url;
626
+ if (!idOrUrl) {
627
+ 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.');
628
+ }
629
+ if (isInteger(idOrUrl)) {
630
+ return "https://vimeo.com/".concat(idOrUrl);
631
+ }
632
+ if (isVimeoUrl(idOrUrl)) {
633
+ return idOrUrl.replace('http:', 'https:');
634
+ }
635
+ if (id) {
636
+ throw new TypeError("\u201C".concat(id, "\u201D is not a valid video id."));
637
+ }
638
+ throw new TypeError("\u201C".concat(idOrUrl, "\u201D is not a vimeo.com url."));
639
+ }
640
+
641
+ /* eslint-disable max-params */
642
+ /**
643
+ * A utility method for attaching and detaching event handlers
644
+ *
645
+ * @param {EventTarget} target
646
+ * @param {string | string[]} eventName
647
+ * @param {function} callback
648
+ * @param {'addEventListener' | 'on'} onName
649
+ * @param {'removeEventListener' | 'off'} offName
650
+ * @return {{cancel: (function(): void)}}
651
+ */
652
+ var subscribe = function subscribe(target, eventName, callback) {
653
+ var onName = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'addEventListener';
654
+ var offName = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 'removeEventListener';
655
+ var eventNames = typeof eventName === 'string' ? [eventName] : eventName;
656
+ eventNames.forEach(function (evName) {
657
+ target[onName](evName, callback);
658
+ });
659
+ return {
660
+ cancel: function cancel() {
661
+ return eventNames.forEach(function (evName) {
662
+ return target[offName](evName, callback);
663
+ });
664
+ }
665
+ };
666
+ };
667
+
668
+ var arrayIndexOfSupport = typeof Array.prototype.indexOf !== 'undefined';
669
+ var postMessageSupport = typeof window !== 'undefined' && typeof window.postMessage !== 'undefined';
670
+ if (!isNode && (!arrayIndexOfSupport || !postMessageSupport)) {
671
+ throw new Error('Sorry, the Vimeo Player API is not available in this browser.');
672
+ }
673
+
674
+ var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
675
+
676
+ function createCommonjsModule(fn, module) {
677
+ return module = { exports: {} }, fn(module, module.exports), module.exports;
678
+ }
679
+
680
+ /*!
681
+ * weakmap-polyfill v2.0.4 - ECMAScript6 WeakMap polyfill
682
+ * https://github.com/polygonplanet/weakmap-polyfill
683
+ * Copyright (c) 2015-2021 polygonplanet <polygon.planet.aqua@gmail.com>
684
+ * @license MIT
685
+ */
686
+
687
+ (function (self) {
688
+
689
+ if (self.WeakMap) {
690
+ return;
691
+ }
692
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
693
+ var hasDefine = Object.defineProperty && function () {
694
+ try {
695
+ // Avoid IE8's broken Object.defineProperty
696
+ return Object.defineProperty({}, 'x', {
697
+ value: 1
698
+ }).x === 1;
699
+ } catch (e) {}
700
+ }();
701
+ var defineProperty = function (object, name, value) {
702
+ if (hasDefine) {
703
+ Object.defineProperty(object, name, {
704
+ configurable: true,
705
+ writable: true,
706
+ value: value
707
+ });
708
+ } else {
709
+ object[name] = value;
710
+ }
711
+ };
712
+ self.WeakMap = function () {
713
+ // ECMA-262 23.3 WeakMap Objects
714
+ function WeakMap() {
715
+ if (this === void 0) {
716
+ throw new TypeError("Constructor WeakMap requires 'new'");
717
+ }
718
+ defineProperty(this, '_id', genId('_WeakMap'));
719
+
720
+ // ECMA-262 23.3.1.1 WeakMap([iterable])
721
+ if (arguments.length > 0) {
722
+ // Currently, WeakMap `iterable` argument is not supported
723
+ throw new TypeError('WeakMap iterable is not supported');
724
+ }
725
+ }
726
+
727
+ // ECMA-262 23.3.3.2 WeakMap.prototype.delete(key)
728
+ defineProperty(WeakMap.prototype, 'delete', function (key) {
729
+ checkInstance(this, 'delete');
730
+ if (!isObject(key)) {
731
+ return false;
732
+ }
733
+ var entry = key[this._id];
734
+ if (entry && entry[0] === key) {
735
+ delete key[this._id];
736
+ return true;
737
+ }
738
+ return false;
739
+ });
740
+
741
+ // ECMA-262 23.3.3.3 WeakMap.prototype.get(key)
742
+ defineProperty(WeakMap.prototype, 'get', function (key) {
743
+ checkInstance(this, 'get');
744
+ if (!isObject(key)) {
745
+ return void 0;
746
+ }
747
+ var entry = key[this._id];
748
+ if (entry && entry[0] === key) {
749
+ return entry[1];
750
+ }
751
+ return void 0;
752
+ });
753
+
754
+ // ECMA-262 23.3.3.4 WeakMap.prototype.has(key)
755
+ defineProperty(WeakMap.prototype, 'has', function (key) {
756
+ checkInstance(this, 'has');
757
+ if (!isObject(key)) {
758
+ return false;
759
+ }
760
+ var entry = key[this._id];
761
+ if (entry && entry[0] === key) {
762
+ return true;
763
+ }
764
+ return false;
765
+ });
766
+
767
+ // ECMA-262 23.3.3.5 WeakMap.prototype.set(key, value)
768
+ defineProperty(WeakMap.prototype, 'set', function (key, value) {
769
+ checkInstance(this, 'set');
770
+ if (!isObject(key)) {
771
+ throw new TypeError('Invalid value used as weak map key');
772
+ }
773
+ var entry = key[this._id];
774
+ if (entry && entry[0] === key) {
775
+ entry[1] = value;
776
+ return this;
777
+ }
778
+ defineProperty(key, this._id, [key, value]);
779
+ return this;
780
+ });
781
+ function checkInstance(x, methodName) {
782
+ if (!isObject(x) || !hasOwnProperty.call(x, '_id')) {
783
+ throw new TypeError(methodName + ' method called on incompatible receiver ' + typeof x);
784
+ }
785
+ }
786
+ function genId(prefix) {
787
+ return prefix + '_' + rand() + '.' + rand();
788
+ }
789
+ function rand() {
790
+ return Math.random().toString().substring(2);
791
+ }
792
+ defineProperty(WeakMap, '_polyfill', true);
793
+ return WeakMap;
794
+ }();
795
+ function isObject(x) {
796
+ return Object(x) === x;
797
+ }
798
+ })(typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : typeof commonjsGlobal !== 'undefined' ? commonjsGlobal : commonjsGlobal);
799
+
800
+ var npo_src = createCommonjsModule(function (module) {
801
+ /*! Native Promise Only
802
+ v0.8.1 (c) Kyle Simpson
803
+ MIT License: http://getify.mit-license.org
804
+ */
805
+
806
+ (function UMD(name, context, definition) {
807
+ // special form of UMD for polyfilling across evironments
808
+ context[name] = context[name] || definition();
809
+ if ( module.exports) {
810
+ module.exports = context[name];
811
+ }
812
+ })("Promise", typeof commonjsGlobal != "undefined" ? commonjsGlobal : commonjsGlobal, function DEF() {
813
+
814
+ var builtInProp,
815
+ cycle,
816
+ scheduling_queue,
817
+ ToString = Object.prototype.toString,
818
+ timer = typeof setImmediate != "undefined" ? function timer(fn) {
819
+ return setImmediate(fn);
820
+ } : setTimeout;
821
+
822
+ // dammit, IE8.
823
+ try {
824
+ Object.defineProperty({}, "x", {});
825
+ builtInProp = function builtInProp(obj, name, val, config) {
826
+ return Object.defineProperty(obj, name, {
827
+ value: val,
828
+ writable: true,
829
+ configurable: config !== false
830
+ });
831
+ };
832
+ } catch (err) {
833
+ builtInProp = function builtInProp(obj, name, val) {
834
+ obj[name] = val;
835
+ return obj;
836
+ };
837
+ }
838
+
839
+ // Note: using a queue instead of array for efficiency
840
+ scheduling_queue = function Queue() {
841
+ var first, last, item;
842
+ function Item(fn, self) {
843
+ this.fn = fn;
844
+ this.self = self;
845
+ this.next = void 0;
846
+ }
847
+ return {
848
+ add: function add(fn, self) {
849
+ item = new Item(fn, self);
850
+ if (last) {
851
+ last.next = item;
852
+ } else {
853
+ first = item;
854
+ }
855
+ last = item;
856
+ item = void 0;
857
+ },
858
+ drain: function drain() {
859
+ var f = first;
860
+ first = last = cycle = void 0;
861
+ while (f) {
862
+ f.fn.call(f.self);
863
+ f = f.next;
864
+ }
865
+ }
866
+ };
867
+ }();
868
+ function schedule(fn, self) {
869
+ scheduling_queue.add(fn, self);
870
+ if (!cycle) {
871
+ cycle = timer(scheduling_queue.drain);
872
+ }
873
+ }
874
+
875
+ // promise duck typing
876
+ function isThenable(o) {
877
+ var _then,
878
+ o_type = typeof o;
879
+ if (o != null && (o_type == "object" || o_type == "function")) {
880
+ _then = o.then;
881
+ }
882
+ return typeof _then == "function" ? _then : false;
883
+ }
884
+ function notify() {
885
+ for (var i = 0; i < this.chain.length; i++) {
886
+ notifyIsolated(this, this.state === 1 ? this.chain[i].success : this.chain[i].failure, this.chain[i]);
887
+ }
888
+ this.chain.length = 0;
889
+ }
890
+
891
+ // NOTE: This is a separate function to isolate
892
+ // the `try..catch` so that other code can be
893
+ // optimized better
894
+ function notifyIsolated(self, cb, chain) {
895
+ var ret, _then;
896
+ try {
897
+ if (cb === false) {
898
+ chain.reject(self.msg);
899
+ } else {
900
+ if (cb === true) {
901
+ ret = self.msg;
902
+ } else {
903
+ ret = cb.call(void 0, self.msg);
904
+ }
905
+ if (ret === chain.promise) {
906
+ chain.reject(TypeError("Promise-chain cycle"));
907
+ } else if (_then = isThenable(ret)) {
908
+ _then.call(ret, chain.resolve, chain.reject);
909
+ } else {
910
+ chain.resolve(ret);
911
+ }
912
+ }
913
+ } catch (err) {
914
+ chain.reject(err);
915
+ }
916
+ }
917
+ function resolve(msg) {
918
+ var _then,
919
+ self = this;
920
+
921
+ // already triggered?
922
+ if (self.triggered) {
923
+ return;
924
+ }
925
+ self.triggered = true;
926
+
927
+ // unwrap
928
+ if (self.def) {
929
+ self = self.def;
930
+ }
931
+ try {
932
+ if (_then = isThenable(msg)) {
933
+ schedule(function () {
934
+ var def_wrapper = new MakeDefWrapper(self);
935
+ try {
936
+ _then.call(msg, function $resolve$() {
937
+ resolve.apply(def_wrapper, arguments);
938
+ }, function $reject$() {
939
+ reject.apply(def_wrapper, arguments);
940
+ });
941
+ } catch (err) {
942
+ reject.call(def_wrapper, err);
943
+ }
944
+ });
945
+ } else {
946
+ self.msg = msg;
947
+ self.state = 1;
948
+ if (self.chain.length > 0) {
949
+ schedule(notify, self);
950
+ }
951
+ }
952
+ } catch (err) {
953
+ reject.call(new MakeDefWrapper(self), err);
954
+ }
955
+ }
956
+ function reject(msg) {
957
+ var self = this;
958
+
959
+ // already triggered?
960
+ if (self.triggered) {
961
+ return;
962
+ }
963
+ self.triggered = true;
964
+
965
+ // unwrap
966
+ if (self.def) {
967
+ self = self.def;
968
+ }
969
+ self.msg = msg;
970
+ self.state = 2;
971
+ if (self.chain.length > 0) {
972
+ schedule(notify, self);
973
+ }
974
+ }
975
+ function iteratePromises(Constructor, arr, resolver, rejecter) {
976
+ for (var idx = 0; idx < arr.length; idx++) {
977
+ (function IIFE(idx) {
978
+ Constructor.resolve(arr[idx]).then(function $resolver$(msg) {
979
+ resolver(idx, msg);
980
+ }, rejecter);
981
+ })(idx);
982
+ }
983
+ }
984
+ function MakeDefWrapper(self) {
985
+ this.def = self;
986
+ this.triggered = false;
987
+ }
988
+ function MakeDef(self) {
989
+ this.promise = self;
990
+ this.state = 0;
991
+ this.triggered = false;
992
+ this.chain = [];
993
+ this.msg = void 0;
994
+ }
995
+ function Promise(executor) {
996
+ if (typeof executor != "function") {
997
+ throw TypeError("Not a function");
998
+ }
999
+ if (this.__NPO__ !== 0) {
1000
+ throw TypeError("Not a promise");
1001
+ }
1002
+
1003
+ // instance shadowing the inherited "brand"
1004
+ // to signal an already "initialized" promise
1005
+ this.__NPO__ = 1;
1006
+ var def = new MakeDef(this);
1007
+ this["then"] = function then(success, failure) {
1008
+ var o = {
1009
+ success: typeof success == "function" ? success : true,
1010
+ failure: typeof failure == "function" ? failure : false
1011
+ };
1012
+ // Note: `then(..)` itself can be borrowed to be used against
1013
+ // a different promise constructor for making the chained promise,
1014
+ // by substituting a different `this` binding.
1015
+ o.promise = new this.constructor(function extractChain(resolve, reject) {
1016
+ if (typeof resolve != "function" || typeof reject != "function") {
1017
+ throw TypeError("Not a function");
1018
+ }
1019
+ o.resolve = resolve;
1020
+ o.reject = reject;
1021
+ });
1022
+ def.chain.push(o);
1023
+ if (def.state !== 0) {
1024
+ schedule(notify, def);
1025
+ }
1026
+ return o.promise;
1027
+ };
1028
+ this["catch"] = function $catch$(failure) {
1029
+ return this.then(void 0, failure);
1030
+ };
1031
+ try {
1032
+ executor.call(void 0, function publicResolve(msg) {
1033
+ resolve.call(def, msg);
1034
+ }, function publicReject(msg) {
1035
+ reject.call(def, msg);
1036
+ });
1037
+ } catch (err) {
1038
+ reject.call(def, err);
1039
+ }
1040
+ }
1041
+ var PromisePrototype = builtInProp({}, "constructor", Promise, /*configurable=*/false);
1042
+
1043
+ // Note: Android 4 cannot use `Object.defineProperty(..)` here
1044
+ Promise.prototype = PromisePrototype;
1045
+
1046
+ // built-in "brand" to signal an "uninitialized" promise
1047
+ builtInProp(PromisePrototype, "__NPO__", 0, /*configurable=*/false);
1048
+ builtInProp(Promise, "resolve", function Promise$resolve(msg) {
1049
+ var Constructor = this;
1050
+
1051
+ // spec mandated checks
1052
+ // note: best "isPromise" check that's practical for now
1053
+ if (msg && typeof msg == "object" && msg.__NPO__ === 1) {
1054
+ return msg;
1055
+ }
1056
+ return new Constructor(function executor(resolve, reject) {
1057
+ if (typeof resolve != "function" || typeof reject != "function") {
1058
+ throw TypeError("Not a function");
1059
+ }
1060
+ resolve(msg);
1061
+ });
1062
+ });
1063
+ builtInProp(Promise, "reject", function Promise$reject(msg) {
1064
+ return new this(function executor(resolve, reject) {
1065
+ if (typeof resolve != "function" || typeof reject != "function") {
1066
+ throw TypeError("Not a function");
1067
+ }
1068
+ reject(msg);
1069
+ });
1070
+ });
1071
+ builtInProp(Promise, "all", function Promise$all(arr) {
1072
+ var Constructor = this;
1073
+
1074
+ // spec mandated checks
1075
+ if (ToString.call(arr) != "[object Array]") {
1076
+ return Constructor.reject(TypeError("Not an array"));
1077
+ }
1078
+ if (arr.length === 0) {
1079
+ return Constructor.resolve([]);
1080
+ }
1081
+ return new Constructor(function executor(resolve, reject) {
1082
+ if (typeof resolve != "function" || typeof reject != "function") {
1083
+ throw TypeError("Not a function");
1084
+ }
1085
+ var len = arr.length,
1086
+ msgs = Array(len),
1087
+ count = 0;
1088
+ iteratePromises(Constructor, arr, function resolver(idx, msg) {
1089
+ msgs[idx] = msg;
1090
+ if (++count === len) {
1091
+ resolve(msgs);
1092
+ }
1093
+ }, reject);
1094
+ });
1095
+ });
1096
+ builtInProp(Promise, "race", function Promise$race(arr) {
1097
+ var Constructor = this;
1098
+
1099
+ // spec mandated checks
1100
+ if (ToString.call(arr) != "[object Array]") {
1101
+ return Constructor.reject(TypeError("Not an array"));
1102
+ }
1103
+ return new Constructor(function executor(resolve, reject) {
1104
+ if (typeof resolve != "function" || typeof reject != "function") {
1105
+ throw TypeError("Not a function");
1106
+ }
1107
+ iteratePromises(Constructor, arr, function resolver(idx, msg) {
1108
+ resolve(msg);
1109
+ }, reject);
1110
+ });
1111
+ });
1112
+ return Promise;
1113
+ });
1114
+ });
1115
+
1116
+ /**
1117
+ * @module lib/callbacks
1118
+ */
1119
+
1120
+ var callbackMap = new WeakMap();
1121
+
1122
+ /**
1123
+ * Store a callback for a method or event for a player.
1124
+ *
1125
+ * @param {Player} player The player object.
1126
+ * @param {string} name The method or event name.
1127
+ * @param {(function(this:Player, *): void|{resolve: function, reject: function})} callback
1128
+ * The callback to call or an object with resolve and reject functions for a promise.
1129
+ * @return {void}
1130
+ */
1131
+ function storeCallback(player, name, callback) {
1132
+ var playerCallbacks = callbackMap.get(player.element) || {};
1133
+ if (!(name in playerCallbacks)) {
1134
+ playerCallbacks[name] = [];
1135
+ }
1136
+ playerCallbacks[name].push(callback);
1137
+ callbackMap.set(player.element, playerCallbacks);
1138
+ }
1139
+
1140
+ /**
1141
+ * Get the callbacks for a player and event or method.
1142
+ *
1143
+ * @param {Player} player The player object.
1144
+ * @param {string} name The method or event name
1145
+ * @return {function[]}
1146
+ */
1147
+ function getCallbacks(player, name) {
1148
+ var playerCallbacks = callbackMap.get(player.element) || {};
1149
+ return playerCallbacks[name] || [];
1150
+ }
1151
+
1152
+ /**
1153
+ * Remove a stored callback for a method or event for a player.
1154
+ *
1155
+ * @param {Player} player The player object.
1156
+ * @param {string} name The method or event name
1157
+ * @param {function} [callback] The specific callback to remove.
1158
+ * @return {boolean} Was this the last callback?
1159
+ */
1160
+ function removeCallback(player, name, callback) {
1161
+ var playerCallbacks = callbackMap.get(player.element) || {};
1162
+ if (!playerCallbacks[name]) {
1163
+ return true;
1164
+ }
1165
+
1166
+ // If no callback is passed, remove all callbacks for the event
1167
+ if (!callback) {
1168
+ playerCallbacks[name] = [];
1169
+ callbackMap.set(player.element, playerCallbacks);
1170
+ return true;
1171
+ }
1172
+ var index = playerCallbacks[name].indexOf(callback);
1173
+ if (index !== -1) {
1174
+ playerCallbacks[name].splice(index, 1);
1175
+ }
1176
+ callbackMap.set(player.element, playerCallbacks);
1177
+ return playerCallbacks[name] && playerCallbacks[name].length === 0;
1178
+ }
1179
+
1180
+ /**
1181
+ * Return the first stored callback for a player and event or method.
1182
+ *
1183
+ * @param {Player} player The player object.
1184
+ * @param {string} name The method or event name.
1185
+ * @return {function} The callback, or false if there were none
1186
+ */
1187
+ function shiftCallbacks(player, name) {
1188
+ var playerCallbacks = getCallbacks(player, name);
1189
+ if (playerCallbacks.length < 1) {
1190
+ return false;
1191
+ }
1192
+ var callback = playerCallbacks.shift();
1193
+ removeCallback(player, name, callback);
1194
+ return callback;
1195
+ }
1196
+
1197
+ /**
1198
+ * Move callbacks associated with an element to another element.
1199
+ *
1200
+ * @param {HTMLElement} oldElement The old element.
1201
+ * @param {HTMLElement} newElement The new element.
1202
+ * @return {void}
1203
+ */
1204
+ function swapCallbacks(oldElement, newElement) {
1205
+ var playerCallbacks = callbackMap.get(oldElement);
1206
+ callbackMap.set(newElement, playerCallbacks);
1207
+ callbackMap.delete(oldElement);
1208
+ }
1209
+
1210
+ /**
1211
+ * @module lib/postmessage
1212
+ */
1213
+
1214
+ /**
1215
+ * Parse a message received from postMessage.
1216
+ *
1217
+ * @param {*} data The data received from postMessage.
1218
+ * @return {object}
1219
+ */
1220
+ function parseMessageData(data) {
1221
+ if (typeof data === 'string') {
1222
+ try {
1223
+ data = JSON.parse(data);
1224
+ } catch (error) {
1225
+ // If the message cannot be parsed, throw the error as a warning
1226
+ console.warn(error);
1227
+ return {};
1228
+ }
1229
+ }
1230
+ return data;
1231
+ }
1232
+
1233
+ /**
1234
+ * Post a message to the specified target.
1235
+ *
1236
+ * @param {Player} player The player object to use.
1237
+ * @param {string} method The API method to call.
1238
+ * @param {object} params The parameters to send to the player.
1239
+ * @return {void}
1240
+ */
1241
+ function postMessage(player, method, params) {
1242
+ if (!player.element.contentWindow || !player.element.contentWindow.postMessage) {
1243
+ return;
1244
+ }
1245
+ var message = {
1246
+ method: method
1247
+ };
1248
+ if (params !== undefined) {
1249
+ message.value = params;
1250
+ }
1251
+
1252
+ // IE 8 and 9 do not support passing messages, so stringify them
1253
+ var ieVersion = parseFloat(navigator.userAgent.toLowerCase().replace(/^.*msie (\d+).*$/, '$1'));
1254
+ if (ieVersion >= 8 && ieVersion < 10) {
1255
+ message = JSON.stringify(message);
1256
+ }
1257
+ player.element.contentWindow.postMessage(message, player.origin);
1258
+ }
1259
+
1260
+ /**
1261
+ * Parse the data received from a message event.
1262
+ *
1263
+ * @param {Player} player The player that received the message.
1264
+ * @param {(Object|string)} data The message data. Strings will be parsed into JSON.
1265
+ * @return {void}
1266
+ */
1267
+ function processData(player, data) {
1268
+ data = parseMessageData(data);
1269
+ var callbacks = [];
1270
+ var param;
1271
+ if (data.event) {
1272
+ if (data.event === 'error') {
1273
+ var promises = getCallbacks(player, data.data.method);
1274
+ promises.forEach(function (promise) {
1275
+ var error = new Error(data.data.message);
1276
+ error.name = data.data.name;
1277
+ promise.reject(error);
1278
+ removeCallback(player, data.data.method, promise);
1279
+ });
1280
+ }
1281
+ callbacks = getCallbacks(player, "event:".concat(data.event));
1282
+ param = data.data;
1283
+ } else if (data.method) {
1284
+ var callback = shiftCallbacks(player, data.method);
1285
+ if (callback) {
1286
+ callbacks.push(callback);
1287
+ param = data.value;
1288
+ }
1289
+ }
1290
+ callbacks.forEach(function (callback) {
1291
+ try {
1292
+ if (typeof callback === 'function') {
1293
+ callback.call(player, param);
1294
+ return;
1295
+ }
1296
+ callback.resolve(param);
1297
+ } catch (e) {
1298
+ // empty
1299
+ }
1300
+ });
1301
+ }
1302
+
1303
+ /**
1304
+ * @module lib/embed
1305
+ */
1306
+ var oEmbedParameters = ['airplay', 'audio_tracks', 'autopause', 'autoplay', 'background', 'byline', 'cc', 'chapters', 'chromecast', 'color', 'colors', 'controls', 'dnt', 'fullscreen', 'height', 'id', 'interactive_params', 'keyboard', 'loop', 'maxheight', 'maxwidth', 'muted', 'play_button_position', 'playsinline', 'portrait', 'progress_bar', 'quality_selector', 'responsive', 'speed', 'texttrack', 'title', 'transcript', 'transparent', 'url', 'vimeo_logo', 'volume', 'width'];
1307
+
1308
+ /**
1309
+ * Get the 'data-vimeo'-prefixed attributes from an element as an object.
1310
+ *
1311
+ * @param {HTMLElement} element The element.
1312
+ * @param {Object} [defaults={}] The default values to use.
1313
+ * @return {Object<string, string>}
1314
+ */
1315
+ function getOEmbedParameters(element) {
1316
+ var defaults = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1317
+ return oEmbedParameters.reduce(function (params, param) {
1318
+ var value = element.getAttribute("data-vimeo-".concat(param));
1319
+ if (value || value === '') {
1320
+ params[param] = value === '' ? 1 : value;
1321
+ }
1322
+ return params;
1323
+ }, defaults);
1324
+ }
1325
+
1326
+ /**
1327
+ * Create an embed from oEmbed data inside an element.
1328
+ *
1329
+ * @param {object} data The oEmbed data.
1330
+ * @param {HTMLElement} element The element to put the iframe in.
1331
+ * @return {HTMLIFrameElement} The iframe embed.
1332
+ */
1333
+ function createEmbed(_ref, element) {
1334
+ var html = _ref.html;
1335
+ if (!element) {
1336
+ throw new TypeError('An element must be provided');
1337
+ }
1338
+ if (element.getAttribute('data-vimeo-initialized') !== null) {
1339
+ return element.querySelector('iframe');
1340
+ }
1341
+ var div = document.createElement('div');
1342
+ div.innerHTML = html;
1343
+ element.appendChild(div.firstChild);
1344
+ element.setAttribute('data-vimeo-initialized', 'true');
1345
+ return element.querySelector('iframe');
1346
+ }
1347
+
1348
+ /**
1349
+ * Make an oEmbed call for the specified URL.
1350
+ *
1351
+ * @param {string} videoUrl The vimeo.com url for the video.
1352
+ * @param {Object} [params] Parameters to pass to oEmbed.
1353
+ * @param {HTMLElement} element The element.
1354
+ * @return {Promise}
1355
+ */
1356
+ function getOEmbedData(videoUrl) {
1357
+ var params = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1358
+ var element = arguments.length > 2 ? arguments[2] : undefined;
1359
+ return new Promise(function (resolve, reject) {
1360
+ if (!isVimeoUrl(videoUrl)) {
1361
+ throw new TypeError("\u201C".concat(videoUrl, "\u201D is not a vimeo.com url."));
1362
+ }
1363
+ var url = "https://vimeo.com/api/oembed.json?url=".concat(encodeURIComponent(videoUrl));
1364
+ for (var param in params) {
1365
+ if (params.hasOwnProperty(param)) {
1366
+ url += "&".concat(param, "=").concat(encodeURIComponent(params[param]));
1367
+ }
1368
+ }
1369
+ var xhr = 'XDomainRequest' in window ? new XDomainRequest() : new XMLHttpRequest();
1370
+ xhr.open('GET', url, true);
1371
+ xhr.onload = function () {
1372
+ if (xhr.status === 404) {
1373
+ reject(new Error("\u201C".concat(videoUrl, "\u201D was not found.")));
1374
+ return;
1375
+ }
1376
+ if (xhr.status === 403) {
1377
+ reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable.")));
1378
+ return;
1379
+ }
1380
+ try {
1381
+ var json = JSON.parse(xhr.responseText);
1382
+ // Check api response for 403 on oembed
1383
+ if (json.domain_status_code === 403) {
1384
+ // We still want to create the embed to give users visual feedback
1385
+ createEmbed(json, element);
1386
+ reject(new Error("\u201C".concat(videoUrl, "\u201D is not embeddable.")));
1387
+ return;
1388
+ }
1389
+ resolve(json);
1390
+ } catch (error) {
1391
+ reject(error);
1392
+ }
1393
+ };
1394
+ xhr.onerror = function () {
1395
+ var status = xhr.status ? " (".concat(xhr.status, ")") : '';
1396
+ reject(new Error("There was an error fetching the embed code from Vimeo".concat(status, ".")));
1397
+ };
1398
+ xhr.send();
1399
+ });
1400
+ }
1401
+
1402
+ /**
1403
+ * Initialize all embeds within a specific element
1404
+ *
1405
+ * @param {HTMLElement} [parent=document] The parent element.
1406
+ * @return {void}
1407
+ */
1408
+ function initializeEmbeds() {
1409
+ var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
1410
+ var elements = [].slice.call(parent.querySelectorAll('[data-vimeo-id], [data-vimeo-url]'));
1411
+ var handleError = function handleError(error) {
1412
+ if ('console' in window && console.error) {
1413
+ console.error("There was an error creating an embed: ".concat(error));
1414
+ }
1415
+ };
1416
+ elements.forEach(function (element) {
1417
+ try {
1418
+ // Skip any that have data-vimeo-defer
1419
+ if (element.getAttribute('data-vimeo-defer') !== null) {
1420
+ return;
1421
+ }
1422
+ var params = getOEmbedParameters(element);
1423
+ var url = getVimeoUrl(params);
1424
+ getOEmbedData(url, params, element).then(function (data) {
1425
+ return createEmbed(data, element);
1426
+ }).catch(handleError);
1427
+ } catch (error) {
1428
+ handleError(error);
1429
+ }
1430
+ });
1431
+ }
1432
+
1433
+ /**
1434
+ * Resize embeds when messaged by the player.
1435
+ *
1436
+ * @param {HTMLElement} [parent=document] The parent element.
1437
+ * @return {void}
1438
+ */
1439
+ function resizeEmbeds() {
1440
+ var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
1441
+ // Prevent execution if users include the player.js script multiple times.
1442
+ if (window.VimeoPlayerResizeEmbeds_) {
1443
+ return;
1444
+ }
1445
+ window.VimeoPlayerResizeEmbeds_ = true;
1446
+ var onMessage = function onMessage(event) {
1447
+ if (!isVimeoUrl(event.origin)) {
1448
+ return;
1449
+ }
1450
+
1451
+ // 'spacechange' is fired only on embeds with cards
1452
+ if (!event.data || event.data.event !== 'spacechange') {
1453
+ return;
1454
+ }
1455
+ var iframes = parent.querySelectorAll('iframe');
1456
+ for (var i = 0; i < iframes.length; i++) {
1457
+ if (iframes[i].contentWindow !== event.source) {
1458
+ continue;
1459
+ }
1460
+
1461
+ // Change padding-bottom of the enclosing div to accommodate
1462
+ // card carousel without distorting aspect ratio
1463
+ var space = iframes[i].parentElement;
1464
+ space.style.paddingBottom = "".concat(event.data.data[0].bottom, "px");
1465
+ break;
1466
+ }
1467
+ };
1468
+ window.addEventListener('message', onMessage);
1469
+ }
1470
+
1471
+ /**
1472
+ * Add chapters to existing metadata for Google SEO
1473
+ *
1474
+ * @param {HTMLElement} [parent=document] The parent element.
1475
+ * @return {void}
1476
+ */
1477
+ function initAppendVideoMetadata() {
1478
+ var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
1479
+ // Prevent execution if users include the player.js script multiple times.
1480
+ if (window.VimeoSeoMetadataAppended) {
1481
+ return;
1482
+ }
1483
+ window.VimeoSeoMetadataAppended = true;
1484
+ var onMessage = function onMessage(event) {
1485
+ if (!isVimeoUrl(event.origin)) {
1486
+ return;
1487
+ }
1488
+ var data = parseMessageData(event.data);
1489
+ if (!data || data.event !== 'ready') {
1490
+ return;
1491
+ }
1492
+ var iframes = parent.querySelectorAll('iframe');
1493
+ for (var i = 0; i < iframes.length; i++) {
1494
+ var iframe = iframes[i];
1495
+
1496
+ // Initiate appendVideoMetadata if iframe is a Vimeo embed
1497
+ var isValidMessageSource = iframe.contentWindow === event.source;
1498
+ if (isVimeoEmbed(iframe.src) && isValidMessageSource) {
1499
+ var player = new Player(iframe);
1500
+ player.callMethod('appendVideoMetadata', window.location.href);
1501
+ }
1502
+ }
1503
+ };
1504
+ window.addEventListener('message', onMessage);
1505
+ }
1506
+
1507
+ /**
1508
+ * Seek to time indicated by vimeo_t query parameter if present in URL
1509
+ *
1510
+ * @param {HTMLElement} [parent=document] The parent element.
1511
+ * @return {void}
1512
+ */
1513
+ function checkUrlTimeParam() {
1514
+ var parent = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : document;
1515
+ // Prevent execution if users include the player.js script multiple times.
1516
+ if (window.VimeoCheckedUrlTimeParam) {
1517
+ return;
1518
+ }
1519
+ window.VimeoCheckedUrlTimeParam = true;
1520
+ var handleError = function handleError(error) {
1521
+ if ('console' in window && console.error) {
1522
+ console.error("There was an error getting video Id: ".concat(error));
1523
+ }
1524
+ };
1525
+ var onMessage = function onMessage(event) {
1526
+ if (!isVimeoUrl(event.origin)) {
1527
+ return;
1528
+ }
1529
+ var data = parseMessageData(event.data);
1530
+ if (!data || data.event !== 'ready') {
1531
+ return;
1532
+ }
1533
+ var iframes = parent.querySelectorAll('iframe');
1534
+ var _loop = function _loop() {
1535
+ var iframe = iframes[i];
1536
+ var isValidMessageSource = iframe.contentWindow === event.source;
1537
+ if (isVimeoEmbed(iframe.src) && isValidMessageSource) {
1538
+ var player = new Player(iframe);
1539
+ player.getVideoId().then(function (videoId) {
1540
+ var matches = new RegExp("[?&]vimeo_t_".concat(videoId, "=([^&#]*)")).exec(window.location.href);
1541
+ if (matches && matches[1]) {
1542
+ var sec = decodeURI(matches[1]);
1543
+ player.setCurrentTime(sec);
1544
+ }
1545
+ return;
1546
+ }).catch(handleError);
1547
+ }
1548
+ };
1549
+ for (var i = 0; i < iframes.length; i++) {
1550
+ _loop();
1551
+ }
1552
+ };
1553
+ window.addEventListener('message', onMessage);
1554
+ }
1555
+
1556
+ /* MIT License
1557
+
1558
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
1559
+
1560
+ Permission 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:
1561
+
1562
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
1563
+
1564
+ THE 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.
1565
+ Terms */
1566
+
1567
+ function initializeScreenfull() {
1568
+ var fn = function () {
1569
+ var val;
1570
+ var fnMap = [['requestFullscreen', 'exitFullscreen', 'fullscreenElement', 'fullscreenEnabled', 'fullscreenchange', 'fullscreenerror'],
1571
+ // New WebKit
1572
+ ['webkitRequestFullscreen', 'webkitExitFullscreen', 'webkitFullscreenElement', 'webkitFullscreenEnabled', 'webkitfullscreenchange', 'webkitfullscreenerror'],
1573
+ // Old WebKit
1574
+ ['webkitRequestFullScreen', 'webkitCancelFullScreen', 'webkitCurrentFullScreenElement', 'webkitCancelFullScreen', 'webkitfullscreenchange', 'webkitfullscreenerror'], ['mozRequestFullScreen', 'mozCancelFullScreen', 'mozFullScreenElement', 'mozFullScreenEnabled', 'mozfullscreenchange', 'mozfullscreenerror'], ['msRequestFullscreen', 'msExitFullscreen', 'msFullscreenElement', 'msFullscreenEnabled', 'MSFullscreenChange', 'MSFullscreenError']];
1575
+ var i = 0;
1576
+ var l = fnMap.length;
1577
+ var ret = {};
1578
+ for (; i < l; i++) {
1579
+ val = fnMap[i];
1580
+ if (val && val[1] in document) {
1581
+ for (i = 0; i < val.length; i++) {
1582
+ ret[fnMap[0][i]] = val[i];
1583
+ }
1584
+ return ret;
1585
+ }
1586
+ }
1587
+ return false;
1588
+ }();
1589
+ var eventNameMap = {
1590
+ fullscreenchange: fn.fullscreenchange,
1591
+ fullscreenerror: fn.fullscreenerror
1592
+ };
1593
+ var screenfull = {
1594
+ request: function request(element) {
1595
+ return new Promise(function (resolve, reject) {
1596
+ var onFullScreenEntered = function onFullScreenEntered() {
1597
+ screenfull.off('fullscreenchange', onFullScreenEntered);
1598
+ resolve();
1599
+ };
1600
+ screenfull.on('fullscreenchange', onFullScreenEntered);
1601
+ element = element || document.documentElement;
1602
+ var returnPromise = element[fn.requestFullscreen]();
1603
+ if (returnPromise instanceof Promise) {
1604
+ returnPromise.then(onFullScreenEntered).catch(reject);
1605
+ }
1606
+ });
1607
+ },
1608
+ exit: function exit() {
1609
+ return new Promise(function (resolve, reject) {
1610
+ if (!screenfull.isFullscreen) {
1611
+ resolve();
1612
+ return;
1613
+ }
1614
+ var onFullScreenExit = function onFullScreenExit() {
1615
+ screenfull.off('fullscreenchange', onFullScreenExit);
1616
+ resolve();
1617
+ };
1618
+ screenfull.on('fullscreenchange', onFullScreenExit);
1619
+ var returnPromise = document[fn.exitFullscreen]();
1620
+ if (returnPromise instanceof Promise) {
1621
+ returnPromise.then(onFullScreenExit).catch(reject);
1622
+ }
1623
+ });
1624
+ },
1625
+ on: function on(event, callback) {
1626
+ var eventName = eventNameMap[event];
1627
+ if (eventName) {
1628
+ document.addEventListener(eventName, callback);
1629
+ }
1630
+ },
1631
+ off: function off(event, callback) {
1632
+ var eventName = eventNameMap[event];
1633
+ if (eventName) {
1634
+ document.removeEventListener(eventName, callback);
1635
+ }
1636
+ }
1637
+ };
1638
+ Object.defineProperties(screenfull, {
1639
+ isFullscreen: {
1640
+ get: function get() {
1641
+ return Boolean(document[fn.fullscreenElement]);
1642
+ }
1643
+ },
1644
+ element: {
1645
+ enumerable: true,
1646
+ get: function get() {
1647
+ return document[fn.fullscreenElement];
1648
+ }
1649
+ },
1650
+ isEnabled: {
1651
+ enumerable: true,
1652
+ get: function get() {
1653
+ // Coerce to boolean in case of old WebKit
1654
+ return Boolean(document[fn.fullscreenEnabled]);
1655
+ }
1656
+ }
1657
+ });
1658
+ return screenfull;
1659
+ }
1660
+
1661
+ /** @typedef {import('./timing-src-connector.types').PlayerControls} PlayerControls */
1662
+ /** @typedef {import('./timing-object.types').TimingObject} TimingObject */
1663
+ /** @typedef {import('./timing-src-connector.types').TimingSrcConnectorOptions} TimingSrcConnectorOptions */
1664
+ /** @typedef {(msg: string) => any} Logger */
1665
+ /** @typedef {import('timing-object.types').TConnectionState} TConnectionState */
1666
+
1667
+ /**
1668
+ * @type {TimingSrcConnectorOptions}
1669
+ *
1670
+ * For details on these properties and their effects, see the typescript definition referenced above.
1671
+ */
1672
+ var defaultOptions = {
1673
+ role: 'viewer',
1674
+ autoPlayMuted: true,
1675
+ allowedDrift: 0.3,
1676
+ maxAllowedDrift: 1,
1677
+ minCheckInterval: 0.1,
1678
+ maxRateAdjustment: 0.2,
1679
+ maxTimeToCatchUp: 1
1680
+ };
1681
+
1682
+ /**
1683
+ * 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.
1684
+ *
1685
+ * Proposed spec: https://webtiming.github.io/timingobject/
1686
+ * V3 Spec: https://timingsrc.readthedocs.io/en/latest/
1687
+ * Demuxed talk: https://www.youtube.com/watch?v=cZSjDaGDmX8
1688
+ *
1689
+ * 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.
1690
+ *
1691
+ * There are 5 general responsibilities in TimingSrcConnector:
1692
+ *
1693
+ * 1. `updatePlayer()` which sets the player's currentTime, playbackRate and pause/play state based on current state of the TimingObject.
1694
+ * 2. `updateTimingObject()` which sets the TimingObject's position and velocity from the player's state.
1695
+ * 3. `playerUpdater` which listens for change events on the TimingObject and will respond by calling updatePlayer.
1696
+ * 4. `timingObjectUpdater` which listens to the player events of seeked, play and pause and will respond by calling `updateTimingObject()`.
1697
+ * 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.
1698
+ */
1699
+ var TimingSrcConnector = /*#__PURE__*/function (_EventTarget) {
1700
+ _inherits(TimingSrcConnector, _EventTarget);
1701
+ var _super = _createSuper(TimingSrcConnector);
1702
+ /**
1703
+ * @param {PlayerControls} player
1704
+ * @param {TimingObject} timingObject
1705
+ * @param {TimingSrcConnectorOptions} options
1706
+ * @param {Logger} logger
1707
+ */
1708
+ function TimingSrcConnector(_player, timingObject) {
1709
+ var _this;
1710
+ var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
1711
+ var logger = arguments.length > 3 ? arguments[3] : undefined;
1712
+ _classCallCheck(this, TimingSrcConnector);
1713
+ _this = _super.call(this);
1714
+ _defineProperty(_assertThisInitialized(_this), "logger", void 0);
1715
+ _defineProperty(_assertThisInitialized(_this), "speedAdjustment", 0);
1716
+ /**
1717
+ * @param {PlayerControls} player
1718
+ * @param {number} newAdjustment
1719
+ * @return {Promise<void>}
1720
+ */
1721
+ _defineProperty(_assertThisInitialized(_this), "adjustSpeed", /*#__PURE__*/function () {
1722
+ var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(player, newAdjustment) {
1723
+ var newPlaybackRate;
1724
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
1725
+ while (1) switch (_context.prev = _context.next) {
1726
+ case 0:
1727
+ if (!(_this.speedAdjustment === newAdjustment)) {
1728
+ _context.next = 2;
1729
+ break;
1730
+ }
1731
+ return _context.abrupt("return");
1732
+ case 2:
1733
+ _context.next = 4;
1734
+ return player.getPlaybackRate();
1735
+ case 4:
1736
+ _context.t0 = _context.sent;
1737
+ _context.t1 = _this.speedAdjustment;
1738
+ _context.t2 = _context.t0 - _context.t1;
1739
+ _context.t3 = newAdjustment;
1740
+ newPlaybackRate = _context.t2 + _context.t3;
1741
+ _this.log("New playbackRate: ".concat(newPlaybackRate));
1742
+ _context.next = 12;
1743
+ return player.setPlaybackRate(newPlaybackRate);
1744
+ case 12:
1745
+ _this.speedAdjustment = newAdjustment;
1746
+ case 13:
1747
+ case "end":
1748
+ return _context.stop();
1749
+ }
1750
+ }, _callee);
1751
+ }));
1752
+ return function (_x, _x2) {
1753
+ return _ref.apply(this, arguments);
1754
+ };
1755
+ }());
1756
+ _this.logger = logger;
1757
+ _this.init(timingObject, _player, _objectSpread2(_objectSpread2({}, defaultOptions), options));
1758
+ return _this;
1759
+ }
1760
+ _createClass(TimingSrcConnector, [{
1761
+ key: "disconnect",
1762
+ value: function disconnect() {
1763
+ this.dispatchEvent(new Event('disconnect'));
1764
+ }
1765
+
1766
+ /**
1767
+ * @param {TimingObject} timingObject
1768
+ * @param {PlayerControls} player
1769
+ * @param {TimingSrcConnectorOptions} options
1770
+ * @return {Promise<void>}
1771
+ */
1772
+ }, {
1773
+ key: "init",
1774
+ value: function () {
1775
+ var _init = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(timingObject, player, options) {
1776
+ var _this2 = this;
1777
+ var playerUpdater, positionSync, timingObjectUpdater;
1778
+ return _regeneratorRuntime().wrap(function _callee2$(_context2) {
1779
+ while (1) switch (_context2.prev = _context2.next) {
1780
+ case 0:
1781
+ _context2.next = 2;
1782
+ return this.waitForTOReadyState(timingObject, 'open');
1783
+ case 2:
1784
+ if (!(options.role === 'viewer')) {
1785
+ _context2.next = 10;
1786
+ break;
1787
+ }
1788
+ _context2.next = 5;
1789
+ return this.updatePlayer(timingObject, player, options);
1790
+ case 5:
1791
+ playerUpdater = subscribe(timingObject, 'change', function () {
1792
+ return _this2.updatePlayer(timingObject, player, options);
1793
+ });
1794
+ positionSync = this.maintainPlaybackPosition(timingObject, player, options);
1795
+ this.addEventListener('disconnect', function () {
1796
+ positionSync.cancel();
1797
+ playerUpdater.cancel();
1798
+ });
1799
+ _context2.next = 14;
1800
+ break;
1801
+ case 10:
1802
+ _context2.next = 12;
1803
+ return this.updateTimingObject(timingObject, player);
1804
+ case 12:
1805
+ timingObjectUpdater = subscribe(player, ['seeked', 'play', 'pause', 'ratechange'], function () {
1806
+ return _this2.updateTimingObject(timingObject, player);
1807
+ }, 'on', 'off');
1808
+ this.addEventListener('disconnect', function () {
1809
+ return timingObjectUpdater.cancel();
1810
+ });
1811
+ case 14:
1812
+ case "end":
1813
+ return _context2.stop();
1814
+ }
1815
+ }, _callee2, this);
1816
+ }));
1817
+ function init(_x3, _x4, _x5) {
1818
+ return _init.apply(this, arguments);
1819
+ }
1820
+ return init;
1821
+ }()
1822
+ /**
1823
+ * Sets the TimingObject's state to reflect that of the player
1824
+ *
1825
+ * @param {TimingObject} timingObject
1826
+ * @param {PlayerControls} player
1827
+ * @return {Promise<void>}
1828
+ */
1829
+ }, {
1830
+ key: "updateTimingObject",
1831
+ value: function () {
1832
+ var _updateTimingObject = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(timingObject, player) {
1833
+ return _regeneratorRuntime().wrap(function _callee3$(_context3) {
1834
+ while (1) switch (_context3.prev = _context3.next) {
1835
+ case 0:
1836
+ _context3.t0 = timingObject;
1837
+ _context3.next = 3;
1838
+ return player.getCurrentTime();
1839
+ case 3:
1840
+ _context3.t1 = _context3.sent;
1841
+ _context3.next = 6;
1842
+ return player.getPaused();
1843
+ case 6:
1844
+ if (!_context3.sent) {
1845
+ _context3.next = 10;
1846
+ break;
1847
+ }
1848
+ _context3.t2 = 0;
1849
+ _context3.next = 13;
1850
+ break;
1851
+ case 10:
1852
+ _context3.next = 12;
1853
+ return player.getPlaybackRate();
1854
+ case 12:
1855
+ _context3.t2 = _context3.sent;
1856
+ case 13:
1857
+ _context3.t3 = _context3.t2;
1858
+ _context3.t4 = {
1859
+ position: _context3.t1,
1860
+ velocity: _context3.t3
1861
+ };
1862
+ _context3.t0.update.call(_context3.t0, _context3.t4);
1863
+ case 16:
1864
+ case "end":
1865
+ return _context3.stop();
1866
+ }
1867
+ }, _callee3);
1868
+ }));
1869
+ function updateTimingObject(_x6, _x7) {
1870
+ return _updateTimingObject.apply(this, arguments);
1871
+ }
1872
+ return updateTimingObject;
1873
+ }()
1874
+ /**
1875
+ * Sets the player's timing state to reflect that of the TimingObject
1876
+ *
1877
+ * @param {TimingObject} timingObject
1878
+ * @param {PlayerControls} player
1879
+ * @param {TimingSrcConnectorOptions} options
1880
+ * @return {Promise<void>}
1881
+ */
1882
+ }, {
1883
+ key: "updatePlayer",
1884
+ value: function () {
1885
+ var _updatePlayer = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(timingObject, player, options) {
1886
+ var _timingObject$query, position, velocity;
1887
+ return _regeneratorRuntime().wrap(function _callee5$(_context5) {
1888
+ while (1) switch (_context5.prev = _context5.next) {
1889
+ case 0:
1890
+ _timingObject$query = timingObject.query(), position = _timingObject$query.position, velocity = _timingObject$query.velocity;
1891
+ if (typeof position === 'number') {
1892
+ player.setCurrentTime(position);
1893
+ }
1894
+ if (!(typeof velocity === 'number')) {
1895
+ _context5.next = 25;
1896
+ break;
1897
+ }
1898
+ if (!(velocity === 0)) {
1899
+ _context5.next = 11;
1900
+ break;
1901
+ }
1902
+ _context5.next = 6;
1903
+ return player.getPaused();
1904
+ case 6:
1905
+ _context5.t0 = _context5.sent;
1906
+ if (!(_context5.t0 === false)) {
1907
+ _context5.next = 9;
1908
+ break;
1909
+ }
1910
+ player.pause();
1911
+ case 9:
1912
+ _context5.next = 25;
1913
+ break;
1914
+ case 11:
1915
+ if (!(velocity > 0)) {
1916
+ _context5.next = 25;
1917
+ break;
1918
+ }
1919
+ _context5.next = 14;
1920
+ return player.getPaused();
1921
+ case 14:
1922
+ _context5.t1 = _context5.sent;
1923
+ if (!(_context5.t1 === true)) {
1924
+ _context5.next = 19;
1925
+ break;
1926
+ }
1927
+ _context5.next = 18;
1928
+ return player.play().catch( /*#__PURE__*/function () {
1929
+ var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(err) {
1930
+ return _regeneratorRuntime().wrap(function _callee4$(_context4) {
1931
+ while (1) switch (_context4.prev = _context4.next) {
1932
+ case 0:
1933
+ if (!(err.name === 'NotAllowedError' && options.autoPlayMuted)) {
1934
+ _context4.next = 5;
1935
+ break;
1936
+ }
1937
+ _context4.next = 3;
1938
+ return player.setMuted(true);
1939
+ case 3:
1940
+ _context4.next = 5;
1941
+ return player.play().catch(function (err2) {
1942
+ return console.error('Couldn\'t play the video from TimingSrcConnector. Error:', err2);
1943
+ });
1944
+ case 5:
1945
+ case "end":
1946
+ return _context4.stop();
1947
+ }
1948
+ }, _callee4);
1949
+ }));
1950
+ return function (_x11) {
1951
+ return _ref2.apply(this, arguments);
1952
+ };
1953
+ }());
1954
+ case 18:
1955
+ this.updatePlayer(timingObject, player, options);
1956
+ case 19:
1957
+ _context5.next = 21;
1958
+ return player.getPlaybackRate();
1959
+ case 21:
1960
+ _context5.t2 = _context5.sent;
1961
+ _context5.t3 = velocity;
1962
+ if (!(_context5.t2 !== _context5.t3)) {
1963
+ _context5.next = 25;
1964
+ break;
1965
+ }
1966
+ player.setPlaybackRate(velocity);
1967
+ case 25:
1968
+ case "end":
1969
+ return _context5.stop();
1970
+ }
1971
+ }, _callee5, this);
1972
+ }));
1973
+ function updatePlayer(_x8, _x9, _x10) {
1974
+ return _updatePlayer.apply(this, arguments);
1975
+ }
1976
+ return updatePlayer;
1977
+ }()
1978
+ /**
1979
+ * Since video players do not play with 100% time precision, we need to closely monitor
1980
+ * our player to be sure it remains in sync with the TimingObject.
1981
+ *
1982
+ * If out of sync, we use the current conditions and the options provided to determine
1983
+ * whether to re-sync via setting currentTime or adjusting the playbackRate
1984
+ *
1985
+ * @param {TimingObject} timingObject
1986
+ * @param {PlayerControls} player
1987
+ * @param {TimingSrcConnectorOptions} options
1988
+ * @return {{cancel: (function(): void)}}
1989
+ */
1990
+ }, {
1991
+ key: "maintainPlaybackPosition",
1992
+ value: function maintainPlaybackPosition(timingObject, player, options) {
1993
+ var _this3 = this;
1994
+ var allowedDrift = options.allowedDrift,
1995
+ maxAllowedDrift = options.maxAllowedDrift,
1996
+ minCheckInterval = options.minCheckInterval,
1997
+ maxRateAdjustment = options.maxRateAdjustment,
1998
+ maxTimeToCatchUp = options.maxTimeToCatchUp;
1999
+ var syncInterval = Math.min(maxTimeToCatchUp, Math.max(minCheckInterval, maxAllowedDrift)) * 1000;
2000
+ var check = /*#__PURE__*/function () {
2001
+ var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
2002
+ var diff, diffAbs, min, max, adjustment;
2003
+ return _regeneratorRuntime().wrap(function _callee6$(_context6) {
2004
+ while (1) switch (_context6.prev = _context6.next) {
2005
+ case 0:
2006
+ _context6.t0 = timingObject.query().velocity === 0;
2007
+ if (_context6.t0) {
2008
+ _context6.next = 6;
2009
+ break;
2010
+ }
2011
+ _context6.next = 4;
2012
+ return player.getPaused();
2013
+ case 4:
2014
+ _context6.t1 = _context6.sent;
2015
+ _context6.t0 = _context6.t1 === true;
2016
+ case 6:
2017
+ if (!_context6.t0) {
2018
+ _context6.next = 8;
2019
+ break;
2020
+ }
2021
+ return _context6.abrupt("return");
2022
+ case 8:
2023
+ _context6.t2 = timingObject.query().position;
2024
+ _context6.next = 11;
2025
+ return player.getCurrentTime();
2026
+ case 11:
2027
+ _context6.t3 = _context6.sent;
2028
+ diff = _context6.t2 - _context6.t3;
2029
+ diffAbs = Math.abs(diff);
2030
+ _this3.log("Drift: ".concat(diff));
2031
+ if (!(diffAbs > maxAllowedDrift)) {
2032
+ _context6.next = 22;
2033
+ break;
2034
+ }
2035
+ _context6.next = 18;
2036
+ return _this3.adjustSpeed(player, 0);
2037
+ case 18:
2038
+ player.setCurrentTime(timingObject.query().position);
2039
+ _this3.log('Resync by currentTime');
2040
+ _context6.next = 29;
2041
+ break;
2042
+ case 22:
2043
+ if (!(diffAbs > allowedDrift)) {
2044
+ _context6.next = 29;
2045
+ break;
2046
+ }
2047
+ min = diffAbs / maxTimeToCatchUp;
2048
+ max = maxRateAdjustment;
2049
+ adjustment = min < max ? (max - min) / 2 : max;
2050
+ _context6.next = 28;
2051
+ return _this3.adjustSpeed(player, adjustment * Math.sign(diff));
2052
+ case 28:
2053
+ _this3.log('Resync by playbackRate');
2054
+ case 29:
2055
+ case "end":
2056
+ return _context6.stop();
2057
+ }
2058
+ }, _callee6);
2059
+ }));
2060
+ return function check() {
2061
+ return _ref3.apply(this, arguments);
2062
+ };
2063
+ }();
2064
+ var interval = setInterval(function () {
2065
+ return check();
2066
+ }, syncInterval);
2067
+ return {
2068
+ cancel: function cancel() {
2069
+ return clearInterval(interval);
2070
+ }
2071
+ };
2072
+ }
2073
+
2074
+ /**
2075
+ * @param {string} msg
2076
+ */
2077
+ }, {
2078
+ key: "log",
2079
+ value: function log(msg) {
2080
+ var _this$logger;
2081
+ (_this$logger = this.logger) === null || _this$logger === void 0 ? void 0 : _this$logger.call(this, "TimingSrcConnector: ".concat(msg));
2082
+ }
2083
+ }, {
2084
+ key: "waitForTOReadyState",
2085
+ value:
2086
+ /**
2087
+ * @param {TimingObject} timingObject
2088
+ * @param {TConnectionState} state
2089
+ * @return {Promise<void>}
2090
+ */
2091
+ function waitForTOReadyState(timingObject, state) {
2092
+ return new Promise(function (resolve) {
2093
+ var check = function check() {
2094
+ if (timingObject.readyState === state) {
2095
+ resolve();
2096
+ } else {
2097
+ timingObject.addEventListener('readystatechange', check, {
2098
+ once: true
2099
+ });
2100
+ }
2101
+ };
2102
+ check();
2103
+ });
2104
+ }
2105
+ }]);
2106
+ return TimingSrcConnector;
2107
+ }( /*#__PURE__*/_wrapNativeSuper(EventTarget));
2108
+
2109
+ var playerMap = new WeakMap();
2110
+ var readyMap = new WeakMap();
2111
+ var screenfull = {};
2112
+ var Player = /*#__PURE__*/function () {
2113
+ /**
2114
+ * Create a Player.
2115
+ *
2116
+ * @param {(HTMLIFrameElement|HTMLElement|string|jQuery)} element A reference to the Vimeo
2117
+ * player iframe, and id, or a jQuery object.
2118
+ * @param {object} [options] oEmbed parameters to use when creating an embed in the element.
2119
+ * @return {Player}
2120
+ */
2121
+ function Player(element) {
2122
+ var _this = this;
2123
+ var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2124
+ _classCallCheck(this, Player);
2125
+ /* global jQuery */
2126
+ if (window.jQuery && element instanceof jQuery) {
2127
+ if (element.length > 1 && window.console && console.warn) {
2128
+ console.warn('A jQuery object with multiple elements was passed, using the first element.');
2129
+ }
2130
+ element = element[0];
2131
+ }
2132
+
2133
+ // Find an element by ID
2134
+ if (typeof document !== 'undefined' && typeof element === 'string') {
2135
+ element = document.getElementById(element);
2136
+ }
2137
+
2138
+ // Not an element!
2139
+ if (!isDomElement(element)) {
2140
+ throw new TypeError('You must pass either a valid element or a valid id.');
2141
+ }
2142
+
2143
+ // Already initialized an embed in this div, so grab the iframe
2144
+ if (element.nodeName !== 'IFRAME') {
2145
+ var iframe = element.querySelector('iframe');
2146
+ if (iframe) {
2147
+ element = iframe;
2148
+ }
2149
+ }
2150
+
2151
+ // iframe url is not a Vimeo url
2152
+ if (element.nodeName === 'IFRAME' && !isVimeoUrl(element.getAttribute('src') || '')) {
2153
+ throw new Error('The player element passed isn’t a Vimeo embed.');
2154
+ }
2155
+
2156
+ // If there is already a player object in the map, return that
2157
+ if (playerMap.has(element)) {
2158
+ return playerMap.get(element);
2159
+ }
2160
+ this._window = element.ownerDocument.defaultView;
2161
+ this.element = element;
2162
+ this.origin = '*';
2163
+ var readyPromise = new npo_src(function (resolve, reject) {
2164
+ _this._onMessage = function (event) {
2165
+ if (!isVimeoUrl(event.origin) || _this.element.contentWindow !== event.source) {
2166
+ return;
2167
+ }
2168
+ if (_this.origin === '*') {
2169
+ _this.origin = event.origin;
2170
+ }
2171
+ var data = parseMessageData(event.data);
2172
+ var isError = data && data.event === 'error';
2173
+ var isReadyError = isError && data.data && data.data.method === 'ready';
2174
+ if (isReadyError) {
2175
+ var error = new Error(data.data.message);
2176
+ error.name = data.data.name;
2177
+ reject(error);
2178
+ return;
2179
+ }
2180
+ var isReadyEvent = data && data.event === 'ready';
2181
+ var isPingResponse = data && data.method === 'ping';
2182
+ if (isReadyEvent || isPingResponse) {
2183
+ _this.element.setAttribute('data-ready', 'true');
2184
+ resolve();
2185
+ return;
2186
+ }
2187
+ processData(_this, data);
2188
+ };
2189
+ _this._window.addEventListener('message', _this._onMessage);
2190
+ if (_this.element.nodeName !== 'IFRAME') {
2191
+ var params = getOEmbedParameters(element, options);
2192
+ var url = getVimeoUrl(params);
2193
+ getOEmbedData(url, params, element).then(function (data) {
2194
+ var iframe = createEmbed(data, element);
2195
+ // Overwrite element with the new iframe,
2196
+ // but store reference to the original element
2197
+ _this.element = iframe;
2198
+ _this._originalElement = element;
2199
+ swapCallbacks(element, iframe);
2200
+ playerMap.set(_this.element, _this);
2201
+ return data;
2202
+ }).catch(reject);
2203
+ }
2204
+ });
2205
+
2206
+ // Store a copy of this Player in the map
2207
+ readyMap.set(this, readyPromise);
2208
+ playerMap.set(this.element, this);
2209
+
2210
+ // Send a ping to the iframe so the ready promise will be resolved if
2211
+ // the player is already ready.
2212
+ if (this.element.nodeName === 'IFRAME') {
2213
+ postMessage(this, 'ping');
2214
+ }
2215
+ if (screenfull.isEnabled) {
2216
+ var exitFullscreen = function exitFullscreen() {
2217
+ return screenfull.exit();
2218
+ };
2219
+ this.fullscreenchangeHandler = function () {
2220
+ if (screenfull.isFullscreen) {
2221
+ storeCallback(_this, 'event:exitFullscreen', exitFullscreen);
2222
+ } else {
2223
+ removeCallback(_this, 'event:exitFullscreen', exitFullscreen);
2224
+ }
2225
+ // eslint-disable-next-line
2226
+ _this.ready().then(function () {
2227
+ postMessage(_this, 'fullscreenchange', screenfull.isFullscreen);
2228
+ });
2229
+ };
2230
+ screenfull.on('fullscreenchange', this.fullscreenchangeHandler);
2231
+ }
2232
+ return this;
2233
+ }
2234
+
2235
+ /**
2236
+ * Get a promise for a method.
2237
+ *
2238
+ * @param {string} name The API method to call.
2239
+ * @param {Object} [args={}] Arguments to send via postMessage.
2240
+ * @return {Promise}
2241
+ */
2242
+ _createClass(Player, [{
2243
+ key: "callMethod",
2244
+ value: function callMethod(name) {
2245
+ var _this2 = this;
2246
+ var args = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2247
+ return new npo_src(function (resolve, reject) {
2248
+ // We are storing the resolve/reject handlers to call later, so we
2249
+ // can’t return here.
2250
+ // eslint-disable-next-line promise/always-return
2251
+ return _this2.ready().then(function () {
2252
+ storeCallback(_this2, name, {
2253
+ resolve: resolve,
2254
+ reject: reject
2255
+ });
2256
+ postMessage(_this2, name, args);
2257
+ }).catch(reject);
2258
+ });
2259
+ }
2260
+
2261
+ /**
2262
+ * Get a promise for the value of a player property.
2263
+ *
2264
+ * @param {string} name The property name
2265
+ * @return {Promise}
2266
+ */
2267
+ }, {
2268
+ key: "get",
2269
+ value: function get(name) {
2270
+ var _this3 = this;
2271
+ return new npo_src(function (resolve, reject) {
2272
+ name = getMethodName(name, 'get');
2273
+
2274
+ // We are storing the resolve/reject handlers to call later, so we
2275
+ // can’t return here.
2276
+ // eslint-disable-next-line promise/always-return
2277
+ return _this3.ready().then(function () {
2278
+ storeCallback(_this3, name, {
2279
+ resolve: resolve,
2280
+ reject: reject
2281
+ });
2282
+ postMessage(_this3, name);
2283
+ }).catch(reject);
2284
+ });
2285
+ }
2286
+
2287
+ /**
2288
+ * Get a promise for setting the value of a player property.
2289
+ *
2290
+ * @param {string} name The API method to call.
2291
+ * @param {mixed} value The value to set.
2292
+ * @return {Promise}
2293
+ */
2294
+ }, {
2295
+ key: "set",
2296
+ value: function set(name, value) {
2297
+ var _this4 = this;
2298
+ return new npo_src(function (resolve, reject) {
2299
+ name = getMethodName(name, 'set');
2300
+ if (value === undefined || value === null) {
2301
+ throw new TypeError('There must be a value to set.');
2302
+ }
2303
+
2304
+ // We are storing the resolve/reject handlers to call later, so we
2305
+ // can’t return here.
2306
+ // eslint-disable-next-line promise/always-return
2307
+ return _this4.ready().then(function () {
2308
+ storeCallback(_this4, name, {
2309
+ resolve: resolve,
2310
+ reject: reject
2311
+ });
2312
+ postMessage(_this4, name, value);
2313
+ }).catch(reject);
2314
+ });
2315
+ }
2316
+
2317
+ /**
2318
+ * Add an event listener for the specified event. Will call the
2319
+ * callback with a single parameter, `data`, that contains the data for
2320
+ * that event.
2321
+ *
2322
+ * @param {string} eventName The name of the event.
2323
+ * @param {function(*)} callback The function to call when the event fires.
2324
+ * @return {void}
2325
+ */
2326
+ }, {
2327
+ key: "on",
2328
+ value: function on(eventName, callback) {
2329
+ if (!eventName) {
2330
+ throw new TypeError('You must pass an event name.');
2331
+ }
2332
+ if (!callback) {
2333
+ throw new TypeError('You must pass a callback function.');
2334
+ }
2335
+ if (typeof callback !== 'function') {
2336
+ throw new TypeError('The callback must be a function.');
2337
+ }
2338
+ var callbacks = getCallbacks(this, "event:".concat(eventName));
2339
+ if (callbacks.length === 0) {
2340
+ this.callMethod('addEventListener', eventName).catch(function () {
2341
+ // Ignore the error. There will be an error event fired that
2342
+ // will trigger the error callback if they are listening.
2343
+ });
2344
+ }
2345
+ storeCallback(this, "event:".concat(eventName), callback);
2346
+ }
2347
+
2348
+ /**
2349
+ * Remove an event listener for the specified event. Will remove all
2350
+ * listeners for that event if a `callback` isn’t passed, or only that
2351
+ * specific callback if it is passed.
2352
+ *
2353
+ * @param {string} eventName The name of the event.
2354
+ * @param {function} [callback] The specific callback to remove.
2355
+ * @return {void}
2356
+ */
2357
+ }, {
2358
+ key: "off",
2359
+ value: function off(eventName, callback) {
2360
+ if (!eventName) {
2361
+ throw new TypeError('You must pass an event name.');
2362
+ }
2363
+ if (callback && typeof callback !== 'function') {
2364
+ throw new TypeError('The callback must be a function.');
2365
+ }
2366
+ var lastCallback = removeCallback(this, "event:".concat(eventName), callback);
2367
+
2368
+ // If there are no callbacks left, remove the listener
2369
+ if (lastCallback) {
2370
+ this.callMethod('removeEventListener', eventName).catch(function (e) {
2371
+ // Ignore the error. There will be an error event fired that
2372
+ // will trigger the error callback if they are listening.
2373
+ });
2374
+ }
2375
+ }
2376
+
2377
+ /**
2378
+ * A promise to load a new video.
2379
+ *
2380
+ * @promise LoadVideoPromise
2381
+ * @fulfill {number} The video with this id or url successfully loaded.
2382
+ * @reject {TypeError} The id was not a number.
2383
+ */
2384
+ /**
2385
+ * Load a new video into this embed. The promise will be resolved if
2386
+ * the video is successfully loaded, or it will be rejected if it could
2387
+ * not be loaded.
2388
+ *
2389
+ * @param {number|string|object} options The id of the video, the url of the video, or an object with embed options.
2390
+ * @return {LoadVideoPromise}
2391
+ */
2392
+ }, {
2393
+ key: "loadVideo",
2394
+ value: function loadVideo(options) {
2395
+ return this.callMethod('loadVideo', options);
2396
+ }
2397
+
2398
+ /**
2399
+ * A promise to perform an action when the Player is ready.
2400
+ *
2401
+ * @todo document errors
2402
+ * @promise LoadVideoPromise
2403
+ * @fulfill {void}
2404
+ */
2405
+ /**
2406
+ * Trigger a function when the player iframe has initialized. You do not
2407
+ * need to wait for `ready` to trigger to begin adding event listeners
2408
+ * or calling other methods.
2409
+ *
2410
+ * @return {ReadyPromise}
2411
+ */
2412
+ }, {
2413
+ key: "ready",
2414
+ value: function ready() {
2415
+ var readyPromise = readyMap.get(this) || new npo_src(function (resolve, reject) {
2416
+ reject(new Error('Unknown player. Probably unloaded.'));
2417
+ });
2418
+ return npo_src.resolve(readyPromise);
2419
+ }
2420
+
2421
+ /**
2422
+ * A promise to add a cue point to the player.
2423
+ *
2424
+ * @promise AddCuePointPromise
2425
+ * @fulfill {string} The id of the cue point to use for removeCuePoint.
2426
+ * @reject {RangeError} the time was less than 0 or greater than the
2427
+ * video’s duration.
2428
+ * @reject {UnsupportedError} Cue points are not supported with the current
2429
+ * player or browser.
2430
+ */
2431
+ /**
2432
+ * Add a cue point to the player.
2433
+ *
2434
+ * @param {number} time The time for the cue point.
2435
+ * @param {object} [data] Arbitrary data to be returned with the cue point.
2436
+ * @return {AddCuePointPromise}
2437
+ */
2438
+ }, {
2439
+ key: "addCuePoint",
2440
+ value: function addCuePoint(time) {
2441
+ var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
2442
+ return this.callMethod('addCuePoint', {
2443
+ time: time,
2444
+ data: data
2445
+ });
2446
+ }
2447
+
2448
+ /**
2449
+ * A promise to remove a cue point from the player.
2450
+ *
2451
+ * @promise AddCuePointPromise
2452
+ * @fulfill {string} The id of the cue point that was removed.
2453
+ * @reject {InvalidCuePoint} The cue point with the specified id was not
2454
+ * found.
2455
+ * @reject {UnsupportedError} Cue points are not supported with the current
2456
+ * player or browser.
2457
+ */
2458
+ /**
2459
+ * Remove a cue point from the video.
2460
+ *
2461
+ * @param {string} id The id of the cue point to remove.
2462
+ * @return {RemoveCuePointPromise}
2463
+ */
2464
+ }, {
2465
+ key: "removeCuePoint",
2466
+ value: function removeCuePoint(id) {
2467
+ return this.callMethod('removeCuePoint', id);
2468
+ }
2469
+
2470
+ /**
2471
+ * A representation of a text track on a video.
2472
+ *
2473
+ * @typedef {Object} VimeoTextTrack
2474
+ * @property {string} language The ISO language code.
2475
+ * @property {string} kind The kind of track it is (captions or subtitles).
2476
+ * @property {string} label The human‐readable label for the track.
2477
+ */
2478
+ /**
2479
+ * A promise to enable a text track.
2480
+ *
2481
+ * @promise EnableTextTrackPromise
2482
+ * @fulfill {VimeoTextTrack} The text track that was enabled.
2483
+ * @reject {InvalidTrackLanguageError} No track was available with the
2484
+ * specified language.
2485
+ * @reject {InvalidTrackError} No track was available with the specified
2486
+ * language and kind.
2487
+ */
2488
+ /**
2489
+ * Enable the text track with the specified language, and optionally the
2490
+ * specified kind (captions or subtitles).
2491
+ *
2492
+ * When set via the API, the track language will not change the viewer’s
2493
+ * stored preference.
2494
+ *
2495
+ * @param {string} language The two‐letter language code.
2496
+ * @param {string} [kind] The kind of track to enable (captions or subtitles).
2497
+ * @return {EnableTextTrackPromise}
2498
+ */
2499
+ }, {
2500
+ key: "enableTextTrack",
2501
+ value: function enableTextTrack(language, kind) {
2502
+ if (!language) {
2503
+ throw new TypeError('You must pass a language.');
2504
+ }
2505
+ return this.callMethod('enableTextTrack', {
2506
+ language: language,
2507
+ kind: kind
2508
+ });
2509
+ }
2510
+
2511
+ /**
2512
+ * A promise to disable the active text track.
2513
+ *
2514
+ * @promise DisableTextTrackPromise
2515
+ * @fulfill {void} The track was disabled.
2516
+ */
2517
+ /**
2518
+ * Disable the currently-active text track.
2519
+ *
2520
+ * @return {DisableTextTrackPromise}
2521
+ */
2522
+ }, {
2523
+ key: "disableTextTrack",
2524
+ value: function disableTextTrack() {
2525
+ return this.callMethod('disableTextTrack');
2526
+ }
2527
+
2528
+ /**
2529
+ * A promise to pause the video.
2530
+ *
2531
+ * @promise PausePromise
2532
+ * @fulfill {void} The video was paused.
2533
+ */
2534
+ /**
2535
+ * Pause the video if it’s playing.
2536
+ *
2537
+ * @return {PausePromise}
2538
+ */
2539
+ }, {
2540
+ key: "pause",
2541
+ value: function pause() {
2542
+ return this.callMethod('pause');
2543
+ }
2544
+
2545
+ /**
2546
+ * A promise to play the video.
2547
+ *
2548
+ * @promise PlayPromise
2549
+ * @fulfill {void} The video was played.
2550
+ */
2551
+ /**
2552
+ * Play the video if it’s paused. **Note:** on iOS and some other
2553
+ * mobile devices, you cannot programmatically trigger play. Once the
2554
+ * viewer has tapped on the play button in the player, however, you
2555
+ * will be able to use this function.
2556
+ *
2557
+ * @return {PlayPromise}
2558
+ */
2559
+ }, {
2560
+ key: "play",
2561
+ value: function play() {
2562
+ return this.callMethod('play');
2563
+ }
2564
+
2565
+ /**
2566
+ * Request that the player enters fullscreen.
2567
+ * @return {Promise}
2568
+ */
2569
+ }, {
2570
+ key: "requestFullscreen",
2571
+ value: function requestFullscreen() {
2572
+ if (screenfull.isEnabled) {
2573
+ return screenfull.request(this.element);
2574
+ }
2575
+ return this.callMethod('requestFullscreen');
2576
+ }
2577
+
2578
+ /**
2579
+ * Request that the player exits fullscreen.
2580
+ * @return {Promise}
2581
+ */
2582
+ }, {
2583
+ key: "exitFullscreen",
2584
+ value: function exitFullscreen() {
2585
+ if (screenfull.isEnabled) {
2586
+ return screenfull.exit();
2587
+ }
2588
+ return this.callMethod('exitFullscreen');
2589
+ }
2590
+
2591
+ /**
2592
+ * Returns true if the player is currently fullscreen.
2593
+ * @return {Promise}
2594
+ */
2595
+ }, {
2596
+ key: "getFullscreen",
2597
+ value: function getFullscreen() {
2598
+ if (screenfull.isEnabled) {
2599
+ return npo_src.resolve(screenfull.isFullscreen);
2600
+ }
2601
+ return this.get('fullscreen');
2602
+ }
2603
+
2604
+ /**
2605
+ * Request that the player enters picture-in-picture.
2606
+ * @return {Promise}
2607
+ */
2608
+ }, {
2609
+ key: "requestPictureInPicture",
2610
+ value: function requestPictureInPicture() {
2611
+ return this.callMethod('requestPictureInPicture');
2612
+ }
2613
+
2614
+ /**
2615
+ * Request that the player exits picture-in-picture.
2616
+ * @return {Promise}
2617
+ */
2618
+ }, {
2619
+ key: "exitPictureInPicture",
2620
+ value: function exitPictureInPicture() {
2621
+ return this.callMethod('exitPictureInPicture');
2622
+ }
2623
+
2624
+ /**
2625
+ * Returns true if the player is currently picture-in-picture.
2626
+ * @return {Promise}
2627
+ */
2628
+ }, {
2629
+ key: "getPictureInPicture",
2630
+ value: function getPictureInPicture() {
2631
+ return this.get('pictureInPicture');
2632
+ }
2633
+
2634
+ /**
2635
+ * A promise to prompt the viewer to initiate remote playback.
2636
+ *
2637
+ * @promise RemotePlaybackPromptPromise
2638
+ * @fulfill {void}
2639
+ * @reject {NotFoundError} No remote playback device is available.
2640
+ */
2641
+ /**
2642
+ * Request to prompt the user to initiate remote playback.
2643
+ *
2644
+ * @return {RemotePlaybackPromptPromise}
2645
+ */
2646
+ }, {
2647
+ key: "remotePlaybackPrompt",
2648
+ value: function remotePlaybackPrompt() {
2649
+ return this.callMethod('remotePlaybackPrompt');
2650
+ }
2651
+
2652
+ /**
2653
+ * A promise to unload the video.
2654
+ *
2655
+ * @promise UnloadPromise
2656
+ * @fulfill {void} The video was unloaded.
2657
+ */
2658
+ /**
2659
+ * Return the player to its initial state.
2660
+ *
2661
+ * @return {UnloadPromise}
2662
+ */
2663
+ }, {
2664
+ key: "unload",
2665
+ value: function unload() {
2666
+ return this.callMethod('unload');
2667
+ }
2668
+
2669
+ /**
2670
+ * Cleanup the player and remove it from the DOM
2671
+ *
2672
+ * It won't be usable and a new one should be constructed
2673
+ * in order to do any operations.
2674
+ *
2675
+ * @return {Promise}
2676
+ */
2677
+ }, {
2678
+ key: "destroy",
2679
+ value: function destroy() {
2680
+ var _this5 = this;
2681
+ return new npo_src(function (resolve) {
2682
+ readyMap.delete(_this5);
2683
+ playerMap.delete(_this5.element);
2684
+ if (_this5._originalElement) {
2685
+ playerMap.delete(_this5._originalElement);
2686
+ _this5._originalElement.removeAttribute('data-vimeo-initialized');
2687
+ }
2688
+ if (_this5.element && _this5.element.nodeName === 'IFRAME' && _this5.element.parentNode) {
2689
+ // If we've added an additional wrapper div, remove that from the DOM.
2690
+ // If not, just remove the iframe element.
2691
+ if (_this5.element.parentNode.parentNode && _this5._originalElement && _this5._originalElement !== _this5.element.parentNode) {
2692
+ _this5.element.parentNode.parentNode.removeChild(_this5.element.parentNode);
2693
+ } else {
2694
+ _this5.element.parentNode.removeChild(_this5.element);
2695
+ }
2696
+ }
2697
+
2698
+ // If the clip is private there is a case where the element stays the
2699
+ // div element. Destroy should reset the div and remove the iframe child.
2700
+ if (_this5.element && _this5.element.nodeName === 'DIV' && _this5.element.parentNode) {
2701
+ _this5.element.removeAttribute('data-vimeo-initialized');
2702
+ var iframe = _this5.element.querySelector('iframe');
2703
+ if (iframe && iframe.parentNode) {
2704
+ // If we've added an additional wrapper div, remove that from the DOM.
2705
+ // If not, just remove the iframe element.
2706
+ if (iframe.parentNode.parentNode && _this5._originalElement && _this5._originalElement !== iframe.parentNode) {
2707
+ iframe.parentNode.parentNode.removeChild(iframe.parentNode);
2708
+ } else {
2709
+ iframe.parentNode.removeChild(iframe);
2710
+ }
2711
+ }
2712
+ }
2713
+ _this5._window.removeEventListener('message', _this5._onMessage);
2714
+ if (screenfull.isEnabled) {
2715
+ screenfull.off('fullscreenchange', _this5.fullscreenchangeHandler);
2716
+ }
2717
+ resolve();
2718
+ });
2719
+ }
2720
+
2721
+ /**
2722
+ * A promise to get the autopause behavior of the video.
2723
+ *
2724
+ * @promise GetAutopausePromise
2725
+ * @fulfill {boolean} Whether autopause is turned on or off.
2726
+ * @reject {UnsupportedError} Autopause is not supported with the current
2727
+ * player or browser.
2728
+ */
2729
+ /**
2730
+ * Get the autopause behavior for this player.
2731
+ *
2732
+ * @return {GetAutopausePromise}
2733
+ */
2734
+ }, {
2735
+ key: "getAutopause",
2736
+ value: function getAutopause() {
2737
+ return this.get('autopause');
2738
+ }
2739
+
2740
+ /**
2741
+ * A promise to set the autopause behavior of the video.
2742
+ *
2743
+ * @promise SetAutopausePromise
2744
+ * @fulfill {boolean} Whether autopause is turned on or off.
2745
+ * @reject {UnsupportedError} Autopause is not supported with the current
2746
+ * player or browser.
2747
+ */
2748
+ /**
2749
+ * Enable or disable the autopause behavior of this player.
2750
+ *
2751
+ * By default, when another video is played in the same browser, this
2752
+ * player will automatically pause. Unless you have a specific reason
2753
+ * for doing so, we recommend that you leave autopause set to the
2754
+ * default (`true`).
2755
+ *
2756
+ * @param {boolean} autopause
2757
+ * @return {SetAutopausePromise}
2758
+ */
2759
+ }, {
2760
+ key: "setAutopause",
2761
+ value: function setAutopause(autopause) {
2762
+ return this.set('autopause', autopause);
2763
+ }
2764
+
2765
+ /**
2766
+ * A promise to get the buffered property of the video.
2767
+ *
2768
+ * @promise GetBufferedPromise
2769
+ * @fulfill {Array} Buffered Timeranges converted to an Array.
2770
+ */
2771
+ /**
2772
+ * Get the buffered property of the video.
2773
+ *
2774
+ * @return {GetBufferedPromise}
2775
+ */
2776
+ }, {
2777
+ key: "getBuffered",
2778
+ value: function getBuffered() {
2779
+ return this.get('buffered');
2780
+ }
2781
+
2782
+ /**
2783
+ * @typedef {Object} CameraProperties
2784
+ * @prop {number} props.yaw - Number between 0 and 360.
2785
+ * @prop {number} props.pitch - Number between -90 and 90.
2786
+ * @prop {number} props.roll - Number between -180 and 180.
2787
+ * @prop {number} props.fov - The field of view in degrees.
2788
+ */
2789
+ /**
2790
+ * A promise to get the camera properties of the player.
2791
+ *
2792
+ * @promise GetCameraPromise
2793
+ * @fulfill {CameraProperties} The camera properties.
2794
+ */
2795
+ /**
2796
+ * For 360° videos get the camera properties for this player.
2797
+ *
2798
+ * @return {GetCameraPromise}
2799
+ */
2800
+ }, {
2801
+ key: "getCameraProps",
2802
+ value: function getCameraProps() {
2803
+ return this.get('cameraProps');
2804
+ }
2805
+
2806
+ /**
2807
+ * A promise to set the camera properties of the player.
2808
+ *
2809
+ * @promise SetCameraPromise
2810
+ * @fulfill {Object} The camera was successfully set.
2811
+ * @reject {RangeError} The range was out of bounds.
2812
+ */
2813
+ /**
2814
+ * For 360° videos set the camera properties for this player.
2815
+ *
2816
+ * @param {CameraProperties} camera The camera properties
2817
+ * @return {SetCameraPromise}
2818
+ */
2819
+ }, {
2820
+ key: "setCameraProps",
2821
+ value: function setCameraProps(camera) {
2822
+ return this.set('cameraProps', camera);
2823
+ }
2824
+
2825
+ /**
2826
+ * A representation of a chapter.
2827
+ *
2828
+ * @typedef {Object} VimeoChapter
2829
+ * @property {number} startTime The start time of the chapter.
2830
+ * @property {object} title The title of the chapter.
2831
+ * @property {number} index The place in the order of Chapters. Starts at 1.
2832
+ */
2833
+ /**
2834
+ * A promise to get chapters for the video.
2835
+ *
2836
+ * @promise GetChaptersPromise
2837
+ * @fulfill {VimeoChapter[]} The chapters for the video.
2838
+ */
2839
+ /**
2840
+ * Get an array of all the chapters for the video.
2841
+ *
2842
+ * @return {GetChaptersPromise}
2843
+ */
2844
+ }, {
2845
+ key: "getChapters",
2846
+ value: function getChapters() {
2847
+ return this.get('chapters');
2848
+ }
2849
+
2850
+ /**
2851
+ * A promise to get the currently active chapter.
2852
+ *
2853
+ * @promise GetCurrentChaptersPromise
2854
+ * @fulfill {VimeoChapter|undefined} The current chapter for the video.
2855
+ */
2856
+ /**
2857
+ * Get the currently active chapter for the video.
2858
+ *
2859
+ * @return {GetCurrentChaptersPromise}
2860
+ */
2861
+ }, {
2862
+ key: "getCurrentChapter",
2863
+ value: function getCurrentChapter() {
2864
+ return this.get('currentChapter');
2865
+ }
2866
+
2867
+ /**
2868
+ * A promise to get the accent color of the player.
2869
+ *
2870
+ * @promise GetColorPromise
2871
+ * @fulfill {string} The hex color of the player.
2872
+ */
2873
+ /**
2874
+ * Get the accent color for this player. Note this is deprecated in place of `getColorTwo`.
2875
+ *
2876
+ * @return {GetColorPromise}
2877
+ */
2878
+ }, {
2879
+ key: "getColor",
2880
+ value: function getColor() {
2881
+ return this.get('color');
2882
+ }
2883
+
2884
+ /**
2885
+ * A promise to get all colors for the player in an array.
2886
+ *
2887
+ * @promise GetColorsPromise
2888
+ * @fulfill {string[]} The hex colors of the player.
2889
+ */
2890
+ /**
2891
+ * Get all the colors for this player in an array: [colorOne, colorTwo, colorThree, colorFour]
2892
+ *
2893
+ * @return {GetColorPromise}
2894
+ */
2895
+ }, {
2896
+ key: "getColors",
2897
+ value: function getColors() {
2898
+ return npo_src.all([this.get('colorOne'), this.get('colorTwo'), this.get('colorThree'), this.get('colorFour')]);
2899
+ }
2900
+
2901
+ /**
2902
+ * A promise to set the accent color of the player.
2903
+ *
2904
+ * @promise SetColorPromise
2905
+ * @fulfill {string} The color was successfully set.
2906
+ * @reject {TypeError} The string was not a valid hex or rgb color.
2907
+ * @reject {ContrastError} The color was set, but the contrast is
2908
+ * outside of the acceptable range.
2909
+ * @reject {EmbedSettingsError} The owner of the player has chosen to
2910
+ * use a specific color.
2911
+ */
2912
+ /**
2913
+ * Set the accent color of this player to a hex or rgb string. Setting the
2914
+ * color may fail if the owner of the video has set their embed
2915
+ * preferences to force a specific color.
2916
+ * Note this is deprecated in place of `setColorTwo`.
2917
+ *
2918
+ * @param {string} color The hex or rgb color string to set.
2919
+ * @return {SetColorPromise}
2920
+ */
2921
+ }, {
2922
+ key: "setColor",
2923
+ value: function setColor(color) {
2924
+ return this.set('color', color);
2925
+ }
2926
+
2927
+ /**
2928
+ * A promise to set all colors for the player.
2929
+ *
2930
+ * @promise SetColorsPromise
2931
+ * @fulfill {string[]} The colors were successfully set.
2932
+ * @reject {TypeError} The string was not a valid hex or rgb color.
2933
+ * @reject {ContrastError} The color was set, but the contrast is
2934
+ * outside of the acceptable range.
2935
+ * @reject {EmbedSettingsError} The owner of the player has chosen to
2936
+ * use a specific color.
2937
+ */
2938
+ /**
2939
+ * Set the colors of this player to a hex or rgb string. Setting the
2940
+ * color may fail if the owner of the video has set their embed
2941
+ * preferences to force a specific color.
2942
+ * The colors should be passed in as an array: [colorOne, colorTwo, colorThree, colorFour].
2943
+ * If a color should not be set, the index in the array can be left as null.
2944
+ *
2945
+ * @param {string[]} colors Array of the hex or rgb color strings to set.
2946
+ * @return {SetColorsPromise}
2947
+ */
2948
+ }, {
2949
+ key: "setColors",
2950
+ value: function setColors(colors) {
2951
+ if (!Array.isArray(colors)) {
2952
+ return new npo_src(function (resolve, reject) {
2953
+ return reject(new TypeError('Argument must be an array.'));
2954
+ });
2955
+ }
2956
+ var nullPromise = new npo_src(function (resolve) {
2957
+ return resolve(null);
2958
+ });
2959
+ 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];
2960
+ return npo_src.all(colorPromises);
2961
+ }
2962
+
2963
+ /**
2964
+ * A representation of a cue point.
2965
+ *
2966
+ * @typedef {Object} VimeoCuePoint
2967
+ * @property {number} time The time of the cue point.
2968
+ * @property {object} data The data passed when adding the cue point.
2969
+ * @property {string} id The unique id for use with removeCuePoint.
2970
+ */
2971
+ /**
2972
+ * A promise to get the cue points of a video.
2973
+ *
2974
+ * @promise GetCuePointsPromise
2975
+ * @fulfill {VimeoCuePoint[]} The cue points added to the video.
2976
+ * @reject {UnsupportedError} Cue points are not supported with the current
2977
+ * player or browser.
2978
+ */
2979
+ /**
2980
+ * Get an array of the cue points added to the video.
2981
+ *
2982
+ * @return {GetCuePointsPromise}
2983
+ */
2984
+ }, {
2985
+ key: "getCuePoints",
2986
+ value: function getCuePoints() {
2987
+ return this.get('cuePoints');
2988
+ }
2989
+
2990
+ /**
2991
+ * A promise to get the current time of the video.
2992
+ *
2993
+ * @promise GetCurrentTimePromise
2994
+ * @fulfill {number} The current time in seconds.
2995
+ */
2996
+ /**
2997
+ * Get the current playback position in seconds.
2998
+ *
2999
+ * @return {GetCurrentTimePromise}
3000
+ */
3001
+ }, {
3002
+ key: "getCurrentTime",
3003
+ value: function getCurrentTime() {
3004
+ return this.get('currentTime');
3005
+ }
3006
+
3007
+ /**
3008
+ * A promise to set the current time of the video.
3009
+ *
3010
+ * @promise SetCurrentTimePromise
3011
+ * @fulfill {number} The actual current time that was set.
3012
+ * @reject {RangeError} the time was less than 0 or greater than the
3013
+ * video’s duration.
3014
+ */
3015
+ /**
3016
+ * Set the current playback position in seconds. If the player was
3017
+ * paused, it will remain paused. Likewise, if the player was playing,
3018
+ * it will resume playing once the video has buffered.
3019
+ *
3020
+ * You can provide an accurate time and the player will attempt to seek
3021
+ * to as close to that time as possible. The exact time will be the
3022
+ * fulfilled value of the promise.
3023
+ *
3024
+ * @param {number} currentTime
3025
+ * @return {SetCurrentTimePromise}
3026
+ */
3027
+ }, {
3028
+ key: "setCurrentTime",
3029
+ value: function setCurrentTime(currentTime) {
3030
+ return this.set('currentTime', currentTime);
3031
+ }
3032
+
3033
+ /**
3034
+ * A promise to get the duration of the video.
3035
+ *
3036
+ * @promise GetDurationPromise
3037
+ * @fulfill {number} The duration in seconds.
3038
+ */
3039
+ /**
3040
+ * Get the duration of the video in seconds. It will be rounded to the
3041
+ * nearest second before playback begins, and to the nearest thousandth
3042
+ * of a second after playback begins.
3043
+ *
3044
+ * @return {GetDurationPromise}
3045
+ */
3046
+ }, {
3047
+ key: "getDuration",
3048
+ value: function getDuration() {
3049
+ return this.get('duration');
3050
+ }
3051
+
3052
+ /**
3053
+ * A promise to get the ended state of the video.
3054
+ *
3055
+ * @promise GetEndedPromise
3056
+ * @fulfill {boolean} Whether or not the video has ended.
3057
+ */
3058
+ /**
3059
+ * Get the ended state of the video. The video has ended if
3060
+ * `currentTime === duration`.
3061
+ *
3062
+ * @return {GetEndedPromise}
3063
+ */
3064
+ }, {
3065
+ key: "getEnded",
3066
+ value: function getEnded() {
3067
+ return this.get('ended');
3068
+ }
3069
+
3070
+ /**
3071
+ * A promise to get the loop state of the player.
3072
+ *
3073
+ * @promise GetLoopPromise
3074
+ * @fulfill {boolean} Whether or not the player is set to loop.
3075
+ */
3076
+ /**
3077
+ * Get the loop state of the player.
3078
+ *
3079
+ * @return {GetLoopPromise}
3080
+ */
3081
+ }, {
3082
+ key: "getLoop",
3083
+ value: function getLoop() {
3084
+ return this.get('loop');
3085
+ }
3086
+
3087
+ /**
3088
+ * A promise to set the loop state of the player.
3089
+ *
3090
+ * @promise SetLoopPromise
3091
+ * @fulfill {boolean} The loop state that was set.
3092
+ */
3093
+ /**
3094
+ * Set the loop state of the player. When set to `true`, the player
3095
+ * will start over immediately once playback ends.
3096
+ *
3097
+ * @param {boolean} loop
3098
+ * @return {SetLoopPromise}
3099
+ */
3100
+ }, {
3101
+ key: "setLoop",
3102
+ value: function setLoop(loop) {
3103
+ return this.set('loop', loop);
3104
+ }
3105
+
3106
+ /**
3107
+ * A promise to set the muted state of the player.
3108
+ *
3109
+ * @promise SetMutedPromise
3110
+ * @fulfill {boolean} The muted state that was set.
3111
+ */
3112
+ /**
3113
+ * Set the muted state of the player. When set to `true`, the player
3114
+ * volume will be muted.
3115
+ *
3116
+ * @param {boolean} muted
3117
+ * @return {SetMutedPromise}
3118
+ */
3119
+ }, {
3120
+ key: "setMuted",
3121
+ value: function setMuted(muted) {
3122
+ return this.set('muted', muted);
3123
+ }
3124
+
3125
+ /**
3126
+ * A promise to get the muted state of the player.
3127
+ *
3128
+ * @promise GetMutedPromise
3129
+ * @fulfill {boolean} Whether or not the player is muted.
3130
+ */
3131
+ /**
3132
+ * Get the muted state of the player.
3133
+ *
3134
+ * @return {GetMutedPromise}
3135
+ */
3136
+ }, {
3137
+ key: "getMuted",
3138
+ value: function getMuted() {
3139
+ return this.get('muted');
3140
+ }
3141
+
3142
+ /**
3143
+ * A promise to get the paused state of the player.
3144
+ *
3145
+ * @promise GetLoopPromise
3146
+ * @fulfill {boolean} Whether or not the video is paused.
3147
+ */
3148
+ /**
3149
+ * Get the paused state of the player.
3150
+ *
3151
+ * @return {GetLoopPromise}
3152
+ */
3153
+ }, {
3154
+ key: "getPaused",
3155
+ value: function getPaused() {
3156
+ return this.get('paused');
3157
+ }
3158
+
3159
+ /**
3160
+ * A promise to get the playback rate of the player.
3161
+ *
3162
+ * @promise GetPlaybackRatePromise
3163
+ * @fulfill {number} The playback rate of the player on a scale from 0 to 2.
3164
+ */
3165
+ /**
3166
+ * Get the playback rate of the player on a scale from `0` to `2`.
3167
+ *
3168
+ * @return {GetPlaybackRatePromise}
3169
+ */
3170
+ }, {
3171
+ key: "getPlaybackRate",
3172
+ value: function getPlaybackRate() {
3173
+ return this.get('playbackRate');
3174
+ }
3175
+
3176
+ /**
3177
+ * A promise to set the playbackrate of the player.
3178
+ *
3179
+ * @promise SetPlaybackRatePromise
3180
+ * @fulfill {number} The playback rate was set.
3181
+ * @reject {RangeError} The playback rate was less than 0 or greater than 2.
3182
+ */
3183
+ /**
3184
+ * Set the playback rate of the player on a scale from `0` to `2`. When set
3185
+ * via the API, the playback rate will not be synchronized to other
3186
+ * players or stored as the viewer's preference.
3187
+ *
3188
+ * @param {number} playbackRate
3189
+ * @return {SetPlaybackRatePromise}
3190
+ */
3191
+ }, {
3192
+ key: "setPlaybackRate",
3193
+ value: function setPlaybackRate(playbackRate) {
3194
+ return this.set('playbackRate', playbackRate);
3195
+ }
3196
+
3197
+ /**
3198
+ * A promise to get the played property of the video.
3199
+ *
3200
+ * @promise GetPlayedPromise
3201
+ * @fulfill {Array} Played Timeranges converted to an Array.
3202
+ */
3203
+ /**
3204
+ * Get the played property of the video.
3205
+ *
3206
+ * @return {GetPlayedPromise}
3207
+ */
3208
+ }, {
3209
+ key: "getPlayed",
3210
+ value: function getPlayed() {
3211
+ return this.get('played');
3212
+ }
3213
+
3214
+ /**
3215
+ * A promise to get the qualities available of the current video.
3216
+ *
3217
+ * @promise GetQualitiesPromise
3218
+ * @fulfill {Array} The qualities of the video.
3219
+ */
3220
+ /**
3221
+ * Get the qualities of the current video.
3222
+ *
3223
+ * @return {GetQualitiesPromise}
3224
+ */
3225
+ }, {
3226
+ key: "getQualities",
3227
+ value: function getQualities() {
3228
+ return this.get('qualities');
3229
+ }
3230
+
3231
+ /**
3232
+ * A promise to get the current set quality of the video.
3233
+ *
3234
+ * @promise GetQualityPromise
3235
+ * @fulfill {string} The current set quality.
3236
+ */
3237
+ /**
3238
+ * Get the current set quality of the video.
3239
+ *
3240
+ * @return {GetQualityPromise}
3241
+ */
3242
+ }, {
3243
+ key: "getQuality",
3244
+ value: function getQuality() {
3245
+ return this.get('quality');
3246
+ }
3247
+
3248
+ /**
3249
+ * A promise to set the video quality.
3250
+ *
3251
+ * @promise SetQualityPromise
3252
+ * @fulfill {number} The quality was set.
3253
+ * @reject {RangeError} The quality is not available.
3254
+ */
3255
+ /**
3256
+ * Set a video quality.
3257
+ *
3258
+ * @param {string} quality
3259
+ * @return {SetQualityPromise}
3260
+ */
3261
+ }, {
3262
+ key: "setQuality",
3263
+ value: function setQuality(quality) {
3264
+ return this.set('quality', quality);
3265
+ }
3266
+
3267
+ /**
3268
+ * A promise to get the remote playback availability.
3269
+ *
3270
+ * @promise RemotePlaybackAvailabilityPromise
3271
+ * @fulfill {boolean} Whether remote playback is available.
3272
+ */
3273
+ /**
3274
+ * Get the availability of remote playback.
3275
+ *
3276
+ * @return {RemotePlaybackAvailabilityPromise}
3277
+ */
3278
+ }, {
3279
+ key: "getRemotePlaybackAvailability",
3280
+ value: function getRemotePlaybackAvailability() {
3281
+ return this.get('remotePlaybackAvailability');
3282
+ }
3283
+
3284
+ /**
3285
+ * A promise to get the current remote playback state.
3286
+ *
3287
+ * @promise RemotePlaybackStatePromise
3288
+ * @fulfill {string} The state of the remote playback: connecting, connected, or disconnected.
3289
+ */
3290
+ /**
3291
+ * Get the current remote playback state.
3292
+ *
3293
+ * @return {RemotePlaybackStatePromise}
3294
+ */
3295
+ }, {
3296
+ key: "getRemotePlaybackState",
3297
+ value: function getRemotePlaybackState() {
3298
+ return this.get('remotePlaybackState');
3299
+ }
3300
+
3301
+ /**
3302
+ * A promise to get the seekable property of the video.
3303
+ *
3304
+ * @promise GetSeekablePromise
3305
+ * @fulfill {Array} Seekable Timeranges converted to an Array.
3306
+ */
3307
+ /**
3308
+ * Get the seekable property of the video.
3309
+ *
3310
+ * @return {GetSeekablePromise}
3311
+ */
3312
+ }, {
3313
+ key: "getSeekable",
3314
+ value: function getSeekable() {
3315
+ return this.get('seekable');
3316
+ }
3317
+
3318
+ /**
3319
+ * A promise to get the seeking property of the player.
3320
+ *
3321
+ * @promise GetSeekingPromise
3322
+ * @fulfill {boolean} Whether or not the player is currently seeking.
3323
+ */
3324
+ /**
3325
+ * Get if the player is currently seeking.
3326
+ *
3327
+ * @return {GetSeekingPromise}
3328
+ */
3329
+ }, {
3330
+ key: "getSeeking",
3331
+ value: function getSeeking() {
3332
+ return this.get('seeking');
3333
+ }
3334
+
3335
+ /**
3336
+ * A promise to get the text tracks of a video.
3337
+ *
3338
+ * @promise GetTextTracksPromise
3339
+ * @fulfill {VimeoTextTrack[]} The text tracks associated with the video.
3340
+ */
3341
+ /**
3342
+ * Get an array of the text tracks that exist for the video.
3343
+ *
3344
+ * @return {GetTextTracksPromise}
3345
+ */
3346
+ }, {
3347
+ key: "getTextTracks",
3348
+ value: function getTextTracks() {
3349
+ return this.get('textTracks');
3350
+ }
3351
+
3352
+ /**
3353
+ * A promise to get the embed code for the video.
3354
+ *
3355
+ * @promise GetVideoEmbedCodePromise
3356
+ * @fulfill {string} The `<iframe>` embed code for the video.
3357
+ */
3358
+ /**
3359
+ * Get the `<iframe>` embed code for the video.
3360
+ *
3361
+ * @return {GetVideoEmbedCodePromise}
3362
+ */
3363
+ }, {
3364
+ key: "getVideoEmbedCode",
3365
+ value: function getVideoEmbedCode() {
3366
+ return this.get('videoEmbedCode');
3367
+ }
3368
+
3369
+ /**
3370
+ * A promise to get the id of the video.
3371
+ *
3372
+ * @promise GetVideoIdPromise
3373
+ * @fulfill {number} The id of the video.
3374
+ */
3375
+ /**
3376
+ * Get the id of the video.
3377
+ *
3378
+ * @return {GetVideoIdPromise}
3379
+ */
3380
+ }, {
3381
+ key: "getVideoId",
3382
+ value: function getVideoId() {
3383
+ return this.get('videoId');
3384
+ }
3385
+
3386
+ /**
3387
+ * A promise to get the title of the video.
3388
+ *
3389
+ * @promise GetVideoTitlePromise
3390
+ * @fulfill {number} The title of the video.
3391
+ */
3392
+ /**
3393
+ * Get the title of the video.
3394
+ *
3395
+ * @return {GetVideoTitlePromise}
3396
+ */
3397
+ }, {
3398
+ key: "getVideoTitle",
3399
+ value: function getVideoTitle() {
3400
+ return this.get('videoTitle');
3401
+ }
3402
+
3403
+ /**
3404
+ * A promise to get the native width of the video.
3405
+ *
3406
+ * @promise GetVideoWidthPromise
3407
+ * @fulfill {number} The native width of the video.
3408
+ */
3409
+ /**
3410
+ * Get the native width of the currently‐playing video. The width of
3411
+ * the highest‐resolution available will be used before playback begins.
3412
+ *
3413
+ * @return {GetVideoWidthPromise}
3414
+ */
3415
+ }, {
3416
+ key: "getVideoWidth",
3417
+ value: function getVideoWidth() {
3418
+ return this.get('videoWidth');
3419
+ }
3420
+
3421
+ /**
3422
+ * A promise to get the native height of the video.
3423
+ *
3424
+ * @promise GetVideoHeightPromise
3425
+ * @fulfill {number} The native height of the video.
3426
+ */
3427
+ /**
3428
+ * Get the native height of the currently‐playing video. The height of
3429
+ * the highest‐resolution available will be used before playback begins.
3430
+ *
3431
+ * @return {GetVideoHeightPromise}
3432
+ */
3433
+ }, {
3434
+ key: "getVideoHeight",
3435
+ value: function getVideoHeight() {
3436
+ return this.get('videoHeight');
3437
+ }
3438
+
3439
+ /**
3440
+ * A promise to get the vimeo.com url for the video.
3441
+ *
3442
+ * @promise GetVideoUrlPromise
3443
+ * @fulfill {number} The vimeo.com url for the video.
3444
+ * @reject {PrivacyError} The url isn’t available because of the video’s privacy setting.
3445
+ */
3446
+ /**
3447
+ * Get the vimeo.com url for the video.
3448
+ *
3449
+ * @return {GetVideoUrlPromise}
3450
+ */
3451
+ }, {
3452
+ key: "getVideoUrl",
3453
+ value: function getVideoUrl() {
3454
+ return this.get('videoUrl');
3455
+ }
3456
+
3457
+ /**
3458
+ * A promise to get the volume level of the player.
3459
+ *
3460
+ * @promise GetVolumePromise
3461
+ * @fulfill {number} The volume level of the player on a scale from 0 to 1.
3462
+ */
3463
+ /**
3464
+ * Get the current volume level of the player on a scale from `0` to `1`.
3465
+ *
3466
+ * Most mobile devices do not support an independent volume from the
3467
+ * system volume. In those cases, this method will always return `1`.
3468
+ *
3469
+ * @return {GetVolumePromise}
3470
+ */
3471
+ }, {
3472
+ key: "getVolume",
3473
+ value: function getVolume() {
3474
+ return this.get('volume');
3475
+ }
3476
+
3477
+ /**
3478
+ * A promise to set the volume level of the player.
3479
+ *
3480
+ * @promise SetVolumePromise
3481
+ * @fulfill {number} The volume was set.
3482
+ * @reject {RangeError} The volume was less than 0 or greater than 1.
3483
+ */
3484
+ /**
3485
+ * Set the volume of the player on a scale from `0` to `1`. When set
3486
+ * via the API, the volume level will not be synchronized to other
3487
+ * players or stored as the viewer’s preference.
3488
+ *
3489
+ * Most mobile devices do not support setting the volume. An error will
3490
+ * *not* be triggered in that situation.
3491
+ *
3492
+ * @param {number} volume
3493
+ * @return {SetVolumePromise}
3494
+ */
3495
+ }, {
3496
+ key: "setVolume",
3497
+ value: function setVolume(volume) {
3498
+ return this.set('volume', volume);
3499
+ }
3500
+
3501
+ /** @typedef {import('./lib/timing-object.types').TimingObject} TimingObject */
3502
+ /** @typedef {import('./lib/timing-src-connector.types').TimingSrcConnectorOptions} TimingSrcConnectorOptions */
3503
+ /** @typedef {import('./lib/timing-src-connector').TimingSrcConnector} TimingSrcConnector */
3504
+
3505
+ /**
3506
+ * Connects a TimingObject to the video player (https://webtiming.github.io/timingobject/)
3507
+ *
3508
+ * @param {TimingObject} timingObject
3509
+ * @param {TimingSrcConnectorOptions} options
3510
+ *
3511
+ * @return {Promise<TimingSrcConnector>}
3512
+ */
3513
+ }, {
3514
+ key: "setTimingSrc",
3515
+ value: function () {
3516
+ var _setTimingSrc = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(timingObject, options) {
3517
+ var _this6 = this;
3518
+ var connector;
3519
+ return _regeneratorRuntime().wrap(function _callee$(_context) {
3520
+ while (1) switch (_context.prev = _context.next) {
3521
+ case 0:
3522
+ if (timingObject) {
3523
+ _context.next = 2;
3524
+ break;
3525
+ }
3526
+ throw new TypeError('A Timing Object must be provided.');
3527
+ case 2:
3528
+ _context.next = 4;
3529
+ return this.ready();
3530
+ case 4:
3531
+ connector = new TimingSrcConnector(this, timingObject, options);
3532
+ postMessage(this, 'notifyTimingObjectConnect');
3533
+ connector.addEventListener('disconnect', function () {
3534
+ return postMessage(_this6, 'notifyTimingObjectDisconnect');
3535
+ });
3536
+ return _context.abrupt("return", connector);
3537
+ case 8:
3538
+ case "end":
3539
+ return _context.stop();
3540
+ }
3541
+ }, _callee, this);
3542
+ }));
3543
+ function setTimingSrc(_x, _x2) {
3544
+ return _setTimingSrc.apply(this, arguments);
3545
+ }
3546
+ return setTimingSrc;
3547
+ }()
3548
+ }]);
3549
+ return Player;
3550
+ }(); // Setup embed only if this is not a node environment
3551
+
3552
+ if (!isNode) {
3553
+ screenfull = initializeScreenfull();
3554
+ initializeEmbeds();
3555
+ resizeEmbeds();
3556
+ initAppendVideoMetadata();
3557
+ checkUrlTimeParam();
3558
+ }
3559
+
3560
+ return Player;
3561
+
3562
+ })));