266 lines
8.5 KiB
JavaScript
266 lines
8.5 KiB
JavaScript
// Metro module 1654 (f1655).
|
|
import * as _Module1609 from "./Module1609";
|
|
import * as _Module1655 from "./Module1655";
|
|
import { runOnUI } from "./runWorkletOnJS";
|
|
function $mk102432($env) {
|
|
return function updateMappersOrder() {
|
|
let c28935_0, c28935_1, c28935_2;
|
|
const r2 = $env;
|
|
const dfs2 = function dfs(a0) {
|
|
c28935_1.add(a0);
|
|
for (const input of a0.inputs) {
|
|
const r32 = c28935_0.get(input);
|
|
if (r32) {
|
|
for (const item of r32) {
|
|
if (!c28935_1.has(item)) {
|
|
dfs2(item);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
c28935_2.push(a0);
|
|
};
|
|
c28935_0 = new Map();
|
|
const r12 = r2[0];
|
|
r12.forEach((item) => {
|
|
if (item.outputs) {
|
|
for (const output of item.outputs) {
|
|
const r29 = c28935_0.get(output);
|
|
if (r29 === void 0) {
|
|
c28935_0.set(output, [item]);
|
|
} else {
|
|
r29.push(item);
|
|
}
|
|
}
|
|
}
|
|
});
|
|
c28935_1 = new Set();
|
|
const r20 = [];
|
|
c28935_2 = r20;
|
|
r12.forEach((item) => {
|
|
if (!c28935_1.has(item)) {
|
|
dfs2(item);
|
|
}
|
|
});
|
|
r2[1] = r20;
|
|
};
|
|
}
|
|
function $mk102433($env) {
|
|
return function mapperRun() {
|
|
const r3 = $env;
|
|
r3[2] = false;
|
|
if (!r3[3]) {
|
|
try {
|
|
r3[3] = true;
|
|
if (r3[0].size !== r3[1].length) {
|
|
(0, r3[4])();
|
|
}
|
|
for (const item of r3[1]) {
|
|
if (item.dirty) {
|
|
item.dirty = false;
|
|
item.worklet();
|
|
}
|
|
}
|
|
} catch (r35) {
|
|
r3[3] = false;
|
|
throw r35;
|
|
}
|
|
r3[3] = false;
|
|
}
|
|
};
|
|
}
|
|
function $mk102434($env) {
|
|
return function maybeRequestUpdates() {
|
|
const r1 = $env;
|
|
if ($env.$parent[3]) {
|
|
(0, r1[5])();
|
|
} else if (!r1[2]) {
|
|
if (r1[3]) {
|
|
requestAnimationFrame(r1[5]);
|
|
} else {
|
|
queueMicrotask(r1[5]);
|
|
}
|
|
r1[2] = true;
|
|
}
|
|
};
|
|
}
|
|
function $mk102435($env) {
|
|
return function extractInputs(a0, a1) {
|
|
const r5 = $env;
|
|
if (Array.isArray(a0)) {
|
|
for (const item2 of a0) {
|
|
if (item2) {
|
|
(0, r5[7])(item2, a1);
|
|
}
|
|
}
|
|
} else {
|
|
const r24 = $env.$parent;
|
|
if ((0, r24[1])(r24[2][1]).isSharedValue(a0)) {
|
|
a1.push(a0);
|
|
} else if (Object.getPrototypeOf(a0) === Object.prototype) {
|
|
for (const item of Object.values(a0)) {
|
|
if (item) {
|
|
(0, r5[7])(item, a1);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return a1;
|
|
};
|
|
}
|
|
function $mk102436($env) {
|
|
return (a0, a1, a2, a3) => {
|
|
const r1 = $env;
|
|
let env28936 = {
|
|
$parent: $env
|
|
};
|
|
const r6 = r1[7];
|
|
const inputs = [];
|
|
r6(a2, inputs);
|
|
const r4 = {
|
|
id: a0,
|
|
dirty: true,
|
|
worklet: a1,
|
|
inputs,
|
|
outputs: a3
|
|
};
|
|
env28936[0] = r4;
|
|
r1[0].set(r4.id, r4);
|
|
r1[1] = [];
|
|
for (const input of r4.inputs) {
|
|
input.addListener(r4.id, () => {
|
|
env28936[0].dirty = true;
|
|
const r7 = env28936.$parent;
|
|
if (r7.$parent[3]) {
|
|
(0, r7[5])();
|
|
} else if (!r7[2]) {
|
|
if (r7[3]) {
|
|
requestAnimationFrame(r7[5]);
|
|
} else {
|
|
queueMicrotask(r7[5]);
|
|
}
|
|
r7[2] = true;
|
|
}
|
|
});
|
|
}
|
|
(0, r1[6])();
|
|
};
|
|
}
|
|
function $mk102437($env) {
|
|
return (a0) => {
|
|
const r1 = $env;
|
|
const r4 = r1[0];
|
|
const r3 = r4.get(a0);
|
|
if (r3) {
|
|
r4.delete(r3.id);
|
|
r1[1] = [];
|
|
for (const input of r3.inputs) {
|
|
input.removeListener(r3.id);
|
|
}
|
|
}
|
|
};
|
|
}
|
|
let createMapperRegistry, c1312_6, c1312_7;
|
|
let env1312 = {};
|
|
const isJest = _Module1609.isJest();
|
|
const c1312_3 = isJest;
|
|
const createMapperRegistry2 = function createMapperRegistry() {
|
|
let env24526;
|
|
const r2 = env24526 = {
|
|
$parent: env1312
|
|
};
|
|
env24526[4] = $mk102432(r2);
|
|
env24526[5] = $mk102433(r2);
|
|
env24526[6] = $mk102434(r2);
|
|
env24526[7] = $mk102435(r2);
|
|
env24526[0] = new Map();
|
|
env24526[1] = [];
|
|
env24526[2] = false;
|
|
env24526[3] = false;
|
|
return {
|
|
start: $mk102436(r2),
|
|
stop: $mk102437(r2)
|
|
};
|
|
};
|
|
createMapperRegistry2.__closure = {
|
|
IS_JEST: isJest,
|
|
isSharedValue: _Module1655.isSharedValue
|
|
};
|
|
createMapperRegistry2.__workletHash = 4849129099287;
|
|
createMapperRegistry2.__initData = {
|
|
code: "function createMapperRegistry_Pnpm_mappersTs1(){const{IS_JEST,isSharedValue}=this.__closure;const mappers=new Map();let sortedMappers=[];let runRequested=false;let processingMappers=false;function updateMappersOrder(){const pre=new Map();mappers.forEach(function(mapper){if(mapper.outputs){for(const output of mapper.outputs){const preMappers=pre.get(output);if(preMappers===undefined){pre.set(output,[mapper]);}else{preMappers.push(mapper);}}}});const visited=new Set();const newOrder=[];function dfs(mapper){visited.add(mapper);for(const input of mapper.inputs){const preMappers=pre.get(input);if(preMappers){for(const preMapper of preMappers){if(!visited.has(preMapper)){dfs(preMapper);}}}}newOrder.push(mapper);}mappers.forEach(function(mapper){if(!visited.has(mapper)){dfs(mapper);}});sortedMappers=newOrder;}function mapperRun(){runRequested=false;if(processingMappers){return;}try{processingMappers=true;if(mappers.size!==sortedMappers.length){updateMappersOrder();}for(const mapper of sortedMappers){if(mapper.dirty){mapper.dirty=false;mapper.worklet();}}}finally{processingMappers=false;}}function maybeRequestUpdates(){if(IS_JEST){mapperRun();}else if(!runRequested){if(processingMappers){requestAnimationFrame(mapperRun);}else{queueMicrotask(mapperRun);}runRequested=true;}}function extractInputs(inputs,resultArray){if(Array.isArray(inputs)){for(const input of inputs){input&&extractInputs(input,resultArray);}}else if(isSharedValue(inputs)){resultArray.push(inputs);}else if(Object.getPrototypeOf(inputs)===Object.prototype){for(const element of Object.values(inputs)){element&&extractInputs(element,resultArray);}}return resultArray;}return{start:function(mapperID,worklet,inputs,outputs){const mapper={id:mapperID,dirty:true,worklet:worklet,inputs:extractInputs(inputs,[]),outputs:outputs};mappers.set(mapper.id,mapper);sortedMappers=[];for(const sv of mapper.inputs){sv.addListener(mapper.id,function(){mapper.dirty=true;maybeRequestUpdates();});}maybeRequestUpdates();},stop:function(mapperID){const mapper=mappers.get(mapperID);if(mapper){mappers.delete(mapper.id);sortedMappers=[];for(const sv of mapper.inputs){sv.removeListener(mapper.id);}}}};}"
|
|
};
|
|
createMapperRegistry = createMapperRegistry2;
|
|
env1312[5] = 9999;
|
|
c1312_6 = {
|
|
code: "function pnpm_mappersTs2(){const{createMapperRegistry,mapperID,worklet,inputs,outputs}=this.__closure;let mapperRegistry=global.__mapperRegistry;if(mapperRegistry===undefined){mapperRegistry=global.__mapperRegistry=createMapperRegistry();}mapperRegistry.start(mapperID,worklet,inputs,outputs);}"
|
|
};
|
|
c1312_7 = {
|
|
code: "function pnpm_mappersTs3(){const{mapperID}=this.__closure;const mapperRegistry=global.__mapperRegistry;mapperRegistry===null||mapperRegistry===void 0||mapperRegistry.stop(mapperID);}"
|
|
};
|
|
export function startMapper(a0) {
|
|
let inputs = arguments[1];
|
|
if (inputs === void 0) {
|
|
inputs = [];
|
|
}
|
|
let c13151_1 = inputs;
|
|
let outputs = arguments[2];
|
|
if (outputs === void 0) {
|
|
outputs = [];
|
|
}
|
|
let c13151_2 = outputs;
|
|
const mapperID = env1312[5] + 1;
|
|
env1312[5] = mapperID;
|
|
let c13151_3 = mapperID;
|
|
const f = function f() {
|
|
const r3 = env1312;
|
|
let __mapperRegistry = global.__mapperRegistry;
|
|
if (__mapperRegistry === void 0) {
|
|
let env24527;
|
|
const r14 = env24527 = {
|
|
$parent: r3
|
|
};
|
|
env24527[4] = $mk102432(r14);
|
|
env24527[5] = $mk102433(r14);
|
|
env24527[6] = $mk102434(r14);
|
|
env24527[7] = $mk102435(r14);
|
|
env24527[0] = new Map();
|
|
env24527[1] = [];
|
|
env24527[2] = false;
|
|
env24527[3] = false;
|
|
const __mapperRegistry2 = {
|
|
start: $mk102436(r14),
|
|
stop: $mk102437(r14)
|
|
};
|
|
global.__mapperRegistry = __mapperRegistry2;
|
|
__mapperRegistry = __mapperRegistry2;
|
|
}
|
|
__mapperRegistry.start(c13151_3, a0, c13151_1, c13151_2);
|
|
};
|
|
f.__closure = {
|
|
createMapperRegistry,
|
|
mapperID,
|
|
worklet: a0,
|
|
inputs,
|
|
outputs
|
|
};
|
|
f.__workletHash = 1517453109481;
|
|
f.__initData = c1312_6;
|
|
runOnUI(f)();
|
|
return mapperID;
|
|
}
|
|
export function stopMapper(a0) {
|
|
const t = function t() {
|
|
const __mapperRegistry = global.__mapperRegistry;
|
|
if (__mapperRegistry != null) {
|
|
__mapperRegistry.stop(a0);
|
|
}
|
|
};
|
|
t.__closure = {
|
|
mapperID: a0
|
|
};
|
|
t.__workletHash = 1696829263429;
|
|
t.__initData = c1312_7;
|
|
runOnUI(t)();
|
|
}
|