@hopeplayer/core 1.0.15 → 1.0.17
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/README.md +24 -14
- package/dist/HopePlayerElement.d.ts +37 -0
- package/dist/HopePlayerElement.d.ts.map +1 -1
- package/dist/chunks/adTriggers-4SueRFgK.js +415 -0
- package/dist/chunks/adTriggers-4SueRFgK.js.map +1 -0
- package/dist/chunks/{index-BCMVXNL0.js → ads-DPL7m9PV.js} +135 -158
- package/dist/chunks/ads-DPL7m9PV.js.map +1 -0
- package/dist/chunks/{index-BeJNpAyx.js → audio-LkYgd5Wq.js} +7 -7
- package/dist/chunks/audio-LkYgd5Wq.js.map +1 -0
- package/dist/chunks/{ScratchSound-0XKHUcJK.js → audioScratchSound-7XkwCCDm.js} +1 -1
- package/dist/chunks/audioScratchSound-7XkwCCDm.js.map +1 -0
- package/dist/chunks/cast-DCAT2agI.js +387 -0
- package/dist/chunks/cast-DCAT2agI.js.map +1 -0
- package/dist/chunks/{index-rENB3n9O.js → countdownScreen-CI-u6jjA.js} +1 -1
- package/dist/chunks/countdownScreen-CI-u6jjA.js.map +1 -0
- package/dist/chunks/{index-Q8FMOHj0.js → dai-B9Tth1Iv.js} +1 -1
- package/dist/chunks/dai-B9Tth1Iv.js.map +1 -0
- package/dist/chunks/{index-DCXX1ZJG.js → debugPanel-Bnc_7GOn.js} +1 -1
- package/dist/chunks/debugPanel-Bnc_7GOn.js.map +1 -0
- package/dist/chunks/{index-DXWK4EFa.js → dubbing-kNMPpyHl.js} +1 -1
- package/dist/chunks/dubbing-kNMPpyHl.js.map +1 -0
- package/dist/chunks/{index-BBmuCtKu.js → geoChecker-BRtvHwI-.js} +1 -1
- package/dist/chunks/geoChecker-BRtvHwI-.js.map +1 -0
- package/dist/chunks/{index-Ca8hocby.js → gesture-BzPCgi87.js} +1 -1
- package/dist/chunks/gesture-BzPCgi87.js.map +1 -0
- package/dist/chunks/gpt-CGXHTG_H.js +18 -0
- package/dist/chunks/gpt-CGXHTG_H.js.map +1 -0
- package/dist/chunks/{index-3QALpwsf.js → inViewAutoplay-CRJe7GA4.js} +1 -1
- package/dist/chunks/inViewAutoplay-CRJe7GA4.js.map +1 -0
- package/dist/chunks/{index-7IBf8Y-R.js → liveWallClock-ChUTtzLD.js} +1 -1
- package/dist/chunks/liveWallClock-ChUTtzLD.js.map +1 -0
- package/dist/chunks/{index-f0vSgRIK.js → loopSection-CvF4l5uf.js} +1 -1
- package/dist/chunks/loopSection-CvF4l5uf.js.map +1 -0
- package/dist/chunks/{index-DRlQC-ev.js → markers-DE4O8xbw.js} +2 -2
- package/dist/chunks/markers-DE4O8xbw.js.map +1 -0
- package/dist/chunks/{index-CaMVTgh0.js → pauseAd-BQQe21X4.js} +55 -68
- package/dist/chunks/pauseAd-BQQe21X4.js.map +1 -0
- package/dist/chunks/{index-w7pACyTw.js → player-C886oKP-.js} +726 -391
- package/dist/chunks/player-C886oKP-.js.map +1 -0
- package/dist/chunks/{index-DpUZXNJS.js → playlist-CI3mRZjo.js} +2 -2
- package/dist/chunks/playlist-CI3mRZjo.js.map +1 -0
- package/dist/chunks/{VideoPrebid-CpckFzSq.js → prebid-CRY3i2OT.js} +1 -1
- package/dist/chunks/prebid-CRY3i2OT.js.map +1 -0
- package/dist/chunks/{index-DT8-oMPm.js → qrResume-BNy8XCp_.js} +1 -1
- package/dist/chunks/qrResume-BNy8XCp_.js.map +1 -0
- package/dist/chunks/redirectScreen-CJ3q9OX4.js +208 -0
- package/dist/chunks/redirectScreen-CJ3q9OX4.js.map +1 -0
- package/dist/chunks/rewardedUnlock-EyGMB9PK.js +264 -0
- package/dist/chunks/rewardedUnlock-EyGMB9PK.js.map +1 -0
- package/dist/chunks/{index-BOoNcKeR.js → segments-C2HKU6XK.js} +2 -2
- package/dist/chunks/segments-C2HKU6XK.js.map +1 -0
- package/dist/chunks/{index-D5P-LWbg.js → sponsorship-DyFwGmEb.js} +20 -20
- package/dist/chunks/sponsorship-DyFwGmEb.js.map +1 -0
- package/dist/chunks/{index-BvoB2O1p.js → spriteThumbnails-D0NQ5CCp.js} +2 -2
- package/dist/chunks/spriteThumbnails-D0NQ5CCp.js.map +1 -0
- package/dist/chunks/{index-DGtpFgHV.js → statsPanel-DSClIwA3.js} +1 -1
- package/dist/chunks/statsPanel-DSClIwA3.js.map +1 -0
- package/dist/chunks/{index-CDDke5rz.js → sticky-D_eLCNFk.js} +1 -1
- package/dist/chunks/sticky-D_eLCNFk.js.map +1 -0
- package/dist/chunks/{index-ClQg_X1N.js → story-D5Got6-6.js} +2 -2
- package/dist/chunks/{index-ClQg_X1N.js.map → story-D5Got6-6.js.map} +1 -1
- package/dist/chunks/{index-C5oGMHF_.js → tapGestures-DrC42DiI.js} +1 -1
- package/dist/chunks/tapGestures-DrC42DiI.js.map +1 -0
- package/dist/hls/SourceManager.d.ts +8 -0
- package/dist/hls/SourceManager.d.ts.map +1 -1
- package/dist/hls/sourceGroups.d.ts +19 -0
- package/dist/hls/sourceGroups.d.ts.map +1 -0
- package/dist/hope-player.js +1 -1
- package/dist/i18n/locales/en.d.ts.map +1 -1
- package/dist/i18n/locales/tr.d.ts.map +1 -1
- package/dist/i18n/types.d.ts +12 -0
- package/dist/i18n/types.d.ts.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/plugins/ad-triggers/AdTriggers.d.ts +99 -0
- package/dist/plugins/ad-triggers/AdTriggers.d.ts.map +1 -0
- package/dist/plugins/ad-triggers/index.d.ts +7 -0
- package/dist/plugins/ad-triggers/index.d.ts.map +1 -0
- package/dist/plugins/ads/AdsController.d.ts +8 -0
- package/dist/plugins/ads/AdsController.d.ts.map +1 -1
- package/dist/plugins/ads/generateVastUrl.d.ts +10 -0
- package/dist/plugins/ads/generateVastUrl.d.ts.map +1 -1
- package/dist/plugins/cast/CastController.d.ts +107 -0
- package/dist/plugins/cast/CastController.d.ts.map +1 -0
- package/dist/plugins/cast/RemoteMediaProxy.d.ts +41 -0
- package/dist/plugins/cast/RemoteMediaProxy.d.ts.map +1 -0
- package/dist/plugins/cast/castSdk.d.ts +160 -0
- package/dist/plugins/cast/castSdk.d.ts.map +1 -0
- package/dist/plugins/cast/index.d.ts +7 -0
- package/dist/plugins/cast/index.d.ts.map +1 -0
- package/dist/plugins/pause-ad/loadGpt.d.ts +2 -0
- package/dist/plugins/pause-ad/loadGpt.d.ts.map +1 -1
- package/dist/plugins/redirect-screen/RedirectScreen.d.ts +26 -3
- package/dist/plugins/redirect-screen/RedirectScreen.d.ts.map +1 -1
- package/dist/plugins/rewarded/RewardedUnlock.d.ts +2 -5
- package/dist/plugins/rewarded/RewardedUnlock.d.ts.map +1 -1
- package/dist/plugins/rewarded/gpt.d.ts +6 -2
- package/dist/plugins/rewarded/gpt.d.ts.map +1 -1
- package/dist/plugins/sponsorship/SponsorshipLayer.d.ts.map +1 -1
- package/dist/types/index.d.ts +308 -3
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +3 -1
- package/dist/chunks/ScratchSound-0XKHUcJK.js.map +0 -1
- package/dist/chunks/VideoPrebid-CpckFzSq.js.map +0 -1
- package/dist/chunks/index-3QALpwsf.js.map +0 -1
- package/dist/chunks/index-7IBf8Y-R.js.map +0 -1
- package/dist/chunks/index-BBmuCtKu.js.map +0 -1
- package/dist/chunks/index-BCMVXNL0.js.map +0 -1
- package/dist/chunks/index-BOoNcKeR.js.map +0 -1
- package/dist/chunks/index-BeJNpAyx.js.map +0 -1
- package/dist/chunks/index-BvoB2O1p.js.map +0 -1
- package/dist/chunks/index-C5oGMHF_.js.map +0 -1
- package/dist/chunks/index-CDDke5rz.js.map +0 -1
- package/dist/chunks/index-Ca8hocby.js.map +0 -1
- package/dist/chunks/index-CaMVTgh0.js.map +0 -1
- package/dist/chunks/index-D5P-LWbg.js.map +0 -1
- package/dist/chunks/index-D6r-BGAV.js +0 -77
- package/dist/chunks/index-D6r-BGAV.js.map +0 -1
- package/dist/chunks/index-DCXX1ZJG.js.map +0 -1
- package/dist/chunks/index-DGtpFgHV.js.map +0 -1
- package/dist/chunks/index-DRlQC-ev.js.map +0 -1
- package/dist/chunks/index-DT8-oMPm.js.map +0 -1
- package/dist/chunks/index-DXWK4EFa.js.map +0 -1
- package/dist/chunks/index-DpUZXNJS.js.map +0 -1
- package/dist/chunks/index-Q8FMOHj0.js.map +0 -1
- package/dist/chunks/index-TkG8IO6q.js +0 -239
- package/dist/chunks/index-TkG8IO6q.js.map +0 -1
- package/dist/chunks/index-f0vSgRIK.js.map +0 -1
- package/dist/chunks/index-rENB3n9O.js.map +0 -1
- package/dist/chunks/index-w7pACyTw.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
# @hopeplayer/core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**An open-source, monetization-first video player** — a framework-agnostic `<hope-player>` custom element (Shadow DOM, TypeScript) with Google IMA, Prebid, rewarded ads, sponsorships, out-of-page ad triggers and Chromecast with TV ads built in. Every feature is its own lazy-loaded chunk: nothing you don't configure is downloaded.
|
|
4
4
|
|
|
5
|
-
Full docs, live demos
|
|
5
|
+
Full docs, live demos and the options reference: **[umutyaldiz.com/hopecoreplayer](https://umutyaldiz.com/hopecoreplayer)**
|
|
6
|
+
|
|
7
|
+
## Quick start (CDN, no build step)
|
|
8
|
+
|
|
9
|
+
```html
|
|
10
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@hopeplayer/core@1/dist/hope-player.js"></script>
|
|
11
|
+
|
|
12
|
+
<hope-player src="https://test-streams.mux.dev/x36xhzz/x36xhzz.m3u8" style="display:block;aspect-ratio:16/9"></hope-player>
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Use the full `…/dist/hope-player.js` path — plugins load as relative chunks next to it (unpkg and esm.sh work the same way).
|
|
6
16
|
|
|
7
17
|
## Install
|
|
8
18
|
|
|
@@ -13,24 +23,24 @@ npm install @hopeplayer/core
|
|
|
13
23
|
```ts
|
|
14
24
|
import '@hopeplayer/core';
|
|
15
25
|
|
|
16
|
-
document.querySelector('
|
|
17
|
-
src: '/video.
|
|
26
|
+
document.querySelector('hope-player').options = {
|
|
27
|
+
src: '/video.m3u8',
|
|
18
28
|
poster: '/poster.jpg',
|
|
29
|
+
ads: { adTagPreroll: 'https://pubads.g.doubleclick.net/gampad/ads?…' },
|
|
30
|
+
cast: { chromecast: true, airplay: true },
|
|
19
31
|
};
|
|
20
32
|
```
|
|
21
33
|
|
|
22
|
-
```html
|
|
23
|
-
<hope-player src="/video.mp4" poster="/poster.jpg"></hope-player>
|
|
24
|
-
```
|
|
25
|
-
|
|
26
34
|
## Highlights
|
|
27
35
|
|
|
28
|
-
- **
|
|
29
|
-
- **
|
|
30
|
-
- **
|
|
31
|
-
- **4
|
|
32
|
-
- **i18n
|
|
33
|
-
-
|
|
36
|
+
- **Playback:** MP4 / WebM / HLS (hls.js only when needed, native on Safari / iOS), live, fallback sources, quality and audio menus, captions, sprite thumbnails, chapters, playlist and story mode, audio player, PiP, Chromecast and AirPlay.
|
|
37
|
+
- **Monetization:** Google IMA (VAST / VMAP, overlays, OM SDK, SCTE-35, DAI), Prebid video with GAM `cust_params`, consent (TCF / USP / GPP), rewarded quality unlock, sponsorship layer, pause ads, rule-driven Ad Manager out-of-page ads — and ads keep playing on the TV when casting.
|
|
38
|
+
- **Shadow DOM** — styles never leak into (or get overridden by) the host page.
|
|
39
|
+
- **4 style presets** plus CSS custom properties (`--hp-color-accent`…) and `::part()` hooks.
|
|
40
|
+
- **i18n** — every label and ad-UI string follows `locale` / `labels`.
|
|
41
|
+
- **Wrappers:** [`@hopeplayer/react`](https://www.npmjs.com/package/@hopeplayer/react), [`@hopeplayer/vue`](https://www.npmjs.com/package/@hopeplayer/vue), [`@hopeplayer/react-native`](https://www.npmjs.com/package/@hopeplayer/react-native).
|
|
42
|
+
|
|
43
|
+
[Changelog](https://github.com/umutyaldiz/hopecoreplayer/blob/main/CHANGELOG.md) · [Contributing](https://github.com/umutyaldiz/hopecoreplayer/blob/main/CONTRIBUTING.md) · [Issues](https://github.com/umutyaldiz/hopecoreplayer/issues)
|
|
34
44
|
|
|
35
45
|
## License
|
|
36
46
|
|
|
@@ -62,7 +62,15 @@ export declare class HopePlayerElement extends HTMLElement {
|
|
|
62
62
|
private rewardedUnlock;
|
|
63
63
|
private sponsorship;
|
|
64
64
|
/** Son uygulanan MP4 kaynak listesi ve seçili etiket — kilit açılınca menü yeniden kurulur. */
|
|
65
|
+
/** Çalan biçim grubunun kaynakları (kalite menüsü bunlar) — bkz. `sourceGroups`. */
|
|
65
66
|
private currentSources;
|
|
67
|
+
/** `sources` biçime göre gruplu, `sourcePriority` sırasıyla; ölümcül hatada sıradakine geçilir. */
|
|
68
|
+
private sourceGroups;
|
|
69
|
+
private activeGroup;
|
|
70
|
+
/** Sıradaki gruba geçiş başladı — aynı arızanın ikinci hata olayı hata ekranı açmasın. */
|
|
71
|
+
private fallbackPending;
|
|
72
|
+
/** hls.js ölümcül hatasının MediaError karşılığı (video.error oluşmaz) — hp:sourcefallback detayı için. */
|
|
73
|
+
private streamErrorCode;
|
|
66
74
|
private activeSourceLabel;
|
|
67
75
|
private lastHlsLevels;
|
|
68
76
|
private lastHlsActive;
|
|
@@ -78,8 +86,13 @@ export declare class HopePlayerElement extends HTMLElement {
|
|
|
78
86
|
private countdownScreen;
|
|
79
87
|
private geoChecker;
|
|
80
88
|
private redirectScreen;
|
|
89
|
+
private redirectKey;
|
|
81
90
|
private qrResume;
|
|
82
91
|
private pauseAd;
|
|
92
|
+
private adTriggers;
|
|
93
|
+
private castController;
|
|
94
|
+
/** İçerik Chromecast'te oynuyor (player kumanda) — yerel reklam / otomatik oynatma devre dışı. */
|
|
95
|
+
private casting;
|
|
83
96
|
private dubbing;
|
|
84
97
|
private liveWallClock;
|
|
85
98
|
private daiController;
|
|
@@ -161,6 +174,11 @@ export declare class HopePlayerElement extends HTMLElement {
|
|
|
161
174
|
showDebugLog(): Promise<void>;
|
|
162
175
|
private readonly onMediaError;
|
|
163
176
|
private readonly onSubtitleError;
|
|
177
|
+
/**
|
|
178
|
+
* Açık reklam tetikleyici reklamını kapat (adTriggers). `layout: 'none'` kreatifleri kendi kodlarından çağırabilir:
|
|
179
|
+
* `window.top.document.querySelector('hope-player').closeAdTrigger()`.
|
|
180
|
+
*/
|
|
181
|
+
closeAdTrigger(): void;
|
|
164
182
|
/** Teknik istatistik panelini aç/kapat (`force`: true = aç, false = kapat). Sağ tık menüsündeki "İstatistikler" ile aynı. */
|
|
165
183
|
toggleStats(force?: boolean): Promise<void>;
|
|
166
184
|
private readonly onPointerTypeTrack;
|
|
@@ -210,9 +228,28 @@ export declare class HopePlayerElement extends HTMLElement {
|
|
|
210
228
|
/** Kilit durumu değişti: menüleri yeniden kur, HLS üst sınırını güncelle; `upgrade` ise en iyi kaliteye geç. */
|
|
211
229
|
private refreshQualityGate;
|
|
212
230
|
private applyRewardedUnlock;
|
|
231
|
+
/**
|
|
232
|
+
* İçerik kimliği: `sources` çalıyorsa tüm kaynakları (kalite değişimi / yedek kaynak aynı içerik), eklentinin
|
|
233
|
+
* yüklediği medya (playlist, hikâye, dublaj) çalıyorsa onun adresi.
|
|
234
|
+
*/
|
|
235
|
+
private contentKey;
|
|
236
|
+
private applyCast;
|
|
237
|
+
/** TV'ye gönderilecek içerik: o an çalan kaynak (ya da `cast.source`), başlık / kapak, altyazılar, reklam tag'leri. */
|
|
238
|
+
private castMedia;
|
|
239
|
+
private applyAdTriggers;
|
|
213
240
|
private applySponsorship;
|
|
214
241
|
/** Kalite değişirken oynatma konumunu ve play/pause durumunu korur. */
|
|
215
242
|
private switchQualitySource;
|
|
243
|
+
/** `from`'dan itibaren tarayıcının oynatabileceği ilk grup (oynatamadıkları atlanır); hiçbiri yoksa -1 (from 0'sa 0 — yine de dene). */
|
|
244
|
+
private firstPlayableGroup;
|
|
245
|
+
/**
|
|
246
|
+
* Ölümcül hata: sıradaki biçim grubuna geç (konum ve oynatma durumu korunur).
|
|
247
|
+
* true = geçiliyor, hata ekranı gösterilmez. Hata ekranının `shouldShow`'undan çağrılır.
|
|
248
|
+
*/
|
|
249
|
+
private tryNextSourceGroup;
|
|
250
|
+
private activateSourceGroup;
|
|
251
|
+
/** Hata ekranındaki "Tekrar dene": birden fazla grup varsa en öncelikli gruptan baştan başla. */
|
|
252
|
+
private retrySource;
|
|
216
253
|
private readonly onHlsLevelsChanged;
|
|
217
254
|
/** iPhone Safari element tam ekranını desteklemiyor — yalnızca <video>'nun kendi (native kontrollü) tam ekranı. */
|
|
218
255
|
private get iosVideo();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HopePlayerElement.d.ts","sourceRoot":"","sources":["../src/HopePlayerElement.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgC,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAuC,KAAK,kBAAkB,EAA+C,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"HopePlayerElement.d.ts","sourceRoot":"","sources":["../src/HopePlayerElement.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAgC,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAC/E,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAuC,KAAK,kBAAkB,EAA+C,MAAM,qBAAqB,CAAC;AAwBhJ,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AA8C5C,+DAA+D;AAC/D,eAAO,MAAM,mBAAmB,QAAmB,CAAC;AAiCpD,gHAAgH;AAChH,qBAAa,iBAAkB,SAAQ,WAAW;IAC9C,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAED,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAa;IAClC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAiB;IAC3C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;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 +1,415 @@
|
|
|
1
|
+
var T = Object.defineProperty;
|
|
2
|
+
var x = (a, e, t) => e in a ? T(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
|
|
3
|
+
var c = (a, e, t) => x(a, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { l as L } from "./gpt-CGXHTG_H.js";
|
|
5
|
+
const C = 5e3, F = 8e3, P = 30, U = ["none", "full", "center", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right"], N = ["time", "interval", "percent", "fullscreen", "fullscreenExit", "start", "pause", "resume", "ended"], R = 1.5;
|
|
6
|
+
let M = 0;
|
|
7
|
+
function D(a) {
|
|
8
|
+
if (typeof a != "string" || !a.trim()) return null;
|
|
9
|
+
try {
|
|
10
|
+
const e = new URL(a, document.baseURI);
|
|
11
|
+
return e.protocol === "https:" || e.protocol === "http:" ? e.href : null;
|
|
12
|
+
} catch {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const p = (a, e, t) => typeof a == "number" && Number.isFinite(a) ? Math.min(t, Math.max(e, a)) : void 0, k = (a) => typeof a == "string" ? a.slice(0, 200) : typeof a == "number" && Number.isFinite(a) || typeof a == "boolean" ? String(a) : null;
|
|
17
|
+
function y(a) {
|
|
18
|
+
let e;
|
|
19
|
+
if (typeof a == "string") {
|
|
20
|
+
if (!a.trim()) return;
|
|
21
|
+
e = [...new URLSearchParams(a.trim().replace(/^\?/, "")).entries()].map(([s, i]) => [s, i.includes(",") ? i.split(",") : i]);
|
|
22
|
+
} else if (a && typeof a == "object" && !Array.isArray(a))
|
|
23
|
+
e = Object.entries(a);
|
|
24
|
+
else
|
|
25
|
+
return;
|
|
26
|
+
const t = {};
|
|
27
|
+
for (const [s, i] of e.slice(0, 50))
|
|
28
|
+
if (/^[\w.-]{1,40}$/.test(s))
|
|
29
|
+
if (Array.isArray(i)) {
|
|
30
|
+
const r = i.map(k).filter((l) => l !== null && l !== "").slice(0, 30);
|
|
31
|
+
r.length && (t[s] = r);
|
|
32
|
+
} else {
|
|
33
|
+
const r = k(i);
|
|
34
|
+
r !== null && r !== "" && (t[s] = r);
|
|
35
|
+
}
|
|
36
|
+
return Object.keys(t).length ? t : void 0;
|
|
37
|
+
}
|
|
38
|
+
function O(a) {
|
|
39
|
+
if (!a || typeof a != "object") return null;
|
|
40
|
+
const e = a, t = e.type;
|
|
41
|
+
if (!N.includes(t)) return null;
|
|
42
|
+
const s = (i, r, l) => (Array.isArray(i) ? i : [i]).map((o) => p(o, r, l)).filter((o) => o !== void 0).slice(0, 50);
|
|
43
|
+
if (t === "time") {
|
|
44
|
+
const i = s(e.at, 0, 86400);
|
|
45
|
+
return i.length ? { type: t, at: i } : null;
|
|
46
|
+
}
|
|
47
|
+
if (t === "percent") {
|
|
48
|
+
const i = s(e.at, 1, 99);
|
|
49
|
+
return i.length ? { type: t, at: i } : null;
|
|
50
|
+
}
|
|
51
|
+
if (t === "interval") {
|
|
52
|
+
const i = p(e.every, 10, 86400);
|
|
53
|
+
return i ? { type: t, every: i, startAfter: p(e.startAfter, 0, 86400) } : null;
|
|
54
|
+
}
|
|
55
|
+
return { type: t, delay: p(e.delay, 0, 600) };
|
|
56
|
+
}
|
|
57
|
+
function b(a) {
|
|
58
|
+
var o, d, h;
|
|
59
|
+
if (!a || typeof a != "object") return null;
|
|
60
|
+
const e = a;
|
|
61
|
+
if (e.active !== !0 || !Array.isArray(e.rules)) return null;
|
|
62
|
+
const t = Date.now(), s = e.validFrom ? Date.parse(e.validFrom) : NaN, i = e.validUntil ? Date.parse(e.validUntil) : NaN;
|
|
63
|
+
if (Number.isFinite(s) && t < s || Number.isFinite(i) && t > i) return null;
|
|
64
|
+
const r = (u) => Array.isArray(u) ? u.map(D).filter((n) => !!n).slice(0, 10) : [], l = [];
|
|
65
|
+
for (const u of e.rules.slice(0, 20)) {
|
|
66
|
+
if (!u || typeof u != "object") continue;
|
|
67
|
+
const n = u;
|
|
68
|
+
if (typeof n.adUnitPath != "string" || !/^\/\d+(?:[,/][\w.\-/]*)?$/.test(n.adUnitPath)) continue;
|
|
69
|
+
const f = (Array.isArray(n.triggers) ? n.triggers : []).map(O).filter((v) => !!v).slice(0, 20);
|
|
70
|
+
if (!f.length) continue;
|
|
71
|
+
const g = Array.isArray(n.size) && n.size.length === 2 ? [p(n.size[0], 1, 4e3), p(n.size[1], 1, 4e3)] : null, m = U.includes(n.layout) ? n.layout : "none";
|
|
72
|
+
l.push({
|
|
73
|
+
id: typeof n.id == "string" ? n.id.slice(0, 80) : void 0,
|
|
74
|
+
adUnitPath: n.adUnitPath,
|
|
75
|
+
mode: n.mode === "fullscreen" || n.mode === "normal" ? n.mode : "any",
|
|
76
|
+
triggers: f,
|
|
77
|
+
targeting: y(n.targeting),
|
|
78
|
+
// API'lerde yaygın `cust_params` yazımı da kabul edilir.
|
|
79
|
+
custParams: y(n.custParams ?? n.cust_params),
|
|
80
|
+
layout: m,
|
|
81
|
+
size: g && g[0] && g[1] ? [g[0], g[1]] : void 0,
|
|
82
|
+
backdrop: typeof n.backdrop == "boolean" ? n.backdrop : m === "full",
|
|
83
|
+
pauseContent: n.pauseContent === !0,
|
|
84
|
+
closeButton: n.closeButton !== !1,
|
|
85
|
+
closeDelay: p(n.closeDelay, 0, 120) ?? 0,
|
|
86
|
+
duration: p(n.duration, 1, 3600),
|
|
87
|
+
label: n.label === !1 ? !1 : typeof n.label == "string" ? n.label.slice(0, 40) : void 0,
|
|
88
|
+
maxShows: p(n.maxShows, 1, 1e3),
|
|
89
|
+
minGapSeconds: p(n.minGapSeconds, 0, 86400),
|
|
90
|
+
minPlayerWidth: p(n.minPlayerWidth, 0, 4e3),
|
|
91
|
+
tracking: { impression: r((o = n.tracking) == null ? void 0 : o.impression), close: r((d = n.tracking) == null ? void 0 : d.close), empty: r((h = n.tracking) == null ? void 0 : h.empty) }
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
return l.length ? {
|
|
95
|
+
active: !0,
|
|
96
|
+
id: typeof e.id == "string" ? e.id.slice(0, 120) : void 0,
|
|
97
|
+
minGapSeconds: p(e.minGapSeconds, 0, 86400) ?? P,
|
|
98
|
+
rules: l
|
|
99
|
+
} : null;
|
|
100
|
+
}
|
|
101
|
+
function S(a) {
|
|
102
|
+
for (const e of a ?? []) {
|
|
103
|
+
const t = new Image();
|
|
104
|
+
t.referrerPolicy = "no-referrer-when-downgrade", t.src = e;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
class $ {
|
|
108
|
+
constructor(e, t) {
|
|
109
|
+
c(this, "options");
|
|
110
|
+
c(this, "config", null);
|
|
111
|
+
c(this, "loaded", !1);
|
|
112
|
+
c(this, "googletag", null);
|
|
113
|
+
c(this, "showing", null);
|
|
114
|
+
c(this, "instance", ++M);
|
|
115
|
+
c(this, "seq", 0);
|
|
116
|
+
c(this, "requestSeq", 0);
|
|
117
|
+
c(this, "destroyed", !1);
|
|
118
|
+
c(this, "refreshTimer", null);
|
|
119
|
+
c(this, "tickTimer");
|
|
120
|
+
/** Olaydan `delay` sn sonra çalışacak tetiklemeler — koşul bozulunca iptal edilir. */
|
|
121
|
+
c(this, "delayed", []);
|
|
122
|
+
// ── içerik başına durum (kaynak değişince sıfırlanır) ──
|
|
123
|
+
c(this, "contentKey", "");
|
|
124
|
+
c(this, "fired", /* @__PURE__ */ new Set());
|
|
125
|
+
c(this, "shows", /* @__PURE__ */ new Map());
|
|
126
|
+
c(this, "lastShownAt", /* @__PURE__ */ new Map());
|
|
127
|
+
c(this, "lastAnyAt", 0);
|
|
128
|
+
c(this, "watchedMs", 0);
|
|
129
|
+
c(this, "lastTick", performance.now());
|
|
130
|
+
c(this, "lastPos", 0);
|
|
131
|
+
c(this, "started", !1);
|
|
132
|
+
c(this, "userPaused", !1);
|
|
133
|
+
/** Player'ın kendi duraklatması (pauseContent) — pause/resume kuralı sayılmaz. */
|
|
134
|
+
c(this, "selfPause", !1);
|
|
135
|
+
c(this, "wasFullscreen", !1);
|
|
136
|
+
// ── olaylar → tetikleyiciler ──
|
|
137
|
+
c(this, "onLoadStart", () => {
|
|
138
|
+
const e = this.ctx.contentKey();
|
|
139
|
+
e !== this.contentKey && (this.contentKey = e, this.fired.clear(), this.shows.clear(), this.lastShownAt.clear(), this.watchedMs = 0, this.lastPos = 0, this.started = !1, this.userPaused = !1, this.cancelDelayed(), this.close("content"));
|
|
140
|
+
});
|
|
141
|
+
c(this, "onPlaying", () => {
|
|
142
|
+
this.ctx.isBlocked() || (this.started ? this.userPaused && this.trigger("resume") : (this.started = !0, this.trigger("start")), this.userPaused = !1, this.cancelDelayed("pause"));
|
|
143
|
+
});
|
|
144
|
+
c(this, "onPause", () => {
|
|
145
|
+
const e = this.ctx.videoEl;
|
|
146
|
+
if (this.selfPause) {
|
|
147
|
+
this.selfPause = !1;
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
e.ended || e.seeking || this.ctx.isBlocked() || (this.userPaused = !0, this.cancelDelayed("start", "resume"), this.trigger("pause"));
|
|
151
|
+
});
|
|
152
|
+
c(this, "onEnded", () => {
|
|
153
|
+
this.ctx.isBlocked() || this.trigger("ended");
|
|
154
|
+
});
|
|
155
|
+
c(this, "onSeeked", () => {
|
|
156
|
+
this.lastPos = this.ctx.videoEl.currentTime;
|
|
157
|
+
});
|
|
158
|
+
c(this, "onFullscreenChange", () => {
|
|
159
|
+
var s;
|
|
160
|
+
const e = this.ctx.isFullscreen();
|
|
161
|
+
if (e === this.wasFullscreen) return;
|
|
162
|
+
this.wasFullscreen = e, this.cancelDelayed(e ? "fullscreenExit" : "fullscreen");
|
|
163
|
+
const t = (s = this.showing) == null ? void 0 : s.rule.mode;
|
|
164
|
+
(t === "fullscreen" && !e || t === "normal" && e) && this.close("mode"), this.trigger(e ? "fullscreen" : "fullscreenExit");
|
|
165
|
+
});
|
|
166
|
+
c(this, "onVideoAdStart", (e) => {
|
|
167
|
+
var t;
|
|
168
|
+
((t = e.detail) == null ? void 0 : t.linear) !== !1 && (this.cancelDelayed(), this.close("ad"));
|
|
169
|
+
});
|
|
170
|
+
c(this, "onTimeUpdate", () => {
|
|
171
|
+
const e = this.ctx.videoEl, t = e.currentTime, s = this.lastPos;
|
|
172
|
+
this.lastPos = t;
|
|
173
|
+
const i = this.config;
|
|
174
|
+
if (!i || e.paused || e.seeking || this.isLive() || this.ctx.isBlocked() || t <= s || t - s > R) return;
|
|
175
|
+
const r = e.duration;
|
|
176
|
+
i.rules.forEach(
|
|
177
|
+
(l, o) => l.triggers.forEach((d, h) => {
|
|
178
|
+
if (!(d.type !== "time" && d.type !== "percent"))
|
|
179
|
+
for (const u of d.at) {
|
|
180
|
+
const n = d.type === "percent" ? Number.isFinite(r) && r > 0 ? r * u / 100 : NaN : u, f = `${o}:${h}:${u}`;
|
|
181
|
+
s < n && n <= t && !this.fired.has(f) && (this.fired.add(f), this.showRule(o, d.type));
|
|
182
|
+
}
|
|
183
|
+
})
|
|
184
|
+
);
|
|
185
|
+
});
|
|
186
|
+
/** Gerçek izleme süresi: interval kuralları (ve canlıda time kuralları) bununla sayılır. */
|
|
187
|
+
c(this, "tick", () => {
|
|
188
|
+
var o;
|
|
189
|
+
const e = performance.now(), t = Math.min(2e3, Math.max(0, e - this.lastTick));
|
|
190
|
+
this.lastTick = e;
|
|
191
|
+
const s = this.ctx.videoEl, i = this.config;
|
|
192
|
+
if (!i || s.paused || s.ended || document.hidden || this.ctx.isBlocked() || (o = this.showing) != null && o.filled) return;
|
|
193
|
+
const r = this.watchedMs / 1e3;
|
|
194
|
+
this.watchedMs += t;
|
|
195
|
+
const l = this.watchedMs / 1e3;
|
|
196
|
+
i.rules.forEach(
|
|
197
|
+
(d, h) => d.triggers.forEach((u, n) => {
|
|
198
|
+
if (u.type === "interval") {
|
|
199
|
+
const f = u.startAfter ?? u.every, g = Math.floor((l - f) / u.every);
|
|
200
|
+
l >= f && f + g * u.every > r && this.showRule(h, "interval");
|
|
201
|
+
} else if (u.type === "time" && this.isLive())
|
|
202
|
+
for (const f of u.at) {
|
|
203
|
+
const g = `${h}:${n}:${f}:live`;
|
|
204
|
+
r < f && f <= l && !this.fired.has(g) && (this.fired.add(g), this.showRule(h, "time"));
|
|
205
|
+
}
|
|
206
|
+
})
|
|
207
|
+
);
|
|
208
|
+
});
|
|
209
|
+
this.ctx = e, this.options = t;
|
|
210
|
+
const s = e.videoEl;
|
|
211
|
+
s.addEventListener("timeupdate", this.onTimeUpdate), s.addEventListener("seeked", this.onSeeked), s.addEventListener("playing", this.onPlaying), s.addEventListener("pause", this.onPause), s.addEventListener("ended", this.onEnded), s.addEventListener("loadstart", this.onLoadStart), s.addEventListener("webkitbeginfullscreen", this.onFullscreenChange), s.addEventListener("webkitendfullscreen", this.onFullscreenChange), document.addEventListener("fullscreenchange", this.onFullscreenChange), document.addEventListener("webkitfullscreenchange", this.onFullscreenChange), e.hostEl.addEventListener("hp:adstart", this.onVideoAdStart), this.wasFullscreen = e.isFullscreen(), this.contentKey = e.contentKey(), this.tickTimer = setInterval(this.tick, 1e3), this.load(), this.scheduleRefresh();
|
|
212
|
+
}
|
|
213
|
+
update(e) {
|
|
214
|
+
const t = e.endpoint !== this.options.endpoint || JSON.stringify(e.params) !== JSON.stringify(this.options.params) || JSON.stringify(e.config) !== JSON.stringify(this.options.config), s = e.refreshSeconds !== this.options.refreshSeconds;
|
|
215
|
+
this.options = e, t && this.load(), s && this.scheduleRefresh();
|
|
216
|
+
}
|
|
217
|
+
get current() {
|
|
218
|
+
return this.config;
|
|
219
|
+
}
|
|
220
|
+
/** Şu an bir reklam gösteriliyor mu. */
|
|
221
|
+
get active() {
|
|
222
|
+
var e;
|
|
223
|
+
return !!((e = this.showing) != null && e.filled);
|
|
224
|
+
}
|
|
225
|
+
// ── kurallar ──
|
|
226
|
+
scheduleRefresh() {
|
|
227
|
+
this.refreshTimer && clearInterval(this.refreshTimer), this.refreshTimer = null;
|
|
228
|
+
const e = this.options.refreshSeconds;
|
|
229
|
+
this.options.endpoint && typeof e == "number" && e >= 10 && (this.refreshTimer = setInterval(() => void this.load(), e * 1e3));
|
|
230
|
+
}
|
|
231
|
+
async load() {
|
|
232
|
+
const e = ++this.requestSeq;
|
|
233
|
+
if (!this.options.endpoint) {
|
|
234
|
+
this.apply(b(this.options.config));
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
const t = typeof AbortController < "u" ? new AbortController() : null, s = setTimeout(() => t == null ? void 0 : t.abort(), this.options.timeoutMs ?? C);
|
|
238
|
+
let i = "";
|
|
239
|
+
try {
|
|
240
|
+
const r = new URL(this.options.endpoint, document.baseURI);
|
|
241
|
+
for (const [d, h] of Object.entries(this.options.params ?? {})) r.searchParams.set(d, h);
|
|
242
|
+
i = r.href;
|
|
243
|
+
const l = await fetch(i, { ...this.options.fetchInit, signal: t == null ? void 0 : t.signal });
|
|
244
|
+
if (!l.ok) throw new Error(`HTTP ${l.status}`);
|
|
245
|
+
const o = await l.json();
|
|
246
|
+
if (this.destroyed || e !== this.requestSeq) return;
|
|
247
|
+
this.apply(b(o));
|
|
248
|
+
} catch (r) {
|
|
249
|
+
if (this.destroyed || e !== this.requestSeq) return;
|
|
250
|
+
this.ctx.log({ message: `Ad triggers API failed: ${String(r)}`, details: { url: i } }), !this.config && this.options.config && this.apply(b(this.options.config));
|
|
251
|
+
} finally {
|
|
252
|
+
clearTimeout(s);
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
apply(e) {
|
|
256
|
+
const t = !this.loaded || JSON.stringify(e) !== JSON.stringify(this.config);
|
|
257
|
+
this.loaded = !0, this.config = e, t && (this.cancelDelayed(), e || this.close("content"), this.ctx.hostEl.dispatchEvent(new CustomEvent("hp:adtriggers", { detail: { config: e } })));
|
|
258
|
+
}
|
|
259
|
+
isLive() {
|
|
260
|
+
return this.ctx.videoEl.duration === 1 / 0;
|
|
261
|
+
}
|
|
262
|
+
/** Olay tipindeki tetikleyicisi olan her kural (gecikmeliyse zamanlanır). */
|
|
263
|
+
trigger(e) {
|
|
264
|
+
const t = this.config;
|
|
265
|
+
t && t.rules.forEach((s, i) => {
|
|
266
|
+
const r = s.triggers.find((d) => d.type === e);
|
|
267
|
+
if (!r) return;
|
|
268
|
+
const l = (r.delay ?? 0) * 1e3;
|
|
269
|
+
if (l <= 0) {
|
|
270
|
+
this.showRule(i, e);
|
|
271
|
+
return;
|
|
272
|
+
}
|
|
273
|
+
const o = setTimeout(() => {
|
|
274
|
+
this.delayed = this.delayed.filter((d) => d.timer !== o), this.showRule(i, e);
|
|
275
|
+
}, l);
|
|
276
|
+
this.delayed.push({ type: e, timer: o });
|
|
277
|
+
});
|
|
278
|
+
}
|
|
279
|
+
cancelDelayed(...e) {
|
|
280
|
+
this.delayed = this.delayed.filter((t) => e.length && !e.includes(t.type) ? !0 : (clearTimeout(t.timer), !1));
|
|
281
|
+
}
|
|
282
|
+
// ── gösterim ──
|
|
283
|
+
/** Koşullar uygunsa kuralın reklamını ister. Uygun değilse sessizce atlanır (sebep kayda düşer). */
|
|
284
|
+
showRule(e, t) {
|
|
285
|
+
var d, h;
|
|
286
|
+
const s = (d = this.config) == null ? void 0 : d.rules[e];
|
|
287
|
+
if (!s || this.destroyed) return;
|
|
288
|
+
const i = this.ctx.videoEl, r = this.ctx.isFullscreen(), l = (u) => this.ctx.log({ message: `Ad trigger skipped (${u})`, details: { rule: s.id, trigger: t } });
|
|
289
|
+
if (this.showing && !(this.showing.filled && this.showing.rule.layout === "none")) return l("another ad is showing");
|
|
290
|
+
if (this.ctx.isBlocked()) return l("video ad / intro screen");
|
|
291
|
+
if (document.hidden) return l("tab hidden");
|
|
292
|
+
if (this.ctx.isNativeFullscreen()) return l("native iOS fullscreen");
|
|
293
|
+
if (s.mode === "fullscreen" && !r) return l("not fullscreen");
|
|
294
|
+
if (s.mode === "normal" && r) return l("fullscreen");
|
|
295
|
+
if (t === "pause" && (!i.paused || i.ended) || t === "ended" && !i.ended || ["time", "percent", "interval", "start", "resume"].includes(t) && i.paused) return;
|
|
296
|
+
if (s.minPlayerWidth && this.ctx.overlayEl.getBoundingClientRect().width < s.minPlayerWidth) return l("player too narrow");
|
|
297
|
+
const o = Date.now();
|
|
298
|
+
if (s.maxShows && (this.shows.get(e) ?? 0) >= s.maxShows) return l("maxShows");
|
|
299
|
+
if (s.minGapSeconds && o - (this.lastShownAt.get(e) ?? 0) < s.minGapSeconds * 1e3) return l("rule minGapSeconds");
|
|
300
|
+
if (o - this.lastAnyAt < (((h = this.config) == null ? void 0 : h.minGapSeconds) ?? P) * 1e3) return l("minGapSeconds");
|
|
301
|
+
this.showing && this.close("replaced"), this.lastAnyAt = o, this.lastShownAt.set(e, o), this.request(e, s, t, r);
|
|
302
|
+
}
|
|
303
|
+
async request(e, t, s, i) {
|
|
304
|
+
const r = ++this.seq, l = `hp-adtrigger-${this.instance}`, o = this.buildBox(t, l), d = document.createElement("div");
|
|
305
|
+
d.id = `hp-adtrigger-${this.instance}-${r}`, d.slot = l;
|
|
306
|
+
const h = { rule: t, trigger: s, box: o, adHost: d, slot: null, filled: !1, pausedContent: !1, timers: [] };
|
|
307
|
+
this.showing = h, this.ctx.overlayEl.appendChild(o), this.ctx.hostEl.appendChild(d);
|
|
308
|
+
const u = { rule: t.id, trigger: s, adUnitPath: t.adUnitPath }, n = (g) => {
|
|
309
|
+
var m;
|
|
310
|
+
this.showing === h && (this.ctx.log({ message: `Ad trigger: no ad (${g})`, details: { ...u } }), S((m = t.tracking) == null ? void 0 : m.empty), this.ctx.hostEl.dispatchEvent(new CustomEvent("hp:adtriggerempty", { detail: u })), this.teardown(h));
|
|
311
|
+
};
|
|
312
|
+
h.timers.push(setTimeout(() => !h.filled && n("timeout"), this.options.renderTimeoutMs ?? F));
|
|
313
|
+
try {
|
|
314
|
+
this.googletag ?? (this.googletag = await L());
|
|
315
|
+
} catch (g) {
|
|
316
|
+
n(String(g));
|
|
317
|
+
return;
|
|
318
|
+
}
|
|
319
|
+
if (this.showing !== h) return;
|
|
320
|
+
const f = this.googletag;
|
|
321
|
+
f.cmd.push(() => {
|
|
322
|
+
if (this.showing !== h) return;
|
|
323
|
+
const g = f.defineOutOfPageSlot(t.adUnitPath, d.id);
|
|
324
|
+
if (!g) {
|
|
325
|
+
n("slot could not be defined");
|
|
326
|
+
return;
|
|
327
|
+
}
|
|
328
|
+
h.slot = g, g.addService(f.pubads());
|
|
329
|
+
const m = {
|
|
330
|
+
...y(this.options.targeting),
|
|
331
|
+
...y(this.options.custParams),
|
|
332
|
+
...t.targeting,
|
|
333
|
+
...y(t.custParams),
|
|
334
|
+
hp_trigger: s,
|
|
335
|
+
hp_mode: i ? "fullscreen" : "normal"
|
|
336
|
+
};
|
|
337
|
+
t.id && (m.hp_rule = t.id);
|
|
338
|
+
for (const [w, E] of Object.entries(m)) g.setTargeting(w, E);
|
|
339
|
+
h.custParams = m;
|
|
340
|
+
const v = (w) => {
|
|
341
|
+
var E, A;
|
|
342
|
+
w.slot === g && ((A = (E = f.pubads()).removeEventListener) == null || A.call(E, "slotRenderEnded", v), w.isEmpty ? n("empty") : this.reveal(e, h, i));
|
|
343
|
+
};
|
|
344
|
+
f.pubads().addEventListener("slotRenderEnded", v), f.enableServices(), f.display(d.id), f.pubads().isInitialLoadDisabled() && f.pubads().refresh([g]);
|
|
345
|
+
});
|
|
346
|
+
}
|
|
347
|
+
buildBox(e, t) {
|
|
348
|
+
const s = document.createElement("div");
|
|
349
|
+
s.className = "hp-adtrigger", s.setAttribute("part", "ad-trigger");
|
|
350
|
+
const i = e.layout === "none";
|
|
351
|
+
s.setAttribute("data-layout", e.layout ?? "none"), s.toggleAttribute("data-backdrop", !!e.backdrop);
|
|
352
|
+
const r = document.createElement("div");
|
|
353
|
+
if (r.className = "hp-adtrigger-frame", e.size && e.layout !== "full" && (r.style.setProperty("--hp-adtrigger-w", `${e.size[0]}px`), r.style.setProperty("--hp-adtrigger-h", `${e.size[1]}px`), r.setAttribute("data-sized", "")), e.label !== !1 && !i) {
|
|
354
|
+
const o = document.createElement("span");
|
|
355
|
+
o.className = "hp-adtrigger-label", o.textContent = e.label || this.ctx.i18n.adTriggerLabel, r.appendChild(o);
|
|
356
|
+
}
|
|
357
|
+
const l = document.createElement("slot");
|
|
358
|
+
if (l.name = t, r.appendChild(l), e.closeButton !== !1 && !i) {
|
|
359
|
+
const o = document.createElement("button");
|
|
360
|
+
o.type = "button", o.className = "hp-adtrigger-close", o.setAttribute("part", "ad-trigger-close"), o.setAttribute("aria-label", this.ctx.i18n.pauseAdClose), o.hidden = !0, o.innerHTML = '<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.2" stroke-linecap="round" aria-hidden="true"><path d="M6 6l12 12M18 6L6 18"/></svg>', o.addEventListener("click", () => this.close("user")), r.appendChild(o);
|
|
361
|
+
}
|
|
362
|
+
s.appendChild(r);
|
|
363
|
+
for (const o of ["pointerdown", "click", "dblclick"]) s.addEventListener(o, (d) => d.stopPropagation());
|
|
364
|
+
return s;
|
|
365
|
+
}
|
|
366
|
+
reveal(e, t, s) {
|
|
367
|
+
var o;
|
|
368
|
+
if (this.showing !== t) return;
|
|
369
|
+
const { rule: i } = t;
|
|
370
|
+
if (t.filled = !0, this.shows.set(e, (this.shows.get(e) ?? 0) + 1), this.lastAnyAt = Date.now(), i.layout === "full" || i.size && i.layout !== "none") {
|
|
371
|
+
const d = t.adHost.querySelector("iframe");
|
|
372
|
+
d && Object.assign(d.style, { width: "100%", height: "100%", border: "0" }), Object.assign(t.adHost.style, { width: "100%", height: "100%" });
|
|
373
|
+
}
|
|
374
|
+
t.box.setAttribute("data-open", "");
|
|
375
|
+
const r = t.box.querySelector(".hp-adtrigger-close");
|
|
376
|
+
r && t.timers.push(setTimeout(() => r.hidden = !1, (i.closeDelay ?? 0) * 1e3)), i.duration && t.timers.push(setTimeout(() => this.close("timeout"), i.duration * 1e3));
|
|
377
|
+
const l = this.ctx.videoEl;
|
|
378
|
+
i.pauseContent && !l.paused && (t.pausedContent = !0, this.selfPause = !0, l.pause()), S((o = i.tracking) == null ? void 0 : o.impression), this.ctx.hostEl.dispatchEvent(
|
|
379
|
+
new CustomEvent("hp:adtriggershow", { detail: { rule: i.id, trigger: t.trigger, adUnitPath: i.adUnitPath, fullscreen: s, custParams: t.custParams ?? {} } })
|
|
380
|
+
);
|
|
381
|
+
}
|
|
382
|
+
/** Gösterilen reklamı kapat (bekleyen istek varsa iptal). */
|
|
383
|
+
close(e) {
|
|
384
|
+
var i;
|
|
385
|
+
const t = this.showing;
|
|
386
|
+
if (!t) return;
|
|
387
|
+
const s = t.filled;
|
|
388
|
+
this.teardown(t), s && (S((i = t.rule.tracking) == null ? void 0 : i.close), this.ctx.hostEl.dispatchEvent(new CustomEvent("hp:adtriggerclose", { detail: { rule: t.rule.id, reason: e } })), t.pausedContent && e !== "content" && e !== "ad" && this.ctx.videoEl.play().catch(() => {
|
|
389
|
+
}));
|
|
390
|
+
}
|
|
391
|
+
teardown(e) {
|
|
392
|
+
this.showing === e && (this.showing = null);
|
|
393
|
+
for (const t of e.timers) clearTimeout(t);
|
|
394
|
+
if (e.slot && this.googletag)
|
|
395
|
+
try {
|
|
396
|
+
this.googletag.destroySlots([e.slot]);
|
|
397
|
+
} catch {
|
|
398
|
+
}
|
|
399
|
+
e.box.remove(), e.adHost.remove();
|
|
400
|
+
}
|
|
401
|
+
destroy() {
|
|
402
|
+
this.destroyed = !0, this.cancelDelayed(), this.close("content"), clearInterval(this.tickTimer), this.refreshTimer && clearInterval(this.refreshTimer);
|
|
403
|
+
const e = this.ctx.videoEl;
|
|
404
|
+
e.removeEventListener("timeupdate", this.onTimeUpdate), e.removeEventListener("seeked", this.onSeeked), e.removeEventListener("playing", this.onPlaying), e.removeEventListener("pause", this.onPause), e.removeEventListener("ended", this.onEnded), e.removeEventListener("loadstart", this.onLoadStart), e.removeEventListener("webkitbeginfullscreen", this.onFullscreenChange), e.removeEventListener("webkitendfullscreen", this.onFullscreenChange), document.removeEventListener("fullscreenchange", this.onFullscreenChange), document.removeEventListener("webkitfullscreenchange", this.onFullscreenChange), this.ctx.hostEl.removeEventListener("hp:adstart", this.onVideoAdStart);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
function I(a, e) {
|
|
408
|
+
return new $(a, e);
|
|
409
|
+
}
|
|
410
|
+
export {
|
|
411
|
+
$ as AdTriggers,
|
|
412
|
+
I as installAdTriggers,
|
|
413
|
+
b as normalizeAdTriggers
|
|
414
|
+
};
|
|
415
|
+
//# sourceMappingURL=adTriggers-4SueRFgK.js.map
|