vistaview 0.10.11 â 0.10.13
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/README.md +39 -32
- package/dist/lib/components.d.ts +3 -2
- package/dist/lib/components.d.ts.map +1 -1
- package/dist/lib/types.d.ts +6 -6
- package/dist/lib/types.d.ts.map +1 -1
- package/dist/lib/vista-view.d.ts.map +1 -1
- package/dist/vistaview.js +26 -27
- package/dist/vistaview.umd.js +8 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ A lightweight, modern image lightbox library for the web. Zero dependencies, fra
|
|
|
6
6
|
|
|
7
7
|
## Features
|
|
8
8
|
|
|
9
|
-
- ðŠķ **Lightweight** â ~
|
|
9
|
+
- ðŠķ **Lightweight** â ~42KB ESM (~10KB gzip), minimal footprint
|
|
10
10
|
- ðą **Touch-first** â Swipe gestures for navigation and closing, pinch-to-zoom support
|
|
11
11
|
- ðĻ **Customizable** â Configurable controls, animations, and styling via CSS variables
|
|
12
12
|
- âŋ **Accessible** â Keyboard navigation, ARIA labels, reduced motion support
|
|
@@ -126,6 +126,13 @@ vistaView({
|
|
|
126
126
|
bottomLeft: ['description'],
|
|
127
127
|
},
|
|
128
128
|
|
|
129
|
+
// Extensions (optional)
|
|
130
|
+
extensions: [
|
|
131
|
+
download(),
|
|
132
|
+
imageStory({ getStory: async (index) => ({ content: '...' }) }),
|
|
133
|
+
youtubeVideo(),
|
|
134
|
+
],
|
|
135
|
+
|
|
129
136
|
// Events
|
|
130
137
|
onOpen: (vistaView) => {}, // Called when lightbox opens
|
|
131
138
|
onClose: (vistaView) => {}, // Called when lightbox closes
|
|
@@ -149,7 +156,7 @@ vistaView({
|
|
|
149
156
|
| `close` | Close the lightbox |
|
|
150
157
|
| `description` | Shows the image alt text |
|
|
151
158
|
|
|
152
|
-
**Note:** Controls
|
|
159
|
+
**Note:** Controls accept built-in control names (strings like `'zoomIn'`, `'close'`) or extension names (strings like `'download'`, `'imageStory'`). Extensions must be configured separately in the `extensions` array. See the [Extensions](#extensions) section for details.
|
|
153
160
|
|
|
154
161
|
## Extensions
|
|
155
162
|
|
|
@@ -416,10 +423,10 @@ dist/extensions/openstreetmap.js 5.28 kB â gzip: 2.06 kB
|
|
|
416
423
|
dist/extensions/mapbox.js 5.48 kB â gzip: 2.08 kB
|
|
417
424
|
dist/vista-box-CQvGrjln.js 15.00 kB â gzip: 3.93 kB
|
|
418
425
|
dist/extensions/image-story.js 33.60 kB â gzip: 10.84 kB
|
|
419
|
-
dist/vistaview.js
|
|
420
|
-
[vite:dts] Declaration files built in
|
|
426
|
+
dist/vistaview.js 41.90 kB â gzip: 10.30 kB
|
|
427
|
+
[vite:dts] Declaration files built in 820ms.
|
|
421
428
|
|
|
422
|
-
â built in 1.
|
|
429
|
+
â built in 1.06s
|
|
423
430
|
|
|
424
431
|
> vistaview@0.10.7 build:umd
|
|
425
432
|
|
|
@@ -427,106 +434,106 @@ vite v6.4.1 building for production...
|
|
|
427
434
|
â 21 modules transformed.
|
|
428
435
|
|
|
429
436
|
[vite:dts] Start generate declaration files...
|
|
430
|
-
dist/vistaview.umd.js 42.
|
|
431
|
-
[vite:dts] Declaration files built in
|
|
437
|
+
dist/vistaview.umd.js 42.59 kB â gzip: 11.58 kB
|
|
438
|
+
[vite:dts] Declaration files built in 773ms.
|
|
432
439
|
|
|
433
|
-
â built in
|
|
440
|
+
â built in 886ms
|
|
434
441
|
vite v6.4.1 building for production...
|
|
435
442
|
â 1 modules transformed.
|
|
436
443
|
|
|
437
444
|
[vite:dts] Start generate declaration files...
|
|
438
445
|
dist/extensions/download.umd.js 1.58 kB â gzip: 0.84 kB
|
|
439
|
-
[vite:dts] Declaration files built in
|
|
446
|
+
[vite:dts] Declaration files built in 778ms.
|
|
440
447
|
|
|
441
|
-
â built in
|
|
448
|
+
â built in 807ms
|
|
442
449
|
vite v6.4.1 building for production...
|
|
443
450
|
â 1 modules transformed.
|
|
444
451
|
|
|
445
452
|
[vite:dts] Start generate declaration files...
|
|
446
453
|
dist/extensions/logger.umd.js 0.76 kB â gzip: 0.37 kB
|
|
447
|
-
[vite:dts] Declaration files built in
|
|
454
|
+
[vite:dts] Declaration files built in 796ms.
|
|
448
455
|
|
|
449
|
-
â built in
|
|
456
|
+
â built in 821ms
|
|
450
457
|
vite v6.4.1 building for production...
|
|
451
458
|
â 5 modules transformed.
|
|
452
459
|
|
|
453
460
|
[vite:dts] Start generate declaration files...
|
|
454
461
|
dist/extensions/image-story.umd.js 25.28 kB â gzip: 9.81 kB
|
|
455
|
-
[vite:dts] Declaration files built in
|
|
462
|
+
[vite:dts] Declaration files built in 764ms.
|
|
456
463
|
|
|
457
|
-
â built in
|
|
464
|
+
â built in 858ms
|
|
458
465
|
vite v6.4.1 building for production...
|
|
459
466
|
â 4 modules transformed.
|
|
460
467
|
|
|
461
468
|
[vite:dts] Start generate declaration files...
|
|
462
469
|
dist/extensions/youtube-video.umd.js 14.28 kB â gzip: 4.46 kB
|
|
463
|
-
[vite:dts] Declaration files built in
|
|
470
|
+
[vite:dts] Declaration files built in 766ms.
|
|
464
471
|
|
|
465
|
-
â built in
|
|
472
|
+
â built in 828ms
|
|
466
473
|
vite v6.4.1 building for production...
|
|
467
474
|
â 4 modules transformed.
|
|
468
475
|
|
|
469
476
|
[vite:dts] Start generate declaration files...
|
|
470
477
|
dist/extensions/vimeo-video.umd.js 13.90 kB â gzip: 4.29 kB
|
|
471
|
-
[vite:dts] Declaration files built in
|
|
478
|
+
[vite:dts] Declaration files built in 767ms.
|
|
472
479
|
|
|
473
|
-
â built in
|
|
480
|
+
â built in 831ms
|
|
474
481
|
vite v6.4.1 building for production...
|
|
475
482
|
â 4 modules transformed.
|
|
476
483
|
|
|
477
484
|
[vite:dts] Start generate declaration files...
|
|
478
485
|
dist/extensions/dailymotion-video.umd.js 14.03 kB â gzip: 4.31 kB
|
|
479
|
-
[vite:dts] Declaration files built in
|
|
486
|
+
[vite:dts] Declaration files built in 769ms.
|
|
480
487
|
|
|
481
|
-
â built in
|
|
488
|
+
â built in 831ms
|
|
482
489
|
vite v6.4.1 building for production...
|
|
483
490
|
â 4 modules transformed.
|
|
484
491
|
|
|
485
492
|
[vite:dts] Start generate declaration files...
|
|
486
493
|
dist/extensions/wistia-video.umd.js 14.13 kB â gzip: 4.38 kB
|
|
487
|
-
[vite:dts] Declaration files built in
|
|
494
|
+
[vite:dts] Declaration files built in 768ms.
|
|
488
495
|
|
|
489
|
-
â built in
|
|
496
|
+
â built in 832ms
|
|
490
497
|
vite v6.4.1 building for production...
|
|
491
498
|
â 4 modules transformed.
|
|
492
499
|
|
|
493
500
|
[vite:dts] Start generate declaration files...
|
|
494
501
|
dist/extensions/vidyard-video.umd.js 13.97 kB â gzip: 4.29 kB
|
|
495
|
-
[vite:dts] Declaration files built in
|
|
502
|
+
[vite:dts] Declaration files built in 778ms.
|
|
496
503
|
|
|
497
|
-
â built in
|
|
504
|
+
â built in 839ms
|
|
498
505
|
vite v6.4.1 building for production...
|
|
499
506
|
â 4 modules transformed.
|
|
500
507
|
|
|
501
508
|
[vite:dts] Start generate declaration files...
|
|
502
509
|
dist/extensions/streamable-video.umd.js 13.94 kB â gzip: 4.29 kB
|
|
503
|
-
[vite:dts] Declaration files built in
|
|
510
|
+
[vite:dts] Declaration files built in 751ms.
|
|
504
511
|
|
|
505
|
-
â built in
|
|
512
|
+
â built in 813ms
|
|
506
513
|
vite v6.4.1 building for production...
|
|
507
514
|
â 4 modules transformed.
|
|
508
515
|
|
|
509
516
|
[vite:dts] Start generate declaration files...
|
|
510
517
|
dist/extensions/google-maps.umd.js 14.78 kB â gzip: 4.66 kB
|
|
511
|
-
[vite:dts] Declaration files built in
|
|
518
|
+
[vite:dts] Declaration files built in 771ms.
|
|
512
519
|
|
|
513
|
-
â built in
|
|
520
|
+
â built in 833ms
|
|
514
521
|
vite v6.4.1 building for production...
|
|
515
522
|
â 4 modules transformed.
|
|
516
523
|
|
|
517
524
|
[vite:dts] Start generate declaration files...
|
|
518
525
|
dist/extensions/mapbox.umd.js 16.07 kB â gzip: 4.96 kB
|
|
519
|
-
[vite:dts] Declaration files built in
|
|
526
|
+
[vite:dts] Declaration files built in 799ms.
|
|
520
527
|
|
|
521
|
-
â built in
|
|
528
|
+
â built in 866ms
|
|
522
529
|
vite v6.4.1 building for production...
|
|
523
530
|
â 4 modules transformed.
|
|
524
531
|
|
|
525
532
|
[vite:dts] Start generate declaration files...
|
|
526
533
|
dist/extensions/openstreetmap.umd.js 15.87 kB â gzip: 4.93 kB
|
|
527
|
-
[vite:dts] Declaration files built in
|
|
534
|
+
[vite:dts] Declaration files built in 782ms.
|
|
528
535
|
|
|
529
|
-
â built in
|
|
536
|
+
â built in 849ms
|
|
530
537
|
```
|
|
531
538
|
|
|
532
539
|
## License
|
package/dist/lib/components.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { VistaOpt } from './types';
|
|
2
|
-
export declare function vistaViewComponent({ controls, }: {
|
|
1
|
+
import { VistaExtension, VistaOpt } from './types';
|
|
2
|
+
export declare function vistaViewComponent({ controls, extensions, }: {
|
|
3
3
|
controls: VistaOpt['controls'];
|
|
4
|
+
extensions: Set<VistaExtension>;
|
|
4
5
|
}): DocumentFragment;
|
|
5
6
|
//# sourceMappingURL=components.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/lib/components.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"components.d.ts","sourceRoot":"","sources":["../../src/lib/components.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAoB,cAAc,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAwE1E,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,UAAU,GACX,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;IAC/B,UAAU,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CACjC,GAAG,gBAAgB,CAqDnB"}
|
package/dist/lib/types.d.ts
CHANGED
|
@@ -12,12 +12,12 @@ export type VistaOpt = {
|
|
|
12
12
|
arrowOnSmallScreens?: boolean;
|
|
13
13
|
rapidLimit?: number;
|
|
14
14
|
controls?: {
|
|
15
|
-
topLeft?: (VistaDefaultCtrl |
|
|
16
|
-
topRight?: (VistaDefaultCtrl |
|
|
17
|
-
topCenter?: (VistaDefaultCtrl |
|
|
18
|
-
bottomCenter?: (VistaDefaultCtrl |
|
|
19
|
-
bottomLeft?: (VistaDefaultCtrl |
|
|
20
|
-
bottomRight?: (VistaDefaultCtrl |
|
|
15
|
+
topLeft?: (VistaDefaultCtrl | string)[];
|
|
16
|
+
topRight?: (VistaDefaultCtrl | string)[];
|
|
17
|
+
topCenter?: (VistaDefaultCtrl | string)[];
|
|
18
|
+
bottomCenter?: (VistaDefaultCtrl | string)[];
|
|
19
|
+
bottomLeft?: (VistaDefaultCtrl | string)[];
|
|
20
|
+
bottomRight?: (VistaDefaultCtrl | string)[];
|
|
21
21
|
};
|
|
22
22
|
extensions?: VistaExtension[];
|
|
23
23
|
onImageView?: (params: VistaData, vistaView: VistaView) => void;
|
package/dist/lib/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAExE,YAAY,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,MAAM,MAAM,QAAQ,GAAG;IACrB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,aAAa,CAAC,E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
41
|
+
function A(s, t) {
|
|
42
42
|
if (typeof s == "string")
|
|
43
43
|
switch (s) {
|
|
44
44
|
case "zoomIn":
|
|
@@ -52,27 +52,33 @@ function A(s) {
|
|
|
52
52
|
case "description":
|
|
53
53
|
return '<div class="vvw-desc vvw-ui" role="status" aria-live="polite" aria-atomic="true"></div>';
|
|
54
54
|
default:
|
|
55
|
-
|
|
55
|
+
const e = t[s];
|
|
56
|
+
return e && e.control ? `<div class="vvw-ext vvw-ui" aria-label="${e.description || e.name}" data-vvw-control="${e.name}"></div>` : (console.warn(`Unknown control: ${s}. Will return empty string.`), "");
|
|
56
57
|
}
|
|
57
|
-
return
|
|
58
|
+
return "";
|
|
58
59
|
}
|
|
59
60
|
function $({
|
|
60
|
-
controls: s
|
|
61
|
+
controls: s,
|
|
62
|
+
extensions: t
|
|
61
63
|
}) {
|
|
62
|
-
const
|
|
64
|
+
const e = {};
|
|
65
|
+
t.forEach((o) => {
|
|
66
|
+
e[o.name] = o;
|
|
67
|
+
});
|
|
68
|
+
const i = (o) => o ? o.map((a) => A(a, e)).join("") : "", n = F(
|
|
63
69
|
`<div class="vvw-root" id="vvw-root">
|
|
64
70
|
<div class="vvw-container">
|
|
65
71
|
<div class="vvw-bg"></div>
|
|
66
72
|
<div class="vvw-image-container"></div>
|
|
67
73
|
<div class="vvw-top-bar">
|
|
68
|
-
<div>${
|
|
69
|
-
<div>${
|
|
70
|
-
<div>${
|
|
74
|
+
<div>${i(s == null ? void 0 : s.topLeft)}</div>
|
|
75
|
+
<div>${i(s == null ? void 0 : s.topCenter)}</div>
|
|
76
|
+
<div>${i(s == null ? void 0 : s.topRight)}</div>
|
|
71
77
|
</div>
|
|
72
78
|
<div class="vvw-bottom-bar">
|
|
73
|
-
<div>${
|
|
74
|
-
<div>${
|
|
75
|
-
<div>${
|
|
79
|
+
<div>${i(s == null ? void 0 : s.bottomLeft)}</div>
|
|
80
|
+
<div>${i(s == null ? void 0 : s.bottomCenter)}</div>
|
|
81
|
+
<div>${i(s == null ? void 0 : s.bottomRight)}</div>
|
|
76
82
|
</div>
|
|
77
83
|
<div class="vvw-prev vvw-ui"><button aria-label="Previous">${R}</button></div>
|
|
78
84
|
<div class="vvw-next vvw-ui"><button aria-label="Next">${O}</button></div>
|
|
@@ -86,12 +92,13 @@ function $({
|
|
|
86
92
|
...(s == null ? void 0 : s.bottomLeft) || [],
|
|
87
93
|
...(s == null ? void 0 : s.bottomCenter) || [],
|
|
88
94
|
...(s == null ? void 0 : s.bottomRight) || []
|
|
89
|
-
].forEach((
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
95
|
+
].forEach((o) => {
|
|
96
|
+
const a = e[o];
|
|
97
|
+
if (a && a.control) {
|
|
98
|
+
const h = n.querySelector(`[data-vvw-control="${a.name}"]`), l = a.control();
|
|
99
|
+
h && l && h.appendChild(l);
|
|
93
100
|
}
|
|
94
|
-
}),
|
|
101
|
+
}), n;
|
|
95
102
|
}
|
|
96
103
|
function k(s) {
|
|
97
104
|
}
|
|
@@ -679,16 +686,7 @@ class tt {
|
|
|
679
686
|
...I.controls,
|
|
680
687
|
...e.controls
|
|
681
688
|
}
|
|
682
|
-
}, this.options.imageSetupFunction && (this.imageSetupFunction = this.options.imageSetupFunction), this.options.closeFunction && (this.closeFunction = this.options.closeFunction), this.options.initFunction && (this.initFunction = this.options.initFunction), this.options.transitionFunction && (this.transitionFunction = this.options.transitionFunction),
|
|
683
|
-
...this.options.controls.topLeft || [],
|
|
684
|
-
...this.options.controls.topRight || [],
|
|
685
|
-
...this.options.controls.topCenter || [],
|
|
686
|
-
...this.options.controls.bottomCenter || [],
|
|
687
|
-
...this.options.controls.bottomLeft || [],
|
|
688
|
-
...this.options.controls.bottomRight || []
|
|
689
|
-
].forEach((n) => {
|
|
690
|
-
typeof n != "string" && this.state.extensions.add(n);
|
|
691
|
-
}), (i = this.options.extensions) == null || i.forEach((n) => {
|
|
689
|
+
}, this.options.imageSetupFunction && (this.imageSetupFunction = this.options.imageSetupFunction), this.options.closeFunction && (this.closeFunction = this.options.closeFunction), this.options.initFunction && (this.initFunction = this.options.initFunction), this.options.transitionFunction && (this.transitionFunction = this.options.transitionFunction), (i = this.options.extensions) == null || i.forEach((n) => {
|
|
692
690
|
this.state.extensions.add(n);
|
|
693
691
|
}), this.state.isReducedMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches, this.reset(), this.initFunction(this);
|
|
694
692
|
}
|
|
@@ -829,7 +827,8 @@ class tt {
|
|
|
829
827
|
}
|
|
830
828
|
y.somethingOpened = this, this.reset(), (t < 0 || t >= this.state.elmLength) && (t = (t % this.state.elmLength + this.state.elmLength) % this.state.elmLength), this.state.currentIndex = t, document.body.style.overflow = "hidden";
|
|
831
829
|
const e = $({
|
|
832
|
-
controls: this.options.controls
|
|
830
|
+
controls: this.options.controls,
|
|
831
|
+
extensions: this.state.extensions
|
|
833
832
|
});
|
|
834
833
|
if (document.body.append(e), this.root = document.body.querySelector("#vvw-root"), !this.root)
|
|
835
834
|
throw new Error("Failed to setup VistaView root element.");
|
package/dist/vistaview.umd.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
(function(c,y){typeof exports=="object"&&typeof module<"u"?y(exports):typeof define=="function"&&define.amd?define(["exports"],y):(c=typeof globalThis<"u"?globalThis:c||self,y(c.VistaView=c.VistaView||{}))})(this,(function(c){"use strict";var nt=Object.defineProperty;var st=(c,y,I)=>y in c?nt(c,y,{enumerable:!0,configurable:!0,writable:!0,value:I}):c[y]=I;var
|
|
1
|
+
(function(c,y){typeof exports=="object"&&typeof module<"u"?y(exports):typeof define=="function"&&define.amd?define(["exports"],y):(c=typeof globalThis<"u"?globalThis:c||self,y(c.VistaView=c.VistaView||{}))})(this,(function(c){"use strict";var nt=Object.defineProperty;var st=(c,y,I)=>y in c?nt(c,y,{enumerable:!0,configurable:!0,writable:!0,value:I}):c[y]=I;var a=(c,y,I)=>st(c,typeof y!="symbol"?y+"":y,I);const y={animationDurationBase:333,maxZoomLevel:2,preloads:1,keyboardListeners:!0,arrowOnSmallScreens:!1,rapidLimit:222,controls:{topLeft:["indexDisplay"],topRight:["zoomIn","zoomOut","close"],bottomLeft:["description"]}},I='<svg viewBox="0 0 24 24"><path d="m15 18-6-6 6-6"/></svg>',k='<svg viewBox="0 0 24 24"><path d="m9 18 6-6-6-6"/></svg>',j='<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="11" x2="11" y1="8" y2="14"/><line x1="8" x2="14" y1="11" y2="11"/></svg>',N='<svg viewBox="0 0 24 24"><circle cx="11" cy="11" r="8"/><line x1="21" x2="16.65" y1="21" y2="16.65"/><line x1="8" x2="14" y1="11" y2="11"/></svg>',B='<svg viewBox="0 0 24 24"><path d="M18 6 6 18"/><path d="m6 6 12 12"/></svg>';let P=null;function Z(){return P||(window.trustedTypes||(window.trustedTypes={createPolicy:(s,t)=>t}),P=window.trustedTypes.createPolicy("vistaView-policy",{createHTML:s=>s,createScript:()=>{throw new Error("Not implemented")},createScriptURL:()=>{throw new Error("Not implemented")}}),P)}function U(s){const e=Z().createHTML(s),i=document.createElement("template");i.innerHTML=e;const n=i.content;return i.remove(),n}function X(s,t){if(typeof s=="string")switch(s){case"zoomIn":return`<div class="vvw-ui"><button aria-label="Zoom In" class="vvw-zoom-in">${j}</button></div>`;case"zoomOut":return`<div class="vvw-ui"><button aria-label="Zoom Out" disabled class="vvw-zoom-out">${N}</button></div>`;case"close":return`<div class="vvw-ui"><button aria-label="Close" class="vvw-close">${B}</button></div>`;case"indexDisplay":return'<div class="vvw-index vvw-ui" aria-hidden="true"></div>';case"description":return'<div class="vvw-desc vvw-ui" role="status" aria-live="polite" aria-atomic="true"></div>';default:const e=t[s];return e&&e.control?`<div class="vvw-ext vvw-ui" aria-label="${e.description||e.name}" data-vvw-control="${e.name}"></div>`:(console.warn(`Unknown control: ${s}. Will return empty string.`),"")}return""}function Y({controls:s,extensions:t}){const e={};t.forEach(o=>{e[o.name]=o});const i=o=>o?o.map(r=>X(r,e)).join(""):"",n=U(`<div class="vvw-root" id="vvw-root">
|
|
2
2
|
<div class="vvw-container">
|
|
3
3
|
<div class="vvw-bg"></div>
|
|
4
4
|
<div class="vvw-image-container"></div>
|
|
5
5
|
<div class="vvw-top-bar">
|
|
6
|
-
<div>${
|
|
7
|
-
<div>${
|
|
8
|
-
<div>${
|
|
6
|
+
<div>${i(s==null?void 0:s.topLeft)}</div>
|
|
7
|
+
<div>${i(s==null?void 0:s.topCenter)}</div>
|
|
8
|
+
<div>${i(s==null?void 0:s.topRight)}</div>
|
|
9
9
|
</div>
|
|
10
10
|
<div class="vvw-bottom-bar">
|
|
11
|
-
<div>${
|
|
12
|
-
<div>${
|
|
13
|
-
<div>${
|
|
11
|
+
<div>${i(s==null?void 0:s.bottomLeft)}</div>
|
|
12
|
+
<div>${i(s==null?void 0:s.bottomCenter)}</div>
|
|
13
|
+
<div>${i(s==null?void 0:s.bottomRight)}</div>
|
|
14
14
|
</div>
|
|
15
15
|
<div class="vvw-prev vvw-ui"><button aria-label="Previous">${I}</button></div>
|
|
16
16
|
<div class="vvw-next vvw-ui"><button aria-label="Next">${k}</button></div>
|
|
17
17
|
</div>
|
|
18
|
-
</div>`);return[...(s==null?void 0:s.topLeft)||[],...(s==null?void 0:s.topCenter)||[],...(s==null?void 0:s.topRight)||[],...(s==null?void 0:s.bottomLeft)||[],...(s==null?void 0:s.bottomCenter)||[],...(s==null?void 0:s.bottomRight)||[]].forEach(i=>{if(typeof i!="string"&&i.control){const n=e.querySelector(`[data-vvw-control="${i.name}"]`),o=i.control();n&&o&&n.appendChild(o)}}),e}function z(s){}function W(s){K(s)}function K(s){let t={x:0,y:0},e={x:0,y:0},i=null;s.registerPointerListener(n=>{var o;if(!n.hasInternalExecution&&!(n.pointers.length>1)){if(n.event==="down"&&(t={x:n.pointer.x,y:n.pointer.y},e={x:n.pointer.x,y:n.pointer.y},(o=n.abortController)==null||o.abort()),n.event==="move"){e={x:n.pointer.x,y:n.pointer.y};const a=e.x-t.x,l=e.y-t.y;if(!i&&Math.abs(l)>Math.abs(a)||i==="y"){const h=l/window.innerHeight*100;s.imageContainer.style.transition="none",s.imageContainer.style.transform=`translateY(${h}vh)`,i="y"}else if(!i&&Math.abs(a)>Math.abs(l)||i==="x"&&n.state.elmLength>1){const h=a/window.innerWidth*100;s.imageContainer.style.transition="none",s.imageContainer.style.transform=`translateX(${h}vw)`,i="x"}}if(n.event==="up"||n.event==="cancel"){let a=function(l){var h;(h=s.imageContainer)==null||h.addEventListener("transitionend",function f(){var d;(d=s.imageContainer)==null||d.removeEventListener("transitionend",f),s.imageContainer.style.transition="",s.imageContainer.style.transform=""}),s.imageContainer.style.transition="transform 222ms ease",s.imageContainer.style.transform=l};if(i==="y"){const l=e.y-t.y;Math.abs(l)>144?(s.imageContainer.style.transition="transform 222ms ease",s.imageContainer.style.transform="translateY(0vh)",s.close()):a("translateY(0vh)")}if(i==="x"&&n.state.elmLength>1){const l=e.x-t.x;s.imageContainer.style.transition="",l>64?s.prev():l<-64?s.next():a("translateX(0vw)")}i=null,t={x:0,y:0},e={x:0,y:0}}}})}function R(s){const t=s.options.preloads;s.imageContainer.style.width=`${(t*2+1)*100}vw`,s.imageContainer.style.left=`-${t*100}vw`,s.imageContainer.style.display="flex"}function T(s){}function H({vistaView:s,htmlElements:{to:t},index:{from:e,to:i}},n){const{imageContainer:o,options:a}=s,{isReducedMotion:l}=s.state;if(!(!t||n.aborted||l||!(Math.abs(i-e)===1||e===0&&i===s.state.elmLength-1||e===s.state.elmLength-1&&i===0)))return{cleanup:()=>{o.style.transition="",o.style.transform=""},transitionEnded:new Promise(f=>{o.addEventListener("transitionend",()=>{f()},{once:!0}),o.addEventListener("transitioncancel",()=>{n.aborted&&f()},{once:!0});const d=Math.round(a.animationDurationBase*100)/100,u=i===e+1||e===s.state.elmLength-1&&i===0?"translateX(-100vw)":"translateX(100vw)";o.style.transition=`transform ${d}ms ease`,o.style.transform=u})}}function D(s){const t=window.innerWidth,e=window.innerHeight,i=s.naturalWidth,n=s.naturalHeight;if(!i||!n)throw console.error("Error",s),new Error("Image natural dimensions are zero");if(i<t&&n<e)return{width:i,height:n};const o=i/n,a=t/e;let l,h;return o>a?(l=t,h=t/o):(h=e,l=e*o),{width:l,height:h}}class x{static ease(t,e,i){const n=e-t,o=t+n*.2;return Math.abs(n)<i?e:o}static play(t,e,i){if(i()){requestAnimationFrame(()=>{this.play(t,e,i)});return}this.map.get(t)&&(t.element.classList.contains("vvw--load-cancelled")||requestAnimationFrame(()=>{var d,u,v,p,g,m,w,b,E,S;const n=this.map.get(t);if(!n||!t.element||t.element.classList.contains("vvw--load-cancelled"))return;const{current:o,target:a,log:l}=n;let h={};a.width!==void 0&&(h.width=this.ease(o._width,a.width,1)),a.height!==void 0&&(h.height=this.ease(o._height,a.height,1)),((d=a.transform)==null?void 0:d.x)!==void 0&&(h.transform=h.transform||{},h.transform.x=this.ease(o._transform.x,a.transform.x,1)),((u=a.transform)==null?void 0:u.y)!==void 0&&(h.transform=h.transform||{},h.transform.y=this.ease(o._transform.y,a.transform.y,1)),((v=a.transform)==null?void 0:v.scale)!==void 0&&(h.transform=h.transform||{},h.transform.scale=this.ease(o._transform.scale,a.transform.scale,.005)),((p=a.translate)==null?void 0:p.x)!==void 0&&(h.translate=h.translate||{},h.translate.x=this.ease(o._translate.x,a.translate.x,1)),((g=a.translate)==null?void 0:g.y)!==void 0&&(h.translate=h.translate||{},h.translate.y=this.ease(o._translate.y,a.translate.y,1)),h.width!==void 0&&(o.width=h.width),h.height!==void 0&&(o.height=h.height),h.translate&&(o.translate={...o.translate,...h.translate}),h.transform&&(o.transform={...o.transform,...h.transform}),(a.width===void 0||o._width===a.width)&&(a.height===void 0||o._height===a.height)&&(((m=a.transform)==null?void 0:m.x)===void 0||o._transform.x===a.transform.x)&&(((w=a.transform)==null?void 0:w.y)===void 0||o._transform.y===a.transform.y)&&(((b=a.transform)==null?void 0:b.scale)===void 0||o._transform.scale===a.transform.scale)&&(((E=a.translate)==null?void 0:E.x)===void 0||o._translate.x===a.translate.x)&&(((S=a.translate)==null?void 0:S.y)===void 0||o._translate.y===a.translate.y)?(this.map.delete(t),e()):(this.map.set(t,{current:o,target:a,log:l}),this.play(t,e,i))}))}static stop(t){const e=this.map.get(t);return this.map.delete(t),e}static start({vistaImage:t,target:e,onComplete:i,shouldWait:n}){this.stop(t),this.map.set(t,{current:t.state,target:e}),this.play(t,i,n)}}r(x,"map",new Map);function M(s){const e=window.getComputedStyle(s).objectFit||"",{width:i,height:n}=s.getBoundingClientRect(),o=s.naturalWidth,a=s.naturalHeight;if(!e)return{width:i,height:n};if(!o||!a)return{width:i,height:n};const l=o/a,h=i/n;switch(e){case"fill":return{width:i,height:n};case"none":return{width:o,height:a};case"contain":return l>h?{width:i,height:i/l}:{width:n*l,height:n};case"cover":return l<h?{width:i,height:i/l}:{width:n*l,height:n};case"scale-down":{const f={width:o,height:a},d=l>h?{width:i,height:i/l}:{width:n*l,height:n};return d.width<=f.width&&d.height<=f.height?d:f}}return{width:i,height:n}}class F{constructor(t){r(this,"state");r(this,"parsedSrcSet");r(this,"isReady",!1);r(this,"isThrowing",!1);r(this,"thumb",null);r(this,"pos");r(this,"index");r(this,"config");r(this,"origin");r(this,"initH",0);r(this,"initW",0);r(this,"fullH",0);r(this,"fullW",0);r(this,"maxW",0);r(this,"minW",0);r(this,"defaultWH",200);r(this,"isZoomedIn",!1);r(this,"isCancelled",!1);r(this,"isLoadedResolved",null);r(this,"isLoadedRejected",null);r(this,"isLoaded",new Promise((t,e)=>{this.isLoadedResolved=t,this.isLoadedRejected=e}));r(this,"replacement",null);r(this,"originalParent",null);r(this,"originalNextSibling",null);r(this,"originalStyle","");r(this,"thumbImage",null);r(this,"fittedSize",null);r(this,"maxZoomLevel");r(this,"vistaView");r(this,"transitionState",null);r(this,"transitionShouldWait",()=>!1);r(this,"initPointerCenter",{x:0,y:0});r(this,"onScale");var i;this.state=this.createState(),this.pos=t.pos,this.index=t.index,this.config=t.elm.config,this.parsedSrcSet=t.elm.parsedSrcSet,this.origin=t.elm.origin,this.maxZoomLevel=t.maxZoomLevel,this.vistaView=t.vistaView,this.onScale=t.onScale,t.transitionState&&(this.transitionState=t.transitionState),t.transitionShouldWait&&(this.transitionShouldWait=t.transitionShouldWait),this.initPointerCenter={x:window.innerWidth/2,y:window.innerHeight/2};const e=this.pos===0?(i=this.origin)==null?void 0:i.image:null;if(this.originalParent=(e==null?void 0:e.parentElement)||null,this.originalNextSibling=(e==null?void 0:e.nextSibling)||null,e&&this.originalParent){this.originalStyle=e.style.cssText,this.thumbImage=e;const n=e.cloneNode(!0);this.originalParent.insertBefore(n,e),this.replacement=n,this.thumb=document.createElement("div"),this.thumb.classList.add("vvw-img-lo");const{width:o,height:a}=this.thumbImage?M(this.thumbImage):{width:0,height:0};this.fittedSize={width:o,height:a},this.thumb.appendChild(e),e.style.width="100%",e.style.height="100%",e.style.objectFit=this.origin.objectFit}}createState(){const t=this;return{_t:this,_width:0,_height:0,_transform:{x:0,y:0,scale:1},_translate:{x:0,y:0},_lessThanMinWidth:!1,get width(){return this._width},set width(e){this._width=e,t.onWidthChange(e)},get height(){return this._height},set height(e){this._height=e,t.onHeightChange(e)},get transform(){return this._transform},set transform(e){this._transform=e,t.onTransformChange(e)},get translate(){return this._translate},set translate(e){this._translate=e,t.onTranslateChange(e)},get lessThanMinWidth(){return this._lessThanMinWidth},set lessThanMinWidth(e){this._lessThanMinWidth=e,t.onLessThanMinWidthChange(e)}}}onLessThanMinWidthChange(t){t?this.element.style.opacity="0.5":this.element.style.opacity=""}onTranslateChange(t){this.element.style.translate=`calc(-50% + ${t.x}px) calc(-50% + ${t.y}px)`}onTransformChange(t){const e=`translate3d(${t.x}px, ${t.y}px, 0px) scale3d(${t.scale}, ${t.scale}, 1)`;this.element.style.transform=e}onWidthChange(t){this.element.style.width=`${t}px`}onHeightChange(t){this.element.style.height=`${t}px`}onImageReady(){}animateZoom(t,e){}scaleMove(t,e,i){}momentumThrow(t){return()=>{}}async init(){await this.isLoaded;const t=this.element;this.transitionState&&this.transitionState.current.width&&this.transitionState.current.height?(this.state.width=this.transitionState.current.width,this.state.height=this.transitionState.current.height):t.classList.contains("vvw--loaded")||(this.state.width=this.initW,this.state.height=this.initH);const e=()=>{this.isCancelled||x.start({vistaImage:this,target:{width:this.fullW,height:this.fullH},onComplete:()=>{this.isCancelled||(this.isReady=!0,t.classList.add("vvw--ready"),this.onImageReady())},shouldWait:this.transitionShouldWait})};this.pos<-1||this.pos>1?(this.state.width=this.fullW,this.state.height=this.fullH,t.classList.add("vvw--loaded"),t.classList.add("vvw--ready"),this.isReady=!0):t.classList.contains("vvw--loaded")?t.classList.contains("vvw--ready")?(this.isReady=!0,this.onImageReady()):e():(t.classList.add("vvw--loaded"),setTimeout(()=>{this.isCancelled||e()},333))}getFullSizeDim(){const{width:t,height:e}=this.thumb.getBoundingClientRect(),i=t/e;let n=window.innerWidth,o=window.innerHeight;return i>window.innerWidth/window.innerHeight?o=n/i:n=o*i,{width:n,height:o}}setSizes(t={}){var l,h,f;const{stableSize:e=!0,initDimension:i}=t;if(!this.origin)return;const n=this.thumb;let o={width:this.defaultWH,height:this.defaultWH,top:0,left:0};if(n){o=(((l=this.origin)==null?void 0:l.anchor)||this.replacement).getBoundingClientRect();const d=n.style;d.width=o.width+"px",d.height=o.height+"px",d.top="50%",d.left="50%",d.translate="-50% -50%",d.position="fixed",d.objectFit=this.origin.objectFit,d.borderRadius=this.origin.borderRadius;const u=Math.min(Math.max(o.left,-o.width),window.innerWidth+o.width)-window.innerWidth/2+o.width/2,v=Math.min(Math.max(o.top,-o.height),window.innerHeight+o.height)-window.innerHeight/2+o.height/2;d.setProperty("--vvw-init-radius",d.borderRadius),d.setProperty("--vvw-pulse-radius",`calc(1.3 * ${d.borderRadius})`),d.setProperty("--vvw-init-x",`${u}px`),d.setProperty("--vvw-init-y",`${v}px`),i&&(d.setProperty("--vvw-current-x",`${u}px`),d.setProperty("--vvw-current-y",`${v}px`))}if(!i){const{width:d,height:u}=this.thumbImage?M(this.thumbImage):{width:0,height:0};this.fittedSize={width:d,height:u}}const a=this.element;if(this.initW=Math.min(((h=this.fittedSize)==null?void 0:h.width)??0,o.width),this.initH=Math.min(((f=this.fittedSize)==null?void 0:f.height)??0,o.height),a.style.setProperty("--vvw-init-w",this.initW+"px"),a.style.setProperty("--vvw-init-h",this.initH+"px"),a.style.setProperty("--vvw-init-radius",this.origin.borderRadius),a.style.objectFit="cover",!i){if(this.isReady&&!this.isCancelled){const{width:d,height:u}=this.getFullSizeDim();this.fullH=u,this.fullW=d,this.minW=this.fullW*.5}!this.isZoomedIn&&e&&this.normalize()}}normalize(){this.state.transform={x:0,y:0,scale:1},this.state.translate={x:0,y:0},this.state.width=this.fullW,this.state.height=this.fullH,this.isZoomedIn=!1}getFromParsedSrcSet(t){if(!this.parsedSrcSet||this.parsedSrcSet.length===0)return null;const e=t*(window.devicePixelRatio||1);let i=this.parsedSrcSet[this.parsedSrcSet.length-1];for(const n of this.parsedSrcSet)if(n.width>=e){i=n;break}return i.src}prepareClose(){x.stop(this),this.setFinalTransform()}cancelPendingLoad(){var t;this.isCancelled=!0,(t=this.element)==null||t.classList.add("vvw--load-cancelled")}setInitialCenter(t){this.initPointerCenter=t}destroy(){var t,e;this.originalParent&&this.thumbImage&&(this.thumbImage.style.cssText=this.originalStyle,this.originalNextSibling?this.originalParent.insertBefore(this.thumbImage,this.originalNextSibling):this.originalParent.appendChild(this.thumbImage)),this.originalParent=null,this.originalNextSibling=null,this.originalStyle="",this.thumbImage=null,this.replacement&&(this.replacement.remove(),this.replacement=null),(t=this.thumb)==null||t.remove(),(e=this.element)==null||e.remove(),this.thumb=null,this.origin=void 0,this.config={src:"",alt:""}}cloneStyleFrom(t,e){t!=null&&t.element&&(e&&(this.transitionState=e||null),t.element.classList.contains("vvw--loaded")&&(this.element.classList.add("vvw--loaded"),this.state.width=t.state.width,this.state.height=t.state.height),t.element.classList.contains("vvw--ready")&&this.element.classList.add("vvw--ready"))}toObject(){return structuredClone({config:{src:this.config.src,alt:this.config.alt,srcSet:this.config.srcSet},origin:this.origin?{src:this.origin.src,srcSet:this.origin.srcSet,borderRadius:this.origin.borderRadius,objectFit:this.origin.objectFit}:null,parsedSrcSet:this.parsedSrcSet,element:"src"in this.element?this.element.src:this.element.toString(),thumb:void 0,index:this.index,pos:this.pos,state:{width:this.state._width,height:this.state._height,transform:this.state._transform,translate:this.state._translate}})}setFinalTransform(t={}){const{propagateEvent:e=!0}=t;if(this.isReady){if(this.state.translate.x+=this.state.transform.x,this.state.translate.y+=this.state.transform.y,this.state.width*=this.state.transform.scale,this.state.height*=this.state.transform.scale,Math.abs(this.state.width-this.fullW)<1&&(this.state.width=this.fullW,this.state.height=this.fullH),Math.abs(this.state.translate.x)<1&&(this.state.translate.x=0),Math.abs(this.state.translate.y)<1&&(this.state.translate.y=0),this.state.translate={...this.state.translate},this.state.transform={x:0,y:0,scale:1},e){const i=this.toObject();this.vistaView.options.onContentChange&&this.vistaView.options.onContentChange(i,this.vistaView),this.vistaView.state.extensions.forEach(n=>{n.onContentChange&&n.onContentChange(i,this.vistaView)})}return{close:!0,cancel:()=>{}}}}}class O extends F{constructor(e){super(e);r(this,"element");r(this,"rect",null);r(this,"animateNormalizeTimeout",null);const i=document.createElement("img");i.alt=this.config.alt||"",i.classList.add("vvw-img-hi"),this.element=i,i.onerror=n=>{this.isLoadedRejected(n)},i.src=this.config.src,i.decode().then(()=>{this.onLoad()}).catch(n=>{this.isLoadedRejected(n)}),this.setSizes({stableSize:!1,initDimension:!0})}onWidthChange(e){super.onWidthChange(e);const i=this.getFromParsedSrcSet(e);if(i&&this.element.src!==i){const n=new Image;n.onload=()=>{n.decode().then(()=>{this.isCancelled||(this.element.src=i)})},n.src=i}}onLoad(){if(this.isCancelled)return;const e=this.element;e.width=e.naturalWidth,e.height=e.naturalHeight,this.maxW=e.naturalWidth*this.maxZoomLevel;const{width:i,height:n}=D(e);this.fullH=n,this.fullW=i,this.minW=this.fullW*.5,this.isLoadedResolved(!0)}getFullSizeDim(){return D(this.element)}normalize(){super.normalize();const e=this.element;e.style.objectFit="cover",e.style.borderRadius="0"}scaleMove(e,i,n=!1){if(!this.isReady||!this.element)return;this.rect||(this.rect=this.element.getBoundingClientRect()),i||(i=this.initPointerCenter);const o=this.rect.left+this.rect.width/2,a=this.rect.top+this.rect.height/2,l=this.initPointerCenter.x-o,h=this.initPointerCenter.y-a,f=l*(1-e),d=h*(1-e),u=i.x-this.initPointerCenter.x,v=i.y-this.initPointerCenter.y;n?x.start({vistaImage:this,target:{transform:{x:f+u,y:d+v,scale:e}},onComplete:()=>{this.setFinalTransform()},shouldWait:()=>!1}):this.state.transform={x:f+u,y:d+v,scale:e};const g=this.element.getBoundingClientRect().width*e;this.isZoomedIn=g>this.fullW,this.state.lessThanMinWidth=g<=this.minW,this.onScale({vistaImage:this,scale:g/this.fullW,isMax:g>=this.maxW,isMin:g<=this.fullW})}animateZoom(e,i){this.state.width*e<this.minW||this.scaleMove(e,i,!0)}momentumThrow(e){if(!this.isReady)return()=>{};if(!this.isThrowing)return this.setFinalTransform(),()=>{};if(Math.abs(e.x)<.1&&Math.abs(e.y)<.1){const n=this.element.getBoundingClientRect();return x.start({vistaImage:this,target:{transform:{x:n.right<window.innerWidth/2?this.state.transform.x+(window.innerWidth/2-n.right):n.left>window.innerWidth/2?this.state.transform.x-(n.left-window.innerWidth/2):this.state.transform.x,y:n.bottom<window.innerHeight/2?this.state.transform.y+(window.innerHeight/2-n.bottom):n.top>window.innerHeight/2?this.state.transform.y-(n.top-window.innerHeight/2):this.state.transform.y}},onComplete:()=>{this.isThrowing=!1,this.setFinalTransform()},shouldWait:()=>!1}),()=>{}}return requestAnimationFrame(()=>{if(!this.isThrowing)return this.momentumThrow({x:0,y:0});const i=this.element,n=this.state.transform;n.x+=e.x,n.y+=e.y;const o=i.getBoundingClientRect();n.x=n.x+e.x,n.y=n.y+e.y,o.right<window.innerWidth/2&&(n.x+=(window.innerWidth/2-o.right)*.1,e.x*=.7),o.left>window.innerWidth/2&&(n.x-=(o.left-window.innerWidth/2)*.1,e.x*=.7),o.bottom<window.innerHeight/2&&(n.y+=(window.innerHeight/2-o.bottom)*.1,e.y*=.7),o.top>window.innerHeight/2&&(n.y-=(o.top-window.innerHeight/2)*.1,e.y*=.7),this.state.transform=n,this.momentumThrow({x:e.x*.9,y:e.y*.9})}),()=>{x.stop(this),this.isThrowing=!1,this.setFinalTransform()}}animateNormalize(){this.animateNormalizeTimeout&&clearTimeout(this.animateNormalizeTimeout),this.animateNormalizeTimeout=setTimeout(()=>{x.start({vistaImage:this,target:{width:this.fullW,height:this.fullH,translate:{x:0,y:0},transform:{x:0,y:0,scale:1}},onComplete:()=>{this.setFinalTransform()},shouldWait:()=>!1})},50)}setFinalTransform(){if(!this.isReady)return;this.rect=null,super.setFinalTransform({propagateEvent:!1});const e=this.state.width<=this.minW;if(this.state.width>this.maxW)this.animateZoom(this.maxW/this.state.width);else if(!e&&this.state.width<this.fullW)this.animateNormalize();else if(this.pos===0){const i=this.toObject();this.vistaView.options.onContentChange&&this.vistaView.options.onContentChange(i,this.vistaView),this.vistaView.state.extensions.forEach(n=>{n.onContentChange&&n.onContentChange(i,this.vistaView)})}return{close:e,cancel:()=>x.stop(this)}}}class G{constructor(){r(this,"fiolast",{})}fio(t,e,i=50){const o=Date.now()-(this.fiolast[e]??0),a=()=>{this.fiolast[e]=Date.now(),t()};if(!this.fiolast[e]){a();return}o>=i&&a()}}class ${constructor(){r(this,"open",!1);r(this,"settled",!1);r(this,"closing",!1);r(this,"zoomedIn",!1);r(this,"children",{htmls:[],images:[]});r(this,"currentIndex",-1);r(this,"elmLength",0);r(this,"abortController",new AbortController);r(this,"isReducedMotion",!1);r(this,"extensions",new Set)}}function q(s){return s&&!/^0(px|%|r?em|vw|vh|vmin|vmax|cm|mm|in|pt|pc|ex|ch)?$/i.test(s.trim())&&s}function J(s){const t=s instanceof HTMLAnchorElement?s:null,e=s instanceof HTMLImageElement?s:t==null?void 0:t.querySelector("img"),i=t?getComputedStyle(t):null,n=e?getComputedStyle(e):null;let o="0px",a=n?n.objectFit:"contain";return i&&q(i.borderRadius)?o=i.borderRadius:n&&q(n.borderRadius)&&(o=n.borderRadius),{borderRadius:o,objectFit:a}}function Q(s){const t=s.split(",").map(i=>i.trim()),e=[];for(const i of t){const[n,o]=i.split(" ").map(a=>a.trim());if(n&&o&&o.endsWith("w")){const a=parseInt(o.slice(0,-1),10);isNaN(a)||e.push({src:n,width:a})}}return e}function tt(s){const t=s instanceof HTMLImageElement?s:s.querySelector("img"),e=s.dataset.vistaviewSrc||s.getAttribute("href")||s.getAttribute("src")||(t==null?void 0:t.getAttribute("src"))||"",i=s.dataset.vistaviewSrcset||s.getAttribute("srcset")||(t==null?void 0:t.getAttribute("srcset"))||"";if(!e&&!i)throw console.error("VistaView Error:",s),new Error("VistaView: Element must have href, src, or srcSet");const n=i?Q(i):void 0,o=J(s);return{config:{src:e,alt:s.dataset.vistaviewAlt||s.getAttribute("alt")||(t==null?void 0:t.getAttribute("alt"))||"",srcSet:i||void 0},parsedSrcSet:n!=null&&n.length?n:void 0,origin:{anchor:s instanceof HTMLAnchorElement?s:void 0,image:t,src:e,srcSet:i,borderRadius:o.borderRadius,objectFit:o.objectFit}}}class V{constructor({elm:t,listeners:e}){r(this,"pointers",[]);r(this,"elm");r(this,"listeners",[]);r(this,"lastPointerDownId",null);r(this,"removeLastPointer",()=>{if(this.pointers.length&&this.lastPointerDownId!==null){const t=this.pointers.findIndex(e=>e.id===this.lastPointerDownId);t!==-1&&this.pointers.splice(t,1)}});r(this,"onPointerDown",t=>{if(!this.listeners.length||t.button!==0)return;t.preventDefault(),this.lastPointerDownId=t.pointerId,window.addEventListener("contextmenu",this.removeLastPointer,{once:!0}),window.addEventListener("auxclick",this.removeLastPointer,{once:!0});let e={x:t.clientX,y:t.clientY,movementX:0,movementY:0,id:t.pointerId};this.pointers.push(e),this.listeners.forEach(i=>i({event:"down",pointer:e,pointers:this.pointers,lastPointerLen:this.pointers.length-1}))});r(this,"onPointerMove",t=>{if(!this.listeners.length)return;t.preventDefault();const e=this.pointers.find(i=>i.id===t.pointerId);e&&(e.movementX=t.movementX,e.movementY=t.movementY,e.x=t.clientX,e.y=t.clientY,this.listeners.forEach(i=>i({event:"move",pointer:e,pointers:this.pointers,lastPointerLen:this.pointers.length-1})))});r(this,"onPointerUp",t=>{if(!this.listeners.length||t.button!==0||(window.removeEventListener("contextmenu",this.removeLastPointer),window.removeEventListener("auxclick",this.removeLastPointer),t.target instanceof Node&&!this.elm.contains(t.target)&&t.target!==document.querySelector("html")&&t.target!==document))return;t.preventDefault();const e=this.pointers.findIndex(o=>o.id===t.pointerId);if(e===-1)return;const i=this.pointers[e];i.x=t.clientX,i.y=t.clientY;const n=this.pointers.length;this.pointers.splice(e,1),this.listeners.forEach(o=>o({event:"up",pointer:i,pointers:this.pointers,lastPointerLen:n}))});r(this,"onPointerCancel",t=>{if(!this.listeners.length||t.target instanceof Node&&!this.elm.contains(t.target)&&t.target!==document.querySelector("html")&&t.target!==document)return;t.preventDefault();const e=this.pointers.findIndex(o=>o.id===t.pointerId);if(e===-1)return;const i=this.pointers[e];i.x=t.clientX,i.y=t.clientY;const n=this.pointers.length;this.pointers.splice(e,1),this.listeners.forEach(o=>o({event:"cancel",pointer:i,pointers:this.pointers,lastPointerLen:n}))});this.elm=t??document,e&&(this.listeners=e),this.startListeners()}startListeners(){this.elm.addEventListener("pointerdown",this.onPointerDown),this.elm.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp),document.addEventListener("pointercancel",this.onPointerCancel)}removeListeners(){this.elm.removeEventListener("pointerdown",this.onPointerDown),this.elm.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),document.removeEventListener("pointercancel",this.onPointerCancel),this.pointers=[]}addEventListener(t){this.listeners.push(t)}removeEventListener(t){this.listeners=this.listeners.filter(e=>e!==t)}getPointerDistance(t,e){const i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)}getCentroid(){if(this.pointers.length===0)return null;const t=this.pointers.reduce((e,i)=>(e.x+=i.x,e.y+=i.y,e),{x:0,y:0});return{x:t.x/this.pointers.length,y:t.y/this.pointers.length}}}class _{constructor(t){r(this,"pointers",null);r(this,"lastDistance",0);r(this,"pinchMode",!1);r(this,"lastPinchEndTime",0);r(this,"PINCH_COOLDOWN",111);r(this,"cancelMove",()=>{});r(this,"pointerListeners",[]);r(this,"vvw");r(this,"imageContainer",null);r(this,"isPinching",()=>this.pinchMode||performance.now()-this.lastPinchEndTime<this.PINCH_COOLDOWN);r(this,"internalPointerListener",t=>{const e=this.vvw.state.children.images.find(i=>i.pos===0);if(t.event==="down"){if(this.cancelMove(),this.vvw.state.zoomedIn&&t.pointers.length===1&&!this.isPinching()){const i=this.pointers.getCentroid();e.setInitialCenter(i)}if(t.pointers.length>=2){this.pinchMode=!0;const i=this.pointers.getCentroid();this.lastDistance=this.pointers.getPointerDistance(t.pointers[0],t.pointers[1]),e.setInitialCenter(i)}}else if(t.event==="move"){if(this.vvw.state.zoomedIn&&t.pointers.length===1&&t.lastPointerLen===0&&!this.isPinching()){const i=this.pointers.getCentroid();e.scaleMove(1,i)}if(t.pointers.length>=2&&this.pinchMode){const i=this.pointers.getCentroid(),n=this.pointers.getPointerDistance(t.pointers[0],t.pointers[1]);e.scaleMove(n/this.lastDistance,i)}}else if((t.event==="up"||t.event==="cancel")&&(this.pinchMode||this.vvw.state.zoomedIn))if(this.pinchMode){this.lastPinchEndTime=performance.now(),this.pinchMode=!1;const i=e.setFinalTransform();i!=null&&i.cancel&&(this.cancelMove=i.cancel),i!=null&&i.close&&requestAnimationFrame(()=>{this.vvw.close()})}else this.vvw.state.zoomedIn&&t.pointers.length===0&&!this.isPinching()&&(e.isThrowing=!0,this.cancelMove=e.momentumThrow({x:t.pointer.movementX,y:t.pointer.movementY}));this.pointerListeners.forEach(i=>i({...t,state:this.vvw.state,hasInternalExecution:this.vvw.state.zoomedIn||this.isPinching(),abortController:this.vvw.state.abortController}))});r(this,"onKeyDown",t=>{const e=this.vvw;switch(t.key){case"ArrowLeft":t.preventDefault(),e.prev();break;case"ArrowRight":t.preventDefault(),e.next();break;case"ArrowUp":t.preventDefault(),e.zoomIn();break;case"ArrowDown":t.preventDefault(),e.zoomOut();break;case"Escape":t.preventDefault(),e.close();break}});r(this,"onScroll",t=>{t.preventDefault();const e=this.vvw,i=this.vvw.state.children.images.find(o=>o.pos===0),n=t.deltaY;i.setInitialCenter({x:t.clientX,y:t.clientY}),n<0?e.zoomIn():n>0&&e.zoomOut()});r(this,"onResizeHandler",()=>{this.vvw.state.children.images.forEach(t=>{t.setSizes()})});this.vvw=t}registerPointerListener(t){this.pointerListeners.push(t)}start(t){this.vvw.options.keyboardListeners&&window.addEventListener("keydown",this.onKeyDown),this.imageContainer=t,this.imageContainer.addEventListener("wheel",this.onScroll,{passive:!1}),window.addEventListener("resize",this.onResizeHandler),this.pointers=new V({elm:t,listeners:[this.internalPointerListener]})}stop(){this.vvw.options.keyboardListeners&&window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("resize",this.onResizeHandler),this.imageContainer.removeEventListener("wheel",this.onScroll),this.pointers.removeListeners(),this.pointerListeners=[]}}const C={somethingOpened:null};class A{constructor(t,e={}){r(this,"options");r(this,"state",new $);r(this,"imageContainer",null);r(this,"externalPointerListener",[]);r(this,"elements");r(this,"eventHandlers",null);r(this,"imageSetupFunction",z);r(this,"initFunction",W);r(this,"openFunction",R);r(this,"closeFunction",T);r(this,"transitionFunction",H);r(this,"throttle",new G);r(this,"root",null);r(this,"onClickElements",t=>{t.preventDefault();const e=t.currentTarget;e.dataset.vvwIdx&&this.open(parseInt(e.dataset.vvwIdx))});r(this,"defaultOnClickHandler",t=>t.preventDefault());r(this,"lastSwapTime",0);r(this,"isRapidSwap",!1);r(this,"isRapidSwapRelease",0);r(this,"transitionCleanup",null);r(this,"tempDeactivatedUi",[]);r(this,"tempDeactivationRequestBy",null);r(this,"isZoomedIn",!1);var i;this.elements=t,this.options={...y,...e,controls:{...y.controls,...e.controls}},this.options.imageSetupFunction&&(this.imageSetupFunction=this.options.imageSetupFunction),this.options.closeFunction&&(this.closeFunction=this.options.closeFunction),this.options.initFunction&&(this.initFunction=this.options.initFunction),this.options.transitionFunction&&(this.transitionFunction=this.options.transitionFunction),[...this.options.controls.topLeft||[],...this.options.controls.topRight||[],...this.options.controls.topCenter||[],...this.options.controls.bottomCenter||[],...this.options.controls.bottomLeft||[],...this.options.controls.bottomRight||[]].forEach(n=>{typeof n!="string"&&this.state.extensions.add(n)}),(i=this.options.extensions)==null||i.forEach(n=>{this.state.extensions.add(n)}),this.state.isReducedMotion=window.matchMedia("(prefers-reduced-motion: reduce)").matches,this.reset(),this.initFunction(this)}reset(){if(typeof this.elements=="string"){const t=this.qsOrigin(this.elements);this.state.elmLength=t.length,t.forEach((e,i)=>{const n=e;n.dataset.vvwIdx=i.toString(),n.removeEventListener("click",this.defaultOnClickHandler),n.removeEventListener("pointerup",this.onClickElements),n.addEventListener("click",this.defaultOnClickHandler),n.addEventListener("pointerup",this.onClickElements)})}else this.state.elmLength=this.elements.length}qs(t){return this.root?this.root.querySelector(t):null}qsOrigin(t){return document.querySelectorAll(t)}registerPointerListener(t){this.externalPointerListener.push(t)}getChildElements(t,e){const i=[],n=[],o=typeof this.elements=="string"?this.qsOrigin(this.elements):this.elements;for(let a=-t;a<=t;a++){const l=(e+a+o.length)%o.length,h=o[l],d={elm:h instanceof HTMLElement?tt(h):{config:h,origin:void 0,parsedSrcSet:void 0},pos:a,index:l,vistaView:this,maxZoomLevel:this.options.maxZoomLevel,transitionShouldWait:()=>this.isRapidSwap,onScale:({vistaImage:g,isMin:m,isMax:w})=>{var b,E,S,L;g.index===this.state.currentIndex&&(this.state.zoomedIn=!m,m?(b=this.qs(".vvw-zoom-out"))==null||b.setAttribute("disabled","true"):(E=this.qs(".vvw-zoom-out"))==null||E.removeAttribute("disabled"),w?(S=this.qs(".vvw-zoom-in"))==null||S.setAttribute("disabled","true"):(L=this.qs(".vvw-zoom-in"))==null||L.removeAttribute("disabled"))}};let u=null;this.state.extensions.forEach(g=>{!u&&g.onInitializeImage&&(u=g.onInitializeImage(d))});const v=u??new O(d),p=document.createElement("div");p.className="vvw-item",p.dataset.vvwPos=`${a}`,p.dataset.vvwIdx=`${l}`,v.thumb&&p.appendChild(v.thumb),p.appendChild(v.element),i.push(v),n.push(p)}return{htmls:n,images:i}}async swap(t,e){var p,g;this.reactivateUi();const i=this.options.preloads||0,n=this.state.currentIndex,{htmls:o,images:a}=this.getChildElements(i,n),l=this.imageContainer,h=this.state.children,f={htmlElements:{from:h.htmls,to:o},images:{from:h.images,to:a},index:{from:t,to:this.state.currentIndex},via:e||{next:!1,prev:!1},vistaView:this};this.imageSetupFunction(f),this.state.zoomedIn=!1,(p=this.qs(".vvw-zoom-out"))==null||p.setAttribute("disabled","true"),(g=this.qs(".vvw-zoom-in"))==null||g.removeAttribute("disabled");const u=performance.now()-this.lastSwapTime<this.options.rapidLimit;this.isRapidSwap=u;const{images:v}=this.state.children;if(this.state.children={htmls:o,images:a},this.displayCurrentInfo(),u)v.forEach(m=>{m.cancelPendingLoad(),m.destroy()});else{const m=this.state.abortController.signal,w=this.transitionFunction(f,m);w&&(this.transitionCleanup=w.cleanup,await w.transitionEnded),this.lastSwapTime=performance.now(),v.forEach(L=>{L.cancelPendingLoad()});const b=v.find(L=>L.index===n),E=b?x.stop(b):void 0,S=a.find(L=>L.index===n);S&&b&&S.cloneStyleFrom(b,E),v.forEach(L=>{L.destroy()})}l.innerHTML="",this.transitionCleanup&&this.transitionCleanup(),o.forEach(m=>{l.appendChild(m)}),a.forEach(m=>{m.init()}),u?(this.isRapidSwapRelease&&clearTimeout(this.isRapidSwapRelease),this.isRapidSwapRelease=setTimeout(()=>{this.isRapidSwap=!1},333)):this.isRapidSwap=!1,this.options.onImageView&&this.options.onImageView(f,this),this.state.extensions.forEach(m=>{m.onImageView&&m.onImageView(f,this)})}displayCurrentInfo(){const t=this.state.currentIndex;typeof this.elements=="string"&&this.qsOrigin(this.elements).forEach((a,l)=>{a.style.opacity="",l===t&&(a.style.opacity="0")});const e=this.qs(".vvw-index"),i=`${t+1}`,n=`${this.state.elmLength}`;e&&(e.textContent=`${i} / ${n}`);const o=this.qs(".vvw-desc");if(o){const a=this.state.children.images.find(h=>h.index===t),l=(a==null?void 0:a.config.alt)||"";l?(o.textContent=l,o.setAttribute("aria-label",`Image ${i} of ${n}: ${l}`),o.style.opacity=""):(o.textContent="",o.setAttribute("aria-label",`Image ${i} of ${n}`),o.style.opacity="0")}}deactivateUi(t,e){t.forEach(i=>{var n,o;i==="zoomIn"?(n=this.qs(".vvw-zoom-in"))==null||n.setAttribute("disabled","true"):i==="zoomOut"&&((o=this.qs(".vvw-zoom-out"))==null||o.setAttribute("disabled","true")),this.tempDeactivatedUi.push(i)}),this.tempDeactivationRequestBy=e||null,this.state.extensions.forEach(i=>{i.onDeactivateUi&&i.onDeactivateUi(t,this.tempDeactivationRequestBy,this)})}reactivateUi(){this.tempDeactivatedUi.forEach(t=>{var e,i;t==="zoomIn"?(e=this.qs(".vvw-zoom-in"))==null||e.removeAttribute("disabled"):t==="zoomOut"&&((i=this.qs(".vvw-zoom-out"))==null||i.removeAttribute("disabled"))}),this.state.extensions.forEach(t=>{t.onReactivateUi&&t.onReactivateUi(this.tempDeactivatedUi,this.tempDeactivationRequestBy,this)}),this.tempDeactivatedUi=[],this.tempDeactivationRequestBy=null}open(t=0){var h,f,d,u,v,p,g;if(C.somethingOpened){console.warn("Another VistaView instance is already opened. Close it first before opening a new one.");return}C.somethingOpened=this,this.reset(),(t<0||t>=this.state.elmLength)&&(t=(t%this.state.elmLength+this.state.elmLength)%this.state.elmLength),this.state.currentIndex=t,document.body.style.overflow="hidden";const e=Y({controls:this.options.controls});if(document.body.append(e),this.root=document.body.querySelector("#vvw-root"),!this.root)throw new Error("Failed to setup VistaView root element.");this.imageContainer=this.qs(".vvw-image-container"),this.options.animationDurationBase&&this.root.style.setProperty("--vvw-anim-dur",`${this.options.animationDurationBase}`),this.options.initialZIndex!==void 0&&this.root.style.setProperty("--vvw-init-z",`${this.options.initialZIndex??0}`),this.options.arrowOnSmallScreens&&this.root.classList.add("vvw-arrow-sm");const i=this.options.preloads||0,n=t,{images:o,htmls:a}=this.getChildElements(i,n),l={htmlElements:{from:null,to:a},images:{from:null,to:o},index:{from:null,to:this.state.currentIndex},via:{next:!1,prev:!1},vistaView:this};this.imageSetupFunction(l),this.state.children={htmls:a,images:o},a.forEach(m=>{this.imageContainer.appendChild(m)}),o.forEach(m=>{m.init()}),(h=this.qs(".vvw-close"))==null||h.addEventListener("click",()=>this.close()),(f=this.qs(".vvw-zoom-in"))==null||f.addEventListener("click",()=>this.zoomIn()),(d=this.qs(".vvw-zoom-out"))==null||d.addEventListener("click",()=>this.zoomOut()),(u=this.qs(".vvw-prev>button"))==null||u.addEventListener("click",()=>this.prev()),(v=this.qs(".vvw-next>button"))==null||v.addEventListener("click",()=>this.next()),this.state.elmLength<2&&((p=this.qs(".vvw-prev"))==null||p.classList.add("vvw--hidden"),(g=this.qs(".vvw-next"))==null||g.classList.add("vvw--hidden")),this.openFunction(this),this.eventHandlers=new _(this),this.externalPointerListener.forEach(m=>{this.eventHandlers.registerPointerListener(m)}),this.eventHandlers.start(this.imageContainer),requestAnimationFrame(()=>{requestAnimationFrame(()=>{var m;(m=this.root)==null||m.addEventListener("transitionend",()=>{var w;(w=this.root)==null||w.classList.add("vvw--settled")},{once:!0}),this.root.classList.add("vvw--active"),this.displayCurrentInfo(),this.options.onOpen&&this.options.onOpen(this),this.options.onImageView&&this.options.onImageView(l,this),this.state.extensions.forEach(w=>{w.onOpen&&w.onOpen(this),w.onImageView&&w.onImageView(l,this)})})})}async close(t=!0){C.somethingOpened===this&&this.root&&(this.eventHandlers.stop(),this.eventHandlers=null,this.state.children.images.forEach(e=>{e.prepareClose()}),t?await new Promise(e=>{let n=0;this.root.addEventListener("transitionend",o=>{o.target===this.root&&(n++,n===2&&typeof this.elements=="string"&&(this.state.children.images.forEach(a=>{a.destroy()}),this.qsOrigin(this.elements).forEach(a=>{a.style.opacity=""})),n===3&&e(null))}),this.root.classList.add("vvw--closing")}):typeof this.elements=="string"&&(this.state.children.images.forEach(e=>{e.destroy()}),this.qsOrigin(this.elements).forEach(e=>{e.style.opacity=""})),this.root.remove(),this.root=null,this.imageContainer=null,this.state.children={htmls:[],images:[]},this.state.currentIndex=-1,this.state.children.images.forEach(e=>{e.destroy()}),document.body.style.overflow="",C.somethingOpened=null,this.closeFunction(this),this.options.onClose&&this.options.onClose(this),this.state.extensions.forEach(e=>{e.onClose&&e.onClose(this)}))}destroy(){this.close(!1),this.externalPointerListener=[],typeof this.elements=="string"&&this.qsOrigin(this.elements).forEach(t=>{t.removeAttribute("data-vista-idx"),t.removeEventListener("click",this.defaultOnClickHandler),t.removeEventListener("pointerup",this.onClickElements)})}next(){if(C.somethingOpened!==this){console.warn("This VistaView instance is not opened.");return}const t=(this.state.currentIndex+1)%this.state.elmLength;this.view(t,{next:!0,prev:!1})}prev(){if(C.somethingOpened!==this){console.warn("This VistaView instance is not opened.");return}const t=(this.state.currentIndex-1+this.state.elmLength)%this.state.elmLength;this.view(t,{next:!1,prev:!0})}view(t,e){if(C.somethingOpened!==this){console.warn("This VistaView instance is not opened.");return}if(this.state.elmLength<2)return;(t<0||t>=this.state.elmLength)&&(t=(t%this.state.elmLength+this.state.elmLength)%this.state.elmLength);const i=this.state.currentIndex;this.state.currentIndex=t;const n=this.state.abortController;n==null||n.abort(),this.state.abortController=new AbortController,this.swap(i,e)}zoomIn(){if(C.somethingOpened!==this){console.warn("This VistaView instance is not opened.");return}this.tempDeactivatedUi.includes("zoomIn")||this.throttle.fio(()=>{const t=this.state.children.images.find(e=>e.pos===0);t==null||t.animateZoom(1.68)},"zoom",222)}zoomOut(){if(C.somethingOpened!==this){console.warn("This VistaView instance is not opened.");return}this.tempDeactivatedUi.includes("zoomOut")||this.throttle.fio(()=>{const t=this.state.children.images.find(e=>e.pos===0);t==null||t.animateZoom(.68)},"zoom",222)}getCurrentIndex(){return this.state.currentIndex}}function et(s){let t=null;if(typeof s=="string"){if(t=document.querySelectorAll(s),t.length===0)return new Error("No elements found in node list.").toString();for(let e=0;e<t.length;e++){const i=t[e],n=i.tagName.toLowerCase();if(n!=="img"&&n!=="a")return new Error(`Invalid element at index ${e}: expected <img>, <a>, got <${n}>`);if(n==="a"&&!(i.querySelector("img")!==null))return new Error(`Invalid <a> element at index ${e}: must contain <img>`)}}else{const e=s;for(let i=0;i<e.length;i++)if(!e[i].src)return new Error(`Invalid image data at index ${i}: must have 'src'`)}return s}function it({elements:s,...t}){if(!s)return console.error(s),console.error("no elements provided"),console.warn("VistaView: silently returning."),null;let e=et(s);if(e instanceof Error)return console.error(e),console.warn("VistaView: silently returning."),null;const i=new A(e,t);return{open:(n=0)=>i.open(n),reset:()=>i.reset(),close:()=>i.close(),next:()=>i.next(),prev:()=>i.prev(),zoomIn:()=>i.zoomIn(),zoomOut:()=>i.zoomOut(),destroy:()=>i.destroy(),getCurrentIndex:()=>i.getCurrentIndex(),view:n=>{i.view(n)}}}c.DefaultOptions=y,c.VistaBox=F,c.VistaHiresTransition=x,c.VistaImage=O,c.VistaImageEvent=_,c.VistaPointers=V,c.VistaState=$,c.VistaView=A,c.close=T,c.imageSetup=z,c.init=W,c.open=R,c.transition=H,c.vistaView=it,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})}));
|
|
18
|
+
</div>`);return[...(s==null?void 0:s.topLeft)||[],...(s==null?void 0:s.topCenter)||[],...(s==null?void 0:s.topRight)||[],...(s==null?void 0:s.bottomLeft)||[],...(s==null?void 0:s.bottomCenter)||[],...(s==null?void 0:s.bottomRight)||[]].forEach(o=>{const r=e[o];if(r&&r.control){const l=n.querySelector(`[data-vvw-control="${r.name}"]`),h=r.control();l&&h&&l.appendChild(h)}}),n}function z(s){}function W(s){K(s)}function K(s){let t={x:0,y:0},e={x:0,y:0},i=null;s.registerPointerListener(n=>{var o;if(!n.hasInternalExecution&&!(n.pointers.length>1)){if(n.event==="down"&&(t={x:n.pointer.x,y:n.pointer.y},e={x:n.pointer.x,y:n.pointer.y},(o=n.abortController)==null||o.abort()),n.event==="move"){e={x:n.pointer.x,y:n.pointer.y};const r=e.x-t.x,l=e.y-t.y;if(!i&&Math.abs(l)>Math.abs(r)||i==="y"){const h=l/window.innerHeight*100;s.imageContainer.style.transition="none",s.imageContainer.style.transform=`translateY(${h}vh)`,i="y"}else if(!i&&Math.abs(r)>Math.abs(l)||i==="x"&&n.state.elmLength>1){const h=r/window.innerWidth*100;s.imageContainer.style.transition="none",s.imageContainer.style.transform=`translateX(${h}vw)`,i="x"}}if(n.event==="up"||n.event==="cancel"){let r=function(l){var h;(h=s.imageContainer)==null||h.addEventListener("transitionend",function f(){var d;(d=s.imageContainer)==null||d.removeEventListener("transitionend",f),s.imageContainer.style.transition="",s.imageContainer.style.transform=""}),s.imageContainer.style.transition="transform 222ms ease",s.imageContainer.style.transform=l};if(i==="y"){const l=e.y-t.y;Math.abs(l)>144?(s.imageContainer.style.transition="transform 222ms ease",s.imageContainer.style.transform="translateY(0vh)",s.close()):r("translateY(0vh)")}if(i==="x"&&n.state.elmLength>1){const l=e.x-t.x;s.imageContainer.style.transition="",l>64?s.prev():l<-64?s.next():r("translateX(0vw)")}i=null,t={x:0,y:0},e={x:0,y:0}}}})}function R(s){const t=s.options.preloads;s.imageContainer.style.width=`${(t*2+1)*100}vw`,s.imageContainer.style.left=`-${t*100}vw`,s.imageContainer.style.display="flex"}function T(s){}function H({vistaView:s,htmlElements:{to:t},index:{from:e,to:i}},n){const{imageContainer:o,options:r}=s,{isReducedMotion:l}=s.state;if(!(!t||n.aborted||l||!(Math.abs(i-e)===1||e===0&&i===s.state.elmLength-1||e===s.state.elmLength-1&&i===0)))return{cleanup:()=>{o.style.transition="",o.style.transform=""},transitionEnded:new Promise(f=>{o.addEventListener("transitionend",()=>{f()},{once:!0}),o.addEventListener("transitioncancel",()=>{n.aborted&&f()},{once:!0});const d=Math.round(r.animationDurationBase*100)/100,u=i===e+1||e===s.state.elmLength-1&&i===0?"translateX(-100vw)":"translateX(100vw)";o.style.transition=`transform ${d}ms ease`,o.style.transform=u})}}function D(s){const t=window.innerWidth,e=window.innerHeight,i=s.naturalWidth,n=s.naturalHeight;if(!i||!n)throw console.error("Error",s),new Error("Image natural dimensions are zero");if(i<t&&n<e)return{width:i,height:n};const o=i/n,r=t/e;let l,h;return o>r?(l=t,h=t/o):(h=e,l=e*o),{width:l,height:h}}class x{static ease(t,e,i){const n=e-t,o=t+n*.2;return Math.abs(n)<i?e:o}static play(t,e,i){if(i()){requestAnimationFrame(()=>{this.play(t,e,i)});return}this.map.get(t)&&(t.element.classList.contains("vvw--load-cancelled")||requestAnimationFrame(()=>{var d,u,v,p,g,m,w,b,E,S;const n=this.map.get(t);if(!n||!t.element||t.element.classList.contains("vvw--load-cancelled"))return;const{current:o,target:r,log:l}=n;let h={};r.width!==void 0&&(h.width=this.ease(o._width,r.width,1)),r.height!==void 0&&(h.height=this.ease(o._height,r.height,1)),((d=r.transform)==null?void 0:d.x)!==void 0&&(h.transform=h.transform||{},h.transform.x=this.ease(o._transform.x,r.transform.x,1)),((u=r.transform)==null?void 0:u.y)!==void 0&&(h.transform=h.transform||{},h.transform.y=this.ease(o._transform.y,r.transform.y,1)),((v=r.transform)==null?void 0:v.scale)!==void 0&&(h.transform=h.transform||{},h.transform.scale=this.ease(o._transform.scale,r.transform.scale,.005)),((p=r.translate)==null?void 0:p.x)!==void 0&&(h.translate=h.translate||{},h.translate.x=this.ease(o._translate.x,r.translate.x,1)),((g=r.translate)==null?void 0:g.y)!==void 0&&(h.translate=h.translate||{},h.translate.y=this.ease(o._translate.y,r.translate.y,1)),h.width!==void 0&&(o.width=h.width),h.height!==void 0&&(o.height=h.height),h.translate&&(o.translate={...o.translate,...h.translate}),h.transform&&(o.transform={...o.transform,...h.transform}),(r.width===void 0||o._width===r.width)&&(r.height===void 0||o._height===r.height)&&(((m=r.transform)==null?void 0:m.x)===void 0||o._transform.x===r.transform.x)&&(((w=r.transform)==null?void 0:w.y)===void 0||o._transform.y===r.transform.y)&&(((b=r.transform)==null?void 0:b.scale)===void 0||o._transform.scale===r.transform.scale)&&(((E=r.translate)==null?void 0:E.x)===void 0||o._translate.x===r.translate.x)&&(((S=r.translate)==null?void 0:S.y)===void 0||o._translate.y===r.translate.y)?(this.map.delete(t),e()):(this.map.set(t,{current:o,target:r,log:l}),this.play(t,e,i))}))}static stop(t){const e=this.map.get(t);return this.map.delete(t),e}static start({vistaImage:t,target:e,onComplete:i,shouldWait:n}){this.stop(t),this.map.set(t,{current:t.state,target:e}),this.play(t,i,n)}}a(x,"map",new Map);function M(s){const e=window.getComputedStyle(s).objectFit||"",{width:i,height:n}=s.getBoundingClientRect(),o=s.naturalWidth,r=s.naturalHeight;if(!e)return{width:i,height:n};if(!o||!r)return{width:i,height:n};const l=o/r,h=i/n;switch(e){case"fill":return{width:i,height:n};case"none":return{width:o,height:r};case"contain":return l>h?{width:i,height:i/l}:{width:n*l,height:n};case"cover":return l<h?{width:i,height:i/l}:{width:n*l,height:n};case"scale-down":{const f={width:o,height:r},d=l>h?{width:i,height:i/l}:{width:n*l,height:n};return d.width<=f.width&&d.height<=f.height?d:f}}return{width:i,height:n}}class F{constructor(t){a(this,"state");a(this,"parsedSrcSet");a(this,"isReady",!1);a(this,"isThrowing",!1);a(this,"thumb",null);a(this,"pos");a(this,"index");a(this,"config");a(this,"origin");a(this,"initH",0);a(this,"initW",0);a(this,"fullH",0);a(this,"fullW",0);a(this,"maxW",0);a(this,"minW",0);a(this,"defaultWH",200);a(this,"isZoomedIn",!1);a(this,"isCancelled",!1);a(this,"isLoadedResolved",null);a(this,"isLoadedRejected",null);a(this,"isLoaded",new Promise((t,e)=>{this.isLoadedResolved=t,this.isLoadedRejected=e}));a(this,"replacement",null);a(this,"originalParent",null);a(this,"originalNextSibling",null);a(this,"originalStyle","");a(this,"thumbImage",null);a(this,"fittedSize",null);a(this,"maxZoomLevel");a(this,"vistaView");a(this,"transitionState",null);a(this,"transitionShouldWait",()=>!1);a(this,"initPointerCenter",{x:0,y:0});a(this,"onScale");var i;this.state=this.createState(),this.pos=t.pos,this.index=t.index,this.config=t.elm.config,this.parsedSrcSet=t.elm.parsedSrcSet,this.origin=t.elm.origin,this.maxZoomLevel=t.maxZoomLevel,this.vistaView=t.vistaView,this.onScale=t.onScale,t.transitionState&&(this.transitionState=t.transitionState),t.transitionShouldWait&&(this.transitionShouldWait=t.transitionShouldWait),this.initPointerCenter={x:window.innerWidth/2,y:window.innerHeight/2};const e=this.pos===0?(i=this.origin)==null?void 0:i.image:null;if(this.originalParent=(e==null?void 0:e.parentElement)||null,this.originalNextSibling=(e==null?void 0:e.nextSibling)||null,e&&this.originalParent){this.originalStyle=e.style.cssText,this.thumbImage=e;const n=e.cloneNode(!0);this.originalParent.insertBefore(n,e),this.replacement=n,this.thumb=document.createElement("div"),this.thumb.classList.add("vvw-img-lo");const{width:o,height:r}=this.thumbImage?M(this.thumbImage):{width:0,height:0};this.fittedSize={width:o,height:r},this.thumb.appendChild(e),e.style.width="100%",e.style.height="100%",e.style.objectFit=this.origin.objectFit}}createState(){const t=this;return{_t:this,_width:0,_height:0,_transform:{x:0,y:0,scale:1},_translate:{x:0,y:0},_lessThanMinWidth:!1,get width(){return this._width},set width(e){this._width=e,t.onWidthChange(e)},get height(){return this._height},set height(e){this._height=e,t.onHeightChange(e)},get transform(){return this._transform},set transform(e){this._transform=e,t.onTransformChange(e)},get translate(){return this._translate},set translate(e){this._translate=e,t.onTranslateChange(e)},get lessThanMinWidth(){return this._lessThanMinWidth},set lessThanMinWidth(e){this._lessThanMinWidth=e,t.onLessThanMinWidthChange(e)}}}onLessThanMinWidthChange(t){t?this.element.style.opacity="0.5":this.element.style.opacity=""}onTranslateChange(t){this.element.style.translate=`calc(-50% + ${t.x}px) calc(-50% + ${t.y}px)`}onTransformChange(t){const e=`translate3d(${t.x}px, ${t.y}px, 0px) scale3d(${t.scale}, ${t.scale}, 1)`;this.element.style.transform=e}onWidthChange(t){this.element.style.width=`${t}px`}onHeightChange(t){this.element.style.height=`${t}px`}onImageReady(){}animateZoom(t,e){}scaleMove(t,e,i){}momentumThrow(t){return()=>{}}async init(){await this.isLoaded;const t=this.element;this.transitionState&&this.transitionState.current.width&&this.transitionState.current.height?(this.state.width=this.transitionState.current.width,this.state.height=this.transitionState.current.height):t.classList.contains("vvw--loaded")||(this.state.width=this.initW,this.state.height=this.initH);const e=()=>{this.isCancelled||x.start({vistaImage:this,target:{width:this.fullW,height:this.fullH},onComplete:()=>{this.isCancelled||(this.isReady=!0,t.classList.add("vvw--ready"),this.onImageReady())},shouldWait:this.transitionShouldWait})};this.pos<-1||this.pos>1?(this.state.width=this.fullW,this.state.height=this.fullH,t.classList.add("vvw--loaded"),t.classList.add("vvw--ready"),this.isReady=!0):t.classList.contains("vvw--loaded")?t.classList.contains("vvw--ready")?(this.isReady=!0,this.onImageReady()):e():(t.classList.add("vvw--loaded"),setTimeout(()=>{this.isCancelled||e()},333))}getFullSizeDim(){const{width:t,height:e}=this.thumb.getBoundingClientRect(),i=t/e;let n=window.innerWidth,o=window.innerHeight;return i>window.innerWidth/window.innerHeight?o=n/i:n=o*i,{width:n,height:o}}setSizes(t={}){var l,h,f;const{stableSize:e=!0,initDimension:i}=t;if(!this.origin)return;const n=this.thumb;let o={width:this.defaultWH,height:this.defaultWH,top:0,left:0};if(n){o=(((l=this.origin)==null?void 0:l.anchor)||this.replacement).getBoundingClientRect();const d=n.style;d.width=o.width+"px",d.height=o.height+"px",d.top="50%",d.left="50%",d.translate="-50% -50%",d.position="fixed",d.objectFit=this.origin.objectFit,d.borderRadius=this.origin.borderRadius;const u=Math.min(Math.max(o.left,-o.width),window.innerWidth+o.width)-window.innerWidth/2+o.width/2,v=Math.min(Math.max(o.top,-o.height),window.innerHeight+o.height)-window.innerHeight/2+o.height/2;d.setProperty("--vvw-init-radius",d.borderRadius),d.setProperty("--vvw-pulse-radius",`calc(1.3 * ${d.borderRadius})`),d.setProperty("--vvw-init-x",`${u}px`),d.setProperty("--vvw-init-y",`${v}px`),i&&(d.setProperty("--vvw-current-x",`${u}px`),d.setProperty("--vvw-current-y",`${v}px`))}if(!i){const{width:d,height:u}=this.thumbImage?M(this.thumbImage):{width:0,height:0};this.fittedSize={width:d,height:u}}const r=this.element;if(this.initW=Math.min(((h=this.fittedSize)==null?void 0:h.width)??0,o.width),this.initH=Math.min(((f=this.fittedSize)==null?void 0:f.height)??0,o.height),r.style.setProperty("--vvw-init-w",this.initW+"px"),r.style.setProperty("--vvw-init-h",this.initH+"px"),r.style.setProperty("--vvw-init-radius",this.origin.borderRadius),r.style.objectFit="cover",!i){if(this.isReady&&!this.isCancelled){const{width:d,height:u}=this.getFullSizeDim();this.fullH=u,this.fullW=d,this.minW=this.fullW*.5}!this.isZoomedIn&&e&&this.normalize()}}normalize(){this.state.transform={x:0,y:0,scale:1},this.state.translate={x:0,y:0},this.state.width=this.fullW,this.state.height=this.fullH,this.isZoomedIn=!1}getFromParsedSrcSet(t){if(!this.parsedSrcSet||this.parsedSrcSet.length===0)return null;const e=t*(window.devicePixelRatio||1);let i=this.parsedSrcSet[this.parsedSrcSet.length-1];for(const n of this.parsedSrcSet)if(n.width>=e){i=n;break}return i.src}prepareClose(){x.stop(this),this.setFinalTransform()}cancelPendingLoad(){var t;this.isCancelled=!0,(t=this.element)==null||t.classList.add("vvw--load-cancelled")}setInitialCenter(t){this.initPointerCenter=t}destroy(){var t,e;this.originalParent&&this.thumbImage&&(this.thumbImage.style.cssText=this.originalStyle,this.originalNextSibling?this.originalParent.insertBefore(this.thumbImage,this.originalNextSibling):this.originalParent.appendChild(this.thumbImage)),this.originalParent=null,this.originalNextSibling=null,this.originalStyle="",this.thumbImage=null,this.replacement&&(this.replacement.remove(),this.replacement=null),(t=this.thumb)==null||t.remove(),(e=this.element)==null||e.remove(),this.thumb=null,this.origin=void 0,this.config={src:"",alt:""}}cloneStyleFrom(t,e){t!=null&&t.element&&(e&&(this.transitionState=e||null),t.element.classList.contains("vvw--loaded")&&(this.element.classList.add("vvw--loaded"),this.state.width=t.state.width,this.state.height=t.state.height),t.element.classList.contains("vvw--ready")&&this.element.classList.add("vvw--ready"))}toObject(){return structuredClone({config:{src:this.config.src,alt:this.config.alt,srcSet:this.config.srcSet},origin:this.origin?{src:this.origin.src,srcSet:this.origin.srcSet,borderRadius:this.origin.borderRadius,objectFit:this.origin.objectFit}:null,parsedSrcSet:this.parsedSrcSet,element:"src"in this.element?this.element.src:this.element.toString(),thumb:void 0,index:this.index,pos:this.pos,state:{width:this.state._width,height:this.state._height,transform:this.state._transform,translate:this.state._translate}})}setFinalTransform(t={}){const{propagateEvent:e=!0}=t;if(this.isReady){if(this.state.translate.x+=this.state.transform.x,this.state.translate.y+=this.state.transform.y,this.state.width*=this.state.transform.scale,this.state.height*=this.state.transform.scale,Math.abs(this.state.width-this.fullW)<1&&(this.state.width=this.fullW,this.state.height=this.fullH),Math.abs(this.state.translate.x)<1&&(this.state.translate.x=0),Math.abs(this.state.translate.y)<1&&(this.state.translate.y=0),this.state.translate={...this.state.translate},this.state.transform={x:0,y:0,scale:1},e){const i=this.toObject();this.vistaView.options.onContentChange&&this.vistaView.options.onContentChange(i,this.vistaView),this.vistaView.state.extensions.forEach(n=>{n.onContentChange&&n.onContentChange(i,this.vistaView)})}return{close:!0,cancel:()=>{}}}}}class O extends F{constructor(e){super(e);a(this,"element");a(this,"rect",null);a(this,"animateNormalizeTimeout",null);const i=document.createElement("img");i.alt=this.config.alt||"",i.classList.add("vvw-img-hi"),this.element=i,i.onerror=n=>{this.isLoadedRejected(n)},i.src=this.config.src,i.decode().then(()=>{this.onLoad()}).catch(n=>{this.isLoadedRejected(n)}),this.setSizes({stableSize:!1,initDimension:!0})}onWidthChange(e){super.onWidthChange(e);const i=this.getFromParsedSrcSet(e);if(i&&this.element.src!==i){const n=new Image;n.onload=()=>{n.decode().then(()=>{this.isCancelled||(this.element.src=i)})},n.src=i}}onLoad(){if(this.isCancelled)return;const e=this.element;e.width=e.naturalWidth,e.height=e.naturalHeight,this.maxW=e.naturalWidth*this.maxZoomLevel;const{width:i,height:n}=D(e);this.fullH=n,this.fullW=i,this.minW=this.fullW*.5,this.isLoadedResolved(!0)}getFullSizeDim(){return D(this.element)}normalize(){super.normalize();const e=this.element;e.style.objectFit="cover",e.style.borderRadius="0"}scaleMove(e,i,n=!1){if(!this.isReady||!this.element)return;this.rect||(this.rect=this.element.getBoundingClientRect()),i||(i=this.initPointerCenter);const o=this.rect.left+this.rect.width/2,r=this.rect.top+this.rect.height/2,l=this.initPointerCenter.x-o,h=this.initPointerCenter.y-r,f=l*(1-e),d=h*(1-e),u=i.x-this.initPointerCenter.x,v=i.y-this.initPointerCenter.y;n?x.start({vistaImage:this,target:{transform:{x:f+u,y:d+v,scale:e}},onComplete:()=>{this.setFinalTransform()},shouldWait:()=>!1}):this.state.transform={x:f+u,y:d+v,scale:e};const g=this.element.getBoundingClientRect().width*e;this.isZoomedIn=g>this.fullW,this.state.lessThanMinWidth=g<=this.minW,this.onScale({vistaImage:this,scale:g/this.fullW,isMax:g>=this.maxW,isMin:g<=this.fullW})}animateZoom(e,i){this.state.width*e<this.minW||this.scaleMove(e,i,!0)}momentumThrow(e){if(!this.isReady)return()=>{};if(!this.isThrowing)return this.setFinalTransform(),()=>{};if(Math.abs(e.x)<.1&&Math.abs(e.y)<.1){const n=this.element.getBoundingClientRect();return x.start({vistaImage:this,target:{transform:{x:n.right<window.innerWidth/2?this.state.transform.x+(window.innerWidth/2-n.right):n.left>window.innerWidth/2?this.state.transform.x-(n.left-window.innerWidth/2):this.state.transform.x,y:n.bottom<window.innerHeight/2?this.state.transform.y+(window.innerHeight/2-n.bottom):n.top>window.innerHeight/2?this.state.transform.y-(n.top-window.innerHeight/2):this.state.transform.y}},onComplete:()=>{this.isThrowing=!1,this.setFinalTransform()},shouldWait:()=>!1}),()=>{}}return requestAnimationFrame(()=>{if(!this.isThrowing)return this.momentumThrow({x:0,y:0});const i=this.element,n=this.state.transform;n.x+=e.x,n.y+=e.y;const o=i.getBoundingClientRect();n.x=n.x+e.x,n.y=n.y+e.y,o.right<window.innerWidth/2&&(n.x+=(window.innerWidth/2-o.right)*.1,e.x*=.7),o.left>window.innerWidth/2&&(n.x-=(o.left-window.innerWidth/2)*.1,e.x*=.7),o.bottom<window.innerHeight/2&&(n.y+=(window.innerHeight/2-o.bottom)*.1,e.y*=.7),o.top>window.innerHeight/2&&(n.y-=(o.top-window.innerHeight/2)*.1,e.y*=.7),this.state.transform=n,this.momentumThrow({x:e.x*.9,y:e.y*.9})}),()=>{x.stop(this),this.isThrowing=!1,this.setFinalTransform()}}animateNormalize(){this.animateNormalizeTimeout&&clearTimeout(this.animateNormalizeTimeout),this.animateNormalizeTimeout=setTimeout(()=>{x.start({vistaImage:this,target:{width:this.fullW,height:this.fullH,translate:{x:0,y:0},transform:{x:0,y:0,scale:1}},onComplete:()=>{this.setFinalTransform()},shouldWait:()=>!1})},50)}setFinalTransform(){if(!this.isReady)return;this.rect=null,super.setFinalTransform({propagateEvent:!1});const e=this.state.width<=this.minW;if(this.state.width>this.maxW)this.animateZoom(this.maxW/this.state.width);else if(!e&&this.state.width<this.fullW)this.animateNormalize();else if(this.pos===0){const i=this.toObject();this.vistaView.options.onContentChange&&this.vistaView.options.onContentChange(i,this.vistaView),this.vistaView.state.extensions.forEach(n=>{n.onContentChange&&n.onContentChange(i,this.vistaView)})}return{close:e,cancel:()=>x.stop(this)}}}class G{constructor(){a(this,"fiolast",{})}fio(t,e,i=50){const o=Date.now()-(this.fiolast[e]??0),r=()=>{this.fiolast[e]=Date.now(),t()};if(!this.fiolast[e]){r();return}o>=i&&r()}}class ${constructor(){a(this,"open",!1);a(this,"settled",!1);a(this,"closing",!1);a(this,"zoomedIn",!1);a(this,"children",{htmls:[],images:[]});a(this,"currentIndex",-1);a(this,"elmLength",0);a(this,"abortController",new AbortController);a(this,"isReducedMotion",!1);a(this,"extensions",new Set)}}function q(s){return s&&!/^0(px|%|r?em|vw|vh|vmin|vmax|cm|mm|in|pt|pc|ex|ch)?$/i.test(s.trim())&&s}function J(s){const t=s instanceof HTMLAnchorElement?s:null,e=s instanceof HTMLImageElement?s:t==null?void 0:t.querySelector("img"),i=t?getComputedStyle(t):null,n=e?getComputedStyle(e):null;let o="0px",r=n?n.objectFit:"contain";return i&&q(i.borderRadius)?o=i.borderRadius:n&&q(n.borderRadius)&&(o=n.borderRadius),{borderRadius:o,objectFit:r}}function Q(s){const t=s.split(",").map(i=>i.trim()),e=[];for(const i of t){const[n,o]=i.split(" ").map(r=>r.trim());if(n&&o&&o.endsWith("w")){const r=parseInt(o.slice(0,-1),10);isNaN(r)||e.push({src:n,width:r})}}return e}function tt(s){const t=s instanceof HTMLImageElement?s:s.querySelector("img"),e=s.dataset.vistaviewSrc||s.getAttribute("href")||s.getAttribute("src")||(t==null?void 0:t.getAttribute("src"))||"",i=s.dataset.vistaviewSrcset||s.getAttribute("srcset")||(t==null?void 0:t.getAttribute("srcset"))||"";if(!e&&!i)throw console.error("VistaView Error:",s),new Error("VistaView: Element must have href, src, or srcSet");const n=i?Q(i):void 0,o=J(s);return{config:{src:e,alt:s.dataset.vistaviewAlt||s.getAttribute("alt")||(t==null?void 0:t.getAttribute("alt"))||"",srcSet:i||void 0},parsedSrcSet:n!=null&&n.length?n:void 0,origin:{anchor:s instanceof HTMLAnchorElement?s:void 0,image:t,src:e,srcSet:i,borderRadius:o.borderRadius,objectFit:o.objectFit}}}class V{constructor({elm:t,listeners:e}){a(this,"pointers",[]);a(this,"elm");a(this,"listeners",[]);a(this,"lastPointerDownId",null);a(this,"removeLastPointer",()=>{if(this.pointers.length&&this.lastPointerDownId!==null){const t=this.pointers.findIndex(e=>e.id===this.lastPointerDownId);t!==-1&&this.pointers.splice(t,1)}});a(this,"onPointerDown",t=>{if(!this.listeners.length||t.button!==0)return;t.preventDefault(),this.lastPointerDownId=t.pointerId,window.addEventListener("contextmenu",this.removeLastPointer,{once:!0}),window.addEventListener("auxclick",this.removeLastPointer,{once:!0});let e={x:t.clientX,y:t.clientY,movementX:0,movementY:0,id:t.pointerId};this.pointers.push(e),this.listeners.forEach(i=>i({event:"down",pointer:e,pointers:this.pointers,lastPointerLen:this.pointers.length-1}))});a(this,"onPointerMove",t=>{if(!this.listeners.length)return;t.preventDefault();const e=this.pointers.find(i=>i.id===t.pointerId);e&&(e.movementX=t.movementX,e.movementY=t.movementY,e.x=t.clientX,e.y=t.clientY,this.listeners.forEach(i=>i({event:"move",pointer:e,pointers:this.pointers,lastPointerLen:this.pointers.length-1})))});a(this,"onPointerUp",t=>{if(!this.listeners.length||t.button!==0||(window.removeEventListener("contextmenu",this.removeLastPointer),window.removeEventListener("auxclick",this.removeLastPointer),t.target instanceof Node&&!this.elm.contains(t.target)&&t.target!==document.querySelector("html")&&t.target!==document))return;t.preventDefault();const e=this.pointers.findIndex(o=>o.id===t.pointerId);if(e===-1)return;const i=this.pointers[e];i.x=t.clientX,i.y=t.clientY;const n=this.pointers.length;this.pointers.splice(e,1),this.listeners.forEach(o=>o({event:"up",pointer:i,pointers:this.pointers,lastPointerLen:n}))});a(this,"onPointerCancel",t=>{if(!this.listeners.length||t.target instanceof Node&&!this.elm.contains(t.target)&&t.target!==document.querySelector("html")&&t.target!==document)return;t.preventDefault();const e=this.pointers.findIndex(o=>o.id===t.pointerId);if(e===-1)return;const i=this.pointers[e];i.x=t.clientX,i.y=t.clientY;const n=this.pointers.length;this.pointers.splice(e,1),this.listeners.forEach(o=>o({event:"cancel",pointer:i,pointers:this.pointers,lastPointerLen:n}))});this.elm=t??document,e&&(this.listeners=e),this.startListeners()}startListeners(){this.elm.addEventListener("pointerdown",this.onPointerDown),this.elm.addEventListener("pointermove",this.onPointerMove),document.addEventListener("pointerup",this.onPointerUp),document.addEventListener("pointercancel",this.onPointerCancel)}removeListeners(){this.elm.removeEventListener("pointerdown",this.onPointerDown),this.elm.removeEventListener("pointermove",this.onPointerMove),document.removeEventListener("pointerup",this.onPointerUp),document.removeEventListener("pointercancel",this.onPointerCancel),this.pointers=[]}addEventListener(t){this.listeners.push(t)}removeEventListener(t){this.listeners=this.listeners.filter(e=>e!==t)}getPointerDistance(t,e){const i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)}getCentroid(){if(this.pointers.length===0)return null;const t=this.pointers.reduce((e,i)=>(e.x+=i.x,e.y+=i.y,e),{x:0,y:0});return{x:t.x/this.pointers.length,y:t.y/this.pointers.length}}}class _{constructor(t){a(this,"pointers",null);a(this,"lastDistance",0);a(this,"pinchMode",!1);a(this,"lastPinchEndTime",0);a(this,"PINCH_COOLDOWN",111);a(this,"cancelMove",()=>{});a(this,"pointerListeners",[]);a(this,"vvw");a(this,"imageContainer",null);a(this,"isPinching",()=>this.pinchMode||performance.now()-this.lastPinchEndTime<this.PINCH_COOLDOWN);a(this,"internalPointerListener",t=>{const e=this.vvw.state.children.images.find(i=>i.pos===0);if(t.event==="down"){if(this.cancelMove(),this.vvw.state.zoomedIn&&t.pointers.length===1&&!this.isPinching()){const i=this.pointers.getCentroid();e.setInitialCenter(i)}if(t.pointers.length>=2){this.pinchMode=!0;const i=this.pointers.getCentroid();this.lastDistance=this.pointers.getPointerDistance(t.pointers[0],t.pointers[1]),e.setInitialCenter(i)}}else if(t.event==="move"){if(this.vvw.state.zoomedIn&&t.pointers.length===1&&t.lastPointerLen===0&&!this.isPinching()){const i=this.pointers.getCentroid();e.scaleMove(1,i)}if(t.pointers.length>=2&&this.pinchMode){const i=this.pointers.getCentroid(),n=this.pointers.getPointerDistance(t.pointers[0],t.pointers[1]);e.scaleMove(n/this.lastDistance,i)}}else if((t.event==="up"||t.event==="cancel")&&(this.pinchMode||this.vvw.state.zoomedIn))if(this.pinchMode){this.lastPinchEndTime=performance.now(),this.pinchMode=!1;const i=e.setFinalTransform();i!=null&&i.cancel&&(this.cancelMove=i.cancel),i!=null&&i.close&&requestAnimationFrame(()=>{this.vvw.close()})}else this.vvw.state.zoomedIn&&t.pointers.length===0&&!this.isPinching()&&(e.isThrowing=!0,this.cancelMove=e.momentumThrow({x:t.pointer.movementX,y:t.pointer.movementY}));this.pointerListeners.forEach(i=>i({...t,state:this.vvw.state,hasInternalExecution:this.vvw.state.zoomedIn||this.isPinching(),abortController:this.vvw.state.abortController}))});a(this,"onKeyDown",t=>{const e=this.vvw;switch(t.key){case"ArrowLeft":t.preventDefault(),e.prev();break;case"ArrowRight":t.preventDefault(),e.next();break;case"ArrowUp":t.preventDefault(),e.zoomIn();break;case"ArrowDown":t.preventDefault(),e.zoomOut();break;case"Escape":t.preventDefault(),e.close();break}});a(this,"onScroll",t=>{t.preventDefault();const e=this.vvw,i=this.vvw.state.children.images.find(o=>o.pos===0),n=t.deltaY;i.setInitialCenter({x:t.clientX,y:t.clientY}),n<0?e.zoomIn():n>0&&e.zoomOut()});a(this,"onResizeHandler",()=>{this.vvw.state.children.images.forEach(t=>{t.setSizes()})});this.vvw=t}registerPointerListener(t){this.pointerListeners.push(t)}start(t){this.vvw.options.keyboardListeners&&window.addEventListener("keydown",this.onKeyDown),this.imageContainer=t,this.imageContainer.addEventListener("wheel",this.onScroll,{passive:!1}),window.addEventListener("resize",this.onResizeHandler),this.pointers=new V({elm:t,listeners:[this.internalPointerListener]})}stop(){this.vvw.options.keyboardListeners&&window.removeEventListener("keydown",this.onKeyDown),window.removeEventListener("resize",this.onResizeHandler),this.imageContainer.removeEventListener("wheel",this.onScroll),this.pointers.removeListeners(),this.pointerListeners=[]}}const C={somethingOpened:null};class A{constructor(t,e={}){a(this,"options");a(this,"state",new $);a(this,"imageContainer",null);a(this,"externalPointerListener",[]);a(this,"elements");a(this,"eventHandlers",null);a(this,"imageSetupFunction",z);a(this,"initFunction",W);a(this,"openFunction",R);a(this,"closeFunction",T);a(this,"transitionFunction",H);a(this,"throttle",new G);a(this,"root",null);a(this,"onClickElements",t=>{t.preventDefault();const e=t.currentTarget;e.dataset.vvwIdx&&this.open(parseInt(e.dataset.vvwIdx))});a(this,"defaultOnClickHandler",t=>t.preventDefault());a(this,"lastSwapTime",0);a(this,"isRapidSwap",!1);a(this,"isRapidSwapRelease",0);a(this,"transitionCleanup",null);a(this,"tempDeactivatedUi",[]);a(this,"tempDeactivationRequestBy",null);a(this,"isZoomedIn",!1);var i;this.elements=t,this.options={...y,...e,controls:{...y.controls,...e.controls}},this.options.imageSetupFunction&&(this.imageSetupFunction=this.options.imageSetupFunction),this.options.closeFunction&&(this.closeFunction=this.options.closeFunction),this.options.initFunction&&(this.initFunction=this.options.initFunction),this.options.transitionFunction&&(this.transitionFunction=this.options.transitionFunction),(i=this.options.extensions)==null||i.forEach(n=>{this.state.extensions.add(n)}),this.state.isReducedMotion=window.matchMedia("(prefers-reduced-motion: reduce)").matches,this.reset(),this.initFunction(this)}reset(){if(typeof this.elements=="string"){const t=this.qsOrigin(this.elements);this.state.elmLength=t.length,t.forEach((e,i)=>{const n=e;n.dataset.vvwIdx=i.toString(),n.removeEventListener("click",this.defaultOnClickHandler),n.removeEventListener("pointerup",this.onClickElements),n.addEventListener("click",this.defaultOnClickHandler),n.addEventListener("pointerup",this.onClickElements)})}else this.state.elmLength=this.elements.length}qs(t){return this.root?this.root.querySelector(t):null}qsOrigin(t){return document.querySelectorAll(t)}registerPointerListener(t){this.externalPointerListener.push(t)}getChildElements(t,e){const i=[],n=[],o=typeof this.elements=="string"?this.qsOrigin(this.elements):this.elements;for(let r=-t;r<=t;r++){const l=(e+r+o.length)%o.length,h=o[l],d={elm:h instanceof HTMLElement?tt(h):{config:h,origin:void 0,parsedSrcSet:void 0},pos:r,index:l,vistaView:this,maxZoomLevel:this.options.maxZoomLevel,transitionShouldWait:()=>this.isRapidSwap,onScale:({vistaImage:g,isMin:m,isMax:w})=>{var b,E,S,L;g.index===this.state.currentIndex&&(this.state.zoomedIn=!m,m?(b=this.qs(".vvw-zoom-out"))==null||b.setAttribute("disabled","true"):(E=this.qs(".vvw-zoom-out"))==null||E.removeAttribute("disabled"),w?(S=this.qs(".vvw-zoom-in"))==null||S.setAttribute("disabled","true"):(L=this.qs(".vvw-zoom-in"))==null||L.removeAttribute("disabled"))}};let u=null;this.state.extensions.forEach(g=>{!u&&g.onInitializeImage&&(u=g.onInitializeImage(d))});const v=u??new O(d),p=document.createElement("div");p.className="vvw-item",p.dataset.vvwPos=`${r}`,p.dataset.vvwIdx=`${l}`,v.thumb&&p.appendChild(v.thumb),p.appendChild(v.element),i.push(v),n.push(p)}return{htmls:n,images:i}}async swap(t,e){var p,g;this.reactivateUi();const i=this.options.preloads||0,n=this.state.currentIndex,{htmls:o,images:r}=this.getChildElements(i,n),l=this.imageContainer,h=this.state.children,f={htmlElements:{from:h.htmls,to:o},images:{from:h.images,to:r},index:{from:t,to:this.state.currentIndex},via:e||{next:!1,prev:!1},vistaView:this};this.imageSetupFunction(f),this.state.zoomedIn=!1,(p=this.qs(".vvw-zoom-out"))==null||p.setAttribute("disabled","true"),(g=this.qs(".vvw-zoom-in"))==null||g.removeAttribute("disabled");const u=performance.now()-this.lastSwapTime<this.options.rapidLimit;this.isRapidSwap=u;const{images:v}=this.state.children;if(this.state.children={htmls:o,images:r},this.displayCurrentInfo(),u)v.forEach(m=>{m.cancelPendingLoad(),m.destroy()});else{const m=this.state.abortController.signal,w=this.transitionFunction(f,m);w&&(this.transitionCleanup=w.cleanup,await w.transitionEnded),this.lastSwapTime=performance.now(),v.forEach(L=>{L.cancelPendingLoad()});const b=v.find(L=>L.index===n),E=b?x.stop(b):void 0,S=r.find(L=>L.index===n);S&&b&&S.cloneStyleFrom(b,E),v.forEach(L=>{L.destroy()})}l.innerHTML="",this.transitionCleanup&&this.transitionCleanup(),o.forEach(m=>{l.appendChild(m)}),r.forEach(m=>{m.init()}),u?(this.isRapidSwapRelease&&clearTimeout(this.isRapidSwapRelease),this.isRapidSwapRelease=setTimeout(()=>{this.isRapidSwap=!1},333)):this.isRapidSwap=!1,this.options.onImageView&&this.options.onImageView(f,this),this.state.extensions.forEach(m=>{m.onImageView&&m.onImageView(f,this)})}displayCurrentInfo(){const t=this.state.currentIndex;typeof this.elements=="string"&&this.qsOrigin(this.elements).forEach((r,l)=>{r.style.opacity="",l===t&&(r.style.opacity="0")});const e=this.qs(".vvw-index"),i=`${t+1}`,n=`${this.state.elmLength}`;e&&(e.textContent=`${i} / ${n}`);const o=this.qs(".vvw-desc");if(o){const r=this.state.children.images.find(h=>h.index===t),l=(r==null?void 0:r.config.alt)||"";l?(o.textContent=l,o.setAttribute("aria-label",`Image ${i} of ${n}: ${l}`),o.style.opacity=""):(o.textContent="",o.setAttribute("aria-label",`Image ${i} of ${n}`),o.style.opacity="0")}}deactivateUi(t,e){t.forEach(i=>{var n,o;i==="zoomIn"?(n=this.qs(".vvw-zoom-in"))==null||n.setAttribute("disabled","true"):i==="zoomOut"&&((o=this.qs(".vvw-zoom-out"))==null||o.setAttribute("disabled","true")),this.tempDeactivatedUi.push(i)}),this.tempDeactivationRequestBy=e||null,this.state.extensions.forEach(i=>{i.onDeactivateUi&&i.onDeactivateUi(t,this.tempDeactivationRequestBy,this)})}reactivateUi(){this.tempDeactivatedUi.forEach(t=>{var e,i;t==="zoomIn"?(e=this.qs(".vvw-zoom-in"))==null||e.removeAttribute("disabled"):t==="zoomOut"&&((i=this.qs(".vvw-zoom-out"))==null||i.removeAttribute("disabled"))}),this.state.extensions.forEach(t=>{t.onReactivateUi&&t.onReactivateUi(this.tempDeactivatedUi,this.tempDeactivationRequestBy,this)}),this.tempDeactivatedUi=[],this.tempDeactivationRequestBy=null}open(t=0){var h,f,d,u,v,p,g;if(C.somethingOpened){console.warn("Another VistaView instance is already opened. Close it first before opening a new one.");return}C.somethingOpened=this,this.reset(),(t<0||t>=this.state.elmLength)&&(t=(t%this.state.elmLength+this.state.elmLength)%this.state.elmLength),this.state.currentIndex=t,document.body.style.overflow="hidden";const e=Y({controls:this.options.controls,extensions:this.state.extensions});if(document.body.append(e),this.root=document.body.querySelector("#vvw-root"),!this.root)throw new Error("Failed to setup VistaView root element.");this.imageContainer=this.qs(".vvw-image-container"),this.options.animationDurationBase&&this.root.style.setProperty("--vvw-anim-dur",`${this.options.animationDurationBase}`),this.options.initialZIndex!==void 0&&this.root.style.setProperty("--vvw-init-z",`${this.options.initialZIndex??0}`),this.options.arrowOnSmallScreens&&this.root.classList.add("vvw-arrow-sm");const i=this.options.preloads||0,n=t,{images:o,htmls:r}=this.getChildElements(i,n),l={htmlElements:{from:null,to:r},images:{from:null,to:o},index:{from:null,to:this.state.currentIndex},via:{next:!1,prev:!1},vistaView:this};this.imageSetupFunction(l),this.state.children={htmls:r,images:o},r.forEach(m=>{this.imageContainer.appendChild(m)}),o.forEach(m=>{m.init()}),(h=this.qs(".vvw-close"))==null||h.addEventListener("click",()=>this.close()),(f=this.qs(".vvw-zoom-in"))==null||f.addEventListener("click",()=>this.zoomIn()),(d=this.qs(".vvw-zoom-out"))==null||d.addEventListener("click",()=>this.zoomOut()),(u=this.qs(".vvw-prev>button"))==null||u.addEventListener("click",()=>this.prev()),(v=this.qs(".vvw-next>button"))==null||v.addEventListener("click",()=>this.next()),this.state.elmLength<2&&((p=this.qs(".vvw-prev"))==null||p.classList.add("vvw--hidden"),(g=this.qs(".vvw-next"))==null||g.classList.add("vvw--hidden")),this.openFunction(this),this.eventHandlers=new _(this),this.externalPointerListener.forEach(m=>{this.eventHandlers.registerPointerListener(m)}),this.eventHandlers.start(this.imageContainer),requestAnimationFrame(()=>{requestAnimationFrame(()=>{var m;(m=this.root)==null||m.addEventListener("transitionend",()=>{var w;(w=this.root)==null||w.classList.add("vvw--settled")},{once:!0}),this.root.classList.add("vvw--active"),this.displayCurrentInfo(),this.options.onOpen&&this.options.onOpen(this),this.options.onImageView&&this.options.onImageView(l,this),this.state.extensions.forEach(w=>{w.onOpen&&w.onOpen(this),w.onImageView&&w.onImageView(l,this)})})})}async close(t=!0){C.somethingOpened===this&&this.root&&(this.eventHandlers.stop(),this.eventHandlers=null,this.state.children.images.forEach(e=>{e.prepareClose()}),t?await new Promise(e=>{let n=0;this.root.addEventListener("transitionend",o=>{o.target===this.root&&(n++,n===2&&typeof this.elements=="string"&&(this.state.children.images.forEach(r=>{r.destroy()}),this.qsOrigin(this.elements).forEach(r=>{r.style.opacity=""})),n===3&&e(null))}),this.root.classList.add("vvw--closing")}):typeof this.elements=="string"&&(this.state.children.images.forEach(e=>{e.destroy()}),this.qsOrigin(this.elements).forEach(e=>{e.style.opacity=""})),this.root.remove(),this.root=null,this.imageContainer=null,this.state.children={htmls:[],images:[]},this.state.currentIndex=-1,this.state.children.images.forEach(e=>{e.destroy()}),document.body.style.overflow="",C.somethingOpened=null,this.closeFunction(this),this.options.onClose&&this.options.onClose(this),this.state.extensions.forEach(e=>{e.onClose&&e.onClose(this)}))}destroy(){this.close(!1),this.externalPointerListener=[],typeof this.elements=="string"&&this.qsOrigin(this.elements).forEach(t=>{t.removeAttribute("data-vista-idx"),t.removeEventListener("click",this.defaultOnClickHandler),t.removeEventListener("pointerup",this.onClickElements)})}next(){if(C.somethingOpened!==this){console.warn("This VistaView instance is not opened.");return}const t=(this.state.currentIndex+1)%this.state.elmLength;this.view(t,{next:!0,prev:!1})}prev(){if(C.somethingOpened!==this){console.warn("This VistaView instance is not opened.");return}const t=(this.state.currentIndex-1+this.state.elmLength)%this.state.elmLength;this.view(t,{next:!1,prev:!0})}view(t,e){if(C.somethingOpened!==this){console.warn("This VistaView instance is not opened.");return}if(this.state.elmLength<2)return;(t<0||t>=this.state.elmLength)&&(t=(t%this.state.elmLength+this.state.elmLength)%this.state.elmLength);const i=this.state.currentIndex;this.state.currentIndex=t;const n=this.state.abortController;n==null||n.abort(),this.state.abortController=new AbortController,this.swap(i,e)}zoomIn(){if(C.somethingOpened!==this){console.warn("This VistaView instance is not opened.");return}this.tempDeactivatedUi.includes("zoomIn")||this.throttle.fio(()=>{const t=this.state.children.images.find(e=>e.pos===0);t==null||t.animateZoom(1.68)},"zoom",222)}zoomOut(){if(C.somethingOpened!==this){console.warn("This VistaView instance is not opened.");return}this.tempDeactivatedUi.includes("zoomOut")||this.throttle.fio(()=>{const t=this.state.children.images.find(e=>e.pos===0);t==null||t.animateZoom(.68)},"zoom",222)}getCurrentIndex(){return this.state.currentIndex}}function et(s){let t=null;if(typeof s=="string"){if(t=document.querySelectorAll(s),t.length===0)return new Error("No elements found in node list.").toString();for(let e=0;e<t.length;e++){const i=t[e],n=i.tagName.toLowerCase();if(n!=="img"&&n!=="a")return new Error(`Invalid element at index ${e}: expected <img>, <a>, got <${n}>`);if(n==="a"&&!(i.querySelector("img")!==null))return new Error(`Invalid <a> element at index ${e}: must contain <img>`)}}else{const e=s;for(let i=0;i<e.length;i++)if(!e[i].src)return new Error(`Invalid image data at index ${i}: must have 'src'`)}return s}function it({elements:s,...t}){if(!s)return console.error(s),console.error("no elements provided"),console.warn("VistaView: silently returning."),null;let e=et(s);if(e instanceof Error)return console.error(e),console.warn("VistaView: silently returning."),null;const i=new A(e,t);return{open:(n=0)=>i.open(n),reset:()=>i.reset(),close:()=>i.close(),next:()=>i.next(),prev:()=>i.prev(),zoomIn:()=>i.zoomIn(),zoomOut:()=>i.zoomOut(),destroy:()=>i.destroy(),getCurrentIndex:()=>i.getCurrentIndex(),view:n=>{i.view(n)}}}c.DefaultOptions=y,c.VistaBox=F,c.VistaHiresTransition=x,c.VistaImage=O,c.VistaImageEvent=_,c.VistaPointers=V,c.VistaState=$,c.VistaView=A,c.close=T,c.imageSetup=z,c.init=W,c.open=R,c.transition=H,c.vistaView=it,Object.defineProperty(c,Symbol.toStringTag,{value:"Module"})}));
|