@behold/widget 0.5.56 → 0.5.57
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/ElasticCarousel-WWMTzi-V.js +1032 -0
- package/dist/ErrorMessage-tHLrPf_h.js +110 -0
- package/dist/GalleryWall-Jlau7S7U.js +354 -0
- package/dist/Grid-2Aag90e0.js +338 -0
- package/dist/PopoverGallery-pssVDO_O.js +1905 -0
- package/dist/Widget.d.ts.map +1 -1
- package/dist/base-GZO73SkY.js +1220 -0
- package/dist/caret-right-S2XSTDFy.js +5 -0
- package/dist/index-R4lEDZFo.js +985 -0
- package/dist/index.js +1 -1
- package/dist/resizeObserver-OlrW1x9X.js +454 -0
- package/package.json +1 -1
- package/dist/ElasticCarousel-s2sX3nIq.js +0 -1
- package/dist/ErrorMessage-3rbOheq9.js +0 -1
- package/dist/GalleryWall-mEjc2b_H.js +0 -1
- package/dist/Grid-x7FHVqft.js +0 -1
- package/dist/PopoverGallery-tM2duxr5.js +0 -1
- package/dist/base-DWXYuUGq.js +0 -1
- package/dist/caret-right-xsqAZl9R.js +0 -1
- package/dist/index-Gpp9x18n.js +0 -1
- package/dist/resizeObserver--rsjm-GV.js +0 -1
package/dist/index.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export{W as widget}from
|
1
|
+
export { W as widget } from './index-R4lEDZFo.js';
|
@@ -0,0 +1,454 @@
|
|
1
|
+
var e,
|
2
|
+
t = [],
|
3
|
+
n = 'ResizeObserver loop completed with undelivered notifications.';
|
4
|
+
!(function (e) {
|
5
|
+
(e.BORDER_BOX = 'border-box'),
|
6
|
+
(e.CONTENT_BOX = 'content-box'),
|
7
|
+
(e.DEVICE_PIXEL_CONTENT_BOX = 'device-pixel-content-box');
|
8
|
+
})(e || (e = {}));
|
9
|
+
var r,
|
10
|
+
i = function (e) {
|
11
|
+
return Object.freeze(e)
|
12
|
+
},
|
13
|
+
o = function (e, t) {
|
14
|
+
(this.inlineSize = e), (this.blockSize = t), i(this);
|
15
|
+
},
|
16
|
+
s = (function () {
|
17
|
+
function e(e, t, n, r) {
|
18
|
+
return (
|
19
|
+
(this.x = e),
|
20
|
+
(this.y = t),
|
21
|
+
(this.width = n),
|
22
|
+
(this.height = r),
|
23
|
+
(this.top = this.y),
|
24
|
+
(this.left = this.x),
|
25
|
+
(this.bottom = this.top + this.height),
|
26
|
+
(this.right = this.left + this.width),
|
27
|
+
i(this)
|
28
|
+
)
|
29
|
+
}
|
30
|
+
return (
|
31
|
+
(e.prototype.toJSON = function () {
|
32
|
+
var e = this;
|
33
|
+
return {
|
34
|
+
x: e.x,
|
35
|
+
y: e.y,
|
36
|
+
top: e.top,
|
37
|
+
right: e.right,
|
38
|
+
bottom: e.bottom,
|
39
|
+
left: e.left,
|
40
|
+
width: e.width,
|
41
|
+
height: e.height,
|
42
|
+
}
|
43
|
+
}),
|
44
|
+
(e.fromRect = function (t) {
|
45
|
+
return new e(t.x, t.y, t.width, t.height)
|
46
|
+
}),
|
47
|
+
e
|
48
|
+
)
|
49
|
+
})(),
|
50
|
+
a = function (e) {
|
51
|
+
return e instanceof SVGElement && 'getBBox' in e
|
52
|
+
},
|
53
|
+
c = function (e) {
|
54
|
+
if (a(e)) {
|
55
|
+
var t = e.getBBox(),
|
56
|
+
n = t.width,
|
57
|
+
r = t.height;
|
58
|
+
return !n && !r
|
59
|
+
}
|
60
|
+
var i = e,
|
61
|
+
o = i.offsetWidth,
|
62
|
+
s = i.offsetHeight;
|
63
|
+
return !(o || s || e.getClientRects().length)
|
64
|
+
},
|
65
|
+
u = function (e) {
|
66
|
+
var t;
|
67
|
+
if (e instanceof Element) return !0
|
68
|
+
var n =
|
69
|
+
null === (t = null == e ? void 0 : e.ownerDocument) || void 0 === t
|
70
|
+
? void 0
|
71
|
+
: t.defaultView;
|
72
|
+
return !!(n && e instanceof n.Element)
|
73
|
+
},
|
74
|
+
h = 'undefined' != typeof window ? window : {},
|
75
|
+
f = new WeakMap(),
|
76
|
+
d = /auto|scroll/,
|
77
|
+
v = /^tb|vertical/,
|
78
|
+
l = /msie|trident/i.test(h.navigator && h.navigator.userAgent),
|
79
|
+
p = function (e) {
|
80
|
+
return parseFloat(e || '0')
|
81
|
+
},
|
82
|
+
g = function (e, t, n) {
|
83
|
+
return (
|
84
|
+
void 0 === e && (e = 0),
|
85
|
+
void 0 === t && (t = 0),
|
86
|
+
void 0 === n && (n = !1),
|
87
|
+
new o((n ? t : e) || 0, (n ? e : t) || 0)
|
88
|
+
)
|
89
|
+
},
|
90
|
+
b = i({
|
91
|
+
devicePixelContentBoxSize: g(),
|
92
|
+
borderBoxSize: g(),
|
93
|
+
contentBoxSize: g(),
|
94
|
+
contentRect: new s(0, 0, 0, 0),
|
95
|
+
}),
|
96
|
+
w = function (e, t) {
|
97
|
+
if ((void 0 === t && (t = !1), f.has(e) && !t)) return f.get(e)
|
98
|
+
if (c(e)) return f.set(e, b), b
|
99
|
+
var n = getComputedStyle(e),
|
100
|
+
r = a(e) && e.ownerSVGElement && e.getBBox(),
|
101
|
+
o = !l && 'border-box' === n.boxSizing,
|
102
|
+
u = v.test(n.writingMode || ''),
|
103
|
+
h = !r && d.test(n.overflowY || ''),
|
104
|
+
w = !r && d.test(n.overflowX || ''),
|
105
|
+
x = r ? 0 : p(n.paddingTop),
|
106
|
+
E = r ? 0 : p(n.paddingRight),
|
107
|
+
T = r ? 0 : p(n.paddingBottom),
|
108
|
+
m = r ? 0 : p(n.paddingLeft),
|
109
|
+
y = r ? 0 : p(n.borderTopWidth),
|
110
|
+
z = r ? 0 : p(n.borderRightWidth),
|
111
|
+
B = r ? 0 : p(n.borderBottomWidth),
|
112
|
+
S = m + E,
|
113
|
+
O = x + T,
|
114
|
+
R = (r ? 0 : p(n.borderLeftWidth)) + z,
|
115
|
+
C = y + B,
|
116
|
+
k = w ? e.offsetHeight - C - e.clientHeight : 0,
|
117
|
+
N = h ? e.offsetWidth - R - e.clientWidth : 0,
|
118
|
+
D = o ? S + R : 0,
|
119
|
+
M = o ? O + C : 0,
|
120
|
+
P = r ? r.width : p(n.width) - D - N,
|
121
|
+
_ = r ? r.height : p(n.height) - M - k,
|
122
|
+
F = P + S + N + R,
|
123
|
+
I = _ + O + k + C,
|
124
|
+
L = i({
|
125
|
+
devicePixelContentBoxSize: g(
|
126
|
+
Math.round(P * devicePixelRatio),
|
127
|
+
Math.round(_ * devicePixelRatio),
|
128
|
+
u,
|
129
|
+
),
|
130
|
+
borderBoxSize: g(F, I, u),
|
131
|
+
contentBoxSize: g(P, _, u),
|
132
|
+
contentRect: new s(m, x, P, _),
|
133
|
+
});
|
134
|
+
return f.set(e, L), L
|
135
|
+
},
|
136
|
+
x = function (t, n, r) {
|
137
|
+
var i = w(t, r),
|
138
|
+
o = i.borderBoxSize,
|
139
|
+
s = i.contentBoxSize,
|
140
|
+
a = i.devicePixelContentBoxSize;
|
141
|
+
switch (n) {
|
142
|
+
case e.DEVICE_PIXEL_CONTENT_BOX:
|
143
|
+
return a
|
144
|
+
case e.BORDER_BOX:
|
145
|
+
return o
|
146
|
+
default:
|
147
|
+
return s
|
148
|
+
}
|
149
|
+
},
|
150
|
+
E = function (e) {
|
151
|
+
var t = w(e)
|
152
|
+
;(this.target = e),
|
153
|
+
(this.contentRect = t.contentRect),
|
154
|
+
(this.borderBoxSize = i([t.borderBoxSize])),
|
155
|
+
(this.contentBoxSize = i([t.contentBoxSize])),
|
156
|
+
(this.devicePixelContentBoxSize = i([t.devicePixelContentBoxSize]));
|
157
|
+
},
|
158
|
+
T = function (e) {
|
159
|
+
if (c(e)) return 1 / 0
|
160
|
+
for (var t = 0, n = e.parentNode; n; ) (t += 1), (n = n.parentNode);
|
161
|
+
return t
|
162
|
+
},
|
163
|
+
m = function () {
|
164
|
+
var e = 1 / 0,
|
165
|
+
n = [];
|
166
|
+
t.forEach(function (t) {
|
167
|
+
if (0 !== t.activeTargets.length) {
|
168
|
+
var r = [];
|
169
|
+
t.activeTargets.forEach(function (t) {
|
170
|
+
var n = new E(t.target),
|
171
|
+
i = T(t.target);
|
172
|
+
r.push(n),
|
173
|
+
(t.lastReportedSize = x(t.target, t.observedBox)),
|
174
|
+
i < e && (e = i);
|
175
|
+
}),
|
176
|
+
n.push(function () {
|
177
|
+
t.callback.call(t.observer, r, t.observer);
|
178
|
+
}),
|
179
|
+
t.activeTargets.splice(0, t.activeTargets.length);
|
180
|
+
}
|
181
|
+
});
|
182
|
+
for (var r = 0, i = n; r < i.length; r++) {
|
183
|
+
(0, i[r])();
|
184
|
+
}
|
185
|
+
return e
|
186
|
+
},
|
187
|
+
y = function (e) {
|
188
|
+
t.forEach(function (t) {
|
189
|
+
t.activeTargets.splice(0, t.activeTargets.length),
|
190
|
+
t.skippedTargets.splice(0, t.skippedTargets.length),
|
191
|
+
t.observationTargets.forEach(function (n) {
|
192
|
+
n.isActive() &&
|
193
|
+
(T(n.target) > e
|
194
|
+
? t.activeTargets.push(n)
|
195
|
+
: t.skippedTargets.push(n));
|
196
|
+
});
|
197
|
+
});
|
198
|
+
},
|
199
|
+
z = function () {
|
200
|
+
var e,
|
201
|
+
r = 0;
|
202
|
+
for (
|
203
|
+
y(r);
|
204
|
+
t.some(function (e) {
|
205
|
+
return e.activeTargets.length > 0
|
206
|
+
});
|
207
|
+
|
208
|
+
)
|
209
|
+
(r = m()), y(r);
|
210
|
+
return (
|
211
|
+
t.some(function (e) {
|
212
|
+
return e.skippedTargets.length > 0
|
213
|
+
}) &&
|
214
|
+
('function' == typeof ErrorEvent
|
215
|
+
? (e = new ErrorEvent('error', { message: n }))
|
216
|
+
: ((e = document.createEvent('Event')).initEvent('error', !1, !1),
|
217
|
+
(e.message = n)),
|
218
|
+
window.dispatchEvent(e)),
|
219
|
+
r > 0
|
220
|
+
)
|
221
|
+
},
|
222
|
+
B = [],
|
223
|
+
S = function (e) {
|
224
|
+
if (!r) {
|
225
|
+
var t = 0,
|
226
|
+
n = document.createTextNode('');
|
227
|
+
new MutationObserver(function () {
|
228
|
+
return B.splice(0).forEach(function (e) {
|
229
|
+
return e()
|
230
|
+
})
|
231
|
+
}).observe(n, { characterData: !0 }),
|
232
|
+
(r = function () {
|
233
|
+
n.textContent = ''.concat(t ? t-- : t++);
|
234
|
+
});
|
235
|
+
}
|
236
|
+
B.push(e), r();
|
237
|
+
},
|
238
|
+
O = 0,
|
239
|
+
R = { attributes: !0, characterData: !0, childList: !0, subtree: !0 },
|
240
|
+
C = [
|
241
|
+
'resize',
|
242
|
+
'load',
|
243
|
+
'transitionend',
|
244
|
+
'animationend',
|
245
|
+
'animationstart',
|
246
|
+
'animationiteration',
|
247
|
+
'keyup',
|
248
|
+
'keydown',
|
249
|
+
'mouseup',
|
250
|
+
'mousedown',
|
251
|
+
'mouseover',
|
252
|
+
'mouseout',
|
253
|
+
'blur',
|
254
|
+
'focus',
|
255
|
+
],
|
256
|
+
k = function (e) {
|
257
|
+
return void 0 === e && (e = 0), Date.now() + e
|
258
|
+
},
|
259
|
+
N = !1,
|
260
|
+
D = new ((function () {
|
261
|
+
function e() {
|
262
|
+
var e = this
|
263
|
+
;(this.stopped = !0),
|
264
|
+
(this.listener = function () {
|
265
|
+
return e.schedule()
|
266
|
+
});
|
267
|
+
}
|
268
|
+
return (
|
269
|
+
(e.prototype.run = function (e) {
|
270
|
+
var t = this;
|
271
|
+
if ((void 0 === e && (e = 250), !N)) {
|
272
|
+
N = !0;
|
273
|
+
var n,
|
274
|
+
r = k(e)
|
275
|
+
;(n = function () {
|
276
|
+
var n = !1;
|
277
|
+
try {
|
278
|
+
n = z();
|
279
|
+
} finally {
|
280
|
+
if (((N = !1), (e = r - k()), !O)) return
|
281
|
+
n ? t.run(1e3) : e > 0 ? t.run(e) : t.start();
|
282
|
+
}
|
283
|
+
}),
|
284
|
+
S(function () {
|
285
|
+
requestAnimationFrame(n);
|
286
|
+
});
|
287
|
+
}
|
288
|
+
}),
|
289
|
+
(e.prototype.schedule = function () {
|
290
|
+
this.stop(), this.run();
|
291
|
+
}),
|
292
|
+
(e.prototype.observe = function () {
|
293
|
+
var e = this,
|
294
|
+
t = function () {
|
295
|
+
return e.observer && e.observer.observe(document.body, R)
|
296
|
+
};
|
297
|
+
document.body ? t() : h.addEventListener('DOMContentLoaded', t);
|
298
|
+
}),
|
299
|
+
(e.prototype.start = function () {
|
300
|
+
var e = this;
|
301
|
+
this.stopped &&
|
302
|
+
((this.stopped = !1),
|
303
|
+
(this.observer = new MutationObserver(this.listener)),
|
304
|
+
this.observe(),
|
305
|
+
C.forEach(function (t) {
|
306
|
+
return h.addEventListener(t, e.listener, !0)
|
307
|
+
}));
|
308
|
+
}),
|
309
|
+
(e.prototype.stop = function () {
|
310
|
+
var e = this;
|
311
|
+
this.stopped ||
|
312
|
+
(this.observer && this.observer.disconnect(),
|
313
|
+
C.forEach(function (t) {
|
314
|
+
return h.removeEventListener(t, e.listener, !0)
|
315
|
+
}),
|
316
|
+
(this.stopped = !0));
|
317
|
+
}),
|
318
|
+
e
|
319
|
+
)
|
320
|
+
})())(),
|
321
|
+
M = function (e) {
|
322
|
+
!O && e > 0 && D.start(), !(O += e) && D.stop();
|
323
|
+
},
|
324
|
+
P = (function () {
|
325
|
+
function t(t, n) {
|
326
|
+
(this.target = t),
|
327
|
+
(this.observedBox = n || e.CONTENT_BOX),
|
328
|
+
(this.lastReportedSize = { inlineSize: 0, blockSize: 0 });
|
329
|
+
}
|
330
|
+
return (
|
331
|
+
(t.prototype.isActive = function () {
|
332
|
+
var e,
|
333
|
+
t = x(this.target, this.observedBox, !0);
|
334
|
+
return (
|
335
|
+
(e = this.target),
|
336
|
+
a(e) ||
|
337
|
+
(function (e) {
|
338
|
+
switch (e.tagName) {
|
339
|
+
case 'INPUT':
|
340
|
+
if ('image' !== e.type) break
|
341
|
+
case 'VIDEO':
|
342
|
+
case 'AUDIO':
|
343
|
+
case 'EMBED':
|
344
|
+
case 'OBJECT':
|
345
|
+
case 'CANVAS':
|
346
|
+
case 'IFRAME':
|
347
|
+
case 'IMG':
|
348
|
+
return !0
|
349
|
+
}
|
350
|
+
return !1
|
351
|
+
})(e) ||
|
352
|
+
'inline' !== getComputedStyle(e).display ||
|
353
|
+
(this.lastReportedSize = t),
|
354
|
+
this.lastReportedSize.inlineSize !== t.inlineSize ||
|
355
|
+
this.lastReportedSize.blockSize !== t.blockSize
|
356
|
+
)
|
357
|
+
}),
|
358
|
+
t
|
359
|
+
)
|
360
|
+
})(),
|
361
|
+
_ = function (e, t) {
|
362
|
+
(this.activeTargets = []),
|
363
|
+
(this.skippedTargets = []),
|
364
|
+
(this.observationTargets = []),
|
365
|
+
(this.observer = e),
|
366
|
+
(this.callback = t);
|
367
|
+
},
|
368
|
+
F = new WeakMap(),
|
369
|
+
I = function (e, t) {
|
370
|
+
for (var n = 0; n < e.length; n += 1) if (e[n].target === t) return n
|
371
|
+
return -1
|
372
|
+
},
|
373
|
+
L = (function () {
|
374
|
+
function e() {}
|
375
|
+
return (
|
376
|
+
(e.connect = function (e, t) {
|
377
|
+
var n = new _(e, t);
|
378
|
+
F.set(e, n);
|
379
|
+
}),
|
380
|
+
(e.observe = function (e, n, r) {
|
381
|
+
var i = F.get(e),
|
382
|
+
o = 0 === i.observationTargets.length;
|
383
|
+
I(i.observationTargets, n) < 0 &&
|
384
|
+
(o && t.push(i),
|
385
|
+
i.observationTargets.push(new P(n, r && r.box)),
|
386
|
+
M(1),
|
387
|
+
D.schedule());
|
388
|
+
}),
|
389
|
+
(e.unobserve = function (e, n) {
|
390
|
+
var r = F.get(e),
|
391
|
+
i = I(r.observationTargets, n),
|
392
|
+
o = 1 === r.observationTargets.length;
|
393
|
+
i >= 0 &&
|
394
|
+
(o && t.splice(t.indexOf(r), 1),
|
395
|
+
r.observationTargets.splice(i, 1),
|
396
|
+
M(-1));
|
397
|
+
}),
|
398
|
+
(e.disconnect = function (e) {
|
399
|
+
var t = this,
|
400
|
+
n = F.get(e);
|
401
|
+
n.observationTargets.slice().forEach(function (n) {
|
402
|
+
return t.unobserve(e, n.target)
|
403
|
+
}),
|
404
|
+
n.activeTargets.splice(0, n.activeTargets.length);
|
405
|
+
}),
|
406
|
+
e
|
407
|
+
)
|
408
|
+
})(),
|
409
|
+
W = (function () {
|
410
|
+
function e(e) {
|
411
|
+
if (0 === arguments.length)
|
412
|
+
throw new TypeError(
|
413
|
+
"Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.",
|
414
|
+
)
|
415
|
+
if ('function' != typeof e)
|
416
|
+
throw new TypeError(
|
417
|
+
"Failed to construct 'ResizeObserver': The callback provided as parameter 1 is not a function.",
|
418
|
+
)
|
419
|
+
L.connect(this, e);
|
420
|
+
}
|
421
|
+
return (
|
422
|
+
(e.prototype.observe = function (e, t) {
|
423
|
+
if (0 === arguments.length)
|
424
|
+
throw new TypeError(
|
425
|
+
"Failed to execute 'observe' on 'ResizeObserver': 1 argument required, but only 0 present.",
|
426
|
+
)
|
427
|
+
if (!u(e))
|
428
|
+
throw new TypeError(
|
429
|
+
"Failed to execute 'observe' on 'ResizeObserver': parameter 1 is not of type 'Element",
|
430
|
+
)
|
431
|
+
L.observe(this, e, t);
|
432
|
+
}),
|
433
|
+
(e.prototype.unobserve = function (e) {
|
434
|
+
if (0 === arguments.length)
|
435
|
+
throw new TypeError(
|
436
|
+
"Failed to execute 'unobserve' on 'ResizeObserver': 1 argument required, but only 0 present.",
|
437
|
+
)
|
438
|
+
if (!u(e))
|
439
|
+
throw new TypeError(
|
440
|
+
"Failed to execute 'unobserve' on 'ResizeObserver': parameter 1 is not of type 'Element",
|
441
|
+
)
|
442
|
+
L.unobserve(this, e);
|
443
|
+
}),
|
444
|
+
(e.prototype.disconnect = function () {
|
445
|
+
L.disconnect(this);
|
446
|
+
}),
|
447
|
+
(e.toString = function () {
|
448
|
+
return 'function ResizeObserver () { [polyfill code] }'
|
449
|
+
}),
|
450
|
+
e
|
451
|
+
)
|
452
|
+
})();
|
453
|
+
|
454
|
+
export { W as ResizeObserver, E as ResizeObserverEntry, o as ResizeObserverSize };
|
package/package.json
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
import{c as t,p as s,g as i,s as e,a as h,h as o}from"./index-Gpp9x18n.js";import{B as a,I as n,V as r,A as l,b as c,g as d}from"./base-DWXYuUGq.js";import{c as p,a as u}from"./caret-right-xsqAZl9R.js";class g{containerEl;slideEls;height;gap;borderRadius;applyBorderRadiusToContainer;snapToSlide;bindToScrollPos;resizeObserver;onSlideChange;t;i;h;o;l;p;u;m;v;S;P;_;M;k;C;R;T;$;A;I;L;B;j;F;G;V;anchorSlide;finalAnchorSlide;constructor({onSlideChange:t}){this.o=[],this.l=!1,this.p=!1,this.u=!1,this.m=0,this.v=0,this.S=0,this.anchorSlide=0,this.P=0,this._={start:0,previous:0},this.M=[],this.k=0,this.$=1/60,this.A=3,this.I=2,this.borderRadius=20,this.applyBorderRadiusToContainer=!1,this.gap=20,this.height=300,this.snapToSlide=!1,this.bindToScrollPos=!1,this.C=40,this.R=0,this.T=0,this.L=window.innerHeight,this.B=null,this.j=0,this.F=()=>{},this.G=!1,this.onSlideChange=t;let s=window.ResizeObserver;"ResizeObserver"in window==0&&(s=window.BeholdResizeObserver),this.resizeObserver=new s((t=>this.handleResize(t))),this.handlePointerdown=this.handlePointerdown.bind(this),this.handlePointermove=this.handlePointermove.bind(this),this.handlePointerup=this.handlePointerup.bind(this)}init({containerEl:s,slideEls:i,height:e=300,gap:h=20,borderRadius:o=40,applyBorderRadiusToContainer:a=!0,snapToSlide:n=!1,bindToScrollPos:r=!1}){this.containerEl=s,this.slideEls=i.map((s=>t({classes:"ec-slide",contents:s}))),this.h=i,this.t=s.offsetWidth,this.i=s?.scrollWidth||0,this.updateSettings({height:e,gap:h,borderRadius:o,applyBorderRadiusToContainer:a,snapToSlide:n,bindToScrollPos:r}),this.addEventListeners(),this.containerEl.style.setProperty("--ec-container-width",`${this.t}px`),this.containerEl.beholdReplaceChildren(...this.slideEls),this.updateDimensions(),this.l=!0,this.loop()}updateSettings({height:t=300,gap:s=20,borderRadius:i=40,applyBorderRadiusToContainer:e=!0,snapToSlide:h=!1,bindToScrollPos:o=!1}){cancelAnimationFrame(this.V),this.V=requestAnimationFrame((()=>{this.height=t,this.gap=s,this.borderRadius=Math.min(i/100*this.height,.45*this.t/2),this.C=Math.max(this.borderRadius,40),this.applyBorderRadiusToContainer=e,this.snapToSlide=h,this.bindToScrollPos=o,this.containerEl.style.setProperty("--ec-height",`${this.height}px`),this.containerEl.style.setProperty("--ec-border-radius",this.applyBorderRadiusToContainer?`${this.borderRadius}px`:"0px"),this.snapToSlide&&(this.P=-this.getClosestSlideToPoint(this.P).leftEdge)}))}destroy(){this.l=!1,cancelAnimationFrame(this.V),this.removeEventListeners(),this.slideEls?.length&&this.slideEls.forEach((t=>{t.remove()})),this.slideEls=null,this.containerEl=null}handleResize(t){let s=null;t&&t.forEach((t=>{t.target===this.containerEl&&(s=t.borderBoxSize?t.borderBoxSize[0].inlineSize:t.contentRect.width)})),this.updateDimensions(s),this.P=Math.max(Math.min(0,this.P),this.t-this.i)}addEventListeners(){this.removeEventListeners(),this.slideEls.length&&this.slideEls.forEach((t=>{this.resizeObserver.observe(t)})),this.containerEl&&(this.resizeObserver.observe(this.containerEl),this.containerEl.addEventListener("pointerdown",this.handlePointerdown),document.addEventListener("pointermove",this.handlePointermove,{passive:!0}),document.addEventListener("pointerup",this.handlePointerup),document.body.addEventListener("pointerleave",this.handlePointerup))}removeEventListeners(){this.resizeObserver.disconnect(),this.containerEl&&(this.containerEl.removeEventListener("pointerdown",this.handlePointerdown),document.removeEventListener("pointermove",this.handlePointermove),document.removeEventListener("pointerup",this.handlePointerup))}handlePointerdown(t){this.p=!0,this.v=this.S,this.P=this.S,this._.start=t.clientX,this._.previous=t.clientX,this.updateDimensions()}handlePointermove(t){if(!this.p)return;const i=t.clientX-this._.start;Math.abs(i)>10&&this.containerEl.classList.add("ec-is-dragging"),this.P=this.v+i,s(this.M,t.clientX-this._.previous,10),this._.previous=t.clientX}handlePointerup(){var t;this.containerEl.classList.remove("ec-is-dragging"),this.p=!1,this.P+=10*((t=this.M).length?t.reduce(((t,s)=>t+s),0)/t.length:0),this.P=Math.max(Math.min(0,this.P),this.t-this.i),this.snapToSlide&&(this.P=-this.getClosestSlideToPoint(this.P).leftEdge)}updateDimensions(t){this.t=t||this.containerEl.offsetWidth;let s=0;this.o=this.slideEls.map(((t,i)=>{let e=t.offsetWidth,h=s;return s+=e,i<this.o.length-1&&(s+=this.gap),{width:e,x:h}})),this.i=s,this.finalAnchorSlide=this.getFinalAnchorSlide(),this.containerEl.style.setProperty("--ec-container-width",`${this.t}px`)}getAcceleration({displacement:t,m:s,stiffness:i=7,mass:e=17,friction:h=1.25}){let o=-i*t/e-h*s;return Math.abs(o)<.001&&(o=0),o*this.$}getClosestSlideToPoint(t){return this.o.reduce(((s,i,e)=>{const h=Math.abs(s.cumulativeWidth+t);return h<s.distanceFromTarget?{index:e,distanceFromTarget:h,leftEdge:s.cumulativeWidth,cumulativeWidth:s.cumulativeWidth+i.width+this.gap}:{...s,cumulativeWidth:s.cumulativeWidth+i.width+this.gap}}),{index:0,distanceFromTarget:1/0,leftEdge:0,cumulativeWidth:0})}getFinalAnchorSlide(){return this.slideEls.reduceRight(((t,s,i)=>(t.cumulativeWidth<this.t&&(t.index=i,t.cumulativeWidth+=this.o[i]?.width||0),t)),{index:0,cumulativeWidth:0}).index}updateScrollPos(){this.F(),this.F=i(this.containerEl,(t=>{this.t=t.width;const s=Math.max(Math.min((this.L-t.top)/(this.L+t.height),1),0);if(s!==this.j){this.u=!0;const t=this.j-s,i=this.L*t*.5;this.P+=i,this.P=Math.max(Math.min(0,this.P),this.t-this.i),this.j=s}this.B=t}))}updatePosition(){const t=this.S-this.P;let s=200,i=23,e=80;this.u&&(s=600,i=40,e=40),(0===this.P||this.P<=this.t-this.i)&&(s=100,i=16,e=45);const h=this.getAcceleration({displacement:t,m:this.m,stiffness:s,friction:i,mass:e});this.m+=h,this.S+=b(this.m)}getSlidePositions(){const t=b(this.S);let s=t,i=!1;const e=this.slideEls.map(((e,h)=>{const o=this.h[h],a=this.o[h]?.width;h>0&&(s+=this.o[h-1]?.width+this.gap);let n=0,r=0,l=0,c=0,d=Math.min(a*this.A,this.t);const p=this.o[h];p&&p.x+p.width*this.A>this.i&&(d=a*(this.slideEls.length-h)+Math.round(this.R));let u=Math.min(Math.max(d-Math.max(this.t-s+Math.round(this.R),0),0)/(d-this.C),1);const g=(a-this.C)*u;if(l=g,n=-g/2,c-=g,s<this.t&&s+a-l+this.gap>=this.t&&t<=0){const t=a-r-l,e=this.C-(this.t-s)<=0?t:this.t-s,o=this.t-(s+e);o>0&&!this.R&&(this.R=o*this.I,this.T=h+1,i=!0),e<this.C/2&&!this.R&&(this.R=(e+this.gap)*this.I,this.T=h+1,i=!0)}Math.round(s-this.gap)<=0&&Math.round(a+s)>0&&(h!==this.anchorSlide&&this.onSlideChange&&this.onSlideChange(h),this.anchorSlide=h),s<=0&&(r=Math.min(Math.abs(s),a-this.C),n=s/-2),this.G&&(s>this.t+250||s+a<-250?o.remove():o.isConnected||e.append(o));const b={el:e,contentEl:o,xPos:s,rightClipInset:l,leftClipInset:r,innerTranslate:n};return s+=c,b}));return i?this.getSlidePositions():e}positionSlides(){this.getSlidePositions().forEach((({el:t,contentEl:s,xPos:i,rightClipInset:e,leftClipInset:h,innerTranslate:o},a)=>{const n=Math.min(this.borderRadius,this.o[a]?.width/2);t.style.transform=`translate3d(${i}px, 0 ,0)`,t.style.clipPath=`inset(0 ${e}px 0 ${h}px round ${n}px)`,s.style.transform=`translate3d(${o}px, 0, 0)`}))}goToSlide(t){this.updateDimensions(),this.P=-this.o[t]?.x??this.P,this.P=Math.max(Math.min(0,this.P),this.t-this.i)}advance(){this.goToSlide(Math.min(this.getClosestSlideToPoint(this.P).index+1,this.slideEls.length-1))}retreat(){this.goToSlide(Math.max(this.getClosestSlideToPoint(this.P).index-1,0))}render(){this.M.shift(),this.slideEls&&(this.bindToScrollPos&&this.updateScrollPos(),this.updatePosition(),this.positionSlides(),this.u=!1)}loop(){if(!this.l)return;const t=performance.now();t-this.k>16&&(this.render(),this.k=t),requestAnimationFrame((()=>this.loop()))}}function b(t,s=3){return parseFloat(t.toFixed(s))}class f extends a{label="ElasticCarousel";widgetSettings;feedMetadata;posts;previewLoadingColors=null;containerEl;headerEl;innerEl;footerEl;instagramLogoEl;labelEl;leftArrowEl;rightArrowEl;slidesContainerEl;postEls;popoverGalleryEl;appliedBreakpoint;medianPaletteHSL;gyre;constructor(){super(),this.onPropChange(this.W,["widgetSettings","feedMetadata","posts","previewLoadingColors"],["widgetSettings","feedMetadata","posts"],this.setup),n.register(),r.register(),l.register(),this.gyre=new g({onSlideChange:t=>this.H(t)}),this.O=this.O.bind(this),this.addEventListener("post-focus-next",this.D),this.addEventListener("post-focus-previous",this.J),this.onConnect((()=>{this.slidesContainerEl=t({classes:"ec-slides"}),this.headerEl=t({type:"header",classes:"ec-header"}),this.innerEl=t({classes:"ec-inner",contents:[this.slidesContainerEl]}),this.footerEl=t({type:"footer",classes:"ec-footer"}),this.labelEl=t({classes:"ec-label"}),this.leftArrowEl=t({type:"button",classes:"ec-button ec-retreat",contents:[p],listeners:{click:()=>this.q()},attributes:{tabindex:-1,disabled:!0}}),this.rightArrowEl=t({type:"button",classes:"ec-button ec-advance",contents:[u],listeners:{click:()=>this.U()},attributes:{tabindex:-1}}),this.containerEl=t({type:"figure",classes:"ec-carousel",contents:[this.innerEl]}),this.renderWidget(this.containerEl,[c,'.ec-carousel{--ec-controls-margin:20px;--ec-button-border-radius:40%;--ec-icon-color:#4a4a4a;--ec-text-color:#4a4a4a;--ec-button-color:#f4f4f4;--ec-button-hover-color:#ececec;--ec-button-icon-color:#4a4a4a;--ec-button-icon-hover-color:#2e2e2e;--ec-button-gap:min(calc(var(--ec-controls-margin)/2),5px);flex-direction:column;height:var(--ec-height);margin:0;overflow:hidden;width:100%}.ec-carousel,.ec-inner{display:flex;justify-content:center}.ec-inner{align-items:center}.ec-slides{border-radius:var(--ec-border-radius);contain:style paint;cursor:grab;height:var(--ec-height);justify-content:flex-start;overflow:hidden;position:relative;touch-action:none;width:100%}.ec-slide,.ec-slides{display:flex;isolation:isolate}.ec-slide{contain:content;flex-shrink:0;height:100%;left:0;max-width:calc(var(--ec-container-width)*.45);position:absolute;top:0;-moz-user-select:none;user-select:none;-webkit-user-select:none;will-change:clip-path,transform}.ec-is-dragging{cursor:grabbing}.ec-is-dragging .ec-slide{pointer-events:none}.ec-footer,.ec-header{display:flex;justify-content:center}.ec-carousel--controls-sides .ec-footer,.ec-carousel--controls-sides .ec-header{padding:0 64px}.ec-header{margin-bottom:var(--ec-controls-margin)}.ec-footer{margin-top:var(--ec-controls-margin)}.ec-label{align-items:center;display:flex;flex-shrink:1;gap:7px 5px;line-height:1.2;min-width:0;overflow:hidden;text-overflow:ellipsis;-moz-user-select:none;user-select:none;-webkit-user-select:none}.ec-carousel--controls-center .ec-button+.ec-label,.ec-carousel--controls-split .ec-button+.ec-label{margin:0 max(calc(var(--ec-controls-margin)*1.5),20px)}.ec-carousel--label-right .ec-label{margin-left:auto}.ec-carousel--label-left .ec-label{margin-right:auto}.ec-label svg{flex-shrink:0;height:24px;margin-right:5px;width:24px}.ec-label svg path{fill:var(--ec-icon-color)}.ec-label a,.ec-label div{color:var(--ec-text-color);display:inline-block;font-family:inherit;font-size:19px;overflow:hidden;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.ec-button,.ec-carousel--controls-center .ec-footer,.ec-carousel--controls-center .ec-header{justify-content:center}.ec-button{align-items:center;background-color:transparent;border:none;cursor:pointer;display:flex;flex-shrink:0;height:44px;padding:0;transition:all .3s ease;width:44px}.ec-carousel--controls-sides .ec-button{height:var(--ec-height);width:64px}.ec-button:disabled{cursor:default;opacity:.5}.ec-button:before{background-color:var(--ec-button-color);border-radius:var(--ec-button-border-radius);content:"";height:44px;position:absolute;transition:all .3s ease;width:44px}.ec-button:not(:disabled):hover:before{background-color:var(--ec-button-hover-color)}.ec-button svg{height:14px;position:relative;width:auto;z-index:1}.ec-button svg path{fill:var(--ec-button-icon-color);transition:all .3s ease}.ec-button:not(:disabled):hover svg path{fill:var(--ec-button-icon-hover-color)}.ec-retreat{padding-right:var(--ec-button-gap);width:calc(44px + var(--ec-button-gap))}.ec-carousel--controls-split .ec-retreat{margin-right:auto}.ec-carousel--controls-right .ec-retreat{margin-left:auto}.ec-advance{padding-left:var(--ec-button-gap);width:calc(44px + var(--ec-button-gap))}.ec-carousel--controls-split .ec-advance{margin-left:auto}.ec-carousel--controls-left .ec-advance{margin-right:auto}.ec-carousel--controls-sides .ec-retreat{padding-right:20px}.ec-carousel--controls-sides .ec-advance{padding-left:20px}.post{height:100%;max-width:calc(var(--ec-container-width)*.45)}.post a{-webkit-user-drag:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.post--placeholder{background-color:#dedede;height:0;padding-bottom:calc(100%/var(--post-aspect-ratio))}']),this.setAttribute("tabindex","0"),this.setAttribute("aria-label","Gallery of Instagram posts. Shift + arrow keys to navigate"),this.onResize(this,this,this.N)}))}setup(){if("transparent"!==this.widgetSettings.loadingColor){const t=this.posts.filter((t=>t.colorPalette)).map((t=>t.colorPalette));this.medianPaletteHSL=d(t,this.widgetSettings.loadingColor)}const t=this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints);this.renderBreakpoint(t),e(this.containerEl,{"--ec-icon-color":this.widgetSettings.iconColor,"--ec-text-color":this.widgetSettings.textColor,"--ec-button-color":this.widgetSettings.buttonColor,"--ec-button-hover-color":this.widgetSettings.buttonHoverColor,"--ec-button-icon-color":this.widgetSettings.buttonIconColor,"--ec-button-icon-hover-color":this.widgetSettings.buttonIconHoverColor}),this.postEls&&this.postEls.forEach((t=>{t.widgetSettings=this.widgetSettings,t.feedMetadata=this.feedMetadata})),this.K(),"openPopupGallery"===this.widgetSettings.onPostClick&&this.enablePopoverGallery()}K(){const s=document.createElement("template");if(s.innerHTML='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1000 1000"><path d="M295.42,6c-53.2,2.51-89.53,11-121.29,23.48-32.87,12.81-60.73,30-88.45,57.82S40.89,143,28.17,175.92c-12.31,31.83-20.65,68.19-23,121.42S2.3,367.68,2.56,503.46,3.42,656.26,6,709.6c2.54,53.19,11,89.51,23.48,121.28,12.83,32.87,30,60.72,57.83,88.45S143,964.09,176,976.83c31.8,12.29,68.17,20.67,121.39,23s70.35,2.87,206.09,2.61,152.83-.86,206.16-3.39S799.1,988,830.88,975.58c32.87-12.86,60.74-30,88.45-57.84S964.1,862,976.81,829.06c12.32-31.8,20.69-68.17,23-121.35,2.33-53.37,2.88-70.41,2.62-206.17s-.87-152.78-3.4-206.1-11-89.53-23.47-121.32c-12.85-32.87-30-60.7-57.82-88.45S862,40.87,829.07,28.19c-31.82-12.31-68.17-20.7-121.39-23S637.33,2.3,501.54,2.56,348.75,3.4,295.42,6m5.84,903.88c-48.75-2.12-75.22-10.22-92.86-17-23.36-9-40-19.88-57.58-37.29s-28.38-34.11-37.5-57.42c-6.85-17.64-15.1-44.08-17.38-92.83-2.48-52.69-3-68.51-3.29-202s.22-149.29,2.53-202c2.08-48.71,10.23-75.21,17-92.84,9-23.39,19.84-40,37.29-57.57s34.1-28.39,57.43-37.51c17.62-6.88,44.06-15.06,92.79-17.38,52.73-2.5,68.53-3,202-3.29s149.31.21,202.06,2.53c48.71,2.12,75.22,10.19,92.83,17,23.37,9,40,19.81,57.57,37.29s28.4,34.07,37.52,57.45c6.89,17.57,15.07,44,17.37,92.76,2.51,52.73,3.08,68.54,3.32,202s-.23,149.31-2.54,202c-2.13,48.75-10.21,75.23-17,92.89-9,23.35-19.85,40-37.31,57.56s-34.09,28.38-57.43,37.5c-17.6,6.87-44.07,15.07-92.76,17.39-52.73,2.48-68.53,3-202.05,3.29s-149.27-.25-202-2.53m407.6-674.61a60,60,0,1,0,59.88-60.1,60,60,0,0,0-59.88,60.1M245.77,503c.28,141.8,115.44,256.49,257.21,256.22S759.52,643.8,759.25,502,643.79,245.48,502,245.76,245.5,361.22,245.77,503m90.06-.18a166.67,166.67,0,1,1,167,166.34,166.65,166.65,0,0,1-167-166.34" transform="translate(-2.5 -2.5)"/><title>Instagram</title></svg>',this.widgetSettings.label){const i=t({type:this.widgetSettings.labelLink?"a":"div",contents:this.widgetSettings.label,attributes:{href:this.widgetSettings.labelLink||null,target:this.widgetSettings.labelLink?"_blank":null}});this.labelEl.beholdReplaceChildren(s.content,i)}else if(this.feedMetadata.hashtags?.length){const i=this.feedMetadata.hashtags.map(((s,i,e)=>t({type:"a",contents:["#",s,i<e.length-1?", ":""],attributes:{target:"_blank",href:`https://instagram.com/explore/tags/${s}`}})));this.labelEl.beholdReplaceChildren(s.content,...i)}else{const i=t({type:"a",contents:[this.feedMetadata.username],attributes:{target:"_blank",href:`https://instagram.com/${this.feedMetadata.username}`}});this.labelEl.beholdReplaceChildren(s.content,i)}}H(t){0===t&&this.leftArrowEl?this.leftArrowEl.disabled=!0:this.leftArrowEl.disabled=!1,t>=this.gyre.finalAnchorSlide?this.rightArrowEl.disabled=!0:this.rightArrowEl.disabled=!1}W({changedProp:t,oldValue:s,newValue:i}){switch(t){case"posts":this.X({oldValue:s,newValue:i});break;case"widgetSettings":this.Y(s,i);break;case"feedMetadata":this.Z();break;case"previewLoadingColors":this.postEls.forEach((t=>{t.previewLoadingColors=this.previewLoadingColors})),h(this,{"is-previewing-loading-colors":!!this.previewLoadingColors})}}X({oldValue:t,newValue:s}){this.postEls=[],this.renderBreakpoint(this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints),!0),this.postEls.forEach((t=>{t.widgetSettings=this.widgetSettings,t.feedMetadata=this.feedMetadata})),this.popoverGalleryEl&&(this.popoverGalleryEl.posts=this.posts)}Y(t,s){let i=!1;this.postEls?.length&&!o(t.breakpoints,s.breakpoints,["postHeight"],1)||(i=!0),e(this.containerEl,{"--ec-icon-color":this.widgetSettings.iconColor,"--ec-text-color":this.widgetSettings.textColor,"--ec-button-color":this.widgetSettings.buttonColor,"--ec-button-hover-color":this.widgetSettings.buttonHoverColor,"--ec-button-icon-color":this.widgetSettings.buttonIconColor,"--ec-button-icon-hover-color":this.widgetSettings.buttonIconHoverColor}),o(t,s,["label","labelLink"])&&this.K(),"openPopupGallery"!==t?.onPostClick&&"openPopupGallery"===s?.onPostClick&&this.enablePopoverGallery();const h=this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints);this.renderBreakpoint(h,i),this.postEls.forEach((t=>{t.widgetSettings=this.widgetSettings})),this.popoverGalleryEl&&(this.popoverGalleryEl.widgetSettings=this.widgetSettings)}Z(){let t=`from @${this.feedMetadata.username}`;this.feedMetadata.hashtags?.length&&(t=`from hashtag${this.feedMetadata.hashtags.length>1?"s":""} ${this.feedMetadata.hashtags.join(", ")}`),this.setAttribute("aria-label",`Gallery of Instagram posts ${t}. Shift + arrow keys to navigate`),this.postEls.forEach((t=>{t.feedMetadata=this.feedMetadata})),this.popoverGalleryEl&&(this.popoverGalleryEl.feedMetadata=this.feedMetadata)}async enablePopoverGallery(){if(this.popoverGalleryEl)return;const{default:t}=await import("./PopoverGallery-tM2duxr5.js");t.register(),this.popoverGalleryEl=document.createElement("behold-popover-gallery"),Object.assign(this.popoverGalleryEl,{widgetSettings:this.widgetSettings,feedMetadata:this.feedMetadata,posts:this.posts,closeFocusEl:this,onSlideChange:t=>{this.gyre.goToSlide(t),this.popoverGalleryEl.closeFocusEl=this.postEls[t]}})}N(t){const s=t.contentBoxSize?.[0]?.inlineSize,i=this.widgetSettings.breakpoints,e=this.getMatchingBreakpoint(s,i);this.renderBreakpoint(e)}J(){if(!this.postEls.length)return;let t=[...this.postEls].indexOf(this.shadow.activeElement?.parentElement);t>0&&(t-=1),this.postEls[t].focus(),this.gyre.goToSlide(t)}D(){if(!this.postEls.length)return;let t=[...this.postEls].indexOf(this.shadow.activeElement?.parentElement);this.gyre.anchorSlide>0&&t<this.gyre.anchorSlide&&(t=this.gyre.anchorSlide),t>-1&&t<this.postEls.length-1&&(t+=1),t<0&&(t=0),this.postEls[t].focus(),this.gyre.goToSlide(t)}O(t){this.popoverGalleryEl.open(this.postEls.indexOf(t),t)}U(){this.gyre&&this.gyre.advance()}q(){this.gyre&&this.gyre.retreat()}renderPosts(t){this.postEls=this.createPostEls(t),this.raf((()=>{this.gyre.destroy(),this.gyre.init({containerEl:this.slidesContainerEl,slideEls:this.postEls,height:t.postHeight,gap:t.gap.x,borderRadius:parseInt(t.borderRadius),applyBorderRadiusToContainer:t.applyBorderRadiusToContainer||!0,snapToSlide:t.snapToSlide||!1,bindToScrollPos:t.bindToScrollPos||!1})}),"renderPosts")}getMatchingBreakpoint(t,s){return Object.entries(s).map((([t,s])=>({width:t,...s}))).filter((t=>"default"!==t.width)).sort(((t,s)=>parseInt(s.width)-parseInt(t.width))).reduce(((s,i)=>t<=parseInt(i.width)?i:s),s.default)}renderBreakpoint(t,s=!1){if(!this.posts||!this.containerEl)return;const i=this.appliedBreakpoint,{showControls:a,controlsPosition:n,controlsJustification:r,showLabel:l,labelPosition:c,labelJustification:d,buttonBorderRadius:p,controlsMargin:u}=t;if(this.postEls?.length&&!o(i,t,["numPosts","forcePostAspectRatio","postAspectRatio","postHeight"])||(s=!0),this.widgetSettings.maxWidth&&this.widgetSettings.constrainWidth&&this.containerEl.style.maxWidth!==`${this.widgetSettings.maxWidth}px`&&(this.containerEl.style.maxWidth=`${this.widgetSettings.maxWidth}px`),this.widgetSettings.constrainWidth||(this.containerEl.style.maxWidth=""),this.leftArrowEl.remove(),this.rightArrowEl.remove(),o(i,t,["showControls","controlsPosition","controlsJustification","showLabel","labelPosition","labelJustification"])||a&&!this.leftArrowEl.isConnected||l&&!this.labelEl.isConnected){this.leftArrowEl.remove(),this.rightArrowEl.remove(),this.labelEl.remove(),this.headerEl.remove(),this.footerEl.remove(),e(this.containerEl,{"--ec-button-border-radius":`${p}%`,"--ec-controls-margin":`${u}px`}),h(this.containerEl,{"ec-carousel--controls-sides":"sides"===n,"ec-carousel--controls-left":"left"===r,"ec-carousel--controls-right":"right"===r,"ec-carousel--controls-center":"center"===r,"ec-carousel--controls-split":"split"===r,"ec-carousel--label-left":"left"===d,"ec-carousel--label-right":"right"===d,"ec-carousel--label-center":"left"===d}),l&&("top"===c&&this.headerEl.append(this.labelEl),"bottom"===c&&this.footerEl.append(this.labelEl));let t=this.innerEl;if("top"===n&&(t=this.headerEl),"bottom"===n&&(t=this.footerEl),a&&"sides"===n)t.prepend(this.leftArrowEl),t.append(this.rightArrowEl);else if(a)switch(r){case"left":t.prepend(this.rightArrowEl),t.prepend(this.leftArrowEl);break;case"right":t.append(this.leftArrowEl),t.append(this.rightArrowEl);break;default:t.prepend(this.leftArrowEl),t.append(this.rightArrowEl)}this.headerEl.childElementCount&&this.containerEl.prepend(this.headerEl),this.footerEl.childElementCount&&this.containerEl.append(this.footerEl)}this.containerEl.setAttribute("data-hover-effect",this.widgetSettings.hoverEffect),s?this.renderPosts(t):this.gyre.updateSettings({height:t.postHeight,gap:t.gap.x,borderRadius:parseInt(t.borderRadius),applyBorderRadiusToContainer:t.applyBorderRadiusToContainer,snapToSlide:t.snapToSlide,bindToScrollPos:t.bindToScrollPos}),this.appliedBreakpoint=t}createPostEls(s){const{numPosts:i,postHeight:e,postAspectRatio:h,forcePostAspectRatio:o}=s,a=this.posts.filter(((t,i)=>i<(s?.numPosts||this.posts?.length||12))),n=a.map(((s,n)=>{const r=[s.sizes.full.width,s.sizes.full.height],l=o?h||[1,1]:r,c=l.reduce(((t,s)=>t/s));let d="behold-image-post";return"VIDEO"===s.mediaType&&(d="behold-video-post"),"CAROUSEL_ALBUM"===s.mediaType&&(d="behold-album-post"),t({type:d,props:{post:s,widgetSettings:this.widgetSettings,feedMetadata:this.feedMetadata,medianPaletteHSL:this.medianPaletteHSL,onClick:this.O,hasRowGap:!0,isLastRow:!1,index:n,aspectRatio:l,totalPosts:a?.length||i||this.posts?.length||0},style:{width:e*c+"px","--post-aspect-ratio":c}})}));for(;n.length<s.numPosts;){const s=t({classes:"post post--placeholder",style:{width:`${e}px`,"--post-aspect-ratio":1}});n.push(s)}return n}static register(t="behold-elastic-carousel"){return customElements.get(t)||customElements.define(t,f),t}}export{f as default};
|
@@ -1 +0,0 @@
|
|
1
|
-
import{B as t,t as e,c as s,a as n}from"./index-Gpp9x18n.js";class l extends t{label="ErrorMessage";shadow;logoEl;styleEl;errorTitleEl;errorMessageEl;errorMessageTextEl;errorMessage;constructor(){super(),this.shadow=this.attachShadow({mode:"open"}),this.onPropChange(this.t,["errorMessage"]),this.onConnect((()=>{this.onResize(this,this,e(this.l,50,this))})),this.onConnect((()=>{this.render()}))}t({changedProp:t}){this.render()}render(){if(!this.errorMessage)return;let t='<?xml version="1.0" encoding="utf-8"?>\n<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 20.5 20.5" enable-background="new 0 0 20.5 20.5" xml:space="preserve">\n<g>\n\t<path fill="#010101" d="M10.2,20.5c-1.2,0-2.4-0.2-3.8-0.5c-2.9-0.7-5.3-3.1-6-6.1C0.2,12.7,0,11.4,0,10.3C0,9.2,0.1,8,0.4,6.8\n\t\tC1.1,3.6,3.7,1,6.9,0.4c2.4-0.5,4.4-0.5,6.8,0c3.3,0.7,5.8,3.2,6.5,6.5c0.2,1.1,0.4,2.3,0.4,3.3c0,1.1-0.1,2.3-0.4,3.5l0,0\n\t\tc-0.7,3.2-3.2,5.7-6.4,6.4C12.5,20.4,11.3,20.5,10.2,20.5z M10.2,1.5c-0.9,0-2,0.1-3,0.3C4.5,2.4,2.5,4.5,1.9,7.1\n\t\tc-0.2,1.1-0.4,2.2-0.4,3.1c0,1,0.1,2.2,0.4,3.4c0.6,2.4,2.5,4.4,4.9,5c2.3,0.6,4.2,0.6,6.6,0.1c2.6-0.6,4.7-2.7,5.2-5.3\n\t\tc0.2-1.1,0.3-2.1,0.3-3.2c0-1-0.1-2-0.3-3c-0.5-2.7-2.6-4.7-5.3-5.3C12.2,1.6,11.2,1.5,10.2,1.5z"/>\n</g>\n<g>\n\t<g>\n\t\t<path fill="#010101" d="M10.2,13.5c0.6,0,1,0.5,1,1.1c0,0.6-0.5,1.1-1,1.1s-1-0.5-1-1.1C9.2,14,9.7,13.5,10.2,13.5z M9.6,12.3\n\t\t\tL9.3,4.7h1.9l-0.3,7.5H9.6z"/>\n\t</g>\n</g>\n</svg>',e="Error";this.errorMessage.includes("Upgrade")&&(t='<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 17.54 17.54"><path d="M8.77,17.54c-2.35,0-4.7-.81-6.33-2.44C-.81,11.84-.81,5.69,2.44,2.44,5.69-.81,11.84-.81,15.1,2.44c3.26,3.25,3.25,9.4,0,12.66-1.63,1.63-3.98,2.44-6.33,2.44ZM8.77,1.51c-1.97,0-3.94,.67-5.27,1.99C.84,6.16,.84,11.38,3.5,14.04c2.66,2.66,7.88,2.66,10.54,0,2.66-2.66,2.66-7.88,0-10.54-1.33-1.33-3.3-1.99-5.27-1.99Z"/><path d="M8.76,13.02c-.41,0-.75-.34-.75-.75V5.26c0-.41,.34-.75,.75-.75s.75,.34,.75,.75v7.01c0,.41-.34,.75-.75,.75Z"/><path d="M6.36,8.42c-.19,0-.38-.07-.53-.22-.29-.29-.29-.77,0-1.06l2.41-2.41c.29-.29,.77-.29,1.06,0s.29,.77,0,1.06l-2.41,2.41c-.15,.15-.34,.22-.53,.22Z"/><path d="M11.17,8.42c-.19,0-.38-.07-.53-.22l-2.41-2.41c-.29-.29-.29-.77,0-1.06s.77-.29,1.06,0l2.41,2.41c.29,.29,.29,.77,0,1.06-.15,.15-.34,.22-.53,.22Z"/></svg>',e="Upgrade Required"),this.logoEl=s({type:"a",classes:"logo",contents:'<?xml version="1.0" encoding="utf-8"?>\n<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"\n\t viewBox="0 0 91.5 29.5" enable-background="new 0 0 91.5 29.5" xml:space="preserve">\n<g>\n\t<path fill="#3BA566" d="M12,11.7c0.8,0,1.8,0.1,2.8,0.3c1.3,0.3,2.4,1.3,2.6,2.6c0.2,1,0.3,1.9,0.3,2.8s-0.1,1.9-0.3,2.9\n\t\tc-0.3,1.3-1.3,2.3-2.6,2.6c-1,0.2-2,0.4-2.8,0.4c-0.9,0-1.9-0.1-3-0.4s-2-1.2-2.3-2.3s-0.4-2.1-0.4-3c0-0.8,0.1-1.8,0.3-2.8\n\t\tc0.3-1.3,1.3-2.4,2.6-2.6C10.2,11.9,11.2,11.7,12,11.7 M12,5.5c-1.4,0-2.8,0.2-4,0.5c-3.8,0.7-6.7,3.6-7.5,7.4\n\t\tC0.2,14.7,0,16.1,0,17.5c0,1.6,0.2,3.1,0.6,4.5c0.8,3.4,3.5,6.1,6.9,7c1.4,0.3,2.9,0.5,4.5,0.5c1.5,0,2.9-0.2,4.2-0.5\n\t\tc3.7-0.8,6.5-3.7,7.3-7.4c0.3-1.3,0.5-2.7,0.5-4.2c0-1.4-0.2-2.8-0.4-4c-0.8-3.8-3.7-6.6-7.5-7.4C14.8,5.7,13.4,5.5,12,5.5L12,5.5z\n\t\t"/>\n</g>\n<g id="type">\n\t<path fill="#FFFFFF" d="M42.2,20.8c0,2.6-1.9,4.3-5.1,4.3h-5.2c0.5-1.4,0.6-2.5,0.6-3.9v-7.7c0-1.4-0.1-2.5-0.6-3.9H37\n\t\tc2.4,0,4.7,1,4.7,3.6c0,2.1-1.4,3.4-3.1,3.9C40.5,17.5,42.2,18.5,42.2,20.8z M35.2,10.4c0,1.1-0.1,2-0.1,3v3.4h1.4\n\t\tc1.7,0,2.5-1.2,2.5-3.1c0-2.2-1-3.4-3.2-3.4C35.6,10.4,35.4,10.4,35.2,10.4z M39.5,21.3c0-2.4-1.4-3.6-3.3-3.6\n\t\tc-0.2,0-0.6,0-1.1,0.1v3.5c0,0.9,0,2,0.1,2.9c0.5,0.1,0.9,0.1,1.4,0.1C38.6,24.3,39.5,23.2,39.5,21.3z"/>\n\t<path fill="#FFFFFF" d="M52.7,19.1h-6.5c0.2,2.5,1.2,4.1,3.8,4.1c1.1,0,1.8-0.3,2.6-0.9c-0.2,1.6-1.5,3.1-3.9,3.1c-3,0-5-2.4-5-6.2\n\t\tc0-3.4,1.6-6.4,5-6.4c2.9,0,4,2.1,4,4.5C52.7,17.3,52.7,19.1,52.7,19.1z M50.2,17.3c0-2.5-0.7-3.6-1.8-3.6c-1.3,0-2.1,1.5-2.1,4.3\n\t\tv0.3h3C50,18.4,50.2,18.3,50.2,17.3z"/>\n\t<path fill="#FFFFFF" d="M64,25.2h-2.8c-0.2-1.1-0.3-2.4-0.3-3.8v-4.6c0-1.4-0.5-2.1-1.5-2.1c-0.6,0-1.3,0.2-2.1,1.2v5.6\n\t\tc0,1.3,0.1,2.3,0.6,3.6h-3.6c0.5-1.3,0.6-2.3,0.6-3.6v-8.2c0-1.5,0-2.9-0.6-4c1.1-0.3,2-0.7,3-1.2v7c0.9-1.6,2.2-2.2,3.4-2.2\n\t\tc1.6,0,2.6,1,2.6,3.4v5C63.4,22.7,63.5,23.8,64,25.2z"/>\n\t<path fill="#FFFFFF" d="M65.4,19.2c0-3.8,2-6.3,5-6.3c2.9,0,4.8,2.7,4.8,6.3c0,3.8-2,6.3-5,6.3C67.3,25.4,65.4,22.8,65.4,19.2z\n\t\t M72.4,19.9c0-3.1-0.7-6.1-2.4-6.1c-1.3,0-1.9,1.7-1.9,4.6c0,3.2,0.7,6.1,2.4,6.1C71.8,24.5,72.4,23,72.4,19.9z"/>\n\t<path fill="#FFFFFF" d="M77.3,21.5v-8.2c0-1.5,0-2.9-0.6-4c1.1-0.3,2-0.7,3-1.2v13.4c0,1.3,0.1,2.3,0.6,3.6h-3.6\n\t\tC77.2,23.8,77.3,22.8,77.3,21.5z"/>\n\t<path fill="#FFFFFF" d="M89,25.2c-0.2-0.3-0.4-0.8-0.4-1.4c-0.7,1.1-1.6,1.5-2.8,1.5c-2.2,0-4-1.9-4-5.6c0-4.4,2.4-6.8,5-6.8\n\t\tc0.7,0,1.2,0.1,1.7,0.4l0,0c0-1.4,0-2.9-0.6-3.9c1.1-0.3,2-0.7,3-1.2v13.3c0,1.3,0.1,2.2,0.6,3.6H89V25.2z M88.5,23.1v-6.6\n\t\tc0-2-0.8-2.6-1.7-2.6c-1.4,0-2.3,1.5-2.3,4.8c0,3.4,1.1,4.9,2.8,4.9C87.8,23.5,88.2,23.4,88.5,23.1z"/>\n</g>\n<g>\n\t<path fill="#FFFFFF" d="M32.3,4.7V0.1h2.2c1,0,1.6,0.7,1.6,1.5c0,0.8-0.6,1.5-1.6,1.5h-1.2v1.7H32.3z M34.3,0.9h-1.1v1.3h1.1\n\t\tC34.7,2.2,35,2,35,1.6C35,1.2,34.7,0.9,34.3,0.9z"/>\n\t<path fill="#FFFFFF" d="M39.5,0C41,0,42,1,42,2.4c0,1.4-1,2.4-2.4,2.4c-1.4,0-2.4-1-2.4-2.4C37.1,1,38.1,0,39.5,0z M39.5,0.9\n\t\tc-0.9,0-1.4,0.7-1.4,1.5c0,0.9,0.6,1.5,1.4,1.5S41,3.3,41,2.4C41,1.5,40.4,0.9,39.5,0.9z"/>\n\t<path fill="#FFFFFF" d="M46.8,4.7L46,1.5l-0.8,3.2h-1.1l-1.3-4.7h1.1l0.8,3.4l0.9-3.4h0.8l0.9,3.4l0.8-3.4h1.1l-1.3,4.7H46.8z"/>\n\t<path fill="#FFFFFF" d="M50.4,4.7V0.1h3.3v0.9h-2.3v1h2.3v0.9h-2.3v1.1h2.3v0.9H50.4z"/>\n\t<path fill="#FFFFFF" d="M57.8,4.7l-0.9-1.7h-0.7v1.7h-1V0.1h2.2c1,0,1.6,0.6,1.6,1.5c0,0.8-0.5,1.3-1,1.4l1.1,1.8H57.8z M57.2,0.9\n\t\th-1v1.3h1c0.4,0,0.7-0.3,0.7-0.6C57.9,1.2,57.6,0.9,57.2,0.9z"/>\n\t<path fill="#FFFFFF" d="M60.4,4.7V0.1h3.3v0.9h-2.3v1h2.3v0.9h-2.3v1.1h2.3v0.9H60.4z"/>\n\t<path fill="#FFFFFF" d="M65.1,4.7V0.1H67c1.5,0,2.5,0.9,2.5,2.3c0,1.4-1,2.3-2.5,2.3H65.1z M66.1,3.9H67c0.9,0,1.5-0.7,1.5-1.5\n\t\tC68.4,1.6,67.9,1,67,1h-0.8V3.9z"/>\n\t<path fill="#FFFFFF" d="M73.3,4.7V0.1h2.5c0.9,0,1.3,0.6,1.3,1.2c0,0.6-0.4,1-0.8,1.1c0.5,0.1,0.9,0.6,0.9,1.1\n\t\tc0,0.7-0.5,1.3-1.4,1.3H73.3z M74.3,2h1.2c0.3,0,0.5-0.2,0.5-0.5c0-0.3-0.2-0.5-0.5-0.5h-1.2V2z M74.3,3.9h1.3\n\t\tc0.4,0,0.6-0.2,0.6-0.6c0-0.3-0.2-0.5-0.6-0.5h-1.3V3.9z"/>\n\t<path fill="#FFFFFF" d="M79.8,4.7V2.8L78,0.1h1.1L80.3,2l1.1-1.9h1.1l-1.8,2.8v1.9H79.8z"/>\n</g>\n</svg>',attributes:{href:"https://behold.so",target:"_blank","aria-label":"behold"}}),this.errorTitleEl=s({classes:"message__title",contents:[t,e]}),this.errorMessageTextEl=s({classes:"message__inner"}),this.errorMessageTextEl.innerHTML=this.errorMessage?.replace("Upgrade your plan",'<a href="https://app.behold.so/account" target="blank">Upgrade your plan</a>'),this.errorMessageEl=s({classes:"message",contents:[this.errorTitleEl,this.errorMessageTextEl]}),this.styleEl=s({type:"style",contents:":host{align-items:center;background:#f1f1f1 url(https://behold.pictures/widget:error-background.webp) 0 no-repeat;background-size:auto 100%;border:none;border-radius:20px;box-shadow:none;box-sizing:border-box;color:#000;display:flex;height:200px;justify-content:space-between;margin:0;max-width:750px;min-width:50px;outline:none;overflow:hidden;width:100%}:host *{box-sizing:border-box}:host(.large){height:180px}:host(.medium),:host(.small){background:#f1f1f1 url(https://behold.pictures/widget:error-background-small.webp) top no-repeat;background-size:auto 186px;flex-direction:column;height:auto}.logo{align-items:center;background:linear-gradient(90deg,rgba(0,0,0,.75) 10%,rgba(0,0,0,.5) 75%,transparent);display:flex;flex-grow:0;flex-shrink:0;height:100%;justify-content:center;padding:0 10px 5px 0;width:220px}.logo svg{height:40px;width:auto}:host(.large) .logo{width:180px}:host(.large) .logo svg{height:35px}:host(.medium) .logo,:host(.small) .logo{background:linear-gradient(180deg,rgba(0,0,0,.75) 10%,rgba(0,0,0,.5) 40%,transparent);height:150px;width:100%}.message{align-items:center;display:flex;flex-direction:column;flex-grow:1;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;font-size:16px;gap:15px;justify-content:center;line-height:1.5;padding:20px 60px 20px 80px;text-align:center}.message a{color:#000;display:inline-block;text-decoration:underline}:host(.large) .message{font-size:15px;gap:10px;padding:20px 30px 20px 70px}:host(.medium) .message{font-size:16px;gap:15px;padding:40px 30px}:host(.small) .message{font-size:15px;gap:15px;padding:30px 20px}.message__title{align-items:center;display:flex;font-size:20px;font-weight:500;justify-content:center}.message__title svg{height:25px;margin-right:15px;width:25px}:host(.large) .message__title{font-size:18px}:host(.large) .message__title svg{height:20px;margin-right:10px;width:20px}:host(.medium) .message__title,:host(.small) .message__title{flex-direction:column;font-size:17px}:host(.medium) .message__title svg,:host(.small) .message__title svg{margin-bottom:7px;margin-right:0}".toString()}),this.shadow.beholdReplaceChildren(this.logoEl,this.errorMessageEl,this.styleEl)}l(t){const e=t?.borderBoxSize?.[0]?.inlineSize||t?.contentRect?.width||0;let s="xlarge";e<600&&(s="large"),e<500&&(s="medium"),e<250&&(s="small"),["small","medium","large","xlarge"].forEach((t=>{n(this,{[`${t}`]:t===s})}))}static register(t="behold-error-message"){return customElements.get(t)||customElements.define(t,l),t}}export{l as default};
|
@@ -1 +0,0 @@
|
|
1
|
-
import{c as t,a as s,s as e,f as i,t as h}from"./index-Gpp9x18n.js";import{B as a,I as o,V as n,A as r,b as l,g as p}from"./base-DWXYuUGq.js";class d extends a{label="GalleryWall";widgetSettings;feedMetadata;posts;previewLoadingColors=null;containerEl;heightRefEl;postEls;popoverGalleryEl;appliedBreakpoint;medianPaletteHSL;constructor(){super(),this.onPropChange(this.t,["widgetSettings","feedMetadata","posts","previewLoadingColors"],["widgetSettings","feedMetadata","posts"],this.setup),o.register(),n.register(),r.register(),this.i=this.i.bind(this),this.addEventListener("post-focus-next",this.h),this.addEventListener("post-focus-previous",this.o),this.onConnect((()=>{this.style.opacity="0",this.heightRefEl=t({classes:"height-ref"}),this.containerEl=t({type:"figure",classes:"posts",contents:[this.heightRefEl]}),this.renderWidget(this.containerEl,[l,".posts{display:block;min-height:100%;width:100%}.height-ref{position:relative}.post{-webkit-font-smoothing:inherit;-moz-osx-font-smoothing:inherit;border:none;color:inherit;display:block;font:inherit;height:100px;left:0;line-height:normal;overflow:hidden;position:absolute;top:0;transform-origin:top left;transition:background .3s ease;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100px}.post--placeholder{background-color:#dedede;position:absolute}"]),this.setAttribute("tabindex","0"),this.setAttribute("aria-label","Gallery of Instagram posts. Shift + arrow keys to navigate"),this.onResize(this,this.containerEl,this.l)}))}setup(){if("transparent"!==this.widgetSettings.loadingColor){const t=this.posts.filter((t=>t.colorPalette)).map((t=>t.colorPalette));this.medianPaletteHSL=p(t,this.widgetSettings.loadingColor)}const t=this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints);this.renderBreakpoint(t),this.style.opacity="","openPopupGallery"===this.widgetSettings.onPostClick&&this.enablePopoverGallery()}t({changedProp:t,oldValue:e,newValue:i}){switch(t){case"posts":this.p();break;case"widgetSettings":this.u(e,i);break;case"feedMetadata":this.m();break;case"previewLoadingColors":this.postEls.forEach((t=>{t.previewLoadingColors=this.previewLoadingColors})),s(this,{"is-previewing-loading-colors":!!this.previewLoadingColors})}}p(){this.postEls=[],this.renderBreakpoint(this.appliedBreakpoint,!0),this.popoverGalleryEl&&(this.popoverGalleryEl.posts=this.posts)}u(t,s){"openPopupGallery"!==t?.onPostClick&&"openPopupGallery"===s?.onPostClick&&this.enablePopoverGallery(),this.renderBreakpoint(this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints)),this.postEls.forEach((t=>{t.widgetSettings=this.widgetSettings})),this.popoverGalleryEl&&(this.popoverGalleryEl.widgetSettings=this.widgetSettings)}m(){let t=`from @${this.feedMetadata.username}`;this.feedMetadata.hashtags?.length&&(t=`from hashtag${this.feedMetadata.hashtags.length>1?"s":""} ${this.feedMetadata.hashtags.join(", ")}`),this.setAttribute("aria-label",`Gallery of Instagram posts ${t}. Shift + arrow keys to navigate`),this.postEls.forEach((t=>{t.feedMetadata=this.feedMetadata})),this.popoverGalleryEl&&(this.popoverGalleryEl.feedMetadata=this.feedMetadata)}async enablePopoverGallery(){const{default:t}=await import("./PopoverGallery-tM2duxr5.js");t.register(),this.popoverGalleryEl=document.createElement("behold-popover-gallery"),Object.assign(this.popoverGalleryEl,{widgetSettings:this.widgetSettings,feedMetadata:this.feedMetadata,posts:this.posts,closeFocusEl:this,onSlideChange:t=>{this.popoverGalleryEl.closeFocusEl=this.postEls[t]}})}l(t){const s=t.contentBoxSize?.[0]?.inlineSize,e=this.widgetSettings.breakpoints,i=this.getMatchingBreakpoint(s,e);this.renderBreakpoint(i)}o(){if(!this.postEls.length)return;let t=[...this.heightRefEl.children].indexOf(this.shadow.activeElement?.parentElement);t>0?t-=1:t=this.postEls.length-1,this.postEls[t].focus()}h(){if(!this.postEls.length)return;let t=[...this.heightRefEl.children].indexOf(this.shadow.activeElement?.parentElement);t>-1&&t<this.postEls.length-1?t+=1:t=0,this.postEls[t].focus()}i(t){this.popoverGalleryEl.open(this.postEls.indexOf(t),t)}renderPosts(t){this.postEls=this.createPostEls(t),this.raf((()=>{this.heightRefEl.beholdReplaceChildren(...this.postEls)}),"renderPosts")}getMatchingBreakpoint(t,s){return Object.entries(s).map((([t,s])=>({width:t,...s}))).filter((t=>"default"!==t.width)).sort(((t,s)=>s.width.localeCompare(t.width))).reduce(((s,e)=>t<=parseInt(e.width)?e:s),{...s.default,numPosts:s.default.galleryWallLayout.length})}renderBreakpoint(t,s=!1){this.cancelRaf("setContainerHeight"),this.postEls||(s=!0);const h=this.appliedBreakpoint;this.appliedBreakpoint=t;const{gap:a,borderRadius:o,numPosts:n,galleryWallLayout:r,galleryWallNamedLayout:l}=t;switch(this.widgetSettings.alignment){case"left":this.style.justifyContent="flex-start";break;case"right":this.style.justifyContent="flex-end";break;default:this.style.justifyContent="center"}this.widgetSettings.maxWidth&&this.widgetSettings.constrainWidth&&this.containerEl.style.maxWidth!==`${this.widgetSettings.maxWidth}px`&&(this.containerEl.style.maxWidth=`${this.widgetSettings.maxWidth}px`),this.widgetSettings.constrainWidth||(this.containerEl.style.maxWidth=""),this.containerEl.setAttribute("data-hover-effect",this.widgetSettings.hoverEffect),e(this.containerEl,{"--post-border-radius":`${o}%`}),(h?.numPosts!==n||h?.galleryWallNamedLayout!==l.toString()||s)&&this.renderPosts(t);const p=this.containerEl.offsetWidth,d=a.x/1e3*p,c=a.y/1e3*p;this.postEls.forEach(((t,s)=>{const[e,i,h,a]=r?.[s]?r[s].split(",").map((t=>parseInt(t))):[0,0,10,10],o=e*(p/100)+d/2,n=i*(p/100);t.style.transform=`translate(${o}px, ${n}px`,t.style.width=h*(p/100)-d+"px",t.style.height=a*(p/100)-c+"px"})),i(),this.raf((()=>{this.setContainerHeight()}),"setContainerHeight")}createPostEls(s){const{gap:e,postAspectRatio:i}=s,h=s?.numPosts||this.posts?.length||200,a=this.posts.filter(((t,s)=>s<h)),o=a.map(((h,o)=>{let n="behold-image-post";return"VIDEO"===h.mediaType&&(n="behold-video-post"),"CAROUSEL_ALBUM"===h.mediaType&&(n="behold-album-post"),t({type:n,props:{post:h,widgetSettings:this.widgetSettings,feedMetadata:this.feedMetadata,medianPaletteHSL:this.medianPaletteHSL,onClick:this.i,hasRowGap:"0"!=`${e.y}`,index:o,aspectRatio:i||[1,1],totalPosts:a?.length||s?.numPosts||this.posts?.length||0}})}));return o.length<s.galleryWallLayout.length&&s.galleryWallLayout.filter(((t,s)=>s>=o.length)).forEach((s=>{const e=t({classes:"post post--placeholder"});o.push(e)})),o}setContainerHeight=h((()=>{this.style.height=`${this.heightRefEl.scrollHeight}px`}),10,this);static register(t="behold-gallery-wall"){return customElements.get(t)||customElements.define(t,d),t}}export{d as default};
|
package/dist/Grid-x7FHVqft.js
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
import{c as t,a as s,f as i,s as e}from"./index-Gpp9x18n.js";import{B as h,I as a,V as o,A as r,b as n,g as l}from"./base-DWXYuUGq.js";class p extends h{label="Grid";widgetSettings;feedMetadata;posts;previewLoadingColors=null;containerEl;postEls;popoverGalleryEl;appliedBreakpoint;medianPaletteHSL;constructor(){super(),a.register(),o.register(),r.register(),this.t=this.t.bind(this),this.addEventListener("post-focus-next",this.i),this.addEventListener("post-focus-previous",this.h),this.onPropChange(this.o,["widgetSettings","feedMetadata","posts","previewLoadingColors"],["widgetSettings","feedMetadata","posts"],this.setup),this.onConnect((()=>{this.containerEl=t({type:"figure",classes:"posts"}),this.renderWidget(this.containerEl,[n,".post--placeholder{background-color:#dedede;height:0;padding-bottom:calc(100%/var(--post-aspect-ratio))}"]),this.setAttribute("tabindex","0"),this.setAttribute("aria-label","Gallery of Instagram posts. Shift + arrow keys to navigate"),this.onResize(this,this,this.l)}))}setup(){if("transparent"!==this.widgetSettings.loadingColor){const t=this.posts.filter((t=>t.colorPalette)).map((t=>t.colorPalette));this.medianPaletteHSL=l(t,this.widgetSettings.loadingColor)}const t=this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints);this.renderBreakpoint(t),this.postEls&&this.postEls.forEach((t=>{t.widgetSettings=this.widgetSettings,t.feedMetadata=this.feedMetadata})),"openPopupGallery"===this.widgetSettings.onPostClick&&this.enablePopoverGallery()}o({changedProp:t,oldValue:i,newValue:e}){switch(t){case"posts":this.p({oldValue:i,newValue:e});break;case"widgetSettings":this.u(i,e);break;case"feedMetadata":this.m();break;case"previewLoadingColors":this.postEls.forEach((t=>{t.previewLoadingColors=this.previewLoadingColors})),s(this,{"is-previewing-loading-colors":!!this.previewLoadingColors})}}p({oldValue:t,newValue:s}){this.postEls=[],this.renderBreakpoint(this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints),!0),this.popoverGalleryEl&&(this.popoverGalleryEl.posts=this.posts)}u(t,s){"openPopupGallery"!==t?.onPostClick&&"openPopupGallery"===s?.onPostClick&&this.enablePopoverGallery();const i=this.getMatchingBreakpoint(this.offsetWidth,this.widgetSettings.breakpoints);this.renderBreakpoint(i),this.postEls.forEach((t=>{t.widgetSettings=this.widgetSettings})),this.popoverGalleryEl&&(this.popoverGalleryEl.widgetSettings=this.widgetSettings)}m(){let t=`from @${this.feedMetadata.username}`;this.feedMetadata.hashtags?.length&&(t=`from hashtag${this.feedMetadata.hashtags.length>1?"s":""} ${this.feedMetadata.hashtags.join(", ")}`),this.setAttribute("aria-label",`Gallery of Instagram posts ${t}. Shift + arrow keys to navigate`),this.postEls.forEach((t=>{t.feedMetadata=this.feedMetadata})),this.popoverGalleryEl&&(this.popoverGalleryEl.feedMetadata=this.feedMetadata)}async enablePopoverGallery(){if(this.popoverGalleryEl)return;const{default:t}=await import("./PopoverGallery-tM2duxr5.js");t.register(),this.popoverGalleryEl=document.createElement("behold-popover-gallery"),Object.assign(this.popoverGalleryEl,{widgetSettings:this.widgetSettings,feedMetadata:this.feedMetadata,posts:this.posts,closeFocusEl:this,onSlideChange:t=>{this.popoverGalleryEl.closeFocusEl=this.postEls[t]}})}l(t){const s=t.contentBoxSize?.[0]?.inlineSize,i=this.widgetSettings.breakpoints,e=this.getMatchingBreakpoint(s,i);this.renderBreakpoint(e)}h(){if(!this.postEls.length)return;let t=[...this.containerEl.children].indexOf(this.shadow.activeElement?.parentElement);t>0?t-=1:t=this.postEls.length-1,this.postEls[t].focus()}i(){if(!this.postEls.length)return;let t=[...this.containerEl.children].indexOf(this.shadow.activeElement?.parentElement);t>-1&&t<this.postEls.length-1?t+=1:t=0,this.postEls[t].focus()}t(t){this.popoverGalleryEl.open(this.postEls.indexOf(t),t)}renderPosts(t){this.postEls=this.createPostEls(t),this.raf((()=>{this.containerEl.beholdReplaceChildren(...this.postEls)}),"renderPosts")}getMatchingBreakpoint(t,s){return Object.entries(s).map((([t,s])=>({width:t,...s}))).filter((t=>"default"!==t.width)).sort(((t,s)=>parseInt(s.width)-parseInt(t.width))).reduce(((s,i)=>t<=parseInt(i.width)?i:s),{numPosts:this.posts.length,...s.default})}renderBreakpoint(t,s=!1){if(!this.posts||!this.containerEl)return;this.postEls?.length||(s=!0);const h=this.appliedBreakpoint,{numColumns:a,gap:o,borderRadius:r,numPosts:n,postAspectRatio:l}=t;switch(h?.numPosts>n&&(this.containerEl.beholdReplaceChildren(),i()),this.widgetSettings.alignment){case"left":this.style.justifyContent="flex-start";break;case"right":this.style.justifyContent="flex-end";break;default:this.style.justifyContent="center"}this.widgetSettings.maxWidth&&this.widgetSettings.constrainWidth&&this.containerEl.style.maxWidth!==`${this.widgetSettings.maxWidth}px`&&(this.containerEl.style.maxWidth=`${this.widgetSettings.maxWidth}px`),this.widgetSettings.constrainWidth||(this.containerEl.style.maxWidth=""),this.containerEl.style.gridTemplateColumns=`repeat(${a}, 1fr)`,this.containerEl.style.gap=`${o.y}px ${o.x}px`,this.containerEl.setAttribute("data-hover-effect",this.widgetSettings.hoverEffect);let p=(l||[1,1]).reduce(((t,s)=>t/s));e(this.containerEl,{"--post-border-radius":`${r}%`,"--post-aspect-ratio":`${p}`}),(h?.numPosts!==n||s)&&this.renderPosts(t),this.postEls.forEach(((s,i)=>{s.hasRowGap="0"!=`${t.gap.y}`})),this.appliedBreakpoint=t}createPostEls(s){const{numPosts:i,numColumns:e,gap:h,postAspectRatio:a}=s,o=this.posts.filter(((t,i)=>i<(s?.numPosts||this.posts?.length||200))),r=o.map(((s,r)=>{const n=Math.ceil((i||this.posts.length)/e);let l="behold-image-post";return"VIDEO"===s.mediaType&&(l="behold-video-post"),"CAROUSEL_ALBUM"===s.mediaType&&(l="behold-album-post"),t({type:l,props:{post:s,widgetSettings:this.widgetSettings,feedMetadata:this.feedMetadata,medianPaletteHSL:this.medianPaletteHSL,onClick:this.t,hasRowGap:"0"!=`${h.y}`,isLastRow:Math.ceil((r+1)/e)===n,index:r,aspectRatio:a||[1,1],totalPosts:o?.length||i||this.posts?.length||0}})}));for(;r.length<s.numPosts;){const s=t({classes:"post post--placeholder"});r.push(s)}return r}static register(t="behold-grid"){return customElements.get(t)||customElements.define(t,p),t}}export{p as default};
|