@pablopunk/webr 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (126) hide show
  1. package/LICENSE +661 -0
  2. package/README.md +17 -0
  3. package/bin/webr.mjs +11 -0
  4. package/dist/client/_astro/App.BxlQhLhN.css +1 -0
  5. package/dist/client/_astro/App.CzxEZ_Dw.js +2 -0
  6. package/dist/client/_astro/ClientRouter.astro_astro_type_script_index_0_lang.CTgtIFyY.js +1 -0
  7. package/dist/client/_astro/addon-fit.jgKqzwky.js +1 -0
  8. package/dist/client/_astro/addon-web-links.C9lyQRxI.js +1 -0
  9. package/dist/client/_astro/client.BDkzSRUN.js +1 -0
  10. package/dist/client/_astro/client.Bbg9OBwT.js +1 -0
  11. package/dist/client/_astro/client.CLSsMr2g.js +9 -0
  12. package/dist/client/_astro/jetbrains-mono.CFJaiWaY.woff2 +0 -0
  13. package/dist/client/_astro/symbols-nerd.CEdkKAK8.woff2 +0 -0
  14. package/dist/client/_astro/xterm.B-l5AIf6.js +7 -0
  15. package/dist/client/apple-touch-icon.png +0 -0
  16. package/dist/client/brand-mark.png +0 -0
  17. package/dist/client/favicon-16.png +0 -0
  18. package/dist/client/favicon-32.png +0 -0
  19. package/dist/client/favicon.ico +0 -0
  20. package/dist/client/icon-192.png +0 -0
  21. package/dist/client/icon-512.png +0 -0
  22. package/dist/client/icon-maskable-512.png +0 -0
  23. package/dist/client/manifest.webmanifest +30 -0
  24. package/dist/server/chunks/App_BmsGAwGf.mjs +4314 -0
  25. package/dist/server/chunks/_id__u0ueX6GO.mjs +34 -0
  26. package/dist/server/chunks/_tab__DL6wyr-j.mjs +35 -0
  27. package/dist/server/chunks/_virtual_astro_server-island-manifest_C1Q2srgE.mjs +5 -0
  28. package/dist/server/chunks/_virtual_astro_session-driver_DS5V7T-N.mjs +6 -0
  29. package/dist/server/chunks/compiler_CpXox_xS.mjs +35 -0
  30. package/dist/server/chunks/console_CucE1SwS.mjs +170 -0
  31. package/dist/server/chunks/errors_BgIp4W2B.mjs +383 -0
  32. package/dist/server/chunks/index_DyyPce_k.mjs +22 -0
  33. package/dist/server/chunks/new_G7XChx5p.mjs +33 -0
  34. package/dist/server/chunks/node_BlixNyYV.mjs +1816 -0
  35. package/dist/server/chunks/noop-entrypoint_Z3zFhrGC.mjs +4 -0
  36. package/dist/server/chunks/remote_BxuVLM0r.mjs +169 -0
  37. package/dist/server/chunks/server_DS45LC4q.mjs +2496 -0
  38. package/dist/server/chunks/settings_DLV2Js3e.mjs +31 -0
  39. package/dist/server/chunks/sharp_CgNvPCpY.mjs +152 -0
  40. package/dist/server/chunks/vnode-children_CRmaSs5G.mjs +24 -0
  41. package/dist/server/entry.mjs +5837 -0
  42. package/dist/server/virtual_astro_middleware.mjs +4 -0
  43. package/drizzle/0000_gateway.sql +13 -0
  44. package/drizzle/0001_device_sessions.sql +9 -0
  45. package/drizzle/0002_audit_events.sql +7 -0
  46. package/drizzle/meta/_journal.json +1 -0
  47. package/package.json +88 -0
  48. package/server/cli.ts +93 -0
  49. package/server/command.ts +9 -0
  50. package/server/entry.ts +3 -0
  51. package/server/herdr-check.ts +37 -0
  52. package/server/home.ts +4 -0
  53. package/server/log-file.ts +52 -0
  54. package/server/package-info.ts +6 -0
  55. package/server/plugin/config.ts +14 -0
  56. package/server/plugin/dev.ts +27 -0
  57. package/server/plugin/files.ts +10 -0
  58. package/server/plugin/herdr.ts +33 -0
  59. package/server/plugin/index.ts +68 -0
  60. package/server/plugin/probe.ts +17 -0
  61. package/server/plugin/stop.ts +39 -0
  62. package/server/port.ts +8 -0
  63. package/server/run.ts +35 -0
  64. package/server/ssr.ts +23 -0
  65. package/server/start.ts +5 -0
  66. package/server/update/hint.ts +26 -0
  67. package/server/update/index.ts +33 -0
  68. package/server/update/latest.ts +33 -0
  69. package/server/update/package-manager.ts +24 -0
  70. package/server/update/versions.ts +15 -0
  71. package/src/lib/avatars.ts +15 -0
  72. package/src/lib/launch.ts +16 -0
  73. package/src/lib/machines.ts +41 -0
  74. package/src/lib/mock-store.ts +82 -0
  75. package/src/lib/models.ts +139 -0
  76. package/src/lib/project-icons.ts +120 -0
  77. package/src/lib/terminal-split.ts +23 -0
  78. package/src/lib/uuid.ts +10 -0
  79. package/src/server/auth/access.ts +22 -0
  80. package/src/server/auth/audit.ts +15 -0
  81. package/src/server/auth/auth.ts +134 -0
  82. package/src/server/auth/pair-page.ts +85 -0
  83. package/src/server/auth/pairing.ts +91 -0
  84. package/src/server/auth/presence.ts +8 -0
  85. package/src/server/auth/sessions.ts +48 -0
  86. package/src/server/directories.ts +21 -0
  87. package/src/server/dist.ts +3 -0
  88. package/src/server/host.ts +166 -0
  89. package/src/server/perf-log.ts +23 -0
  90. package/src/server/protocol/deadlines.ts +24 -0
  91. package/src/server/protocol/native.ts +10 -0
  92. package/src/server/protocol/ndjson.ts +22 -0
  93. package/src/server/protocol/socket.ts +81 -0
  94. package/src/server/protocol/validate.ts +17 -0
  95. package/src/server/public-urls.ts +17 -0
  96. package/src/server/runtime/herdr-actions.ts +122 -0
  97. package/src/server/runtime/launch.ts +55 -0
  98. package/src/server/runtime/manager.ts +187 -0
  99. package/src/server/runtime/reconcile.ts +51 -0
  100. package/src/server/runtime/supervisor.ts +92 -0
  101. package/src/server/runtime/target.ts +37 -0
  102. package/src/server/runtime/workspace.ts +24 -0
  103. package/src/server/storage/database.ts +88 -0
  104. package/src/server/storage/drizzle-node-sqlite.ts +18 -0
  105. package/src/server/storage/node-sqlite-client.ts +44 -0
  106. package/src/server/storage/schema.ts +25 -0
  107. package/src/server/tailscale-host.ts +17 -0
  108. package/src/server/terminal/cli.ts +44 -0
  109. package/src/server/terminal/hub.ts +140 -0
  110. package/src/server/terminal/writer.ts +38 -0
  111. package/src/server/transport/herdr-target.ts +148 -0
  112. package/src/server/transport/icons.ts +65 -0
  113. package/src/server/transport/identity.ts +5 -0
  114. package/src/server/transport/local-session.ts +65 -0
  115. package/src/server/transport/model-discovery.ts +18 -0
  116. package/src/server/transport/native-locations.ts +17 -0
  117. package/src/server/transport/process.ts +21 -0
  118. package/src/server/transport/registry.ts +27 -0
  119. package/src/server/transport/ssh.ts +47 -0
  120. package/src/server/uploads.ts +40 -0
  121. package/src/server/websockets.ts +62 -0
  122. package/src/shared/agent-kinds.ts +4 -0
  123. package/src/shared/frame.ts +38 -0
  124. package/src/shared/projects.ts +1 -0
  125. package/src/shared/retry.ts +1 -0
  126. package/src/shared/runtime.ts +33 -0
