@srgssr/share-button 0.1.0

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.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 SRG SSR
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,242 @@
1
+ # Pillarbox Web: Share Button
2
+
3
+ The Share Button adds a share toggle on the top-right corner of a video.js player. Clicking it
4
+ opens a share modal anchored to the same corner, from which the user can share the media on
5
+ social networks, by email, or copy the link and the embed code.
6
+
7
+ ## Requirements
8
+
9
+ To use this component, you need the following installed on your system:
10
+
11
+ - Node.js
12
+
13
+ ## Quick Start
14
+
15
+ To get started with this component, install it through the following command:
16
+
17
+ ```bash
18
+ npm install --save video.js @srgssr/share-button
19
+ ```
20
+
21
+ Once the player is installed you can activate the component as follows:
22
+
23
+ ```javascript
24
+ import videojs from 'video.js';
25
+ import '@srgssr/share-button';
26
+
27
+ const player = videojs('my-player', {
28
+ shareToggle: true,
29
+ shareModal: true
30
+ });
31
+ ```
32
+
33
+ To apply the default styling, add the following line to your CSS file:
34
+
35
+ ```css
36
+ @import "@srgssr/share-button/dist/share-button.min.css";
37
+ ```
38
+
39
+ > [!TIP]
40
+ > The `ShareModal` must be added to the player by the integrator, the `ShareToggle` only opens it.
41
+ > This lets you open the modal from anywhere else, e.g. `player.getChild('ShareModal').open()`.
42
+
43
+ ## API Documentation
44
+
45
+ The component adds 2 new components to the player:
46
+
47
+ - `ShareToggle`: the button that opens the modal. It extends the shared
48
+ [`SvgButton`][svg-button-api] component, all `SvgButton` options are supported as well as the
49
+ following defaults:
50
+
51
+ | Option | Type | Default |
52
+ |---------------|----------|-----------|
53
+ | `controlText` | `string` | `'Share'` |
54
+ | `iconName` | `string` | `'share'` |
55
+
56
+ - [`ShareModal`][share-modal]: a custom dialog that extends the `ModalDialog` class. It can take any
57
+ modal dialog options available in video.js ([See Video.js ModalDialog Documentation][videojs-modal-doc])
58
+ as well as the following options:
59
+
60
+ | Option | Type | Default | Description |
61
+ |-------------------------|----------|-----------|--------------------------------------------------------------------------------------------|
62
+ | `title` | `string` | `'Share'` | The title displayed at the top of the modal, localized in the player language. |
63
+ | `shareUrlOptions` | `Object` | `{}` | Configuration for the [`ShareUrlOptions`](#share-url-options) child component. |
64
+ | `shareButtonCollection` | `Object` | `{}` | Configuration for the [`ShareButtonCollection`](#share-button-collection) child component. |
65
+
66
+ ### Share URL Options
67
+
68
+ The [`ShareUrlOptions`][share-url-options] component is a radio group selecting which URL is
69
+ shared. The selected option generates the media URL that each share button wraps for its own
70
+ platform.
71
+
72
+ | Option | Type | Default | Description |
73
+ |----------------------|--------------------|-----------------------------------------------------|--------------------------------------------------------------------------------------------------------|
74
+ | `url` | `string\|function` | `window.location.href` | The base URL used to generate the shared URL. Functions receive `(player, component, context)`. |
75
+ | `includeCurrentTime` | `boolean` | `false` | Enables the option sharing the media at the current position, adding a `startTime` parameter. |
76
+ | `defaultOption` | `string` | `'currentTime'` when enabled, `'episode'` otherwise | The initially selected option. Disabled options are never selected by default. |
77
+ | `options` | `Object` | `episode` and `currentTime` | The available options, each one declaring a `label`, a `title` and a `generateUrl(player, component)`. |
78
+
79
+ Set an entry of `options` to `false` to remove it. An entry may also declare
80
+ `isHidden(player, component)` to leave the option out of the group entirely, and
81
+ `isDisabled(player, component)` — or a static `disabled` boolean — to render it as a disabled radio.
82
+ Both are re-evaluated on `timeupdate`, and the group falls back to the default option when the
83
+ selected one becomes disabled.
84
+
85
+ When `url` is a function, the `context` argument exposes available media information without
86
+ imposing any application-specific URL format:
87
+
88
+ | Context property | Description |
89
+ |----------------------|----------------------------------------------------------------------------------|
90
+ | `currentSource` | Result of `player.currentSource()` when available. |
91
+ | `mediaData` | `currentSource.mediaData` when available. |
92
+ | `mainChapter` | Result of `mediaComposition.getMainChapter()` when available. |
93
+ | `currentMedia` | `mainChapter`, falling back to `mediaData`. |
94
+ | `subdivisions` | Result of `mediaComposition.getSubdivisions()` when available. |
95
+ | `currentSubdivision` | Current non-blocked subdivision matching `player.currentTime()`, when available. |
96
+ | `currentTime` | Result of `player.currentTime()`. |
97
+ | `title` | Title of `currentMedia` when available. |
98
+
99
+ ### Share Button Collection
100
+
101
+ The [`ShareButtonCollection`][share-button-collection] component contains the platform buttons as
102
+ its children:
103
+
104
+ | Button | Default `label` | Default `title` |
105
+ |-----------------------|-----------------|-----------------------|
106
+ | `facebookShareButton` | `'Facebook'` | `'Share on Facebook'` |
107
+ | `xShareButton` | `'X'` | `'Share on X'` |
108
+ | `linkedinShareButton` | `'LinkedIn'` | `'Share on LinkedIn'` |
109
+ | `whatsappShareButton` | `'WhatsApp'` | `'Share on WhatsApp'` |
110
+ | `emailShareButton` | `'E-mail'` | `'Share by email'` |
111
+ | `copyLinkShareButton` | `'Copy link'` | `'Copy link'` |
112
+ | `embedShareButton` | `'Embed'` | `'Embed'` |
113
+
114
+ You can define the order of the buttons, remove buttons you don't need, or add new ones.
115
+ [See Video.js Component Children Documentation][videojs-children-doc]. The collection also accepts
116
+ the following option:
117
+
118
+ | Option | Type | Default | Description |
119
+ |-------------|--------------------------------------|------------------|----------------------------------------------------------------------------------|
120
+ | `shareText` | `string \| function(player, button)` | `document.title` | The text shared alongside the URL by every button, unless overridden per button. |
121
+
122
+ ### Share Button
123
+
124
+ Each button extends the shared [`SvgComponent`][svg-component-api] component. All `SvgComponent`
125
+ options are supported as well as the following options:
126
+
127
+ | Option | Type | Default | Description |
128
+ |------------------|---------------------------------------|-------------------------|-------------------------------------------------------------------------------|
129
+ | `label` | `string` | Platform label | The visible label displayed below the icon, localized in the player language. |
130
+ | `title` | `string` | Platform title | The accessible title of the link, localized in the player language. |
131
+ | `buildUrl` | `function(url, text, player, button)` | Platform URL | Builds the platform URL from the generated media URL and the share text. |
132
+ | `shareText` | `string \| function(player, button)` | `undefined` | Overrides the collection `shareText` for this button. |
133
+ | `target` | `string` | `'_blank'` | The `target` attribute of the link. |
134
+ | `rel` | `string` | `'noopener noreferrer'` | The `rel` attribute of the link. |
135
+ | `buildEmbedCode` | `function(url, player, button)` | An `iframe` snippet | `EmbedShareButton` only, builds the embed code copied to the clipboard. |
136
+
137
+ To add a button that does not exist in the package, create a component extending
138
+ [`ShareButton`][share-button], register it, then include it in the collection `children`.
139
+
140
+ ### Events
141
+
142
+ The following event is emitted by the share buttons:
143
+
144
+ | Event | Description |
145
+ |---------|--------------------------------------------------------------------------------------------------|
146
+ | `share` | Triggered when a share button is activated. The event bubbles up to the modal and to the player. |
147
+
148
+ ### Usage Example
149
+
150
+ ```javascript
151
+ import videojs from 'video.js';
152
+ import { ShareButton } from '@srgssr/share-button';
153
+
154
+ // Add a custom share button
155
+ class CustomShareButton extends ShareButton {}
156
+
157
+ CustomShareButton.prototype.options_ = videojs.obj.merge(ShareButton.prototype.options_, {
158
+ className: 'vjs-share-button-custom',
159
+ label: 'Custom',
160
+ title: 'Share on Custom',
161
+ icon: '<svg>...</svg>',
162
+ buildUrl: url => `https://custom.example/share?u=${encodeURIComponent(url)}`
163
+ });
164
+
165
+ videojs.registerComponent('CustomShareButton', CustomShareButton);
166
+
167
+ const player = videojs('my-player', {
168
+ // Customize the look of the share button
169
+ shareToggle: { iconName: 'square' },
170
+ // Change the modal options
171
+ shareModal: {
172
+ // Force the playback to pause when the modal is opened
173
+ pauseOnOpen: true,
174
+ shareUrlOptions: {
175
+ // Let the user share the media at the current position
176
+ includeCurrentTime: true
177
+ },
178
+ shareButtonCollection: {
179
+ // Share a custom text instead of the page title
180
+ shareText: player => `Watch ${player.currentSrc()}`,
181
+ // Remove the X button
182
+ xShareButton: false,
183
+ // Customize the Facebook button
184
+ facebookShareButton: { title: 'Share this video on Facebook' },
185
+ // Add the custom button
186
+ customShareButton: true
187
+ }
188
+ }
189
+ });
190
+
191
+ // React to share actions
192
+ player.on('share', ({ target }) => console.log('Shared through', target.className));
193
+ ```
194
+
195
+ ## Contributing
196
+
197
+ For detailed contribution guidelines, refer to our [Contributing guide][contributing-guide].
198
+ Please adhere to the specified guidelines.
199
+
200
+ ### Setting up a development server
201
+
202
+ Start the development server:
203
+
204
+ ```bash
205
+ npm run start
206
+ ```
207
+
208
+ This will start the server on `http://localhost:4200`. Open this URL in your browser to view the
209
+ demo page.
210
+
211
+ The video player (`player`) and the Pillarbox library (`pillarbox`) are exposed on the `window`
212
+ object, making it easy to access and manipulate from the browser's developer console for debugging.
213
+
214
+ #### Available URL parameters
215
+
216
+ The demo page supports several URL parameters that modify the behavior of the video player:
217
+
218
+ - `debug`: Set this to enable debugging mode.
219
+ - `ilHost`: Specifies the host for the data provider.
220
+ - `language`: Sets the language for the player interface.
221
+ - `urn`: Specifies the URN of the video to load. Default is `urn:rts:video:8841634`.
222
+
223
+ You can combine parameters in the URL like so:
224
+
225
+ ```plaintext
226
+ http://localhost:4200/?language=fr&urn=urn:rts:video:14318206
227
+ ```
228
+
229
+ ## Licensing
230
+
231
+ This project is licensed under the MIT License. See the [LICENSE](./LICENSE) file for more
232
+ details.
233
+
234
+ [contributing-guide]: https://github.com/SRGSSR/pillarbox-web-suite/blob/main/docs/README.md#contributing
235
+ [svg-button-api]: ../svg-button/README.md#api-documentation
236
+ [svg-component-api]: ../svg-button/README.md#api-documentation
237
+ [videojs-modal-doc]: https://docs.videojs.com/tutorial-modal-dialog.html
238
+ [videojs-children-doc]: https://videojs.com/guides/components/#component-children
239
+ [share-modal]: ./src/share-modal.js
240
+ [share-url-options]: ./src/share-url-options.js
241
+ [share-button-collection]: ./src/share-button-collection.js
242
+ [share-button]: ./src/share-button.js
@@ -0,0 +1,21 @@
1
+ {
2
+ "Share": "Teilen",
3
+ "Sharing type": "Art des Teilens",
4
+ "Close": "Schliessen",
5
+ "Share episode": "Episode teilen",
6
+ "Episode": "Episode",
7
+ "Share the current position": "Aktuelle Position teilen",
8
+ "Current position": "Aktuelle Position",
9
+ "Share on Facebook": "Auf Facebook teilen",
10
+ "Share on X": "Auf X teilen",
11
+ "Share on LinkedIn": "Auf LinkedIn teilen",
12
+ "Share on WhatsApp": "Auf WhatsApp teilen",
13
+ "Share by email": "Per E-Mail teilen",
14
+ "Copy link": "Link kopieren",
15
+ "Embed": "Einbetten",
16
+ "Facebook": "Facebook",
17
+ "X": "X",
18
+ "LinkedIn": "LinkedIn",
19
+ "WhatsApp": "WhatsApp",
20
+ "E-mail": "E-Mail"
21
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "Share": "Share",
3
+ "Sharing type": "Sharing type",
4
+ "Close": "Close",
5
+ "Share episode": "Share episode",
6
+ "Episode": "Episode",
7
+ "Share the current position": "Share the current position",
8
+ "Current position": "Current position",
9
+ "Share on Facebook": "Share on Facebook",
10
+ "Share on X": "Share on X",
11
+ "Share on LinkedIn": "Share on LinkedIn",
12
+ "Share on WhatsApp": "Share on WhatsApp",
13
+ "Share by email": "Share by email",
14
+ "Copy link": "Copy link",
15
+ "Embed": "Embed",
16
+ "Facebook": "Facebook",
17
+ "X": "X",
18
+ "LinkedIn": "LinkedIn",
19
+ "WhatsApp": "WhatsApp",
20
+ "E-mail": "E-mail"
21
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "Share": "Partager",
3
+ "Sharing type": "Type de partage",
4
+ "Close": "Fermer",
5
+ "Share episode": "Partager l'épisode",
6
+ "Episode": "Épisode",
7
+ "Share the current position": "Partager la position courante",
8
+ "Current position": "Position courante",
9
+ "Share on Facebook": "Partager sur Facebook",
10
+ "Share on X": "Partager sur X",
11
+ "Share on LinkedIn": "Partager sur Linkedin",
12
+ "Share on WhatsApp": "Partager sur Whatsapp",
13
+ "Share by email": "Partager par e-mail",
14
+ "Copy link": "Copier le lien",
15
+ "Embed": "Embed",
16
+ "Facebook": "Facebook",
17
+ "X": "X",
18
+ "LinkedIn": "LinkedIn",
19
+ "WhatsApp": "WhatsApp",
20
+ "E-mail": "E-mail"
21
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "Share": "Condividi",
3
+ "Sharing type": "Tipo di condivisione",
4
+ "Close": "Chiudi",
5
+ "Share episode": "Condividi l'episodio",
6
+ "Episode": "Episodio",
7
+ "Share the current position": "Condividi la posizione corrente",
8
+ "Current position": "Posizione corrente",
9
+ "Share on Facebook": "Condividi su Facebook",
10
+ "Share on X": "Condividi su X",
11
+ "Share on LinkedIn": "Condividi su LinkedIn",
12
+ "Share on WhatsApp": "Condividi su WhatsApp",
13
+ "Share by email": "Condividi via e-mail",
14
+ "Copy link": "Copia il link",
15
+ "Embed": "Incorpora",
16
+ "Facebook": "Facebook",
17
+ "X": "X",
18
+ "LinkedIn": "LinkedIn",
19
+ "WhatsApp": "WhatsApp",
20
+ "E-mail": "E-mail"
21
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "Share": "Cundivider",
3
+ "Sharing type": "Tip da cundivider",
4
+ "Close": "Serrar",
5
+ "Share episode": "Cundivider l'episoda",
6
+ "Episode": "Episoda",
7
+ "Share the current position": "Cundivider la posiziun actuala",
8
+ "Current position": "Posiziun actuala",
9
+ "Share on Facebook": "Cundivider sin Facebook",
10
+ "Share on X": "Cundivider sin X",
11
+ "Share on LinkedIn": "Cundivider sin LinkedIn",
12
+ "Share on WhatsApp": "Cundivider sin WhatsApp",
13
+ "Share by email": "Cundivider per e-mail",
14
+ "Copy link": "Copiar il link",
15
+ "Embed": "Integrar",
16
+ "Facebook": "Facebook",
17
+ "X": "X",
18
+ "LinkedIn": "LinkedIn",
19
+ "WhatsApp": "WhatsApp",
20
+ "E-mail": "E-mail"
21
+ }
@@ -0,0 +1,24 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,s)=>(s=n==null?{}:e(i(n)),o(r||!n||!n.__esModule||!a.call(n,`default`)?t(s,`default`,{value:n,enumerable:!0}):s,n));let c=require("video.js");c=s(c,1);function l(e,t){this.v=e,this.k=t}function u(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function d(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){u(a,r,i,o,s,`next`,e)}function s(e){u(a,r,i,o,s,`throw`,e)}o(void 0)})}}function f(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof l;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`?`return`:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(a.done?`return`:`normal`,n)},function(e){r(`throw`,e)})}catch(e){i(`throw`,e)}}function i(e,i){switch(e){case`return`:t.resolve({value:i,done:!0});break;case`throw`:t.reject(i);break;default:t.resolve({value:i,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}f.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},f.prototype.next=function(e){return this._invoke(`next`,e)},f.prototype.throw=function(e){return this._invoke(`throw`,e)},f.prototype.return=function(e){return this._invoke(`return`,e)};function p(e){let t=new DOMParser().parseFromString(e,`image/svg+xml`).documentElement;if(!(t instanceof SVGElement))throw Error(`Parsed root is not an SVGElement`);return t}function m(e){return h.apply(this,arguments)}function h(){return h=d(function*(e){let t=yield fetch(e,{mode:`cors`});if(!t.ok)throw Error(`Failed to fetch SVG: ${t.status} ${t.statusText}`);return p(yield t.text())}),h.apply(this,arguments)}function g(e){return _.apply(this,arguments)}function _(){return _=d(function*(e){let t=e.trim(),n=URL.parse(t);if(n)return yield m(n.href);if(t.startsWith(`<`))return p(t);throw Error(`Provided string is not a URL or an SVG element: ${e}`)}),_.apply(this,arguments)}function ee(e){return v.apply(this,arguments)}function v(){return v=d(function*(e){if(e instanceof SVGElement)return e;if(e instanceof URL)return yield m(e.href);if(typeof e==`string`)return yield g(e);throw Error(`Invalid icon type provided: ${e}`)}),v.apply(this,arguments)}function te(e,t){this.v=e,this.k=t}function y(e,t,n,r,i,a,o){try{var s=e[a](o),c=s.value}catch(e){n(e);return}s.done?t(c):Promise.resolve(c).then(r,i)}function b(e){return function(){var t=this,n=arguments;return new Promise(function(r,i){var a=e.apply(t,n);function o(e){y(a,r,i,o,s,`next`,e)}function s(e){y(a,r,i,o,s,`throw`,e)}o(void 0)})}}function x(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof te;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`?`return`:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(a.done?`return`:`normal`,n)},function(e){r(`throw`,e)})}catch(e){i(`throw`,e)}}function i(e,i){switch(e){case`return`:t.resolve({value:i,done:!0});break;case`throw`:t.reject(i);break;default:t.resolve({value:i,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}x.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},x.prototype.next=function(e){return this._invoke(`next`,e)},x.prototype.throw=function(e){return this._invoke(`throw`,e)},x.prototype.return=function(e){return this._invoke(`return`,e)};var S=`1.1.3`;function C(e){return w.apply(this,arguments)}function w(){return w=b(function*(e){let{icon:t,iconName:n}=e.options();n&&e.setIcon(n);let r=e.el().querySelector(`.vjs-icon-placeholder`);n&&r&&r.classList.toggle(`vjs-icon-${n}`,!0),yield ne(t,r)}),w.apply(this,arguments)}function ne(e,t){return T.apply(this,arguments)}function T(){return T=b(function*(e,t){if(!e||!t)return;let n=yield ee(e);n.classList.add(`icon-from-options`),t.classList.add(`vjs-svg-icon`),t.replaceChildren(n)}),T.apply(this,arguments)}var re=c.default.log.createLogger(`svg-button`),E=c.default.getComponent(`Button`),ie=class extends E{constructor(e,t){super(e,t),this.appendIcon().catch(e=>re.error(`There was a problem loading the provided SVG Icon`,e))}appendIcon(){var e=this;return b(function*(t=void 0){if(t){let{icon:n,iconName:r}=t;e.options({icon:n,iconName:r})}yield C(e)}).apply(this,arguments)}buildCSSClass(){return`vjs-svg-button ${super.buildCSSClass()}`}static get VERSION(){return S}};c.default.registerComponent(`SvgButton`,ie);var ae=c.default.log.createLogger(`svg-component`),oe=c.default.getComponent(`Component`),se=class extends oe{constructor(e,t){super(e,t),this.appendIcon().catch(e=>ae.error(`There was a problem loading the provided SVG Icon`,e))}appendIcon(){var e=this;return b(function*(t=void 0){if(t){let{icon:n,iconName:r}=t;e.options({icon:n,iconName:r})}yield C(e)}).apply(this,arguments)}createEl(e,t={},n={}){t=Object.assign({className:this.buildCSSClass()},t);let r=super.createEl(e,t,n);return this.player_.options_.experimentalSvgIcons||r.appendChild(c.default.dom.createEl(`span`,{className:`vjs-icon-placeholder`},{"aria-hidden":!0})),r}buildCSSClass(){return`vjs-svg-component ${super.buildCSSClass()}`}static get VERSION(){return S}};c.default.registerComponent(`SvgComponent`,se);var ce=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
2
+ <path d="M5.91929 7.72199C6.2117 7.42625 6.68666 7.42625 6.97907 7.72199C7.27116 8.01767 7.27116 8.49717 6.97907 8.79285L3.80752 11.9995L6.97907 15.2072C7.27116 15.5028 7.27116 15.9823 6.97907 16.278C6.68666 16.5738 6.2117 16.5738 5.91929 16.278L2.21931 12.5359C1.9269 12.2402 1.9269 11.7598 2.21931 11.4641L5.91929 7.72199ZM17.0212 7.72199C17.3136 7.4263 17.7876 7.42628 18.08 7.72199L21.7809 11.4651C22.0729 11.7608 22.0732 12.2403 21.7809 12.5359L18.08 16.278C17.7876 16.5738 17.3136 16.5738 17.0212 16.278C16.7288 15.9823 16.7288 15.5029 17.0212 15.2072L20.1918 11.9995L17.0212 8.79285C16.7288 8.49711 16.7288 8.01772 17.0212 7.72199ZM13.1808 7.9192C13.3657 7.54512 13.8151 7.39297 14.185 7.58C14.5549 7.76704 14.7044 8.22254 14.5194 8.59662L10.8194 16.0818C10.6345 16.4555 10.1849 16.6067 9.81524 16.42C9.44548 16.233 9.29518 15.7784 9.47985 15.4044L13.1808 7.9192Z" fill="currentColor"/>
3
+ </svg>
4
+ `,le=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
5
+ <path d="M11.9998 2C6.47711 2 2 6.49365 2 12.0367C2 16.7436 5.22874 20.6932 9.58425 21.778V15.104H7.52229V12.0367H9.58425V10.7151C9.58425 7.29899 11.1246 5.7156 14.4662 5.7156C15.0997 5.7156 16.1929 5.84046 16.6401 5.96491V8.74509C16.4041 8.7202 15.9941 8.70775 15.4849 8.70775C13.8454 8.70775 13.2118 9.33123 13.2118 10.952V12.0367H16.4781L15.9169 15.104H13.2118V22C18.1633 21.3998 22 17.1683 22 12.0367C21.9996 6.49365 17.5225 2 11.9998 2Z" fill="currentColor"/>
6
+ </svg>
7
+ `,D=`<svg xmlns="http://www.w3.org/2000/svg" width="20" height="16" viewBox="0 0 20 16" fill="none">
8
+ <path d="M0 11.1868C0 9.93044 0.454022 8.71396 1.27952 7.80719L5.1937 3.50612C5.97826 2.64245 7.04411 2.1225 8.18285 2.07243C9.32194 2.02234 10.4248 2.44794 11.2731 3.24311C12.1194 4.03644 12.6508 5.13866 12.7785 6.32406C12.9062 7.50926 12.6237 8.70981 11.9762 9.6878C11.7452 10.0368 11.277 10.131 10.9304 9.89841C10.5839 9.66575 10.4902 9.1943 10.7213 8.84538C11.1667 8.17245 11.3697 7.3301 11.279 6.4882C11.1884 5.64639 10.8133 4.88638 10.246 4.35447C9.68055 3.82442 8.96667 3.55859 8.24864 3.59016C7.53029 3.62176 6.83545 3.95007 6.30726 4.53145H6.30628L2.39112 8.83253V8.83352C1.83239 9.44735 1.50832 10.2928 1.50832 11.1868C1.50833 12.0808 1.83238 12.9262 2.39112 13.54C2.948 14.1516 3.68867 14.4813 4.44543 14.4813C5.20216 14.4813 5.94286 14.1516 6.49973 13.54L7.26371 12.7005C7.5451 12.3915 8.02213 12.3709 8.32916 12.6541C8.63609 12.9374 8.65748 13.4177 8.3763 13.7269L7.61133 14.5663C6.78375 15.4753 5.6466 16 4.44543 16C3.24424 16 2.10711 15.4753 1.27952 14.5663C0.45401 13.6595 6.74243e-06 12.4431 0 11.1868ZM18.4917 4.47608C18.4916 3.69176 18.1823 2.93947 17.6315 2.38487C17.0807 1.83027 16.3335 1.51878 15.5546 1.51872C14.7757 1.51872 14.0285 1.83036 13.4777 2.38487L12.862 3.00482C12.5675 3.30107 12.09 3.30112 11.7956 3.00482C11.5011 2.70835 11.5013 2.2276 11.7956 1.93103L12.4113 1.31109C13.245 0.471754 14.3756 0 15.5546 0C16.7336 5.7788e-05 17.8642 0.47167 18.6979 1.31109C19.5316 2.1505 19.9999 3.28897 20 4.47608C20 5.66317 19.5315 6.80163 18.6979 7.64108L14.7827 11.5842L14.7818 11.5832C13.9911 12.3804 12.9313 12.8485 11.8132 12.8933C10.6952 12.938 9.60145 12.557 8.75043 11.8255C7.89928 11.0938 7.35289 10.0653 7.22149 8.94624C7.09016 7.82725 7.38328 6.69946 8.04144 5.78816C8.28642 5.44902 8.75826 5.37442 9.09511 5.62106C9.43162 5.86774 9.50579 6.34195 9.26106 6.681C8.82617 7.28316 8.63317 8.02887 8.71999 8.76826C8.80684 9.50759 9.16714 10.1872 9.72946 10.6706C10.2917 11.1539 11.0146 11.4051 11.7533 11.3756C12.4921 11.346 13.1929 11.0373 13.7153 10.5104H13.7163L17.6315 6.5673C18.1822 6.01266 18.4917 5.26038 18.4917 4.47608Z" fill="currentColor"/>
9
+ </svg>
10
+ `,O=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
11
+ <path d="M19.6676 3H4.32891C3.59414 3 3 3.58008 3 4.29727V19.6992C3 20.4164 3.59414 21 4.32891 21H19.6676C20.4023 21 21 20.4164 21 19.7027V4.29727C21 3.58008 20.4023 3 19.6676 3ZM8.34023 18.3387H5.66836V9.74648H8.34023V18.3387ZM7.0043 8.57578C6.14648 8.57578 5.45391 7.8832 5.45391 7.02891C5.45391 6.17461 6.14648 5.48203 7.0043 5.48203C7.85859 5.48203 8.55117 6.17461 8.55117 7.02891C8.55117 7.87969 7.85859 8.57578 7.0043 8.57578ZM18.3387 18.3387H15.6703V14.1621C15.6703 13.1672 15.6527 11.884 14.2816 11.884C12.893 11.884 12.682 12.9703 12.682 14.0918V18.3387H10.0172V9.74648H12.5766V10.9207H12.6117C12.9668 10.2457 13.8387 9.53203 15.1359 9.53203C17.8395 9.53203 18.3387 11.3109 18.3387 13.6242V18.3387Z" fill="currentColor"/>
12
+ </svg>
13
+ `,k=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
14
+ <path d="M20.4977 7.42209L16.2293 10.4005L18.6764 12.6899C18.9809 12.9749 18.9991 13.4556 18.7175 13.7639C18.4359 14.0721 17.9609 14.0913 17.6563 13.8064L14.9617 11.2854L13.5513 12.2712C13.0954 12.5897 12.554 12.7602 12 12.7602C11.5155 12.7601 11.0411 12.6299 10.6248 12.384L10.4497 12.2712L9.03736 11.2854L6.3437 13.8064C6.03906 14.0911 5.56401 14.072 5.28247 13.7639C5.00105 13.4556 5.01997 12.9748 5.32453 12.6899L7.76976 10.4014L3.50235 7.42209V16.9917C3.50235 17.1703 3.54436 17.2543 3.56886 17.2916C3.59646 17.3335 3.6388 17.3715 3.70383 17.4044C3.77174 17.4387 3.84877 17.4595 3.9151 17.4707C3.94627 17.476 3.97073 17.4786 3.98455 17.4796H20.0164C20.1927 17.4796 20.275 17.4371 20.3118 17.4123C20.3532 17.3844 20.3908 17.3416 20.4233 17.2757C20.4572 17.207 20.4778 17.129 20.4888 17.0619L20.4977 16.9917V7.42209ZM11.3026 11.0201C11.5074 11.1631 11.7512 11.2398 12 11.2398C12.249 11.2398 12.4925 11.1633 12.6974 11.0201L19.145 6.52036H4.85505L11.3026 11.0201ZM22 16.9926V17.0312C21.9994 17.0493 21.998 17.0724 21.9961 17.0995C21.9923 17.1539 21.9847 17.2272 21.9707 17.3124C21.9432 17.479 21.8872 17.7128 21.7672 17.9557C21.6456 18.2019 21.4506 18.4713 21.1451 18.6773C20.8352 18.8864 20.4559 18.9999 20.0164 19H3.94542C3.92756 18.9994 3.90484 18.998 3.87793 18.996C3.82433 18.9922 3.75263 18.9845 3.66862 18.9703C3.50386 18.9425 3.27213 18.886 3.03189 18.7644C2.78862 18.6413 2.52248 18.444 2.31886 18.1349C2.1122 17.8211 2 17.4366 2 16.9917V7.00834V6.99251C2.0001 6.98593 2.00068 6.97781 2.00098 6.96875C2.00157 6.95068 2.00199 6.92766 2.00391 6.90045C2.00774 6.84621 2.01536 6.77363 2.02934 6.68863C2.05681 6.52185 2.1136 6.28746 2.23376 6.04426C2.3554 5.7981 2.54946 5.52872 2.85485 5.32268C3.16497 5.11348 3.54483 5 3.98455 5H20.0321L20.1221 5.00396C20.1758 5.00784 20.2482 5.0155 20.3324 5.02969C20.4971 5.05749 20.7279 5.11508 20.9681 5.23657C21.2113 5.35964 21.4775 5.55607 21.6811 5.8651C21.8879 6.17895 22 6.56333 22 7.00834V16.9926Z" fill="currentColor"/>
15
+ </svg>
16
+ `,ue=`<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
17
+ <path d="M9.43542 6.84128C9.55792 6.83128 9.67129 6.90302 9.72351 7.01413L10.8641 9.43307C10.918 9.54745 10.8939 9.68347 10.8046 9.77292L9.95496 10.6235C9.77112 10.8073 9.71708 11.0936 9.84363 11.3208C10.1539 11.8772 10.5712 12.4137 11.0546 12.9067C11.5475 13.3899 12.0833 13.8077 12.6395 14.1176C12.8666 14.2441 13.1527 14.19 13.3368 14.0063L14.1874 13.1557C14.2768 13.0664 14.4128 13.043 14.5272 13.0971L16.9462 14.2368C17.0573 14.289 17.129 14.4027 17.119 14.5249C17.0928 14.8433 16.9651 15.4815 16.3934 16.0532C14.7798 17.6669 11.8822 15.8421 11.7616 15.77C11.0486 15.3869 10.3709 14.8741 9.72839 14.2319C9.08625 13.5897 8.57333 12.9117 8.19031 12.1987C8.11602 12.0755 6.29465 9.18098 7.9071 7.56784C8.4788 6.99614 9.11696 6.86746 9.43542 6.84128Z" fill="currentColor"/>
18
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M12.1844 1.77682C17.7071 1.77691 22.1844 6.25418 22.1844 11.7768C22.1844 17.2994 17.707 21.7767 12.1844 21.7768C10.4429 21.7768 8.8058 21.331 7.37976 20.5483L2.18445 21.7768L3.51648 16.7661C2.66957 15.2978 2.18447 13.5937 2.18445 11.7768C2.18445 6.25413 6.66175 1.77682 12.1844 1.77682ZM12.1844 3.56784C7.65091 3.56784 3.97546 7.24328 3.97546 11.7768C3.97555 13.5246 4.52177 15.1448 5.453 16.476L4.59265 19.4096L7.66199 18.6284C8.95882 19.4862 10.5133 19.9848 12.1844 19.9848C16.7178 19.9848 20.3932 16.3101 20.3934 11.7768C20.3934 7.24333 16.7179 3.56792 12.1844 3.56784Z" fill="currentColor"/>
19
+ </svg>
20
+ `,de=`<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">
21
+ <path d="M17.1761 3.86484H19.9362L13.9061 10.7568L21 20.1352H15.4456L11.0951 14.4472L6.11723 20.1352H3.35544L9.80517 12.7635L3 3.86484H8.69545L12.6279 9.06384L17.1761 3.86484ZM16.2073 18.4831H17.7368L7.86441 5.43013H6.2232L16.2073 18.4831Z" fill="currentColor"/>
22
+ </svg>
23
+ `,fe=c.default.getComponent(`SvgComponent`),A=c.default.log.createLogger(`share-button`),j=class extends fe{constructor(e,t={}){super(e,t),this.on(`click`,this.handleClick)}createEl(e=`a`,t={},n={}){if(e!==`a`)throw A.error(`Creating a ShareButton with an HTML element of ${e} is not supported; the element must be an 'a'`),Error(`'${e}' is not supported for ShareButton`);let{title:r,target:i,rel:a}=this.options(),o=super.createEl(e,t,c.default.obj.merge({href:this.getHref(),title:this.localize(r),target:i,rel:a},n));return o.prepend(c.default.dom.createEl(`span`,{className:`vjs-control-text`,textContent:this.localize(r)})),o.append(c.default.dom.createEl(`span`,{className:`vjs-share-button-title`,textContent:this.localize(this.options().label)})),o}setUrlGenerator(e){this.generateUrl_=e,this.updateHref()}generateUrl(){return typeof this.generateUrl_==`function`?this.generateUrl_():``}getHref(){let e=this.generateUrl();if(!e)return``;try{let{buildUrl:t}=this.options();return t(e,this.shareText(),this.player(),this)}catch(e){A.error(`Error building the share url:`,e)}return``}shareText(){let e=this.options().shareText??this.parentComponent_?.options().shareText??document.title;return typeof e==`function`?e(this.player(),this):e}updateHref(){this.el().href=this.getHref()}handleClick(){this.trigger({type:`share`,bubbles:!0})}buildCSSClass(){return`vjs-share-button ${super.buildCSSClass()}`}handleLanguagechange(){let{title:e,label:t}=this.options();this.el().title=this.localize(e),this.$(`.vjs-control-text`).textContent=this.localize(e),this.$(`.vjs-share-button-title`).textContent=this.localize(t)}};j.prototype.options_={target:`_blank`,rel:`noopener noreferrer`,buildUrl:e=>e};var M=class extends j{};M.prototype.options_=c.default.obj.merge(j.prototype.options_,{className:`vjs-share-button-facebook`,label:`Facebook`,title:`Share on Facebook`,icon:le,iconName:`facebook`,buildUrl:e=>`https://www.facebook.com/sharer/sharer.php?u=${encodeURIComponent(e)}`});var N=class extends j{};N.prototype.options_=c.default.obj.merge(j.prototype.options_,{className:`vjs-share-button-x`,label:`X`,title:`Share on X`,icon:de,iconName:`x`,buildUrl:(e,t)=>`https://twitter.com/intent/tweet?url=${encodeURIComponent(e)}&text=${encodeURIComponent(t)}`});var P=class extends j{};P.prototype.options_=c.default.obj.merge(j.prototype.options_,{className:`vjs-share-button-linkedin`,label:`LinkedIn`,title:`Share on LinkedIn`,icon:O,iconName:`linkedin`,buildUrl:e=>`https://www.linkedin.com/sharing/share-offsite/?url=${encodeURIComponent(e)}`});var F=class extends j{};F.prototype.options_=c.default.obj.merge(j.prototype.options_,{className:`vjs-share-button-whatsapp`,label:`WhatsApp`,title:`Share on WhatsApp`,icon:ue,iconName:`whatsapp`,buildUrl:(e,t)=>`https://api.whatsapp.com/send?text=${encodeURIComponent(`${t} ${e}`)}`});var I=class extends j{};I.prototype.options_=c.default.obj.merge(j.prototype.options_,{className:`vjs-share-button-email`,label:`E-mail`,title:`Share by email`,icon:k,iconName:`email`,target:`_self`,buildUrl:(e,t)=>{let n=encodeURIComponent(t);return`mailto:?subject=${n}&body=${n}%20${encodeURIComponent(e)}`}});var L=class extends j{handleClick(e){e.preventDefault(),this.copyText(this.textToCopy()),super.handleClick(e)}textToCopy(){return this.generateUrl()}copyText(e){var t;if(!((t=navigator.clipboard)!=null&&t.writeText)){A.warn(`Clipboard API is unavailable; the text could not be copied.`);return}Promise.resolve(navigator.clipboard.writeText(e)).catch(e=>{A.error(`The text could not be copied:`,e)})}};L.prototype.options_=c.default.obj.merge(j.prototype.options_,{className:`vjs-share-button-copy`,label:`Copy link`,title:`Copy link`,icon:D,iconName:`copy-link`,target:``,rel:``,buildUrl:()=>`#`});var R=class extends L{textToCopy(){let{buildEmbedCode:e}=this.options();return e(this.generateUrl(),this.player(),this)}};R.prototype.options_=c.default.obj.merge(L.prototype.options_,{className:`vjs-share-button-embed`,label:`Embed`,title:`Embed`,icon:ce,iconName:`embed`,buildEmbedCode:e=>`<iframe src="${e}" width="560" height="315" allowfullscreen></iframe>`}),c.default.registerComponent(`ShareButton`,j),c.default.registerComponent(`FacebookShareButton`,M),c.default.registerComponent(`XShareButton`,N),c.default.registerComponent(`LinkedinShareButton`,P),c.default.registerComponent(`WhatsappShareButton`,F),c.default.registerComponent(`EmailShareButton`,I),c.default.registerComponent(`CopyLinkShareButton`,L),c.default.registerComponent(`EmbedShareButton`,R);var z=c.default.getComponent(`Component`),B=class extends z{setUrlGenerator(e){this.children().forEach(t=>t.setUrlGenerator?.call(t,e))}};B.prototype.options_={className:`vjs-share-button-collection`,shareText:void 0,children:[`facebookShareButton`,`xShareButton`,`linkedinShareButton`,`whatsappShareButton`,`emailShareButton`,`copyLinkShareButton`,`embedShareButton`]},c.default.registerComponent(`ShareButtonCollection`,B);function V(e,t){this.v=e,this.k=t}function pe(e,t,n){return(t=he(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function H(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,r)}return n}function U(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]==null?{}:arguments[t];t%2?H(Object(n),!0).forEach(function(t){pe(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):H(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function me(e,t){if(typeof e!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(typeof r!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function he(e){var t=me(e,`string`);return typeof t==`symbol`?t:t+``}function W(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof V;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`?`return`:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(a.done?`return`:`normal`,n)},function(e){r(`throw`,e)})}catch(e){i(`throw`,e)}}function i(e,i){switch(e){case`return`:t.resolve({value:i,done:!0});break;case`throw`:t.reject(i);break;default:t.resolve({value:i,done:!1})}(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}W.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},W.prototype.next=function(e){return this._invoke(`next`,e)},W.prototype.throw=function(e){return this._invoke(`throw`,e)},W.prototype.return=function(e){return this._invoke(`return`,e)};var ge={Share:`Teilen`,"Sharing type":`Art des Teilens`,Close:`Schliessen`,"Share episode":`Episode teilen`,Episode:`Episode`,"Share the current position":`Aktuelle Position teilen`,"Current position":`Aktuelle Position`,"Share on Facebook":`Auf Facebook teilen`,"Share on X":`Auf X teilen`,"Share on LinkedIn":`Auf LinkedIn teilen`,"Share on WhatsApp":`Auf WhatsApp teilen`,"Share by email":`Per E-Mail teilen`,"Copy link":`Link kopieren`,Embed:`Einbetten`,Facebook:`Facebook`,X:`X`,LinkedIn:`LinkedIn`,WhatsApp:`WhatsApp`,"E-mail":`E-Mail`},_e={Share:`Share`,"Sharing type":`Sharing type`,Close:`Close`,"Share episode":`Share episode`,Episode:`Episode`,"Share the current position":`Share the current position`,"Current position":`Current position`,"Share on Facebook":`Share on Facebook`,"Share on X":`Share on X`,"Share on LinkedIn":`Share on LinkedIn`,"Share on WhatsApp":`Share on WhatsApp`,"Share by email":`Share by email`,"Copy link":`Copy link`,Embed:`Embed`,Facebook:`Facebook`,X:`X`,LinkedIn:`LinkedIn`,WhatsApp:`WhatsApp`,"E-mail":`E-mail`},ve={Share:`Partager`,"Sharing type":`Type de partage`,Close:`Fermer`,"Share episode":`Partager l'épisode`,Episode:`Épisode`,"Share the current position":`Partager la position courante`,"Current position":`Position courante`,"Share on Facebook":`Partager sur Facebook`,"Share on X":`Partager sur X`,"Share on LinkedIn":`Partager sur Linkedin`,"Share on WhatsApp":`Partager sur Whatsapp`,"Share by email":`Partager par e-mail`,"Copy link":`Copier le lien`,Embed:`Embed`,Facebook:`Facebook`,X:`X`,LinkedIn:`LinkedIn`,WhatsApp:`WhatsApp`,"E-mail":`E-mail`},ye={Share:`Condividi`,"Sharing type":`Tipo di condivisione`,Close:`Chiudi`,"Share episode":`Condividi l'episodio`,Episode:`Episodio`,"Share the current position":`Condividi la posizione corrente`,"Current position":`Posizione corrente`,"Share on Facebook":`Condividi su Facebook`,"Share on X":`Condividi su X`,"Share on LinkedIn":`Condividi su LinkedIn`,"Share on WhatsApp":`Condividi su WhatsApp`,"Share by email":`Condividi via e-mail`,"Copy link":`Copia il link`,Embed:`Incorpora`,Facebook:`Facebook`,X:`X`,LinkedIn:`LinkedIn`,WhatsApp:`WhatsApp`,"E-mail":`E-mail`},be={Share:`Cundivider`,"Sharing type":`Tip da cundivider`,Close:`Serrar`,"Share episode":`Cundivider l'episoda`,Episode:`Episoda`,"Share the current position":`Cundivider la posiziun actuala`,"Current position":`Posiziun actuala`,"Share on Facebook":`Cundivider sin Facebook`,"Share on X":`Cundivider sin X`,"Share on LinkedIn":`Cundivider sin LinkedIn`,"Share on WhatsApp":`Cundivider sin WhatsApp`,"Share by email":`Cundivider per e-mail`,"Copy link":`Copiar il link`,Embed:`Integrar`,Facebook:`Facebook`,X:`X`,LinkedIn:`LinkedIn`,WhatsApp:`WhatsApp`,"E-mail":`E-mail`};function G(e,t){c.default.addLanguage(e,U(U({},c.default.options.language[e]??{}),t))}G(`de`,ge),G(`en`,_e),G(`fr`,ve),G(`it`,ye),G(`rm`,be);var xe=c.default.getComponent(`Component`),K=(e,t)=>Se(e,t)||window.location.href,Se=(e,t)=>{let{url:n}=t.options();return typeof n==`function`?n(e,t,t.context()):n},q=e=>e.options().mediaComposition,J=e=>{var t,n;return(t=q(e))==null||(n=t.getMainChapter)==null?void 0:n.call(t)},Y=e=>{var t,n;return((t=q(e))==null||(n=t.getSubdivisions)==null?void 0:n.call(t))??[]},Ce=(e,t)=>t>=e.markIn/1e3&&t<e.markOut/1e3,we=e=>Y(e).filter(e=>!e.blockReason).filter(t=>Ce(t,e.currentTime())).pop(),X=e=>e.currentSource()?.mediaData,Te=e=>J(e)||X(e),Z=class extends xe{constructor(e,t={}){super(e,t),this.render(),this.on(this.player(),`timeupdate`,this.updateOptionsState)}createEl(){return super.createEl(`div`,{},{role:`radiogroup`,"aria-label":this.localize(`Sharing type`)})}render(e=this.defaultOption()){let t=this.entries();this.toggleClass(`vjs-hidden`,t.length<=1),this.el().replaceChildren(...t.map(([t,n])=>this.createOption(t,n,t===e)))}entries(){let{options:e,includeCurrentTime:t}=this.options();return Object.entries(e).filter(([e,n])=>n!==!1&&!this.isOptionHidden(n)&&(e!==`currentTime`||t))}isOptionHidden(e){return typeof e.isHidden==`function`&&e.isHidden(this.player(),this)}isOptionDisabled(e){return typeof e.isDisabled==`function`?e.isDisabled(this.player(),this):!!e.disabled}defaultOption(){let{defaultOption:e,includeCurrentTime:t}=this.options(),n=e??(t?`currentTime`:`episode`),r=this.entries().filter(([,e])=>!this.isOptionDisabled(e));return r.some(([e])=>e===n)?n:r[0]?.[0]}createOption(e,t,n){let r=`${this.id()}_${e}`,i=c.default.dom.createEl(`label`,{className:`vjs-share-url-option-label`,title:this.localize(t.title??t.label)},{for:r});return i.append(c.default.dom.createEl(`input`,{className:`vjs-share-url-option-input`,checked:n,disabled:this.isOptionDisabled(t)},{id:r,type:`radio`,name:`${this.id()}_url_option`,value:e}),c.default.dom.createEl(`span`,{textContent:this.localize(t.label)})),i}input(e){return this.$(`.vjs-share-url-option-input[value="${e}"]`)}selected(){return this.$(`.vjs-share-url-option-input:checked`)?.value}updateOptionsState(){this.entries().forEach(([e,t])=>{let n=this.input(e);n&&(n.disabled=this.isOptionDisabled(t))});let e=this.options().options[this.selected()];e&&this.isOptionDisabled(e)&&this.selectDefaultOption()}selectDefaultOption(){let e=this.input(this.defaultOption());e&&(e.checked=!0,this.trigger(`change`))}context(){var e;let t=Te(this.player());return{currentMedia:t,currentSource:(e=this.player()).currentSource?.call(e),currentSubdivision:we(this.player()),currentTime:this.player().currentTime(),mainChapter:J(this.player()),mediaData:X(this.player()),subdivisions:Y(this.player()),title:t?.title}}generateUrl(){let e=this.options().options[this.selected()];return e?e.generateUrl(this.player(),this):``}handleLanguagechange(){this.el().setAttribute(`aria-label`,this.localize(`Sharing type`)),this.render(this.selected())}};Z.prototype.options_={className:`vjs-share-url-options`,defaultOption:void 0,includeCurrentTime:!1,url:void 0,options:{episode:{label:`Episode`,title:`Share episode`,generateUrl:(e,t)=>K(e,t)},currentTime:{label:`Current position`,title:`Share the current position`,generateUrl:(e,t)=>{let n=new URL(K(e,t));return n.searchParams.set(`startTime`,Math.floor(e.currentTime())),n.toString()}}}},c.default.registerComponent(`ShareUrlOptions`,Z);var Ee=c.default.getComponent(`ModalDialog`),Q=class extends Ee{constructor(e,t={}){super(e,t),this.handleOutsideClick=this.handleOutsideClick.bind(this),this.fill(),this.render()}dispose(){this.unbindOutsideClick(),super.dispose()}buildCSSClass(){return`vjs-share-modal ${super.buildCSSClass()}`}render(){this.title_=this.createTitle(),this.urlOptions_=this.addChild(`ShareUrlOptions`,this.options().shareUrlOptions),this.collection_=this.addChild(`ShareButtonCollection`,this.options().shareButtonCollection),this.on(this.urlOptions_,`change`,this.updateUrlGenerator),this.on(`share`,this.handleShare),this.updateUrlGenerator()}createTitle(){let e=this.addChild(`ShareModalTitle`,{componentClass:`TitleBar`,className:`vjs-share-title`});return e.update({title:this.localize(this.options().title??`Share`)}),e}open(){super.open(),this.bindOutsideClick(),this.updateUrlGenerator()}close(){this.unbindOutsideClick(),super.close()}updateUrlGenerator(){this.collection_.setUrlGenerator(()=>this.urlOptions_.generateUrl())}handleShare(){this.close()}bindOutsideClick(){document.addEventListener(`pointerdown`,this.handleOutsideClick)}unbindOutsideClick(){document.removeEventListener(`pointerdown`,this.handleOutsideClick)}handleOutsideClick(e){this.isOwnClick(e)||this.close()}isOwnClick(e){return this.el().contains(e.target)}handleLanguagechange(){this.el().title=this.localize(this.options().title??`Share`),this.title_.update({title:this.localize(this.options().title??`Share`)})}};Q.prototype.options_={pauseOnOpen:!1,temporary:!1,title:`Share`,shareUrlOptions:{},shareButtonCollection:{}},c.default.registerComponent(`ShareModal`,Q);var De=`0.0.1`,Oe=c.default.getComponent(`SvgButton`),ke=c.default.log.createLogger(`share-toggle`),$=class extends Oe{constructor(e,t={}){super(e,t),this.player().ready(()=>this.bindShareModal())}bindShareModal(){let e=this.player().getChild(`ShareModal`);if(!e){ke.warn(`ShareToggle requires a ShareModal child on the player`);return}this.on(e,`modalopen`,this.hide),this.on(e,`modalclose`,this.show),this.toggleClass(`vjs-hidden`,e.opened())}handleClick(e){super.handleClick(e),this.shareModal().open()}shareModal(){let e=this.player().getChild(`ShareModal`);if(!e)throw Error(`ShareToggle requires a ShareModal child on the player`);return e}buildCSSClass(){return`vjs-share-toggle ${super.buildCSSClass()}`}static get VERSION(){return De}};$.prototype.options_={controlText:`Share`,iconName:`share`},c.default.registerComponent(`ShareToggle`,$),exports.ShareButton=j,exports.ShareButtonCollection=B,exports.ShareModal=Q,exports.ShareToggle=$,exports.ShareUrlOptions=Z;
24
+ //# sourceMappingURL=share-button.cjs.map