@nonphoto/sanity-image 0.0.3 → 0.0.4
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.
- package/dist/sanity-image.js +98 -116
- package/dist/sanity-image.umd.cjs +2 -2
- package/package.json +1 -1
package/dist/sanity-image.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
var
|
|
1
|
+
var $ = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, P = {}, k = {
|
|
2
2
|
get exports() {
|
|
3
3
|
return P;
|
|
4
4
|
},
|
|
5
|
-
set exports(
|
|
6
|
-
P =
|
|
5
|
+
set exports(f) {
|
|
6
|
+
P = f;
|
|
7
7
|
}
|
|
8
8
|
};
|
|
9
|
-
(function(
|
|
10
|
-
(function(
|
|
11
|
-
|
|
12
|
-
})(
|
|
13
|
-
function
|
|
14
|
-
return
|
|
9
|
+
(function(f, y) {
|
|
10
|
+
(function(s, v) {
|
|
11
|
+
f.exports = v();
|
|
12
|
+
})($, function() {
|
|
13
|
+
function s() {
|
|
14
|
+
return s = Object.assign || function(t) {
|
|
15
15
|
for (var i = 1; i < arguments.length; i++) {
|
|
16
16
|
var n = arguments[i];
|
|
17
17
|
for (var r in n)
|
|
18
18
|
Object.prototype.hasOwnProperty.call(n, r) && (t[r] = n[r]);
|
|
19
19
|
}
|
|
20
20
|
return t;
|
|
21
|
-
},
|
|
21
|
+
}, s.apply(this, arguments);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function v(t, i) {
|
|
24
24
|
if (t) {
|
|
25
25
|
if (typeof t == "string")
|
|
26
26
|
return I(t, i);
|
|
@@ -41,7 +41,7 @@ var Q = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : ty
|
|
|
41
41
|
var n = typeof Symbol < "u" && t[Symbol.iterator] || t["@@iterator"];
|
|
42
42
|
if (n)
|
|
43
43
|
return (n = n.call(t)).next.bind(n);
|
|
44
|
-
if (Array.isArray(t) || (n =
|
|
44
|
+
if (Array.isArray(t) || (n = v(t)) || i && t && typeof t.length == "number") {
|
|
45
45
|
n && (t = n);
|
|
46
46
|
var r = 0;
|
|
47
47
|
return function() {
|
|
@@ -56,17 +56,17 @@ var Q = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : ty
|
|
|
56
56
|
throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
57
57
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
58
58
|
}
|
|
59
|
-
var
|
|
60
|
-
function
|
|
59
|
+
var d = "image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg";
|
|
60
|
+
function u(t) {
|
|
61
61
|
var i = t.split("-"), n = i[1], r = i[2], o = i[3];
|
|
62
62
|
if (!n || !r || !o)
|
|
63
|
-
throw new Error("Malformed asset _ref '" + t + `'. Expected an id like "` +
|
|
64
|
-
var e = r.split("x"), a = e[0],
|
|
65
|
-
if (!
|
|
66
|
-
throw new Error("Malformed asset _ref '" + t + `'. Expected an id like "` +
|
|
63
|
+
throw new Error("Malformed asset _ref '" + t + `'. Expected an id like "` + d + '".');
|
|
64
|
+
var e = r.split("x"), a = e[0], h = e[1], c = +a, l = +h, p = isFinite(c) && isFinite(l);
|
|
65
|
+
if (!p)
|
|
66
|
+
throw new Error("Malformed asset _ref '" + t + `'. Expected an id like "` + d + '".');
|
|
67
67
|
return {
|
|
68
68
|
id: n,
|
|
69
|
-
width:
|
|
69
|
+
width: c,
|
|
70
70
|
height: l,
|
|
71
71
|
format: o
|
|
72
72
|
};
|
|
@@ -74,7 +74,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
74
74
|
var S = function(i) {
|
|
75
75
|
var n = i;
|
|
76
76
|
return n ? typeof n._ref == "string" : !1;
|
|
77
|
-
},
|
|
77
|
+
}, U = function(i) {
|
|
78
78
|
var n = i;
|
|
79
79
|
return n ? typeof n._id == "string" : !1;
|
|
80
80
|
}, O = function(i) {
|
|
@@ -85,10 +85,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
85
85
|
if (!t)
|
|
86
86
|
return null;
|
|
87
87
|
var i;
|
|
88
|
-
if (typeof t == "string" &&
|
|
88
|
+
if (typeof t == "string" && q(t))
|
|
89
89
|
i = {
|
|
90
90
|
asset: {
|
|
91
|
-
_ref:
|
|
91
|
+
_ref: E(t)
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
94
|
else if (typeof t == "string")
|
|
@@ -101,7 +101,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
101
101
|
i = {
|
|
102
102
|
asset: t
|
|
103
103
|
};
|
|
104
|
-
else if (
|
|
104
|
+
else if (U(t))
|
|
105
105
|
i = {
|
|
106
106
|
asset: {
|
|
107
107
|
_ref: t._id || ""
|
|
@@ -110,27 +110,27 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
110
110
|
else if (O(t))
|
|
111
111
|
i = {
|
|
112
112
|
asset: {
|
|
113
|
-
_ref:
|
|
113
|
+
_ref: E(t.asset.url)
|
|
114
114
|
}
|
|
115
115
|
};
|
|
116
116
|
else if (typeof t.asset == "object")
|
|
117
|
-
i =
|
|
117
|
+
i = s({}, t);
|
|
118
118
|
else
|
|
119
119
|
return null;
|
|
120
120
|
var n = t;
|
|
121
|
-
return n.crop && (i.crop = n.crop), n.hotspot && (i.hotspot = n.hotspot),
|
|
121
|
+
return n.crop && (i.crop = n.crop), n.hotspot && (i.hotspot = n.hotspot), z(i);
|
|
122
122
|
}
|
|
123
|
-
function
|
|
123
|
+
function q(t) {
|
|
124
124
|
return /^https?:\/\//.test("" + t);
|
|
125
125
|
}
|
|
126
|
-
function
|
|
126
|
+
function E(t) {
|
|
127
127
|
var i = t.split("/").slice(-1);
|
|
128
128
|
return ("image-" + i[0]).replace(/\.([a-z]+)$/, "-$1");
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function z(t) {
|
|
131
131
|
if (t.crop && t.hotspot)
|
|
132
132
|
return t;
|
|
133
|
-
var i =
|
|
133
|
+
var i = s({}, t);
|
|
134
134
|
return i.crop || (i.crop = {
|
|
135
135
|
left: 0,
|
|
136
136
|
top: 0,
|
|
@@ -143,42 +143,42 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
143
143
|
width: 1
|
|
144
144
|
}), i;
|
|
145
145
|
}
|
|
146
|
-
var
|
|
146
|
+
var R = [["width", "w"], ["height", "h"], ["format", "fm"], ["download", "dl"], ["blur", "blur"], ["sharpen", "sharp"], ["invert", "invert"], ["orientation", "or"], ["minHeight", "min-h"], ["maxHeight", "max-h"], ["minWidth", "min-w"], ["maxWidth", "max-w"], ["quality", "q"], ["fit", "fit"], ["crop", "crop"], ["saturation", "sat"], ["auto", "auto"], ["dpr", "dpr"], ["pad", "pad"]];
|
|
147
147
|
function _(t) {
|
|
148
|
-
var i =
|
|
148
|
+
var i = s({}, t || {}), n = i.source;
|
|
149
149
|
delete i.source;
|
|
150
150
|
var r = A(n);
|
|
151
151
|
if (!r)
|
|
152
152
|
throw new Error("Unable to resolve image URL from source (" + JSON.stringify(n) + ")");
|
|
153
|
-
var o = r.asset._ref || r.asset._id || "", e =
|
|
153
|
+
var o = r.asset._ref || r.asset._id || "", e = u(o), a = Math.round(r.crop.left * e.width), h = Math.round(r.crop.top * e.height), c = {
|
|
154
154
|
left: a,
|
|
155
|
-
top:
|
|
155
|
+
top: h,
|
|
156
156
|
width: Math.round(e.width - r.crop.right * e.width - a),
|
|
157
|
-
height: Math.round(e.height - r.crop.bottom * e.height -
|
|
158
|
-
}, l = r.hotspot.height * e.height / 2,
|
|
159
|
-
left:
|
|
160
|
-
top:
|
|
161
|
-
right:
|
|
162
|
-
bottom:
|
|
157
|
+
height: Math.round(e.height - r.crop.bottom * e.height - h)
|
|
158
|
+
}, l = r.hotspot.height * e.height / 2, p = r.hotspot.width * e.width / 2, m = r.hotspot.x * e.width, w = r.hotspot.y * e.height, g = {
|
|
159
|
+
left: m - p,
|
|
160
|
+
top: w - l,
|
|
161
|
+
right: m + p,
|
|
162
|
+
bottom: w + l
|
|
163
163
|
};
|
|
164
|
-
return i.rect || i.focalPoint || i.ignoreImageParams || i.crop || (i =
|
|
165
|
-
crop:
|
|
166
|
-
hotspot:
|
|
167
|
-
}, i))), L(
|
|
164
|
+
return i.rect || i.focalPoint || i.ignoreImageParams || i.crop || (i = s({}, i, V({
|
|
165
|
+
crop: c,
|
|
166
|
+
hotspot: g
|
|
167
|
+
}, i))), L(s({}, i, {
|
|
168
168
|
asset: e
|
|
169
169
|
}));
|
|
170
170
|
}
|
|
171
171
|
function L(t) {
|
|
172
172
|
var i = (t.baseUrl || "https://cdn.sanity.io").replace(/\/+$/, ""), n = t.asset.id + "-" + t.asset.width + "x" + t.asset.height + "." + t.asset.format, r = i + "/images/" + t.projectId + "/" + t.dataset + "/" + n, o = [];
|
|
173
173
|
if (t.rect) {
|
|
174
|
-
var e = t.rect, a = e.left,
|
|
175
|
-
|
|
174
|
+
var e = t.rect, a = e.left, h = e.top, c = e.width, l = e.height, p = a !== 0 || h !== 0 || l !== t.asset.height || c !== t.asset.width;
|
|
175
|
+
p && o.push("rect=" + a + "," + h + "," + c + "," + l);
|
|
176
176
|
}
|
|
177
177
|
t.bg && o.push("bg=" + t.bg), t.focalPoint && (o.push("fp-x=" + t.focalPoint.x), o.push("fp-y=" + t.focalPoint.y));
|
|
178
|
-
var
|
|
179
|
-
return
|
|
180
|
-
var
|
|
181
|
-
typeof t[
|
|
178
|
+
var m = [t.flipHorizontal && "h", t.flipVertical && "v"].filter(Boolean).join("");
|
|
179
|
+
return m && o.push("flip=" + m), R.forEach(function(w) {
|
|
180
|
+
var g = w[0], b = w[1];
|
|
181
|
+
typeof t[g] < "u" ? o.push(b + "=" + encodeURIComponent(t[g])) : typeof t[b] < "u" && o.push(b + "=" + encodeURIComponent(t[b]));
|
|
182
182
|
}), o.length === 0 ? r : r + "?" + o.join("&");
|
|
183
183
|
}
|
|
184
184
|
function V(t, i) {
|
|
@@ -189,22 +189,22 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
189
189
|
height: o,
|
|
190
190
|
rect: t.crop
|
|
191
191
|
};
|
|
192
|
-
var e = t.crop, a = t.hotspot,
|
|
193
|
-
if (
|
|
194
|
-
var l = Math.round(e.height),
|
|
195
|
-
|
|
196
|
-
left:
|
|
197
|
-
top:
|
|
198
|
-
width:
|
|
192
|
+
var e = t.crop, a = t.hotspot, h = r / o, c = e.width / e.height;
|
|
193
|
+
if (c > h) {
|
|
194
|
+
var l = Math.round(e.height), p = Math.round(l * h), m = Math.max(0, Math.round(e.top)), w = Math.round((a.right - a.left) / 2 + a.left), g = Math.max(0, Math.round(w - p / 2));
|
|
195
|
+
g < e.left ? g = e.left : g + p > e.left + e.width && (g = e.left + e.width - p), n = {
|
|
196
|
+
left: g,
|
|
197
|
+
top: m,
|
|
198
|
+
width: p,
|
|
199
199
|
height: l
|
|
200
200
|
};
|
|
201
201
|
} else {
|
|
202
|
-
var
|
|
203
|
-
x < e.top ? x = e.top : x +
|
|
204
|
-
left:
|
|
202
|
+
var b = e.width, j = Math.round(b / h), J = Math.max(0, Math.round(e.left)), Q = Math.round((a.bottom - a.top) / 2 + a.top), x = Math.max(0, Math.round(Q - j / 2));
|
|
203
|
+
x < e.top ? x = e.top : x + j > e.top + e.height && (x = e.top + e.height - j), n = {
|
|
204
|
+
left: J,
|
|
205
205
|
top: x,
|
|
206
|
-
width:
|
|
207
|
-
height:
|
|
206
|
+
width: b,
|
|
207
|
+
height: j
|
|
208
208
|
};
|
|
209
209
|
}
|
|
210
210
|
return {
|
|
@@ -214,22 +214,22 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
214
214
|
};
|
|
215
215
|
}
|
|
216
216
|
var B = ["clip", "crop", "fill", "fillmax", "max", "scale", "min"], F = ["top", "bottom", "left", "right", "center", "focalpoint", "entropy"], N = ["format"];
|
|
217
|
-
function
|
|
217
|
+
function D(t) {
|
|
218
218
|
return t && "config" in t ? typeof t.config == "function" : !1;
|
|
219
219
|
}
|
|
220
|
-
function
|
|
220
|
+
function G(t) {
|
|
221
221
|
return t && "clientConfig" in t ? typeof t.clientConfig == "object" : !1;
|
|
222
222
|
}
|
|
223
|
-
function
|
|
224
|
-
for (var i =
|
|
223
|
+
function X(t) {
|
|
224
|
+
for (var i = R, n = M(i), r; !(r = n()).done; ) {
|
|
225
225
|
var o = r.value, e = o[0], a = o[1];
|
|
226
226
|
if (t === e || t === a)
|
|
227
227
|
return e;
|
|
228
228
|
}
|
|
229
229
|
return t;
|
|
230
230
|
}
|
|
231
|
-
function
|
|
232
|
-
if (
|
|
231
|
+
function Y(t) {
|
|
232
|
+
if (D(t)) {
|
|
233
233
|
var i = t.config(), n = i.apiHost, r = i.projectId, o = i.dataset, e = n || "https://api.sanity.io";
|
|
234
234
|
return new H(null, {
|
|
235
235
|
baseUrl: e.replace(/^https:\/\/api\./, "https://cdn."),
|
|
@@ -238,19 +238,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
238
238
|
});
|
|
239
239
|
}
|
|
240
240
|
var a = t;
|
|
241
|
-
if (
|
|
242
|
-
var
|
|
241
|
+
if (G(a)) {
|
|
242
|
+
var h = a.clientConfig, c = h.apiHost, l = h.projectId, p = h.dataset, m = c || "https://api.sanity.io";
|
|
243
243
|
return new H(null, {
|
|
244
|
-
baseUrl:
|
|
244
|
+
baseUrl: m.replace(/^https:\/\/api\./, "https://cdn."),
|
|
245
245
|
projectId: l,
|
|
246
|
-
dataset:
|
|
246
|
+
dataset: p
|
|
247
247
|
});
|
|
248
248
|
}
|
|
249
249
|
return new H(null, t);
|
|
250
250
|
}
|
|
251
251
|
var H = /* @__PURE__ */ function() {
|
|
252
252
|
function t(n, r) {
|
|
253
|
-
this.options = void 0, this.options = n ?
|
|
253
|
+
this.options = void 0, this.options = n ? s({}, n.options || {}, r || {}) : s({}, r || {});
|
|
254
254
|
}
|
|
255
255
|
var i = t.prototype;
|
|
256
256
|
return i.withOptions = function(r) {
|
|
@@ -259,10 +259,10 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
259
259
|
};
|
|
260
260
|
for (var a in r)
|
|
261
261
|
if (r.hasOwnProperty(a)) {
|
|
262
|
-
var
|
|
263
|
-
e[
|
|
262
|
+
var h = X(a);
|
|
263
|
+
e[h] = r[a];
|
|
264
264
|
}
|
|
265
|
-
return new t(this,
|
|
265
|
+
return new t(this, s({
|
|
266
266
|
baseUrl: o
|
|
267
267
|
}, e));
|
|
268
268
|
}, i.image = function(r) {
|
|
@@ -402,7 +402,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
402
402
|
return this.url();
|
|
403
403
|
}, t;
|
|
404
404
|
}();
|
|
405
|
-
return
|
|
405
|
+
return Y;
|
|
406
406
|
});
|
|
407
407
|
})(k);
|
|
408
408
|
const C = P, tt = [
|
|
@@ -437,63 +437,45 @@ const C = P, tt = [
|
|
|
437
437
|
360,
|
|
438
438
|
240
|
|
439
439
|
], K = 24, Z = 1200, T = 90;
|
|
440
|
-
function W(
|
|
441
|
-
return
|
|
440
|
+
function W(f, y, s) {
|
|
441
|
+
return f ? f * (1 - (y ?? 0) - (s ?? 0)) : void 0;
|
|
442
442
|
}
|
|
443
443
|
function rt({
|
|
444
|
-
image:
|
|
445
|
-
client:
|
|
446
|
-
widths:
|
|
447
|
-
quality:
|
|
444
|
+
image: f,
|
|
445
|
+
client: y,
|
|
446
|
+
widths: s,
|
|
447
|
+
quality: v = T
|
|
448
448
|
}) {
|
|
449
|
-
var S,
|
|
450
|
-
const I = Array.from(
|
|
449
|
+
var S, U;
|
|
450
|
+
const I = Array.from(s).sort((O, A) => O - A), M = C(y).image(f).quality(v).auto("format"), d = typeof f == "object" && "asset" in f ? f.asset.metadata : void 0, u = typeof f == "object" && "crop" in f ? f.crop : void 0;
|
|
451
451
|
return {
|
|
452
|
-
src: (
|
|
452
|
+
src: (d == null ? void 0 : d.lqip) ?? M.width(K).url().toString(),
|
|
453
453
|
srcset: I.map((O) => `${M.width(O).url()} ${O}w`).join(","),
|
|
454
454
|
naturalWidth: W(
|
|
455
|
-
(S =
|
|
456
|
-
|
|
457
|
-
|
|
455
|
+
(S = d == null ? void 0 : d.dimensions) == null ? void 0 : S.width,
|
|
456
|
+
u == null ? void 0 : u.left,
|
|
457
|
+
u == null ? void 0 : u.right
|
|
458
458
|
),
|
|
459
459
|
naturalHeight: W(
|
|
460
|
-
(
|
|
461
|
-
|
|
462
|
-
|
|
460
|
+
(U = d == null ? void 0 : d.dimensions) == null ? void 0 : U.height,
|
|
461
|
+
u == null ? void 0 : u.top,
|
|
462
|
+
u == null ? void 0 : u.bottom
|
|
463
463
|
)
|
|
464
464
|
};
|
|
465
465
|
}
|
|
466
466
|
function it({
|
|
467
|
-
image:
|
|
468
|
-
client:
|
|
469
|
-
width:
|
|
470
|
-
quality:
|
|
471
|
-
}) {
|
|
472
|
-
return C(u).image(s).quality(w).auto("format").width(h).url();
|
|
473
|
-
}
|
|
474
|
-
function nt({
|
|
475
|
-
naturalWidth: s,
|
|
476
|
-
naturalHeight: u
|
|
467
|
+
image: f,
|
|
468
|
+
client: y,
|
|
469
|
+
width: s = Z,
|
|
470
|
+
quality: v = T
|
|
477
471
|
}) {
|
|
478
|
-
return
|
|
479
|
-
}
|
|
480
|
-
function et({
|
|
481
|
-
naturalWidth: s,
|
|
482
|
-
naturalHeight: u
|
|
483
|
-
}) {
|
|
484
|
-
return s && u ? u / s : void 0;
|
|
485
|
-
}
|
|
486
|
-
function ot(s) {
|
|
487
|
-
return s.sort(([u], [h]) => h - u).map(([u, h]) => `(min-width: ${u}px) ${h}`).concat(["100vw"]).join(", ");
|
|
472
|
+
return C(y).image(f).quality(v).auto("format").width(s).url();
|
|
488
473
|
}
|
|
489
474
|
export {
|
|
490
|
-
et as aspectRatio,
|
|
491
475
|
Z as defaultMetaImageWidth,
|
|
492
476
|
T as defaultQuality,
|
|
493
477
|
tt as defaultWidths,
|
|
494
478
|
rt as imageProps,
|
|
495
479
|
K as lowResWidth,
|
|
496
|
-
it as metaImageUrl
|
|
497
|
-
ot as sizes,
|
|
498
|
-
nt as styleAspectRatio
|
|
480
|
+
it as metaImageUrl
|
|
499
481
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var
|
|
1
|
+
(function(c,x){typeof exports=="object"&&typeof module<"u"?x(exports):typeof define=="function"&&define.amd?define(["exports"],x):(c=typeof globalThis<"u"?globalThis:c||self,x(c["sanity-image"]={}))})(this,function(c){"use strict";var x=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},P={},V={get exports(){return P},set exports(f){P=f}};(function(f,O){(function(s,w){f.exports=w()})(x,function(){function s(){return s=Object.assign||function(t){for(var r=1;r<arguments.length;r++){var n=arguments[r];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])}return t},s.apply(this,arguments)}function w(t,r){if(t){if(typeof t=="string")return S(t,r);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return S(t,r)}}function S(t,r){(r==null||r>t.length)&&(r=t.length);for(var n=0,i=new Array(r);n<r;n++)i[n]=t[n];return i}function j(t,r){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=w(t))||r&&t&&typeof t.length=="number"){n&&(t=n);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
2
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}var d="image-Tb9Ew8CXIwaY6R1kjMvI0uRR-2000x3000-jpg";function u(t){var r=t.split("-"),n=r[1],i=r[2],o=r[3];if(!n||!i||!o)throw new Error("Malformed asset _ref '"+t+`'. Expected an id like "`+d+'".');var e=i.split("x"),a=e[0],h=e[1],m=+a,l=+h,p=isFinite(m)&&isFinite(l);if(!p)throw new Error("Malformed asset _ref '"+t+`'. Expected an id like "`+d+'".');return{id:n,width:m,height:l,format:o}}var U=function(r){var n=r;return n?typeof n._ref=="string":!1},A=function(r){var n=r;return n?typeof n._id=="string":!1},I=function(r){var n=r;return n&&n.asset?typeof n.asset.url=="string":!1};function R(t){if(!t)return null;var r;if(typeof t=="string"&&D(t))r={asset:{_ref:_(t)}};else if(typeof t=="string")r={asset:{_ref:t}};else if(U(t))r={asset:t};else if(A(t))r={asset:{_ref:t._id||""}};else if(I(t))r={asset:{_ref:_(t.asset.url)}};else if(typeof t.asset=="object")r=s({},t);else return null;var n=t;return n.crop&&(r.crop=n.crop),n.hotspot&&(r.hotspot=n.hotspot),G(r)}function D(t){return/^https?:\/\//.test(""+t)}function _(t){var r=t.split("/").slice(-1);return("image-"+r[0]).replace(/\.([a-z]+)$/,"-$1")}function G(t){if(t.crop&&t.hotspot)return t;var r=s({},t);return r.crop||(r.crop={left:0,top:0,bottom:0,right:0}),r.hotspot||(r.hotspot={x:.5,y:.5,height:1,width:1}),r}var L=[["width","w"],["height","h"],["format","fm"],["download","dl"],["blur","blur"],["sharpen","sharp"],["invert","invert"],["orientation","or"],["minHeight","min-h"],["maxHeight","max-h"],["minWidth","min-w"],["maxWidth","max-w"],["quality","q"],["fit","fit"],["crop","crop"],["saturation","sat"],["auto","auto"],["dpr","dpr"],["pad","pad"]];function Q(t){var r=s({},t||{}),n=r.source;delete r.source;var i=R(n);if(!i)throw new Error("Unable to resolve image URL from source ("+JSON.stringify(n)+")");var o=i.asset._ref||i.asset._id||"",e=u(o),a=Math.round(i.crop.left*e.width),h=Math.round(i.crop.top*e.height),m={left:a,top:h,width:Math.round(e.width-i.crop.right*e.width-a),height:Math.round(e.height-i.crop.bottom*e.height-h)},l=i.hotspot.height*e.height/2,p=i.hotspot.width*e.width/2,v=i.hotspot.x*e.width,b=i.hotspot.y*e.height,g={left:v-p,top:b-l,right:v+p,bottom:b+l};return r.rect||r.focalPoint||r.ignoreImageParams||r.crop||(r=s({},r,Y({crop:m,hotspot:g},r))),X(s({},r,{asset:e}))}function X(t){var r=(t.baseUrl||"https://cdn.sanity.io").replace(/\/+$/,""),n=t.asset.id+"-"+t.asset.width+"x"+t.asset.height+"."+t.asset.format,i=r+"/images/"+t.projectId+"/"+t.dataset+"/"+n,o=[];if(t.rect){var e=t.rect,a=e.left,h=e.top,m=e.width,l=e.height,p=a!==0||h!==0||l!==t.asset.height||m!==t.asset.width;p&&o.push("rect="+a+","+h+","+m+","+l)}t.bg&&o.push("bg="+t.bg),t.focalPoint&&(o.push("fp-x="+t.focalPoint.x),o.push("fp-y="+t.focalPoint.y));var v=[t.flipHorizontal&&"h",t.flipVertical&&"v"].filter(Boolean).join("");return v&&o.push("flip="+v),L.forEach(function(b){var g=b[0],y=b[1];typeof t[g]<"u"?o.push(y+"="+encodeURIComponent(t[g])):typeof t[y]<"u"&&o.push(y+"="+encodeURIComponent(t[y]))}),o.length===0?i:i+"?"+o.join("&")}function Y(t,r){var n,i=r.width,o=r.height;if(!(i&&o))return{width:i,height:o,rect:t.crop};var e=t.crop,a=t.hotspot,h=i/o,m=e.width/e.height;if(m>h){var l=Math.round(e.height),p=Math.round(l*h),v=Math.max(0,Math.round(e.top)),b=Math.round((a.right-a.left)/2+a.left),g=Math.max(0,Math.round(b-p/2));g<e.left?g=e.left:g+p>e.left+e.width&&(g=e.left+e.width-p),n={left:g,top:v,width:p,height:l}}else{var y=e.width,H=Math.round(y/h),rt=Math.max(0,Math.round(e.left)),nt=Math.round((a.bottom-a.top)/2+a.top),M=Math.max(0,Math.round(nt-H/2));M<e.top?M=e.top:M+H>e.top+e.height&&(M=e.top+e.height-H),n={left:rt,top:M,width:y,height:H}}return{width:i,height:o,rect:n}}var J=["clip","crop","fill","fillmax","max","scale","min"],$=["top","bottom","left","right","center","focalpoint","entropy"],k=["format"];function K(t){return t&&"config"in t?typeof t.config=="function":!1}function Z(t){return t&&"clientConfig"in t?typeof t.clientConfig=="object":!1}function tt(t){for(var r=L,n=j(r),i;!(i=n()).done;){var o=i.value,e=o[0],a=o[1];if(t===e||t===a)return e}return t}function it(t){if(K(t)){var r=t.config(),n=r.apiHost,i=r.projectId,o=r.dataset,e=n||"https://api.sanity.io";return new E(null,{baseUrl:e.replace(/^https:\/\/api\./,"https://cdn."),projectId:i,dataset:o})}var a=t;if(Z(a)){var h=a.clientConfig,m=h.apiHost,l=h.projectId,p=h.dataset,v=m||"https://api.sanity.io";return new E(null,{baseUrl:v.replace(/^https:\/\/api\./,"https://cdn."),projectId:l,dataset:p})}return new E(null,t)}var E=function(){function t(n,i){this.options=void 0,this.options=n?s({},n.options||{},i||{}):s({},i||{})}var r=t.prototype;return r.withOptions=function(i){var o=i.baseUrl||this.options.baseUrl,e={baseUrl:o};for(var a in i)if(i.hasOwnProperty(a)){var h=tt(a);e[h]=i[a]}return new t(this,s({baseUrl:o},e))},r.image=function(i){return this.withOptions({source:i})},r.dataset=function(i){return this.withOptions({dataset:i})},r.projectId=function(i){return this.withOptions({projectId:i})},r.bg=function(i){return this.withOptions({bg:i})},r.dpr=function(i){return this.withOptions(i&&i!==1?{dpr:i}:{})},r.width=function(i){return this.withOptions({width:i})},r.height=function(i){return this.withOptions({height:i})},r.focalPoint=function(i,o){return this.withOptions({focalPoint:{x:i,y:o}})},r.maxWidth=function(i){return this.withOptions({maxWidth:i})},r.minWidth=function(i){return this.withOptions({minWidth:i})},r.maxHeight=function(i){return this.withOptions({maxHeight:i})},r.minHeight=function(i){return this.withOptions({minHeight:i})},r.size=function(i,o){return this.withOptions({width:i,height:o})},r.blur=function(i){return this.withOptions({blur:i})},r.sharpen=function(i){return this.withOptions({sharpen:i})},r.rect=function(i,o,e,a){return this.withOptions({rect:{left:i,top:o,width:e,height:a}})},r.format=function(i){return this.withOptions({format:i})},r.invert=function(i){return this.withOptions({invert:i})},r.orientation=function(i){return this.withOptions({orientation:i})},r.quality=function(i){return this.withOptions({quality:i})},r.forceDownload=function(i){return this.withOptions({download:i})},r.flipHorizontal=function(){return this.withOptions({flipHorizontal:!0})},r.flipVertical=function(){return this.withOptions({flipVertical:!0})},r.ignoreImageParams=function(){return this.withOptions({ignoreImageParams:!0})},r.fit=function(i){if(J.indexOf(i)===-1)throw new Error('Invalid fit mode "'+i+'"');return this.withOptions({fit:i})},r.crop=function(i){if($.indexOf(i)===-1)throw new Error('Invalid crop mode "'+i+'"');return this.withOptions({crop:i})},r.saturation=function(i){return this.withOptions({saturation:i})},r.auto=function(i){if(k.indexOf(i)===-1)throw new Error('Invalid auto mode "'+i+'"');return this.withOptions({auto:i})},r.pad=function(i){return this.withOptions({pad:i})},r.url=function(){return Q(this.options)},r.toString=function(){return this.url()},t}();return it})})(V);const T=P,B=[6016,5120,4480,3840,3200,2560,2048,1920,1668,1280,1080,960,720,640,480,360,240],C=24,q=1200,W=90;function z(f,O,s){return f?f*(1-(O??0)-(s??0)):void 0}function F({image:f,client:O,widths:s,quality:w=W}){var U,A;const S=Array.from(s).sort((I,R)=>I-R),j=T(O).image(f).quality(w).auto("format"),d=typeof f=="object"&&"asset"in f?f.asset.metadata:void 0,u=typeof f=="object"&&"crop"in f?f.crop:void 0;return{src:(d==null?void 0:d.lqip)??j.width(C).url().toString(),srcset:S.map(I=>`${j.width(I).url()} ${I}w`).join(","),naturalWidth:z((U=d==null?void 0:d.dimensions)==null?void 0:U.width,u==null?void 0:u.left,u==null?void 0:u.right),naturalHeight:z((A=d==null?void 0:d.dimensions)==null?void 0:A.height,u==null?void 0:u.top,u==null?void 0:u.bottom)}}function N({image:f,client:O,width:s=q,quality:w=W}){return T(O).image(f).quality(w).auto("format").width(s).url()}c.defaultMetaImageWidth=q,c.defaultQuality=W,c.defaultWidths=B,c.imageProps=F,c.lowResWidth=C,c.metaImageUrl=N,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})});
|