decord/source/4069_useRive.js

114 lines
3.2 KiB
JavaScript
Raw Normal View History

2026-08-08 06:10:11 +00:00
// Module ID: 4069
// Function ID: 4070
2026-07-20 16:05:17 +00:00
// Name: useRive
2026-08-08 06:10:11 +00:00
// Dependencies: [32, 19, 4058]
2026-07-20 16:05:17 +00:00
// Exports: useRive
2026-08-08 06:10:11 +00:00
// Module 4069 (useRive)
2026-07-23 10:11:24 +00:00
import _slicedToArray from "_slicedToArray";
2026-07-29 08:29:29 +00:00
import noop from "noop";
2026-07-23 10:11:24 +00:00
2026-07-29 08:29:29 +00:00
let c3;
let c4;
2026-07-20 16:05:17 +00:00
let useCallback;
2026-07-23 10:11:24 +00:00
let require = arg1;
2026-07-29 08:29:29 +00:00
({ useRef: c3, useCallback, useState: c4 } = noop);
2026-07-20 16:05:17 +00:00
export const useRive = function useRive() {
2026-07-29 08:29:29 +00:00
let dependencyMap;
let tmp4;
2026-08-08 06:10:11 +00:00
let obj = require(4058) /* c */;
2026-07-20 16:05:17 +00:00
const cResult = obj.c(4);
2026-07-29 08:29:29 +00:00
const tmp2 = callback2(null);
2026-07-23 10:11:24 +00:00
require = tmp2;
2026-07-29 08:29:29 +00:00
[tmp4, dependencyMap] = callback(callback3(null), 2);
2026-07-23 10:11:24 +00:00
callback = callback2(null);
2026-07-20 16:05:17 +00:00
if (cResult[0] === Symbol.for("react.memo_cache_sentinel")) {
2026-07-29 08:29:29 +00:00
const fn = function t(current) {
if (current.current !== current) {
2026-07-20 16:05:17 +00:00
tmp2.current = current;
if (ref.current) {
2026-07-23 10:11:24 +00:00
let _clearTimeout = clearTimeout;
2026-07-29 08:29:29 +00:00
clearTimeout(tmp11.current);
2026-07-20 16:05:17 +00:00
}
const promise = new Promise((arg0, arg1) => {
2026-07-23 10:11:24 +00:00
let closure_0 = arg1;
2026-07-29 08:29:29 +00:00
_slicedToArray.current = setTimeout(() => {
2026-07-20 16:05:17 +00:00
const error = new Error("Rive view ready timeout");
2026-07-23 10:11:24 +00:00
callback(error);
2026-07-20 16:05:17 +00:00
}, 5000);
});
let awaitViewReadyResult;
2026-07-29 08:29:29 +00:00
if (current != null) {
2026-07-20 16:05:17 +00:00
awaitViewReadyResult = current.awaitViewReady();
}
const items = [awaitViewReadyResult, promise];
const racePromise = Promise.race(items);
const nextPromise = Promise.race(items).then((arg0) => {
if (true === arg0) {
2026-07-23 10:11:24 +00:00
outer1_1(closure_0);
2026-07-20 16:05:17 +00:00
} else {
const _console = console;
console.warn("Rive view ready check returned false");
2026-07-23 10:11:24 +00:00
outer1_1(null);
2026-07-20 16:05:17 +00:00
}
});
Promise.race(items).then((arg0) => {
if (true === arg0) {
2026-07-23 10:11:24 +00:00
outer1_1(closure_0);
2026-07-20 16:05:17 +00:00
} else {
const _console = console;
console.warn("Rive view ready check returned false");
2026-07-23 10:11:24 +00:00
outer1_1(null);
2026-07-20 16:05:17 +00:00
}
}).catch((arg0) => {
console.warn("Failed to initialize Rive view:", arg0);
2026-07-29 08:29:29 +00:00
callback(null);
2026-07-20 16:05:17 +00:00
}).finally(() => {
2026-07-29 08:29:29 +00:00
if (ref.current) {
2026-07-20 16:05:17 +00:00
const _clearTimeout = clearTimeout;
2026-07-29 08:29:29 +00:00
clearTimeout(tmp.current);
tmp.current = null;
2026-07-20 16:05:17 +00:00
}
});
const catchPromise = Promise.race(items).then((arg0) => {
if (true === arg0) {
2026-07-23 10:11:24 +00:00
outer1_1(closure_0);
2026-07-20 16:05:17 +00:00
} else {
const _console = console;
console.warn("Rive view ready check returned false");
2026-07-23 10:11:24 +00:00
outer1_1(null);
2026-07-20 16:05:17 +00:00
}
}).catch((arg0) => {
console.warn("Failed to initialize Rive view:", arg0);
2026-07-29 08:29:29 +00:00
callback(null);
2026-07-20 16:05:17 +00:00
});
}
2026-07-29 08:29:29 +00:00
};
cResult[0] = fn;
let first = fn;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
first = cResult[0];
2026-07-20 16:05:17 +00:00
}
if (cResult[1] === Symbol.for("react.memo_cache_sentinel")) {
2026-07-29 08:29:29 +00:00
obj = { f: null };
obj[0] = first;
2026-07-20 16:05:17 +00:00
cResult[1] = obj;
let tmp6 = obj;
} else {
tmp6 = cResult[1];
}
2026-07-29 08:29:29 +00:00
if (cResult[2] !== tmp4) {
obj = { riveRef: null, riveViewRef: null, setHybridRef: null };
obj[0] = tmp2;
obj[1] = tmp4;
obj[2] = tmp6;
cResult[2] = tmp4;
2026-07-20 16:05:17 +00:00
cResult[3] = obj;
let tmp7 = obj;
} else {
tmp7 = cResult[3];
}
return tmp7;
};