decord/source/__polyfill/00xxx/module_331.js
github-actions e510164e6b chore: update source for alpha 346.2
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4759.js (118.4 MB)
2026-09-10 05:38:07 +00:00

81 lines
2.3 KiB
JavaScript

// Module ID: 331
// Function ID: 332
// Dependencies: [32, 81]
// Exports: getImageSourcesFromImageProps
// Module 331
import _slicedToArray from "module_32" /* 32 */;
export const getImageSourcesFromImageProps = function getImageSourcesFromImageProps(source) {
let tmp = width(height[1])(source.source);
({ referrerPolicy, src, srcSet, width } = source);
height = source.height;
const headers = {};
if ("use-credentials" === source.crossOrigin) {
headers["Access-Control-Allow-Credentials"] = "true";
}
if (null != referrerPolicy) {
headers["Referrer-Policy"] = referrerPolicy;
}
if (null != srcSet) {
const items = [];
const parts = srcSet.split(", ");
closure_4 = true;
const item = parts.forEach((item) => {
const tmp = _slicedToArray(item.split(" "), 2);
let 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;
const size = { headers, scale: parsed, uri: tmp[0], width, height };
items.push(size);
}
} else {
const _console = console;
console.warn("The provided format for scale is not supported yet. Please use scales like 1x, 2x, etc.");
}
});
let tmp8 = closure_4;
if (closure_4) {
tmp8 = null != src;
}
if (tmp8) {
let size = { headers, scale: 1, uri: src, width, height };
items.push(size);
}
let tmp2 = items;
if (0 === items.length) {
let _console = console;
console.warn("The provided value for srcSet is not valid.");
tmp2 = items;
}
} else if (null != src) {
const size1 = { uri: src, headers, width, height };
const items1 = [size1];
tmp2 = items1;
} else {
tmp2 = tmp;
if (null != tmp) {
tmp2 = tmp;
if (tmp.uri) {
const _Object = Object;
tmp2 = tmp;
if (Object.keys(headers).length > 0) {
const obj2 = {};
const merged = Object.assign(tmp);
obj2.headers = headers;
const items2 = [obj2];
tmp2 = items2;
}
}
}
}
return tmp2;
};