PageSourceSearch

https://kuto.app/static/useImgix-CRAgJkMW.js

js kuto.app collected 2026-10-07 04:05:39 UTC 2,740 bytes, 103 lines download raw bytes

1import { O as useServer } from "./index-B4tqMR8N.js";
2const IMGIX_PUBLIC_URL = "https://fremont-web-public.imgix.net";
3function getFileStoragePath({
4  path,
5  root
6}) {
7  return "".concat(root != null ? root : "public", "/").concat(path);
8}
9class Imgix {
10  constructor(baseUrl) {
11    this.baseUrl = baseUrl;
12    this.baseUrl = baseUrl;
13  }
14  url(image, params = {}) {
15    if (image.mockUrl) {
16      return image.mockUrl;
17    }
18    const baseUrl = (() => {
19      if (image.imgixBaseUrl) {
20        return image.imgixBaseUrl;
21      } else if (typeof this.baseUrl === "function") {
22        return this.baseUrl(image);
23      } else {
24        return this.baseUrl;
25      }
26    })();
27    let url = "".concat(baseUrl, "/").concat(encodeURIComponent(image.path));
28    let sep = "?";
29    for (const [key, value] of Object.entries(params)) {
30      url += "".concat(sep).concat(key, "=").concat(encodeURIComponent(value));
31      sep = "&";
32    }
33    return url;
34  }
35  async meta(image) {
36    const url = this.url(image, {
37      fm: "json",
38      faces: 1
39    });
40    const response = await fetch(url);
41    const meta = await response.json();
42    return meta;
43  }
44  async palette(image) {
45    const url = this.url(image, {
46      palette: "json"
47    });
48    const response = await fetch(url);
49    if (!response.ok) {
50      throw new Error("Failed to fetch palette");
51    }
52    return await response.json();
53  }
54  async size(image, meta) {
55    const {
56      PixelWidth,
57      PixelHeight,
58      Orientation
59    } = meta != null ? meta : await this.meta(image);
60    if (Orientation === 6 || Orientation === 8) {
61      return {
62        width: PixelHeight,
63        height: PixelWidth
64      };
65    } else {
66      return {
67        width: PixelWidth,
68        height: PixelHeight
69      };
70    }
71  }
72  srcProps(image, params) {
73    const src = this.url(image, params);
74    const srcSet = "\n      ".concat(src, " 1x,\n      ").concat(this.url(image, {
75      ...params,
76      q: 40,
77      dpr: 2
78    }), " 2x,\n      ").concat(this.url(image, {
79      ...params,
80      q: 20,
81      dpr: 3
82    }), " 3x\n    ");
83    return {
84      src,
85      srcSet
86    };
87  }
88}
89function useImgix() {
90  const server = useServer();
91  const localhost = typeof location !== "undefined" ? location.hostname : "localhost";
92  const baseUrl = (image) => {
93    var _a, _b;
94    return ((_a = server.emulators) == null ? void 0 : _a.functions) && ((_b = server.emulators) == null ? void 0 : _b.storage) && image.emulator !== false ? "//".concat(localhost, ":").concat(server.emulators.functions.port, "/fremont-web/us-central1/http/api/imgix") : IMGIX_PUBLIC_URL;
95  };
96  return new Imgix(baseUrl);
97}
98export {
99  IMGIX_PUBLIC_URL as I,
100  Imgix as a,
101  getFileStoragePath as g,
102  useImgix as u
103};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.