@mux/mux-player 0.1.0-beta.21

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 (118) hide show
  1. package/CHANGELOG.md +281 -0
  2. package/LICENSE +9 -0
  3. package/README.md +231 -0
  4. package/coverage/lcov-report/base.css +224 -0
  5. package/coverage/lcov-report/block-navigation.js +87 -0
  6. package/coverage/lcov-report/favicon.png +0 -0
  7. package/coverage/lcov-report/index.html +161 -0
  8. package/coverage/lcov-report/prettify.css +1 -0
  9. package/coverage/lcov-report/prettify.js +2 -0
  10. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  11. package/coverage/lcov-report/sorter.js +196 -0
  12. package/coverage/lcov-report/src/dialog.ts.html +247 -0
  13. package/coverage/lcov-report/src/errors.ts.html +574 -0
  14. package/coverage/lcov-report/src/helpers.ts.html +478 -0
  15. package/coverage/lcov-report/src/html.ts.html +580 -0
  16. package/coverage/lcov-report/src/index.html +251 -0
  17. package/coverage/lcov-report/src/index.ts.html +2941 -0
  18. package/coverage/lcov-report/src/logger.ts.html +163 -0
  19. package/coverage/lcov-report/src/media-chrome/dialog.ts.html +661 -0
  20. package/coverage/lcov-report/src/media-chrome/index.html +131 -0
  21. package/coverage/lcov-report/src/media-chrome/time-display.ts.html +295 -0
  22. package/coverage/lcov-report/src/media-theme-mux/icons/airplay.svg.html +109 -0
  23. package/coverage/lcov-report/src/media-theme-mux/icons/captions-off.svg.html +100 -0
  24. package/coverage/lcov-report/src/media-theme-mux/icons/captions-on.svg.html +100 -0
  25. package/coverage/lcov-report/src/media-theme-mux/icons/fullscreen-enter.svg.html +100 -0
  26. package/coverage/lcov-report/src/media-theme-mux/icons/fullscreen-exit.svg.html +100 -0
  27. package/coverage/lcov-report/src/media-theme-mux/icons/index.html +326 -0
  28. package/coverage/lcov-report/src/media-theme-mux/icons/pause.svg.html +100 -0
  29. package/coverage/lcov-report/src/media-theme-mux/icons/pip-enter.svg.html +100 -0
  30. package/coverage/lcov-report/src/media-theme-mux/icons/pip-exit.svg.html +100 -0
  31. package/coverage/lcov-report/src/media-theme-mux/icons/play.svg.html +100 -0
  32. package/coverage/lcov-report/src/media-theme-mux/icons/seek-backward.svg.html +124 -0
  33. package/coverage/lcov-report/src/media-theme-mux/icons/seek-forward.svg.html +124 -0
  34. package/coverage/lcov-report/src/media-theme-mux/icons/volume-high.svg.html +103 -0
  35. package/coverage/lcov-report/src/media-theme-mux/icons/volume-low.svg.html +103 -0
  36. package/coverage/lcov-report/src/media-theme-mux/icons/volume-medium.svg.html +103 -0
  37. package/coverage/lcov-report/src/media-theme-mux/icons/volume-off.svg.html +103 -0
  38. package/coverage/lcov-report/src/media-theme-mux/icons.ts.html +184 -0
  39. package/coverage/lcov-report/src/media-theme-mux/index.html +146 -0
  40. package/coverage/lcov-report/src/media-theme-mux/media-theme-mux.ts.html +1279 -0
  41. package/coverage/lcov-report/src/media-theme-mux/styles.css.html +586 -0
  42. package/coverage/lcov-report/src/styles.css.html +211 -0
  43. package/coverage/lcov-report/src/template.ts.html +463 -0
  44. package/coverage/lcov-report/src/utils.ts.html +385 -0
  45. package/coverage/lcov-report/src/video-api.ts.html +979 -0
  46. package/coverage/lcov.info +4058 -0
  47. package/dist/index.cjs.js +1432 -0
  48. package/dist/index.mjs +709 -0
  49. package/dist/mux-player.js +1478 -0
  50. package/dist/mux-player.mjs +1478 -0
  51. package/dist/tsconfig.tsbuildinfo +1 -0
  52. package/dist/types/dialog.d.ts +6 -0
  53. package/dist/types/errors.d.ts +6 -0
  54. package/dist/types/helpers.d.ts +26 -0
  55. package/dist/types/html.d.ts +18 -0
  56. package/dist/types/index.d.ts +199 -0
  57. package/dist/types/logger.d.ts +5 -0
  58. package/dist/types/media-chrome/dialog.d.ts +12 -0
  59. package/dist/types/media-chrome/time-display.d.ts +9 -0
  60. package/dist/types/media-theme-mux/icons.d.ts +15 -0
  61. package/dist/types/media-theme-mux/media-theme-mux.d.ts +29 -0
  62. package/dist/types/template.d.ts +5 -0
  63. package/dist/types/utils.d.ts +10 -0
  64. package/dist/types/video-api.d.ts +64 -0
  65. package/dist/types-ts3.4/dialog.d.ts +6 -0
  66. package/dist/types-ts3.4/errors.d.ts +6 -0
  67. package/dist/types-ts3.4/helpers.d.ts +26 -0
  68. package/dist/types-ts3.4/html.d.ts +18 -0
  69. package/dist/types-ts3.4/index.d.ts +180 -0
  70. package/dist/types-ts3.4/logger.d.ts +5 -0
  71. package/dist/types-ts3.4/media-chrome/dialog.d.ts +12 -0
  72. package/dist/types-ts3.4/media-chrome/time-display.d.ts +9 -0
  73. package/dist/types-ts3.4/media-theme-mux/icons.d.ts +15 -0
  74. package/dist/types-ts3.4/media-theme-mux/media-theme-mux.d.ts +29 -0
  75. package/dist/types-ts3.4/template.d.ts +5 -0
  76. package/dist/types-ts3.4/utils.d.ts +10 -0
  77. package/dist/types-ts3.4/video-api.d.ts +53 -0
  78. package/lang/en.json +32 -0
  79. package/lang/nl.json +31 -0
  80. package/package.json +107 -0
  81. package/src/dialog.ts +54 -0
  82. package/src/errors.ts +163 -0
  83. package/src/helpers.ts +131 -0
  84. package/src/html.ts +165 -0
  85. package/src/index.ts +952 -0
  86. package/src/logger.ts +26 -0
  87. package/src/media-chrome/dialog.ts +192 -0
  88. package/src/media-chrome/time-display.ts +70 -0
  89. package/src/media-theme-mux/icons/airplay.svg +8 -0
  90. package/src/media-theme-mux/icons/captions-off.svg +5 -0
  91. package/src/media-theme-mux/icons/captions-on.svg +5 -0
  92. package/src/media-theme-mux/icons/fullscreen-enter.svg +5 -0
  93. package/src/media-theme-mux/icons/fullscreen-exit.svg +5 -0
  94. package/src/media-theme-mux/icons/pause.svg +5 -0
  95. package/src/media-theme-mux/icons/pip-enter.svg +5 -0
  96. package/src/media-theme-mux/icons/pip-exit.svg +5 -0
  97. package/src/media-theme-mux/icons/play.svg +5 -0
  98. package/src/media-theme-mux/icons/seek-backward.svg +13 -0
  99. package/src/media-theme-mux/icons/seek-forward.svg +13 -0
  100. package/src/media-theme-mux/icons/volume-high.svg +6 -0
  101. package/src/media-theme-mux/icons/volume-low.svg +6 -0
  102. package/src/media-theme-mux/icons/volume-medium.svg +6 -0
  103. package/src/media-theme-mux/icons/volume-off.svg +6 -0
  104. package/src/media-theme-mux/icons.ts +33 -0
  105. package/src/media-theme-mux/media-theme-mux.ts +398 -0
  106. package/src/media-theme-mux/styles.css +167 -0
  107. package/src/styles.css +42 -0
  108. package/src/template.ts +126 -0
  109. package/src/types.d.ts +52 -0
  110. package/src/utils.ts +100 -0
  111. package/src/video-api.ts +298 -0
  112. package/test/errors.test.js +169 -0
  113. package/test/helpers.test.js +78 -0
  114. package/test/player.test.js +696 -0
  115. package/test/template.test.js +70 -0
  116. package/test/utils.test.js +21 -0
  117. package/test/web-test-runner.config.mjs +29 -0
  118. package/tsconfig.json +21 -0
