decord/source/modules/quests/VideoQuestUIStore.tsx

141 lines
4.7 KiB
TypeScript
Raw Normal View History

2026-07-25 08:10:48 +00:00
// Module ID: 5934
2026-07-27 11:26:19 +00:00
// Function ID: 52819
2026-07-20 16:05:17 +00:00
// Name: _toPropertyKey
2026-07-25 08:10:48 +00:00
// Dependencies: [29, 677, 4000, 5935, 682, 5936, 2]
2026-07-20 16:05:17 +00:00
2026-07-25 08:10:48 +00:00
// Module 5934 (_toPropertyKey)
2026-07-23 10:11:24 +00:00
import _objectWithoutProperties from "_objectWithoutProperties";
import useStoreWithEqualityFn from "useStoreWithEqualityFn";
import createJSONStorage from "createJSONStorage";
import createJSONStorage from "createJSONStorage";
const require = arg1;
2026-07-20 16:05:17 +00:00
function _toPropertyKey(arg0) {
let StringResult = arg0;
if ("object" === typeof arg0) {
StringResult = arg0;
if (arg0) {
const _Symbol = Symbol;
if (undefined !== arg0[Symbol.toPrimitive]) {
const callResult = obj.call(arg0, "string");
StringResult = callResult;
if ("object" === typeof callResult) {
const _TypeError = TypeError;
const typeError = new TypeError("@@toPrimitive must return a primitive value.");
throw typeError;
}
} else {
const _String = String;
StringResult = String(arg0);
}
}
}
let text = StringResult;
if ("symbol" !== typeof StringResult) {
text = `${tmp}`;
}
return text;
}
let obj = { UNKNOWN: "UNKNOWN", NOT_STARTED: "NOT_STARTED", IN_PROGRESS: "IN_PROGRESS", COMPLETED: "COMPLETED" };
2026-07-23 10:11:24 +00:00
useStoreWithEqualityFn = useStoreWithEqualityFn.createWithEqualityFn();
2026-07-20 16:05:17 +00:00
obj = { name: "videoQuestUIState" };
2026-07-25 08:10:48 +00:00
obj.storage = createJSONStorage.createJSONStorage(() => importDefault(5936));
2026-07-20 16:05:17 +00:00
obj.partialize = function partialize(volume) {
return { volume: volume.volume, muted: volume.muted, videoProgress: volume.videoProgress };
};
obj.version = 0;
2026-07-23 10:11:24 +00:00
const withEqualityFnResult = useStoreWithEqualityFn(createJSONStorage.persist((arg0, arg1) => {
const _require = arg0;
let closure_1 = arg1;
let obj = {
2026-07-25 08:10:48 +00:00
volume: _require(5935).DEFAULT_VIDEO_VOLUME,
2026-07-23 10:11:24 +00:00
muted: false,
transcriptEnabled: false,
captionEnabled: false,
2026-07-20 16:05:17 +00:00
videoProgress: {},
2026-07-23 10:11:24 +00:00
transcript: null,
2026-07-20 16:05:17 +00:00
setVolume(arg0) {
2026-07-23 10:11:24 +00:00
const callback = arg0;
callback(outer1_2[4]).batchUpdates(() => callback({ volume: callback }));
2026-07-20 16:05:17 +00:00
},
setMuted(arg0) {
2026-07-23 10:11:24 +00:00
const callback = arg0;
callback(outer1_2[4]).batchUpdates(() => callback({ muted: callback }));
2026-07-20 16:05:17 +00:00
},
setVideoProgress(arg0, arg1, arg2) {
2026-07-23 10:11:24 +00:00
const callback = arg0;
const callback2 = arg1;
let closure_2 = arg2;
const tmp = callback2().videoProgress[arg0];
2026-07-20 16:05:17 +00:00
let maxTimestampSec;
if (null != tmp) {
maxTimestampSec = tmp.maxTimestampSec;
}
let num = 0;
if (null != maxTimestampSec) {
num = maxTimestampSec;
}
2026-07-23 10:11:24 +00:00
let _objectWithoutProperties = Math.max(num, arg1);
callback(outer1_2[4]).batchUpdates(() => {
2026-07-20 16:05:17 +00:00
let obj = {};
obj = {};
2026-07-23 10:11:24 +00:00
const merged = Object.assign(callback2().videoProgress);
obj = { timestampSec: callback2, duration: closure_2, maxTimestampSec: _objectWithoutProperties };
obj[callback] = obj;
2026-07-20 16:05:17 +00:00
obj.videoProgress = obj;
2026-07-23 10:11:24 +00:00
return callback(obj);
2026-07-20 16:05:17 +00:00
});
},
setTranscriptEnabled(arg0) {
2026-07-23 10:11:24 +00:00
const callback = arg0;
callback(outer1_2[4]).batchUpdates(() => callback({ transcriptEnabled: callback }));
2026-07-20 16:05:17 +00:00
},
setCaptionEnabled(arg0) {
2026-07-23 10:11:24 +00:00
const callback = arg0;
callback(outer1_2[4]).batchUpdates(() => callback({ captionEnabled: callback }));
2026-07-20 16:05:17 +00:00
},
getVideoProgress(questId) {
2026-07-23 10:11:24 +00:00
return callback2().videoProgress[questId];
2026-07-20 16:05:17 +00:00
},
getVideoProgressState(arg0) {
2026-07-23 10:11:24 +00:00
const tmp = callback2().videoProgress[arg0];
2026-07-20 16:05:17 +00:00
if (null == tmp) {
2026-07-23 10:11:24 +00:00
let IN_PROGRESS = outer1_4.UNKNOWN;
2026-07-20 16:05:17 +00:00
} else if (0 === tmp.timestampSec) {
2026-07-23 10:11:24 +00:00
IN_PROGRESS = outer1_4.NOT_STARTED;
2026-07-20 16:05:17 +00:00
} else if (tmp.timestampSec >= tmp.duration) {
2026-07-23 10:11:24 +00:00
IN_PROGRESS = outer1_4.COMPLETED;
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
IN_PROGRESS = outer1_4.IN_PROGRESS;
2026-07-20 16:05:17 +00:00
}
return IN_PROGRESS;
},
resetQuest(questId) {
2026-07-23 10:11:24 +00:00
const callback = questId;
callback(outer1_2[4]).batchUpdates(() => {
const items = [questId];
questId({ videoProgress: outer2_3(outer1_1().videoProgress, items.map(outer2_5)) });
2026-07-20 16:05:17 +00:00
});
},
clearState() {
2026-07-23 10:11:24 +00:00
callback(outer1_2[4]).batchUpdates(() => {
outer1_0({ videoProgress: {} });
2026-07-20 16:05:17 +00:00
});
},
setTranscriptAsset(arg0) {
2026-07-23 10:11:24 +00:00
const callback = arg0;
callback(outer1_2[4]).batchUpdates(() => {
callback({ transcript: callback });
2026-07-20 16:05:17 +00:00
});
}
};
2026-07-23 10:11:24 +00:00
return obj;
2026-07-20 16:05:17 +00:00
}, obj));
2026-07-23 10:11:24 +00:00
const result = require("createJSONStorage").fileFinishedImporting("modules/quests/VideoQuestUIStore.tsx");
2026-07-20 16:05:17 +00:00
export default withEqualityFnResult;
2026-07-23 10:11:24 +00:00
export const DEFAULT_VIDEO_PROGRESS = { timestampSec: 0, duration: 10, maxTimestampSec: 0 };
2026-07-20 16:05:17 +00:00
export const VideoProgressState = obj;
export const FetchStatus = { NONE: "NONE", FETCHING: "FETCHING", SUCCESS: "SUCCESS", FAILURE: "FAILURE" };
export const useVideoQuestUIStore = withEqualityFnResult;