stormcloud-video-player 0.8.79 → 0.8.81

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/stormcloud-vp.min.js +2 -2
  2. package/lib/Player.cjs +6 -0
  3. package/lib/Player.cjs.map +1 -1
  4. package/lib/Player.d.cts +4 -1
  5. package/lib/StormcloudPlayer.cjs +1459 -167
  6. package/lib/StormcloudPlayer.cjs.map +1 -1
  7. package/lib/StormcloudPlayer.d.cts +3 -0
  8. package/lib/index.cjs +1547 -169
  9. package/lib/index.cjs.map +1 -1
  10. package/lib/index.d.cts +3 -0
  11. package/lib/index.d.ts +89 -3
  12. package/lib/index.js +1547 -169
  13. package/lib/index.js.map +1 -1
  14. package/lib/player/AdBreakOrchestrator.cjs +452 -88
  15. package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
  16. package/lib/player/AdBreakOrchestrator.d.cts +1 -0
  17. package/lib/player/AdConfigManager.cjs +1024 -97
  18. package/lib/player/AdConfigManager.cjs.map +1 -1
  19. package/lib/player/AdConfigManager.d.cts +2 -0
  20. package/lib/player/AdTimingService.cjs +0 -9
  21. package/lib/player/AdTimingService.cjs.map +1 -1
  22. package/lib/player/AdTimingService.d.cts +1 -0
  23. package/lib/player/EdgePodRequest.d.cts +1 -0
  24. package/lib/player/FloorLadder.cjs +3 -0
  25. package/lib/player/FloorLadder.cjs.map +1 -1
  26. package/lib/player/FloorLadder.d.cts +1 -0
  27. package/lib/player/HlsEngine.cjs +7 -1
  28. package/lib/player/HlsEngine.cjs.map +1 -1
  29. package/lib/player/HlsEngine.d.cts +2 -0
  30. package/lib/player/OptimizedPodRequest.cjs +21 -6
  31. package/lib/player/OptimizedPodRequest.cjs.map +1 -1
  32. package/lib/player/OptimizedPodRequest.d.cts +1 -1
  33. package/lib/player/PlayerControls.d.cts +1 -0
  34. package/lib/player/Scte35CueManager.d.cts +1 -0
  35. package/lib/player/Scte35Parser.d.cts +1 -0
  36. package/lib/player/StormcloudVideoPlayer.cjs +1459 -167
  37. package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
  38. package/lib/player/StormcloudVideoPlayer.d.cts +19 -1
  39. package/lib/player/playerTypes.d.cts +1 -0
  40. package/lib/players/HlsPlayer.cjs +1459 -167
  41. package/lib/players/HlsPlayer.cjs.map +1 -1
  42. package/lib/players/HlsPlayer.d.cts +1 -0
  43. package/lib/players/index.cjs +1459 -167
  44. package/lib/players/index.cjs.map +1 -1
  45. package/lib/props.cjs +6 -0
  46. package/lib/props.cjs.map +1 -1
  47. package/lib/props.d.cts +3 -0
  48. package/lib/sdk/hlsAdPlayer.cjs +32 -3
  49. package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
  50. package/lib/sdk/hlsAdPlayer.d.cts +1 -0
  51. package/lib/sdk/pal.cjs +10 -3
  52. package/lib/sdk/pal.cjs.map +1 -1
  53. package/lib/sdk/pal.d.cts +3 -0
  54. package/lib/types.d.cts +29 -1
  55. package/lib/ui/StormcloudVideoPlayer.cjs +1547 -169
  56. package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
  57. package/lib/ui/StormcloudVideoPlayer.d.cts +3 -0
  58. package/lib/utils/__tests__/adSignals.test.cjs +25817 -0
  59. package/lib/utils/__tests__/adSignals.test.cjs.map +1 -0
  60. package/lib/utils/__tests__/adSignals.test.d.cts +2 -0
  61. package/lib/utils/adIdentity.cjs +421 -0
  62. package/lib/utils/adIdentity.cjs.map +1 -0
  63. package/lib/utils/adIdentity.d.cts +30 -0
  64. package/lib/utils/browserCompat.cjs +13 -0
  65. package/lib/utils/browserCompat.cjs.map +1 -1
  66. package/lib/utils/browserCompat.d.cts +2 -1
  67. package/lib/utils/contentMetadata.cjs +324 -0
  68. package/lib/utils/contentMetadata.cjs.map +1 -0
  69. package/lib/utils/contentMetadata.d.cts +51 -0
  70. package/lib/utils/ctvVastSignals.cjs +250 -181
  71. package/lib/utils/ctvVastSignals.cjs.map +1 -1
  72. package/lib/utils/deviceInfo.cjs +698 -0
  73. package/lib/utils/deviceInfo.cjs.map +1 -0
  74. package/lib/utils/deviceInfo.d.cts +46 -0
  75. package/lib/utils/partnerSignals.cjs +294 -0
  76. package/lib/utils/partnerSignals.cjs.map +1 -0
  77. package/lib/utils/partnerSignals.d.cts +12 -0
  78. package/lib/utils/screenActivity.cjs +125 -0
  79. package/lib/utils/screenActivity.cjs.map +1 -0
  80. package/lib/utils/screenActivity.d.cts +5 -0
  81. package/lib/utils/tracking.cjs +406 -56
  82. package/lib/utils/tracking.cjs.map +1 -1
  83. package/lib/utils/tracking.d.cts +2 -1
  84. package/lib/utils/vastEnvironmentSignals.cjs +255 -85
  85. package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
  86. package/lib/utils/vastEnvironmentSignals.d.cts +8 -2
  87. package/lib/utils/vastMacros.cjs +58 -1
  88. package/lib/utils/vastMacros.cjs.map +1 -1
  89. package/lib/utils/vastMacros.d.cts +21 -0
  90. package/package.json +1 -1
@@ -308,8 +308,174 @@ __export(AdConfigManager_exports, {
308
308
  }
309
309
  });
310
310
  module.exports = __toCommonJS(AdConfigManager_exports);
