@flowplayer/player 3.22.0-rc → 3.23.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/plugins/ssai.d.ts CHANGED
@@ -1,23 +1,48 @@
1
1
  /// <reference types="node" />
2
2
 
3
3
  import type { BitrateInfo } from 'dashjs';
4
+ import type { FragParsingMetadataData } from 'hls.js';
4
5
  import type { Get } from 'type-fest';
5
6
  import type { Level } from 'hls.js';
6
7
  import type { MediaKeyFunc } from 'hls.js';
7
8
  import type { SetFieldType } from 'type-fest';
8
9
  import type { TupleToUnion } from 'type-fest';
9
10
 
10
- /* Excluded from this release type: AdEvent */
11
+ declare interface Ad {
12
+ getAdId(): string;
13
+ getAdPodInfo(): AdPodInfo;
14
+ getDuration(): number;
15
+ getVastMediaHeight(): number;
16
+ getVastMediaWidth(): number;
17
+ getSkipTimeOffset(): number;
18
+ isSkippable(): boolean;
19
+ }
20
+
21
+ declare interface AdPodInfo {
22
+ getPodIndex(): number;
23
+ }
24
+
25
+ declare interface AdPodInfo {
26
+ getAdPosition(): number;
27
+ getPodIndex(): number;
28
+ getTotalAds(): number;
29
+ }
11
30
 
