// Metro module 8060 (f8061). import { useState } from "react"; import { cloneDeep, isEqual } from "../../../_bundle/Module12"; function $mk79787() { return (a0, a1) => { let r8 = a1.randomizedSources?.length; if (r8 == null) { r8 = 0; } return r8 > 0 ? a0 !== 0 ? Math.min(a0, r8) : r8 : a0; }; } function $mk79788($env) { return (a0) => { if (a0.randomizedSources != null && a0.randomizedSources.length > 0) { a0.src = a0.randomizedSources[$env[0]].src; } return a0; }; } export function sortEffectLayers(a0) { return a0.sort(({ zIndex }, b) => { if (zIndex == null) { zIndex = 0; } let zIndex2 = b.zIndex; if (zIndex2 == null) { zIndex2 = 0; } return zIndex - zIndex2; }); } export function usePotentiallyRandomizedProfileEffect(a0) { let env16230; const [state, setState] = useState(a0); const r15 = env16230 = {}; env16230[0] = void 0; let r22 = a0; if (a0 != null) { const r26 = cloneDeep(a0); const r0 = r26.effects.reduce($mk79787(), 0) - 1; env16230[0] = Math.floor(Math.random() * (r0 - 0 + 1) + 0); r26.effects = r26.effects.map($mk79788(r15)); r22 = r26; } const [state2, setState2] = useState(r22); if (!isEqual(state, a0)) { let env16231; setState(a0); const r54 = env16231 = {}; env16231[0] = void 0; let r55 = a0; if (a0 != null) { const r59 = cloneDeep(a0); const r66 = r59.effects.reduce($mk79787(), 0) - 1; env16231[0] = Math.floor(Math.random() * (r66 - 0 + 1) + 0); r59.effects = r59.effects.map($mk79788(r54)); r55 = r59; } setState2(r55); } return state2; }