@absolutejs/absolute 0.19.0-beta.208 → 0.19.0-beta.209

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.
@@ -0,0 +1,737 @@
1
+ // src/react/components/Head.tsx
2
+ import { jsxDEV, Fragment } from "react/jsx-dev-runtime";
3
+ var RobotsContent = ({ robots }) => {
4
+ const directives = [];
5
+ if (robots.index === false)
6
+ directives.push("noindex");
7
+ if (robots.index === true)
8
+ directives.push("index");
9
+ if (robots.follow === false)
10
+ directives.push("nofollow");
11
+ if (robots.follow === true)
12
+ directives.push("follow");
13
+ if (robots.noarchive)
14
+ directives.push("noarchive");
15
+ if (robots.nosnippet)
16
+ directives.push("nosnippet");
17
+ if (robots.noimageindex)
18
+ directives.push("noimageindex");
19
+ if (robots.maxSnippet !== undefined)
20
+ directives.push(`max-snippet:${robots.maxSnippet}`);
21
+ if (robots.maxImagePreview)
22
+ directives.push(`max-image-preview:${robots.maxImagePreview}`);
23
+ if (robots.maxVideoPreview !== undefined)
24
+ directives.push(`max-video-preview:${robots.maxVideoPreview}`);
25
+ const content = directives.join(", ");
26
+ return content ? /* @__PURE__ */ jsxDEV("meta", {
27
+ content,
28
+ name: "robots"
29
+ }, undefined, false, undefined, this) : null;
30
+ };
31
+ var OpenGraphTags = ({
32
+ openGraph,
33
+ title,
34
+ description
35
+ }) => /* @__PURE__ */ jsxDEV(Fragment, {
36
+ children: [
37
+ /* @__PURE__ */ jsxDEV("meta", {
38
+ content: openGraph.title ?? title,
39
+ property: "og:title"
40
+ }, undefined, false, undefined, this),
41
+ /* @__PURE__ */ jsxDEV("meta", {
42
+ content: openGraph.description ?? description,
43
+ property: "og:description"
44
+ }, undefined, false, undefined, this),
45
+ openGraph.url && /* @__PURE__ */ jsxDEV("meta", {
46
+ content: openGraph.url,
47
+ property: "og:url"
48
+ }, undefined, false, undefined, this),
49
+ openGraph.image && /* @__PURE__ */ jsxDEV("meta", {
50
+ content: openGraph.image,
51
+ property: "og:image"
52
+ }, undefined, false, undefined, this),
53
+ openGraph.imageAlt && /* @__PURE__ */ jsxDEV("meta", {
54
+ content: openGraph.imageAlt,
55
+ property: "og:image:alt"
56
+ }, undefined, false, undefined, this),
57
+ openGraph.imageWidth && /* @__PURE__ */ jsxDEV("meta", {
58
+ content: String(openGraph.imageWidth),
59
+ property: "og:image:width"
60
+ }, undefined, false, undefined, this),
61
+ openGraph.imageHeight && /* @__PURE__ */ jsxDEV("meta", {
62
+ content: String(openGraph.imageHeight),
63
+ property: "og:image:height"
64
+ }, undefined, false, undefined, this),
65
+ openGraph.type && /* @__PURE__ */ jsxDEV("meta", {
66
+ content: openGraph.type,
67
+ property: "og:type"
68
+ }, undefined, false, undefined, this),
69
+ openGraph.siteName && /* @__PURE__ */ jsxDEV("meta", {
70
+ content: openGraph.siteName,
71
+ property: "og:site_name"
72
+ }, undefined, false, undefined, this),
73
+ openGraph.locale && /* @__PURE__ */ jsxDEV("meta", {
74
+ content: openGraph.locale,
75
+ property: "og:locale"
76
+ }, undefined, false, undefined, this)
77
+ ]
78
+ }, undefined, true, undefined, this);
79
+ var TwitterTags = ({
80
+ twitter,
81
+ title,
82
+ description
83
+ }) => /* @__PURE__ */ jsxDEV(Fragment, {
84
+ children: [
85
+ twitter.card && /* @__PURE__ */ jsxDEV("meta", {
86
+ content: twitter.card,
87
+ name: "twitter:card"
88
+ }, undefined, false, undefined, this),
89
+ /* @__PURE__ */ jsxDEV("meta", {
90
+ content: twitter.title ?? title,
91
+ name: "twitter:title"
92
+ }, undefined, false, undefined, this),
93
+ /* @__PURE__ */ jsxDEV("meta", {
94
+ content: twitter.description ?? description,
95
+ name: "twitter:description"
96
+ }, undefined, false, undefined, this),
97
+ twitter.image && /* @__PURE__ */ jsxDEV("meta", {
98
+ content: twitter.image,
99
+ name: "twitter:image"
100
+ }, undefined, false, undefined, this),
101
+ twitter.imageAlt && /* @__PURE__ */ jsxDEV("meta", {
102
+ content: twitter.imageAlt,
103
+ name: "twitter:image:alt"
104
+ }, undefined, false, undefined, this),
105
+ twitter.site && /* @__PURE__ */ jsxDEV("meta", {
106
+ content: twitter.site,
107
+ name: "twitter:site"
108
+ }, undefined, false, undefined, this),
109
+ twitter.creator && /* @__PURE__ */ jsxDEV("meta", {
110
+ content: twitter.creator,
111
+ name: "twitter:creator"
112
+ }, undefined, false, undefined, this)
113
+ ]
114
+ }, undefined, true, undefined, this);
115
+ var CustomMetaTag = ({ tag }) => {
116
+ if (tag.property)
117
+ return /* @__PURE__ */ jsxDEV("meta", {
118
+ content: tag.content,
119
+ property: tag.property
120
+ }, undefined, false, undefined, this);
121
+ if (tag.httpEquiv)
122
+ return /* @__PURE__ */ jsxDEV("meta", {
123
+ content: tag.content,
124
+ httpEquiv: tag.httpEquiv
125
+ }, undefined, false, undefined, this);
126
+ return /* @__PURE__ */ jsxDEV("meta", {
127
+ content: tag.content,
128
+ name: tag.name
129
+ }, undefined, false, undefined, this);
130
+ };
131
+ var Head = ({
132
+ title = "AbsoluteJS",
133
+ description = "A page created using AbsoluteJS",
134
+ icon = "/assets/ico/favicon.ico",
135
+ font,
136
+ cssPath,
137
+ canonical,
138
+ openGraph,
139
+ twitter,
140
+ robots,
141
+ meta
142
+ } = {}) => /* @__PURE__ */ jsxDEV("head", {
143
+ suppressHydrationWarning: true,
144
+ children: [
145
+ /* @__PURE__ */ jsxDEV("meta", {
146
+ charSet: "utf-8"
147
+ }, undefined, false, undefined, this),
148
+ /* @__PURE__ */ jsxDEV("title", {
149
+ children: title
150
+ }, undefined, false, undefined, this),
151
+ /* @__PURE__ */ jsxDEV("meta", {
152
+ content: description,
153
+ name: "description"
154
+ }, undefined, false, undefined, this),
155
+ /* @__PURE__ */ jsxDEV("meta", {
156
+ content: "width=device-width, initial-scale=1",
157
+ name: "viewport"
158
+ }, undefined, false, undefined, this),
159
+ /* @__PURE__ */ jsxDEV("link", {
160
+ href: icon,
161
+ rel: "icon"
162
+ }, undefined, false, undefined, this),
163
+ canonical && /* @__PURE__ */ jsxDEV("link", {
164
+ href: canonical,
165
+ rel: "canonical"
166
+ }, undefined, false, undefined, this),
167
+ openGraph && /* @__PURE__ */ jsxDEV(OpenGraphTags, {
168
+ description,
169
+ openGraph,
170
+ title
171
+ }, undefined, false, undefined, this),
172
+ twitter && /* @__PURE__ */ jsxDEV(TwitterTags, {
173
+ description,
174
+ title,
175
+ twitter
176
+ }, undefined, false, undefined, this),
177
+ robots && /* @__PURE__ */ jsxDEV(RobotsContent, {
178
+ robots
179
+ }, undefined, false, undefined, this),
180
+ meta?.map((tag, i) => /* @__PURE__ */ jsxDEV(CustomMetaTag, {
181
+ tag
182
+ }, i, false, undefined, this)),
183
+ font && /* @__PURE__ */ jsxDEV(Fragment, {
184
+ children: [
185
+ /* @__PURE__ */ jsxDEV("link", {
186
+ href: "https://fonts.googleapis.com",
187
+ rel: "preconnect"
188
+ }, undefined, false, undefined, this),
189
+ /* @__PURE__ */ jsxDEV("link", {
190
+ crossOrigin: "anonymous",
191
+ href: "https://fonts.gstatic.com",
192
+ rel: "preconnect",
193
+ suppressHydrationWarning: true
194
+ }, undefined, false, undefined, this),
195
+ /* @__PURE__ */ jsxDEV("link", {
196
+ href: `https://fonts.googleapis.com/css2?family=${font}:wght@100..900&display=swap`,
197
+ rel: "stylesheet",
198
+ suppressHydrationWarning: true
199
+ }, undefined, false, undefined, this)
200
+ ]
201
+ }, undefined, true, undefined, this),
202
+ cssPath && [cssPath].flat().map((path) => /* @__PURE__ */ jsxDEV("link", {
203
+ href: path,
204
+ rel: "stylesheet",
205
+ suppressHydrationWarning: true,
206
+ type: "text/css"
207
+ }, path, false, undefined, this))
208
+ ]
209
+ }, undefined, true, undefined, this);
210
+ // src/utils/imageProcessing.ts
211
+ var {existsSync, mkdirSync, readFileSync, writeFileSync} = (() => ({}));
212
+
213
+ // node:path
214
+ function assertPath(path) {
215
+ if (typeof path !== "string")
216
+ throw TypeError("Path must be a string. Received " + JSON.stringify(path));
217
+ }
218
+ function normalizeStringPosix(path, allowAboveRoot) {
219
+ var res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, code;
220
+ for (var i = 0;i <= path.length; ++i) {
221
+ if (i < path.length)
222
+ code = path.charCodeAt(i);
223
+ else if (code === 47)
224
+ break;
225
+ else
226
+ code = 47;
227
+ if (code === 47) {
228
+ if (lastSlash === i - 1 || dots === 1)
229
+ ;
230
+ else if (lastSlash !== i - 1 && dots === 2) {
231
+ if (res.length < 2 || lastSegmentLength !== 2 || res.charCodeAt(res.length - 1) !== 46 || res.charCodeAt(res.length - 2) !== 46) {
232
+ if (res.length > 2) {
233
+ var lastSlashIndex = res.lastIndexOf("/");
234
+ if (lastSlashIndex !== res.length - 1) {
235
+ if (lastSlashIndex === -1)
236
+ res = "", lastSegmentLength = 0;
237
+ else
238
+ res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
239
+ lastSlash = i, dots = 0;
240
+ continue;
241
+ }
242
+ } else if (res.length === 2 || res.length === 1) {
243
+ res = "", lastSegmentLength = 0, lastSlash = i, dots = 0;
244
+ continue;
245
+ }
246
+ }
247
+ if (allowAboveRoot) {
248
+ if (res.length > 0)
249
+ res += "/..";
250
+ else
251
+ res = "..";
252
+ lastSegmentLength = 2;
253
+ }
254
+ } else {
255
+ if (res.length > 0)
256
+ res += "/" + path.slice(lastSlash + 1, i);
257
+ else
258
+ res = path.slice(lastSlash + 1, i);
259
+ lastSegmentLength = i - lastSlash - 1;
260
+ }
261
+ lastSlash = i, dots = 0;
262
+ } else if (code === 46 && dots !== -1)
263
+ ++dots;
264
+ else
265
+ dots = -1;
266
+ }
267
+ return res;
268
+ }
269
+ function _format(sep, pathObject) {
270
+ var dir = pathObject.dir || pathObject.root, base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
271
+ if (!dir)
272
+ return base;
273
+ if (dir === pathObject.root)
274
+ return dir + base;
275
+ return dir + sep + base;
276
+ }
277
+ function resolve() {
278
+ var resolvedPath = "", resolvedAbsolute = false, cwd;
279
+ for (var i = arguments.length - 1;i >= -1 && !resolvedAbsolute; i--) {
280
+ var path;
281
+ if (i >= 0)
282
+ path = arguments[i];
283
+ else {
284
+ if (cwd === undefined)
285
+ cwd = process.cwd();
286
+ path = cwd;
287
+ }
288
+ if (assertPath(path), path.length === 0)
289
+ continue;
290
+ resolvedPath = path + "/" + resolvedPath, resolvedAbsolute = path.charCodeAt(0) === 47;
291
+ }
292
+ if (resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute), resolvedAbsolute)
293
+ if (resolvedPath.length > 0)
294
+ return "/" + resolvedPath;
295
+ else
296
+ return "/";
297
+ else if (resolvedPath.length > 0)
298
+ return resolvedPath;
299
+ else
300
+ return ".";
301
+ }
302
+ function normalize(path) {
303
+ if (assertPath(path), path.length === 0)
304
+ return ".";
305
+ var isAbsolute = path.charCodeAt(0) === 47, trailingSeparator = path.charCodeAt(path.length - 1) === 47;
306
+ if (path = normalizeStringPosix(path, !isAbsolute), path.length === 0 && !isAbsolute)
307
+ path = ".";
308
+ if (path.length > 0 && trailingSeparator)
309
+ path += "/";
310
+ if (isAbsolute)
311
+ return "/" + path;
312
+ return path;
313
+ }
314
+ function isAbsolute(path) {
315
+ return assertPath(path), path.length > 0 && path.charCodeAt(0) === 47;
316
+ }
317
+ function join() {
318
+ if (arguments.length === 0)
319
+ return ".";
320
+ var joined;
321
+ for (var i = 0;i < arguments.length; ++i) {
322
+ var arg = arguments[i];
323
+ if (assertPath(arg), arg.length > 0)
324
+ if (joined === undefined)
325
+ joined = arg;
326
+ else
327
+ joined += "/" + arg;
328
+ }
329
+ if (joined === undefined)
330
+ return ".";
331
+ return normalize(joined);
332
+ }
333
+ function relative(from, to) {
334
+ if (assertPath(from), assertPath(to), from === to)
335
+ return "";
336
+ if (from = resolve(from), to = resolve(to), from === to)
337
+ return "";
338
+ var fromStart = 1;
339
+ for (;fromStart < from.length; ++fromStart)
340
+ if (from.charCodeAt(fromStart) !== 47)
341
+ break;
342
+ var fromEnd = from.length, fromLen = fromEnd - fromStart, toStart = 1;
343
+ for (;toStart < to.length; ++toStart)
344
+ if (to.charCodeAt(toStart) !== 47)
345
+ break;
346
+ var toEnd = to.length, toLen = toEnd - toStart, length = fromLen < toLen ? fromLen : toLen, lastCommonSep = -1, i = 0;
347
+ for (;i <= length; ++i) {
348
+ if (i === length) {
349
+ if (toLen > length) {
350
+ if (to.charCodeAt(toStart + i) === 47)
351
+ return to.slice(toStart + i + 1);
352
+ else if (i === 0)
353
+ return to.slice(toStart + i);
354
+ } else if (fromLen > length) {
355
+ if (from.charCodeAt(fromStart + i) === 47)
356
+ lastCommonSep = i;
357
+ else if (i === 0)
358
+ lastCommonSep = 0;
359
+ }
360
+ break;
361
+ }
362
+ var fromCode = from.charCodeAt(fromStart + i), toCode = to.charCodeAt(toStart + i);
363
+ if (fromCode !== toCode)
364
+ break;
365
+ else if (fromCode === 47)
366
+ lastCommonSep = i;
367
+ }
368
+ var out = "";
369
+ for (i = fromStart + lastCommonSep + 1;i <= fromEnd; ++i)
370
+ if (i === fromEnd || from.charCodeAt(i) === 47)
371
+ if (out.length === 0)
372
+ out += "..";
373
+ else
374
+ out += "/..";
375
+ if (out.length > 0)
376
+ return out + to.slice(toStart + lastCommonSep);
377
+ else {
378
+ if (toStart += lastCommonSep, to.charCodeAt(toStart) === 47)
379
+ ++toStart;
380
+ return to.slice(toStart);
381
+ }
382
+ }
383
+ function _makeLong(path) {
384
+ return path;
385
+ }
386
+ function dirname(path) {
387
+ if (assertPath(path), path.length === 0)
388
+ return ".";
389
+ var code = path.charCodeAt(0), hasRoot = code === 47, end = -1, matchedSlash = true;
390
+ for (var i = path.length - 1;i >= 1; --i)
391
+ if (code = path.charCodeAt(i), code === 47) {
392
+ if (!matchedSlash) {
393
+ end = i;
394
+ break;
395
+ }
396
+ } else
397
+ matchedSlash = false;
398
+ if (end === -1)
399
+ return hasRoot ? "/" : ".";
400
+ if (hasRoot && end === 1)
401
+ return "//";
402
+ return path.slice(0, end);
403
+ }
404
+ function basename(path, ext) {
405
+ if (ext !== undefined && typeof ext !== "string")
406
+ throw TypeError('"ext" argument must be a string');
407
+ assertPath(path);
408
+ var start = 0, end = -1, matchedSlash = true, i;
409
+ if (ext !== undefined && ext.length > 0 && ext.length <= path.length) {
410
+ if (ext.length === path.length && ext === path)
411
+ return "";
412
+ var extIdx = ext.length - 1, firstNonSlashEnd = -1;
413
+ for (i = path.length - 1;i >= 0; --i) {
414
+ var code = path.charCodeAt(i);
415
+ if (code === 47) {
416
+ if (!matchedSlash) {
417
+ start = i + 1;
418
+ break;
419
+ }
420
+ } else {
421
+ if (firstNonSlashEnd === -1)
422
+ matchedSlash = false, firstNonSlashEnd = i + 1;
423
+ if (extIdx >= 0)
424
+ if (code === ext.charCodeAt(extIdx)) {
425
+ if (--extIdx === -1)
426
+ end = i;
427
+ } else
428
+ extIdx = -1, end = firstNonSlashEnd;
429
+ }
430
+ }
431
+ if (start === end)
432
+ end = firstNonSlashEnd;
433
+ else if (end === -1)
434
+ end = path.length;
435
+ return path.slice(start, end);
436
+ } else {
437
+ for (i = path.length - 1;i >= 0; --i)
438
+ if (path.charCodeAt(i) === 47) {
439
+ if (!matchedSlash) {
440
+ start = i + 1;
441
+ break;
442
+ }
443
+ } else if (end === -1)
444
+ matchedSlash = false, end = i + 1;
445
+ if (end === -1)
446
+ return "";
447
+ return path.slice(start, end);
448
+ }
449
+ }
450
+ function extname(path) {
451
+ assertPath(path);
452
+ var startDot = -1, startPart = 0, end = -1, matchedSlash = true, preDotState = 0;
453
+ for (var i = path.length - 1;i >= 0; --i) {
454
+ var code = path.charCodeAt(i);
455
+ if (code === 47) {
456
+ if (!matchedSlash) {
457
+ startPart = i + 1;
458
+ break;
459
+ }
460
+ continue;
461
+ }
462
+ if (end === -1)
463
+ matchedSlash = false, end = i + 1;
464
+ if (code === 46) {
465
+ if (startDot === -1)
466
+ startDot = i;
467
+ else if (preDotState !== 1)
468
+ preDotState = 1;
469
+ } else if (startDot !== -1)
470
+ preDotState = -1;
471
+ }
472
+ if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1)
473
+ return "";
474
+ return path.slice(startDot, end);
475
+ }
476
+ function format(pathObject) {
477
+ if (pathObject === null || typeof pathObject !== "object")
478
+ throw TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof pathObject);
479
+ return _format("/", pathObject);
480
+ }
481
+ function parse(path) {
482
+ assertPath(path);
483
+ var ret = { root: "", dir: "", base: "", ext: "", name: "" };
484
+ if (path.length === 0)
485
+ return ret;
486
+ var code = path.charCodeAt(0), isAbsolute2 = code === 47, start;
487
+ if (isAbsolute2)
488
+ ret.root = "/", start = 1;
489
+ else
490
+ start = 0;
491
+ var startDot = -1, startPart = 0, end = -1, matchedSlash = true, i = path.length - 1, preDotState = 0;
492
+ for (;i >= start; --i) {
493
+ if (code = path.charCodeAt(i), code === 47) {
494
+ if (!matchedSlash) {
495
+ startPart = i + 1;
496
+ break;
497
+ }
498
+ continue;
499
+ }
500
+ if (end === -1)
501
+ matchedSlash = false, end = i + 1;
502
+ if (code === 46) {
503
+ if (startDot === -1)
504
+ startDot = i;
505
+ else if (preDotState !== 1)
506
+ preDotState = 1;
507
+ } else if (startDot !== -1)
508
+ preDotState = -1;
509
+ }
510
+ if (startDot === -1 || end === -1 || preDotState === 0 || preDotState === 1 && startDot === end - 1 && startDot === startPart + 1) {
511
+ if (end !== -1)
512
+ if (startPart === 0 && isAbsolute2)
513
+ ret.base = ret.name = path.slice(1, end);
514
+ else
515
+ ret.base = ret.name = path.slice(startPart, end);
516
+ } else {
517
+ if (startPart === 0 && isAbsolute2)
518
+ ret.name = path.slice(1, startDot), ret.base = path.slice(1, end);
519
+ else
520
+ ret.name = path.slice(startPart, startDot), ret.base = path.slice(startPart, end);
521
+ ret.ext = path.slice(startDot, end);
522
+ }
523
+ if (startPart > 0)
524
+ ret.dir = path.slice(0, startPart - 1);
525
+ else if (isAbsolute2)
526
+ ret.dir = "/";
527
+ return ret;
528
+ }
529
+ var sep = "/";
530
+ var delimiter = ":";
531
+ var posix = ((p) => (p.posix = p, p))({ resolve, normalize, isAbsolute, join, relative, _makeLong, dirname, basename, extname, format, parse, sep, delimiter, win32: null, posix: null });
532
+
533
+ // src/utils/imageProcessing.ts
534
+ var DEFAULT_DEVICE_SIZES = [
535
+ 640,
536
+ 750,
537
+ 828,
538
+ 1080,
539
+ 1200,
540
+ 1920,
541
+ 2048,
542
+ 3840
543
+ ];
544
+ var DEFAULT_IMAGE_SIZES = [
545
+ 16,
546
+ 32,
547
+ 48,
548
+ 64,
549
+ 96,
550
+ 128,
551
+ 256,
552
+ 384
553
+ ];
554
+ var DEFAULT_QUALITY = 75;
555
+ var OPTIMIZATION_ENDPOINT = "/_absolute/image";
556
+ var BLUR_DEVIATION = 20;
557
+ var snapToSize = (target, sizes) => {
558
+ for (const size of sizes) {
559
+ if (size >= target)
560
+ return size;
561
+ }
562
+ return sizes[sizes.length - 1] ?? target;
563
+ };
564
+ var buildOptimizedUrl = (src, width, quality, basePath = OPTIMIZATION_ENDPOINT) => `${basePath}?url=${encodeURIComponent(src)}&w=${width}&q=${quality}`;
565
+ var generateBlurSvg = (base64Thumbnail) => {
566
+ const svg = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 320"><filter id="b" color-interpolation-filters="sRGB"><feGaussianBlur stdDeviation="${BLUR_DEVIATION}"/><feColorMatrix values="1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 100 -1"/></filter><image filter="url(#b)" x="0" y="0" width="100%" height="100%" href="${base64Thumbnail}"/></svg>`;
567
+ const encoded = encodeURIComponent(svg);
568
+ return `url("data:image/svg+xml,${encoded}")`;
569
+ };
570
+ var generateSrcSet = (src, width, sizes, config, loader) => {
571
+ const quality = config?.quality ?? DEFAULT_QUALITY;
572
+ const basePath = config?.path ?? OPTIMIZATION_ENDPOINT;
573
+ const buildUrl = loader ?? ((params) => buildOptimizedUrl(params.src, params.width, params.quality, basePath));
574
+ if (sizes) {
575
+ const allSizes = getAllSizes(config);
576
+ return allSizes.map((sizeWidth) => `${buildUrl({ quality, src, width: sizeWidth })} ${sizeWidth}w`).join(", ");
577
+ }
578
+ if (width) {
579
+ const allSizes = getAllSizes(config);
580
+ const w1x = snapToSize(width, allSizes);
581
+ const w2x = snapToSize(width * 2, allSizes);
582
+ return `${buildUrl({ quality, src, width: w1x })} 1x, ${buildUrl({ quality, src, width: w2x })} 2x`;
583
+ }
584
+ const deviceSizes = config?.deviceSizes ?? DEFAULT_DEVICE_SIZES;
585
+ return deviceSizes.map((sizeWidth) => `${buildUrl({ quality, src, width: sizeWidth })} ${sizeWidth}w`).join(", ");
586
+ };
587
+ var getAllSizes = (config) => {
588
+ const device = config?.deviceSizes ?? DEFAULT_DEVICE_SIZES;
589
+ const image = config?.imageSizes ?? DEFAULT_IMAGE_SIZES;
590
+ return [...device, ...image].sort((left, right) => left - right);
591
+ };
592
+
593
+ // src/react/components/Image.tsx
594
+ import { jsxDEV as jsxDEV2, Fragment as Fragment2 } from "react/jsx-dev-runtime";
595
+ var resolveSource = (src, overrideSrc, unoptimized, loader, width, quality) => {
596
+ if (overrideSrc)
597
+ return overrideSrc;
598
+ if (unoptimized)
599
+ return src;
600
+ if (loader)
601
+ return loader({ quality, src, width: width ?? 0 });
602
+ if (!width)
603
+ return buildOptimizedUrl(src, 0, quality);
604
+ return buildOptimizedUrl(src, width, quality);
605
+ };
606
+ var resolveBlurBackground = (hasBlur, placeholder, blurDataURL) => {
607
+ if (!hasBlur)
608
+ return;
609
+ if (typeof placeholder === "string" && placeholder !== "blur" && placeholder.startsWith("data:")) {
610
+ return generateBlurSvg(placeholder);
611
+ }
612
+ if (blurDataURL)
613
+ return generateBlurSvg(blurDataURL);
614
+ return;
615
+ };
616
+ var Image = ({
617
+ alt,
618
+ blurDataURL,
619
+ className,
620
+ crossOrigin,
621
+ fetchPriority,
622
+ fill,
623
+ height,
624
+ loader,
625
+ loading,
626
+ onError,
627
+ onLoad,
628
+ overrideSrc,
629
+ placeholder,
630
+ priority,
631
+ quality = DEFAULT_QUALITY,
632
+ referrerPolicy,
633
+ sizes,
634
+ src,
635
+ style,
636
+ unoptimized,
637
+ width
638
+ }) => {
639
+ const resolvedSrc = resolveSource(src, overrideSrc, unoptimized, loader, width, quality);
640
+ const srcSet = unoptimized ? undefined : generateSrcSet(src, width, sizes, undefined, loader ?? undefined);
641
+ const resolvedSizes = sizes ?? (fill ? "100vw" : undefined);
642
+ const resolvedLoading = priority ? "eager" : loading ?? "lazy";
643
+ const resolvedFetchPriority = priority ? "high" : fetchPriority;
644
+ const hasBlur = placeholder === "blur" || typeof placeholder === "string" && placeholder !== "empty" && placeholder.startsWith("data:");
645
+ const blurBackground = resolveBlurBackground(hasBlur, placeholder, blurDataURL);
646
+ const imgStyle = {
647
+ ...style ?? {},
648
+ ...blurBackground ? {
649
+ backgroundImage: blurBackground,
650
+ backgroundPosition: "center",
651
+ backgroundRepeat: "no-repeat",
652
+ backgroundSize: "cover"
653
+ } : {},
654
+ ...fill ? {
655
+ color: "transparent",
656
+ height: "100%",
657
+ inset: 0,
658
+ objectFit: "cover",
659
+ position: "absolute",
660
+ width: "100%"
661
+ } : { color: "transparent" }
662
+ };
663
+ const preloadLink = priority ? /* @__PURE__ */ jsxDEV2("link", {
664
+ as: "image",
665
+ crossOrigin,
666
+ href: resolvedSrc,
667
+ imageSizes: resolvedSizes,
668
+ imageSrcSet: srcSet,
669
+ rel: "preload"
670
+ }, undefined, false, undefined, this) : null;
671
+ const imgElement = /* @__PURE__ */ jsxDEV2("img", {
672
+ alt,
673
+ className,
674
+ crossOrigin,
675
+ decoding: "async",
676
+ fetchPriority: resolvedFetchPriority,
677
+ height: fill ? undefined : height,
678
+ loading: resolvedLoading,
679
+ onError: onError ? (event) => onError(event.nativeEvent) : undefined,
680
+ onLoad: (event) => {
681
+ const { target } = event;
682
+ if (blurBackground && target instanceof HTMLImageElement) {
683
+ target.style.backgroundImage = "none";
684
+ }
685
+ if (onLoad)
686
+ onLoad(event.nativeEvent);
687
+ },
688
+ referrerPolicy,
689
+ sizes: resolvedSizes,
690
+ src: resolvedSrc,
691
+ srcSet,
692
+ style: imgStyle,
693
+ width: fill ? undefined : width
694
+ }, undefined, false, undefined, this);
695
+ if (fill) {
696
+ return /* @__PURE__ */ jsxDEV2(Fragment2, {
697
+ children: [
698
+ preloadLink,
699
+ /* @__PURE__ */ jsxDEV2("span", {
700
+ style: {
701
+ display: "block",
702
+ height: "100%",
703
+ overflow: "hidden",
704
+ position: "relative",
705
+ width: "100%"
706
+ },
707
+ children: imgElement
708
+ }, undefined, false, undefined, this)
709
+ ]
710
+ }, undefined, true, undefined, this);
711
+ }
712
+ return /* @__PURE__ */ jsxDEV2(Fragment2, {
713
+ children: [
714
+ preloadLink,
715
+ imgElement
716
+ ]
717
+ }, undefined, true, undefined, this);
718
+ };
719
+ // src/react/components/JsonLd.tsx
720
+ import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
721
+ var JsonLd = ({
722
+ schema
723
+ }) => {
724
+ const data = Array.isArray(schema) ? schema.map((s) => ({
725
+ "@context": "https://schema.org",
726
+ ...s
727
+ })) : { "@context": "https://schema.org", ...schema };
728
+ return /* @__PURE__ */ jsxDEV3("script", {
729
+ dangerouslySetInnerHTML: { __html: JSON.stringify(data) },
730
+ type: "application/ld+json"
731
+ }, undefined, false, undefined, this);
732
+ };
733
+ export {
734
+ JsonLd,
735
+ Image,
736
+ Head
737
+ };