12
- declare type AdProgress = {
31
+ /* Excluded from this release type: AdProgress */
32
+
33
+ declare type AdProgressData = {
34
+ adBreakDuration: number;
35
+ adPeriodDuration: number;
36
+ adPosition: number;
13
37
  currentTime: number;
14
- duration?: number;
38
+ duration: number;
39
+ totalAds: number;
15
40
  };
16
41
 
17
42
  /**
18
43
  * @public
19
44
  */
20
- declare enum AdType {
45
+ export declare enum AdType {
21
46
  Preroll = "preroll",
22
47
  Midroll = "midroll",
23
48
  Postroll = "postroll"
@@ -201,6 +226,12 @@ CONTEXT_MENU = "contextmenu";
201
226
  */
202
227
  declare type ContextMenuEventDetail = null;
203
228
 
229
+ declare type CuePoint = {
230
+ end: number;
231
+ played: boolean;
232
+ start: number;
233
+ };
234
+
204
235
  /**
205
236
  * @public
206
237
  * @deprecated
@@ -250,6 +281,21 @@ declare const /**
250
281
  */
251
282
  CUEPOINTS = "cuepoints";
252
283
 
284
+ /**
285
+ * @public
286
+ */
287
+ export declare type DAISrcCommons = {
288
+ type: "google/dai";
289
+ /**
290
+ * Back-up stream to use in case the main stream fails to play. Can be used in any DAI Source
291
+ */
292
+ backupStream?: string;
293
+ } & StreamRequest;
294
+
295
+ /* Excluded from this release type: DASH_METADATA */
296
+
297
+ /* Excluded from this release type: DASHMetadata */
298
+
253
299
  /**
254
300
  * @public
255
301
  */
@@ -442,6 +488,20 @@ declare namespace events {
442
488
  }
443
489
  }
444
490
 
491
+ declare namespace events_2 {
492
+ export {
493
+ SSAI_AD_START,
494
+ SSAI_AD_END,
495
+ SSAI_AD_PROGRESS,
496
+ SSAI_AD_SKIPPED,
497
+ SSAI_AD_PAUSED,
498
+ SSAI_AD_RESUMED,
499
+ SSAI_AD_STARTED,
500
+ SSAI_AD_COMPLETED,
501
+ SSAI_AD_ERROR
502
+ }
503
+ }
504
+
445
505
  declare type ExtractBareConfig<Plugins extends PluginCtor> = Plugins extends PluginCtor<ConfigWith<infer ConfigType>> ? ConfigType : never;
446
506
 
447
507
  declare type ExtractPluginPlayerExtension<Plugin extends PluginCtor> = Plugin extends PluginCtor<infer _uConfigType, PlayerWith<infer PluginPlayer>> ? PluginPlayer : never;
@@ -595,6 +655,10 @@ declare const /**
595
655
  */
596
656
  FULLSCREEN_EXIT = "fullscreenexit";
597
657
 
658
+ declare interface GoogleEventListener {
659
+ addEventListener(events: string[], cb: (e: StreamEvent) => void, passive: boolean): void;
660
+ }
661
+
598
662
  declare const GRABBING = "is-grabbing";
599
663
 
600
664
  declare const HAS_POSTER = "has-poster";
@@ -603,6 +667,8 @@ declare type HasGlobalSrcExtensios<PluginSrcs extends unknown[]> = ArrayToInters
603
667
 
604
668
  declare type HasSrcExtensions<PluginBareConfigs extends unknown[]> = TupleToUnion<PickSrcExtensions<PluginBareConfigs>> extends never ? false : true;
605
669
 
670
+ /* Excluded from this release type: HLS_METADATA */
671
+
606
672
  declare const HOVERED = "is-hovered";
607
673
 
608
674
  declare const IN_VIEWPORT = "is-in-viewport";
@@ -675,6 +741,10 @@ declare const LIVE_SEEKED = "is-live-seeked";
675
741
  */
676
742
  declare type LiveEventDetail = null;
677
743
 
744
+ declare interface LiveStreamRequest extends StreamRequest {
745
+ assetKey: string;
746
+ }
747
+
678
748
  /**
679
749
  * @public
680
750
  */
@@ -1198,6 +1268,10 @@ declare interface PluginCtor<PluginConfig extends Config = Config, PluginPlayer
1198
1268
 
1199
1269
  declare type PluginStates = string;
1200
1270
 
1271
+ declare interface PodVodStreamRequest extends StreamRequest {
1272
+ networkCode: string;
1273
+ }
1274
+
1201
1275
  /**
1202
1276
  * @public
1203
1277
  */
@@ -1507,19 +1581,212 @@ declare type SourceWith<T> = SourceObj & T;
1507
1581
 
1508
1582
  /**
1509
1583
  * @public
1584
+ *
1585
+ * The SSAI plugin allows you to serve ads that are dynamically inserted into video content at the server level before content is delivered to the viewer's device.
1586
+ *
1587
+ * See {@link https://developer.wowza.com/docs/wowza-flowplayer/plugins/ssai | Official documentation}
1510
1588
  */
1511
- declare const SSAI: PluginCtor<NoInfer<Config>, NoInfer<Player>>;
1589
+ declare const SSAI: PluginCtor<NoInfer<SSAIConfig>, NoInfer<SSAIPlayer>> & NoInfer<SSAIAPI>;
1512
1590
  export default SSAI;
1513
1591
 
1592
+ declare const SSAI_AD_COMPLETED = "ad-completed";
1593
+
1594
+ declare const SSAI_AD_END = "ad-break-completed";
1595
+
1596
+ declare const SSAI_AD_ERROR = "ad-error";
1597
+
1598
+ declare const SSAI_AD_PAUSED = "ad-paused";
1599
+
1600
+ declare const SSAI_AD_PROGRESS = "ad-progress";
1601
+
1602
+ declare const SSAI_AD_RESUMED = "ad-resumed";
1603
+
1604
+ declare const SSAI_AD_SKIPPED = "ad-skipped";
1605
+
1606
+ declare const SSAI_AD_START = "ad-break-started";
1607
+
1608
+ declare const SSAI_AD_STARTED = "ad-started";
1609
+
1610
+ /**
1611
+ * @public
1612
+ */
1613
+ export declare type SSAIAdEventDetail = {
1614
+ remaining?: number;
1615
+ duration?: number;
1616
+ totals?: number;
1617
+ position?: number;
1618
+ currentTime?: number;
1619
+ };
1620
+
1621
+ /**
1622
+ * @public
1623
+ */
1624
+ export declare type SSAIAPI = {
1625
+ events: SSAIEvents;
1626
+ };
1627
+
1628
+ /**
1629
+ * @public
1630
+ */
1631
+ export declare type SSAIConfig = ConfigWith<{
1632
+ src: UnsafeSource<SSAISrc>;
1633
+ }>;
1634
+
1635
+ /**
1636
+ * @public
1637
+ */
1638
+ export declare type SSAIEvent = SSAIEvents[keyof SSAIEvents];
1639
+
1640
+ /**
1641
+ * @public
1642
+ */
1643
+ export declare type SSAIEvents = typeof events_2;
1644
+
1514
1645
  /* Excluded from this release type: SSAIInterface */
1515
1646
 
1516
- /* Excluded from this release type: SSAIPlayer */
1647
+ /**
1648
+ * @public
1649
+ * Full service live configuration
1650
+ */
1651
+ export declare type SSAILiveStreamFullServiceSrc = DAISrcCommons & {
1652
+ /**
1653
+ * (Applies to Full service Live)
1654
+ *
1655
+ * Used to determine which live stream should play. The live stream request asset key identifier can be found in the {@link https://support.google.com/admanager/answer/7294289#locate-a-live-linear-stream-url-and-asset-key| DFP UI}.
1656
+ *
1657
+ * For more, see {@link https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5/reference/js/LiveStreamRequest#assetKey| Google's API reference}
1658
+ *
1659
+ */
1660
+ assetKey: string;
1661
+ };
1517
1662
 
1518
- declare type SSAIState = {
1519
- snapback: boolean;
1520
- snapbackTime?: number;
1521
- adProgress?: AdProgress;
1522
- rate?: number;
1663
+ /**
1664
+ * @public
1665
+ * Pod serving live configuration
1666
+ */
1667
+ export declare type SSAILiveStreamPodSrc = DAISrcCommons & {
1668
+ /**
1669
+ * (Applies to Pod serving Live)
1670
+ *
1671
+ * The custom asset key that identifies your pod serving event in Ad Manager 360. This can be created by your manifest manipulator or third-party pod serving partner.
1672
+ * For more, see {@link https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5/reference/js/PodStreamRequest#customAssetKey| Google's API reference.}
1673
+ */
1674
+ customAssetKey: string;
1675
+ /**
1676
+ * (Applies to Pod serving Live)
1677
+ *
1678
+ * The video stream URL provided by your manifest manipulator or third-party partner using pod serving.
1679
+ * This URL includes a [[STREAMID]] placeholder that's replaced by the stream ID value provided by the IMA DAI SDK before the request is made.
1680
+ * For more, see {@link https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5?service=pod#livestream-pod-serving_1| Google's live pod-serving example code.}
1681
+ */
1682
+ streamUrl: string;
1683
+ /**
1684
+ * (Applies to Pod serving Live)
1685
+ *
1686
+ * Network code for the publisher making the stream request. Corresponds to the network code for your Ad Manager 360 account. Helps Google's ad serving systems route ad request and responses to the correct publisher account and manage ad inventory effectively.
1687
+ * For more, see {@link https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5/reference/js/PodStreamRequest#networkCode| Google's API reference}
1688
+ */
1689
+ networkCode: string;
1690
+ };
1691
+
1692
+ /**
1693
+ * @public
1694
+ */
1695
+ export declare type SSAIPlayer = PlayerWith<{
1696
+ /* Excluded from this release type: ssai */
1697
+ /* Excluded from this release type: on */
1698
+ /**
1699
+ * Fires when an individual ad completes.
1700
+ */
1701
+ on(event: typeof SSAI_AD_COMPLETED, handler: (e: FPEvent<SSAIAdEventDetail>) => void): Player;
1702
+ /**
1703
+ * Fires the first time each ad break ends
1704
+ */
1705
+ on(event: typeof SSAI_AD_END, handler: (e: FPEvent<SSAIAdEventDetail>) => void): Player;
1706
+ /**
1707
+ * Fires the first time each ad break begins playback.
1708
+ */
1709
+ on(event: typeof SSAI_AD_START, handler: (e: FPEvent<SSAIAdEventDetail>) => void): Player;
1710
+ /**
1711
+ * Fires when an ad starts.
1712
+ */
1713
+ on(event: typeof SSAI_AD_STARTED, handler: (e: FPEvent<SSAIAdEventDetail>) => void): Player;
1714
+ /**
1715
+ * Fires when an ad pauses.
1716
+ */
1717
+ on(event: typeof SSAI_AD_PAUSED, handler: (e: FPEvent<SSAIAdEventDetail>) => void): Player;
1718
+ /**
1719
+ * Fires when the current ad progresses.
1720
+ */
1721
+ on(event: typeof SSAI_AD_PROGRESS, handler: (e: FPEvent<SSAIAdEventDetail>) => void): Player;
1722
+ /**
1723
+ * Fires when an ad resumes.
1724
+ */
1725
+ on(event: typeof SSAI_AD_RESUMED, handler: (e: FPEvent<SSAIAdEventDetail>) => void): Player;
1726
+ /**
1727
+ * Fires when the user skips an ad.
1728
+ */
1729
+ on(event: typeof SSAI_AD_SKIPPED, handler: (e: FPEvent<SSAIAdEventDetail>) => void): Player;
1730
+ /* Excluded from this release type: on */
1731
+ /* Excluded from this release type: on */
1732
+ /* Excluded from this release type: emit */
1733
+ }>;
1734
+
1735
+ /**
1736
+ * @public
1737
+ * DAI source or Yospace
1738
+ */
1739
+ export declare type SSAISrc = YospaceSrc | SSAIVODFullServiceSrc | SSAIVODPodSrc | SSAILiveStreamFullServiceSrc | SSAILiveStreamPodSrc;
1740
+
1741
+ /* Excluded from this release type: SSAIState */
1742
+
1743
+ /**
1744
+ * @public
1745
+ * Full service VOD configuration
1746
+ */
1747
+ export declare type SSAIVODFullServiceSrc = DAISrcCommons & {
1748
+ /**
1749
+ * (Applies to Full service VOD)
1750
+ *
1751
+ * Unique identifier for the publisher content from a CMS.
1752
+ * To retrieve this ID in the Media RSS (MRSS) feed from Google, {@link https://support.google.com/admanager/answer/7064112?hl=en| create the content source}
1753
+ * in your Google Ad Manager UI.
1754
+ * Helps Google's ad serving systems associate the correct ad inventory and ad targeting criteria with the specific content being streamed.
1755
+ * For more, see {@link https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5/reference/js/VODStreamRequest#contentSourceId| Google's API reference}
1756
+ */
1757
+ contentSourceId: string;
1758
+ /**
1759
+ * (Applies to Full service VOD)
1760
+ *
1761
+ * Identifier for each individual video asset the Google MRSS feed uses to populate the content source library. Helps Google's ad serving systems to associate ad targeting criteria and ad insertion policies with specific videos.
1762
+ * For more, see {@link https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5/reference/js/VODStreamRequest#videoId| Google's API reference.}
1763
+ */
1764
+ videoId: string;
1765
+ };
1766
+
1767
+ /**
1768
+ * @public
1769
+ * Pod serving VOD configuration
1770
+ */
1771
+ export declare type SSAIVODPodSrc = DAISrcCommons & {
1772
+ /**
1773
+ * (Applies to Pod serving VOD)
1774
+ *
1775
+ * Callback function that takes streamManager and streamId arguments. Add your code to this function to request and dynamically generate the stream URL from your video technology partner (VTP). Your function should return a Promise object with the stream URL if it's resolved or an error if the promise is rejected.
1776
+ *
1777
+ * For more, see {@link https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5?service=pod#vod-pod-serving_1| Google's VOD pod-serving example code.}
1778
+ * @param streamManager - Handles dynamic ad insertion streams. See {@link https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5/reference/js/StreamManager#processMetadata| Google's API Reference}
1779
+ * @param streamId - Stream ID
1780
+ * @returns Promise with the Stream URL
1781
+ */
1782
+ requestStreamUrl: (streamManager: StreamManager, // NOTE we decided not to expose StreamManager and its subtypes to public, as pollution of intellisence outweights the small usecase for streamManager
1783
+ streamId: string) => Promise<string>;
1784
+ /**
1785
+ * (Applies to Pod serving VOD)
1786
+ *
1787
+ * Used to generate VOD pod serving request
1788
+ */
1789
+ networkCode: string;
1523
1790
  };
1524
1791
 
1525
1792
  declare const STARTING = "is-starting";
@@ -1569,6 +1836,49 @@ declare namespace states {
1569
1836
  }
1570
1837
  }
1571
1838
 
1839
+ declare interface StreamData {
1840
+ adProgressData?: AdProgressData;
1841
+ errorMessage?: string;
1842
+ url?: string;
1843
+ streamId?: string;
1844
+ }
1845
+
1846
+ declare type StreamEvent = {
1847
+ type: string;
1848
+ getStreamData(): StreamData;
1849
+ getAd(): Ad | undefined;
1850
+ };
1851
+
1852
+ declare interface StreamManager extends GoogleEventListener {
1853
+ new (video: HTMLVideoElement, adUi: HTMLDivElement, uiSettings?: Record<string, any>): this;
1854
+ contentTimeForStreamTime(streamTime: number): number;
1855
+ streamTimeForContentTime(contentTime: number): number;
1856
+ reset(): void;
1857
+ onTimedMetadata(metadata: Record<string, any>): void;
1858
+ processMetadata(type: string, data: Uint8Array | string, timestamp: number): void;
1859
+ requestStream(req: LiveStreamRequest | VODStreamRequest | PodVodStreamRequest): void;
1860
+ previousCuePointForStreamTime(streamTime: number): CuePoint | null;
1861
+ loadStreamMetadata(): void;
1862
+ }
1863
+
1864
+ /**
1865
+ * @public
1866
+ * See {@link https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5/reference/js/StreamRequest| Google's API reference}
1867
+ */
1868
+ export declare interface StreamRequest {
1869
+ adTagParameters?: Record<string, string>;
1870
+ omidAccessModeRules?: Record<string, string>;
1871
+ apiKey?: string;
1872
+ authToken?: string;
1873
+ /**
1874
+ * The stream format to request. For more, see {@link https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5/reference/js/StreamRequest#format| Google's API reference}
1875
+ *
1876
+ * Required for DASH streams
1877
+ */
1878
+ format?: "dash" | "hls";
1879
+ streamActivityMonitorId: string;
1880
+ }
1881
+
1572
1882
  /**
1573
1883
  * @public
1574
1884
  */
@@ -1701,6 +2011,11 @@ declare type ViewEnterEventDetail = null;
1701
2011
  */
1702
2012
  declare type ViewLeaveEventDetail = null;
1703
2013
 
2014
+ declare interface VODStreamRequest extends StreamRequest {
2015
+ contentSourceId: string;
2016
+ videoId: string;
2017
+ }
2018
+
1704
2019
  /**
1705
2020
  * @public
1706
2021
  */
@@ -1735,4 +2050,16 @@ declare const WILL_SEEK = "will-seek";
1735
2050
 
1736
2051
  declare type WithOpts<PluginPlayer extends Player = Player, PluginConfig extends Config = Config> = SetFieldType<SetFieldType<PluginPlayer, "opts", PluginConfig>, "setOpts", (config: PluginConfig) => void>;
1737
2052
 
2053
+ /**
2054
+ * Yospace DAI configuration
2055
+ * @public
2056
+ */
2057
+ export declare type YospaceSrc = {
2058
+ type: "yospace";
2059
+ /**
2060
+ * Identifies the Yospace stream.
2061
+ */
2062
+ src: string;
2063
+ };
2064
+
1738
2065
  export { }
package/plugins/ssai.js CHANGED
@@ -4,4 +4,4 @@
4
4
  * https://github.com/lancedikson/bowser
5
5
  * MIT License | (c) Dustin Diaz 2012-2015
6
6
  * MIT License | (c) Denis Demchenko 2015-2019
7
- */const S=class Bowser{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new Parser(e,t)}static parse(e){return new Parser(e).getResult()}static get BROWSER_MAP(){return u}static get ENGINE_MAP(){return g}static get OS_MAP(){return m}static get PLATFORMS_MAP(){return p}}.parse(window.navigator.userAgent),{platform:w,os:_,browser:M}=S,A=e=>e&&e.toLowerCase();var T={rnd:Math.random().toString(36).substr(2,32),os:A(_.name+(_.versionName?" "+_.versionName:"")),device:A(w.type),browser:A(M.name),browser_version:(M&&M.version?M.version:"unknown").split(".").shift(),plugin_version:"3.22.0-rc"};const E="https://fp-eu-w1-aai.flowplayer.com/in",k="POST",U=["ad-requested","ad-request-error","ad-request-completed","ad-completed","ad-started","ad-error","ad-skipped"],R=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],P=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],O=d("ads/analytics"),C=RequestQueue.of(),F=(...e)=>Object.assign({},...e);class Analytics{static of(e,t){return new Analytics(e,t)}static ensure_required_keys(e,t){return e.required_keys.filter(e=>!(e in t))}static pluck_valid_keys(e,t){return((e,...t)=>Object.keys(e).filter(e=>~t.indexOf(e)).reduce((t,s)=>Object.assign(t,{[s]:e[s]}),{}))(t,...e.valid_keys)}static mergeMetadata(e,t={}){return e.metadata=Analytics.pluck_valid_keys(e,F(e.metadata,t,{player_version:"3.22.0-rc"})),e}constructor(e,t={}){this.emitter=e,this.metadata=F(T,t.metadata||{}),this.emitter=e,this.events=t.events||[],this.required_keys=t.required_keys||[],this.optional_keys=t.optional_keys||[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),O(this),this.wireup()}wireup(){this.events.forEach(e=>{this.emitter.on(e,t=>{const s=t.detail,r=F(this.metadata,{event_type:e},s),i=Analytics.pluck_valid_keys(this,r),a=Analytics.ensure_required_keys(this,i);if(O(`Event[${e}]`,{payload:i,observation:s}),a.length)return O(`Analytics.validate_metadata() failed for\n Event[${e}]\n missing keys: ${a}`,i);RequestQueue.rpush(C,[E,k,i])})})}destroy(){this.emitter=this.metadata=this.events=this.required_keys=this.optional_keys=this.valid_keys=void 0}}var B;function I(e,t){var s;switch(t){case B.Preroll:return 0;case B.Postroll:return-1;default:return null===(s=e.ssai)||void 0===s?void 0:s.provider.getContentCurrentTime(e)}}function q(e,t,s){var r,i,a,n;const o=null===(r=t.ssai)||void 0===r?void 0:r.provider.getAdType(),d=null===(n=null===(a=null===(i=t.ssai)||void 0===i?void 0:i.provider)||void 0===a?void 0:a.src)||void 0===n?void 0:n.analyticsId,c={ad_break_time:I(t,o),ad_muted:t.muted,event_type:e,is_ssai:!0};o&&Object.assign(c,{ad_type:o}),d&&Object.assign(c,{ad_tag_id:d}),s&&"duration"in s&&Object.assign(c,{ad_remaining_seconds:s.duration-s.currentTime,ad_duration_seconds:s.duration}),t.emit("health:record",{event:"ads/"+e,detail:c}),t.emit(e,Object.assign(c,s))}function D(e,t){var s;e.setState("ssai-ad-active",!0);const r=null===(s=e.ssai)||void 0===s?void 0:s.state;r&&(r.adProgress={currentTime:0,duration:t},L(e,r))}function N(e,t){var s;const r=null===(s=e.ssai)||void 0===s?void 0:s.state;r&&(r.adProgress=t,L(e,r))}function x(e){if(!e.ssai)return;const t=e.ssai.state;e.setState("ssai-ad-active",!1),delete t.adProgress,void 0!==t.rate&&(e.playbackRate=t.rate,delete t.rate),"number"==typeof t.snapbackTime&&(r(e,t.snapbackTime),delete t.snapbackTime)}function L(e,t){const s=e.playbackRate;1!==s&&(t.rate=s,e.playbackRate=1)}!function(e){e.Preroll="preroll",e.Midroll="midroll",e.Postroll="postroll"}(B||(B={}));const j=navigator.languages||[navigator.language];const Q="flowplayer-ssai-ui";function V(e,t){const s=new google.ima.dai.api.UiSettings,r=e.opt("lang")||function(){try{return j.reduce((e,t)=>~t.indexOf("-")?e.concat(t,t.split("-")[0]):e.concat(t),[])}catch(e){return[]}}().find(e=>!e.includes("-"))||"en";s.setLocale(r);const i=new google.ima.dai.api.StreamManager(e,function(e,t){const s=e._customElements.get(t);return s&&e.root.querySelector(s)||void 0}(e,Q),s);return i.addEventListener([google.ima.dai.api.StreamEvent.Type.LOADED,google.ima.dai.api.StreamEvent.Type.ERROR,google.ima.dai.api.StreamEvent.Type.STREAM_INITIALIZED,google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED,google.ima.dai.api.StreamEvent.Type.AD_PROGRESS,google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED,google.ima.dai.api.StreamEvent.Type.RESUMED,google.ima.dai.api.StreamEvent.Type.PAUSED,google.ima.dai.api.StreamEvent.Type.STARTED,google.ima.dai.api.StreamEvent.Type.COMPLETE,google.ima.dai.api.StreamEvent.Type.SKIPPED,google.ima.dai.api.StreamEvent.Type.CLICK],s=>{!function(e,t,s,r){var i;if((null===(i=e.ssai)||void 0===i?void 0:i.provider)!==r)return;switch(s.type){case google.ima.dai.api.StreamEvent.Type.STREAM_INITIALIZED:return async function(e,t,s,r){var i,a;const n=r.getStreamData().streamId;if(!n||!t.isPod)return;if(!t.isVod){const s=null===(i=t.src)||void 0===i?void 0:i.streamUrl;return s?(t.daiStream=t.buildPodStreamURL(s,n),e.setSrc(t.daiStream)):console.error("streamUrl param is missing : https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5?service=pod#create_a_simple_video_player_2")}const o=null===(a=t.src)||void 0===a?void 0:a.requestStreamUrl;if(!o)return console.error("requestStreamUrl param is missing : https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5?service=pod#vod-pod-serving_1");try{t.daiStream=await o(s,n),s.loadStreamMetadata(),e.setSrc(t.daiStream)}catch(s){G(e,t)}}(e,r,t,s);case google.ima.dai.api.StreamEvent.Type.RESUMED:return q("ad-resumed",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.PAUSED:return q("ad-paused",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.COMPLETE:return q("ad-completed",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.SKIPPED:return q("ad-skipped",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.LOADED:return function(e,t,s){const r=s.getStreamData().url;if(!r||t.isPod&&!t.isVod)return;t.daiStream=r,e.setSrc(r)}(e,r,s);case google.ima.dai.api.StreamEvent.Type.STARTED:return r.currentAd=s.getAd(),q("ad-started",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED:return D(e),q("ad-break-started",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED:return q(n,e,z(e,s,r)),x(e),r.currentAd=void 0;case google.ima.dai.api.StreamEvent.Type.ERROR:return G(e,r,s);case google.ima.dai.api.StreamEvent.Type.AD_PROGRESS:{const t=z(e,s,r);return N(e,t),q("ad-progress",e,t)}case google.ima.dai.api.StreamEvent.Type.CLICK:(function(e,t){if(!e.paused)e.togglePlay(!1)})(e)}}(e,i,s,t)},!1),e.on("ssai:hls:metadata",s=>{var r,a;(null===(r=e.ssai)||void 0===r?void 0:r.provider)===t&&(null===(a=s.detail)||void 0===a||a.samples.forEach(e=>i.processMetadata("ID3",e.data,e.pts)))}),e.on("ssai:dash:metadata",s=>{var r;const a=s.detail;if(!a||(null===(r=e.ssai)||void 0===r?void 0:r.provider)!==t)return;const n=a.event.messageData,o=a.event.calculatedPresentationTime;i.processMetadata("urn:google:dai:2018",n,o)}),i}function z(e,t,s){const r=s.currentAd,i=Object.assign({},t.getStreamData().adProgressData);return r&&Object.assign(i,{vast_ad_id:r.getAdId()}),(null==r?void 0:r.getAdPodInfo())&&Object.assign(i,{position:r.getAdPodInfo().getAdPosition(),totals:r.getAdPodInfo().getTotalAds()}),i}function G(e,t,s){var r,i;if(null===(r=t.src)||void 0===r?void 0:r.backupStream)return e.setSrc(t.src.backupStream);e.emit("error",{message:(null===(i=null==s?void 0:s.getStreamData())||void 0===i?void 0:i.errorMessage)||"error loading stream"})}const W=d("ads/ima/sdk");var H;async function K(e,t){var s;const r=null===(s=null===window||void 0===window?void 0:window.google)||void 0===s?void 0:s.ima;if(t?null==r?void 0:r.dai:r)return void W(":noop");const i=t?"https://imasdk.googleapis.com/js/sdkloader/ima3_dai.js":e._storage.getItem("ima/debug")?"https://imasdk.googleapis.com/js/sdkloader/ima3_debug.js":"https://imasdk.googleapis.com/js/sdkloader/ima3.js";try{return await async function(e){return new Promise((t,s)=>{let r=document.querySelector(`script[src='${e}']`);if(r)return Y(r,t,s);r=document.createElement("script"),r.setAttribute("state",H.LOADING),Y(r,t,s),r.src=e,document.head.appendChild(r)})}(i),void W(":loaded")}catch(e){W(":error "+e.message,e)}}function Y(e,t,s){const r=e.getAttribute("state");if(r&&[H.ERROR,H.LOADED].includes(r))return t(void 0);e.addEventListener("load",()=>{e.setAttribute("state",H.LOADED),t(void 0)},{once:!0}),["error","abort"].forEach(t=>{e.addEventListener(t,()=>{e.setAttribute("state",H.ERROR),s("script failed to load")},{once:!0})})}!function(e){e.LOADING="loading",e.LOADED="loaded",e.ERROR="error"}(H||(H={}));class Dai{constructor(e){this.make_analytics(e)}async onload(e,t){var s,r;return await K(e,!0),(null===(r=null===(s=window.google)||void 0===s?void 0:s.ima)||void 0===r?void 0:r.dai)?((null==this?void 0:this.streamManager)||(this.streamManager=V(e,this)),this.src=t,this.isPod=!!t.customAssetKey||!!t.requestStreamUrl,this.isVod=!!t.contentSourceId||!!t.videoId||!!t.requestStreamUrl,this.isPod?this.requestPodStream(t):void this.requestStream(t)):(console.warn("google.ima.dai unavailable"),void(t.backupStream&&e.setSrc(t.backupStream)))}onNewSrc(e,t){var s;t.src!==this.daiStream&&(this.daiStream=void 0,e.ssai=void 0,null===(s=this.streamManager)||void 0===s||s.reset())}make_analytics(e){const t=Analytics.of(e,{required_keys:R,events:U,optional_keys:P});e.on("config",()=>{var s;return Analytics.mergeMetadata(t,null===(s=e.opts)||void 0===s?void 0:s.metadata)})}onId3(e){var t;const s={},r=e.value;s[r.key]=r.data,null===(t=this.streamManager)||void 0===t||t.onTimedMetadata(s)}getAdType(){if(this.currentAd)switch(this.currentAd.getAdPodInfo().getPodIndex()){case 0:return B.Preroll;case-1:return B.Postroll;case-2:return;default:return B.Midroll}}getContentCurrentTime(e){const t=e.currentTime;return this.streamManager?this.streamManager.contentTimeForStreamTime(t):t}setContentCurrentTime(e,t){}getContentDuration(e){const t=e.duration;return this.streamManager?this.streamManager.contentTimeForStreamTime(t):t}getPreviousActiveAdStart(e,t){var s;const r=null===(s=null==this?void 0:this.streamManager)||void 0===s?void 0:s.previousCuePointForStreamTime(t);if(r&&!r.played)return r.start}requestStream(e){var t;const s=this.isVod?new google.ima.dai.api.VODStreamRequest:new google.ima.dai.api.LiveStreamRequest;null===(t=this.streamManager)||void 0===t||t.requestStream(Object.assign(s,e))}requestPodStream(e){var t;const s=this.isVod?new google.ima.dai.api.PodVodStreamRequest:new google.ima.dai.api.PodStreamRequest;null===(t=this.streamManager)||void 0===t||t.requestStream(Object.assign(s,e))}buildPodStreamURL(e,t){return e.replace("[[STREAMID]]",t)}}Dai.Type="google/dai";const $=window.YospaceAdManagement||{AnalyticEventObserver:null};class EventObserver extends $.AnalyticEventObserver{constructor(e){super(),this.video=e}onAdvertBreakStart(e){const t=e.getDuration();if(!e.isActive()&&t){const e=s(this.video);r(this.video,e+t/1e3)}D(this.video,e.getStart()),q("ad-break-started",this.video)}onAdvertBreakEnd(){x(this.video),q(n,this.video)}onAdvertStart(e){}onAdvertEnd(){}onTrackingEvent(e){}}function Z(e,t){YospaceAdManagement.SessionVOD.create(e,t.ssai.properties,e=>{const r=e.getPayload();if(r.getSessionResult()===YospaceAdManagement.SessionResult.INITIALISED){t.ssai.session=r;const e=new EventObserver(t);r.addAnalyticObserver(e),t.setSrc({src:r.getPlaybackUrl()}),setInterval(()=>{const e=1e3*s(t);r.onPlayheadUpdate(e),function(e,t,s){const r=e.getCurrentAdBreak();if(!r)return;const i={currentTime:s-r.getStart(),duration:r.getDuration()};N(t,i),q("ad-progress",t,i)}(r,t,e)},250)}else console.warn("YoSpace Failed to initialise session. ResultCode = "+r.getResultCode())})}class Yospace{static exists(){return!!window.YospaceAdManagement}constructor(e){!function(e){Object.defineProperty(e,"currentTime",{get:function(){if(e.ssai){const t=e.ssai.state.adProgress;return t?t.currentTime:e.ssai.provider.getContentCurrentTime(e)}return s(e)},set:function(t){var s;if(e.ssai){if(e.ssai.state.adProgress)return;return null===(s=e.ssai.provider)||void 0===s?void 0:s.setContentCurrentTime(e,t)}return r(e,t)}}),Object.defineProperty(e,"duration",{get:function(){if(e.ssai){const t=e.ssai.state.adProgress;return t?t.duration:e.ssai.provider.getContentDuration(e)}return a(e)},set:function(){}})}(e)}onload(e,t){Object.assign(e.ssai,function(){const e=new YospaceAdManagement.SessionProperties;return e.setUserAgent(navigator.userAgent),{properties:e}}()),t&&t.src&&Z(t.src,e)}getContentCurrentTime(e){const t=s(e),r=e.ssai.session;return r?r.getContentPositionForPlayhead(1e3*t)/1e3:t}setContentCurrentTime(e,t){const s=e.ssai.session;if(!s)return r(e,t);return r(e,s.getPlayheadForContentPosition(1e3*t)/1e3)}getContentDuration(e){const t=e.ssai.session,s=a(e);return t?t.getContentPositionForPlayhead(t.getDuration())/1e3:s}getAdType(){}getPreviousActiveAdStart(e,t){const s=e.ssai.session;if(!s)return;const r=s.getAdBreaks();let i;const a=1e3*t;return r.forEach(e=>{void 0===i&&e.getStart()<a&&e.isActive()&&(i=e)}),void 0!==i?i.getStart()/1e3:void 0}}function X(e){var t;if((null===(t=this.player.ssai)||void 0===t?void 0:t.provider)===this)switch(e.type){case"playing":case"pause":return function(e){if(!e.player.hasState("ssai-ad-active"))return;return q(e.player.paused?"ad-paused":"ad-resumed",e.player)}(this);case"progress":return function(e){const t=e.player,s=t.hls;if(!s)return;if(t.hasState("ssai-ad-active"))return s.config.maxBufferLength=1;const r=t.currentTime;let i,a=0;for(;a<t.buffered.length;a++)if(t.buffered.start(a)-1<=r&&t.buffered.end(a)>=r){i=t.buffered.end(a);break}if(void 0===i)return;const n=e.getAdCues().find(e=>!e.played&&e.endTime>i&&e.startTime<=i);return s.config.maxBufferLength=n?1:30}(this);case"timeupdate":return function(e){if(!e.activeCue||!e.player.hasState("ssai-ad-active"))return;const t=e.player.currentTime;if(t<=e.activeCue.endTime)return e.ad={duration:e.activeCue.endTime-e.activeCue.startTime,currentTime:t-e.activeCue.startTime},q("ad-progress",e.player,Object.assign(Object.assign({},e.ad),e.podInfo));if(e.podInfo.totals!==e.podInfo.position)return;q("ad-completed",e.player),q(n,e.player),x(e.player),e.activeCue.played=!0,e.activeCue=void 0}(this)}}Yospace.Type="yospace";class MediaTailor{constructor(e){this.ad={duration:0,currentTime:0},this.podInfo={totals:0,position:0},this.player=e,e.on(["timeupdate","progress","playing","pause"],X.bind(this))}onload(e,t){this.stream=t.stream,e.setSrc(t.stream)}onNewSrc(e,t){t.src!==this.stream&&(this.activeCue=void 0,e.ssai=void 0)}getPreviousActiveAdStart(e,t){const s=this.getAdCues(),r=s.slice().reverse().find(e=>e.endTime<t);if(!r||r.played)return;const i=s[s.indexOf(r)+1];return!i||t<i.startTime&&(t+.1<=i.startTime||i.played||e.paused)?this.findAdBreakStartCue(r).startTime:void 0}onId3(e){var t;if(e.played||e==this.activeCue)return;if("X-AD-CREATIVE-SIGNALING"!==(null===(t=e.value)||void 0===t?void 0:t.key))return;if(this.activeCue)return q("ad-completed",this.player),this.activeCue.played=!0,this.activeCue=e,++this.podInfo.position,q("ad-started",this.player,Object.assign(Object.assign({},this.ad),this.podInfo));const s=this.findAdBreakStartCue(e);if(s!==e)return this.player.currentTime=s.startTime;Math.abs(e.startTime-this.player.currentTime)>1&&(this.player.currentTime=e.startTime),this.activeCue=e,D(this.player),this.setPodInfo(e),q("ad-break-started",this.player),q("ad-started",this.player,Object.assign(Object.assign({},this.ad),this.podInfo))}setPodInfo(e){const t=this.getAdCues().filter(t=>t.startTime>=e.startTime);let s=1;for(;s<=t.length-1&&!(t[s].startTime-t[s-1].endTime>1);)s++;return this.podInfo={totals:s,position:1},this.player.hasState("is-live")?this.ad_type=B.Midroll:e.startTime<=1?this.ad_type=B.Preroll:Math.abs(t[s-1].endTime-this.player.duration)<=1?this.ad_type=B.Postroll:this.ad_type=B.Midroll}findAdBreakStartCue(e){const t=this.getAdCues().filter(t=>t.startTime<=e.startTime).reverse();let s=e,r=1;for(;r<t.length&&!(t[r-1].startTime-t[r].endTime>.1);)s=t[r],r++;return s}getAdCues(){var e;const t=(null===(e=Array.from(this.player.textTracks).find(e=>"metadata"===e.kind))||void 0===e?void 0:e.cues)||[];return Array.from(t).slice().filter(e=>{var t;return"X-AD-CREATIVE-SIGNALING"===(null===(t=e.value)||void 0===t?void 0:t.key)})}getContentCurrentTime(e){if(!this.activeCue)return 0;let t=this.findAdBreakStartCue(this.activeCue).startTime;return this.getAdCues().filter(e=>e.endTime<t).forEach(e=>{t-=e.endTime-e.startTime}),t}getAdType(){return this.ad_type}getContentDuration(e){return 0}setContentCurrentTime(e,t){}}MediaTailor.Type="mediaTailor";const J=(e,t)=>new(((e,t)=>{const s=e.get(t);if(!s)throw new Error(`no flowplayer component with the name ${t} exists`);const r=window.customElements.get(t);if(!r)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(s);return"function"!=typeof i?r:i})(e._customElements,t))(e),ee=(e,t,s)=>{window.customElements.get(t)||window.customElements.define(t,s),e.customElements.get(t)||e.customElements.set(t,t)};class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class SSAIAdUi extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-ui",this.append(...this.player.createComponents("flowplayer-ssai-indicator","flowplayer-ssai-timeline","flowplayer-ssai-controls"))}}class SSAITimeline extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-timeline";const t=document.createElement("div");t.className="fp-ssai-progress",this.append(t),this.player.on(n,()=>{t.classList.remove("go"),"--ssai-percent-complete --ssai-percent-previous".split(" ").forEach(e=>this.style.setProperty(e,"0"))}),this.player.on("ad-progress",e=>{var s,r;const i=null===(s=e.detail)||void 0===s?void 0:s.currentTime,a=null===(r=e.detail)||void 0===r?void 0:r.duration;if(void 0===a||void 0===i)return;const n=i/a*100,o=t.style.getPropertyValue("--ssai-percent-complete");t.classList.remove("go"),t.style.setProperty("--ssai-percent-previous",o),t.style.setProperty("--ssai-percent-complete",n.toFixed(3)),t.classList.add("go")})}}function te(e){const t="number"==typeof e?e:parseInt(e,10);return(t>9?"":"0")+t}class SSAIControls extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-controls",this.createLeftZone(),this.createRightZone()}createRightZone(){const e=document.createElement("div");e.className="fp-ssai-right-zone",e.append(...this.player.createComponents("flowplayer-volume-control"),...this.fsIcons()),this.append(e)}createLeftZone(){const e=document.createElement("div");e.className="fp-ssai-left-zone",e.append(...this.player.createComponents("flowplayer-control-buttons"),this.remainingTimeComponent()),this.append(e)}fsIcons(){return this.player.createComponents("flowplayer-fullscreen-enter-icon","flowplayer-fullscreen-exit-icon").map(e=>(e.onclick=()=>this.player.toggleFullScreen(),e))}remainingTimeComponent(){const e=document.createElement("div");return e.className="fp-ssai-remaining",this.player.on("ad-progress",t=>{var s;const r=null===(s=t.detail)||void 0===s?void 0:s.remaining;void 0!==r&&(e.textContent=function(e){if(isNaN(e)||e>=Number.MAX_SAFE_INTEGER)return"";const t=e<0?"-":"";e=Math.round(Math.abs(e));const s=Math.floor(e/3600);let r=Math.floor(e/60);return e-=60*r,s>=1?(r-=60*s,t+s+":"+te(r)+":"+te(e)):t+te(r)+":"+te(e)}(r))}),e}}class SSAIAdIndicator extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-indicator",this.player.on("ad-started",e=>{var t,s;const r=null===(t=e.detail)||void 0===t?void 0:t.totals,i=null===(s=e.detail)||void 0===s?void 0:s.position;void 0!==r&&void 0!==i&&(this.textContent=`${this.player.i18n("ads.indicator","ADS")} ${i} / ${r}`)})}}var se,re=Object.freeze({__proto__:null,ID3:"ID3"});const ie=((se=class ID3{init(e,t,s){s.textTracks.addEventListener("addtrack",({track:e})=>{if(e&&"metadata"===e.kind)return"id3"==e.id||"id3"==e.label||"com.apple.streaming"==e.inBandMetadataTrackDispatchType?function(e,t){t.mode="hidden",t.addEventListener("cuechange",async()=>{Array.from(t.activeCues||[]).forEach(async t=>{(function(e){return"object"==typeof e.value&&"string"==typeof e.value.key&&!!e.value.data})(t)&&e.emit("ID3",{cue:t})})})}(s,e):void 0})}}).events=re,se),ae=e(window,ie);var ne;const oe=((ne=class Ssai{constructor(e,t){this.umd=e,this.providers=[],this.player=t,ee(e,Q,SSAIAdUi),ee(e,"flowplayer-ssai-timeline",SSAITimeline),ee(e,"flowplayer-ssai-controls",SSAIControls),ee(e,"flowplayer-ssai-indicator",SSAIAdIndicator)}init(e,t,i){const a=J(i,Q);if(t.append(a),i.on(ae.events.ID3,({detail:e})=>{var t,s,r;const a=null==e?void 0:e.cue;a&&(null===(r=null===(t=i.ssai)||void 0===t?void 0:(s=t.provider).onId3)||void 0===r||r.call(s,a))}),i.on("seeked",()=>function(e){if(e.opt("live"))return;if(!e.ssai)return;const{provider:t,state:i}=e.ssai;if(i.snapback)return i.snapback=!1;const a=s(e),n=t.getPreviousActiveAdStart(e,a);void 0!==n&&(i.snapback=!0,i.snapbackTime=a,r(e,n))}(i)),i.on("src",e=>{var t,s,r;i.setState("ssai-ad-active",!1),null===(r=null===(s=null===(t=i.ssai)||void 0===t?void 0:t.provider)||void 0===s?void 0:s.onNewSrc)||void 0===r||r.call(s,i,e.detail)}),this.umd.extensions.find(e=>e.name===ae.name))return;new ae(this.umd,i).init(e,t,i)}onload(e,t,s,r){var i,a;null===(a=null===(i=s.ssai)||void 0===i?void 0:i.provider)||void 0===a||a.onload(s,r)}wants(e,t,s){return!!this.findProvider(t)}findProvider(e){let t=void 0;switch(e.type){case MediaTailor.Type:t=this.providers.find(e=>e instanceof MediaTailor)||new MediaTailor(this.player);break;case Dai.Type:t=this.providers.find(e=>e instanceof Dai)||new Dai(this.player);break;case Yospace.Type:Yospace.exists()&&(t=this.providers.find(e=>e instanceof Yospace)||new Yospace(this.player))}return t&&(this.player.ssai={provider:t,state:{snapback:!1}},this.providers.includes(t)||this.providers.push(t)),t}}).events=o,ne);return e(window,oe)}));
7
+ */const S=class Bowser{static getParser(e,t=!1){if("string"!=typeof e)throw new Error("UserAgent should be a string");return new Parser(e,t)}static parse(e){return new Parser(e).getResult()}static get BROWSER_MAP(){return u}static get ENGINE_MAP(){return g}static get OS_MAP(){return m}static get PLATFORMS_MAP(){return p}}.parse(window.navigator.userAgent),{platform:w,os:_,browser:M}=S,A=e=>e&&e.toLowerCase();var T={rnd:Math.random().toString(36).substr(2,32),os:A(_.name+(_.versionName?" "+_.versionName:"")),device:A(w.type),browser:A(M.name),browser_version:(M&&M.version?M.version:"unknown").split(".").shift(),plugin_version:"3.23.0"};const E="https://fp-eu-w1-aai.flowplayer.com/in",k="POST",U=["ad-requested","ad-request-error","ad-request-completed","ad-completed","ad-started","ad-error","ad-skipped"],R=["event_type","ad_tag_id","media_id","player_id","site_id","sitegroup_id","rnd","os","device","browser","browser_version","plugin_version","player_version"],P=["vast_error","reason","request_load_time","ad_type","vast_ad_id"],O=d("ads/analytics"),C=RequestQueue.of(),F=(...e)=>Object.assign({},...e);class Analytics{static of(e,t){return new Analytics(e,t)}static ensure_required_keys(e,t){return e.required_keys.filter(e=>!(e in t))}static pluck_valid_keys(e,t){return((e,...t)=>Object.keys(e).filter(e=>~t.indexOf(e)).reduce((t,s)=>Object.assign(t,{[s]:e[s]}),{}))(t,...e.valid_keys)}static mergeMetadata(e,t={}){return e.metadata=Analytics.pluck_valid_keys(e,F(e.metadata,t,{player_version:"3.23.0"})),e}constructor(e,t={}){this.emitter=e,this.metadata=F(T,t.metadata||{}),this.emitter=e,this.events=t.events||[],this.required_keys=t.required_keys||[],this.optional_keys=t.optional_keys||[],this.valid_keys=this.required_keys.slice(0).concat(this.optional_keys),O(this),this.wireup()}wireup(){this.events.forEach(e=>{this.emitter.on(e,t=>{const s=t.detail,r=F(this.metadata,{event_type:e},s),i=Analytics.pluck_valid_keys(this,r),a=Analytics.ensure_required_keys(this,i);if(O(`Event[${e}]`,{payload:i,observation:s}),a.length)return O(`Analytics.validate_metadata() failed for\n Event[${e}]\n missing keys: ${a}`,i);RequestQueue.rpush(C,[E,k,i])})})}destroy(){this.emitter=this.metadata=this.events=this.required_keys=this.optional_keys=this.valid_keys=void 0}}var B;function I(e,t){var s;switch(t){case B.Preroll:return 0;case B.Postroll:return-1;default:return null===(s=e.ssai)||void 0===s?void 0:s.provider.getContentCurrentTime(e)}}function q(e,t,s){var r,i,a,n;const o=null===(r=t.ssai)||void 0===r?void 0:r.provider.getAdType(),d=null===(n=null===(a=null===(i=t.ssai)||void 0===i?void 0:i.provider)||void 0===a?void 0:a.src)||void 0===n?void 0:n.analyticsId,c={ad_break_time:I(t,o),ad_muted:t.muted,event_type:e,is_ssai:!0};o&&Object.assign(c,{ad_type:o}),d&&Object.assign(c,{ad_tag_id:d}),s&&"duration"in s&&Object.assign(c,{ad_remaining_seconds:s.duration-s.currentTime,ad_duration_seconds:s.duration}),t.emit("health:record",{event:"ads/"+e,detail:c}),t.emit(e,Object.assign(c,s))}function D(e,t){var s;e.setState("ssai-ad-active",!0);const r=null===(s=e.ssai)||void 0===s?void 0:s.state;r&&(r.adProgress={currentTime:0,duration:t},L(e,r))}function N(e,t){var s;const r=null===(s=e.ssai)||void 0===s?void 0:s.state;r&&(r.adProgress=t,L(e,r))}function x(e){if(!e.ssai)return;const t=e.ssai.state;e.setState("ssai-ad-active",!1),delete t.adProgress,void 0!==t.rate&&(e.playbackRate=t.rate,delete t.rate),"number"==typeof t.snapbackTime&&(r(e,t.snapbackTime),delete t.snapbackTime)}function L(e,t){const s=e.playbackRate;1!==s&&(t.rate=s,e.playbackRate=1)}!function(e){e.Preroll="preroll",e.Midroll="midroll",e.Postroll="postroll"}(B||(B={}));const j=navigator.languages||[navigator.language];const Q="flowplayer-ssai-ui";function V(e,t){const s=new google.ima.dai.api.UiSettings,r=e.opt("lang")||function(){try{return j.reduce((e,t)=>~t.indexOf("-")?e.concat(t,t.split("-")[0]):e.concat(t),[])}catch(e){return[]}}().find(e=>!e.includes("-"))||"en";s.setLocale(r);const i=new google.ima.dai.api.StreamManager(e,function(e,t){const s=e._customElements.get(t);return s&&e.root.querySelector(s)||void 0}(e,Q),s);return i.addEventListener([google.ima.dai.api.StreamEvent.Type.LOADED,google.ima.dai.api.StreamEvent.Type.ERROR,google.ima.dai.api.StreamEvent.Type.STREAM_INITIALIZED,google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED,google.ima.dai.api.StreamEvent.Type.AD_PROGRESS,google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED,google.ima.dai.api.StreamEvent.Type.RESUMED,google.ima.dai.api.StreamEvent.Type.PAUSED,google.ima.dai.api.StreamEvent.Type.STARTED,google.ima.dai.api.StreamEvent.Type.COMPLETE,google.ima.dai.api.StreamEvent.Type.SKIPPED,google.ima.dai.api.StreamEvent.Type.CLICK],s=>{!function(e,t,s,r){var i;if((null===(i=e.ssai)||void 0===i?void 0:i.provider)!==r)return;switch(s.type){case google.ima.dai.api.StreamEvent.Type.STREAM_INITIALIZED:return async function(e,t,s,r){var i,a;const n=r.getStreamData().streamId;if(!n||!t.isPod)return;if(!t.isVod){const s=null===(i=t.src)||void 0===i?void 0:i.streamUrl;return s?(t.daiStream=t.buildPodStreamURL(s,n),e.setSrc(t.daiStream)):console.error("streamUrl param is missing : https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5?service=pod#create_a_simple_video_player_2")}const o=null===(a=t.src)||void 0===a?void 0:a.requestStreamUrl;if(!o)return console.error("requestStreamUrl param is missing : https://developers.google.com/ad-manager/dynamic-ad-insertion/sdk/html5?service=pod#vod-pod-serving_1");try{t.daiStream=await o(s,n),s.loadStreamMetadata(),e.setSrc(t.daiStream)}catch(s){G(e,t)}}(e,r,t,s);case google.ima.dai.api.StreamEvent.Type.RESUMED:return q("ad-resumed",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.PAUSED:return q("ad-paused",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.COMPLETE:return q("ad-completed",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.SKIPPED:return q("ad-skipped",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.LOADED:return function(e,t,s){const r=s.getStreamData().url;if(!r||t.isPod&&!t.isVod)return;t.daiStream=r,e.setSrc(r)}(e,r,s);case google.ima.dai.api.StreamEvent.Type.STARTED:return r.currentAd=s.getAd(),q("ad-started",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.AD_BREAK_STARTED:return D(e),q("ad-break-started",e,z(e,s,r));case google.ima.dai.api.StreamEvent.Type.AD_BREAK_ENDED:return q(n,e,z(e,s,r)),x(e),r.currentAd=void 0;case google.ima.dai.api.StreamEvent.Type.ERROR:return G(e,r,s);case google.ima.dai.api.StreamEvent.Type.AD_PROGRESS:{const t=z(e,s,r);return N(e,t),q("ad-progress",e,t)}case google.ima.dai.api.StreamEvent.Type.CLICK:(function(e,t){if(!e.paused)e.togglePlay(!1)})(e)}}(e,i,s,t)},!1),e.on("ssai:hls:metadata",s=>{var r,a;(null===(r=e.ssai)||void 0===r?void 0:r.provider)===t&&(null===(a=s.detail)||void 0===a||a.samples.forEach(e=>i.processMetadata("ID3",e.data,e.pts)))}),e.on("ssai:dash:metadata",s=>{var r;const a=s.detail;if(!a||(null===(r=e.ssai)||void 0===r?void 0:r.provider)!==t)return;const n=a.event.messageData,o=a.event.calculatedPresentationTime;i.processMetadata("urn:google:dai:2018",n,o)}),i}function z(e,t,s){const r=s.currentAd,i=Object.assign({},t.getStreamData().adProgressData);return r&&Object.assign(i,{vast_ad_id:r.getAdId()}),(null==r?void 0:r.getAdPodInfo())&&Object.assign(i,{position:r.getAdPodInfo().getAdPosition(),totals:r.getAdPodInfo().getTotalAds()}),i}function G(e,t,s){var r,i;if(null===(r=t.src)||void 0===r?void 0:r.backupStream)return e.setSrc(t.src.backupStream);e.emit("error",{message:(null===(i=null==s?void 0:s.getStreamData())||void 0===i?void 0:i.errorMessage)||"error loading stream"})}var W;!function(e){e.Preroll="preroll",e.Midroll="midroll",e.Postroll="postroll"}(W||(W={}));const H=d("ads/ima/sdk");var K;async function Y(e,t){var s;const r=null===(s=null===window||void 0===window?void 0:window.google)||void 0===s?void 0:s.ima;if(t?null==r?void 0:r.dai:r)return void H(":noop");const i=t?"https://imasdk.googleapis.com/js/sdkloader/ima3_dai.js":e._storage.getItem("ima/debug")?"https://imasdk.googleapis.com/js/sdkloader/ima3_debug.js":"https://imasdk.googleapis.com/js/sdkloader/ima3.js";try{return await async function(e){return new Promise((t,s)=>{let r=document.querySelector(`script[src='${e}']`);if(r)return $(r,t,s);r=document.createElement("script"),r.setAttribute("state",K.LOADING),$(r,t,s),r.src=e,document.head.appendChild(r)})}(i),void H(":loaded")}catch(e){H(":error "+e.message,e)}}function $(e,t,s){const r=e.getAttribute("state");if(r&&[K.ERROR,K.LOADED].includes(r))return t(void 0);e.addEventListener("load",()=>{e.setAttribute("state",K.LOADED),t(void 0)},{once:!0}),["error","abort"].forEach(t=>{e.addEventListener(t,()=>{e.setAttribute("state",K.ERROR),s("script failed to load")},{once:!0})})}!function(e){e.LOADING="loading",e.LOADED="loaded",e.ERROR="error"}(K||(K={}));class Dai{constructor(e){this.make_analytics(e)}async onload(e,t){var s,r;return await Y(e,!0),(null===(r=null===(s=window.google)||void 0===s?void 0:s.ima)||void 0===r?void 0:r.dai)?((null==this?void 0:this.streamManager)||(this.streamManager=V(e,this)),this.src=t,this.isPod=!!t.customAssetKey||!!t.requestStreamUrl,this.isVod=!!t.contentSourceId||!!t.videoId||!!t.requestStreamUrl,this.isPod?this.requestPodStream(t):void this.requestStream(t)):(console.warn("google.ima.dai unavailable"),void(t.backupStream&&e.setSrc(t.backupStream)))}onNewSrc(e,t){var s;t.src!==this.daiStream&&(this.daiStream=void 0,e.ssai=void 0,null===(s=this.streamManager)||void 0===s||s.reset())}make_analytics(e){const t=Analytics.of(e,{required_keys:R,events:U,optional_keys:P});e.on("config",()=>{var s;return Analytics.mergeMetadata(t,null===(s=e.opts)||void 0===s?void 0:s.metadata)})}onId3(e){var t;const s={},r=e.value;s[r.key]=r.data,null===(t=this.streamManager)||void 0===t||t.onTimedMetadata(s)}getAdType(){if(this.currentAd)switch(this.currentAd.getAdPodInfo().getPodIndex()){case 0:return W.Preroll;case-1:return W.Postroll;case-2:return;default:return W.Midroll}}getContentCurrentTime(e){const t=e.currentTime;return this.streamManager?this.streamManager.contentTimeForStreamTime(t):t}setContentCurrentTime(e,t){}getContentDuration(e){const t=e.duration;return this.streamManager?this.streamManager.contentTimeForStreamTime(t):t}getPreviousActiveAdStart(e,t){var s;const r=null===(s=null==this?void 0:this.streamManager)||void 0===s?void 0:s.previousCuePointForStreamTime(t);if(r&&!r.played)return r.start}requestStream(e){var t;const s=this.isVod?new google.ima.dai.api.VODStreamRequest:new google.ima.dai.api.LiveStreamRequest;null===(t=this.streamManager)||void 0===t||t.requestStream(Object.assign(s,e))}requestPodStream(e){var t;const s=this.isVod?new google.ima.dai.api.PodVodStreamRequest:new google.ima.dai.api.PodStreamRequest;null===(t=this.streamManager)||void 0===t||t.requestStream(Object.assign(s,e))}buildPodStreamURL(e,t){return e.replace("[[STREAMID]]",t)}}Dai.Type="google/dai";const Z=window.YospaceAdManagement||{AnalyticEventObserver:null};class EventObserver extends Z.AnalyticEventObserver{constructor(e){super(),this.video=e}onAdvertBreakStart(e){const t=e.getDuration();if(!e.isActive()&&t){const e=s(this.video);r(this.video,e+t/1e3)}D(this.video,e.getStart()),q("ad-break-started",this.video)}onAdvertBreakEnd(){x(this.video),q(n,this.video)}onAdvertStart(e){}onAdvertEnd(){}onTrackingEvent(e){}}function X(e,t){YospaceAdManagement.SessionVOD.create(e,t.ssai.properties,e=>{const r=e.getPayload();if(r.getSessionResult()===YospaceAdManagement.SessionResult.INITIALISED){t.ssai.session=r;const e=new EventObserver(t);r.addAnalyticObserver(e),t.setSrc({src:r.getPlaybackUrl()}),setInterval(()=>{const e=1e3*s(t);r.onPlayheadUpdate(e),function(e,t,s){const r=e.getCurrentAdBreak();if(!r)return;const i={currentTime:s-r.getStart(),duration:r.getDuration()};N(t,i),q("ad-progress",t,i)}(r,t,e)},250)}else console.warn("YoSpace Failed to initialise session. ResultCode = "+r.getResultCode())})}class Yospace{static exists(){return!!window.YospaceAdManagement}constructor(e){!function(e){Object.defineProperty(e,"currentTime",{get:function(){if(e.ssai){const t=e.ssai.state.adProgress;return t?t.currentTime:e.ssai.provider.getContentCurrentTime(e)}return s(e)},set:function(t){var s;if(e.ssai){if(e.ssai.state.adProgress)return;return null===(s=e.ssai.provider)||void 0===s?void 0:s.setContentCurrentTime(e,t)}return r(e,t)}}),Object.defineProperty(e,"duration",{get:function(){if(e.ssai){const t=e.ssai.state.adProgress;return t?t.duration:e.ssai.provider.getContentDuration(e)}return a(e)},set:function(){}})}(e)}onload(e,t){Object.assign(e.ssai,function(){const e=new YospaceAdManagement.SessionProperties;return e.setUserAgent(navigator.userAgent),{properties:e}}()),t&&t.src&&X(t.src,e)}getContentCurrentTime(e){const t=s(e),r=e.ssai.session;return r?r.getContentPositionForPlayhead(1e3*t)/1e3:t}setContentCurrentTime(e,t){const s=e.ssai.session;if(!s)return r(e,t);return r(e,s.getPlayheadForContentPosition(1e3*t)/1e3)}getContentDuration(e){const t=e.ssai.session,s=a(e);return t?t.getContentPositionForPlayhead(t.getDuration())/1e3:s}getAdType(){}getPreviousActiveAdStart(e,t){const s=e.ssai.session;if(!s)return;const r=s.getAdBreaks();let i;const a=1e3*t;return r.forEach(e=>{void 0===i&&e.getStart()<a&&e.isActive()&&(i=e)}),void 0!==i?i.getStart()/1e3:void 0}}function J(e){var t;if((null===(t=this.player.ssai)||void 0===t?void 0:t.provider)===this)switch(e.type){case"playing":case"pause":return function(e){if(!e.player.hasState("ssai-ad-active"))return;return q(e.player.paused?"ad-paused":"ad-resumed",e.player)}(this);case"progress":return function(e){const t=e.player,s=t.hls;if(!s)return;if(t.hasState("ssai-ad-active"))return s.config.maxBufferLength=1;const r=t.currentTime;let i,a=0;for(;a<t.buffered.length;a++)if(t.buffered.start(a)-1<=r&&t.buffered.end(a)>=r){i=t.buffered.end(a);break}if(void 0===i)return;const n=e.getAdCues().find(e=>!e.played&&e.endTime>i&&e.startTime<=i);return s.config.maxBufferLength=n?1:30}(this);case"timeupdate":return function(e){if(!e.activeCue||!e.player.hasState("ssai-ad-active"))return;const t=e.player.currentTime;if(t<=e.activeCue.endTime)return e.ad={duration:e.activeCue.endTime-e.activeCue.startTime,currentTime:t-e.activeCue.startTime},q("ad-progress",e.player,Object.assign(Object.assign({},e.ad),e.podInfo));if(e.podInfo.totals!==e.podInfo.position)return;q("ad-completed",e.player),q(n,e.player),x(e.player),e.activeCue.played=!0,e.activeCue=void 0}(this)}}Yospace.Type="yospace";class MediaTailor{constructor(e){this.ad={duration:0,currentTime:0},this.podInfo={totals:0,position:0},this.player=e,e.on(["timeupdate","progress","playing","pause"],J.bind(this))}onload(e,t){this.stream=t.stream,e.setSrc(t.stream)}onNewSrc(e,t){t.src!==this.stream&&(this.activeCue=void 0,e.ssai=void 0)}getPreviousActiveAdStart(e,t){const s=this.getAdCues(),r=s.slice().reverse().find(e=>e.endTime<t);if(!r||r.played)return;const i=s[s.indexOf(r)+1];return!i||t<i.startTime&&(t+.1<=i.startTime||i.played||e.paused)?this.findAdBreakStartCue(r).startTime:void 0}onId3(e){var t;if(e.played||e==this.activeCue)return;if("X-AD-CREATIVE-SIGNALING"!==(null===(t=e.value)||void 0===t?void 0:t.key))return;if(this.activeCue)return q("ad-completed",this.player),this.activeCue.played=!0,this.activeCue=e,++this.podInfo.position,q("ad-started",this.player,Object.assign(Object.assign({},this.ad),this.podInfo));const s=this.findAdBreakStartCue(e);if(s!==e)return this.player.currentTime=s.startTime;Math.abs(e.startTime-this.player.currentTime)>1&&(this.player.currentTime=e.startTime),this.activeCue=e,D(this.player),this.setPodInfo(e),q("ad-break-started",this.player),q("ad-started",this.player,Object.assign(Object.assign({},this.ad),this.podInfo))}setPodInfo(e){const t=this.getAdCues().filter(t=>t.startTime>=e.startTime);let s=1;for(;s<=t.length-1&&!(t[s].startTime-t[s-1].endTime>1);)s++;return this.podInfo={totals:s,position:1},this.player.hasState("is-live")?this.ad_type=B.Midroll:e.startTime<=1?this.ad_type=B.Preroll:Math.abs(t[s-1].endTime-this.player.duration)<=1?this.ad_type=B.Postroll:this.ad_type=B.Midroll}findAdBreakStartCue(e){const t=this.getAdCues().filter(t=>t.startTime<=e.startTime).reverse();let s=e,r=1;for(;r<t.length&&!(t[r-1].startTime-t[r].endTime>.1);)s=t[r],r++;return s}getAdCues(){var e;const t=(null===(e=Array.from(this.player.textTracks).find(e=>"metadata"===e.kind))||void 0===e?void 0:e.cues)||[];return Array.from(t).slice().filter(e=>{var t;return"X-AD-CREATIVE-SIGNALING"===(null===(t=e.value)||void 0===t?void 0:t.key)})}getContentCurrentTime(e){if(!this.activeCue)return 0;let t=this.findAdBreakStartCue(this.activeCue).startTime;return this.getAdCues().filter(e=>e.endTime<t).forEach(e=>{t-=e.endTime-e.startTime}),t}getAdType(){return this.ad_type}getContentDuration(e){return 0}setContentCurrentTime(e,t){}}MediaTailor.Type="mediaTailor";const ee=(e,t)=>new(((e,t)=>{const s=e.get(t);if(!s)throw new Error(`no flowplayer component with the name ${t} exists`);const r=window.customElements.get(t);if(!r)throw new Error(`no default flowplayer component with the name ${t} exists`);const i=window.customElements.get(s);return"function"!=typeof i?r:i})(e._customElements,t))(e),te=(e,t,s)=>{window.customElements.get(t)||window.customElements.define(t,s),e.customElements.get(t)||e.customElements.set(t,t)};class FlowplayerComponent extends HTMLElement{constructor(e){super(),this.player=e}}class SSAIAdUi extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-ui",this.append(...this.player.createComponents("flowplayer-ssai-indicator","flowplayer-ssai-timeline","flowplayer-ssai-controls"))}}class SSAITimeline extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-timeline";const t=document.createElement("div");t.className="fp-ssai-progress",this.append(t),this.player.on(n,()=>{t.classList.remove("go"),"--ssai-percent-complete --ssai-percent-previous".split(" ").forEach(e=>this.style.setProperty(e,"0"))}),this.player.on("ad-progress",e=>{var s,r;const i=null===(s=e.detail)||void 0===s?void 0:s.currentTime,a=null===(r=e.detail)||void 0===r?void 0:r.duration;if(void 0===a||void 0===i)return;const n=i/a*100,o=t.style.getPropertyValue("--ssai-percent-complete");t.classList.remove("go"),t.style.setProperty("--ssai-percent-previous",o),t.style.setProperty("--ssai-percent-complete",n.toFixed(3)),t.classList.add("go")})}}function se(e){const t="number"==typeof e?e:parseInt(e,10);return(t>9?"":"0")+t}class SSAIControls extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-controls",this.createLeftZone(),this.createRightZone()}createRightZone(){const e=document.createElement("div");e.className="fp-ssai-right-zone",e.append(...this.player.createComponents("flowplayer-volume-control"),...this.fsIcons()),this.append(e)}createLeftZone(){const e=document.createElement("div");e.className="fp-ssai-left-zone",e.append(...this.player.createComponents("flowplayer-control-buttons"),this.remainingTimeComponent()),this.append(e)}fsIcons(){return this.player.createComponents("flowplayer-fullscreen-enter-icon","flowplayer-fullscreen-exit-icon").map(e=>(e.onclick=()=>this.player.toggleFullScreen(),e))}remainingTimeComponent(){const e=document.createElement("div");return e.className="fp-ssai-remaining",this.player.on("ad-progress",t=>{var s;const r=null===(s=t.detail)||void 0===s?void 0:s.remaining;void 0!==r&&(e.textContent=function(e){if(isNaN(e)||e>=Number.MAX_SAFE_INTEGER)return"";const t=e<0?"-":"";e=Math.round(Math.abs(e));const s=Math.floor(e/3600);let r=Math.floor(e/60);return e-=60*r,s>=1?(r-=60*s,t+s+":"+se(r)+":"+se(e)):t+se(r)+":"+se(e)}(r))}),e}}class SSAIAdIndicator extends FlowplayerComponent{constructor(e){super(e),this.className="fp-ssai-indicator",this.player.on("ad-started",e=>{var t,s;const r=null===(t=e.detail)||void 0===t?void 0:t.totals,i=null===(s=e.detail)||void 0===s?void 0:s.position;void 0!==r&&void 0!==i&&(this.textContent=`${this.player.i18n("ads.indicator","ADS")} ${i} / ${r}`)})}}var re,ie=Object.freeze({__proto__:null,ID3:"ID3"});const ae=((re=class ID3{init(e,t,s){s.textTracks.addEventListener("addtrack",({track:e})=>{if(e&&"metadata"===e.kind)return"id3"==e.id||"id3"==e.label||"com.apple.streaming"==e.inBandMetadataTrackDispatchType?function(e,t){t.mode="hidden",t.addEventListener("cuechange",async()=>{Array.from(t.activeCues||[]).forEach(async t=>{(function(e){return"object"==typeof e.value&&"string"==typeof e.value.key&&!!e.value.data})(t)&&e.emit("ID3",{cue:t})})})}(s,e):void 0})}}).events=ie,re),ne=e(window,ae);var oe;const de=((oe=class Ssai{constructor(e,t){this.umd=e,this.providers=[],this.player=t,te(e,Q,SSAIAdUi),te(e,"flowplayer-ssai-timeline",SSAITimeline),te(e,"flowplayer-ssai-controls",SSAIControls),te(e,"flowplayer-ssai-indicator",SSAIAdIndicator)}init(e,t,i){const a=ee(i,Q);if(t.append(a),i.on(ne.events.ID3,({detail:e})=>{var t,s,r;const a=null==e?void 0:e.cue;a&&(null===(r=null===(t=i.ssai)||void 0===t?void 0:(s=t.provider).onId3)||void 0===r||r.call(s,a))}),i.on("seeked",()=>function(e){if(e.opt("live"))return;if(!e.ssai)return;const{provider:t,state:i}=e.ssai;if(i.snapback)return i.snapback=!1;const a=s(e),n=t.getPreviousActiveAdStart(e,a);void 0!==n&&(i.snapback=!0,i.snapbackTime=a,r(e,n))}(i)),i.on("src",e=>{var t,s,r;i.setState("ssai-ad-active",!1),null===(r=null===(s=null===(t=i.ssai)||void 0===t?void 0:t.provider)||void 0===s?void 0:s.onNewSrc)||void 0===r||r.call(s,i,e.detail)}),this.umd.extensions.find(e=>e.name===ne.name))return;new ne(this.umd,i).init(e,t,i)}onload(e,t,s,r){var i,a;null===(a=null===(i=s.ssai)||void 0===i?void 0:i.provider)||void 0===a||a.onload(s,r)}wants(e,t,s){return!!this.findProvider(t)}findProvider(e){let t=void 0;switch(e.type){case MediaTailor.Type:t=this.providers.find(e=>e instanceof MediaTailor)||new MediaTailor(this.player);break;case Dai.Type:t=this.providers.find(e=>e instanceof Dai)||new Dai(this.player);break;case Yospace.Type:Yospace.exists()&&(t=this.providers.find(e=>e instanceof Yospace)||new Yospace(this.player))}return t&&(this.player.ssai={provider:t,state:{snapback:!1}},this.providers.includes(t)||this.providers.push(t)),t}}).events=o,oe);return e(window,de)}));