| Server IP : 159.203.156.69 / Your IP : 216.73.216.37 Web Server : nginx/1.24.0 System : Linux main-ubuntu 6.8.0-71-generic #71-Ubuntu SMP PREEMPT_DYNAMIC Tue Jul 22 16:52:38 UTC 2025 x86_64 User : root ( 0) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/tanviranik.com/node_modules/unpic/script/src/providers/ |
Upload File : |
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.transform = exports.extract = exports.generate = void 0;
const utils_js_1 = require("../utils.js");
const operationsGenerator = (0, utils_js_1.createOperationsGenerator)({
defaults: {
auto: "webp",
disable: "upscale",
},
});
const generate = (src, operations, { baseURL = "https://images.contentstack.io/" } = {}) => {
if (operations.width && operations.height) {
operations.fit ??= "crop";
}
const modifiers = operationsGenerator(operations);
const url = (0, utils_js_1.toUrl)(src);
if (url.hostname === "n") {
url.protocol = "https:";
url.hostname = new URL(baseURL).hostname;
}
url.search = modifiers;
return (0, utils_js_1.toCanonicalUrlString)(url);
};
exports.generate = generate;
const extract = (url) => {
const { src, operations } = (0, utils_js_1.extractFromURL)(url) ?? {};
if (!operations || !src) {
return null;
}
const { origin } = (0, utils_js_1.toUrl)(url);
return {
src,
operations: operations,
options: {
baseURL: origin,
},
};
};
exports.extract = extract;
exports.transform = (0, utils_js_1.createExtractAndGenerate)(exports.extract, exports.generate);