smartphoto 2.1.3 → 2.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/css/smartphoto.css +68 -8
- package/css/smartphoto.min.css +1 -1
- package/js/jquery-smartphoto.js +38 -6
- package/js/jquery-smartphoto.min.js +2 -2
- package/js/smartphoto.js +38 -6
- package/js/smartphoto.min.js +2 -2
- package/lib/smartphoto.js +37 -4
- package/lib/smartphoto.mjs +37 -4
- package/lib/types/core/types.d.ts +1 -0
- package/package.json +10 -8
- package/css/smartphoto.css.map +0 -1
package/README.md
CHANGED
|
@@ -188,6 +188,11 @@ Slide fields:
|
|
|
188
188
|
<td>minimum swipe distance (px) to trigger navigation/close</td>
|
|
189
189
|
<td>100</td>
|
|
190
190
|
</tr>
|
|
191
|
+
<tr>
|
|
192
|
+
<td>swipeVelocity</td>
|
|
193
|
+
<td>minimum swipe speed (px/ms) that triggers navigation even below swipeOffset (fast flicks)</td>
|
|
194
|
+
<td>0.5</td>
|
|
195
|
+
</tr>
|
|
191
196
|
<tr>
|
|
192
197
|
<td>headerHeight</td>
|
|
193
198
|
<td>height (px) reserved for the header when fitting images</td>
|
package/css/smartphoto.css
CHANGED
|
@@ -2,26 +2,32 @@
|
|
|
2
2
|
from {
|
|
3
3
|
opacity: 0;
|
|
4
4
|
}
|
|
5
|
+
|
|
5
6
|
to {
|
|
6
7
|
opacity: 1;
|
|
7
8
|
}
|
|
8
9
|
}
|
|
10
|
+
|
|
9
11
|
@keyframes smartphoto-img-wrap {
|
|
10
12
|
from {
|
|
11
13
|
opacity: 0;
|
|
12
14
|
}
|
|
15
|
+
|
|
13
16
|
to {
|
|
14
17
|
opacity: 1;
|
|
15
18
|
}
|
|
16
19
|
}
|
|
20
|
+
|
|
17
21
|
@keyframes smartphoto-inner {
|
|
18
22
|
from {
|
|
19
23
|
transform: translate(0, 100px);
|
|
20
24
|
}
|
|
25
|
+
|
|
21
26
|
to {
|
|
22
27
|
transform: translate(0, 0);
|
|
23
28
|
}
|
|
24
29
|
}
|
|
30
|
+
|
|
25
31
|
@keyframes smartphoto-loader {
|
|
26
32
|
0% {
|
|
27
33
|
opacity: 0.4;
|
|
@@ -36,14 +42,23 @@
|
|
|
36
42
|
transform: rotate(360deg);
|
|
37
43
|
}
|
|
38
44
|
}
|
|
45
|
+
|
|
46
|
+
/* display の切り替えをキーフレーム内でアニメーションさせていた版は、閉じている間
|
|
47
|
+
* (dialog が display:none)にアニメーションのタイムラインが進まなくなり、再度開いた
|
|
48
|
+
* 際に 0%/1% の display:none で止まったままになる実機バグがあった(矢印/ナビが
|
|
49
|
+
* クリック不能になり、その下の背景をタップしたと判定されてモーダルが閉じてしまう)。
|
|
50
|
+
* 表示/非表示そのものは常に aria-hidden 属性のセレクタ側(下記)で確定させ、
|
|
51
|
+
* ここでは opacity のフェードのみをアニメーションする */
|
|
39
52
|
@keyframes smartphoto-appear {
|
|
40
53
|
0% {
|
|
41
54
|
opacity: 0;
|
|
42
55
|
}
|
|
56
|
+
|
|
43
57
|
100% {
|
|
44
58
|
opacity: 1;
|
|
45
59
|
}
|
|
46
60
|
}
|
|
61
|
+
|
|
47
62
|
@keyframes smartphoto-hide {
|
|
48
63
|
0% {
|
|
49
64
|
opacity: 1;
|
|
@@ -52,38 +67,67 @@
|
|
|
52
67
|
opacity: 0;
|
|
53
68
|
}
|
|
54
69
|
}
|
|
70
|
+
|
|
55
71
|
:root:has(dialog.smartphoto[open]) {
|
|
56
72
|
overflow: hidden;
|
|
57
73
|
}
|
|
58
74
|
|
|
75
|
+
/* dialogタグの表示制御 */
|
|
59
76
|
.smartphoto {
|
|
77
|
+
/* dialogタグのデフォルトスタイルをリセット */
|
|
60
78
|
border: none;
|
|
61
79
|
background: transparent;
|
|
62
80
|
padding: 0;
|
|
63
81
|
margin: 0;
|
|
64
82
|
outline: none;
|
|
83
|
+
/* 既存のスタイルを適用 */
|
|
65
84
|
position: fixed;
|
|
66
85
|
inset: 0;
|
|
67
86
|
width: 100%;
|
|
68
87
|
height: 100%;
|
|
69
88
|
max-width: 100%;
|
|
70
89
|
max-height: 100%;
|
|
90
|
+
/* dialog 自体には overflow の既定値が無く、子要素(nav/arrows 等)が僅かに
|
|
91
|
+
* ボックスを超えるだけで dialog 自身がスクロール可能になってしまう。
|
|
92
|
+
* 内側のスクロールは常に禁止し、外側の背景スクロール抑制(:root:has())と
|
|
93
|
+
* 合わせて完全に固定表示にする */
|
|
71
94
|
overflow: hidden;
|
|
95
|
+
/* モバイルでスクロールに伴いアドレスバーが表示/非表示になり可視領域が変化しても
|
|
96
|
+
* 追従するよう、dvh (動的ビューポート高さ) を優先する
|
|
97
|
+
* (see: https://github.com/appleple/SmartPhoto/issues/90)。
|
|
98
|
+
* dvh はブラウザによってはアドレスバーの伸縮への追従が実装依存で不安定なため、
|
|
99
|
+
* JS で実測して設定する --smartphoto-vh (updateViewportHeight() 参照) があれば
|
|
100
|
+
* それを優先し、JS 無効時やブラウザ未対応時は height:100%/max-height:100% に
|
|
101
|
+
* フォールバックする */
|
|
72
102
|
height: var(--smartphoto-vh, 100dvh);
|
|
73
103
|
max-height: var(--smartphoto-vh, 100dvh);
|
|
74
|
-
background-color: var(--smartphoto-backdrop-color,
|
|
104
|
+
background-color: var(--smartphoto-backdrop-color, rgba(0, 0, 0, 1));
|
|
75
105
|
opacity: 1;
|
|
76
106
|
font-family: sans-serif;
|
|
77
107
|
cursor: pointer;
|
|
78
|
-
|
|
108
|
+
/* close() は [open] 属性を外すと同時にネイティブに display:none / トップレイヤー
|
|
109
|
+
* からの除外を行う(§8)。display・overlay を allow-discrete で transition
|
|
110
|
+
* 対象に加えることで、opacity のフェードが完了するまでその適用を1フレーム分
|
|
111
|
+
* 遅らせ、閉じる瞬間に「ぱっと」消えず滑らかにフェードアウトするようにする */
|
|
112
|
+
transition:
|
|
113
|
+
opacity var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out),
|
|
114
|
+
display var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out) allow-discrete,
|
|
115
|
+
overlay var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out) allow-discrete;
|
|
79
116
|
}
|
|
117
|
+
|
|
80
118
|
.smartphoto:not([open]) {
|
|
81
119
|
opacity: 0;
|
|
82
120
|
}
|
|
121
|
+
|
|
83
122
|
.smartphoto::backdrop {
|
|
84
|
-
background-color: var(--smartphoto-backdrop-color,
|
|
123
|
+
background-color: var(--smartphoto-backdrop-color, rgba(0, 0, 0, 1));
|
|
85
124
|
}
|
|
86
125
|
|
|
126
|
+
/* View Transition(openPhotoWithViewTransition() 参照)の疑似要素ツリーは document の
|
|
127
|
+
* ルート要素(html)の子として扱われ、dialog に設定した --smartphoto-animation-speed を
|
|
128
|
+
* 継承しない。そのため JS 側では document.documentElement にも同じ変数を設定しており、
|
|
129
|
+
* ここではその値を参照する。指定がなければブラウザ既定(実装依存, 概ね0.25s前後で
|
|
130
|
+
* 速すぎるとの声があった)の代わりに 0.3s を使う */
|
|
87
131
|
::view-transition-group(smartphoto-hero),
|
|
88
132
|
::view-transition-old(smartphoto-hero),
|
|
89
133
|
::view-transition-new(smartphoto-hero) {
|
|
@@ -121,6 +165,7 @@
|
|
|
121
165
|
left: 0;
|
|
122
166
|
width: 100%;
|
|
123
167
|
height: 100%;
|
|
168
|
+
/* Pointer Events(swipe/pinch)がブラウザ既定のスクロール・ズームと衝突しないようにする */
|
|
124
169
|
touch-action: none;
|
|
125
170
|
}
|
|
126
171
|
|
|
@@ -169,6 +214,7 @@
|
|
|
169
214
|
-ms-user-select: none;
|
|
170
215
|
user-select: none;
|
|
171
216
|
transition: transform var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out);
|
|
217
|
+
|
|
172
218
|
-webkit-user-drag: none;
|
|
173
219
|
}
|
|
174
220
|
|
|
@@ -189,6 +235,7 @@
|
|
|
189
235
|
.smartphoto-img-wrap {
|
|
190
236
|
display: inline-block;
|
|
191
237
|
opacity: 1;
|
|
238
|
+
/* Pointer Events(ピンチ/ドラッグ)がブラウザ既定のスクロール・ズームと衝突しないようにする */
|
|
192
239
|
touch-action: none;
|
|
193
240
|
-webkit-transition: opacity var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out);
|
|
194
241
|
-moz-transition: opacity var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out);
|
|
@@ -222,7 +269,7 @@
|
|
|
222
269
|
animation-timing-function: var(--smartphoto-animation-function, ease-out);
|
|
223
270
|
}
|
|
224
271
|
|
|
225
|
-
.smartphoto-arrows[aria-hidden=true] {
|
|
272
|
+
.smartphoto-arrows[aria-hidden='true'] {
|
|
226
273
|
animation-name: smartphoto-hide;
|
|
227
274
|
display: none;
|
|
228
275
|
}
|
|
@@ -239,16 +286,19 @@
|
|
|
239
286
|
animation-timing-function: var(--smartphoto-animation-function, ease-out);
|
|
240
287
|
animation-name: smartphoto-appear;
|
|
241
288
|
}
|
|
289
|
+
|
|
242
290
|
.smartphoto-arrows li:focus {
|
|
243
291
|
outline: none;
|
|
244
292
|
}
|
|
245
293
|
|
|
246
|
-
.smartphoto-arrows [aria-hidden=true] {
|
|
294
|
+
.smartphoto-arrows [aria-hidden='true'] {
|
|
247
295
|
animation-name: smartphoto-hide;
|
|
248
296
|
display: none;
|
|
249
297
|
}
|
|
250
298
|
|
|
251
299
|
.smartphoto-arrows button {
|
|
300
|
+
/* <button> の UA デフォルト(border/padding/背景/appearance)をリセットし、
|
|
301
|
+
* 旧 <a> と同じ「全面クリック領域 + 背景 SVG アイコン」の見た目を維持する */
|
|
252
302
|
appearance: none;
|
|
253
303
|
display: block;
|
|
254
304
|
width: 100%;
|
|
@@ -265,6 +315,7 @@
|
|
|
265
315
|
padding: 5px 0;
|
|
266
316
|
background-color: rgba(0, 0, 0, 0.5);
|
|
267
317
|
}
|
|
318
|
+
|
|
268
319
|
.smartphoto-arrow-right button {
|
|
269
320
|
background-image: url(data:image/svg+xml;base64,PHN2ZyBpZD0i44Os44Kk44Ok44O8XzEiIGRhdGEtbmFtZT0i44Os44Kk44Ok44O8IDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDI4MzQuNjUgMjgzNC42NSIgZmlsbD0iI0ZGRiAiPjx0aXRsZT5pY29uPC90aXRsZT48cGF0aCBkPSJNMTgzNy44OCwxNDE3LjMyLDY0My41OSwyMjNhNzIuMjEsNzIuMjEsMCwwLDEsMC0xMDEuODJMNzQzLjgyLDIxYTcyLjIxLDcyLjIxLDAsMCwxLDEwMS44MiwwTDIwOTAuODMsMTI2Ni4xOWwxMDAuMjMsMTAwLjIzYTcyLjIxLDcyLjIxLDAsMCwxLDAsMTAxLjgyTDg0NS42NCwyODEzLjY1YTcyLjIxLDcyLjIxLDAsMCwxLTEwMS44MiwwTDY0My41OSwyNzEzLjQyYTcyLjIxLDcyLjIxLDAsMCwxLDAtMTAxLjgyWiIvPjwvc3ZnPg==);
|
|
270
321
|
}
|
|
@@ -274,6 +325,7 @@
|
|
|
274
325
|
padding: 5px 0;
|
|
275
326
|
background-color: rgba(0, 0, 0, 0.5);
|
|
276
327
|
}
|
|
328
|
+
|
|
277
329
|
.smartphoto-arrow-left button {
|
|
278
330
|
background-image: url(data:image/svg+xml;base64,PHN2ZyBpZD0i44Os44Kk44Ok44O8XzEiIGRhdGEtbmFtZT0i44Os44Kk44Ok44O8IDEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgdmlld0JveD0iMCAwIDI4MzQuNjUgMjgzNC42NSIgZmlsbD0iI0ZGRiI+PHRpdGxlPmljb248L3RpdGxlPjxwYXRoIGQ9Ik05OTYuNzcsMTQxNy4zMiwyMTkxLjA2LDIyM2E3Mi4yMSw3Mi4yMSwwLDAsMCwwLTEwMS44MkwyMDkwLjgzLDIxQTcyLjIxLDcyLjIxLDAsMCwwLDE5ODksMjFMNzQzLjgyLDEyNjYuMTksNjQzLjU5LDEzNjYuNDJhNzIuMjEsNzIuMjEsMCwwLDAsMCwxMDEuODJMMTk4OSwyODEzLjY1YTcyLjIxLDcyLjIxLDAsMCwwLDEwMS44MiwwbDEwMC4yMy0xMDAuMjNhNzIuMjEsNzIuMjEsMCwwLDAsMC0xMDEuODJaIi8+PC9zdmc+);
|
|
279
331
|
}
|
|
@@ -293,7 +345,7 @@
|
|
|
293
345
|
animation-timing-function: var(--smartphoto-animation-function, ease-out);
|
|
294
346
|
}
|
|
295
347
|
|
|
296
|
-
.smartphoto-nav[aria-hidden=true] {
|
|
348
|
+
.smartphoto-nav[aria-hidden='true'] {
|
|
297
349
|
animation-name: smartphoto-hide;
|
|
298
350
|
display: none;
|
|
299
351
|
}
|
|
@@ -306,6 +358,7 @@
|
|
|
306
358
|
padding: 0;
|
|
307
359
|
text-align: center;
|
|
308
360
|
white-space: nowrap;
|
|
361
|
+
|
|
309
362
|
-webkit-overflow-scrolling: touch;
|
|
310
363
|
}
|
|
311
364
|
|
|
@@ -317,6 +370,8 @@
|
|
|
317
370
|
}
|
|
318
371
|
|
|
319
372
|
.smartphoto-nav button {
|
|
373
|
+
/* <button> の UA デフォルト(border/padding/appearance)をリセットし、
|
|
374
|
+
* 旧 <a> と同じサムネイル背景画像ボタンの見た目を維持する */
|
|
320
375
|
appearance: none;
|
|
321
376
|
display: block;
|
|
322
377
|
width: 100%;
|
|
@@ -330,6 +385,7 @@
|
|
|
330
385
|
opacity: 0.5;
|
|
331
386
|
cursor: pointer;
|
|
332
387
|
}
|
|
388
|
+
|
|
333
389
|
.smartphoto-nav button:focus {
|
|
334
390
|
opacity: 0.8;
|
|
335
391
|
}
|
|
@@ -353,6 +409,7 @@
|
|
|
353
409
|
padding: 0;
|
|
354
410
|
white-space: nowrap;
|
|
355
411
|
}
|
|
412
|
+
|
|
356
413
|
.smartphoto-list li {
|
|
357
414
|
display: block;
|
|
358
415
|
position: absolute;
|
|
@@ -362,6 +419,7 @@
|
|
|
362
419
|
height: 100%;
|
|
363
420
|
transition: all var(--smartphoto-animation-speed, 0.3s) var(--smartphoto-animation-function, ease-out);
|
|
364
421
|
}
|
|
422
|
+
|
|
365
423
|
.smartphoto-list li:focus {
|
|
366
424
|
outline: none;
|
|
367
425
|
}
|
|
@@ -388,6 +446,7 @@
|
|
|
388
446
|
margin: 0;
|
|
389
447
|
font-weight: normal;
|
|
390
448
|
}
|
|
449
|
+
|
|
391
450
|
.smartphoto-caption:focus {
|
|
392
451
|
outline: none;
|
|
393
452
|
}
|
|
@@ -399,6 +458,9 @@
|
|
|
399
458
|
width: 0;
|
|
400
459
|
height: 0;
|
|
401
460
|
transform: translate(50vw, 50vh);
|
|
461
|
+
/* dvh 対応ブラウザでは動的ビューポート高さを基準に中央寄せする
|
|
462
|
+
* (see: https://github.com/appleple/SmartPhoto/issues/90)。
|
|
463
|
+
* --smartphoto-vh (updateViewportHeight() 参照) が設定されていればそちらを優先する(§) */
|
|
402
464
|
transform: translate(50vw, 50dvh);
|
|
403
465
|
transform: translate(50vw, calc(var(--smartphoto-vh, 100dvh) / 2));
|
|
404
466
|
}
|
|
@@ -436,5 +498,3 @@
|
|
|
436
498
|
border: 0;
|
|
437
499
|
clip: rect(0, 0, 0, 0);
|
|
438
500
|
}
|
|
439
|
-
|
|
440
|
-
/*# sourceMappingURL=smartphoto.css.map */
|
package/css/smartphoto.min.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
@keyframes smartphoto{
|
|
1
|
+
@keyframes smartphoto{0%{opacity:0}to{opacity:1}}@keyframes smartphoto-img-wrap{0%{opacity:0}to{opacity:1}}@keyframes smartphoto-inner{0%{transform:translateY(100px)}to{transform:translate(0)}}@keyframes smartphoto-loader{0%{opacity:.4;transform:rotate(0deg)}50%{opacity:1;transform:rotate(180deg)}to{opacity:.4;transform:rotate(1turn)}}@keyframes smartphoto-appear{0%{opacity:0}to{opacity:1}}@keyframes smartphoto-hide{0%{opacity:1}to{opacity:0}}:root:has(dialog.smartphoto[open]){overflow:hidden}.smartphoto{border:none;background:transparent;padding:0;margin:0;outline:none;position:fixed;inset:0;width:100%;height:100%;max-width:100%;max-height:100%;overflow:hidden;height:var(--smartphoto-vh,100dvh);max-height:var(--smartphoto-vh,100dvh);background-color:var(--smartphoto-backdrop-color,#000);opacity:1;font-family:sans-serif;cursor:pointer;transition:opacity var(--smartphoto-animation-speed,.3s) var(--smartphoto-animation-function,ease-out),display var(--smartphoto-animation-speed,.3s) var(--smartphoto-animation-function,ease-out) allow-discrete,overlay var(--smartphoto-animation-speed,.3s) var(--smartphoto-animation-function,ease-out) allow-discrete}.smartphoto:not([open]){opacity:0}.smartphoto::backdrop{background-color:var(--smartphoto-backdrop-color,#000)}::view-transition-group(smartphoto-hero),::view-transition-new(smartphoto-hero),::view-transition-old(smartphoto-hero){animation-duration:var(--smartphoto-animation-speed,.3s);animation-timing-function:var(--smartphoto-animation-function,ease-out)}.smartphoto-close{opacity:0}.smartphoto-count{display:inline-block;color:#fff;font-size:16px}.smartphoto-header{display:block;box-sizing:border-box;position:fixed;z-index:102;top:0;left:0;width:100%;height:50px;padding:15px;background-color:var(--smartphoto-header-color,rgba(0,0,0,.2))}.smartphoto-content{display:block;position:absolute;top:0;left:0;width:100%;height:100%;touch-action:none}.smartphoto-dismiss{display:block;position:absolute;top:15px;right:10px;width:20px;height:20px;padding:0;border:none;background-color:transparent;background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiNmZmYiIGRhdGEtbmFtZT0i44Os44Kk44Ok44O8IDEiIHZpZXdCb3g9IjAgMCAyODM0LjY1IDI4MzQuNjUiPjx0aXRsZT5pY29uPC90aXRsZT48cGF0aCBkPSJNMTU3Ni40MiAxNDA2Ljc2IDI3ODQgMTk5LjE5YTU2Ljg2IDU2Ljg2IDAgMCAwIDAtODAuMThsLTc4LjkyLTc4LjkyYTU2Ljg2IDU2Ljg2IDAgMCAwLTgwLjE4IDBMMTQxNy4zMiAxMjQ3LjY2IDIwOS43NSA0MC4wOWE1Ni44NiA1Ni44NiAwIDAgMC04MC4xOCAwTDUwLjY1IDExOWE1Ni44NiA1Ni44NiAwIDAgMCAwIDgwLjE4bDEyMDcuNTggMTIwNy41OEw1MC42NSAyNjE0LjM0YTU2Ljg2IDU2Ljg2IDAgMCAwIDAgODAuMThsNzguOTIgNzguOTJhNTYuODYgNTYuODYgMCAwIDAgODAuMTggMGwxMjA3LjU3LTEyMDcuNThMMjYyNC45IDI3NzMuNDRhNTYuODYgNTYuODYgMCAwIDAgODAuMTggMGw3OC45Mi03OC45MmE1Ni44NiA1Ni44NiAwIDAgMCAwLTgwLjE4WiIvPjwvc3ZnPg==);text-shadow:0 1px 0 #fff;color:#fff;font-size:30px;text-decoration:none;cursor:pointer;line-height:1}.smartphoto-body{z-index:102;margin:0 auto}.smartphoto-body,.smartphoto-inner{position:relative;width:100%;height:100%}.smartphoto-inner{vertical-align:top}.smartphoto-img{display:none;max-width:none;width:auto;height:auto;cursor:zoom-in;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;transition:transform var(--smartphoto-animation-speed,.3s) var(--smartphoto-animation-function,ease-out);-webkit-user-drag:none}.smartphoto-img.active{display:block}.smartphoto-img-onmove{cursor:grab;cursor:-webkit-grab;transition:none}.smartphoto-img-elasticmove{transition:transform var(--smartphoto-animation-speed,.3s) var(--smartphoto-animation-function,ease-out)}.smartphoto-img-wrap{display:inline-block;opacity:1;touch-action:none;-webkit-transition:opacity var(--smartphoto-animation-speed,.3s) var(--smartphoto-animation-function,ease-out);-moz-transition:opacity var(--smartphoto-animation-speed,.3s) var(--smartphoto-animation-function,ease-out);-ms-transition:opacity var(--smartphoto-animation-speed,.3s) var(--smartphoto-animation-function,ease-out);-o-transition:opacity var(--smartphoto-animation-speed,.3s) var(--smartphoto-animation-function,ease-out);transition:opacity var(--smartphoto-animation-speed,.3s) var(--smartphoto-animation-function,ease-out);animation-name:smartphoto-img-wrap;animation-duration:var(--smartphoto-animation-speed,.3s);animation-timing-function:var(--smartphoto-animation-function,ease-out)}.smartphoto-img-left{transform:translateX(150%)!important}.smartphoto-img-right{transform:translateX(-150%)!important}.smartphoto-arrows{list-style-type:none;margin:0;padding:0;position:relative;z-index:1002;top:50%;left:0;opacity:1;animation-name:smartphoto-appear;animation-duration:var(--smartphoto-animation-speed,.3s);animation-timing-function:var(--smartphoto-animation-function,ease-out)}.smartphoto-arrows[aria-hidden=true]{animation-name:smartphoto-hide;display:none}.smartphoto-arrows li{display:block;position:absolute;top:50%;width:30px;height:30px;margin-top:-20px;box-sizing:content-box;animation-duration:var(--smartphoto-animation-speed,.3s);animation-timing-function:var(--smartphoto-animation-function,ease-out);animation-name:smartphoto-appear}.smartphoto-arrows li:focus{outline:none}.smartphoto-arrows [aria-hidden=true]{animation-name:smartphoto-hide;display:none}.smartphoto-arrows button{appearance:none;display:block;width:100%;height:100%;margin:0;padding:0;border:none;background-color:transparent;cursor:pointer}.smartphoto-arrow-right{right:0;padding:5px 0;background-color:rgba(0,0,0,.5)}.smartphoto-arrow-right button{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiNmZmYiIGRhdGEtbmFtZT0i44Os44Kk44Ok44O8IDEiIHZpZXdCb3g9IjAgMCAyODM0LjY1IDI4MzQuNjUiPjx0aXRsZT5pY29uPC90aXRsZT48cGF0aCBkPSJNMTgzNy44OCAxNDE3LjMyIDY0My41OSAyMjNhNzIuMjEgNzIuMjEgMCAwIDEgMC0xMDEuODJMNzQzLjgyIDIxYTcyLjIxIDcyLjIxIDAgMCAxIDEwMS44MiAwbDEyNDUuMTkgMTI0NS4xOSAxMDAuMjMgMTAwLjIzYTcyLjIxIDcyLjIxIDAgMCAxIDAgMTAxLjgyTDg0NS42NCAyODEzLjY1YTcyLjIxIDcyLjIxIDAgMCAxLTEwMS44MiAwbC0xMDAuMjMtMTAwLjIzYTcyLjIxIDcyLjIxIDAgMCAxIDAtMTAxLjgyWiIvPjwvc3ZnPg==)}.smartphoto-arrow-left{left:0;padding:5px 0;background-color:rgba(0,0,0,.5)}.smartphoto-arrow-left button{background-image:url(data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9IiNmZmYiIGRhdGEtbmFtZT0i44Os44Kk44Ok44O8IDEiIHZpZXdCb3g9IjAgMCAyODM0LjY1IDI4MzQuNjUiPjx0aXRsZT5pY29uPC90aXRsZT48cGF0aCBkPSJNOTk2Ljc3IDE0MTcuMzIgMjE5MS4wNiAyMjNhNzIuMjEgNzIuMjEgMCAwIDAgMC0xMDEuODJMMjA5MC44MyAyMUE3Mi4yMSA3Mi4yMSAwIDAgMCAxOTg5IDIxTDc0My44MiAxMjY2LjE5bC0xMDAuMjMgMTAwLjIzYTcyLjIxIDcyLjIxIDAgMCAwIDAgMTAxLjgyTDE5ODkgMjgxMy42NWE3Mi4yMSA3Mi4yMSAwIDAgMCAxMDEuODIgMGwxMDAuMjMtMTAwLjIzYTcyLjIxIDcyLjIxIDAgMCAwIDAtMTAxLjgyWiIvPjwvc3ZnPg==)}.smartPhotoArrowHideIcon{display:none}.smartphoto-nav{position:absolute;bottom:0;left:0;width:100%;opacity:1;animation-name:smartphoto-appear;animation-duration:var(--smartphoto-animation-speed,.3s);animation-timing-function:var(--smartphoto-animation-function,ease-out)}.smartphoto-nav[aria-hidden=true]{animation-name:smartphoto-hide;display:none}.smartphoto-nav ul{display:block;overflow-x:auto;list-style:none;margin:0;padding:0;text-align:center;white-space:nowrap;-webkit-overflow-scrolling:touch}.smartphoto-nav li{display:inline-block;overflow:hidden;width:50px;height:50px}.smartphoto-nav button{appearance:none;display:block;width:100%;height:100%;margin:0;padding:0;border:none;background-color:#fff;background-position:50%;background-size:cover;opacity:.5;cursor:pointer}.smartphoto-nav button:focus{opacity:.8}.smartphoto-nav button.current{opacity:1}.smartphoto-nav img{width:auto;height:100%}.smartphoto-list{list-style-type:none;position:absolute;z-index:101;top:0;left:0;margin:0;padding:0;white-space:nowrap}.smartphoto-list li{display:block;position:absolute;top:0;left:0;width:100%;height:100%;transition:all var(--smartphoto-animation-speed,.3s) var(--smartphoto-animation-function,ease-out)}.smartphoto-list li:focus{outline:none}.smartphoto-list-onmove{transition:all .3s var(--smartphoto-animation-function,ease-out)}.smartphoto-caption{overflow:hidden;box-sizing:border-box;position:absolute;top:0;left:0;width:100%;height:50px;padding:0 50px;color:#fff;font-size:12px;text-align:center;line-height:50px;white-space:nowrap;text-overflow:ellipsis;margin:0;font-weight:400}.smartphoto-caption:focus{outline:none}.smartphoto-loader-wrap{display:block;position:relative;z-index:103;width:0;height:0;transform:translate(50vw,50vh);transform:translate(50vw,50dvh);transform:translate(50vw,calc(var(--smartphoto-vh, 100dvh)/2))}.smartphoto-loader{position:absolute;z-index:101;top:0;left:0;width:30px;height:30px;margin-top:-25px;margin-left:-25px;border:8px solid #17cddd;border-right-color:transparent;border-radius:50%;animation:smartphoto-loader .5s linear infinite}.smartphoto-img-clone{position:fixed;z-index:100;top:0;left:0;transition:all var(--smartphoto-animation-speed,.3s) var(--smartphoto-animation-function,ease-out)}.smartphoto-sr-only{overflow:hidden;position:absolute;width:1px;height:1px;margin:-1px;padding:0;border:0;clip:rect(0,0,0,0)}
|
package/js/jquery-smartphoto.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* SmartPhoto v2.1.
|
|
2
|
+
* SmartPhoto v2.1.4
|
|
3
3
|
* (c) appleple
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -106,6 +106,7 @@
|
|
|
106
106
|
swipeTopToClose: false,
|
|
107
107
|
swipeBottomToClose: true,
|
|
108
108
|
swipeOffset: 100,
|
|
109
|
+
swipeVelocity: 0.5,
|
|
109
110
|
headerHeight: 60,
|
|
110
111
|
footerHeight: 60,
|
|
111
112
|
forceInterval: 10,
|
|
@@ -366,6 +367,7 @@
|
|
|
366
367
|
const y = p1.y - p2.y;
|
|
367
368
|
return Math.sqrt(x * x + y * y);
|
|
368
369
|
}
|
|
370
|
+
var MIN_FLICK_DISTANCE = 10;
|
|
369
371
|
function getForceAndTheta(x, y) {
|
|
370
372
|
return { force: Math.sqrt(x * x + y * y), theta: Math.atan2(y, x) };
|
|
371
373
|
}
|
|
@@ -383,6 +385,7 @@
|
|
|
383
385
|
let firstPos = null;
|
|
384
386
|
let oldPos = null;
|
|
385
387
|
let moveDir = null;
|
|
388
|
+
let swipeStartTime = 0;
|
|
386
389
|
let photoSwipable = false;
|
|
387
390
|
let firstPhotoPos = null;
|
|
388
391
|
let oldPhotoPos = null;
|
|
@@ -390,6 +393,7 @@
|
|
|
390
393
|
let photoVY = 0;
|
|
391
394
|
let pinching = false;
|
|
392
395
|
let oldDistance = 0;
|
|
396
|
+
let pinchMoveFrame = null;
|
|
393
397
|
let vx = 0;
|
|
394
398
|
let vy = 0;
|
|
395
399
|
function isSmartPhone2() {
|
|
@@ -511,6 +515,7 @@
|
|
|
511
515
|
dragStart = true;
|
|
512
516
|
firstPos = pos;
|
|
513
517
|
oldPos = pos;
|
|
518
|
+
swipeStartTime = Date.now();
|
|
514
519
|
}
|
|
515
520
|
function startPhotoDrag(e) {
|
|
516
521
|
photoSwipable = true;
|
|
@@ -535,6 +540,23 @@
|
|
|
535
540
|
}
|
|
536
541
|
startSwipe(e);
|
|
537
542
|
}
|
|
543
|
+
function scheduleGestureMove() {
|
|
544
|
+
if (pinchMoveFrame !== null) {
|
|
545
|
+
return;
|
|
546
|
+
}
|
|
547
|
+
pinchMoveFrame = requestAnimationFrame(() => {
|
|
548
|
+
pinchMoveFrame = null;
|
|
549
|
+
callbacks.onGestureMove();
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
function flushGestureMove() {
|
|
553
|
+
if (pinchMoveFrame === null) {
|
|
554
|
+
return;
|
|
555
|
+
}
|
|
556
|
+
cancelAnimationFrame(pinchMoveFrame);
|
|
557
|
+
pinchMoveFrame = null;
|
|
558
|
+
callbacks.onGestureMove();
|
|
559
|
+
}
|
|
538
560
|
function movePinch() {
|
|
539
561
|
const points = Array.from(activePointers.values());
|
|
540
562
|
const dist = distance(
|
|
@@ -559,7 +581,7 @@
|
|
|
559
581
|
state.viewer.hideUi = state.viewer.scaleSize < 1 || state.viewer.scaleSize > border;
|
|
560
582
|
}
|
|
561
583
|
oldDistance = dist;
|
|
562
|
-
|
|
584
|
+
scheduleGestureMove();
|
|
563
585
|
}
|
|
564
586
|
function moveSwipe(e) {
|
|
565
587
|
const pos = getPos(e);
|
|
@@ -608,6 +630,7 @@
|
|
|
608
630
|
}
|
|
609
631
|
function endPinch() {
|
|
610
632
|
pinching = false;
|
|
633
|
+
flushGestureMove();
|
|
611
634
|
const item = currentItem(state);
|
|
612
635
|
if (!item) {
|
|
613
636
|
return;
|
|
@@ -645,9 +668,11 @@
|
|
|
645
668
|
const items = (_a = currentItems(state)) != null ? _a : [];
|
|
646
669
|
if (moveDir === "horizontal") {
|
|
647
670
|
let result = "stay";
|
|
648
|
-
|
|
671
|
+
const elapsedMs = Math.max(now - swipeStartTime, 1);
|
|
672
|
+
const isFlick = Math.abs(swipeWidth) >= MIN_FLICK_DISTANCE && Math.abs(swipeWidth) / elapsedMs >= state.options.swipeVelocity;
|
|
673
|
+
if ((swipeWidth >= state.options.swipeOffset || isFlick && swipeWidth > 0) && state.viewer.currentIndex !== 0) {
|
|
649
674
|
result = "prev";
|
|
650
|
-
} else if (swipeWidth <= -state.options.swipeOffset && state.viewer.currentIndex !== items.length - 1) {
|
|
675
|
+
} else if ((swipeWidth <= -state.options.swipeOffset || isFlick && swipeWidth < 0) && state.viewer.currentIndex !== items.length - 1) {
|
|
651
676
|
result = "next";
|
|
652
677
|
}
|
|
653
678
|
callbacks.onSwipeEnd(result);
|
|
@@ -738,6 +763,10 @@
|
|
|
738
763
|
}
|
|
739
764
|
function detach() {
|
|
740
765
|
clearInterval(interval);
|
|
766
|
+
if (pinchMoveFrame !== null) {
|
|
767
|
+
cancelAnimationFrame(pinchMoveFrame);
|
|
768
|
+
pinchMoveFrame = null;
|
|
769
|
+
}
|
|
741
770
|
}
|
|
742
771
|
return { attach, detach };
|
|
743
772
|
}
|
|
@@ -1075,8 +1104,11 @@
|
|
|
1075
1104
|
return document.documentElement.clientWidth;
|
|
1076
1105
|
}
|
|
1077
1106
|
function getWindowHeight() {
|
|
1078
|
-
|
|
1079
|
-
|
|
1107
|
+
const visualViewport = window.visualViewport;
|
|
1108
|
+
if (visualViewport) {
|
|
1109
|
+
return visualViewport.height * visualViewport.scale;
|
|
1110
|
+
}
|
|
1111
|
+
return document.documentElement.clientHeight;
|
|
1080
1112
|
}
|
|
1081
1113
|
function isElementArray(source) {
|
|
1082
1114
|
return source.length > 0 && source[0] instanceof Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* SmartPhoto v2.1.
|
|
2
|
+
* SmartPhoto v2.1.4
|
|
3
3
|
* (c) appleple
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
"use strict";(()=>{var j=()=>{let t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0};function fe(t,...e){var i;t=t||{};for(let o=0;o<e.length;o++){let r=e[o];if(r){for(let s in r)if(Object.hasOwn(r,s)){let n=r[s];n&&typeof n=="object"?t[s]=fe((i=t[s])!=null?i:{},n):t[s]=n}}}return t}var ve=fe,ne=(t,e,i)=>{let o;window.CustomEvent?o=new CustomEvent(e,{cancelable:!0}):(o=document.createEvent("CustomEvent"),o.initCustomEvent(e,!1,!1,i)),t.dispatchEvent(o)},we=t=>{let e={};for(let i of t.split("&")){let o=i.split("="),r=o[0],s=o.length>1?o.slice(1).join("="):r;e[r]=decodeURIComponent(s)}return e},ge=t=>({left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top});var Xe={classNames:{smartPhoto:"smartphoto",smartPhotoClose:"smartphoto-close",smartPhotoBody:"smartphoto-body",smartPhotoInner:"smartphoto-inner",smartPhotoContent:"smartphoto-content",smartPhotoImg:"smartphoto-img",smartPhotoImgOnMove:"smartphoto-img-onmove",smartPhotoImgElasticMove:"smartphoto-img-elasticmove",smartPhotoImgWrap:"smartphoto-img-wrap",smartPhotoArrows:"smartphoto-arrows",smartPhotoNav:"smartphoto-nav",smartPhotoArrowRight:"smartphoto-arrow-right",smartPhotoArrowLeft:"smartphoto-arrow-left",smartPhotoArrowHideIcon:"smartphoto-arrow-hide",smartPhotoImgLeft:"smartphoto-img-left",smartPhotoImgRight:"smartphoto-img-right",smartPhotoList:"smartphoto-list",smartPhotoListOnMove:"smartphoto-list-onmove",smartPhotoHeader:"smartphoto-header",smartPhotoCount:"smartphoto-count",smartPhotoCaption:"smartphoto-caption",smartPhotoDismiss:"smartphoto-dismiss",smartPhotoLoader:"smartphoto-loader",smartPhotoLoaderWrap:"smartphoto-loader-wrap",smartPhotoImgClone:"smartphoto-img-clone"},message:{gotoNextImage:"go to the next image",gotoPrevImage:"go to the previous image",closeDialog:"close the image dialog",carouselLabel:"Images"},arrows:!0,nav:!0,showAnimation:!0,verticalGravity:!1,useOrientationApi:!1,useHistoryApi:!0,swipeTopToClose:!1,swipeBottomToClose:!0,swipeOffset:100,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,loadOffset:2,resizeStyle:"fit",lazyAttribute:"data-src",animationSpeed:300};function Ee(t){return Object.keys(t).forEach(e=>{let i=t[e];i&&typeof i=="object"&&!Object.isFrozen(i)&&Ee(i)}),Object.freeze(t)}function Pe(t){return{options:Ee(ve({},Xe,t)),viewer:{isOpen:!1,currentGroup:null,currentIndex:0,oldIndex:0,total:0,translateX:0,translateY:0,photoPosX:0,photoPosY:0,scaleSize:1,scale:!1,elastic:!1,hideUi:!1,onMove:!1,appear:!1,appearEffect:null,prev:-1,next:-1,showPrevArrow:!1,showNextArrow:!1},groups:new Map}}function ae(t){return t.getAttribute("data-group")||"nogroup"}function le(t){return t.group||"nogroup"}function be(t,e,i,o){let r=ae(t),s=t.getAttribute("href"),n=t.querySelector("img"),c=s;n&&(n.getAttribute(e.lazyAttribute)?c=n.getAttribute(e.lazyAttribute):n.currentSrc?c=n.currentSrc:c=n.src);let p="";n!=null&&n.getAttribute("alt")?p=n.getAttribute("alt"):t.getAttribute("data-caption")?p=t.getAttribute("data-caption"):p=s!=null?s:"";let E=t.getAttribute("data-id");return{src:s,thumb:c,caption:t.getAttribute("data-caption"),alt:p,groupId:r,translateX:o*i,translateY:0,index:i,width:50,height:50,scale:1,x:0,y:0,id:E||i,loaded:!1,processed:!1,element:t}}function ye(t,e,i){var E,v,x,b,I;let o=le(t),r=t.src,s=(E=t.thumb)!=null?E:r,n=(v=t.caption)!=null?v:null,c=(b=(x=t.alt)!=null?x:n)!=null?b:r,p=typeof t.width=="number"&&typeof t.height=="number";return{src:r,thumb:s,caption:n,alt:c,groupId:o,translateX:i*e,translateY:0,index:e,width:p?t.width:50,height:p?t.height:50,scale:1,x:0,y:0,id:(I=t.id)!=null?I:e,loaded:p,processed:!1,element:null}}function he(t,e){t.groups.has(e.groupId)||t.groups.set(e.groupId,[]),t.groups.get(e.groupId).push(e),t.viewer.currentGroup=e.groupId}function H(t){var e;return t.viewer.currentGroup===null?null:(e=t.groups.get(t.viewer.currentGroup))!=null?e:null}function M(t){var i;let e=H(t);return e&&(i=e[t.viewer.currentIndex])!=null?i:null}function ue(t){let e=H(t);if(!e)return;let i=e.length,o=t.viewer.currentIndex+1,r=t.viewer.currentIndex-1;t.viewer.showNextArrow=!1,t.viewer.showPrevArrow=!1,o!==i&&(t.viewer.next=o,t.viewer.showNextArrow=!0),r!==-1&&(t.viewer.prev=r,t.viewer.showPrevArrow=!0)}function Se(t,e){t.forEach((i,o)=>{i.translateX=e*o})}function Q(t,e){let i=10**e;return Math.round(t*i)/i}function W(t,e,i,o){return o?t.width>t.height?i/(t.height*t.scale):e/(t.width*t.scale):1/t.scale}function xe(t,e,i,o){let r=t.width*t.scale*e.scaleSize,s=t.height*t.scale*e.scaleSize,n,c,p,E;return i>r?(p=(i-r)/2,n=-1*p):(p=(r-i)/2,n=-1*p),o>s?(E=(o-s)/2,c=-1*E):(E=(s-o)/2,c=-1*E),{minX:Q(n,6)*e.scaleSize,minY:Q(c,6)*e.scaleSize,maxX:Q(p,6)*e.scaleSize,maxY:Q(E,6)*e.scaleSize}}function Ie(t,e,i,o,r){let s=i-(o+r);t.forEach(n=>{n.loaded&&(n.processed=!0,n.scale=s/n.height,n.height<s&&(n.scale=1),n.x=(n.scale-1)/2*n.width+(e-n.width*n.scale)/2,n.y=(n.scale-1)/2*n.height+(i-n.height*n.scale)/2,n.width*n.scale>e&&(n.scale=e/n.width,n.x=(n.scale-1)/2*n.width))})}function Le(t){let e=M(t);return e?`group=${t.viewer.currentGroup}&photo=${e.id}`:""}function Ce(t,e){let i=null;return t.groups.forEach(o=>{o.forEach(r=>{e.group===r.groupId&&e.photo===r.id&&(i=r)})}),i}function de(t,e){let i=10**e;return Math.round(t*i)/i}function $(t){return{x:t.pageX,y:t.pageY}}function Te(t,e){let i=t.x-e.x,o=t.y-e.y;return Math.sqrt(i*i+o*o)}function Ye(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}function Ae(){return{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}}function He({state:t,callbacks:e},{signal:i}){let o=new Map,r=Date.now(),s=!1,n=!1,c=null,p=null,E=null,v=!1,x=null,b=null,I=0,z=0,y=!1,Y=0,L=0,C=0;function N(){return j()}function k(a){let{width:h,height:f}=Ae();return xe(a,t.viewer,h,f)}function u(a){let{width:h,height:f}=Ae();return W(a,h,f,N())}function J(a,h){let f=M(t),m=k(f);t.viewer.elastic=!0,a===1?t.viewer.photoPosX=m.minX:a===-1&&(t.viewer.photoPosX=m.maxX),h===1?t.viewer.photoPosY=m.minY:h===-1&&(t.viewer.photoPosY=m.maxY),e.onPhotoDragMove(),setTimeout(()=>{t.viewer.elastic=!1,e.onPhotoDragMove()},300)}let R=setInterval(()=>{if(y||s||v||t.viewer.elastic||!t.viewer.scale)return;t.viewer.photoPosX+=L,t.viewer.photoPosY+=C;let a=M(t);if(!a)return;let h=k(a);t.viewer.photoPosX<h.minX?(t.viewer.photoPosX=h.minX,L*=-.2):t.viewer.photoPosX>h.maxX&&(t.viewer.photoPosX=h.maxX,L*=-.2),t.viewer.photoPosY<h.minY?(t.viewer.photoPosY=h.minY,C*=-.2):t.viewer.photoPosY>h.maxY&&(t.viewer.photoPosY=h.maxY,C*=-.2);let f=Ye(L,C),m=f.force-t.options.registance;Math.abs(m)<.5||(L=Math.cos(f.theta)*m,C=Math.sin(f.theta)*m,e.onPhotoDragMove())},t.options.forceInterval);function G(a,h){(a>5||a<-5)&&(L+=a*.05),t.options.verticalGravity&&(h>5||h<-5)&&(C+=h*.05)}function K(a){if(!(a!=null&&a.gamma)||t.viewer.appearEffect||y||s||v||t.viewer.elastic||!t.viewer.scale)return;let{orientation:h}=window;h===0?G(a.gamma,a.beta):h===90?G(a.beta,a.gamma):h===-90?G(-a.beta,-a.gamma):h===180&&G(-a.gamma,-a.beta)}t.options.useOrientationApi&&window.addEventListener("deviceorientation",K,{signal:i});function B(){y=!0,s=!1,v=!1;let a=Array.from(o.values());Y=Te(a[0],a[1]),t.viewer.scale=!0,e.onGestureStart()}function U(a){let h=$(a);s=!0,n=!0,c=h,p=h}function _(a){v=!0;let h=$(a);b=h,x=h}function Z(a){var h,f;try{(f=(h=a.currentTarget).setPointerCapture)==null||f.call(h,a.pointerId)}catch(m){}if(o.set(a.pointerId,$(a)),o.size>1){B();return}if(t.viewer.scale){_(a);return}U(a)}function ee(){let a=Array.from(o.values()),h=Te(a[0],a[1]),f=(h-Y)/100,m=t.viewer.scaleSize,T=t.viewer.photoPosX,A=t.viewer.photoPosY;t.viewer.scaleSize+=de(f,6),t.viewer.scaleSize<.2&&(t.viewer.scaleSize=.2),t.viewer.scaleSize<m&&(t.viewer.photoPosX=(1+t.viewer.scaleSize-m)*T,t.viewer.photoPosY=(1+t.viewer.scaleSize-m)*A);let X=M(t);if(X){let re=u(X);t.viewer.hideUi=t.viewer.scaleSize<1||t.viewer.scaleSize>re}Y=h,e.onGestureMove()}function te(a){let h=$(a),f=h.x-p.x,m=h.y-c.y;n&&(e.onSwipeStart(),n=!1,E=Math.abs(f)>Math.abs(m)?"horizontal":"vertical"),E==="horizontal"?t.viewer.translateX+=f:t.viewer.translateY=m,p=h,e.onSwipeMove()}function ie(a){let h=$(a),f=h.x-b.x,m=h.y-b.y,T=de(t.viewer.scaleSize*f,6),A=de(t.viewer.scaleSize*m,6);t.viewer.photoPosX+=T,I=T,t.viewer.photoPosY+=A,z=A,b=h,e.onPhotoDragMove()}function oe(a){if(o.has(a.pointerId)){if(o.set(a.pointerId,$(a)),y){ee();return}if(v){ie(a);return}te(a)}}function d(){y=!1;let a=M(t);if(!a)return;let h=u(a);t.viewer.scaleSize>h||(t.viewer.photoPosX=0,t.viewer.photoPosY=0,t.viewer.scale=!1,t.viewer.scaleSize=1,t.viewer.hideUi=!1,e.onGestureEnd())}function l(){var pe;s=!1;let a=c,h=p,f=Date.now(),m=r-f,T=h.x-a.x,A=h.y-a.y,X=T===0&&A===0;if(!N()&&X){e.onTap();return}if(Math.abs(m)<=500&&X){e.onTap();return}r=f;let re=(pe=H(t))!=null?pe:[];if(E==="horizontal"){let V="stay";T>=t.options.swipeOffset&&t.viewer.currentIndex!==0?V="prev":T<=-t.options.swipeOffset&&t.viewer.currentIndex!==re.length-1&&(V="next"),e.onSwipeEnd(V)}else{let V="stay";t.options.swipeBottomToClose&&A>=t.options.swipeOffset?V="close-bottom":t.options.swipeTopToClose&&A<=-t.options.swipeOffset&&(V="close-top"),e.onSwipeEnd(V)}}function P(){v=!1;let a=b,h=x;if(a.x===h.x){e.onPhotoDragEnd("zoom-out");return}let f=M(t);if(!f){e.onPhotoDragEnd(null);return}let m=k(f),T=t.options.swipeOffset*t.viewer.scaleSize,A=0,X=0;if(t.viewer.photoPosX>m.maxX?A=-1:t.viewer.photoPosX<m.minX&&(A=1),t.viewer.photoPosY>m.maxY?X=-1:t.viewer.photoPosY<m.minY&&(X=1),t.viewer.photoPosX-m.maxX>T&&t.viewer.currentIndex!==0){e.onPhotoDragEnd("prev");return}if(m.minX-t.viewer.photoPosX>T&&t.viewer.currentIndex+1!==t.viewer.total){e.onPhotoDragEnd("next");return}A===0&&X===0?(L=I/5,C=z/5):J(A,X),e.onPhotoDragEnd(null)}function g(a){if(o.delete(a.pointerId),y){o.size<2&&d();return}if(v){P();return}s&&l()}function w(...a){for(let h of a)h.addEventListener("pointerdown",Z,{signal:i}),h.addEventListener("pointermove",oe,{signal:i}),h.addEventListener("pointerup",g,{signal:i}),h.addEventListener("pointercancel",g,{signal:i})}function S(){clearInterval(R)}return{attach:w,detach:S}}function q(t){let e=document.createElement("span");return e.className="smartphoto-sr-only",e.textContent=t,e}function ce(){let t=document.createElement("button");return t.type="button",t}function Ne(t){return t.replace(/"/g,'\\"')}function Me({id:t,options:e},i,{signal:o}){let{classNames:r,message:s}=e,n=document.createElement("div");n.setAttribute("data-id",t);let c=document.createElement("dialog");c.className=r.smartPhoto,c.setAttribute("aria-labelledby",`smartphoto-${t}-title`),c.style.setProperty("--smartphoto-animation-speed",`${e.animationSpeed}ms`);let p=document.createElement("div");p.className=r.smartPhotoBody;let E=document.createElement("div");E.className=r.smartPhotoInner;let v=document.createElement("div");v.className=r.smartPhotoHeader;let x=document.createElement("span");x.className=r.smartPhotoCount;let b=document.createElement("h1");b.id=`smartphoto-${t}-title`,b.className=r.smartPhotoCaption,b.setAttribute("tabindex","-1");let I=document.createElement("button");I.className=r.smartPhotoDismiss,I.appendChild(q(s.closeDialog)),I.addEventListener("click",()=>i.onDismiss(),{signal:o}),v.append(x,b,I);let z=document.createElement("div");z.className=r.smartPhotoContent,z.addEventListener("click",d=>{d.target===z&&i.onBackdropClick()},{signal:o});let y=document.createElement("ul");y.className=r.smartPhotoList,y.setAttribute("role","region"),y.setAttribute("aria-roledescription","carousel"),y.setAttribute("aria-label",s.carouselLabel),y.setAttribute("aria-live","polite"),y.setAttribute("aria-atomic","false"),E.append(v,z,y);let Y=null,L=null,C=null;if(e.arrows){Y=document.createElement("ul"),Y.className=r.smartPhotoArrows,L=document.createElement("li"),L.className=r.smartPhotoArrowLeft;let d=ce();d.appendChild(q(s.gotoPrevImage)),d.addEventListener("click",()=>i.onPrev(),{signal:o}),L.appendChild(d),C=document.createElement("li"),C.className=r.smartPhotoArrowRight;let l=ce();l.appendChild(q(s.gotoNextImage)),l.addEventListener("click",()=>i.onNext(),{signal:o}),C.appendChild(l),Y.append(L,C),E.appendChild(Y)}let N=null,k=null;e.nav&&(N=document.createElement("nav"),N.className=r.smartPhotoNav,N.setAttribute("aria-label","Choose slide to display"),k=document.createElement("ul"),N.appendChild(k),E.appendChild(N)),p.appendChild(E),c.appendChild(p),n.appendChild(c);let u={dialog:c,count:x,caption:b,dismiss:I,content:z,list:y,arrows:Y,arrowLeft:L,arrowRight:C,nav:N,navList:k,slides:new Map,imgClone:null};function J(){let d=document.createElement("div");d.className=r.smartPhotoLoaderWrap;let l=document.createElement("span");return l.className=r.smartPhotoLoader,d.appendChild(l),d}function R(d){var g,w;let l=document.createElement("div");l.className=r.smartPhotoImgWrap;let P=document.createElement("img");return P.className=r.smartPhotoImg,P.src=(g=d.src)!=null?g:"",P.alt=(w=d.alt)!=null?w:"",P.addEventListener("dragstart",S=>S.preventDefault(),{signal:o}),l.appendChild(P),{imgWrap:l,img:P}}function G(d,l){var P;u.list.replaceChildren(),(P=u.navList)==null||P.replaceChildren(),u.slides=new Map,d.forEach(g=>{var a,h;let w=document.createElement("li");w.setAttribute("role","group"),w.setAttribute("aria-roledescription","slide"),w.setAttribute("aria-label",`${g.index+1} of ${d.length}`);let S={li:w,loaderWrap:null,imgWrap:null,img:null,navLink:null};if(g.processed){let{imgWrap:f,img:m}=R(g);w.appendChild(f),S.imgWrap=f,S.img=m}else{let f=J();w.appendChild(f),S.loaderWrap=f}if(u.list.appendChild(w),u.slides.set(g,S),u.navList){let f=document.createElement("li"),m=ce();m.style.backgroundImage=`url("${Ne((a=g.thumb)!=null?a:"")}")`;let T=g.index;m.addEventListener("click",()=>i.onNavigate(T),{signal:o}),m.appendChild(q(`go to ${(h=g.caption)!=null?h:""}`)),f.appendChild(m),u.navList.appendChild(f),S.navLink=m}}),U(l)}function K(d,l){var w;if(l.imgWrap||!d.processed)return l;let{imgWrap:P,img:g}=R(d);return(w=l.loaderWrap)==null||w.replaceWith(P),l.loaderWrap=null,l.imgWrap=P,l.img=g,l}function B(d){d&&document.activeElement&&d.contains(document.activeElement)&&u.caption.focus()}function U(d){let{viewer:l}=d;u.count.textContent=`${l.currentIndex+1}/${l.total}`,u.slides.forEach((P,g)=>{var a;let w=K(g,P),S=g.index===l.currentIndex;w.li.style.transform=`translate(${g.translateX}px,${g.translateY}px)`,w.li.classList.toggle("current",S),S?w.li.removeAttribute("aria-hidden"):w.li.setAttribute("aria-hidden","true"),S&&(u.caption.textContent=(a=g.caption)!=null?a:""),w.imgWrap&&w.img&&(w.imgWrap.style.transform=`translate(${g.x}px,${g.y}px) scale(${g.scale})`,w.img.style.width=`${g.width}px`,w.img.classList.toggle("active",l.appear),w.img.classList.toggle(r.smartPhotoImgOnMove,l.scale),w.img.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),w.navLink&&(w.navLink.classList.toggle("current",S),S?w.navLink.setAttribute("aria-current","true"):w.navLink.removeAttribute("aria-current"))}),u.arrowLeft&&(l.showPrevArrow?u.arrowLeft.removeAttribute("aria-hidden"):(B(u.arrowLeft),u.arrowLeft.setAttribute("aria-hidden","true"))),u.arrowRight&&(l.showNextArrow?u.arrowRight.removeAttribute("aria-hidden"):(B(u.arrowRight),u.arrowRight.setAttribute("aria-hidden","true"))),u.arrows&&(l.hideUi&&B(u.arrows),u.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false")),u.nav&&(l.hideUi&&B(u.nav),u.nav.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function _(d){for(let[l,P]of u.slides)if(l.index===d.viewer.currentIndex)return P;return null}function Z(d){let{viewer:l}=d,P=_(d),g=P==null?void 0:P.img;g&&(g.style.transform=`translate(${l.photoPosX}px,${l.photoPosY}px) scale(${l.scaleSize})`,g.classList.toggle(r.smartPhotoImgOnMove,l.scale),g.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),u.nav&&(l.hideUi&&B(u.nav),u.nav.setAttribute("aria-hidden",l.hideUi?"true":"false")),u.arrows&&(l.hideUi&&B(u.arrows),u.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function ee(d){let{viewer:l}=d;u.list.style.transform=`translate(${l.translateX}px,${l.translateY}px)`,u.list.classList.toggle(r.smartPhotoListOnMove,l.onMove)}function te(d){let l=document.createElement("img");l.className=r.smartPhotoImgClone,l.src=d.img,l.style.width=`${d.width}px`,l.style.height=`${d.height}px`,l.style.transform=`translate(${d.left}px,${d.top}px) scale(1)`,p.appendChild(l),u.imgClone=l}function ie(){var d;(d=u.imgClone)==null||d.remove(),u.imgClone=null}function oe(){n.remove()}return{root:n,refs:u,render:U,syncSlides:G,updatePhotoTransform:Z,updateListTransform:ee,showAppearEffect:te,removeAppearEffect:ie,destroy:oe}}function O(){return document.documentElement.clientWidth}function D(){var t,e;return(e=(t=window.visualViewport)==null?void 0:t.height)!=null?e:document.documentElement.clientHeight}function Be(t){return t.length>0&&t[0]instanceof Element}function De(){return(Date.now().toString(36)+Math.random().toString(36).substring(2,7)).toUpperCase()}function ze(){return{x:window.pageXOffset!==void 0?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:document.documentElement.scrollTop}}var F=class{constructor(e,i){this.id=De();this.abortController=new AbortController;this.isSmartPhoneFlag=j();this.lastTriggerElement=null;this.isFiringPublicCloseEvent=!1;this.finishHideEffect=null;this.timeouts=[];this.loadAllFired=new Set;this.syncedGroupId=null;this.updateViewportHeight=()=>{this.view.refs.dialog.style.setProperty("--smartphoto-vh",`${D()}px`)};this.handleResize=()=>{H(this.state)&&(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.commit())};this.handleKeydown=e=>{if(!this.state.viewer.isOpen)return;let i=e.keyCode||e.which;i===37?this.gotoSlide(this.state.viewer.prev):i===39?this.gotoSlide(this.state.viewer.next):i===27&&this.hidePhoto()};this.handleOrientationChange=()=>{if(!H(this.state))return;this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit();let e=O(),i=500,o=r=>{this.scheduleTimeout(()=>{e!==O()?(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit()):r<=i&&o(r+25)},25)};o(0)};this.state=Pe(i!=null?i:{}),this.view=Me({id:this.id,options:this.state.options},this.buildViewHandlers(),{signal:this.abortController.signal}),document.body.appendChild(this.view.root),this.gestures=He({state:this.state,callbacks:this.buildGestureCallbacks()},{signal:this.abortController.signal}),this.gestures.attach(this.view.refs.content,this.view.refs.list),this.view.refs.dialog.addEventListener("close",()=>{!this.isFiringPublicCloseEvent&&this.state.viewer.isOpen&&this.hidePhoto()},{signal:this.abortController.signal}),this.ingestSource(e),this.syncCurrentGroupView();let o=this.restoreFromHash();if(o&&(o.element?ne(o.element,"click"):this.openPhoto(o,null)),this.updateViewportHeight(),window.visualViewport?window.visualViewport.addEventListener("resize",this.updateViewportHeight,{signal:this.abortController.signal}):window.addEventListener("resize",this.updateViewportHeight,{signal:this.abortController.signal}),!this.isSmartPhoneFlag){window.addEventListener("resize",this.handleResize,{signal:this.abortController.signal}),window.addEventListener("keydown",this.handleKeydown,{signal:this.abortController.signal});return}window.addEventListener("orientationchange",this.handleOrientationChange,{signal:this.abortController.signal})}on(e,i){let o=this.view.refs.dialog,r=s=>i.call(o,s);o.addEventListener(e,r,{signal:this.abortController.signal})}destroy(){this.state.viewer.isOpen=!1,this.view.refs.dialog.open&&this.view.refs.dialog.close(),this.abortController.abort(),this.timeouts.forEach(e=>{clearTimeout(e)}),this.timeouts=[],this.gestures.detach(),this.view.destroy()}[Symbol.dispose](){this.destroy()}gotoSlide(e){this.state.viewer.currentIndex=Number.parseInt(String(e),10),this.state.viewer.currentIndex||(this.state.viewer.currentIndex=0),this.slideList()}hidePhoto(e="bottom"){var o;if(!this.state.viewer.isOpen)return;this.state.viewer.isOpen=!1,this.state.viewer.appear=!1,this.state.viewer.appearEffect=null,this.view.removeAppearEffect(),this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.scaleSize=1;let i=ze();location.hash&&this.setHash(""),window.scroll(i.x,i.y),this.syncDialog(),(o=this.lastTriggerElement)!=null&&o.isConnected&&this.lastTriggerElement.focus(),this.lastTriggerElement=null,this.doHideEffect(e).then(()=>{this.view.render(this.state),this.isFiringPublicCloseEvent=!0,this.fireEvent("close"),this.isFiringPublicCloseEvent=!1})}zoomPhoto(){let e=M(this.state);e&&(this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=W(e,O(),D(),this.isSmartPhoneFlag),!(this.state.viewer.scaleSize<=1)&&(this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.view.updatePhotoTransform(this.state),this.scheduleTimeout(()=>{this.state.viewer.scale=!0,this.view.updatePhotoTransform(this.state),this.fireEvent("zoomin")},300)))}zoomOutPhoto(){this.state.viewer.scaleSize=1,this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.view.updatePhotoTransform(this.state),this.fireEvent("zoomout")}addNewItem(e){return this.addItem(e)}show(e=0,i={}){var p,E,v;let o=(p=i.group)!=null?p:this.state.viewer.currentGroup;if(o===null)return;let r=this.state.groups.get(o);if(!(r!=null&&r.length))return;let s=typeof e=="number"?r[e]:r.find(x=>x.id===e);if(!s)return;let n=document.activeElement instanceof HTMLElement?document.activeElement:null,c=(v=(E=i.trigger)!=null?E:s.element)!=null?v:n;this.openPhoto(s,c)}hide(){this.hidePhoto()}next(){this.state.viewer.showNextArrow&&this.gotoSlide(this.state.viewer.next)}prev(){this.state.viewer.showPrevArrow&&this.gotoSlide(this.state.viewer.prev)}addItem(e){let i=e instanceof Element?this.addElementItem(e):this.addSlideItem(e);return this.syncCurrentGroupView(),i}get currentIndex(){return this.state.viewer.currentIndex}ingestSource(e){if(Array.isArray(e)&&!Be(e)){e.forEach(o=>{this.addSlideItem(o)});return}Array.from(typeof e=="string"?document.querySelectorAll(e):e).forEach(o=>{this.addElementItem(o)})}addElementItem(e){var s,n;let i=ae(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=be(e,this.state.options,o,O());return he(this.state,r),this.loadAllFired.delete(i),this.bindThumbnailClick(e,r),r}addSlideItem(e){var s,n;let i=le(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=ye(e,o,O());return he(this.state,r),this.loadAllFired.delete(i),r}bindThumbnailClick(e,i){e.addEventListener("click",o=>{o.preventDefault(),this.openPhoto(i,e)},{signal:this.abortController.signal})}syncCurrentGroupView(){let e=H(this.state);e&&(this.view.syncSlides(e,this.state),this.syncedGroupId=this.state.viewer.currentGroup)}setHash(e){var o;if(!((o=window.history)!=null&&o.pushState)||!this.state.options.useHistoryApi)return;let i=`${location.pathname}${location.search}`;window.history.replaceState(null,"",e?`${i}#${e}`:i)}setHashByCurrentIndex(){let e=ze();this.setHash(Le(this.state)),window.scroll(e.x,e.y)}restoreFromHash(){let e=location.hash.substring(1);return e?Ce(this.state,we(e)):null}setPosByCurrentIndex(){let e=M(this.state);e&&(this.state.viewer.translateX=-e.translateX,this.state.viewer.translateY=0,this.view.updateListTransform(this.state))}setSizeByScreen(){let e=H(this.state);e&&Ie(e,O(),D(),this.state.options.headerHeight,this.state.options.footerHeight)}resetTranslateCurrent(){Se(H(this.state),O())}currentImgElement(){for(let[e,i]of this.view.refs.slides)if(e.index===this.state.viewer.currentIndex)return i.img;return null}syncDialog(){let{dialog:e,caption:i}=this.view.refs;this.state.viewer.isOpen&&!e.open?(e.showModal(),i.focus()):!this.state.viewer.isOpen&&e.open&&e.close()}commit(){this.view.render(this.state),this.syncDialog()}initPhoto(){var i;(i=this.finishHideEffect)==null||i.call(this),this.view.refs.dialog.style.opacity="";let e=H(this.state);if(this.state.viewer.total=e.length,this.state.viewer.isOpen=!0,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.setPosByCurrentIndex(),this.setSizeByScreen(),ue(this.state),this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag){let o=M(this.state);this.state.viewer.scale=!0,this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=W(o,O(),D(),this.isSmartPhoneFlag)}}supportsViewTransition(){return typeof document.startViewTransition=="function"}openPhotoWithViewTransition(e){var n,c;document.documentElement.style.setProperty("--smartphoto-animation-speed",`${this.state.options.animationSpeed}ms`);let i="smartphoto-hero",o=(n=e==null?void 0:e.querySelector("img"))!=null?n:null;o&&(o.style.viewTransitionName=i);let r=()=>{o&&(o.style.viewTransitionName="");let p=this.currentImgElement();p&&(p.style.viewTransitionName="")},s=(c=document.startViewTransition)==null?void 0:c.call(document,()=>{this.initPhoto(),this.state.viewer.appear=!0,this.commit(),o&&(o.style.viewTransitionName=""),this.currentImgElement().style.viewTransitionName=i});s==null||s.ready.catch(()=>{r()}),s==null||s.finished.then(r,r)}addAppearEffect(e,i){var z;let o=(z=e==null?void 0:e.querySelector("img"))!=null?z:null;if(!o){this.state.viewer.appear=!0;return}let r=ge(o),s=o.offsetWidth,n=o.offsetHeight,c=O(),p=D(),E=p-this.state.options.headerHeight-this.state.options.footerHeight,v=1;this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag?s>n?v=p/n:v=c/s:(s>=n?i.height<E?v=i.width/s:v=E/n:i.height<E?v=i.height/n:v=E/n,s*v>c&&(v=c/s));let x=(v-1)/2*s+(c-s*v)/2,b=(v-1)/2*n+(p-n*v)/2,I=o.getAttribute(this.state.options.lazyAttribute);this.state.viewer.appearEffect={width:s,height:n,top:r.top,left:r.left,once:!0,img:I||i.src||"",afterX:x,afterY:b,scale:v}}runAppearEffect(e){this.view.showAppearEffect(e);let i=this.view.refs.imgClone;return new Promise(o=>{let r=()=>{i.removeEventListener("transitionend",r,!0),o()};i.addEventListener("transitionend",r,!0),this.scheduleTimeout(()=>{i.style.transform=`translate(${e.afterX}px, ${e.afterY}px) scale(${e.scale})`},10)})}doOpen(e,i){if(this.state.options.showAnimation!==!1&&this.supportsViewTransition())this.openPhotoWithViewTransition(e);else if(this.state.options.showAnimation===!1)this.initPhoto(),this.state.viewer.appear=!0,this.commit();else{this.initPhoto(),this.addAppearEffect(e,i),this.commit();let o=this.state.viewer.appearEffect;o&&this.runAppearEffect(o).then(()=>{this.state.viewer.appearEffect=null,this.view.removeAppearEffect(),this.state.viewer.appear=!0,this.commit()})}this.fireEvent("open"),this.resyncSizeAfterOpen()}resyncSizeAfterOpen(){let e=O(),i=D();requestAnimationFrame(()=>{this.state.viewer.isOpen&&(O()===e&&D()===i||(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.view.render(this.state)))})}openPhoto(e,i){this.lastTriggerElement=i,this.state.viewer.currentGroup=e.groupId,this.state.viewer.currentIndex=e.index,this.syncedGroupId!==e.groupId&&this.syncCurrentGroupView(),this.setHashByCurrentIndex(),e.loaded?this.doOpen(i,e):this.loadItem(e).then(()=>{this.doOpen(i,e)})}doHideEffect(e){return new Promise(i=>{let o=this.view.refs.dialog,r=this.currentImgElement(),s=D(),n=e==="top"?`translateY(-${s}px)`:`translateY(${s}px)`,c=()=>{this.finishHideEffect===c&&(this.finishHideEffect=null,o.removeEventListener("transitionend",c,!0),r&&r.style.transform===n&&(r.style.transform=""),i())};this.finishHideEffect=c,r&&(r.style.transform=n),o.addEventListener("transitionend",c,!0),this.scheduleTimeout(c,this.state.options.animationSpeed+100)})}loadItem(e){return new Promise(i=>{var r;let o=new Image;o.onload=()=>{e.width=o.width,e.height=o.height,e.loaded=!0,this.checkLoadAll(e.groupId),i()},o.onerror=()=>i(),o.src=(r=e.src)!=null?r:""})}checkLoadAll(e){if(this.loadAllFired.has(e))return;let i=this.state.groups.get(e);i!=null&&i.length&&i.every(o=>o.loaded)&&(this.loadAllFired.add(e),this.fireEvent("loadall"))}loadNeighborItems(){let e=H(this.state);if(!e)return;let{currentIndex:i}=this.state.viewer,{loadOffset:o}=this.state.options,r=[];for(let s=i-o;s<i+o;s++){let n=e[s];n&&!n.loaded&&r.push(this.loadItem(n))}r.length&&Promise.all(r).then(()=>{this.initPhoto(),this.commit()})}slideList(){this.state.viewer.scaleSize=1,this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.state.viewer.onMove=!0,this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.scheduleTimeout(()=>{let e=M(this.state);this.state.viewer.onMove=!1,ue(this.state),this.commit(),this.state.viewer.oldIndex!==this.state.viewer.currentIndex&&this.fireEvent("change"),this.state.viewer.oldIndex=this.state.viewer.currentIndex,this.loadNeighborItems(),e&&!e.loaded&&this.loadItem(e).then(()=>{this.initPhoto(),this.commit()})},200)}scheduleTimeout(e,i){let o=window.setTimeout(()=>{this.timeouts=this.timeouts.filter(r=>r!==o),e()},i);return this.timeouts.push(o),o}fireEvent(e){ne(this.view.refs.dialog,e)}buildViewHandlers(){return{onDismiss:()=>this.hidePhoto(),onPrev:()=>this.prev(),onNext:()=>this.next(),onNavigate:e=>this.gotoSlide(e),onBackdropClick:()=>this.hidePhoto()}}buildGestureCallbacks(){return{onSwipeStart:()=>this.fireEvent("swipestart"),onSwipeMove:()=>this.view.updateListTransform(this.state),onSwipeEnd:e=>{if(this.fireEvent("swipeend"),e==="close-bottom"){this.hidePhoto("bottom");return}if(e==="close-top"){this.hidePhoto("top");return}e==="prev"?this.state.viewer.currentIndex-=1:e==="next"&&(this.state.viewer.currentIndex+=1),this.slideList()},onTap:()=>this.zoomPhoto(),onGestureStart:()=>{this.fireEvent("gesturestart"),this.view.updatePhotoTransform(this.state)},onGestureMove:()=>this.view.updatePhotoTransform(this.state),onGestureEnd:()=>{this.fireEvent("gestureend"),this.view.updatePhotoTransform(this.state)},onPhotoDragMove:()=>this.view.updatePhotoTransform(this.state),onPhotoDragEnd:e=>{if(e==="zoom-out"){this.zoomOutPhoto();return}if(e==="prev"){this.gotoSlide(this.state.viewer.prev);return}if(e==="next"){this.gotoSlide(this.state.viewer.next);return}this.view.updatePhotoTransform(this.state)}}}};var Oe=F;var me=t=>{t.fn.SmartPhoto=function(e){return typeof e=="string"||new Oe(this,e),this}};if(typeof define=="function"&&define.amd)define(["jquery"],me);else{let t=window,e=t.jQuery?t.jQuery:t.$;typeof e!="undefined"&&me(e)}var Je=me;})();
|
|
6
|
+
"use strict";(()=>{var K=()=>{let t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0};function Pe(t,...e){var i;t=t||{};for(let o=0;o<e.length;o++){let r=e[o];if(r){for(let s in r)if(Object.hasOwn(r,s)){let n=r[s];n&&typeof n=="object"?t[s]=Pe((i=t[s])!=null?i:{},n):t[s]=n}}}return t}var be=Pe,he=(t,e,i)=>{let o;window.CustomEvent?o=new CustomEvent(e,{cancelable:!0}):(o=document.createEvent("CustomEvent"),o.initCustomEvent(e,!1,!1,i)),t.dispatchEvent(o)},ye=t=>{let e={};for(let i of t.split("&")){let o=i.split("="),r=o[0],s=o.length>1?o.slice(1).join("="):r;e[r]=decodeURIComponent(s)}return e},Se=t=>({left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top});var Ge={classNames:{smartPhoto:"smartphoto",smartPhotoClose:"smartphoto-close",smartPhotoBody:"smartphoto-body",smartPhotoInner:"smartphoto-inner",smartPhotoContent:"smartphoto-content",smartPhotoImg:"smartphoto-img",smartPhotoImgOnMove:"smartphoto-img-onmove",smartPhotoImgElasticMove:"smartphoto-img-elasticmove",smartPhotoImgWrap:"smartphoto-img-wrap",smartPhotoArrows:"smartphoto-arrows",smartPhotoNav:"smartphoto-nav",smartPhotoArrowRight:"smartphoto-arrow-right",smartPhotoArrowLeft:"smartphoto-arrow-left",smartPhotoArrowHideIcon:"smartphoto-arrow-hide",smartPhotoImgLeft:"smartphoto-img-left",smartPhotoImgRight:"smartphoto-img-right",smartPhotoList:"smartphoto-list",smartPhotoListOnMove:"smartphoto-list-onmove",smartPhotoHeader:"smartphoto-header",smartPhotoCount:"smartphoto-count",smartPhotoCaption:"smartphoto-caption",smartPhotoDismiss:"smartphoto-dismiss",smartPhotoLoader:"smartphoto-loader",smartPhotoLoaderWrap:"smartphoto-loader-wrap",smartPhotoImgClone:"smartphoto-img-clone"},message:{gotoNextImage:"go to the next image",gotoPrevImage:"go to the previous image",closeDialog:"close the image dialog",carouselLabel:"Images"},arrows:!0,nav:!0,showAnimation:!0,verticalGravity:!1,useOrientationApi:!1,useHistoryApi:!0,swipeTopToClose:!1,swipeBottomToClose:!0,swipeOffset:100,swipeVelocity:.5,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,loadOffset:2,resizeStyle:"fit",lazyAttribute:"data-src",animationSpeed:300};function xe(t){return Object.keys(t).forEach(e=>{let i=t[e];i&&typeof i=="object"&&!Object.isFrozen(i)&&xe(i)}),Object.freeze(t)}function Ie(t){return{options:xe(be({},Ge,t)),viewer:{isOpen:!1,currentGroup:null,currentIndex:0,oldIndex:0,total:0,translateX:0,translateY:0,photoPosX:0,photoPosY:0,scaleSize:1,scale:!1,elastic:!1,hideUi:!1,onMove:!1,appear:!1,appearEffect:null,prev:-1,next:-1,showPrevArrow:!1,showNextArrow:!1},groups:new Map}}function de(t){return t.getAttribute("data-group")||"nogroup"}function ce(t){return t.group||"nogroup"}function Le(t,e,i,o){let r=de(t),s=t.getAttribute("href"),n=t.querySelector("img"),c=s;n&&(n.getAttribute(e.lazyAttribute)?c=n.getAttribute(e.lazyAttribute):n.currentSrc?c=n.currentSrc:c=n.src);let m="";n!=null&&n.getAttribute("alt")?m=n.getAttribute("alt"):t.getAttribute("data-caption")?m=t.getAttribute("data-caption"):m=s!=null?s:"";let v=t.getAttribute("data-id");return{src:s,thumb:c,caption:t.getAttribute("data-caption"),alt:m,groupId:r,translateX:o*i,translateY:0,index:i,width:50,height:50,scale:1,x:0,y:0,id:v||i,loaded:!1,processed:!1,element:t}}function Ce(t,e,i){var v,g,b,C,y;let o=ce(t),r=t.src,s=(v=t.thumb)!=null?v:r,n=(g=t.caption)!=null?g:null,c=(C=(b=t.alt)!=null?b:n)!=null?C:r,m=typeof t.width=="number"&&typeof t.height=="number";return{src:r,thumb:s,caption:n,alt:c,groupId:o,translateX:i*e,translateY:0,index:e,width:m?t.width:50,height:m?t.height:50,scale:1,x:0,y:0,id:(y=t.id)!=null?y:e,loaded:m,processed:!1,element:null}}function me(t,e){t.groups.has(e.groupId)||t.groups.set(e.groupId,[]),t.groups.get(e.groupId).push(e),t.viewer.currentGroup=e.groupId}function M(t){var e;return t.viewer.currentGroup===null?null:(e=t.groups.get(t.viewer.currentGroup))!=null?e:null}function H(t){var i;let e=M(t);return e&&(i=e[t.viewer.currentIndex])!=null?i:null}function pe(t){let e=M(t);if(!e)return;let i=e.length,o=t.viewer.currentIndex+1,r=t.viewer.currentIndex-1;t.viewer.showNextArrow=!1,t.viewer.showPrevArrow=!1,o!==i&&(t.viewer.next=o,t.viewer.showNextArrow=!0),r!==-1&&(t.viewer.prev=r,t.viewer.showPrevArrow=!0)}function Te(t,e){t.forEach((i,o)=>{i.translateX=e*o})}function _(t,e){let i=10**e;return Math.round(t*i)/i}function Q(t,e,i,o){return o?t.width>t.height?i/(t.height*t.scale):e/(t.width*t.scale):1/t.scale}function Ae(t,e,i,o){let r=t.width*t.scale*e.scaleSize,s=t.height*t.scale*e.scaleSize,n,c,m,v;return i>r?(m=(i-r)/2,n=-1*m):(m=(r-i)/2,n=-1*m),o>s?(v=(o-s)/2,c=-1*v):(v=(s-o)/2,c=-1*v),{minX:_(n,6)*e.scaleSize,minY:_(c,6)*e.scaleSize,maxX:_(m,6)*e.scaleSize,maxY:_(v,6)*e.scaleSize}}function Me(t,e,i,o,r){let s=i-(o+r);t.forEach(n=>{n.loaded&&(n.processed=!0,n.scale=s/n.height,n.height<s&&(n.scale=1),n.x=(n.scale-1)/2*n.width+(e-n.width*n.scale)/2,n.y=(n.scale-1)/2*n.height+(i-n.height*n.scale)/2,n.width*n.scale>e&&(n.scale=e/n.width,n.x=(n.scale-1)/2*n.width))})}function He(t){let e=H(t);return e?`group=${t.viewer.currentGroup}&photo=${e.id}`:""}function ze(t,e){let i=null;return t.groups.forEach(o=>{o.forEach(r=>{e.group===r.groupId&&e.photo===r.id&&(i=r)})}),i}function fe(t,e){let i=10**e;return Math.round(t*i)/i}function W(t){return{x:t.pageX,y:t.pageY}}function Oe(t,e){let i=t.x-e.x,o=t.y-e.y;return Math.sqrt(i*i+o*o)}var ke=10;function $e(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}function Xe(){return{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}}function Ne({state:t,callbacks:e},{signal:i}){let o=new Map,r=Date.now(),s=!1,n=!1,c=null,m=null,v=null,g=0,b=!1,C=null,y=null,z=0,O=0,A=!1,V=0,S=null,L=0,X=0;function u(){return K()}function R(a){let{width:h,height:E}=Xe();return Ae(a,t.viewer,h,E)}function U(a){let{width:h,height:E}=Xe();return Q(a,h,E,u())}function ee(a,h){let E=H(t),w=R(E);t.viewer.elastic=!0,a===1?t.viewer.photoPosX=w.minX:a===-1&&(t.viewer.photoPosX=w.maxX),h===1?t.viewer.photoPosY=w.minY:h===-1&&(t.viewer.photoPosY=w.maxY),e.onPhotoDragMove(),setTimeout(()=>{t.viewer.elastic=!1,e.onPhotoDragMove()},300)}let te=setInterval(()=>{if(A||s||b||t.viewer.elastic||!t.viewer.scale)return;t.viewer.photoPosX+=L,t.viewer.photoPosY+=X;let a=H(t);if(!a)return;let h=R(a);t.viewer.photoPosX<h.minX?(t.viewer.photoPosX=h.minX,L*=-.2):t.viewer.photoPosX>h.maxX&&(t.viewer.photoPosX=h.maxX,L*=-.2),t.viewer.photoPosY<h.minY?(t.viewer.photoPosY=h.minY,X*=-.2):t.viewer.photoPosY>h.maxY&&(t.viewer.photoPosY=h.maxY,X*=-.2);let E=$e(L,X),w=E.force-t.options.registance;Math.abs(w)<.5||(L=Math.cos(E.theta)*w,X=Math.sin(E.theta)*w,e.onPhotoDragMove())},t.options.forceInterval);function N(a,h){(a>5||a<-5)&&(L+=a*.05),t.options.verticalGravity&&(h>5||h<-5)&&(X+=h*.05)}function J(a){if(!(a!=null&&a.gamma)||t.viewer.appearEffect||A||s||b||t.viewer.elastic||!t.viewer.scale)return;let{orientation:h}=window;h===0?N(a.gamma,a.beta):h===90?N(a.beta,a.gamma):h===-90?N(-a.beta,-a.gamma):h===180&&N(-a.gamma,-a.beta)}t.options.useOrientationApi&&window.addEventListener("deviceorientation",J,{signal:i});function ie(){A=!0,s=!1,b=!1;let a=Array.from(o.values());V=Oe(a[0],a[1]),t.viewer.scale=!0,e.onGestureStart()}function oe(a){let h=W(a);s=!0,n=!0,c=h,m=h,g=Date.now()}function re(a){b=!0;let h=W(a);y=h,C=h}function ne(a){var h,E;try{(E=(h=a.currentTarget).setPointerCapture)==null||E.call(h,a.pointerId)}catch(w){}if(o.set(a.pointerId,W(a)),o.size>1){ie();return}if(t.viewer.scale){re(a);return}oe(a)}function se(){S===null&&(S=requestAnimationFrame(()=>{S=null,e.onGestureMove()}))}function ae(){S!==null&&(cancelAnimationFrame(S),S=null,e.onGestureMove())}function d(){let a=Array.from(o.values()),h=Oe(a[0],a[1]),E=(h-V)/100,w=t.viewer.scaleSize,I=t.viewer.photoPosX,T=t.viewer.photoPosY;t.viewer.scaleSize+=fe(E,6),t.viewer.scaleSize<.2&&(t.viewer.scaleSize=.2),t.viewer.scaleSize<w&&(t.viewer.photoPosX=(1+t.viewer.scaleSize-w)*I,t.viewer.photoPosY=(1+t.viewer.scaleSize-w)*T);let B=H(t);if(B){let le=U(B);t.viewer.hideUi=t.viewer.scaleSize<1||t.viewer.scaleSize>le}V=h,se()}function l(a){let h=W(a),E=h.x-m.x,w=h.y-c.y;n&&(e.onSwipeStart(),n=!1,v=Math.abs(E)>Math.abs(w)?"horizontal":"vertical"),v==="horizontal"?t.viewer.translateX+=E:t.viewer.translateY=w,m=h,e.onSwipeMove()}function P(a){let h=W(a),E=h.x-y.x,w=h.y-y.y,I=fe(t.viewer.scaleSize*E,6),T=fe(t.viewer.scaleSize*w,6);t.viewer.photoPosX+=I,z=I,t.viewer.photoPosY+=T,O=T,y=h,e.onPhotoDragMove()}function f(a){if(o.has(a.pointerId)){if(o.set(a.pointerId,W(a)),A){d();return}if(b){P(a);return}l(a)}}function p(){A=!1,ae();let a=H(t);if(!a)return;let h=U(a);t.viewer.scaleSize>h||(t.viewer.photoPosX=0,t.viewer.photoPosY=0,t.viewer.scale=!1,t.viewer.scaleSize=1,t.viewer.hideUi=!1,e.onGestureEnd())}function x(){var ge;s=!1;let a=c,h=m,E=Date.now(),w=r-E,I=h.x-a.x,T=h.y-a.y,B=I===0&&T===0;if(!u()&&B){e.onTap();return}if(Math.abs(w)<=500&&B){e.onTap();return}r=E;let le=(ge=M(t))!=null?ge:[];if(v==="horizontal"){let F="stay",Ve=Math.max(E-g,1),Ee=Math.abs(I)>=ke&&Math.abs(I)/Ve>=t.options.swipeVelocity;(I>=t.options.swipeOffset||Ee&&I>0)&&t.viewer.currentIndex!==0?F="prev":(I<=-t.options.swipeOffset||Ee&&I<0)&&t.viewer.currentIndex!==le.length-1&&(F="next"),e.onSwipeEnd(F)}else{let F="stay";t.options.swipeBottomToClose&&T>=t.options.swipeOffset?F="close-bottom":t.options.swipeTopToClose&&T<=-t.options.swipeOffset&&(F="close-top"),e.onSwipeEnd(F)}}function $(){b=!1;let a=y,h=C;if(a.x===h.x){e.onPhotoDragEnd("zoom-out");return}let E=H(t);if(!E){e.onPhotoDragEnd(null);return}let w=R(E),I=t.options.swipeOffset*t.viewer.scaleSize,T=0,B=0;if(t.viewer.photoPosX>w.maxX?T=-1:t.viewer.photoPosX<w.minX&&(T=1),t.viewer.photoPosY>w.maxY?B=-1:t.viewer.photoPosY<w.minY&&(B=1),t.viewer.photoPosX-w.maxX>I&&t.viewer.currentIndex!==0){e.onPhotoDragEnd("prev");return}if(w.minX-t.viewer.photoPosX>I&&t.viewer.currentIndex+1!==t.viewer.total){e.onPhotoDragEnd("next");return}T===0&&B===0?(L=z/5,X=O/5):ee(T,B),e.onPhotoDragEnd(null)}function j(a){if(o.delete(a.pointerId),A){o.size<2&&p();return}if(b){$();return}s&&x()}function D(...a){for(let h of a)h.addEventListener("pointerdown",ne,{signal:i}),h.addEventListener("pointermove",f,{signal:i}),h.addEventListener("pointerup",j,{signal:i}),h.addEventListener("pointercancel",j,{signal:i})}function G(){clearInterval(te),S!==null&&(cancelAnimationFrame(S),S=null)}return{attach:D,detach:G}}function Z(t){let e=document.createElement("span");return e.className="smartphoto-sr-only",e.textContent=t,e}function ve(){let t=document.createElement("button");return t.type="button",t}function Fe(t){return t.replace(/"/g,'\\"')}function Ye({id:t,options:e},i,{signal:o}){let{classNames:r,message:s}=e,n=document.createElement("div");n.setAttribute("data-id",t);let c=document.createElement("dialog");c.className=r.smartPhoto,c.setAttribute("aria-labelledby",`smartphoto-${t}-title`),c.style.setProperty("--smartphoto-animation-speed",`${e.animationSpeed}ms`);let m=document.createElement("div");m.className=r.smartPhotoBody;let v=document.createElement("div");v.className=r.smartPhotoInner;let g=document.createElement("div");g.className=r.smartPhotoHeader;let b=document.createElement("span");b.className=r.smartPhotoCount;let C=document.createElement("h1");C.id=`smartphoto-${t}-title`,C.className=r.smartPhotoCaption,C.setAttribute("tabindex","-1");let y=document.createElement("button");y.className=r.smartPhotoDismiss,y.appendChild(Z(s.closeDialog)),y.addEventListener("click",()=>i.onDismiss(),{signal:o}),g.append(b,C,y);let z=document.createElement("div");z.className=r.smartPhotoContent,z.addEventListener("click",d=>{d.target===z&&i.onBackdropClick()},{signal:o});let O=document.createElement("ul");O.className=r.smartPhotoList,O.setAttribute("role","region"),O.setAttribute("aria-roledescription","carousel"),O.setAttribute("aria-label",s.carouselLabel),O.setAttribute("aria-live","polite"),O.setAttribute("aria-atomic","false"),v.append(g,z,O);let A=null,V=null,S=null;if(e.arrows){A=document.createElement("ul"),A.className=r.smartPhotoArrows,V=document.createElement("li"),V.className=r.smartPhotoArrowLeft;let d=ve();d.appendChild(Z(s.gotoPrevImage)),d.addEventListener("click",()=>i.onPrev(),{signal:o}),V.appendChild(d),S=document.createElement("li"),S.className=r.smartPhotoArrowRight;let l=ve();l.appendChild(Z(s.gotoNextImage)),l.addEventListener("click",()=>i.onNext(),{signal:o}),S.appendChild(l),A.append(V,S),v.appendChild(A)}let L=null,X=null;e.nav&&(L=document.createElement("nav"),L.className=r.smartPhotoNav,L.setAttribute("aria-label","Choose slide to display"),X=document.createElement("ul"),L.appendChild(X),v.appendChild(L)),m.appendChild(v),c.appendChild(m),n.appendChild(c);let u={dialog:c,count:b,caption:C,dismiss:y,content:z,list:O,arrows:A,arrowLeft:V,arrowRight:S,nav:L,navList:X,slides:new Map,imgClone:null};function R(){let d=document.createElement("div");d.className=r.smartPhotoLoaderWrap;let l=document.createElement("span");return l.className=r.smartPhotoLoader,d.appendChild(l),d}function U(d){var f,p;let l=document.createElement("div");l.className=r.smartPhotoImgWrap;let P=document.createElement("img");return P.className=r.smartPhotoImg,P.src=(f=d.src)!=null?f:"",P.alt=(p=d.alt)!=null?p:"",P.addEventListener("dragstart",x=>x.preventDefault(),{signal:o}),l.appendChild(P),{imgWrap:l,img:P}}function ee(d,l){var P;u.list.replaceChildren(),(P=u.navList)==null||P.replaceChildren(),u.slides=new Map,d.forEach(f=>{var $,j;let p=document.createElement("li");p.setAttribute("role","group"),p.setAttribute("aria-roledescription","slide"),p.setAttribute("aria-label",`${f.index+1} of ${d.length}`);let x={li:p,loaderWrap:null,imgWrap:null,img:null,navLink:null};if(f.processed){let{imgWrap:D,img:G}=U(f);p.appendChild(D),x.imgWrap=D,x.img=G}else{let D=R();p.appendChild(D),x.loaderWrap=D}if(u.list.appendChild(p),u.slides.set(f,x),u.navList){let D=document.createElement("li"),G=ve();G.style.backgroundImage=`url("${Fe(($=f.thumb)!=null?$:"")}")`;let a=f.index;G.addEventListener("click",()=>i.onNavigate(a),{signal:o}),G.appendChild(Z(`go to ${(j=f.caption)!=null?j:""}`)),D.appendChild(G),u.navList.appendChild(D),x.navLink=G}}),J(l)}function te(d,l){var p;if(l.imgWrap||!d.processed)return l;let{imgWrap:P,img:f}=U(d);return(p=l.loaderWrap)==null||p.replaceWith(P),l.loaderWrap=null,l.imgWrap=P,l.img=f,l}function N(d){d&&document.activeElement&&d.contains(document.activeElement)&&u.caption.focus()}function J(d){let{viewer:l}=d;u.count.textContent=`${l.currentIndex+1}/${l.total}`,u.slides.forEach((P,f)=>{var $;let p=te(f,P),x=f.index===l.currentIndex;p.li.style.transform=`translate(${f.translateX}px,${f.translateY}px)`,p.li.classList.toggle("current",x),x?p.li.removeAttribute("aria-hidden"):p.li.setAttribute("aria-hidden","true"),x&&(u.caption.textContent=($=f.caption)!=null?$:""),p.imgWrap&&p.img&&(p.imgWrap.style.transform=`translate(${f.x}px,${f.y}px) scale(${f.scale})`,p.img.style.width=`${f.width}px`,p.img.classList.toggle("active",l.appear),p.img.classList.toggle(r.smartPhotoImgOnMove,l.scale),p.img.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),p.navLink&&(p.navLink.classList.toggle("current",x),x?p.navLink.setAttribute("aria-current","true"):p.navLink.removeAttribute("aria-current"))}),u.arrowLeft&&(l.showPrevArrow?u.arrowLeft.removeAttribute("aria-hidden"):(N(u.arrowLeft),u.arrowLeft.setAttribute("aria-hidden","true"))),u.arrowRight&&(l.showNextArrow?u.arrowRight.removeAttribute("aria-hidden"):(N(u.arrowRight),u.arrowRight.setAttribute("aria-hidden","true"))),u.arrows&&(l.hideUi&&N(u.arrows),u.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false")),u.nav&&(l.hideUi&&N(u.nav),u.nav.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function ie(d){for(let[l,P]of u.slides)if(l.index===d.viewer.currentIndex)return P;return null}function oe(d){let{viewer:l}=d,P=ie(d),f=P==null?void 0:P.img;f&&(f.style.transform=`translate(${l.photoPosX}px,${l.photoPosY}px) scale(${l.scaleSize})`,f.classList.toggle(r.smartPhotoImgOnMove,l.scale),f.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),u.nav&&(l.hideUi&&N(u.nav),u.nav.setAttribute("aria-hidden",l.hideUi?"true":"false")),u.arrows&&(l.hideUi&&N(u.arrows),u.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function re(d){let{viewer:l}=d;u.list.style.transform=`translate(${l.translateX}px,${l.translateY}px)`,u.list.classList.toggle(r.smartPhotoListOnMove,l.onMove)}function ne(d){let l=document.createElement("img");l.className=r.smartPhotoImgClone,l.src=d.img,l.style.width=`${d.width}px`,l.style.height=`${d.height}px`,l.style.transform=`translate(${d.left}px,${d.top}px) scale(1)`,m.appendChild(l),u.imgClone=l}function se(){var d;(d=u.imgClone)==null||d.remove(),u.imgClone=null}function ae(){n.remove()}return{root:n,refs:u,render:J,syncSlides:ee,updatePhotoTransform:oe,updateListTransform:re,showAppearEffect:ne,removeAppearEffect:se,destroy:ae}}function Y(){return document.documentElement.clientWidth}function k(){let t=window.visualViewport;return t?t.height*t.scale:document.documentElement.clientHeight}function We(t){return t.length>0&&t[0]instanceof Element}function Re(){return(Date.now().toString(36)+Math.random().toString(36).substring(2,7)).toUpperCase()}function De(){return{x:window.pageXOffset!==void 0?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:document.documentElement.scrollTop}}var q=class{constructor(e,i){this.id=Re();this.abortController=new AbortController;this.isSmartPhoneFlag=K();this.lastTriggerElement=null;this.isFiringPublicCloseEvent=!1;this.finishHideEffect=null;this.timeouts=[];this.loadAllFired=new Set;this.syncedGroupId=null;this.updateViewportHeight=()=>{this.view.refs.dialog.style.setProperty("--smartphoto-vh",`${k()}px`)};this.handleResize=()=>{M(this.state)&&(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.commit())};this.handleKeydown=e=>{if(!this.state.viewer.isOpen)return;let i=e.keyCode||e.which;i===37?this.gotoSlide(this.state.viewer.prev):i===39?this.gotoSlide(this.state.viewer.next):i===27&&this.hidePhoto()};this.handleOrientationChange=()=>{if(!M(this.state))return;this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit();let e=Y(),i=500,o=r=>{this.scheduleTimeout(()=>{e!==Y()?(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit()):r<=i&&o(r+25)},25)};o(0)};this.state=Ie(i!=null?i:{}),this.view=Ye({id:this.id,options:this.state.options},this.buildViewHandlers(),{signal:this.abortController.signal}),document.body.appendChild(this.view.root),this.gestures=Ne({state:this.state,callbacks:this.buildGestureCallbacks()},{signal:this.abortController.signal}),this.gestures.attach(this.view.refs.content,this.view.refs.list),this.view.refs.dialog.addEventListener("close",()=>{!this.isFiringPublicCloseEvent&&this.state.viewer.isOpen&&this.hidePhoto()},{signal:this.abortController.signal}),this.ingestSource(e),this.syncCurrentGroupView();let o=this.restoreFromHash();if(o&&(o.element?he(o.element,"click"):this.openPhoto(o,null)),this.updateViewportHeight(),window.visualViewport?window.visualViewport.addEventListener("resize",this.updateViewportHeight,{signal:this.abortController.signal}):window.addEventListener("resize",this.updateViewportHeight,{signal:this.abortController.signal}),!this.isSmartPhoneFlag){window.addEventListener("resize",this.handleResize,{signal:this.abortController.signal}),window.addEventListener("keydown",this.handleKeydown,{signal:this.abortController.signal});return}window.addEventListener("orientationchange",this.handleOrientationChange,{signal:this.abortController.signal})}on(e,i){let o=this.view.refs.dialog,r=s=>i.call(o,s);o.addEventListener(e,r,{signal:this.abortController.signal})}destroy(){this.state.viewer.isOpen=!1,this.view.refs.dialog.open&&this.view.refs.dialog.close(),this.abortController.abort(),this.timeouts.forEach(e=>{clearTimeout(e)}),this.timeouts=[],this.gestures.detach(),this.view.destroy()}[Symbol.dispose](){this.destroy()}gotoSlide(e){this.state.viewer.currentIndex=Number.parseInt(String(e),10),this.state.viewer.currentIndex||(this.state.viewer.currentIndex=0),this.slideList()}hidePhoto(e="bottom"){var o;if(!this.state.viewer.isOpen)return;this.state.viewer.isOpen=!1,this.state.viewer.appear=!1,this.state.viewer.appearEffect=null,this.view.removeAppearEffect(),this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.scaleSize=1;let i=De();location.hash&&this.setHash(""),window.scroll(i.x,i.y),this.syncDialog(),(o=this.lastTriggerElement)!=null&&o.isConnected&&this.lastTriggerElement.focus(),this.lastTriggerElement=null,this.doHideEffect(e).then(()=>{this.view.render(this.state),this.isFiringPublicCloseEvent=!0,this.fireEvent("close"),this.isFiringPublicCloseEvent=!1})}zoomPhoto(){let e=H(this.state);e&&(this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=Q(e,Y(),k(),this.isSmartPhoneFlag),!(this.state.viewer.scaleSize<=1)&&(this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.view.updatePhotoTransform(this.state),this.scheduleTimeout(()=>{this.state.viewer.scale=!0,this.view.updatePhotoTransform(this.state),this.fireEvent("zoomin")},300)))}zoomOutPhoto(){this.state.viewer.scaleSize=1,this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.view.updatePhotoTransform(this.state),this.fireEvent("zoomout")}addNewItem(e){return this.addItem(e)}show(e=0,i={}){var m,v,g;let o=(m=i.group)!=null?m:this.state.viewer.currentGroup;if(o===null)return;let r=this.state.groups.get(o);if(!(r!=null&&r.length))return;let s=typeof e=="number"?r[e]:r.find(b=>b.id===e);if(!s)return;let n=document.activeElement instanceof HTMLElement?document.activeElement:null,c=(g=(v=i.trigger)!=null?v:s.element)!=null?g:n;this.openPhoto(s,c)}hide(){this.hidePhoto()}next(){this.state.viewer.showNextArrow&&this.gotoSlide(this.state.viewer.next)}prev(){this.state.viewer.showPrevArrow&&this.gotoSlide(this.state.viewer.prev)}addItem(e){let i=e instanceof Element?this.addElementItem(e):this.addSlideItem(e);return this.syncCurrentGroupView(),i}get currentIndex(){return this.state.viewer.currentIndex}ingestSource(e){if(Array.isArray(e)&&!We(e)){e.forEach(o=>{this.addSlideItem(o)});return}Array.from(typeof e=="string"?document.querySelectorAll(e):e).forEach(o=>{this.addElementItem(o)})}addElementItem(e){var s,n;let i=de(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=Le(e,this.state.options,o,Y());return me(this.state,r),this.loadAllFired.delete(i),this.bindThumbnailClick(e,r),r}addSlideItem(e){var s,n;let i=ce(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=Ce(e,o,Y());return me(this.state,r),this.loadAllFired.delete(i),r}bindThumbnailClick(e,i){e.addEventListener("click",o=>{o.preventDefault(),this.openPhoto(i,e)},{signal:this.abortController.signal})}syncCurrentGroupView(){let e=M(this.state);e&&(this.view.syncSlides(e,this.state),this.syncedGroupId=this.state.viewer.currentGroup)}setHash(e){var o;if(!((o=window.history)!=null&&o.pushState)||!this.state.options.useHistoryApi)return;let i=`${location.pathname}${location.search}`;window.history.replaceState(null,"",e?`${i}#${e}`:i)}setHashByCurrentIndex(){let e=De();this.setHash(He(this.state)),window.scroll(e.x,e.y)}restoreFromHash(){let e=location.hash.substring(1);return e?ze(this.state,ye(e)):null}setPosByCurrentIndex(){let e=H(this.state);e&&(this.state.viewer.translateX=-e.translateX,this.state.viewer.translateY=0,this.view.updateListTransform(this.state))}setSizeByScreen(){let e=M(this.state);e&&Me(e,Y(),k(),this.state.options.headerHeight,this.state.options.footerHeight)}resetTranslateCurrent(){Te(M(this.state),Y())}currentImgElement(){for(let[e,i]of this.view.refs.slides)if(e.index===this.state.viewer.currentIndex)return i.img;return null}syncDialog(){let{dialog:e,caption:i}=this.view.refs;this.state.viewer.isOpen&&!e.open?(e.showModal(),i.focus()):!this.state.viewer.isOpen&&e.open&&e.close()}commit(){this.view.render(this.state),this.syncDialog()}initPhoto(){var i;(i=this.finishHideEffect)==null||i.call(this),this.view.refs.dialog.style.opacity="";let e=M(this.state);if(this.state.viewer.total=e.length,this.state.viewer.isOpen=!0,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.setPosByCurrentIndex(),this.setSizeByScreen(),pe(this.state),this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag){let o=H(this.state);this.state.viewer.scale=!0,this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=Q(o,Y(),k(),this.isSmartPhoneFlag)}}supportsViewTransition(){return typeof document.startViewTransition=="function"}openPhotoWithViewTransition(e){var n,c;document.documentElement.style.setProperty("--smartphoto-animation-speed",`${this.state.options.animationSpeed}ms`);let i="smartphoto-hero",o=(n=e==null?void 0:e.querySelector("img"))!=null?n:null;o&&(o.style.viewTransitionName=i);let r=()=>{o&&(o.style.viewTransitionName="");let m=this.currentImgElement();m&&(m.style.viewTransitionName="")},s=(c=document.startViewTransition)==null?void 0:c.call(document,()=>{this.initPhoto(),this.state.viewer.appear=!0,this.commit(),o&&(o.style.viewTransitionName=""),this.currentImgElement().style.viewTransitionName=i});s==null||s.ready.catch(()=>{r()}),s==null||s.finished.then(r,r)}addAppearEffect(e,i){var z;let o=(z=e==null?void 0:e.querySelector("img"))!=null?z:null;if(!o){this.state.viewer.appear=!0;return}let r=Se(o),s=o.offsetWidth,n=o.offsetHeight,c=Y(),m=k(),v=m-this.state.options.headerHeight-this.state.options.footerHeight,g=1;this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag?s>n?g=m/n:g=c/s:(s>=n?i.height<v?g=i.width/s:g=v/n:i.height<v?g=i.height/n:g=v/n,s*g>c&&(g=c/s));let b=(g-1)/2*s+(c-s*g)/2,C=(g-1)/2*n+(m-n*g)/2,y=o.getAttribute(this.state.options.lazyAttribute);this.state.viewer.appearEffect={width:s,height:n,top:r.top,left:r.left,once:!0,img:y||i.src||"",afterX:b,afterY:C,scale:g}}runAppearEffect(e){this.view.showAppearEffect(e);let i=this.view.refs.imgClone;return new Promise(o=>{let r=()=>{i.removeEventListener("transitionend",r,!0),o()};i.addEventListener("transitionend",r,!0),this.scheduleTimeout(()=>{i.style.transform=`translate(${e.afterX}px, ${e.afterY}px) scale(${e.scale})`},10)})}doOpen(e,i){if(this.state.options.showAnimation!==!1&&this.supportsViewTransition())this.openPhotoWithViewTransition(e);else if(this.state.options.showAnimation===!1)this.initPhoto(),this.state.viewer.appear=!0,this.commit();else{this.initPhoto(),this.addAppearEffect(e,i),this.commit();let o=this.state.viewer.appearEffect;o&&this.runAppearEffect(o).then(()=>{this.state.viewer.appearEffect=null,this.view.removeAppearEffect(),this.state.viewer.appear=!0,this.commit()})}this.fireEvent("open"),this.resyncSizeAfterOpen()}resyncSizeAfterOpen(){let e=Y(),i=k();requestAnimationFrame(()=>{this.state.viewer.isOpen&&(Y()===e&&k()===i||(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.view.render(this.state)))})}openPhoto(e,i){this.lastTriggerElement=i,this.state.viewer.currentGroup=e.groupId,this.state.viewer.currentIndex=e.index,this.syncedGroupId!==e.groupId&&this.syncCurrentGroupView(),this.setHashByCurrentIndex(),e.loaded?this.doOpen(i,e):this.loadItem(e).then(()=>{this.doOpen(i,e)})}doHideEffect(e){return new Promise(i=>{let o=this.view.refs.dialog,r=this.currentImgElement(),s=k(),n=e==="top"?`translateY(-${s}px)`:`translateY(${s}px)`,c=()=>{this.finishHideEffect===c&&(this.finishHideEffect=null,o.removeEventListener("transitionend",c,!0),r&&r.style.transform===n&&(r.style.transform=""),i())};this.finishHideEffect=c,r&&(r.style.transform=n),o.addEventListener("transitionend",c,!0),this.scheduleTimeout(c,this.state.options.animationSpeed+100)})}loadItem(e){return new Promise(i=>{var r;let o=new Image;o.onload=()=>{e.width=o.width,e.height=o.height,e.loaded=!0,this.checkLoadAll(e.groupId),i()},o.onerror=()=>i(),o.src=(r=e.src)!=null?r:""})}checkLoadAll(e){if(this.loadAllFired.has(e))return;let i=this.state.groups.get(e);i!=null&&i.length&&i.every(o=>o.loaded)&&(this.loadAllFired.add(e),this.fireEvent("loadall"))}loadNeighborItems(){let e=M(this.state);if(!e)return;let{currentIndex:i}=this.state.viewer,{loadOffset:o}=this.state.options,r=[];for(let s=i-o;s<i+o;s++){let n=e[s];n&&!n.loaded&&r.push(this.loadItem(n))}r.length&&Promise.all(r).then(()=>{this.initPhoto(),this.commit()})}slideList(){this.state.viewer.scaleSize=1,this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.state.viewer.onMove=!0,this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.scheduleTimeout(()=>{let e=H(this.state);this.state.viewer.onMove=!1,pe(this.state),this.commit(),this.state.viewer.oldIndex!==this.state.viewer.currentIndex&&this.fireEvent("change"),this.state.viewer.oldIndex=this.state.viewer.currentIndex,this.loadNeighborItems(),e&&!e.loaded&&this.loadItem(e).then(()=>{this.initPhoto(),this.commit()})},200)}scheduleTimeout(e,i){let o=window.setTimeout(()=>{this.timeouts=this.timeouts.filter(r=>r!==o),e()},i);return this.timeouts.push(o),o}fireEvent(e){he(this.view.refs.dialog,e)}buildViewHandlers(){return{onDismiss:()=>this.hidePhoto(),onPrev:()=>this.prev(),onNext:()=>this.next(),onNavigate:e=>this.gotoSlide(e),onBackdropClick:()=>this.hidePhoto()}}buildGestureCallbacks(){return{onSwipeStart:()=>this.fireEvent("swipestart"),onSwipeMove:()=>this.view.updateListTransform(this.state),onSwipeEnd:e=>{if(this.fireEvent("swipeend"),e==="close-bottom"){this.hidePhoto("bottom");return}if(e==="close-top"){this.hidePhoto("top");return}e==="prev"?this.state.viewer.currentIndex-=1:e==="next"&&(this.state.viewer.currentIndex+=1),this.slideList()},onTap:()=>this.zoomPhoto(),onGestureStart:()=>{this.fireEvent("gesturestart"),this.view.updatePhotoTransform(this.state)},onGestureMove:()=>this.view.updatePhotoTransform(this.state),onGestureEnd:()=>{this.fireEvent("gestureend"),this.view.updatePhotoTransform(this.state)},onPhotoDragMove:()=>this.view.updatePhotoTransform(this.state),onPhotoDragEnd:e=>{if(e==="zoom-out"){this.zoomOutPhoto();return}if(e==="prev"){this.gotoSlide(this.state.viewer.prev);return}if(e==="next"){this.gotoSlide(this.state.viewer.next);return}this.view.updatePhotoTransform(this.state)}}}};var Be=q;var we=t=>{t.fn.SmartPhoto=function(e){return typeof e=="string"||new Be(this,e),this}};if(typeof define=="function"&&define.amd)define(["jquery"],we);else{let t=window,e=t.jQuery?t.jQuery:t.$;typeof e!="undefined"&&we(e)}var ot=we;})();
|
package/js/smartphoto.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* SmartPhoto v2.1.
|
|
2
|
+
* SmartPhoto v2.1.4
|
|
3
3
|
* (c) appleple
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
@@ -130,6 +130,7 @@ var SmartPhoto = (() => {
|
|
|
130
130
|
swipeTopToClose: false,
|
|
131
131
|
swipeBottomToClose: true,
|
|
132
132
|
swipeOffset: 100,
|
|
133
|
+
swipeVelocity: 0.5,
|
|
133
134
|
headerHeight: 60,
|
|
134
135
|
footerHeight: 60,
|
|
135
136
|
forceInterval: 10,
|
|
@@ -390,6 +391,7 @@ var SmartPhoto = (() => {
|
|
|
390
391
|
const y = p1.y - p2.y;
|
|
391
392
|
return Math.sqrt(x * x + y * y);
|
|
392
393
|
}
|
|
394
|
+
var MIN_FLICK_DISTANCE = 10;
|
|
393
395
|
function getForceAndTheta(x, y) {
|
|
394
396
|
return { force: Math.sqrt(x * x + y * y), theta: Math.atan2(y, x) };
|
|
395
397
|
}
|
|
@@ -407,6 +409,7 @@ var SmartPhoto = (() => {
|
|
|
407
409
|
let firstPos = null;
|
|
408
410
|
let oldPos = null;
|
|
409
411
|
let moveDir = null;
|
|
412
|
+
let swipeStartTime = 0;
|
|
410
413
|
let photoSwipable = false;
|
|
411
414
|
let firstPhotoPos = null;
|
|
412
415
|
let oldPhotoPos = null;
|
|
@@ -414,6 +417,7 @@ var SmartPhoto = (() => {
|
|
|
414
417
|
let photoVY = 0;
|
|
415
418
|
let pinching = false;
|
|
416
419
|
let oldDistance = 0;
|
|
420
|
+
let pinchMoveFrame = null;
|
|
417
421
|
let vx = 0;
|
|
418
422
|
let vy = 0;
|
|
419
423
|
function isSmartPhone2() {
|
|
@@ -535,6 +539,7 @@ var SmartPhoto = (() => {
|
|
|
535
539
|
dragStart = true;
|
|
536
540
|
firstPos = pos;
|
|
537
541
|
oldPos = pos;
|
|
542
|
+
swipeStartTime = Date.now();
|
|
538
543
|
}
|
|
539
544
|
function startPhotoDrag(e) {
|
|
540
545
|
photoSwipable = true;
|
|
@@ -559,6 +564,23 @@ var SmartPhoto = (() => {
|
|
|
559
564
|
}
|
|
560
565
|
startSwipe(e);
|
|
561
566
|
}
|
|
567
|
+
function scheduleGestureMove() {
|
|
568
|
+
if (pinchMoveFrame !== null) {
|
|
569
|
+
return;
|
|
570
|
+
}
|
|
571
|
+
pinchMoveFrame = requestAnimationFrame(() => {
|
|
572
|
+
pinchMoveFrame = null;
|
|
573
|
+
callbacks.onGestureMove();
|
|
574
|
+
});
|
|
575
|
+
}
|
|
576
|
+
function flushGestureMove() {
|
|
577
|
+
if (pinchMoveFrame === null) {
|
|
578
|
+
return;
|
|
579
|
+
}
|
|
580
|
+
cancelAnimationFrame(pinchMoveFrame);
|
|
581
|
+
pinchMoveFrame = null;
|
|
582
|
+
callbacks.onGestureMove();
|
|
583
|
+
}
|
|
562
584
|
function movePinch() {
|
|
563
585
|
const points = Array.from(activePointers.values());
|
|
564
586
|
const dist = distance(
|
|
@@ -583,7 +605,7 @@ var SmartPhoto = (() => {
|
|
|
583
605
|
state.viewer.hideUi = state.viewer.scaleSize < 1 || state.viewer.scaleSize > border;
|
|
584
606
|
}
|
|
585
607
|
oldDistance = dist;
|
|
586
|
-
|
|
608
|
+
scheduleGestureMove();
|
|
587
609
|
}
|
|
588
610
|
function moveSwipe(e) {
|
|
589
611
|
const pos = getPos(e);
|
|
@@ -632,6 +654,7 @@ var SmartPhoto = (() => {
|
|
|
632
654
|
}
|
|
633
655
|
function endPinch() {
|
|
634
656
|
pinching = false;
|
|
657
|
+
flushGestureMove();
|
|
635
658
|
const item = currentItem(state);
|
|
636
659
|
if (!item) {
|
|
637
660
|
return;
|
|
@@ -669,9 +692,11 @@ var SmartPhoto = (() => {
|
|
|
669
692
|
const items = (_a = currentItems(state)) != null ? _a : [];
|
|
670
693
|
if (moveDir === "horizontal") {
|
|
671
694
|
let result = "stay";
|
|
672
|
-
|
|
695
|
+
const elapsedMs = Math.max(now - swipeStartTime, 1);
|
|
696
|
+
const isFlick = Math.abs(swipeWidth) >= MIN_FLICK_DISTANCE && Math.abs(swipeWidth) / elapsedMs >= state.options.swipeVelocity;
|
|
697
|
+
if ((swipeWidth >= state.options.swipeOffset || isFlick && swipeWidth > 0) && state.viewer.currentIndex !== 0) {
|
|
673
698
|
result = "prev";
|
|
674
|
-
} else if (swipeWidth <= -state.options.swipeOffset && state.viewer.currentIndex !== items.length - 1) {
|
|
699
|
+
} else if ((swipeWidth <= -state.options.swipeOffset || isFlick && swipeWidth < 0) && state.viewer.currentIndex !== items.length - 1) {
|
|
675
700
|
result = "next";
|
|
676
701
|
}
|
|
677
702
|
callbacks.onSwipeEnd(result);
|
|
@@ -762,6 +787,10 @@ var SmartPhoto = (() => {
|
|
|
762
787
|
}
|
|
763
788
|
function detach() {
|
|
764
789
|
clearInterval(interval);
|
|
790
|
+
if (pinchMoveFrame !== null) {
|
|
791
|
+
cancelAnimationFrame(pinchMoveFrame);
|
|
792
|
+
pinchMoveFrame = null;
|
|
793
|
+
}
|
|
765
794
|
}
|
|
766
795
|
return { attach, detach };
|
|
767
796
|
}
|
|
@@ -1099,8 +1128,11 @@ var SmartPhoto = (() => {
|
|
|
1099
1128
|
return document.documentElement.clientWidth;
|
|
1100
1129
|
}
|
|
1101
1130
|
function getWindowHeight() {
|
|
1102
|
-
|
|
1103
|
-
|
|
1131
|
+
const visualViewport = window.visualViewport;
|
|
1132
|
+
if (visualViewport) {
|
|
1133
|
+
return visualViewport.height * visualViewport.scale;
|
|
1134
|
+
}
|
|
1135
|
+
return document.documentElement.clientHeight;
|
|
1104
1136
|
}
|
|
1105
1137
|
function isElementArray(source) {
|
|
1106
1138
|
return source.length > 0 && source[0] instanceof Element;
|
package/js/smartphoto.min.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* SmartPhoto v2.1.
|
|
2
|
+
* SmartPhoto v2.1.4
|
|
3
3
|
* (c) appleple
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
"use strict";var SmartPhoto=(()=>{var ne=Object.defineProperty;var Oe=Object.getOwnPropertyDescriptor;var Xe=Object.getOwnPropertyNames;var Ye=Object.prototype.hasOwnProperty;var Ne=(t,e)=>{for(var i in e)ne(t,i,{get:e[i],enumerable:!0})},Be=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Xe(e))!Ye.call(t,r)&&r!==i&&ne(t,r,{get:()=>e[r],enumerable:!(o=Oe(e,r))||o.enumerable});return t};var De=t=>Be(ne({},"__esModule",{value:!0}),t);var Re={};Ne(Re,{default:()=>Fe});var q=()=>{let t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0};function fe(t,...e){var i;t=t||{};for(let o=0;o<e.length;o++){let r=e[o];if(r){for(let s in r)if(Object.hasOwn(r,s)){let n=r[s];n&&typeof n=="object"?t[s]=fe((i=t[s])!=null?i:{},n):t[s]=n}}}return t}var ve=fe,se=(t,e,i)=>{let o;window.CustomEvent?o=new CustomEvent(e,{cancelable:!0}):(o=document.createEvent("CustomEvent"),o.initCustomEvent(e,!1,!1,i)),t.dispatchEvent(o)},we=t=>{let e={};for(let i of t.split("&")){let o=i.split("="),r=o[0],s=o.length>1?o.slice(1).join("="):r;e[r]=decodeURIComponent(s)}return e},ge=t=>({left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top});var Ve={classNames:{smartPhoto:"smartphoto",smartPhotoClose:"smartphoto-close",smartPhotoBody:"smartphoto-body",smartPhotoInner:"smartphoto-inner",smartPhotoContent:"smartphoto-content",smartPhotoImg:"smartphoto-img",smartPhotoImgOnMove:"smartphoto-img-onmove",smartPhotoImgElasticMove:"smartphoto-img-elasticmove",smartPhotoImgWrap:"smartphoto-img-wrap",smartPhotoArrows:"smartphoto-arrows",smartPhotoNav:"smartphoto-nav",smartPhotoArrowRight:"smartphoto-arrow-right",smartPhotoArrowLeft:"smartphoto-arrow-left",smartPhotoArrowHideIcon:"smartphoto-arrow-hide",smartPhotoImgLeft:"smartphoto-img-left",smartPhotoImgRight:"smartphoto-img-right",smartPhotoList:"smartphoto-list",smartPhotoListOnMove:"smartphoto-list-onmove",smartPhotoHeader:"smartphoto-header",smartPhotoCount:"smartphoto-count",smartPhotoCaption:"smartphoto-caption",smartPhotoDismiss:"smartphoto-dismiss",smartPhotoLoader:"smartphoto-loader",smartPhotoLoaderWrap:"smartphoto-loader-wrap",smartPhotoImgClone:"smartphoto-img-clone"},message:{gotoNextImage:"go to the next image",gotoPrevImage:"go to the previous image",closeDialog:"close the image dialog",carouselLabel:"Images"},arrows:!0,nav:!0,showAnimation:!0,verticalGravity:!1,useOrientationApi:!1,useHistoryApi:!0,swipeTopToClose:!1,swipeBottomToClose:!0,swipeOffset:100,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,loadOffset:2,resizeStyle:"fit",lazyAttribute:"data-src",animationSpeed:300};function Ee(t){return Object.keys(t).forEach(e=>{let i=t[e];i&&typeof i=="object"&&!Object.isFrozen(i)&&Ee(i)}),Object.freeze(t)}function Pe(t){return{options:Ee(ve({},Ve,t)),viewer:{isOpen:!1,currentGroup:null,currentIndex:0,oldIndex:0,total:0,translateX:0,translateY:0,photoPosX:0,photoPosY:0,scaleSize:1,scale:!1,elastic:!1,hideUi:!1,onMove:!1,appear:!1,appearEffect:null,prev:-1,next:-1,showPrevArrow:!1,showNextArrow:!1},groups:new Map}}function le(t){return t.getAttribute("data-group")||"nogroup"}function he(t){return t.group||"nogroup"}function be(t,e,i,o){let r=le(t),s=t.getAttribute("href"),n=t.querySelector("img"),c=s;n&&(n.getAttribute(e.lazyAttribute)?c=n.getAttribute(e.lazyAttribute):n.currentSrc?c=n.currentSrc:c=n.src);let p="";n!=null&&n.getAttribute("alt")?p=n.getAttribute("alt"):t.getAttribute("data-caption")?p=t.getAttribute("data-caption"):p=s!=null?s:"";let E=t.getAttribute("data-id");return{src:s,thumb:c,caption:t.getAttribute("data-caption"),alt:p,groupId:r,translateX:o*i,translateY:0,index:i,width:50,height:50,scale:1,x:0,y:0,id:E||i,loaded:!1,processed:!1,element:t}}function ye(t,e,i){var E,v,x,b,I;let o=he(t),r=t.src,s=(E=t.thumb)!=null?E:r,n=(v=t.caption)!=null?v:null,c=(b=(x=t.alt)!=null?x:n)!=null?b:r,p=typeof t.width=="number"&&typeof t.height=="number";return{src:r,thumb:s,caption:n,alt:c,groupId:o,translateX:i*e,translateY:0,index:e,width:p?t.width:50,height:p?t.height:50,scale:1,x:0,y:0,id:(I=t.id)!=null?I:e,loaded:p,processed:!1,element:null}}function ue(t,e){t.groups.has(e.groupId)||t.groups.set(e.groupId,[]),t.groups.get(e.groupId).push(e),t.viewer.currentGroup=e.groupId}function H(t){var e;return t.viewer.currentGroup===null?null:(e=t.groups.get(t.viewer.currentGroup))!=null?e:null}function M(t){var i;let e=H(t);return e&&(i=e[t.viewer.currentIndex])!=null?i:null}function de(t){let e=H(t);if(!e)return;let i=e.length,o=t.viewer.currentIndex+1,r=t.viewer.currentIndex-1;t.viewer.showNextArrow=!1,t.viewer.showPrevArrow=!1,o!==i&&(t.viewer.next=o,t.viewer.showNextArrow=!0),r!==-1&&(t.viewer.prev=r,t.viewer.showPrevArrow=!0)}function Se(t,e){t.forEach((i,o)=>{i.translateX=e*o})}function j(t,e){let i=10**e;return Math.round(t*i)/i}function W(t,e,i,o){return o?t.width>t.height?i/(t.height*t.scale):e/(t.width*t.scale):1/t.scale}function xe(t,e,i,o){let r=t.width*t.scale*e.scaleSize,s=t.height*t.scale*e.scaleSize,n,c,p,E;return i>r?(p=(i-r)/2,n=-1*p):(p=(r-i)/2,n=-1*p),o>s?(E=(o-s)/2,c=-1*E):(E=(s-o)/2,c=-1*E),{minX:j(n,6)*e.scaleSize,minY:j(c,6)*e.scaleSize,maxX:j(p,6)*e.scaleSize,maxY:j(E,6)*e.scaleSize}}function Ie(t,e,i,o,r){let s=i-(o+r);t.forEach(n=>{n.loaded&&(n.processed=!0,n.scale=s/n.height,n.height<s&&(n.scale=1),n.x=(n.scale-1)/2*n.width+(e-n.width*n.scale)/2,n.y=(n.scale-1)/2*n.height+(i-n.height*n.scale)/2,n.width*n.scale>e&&(n.scale=e/n.width,n.x=(n.scale-1)/2*n.width))})}function Le(t){let e=M(t);return e?`group=${t.viewer.currentGroup}&photo=${e.id}`:""}function Ce(t,e){let i=null;return t.groups.forEach(o=>{o.forEach(r=>{e.group===r.groupId&&e.photo===r.id&&(i=r)})}),i}function ce(t,e){let i=10**e;return Math.round(t*i)/i}function k(t){return{x:t.pageX,y:t.pageY}}function Te(t,e){let i=t.x-e.x,o=t.y-e.y;return Math.sqrt(i*i+o*o)}function Ge(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}function Ae(){return{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}}function He({state:t,callbacks:e},{signal:i}){let o=new Map,r=Date.now(),s=!1,n=!1,c=null,p=null,E=null,v=!1,x=null,b=null,I=0,z=0,y=!1,Y=0,L=0,C=0;function N(){return q()}function V(a){let{width:h,height:f}=Ae();return xe(a,t.viewer,h,f)}function u(a){let{width:h,height:f}=Ae();return W(a,h,f,N())}function Q(a,h){let f=M(t),m=V(f);t.viewer.elastic=!0,a===1?t.viewer.photoPosX=m.minX:a===-1&&(t.viewer.photoPosX=m.maxX),h===1?t.viewer.photoPosY=m.minY:h===-1&&(t.viewer.photoPosY=m.maxY),e.onPhotoDragMove(),setTimeout(()=>{t.viewer.elastic=!1,e.onPhotoDragMove()},300)}let R=setInterval(()=>{if(y||s||v||t.viewer.elastic||!t.viewer.scale)return;t.viewer.photoPosX+=L,t.viewer.photoPosY+=C;let a=M(t);if(!a)return;let h=V(a);t.viewer.photoPosX<h.minX?(t.viewer.photoPosX=h.minX,L*=-.2):t.viewer.photoPosX>h.maxX&&(t.viewer.photoPosX=h.maxX,L*=-.2),t.viewer.photoPosY<h.minY?(t.viewer.photoPosY=h.minY,C*=-.2):t.viewer.photoPosY>h.maxY&&(t.viewer.photoPosY=h.maxY,C*=-.2);let f=Ge(L,C),m=f.force-t.options.registance;Math.abs(m)<.5||(L=Math.cos(f.theta)*m,C=Math.sin(f.theta)*m,e.onPhotoDragMove())},t.options.forceInterval);function $(a,h){(a>5||a<-5)&&(L+=a*.05),t.options.verticalGravity&&(h>5||h<-5)&&(C+=h*.05)}function _(a){if(!(a!=null&&a.gamma)||t.viewer.appearEffect||y||s||v||t.viewer.elastic||!t.viewer.scale)return;let{orientation:h}=window;h===0?$(a.gamma,a.beta):h===90?$(a.beta,a.gamma):h===-90?$(-a.beta,-a.gamma):h===180&&$(-a.gamma,-a.beta)}t.options.useOrientationApi&&window.addEventListener("deviceorientation",_,{signal:i});function B(){y=!0,s=!1,v=!1;let a=Array.from(o.values());Y=Te(a[0],a[1]),t.viewer.scale=!0,e.onGestureStart()}function U(a){let h=k(a);s=!0,n=!0,c=h,p=h}function J(a){v=!0;let h=k(a);b=h,x=h}function Z(a){var h,f;try{(f=(h=a.currentTarget).setPointerCapture)==null||f.call(h,a.pointerId)}catch(m){}if(o.set(a.pointerId,k(a)),o.size>1){B();return}if(t.viewer.scale){J(a);return}U(a)}function ee(){let a=Array.from(o.values()),h=Te(a[0],a[1]),f=(h-Y)/100,m=t.viewer.scaleSize,T=t.viewer.photoPosX,A=t.viewer.photoPosY;t.viewer.scaleSize+=ce(f,6),t.viewer.scaleSize<.2&&(t.viewer.scaleSize=.2),t.viewer.scaleSize<m&&(t.viewer.photoPosX=(1+t.viewer.scaleSize-m)*T,t.viewer.photoPosY=(1+t.viewer.scaleSize-m)*A);let X=M(t);if(X){let re=u(X);t.viewer.hideUi=t.viewer.scaleSize<1||t.viewer.scaleSize>re}Y=h,e.onGestureMove()}function te(a){let h=k(a),f=h.x-p.x,m=h.y-c.y;n&&(e.onSwipeStart(),n=!1,E=Math.abs(f)>Math.abs(m)?"horizontal":"vertical"),E==="horizontal"?t.viewer.translateX+=f:t.viewer.translateY=m,p=h,e.onSwipeMove()}function ie(a){let h=k(a),f=h.x-b.x,m=h.y-b.y,T=ce(t.viewer.scaleSize*f,6),A=ce(t.viewer.scaleSize*m,6);t.viewer.photoPosX+=T,I=T,t.viewer.photoPosY+=A,z=A,b=h,e.onPhotoDragMove()}function oe(a){if(o.has(a.pointerId)){if(o.set(a.pointerId,k(a)),y){ee();return}if(v){ie(a);return}te(a)}}function d(){y=!1;let a=M(t);if(!a)return;let h=u(a);t.viewer.scaleSize>h||(t.viewer.photoPosX=0,t.viewer.photoPosY=0,t.viewer.scale=!1,t.viewer.scaleSize=1,t.viewer.hideUi=!1,e.onGestureEnd())}function l(){var pe;s=!1;let a=c,h=p,f=Date.now(),m=r-f,T=h.x-a.x,A=h.y-a.y,X=T===0&&A===0;if(!N()&&X){e.onTap();return}if(Math.abs(m)<=500&&X){e.onTap();return}r=f;let re=(pe=H(t))!=null?pe:[];if(E==="horizontal"){let G="stay";T>=t.options.swipeOffset&&t.viewer.currentIndex!==0?G="prev":T<=-t.options.swipeOffset&&t.viewer.currentIndex!==re.length-1&&(G="next"),e.onSwipeEnd(G)}else{let G="stay";t.options.swipeBottomToClose&&A>=t.options.swipeOffset?G="close-bottom":t.options.swipeTopToClose&&A<=-t.options.swipeOffset&&(G="close-top"),e.onSwipeEnd(G)}}function P(){v=!1;let a=b,h=x;if(a.x===h.x){e.onPhotoDragEnd("zoom-out");return}let f=M(t);if(!f){e.onPhotoDragEnd(null);return}let m=V(f),T=t.options.swipeOffset*t.viewer.scaleSize,A=0,X=0;if(t.viewer.photoPosX>m.maxX?A=-1:t.viewer.photoPosX<m.minX&&(A=1),t.viewer.photoPosY>m.maxY?X=-1:t.viewer.photoPosY<m.minY&&(X=1),t.viewer.photoPosX-m.maxX>T&&t.viewer.currentIndex!==0){e.onPhotoDragEnd("prev");return}if(m.minX-t.viewer.photoPosX>T&&t.viewer.currentIndex+1!==t.viewer.total){e.onPhotoDragEnd("next");return}A===0&&X===0?(L=I/5,C=z/5):Q(A,X),e.onPhotoDragEnd(null)}function g(a){if(o.delete(a.pointerId),y){o.size<2&&d();return}if(v){P();return}s&&l()}function w(...a){for(let h of a)h.addEventListener("pointerdown",Z,{signal:i}),h.addEventListener("pointermove",oe,{signal:i}),h.addEventListener("pointerup",g,{signal:i}),h.addEventListener("pointercancel",g,{signal:i})}function S(){clearInterval(R)}return{attach:w,detach:S}}function K(t){let e=document.createElement("span");return e.className="smartphoto-sr-only",e.textContent=t,e}function me(){let t=document.createElement("button");return t.type="button",t}function $e(t){return t.replace(/"/g,'\\"')}function Me({id:t,options:e},i,{signal:o}){let{classNames:r,message:s}=e,n=document.createElement("div");n.setAttribute("data-id",t);let c=document.createElement("dialog");c.className=r.smartPhoto,c.setAttribute("aria-labelledby",`smartphoto-${t}-title`),c.style.setProperty("--smartphoto-animation-speed",`${e.animationSpeed}ms`);let p=document.createElement("div");p.className=r.smartPhotoBody;let E=document.createElement("div");E.className=r.smartPhotoInner;let v=document.createElement("div");v.className=r.smartPhotoHeader;let x=document.createElement("span");x.className=r.smartPhotoCount;let b=document.createElement("h1");b.id=`smartphoto-${t}-title`,b.className=r.smartPhotoCaption,b.setAttribute("tabindex","-1");let I=document.createElement("button");I.className=r.smartPhotoDismiss,I.appendChild(K(s.closeDialog)),I.addEventListener("click",()=>i.onDismiss(),{signal:o}),v.append(x,b,I);let z=document.createElement("div");z.className=r.smartPhotoContent,z.addEventListener("click",d=>{d.target===z&&i.onBackdropClick()},{signal:o});let y=document.createElement("ul");y.className=r.smartPhotoList,y.setAttribute("role","region"),y.setAttribute("aria-roledescription","carousel"),y.setAttribute("aria-label",s.carouselLabel),y.setAttribute("aria-live","polite"),y.setAttribute("aria-atomic","false"),E.append(v,z,y);let Y=null,L=null,C=null;if(e.arrows){Y=document.createElement("ul"),Y.className=r.smartPhotoArrows,L=document.createElement("li"),L.className=r.smartPhotoArrowLeft;let d=me();d.appendChild(K(s.gotoPrevImage)),d.addEventListener("click",()=>i.onPrev(),{signal:o}),L.appendChild(d),C=document.createElement("li"),C.className=r.smartPhotoArrowRight;let l=me();l.appendChild(K(s.gotoNextImage)),l.addEventListener("click",()=>i.onNext(),{signal:o}),C.appendChild(l),Y.append(L,C),E.appendChild(Y)}let N=null,V=null;e.nav&&(N=document.createElement("nav"),N.className=r.smartPhotoNav,N.setAttribute("aria-label","Choose slide to display"),V=document.createElement("ul"),N.appendChild(V),E.appendChild(N)),p.appendChild(E),c.appendChild(p),n.appendChild(c);let u={dialog:c,count:x,caption:b,dismiss:I,content:z,list:y,arrows:Y,arrowLeft:L,arrowRight:C,nav:N,navList:V,slides:new Map,imgClone:null};function Q(){let d=document.createElement("div");d.className=r.smartPhotoLoaderWrap;let l=document.createElement("span");return l.className=r.smartPhotoLoader,d.appendChild(l),d}function R(d){var g,w;let l=document.createElement("div");l.className=r.smartPhotoImgWrap;let P=document.createElement("img");return P.className=r.smartPhotoImg,P.src=(g=d.src)!=null?g:"",P.alt=(w=d.alt)!=null?w:"",P.addEventListener("dragstart",S=>S.preventDefault(),{signal:o}),l.appendChild(P),{imgWrap:l,img:P}}function $(d,l){var P;u.list.replaceChildren(),(P=u.navList)==null||P.replaceChildren(),u.slides=new Map,d.forEach(g=>{var a,h;let w=document.createElement("li");w.setAttribute("role","group"),w.setAttribute("aria-roledescription","slide"),w.setAttribute("aria-label",`${g.index+1} of ${d.length}`);let S={li:w,loaderWrap:null,imgWrap:null,img:null,navLink:null};if(g.processed){let{imgWrap:f,img:m}=R(g);w.appendChild(f),S.imgWrap=f,S.img=m}else{let f=Q();w.appendChild(f),S.loaderWrap=f}if(u.list.appendChild(w),u.slides.set(g,S),u.navList){let f=document.createElement("li"),m=me();m.style.backgroundImage=`url("${$e((a=g.thumb)!=null?a:"")}")`;let T=g.index;m.addEventListener("click",()=>i.onNavigate(T),{signal:o}),m.appendChild(K(`go to ${(h=g.caption)!=null?h:""}`)),f.appendChild(m),u.navList.appendChild(f),S.navLink=m}}),U(l)}function _(d,l){var w;if(l.imgWrap||!d.processed)return l;let{imgWrap:P,img:g}=R(d);return(w=l.loaderWrap)==null||w.replaceWith(P),l.loaderWrap=null,l.imgWrap=P,l.img=g,l}function B(d){d&&document.activeElement&&d.contains(document.activeElement)&&u.caption.focus()}function U(d){let{viewer:l}=d;u.count.textContent=`${l.currentIndex+1}/${l.total}`,u.slides.forEach((P,g)=>{var a;let w=_(g,P),S=g.index===l.currentIndex;w.li.style.transform=`translate(${g.translateX}px,${g.translateY}px)`,w.li.classList.toggle("current",S),S?w.li.removeAttribute("aria-hidden"):w.li.setAttribute("aria-hidden","true"),S&&(u.caption.textContent=(a=g.caption)!=null?a:""),w.imgWrap&&w.img&&(w.imgWrap.style.transform=`translate(${g.x}px,${g.y}px) scale(${g.scale})`,w.img.style.width=`${g.width}px`,w.img.classList.toggle("active",l.appear),w.img.classList.toggle(r.smartPhotoImgOnMove,l.scale),w.img.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),w.navLink&&(w.navLink.classList.toggle("current",S),S?w.navLink.setAttribute("aria-current","true"):w.navLink.removeAttribute("aria-current"))}),u.arrowLeft&&(l.showPrevArrow?u.arrowLeft.removeAttribute("aria-hidden"):(B(u.arrowLeft),u.arrowLeft.setAttribute("aria-hidden","true"))),u.arrowRight&&(l.showNextArrow?u.arrowRight.removeAttribute("aria-hidden"):(B(u.arrowRight),u.arrowRight.setAttribute("aria-hidden","true"))),u.arrows&&(l.hideUi&&B(u.arrows),u.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false")),u.nav&&(l.hideUi&&B(u.nav),u.nav.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function J(d){for(let[l,P]of u.slides)if(l.index===d.viewer.currentIndex)return P;return null}function Z(d){let{viewer:l}=d,P=J(d),g=P==null?void 0:P.img;g&&(g.style.transform=`translate(${l.photoPosX}px,${l.photoPosY}px) scale(${l.scaleSize})`,g.classList.toggle(r.smartPhotoImgOnMove,l.scale),g.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),u.nav&&(l.hideUi&&B(u.nav),u.nav.setAttribute("aria-hidden",l.hideUi?"true":"false")),u.arrows&&(l.hideUi&&B(u.arrows),u.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function ee(d){let{viewer:l}=d;u.list.style.transform=`translate(${l.translateX}px,${l.translateY}px)`,u.list.classList.toggle(r.smartPhotoListOnMove,l.onMove)}function te(d){let l=document.createElement("img");l.className=r.smartPhotoImgClone,l.src=d.img,l.style.width=`${d.width}px`,l.style.height=`${d.height}px`,l.style.transform=`translate(${d.left}px,${d.top}px) scale(1)`,p.appendChild(l),u.imgClone=l}function ie(){var d;(d=u.imgClone)==null||d.remove(),u.imgClone=null}function oe(){n.remove()}return{root:n,refs:u,render:U,syncSlides:$,updatePhotoTransform:Z,updateListTransform:ee,showAppearEffect:te,removeAppearEffect:ie,destroy:oe}}function O(){return document.documentElement.clientWidth}function D(){var t,e;return(e=(t=window.visualViewport)==null?void 0:t.height)!=null?e:document.documentElement.clientHeight}function ke(t){return t.length>0&&t[0]instanceof Element}function We(){return(Date.now().toString(36)+Math.random().toString(36).substring(2,7)).toUpperCase()}function ze(){return{x:window.pageXOffset!==void 0?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:document.documentElement.scrollTop}}var F=class{constructor(e,i){this.id=We();this.abortController=new AbortController;this.isSmartPhoneFlag=q();this.lastTriggerElement=null;this.isFiringPublicCloseEvent=!1;this.finishHideEffect=null;this.timeouts=[];this.loadAllFired=new Set;this.syncedGroupId=null;this.updateViewportHeight=()=>{this.view.refs.dialog.style.setProperty("--smartphoto-vh",`${D()}px`)};this.handleResize=()=>{H(this.state)&&(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.commit())};this.handleKeydown=e=>{if(!this.state.viewer.isOpen)return;let i=e.keyCode||e.which;i===37?this.gotoSlide(this.state.viewer.prev):i===39?this.gotoSlide(this.state.viewer.next):i===27&&this.hidePhoto()};this.handleOrientationChange=()=>{if(!H(this.state))return;this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit();let e=O(),i=500,o=r=>{this.scheduleTimeout(()=>{e!==O()?(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit()):r<=i&&o(r+25)},25)};o(0)};this.state=Pe(i!=null?i:{}),this.view=Me({id:this.id,options:this.state.options},this.buildViewHandlers(),{signal:this.abortController.signal}),document.body.appendChild(this.view.root),this.gestures=He({state:this.state,callbacks:this.buildGestureCallbacks()},{signal:this.abortController.signal}),this.gestures.attach(this.view.refs.content,this.view.refs.list),this.view.refs.dialog.addEventListener("close",()=>{!this.isFiringPublicCloseEvent&&this.state.viewer.isOpen&&this.hidePhoto()},{signal:this.abortController.signal}),this.ingestSource(e),this.syncCurrentGroupView();let o=this.restoreFromHash();if(o&&(o.element?se(o.element,"click"):this.openPhoto(o,null)),this.updateViewportHeight(),window.visualViewport?window.visualViewport.addEventListener("resize",this.updateViewportHeight,{signal:this.abortController.signal}):window.addEventListener("resize",this.updateViewportHeight,{signal:this.abortController.signal}),!this.isSmartPhoneFlag){window.addEventListener("resize",this.handleResize,{signal:this.abortController.signal}),window.addEventListener("keydown",this.handleKeydown,{signal:this.abortController.signal});return}window.addEventListener("orientationchange",this.handleOrientationChange,{signal:this.abortController.signal})}on(e,i){let o=this.view.refs.dialog,r=s=>i.call(o,s);o.addEventListener(e,r,{signal:this.abortController.signal})}destroy(){this.state.viewer.isOpen=!1,this.view.refs.dialog.open&&this.view.refs.dialog.close(),this.abortController.abort(),this.timeouts.forEach(e=>{clearTimeout(e)}),this.timeouts=[],this.gestures.detach(),this.view.destroy()}[Symbol.dispose](){this.destroy()}gotoSlide(e){this.state.viewer.currentIndex=Number.parseInt(String(e),10),this.state.viewer.currentIndex||(this.state.viewer.currentIndex=0),this.slideList()}hidePhoto(e="bottom"){var o;if(!this.state.viewer.isOpen)return;this.state.viewer.isOpen=!1,this.state.viewer.appear=!1,this.state.viewer.appearEffect=null,this.view.removeAppearEffect(),this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.scaleSize=1;let i=ze();location.hash&&this.setHash(""),window.scroll(i.x,i.y),this.syncDialog(),(o=this.lastTriggerElement)!=null&&o.isConnected&&this.lastTriggerElement.focus(),this.lastTriggerElement=null,this.doHideEffect(e).then(()=>{this.view.render(this.state),this.isFiringPublicCloseEvent=!0,this.fireEvent("close"),this.isFiringPublicCloseEvent=!1})}zoomPhoto(){let e=M(this.state);e&&(this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=W(e,O(),D(),this.isSmartPhoneFlag),!(this.state.viewer.scaleSize<=1)&&(this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.view.updatePhotoTransform(this.state),this.scheduleTimeout(()=>{this.state.viewer.scale=!0,this.view.updatePhotoTransform(this.state),this.fireEvent("zoomin")},300)))}zoomOutPhoto(){this.state.viewer.scaleSize=1,this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.view.updatePhotoTransform(this.state),this.fireEvent("zoomout")}addNewItem(e){return this.addItem(e)}show(e=0,i={}){var p,E,v;let o=(p=i.group)!=null?p:this.state.viewer.currentGroup;if(o===null)return;let r=this.state.groups.get(o);if(!(r!=null&&r.length))return;let s=typeof e=="number"?r[e]:r.find(x=>x.id===e);if(!s)return;let n=document.activeElement instanceof HTMLElement?document.activeElement:null,c=(v=(E=i.trigger)!=null?E:s.element)!=null?v:n;this.openPhoto(s,c)}hide(){this.hidePhoto()}next(){this.state.viewer.showNextArrow&&this.gotoSlide(this.state.viewer.next)}prev(){this.state.viewer.showPrevArrow&&this.gotoSlide(this.state.viewer.prev)}addItem(e){let i=e instanceof Element?this.addElementItem(e):this.addSlideItem(e);return this.syncCurrentGroupView(),i}get currentIndex(){return this.state.viewer.currentIndex}ingestSource(e){if(Array.isArray(e)&&!ke(e)){e.forEach(o=>{this.addSlideItem(o)});return}Array.from(typeof e=="string"?document.querySelectorAll(e):e).forEach(o=>{this.addElementItem(o)})}addElementItem(e){var s,n;let i=le(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=be(e,this.state.options,o,O());return ue(this.state,r),this.loadAllFired.delete(i),this.bindThumbnailClick(e,r),r}addSlideItem(e){var s,n;let i=he(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=ye(e,o,O());return ue(this.state,r),this.loadAllFired.delete(i),r}bindThumbnailClick(e,i){e.addEventListener("click",o=>{o.preventDefault(),this.openPhoto(i,e)},{signal:this.abortController.signal})}syncCurrentGroupView(){let e=H(this.state);e&&(this.view.syncSlides(e,this.state),this.syncedGroupId=this.state.viewer.currentGroup)}setHash(e){var o;if(!((o=window.history)!=null&&o.pushState)||!this.state.options.useHistoryApi)return;let i=`${location.pathname}${location.search}`;window.history.replaceState(null,"",e?`${i}#${e}`:i)}setHashByCurrentIndex(){let e=ze();this.setHash(Le(this.state)),window.scroll(e.x,e.y)}restoreFromHash(){let e=location.hash.substring(1);return e?Ce(this.state,we(e)):null}setPosByCurrentIndex(){let e=M(this.state);e&&(this.state.viewer.translateX=-e.translateX,this.state.viewer.translateY=0,this.view.updateListTransform(this.state))}setSizeByScreen(){let e=H(this.state);e&&Ie(e,O(),D(),this.state.options.headerHeight,this.state.options.footerHeight)}resetTranslateCurrent(){Se(H(this.state),O())}currentImgElement(){for(let[e,i]of this.view.refs.slides)if(e.index===this.state.viewer.currentIndex)return i.img;return null}syncDialog(){let{dialog:e,caption:i}=this.view.refs;this.state.viewer.isOpen&&!e.open?(e.showModal(),i.focus()):!this.state.viewer.isOpen&&e.open&&e.close()}commit(){this.view.render(this.state),this.syncDialog()}initPhoto(){var i;(i=this.finishHideEffect)==null||i.call(this),this.view.refs.dialog.style.opacity="";let e=H(this.state);if(this.state.viewer.total=e.length,this.state.viewer.isOpen=!0,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.setPosByCurrentIndex(),this.setSizeByScreen(),de(this.state),this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag){let o=M(this.state);this.state.viewer.scale=!0,this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=W(o,O(),D(),this.isSmartPhoneFlag)}}supportsViewTransition(){return typeof document.startViewTransition=="function"}openPhotoWithViewTransition(e){var n,c;document.documentElement.style.setProperty("--smartphoto-animation-speed",`${this.state.options.animationSpeed}ms`);let i="smartphoto-hero",o=(n=e==null?void 0:e.querySelector("img"))!=null?n:null;o&&(o.style.viewTransitionName=i);let r=()=>{o&&(o.style.viewTransitionName="");let p=this.currentImgElement();p&&(p.style.viewTransitionName="")},s=(c=document.startViewTransition)==null?void 0:c.call(document,()=>{this.initPhoto(),this.state.viewer.appear=!0,this.commit(),o&&(o.style.viewTransitionName=""),this.currentImgElement().style.viewTransitionName=i});s==null||s.ready.catch(()=>{r()}),s==null||s.finished.then(r,r)}addAppearEffect(e,i){var z;let o=(z=e==null?void 0:e.querySelector("img"))!=null?z:null;if(!o){this.state.viewer.appear=!0;return}let r=ge(o),s=o.offsetWidth,n=o.offsetHeight,c=O(),p=D(),E=p-this.state.options.headerHeight-this.state.options.footerHeight,v=1;this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag?s>n?v=p/n:v=c/s:(s>=n?i.height<E?v=i.width/s:v=E/n:i.height<E?v=i.height/n:v=E/n,s*v>c&&(v=c/s));let x=(v-1)/2*s+(c-s*v)/2,b=(v-1)/2*n+(p-n*v)/2,I=o.getAttribute(this.state.options.lazyAttribute);this.state.viewer.appearEffect={width:s,height:n,top:r.top,left:r.left,once:!0,img:I||i.src||"",afterX:x,afterY:b,scale:v}}runAppearEffect(e){this.view.showAppearEffect(e);let i=this.view.refs.imgClone;return new Promise(o=>{let r=()=>{i.removeEventListener("transitionend",r,!0),o()};i.addEventListener("transitionend",r,!0),this.scheduleTimeout(()=>{i.style.transform=`translate(${e.afterX}px, ${e.afterY}px) scale(${e.scale})`},10)})}doOpen(e,i){if(this.state.options.showAnimation!==!1&&this.supportsViewTransition())this.openPhotoWithViewTransition(e);else if(this.state.options.showAnimation===!1)this.initPhoto(),this.state.viewer.appear=!0,this.commit();else{this.initPhoto(),this.addAppearEffect(e,i),this.commit();let o=this.state.viewer.appearEffect;o&&this.runAppearEffect(o).then(()=>{this.state.viewer.appearEffect=null,this.view.removeAppearEffect(),this.state.viewer.appear=!0,this.commit()})}this.fireEvent("open"),this.resyncSizeAfterOpen()}resyncSizeAfterOpen(){let e=O(),i=D();requestAnimationFrame(()=>{this.state.viewer.isOpen&&(O()===e&&D()===i||(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.view.render(this.state)))})}openPhoto(e,i){this.lastTriggerElement=i,this.state.viewer.currentGroup=e.groupId,this.state.viewer.currentIndex=e.index,this.syncedGroupId!==e.groupId&&this.syncCurrentGroupView(),this.setHashByCurrentIndex(),e.loaded?this.doOpen(i,e):this.loadItem(e).then(()=>{this.doOpen(i,e)})}doHideEffect(e){return new Promise(i=>{let o=this.view.refs.dialog,r=this.currentImgElement(),s=D(),n=e==="top"?`translateY(-${s}px)`:`translateY(${s}px)`,c=()=>{this.finishHideEffect===c&&(this.finishHideEffect=null,o.removeEventListener("transitionend",c,!0),r&&r.style.transform===n&&(r.style.transform=""),i())};this.finishHideEffect=c,r&&(r.style.transform=n),o.addEventListener("transitionend",c,!0),this.scheduleTimeout(c,this.state.options.animationSpeed+100)})}loadItem(e){return new Promise(i=>{var r;let o=new Image;o.onload=()=>{e.width=o.width,e.height=o.height,e.loaded=!0,this.checkLoadAll(e.groupId),i()},o.onerror=()=>i(),o.src=(r=e.src)!=null?r:""})}checkLoadAll(e){if(this.loadAllFired.has(e))return;let i=this.state.groups.get(e);i!=null&&i.length&&i.every(o=>o.loaded)&&(this.loadAllFired.add(e),this.fireEvent("loadall"))}loadNeighborItems(){let e=H(this.state);if(!e)return;let{currentIndex:i}=this.state.viewer,{loadOffset:o}=this.state.options,r=[];for(let s=i-o;s<i+o;s++){let n=e[s];n&&!n.loaded&&r.push(this.loadItem(n))}r.length&&Promise.all(r).then(()=>{this.initPhoto(),this.commit()})}slideList(){this.state.viewer.scaleSize=1,this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.state.viewer.onMove=!0,this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.scheduleTimeout(()=>{let e=M(this.state);this.state.viewer.onMove=!1,de(this.state),this.commit(),this.state.viewer.oldIndex!==this.state.viewer.currentIndex&&this.fireEvent("change"),this.state.viewer.oldIndex=this.state.viewer.currentIndex,this.loadNeighborItems(),e&&!e.loaded&&this.loadItem(e).then(()=>{this.initPhoto(),this.commit()})},200)}scheduleTimeout(e,i){let o=window.setTimeout(()=>{this.timeouts=this.timeouts.filter(r=>r!==o),e()},i);return this.timeouts.push(o),o}fireEvent(e){se(this.view.refs.dialog,e)}buildViewHandlers(){return{onDismiss:()=>this.hidePhoto(),onPrev:()=>this.prev(),onNext:()=>this.next(),onNavigate:e=>this.gotoSlide(e),onBackdropClick:()=>this.hidePhoto()}}buildGestureCallbacks(){return{onSwipeStart:()=>this.fireEvent("swipestart"),onSwipeMove:()=>this.view.updateListTransform(this.state),onSwipeEnd:e=>{if(this.fireEvent("swipeend"),e==="close-bottom"){this.hidePhoto("bottom");return}if(e==="close-top"){this.hidePhoto("top");return}e==="prev"?this.state.viewer.currentIndex-=1:e==="next"&&(this.state.viewer.currentIndex+=1),this.slideList()},onTap:()=>this.zoomPhoto(),onGestureStart:()=>{this.fireEvent("gesturestart"),this.view.updatePhotoTransform(this.state)},onGestureMove:()=>this.view.updatePhotoTransform(this.state),onGestureEnd:()=>{this.fireEvent("gestureend"),this.view.updatePhotoTransform(this.state)},onPhotoDragMove:()=>this.view.updatePhotoTransform(this.state),onPhotoDragEnd:e=>{if(e==="zoom-out"){this.zoomOutPhoto();return}if(e==="prev"){this.gotoSlide(this.state.viewer.prev);return}if(e==="next"){this.gotoSlide(this.state.viewer.next);return}this.view.updatePhotoTransform(this.state)}}}};var Fe=F;return De(Re);})();
|
|
6
|
+
"use strict";var SmartPhoto=(()=>{var he=Object.defineProperty;var Ve=Object.getOwnPropertyDescriptor;var Ge=Object.getOwnPropertyNames;var Fe=Object.prototype.hasOwnProperty;var $e=(t,e)=>{for(var i in e)he(t,i,{get:e[i],enumerable:!0})},ke=(t,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ge(e))!Fe.call(t,r)&&r!==i&&he(t,r,{get:()=>e[r],enumerable:!(o=Ve(e,r))||o.enumerable});return t};var We=t=>ke(he({},"__esModule",{value:!0}),t);var Je={};$e(Je,{default:()=>Qe});var Q=()=>{let t=navigator.userAgent;return t.indexOf("iPhone")>0||t.indexOf("iPad")>0||t.indexOf("ipod")>0||t.indexOf("Android")>0};function Pe(t,...e){var i;t=t||{};for(let o=0;o<e.length;o++){let r=e[o];if(r){for(let s in r)if(Object.hasOwn(r,s)){let n=r[s];n&&typeof n=="object"?t[s]=Pe((i=t[s])!=null?i:{},n):t[s]=n}}}return t}var be=Pe,ue=(t,e,i)=>{let o;window.CustomEvent?o=new CustomEvent(e,{cancelable:!0}):(o=document.createEvent("CustomEvent"),o.initCustomEvent(e,!1,!1,i)),t.dispatchEvent(o)},ye=t=>{let e={};for(let i of t.split("&")){let o=i.split("="),r=o[0],s=o.length>1?o.slice(1).join("="):r;e[r]=decodeURIComponent(s)}return e},Se=t=>({left:t.getBoundingClientRect().left,top:t.getBoundingClientRect().top});var Re={classNames:{smartPhoto:"smartphoto",smartPhotoClose:"smartphoto-close",smartPhotoBody:"smartphoto-body",smartPhotoInner:"smartphoto-inner",smartPhotoContent:"smartphoto-content",smartPhotoImg:"smartphoto-img",smartPhotoImgOnMove:"smartphoto-img-onmove",smartPhotoImgElasticMove:"smartphoto-img-elasticmove",smartPhotoImgWrap:"smartphoto-img-wrap",smartPhotoArrows:"smartphoto-arrows",smartPhotoNav:"smartphoto-nav",smartPhotoArrowRight:"smartphoto-arrow-right",smartPhotoArrowLeft:"smartphoto-arrow-left",smartPhotoArrowHideIcon:"smartphoto-arrow-hide",smartPhotoImgLeft:"smartphoto-img-left",smartPhotoImgRight:"smartphoto-img-right",smartPhotoList:"smartphoto-list",smartPhotoListOnMove:"smartphoto-list-onmove",smartPhotoHeader:"smartphoto-header",smartPhotoCount:"smartphoto-count",smartPhotoCaption:"smartphoto-caption",smartPhotoDismiss:"smartphoto-dismiss",smartPhotoLoader:"smartphoto-loader",smartPhotoLoaderWrap:"smartphoto-loader-wrap",smartPhotoImgClone:"smartphoto-img-clone"},message:{gotoNextImage:"go to the next image",gotoPrevImage:"go to the previous image",closeDialog:"close the image dialog",carouselLabel:"Images"},arrows:!0,nav:!0,showAnimation:!0,verticalGravity:!1,useOrientationApi:!1,useHistoryApi:!0,swipeTopToClose:!1,swipeBottomToClose:!0,swipeOffset:100,swipeVelocity:.5,headerHeight:60,footerHeight:60,forceInterval:10,registance:.5,loadOffset:2,resizeStyle:"fit",lazyAttribute:"data-src",animationSpeed:300};function xe(t){return Object.keys(t).forEach(e=>{let i=t[e];i&&typeof i=="object"&&!Object.isFrozen(i)&&xe(i)}),Object.freeze(t)}function Ie(t){return{options:xe(be({},Re,t)),viewer:{isOpen:!1,currentGroup:null,currentIndex:0,oldIndex:0,total:0,translateX:0,translateY:0,photoPosX:0,photoPosY:0,scaleSize:1,scale:!1,elastic:!1,hideUi:!1,onMove:!1,appear:!1,appearEffect:null,prev:-1,next:-1,showPrevArrow:!1,showNextArrow:!1},groups:new Map}}function ce(t){return t.getAttribute("data-group")||"nogroup"}function me(t){return t.group||"nogroup"}function Le(t,e,i,o){let r=ce(t),s=t.getAttribute("href"),n=t.querySelector("img"),c=s;n&&(n.getAttribute(e.lazyAttribute)?c=n.getAttribute(e.lazyAttribute):n.currentSrc?c=n.currentSrc:c=n.src);let m="";n!=null&&n.getAttribute("alt")?m=n.getAttribute("alt"):t.getAttribute("data-caption")?m=t.getAttribute("data-caption"):m=s!=null?s:"";let v=t.getAttribute("data-id");return{src:s,thumb:c,caption:t.getAttribute("data-caption"),alt:m,groupId:r,translateX:o*i,translateY:0,index:i,width:50,height:50,scale:1,x:0,y:0,id:v||i,loaded:!1,processed:!1,element:t}}function Ce(t,e,i){var v,g,b,C,y;let o=me(t),r=t.src,s=(v=t.thumb)!=null?v:r,n=(g=t.caption)!=null?g:null,c=(C=(b=t.alt)!=null?b:n)!=null?C:r,m=typeof t.width=="number"&&typeof t.height=="number";return{src:r,thumb:s,caption:n,alt:c,groupId:o,translateX:i*e,translateY:0,index:e,width:m?t.width:50,height:m?t.height:50,scale:1,x:0,y:0,id:(y=t.id)!=null?y:e,loaded:m,processed:!1,element:null}}function pe(t,e){t.groups.has(e.groupId)||t.groups.set(e.groupId,[]),t.groups.get(e.groupId).push(e),t.viewer.currentGroup=e.groupId}function M(t){var e;return t.viewer.currentGroup===null?null:(e=t.groups.get(t.viewer.currentGroup))!=null?e:null}function H(t){var i;let e=M(t);return e&&(i=e[t.viewer.currentIndex])!=null?i:null}function fe(t){let e=M(t);if(!e)return;let i=e.length,o=t.viewer.currentIndex+1,r=t.viewer.currentIndex-1;t.viewer.showNextArrow=!1,t.viewer.showPrevArrow=!1,o!==i&&(t.viewer.next=o,t.viewer.showNextArrow=!0),r!==-1&&(t.viewer.prev=r,t.viewer.showPrevArrow=!0)}function Te(t,e){t.forEach((i,o)=>{i.translateX=e*o})}function J(t,e){let i=10**e;return Math.round(t*i)/i}function j(t,e,i,o){return o?t.width>t.height?i/(t.height*t.scale):e/(t.width*t.scale):1/t.scale}function Ae(t,e,i,o){let r=t.width*t.scale*e.scaleSize,s=t.height*t.scale*e.scaleSize,n,c,m,v;return i>r?(m=(i-r)/2,n=-1*m):(m=(r-i)/2,n=-1*m),o>s?(v=(o-s)/2,c=-1*v):(v=(s-o)/2,c=-1*v),{minX:J(n,6)*e.scaleSize,minY:J(c,6)*e.scaleSize,maxX:J(m,6)*e.scaleSize,maxY:J(v,6)*e.scaleSize}}function Me(t,e,i,o,r){let s=i-(o+r);t.forEach(n=>{n.loaded&&(n.processed=!0,n.scale=s/n.height,n.height<s&&(n.scale=1),n.x=(n.scale-1)/2*n.width+(e-n.width*n.scale)/2,n.y=(n.scale-1)/2*n.height+(i-n.height*n.scale)/2,n.width*n.scale>e&&(n.scale=e/n.width,n.x=(n.scale-1)/2*n.width))})}function He(t){let e=H(t);return e?`group=${t.viewer.currentGroup}&photo=${e.id}`:""}function ze(t,e){let i=null;return t.groups.forEach(o=>{o.forEach(r=>{e.group===r.groupId&&e.photo===r.id&&(i=r)})}),i}function ve(t,e){let i=10**e;return Math.round(t*i)/i}function W(t){return{x:t.pageX,y:t.pageY}}function Oe(t,e){let i=t.x-e.x,o=t.y-e.y;return Math.sqrt(i*i+o*o)}var Ue=10;function qe(t,e){return{force:Math.sqrt(t*t+e*e),theta:Math.atan2(e,t)}}function Xe(){return{width:document.documentElement.clientWidth,height:document.documentElement.clientHeight}}function Ne({state:t,callbacks:e},{signal:i}){let o=new Map,r=Date.now(),s=!1,n=!1,c=null,m=null,v=null,g=0,b=!1,C=null,y=null,z=0,O=0,A=!1,V=0,S=null,L=0,X=0;function u(){return Q()}function R(a){let{width:h,height:E}=Xe();return Ae(a,t.viewer,h,E)}function U(a){let{width:h,height:E}=Xe();return j(a,h,E,u())}function ee(a,h){let E=H(t),w=R(E);t.viewer.elastic=!0,a===1?t.viewer.photoPosX=w.minX:a===-1&&(t.viewer.photoPosX=w.maxX),h===1?t.viewer.photoPosY=w.minY:h===-1&&(t.viewer.photoPosY=w.maxY),e.onPhotoDragMove(),setTimeout(()=>{t.viewer.elastic=!1,e.onPhotoDragMove()},300)}let te=setInterval(()=>{if(A||s||b||t.viewer.elastic||!t.viewer.scale)return;t.viewer.photoPosX+=L,t.viewer.photoPosY+=X;let a=H(t);if(!a)return;let h=R(a);t.viewer.photoPosX<h.minX?(t.viewer.photoPosX=h.minX,L*=-.2):t.viewer.photoPosX>h.maxX&&(t.viewer.photoPosX=h.maxX,L*=-.2),t.viewer.photoPosY<h.minY?(t.viewer.photoPosY=h.minY,X*=-.2):t.viewer.photoPosY>h.maxY&&(t.viewer.photoPosY=h.maxY,X*=-.2);let E=qe(L,X),w=E.force-t.options.registance;Math.abs(w)<.5||(L=Math.cos(E.theta)*w,X=Math.sin(E.theta)*w,e.onPhotoDragMove())},t.options.forceInterval);function N(a,h){(a>5||a<-5)&&(L+=a*.05),t.options.verticalGravity&&(h>5||h<-5)&&(X+=h*.05)}function _(a){if(!(a!=null&&a.gamma)||t.viewer.appearEffect||A||s||b||t.viewer.elastic||!t.viewer.scale)return;let{orientation:h}=window;h===0?N(a.gamma,a.beta):h===90?N(a.beta,a.gamma):h===-90?N(-a.beta,-a.gamma):h===180&&N(-a.gamma,-a.beta)}t.options.useOrientationApi&&window.addEventListener("deviceorientation",_,{signal:i});function ie(){A=!0,s=!1,b=!1;let a=Array.from(o.values());V=Oe(a[0],a[1]),t.viewer.scale=!0,e.onGestureStart()}function oe(a){let h=W(a);s=!0,n=!0,c=h,m=h,g=Date.now()}function re(a){b=!0;let h=W(a);y=h,C=h}function ne(a){var h,E;try{(E=(h=a.currentTarget).setPointerCapture)==null||E.call(h,a.pointerId)}catch(w){}if(o.set(a.pointerId,W(a)),o.size>1){ie();return}if(t.viewer.scale){re(a);return}oe(a)}function se(){S===null&&(S=requestAnimationFrame(()=>{S=null,e.onGestureMove()}))}function ae(){S!==null&&(cancelAnimationFrame(S),S=null,e.onGestureMove())}function d(){let a=Array.from(o.values()),h=Oe(a[0],a[1]),E=(h-V)/100,w=t.viewer.scaleSize,I=t.viewer.photoPosX,T=t.viewer.photoPosY;t.viewer.scaleSize+=ve(E,6),t.viewer.scaleSize<.2&&(t.viewer.scaleSize=.2),t.viewer.scaleSize<w&&(t.viewer.photoPosX=(1+t.viewer.scaleSize-w)*I,t.viewer.photoPosY=(1+t.viewer.scaleSize-w)*T);let B=H(t);if(B){let le=U(B);t.viewer.hideUi=t.viewer.scaleSize<1||t.viewer.scaleSize>le}V=h,se()}function l(a){let h=W(a),E=h.x-m.x,w=h.y-c.y;n&&(e.onSwipeStart(),n=!1,v=Math.abs(E)>Math.abs(w)?"horizontal":"vertical"),v==="horizontal"?t.viewer.translateX+=E:t.viewer.translateY=w,m=h,e.onSwipeMove()}function P(a){let h=W(a),E=h.x-y.x,w=h.y-y.y,I=ve(t.viewer.scaleSize*E,6),T=ve(t.viewer.scaleSize*w,6);t.viewer.photoPosX+=I,z=I,t.viewer.photoPosY+=T,O=T,y=h,e.onPhotoDragMove()}function f(a){if(o.has(a.pointerId)){if(o.set(a.pointerId,W(a)),A){d();return}if(b){P(a);return}l(a)}}function p(){A=!1,ae();let a=H(t);if(!a)return;let h=U(a);t.viewer.scaleSize>h||(t.viewer.photoPosX=0,t.viewer.photoPosY=0,t.viewer.scale=!1,t.viewer.scaleSize=1,t.viewer.hideUi=!1,e.onGestureEnd())}function x(){var ge;s=!1;let a=c,h=m,E=Date.now(),w=r-E,I=h.x-a.x,T=h.y-a.y,B=I===0&&T===0;if(!u()&&B){e.onTap();return}if(Math.abs(w)<=500&&B){e.onTap();return}r=E;let le=(ge=M(t))!=null?ge:[];if(v==="horizontal"){let k="stay",Be=Math.max(E-g,1),Ee=Math.abs(I)>=Ue&&Math.abs(I)/Be>=t.options.swipeVelocity;(I>=t.options.swipeOffset||Ee&&I>0)&&t.viewer.currentIndex!==0?k="prev":(I<=-t.options.swipeOffset||Ee&&I<0)&&t.viewer.currentIndex!==le.length-1&&(k="next"),e.onSwipeEnd(k)}else{let k="stay";t.options.swipeBottomToClose&&T>=t.options.swipeOffset?k="close-bottom":t.options.swipeTopToClose&&T<=-t.options.swipeOffset&&(k="close-top"),e.onSwipeEnd(k)}}function $(){b=!1;let a=y,h=C;if(a.x===h.x){e.onPhotoDragEnd("zoom-out");return}let E=H(t);if(!E){e.onPhotoDragEnd(null);return}let w=R(E),I=t.options.swipeOffset*t.viewer.scaleSize,T=0,B=0;if(t.viewer.photoPosX>w.maxX?T=-1:t.viewer.photoPosX<w.minX&&(T=1),t.viewer.photoPosY>w.maxY?B=-1:t.viewer.photoPosY<w.minY&&(B=1),t.viewer.photoPosX-w.maxX>I&&t.viewer.currentIndex!==0){e.onPhotoDragEnd("prev");return}if(w.minX-t.viewer.photoPosX>I&&t.viewer.currentIndex+1!==t.viewer.total){e.onPhotoDragEnd("next");return}T===0&&B===0?(L=z/5,X=O/5):ee(T,B),e.onPhotoDragEnd(null)}function q(a){if(o.delete(a.pointerId),A){o.size<2&&p();return}if(b){$();return}s&&x()}function D(...a){for(let h of a)h.addEventListener("pointerdown",ne,{signal:i}),h.addEventListener("pointermove",f,{signal:i}),h.addEventListener("pointerup",q,{signal:i}),h.addEventListener("pointercancel",q,{signal:i})}function G(){clearInterval(te),S!==null&&(cancelAnimationFrame(S),S=null)}return{attach:D,detach:G}}function Z(t){let e=document.createElement("span");return e.className="smartphoto-sr-only",e.textContent=t,e}function we(){let t=document.createElement("button");return t.type="button",t}function je(t){return t.replace(/"/g,'\\"')}function Ye({id:t,options:e},i,{signal:o}){let{classNames:r,message:s}=e,n=document.createElement("div");n.setAttribute("data-id",t);let c=document.createElement("dialog");c.className=r.smartPhoto,c.setAttribute("aria-labelledby",`smartphoto-${t}-title`),c.style.setProperty("--smartphoto-animation-speed",`${e.animationSpeed}ms`);let m=document.createElement("div");m.className=r.smartPhotoBody;let v=document.createElement("div");v.className=r.smartPhotoInner;let g=document.createElement("div");g.className=r.smartPhotoHeader;let b=document.createElement("span");b.className=r.smartPhotoCount;let C=document.createElement("h1");C.id=`smartphoto-${t}-title`,C.className=r.smartPhotoCaption,C.setAttribute("tabindex","-1");let y=document.createElement("button");y.className=r.smartPhotoDismiss,y.appendChild(Z(s.closeDialog)),y.addEventListener("click",()=>i.onDismiss(),{signal:o}),g.append(b,C,y);let z=document.createElement("div");z.className=r.smartPhotoContent,z.addEventListener("click",d=>{d.target===z&&i.onBackdropClick()},{signal:o});let O=document.createElement("ul");O.className=r.smartPhotoList,O.setAttribute("role","region"),O.setAttribute("aria-roledescription","carousel"),O.setAttribute("aria-label",s.carouselLabel),O.setAttribute("aria-live","polite"),O.setAttribute("aria-atomic","false"),v.append(g,z,O);let A=null,V=null,S=null;if(e.arrows){A=document.createElement("ul"),A.className=r.smartPhotoArrows,V=document.createElement("li"),V.className=r.smartPhotoArrowLeft;let d=we();d.appendChild(Z(s.gotoPrevImage)),d.addEventListener("click",()=>i.onPrev(),{signal:o}),V.appendChild(d),S=document.createElement("li"),S.className=r.smartPhotoArrowRight;let l=we();l.appendChild(Z(s.gotoNextImage)),l.addEventListener("click",()=>i.onNext(),{signal:o}),S.appendChild(l),A.append(V,S),v.appendChild(A)}let L=null,X=null;e.nav&&(L=document.createElement("nav"),L.className=r.smartPhotoNav,L.setAttribute("aria-label","Choose slide to display"),X=document.createElement("ul"),L.appendChild(X),v.appendChild(L)),m.appendChild(v),c.appendChild(m),n.appendChild(c);let u={dialog:c,count:b,caption:C,dismiss:y,content:z,list:O,arrows:A,arrowLeft:V,arrowRight:S,nav:L,navList:X,slides:new Map,imgClone:null};function R(){let d=document.createElement("div");d.className=r.smartPhotoLoaderWrap;let l=document.createElement("span");return l.className=r.smartPhotoLoader,d.appendChild(l),d}function U(d){var f,p;let l=document.createElement("div");l.className=r.smartPhotoImgWrap;let P=document.createElement("img");return P.className=r.smartPhotoImg,P.src=(f=d.src)!=null?f:"",P.alt=(p=d.alt)!=null?p:"",P.addEventListener("dragstart",x=>x.preventDefault(),{signal:o}),l.appendChild(P),{imgWrap:l,img:P}}function ee(d,l){var P;u.list.replaceChildren(),(P=u.navList)==null||P.replaceChildren(),u.slides=new Map,d.forEach(f=>{var $,q;let p=document.createElement("li");p.setAttribute("role","group"),p.setAttribute("aria-roledescription","slide"),p.setAttribute("aria-label",`${f.index+1} of ${d.length}`);let x={li:p,loaderWrap:null,imgWrap:null,img:null,navLink:null};if(f.processed){let{imgWrap:D,img:G}=U(f);p.appendChild(D),x.imgWrap=D,x.img=G}else{let D=R();p.appendChild(D),x.loaderWrap=D}if(u.list.appendChild(p),u.slides.set(f,x),u.navList){let D=document.createElement("li"),G=we();G.style.backgroundImage=`url("${je(($=f.thumb)!=null?$:"")}")`;let a=f.index;G.addEventListener("click",()=>i.onNavigate(a),{signal:o}),G.appendChild(Z(`go to ${(q=f.caption)!=null?q:""}`)),D.appendChild(G),u.navList.appendChild(D),x.navLink=G}}),_(l)}function te(d,l){var p;if(l.imgWrap||!d.processed)return l;let{imgWrap:P,img:f}=U(d);return(p=l.loaderWrap)==null||p.replaceWith(P),l.loaderWrap=null,l.imgWrap=P,l.img=f,l}function N(d){d&&document.activeElement&&d.contains(document.activeElement)&&u.caption.focus()}function _(d){let{viewer:l}=d;u.count.textContent=`${l.currentIndex+1}/${l.total}`,u.slides.forEach((P,f)=>{var $;let p=te(f,P),x=f.index===l.currentIndex;p.li.style.transform=`translate(${f.translateX}px,${f.translateY}px)`,p.li.classList.toggle("current",x),x?p.li.removeAttribute("aria-hidden"):p.li.setAttribute("aria-hidden","true"),x&&(u.caption.textContent=($=f.caption)!=null?$:""),p.imgWrap&&p.img&&(p.imgWrap.style.transform=`translate(${f.x}px,${f.y}px) scale(${f.scale})`,p.img.style.width=`${f.width}px`,p.img.classList.toggle("active",l.appear),p.img.classList.toggle(r.smartPhotoImgOnMove,l.scale),p.img.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),p.navLink&&(p.navLink.classList.toggle("current",x),x?p.navLink.setAttribute("aria-current","true"):p.navLink.removeAttribute("aria-current"))}),u.arrowLeft&&(l.showPrevArrow?u.arrowLeft.removeAttribute("aria-hidden"):(N(u.arrowLeft),u.arrowLeft.setAttribute("aria-hidden","true"))),u.arrowRight&&(l.showNextArrow?u.arrowRight.removeAttribute("aria-hidden"):(N(u.arrowRight),u.arrowRight.setAttribute("aria-hidden","true"))),u.arrows&&(l.hideUi&&N(u.arrows),u.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false")),u.nav&&(l.hideUi&&N(u.nav),u.nav.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function ie(d){for(let[l,P]of u.slides)if(l.index===d.viewer.currentIndex)return P;return null}function oe(d){let{viewer:l}=d,P=ie(d),f=P==null?void 0:P.img;f&&(f.style.transform=`translate(${l.photoPosX}px,${l.photoPosY}px) scale(${l.scaleSize})`,f.classList.toggle(r.smartPhotoImgOnMove,l.scale),f.classList.toggle(r.smartPhotoImgElasticMove,l.elastic)),u.nav&&(l.hideUi&&N(u.nav),u.nav.setAttribute("aria-hidden",l.hideUi?"true":"false")),u.arrows&&(l.hideUi&&N(u.arrows),u.arrows.setAttribute("aria-hidden",l.hideUi?"true":"false"))}function re(d){let{viewer:l}=d;u.list.style.transform=`translate(${l.translateX}px,${l.translateY}px)`,u.list.classList.toggle(r.smartPhotoListOnMove,l.onMove)}function ne(d){let l=document.createElement("img");l.className=r.smartPhotoImgClone,l.src=d.img,l.style.width=`${d.width}px`,l.style.height=`${d.height}px`,l.style.transform=`translate(${d.left}px,${d.top}px) scale(1)`,m.appendChild(l),u.imgClone=l}function se(){var d;(d=u.imgClone)==null||d.remove(),u.imgClone=null}function ae(){n.remove()}return{root:n,refs:u,render:_,syncSlides:ee,updatePhotoTransform:oe,updateListTransform:re,showAppearEffect:ne,removeAppearEffect:se,destroy:ae}}function Y(){return document.documentElement.clientWidth}function F(){let t=window.visualViewport;return t?t.height*t.scale:document.documentElement.clientHeight}function Ke(t){return t.length>0&&t[0]instanceof Element}function _e(){return(Date.now().toString(36)+Math.random().toString(36).substring(2,7)).toUpperCase()}function De(){return{x:window.pageXOffset!==void 0?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==void 0?window.pageYOffset:document.documentElement.scrollTop}}var K=class{constructor(e,i){this.id=_e();this.abortController=new AbortController;this.isSmartPhoneFlag=Q();this.lastTriggerElement=null;this.isFiringPublicCloseEvent=!1;this.finishHideEffect=null;this.timeouts=[];this.loadAllFired=new Set;this.syncedGroupId=null;this.updateViewportHeight=()=>{this.view.refs.dialog.style.setProperty("--smartphoto-vh",`${F()}px`)};this.handleResize=()=>{M(this.state)&&(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.commit())};this.handleKeydown=e=>{if(!this.state.viewer.isOpen)return;let i=e.keyCode||e.which;i===37?this.gotoSlide(this.state.viewer.prev):i===39?this.gotoSlide(this.state.viewer.next):i===27&&this.hidePhoto()};this.handleOrientationChange=()=>{if(!M(this.state))return;this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit();let e=Y(),i=500,o=r=>{this.scheduleTimeout(()=>{e!==Y()?(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.commit()):r<=i&&o(r+25)},25)};o(0)};this.state=Ie(i!=null?i:{}),this.view=Ye({id:this.id,options:this.state.options},this.buildViewHandlers(),{signal:this.abortController.signal}),document.body.appendChild(this.view.root),this.gestures=Ne({state:this.state,callbacks:this.buildGestureCallbacks()},{signal:this.abortController.signal}),this.gestures.attach(this.view.refs.content,this.view.refs.list),this.view.refs.dialog.addEventListener("close",()=>{!this.isFiringPublicCloseEvent&&this.state.viewer.isOpen&&this.hidePhoto()},{signal:this.abortController.signal}),this.ingestSource(e),this.syncCurrentGroupView();let o=this.restoreFromHash();if(o&&(o.element?ue(o.element,"click"):this.openPhoto(o,null)),this.updateViewportHeight(),window.visualViewport?window.visualViewport.addEventListener("resize",this.updateViewportHeight,{signal:this.abortController.signal}):window.addEventListener("resize",this.updateViewportHeight,{signal:this.abortController.signal}),!this.isSmartPhoneFlag){window.addEventListener("resize",this.handleResize,{signal:this.abortController.signal}),window.addEventListener("keydown",this.handleKeydown,{signal:this.abortController.signal});return}window.addEventListener("orientationchange",this.handleOrientationChange,{signal:this.abortController.signal})}on(e,i){let o=this.view.refs.dialog,r=s=>i.call(o,s);o.addEventListener(e,r,{signal:this.abortController.signal})}destroy(){this.state.viewer.isOpen=!1,this.view.refs.dialog.open&&this.view.refs.dialog.close(),this.abortController.abort(),this.timeouts.forEach(e=>{clearTimeout(e)}),this.timeouts=[],this.gestures.detach(),this.view.destroy()}[Symbol.dispose](){this.destroy()}gotoSlide(e){this.state.viewer.currentIndex=Number.parseInt(String(e),10),this.state.viewer.currentIndex||(this.state.viewer.currentIndex=0),this.slideList()}hidePhoto(e="bottom"){var o;if(!this.state.viewer.isOpen)return;this.state.viewer.isOpen=!1,this.state.viewer.appear=!1,this.state.viewer.appearEffect=null,this.view.removeAppearEffect(),this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.scaleSize=1;let i=De();location.hash&&this.setHash(""),window.scroll(i.x,i.y),this.syncDialog(),(o=this.lastTriggerElement)!=null&&o.isConnected&&this.lastTriggerElement.focus(),this.lastTriggerElement=null,this.doHideEffect(e).then(()=>{this.view.render(this.state),this.isFiringPublicCloseEvent=!0,this.fireEvent("close"),this.isFiringPublicCloseEvent=!1})}zoomPhoto(){let e=H(this.state);e&&(this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=j(e,Y(),F(),this.isSmartPhoneFlag),!(this.state.viewer.scaleSize<=1)&&(this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.view.updatePhotoTransform(this.state),this.scheduleTimeout(()=>{this.state.viewer.scale=!0,this.view.updatePhotoTransform(this.state),this.fireEvent("zoomin")},300)))}zoomOutPhoto(){this.state.viewer.scaleSize=1,this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.view.updatePhotoTransform(this.state),this.fireEvent("zoomout")}addNewItem(e){return this.addItem(e)}show(e=0,i={}){var m,v,g;let o=(m=i.group)!=null?m:this.state.viewer.currentGroup;if(o===null)return;let r=this.state.groups.get(o);if(!(r!=null&&r.length))return;let s=typeof e=="number"?r[e]:r.find(b=>b.id===e);if(!s)return;let n=document.activeElement instanceof HTMLElement?document.activeElement:null,c=(g=(v=i.trigger)!=null?v:s.element)!=null?g:n;this.openPhoto(s,c)}hide(){this.hidePhoto()}next(){this.state.viewer.showNextArrow&&this.gotoSlide(this.state.viewer.next)}prev(){this.state.viewer.showPrevArrow&&this.gotoSlide(this.state.viewer.prev)}addItem(e){let i=e instanceof Element?this.addElementItem(e):this.addSlideItem(e);return this.syncCurrentGroupView(),i}get currentIndex(){return this.state.viewer.currentIndex}ingestSource(e){if(Array.isArray(e)&&!Ke(e)){e.forEach(o=>{this.addSlideItem(o)});return}Array.from(typeof e=="string"?document.querySelectorAll(e):e).forEach(o=>{this.addElementItem(o)})}addElementItem(e){var s,n;let i=ce(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=Le(e,this.state.options,o,Y());return pe(this.state,r),this.loadAllFired.delete(i),this.bindThumbnailClick(e,r),r}addSlideItem(e){var s,n;let i=me(e),o=(n=(s=this.state.groups.get(i))==null?void 0:s.length)!=null?n:0,r=Ce(e,o,Y());return pe(this.state,r),this.loadAllFired.delete(i),r}bindThumbnailClick(e,i){e.addEventListener("click",o=>{o.preventDefault(),this.openPhoto(i,e)},{signal:this.abortController.signal})}syncCurrentGroupView(){let e=M(this.state);e&&(this.view.syncSlides(e,this.state),this.syncedGroupId=this.state.viewer.currentGroup)}setHash(e){var o;if(!((o=window.history)!=null&&o.pushState)||!this.state.options.useHistoryApi)return;let i=`${location.pathname}${location.search}`;window.history.replaceState(null,"",e?`${i}#${e}`:i)}setHashByCurrentIndex(){let e=De();this.setHash(He(this.state)),window.scroll(e.x,e.y)}restoreFromHash(){let e=location.hash.substring(1);return e?ze(this.state,ye(e)):null}setPosByCurrentIndex(){let e=H(this.state);e&&(this.state.viewer.translateX=-e.translateX,this.state.viewer.translateY=0,this.view.updateListTransform(this.state))}setSizeByScreen(){let e=M(this.state);e&&Me(e,Y(),F(),this.state.options.headerHeight,this.state.options.footerHeight)}resetTranslateCurrent(){Te(M(this.state),Y())}currentImgElement(){for(let[e,i]of this.view.refs.slides)if(e.index===this.state.viewer.currentIndex)return i.img;return null}syncDialog(){let{dialog:e,caption:i}=this.view.refs;this.state.viewer.isOpen&&!e.open?(e.showModal(),i.focus()):!this.state.viewer.isOpen&&e.open&&e.close()}commit(){this.view.render(this.state),this.syncDialog()}initPhoto(){var i;(i=this.finishHideEffect)==null||i.call(this),this.view.refs.dialog.style.opacity="";let e=M(this.state);if(this.state.viewer.total=e.length,this.state.viewer.isOpen=!0,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.setPosByCurrentIndex(),this.setSizeByScreen(),fe(this.state),this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag){let o=H(this.state);this.state.viewer.scale=!0,this.state.viewer.hideUi=!0,this.state.viewer.scaleSize=j(o,Y(),F(),this.isSmartPhoneFlag)}}supportsViewTransition(){return typeof document.startViewTransition=="function"}openPhotoWithViewTransition(e){var n,c;document.documentElement.style.setProperty("--smartphoto-animation-speed",`${this.state.options.animationSpeed}ms`);let i="smartphoto-hero",o=(n=e==null?void 0:e.querySelector("img"))!=null?n:null;o&&(o.style.viewTransitionName=i);let r=()=>{o&&(o.style.viewTransitionName="");let m=this.currentImgElement();m&&(m.style.viewTransitionName="")},s=(c=document.startViewTransition)==null?void 0:c.call(document,()=>{this.initPhoto(),this.state.viewer.appear=!0,this.commit(),o&&(o.style.viewTransitionName=""),this.currentImgElement().style.viewTransitionName=i});s==null||s.ready.catch(()=>{r()}),s==null||s.finished.then(r,r)}addAppearEffect(e,i){var z;let o=(z=e==null?void 0:e.querySelector("img"))!=null?z:null;if(!o){this.state.viewer.appear=!0;return}let r=Se(o),s=o.offsetWidth,n=o.offsetHeight,c=Y(),m=F(),v=m-this.state.options.headerHeight-this.state.options.footerHeight,g=1;this.state.options.resizeStyle==="fill"&&this.isSmartPhoneFlag?s>n?g=m/n:g=c/s:(s>=n?i.height<v?g=i.width/s:g=v/n:i.height<v?g=i.height/n:g=v/n,s*g>c&&(g=c/s));let b=(g-1)/2*s+(c-s*g)/2,C=(g-1)/2*n+(m-n*g)/2,y=o.getAttribute(this.state.options.lazyAttribute);this.state.viewer.appearEffect={width:s,height:n,top:r.top,left:r.left,once:!0,img:y||i.src||"",afterX:b,afterY:C,scale:g}}runAppearEffect(e){this.view.showAppearEffect(e);let i=this.view.refs.imgClone;return new Promise(o=>{let r=()=>{i.removeEventListener("transitionend",r,!0),o()};i.addEventListener("transitionend",r,!0),this.scheduleTimeout(()=>{i.style.transform=`translate(${e.afterX}px, ${e.afterY}px) scale(${e.scale})`},10)})}doOpen(e,i){if(this.state.options.showAnimation!==!1&&this.supportsViewTransition())this.openPhotoWithViewTransition(e);else if(this.state.options.showAnimation===!1)this.initPhoto(),this.state.viewer.appear=!0,this.commit();else{this.initPhoto(),this.addAppearEffect(e,i),this.commit();let o=this.state.viewer.appearEffect;o&&this.runAppearEffect(o).then(()=>{this.state.viewer.appearEffect=null,this.view.removeAppearEffect(),this.state.viewer.appear=!0,this.commit()})}this.fireEvent("open"),this.resyncSizeAfterOpen()}resyncSizeAfterOpen(){let e=Y(),i=F();requestAnimationFrame(()=>{this.state.viewer.isOpen&&(Y()===e&&F()===i||(this.resetTranslateCurrent(),this.setPosByCurrentIndex(),this.setSizeByScreen(),this.view.render(this.state)))})}openPhoto(e,i){this.lastTriggerElement=i,this.state.viewer.currentGroup=e.groupId,this.state.viewer.currentIndex=e.index,this.syncedGroupId!==e.groupId&&this.syncCurrentGroupView(),this.setHashByCurrentIndex(),e.loaded?this.doOpen(i,e):this.loadItem(e).then(()=>{this.doOpen(i,e)})}doHideEffect(e){return new Promise(i=>{let o=this.view.refs.dialog,r=this.currentImgElement(),s=F(),n=e==="top"?`translateY(-${s}px)`:`translateY(${s}px)`,c=()=>{this.finishHideEffect===c&&(this.finishHideEffect=null,o.removeEventListener("transitionend",c,!0),r&&r.style.transform===n&&(r.style.transform=""),i())};this.finishHideEffect=c,r&&(r.style.transform=n),o.addEventListener("transitionend",c,!0),this.scheduleTimeout(c,this.state.options.animationSpeed+100)})}loadItem(e){return new Promise(i=>{var r;let o=new Image;o.onload=()=>{e.width=o.width,e.height=o.height,e.loaded=!0,this.checkLoadAll(e.groupId),i()},o.onerror=()=>i(),o.src=(r=e.src)!=null?r:""})}checkLoadAll(e){if(this.loadAllFired.has(e))return;let i=this.state.groups.get(e);i!=null&&i.length&&i.every(o=>o.loaded)&&(this.loadAllFired.add(e),this.fireEvent("loadall"))}loadNeighborItems(){let e=M(this.state);if(!e)return;let{currentIndex:i}=this.state.viewer,{loadOffset:o}=this.state.options,r=[];for(let s=i-o;s<i+o;s++){let n=e[s];n&&!n.loaded&&r.push(this.loadItem(n))}r.length&&Promise.all(r).then(()=>{this.initPhoto(),this.commit()})}slideList(){this.state.viewer.scaleSize=1,this.state.viewer.hideUi=!1,this.state.viewer.scale=!1,this.state.viewer.photoPosX=0,this.state.viewer.photoPosY=0,this.state.viewer.onMove=!0,this.setPosByCurrentIndex(),this.setHashByCurrentIndex(),this.setSizeByScreen(),this.scheduleTimeout(()=>{let e=H(this.state);this.state.viewer.onMove=!1,fe(this.state),this.commit(),this.state.viewer.oldIndex!==this.state.viewer.currentIndex&&this.fireEvent("change"),this.state.viewer.oldIndex=this.state.viewer.currentIndex,this.loadNeighborItems(),e&&!e.loaded&&this.loadItem(e).then(()=>{this.initPhoto(),this.commit()})},200)}scheduleTimeout(e,i){let o=window.setTimeout(()=>{this.timeouts=this.timeouts.filter(r=>r!==o),e()},i);return this.timeouts.push(o),o}fireEvent(e){ue(this.view.refs.dialog,e)}buildViewHandlers(){return{onDismiss:()=>this.hidePhoto(),onPrev:()=>this.prev(),onNext:()=>this.next(),onNavigate:e=>this.gotoSlide(e),onBackdropClick:()=>this.hidePhoto()}}buildGestureCallbacks(){return{onSwipeStart:()=>this.fireEvent("swipestart"),onSwipeMove:()=>this.view.updateListTransform(this.state),onSwipeEnd:e=>{if(this.fireEvent("swipeend"),e==="close-bottom"){this.hidePhoto("bottom");return}if(e==="close-top"){this.hidePhoto("top");return}e==="prev"?this.state.viewer.currentIndex-=1:e==="next"&&(this.state.viewer.currentIndex+=1),this.slideList()},onTap:()=>this.zoomPhoto(),onGestureStart:()=>{this.fireEvent("gesturestart"),this.view.updatePhotoTransform(this.state)},onGestureMove:()=>this.view.updatePhotoTransform(this.state),onGestureEnd:()=>{this.fireEvent("gestureend"),this.view.updatePhotoTransform(this.state)},onPhotoDragMove:()=>this.view.updatePhotoTransform(this.state),onPhotoDragEnd:e=>{if(e==="zoom-out"){this.zoomOutPhoto();return}if(e==="prev"){this.gotoSlide(this.state.viewer.prev);return}if(e==="next"){this.gotoSlide(this.state.viewer.next);return}this.view.updatePhotoTransform(this.state)}}}};var Qe=K;return We(Je);})();
|
|
7
7
|
SmartPhoto = SmartPhoto.default;
|
package/lib/smartphoto.js
CHANGED
|
@@ -124,6 +124,7 @@ var defaults = {
|
|
|
124
124
|
swipeTopToClose: false,
|
|
125
125
|
swipeBottomToClose: true,
|
|
126
126
|
swipeOffset: 100,
|
|
127
|
+
swipeVelocity: 0.5,
|
|
127
128
|
headerHeight: 60,
|
|
128
129
|
footerHeight: 60,
|
|
129
130
|
forceInterval: 10,
|
|
@@ -381,6 +382,7 @@ function distance(p1, p2) {
|
|
|
381
382
|
const y = p1.y - p2.y;
|
|
382
383
|
return Math.sqrt(x * x + y * y);
|
|
383
384
|
}
|
|
385
|
+
var MIN_FLICK_DISTANCE = 10;
|
|
384
386
|
function getForceAndTheta(x, y) {
|
|
385
387
|
return { force: Math.sqrt(x * x + y * y), theta: Math.atan2(y, x) };
|
|
386
388
|
}
|
|
@@ -398,6 +400,7 @@ function createGestures({ state, callbacks }, { signal }) {
|
|
|
398
400
|
let firstPos = null;
|
|
399
401
|
let oldPos = null;
|
|
400
402
|
let moveDir = null;
|
|
403
|
+
let swipeStartTime = 0;
|
|
401
404
|
let photoSwipable = false;
|
|
402
405
|
let firstPhotoPos = null;
|
|
403
406
|
let oldPhotoPos = null;
|
|
@@ -405,6 +408,7 @@ function createGestures({ state, callbacks }, { signal }) {
|
|
|
405
408
|
let photoVY = 0;
|
|
406
409
|
let pinching = false;
|
|
407
410
|
let oldDistance = 0;
|
|
411
|
+
let pinchMoveFrame = null;
|
|
408
412
|
let vx = 0;
|
|
409
413
|
let vy = 0;
|
|
410
414
|
function isSmartPhone2() {
|
|
@@ -526,6 +530,7 @@ function createGestures({ state, callbacks }, { signal }) {
|
|
|
526
530
|
dragStart = true;
|
|
527
531
|
firstPos = pos;
|
|
528
532
|
oldPos = pos;
|
|
533
|
+
swipeStartTime = Date.now();
|
|
529
534
|
}
|
|
530
535
|
function startPhotoDrag(e) {
|
|
531
536
|
photoSwipable = true;
|
|
@@ -549,6 +554,23 @@ function createGestures({ state, callbacks }, { signal }) {
|
|
|
549
554
|
}
|
|
550
555
|
startSwipe(e);
|
|
551
556
|
}
|
|
557
|
+
function scheduleGestureMove() {
|
|
558
|
+
if (pinchMoveFrame !== null) {
|
|
559
|
+
return;
|
|
560
|
+
}
|
|
561
|
+
pinchMoveFrame = requestAnimationFrame(() => {
|
|
562
|
+
pinchMoveFrame = null;
|
|
563
|
+
callbacks.onGestureMove();
|
|
564
|
+
});
|
|
565
|
+
}
|
|
566
|
+
function flushGestureMove() {
|
|
567
|
+
if (pinchMoveFrame === null) {
|
|
568
|
+
return;
|
|
569
|
+
}
|
|
570
|
+
cancelAnimationFrame(pinchMoveFrame);
|
|
571
|
+
pinchMoveFrame = null;
|
|
572
|
+
callbacks.onGestureMove();
|
|
573
|
+
}
|
|
552
574
|
function movePinch() {
|
|
553
575
|
const points = Array.from(activePointers.values());
|
|
554
576
|
const dist = distance(
|
|
@@ -573,7 +595,7 @@ function createGestures({ state, callbacks }, { signal }) {
|
|
|
573
595
|
state.viewer.hideUi = state.viewer.scaleSize < 1 || state.viewer.scaleSize > border;
|
|
574
596
|
}
|
|
575
597
|
oldDistance = dist;
|
|
576
|
-
|
|
598
|
+
scheduleGestureMove();
|
|
577
599
|
}
|
|
578
600
|
function moveSwipe(e) {
|
|
579
601
|
const pos = getPos(e);
|
|
@@ -622,6 +644,7 @@ function createGestures({ state, callbacks }, { signal }) {
|
|
|
622
644
|
}
|
|
623
645
|
function endPinch() {
|
|
624
646
|
pinching = false;
|
|
647
|
+
flushGestureMove();
|
|
625
648
|
const item = currentItem(state);
|
|
626
649
|
if (!item) {
|
|
627
650
|
return;
|
|
@@ -658,9 +681,11 @@ function createGestures({ state, callbacks }, { signal }) {
|
|
|
658
681
|
const items = currentItems(state) ?? [];
|
|
659
682
|
if (moveDir === "horizontal") {
|
|
660
683
|
let result = "stay";
|
|
661
|
-
|
|
684
|
+
const elapsedMs = Math.max(now - swipeStartTime, 1);
|
|
685
|
+
const isFlick = Math.abs(swipeWidth) >= MIN_FLICK_DISTANCE && Math.abs(swipeWidth) / elapsedMs >= state.options.swipeVelocity;
|
|
686
|
+
if ((swipeWidth >= state.options.swipeOffset || isFlick && swipeWidth > 0) && state.viewer.currentIndex !== 0) {
|
|
662
687
|
result = "prev";
|
|
663
|
-
} else if (swipeWidth <= -state.options.swipeOffset && state.viewer.currentIndex !== items.length - 1) {
|
|
688
|
+
} else if ((swipeWidth <= -state.options.swipeOffset || isFlick && swipeWidth < 0) && state.viewer.currentIndex !== items.length - 1) {
|
|
664
689
|
result = "next";
|
|
665
690
|
}
|
|
666
691
|
callbacks.onSwipeEnd(result);
|
|
@@ -751,6 +776,10 @@ function createGestures({ state, callbacks }, { signal }) {
|
|
|
751
776
|
}
|
|
752
777
|
function detach() {
|
|
753
778
|
clearInterval(interval);
|
|
779
|
+
if (pinchMoveFrame !== null) {
|
|
780
|
+
cancelAnimationFrame(pinchMoveFrame);
|
|
781
|
+
pinchMoveFrame = null;
|
|
782
|
+
}
|
|
754
783
|
}
|
|
755
784
|
return { attach, detach };
|
|
756
785
|
}
|
|
@@ -1082,7 +1111,11 @@ function getWindowWidth() {
|
|
|
1082
1111
|
return document.documentElement.clientWidth;
|
|
1083
1112
|
}
|
|
1084
1113
|
function getWindowHeight() {
|
|
1085
|
-
|
|
1114
|
+
const visualViewport = window.visualViewport;
|
|
1115
|
+
if (visualViewport) {
|
|
1116
|
+
return visualViewport.height * visualViewport.scale;
|
|
1117
|
+
}
|
|
1118
|
+
return document.documentElement.clientHeight;
|
|
1086
1119
|
}
|
|
1087
1120
|
function isElementArray(source) {
|
|
1088
1121
|
return source.length > 0 && source[0] instanceof Element;
|
package/lib/smartphoto.mjs
CHANGED
|
@@ -98,6 +98,7 @@ var defaults = {
|
|
|
98
98
|
swipeTopToClose: false,
|
|
99
99
|
swipeBottomToClose: true,
|
|
100
100
|
swipeOffset: 100,
|
|
101
|
+
swipeVelocity: 0.5,
|
|
101
102
|
headerHeight: 60,
|
|
102
103
|
footerHeight: 60,
|
|
103
104
|
forceInterval: 10,
|
|
@@ -355,6 +356,7 @@ function distance(p1, p2) {
|
|
|
355
356
|
const y = p1.y - p2.y;
|
|
356
357
|
return Math.sqrt(x * x + y * y);
|
|
357
358
|
}
|
|
359
|
+
var MIN_FLICK_DISTANCE = 10;
|
|
358
360
|
function getForceAndTheta(x, y) {
|
|
359
361
|
return { force: Math.sqrt(x * x + y * y), theta: Math.atan2(y, x) };
|
|
360
362
|
}
|
|
@@ -372,6 +374,7 @@ function createGestures({ state, callbacks }, { signal }) {
|
|
|
372
374
|
let firstPos = null;
|
|
373
375
|
let oldPos = null;
|
|
374
376
|
let moveDir = null;
|
|
377
|
+
let swipeStartTime = 0;
|
|
375
378
|
let photoSwipable = false;
|
|
376
379
|
let firstPhotoPos = null;
|
|
377
380
|
let oldPhotoPos = null;
|
|
@@ -379,6 +382,7 @@ function createGestures({ state, callbacks }, { signal }) {
|
|
|
379
382
|
let photoVY = 0;
|
|
380
383
|
let pinching = false;
|
|
381
384
|
let oldDistance = 0;
|
|
385
|
+
let pinchMoveFrame = null;
|
|
382
386
|
let vx = 0;
|
|
383
387
|
let vy = 0;
|
|
384
388
|
function isSmartPhone2() {
|
|
@@ -500,6 +504,7 @@ function createGestures({ state, callbacks }, { signal }) {
|
|
|
500
504
|
dragStart = true;
|
|
501
505
|
firstPos = pos;
|
|
502
506
|
oldPos = pos;
|
|
507
|
+
swipeStartTime = Date.now();
|
|
503
508
|
}
|
|
504
509
|
function startPhotoDrag(e) {
|
|
505
510
|
photoSwipable = true;
|
|
@@ -523,6 +528,23 @@ function createGestures({ state, callbacks }, { signal }) {
|
|
|
523
528
|
}
|
|
524
529
|
startSwipe(e);
|
|
525
530
|
}
|
|
531
|
+
function scheduleGestureMove() {
|
|
532
|
+
if (pinchMoveFrame !== null) {
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
pinchMoveFrame = requestAnimationFrame(() => {
|
|
536
|
+
pinchMoveFrame = null;
|
|
537
|
+
callbacks.onGestureMove();
|
|
538
|
+
});
|
|
539
|
+
}
|
|
540
|
+
function flushGestureMove() {
|
|
541
|
+
if (pinchMoveFrame === null) {
|
|
542
|
+
return;
|
|
543
|
+
}
|
|
544
|
+
cancelAnimationFrame(pinchMoveFrame);
|
|
545
|
+
pinchMoveFrame = null;
|
|
546
|
+
callbacks.onGestureMove();
|
|
547
|
+
}
|
|
526
548
|
function movePinch() {
|
|
527
549
|
const points = Array.from(activePointers.values());
|
|
528
550
|
const dist = distance(
|
|
@@ -547,7 +569,7 @@ function createGestures({ state, callbacks }, { signal }) {
|
|
|
547
569
|
state.viewer.hideUi = state.viewer.scaleSize < 1 || state.viewer.scaleSize > border;
|
|
548
570
|
}
|
|
549
571
|
oldDistance = dist;
|
|
550
|
-
|
|
572
|
+
scheduleGestureMove();
|
|
551
573
|
}
|
|
552
574
|
function moveSwipe(e) {
|
|
553
575
|
const pos = getPos(e);
|
|
@@ -596,6 +618,7 @@ function createGestures({ state, callbacks }, { signal }) {
|
|
|
596
618
|
}
|
|
597
619
|
function endPinch() {
|
|
598
620
|
pinching = false;
|
|
621
|
+
flushGestureMove();
|
|
599
622
|
const item = currentItem(state);
|
|
600
623
|
if (!item) {
|
|
601
624
|
return;
|
|
@@ -632,9 +655,11 @@ function createGestures({ state, callbacks }, { signal }) {
|
|
|
632
655
|
const items = currentItems(state) ?? [];
|
|
633
656
|
if (moveDir === "horizontal") {
|
|
634
657
|
let result = "stay";
|
|
635
|
-
|
|
658
|
+
const elapsedMs = Math.max(now - swipeStartTime, 1);
|
|
659
|
+
const isFlick = Math.abs(swipeWidth) >= MIN_FLICK_DISTANCE && Math.abs(swipeWidth) / elapsedMs >= state.options.swipeVelocity;
|
|
660
|
+
if ((swipeWidth >= state.options.swipeOffset || isFlick && swipeWidth > 0) && state.viewer.currentIndex !== 0) {
|
|
636
661
|
result = "prev";
|
|
637
|
-
} else if (swipeWidth <= -state.options.swipeOffset && state.viewer.currentIndex !== items.length - 1) {
|
|
662
|
+
} else if ((swipeWidth <= -state.options.swipeOffset || isFlick && swipeWidth < 0) && state.viewer.currentIndex !== items.length - 1) {
|
|
638
663
|
result = "next";
|
|
639
664
|
}
|
|
640
665
|
callbacks.onSwipeEnd(result);
|
|
@@ -725,6 +750,10 @@ function createGestures({ state, callbacks }, { signal }) {
|
|
|
725
750
|
}
|
|
726
751
|
function detach() {
|
|
727
752
|
clearInterval(interval);
|
|
753
|
+
if (pinchMoveFrame !== null) {
|
|
754
|
+
cancelAnimationFrame(pinchMoveFrame);
|
|
755
|
+
pinchMoveFrame = null;
|
|
756
|
+
}
|
|
728
757
|
}
|
|
729
758
|
return { attach, detach };
|
|
730
759
|
}
|
|
@@ -1056,7 +1085,11 @@ function getWindowWidth() {
|
|
|
1056
1085
|
return document.documentElement.clientWidth;
|
|
1057
1086
|
}
|
|
1058
1087
|
function getWindowHeight() {
|
|
1059
|
-
|
|
1088
|
+
const visualViewport = window.visualViewport;
|
|
1089
|
+
if (visualViewport) {
|
|
1090
|
+
return visualViewport.height * visualViewport.scale;
|
|
1091
|
+
}
|
|
1092
|
+
return document.documentElement.clientHeight;
|
|
1060
1093
|
}
|
|
1061
1094
|
function isElementArray(source) {
|
|
1062
1095
|
return source.length > 0 && source[0] instanceof Element;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smartphoto",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.4",
|
|
4
4
|
"description": "smartphoto",
|
|
5
5
|
"homepage": "https://developer.a-blogcms.jp",
|
|
6
6
|
"main": "./lib/smartphoto.js",
|
|
@@ -31,17 +31,17 @@
|
|
|
31
31
|
"lint": "biome check --write ./src",
|
|
32
32
|
"lint:ci": "biome ci ./src",
|
|
33
33
|
"typecheck": "tsc --noEmit",
|
|
34
|
-
"build": "npm run build:js && npm run build:types && npm run build:
|
|
34
|
+
"build": "npm run build:js && npm run build:types && npm run build:css",
|
|
35
35
|
"build:js": "tsup",
|
|
36
36
|
"build:types": "tsc -p tsconfig.build.json",
|
|
37
|
-
"build:
|
|
38
|
-
"clean:css": "rm -rf ./css
|
|
39
|
-
"
|
|
40
|
-
"
|
|
37
|
+
"build:css": "npm run clean:css && npm run css:copy && npm run css:min",
|
|
38
|
+
"clean:css": "rm -rf ./css && mkdir -p ./css",
|
|
39
|
+
"css:copy": "cp ./styles/smartphoto.css ./css/smartphoto.css",
|
|
40
|
+
"css:min": "postcss ./styles/smartphoto.css -o ./css/smartphoto.min.css",
|
|
41
41
|
"dev": "vite",
|
|
42
42
|
"preview": "vite preview",
|
|
43
43
|
"prepare": "husky",
|
|
44
|
-
"prepack": "npm run lint:ci && npm run typecheck && npm
|
|
44
|
+
"prepack": "npm run lint:ci && npm run typecheck && npm test && npm run build",
|
|
45
45
|
"release:patch": "npm version patch && git push --follow-tags",
|
|
46
46
|
"release:minor": "npm version minor && git push --follow-tags",
|
|
47
47
|
"release:major": "npm version major && git push --follow-tags"
|
|
@@ -64,10 +64,12 @@
|
|
|
64
64
|
"@testing-library/jest-dom": "^7.0.0",
|
|
65
65
|
"@types/node": "^24.13.3",
|
|
66
66
|
"@vitest/coverage-v8": "^4.1.10",
|
|
67
|
+
"cssnano": "^8.0.4",
|
|
67
68
|
"husky": "^9.1.7",
|
|
68
69
|
"jsdom": "^30.0.1",
|
|
69
70
|
"lint-staged": "^17.3.0",
|
|
70
|
-
"
|
|
71
|
+
"postcss": "^8.5.26",
|
|
72
|
+
"postcss-cli": "^11.0.1",
|
|
71
73
|
"tsup": "^8.5.1",
|
|
72
74
|
"typescript": "^7.0.2",
|
|
73
75
|
"vite": "^8.2.0",
|
package/css/smartphoto.css.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sourceRoot":"","sources":["../scss/smartphoto.scss"],"names":[],"mappings":"AAKA;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;IACA;;EAEF;IACE;IACA;;EAEF;IACE;IACA;;;AAUJ;EACE;IACE;;EAGF;IACE;;;AAIJ;EACE;IACE;;EAEF;IACE;;;AAIJ;EACE;;;AAIF;EAEE;EACA;EACA;EACA;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EAKA;EAQA;EACA;EACA;EACA;EACA;EACA;EAKA,YACE;;AAIF;EACE;;AAGF;EACE;;;AASJ;AAAA;AAAA;EAGE;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EAEA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;;;AAGF;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;EACA;;;AAGF;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;;;AAGF;EACE;EACA;EACA;EACA;;;AAGF;EAGE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;;;AAGF;EACE;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAKN;EACE;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;AACA;EACE;;;AAIJ;EACE;EACA;EACA;EACA;EACA;EACA;EAIA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;;;AAGF;EACE;EACA;EACA;EACA;EACA;EACA;EACA;EACA","file":"smartphoto.css"}
|