@webitel/ui-sdk 25.12.79 → 26.2.0-1

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 (189) hide show
  1. package/dist/{install-CRbNkh_i.js → install-B9M-ZqxA.js} +21546 -21380
  2. package/dist/plyr-B0Ha1r7X.js +4152 -0
  3. package/dist/ui-sdk.css +1 -1
  4. package/dist/ui-sdk.js +1 -1
  5. package/dist/ui-sdk.umd.cjs +900 -887
  6. package/dist/{vidstack-Bq6c3Bam-DnntDKqk.js → vidstack-Bq6c3Bam-uJBwzXIY.js} +17 -17
  7. package/dist/{vidstack-D2pY00kU-Ciu2Iq-a.js → vidstack-D2pY00kU-CCxj_LQ0.js} +22 -22
  8. package/dist/{vidstack-DDXt6fpN-Qeuu3enP.js → vidstack-DDXt6fpN-ssZsNWDK.js} +4 -4
  9. package/dist/{vidstack-D_-9AA6_-DDREtIe7.js → vidstack-D_-9AA6_-IdSwTpOc.js} +1 -1
  10. package/dist/vidstack-DqAw8m9J-CgqSPNym.js +29 -0
  11. package/dist/{vidstack-audio-QtBceTAC.js → vidstack-audio-B7dtm36k.js} +2 -2
  12. package/dist/{vidstack-dash-Dab5AKoh.js → vidstack-dash-CYEsxTxk.js} +3 -3
  13. package/dist/{vidstack-google-cast-F7CV0tuD.js → vidstack-google-cast-BxXxUoUz.js} +10 -10
  14. package/dist/{vidstack-hls-C36x2qP7.js → vidstack-hls-DqolxsWc.js} +11 -11
  15. package/dist/{vidstack-video-Du0ZCqVE.js → vidstack-video-c7YjrOuW.js} +8 -8
  16. package/dist/{vidstack-vimeo-D0_aktMu.js → vidstack-vimeo-DQlaaskX.js} +22 -22
  17. package/dist/{vidstack-youtube-BBjfoGW2.js → vidstack-youtube-B7fNaTqG.js} +29 -29
  18. package/dist/{vuex.esm-bundler-YoPhVVuJ.js → vuex.esm-bundler-BmZywXo-.js} +1 -1
  19. package/package.json +67 -47
  20. package/types/api/history/index.d.ts +2 -0
  21. package/types/api/history/transcript/callTranscript.d.ts +15 -0
  22. package/types/components/on-demand/wt-cc-agent-status-timers/wt-cc-agent-status-timers.vue.d.ts +32 -7
  23. package/types/components/on-demand/wt-chat-emoji/wt-chat-emoji.vue.d.ts +18 -7
  24. package/types/components/on-demand/wt-display-chip-items/wt-display-chip-items.vue.d.ts +7 -6
  25. package/types/components/on-demand/wt-navigation-menu/components/_internals/nav-menu-lvl-1.vue.d.ts +34 -9
  26. package/types/components/on-demand/wt-navigation-menu/components/_internals/nav-menu-lvl-2.vue.d.ts +14 -6
  27. package/types/components/on-demand/wt-navigation-menu/components/wt-navigation-menu.vue.d.ts +30 -8
  28. package/types/components/on-demand/wt-route-transition/wt-route-transition.vue.d.ts +3 -2
  29. package/types/components/on-demand/wt-save-failed-popup/wt-save-failed-popup.vue.d.ts +3 -2
  30. package/types/components/on-demand/wt-selection-popup/wt-selection-popup.vue.d.ts +52 -11
  31. package/types/components/on-demand/wt-start-page/components/start-page-card.vue.d.ts +12 -6
  32. package/types/components/on-demand/wt-start-page/components/start-page-logo.vue.d.ts +12 -6
  33. package/types/components/on-demand/wt-start-page/components/wt-start-page.vue.d.ts +2 -1
  34. package/types/components/on-demand/wt-table-transition/wt-table-transition.vue.d.ts +3 -2
  35. package/types/components/on-demand/wt-type-extension-value-input/wt-type-extension-value-input.vue.d.ts +13 -11
  36. package/types/components/transitions/cases/wt-replace-transition.vue.d.ts +40 -9
  37. package/types/components/transitions/wt-expand-transition.vue.d.ts +3 -2
  38. package/types/components/transitions/wt-transition.vue.d.ts +38 -9
  39. package/types/components/wt-action-bar/wt-action-bar.vue.d.ts +76 -12
  40. package/types/components/wt-app-header/wt-app-header.vue.d.ts +3 -2
  41. package/types/components/wt-app-header/wt-app-navigator.vue.d.ts +28 -9
  42. package/types/components/wt-app-header/wt-header-actions.vue.d.ts +3 -2
  43. package/types/components/wt-avatar/wt-avatar.vue.d.ts +72 -13
  44. package/types/components/wt-badge/wt-badge.vue.d.ts +3 -2
  45. package/types/components/wt-badge-new/wt-badge.vue.d.ts +5 -4
  46. package/types/components/wt-breadcrumb/wt-breadcrumb.vue.d.ts +2 -1
  47. package/types/components/wt-button/wt-button.vue.d.ts +7 -6
  48. package/types/components/wt-button-select/wt-button-select.vue.d.ts +50 -10
  49. package/types/components/wt-checkbox/wt-checkbox.vue.d.ts +7 -5
  50. package/types/components/wt-chip/wt-chip.vue.d.ts +5 -4
  51. package/types/components/wt-confirm-dialog/wt-confirm-dialog.vue.d.ts +44 -12
  52. package/types/components/wt-context-menu/wt-context-menu.vue.d.ts +80 -17
  53. package/types/components/wt-copy-action/wt-copy-action.vue.d.ts +3 -2
  54. package/types/components/wt-datepicker/wt-datepicker.vue.d.ts +119 -21
  55. package/types/components/wt-divider/wt-divider.vue.d.ts +2 -1
  56. package/types/components/wt-dual-panel/wt-dual-panel.vue.d.ts +34 -9
  57. package/types/components/wt-dummy/wt-dummy.vue.d.ts +60 -16
  58. package/types/components/wt-empty/wt-empty.vue.d.ts +132 -16
  59. package/types/components/wt-error-page/wt-error-page.vue.d.ts +3 -2
  60. package/types/components/wt-expansion-panel/wt-expansion-panel.vue.d.ts +28 -8
  61. package/types/components/wt-filters-panel-wrapper/wt-filters-panel-wrapper.vue.d.ts +3 -2
  62. package/types/components/wt-galleria/wt-galleria.vue.d.ts +4 -2
  63. package/types/components/wt-headline/wt-headline.vue.d.ts +2 -1
  64. package/types/components/wt-headline-nav/__tests__/wt-headline-nav.spec.d.ts +1 -0
  65. package/types/components/wt-headline-nav/wt-headline-nav.vue.d.ts +7 -0
  66. package/types/components/wt-hint/wt-hint.vue.d.ts +3 -2
  67. package/types/components/wt-icon/wt-icon.vue.d.ts +2 -1
  68. package/types/components/wt-icon-action/wt-icon-action.vue.d.ts +46 -10
  69. package/types/components/wt-icon-btn/wt-icon-btn.vue.d.ts +2 -1
  70. package/types/components/wt-image/wt-image.vue.d.ts +3 -2
  71. package/types/components/wt-indicator/wt-indicator.vue.d.ts +3 -2
  72. package/types/components/wt-input/wt-input.vue.d.ts +9 -8
  73. package/types/components/wt-input-info/wt-input-info.vue.d.ts +3 -2
  74. package/types/components/wt-intersection-observer/wt-intersection-observer.vue.d.ts +2 -1
  75. package/types/components/wt-item-link/wt-item-link.vue.d.ts +82 -13
  76. package/types/components/wt-label/wt-label.vue.d.ts +3 -2
  77. package/types/components/wt-load-bar/wt-load-bar.vue.d.ts +3 -2
  78. package/types/components/wt-loader/_internals/wt-brand-loader.vue.d.ts +2 -1
  79. package/types/components/wt-loader/_internals/wt-loader--md.vue.d.ts +2 -0
  80. package/types/components/wt-loader/_internals/wt-loader--sm.vue.d.ts +16 -0
  81. package/types/components/wt-loader/_internals/wt-spinner-loader.vue.d.ts +3 -2
  82. package/types/components/wt-loader/wt-loader.vue.d.ts +3 -2
  83. package/types/components/wt-logo/wt-logo.vue.d.ts +38 -9
  84. package/types/components/wt-menubar/wt-menubar.vue.d.ts +3 -3
  85. package/types/components/wt-navigation-bar/wt-navigation-bar.vue.d.ts +3 -2
  86. package/types/components/wt-notification/wt-notification.vue.d.ts +3 -2
  87. package/types/components/wt-notifications-bar/wt-notifications-bar.vue.d.ts +3 -2
  88. package/types/components/wt-page-header/wt-page-header.vue.d.ts +62 -17
  89. package/types/components/wt-page-wrapper/wt-page-wrapper.vue.d.ts +3 -2
  90. package/types/components/wt-pagination/wt-pagination.vue.d.ts +3 -2
  91. package/types/components/wt-player/wt-player.vue.d.ts +4 -3
  92. package/types/components/wt-popover/wt-popover.vue.d.ts +5 -4
  93. package/types/components/wt-popup/wt-popup.vue.d.ts +4 -3
  94. package/types/components/wt-progress-bar/wt-progress-bar.vue.d.ts +3 -2
  95. package/types/components/wt-radio/wt-radio.vue.d.ts +7 -5
  96. package/types/components/wt-rounded-action/wt-rounded-action.vue.d.ts +112 -18
  97. package/types/components/wt-search-bar/wt-search-bar.vue.d.ts +7 -6
  98. package/types/components/wt-select/wt-select-v2.vue.d.ts +72 -15
  99. package/types/components/wt-select/wt-select.vue.d.ts +3 -2
  100. package/types/components/wt-slider/wt-slider.vue.d.ts +4 -2
  101. package/types/components/wt-status-select/wt-status-select.vue.d.ts +3 -2
  102. package/types/components/wt-stepper/wt-stepper.vue.d.ts +20 -8
  103. package/types/components/wt-switcher/wt-switcher.vue.d.ts +7 -5
  104. package/types/components/wt-table/wt-table.vue.d.ts +17 -16
  105. package/types/components/wt-table-actions/wt-table-actions.vue.d.ts +3 -2
  106. package/types/components/wt-table-column-select/wt-table-column-select.vue.d.ts +3 -2
  107. package/types/components/wt-tabs/wt-tabs.vue.d.ts +3 -2
  108. package/types/components/wt-tags-input/wt-tags-input.vue.d.ts +3 -2
  109. package/types/components/wt-textarea/wt-textarea.vue.d.ts +8 -6
  110. package/types/components/wt-time-input/wt-time-input.vue.d.ts +3 -2
  111. package/types/components/wt-timepicker/wt-timepicker.vue.d.ts +4 -3
  112. package/types/components/wt-tooltip/_internals/wt-tooltip-floating.vue.d.ts +20 -7
  113. package/types/components/wt-tooltip/wt-tooltip.vue.d.ts +66 -13
  114. package/types/components/wt-tree/wt-tree.vue.d.ts +5 -4
  115. package/types/components/wt-tree-line/wt-tree-line.vue.d.ts +7 -6
  116. package/types/components/wt-tree-table/wt-tree-table.vue.d.ts +8 -7
  117. package/types/components/wt-tree-table-row/wt-tree-table-row.vue.d.ts +6 -5
  118. package/types/components/wt-vidstack-player/components/buttons/fullscreen-button.vue.d.ts +2 -1
  119. package/types/components/wt-vidstack-player/components/buttons/play-button.vue.d.ts +2 -1
  120. package/types/components/wt-vidstack-player/components/controls-group/controls-group.vue.d.ts +5 -4
  121. package/types/components/wt-vidstack-player/components/layouts/video-layout.vue.d.ts +6 -5
  122. package/types/components/wt-vidstack-player/components/panels/media-control-panel/components/buttons/fullscreen-button.vue.d.ts +6 -0
  123. package/types/components/wt-vidstack-player/components/panels/media-control-panel/components/buttons/play-button.vue.d.ts +2 -0
  124. package/types/components/wt-vidstack-player/components/panels/media-control-panel/components/sliders/time-slider.vue.d.ts +2 -0
  125. package/types/components/wt-vidstack-player/components/panels/media-control-panel/components/time-group.vue.d.ts +2 -0
  126. package/types/components/wt-vidstack-player/components/panels/media-control-panel/media-control-panel.vue.d.ts +2 -0
  127. package/types/components/wt-vidstack-player/components/panels/media-controls-panel/components/buttons/fullscreen-button.vue.d.ts +2 -1
  128. package/types/components/wt-vidstack-player/components/panels/media-controls-panel/components/buttons/play-button.vue.d.ts +2 -1
  129. package/types/components/wt-vidstack-player/components/panels/media-controls-panel/components/sliders/time-slider.vue.d.ts +2 -1
  130. package/types/components/wt-vidstack-player/components/panels/media-controls-panel/components/time-group.vue.d.ts +2 -1
  131. package/types/components/wt-vidstack-player/components/panels/media-controls-panel/media-controls-panel.vue.d.ts +2 -1
  132. package/types/components/wt-vidstack-player/components/panels/screen-sharing-control-panel/screen-sharing-control-panel.vue.d.ts +17 -0
  133. package/types/components/wt-vidstack-player/components/panels/screen-sharing-controls-panel/screen-sharing-controls-panel.vue.d.ts +2 -1
  134. package/types/components/wt-vidstack-player/components/panels/video-call-controls-panel/video-call-controls-panel.vue.d.ts +2 -1
  135. package/types/components/wt-vidstack-player/components/panels/video-display-panel/video-display-panel.vue.d.ts +2 -1
  136. package/types/components/wt-vidstack-player/components/recording-indicator/recording-indicator.vue.d.ts +2 -1
  137. package/types/components/wt-vidstack-player/components/screenshot-box/screenshot-box.vue.d.ts +2 -1
  138. package/types/components/wt-vidstack-player/components/toggle-button.vue.d.ts +2 -1
  139. package/types/components/wt-vidstack-player/types/ScreenshotStatus.d.ts +1 -0
  140. package/types/components/wt-vidstack-player/wt-vidstack-player.vue.d.ts +7 -6
  141. package/types/locale/ua/ua.d.ts +911 -0
  142. package/types/modules/AgentPdfs/components/agent-pdfs-tab.vue.d.ts +3 -2
  143. package/types/modules/AgentPdfs/components/pdf-status-preview.vue.d.ts +2 -1
  144. package/types/modules/AgentPdfs/components/pdf-status.vue.d.ts +2 -1
  145. package/types/modules/AgentStatusSelect/components/_internals/wt-cc-pause-cause-popup.vue.d.ts +20 -7
  146. package/types/modules/AgentStatusSelect/components/_internals/wt-cc-status-select-error-popup.vue.d.ts +16 -7
  147. package/types/modules/AgentStatusSelect/components/wt-cc-agent-status-select.vue.d.ts +32 -10
  148. package/types/modules/Appearance/components/wt-dark-mode-switcher.vue.d.ts +18 -7
  149. package/types/modules/AuditForm/components/audit-form-question-read-wrapper.vue.d.ts +4 -2
  150. package/types/modules/AuditForm/components/audit-form-question-write-wrapper.vue.d.ts +2 -1
  151. package/types/modules/AuditForm/components/audit-form-question.vue.d.ts +4 -2
  152. package/types/modules/AuditForm/components/audit-form.vue.d.ts +4 -2
  153. package/types/modules/AuditForm/components/form/form-footer/audit-form-footer.vue.d.ts +2 -1
  154. package/types/modules/AuditForm/components/form-answers/answer-editing-info/audit-form-answer-editing-info.vue.d.ts +2 -1
  155. package/types/modules/AuditForm/components/form-questions/options/audit-form-question-options-write-row.vue.d.ts +28 -9
  156. package/types/modules/AuditForm/components/form-questions/options/audit-form-question-options.vue.d.ts +4 -2
  157. package/types/modules/AuditForm/components/form-questions/score/audit-form-question-score.vue.d.ts +2 -1
  158. package/types/modules/CallSession/modules/ScreenSharing/screen-sharing.vue.d.ts +2 -1
  159. package/types/modules/CallSession/modules/VideoCall/video-call.vue.d.ts +28 -10
  160. package/types/modules/DeleteConfirmationPopup/components/delete-confirmation-popup.vue.d.ts +24 -9
  161. package/types/modules/FilesExport/FilesExport.d.ts +1 -3
  162. package/types/modules/FilesExport/scripts/generateMediaURL.d.ts +2 -0
  163. package/types/modules/Filters/components/filter-datetime.vue.d.ts +20 -8
  164. package/types/modules/Filters/components/filter-pagination.vue.d.ts +22 -8
  165. package/types/modules/Filters/components/filter-search.vue.d.ts +38 -10
  166. package/types/modules/Filters/components/filter-select.vue.d.ts +20 -8
  167. package/types/modules/Filters/components/filter-table-fields.vue.d.ts +34 -11
  168. package/types/modules/ObjectPermissions/_internals/components/permissions-role-row.vue.d.ts +12 -6
  169. package/types/modules/ObjectPermissions/_internals/components/permissions-role-select.vue.d.ts +9 -1
  170. package/types/modules/ObjectPermissions/_internals/components/permissions-tab-role-popup.vue.d.ts +12 -6
  171. package/types/modules/ObjectPermissions/components/permissions-tab.vue.d.ts +44 -8
  172. package/types/modules/QueryFilters/components/abstract-api-filter.vue.d.ts +3 -2
  173. package/types/modules/QueryFilters/components/abstract-enum-filter.vue.d.ts +3 -2
  174. package/types/modules/QueryFilters/components/filter-datetime.vue.d.ts +3 -2
  175. package/types/modules/QueryFilters/components/filter-from-to.vue.d.ts +3 -2
  176. package/types/modules/QueryFilters/components/filter-search.vue.d.ts +3 -2
  177. package/types/modules/QueryFilters/components/filter-table-fields.vue.d.ts +3 -2
  178. package/types/playground.vue.d.ts +2 -1
  179. package/types/plugins/primevue/theme/extend/extend.d.ts +5 -0
  180. package/types/plugins/primevue/theme/extend/spacings/spacings.d.ts +13 -0
  181. package/types/plugins/primevue/theme/semantic/color-scheme/color-schema.d.ts +1189 -0
  182. package/types/plugins/primevue/theme/semantic/color-scheme/dark-color.d.ts +162 -0
  183. package/types/plugins/primevue/theme/semantic/color-scheme/light-color.d.ts +162 -0
  184. package/types/plugins/primevue/theme/semantic/color-scheme/palette.d.ts +435 -0
  185. package/types/plugins/primevue/theme/semantic/semantic.d.ts +5 -0
  186. package/types/scripts/caseConverters.d.ts +1 -1
  187. package/types/the-app.vue.d.ts +3 -2
  188. package/dist/plyr-dBBD5QAl.js +0 -4350
  189. package/dist/vidstack-DqAw8m9J-C4fRnvp8.js +0 -29
