226 lines
6.9 KiB
JavaScript
226 lines
6.9 KiB
JavaScript
// Metro module 5617 (f5618).
|
|
import * as _Module5615 from "./Module5615";
|
|
import * as _swizzle from "./swizzle";
|
|
const hasOwnProperty = Object.hasOwnProperty;
|
|
let c3462_3 = Object.create(null);
|
|
for (const key in _Module5615) {
|
|
const call = hasOwnProperty.call;
|
|
if (hasOwnProperty.call(_Module5615, key)) {
|
|
c3462_3[_Module5615[key]] = key;
|
|
}
|
|
}
|
|
const exports2 = {
|
|
to: {},
|
|
get: {}
|
|
};
|
|
module.exports = exports2;
|
|
let c3462_4 = exports2;
|
|
c3462_4.get = function(a0) {
|
|
let model, value;
|
|
const r4 = a0.substring(0, 3).toLowerCase();
|
|
if (r4 === "hsl") {
|
|
value = c3462_4.get.hsl(a0);
|
|
model = "hsl";
|
|
} else if (r4 === "hwb") {
|
|
value = c3462_4.get.hwb(a0);
|
|
model = "hwb";
|
|
} else {
|
|
value = c3462_4.get.rgb(a0);
|
|
model = "rgb";
|
|
}
|
|
return value ? {
|
|
model,
|
|
value
|
|
} : null;
|
|
};
|
|
c3462_4.get.rgb = function(a0) {
|
|
let r41, r53;
|
|
if (!a0) {
|
|
return null;
|
|
}
|
|
const r10 = [0, 0, 0, 1];
|
|
const r25 = a0.match(/^#([a-f0-9]{6})([a-f0-9]{2})?$/i);
|
|
if (r25) {
|
|
const r89 = r25[2];
|
|
const r90 = r25[1];
|
|
let r97 = 0;
|
|
while (true) {
|
|
const r7 = 2 * r97;
|
|
r10[r97] = parseInt(r90.slice(r7, r7 + 2), 16);
|
|
r97 = r97 + 1;
|
|
if (!(r97 < 3)) {
|
|
r53 = 0;
|
|
if (!r89) {
|
|
break;
|
|
}
|
|
r10[3] = parseInt(r89, 16) / 255;
|
|
r53 = 0;
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
const r27 = a0.match(/^#([a-f0-9]{3,4})$/i);
|
|
if (r27) {
|
|
const r71 = r27[1];
|
|
const r72 = r71[3];
|
|
let r78 = 0;
|
|
while (true) {
|
|
r10[r78] = parseInt(r71[r78] + r71[r78], 16);
|
|
r78 = r78 + 1;
|
|
if (!(r78 < 3)) {
|
|
r53 = 0;
|
|
if (!r72) {
|
|
break;
|
|
}
|
|
r10[3] = parseInt(r72 + r72, 16) / 255;
|
|
r53 = 0;
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
const r29 = a0.match(/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/);
|
|
let r2 = 0;
|
|
if (r29) {
|
|
while (true) {
|
|
const r60 = parseInt;
|
|
const r61 = r2 + 1;
|
|
r10[r2] = r60(r29[r61], 0);
|
|
r2 = r61;
|
|
if (!(r2 < 3)) {
|
|
const r64 = r29[4];
|
|
r53 = 0;
|
|
if (!r64) {
|
|
break;
|
|
}
|
|
const r65 = r29[5];
|
|
const r68 = parseFloat(r29[4]);
|
|
if (r65) {
|
|
r10[3] = 0.01 * r68;
|
|
r53 = 0;
|
|
break;
|
|
}
|
|
r10[3] = r68;
|
|
r53 = 0;
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
const r32 = a0.match(/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/);
|
|
let r0 = 0;
|
|
if (!r32) {
|
|
const r34 = a0.match(/^(\w+)$/);
|
|
let r35 = null;
|
|
if (r34) {
|
|
if (r34[1] === "transparent") {
|
|
r41 = [0, 0, 0, 0];
|
|
} else {
|
|
const call = hasOwnProperty.call;
|
|
const r40 = hasOwnProperty.call(_Module5615, r34[1]);
|
|
r41 = null;
|
|
if (r40) {
|
|
const r45 = _Module5615[r34[1]];
|
|
r45[3] = 1;
|
|
r41 = r45;
|
|
}
|
|
}
|
|
r35 = r41;
|
|
}
|
|
return r35;
|
|
}
|
|
while (true) {
|
|
const r46 = Math;
|
|
const r48 = parseFloat;
|
|
const r5 = r0 + 1;
|
|
r10[r0] = r46.round(2.55 * r48(r32[r5]));
|
|
r0 = r5;
|
|
if (!(r0 < 3)) {
|
|
const r52 = r32[4];
|
|
r53 = 0;
|
|
if (!r52) {
|
|
break;
|
|
}
|
|
const r54 = r32[5];
|
|
const r57 = parseFloat(r32[4]);
|
|
if (r54) {
|
|
r10[3] = 0.01 * r57;
|
|
r53 = 0;
|
|
break;
|
|
}
|
|
r10[3] = r57;
|
|
r53 = 0;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
while (true) {
|
|
r10[r53] = Math.min(Math.max(0, r10[r53]), 255);
|
|
r53 = r53 + 1;
|
|
if (!(r53 < 3)) {
|
|
r10[3] = Math.min(Math.max(0, r10[3]), 1);
|
|
return r10;
|
|
}
|
|
}
|
|
};
|
|
c3462_4.get.hsl = function(a0) {
|
|
if (a0) {
|
|
const r6 = a0.match(/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);
|
|
if (r6) {
|
|
const r17 = parseFloat(r6[4]);
|
|
return [(parseFloat(r6[1]) % 360 + 360) % 360, Math.min(Math.max(0, parseFloat(r6[2])), 100), Math.min(Math.max(0, parseFloat(r6[3])), 100), Math.min(Math.max(0, isNaN(r17) ? 1 : r17), 1)];
|
|
}
|
|
return null;
|
|
}
|
|
return null;
|
|
};
|
|
c3462_4.get.hwb = function(a0) {
|
|
if (a0) {
|
|
const r6 = a0.match(/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/);
|
|
if (r6) {
|
|
const r17 = parseFloat(r6[4]);
|
|
return [(parseFloat(r6[1]) % 360 + 360) % 360, Math.min(Math.max(0, parseFloat(r6[2])), 100), Math.min(Math.max(0, parseFloat(r6[3])), 100), Math.min(Math.max(0, isNaN(r17) ? 1 : r17), 1)];
|
|
}
|
|
return null;
|
|
}
|
|
return null;
|
|
};
|
|
c3462_4.to.hex = function() {
|
|
const r9 = _swizzle(arguments);
|
|
const r21 = Math.round(r9[0]).toString(16).toUpperCase();
|
|
const r26 = "#" + (r21.length < 2 ? "0" + r21 : r21);
|
|
const r33 = Math.round(r9[1]).toString(16).toUpperCase();
|
|
const r37 = r26 + (r33.length < 2 ? "0" + r33 : r33);
|
|
const r45 = Math.round(r9[2]).toString(16).toUpperCase();
|
|
const r49 = r37 + (r45.length < 2 ? "0" + r45 : r45);
|
|
const r51 = r9[3] < 1;
|
|
let r52 = "";
|
|
if (r51) {
|
|
const r65 = Math.round(Math.round(255 * r9[3])).toString(16).toUpperCase();
|
|
r52 = r65.length < 2 ? "0" + r65 : r65;
|
|
}
|
|
return r49 + r52;
|
|
};
|
|
c3462_4.to.rgb = function() {
|
|
const r13 = _swizzle(arguments);
|
|
return !(r13.length < 4) && r13[3] !== 1 ? "rgba(" + Math.round(r13[0]) + ", " + Math.round(r13[1]) + ", " + Math.round(r13[2]) + ", " + r13[3] + ")" : "rgb(" + Math.round(r13[0]) + ", " + Math.round(r13[1]) + ", " + Math.round(r13[2]) + ")";
|
|
};
|
|
c3462_4.to.rgb.percent = function() {
|
|
const r14 = _swizzle(arguments);
|
|
const r18 = Math.round(r14[0] / 255 * 100);
|
|
const r23 = Math.round(r14[1] / 255 * 100);
|
|
const r29 = Math.round(r14[2] / 255 * 100);
|
|
return !(r14.length < 4) && r14[3] !== 1 ? "rgba(" + r18 + "%, " + r23 + "%, " + r29 + "%, " + r14[3] + ")" : "rgb(" + r18 + "%, " + r23 + "%, " + r29 + "%)";
|
|
};
|
|
c3462_4.to.hsl = function() {
|
|
const r11 = _swizzle(arguments);
|
|
return !(r11.length < 4) && r11[3] !== 1 ? "hsla(" + r11[0] + ", " + r11[1] + "%, " + r11[2] + "%, " + r11[3] + ")" : "hsl(" + r11[0] + ", " + r11[1] + "%, " + r11[2] + "%)";
|
|
};
|
|
c3462_4.to.hwb = function() {
|
|
const r12 = _swizzle(arguments);
|
|
return HermesInternal.concat.call("hwb(" + r12[0] + ", " + r12[1] + "%, " + r12[2], "%", r12.length >= 4 && r12[3] !== 1 ? ", " + r12[3] : "", ")");
|
|
};
|
|
c3462_4.to.keyword = function(a0) {
|
|
return c3462_3[a0.slice(0, 3)];
|
|
};
|