@ziztechnology/dial-library 0.0.16 → 0.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 +382 -250
- package/dist/index.d.mts +132 -3
- package/dist/index.mjs +687 -393
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -40,7 +40,7 @@ const dialSdkDebugWarn = (moduleName, scope, phase, data) => {
|
|
|
40
40
|
const message = `[DIAL_SDK_DEBUG - ${moduleName}] ${scope}: ${phase}`;
|
|
41
41
|
try {
|
|
42
42
|
if (!hasLoggedSdkVersion) {
|
|
43
|
-
console.log(`[DIAL_SDK_DEBUG] SDK version: 0.0.
|
|
43
|
+
console.log(`[DIAL_SDK_DEBUG] SDK version: 0.0.17`);
|
|
44
44
|
hasLoggedSdkVersion = true;
|
|
45
45
|
}
|
|
46
46
|
if (data === void 0) console.log(message);
|
|
@@ -49,19 +49,19 @@ const dialSdkDebugWarn = (moduleName, scope, phase, data) => {
|
|
|
49
49
|
};
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/sensor/unified_info.ts
|
|
52
|
-
const DEBUG_MODULE$
|
|
52
|
+
const DEBUG_MODULE$6 = "unified_info.ts";
|
|
53
53
|
const unifiedSensorInfo = () => {
|
|
54
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
54
|
+
dialSdkDebugWarn(DEBUG_MODULE$6, "unifiedSensorInfo", "called");
|
|
55
55
|
try {
|
|
56
56
|
return window.unifiedSensorInfo().then((payload) => {
|
|
57
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
57
|
+
dialSdkDebugWarn(DEBUG_MODULE$6, "unifiedSensorInfo", "resolved", { payload });
|
|
58
58
|
return payload;
|
|
59
59
|
}, (error) => {
|
|
60
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
60
|
+
dialSdkDebugWarn(DEBUG_MODULE$6, "unifiedSensorInfo", "rejected", error);
|
|
61
61
|
throw error;
|
|
62
62
|
});
|
|
63
63
|
} catch (error) {
|
|
64
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
64
|
+
dialSdkDebugWarn(DEBUG_MODULE$6, "unifiedSensorInfo", "threw", error);
|
|
65
65
|
throw error;
|
|
66
66
|
}
|
|
67
67
|
};
|
|
@@ -168,7 +168,7 @@ const resolveDirectionalLongitudinalTuning = (tuning) => ({
|
|
|
168
168
|
});
|
|
169
169
|
//#endregion
|
|
170
170
|
//#region src/driving_expression/check_status.ts
|
|
171
|
-
const DEBUG_MODULE$
|
|
171
|
+
const DEBUG_MODULE$5 = "check_status.ts";
|
|
172
172
|
const DEVICE_RIGHT = {
|
|
173
173
|
x: 1,
|
|
174
174
|
y: 0,
|
|
@@ -224,14 +224,14 @@ const DEFAULT_DRIVING_STATUS_TUNING = Object.freeze({
|
|
|
224
224
|
turnClosureWindowMs: 1500
|
|
225
225
|
});
|
|
226
226
|
const classifyDrivingSnapshot = (info, tuningOverrides) => {
|
|
227
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
227
|
+
dialSdkDebugWarn(DEBUG_MODULE$5, "classifyDrivingSnapshot", "called", {
|
|
228
228
|
info,
|
|
229
229
|
tuningOverrides
|
|
230
230
|
});
|
|
231
231
|
const tuning = resolveDrivingStatusTuning(tuningOverrides);
|
|
232
232
|
const metrics = extractDrivingSnapshotMetrics(info, tuning);
|
|
233
233
|
if (metrics === null) {
|
|
234
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
234
|
+
dialSdkDebugWarn(DEBUG_MODULE$5, "classifyDrivingSnapshot", "returned", { result: null });
|
|
235
235
|
return null;
|
|
236
236
|
}
|
|
237
237
|
const { candidateStatus, rejectionReason } = classifyInstantaneousEvidence(metrics, tuning);
|
|
@@ -245,11 +245,11 @@ const classifyDrivingSnapshot = (info, tuningOverrides) => {
|
|
|
245
245
|
maximumSampleAgeMs: Math.max(info.capturedAtMs - metrics.linearAccelerationSampledAtMs, info.capturedAtMs - metrics.gyroscopeSampledAtMs, info.capturedAtMs - metrics.gravitySampledAtMs)
|
|
246
246
|
}
|
|
247
247
|
};
|
|
248
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
248
|
+
dialSdkDebugWarn(DEBUG_MODULE$5, "classifyDrivingSnapshot", "returned", { result });
|
|
249
249
|
return result;
|
|
250
250
|
};
|
|
251
251
|
const resolveDrivingStatusTuning = (overrides = {}) => {
|
|
252
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
252
|
+
dialSdkDebugWarn(DEBUG_MODULE$5, "resolveDrivingStatusTuning", "called", { overrides });
|
|
253
253
|
const tuning = {
|
|
254
254
|
...DEFAULT_DRIVING_STATUS_TUNING,
|
|
255
255
|
...overrides
|
|
@@ -289,7 +289,7 @@ const resolveDrivingStatusTuning = (overrides = {}) => {
|
|
|
289
289
|
"turnExitConfirmationMs",
|
|
290
290
|
"turnClosureWindowMs"
|
|
291
291
|
]) requirePositiveFinite(field, tuning[field], {
|
|
292
|
-
moduleName: DEBUG_MODULE$
|
|
292
|
+
moduleName: DEBUG_MODULE$5,
|
|
293
293
|
scope: "assertPositiveFinite"
|
|
294
294
|
});
|
|
295
295
|
for (const field of [
|
|
@@ -314,17 +314,17 @@ const resolveDrivingStatusTuning = (overrides = {}) => {
|
|
|
314
314
|
if (tuning.rapidLongitudinalMeanThreshold <= tuning.longitudinalThreshold) throwLoggedRangeError("resolveDrivingStatusTuning", "rapidLongitudinalMeanThreshold must be greater than longitudinalThreshold");
|
|
315
315
|
if (tuning.rapidLongitudinalPeakThreshold < tuning.rapidLongitudinalMeanThreshold) throwLoggedRangeError("resolveDrivingStatusTuning", "rapidLongitudinalPeakThreshold must be greater than or equal to rapidLongitudinalMeanThreshold");
|
|
316
316
|
if (tuning.turnYawThreshold <= tuning.turnExitYawThreshold) throwLoggedRangeError("resolveDrivingStatusTuning", "turnYawThreshold must be greater than turnExitYawThreshold");
|
|
317
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
317
|
+
dialSdkDebugWarn(DEBUG_MODULE$5, "resolveDrivingStatusTuning", "returned", { tuning });
|
|
318
318
|
return tuning;
|
|
319
319
|
};
|
|
320
320
|
const extractDrivingSnapshotMetrics = (info, tuning = DEFAULT_DRIVING_STATUS_TUNING, correction = {}) => {
|
|
321
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
321
|
+
dialSdkDebugWarn(DEBUG_MODULE$5, "extractDrivingSnapshotMetrics", "called", {
|
|
322
322
|
info,
|
|
323
323
|
tuning,
|
|
324
324
|
correction
|
|
325
325
|
});
|
|
326
326
|
if (!info || !Number.isFinite(info.capturedAtMs)) {
|
|
327
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
327
|
+
dialSdkDebugWarn(DEBUG_MODULE$5, "extractDrivingSnapshotMetrics", "returned invalid capture time", { info });
|
|
328
328
|
return null;
|
|
329
329
|
}
|
|
330
330
|
const linearAcceleration = extractFreshVector(info.linearAcceleration, info.capturedAtMs, tuning.maxSampleAgeMs);
|
|
@@ -335,7 +335,7 @@ const extractDrivingSnapshotMetrics = (info, tuning = DEFAULT_DRIVING_STATUS_TUN
|
|
|
335
335
|
sampledAtMs: gravityMetric.sampledAtMs
|
|
336
336
|
} : gravityMetric);
|
|
337
337
|
if (linearAcceleration === null || gyroscope === null || gravity === null) {
|
|
338
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
338
|
+
dialSdkDebugWarn(DEBUG_MODULE$5, "extractDrivingSnapshotMetrics", "returned unavailable vectors", {
|
|
339
339
|
linearAcceleration,
|
|
340
340
|
gyroscope,
|
|
341
341
|
gravity
|
|
@@ -344,7 +344,7 @@ const extractDrivingSnapshotMetrics = (info, tuning = DEFAULT_DRIVING_STATUS_TUN
|
|
|
344
344
|
}
|
|
345
345
|
const frame = buildVehicleFrame(gravity.value, tuning.vehicleRightMinimumNorm);
|
|
346
346
|
if (frame === null) {
|
|
347
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
347
|
+
dialSdkDebugWarn(DEBUG_MODULE$5, "extractDrivingSnapshotMetrics", "returned invalid vehicle frame", {
|
|
348
348
|
gravity: gravity.value,
|
|
349
349
|
vehicleRightMinimumNorm: tuning.vehicleRightMinimumNorm
|
|
350
350
|
});
|
|
@@ -367,28 +367,28 @@ const extractDrivingSnapshotMetrics = (info, tuning = DEFAULT_DRIVING_STATUS_TUN
|
|
|
367
367
|
rawGyroscope: gyroscope.value,
|
|
368
368
|
frame
|
|
369
369
|
};
|
|
370
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
370
|
+
dialSdkDebugWarn(DEBUG_MODULE$5, "extractDrivingSnapshotMetrics", "returned", { result });
|
|
371
371
|
return result;
|
|
372
372
|
};
|
|
373
373
|
const buildVehicleFrame = (gravity, rightMinimumNorm = DEFAULT_DRIVING_STATUS_TUNING.vehicleRightMinimumNorm) => {
|
|
374
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
374
|
+
dialSdkDebugWarn(DEBUG_MODULE$5, "buildVehicleFrame", "called", {
|
|
375
375
|
gravity,
|
|
376
376
|
rightMinimumNorm
|
|
377
377
|
});
|
|
378
378
|
const gravityDirection = normalize(gravity);
|
|
379
379
|
if (gravityDirection === null) {
|
|
380
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
380
|
+
dialSdkDebugWarn(DEBUG_MODULE$5, "buildVehicleFrame", "returned invalid gravity", { result: null });
|
|
381
381
|
return null;
|
|
382
382
|
}
|
|
383
383
|
const up = gravityDirection;
|
|
384
384
|
const projectedRight = subtract(DEVICE_RIGHT, scale(up, dot(DEVICE_RIGHT, up)));
|
|
385
385
|
if (magnitude(projectedRight) < rightMinimumNorm) {
|
|
386
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
386
|
+
dialSdkDebugWarn(DEBUG_MODULE$5, "buildVehicleFrame", "returned degenerate right axis", { result: null });
|
|
387
387
|
return null;
|
|
388
388
|
}
|
|
389
389
|
const right = normalize(projectedRight);
|
|
390
390
|
if (right === null) {
|
|
391
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
391
|
+
dialSdkDebugWarn(DEBUG_MODULE$5, "buildVehicleFrame", "returned invalid right axis", { result: null });
|
|
392
392
|
return null;
|
|
393
393
|
}
|
|
394
394
|
const forward = normalize(cross(right, up));
|
|
@@ -397,7 +397,7 @@ const buildVehicleFrame = (gravity, rightMinimumNorm = DEFAULT_DRIVING_STATUS_TU
|
|
|
397
397
|
right,
|
|
398
398
|
forward
|
|
399
399
|
};
|
|
400
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
400
|
+
dialSdkDebugWarn(DEBUG_MODULE$5, "buildVehicleFrame", "returned", { result });
|
|
401
401
|
return result;
|
|
402
402
|
};
|
|
403
403
|
const classifyInstantaneousEvidence = (metrics, tuning) => {
|
|
@@ -467,7 +467,7 @@ const normalize = (value) => {
|
|
|
467
467
|
};
|
|
468
468
|
const throwLoggedRangeError = (scope, message) => {
|
|
469
469
|
const error = new RangeError(message);
|
|
470
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
470
|
+
dialSdkDebugWarn(DEBUG_MODULE$5, scope, "threw", error);
|
|
471
471
|
throw error;
|
|
472
472
|
};
|
|
473
473
|
//#endregion
|
|
@@ -503,17 +503,17 @@ const invokeSafely = (callback, args, onError) => {
|
|
|
503
503
|
};
|
|
504
504
|
//#endregion
|
|
505
505
|
//#region src/driving_expression/driving_expressions.ts
|
|
506
|
-
const DEBUG_MODULE$
|
|
506
|
+
const DEBUG_MODULE$4 = "driving_expressions.ts";
|
|
507
507
|
const IS_RECORD_DEBUG$1 = {
|
|
508
|
-
moduleName: DEBUG_MODULE$
|
|
508
|
+
moduleName: DEBUG_MODULE$4,
|
|
509
509
|
scope: "isRecord"
|
|
510
510
|
};
|
|
511
511
|
const REQUIRE_POSITIVE_FINITE_DEBUG$1 = {
|
|
512
|
-
moduleName: DEBUG_MODULE$
|
|
512
|
+
moduleName: DEBUG_MODULE$4,
|
|
513
513
|
scope: "requirePositiveFinite"
|
|
514
514
|
};
|
|
515
515
|
const CREATE_ABORT_ERROR_DEBUG$1 = {
|
|
516
|
-
moduleName: DEBUG_MODULE$
|
|
516
|
+
moduleName: DEBUG_MODULE$4,
|
|
517
517
|
scope: "createAbortError"
|
|
518
518
|
};
|
|
519
519
|
const OFFICIAL_DRIVING_EXPRESSION_FALLBACKS = Object.freeze({
|
|
@@ -556,7 +556,7 @@ const OFFICIAL_DRIVING_EXPRESSIONS_CONFIG = Object.freeze({
|
|
|
556
556
|
});
|
|
557
557
|
var DrivingExpressionsConfigError = class extends Error {
|
|
558
558
|
constructor(code, message, state) {
|
|
559
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
559
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "DrivingExpressionsConfigError.constructor", "called", {
|
|
560
560
|
code,
|
|
561
561
|
message,
|
|
562
562
|
state
|
|
@@ -565,20 +565,20 @@ var DrivingExpressionsConfigError = class extends Error {
|
|
|
565
565
|
this.name = "DrivingExpressionsConfigError";
|
|
566
566
|
this.code = code;
|
|
567
567
|
this.state = state;
|
|
568
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
568
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "DrivingExpressionsConfigError.constructor", "created", { error: this });
|
|
569
569
|
}
|
|
570
570
|
};
|
|
571
571
|
var DrivingExpressionResolutionError = class extends Error {
|
|
572
572
|
constructor(status) {
|
|
573
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
573
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "DrivingExpressionResolutionError.constructor", "called", { status });
|
|
574
574
|
super(`No driving expression is configured for ${status}`);
|
|
575
575
|
this.name = "DrivingExpressionResolutionError";
|
|
576
576
|
this.status = status;
|
|
577
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
577
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "DrivingExpressionResolutionError.constructor", "created", { error: this });
|
|
578
578
|
}
|
|
579
579
|
};
|
|
580
580
|
const parseDrivingExpressionsConfig = (raw, options = {}) => {
|
|
581
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
581
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseDrivingExpressionsConfig", "called", {
|
|
582
582
|
raw,
|
|
583
583
|
options
|
|
584
584
|
});
|
|
@@ -596,24 +596,24 @@ const parseDrivingExpressionsConfig = (raw, options = {}) => {
|
|
|
596
596
|
schemaVersion: 1,
|
|
597
597
|
states
|
|
598
598
|
};
|
|
599
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
599
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseDrivingExpressionsConfig", "returned", { result });
|
|
600
600
|
return result;
|
|
601
601
|
};
|
|
602
602
|
const tryParseDrivingExpressionsConfig = (raw, options) => {
|
|
603
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
603
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "tryParseDrivingExpressionsConfig", "called", {
|
|
604
604
|
raw,
|
|
605
605
|
options
|
|
606
606
|
});
|
|
607
607
|
try {
|
|
608
608
|
const result = parseDrivingExpressionsConfig(raw, options);
|
|
609
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
609
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "tryParseDrivingExpressionsConfig", "returned", { result });
|
|
610
610
|
return result;
|
|
611
611
|
} catch (error) {
|
|
612
612
|
if (!(error instanceof DrivingExpressionsConfigError)) {
|
|
613
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
613
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "tryParseDrivingExpressionsConfig", "threw unexpected error", error);
|
|
614
614
|
throw error;
|
|
615
615
|
}
|
|
616
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
616
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "tryParseDrivingExpressionsConfig", "returned null after parse error", error);
|
|
617
617
|
return null;
|
|
618
618
|
}
|
|
619
619
|
};
|
|
@@ -622,13 +622,13 @@ const tryParseDrivingExpressionsConfig = (raw, options) => {
|
|
|
622
622
|
* It never installs official fallbacks implicitly.
|
|
623
623
|
*/
|
|
624
624
|
const readDrivingExpressionsConfig = (raw, options) => {
|
|
625
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
625
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "readDrivingExpressionsConfig", "called", {
|
|
626
626
|
raw,
|
|
627
627
|
options
|
|
628
628
|
});
|
|
629
629
|
const source = raw === void 0 ? readRuntimeDrivingExpressionsValue() : raw;
|
|
630
630
|
const result = source === void 0 ? null : tryParseDrivingExpressionsConfig(source, options);
|
|
631
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
631
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "readDrivingExpressionsConfig", "returned", {
|
|
632
632
|
source,
|
|
633
633
|
result
|
|
634
634
|
});
|
|
@@ -639,7 +639,7 @@ const readDrivingExpressionsConfig = (raw, options) => {
|
|
|
639
639
|
* It never installs official fallbacks implicitly.
|
|
640
640
|
*/
|
|
641
641
|
const waitForDrivingExpressionsConfig = (options = {}) => {
|
|
642
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
642
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "waitForDrivingExpressionsConfig", "called", { options });
|
|
643
643
|
const timeoutMs = requireNonNegativeFinite("timeoutMs", options.timeoutMs ?? 3e3);
|
|
644
644
|
const pollIntervalMs = requirePositiveFinite("pollIntervalMs", options.pollIntervalMs ?? 100, REQUIRE_POSITIVE_FINITE_DEBUG$1);
|
|
645
645
|
const { signal } = options;
|
|
@@ -648,7 +648,7 @@ const waitForDrivingExpressionsConfig = (options = {}) => {
|
|
|
648
648
|
let timer;
|
|
649
649
|
let settled = false;
|
|
650
650
|
const cleanup = () => {
|
|
651
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
651
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "waitForDrivingExpressionsConfig.cleanup", "called", {
|
|
652
652
|
timer,
|
|
653
653
|
settled
|
|
654
654
|
});
|
|
@@ -657,50 +657,50 @@ const waitForDrivingExpressionsConfig = (options = {}) => {
|
|
|
657
657
|
timer = void 0;
|
|
658
658
|
}
|
|
659
659
|
signal?.removeEventListener("abort", handleAbort);
|
|
660
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
660
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "waitForDrivingExpressionsConfig.cleanup", "returned");
|
|
661
661
|
};
|
|
662
662
|
const finish = (config) => {
|
|
663
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
663
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "waitForDrivingExpressionsConfig.finish", "called", {
|
|
664
664
|
config,
|
|
665
665
|
settled
|
|
666
666
|
});
|
|
667
667
|
if (settled) {
|
|
668
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
668
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "waitForDrivingExpressionsConfig.finish", "ignored");
|
|
669
669
|
return;
|
|
670
670
|
}
|
|
671
671
|
settled = true;
|
|
672
672
|
cleanup();
|
|
673
673
|
resolve(config);
|
|
674
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
674
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "waitForDrivingExpressionsConfig.finish", "resolved", { config });
|
|
675
675
|
};
|
|
676
676
|
const fail = (error) => {
|
|
677
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
677
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "waitForDrivingExpressionsConfig.fail", "called", {
|
|
678
678
|
error,
|
|
679
679
|
settled
|
|
680
680
|
});
|
|
681
681
|
if (settled) {
|
|
682
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
682
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "waitForDrivingExpressionsConfig.fail", "ignored");
|
|
683
683
|
return;
|
|
684
684
|
}
|
|
685
685
|
settled = true;
|
|
686
686
|
cleanup();
|
|
687
687
|
reject(error);
|
|
688
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
688
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "waitForDrivingExpressionsConfig.fail", "rejected", error);
|
|
689
689
|
};
|
|
690
690
|
const handleAbort = () => {
|
|
691
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
691
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "waitForDrivingExpressionsConfig.handleAbort", "called");
|
|
692
692
|
fail(createAbortError("The operation was aborted", CREATE_ABORT_ERROR_DEBUG$1));
|
|
693
693
|
};
|
|
694
694
|
const read = () => {
|
|
695
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
695
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "waitForDrivingExpressionsConfig.read", "called");
|
|
696
696
|
const result = readDrivingExpressionsConfig(void 0, options.parseOptions);
|
|
697
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
697
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "waitForDrivingExpressionsConfig.read", "returned", { result });
|
|
698
698
|
return result;
|
|
699
699
|
};
|
|
700
700
|
const poll = () => {
|
|
701
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
701
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "waitForDrivingExpressionsConfig.poll", "called", { settled });
|
|
702
702
|
if (settled) {
|
|
703
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
703
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "waitForDrivingExpressionsConfig.poll", "ignored");
|
|
704
704
|
return;
|
|
705
705
|
}
|
|
706
706
|
if (signal?.aborted) {
|
|
@@ -724,7 +724,7 @@ const waitForDrivingExpressionsConfig = (options = {}) => {
|
|
|
724
724
|
return;
|
|
725
725
|
}
|
|
726
726
|
timer = globalThis.setTimeout(poll, Math.min(pollIntervalMs, remainingMs));
|
|
727
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
727
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "waitForDrivingExpressionsConfig.poll", "scheduled", {
|
|
728
728
|
remainingMs,
|
|
729
729
|
delayMs: Math.min(pollIntervalMs, remainingMs)
|
|
730
730
|
});
|
|
@@ -736,7 +736,7 @@ const waitForDrivingExpressionsConfig = (options = {}) => {
|
|
|
736
736
|
/** Original resolver behavior: missing legacy slots fall back to STEADY_DRIVING. */
|
|
737
737
|
const resolveDrivingExpression = (config, status) => {
|
|
738
738
|
const result = config.states[status] ?? config.states.STEADY_DRIVING;
|
|
739
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
739
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "resolveDrivingExpression", "returned", {
|
|
740
740
|
config,
|
|
741
741
|
status,
|
|
742
742
|
result
|
|
@@ -745,55 +745,55 @@ const resolveDrivingExpression = (config, status) => {
|
|
|
745
745
|
};
|
|
746
746
|
/** Strict resolver used by the player; official fallbacks are opt-in. */
|
|
747
747
|
const resolveDrivingExpressionStrict = (config, status, fallbacks) => {
|
|
748
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
748
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "resolveDrivingExpressionStrict", "called", {
|
|
749
749
|
config,
|
|
750
750
|
status,
|
|
751
751
|
fallbacks
|
|
752
752
|
});
|
|
753
753
|
const configured = config.states[status];
|
|
754
754
|
if (configured !== void 0) {
|
|
755
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
755
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "resolveDrivingExpressionStrict", "returned configured media", { configured });
|
|
756
756
|
return configured;
|
|
757
757
|
}
|
|
758
758
|
const fallback = fallbacks?.[status];
|
|
759
759
|
if (fallback !== void 0) {
|
|
760
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
760
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "resolveDrivingExpressionStrict", "returned fallback media", { fallback });
|
|
761
761
|
return fallback;
|
|
762
762
|
}
|
|
763
763
|
const error = new DrivingExpressionResolutionError(status);
|
|
764
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
764
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "resolveDrivingExpressionStrict", "threw", error);
|
|
765
765
|
throw error;
|
|
766
766
|
};
|
|
767
767
|
const isPublicDrivingMediaUrl = (value) => {
|
|
768
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
768
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isPublicDrivingMediaUrl", "called", { value });
|
|
769
769
|
try {
|
|
770
770
|
const url = new URL(value);
|
|
771
771
|
if (url.protocol !== "https:" || url.username !== "" || url.password !== "") {
|
|
772
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
772
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isPublicDrivingMediaUrl", "returned", {
|
|
773
773
|
result: false,
|
|
774
774
|
reason: "protocol_or_auth"
|
|
775
775
|
});
|
|
776
776
|
return false;
|
|
777
777
|
}
|
|
778
778
|
if (!isPublicHostname(url.hostname)) {
|
|
779
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
779
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isPublicDrivingMediaUrl", "returned", {
|
|
780
780
|
result: false,
|
|
781
781
|
reason: "hostname"
|
|
782
782
|
});
|
|
783
783
|
return false;
|
|
784
784
|
}
|
|
785
785
|
for (const key of url.searchParams.keys()) if (TEMPORARY_SIGNATURE_QUERY_KEYS.has(key.toLowerCase())) {
|
|
786
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
786
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isPublicDrivingMediaUrl", "returned", {
|
|
787
787
|
result: false,
|
|
788
788
|
reason: "temporary_signature",
|
|
789
789
|
key
|
|
790
790
|
});
|
|
791
791
|
return false;
|
|
792
792
|
}
|
|
793
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
793
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isPublicDrivingMediaUrl", "returned", { result: true });
|
|
794
794
|
return true;
|
|
795
795
|
} catch (error) {
|
|
796
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
796
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isPublicDrivingMediaUrl", "returned after URL parse error", {
|
|
797
797
|
result: false,
|
|
798
798
|
error
|
|
799
799
|
});
|
|
@@ -801,10 +801,10 @@ const isPublicDrivingMediaUrl = (value) => {
|
|
|
801
801
|
}
|
|
802
802
|
};
|
|
803
803
|
const isPublicHostname = (rawHostname) => {
|
|
804
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
804
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isPublicHostname", "called", { rawHostname });
|
|
805
805
|
const hostname = rawHostname.toLowerCase().replace(/^\[|\]$/gu, "").replace(/\.+$/gu, "");
|
|
806
806
|
if (hostname === "") {
|
|
807
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
807
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isPublicHostname", "returned", {
|
|
808
808
|
result: false,
|
|
809
809
|
hostname
|
|
810
810
|
});
|
|
@@ -813,7 +813,7 @@ const isPublicHostname = (rawHostname) => {
|
|
|
813
813
|
const ipv4 = parseIpv4(hostname);
|
|
814
814
|
if (ipv4 !== null) {
|
|
815
815
|
const result = !isRestrictedIpv4(ipv4);
|
|
816
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
816
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isPublicHostname", "returned IPv4 result", {
|
|
817
817
|
hostname,
|
|
818
818
|
ipv4,
|
|
819
819
|
result
|
|
@@ -823,7 +823,7 @@ const isPublicHostname = (rawHostname) => {
|
|
|
823
823
|
const ipv6 = parseIpv6(hostname);
|
|
824
824
|
if (ipv6 !== null) {
|
|
825
825
|
const result = !isRestrictedIpv6(ipv6);
|
|
826
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
826
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isPublicHostname", "returned IPv6 result", {
|
|
827
827
|
hostname,
|
|
828
828
|
ipv6,
|
|
829
829
|
result
|
|
@@ -831,14 +831,14 @@ const isPublicHostname = (rawHostname) => {
|
|
|
831
831
|
return result;
|
|
832
832
|
}
|
|
833
833
|
if (!hostname.includes(".")) {
|
|
834
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
834
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isPublicHostname", "returned", {
|
|
835
835
|
hostname,
|
|
836
836
|
result: false
|
|
837
837
|
});
|
|
838
838
|
return false;
|
|
839
839
|
}
|
|
840
840
|
const result = !INTERNAL_HOST_SUFFIXES.some((suffix) => hostname === suffix || hostname.endsWith(`.${suffix}`));
|
|
841
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
841
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isPublicHostname", "returned DNS result", {
|
|
842
842
|
hostname,
|
|
843
843
|
result
|
|
844
844
|
});
|
|
@@ -857,37 +857,37 @@ const INTERNAL_HOST_SUFFIXES = [
|
|
|
857
857
|
"private"
|
|
858
858
|
];
|
|
859
859
|
const parseIpv4 = (hostname) => {
|
|
860
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
860
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseIpv4", "called", { hostname });
|
|
861
861
|
const parts = hostname.split(".");
|
|
862
862
|
if (parts.length !== 4 || parts.some((part) => !/^\d{1,3}$/u.test(part))) {
|
|
863
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
863
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseIpv4", "returned", { result: null });
|
|
864
864
|
return null;
|
|
865
865
|
}
|
|
866
866
|
const octets = parts.map(Number);
|
|
867
867
|
if (octets.some((octet) => octet > 255)) {
|
|
868
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
868
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseIpv4", "returned", {
|
|
869
869
|
result: null,
|
|
870
870
|
octets
|
|
871
871
|
});
|
|
872
872
|
return null;
|
|
873
873
|
}
|
|
874
874
|
const result = octets;
|
|
875
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
875
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseIpv4", "returned", { result });
|
|
876
876
|
return result;
|
|
877
877
|
};
|
|
878
878
|
const isRestrictedIpv4 = (value) => {
|
|
879
879
|
const [a, b, c] = value;
|
|
880
880
|
const result = a === 0 || a === 10 || a === 127 || a === 100 && b >= 64 && b <= 127 || a === 169 && b === 254 || a === 172 && b >= 16 && b <= 31 || a === 192 && b === 0 && c === 0 || a === 192 && b === 0 && c === 2 || a === 192 && b === 31 && c === 196 || a === 192 && b === 52 && c === 193 || a === 192 && b === 88 && c === 99 || a === 192 && b === 168 || a === 192 && b === 175 && c === 48 || a === 198 && (b === 18 || b === 19) || a === 198 && b === 51 && c === 100 || a === 203 && b === 0 && c === 113 || a >= 224;
|
|
881
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
881
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isRestrictedIpv4", "returned", {
|
|
882
882
|
value,
|
|
883
883
|
result
|
|
884
884
|
});
|
|
885
885
|
return result;
|
|
886
886
|
};
|
|
887
887
|
const parseIpv6 = (hostname) => {
|
|
888
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
888
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseIpv6", "called", { hostname });
|
|
889
889
|
if (!hostname.includes(":")) {
|
|
890
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
890
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseIpv6", "returned", { result: null });
|
|
891
891
|
return null;
|
|
892
892
|
}
|
|
893
893
|
let normalized = hostname;
|
|
@@ -895,14 +895,14 @@ const parseIpv6 = (hostname) => {
|
|
|
895
895
|
const lastColon = normalized.lastIndexOf(":");
|
|
896
896
|
const ipv4 = parseIpv4(normalized.slice(lastColon + 1));
|
|
897
897
|
if (ipv4 === null) {
|
|
898
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
898
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseIpv6", "returned invalid embedded IPv4", { result: null });
|
|
899
899
|
return null;
|
|
900
900
|
}
|
|
901
901
|
normalized = `${normalized.slice(0, lastColon)}:${(ipv4[0] << 8 | ipv4[1]).toString(16)}:${(ipv4[2] << 8 | ipv4[3]).toString(16)}`;
|
|
902
902
|
}
|
|
903
903
|
const halves = normalized.split("::");
|
|
904
904
|
if (halves.length > 2) {
|
|
905
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
905
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseIpv6", "returned invalid halves", {
|
|
906
906
|
result: null,
|
|
907
907
|
halves
|
|
908
908
|
});
|
|
@@ -911,7 +911,7 @@ const parseIpv6 = (hostname) => {
|
|
|
911
911
|
const left = halves[0] === "" ? [] : halves[0].split(":");
|
|
912
912
|
const right = halves.length === 1 || halves[1] === "" ? [] : halves[1].split(":");
|
|
913
913
|
if ([...left, ...right].some((part) => !/^[\da-f]{1,4}$/u.test(part))) {
|
|
914
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
914
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseIpv6", "returned invalid group", {
|
|
915
915
|
result: null,
|
|
916
916
|
left,
|
|
917
917
|
right
|
|
@@ -920,7 +920,7 @@ const parseIpv6 = (hostname) => {
|
|
|
920
920
|
}
|
|
921
921
|
const omitted = 8 - left.length - right.length;
|
|
922
922
|
if (halves.length === 1 && omitted !== 0 || halves.length === 2 && omitted < 1) {
|
|
923
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
923
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseIpv6", "returned invalid omission", {
|
|
924
924
|
result: null,
|
|
925
925
|
omitted
|
|
926
926
|
});
|
|
@@ -932,7 +932,7 @@ const parseIpv6 = (hostname) => {
|
|
|
932
932
|
...right
|
|
933
933
|
].map((part) => Number.parseInt(part, 16));
|
|
934
934
|
if (groups.length !== 8) {
|
|
935
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
935
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseIpv6", "returned invalid group count", {
|
|
936
936
|
result: null,
|
|
937
937
|
groups
|
|
938
938
|
});
|
|
@@ -943,21 +943,21 @@ const parseIpv6 = (hostname) => {
|
|
|
943
943
|
bytes[index * 2] = group >>> 8;
|
|
944
944
|
bytes[index * 2 + 1] = group & 255;
|
|
945
945
|
});
|
|
946
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
946
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseIpv6", "returned", { result: bytes });
|
|
947
947
|
return bytes;
|
|
948
948
|
};
|
|
949
949
|
const isRestrictedIpv6 = (bytes) => {
|
|
950
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
950
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isRestrictedIpv6", "called", { bytes });
|
|
951
951
|
const allZeroPrefix = (length) => {
|
|
952
952
|
const result = bytes.subarray(0, length).every((value) => value === 0);
|
|
953
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
953
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isRestrictedIpv6.allZeroPrefix", "returned", {
|
|
954
954
|
length,
|
|
955
955
|
result
|
|
956
956
|
});
|
|
957
957
|
return result;
|
|
958
958
|
};
|
|
959
959
|
const result = bytes.every((value) => value === 0) || allZeroPrefix(15) && bytes[15] === 1 || allZeroPrefix(12) || allZeroPrefix(10) && bytes[10] === 255 && bytes[11] === 255 || bytes[0] === 0 && bytes[1] === 100 && bytes[2] === 255 && bytes[3] === 155 || (bytes[0] & 254) === 252 || bytes[0] === 254 && (bytes[1] & 192) === 128 || bytes[0] === 255 || bytes[0] === 1 && bytes.subarray(1, 8).every((value) => value === 0) || bytes[0] === 32 && bytes[1] === 1 && bytes[2] === 13 && bytes[3] === 184 || bytes[0] === 32 && bytes[1] === 1 && bytes[2] <= 1 || bytes[0] === 32 && bytes[1] === 2 || bytes[0] === 63 && bytes[1] === 254;
|
|
960
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
960
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isRestrictedIpv6", "returned", { result });
|
|
961
961
|
return result;
|
|
962
962
|
};
|
|
963
963
|
const TEMPORARY_SIGNATURE_QUERY_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -994,7 +994,7 @@ const TEMPORARY_SIGNATURE_QUERY_KEYS = /* @__PURE__ */ new Set([
|
|
|
994
994
|
"x-oss-signature"
|
|
995
995
|
]);
|
|
996
996
|
const parseDrivingExpressionMedia = (raw, status, options) => {
|
|
997
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
997
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseDrivingExpressionMedia", "called", {
|
|
998
998
|
raw,
|
|
999
999
|
status,
|
|
1000
1000
|
options
|
|
@@ -1005,7 +1005,7 @@ const parseDrivingExpressionMedia = (raw, status, options) => {
|
|
|
1005
1005
|
kind: "image",
|
|
1006
1006
|
url: raw
|
|
1007
1007
|
};
|
|
1008
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1008
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseDrivingExpressionMedia", "returned legacy image", { result });
|
|
1009
1009
|
return result;
|
|
1010
1010
|
}
|
|
1011
1011
|
if (!isRecord(raw, IS_RECORD_DEBUG$1) || typeof raw.kind !== "string") throw invalidMedia(status, "media must be a structured object with a supported kind");
|
|
@@ -1029,7 +1029,7 @@ const parseDrivingExpressionMedia = (raw, status, options) => {
|
|
|
1029
1029
|
kind: "emoji",
|
|
1030
1030
|
text: raw.text.trim()
|
|
1031
1031
|
};
|
|
1032
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1032
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseDrivingExpressionMedia", "returned emoji", { result });
|
|
1033
1033
|
return result;
|
|
1034
1034
|
}
|
|
1035
1035
|
case "image": {
|
|
@@ -1046,7 +1046,7 @@ const parseDrivingExpressionMedia = (raw, status, options) => {
|
|
|
1046
1046
|
url,
|
|
1047
1047
|
mimeType
|
|
1048
1048
|
});
|
|
1049
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1049
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseDrivingExpressionMedia", "returned image", { result });
|
|
1050
1050
|
return result;
|
|
1051
1051
|
}
|
|
1052
1052
|
case "video": {
|
|
@@ -1061,7 +1061,7 @@ const parseDrivingExpressionMedia = (raw, status, options) => {
|
|
|
1061
1061
|
coverUrl,
|
|
1062
1062
|
mimeType
|
|
1063
1063
|
});
|
|
1064
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1064
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseDrivingExpressionMedia", "returned video", { result });
|
|
1065
1065
|
return result;
|
|
1066
1066
|
}
|
|
1067
1067
|
case "live_photo": {
|
|
@@ -1078,7 +1078,7 @@ const parseDrivingExpressionMedia = (raw, status, options) => {
|
|
|
1078
1078
|
coverUrl,
|
|
1079
1079
|
motionUrl
|
|
1080
1080
|
});
|
|
1081
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1081
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseDrivingExpressionMedia", "returned live photo", { result });
|
|
1082
1082
|
return result;
|
|
1083
1083
|
}
|
|
1084
1084
|
case "tgs": {
|
|
@@ -1095,20 +1095,20 @@ const parseDrivingExpressionMedia = (raw, status, options) => {
|
|
|
1095
1095
|
url,
|
|
1096
1096
|
coverUrl
|
|
1097
1097
|
});
|
|
1098
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1098
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseDrivingExpressionMedia", "returned TGS", { result });
|
|
1099
1099
|
return result;
|
|
1100
1100
|
}
|
|
1101
1101
|
default: throw invalidMedia(status, `unsupported media kind: ${raw.kind}`);
|
|
1102
1102
|
}
|
|
1103
1103
|
};
|
|
1104
1104
|
const parseJsonObject = (raw) => {
|
|
1105
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1105
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseJsonObject", "called", { raw });
|
|
1106
1106
|
let value = raw;
|
|
1107
1107
|
if (typeof value === "string") try {
|
|
1108
1108
|
value = JSON.parse(value);
|
|
1109
1109
|
} catch (cause) {
|
|
1110
1110
|
const error = new DrivingExpressionsConfigError("DRIVING_EXPRESSIONS_INVALID_SCHEMA", "drivingExpressions is not valid JSON");
|
|
1111
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1111
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseJsonObject", "threw", {
|
|
1112
1112
|
error,
|
|
1113
1113
|
cause
|
|
1114
1114
|
});
|
|
@@ -1116,34 +1116,34 @@ const parseJsonObject = (raw) => {
|
|
|
1116
1116
|
}
|
|
1117
1117
|
if (!isRecord(value, IS_RECORD_DEBUG$1)) {
|
|
1118
1118
|
const error = new DrivingExpressionsConfigError("DRIVING_EXPRESSIONS_INVALID_SCHEMA", "drivingExpressions must be a JSON object or JSON object string");
|
|
1119
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1119
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseJsonObject", "threw", error);
|
|
1120
1120
|
throw error;
|
|
1121
1121
|
}
|
|
1122
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1122
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseJsonObject", "returned", { value });
|
|
1123
1123
|
return value;
|
|
1124
1124
|
};
|
|
1125
1125
|
const readRuntimeDrivingExpressionsValue = () => {
|
|
1126
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1126
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "readRuntimeDrivingExpressionsValue", "called");
|
|
1127
1127
|
const result = globalThis.__TOOOONY_DRIVING_EXPRESSIONS__;
|
|
1128
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1128
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "readRuntimeDrivingExpressionsValue", "returned typed injection", { result });
|
|
1129
1129
|
return result;
|
|
1130
1130
|
};
|
|
1131
1131
|
const parseMediaAssetId = (raw, status) => {
|
|
1132
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1132
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseMediaAssetId", "called", {
|
|
1133
1133
|
raw,
|
|
1134
1134
|
status
|
|
1135
1135
|
});
|
|
1136
1136
|
if (raw === void 0) {
|
|
1137
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1137
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseMediaAssetId", "returned", { result: void 0 });
|
|
1138
1138
|
return;
|
|
1139
1139
|
}
|
|
1140
1140
|
if (!Number.isSafeInteger(raw) || raw <= 0) throw invalidMedia(status, "mediaAssetId must be a positive safe integer when present");
|
|
1141
1141
|
const result = raw;
|
|
1142
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1142
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseMediaAssetId", "returned", { result });
|
|
1143
1143
|
return result;
|
|
1144
1144
|
};
|
|
1145
1145
|
const assertFieldsAbsent = (value, status, fields) => {
|
|
1146
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1146
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "assertFieldsAbsent", "called", {
|
|
1147
1147
|
value,
|
|
1148
1148
|
status,
|
|
1149
1149
|
fields
|
|
@@ -1151,72 +1151,72 @@ const assertFieldsAbsent = (value, status, fields) => {
|
|
|
1151
1151
|
const present = fields.find((field) => Object.prototype.hasOwnProperty.call(value, field));
|
|
1152
1152
|
if (present !== void 0) {
|
|
1153
1153
|
const error = invalidMedia(status, `${present} is not allowed for this media kind`);
|
|
1154
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1154
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "assertFieldsAbsent", "threw", error);
|
|
1155
1155
|
throw error;
|
|
1156
1156
|
}
|
|
1157
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1157
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "assertFieldsAbsent", "returned");
|
|
1158
1158
|
};
|
|
1159
1159
|
const parseRequiredUrl = (raw, status, field) => {
|
|
1160
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1160
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseRequiredUrl", "called", {
|
|
1161
1161
|
raw,
|
|
1162
1162
|
status,
|
|
1163
1163
|
field
|
|
1164
1164
|
});
|
|
1165
1165
|
if (typeof raw !== "string" || raw.length === 0) {
|
|
1166
1166
|
const error = invalidMedia(status, `${field} is required`);
|
|
1167
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1167
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseRequiredUrl", "threw", error);
|
|
1168
1168
|
throw error;
|
|
1169
1169
|
}
|
|
1170
1170
|
assertPublicUrl(raw, status, field);
|
|
1171
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1171
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseRequiredUrl", "returned", { result: raw });
|
|
1172
1172
|
return raw;
|
|
1173
1173
|
};
|
|
1174
1174
|
const parseOptionalUrl = (raw, status, field) => {
|
|
1175
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1175
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseOptionalUrl", "called", {
|
|
1176
1176
|
raw,
|
|
1177
1177
|
status,
|
|
1178
1178
|
field
|
|
1179
1179
|
});
|
|
1180
1180
|
if (raw === void 0) {
|
|
1181
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1181
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseOptionalUrl", "returned", { result: void 0 });
|
|
1182
1182
|
return;
|
|
1183
1183
|
}
|
|
1184
1184
|
const result = parseRequiredUrl(raw, status, field);
|
|
1185
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1185
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseOptionalUrl", "returned", { result });
|
|
1186
1186
|
return result;
|
|
1187
1187
|
};
|
|
1188
1188
|
const parseOptionalString = (raw, status, field) => {
|
|
1189
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1189
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseOptionalString", "called", {
|
|
1190
1190
|
raw,
|
|
1191
1191
|
status,
|
|
1192
1192
|
field
|
|
1193
1193
|
});
|
|
1194
1194
|
if (raw === void 0) {
|
|
1195
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1195
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseOptionalString", "returned", { result: void 0 });
|
|
1196
1196
|
return;
|
|
1197
1197
|
}
|
|
1198
1198
|
if (typeof raw !== "string" || raw.trim() === "" || raw.length > 255) throw invalidMedia(status, `${field} must be a non-empty string of at most 255 characters`);
|
|
1199
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1199
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "parseOptionalString", "returned", { result: raw });
|
|
1200
1200
|
return raw;
|
|
1201
1201
|
};
|
|
1202
1202
|
const assertPublicUrl = (value, status, field) => {
|
|
1203
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1203
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "assertPublicUrl", "called", {
|
|
1204
1204
|
value,
|
|
1205
1205
|
status,
|
|
1206
1206
|
field
|
|
1207
1207
|
});
|
|
1208
1208
|
if (!isPublicDrivingMediaUrl(value)) {
|
|
1209
1209
|
const error = new DrivingExpressionsConfigError("MEDIA_URL_NOT_PUBLIC_HTTPS", `${status}.${field} must be a long-lived public HTTPS URL`, status);
|
|
1210
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1210
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "assertPublicUrl", "threw", error);
|
|
1211
1211
|
throw error;
|
|
1212
1212
|
}
|
|
1213
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1213
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "assertPublicUrl", "returned");
|
|
1214
1214
|
};
|
|
1215
1215
|
const isOneVisibleGrapheme = (value) => {
|
|
1216
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1216
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isOneVisibleGrapheme", "called", { value });
|
|
1217
1217
|
const trimmed = value.trim();
|
|
1218
1218
|
if (trimmed === "" || trimmed.length > 32) {
|
|
1219
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1219
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isOneVisibleGrapheme", "returned", {
|
|
1220
1220
|
result: false,
|
|
1221
1221
|
trimmed
|
|
1222
1222
|
});
|
|
@@ -1225,7 +1225,7 @@ const isOneVisibleGrapheme = (value) => {
|
|
|
1225
1225
|
const Segmenter = Intl.Segmenter;
|
|
1226
1226
|
const graphemes = Segmenter ? Array.from(new Segmenter(void 0, { granularity: "grapheme" }).segment(trimmed)) : Array.from(trimmed);
|
|
1227
1227
|
const result = graphemes.length === 1;
|
|
1228
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1228
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "isOneVisibleGrapheme", "returned", {
|
|
1229
1229
|
graphemes,
|
|
1230
1230
|
result
|
|
1231
1231
|
});
|
|
@@ -1233,7 +1233,7 @@ const isOneVisibleGrapheme = (value) => {
|
|
|
1233
1233
|
};
|
|
1234
1234
|
const invalidMedia = (status, detail) => {
|
|
1235
1235
|
const result = new DrivingExpressionsConfigError("DRIVING_EXPRESSION_INVALID_MEDIA", `Invalid driving expression for ${status}: ${detail}`, status);
|
|
1236
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1236
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "invalidMedia", "returned", {
|
|
1237
1237
|
status,
|
|
1238
1238
|
detail,
|
|
1239
1239
|
result
|
|
@@ -1241,27 +1241,27 @@ const invalidMedia = (status, detail) => {
|
|
|
1241
1241
|
return result;
|
|
1242
1242
|
};
|
|
1243
1243
|
const compact = (value) => {
|
|
1244
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1244
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "compact", "called", { value });
|
|
1245
1245
|
for (const key of Object.keys(value)) if (value[key] === void 0) delete value[key];
|
|
1246
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1246
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "compact", "returned", { result: value });
|
|
1247
1247
|
return value;
|
|
1248
1248
|
};
|
|
1249
1249
|
const requireNonNegativeFinite = (name, value) => {
|
|
1250
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1250
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "requireNonNegativeFinite", "called", {
|
|
1251
1251
|
name,
|
|
1252
1252
|
value
|
|
1253
1253
|
});
|
|
1254
1254
|
if (!Number.isFinite(value) || value < 0) {
|
|
1255
1255
|
const error = /* @__PURE__ */ new RangeError(`${name} must be a non-negative finite number`);
|
|
1256
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1256
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "requireNonNegativeFinite", "threw", error);
|
|
1257
1257
|
throw error;
|
|
1258
1258
|
}
|
|
1259
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1259
|
+
dialSdkDebugWarn(DEBUG_MODULE$4, "requireNonNegativeFinite", "returned", { result: value });
|
|
1260
1260
|
return value;
|
|
1261
1261
|
};
|
|
1262
1262
|
//#endregion
|
|
1263
1263
|
//#region src/driving_expression/page_lifecycle.ts
|
|
1264
|
-
const DEBUG_MODULE$
|
|
1264
|
+
const DEBUG_MODULE$3 = "page_lifecycle.ts";
|
|
1265
1265
|
const subscribers = /* @__PURE__ */ new Set();
|
|
1266
1266
|
let installedWindow = null;
|
|
1267
1267
|
let installedDocument = null;
|
|
@@ -1272,7 +1272,7 @@ let hadOwnResumeHook = false;
|
|
|
1272
1272
|
let pauseHook = null;
|
|
1273
1273
|
let resumeHook = null;
|
|
1274
1274
|
const subscribeDrivingPageLifecycle = (pause, resume) => {
|
|
1275
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1275
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "subscribeDrivingPageLifecycle", "called", { subscriberCount: subscribers.size });
|
|
1276
1276
|
const subscriber = {
|
|
1277
1277
|
pause,
|
|
1278
1278
|
resume
|
|
@@ -1281,29 +1281,29 @@ const subscribeDrivingPageLifecycle = (pause, resume) => {
|
|
|
1281
1281
|
if (subscribers.size === 1) installLifecycleHooks();
|
|
1282
1282
|
if (isDrivingPageHidden()) safeInvoke(pause);
|
|
1283
1283
|
let subscribed = true;
|
|
1284
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1284
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "subscribeDrivingPageLifecycle", "subscribed", { subscriberCount: subscribers.size });
|
|
1285
1285
|
return () => {
|
|
1286
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1286
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "subscribeDrivingPageLifecycle.unsubscribe", "called", { subscribed });
|
|
1287
1287
|
if (!subscribed) {
|
|
1288
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1288
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "subscribeDrivingPageLifecycle.unsubscribe", "ignored");
|
|
1289
1289
|
return;
|
|
1290
1290
|
}
|
|
1291
1291
|
subscribed = false;
|
|
1292
1292
|
subscribers.delete(subscriber);
|
|
1293
1293
|
if (subscribers.size === 0) uninstallLifecycleHooks();
|
|
1294
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1294
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "subscribeDrivingPageLifecycle.unsubscribe", "returned", { subscriberCount: subscribers.size });
|
|
1295
1295
|
};
|
|
1296
1296
|
};
|
|
1297
1297
|
const isDrivingPageHidden = () => {
|
|
1298
1298
|
const result = typeof document !== "undefined" && document.visibilityState === "hidden";
|
|
1299
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1299
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "isDrivingPageHidden", "returned", {
|
|
1300
1300
|
visibilityState: typeof document === "undefined" ? void 0 : document.visibilityState,
|
|
1301
1301
|
result
|
|
1302
1302
|
});
|
|
1303
1303
|
return result;
|
|
1304
1304
|
};
|
|
1305
1305
|
const installLifecycleHooks = () => {
|
|
1306
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1306
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "installLifecycleHooks", "called");
|
|
1307
1307
|
installedDocument = typeof document === "undefined" ? null : document;
|
|
1308
1308
|
installedWindow = typeof window === "undefined" ? null : window;
|
|
1309
1309
|
installedDocument?.addEventListener("visibilitychange", handleVisibilityChange);
|
|
@@ -1314,7 +1314,7 @@ const installLifecycleHooks = () => {
|
|
|
1314
1314
|
installedWindow?.addEventListener("toooony-device-sensors-release", dispatchPause);
|
|
1315
1315
|
installedWindow?.addEventListener("toooony-device-sensors-resume", dispatchResume);
|
|
1316
1316
|
if (!installedWindow) {
|
|
1317
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1317
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "installLifecycleHooks", "returned without window");
|
|
1318
1318
|
return;
|
|
1319
1319
|
}
|
|
1320
1320
|
hadOwnPauseHook = Object.prototype.hasOwnProperty.call(installedWindow, "__watchFaceRuntimePause");
|
|
@@ -1322,20 +1322,20 @@ const installLifecycleHooks = () => {
|
|
|
1322
1322
|
previousPauseHook = installedWindow.__watchFaceRuntimePause;
|
|
1323
1323
|
previousResumeHook = installedWindow.__watchFaceRuntimeResume;
|
|
1324
1324
|
pauseHook = function(...args) {
|
|
1325
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1325
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "runtimePauseHook", "called", { args });
|
|
1326
1326
|
try {
|
|
1327
1327
|
const result = typeof previousPauseHook === "function" ? previousPauseHook.apply(this, args) : void 0;
|
|
1328
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1328
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "runtimePauseHook", "returned", { result });
|
|
1329
1329
|
return result;
|
|
1330
1330
|
} finally {
|
|
1331
1331
|
dispatchPause();
|
|
1332
1332
|
}
|
|
1333
1333
|
};
|
|
1334
1334
|
resumeHook = function(...args) {
|
|
1335
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1335
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "runtimeResumeHook", "called", { args });
|
|
1336
1336
|
try {
|
|
1337
1337
|
const result = typeof previousResumeHook === "function" ? previousResumeHook.apply(this, args) : void 0;
|
|
1338
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1338
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "runtimeResumeHook", "returned", { result });
|
|
1339
1339
|
return result;
|
|
1340
1340
|
} finally {
|
|
1341
1341
|
dispatchResume();
|
|
@@ -1343,13 +1343,13 @@ const installLifecycleHooks = () => {
|
|
|
1343
1343
|
};
|
|
1344
1344
|
installedWindow.__watchFaceRuntimePause = pauseHook;
|
|
1345
1345
|
installedWindow.__watchFaceRuntimeResume = resumeHook;
|
|
1346
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1346
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "installLifecycleHooks", "returned", {
|
|
1347
1347
|
hadOwnPauseHook,
|
|
1348
1348
|
hadOwnResumeHook
|
|
1349
1349
|
});
|
|
1350
1350
|
};
|
|
1351
1351
|
const uninstallLifecycleHooks = () => {
|
|
1352
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1352
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "uninstallLifecycleHooks", "called");
|
|
1353
1353
|
installedDocument?.removeEventListener("visibilitychange", handleVisibilityChange);
|
|
1354
1354
|
installedWindow?.removeEventListener("pagehide", dispatchPause);
|
|
1355
1355
|
installedWindow?.removeEventListener("freeze", dispatchPause);
|
|
@@ -1369,54 +1369,54 @@ const uninstallLifecycleHooks = () => {
|
|
|
1369
1369
|
hadOwnResumeHook = false;
|
|
1370
1370
|
pauseHook = null;
|
|
1371
1371
|
resumeHook = null;
|
|
1372
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1372
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "uninstallLifecycleHooks", "returned");
|
|
1373
1373
|
};
|
|
1374
1374
|
const handleVisibilityChange = () => {
|
|
1375
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1375
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "handleVisibilityChange", "called");
|
|
1376
1376
|
if (isDrivingPageHidden()) dispatchPause();
|
|
1377
1377
|
else dispatchResume();
|
|
1378
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1378
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "handleVisibilityChange", "returned");
|
|
1379
1379
|
};
|
|
1380
1380
|
const dispatchPause = () => {
|
|
1381
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1381
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "dispatchPause", "called", { subscriberCount: subscribers.size });
|
|
1382
1382
|
for (const subscriber of [...subscribers]) safeInvoke(subscriber.pause);
|
|
1383
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1383
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "dispatchPause", "returned");
|
|
1384
1384
|
};
|
|
1385
1385
|
const dispatchResume = () => {
|
|
1386
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1386
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "dispatchResume", "called", { subscriberCount: subscribers.size });
|
|
1387
1387
|
if (isDrivingPageHidden()) {
|
|
1388
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1388
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "dispatchResume", "ignored while hidden");
|
|
1389
1389
|
return;
|
|
1390
1390
|
}
|
|
1391
1391
|
for (const subscriber of [...subscribers]) safeInvoke(subscriber.resume);
|
|
1392
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1392
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "dispatchResume", "returned");
|
|
1393
1393
|
};
|
|
1394
1394
|
const safeInvoke = (callback) => {
|
|
1395
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1395
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "safeInvoke", "called");
|
|
1396
1396
|
if (invokeSafely(callback, [], (error) => {
|
|
1397
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1398
|
-
})) dialSdkDebugWarn(DEBUG_MODULE$
|
|
1397
|
+
dialSdkDebugWarn(DEBUG_MODULE$3, "safeInvoke", "callback threw", error);
|
|
1398
|
+
})) dialSdkDebugWarn(DEBUG_MODULE$3, "safeInvoke", "returned");
|
|
1399
1399
|
};
|
|
1400
1400
|
//#endregion
|
|
1401
1401
|
//#region src/driving_expression/driving_status_controller.ts
|
|
1402
|
-
const DEBUG_MODULE$
|
|
1402
|
+
const DEBUG_MODULE$2 = "driving_status_controller.ts";
|
|
1403
1403
|
const ZERO_VECTOR = {
|
|
1404
1404
|
x: 0,
|
|
1405
1405
|
y: 0,
|
|
1406
1406
|
z: 0
|
|
1407
1407
|
};
|
|
1408
1408
|
const REQUIRE_POSITIVE_FINITE_DEBUG = {
|
|
1409
|
-
moduleName: DEBUG_MODULE$
|
|
1409
|
+
moduleName: DEBUG_MODULE$2,
|
|
1410
1410
|
scope: "requirePositiveFinite"
|
|
1411
1411
|
};
|
|
1412
1412
|
const createDrivingStatusController = (options = {}) => {
|
|
1413
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1414
|
-
const result = new
|
|
1415
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1413
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "createDrivingStatusController", "called", { options });
|
|
1414
|
+
const result = new DrivingStatusController(options);
|
|
1415
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "createDrivingStatusController", "returned", { snapshot: result.getSnapshot() });
|
|
1416
1416
|
return result;
|
|
1417
1417
|
};
|
|
1418
|
-
var
|
|
1419
|
-
constructor(options) {
|
|
1418
|
+
var DrivingStatusController = class {
|
|
1419
|
+
constructor(options = {}) {
|
|
1420
1420
|
this.listeners = /* @__PURE__ */ new Set();
|
|
1421
1421
|
this.longitudinalWindow = [];
|
|
1422
1422
|
this.yawWindow = [];
|
|
@@ -1463,9 +1463,9 @@ var DefaultDrivingStatusController = class {
|
|
|
1463
1463
|
this.pendingRead = null;
|
|
1464
1464
|
this.unsubscribePageLifecycle = null;
|
|
1465
1465
|
this.handleLifecyclePause = () => {
|
|
1466
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1466
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.handleLifecyclePause", "called");
|
|
1467
1467
|
if (!this.requestedRunning || this.lifecycleSuspended) {
|
|
1468
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1468
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.handleLifecyclePause", "ignored", {
|
|
1469
1469
|
requestedRunning: this.requestedRunning,
|
|
1470
1470
|
lifecycleSuspended: this.lifecycleSuspended
|
|
1471
1471
|
});
|
|
@@ -1474,13 +1474,13 @@ var DefaultDrivingStatusController = class {
|
|
|
1474
1474
|
this.lifecycleSuspended = true;
|
|
1475
1475
|
this.deactivatePolling();
|
|
1476
1476
|
this.resetTransientRecognition();
|
|
1477
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1477
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.handleLifecyclePause", "returned");
|
|
1478
1478
|
};
|
|
1479
1479
|
this.handleLifecycleResume = () => {
|
|
1480
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1480
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.handleLifecycleResume", "called");
|
|
1481
1481
|
const pageHidden = this.requestedRunning && this.lifecycleSuspended && !this.destroyed ? isDrivingPageHidden() : false;
|
|
1482
1482
|
if (!this.requestedRunning || !this.lifecycleSuspended || this.destroyed || pageHidden) {
|
|
1483
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1483
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.handleLifecycleResume", "ignored", {
|
|
1484
1484
|
requestedRunning: this.requestedRunning,
|
|
1485
1485
|
lifecycleSuspended: this.lifecycleSuspended,
|
|
1486
1486
|
destroyed: this.destroyed,
|
|
@@ -1490,9 +1490,9 @@ var DefaultDrivingStatusController = class {
|
|
|
1490
1490
|
}
|
|
1491
1491
|
this.lifecycleSuspended = false;
|
|
1492
1492
|
this.activatePolling();
|
|
1493
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1493
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.handleLifecycleResume", "returned");
|
|
1494
1494
|
};
|
|
1495
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1495
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.constructor", "called", { options });
|
|
1496
1496
|
this.sensorProvider = options.sensorProvider ?? unifiedSensorInfo;
|
|
1497
1497
|
this.pollIntervalMs = requirePositiveFinite("pollIntervalMs", options.pollIntervalMs ?? 200, REQUIRE_POSITIVE_FINITE_DEBUG);
|
|
1498
1498
|
this.unavailableFallbackMs = requirePositiveFinite("unavailableFallbackMs", options.unavailableFallbackMs ?? 3e3, REQUIRE_POSITIVE_FINITE_DEBUG);
|
|
@@ -1504,19 +1504,19 @@ var DefaultDrivingStatusController = class {
|
|
|
1504
1504
|
const initialStatus = options.initialStatus ?? "STOPPED";
|
|
1505
1505
|
if (!CAR_RUNNING_STATUSES.includes(initialStatus)) {
|
|
1506
1506
|
const error = /* @__PURE__ */ new TypeError(`Unsupported initialStatus: ${initialStatus}`);
|
|
1507
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1507
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.constructor", "threw", error);
|
|
1508
1508
|
throw error;
|
|
1509
1509
|
}
|
|
1510
1510
|
this.status = initialStatus;
|
|
1511
1511
|
this.baseStatus = isBaseStatus(initialStatus) ? initialStatus : "STOPPED";
|
|
1512
1512
|
this.statusCommittedAtMs = this.clock.now();
|
|
1513
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1514
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1513
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.constructor", "resolved directional longitudinal tuning", this.directionalLongitudinalTuning);
|
|
1514
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.constructor", "created", this.getSnapshot());
|
|
1515
1515
|
}
|
|
1516
1516
|
start() {
|
|
1517
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1517
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.start", "called", this.getSnapshot());
|
|
1518
1518
|
if (this.destroyed || this.requestedRunning) {
|
|
1519
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1519
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.start", "ignored", {
|
|
1520
1520
|
destroyed: this.destroyed,
|
|
1521
1521
|
requestedRunning: this.requestedRunning
|
|
1522
1522
|
});
|
|
@@ -1525,12 +1525,12 @@ var DefaultDrivingStatusController = class {
|
|
|
1525
1525
|
this.requestedRunning = true;
|
|
1526
1526
|
this.attachLifecycleListeners();
|
|
1527
1527
|
if (!this.lifecycleSuspended) this.activatePolling();
|
|
1528
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1528
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.start", "returned", this.getSnapshot());
|
|
1529
1529
|
}
|
|
1530
1530
|
stop() {
|
|
1531
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1531
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.stop", "called", this.getSnapshot());
|
|
1532
1532
|
if (this.destroyed || !this.requestedRunning) {
|
|
1533
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1533
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.stop", "ignored", {
|
|
1534
1534
|
destroyed: this.destroyed,
|
|
1535
1535
|
requestedRunning: this.requestedRunning
|
|
1536
1536
|
});
|
|
@@ -1541,12 +1541,12 @@ var DefaultDrivingStatusController = class {
|
|
|
1541
1541
|
this.detachLifecycleListeners();
|
|
1542
1542
|
this.deactivatePolling();
|
|
1543
1543
|
this.resetTransientRecognition();
|
|
1544
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1544
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.stop", "returned", this.getSnapshot());
|
|
1545
1545
|
}
|
|
1546
1546
|
destroy() {
|
|
1547
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1547
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.destroy", "called", this.getSnapshot());
|
|
1548
1548
|
if (this.destroyed) {
|
|
1549
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1549
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.destroy", "ignored");
|
|
1550
1550
|
return;
|
|
1551
1551
|
}
|
|
1552
1552
|
if (this.requestedRunning) this.stop();
|
|
@@ -1557,7 +1557,7 @@ var DefaultDrivingStatusController = class {
|
|
|
1557
1557
|
this.destroyed = true;
|
|
1558
1558
|
this.listeners.clear();
|
|
1559
1559
|
this.resetTransientRecognition();
|
|
1560
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1560
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.destroy", "returned", this.getSnapshot());
|
|
1561
1561
|
}
|
|
1562
1562
|
getSnapshot() {
|
|
1563
1563
|
const result = {
|
|
@@ -1572,36 +1572,36 @@ var DefaultDrivingStatusController = class {
|
|
|
1572
1572
|
unavailableSinceMs: this.unavailableSinceMs,
|
|
1573
1573
|
tuningVersion: this.tuning.version
|
|
1574
1574
|
};
|
|
1575
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1575
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.getSnapshot", "returned", { result });
|
|
1576
1576
|
return result;
|
|
1577
1577
|
}
|
|
1578
1578
|
subscribe(listener) {
|
|
1579
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1579
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.subscribe", "called", {
|
|
1580
1580
|
listener,
|
|
1581
1581
|
destroyed: this.destroyed
|
|
1582
1582
|
});
|
|
1583
1583
|
if (this.destroyed) {
|
|
1584
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1584
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.subscribe", "ignored destroyed controller");
|
|
1585
1585
|
return noop;
|
|
1586
1586
|
}
|
|
1587
1587
|
this.listeners.add(listener);
|
|
1588
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1588
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.subscribe", "returned", { listenerCount: this.listeners.size });
|
|
1589
1589
|
let subscribed = true;
|
|
1590
1590
|
return () => {
|
|
1591
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1591
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.unsubscribe", "called", { subscribed });
|
|
1592
1592
|
if (!subscribed) {
|
|
1593
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1593
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.unsubscribe", "ignored");
|
|
1594
1594
|
return;
|
|
1595
1595
|
}
|
|
1596
1596
|
subscribed = false;
|
|
1597
1597
|
this.listeners.delete(listener);
|
|
1598
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1598
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.unsubscribe", "returned", { listenerCount: this.listeners.size });
|
|
1599
1599
|
};
|
|
1600
1600
|
}
|
|
1601
1601
|
activatePolling() {
|
|
1602
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1602
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.activatePolling", "called");
|
|
1603
1603
|
if (this.destroyed || this.polling || !this.requestedRunning || this.lifecycleSuspended) {
|
|
1604
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1604
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.activatePolling", "ignored", {
|
|
1605
1605
|
destroyed: this.destroyed,
|
|
1606
1606
|
polling: this.polling,
|
|
1607
1607
|
requestedRunning: this.requestedRunning,
|
|
@@ -1612,10 +1612,10 @@ var DefaultDrivingStatusController = class {
|
|
|
1612
1612
|
this.polling = true;
|
|
1613
1613
|
this.generation += 1;
|
|
1614
1614
|
this.schedulePoll(0, this.generation);
|
|
1615
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1615
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.activatePolling", "returned", { generation: this.generation });
|
|
1616
1616
|
}
|
|
1617
1617
|
deactivatePolling() {
|
|
1618
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1618
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.deactivatePolling", "called", {
|
|
1619
1619
|
generation: this.generation,
|
|
1620
1620
|
hasTimer: this.timer !== void 0,
|
|
1621
1621
|
hasPendingRead: this.pendingRead !== null
|
|
@@ -1628,7 +1628,7 @@ var DefaultDrivingStatusController = class {
|
|
|
1628
1628
|
}
|
|
1629
1629
|
this.pendingRead?.abort();
|
|
1630
1630
|
this.pendingRead = null;
|
|
1631
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1631
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.deactivatePolling", "returned", { generation: this.generation });
|
|
1632
1632
|
}
|
|
1633
1633
|
schedulePoll(delayMs, generation) {
|
|
1634
1634
|
if (!this.polling || generation !== this.generation || this.timer !== void 0) return;
|
|
@@ -1639,9 +1639,9 @@ var DefaultDrivingStatusController = class {
|
|
|
1639
1639
|
}
|
|
1640
1640
|
async poll(generation) {
|
|
1641
1641
|
const pollStartedAtMs = this.clock.now();
|
|
1642
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1642
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.poll", "called", { generation });
|
|
1643
1643
|
if (!this.polling || generation !== this.generation || this.pendingRead !== null) {
|
|
1644
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1644
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.poll", "ignored", {
|
|
1645
1645
|
polling: this.polling,
|
|
1646
1646
|
generation,
|
|
1647
1647
|
currentGeneration: this.generation,
|
|
@@ -1654,7 +1654,7 @@ var DefaultDrivingStatusController = class {
|
|
|
1654
1654
|
try {
|
|
1655
1655
|
const payload = await this.sensorProvider(pendingRead.signal);
|
|
1656
1656
|
if (!this.polling || generation !== this.generation || pendingRead.signal.aborted) {
|
|
1657
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1657
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.poll", "discarded provider result", {
|
|
1658
1658
|
generation,
|
|
1659
1659
|
currentGeneration: this.generation,
|
|
1660
1660
|
polling: this.polling,
|
|
@@ -1671,21 +1671,21 @@ var DefaultDrivingStatusController = class {
|
|
|
1671
1671
|
});
|
|
1672
1672
|
const accelerometerSample = extractFreshVector(payload.accelerometer, payload.capturedAtMs, this.tuning.maxSampleAgeMs);
|
|
1673
1673
|
if (gravity === null || metrics === null || accelerometerSample === null) {
|
|
1674
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1674
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.poll", "invalid or stale snapshot", {
|
|
1675
1675
|
metrics,
|
|
1676
1676
|
accelerometerSample
|
|
1677
1677
|
});
|
|
1678
1678
|
this.processUnavailable("invalid_or_stale_snapshot");
|
|
1679
1679
|
} else {
|
|
1680
1680
|
this.processAvailable(metrics, accelerometerSample, gravity);
|
|
1681
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1681
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.poll", "processed sample", { capturedAtMs: metrics.capturedAtMs });
|
|
1682
1682
|
}
|
|
1683
1683
|
} catch (error) {
|
|
1684
1684
|
if (!this.polling || generation !== this.generation || pendingRead.signal.aborted || isAbortError(error)) {
|
|
1685
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1685
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.poll", "ignored provider error", { error });
|
|
1686
1686
|
return;
|
|
1687
1687
|
}
|
|
1688
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1688
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.poll", "caught provider error", { error });
|
|
1689
1689
|
this.processUnavailable("provider_error");
|
|
1690
1690
|
} finally {
|
|
1691
1691
|
if (this.pendingRead === pendingRead) this.pendingRead = null;
|
|
@@ -1693,7 +1693,7 @@ var DefaultDrivingStatusController = class {
|
|
|
1693
1693
|
const elapsedMs = Math.max(0, this.clock.now() - pollStartedAtMs);
|
|
1694
1694
|
this.schedulePoll(Math.max(0, this.pollIntervalMs - elapsedMs), generation);
|
|
1695
1695
|
}
|
|
1696
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1696
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.poll", "completed", {
|
|
1697
1697
|
generation,
|
|
1698
1698
|
polling: this.polling
|
|
1699
1699
|
});
|
|
@@ -1745,7 +1745,7 @@ var DefaultDrivingStatusController = class {
|
|
|
1745
1745
|
};
|
|
1746
1746
|
}
|
|
1747
1747
|
processAvailable(metrics, accelerometerSample, gravity) {
|
|
1748
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1748
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.processAvailable", "called", {
|
|
1749
1749
|
metrics,
|
|
1750
1750
|
accelerometerSample
|
|
1751
1751
|
});
|
|
@@ -1770,7 +1770,7 @@ var DefaultDrivingStatusController = class {
|
|
|
1770
1770
|
const addedYaw = pushUniqueMetric(this.yawWindow, metrics, "gyroscopeSampledAtMs", yawRetentionMs);
|
|
1771
1771
|
const addedMotion = pushUniqueVector(this.motionWindow, accelerometerSample, recognitionRetentionMs(this.tuning.motionWindowMs, this.tuning.motionMinimumSamples));
|
|
1772
1772
|
if (!addedLongitudinal && !addedYaw && !addedMotion) {
|
|
1773
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1773
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.processAvailable", "ignored duplicate sample");
|
|
1774
1774
|
return;
|
|
1775
1775
|
}
|
|
1776
1776
|
const motionCoverageWindow = selectCoverageWindow(this.motionWindow, this.tuning.motionMinimumSamples, this.tuning.motionWindowMs, (sample) => sample.sampledAtMs);
|
|
@@ -1782,7 +1782,7 @@ var DefaultDrivingStatusController = class {
|
|
|
1782
1782
|
const previousTurnStatus = this.turnStatus;
|
|
1783
1783
|
const baseCondition = this.updateBaseDetector(motionMad, metrics, accelerometerSample.sampledAtMs, addedMotion, motionCoverageWindow?.[0]?.sampledAtMs ?? accelerometerSample.sampledAtMs);
|
|
1784
1784
|
const longitudinalEvidence = detectLongitudinalEvidence(this.longitudinalWindow, this.tuning, this.directionalLongitudinalTuning);
|
|
1785
|
-
if (longitudinalEvidence.brakingQualityRejection !== null || longitudinalEvidence.suddenBrakingQualityRejection !== null) dialSdkDebugWarn(DEBUG_MODULE$
|
|
1785
|
+
if (longitudinalEvidence.brakingQualityRejection !== null || longitudinalEvidence.suddenBrakingQualityRejection !== null) dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.processAvailable", "rejected braking quality", {
|
|
1786
1786
|
braking: longitudinalEvidence.brakingQualityRejection,
|
|
1787
1787
|
suddenBraking: longitudinalEvidence.suddenBrakingQualityRejection
|
|
1788
1788
|
});
|
|
@@ -1834,7 +1834,7 @@ var DefaultDrivingStatusController = class {
|
|
|
1834
1834
|
});
|
|
1835
1835
|
const hasAction = this.urgentStatus !== null || this.turnStatus !== null || this.normalLongitudinalStatus !== null;
|
|
1836
1836
|
if (motionMad !== null || hasAction) this.commitSelectedStatus(now);
|
|
1837
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1837
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.processAvailable", "returned", {
|
|
1838
1838
|
motionMad,
|
|
1839
1839
|
baseCondition,
|
|
1840
1840
|
status: this.status,
|
|
@@ -1975,7 +1975,7 @@ var DefaultDrivingStatusController = class {
|
|
|
1975
1975
|
this.commit(selected, now, "candidate_confirmed");
|
|
1976
1976
|
}
|
|
1977
1977
|
processUnavailable(category) {
|
|
1978
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1978
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.processUnavailable", "called", { category });
|
|
1979
1979
|
const now = this.clock.now();
|
|
1980
1980
|
if (this.unavailableSinceMs === null) this.unavailableSinceMs = now;
|
|
1981
1981
|
const unavailableForMs = Math.max(0, now - this.unavailableSinceMs);
|
|
@@ -1988,7 +1988,7 @@ var DefaultDrivingStatusController = class {
|
|
|
1988
1988
|
tuningVersion: this.tuning.version
|
|
1989
1989
|
});
|
|
1990
1990
|
if (unavailableForMs < this.unavailableFallbackMs || this.fallbackApplied) {
|
|
1991
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
1991
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.processUnavailable", "holding previous status", {
|
|
1992
1992
|
category,
|
|
1993
1993
|
unavailableForMs,
|
|
1994
1994
|
fallbackApplied: this.fallbackApplied
|
|
@@ -2005,14 +2005,14 @@ var DefaultDrivingStatusController = class {
|
|
|
2005
2005
|
tuningVersion: this.tuning.version
|
|
2006
2006
|
});
|
|
2007
2007
|
this.commit("STOPPED", now, "unavailable_fallback");
|
|
2008
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
2008
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.processUnavailable", "returned fallback", {
|
|
2009
2009
|
unavailableForMs,
|
|
2010
2010
|
status: this.status
|
|
2011
2011
|
});
|
|
2012
2012
|
}
|
|
2013
2013
|
commit(nextStatus, now, reason) {
|
|
2014
2014
|
if (nextStatus === this.status) {
|
|
2015
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
2015
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.commit", "ignored unchanged status", {
|
|
2016
2016
|
status: this.status,
|
|
2017
2017
|
reason
|
|
2018
2018
|
});
|
|
@@ -2030,7 +2030,7 @@ var DefaultDrivingStatusController = class {
|
|
|
2030
2030
|
atMs: now
|
|
2031
2031
|
};
|
|
2032
2032
|
for (const listener of [...this.listeners]) invokeSafely(listener, [event], (error) => {
|
|
2033
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
2033
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "safeCall", "callback threw", {
|
|
2034
2034
|
error,
|
|
2035
2035
|
value: event
|
|
2036
2036
|
});
|
|
@@ -2043,7 +2043,7 @@ var DefaultDrivingStatusController = class {
|
|
|
2043
2043
|
reason,
|
|
2044
2044
|
tuningVersion: this.tuning.version
|
|
2045
2045
|
});
|
|
2046
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
2046
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.commit", "status changed", { event });
|
|
2047
2047
|
}
|
|
2048
2048
|
setCandidate(candidate, atMs) {
|
|
2049
2049
|
if (candidate === this.candidate) return;
|
|
@@ -2057,7 +2057,7 @@ var DefaultDrivingStatusController = class {
|
|
|
2057
2057
|
previousCandidate,
|
|
2058
2058
|
tuningVersion: this.tuning.version
|
|
2059
2059
|
});
|
|
2060
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
2060
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.setCandidate", "candidate changed", {
|
|
2061
2061
|
candidate,
|
|
2062
2062
|
previousCandidate,
|
|
2063
2063
|
candidateSinceMs: this.candidateSinceMs
|
|
@@ -2093,12 +2093,12 @@ var DefaultDrivingStatusController = class {
|
|
|
2093
2093
|
this.lastGravitySampledAtMs = null;
|
|
2094
2094
|
}
|
|
2095
2095
|
emitDiagnostic(event) {
|
|
2096
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
2096
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "DrivingStatusController.emitDiagnostic", "called", {
|
|
2097
2097
|
event,
|
|
2098
2098
|
hasListener: this.onDiagnostic !== void 0
|
|
2099
2099
|
});
|
|
2100
2100
|
if (this.onDiagnostic) invokeSafely(this.onDiagnostic, [event], (error) => {
|
|
2101
|
-
dialSdkDebugWarn(DEBUG_MODULE$
|
|
2101
|
+
dialSdkDebugWarn(DEBUG_MODULE$2, "safeCall", "callback threw", {
|
|
2102
2102
|
error,
|
|
2103
2103
|
value: event
|
|
2104
2104
|
});
|
|
@@ -2392,31 +2392,31 @@ const isBaseStatus = (status) => status === "STOPPED" || status === "STEADY_DRIV
|
|
|
2392
2392
|
const noop = () => void 0;
|
|
2393
2393
|
//#endregion
|
|
2394
2394
|
//#region src/driving_expression/driving_expression_player.ts
|
|
2395
|
-
const DEBUG_MODULE = "driving_expression_player.ts";
|
|
2395
|
+
const DEBUG_MODULE$1 = "driving_expression_player.ts";
|
|
2396
2396
|
const MAX_RETAINED_IMAGES = 3;
|
|
2397
2397
|
const POSITIVE_FINITE_DEBUG = {
|
|
2398
|
-
moduleName: DEBUG_MODULE,
|
|
2398
|
+
moduleName: DEBUG_MODULE$1,
|
|
2399
2399
|
scope: "positiveFinite"
|
|
2400
2400
|
};
|
|
2401
2401
|
const CREATE_ABORT_ERROR_DEBUG = {
|
|
2402
|
-
moduleName: DEBUG_MODULE,
|
|
2402
|
+
moduleName: DEBUG_MODULE$1,
|
|
2403
2403
|
scope: "createAbortError"
|
|
2404
2404
|
};
|
|
2405
2405
|
const IS_ABORT_ERROR_DEBUG = {
|
|
2406
|
-
moduleName: DEBUG_MODULE,
|
|
2406
|
+
moduleName: DEBUG_MODULE$1,
|
|
2407
2407
|
scope: "isAbortError"
|
|
2408
2408
|
};
|
|
2409
2409
|
const IS_RECORD_DEBUG = {
|
|
2410
|
-
moduleName: DEBUG_MODULE,
|
|
2410
|
+
moduleName: DEBUG_MODULE$1,
|
|
2411
2411
|
scope: "isRecord"
|
|
2412
2412
|
};
|
|
2413
2413
|
const createDrivingExpressionPlayer = (container, options) => {
|
|
2414
|
-
dialSdkDebugWarn(DEBUG_MODULE, "createDrivingExpressionPlayer", "called", {
|
|
2414
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "createDrivingExpressionPlayer", "called", {
|
|
2415
2415
|
container,
|
|
2416
2416
|
options
|
|
2417
2417
|
});
|
|
2418
2418
|
const result = new DefaultDrivingExpressionPlayer(container, options);
|
|
2419
|
-
dialSdkDebugWarn(DEBUG_MODULE, "createDrivingExpressionPlayer", "returned", { snapshot: result.getSnapshot() });
|
|
2419
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "createDrivingExpressionPlayer", "returned", { snapshot: result.getSnapshot() });
|
|
2420
2420
|
return result;
|
|
2421
2421
|
};
|
|
2422
2422
|
var DefaultDrivingExpressionPlayer = class {
|
|
@@ -2443,32 +2443,32 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2443
2443
|
this.retainedImages = /* @__PURE__ */ new Map();
|
|
2444
2444
|
this.preloadedHintUrls = /* @__PURE__ */ new Set();
|
|
2445
2445
|
this.handleLifecyclePause = () => {
|
|
2446
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.handleLifecyclePause", "called");
|
|
2446
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.handleLifecyclePause", "called");
|
|
2447
2447
|
if (this.destroyed || this.lifecycleSuspended) {
|
|
2448
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.handleLifecyclePause", "ignored");
|
|
2448
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.handleLifecyclePause", "ignored");
|
|
2449
2449
|
return;
|
|
2450
2450
|
}
|
|
2451
2451
|
this.lifecycleSuspended = true;
|
|
2452
2452
|
this.updatePauseState();
|
|
2453
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.handleLifecyclePause", "returned");
|
|
2453
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.handleLifecyclePause", "returned");
|
|
2454
2454
|
};
|
|
2455
2455
|
this.handleLifecycleResume = () => {
|
|
2456
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.handleLifecycleResume", "called");
|
|
2456
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.handleLifecycleResume", "called");
|
|
2457
2457
|
if (this.destroyed || !this.lifecycleSuspended) {
|
|
2458
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.handleLifecycleResume", "ignored");
|
|
2458
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.handleLifecycleResume", "ignored");
|
|
2459
2459
|
return;
|
|
2460
2460
|
}
|
|
2461
2461
|
this.lifecycleSuspended = false;
|
|
2462
2462
|
this.updatePauseState();
|
|
2463
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.handleLifecycleResume", "returned");
|
|
2463
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.handleLifecycleResume", "returned");
|
|
2464
2464
|
};
|
|
2465
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.constructor", "called", {
|
|
2465
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.constructor", "called", {
|
|
2466
2466
|
container,
|
|
2467
2467
|
options
|
|
2468
2468
|
});
|
|
2469
2469
|
if (!container || typeof container.replaceChildren !== "function") {
|
|
2470
2470
|
const error = /* @__PURE__ */ new TypeError("container must be an HTMLElement-like DOM container");
|
|
2471
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.constructor", "threw", error);
|
|
2471
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.constructor", "threw", error);
|
|
2472
2472
|
throw error;
|
|
2473
2473
|
}
|
|
2474
2474
|
this.container = container;
|
|
@@ -2485,7 +2485,7 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2485
2485
|
this.maxTgsJsonBytes = requirePositiveFinite("maxTgsJsonBytes", options.maxTgsJsonBytes ?? 8 * 1024 * 1024, POSITIVE_FINITE_DEBUG);
|
|
2486
2486
|
this.maxTgsLayers = requirePositiveFinite("maxTgsLayers", options.maxTgsLayers ?? 500, POSITIVE_FINITE_DEBUG);
|
|
2487
2487
|
if (options.managePageLifecycle ?? true) this.unsubscribePageLifecycle = subscribeDrivingPageLifecycle(this.handleLifecyclePause, this.handleLifecycleResume);
|
|
2488
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.constructor", "created", {
|
|
2488
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.constructor", "created", {
|
|
2489
2489
|
loadTimeoutMs: this.loadTimeoutMs,
|
|
2490
2490
|
retryBackoffMs: this.retryBackoffMs,
|
|
2491
2491
|
fit: this.fit,
|
|
@@ -2496,12 +2496,12 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2496
2496
|
});
|
|
2497
2497
|
}
|
|
2498
2498
|
async show(status) {
|
|
2499
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.show", "called", {
|
|
2499
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.show", "called", {
|
|
2500
2500
|
status,
|
|
2501
2501
|
snapshot: this.getSnapshot()
|
|
2502
2502
|
});
|
|
2503
2503
|
if (this.destroyed || status === this.status && this.phase !== "idle") {
|
|
2504
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.show", "ignored");
|
|
2504
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.show", "ignored");
|
|
2505
2505
|
return;
|
|
2506
2506
|
}
|
|
2507
2507
|
this.status = status;
|
|
@@ -2513,23 +2513,23 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2513
2513
|
this.desiredMedia = null;
|
|
2514
2514
|
this.desiredMediaRole = null;
|
|
2515
2515
|
this.handleFailure(status, null, new DrivingExpressionResolutionError(status), "invalid_config", operation, false);
|
|
2516
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.show", "returned after missing config");
|
|
2516
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.show", "returned after missing config");
|
|
2517
2517
|
return;
|
|
2518
2518
|
}
|
|
2519
2519
|
this.desiredMedia = fallback.media;
|
|
2520
2520
|
this.desiredMediaRole = "fallback";
|
|
2521
2521
|
if (this.paused) {
|
|
2522
2522
|
this.phase = "idle";
|
|
2523
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.show", "deferred fallback while paused");
|
|
2523
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.show", "deferred fallback while paused");
|
|
2524
2524
|
return;
|
|
2525
2525
|
}
|
|
2526
2526
|
if (fallback.type === "unsupported") {
|
|
2527
2527
|
this.handleFailure(status, fallback.media, unsupportedFallbackError(fallback.media), "invalid_config", operation, false, false);
|
|
2528
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.show", "returned unsupported fallback");
|
|
2528
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.show", "returned unsupported fallback");
|
|
2529
2529
|
return;
|
|
2530
2530
|
}
|
|
2531
2531
|
this.renderFallback(status, fallback.media);
|
|
2532
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.show", "returned fallback", { snapshot: this.getSnapshot() });
|
|
2532
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.show", "returned fallback", { snapshot: this.getSnapshot() });
|
|
2533
2533
|
return;
|
|
2534
2534
|
}
|
|
2535
2535
|
const media = normalizeMedia(configured);
|
|
@@ -2537,40 +2537,40 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2537
2537
|
this.desiredMediaRole = "primary";
|
|
2538
2538
|
if (this.paused) {
|
|
2539
2539
|
this.phase = "idle";
|
|
2540
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.show", "deferred media while paused", { media });
|
|
2540
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.show", "deferred media while paused", { media });
|
|
2541
2541
|
return;
|
|
2542
2542
|
}
|
|
2543
2543
|
await this.load(status, media, operation);
|
|
2544
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.show", "resolved", {
|
|
2544
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.show", "resolved", {
|
|
2545
2545
|
status,
|
|
2546
2546
|
media,
|
|
2547
2547
|
snapshot: this.getSnapshot()
|
|
2548
2548
|
});
|
|
2549
2549
|
}
|
|
2550
2550
|
pause() {
|
|
2551
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.pause", "called", this.getSnapshot());
|
|
2551
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.pause", "called", this.getSnapshot());
|
|
2552
2552
|
if (this.destroyed || this.userPaused) {
|
|
2553
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.pause", "ignored");
|
|
2553
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.pause", "ignored");
|
|
2554
2554
|
return;
|
|
2555
2555
|
}
|
|
2556
2556
|
this.userPaused = true;
|
|
2557
2557
|
this.updatePauseState();
|
|
2558
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.pause", "returned", this.getSnapshot());
|
|
2558
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.pause", "returned", this.getSnapshot());
|
|
2559
2559
|
}
|
|
2560
2560
|
resume() {
|
|
2561
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.resume", "called", this.getSnapshot());
|
|
2561
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.resume", "called", this.getSnapshot());
|
|
2562
2562
|
if (this.destroyed || !this.userPaused) {
|
|
2563
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.resume", "ignored");
|
|
2563
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.resume", "ignored");
|
|
2564
2564
|
return;
|
|
2565
2565
|
}
|
|
2566
2566
|
this.userPaused = false;
|
|
2567
2567
|
this.updatePauseState();
|
|
2568
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.resume", "returned", this.getSnapshot());
|
|
2568
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.resume", "returned", this.getSnapshot());
|
|
2569
2569
|
}
|
|
2570
2570
|
destroy() {
|
|
2571
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.destroy", "called", this.getSnapshot());
|
|
2571
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.destroy", "called", this.getSnapshot());
|
|
2572
2572
|
if (this.destroyed) {
|
|
2573
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.destroy", "ignored");
|
|
2573
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.destroy", "ignored");
|
|
2574
2574
|
return;
|
|
2575
2575
|
}
|
|
2576
2576
|
this.destroyed = true;
|
|
@@ -2589,7 +2589,7 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2589
2589
|
this.phase = "idle";
|
|
2590
2590
|
this.mediaKind = null;
|
|
2591
2591
|
this.errorCategory = null;
|
|
2592
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.destroy", "returned", this.getSnapshot());
|
|
2592
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.destroy", "returned", this.getSnapshot());
|
|
2593
2593
|
}
|
|
2594
2594
|
getSnapshot() {
|
|
2595
2595
|
const result = {
|
|
@@ -2599,11 +2599,11 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2599
2599
|
mediaKind: this.mediaKind,
|
|
2600
2600
|
errorCategory: this.errorCategory
|
|
2601
2601
|
};
|
|
2602
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.getSnapshot", "returned", { result });
|
|
2602
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.getSnapshot", "returned", { result });
|
|
2603
2603
|
return result;
|
|
2604
2604
|
}
|
|
2605
2605
|
beginOperation() {
|
|
2606
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.beginOperation", "called", {
|
|
2606
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.beginOperation", "called", {
|
|
2607
2607
|
operation: this.operation,
|
|
2608
2608
|
snapshot: this.getSnapshot()
|
|
2609
2609
|
});
|
|
@@ -2615,11 +2615,11 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2615
2615
|
this.phase = "loading";
|
|
2616
2616
|
this.mediaKind = null;
|
|
2617
2617
|
this.errorCategory = null;
|
|
2618
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.beginOperation", "returned", { operation: this.operation });
|
|
2618
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.beginOperation", "returned", { operation: this.operation });
|
|
2619
2619
|
return this.operation;
|
|
2620
2620
|
}
|
|
2621
2621
|
updatePauseState() {
|
|
2622
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.updatePauseState", "called", {
|
|
2622
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.updatePauseState", "called", {
|
|
2623
2623
|
userPaused: this.userPaused,
|
|
2624
2624
|
lifecycleSuspended: this.lifecycleSuspended,
|
|
2625
2625
|
paused: this.paused,
|
|
@@ -2627,7 +2627,7 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2627
2627
|
});
|
|
2628
2628
|
const shouldPause = this.userPaused || this.lifecycleSuspended;
|
|
2629
2629
|
if (shouldPause === this.paused) {
|
|
2630
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.updatePauseState", "ignored unchanged state");
|
|
2630
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.updatePauseState", "ignored unchanged state");
|
|
2631
2631
|
return;
|
|
2632
2632
|
}
|
|
2633
2633
|
this.paused = shouldPause;
|
|
@@ -2636,7 +2636,7 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2636
2636
|
this.cancelPendingWork();
|
|
2637
2637
|
this.activeVideo?.pause();
|
|
2638
2638
|
this.activeTgs?.pause?.();
|
|
2639
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.updatePauseState", "paused", this.getSnapshot());
|
|
2639
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.updatePauseState", "paused", this.getSnapshot());
|
|
2640
2640
|
return;
|
|
2641
2641
|
}
|
|
2642
2642
|
if (this.phase === "ready") {
|
|
@@ -2649,7 +2649,7 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2649
2649
|
video.play().catch((error) => this.handleActiveVideoFailure(video, status, media, operation, "decode", error));
|
|
2650
2650
|
}
|
|
2651
2651
|
this.activeTgs?.play?.();
|
|
2652
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.updatePauseState", "resumed ready media");
|
|
2652
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.updatePauseState", "resumed ready media");
|
|
2653
2653
|
return;
|
|
2654
2654
|
}
|
|
2655
2655
|
if (this.status !== null && this.desiredMedia !== null) {
|
|
@@ -2661,10 +2661,10 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2661
2661
|
else this.handleFailure(status, fallback, unsupportedFallbackError(fallback), "invalid_config", operation, false, false);
|
|
2662
2662
|
} else this.load(this.status, this.desiredMedia, operation);
|
|
2663
2663
|
}
|
|
2664
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.updatePauseState", "returned", this.getSnapshot());
|
|
2664
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.updatePauseState", "returned", this.getSnapshot());
|
|
2665
2665
|
}
|
|
2666
2666
|
async load(status, media, operation) {
|
|
2667
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.load", "called", {
|
|
2667
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.load", "called", {
|
|
2668
2668
|
status,
|
|
2669
2669
|
media,
|
|
2670
2670
|
operation
|
|
@@ -2674,13 +2674,13 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2674
2674
|
if (media.kind === "emoji") {
|
|
2675
2675
|
this.renderEmoji(media.text);
|
|
2676
2676
|
this.markReady(status, media.kind, startedAt, operation);
|
|
2677
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.load", "resolved emoji", { snapshot: this.getSnapshot() });
|
|
2677
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.load", "resolved emoji", { snapshot: this.getSnapshot() });
|
|
2678
2678
|
return;
|
|
2679
2679
|
}
|
|
2680
2680
|
const invalidUrl = firstInvalidMediaUrl(media);
|
|
2681
2681
|
if (invalidUrl !== null) {
|
|
2682
2682
|
this.handleFailure(status, media, /* @__PURE__ */ new Error("One or more media URLs are not long-lived public HTTPS URLs"), "invalid_config", operation);
|
|
2683
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.load", "returned invalid URL", { invalidUrl });
|
|
2683
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.load", "returned invalid URL", { invalidUrl });
|
|
2684
2684
|
return;
|
|
2685
2685
|
}
|
|
2686
2686
|
const loadAbort = new AbortController();
|
|
@@ -2703,7 +2703,7 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2703
2703
|
break;
|
|
2704
2704
|
}
|
|
2705
2705
|
if (!this.isCurrent(operation) || this.failedOperation === operation) {
|
|
2706
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.load", "discarded completed load", {
|
|
2706
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.load", "discarded completed load", {
|
|
2707
2707
|
operation,
|
|
2708
2708
|
failedOperation: this.failedOperation
|
|
2709
2709
|
});
|
|
@@ -2711,31 +2711,31 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2711
2711
|
}
|
|
2712
2712
|
this.markReady(status, media.kind, startedAt, operation);
|
|
2713
2713
|
this.startPreloading(status, operation);
|
|
2714
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.load", "resolved", {
|
|
2714
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.load", "resolved", {
|
|
2715
2715
|
status,
|
|
2716
2716
|
media,
|
|
2717
2717
|
operation,
|
|
2718
2718
|
snapshot: this.getSnapshot()
|
|
2719
2719
|
});
|
|
2720
2720
|
} catch (error) {
|
|
2721
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.load", "caught error", {
|
|
2721
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.load", "caught error", {
|
|
2722
2722
|
error,
|
|
2723
2723
|
operation
|
|
2724
2724
|
});
|
|
2725
2725
|
if (!this.isCurrent(operation) || isAbortError(error, IS_ABORT_ERROR_DEBUG)) {
|
|
2726
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.load", "ignored error");
|
|
2726
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.load", "ignored error");
|
|
2727
2727
|
return;
|
|
2728
2728
|
}
|
|
2729
2729
|
this.handleFailure(status, media, error, categorizeMediaError(error), operation);
|
|
2730
2730
|
} finally {
|
|
2731
2731
|
loadAbort.abort();
|
|
2732
2732
|
if (this.loadAbort === loadAbort) this.loadAbort = null;
|
|
2733
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.load", "completed", { operation });
|
|
2733
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.load", "completed", { operation });
|
|
2734
2734
|
}
|
|
2735
2735
|
}
|
|
2736
2736
|
async loadImage(status, media, signal, operation) {
|
|
2737
2737
|
const { url } = media;
|
|
2738
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.loadImage", "called", {
|
|
2738
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.loadImage", "called", {
|
|
2739
2739
|
status,
|
|
2740
2740
|
media,
|
|
2741
2741
|
signal,
|
|
@@ -2745,7 +2745,7 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2745
2745
|
const retained = this.takeRetainedImage(url);
|
|
2746
2746
|
if (retained !== null) {
|
|
2747
2747
|
this.container.replaceChildren(retained);
|
|
2748
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.loadImage", "resolved retained image", {
|
|
2748
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.loadImage", "resolved retained image", {
|
|
2749
2749
|
url,
|
|
2750
2750
|
operation,
|
|
2751
2751
|
image: retained
|
|
@@ -2759,12 +2759,12 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2759
2759
|
image.src = url;
|
|
2760
2760
|
});
|
|
2761
2761
|
if (!this.isCurrent(operation)) {
|
|
2762
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.loadImage", "discarded", { operation });
|
|
2762
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.loadImage", "discarded", { operation });
|
|
2763
2763
|
return;
|
|
2764
2764
|
}
|
|
2765
2765
|
if (isRetainableImage(media)) this.retainImage(url, image);
|
|
2766
2766
|
this.container.replaceChildren(image);
|
|
2767
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.loadImage", "resolved", {
|
|
2767
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.loadImage", "resolved", {
|
|
2768
2768
|
url,
|
|
2769
2769
|
operation,
|
|
2770
2770
|
image
|
|
@@ -2794,7 +2794,7 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2794
2794
|
this.retainedImages.clear();
|
|
2795
2795
|
}
|
|
2796
2796
|
async loadVideo(url, mimeType, status, media, signal, operation) {
|
|
2797
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.loadVideo", "called", {
|
|
2797
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.loadVideo", "called", {
|
|
2798
2798
|
url,
|
|
2799
2799
|
mimeType,
|
|
2800
2800
|
status,
|
|
@@ -2811,7 +2811,7 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2811
2811
|
video.load();
|
|
2812
2812
|
});
|
|
2813
2813
|
if (!this.isCurrent(operation)) {
|
|
2814
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.loadVideo", "discarded", { operation });
|
|
2814
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.loadVideo", "discarded", { operation });
|
|
2815
2815
|
return;
|
|
2816
2816
|
}
|
|
2817
2817
|
video.currentTime = 0;
|
|
@@ -2819,14 +2819,14 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2819
2819
|
this.activeVideo = video;
|
|
2820
2820
|
this.attachActiveVideoFailureListeners(video, status, media, operation);
|
|
2821
2821
|
await video.play();
|
|
2822
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.loadVideo", "resolved", {
|
|
2822
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.loadVideo", "resolved", {
|
|
2823
2823
|
url,
|
|
2824
2824
|
operation,
|
|
2825
2825
|
video
|
|
2826
2826
|
});
|
|
2827
2827
|
}
|
|
2828
2828
|
async loadLivePhoto(media, status, signal, operation) {
|
|
2829
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.loadLivePhoto", "called", {
|
|
2829
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.loadLivePhoto", "called", {
|
|
2830
2830
|
media,
|
|
2831
2831
|
status,
|
|
2832
2832
|
signal,
|
|
@@ -2838,25 +2838,25 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2838
2838
|
cover.src = media.coverUrl;
|
|
2839
2839
|
});
|
|
2840
2840
|
if (!this.isCurrent(operation)) {
|
|
2841
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.loadLivePhoto", "discarded", { operation });
|
|
2841
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.loadLivePhoto", "discarded", { operation });
|
|
2842
2842
|
return;
|
|
2843
2843
|
}
|
|
2844
2844
|
this.container.replaceChildren(cover);
|
|
2845
2845
|
await this.loadVideo(media.motionUrl, void 0, status, media, signal, operation);
|
|
2846
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.loadLivePhoto", "resolved", {
|
|
2846
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.loadLivePhoto", "resolved", {
|
|
2847
2847
|
media,
|
|
2848
2848
|
operation
|
|
2849
2849
|
});
|
|
2850
2850
|
}
|
|
2851
2851
|
async loadTgs(url, signal, operation) {
|
|
2852
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.loadTgs", "called", {
|
|
2852
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.loadTgs", "called", {
|
|
2853
2853
|
url,
|
|
2854
2854
|
signal,
|
|
2855
2855
|
operation
|
|
2856
2856
|
});
|
|
2857
2857
|
if (!this.fetchImplementation) {
|
|
2858
2858
|
const error = new MediaPlayerError("unsupported", "fetch is unavailable");
|
|
2859
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.loadTgs", "threw", error);
|
|
2859
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.loadTgs", "threw", error);
|
|
2860
2860
|
throw error;
|
|
2861
2861
|
}
|
|
2862
2862
|
const response = await withTimeout(this.fetchImplementation(url, {
|
|
@@ -2866,7 +2866,7 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2866
2866
|
}), this.loadTimeoutMs, signal);
|
|
2867
2867
|
if (!response.ok) throw new MediaPlayerError("network", `TGS request failed with HTTP ${response.status}`);
|
|
2868
2868
|
const contentType = response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase() ?? "";
|
|
2869
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.loadTgs", "received response", {
|
|
2869
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.loadTgs", "received response", {
|
|
2870
2870
|
ok: response.ok,
|
|
2871
2871
|
status: response.status,
|
|
2872
2872
|
contentType,
|
|
@@ -2884,7 +2884,7 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2884
2884
|
animationData = JSON.parse(new TextDecoder().decode(bytes));
|
|
2885
2885
|
} catch (cause) {
|
|
2886
2886
|
const error = new MediaPlayerError("decode", "TGS JSON is malformed");
|
|
2887
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.loadTgs", "threw", {
|
|
2887
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.loadTgs", "threw", {
|
|
2888
2888
|
error,
|
|
2889
2889
|
cause
|
|
2890
2890
|
});
|
|
@@ -2896,12 +2896,12 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2896
2896
|
const handle = await withTimeout(Promise.resolve(this.tgsRenderer(host, animationData, signal)), this.loadTimeoutMs, signal);
|
|
2897
2897
|
if (!this.isCurrent(operation)) {
|
|
2898
2898
|
handle.destroy();
|
|
2899
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.loadTgs", "discarded", { operation });
|
|
2899
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.loadTgs", "discarded", { operation });
|
|
2900
2900
|
return;
|
|
2901
2901
|
}
|
|
2902
2902
|
this.activeTgs = handle;
|
|
2903
2903
|
this.container.replaceChildren(host);
|
|
2904
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.loadTgs", "resolved", {
|
|
2904
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.loadTgs", "resolved", {
|
|
2905
2905
|
url,
|
|
2906
2906
|
operation,
|
|
2907
2907
|
animationData,
|
|
@@ -2909,7 +2909,7 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2909
2909
|
});
|
|
2910
2910
|
}
|
|
2911
2911
|
renderLoadingPlaceholder(status, coverUrl, operation, signal) {
|
|
2912
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.renderLoadingPlaceholder", "called", {
|
|
2912
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.renderLoadingPlaceholder", "called", {
|
|
2913
2913
|
status,
|
|
2914
2914
|
coverUrl,
|
|
2915
2915
|
operation,
|
|
@@ -2917,43 +2917,43 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2917
2917
|
});
|
|
2918
2918
|
this.renderConfiguredFallback(status, false);
|
|
2919
2919
|
if (!coverUrl) {
|
|
2920
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.renderLoadingPlaceholder", "returned no cover");
|
|
2920
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.renderLoadingPlaceholder", "returned no cover");
|
|
2921
2921
|
return;
|
|
2922
2922
|
}
|
|
2923
2923
|
const cover = this.createImage();
|
|
2924
2924
|
waitForElementEvent(cover, "load", "error", signal, this.loadTimeoutMs, () => {
|
|
2925
2925
|
cover.src = coverUrl;
|
|
2926
2926
|
}).then(() => {
|
|
2927
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.renderLoadingPlaceholder.then", "called", {
|
|
2927
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.renderLoadingPlaceholder.then", "called", {
|
|
2928
2928
|
operation,
|
|
2929
2929
|
cover
|
|
2930
2930
|
});
|
|
2931
2931
|
if (this.isCurrent(operation) && this.phase === "loading") this.container.replaceChildren(cover);
|
|
2932
2932
|
}).catch((error) => {
|
|
2933
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.renderLoadingPlaceholder.catch", "called", {
|
|
2933
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.renderLoadingPlaceholder.catch", "called", {
|
|
2934
2934
|
operation,
|
|
2935
2935
|
error
|
|
2936
2936
|
});
|
|
2937
2937
|
if (this.isCurrent(operation) && this.phase === "loading") this.renderConfiguredFallback(status, false);
|
|
2938
2938
|
});
|
|
2939
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.renderLoadingPlaceholder", "returned");
|
|
2939
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.renderLoadingPlaceholder", "returned");
|
|
2940
2940
|
}
|
|
2941
2941
|
renderConfiguredFallback(status, report = true) {
|
|
2942
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.renderConfiguredFallback", "called", {
|
|
2942
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.renderConfiguredFallback", "called", {
|
|
2943
2943
|
status,
|
|
2944
2944
|
report
|
|
2945
2945
|
});
|
|
2946
2946
|
const fallback = this.resolveFallback(status);
|
|
2947
2947
|
if (fallback.type !== "static") {
|
|
2948
2948
|
this.container.replaceChildren();
|
|
2949
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.renderConfiguredFallback", "returned", {
|
|
2949
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.renderConfiguredFallback", "returned", {
|
|
2950
2950
|
result: false,
|
|
2951
2951
|
fallbackType: fallback.type
|
|
2952
2952
|
});
|
|
2953
2953
|
return false;
|
|
2954
2954
|
}
|
|
2955
2955
|
this.renderFallback(status, fallback.media, report);
|
|
2956
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.renderConfiguredFallback", "returned", {
|
|
2956
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.renderConfiguredFallback", "returned", {
|
|
2957
2957
|
result: true,
|
|
2958
2958
|
fallback: fallback.media
|
|
2959
2959
|
});
|
|
@@ -2968,14 +2968,14 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2968
2968
|
type: "unsupported",
|
|
2969
2969
|
media: fallback
|
|
2970
2970
|
};
|
|
2971
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.resolveFallback", "returned", {
|
|
2971
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.resolveFallback", "returned", {
|
|
2972
2972
|
status,
|
|
2973
2973
|
result
|
|
2974
2974
|
});
|
|
2975
2975
|
return result;
|
|
2976
2976
|
}
|
|
2977
2977
|
renderFallback(status, fallback, report = true) {
|
|
2978
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.renderFallback", "called", {
|
|
2978
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.renderFallback", "called", {
|
|
2979
2979
|
status,
|
|
2980
2980
|
fallback,
|
|
2981
2981
|
report
|
|
@@ -2996,10 +2996,10 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
2996
2996
|
status,
|
|
2997
2997
|
kind: fallback.kind
|
|
2998
2998
|
});
|
|
2999
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.renderFallback", "returned", { snapshot: this.getSnapshot() });
|
|
2999
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.renderFallback", "returned", { snapshot: this.getSnapshot() });
|
|
3000
3000
|
}
|
|
3001
3001
|
renderEmoji(text) {
|
|
3002
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.renderEmoji", "called", { text });
|
|
3002
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.renderEmoji", "called", { text });
|
|
3003
3003
|
const emoji = this.document.createElement("span");
|
|
3004
3004
|
emoji.textContent = text;
|
|
3005
3005
|
emoji.setAttribute("role", "img");
|
|
@@ -3015,17 +3015,17 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
3015
3015
|
width: "100%"
|
|
3016
3016
|
});
|
|
3017
3017
|
this.container.replaceChildren(emoji);
|
|
3018
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.renderEmoji", "returned", { emoji });
|
|
3018
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.renderEmoji", "returned", { emoji });
|
|
3019
3019
|
}
|
|
3020
3020
|
markReady(status, kind, startedAt, operation) {
|
|
3021
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.markReady", "called", {
|
|
3021
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.markReady", "called", {
|
|
3022
3022
|
status,
|
|
3023
3023
|
kind,
|
|
3024
3024
|
startedAt,
|
|
3025
3025
|
operation
|
|
3026
3026
|
});
|
|
3027
3027
|
if (!this.isCurrent(operation) || this.failedOperation === operation) {
|
|
3028
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.markReady", "ignored");
|
|
3028
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.markReady", "ignored");
|
|
3029
3029
|
return;
|
|
3030
3030
|
}
|
|
3031
3031
|
this.phase = "ready";
|
|
@@ -3037,10 +3037,10 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
3037
3037
|
kind,
|
|
3038
3038
|
elapsedMs: Math.max(0, Date.now() - startedAt)
|
|
3039
3039
|
});
|
|
3040
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.markReady", "returned", this.getSnapshot());
|
|
3040
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.markReady", "returned", this.getSnapshot());
|
|
3041
3041
|
}
|
|
3042
3042
|
handleFailure(status, media, error, category, operation, scheduleRetry = true, applyFallback = true) {
|
|
3043
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.handleFailure", "called", {
|
|
3043
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.handleFailure", "called", {
|
|
3044
3044
|
status,
|
|
3045
3045
|
media,
|
|
3046
3046
|
error,
|
|
@@ -3050,7 +3050,7 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
3050
3050
|
applyFallback
|
|
3051
3051
|
});
|
|
3052
3052
|
if (!this.isCurrent(operation) || this.failedOperation === operation) {
|
|
3053
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.handleFailure", "ignored");
|
|
3053
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.handleFailure", "ignored");
|
|
3054
3054
|
return;
|
|
3055
3055
|
}
|
|
3056
3056
|
this.failedOperation = operation;
|
|
@@ -3087,42 +3087,42 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
3087
3087
|
this.errorCategory = category;
|
|
3088
3088
|
}
|
|
3089
3089
|
if (scheduleRetry && media !== null) this.scheduleRetry(status, media, operation);
|
|
3090
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.handleFailure", "returned", {
|
|
3090
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.handleFailure", "returned", {
|
|
3091
3091
|
fallbackApplied,
|
|
3092
3092
|
snapshot: this.getSnapshot()
|
|
3093
3093
|
});
|
|
3094
3094
|
}
|
|
3095
3095
|
scheduleRetry(status, media, failedOperation) {
|
|
3096
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.scheduleRetry", "called", {
|
|
3096
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.scheduleRetry", "called", {
|
|
3097
3097
|
status,
|
|
3098
3098
|
media,
|
|
3099
3099
|
failedOperation
|
|
3100
3100
|
});
|
|
3101
3101
|
if (this.destroyed || this.paused || !this.isCurrent(failedOperation)) {
|
|
3102
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.scheduleRetry", "ignored");
|
|
3102
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.scheduleRetry", "ignored");
|
|
3103
3103
|
return;
|
|
3104
3104
|
}
|
|
3105
3105
|
this.retryTimer = globalThis.setTimeout(() => {
|
|
3106
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.scheduleRetry.callback", "called", {
|
|
3106
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.scheduleRetry.callback", "called", {
|
|
3107
3107
|
status,
|
|
3108
3108
|
media,
|
|
3109
3109
|
failedOperation
|
|
3110
3110
|
});
|
|
3111
3111
|
this.retryTimer = void 0;
|
|
3112
3112
|
if (this.destroyed || this.paused || this.status !== status || !this.isCurrent(failedOperation)) {
|
|
3113
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.scheduleRetry.callback", "ignored");
|
|
3113
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.scheduleRetry.callback", "ignored");
|
|
3114
3114
|
return;
|
|
3115
3115
|
}
|
|
3116
3116
|
const operation = this.beginOperation();
|
|
3117
3117
|
this.load(status, media, operation);
|
|
3118
3118
|
}, this.retryBackoffMs);
|
|
3119
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.scheduleRetry", "scheduled", {
|
|
3119
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.scheduleRetry", "scheduled", {
|
|
3120
3120
|
retryTimer: this.retryTimer,
|
|
3121
3121
|
retryBackoffMs: this.retryBackoffMs
|
|
3122
3122
|
});
|
|
3123
3123
|
}
|
|
3124
3124
|
startPreloading(currentStatus, operation) {
|
|
3125
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.startPreloading", "called", {
|
|
3125
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.startPreloading", "called", {
|
|
3126
3126
|
currentStatus,
|
|
3127
3127
|
operation
|
|
3128
3128
|
});
|
|
@@ -3135,13 +3135,13 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
3135
3135
|
...CAR_RUNNING_STATUSES
|
|
3136
3136
|
].filter((status, index, all) => all.indexOf(status) === index);
|
|
3137
3137
|
(async () => {
|
|
3138
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.startPreloading.worker", "started", {
|
|
3138
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.startPreloading.worker", "started", {
|
|
3139
3139
|
statuses,
|
|
3140
3140
|
operation
|
|
3141
3141
|
});
|
|
3142
3142
|
for (const status of statuses) {
|
|
3143
3143
|
if (!this.isCurrent(operation) || preloadAbort.signal.aborted) {
|
|
3144
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.startPreloading.worker", "cancelled", {
|
|
3144
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.startPreloading.worker", "cancelled", {
|
|
3145
3145
|
status,
|
|
3146
3146
|
operation
|
|
3147
3147
|
});
|
|
@@ -3160,12 +3160,12 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
3160
3160
|
});
|
|
3161
3161
|
this.preloadedHintUrls.add(hintUrl);
|
|
3162
3162
|
image.removeAttribute("src");
|
|
3163
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.startPreloading.worker", "preloaded", {
|
|
3163
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.startPreloading.worker", "preloaded", {
|
|
3164
3164
|
status,
|
|
3165
3165
|
hintUrl
|
|
3166
3166
|
});
|
|
3167
3167
|
} catch (error) {
|
|
3168
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.startPreloading.worker", "preload failed", {
|
|
3168
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.startPreloading.worker", "preload failed", {
|
|
3169
3169
|
status,
|
|
3170
3170
|
hintUrl,
|
|
3171
3171
|
error
|
|
@@ -3173,21 +3173,21 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
3173
3173
|
if (preloadAbort.signal.aborted) return;
|
|
3174
3174
|
}
|
|
3175
3175
|
}
|
|
3176
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.startPreloading.worker", "completed", { operation });
|
|
3176
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.startPreloading.worker", "completed", { operation });
|
|
3177
3177
|
})();
|
|
3178
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.startPreloading", "returned", { statuses });
|
|
3178
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.startPreloading", "returned", { statuses });
|
|
3179
3179
|
}
|
|
3180
3180
|
createImage() {
|
|
3181
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.createImage", "called");
|
|
3181
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.createImage", "called");
|
|
3182
3182
|
const image = this.document.createElement("img");
|
|
3183
3183
|
image.alt = "";
|
|
3184
3184
|
image.decoding = "async";
|
|
3185
3185
|
styleMediaElement(image, this.fit);
|
|
3186
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.createImage", "returned", { image });
|
|
3186
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.createImage", "returned", { image });
|
|
3187
3187
|
return image;
|
|
3188
3188
|
}
|
|
3189
3189
|
getReusableVideo() {
|
|
3190
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.getReusableVideo", "called", { hasReusableVideo: this.reusableVideo !== null });
|
|
3190
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.getReusableVideo", "called", { hasReusableVideo: this.reusableVideo !== null });
|
|
3191
3191
|
if (!this.reusableVideo) {
|
|
3192
3192
|
this.reusableVideo = this.document.createElement("video");
|
|
3193
3193
|
this.reusableVideo.muted = true;
|
|
@@ -3197,11 +3197,11 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
3197
3197
|
this.reusableVideo.setAttribute("playsinline", "");
|
|
3198
3198
|
styleMediaElement(this.reusableVideo, this.fit);
|
|
3199
3199
|
}
|
|
3200
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.getReusableVideo", "returned", { video: this.reusableVideo });
|
|
3200
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.getReusableVideo", "returned", { video: this.reusableVideo });
|
|
3201
3201
|
return this.reusableVideo;
|
|
3202
3202
|
}
|
|
3203
3203
|
attachActiveVideoFailureListeners(video, status, media, operation) {
|
|
3204
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.attachActiveVideoFailureListeners", "called", {
|
|
3204
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.attachActiveVideoFailureListeners", "called", {
|
|
3205
3205
|
video,
|
|
3206
3206
|
status,
|
|
3207
3207
|
media,
|
|
@@ -3210,19 +3210,19 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
3210
3210
|
this.detachActiveVideoFailureListeners();
|
|
3211
3211
|
let attached = true;
|
|
3212
3212
|
const cleanup = () => {
|
|
3213
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.videoListenerCleanup", "called", { attached });
|
|
3213
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.videoListenerCleanup", "called", { attached });
|
|
3214
3214
|
if (!attached) {
|
|
3215
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.videoListenerCleanup", "ignored");
|
|
3215
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.videoListenerCleanup", "ignored");
|
|
3216
3216
|
return;
|
|
3217
3217
|
}
|
|
3218
3218
|
attached = false;
|
|
3219
3219
|
video.removeEventListener("error", handleError);
|
|
3220
3220
|
video.removeEventListener("stalled", handleStalled);
|
|
3221
3221
|
if (this.activeVideoListenersCleanup === cleanup) this.activeVideoListenersCleanup = null;
|
|
3222
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.videoListenerCleanup", "returned");
|
|
3222
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.videoListenerCleanup", "returned");
|
|
3223
3223
|
};
|
|
3224
3224
|
const failed = (category, event) => {
|
|
3225
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.videoListenerFailed", "called", {
|
|
3225
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.videoListenerFailed", "called", {
|
|
3226
3226
|
category,
|
|
3227
3227
|
event,
|
|
3228
3228
|
attached
|
|
@@ -3231,20 +3231,20 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
3231
3231
|
this.handleActiveVideoFailure(video, status, media, operation, category, new MediaPlayerError(category, `${event.type} after video playback started`));
|
|
3232
3232
|
};
|
|
3233
3233
|
const handleError = (event) => {
|
|
3234
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.handleVideoError", "called", { event });
|
|
3234
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.handleVideoError", "called", { event });
|
|
3235
3235
|
failed("decode", event);
|
|
3236
3236
|
};
|
|
3237
3237
|
const handleStalled = (event) => {
|
|
3238
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.handleVideoStalled", "called", { event });
|
|
3238
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.handleVideoStalled", "called", { event });
|
|
3239
3239
|
failed("network", event);
|
|
3240
3240
|
};
|
|
3241
3241
|
video.addEventListener("error", handleError);
|
|
3242
3242
|
video.addEventListener("stalled", handleStalled);
|
|
3243
3243
|
this.activeVideoListenersCleanup = cleanup;
|
|
3244
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.attachActiveVideoFailureListeners", "returned");
|
|
3244
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.attachActiveVideoFailureListeners", "returned");
|
|
3245
3245
|
}
|
|
3246
3246
|
handleActiveVideoFailure(video, status, media, operation, category, error) {
|
|
3247
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.handleActiveVideoFailure", "called", {
|
|
3247
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.handleActiveVideoFailure", "called", {
|
|
3248
3248
|
video,
|
|
3249
3249
|
status,
|
|
3250
3250
|
media,
|
|
@@ -3253,33 +3253,33 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
3253
3253
|
error
|
|
3254
3254
|
});
|
|
3255
3255
|
if (this.activeVideo !== video || !this.isCurrent(operation)) {
|
|
3256
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.handleActiveVideoFailure", "ignored");
|
|
3256
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.handleActiveVideoFailure", "ignored");
|
|
3257
3257
|
return;
|
|
3258
3258
|
}
|
|
3259
3259
|
this.stopActiveVideo();
|
|
3260
3260
|
this.handleFailure(status, media, error, category, operation);
|
|
3261
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.handleActiveVideoFailure", "returned");
|
|
3261
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.handleActiveVideoFailure", "returned");
|
|
3262
3262
|
}
|
|
3263
3263
|
detachActiveVideoFailureListeners() {
|
|
3264
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.detachActiveVideoFailureListeners", "called");
|
|
3264
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.detachActiveVideoFailureListeners", "called");
|
|
3265
3265
|
const cleanup = this.activeVideoListenersCleanup;
|
|
3266
3266
|
this.activeVideoListenersCleanup = null;
|
|
3267
3267
|
cleanup?.();
|
|
3268
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.detachActiveVideoFailureListeners", "returned");
|
|
3268
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.detachActiveVideoFailureListeners", "returned");
|
|
3269
3269
|
}
|
|
3270
3270
|
stopActiveVideo() {
|
|
3271
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.stopActiveVideo", "called", { activeVideo: this.activeVideo });
|
|
3271
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.stopActiveVideo", "called", { activeVideo: this.activeVideo });
|
|
3272
3272
|
this.detachActiveVideoFailureListeners();
|
|
3273
3273
|
if (!this.activeVideo) {
|
|
3274
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.stopActiveVideo", "returned no active video");
|
|
3274
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.stopActiveVideo", "returned no active video");
|
|
3275
3275
|
return;
|
|
3276
3276
|
}
|
|
3277
3277
|
resetVideo(this.activeVideo);
|
|
3278
3278
|
this.activeVideo = null;
|
|
3279
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.stopActiveVideo", "returned");
|
|
3279
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.stopActiveVideo", "returned");
|
|
3280
3280
|
}
|
|
3281
3281
|
releaseActiveMedia() {
|
|
3282
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.releaseActiveMedia", "called", {
|
|
3282
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.releaseActiveMedia", "called", {
|
|
3283
3283
|
activeVideo: this.activeVideo,
|
|
3284
3284
|
activeTgs: this.activeTgs
|
|
3285
3285
|
});
|
|
@@ -3288,10 +3288,10 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
3288
3288
|
safeDestroy(this.activeTgs);
|
|
3289
3289
|
this.activeTgs = null;
|
|
3290
3290
|
}
|
|
3291
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.releaseActiveMedia", "returned");
|
|
3291
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.releaseActiveMedia", "returned");
|
|
3292
3292
|
}
|
|
3293
3293
|
cancelPendingWork() {
|
|
3294
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.cancelPendingWork", "called", {
|
|
3294
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.cancelPendingWork", "called", {
|
|
3295
3295
|
hasLoad: this.loadAbort !== null,
|
|
3296
3296
|
hasPreload: this.preloadAbort !== null,
|
|
3297
3297
|
retryTimer: this.retryTimer
|
|
@@ -3306,11 +3306,11 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
3306
3306
|
globalThis.clearTimeout(this.retryTimer);
|
|
3307
3307
|
this.retryTimer = void 0;
|
|
3308
3308
|
}
|
|
3309
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.cancelPendingWork", "returned");
|
|
3309
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.cancelPendingWork", "returned");
|
|
3310
3310
|
}
|
|
3311
3311
|
isCurrent(operation) {
|
|
3312
3312
|
const result = !this.destroyed && !this.paused && operation === this.operation;
|
|
3313
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.isCurrent", "returned", {
|
|
3313
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.isCurrent", "returned", {
|
|
3314
3314
|
operation,
|
|
3315
3315
|
currentOperation: this.operation,
|
|
3316
3316
|
destroyed: this.destroyed,
|
|
@@ -3320,29 +3320,29 @@ var DefaultDrivingExpressionPlayer = class {
|
|
|
3320
3320
|
return result;
|
|
3321
3321
|
}
|
|
3322
3322
|
emitDiagnostic(event) {
|
|
3323
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.emitDiagnostic", "called", {
|
|
3323
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.emitDiagnostic", "called", {
|
|
3324
3324
|
event,
|
|
3325
3325
|
hasListener: this.onDiagnostic !== void 0
|
|
3326
3326
|
});
|
|
3327
3327
|
if (!this.onDiagnostic) {
|
|
3328
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.emitDiagnostic", "returned no listener");
|
|
3328
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.emitDiagnostic", "returned no listener");
|
|
3329
3329
|
return;
|
|
3330
3330
|
}
|
|
3331
3331
|
if (invokeSafely(this.onDiagnostic, [event], (error) => {
|
|
3332
|
-
dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.emitDiagnostic", "listener threw", error);
|
|
3333
|
-
})) dialSdkDebugWarn(DEBUG_MODULE, "DefaultDrivingExpressionPlayer.emitDiagnostic", "returned", { event });
|
|
3332
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.emitDiagnostic", "listener threw", error);
|
|
3333
|
+
})) dialSdkDebugWarn(DEBUG_MODULE$1, "DefaultDrivingExpressionPlayer.emitDiagnostic", "returned", { event });
|
|
3334
3334
|
}
|
|
3335
3335
|
};
|
|
3336
3336
|
var MediaPlayerError = class extends Error {
|
|
3337
3337
|
constructor(category, message) {
|
|
3338
|
-
dialSdkDebugWarn(DEBUG_MODULE, "MediaPlayerError.constructor", "called", {
|
|
3338
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "MediaPlayerError.constructor", "called", {
|
|
3339
3339
|
category,
|
|
3340
3340
|
message
|
|
3341
3341
|
});
|
|
3342
3342
|
super(message);
|
|
3343
3343
|
this.name = "MediaPlayerError";
|
|
3344
3344
|
this.category = category;
|
|
3345
|
-
dialSdkDebugWarn(DEBUG_MODULE, "MediaPlayerError.constructor", "created", { error: this });
|
|
3345
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "MediaPlayerError.constructor", "created", { error: this });
|
|
3346
3346
|
}
|
|
3347
3347
|
};
|
|
3348
3348
|
const SUPPORTED_TGS_CONTENT_TYPES = /* @__PURE__ */ new Set([
|
|
@@ -3357,7 +3357,7 @@ const normalizeMedia = (media) => {
|
|
|
3357
3357
|
kind: "image",
|
|
3358
3358
|
url: media
|
|
3359
3359
|
} : media;
|
|
3360
|
-
dialSdkDebugWarn(DEBUG_MODULE, "normalizeMedia", "returned", {
|
|
3360
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "normalizeMedia", "returned", {
|
|
3361
3361
|
media,
|
|
3362
3362
|
result
|
|
3363
3363
|
});
|
|
@@ -3374,7 +3374,7 @@ const isRetainableImage = (media) => {
|
|
|
3374
3374
|
}
|
|
3375
3375
|
};
|
|
3376
3376
|
const firstInvalidMediaUrl = (media) => {
|
|
3377
|
-
dialSdkDebugWarn(DEBUG_MODULE, "firstInvalidMediaUrl", "called", { media });
|
|
3377
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "firstInvalidMediaUrl", "called", { media });
|
|
3378
3378
|
let values;
|
|
3379
3379
|
switch (media.kind) {
|
|
3380
3380
|
case "emoji":
|
|
@@ -3392,14 +3392,14 @@ const firstInvalidMediaUrl = (media) => {
|
|
|
3392
3392
|
break;
|
|
3393
3393
|
}
|
|
3394
3394
|
const result = values.find((value) => typeof value === "string" && !isPublicDrivingMediaUrl(value)) ?? null;
|
|
3395
|
-
dialSdkDebugWarn(DEBUG_MODULE, "firstInvalidMediaUrl", "returned", {
|
|
3395
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "firstInvalidMediaUrl", "returned", {
|
|
3396
3396
|
values,
|
|
3397
3397
|
result
|
|
3398
3398
|
});
|
|
3399
3399
|
return result;
|
|
3400
3400
|
};
|
|
3401
3401
|
const mediaPreloadHint = (media) => {
|
|
3402
|
-
dialSdkDebugWarn(DEBUG_MODULE, "mediaPreloadHint", "called", { media });
|
|
3402
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "mediaPreloadHint", "called", { media });
|
|
3403
3403
|
let result;
|
|
3404
3404
|
switch (media.kind) {
|
|
3405
3405
|
case "image":
|
|
@@ -3416,11 +3416,11 @@ const mediaPreloadHint = (media) => {
|
|
|
3416
3416
|
result = void 0;
|
|
3417
3417
|
break;
|
|
3418
3418
|
}
|
|
3419
|
-
dialSdkDebugWarn(DEBUG_MODULE, "mediaPreloadHint", "returned", { result });
|
|
3419
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "mediaPreloadHint", "returned", { result });
|
|
3420
3420
|
return result;
|
|
3421
3421
|
};
|
|
3422
3422
|
const waitForElementEvent = (element, successEvent, failureEvent, signal, timeoutMs, start) => {
|
|
3423
|
-
dialSdkDebugWarn(DEBUG_MODULE, "waitForElementEvent", "called", {
|
|
3423
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "waitForElementEvent", "called", {
|
|
3424
3424
|
element,
|
|
3425
3425
|
successEvent,
|
|
3426
3426
|
failureEvent,
|
|
@@ -3430,25 +3430,25 @@ const waitForElementEvent = (element, successEvent, failureEvent, signal, timeou
|
|
|
3430
3430
|
const result = new Promise((resolve, reject) => {
|
|
3431
3431
|
let timer;
|
|
3432
3432
|
const cleanup = () => {
|
|
3433
|
-
dialSdkDebugWarn(DEBUG_MODULE, "waitForElementEvent.cleanup", "called", { timer });
|
|
3433
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "waitForElementEvent.cleanup", "called", { timer });
|
|
3434
3434
|
element.removeEventListener(successEvent, handleSuccess);
|
|
3435
3435
|
element.removeEventListener(failureEvent, handleFailure);
|
|
3436
3436
|
signal.removeEventListener("abort", handleAbort);
|
|
3437
3437
|
if (timer !== void 0) globalThis.clearTimeout(timer);
|
|
3438
|
-
dialSdkDebugWarn(DEBUG_MODULE, "waitForElementEvent.cleanup", "returned");
|
|
3438
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "waitForElementEvent.cleanup", "returned");
|
|
3439
3439
|
};
|
|
3440
3440
|
const handleSuccess = () => {
|
|
3441
|
-
dialSdkDebugWarn(DEBUG_MODULE, "waitForElementEvent.handleSuccess", "called", { successEvent });
|
|
3441
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "waitForElementEvent.handleSuccess", "called", { successEvent });
|
|
3442
3442
|
cleanup();
|
|
3443
3443
|
resolve();
|
|
3444
3444
|
};
|
|
3445
3445
|
const handleFailure = () => {
|
|
3446
|
-
dialSdkDebugWarn(DEBUG_MODULE, "waitForElementEvent.handleFailure", "called", { failureEvent });
|
|
3446
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "waitForElementEvent.handleFailure", "called", { failureEvent });
|
|
3447
3447
|
cleanup();
|
|
3448
3448
|
reject(new MediaPlayerError("decode", `${failureEvent} while loading media`));
|
|
3449
3449
|
};
|
|
3450
3450
|
const handleAbort = () => {
|
|
3451
|
-
dialSdkDebugWarn(DEBUG_MODULE, "waitForElementEvent.handleAbort", "called");
|
|
3451
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "waitForElementEvent.handleAbort", "called");
|
|
3452
3452
|
cleanup();
|
|
3453
3453
|
reject(createAbortError("Aborted", CREATE_ABORT_ERROR_DEBUG));
|
|
3454
3454
|
};
|
|
@@ -3456,7 +3456,7 @@ const waitForElementEvent = (element, successEvent, failureEvent, signal, timeou
|
|
|
3456
3456
|
element.addEventListener(failureEvent, handleFailure, { once: true });
|
|
3457
3457
|
signal.addEventListener("abort", handleAbort, { once: true });
|
|
3458
3458
|
timer = globalThis.setTimeout(() => {
|
|
3459
|
-
dialSdkDebugWarn(DEBUG_MODULE, "waitForElementEvent.timeout", "called", { timeoutMs });
|
|
3459
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "waitForElementEvent.timeout", "called", { timeoutMs });
|
|
3460
3460
|
cleanup();
|
|
3461
3461
|
reject(new MediaPlayerError("timeout", `media load timed out after ${timeoutMs}ms`));
|
|
3462
3462
|
}, timeoutMs);
|
|
@@ -3467,11 +3467,11 @@ const waitForElementEvent = (element, successEvent, failureEvent, signal, timeou
|
|
|
3467
3467
|
reject(error);
|
|
3468
3468
|
}
|
|
3469
3469
|
});
|
|
3470
|
-
result.then(() => dialSdkDebugWarn(DEBUG_MODULE, "waitForElementEvent", "resolved"), (error) => dialSdkDebugWarn(DEBUG_MODULE, "waitForElementEvent", "rejected", error));
|
|
3470
|
+
result.then(() => dialSdkDebugWarn(DEBUG_MODULE$1, "waitForElementEvent", "resolved"), (error) => dialSdkDebugWarn(DEBUG_MODULE$1, "waitForElementEvent", "rejected", error));
|
|
3471
3471
|
return result;
|
|
3472
3472
|
};
|
|
3473
3473
|
const withTimeout = (promise, timeoutMs, signal) => {
|
|
3474
|
-
dialSdkDebugWarn(DEBUG_MODULE, "withTimeout", "called", {
|
|
3474
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "withTimeout", "called", {
|
|
3475
3475
|
promise,
|
|
3476
3476
|
timeoutMs,
|
|
3477
3477
|
signal
|
|
@@ -3479,37 +3479,37 @@ const withTimeout = (promise, timeoutMs, signal) => {
|
|
|
3479
3479
|
const result = new Promise((resolve, reject) => {
|
|
3480
3480
|
let timer;
|
|
3481
3481
|
const cleanup = () => {
|
|
3482
|
-
dialSdkDebugWarn(DEBUG_MODULE, "withTimeout.cleanup", "called", { timer });
|
|
3482
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "withTimeout.cleanup", "called", { timer });
|
|
3483
3483
|
signal.removeEventListener("abort", handleAbort);
|
|
3484
3484
|
if (timer !== void 0) globalThis.clearTimeout(timer);
|
|
3485
|
-
dialSdkDebugWarn(DEBUG_MODULE, "withTimeout.cleanup", "returned");
|
|
3485
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "withTimeout.cleanup", "returned");
|
|
3486
3486
|
};
|
|
3487
3487
|
const handleAbort = () => {
|
|
3488
|
-
dialSdkDebugWarn(DEBUG_MODULE, "withTimeout.handleAbort", "called");
|
|
3488
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "withTimeout.handleAbort", "called");
|
|
3489
3489
|
cleanup();
|
|
3490
3490
|
reject(createAbortError("Aborted", CREATE_ABORT_ERROR_DEBUG));
|
|
3491
3491
|
};
|
|
3492
3492
|
signal.addEventListener("abort", handleAbort, { once: true });
|
|
3493
3493
|
timer = globalThis.setTimeout(() => {
|
|
3494
|
-
dialSdkDebugWarn(DEBUG_MODULE, "withTimeout.timeout", "called", { timeoutMs });
|
|
3494
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "withTimeout.timeout", "called", { timeoutMs });
|
|
3495
3495
|
cleanup();
|
|
3496
3496
|
reject(new MediaPlayerError("timeout", `media load timed out after ${timeoutMs}ms`));
|
|
3497
3497
|
}, timeoutMs);
|
|
3498
3498
|
promise.then((value) => {
|
|
3499
|
-
dialSdkDebugWarn(DEBUG_MODULE, "withTimeout.promiseResolved", "called", { value });
|
|
3499
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "withTimeout.promiseResolved", "called", { value });
|
|
3500
3500
|
cleanup();
|
|
3501
3501
|
resolve(value);
|
|
3502
3502
|
}, (error) => {
|
|
3503
|
-
dialSdkDebugWarn(DEBUG_MODULE, "withTimeout.promiseRejected", "called", { error });
|
|
3503
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "withTimeout.promiseRejected", "called", { error });
|
|
3504
3504
|
cleanup();
|
|
3505
3505
|
reject(error);
|
|
3506
3506
|
});
|
|
3507
3507
|
});
|
|
3508
|
-
result.then((value) => dialSdkDebugWarn(DEBUG_MODULE, "withTimeout", "resolved", { value }), (error) => dialSdkDebugWarn(DEBUG_MODULE, "withTimeout", "rejected", error));
|
|
3508
|
+
result.then((value) => dialSdkDebugWarn(DEBUG_MODULE$1, "withTimeout", "resolved", { value }), (error) => dialSdkDebugWarn(DEBUG_MODULE$1, "withTimeout", "rejected", error));
|
|
3509
3509
|
return result;
|
|
3510
3510
|
};
|
|
3511
3511
|
const defaultTgsRenderer = async (container, animationData, signal) => {
|
|
3512
|
-
dialSdkDebugWarn(DEBUG_MODULE, "defaultTgsRenderer", "called", {
|
|
3512
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "defaultTgsRenderer", "called", {
|
|
3513
3513
|
container,
|
|
3514
3514
|
animationData,
|
|
3515
3515
|
signal
|
|
@@ -3527,27 +3527,27 @@ const defaultTgsRenderer = async (container, animationData, signal) => {
|
|
|
3527
3527
|
});
|
|
3528
3528
|
await new Promise((resolve, reject) => {
|
|
3529
3529
|
const ready = () => {
|
|
3530
|
-
dialSdkDebugWarn(DEBUG_MODULE, "defaultTgsRenderer.ready", "called");
|
|
3530
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "defaultTgsRenderer.ready", "called");
|
|
3531
3531
|
cleanup();
|
|
3532
3532
|
resolve();
|
|
3533
3533
|
};
|
|
3534
3534
|
const failed = () => {
|
|
3535
|
-
dialSdkDebugWarn(DEBUG_MODULE, "defaultTgsRenderer.failed", "called");
|
|
3535
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "defaultTgsRenderer.failed", "called");
|
|
3536
3536
|
cleanup();
|
|
3537
3537
|
reject(new MediaPlayerError("decode", "Lottie could not initialize the TGS animation"));
|
|
3538
3538
|
};
|
|
3539
3539
|
const aborted = () => {
|
|
3540
|
-
dialSdkDebugWarn(DEBUG_MODULE, "defaultTgsRenderer.aborted", "called");
|
|
3540
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "defaultTgsRenderer.aborted", "called");
|
|
3541
3541
|
cleanup();
|
|
3542
3542
|
animation.destroy();
|
|
3543
3543
|
reject(createAbortError("Aborted", CREATE_ABORT_ERROR_DEBUG));
|
|
3544
3544
|
};
|
|
3545
3545
|
const cleanup = () => {
|
|
3546
|
-
dialSdkDebugWarn(DEBUG_MODULE, "defaultTgsRenderer.cleanup", "called");
|
|
3546
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "defaultTgsRenderer.cleanup", "called");
|
|
3547
3547
|
animation.removeEventListener("DOMLoaded", ready);
|
|
3548
3548
|
animation.removeEventListener("data_failed", failed);
|
|
3549
3549
|
signal.removeEventListener("abort", aborted);
|
|
3550
|
-
dialSdkDebugWarn(DEBUG_MODULE, "defaultTgsRenderer.cleanup", "returned");
|
|
3550
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "defaultTgsRenderer.cleanup", "returned");
|
|
3551
3551
|
};
|
|
3552
3552
|
animation.addEventListener("DOMLoaded", ready);
|
|
3553
3553
|
animation.addEventListener("data_failed", failed);
|
|
@@ -3555,27 +3555,27 @@ const defaultTgsRenderer = async (container, animationData, signal) => {
|
|
|
3555
3555
|
});
|
|
3556
3556
|
const result = {
|
|
3557
3557
|
destroy: () => {
|
|
3558
|
-
dialSdkDebugWarn(DEBUG_MODULE, "defaultTgsRenderer.handle.destroy", "called");
|
|
3558
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "defaultTgsRenderer.handle.destroy", "called");
|
|
3559
3559
|
animation.destroy();
|
|
3560
3560
|
},
|
|
3561
3561
|
pause: () => {
|
|
3562
|
-
dialSdkDebugWarn(DEBUG_MODULE, "defaultTgsRenderer.handle.pause", "called");
|
|
3562
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "defaultTgsRenderer.handle.pause", "called");
|
|
3563
3563
|
animation.pause();
|
|
3564
3564
|
},
|
|
3565
3565
|
play: () => {
|
|
3566
|
-
dialSdkDebugWarn(DEBUG_MODULE, "defaultTgsRenderer.handle.play", "called");
|
|
3566
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "defaultTgsRenderer.handle.play", "called");
|
|
3567
3567
|
animation.play();
|
|
3568
3568
|
},
|
|
3569
3569
|
restart: () => {
|
|
3570
|
-
dialSdkDebugWarn(DEBUG_MODULE, "defaultTgsRenderer.handle.restart", "called");
|
|
3570
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "defaultTgsRenderer.handle.restart", "called");
|
|
3571
3571
|
animation.goToAndPlay(0, true);
|
|
3572
3572
|
}
|
|
3573
3573
|
};
|
|
3574
|
-
dialSdkDebugWarn(DEBUG_MODULE, "defaultTgsRenderer", "resolved", { result });
|
|
3574
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "defaultTgsRenderer", "resolved", { result });
|
|
3575
3575
|
return result;
|
|
3576
3576
|
};
|
|
3577
3577
|
function validateTgsAnimation(value, maxLayers) {
|
|
3578
|
-
dialSdkDebugWarn(DEBUG_MODULE, "validateTgsAnimation", "called", {
|
|
3578
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "validateTgsAnimation", "called", {
|
|
3579
3579
|
value,
|
|
3580
3580
|
maxLayers
|
|
3581
3581
|
});
|
|
@@ -3583,10 +3583,10 @@ function validateTgsAnimation(value, maxLayers) {
|
|
|
3583
3583
|
if (value.layers.length > maxLayers) throw new MediaPlayerError("decode", "TGS animation has too many layers");
|
|
3584
3584
|
if (typeof value.fr === "number" && (!Number.isFinite(value.fr) || value.fr <= 0 || value.fr > 120)) throw new MediaPlayerError("decode", "TGS animation frame rate is outside the supported range");
|
|
3585
3585
|
if (typeof value.ip === "number" && typeof value.op === "number" && (value.op <= value.ip || value.op - value.ip > 3e4)) throw new MediaPlayerError("decode", "TGS animation duration is outside the supported range");
|
|
3586
|
-
dialSdkDebugWarn(DEBUG_MODULE, "validateTgsAnimation", "returned");
|
|
3586
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "validateTgsAnimation", "returned");
|
|
3587
3587
|
}
|
|
3588
3588
|
const gunzipWithLimit = (compressed, maxOutputBytes) => {
|
|
3589
|
-
dialSdkDebugWarn(DEBUG_MODULE, "gunzipWithLimit", "called", {
|
|
3589
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "gunzipWithLimit", "called", {
|
|
3590
3590
|
compressed,
|
|
3591
3591
|
maxOutputBytes
|
|
3592
3592
|
});
|
|
@@ -3596,7 +3596,7 @@ const gunzipWithLimit = (compressed, maxOutputBytes) => {
|
|
|
3596
3596
|
let outputBytes = 0;
|
|
3597
3597
|
try {
|
|
3598
3598
|
const gunzip = new Gunzip((chunk) => {
|
|
3599
|
-
dialSdkDebugWarn(DEBUG_MODULE, "gunzipWithLimit.onChunk", "called", {
|
|
3599
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "gunzipWithLimit.onChunk", "called", {
|
|
3600
3600
|
chunk,
|
|
3601
3601
|
outputBytes,
|
|
3602
3602
|
maxOutputBytes
|
|
@@ -3611,10 +3611,10 @@ const gunzipWithLimit = (compressed, maxOutputBytes) => {
|
|
|
3611
3611
|
gunzip.push(compressed.subarray(offset, end), end === compressed.byteLength);
|
|
3612
3612
|
}
|
|
3613
3613
|
} catch (error) {
|
|
3614
|
-
dialSdkDebugWarn(DEBUG_MODULE, "gunzipWithLimit", "caught error", error);
|
|
3614
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "gunzipWithLimit", "caught error", error);
|
|
3615
3615
|
if (error instanceof MediaPlayerError) throw error;
|
|
3616
3616
|
const wrapped = new MediaPlayerError("decode", "TGS gzip decompression failed");
|
|
3617
|
-
dialSdkDebugWarn(DEBUG_MODULE, "gunzipWithLimit", "threw", wrapped);
|
|
3617
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "gunzipWithLimit", "threw", wrapped);
|
|
3618
3618
|
throw wrapped;
|
|
3619
3619
|
}
|
|
3620
3620
|
const output = new Uint8Array(outputBytes);
|
|
@@ -3623,22 +3623,22 @@ const gunzipWithLimit = (compressed, maxOutputBytes) => {
|
|
|
3623
3623
|
output.set(chunk, offset);
|
|
3624
3624
|
offset += chunk.byteLength;
|
|
3625
3625
|
}
|
|
3626
|
-
dialSdkDebugWarn(DEBUG_MODULE, "gunzipWithLimit", "returned", {
|
|
3626
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "gunzipWithLimit", "returned", {
|
|
3627
3627
|
output,
|
|
3628
3628
|
outputBytes
|
|
3629
3629
|
});
|
|
3630
3630
|
return output;
|
|
3631
3631
|
};
|
|
3632
3632
|
const resetVideo = (video) => {
|
|
3633
|
-
dialSdkDebugWarn(DEBUG_MODULE, "resetVideo", "called", { video });
|
|
3633
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "resetVideo", "called", { video });
|
|
3634
3634
|
video.pause();
|
|
3635
3635
|
video.removeAttribute("src");
|
|
3636
3636
|
video.removeAttribute("type");
|
|
3637
3637
|
video.load();
|
|
3638
|
-
dialSdkDebugWarn(DEBUG_MODULE, "resetVideo", "returned", { video });
|
|
3638
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "resetVideo", "returned", { video });
|
|
3639
3639
|
};
|
|
3640
3640
|
const styleMediaElement = (element, fit) => {
|
|
3641
|
-
dialSdkDebugWarn(DEBUG_MODULE, "styleMediaElement", "called", {
|
|
3641
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "styleMediaElement", "called", {
|
|
3642
3642
|
element,
|
|
3643
3643
|
fit
|
|
3644
3644
|
});
|
|
@@ -3650,27 +3650,27 @@ const styleMediaElement = (element, fit) => {
|
|
|
3650
3650
|
objectFit: fit,
|
|
3651
3651
|
width: "100%"
|
|
3652
3652
|
});
|
|
3653
|
-
dialSdkDebugWarn(DEBUG_MODULE, "styleMediaElement", "returned", { element });
|
|
3653
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "styleMediaElement", "returned", { element });
|
|
3654
3654
|
};
|
|
3655
3655
|
const categorizeMediaError = (error) => {
|
|
3656
3656
|
const result = error instanceof MediaPlayerError ? error.category : error instanceof TypeError ? "network" : "decode";
|
|
3657
|
-
dialSdkDebugWarn(DEBUG_MODULE, "categorizeMediaError", "returned", {
|
|
3657
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "categorizeMediaError", "returned", {
|
|
3658
3658
|
error,
|
|
3659
3659
|
result
|
|
3660
3660
|
});
|
|
3661
3661
|
return result;
|
|
3662
3662
|
};
|
|
3663
3663
|
const safeErrorMessage = (error) => {
|
|
3664
|
-
dialSdkDebugWarn(DEBUG_MODULE, "safeErrorMessage", "called", { error });
|
|
3664
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "safeErrorMessage", "called", { error });
|
|
3665
3665
|
const message = error instanceof Error ? error.message : String(error);
|
|
3666
3666
|
const result = redactUrlQueries(message).slice(0, 240);
|
|
3667
|
-
dialSdkDebugWarn(DEBUG_MODULE, "safeErrorMessage", "returned", { result });
|
|
3667
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "safeErrorMessage", "returned", { result });
|
|
3668
3668
|
return result;
|
|
3669
3669
|
};
|
|
3670
3670
|
const redactUrlQueries = (message) => {
|
|
3671
|
-
dialSdkDebugWarn(DEBUG_MODULE, "redactUrlQueries", "called", { message });
|
|
3671
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "redactUrlQueries", "called", { message });
|
|
3672
3672
|
const result = message.replace(/https:\/\/[^\s"'<>]+/gu, (candidate) => {
|
|
3673
|
-
dialSdkDebugWarn(DEBUG_MODULE, "redactUrlQueries.replace", "called", { candidate });
|
|
3673
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "redactUrlQueries.replace", "called", { candidate });
|
|
3674
3674
|
try {
|
|
3675
3675
|
const url = new URL(candidate);
|
|
3676
3676
|
return `${url.origin}${url.pathname}`;
|
|
@@ -3678,17 +3678,311 @@ const redactUrlQueries = (message) => {
|
|
|
3678
3678
|
return "[url]";
|
|
3679
3679
|
}
|
|
3680
3680
|
});
|
|
3681
|
-
dialSdkDebugWarn(DEBUG_MODULE, "redactUrlQueries", "returned", { result });
|
|
3681
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "redactUrlQueries", "returned", { result });
|
|
3682
3682
|
return result;
|
|
3683
3683
|
};
|
|
3684
3684
|
const safeDestroy = (handle) => {
|
|
3685
|
-
dialSdkDebugWarn(DEBUG_MODULE, "safeDestroy", "called", { handle });
|
|
3685
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "safeDestroy", "called", { handle });
|
|
3686
3686
|
try {
|
|
3687
3687
|
handle.destroy();
|
|
3688
|
-
dialSdkDebugWarn(DEBUG_MODULE, "safeDestroy", "returned");
|
|
3688
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "safeDestroy", "returned");
|
|
3689
3689
|
} catch (error) {
|
|
3690
|
-
dialSdkDebugWarn(DEBUG_MODULE, "safeDestroy", "destroy threw", error);
|
|
3690
|
+
dialSdkDebugWarn(DEBUG_MODULE$1, "safeDestroy", "destroy threw", error);
|
|
3691
|
+
}
|
|
3692
|
+
};
|
|
3693
|
+
//#endregion
|
|
3694
|
+
//#region src/bridge/native_multimedia_bridge.ts
|
|
3695
|
+
const getAndroidCarBridge = () => window.AndroidCarBridge;
|
|
3696
|
+
const resolveNativeMultimediaBridgeProtocol = () => {
|
|
3697
|
+
return typeof getAndroidCarBridge().onBridgeLifecycle === "function" ? "lifecycle" : "legacy";
|
|
3698
|
+
};
|
|
3699
|
+
const notifyNativeMultimediaBridgeReady = (instanceId, protocol) => {
|
|
3700
|
+
const bridge = getAndroidCarBridge();
|
|
3701
|
+
const version = `dial-sdk@0.0.17`;
|
|
3702
|
+
if (protocol === "lifecycle" && typeof bridge.onBridgeLifecycle === "function") {
|
|
3703
|
+
bridge.onBridgeLifecycle(JSON.stringify({
|
|
3704
|
+
event: "ready",
|
|
3705
|
+
instanceId,
|
|
3706
|
+
version
|
|
3707
|
+
}));
|
|
3708
|
+
return;
|
|
3709
|
+
}
|
|
3710
|
+
bridge.onBridgeReady(version);
|
|
3711
|
+
};
|
|
3712
|
+
const notifyNativeMultimediaBridgeDestroyed = (instanceId, protocol) => {
|
|
3713
|
+
if (protocol !== "lifecycle") return;
|
|
3714
|
+
const bridge = getAndroidCarBridge();
|
|
3715
|
+
if (typeof bridge.onBridgeLifecycle !== "function") return;
|
|
3716
|
+
bridge.onBridgeLifecycle(JSON.stringify({
|
|
3717
|
+
event: "destroyed",
|
|
3718
|
+
instanceId
|
|
3719
|
+
}));
|
|
3720
|
+
};
|
|
3721
|
+
const reportNativeMultimediaState = (state) => {
|
|
3722
|
+
getAndroidCarBridge().onPlayerState(JSON.stringify({
|
|
3723
|
+
isPlaying: state.isPlaying,
|
|
3724
|
+
title: state.title,
|
|
3725
|
+
artist: state.artist,
|
|
3726
|
+
canNext: state.canNext,
|
|
3727
|
+
canPrevious: state.canPrevious
|
|
3728
|
+
}));
|
|
3729
|
+
};
|
|
3730
|
+
const logNativeMultimediaBridge = (level, message) => {
|
|
3731
|
+
try {
|
|
3732
|
+
getAndroidCarBridge().log(level, message);
|
|
3733
|
+
return true;
|
|
3734
|
+
} catch {
|
|
3735
|
+
return false;
|
|
3736
|
+
}
|
|
3737
|
+
};
|
|
3738
|
+
//#endregion
|
|
3739
|
+
//#region src/multimedia/multimedia_controller.ts
|
|
3740
|
+
const DEBUG_MODULE = "multimedia_controller.ts";
|
|
3741
|
+
const DEFAULT_REPORT_INTERVAL_MS = 1e3;
|
|
3742
|
+
const REPORT_INTERVAL_DEBUG = {
|
|
3743
|
+
moduleName: DEBUG_MODULE,
|
|
3744
|
+
scope: "reportIntervalMs"
|
|
3745
|
+
};
|
|
3746
|
+
var MultimediaBridgeError = class extends Error {
|
|
3747
|
+
constructor(code, message, cause) {
|
|
3748
|
+
super(message);
|
|
3749
|
+
this.name = "MultimediaBridgeError";
|
|
3750
|
+
this.code = code;
|
|
3751
|
+
this.cause = cause;
|
|
3752
|
+
}
|
|
3753
|
+
};
|
|
3754
|
+
let activeController = null;
|
|
3755
|
+
let multimediaBridgeInstanceSequence = 0;
|
|
3756
|
+
const createMultimediaBridgeInstanceId = () => {
|
|
3757
|
+
multimediaBridgeInstanceSequence += 1;
|
|
3758
|
+
return `media-${Date.now().toString(36)}-${multimediaBridgeInstanceSequence.toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
|
|
3759
|
+
};
|
|
3760
|
+
const createMultimediaController = (options) => {
|
|
3761
|
+
dialSdkDebugWarn(DEBUG_MODULE, "createMultimediaController", "called", { options });
|
|
3762
|
+
const controller = new MultimediaController(options);
|
|
3763
|
+
dialSdkDebugWarn(DEBUG_MODULE, "createMultimediaController", "returned");
|
|
3764
|
+
return controller;
|
|
3765
|
+
};
|
|
3766
|
+
var MultimediaController = class {
|
|
3767
|
+
constructor(options) {
|
|
3768
|
+
this.bridgeInstanceId = createMultimediaBridgeInstanceId();
|
|
3769
|
+
this.reportTimer = null;
|
|
3770
|
+
this.bridgeProtocol = null;
|
|
3771
|
+
this.lastKnownState = {
|
|
3772
|
+
isPlaying: false,
|
|
3773
|
+
title: "",
|
|
3774
|
+
artist: "",
|
|
3775
|
+
canNext: false,
|
|
3776
|
+
canPrevious: false
|
|
3777
|
+
};
|
|
3778
|
+
this.destroyed = false;
|
|
3779
|
+
this.handleMediaCommand = (event) => {
|
|
3780
|
+
if (this.destroyed) return;
|
|
3781
|
+
const detail = event.detail;
|
|
3782
|
+
if (!detail || typeof detail !== "object") return;
|
|
3783
|
+
const command = detail.command;
|
|
3784
|
+
if (!this.isMultimediaCommand(command)) return;
|
|
3785
|
+
if (command === "seekToMs") this.dispatchControl(command, detail.positionMs);
|
|
3786
|
+
else this.dispatchControl(command);
|
|
3787
|
+
};
|
|
3788
|
+
this.handleMediaStateRequest = () => {
|
|
3789
|
+
this.reportState();
|
|
3790
|
+
};
|
|
3791
|
+
dialSdkDebugWarn(DEBUG_MODULE, "MultimediaController.constructor", "called", { options });
|
|
3792
|
+
if (activeController !== null) {
|
|
3793
|
+
const error = new MultimediaBridgeError("MULTIMEDIA_BRIDGE_CONFLICT", "A multimedia controller is already active in this window");
|
|
3794
|
+
dialSdkDebugWarn(DEBUG_MODULE, "MultimediaController.constructor", "threw", error);
|
|
3795
|
+
throw error;
|
|
3796
|
+
}
|
|
3797
|
+
this.assertOptions(options);
|
|
3798
|
+
this.runtimeWindow = window;
|
|
3799
|
+
if ("__carBridge" in this.runtimeWindow) {
|
|
3800
|
+
const error = new MultimediaBridgeError("MULTIMEDIA_BRIDGE_CONFLICT", "window.__carBridge already exists; destroy the existing media bridge before creating a controller");
|
|
3801
|
+
dialSdkDebugWarn(DEBUG_MODULE, "MultimediaController.constructor", "threw", error);
|
|
3802
|
+
throw error;
|
|
3803
|
+
}
|
|
3804
|
+
this.getStateProvider = options.getState;
|
|
3805
|
+
this.controls = options.controls;
|
|
3806
|
+
this.reportIntervalMs = requirePositiveFinite("reportIntervalMs", options.reportIntervalMs ?? DEFAULT_REPORT_INTERVAL_MS, REPORT_INTERVAL_DEBUG);
|
|
3807
|
+
this.runtimeBridge = {
|
|
3808
|
+
play: () => this.dispatchControl("play"),
|
|
3809
|
+
pause: () => this.dispatchControl("pause"),
|
|
3810
|
+
toggle: () => this.dispatchControl("toggle"),
|
|
3811
|
+
next: () => this.dispatchControl("next"),
|
|
3812
|
+
previous: () => this.dispatchControl("previous"),
|
|
3813
|
+
seekToMs: (positionMs) => this.dispatchControl("seekToMs", positionMs),
|
|
3814
|
+
getState: () => this.readState()
|
|
3815
|
+
};
|
|
3816
|
+
activeController = this;
|
|
3817
|
+
try {
|
|
3818
|
+
const initialState = this.readState();
|
|
3819
|
+
this.lastKnownState = initialState;
|
|
3820
|
+
this.runtimeWindow.__carBridge = this.runtimeBridge;
|
|
3821
|
+
this.runtimeWindow.addEventListener("toooony:media-command", this.handleMediaCommand);
|
|
3822
|
+
this.runtimeWindow.addEventListener("toooony:media-state-request", this.handleMediaStateRequest);
|
|
3823
|
+
this.bridgeProtocol = resolveNativeMultimediaBridgeProtocol();
|
|
3824
|
+
notifyNativeMultimediaBridgeReady(this.bridgeInstanceId, this.bridgeProtocol);
|
|
3825
|
+
logNativeMultimediaBridge("INFO", "Dial SDK multimedia bridge initialized");
|
|
3826
|
+
this.reportInitialState(initialState);
|
|
3827
|
+
} catch (error) {
|
|
3828
|
+
if (activeController === this) activeController = null;
|
|
3829
|
+
this.closeNativeBridge();
|
|
3830
|
+
this.cleanupInstalledResources();
|
|
3831
|
+
const wrapped = new MultimediaBridgeError("MULTIMEDIA_BRIDGE_INITIALIZATION_FAILED", "Failed to initialize the multimedia bridge", error);
|
|
3832
|
+
dialSdkDebugWarn(DEBUG_MODULE, "MultimediaController.constructor", "threw", wrapped);
|
|
3833
|
+
throw wrapped;
|
|
3834
|
+
}
|
|
3835
|
+
dialSdkDebugWarn(DEBUG_MODULE, "MultimediaController.constructor", "created", { reportIntervalMs: this.reportIntervalMs });
|
|
3836
|
+
}
|
|
3837
|
+
reportState() {
|
|
3838
|
+
dialSdkDebugWarn(DEBUG_MODULE, "MultimediaController.reportState", "called");
|
|
3839
|
+
if (this.destroyed) {
|
|
3840
|
+
dialSdkDebugWarn(DEBUG_MODULE, "MultimediaController.reportState", "ignored after destroy");
|
|
3841
|
+
return false;
|
|
3842
|
+
}
|
|
3843
|
+
try {
|
|
3844
|
+
const state = this.readState();
|
|
3845
|
+
this.lastKnownState = state;
|
|
3846
|
+
this.syncHeartbeat(state.isPlaying);
|
|
3847
|
+
reportNativeMultimediaState(state);
|
|
3848
|
+
dialSdkDebugWarn(DEBUG_MODULE, "MultimediaController.reportState", "returned", {
|
|
3849
|
+
result: true,
|
|
3850
|
+
state
|
|
3851
|
+
});
|
|
3852
|
+
return true;
|
|
3853
|
+
} catch (error) {
|
|
3854
|
+
this.reportFailure("state report failed", error);
|
|
3855
|
+
dialSdkDebugWarn(DEBUG_MODULE, "MultimediaController.reportState", "returned", { result: false });
|
|
3856
|
+
return false;
|
|
3857
|
+
}
|
|
3858
|
+
}
|
|
3859
|
+
destroy() {
|
|
3860
|
+
dialSdkDebugWarn(DEBUG_MODULE, "MultimediaController.destroy", "called", { destroyed: this.destroyed });
|
|
3861
|
+
if (this.destroyed) {
|
|
3862
|
+
dialSdkDebugWarn(DEBUG_MODULE, "MultimediaController.destroy", "ignored");
|
|
3863
|
+
return;
|
|
3864
|
+
}
|
|
3865
|
+
this.destroyed = true;
|
|
3866
|
+
this.closeNativeBridge();
|
|
3867
|
+
this.cleanupInstalledResources();
|
|
3868
|
+
if (activeController === this) activeController = null;
|
|
3869
|
+
logNativeMultimediaBridge("INFO", "Dial SDK multimedia bridge destroyed");
|
|
3870
|
+
dialSdkDebugWarn(DEBUG_MODULE, "MultimediaController.destroy", "returned");
|
|
3871
|
+
}
|
|
3872
|
+
assertOptions(options) {
|
|
3873
|
+
if (!options || typeof options !== "object") throw new TypeError("options must be an object");
|
|
3874
|
+
if (typeof options.getState !== "function") throw new TypeError("getState must be a function");
|
|
3875
|
+
if (!options.controls || typeof options.controls !== "object") throw new TypeError("controls must be an object");
|
|
3876
|
+
if (typeof options.controls.play !== "function") throw new TypeError("controls.play must be a function");
|
|
3877
|
+
if (typeof options.controls.pause !== "function") throw new TypeError("controls.pause must be a function");
|
|
3878
|
+
for (const name of [
|
|
3879
|
+
"toggle",
|
|
3880
|
+
"next",
|
|
3881
|
+
"previous",
|
|
3882
|
+
"seekToMs"
|
|
3883
|
+
]) {
|
|
3884
|
+
const control = options.controls[name];
|
|
3885
|
+
if (control !== void 0 && typeof control !== "function") throw new TypeError(`controls.${name} must be a function when provided`);
|
|
3886
|
+
}
|
|
3887
|
+
}
|
|
3888
|
+
readState() {
|
|
3889
|
+
const state = this.getStateProvider();
|
|
3890
|
+
if (!state || typeof state !== "object") throw new TypeError("getState must return a multimedia player state");
|
|
3891
|
+
if (typeof state.isPlaying !== "boolean") throw new TypeError("state.isPlaying must be a boolean");
|
|
3892
|
+
if (typeof state.title !== "string") throw new TypeError("state.title must be a string");
|
|
3893
|
+
if (typeof state.artist !== "string") throw new TypeError("state.artist must be a string");
|
|
3894
|
+
if (typeof state.canNext !== "boolean") throw new TypeError("state.canNext must be a boolean");
|
|
3895
|
+
if (typeof state.canPrevious !== "boolean") throw new TypeError("state.canPrevious must be a boolean");
|
|
3896
|
+
return {
|
|
3897
|
+
isPlaying: state.isPlaying,
|
|
3898
|
+
title: state.title,
|
|
3899
|
+
artist: state.artist,
|
|
3900
|
+
canNext: state.canNext,
|
|
3901
|
+
canPrevious: state.canPrevious
|
|
3902
|
+
};
|
|
3903
|
+
}
|
|
3904
|
+
reportInitialState(state) {
|
|
3905
|
+
this.syncHeartbeat(state.isPlaying);
|
|
3906
|
+
reportNativeMultimediaState(state);
|
|
3907
|
+
}
|
|
3908
|
+
dispatchControl(command, rawPositionMs) {
|
|
3909
|
+
if (this.destroyed) return;
|
|
3910
|
+
dialSdkDebugWarn(DEBUG_MODULE, "MultimediaController.dispatchControl", "called", {
|
|
3911
|
+
command,
|
|
3912
|
+
positionMs: rawPositionMs
|
|
3913
|
+
});
|
|
3914
|
+
try {
|
|
3915
|
+
let result;
|
|
3916
|
+
switch (command) {
|
|
3917
|
+
case "play":
|
|
3918
|
+
result = this.controls.play();
|
|
3919
|
+
break;
|
|
3920
|
+
case "pause":
|
|
3921
|
+
result = this.controls.pause();
|
|
3922
|
+
break;
|
|
3923
|
+
case "toggle":
|
|
3924
|
+
result = this.controls.toggle ? this.controls.toggle() : this.readState().isPlaying ? this.controls.pause() : this.controls.play();
|
|
3925
|
+
break;
|
|
3926
|
+
case "next":
|
|
3927
|
+
result = this.controls.next?.();
|
|
3928
|
+
break;
|
|
3929
|
+
case "previous":
|
|
3930
|
+
result = this.controls.previous?.();
|
|
3931
|
+
break;
|
|
3932
|
+
case "seekToMs":
|
|
3933
|
+
if (typeof rawPositionMs !== "number" || !Number.isFinite(rawPositionMs) || rawPositionMs < 0) {
|
|
3934
|
+
this.reportFailure("ignored invalid seekToMs position", rawPositionMs);
|
|
3935
|
+
return;
|
|
3936
|
+
}
|
|
3937
|
+
result = this.controls.seekToMs?.(rawPositionMs);
|
|
3938
|
+
break;
|
|
3939
|
+
}
|
|
3940
|
+
Promise.resolve(result).then(() => {
|
|
3941
|
+
if (!this.destroyed) this.reportState();
|
|
3942
|
+
}, (error) => this.reportFailure(`media command ${command} failed`, error));
|
|
3943
|
+
} catch (error) {
|
|
3944
|
+
this.reportFailure(`media command ${command} failed`, error);
|
|
3945
|
+
}
|
|
3946
|
+
}
|
|
3947
|
+
syncHeartbeat(isPlaying) {
|
|
3948
|
+
if (isPlaying) {
|
|
3949
|
+
if (this.reportTimer === null) this.reportTimer = globalThis.setInterval(() => this.reportState(), this.reportIntervalMs);
|
|
3950
|
+
return;
|
|
3951
|
+
}
|
|
3952
|
+
this.stopHeartbeat();
|
|
3953
|
+
}
|
|
3954
|
+
stopHeartbeat() {
|
|
3955
|
+
if (this.reportTimer === null) return;
|
|
3956
|
+
globalThis.clearInterval(this.reportTimer);
|
|
3957
|
+
this.reportTimer = null;
|
|
3958
|
+
}
|
|
3959
|
+
cleanupInstalledResources() {
|
|
3960
|
+
this.stopHeartbeat();
|
|
3961
|
+
this.runtimeWindow.removeEventListener("toooony:media-command", this.handleMediaCommand);
|
|
3962
|
+
this.runtimeWindow.removeEventListener("toooony:media-state-request", this.handleMediaStateRequest);
|
|
3963
|
+
if (this.runtimeWindow.__carBridge === this.runtimeBridge) Reflect.deleteProperty(this.runtimeWindow, "__carBridge");
|
|
3964
|
+
}
|
|
3965
|
+
closeNativeBridge() {
|
|
3966
|
+
const protocol = this.bridgeProtocol;
|
|
3967
|
+
if (protocol === null) return;
|
|
3968
|
+
this.bridgeProtocol = null;
|
|
3969
|
+
try {
|
|
3970
|
+
if (protocol === "lifecycle") notifyNativeMultimediaBridgeDestroyed(this.bridgeInstanceId, protocol);
|
|
3971
|
+
else reportNativeMultimediaState({
|
|
3972
|
+
...this.lastKnownState,
|
|
3973
|
+
isPlaying: false
|
|
3974
|
+
});
|
|
3975
|
+
} catch (error) {
|
|
3976
|
+
this.reportFailure("media bridge destroy notification failed", error);
|
|
3977
|
+
}
|
|
3978
|
+
}
|
|
3979
|
+
reportFailure(message, error) {
|
|
3980
|
+
dialSdkDebugWarn(DEBUG_MODULE, "MultimediaController", message, { error });
|
|
3981
|
+
logNativeMultimediaBridge("ERROR", `${message}: ${error instanceof Error ? `${error.name}: ${error.message}` : String(error)}`);
|
|
3982
|
+
}
|
|
3983
|
+
isMultimediaCommand(value) {
|
|
3984
|
+
return value === "play" || value === "pause" || value === "toggle" || value === "next" || value === "previous" || value === "seekToMs";
|
|
3691
3985
|
}
|
|
3692
3986
|
};
|
|
3693
3987
|
//#endregion
|
|
3694
|
-
export { BATTERY_HEALTH_LABELS, CAR_RUNNING_LABELS, CAR_RUNNING_STATUSES, CAR_RUNNING_STATUS_PRIORITY, DEFAULT_DRIVING_STATUS_TUNING, DrivingExpressionResolutionError, DrivingExpressionsConfigError, OFFICIAL_DRIVING_EXPRESSIONS_CONFIG, OFFICIAL_DRIVING_EXPRESSION_FALLBACKS, buildVehicleFrame, classifyDrivingSnapshot, createDrivingExpressionPlayer, createDrivingStatusController, extractDrivingSnapshotMetrics, isPublicDrivingMediaUrl, parseDrivingExpressionsConfig, readDrivingExpressionsConfig, resolveDrivingExpression, resolveDrivingExpressionStrict, resolveDrivingStatusTuning, tryParseDrivingExpressionsConfig, unifiedSensorInfo, waitForDrivingExpressionsConfig };
|
|
3988
|
+
export { BATTERY_HEALTH_LABELS, CAR_RUNNING_LABELS, CAR_RUNNING_STATUSES, CAR_RUNNING_STATUS_PRIORITY, DEFAULT_DRIVING_STATUS_TUNING, DrivingExpressionResolutionError, DrivingExpressionsConfigError, DrivingStatusController, MultimediaBridgeError, MultimediaController, OFFICIAL_DRIVING_EXPRESSIONS_CONFIG, OFFICIAL_DRIVING_EXPRESSION_FALLBACKS, buildVehicleFrame, classifyDrivingSnapshot, createDrivingExpressionPlayer, createDrivingStatusController, createMultimediaController, extractDrivingSnapshotMetrics, isPublicDrivingMediaUrl, parseDrivingExpressionsConfig, readDrivingExpressionsConfig, resolveDrivingExpression, resolveDrivingExpressionStrict, resolveDrivingStatusTuning, tryParseDrivingExpressionsConfig, unifiedSensorInfo, waitForDrivingExpressionsConfig };
|