Files
discord-decomp/_bundle/Module1757.js
T
2026-11-01 12:12:55 +02:00

211 lines
9.3 KiB
JavaScript

// Metro module 1757 (f1758).
import * as _Module1617 from "./Module1617";
let o2, parseBoxShadowString, parseLength;
const r12 = function(item2) {
return item2.endsWith("px") || !isNaN(Number(item2));
};
r12.__closure = {};
r12.__workletHash = 6091944631530;
r12.__initData = {
code: "function pnpm_processBoxShadowTs1(value){return value.endsWith('px')||!isNaN(Number(value));}"
};
o2 = r12;
const parseBoxShadowString2 = function parseBoxShadowString(a0) {
const r0 = [];
for (const item of a0.split(/,(?![^()]*\))/).map((item) => item.trim()).filter((item) => item !== "")) {
L42: {
L35: {
L31: {
L27: {
L23: {
L17: {
const r47 = {
offsetX: 0,
offsetY: 0
};
let offsetX = null;
let offsetY = null;
let r50 = false;
let r51 = 0;
done22: {
for (const item2 of item.split(/\s+(?![^(]*\))/)) {
if (o2(item2)) {
const r78 = r51;
if (r78 === 0) {
offsetX = item2;
r51 = r51 + 1;
continue;
}
if (r78 === 1) {
if (r50) {
break L35;
}
offsetY = item2;
r51 = r51 + 1;
continue;
}
if (r78 === 2) {
if (r50) {
break L31;
}
r47.blurRadius = item2;
r51 = r51 + 1;
continue;
}
if (r78 === 3) {
if (r50) {
break L27;
}
r47.spreadDistance = item2;
r51 = r51 + 1;
continue;
}
break L23;
}
if (item2 === "inset") {
if (r47.inset) {
break L17;
}
if (offsetX !== null) {
r50 = true;
}
r47.inset = true;
continue;
}
if (!r47.color) {
if (offsetX != null) {
r50 = true;
}
r47.color = item2;
continue;
}
break done22;
}
if (offsetX === null) {
break L42;
}
if (offsetY === null) {
break L42;
}
r47.offsetX = offsetX;
r47.offsetY = offsetY;
r0.push(r47);
continue;
}
return [];
}
return [];
}
return [];
}
return [];
}
return [];
}
return [];
}
return [];
}
return r0;
};
parseBoxShadowString2.__closure = {
isLength: o2
};
parseBoxShadowString2.__workletHash = 13799106280870;
parseBoxShadowString2.__initData = {
code: "function parseBoxShadowString_Pnpm_processBoxShadowTs2(rawBoxShadows){const{isLength}=this.__closure;const result=[];for(const rawBoxShadow of rawBoxShadows.split(/,(?![^()]*\\))/).map(function(bS){return bS.trim();}).filter(function(bS){return bS!=='';})){const boxShadow={offsetX:0,offsetY:0};let offsetX=null;let offsetY=null;let keywordDetectedAfterLength=false;let lengthCount=0;const args=rawBoxShadow.split(/\\s+(?![^(]*\\))/);for(const arg of args){if(isLength(arg)){switch(lengthCount){case 0:offsetX=arg;lengthCount++;break;case 1:if(keywordDetectedAfterLength){return[];}offsetY=arg;lengthCount++;break;case 2:if(keywordDetectedAfterLength){return[];}boxShadow.blurRadius=arg;lengthCount++;break;case 3:if(keywordDetectedAfterLength){return[];}boxShadow.spreadDistance=arg;lengthCount++;break;default:return[];}}else if(arg==='inset'){if(boxShadow.inset){return[];}if(offsetX!==null){keywordDetectedAfterLength=true;}boxShadow.inset=true;continue;}else{if(boxShadow.color){return[];}if(offsetX!=null){keywordDetectedAfterLength=true;}boxShadow.color=arg;continue;}}if(offsetX===null||offsetY===null){return[];}boxShadow.offsetX=offsetX;boxShadow.offsetY=offsetY;result.push(boxShadow);}return result;}"
};
parseBoxShadowString = parseBoxShadowString2;
const parseLength2 = function parseLength(a0) {
const r9 = /([+-]?\d*(\.\d+)?)([\w\W]+)?/g.exec(a0);
return r9 ? a0.endsWith("px") || !isNaN(Number(a0)) ? Number(r9[1]) : null : null;
};
parseLength2.__closure = {
isLength: o2
};
parseLength2.__workletHash = 16787390997763;
parseLength2.__initData = {
code: "function parseLength_Pnpm_processBoxShadowTs3(length){const{isLength}=this.__closure;const argsWithUnitsRegex=/([+-]?\\d*(\\.\\d+)?)([\\w\\W]+)?/g;const match=argsWithUnitsRegex.exec(length);if(!match||!isLength(length)){return null;}return Number(match[1]);}"
};
parseLength = parseLength2;
export function processBoxShadow(a0) {
let r38;
const boxShadow2 = [];
const boxShadow = a0.boxShadow;
if (boxShadow === null) {
return boxShadow2;
}
if (typeof boxShadow === "string") {
r38 = parseBoxShadowString(boxShadow.replace(/\n/g, " "));
} else {
const isArray = Array.isArray(boxShadow);
r38 = boxShadow;
if (!isArray) {
throw new _Module1617.ReanimatedError(`Box shadow value must be an array of shadow objects or a string. Received: ${JSON.stringify(boxShadow)}`);
}
}
for (const item of r38) {
L41: {
L35: {
L29: {
L23: {
const r65 = {
offsetX: 0,
offsetY: 0
};
for (const key in item) {
if (key === "offsetX") {
const offsetX = typeof item.offsetX === "string" ? parseLength(item.offsetX) : item.offsetX;
if (offsetX === null) {
break L41;
}
r65.offsetX = offsetX;
} else if (key === "offsetY") {
const offsetY = typeof item.offsetY === "string" ? parseLength(item.offsetY) : item.offsetY;
if (offsetY === null) {
break L35;
}
r65.offsetY = offsetY;
} else if (key === "spreadDistance") {
const r89 = typeof item.spreadDistance === "string" ? parseLength(item.spreadDistance) : item.spreadDistance;
if (r89 === null) {
break L29;
}
r65.spreadDistance = r89;
} else if (key === "blurRadius") {
const r77 = typeof item.blurRadius === "string" ? parseLength(item.blurRadius) : item.blurRadius;
if (r77 === null) {
break L23;
}
if (r77 < 0) {
break L23;
}
r65.blurRadius = r77;
} else if (key === "color") {
r65.color = item.color;
} else if (key === "inset") {
r65.inset = item.inset;
}
}
boxShadow2.push(r65);
continue;
}
return [];
}
return [];
}
return [];
}
return [];
}
a0.boxShadow = boxShadow2;
}
processBoxShadow.__closure = {
parseBoxShadowString,
parseLength
};
processBoxShadow.__workletHash = 5021783745910;
processBoxShadow.__initData = {
code: "function processBoxShadow_Pnpm_processBoxShadowTs4(props){const{parseBoxShadowString,parseLength}=this.__closure;const result=[];const rawBoxShadows=props.boxShadow;if(rawBoxShadows===null){return result;}let boxShadowList;if(typeof rawBoxShadows==='string'){boxShadowList=parseBoxShadowString(rawBoxShadows.replace(/\\n/g,' '));}else if(Array.isArray(rawBoxShadows)){boxShadowList=rawBoxShadows;}else{throw new ReanimatedError(\"Box shadow value must be an array of shadow objects or a string. Received: \"+JSON.stringify(rawBoxShadows));}for(const rawBoxShadow of boxShadowList){const parsedBoxShadow={offsetX:0,offsetY:0};let value;for(const arg in rawBoxShadow){switch(arg){case'offsetX':value=typeof rawBoxShadow.offsetX==='string'?parseLength(rawBoxShadow.offsetX):rawBoxShadow.offsetX;if(value===null){return[];}parsedBoxShadow.offsetX=value;break;case'offsetY':value=typeof rawBoxShadow.offsetY==='string'?parseLength(rawBoxShadow.offsetY):rawBoxShadow.offsetY;if(value===null){return[];}parsedBoxShadow.offsetY=value;break;case'spreadDistance':value=typeof rawBoxShadow.spreadDistance==='string'?parseLength(rawBoxShadow.spreadDistance):rawBoxShadow.spreadDistance;if(value===null){return[];}parsedBoxShadow.spreadDistance=value;break;case'blurRadius':value=typeof rawBoxShadow.blurRadius==='string'?parseLength(rawBoxShadow.blurRadius):rawBoxShadow.blurRadius;if(value===null||value<0){return[];}parsedBoxShadow.blurRadius=value;break;case'color':parsedBoxShadow.color=rawBoxShadow.color;break;case'inset':parsedBoxShadow.inset=rawBoxShadow.inset;}}result.push(parsedBoxShadow);}props.boxShadow=result;}"
};