311
+ // src/utils/adIdentity.ts
312
+ var GOOGLE_ID_TYPES = [
313
+ "aaid",
314
+ "adid",
315
+ "afai",
316
+ "idfa",
317
+ "lgudid",
318
+ "msai",
319
+ "rida",
320
+ "tifa",
321
+ "tvOS",
322
+ "vaid",
323
+ "vida",
324
+ "dpid"
325
+ ];
326
+ var MAX_SESSION_ID_AGE_MS = 6 * 60 * 60 * 1e3;
327
+ var DEFAULT_SESSION_ID_MAX_AGE_MS = MAX_SESSION_ID_AGE_MS;
328
+ var DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
329
+ var FALLBACK_DEVICE_ID_KEY = "stormcloud.ad.dpid.v2";
330
+ var SESSION_ID_KEY = "stormcloud.ad.sid.v2";
331
+ var LEGACY_SESSION_KEY = "stormcloud.ctv.sid";
332
+ var ZEROED_IDS = /* @__PURE__ */ new Set([
333
+ "00000000-0000-0000-0000-000000000000",
334
+ "38400000-8cf0-11bd-b23e-10b96e40000d"
335
+ ]);
336
+ var hostIdentity;
337
+ var memoryStore = {};
338
+ var lgUdidResult;
339
+ var legacyCleared = false;
340
+ function isUsableAdId(value) {
341
+ if (typeof value !== "string") return false;
342
+ var t = value.trim();
343
+ if (!t) return false;
344
+ if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(t)) return false;
345
+ if (/^(unknown|null|undefined|none|n\/a)$/i.test(t)) return false;
346
+ return !ZEROED_IDS.has(t.toLowerCase());
347
+ }
348
+ function isZeroedAdId(value) {
349
+ return typeof value === "string" && ZEROED_IDS.has(value.trim().toLowerCase());
350
+ }
351
+ function normalizeIdType(value) {
352
+ if (typeof value !== "string") return void 0;
353
+ var lower = value.trim().toLowerCase();
354
+ if (!lower) return void 0;
355
+ var match = GOOGLE_ID_TYPES.find(function(t) {
356
+ return t.toLowerCase() === lower;
357
+ });
358
+ return match !== null && match !== void 0 ? match : "dpid";
359
+ }
360
+ function createUuid() {
361
+ var _bytes_, _bytes_1, _bytes_i;
362
+ var c = typeof crypto !== "undefined" ? crypto : void 0;
363
+ if (c && typeof c.randomUUID === "function") return c.randomUUID();
364
+ var bytes = new Uint8Array(16);
365
+ if (c && typeof c.getRandomValues === "function") {
366
+ c.getRandomValues(bytes);
367
+ } else {
368
+ for(var i = 0; i < 16; i++)bytes[i] = Math.floor(Math.random() * 256);
369
+ }
370
+ bytes[6] = ((_bytes_ = bytes[6]) !== null && _bytes_ !== void 0 ? _bytes_ : 0) & 15 | 64;
371
+ bytes[8] = ((_bytes_1 = bytes[8]) !== null && _bytes_1 !== void 0 ? _bytes_1 : 0) & 63 | 128;
372
+ var hex = "";
373
+ for(var i1 = 0; i1 < 16; i1++)hex += ((_bytes_i = bytes[i1]) !== null && _bytes_i !== void 0 ? _bytes_i : 0).toString(16).padStart(2, "0");
374
+ return "".concat(hex.slice(0, 8), "-").concat(hex.slice(8, 12), "-").concat(hex.slice(12, 16), "-").concat(hex.slice(16, 20), "-").concat(hex.slice(20));
375
+ }
376
+ function readStored(key) {
377
+ try {
378
+ var _window_localStorage;
379
+ var raw = typeof window !== "undefined" ? (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.getItem(key) : null;
380
+ if (raw) {
381
+ var parsed = JSON.parse(raw);
382
+ if (parsed && typeof parsed.id === "string" && typeof parsed.createdAt === "number" && isFinite(parsed.createdAt)) {
383
+ return {
384
+ id: parsed.id,
385
+ createdAt: parsed.createdAt
386
+ };
387
+ }
388
+ }
389
+ } catch (unused) {}
390
+ return memoryStore[key];
391
+ }
392
+ function writeStored(key, value) {
393
+ memoryStore[key] = value;
394
+ try {
395
+ if (typeof window !== "undefined") {
396
+ var _window_localStorage;
397
+ (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.setItem(key, JSON.stringify(value));
398
+ }
399
+ } catch (unused) {}
400
+ }
401
+ function clearLegacyIdsOnce() {
402
+ if (legacyCleared) return;
403
+ legacyCleared = true;
404
+ try {
405
+ var _window_localStorage;
406
+ if (typeof window !== "undefined") (_window_localStorage = window.localStorage) === null || _window_localStorage === void 0 ? void 0 : _window_localStorage.removeItem(LEGACY_SESSION_KEY);
407
+ } catch (unused) {}
408
+ try {
409
+ if (typeof document !== "undefined") {
410
+ document.cookie = "".concat(encodeURIComponent(LEGACY_SESSION_KEY), "=;path=/;max-age=0;SameSite=Lax");
411
+ }
412
+ } catch (unused) {}
413
+ }
414
+ function clampAge(value, fallback, max) {
415
+ var v = typeof value === "number" && isFinite(value) && value > 0 ? value : fallback;
416
+ if (max != null) v = Math.min(v, max);
417
+ return v;
418
+ }
419
+ function getHostAdIdentity() {
420
+ return hostIdentity ? _object_spread({}, hostIdentity) : void 0;
421
+ }
422
+ function readSamsungTifa() {
423
+ try {
424
+ var _window_webapis;
425
+ var adinfo = typeof window !== "undefined" ? (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo : void 0;
426
+ if (!adinfo) return void 0;
427
+ var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
428
+ var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
429
+ if (isZeroedAdId(tifa)) return {
430
+ deviceIdType: "tifa",
431
+ limitAdTracking: true
432
+ };
433
+ if (!isUsableAdId(tifa)) return void 0;
434
+ return _object_spread({
435
+ deviceId: tifa.trim(),
436
+ deviceIdType: "tifa"
437
+ }, typeof lat === "boolean" ? {
438
+ limitAdTracking: lat
439
+ } : {});
440
+ } catch (unused) {
441
+ return void 0;
442
+ }
443
+ }
444
+ function readCachedLgUdid() {
445
+ return lgUdidResult ? _object_spread({}, lgUdidResult) : void 0;
446
+ }
447
+ function getOrRotateFallbackDeviceId() {
448
+ var maxAgeMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS, now = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : Date.now();
449
+ clearLegacyIdsOnce();
450
+ var age = clampAge(maxAgeMs, DEFAULT_FALLBACK_DEVICE_ID_MAX_AGE_MS);
451
+ var stored = readStored(FALLBACK_DEVICE_ID_KEY);
452
+ if (stored && isUsableAdId(stored.id) && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
453
+ return stored.id;
454
+ }
455
+ var id = createUuid();
456
+ writeStored(FALLBACK_DEVICE_ID_KEY, {
457
+ id: id,
458
+ createdAt: now
459
+ });
460
+ return id;
461
+ }
462
+ function getOrRotateSessionId() {
463
+ var maxAgeMs = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_SESSION_ID_MAX_AGE_MS, avoidValue = arguments.length > 1 ? arguments[1] : void 0, now = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : Date.now();
464
+ clearLegacyIdsOnce();
465
+ var age = clampAge(maxAgeMs, DEFAULT_SESSION_ID_MAX_AGE_MS, MAX_SESSION_ID_AGE_MS);
466
+ var stored = readStored(SESSION_ID_KEY);
467
+ if (stored && isUsableAdId(stored.id) && stored.id !== avoidValue && now - stored.createdAt >= 0 && now - stored.createdAt < age) {
468
+ return stored.id;
469
+ }
470
+ var id = createUuid();
471
+ while(id === avoidValue)id = createUuid();
472
+ writeStored(SESSION_ID_KEY, {
473
+ id: id,
474
+ createdAt: now
475
+ });
476
+ return id;
477
+ }
311
478
  // src/utils/vastEnvironmentSignals.ts
312
- var CTV_SESSION_STORAGE_KEY = "stormcloud.ctv.sid";
313
479
  var PLAYER_ID_STORAGE_KEY = "stormcloud.player.id";
314
480
  var DEVICE_ID_STORAGE_KEYS = [
315
481
  "rdid",
@@ -328,49 +494,96 @@ var ANDROID_ID_TYPES = /* @__PURE__ */ new Set([
328
494
  "adid"
329
495
  ]);
330
496
  function resolveVastEnvironmentSignals(isCtv) {
331
- var bridgeSignals = readNativeBridgeSignals();
332
- var platformDevice = readPlatformNativeDeviceId();
333
- var bridgeDeviceId = validDeviceId(bridgeSignals.deviceId);
334
- var realDeviceId = bridgeDeviceId || (isCtv ? validDeviceId(readStoredDeviceId()) : void 0) || validDeviceId(platformDevice.deviceId);
335
- var deviceId = realDeviceId;
336
- var deviceIdType = (bridgeDeviceId ? bridgeSignals.deviceIdType : void 0) || readStoredString("deviceIdType") || readStoredString("idtype") || platformDevice.deviceIdType || inferDeviceIdType();
337
- var platformLat = bridgeDeviceId ? bridgeSignals.limitAdTracking : platformDevice.limitAdTracking;
338
- var limitAdTracking = deviceId != null ? platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking() : void 0;
339
- if (!deviceId && isCtv) {
340
- var dpid = getOrCreateStoredUuid(PLAYER_ID_STORAGE_KEY);
341
- if (dpid) {
342
- deviceId = dpid;
343
- deviceIdType = "dpid";
344
- limitAdTracking = platformLat !== null && platformLat !== void 0 ? platformLat : readStoredLimitAdTracking();
345
- }
346
- }
497
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
347
498
  var deviceTypeHint = resolveDeviceTypeHint(isCtv);
499
+ var identity = resolveDeviceIdentity(isCtv, options);
500
+ var identityFields = _object_spread({}, identity.deviceId ? {
501
+ deviceId: identity.deviceId
502
+ } : {}, identity.deviceId && identity.deviceIdType ? {
503
+ deviceIdType: identity.deviceIdType
504
+ } : {}, identity.deviceId && identity.limitAdTracking != null ? {
505
+ limitAdTracking: identity.limitAdTracking
506
+ } : {}, identity.source ? {
507
+ deviceIdSource: identity.source
508
+ } : {});
348
509
  if (isCtv) {
349
510
  return _object_spread_props(_object_spread({
350
511
  isCtv: true,
351
- sessionId: getOrCreateCtvSessionId()
352
- }, deviceId ? {
353
- deviceId: deviceId
354
- } : {}, deviceId && deviceIdType ? {
355
- deviceIdType: deviceIdType
356
- } : {}, deviceId && limitAdTracking != null ? {
357
- limitAdTracking: limitAdTracking
358
- } : {}), {
512
+ sessionId: getOrRotateSessionId(options.sessionIdMaxAgeMs, identity.deviceId)
513
+ }, identityFields), {
359
514
  deviceTypeHint: deviceTypeHint
360
515
  });
361
516
  }
362
517
  return _object_spread_props(_object_spread({
363
518
  isCtv: false
364
- }, deviceId ? {
365
- deviceId: deviceId
366
- } : {}, deviceId && deviceIdType ? {
367
- deviceIdType: deviceIdType
368
- } : {}, deviceId && limitAdTracking != null ? {
369
- limitAdTracking: limitAdTracking
370
- } : {}), {
519
+ }, identityFields), {
371
520
  deviceTypeHint: deviceTypeHint
372
521
  });
373
522
  }
523
+ function resolveDeviceIdentity(isCtv, options) {
524
+ var _platform_limitAdTracking;
525
+ var host = getHostAdIdentity();
526
+ if (host) {
527
+ var _host_deviceIdType;
528
+ return _object_spread_props(_object_spread({
529
+ deviceId: host.deviceId,
530
+ deviceIdType: (_host_deviceIdType = host.deviceIdType) !== null && _host_deviceIdType !== void 0 ? _host_deviceIdType : "dpid"
531
+ }, host.limitAdTracking != null ? {
532
+ limitAdTracking: host.limitAdTracking
533
+ } : {}), {
534
+ source: "host"
535
+ });
536
+ }
537
+ var bridge = readNativeBridgeSignals();
538
+ var bridgeDeviceId = validDeviceId(bridge.deviceId);
539
+ if (bridgeDeviceId) {
540
+ var _normalizeIdType;
541
+ return _object_spread_props(_object_spread({
542
+ deviceId: bridgeDeviceId,
543
+ deviceIdType: (_normalizeIdType = normalizeIdType(bridge.deviceIdType)) !== null && _normalizeIdType !== void 0 ? _normalizeIdType : "dpid"
544
+ }, bridge.limitAdTracking != null ? {
545
+ limitAdTracking: bridge.limitAdTracking
546
+ } : {}), {
547
+ source: "bridge"
548
+ });
549
+ }
550
+ var platform = readPlatformNativeDeviceId();
551
+ var platformDeviceId = validDeviceId(platform.deviceId);
552
+ if (platformDeviceId) {
553
+ var _platform_deviceIdType;
554
+ return _object_spread_props(_object_spread({
555
+ deviceId: platformDeviceId,
556
+ deviceIdType: (_platform_deviceIdType = platform.deviceIdType) !== null && _platform_deviceIdType !== void 0 ? _platform_deviceIdType : "dpid"
557
+ }, platform.limitAdTracking != null ? {
558
+ limitAdTracking: platform.limitAdTracking
559
+ } : {}), {
560
+ source: "platform"
561
+ });
562
+ }
563
+ if (!isCtv) return {};
564
+ var storedDeviceId = validDeviceId(readStoredDeviceId());
565
+ if (storedDeviceId) {
566
+ var _normalizeIdType1;
567
+ var storedLat = readStoredLimitAdTracking();
568
+ return _object_spread_props(_object_spread({
569
+ deviceId: storedDeviceId,
570
+ deviceIdType: (_normalizeIdType1 = normalizeIdType(readStoredString("deviceIdType") || readStoredString("idtype"))) !== null && _normalizeIdType1 !== void 0 ? _normalizeIdType1 : "dpid"
571
+ }, storedLat != null ? {
572
+ limitAdTracking: storedLat
573
+ } : {}), {
574
+ source: "stored"
575
+ });
576
+ }
577
+ var fallbackLat = (_platform_limitAdTracking = platform.limitAdTracking) !== null && _platform_limitAdTracking !== void 0 ? _platform_limitAdTracking : readStoredLimitAdTracking();
578
+ return _object_spread_props(_object_spread({
579
+ deviceId: getOrRotateFallbackDeviceId(options.fallbackDeviceIdMaxAgeMs),
580
+ deviceIdType: "dpid"
581
+ }, fallbackLat != null ? {
582
+ limitAdTracking: fallbackLat
583
+ } : {}), {
584
+ source: "generated"
585
+ });
586
+ }
374
587
  var DEVICE_TYPE_HINT = {
375
588
  FEATURE_PHONE: 1,
376
589
  SMARTPHONE: 2,
@@ -531,7 +744,7 @@ function resolveNativeDeviceId() {
531
744
  var bridgeSignals = readNativeBridgeSignals();
532
745
  var platformDevice = readPlatformNativeDeviceId();
533
746
  var deviceId = bridgeSignals.deviceId || (includeStored ? readStoredDeviceId() : void 0) || platformDevice.deviceId;
534
- if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId(deviceId)) {
747
+ if (!deviceId || isMacroPlaceholder(deviceId) || isZeroedAdId2(deviceId)) {
535
748
  return void 0;
536
749
  }
537
750
  return deviceId;
@@ -545,20 +758,10 @@ function getOrCreateStoredUuid(storageKey) {
545
758
  writePersistentId(storageKey, existing);
546
759
  return existing;
547
760
  }
548
- var id = createUuid();
761
+ var id = createUuid2();
549
762
  writePersistentId(storageKey, id);
550
763
  return id;
551
764
  }
552
- function getOrCreateCtvSessionId() {
553
- var existing = readPersistentId(CTV_SESSION_STORAGE_KEY);
554
- if (existing) {
555
- writePersistentId(CTV_SESSION_STORAGE_KEY, existing);
556
- return existing;
557
- }
558
- var sessionId = createUuid();
559
- writePersistentId(CTV_SESSION_STORAGE_KEY, sessionId);
560
- return sessionId;
561
- }
562
765
  function readPersistentId(storageKey) {
563
766
  return readStoredString(storageKey) || readCookie(storageKey);
564
767
  }
@@ -611,7 +814,7 @@ function writeCookie(name, value) {
611
814
  document.cookie = encodeURIComponent(name) + "=" + encodeURIComponent(value) + ";path=/;max-age=" + PERSISTENT_ID_COOKIE_MAX_AGE + ";SameSite=Lax";
612
815
  } catch (unused) {}
613
816
  }
614
- function createUuid() {
817
+ function createUuid2() {
615
818
  var _bytes_, _bytes_1;
616
819
  if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
617
820
  return crypto.randomUUID();
@@ -645,44 +848,10 @@ function performanceNow() {
645
848
  }
646
849
  function readPlatformNativeDeviceId() {
647
850
  if (typeof window === "undefined") return {};
648
- try {
649
- var _window_webapis;
650
- var adinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.adinfo;
651
- if (adinfo) {
652
- var tifa = typeof adinfo.getTIFA === "function" ? adinfo.getTIFA() : adinfo.tifa;
653
- if (typeof tifa === "string" && tifa && !isMacroPlaceholder(tifa)) {
654
- var lat = typeof adinfo.isLATEnabled === "function" ? adinfo.isLATEnabled() : void 0;
655
- return _object_spread({
656
- deviceId: tifa,
657
- deviceIdType: "tifa"
658
- }, typeof lat === "boolean" ? {
659
- limitAdTracking: lat
660
- } : {});
661
- }
662
- }
663
- } catch (unused) {}
664
- try {
665
- var webOSDev = window.webOSDev;
666
- if (webOSDev) {
667
- var _webOSDev_lgudid;
668
- var lgudid = typeof webOSDev.LGUDID === "function" ? webOSDev.LGUDID() : (_webOSDev_lgudid = webOSDev.lgudid) !== null && _webOSDev_lgudid !== void 0 ? _webOSDev_lgudid : webOSDev.LGUDID;
669
- if (typeof lgudid === "string" && lgudid) {
670
- if (isZeroedAdId(lgudid)) {
671
- return {
672
- deviceIdType: "lgudid",
673
- limitAdTracking: true
674
- };
675
- }
676
- if (!isMacroPlaceholder(lgudid)) {
677
- return {
678
- deviceId: lgudid,
679
- deviceIdType: "lgudid",
680
- limitAdTracking: false
681
- };
682
- }
683
- }
684
- }
685
- } catch (unused) {}
851
+ var tifa = readSamsungTifa();
852
+ if (tifa) return tifa;
853
+ var lgudid = readCachedLgUdid();
854
+ if (lgudid) return lgudid;
686
855
  try {
687
856
  var roku = window.Roku;
688
857
  if (roku) {
@@ -709,7 +878,7 @@ function isMacroPlaceholder(value) {
709
878
  function validDeviceId(value) {
710
879
  return value && !isMacroPlaceholder(value) ? value : void 0;
711
880
  }
712
- function isZeroedAdId(value) {
881
+ function isZeroedAdId2(value) {
713
882
  return ZEROED_AD_ID_PATTERNS.has(value.trim().toLowerCase());
714
883
  }
715
884
  function readNativeBridgeSignals() {
@@ -753,7 +922,7 @@ function readNativeBridgeSignals() {
753
922
  "deviceIdType",
754
923
  "advertisingIdType",
755
924
  "idType"
756
- ]) || inferDeviceIdType();
925
+ ]) || void 0;
757
926
  var limitAdTracking = readBridgeBoolean(source, [
758
927
  "is_lat",
759
928
  "limitAdTracking",
@@ -933,6 +1102,294 @@ function normalizeBoolean(value) {
933
1102
  }
934
1103
  return void 0;
935
1104
  }
1105
+ // src/utils/contentMetadata.ts
1106
+ var MAX_CONTENT_VALUE_LENGTH = 128;
1107
+ var BRIDGE_KEYS = {
1108
+ channelName: [
1109
+ "channelName",
1110
+ "ct_ch"
1111
+ ],
1112
+ programTitle: [
1113
+ "programTitle",
1114
+ "ct_ti"
1115
+ ],
1116
+ contentNetwork: [
1117
+ "contentNetwork",
1118
+ "ct_ne"
1119
+ ],
1120
+ contentType: [
1121
+ "contentType",
1122
+ "ctt"
1123
+ ],
1124
+ contentCategory: [
1125
+ "contentCategory",
1126
+ "ctc"
1127
+ ],
1128
+ contentGenre: [
1129
+ "contentGenre",
1130
+ "ctgr"
1131
+ ],
1132
+ contentLanguage: [
1133
+ "contentLanguage",
1134
+ "ctlg"
1135
+ ],
1136
+ contentDuration: [
1137
+ "contentDuration",
1138
+ "ctd"
1139
+ ],
1140
+ contentSeason: [
1141
+ "contentSeason",
1142
+ "cts"
1143
+ ],
1144
+ contentEpisode: [
1145
+ "contentEpisode",
1146
+ "cte"
1147
+ ],
1148
+ contentRating: [
1149
+ "contentRating",
1150
+ "ctr"
1151
+ ],
1152
+ contentId: [
1153
+ "contentId",
1154
+ "ctid"
1155
+ ]
1156
+ };
1157
+ function sanitizeContentValue(value) {
1158
+ if (typeof value !== "string") return void 0;
1159
+ var cleaned = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
1160
+ if (!cleaned) return void 0;
1161
+ if (/^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%|\$\{[^}]+\})$/.test(cleaned)) return void 0;
1162
+ if (/^(unknown|null|undefined|none|n\/a|-)$/i.test(cleaned)) return void 0;
1163
+ return cleaned.length > MAX_CONTENT_VALUE_LENGTH ? cleaned.slice(0, MAX_CONTENT_VALUE_LENGTH).trim() : cleaned;
1164
+ }
1165
+ function sanitizeContentScalar(value) {
1166
+ if (typeof value === "number") {
1167
+ return Number.isFinite(value) ? String(value) : void 0;
1168
+ }
1169
+ return sanitizeContentValue(value);
1170
+ }
1171
+ function normalizeContentLanguage(value) {
1172
+ var cleaned = sanitizeContentValue(value);
1173
+ if (!cleaned) return void 0;
1174
+ var match = cleaned.match(/^([A-Za-z]{2})(?:[-_][A-Za-z0-9]{1,8})*$/);
1175
+ return match && match[1] ? match[1].toLowerCase() : void 0;
1176
+ }
1177
+ function normalizeContentDuration(value) {
1178
+ var raw = sanitizeContentScalar(value);
1179
+ if (raw == null || !/^-?\d+(\.\d+)?$/.test(raw)) return void 0;
1180
+ var seconds = Number(raw);
1181
+ if (seconds === -1) return -1;
1182
+ return seconds > 0 ? Math.round(seconds) : void 0;
1183
+ }
1184
+ function bridgeSources() {
1185
+ if (typeof window === "undefined") return [];
1186
+ var w = window;
1187
+ return [
1188
+ w.__STORMCLOUD_CTV__,
1189
+ w.__STORMCLOUD_CTV_AD_INFO__,
1190
+ w.stormcloudCtv
1191
+ ].filter(Boolean);
1192
+ }
1193
+ function readBridgeValue2(keys, sanitize) {
1194
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
1195
+ try {
1196
+ for(var _iterator = bridgeSources()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
1197
+ var source = _step.value;
1198
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
1199
+ try {
1200
+ for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
1201
+ var key = _step1.value;
1202
+ var value = void 0;
1203
+ try {
1204
+ value = source === null || source === void 0 ? void 0 : source[key];
1205
+ if (typeof value === "function") value = value.call(source);
1206
+ } catch (unused) {
1207
+ value = void 0;
1208
+ }
1209
+ var sanitized = sanitize(value);
1210
+ if (sanitized != null) return sanitized;
1211
+ }
1212
+ } catch (err) {
1213
+ _didIteratorError1 = true;
1214
+ _iteratorError1 = err;
1215
+ } finally{
1216
+ try {
1217
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
1218
+ _iterator1.return();
1219
+ }
1220
+ } finally{
1221
+ if (_didIteratorError1) {
1222
+ throw _iteratorError1;
1223
+ }
1224
+ }
1225
+ }
1226
+ }
1227
+ } catch (err) {
1228
+ _didIteratorError = true;
1229
+ _iteratorError = err;
1230
+ } finally{
1231
+ try {
1232
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
1233
+ _iterator.return();
1234
+ }
1235
+ } finally{
1236
+ if (_didIteratorError) {
1237
+ throw _iteratorError;
1238
+ }
1239
+ }
1240
+ }
1241
+ return void 0;
1242
+ }
1243
+ function readBridgeContentValue(keys) {
1244
+ return readBridgeValue2(keys, sanitizeContentValue);
1245
+ }
1246
+ function resolveContentMetadata(config) {
1247
+ var _sanitizeContentValue, _sanitizeContentValue1, _sanitizeContentValue2, _config_contentDetails, _sanitizeContentValue3, _sanitizeContentValue4, _sanitizeContentValue5, _normalizeContentLanguage, _normalizeContentDuration, _sanitizeContentScalar, _sanitizeContentScalar1, _sanitizeContentValue6, _sanitizeContentValue7;
1248
+ var channelName = (_sanitizeContentValue = sanitizeContentValue(config.channelName)) !== null && _sanitizeContentValue !== void 0 ? _sanitizeContentValue : readBridgeContentValue(BRIDGE_KEYS.channelName);
1249
+ var programTitle = (_sanitizeContentValue1 = sanitizeContentValue(config.programTitle)) !== null && _sanitizeContentValue1 !== void 0 ? _sanitizeContentValue1 : readBridgeContentValue(BRIDGE_KEYS.programTitle);
1250
+ var contentNetwork = (_sanitizeContentValue2 = sanitizeContentValue(config.contentNetwork)) !== null && _sanitizeContentValue2 !== void 0 ? _sanitizeContentValue2 : readBridgeContentValue(BRIDGE_KEYS.contentNetwork);
1251
+ var details = (_config_contentDetails = config.contentDetails) !== null && _config_contentDetails !== void 0 ? _config_contentDetails : {};
1252
+ var contentType = (_sanitizeContentValue3 = sanitizeContentValue(details.contentType)) !== null && _sanitizeContentValue3 !== void 0 ? _sanitizeContentValue3 : readBridgeContentValue(BRIDGE_KEYS.contentType);
1253
+ var contentCategory = (_sanitizeContentValue4 = sanitizeContentValue(details.category)) !== null && _sanitizeContentValue4 !== void 0 ? _sanitizeContentValue4 : readBridgeContentValue(BRIDGE_KEYS.contentCategory);
1254
+ var contentGenre = (_sanitizeContentValue5 = sanitizeContentValue(details.genre)) !== null && _sanitizeContentValue5 !== void 0 ? _sanitizeContentValue5 : readBridgeContentValue(BRIDGE_KEYS.contentGenre);
1255
+ var contentLanguage = (_normalizeContentLanguage = normalizeContentLanguage(details.language)) !== null && _normalizeContentLanguage !== void 0 ? _normalizeContentLanguage : readBridgeValue2(BRIDGE_KEYS.contentLanguage, normalizeContentLanguage);
1256
+ var contentDurationSeconds = (_normalizeContentDuration = normalizeContentDuration(details.durationSeconds)) !== null && _normalizeContentDuration !== void 0 ? _normalizeContentDuration : readBridgeValue2(BRIDGE_KEYS.contentDuration, normalizeContentDuration);
1257
+ var contentSeason = (_sanitizeContentScalar = sanitizeContentScalar(details.season)) !== null && _sanitizeContentScalar !== void 0 ? _sanitizeContentScalar : readBridgeValue2(BRIDGE_KEYS.contentSeason, sanitizeContentScalar);
1258
+ var contentEpisode = (_sanitizeContentScalar1 = sanitizeContentScalar(details.episode)) !== null && _sanitizeContentScalar1 !== void 0 ? _sanitizeContentScalar1 : readBridgeValue2(BRIDGE_KEYS.contentEpisode, sanitizeContentScalar);
1259
+ var contentRating = (_sanitizeContentValue6 = sanitizeContentValue(details.rating)) !== null && _sanitizeContentValue6 !== void 0 ? _sanitizeContentValue6 : readBridgeContentValue(BRIDGE_KEYS.contentRating);
1260
+ var contentId = (_sanitizeContentValue7 = sanitizeContentValue(details.contentId)) !== null && _sanitizeContentValue7 !== void 0 ? _sanitizeContentValue7 : readBridgeContentValue(BRIDGE_KEYS.contentId);
1261
+ return _object_spread({}, channelName ? {
1262
+ channelName: channelName
1263
+ } : {}, programTitle ? {
1264
+ programTitle: programTitle
1265
+ } : {}, contentNetwork ? {
1266
+ contentNetwork: contentNetwork
1267
+ } : {}, contentType ? {
1268
+ contentType: contentType
1269
+ } : {}, contentCategory ? {
1270
+ contentCategory: contentCategory
1271
+ } : {}, contentGenre ? {
1272
+ contentGenre: contentGenre
1273
+ } : {}, contentLanguage ? {
1274
+ contentLanguage: contentLanguage
1275
+ } : {}, contentDurationSeconds != null ? {
1276
+ contentDurationSeconds: contentDurationSeconds
1277
+ } : {}, contentSeason ? {
1278
+ contentSeason: contentSeason
1279
+ } : {}, contentEpisode ? {
1280
+ contentEpisode: contentEpisode
1281
+ } : {}, contentRating ? {
1282
+ contentRating: contentRating
1283
+ } : {}, contentId ? {
1284
+ contentId: contentId
1285
+ } : {});
1286
+ }
1287
+ function appendMissingContentParams(url, meta) {
1288
+ if (!meta.channelName && !meta.programTitle && !meta.contentNetwork) return url;
1289
+ try {
1290
+ var parsed = new URL(url);
1291
+ var add = function add(key, value) {
1292
+ if (value && !parsed.searchParams.has(key)) parsed.searchParams.set(key, value);
1293
+ };
1294
+ add("ct_ch", meta.channelName);
1295
+ add("ct_ti", meta.programTitle);
1296
+ add("ct_ne", meta.contentNetwork);
1297
+ return parsed.toString();
1298
+ } catch (unused) {
1299
+ return url;
1300
+ }
1301
+ }
1302
+ // src/utils/partnerSignals.ts
1303
+ var PLATFORM_IFA_TYPES = /* @__PURE__ */ new Set([
1304
+ "aaid",
1305
+ "adid",
1306
+ "afai",
1307
+ "idfa",
1308
+ "lgudid",
1309
+ "msai",
1310
+ "rida",
1311
+ "tifa",
1312
+ "tvos",
1313
+ "vaid",
1314
+ "vida"
1315
+ ]);
1316
+ function toIabIfaType(deviceIdType, source) {
1317
+ if (!deviceIdType) return void 0;
1318
+ var type = deviceIdType.trim().toLowerCase();
1319
+ if (source === "generated") return "sessionid";
1320
+ if (PLATFORM_IFA_TYPES.has(type)) return type;
1321
+ if (source === "platform") return "dpid";
1322
+ return "ppid";
1323
+ }
1324
+ function playbackMethodCode(autoPlay, muted) {
1325
+ if (autoPlay === false) return 3;
1326
+ if (autoPlay !== true || muted == null) return void 0;
1327
+ return muted ? 2 : 1;
1328
+ }
1329
+ function resolvePlayerSize(video) {
1330
+ var width = video ? video.clientWidth : 0;
1331
+ var height = video ? video.clientHeight : 0;
1332
+ if (!(width > 0 && height > 0) && typeof window !== "undefined") {
1333
+ width = window.innerWidth;
1334
+ height = window.innerHeight;
1335
+ }
1336
+ if (!(width > 0 && height > 0)) return {};
1337
+ return {
1338
+ width: Math.round(width),
1339
+ height: Math.round(height)
1340
+ };
1341
+ }
1342
+ function sanitizeUserId(value) {
1343
+ var cleaned = sanitizeContentValue(value);
1344
+ if (!cleaned || /\s/.test(cleaned)) return void 0;
1345
+ return cleaned;
1346
+ }
1347
+ function isPublicIpv4(ip) {
1348
+ var parts = ip.split(".");
1349
+ if (parts.length !== 4) return false;
1350
+ var nums = parts.map(function(p) {
1351
+ return /^\d{1,3}$/.test(p) ? Number(p) : NaN;
1352
+ });
1353
+ if (nums.some(function(n) {
1354
+ return !(n >= 0 && n <= 255);
1355
+ })) return false;
1356
+ var _nums = _sliced_to_array(nums, 2), a = _nums[0], b = _nums[1];
1357
+ if (a === 0 || a === 10 || a === 127 || a >= 224) return false;
1358
+ if (a === 100 && b >= 64 && b <= 127) return false;
1359
+ if (a === 169 && b === 254) return false;
1360
+ if (a === 172 && b >= 16 && b <= 31) return false;
1361
+ if (a === 192 && b === 168) return false;
1362
+ return true;
1363
+ }
1364
+ function isPublicIpv6(ip) {
1365
+ var lower = ip.toLowerCase();
1366
+ if (!/^[0-9a-f:]+$/.test(lower) || lower.split(":").length < 3) return false;
1367
+ if (lower === "::" || lower === "::1") return false;
1368
+ if (/^fe[89ab]/.test(lower)) return false;
1369
+ if (/^f[cd]/.test(lower)) return false;
1370
+ return true;
1371
+ }
1372
+ function sanitizePublicIp(value) {
1373
+ var cleaned = sanitizeContentValue(value);
1374
+ if (!cleaned) return void 0;
1375
+ if (cleaned.includes(".")) return isPublicIpv4(cleaned) ? cleaned : void 0;
1376
+ return isPublicIpv6(cleaned) ? cleaned : void 0;
1377
+ }
1378
+ function resolveUserId(configValue) {
1379
+ var _sanitizeUserId;
1380
+ return (_sanitizeUserId = sanitizeUserId(configValue)) !== null && _sanitizeUserId !== void 0 ? _sanitizeUserId : readBridgeValue2([
1381
+ "userId",
1382
+ "uid"
1383
+ ], sanitizeUserId);
1384
+ }
1385
+ function resolveClientIp(configValue) {
1386
+ var _sanitizePublicIp;
1387
+ return (_sanitizePublicIp = sanitizePublicIp(configValue)) !== null && _sanitizePublicIp !== void 0 ? _sanitizePublicIp : readBridgeValue2([
1388
+ "ipAddress",
1389
+ "clientIp",
1390
+ "ip"
1391
+ ], sanitizePublicIp);
1392
+ }
936
1393
  // src/utils/vastMacros.ts
937
1394
  var UNEXPANDED_MACRO_PATTERN = /^(\[[^\]]*\]|\{[^}]*\}|%%[^%]*%%)$/;
938
1395
  var INVALID_VAST_PARAM_KEY = /^\s|\s$/;
@@ -1250,7 +1707,8 @@ var NESTED_QUERY_PARAM_KEYS = /* @__PURE__ */ new Set([
1250
1707
  var SCVP_POD_MACROS = /* @__PURE__ */ new Set([
1251
1708
  "PMND",
1252
1709
  "PMXD",
1253
- "PMAD"
1710
+ "PMAD",
1711
+ "MABD"
1254
1712
  ]);
1255
1713
  function hasScvpMacros(url) {
1256
1714
  return !!url && SCVP_MACRO_DETECT.test(url);
@@ -1295,12 +1753,15 @@ function resolveScvpMacroValues(ctx) {
1295
1753
  set("RDID", deviceId);
1296
1754
  set("IDTYPE", deviceIdType);
1297
1755
  set("IS-LAT", (_toFlag = toFlag(ctx.limitAdTracking)) !== null && _toFlag !== void 0 ? _toFlag : "0");
1756
+ set("IFA", deviceId);
1757
+ set("IFA-TYPE", toIabIfaType(deviceIdType, ctx.deviceIdSource));
1298
1758
  }
1299
1759
  set("SID", ctx.sessionId);
1300
1760
  set("DTH", ctx.deviceTypeHint);
1301
1761
  set("GIVN", ctx.palNonce);
1302
1762
  set("CT-TI", ctx.programTitle);
1303
1763
  set("CT-CH", ctx.channelName);
1764
+ set("CT-NE", ctx.contentNetwork);
1304
1765
  set("POD", ctx.pod);
1305
1766
  set("CORRELATOR", ctx.correlator);
1306
1767
  set("SCOR", ctx.streamCorrelator);
@@ -1311,6 +1772,26 @@ function resolveScvpMacroValues(ctx) {
1311
1772
  set("GDPR", (_ctx_consent = ctx.consent) === null || _ctx_consent === void 0 ? void 0 : _ctx_consent.gdpr);
1312
1773
  set("GDPR-CONSENT", (_ctx_consent1 = ctx.consent) === null || _ctx_consent1 === void 0 ? void 0 : _ctx_consent1.gdprConsent);
1313
1774
  set("US-PRIVACY", (_ctx_consent2 = ctx.consent) === null || _ctx_consent2 === void 0 ? void 0 : _ctx_consent2.usPrivacy);
1775
+ set("PLAYER-WIDTH", ctx.playerWidth);
1776
+ set("PLAYER-HEIGHT", ctx.playerHeight);
1777
+ set("TIMESTAMP", ctx.timestamp);
1778
+ set("LIVE", toFlag(ctx.isLive));
1779
+ set("VPMT", playbackMethodCode(ctx.isCtv ? true : ctx.adWillAutoPlay, ctx.adWillPlayMuted));
1780
+ set("DEVICE-MAKE", ctx.deviceMake);
1781
+ set("DEVICE-MODEL", ctx.deviceModel);
1782
+ set("DEVICE-HWV", ctx.deviceHardwareVersion);
1783
+ set("UA", ctx.userAgent);
1784
+ set("IP", ctx.ipAddress);
1785
+ set("UID", ctx.userId);
1786
+ set("CT-TYPE", ctx.contentType);
1787
+ set("CT-CATEGORY", ctx.contentCategory);
1788
+ set("CT-GENRE", ctx.contentGenre);
1789
+ set("CT-LANGUAGE", ctx.contentLanguage);
1790
+ set("CT-DURATION", ctx.contentDurationSeconds != null ? ctx.contentDurationSeconds : ctx.isLive ? -1 : void 0);
1791
+ set("CT-SEASON", ctx.contentSeason);
1792
+ set("CT-EPISODE", ctx.contentEpisode);
1793
+ set("CT-RATING", ctx.contentRating);
1794
+ set("CT-ID", ctx.contentId);
1314
1795
  return values;
1315
1796
  }
1316
1797
  var keepNone = function keepNone() {
@@ -1522,6 +2003,9 @@ function applyVastMacros(baseUrl, ctx) {
1522
2003
  if (ctx.channelName) {
1523
2004
  params.set("ct_ch", ctx.channelName);
1524
2005
  }
2006
+ if (ctx.contentNetwork) {
2007
+ params.set("ct_ne", ctx.contentNetwork);
2008
+ }
1525
2009
  var staleKeys = [];
1526
2010
  params.forEach(function(value, key) {
1527
2011
  if (isMacroPlaceholder2(value)) {
@@ -1560,7 +2044,7 @@ function replaceCorrelatorFallback(baseUrl, correlator) {
1560
2044
  return "".concat(baseUrl).concat(sep, "correlator=").concat(correlator);
1561
2045
  }
1562
2046
  // src/player/OptimizedPodRequest.ts
1563
- var DEFAULT_REQUEST_SAFETY_MS = 1500;
2047
+ var DEFAULT_REQUEST_SAFETY_MS = 2500;
1564
2048
  function nonNegativeInt(value) {
1565
2049
  return typeof value === "number" && Number.isFinite(value) && value >= 0 ? Math.floor(value) : void 0;
1566
2050
  }
@@ -1578,6 +2062,358 @@ function resolveAdPodConfig(config) {
1578
2062
  exactDuration: config.podExactDuration === true
1579
2063
  };
1580
2064
  }
2065
+ // src/utils/deviceInfo.ts
2066
+ var CATEGORY_CODES = {
2067
+ "LG TV": "lg_tv",
2068
+ "LG Set-Top Box": "lg_stb",
2069
+ "Samsung TV": "samsung_tv",
2070
+ Other: "other"
2071
+ };
2072
+ var DEVICE_CATEGORIES = [
2073
+ "LG TV",
2074
+ "LG Set-Top Box",
2075
+ "Samsung TV",
2076
+ "Other"
2077
+ ];
2078
+ var hostDeviceInfo;
2079
+ var lgDeviceInfo;
2080
+ var platformCache;
2081
+ var primePromise;
2082
+ function cleanString(value) {
2083
+ var maxLength = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 128;
2084
+ if (typeof value !== "string") return void 0;
2085
+ var t = value.replace(/[\u0000-\u001f\u007f]/g, " ").replace(/\s+/g, " ").trim();
2086
+ if (!t || /^(unknown|null|undefined|none|n\/a|-|0)$/i.test(t)) return void 0;
2087
+ return t.length > maxLength ? t.slice(0, maxLength) : t;
2088
+ }
2089
+ function safeCall2(fn, thisArg) {
2090
+ if (typeof fn !== "function") return void 0;
2091
+ try {
2092
+ return fn.call(thisArg);
2093
+ } catch (unused) {
2094
+ return void 0;
2095
+ }
2096
+ }
2097
+ function userAgent() {
2098
+ return typeof navigator !== "undefined" ? navigator.userAgent || "" : "";
2099
+ }
2100
+ function bridgeSources2() {
2101
+ if (typeof window === "undefined") return [];
2102
+ var w = window;
2103
+ return [
2104
+ w.__STORMCLOUD_CTV__,
2105
+ w.__STORMCLOUD_CTV_AD_INFO__,
2106
+ w.stormcloudCtv
2107
+ ].filter(Boolean);
2108
+ }
2109
+ function readBridge(keys) {
2110
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
2111
+ try {
2112
+ for(var _iterator = bridgeSources2()[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
2113
+ var source = _step.value;
2114
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = undefined;
2115
+ try {
2116
+ for(var _iterator1 = keys[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true){
2117
+ var key = _step1.value;
2118
+ var value = void 0;
2119
+ try {
2120
+ value = source === null || source === void 0 ? void 0 : source[key];
2121
+ if (typeof value === "function") value = value.call(source);
2122
+ } catch (unused) {
2123
+ value = void 0;
2124
+ }
2125
+ var clean = cleanString(value);
2126
+ if (clean) return clean;
2127
+ }
2128
+ } catch (err) {
2129
+ _didIteratorError1 = true;
2130
+ _iteratorError1 = err;
2131
+ } finally{
2132
+ try {
2133
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) {
2134
+ _iterator1.return();
2135
+ }
2136
+ } finally{
2137
+ if (_didIteratorError1) {
2138
+ throw _iteratorError1;
2139
+ }
2140
+ }
2141
+ }
2142
+ }
2143
+ } catch (err) {
2144
+ _didIteratorError = true;
2145
+ _iteratorError = err;
2146
+ } finally{
2147
+ try {
2148
+ if (!_iteratorNormalCompletion && _iterator.return != null) {
2149
+ _iterator.return();
2150
+ }
2151
+ } finally{
2152
+ if (_didIteratorError) {
2153
+ throw _iteratorError;
2154
+ }
2155
+ }
2156
+ }
2157
+ return void 0;
2158
+ }
2159
+ function makeForCategory(category) {
2160
+ if (category === "LG TV" || category === "LG Set-Top Box") return "LG";
2161
+ if (category === "Samsung TV") return "Samsung";
2162
+ return void 0;
2163
+ }
2164
+ function normalizeCategory(value) {
2165
+ var v = cleanString(value);
2166
+ if (!v) return void 0;
2167
+ var exact = DEVICE_CATEGORIES.find(function(c) {
2168
+ return c.toLowerCase() === v.toLowerCase();
2169
+ });
2170
+ if (exact) return exact;
2171
+ var code = v.toLowerCase().replace(/[\s-]+/g, "_");
2172
+ var byCode = Object.keys(CATEGORY_CODES).find(function(c) {
2173
+ return CATEGORY_CODES[c] === code;
2174
+ });
2175
+ return byCode;
2176
+ }
2177
+ function parseUserAgentDeviceInfo(ua) {
2178
+ var sources = [];
2179
+ var out = {
2180
+ platform: "other",
2181
+ sources: sources
2182
+ };
2183
+ var chrome = ua.match(/(?:Chrome|PCBR)\/(\d+)\./) || ua.match(/\s(\d{2,3})\.\d+\.\d+\.\d+\/[\d.]+\s+TV\b/);
2184
+ if (chrome && chrome[1]) out.browserMajorVersion = parseInt(chrome[1], 10);
2185
+ if (/Web0S|webOS/i.test(ua)) {
2186
+ out.platform = "webos";
2187
+ var lg = ua.match(/LGE\s*;\s*([A-Za-z0-9][A-Za-z0-9._-]*)\s*;\s*(\d{2}\.\d{2}\.\d{2})/);
2188
+ if (lg && lg[1] && lg[2]) {
2189
+ out.model = lg[1];
2190
+ out.firmware = lg[2];
2191
+ sources.push("user_agent");
2192
+ }
2193
+ } else if (/Tizen/i.test(ua)) {
2194
+ out.platform = "tizen";
2195
+ var tizen = ua.match(/Tizen\s+(\d+(?:\.\d+)*)/i);
2196
+ if (tizen && tizen[1]) {
2197
+ out.osVersion = "Tizen ".concat(tizen[1]);
2198
+ sources.push("user_agent");
2199
+ }
2200
+ }
2201
+ return out;
2202
+ }
2203
+ function readSamsungProductInfo() {
2204
+ var _cleanString;
2205
+ var _window_webapis;
2206
+ if (typeof window === "undefined") return void 0;
2207
+ var productinfo = (_window_webapis = window.webapis) === null || _window_webapis === void 0 ? void 0 : _window_webapis.productinfo;
2208
+ if (!productinfo) return void 0;
2209
+ var model = (_cleanString = cleanString(safeCall2(productinfo.getRealModel, productinfo), 40)) !== null && _cleanString !== void 0 ? _cleanString : cleanString(safeCall2(productinfo.getModel, productinfo), 40);
2210
+ var firmware = cleanString(safeCall2(productinfo.getFirmware, productinfo), 64);
2211
+ var duid = cleanString(safeCall2(productinfo.getDuid, productinfo), 128);
2212
+ if (!model && !firmware && !duid) return void 0;
2213
+ return _object_spread({}, model ? {
2214
+ model: model
2215
+ } : {}, firmware ? {
2216
+ firmware: firmware
2217
+ } : {}, duid ? {
2218
+ internalDeviceId: duid,
2219
+ internalDeviceIdSource: "samsung_duid"
2220
+ } : {});
2221
+ }
2222
+ function computePlatformInfo() {
2223
+ var info = parseUserAgentDeviceInfo(userAgent());
2224
+ var sources = _to_consumable_array(info.sources);
2225
+ var samsung = readSamsungProductInfo();
2226
+ if (samsung) {
2227
+ info.platform = "tizen";
2228
+ if (samsung.model) info.model = samsung.model;
2229
+ if (samsung.firmware) info.firmware = samsung.firmware;
2230
+ if (samsung.internalDeviceId) {
2231
+ info.internalDeviceId = samsung.internalDeviceId;
2232
+ info.internalDeviceIdSource = "samsung_duid";
2233
+ }
2234
+ sources.push("samsung_productinfo");
2235
+ }
2236
+ if (lgDeviceInfo) {
2237
+ info.platform = "webos";
2238
+ if (!info.model && lgDeviceInfo.model) info.model = lgDeviceInfo.model;
2239
+ if (!info.firmware && lgDeviceInfo.firmware) info.firmware = lgDeviceInfo.firmware;
2240
+ if (lgDeviceInfo.sdkVersion) info.osVersion = "webOS TV ".concat(lgDeviceInfo.sdkVersion);
2241
+ sources.push("lg_deviceinfo");
2242
+ }
2243
+ var lgUdid = readCachedLgUdid();
2244
+ if ((lgUdid === null || lgUdid === void 0 ? void 0 : lgUdid.deviceId) && !info.internalDeviceId) {
2245
+ info.internalDeviceId = lgUdid.deviceId;
2246
+ info.internalDeviceIdSource = "lg_udid";
2247
+ sources.push("lg_udid");
2248
+ }
2249
+ info.sources = sources;
2250
+ return info;
2251
+ }
2252
+ function categorize(platform, model) {
2253
+ if (platform === "tizen") return "Samsung TV";
2254
+ if (platform === "webos") {
2255
+ var ua = userAgent();
2256
+ if (model && /^STB-/i.test(model) || /\bSTB-\d{4}|LGSTB/i.test(ua)) return "LG Set-Top Box";
2257
+ return "LG TV";
2258
+ }
2259
+ return "Other";
2260
+ }
2261
+ function getDeviceInfo() {
2262
+ var _cleanString, _cleanString1, _ref, _cleanString2, _ref1, _cleanString3, _ref2, _normalizeCategory, _ref3, _cleanString4, _cleanString5;
2263
+ var platform = platformCache !== null && platformCache !== void 0 ? platformCache : computePlatformInfo();
2264
+ if (primePromise && !platformCache) {} else {
2265
+ platformCache = platform;
2266
+ }
2267
+ var host = hostDeviceInfo !== null && hostDeviceInfo !== void 0 ? hostDeviceInfo : {};
2268
+ var bridge = {
2269
+ terminalId: readBridge([
2270
+ "terminalId",
2271
+ "terminal_id"
2272
+ ]),
2273
+ internalDeviceId: readBridge([
2274
+ "internalDeviceId",
2275
+ "internal_device_id"
2276
+ ]),
2277
+ model: readBridge([
2278
+ "deviceModel"
2279
+ ]),
2280
+ firmware: readBridge([
2281
+ "firmwareVersion"
2282
+ ]),
2283
+ category: normalizeCategory(readBridge([
2284
+ "deviceCategory"
2285
+ ])),
2286
+ make: readBridge([
2287
+ "deviceMake"
2288
+ ]),
2289
+ hardwareVersion: readBridge([
2290
+ "deviceHardwareVersion",
2291
+ "hardwareVersion"
2292
+ ])
2293
+ };
2294
+ var terminalId = (_cleanString = cleanString(host.terminalId)) !== null && _cleanString !== void 0 ? _cleanString : bridge.terminalId;
2295
+ var hostInternalId = (_cleanString1 = cleanString(host.internalDeviceId)) !== null && _cleanString1 !== void 0 ? _cleanString1 : bridge.internalDeviceId;
2296
+ var model = (_ref = (_cleanString2 = cleanString(host.model, 40)) !== null && _cleanString2 !== void 0 ? _cleanString2 : bridge.model) !== null && _ref !== void 0 ? _ref : platform.model;
2297
+ var firmware = (_ref1 = (_cleanString3 = cleanString(host.firmware, 64)) !== null && _cleanString3 !== void 0 ? _cleanString3 : bridge.firmware) !== null && _ref1 !== void 0 ? _ref1 : platform.firmware;
2298
+ var category = (_ref2 = (_normalizeCategory = normalizeCategory(host.category)) !== null && _normalizeCategory !== void 0 ? _normalizeCategory : bridge.category) !== null && _ref2 !== void 0 ? _ref2 : categorize(platform.platform, model);
2299
+ var sources = _to_consumable_array(platform.sources);
2300
+ var bridgeValues = [
2301
+ bridge.terminalId,
2302
+ bridge.internalDeviceId,
2303
+ bridge.model,
2304
+ bridge.firmware,
2305
+ bridge.category,
2306
+ bridge.make,
2307
+ bridge.hardwareVersion
2308
+ ];
2309
+ if (bridgeValues.some(function(v) {
2310
+ return v !== void 0;
2311
+ })) sources.unshift("bridge");
2312
+ if (hostDeviceInfo) sources.unshift("host");
2313
+ var internalDeviceId = hostInternalId !== null && hostInternalId !== void 0 ? hostInternalId : platform.internalDeviceId;
2314
+ var internalDeviceIdSource = hostInternalId ? "host" : platform.internalDeviceIdSource;
2315
+ var make = (_ref3 = (_cleanString4 = cleanString(host.make, 40)) !== null && _cleanString4 !== void 0 ? _cleanString4 : bridge.make) !== null && _ref3 !== void 0 ? _ref3 : makeForCategory(category);
2316
+ var hardwareVersion = (_cleanString5 = cleanString(host.hardwareVersion, 40)) !== null && _cleanString5 !== void 0 ? _cleanString5 : bridge.hardwareVersion;
2317
+ var sonifiModel = model && category === "Samsung TV" && !/^SAMSUNG-IPTV-/i.test(model) ? "SAMSUNG-IPTV-".concat(model) : model;
2318
+ return _object_spread_props(_object_spread({
2319
+ category: category,
2320
+ categoryCode: CATEGORY_CODES[category]
2321
+ }, make ? {
2322
+ make: make
2323
+ } : {}, model ? {
2324
+ model: model
2325
+ } : {}, hardwareVersion ? {
2326
+ hardwareVersion: hardwareVersion
2327
+ } : {}, sonifiModel ? {
2328
+ sonifiModel: sonifiModel
2329
+ } : {}, firmware ? {
2330
+ firmware: firmware
2331
+ } : {}, platform.osVersion ? {
2332
+ osVersion: platform.osVersion
2333
+ } : {}, platform.browserMajorVersion != null ? {
2334
+ browserMajorVersion: platform.browserMajorVersion
2335
+ } : {}, internalDeviceId ? {
2336
+ internalDeviceId: internalDeviceId
2337
+ } : {}, internalDeviceId && internalDeviceIdSource ? {
2338
+ internalDeviceIdSource: internalDeviceIdSource
2339
+ } : {}, terminalId ? {
2340
+ terminalId: terminalId
2341
+ } : {}), {
2342
+ sources: sources
2343
+ });
2344
+ }
2345
+ var DEVICE_KEY_VALUE_KEYS = {
2346
+ category: "sc_dev",
2347
+ model: "sc_model",
2348
+ firmware: "sc_fw"
2349
+ };
2350
+ function sanitizeKeyValue(value) {
2351
+ if (typeof value !== "string") return void 0;
2352
+ var v = value.trim().replace(/[^A-Za-z0-9._-]+/g, "_").replace(/^_+|_+$/g, "");
2353
+ return v ? v.slice(0, 40) : void 0;
2354
+ }
2355
+ function deviceKeyValuePairs(info) {
2356
+ var pairs = [
2357
+ [
2358
+ DEVICE_KEY_VALUE_KEYS.category,
2359
+ info.categoryCode
2360
+ ]
2361
+ ];
2362
+ var model = sanitizeKeyValue(info.model);
2363
+ var firmware = sanitizeKeyValue(info.firmware);
2364
+ if (model) pairs.push([
2365
+ DEVICE_KEY_VALUE_KEYS.model,
2366
+ model
2367
+ ]);
2368
+ if (firmware) pairs.push([
2369
+ DEVICE_KEY_VALUE_KEYS.firmware,
2370
+ firmware
2371
+ ]);
2372
+ return pairs;
2373
+ }
2374
+ function applyDeviceKeyValues(url, info) {
2375
+ try {
2376
+ var parsed = new URL(url);
2377
+ var pairs = deviceKeyValuePairs(info);
2378
+ var ours = new Set(pairs.map(function(param) {
2379
+ var _param = _sliced_to_array(param, 1), k = _param[0];
2380
+ return k;
2381
+ }));
2382
+ var existing = (parsed.searchParams.get("cust_params") || "").split("&").filter(function(p) {
2383
+ var _p_split_;
2384
+ return p !== "" && !ours.has((_p_split_ = p.split("=")[0]) !== null && _p_split_ !== void 0 ? _p_split_ : "");
2385
+ });
2386
+ var merged = existing.concat(pairs.map(function(param) {
2387
+ var _param = _sliced_to_array(param, 2), k = _param[0], v = _param[1];
2388
+ return "".concat(k, "=").concat(v);
2389
+ })).join("&");
2390
+ parsed.searchParams.set("cust_params", merged);
2391
+ return parsed.toString();
2392
+ } catch (unused) {
2393
+ return url;
2394
+ }
2395
+ }
2396
+ function deviceInfoAnalyticsFields(info) {
2397
+ return _object_spread({
2398
+ device_category: info.category
2399
+ }, info.model ? {
2400
+ device_model: info.model
2401
+ } : {}, info.sonifiModel ? {
2402
+ sonifi_model: info.sonifiModel
2403
+ } : {}, info.firmware ? {
2404
+ firmware_version: info.firmware
2405
+ } : {}, info.osVersion ? {
2406
+ os_version: info.osVersion
2407
+ } : {}, info.browserMajorVersion != null ? {
2408
+ browser_major_version: info.browserMajorVersion
2409
+ } : {}, info.internalDeviceId ? {
2410
+ internal_device_id: info.internalDeviceId
2411
+ } : {}, info.internalDeviceIdSource ? {
2412
+ internal_device_id_source: info.internalDeviceIdSource
2413
+ } : {}, info.terminalId ? {
2414
+ terminal_id: info.terminalId
2415
+ } : {});
2416
+ }
1581
2417
  // src/utils/devUrl.ts
1582
2418
  var PRIVATE_HOST_PATTERNS = [
1583
2419
  /^localhost$/i,
@@ -1710,6 +2546,9 @@ function buildAnalyticsContext(config) {
1710
2546
  if (config.isLiveStream !== void 0) {
1711
2547
  context.inputStreamType = config.isLiveStream ? "live" : "vod";
1712
2548
  }
2549
+ if (config.sendDeviceInfoToAnalytics) {
2550
+ context.includeDeviceInfo = true;
2551
+ }
1713
2552
  return context;
1714
2553
  }
1715
2554
  function getClientInfo() {
@@ -2002,7 +2841,7 @@ function buildPlayerMetricEvent() {
2002
2841
  capture_at: captureAt
2003
2842
  }, context.inputStreamType ? {
2004
2843
  input_stream_type: context.inputStreamType
2005
- } : {})
2844
+ } : {}, context.includeDeviceInfo ? deviceInfoAnalyticsFields(getDeviceInfo()) : {})
2006
2845
  ];
2007
2846
  }
2008
2847
  });
@@ -2120,6 +2959,13 @@ function sendHeartbeat(_0) {
2120
2959
  }).apply(this, arguments);
2121
2960
  }
2122
2961
  // src/player/AdConfigManager.ts
2962
+ function isGamAdUrl(rawUrl) {
2963
+ try {
2964
+ return GAM_AD_HOSTS.has(new URL(rawUrl).hostname);
2965
+ } catch (unused) {
2966
+ return false;
2967
+ }
2968
+ }
2123
2969
  function withDeferredPodParams(rawUrl, deferNonce) {
2124
2970
  try {
2125
2971
  var url = new URL(rawUrl);
@@ -2137,11 +2983,15 @@ function withDeferredPodParams(rawUrl, deferNonce) {
2137
2983
  }
2138
2984
  var AdConfigManager = /*#__PURE__*/ function() {
2139
2985
  function AdConfigManager(config, video) {
2986
+ var _this = this;
2140
2987
  _class_call_check(this, AdConfigManager);
2141
2988
  this.vmapBreaks = [];
2142
2989
  this.consumedVmapBreakIds = /* @__PURE__ */ new Set();
2143
2990
  this.streamCorrelator = generateCorrelator();
2144
2991
  this.consentSignals = {};
2992
+ this.isLiveStream = function() {
2993
+ return !!_this.config.isLiveStream;
2994
+ };
2145
2995
  this.podCounter = 0;
2146
2996
  this.podAssignedByPrefetch = false;
2147
2997
  this.lastHeartbeatTime = 0;
@@ -2592,9 +3442,22 @@ var AdConfigManager = /*#__PURE__*/ function() {
2592
3442
  {
2593
3443
  key: "generatePodVastUrl",
2594
3444
  value: function generatePodVastUrl(baseUrl, adPlayer, palNonce, inAdBreak) {
3445
+ var _content_contentDurationSeconds;
2595
3446
  var adWillPlayMuted = inAdBreak ? adPlayer.getOriginalMutedState() : this.video.muted;
2596
- var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest);
2597
- var macroContext = _object_spread_props(_object_spread({
3447
+ var envSignals = resolveVastEnvironmentSignals(!!this.config.ctvAdRequest, {
3448
+ fallbackDeviceIdMaxAgeMs: this.config.fallbackDeviceIdMaxAgeMs,
3449
+ sessionIdMaxAgeMs: this.config.sessionIdMaxAgeMs
3450
+ });
3451
+ var content = resolveContentMetadata(this.config);
3452
+ var isLive = this.isLiveStream();
3453
+ var device = getDeviceInfo();
3454
+ var playerSize = resolvePlayerSize(this.video);
3455
+ var videoDuration = this.video.duration;
3456
+ var contentDurationSeconds = (_content_contentDurationSeconds = content.contentDurationSeconds) !== null && _content_contentDurationSeconds !== void 0 ? _content_contentDurationSeconds : !isLive && Number.isFinite(videoDuration) && videoDuration > 0 ? Math.round(videoDuration) : void 0;
3457
+ var userId = resolveUserId(this.config.adUserId);
3458
+ var ipAddress = resolveClientIp(this.config.clientIpAddress);
3459
+ var userAgent2 = typeof navigator !== "undefined" && navigator.userAgent ? navigator.userAgent : void 0;
3460
+ var macroContext = _object_spread(_object_spread_props(_object_spread(_object_spread_props(_object_spread({
2598
3461
  correlator: this.viewCorrelator,
2599
3462
  streamCorrelator: this.streamCorrelator,
2600
3463
  pod: this.podCounter > 0 ? this.podCounter : void 0,
@@ -2608,14 +3471,54 @@ var AdConfigManager = /*#__PURE__*/ function() {
2608
3471
  limitAdTracking: envSignals.limitAdTracking,
2609
3472
  deviceTypeHint: envSignals.deviceTypeHint,
2610
3473
  adTest: this.config.adTest
2611
- }, this.config.programTitle ? {
2612
- programTitle: this.config.programTitle
2613
- } : {}, this.config.channelName ? {
2614
- channelName: this.config.channelName
3474
+ }, content.programTitle ? {
3475
+ programTitle: content.programTitle
3476
+ } : {}, content.channelName ? {
3477
+ channelName: content.channelName
3478
+ } : {}, content.contentNetwork ? {
3479
+ contentNetwork: content.contentNetwork
2615
3480
  } : {}), {
2616
3481
  consent: this.consentSignals,
2617
- palNonce: palNonce.getCurrentNonce() || void 0
2618
- });
3482
+ palNonce: palNonce.getCurrentNonce() || void 0,
3483
+ deviceIdSource: envSignals.deviceIdSource,
3484
+ isLive: isLive
3485
+ }), playerSize.width ? {
3486
+ playerWidth: playerSize.width
3487
+ } : {}, playerSize.height ? {
3488
+ playerHeight: playerSize.height
3489
+ } : {}), {
3490
+ timestamp: String(Date.now())
3491
+ }), device.make ? {
3492
+ deviceMake: device.make
3493
+ } : {}, device.model ? {
3494
+ deviceModel: device.model
3495
+ } : {}, device.hardwareVersion ? {
3496
+ deviceHardwareVersion: device.hardwareVersion
3497
+ } : {}, userAgent2 ? {
3498
+ userAgent: userAgent2
3499
+ } : {}, ipAddress ? {
3500
+ ipAddress: ipAddress
3501
+ } : {}, userId ? {
3502
+ userId: userId
3503
+ } : {}, content.contentType ? {
3504
+ contentType: content.contentType
3505
+ } : {}, content.contentCategory ? {
3506
+ contentCategory: content.contentCategory
3507
+ } : {}, content.contentGenre ? {
3508
+ contentGenre: content.contentGenre
3509
+ } : {}, content.contentLanguage ? {
3510
+ contentLanguage: content.contentLanguage
3511
+ } : {}, contentDurationSeconds != null ? {
3512
+ contentDurationSeconds: contentDurationSeconds
3513
+ } : {}, content.contentSeason ? {
3514
+ contentSeason: content.contentSeason
3515
+ } : {}, content.contentEpisode ? {
3516
+ contentEpisode: content.contentEpisode
3517
+ } : {}, content.contentRating ? {
3518
+ contentRating: content.contentRating
3519
+ } : {}, content.contentId ? {
3520
+ contentId: content.contentId
3521
+ } : {});
2619
3522
  var nonceReady = !!macroContext.palNonce;
2620
3523
  var finalUrl;
2621
3524
  if (hasScvpMacros(baseUrl)) {
@@ -2629,6 +3532,31 @@ var AdConfigManager = /*#__PURE__*/ function() {
2629
3532
  } else {
2630
3533
  finalUrl = withDeferredPodParams(palNonce.injectNonce(ensureVideoAdType(applyVastMacros(baseUrl, macroContext))), !nonceReady);
2631
3534
  }
3535
+ if (isGamAdUrl(finalUrl)) {
3536
+ finalUrl = appendMissingContentParams(finalUrl, content);
3537
+ if (this.config.ctvAdRequest && this.config.sendDeviceKeyValues !== false) {
3538
+ finalUrl = applyDeviceKeyValues(finalUrl, device);
3539
+ }
3540
+ }
3541
+ if (this.debug) {
3542
+ var id = envSignals.deviceId;
3543
+ console.log("[AD-IDENTITY]", {
3544
+ source: envSignals.deviceIdSource,
3545
+ idtype: envSignals.deviceIdType,
3546
+ rdidTail: id ? id.slice(-4) : void 0,
3547
+ isLat: envSignals.limitAdTracking,
3548
+ dth: envSignals.deviceTypeHint,
3549
+ sidTail: envSignals.sessionId ? envSignals.sessionId.slice(-4) : void 0,
3550
+ ct_ch: content.channelName,
3551
+ ct_ti: content.programTitle,
3552
+ ct_ne: content.contentNetwork,
3553
+ ifaType: toIabIfaType(envSignals.deviceIdType, envSignals.deviceIdSource),
3554
+ live: isLive,
3555
+ player: playerSize,
3556
+ make: device.make,
3557
+ model: device.model
3558
+ });
3559
+ }
2632
3560
  console.log("[StormcloudVideoPlayer] Prepared optimized-pod request URL (pod=".concat(this.podCounter, "; pmnd/pmxd/pmad resolved at dispatch):"), finalUrl);
2633
3561
  return finalUrl;
2634
3562
  }
@@ -2680,7 +3608,6 @@ var AdConfigManager = /*#__PURE__*/ function() {
2680
3608
  }
2681
3609
  },
2682
3610
  {
2683
- // --- Tracking ---
2684
3611
  key: "initializeTracking",
2685
3612
  value: function initializeTracking() {
2686
3613
  var _this = this;