@@ -0,0 +1,4152 @@
1
+ function m(e, i, t) {
2
+ return (i = bt(i)) in e ? Object.defineProperty(e, i, {
3
+ value: t,
4
+ enumerable: !0,
5
+ configurable: !0,
6
+ writable: !0
7
+ }) : e[i] = t, e;
8
+ }
9
+ function gt(e, i) {
10
+ if (typeof e != "object" || !e) return e;
11
+ var t = e[Symbol.toPrimitive];
12
+ if (t !== void 0) {
13
+ var s = t.call(e, i);
14
+ if (typeof s != "object") return s;
15
+ throw new TypeError("@@toPrimitive must return a primitive value.");
16
+ }
17
+ return (i === "string" ? String : Number)(e);
18
+ }
19
+ function bt(e) {
20
+ var i = gt(e, "string");
21
+ return typeof i == "symbol" ? i : i + "";
22
+ }
23
+ function yt(e, i) {
24
+ if (!(e instanceof i)) throw new TypeError("Cannot call a class as a function");
25
+ }
26
+ function Oe(e, i) {
27
+ for (var t = 0; t < i.length; t++) {
28
+ var s = i[t];
29
+ s.enumerable = s.enumerable || !1, s.configurable = !0, "value" in s && (s.writable = !0), Object.defineProperty(e, s.key, s);
30
+ }
31
+ }
32
+ function vt(e, i, t) {
33
+ return i && Oe(e.prototype, i), t && Oe(e, t), e;
34
+ }
35
+ function wt(e, i, t) {
36
+ return i in e ? Object.defineProperty(e, i, {
37
+ value: t,
38
+ enumerable: !0,
39
+ configurable: !0,
40
+ writable: !0
41
+ }) : e[i] = t, e;
42
+ }
43
+ function _e(e, i) {
44
+ var t = Object.keys(e);
45
+ if (Object.getOwnPropertySymbols) {
46
+ var s = Object.getOwnPropertySymbols(e);
47
+ i && (s = s.filter(function(n) {
48
+ return Object.getOwnPropertyDescriptor(e, n).enumerable;
49
+ })), t.push.apply(t, s);
50
+ }
51
+ return t;
52
+ }
53
+ function je(e) {
54
+ for (var i = 1; i < arguments.length; i++) {
55
+ var t = arguments[i] != null ? arguments[i] : {};
56
+ i % 2 ? _e(Object(t), !0).forEach(function(s) {
57
+ wt(e, s, t[s]);
58
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : _e(Object(t)).forEach(function(s) {
59
+ Object.defineProperty(e, s, Object.getOwnPropertyDescriptor(t, s));
60
+ });
61
+ }
62
+ return e;
63
+ }
64
+ var De = {
65
+ addCSS: !0,
66
+ thumbWidth: 15,
67
+ watch: !0
68
+ };
69
+ function kt(e, i) {
70
+ return (function() {
71
+ return Array.from(document.querySelectorAll(i)).includes(this);
72
+ }).call(e, i);
73
+ }
74
+ function Tt(e, i) {
75
+ if (e && i) {
76
+ var t = new Event(i, {
77
+ bubbles: !0
78
+ });
79
+ e.dispatchEvent(t);
80
+ }
81
+ }
82
+ var ie = function(e) {
83
+ return e != null ? e.constructor : null;
84
+ }, Me = function(e, i) {
85
+ return !!(e && i && e instanceof i);
86
+ }, Be = function(e) {
87
+ return e == null;
88
+ }, We = function(e) {
89
+ return ie(e) === Object;
90
+ }, Ct = function(e) {
91
+ return ie(e) === Number && !Number.isNaN(e);
92
+ }, ze = function(e) {
93
+ return ie(e) === String;
94
+ }, At = function(e) {
95
+ return ie(e) === Boolean;
96
+ }, Et = function(e) {
97
+ return ie(e) === Function;
98
+ }, Ke = function(e) {
99
+ return Array.isArray(e);
100
+ }, Ye = function(e) {
101
+ return Me(e, NodeList);
102
+ }, St = function(e) {
103
+ return Me(e, Element);
104
+ }, Pt = function(e) {
105
+ return Me(e, Event);
106
+ }, Mt = function(e) {
107
+ return Be(e) || (ze(e) || Ke(e) || Ye(e)) && !e.length || We(e) && !Object.keys(e).length;
108
+ }, D = {
109
+ nullOrUndefined: Be,
110
+ object: We,
111
+ number: Ct,
112
+ string: ze,
113
+ boolean: At,
114
+ function: Et,
115
+ array: Ke,
116
+ nodeList: Ye,
117
+ element: St,
118
+ event: Pt,
119
+ empty: Mt
120
+ };
121
+ function Nt(e) {
122
+ var i = "".concat(e).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);
123
+ return i ? Math.max(0, (i[1] ? i[1].length : 0) - (i[2] ? +i[2] : 0)) : 0;
124
+ }
125
+ function xt(e, i) {
126
+ if (1 > i) {
127
+ var t = Nt(i);
128
+ return parseFloat(e.toFixed(t));
129
+ }
130
+ return Math.round(e / i) * i;
131
+ }
132
+ var Lt = (function() {
133
+ function e(i, t) {
134
+ yt(this, e), D.element(i) ? this.element = i : D.string(i) && (this.element = document.querySelector(i)), D.element(this.element) && D.empty(this.element.rangeTouch) && (this.config = je({}, De, {}, t), this.init());
135
+ }
136
+ return vt(e, [{
137
+ key: "init",
138
+ value: function() {
139
+ e.enabled && (this.config.addCSS && (this.element.style.userSelect = "none", this.element.style.webKitUserSelect = "none", this.element.style.touchAction = "manipulation"), this.listeners(!0), this.element.rangeTouch = this);
140
+ }
141
+ }, {
142
+ key: "destroy",
143
+ value: function() {
144
+ e.enabled && (this.config.addCSS && (this.element.style.userSelect = "", this.element.style.webKitUserSelect = "", this.element.style.touchAction = ""), this.listeners(!1), this.element.rangeTouch = null);
145
+ }
146
+ }, {
147
+ key: "listeners",
148
+ value: function(i) {
149
+ var t = this, s = i ? "addEventListener" : "removeEventListener";
150
+ ["touchstart", "touchmove", "touchend"].forEach(function(n) {
151
+ t.element[s](n, function(r) {
152
+ return t.set(r);
153
+ }, !1);
154
+ });
155
+ }
156
+ }, {
157
+ key: "get",
158
+ value: function(i) {
159
+ if (!e.enabled || !D.event(i)) return null;
160
+ var t, s = i.target, n = i.changedTouches[0], r = parseFloat(s.getAttribute("min")) || 0, l = parseFloat(s.getAttribute("max")) || 100, o = parseFloat(s.getAttribute("step")) || 1, c = s.getBoundingClientRect(), u = 100 / c.width * (this.config.thumbWidth / 2) / 100;
161
+ return 0 > (t = 100 / c.width * (n.clientX - c.left)) ? t = 0 : 100 < t && (t = 100), 50 > t ? t -= (100 - 2 * t) * u : 50 < t && (t += 2 * (t - 50) * u), r + xt(t / 100 * (l - r), o);
162
+ }
163
+ }, {
164
+ key: "set",
165
+ value: function(i) {
166
+ e.enabled && D.event(i) && !i.target.disabled && (i.preventDefault(), i.target.value = this.get(i), Tt(i.target, i.type === "touchend" ? "change" : "input"));
167
+ }
168
+ }], [{
169
+ key: "setup",
170
+ value: function(i) {
171
+ var t = 1 < arguments.length && arguments[1] !== void 0 ? arguments[1] : {}, s = null;
172
+ if (D.empty(i) || D.string(i) ? s = Array.from(document.querySelectorAll(D.string(i) ? i : 'input[type="range"]')) : D.element(i) ? s = [i] : D.nodeList(i) ? s = Array.from(i) : D.array(i) && (s = i.filter(D.element)), D.empty(s)) return null;
173
+ var n = je({}, De, {}, t);
174
+ if (D.string(i) && n.watch) {
175
+ var r = new MutationObserver(function(l) {
176
+ Array.from(l).forEach(function(o) {
177
+ Array.from(o.addedNodes).forEach(function(c) {
178
+ D.element(c) && kt(c, i) && new e(c, n);
179
+ });
180
+ });
181
+ });
182
+ r.observe(document.body, {
183
+ childList: !0,
184
+ subtree: !0
185
+ });
186
+ }
187
+ return s.map(function(l) {
188
+ return new e(l, t);
189
+ });
190
+ }
191
+ }, {
192
+ key: "enabled",
193
+ get: function() {
194
+ return "ontouchstart" in document.documentElement;
195
+ }
196
+ }]), e;
197
+ })();
198
+ const se = (e) => e !== null && typeof e < "u" ? e.constructor : null, B = (e, i) => !!(e && i && e instanceof i), Ne = (e) => e === null || typeof e > "u", Xe = (e) => se(e) === Object, $t = (e) => se(e) === Number && !Number.isNaN(e), pe = (e) => se(e) === String, It = (e) => se(e) === Boolean, Qe = (e) => typeof e == "function", Je = (e) => Array.isArray(e), Ot = (e) => B(e, WeakMap), Ge = (e) => B(e, NodeList), _t = (e) => se(e) === Text, jt = (e) => B(e, Event), Dt = (e) => B(e, KeyboardEvent), Rt = (e) => B(e, window.TextTrackCue) || B(e, window.VTTCue), Ht = (e) => B(e, TextTrack) || !Ne(e) && pe(e.kind), qt = (e) => B(e, Promise) && Qe(e.then);
199
+ function Vt(e) {
200
+ return e !== null && typeof e == "object" && e.nodeType === 1 && typeof e.style == "object" && typeof e.ownerDocument == "object";
201
+ }
202
+ function Ze(e) {
203
+ return Ne(e) || (pe(e) || Je(e) || Ge(e)) && !e.length || Xe(e) && !Object.keys(e).length;
204
+ }
205
+ function Ft(e) {
206
+ if (B(e, window.URL))
207
+ return !0;
208
+ if (!pe(e))
209
+ return !1;
210
+ let i = e;
211
+ (!e.startsWith("http://") || !e.startsWith("https://")) && (i = `http://${e}`);
212
+ try {
213
+ return !Ze(new URL(i).hostname);
214
+ } catch {
215
+ return !1;
216
+ }
217
+ }
218
+ var a = {
219
+ nullOrUndefined: Ne,
220
+ object: Xe,
221
+ number: $t,
222
+ string: pe,
223
+ boolean: It,
224
+ function: Qe,
225
+ array: Je,
226
+ weakMap: Ot,
227
+ nodeList: Ge,
228
+ element: Vt,
229
+ textNode: _t,
230
+ event: jt,
231
+ keyboardEvent: Dt,
232
+ cue: Rt,
233
+ track: Ht,
234
+ promise: qt,
235
+ url: Ft,
236
+ empty: Ze
237
+ };
238
+ const ke = (() => {
239
+ const e = document.createElement("span"), i = {
240
+ WebkitTransition: "webkitTransitionEnd",
241
+ MozTransition: "transitionend",
242
+ OTransition: "oTransitionEnd otransitionend",
243
+ transition: "transitionend"
244
+ }, t = Object.keys(i).find((s) => e.style[s] !== void 0);
245
+ return a.string(t) ? i[t] : !1;
246
+ })();
247
+ function et(e, i) {
248
+ setTimeout(() => {
249
+ try {
250
+ e.hidden = !0, e.offsetHeight, e.hidden = !1;
251
+ } catch {
252
+ }
253
+ }, i);
254
+ }
255
+ function Ut(e) {
256
+ return JSON.parse(JSON.stringify(e));
257
+ }
258
+ function tt(e, i) {
259
+ return i.split(".").reduce((t, s) => t && t[s], e);
260
+ }
261
+ function L(e = {}, ...i) {
262
+ if (!i.length)
263
+ return e;
264
+ const t = i.shift();
265
+ return a.object(t) ? (Object.keys(t).forEach((s) => {
266
+ a.object(t[s]) ? (Object.keys(e).includes(s) || Object.assign(e, {
267
+ [s]: {}
268
+ }), L(e[s], t[s])) : Object.assign(e, {
269
+ [s]: t[s]
270
+ });
271
+ }), L(e, ...i)) : e;
272
+ }
273
+ function it(e, i) {
274
+ const t = e.length ? e : [e];
275
+ Array.from(t).reverse().forEach((s, n) => {
276
+ const r = n > 0 ? i.cloneNode(!0) : i, l = s.parentNode, o = s.nextSibling;
277
+ r.appendChild(s), o ? l.insertBefore(r, o) : l.appendChild(r);
278
+ });
279
+ }
280
+ function Te(e, i) {
281
+ !a.element(e) || a.empty(i) || Object.entries(i).filter(([, t]) => !a.nullOrUndefined(t)).forEach(([t, s]) => e.setAttribute(t, s));
282
+ }
283
+ function y(e, i, t) {
284
+ const s = document.createElement(e);
285
+ return a.object(i) && Te(s, i), a.string(t) && (s.textContent = t), s;
286
+ }
287
+ function Bt(e, i) {
288
+ !a.element(e) || !a.element(i) || i.parentNode.insertBefore(e, i.nextSibling);
289
+ }
290
+ function Re(e, i, t, s) {
291
+ a.element(i) && i.appendChild(y(e, t, s));
292
+ }
293
+ function U(e) {
294
+ if (a.nodeList(e) || a.array(e)) {
295
+ Array.from(e).forEach(U);
296
+ return;
297
+ }
298
+ !a.element(e) || !a.element(e.parentNode) || e.parentNode.removeChild(e);
299
+ }
300
+ function ae(e) {
301
+ if (!a.element(e)) return;
302
+ let {
303
+ length: i
304
+ } = e.childNodes;
305
+ for (; i > 0; )
306
+ e.removeChild(e.lastChild), i -= 1;
307
+ }
308
+ function ue(e, i) {
309
+ return !a.element(i) || !a.element(i.parentNode) || !a.element(e) ? null : (i.parentNode.replaceChild(e, i), e);
310
+ }
311
+ function V(e, i) {
312
+ if (!a.string(e) || a.empty(e)) return {};
313
+ const t = {}, s = L({}, i);
314
+ return e.split(",").forEach((n) => {
315
+ const r = n.trim(), l = r.replace(".", ""), c = r.replace(/[[\]]/g, "").split("="), [u] = c, p = c.length > 1 ? c[1].replace(/["']/g, "") : "";
316
+ switch (r.charAt(0)) {
317
+ case ".":
318
+ a.string(s.class) ? t.class = `${s.class} ${l}` : t.class = l;
319
+ break;
320
+ case "#":
321
+ t.id = r.replace("#", "");
322
+ break;
323
+ case "[":
324
+ t[u] = p;
325
+ break;
326
+ }
327
+ }), L(s, t);
328
+ }
329
+ function K(e, i) {
330
+ if (!a.element(e)) return;
331
+ let t = i;
332
+ a.boolean(t) || (t = !e.hidden), e.hidden = t;
333
+ }
334
+ function E(e, i, t) {
335
+ if (a.nodeList(e))
336
+ return Array.from(e).map((s) => E(s, i, t));
337
+ if (a.element(e)) {
338
+ let s = "toggle";
339
+ return typeof t < "u" && (s = t ? "add" : "remove"), e.classList[s](i), e.classList.contains(i);
340
+ }
341
+ return !1;
342
+ }
343
+ function he(e, i) {
344
+ return a.element(e) && e.classList.contains(i);
345
+ }
346
+ function Y(e, i) {
347
+ const {
348
+ prototype: t
349
+ } = Element;
350
+ function s() {
351
+ return Array.from(document.querySelectorAll(i)).includes(this);
352
+ }
353
+ return (t.matches || t.webkitMatchesSelector || t.mozMatchesSelector || t.msMatchesSelector || s).call(e, i);
354
+ }
355
+ function Wt(e, i) {
356
+ const {
357
+ prototype: t
358
+ } = Element;
359
+ function s() {
360
+ let r = this;
361
+ do {
362
+ if (Y.matches(r, i)) return r;
363
+ r = r.parentElement || r.parentNode;
364
+ } while (r !== null && r.nodeType === 1);
365
+ return null;
366
+ }
367
+ return (t.closest || s).call(e, i);
368
+ }
369
+ function Z(e) {
370
+ return this.elements.container.querySelectorAll(e);
371
+ }
372
+ function I(e) {
373
+ return this.elements.container.querySelector(e);
374
+ }
375
+ function be(e = null, i = !1) {
376
+ a.element(e) && e.focus({
377
+ preventScroll: !0,
378
+ focusVisible: i
379
+ });
380
+ }
381
+ const He = {
382
+ "audio/ogg": "vorbis",
383
+ "audio/wav": "1",
384
+ "video/webm": "vp8, vorbis",
385
+ "video/mp4": "avc1.42E01E, mp4a.40.2",
386
+ "video/ogg": "theora"
387
+ }, $ = {
388
+ // Basic support
389
+ audio: "canPlayType" in document.createElement("audio"),
390
+ video: "canPlayType" in document.createElement("video"),
391
+ // Check for support
392
+ // Basic functionality vs full UI
393
+ check(e, i) {
394
+ const t = $[e] || i !== "html5", s = t && $.rangeInput;
395
+ return {
396
+ api: t,
397
+ ui: s
398
+ };
399
+ },
400
+ // Picture-in-picture support
401
+ pip: document.pictureInPictureEnabled && !y("video").disablePictureInPicture,
402
+ // Airplay support
403
+ // Safari only currently
404
+ airplay: a.function(window.WebKitPlaybackTargetAvailabilityEvent),
405
+ // Inline playback support
406
+ // https://webkit.org/blog/6784/new-video-policies-for-ios/
407
+ playsinline: "playsInline" in document.createElement("video"),
408
+ // Check for mime type support against a player instance
409
+ // Credits: http://diveintohtml5.info/everything.html
410
+ // Related: http://www.leanbackplayer.com/test/h5mt.html
411
+ mime(e) {
412
+ if (a.empty(e))
413
+ return !1;
414
+ const [i] = e.split("/");
415
+ let t = e;
416
+ if (!this.isHTML5 || i !== this.type)
417
+ return !1;
418
+ Object.keys(He).includes(t) && (t += `; codecs="${He[e]}"`);
419
+ try {
420
+ return !!(t && this.media.canPlayType(t).replace(/no/, ""));
421
+ } catch {
422
+ return !1;
423
+ }
424
+ },
425
+ // Check for textTracks support
426
+ textTracks: "textTracks" in document.createElement("video"),
427
+ // <input type="range"> Sliders
428
+ rangeInput: (() => {
429
+ const e = document.createElement("input");
430
+ return e.type = "range", e.type === "range";
431
+ })(),
432
+ // Touch
433
+ // NOTE: Remember a device can be mouse + touch enabled so we check on first touch event
434
+ touch: "ontouchstart" in document.documentElement,
435
+ // Detect transitions support
436
+ transitions: ke !== !1,
437
+ // Reduced motion iOS & MacOS setting
438
+ // https://webkit.org/blog/7551/responsive-design-for-motion/
439
+ reducedMotion: "matchMedia" in window && window.matchMedia("(prefers-reduced-motion)").matches
440
+ }, zt = (() => {
441
+ let e = !1;
442
+ try {
443
+ const i = Object.defineProperty({}, "passive", {
444
+ get() {
445
+ return e = !0, null;
446
+ }
447
+ });
448
+ window.addEventListener("test", null, i), window.removeEventListener("test", null, i);
449
+ } catch {
450
+ }
451
+ return e;
452
+ })();
453
+ function ee(e, i, t, s = !1, n = !0, r = !1) {
454
+ if (!e || !("addEventListener" in e) || a.empty(i) || !a.function(t))
455
+ return;
456
+ const l = i.split(" ");
457
+ let o = r;
458
+ zt && (o = {
459
+ // Whether the listener can be passive (i.e. default never prevented)
460
+ passive: n,
461
+ // Whether the listener is a capturing listener or not
462
+ capture: r
463
+ }), l.forEach((c) => {
464
+ this && this.eventListeners && s && this.eventListeners.push({
465
+ element: e,
466
+ type: c,
467
+ callback: t,
468
+ options: o
469
+ }), e[s ? "addEventListener" : "removeEventListener"](c, t, o);
470
+ });
471
+ }
472
+ function T(e, i = "", t, s = !0, n = !1) {
473
+ ee.call(this, e, i, t, !0, s, n);
474
+ }
475
+ function fe(e, i = "", t, s = !0, n = !1) {
476
+ ee.call(this, e, i, t, !1, s, n);
477
+ }
478
+ function xe(e, i = "", t, s = !0, n = !1) {
479
+ const r = (...l) => {
480
+ fe(e, i, r, s, n), t.apply(this, l);
481
+ };
482
+ ee.call(this, e, i, r, !0, s, n);
483
+ }
484
+ function v(e, i = "", t = !1, s = {}) {
485
+ if (!a.element(e) || a.empty(i))
486
+ return;
487
+ const n = new CustomEvent(i, {
488
+ bubbles: t,
489
+ detail: {
490
+ ...s,
491
+ plyr: this
492
+ }
493
+ });
494
+ e.dispatchEvent(n);
495
+ }
496
+ function Kt() {
497
+ this && this.eventListeners && (this.eventListeners.forEach((e) => {
498
+ const {
499
+ element: i,
500
+ type: t,
501
+ callback: s,
502
+ options: n
503
+ } = e;
504
+ i.removeEventListener(t, s, n);
505
+ }), this.eventListeners = []);
506
+ }
507
+ function Yt() {
508
+ return new Promise((e) => this.ready ? setTimeout(e, 0) : T.call(this, this.elements.container, "ready", e)).then(() => {
509
+ });
510
+ }
511
+ function F(e) {
512
+ a.promise(e) && e.then(null, () => {
513
+ });
514
+ }
515
+ function Ce(e) {
516
+ return a.array(e) ? e.filter((i, t) => e.indexOf(i) === t) : e;
517
+ }
518
+ function st(e, i) {
519
+ return !a.array(e) || !e.length ? null : e.reduce((t, s) => Math.abs(s - i) < Math.abs(t - i) ? s : t);
520
+ }
521
+ function nt(e) {
522
+ return !window || !window.CSS ? !1 : window.CSS.supports(e);
523
+ }
524
+ const qe = [[1, 1], [4, 3], [3, 4], [5, 4], [4, 5], [3, 2], [2, 3], [16, 10], [10, 16], [16, 9], [9, 16], [21, 9], [9, 21], [32, 9], [9, 32]].reduce((e, [i, t]) => ({
525
+ ...e,
526
+ [i / t]: [i, t]
527
+ }), {});
528
+ function rt(e) {
529
+ return !a.array(e) && (!a.string(e) || !e.includes(":")) ? !1 : (a.array(e) ? e : e.split(":")).map(Number).every(a.number);
530
+ }
531
+ function de(e) {
532
+ if (!a.array(e) || !e.every(a.number))
533
+ return null;
534
+ const [i, t] = e, s = (r, l) => l === 0 ? r : s(l, r % l), n = s(i, t);
535
+ return [i / n, t / n];
536
+ }
537
+ function Le(e) {
538
+ const i = (s) => rt(s) ? s.split(":").map(Number) : null;
539
+ let t = i(e);
540
+ if (t === null && (t = i(this.config.ratio)), t === null && !a.empty(this.embed) && a.array(this.embed.ratio) && ({
541
+ ratio: t
542
+ } = this.embed), t === null && this.isHTML5) {
543
+ const {
544
+ videoWidth: s,
545
+ videoHeight: n
546
+ } = this.media;
547
+ t = [s, n];
548
+ }
549
+ return de(t);
550
+ }
551
+ function X(e) {
552
+ if (!this.isVideo)
553
+ return {};
554
+ const {
555
+ wrapper: i
556
+ } = this.elements, t = Le.call(this, e);
557
+ if (!a.array(t))
558
+ return {};
559
+ const [s, n] = de(t), r = nt(`aspect-ratio: ${s}/${n}`), l = 100 / s * n;
560
+ if (r ? i.style.aspectRatio = `${s}/${n}` : i.style.paddingBottom = `${l}%`, this.isVimeo && !this.config.vimeo.premium && this.supported.ui) {
561
+ const o = 100 / this.media.offsetWidth * Number.parseInt(window.getComputedStyle(this.media).paddingBottom, 10), c = (o - l) / (o / 50);
562
+ this.fullscreen.active ? i.style.paddingBottom = null : this.media.style.transform = `translateY(-${c}%)`;
563
+ } else this.isHTML5 && i.classList.add(this.config.classNames.videoFixedRatio);
564
+ return {
565
+ padding: l,
566
+ ratio: t
567
+ };
568
+ }
569
+ function at(e, i, t = 0.05) {
570
+ const s = e / i, n = st(Object.keys(qe), s);
571
+ return Math.abs(n - s) <= t ? qe[n] : [e, i];
572
+ }
573
+ function Xt() {
574
+ const e = Math.max(document.documentElement.clientWidth || 0, window.innerWidth || 0), i = Math.max(document.documentElement.clientHeight || 0, window.innerHeight || 0);
575
+ return [e, i];
576
+ }
577
+ const z = {
578
+ getSources() {
579
+ return this.isHTML5 ? Array.from(this.media.querySelectorAll("source")).filter((i) => {
580
+ const t = i.getAttribute("type");
581
+ return a.empty(t) ? !0 : $.mime.call(this, t);
582
+ }) : [];
583
+ },
584
+ // Get quality levels
585
+ getQualityOptions() {
586
+ return this.config.quality.forced ? this.config.quality.options : z.getSources.call(this).map((e) => Number(e.getAttribute("size"))).filter(Boolean);
587
+ },
588
+ setup() {
589
+ if (!this.isHTML5)
590
+ return;
591
+ const e = this;
592
+ e.options.speed = e.config.speed.options, a.empty(this.config.ratio) || X.call(e), Object.defineProperty(e.media, "quality", {
593
+ get() {
594
+ const t = z.getSources.call(e).find((s) => s.getAttribute("src") === e.source);
595
+ return t && Number(t.getAttribute("size"));
596
+ },
597
+ set(i) {
598
+ if (e.quality !== i) {
599
+ if (e.config.quality.forced && a.function(e.config.quality.onChange))
600
+ e.config.quality.onChange(i);
601
+ else {
602
+ const s = z.getSources.call(e).find((u) => Number(u.getAttribute("size")) === i);
603
+ if (!s)
604
+ return;
605
+ const {
606
+ currentTime: n,
607
+ paused: r,
608
+ preload: l,
609
+ readyState: o,
610
+ playbackRate: c
611
+ } = e.media;
612
+ e.media.src = s.getAttribute("src"), (l !== "none" || o) && (e.once("loadedmetadata", () => {
613
+ e.speed = c, e.currentTime = n, r || F(e.play());
614
+ }), e.media.load());
615
+ }
616
+ v.call(e, e.media, "qualitychange", !1, {
617
+ quality: i
618
+ });
619
+ }
620
+ }
621
+ });
622
+ },
623
+ // Cancel current network requests
624
+ // See https://github.com/sampotts/plyr/issues/174
625
+ cancelRequests() {
626
+ this.isHTML5 && (U(z.getSources.call(this)), this.media.setAttribute("src", this.config.blankVideo), this.media.load(), this.debug.log("Cancelled network requests"));
627
+ }
628
+ }, Qt = !!window.document.documentMode, Jt = /Edge/.test(navigator.userAgent), Gt = "WebkitAppearance" in document.documentElement.style && !/Edge/.test(navigator.userAgent), Zt = navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1, ei = /iPad|iPhone|iPod/i.test(navigator.userAgent) && navigator.maxTouchPoints > 1;
629
+ var _ = {
630
+ isIE: Qt,
631
+ isEdge: Jt,
632
+ isWebKit: Gt,
633
+ isIPadOS: Zt,
634
+ isIos: ei
635
+ };
636
+ function ti(e) {
637
+ return `${e}-${Math.floor(Math.random() * 1e4)}`;
638
+ }
639
+ function Ae(e, ...i) {
640
+ return a.empty(e) ? e : e.toString().replace(/\{(\d+)\}/g, (t, s) => i[s].toString());
641
+ }
642
+ function ii(e, i) {
643
+ return e === 0 || i === 0 || Number.isNaN(e) || Number.isNaN(i) ? 0 : (e / i * 100).toFixed(2);
644
+ }
645
+ function G(e = "", i = "", t = "") {
646
+ return e.replace(new RegExp(i.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g, "\\$1"), "g"), t.toString());
647
+ }
648
+ function lt(e = "") {
649
+ return e.toString().replace(/\w\S*/g, (i) => i.charAt(0).toUpperCase() + i.slice(1).toLowerCase());
650
+ }
651
+ function si(e = "") {
652
+ let i = e.toString();
653
+ return i = G(i, "-", " "), i = G(i, "_", " "), i = lt(i), G(i, " ", "");
654
+ }
655
+ function ni(e = "") {
656
+ let i = e.toString();
657
+ return i = si(i), i.charAt(0).toLowerCase() + i.slice(1);
658
+ }
659
+ function ri(e) {
660
+ const i = document.createDocumentFragment(), t = document.createElement("div");
661
+ return i.appendChild(t), t.innerHTML = e, i.firstChild.textContent;
662
+ }
663
+ function ai(e) {
664
+ const i = document.createElement("div");
665
+ return i.appendChild(e), i.innerHTML;
666
+ }
667
+ const Ve = {
668
+ pip: "PIP",
669
+ airplay: "AirPlay",
670
+ html5: "HTML5",
671
+ vimeo: "Vimeo",
672
+ youtube: "YouTube"
673
+ }, O = {
674
+ get(e = "", i = {}) {
675
+ if (a.empty(e) || a.empty(i))
676
+ return "";
677
+ let t = tt(i.i18n, e);
678
+ if (a.empty(t))
679
+ return Object.keys(Ve).includes(e) ? Ve[e] : "";
680
+ const s = {
681
+ "{seektime}": i.seekTime,
682
+ "{title}": i.title
683
+ };
684
+ return Object.entries(s).forEach(([n, r]) => {
685
+ t = G(t, n, r);
686
+ }), t;
687
+ }
688
+ };
689
+ class te {
690
+ constructor(i) {
691
+ m(this, "get", (t) => {
692
+ if (!te.supported || !this.enabled)
693
+ return null;
694
+ const s = window.localStorage.getItem(this.key);
695
+ if (a.empty(s)) return null;
696
+ const n = JSON.parse(s);
697
+ return a.string(t) && t.length ? n[t] : n;
698
+ }), m(this, "set", (t) => {
699
+ if (!te.supported || !this.enabled || !a.object(t))
700
+ return;
701
+ let s = this.get();
702
+ a.empty(s) && (s = {}), L(s, t);
703
+ try {
704
+ window.localStorage.setItem(this.key, JSON.stringify(s));
705
+ } catch {
706
+ }
707
+ }), this.enabled = i.config.storage.enabled, this.key = i.config.storage.key;
708
+ }
709
+ // Check for actual support (see if we can use it)
710
+ static get supported() {
711
+ try {
712
+ if (!("localStorage" in window)) return !1;
713
+ const i = "___test";
714
+ return window.localStorage.setItem(i, i), window.localStorage.removeItem(i), !0;
715
+ } catch {
716
+ return !1;
717
+ }
718
+ }
719
+ }
720
+ function ne(e, i = "text", t = !1) {
721
+ return new Promise((s, n) => {
722
+ try {
723
+ const r = new XMLHttpRequest();
724
+ if (!("withCredentials" in r)) return;
725
+ t && (r.withCredentials = !0), r.addEventListener("load", () => {
726
+ if (i === "text")
727
+ try {
728
+ s(JSON.parse(r.responseText));
729
+ } catch {
730
+ s(r.responseText);
731
+ }
732
+ else
733
+ s(r.response);
734
+ }), r.addEventListener("error", () => {
735
+ throw new Error(r.status);
736
+ }), r.open("GET", e, !0), r.responseType = i, r.send();
737
+ } catch (r) {
738
+ n(r);
739
+ }
740
+ });
741
+ }
742
+ function ot(e, i) {
743
+ if (!a.string(e))
744
+ return;
745
+ const t = "cache", s = a.string(i);
746
+ let n = !1;
747
+ const r = () => document.getElementById(i) !== null, l = (o, c) => {
748
+ o.innerHTML = c, !(s && r()) && document.body.insertAdjacentElement("afterbegin", o);
749
+ };
750
+ if (!s || !r()) {
751
+ const o = te.supported, c = document.createElement("div");
752
+ if (c.setAttribute("hidden", ""), s && c.setAttribute("id", i), o) {
753
+ const u = window.localStorage.getItem(`${t}-${i}`);
754
+ if (n = u !== null, n) {
755
+ const p = JSON.parse(u);
756
+ l(c, p.content);
757
+ }
758
+ }
759
+ ne(e).then((u) => {
760
+ if (!a.empty(u)) {
761
+ if (o)
762
+ try {
763
+ window.localStorage.setItem(`${t}-${i}`, JSON.stringify({
764
+ content: u
765
+ }));
766
+ } catch {
767
+ }
768
+ l(c, u);
769
+ }
770
+ }).catch(() => {
771
+ });
772
+ }
773
+ }
774
+ const ct = (e) => Math.trunc(e / 60 / 60 % 60, 10), li = (e) => Math.trunc(e / 60 % 60, 10), oi = (e) => Math.trunc(e % 60, 10);
775
+ function ge(e = 0, i = !1, t = !1) {
776
+ if (!a.number(e))
777
+ return ge(void 0, i, t);
778
+ const s = (o) => `0${o}`.slice(-2);
779
+ let n = ct(e);
780
+ const r = li(e), l = oi(e);
781
+ return i || n > 0 ? n = `${n}:` : n = "", `${t && e > 0 ? "-" : ""}${n}${s(r)}:${s(l)}`;
782
+ }
783
+ const d = {
784
+ // Get icon URL
785
+ getIconUrl() {
786
+ const e = new URL(this.config.iconUrl, window.location), i = window.location.host ? window.location.host : window.top.location.host, t = e.host !== i || _.isIE && !window.svg4everybody;
787
+ return {
788
+ url: this.config.iconUrl,
789
+ cors: t
790
+ };
791
+ },
792
+ // Find the UI controls
793
+ findElements() {
794
+ try {
795
+ return this.elements.controls = I.call(this, this.config.selectors.controls.wrapper), this.elements.buttons = {
796
+ play: Z.call(this, this.config.selectors.buttons.play),
797
+ pause: I.call(this, this.config.selectors.buttons.pause),
798
+ restart: I.call(this, this.config.selectors.buttons.restart),
799
+ rewind: I.call(this, this.config.selectors.buttons.rewind),
800
+ fastForward: I.call(this, this.config.selectors.buttons.fastForward),
801
+ mute: I.call(this, this.config.selectors.buttons.mute),
802
+ pip: I.call(this, this.config.selectors.buttons.pip),
803
+ airplay: I.call(this, this.config.selectors.buttons.airplay),
804
+ settings: I.call(this, this.config.selectors.buttons.settings),
805
+ captions: I.call(this, this.config.selectors.buttons.captions),
806
+ fullscreen: I.call(this, this.config.selectors.buttons.fullscreen)
807
+ }, this.elements.progress = I.call(this, this.config.selectors.progress), this.elements.inputs = {
808
+ seek: I.call(this, this.config.selectors.inputs.seek),
809
+ volume: I.call(this, this.config.selectors.inputs.volume)
810
+ }, this.elements.display = {
811
+ buffer: I.call(this, this.config.selectors.display.buffer),
812
+ currentTime: I.call(this, this.config.selectors.display.currentTime),
813
+ duration: I.call(this, this.config.selectors.display.duration)
814
+ }, a.element(this.elements.progress) && (this.elements.display.seekTooltip = this.elements.progress.querySelector(`.${this.config.classNames.tooltip}`)), !0;
815
+ } catch (e) {
816
+ return this.debug.warn("It looks like there is a problem with your custom controls HTML", e), this.toggleNativeControls(!0), !1;
817
+ }
818
+ },
819
+ // Create <svg> icon
820
+ createIcon(e, i) {
821
+ const t = "http://www.w3.org/2000/svg", s = d.getIconUrl.call(this), n = `${s.cors ? "" : s.url}#${this.config.iconPrefix}`, r = document.createElementNS(t, "svg");
822
+ Te(r, L(i, {
823
+ "aria-hidden": "true",
824
+ focusable: "false"
825
+ }));
826
+ const l = document.createElementNS(t, "use"), o = `${n}-${e}`;
827
+ return "href" in l && l.setAttributeNS("http://www.w3.org/1999/xlink", "href", o), l.setAttributeNS("http://www.w3.org/1999/xlink", "xlink:href", o), r.appendChild(l), r;
828
+ },
829
+ // Create hidden text label
830
+ createLabel(e, i = {}) {
831
+ const t = O.get(e, this.config), s = {
832
+ ...i,
833
+ class: [i.class, this.config.classNames.hidden].filter(Boolean).join(" ")
834
+ };
835
+ return y("span", s, t);
836
+ },
837
+ // Create a badge
838
+ createBadge(e) {
839
+ if (a.empty(e))
840
+ return null;
841
+ const i = y("span", {
842
+ class: this.config.classNames.menu.value
843
+ });
844
+ return i.appendChild(y("span", {
845
+ class: this.config.classNames.menu.badge
846
+ }, e)), i;
847
+ },
848
+ // Create a <button>
849
+ createButton(e, i) {
850
+ const t = L({}, i);
851
+ let s = ni(e);
852
+ const n = {
853
+ element: "button",
854
+ toggle: !1,
855
+ label: null,
856
+ icon: null,
857
+ labelPressed: null,
858
+ iconPressed: null
859
+ };
860
+ switch (["element", "icon", "label"].forEach((l) => {
861
+ Object.keys(t).includes(l) && (n[l] = t[l], delete t[l]);
862
+ }), n.element === "button" && !Object.keys(t).includes("type") && (t.type = "button"), Object.keys(t).includes("class") ? t.class.split(" ").includes(this.config.classNames.control) || L(t, {
863
+ class: `${t.class} ${this.config.classNames.control}`
864
+ }) : t.class = this.config.classNames.control, e) {
865
+ case "play":
866
+ n.toggle = !0, n.label = "play", n.labelPressed = "pause", n.icon = "play", n.iconPressed = "pause";
867
+ break;
868
+ case "mute":
869
+ n.toggle = !0, n.label = "mute", n.labelPressed = "unmute", n.icon = "volume", n.iconPressed = "muted";
870
+ break;
871
+ case "captions":
872
+ n.toggle = !0, n.label = "enableCaptions", n.labelPressed = "disableCaptions", n.icon = "captions-off", n.iconPressed = "captions-on";
873
+ break;
874
+ case "fullscreen":
875
+ n.toggle = !0, n.label = "enterFullscreen", n.labelPressed = "exitFullscreen", n.icon = "enter-fullscreen", n.iconPressed = "exit-fullscreen";
876
+ break;
877
+ case "play-large":
878
+ t.class += ` ${this.config.classNames.control}--overlaid`, s = "play", n.label = "play", n.icon = "play";
879
+ break;
880
+ default:
881
+ a.empty(n.label) && (n.label = s), a.empty(n.icon) && (n.icon = e);
882
+ }
883
+ const r = y(n.element);
884
+ return n.toggle ? (r.appendChild(d.createIcon.call(this, n.iconPressed, {
885
+ class: "icon--pressed"
886
+ })), r.appendChild(d.createIcon.call(this, n.icon, {
887
+ class: "icon--not-pressed"
888
+ })), r.appendChild(d.createLabel.call(this, n.labelPressed, {
889
+ class: "label--pressed"
890
+ })), r.appendChild(d.createLabel.call(this, n.label, {
891
+ class: "label--not-pressed"
892
+ }))) : (r.appendChild(d.createIcon.call(this, n.icon)), r.appendChild(d.createLabel.call(this, n.label))), L(t, V(this.config.selectors.buttons[s], t)), Te(r, t), s === "play" ? (a.array(this.elements.buttons[s]) || (this.elements.buttons[s] = []), this.elements.buttons[s].push(r)) : this.elements.buttons[s] = r, r;
893
+ },
894
+ // Create an <input type='range'>
895
+ createRange(e, i) {
896
+ const t = y("input", L(V(this.config.selectors.inputs[e]), {
897
+ type: "range",
898
+ min: 0,
899
+ max: 100,
900
+ step: 0.01,
901
+ value: 0,
902
+ autocomplete: "off",
903
+ // A11y fixes for https://github.com/sampotts/plyr/issues/905
904
+ role: "slider",
905
+ "aria-label": O.get(e, this.config),
906
+ "aria-valuemin": 0,
907
+ "aria-valuemax": 100,
908
+ "aria-valuenow": 0
909
+ }, i));
910
+ return this.elements.inputs[e] = t, d.updateRangeFill.call(this, t), Lt.setup(t), t;
911
+ },
912
+ // Create a <progress>
913
+ createProgress(e, i) {
914
+ const t = y("progress", L(V(this.config.selectors.display[e]), {
915
+ min: 0,
916
+ max: 100,
917
+ value: 0,
918
+ role: "progressbar",
919
+ "aria-hidden": !0
920
+ }, i));
921
+ if (e !== "volume") {
922
+ t.appendChild(y("span", null, "0"));
923
+ const s = {
924
+ played: "played",
925
+ buffer: "buffered"
926
+ }[e], n = s ? O.get(s, this.config) : "";
927
+ t.textContent = `% ${n.toLowerCase()}`;
928
+ }
929
+ return this.elements.display[e] = t, t;
930
+ },
931
+ // Create time display
932
+ createTime(e, i) {
933
+ const t = V(this.config.selectors.display[e], i), s = y("div", L(t, {
934
+ class: `${t.class ? t.class : ""} ${this.config.classNames.display.time} `.trim(),
935
+ "aria-label": O.get(e, this.config),
936
+ role: "timer"
937
+ }), "00:00");
938
+ return this.elements.display[e] = s, s;
939
+ },
940
+ // Bind keyboard shortcuts for a menu item
941
+ // We have to bind to keyup otherwise Firefox triggers a click when a keydown event handler shifts focus
942
+ // https://bugzilla.mozilla.org/show_bug.cgi?id=1220143
943
+ bindMenuItemShortcuts(e, i) {
944
+ T.call(this, e, "keydown keyup", (t) => {
945
+ if (![" ", "ArrowUp", "ArrowDown", "ArrowRight"].includes(t.key) || (t.preventDefault(), t.stopPropagation(), t.type === "keydown"))
946
+ return;
947
+ const s = Y(e, '[role="menuitemradio"]');
948
+ if (!s && [" ", "ArrowRight"].includes(t.key))
949
+ d.showMenuPanel.call(this, i, !0);
950
+ else {
951
+ let n;
952
+ t.key !== " " && (t.key === "ArrowDown" || s && t.key === "ArrowRight" ? (n = e.nextElementSibling, a.element(n) || (n = e.parentNode.firstElementChild)) : (n = e.previousElementSibling, a.element(n) || (n = e.parentNode.lastElementChild)), be.call(this, n, !0));
953
+ }
954
+ }, !1), T.call(this, e, "keyup", (t) => {
955
+ t.key === "Return" && d.focusFirstMenuItem.call(this, null, !0);
956
+ });
957
+ },
958
+ // Create a settings menu item
959
+ createMenuItem({
960
+ value: e,
961
+ list: i,
962
+ type: t,
963
+ title: s,
964
+ badge: n = null,
965
+ checked: r = !1
966
+ }) {
967
+ const l = V(this.config.selectors.inputs[t]), o = y("button", L(l, {
968
+ type: "button",
969
+ role: "menuitemradio",
970
+ class: `${this.config.classNames.control} ${l.class ? l.class : ""}`.trim(),
971
+ "aria-checked": r,
972
+ value: e
973
+ })), c = y("span");
974
+ c.innerHTML = s, a.element(n) && c.appendChild(n), o.appendChild(c), Object.defineProperty(o, "checked", {
975
+ enumerable: !0,
976
+ get() {
977
+ return o.getAttribute("aria-checked") === "true";
978
+ },
979
+ set(u) {
980
+ u && Array.from(o.parentNode.children).filter((p) => Y(p, '[role="menuitemradio"]')).forEach((p) => p.setAttribute("aria-checked", "false")), o.setAttribute("aria-checked", u ? "true" : "false");
981
+ }
982
+ }), this.listeners.bind(o, "click keyup", (u) => {
983
+ if (!(a.keyboardEvent(u) && u.key !== " ")) {
984
+ switch (u.preventDefault(), u.stopPropagation(), o.checked = !0, t) {
985
+ case "language":
986
+ this.currentTrack = Number(e);
987
+ break;
988
+ case "quality":
989
+ this.quality = e;
990
+ break;
991
+ case "speed":
992
+ this.speed = Number.parseFloat(e);
993
+ break;
994
+ }
995
+ d.showMenuPanel.call(this, "home", a.keyboardEvent(u));
996
+ }
997
+ }, t, !1), d.bindMenuItemShortcuts.call(this, o, t), i.appendChild(o);
998
+ },
999
+ // Format a time for display
1000
+ formatTime(e = 0, i = !1) {
1001
+ if (!a.number(e))
1002
+ return e;
1003
+ const t = ct(this.duration) > 0;
1004
+ return ge(e, t, i);
1005
+ },
1006
+ // Update the displayed time
1007
+ updateTimeDisplay(e = null, i = 0, t = !1) {
1008
+ !a.element(e) || !a.number(i) || (e.textContent = d.formatTime(i, t));
1009
+ },
1010
+ // Update volume UI and storage
1011
+ updateVolume() {
1012
+ this.supported.ui && (a.element(this.elements.inputs.volume) && d.setRange.call(this, this.elements.inputs.volume, this.muted ? 0 : this.volume), a.element(this.elements.buttons.mute) && (this.elements.buttons.mute.pressed = this.muted || this.volume === 0));
1013
+ },
1014
+ // Update seek value and lower fill
1015
+ setRange(e, i = 0) {
1016
+ a.element(e) && (e.value = i, d.updateRangeFill.call(this, e));
1017
+ },
1018
+ // Update <progress> elements
1019
+ updateProgress(e) {
1020
+ if (!this.supported.ui || !a.event(e))
1021
+ return;
1022
+ let i = 0;
1023
+ const t = (s, n) => {
1024
+ const r = a.number(n) ? n : 0, l = a.element(s) ? s : this.elements.display.buffer;
1025
+ if (a.element(l)) {
1026
+ l.value = r;
1027
+ const o = l.getElementsByTagName("span")[0];
1028
+ a.element(o) && (o.childNodes[0].nodeValue = r);
1029
+ }
1030
+ };
1031
+ if (e)
1032
+ switch (e.type) {
1033
+ // Video playing
1034
+ case "timeupdate":
1035
+ case "seeking":
1036
+ case "seeked":
1037
+ i = ii(this.currentTime, this.duration), e.type === "timeupdate" && d.setRange.call(this, this.elements.inputs.seek, i);
1038
+ break;
1039
+ // Check buffer status
1040
+ case "playing":
1041
+ case "progress":
1042
+ t(this.elements.display.buffer, this.buffered * 100);
1043
+ break;
1044
+ }
1045
+ },
1046
+ // Webkit polyfill for lower fill range
1047
+ updateRangeFill(e) {
1048
+ const i = a.event(e) ? e.target : e;
1049
+ if (!(!a.element(i) || i.getAttribute("type") !== "range")) {
1050
+ if (Y(i, this.config.selectors.inputs.seek)) {
1051
+ i.setAttribute("aria-valuenow", this.currentTime);
1052
+ const t = d.formatTime(this.currentTime), s = d.formatTime(this.duration), n = O.get("seekLabel", this.config);
1053
+ i.setAttribute("aria-valuetext", n.replace("{currentTime}", t).replace("{duration}", s));
1054
+ } else if (Y(i, this.config.selectors.inputs.volume)) {
1055
+ const t = i.value * 100;
1056
+ i.setAttribute("aria-valuenow", t), i.setAttribute("aria-valuetext", `${t.toFixed(1)}%`);
1057
+ } else
1058
+ i.setAttribute("aria-valuenow", i.value);
1059
+ !_.isWebKit && !_.isIPadOS || i.style.setProperty("--value", `${i.value / i.max * 100}%`);
1060
+ }
1061
+ },
1062
+ // Update hover tooltip for seeking
1063
+ updateSeekTooltip(e) {
1064
+ var i, t;
1065
+ if (!this.config.tooltips.seek || !a.element(this.elements.inputs.seek) || !a.element(this.elements.display.seekTooltip) || this.duration === 0)
1066
+ return;
1067
+ const s = this.elements.display.seekTooltip, n = `${this.config.classNames.tooltip}--visible`, r = (p) => E(s, n, p);
1068
+ if (this.touch) {
1069
+ r(!1);
1070
+ return;
1071
+ }
1072
+ let l = 0;
1073
+ const o = this.elements.progress.getBoundingClientRect();
1074
+ if (a.event(e)) {
1075
+ const p = e.pageX - e.clientX;
1076
+ l = 100 / o.width * (e.pageX - o.left - p);
1077
+ } else if (he(s, n))
1078
+ l = Number.parseFloat(s.style.left, 10);
1079
+ else
1080
+ return;
1081
+ l < 0 ? l = 0 : l > 100 && (l = 100);
1082
+ const c = this.duration / 100 * l;
1083
+ s.textContent = d.formatTime(c);
1084
+ const u = (i = this.config.markers) === null || i === void 0 || (t = i.points) === null || t === void 0 ? void 0 : t.find(({
1085
+ time: p
1086
+ }) => p === Math.round(c));
1087
+ u && s.insertAdjacentHTML("afterbegin", `${u.label}<br>`), s.style.left = `${l}%`, a.event(e) && ["mouseenter", "mouseleave"].includes(e.type) && r(e.type === "mouseenter");
1088
+ },
1089
+ // Handle time change event
1090
+ timeUpdate(e) {
1091
+ const i = !a.element(this.elements.display.duration) && this.config.invertTime;
1092
+ d.updateTimeDisplay.call(this, this.elements.display.currentTime, i ? this.duration - this.currentTime : this.currentTime, i), !(e && e.type === "timeupdate" && this.media.seeking) && d.updateProgress.call(this, e);
1093
+ },
1094
+ // Show the duration on metadataloaded or durationchange events
1095
+ durationUpdate() {
1096
+ if (!this.supported.ui || !this.config.invertTime && this.currentTime)
1097
+ return;
1098
+ if (this.duration >= 2 ** 32) {
1099
+ K(this.elements.display.currentTime, !0), K(this.elements.progress, !0);
1100
+ return;
1101
+ }
1102
+ a.element(this.elements.inputs.seek) && this.elements.inputs.seek.setAttribute("aria-valuemax", this.duration);
1103
+ const e = a.element(this.elements.display.duration);
1104
+ !e && this.config.displayDuration && this.paused && d.updateTimeDisplay.call(this, this.elements.display.currentTime, this.duration), e && d.updateTimeDisplay.call(this, this.elements.display.duration, this.duration), this.config.markers.enabled && d.setMarkers.call(this), d.updateSeekTooltip.call(this);
1105
+ },
1106
+ // Hide/show a tab
1107
+ toggleMenuButton(e, i) {
1108
+ K(this.elements.settings.buttons[e], !i);
1109
+ },
1110
+ // Update the selected setting
1111
+ updateSetting(e, i, t) {
1112
+ const s = this.elements.settings.panels[e];
1113
+ let n = null, r = i;
1114
+ if (e === "captions")
1115
+ n = this.currentTrack;
1116
+ else {
1117
+ if (n = a.empty(t) ? this[e] : t, a.empty(n) && (n = this.config[e].default), !a.empty(this.options[e]) && !this.options[e].includes(n)) {
1118
+ this.debug.warn(`Unsupported value of '${n}' for ${e}`);
1119
+ return;
1120
+ }
1121
+ if (!this.config[e].options.includes(n)) {
1122
+ this.debug.warn(`Disabled value of '${n}' for ${e}`);
1123
+ return;
1124
+ }
1125
+ }
1126
+ if (a.element(r) || (r = s && s.querySelector('[role="menu"]')), !a.element(r))
1127
+ return;
1128
+ const l = this.elements.settings.buttons[e].querySelector(`.${this.config.classNames.menu.value}`);
1129
+ l.innerHTML = d.getLabel.call(this, e, n);
1130
+ const o = r && r.querySelector(`[value="${n}"]`);
1131
+ a.element(o) && (o.checked = !0);
1132
+ },
1133
+ // Translate a value into a nice label
1134
+ getLabel(e, i) {
1135
+ switch (e) {
1136
+ case "speed":
1137
+ return i === 1 ? O.get("normal", this.config) : `${i}&times;`;
1138
+ case "quality":
1139
+ if (a.number(i)) {
1140
+ const t = O.get(`qualityLabel.${i}`, this.config);
1141
+ return t.length ? t : `${i}p`;
1142
+ }
1143
+ return lt(i);
1144
+ case "captions":
1145
+ return A.getLabel.call(this);
1146
+ default:
1147
+ return null;
1148
+ }
1149
+ },
1150
+ // Set the quality menu
1151
+ setQualityMenu(e) {
1152
+ if (!a.element(this.elements.settings.panels.quality))
1153
+ return;
1154
+ const i = "quality", t = this.elements.settings.panels.quality.querySelector('[role="menu"]');
1155
+ a.array(e) && (this.options.quality = Ce(e).filter((r) => this.config.quality.options.includes(r)));
1156
+ const s = !a.empty(this.options.quality) && this.options.quality.length > 1;
1157
+ if (d.toggleMenuButton.call(this, i, s), ae(t), d.checkMenu.call(this), !s)
1158
+ return;
1159
+ const n = (r) => {
1160
+ const l = O.get(`qualityBadge.${r}`, this.config);
1161
+ return l.length ? d.createBadge.call(this, l) : null;
1162
+ };
1163
+ this.options.quality.sort((r, l) => {
1164
+ const o = this.config.quality.options;
1165
+ return o.indexOf(r) > o.indexOf(l) ? 1 : -1;
1166
+ }).forEach((r) => {
1167
+ d.createMenuItem.call(this, {
1168
+ value: r,
1169
+ list: t,
1170
+ type: i,
1171
+ title: d.getLabel.call(this, "quality", r),
1172
+ badge: n(r)
1173
+ });
1174
+ }), d.updateSetting.call(this, i, t);
1175
+ },
1176
+ // Set the looping options
1177
+ /* setLoopMenu() {
1178
+ // Menu required
1179
+ if (!is.element(this.elements.settings.panels.loop)) {
1180
+ return;
1181
+ }
1182
+ const options = ['start', 'end', 'all', 'reset'];
1183
+ const list = this.elements.settings.panels.loop.querySelector('[role="menu"]');
1184
+ // Show the pane and tab
1185
+ toggleHidden(this.elements.settings.buttons.loop, false);
1186
+ toggleHidden(this.elements.settings.panels.loop, false);
1187
+ // Toggle the pane and tab
1188
+ const toggle = !is.empty(this.loop.options);
1189
+ controls.toggleMenuButton.call(this, 'loop', toggle);
1190
+ // Empty the menu
1191
+ emptyElement(list);
1192
+ options.forEach(option => {
1193
+ const item = createElement('li');
1194
+ const button = createElement(
1195
+ 'button',
1196
+ extend(getAttributesFromSelector(this.config.selectors.buttons.loop), {
1197
+ type: 'button',
1198
+ class: this.config.classNames.control,
1199
+ 'data-plyr-loop-action': option,
1200
+ }),
1201
+ i18n.get(option, this.config)
1202
+ );
1203
+ if (['start', 'end'].includes(option)) {
1204
+ const badge = controls.createBadge.call(this, '00:00');
1205
+ button.appendChild(badge);
1206
+ }
1207
+ item.appendChild(button);
1208
+ list.appendChild(item);
1209
+ });
1210
+ }, */
1211
+ // Get current selected caption language
1212
+ // TODO: rework this to user the getter in the API?
1213
+ // Set a list of available captions languages
1214
+ setCaptionsMenu() {
1215
+ if (!a.element(this.elements.settings.panels.captions))
1216
+ return;
1217
+ const e = "captions", i = this.elements.settings.panels.captions.querySelector('[role="menu"]'), t = A.getTracks.call(this), s = !!t.length;
1218
+ if (d.toggleMenuButton.call(this, e, s), ae(i), d.checkMenu.call(this), !s)
1219
+ return;
1220
+ const n = t.map((r, l) => ({
1221
+ value: l,
1222
+ checked: this.captions.toggled && this.currentTrack === l,
1223
+ title: A.getLabel.call(this, r),
1224
+ badge: r.language && d.createBadge.call(this, r.language.toUpperCase()),
1225
+ list: i,
1226
+ type: "language"
1227
+ }));
1228
+ n.unshift({
1229
+ value: -1,
1230
+ checked: !this.captions.toggled,
1231
+ title: O.get("disabled", this.config),
1232
+ list: i,
1233
+ type: "language"
1234
+ }), n.forEach(d.createMenuItem.bind(this)), d.updateSetting.call(this, e, i);
1235
+ },
1236
+ // Set a list of available captions languages
1237
+ setSpeedMenu() {
1238
+ if (!a.element(this.elements.settings.panels.speed))
1239
+ return;
1240
+ const e = "speed", i = this.elements.settings.panels.speed.querySelector('[role="menu"]');
1241
+ this.options.speed = this.options.speed.filter((s) => s >= this.minimumSpeed && s <= this.maximumSpeed);
1242
+ const t = !a.empty(this.options.speed) && this.options.speed.length > 1;
1243
+ d.toggleMenuButton.call(this, e, t), ae(i), d.checkMenu.call(this), t && (this.options.speed.forEach((s) => {
1244
+ d.createMenuItem.call(this, {
1245
+ value: s,
1246
+ list: i,
1247
+ type: e,
1248
+ title: d.getLabel.call(this, "speed", s)
1249
+ });
1250
+ }), d.updateSetting.call(this, e, i));
1251
+ },
1252
+ // Check if we need to hide/show the settings menu
1253
+ checkMenu() {
1254
+ const {
1255
+ buttons: e
1256
+ } = this.elements.settings, i = !a.empty(e) && Object.values(e).some((t) => !t.hidden);
1257
+ K(this.elements.settings.menu, !i);
1258
+ },
1259
+ // Focus the first menu item in a given (or visible) menu
1260
+ focusFirstMenuItem(e, i = !1) {
1261
+ if (this.elements.settings.popup.hidden)
1262
+ return;
1263
+ let t = e;
1264
+ a.element(t) || (t = Object.values(this.elements.settings.panels).find((n) => !n.hidden));
1265
+ const s = t.querySelector('[role^="menuitem"]');
1266
+ be.call(this, s, i);
1267
+ },
1268
+ // Show/hide menu
1269
+ toggleMenu(e) {
1270
+ const {
1271
+ popup: i
1272
+ } = this.elements.settings, t = this.elements.buttons.settings;
1273
+ if (!a.element(i) || !a.element(t))
1274
+ return;
1275
+ const {
1276
+ hidden: s
1277
+ } = i;
1278
+ let n = s;
1279
+ if (a.boolean(e))
1280
+ n = e;
1281
+ else if (a.keyboardEvent(e) && e.key === "Escape")
1282
+ n = !1;
1283
+ else if (a.event(e)) {
1284
+ const r = a.function(e.composedPath) ? e.composedPath()[0] : e.target, l = i.contains(r);
1285
+ if (l || !l && e.target !== t && n)
1286
+ return;
1287
+ }
1288
+ t.setAttribute("aria-expanded", n), K(i, !n), E(this.elements.container, this.config.classNames.menu.open, n), n && a.keyboardEvent(e) ? d.focusFirstMenuItem.call(this, null, !0) : !n && !s && be.call(this, t, a.keyboardEvent(e));
1289
+ },
1290
+ // Get the natural size of a menu panel
1291
+ getMenuSize(e) {
1292
+ const i = e.cloneNode(!0);
1293
+ i.style.position = "absolute", i.style.opacity = 0, i.removeAttribute("hidden"), e.parentNode.appendChild(i);
1294
+ const t = i.scrollWidth, s = i.scrollHeight;
1295
+ return U(i), {
1296
+ width: t,
1297
+ height: s
1298
+ };
1299
+ },
1300
+ // Show a panel in the menu
1301
+ showMenuPanel(e = "", i = !1) {
1302
+ const t = this.elements.container.querySelector(`#plyr-settings-${this.id}-${e}`);
1303
+ if (!a.element(t))
1304
+ return;
1305
+ const s = t.parentNode, n = Array.from(s.children).find((r) => !r.hidden);
1306
+ if ($.transitions && !$.reducedMotion) {
1307
+ s.style.width = `${n.scrollWidth}px`, s.style.height = `${n.scrollHeight}px`;
1308
+ const r = d.getMenuSize.call(this, t), l = (o) => {
1309
+ o.target !== s || !["width", "height"].includes(o.propertyName) || (s.style.width = "", s.style.height = "", fe.call(this, s, ke, l));
1310
+ };
1311
+ T.call(this, s, ke, l), s.style.width = `${r.width}px`, s.style.height = `${r.height}px`;
1312
+ }
1313
+ K(n, !0), K(t, !1), d.focusFirstMenuItem.call(this, t, i);
1314
+ },
1315
+ // Set the download URL
1316
+ setDownloadUrl() {
1317
+ const e = this.elements.buttons.download;
1318
+ a.element(e) && e.setAttribute("href", this.download);
1319
+ },
1320
+ // Build the default HTML
1321
+ create(e) {
1322
+ const {
1323
+ bindMenuItemShortcuts: i,
1324
+ createButton: t,
1325
+ createProgress: s,
1326
+ createRange: n,
1327
+ createTime: r,
1328
+ setQualityMenu: l,
1329
+ setSpeedMenu: o,
1330
+ showMenuPanel: c
1331
+ } = d;
1332
+ this.elements.controls = null, a.array(this.config.controls) && this.config.controls.includes("play-large") && this.elements.container.appendChild(t.call(this, "play-large"));
1333
+ const u = y("div", V(this.config.selectors.controls.wrapper));
1334
+ this.elements.controls = u;
1335
+ const p = {
1336
+ class: "plyr__controls__item"
1337
+ };
1338
+ return Ce(a.array(this.config.controls) ? this.config.controls : []).forEach((b) => {
1339
+ if (b === "restart" && u.appendChild(t.call(this, "restart", p)), b === "rewind" && u.appendChild(t.call(this, "rewind", p)), b === "play" && u.appendChild(t.call(this, "play", p)), b === "fast-forward" && u.appendChild(t.call(this, "fast-forward", p)), b === "progress") {
1340
+ const h = y("div", {
1341
+ class: `${p.class} plyr__progress__container`
1342
+ }), g = y("div", V(this.config.selectors.progress));
1343
+ if (g.appendChild(n.call(this, "seek", {
1344
+ id: `plyr-seek-${e.id}`
1345
+ })), g.appendChild(s.call(this, "buffer")), this.config.tooltips.seek) {
1346
+ const C = y("span", {
1347
+ class: this.config.classNames.tooltip
1348
+ }, "00:00");
1349
+ g.appendChild(C), this.elements.display.seekTooltip = C;
1350
+ }
1351
+ this.elements.progress = g, h.appendChild(this.elements.progress), u.appendChild(h);
1352
+ }
1353
+ if (b === "current-time" && u.appendChild(r.call(this, "currentTime", p)), b === "duration" && u.appendChild(r.call(this, "duration", p)), b === "mute" || b === "volume") {
1354
+ let {
1355
+ volume: h
1356
+ } = this.elements;
1357
+ if ((!a.element(h) || !u.contains(h)) && (h = y("div", L({}, p, {
1358
+ class: `${p.class} plyr__volume`.trim()
1359
+ })), this.elements.volume = h, u.appendChild(h)), b === "mute" && h.appendChild(t.call(this, "mute")), b === "volume" && !_.isIos && !_.isIPadOS) {
1360
+ const g = {
1361
+ max: 1,
1362
+ step: 0.05,
1363
+ value: this.config.volume
1364
+ };
1365
+ h.appendChild(n.call(this, "volume", L(g, {
1366
+ id: `plyr-volume-${e.id}`
1367
+ })));
1368
+ }
1369
+ }
1370
+ if (b === "captions" && u.appendChild(t.call(this, "captions", p)), b === "settings" && !a.empty(this.config.settings)) {
1371
+ const h = y("div", L({}, p, {
1372
+ class: `${p.class} plyr__menu`.trim(),
1373
+ hidden: ""
1374
+ }));
1375
+ h.appendChild(t.call(this, "settings", {
1376
+ "aria-haspopup": !0,
1377
+ "aria-controls": `plyr-settings-${e.id}`,
1378
+ "aria-expanded": !1
1379
+ }));
1380
+ const g = y("div", {
1381
+ class: "plyr__menu__container",
1382
+ id: `plyr-settings-${e.id}`,
1383
+ hidden: ""
1384
+ }), C = y("div"), w = y("div", {
1385
+ id: `plyr-settings-${e.id}-home`
1386
+ }), x = y("div", {
1387
+ role: "menu"
1388
+ });
1389
+ w.appendChild(x), C.appendChild(w), this.elements.settings.panels.home = w, this.config.settings.forEach((P) => {
1390
+ const f = y("button", L(V(this.config.selectors.buttons.settings), {
1391
+ type: "button",
1392
+ class: `${this.config.classNames.control} ${this.config.classNames.control}--forward`,
1393
+ role: "menuitem",
1394
+ "aria-haspopup": !0,
1395
+ hidden: ""
1396
+ }));
1397
+ i.call(this, f, P), T.call(this, f, "click", () => {
1398
+ c.call(this, P, !1);
1399
+ });
1400
+ const k = y("span", null, O.get(P, this.config)), M = y("span", {
1401
+ class: this.config.classNames.menu.value
1402
+ });
1403
+ M.innerHTML = e[P], k.appendChild(M), f.appendChild(k), x.appendChild(f);
1404
+ const j = y("div", {
1405
+ id: `plyr-settings-${e.id}-${P}`,
1406
+ hidden: ""
1407
+ }), R = y("button", {
1408
+ type: "button",
1409
+ class: `${this.config.classNames.control} ${this.config.classNames.control}--back`
1410
+ });
1411
+ R.appendChild(y("span", {
1412
+ "aria-hidden": !0
1413
+ }, O.get(P, this.config))), R.appendChild(y("span", {
1414
+ class: this.config.classNames.hidden
1415
+ }, O.get("menuBack", this.config))), T.call(this, j, "keydown", (H) => {
1416
+ H.key === "ArrowLeft" && (H.preventDefault(), H.stopPropagation(), c.call(this, "home", !0));
1417
+ }, !1), T.call(this, R, "click", () => {
1418
+ c.call(this, "home", !1);
1419
+ }), j.appendChild(R), j.appendChild(y("div", {
1420
+ role: "menu"
1421
+ })), C.appendChild(j), this.elements.settings.buttons[P] = f, this.elements.settings.panels[P] = j;
1422
+ }), g.appendChild(C), h.appendChild(g), u.appendChild(h), this.elements.settings.popup = g, this.elements.settings.menu = h;
1423
+ }
1424
+ if (b === "pip" && $.pip && u.appendChild(t.call(this, "pip", p)), b === "airplay" && $.airplay && u.appendChild(t.call(this, "airplay", p)), b === "download") {
1425
+ const h = L({}, p, {
1426
+ element: "a",
1427
+ href: this.download,
1428
+ target: "_blank"
1429
+ });
1430
+ this.isHTML5 && (h.download = "");
1431
+ const {
1432
+ download: g
1433
+ } = this.config.urls;
1434
+ !a.url(g) && this.isEmbed && L(h, {
1435
+ icon: `logo-${this.provider}`,
1436
+ label: this.provider
1437
+ }), u.appendChild(t.call(this, "download", h));
1438
+ }
1439
+ b === "fullscreen" && u.appendChild(t.call(this, "fullscreen", p));
1440
+ }), this.isHTML5 && l.call(this, z.getQualityOptions.call(this)), o.call(this), u;
1441
+ },
1442
+ // Insert controls
1443
+ inject() {
1444
+ if (this.config.loadSprite) {
1445
+ const l = d.getIconUrl.call(this);
1446
+ l.cors && ot(l.url, "sprite-plyr");
1447
+ }
1448
+ this.id = Math.floor(Math.random() * 1e4);
1449
+ let e = null;
1450
+ this.elements.controls = null;
1451
+ const i = {
1452
+ id: this.id,
1453
+ seektime: this.config.seekTime,
1454
+ title: this.config.title
1455
+ };
1456
+ let t = !0;
1457
+ a.function(this.config.controls) && (this.config.controls = this.config.controls.call(this, i)), this.config.controls || (this.config.controls = []), a.element(this.config.controls) || a.string(this.config.controls) ? e = this.config.controls : (e = d.create.call(this, {
1458
+ id: this.id,
1459
+ seektime: this.config.seekTime,
1460
+ speed: this.speed,
1461
+ quality: this.quality,
1462
+ captions: A.getLabel.call(this)
1463
+ // TODO: Looping
1464
+ // loop: 'None',
1465
+ }), t = !1);
1466
+ const s = (l) => {
1467
+ let o = l;
1468
+ return Object.entries(i).forEach(([c, u]) => {
1469
+ o = G(o, `{${c}}`, u);
1470
+ }), o;
1471
+ };
1472
+ t && a.string(this.config.controls) && (e = s(e));
1473
+ let n;
1474
+ a.string(this.config.selectors.controls.container) && (n = document.querySelector(this.config.selectors.controls.container)), a.element(n) || (n = this.elements.container);
1475
+ const r = a.element(e) ? "insertAdjacentElement" : "insertAdjacentHTML";
1476
+ if (n[r]("afterbegin", e), a.element(this.elements.controls) || d.findElements.call(this), !a.empty(this.elements.buttons)) {
1477
+ const l = (o) => {
1478
+ const c = this.config.classNames.controlPressed;
1479
+ o.setAttribute("aria-pressed", "false"), Object.defineProperty(o, "pressed", {
1480
+ configurable: !0,
1481
+ enumerable: !0,
1482
+ get() {
1483
+ return he(o, c);
1484
+ },
1485
+ set(u = !1) {
1486
+ E(o, c, u), o.setAttribute("aria-pressed", u ? "true" : "false");
1487
+ }
1488
+ });
1489
+ };
1490
+ Object.values(this.elements.buttons).filter(Boolean).forEach((o) => {
1491
+ a.array(o) || a.nodeList(o) ? Array.from(o).filter(Boolean).forEach(l) : l(o);
1492
+ });
1493
+ }
1494
+ if (_.isEdge && et(n), this.config.tooltips.controls) {
1495
+ const {
1496
+ classNames: l,
1497
+ selectors: o
1498
+ } = this.config, c = `${o.controls.wrapper} ${o.labels} .${l.hidden}`, u = Z.call(this, c);
1499
+ Array.from(u).forEach((p) => {
1500
+ E(p, this.config.classNames.hidden, !1), E(p, this.config.classNames.tooltip, !0);
1501
+ });
1502
+ }
1503
+ },
1504
+ // Set media metadata
1505
+ setMediaMetadata() {
1506
+ try {
1507
+ "mediaSession" in navigator && (navigator.mediaSession.metadata = new window.MediaMetadata({
1508
+ title: this.config.mediaMetadata.title,
1509
+ artist: this.config.mediaMetadata.artist,
1510
+ album: this.config.mediaMetadata.album,
1511
+ artwork: this.config.mediaMetadata.artwork
1512
+ }));
1513
+ } catch {
1514
+ }
1515
+ },
1516
+ // Add markers
1517
+ setMarkers() {
1518
+ var e, i;
1519
+ if (!this.duration || this.elements.markers) return;
1520
+ const t = (e = this.config.markers) === null || e === void 0 || (i = e.points) === null || i === void 0 ? void 0 : i.filter(({
1521
+ time: c
1522
+ }) => c > 0 && c < this.duration);
1523
+ if (!(t != null && t.length)) return;
1524
+ const s = document.createDocumentFragment(), n = document.createDocumentFragment();
1525
+ let r = null;
1526
+ const l = `${this.config.classNames.tooltip}--visible`, o = (c) => E(r, l, c);
1527
+ t.forEach((c) => {
1528
+ const u = y("span", {
1529
+ class: this.config.classNames.marker
1530
+ }, ""), p = `${c.time / this.duration * 100}%`;
1531
+ r && (u.addEventListener("mouseenter", () => {
1532
+ c.label || (r.style.left = p, r.innerHTML = c.label, o(!0));
1533
+ }), u.addEventListener("mouseleave", () => {
1534
+ o(!1);
1535
+ })), u.addEventListener("click", () => {
1536
+ this.currentTime = c.time;
1537
+ }), u.style.left = p, n.appendChild(u);
1538
+ }), s.appendChild(n), this.config.tooltips.seek || (r = y("span", {
1539
+ class: this.config.classNames.tooltip
1540
+ }, ""), s.appendChild(r)), this.elements.markers = {
1541
+ points: n,
1542
+ tip: r
1543
+ }, this.elements.progress.appendChild(s);
1544
+ }
1545
+ };
1546
+ function ut(e, i = !0) {
1547
+ let t = e;
1548
+ if (i) {
1549
+ const s = document.createElement("a");
1550
+ s.href = t, t = s.href;
1551
+ }
1552
+ try {
1553
+ return new URL(t);
1554
+ } catch {
1555
+ return null;
1556
+ }
1557
+ }
1558
+ function ht(e) {
1559
+ const i = new URLSearchParams();
1560
+ return a.object(e) && Object.entries(e).forEach(([t, s]) => {
1561
+ i.set(t, s);
1562
+ }), i;
1563
+ }
1564
+ const A = {
1565
+ // Setup captions
1566
+ setup() {
1567
+ if (!this.supported.ui)
1568
+ return;
1569
+ if (!this.isVideo || this.isYouTube || this.isHTML5 && !$.textTracks) {
1570
+ a.array(this.config.controls) && this.config.controls.includes("settings") && this.config.settings.includes("captions") && d.setCaptionsMenu.call(this);
1571
+ return;
1572
+ }
1573
+ if (a.element(this.elements.captions) || (this.elements.captions = y("div", V(this.config.selectors.captions)), this.elements.captions.setAttribute("dir", "auto"), Bt(this.elements.captions, this.elements.wrapper)), _.isIE && window.URL) {
1574
+ const n = this.media.querySelectorAll("track");
1575
+ Array.from(n).forEach((r) => {
1576
+ const l = r.getAttribute("src"), o = ut(l);
1577
+ o !== null && o.hostname !== window.location.href.hostname && ["http:", "https:"].includes(o.protocol) && ne(l, "blob").then((c) => {
1578
+ r.setAttribute("src", window.URL.createObjectURL(c));
1579
+ }).catch(() => {
1580
+ U(r);
1581
+ });
1582
+ });
1583
+ }
1584
+ const e = navigator.languages || [navigator.language || navigator.userLanguage || "en"], i = Ce(e.map((n) => n.split("-")[0]));
1585
+ let t = (this.storage.get("language") || this.captions.language || this.config.captions.language || "auto").toLowerCase();
1586
+ t === "auto" && ([t] = i);
1587
+ let s = this.storage.get("captions") || this.captions.active;
1588
+ if (a.boolean(s) || ({
1589
+ active: s
1590
+ } = this.config.captions), Object.assign(this.captions, {
1591
+ toggled: !1,
1592
+ active: s,
1593
+ language: t,
1594
+ languages: i
1595
+ }), this.isHTML5) {
1596
+ const n = this.config.captions.update ? "addtrack removetrack" : "removetrack";
1597
+ T.call(this, this.media.textTracks, n, A.update.bind(this));
1598
+ }
1599
+ setTimeout(A.update.bind(this), 0);
1600
+ },
1601
+ // Update available language options in settings based on tracks
1602
+ update() {
1603
+ const e = A.getTracks.call(this, !0), {
1604
+ active: i,
1605
+ language: t,
1606
+ meta: s,
1607
+ currentTrackNode: n
1608
+ } = this.captions, r = !!e.find((l) => l.language === t);
1609
+ this.isHTML5 && this.isVideo && e.filter((l) => !s.get(l)).forEach((l) => {
1610
+ this.debug.log("Track added", l), s.set(l, {
1611
+ default: l.mode === "showing"
1612
+ }), l.mode === "showing" && (l.mode = "hidden"), T.call(this, l, "cuechange", () => A.updateCues.call(this));
1613
+ }), (r && this.language !== t || !e.includes(n)) && (A.setLanguage.call(this, t), A.toggle.call(this, i && r)), this.elements && E(this.elements.container, this.config.classNames.captions.enabled, !a.empty(e)), a.array(this.config.controls) && this.config.controls.includes("settings") && this.config.settings.includes("captions") && d.setCaptionsMenu.call(this);
1614
+ },
1615
+ // Toggle captions display
1616
+ // Used internally for the toggleCaptions method, with the passive option forced to false
1617
+ toggle(e, i = !0) {
1618
+ if (!this.supported.ui)
1619
+ return;
1620
+ const {
1621
+ toggled: t
1622
+ } = this.captions, s = this.config.classNames.captions.active, n = a.nullOrUndefined(e) ? !t : e;
1623
+ if (n !== t) {
1624
+ if (i || (this.captions.active = n, this.storage.set({
1625
+ captions: n
1626
+ })), !this.language && n && !i) {
1627
+ const r = A.getTracks.call(this), l = A.findTrack.call(this, [this.captions.language, ...this.captions.languages], !0);
1628
+ this.captions.language = l.language, A.set.call(this, r.indexOf(l));
1629
+ return;
1630
+ }
1631
+ this.elements.buttons.captions && (this.elements.buttons.captions.pressed = n), E(this.elements.container, s, n), this.captions.toggled = n, d.updateSetting.call(this, "captions"), v.call(this, this.media, n ? "captionsenabled" : "captionsdisabled");
1632
+ }
1633
+ setTimeout(() => {
1634
+ n && this.captions.toggled && (this.captions.currentTrackNode.mode = "hidden");
1635
+ });
1636
+ },
1637
+ // Set captions by track index
1638
+ // Used internally for the currentTrack setter with the passive option forced to false
1639
+ set(e, i = !0) {
1640
+ const t = A.getTracks.call(this);
1641
+ if (e === -1) {
1642
+ A.toggle.call(this, !1, i);
1643
+ return;
1644
+ }
1645
+ if (!a.number(e)) {
1646
+ this.debug.warn("Invalid caption argument", e);
1647
+ return;
1648
+ }
1649
+ if (!(e in t)) {
1650
+ this.debug.warn("Track not found", e);
1651
+ return;
1652
+ }
1653
+ if (this.captions.currentTrack !== e) {
1654
+ this.captions.currentTrack = e;
1655
+ const s = t[e], {
1656
+ language: n
1657
+ } = s || {};
1658
+ this.captions.currentTrackNode = s, d.updateSetting.call(this, "captions"), i || (this.captions.language = n, this.storage.set({
1659
+ language: n
1660
+ })), this.isVimeo && this.embed.enableTextTrack(n, null, !1), v.call(this, this.media, "languagechange");
1661
+ }
1662
+ A.toggle.call(this, !0, i), this.isHTML5 && this.isVideo && A.updateCues.call(this);
1663
+ },
1664
+ // Set captions by language
1665
+ // Used internally for the language setter with the passive option forced to false
1666
+ setLanguage(e, i = !0) {
1667
+ if (!a.string(e)) {
1668
+ this.debug.warn("Invalid language argument", e);
1669
+ return;
1670
+ }
1671
+ const t = e.toLowerCase();
1672
+ this.captions.language = t;
1673
+ const s = A.getTracks.call(this), n = A.findTrack.call(this, [t]);
1674
+ A.set.call(this, s.indexOf(n), i);
1675
+ },
1676
+ // Get current valid caption tracks
1677
+ // If update is false it will also ignore tracks without metadata
1678
+ // This is used to "freeze" the language options when captions.update is false
1679
+ getTracks(e = !1) {
1680
+ return Array.from((this.media || {}).textTracks || []).filter((t) => !this.isHTML5 || e || this.captions.meta.has(t)).filter((t) => ["captions", "subtitles"].includes(t.kind));
1681
+ },
1682
+ // Match tracks based on languages and get the first
1683
+ findTrack(e, i = !1) {
1684
+ const t = A.getTracks.call(this), s = (l) => Number((this.captions.meta.get(l) || {}).default), n = Array.from(t).sort((l, o) => s(o) - s(l));
1685
+ let r;
1686
+ return e.every((l) => (r = n.find((o) => o.language === l), !r)), r || (i ? n[0] : void 0);
1687
+ },
1688
+ // Get the current track
1689
+ getCurrentTrack() {
1690
+ return A.getTracks.call(this)[this.currentTrack];
1691
+ },
1692
+ // Get UI label for track
1693
+ getLabel(e) {
1694
+ let i = e;
1695
+ return !a.track(i) && $.textTracks && this.captions.toggled && (i = A.getCurrentTrack.call(this)), a.track(i) ? a.empty(i.label) ? a.empty(i.language) ? O.get("enabled", this.config) : e.language.toUpperCase() : i.label : O.get("disabled", this.config);
1696
+ },
1697
+ // Update captions using current track's active cues
1698
+ // Also optional array argument in case there isn't any track (ex: vimeo)
1699
+ updateCues(e) {
1700
+ if (!this.supported.ui)
1701
+ return;
1702
+ if (!a.element(this.elements.captions)) {
1703
+ this.debug.warn("No captions element to render to");
1704
+ return;
1705
+ }
1706
+ if (!a.nullOrUndefined(e) && !Array.isArray(e)) {
1707
+ this.debug.warn("updateCues: Invalid input", e);
1708
+ return;
1709
+ }
1710
+ let i = e;
1711
+ if (!i) {
1712
+ const n = A.getCurrentTrack.call(this);
1713
+ i = Array.from((n || {}).activeCues || []).map((r) => r.getCueAsHTML()).map(ai);
1714
+ }
1715
+ const t = i.map((n) => n.trim()).join(`
1716
+ `);
1717
+ if (t !== this.elements.captions.innerHTML) {
1718
+ ae(this.elements.captions);
1719
+ const n = y("span", V(this.config.selectors.caption));
1720
+ n.innerHTML = t, this.elements.captions.appendChild(n), v.call(this, this.media, "cuechange");
1721
+ }
1722
+ }
1723
+ }, dt = {
1724
+ // Disable
1725
+ enabled: !0,
1726
+ // Custom media title
1727
+ title: "",
1728
+ // Logging to console
1729
+ debug: !1,
1730
+ // Auto play (if supported)
1731
+ autoplay: !1,
1732
+ // Only allow one media playing at once (vimeo only)
1733
+ autopause: !0,
1734
+ // Allow inline playback on iOS
1735
+ playsinline: !0,
1736
+ // Default time to skip when rewind/fast forward
1737
+ seekTime: 10,
1738
+ // Default volume
1739
+ volume: 1,
1740
+ muted: !1,
1741
+ // Pass a custom duration
1742
+ duration: null,
1743
+ // Display the media duration on load in the current time position
1744
+ // If you have opted to display both duration and currentTime, this is ignored
1745
+ displayDuration: !0,
1746
+ // Invert the current time to be a countdown
1747
+ invertTime: !0,
1748
+ // Clicking the currentTime inverts it's value to show time left rather than elapsed
1749
+ toggleInvert: !0,
1750
+ // Force an aspect ratio
1751
+ // The format must be `'w:h'` (e.g. `'16:9'`)
1752
+ ratio: null,
1753
+ // Click video container to play/pause
1754
+ clickToPlay: !0,
1755
+ // Auto hide the controls
1756
+ hideControls: !0,
1757
+ // Reset to start when playback ended
1758
+ resetOnEnd: !1,
1759
+ // Disable the standard context menu
1760
+ disableContextMenu: !0,
1761
+ // Sprite (for icons)
1762
+ loadSprite: !0,
1763
+ iconPrefix: "plyr",
1764
+ iconUrl: "https://cdn.plyr.io/3.8.4/plyr.svg",
1765
+ // Blank video (used to prevent errors on source change)
1766
+ blankVideo: "https://cdn.plyr.io/static/blank.mp4",
1767
+ // Quality default
1768
+ quality: {
1769
+ default: 576,
1770
+ // The options to display in the UI, if available for the source media
1771
+ options: [4320, 2880, 2160, 1440, 1080, 720, 576, 480, 360, 240],
1772
+ forced: !1,
1773
+ onChange: null
1774
+ },
1775
+ // Set loops
1776
+ loop: {
1777
+ active: !1
1778
+ // start: null,
1779
+ // end: null,
1780
+ },
1781
+ // Speed default and options to display
1782
+ speed: {
1783
+ selected: 1,
1784
+ // The options to display in the UI, if available for the source media (e.g. Vimeo and YouTube only support 0.5x-4x)
1785
+ options: [0.5, 0.75, 1, 1.25, 1.5, 1.75, 2, 4]
1786
+ },
1787
+ // Keyboard shortcut settings
1788
+ keyboard: {
1789
+ focused: !0,
1790
+ global: !1
1791
+ },
1792
+ // Display tooltips
1793
+ tooltips: {
1794
+ controls: !1,
1795
+ seek: !0
1796
+ },
1797
+ // Captions settings
1798
+ captions: {
1799
+ active: !1,
1800
+ language: "auto",
1801
+ // Listen to new tracks added after Plyr is initialized.
1802
+ // This is needed for streaming captions, but may result in unselectable options
1803
+ update: !1
1804
+ },
1805
+ // Fullscreen settings
1806
+ fullscreen: {
1807
+ enabled: !0,
1808
+ // Allow fullscreen?
1809
+ fallback: !0,
1810
+ // Fallback using full viewport/window
1811
+ iosNative: !1
1812
+ // Use the native fullscreen in iOS (disables custom controls)
1813
+ // Selector for the fullscreen container so contextual / non-player content can remain visible in fullscreen mode
1814
+ // Non-ancestors of the player element will be ignored
1815
+ // container: null, // defaults to the player element
1816
+ },
1817
+ // Local storage
1818
+ storage: {
1819
+ enabled: !0,
1820
+ key: "plyr"
1821
+ },
1822
+ // Default controls
1823
+ controls: [
1824
+ "play-large",
1825
+ // 'restart',
1826
+ // 'rewind',
1827
+ "play",
1828
+ // 'fast-forward',
1829
+ "progress",
1830
+ "current-time",
1831
+ // 'duration',
1832
+ "mute",
1833
+ "volume",
1834
+ "captions",
1835
+ "settings",
1836
+ "pip",
1837
+ "airplay",
1838
+ // 'download',
1839
+ "fullscreen"
1840
+ ],
1841
+ settings: ["captions", "quality", "speed"],
1842
+ // Localisation
1843
+ i18n: {
1844
+ restart: "Restart",
1845
+ rewind: "Rewind {seektime}s",
1846
+ play: "Play",
1847
+ pause: "Pause",
1848
+ fastForward: "Forward {seektime}s",
1849
+ seek: "Seek",
1850
+ seekLabel: "{currentTime} of {duration}",
1851
+ played: "Played",
1852
+ buffered: "Buffered",
1853
+ currentTime: "Current time",
1854
+ duration: "Duration",
1855
+ volume: "Volume",
1856
+ mute: "Mute",
1857
+ unmute: "Unmute",
1858
+ enableCaptions: "Enable captions",
1859
+ disableCaptions: "Disable captions",
1860
+ download: "Download",
1861
+ enterFullscreen: "Enter fullscreen",
1862
+ exitFullscreen: "Exit fullscreen",
1863
+ frameTitle: "Player for {title}",
1864
+ captions: "Captions",
1865
+ settings: "Settings",
1866
+ pip: "PIP",
1867
+ menuBack: "Go back to previous menu",
1868
+ speed: "Speed",
1869
+ normal: "Normal",
1870
+ quality: "Quality",
1871
+ loop: "Loop",
1872
+ start: "Start",
1873
+ end: "End",
1874
+ all: "All",
1875
+ reset: "Reset",
1876
+ disabled: "Disabled",
1877
+ enabled: "Enabled",
1878
+ advertisement: "Ad",
1879
+ qualityBadge: {
1880
+ 2160: "4K",
1881
+ 1440: "HD",
1882
+ 1080: "HD",
1883
+ 720: "HD",
1884
+ 576: "SD",
1885
+ 480: "SD"
1886
+ }
1887
+ },
1888
+ // URLs
1889
+ urls: {
1890
+ download: null,
1891
+ vimeo: {
1892
+ sdk: "https://player.vimeo.com/api/player.js",
1893
+ iframe: "https://player.vimeo.com/video/{0}?{1}",
1894
+ api: "https://vimeo.com/api/oembed.json?url={0}"
1895
+ },
1896
+ youtube: {
1897
+ sdk: "https://www.youtube.com/iframe_api",
1898
+ api: "https://noembed.com/embed?url=https://www.youtube.com/watch?v={0}"
1899
+ },
1900
+ googleIMA: {
1901
+ sdk: "https://imasdk.googleapis.com/js/sdkloader/ima3.js"
1902
+ }
1903
+ },
1904
+ // Custom control listeners
1905
+ listeners: {
1906
+ seek: null,
1907
+ play: null,
1908
+ pause: null,
1909
+ restart: null,
1910
+ rewind: null,
1911
+ fastForward: null,
1912
+ mute: null,
1913
+ volume: null,
1914
+ captions: null,
1915
+ download: null,
1916
+ fullscreen: null,
1917
+ pip: null,
1918
+ airplay: null,
1919
+ speed: null,
1920
+ quality: null,
1921
+ loop: null,
1922
+ language: null
1923
+ },
1924
+ // Events to watch and bubble
1925
+ events: [
1926
+ // Events to watch on HTML5 media elements and bubble
1927
+ // https://developer.mozilla.org/en/docs/Web/Guide/Events/Media_events
1928
+ "ended",
1929
+ "progress",
1930
+ "stalled",
1931
+ "playing",
1932
+ "waiting",
1933
+ "canplay",
1934
+ "canplaythrough",
1935
+ "loadstart",
1936
+ "loadeddata",
1937
+ "loadedmetadata",
1938
+ "timeupdate",
1939
+ "volumechange",
1940
+ "play",
1941
+ "pause",
1942
+ "error",
1943
+ "seeking",
1944
+ "seeked",
1945
+ "emptied",
1946
+ "ratechange",
1947
+ "cuechange",
1948
+ // Custom events
1949
+ "download",
1950
+ "enterfullscreen",
1951
+ "exitfullscreen",
1952
+ "captionsenabled",
1953
+ "captionsdisabled",
1954
+ "languagechange",
1955
+ "controlshidden",
1956
+ "controlsshown",
1957
+ "ready",
1958
+ // YouTube
1959
+ "statechange",
1960
+ // Quality
1961
+ "qualitychange",
1962
+ // Ads
1963
+ "adsloaded",
1964
+ "adscontentpause",
1965
+ "adscontentresume",
1966
+ "adstarted",
1967
+ "adsmidpoint",
1968
+ "adscomplete",
1969
+ "adsallcomplete",
1970
+ "adsimpression",
1971
+ "adsclick"
1972
+ ],
1973
+ // Selectors
1974
+ // Change these to match your template if using custom HTML
1975
+ selectors: {
1976
+ editable: "input, textarea, select, [contenteditable]",
1977
+ container: ".plyr",
1978
+ controls: {
1979
+ container: null,
1980
+ wrapper: ".plyr__controls"
1981
+ },
1982
+ labels: "[data-plyr]",
1983
+ buttons: {
1984
+ play: '[data-plyr="play"]',
1985
+ pause: '[data-plyr="pause"]',
1986
+ restart: '[data-plyr="restart"]',
1987
+ rewind: '[data-plyr="rewind"]',
1988
+ fastForward: '[data-plyr="fast-forward"]',
1989
+ mute: '[data-plyr="mute"]',
1990
+ captions: '[data-plyr="captions"]',
1991
+ download: '[data-plyr="download"]',
1992
+ fullscreen: '[data-plyr="fullscreen"]',
1993
+ pip: '[data-plyr="pip"]',
1994
+ airplay: '[data-plyr="airplay"]',
1995
+ settings: '[data-plyr="settings"]',
1996
+ loop: '[data-plyr="loop"]'
1997
+ },
1998
+ inputs: {
1999
+ seek: '[data-plyr="seek"]',
2000
+ volume: '[data-plyr="volume"]',
2001
+ speed: '[data-plyr="speed"]',
2002
+ language: '[data-plyr="language"]',
2003
+ quality: '[data-plyr="quality"]'
2004
+ },
2005
+ display: {
2006
+ currentTime: ".plyr__time--current",
2007
+ duration: ".plyr__time--duration",
2008
+ buffer: ".plyr__progress__buffer",
2009
+ loop: ".plyr__progress__loop",
2010
+ // Used later
2011
+ volume: ".plyr__volume--display"
2012
+ },
2013
+ progress: ".plyr__progress",
2014
+ captions: ".plyr__captions",
2015
+ caption: ".plyr__caption"
2016
+ },
2017
+ // Class hooks added to the player in different states
2018
+ classNames: {
2019
+ type: "plyr--{0}",
2020
+ provider: "plyr--{0}",
2021
+ video: "plyr__video-wrapper",
2022
+ embed: "plyr__video-embed",
2023
+ videoFixedRatio: "plyr__video-wrapper--fixed-ratio",
2024
+ embedContainer: "plyr__video-embed__container",
2025
+ poster: "plyr__poster",
2026
+ posterEnabled: "plyr__poster-enabled",
2027
+ ads: "plyr__ads",
2028
+ control: "plyr__control",
2029
+ controlPressed: "plyr__control--pressed",
2030
+ playing: "plyr--playing",
2031
+ paused: "plyr--paused",
2032
+ stopped: "plyr--stopped",
2033
+ loading: "plyr--loading",
2034
+ hover: "plyr--hover",
2035
+ tooltip: "plyr__tooltip",
2036
+ cues: "plyr__cues",
2037
+ marker: "plyr__progress__marker",
2038
+ hidden: "plyr__sr-only",
2039
+ hideControls: "plyr--hide-controls",
2040
+ isTouch: "plyr--is-touch",
2041
+ uiSupported: "plyr--full-ui",
2042
+ noTransition: "plyr--no-transition",
2043
+ display: {
2044
+ time: "plyr__time"
2045
+ },
2046
+ menu: {
2047
+ value: "plyr__menu__value",
2048
+ badge: "plyr__badge",
2049
+ open: "plyr--menu-open"
2050
+ },
2051
+ captions: {
2052
+ enabled: "plyr--captions-enabled",
2053
+ active: "plyr--captions-active"
2054
+ },
2055
+ fullscreen: {
2056
+ enabled: "plyr--fullscreen-enabled",
2057
+ fallback: "plyr--fullscreen-fallback"
2058
+ },
2059
+ pip: {
2060
+ supported: "plyr--pip-supported",
2061
+ active: "plyr--pip-active"
2062
+ },
2063
+ airplay: {
2064
+ supported: "plyr--airplay-supported",
2065
+ active: "plyr--airplay-active"
2066
+ },
2067
+ previewThumbnails: {
2068
+ // Tooltip thumbs
2069
+ thumbContainer: "plyr__preview-thumb",
2070
+ thumbContainerShown: "plyr__preview-thumb--is-shown",
2071
+ imageContainer: "plyr__preview-thumb__image-container",
2072
+ timeContainer: "plyr__preview-thumb__time-container",
2073
+ // Scrubbing
2074
+ scrubbingContainer: "plyr__preview-scrubbing",
2075
+ scrubbingContainerShown: "plyr__preview-scrubbing--is-shown"
2076
+ }
2077
+ },
2078
+ // Embed attributes
2079
+ attributes: {
2080
+ embed: {
2081
+ provider: "data-plyr-provider",
2082
+ id: "data-plyr-embed-id",
2083
+ hash: "data-plyr-embed-hash"
2084
+ }
2085
+ },
2086
+ // Advertisements plugin
2087
+ // Register for an account here: http://vi.ai/publisher-video-monetization/?aid=plyrio
2088
+ ads: {
2089
+ enabled: !1,
2090
+ publisherId: "",
2091
+ tagUrl: ""
2092
+ },
2093
+ // Preview Thumbnails plugin
2094
+ previewThumbnails: {
2095
+ enabled: !1,
2096
+ src: "",
2097
+ withCredentials: !1
2098
+ },
2099
+ // Vimeo plugin
2100
+ vimeo: {
2101
+ byline: !1,
2102
+ portrait: !1,
2103
+ title: !1,
2104
+ speed: !0,
2105
+ transparent: !1,
2106
+ // Custom settings from Plyr
2107
+ customControls: !0,
2108
+ referrerPolicy: null,
2109
+ // https://developer.mozilla.org/en-US/docs/Web/API/HTMLIFrameElement/referrerPolicy
2110
+ // Whether the owner of the video has a Pro or Business account
2111
+ // (which allows us to properly hide controls without CSS hacks, etc)
2112
+ premium: !1
2113
+ },
2114
+ // YouTube plugin
2115
+ youtube: {
2116
+ rel: 0,
2117
+ // No related vids
2118
+ showinfo: 0,
2119
+ // Hide info
2120
+ iv_load_policy: 3,
2121
+ // Hide annotations
2122
+ modestbranding: 1,
2123
+ // Hide logos as much as possible (they still show one in the corner when paused)
2124
+ // Custom settings from Plyr
2125
+ customControls: !0,
2126
+ noCookie: !1
2127
+ // Whether to use an alternative version of YouTube without cookies
2128
+ },
2129
+ // Media Metadata
2130
+ mediaMetadata: {
2131
+ title: "",
2132
+ artist: "",
2133
+ album: "",
2134
+ artwork: []
2135
+ },
2136
+ // Markers
2137
+ markers: {
2138
+ enabled: !1,
2139
+ points: []
2140
+ }
2141
+ }, ye = {
2142
+ active: "picture-in-picture",
2143
+ inactive: "inline"
2144
+ }, W = {
2145
+ html5: "html5",
2146
+ youtube: "youtube",
2147
+ vimeo: "vimeo"
2148
+ }, ve = {
2149
+ audio: "audio",
2150
+ video: "video"
2151
+ };
2152
+ function ci(e) {
2153
+ return /^(?:https?:\/\/)?(?:www\.)?(?:youtube\.com|youtube-nocookie\.com|youtu\.?be)\/.+$/.test(e) ? W.youtube : /^https?:\/\/player.vimeo.com\/video\/\d{0,9}(?=\b|\/)/.test(e) ? W.vimeo : null;
2154
+ }
2155
+ function we() {
2156
+ }
2157
+ class ui {
2158
+ constructor(i = !1) {
2159
+ this.enabled = window.console && i, this.enabled && this.log("Debugging enabled");
2160
+ }
2161
+ get log() {
2162
+ return this.enabled ? Function.prototype.bind.call(console.log, console) : we;
2163
+ }
2164
+ get warn() {
2165
+ return this.enabled ? Function.prototype.bind.call(console.warn, console) : we;
2166
+ }
2167
+ get error() {
2168
+ return this.enabled ? Function.prototype.bind.call(console.error, console) : we;
2169
+ }
2170
+ }
2171
+ class q {
2172
+ constructor(i) {
2173
+ m(this, "onChange", () => {
2174
+ if (!this.supported) return;
2175
+ const t = this.player.elements.buttons.fullscreen;
2176
+ a.element(t) && (t.pressed = this.active);
2177
+ const s = this.target === this.player.media ? this.target : this.player.elements.container;
2178
+ v.call(this.player, s, this.active ? "enterfullscreen" : "exitfullscreen", !0);
2179
+ }), m(this, "toggleFallback", (t = !1) => {
2180
+ if (t) {
2181
+ var s, n;
2182
+ this.scrollPosition = {
2183
+ x: (s = window.scrollX) !== null && s !== void 0 ? s : 0,
2184
+ y: (n = window.scrollY) !== null && n !== void 0 ? n : 0
2185
+ };
2186
+ } else
2187
+ window.scrollTo(this.scrollPosition.x, this.scrollPosition.y);
2188
+ if (document.body.style.overflow = t ? "hidden" : "", E(this.target, this.player.config.classNames.fullscreen.fallback, t), _.isIos) {
2189
+ let r = document.head.querySelector('meta[name="viewport"]');
2190
+ const l = "viewport-fit=cover";
2191
+ r || (r = document.createElement("meta"), r.setAttribute("name", "viewport"));
2192
+ const o = a.string(r.content) && r.content.includes(l);
2193
+ t ? (this.cleanupViewport = !o, o || (r.content += `,${l}`)) : this.cleanupViewport && (r.content = r.content.split(",").filter((c) => c.trim() !== l).join(","));
2194
+ }
2195
+ this.onChange();
2196
+ }), m(this, "trapFocus", (t) => {
2197
+ if (_.isIos || _.isIPadOS || !this.active || t.key !== "Tab") return;
2198
+ const s = document.activeElement, n = Z.call(this.player, "a[href], button:not(:disabled), input:not(:disabled), [tabindex]"), [r] = n, l = n[n.length - 1];
2199
+ s === l && !t.shiftKey ? (r.focus(), t.preventDefault()) : s === r && t.shiftKey && (l.focus(), t.preventDefault());
2200
+ }), m(this, "update", () => {
2201
+ if (this.supported) {
2202
+ let t;
2203
+ this.forceFallback ? t = "Fallback (forced)" : q.nativeSupported ? t = "Native" : t = "Fallback", this.player.debug.log(`${t} fullscreen enabled`);
2204
+ } else
2205
+ this.player.debug.log("Fullscreen not supported and fallback disabled");
2206
+ E(this.player.elements.container, this.player.config.classNames.fullscreen.enabled, this.supported);
2207
+ }), m(this, "enter", () => {
2208
+ this.supported && (_.isIos && this.player.config.fullscreen.iosNative ? this.player.isVimeo ? this.player.embed.requestFullscreen() : this.target.webkitEnterFullscreen() : !q.nativeSupported || this.forceFallback ? this.toggleFallback(!0) : this.prefix ? a.empty(this.prefix) || this.target[`${this.prefix}Request${this.property}`]() : this.target.requestFullscreen({
2209
+ navigationUI: "hide"
2210
+ }));
2211
+ }), m(this, "exit", () => {
2212
+ if (this.supported) {
2213
+ if (_.isIos && this.player.config.fullscreen.iosNative)
2214
+ this.player.isVimeo ? this.player.embed.exitFullscreen() : this.target.webkitEnterFullscreen(), F(this.player.play());
2215
+ else if (!q.nativeSupported || this.forceFallback)
2216
+ this.toggleFallback(!1);
2217
+ else if (!this.prefix)
2218
+ (document.cancelFullScreen || document.exitFullscreen).call(document);
2219
+ else if (!a.empty(this.prefix)) {
2220
+ const t = this.prefix === "moz" ? "Cancel" : "Exit";
2221
+ document[`${this.prefix}${t}${this.property}`]();
2222
+ }
2223
+ }
2224
+ }), m(this, "toggle", () => {
2225
+ this.active ? this.exit() : this.enter();
2226
+ }), this.player = i, this.prefix = q.prefix, this.property = q.property, this.scrollPosition = {
2227
+ x: 0,
2228
+ y: 0
2229
+ }, this.forceFallback = i.config.fullscreen.fallback === "force", this.player.elements.fullscreen = i.config.fullscreen.container && Wt(this.player.elements.container, i.config.fullscreen.container), T.call(this.player, document, this.prefix === "ms" ? "MSFullscreenChange" : `${this.prefix}fullscreenchange`, () => {
2230
+ this.onChange();
2231
+ }), T.call(this.player, this.player.elements.container, "dblclick", (t) => {
2232
+ a.element(this.player.elements.controls) && this.player.elements.controls.contains(t.target) || this.player.listeners.proxy(t, this.toggle, "fullscreen");
2233
+ }), T.call(this, this.player.elements.container, "keydown", (t) => this.trapFocus(t)), this.update();
2234
+ }
2235
+ // Determine if native supported
2236
+ static get nativeSupported() {
2237
+ return !!(document.fullscreenEnabled || document.webkitFullscreenEnabled || document.mozFullScreenEnabled || document.msFullscreenEnabled);
2238
+ }
2239
+ // If we're actually using native
2240
+ get useNative() {
2241
+ return q.nativeSupported && !this.forceFallback;
2242
+ }
2243
+ // Get the prefix for handlers
2244
+ static get prefix() {
2245
+ if (a.function(document.exitFullscreen)) return "";
2246
+ let i = "";
2247
+ return ["webkit", "moz", "ms"].some((s) => a.function(document[`${s}ExitFullscreen`]) || a.function(document[`${s}CancelFullScreen`]) ? (i = s, !0) : !1), i;
2248
+ }
2249
+ static get property() {
2250
+ return this.prefix === "moz" ? "FullScreen" : "Fullscreen";
2251
+ }
2252
+ // Determine if fullscreen is supported
2253
+ get supported() {
2254
+ return [
2255
+ // Fullscreen is enabled in config
2256
+ this.player.config.fullscreen.enabled,
2257
+ // Must be a video
2258
+ this.player.isVideo,
2259
+ // Either native is supported or fallback enabled
2260
+ q.nativeSupported || this.player.config.fullscreen.fallback,
2261
+ // YouTube has no way to trigger fullscreen, so on devices with no native support, playsinline
2262
+ // must be enabled and iosNative fullscreen must be disabled to offer the fullscreen fallback
2263
+ !this.player.isYouTube || q.nativeSupported || !_.isIos || this.player.config.playsinline && !this.player.config.fullscreen.iosNative
2264
+ ].every(Boolean);
2265
+ }
2266
+ // Get active state
2267
+ get active() {
2268
+ if (!this.supported) return !1;
2269
+ if (!q.nativeSupported || this.forceFallback)
2270
+ return he(this.target, this.player.config.classNames.fullscreen.fallback);
2271
+ const i = this.prefix ? this.target.getRootNode()[`${this.prefix}${this.property}Element`] : this.target.getRootNode().fullscreenElement;
2272
+ return i && i.shadowRoot ? i === this.target.getRootNode().host : i === this.target;
2273
+ }
2274
+ // Get target element
2275
+ get target() {
2276
+ var i;
2277
+ return _.isIos && this.player.config.fullscreen.iosNative ? this.player.media : (i = this.player.elements.fullscreen) !== null && i !== void 0 ? i : this.player.elements.container;
2278
+ }
2279
+ }
2280
+ function le(e, i = 1) {
2281
+ return new Promise((t, s) => {
2282
+ const n = new Image(), r = () => {
2283
+ delete n.onload, delete n.onerror, (n.naturalWidth >= i ? t : s)(n);
2284
+ };
2285
+ Object.assign(n, {
2286
+ onload: r,
2287
+ onerror: r,
2288
+ src: e
2289
+ });
2290
+ });
2291
+ }
2292
+ const S = {
2293
+ addStyleHook() {
2294
+ E(this.elements.container, this.config.selectors.container.replace(".", ""), !0), E(this.elements.container, this.config.classNames.uiSupported, this.supported.ui);
2295
+ },
2296
+ // Toggle native HTML5 media controls
2297
+ toggleNativeControls(e = !1) {
2298
+ e && this.isHTML5 ? this.media.setAttribute("controls", "") : this.media.removeAttribute("controls");
2299
+ },
2300
+ // Setup the UI
2301
+ build() {
2302
+ if (this.listeners.media(), !this.supported.ui) {
2303
+ this.debug.warn(`Basic support only for ${this.provider} ${this.type}`), S.toggleNativeControls.call(this, !0);
2304
+ return;
2305
+ }
2306
+ a.element(this.elements.controls) || (d.inject.call(this), this.listeners.controls()), S.toggleNativeControls.call(this), this.isHTML5 && A.setup.call(this), this.volume = null, this.muted = null, this.loop = null, this.quality = null, this.speed = null, d.updateVolume.call(this), d.timeUpdate.call(this), d.durationUpdate.call(this), S.checkPlaying.call(this), E(this.elements.container, this.config.classNames.pip.supported, $.pip && this.isHTML5 && this.isVideo), E(this.elements.container, this.config.classNames.airplay.supported, $.airplay && this.isHTML5), E(this.elements.container, this.config.classNames.isTouch, this.touch), this.ready = !0, setTimeout(() => {
2307
+ v.call(this, this.media, "ready");
2308
+ }, 0), S.setTitle.call(this), this.poster && S.setPoster.call(this, this.poster, !1).catch(() => {
2309
+ }), this.config.duration && d.durationUpdate.call(this), this.config.mediaMetadata && d.setMediaMetadata.call(this);
2310
+ },
2311
+ // Setup aria attribute for play and iframe title
2312
+ setTitle() {
2313
+ let e = O.get("play", this.config);
2314
+ if (a.string(this.config.title) && !a.empty(this.config.title) && (e += `, ${this.config.title}`), Array.from(this.elements.buttons.play || []).forEach((i) => {
2315
+ i.setAttribute("aria-label", e);
2316
+ }), this.isEmbed) {
2317
+ const i = I.call(this, "iframe");
2318
+ if (!a.element(i))
2319
+ return;
2320
+ const t = a.empty(this.config.title) ? "video" : this.config.title, s = O.get("frameTitle", this.config);
2321
+ i.setAttribute("title", s.replace("{title}", t));
2322
+ }
2323
+ },
2324
+ // Toggle poster
2325
+ togglePoster(e) {
2326
+ E(this.elements.container, this.config.classNames.posterEnabled, e);
2327
+ },
2328
+ // Set the poster image (async)
2329
+ // Used internally for the poster setter, with the passive option forced to false
2330
+ setPoster(e, i = !0) {
2331
+ return i && this.poster ? Promise.reject(new Error("Poster already set")) : (this.media.setAttribute("data-poster", e), this.elements.poster.removeAttribute("hidden"), Yt.call(this).then(() => le(e)).catch((t) => {
2332
+ throw e === this.poster && S.togglePoster.call(this, !1), t;
2333
+ }).then(() => {
2334
+ if (e !== this.poster)
2335
+ throw new Error("setPoster cancelled by later call to setPoster");
2336
+ }).then(() => (Object.assign(this.elements.poster.style, {
2337
+ backgroundImage: `url('${e}')`,
2338
+ // Reset backgroundSize as well (since it can be set to "cover" for padded thumbnails for youtube)
2339
+ backgroundSize: ""
2340
+ }), S.togglePoster.call(this, !0), e)));
2341
+ },
2342
+ // Check playing state
2343
+ checkPlaying(e) {
2344
+ E(this.elements.container, this.config.classNames.playing, this.playing), E(this.elements.container, this.config.classNames.paused, this.paused), E(this.elements.container, this.config.classNames.stopped, this.stopped), Array.from(this.elements.buttons.play || []).forEach((i) => {
2345
+ Object.assign(i, {
2346
+ pressed: this.playing
2347
+ }), i.setAttribute("aria-label", O.get(this.playing ? "pause" : "play", this.config));
2348
+ }), !(a.event(e) && e.type === "timeupdate") && S.toggleControls.call(this);
2349
+ },
2350
+ // Check if media is loading
2351
+ checkLoading(e) {
2352
+ this.loading = ["stalled", "waiting"].includes(e.type), clearTimeout(this.timers.loading), this.timers.loading = setTimeout(() => {
2353
+ E(this.elements.container, this.config.classNames.loading, this.loading), S.toggleControls.call(this);
2354
+ }, this.loading ? 250 : 0);
2355
+ },
2356
+ // Toggle controls based on state and `force` argument
2357
+ toggleControls(e) {
2358
+ const {
2359
+ controls: i
2360
+ } = this.elements;
2361
+ if (i && this.config.hideControls) {
2362
+ const t = this.touch && this.lastSeekTime + 2e3 > Date.now();
2363
+ this.toggleControls(!!(e || this.loading || this.paused || i.pressed || i.hover || t));
2364
+ }
2365
+ },
2366
+ // Migrate any custom properties from the media to the parent
2367
+ migrateStyles() {
2368
+ Object.values({
2369
+ ...this.media.style
2370
+ }).filter((e) => !a.empty(e) && a.string(e) && e.startsWith("--plyr")).forEach((e) => {
2371
+ this.elements.container.style.setProperty(e, this.media.style.getPropertyValue(e)), this.media.style.removeProperty(e);
2372
+ }), a.empty(this.media.style) && this.media.removeAttribute("style");
2373
+ }
2374
+ };
2375
+ class hi {
2376
+ constructor(i) {
2377
+ m(this, "firstTouch", () => {
2378
+ const {
2379
+ player: t
2380
+ } = this, {
2381
+ elements: s
2382
+ } = t;
2383
+ t.touch = !0, E(s.container, t.config.classNames.isTouch, !0);
2384
+ }), m(this, "global", (t = !0) => {
2385
+ const {
2386
+ player: s
2387
+ } = this;
2388
+ s.config.keyboard.global && ee.call(s, window, "keydown keyup", this.handleKey, t, !1), ee.call(s, document.body, "click", this.toggleMenu, t), xe.call(s, document.body, "touchstart", this.firstTouch);
2389
+ }), m(this, "container", () => {
2390
+ const {
2391
+ player: t
2392
+ } = this, {
2393
+ config: s,
2394
+ elements: n,
2395
+ timers: r
2396
+ } = t;
2397
+ !s.keyboard.global && s.keyboard.focused && T.call(t, n.container, "keydown keyup", this.handleKey, !1), T.call(t, n.container, "mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen", (c) => {
2398
+ const {
2399
+ controls: u
2400
+ } = n;
2401
+ u && c.type === "enterfullscreen" && (u.pressed = !1, u.hover = !1);
2402
+ const p = ["touchstart", "touchmove", "mousemove"].includes(c.type);
2403
+ let b = 0;
2404
+ p && (S.toggleControls.call(t, !0), b = t.touch ? 3e3 : 2e3), clearTimeout(r.controls), r.controls = setTimeout(() => S.toggleControls.call(t, !1), b);
2405
+ });
2406
+ const l = () => {
2407
+ if (!t.isVimeo || t.config.vimeo.premium)
2408
+ return;
2409
+ const c = n.wrapper, {
2410
+ active: u
2411
+ } = t.fullscreen, [p, b] = Le.call(t), h = nt(`aspect-ratio: ${p} / ${b}`);
2412
+ if (!u) {
2413
+ h ? (c.style.width = null, c.style.height = null) : (c.style.maxWidth = null, c.style.margin = null);
2414
+ return;
2415
+ }
2416
+ const [g, C] = Xt(), w = g / C > p / b;
2417
+ h ? (c.style.width = w ? "auto" : "100%", c.style.height = w ? "100%" : "auto") : (c.style.maxWidth = w ? `${C / b * p}px` : null, c.style.margin = w ? "0 auto" : null);
2418
+ }, o = () => {
2419
+ clearTimeout(r.resized), r.resized = setTimeout(l, 50);
2420
+ };
2421
+ T.call(t, n.container, "enterfullscreen exitfullscreen", (c) => {
2422
+ const {
2423
+ target: u
2424
+ } = t.fullscreen;
2425
+ if (u !== n.container || !t.isEmbed && a.empty(t.config.ratio))
2426
+ return;
2427
+ l(), (c.type === "enterfullscreen" ? T : fe).call(t, window, "resize", o);
2428
+ });
2429
+ }), m(this, "media", () => {
2430
+ const {
2431
+ player: t
2432
+ } = this, {
2433
+ elements: s
2434
+ } = t;
2435
+ if (T.call(t, t.media, "timeupdate seeking seeked", (r) => d.timeUpdate.call(t, r)), T.call(t, t.media, "durationchange loadeddata loadedmetadata", (r) => d.durationUpdate.call(t, r)), T.call(t, t.media, "ended", () => {
2436
+ t.isHTML5 && t.isVideo && t.config.resetOnEnd && (t.restart(), t.pause());
2437
+ }), T.call(t, t.media, "progress playing seeking seeked", (r) => d.updateProgress.call(t, r)), T.call(t, t.media, "volumechange", (r) => d.updateVolume.call(t, r)), T.call(t, t.media, "playing play pause ended emptied timeupdate", (r) => S.checkPlaying.call(t, r)), T.call(t, t.media, "waiting canplay seeked playing", (r) => S.checkLoading.call(t, r)), t.supported.ui && t.config.clickToPlay && !t.isAudio) {
2438
+ const r = I.call(t, `.${t.config.classNames.video}`);
2439
+ if (!a.element(r))
2440
+ return;
2441
+ T.call(t, s.container, "click", (l) => {
2442
+ ![s.container, r].includes(l.target) && !r.contains(l.target) || t.touch && t.config.hideControls || (t.ended ? (this.proxy(l, t.restart, "restart"), this.proxy(l, () => {
2443
+ F(t.play());
2444
+ }, "play")) : this.proxy(l, () => {
2445
+ F(t.togglePlay());
2446
+ }, "play"));
2447
+ });
2448
+ }
2449
+ t.supported.ui && t.config.disableContextMenu && T.call(t, s.wrapper, "contextmenu", (r) => {
2450
+ r.preventDefault();
2451
+ }, !1), T.call(t, t.media, "volumechange", () => {
2452
+ t.storage.set({
2453
+ volume: t.volume,
2454
+ muted: t.muted
2455
+ });
2456
+ }), T.call(t, t.media, "ratechange", () => {
2457
+ d.updateSetting.call(t, "speed"), t.storage.set({
2458
+ speed: t.speed
2459
+ });
2460
+ }), T.call(t, t.media, "qualitychange", (r) => {
2461
+ d.updateSetting.call(t, "quality", null, r.detail.quality);
2462
+ }), T.call(t, t.media, "ready qualitychange", () => {
2463
+ d.setDownloadUrl.call(t);
2464
+ });
2465
+ const n = t.config.events.concat(["keyup", "keydown"]).join(" ");
2466
+ T.call(t, t.media, n, (r) => {
2467
+ let {
2468
+ detail: l = {}
2469
+ } = r;
2470
+ r.type === "error" && (l = t.media.error), v.call(t, s.container, r.type, !0, l);
2471
+ });
2472
+ }), m(this, "proxy", (t, s, n) => {
2473
+ const {
2474
+ player: r
2475
+ } = this, l = r.config.listeners[n], o = a.function(l);
2476
+ let c = !0;
2477
+ o && (c = l.call(r, t)), c !== !1 && a.function(s) && s.call(r, t);
2478
+ }), m(this, "bind", (t, s, n, r, l = !0) => {
2479
+ const {
2480
+ player: o
2481
+ } = this, c = o.config.listeners[r], u = a.function(c);
2482
+ T.call(o, t, s, (p) => this.proxy(p, n, r), l && !u);
2483
+ }), m(this, "controls", () => {
2484
+ const {
2485
+ player: t
2486
+ } = this, {
2487
+ elements: s
2488
+ } = t, n = _.isIE ? "change" : "input";
2489
+ if (s.buttons.play && Array.from(s.buttons.play).forEach((r) => {
2490
+ this.bind(r, "click", () => {
2491
+ F(t.togglePlay());
2492
+ }, "play");
2493
+ }), this.bind(s.buttons.restart, "click", t.restart, "restart"), this.bind(s.buttons.rewind, "click", () => {
2494
+ t.lastSeekTime = Date.now(), t.rewind();
2495
+ }, "rewind"), this.bind(s.buttons.fastForward, "click", () => {
2496
+ t.lastSeekTime = Date.now(), t.forward();
2497
+ }, "fastForward"), this.bind(s.buttons.mute, "click", () => {
2498
+ t.muted = !t.muted;
2499
+ }, "mute"), this.bind(s.buttons.captions, "click", () => t.toggleCaptions()), this.bind(s.buttons.download, "click", () => {
2500
+ v.call(t, t.media, "download");
2501
+ }, "download"), this.bind(s.buttons.fullscreen, "click", () => {
2502
+ t.fullscreen.toggle();
2503
+ }, "fullscreen"), this.bind(s.buttons.pip, "click", () => {
2504
+ t.pip = "toggle";
2505
+ }, "pip"), this.bind(s.buttons.airplay, "click", t.airplay, "airplay"), this.bind(s.buttons.settings, "click", (r) => {
2506
+ r.stopPropagation(), r.preventDefault(), d.toggleMenu.call(t, r);
2507
+ }, null, !1), this.bind(
2508
+ s.buttons.settings,
2509
+ "keyup",
2510
+ (r) => {
2511
+ if ([" ", "Enter"].includes(r.key)) {
2512
+ if (r.key === "Enter") {
2513
+ d.focusFirstMenuItem.call(t, null, !0);
2514
+ return;
2515
+ }
2516
+ r.preventDefault(), r.stopPropagation(), d.toggleMenu.call(t, r);
2517
+ }
2518
+ },
2519
+ null,
2520
+ !1
2521
+ // Can't be passive as we're preventing default
2522
+ ), this.bind(s.settings.menu, "keydown", (r) => {
2523
+ r.key === "Escape" && d.toggleMenu.call(t, r);
2524
+ }), this.bind(s.inputs.seek, "mousedown mousemove", (r) => {
2525
+ const l = s.progress.getBoundingClientRect(), o = r.pageX - r.clientX, c = 100 / l.width * (r.pageX - l.left - o);
2526
+ r.currentTarget.setAttribute("seek-value", c);
2527
+ }), this.bind(s.inputs.seek, "mousedown mouseup keydown keyup touchstart touchend", (r) => {
2528
+ const l = r.currentTarget, o = "play-on-seeked";
2529
+ if (a.keyboardEvent(r) && !["ArrowLeft", "ArrowRight"].includes(r.key))
2530
+ return;
2531
+ t.lastSeekTime = Date.now();
2532
+ const c = l.hasAttribute(o), u = ["mouseup", "touchend", "keyup"].includes(r.type);
2533
+ c && u ? (l.removeAttribute(o), F(t.play())) : !u && t.playing && (l.setAttribute(o, ""), t.pause());
2534
+ }), _.isIos) {
2535
+ const r = Z.call(t, 'input[type="range"]');
2536
+ Array.from(r).forEach((l) => this.bind(l, n, (o) => et(o.target)));
2537
+ }
2538
+ this.bind(s.inputs.seek, n, (r) => {
2539
+ const l = r.currentTarget;
2540
+ let o = l.getAttribute("seek-value");
2541
+ a.empty(o) && (o = l.value), l.removeAttribute("seek-value"), t.currentTime = o / l.max * t.duration;
2542
+ }, "seek"), this.bind(s.progress, "mouseenter mouseleave mousemove", (r) => d.updateSeekTooltip.call(t, r)), this.bind(s.progress, "mousemove touchmove", (r) => {
2543
+ const {
2544
+ previewThumbnails: l
2545
+ } = t;
2546
+ l && l.loaded && l.startMove(r);
2547
+ }), this.bind(s.progress, "mouseleave touchend click", () => {
2548
+ const {
2549
+ previewThumbnails: r
2550
+ } = t;
2551
+ r && r.loaded && r.endMove(!1, !0);
2552
+ }), this.bind(s.progress, "mousedown touchstart", (r) => {
2553
+ const {
2554
+ previewThumbnails: l
2555
+ } = t;
2556
+ l && l.loaded && l.startScrubbing(r);
2557
+ }), this.bind(s.progress, "mouseup touchend", (r) => {
2558
+ const {
2559
+ previewThumbnails: l
2560
+ } = t;
2561
+ l && l.loaded && l.endScrubbing(r);
2562
+ }), _.isWebKit && Array.from(Z.call(t, 'input[type="range"]')).forEach((r) => {
2563
+ this.bind(r, "input", (l) => d.updateRangeFill.call(t, l.target));
2564
+ }), t.config.toggleInvert && !a.element(s.display.duration) && this.bind(s.display.currentTime, "click", () => {
2565
+ t.currentTime !== 0 && (t.config.invertTime = !t.config.invertTime, d.timeUpdate.call(t));
2566
+ }), this.bind(s.inputs.volume, n, (r) => {
2567
+ t.volume = r.target.value;
2568
+ }, "volume"), this.bind(s.controls, "mouseenter mouseleave", (r) => {
2569
+ s.controls.hover = !t.touch && r.type === "mouseenter";
2570
+ }), s.fullscreen && Array.from(s.fullscreen.children).filter((r) => !r.contains(s.container)).forEach((r) => {
2571
+ this.bind(r, "mouseenter mouseleave", (l) => {
2572
+ s.controls && (s.controls.hover = !t.touch && l.type === "mouseenter");
2573
+ });
2574
+ }), this.bind(s.controls, "mousedown mouseup touchstart touchend touchcancel", (r) => {
2575
+ s.controls.pressed = ["mousedown", "touchstart"].includes(r.type);
2576
+ }), this.bind(s.controls, "focusin", () => {
2577
+ const {
2578
+ config: r,
2579
+ timers: l
2580
+ } = t;
2581
+ E(s.controls, r.classNames.noTransition, !0), S.toggleControls.call(t, !0), setTimeout(() => {
2582
+ E(s.controls, r.classNames.noTransition, !1);
2583
+ }, 0);
2584
+ const o = this.touch ? 3e3 : 4e3;
2585
+ clearTimeout(l.controls), l.controls = setTimeout(() => S.toggleControls.call(t, !1), o);
2586
+ }), this.bind(s.inputs.volume, "wheel", (r) => {
2587
+ const l = r.webkitDirectionInvertedFromDevice, [o, c] = [r.deltaX, -r.deltaY].map((b) => l ? -b : b), u = Math.sign(Math.abs(o) > Math.abs(c) ? o : c);
2588
+ t.increaseVolume(u / 50);
2589
+ const {
2590
+ volume: p
2591
+ } = t.media;
2592
+ (u === 1 && p < 1 || u === -1 && p > 0) && r.preventDefault();
2593
+ }, "volume", !1);
2594
+ }), this.player = i, this.lastKey = null, this.focusTimer = null, this.lastKeyDown = null, this.handleKey = this.handleKey.bind(this), this.toggleMenu = this.toggleMenu.bind(this), this.firstTouch = this.firstTouch.bind(this);
2595
+ }
2596
+ // Handle key presses
2597
+ handleKey(i) {
2598
+ const {
2599
+ player: t
2600
+ } = this, {
2601
+ elements: s
2602
+ } = t, {
2603
+ key: n,
2604
+ type: r,
2605
+ altKey: l,
2606
+ ctrlKey: o,
2607
+ metaKey: c,
2608
+ shiftKey: u
2609
+ } = i, p = r === "keydown", b = p && n === this.lastKey;
2610
+ if (l || o || c || u || !n)
2611
+ return;
2612
+ const h = (g) => {
2613
+ t.currentTime = t.duration / 10 * g;
2614
+ };
2615
+ if (p) {
2616
+ const g = document.activeElement;
2617
+ if (a.element(g)) {
2618
+ const {
2619
+ editable: w
2620
+ } = t.config.selectors, {
2621
+ seek: x
2622
+ } = s.inputs;
2623
+ if (g !== x && Y(g, w) || i.key === " " && Y(g, 'button, [role^="menuitem"]'))
2624
+ return;
2625
+ }
2626
+ switch ([" ", "ArrowLeft", "ArrowUp", "ArrowRight", "ArrowDown", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "c", "f", "k", "l", "m"].includes(n) && (i.preventDefault(), i.stopPropagation()), n) {
2627
+ case "0":
2628
+ case "1":
2629
+ case "2":
2630
+ case "3":
2631
+ case "4":
2632
+ case "5":
2633
+ case "6":
2634
+ case "7":
2635
+ case "8":
2636
+ case "9":
2637
+ b || h(Number.parseInt(n, 10));
2638
+ break;
2639
+ case " ":
2640
+ case "k":
2641
+ b || F(t.togglePlay());
2642
+ break;
2643
+ case "ArrowUp":
2644
+ t.increaseVolume(0.1);
2645
+ break;
2646
+ case "ArrowDown":
2647
+ t.decreaseVolume(0.1);
2648
+ break;
2649
+ case "m":
2650
+ b || (t.muted = !t.muted);
2651
+ break;
2652
+ case "ArrowRight":
2653
+ t.forward();
2654
+ break;
2655
+ case "ArrowLeft":
2656
+ t.rewind();
2657
+ break;
2658
+ case "f":
2659
+ t.fullscreen.toggle();
2660
+ break;
2661
+ case "c":
2662
+ b || t.toggleCaptions();
2663
+ break;
2664
+ case "l":
2665
+ t.loop = !t.loop;
2666
+ break;
2667
+ }
2668
+ n === "Escape" && !t.fullscreen.usingNative && t.fullscreen.active && t.fullscreen.toggle(), this.lastKey = n;
2669
+ } else
2670
+ this.lastKey = null;
2671
+ }
2672
+ // Toggle menu
2673
+ toggleMenu(i) {
2674
+ d.toggleMenu.call(this.player, i);
2675
+ }
2676
+ }
2677
+ function di(e) {
2678
+ return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
2679
+ }
2680
+ var oe = { exports: {} }, mi = oe.exports, Fe;
2681
+ function pi() {
2682
+ return Fe || (Fe = 1, (function(e, i) {
2683
+ (function(t, s) {
2684
+ e.exports = s();
2685
+ })(mi, function() {
2686
+ var t = function() {
2687
+ }, s = {}, n = {}, r = {};
2688
+ function l(h, g) {
2689
+ h = h.push ? h : [h];
2690
+ var C = [], w = h.length, x = w, P, f, k, M;
2691
+ for (P = function(j, R) {
2692
+ R.length && C.push(j), x--, x || g(C);
2693
+ }; w--; ) {
2694
+ if (f = h[w], k = n[f], k) {
2695
+ P(f, k);
2696
+ continue;
2697
+ }
2698
+ M = r[f] = r[f] || [], M.push(P);
2699
+ }
2700
+ }
2701
+ function o(h, g) {
2702
+ if (h) {
2703
+ var C = r[h];
2704
+ if (n[h] = g, !!C)
2705
+ for (; C.length; )
2706
+ C[0](h, g), C.splice(0, 1);
2707
+ }
2708
+ }
2709
+ function c(h, g) {
2710
+ h.call && (h = {
2711
+ success: h
2712
+ }), g.length ? (h.error || t)(g) : (h.success || t)(h);
2713
+ }
2714
+ function u(h, g, C, w) {
2715
+ var x = document, P = C.async, f = (C.numRetries || 0) + 1, k = C.before || t, M = h.replace(/[\?|#].*$/, ""), j = h.replace(/^(css|img|module|nomodule)!/, ""), R, H, N;
2716
+ if (w = w || 0, /(^css!|\.css$)/.test(M))
2717
+ N = x.createElement("link"), N.rel = "stylesheet", N.href = j, R = "hideFocus" in N, R && N.relList && (R = 0, N.rel = "preload", N.as = "style");
2718
+ else if (/(^img!|\.(png|gif|jpg|svg|webp)$)/.test(M))
2719
+ N = x.createElement("img"), N.src = j;
2720
+ else if (N = x.createElement("script"), N.src = j, N.async = P === void 0 ? !0 : P, H = "noModule" in N, /^module!/.test(M)) {
2721
+ if (!H) return g(h, "l");
2722
+ N.type = "module";
2723
+ } else if (/^nomodule!/.test(M) && H) return g(h, "l");
2724
+ N.onload = N.onerror = N.onbeforeload = function(Ie) {
2725
+ var re = Ie.type[0];
2726
+ if (R)
2727
+ try {
2728
+ N.sheet.cssText.length || (re = "e");
2729
+ } catch (ft) {
2730
+ ft.code != 18 && (re = "e");
2731
+ }
2732
+ if (re == "e") {
2733
+ if (w += 1, w < f)
2734
+ return u(h, g, C, w);
2735
+ } else if (N.rel == "preload" && N.as == "style")
2736
+ return N.rel = "stylesheet";
2737
+ g(h, re, Ie.defaultPrevented);
2738
+ }, k(h, N) !== !1 && x.head.appendChild(N);
2739
+ }
2740
+ function p(h, g, C) {
2741
+ h = h.push ? h : [h];
2742
+ var w = h.length, x = w, P = [], f, k;
2743
+ for (f = function(M, j, R) {
2744
+ if (j == "e" && P.push(M), j == "b")
2745
+ if (R) P.push(M);
2746
+ else return;
2747
+ w--, w || g(P);
2748
+ }, k = 0; k < x; k++) u(h[k], f, C);
2749
+ }
2750
+ function b(h, g, C) {
2751
+ var w, x;
2752
+ if (g && g.trim && (w = g), x = (w ? C : g) || {}, w) {
2753
+ if (w in s)
2754
+ throw "LoadJS";
2755
+ s[w] = !0;
2756
+ }
2757
+ function P(f, k) {
2758
+ p(h, function(M) {
2759
+ c(x, M), f && c({
2760
+ success: f,
2761
+ error: k
2762
+ }, M), o(w, M);
2763
+ }, x);
2764
+ }
2765
+ if (x.returnPromise) return new Promise(P);
2766
+ P();
2767
+ }
2768
+ return b.ready = function(g, C) {
2769
+ return l(g, function(w) {
2770
+ c(C, w);
2771
+ }), b;
2772
+ }, b.done = function(g) {
2773
+ o(g, []);
2774
+ }, b.reset = function() {
2775
+ s = {}, n = {}, r = {};
2776
+ }, b.isDefined = function(g) {
2777
+ return g in s;
2778
+ }, b;
2779
+ });
2780
+ })(oe)), oe.exports;
2781
+ }
2782
+ var fi = pi(), gi = /* @__PURE__ */ di(fi);
2783
+ function $e(e) {
2784
+ return new Promise((i, t) => {
2785
+ gi(e, {
2786
+ success: i,
2787
+ error: t
2788
+ });
2789
+ });
2790
+ }
2791
+ function bi(e) {
2792
+ if (a.empty(e))
2793
+ return null;
2794
+ if (a.number(Number(e)))
2795
+ return e;
2796
+ const i = /^.*(vimeo.com\/|video\/)(\d+).*/, t = e.match(i);
2797
+ return t ? t[2] : e;
2798
+ }
2799
+ function yi(e) {
2800
+ const i = /^.*(vimeo.com\/|video\/)(\d+)(\?.*h=|\/)+([\d,a-f]+)/, t = e.match(i);
2801
+ return t && t.length === 5 ? t[4] : null;
2802
+ }
2803
+ function Q(e) {
2804
+ e && !this.embed.hasPlayed && (this.embed.hasPlayed = !0), this.media.paused === e && (this.media.paused = !e, v.call(this, this.media, e ? "play" : "pause"));
2805
+ }
2806
+ const Ee = {
2807
+ setup() {
2808
+ const e = this;
2809
+ E(e.elements.wrapper, e.config.classNames.embed, !0), e.options.speed = e.config.speed.options, X.call(e), a.object(window.Vimeo) ? Ee.ready.call(e) : $e(e.config.urls.vimeo.sdk).then(() => {
2810
+ Ee.ready.call(e);
2811
+ }).catch((i) => {
2812
+ e.debug.warn("Vimeo SDK (player.js) failed to load", i);
2813
+ });
2814
+ },
2815
+ // API Ready
2816
+ ready() {
2817
+ const e = this, i = e.config.vimeo, {
2818
+ premium: t,
2819
+ referrerPolicy: s,
2820
+ ...n
2821
+ } = i;
2822
+ let r = e.media.getAttribute("src"), l = "";
2823
+ a.empty(r) ? (r = e.media.getAttribute(e.config.attributes.embed.id), l = e.media.getAttribute(e.config.attributes.embed.hash)) : l = yi(r);
2824
+ const o = l ? {
2825
+ h: l
2826
+ } : {};
2827
+ t && Object.assign(n, {
2828
+ controls: !1,
2829
+ sidedock: !1
2830
+ });
2831
+ const c = ht({
2832
+ loop: e.config.loop.active,
2833
+ autoplay: e.autoplay,
2834
+ muted: e.muted,
2835
+ gesture: "media",
2836
+ playsinline: e.config.playsinline,
2837
+ // hash has to be added to iframe-URL
2838
+ ...o,
2839
+ ...n
2840
+ }), u = bi(r), p = y("iframe"), b = Ae(e.config.urls.vimeo.iframe, u, c);
2841
+ if (p.setAttribute("src", b), p.setAttribute("allowfullscreen", ""), p.setAttribute("allow", ["autoplay", "fullscreen", "picture-in-picture", "encrypted-media", "accelerometer", "gyroscope"].join("; ")), a.empty(s) || p.setAttribute("referrerPolicy", s), t || !i.customControls)
2842
+ p.setAttribute("data-poster", e.poster), e.media = ue(p, e.media);
2843
+ else {
2844
+ const f = y("div", {
2845
+ class: e.config.classNames.embedContainer,
2846
+ "data-poster": e.poster
2847
+ });
2848
+ f.appendChild(p), e.media = ue(f, e.media);
2849
+ }
2850
+ i.customControls || ne(Ae(e.config.urls.vimeo.api, b)).then((f) => {
2851
+ a.empty(f) || !f.thumbnail_url || S.setPoster.call(e, f.thumbnail_url).catch(() => {
2852
+ });
2853
+ }), e.embed = new window.Vimeo.Player(p, {
2854
+ autopause: e.config.autopause,
2855
+ muted: e.muted
2856
+ }), e.media.paused = !0, e.media.currentTime = 0, e.supported.ui && e.embed.disableTextTrack(), e.media.play = () => (Q.call(e, !0), e.embed.play()), e.media.pause = () => (Q.call(e, !1), e.embed.pause()), e.media.stop = () => {
2857
+ e.pause(), e.currentTime = 0;
2858
+ };
2859
+ let {
2860
+ currentTime: h
2861
+ } = e.media;
2862
+ Object.defineProperty(e.media, "currentTime", {
2863
+ get() {
2864
+ return h;
2865
+ },
2866
+ set(f) {
2867
+ const {
2868
+ embed: k,
2869
+ media: M,
2870
+ paused: j,
2871
+ volume: R
2872
+ } = e, H = j && !k.hasPlayed;
2873
+ M.seeking = !0, v.call(e, M, "seeking"), Promise.resolve(H && k.setVolume(0)).then(() => k.setCurrentTime(f)).then(() => H && k.pause()).then(() => H && k.setVolume(R)).catch(() => {
2874
+ });
2875
+ }
2876
+ });
2877
+ let g = e.config.speed.selected;
2878
+ Object.defineProperty(e.media, "playbackRate", {
2879
+ get() {
2880
+ return g;
2881
+ },
2882
+ set(f) {
2883
+ e.embed.setPlaybackRate(f).then(() => {
2884
+ g = f, v.call(e, e.media, "ratechange");
2885
+ }).catch(() => {
2886
+ e.options.speed = [1];
2887
+ });
2888
+ }
2889
+ });
2890
+ let {
2891
+ volume: C
2892
+ } = e.config;
2893
+ Object.defineProperty(e.media, "volume", {
2894
+ get() {
2895
+ return C;
2896
+ },
2897
+ set(f) {
2898
+ e.embed.setVolume(f).then(() => {
2899
+ C = f, v.call(e, e.media, "volumechange");
2900
+ });
2901
+ }
2902
+ });
2903
+ let {
2904
+ muted: w
2905
+ } = e.config;
2906
+ Object.defineProperty(e.media, "muted", {
2907
+ get() {
2908
+ return w;
2909
+ },
2910
+ set(f) {
2911
+ const k = a.boolean(f) ? f : !1;
2912
+ e.embed.setMuted(k ? !0 : e.config.muted).then(() => {
2913
+ w = k, v.call(e, e.media, "volumechange");
2914
+ });
2915
+ }
2916
+ });
2917
+ let {
2918
+ loop: x
2919
+ } = e.config;
2920
+ Object.defineProperty(e.media, "loop", {
2921
+ get() {
2922
+ return x;
2923
+ },
2924
+ set(f) {
2925
+ const k = a.boolean(f) ? f : e.config.loop.active;
2926
+ e.embed.setLoop(k).then(() => {
2927
+ x = k;
2928
+ });
2929
+ }
2930
+ });
2931
+ let P;
2932
+ e.embed.getVideoUrl().then((f) => {
2933
+ P = f, d.setDownloadUrl.call(e);
2934
+ }).catch((f) => {
2935
+ this.debug.warn(f);
2936
+ }), Object.defineProperty(e.media, "currentSrc", {
2937
+ get() {
2938
+ return P;
2939
+ }
2940
+ }), Object.defineProperty(e.media, "ended", {
2941
+ get() {
2942
+ return e.currentTime === e.duration;
2943
+ }
2944
+ }), Promise.all([e.embed.getVideoWidth(), e.embed.getVideoHeight()]).then((f) => {
2945
+ const [k, M] = f;
2946
+ e.embed.ratio = at(k, M), X.call(this);
2947
+ }), e.embed.setAutopause(e.config.autopause).then((f) => {
2948
+ e.config.autopause = f;
2949
+ }), e.embed.getVideoTitle().then((f) => {
2950
+ e.config.title = f, S.setTitle.call(this);
2951
+ }), e.embed.getCurrentTime().then((f) => {
2952
+ h = f, v.call(e, e.media, "timeupdate");
2953
+ }), e.embed.getDuration().then((f) => {
2954
+ e.media.duration = f, v.call(e, e.media, "durationchange");
2955
+ }), e.embed.getTextTracks().then((f) => {
2956
+ e.media.textTracks = f, A.setup.call(e);
2957
+ }), e.embed.on("cuechange", ({
2958
+ cues: f = []
2959
+ }) => {
2960
+ const k = f.map((M) => ri(M.text));
2961
+ A.updateCues.call(e, k);
2962
+ }), e.embed.on("loaded", () => {
2963
+ e.embed.getPaused().then((f) => {
2964
+ Q.call(e, !f), f || v.call(e, e.media, "playing");
2965
+ }), a.element(e.embed.element) && e.supported.ui && e.embed.element.setAttribute("tabindex", -1);
2966
+ }), e.embed.on("bufferstart", () => {
2967
+ v.call(e, e.media, "waiting");
2968
+ }), e.embed.on("bufferend", () => {
2969
+ v.call(e, e.media, "playing");
2970
+ }), e.embed.on("play", () => {
2971
+ Q.call(e, !0), v.call(e, e.media, "playing");
2972
+ }), e.embed.on("pause", () => {
2973
+ Q.call(e, !1);
2974
+ }), e.embed.on("timeupdate", (f) => {
2975
+ e.media.seeking = !1, h = f.seconds, v.call(e, e.media, "timeupdate");
2976
+ }), e.embed.on("progress", (f) => {
2977
+ e.media.buffered = f.percent, v.call(e, e.media, "progress"), Number.parseInt(f.percent, 10) === 1 && v.call(e, e.media, "canplaythrough"), e.embed.getDuration().then((k) => {
2978
+ k !== e.media.duration && (e.media.duration = k, v.call(e, e.media, "durationchange"));
2979
+ });
2980
+ }), e.embed.on("seeked", () => {
2981
+ e.media.seeking = !1, v.call(e, e.media, "seeked");
2982
+ }), e.embed.on("ended", () => {
2983
+ e.media.paused = !0, v.call(e, e.media, "ended");
2984
+ }), e.embed.on("error", (f) => {
2985
+ e.media.error = f, v.call(e, e.media, "error");
2986
+ }), i.customControls && setTimeout(() => S.build.call(e), 0);
2987
+ }
2988
+ };
2989
+ function vi(e) {
2990
+ if (a.empty(e))
2991
+ return null;
2992
+ const i = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/, t = e.match(i);
2993
+ return t && t[2] ? t[2] : e;
2994
+ }
2995
+ function J(e) {
2996
+ e && !this.embed.hasPlayed && (this.embed.hasPlayed = !0), this.media.paused === e && (this.media.paused = !e, v.call(this, this.media, e ? "play" : "pause"));
2997
+ }
2998
+ function wi(e) {
2999
+ if (e.noCookie)
3000
+ return "https://www.youtube-nocookie.com";
3001
+ if (window.location.protocol === "http:")
3002
+ return "http://www.youtube.com";
3003
+ }
3004
+ const ce = {
3005
+ setup() {
3006
+ if (E(this.elements.wrapper, this.config.classNames.embed, !0), a.object(window.YT) && a.function(window.YT.Player))
3007
+ ce.ready.call(this);
3008
+ else {
3009
+ const e = window.onYouTubeIframeAPIReady;
3010
+ window.onYouTubeIframeAPIReady = () => {
3011
+ a.function(e) && e(), ce.ready.call(this);
3012
+ }, $e(this.config.urls.youtube.sdk).catch((i) => {
3013
+ this.debug.warn("YouTube API failed to load", i);
3014
+ });
3015
+ }
3016
+ },
3017
+ // Get the media title
3018
+ getTitle(e) {
3019
+ const i = Ae(this.config.urls.youtube.api, e);
3020
+ ne(i).then((t) => {
3021
+ if (a.object(t)) {
3022
+ const {
3023
+ title: s,
3024
+ height: n,
3025
+ width: r
3026
+ } = t;
3027
+ this.config.title = s, S.setTitle.call(this), this.embed.ratio = at(r, n);
3028
+ }
3029
+ X.call(this);
3030
+ }).catch(() => {
3031
+ X.call(this);
3032
+ });
3033
+ },
3034
+ // API ready
3035
+ ready() {
3036
+ const e = this, i = e.config.youtube, t = e.media && e.media.getAttribute("id");
3037
+ if (!a.empty(t) && t.startsWith("youtube-"))
3038
+ return;
3039
+ let s = e.media.getAttribute("src");
3040
+ a.empty(s) && (s = e.media.getAttribute(this.config.attributes.embed.id));
3041
+ const n = vi(s), r = ti(e.provider), l = y("div", {
3042
+ id: r,
3043
+ "data-poster": i.customControls ? e.poster : void 0
3044
+ });
3045
+ if (e.media = ue(l, e.media), i.customControls) {
3046
+ const o = (c) => `https://i.ytimg.com/vi/${n}/${c}default.jpg`;
3047
+ le(o("maxres"), 121).catch(() => le(o("sd"), 121)).catch(() => le(o("hq"))).then((c) => S.setPoster.call(e, c.src)).then((c) => {
3048
+ c.includes("maxres") || (e.elements.poster.style.backgroundSize = "cover");
3049
+ }).catch(() => {
3050
+ });
3051
+ }
3052
+ e.embed = new window.YT.Player(e.media, {
3053
+ videoId: n,
3054
+ host: wi(i),
3055
+ playerVars: L({}, {
3056
+ // Autoplay
3057
+ autoplay: e.config.autoplay ? 1 : 0,
3058
+ // iframe interface language
3059
+ hl: e.config.hl,
3060
+ // Only show controls if not fully supported or opted out
3061
+ controls: e.supported.ui && i.customControls ? 0 : 1,
3062
+ // Disable keyboard as we handle it
3063
+ disablekb: 1,
3064
+ // Allow iOS inline playback
3065
+ playsinline: e.config.playsinline && !e.config.fullscreen.iosNative ? 1 : 0,
3066
+ // Captions are flaky on YouTube
3067
+ cc_load_policy: e.captions.active ? 1 : 0,
3068
+ cc_lang_pref: e.config.captions.language,
3069
+ // Tracking for stats
3070
+ widget_referrer: window ? window.location.href : null
3071
+ }, i),
3072
+ events: {
3073
+ onError(o) {
3074
+ if (!e.media.error) {
3075
+ const c = o.data, u = {
3076
+ 2: "The request contains an invalid parameter value. For example, this error occurs if you specify a video ID that does not have 11 characters, or if the video ID contains invalid characters, such as exclamation points or asterisks.",
3077
+ 5: "The requested content cannot be played in an HTML5 player or another error related to the HTML5 player has occurred.",
3078
+ 100: "The video requested was not found. This error occurs when a video has been removed (for any reason) or has been marked as private.",
3079
+ 101: "The owner of the requested video does not allow it to be played in embedded players.",
3080
+ 150: "The owner of the requested video does not allow it to be played in embedded players."
3081
+ }[c] || "An unknown error occurred";
3082
+ e.media.error = {
3083
+ code: c,
3084
+ message: u
3085
+ }, v.call(e, e.media, "error");
3086
+ }
3087
+ },
3088
+ onPlaybackRateChange(o) {
3089
+ const c = o.target;
3090
+ e.media.playbackRate = c.getPlaybackRate(), v.call(e, e.media, "ratechange");
3091
+ },
3092
+ onReady(o) {
3093
+ if (a.function(e.media.play))
3094
+ return;
3095
+ const c = o.target;
3096
+ ce.getTitle.call(e, n), e.media.play = () => {
3097
+ J.call(e, !0), c.playVideo();
3098
+ }, e.media.pause = () => {
3099
+ J.call(e, !1), c.pauseVideo();
3100
+ }, e.media.stop = () => {
3101
+ c.stopVideo();
3102
+ }, e.media.duration = c.getDuration(), e.media.paused = !0, e.media.currentTime = 0, Object.defineProperty(e.media, "currentTime", {
3103
+ get() {
3104
+ return Number(c.getCurrentTime());
3105
+ },
3106
+ set(h) {
3107
+ e.paused && !e.embed.hasPlayed && e.embed.mute(), e.media.seeking = !0, v.call(e, e.media, "seeking"), c.seekTo(h);
3108
+ }
3109
+ }), Object.defineProperty(e.media, "playbackRate", {
3110
+ get() {
3111
+ return c.getPlaybackRate();
3112
+ },
3113
+ set(h) {
3114
+ c.setPlaybackRate(h);
3115
+ }
3116
+ });
3117
+ let {
3118
+ volume: u
3119
+ } = e.config;
3120
+ Object.defineProperty(e.media, "volume", {
3121
+ get() {
3122
+ return u;
3123
+ },
3124
+ set(h) {
3125
+ u = h, c.setVolume(u * 100), v.call(e, e.media, "volumechange");
3126
+ }
3127
+ });
3128
+ let {
3129
+ muted: p
3130
+ } = e.config;
3131
+ Object.defineProperty(e.media, "muted", {
3132
+ get() {
3133
+ return p;
3134
+ },
3135
+ set(h) {
3136
+ const g = a.boolean(h) ? h : p;
3137
+ p = g, c[g ? "mute" : "unMute"](), c.setVolume(u * 100), v.call(e, e.media, "volumechange");
3138
+ }
3139
+ }), Object.defineProperty(e.media, "currentSrc", {
3140
+ get() {
3141
+ return c.getVideoUrl();
3142
+ }
3143
+ }), Object.defineProperty(e.media, "ended", {
3144
+ get() {
3145
+ return e.currentTime === e.duration;
3146
+ }
3147
+ });
3148
+ const b = c.getAvailablePlaybackRates();
3149
+ e.options.speed = b.filter((h) => e.config.speed.options.includes(h)), e.supported.ui && i.customControls && e.media.setAttribute("tabindex", -1), v.call(e, e.media, "timeupdate"), v.call(e, e.media, "durationchange"), clearInterval(e.timers.buffering), e.timers.buffering = setInterval(() => {
3150
+ e.media.buffered = c.getVideoLoadedFraction(), (e.media.lastBuffered === null || e.media.lastBuffered < e.media.buffered) && v.call(e, e.media, "progress"), e.media.lastBuffered = e.media.buffered, e.media.buffered === 1 && (clearInterval(e.timers.buffering), v.call(e, e.media, "canplaythrough"));
3151
+ }, 200), i.customControls && setTimeout(() => S.build.call(e), 50);
3152
+ },
3153
+ onStateChange(o) {
3154
+ const c = o.target;
3155
+ switch (clearInterval(e.timers.playing), e.media.seeking && [1, 2].includes(o.data) && (e.media.seeking = !1, v.call(e, e.media, "seeked")), o.data) {
3156
+ case -1:
3157
+ v.call(e, e.media, "timeupdate"), e.media.buffered = c.getVideoLoadedFraction(), v.call(e, e.media, "progress");
3158
+ break;
3159
+ case 0:
3160
+ J.call(e, !1), e.media.loop ? (c.stopVideo(), c.playVideo()) : v.call(e, e.media, "ended");
3161
+ break;
3162
+ case 1:
3163
+ i.customControls && !e.config.autoplay && e.media.paused && !e.embed.hasPlayed ? e.media.pause() : (J.call(e, !0), v.call(e, e.media, "playing"), e.timers.playing = setInterval(() => {
3164
+ v.call(e, e.media, "timeupdate");
3165
+ }, 50), e.media.duration !== c.getDuration() && (e.media.duration = c.getDuration(), v.call(e, e.media, "durationchange")));
3166
+ break;
3167
+ case 2:
3168
+ e.muted || e.embed.unMute(), J.call(e, !1);
3169
+ break;
3170
+ case 3:
3171
+ v.call(e, e.media, "waiting");
3172
+ break;
3173
+ }
3174
+ v.call(e, e.elements.container, "statechange", !1, {
3175
+ code: o.data
3176
+ });
3177
+ }
3178
+ }
3179
+ });
3180
+ }
3181
+ }, mt = {
3182
+ // Setup media
3183
+ setup() {
3184
+ if (!this.media) {
3185
+ this.debug.warn("No media element found!");
3186
+ return;
3187
+ }
3188
+ E(this.elements.container, this.config.classNames.type.replace("{0}", this.type), !0), E(this.elements.container, this.config.classNames.provider.replace("{0}", this.provider), !0), this.isEmbed && E(this.elements.container, this.config.classNames.type.replace("{0}", "video"), !0), this.isVideo && (this.elements.wrapper = y("div", {
3189
+ class: this.config.classNames.video
3190
+ }), it(this.media, this.elements.wrapper), this.elements.poster = y("div", {
3191
+ class: this.config.classNames.poster
3192
+ }), this.elements.wrapper.appendChild(this.elements.poster)), this.isHTML5 ? z.setup.call(this) : this.isYouTube ? ce.setup.call(this) : this.isVimeo && Ee.setup.call(this);
3193
+ }
3194
+ };
3195
+ function ki(e) {
3196
+ e.manager && e.manager.destroy(), e.elements.displayContainer && e.elements.displayContainer.destroy(), e.elements.container.remove();
3197
+ }
3198
+ class Ti {
3199
+ /**
3200
+ * Ads constructor.
3201
+ * @param {object} player
3202
+ * @return {Ads}
3203
+ */
3204
+ constructor(i) {
3205
+ m(this, "load", () => {
3206
+ this.enabled && (!a.object(window.google) || !a.object(window.google.ima) ? $e(this.player.config.urls.googleIMA.sdk).then(() => {
3207
+ this.ready();
3208
+ }).catch(() => {
3209
+ this.trigger("error", new Error("Google IMA SDK failed to load"));
3210
+ }) : this.ready());
3211
+ }), m(this, "ready", () => {
3212
+ this.enabled || ki(this), this.startSafetyTimer(12e3, "ready()"), this.managerPromise.then(() => {
3213
+ this.clearSafetyTimer("onAdsManagerLoaded()");
3214
+ }), this.listeners(), this.setupIMA();
3215
+ }), m(this, "setupIMA", () => {
3216
+ this.elements.container = y("div", {
3217
+ class: this.player.config.classNames.ads
3218
+ }), this.player.elements.container.appendChild(this.elements.container), google.ima.settings.setVpaidMode(google.ima.ImaSdkSettings.VpaidMode.ENABLED), google.ima.settings.setLocale(this.player.config.ads.language), google.ima.settings.setDisableCustomPlaybackForIOS10Plus(this.player.config.playsinline), this.elements.displayContainer = new google.ima.AdDisplayContainer(this.elements.container, this.player.media), this.loader = new google.ima.AdsLoader(this.elements.displayContainer), this.loader.addEventListener(google.ima.AdsManagerLoadedEvent.Type.ADS_MANAGER_LOADED, (t) => this.onAdsManagerLoaded(t), !1), this.loader.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, (t) => this.onAdError(t), !1), this.requestAds();
3219
+ }), m(this, "requestAds", () => {
3220
+ const {
3221
+ container: t
3222
+ } = this.player.elements;
3223
+ try {
3224
+ const s = new google.ima.AdsRequest();
3225
+ s.adTagUrl = this.tagUrl, s.linearAdSlotWidth = t.offsetWidth, s.linearAdSlotHeight = t.offsetHeight, s.nonLinearAdSlotWidth = t.offsetWidth, s.nonLinearAdSlotHeight = t.offsetHeight, s.forceNonLinearFullSlot = !1, s.setAdWillPlayMuted(!this.player.muted), this.loader.requestAds(s);
3226
+ } catch (s) {
3227
+ this.onAdError(s);
3228
+ }
3229
+ }), m(this, "pollCountdown", (t = !1) => {
3230
+ if (!t) {
3231
+ clearInterval(this.countdownTimer), this.elements.container.removeAttribute("data-badge-text");
3232
+ return;
3233
+ }
3234
+ const s = () => {
3235
+ const n = ge(Math.max(this.manager.getRemainingTime(), 0)), r = `${O.get("advertisement", this.player.config)} - ${n}`;
3236
+ this.elements.container.setAttribute("data-badge-text", r);
3237
+ };
3238
+ this.countdownTimer = setInterval(s, 100);
3239
+ }), m(this, "onAdsManagerLoaded", (t) => {
3240
+ if (!this.enabled)
3241
+ return;
3242
+ const s = new google.ima.AdsRenderingSettings();
3243
+ s.restoreCustomPlaybackStateOnAdBreakComplete = !0, s.enablePreloading = !0, this.manager = t.getAdsManager(this.player, s), this.cuePoints = this.manager.getCuePoints(), this.manager.addEventListener(google.ima.AdErrorEvent.Type.AD_ERROR, (n) => this.onAdError(n)), Object.keys(google.ima.AdEvent.Type).forEach((n) => {
3244
+ this.manager.addEventListener(google.ima.AdEvent.Type[n], (r) => this.onAdEvent(r));
3245
+ }), this.trigger("loaded");
3246
+ }), m(this, "addCuePoints", () => {
3247
+ a.empty(this.cuePoints) || this.cuePoints.forEach((t) => {
3248
+ if (t !== 0 && t !== -1 && t < this.player.duration) {
3249
+ const s = this.player.elements.progress;
3250
+ if (a.element(s)) {
3251
+ const n = 100 / this.player.duration * t, r = y("span", {
3252
+ class: this.player.config.classNames.cues
3253
+ });
3254
+ r.style.left = `${n.toString()}%`, s.appendChild(r);
3255
+ }
3256
+ }
3257
+ });
3258
+ }), m(this, "onAdEvent", (t) => {
3259
+ const {
3260
+ container: s
3261
+ } = this.player.elements, n = t.getAd(), r = t.getAdData();
3262
+ switch (((o) => {
3263
+ v.call(this.player, this.player.media, `ads${o.replace(/_/g, "").toLowerCase()}`);
3264
+ })(t.type), t.type) {
3265
+ case google.ima.AdEvent.Type.LOADED:
3266
+ this.trigger("loaded"), this.pollCountdown(!0), n.isLinear() || (n.width = s.offsetWidth, n.height = s.offsetHeight);
3267
+ break;
3268
+ case google.ima.AdEvent.Type.STARTED:
3269
+ this.manager.setVolume(this.player.volume);
3270
+ break;
3271
+ case google.ima.AdEvent.Type.ALL_ADS_COMPLETED:
3272
+ this.player.ended ? this.loadAds() : this.loader.contentComplete();
3273
+ break;
3274
+ case google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED:
3275
+ this.pauseContent();
3276
+ break;
3277
+ case google.ima.AdEvent.Type.CONTENT_RESUME_REQUESTED:
3278
+ this.pollCountdown(), this.resumeContent();
3279
+ break;
3280
+ case google.ima.AdEvent.Type.LOG:
3281
+ r.adError && this.player.debug.warn(`Non-fatal ad error: ${r.adError.getMessage()}`);
3282
+ break;
3283
+ }
3284
+ }), m(this, "onAdError", (t) => {
3285
+ this.cancel(), this.player.debug.warn("Ads error", t);
3286
+ }), m(this, "listeners", () => {
3287
+ const {
3288
+ container: t
3289
+ } = this.player.elements;
3290
+ let s;
3291
+ this.player.on("canplay", () => {
3292
+ this.addCuePoints();
3293
+ }), this.player.on("ended", () => {
3294
+ this.loader.contentComplete();
3295
+ }), this.player.on("timeupdate", () => {
3296
+ s = this.player.currentTime;
3297
+ }), this.player.on("seeked", () => {
3298
+ const n = this.player.currentTime;
3299
+ a.empty(this.cuePoints) || this.cuePoints.forEach((r, l) => {
3300
+ s < r && r < n && (this.manager.discardAdBreak(), this.cuePoints.splice(l, 1));
3301
+ });
3302
+ }), window.addEventListener("resize", () => {
3303
+ this.manager && this.manager.resize(t.offsetWidth, t.offsetHeight, google.ima.ViewMode.NORMAL);
3304
+ });
3305
+ }), m(this, "play", () => {
3306
+ const {
3307
+ container: t
3308
+ } = this.player.elements;
3309
+ this.managerPromise || this.resumeContent(), this.managerPromise.then(() => {
3310
+ this.manager.setVolume(this.player.volume), this.elements.displayContainer.initialize();
3311
+ try {
3312
+ this.initialized || (this.manager.init(t.offsetWidth, t.offsetHeight, google.ima.ViewMode.NORMAL), this.manager.start()), this.initialized = !0;
3313
+ } catch (s) {
3314
+ this.onAdError(s);
3315
+ }
3316
+ }).catch(() => {
3317
+ });
3318
+ }), m(this, "resumeContent", () => {
3319
+ this.elements.container.style.zIndex = "", this.playing = !1, F(this.player.media.play());
3320
+ }), m(this, "pauseContent", () => {
3321
+ this.elements.container.style.zIndex = 3, this.playing = !0, this.player.media.pause();
3322
+ }), m(this, "cancel", () => {
3323
+ this.initialized && this.resumeContent(), this.trigger("error"), this.loadAds();
3324
+ }), m(this, "loadAds", () => {
3325
+ this.managerPromise.then(() => {
3326
+ this.manager && this.manager.destroy(), this.managerPromise = new Promise((t) => {
3327
+ this.on("loaded", t), this.player.debug.log(this.manager);
3328
+ }), this.initialized = !1, this.requestAds();
3329
+ }).catch(() => {
3330
+ });
3331
+ }), m(this, "trigger", (t, ...s) => {
3332
+ const n = this.events[t];
3333
+ a.array(n) && n.forEach((r) => {
3334
+ a.function(r) && r.apply(this, s);
3335
+ });
3336
+ }), m(this, "on", (t, s) => (a.array(this.events[t]) || (this.events[t] = []), this.events[t].push(s), this)), m(this, "startSafetyTimer", (t, s) => {
3337
+ this.player.debug.log(`Safety timer invoked from: ${s}`), this.safetyTimer = setTimeout(() => {
3338
+ this.cancel(), this.clearSafetyTimer("startSafetyTimer()");
3339
+ }, t);
3340
+ }), m(this, "clearSafetyTimer", (t) => {
3341
+ a.nullOrUndefined(this.safetyTimer) || (this.player.debug.log(`Safety timer cleared from: ${t}`), clearTimeout(this.safetyTimer), this.safetyTimer = null);
3342
+ }), this.player = i, this.config = i.config.ads, this.playing = !1, this.initialized = !1, this.elements = {
3343
+ container: null,
3344
+ displayContainer: null
3345
+ }, this.manager = null, this.loader = null, this.cuePoints = null, this.events = {}, this.safetyTimer = null, this.countdownTimer = null, this.managerPromise = new Promise((t, s) => {
3346
+ this.on("loaded", t), this.on("error", s);
3347
+ }), this.load();
3348
+ }
3349
+ get enabled() {
3350
+ const {
3351
+ config: i
3352
+ } = this;
3353
+ return this.player.isHTML5 && this.player.isVideo && i.enabled && (!a.empty(i.publisherId) || a.url(i.tagUrl));
3354
+ }
3355
+ // Build the tag URL
3356
+ get tagUrl() {
3357
+ const {
3358
+ config: i
3359
+ } = this;
3360
+ if (a.url(i.tagUrl))
3361
+ return i.tagUrl;
3362
+ const t = {
3363
+ AV_PUBLISHERID: "58c25bb0073ef448b1087ad6",
3364
+ AV_CHANNELID: "5a0458dc28a06145e4519d21",
3365
+ AV_URL: window.location.hostname,
3366
+ cb: Date.now(),
3367
+ AV_WIDTH: 640,
3368
+ AV_HEIGHT: 480,
3369
+ AV_CDIM2: i.publisherId
3370
+ };
3371
+ return `https://go.aniview.com/api/adserver6/vast/?${ht(t)}`;
3372
+ }
3373
+ }
3374
+ function pt(e = 0, i = 0, t = 255) {
3375
+ return Math.min(Math.max(e, i), t);
3376
+ }
3377
+ function Ci(e) {
3378
+ const i = [];
3379
+ return e.split(/\r\n\r\n|\n\n|\r\r/).forEach((s) => {
3380
+ const n = {};
3381
+ s.split(/\r\n|\n|\r/).forEach((l) => {
3382
+ if (a.number(n.startTime)) {
3383
+ if (!a.empty(l.trim()) && a.empty(n.text)) {
3384
+ const o = l.trim().split("#xywh=");
3385
+ [n.text] = o, o[1] && ([n.x, n.y, n.w, n.h] = o[1].split(","));
3386
+ }
3387
+ } else {
3388
+ const o = l.match(/(\d{2})?:?(\d{2}):(\d{2}).(\d{2,3})( ?--> ?)(\d{2})?:?(\d{2}):(\d{2}).(\d{2,3})/);
3389
+ o && (n.startTime = Number(o[1] || 0) * 60 * 60 + Number(o[2]) * 60 + Number(o[3]) + +`0.${o[4]}`, n.endTime = Number(o[6] || 0) * 60 * 60 + Number(o[7]) * 60 + Number(o[8]) + +`0.${o[9]}`);
3390
+ }
3391
+ }), n.text && i.push(n);
3392
+ }), i;
3393
+ }
3394
+ function Ue(e, i) {
3395
+ const t = i.width / i.height, s = {};
3396
+ return e > t ? (s.width = i.width, s.height = 1 / e * i.width) : (s.height = i.height, s.width = e * i.height), s;
3397
+ }
3398
+ class Se {
3399
+ /**
3400
+ * PreviewThumbnails constructor.
3401
+ * @param {Plyr} player
3402
+ * @return {PreviewThumbnails}
3403
+ */
3404
+ constructor(i) {
3405
+ m(this, "load", () => {
3406
+ this.player.elements.display.seekTooltip && (this.player.elements.display.seekTooltip.hidden = this.enabled), this.enabled && this.getThumbnails().then(() => {
3407
+ this.enabled && (this.render(), this.determineContainerAutoSizing(), this.listeners(), this.loaded = !0);
3408
+ });
3409
+ }), m(this, "getThumbnails", () => new Promise((t) => {
3410
+ const {
3411
+ src: s
3412
+ } = this.player.config.previewThumbnails;
3413
+ if (a.empty(s))
3414
+ throw new Error("Missing previewThumbnails.src config attribute");
3415
+ const n = () => {
3416
+ this.thumbnails.sort((r, l) => r.height - l.height), this.player.debug.log("Preview thumbnails", this.thumbnails), t();
3417
+ };
3418
+ if (a.function(s))
3419
+ s((r) => {
3420
+ this.thumbnails = r, n();
3421
+ });
3422
+ else {
3423
+ const l = (a.string(s) ? [s] : s).map((o) => this.getThumbnail(o));
3424
+ Promise.all(l).then(n);
3425
+ }
3426
+ })), m(this, "getThumbnail", (t) => new Promise((s) => {
3427
+ ne(t, void 0, this.player.config.previewThumbnails.withCredentials).then((n) => {
3428
+ const r = {
3429
+ frames: Ci(n),
3430
+ height: null,
3431
+ urlPrefix: ""
3432
+ };
3433
+ !r.frames[0].text.startsWith("/") && !r.frames[0].text.startsWith("http://") && !r.frames[0].text.startsWith("https://") && (r.urlPrefix = t.substring(0, t.lastIndexOf("/") + 1));
3434
+ const l = new Image();
3435
+ l.onload = () => {
3436
+ r.height = l.naturalHeight, r.width = l.naturalWidth, this.thumbnails.push(r), s();
3437
+ }, l.src = r.urlPrefix + r.frames[0].text;
3438
+ });
3439
+ })), m(this, "startMove", (t) => {
3440
+ if (this.loaded && !(!a.event(t) || !["touchmove", "mousemove"].includes(t.type)) && this.player.media.duration) {
3441
+ if (t.type === "touchmove")
3442
+ this.seekTime = this.player.media.duration * (this.player.elements.inputs.seek.value / 100);
3443
+ else {
3444
+ var s, n;
3445
+ const r = this.player.elements.progress.getBoundingClientRect(), l = 100 / r.width * (t.pageX - r.left);
3446
+ this.seekTime = this.player.media.duration * (l / 100), this.seekTime < 0 && (this.seekTime = 0), this.seekTime > this.player.media.duration - 1 && (this.seekTime = this.player.media.duration - 1), this.mousePosX = t.pageX, this.elements.thumb.time.textContent = ge(this.seekTime);
3447
+ const o = (s = this.player.config.markers) === null || s === void 0 || (n = s.points) === null || n === void 0 ? void 0 : n.find(({
3448
+ time: c
3449
+ }) => c === Math.round(this.seekTime));
3450
+ o && this.elements.thumb.time.insertAdjacentHTML("afterbegin", `${o.label}<br>`);
3451
+ }
3452
+ this.showImageAtCurrentTime();
3453
+ }
3454
+ }), m(this, "endMove", () => {
3455
+ this.toggleThumbContainer(!1, !0);
3456
+ }), m(this, "startScrubbing", (t) => {
3457
+ (a.nullOrUndefined(t.button) || t.button === !1 || t.button === 0) && (this.mouseDown = !0, this.player.media.duration && (this.toggleScrubbingContainer(!0), this.toggleThumbContainer(!1, !0), this.showImageAtCurrentTime()));
3458
+ }), m(this, "endScrubbing", () => {
3459
+ this.mouseDown = !1, Math.ceil(this.lastTime) === Math.ceil(this.player.media.currentTime) ? this.toggleScrubbingContainer(!1) : xe.call(this.player, this.player.media, "timeupdate", () => {
3460
+ this.mouseDown || this.toggleScrubbingContainer(!1);
3461
+ });
3462
+ }), m(this, "listeners", () => {
3463
+ this.player.on("play", () => {
3464
+ this.toggleThumbContainer(!1, !0);
3465
+ }), this.player.on("seeked", () => {
3466
+ this.toggleThumbContainer(!1);
3467
+ }), this.player.on("timeupdate", () => {
3468
+ this.lastTime = this.player.media.currentTime;
3469
+ });
3470
+ }), m(this, "render", () => {
3471
+ this.elements.thumb.container = y("div", {
3472
+ class: this.player.config.classNames.previewThumbnails.thumbContainer
3473
+ }), this.elements.thumb.imageContainer = y("div", {
3474
+ class: this.player.config.classNames.previewThumbnails.imageContainer
3475
+ }), this.elements.thumb.container.appendChild(this.elements.thumb.imageContainer);
3476
+ const t = y("div", {
3477
+ class: this.player.config.classNames.previewThumbnails.timeContainer
3478
+ });
3479
+ this.elements.thumb.time = y("span", {}, "00:00"), t.appendChild(this.elements.thumb.time), this.elements.thumb.imageContainer.appendChild(t), a.element(this.player.elements.progress) && this.player.elements.progress.appendChild(this.elements.thumb.container), this.elements.scrubbing.container = y("div", {
3480
+ class: this.player.config.classNames.previewThumbnails.scrubbingContainer
3481
+ }), this.player.elements.wrapper.appendChild(this.elements.scrubbing.container);
3482
+ }), m(this, "destroy", () => {
3483
+ this.elements.thumb.container && this.elements.thumb.container.remove(), this.elements.scrubbing.container && this.elements.scrubbing.container.remove();
3484
+ }), m(this, "showImageAtCurrentTime", () => {
3485
+ this.mouseDown ? this.setScrubbingContainerSize() : this.setThumbContainerSizeAndPos();
3486
+ const t = this.thumbnails[0].frames.findIndex((r) => this.seekTime >= r.startTime && this.seekTime <= r.endTime), s = t >= 0;
3487
+ let n = 0;
3488
+ this.mouseDown || this.toggleThumbContainer(s), s && (this.thumbnails.forEach((r, l) => {
3489
+ this.loadedImages.includes(r.frames[t].text) && (n = l);
3490
+ }), t !== this.showingThumb && (this.showingThumb = t, this.loadImage(n)));
3491
+ }), m(this, "loadImage", (t = 0) => {
3492
+ const s = this.showingThumb, n = this.thumbnails[t], {
3493
+ urlPrefix: r
3494
+ } = n, l = n.frames[s], o = n.frames[s].text, c = r + o;
3495
+ if (!this.currentImageElement || this.currentImageElement.dataset.filename !== o) {
3496
+ this.loadingImage && this.usingSprites && (this.loadingImage.onload = null);
3497
+ const u = new Image();
3498
+ u.src = c, u.dataset.index = s, u.dataset.filename = o, this.showingThumbFilename = o, this.player.debug.log(`Loading image: ${c}`), u.onload = () => this.showImage(u, l, t, s, o, !0), this.loadingImage = u, this.removeOldImages(u);
3499
+ } else
3500
+ this.showImage(this.currentImageElement, l, t, s, o, !1), this.currentImageElement.dataset.index = s, this.removeOldImages(this.currentImageElement);
3501
+ }), m(this, "showImage", (t, s, n, r, l, o = !0) => {
3502
+ this.player.debug.log(`Showing thumb: ${l}. num: ${r}. qual: ${n}. newimg: ${o}`), this.setImageSizeAndOffset(t, s), o && (this.currentImageContainer.appendChild(t), this.currentImageElement = t, this.loadedImages.includes(l) || this.loadedImages.push(l)), this.preloadNearby(r, !0).then(this.preloadNearby(r, !1)).then(this.getHigherQuality(n, t, s, l));
3503
+ }), m(this, "removeOldImages", (t) => {
3504
+ Array.from(this.currentImageContainer.children).forEach((s) => {
3505
+ if (s.tagName.toLowerCase() !== "img")
3506
+ return;
3507
+ const n = this.usingSprites ? 500 : 1e3;
3508
+ if (s.dataset.index !== t.dataset.index && !s.dataset.deleting) {
3509
+ s.dataset.deleting = !0;
3510
+ const {
3511
+ currentImageContainer: r
3512
+ } = this;
3513
+ setTimeout(() => {
3514
+ r.removeChild(s), this.player.debug.log(`Removing thumb: ${s.dataset.filename}`);
3515
+ }, n);
3516
+ }
3517
+ });
3518
+ }), m(this, "preloadNearby", (t, s = !0) => new Promise((n) => {
3519
+ setTimeout(() => {
3520
+ const r = this.thumbnails[0].frames[t].text;
3521
+ if (this.showingThumbFilename === r) {
3522
+ let l;
3523
+ s ? l = this.thumbnails[0].frames.slice(t) : l = this.thumbnails[0].frames.slice(0, t).reverse();
3524
+ let o = !1;
3525
+ l.forEach((c) => {
3526
+ const u = c.text;
3527
+ if (u !== r && !this.loadedImages.includes(u)) {
3528
+ o = !0, this.player.debug.log(`Preloading thumb filename: ${u}`);
3529
+ const {
3530
+ urlPrefix: p
3531
+ } = this.thumbnails[0], b = p + u, h = new Image();
3532
+ h.src = b, h.onload = () => {
3533
+ this.player.debug.log(`Preloaded thumb filename: ${u}`), this.loadedImages.includes(u) || this.loadedImages.push(u), n();
3534
+ };
3535
+ }
3536
+ }), o || n();
3537
+ }
3538
+ }, 300);
3539
+ })), m(this, "getHigherQuality", (t, s, n, r) => {
3540
+ if (t < this.thumbnails.length - 1) {
3541
+ let l = s.naturalHeight;
3542
+ this.usingSprites && (l = n.h), l < this.thumbContainerHeight && setTimeout(() => {
3543
+ this.showingThumbFilename === r && (this.player.debug.log(`Showing higher quality thumb for: ${r}`), this.loadImage(t + 1));
3544
+ }, 300);
3545
+ }
3546
+ }), m(this, "toggleThumbContainer", (t = !1, s = !1) => {
3547
+ const n = this.player.config.classNames.previewThumbnails.thumbContainerShown;
3548
+ this.elements.thumb.container.classList.toggle(n, t), !t && s && (this.showingThumb = null, this.showingThumbFilename = null);
3549
+ }), m(this, "toggleScrubbingContainer", (t = !1) => {
3550
+ const s = this.player.config.classNames.previewThumbnails.scrubbingContainerShown;
3551
+ this.elements.scrubbing.container.classList.toggle(s, t), t || (this.showingThumb = null, this.showingThumbFilename = null);
3552
+ }), m(this, "determineContainerAutoSizing", () => {
3553
+ (this.elements.thumb.imageContainer.clientHeight > 20 || this.elements.thumb.imageContainer.clientWidth > 20) && (this.sizeSpecifiedInCSS = !0);
3554
+ }), m(this, "setThumbContainerSizeAndPos", () => {
3555
+ const {
3556
+ imageContainer: t
3557
+ } = this.elements.thumb;
3558
+ if (this.sizeSpecifiedInCSS) {
3559
+ if (t.clientHeight > 20 && t.clientWidth < 20) {
3560
+ const s = Math.floor(t.clientHeight * this.thumbAspectRatio);
3561
+ t.style.width = `${s}px`;
3562
+ } else if (t.clientHeight < 20 && t.clientWidth > 20) {
3563
+ const s = Math.floor(t.clientWidth / this.thumbAspectRatio);
3564
+ t.style.height = `${s}px`;
3565
+ }
3566
+ } else {
3567
+ const s = Math.floor(this.thumbContainerHeight * this.thumbAspectRatio);
3568
+ t.style.height = `${this.thumbContainerHeight}px`, t.style.width = `${s}px`;
3569
+ }
3570
+ this.setThumbContainerPos();
3571
+ }), m(this, "setThumbContainerPos", () => {
3572
+ const t = this.player.elements.progress.getBoundingClientRect(), s = this.player.elements.container.getBoundingClientRect(), {
3573
+ container: n
3574
+ } = this.elements.thumb, r = s.left - t.left + 10, l = s.right - t.left - n.clientWidth - 10, o = this.mousePosX - t.left - n.clientWidth / 2, c = pt(o, r, l);
3575
+ n.style.left = `${c}px`, n.style.setProperty("--preview-arrow-offset", `${o - c}px`);
3576
+ }), m(this, "setScrubbingContainerSize", () => {
3577
+ const {
3578
+ width: t,
3579
+ height: s
3580
+ } = Ue(this.thumbAspectRatio, {
3581
+ width: this.player.media.clientWidth,
3582
+ height: this.player.media.clientHeight
3583
+ });
3584
+ this.elements.scrubbing.container.style.width = `${t}px`, this.elements.scrubbing.container.style.height = `${s}px`;
3585
+ }), m(this, "setImageSizeAndOffset", (t, s) => {
3586
+ if (!this.usingSprites) return;
3587
+ const n = this.thumbContainerHeight / s.h;
3588
+ t.style.height = `${t.naturalHeight * n}px`, t.style.width = `${t.naturalWidth * n}px`, t.style.left = `-${s.x * n}px`, t.style.top = `-${s.y * n}px`;
3589
+ }), this.player = i, this.thumbnails = [], this.loaded = !1, this.lastMouseMoveTime = Date.now(), this.mouseDown = !1, this.loadedImages = [], this.elements = {
3590
+ thumb: {},
3591
+ scrubbing: {}
3592
+ }, this.load();
3593
+ }
3594
+ get enabled() {
3595
+ return this.player.isHTML5 && this.player.isVideo && this.player.config.previewThumbnails.enabled;
3596
+ }
3597
+ get currentImageContainer() {
3598
+ return this.mouseDown ? this.elements.scrubbing.container : this.elements.thumb.imageContainer;
3599
+ }
3600
+ get usingSprites() {
3601
+ return Object.keys(this.thumbnails[0].frames[0]).includes("w");
3602
+ }
3603
+ get thumbAspectRatio() {
3604
+ return this.usingSprites ? this.thumbnails[0].frames[0].w / this.thumbnails[0].frames[0].h : this.thumbnails[0].width / this.thumbnails[0].height;
3605
+ }
3606
+ get thumbContainerHeight() {
3607
+ if (this.mouseDown) {
3608
+ const {
3609
+ height: i
3610
+ } = Ue(this.thumbAspectRatio, {
3611
+ width: this.player.media.clientWidth,
3612
+ height: this.player.media.clientHeight
3613
+ });
3614
+ return i;
3615
+ }
3616
+ return this.sizeSpecifiedInCSS ? this.elements.thumb.imageContainer.clientHeight : Math.floor(this.player.media.clientWidth / this.thumbAspectRatio / 4);
3617
+ }
3618
+ get currentImageElement() {
3619
+ return this.mouseDown ? this.currentScrubbingImageElement : this.currentThumbnailImageElement;
3620
+ }
3621
+ set currentImageElement(i) {
3622
+ this.mouseDown ? this.currentScrubbingImageElement = i : this.currentThumbnailImageElement = i;
3623
+ }
3624
+ }
3625
+ const Pe = {
3626
+ // Add elements to HTML5 media (source, tracks, etc)
3627
+ insertElements(e, i) {
3628
+ a.string(i) ? Re(e, this.media, {
3629
+ src: i
3630
+ }) : a.array(i) && i.forEach((t) => {
3631
+ Re(e, this.media, t);
3632
+ });
3633
+ },
3634
+ // Update source
3635
+ // Sources are not checked for support so be careful
3636
+ change(e) {
3637
+ if (!tt(e, "sources.length")) {
3638
+ this.debug.warn("Invalid source format");
3639
+ return;
3640
+ }
3641
+ z.cancelRequests.call(this), this.destroy(() => {
3642
+ this.options.quality = [], U(this.media), this.media = null, a.element(this.elements.container) && this.elements.container.removeAttribute("class");
3643
+ const {
3644
+ sources: i,
3645
+ type: t
3646
+ } = e, [{
3647
+ provider: s = W.html5,
3648
+ src: n
3649
+ }] = i, r = s === "html5" ? t : "div", l = s === "html5" ? {} : {
3650
+ src: n
3651
+ };
3652
+ Object.assign(this, {
3653
+ provider: s,
3654
+ type: t,
3655
+ // Check for support
3656
+ supported: $.check(t, s, this.config.playsinline),
3657
+ // Create new element
3658
+ media: y(r, l)
3659
+ }), this.elements.container.appendChild(this.media), a.boolean(e.autoplay) && (this.config.autoplay = e.autoplay), this.isHTML5 && (this.config.crossorigin && this.media.setAttribute("crossorigin", ""), this.config.autoplay && this.media.setAttribute("autoplay", ""), a.empty(e.poster) || (this.poster = e.poster), this.config.loop.active && this.media.setAttribute("loop", ""), this.config.muted && this.media.setAttribute("muted", ""), this.config.playsinline && this.media.setAttribute("playsinline", "")), S.addStyleHook.call(this), this.isHTML5 && Pe.insertElements.call(this, "source", i), this.config.title = e.title, mt.setup.call(this), this.isHTML5 && Object.keys(e).includes("tracks") && Pe.insertElements.call(this, "track", e.tracks), (this.isHTML5 || this.isEmbed && !this.supported.ui) && S.build.call(this), this.isHTML5 && this.media.load(), a.empty(e.previewThumbnails) || (Object.assign(this.config.previewThumbnails, e.previewThumbnails), this.previewThumbnails && this.previewThumbnails.loaded && (this.previewThumbnails.destroy(), this.previewThumbnails = null), this.config.previewThumbnails.enabled && (this.previewThumbnails = new Se(this))), this.fullscreen.update();
3660
+ }, !0);
3661
+ }
3662
+ };
3663
+ class me {
3664
+ constructor(i, t) {
3665
+ if (m(this, "play", () => a.function(this.media.play) ? (this.ads && this.ads.enabled && this.ads.managerPromise.then(() => this.ads.play()).catch(() => F(this.media.play())), this.media.play()) : null), m(this, "pause", () => !this.playing || !a.function(this.media.pause) ? null : this.media.pause()), m(this, "togglePlay", (o) => (a.boolean(o) ? o : !this.playing) ? this.play() : this.pause()), m(this, "stop", () => {
3666
+ this.isHTML5 ? (this.pause(), this.restart()) : a.function(this.media.stop) && this.media.stop();
3667
+ }), m(this, "restart", () => {
3668
+ this.currentTime = 0;
3669
+ }), m(this, "rewind", (o) => {
3670
+ this.currentTime -= a.number(o) ? o : this.config.seekTime;
3671
+ }), m(this, "forward", (o) => {
3672
+ this.currentTime += a.number(o) ? o : this.config.seekTime;
3673
+ }), m(this, "increaseVolume", (o) => {
3674
+ const c = this.media.muted ? 0 : this.volume;
3675
+ this.volume = c + (a.number(o) ? o : 0);
3676
+ }), m(this, "decreaseVolume", (o) => {
3677
+ this.increaseVolume(-o);
3678
+ }), m(this, "airplay", () => {
3679
+ $.airplay && this.media.webkitShowPlaybackTargetPicker();
3680
+ }), m(this, "toggleControls", (o) => {
3681
+ if (this.supported.ui && !this.isAudio) {
3682
+ const c = he(this.elements.container, this.config.classNames.hideControls), u = typeof o > "u" ? void 0 : !o, p = E(this.elements.container, this.config.classNames.hideControls, u);
3683
+ if (p && a.array(this.config.controls) && this.config.controls.includes("settings") && !a.empty(this.config.settings) && d.toggleMenu.call(this, !1), p !== c) {
3684
+ const b = p ? "controlshidden" : "controlsshown";
3685
+ v.call(this, this.media, b);
3686
+ }
3687
+ return !p;
3688
+ }
3689
+ return !1;
3690
+ }), m(this, "on", (o, c) => {
3691
+ T.call(this, this.elements.container, o, c);
3692
+ }), m(this, "once", (o, c) => {
3693
+ xe.call(this, this.elements.container, o, c);
3694
+ }), m(this, "off", (o, c) => {
3695
+ fe(this.elements.container, o, c);
3696
+ }), m(this, "destroy", (o, c = !1) => {
3697
+ if (!this.ready)
3698
+ return;
3699
+ const u = () => {
3700
+ document.body.style.overflow = "", this.embed = null, c ? (Object.keys(this.elements).length && (U(this.elements.buttons.play), U(this.elements.captions), U(this.elements.controls), U(this.elements.wrapper), this.elements.buttons.play = null, this.elements.captions = null, this.elements.controls = null, this.elements.wrapper = null), a.function(o) && o()) : (Kt.call(this), z.cancelRequests.call(this), ue(this.elements.original, this.elements.container), v.call(this, this.elements.original, "destroyed", !0), a.function(o) && o.call(this.elements.original), this.ready = !1, setTimeout(() => {
3701
+ this.elements = null, this.media = null;
3702
+ }, 200));
3703
+ };
3704
+ this.stop(), clearTimeout(this.timers.loading), clearTimeout(this.timers.controls), clearTimeout(this.timers.resized), this.isHTML5 ? (S.toggleNativeControls.call(this, !0), u()) : this.isYouTube ? (clearInterval(this.timers.buffering), clearInterval(this.timers.playing), this.embed !== null && a.function(this.embed.destroy) && this.embed.destroy(), u()) : this.isVimeo && (this.embed !== null && this.embed.unload().then(u), setTimeout(u, 200));
3705
+ }), m(this, "supports", (o) => $.mime.call(this, o)), this.timers = {}, this.ready = !1, this.loading = !1, this.failed = !1, this.touch = $.touch, this.media = i, a.string(this.media) && (this.media = document.querySelectorAll(this.media)), (window.jQuery && this.media instanceof jQuery || a.nodeList(this.media) || a.array(this.media)) && (this.media = this.media[0]), this.config = L({}, dt, me.defaults, t || {}, (() => {
3706
+ try {
3707
+ return JSON.parse(this.media.getAttribute("data-plyr-config"));
3708
+ } catch {
3709
+ return {};
3710
+ }
3711
+ })()), this.elements = {
3712
+ container: null,
3713
+ fullscreen: null,
3714
+ captions: null,
3715
+ buttons: {},
3716
+ display: {},
3717
+ progress: {},
3718
+ inputs: {},
3719
+ settings: {
3720
+ popup: null,
3721
+ menu: null,
3722
+ panels: {},
3723
+ buttons: {}
3724
+ }
3725
+ }, this.captions = {
3726
+ active: null,
3727
+ currentTrack: -1,
3728
+ meta: /* @__PURE__ */ new WeakMap()
3729
+ }, this.fullscreen = {
3730
+ active: !1
3731
+ }, this.options = {
3732
+ speed: [],
3733
+ quality: []
3734
+ }, this.debug = new ui(this.config.debug), this.debug.log("Config", this.config), this.debug.log("Support", $), a.nullOrUndefined(this.media) || !a.element(this.media)) {
3735
+ this.debug.error("Setup failed: no suitable element passed");
3736
+ return;
3737
+ }
3738
+ if (this.media.plyr) {
3739
+ this.debug.warn("Target already setup");
3740
+ return;
3741
+ }
3742
+ if (!this.config.enabled) {
3743
+ this.debug.error("Setup failed: disabled by config");
3744
+ return;
3745
+ }
3746
+ if (!$.check().api) {
3747
+ this.debug.error("Setup failed: no support");
3748
+ return;
3749
+ }
3750
+ const s = this.media.cloneNode(!0);
3751
+ s.autoplay = !1, this.elements.original = s;
3752
+ const n = this.media.tagName.toLowerCase();
3753
+ let r = null, l = null;
3754
+ switch (n) {
3755
+ case "div":
3756
+ if (r = this.media.querySelector("iframe"), a.element(r)) {
3757
+ if (l = ut(r.getAttribute("src")), this.provider = ci(l.toString()), this.elements.container = this.media, this.media = r, this.elements.container.className = "", l.search.length) {
3758
+ const o = ["1", "true"];
3759
+ o.includes(l.searchParams.get("autoplay")) && (this.config.autoplay = !0), o.includes(l.searchParams.get("loop")) && (this.config.loop.active = !0), this.isYouTube ? (this.config.playsinline = o.includes(l.searchParams.get("playsinline")), this.config.youtube.hl = l.searchParams.get("hl")) : this.config.playsinline = !0;
3760
+ }
3761
+ } else
3762
+ this.provider = this.media.getAttribute(this.config.attributes.embed.provider), this.media.removeAttribute(this.config.attributes.embed.provider);
3763
+ if (a.empty(this.provider) || !Object.values(W).includes(this.provider)) {
3764
+ this.debug.error("Setup failed: Invalid provider");
3765
+ return;
3766
+ }
3767
+ this.type = ve.video;
3768
+ break;
3769
+ case "video":
3770
+ case "audio":
3771
+ this.type = n, this.provider = W.html5, this.media.hasAttribute("crossorigin") && (this.config.crossorigin = !0), this.media.hasAttribute("autoplay") && (this.config.autoplay = !0), (this.media.hasAttribute("playsinline") || this.media.hasAttribute("webkit-playsinline")) && (this.config.playsinline = !0), this.media.hasAttribute("muted") && (this.config.muted = !0), this.media.hasAttribute("loop") && (this.config.loop.active = !0);
3772
+ break;
3773
+ default:
3774
+ this.debug.error("Setup failed: unsupported type");
3775
+ return;
3776
+ }
3777
+ if (this.supported = $.check(this.type, this.provider), !this.supported.api) {
3778
+ this.debug.error("Setup failed: no support");
3779
+ return;
3780
+ }
3781
+ this.eventListeners = [], this.listeners = new hi(this), this.storage = new te(this), this.media.plyr = this, a.element(this.elements.container) || (this.elements.container = y("div"), it(this.media, this.elements.container)), S.migrateStyles.call(this), S.addStyleHook.call(this), mt.setup.call(this), this.config.debug && T.call(this, this.elements.container, this.config.events.join(" "), (o) => {
3782
+ this.debug.log(`event: ${o.type}`);
3783
+ }), this.fullscreen = new q(this), (this.isHTML5 || this.isEmbed && !this.supported.ui) && S.build.call(this), this.listeners.container(), this.listeners.global(), this.config.ads.enabled && (this.ads = new Ti(this)), this.isHTML5 && this.config.autoplay && this.once("canplay", () => F(this.play())), this.lastSeekTime = 0, this.config.previewThumbnails.enabled && (this.previewThumbnails = new Se(this));
3784
+ }
3785
+ // ---------------------------------------
3786
+ // API
3787
+ // ---------------------------------------
3788
+ /**
3789
+ * Types and provider helpers
3790
+ */
3791
+ get isHTML5() {
3792
+ return this.provider === W.html5;
3793
+ }
3794
+ get isEmbed() {
3795
+ return this.isYouTube || this.isVimeo;
3796
+ }
3797
+ get isYouTube() {
3798
+ return this.provider === W.youtube;
3799
+ }
3800
+ get isVimeo() {
3801
+ return this.provider === W.vimeo;
3802
+ }
3803
+ get isVideo() {
3804
+ return this.type === ve.video;
3805
+ }
3806
+ get isAudio() {
3807
+ return this.type === ve.audio;
3808
+ }
3809
+ /**
3810
+ * Get playing state
3811
+ */
3812
+ get playing() {
3813
+ return !!(this.ready && !this.paused && !this.ended);
3814
+ }
3815
+ /**
3816
+ * Get paused state
3817
+ */
3818
+ get paused() {
3819
+ return !!this.media.paused;
3820
+ }
3821
+ /**
3822
+ * Get stopped state
3823
+ */
3824
+ get stopped() {
3825
+ return !!(this.paused && this.currentTime === 0);
3826
+ }
3827
+ /**
3828
+ * Get ended state
3829
+ */
3830
+ get ended() {
3831
+ return !!this.media.ended;
3832
+ }
3833
+ /**
3834
+ * Seek to a time
3835
+ * @param {number} input - where to seek to in seconds. Defaults to 0 (the start)
3836
+ */
3837
+ set currentTime(i) {
3838
+ if (!this.duration)
3839
+ return;
3840
+ const t = a.number(i) && i > 0;
3841
+ this.media.currentTime = t ? Math.min(i, this.duration) : 0, this.debug.log(`Seeking to ${this.currentTime} seconds`);
3842
+ }
3843
+ /**
3844
+ * Get current time
3845
+ */
3846
+ get currentTime() {
3847
+ return Number(this.media.currentTime);
3848
+ }
3849
+ /**
3850
+ * Get buffered
3851
+ */
3852
+ get buffered() {
3853
+ const {
3854
+ buffered: i
3855
+ } = this.media;
3856
+ return a.number(i) ? i : i && i.length && this.duration > 0 ? i.end(0) / this.duration : 0;
3857
+ }
3858
+ /**
3859
+ * Get seeking status
3860
+ */
3861
+ get seeking() {
3862
+ return !!this.media.seeking;
3863
+ }
3864
+ /**
3865
+ * Get the duration of the current media
3866
+ */
3867
+ get duration() {
3868
+ const i = Number.parseFloat(this.config.duration), t = (this.media || {}).duration, s = !a.number(t) || t === 1 / 0 ? 0 : t;
3869
+ return i || s;
3870
+ }
3871
+ /**
3872
+ * Set the player volume
3873
+ * @param {number} value - must be between 0 and 1. Defaults to the value from local storage and config.volume if not set in storage
3874
+ */
3875
+ set volume(i) {
3876
+ let t = i;
3877
+ const s = 1, n = 0;
3878
+ a.string(t) && (t = Number(t)), a.number(t) || (t = this.storage.get("volume")), a.number(t) || ({
3879
+ volume: t
3880
+ } = this.config), t > s && (t = s), t < n && (t = n), this.config.volume = t, this.media.volume = t, !a.empty(i) && this.muted && t > 0 && (this.muted = !1);
3881
+ }
3882
+ /**
3883
+ * Get the current player volume
3884
+ */
3885
+ get volume() {
3886
+ return Number(this.media.volume);
3887
+ }
3888
+ /**
3889
+ * Set muted state
3890
+ * @param {boolean} mute
3891
+ */
3892
+ set muted(i) {
3893
+ let t = i;
3894
+ a.boolean(t) || (t = this.storage.get("muted")), a.boolean(t) || (t = this.config.muted), this.config.muted = t, this.media.muted = t;
3895
+ }
3896
+ /**
3897
+ * Get current muted state
3898
+ */
3899
+ get muted() {
3900
+ return !!this.media.muted;
3901
+ }
3902
+ /**
3903
+ * Check if the media has audio
3904
+ */
3905
+ get hasAudio() {
3906
+ return !this.isHTML5 || this.isAudio ? !0 : !!this.media.mozHasAudio || !!this.media.webkitAudioDecodedByteCount || !!(this.media.audioTracks && this.media.audioTracks.length);
3907
+ }
3908
+ /**
3909
+ * Set playback speed
3910
+ * @param {number} input - the speed of playback (0.5-2.0)
3911
+ */
3912
+ set speed(i) {
3913
+ let t = null;
3914
+ a.number(i) && (t = i), a.number(t) || (t = this.storage.get("speed")), a.number(t) || (t = this.config.speed.selected);
3915
+ const {
3916
+ minimumSpeed: s,
3917
+ maximumSpeed: n
3918
+ } = this;
3919
+ t = pt(t, s, n), this.config.speed.selected = t, setTimeout(() => {
3920
+ this.media && (this.media.playbackRate = t);
3921
+ }, 0);
3922
+ }
3923
+ /**
3924
+ * Get current playback speed
3925
+ */
3926
+ get speed() {
3927
+ return Number(this.media.playbackRate);
3928
+ }
3929
+ /**
3930
+ * Get the minimum allowed speed
3931
+ */
3932
+ get minimumSpeed() {
3933
+ return this.isYouTube ? Math.min(...this.options.speed) : this.isVimeo ? 0.5 : 0.0625;
3934
+ }
3935
+ /**
3936
+ * Get the maximum allowed speed
3937
+ */
3938
+ get maximumSpeed() {
3939
+ return this.isYouTube ? Math.max(...this.options.speed) : this.isVimeo ? 2 : 16;
3940
+ }
3941
+ /**
3942
+ * Set playback quality
3943
+ * Currently HTML5 & YouTube only
3944
+ * @param {number} input - Quality level
3945
+ */
3946
+ set quality(i) {
3947
+ const t = this.config.quality, s = this.options.quality;
3948
+ if (!s.length)
3949
+ return;
3950
+ let n = [!a.empty(i) && Number(i), this.storage.get("quality"), t.selected, t.default].find(a.number), r = !0;
3951
+ if (!s.includes(n)) {
3952
+ const l = st(s, n);
3953
+ this.debug.warn(`Unsupported quality option: ${n}, using ${l} instead`), n = l, r = !1;
3954
+ }
3955
+ t.selected = n, this.media.quality = n, r && this.storage.set({
3956
+ quality: n
3957
+ });
3958
+ }
3959
+ /**
3960
+ * Get current quality level
3961
+ */
3962
+ get quality() {
3963
+ return this.media.quality;
3964
+ }
3965
+ /**
3966
+ * Toggle loop
3967
+ * TODO: Finish fancy new logic. Set the indicator on load as user may pass loop as config
3968
+ * @param {boolean} input - Whether to loop or not
3969
+ */
3970
+ set loop(i) {
3971
+ const t = a.boolean(i) ? i : this.config.loop.active;
3972
+ this.config.loop.active = t, this.media.loop = t;
3973
+ }
3974
+ /**
3975
+ * Get current loop state
3976
+ */
3977
+ get loop() {
3978
+ return !!this.media.loop;
3979
+ }
3980
+ /**
3981
+ * Set new media source
3982
+ * @param {object} input - The new source object (see docs)
3983
+ */
3984
+ set source(i) {
3985
+ Pe.change.call(this, i);
3986
+ }
3987
+ /**
3988
+ * Get current source
3989
+ */
3990
+ get source() {
3991
+ return this.media.currentSrc;
3992
+ }
3993
+ /**
3994
+ * Get a download URL (either source or custom)
3995
+ */
3996
+ get download() {
3997
+ const {
3998
+ download: i
3999
+ } = this.config.urls;
4000
+ return a.url(i) ? i : this.source;
4001
+ }
4002
+ /**
4003
+ * Set the download URL
4004
+ */
4005
+ set download(i) {
4006
+ a.url(i) && (this.config.urls.download = i, d.setDownloadUrl.call(this));
4007
+ }
4008
+ /**
4009
+ * Set the poster image for a video
4010
+ * @param {string} input - the URL for the new poster image
4011
+ */
4012
+ set poster(i) {
4013
+ if (!this.isVideo) {
4014
+ this.debug.warn("Poster can only be set for video");
4015
+ return;
4016
+ }
4017
+ S.setPoster.call(this, i, !1).catch(() => {
4018
+ });
4019
+ }
4020
+ /**
4021
+ * Get the current poster image
4022
+ */
4023
+ get poster() {
4024
+ return this.isVideo ? this.media.getAttribute("poster") || this.media.getAttribute("data-poster") : null;
4025
+ }
4026
+ /**
4027
+ * Get the current aspect ratio in use
4028
+ */
4029
+ get ratio() {
4030
+ if (!this.isVideo)
4031
+ return null;
4032
+ const i = de(Le.call(this));
4033
+ return a.array(i) ? i.join(":") : i;
4034
+ }
4035
+ /**
4036
+ * Set video aspect ratio
4037
+ */
4038
+ set ratio(i) {
4039
+ if (!this.isVideo) {
4040
+ this.debug.warn("Aspect ratio can only be set for video");
4041
+ return;
4042
+ }
4043
+ if (!a.string(i) || !rt(i)) {
4044
+ this.debug.error(`Invalid aspect ratio specified (${i})`);
4045
+ return;
4046
+ }
4047
+ this.config.ratio = de(i), X.call(this);
4048
+ }
4049
+ /**
4050
+ * Set the autoplay state
4051
+ * @param {boolean} input - Whether to autoplay or not
4052
+ */
4053
+ set autoplay(i) {
4054
+ this.config.autoplay = a.boolean(i) ? i : this.config.autoplay;
4055
+ }
4056
+ /**
4057
+ * Get the current autoplay state
4058
+ */
4059
+ get autoplay() {
4060
+ return !!this.config.autoplay;
4061
+ }
4062
+ /**
4063
+ * Toggle captions
4064
+ * @param {boolean} input - Whether to enable captions
4065
+ */
4066
+ toggleCaptions(i) {
4067
+ A.toggle.call(this, i, !1);
4068
+ }
4069
+ /**
4070
+ * Set the caption track by index
4071
+ * @param {number} input - Caption index
4072
+ */
4073
+ set currentTrack(i) {
4074
+ A.set.call(this, i, !1), A.setup.call(this);
4075
+ }
4076
+ /**
4077
+ * Get the current caption track index (-1 if disabled)
4078
+ */
4079
+ get currentTrack() {
4080
+ const {
4081
+ toggled: i,
4082
+ currentTrack: t
4083
+ } = this.captions;
4084
+ return i ? t : -1;
4085
+ }
4086
+ /**
4087
+ * Set the wanted language for captions
4088
+ * Since tracks can be added later it won't update the actual caption track until there is a matching track
4089
+ * @param {string} input - Two character ISO language code (e.g. EN, FR, PT, etc)
4090
+ */
4091
+ set language(i) {
4092
+ A.setLanguage.call(this, i, !1);
4093
+ }
4094
+ /**
4095
+ * Get the current track's language
4096
+ */
4097
+ get language() {
4098
+ return (A.getCurrentTrack.call(this) || {}).language;
4099
+ }
4100
+ /**
4101
+ * Toggle picture-in-picture playback on WebKit/MacOS
4102
+ * TODO: update player with state, support, enabled
4103
+ * TODO: detect outside changes
4104
+ */
4105
+ set pip(i) {
4106
+ if (!$.pip)
4107
+ return;
4108
+ const t = a.boolean(i) ? i : !this.pip;
4109
+ a.function(this.media.webkitSetPresentationMode) && this.media.webkitSetPresentationMode(t ? ye.active : ye.inactive), a.function(this.media.requestPictureInPicture) && (!this.pip && t ? this.media.requestPictureInPicture() : this.pip && !t && document.exitPictureInPicture());
4110
+ }
4111
+ /**
4112
+ * Get the current picture-in-picture state
4113
+ */
4114
+ get pip() {
4115
+ return $.pip ? a.empty(this.media.webkitPresentationMode) ? this.media === document.pictureInPictureElement : this.media.webkitPresentationMode === ye.active : null;
4116
+ }
4117
+ /**
4118
+ * Sets the preview thumbnails for the current source
4119
+ */
4120
+ setPreviewThumbnails(i) {
4121
+ this.previewThumbnails && this.previewThumbnails.loaded && (this.previewThumbnails.destroy(), this.previewThumbnails = null), Object.assign(this.config.previewThumbnails, i), this.config.previewThumbnails.enabled && (this.previewThumbnails = new Se(this));
4122
+ }
4123
+ /**
4124
+ * Check for support
4125
+ * @param {string} type - Player type (audio/video)
4126
+ * @param {string} provider - Provider (html5/youtube/vimeo)
4127
+ */
4128
+ static supported(i, t) {
4129
+ return $.check(i, t);
4130
+ }
4131
+ /**
4132
+ * Load an SVG sprite into the page
4133
+ * @param {string} url - URL for the SVG sprite
4134
+ * @param {string} [id] - Unique ID
4135
+ */
4136
+ static loadSprite(i, t) {
4137
+ return ot(i, t);
4138
+ }
4139
+ /**
4140
+ * Setup multiple instances
4141
+ * @param {*} selector
4142
+ * @param {object} options
4143
+ */
4144
+ static setup(i, t = {}) {
4145
+ let s = null;
4146
+ return a.string(i) ? s = Array.from(document.querySelectorAll(i)) : a.nodeList(i) ? s = Array.from(i) : a.array(i) && (s = i.filter(a.element)), a.empty(s) ? null : s.map((n) => new me(n, t));
4147
+ }
4148
+ }
4149
+ me.defaults = Ut(dt);
4150
+ export {
4151
+ me as default
4152
+ };