@@ -0,0 +1,1816 @@
1
+ import { R as __exportAll, S as createAstro, b as unescapeHTML, d as maybeRenderHead, p as addAttribute, t as spreadAttributes, u as renderTemplate } from "./server_DS45LC4q.mjs";
2
+ import { $ as UnsupportedImageFormat, A as MissingGetFontFileRequestUrl, F as NoImageMetadata, Q as UnsupportedImageConversion, T as LocalImageUsedWrongly, W as RemoteImageNotAllowed, b as IncompatibleDescriptorOptions, d as ExpectedNotESMImage, f as FailedToFetchRemoteImageDimensions, j as MissingImageDimension, l as ExpectedImage, p as FontFamilyNotFound, t as AstroError, u as ExpectedImageOptions, w as InvalidImageService, y as ImageMissingAlt } from "./errors_BgIp4W2B.mjs";
3
+ import { d as isRemotePath, f as joinPaths, h as removeQueryString, t as isRemoteAllowed, u as isParentDirectory } from "./remote_BxuVLM0r.mjs";
4
+ import { t as createComponent } from "./compiler_CpXox_xS.mjs";
5
+ import { t as createConsoleLogger } from "./console_CucE1SwS.mjs";
6
+ import path from "node:path";
7
+ import { fileURLToPath } from "node:url";
8
+ import * as mime from "mrmime";
9
+ import { readFile } from "node:fs/promises";
10
+ //#region \0virtual:astro:logger
11
+ var level = "info";
12
+ var VALID_SUPPORTED_FORMATS = [
13
+ "jpeg",
14
+ "jpg",
15
+ "png",
16
+ "tiff",
17
+ "webp",
18
+ "gif",
19
+ "svg",
20
+ "avif"
21
+ ];
22
+ var DEFAULT_OUTPUT_FORMAT = "webp";
23
+ var DEFAULT_HASH_PROPS = [
24
+ "src",
25
+ "width",
26
+ "height",
27
+ "format",
28
+ "quality",
29
+ "fit",
30
+ "position",
31
+ "background"
32
+ ];
33
+ //#endregion
34
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/layout.js
35
+ var DEFAULT_RESOLUTIONS = [
36
+ 640,
37
+ 750,
38
+ 828,
39
+ 960,
40
+ 1080,
41
+ 1280,
42
+ 1668,
43
+ 1920,
44
+ 2048,
45
+ 2560,
46
+ 3200,
47
+ 3840,
48
+ 4480,
49
+ 5120,
50
+ 6016
51
+ ];
52
+ var LIMITED_RESOLUTIONS = [
53
+ 640,
54
+ 750,
55
+ 828,
56
+ 1080,
57
+ 1280,
58
+ 1668,
59
+ 2048,
60
+ 2560
61
+ ];
62
+ var getWidths = ({ width, layout, breakpoints = DEFAULT_RESOLUTIONS, originalWidth }) => {
63
+ const smallerThanOriginal = (w) => !originalWidth || w <= originalWidth;
64
+ if (layout === "full-width") return breakpoints.filter(smallerThanOriginal);
65
+ if (!width) return [];
66
+ const doubleWidth = width * 2;
67
+ const maxSize = originalWidth ? Math.min(doubleWidth, originalWidth) : doubleWidth;
68
+ if (layout === "fixed") return originalWidth && width > originalWidth ? [originalWidth] : [width, maxSize];
69
+ if (layout === "constrained") return [
70
+ width,
71
+ doubleWidth,
72
+ ...breakpoints
73
+ ].filter((w) => w <= maxSize).sort((a, b) => a - b);
74
+ return [];
75
+ };
76
+ var getSizesAttribute = ({ width, layout }) => {
77
+ if (!width || !layout) return;
78
+ switch (layout) {
79
+ case "constrained": return `(min-width: ${width}px) ${width}px, 100vw`;
80
+ case "fixed": return `${width}px`;
81
+ case "full-width": return `100vw`;
82
+ default: return;
83
+ }
84
+ };
85
+ //#endregion
86
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/imageKind.js
87
+ function isESMImportedImage(src) {
88
+ return typeof src === "object" || typeof src === "function" && "src" in src;
89
+ }
90
+ function isRemoteImage(src) {
91
+ return typeof src === "string";
92
+ }
93
+ async function resolveSrc(src) {
94
+ if (typeof src === "object" && "then" in src) {
95
+ const resource = await src;
96
+ return resource.default ?? resource;
97
+ }
98
+ return src;
99
+ }
100
+ //#endregion
101
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/inferSourceFormat.js
102
+ var DATA_PREFIX = "data:";
103
+ function inferSourceFormat(src) {
104
+ if (src.startsWith(DATA_PREFIX)) {
105
+ const sepIndex = src.indexOf(";");
106
+ const commaIndex = src.indexOf(",");
107
+ const mimeEnd = sepIndex === -1 ? commaIndex : commaIndex === -1 ? sepIndex : Math.min(sepIndex, commaIndex);
108
+ if (mimeEnd === -1) return void 0;
109
+ const mime = src.slice(5, mimeEnd);
110
+ if (mime === "image/svg+xml") return "svg";
111
+ return mime.split("/")[1] || void 0;
112
+ }
113
+ try {
114
+ const cleanSrc = removeQueryString(src).split("#")[0];
115
+ const lastSlash = cleanSrc.lastIndexOf("/");
116
+ const basename = lastSlash === -1 ? cleanSrc : cleanSrc.slice(lastSlash + 1);
117
+ const lastDot = basename.lastIndexOf(".");
118
+ if (lastDot === -1) return void 0;
119
+ return basename.slice(lastDot + 1).toLowerCase();
120
+ } catch {
121
+ return;
122
+ }
123
+ }
124
+ function resolveDefaultOutputFormat(sourceFormat) {
125
+ return sourceFormat === "svg" ? "svg" : DEFAULT_OUTPUT_FORMAT;
126
+ }
127
+ //#endregion
128
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/utils.js
129
+ var decoder = new TextDecoder();
130
+ var toUTF8String = (input, start = 0, end = input.length) => decoder.decode(input.slice(start, end));
131
+ var toHexString = (input, start = 0, end = input.length) => input.slice(start, end).reduce((memo, i) => memo + `0${i.toString(16)}`.slice(-2), "");
132
+ var getView = (input, offset) => new DataView(input.buffer, input.byteOffset + offset);
133
+ var readInt16LE = (input, offset = 0) => getView(input, offset).getInt16(0, true);
134
+ var readUInt16BE = (input, offset = 0) => getView(input, offset).getUint16(0, false);
135
+ var readUInt16LE = (input, offset = 0) => getView(input, offset).getUint16(0, true);
136
+ var readUInt24LE = (input, offset = 0) => {
137
+ const view = getView(input, offset);
138
+ return view.getUint16(0, true) + (view.getUint8(2) << 16);
139
+ };
140
+ var readInt32LE = (input, offset = 0) => getView(input, offset).getInt32(0, true);
141
+ var readUInt32BE = (input, offset = 0) => getView(input, offset).getUint32(0, false);
142
+ var readUInt32LE = (input, offset = 0) => getView(input, offset).getUint32(0, true);
143
+ var readUInt64 = (input, offset, isBigEndian) => getView(input, offset).getBigUint64(0, !isBigEndian);
144
+ var methods = {
145
+ readUInt16BE,
146
+ readUInt16LE,
147
+ readUInt32BE,
148
+ readUInt32LE
149
+ };
150
+ function readUInt(input, bits, offset = 0, isBigEndian = false) {
151
+ return methods[`readUInt${bits}${isBigEndian ? "BE" : "LE"}`](input, offset);
152
+ }
153
+ var MIN_BOX_HEADER = 8;
154
+ function readBox(input, offset) {
155
+ if (input.length - offset < MIN_BOX_HEADER) return;
156
+ const boxSize = readUInt32BE(input, offset);
157
+ if (boxSize === 0) return {
158
+ name: toUTF8String(input, offset + 4, offset + 8),
159
+ offset,
160
+ size: input.length - offset
161
+ };
162
+ if (boxSize === 1) return;
163
+ if (boxSize < MIN_BOX_HEADER) return;
164
+ if (input.length - offset < boxSize) return;
165
+ return {
166
+ name: toUTF8String(input, offset + 4, offset + 8),
167
+ offset,
168
+ size: boxSize
169
+ };
170
+ }
171
+ function findBox(input, boxName, startOffset) {
172
+ let offset = startOffset;
173
+ while (offset < input.length) {
174
+ const box = readBox(input, offset);
175
+ if (!box) break;
176
+ if (box.name === boxName) return box;
177
+ if (box.size < MIN_BOX_HEADER) break;
178
+ const nextOffset = offset + box.size;
179
+ if (nextOffset <= offset) break;
180
+ offset = nextOffset;
181
+ }
182
+ }
183
+ //#endregion
184
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/bmp.js
185
+ var BMP = {
186
+ validate: (input) => toUTF8String(input, 0, 2) === "BM",
187
+ calculate: (input) => ({
188
+ height: Math.abs(readInt32LE(input, 22)),
189
+ width: readUInt32LE(input, 18)
190
+ })
191
+ };
192
+ //#endregion
193
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/ico.js
194
+ var TYPE_ICON = 1;
195
+ var SIZE_HEADER$1 = 6;
196
+ var SIZE_IMAGE_ENTRY = 16;
197
+ function getSizeFromOffset(input, offset) {
198
+ const value = input[offset];
199
+ return value === 0 ? 256 : value;
200
+ }
201
+ function getImageSize$1(input, imageIndex) {
202
+ const offset = SIZE_HEADER$1 + imageIndex * SIZE_IMAGE_ENTRY;
203
+ return {
204
+ height: getSizeFromOffset(input, offset + 1),
205
+ width: getSizeFromOffset(input, offset)
206
+ };
207
+ }
208
+ var ICO = {
209
+ validate(input) {
210
+ const reserved = readUInt16LE(input, 0);
211
+ const imageCount = readUInt16LE(input, 4);
212
+ if (reserved !== 0 || imageCount === 0) return false;
213
+ return readUInt16LE(input, 2) === TYPE_ICON;
214
+ },
215
+ calculate(input) {
216
+ const nbImages = readUInt16LE(input, 4);
217
+ const imageSize = getImageSize$1(input, 0);
218
+ if (nbImages === 1) return imageSize;
219
+ const images = [];
220
+ for (let imageIndex = 0; imageIndex < nbImages; imageIndex += 1) images.push(getImageSize$1(input, imageIndex));
221
+ return {
222
+ width: imageSize.width,
223
+ height: imageSize.height,
224
+ images
225
+ };
226
+ }
227
+ };
228
+ //#endregion
229
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/cur.js
230
+ var TYPE_CURSOR = 2;
231
+ var CUR = {
232
+ validate(input) {
233
+ const reserved = readUInt16LE(input, 0);
234
+ const imageCount = readUInt16LE(input, 4);
235
+ if (reserved !== 0 || imageCount === 0) return false;
236
+ return readUInt16LE(input, 2) === TYPE_CURSOR;
237
+ },
238
+ calculate: (input) => ICO.calculate(input)
239
+ };
240
+ //#endregion
241
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/dds.js
242
+ var DDS = {
243
+ validate: (input) => readUInt32LE(input, 0) === 542327876,
244
+ calculate: (input) => ({
245
+ height: readUInt32LE(input, 12),
246
+ width: readUInt32LE(input, 16)
247
+ })
248
+ };
249
+ //#endregion
250
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/gif.js
251
+ var gifRegexp = /^GIF8[79]a/;
252
+ var GIF = {
253
+ validate: (input) => gifRegexp.test(toUTF8String(input, 0, 6)),
254
+ calculate: (input) => ({
255
+ height: readUInt16LE(input, 8),
256
+ width: readUInt16LE(input, 6)
257
+ })
258
+ };
259
+ //#endregion
260
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/heif.js
261
+ var brandMap = {
262
+ avif: "avif",
263
+ avis: "avif",
264
+ mif1: "heif",
265
+ msf1: "heif",
266
+ heic: "heic",
267
+ heix: "heic",
268
+ hevc: "heic",
269
+ hevx: "heic"
270
+ };
271
+ function detectType(input, start, end) {
272
+ let hasAvif = false;
273
+ let hasHeic = false;
274
+ let hasHeif = false;
275
+ for (let i = start; i <= end; i += 4) {
276
+ const brand = toUTF8String(input, i, i + 4);
277
+ if (brand === "avif" || brand === "avis") hasAvif = true;
278
+ else if (brand === "heic" || brand === "heix" || brand === "hevc" || brand === "hevx") hasHeic = true;
279
+ else if (brand === "mif1" || brand === "msf1") hasHeif = true;
280
+ }
281
+ if (hasAvif) return "avif";
282
+ if (hasHeic) return "heic";
283
+ if (hasHeif) return "heif";
284
+ }
285
+ var HEIF = {
286
+ validate(input) {
287
+ if (toUTF8String(input, 4, 8) !== "ftyp") return false;
288
+ const ftypBox = findBox(input, "ftyp", 0);
289
+ if (!ftypBox) return false;
290
+ return toUTF8String(input, ftypBox.offset + 8, ftypBox.offset + 12) in brandMap;
291
+ },
292
+ calculate(input) {
293
+ const metaBox = findBox(input, "meta", 0);
294
+ const iprpBox = metaBox && findBox(input, "iprp", metaBox.offset + 12);
295
+ const ipcoBox = iprpBox && findBox(input, "ipco", iprpBox.offset + 8);
296
+ if (!ipcoBox) throw new TypeError("Invalid HEIF, no ipco box found");
297
+ const type = detectType(input, 8, metaBox.offset);
298
+ const images = [];
299
+ let currentOffset = ipcoBox.offset + 8;
300
+ const ipcoEnd = ipcoBox.offset + ipcoBox.size;
301
+ while (currentOffset < ipcoEnd) {
302
+ const ispeBox = findBox(input, "ispe", currentOffset);
303
+ if (!ispeBox) break;
304
+ if (ispeBox.size < 8) break;
305
+ if (ispeBox.offset + ispeBox.size > ipcoEnd) break;
306
+ const rawWidth = readUInt32BE(input, ispeBox.offset + 12);
307
+ const rawHeight = readUInt32BE(input, ispeBox.offset + 16);
308
+ const clapBox = findBox(input, "clap", currentOffset);
309
+ let width = rawWidth;
310
+ let height = rawHeight;
311
+ if (clapBox && clapBox.offset < ipcoEnd && clapBox.size >= 8) width = rawWidth - readUInt32BE(input, clapBox.offset + 12);
312
+ images.push({
313
+ height,
314
+ width
315
+ });
316
+ const nextOffset = ispeBox.offset + ispeBox.size;
317
+ if (nextOffset <= currentOffset) break;
318
+ currentOffset = nextOffset;
319
+ }
320
+ if (images.length === 0) throw new TypeError("Invalid HEIF, no sizes found");
321
+ return {
322
+ width: images[0].width,
323
+ height: images[0].height,
324
+ type,
325
+ ...images.length > 1 ? { images } : {}
326
+ };
327
+ }
328
+ };
329
+ //#endregion
330
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/icns.js
331
+ var SIZE_HEADER = 8;
332
+ var FILE_LENGTH_OFFSET = 4;
333
+ var MIN_ENTRY_LENGTH = 8;
334
+ var ENTRY_LENGTH_OFFSET = 4;
335
+ var ICON_TYPE_SIZE = {
336
+ ICON: 32,
337
+ "ICN#": 32,
338
+ "icm#": 16,
339
+ icm4: 16,
340
+ icm8: 16,
341
+ "ics#": 16,
342
+ ics4: 16,
343
+ ics8: 16,
344
+ is32: 16,
345
+ s8mk: 16,
346
+ icp4: 16,
347
+ icl4: 32,
348
+ icl8: 32,
349
+ il32: 32,
350
+ l8mk: 32,
351
+ icp5: 32,
352
+ ic11: 32,
353
+ ich4: 48,
354
+ ich8: 48,
355
+ ih32: 48,
356
+ h8mk: 48,
357
+ icp6: 64,
358
+ ic12: 32,
359
+ it32: 128,
360
+ t8mk: 128,
361
+ ic07: 128,
362
+ ic08: 256,
363
+ ic13: 256,
364
+ ic09: 512,
365
+ ic14: 512,
366
+ ic10: 1024
367
+ };
368
+ function readImageHeader(input, imageOffset) {
369
+ const imageLengthOffset = imageOffset + ENTRY_LENGTH_OFFSET;
370
+ return [toUTF8String(input, imageOffset, imageLengthOffset), readUInt32BE(input, imageLengthOffset)];
371
+ }
372
+ function getImageSize(type) {
373
+ const size = ICON_TYPE_SIZE[type];
374
+ return {
375
+ width: size,
376
+ height: size,
377
+ type
378
+ };
379
+ }
380
+ var ICNS = {
381
+ validate: (input) => toUTF8String(input, 0, 4) === "icns",
382
+ calculate(input) {
383
+ const inputLength = input.length;
384
+ const fileLength = readUInt32BE(input, FILE_LENGTH_OFFSET);
385
+ let imageOffset = SIZE_HEADER;
386
+ const images = [];
387
+ while (imageOffset < fileLength && imageOffset < inputLength) {
388
+ if (inputLength - imageOffset < MIN_ENTRY_LENGTH) break;
389
+ const imageHeader = readImageHeader(input, imageOffset);
390
+ const entryLength = imageHeader[1];
391
+ if (entryLength < MIN_ENTRY_LENGTH) break;
392
+ const imageSize = getImageSize(imageHeader[0]);
393
+ if (imageSize.width && imageSize.height) images.push(imageSize);
394
+ const nextOffset = imageOffset + entryLength;
395
+ if (nextOffset <= imageOffset) break;
396
+ imageOffset = nextOffset;
397
+ }
398
+ if (images.length === 0) throw new TypeError("Invalid ICNS, no sizes found");
399
+ return {
400
+ width: images[0].width,
401
+ height: images[0].height,
402
+ ...images.length > 1 ? { images } : {}
403
+ };
404
+ }
405
+ };
406
+ //#endregion
407
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/j2c.js
408
+ var J2C = {
409
+ validate: (input) => readUInt32BE(input, 0) === 4283432785,
410
+ calculate: (input) => ({
411
+ height: readUInt32BE(input, 12),
412
+ width: readUInt32BE(input, 8)
413
+ })
414
+ };
415
+ //#endregion
416
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/jp2.js
417
+ var JP2 = {
418
+ validate(input) {
419
+ if (toUTF8String(input, 4, 8) !== "jP ") return false;
420
+ const ftypBox = findBox(input, "ftyp", 0);
421
+ if (!ftypBox) return false;
422
+ return toUTF8String(input, ftypBox.offset + 8, ftypBox.offset + 12) === "jp2 ";
423
+ },
424
+ calculate(input) {
425
+ const jp2hBox = findBox(input, "jp2h", 0);
426
+ const ihdrBox = jp2hBox && jp2hBox.size >= 8 && findBox(input, "ihdr", jp2hBox.offset + 8);
427
+ if (ihdrBox && ihdrBox.size >= 8) return {
428
+ height: readUInt32BE(input, ihdrBox.offset + 8),
429
+ width: readUInt32BE(input, ihdrBox.offset + 12)
430
+ };
431
+ throw new TypeError("Unsupported JPEG 2000 format");
432
+ }
433
+ };
434
+ //#endregion
435
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/jpg.js
436
+ var EXIF_MARKER = "45786966";
437
+ var APP1_DATA_SIZE_BYTES = 2;
438
+ var EXIF_HEADER_BYTES = 6;
439
+ var BIG_ENDIAN_BYTE_ALIGN = "4d4d";
440
+ var LITTLE_ENDIAN_BYTE_ALIGN = "4949";
441
+ var IDF_ENTRY_BYTES = 12;
442
+ function isEXIF(input) {
443
+ return toHexString(input, 2, 6) === EXIF_MARKER;
444
+ }
445
+ function extractSize(input, index) {
446
+ return {
447
+ height: readUInt16BE(input, index),
448
+ width: readUInt16BE(input, index + 2)
449
+ };
450
+ }
451
+ function extractOrientation(exifBlock, isBigEndian) {
452
+ const idfDirectoryEntries = readUInt(exifBlock, 16, 14, isBigEndian);
453
+ for (let directoryEntryNumber = 0; directoryEntryNumber < idfDirectoryEntries; directoryEntryNumber++) {
454
+ const start = 16 + directoryEntryNumber * IDF_ENTRY_BYTES;
455
+ const end = start + IDF_ENTRY_BYTES;
456
+ if (start > exifBlock.length) return;
457
+ const block = exifBlock.slice(start, end);
458
+ if (readUInt(block, 16, 0, isBigEndian) === 274) {
459
+ if (readUInt(block, 16, 2, isBigEndian) !== 3) return;
460
+ if (readUInt(block, 32, 4, isBigEndian) !== 1) return;
461
+ return readUInt(block, 16, 8, isBigEndian);
462
+ }
463
+ }
464
+ }
465
+ function validateExifBlock(input, index) {
466
+ const exifBlock = input.slice(APP1_DATA_SIZE_BYTES, index);
467
+ const byteAlign = toHexString(exifBlock, EXIF_HEADER_BYTES, 8);
468
+ const isBigEndian = byteAlign === BIG_ENDIAN_BYTE_ALIGN;
469
+ if (isBigEndian || byteAlign === LITTLE_ENDIAN_BYTE_ALIGN) return extractOrientation(exifBlock, isBigEndian);
470
+ }
471
+ function validateInput(input, index) {
472
+ if (index > input.length) throw new TypeError("Corrupt JPG, exceeded buffer limits");
473
+ }
474
+ var JPG = {
475
+ validate: (input) => toHexString(input, 0, 2) === "ffd8",
476
+ calculate(_input) {
477
+ let input = _input.slice(4);
478
+ let orientation;
479
+ let next;
480
+ while (input.length) {
481
+ const i = readUInt16BE(input, 0);
482
+ validateInput(input, i);
483
+ if (input[i] !== 255) {
484
+ input = input.slice(1);
485
+ continue;
486
+ }
487
+ if (isEXIF(input)) orientation = validateExifBlock(input, i);
488
+ next = input[i + 1];
489
+ if (next === 192 || next === 193 || next === 194) {
490
+ const size = extractSize(input, i + 5);
491
+ if (!orientation) return size;
492
+ return {
493
+ height: size.height,
494
+ orientation,
495
+ width: size.width
496
+ };
497
+ }
498
+ input = input.slice(i + 2);
499
+ }
500
+ throw new TypeError("Invalid JPG, no size found");
501
+ }
502
+ };
503
+ //#endregion
504
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/utils/bit-reader.js
505
+ var BitReader = class {
506
+ byteOffset = 2;
507
+ bitOffset = 0;
508
+ input;
509
+ endianness;
510
+ constructor(input, endianness) {
511
+ this.input = input;
512
+ this.endianness = endianness;
513
+ }
514
+ /** Reads a specified number of bits, and move the offset */
515
+ getBits(length = 1) {
516
+ let result = 0;
517
+ let bitsRead = 0;
518
+ while (bitsRead < length) {
519
+ if (this.byteOffset >= this.input.length) throw new Error("Reached end of input");
520
+ const currentByte = this.input[this.byteOffset];
521
+ const bitsLeft = 8 - this.bitOffset;
522
+ const bitsToRead = Math.min(length - bitsRead, bitsLeft);
523
+ if (this.endianness === "little-endian") {
524
+ const mask = (1 << bitsToRead) - 1;
525
+ const bits = currentByte >> this.bitOffset & mask;
526
+ result |= bits << bitsRead;
527
+ } else {
528
+ const bits = (currentByte & (1 << bitsToRead) - 1 << 8 - this.bitOffset - bitsToRead) >> 8 - this.bitOffset - bitsToRead;
529
+ result = result << bitsToRead | bits;
530
+ }
531
+ bitsRead += bitsToRead;
532
+ this.bitOffset += bitsToRead;
533
+ if (this.bitOffset === 8) {
534
+ this.byteOffset++;
535
+ this.bitOffset = 0;
536
+ }
537
+ }
538
+ return result;
539
+ }
540
+ };
541
+ //#endregion
542
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/jxl-stream.js
543
+ function calculateImageDimension(reader, isSmallImage) {
544
+ if (isSmallImage) return 8 * (1 + reader.getBits(5));
545
+ const extraBits = [
546
+ 9,
547
+ 13,
548
+ 18,
549
+ 30
550
+ ][reader.getBits(2)];
551
+ return 1 + reader.getBits(extraBits);
552
+ }
553
+ function calculateImageWidth(reader, isSmallImage, widthMode, height) {
554
+ if (isSmallImage && widthMode === 0) return 8 * (1 + reader.getBits(5));
555
+ if (widthMode === 0) return calculateImageDimension(reader, false);
556
+ return Math.floor(height * [
557
+ 1,
558
+ 1.2,
559
+ 4 / 3,
560
+ 1.5,
561
+ 16 / 9,
562
+ 5 / 4,
563
+ 2
564
+ ][widthMode - 1]);
565
+ }
566
+ var JXLStream = {
567
+ validate: (input) => {
568
+ return toHexString(input, 0, 2) === "ff0a";
569
+ },
570
+ calculate(input) {
571
+ const reader = new BitReader(input, "little-endian");
572
+ const isSmallImage = reader.getBits(1) === 1;
573
+ const height = calculateImageDimension(reader, isSmallImage);
574
+ return {
575
+ width: calculateImageWidth(reader, isSmallImage, reader.getBits(3), height),
576
+ height
577
+ };
578
+ }
579
+ };
580
+ //#endregion
581
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/jxl.js
582
+ function extractCodestream(input) {
583
+ const jxlcBox = findBox(input, "jxlc", 0);
584
+ if (jxlcBox && jxlcBox.size >= 8) return input.slice(jxlcBox.offset + 8, jxlcBox.offset + jxlcBox.size);
585
+ const partialStreams = extractPartialStreams(input);
586
+ if (partialStreams.length > 0) return concatenateCodestreams(partialStreams);
587
+ }
588
+ function extractPartialStreams(input) {
589
+ const partialStreams = [];
590
+ let offset = 0;
591
+ while (offset < input.length) {
592
+ const jxlpBox = findBox(input, "jxlp", offset);
593
+ if (!jxlpBox) break;
594
+ if (jxlpBox.size < 12) break;
595
+ partialStreams.push(input.slice(jxlpBox.offset + 12, jxlpBox.offset + jxlpBox.size));
596
+ const nextOffset = jxlpBox.offset + jxlpBox.size;
597
+ if (nextOffset <= offset) break;
598
+ offset = nextOffset;
599
+ }
600
+ return partialStreams;
601
+ }
602
+ function concatenateCodestreams(partialCodestreams) {
603
+ const totalLength = partialCodestreams.reduce((acc, curr) => acc + curr.length, 0);
604
+ const codestream = new Uint8Array(totalLength);
605
+ let position = 0;
606
+ for (const partial of partialCodestreams) {
607
+ codestream.set(partial, position);
608
+ position += partial.length;
609
+ }
610
+ return codestream;
611
+ }
612
+ var JXL = {
613
+ validate: (input) => {
614
+ if (toUTF8String(input, 4, 8) !== "JXL ") return false;
615
+ const ftypBox = findBox(input, "ftyp", 0);
616
+ if (!ftypBox) return false;
617
+ return toUTF8String(input, ftypBox.offset + 8, ftypBox.offset + 12) === "jxl ";
618
+ },
619
+ calculate(input) {
620
+ const codestream = extractCodestream(input);
621
+ if (codestream) return JXLStream.calculate(codestream);
622
+ throw new Error("No codestream found in JXL container");
623
+ }
624
+ };
625
+ //#endregion
626
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/ktx.js
627
+ var KTX = {
628
+ validate: (input) => {
629
+ const signature = toUTF8String(input, 1, 7);
630
+ return ["KTX 11", "KTX 20"].includes(signature);
631
+ },
632
+ calculate: (input) => {
633
+ const type = input[5] === 49 ? "ktx" : "ktx2";
634
+ const offset = type === "ktx" ? 36 : 20;
635
+ return {
636
+ height: readUInt32LE(input, offset + 4),
637
+ width: readUInt32LE(input, offset),
638
+ type
639
+ };
640
+ }
641
+ };
642
+ //#endregion
643
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/png.js
644
+ var pngSignature = "PNG\r\n\n";
645
+ var pngImageHeaderChunkName = "IHDR";
646
+ var pngFriedChunkName = "CgBI";
647
+ var PNG = {
648
+ validate(input) {
649
+ if (pngSignature === toUTF8String(input, 1, 8)) {
650
+ let chunkName = toUTF8String(input, 12, 16);
651
+ if (chunkName === pngFriedChunkName) chunkName = toUTF8String(input, 28, 32);
652
+ if (chunkName !== pngImageHeaderChunkName) throw new TypeError("Invalid PNG");
653
+ return true;
654
+ }
655
+ return false;
656
+ },
657
+ calculate(input) {
658
+ if (toUTF8String(input, 12, 16) === pngFriedChunkName) return {
659
+ height: readUInt32BE(input, 36),
660
+ width: readUInt32BE(input, 32)
661
+ };
662
+ return {
663
+ height: readUInt32BE(input, 20),
664
+ width: readUInt32BE(input, 16)
665
+ };
666
+ }
667
+ };
668
+ //#endregion
669
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/pnm.js
670
+ var PNMTypes = {
671
+ P1: "pbm/ascii",
672
+ P2: "pgm/ascii",
673
+ P3: "ppm/ascii",
674
+ P4: "pbm",
675
+ P5: "pgm",
676
+ P6: "ppm",
677
+ P7: "pam",
678
+ PF: "pfm"
679
+ };
680
+ var handlers = {
681
+ default: (lines) => {
682
+ let dimensions = [];
683
+ while (lines.length > 0) {
684
+ const line = lines.shift();
685
+ if (line[0] === "#") continue;
686
+ dimensions = line.split(" ");
687
+ break;
688
+ }
689
+ if (dimensions.length === 2) return {
690
+ height: Number.parseInt(dimensions[1], 10),
691
+ width: Number.parseInt(dimensions[0], 10)
692
+ };
693
+ throw new TypeError("Invalid PNM");
694
+ },
695
+ pam: (lines) => {
696
+ const size = {};
697
+ while (lines.length > 0) {
698
+ const line = lines.shift();
699
+ if (line.length > 16 || line.charCodeAt(0) > 128) continue;
700
+ const [key, value] = line.split(" ");
701
+ if (key && value) size[key.toLowerCase()] = Number.parseInt(value, 10);
702
+ if (size.height && size.width) break;
703
+ }
704
+ if (size.height && size.width) return {
705
+ height: size.height,
706
+ width: size.width
707
+ };
708
+ throw new TypeError("Invalid PAM");
709
+ }
710
+ };
711
+ var PNM = {
712
+ validate: (input) => toUTF8String(input, 0, 2) in PNMTypes,
713
+ calculate(input) {
714
+ const type = PNMTypes[toUTF8String(input, 0, 2)];
715
+ const lines = toUTF8String(input, 3).split(/[\r\n]+/);
716
+ return (handlers[type] || handlers.default)(lines);
717
+ }
718
+ };
719
+ //#endregion
720
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/psd.js
721
+ var PSD = {
722
+ validate: (input) => toUTF8String(input, 0, 4) === "8BPS",
723
+ calculate: (input) => ({
724
+ height: readUInt32BE(input, 14),
725
+ width: readUInt32BE(input, 18)
726
+ })
727
+ };
728
+ //#endregion
729
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/svg.js
730
+ var svgReg = /<svg\s([^>"']|"[^"]*"|'[^']*')*>/;
731
+ var extractorRegExps = {
732
+ height: /\sheight=(['"])([^%]+?)\1/,
733
+ root: svgReg,
734
+ viewbox: /\sviewBox=(['"])(.+?)\1/i,
735
+ width: /\swidth=(['"])([^%]+?)\1/
736
+ };
737
+ var INCH_CM = 2.54;
738
+ var units = {
739
+ in: 96,
740
+ cm: 96 / INCH_CM,
741
+ em: 16,
742
+ ex: 8,
743
+ m: 96 / INCH_CM * 100,
744
+ mm: 96 / INCH_CM / 10,
745
+ pc: 96 / 72 / 12,
746
+ pt: 96 / 72,
747
+ px: 1
748
+ };
749
+ var unitsReg = new RegExp(`^([0-9.]+(?:e\\d+)?)(${Object.keys(units).join("|")})?$`);
750
+ function parseLength(len) {
751
+ const m = unitsReg.exec(len);
752
+ if (!m) return;
753
+ return Math.round(Number(m[1]) * (units[m[2]] || 1));
754
+ }
755
+ function parseViewbox(viewbox) {
756
+ const bounds = viewbox.split(" ");
757
+ return {
758
+ height: parseLength(bounds[3]),
759
+ width: parseLength(bounds[2])
760
+ };
761
+ }
762
+ function parseAttributes(root) {
763
+ const width = extractorRegExps.width.exec(root);
764
+ const height = extractorRegExps.height.exec(root);
765
+ const viewbox = extractorRegExps.viewbox.exec(root);
766
+ return {
767
+ height: height && parseLength(height[2]),
768
+ viewbox: viewbox && parseViewbox(viewbox[2]),
769
+ width: width && parseLength(width[2])
770
+ };
771
+ }
772
+ function calculateByDimensions(attrs) {
773
+ return {
774
+ height: attrs.height,
775
+ width: attrs.width
776
+ };
777
+ }
778
+ function calculateByViewbox(attrs, viewbox) {
779
+ const ratio = viewbox.width / viewbox.height;
780
+ if (attrs.width) return {
781
+ height: Math.floor(attrs.width / ratio),
782
+ width: attrs.width
783
+ };
784
+ if (attrs.height) return {
785
+ height: attrs.height,
786
+ width: Math.floor(attrs.height * ratio)
787
+ };
788
+ return {
789
+ height: viewbox.height,
790
+ width: viewbox.width
791
+ };
792
+ }
793
+ var SVG = {
794
+ validate: (input) => svgReg.test(toUTF8String(input, 0, 1e3)),
795
+ calculate(input) {
796
+ const root = extractorRegExps.root.exec(toUTF8String(input));
797
+ if (root) {
798
+ const attrs = parseAttributes(root[0]);
799
+ if (attrs.width != null && attrs.height != null) return calculateByDimensions(attrs);
800
+ if (attrs.viewbox) return calculateByViewbox(attrs, attrs.viewbox);
801
+ }
802
+ throw new TypeError("Invalid SVG");
803
+ }
804
+ };
805
+ //#endregion
806
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/tga.js
807
+ var TGA = {
808
+ validate(input) {
809
+ return readUInt16LE(input, 0) === 0 && readUInt16LE(input, 4) === 0;
810
+ },
811
+ calculate(input) {
812
+ return {
813
+ height: readUInt16LE(input, 14),
814
+ width: readUInt16LE(input, 12)
815
+ };
816
+ }
817
+ };
818
+ //#endregion
819
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/tiff.js
820
+ var CONSTANTS = {
821
+ TAG: {
822
+ WIDTH: 256,
823
+ HEIGHT: 257,
824
+ COMPRESSION: 259
825
+ },
826
+ TYPE: {
827
+ SHORT: 3,
828
+ LONG: 4,
829
+ LONG8: 16
830
+ },
831
+ ENTRY_SIZE: {
832
+ STANDARD: 12,
833
+ BIG: 20
834
+ },
835
+ COUNT_SIZE: {
836
+ STANDARD: 2,
837
+ BIG: 8
838
+ }
839
+ };
840
+ function readIFD(input, { isBigEndian, isBigTiff }) {
841
+ const ifdOffset = isBigTiff ? Number(readUInt64(input, 8, isBigEndian)) : readUInt(input, 32, 4, isBigEndian);
842
+ const entryCountSize = isBigTiff ? CONSTANTS.COUNT_SIZE.BIG : CONSTANTS.COUNT_SIZE.STANDARD;
843
+ return input.slice(ifdOffset + entryCountSize);
844
+ }
845
+ function readTagValue(input, type, offset, isBigEndian) {
846
+ switch (type) {
847
+ case CONSTANTS.TYPE.SHORT: return readUInt(input, 16, offset, isBigEndian);
848
+ case CONSTANTS.TYPE.LONG: return readUInt(input, 32, offset, isBigEndian);
849
+ case CONSTANTS.TYPE.LONG8: {
850
+ const value = Number(readUInt64(input, offset, isBigEndian));
851
+ if (value > Number.MAX_SAFE_INTEGER) throw new TypeError("Value too large");
852
+ return value;
853
+ }
854
+ default: return 0;
855
+ }
856
+ }
857
+ function nextTag(input, isBigTiff) {
858
+ const entrySize = isBigTiff ? CONSTANTS.ENTRY_SIZE.BIG : CONSTANTS.ENTRY_SIZE.STANDARD;
859
+ if (input.length > entrySize) return input.slice(entrySize);
860
+ }
861
+ function extractTags(input, { isBigEndian, isBigTiff }) {
862
+ const tags = {};
863
+ let temp = input;
864
+ while (temp?.length) {
865
+ const code = readUInt(temp, 16, 0, isBigEndian);
866
+ const type = readUInt(temp, 16, 2, isBigEndian);
867
+ const length = isBigTiff ? Number(readUInt64(temp, 4, isBigEndian)) : readUInt(temp, 32, 4, isBigEndian);
868
+ if (code === 0) break;
869
+ if (length === 1 && (type === CONSTANTS.TYPE.SHORT || type === CONSTANTS.TYPE.LONG || isBigTiff && type === CONSTANTS.TYPE.LONG8)) tags[code] = readTagValue(temp, type, isBigTiff ? 12 : 8, isBigEndian);
870
+ temp = nextTag(temp, isBigTiff);
871
+ }
872
+ return tags;
873
+ }
874
+ function determineFormat(input) {
875
+ const signature = toUTF8String(input, 0, 2);
876
+ const version = readUInt(input, 16, 2, signature === "MM");
877
+ return {
878
+ isBigEndian: signature === "MM",
879
+ isBigTiff: version === 43
880
+ };
881
+ }
882
+ function validateBigTIFFHeader(input, isBigEndian) {
883
+ const byteSize = readUInt(input, 16, 4, isBigEndian);
884
+ const reserved = readUInt(input, 16, 6, isBigEndian);
885
+ if (byteSize !== 8 || reserved !== 0) throw new TypeError("Invalid BigTIFF header");
886
+ }
887
+ var signatures = /* @__PURE__ */ new Set([
888
+ "49492a00",
889
+ "4d4d002a",
890
+ "49492b00",
891
+ "4d4d002b"
892
+ ]);
893
+ var TIFF = {
894
+ validate: (input) => {
895
+ const signature = toHexString(input, 0, 4);
896
+ return signatures.has(signature);
897
+ },
898
+ calculate(input) {
899
+ const format = determineFormat(input);
900
+ if (format.isBigTiff) validateBigTIFFHeader(input, format.isBigEndian);
901
+ const tags = extractTags(readIFD(input, format), format);
902
+ const info = {
903
+ height: tags[CONSTANTS.TAG.HEIGHT],
904
+ width: tags[CONSTANTS.TAG.WIDTH],
905
+ type: format.isBigTiff ? "bigtiff" : "tiff"
906
+ };
907
+ if (tags[CONSTANTS.TAG.COMPRESSION]) info.compression = tags[CONSTANTS.TAG.COMPRESSION];
908
+ if (!info.width || !info.height) throw new TypeError("Invalid Tiff. Missing tags");
909
+ return info;
910
+ }
911
+ };
912
+ //#endregion
913
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/webp.js
914
+ function calculateExtended(input) {
915
+ return {
916
+ height: 1 + readUInt24LE(input, 7),
917
+ width: 1 + readUInt24LE(input, 4)
918
+ };
919
+ }
920
+ function calculateLossless(input) {
921
+ return {
922
+ height: 1 + ((input[4] & 15) << 10 | input[3] << 2 | (input[2] & 192) >> 6),
923
+ width: 1 + ((input[2] & 63) << 8 | input[1])
924
+ };
925
+ }
926
+ function calculateLossy(input) {
927
+ return {
928
+ height: readInt16LE(input, 8) & 16383,
929
+ width: readInt16LE(input, 6) & 16383
930
+ };
931
+ }
932
+ //#endregion
933
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/types/index.js
934
+ var typeHandlers = /* @__PURE__ */ new Map([
935
+ ["bmp", BMP],
936
+ ["cur", CUR],
937
+ ["dds", DDS],
938
+ ["gif", GIF],
939
+ ["heif", HEIF],
940
+ ["icns", ICNS],
941
+ ["ico", ICO],
942
+ ["j2c", J2C],
943
+ ["jp2", JP2],
944
+ ["jpg", JPG],
945
+ ["jxl", JXL],
946
+ ["jxl-stream", JXLStream],
947
+ ["ktx", KTX],
948
+ ["png", PNG],
949
+ ["pnm", PNM],
950
+ ["psd", PSD],
951
+ ["svg", SVG],
952
+ ["tga", TGA],
953
+ ["tiff", TIFF],
954
+ ["webp", {
955
+ validate(input) {
956
+ const riffHeader = "RIFF" === toUTF8String(input, 0, 4);
957
+ const webpHeader = "WEBP" === toUTF8String(input, 8, 12);
958
+ const vp8Header = "VP8" === toUTF8String(input, 12, 15);
959
+ return riffHeader && webpHeader && vp8Header;
960
+ },
961
+ calculate(_input) {
962
+ const chunkHeader = toUTF8String(_input, 12, 16);
963
+ const input = _input.slice(20, 30);
964
+ if (chunkHeader === "VP8X") {
965
+ const extendedHeader = input[0];
966
+ const validStart = (extendedHeader & 192) === 0;
967
+ const validEnd = (extendedHeader & 1) === 0;
968
+ if (validStart && validEnd) return calculateExtended(input);
969
+ throw new TypeError("Invalid WebP");
970
+ }
971
+ if (chunkHeader === "VP8 " && input[0] !== 47) return calculateLossy(input);
972
+ const signature = toHexString(input, 3, 6);
973
+ if (chunkHeader === "VP8L" && signature !== "9d012a") return calculateLossless(input);
974
+ throw new TypeError("Invalid WebP");
975
+ }
976
+ }]
977
+ ]);
978
+ var types = Array.from(typeHandlers.keys());
979
+ //#endregion
980
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/detector.js
981
+ var firstBytes = /* @__PURE__ */ new Map([
982
+ [0, "heif"],
983
+ [56, "psd"],
984
+ [66, "bmp"],
985
+ [68, "dds"],
986
+ [71, "gif"],
987
+ [73, "tiff"],
988
+ [77, "tiff"],
989
+ [82, "webp"],
990
+ [105, "icns"],
991
+ [137, "png"],
992
+ [255, "jpg"]
993
+ ]);
994
+ function detector(input) {
995
+ const byte = input[0];
996
+ const type = firstBytes.get(byte);
997
+ if (type && typeHandlers.get(type).validate(input)) return type;
998
+ return types.find((imageType) => typeHandlers.get(imageType).validate(input));
999
+ }
1000
+ //#endregion
1001
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/vendor/image-size/lookup.js
1002
+ function lookup(input) {
1003
+ const type = detector(input);
1004
+ if (typeof type !== "undefined") {
1005
+ const size = typeHandlers.get(type).calculate(input);
1006
+ if (size !== void 0) {
1007
+ size.type = size.type ?? type;
1008
+ return size;
1009
+ }
1010
+ }
1011
+ throw new TypeError("unsupported file type: " + type);
1012
+ }
1013
+ //#endregion
1014
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/metadata.js
1015
+ async function imageMetadata(data, src) {
1016
+ let result;
1017
+ try {
1018
+ result = lookup(data);
1019
+ } catch {
1020
+ throw new AstroError({
1021
+ ...NoImageMetadata,
1022
+ message: NoImageMetadata.message(src)
1023
+ });
1024
+ }
1025
+ if (result.height == null || result.width == null || !result.type) throw new AstroError({
1026
+ ...NoImageMetadata,
1027
+ message: NoImageMetadata.message(src)
1028
+ });
1029
+ const { width, height, type, orientation } = result;
1030
+ const isPortrait = (orientation || 0) >= 5;
1031
+ return {
1032
+ width: isPortrait ? height : width,
1033
+ height: isPortrait ? width : height,
1034
+ format: type,
1035
+ orientation
1036
+ };
1037
+ }
1038
+ //#endregion
1039
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/redirectValidation.js
1040
+ async function fetchWithRedirects(options) {
1041
+ const { url, headers, imageConfig, fetchFn = globalThis.fetch, redirectLimit = 10, onMaxRedirectsExceeded = (_u) => /* @__PURE__ */ new Error("Maximum redirect depth exceeded"), onMissingLocationHeader = (_s, _u) => /* @__PURE__ */ new Error(`Redirect response ${_s} missing Location header`), onDisallowedRedirect = (_current, _target) => /* @__PURE__ */ new Error(`The image at ${_current} redirected to ${_target}, which is not an allowed remote location.`) } = options;
1042
+ if (redirectLimit <= 0) throw onMaxRedirectsExceeded(typeof url === "string" ? url : url.toString());
1043
+ const urlString = typeof url === "string" ? url : url.toString();
1044
+ const res = await fetchFn(new Request(url, { headers }), { redirect: "manual" });
1045
+ if ([
1046
+ 301,
1047
+ 302,
1048
+ 303,
1049
+ 307,
1050
+ 308
1051
+ ].includes(res.status)) {
1052
+ const location = res.headers.get("Location");
1053
+ if (!location) throw onMissingLocationHeader(res.status, urlString);
1054
+ const redirectUrl = new URL(location, urlString).toString();
1055
+ if (!isRemoteAllowed(redirectUrl, {
1056
+ domains: imageConfig.domains ?? [],
1057
+ remotePatterns: imageConfig.remotePatterns ?? []
1058
+ })) throw onDisallowedRedirect(urlString, redirectUrl);
1059
+ return fetchWithRedirects({
1060
+ url: redirectUrl,
1061
+ headers,
1062
+ imageConfig,
1063
+ fetchFn,
1064
+ redirectLimit: redirectLimit - 1,
1065
+ onMaxRedirectsExceeded,
1066
+ onMissingLocationHeader,
1067
+ onDisallowedRedirect
1068
+ });
1069
+ }
1070
+ return res;
1071
+ }
1072
+ //#endregion
1073
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/remoteProbe.js
1074
+ async function inferRemoteSize$1(url, imageConfig) {
1075
+ if (!URL.canParse(url)) throw new AstroError({
1076
+ ...FailedToFetchRemoteImageDimensions,
1077
+ message: FailedToFetchRemoteImageDimensions.message(url)
1078
+ });
1079
+ const allowlistConfig = imageConfig ? {
1080
+ domains: imageConfig.domains ?? [],
1081
+ remotePatterns: imageConfig.remotePatterns ?? []
1082
+ } : void 0;
1083
+ if (!allowlistConfig) {
1084
+ const parsedUrl = new URL(url);
1085
+ if (!["http:", "https:"].includes(parsedUrl.protocol)) throw new AstroError({
1086
+ ...FailedToFetchRemoteImageDimensions,
1087
+ message: FailedToFetchRemoteImageDimensions.message(url)
1088
+ });
1089
+ }
1090
+ if (allowlistConfig && !isRemoteAllowed(url, allowlistConfig)) throw new AstroError({
1091
+ ...RemoteImageNotAllowed,
1092
+ message: RemoteImageNotAllowed.message(url)
1093
+ });
1094
+ let response;
1095
+ try {
1096
+ response = await fetchWithRedirects({
1097
+ url,
1098
+ onMaxRedirectsExceeded: (u) => new AstroError({
1099
+ ...FailedToFetchRemoteImageDimensions,
1100
+ message: FailedToFetchRemoteImageDimensions.message(u)
1101
+ }),
1102
+ onMissingLocationHeader: (_status, u) => new AstroError({
1103
+ ...FailedToFetchRemoteImageDimensions,
1104
+ message: FailedToFetchRemoteImageDimensions.message(u)
1105
+ }),
1106
+ imageConfig: imageConfig ?? {
1107
+ remotePatterns: [],
1108
+ domains: []
1109
+ }
1110
+ });
1111
+ } catch (_err) {
1112
+ throw new AstroError({
1113
+ ...FailedToFetchRemoteImageDimensions,
1114
+ message: FailedToFetchRemoteImageDimensions.message(url)
1115
+ });
1116
+ }
1117
+ if (allowlistConfig && !isRemoteAllowed(response.url, allowlistConfig)) throw new AstroError({
1118
+ ...RemoteImageNotAllowed,
1119
+ message: RemoteImageNotAllowed.message(url)
1120
+ });
1121
+ if (!response.body || !response.ok) throw new AstroError({
1122
+ ...FailedToFetchRemoteImageDimensions,
1123
+ message: FailedToFetchRemoteImageDimensions.message(url)
1124
+ });
1125
+ const reader = response.body.getReader();
1126
+ let done, value;
1127
+ let accumulatedChunks = /* @__PURE__ */ new Uint8Array();
1128
+ while (!done) {
1129
+ const readResult = await reader.read();
1130
+ done = readResult.done;
1131
+ if (done) break;
1132
+ if (readResult.value) {
1133
+ value = readResult.value;
1134
+ let tmp = new Uint8Array(accumulatedChunks.length + value.length);
1135
+ tmp.set(accumulatedChunks, 0);
1136
+ tmp.set(value, accumulatedChunks.length);
1137
+ accumulatedChunks = tmp;
1138
+ try {
1139
+ const dimensions = await imageMetadata(accumulatedChunks, url);
1140
+ if (dimensions) {
1141
+ await reader.cancel();
1142
+ return dimensions;
1143
+ }
1144
+ } catch {}
1145
+ }
1146
+ }
1147
+ throw new AstroError({
1148
+ ...NoImageMetadata,
1149
+ message: NoImageMetadata.message(url)
1150
+ });
1151
+ }
1152
+ //#endregion
1153
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/services/service.js
1154
+ function isLocalService(service) {
1155
+ if (!service) return false;
1156
+ return "transform" in service;
1157
+ }
1158
+ function parseQuality(quality) {
1159
+ let result = Number.parseInt(quality);
1160
+ if (Number.isNaN(result)) return quality;
1161
+ return result;
1162
+ }
1163
+ var sortNumeric = (a, b) => a - b;
1164
+ function verifyOptions(options) {
1165
+ if (!options.src || !isRemoteImage(options.src) && !isESMImportedImage(options.src)) throw new AstroError({
1166
+ ...ExpectedImage,
1167
+ message: ExpectedImage.message(JSON.stringify(options.src), typeof options.src, JSON.stringify(options, (_, v) => v === void 0 ? null : v))
1168
+ });
1169
+ if (!isESMImportedImage(options.src)) {
1170
+ if (options.src.startsWith("/@fs/") || !isRemotePath(options.src) && !options.src.startsWith("/")) throw new AstroError({
1171
+ ...LocalImageUsedWrongly,
1172
+ message: LocalImageUsedWrongly.message(options.src)
1173
+ });
1174
+ let missingDimension;
1175
+ if (!options.width && !options.height) missingDimension = "both";
1176
+ else if (!options.width && options.height) missingDimension = "width";
1177
+ else if (options.width && !options.height) missingDimension = "height";
1178
+ if (missingDimension) throw new AstroError({
1179
+ ...MissingImageDimension,
1180
+ message: MissingImageDimension.message(missingDimension, options.src)
1181
+ });
1182
+ } else {
1183
+ if (!VALID_SUPPORTED_FORMATS.includes(options.src.format)) throw new AstroError({
1184
+ ...UnsupportedImageFormat,
1185
+ message: UnsupportedImageFormat.message(options.src.format, options.src.src, VALID_SUPPORTED_FORMATS)
1186
+ });
1187
+ if (options.widths && options.densities) throw new AstroError(IncompatibleDescriptorOptions);
1188
+ if (options.src.format !== "svg" && options.format === "svg") throw new AstroError(UnsupportedImageConversion);
1189
+ }
1190
+ }
1191
+ var baseService = {
1192
+ propertiesToHash: DEFAULT_HASH_PROPS,
1193
+ validateOptions(options) {
1194
+ verifyOptions(options);
1195
+ if (!options.format) {
1196
+ if (isESMImportedImage(options.src)) options.format = resolveDefaultOutputFormat(options.src.format);
1197
+ else {
1198
+ const inferred = inferSourceFormat(options.src);
1199
+ if (inferred) options.format = resolveDefaultOutputFormat(inferred);
1200
+ }
1201
+ }
1202
+ if (options.width) options.width = Math.round(options.width);
1203
+ if (options.height) options.height = Math.round(options.height);
1204
+ if (options.layout) delete options.layout;
1205
+ if (options.fit === "none") delete options.fit;
1206
+ return options;
1207
+ },
1208
+ getHTMLAttributes(options) {
1209
+ const { targetWidth, targetHeight } = getTargetDimensions(options);
1210
+ const { src, width, height, format, quality, densities, widths, formats, layout, priority, fit, position, background, ...attributes } = options;
1211
+ return {
1212
+ ...attributes,
1213
+ width: targetWidth,
1214
+ height: targetHeight,
1215
+ loading: attributes.loading ?? "lazy",
1216
+ decoding: attributes.decoding ?? "async"
1217
+ };
1218
+ },
1219
+ getSrcSet(options) {
1220
+ const { targetWidth, targetHeight } = getTargetDimensions(options);
1221
+ const aspectRatio = targetWidth / targetHeight;
1222
+ const { widths, densities } = options;
1223
+ const targetFormat = options.format;
1224
+ let transformedWidths = (widths ?? []).sort(sortNumeric);
1225
+ let imageWidth = options.width;
1226
+ let maxWidth = Number.POSITIVE_INFINITY;
1227
+ if (isESMImportedImage(options.src)) {
1228
+ imageWidth = options.src.width;
1229
+ maxWidth = imageWidth;
1230
+ if (transformedWidths.length > 0 && transformedWidths.at(-1) > maxWidth) {
1231
+ transformedWidths = transformedWidths.filter((width) => width <= maxWidth);
1232
+ transformedWidths.push(maxWidth);
1233
+ }
1234
+ }
1235
+ transformedWidths = Array.from(new Set(transformedWidths));
1236
+ const { width: transformWidth, height: transformHeight, ...transformWithoutDimensions } = options;
1237
+ let allWidths = [];
1238
+ if (densities) {
1239
+ const densityValues = densities.map((density) => {
1240
+ if (typeof density === "number") return density;
1241
+ else return Number.parseFloat(density);
1242
+ });
1243
+ allWidths = densityValues.sort(sortNumeric).map((density) => Math.round(targetWidth * density)).map((width, index) => ({
1244
+ width,
1245
+ descriptor: `${densityValues[index]}x`
1246
+ }));
1247
+ } else if (transformedWidths.length > 0) allWidths = transformedWidths.map((width) => ({
1248
+ width,
1249
+ descriptor: `${width}w`
1250
+ }));
1251
+ return allWidths.map(({ width, descriptor }) => {
1252
+ const height = Math.round(width / aspectRatio);
1253
+ return {
1254
+ transform: {
1255
+ ...transformWithoutDimensions,
1256
+ width,
1257
+ height
1258
+ },
1259
+ descriptor,
1260
+ attributes: targetFormat ? { type: `image/${targetFormat}` } : {}
1261
+ };
1262
+ });
1263
+ },
1264
+ getURL(options, imageConfig) {
1265
+ const searchParams = new URLSearchParams();
1266
+ if (isESMImportedImage(options.src)) searchParams.append("href", options.src.src);
1267
+ else if (isRemoteAllowed(options.src, imageConfig)) searchParams.append("href", options.src);
1268
+ else return options.src;
1269
+ Object.entries({
1270
+ w: "width",
1271
+ h: "height",
1272
+ q: "quality",
1273
+ f: "format",
1274
+ fit: "fit",
1275
+ position: "position",
1276
+ background: "background"
1277
+ }).forEach(([param, key]) => {
1278
+ options[key] && searchParams.append(param, options[key].toString());
1279
+ });
1280
+ let url = `${joinPaths("/", imageConfig.endpoint.route)}?${searchParams}`;
1281
+ if (imageConfig.assetQueryParams) {
1282
+ const assetQueryString = imageConfig.assetQueryParams.toString();
1283
+ if (assetQueryString) url += "&" + assetQueryString;
1284
+ }
1285
+ return url;
1286
+ },
1287
+ parseURL(url) {
1288
+ const params = url.searchParams;
1289
+ if (!params.has("href")) return;
1290
+ return {
1291
+ src: params.get("href"),
1292
+ width: params.has("w") ? Number.parseInt(params.get("w")) : void 0,
1293
+ height: params.has("h") ? Number.parseInt(params.get("h")) : void 0,
1294
+ format: params.has("f") ? params.get("f") : void 0,
1295
+ quality: params.get("q"),
1296
+ fit: params.get("fit"),
1297
+ position: params.get("position") ?? void 0,
1298
+ background: params.get("background") ?? void 0
1299
+ };
1300
+ },
1301
+ getRemoteSize(url, imageConfig) {
1302
+ return inferRemoteSize$1(url, imageConfig);
1303
+ }
1304
+ };
1305
+ function getTargetDimensions(options) {
1306
+ let targetWidth = options.width;
1307
+ let targetHeight = options.height;
1308
+ if (isESMImportedImage(options.src)) {
1309
+ const aspectRatio = options.src.width / options.src.height;
1310
+ if (targetHeight && !targetWidth) targetWidth = Math.round(targetHeight * aspectRatio);
1311
+ else if (targetWidth && !targetHeight) targetHeight = Math.round(targetWidth / aspectRatio);
1312
+ else if (!targetWidth && !targetHeight) {
1313
+ targetWidth = options.src.width;
1314
+ targetHeight = options.src.height;
1315
+ }
1316
+ }
1317
+ return {
1318
+ targetWidth,
1319
+ targetHeight
1320
+ };
1321
+ }
1322
+ //#endregion
1323
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/types.js
1324
+ function isImageMetadata(src) {
1325
+ return src.fsPath && !("fsPath" in src);
1326
+ }
1327
+ //#endregion
1328
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/url.js
1329
+ var PLACEHOLDER_BASE = "astro://placeholder";
1330
+ function createPlaceholderURL(pathOrUrl) {
1331
+ return new URL(pathOrUrl, PLACEHOLDER_BASE);
1332
+ }
1333
+ function stringifyPlaceholderURL(url) {
1334
+ return url.href.replace(PLACEHOLDER_BASE, "");
1335
+ }
1336
+ //#endregion
1337
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/internal.js
1338
+ var cssFitValues = [
1339
+ "fill",
1340
+ "contain",
1341
+ "cover",
1342
+ "scale-down"
1343
+ ];
1344
+ async function getConfiguredImageService() {
1345
+ if (!globalThis?.astroAsset?.imageService) {
1346
+ const { default: service } = await import("./sharp_CgNvPCpY.mjs").catch((e) => {
1347
+ const error = new AstroError(InvalidImageService);
1348
+ error.cause = e;
1349
+ throw error;
1350
+ });
1351
+ if (!globalThis.astroAsset) globalThis.astroAsset = {};
1352
+ globalThis.astroAsset.imageService = service;
1353
+ return service;
1354
+ }
1355
+ return globalThis.astroAsset.imageService;
1356
+ }
1357
+ async function getImage$1(options, imageConfig, logger) {
1358
+ if (!options || typeof options !== "object") throw new AstroError({
1359
+ ...ExpectedImageOptions,
1360
+ message: ExpectedImageOptions.message(JSON.stringify(options))
1361
+ });
1362
+ if (typeof options.src === "undefined") throw new AstroError({
1363
+ ...ExpectedImage,
1364
+ message: ExpectedImage.message(options.src, "undefined", JSON.stringify(options))
1365
+ });
1366
+ if (isImageMetadata(options)) throw new AstroError(ExpectedNotESMImage);
1367
+ const service = await getConfiguredImageService();
1368
+ const resolvedOptions = {
1369
+ ...options,
1370
+ src: await resolveSrc(options.src)
1371
+ };
1372
+ let originalWidth;
1373
+ let originalHeight;
1374
+ if (resolvedOptions.inferSize) {
1375
+ delete resolvedOptions.inferSize;
1376
+ if (isRemoteImage(resolvedOptions.src) && isRemotePath(resolvedOptions.src)) {
1377
+ if (!isRemoteAllowed(resolvedOptions.src, imageConfig)) throw new AstroError({
1378
+ ...RemoteImageNotAllowed,
1379
+ message: RemoteImageNotAllowed.message(resolvedOptions.src)
1380
+ });
1381
+ const getRemoteSize = (url) => service.getRemoteSize?.(url, imageConfig, logger) ?? inferRemoteSize$1(url, imageConfig);
1382
+ const result = await getRemoteSize(resolvedOptions.src);
1383
+ resolvedOptions.width ??= result.width;
1384
+ resolvedOptions.height ??= result.height;
1385
+ if (result.format) resolvedOptions.format ??= resolveDefaultOutputFormat(result.format);
1386
+ originalWidth = result.width;
1387
+ originalHeight = result.height;
1388
+ }
1389
+ }
1390
+ const originalFilePath = isESMImportedImage(resolvedOptions.src) ? resolvedOptions.src.fsPath : void 0;
1391
+ const clonedSrc = isESMImportedImage(resolvedOptions.src) ? resolvedOptions.src.clone ?? resolvedOptions.src : resolvedOptions.src;
1392
+ if (isESMImportedImage(clonedSrc)) {
1393
+ originalWidth = clonedSrc.width;
1394
+ originalHeight = clonedSrc.height;
1395
+ }
1396
+ if (originalWidth && originalHeight) {
1397
+ const aspectRatio = originalWidth / originalHeight;
1398
+ if (resolvedOptions.height && !resolvedOptions.width) resolvedOptions.width = Math.round(resolvedOptions.height * aspectRatio);
1399
+ else if (resolvedOptions.width && !resolvedOptions.height) resolvedOptions.height = Math.round(resolvedOptions.width / aspectRatio);
1400
+ else if (!resolvedOptions.width && !resolvedOptions.height) {
1401
+ resolvedOptions.width = originalWidth;
1402
+ resolvedOptions.height = originalHeight;
1403
+ }
1404
+ }
1405
+ resolvedOptions.src = clonedSrc;
1406
+ const layout = options.layout ?? imageConfig.layout ?? "none";
1407
+ if (resolvedOptions.priority) {
1408
+ resolvedOptions.loading ??= "eager";
1409
+ resolvedOptions.decoding ??= "sync";
1410
+ resolvedOptions.fetchpriority ??= "high";
1411
+ delete resolvedOptions.priority;
1412
+ } else {
1413
+ resolvedOptions.loading ??= "lazy";
1414
+ resolvedOptions.decoding ??= "async";
1415
+ resolvedOptions.fetchpriority ??= void 0;
1416
+ }
1417
+ if (layout !== "none") {
1418
+ resolvedOptions.widths ||= getWidths({
1419
+ width: resolvedOptions.width,
1420
+ layout,
1421
+ originalWidth,
1422
+ breakpoints: imageConfig.breakpoints?.length ? imageConfig.breakpoints : isLocalService(service) ? LIMITED_RESOLUTIONS : DEFAULT_RESOLUTIONS
1423
+ });
1424
+ resolvedOptions.sizes ||= getSizesAttribute({
1425
+ width: resolvedOptions.width,
1426
+ layout
1427
+ });
1428
+ delete resolvedOptions.densities;
1429
+ resolvedOptions["data-astro-image"] = layout;
1430
+ if (resolvedOptions.fit && cssFitValues.includes(resolvedOptions.fit)) resolvedOptions["data-astro-image-fit"] = resolvedOptions.fit;
1431
+ resolvedOptions["data-astro-image-pos"] = (resolvedOptions.position || "center").replace(/\s+/g, "-");
1432
+ }
1433
+ const validatedOptions = service.validateOptions ? await service.validateOptions(resolvedOptions, imageConfig, logger) : resolvedOptions;
1434
+ validatedOptions.format ??= await peekRemoteFormatForStaticEmit(validatedOptions, imageConfig, service, logger);
1435
+ const srcSetTransforms = service.getSrcSet ? await service.getSrcSet(validatedOptions, imageConfig, logger) : [];
1436
+ const lazyImageURLFactory = (getValue) => {
1437
+ let cached = null;
1438
+ return () => cached ??= getValue();
1439
+ };
1440
+ const initialImageURL = await service.getURL(validatedOptions, imageConfig, logger);
1441
+ let lazyImageURL = lazyImageURLFactory(() => initialImageURL);
1442
+ const matchesValidatedTransform = (transform) => transform.width === validatedOptions.width && transform.height === validatedOptions.height && transform.format === validatedOptions.format;
1443
+ let srcSets = await Promise.all(srcSetTransforms.map(async (srcSet) => {
1444
+ return {
1445
+ transform: srcSet.transform,
1446
+ url: matchesValidatedTransform(srcSet.transform) ? initialImageURL : await service.getURL(srcSet.transform, imageConfig, logger),
1447
+ descriptor: srcSet.descriptor,
1448
+ attributes: srcSet.attributes
1449
+ };
1450
+ }));
1451
+ if (isLocalService(service) && globalThis.astroAsset.addStaticImage && !(isRemoteImage(validatedOptions.src) && initialImageURL === validatedOptions.src)) {
1452
+ const propsToHash = service.propertiesToHash ?? DEFAULT_HASH_PROPS;
1453
+ lazyImageURL = lazyImageURLFactory(() => globalThis.astroAsset.addStaticImage(validatedOptions, propsToHash, originalFilePath));
1454
+ srcSets = srcSetTransforms.map((srcSet) => {
1455
+ return {
1456
+ transform: srcSet.transform,
1457
+ url: matchesValidatedTransform(srcSet.transform) ? lazyImageURL() : globalThis.astroAsset.addStaticImage(srcSet.transform, propsToHash, originalFilePath),
1458
+ descriptor: srcSet.descriptor,
1459
+ attributes: srcSet.attributes
1460
+ };
1461
+ });
1462
+ } else if (imageConfig.assetQueryParams) {
1463
+ const imageURLObj = createPlaceholderURL(initialImageURL);
1464
+ imageConfig.assetQueryParams.forEach((value, key) => {
1465
+ imageURLObj.searchParams.set(key, value);
1466
+ });
1467
+ lazyImageURL = lazyImageURLFactory(() => stringifyPlaceholderURL(imageURLObj));
1468
+ srcSets = srcSets.map((srcSet) => {
1469
+ const urlObj = createPlaceholderURL(srcSet.url);
1470
+ imageConfig.assetQueryParams.forEach((value, key) => {
1471
+ urlObj.searchParams.set(key, value);
1472
+ });
1473
+ return {
1474
+ ...srcSet,
1475
+ url: stringifyPlaceholderURL(urlObj)
1476
+ };
1477
+ });
1478
+ }
1479
+ return {
1480
+ rawOptions: resolvedOptions,
1481
+ options: validatedOptions,
1482
+ get src() {
1483
+ return lazyImageURL();
1484
+ },
1485
+ srcSet: {
1486
+ values: srcSets,
1487
+ attribute: srcSets.map((srcSet) => `${srcSet.url} ${srcSet.descriptor}`).join(", ")
1488
+ },
1489
+ attributes: service.getHTMLAttributes !== void 0 ? await service.getHTMLAttributes(validatedOptions, imageConfig, logger) : {}
1490
+ };
1491
+ }
1492
+ async function peekRemoteFormatForStaticEmit(options, imageConfig, service, logger) {
1493
+ if (!isRemoteImage(options.src) || !isRemoteAllowed(options.src, imageConfig) || !globalThis.astroAsset?.addStaticImage || !isLocalService(service) || !service.getRemoteSize) return;
1494
+ try {
1495
+ return resolveDefaultOutputFormat((await service.getRemoteSize(options.src, imageConfig, logger)).format);
1496
+ } catch {
1497
+ return;
1498
+ }
1499
+ }
1500
+ Function.prototype.toString.call(Object);
1501
+ //#endregion
1502
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/components/Image.astro
1503
+ createAstro("https://astro.build");
1504
+ var $$Image = createComponent(async ($$result, $$props, $$slots) => {
1505
+ const Astro2 = $$result.createAstro($$props, $$slots);
1506
+ Astro2.self = $$Image;
1507
+ const props = Astro2.props;
1508
+ if (props.alt === void 0 || props.alt === null) throw new AstroError(ImageMissingAlt);
1509
+ if (typeof props.width === "string") props.width = Number.parseInt(props.width);
1510
+ if (typeof props.height === "string") props.height = Number.parseInt(props.height);
1511
+ if ((props.layout ?? imageConfig.layout ?? "none") !== "none") {
1512
+ props.layout ??= imageConfig.layout;
1513
+ props.fit ??= imageConfig.objectFit ?? "cover";
1514
+ props.position ??= imageConfig.objectPosition ?? "center";
1515
+ } else if (imageConfig.objectFit || imageConfig.objectPosition) {
1516
+ props.fit ??= imageConfig.objectFit;
1517
+ props.position ??= imageConfig.objectPosition;
1518
+ }
1519
+ const image = await getImage(props);
1520
+ const additionalAttributes = {};
1521
+ if (image.srcSet.values.length > 0) additionalAttributes.srcset = image.srcSet.attribute;
1522
+ const { class: className, ...attributes } = {
1523
+ ...additionalAttributes,
1524
+ ...image.attributes
1525
+ };
1526
+ return renderTemplate`${maybeRenderHead($$result)}<img${addAttribute(image.src, "src")}${spreadAttributes(attributes)}${addAttribute(className, "class")}>`;
1527
+ }, "/Users/pablopunk/src/herdr-web/node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/components/Image.astro", void 0);
1528
+ //#endregion
1529
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/components/Picture.astro
1530
+ createAstro("https://astro.build");
1531
+ var $$Picture = createComponent(async ($$result, $$props, $$slots) => {
1532
+ const Astro2 = $$result.createAstro($$props, $$slots);
1533
+ Astro2.self = $$Picture;
1534
+ const defaultFormats = ["webp"];
1535
+ const defaultFallbackFormat = "png";
1536
+ const specialFormatsFallback = [
1537
+ "gif",
1538
+ "svg",
1539
+ "jpg",
1540
+ "jpeg"
1541
+ ];
1542
+ const { formats = defaultFormats, pictureAttributes = {}, fallbackFormat, ...props } = Astro2.props;
1543
+ if (props.alt === void 0 || props.alt === null) throw new AstroError(ImageMissingAlt);
1544
+ const scopedStyleClass = props.class?.match(/\bastro-\w{8}\b/)?.[0];
1545
+ if (scopedStyleClass) {
1546
+ if (pictureAttributes.class) pictureAttributes.class = `${pictureAttributes.class} ${scopedStyleClass}`;
1547
+ else pictureAttributes.class = scopedStyleClass;
1548
+ }
1549
+ const useResponsive = (props.layout ?? imageConfig.layout ?? "none") !== "none";
1550
+ if (useResponsive) {
1551
+ props.layout ??= imageConfig.layout;
1552
+ props.fit ??= imageConfig.objectFit ?? "cover";
1553
+ props.position ??= imageConfig.objectPosition ?? "center";
1554
+ } else if (imageConfig.objectFit || imageConfig.objectPosition) {
1555
+ props.fit ??= imageConfig.objectFit;
1556
+ props.position ??= imageConfig.objectPosition;
1557
+ }
1558
+ for (const key in props) if (key.startsWith("data-astro-cid")) pictureAttributes[key] = props[key];
1559
+ const originalSrc = await resolveSrc(props.src);
1560
+ if (props.inferSize && isRemoteImage(originalSrc)) {
1561
+ const remoteSize = await inferRemoteSize(originalSrc);
1562
+ delete props.inferSize;
1563
+ props.width ??= remoteSize.width;
1564
+ props.height ??= remoteSize.height;
1565
+ }
1566
+ const optimizedImages = await Promise.all(formats.map(async (format) => await getImage({
1567
+ ...props,
1568
+ src: originalSrc,
1569
+ format,
1570
+ widths: props.widths,
1571
+ densities: props.densities
1572
+ })));
1573
+ const clonedSrc = isESMImportedImage(originalSrc) ? originalSrc.clone ?? originalSrc : originalSrc;
1574
+ let resultFallbackFormat = fallbackFormat ?? defaultFallbackFormat;
1575
+ if (!fallbackFormat && isESMImportedImage(clonedSrc) && specialFormatsFallback.includes(clonedSrc.format)) resultFallbackFormat = clonedSrc.format;
1576
+ const fallbackImage = await getImage({
1577
+ ...props,
1578
+ format: resultFallbackFormat,
1579
+ widths: props.widths,
1580
+ densities: props.densities
1581
+ });
1582
+ const imgAdditionalAttributes = {};
1583
+ const sourceAdditionalAttributes = {};
1584
+ if (props.sizes) sourceAdditionalAttributes.sizes = props.sizes;
1585
+ if (fallbackImage.srcSet.values.length > 0) imgAdditionalAttributes.srcset = fallbackImage.srcSet.attribute;
1586
+ const { class: className, ...attributes } = {
1587
+ ...imgAdditionalAttributes,
1588
+ ...fallbackImage.attributes
1589
+ };
1590
+ return renderTemplate`${maybeRenderHead($$result)}<picture${spreadAttributes(pictureAttributes)}>${Object.entries(optimizedImages).map(([_, image]) => {
1591
+ const srcsetAttribute = props.densities || !props.densities && !props.widths && !useResponsive ? `${image.src}${image.srcSet.values.length > 0 ? ", " + image.srcSet.attribute : ""}` : image.srcSet.attribute;
1592
+ return renderTemplate`<source${addAttribute(srcsetAttribute, "srcset")}${addAttribute(mime.lookup(image.options.format ?? image.src) ?? `image/${image.options.format}`, "type")}${spreadAttributes(sourceAdditionalAttributes)}>`;
1593
+ })}<img${addAttribute(fallbackImage.src, "src")}${spreadAttributes(attributes)}${addAttribute(className, "class")}></picture>`;
1594
+ }, "/Users/pablopunk/src/herdr-web/node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/components/Picture.astro", void 0);
1595
+ //#endregion
1596
+ //#region \0virtual:astro:assets/fonts/internal
1597
+ var componentDataByCssVariable = /* @__PURE__ */ new Map([]);
1598
+ //#endregion
1599
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/fonts/core/filter-preloads.js
1600
+ function filterPreloads(data, preload) {
1601
+ if (!preload) return null;
1602
+ if (preload === true) return data;
1603
+ return data.filter(({ weight, style, subset }) => preload.some((p) => {
1604
+ if (p.weight !== void 0 && weight !== void 0 && !checkWeight(p.weight.toString(), weight)) return false;
1605
+ if (p.style !== void 0 && p.style !== style) return false;
1606
+ if (p.subset !== void 0 && p.subset !== subset) return false;
1607
+ return true;
1608
+ }));
1609
+ }
1610
+ function checkWeight(input, target) {
1611
+ const trimmedInput = input.trim();
1612
+ if (trimmedInput.includes(" ")) return trimmedInput === target;
1613
+ if (target.includes(" ")) {
1614
+ const [a, b] = target.split(" ");
1615
+ const parsedInput = Number.parseInt(input);
1616
+ return parsedInput >= Number.parseInt(a) && parsedInput <= Number.parseInt(b);
1617
+ }
1618
+ return input === target;
1619
+ }
1620
+ //#endregion
1621
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/components/Font.astro
1622
+ createAstro("https://astro.build");
1623
+ var $$Font = createComponent(($$result, $$props, $$slots) => {
1624
+ const Astro = $$result.createAstro($$props, $$slots);
1625
+ Astro.self = $$Font;
1626
+ const { cssVariable, preload = false } = Astro.props;
1627
+ const data = componentDataByCssVariable.get(cssVariable);
1628
+ if (!data) throw new AstroError({
1629
+ ...FontFamilyNotFound,
1630
+ message: FontFamilyNotFound.message(cssVariable)
1631
+ });
1632
+ const filteredPreloadData = filterPreloads(data.preloads, preload);
1633
+ return renderTemplate`<style>${unescapeHTML(data.css)}</style>${filteredPreloadData?.map(({ url, type }) => renderTemplate`<link rel="preload"${addAttribute(url, "href")} as="font"${addAttribute(`font/${type}`, "type")} crossorigin>`)}`;
1634
+ }, "/Users/pablopunk/src/herdr-web/node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/components/Font.astro", void 0);
1635
+ //#endregion
1636
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/fonts/infra/ssr-runtime-font-file-url-resolver.js
1637
+ var SsrRuntimeFontFileUrlResolver = class {
1638
+ #urls;
1639
+ constructor({ urls }) {
1640
+ this.#urls = urls;
1641
+ }
1642
+ resolve(url, requestUrl) {
1643
+ if (!this.#urls.has(url)) return null;
1644
+ if (!url.startsWith("/")) return url;
1645
+ if (!requestUrl) throw new AstroError(MissingGetFontFileRequestUrl);
1646
+ return `${requestUrl.origin}${url}`;
1647
+ }
1648
+ };
1649
+ new SsrRuntimeFontFileUrlResolver({ urls: /* @__PURE__ */ new Set([]) });
1650
+ //#endregion
1651
+ //#region \0astro:assets
1652
+ var _astroLogger = createConsoleLogger({ level });
1653
+ var _runtimeLogger = {
1654
+ info: (message) => _astroLogger.info(null, message),
1655
+ warn: (message) => _astroLogger.warn(null, message),
1656
+ error: (message) => _astroLogger.error(null, message)
1657
+ };
1658
+ var assetQueryParams = void 0;
1659
+ var imageConfig = {
1660
+ "endpoint": {
1661
+ "route": "/_image",
1662
+ "entrypoint": "astro/assets/endpoint/node"
1663
+ },
1664
+ "service": {
1665
+ "entrypoint": "astro/assets/services/sharp",
1666
+ "config": {}
1667
+ },
1668
+ "dangerouslyProcessSVG": false,
1669
+ "domains": [],
1670
+ "remotePatterns": [],
1671
+ "responsiveStyles": false
1672
+ };
1673
+ Object.defineProperty(imageConfig, "assetQueryParams", {
1674
+ value: assetQueryParams,
1675
+ enumerable: false,
1676
+ configurable: true
1677
+ });
1678
+ var inferRemoteSize = async (url) => {
1679
+ return (await getConfiguredImageService()).getRemoteSize?.(url, imageConfig, _runtimeLogger) ?? inferRemoteSize$1(url, imageConfig);
1680
+ };
1681
+ var outDir = /* #__PURE__ */ new URL("file:///Users/pablopunk/src/herdr-web/dist/client/");
1682
+ var serverDir = /* #__PURE__ */ new URL("file:///Users/pablopunk/src/herdr-web/dist/server/");
1683
+ var getImage = async (options) => await getImage$1(options, imageConfig, _runtimeLogger);
1684
+ //#endregion
1685
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/utils/etag.js
1686
+ var fnv1a52 = (str) => {
1687
+ const len = str.length;
1688
+ let i = 0, t0 = 0, v0 = 8997, t1 = 0, v1 = 33826, t2 = 0, v2 = 40164, t3 = 0, v3 = 52210;
1689
+ while (i < len) {
1690
+ v0 ^= str.charCodeAt(i++);
1691
+ t0 = v0 * 435;
1692
+ t1 = v1 * 435;
1693
+ t2 = v2 * 435;
1694
+ t3 = v3 * 435;
1695
+ t2 += v0 << 8;
1696
+ t3 += v1 << 8;
1697
+ t1 += t0 >>> 16;
1698
+ v0 = t0 & 65535;
1699
+ t2 += t1 >>> 16;
1700
+ v1 = t1 & 65535;
1701
+ v3 = t3 + (t2 >>> 16) & 65535;
1702
+ v2 = t2 & 65535;
1703
+ }
1704
+ return (v3 & 15) * 281474976710656 + v2 * 4294967296 + v1 * 65536 + (v0 ^ v3 >> 4);
1705
+ };
1706
+ var etag = (payload, weak = false) => {
1707
+ return (weak ? "W/\"" : "\"") + fnv1a52(payload).toString(36) + payload.length.toString(36) + "\"";
1708
+ };
1709
+ //#endregion
1710
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/endpoint/shared.js
1711
+ var isLocal = (url) => {
1712
+ const hostname = new URL(url).hostname;
1713
+ return hostname === "localhost" || hostname === "127.0.0.1" || hostname === "[::1]";
1714
+ };
1715
+ async function loadRemoteImage(src) {
1716
+ try {
1717
+ const res = await fetchWithRedirects({
1718
+ url: src,
1719
+ imageConfig
1720
+ });
1721
+ if (!isRemoteAllowed(res.url, imageConfig) && !isLocal(res.url)) return;
1722
+ if (!res.ok) return;
1723
+ return Buffer.from(await res.arrayBuffer());
1724
+ } catch {
1725
+ return;
1726
+ }
1727
+ }
1728
+ var handleImageRequest = async ({ request, loadLocalImage, logger }) => {
1729
+ const imageService = await getConfiguredImageService();
1730
+ if (!("transform" in imageService)) throw new Error("Configured image service is not a local service");
1731
+ const url = new URL(request.url);
1732
+ const transform = await imageService.parseURL(url, imageConfig, logger);
1733
+ if (!transform?.src) return new Response("Invalid request", { status: 400 });
1734
+ if (transform.format === "svg") {
1735
+ if (inferSourceFormat(transform.src) !== "svg") return new Response("Cannot convert non-SVG source to SVG format", { status: 403 });
1736
+ }
1737
+ let inputBuffer = void 0;
1738
+ if (isRemotePath(transform.src)) {
1739
+ if (!isRemoteAllowed(transform.src, imageConfig)) return new Response("Forbidden", { status: 403 });
1740
+ inputBuffer = await loadRemoteImage(new URL(transform.src));
1741
+ } else {
1742
+ const result = await loadLocalImage(removeQueryString(transform.src), url);
1743
+ switch (result.kind) {
1744
+ case "invalid-path": return new Response("Invalid request", { status: 400 });
1745
+ case "not-found": return new Response("Not Found", { status: 404 });
1746
+ case "failed": return new Response("Internal Server Error", { status: 500 });
1747
+ case "loaded": inputBuffer = result.buffer;
1748
+ }
1749
+ }
1750
+ if (!inputBuffer) return new Response("Internal Server Error", { status: 500 });
1751
+ const { data, format } = await imageService.transform(inputBuffer, transform, imageConfig, logger);
1752
+ return new Response(data, {
1753
+ status: 200,
1754
+ headers: {
1755
+ "Content-Type": mime.lookup(format) ?? `image/${format}`,
1756
+ "Cache-Control": "public, max-age=31536000",
1757
+ ETag: etag(data.toString()),
1758
+ Date: (/* @__PURE__ */ new Date()).toUTCString()
1759
+ }
1760
+ });
1761
+ };
1762
+ //#endregion
1763
+ //#region node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/endpoint/node.js
1764
+ var node_exports = /* @__PURE__ */ __exportAll({ GET: () => GET });
1765
+ async function loadLocalImage(src, url) {
1766
+ const outDirURL = resolveOutDir();
1767
+ const idx = url.pathname.indexOf("/_image");
1768
+ if (idx > 0) src = src.slice(idx);
1769
+ let fileUrl;
1770
+ try {
1771
+ if (!URL.canParse("." + src, outDirURL)) return { kind: "invalid-path" };
1772
+ fileUrl = new URL("." + src, outDirURL);
1773
+ if (fileUrl.protocol !== "file:" || !isParentDirectory(fileURLToPath(outDirURL), fileURLToPath(fileUrl))) return { kind: "invalid-path" };
1774
+ } catch {
1775
+ return { kind: "invalid-path" };
1776
+ }
1777
+ try {
1778
+ return {
1779
+ kind: "loaded",
1780
+ buffer: await readFile(fileUrl)
1781
+ };
1782
+ } catch (error) {
1783
+ if (error instanceof Error && "code" in error && (error.code === "ENOENT" || error.code === "ENOTDIR" || error.code === "EISDIR")) return { kind: "not-found" };
1784
+ return { kind: "failed" };
1785
+ }
1786
+ }
1787
+ var GET = async ({ request, logger }) => {
1788
+ try {
1789
+ return await handleImageRequest({
1790
+ request,
1791
+ loadLocalImage,
1792
+ logger
1793
+ });
1794
+ } catch (err) {
1795
+ logger.error(`Could not process image request: ${err}`);
1796
+ return new Response("Internal Server Error", { status: 500 });
1797
+ }
1798
+ };
1799
+ function resolveOutDir() {
1800
+ const serverDirPath = fileURLToPath(serverDir);
1801
+ const rel = path.relative(serverDirPath, fileURLToPath(outDir));
1802
+ const serverFolder = path.basename(serverDirPath);
1803
+ let serverEntryFolderURL = path.dirname(import.meta.url);
1804
+ while (!serverEntryFolderURL.endsWith(serverFolder)) serverEntryFolderURL = path.dirname(serverEntryFolderURL);
1805
+ const serverEntryURL = serverEntryFolderURL + "/entry.mjs";
1806
+ return new URL(appendForwardSlash(rel), serverEntryURL);
1807
+ }
1808
+ function appendForwardSlash(pth) {
1809
+ return pth.endsWith("/") ? pth : pth + "/";
1810
+ }
1811
+ //#endregion
1812
+ //#region \0virtual:astro:page:node_modules/.pnpm/astro@7.3.5_@types+node@22.20.4_tsx@4.23.15_yaml@2.9.1/node_modules/astro/dist/assets/endpoint/node@_@js
1813
+ var node___js_exports = /* @__PURE__ */ __exportAll({ page: () => page });
1814
+ var page = () => node_exports;
1815
+ //#endregion
1816
+ export { resolveDefaultOutputFormat as a, detector as i, baseService as n, page, parseQuality as r, node___js_exports as t };