package/dist/index.mjs ADDED
@@ -0,0 +1,709 @@
1
+ var Oe=(t,e,a)=>{if(!e.has(t))throw TypeError("Cannot "+a)};var y=(t,e,a)=>(Oe(t,e,"read from private field"),a?a.call(t):e.get(t)),f=(t,e,a)=>{if(e.has(t))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(t):e.set(t,a)},N=(t,e,a,o)=>(Oe(t,e,"write to private field"),o?o.call(t,a):e.set(t,a),a);var c=(t,e,a)=>(Oe(t,e,"access private method"),a);import"@mux/playback-core";import{MediaController as ui}from"media-chrome";import"media-chrome";import{TemplateInstance as Qe,NodeTemplatePart as le,createProcessor as ha,AttributeTemplatePart as Ce}from"@github/template-parts";var Q=new WeakMap,de=class{constructor(e,a){this.element=e;this.type=a;this.element.addEventListener(this.type,this);let o=Q.get(this.element);o&&o.set(this.type,this)}set(e){if(typeof e=="function")this.handleEvent=e.bind(this.element);else if(typeof e=="object"&&typeof e.handleEvent=="function")this.handleEvent=e.handleEvent.bind(e);else{this.element.removeEventListener(this.type,this);let a=Q.get(this.element);a&&a.delete(this.type)}}static for(e){Q.has(e.element)||Q.set(e.element,new Map);let a=e.attributeName.slice(2),o=Q.get(e.element);return o&&o.has(a)?o.get(a):new de(e.element,a)}};function pa(t,e){return t instanceof Ce&&t.attributeName.startsWith("on")?(de.for(t).set(e),t.element.removeAttributeNS(t.attributeNamespace,t.attributeName),!0):!1}function ga(t,e){return e instanceof $e&&t instanceof le?(e.renderInto(t),!0):!1}function fa(t,e){return e instanceof DocumentFragment&&t instanceof le?(e.childNodes.length&&t.replace(...e.childNodes),!0):!1}function ba(t,e){if(t instanceof Ce){let a=t.attributeNamespace,o=t.element.getAttributeNS(a,t.attributeName);return String(e)!==o&&(t.value=String(e)),!0}return t.value=String(e),!0}function va(t,e){if(typeof e=="boolean"&&t instanceof Ce){let a=t.attributeNamespace,o=t.element.hasAttributeNS(a,t.attributeName);return e!==o&&(t.booleanValue=e),!0}return!1}function ya(t,e){return e===!1&&t instanceof le?(t.replace(""),!0):!1}function Ea(t,e){va(t,e)||pa(t,e)||ya(t,e)||ga(t,e)||fa(t,e)||ba(t,e)}var Ie=new WeakMap,et=new WeakMap,tt=new WeakMap,$e=class{constructor(e,a,o){this.strings=e;this.values=a;this.processor=o}get template(){if(Ie.has(this.strings))return Ie.get(this.strings);{let e=document.createElement("template"),a=this.strings.length-1;return e.innerHTML=this.strings.reduce((o,i,n)=>o+i+(n<a?`{{ ${n} }}`:""),""),Ie.set(this.strings,e),e}}renderInto(e){let a=this.template;if(et.get(e)!==a){et.set(e,a);let i=new Qe(a,this.values,this.processor);tt.set(e,i),e instanceof le?e.replace(...i.children):e.appendChild(i);return}let o=tt.get(e);o&&o.update(this.values)}},Ta=ha(Ea);function s(t,...e){return new $e(t,e,Ta)}function ee(t,e){t.renderInto(e)}function b(t,e){let a=document.createElement("template");return a.innerHTML=t,new Qe(a,e)}var at=`
2
+ :host {
3
+ cursor: pointer;
4
+ }
5
+ media-time-display {
6
+ color: inherit;
7
+ }
8
+ `,it=document.createElement("template");it.innerHTML=`
9
+ <style>
10
+ ${at}
11
+ </style>
12
+ <media-time-display show-duration></media-time-display>
13
+ `;var ot=["Enter"," "],te=class extends HTMLElement{constructor(){super();var e,a;this.attachShadow({mode:"open"}),(e=this.shadowRoot)==null||e.appendChild(this.constructor.template.content.cloneNode(!0)),this.timeDisplayEl=(a=this.shadowRoot)==null?void 0:a.querySelector("media-time-display")}toggleTimeDisplay(){var e,a,o;((e=this.timeDisplayEl)==null?void 0:e.hasAttribute("remaining"))?(a=this.timeDisplayEl)==null||a.removeAttribute("remaining"):(o=this.timeDisplayEl)==null||o.setAttribute("remaining","")}connectedCallback(){let e=a=>{let{key:o}=a;if(!ot.includes(o)){this.removeEventListener("keyup",e);return}this.toggleTimeDisplay()};this.addEventListener("keydown",a=>{let{metaKey:o,altKey:i,key:n}=a;if(o||i||!ot.includes(n)){this.removeEventListener("keyup",e);return}this.addEventListener("keyup",e)}),this.addEventListener("click",this.toggleTimeDisplay)}};te.styles=at,te.template=it;globalThis.customElements.get("mxp-time-display")||(globalThis.customElements.define("mxp-time-display",te),globalThis.MxpTimeDisplay=te);var nt=`:host(:not([audio])) {
14
+ --secondary-color: transparent;
15
+ }
16
+
17
+ :host {
18
+ color: var(--primary-color);
19
+ --media-icon-color: var(--primary-color);
20
+ --media-range-thumb-background: var(--primary-color);
21
+ --media-range-bar-color: var(--primary-color);
22
+ --media-control-background: var(--secondary-color);
23
+ --media-control-hover-background: var(--secondary-color);
24
+ --media-time-buffered-color: rgba(255, 255, 255, 0.7);
25
+ --media-range-track-background: rgba(255, 255, 255, 0.5);
26
+ --media-range-track-border-radius: 3px;
27
+ display: inline-block;
28
+ width: 100%;
29
+ height: 100%;
30
+ }
31
+
32
+ :host([audio]) ::slotted([slot='media']) {
33
+ height: 0px;
34
+ }
35
+
36
+ :host([audio]) media-controller {
37
+ background: transparent;
38
+ }
39
+
40
+ :host([audio]) media-controller::part(vertical-layer) {
41
+ background: transparent;
42
+ }
43
+
44
+ :host([audio]) media-control-bar {
45
+ width: 100%;
46
+ }
47
+
48
+ media-airplay-button[media-airplay-unavailable],
49
+ media-cast-button[media-cast-unavailable],
50
+ media-volume-range[media-volume-unavailable],
51
+ media-airplay-button[media-airplay-unavailable] {
52
+ display: none;
53
+ }
54
+
55
+ media-volume-range[media-volume-unavailable] {
56
+ display: none;
57
+ }
58
+
59
+ media-pip-button[media-pip-unavailable] {
60
+ display: none;
61
+ }
62
+
63
+ media-controller {
64
+ width: 100%;
65
+ height: 100%;
66
+ }
67
+
68
+ :host(:not([audio])) media-time-range {
69
+ padding: var(--mux-time-range-padding, 0 10px);
70
+ z-index: 10;
71
+ width: 100%;
72
+ height: 22px;
73
+ --media-range-track-translate-y: 6px;
74
+ background: linear-gradient(180deg, transparent, transparent 15px, var(--media-control-background) 15px);
75
+ }
76
+
77
+ media-control-bar {
78
+ --media-button-icon-width: 18px;
79
+ }
80
+
81
+ media-control-bar :is([role='button'], [role='switch'], button) {
82
+ height: 44px;
83
+ }
84
+
85
+ media-cast-button {
86
+ width: 40px;
87
+ }
88
+
89
+ .size-extra-small media-control-bar [role='button'],
90
+ .size-extra-small media-control-bar [role='switch'] {
91
+ height: auto;
92
+ padding: 4.4% 3.2%;
93
+ }
94
+
95
+ .mxp-spacer {
96
+ flex-grow: 1;
97
+ height: 100%;
98
+ background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
99
+ }
100
+
101
+ /* Add a small space on the right to have the play button and
102
+ * fullscreen button aligned in relation to the progress bar. */
103
+ .size-large .mxp-padding-2 {
104
+ width: 2px;
105
+ height: 100%;
106
+ background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
107
+ }
108
+
109
+ media-controller::part(vertical-layer) {
110
+ transition: background-color 1s;
111
+ }
112
+
113
+ media-controller:is([media-paused], :not([user-inactive]))::part(vertical-layer) {
114
+ background-color: rgba(0, 0, 0, 0.6);
115
+ transition: background-color 0.25s;
116
+ }
117
+
118
+ .mxp-center-controls {
119
+ --media-button-icon-width: 100%;
120
+ --media-button-icon-height: auto;
121
+ pointer-events: none;
122
+ width: 100%;
123
+ display: flex;
124
+ flex-flow: row;
125
+ align-items: center;
126
+ justify-content: center;
127
+ }
128
+
129
+ .mxp-center-controls media-play-button {
130
+ --media-control-background: transparent;
131
+ --media-control-hover-background: transparent;
132
+ padding: 0;
133
+ width: max(27px, min(9%, 90px));
134
+ }
135
+
136
+ .mxp-center-controls media-seek-backward-button,
137
+ .mxp-center-controls media-seek-forward-button {
138
+ --media-control-background: transparent;
139
+ --media-control-hover-background: transparent;
140
+ padding: 0;
141
+ margin: 0 10%;
142
+ width: min(7%, 70px);
143
+ }
144
+
145
+ media-loading-indicator {
146
+ --media-loading-icon-width: 100%;
147
+ --media-button-icon-height: auto;
148
+ pointer-events: none;
149
+ position: absolute;
150
+ width: min(15%, 150px);
151
+ display: flex;
152
+ flex-flow: row;
153
+ align-items: center;
154
+ justify-content: center;
155
+ }
156
+
157
+ /* Intentionally don't target the div for transition but the children
158
+ of the div. Prevents messing with media-chrome's autohide feature. */
159
+ media-loading-indicator + div * {
160
+ transition: opacity 0.15s;
161
+ opacity: 1;
162
+ }
163
+
164
+ media-loading-indicator[media-loading]:not([media-paused]) ~ div > * {
165
+ opacity: 0;
166
+ transition-delay: 400ms;
167
+ }
168
+
169
+ media-volume-range {
170
+ width: min(100%, 100px);
171
+ }
172
+
173
+ media-time-display {
174
+ white-space: nowrap;
175
+ }
176
+
177
+ :is(media-time-display, media-text-display, media-playback-rate-button) {
178
+ color: inherit;
179
+ }
180
+ `;var rt=`<svg aria-hidden="true" viewBox="0 0 20 18" slot="airplay">
181
+ <path
182
+ d="M10.19 11.22a.25.25 0 0 0-.38 0l-5.46 6.37a.25.25 0 0 0 .19.41h10.92a.25.25 0 0 0 .19-.41Z"
183
+ />
184
+ <path
185
+ d="M19 0H1a1 1 0 0 0-1 1v13a1 1 0 0 0 1 1h2.94L5 13.75H1.25V1.25h17.5v12.5H15L16.06 15H19a1 1 0 0 0 1-1V1a1 1 0 0 0-1-1Z"
186
+ />
187
+ </svg>
188
+ `;var st=`<svg aria-hidden="true" viewBox="0 0 20 18" slot="off">
189
+ <path
190
+ d="M19.83 2.68a2.58 2.58 0 0 0-2.3-2.5C15.72.06 12.86 0 10 0S4.28.06 2.47.18a2.58 2.58 0 0 0-2.3 2.5 115.86 115.86 0 0 0 0 12.64 2.58 2.58 0 0 0 2.3 2.5c1.81.12 4.67.18 7.53.18s5.72-.06 7.53-.18a2.58 2.58 0 0 0 2.3-2.5 115.86 115.86 0 0 0 0-12.64Zm-1.49 12.53a1.11 1.11 0 0 1-.91 1.11c-1.67.11-4.45.18-7.43.18s-5.76-.07-7.43-.18a1.11 1.11 0 0 1-.91-1.11 122.5 122.5 0 0 1 0-12.42 1.11 1.11 0 0 1 .91-1.11C4.24 1.57 7 1.5 10 1.5s5.76.07 7.43.18a1.11 1.11 0 0 1 .91 1.11 122.5 122.5 0 0 1 0 12.42ZM7.84 11a1.55 1.55 0 0 1-.76.18 1.57 1.57 0 0 1-.71-.18 1.69 1.69 0 0 1-.57-.42 2.1 2.1 0 0 1-.38-.58 2.47 2.47 0 0 1 0-1.64 2 2 0 0 1 .39-.66 1.73 1.73 0 0 1 .58-.42 1.81 1.81 0 0 1 .73-.16 1.68 1.68 0 0 1 .7.14 1.39 1.39 0 0 1 .51.39l1.08-.89a2.18 2.18 0 0 0-.47-.44A2.81 2.81 0 0 0 8.4 6a2.91 2.91 0 0 0-.58-.15 2.71 2.71 0 0 0-.56 0A4.08 4.08 0 0 0 5.88 6a3.27 3.27 0 0 0-1.09.67 3.14 3.14 0 0 0-.71 1.06 3.62 3.62 0 0 0-.26 1.39 3.57 3.57 0 0 0 .26 1.38 3 3 0 0 0 .71 1.06 3.27 3.27 0 0 0 1.09.67 3.85 3.85 0 0 0 1.38.23 3.2 3.2 0 0 0 1.28-.27 2.49 2.49 0 0 0 1-.83l-1.17-.88a1.42 1.42 0 0 1-.53.52Zm6.62 0a1.58 1.58 0 0 1-.76.18A1.54 1.54 0 0 1 13 11a1.69 1.69 0 0 1-.57-.42A2.12 2.12 0 0 1 12 10a2.29 2.29 0 0 1 .39-2.3 1.84 1.84 0 0 1 1.32-.58 1.71 1.71 0 0 1 .7.14 1.39 1.39 0 0 1 .51.39L16 6.73a2.43 2.43 0 0 0-.47-.44A3.22 3.22 0 0 0 15 6a3 3 0 0 0-.57-.15 2.87 2.87 0 0 0-.57 0A4.06 4.06 0 0 0 12.5 6a3.17 3.17 0 0 0-1.09.67 3 3 0 0 0-.72 1.06 3.62 3.62 0 0 0-.25 1.39 3.57 3.57 0 0 0 .25 1.38 2.93 2.93 0 0 0 .72 1.06 3.17 3.17 0 0 0 1.09.67 3.83 3.83 0 0 0 1.37.23 3.16 3.16 0 0 0 1.28-.27 2.45 2.45 0 0 0 1-.83L15 10.51a1.49 1.49 0 0 1-.54.49Z"
191
+ />
192
+ </svg>
193
+ `;var lt=`<svg aria-hidden="true" viewBox="0 0 20 18" slot="on">
194
+ <path
195
+ d="M19.83 2.68a2.58 2.58 0 0 0-2.3-2.5C13.91-.06 6.09-.06 2.47.18a2.58 2.58 0 0 0-2.3 2.5 115.86 115.86 0 0 0 0 12.64 2.58 2.58 0 0 0 2.3 2.5c3.62.24 11.44.24 15.06 0a2.58 2.58 0 0 0 2.3-2.5 115.86 115.86 0 0 0 0-12.64ZM8.42 12.78a3.63 3.63 0 0 1-1.51.32 4.76 4.76 0 0 1-1.63-.27A4 4 0 0 1 4 12a3.67 3.67 0 0 1-.84-1.26 4.23 4.23 0 0 1-.3-1.63 4.28 4.28 0 0 1 .3-1.64A3.53 3.53 0 0 1 4 6.26a3.89 3.89 0 0 1 1.29-.8 4.76 4.76 0 0 1 1.63-.27 4.06 4.06 0 0 1 .67.06 4.57 4.57 0 0 1 .68.18 3.59 3.59 0 0 1 .64.34 2.7 2.7 0 0 1 .55.52l-1.27 1a1.79 1.79 0 0 0-.6-.46 2 2 0 0 0-.83-.16 2 2 0 0 0-1.56.69 2.35 2.35 0 0 0-.46.77 2.78 2.78 0 0 0-.16 1 2.74 2.74 0 0 0 .16 1 2.39 2.39 0 0 0 .46.77 2.07 2.07 0 0 0 .67.5 2 2 0 0 0 .84.18 1.87 1.87 0 0 0 .9-.21 1.78 1.78 0 0 0 .65-.6l1.38 1a2.88 2.88 0 0 1-1.22 1.01Zm7.52 0a3.63 3.63 0 0 1-1.51.32 4.76 4.76 0 0 1-1.63-.27 3.89 3.89 0 0 1-1.28-.83 3.55 3.55 0 0 1-.85-1.26 4.23 4.23 0 0 1-.3-1.63 4.28 4.28 0 0 1 .3-1.64 3.43 3.43 0 0 1 .85-1.25 3.75 3.75 0 0 1 1.28-.8 4.76 4.76 0 0 1 1.63-.27 4 4 0 0 1 .67.06 4.27 4.27 0 0 1 .68.18 3.59 3.59 0 0 1 .64.34 2.46 2.46 0 0 1 .55.52l-1.27 1a1.79 1.79 0 0 0-.6-.46 2 2 0 0 0-.83-.16 2 2 0 0 0-1.56.69 2.35 2.35 0 0 0-.46.77 3 3 0 0 0-.16 1 3 3 0 0 0 .16 1 2.58 2.58 0 0 0 .46.77 2.07 2.07 0 0 0 .67.5 2 2 0 0 0 .84.18 1.87 1.87 0 0 0 .9-.21 1.78 1.78 0 0 0 .65-.6l1.38 1a2.82 2.82 0 0 1-1.21 1.05Z"
196
+ />
197
+ </svg>
198
+ `;var dt=`<svg aria-hidden="true" viewBox="0 0 18 18" slot="enter">
199
+ <path
200
+ d="M17.25 11.5a.76.76 0 0 0-.75.75v4.25h-4.25a.75.75 0 0 0 0 1.5h5a.76.76 0 0 0 .75-.75v-5a.76.76 0 0 0-.75-.75Zm0-11.5h-5a.76.76 0 0 0-.75.75.76.76 0 0 0 .75.75h4.25v4.25a.75.75 0 0 0 1.5 0v-5a.76.76 0 0 0-.75-.75ZM5.75 16.5H1.5v-4.25a.76.76 0 0 0-.75-.75.76.76 0 0 0-.75.75v5a.76.76 0 0 0 .75.75h5a.75.75 0 0 0 0-1.5Zm0-16.5h-5A.76.76 0 0 0 0 .75v5a.76.76 0 0 0 .75.75.76.76 0 0 0 .75-.75V1.5h4.25A.76.76 0 0 0 6.5.75.76.76 0 0 0 5.75 0Z"
201
+ />
202
+ </svg>
203
+ `;var mt=`<svg aria-hidden="true" viewBox="0 0 18 18" slot="exit">
204
+ <path
205
+ d="M17.25 11.5h-5a.76.76 0 0 0-.75.75v5a.75.75 0 0 0 1.5 0V13h4.25a.75.75 0 0 0 0-1.5Zm-5-5h5a.75.75 0 0 0 0-1.5H13V.75a.75.75 0 0 0-1.5 0v5a.76.76 0 0 0 .75.75Zm-6.5 5h-5a.75.75 0 0 0 0 1.5H5v4.25a.75.75 0 0 0 1.5 0v-5a.76.76 0 0 0-.75-.75Zm0-11.5A.76.76 0 0 0 5 .75V5H.75a.75.75 0 0 0 0 1.5h5a.76.76 0 0 0 .75-.75v-5A.76.76 0 0 0 5.75 0Z"
206
+ />
207
+ </svg>
208
+ `;var ct=`<svg aria-hidden="true" viewBox="0 0 18 18" slot="pause">
209
+ <path
210
+ d="M3 16.5a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-15a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5v15ZM11.5 1a.5.5 0 0 0-.5.5v15a.5.5 0 0 0 .5.5h3a.5.5 0 0 0 .5-.5v-15a.5.5 0 0 0-.5-.5h-3Z"
211
+ />
212
+ </svg>
213
+ `;var ut=`<svg aria-hidden="true" viewBox="0 0 20 18" slot="enter">
214
+ <path
215
+ d="M19 0H1a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h6.75v-1.25h-6.5V1.25h17.5v6.5H20V1a1 1 0 0 0-1-1Zm0 10h-8a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1Zm-.5 6.5h-7v-5h7Z"
216
+ />
217
+ </svg>
218
+ `;var ht=`<svg aria-hidden="true" viewBox="0 0 20 18" slot="exit">
219
+ <path
220
+ d="M19 0H1a1 1 0 0 0-1 1v16a1 1 0 0 0 1 1h6.75v-1.25h-6.5V1.25h17.5v6.5H20V1a1 1 0 0 0-1-1Zm0 10h-8a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1v-6a1 1 0 0 0-1-1Zm-.5 6.5h-7v-5h7Z"
221
+ />
222
+ </svg>
223
+ `;var pt=`<svg aria-hidden="true" viewBox="0 0 18 18" slot="play">
224
+ <path
225
+ d="m3.73 17.93 14.05-8.54a.46.46 0 0 0 0-.78L3.73.07A.48.48 0 0 0 3 .46v17.07a.48.48 0 0 0 .73.4Z"
226
+ />
227
+ </svg>
228
+ `;var gt=`<svg aria-hidden="true" viewBox="0 0 16 18" slot="backward">
229
+ <path
230
+ d="M8.75 3.42H4.68l2.14-2.14A.75.75 0 0 0 5.76.22L2.22 3.75a.77.77 0 0 0 0 1.07l3.54 3.53a.75.75 0 0 0 1.06 0 .75.75 0 0 0 0-1.06L4.45 4.92h4.3A5.75 5.75 0 0 1 11 16a.75.75 0 0 0 .29 1.44.72.72 0 0 0 .29-.06A7.25 7.25 0 0 0 8.75 3.42Z"
231
+ />
232
+ <text
233
+ class="value"
234
+ transform="translate(.6 17.8)"
235
+ style="font-size: 8px; font-family: 'ArialMT', 'Arial'"
236
+ >
237
+ {{value}}
238
+ </text>
239
+ <path style="fill: none" d="M0 0h16v18H0z" />
240
+ </svg>
241
+ `;var ft=`<svg aria-hidden="true" viewBox="0 0 16 18" slot="forward">
242
+ <path
243
+ d="M7.25 3.42h4.07L9.18 1.28A.75.75 0 0 1 10.24.22l3.54 3.53a.77.77 0 0 1 0 1.07l-3.54 3.53a.75.75 0 0 1-1.06 0 .75.75 0 0 1 0-1.06l2.37-2.37h-4.3A5.75 5.75 0 0 0 5 16a.75.75 0 0 1-.29 1.44.72.72 0 0 1-.29-.06A7.25 7.25 0 0 1 7.25 3.42Z"
244
+ />
245
+ <text
246
+ class="value"
247
+ transform="translate(6.5 17.8)"
248
+ style="font-size: 8px; font-family: 'ArialMT', 'Arial'"
249
+ >
250
+ {{value}}
251
+ </text>
252
+ <path style="fill: none" d="M0 0h16v18H0z" />
253
+ </svg>
254
+ `;var bt=`<svg aria-hidden="true" viewBox="0 0 18 18" slot="high">
255
+ <path
256
+ d="m8.14 1.86-4 4a.49.49 0 0 1-.35.14H.25a.25.25 0 0 0-.25.25v5.5a.25.25 0 0 0 .25.25h3.54a.49.49 0 0 1 .36.15l4 4a.5.5 0 0 0 .85-.36V2.21a.5.5 0 0 0-.86-.35ZM10.88.3v1.52A7.52 7.52 0 0 1 16.47 9a7.52 7.52 0 0 1-5.59 7.18v1.52A9 9 0 0 0 18 9 9 9 0 0 0 10.88.3ZM14.44 9a5.49 5.49 0 0 0-3.56-5.1v1.66a3.93 3.93 0 0 1 0 6.88v1.66A5.49 5.49 0 0 0 14.44 9Z"
257
+ />
258
+ <path style="fill: none" d="M0 0h18v18H0z" />
259
+ </svg>
260
+ `;var vt=`<svg aria-hidden="true" viewBox="0 0 18 18" slot="low">
261
+ <path
262
+ d="m8.14 1.86-4 4a.49.49 0 0 1-.35.14H.25a.25.25 0 0 0-.25.25v5.5a.25.25 0 0 0 .25.25h3.54a.49.49 0 0 1 .36.15l4 4a.5.5 0 0 0 .85-.36V2.21a.5.5 0 0 0-.86-.35ZM14.44 9a5.49 5.49 0 0 0-3.56-5.1v1.66a3.93 3.93 0 0 1 0 6.88v1.66A5.49 5.49 0 0 0 14.44 9Z"
263
+ />
264
+ <path style="fill: none" d="M0 0h18v18H0z" />
265
+ </svg>
266
+ `;var yt=`<svg aria-hidden="true" viewBox="0 0 18 18" slot="medium">
267
+ <path
268
+ d="m8.14 1.86-4 4a.49.49 0 0 1-.35.14H.25a.25.25 0 0 0-.25.25v5.5a.25.25 0 0 0 .25.25h3.54a.49.49 0 0 1 .36.15l4 4a.5.5 0 0 0 .85-.36V2.21a.5.5 0 0 0-.86-.35ZM14.44 9a5.49 5.49 0 0 0-3.56-5.1v1.66a3.93 3.93 0 0 1 0 6.88v1.66A5.49 5.49 0 0 0 14.44 9Z"
269
+ />
270
+ <path style="fill: none" d="M0 0h18v18H0z" />
271
+ </svg>
272
+ `;var Et=`<svg aria-hidden="true" viewBox="0 0 18 18" slot="off">
273
+ <path
274
+ d="m0 1.05 4.48 4.47-.33.33a.49.49 0 0 1-.36.15H.25a.25.25 0 0 0-.25.25v5.5a.25.25 0 0 0 .25.25h3.54a.49.49 0 0 1 .36.15l4 4a.48.48 0 0 0 .36.15.5.5 0 0 0 .5-.5v-5.75l4.67 4.66a7.71 7.71 0 0 1-2.79 1.47v1.52a9.32 9.32 0 0 0 3.87-1.91L17 18l1-1L1.06 0Zm5.36 5.36L7.75 8.8V14L5 11.26a1.74 1.74 0 0 0-1.24-.51H1.25v-3.5h2.54A1.74 1.74 0 0 0 5 6.74ZM16.47 9a7.19 7.19 0 0 1-.89 3.47l1.11 1.1A8.64 8.64 0 0 0 18 9 9 9 0 0 0 10.88.3v1.52A7.52 7.52 0 0 1 16.47 9ZM9 5.88V2.21a.5.5 0 0 0-.5-.5.48.48 0 0 0-.36.15L6.56 3.44ZM12.91 9a4.28 4.28 0 0 1-.07.72l1.22 1.22A5.2 5.2 0 0 0 14.44 9a5.49 5.49 0 0 0-3.56-5.1v1.66A4 4 0 0 1 12.91 9Z"
275
+ />
276
+ <path style="fill: none" d="M0 0h18v18H0z" />
277
+ </svg>
278
+ `;var Tt=()=>b(rt),kt=()=>b(st),xt=()=>b(lt),At=()=>b(dt),Lt=()=>b(mt),wt=()=>b(ct),Mt=()=>b(ut),St=()=>b(ht),Ot=()=>b(pt),Ct=t=>b(gt,t),It=t=>b(ft,t),$t=()=>b(bt),Rt=()=>b(vt),Pt=()=>b(yt),_t=()=>b(Et);import{StreamTypes as k}from"@mux/playback-core";var C={LG:"large",SM:"small",XS:"extra-small"},Dt=t=>s`
279
+ <style>
280
+ ${nt}
281
+ </style>
282
+
283
+ <media-controller audio="${t.audio||!1}" class="size-${t.playerSize}">
284
+ <slot name="media" slot="media"></slot>
285
+ <media-loading-indicator slot="centered-chrome" no-auto-hide></media-loading-indicator>
286
+ ${Va(t)}
287
+ <slot></slot>
288
+ </media-controller>
289
+ `,Va=t=>{let{streamType:e,playerSize:a,audio:o}=t;if(o)switch(e){case k.LIVE:case k.LL_LIVE:return Ba(t);case k.DVR:case k.LL_DVR:return Ua(t);case k.ON_DEMAND:default:return Ha(t)}switch(e){case k.LIVE:case k.LL_LIVE:switch(a){case C.LG:return Za(t);case C.SM:return za(t);case C.XS:return Ya(t)}case k.DVR:case k.LL_DVR:switch(a){case C.LG:return ja(t);case C.SM:return qa(t);case C.XS:return Wa(t)}case k.ON_DEMAND:default:switch(a){case C.LG:return Ka(t);case C.SM:return Fa(t);case C.XS:return Re(t)}}},T=()=>s`
290
+ <media-play-button>
291
+ ${Ot()}
292
+ ${wt()}
293
+ </media-play-button>
294
+ `,z=t=>s`
295
+ <media-seek-backward-button seek-offset="${t.backwardSeekOffset}">
296
+ ${Ct({value:t.backwardSeekOffset})}
297
+ </media-seek-backward-button>
298
+ `,Z=t=>s`
299
+ <media-seek-forward-button seek-offset="${t.forwardSeekOffset}">
300
+ ${It({value:t.forwardSeekOffset})}
301
+ </media-seek-forward-button>
302
+ `,x=()=>s`
303
+ <media-mute-button>
304
+ ${$t()}
305
+ ${Pt()}
306
+ ${Rt()}
307
+ ${_t()}
308
+ </media-mute-button>
309
+ `,V=t=>s`
310
+ <media-captions-button default-showing="${!t.defaultHiddenCaptions}" >
311
+ ${kt()}
312
+ ${xt()}
313
+ </media-captions-button>`,A=()=>s`
314
+ <media-airplay-button>
315
+ ${Tt()}
316
+ </media-airplay-button>`,H=()=>s`
317
+ <media-pip-button>
318
+ ${Mt()}
319
+ ${St()}
320
+ </media-pip-button>`,U=()=>s`
321
+ <media-fullscreen-button>
322
+ ${At()}
323
+ ${Lt()}
324
+ </media-fullscreen-button>`,Ha=t=>s`
325
+ <media-control-bar>
326
+ ${T()} ${z(t)} ${Z(t)}
327
+ <mxp-time-display></mxp-time-display>
328
+ <media-time-range></media-time-range>
329
+ ${x()}
330
+ <media-volume-range></media-volume-range>
331
+ <media-playback-rate-button></media-playback-rate-button>
332
+ ${A()}
333
+ <media-cast-button></media-cast-button>
334
+ </media-control-bar>
335
+ `,Ua=t=>s`
336
+ <media-control-bar>
337
+ ${T()}
338
+ <slot name="seek-to-live-button"></slot>
339
+ ${z(t)} ${Z(t)}
340
+ <mxp-time-display></mxp-time-display>
341
+ <media-time-range></media-time-range>
342
+ ${x()}
343
+ <media-volume-range></media-volume-range>
344
+ <media-playback-rate-button></media-playback-rate-button>
345
+ ${A()}
346
+ <media-cast-button></media-cast-button>
347
+ </media-control-bar>
348
+ `,Ba=t=>s`
349
+ <media-control-bar>
350
+ ${T()}
351
+ <slot name="seek-to-live-button"></slot>
352
+ ${x()}
353
+ <media-volume-range></media-volume-range>
354
+ ${A()}
355
+ <media-cast-button></media-cast-button>
356
+ </media-control-bar>
357
+ `,Re=t=>s`
358
+ <media-control-bar slot="top-chrome">
359
+ ${t.hasCaptions?V(t):s``}
360
+ <div class="mxp-spacer"></div>
361
+ ${A()}
362
+ <media-cast-button></media-cast-button>
363
+ ${H()}
364
+ </media-control-bar>
365
+ <div slot="centered-chrome" class="mxp-center-controls">
366
+ ${T()}
367
+ </div>
368
+ <media-control-bar>
369
+ ${x()}
370
+ <div class="mxp-spacer"></div>
371
+ ${U()}
372
+ </media-control-bar>
373
+ `,Fa=t=>s`
374
+ <media-control-bar slot="top-chrome" style="justify-content: flex-end;">
375
+ ${t.hasCaptions?V(t):s``}
376
+ ${A()}
377
+ <media-cast-button></media-cast-button>
378
+ ${H()}
379
+ </media-control-bar>
380
+ <div slot="centered-chrome" class="mxp-center-controls">
381
+ ${z(t)}
382
+ ${T()}
383
+ ${Z(t)}
384
+ </div>
385
+ <media-time-range></media-time-range>
386
+ <media-control-bar>
387
+ <mxp-time-display></mxp-time-display>
388
+ ${x()}
389
+ <media-volume-range></media-volume-range>
390
+ <div class="mxp-spacer"></div>
391
+ <media-playback-rate-button></media-playback-rate-button>
392
+ ${U()}
393
+ <div class="mxp-padding-2"></div>
394
+ </media-control-bar>
395
+ `,Ka=t=>s`
396
+ <div slot="centered-chrome" class="mxp-center-controls">
397
+ ${T()}
398
+ </div>
399
+ <media-time-range></media-time-range>
400
+ <media-control-bar>
401
+ ${T()}
402
+ ${z(t)}
403
+ ${Z(t)}
404
+ <mxp-time-display></mxp-time-display>
405
+ ${x()}
406
+ <media-volume-range></media-volume-range>
407
+ <div class="mxp-spacer"></div>
408
+ <media-playback-rate-button></media-playback-rate-button>
409
+ ${t.hasCaptions?V(t):s``}
410
+ ${A()}
411
+ <media-cast-button></media-cast-button>
412
+ ${H()}
413
+ ${U()}
414
+ <div class="mxp-padding-2"></div>
415
+ </media-control-bar>
416
+ `,Ya=Re,za=t=>s`
417
+ <media-control-bar slot="top-chrome">
418
+ <slot name="seek-to-live-button"></slot>
419
+ <div class="mxp-spacer"></div>
420
+ ${t.hasCaptions?V(t):s``}
421
+ ${A()}
422
+ <media-cast-button></media-cast-button>
423
+ ${H()}
424
+ </media-control-bar>
425
+ <div slot="centered-chrome" class="mxp-center-controls">
426
+ ${T()}
427
+ </div>
428
+ <media-control-bar>
429
+ ${x()}
430
+ <media-volume-range></media-volume-range>
431
+ <div class="mxp-spacer"></div>
432
+ ${U()}
433
+ </media-control-bar>
434
+ `,Za=t=>s`
435
+ <media-control-bar slot="top-chrome">
436
+ <slot name="seek-to-live-button"></slot>
437
+ </media-control-bar>
438
+ <div slot="centered-chrome" class="mxp-center-controls">
439
+ ${T()}
440
+ </div>
441
+ <media-control-bar>
442
+ ${x()}
443
+ <media-volume-range></media-volume-range>
444
+ <div class="mxp-spacer"></div>
445
+ ${t.hasCaptions?V(t):s``}
446
+ ${A()}
447
+ <media-cast-button></media-cast-button>
448
+ ${H()}
449
+ ${U()}
450
+ </media-control-bar>
451
+ `,Wa=Re,qa=t=>s`
452
+ <media-control-bar slot="top-chrome" style="justify-content: flex-end;">
453
+ ${t.hasCaptions?V(t):s``}
454
+ ${A()}
455
+ <media-cast-button></media-cast-button>
456
+ ${H()}
457
+ </media-control-bar>
458
+ <div slot="centered-chrome" class="mxp-center-controls">
459
+ ${z(t)}
460
+ ${T()}
461
+ ${Z(t)}
462
+ </div>
463
+ <media-time-range></media-time-range>
464
+ <media-control-bar>
465
+ ${x()}
466
+ <media-volume-range></media-volume-range>
467
+ <slot name="seek-to-live-button"></slot>
468
+ <div class="mxp-spacer"></div>
469
+ ${U()}
470
+ <div class="mxp-padding-2"></div>
471
+ </media-control-bar>
472
+ `,ja=t=>s`
473
+ <div slot="centered-chrome" class="mxp-center-controls">
474
+ ${T()}
475
+ </div>
476
+ <media-time-range></media-time-range>
477
+ <media-control-bar>
478
+ ${T()}
479
+ ${z(t)}
480
+ ${Z(t)}
481
+ ${x()}
482
+ <media-volume-range></media-volume-range>
483
+ <slot name="seek-to-live-button"></slot>
484
+ <div class="mxp-spacer"></div>
485
+ ${t.hasCaptions?V(t):s``}
486
+ ${A()}
487
+ <media-cast-button></media-cast-button>
488
+ ${H()}
489
+ ${U()}
490
+ <div class="mxp-padding-2"></div>
491
+ </media-control-bar>
492
+ `;function Nt(t,e){return{audio:t.hasAttribute("audio"),streamType:t.getAttribute("stream-type"),playerSize:t.getAttribute("player-size"),defaultHiddenCaptions:t.hasAttribute("default-hidden-captions"),hasCaptions:t.hasAttribute("has-captions"),forwardSeekOffset:t.getAttribute("forward-seek-offset"),backwardSeekOffset:t.getAttribute("backward-seek-offset"),...e}}var Pe=class extends HTMLElement{static get observedAttributes(){return["audio","stream-type","player-size","default-hidden-captions","has-captions","forward-seek-offset","backward-seek-offset"]}constructor(){super();this.attachShadow({mode:"open"}),ee(Dt(Nt(this)),this.shadowRoot)}attributeChangedCallback(){ee(Dt(Nt(this)),this.shadowRoot)}};customElements.get("media-theme-mux")||customElements.define("media-theme-mux",Pe);var Vt=Pe;import hi,{MediaError as Be}from"@mux/mux-video";import{StreamTypes as I}from"@mux/playback-core";import{VideoEvents as ni}from"@mux/mux-video";var Ga="en",B={code:Ga};var Ht="en";function l(t,e=!0){var i,n;let a=e&&(n=(i=B)==null?void 0:i[t])!=null?n:t,o=e?B.code:Ht;return new Ut(a,o)}var Ut=class{constructor(e,a=(o=>(o=B.code)!=null?o:Ht)()){this.message=e,this.locale=a}format(e){return this.message.replace(/\{(\w+)\}/g,(a,o)=>{var i;return(i=e[o])!=null?i:""})}toString(){return this.message}};function Bt(t){let e="";return Object.entries(t).forEach(([a,o])=>{o!=null&&(e+=`${Xa(a)}: ${o}; `)}),e?e.trim():void 0}function Xa(t){return t.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase()}function Ft(t){return t.replace(/[-_]([a-z])/g,(e,a)=>a.toUpperCase())}function ae(t){if(t==null)return;let e=+t;return Number.isNaN(e)?void 0:e}function me(t){let e=Ja(t).toString();return e?"?"+e:""}function Ja(t){let e={};for(let a in t)t[a]!=null&&(e[a]=t[a]);return new URLSearchParams(e)}function ie(t){let a=t.split(".")[1].replace(/-/g,"+").replace(/_/g,"/"),o=decodeURIComponent(atob(a).split("").map(function(i){return"%"+("00"+i.charCodeAt(0).toString(16)).slice(-2)}).join(""));return JSON.parse(o)}var _e=(t,e)=>!t||!e?!1:t.contains(e)?!0:_e(t,e.getRootNode().host);import{StreamTypes as ce}from"@mux/playback-core";var De="mux.com",Qa=()=>{try{return"0.1.0-beta.21"}catch{}return"UNKNOWN"},ei=Qa(),ue=()=>ei,Ne=(t,{token:e,domain:a=De}={})=>`https://stream.${a}/${t}.m3u8${me(!!e?{token:e}:{redundant_streams:!0})}`,Kt=(t,{token:e,thumbnailTime:a,domain:o=De}={})=>{let i=e==null?a:void 0;return`https://image.${o}/${t}/thumbnail.jpg${me({token:e,time:i})}`},Yt=(t,{token:e,domain:a=De}={})=>`https://image.${a}/${t}/storyboard.vtt${me({token:e})}`,ti={crossorigin:"crossOrigin",playsinline:"playsInline"};function zt(t){var e;return(e=ti[t])!=null?e:Ft(t)}var he,ai=(t="video")=>he||(typeof window!="undefined"&&(he=document.createElement(t)),he),Zt=async(t=ai())=>{if(!t)return!1;let e=t.volume;return t.volume=e/2+.1,new Promise((a,o)=>{setTimeout(()=>{a(t.volume!==e)},0)})};function Wt(t){var e,a;return Array.from((a=(e=t.media)==null?void 0:e.textTracks)!=null?a:[]).filter(({kind:o})=>o==="subtitles"||o==="captions")}var qt=t=>{var a,o;let{media:e}=t;return(o=(a=e==null?void 0:e._hls)==null?void 0:a.liveSyncPosition)!=null?o:(e==null?void 0:e.seekable.length)?e==null?void 0:e.seekable.end(e.seekable.length-1):void 0},Ve=t=>{let e=qt(t);if(e==null){console.warn("attempting to seek to live but cannot determine live edge time!");return}t.currentTime=e},ii=1,oi=5,jt=3,Gt=.5,Xt=t=>{var n;let{streamType:e}=t,a=qt(t),o=(n=t.media)==null?void 0:n.currentTime;if(a==null||o==null)return!1;let i=a-o;return e===ce.LL_LIVE||e===ce.LL_DVR?i<=ii*(jt+Gt):e===ce.LIVE||e===ce.DVR?i<=oi*(jt+Gt):!1};var Jt=`[mux-player ${ue()}]`;function L(...t){console.warn(Jt,...t)}function F(...t){console.error(Jt,...t)}function pe(t){var a;let e=(a=t.message)!=null?a:"";if(t.file){let o="https://github.com/muxinc/elements/blob/main/errors/";e+=` ${l("Read more: ")}
493
+ ${o}${t.file}`}L(e)}var h={AUTOPLAY:"autoplay",CROSSORIGIN:"crossorigin",LOOP:"loop",MUTED:"muted",PLAYSINLINE:"playsinline",SRC:"src",POSTER:"poster",PRELOAD:"preload"},ge={VOLUME:"volume",PLAYBACKRATE:"playbackrate",MUTED:"muted"},ri=ni.filter(t=>t!=="error"),si=Object.values(h),li=Object.values(ge);function Qt(t){t.querySelectorAll(":scope > track").forEach(e=>{var a;(a=t.media)==null||a.append(e.cloneNode())}),ri.forEach(e=>{var a;(a=t.media)==null||a.addEventListener(e,o=>{t.dispatchEvent(new Event(o.type))})})}var ea=class extends HTMLElement{static get observedAttributes(){return[...si,...li]}constructor(){super();this.querySelectorAll(":scope > track").forEach(o=>{var i;(i=this.media)==null||i.append(o.cloneNode())});let e=o=>{for(let i of o)i.type==="childList"&&(i.removedNodes.forEach(n=>{var u,g;let r=(u=this.media)==null?void 0:u.querySelector(`track[src="${n.src}"]`);r&&((g=this.media)==null||g.removeChild(r))}),i.addedNodes.forEach(n=>{var r;(r=this.media)==null||r.append(n.cloneNode())}))};new MutationObserver(e).observe(this,{childList:!0,subtree:!0})}attributeChangedCallback(e,a,o){switch(e){case ge.MUTED:{this.media&&(this.media.muted=o!=null);return}case ge.VOLUME:{let i=+o;this.media&&!Number.isNaN(i)&&(this.media.volume=i);return}case ge.PLAYBACKRATE:{let i=+o;this.media&&!Number.isNaN(i)&&(this.media.playbackRate=i);return}}}play(){var e;return(e=this.media)==null?void 0:e.play()}pause(){var e;(e=this.media)==null||e.pause()}requestCast(e){var a;return(a=this.media)==null?void 0:a.requestCast(e)}get media(){var e;return(e=this.shadowRoot)==null?void 0:e.querySelector("mux-video")}get video(){return L("<mux-player>.video is deprecated, please use .media instead"),this.media}get paused(){var e,a;return(a=(e=this.media)==null?void 0:e.paused)!=null?a:!0}get duration(){var e,a;return(a=(e=this.media)==null?void 0:e.duration)!=null?a:NaN}get ended(){var e,a;return(a=(e=this.media)==null?void 0:e.ended)!=null?a:!1}get buffered(){var e;return(e=this.media)==null?void 0:e.buffered}get readyState(){var e,a;return(a=(e=this.media)==null?void 0:e.readyState)!=null?a:0}get videoWidth(){var e;return(e=this.media)==null?void 0:e.videoWidth}get videoHeight(){var e;return(e=this.media)==null?void 0:e.videoHeight}get currentTime(){var e,a;return(a=(e=this.media)==null?void 0:e.currentTime)!=null?a:0}set currentTime(e){this.media&&(this.media.currentTime=Number(e))}get volume(){var e,a;return(a=(e=this.media)==null?void 0:e.volume)!=null?a:1}set volume(e){this.media&&(this.media.volume=Number(e))}get src(){return P(this,h.SRC)}set src(e){this.setAttribute(h.SRC,`${e}`)}get poster(){var e;return(e=P(this,h.POSTER))!=null?e:""}set poster(e){this.setAttribute(h.POSTER,`${e}`)}get playbackRate(){var e,a;return(a=(e=this.media)==null?void 0:e.playbackRate)!=null?a:1}set playbackRate(e){this.media&&(this.media.playbackRate=Number(e))}get crossOrigin(){return P(this,h.CROSSORIGIN)}set crossOrigin(e){this.setAttribute(h.CROSSORIGIN,`${e}`)}get autoplay(){return P(this,h.AUTOPLAY)!=null}set autoplay(e){e?this.setAttribute(h.AUTOPLAY,typeof e=="string"?e:""):this.removeAttribute(h.AUTOPLAY)}get loop(){return P(this,h.LOOP)!=null}set loop(e){e?this.setAttribute(h.LOOP,""):this.removeAttribute(h.LOOP)}get muted(){return P(this,h.MUTED)!=null}set muted(e){e?this.setAttribute(h.MUTED,""):this.removeAttribute(h.MUTED)}get playsInline(){return P(this,h.PLAYSINLINE)!=null}set playsInline(e){e?this.setAttribute(h.PLAYSINLINE,""):this.removeAttribute(h.PLAYSINLINE)}get preload(){return P(this,h.PRELOAD)}set preload(e){e?this.setAttribute(h.PRELOAD,e):this.removeAttribute(h.PRELOAD)}};function P(t,e){return t.media?t.media.getAttribute(e):t.getAttribute(e)}var He=ea;var ta=`
494
+ :host {
495
+ z-index: 100;
496
+ display: flex;
497
+ justify-content: center;
498
+ align-items: center;
499
+ width: 100%;
500
+ height: 100%;
501
+ position: absolute;
502
+ top: 0;
503
+ left: 0;
504
+ box-sizing: border-box;
505
+ color: #fff;
506
+ line-height: 18px;
507
+ font-family: Arial, sans-serif;
508
+ padding: var(--media-dialog-backdrop-padding, 0);
509
+ background: var(--media-dialog-backdrop-background,
510
+ linear-gradient(to bottom, rgba(20, 20, 30, 0.7) 50%, rgba(20, 20, 30, 0.9))
511
+ );
512
+ /* Needs to use !important to prevent overwrite of media-chrome */
513
+ transition: var(--media-dialog-transition-open, visibility .2s, opacity .2s) !important;
514
+ transform: var(--media-dialog-transform-open, none) !important;
515
+ visibility: visible !important;
516
+ opacity: 1 !important;
517
+ pointer-events: auto !important;
518
+ }
519
+
520
+ :host(:not([open])) {
521
+ /* Needs to use !important to prevent overwrite of media-chrome */
522
+ transition: var(--media-dialog-transition-close, visibility .1s, opacity .1s) !important;
523
+ transform: var(--media-dialog-transform-close, none) !important;
524
+ visibility: hidden !important;
525
+ opacity: 0 !important;
526
+ pointer-events: none !important;
527
+ }
528
+
529
+ /*
530
+ Only show outline when keyboard focusing.
531
+ https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo
532
+ :host-context support is bad https://caniuse.com/mdn-css_selectors_host-context
533
+ */
534
+ :host-context([media-keyboard-control]) ::slotted(:focus),
535
+ :host-context([media-keyboard-control]) :focus {
536
+ box-shadow: 0 0 0 2px rgba(27, 127, 204, 0.9);
537
+ }
538
+
539
+ .dialog {
540
+ position: relative;
541
+ box-sizing: border-box;
542
+ background: var(--media-dialog-background, none);
543
+ padding: var(--media-dialog-padding, 10px);
544
+ width: min(320px, 100%);
545
+ word-wrap: break-word;
546
+ max-height: 100%;
547
+ overflow: auto;
548
+ text-align: center;
549
+ line-height: 1.4;
550
+ }
551
+ `,aa=document.createElement("template");aa.innerHTML=`
552
+ <style>
553
+ ${ta}
554
+ </style>
555
+
556
+ <div class="dialog">
557
+ <slot></slot>
558
+ </div>
559
+ `;var K=class extends HTMLElement{constructor(){super();var e;this.attachShadow({mode:"open"}),(e=this.shadowRoot)==null||e.appendChild(this.constructor.template.content.cloneNode(!0))}show(){this.setAttribute("open",""),this.dispatchEvent(new CustomEvent("open",{composed:!0,bubbles:!0})),ia(this)}close(){!this.hasAttribute("open")||(this.removeAttribute("open"),this.dispatchEvent(new CustomEvent("close",{composed:!0,bubbles:!0})),di(this))}attributeChangedCallback(e,a,o){e==="open"&&a!==o&&(o!=null?this.show():this.close())}connectedCallback(){this.hasAttribute("role")||this.setAttribute("role","dialog"),this.hasAttribute("open")&&ia(this)}};K.styles=ta,K.template=aa,K.observedAttributes=["open"];function ia(t){let e=new CustomEvent("initfocus",{composed:!0,bubbles:!0,cancelable:!0});if(t.dispatchEvent(e),e.defaultPrevented)return;let a=t.querySelector("[autofocus]:not([disabled])");!a&&t.tabIndex>=0&&(a=t),a||(a=oa(t.shadowRoot)),t._previouslyFocusedElement=document.activeElement,document.activeElement instanceof HTMLElement&&document.activeElement.blur(),t.addEventListener("transitionend",()=>{a instanceof HTMLElement&&a.focus({preventScroll:!0})},{once:!0})}function oa(t){let a=["button","input","keygen","select","textarea"].map(function(i){return i+":not([disabled])"});a.push('[tabindex]:not([disabled]):not([tabindex=""])');let o=t==null?void 0:t.querySelector(a.join(", "));if(!o&&"attachShadow"in Element.prototype){let i=(t==null?void 0:t.querySelectorAll("*"))||[];for(let n=0;n<i.length&&!(i[n].tagName&&i[n].shadowRoot&&(o=oa(i[n].shadowRoot),o));n++);}return o}function di(t){t._previouslyFocusedElement instanceof HTMLElement&&t._previouslyFocusedElement.focus()}globalThis.customElements.get("media-dialog")||(globalThis.customElements.define("media-dialog",K),globalThis.MediaDialog=K);var Ue=K;var na=document.createElement("template");na.innerHTML=`
560
+ <style>
561
+ ${Ue.styles}
562
+
563
+ .close {
564
+ background: none;
565
+ color: inherit;
566
+ border: none;
567
+ padding: 0;
568
+ font: inherit;
569
+ cursor: pointer;
570
+ outline: inherit;
571
+ width: 28px;
572
+ height: 28px;
573
+ position: absolute;
574
+ top: 1rem;
575
+ right: 1rem;
576
+ }
577
+ </style>
578
+
579
+ <div class="dialog">
580
+ <slot></slot>
581
+ </div>
582
+
583
+ <slot name="close">
584
+ <button class="close" tabindex="0">
585
+ <svg fill="none" viewBox="0 0 24 24" stroke="currentColor">
586
+ <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12" />
587
+ </svg>
588
+ </button>
589
+ </slot>
590
+ `;var fe=class extends Ue{constructor(){super();var e,a;(a=(e=this.shadowRoot)==null?void 0:e.querySelector(".close"))==null||a.addEventListener("click",()=>{this.close()})}};fe.template=na;globalThis.customElements.get("mxp-dialog")||(globalThis.customElements.define("mxp-dialog",fe),globalThis.MxpDialog=fe);var ra=`:host {
591
+ display: inline-block;
592
+ }
593
+
594
+ /* Hide custom elements that are not defined yet */
595
+ :not(:defined) {
596
+ display: none;
597
+ }
598
+
599
+ a {
600
+ color: #fff;
601
+ font-size: 0.9em;
602
+ text-decoration: underline;
603
+ }
604
+
605
+ media-controller {
606
+ width: 100%;
607
+ height: 100%;
608
+ }
609
+
610
+ .mxp-seek-to-live-button {
611
+ height: 44px;
612
+ background-color: var(--media-control-background, rgba(20, 20, 30, 0.7));
613
+ color: white;
614
+ border: none;
615
+ cursor: pointer;
616
+ }
617
+
618
+ .mxp-seek-to-live-button[aria-disabled] {
619
+ cursor: default;
620
+ pointer-events: none;
621
+ }
622
+
623
+ .mxp-seek-to-live-button::before {
624
+ content: '\u25CF ';
625
+ color: rgb(118, 118, 118);
626
+ padding-right: 5px;
627
+ }
628
+
629
+ .mxp-seek-to-live-button[aria-disabled]::before {
630
+ color: #fb3c4d;
631
+ }
632
+ `;import{StreamTypes as W}from"@mux/playback-core";var sa=t=>s`
633
+ <style>
634
+ ${ra}
635
+ </style>
636
+ ${ci(t)}
637
+ `,ci=t=>{var e,a,o,i,n,r,u,g,S,E,$,v,O,R,p,D,X,J,Ye,ze,Ze,We,qe,je,Ge,Xe;return s`
638
+ <media-theme-mux
639
+ audio="${t.audio||!1}"
640
+ style="${(e=Bt({"--primary-color":t.primaryColor,"--secondary-color":t.secondaryColor,"--mux-time-range-padding":t.secondaryColor?"0":null,"--media-range-track-border-radius":t.secondaryColor?"0":null}))!=null?e:!1}"
641
+ class="size-${t.playerSize}"
642
+ stream-type="${t.streamType}"
643
+ player-size="${t.playerSize}"
644
+ has-captions="${t.hasCaptions}"
645
+ default-hidden-captions="${t.defaultHiddenCaptions}"
646
+ forward-seek-offset="${t.forwardSeekOffset}"
647
+ backward-seek-offset="${t.backwardSeekOffset}"
648
+ >
649
+ <mux-video
650
+ slot="media"
651
+ crossorigin
652
+ playsinline
653
+ autoplay="${(a=t.autoplay)!=null?a:!1}"
654
+ muted="${(o=t.muted)!=null?o:!1}"
655
+ loop="${(i=t.loop)!=null?i:!1}"
656
+ preload="${(n=t.preload)!=null?n:!1}"
657
+ debug="${(r=t.debug)!=null?r:!1}"
658
+ prefer-mse="${(u=t.preferMse)!=null?u:!1}"
659
+ start-time="${t.startTime!=null?t.startTime:!1}"
660
+ metadata-video-id="${(E=(S=t.metadataVideoId)!=null?S:(g=t.metadata)==null?void 0:g.video_id)!=null?E:!1}"
661
+ metadata-video-title="${(O=(v=t.metadataVideoTitle)!=null?v:($=t.metadata)==null?void 0:$.video_title)!=null?O:!1}"
662
+ metadata-viewer-user-id="${(D=(p=t.metadataViewerUserId)!=null?p:(R=t.metadata)==null?void 0:R.viewer_user_id)!=null?D:!1}"
663
+ beacon-collection-domain="${(X=t.beaconCollectionDomain)!=null?X:!1}"
664
+ player-software-name="${t.playerSoftwareName}"
665
+ player-software-version="${t.playerSoftwareVersion}"
666
+ env-key="${(J=t.envKey)!=null?J:!1}"
667
+ stream-type="${(Ye=t.streamType)!=null?Ye:!1}"
668
+ custom-domain="${(ze=t.customDomain)!=null?ze:!1}"
669
+ src="${t.src?t.src:t.playbackId?Ne(t.playbackId,{domain:t.customDomain,token:t.tokens.playback}):!1}"
670
+ poster="${t.poster?t.poster:t.playbackId&&!t.audio?Kt(t.playbackId,{domain:t.customDomain,thumbnailTime:(Ze=t.thumbnailTime)!=null?Ze:t.startTime,token:t.tokens.thumbnail}):!1}"
671
+ cast-src="${t.src?t.src:t.playbackId?Ne(t.playbackId,{domain:t.customDomain,token:t.tokens.playback}):!1}"
672
+ cast-stream-type="${[W.LIVE,W.LL_LIVE].includes(t.streamType)?"live":!1}"
673
+ >
674
+ ${t.playbackId&&!t.audio&&![W.LIVE,W.LL_LIVE,W.DVR,W.LL_DVR].includes(t.streamType)?s`<track
675
+ label="thumbnails"
676
+ default
677
+ kind="metadata"
678
+ src="${Yt(t.playbackId,{domain:t.customDomain,token:t.tokens.storyboard})}"
679
+ />`:s``}
680
+ </mux-video>
681
+ <button
682
+ slot="seek-to-live-button"
683
+ aria-disabled="${t.inLiveWindow}"
684
+ onclick="${function(ca){var Je;if((Je=t.onSeekToLive)==null||Je.call(t,ca),t.paused){let ua=new CustomEvent("mediaplayrequest",{composed:!0,bubbles:!0});this.dispatchEvent(ua)}}}"
685
+ class="mxp-seek-to-live-button"
686
+ >
687
+ Live
688
+ </button>
689
+ <mxp-dialog
690
+ no-auto-hide
691
+ open="${t.isDialogOpen}"
692
+ onclose="${t.onCloseErrorDialog}"
693
+ oninitfocus="${t.onInitFocusDialog}"
694
+ >
695
+ ${((We=t.dialog)==null?void 0:We.title)?s`<h3>${t.dialog.title}</h3>`:s``}
696
+ <p>
697
+ ${(qe=t.dialog)==null?void 0:qe.message}
698
+ ${((je=t.dialog)==null?void 0:je.linkUrl)?s`<a
699
+ href="${t.dialog.linkUrl}"
700
+ target="_blank"
701
+ rel="external noopener"
702
+ aria-label="${(Ge=t.dialog.linkText)!=null?Ge:""} ${l("(opens in a new window)")}"
703
+ >${(Xe=t.dialog.linkText)!=null?Xe:t.dialog.linkUrl}</a
704
+ >`:s``}
705
+ </p>
706
+ </mxp-dialog>
707
+ </media-theme-mux>
708
+ `};import{MediaError as be}from"@mux/mux-video";function ve(t,e,a,o,i){var u,g,S;let n={},r={};switch(t.code){case be.MEDIA_ERR_NETWORK:{switch(n.title=l("Network Error",i),n.message=t.message,(u=t.data)==null?void 0:u.response.code){case 412:{n.title=l("Video is not currently available",i),n.message=l("The live stream or video file are not yet ready.",i),r.message=l("This playback-id may belong to a live stream that is not currently active or an asset that is not ready.",i),r.file="412-not-playable.md";break}case 404:{n.title=l("Video does not exist",i),n.message="",r.message=l("This playback-id does not exist. You may have used an Asset ID or an ID from a different resource.",i),r.file="404-not-found.md";break}case 403:{if(n.title=l("Invalid playback URL",i),n.message=l("The video URL or playback-token are formatted with incorrect or incomplete information.",i),r.message=l("403 error trying to access this playback URL. If this is a signed URL, you might need to provide a playback-token.",i),r.file="missing-signed-tokens.md",!o)break;let{exp:E,aud:$,sub:v}=ie(o),O=Date.now()>E*1e3,R=v!==a,p=$!=="v",D={timeStyle:"medium",dateStyle:"medium"};if(O){n.title=l("Video URL has expired",i),n.message=l("The video\u2019s secured playback-token has expired.",i),r.message=l("This playback is using signed URLs and the playback-token has expired. Expired at: {expiredDate}. Current time: {currentDate}.",i).format({expiredDate:new Intl.DateTimeFormat(B.code,D).format(E*1e3),currentDate:new Intl.DateTimeFormat(B.code,D).format(Date.now())}),r.file="403-expired-token.md";break}if(R){n.title=l("Video URL is formatted incorrectly",i),n.message=l("The video\u2019s playback ID does not match the one encoded in the playback-token.",i),r.message=l("The specified playback ID {playbackId} and the playback ID encoded in the playback-token {tokenPlaybackId} do not match.",i).format({playbackId:a,tokenPlaybackId:v}),r.file="403-playback-id-mismatch.md";break}if(p){n.title=l("Video URL is formatted incorrectly",i),n.message=l("The playback-token is formatted with incorrect information.",i),r.message=l("The playback-token has an incorrect aud value: {tokenType}. aud value should be v.",i).format({tokenType:$}),r.file="403-incorrect-aud-value.md";break}r.message=l("403 error trying to access this playback URL. If this is a signed playback ID, the token might not have been generated correctly.",i),r.file="403-malformatted-token.md";break}}break}case be.MEDIA_ERR_DECODE:{let{message:E}=t;n={title:l("Media Error",i),message:E},r.file="media-decode-error.md";break}case be.MEDIA_ERR_SRC_NOT_SUPPORTED:{let E=(S=(g=t.data)==null?void 0:g.response)==null?void 0:S.code;if(E>=400&&E<500){t.code=be.MEDIA_ERR_NETWORK,t.data={response:{code:E}},{dialog:n,devlog:r}=ve(t,e,a,o);break}n={title:l("Source Not Supported",i),message:t.message},r.file="media-src-not-supported.md";break}default:n={title:l("Error",i),message:t.message};break}return e&&(n={title:l("Your device appears to be offline",i),message:l("Check your internet connection and try reloading this video.",i)}),{dialog:n,devlog:r}}var pi=Object.values(I),gi=700,fi=300,Fe={LG:"large",SM:"small",XS:"extra-small"};function ye(t){let e=t.getBoundingClientRect();return e.width<fi?Fe.XS:e.width<gi?Fe.SM:Fe.LG}var bi={SRC:"src"},d={ENV_KEY:"env-key",DEBUG:"debug",PLAYBACK_ID:"playback-id",METADATA_URL:"metadata-url",PREFER_MSE:"prefer-mse",PLAYER_SOFTWARE_VERSION:"player-software-version",PLAYER_SOFTWARE_NAME:"player-software-name",METADATA_VIDEO_ID:"metadata-video-id",METADATA_VIDEO_TITLE:"metadata-video-title",METADATA_VIEWER_USER_ID:"metadata-viewer-user-id",BEACON_COLLECTION_DOMAIN:"beacon-collection-domain",CUSTOM_DOMAIN:"custom-domain",TYPE:"type",STREAM_TYPE:"stream-type",START_TIME:"start-time"},m={DEFAULT_HIDDEN_CAPTIONS:"default-hidden-captions",PRIMARY_COLOR:"primary-color",SECONDARY_COLOR:"secondary-color",FORWARD_SEEK_OFFSET:"forward-seek-offset",BACKWARD_SEEK_OFFSET:"backward-seek-offset",PLAYBACK_TOKEN:"playback-token",THUMBNAIL_TOKEN:"thumbnail-token",STORYBOARD_TOKEN:"storyboard-token",THUMBNAIL_TIME:"thumbnail-time",AUDIO:"audio"};function vi(t,e){var a,o;return{src:!t.playbackId&&t.src,poster:t.getAttribute("poster"),thumbnailTime:!t.tokens.thumbnail&&t.thumbnailTime,autoplay:t.autoplay,crossOrigin:t.crossOrigin,loop:t.loop,muted:t.muted,paused:t.paused,playsInline:t.playsInline,preload:t.preload,playbackId:t.playbackId,envKey:t.envKey,debug:t.debug,tokens:t.tokens,beaconCollectionDomain:t.beaconCollectionDomain,metadata:t.metadata,playerSoftwareName:t.playerSoftwareName,playerSoftwareVersion:t.playerSoftwareVersion,startTime:t.startTime,preferMse:t.preferMse,audio:t.audio,streamType:t.streamType,primaryColor:t.primaryColor,secondaryColor:t.secondaryColor,forwardSeekOffset:t.forwardSeekOffset,backwardSeekOffset:t.backwardSeekOffset,defaultHiddenCaptions:t.defaultHiddenCaptions,customDomain:(a=t.getAttribute(d.CUSTOM_DOMAIN))!=null?a:void 0,playerSize:ye((o=t.mediaController)!=null?o:t),hasCaptions:!!Wt(t).length,metadataVideoId:t.getAttribute(d.METADATA_VIDEO_ID),metadataVideoTitle:t.getAttribute(d.METADATA_VIDEO_TITLE),metadataViewerUserId:t.getAttribute(d.METADATA_VIEWER_USER_ID),...e}}var yi=Object.values(d),Ei=Object.values(m),Ti=ue(),ki="mux-player",la={dialog:void 0,isDialogOpen:!1,inLiveWindow:!1},q,ne,_,j,w,re,da,M,Y,G,Ke,se,ma,Te,xi,ke,Ai,xe,Li,Ae,wi,Le,Mi,we,Si,Me,Oi,Se,Ci,Ee=class extends He{constructor(){super();f(this,re);f(this,M);f(this,G);f(this,se);f(this,Te);f(this,ke);f(this,xe);f(this,Ae);f(this,Le);f(this,we);f(this,Me);f(this,Se);f(this,q,!1);f(this,ne,{});f(this,_,!0);f(this,j,void 0);f(this,w,{...la,supportsAirPlay:!1,supportsVolume:!1,onCloseErrorDialog:()=>c(this,M,Y).call(this,{dialog:void 0,isDialogOpen:!1}),onInitFocusDialog:e=>{_e(this,document.activeElement)||e.preventDefault()},onSeekToLive:()=>Ve(this)});this.attachShadow({mode:"open"}),this.isConnected&&c(this,re,da).call(this)}static get observedAttributes(){var e;return[...(e=He.observedAttributes)!=null?e:[],...yi,...Ei]}get theme(){var e,a;return Array.from((a=(e=this.shadowRoot)==null?void 0:e.children)!=null?a:[]).find(({localName:o})=>o.startsWith("media-theme-"))}get mediaController(){var e,a;return(a=(e=this.theme)==null?void 0:e.shadowRoot)==null?void 0:a.querySelector("media-controller")}connectedCallback(){c(this,se,ma).call(this),c(this,Te,xi).call(this)}disconnectedCallback(){c(this,ke,Ai).call(this)}attributeChangedCallback(e,a,o){switch(y(this,q)||c(this,re,da).call(this),super.attributeChangedCallback(e,a,o),[d.PLAYBACK_ID,bi.SRC,m.PLAYBACK_TOKEN].includes(e)&&a!==o&&N(this,w,{...y(this,w),...la}),c(this,G,Ke).call(this,{[zt(e)]:o}),e){case m.THUMBNAIL_TIME:{o!=null&&this.tokens.thumbnail&&L(l("Use of thumbnail-time with thumbnail-token is currently unsupported. Ignore thumbnail-time.").format({}));break}case m.THUMBNAIL_TOKEN:{let{aud:n}=ie(o);o&&n!=="t"&&L(l("The provided thumbnail-token should have audience value 't' instead of '{aud}'.").format({aud:n}));break}case m.STORYBOARD_TOKEN:{let{aud:n}=ie(o);o&&n!=="s"&&L(l("The provided storyboard-token should have audience value 's' instead of '{aud}'.").format({aud:n}));break}case d.PLAYBACK_ID:{o.includes("?token")&&F(l("The specificed playback ID {playbackId} contains a token which must be provided via the playback-token attribute.").format({playbackId:o})),this.streamType?this.streamType!=null&&!pi.includes(this.streamType)&&pe({file:"invalid-stream-type.md",message:l("Invalid stream-type value supplied: `{streamType}`. Please provide stream-type as either: `on-demand`, `live` or `ll-live`").format({streamType:this.streamType})}):pe({file:"invalid-stream-type.md",message:String(l("No stream-type value supplied. Defaulting to `on-demand`. Please provide stream-type as either: `on-demand`, `live` or `ll-live`"))});break}}}get hasPlayed(){var e,a;return(a=(e=this.mediaController)==null?void 0:e.hasAttribute("media-has-played"))!=null?a:!1}get inLiveWindow(){return y(this,w).inLiveWindow}get hls(){return L("<mux-player>.hls is deprecated, please use ._hls instead"),this._hls}get _hls(){var e;return(e=this.media)==null?void 0:e._hls}get mux(){var e;return(e=this.media)==null?void 0:e.mux}get audio(){return this.hasAttribute(m.AUDIO)}set audio(e){e||this.removeAttribute(m.AUDIO),this.setAttribute(m.AUDIO,"")}get thumbnailTime(){return ae(this.getAttribute(m.THUMBNAIL_TIME))}set thumbnailTime(e){this.setAttribute(m.THUMBNAIL_TIME,`${e}`)}get primaryColor(){var e;return(e=this.getAttribute(m.PRIMARY_COLOR))!=null?e:void 0}set primaryColor(e){this.setAttribute(m.PRIMARY_COLOR,`${e}`)}get secondaryColor(){var e;return(e=this.getAttribute(m.SECONDARY_COLOR))!=null?e:void 0}set secondaryColor(e){this.setAttribute(m.SECONDARY_COLOR,`${e}`)}get forwardSeekOffset(){var e;return(e=ae(this.getAttribute(m.FORWARD_SEEK_OFFSET)))!=null?e:10}set forwardSeekOffset(e){this.setAttribute(m.FORWARD_SEEK_OFFSET,`${e}`)}get backwardSeekOffset(){var e;return(e=ae(this.getAttribute(m.BACKWARD_SEEK_OFFSET)))!=null?e:10}set backwardSeekOffset(e){this.setAttribute(m.BACKWARD_SEEK_OFFSET,`${e}`)}get defaultHiddenCaptions(){return this.hasAttribute(m.DEFAULT_HIDDEN_CAPTIONS)}get playerSoftwareName(){var e;return(e=this.getAttribute(d.PLAYER_SOFTWARE_NAME))!=null?e:ki}get playerSoftwareVersion(){var e;return(e=this.getAttribute(d.PLAYER_SOFTWARE_VERSION))!=null?e:Ti}get beaconCollectionDomain(){var e;return(e=this.getAttribute(d.BEACON_COLLECTION_DOMAIN))!=null?e:void 0}set beaconCollectionDomain(e){e!==this.beaconCollectionDomain&&(e?this.setAttribute(d.BEACON_COLLECTION_DOMAIN,e):this.removeAttribute(d.BEACON_COLLECTION_DOMAIN))}get playbackId(){var e;return(e=this.getAttribute(d.PLAYBACK_ID))!=null?e:void 0}set playbackId(e){this.setAttribute(d.PLAYBACK_ID,`${e}`)}get customDomain(){var e;return(e=this.getAttribute(d.CUSTOM_DOMAIN))!=null?e:void 0}set customDomain(e){e!==this.customDomain&&(e?this.setAttribute(d.CUSTOM_DOMAIN,e):this.removeAttribute(d.CUSTOM_DOMAIN))}get envKey(){var e;return(e=oe(this,d.ENV_KEY))!=null?e:void 0}set envKey(e){this.setAttribute(d.ENV_KEY,`${e}`)}get debug(){return oe(this,d.DEBUG)!=null}set debug(e){e?this.setAttribute(d.DEBUG,""):this.removeAttribute(d.DEBUG)}get streamType(){return oe(this,d.STREAM_TYPE)}set streamType(e){this.setAttribute(d.STREAM_TYPE,`${e}`)}get startTime(){return ae(oe(this,d.START_TIME))}set startTime(e){this.setAttribute(d.START_TIME,`${e}`)}get preferMse(){return oe(this,d.PREFER_MSE)!=null}set preferMse(e){e?this.setAttribute(d.PREFER_MSE,""):this.removeAttribute(d.PREFER_MSE)}get metadata(){var e;return(e=this.media)==null?void 0:e.metadata}set metadata(e){this.media&&(this.media.metadata=e)}get tokens(){let e=this.getAttribute(m.PLAYBACK_TOKEN),a=this.getAttribute(m.THUMBNAIL_TOKEN),o=this.getAttribute(m.STORYBOARD_TOKEN);return{...y(this,ne),...e!=null?{playback:e}:{},...a!=null?{thumbnail:a}:{},...o!=null?{storyboard:o}:{}}}set tokens(e){N(this,ne,e!=null?e:{})}get playbackToken(){var e;return(e=this.getAttribute(m.PLAYBACK_TOKEN))!=null?e:void 0}set playbackToken(e){this.setAttribute(m.PLAYBACK_TOKEN,`${e}`)}get thumbnailToken(){var e;return(e=this.getAttribute(m.THUMBNAIL_TOKEN))!=null?e:void 0}set thumbnailToken(e){this.setAttribute(m.THUMBNAIL_TOKEN,`${e}`)}get storyboardToken(){var e;return(e=this.getAttribute(m.STORYBOARD_TOKEN))!=null?e:void 0}set storyboardToken(e){this.setAttribute(m.STORYBOARD_TOKEN,`${e}`)}};q=new WeakMap,ne=new WeakMap,_=new WeakMap,j=new WeakMap,w=new WeakMap,re=new WeakSet,da=function(){var e,a;y(this,q)||(N(this,q,!0),c(this,M,Y).call(this,{playerSize:ye(this)}),customElements.upgrade(this.theme),this.theme instanceof Vt||F("<media-theme-mux> failed to upgrade!"),customElements.upgrade(this.media),this.media instanceof hi||F("<mux-video> failed to upgrade!"),customElements.upgrade(this.mediaController),this.mediaController instanceof ui||F("<media-controller> failed to upgrade!"),Qt(this),c(this,Ae,wi).call(this),c(this,Le,Mi).call(this),c(this,Me,Oi).call(this),c(this,Se,Ci).call(this),c(this,xe,Li).call(this),N(this,_,(a=(e=this.mediaController)==null?void 0:e.hasAttribute("user-inactive"))!=null?a:!0),c(this,we,Si).call(this))},M=new WeakSet,Y=function(e){Object.assign(y(this,w),e),c(this,G,Ke).call(this)},G=new WeakSet,Ke=function(e={}){ee(sa(vi(this,{...y(this,w),...e})),this.shadowRoot)},se=new WeakSet,ma=function(){var e,a;y(this,w).playerSize!=ye((e=this.mediaController)!=null?e:this)&&c(this,M,Y).call(this,{playerSize:ye((a=this.mediaController)!=null?a:this)})},Te=new WeakSet,xi=function(){var e;N(this,j,new ResizeObserver(()=>c(this,se,ma).call(this))),y(this,j).observe((e=this.mediaController)!=null?e:this)},ke=new WeakSet,Ai=function(){var e;(e=y(this,j))==null||e.disconnect()},xe=new WeakSet,Li=function(){var a,o,i,n,r;(a=this.mediaController)==null||a.addEventListener("mediaplayrequest",u=>{var g;((g=u.target)==null?void 0:g.localName)==="media-play-button"&&this.streamType&&[I.LIVE,I.LL_LIVE,I.DVR,I.LL_DVR].includes(this.streamType)&&this.hasPlayed&&Ve(this)});let e=()=>{let u=Xt(this),g=y(this,w).inLiveWindow;u!==g&&(c(this,M,Y).call(this,{inLiveWindow:u}),this.dispatchEvent(new CustomEvent("inlivewindowchange",{composed:!0,bubbles:!0,detail:this.inLiveWindow})))};(o=this.media)==null||o.addEventListener("progress",e),(i=this.media)==null||i.addEventListener("waiting",e),(n=this.media)==null||n.addEventListener("timeupdate",e),(r=this.media)==null||r.addEventListener("emptied",e)},Ae=new WeakSet,wi=function(){var a;let e=o=>{let{detail:i}=o;if(i instanceof Be||(i=new Be(i.message,i.code,i.fatal)),!(i==null?void 0:i.fatal)){L(i),i.data&&L(`${i.name} data:`,i.data);return}let{dialog:n,devlog:r}=ve(i,!window.navigator.onLine,this.playbackId,this.playbackToken);r.message&&pe(r),F(i),i.data&&F(`${i.name} data:`,i.data),c(this,M,Y).call(this,{isDialogOpen:!0,dialog:n})};this.addEventListener("error",e),this.media&&(this.media.errorTranslator=(o={})=>{var n,r,u;if(!((n=this.media)==null?void 0:n.error))return o;let{devlog:i}=ve((r=this.media)==null?void 0:r.error,!window.navigator.onLine,this.playbackId,this.playbackToken,!1);return{player_error_code:(u=this.media)==null?void 0:u.error.code,player_error_message:i.message?String(i.message):o.player_error_message}}),(a=this.media)==null||a.addEventListener("error",o=>{var n,r;let{detail:i}=o;if(!i){let{message:u,code:g}=(r=(n=this.media)==null?void 0:n.error)!=null?r:{};i=new Be(u,g)}!(i==null?void 0:i.fatal)||this.dispatchEvent(new CustomEvent("error",{detail:i}))})},Le=new WeakSet,Mi=function(){var a,o,i,n;let e=()=>c(this,G,Ke).call(this);(o=(a=this.media)==null?void 0:a.textTracks)==null||o.addEventListener("addtrack",e),(n=(i=this.media)==null?void 0:i.textTracks)==null||n.addEventListener("removetrack",e)},we=new WeakSet,Si=function(){var E,$;let e=this.mediaController,a=/.*Version\/.*Safari\/.*/.test(navigator.userAgent);if(/.*iPhone.*/.test(navigator.userAgent))return;let i,n=new WeakMap,r=()=>this.streamType&&[I.LIVE,I.LL_LIVE].includes(this.streamType)&&!this.secondaryColor&&this.offsetWidth>=800,u=(v,O)=>{if(r())return;Array.from(v&&v.activeCues||[]).forEach(p=>{if(!(!p.snapToLines||p.line<-5||p.line>=0&&p.line<10))if(!O||this.paused){let D=p.text.split(`
709
+ `).length,X=a?-2:-3;this.streamType&&[I.LIVE,I.LL_LIVE].includes(this.streamType)&&(X=a?-1:-2);let J=X-D;if(p.line===J)return;n.has(p)||n.set(p,p.line),p.line=0,p.line=J}else setTimeout(()=>{p.line=n.get(p)||"auto"},500)})},g=()=>{var v;u(i,(v=e==null?void 0:e.hasAttribute("user-inactive"))!=null?v:!1)},S=()=>{var R;let O=Array.from(((R=e==null?void 0:e.media)==null?void 0:R.textTracks)||[]).filter(p=>["subtitles","captions"].includes(p.kind)&&p.mode==="showing")[0];O!==i&&(i==null||i.removeEventListener("cuechange",g)),i=O,i==null||i.addEventListener("cuechange",g),u(i,y(this,_))};S(),(E=e==null?void 0:e.media)==null||E.textTracks.addEventListener("change",S),($=e==null?void 0:e.media)==null||$.textTracks.addEventListener("addtrack",S),e==null||e.addEventListener("userinactivechange",()=>{let v=e==null?void 0:e.hasAttribute("user-inactive");y(this,_)!==v&&(N(this,_,v),u(i,y(this,_)))})},Me=new WeakSet,Oi=function(){var e;if(globalThis.WebKitPlaybackTargetAvailabilityEvent){let a=o=>{let i=o.availability==="available";c(this,M,Y).call(this,{supportsAirPlay:i})};(e=this.media)==null||e.addEventListener("webkitplaybacktargetavailabilitychanged",a)}},Se=new WeakSet,Ci=async function(){let e=await Zt();c(this,M,Y).call(this,{supportsVolume:e})};function oe(t,e){return t.media?t.media.getAttribute(e):t.getAttribute(e)}globalThis.customElements.get("mux-player")||(globalThis.customElements.define("mux-player",Ee),globalThis.MuxPlayerElement=Ee);var mn=Ee;export{Be as MediaError,mn as default,oe as getVideoAttribute};