2026-07-29 08:29:29 +00:00
|
|
|
// Module ID: 331
|
|
|
|
|
// Function ID: 332
|
2026-07-20 16:05:17 +00:00
|
|
|
// Name: getImageSourcesFromImageProps
|
2026-07-29 08:29:29 +00:00
|
|
|
// Dependencies: [32, 81]
|
2026-07-20 16:05:17 +00:00
|
|
|
// Exports: getImageSourcesFromImageProps
|
|
|
|
|
|
2026-07-29 08:29:29 +00:00
|
|
|
// Module 331 (getImageSourcesFromImageProps)
|
2026-08-24 06:08:38 +00:00
|
|
|
import closure_2 from "_slicedToArray" /* 32 */;
|
2026-07-23 10:11:24 +00:00
|
|
|
|
2026-07-20 16:05:17 +00:00
|
|
|
|
2026-07-29 08:29:29 +00:00
|
|
|
export const getImageSourcesFromImageProps = function getImageSourcesFromImageProps(source) {
|
|
|
|
|
let tmp = width(height[1])(source.source);
|
|
|
|
|
({ referrerPolicy, src, srcSet, width } = source);
|
|
|
|
|
height = source.height;
|
2026-07-20 16:05:17 +00:00
|
|
|
let obj = {};
|
2026-07-29 08:29:29 +00:00
|
|
|
if ("use-credentials" === source.crossOrigin) {
|
2026-07-23 10:11:24 +00:00
|
|
|
obj["Access-Control-Allow-Credentials"] = "true";
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
if (null != referrerPolicy) {
|
2026-07-23 10:11:24 +00:00
|
|
|
obj["Referrer-Policy"] = referrerPolicy;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
|
|
|
|
if (null != srcSet) {
|
|
|
|
|
const items = [];
|
|
|
|
|
const parts = srcSet.split(", ");
|
2026-08-24 06:08:38 +00:00
|
|
|
c4 = true;
|
2026-07-20 16:05:17 +00:00
|
|
|
const item = parts.forEach((str) => {
|
|
|
|
|
const tmp = obj(str.split(" "), 2);
|
|
|
|
|
str = "1x";
|
|
|
|
|
if (undefined !== tmp[1]) {
|
|
|
|
|
str = tmp2;
|
|
|
|
|
}
|
|
|
|
|
if (str.endsWith("x")) {
|
|
|
|
|
const _parseInt = parseInt;
|
|
|
|
|
const parsed = parseInt(str.split("x")[0], 10);
|
|
|
|
|
const _isNaN = isNaN;
|
|
|
|
|
if (!isNaN(parsed)) {
|
|
|
|
|
closure_4 = 1 !== parsed && closure_4;
|
2026-07-29 08:29:29 +00:00
|
|
|
obj = { headers: null, scale: null, uri: null, width: null, height: null };
|
|
|
|
|
obj[0] = obj;
|
|
|
|
|
obj[1] = parsed;
|
|
|
|
|
obj[2] = tmp[0];
|
|
|
|
|
obj[3] = width;
|
|
|
|
|
obj[4] = height;
|
2026-07-20 16:05:17 +00:00
|
|
|
items.push(obj);
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
const _console = console;
|
|
|
|
|
console.warn("The provided format for scale is not supported yet. Please use scales like 1x, 2x, etc.");
|
|
|
|
|
}
|
|
|
|
|
});
|
2026-07-29 08:29:29 +00:00
|
|
|
let tmp8 = c4;
|
2026-07-23 10:11:24 +00:00
|
|
|
if (c4) {
|
2026-07-29 08:29:29 +00:00
|
|
|
tmp8 = null != src;
|
2026-07-20 16:05:17 +00:00
|
|
|
}
|
2026-07-29 08:29:29 +00:00
|
|
|
if (tmp8) {
|
|
|
|
|
obj = { headers: null, scale: 1, uri: null, width: null, height: null };
|
|
|
|
|
obj[0] = obj;
|
|
|
|
|
obj[2] = src;
|
|
|
|
|
obj[3] = width;
|
|
|
|
|
obj[4] = height;
|
2026-07-20 16:05:17 +00:00
|
|
|
items.push(obj);
|
|
|
|
|
}
|
|
|
|
|
let tmp2 = items;
|
|
|
|
|
if (0 === items.length) {
|
2026-07-23 10:11:24 +00:00
|
|
|
let _console = console;
|
2026-07-20 16:05:17 +00:00
|
|
|
console.warn("The provided value for srcSet is not valid.");
|
|
|
|
|
tmp2 = items;
|
|
|
|
|
}
|
|
|
|
|
} else if (null != src) {
|
2026-07-29 08:29:29 +00:00
|
|
|
obj = { uri: null, headers: null, width: null, height: null };
|
|
|
|
|
obj[0] = src;
|
|
|
|
|
obj[1] = obj;
|
|
|
|
|
obj[2] = width;
|
|
|
|
|
obj[3] = height;
|
2026-07-20 16:05:17 +00:00
|
|
|
const items1 = [obj];
|
|
|
|
|
tmp2 = items1;
|
|
|
|
|
} else {
|
|
|
|
|
tmp2 = tmp;
|
|
|
|
|
if (null != tmp) {
|
|
|
|
|
tmp2 = tmp;
|
|
|
|
|
if (tmp.uri) {
|
|
|
|
|
const _Object = Object;
|
|
|
|
|
tmp2 = tmp;
|
|
|
|
|
if (Object.keys(obj).length > 0) {
|
2026-08-24 06:08:38 +00:00
|
|
|
obj1 = {};
|
2026-07-29 08:29:29 +00:00
|
|
|
const merged = Object.assign(tmp);
|
|
|
|
|
obj1.headers = obj;
|
|
|
|
|
const items2 = [obj1];
|
2026-07-20 16:05:17 +00:00
|
|
|
tmp2 = items2;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return tmp2;
|
|
|
|
|
};
|