Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function init(editorState) {
return Most.drain(Most.map((function (editEngineState) {
StateEngineService$WonderEditor.setIsDebug(true);
var match = GameObjectEngineService$WonderEditor.create(editEngineState);
var scene = match[1];
var match$1 = DefaultSceneUtils$WonderEditor.prepareSpecificGameObjectsForEditEngineState(scene, match[0]);
var match$2 = DefaultSceneUtils$WonderEditor.computeDiffValue(editorState, match$1[0]);
var match$3 = DefaultSceneUtils$WonderEditor.createDefaultScene(scene, match$2[1]);
var editEngineState$1 = DirectorEngineService$WonderEditor.init(GameObjectUtils$WonderEditor.setParentKeepOrder(match$3[1], match$1[1], GameObjectEngineService$WonderEditor.setGameObjectName("scene", scene, match$3[0])));
StateLogicService$WonderEditor.setEditEngineState(DirectorEngineService$WonderEditor.loopBody(0, InitEventUtils$WonderEditor.initEvent(ViewService$Wonderjs.unsafeGetCanvas(editEngineState$1[/* viewRecord */8]), EngineStateDataEditorService$WonderEditor.getEditEngineStateData(/* () */0), /* tuple */[
StateEngineService$WonderEditor.getStateFromData,
StateEngineService$WonderEditor.setStateToData
], editEngineState$1)));
StateEditorService$WonderEditor.setState(match$2[0]);
return /* () */0;
}), _getLoadData("edit")).concat(Most.map((function (runEngineState) {
var editorState = StateEditorService$WonderEditor.getState(/* () */0);
var match = GameObjectEngineService$WonderEditor.create(runEngineState);
var scene = match[1];
var match$1 = DefaultSceneUtils$WonderEditor.createDefaultScene(scene, match[0]);
var runEngineState$1 = DirectorEngineService$WonderEditor.init(GameObjectEngineService$WonderEditor.setGameObjectName("scene", scene, match$1[0]));
StateLogicService$WonderEditor.setRunEngineState(DirectorEngineService$WonderEditor.loopBody(0, InitEventUtils$WonderEditor.initEvent(ViewService$Wonderjs.unsafeGetCanvas(runEngineState$1[/* viewRecord */8]), EngineStateDataEditorService$WonderEditor.getRunEngineStateData(/* () */0), /* tuple */[
StateEngineService$WonderEditor.getStateFromData,
StateEngineService$WonderEditor.setStateToData
], runEngineState$1)));
StateEditorService$WonderEditor.setState(SceneEditorService$WonderEditor.setScene(scene, editorState));
return /* () */0;
}), _getLoadData("run")))).then((function () {
return Promise.resolve(StateEditorService$WonderEditor.getState(/* () */0));
}));
}
function _createFetchNoWorkerJobStreamArr(dataDir, fetchFunc) {
return /* array */[
Most.map(ParseNoWorkerJobService$Wonderjs.convertSettingToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"no_worker/setting/setting.json"
]), fetchFunc)),
Most.map(ParseNoWorkerJobService$Wonderjs.convertInitPipelinesToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"no_worker/pipeline/init_pipelines.json"
]), fetchFunc)),
Most.map(ParseNoWorkerJobService$Wonderjs.convertLoopPipelinesToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"no_worker/pipeline/loop_pipelines.json"
]), fetchFunc)),
Most.map(ParseNoWorkerJobService$Wonderjs.convertInitJobsToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"no_worker/job/init_jobs.json"
]), fetchFunc)),
Most.map(ParseNoWorkerJobService$Wonderjs.convertLoopJobsToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"worker/setting/setting.json"
]), fetchFunc)),
Most.map(ParseWorkerJobService$Wonderjs.convertMainInitPipelinesToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"worker/pipeline/main/main_init_pipelines.json"
]), fetchFunc)),
Most.map(ParseWorkerJobService$Wonderjs.convertMainLoopPipelinesToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"worker/pipeline/main/main_loop_pipelines.json"
]), fetchFunc)),
Most.map(ParseWorkerJobService$Wonderjs.convertMainInitJobsToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"worker/job/main/main_init_jobs.json"
]), fetchFunc)),
Most.map(ParseWorkerJobService$Wonderjs.convertMainLoopJobsToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"worker/job/main/main_loop_jobs.json"
]), fetchFunc)),
Most.map(ParseWorkerJobService$Wonderjs.convertWorkerPipelinesToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"worker/pipeline/worker/worker_pipelines.json"
]), fetchFunc)),
Most.map(ParseWorkerJobService$Wonderjs.convertWorkerJobsToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"worker/job/worker/worker_jobs.json"
]), fetchFunc))
];
}
dataDir,
"no_worker/setting/setting.json"
]), fetchFunc)),
Most.map(ParseNoWorkerJobService$Wonderjs.convertInitPipelinesToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"no_worker/pipeline/init_pipelines.json"
]), fetchFunc)),
Most.map(ParseNoWorkerJobService$Wonderjs.convertLoopPipelinesToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"no_worker/pipeline/loop_pipelines.json"
]), fetchFunc)),
Most.map(ParseNoWorkerJobService$Wonderjs.convertInitJobsToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"no_worker/job/init_jobs.json"
]), fetchFunc)),
Most.map(ParseNoWorkerJobService$Wonderjs.convertLoopJobsToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"no_worker/job/loop_jobs.json"
]), fetchFunc))
];
}
function _createFetchRenderConfigStreamArr(dataDir, fetchFunc) {
return /* array */[
Most.map(ParseRenderConfigService$Wonderjs.convertShadersToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"render/shader/shaders.json"
]), fetchFunc)),
Most.map(ParseRenderConfigService$Wonderjs.convertShaderLibsToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"render/shader/shader_libs.json"
]), fetchFunc))
];
}
dataDir,
"worker/pipeline/main/main_init_pipelines.json"
]), fetchFunc)),
Most.map(ParseWorkerJobService$Wonderjs.convertMainLoopPipelinesToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"worker/pipeline/main/main_loop_pipelines.json"
]), fetchFunc)),
Most.map(ParseWorkerJobService$Wonderjs.convertMainInitJobsToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"worker/job/main/main_init_jobs.json"
]), fetchFunc)),
Most.map(ParseWorkerJobService$Wonderjs.convertMainLoopJobsToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"worker/job/main/main_loop_jobs.json"
]), fetchFunc)),
Most.map(ParseWorkerJobService$Wonderjs.convertWorkerPipelinesToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"worker/pipeline/worker/worker_pipelines.json"
]), fetchFunc)),
Most.map(ParseWorkerJobService$Wonderjs.convertWorkerJobsToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"worker/job/worker/worker_jobs.json"
]), fetchFunc))
];
}
return Most.flatMap((function (rabRelativePath) {
var state = StateDataMainService$Wonderjs.unsafeGetState(StateDataMain$Wonderjs.stateData);
var match = OperateRABAssetBundleMainService$Wonderjs.isLoaded(rabRelativePath, state);
if (match) {
return Most.empty();
} else {
return Most.map((function (param) {
return /* () */0;
}), Most.tap((function (rab) {
var state = StateDataMainService$Wonderjs.unsafeGetState(StateDataMain$Wonderjs.stateData);
StateDataMainService$Wonderjs.setState(StateDataMain$Wonderjs.stateData, OperateRABAssetBundleMainService$Wonderjs.setLoadedRAB(rabRelativePath, rab, OperateRABAssetBundleMainService$Wonderjs.markLoaded(rabRelativePath, state)));
return /* () */0;
}), loadAB(rabRelativePath, wholeManifest, wholeDependencyRelationMap, /* tuple */[
getAssetBundlePathFunc,
isAssetBundleArrayBufferCachedFunc,
getAssetBundleArrayBufferCacheFunc,
cacheAssetBundleArrayBufferFunc,
fetchFunc
])));
}
}), Most.just(rabRelativePath));
}
function _createFetchWorkerJobStreamArr(dataDir, fetchFunc) {
return /* array */[
Most.map(ParseWorkerJobService$Wonderjs.convertSettingToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"worker/setting/setting.json"
]), fetchFunc)),
Most.map(ParseWorkerJobService$Wonderjs.convertMainInitPipelinesToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"worker/pipeline/main/main_init_pipelines.json"
]), fetchFunc)),
Most.map(ParseWorkerJobService$Wonderjs.convertMainLoopPipelinesToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"worker/pipeline/main/main_loop_pipelines.json"
]), fetchFunc)),
Most.map(ParseWorkerJobService$Wonderjs.convertMainInitJobsToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
dataDir,
"worker/job/main/main_init_jobs.json"
]), fetchFunc)),
Most.map(ParseWorkerJobService$Wonderjs.convertMainLoopJobsToRecord, FetchCommon$Wonderjs.createFetchJsonStream(PathService$Wonderjs.join(/* array */[
function itemCounts(todos$: Stream>) {
const activeTodoItemCount$ =
map(length, map(filter((todo) => !todo.completed), todos$))
const completedTodoItemCount$ =
map(length, map(filter((todo) => todo.completed), todos$))
const todoItemCount$ = map(length, todos$)
return {
activeTodoItemCount$,
completedTodoItemCount$,
todoItemCount$,
}
}
export function TodoApp(sources: Sources): Sinks {
const {
dom,
todos$,
activeTodoItemCount$,
completedTodoItemCount$,
todoItemCount$,
} = sources
const addTodo$ = newTodo(dom)
const clearCompletedTodos$ = clearCompleted(dom)
const todoItemSinks$: Stream> =
hold(map(rMap(toTodoItem(dom)), todos$))
const todoItemView$s$ =
mapProp('view$', todoItemSinks$)
const todoItemViews$ = startWith([], switchCombine(todoItemView$s$))
const todoItemRemove$s$ =
mapProp('remove$', todoItemSinks$)
const removeTodo$ = switchMerge(todoItemRemove$s$)
const todoItemUpdate$s$ =
mapProp('update$', todoItemSinks$)
const updateTodo$ = switchMerge(todoItemUpdate$s$)