vendor: 33,105 bytes, lines 1-792
1! function(t, e) { 2 "object" == typeof exports && "undefined" != typeof module ? e(exports) : "function" == typeof define && define.amd ? define(["exports"], e) : e((t = "undefined" != typeof globalThis ? globalThis : t || self).window = t.window || {}) 3}(this, (function(t) { 4 "use strict"; 5 const e = (t, e = 1e4) => (t = parseFloat(t + "") || 0, Math.round((t + Number.EPSILON) * e) / e), 6 i = function(t) { 7 if (!(t && t instanceof Element && t.offsetParent)) return !1; 8 const e = t.scrollHeight > t.clientHeight, 9 i = window.getComputedStyle(t).overflowY, 10 n = -1 !== i.indexOf("hidden"), 11 s = -1 !== i.indexOf("visible"); 12 return e && !n && !s 13 }, 14 n = function(t, e = void 0) { 15 return !(!t || t === document.body || e && t === e) && (i(t) ? t : n(t.parentElement, e)) 16 }, 17 s = function(t) { 18 var e = (new DOMParser).parseFromString(t, "text/html").body; 19 if (e.childElementCount > 1) { 20 for (var i = document.createElement("div"); e.firstChild;) i.appendChild(e.firstChild); 21 return i 22 } 23 return e.firstChild 24 }, 25 o = t => `${t||""}`.split(" ").filter((t => !!t)), 26 a = (t, e, i) => { 27 t && o(e).forEach((e => { 28 t.classList.toggle(e, i || !1) 29 })) 30 }; 31 class r { 32 constructor(t) { 33 Object.defineProperty(this, "pageX", { 34 enumerable: !0, 35 configurable: !0, 36 writable: !0, 37 value: void 0 38 }), Object.defineProperty(this, "pageY", { 39 enumerable: !0, 40 configurable: !0, 41 writable: !0, 42 value: void 0 43 }), Object.defineProperty(this, "clientX", { 44 enumerable: !0, 45 configurable: !0, 46 writable: !0, 47 value: void 0 48 }), Object.defineProperty(this, "clientY", { 49 enumerable: !0, 50 configurable: !0, 51 writable: !0, 52 value: void 0 53 }), Object.defineProperty(this, "id", { 54 enumerable: !0, 55 configurable: !0, 56 writable: !0, 57 value: void 0 58 }), Object.defineProperty(this, "time", { 59 enumerable: !0, 60 configurable: !0, 61 writable: !0, 62 value: void 0 63 }), Object.defineProperty(this, "nativePointer", { 64 enumerable: !0, 65 configurable: !0, 66 writable: !0, 67 value: void 0 68 }), this.nativePointer = t, this.pageX = t.pageX, this.pageY = t.pageY, this.clientX = t.clientX, this.clientY = t.clientY, this.id = self.Touch && t instanceof Touch ? t.identifier : -1, this.time = Date.now() 69 } 70 } 71 const l = { 72 passive: !1 73 }; 74 class c { 75 constructor(t, { 76 start: e = (() => !0), 77 move: i = (() => {}), 78 end: n = (() => {}) 79 }) { 80 Object.defineProperty(this, "element", { 81 enumerable: !0, 82 configurable: !0, 83 writable: !0, 84 value: void 0 85 }), Object.defineProperty(this, "startCallback", { 86 enumerable: !0, 87 configurable: !0, 88 writable: !0, 89 value: void 0 90 }), Object.defineProperty(this, "moveCallback", { 91 enumerable: !0, 92 configurable: !0, 93 writable: !0, 94 value: void 0 95 }), Object.defineProperty(this, "endCallback", { 96 enumerable: !0, 97 configurable: !0, 98 writable: !0, 99 value: void 0 100 }), Object.defineProperty(this, "currentPointers", { 101 enumerable: !0, 102 configurable: !0, 103 writable: !0, 104 value: [] 105 }), Object.defineProperty(this, "startPointers", { 106 enumerable: !0, 107 configurable: !0, 108 writable: !0, 109 value: [] 110 }), this.element = t, this.startCallback = e, this.moveCallback = i, this.endCallback = n; 111 for (const t of ["onPointerStart", "onTouchStart", "onMove", "onTouchEnd", "onPointerEnd", "onWindowBlur"]) this[t] = this[t].bind(this); 112 this.element.addEventListener("mousedown", this.onPointerStart, l), this.element.addEventListener("touchstart", this.onTouchStart, l), this.element.addEventListener("touchmove", this.onMove, l), this.element.addEventListener("touchend", this.onTouchEnd), this.element.addEventListener("touchcancel", this.onTouchEnd) 113 } 114 onPointerStart(t) { 115 if (!t.buttons || 0 !== t.button) return; 116 const e = new r(t); 117 this.currentPointers.some((t => t.id === e.id)) || this.triggerPointerStart(e, t) && (window.addEventListener("mousemove", this.onMove), window.addEventListener("mouseup", this.onPointerEnd), window.addEventListener("blur", this.onWindowBlur)) 118 } 119 onTouchStart(t) { 120 for (const e of Array.from(t.changedTouches || [])) this.triggerPointerStart(new r(e), t); 121 window.addEventListener("blur", this.onWindowBlur) 122 } 123 onMove(t) { 124 const e = this.currentPointers.slice(), 125 i = "changedTouches" in t ? Array.from(t.changedTouches || []).map((t => new r(t))) : [new r(t)], 126 n = []; 127 for (const t of i) { 128 const e = this.currentPointers.findIndex((e => e.id === t.id)); 129 e < 0 || (n.push(t), this.currentPointers[e] = t) 130 } 131 n.length && this.moveCallback(t, this.currentPointers.slice(), e) 132 } 133 onPointerEnd(t) { 134 t.buttons > 0 && 0 !== t.button || (this.triggerPointerEnd(t, new r(t)), window.removeEventListener("mousemove", this.onMove), window.removeEventListener("mouseup", this.onPointerEnd), window.removeEventListener("blur", this.onWindowBlur)) 135 } 136 onTouchEnd(t) { 137 for (const e of Array.from(t.changedTouches || [])) this.triggerPointerEnd(t, new r(e)) 138 } 139 triggerPointerStart(t, e) { 140 return !!this.startCallback(e, t, this.currentPointers.slice()) && (this.currentPointers.push(t), this.startPointers.push(t), !0) 141 } 142 triggerPointerEnd(t, e) { 143 const i = this.currentPointers.findIndex((t => t.id === e.id)); 144 i < 0 || (this.currentPointers.splice(i, 1), this.startPointers.splice(i, 1), this.endCallback(t, e, this.currentPointers.slice())) 145 } 146 onWindowBlur() { 147 this.clear() 148 } 149 clear() { 150 for (; this.currentPointers.length;) { 151 const t = this.currentPointers[this.currentPointers.length - 1]; 152 this.currentPointers.splice(this.currentPointers.length - 1, 1), this.startPointers.splice(this.currentPointers.length - 1, 1), this.endCallback(new Event("touchend", { 153 bubbles: !0, 154 cancelable: !0, 155 clientX: t.clientX, 156 clientY: t.clientY 157 }), t, this.currentPointers.slice()) 158 } 159 } 160 stop() { 161 this.element.removeEventListener("mousedown", this.onPointerStart, l), this.element.removeEventListener("touchstart", this.onTouchStart, l), this.element.removeEventListener("touchmove", this.onMove, l), this.element.removeEventListener("touchend", this.onTouchEnd), this.element.removeEventListener("touchcancel", this.onTouchEnd), window.removeEventListener("mousemove", this.onMove), window.removeEventListener("mouseup", this.onPointerEnd), window.removeEventListener("blur", this.onWindowBlur) 162 } 163 } 164 165 function h(t, e) { 166 return e ? Math.sqrt(Math.pow(e.clientX - t.clientX, 2) + Math.pow(e.clientY - t.clientY, 2)) : 0 167 } 168 169 function d(t, e) { 170 return e ? { 171 clientX: (t.clientX + e.clientX) / 2, 172 clientY: (t.clientY + e.clientY) / 2 173 } : t 174 } 175 const u = t => "object" == typeof t && null !== t && t.constructor === Object && "[object Object]" === Object.prototype.toString.call(t), 176 p = (t, ...e) => { 177 const i = e.length; 178 for (let n = 0; n < i; n++) { 179 const i = e[n] || {}; 180 Object.entries(i).forEach((([e, i]) => { 181 const n = Array.isArray(i) ? [] : {}; 182 t[e] || Object.assign(t, { 183 [e]: n 184 }), u(i) ? Object.assign(t[e], p(n, i)) : Array.isArray(i) ? Object.assign(t, { 185 [e]: [...i] 186 }) : Object.assign(t, { 187 [e]: i 188 }) 189 })) 190 } 191 return t 192 }, 193 f = function(t, e) { 194 return t.split(".").reduce(((t, e) => "object" == typeof t ? t[e] : void 0), e) 195 }; 196 class g { 197 constructor(t = {}) { 198 Object.defineProperty(this, "options", { 199 enumerable: !0, 200 configurable: !0, 201 writable: !0, 202 value: t 203 }), Object.defineProperty(this, "events", { 204 enumerable: !0, 205 configurable: !0, 206 writable: !0, 207 value: new Map 208 }), this.setOptions(t); 209 for (const t of Object.getOwnPropertyNames(Object.getPrototypeOf(this))) t.startsWith("on") && "function" == typeof this[t] && (this[t] = this[t].bind(this)) 210 } 211 setOptions(t) { 212 this.options = t ? p({}, this.constructor.defaults, t) : {}; 213 for (const [t, e] of Object.entries(this.option("on") || {})) this.on(t, e) 214 } 215 option(t, ...e) { 216 let i = f(t, this.options); 217 return i && "function" == typeof i && (i = i.call(this, this, ...e)), i 218 } 219 optionFor(t, e, i, ...n) { 220 let s = f(e, t); 221 var o; 222 "string" != typeof(o = s) || isNaN(o) || isNaN(parseFloat(o)) || (s = parseFloat(s)), "true" === s && (s = !0), "false" === s && (s = !1), s && "function" == typeof s && (s = s.call(this, this, t, ...n)); 223 let a = f(e, this.options); 224 return a && "function" == typeof a ? s = a.call(this, this, t, ...n, s) : void 0 === s && (s = a), void 0 === s ? i : s 225 } 226 cn(t) { 227 const e = this.options.classes; 228 return e && e[t] || "" 229 } 230 localize(t, e = []) { 231 t = String(t).replace(/\{\{(\w+).?(\w+)?\}\}/g, ((t, e, i) => { 232 let n = ""; 233 return i ? n = this.option(`${e[0]+e.toLowerCase().substring(1)}.l10n.${i}`) : e && (n = this.option(`l10n.${e}`)), n || (n = t), n 234 })); 235 for (let i = 0; i < e.length; i++) t = t.split(e[i][0]).join(e[i][1]); 236 return t = t.replace(/\{\{(.*?)\}\}/g, ((t, e) => e)) 237 } 238 on(t, e) { 239 let i = []; 240 "string" == typeof t ? i = t.split(" ") : Array.isArray(t) && (i = t), this.events || (this.events = new Map), i.forEach((t => { 241 let i = this.events.get(t); 242 i || (this.events.set(t, []), i = []), i.includes(e) || i.push(e), this.events.set(t, i) 243 })) 244 } 245 off(t, e) { 246 let i = []; 247 "string" == typeof t ? i = t.split(" ") : Array.isArray(t) && (i = t), i.forEach((t => { 248 const i = this.events.get(t); 249 if (Array.isArray(i)) { 250 const t = i.indexOf(e); 251 t > -1 && i.splice(t, 1) 252 } 253 })) 254 } 255 emit(t, ...e) { 256 [...this.events.get(t) || []].forEach((t => t(this, ...e))), "*" !== t && this.emit("*", t, ...e) 257 } 258 } 259 Object.defineProperty(g, "version", { 260 enumerable: !0, 261 configurable: !0, 262 writable: !0, 263 value: "5.0.36" 264 }), Object.defineProperty(g, "defaults", { 265 enumerable: !0, 266 configurable: !0, 267 writable: !0, 268 value: {} 269 }); 270 class m extends g { 271 constructor(t = {}) { 272 super(t), Object.defineProperty(this, "plugins", { 273 enumerable: !0, 274 configurable: !0, 275 writable: !0, 276 value: {} 277 }) 278 } 279 attachPlugins(t = {}) { 280 const e = new Map; 281 for (const [i, n] of Object.entries(t)) { 282 const t = this.option(i), 283 s = this.plugins[i]; 284 s || !1 === t ? s && !1 === t && (s.detach(), delete this.plugins[i]) : e.set(i, new n(this, t || {})) 285 } 286 for (const [t, i] of e) this.plugins[t] = i, i.attach() 287 } 288 detachPlugins(t) { 289 t = t || Object.keys(this.plugins); 290 for (const e of t) { 291 const t = this.plugins[e]; 292 t && t.detach(), delete this.plugins[e] 293 } 294 return this.emit("detachPlugins"), this 295 } 296 } 297 var v; 298 ! function(t) { 299 t[t.Init = 0] = "Init", t[t.Error = 1] = "Error", t[t.Ready = 2] = "Ready", t[t.Panning = 3] = "Panning", t[t.Mousemove = 4] = "Mousemove", t[t.Destroy = 5] = "Destroy" 300 }(v || (v = {})); 301 const b = ["a", "b", "c", "d", "e", "f"], 302 y = { 303 PANUP: "Move up", 304 PANDOWN: "Move down", 305 PANLEFT: "Move left", 306 PANRIGHT: "Move right", 307 ZOOMIN: "Zoom in", 308 ZOOMOUT: "Zoom out", 309 TOGGLEZOOM: "Toggle zoom level", 310 TOGGLE1TO1: "Toggle zoom level", 311 ITERATEZOOM: "Toggle zoom level", 312 ROTATECCW: "Rotate counterclockwise", 313 ROTATECW: "Rotate clockwise", 314 FLIPX: "Flip horizontally", 315 FLIPY: "Flip vertically", 316 FITX: "Fit horizontally", 317 FITY: "Fit vertically", 318 RESET: "Reset", 319 TOGGLEFS: "Toggle fullscreen" 320 }, 321 w = { 322 content: null, 323 width: "auto", 324 height: "auto", 325 panMode: "drag", 326 touch: !0, 327 dragMinThreshold: 3, 328 lockAxis: !1, 329 mouseMoveFactor: 1, 330 mouseMoveFriction: .12, 331 zoom: !0, 332 pinchToZoom: !0, 333 panOnlyZoomed: "auto", 334 minScale: 1, 335 maxScale: 2, 336 friction: .25, 337 dragFriction: .35, 338 decelFriction: .05, 339 click: "toggleZoom", 340 dblClick: !1, 341 wheel: "zoom", 342 wheelLimit: 7, 343 spinner: !0, 344 bounds: "auto", 345 infinite: !1, 346 rubberband: !0, 347 bounce: !0, 348 maxVelocity: 75, 349 transformParent: !1, 350 classes: { 351 content: "f-panzoom__content", 352 isLoading: "is-loading", 353 canZoomIn: "can-zoom_in", 354 canZoomOut: "can-zoom_out", 355 isDraggable: "is-draggable", 356 isDragging: "is-dragging", 357 inFullscreen: "in-fullscreen", 358 htmlHasFullscreen: "with-panzoom-in-fullscreen" 359 }, 360 l10n: y 361 }, 362 x = '<circle cx="25" cy="25" r="20"></circle>', 363 E = '<div class="f-spinner"><svg viewBox="0 0 50 50">' + x + x + "</svg></div>", 364 S = t => t && null !== t && t instanceof Element && "nodeType" in t, 365 P = (t, e) => { 366 t && o(e).forEach((e => { 367 t.classList.remove(e) 368 })) 369 }, 370 C = (t, e) => { 371 t && o(e).forEach((e => { 372 t.classList.add(e) 373 })) 374 }, 375 T = { 376 a: 1, 377 b: 0, 378 c: 0, 379 d: 1, 380 e: 0, 381 f: 0 382 }, 383 M = 1e5, 384 O = 1e4, 385 A = "mousemove", 386 L = "drag", 387 z = "content", 388 R = "auto"; 389 let k = null, 390 I = null; 391 class D extends m { 392 get fits() { 393 return this.contentRect.width - this.contentRect.fitWidth < 1 && this.contentRect.height - this.contentRect.fitHeight < 1 394 } 395 get isTouchDevice() { 396 return null === I && (I = window.matchMedia("(hover: none)").matches), I 397 } 398 get isMobile() { 399 return null === k && (k = /iPhone|iPad|iPod|Android/i.test(navigator.userAgent)), k 400 } 401 get panMode() { 402 return this.options.panMode !== A || this.isTouchDevice ? L : A 403 } 404 get panOnlyZoomed() { 405 const t = this.options.panOnlyZoomed; 406 return t === R ? this.isTouchDevice : t 407 } 408 get isInfinite() { 409 return this.option("infinite") 410 } 411 get angle() { 412 return 180 * Math.atan2(this.current.b, this.current.a) / Math.PI || 0 413 } 414 get targetAngle() { 415 return 180 * Math.atan2(this.target.b, this.target.a) / Math.PI || 0 416 } 417 get scale() { 418 const { 419 a: t, 420 b: e 421 } = this.current; 422 return Math.sqrt(t * t + e * e) || 1 423 } 424 get targetScale() { 425 const { 426 a: t, 427 b: e 428 } = this.target; 429 return Math.sqrt(t * t + e * e) || 1 430 } 431 get minScale() { 432 return this.option("minScale") || 1 433 } 434 get fullScale() { 435 const { 436 contentRect: t 437 } = this; 438 return t.fullWidth / t.fitWidth || 1 439 } 440 get maxScale() { 441 return this.fullScale * (this.option("maxScale") || 1) || 1 442 } 443 get coverScale() { 444 const { 445 containerRect: t, 446 contentRect: e 447 } = this, i = Math.max(t.height / e.fitHeight, t.width / e.fitWidth) || 1; 448 return Math.min(this.fullScale, i) 449 } 450 get isScaling() { 451 return Math.abs(this.targetScale - this.scale) > 1e-5 && !this.isResting 452 } 453 get isContentLoading() { 454 const t = this.content; 455 return !!(t && t instanceof HTMLImageElement) && !t.complete 456 } 457 get isResting() { 458 if (this.isBouncingX || this.isBouncingY) return !1; 459 for (const t of b) { 460 const e = "e" == t || "f" === t ? 1e-4 : 1e-5; 461 if (Math.abs(this.target[t] - this.current[t]) > e) return !1 462 } 463 return !(!this.ignoreBounds && !this.checkBounds().inBounds) 464 } 465 constructor(t, e = {}, i = {}) { 466 var n; 467 if (super(e), Object.defineProperty(this, "pointerTracker", { 468 enumerable: !0, 469 configurable: !0, 470 writable: !0, 471 value: null 472 }), Object.defineProperty(this, "resizeObserver", { 473 enumerable: !0, 474 configurable: !0, 475 writable: !0, 476 value: null 477 }), Object.defineProperty(this, "updateTimer", { 478 enumerable: !0, 479 configurable: !0, 480 writable: !0, 481 value: null 482 }), Object.defineProperty(this, "clickTimer", { 483 enumerable: !0, 484 configurable: !0, 485 writable: !0, 486 value: null 487 }), Object.defineProperty(this, "rAF", { 488 enumerable: !0, 489 configurable: !0, 490 writable: !0, 491 value: null 492 }), Object.defineProperty(this, "isTicking", { 493 enumerable: !0, 494 configurable: !0, 495 writable: !0, 496 value: !1 497 }), Object.defineProperty(this, "ignoreBounds", { 498 enumerable: !0, 499 configurable: !0, 500 writable: !0, 501 value: !1 502 }), Object.defineProperty(this, "isBouncingX", { 503 enumerable: !0, 504 configurable: !0, 505 writable: !0, 506 value: !1 507 }), Object.defineProperty(this, "isBouncingY", { 508 enumerable: !0, 509 configurable: !0, 510 writable: !0, 511 value: !1 512 }), Object.defineProperty(this, "clicks", { 513 enumerable: !0, 514 configurable: !0, 515 writable: !0, 516 value: 0 517 }), Object.defineProperty(this, "trackingPoints", { 518 enumerable: !0, 519 configurable: !0, 520 writable: !0, 521 value: [] 522 }), Object.defineProperty(this, "pwt", { 523 enumerable: !0, 524 configurable: !0, 525 writable: !0, 526 value: 0 527 }), Object.defineProperty(this, "cwd", { 528 enumerable: !0, 529 configurable: !0, 530 writable: !0, 531 value: 0 532 }), Object.defineProperty(this, "pmme", { 533 enumerable: !0, 534 configurable: !0, 535 writable: !0, 536 value: void 0 537 }), Object.defineProperty(this, "friction", { 538 enumerable: !0, 539 configurable: !0, 540 writable: !0, 541 value: 0 542 }), Object.defineProperty(this, "state", { 543 enumerable: !0, 544 configurable: !0, 545 writable: !0, 546 value: v.Init 547 }), Object.defineProperty(this, "isDragging", { 548 enumerable: !0, 549 configurable: !0, 550 writable: !0, 551 value: !1 552 }), Object.defineProperty(this, "container", { 553 enumerable: !0, 554 configurable: !0, 555 writable: !0, 556 value: void 0 557 }), Object.defineProperty(this, "content", { 558 enumerable: !0, 559 configurable: !0, 560 writable: !0, 561 value: void 0 562 }), Object.defineProperty(this, "spinner", { 563 enumerable: !0, 564 configurable: !0, 565 writable: !0, 566 value: null 567 }), Object.defineProperty(this, "containerRect", { 568 enumerable: !0, 569 configurable: !0, 570 writable: !0, 571 value: { 572 width: 0, 573 height: 0, 574 innerWidth: 0, 575 innerHeight: 0 576 } 577 }), Object.defineProperty(this, "contentRect", { 578 enumerable: !0, 579 configurable: !0, 580 writable: !0, 581 value: { 582 top: 0, 583 right: 0, 584 bottom: 0, 585 left: 0, 586 fullWidth: 0, 587 fullHeight: 0, 588 fitWidth: 0, 589 fitHeight: 0, 590 width: 0, 591 height: 0 592 } 593 }), Object.defineProperty(this, "dragStart", { 594 enumerable: !0, 595 configurable: !0, 596 writable: !0, 597 value: { 598 x: 0, 599 y: 0, 600 top: 0, 601 left: 0, 602 time: 0 603 } 604 }), Object.defineProperty(this, "dragOffset", { 605 enumerable: !0, 606 configurable: !0, 607 writable: !0, 608 value: { 609 x: 0, 610 y: 0, 611 time: 0 612 } 613 }), Object.defineProperty(this, "current", { 614 enumerable: !0, 615 configurable: !0, 616 writable: !0, 617 value: Object.assign({}, T) 618 }), Object.defineProperty(this, "target", { 619 enumerable: !0, 620 configurable: !0, 621 writable: !0, 622 value: Object.assign({}, T) 623 }), Object.defineProperty(this, "velocity", { 624 enumerable: !0, 625 configurable: !0, 626 writable: !0, 627 value: { 628 a: 0, 629 b: 0, 630 c: 0, 631 d: 0, 632 e: 0, 633 f: 0 634 } 635 }), Object.defineProperty(this, "lockedAxis", { 636 enumerable: !0, 637 configurable: !0, 638 writable: !0, 639 value: !1 640 }), !t) throw new Error("Container Element Not Found"); 641 this.container = t, this.initContent(), this.attachPlugins(Object.assign(Object.assign({}, D.Plugins), i)), this.emit("attachPlugins"), this.emit("init"); 642 const o = this.content; 643 if (o.addEventListener("load", this.onLoad), o.addEventListener("error", this.onError), this.isContentLoading) { 644 if (this.option("spinner")) { 645 t.classList.add(this.cn("isLoading")); 646 const e = s(E); 647 !t.contains(o) || o.parentElement instanceof HTMLPictureElement ? this.spinner = t.appendChild(e) : this.spinner = (null === (n = o.parentElement) || void 0 === n ? void 0 : n.insertBefore(e, o)) || null 648 } 649 this.emit("beforeLoad") 650 } else queueMicrotask((() => { 651 this.enable() 652 })) 653 } 654 initContent() { 655 const { 656 container: t 657 } = this, e = this.cn(z); 658 let i = this.option(z) || t.querySelector(`.${e}`); 659 if (i || (i = t.querySelector("img,picture") || t.firstElementChild, i && C(i, e)), i instanceof HTMLPictureElement && (i = i.querySelector("img")), !i) throw new Error("No content found"); 660 this.content = i 661 } 662 onLoad() { 663 const { 664 spinner: t, 665 container: e, 666 state: i 667 } = this; 668 t && (t.remove(), this.spinner = null), this.option("spinner") && e.classList.remove(this.cn("isLoading")), this.emit("afterLoad"), i === v.Init ? this.enable() : this.updateMetrics() 669 } 670 onError() { 671 this.state !== v.Destroy && (this.spinner && (this.spinner.remove(), this.spinner = null), this.stop(), this.detachEvents(), this.state = v.Error, this.emit("error")) 672 } 673 getNextScale(t) { 674 const { 675 fullScale: e, 676 targetScale: i, 677 coverScale: n, 678 maxScale: s, 679 minScale: o 680 } = this; 681 let a = o; 682 switch (t) { 683 case "toggleMax": 684 a = i - o < .5 * (s - o) ? s : o; 685 break; 686 case "toggleCover": 687 a = i - o < .5 * (n - o) ? n : o; 688 break; 689 case "toggleZoom": 690 a = i - o < .5 * (e - o) ? e : o; 691 break; 692 case "iterateZoom": 693 let t = [1, e, s].sort(((t, e) => t - e)), 694 r = t.findIndex((t => t > i + 1e-5)); 695 a = t[r] || 1 696 } 697 return a 698 } 699 attachObserver() { 700 var t; 701 const e = () => { 702 const { 703 container: t, 704 containerRect: e 705 } = this; 706 return Math.abs(e.width - t.getBoundingClientRect().width) > .1 || Math.abs(e.height - t.getBoundingClientRect().height) > .1 707 }; 708 this.resizeObserver || void 0 === window.ResizeObserver || (this.resizeObserver = new ResizeObserver((() => { 709 this.updateTimer || (e() ? (this.onResize(), this.isMobile && (this.updateTimer = setTimeout((() => { 710 e() && this.onResize(), this.updateTimer = null 711 }), 500))) : this.updateTimer && (clearTimeout(this.updateTimer), this.updateTimer = null)) 712 }))), null === (t = this.resizeObserver) || void 0 === t || t.observe(this.container) 713 } 714 detachObserver() { 715 var t; 716 null === (t = this.resizeObserver) || void 0 === t || t.disconnect() 717 } 718 attachEvents() { 719 const { 720 container: t 721 } = this; 722 t.addEventListener("click", this.onClick, { 723 passive: !1, 724 capture: !1 725 }), t.addEventListener("wheel", this.onWheel, { 726 passive: !1 727 }), this.pointerTracker = new c(t, { 728 start: this.onPointerDown, 729 move: this.onPointerMove, 730 end: this.onPointerUp 731 }), document.addEventListener(A, this.onMouseMove) 732 } 733 detachEvents() { 734 var t; 735 const { 736 container: e 737 } = this; 738 e.removeEventListener("click", this.onClick, { 739 passive: !1, 740 capture: !1 741 }), e.removeEventListener("wheel", this.onWheel, { 742 passive: !1 743 }), null === (t = this.pointerTracker) || void 0 === t || t.stop(), this.pointerTracker = null, document.removeEventListener(A, this.onMouseMove), document.removeEventListener("keydown", this.onKeydown, !0), this.clickTimer && (clearTimeout(this.clickTimer), this.clickTimer = null), this.updateTimer && (clearTimeout(this.updateTimer), this.updateTimer = null) 744 } 745 animate() { 746 this.setTargetForce(); 747 const t = this.friction, 748 e = this.option("maxVelocity"); 749 for (const i of b) t ? (this.velocity[i] *= 1 - t, e && !this.isScaling && (this.velocity[i] = Math.max(Math.min(this.velocity[i], e), -1 * e)), this.current[i] += this.velocity[i]) : this.current[i] = this.target[i]; 750 this.setTransform(), this.setEdgeForce(), !this.isResting || this.isDragging ? this.rAF = requestAnimationFrame((() => this.animate())) : this.stop("current") 751 } 752 setTargetForce() { 753 for (const t of b) "e" === t && this.isBouncingX || "f" === t && this.isBouncingY || (this.velocity[t] = (1 / (1 - this.friction) - 1) * (this.target[t] - this.current[t])) 754 } 755 checkBounds(t = 0, e = 0) { 756 const { 757 current: i 758 } = this, n = i.e + t, s = i.f + e, o = this.getBounds(), { 759 x: a, 760 y: r 761 } = o, l = a.min, c = a.max, h = r.min, d = r.max; 762 let u = 0, 763 p = 0; 764 return l !== 1 / 0 && n < l ? u = l - n : c !== 1 / 0 && n > c && (u = c - n), h !== 1 / 0 && s < h ? p = h - s : d !== 1 / 0 && s > d && (p = d - s), Math.abs(u) < 1e-4 && (u = 0), Math.abs(p) < 1e-4 && (p = 0), Object.assign(Object.assign({}, o), { 765 xDiff: u, 766 yDiff: p, 767 inBounds: !u && !p 768 }) 769 } 770 clampTargetBounds() { 771 const { 772 target: t 773 } = this, { 774 x: e, 775 y: i 776 } = this.getBounds(); 777 e.min !== 1 / 0 && (t.e = Math.max(t.e, e.min)), e.max !== 1 / 0 && (t.e = Math.min(t.e, e.max)), i.min !== 1 / 0 && (t.f = Math.max(t.f, i.min)), i.max !== 1 / 0 && (t.f = Math.min(t.f, i.max)) 778 } 779 calculateContentDim(t = this.current) { 780 const { 781 content: e, 782 contentRect: i 783 } = this, { 784 fitWidth: n, 785 fitHeight: s, 786 fullWidth: o, 787 fullHeight: a 788 } = i; 789 let r = o, 790 l = a; 791 if (this.option("zoom") || 0 !== this.angle) { 792 const i = !(e instanceof HTMLImageElement) && ("none" === window.getComputedStyle(e).maxWidth || "none" === window.getComputedStyle(e).maxHeight),
vendor: 4,565 bytes, lines 793-874
793 c = i ? o : n, 794 h = i ? a : s, 795 d = this.getMatrix(t), 796 u = new DOMPoint(0, 0).matrixTransform(d), 797 p = new DOMPoint(0 + c, 0).matrixTransform(d), 798 f = new DOMPoint(0 + c, 0 + h).matrixTransform(d), 799 g = new DOMPoint(0, 0 + h).matrixTransform(d), 800 m = Math.abs(f.x - u.x), 801 v = Math.abs(f.y - u.y), 802 b = Math.abs(g.x - p.x), 803 y = Math.abs(g.y - p.y); 804 r = Math.max(m, b), l = Math.max(v, y) 805 } 806 return { 807 contentWidth: r, 808 contentHeight: l 809 } 810 } 811 setEdgeForce() { 812 if (this.ignoreBounds || this.isDragging || this.panMode === A || this.targetScale < this.scale) return this.isBouncingX = !1, void(this.isBouncingY = !1); 813 const { 814 target: t 815 } = this, { 816 x: e, 817 y: i, 818 xDiff: n, 819 yDiff: s 820 } = this.checkBounds(); 821 const o = this.option("maxVelocity"); 822 let a = this.velocity.e, 823 r = this.velocity.f; 824 0 !== n ? (this.isBouncingX = !0, n * a <= 0 ? a += .14 * n : (a = .14 * n, e.min !== 1 / 0 && (this.target.e = Math.max(t.e, e.min)), e.max !== 1 / 0 && (this.target.e = Math.min(t.e, e.max))), o && (a = Math.max(Math.min(a, o), -1 * o))) : this.isBouncingX = !1, 0 !== s ? (this.isBouncingY = !0, s * r <= 0 ? r += .14 * s : (r = .14 * s, i.min !== 1 / 0 && (this.target.f = Math.max(t.f, i.min)), i.max !== 1 / 0 && (this.target.f = Math.min(t.f, i.max))), o && (r = Math.max(Math.min(r, o), -1 * o))) : this.isBouncingY = !1, this.isBouncingX && (this.velocity.e = a), this.isBouncingY && (this.velocity.f = r) 825 } 826 enable() { 827 const { 828 content: t 829 } = this, e = new DOMMatrixReadOnly(window.getComputedStyle(t).transform); 830 for (const t of b) this.current[t] = this.target[t] = e[t]; 831 this.updateMetrics(), this.attachObserver(), this.attachEvents(), this.state = v.Ready, this.emit("ready") 832 } 833 onClick(t) { 834 var e; 835 "click" === t.type && 0 === t.detail && (this.dragOffset.x = 0, this.dragOffset.y = 0), this.isDragging && (null === (e = this.pointerTracker) || void 0 === e || e.clear(), this.trackingPoints = [], this.startDecelAnim()); 836 const i = t.target; 837 if (!i || t.defaultPrevented) return; 838 if (i.hasAttribute("disabled")) return t.preventDefault(), void t.stopPropagation(); 839 if ((() => { 840 const t = window.getSelection(); 841 return t && "Range" === t.type 842 })() && !i.closest("button")) return; 843 const n = i.closest("[data-panzoom-action]"), 844 s = i.closest("[data-panzoom-change]"), 845 o = n || s, 846 a = o && S(o) ? o.dataset : null; 847 if (a) { 848 const e = a.panzoomChange, 849 i = a.panzoomAction; 850 if ((e || i) && t.preventDefault(), e) { 851 let t = {}; 852 try { 853 t = JSON.parse(e) 854 } catch (t) { 855 console && console.warn("The given data was not valid JSON") 856 } 857 return void this.applyChange(t) 858 } 859 if (i) return void(this[i] && this[i]()) 860 } 861 if (Math.abs(this.dragOffset.x) > 3 || Math.abs(this.dragOffset.y) > 3) return t.preventDefault(), void t.stopPropagation(); 862 if (i.closest("[data-fancybox]")) return; 863 const r = this.content.getBoundingClientRect(), 864 l = this.dragStart; 865 if (l.time && !this.canZoomOut() && (Math.abs(r.x - l.x) > 2 || Math.abs(r.y - l.y) > 2)) return; 866 this.dragStart.time = 0; 867 const c = e => { 868 this.option("zoom", t) && e && "string" == typeof e && /(iterateZoom)|(toggle(Zoom|Full|Cover|Max)|(zoomTo(Fit|Cover|Max)))/.test(e) && "function" == typeof this[e] && (t.preventDefault(), this[e]({ 869 event: t 870 })) 871 }, 872 h = this.option("click", t), 873 d = this.option("dblClick", t); 874 d ? (this.clicks++, 1 == this.clicks && (this.clickTimer = setTimeout((() => {
vendor: 2,160 bytes, lines 875-911
875 1 === this.clicks ? (this.emit("click", t), !t.defaultPrevented && h && c(h)) : (this.emit("dblClick", t), t.defaultPrevented || c(d)), this.clicks = 0, this.clickTimer = null 876 }), 350))) : (this.emit("click", t), !t.defaultPrevented && h && c(h)) 877 } 878 addTrackingPoint(t) { 879 const e = this.trackingPoints.filter((t => t.time > Date.now() - 100)); 880 e.push(t), this.trackingPoints = e 881 } 882 onPointerDown(t, e, i) { 883 var n; 884 if (!1 === this.option("touch", t)) return !1; 885 this.pwt = 0, this.dragOffset = { 886 x: 0, 887 y: 0, 888 time: 0 889 }, this.trackingPoints = []; 890 const s = this.content.getBoundingClientRect(); 891 if (this.dragStart = { 892 x: s.x, 893 y: s.y, 894 top: s.top, 895 left: s.left, 896 time: Date.now() 897 }, this.clickTimer) return !1; 898 if (this.panMode === A && this.targetScale > 1) return t.preventDefault(), t.stopPropagation(), !1; 899 const o = t.composedPath()[0]; 900 if (!i.length) { 901 if (["TEXTAREA", "OPTION", "INPUT", "SELECT", "VIDEO", "IFRAME"].includes(o.nodeName) || o.closest("[contenteditable],[data-selectable],[data-draggable],[data-clickable],[data-panzoom-change],[data-panzoom-action]")) return !1; 902 null === (n = window.getSelection()) || void 0 === n || n.removeAllRanges() 903 } 904 if ("mousedown" === t.type)["A", "BUTTON"].includes(o.nodeName) || t.preventDefault(); 905 else if (Math.abs(this.velocity.a) > .3) return !1; 906 return this.target.e = this.current.e, this.target.f = this.current.f, this.stop(), this.isDragging || (this.isDragging = !0, this.addTrackingPoint(e), this.emit("touchStart", t)), !0 907 } 908 onPointerMove(t, i, s) { 909 if (!1 === this.option("touch", t)) return; 910 if (!this.isDragging) return; 911 if (i.length < 2 && this.panOnlyZoomed && e(this.targetScale) <= e(this.minScale)) return;
vendor: 10,916 bytes, lines 912-1114
912 if (this.emit("touchMove", t), t.defaultPrevented) return; 913 this.addTrackingPoint(i[0]); 914 const { 915 content: o 916 } = this, a = d(s[0], s[1]), r = d(i[0], i[1]); 917 let l = 0, 918 c = 0; 919 if (i.length > 1) { 920 const t = o.getBoundingClientRect(); 921 l = a.clientX - t.left - .5 * t.width, c = a.clientY - t.top - .5 * t.height 922 } 923 const u = h(s[0], s[1]), 924 p = h(i[0], i[1]); 925 let f = u ? p / u : 1, 926 g = r.clientX - a.clientX, 927 m = r.clientY - a.clientY; 928 this.dragOffset.x += g, this.dragOffset.y += m, this.dragOffset.time = Date.now() - this.dragStart.time; 929 let v = e(this.targetScale) === e(this.minScale) && this.option("lockAxis"); 930 if (v && !this.lockedAxis) 931 if ("xy" === v || "y" === v || "touchmove" === t.type) { 932 if (Math.abs(this.dragOffset.x) < 6 && Math.abs(this.dragOffset.y) < 6) return void t.preventDefault(); 933 const e = Math.abs(180 * Math.atan2(this.dragOffset.y, this.dragOffset.x) / Math.PI); 934 this.lockedAxis = e > 45 && e < 135 ? "y" : "x", this.dragOffset.x = 0, this.dragOffset.y = 0, g = 0, m = 0 935 } else this.lockedAxis = v; 936 if (n(t.target, this.content) && (v = "x", this.dragOffset.y = 0), v && "xy" !== v && this.lockedAxis !== v && e(this.targetScale) === e(this.minScale)) return; 937 t.cancelable && t.preventDefault(), this.container.classList.add(this.cn("isDragging")); 938 const b = this.checkBounds(g, m); 939 this.option("rubberband") ? ("x" !== this.isInfinite && (b.xDiff > 0 && g < 0 || b.xDiff < 0 && g > 0) && (g *= Math.max(0, .5 - Math.abs(.75 / this.contentRect.fitWidth * b.xDiff))), "y" !== this.isInfinite && (b.yDiff > 0 && m < 0 || b.yDiff < 0 && m > 0) && (m *= Math.max(0, .5 - Math.abs(.75 / this.contentRect.fitHeight * b.yDiff)))) : (b.xDiff && (g = 0), b.yDiff && (m = 0)); 940 const y = this.targetScale, 941 w = this.minScale, 942 x = this.maxScale; 943 y < .5 * w && (f = Math.max(f, w)), y > 1.5 * x && (f = Math.min(f, x)), "y" === this.lockedAxis && e(y) === e(w) && (g = 0), "x" === this.lockedAxis && e(y) === e(w) && (m = 0), this.applyChange({ 944 originX: l, 945 originY: c, 946 panX: g, 947 panY: m, 948 scale: f, 949 friction: this.option("dragFriction"), 950 ignoreBounds: !0 951 }) 952 } 953 onPointerUp(t, e, i) { 954 if (i.length) return this.dragOffset.x = 0, this.dragOffset.y = 0, void(this.trackingPoints = []); 955 this.container.classList.remove(this.cn("isDragging")), this.isDragging && (this.addTrackingPoint(e), this.panOnlyZoomed && this.contentRect.width - this.contentRect.fitWidth < 1 && this.contentRect.height - this.contentRect.fitHeight < 1 && (this.trackingPoints = []), n(t.target, this.content) && "y" === this.lockedAxis && (this.trackingPoints = []), this.emit("touchEnd", t), this.isDragging = !1, this.lockedAxis = !1, this.state !== v.Destroy && (t.defaultPrevented || this.startDecelAnim())) 956 } 957 startDecelAnim() { 958 var t; 959 const i = this.isScaling; 960 this.rAF && (cancelAnimationFrame(this.rAF), this.rAF = null), this.isBouncingX = !1, this.isBouncingY = !1; 961 for (const t of b) this.velocity[t] = 0; 962 this.target.e = this.current.e, this.target.f = this.current.f, P(this.container, "is-scaling"), P(this.container, "is-animating"), this.isTicking = !1; 963 const { 964 trackingPoints: n 965 } = this, s = n[0], o = n[n.length - 1]; 966 let a = 0, 967 r = 0, 968 l = 0; 969 o && s && (a = o.clientX - s.clientX, r = o.clientY - s.clientY, l = o.time - s.time); 970 const c = (null === (t = window.visualViewport) || void 0 === t ? void 0 : t.scale) || 1; 971 1 !== c && (a *= c, r *= c); 972 let h = 0, 973 d = 0, 974 u = 0, 975 p = 0, 976 f = this.option("decelFriction"); 977 const g = this.targetScale; 978 if (l > 0) { 979 u = Math.abs(a) > 3 ? a / (l / 30) : 0, p = Math.abs(r) > 3 ? r / (l / 30) : 0; 980 const t = this.option("maxVelocity"); 981 t && (u = Math.max(Math.min(u, t), -1 * t), p = Math.max(Math.min(p, t), -1 * t)) 982 } 983 u && (h = u / (1 / (1 - f) - 1)), p && (d = p / (1 / (1 - f) - 1)), ("y" === this.option("lockAxis") || "xy" === this.option("lockAxis") && "y" === this.lockedAxis && e(g) === this.minScale) && (h = u = 0), ("x" === this.option("lockAxis") || "xy" === this.option("lockAxis") && "x" === this.lockedAxis && e(g) === this.minScale) && (d = p = 0); 984 const m = this.dragOffset.x, 985 v = this.dragOffset.y, 986 y = this.option("dragMinThreshold") || 0; 987 Math.abs(m) < y && Math.abs(v) < y && (h = d = 0, u = p = 0), (this.option("zoom") && (g < this.minScale - 1e-5 || g > this.maxScale + 1e-5) || i && !h && !d) && (f = .35), this.applyChange({ 988 panX: h, 989 panY: d, 990 friction: f 991 }), this.emit("decel", u, p, m, v) 992 } 993 onWheel(t) { 994 var e = [-t.deltaX || 0, -t.deltaY || 0, -t.detail || 0].reduce((function(t, e) { 995 return Math.abs(e) > Math.abs(t) ? e : t 996 })); 997 const i = Math.max(-1, Math.min(1, e)); 998 if (this.emit("wheel", t, i), this.panMode === A) return; 999 if (t.defaultPrevented) return; 1000 const n = this.option("wheel"); 1001 "pan" === n ? (t.preventDefault(), this.panOnlyZoomed && !this.canZoomOut() || this.applyChange({ 1002 panX: 2 * -t.deltaX, 1003 panY: 2 * -t.deltaY, 1004 bounce: !1 1005 })) : "zoom" === n && !1 !== this.option("zoom") && this.zoomWithWheel(t) 1006 } 1007 onMouseMove(t) { 1008 this.panWithMouse(t) 1009 } 1010 onKeydown(t) { 1011 "Escape" === t.key && this.toggleFS() 1012 } 1013 onResize() { 1014 this.updateMetrics(), this.checkBounds().inBounds || this.requestTick() 1015 } 1016 setTransform() { 1017 this.emit("beforeTransform"); 1018 const { 1019 current: t, 1020 target: i, 1021 content: n, 1022 contentRect: s 1023 } = this, o = Object.assign({}, T); 1024 for (const n of b) { 1025 const s = "e" == n || "f" === n ? O : M; 1026 o[n] = e(t[n], s), Math.abs(i[n] - t[n]) < ("e" == n || "f" === n ? .51 : .001) && (t[n] = i[n]) 1027 } 1028 let { 1029 a: a, 1030 b: r, 1031 c: l, 1032 d: c, 1033 e: h, 1034 f: d 1035 } = o, u = `matrix(${a}, ${r}, ${l}, ${c}, ${h}, ${d})`, p = n.parentElement instanceof HTMLPictureElement ? n.parentElement : n; 1036 if (this.option("transformParent") && (p = p.parentElement || p), p.style.transform === u) return; 1037 p.style.transform = u; 1038 const { 1039 contentWidth: f, 1040 contentHeight: g 1041 } = this.calculateContentDim(); 1042 s.width = f, s.height = g, this.emit("afterTransform") 1043 } 1044 updateMetrics(t = !1) { 1045 var i; 1046 if (!this || this.state === v.Destroy) return; 1047 if (this.isContentLoading) return; 1048 const n = Math.max(1, (null === (i = window.visualViewport) || void 0 === i ? void 0 : i.scale) || 1), 1049 { 1050 container: s, 1051 content: o 1052 } = this, 1053 a = o instanceof HTMLImageElement, 1054 r = s.getBoundingClientRect(), 1055 l = getComputedStyle(this.container); 1056 let c = r.width * n, 1057 h = r.height * n; 1058 const d = parseFloat(l.paddingTop) + parseFloat(l.paddingBottom), 1059 u = c - (parseFloat(l.paddingLeft) + parseFloat(l.paddingRight)), 1060 p = h - d; 1061 this.containerRect = { 1062 width: c, 1063 height: h, 1064 innerWidth: u, 1065 innerHeight: p 1066 }; 1067 const f = parseFloat(o.dataset.width || "") || (t => { 1068 let e = 0; 1069 return e = t instanceof HTMLImageElement ? t.naturalWidth : t instanceof SVGElement ? t.width.baseVal.value : Math.max(t.offsetWidth, t.scrollWidth), e || 0 1070 })(o), 1071 g = parseFloat(o.dataset.height || "") || (t => { 1072 let e = 0; 1073 return e = t instanceof HTMLImageElement ? t.naturalHeight : t instanceof SVGElement ? t.height.baseVal.value : Math.max(t.offsetHeight, t.scrollHeight), e || 0 1074 })(o); 1075 let m = this.option("width", f) || R, 1076 b = this.option("height", g) || R; 1077 const y = m === R, 1078 w = b === R; 1079 "number" != typeof m && (m = f), "number" != typeof b && (b = g), y && (m = f * (b / g)), w && (b = g / (f / m)); 1080 let x = o.parentElement instanceof HTMLPictureElement ? o.parentElement : o; 1081 this.option("transformParent") && (x = x.parentElement || x); 1082 const E = x.getAttribute("style") || ""; 1083 x.style.setProperty("transform", "none", "important"), a && (x.style.width = "", x.style.height = ""), x.offsetHeight; 1084 const S = o.getBoundingClientRect(); 1085 let P = S.width * n, 1086 C = S.height * n, 1087 T = P, 1088 M = C; 1089 P = Math.min(P, m), C = Math.min(C, b), a ? ({ 1090 width: P, 1091 height: C 1092 } = ((t, e, i, n) => { 1093 const s = i / t, 1094 o = n / e, 1095 a = Math.min(s, o); 1096 return { 1097 width: t *= a, 1098 height: e *= a 1099 } 1100 })(m, b, P, C)) : (P = Math.min(P, m), C = Math.min(C, b)); 1101 let O = .5 * (M - C), 1102 A = .5 * (T - P); 1103 this.contentRect = Object.assign(Object.assign({}, this.contentRect), { 1104 top: S.top - r.top + O, 1105 bottom: r.bottom - S.bottom + O, 1106 left: S.left - r.left + A, 1107 right: r.right - S.right + A, 1108 fitWidth: P, 1109 fitHeight: C, 1110 width: P, 1111 height: C, 1112 fullWidth: m, 1113 fullHeight: b 1114 }), x.style.cssText = E, a && (x.style.width = `${P}px`, x.style.height = `${C}
1114px`), this.setTransform(), !0 !== t && this.emit("refresh"), this.ignoreBounds || (e(this.targetScale) < e(this.minScale) ? this.zoomTo(this.minScale, { 1115 friction: 0 1116 }) : this.targetScale > this.maxScale ? this.zoomTo(this.maxScale, { 1117 friction: 0 1118 }) : this.state === v.Init || this.checkBounds().inBounds || this.requestTick()), this.updateControls() 1119 } 1120 calculateBounds() { 1121 const { 1122 contentWidth: t, 1123 contentHeight: i 1124 } = this.calculateContentDim(this.target), { 1125 targetScale: n, 1126 lockedAxis: s 1127 } = this, { 1128 fitWidth: o, 1129 fitHeight: a 1130 } = this.contentRect; 1131 let r = 0, 1132 l = 0, 1133 c = 0, 1134 h = 0; 1135 const d = this.option("infinite"); 1136 if (!0 === d || s && d === s) r = -1 / 0, c = 1 / 0, l = -1 / 0, h = 1 / 0; 1137 else { 1138 let { 1139 containerRect: s, 1140 contentRect: d 1141 } = this, u = e(o * n, O), p = e(a * n, O), { 1142 innerWidth: f, 1143 innerHeight: g 1144 } = s; 1145 if (s.width === u && (f = s.width), s.width === p && (g = s.height), t > f) { 1146 c = .5 * (t - f), r = -1 * c; 1147 let e = .5 * (d.right - d.left); 1148 r += e, c += e 1149 } 1150 if (o >
vendor: 11,620 bytes, lines 1150-1430
1150 f && t < f && (r -= .5 * (o - f), c -= .5 * (o - f)), i > g) { 1151 h = .5 * (i - g), l = -1 * h; 1152 let t = .5 * (d.bottom - d.top); 1153 l += t, h += t 1154 } 1155 a > g && i < g && (r -= .5 * (a - g), c -= .5 * (a - g)) 1156 } 1157 return { 1158 x: { 1159 min: r, 1160 max: c 1161 }, 1162 y: { 1163 min: l, 1164 max: h 1165 } 1166 } 1167 } 1168 getBounds() { 1169 const t = this.option("bounds"); 1170 return t !== R ? t : this.calculateBounds() 1171 } 1172 updateControls() { 1173 const t = this, 1174 i = t.container, 1175 { 1176 panMode: n, 1177 contentRect: s, 1178 targetScale: o, 1179 minScale: r 1180 } = t; 1181 let l = r, 1182 c = t.option("click") || !1; 1183 c && (l = t.getNextScale(c)); 1184 let h = t.canZoomIn(), 1185 d = t.canZoomOut(), 1186 u = n === L && !!this.option("touch"), 1187 p = d && u; 1188 if (u && (e(o) < e(r) && !this.panOnlyZoomed && (p = !0), (e(s.width, 1) > e(s.fitWidth, 1) || e(s.height, 1) > e(s.fitHeight, 1)) && (p = !0)), e(s.width * o, 1) < e(s.fitWidth, 1) && (p = !1), n === A && (p = !1), a(i, this.cn("isDraggable"), p), !this.option("zoom")) return; 1189 let f = h && e(l) > e(o), 1190 g = !f && !p && d && e(l) < e(o); 1191 a(i, this.cn("canZoomIn"), f), a(i, this.cn("canZoomOut"), g); 1192 for (const t of i.querySelectorAll("[data-panzoom-action]")) { 1193 let e = !1, 1194 i = !1; 1195 switch (t.dataset.panzoomAction) { 1196 case "zoomIn": 1197 h ? e = !0 : i = !0; 1198 break; 1199 case "zoomOut": 1200 d ? e = !0 : i = !0; 1201 break; 1202 case "toggleZoom": 1203 case "iterateZoom": 1204 h || d ? e = !0 : i = !0; 1205 const n = t.querySelector("g"); 1206 n && (n.style.display = h ? "" : "none") 1207 } 1208 e ? (t.removeAttribute("disabled"), t.removeAttribute("tabindex")) : i && (t.setAttribute("disabled", ""), t.setAttribute("tabindex", "-1")) 1209 } 1210 } 1211 panTo({ 1212 x: t = this.target.e, 1213 y: e = this.target.f, 1214 scale: i = this.targetScale, 1215 friction: n = this.option("friction"), 1216 angle: s = 0, 1217 originX: o = 0, 1218 originY: a = 0, 1219 flipX: r = !1, 1220 flipY: l = !1, 1221 ignoreBounds: c = !1 1222 }) { 1223 this.state !== v.Destroy && this.applyChange({ 1224 panX: t - this.target.e, 1225 panY: e - this.target.f, 1226 scale: i / this.targetScale, 1227 angle: s, 1228 originX: o, 1229 originY: a, 1230 friction: n, 1231 flipX: r, 1232 flipY: l, 1233 ignoreBounds: c 1234 }) 1235 } 1236 applyChange({ 1237 panX: t = 0, 1238 panY: i = 0, 1239 scale: n = 1, 1240 angle: s = 0, 1241 originX: o = -this.current.e, 1242 originY: a = -this.current.f, 1243 friction: r = this.option("friction"), 1244 flipX: l = !1, 1245 flipY: c = !1, 1246 ignoreBounds: h = !1, 1247 bounce: d = this.option("bounce") 1248 }) { 1249 const u = this.state; 1250 if (u === v.Destroy) return; 1251 this.rAF && (cancelAnimationFrame(this.rAF), this.rAF = null), this.friction = r || 0, this.ignoreBounds = h; 1252 const { 1253 current: p 1254 } = this, f = p.e, g = p.f, m = this.getMatrix(this.target); 1255 let y = (new DOMMatrix).translate(f, g).translate(o, a).translate(t, i); 1256 if (this.option("zoom")) { 1257 if (!h) { 1258 const t = this.targetScale, 1259 e = this.minScale, 1260 i = this.maxScale; 1261 t * n < e && (n = e / t), t * n > i && (n = i / t) 1262 } 1263 y = y.scale(n) 1264 } 1265 y = y.translate(-o, -a).translate(-f, -g).multiply(m), s && (y = y.rotate(s)), l && (y = y.scale(-1, 1)), c && (y = y.scale(1, -1)); 1266 for (const t of b) "e" !== t && "f" !== t && (y[t] > this.minScale + 1e-5 || y[t] < this.minScale - 1e-5) ? this.target[t] = y[t] : this.target[t] = e(y[t], O); 1267 (this.targetScale < this.scale || Math.abs(n - 1) > .1 || this.panMode === A || !1 === d) && !h && this.clampTargetBounds(), u === v.Init ? this.animate() : this.isResting || (this.state = v.Panning, this.requestTick()) 1268 } 1269 stop(t = !1) { 1270 if (this.state === v.Init || this.state === v.Destroy) return; 1271 const e = this.isTicking; 1272 this.rAF && (cancelAnimationFrame(this.rAF), this.rAF = null), this.isBouncingX = !1, this.isBouncingY = !1; 1273 for (const e of b) this.velocity[e] = 0, "current" === t ? this.current[e] = this.target[e] : "target" === t && (this.target[e] = this.current[e]); 1274 this.setTransform(), P(this.container, "is-scaling"), P(this.container, "is-animating"), this.isTicking = !1, this.state = v.Ready, e && (this.emit("endAnimation"), this.updateControls()) 1275 } 1276 requestTick() { 1277 this.isTicking || (this.emit("startAnimation"), this.updateControls(), C(this.container, "is-animating"), this.isScaling && C(this.container, "is-scaling")), this.isTicking = !0, this.rAF || (this.rAF = requestAnimationFrame((() => this.animate()))) 1278 } 1279 panWithMouse(t, i = this.option("mouseMoveFriction")) { 1280 if (this.pmme = t, this.panMode !== A || !t) return; 1281 if (e(this.targetScale) <= e(this.minScale)) return; 1282 this.emit("mouseMove", t); 1283 const { 1284 container: n, 1285 containerRect: s, 1286 contentRect: o 1287 } = this, a = s.width, r = s.height, l = n.getBoundingClientRect(), c = (t.clientX || 0) - l.left, h = (t.clientY || 0) - l.top; 1288 let { 1289 contentWidth: d, 1290 contentHeight: u 1291 } = this.calculateContentDim(this.target); 1292 const p = this.option("mouseMoveFactor"); 1293 p > 1 && (d !== a && (d *= p), u !== r && (u *= p)); 1294 let f = .5 * (d - a) - c / a * 100 / 100 * (d - a); 1295 f += .5 * (o.right - o.left); 1296 let g = .5 * (u - r) - h / r * 100 / 100 * (u - r); 1297 g += .5 * (o.bottom - o.top), this.applyChange({ 1298 panX: f - this.target.e, 1299 panY: g - this.target.f, 1300 friction: i 1301 }) 1302 } 1303 zoomWithWheel(t) { 1304 if (this.state === v.Destroy || this.state === v.Init) return; 1305 const i = Date.now(); 1306 if (i - this.pwt < 45) return void t.preventDefault(); 1307 this.pwt = i; 1308 var n = [-t.deltaX || 0, -t.deltaY || 0, -t.detail || 0].reduce((function(t, e) { 1309 return Math.abs(e) > Math.abs(t) ? e : t 1310 })); 1311 const s = Math.max(-1, Math.min(1, n)), 1312 { 1313 targetScale: o, 1314 maxScale: a, 1315 minScale: r 1316 } = this; 1317 let l = o * (100 + 45 * s) / 100; 1318 e(l) < e(r) && e(o) <= e(r) ? (this.cwd += Math.abs(s), l = r) : e(l) > e(a) && e(o) >= e(a) ? (this.cwd += Math.abs(s), l = a) : (this.cwd = 0, l = Math.max(Math.min(l, a), r)), this.cwd > this.option("wheelLimit") || (t.preventDefault(), e(l) !== e(o) && this.zoomTo(l, { 1319 event: t 1320 })) 1321 } 1322 canZoomIn() { 1323 return this.option("zoom") && (e(this.contentRect.width, 1) < e(this.contentRect.fitWidth, 1) || e(this.targetScale) < e(this.maxScale)) 1324 } 1325 canZoomOut() { 1326 return this.option("zoom") && e(this.targetScale) > e(this.minScale) 1327 } 1328 zoomIn(t = 1.25, e) { 1329 this.zoomTo(this.targetScale * t, e) 1330 } 1331 zoomOut(t = .8, e) { 1332 this.zoomTo(this.targetScale * t, e) 1333 } 1334 zoomToFit(t) { 1335 this.zoomTo("fit", t) 1336 } 1337 zoomToCover(t) { 1338 this.zoomTo("cover", t) 1339 } 1340 zoomToFull(t) { 1341 this.zoomTo("full", t) 1342 } 1343 zoomToMax(t) { 1344 this.zoomTo("max", t) 1345 } 1346 toggleZoom(t) { 1347 this.zoomTo(this.getNextScale("toggleZoom"), t) 1348 } 1349 toggleMax(t) { 1350 this.zoomTo(this.getNextScale("toggleMax"), t) 1351 } 1352 toggleCover(t) { 1353 this.zoomTo(this.getNextScale("toggleCover"), t) 1354 } 1355 iterateZoom(t) { 1356 this.zoomTo("next", t) 1357 } 1358 zoomTo(t = 1, { 1359 friction: e = R, 1360 originX: i = R, 1361 originY: n = R, 1362 event: s 1363 } = {}) { 1364 if (this.isContentLoading || this.state === v.Destroy) return; 1365 const { 1366 targetScale: o, 1367 fullScale: a, 1368 maxScale: r, 1369 coverScale: l 1370 } = this; 1371 if (this.stop(), this.panMode === A && (s = this.pmme || s), s || i === R || n === R) { 1372 const t = this.content.getBoundingClientRect(), 1373 e = this.container.getBoundingClientRect(), 1374 o = s ? s.clientX : e.left + .5 * e.width, 1375 a = s ? s.clientY : e.top + .5 * e.height; 1376 i = o - t.left - .5 * t.width, n = a - t.top - .5 * t.height 1377 } 1378 let c = 1; 1379 "number" == typeof t ? c = t : "full" === t ? c = a : "cover" === t ? c = l : "max" === t ? c = r : "fit" === t ? c = 1 : "next" === t && (c = this.getNextScale("iterateZoom")), c = c / o || 1, e = e === R ? c > 1 ? .15 : .25 : e, this.applyChange({ 1380 scale: c, 1381 originX: i, 1382 originY: n, 1383 friction: e 1384 }), s && this.panMode === A && this.panWithMouse(s, e) 1385 } 1386 rotateCCW() { 1387 this.applyChange({ 1388 angle: -90 1389 }) 1390 } 1391 rotateCW() { 1392 this.applyChange({ 1393 angle: 90 1394 }) 1395 } 1396 flipX() { 1397 this.applyChange({ 1398 flipX: !0 1399 }) 1400 } 1401 flipY() { 1402 this.applyChange({ 1403 flipY: !0 1404 }) 1405 } 1406 fitX() { 1407 this.stop("target"); 1408 const { 1409 containerRect: t, 1410 contentRect: e, 1411 target: i 1412 } = this; 1413 this.applyChange({ 1414 panX: .5 * t.width - (e.left + .5 * e.fitWidth) - i.e, 1415 panY: .5 * t.height - (e.top + .5 * e.fitHeight) - i.f, 1416 scale: t.width / e.fitWidth / this.targetScale, 1417 originX: 0, 1418 originY: 0, 1419 ignoreBounds: !0 1420 }) 1421 } 1422 fitY() { 1423 this.stop("target"); 1424 const { 1425 containerRect: t, 1426 contentRect: e, 1427 target: i 1428 } = this; 1429 this.applyChange({ 1430 panX: .5 * t.width - (e.left + .5 * e.fitWidth) - i.e,
vendor: 28,367 bytes, lines 1431-2110
1431 panY: .5 * t.innerHeight - (e.top + .5 * e.fitHeight) - i.f, 1432 scale: t.height / e.fitHeight / this.targetScale, 1433 originX: 0, 1434 originY: 0, 1435 ignoreBounds: !0 1436 }) 1437 } 1438 toggleFS() { 1439 const { 1440 container: t 1441 } = this, e = this.cn("inFullscreen"), i = this.cn("htmlHasFullscreen"); 1442 t.classList.toggle(e); 1443 const n = t.classList.contains(e); 1444 n ? (document.documentElement.classList.add(i), document.addEventListener("keydown", this.onKeydown, !0)) : (document.documentElement.classList.remove(i), document.removeEventListener("keydown", this.onKeydown, !0)), this.updateMetrics(), this.emit(n ? "enterFS" : "exitFS") 1445 } 1446 getMatrix(t = this.current) { 1447 const { 1448 a: e, 1449 b: i, 1450 c: n, 1451 d: s, 1452 e: o, 1453 f: a 1454 } = t; 1455 return new DOMMatrix([e, i, n, s, o, a]) 1456 } 1457 reset(t) { 1458 if (this.state !== v.Init && this.state !== v.Destroy) { 1459 this.stop("current"); 1460 for (const t of b) this.target[t] = T[t]; 1461 this.target.a = this.minScale, this.target.d = this.minScale, this.clampTargetBounds(), this.isResting || (this.friction = void 0 === t ? this.option("friction") : t, this.state = v.Panning, this.requestTick()) 1462 } 1463 } 1464 destroy() { 1465 this.stop(), this.state = v.Destroy, this.detachEvents(), this.detachObserver(); 1466 const { 1467 container: t, 1468 content: e 1469 } = this, i = this.option("classes") || {}; 1470 for (const e of Object.values(i)) t.classList.remove(e + ""); 1471 e && (e.removeEventListener("load", this.onLoad), e.removeEventListener("error", this.onError)), this.detachPlugins() 1472 } 1473 } 1474 Object.defineProperty(D, "defaults", { 1475 enumerable: !0, 1476 configurable: !0, 1477 writable: !0, 1478 value: w 1479 }), Object.defineProperty(D, "Plugins", { 1480 enumerable: !0, 1481 configurable: !0, 1482 writable: !0, 1483 value: {} 1484 }); 1485 const F = function(t, e) { 1486 let i = !0; 1487 return (...n) => { 1488 i && (i = !1, t(...n), setTimeout((() => { 1489 i = !0 1490 }), e)) 1491 } 1492 }, 1493 j = (t, e) => { 1494 let i = []; 1495 return t.childNodes.forEach((t => { 1496 t.nodeType !== Node.ELEMENT_NODE || e && !t.matches(e) || i.push(t) 1497 })), i 1498 }, 1499 B = { 1500 viewport: null, 1501 track: null, 1502 enabled: !0, 1503 slides: [], 1504 axis: "x", 1505 transition: "fade", 1506 preload: 1, 1507 slidesPerPage: "auto", 1508 initialPage: 0, 1509 friction: .12, 1510 Panzoom: { 1511 decelFriction: .12 1512 }, 1513 center: !0, 1514 infinite: !0, 1515 fill: !0, 1516 dragFree: !1, 1517 adaptiveHeight: !1, 1518 direction: "ltr", 1519 classes: { 1520 container: "f-carousel", 1521 viewport: "f-carousel__viewport", 1522 track: "f-carousel__track", 1523 slide: "f-carousel__slide", 1524 isLTR: "is-ltr", 1525 isRTL: "is-rtl", 1526 isHorizontal: "is-horizontal", 1527 isVertical: "is-vertical", 1528 inTransition: "in-transition", 1529 isSelected: "is-selected" 1530 }, 1531 l10n: { 1532 NEXT: "Next slide", 1533 PREV: "Previous slide", 1534 GOTO: "Go to slide #%d" 1535 } 1536 }; 1537 var H; 1538 ! function(t) { 1539 t[t.Init = 0] = "Init", t[t.Ready = 1] = "Ready", t[t.Destroy = 2] = "Destroy" 1540 }(H || (H = {})); 1541 const N = t => { 1542 if ("string" == typeof t || t instanceof HTMLElement) t = { 1543 html: t 1544 }; 1545 else { 1546 const e = t.thumb; 1547 void 0 !== e && ("string" == typeof e && (t.thumbSrc = e), e instanceof HTMLImageElement && (t.thumbEl = e, t.thumbElSrc = e.src, t.thumbSrc = e.src), delete t.thumb) 1548 } 1549 return Object.assign({ 1550 html: "", 1551 el: null, 1552 isDom: !1, 1553 class: "", 1554 customClass: "", 1555 index: -1, 1556 dim: 0, 1557 gap: 0, 1558 pos: 0, 1559 transition: !1 1560 }, t) 1561 }, 1562 _ = (t = {}) => Object.assign({ 1563 index: -1, 1564 slides: [], 1565 dim: 0, 1566 pos: -1 1567 }, t); 1568 class $ extends g { 1569 constructor(t, e) { 1570 super(e), Object.defineProperty(this, "instance", { 1571 enumerable: !0, 1572 configurable: !0, 1573 writable: !0, 1574 value: t 1575 }) 1576 } 1577 attach() {} 1578 detach() {} 1579 } 1580 const W = { 1581 classes: { 1582 list: "f-carousel__dots", 1583 isDynamic: "is-dynamic", 1584 hasDots: "has-dots", 1585 dot: "f-carousel__dot", 1586 isBeforePrev: "is-before-prev", 1587 isPrev: "is-prev", 1588 isCurrent: "is-current", 1589 isNext: "is-next", 1590 isAfterNext: "is-after-next" 1591 }, 1592 dotTpl: '<button type="button" data-carousel-page="%i" aria-label="{{GOTO}}"><span class="f-carousel__dot" aria-hidden="true"></span></button>', 1593 dynamicFrom: 11, 1594 maxCount: 1 / 0, 1595 minCount: 2 1596 }; 1597 class X extends $ { 1598 constructor() { 1599 super(...arguments), Object.defineProperty(this, "isDynamic", { 1600 enumerable: !0, 1601 configurable: !0, 1602 writable: !0, 1603 value: !1 1604 }), Object.defineProperty(this, "list", { 1605 enumerable: !0, 1606 configurable: !0, 1607 writable: !0, 1608 value: null 1609 }) 1610 } 1611 onRefresh() { 1612 this.refresh() 1613 } 1614 build() { 1615 let t = this.list; 1616 if (!t) { 1617 t = document.createElement("ul"), C(t, this.cn("list")), t.setAttribute("role", "tablist"); 1618 const e = this.instance.container; 1619 e.appendChild(t), C(e, this.cn("hasDots")), this.list = t 1620 } 1621 return t 1622 } 1623 refresh() { 1624 var t; 1625 const e = this.instance.pages.length, 1626 i = Math.min(2, this.option("minCount")), 1627 n = Math.max(2e3, this.option("maxCount")), 1628 s = this.option("dynamicFrom"); 1629 if (e < i || e > n) return void this.cleanup(); 1630 const o = "number" == typeof s && e > 5 && e >= s, 1631 r = !this.list || this.isDynamic !== o || this.list.children.length !== e; 1632 r && this.cleanup(); 1633 const l = this.build(); 1634 if (a(l, this.cn("isDynamic"), !!o), r) 1635 for (let t = 0; t < e; t++) l.append(this.createItem(t)); 1636 let c, h = 0; 1637 for (const e of [...l.children]) { 1638 const i = h === this.instance.page; 1639 i && (c = e), a(e, this.cn("isCurrent"), i), null === (t = e.children[0]) || void 0 === t || t.setAttribute("aria-selected", i ? "true" : "false"); 1640 for (const t of ["isBeforePrev", "isPrev", "isNext", "isAfterNext"]) P(e, this.cn(t)); 1641 h++ 1642 } 1643 if (c = c || l.firstChild, o && c) { 1644 const t = c.previousElementSibling, 1645 e = t && t.previousElementSibling; 1646 C(t, this.cn("isPrev")), C(e, this.cn("isBeforePrev")); 1647 const i = c.nextElementSibling, 1648 n = i && i.nextElementSibling; 1649 C(i, this.cn("isNext")), C(n, this.cn("isAfterNext")) 1650 } 1651 this.isDynamic = o 1652 } 1653 createItem(t = 0) { 1654 var e; 1655 const i = document.createElement("li"); 1656 i.setAttribute("role", "presentation"); 1657 const n = s(this.instance.localize(this.option("dotTpl"), [ 1658 ["%d", t + 1] 1659 ]).replace(/\%i/g, t + "")); 1660 return i.appendChild(n), null === (e = i.children[0]) || void 0 === e || e.setAttribute("role", "tab"), i 1661 } 1662 cleanup() { 1663 this.list && (this.list.remove(), this.list = null), this.isDynamic = !1, P(this.instance.container, this.cn("hasDots")) 1664 } 1665 attach() { 1666 this.instance.on(["refresh", "change"], this.onRefresh) 1667 } 1668 detach() { 1669 this.instance.off(["refresh", "change"], this.onRefresh), this.cleanup() 1670 } 1671 } 1672 Object.defineProperty(X, "defaults", { 1673 enumerable: !0, 1674 configurable: !0, 1675 writable: !0, 1676 value: W 1677 }); 1678 const q = "disabled", 1679 Y = "next", 1680 V = "prev"; 1681 class Z extends $ { 1682 constructor() { 1683 super(...arguments), Object.defineProperty(this, "container", { 1684 enumerable: !0, 1685 configurable: !0, 1686 writable: !0, 1687 value: null 1688 }), Object.defineProperty(this, "prev", { 1689 enumerable: !0, 1690 configurable: !0, 1691 writable: !0, 1692 value: null 1693 }), Object.defineProperty(this, "next", { 1694 enumerable: !0, 1695 configurable: !0, 1696 writable: !0, 1697 value: null 1698 }), Object.defineProperty(this, "isDom", { 1699 enumerable: !0, 1700 configurable: !0, 1701 writable: !0, 1702 value: !1 1703 }) 1704 } 1705 onRefresh() { 1706 const t = this.instance, 1707 e = t.pages.length, 1708 i = t.page; 1709 if (e < 2) return void this.cleanup(); 1710 this.build(); 1711 let n = this.prev, 1712 s = this.next; 1713 n && s && (n.removeAttribute(q), s.removeAttribute(q), t.isInfinite || (i <= 0 && n.setAttribute(q, ""), i >= e - 1 && s.setAttribute(q, ""))) 1714 } 1715 addBtn(t) { 1716 var e; 1717 const i = this.instance, 1718 n = document.createElement("button"); 1719 n.setAttribute("tabindex", "0"), n.setAttribute("title", i.localize(`{{${t.toUpperCase()}}}`)), C(n, this.cn("button") + " " + this.cn(t === Y ? "isNext" : "isPrev")); 1720 const s = i.isRTL ? t === Y ? V : Y : t; 1721 var o; 1722 return n.innerHTML = i.localize(this.option(`${s}Tpl`)), n.dataset[`carousel${o=t,o?o.match("^[a-z]")?o.charAt(0).toUpperCase()+o.substring(1):o:""}`] = "true", null === (e = this.container) || void 0 === e || e.appendChild(n), n 1723 } 1724 build() { 1725 const t = this.instance.container, 1726 e = this.cn("container"); 1727 let { 1728 container: i, 1729 prev: n, 1730 next: s 1731 } = this; 1732 i || (i = t.querySelector("." + e), this.isDom = !!i), i || (i = document.createElement("div"), C(i, e), t.appendChild(i)), this.container = i, s || (s = i.querySelector("[data-carousel-next]")), s || (s = this.addBtn(Y)), this.next = s, n || (n = i.querySelector("[data-carousel-prev]")), n || (n = this.addBtn(V)), this.prev = n 1733 } 1734 cleanup() { 1735 this.isDom || (this.prev && this.prev.remove(), this.next && this.next.remove(), this.container && this.container.remove()), this.prev = null, this.next = null, this.container = null, this.isDom = !1 1736 } 1737 attach() { 1738 this.instance.on(["refresh", "change"], this.onRefresh) 1739 } 1740 detach() { 1741 this.instance.off(["refresh", "change"], this.onRefresh), this.cleanup() 1742 } 1743 } 1744 Object.defineProperty(Z, "defaults", { 1745 enumerable: !0, 1746 configurable: !0, 1747 writable: !0, 1748 value: { 1749 classes: { 1750 container: "f-carousel__nav", 1751 button: "f-button", 1752 isNext: "is-next", 1753 isPrev: "is-prev" 1754 }, 1755 nextTpl: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M9 3l9 9-9 9"/></svg>', 1756 prevTpl: '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1"><path d="M15 3l-9 9 9 9"/></svg>' 1757 } 1758 }); 1759 class U extends $ { 1760 constructor() { 1761 super(...arguments), Object.defineProperty(this, "selectedIndex", { 1762 enumerable: !0, 1763 configurable: !0, 1764 writable: !0, 1765 value: null 1766 }), Object.defineProperty(this, "target", { 1767 enumerable: !0, 1768 configurable: !0, 1769 writable: !0, 1770 value: null 1771 }), Object.defineProperty(this, "nav", { 1772 enumerable: !0, 1773 configurable: !0, 1774 writable: !0, 1775 value: null 1776 }) 1777 } 1778 addAsTargetFor(t) { 1779 this.target = this.instance, this.nav = t, this.attachEvents() 1780 } 1781 addAsNavFor(t) { 1782 this.nav = this.instance, this.target = t, this.attachEvents() 1783 } 1784 attachEvents() { 1785 const { 1786 nav: t, 1787 target: e 1788 } = this; 1789 t && e && (t.options.initialSlide = e.options.initialPage, t.state === H.Ready ? this.onNavReady(t) : t.on("ready", this.onNavReady), e.state === H.Ready ? this.onTargetReady(e) : e.on("ready", this.onTargetReady)) 1790 } 1791 onNavReady(t) { 1792 t.on("createSlide", this.onNavCreateSlide), t.on("Panzoom.click", this.onNavClick), t.on("Panzoom.touchEnd", this.onNavTouch), this.onTargetChange() 1793 } 1794 onTargetReady(t) { 1795 t.on("change", this.onTargetChange), t.on("Panzoom.refresh", this.onTargetChange), this.onTargetChange() 1796 } 1797 onNavClick(t, e, i) { 1798 this.onNavTouch(t, t.panzoom, i) 1799 } 1800 onNavTouch(t, e, i) { 1801 var n, s; 1802 if (Math.abs(e.dragOffset.x) > 3 || Math.abs(e.dragOffset.y) > 3) return; 1803 const o = i.target, 1804 { 1805 nav: a, 1806 target: r 1807 } = this; 1808 if (!a || !r || !o) return; 1809 const l = o.closest("[data-index]"); 1810 if (i.stopPropagation(), i.preventDefault(), !l) return; 1811 const c = parseInt(l.dataset.index || "", 10) || 0, 1812 h = r.getPageForSlide(c), 1813 d = a.getPageForSlide(c); 1814 a.slideTo(d), r.slideTo(h, { 1815 friction: (null === (s = null === (n = this.nav) || void 0 === n ? void 0 : n.plugins) || void 0 === s ? void 0 : s.Sync.option("friction")) || 0 1816 }), this.markSelectedSlide(c) 1817 } 1818 onNavCreateSlide(t, e) { 1819 e.index === this.selectedIndex && this.markSelectedSlide(e.index) 1820 } 1821 onTargetChange() { 1822 var t, e; 1823 const { 1824 target: i, 1825 nav: n 1826 } = this; 1827 if (!i || !n) return; 1828 if (n.state !== H.Ready || i.state !== H.Ready) return; 1829 const s = null === (e = null === (t = i.pages[i.page]) || void 0 === t ? void 0 : t.slides[0]) || void 0 === e ? void 0 : e.index, 1830 o = n.getPageForSlide(s); 1831 this.markSelectedSlide(s), n.slideTo(o, null === n.prevPage && null === i.prevPage ? { 1832 friction: 0 1833 } : void 0) 1834 } 1835 markSelectedSlide(t) { 1836 const e = this.nav; 1837 e && e.state === H.Ready && (this.selectedIndex = t, [...e.slides].map((e => { 1838 e.el && e.el.classList[e.index === t ? "add" : "remove"]("is-nav-selected") 1839 }))) 1840 } 1841 attach() { 1842 const t = this; 1843 let e = t.options.target, 1844 i = t.options.nav; 1845 e ? t.addAsNavFor(e) : i && t.addAsTargetFor(i) 1846 } 1847 detach() { 1848 const t = this, 1849 e = t.nav, 1850 i = t.target; 1851 e && (e.off("ready", t.onNavReady), e.off("createSlide", t.onNavCreateSlide), e.off("Panzoom.click", t.onNavClick), e.off("Panzoom.touchEnd", t.onNavTouch)), t.nav = null, i && (i.off("ready", t.onTargetReady), i.off("refresh", t.onTargetChange), i.off("change", t.onTargetChange)), t.target = null 1852 } 1853 } 1854 Object.defineProperty(U, "defaults", { 1855 enumerable: !0, 1856 configurable: !0, 1857 writable: !0, 1858 value: { 1859 friction: .35 1860 } 1861 }); 1862 const G = { 1863 Navigation: Z, 1864 Dots: X, 1865 Sync: U 1866 }, 1867 K = "animationend", 1868 J = "isSelected", 1869 Q = "slide"; 1870 class tt extends m { 1871 get axis() { 1872 return this.isHorizontal ? "e" : "f" 1873 } 1874 get isEnabled() { 1875 return this.state === H.Ready 1876 } 1877 get isInfinite() { 1878 let t = !1; 1879 const { 1880 contentDim: e, 1881 viewportDim: i, 1882 pages: n, 1883 slides: s 1884 } = this, o = s[0]; 1885 return n.length >= 2 && o && e + o.dim >= i && (t = this.option("infinite")), t 1886 } 1887 get isRTL() { 1888 return "rtl" === this.option("direction") 1889 } 1890 get isHorizontal() { 1891 return "x" === this.option("axis") 1892 } 1893 constructor(t, e = {}, i = {}) { 1894 if (super(), Object.defineProperty(this, "bp", { 1895 enumerable: !0, 1896 configurable: !0, 1897 writable: !0, 1898 value: "" 1899 }), Object.defineProperty(this, "lp", { 1900 enumerable: !0, 1901 configurable: !0, 1902 writable: !0, 1903 value: 0 1904 }), Object.defineProperty(this, "userOptions", { 1905 enumerable: !0, 1906 configurable: !0, 1907 writable: !0, 1908 value: {} 1909 }), Object.defineProperty(this, "userPlugins", { 1910 enumerable: !0, 1911 configurable: !0, 1912 writable: !0, 1913 value: {} 1914 }), Object.defineProperty(this, "state", { 1915 enumerable: !0, 1916 configurable: !0, 1917 writable: !0, 1918 value: H.Init 1919 }), Object.defineProperty(this, "page", { 1920 enumerable: !0, 1921 configurable: !0, 1922 writable: !0, 1923 value: 0 1924 }), Object.defineProperty(this, "prevPage", { 1925 enumerable: !0, 1926 configurable: !0, 1927 writable: !0, 1928 value: null 1929 }), Object.defineProperty(this, "container", { 1930 enumerable: !0, 1931 configurable: !0, 1932 writable: !0, 1933 value: void 0 1934 }), Object.defineProperty(this, "viewport", { 1935 enumerable: !0, 1936 configurable: !0, 1937 writable: !0, 1938 value: null 1939 }), Object.defineProperty(this, "track", { 1940 enumerable: !0, 1941 configurable: !0, 1942 writable: !0, 1943 value: null 1944 }), Object.defineProperty(this, "slides", { 1945 enumerable: !0, 1946 configurable: !0, 1947 writable: !0, 1948 value: [] 1949 }), Object.defineProperty(this, "pages", { 1950 enumerable: !0, 1951 configurable: !0, 1952 writable: !0, 1953 value: [] 1954 }), Object.defineProperty(this, "panzoom", { 1955 enumerable: !0, 1956 configurable: !0, 1957 writable: !0, 1958 value: null 1959 }), Object.defineProperty(this, "inTransition", { 1960 enumerable: !0, 1961 configurable: !0, 1962 writable: !0, 1963 value: new Set 1964 }), Object.defineProperty(this, "contentDim", { 1965 enumerable: !0, 1966 configurable: !0, 1967 writable: !0, 1968 value: 0 1969 }), Object.defineProperty(this, "viewportDim", { 1970 enumerable: !0, 1971 configurable: !0, 1972 writable: !0, 1973 value: 0 1974 }), "string" == typeof t && (t = document.querySelector(t)), !t || !S(t)) throw new Error("No Element found"); 1975 this.container = t, this.slideNext = F(this.slideNext.bind(this), 150), this.slidePrev = F(this.slidePrev.bind(this), 150), this.userOptions = e, this.userPlugins = i, queueMicrotask((() => { 1976 this.processOptions() 1977 })) 1978 } 1979 processOptions() { 1980 var t, e; 1981 const i = p({}, tt.defaults, this.userOptions); 1982 let n = ""; 1983 const s = i.breakpoints; 1984 if (s && u(s)) 1985 for (const [t, e] of Object.entries(s)) window.matchMedia(t).matches && u(e) && (n += t, p(i, e)); 1986 n === this.bp && this.state !== H.Init || (this.bp = n, this.state === H.Ready && (i.initialSlide = (null === (e = null === (t = this.pages[this.page]) || void 0 === t ? void 0 : t.slides[0]) || void 0 === e ? void 0 : e.index) || 0), this.state !== H.Init && this.destroy(), super.setOptions(i), !1 === this.option("enabled") ? this.attachEvents() : setTimeout((() => { 1987 this.init() 1988 }), 0)) 1989 } 1990 init() { 1991 this.state = H.Init, this.emit("init"), this.attachPlugins(Object.assign(Object.assign({}, tt.Plugins), this.userPlugins)), this.emit("attachPlugins"), this.initLayout(), this.initSlides(), this.updateMetrics(), this.setInitialPosition(), this.initPanzoom(), this.attachEvents(), this.state = H.Ready, this.emit("ready") 1992 } 1993 initLayout() { 1994 const { 1995 container: t 1996 } = this, e = this.option("classes"); 1997 C(t, this.cn("container")), a(t, e.isLTR, !this.isRTL), a(t, e.isRTL, this.isRTL), a(t, e.isVertical, !this.isHorizontal), a(t, e.isHorizontal, this.isHorizontal); 1998 let i = this.option("viewport") || t.querySelector(`.${e.viewport}`); 1999 i || (i = document.createElement("div"), C(i, e.viewport), i.append(...j(t, `.${e.slide}`)), t.prepend(i)), i.addEventListener("scroll", this.onScroll); 2000 let n = this.option("track") || t.querySelector(`.${e.track}`); 2001 n || (n = document.createElement("div"), C(n, e.track), n.append(...Array.from(i.childNodes))), n.setAttribute("aria-live", "polite"), i.contains(n) || i.prepend(n), this.viewport = i, this.track = n, this.emit("initLayout") 2002 } 2003 initSlides() { 2004 const { 2005 track: t 2006 } = this; 2007 if (!t) return; 2008 const e = [...this.slides], 2009 i = []; 2010 [...j(t, `.${this.cn(Q)}`)].forEach((t => { 2011 if (S(t)) { 2012 const e = N({ 2013 el: t, 2014 isDom: !0, 2015 index: this.slides.length 2016 }); 2017 i.push(e) 2018 } 2019 })); 2020 for (let t of [...this.option("slides", []) || [], ...e]) i.push(N(t)); 2021 this.slides = i; 2022 for (let t = 0; t < this.slides.length; t++) this.slides[t].index = t; 2023 for (const t of i) this.emit("beforeInitSlide", t, t.index), this.emit("initSlide", t, t.index); 2024 this.emit("initSlides") 2025 } 2026 setInitialPage() { 2027 const t = this.option("initialSlide"); 2028 this.page = "number" == typeof t ? this.getPageForSlide(t) : parseInt(this.option("initialPage", 0) + "", 10) || 0 2029 } 2030 setInitialPosition() { 2031 const { 2032 track: t, 2033 pages: e, 2034 isHorizontal: i 2035 } = this; 2036 if (!t || !e.length) return; 2037 let n = this.page; 2038 e[n] || (this.page = n = 0); 2039 const s = (e[n].pos || 0) * (this.isRTL && i ? 1 : -1), 2040 o = i ? `${s}px` : "0", 2041 a = i ? "0" : `${s}px`; 2042 t.style.transform = `translate3d(${o}, ${a}, 0) scale(1)`, this.option("adaptiveHeight") && this.setViewportHeight() 2043 } 2044 initPanzoom() { 2045 this.panzoom && (this.panzoom.destroy(), this.panzoom = null); 2046 const t = this.option("Panzoom") || {}; 2047 this.panzoom = new D(this.viewport, p({}, { 2048 content: this.track, 2049 zoom: !1, 2050 panOnlyZoomed: !1, 2051 lockAxis: this.isHorizontal ? "x" : "y", 2052 infinite: this.isInfinite, 2053 click: !1, 2054 dblClick: !1, 2055 touch: t => !(this.pages.length < 2 && !t.options.infinite), 2056 bounds: () => this.getBounds(), 2057 maxVelocity: t => Math.abs(t.target[this.axis] - t.current[this.axis]) < 2 * this.viewportDim ? 100 : 0 2058 }, t)), this.panzoom.on("*", ((t, e, ...i) => { 2059 this.emit(`Panzoom.${e}`, t, ...i) 2060 })), this.panzoom.on("decel", this.onDecel), this.panzoom.on("refresh", this.onRefresh), this.panzoom.on("beforeTransform", this.onBeforeTransform), this.panzoom.on("endAnimation", this.onEndAnimation) 2061 } 2062 attachEvents() { 2063 const t = this.container; 2064 t && (t.addEventListener("click", this.onClick, { 2065 passive: !1, 2066 capture: !1 2067 }), t.addEventListener("slideTo", this.onSlideTo)), window.addEventListener("resize", this.onResize) 2068 } 2069 createPages() { 2070 let t = []; 2071 const { 2072 contentDim: e, 2073 viewportDim: i 2074 } = this; 2075 let n = this.option("slidesPerPage"); 2076 n = ("auto" === n || e <= i) && !1 !== this.option("fill") ? 1 / 0 : parseFloat(n + ""); 2077 let s = 0, 2078 o = 0, 2079 a = 0; 2080 for (const e of this.slides)(!t.length || o + e.dim - i > .05 || a >= n) && (t.push(_()), s = t.length - 1, o = 0, a = 0), t[s].slides.push(e), o += e.dim + e.gap, a++; 2081 return t 2082 } 2083 processPages() { 2084 const t = this.pages, 2085 { 2086 contentDim: i, 2087 viewportDim: n, 2088 isInfinite: s 2089 } = this, 2090 o = this.option("center"), 2091 a = this.option("fill"), 2092 r = a && o && i > n && !s; 2093 if (t.forEach(((t, e) => { 2094 var s; 2095 t.index = e, t.pos = (null === (s = t.slides[0]) || void 0 === s ? void 0 : s.pos) || 0, t.dim = 0; 2096 for (const [e, i] of t.slides.entries()) t.dim += i.dim, e < t.slides.length - 1 && (t.dim += i.gap); 2097 r && t.pos + .5 * t.dim < .5 * n ? t.pos = 0 : r && t.pos + .5 * t.dim >= i - .5 * n ? t.pos = i - n : o && (t.pos += -.5 * (n - t.dim)) 2098 })), t.forEach((t => { 2099 a && !s && i > n && (t.pos = Math.max(t.pos, 0), t.pos = Math.min(t.pos, i - n)), t.pos = e(t.pos, 1e3), t.dim = e(t.dim, 1e3), Math.abs(t.pos) <= .1 && (t.pos = 0) 2100 })), s) return t; 2101 const l = []; 2102 let c; 2103 return t.forEach((t => { 2104 const e = Object.assign({}, t); 2105 c && e.pos === c.pos ? (c.dim += e.dim, c.slides = [...c.slides, ...e.slides]) : (e.index = l.length, c = e, l.push(e)) 2106 })), l 2107 } 2108 getPageFromIndex(t = 0) { 2109 const e = this.pages.length; 2110 let i;
vendor: 9,961 bytes, lines 2111-2310
2111 return t = parseInt((t || 0).toString()) || 0, i = this.isInfinite ? (t % e + e) % e : Math.max(Math.min(t, e - 1), 0), i 2112 } 2113 getSlideMetrics(t) { 2114 var i, n; 2115 const s = this.isHorizontal ? "width" : "height"; 2116 let o = 0, 2117 a = 0, 2118 r = t.el; 2119 const l = !(!r || r.parentNode); 2120 if (r ? o = parseFloat(r.dataset[s] || "") || 0 : (r = document.createElement("div"), r.style.visibility = "hidden", (this.track || document.body).prepend(r)), C(r, this.cn(Q) + " " + t.class + " " + t.customClass), o) r.style[s] = `${o}px`, r.style["width" === s ? "height" : "width"] = ""; 2121 else { 2122 l && (this.track || document.body).prepend(r), o = r.getBoundingClientRect()[s] * Math.max(1, (null === (i = window.visualViewport) || void 0 === i ? void 0 : i.scale) || 1); 2123 let t = r[this.isHorizontal ? "offsetWidth" : "offsetHeight"]; 2124 t - 1 > o && (o = t) 2125 } 2126 const c = getComputedStyle(r); 2127 return "content-box" === c.boxSizing && (this.isHorizontal ? (o += parseFloat(c.paddingLeft) || 0, o += parseFloat(c.paddingRight) || 0) : (o += parseFloat(c.paddingTop) || 0, o += parseFloat(c.paddingBottom) || 0)), a = parseFloat(c[this.isHorizontal ? "marginRight" : "marginBottom"]) || 0, l ? null === (n = r.parentElement) || void 0 === n || n.removeChild(r) : t.el || r.remove(), { 2128 dim: e(o, 1e3), 2129 gap: e(a, 1e3) 2130 } 2131 } 2132 getBounds() { 2133 const { 2134 isInfinite: t, 2135 isRTL: e, 2136 isHorizontal: i, 2137 pages: n 2138 } = this; 2139 let s = { 2140 min: 0, 2141 max: 0 2142 }; 2143 if (t) s = { 2144 min: -1 / 0, 2145 max: 1 / 0 2146 }; 2147 else if (n.length) { 2148 const t = n[0].pos, 2149 o = n[n.length - 1].pos; 2150 s = e && i ? { 2151 min: t, 2152 max: o 2153 } : { 2154 min: -1 * o, 2155 max: -1 * t 2156 } 2157 } 2158 return { 2159 x: i ? s : { 2160 min: 0, 2161 max: 0 2162 }, 2163 y: i ? { 2164 min: 0, 2165 max: 0 2166 } : s 2167 } 2168 } 2169 repositionSlides() { 2170 let t, { 2171 isHorizontal: i, 2172 isRTL: n, 2173 isInfinite: s, 2174 viewport: o, 2175 viewportDim: a, 2176 contentDim: r, 2177 page: l, 2178 pages: c, 2179 slides: h, 2180 panzoom: d 2181 } = this, 2182 u = 0, 2183 p = 0, 2184 f = 0, 2185 g = 0; 2186 d ? g = -1 * d.current[this.axis] : c[l] && (g = c[l].pos || 0), t = i ? n ? "right" : "left" : "top", n && i && (g *= -1); 2187 for (const i of h) { 2188 const n = i.el; 2189 n ? ("top" === t ? (n.style.right = "", n.style.left = "") : n.style.top = "", i.index !== u ? n.style[t] = 0 === p ? "" : `${e(p,1e3)}px` : n.style[t] = "", f += i.dim + i.gap, u++) : p += i.dim + i.gap 2190 } 2191 if (s && f && o) { 2192 let n = getComputedStyle(o), 2193 s = "padding", 2194 l = i ? "Right" : "Bottom", 2195 c = parseFloat(n[s + (i ? "Left" : "Top")]); 2196 g -= c, a += c, a += parseFloat(n[s + l]); 2197 for (const i of h) i.el && (e(i.pos) < e(a) && e(i.pos + i.dim + i.gap) < e(g) && e(g) > e(r - a) && (i.el.style[t] = `${e(p+f,1e3)}px`), e(i.pos + i.gap) >= e(r - a) && e(i.pos) > e(g + a) && e(g) < e(a) && (i.el.style[t] = `-${e(f,1e3)}px`)) 2198 } 2199 let m, v, b = [...this.inTransition]; 2200 if (b.length > 1 && (m = c[b[0]], v = c[b[1]]), m && v) { 2201 let i = 0; 2202 for (const n of h) n.el ? this.inTransition.has(n.index) && m.slides.indexOf(n) < 0 && (n.el.style[t] = `${e(i+(m.pos-v.pos),1e3)}px`) : i += n.dim + n.gap 2203 } 2204 } 2205 createSlideEl(t) { 2206 const { 2207 track: e, 2208 slides: i 2209 } = this; 2210 if (!e || !t) return; 2211 if (t.el && t.el.parentNode) return; 2212 const n = t.el || document.createElement("div"); 2213 C(n, this.cn(Q)), C(n, t.class), C(n, t.customClass); 2214 const s = t.html; 2215 s && (s instanceof HTMLElement ? n.appendChild(s) : n.innerHTML = t.html + ""); 2216 const o = []; 2217 i.forEach(((t, e) => { 2218 t.el && o.push(e) 2219 })); 2220 const a = t.index; 2221 let r = null; 2222 if (o.length) { 2223 r = i[o.reduce(((t, e) => Math.abs(e - a) < Math.abs(t - a) ? e : t))] 2224 } 2225 const l = r && r.el && r.el.parentNode ? r.index < t.index ? r.el.nextSibling : r.el : null; 2226 e.insertBefore(n, e.contains(l) ? l : null), t.el = n, this.emit("createSlide", t) 2227 } 2228 removeSlideEl(t, e = !1) { 2229 const i = null == t ? void 0 : t.el; 2230 if (!i || !i.parentNode) return; 2231 const n = this.cn(J); 2232 if (i.classList.contains(n) && (P(i, n), this.emit("unselectSlide", t)), t.isDom && !e) return i.removeAttribute("aria-hidden"), i.removeAttribute("data-index"), void(i.style.left = ""); 2233 this.emit("removeSlide", t); 2234 const s = new CustomEvent(K); 2235 i.dispatchEvent(s), t.el && (t.el.remove(), t.el = null) 2236 } 2237 transitionTo(t = 0, e = this.option("transition")) { 2238 var i, n, s, o; 2239 if (!e) return !1; 2240 const a = this.page, 2241 { 2242 pages: r, 2243 panzoom: l 2244 } = this; 2245 t = parseInt((t || 0).toString()) || 0; 2246 const c = this.getPageFromIndex(t); 2247 if (!l || !r[c] || r.length < 2 || Math.abs(((null === (n = null === (i = r[a]) || void 0 === i ? void 0 : i.slides[0]) || void 0 === n ? void 0 : n.dim) || 0) - this.viewportDim) > 1) return !1; 2248 let h = t > a ? 1 : -1; 2249 this.isInfinite && (0 === a && t === r.length - 1 && (h = -1), a === r.length - 1 && 0 === t && (h = 1)); 2250 const d = r[c].pos * (this.isRTL ? 1 : -1); 2251 if (a === c && Math.abs(d - l.target[this.axis]) < 1) return !1; 2252 this.clearTransitions(); 2253 const u = l.isResting; 2254 C(this.container, this.cn("inTransition")); 2255 const p = (null === (s = r[a]) || void 0 === s ? void 0 : s.slides[0]) || null, 2256 f = (null === (o = r[c]) || void 0 === o ? void 0 : o.slides[0]) || null; 2257 this.inTransition.add(f.index), this.createSlideEl(f); 2258 let g = p.el, 2259 m = f.el; 2260 u || e === Q || (e = "fadeFast", g = null); 2261 const v = this.isRTL ? "next" : "prev", 2262 b = this.isRTL ? "prev" : "next"; 2263 return g && (this.inTransition.add(p.index), p.transition = e, g.addEventListener(K, this.onAnimationEnd), g.classList.add(`f-${e}Out`, `to-${h>0?b:v}`)), m && (f.transition = e, m.addEventListener(K, this.onAnimationEnd), m.classList.add(`f-${e}In`, `from-${h>0?v:b}`)), l.current[this.axis] = d, l.target[this.axis] = d, l.requestTick(), this.onChange(c), !0 2264 } 2265 manageSlideVisiblity() { 2266 const t = new Set, 2267 e = new Set, 2268 i = this.getVisibleSlides(parseFloat(this.option("preload", 0) + "") || 0); 2269 for (const n of this.slides) i.has(n) ? t.add(n) : e.add(n); 2270 for (const e of this.inTransition) t.add(this.slides[e]); 2271 for (const e of t) this.createSlideEl(e), this.lazyLoadSlide(e); 2272 for (const i of e) t.has(i) || this.removeSlideEl(i); 2273 this.markSelectedSlides(), this.repositionSlides() 2274 } 2275 markSelectedSlides() { 2276 if (!this.pages[this.page] || !this.pages[this.page].slides) return; 2277 const t = "aria-hidden"; 2278 let e = this.cn(J); 2279 if (e) 2280 for (const i of this.slides) { 2281 const n = i.el; 2282 n && (n.dataset.index = `${i.index}`, n.classList.contains("f-thumbs__slide") ? this.getVisibleSlides(0).has(i) ? n.removeAttribute(t) : n.setAttribute(t, "true") : this.pages[this.page].slides.includes(i) ? (n.classList.contains(e) || (C(n, e), this.emit("selectSlide", i)), n.removeAttribute(t)) : (n.classList.contains(e) && (P(n, e), this.emit("unselectSlide", i)), n.setAttribute(t, "true"))) 2283 } 2284 } 2285 flipInfiniteTrack() { 2286 const { 2287 axis: t, 2288 isHorizontal: e, 2289 isInfinite: i, 2290 isRTL: n, 2291 viewportDim: s, 2292 contentDim: o 2293 } = this, a = this.panzoom; 2294 if (!a || !i) return; 2295 let r = a.current[t], 2296 l = a.target[t] - r, 2297 c = 0, 2298 h = .5 * s; 2299 n && e ? (r < -h && (c = -1, r += o), r > o - h && (c = 1, r -= o)) : (r > h && (c = 1, r -= o), r < -o + h && (c = -1, r += o)), c && (a.current[t] = r, a.target[t] = r + l) 2300 } 2301 lazyLoadImg(t, e) { 2302 const i = this, 2303 n = "f-fadeIn", 2304 o = "is-preloading"; 2305 let a = !1, 2306 r = null; 2307 const l = () => { 2308 a || (a = !0, r && (r.remove(), r = null), P(e, o), e.complete && (C(e, n), setTimeout((() => { 2309 P(e, n) 2310 }), 350)), this.option("adaptiveHeight") && t.el && this.pages[this.page].slides.indexOf(t) >
vendor: 4,230 bytes, lines 2310-2396
2310 -1 && (i.updateMetrics(), i.setViewportHeight()), this.emit("load", t)) 2311 }; 2312 C(e, o), e.src = e.dataset.lazySrcset || e.dataset.lazySrc || "", delete e.dataset.lazySrc, delete e.dataset.lazySrcset, e.addEventListener("error", (() => { 2313 l() 2314 })), e.addEventListener("load", (() => { 2315 l() 2316 })), setTimeout((() => { 2317 const i = e.parentNode; 2318 i && t.el && (e.complete ? l() : a || (r = s(E), i.insertBefore(r, e))) 2319 }), 300) 2320 } 2321 lazyLoadSlide(t) { 2322 const e = t && t.el; 2323 if (!e) return; 2324 const i = new Set; 2325 let n = Array.from(e.querySelectorAll("[data-lazy-src],[data-lazy-srcset]")); 2326 e.dataset.lazySrc && n.push(e), n.map((t => { 2327 t instanceof HTMLImageElement ? i.add(t) : t instanceof HTMLElement && t.dataset.lazySrc && (t.style.backgroundImage = `url('${t.dataset.lazySrc}')`, delete t.dataset.lazySrc) 2328 })); 2329 for (const e of i) this.lazyLoadImg(t, e) 2330 } 2331 onAnimationEnd(t) { 2332 var e; 2333 const i = t.target, 2334 n = i ? parseInt(i.dataset.index || "", 10) || 0 : -1, 2335 s = this.slides[n], 2336 o = t.animationName; 2337 if (!i || !s || !o) return; 2338 const a = !!this.inTransition.has(n) && s.transition; 2339 a && o.substring(0, a.length + 2) === `f-${a}` && this.inTransition.delete(n), this.inTransition.size || this.clearTransitions(), n === this.page && (null === (e = this.panzoom) || void 0 === e ? void 0 : e.isResting) && this.emit("settle") 2340 } 2341 onDecel(t, e = 0, i = 0, n = 0, s = 0) { 2342 if (this.option("dragFree")) return void this.setPageFromPosition(); 2343 const { 2344 isRTL: o, 2345 isHorizontal: a, 2346 axis: r, 2347 pages: l 2348 } = this, c = l.length, h = Math.abs(Math.atan2(i, e) / (Math.PI / 180)); 2349 let d = 0; 2350 if (d = h > 45 && h < 135 ? a ? 0 : i : a ? e : 0, !c) return; 2351 let u = this.page, 2352 p = o && a ? 1 : -1; 2353 const f = t.current[r] * p; 2354 let { 2355 pageIndex: g 2356 } = this.getPageFromPosition(f); 2357 Math.abs(d) > 5 ? (l[u].dim < document.documentElement["client" + (this.isHorizontal ? "Width" : "Height")] - 1 && (u = g), u = o && a ? d < 0 ? u - 1 : u + 1 : d < 0 ? u + 1 : u - 1) : u = 0 === n && 0 === s ? u : g, this.slideTo(u, { 2358 transition: !1, 2359 friction: t.option("decelFriction") 2360 }) 2361 } 2362 onClick(t) { 2363 const e = t.target, 2364 i = e && S(e) ? e.dataset : null; 2365 let n, s; 2366 i && (void 0 !== i.carouselPage ? (s = "slideTo", n = i.carouselPage) : void 0 !== i.carouselNext ? s = "slideNext" : void 0 !== i.carouselPrev && (s = "slidePrev")), s ? (t.preventDefault(), t.stopPropagation(), e && !e.hasAttribute("disabled") && this[s](n)) : this.emit("click", t) 2367 } 2368 onSlideTo(t) { 2369 const e = t.detail || 0; 2370 this.slideTo(this.getPageForSlide(e), { 2371 friction: 0 2372 }) 2373 } 2374 onChange(t, e = 0) { 2375 const i = this.page; 2376 this.prevPage = i, this.page = t, this.option("adaptiveHeight") && this.setViewportHeight(), t !== i && (this.markSelectedSlides(), this.emit("change", t, i, e)) 2377 } 2378 onRefresh() { 2379 let t = this.contentDim, 2380 e = this.viewportDim; 2381 this.updateMetrics(), this.contentDim === t && this.viewportDim === e || this.slideTo(this.page, { 2382 friction: 0, 2383 transition: !1 2384 }) 2385 } 2386 onScroll() { 2387 var t; 2388 null === (t = this.viewport) || void 0 === t || t.scroll(0, 0) 2389 } 2390 onResize() { 2391 this.option("breakpoints") && this.processOptions() 2392 } 2393 onBeforeTransform(t) { 2394 this.lp !== t.current[this.axis] && (this.flipInfiniteTrack(), this.manageSlideVisiblity()), this.lp = t.current.e 2395 } 2396 onEndAnimation() {
vendor: 1,069 bytes, lines 2397-2423
2397 this.inTransition.size || this.emit("settle") 2398 } 2399 reInit(t = null, e = null) { 2400 this.destroy(), this.state = H.Init, this.prevPage = null, this.userOptions = t || this.userOptions, this.userPlugins = e || this.userPlugins, this.processOptions() 2401 } 2402 slideTo(t = 0, { 2403 friction: e = this.option("friction"), 2404 transition: i = this.option("transition") 2405 } = {}) { 2406 if (this.state === H.Destroy) return; 2407 t = parseInt((t || 0).toString()) || 0; 2408 const n = this.getPageFromIndex(t), 2409 { 2410 axis: s, 2411 isHorizontal: o, 2412 isRTL: a, 2413 pages: r, 2414 panzoom: l 2415 } = this, 2416 c = r.length, 2417 h = a && o ? 1 : -1; 2418 if (!l || !c) return; 2419 if (this.page !== n) { 2420 const e = new Event("beforeChange", { 2421 bubbles: !0, 2422 cancelable: !0 2423 });
vendor: 9,698 bytes, lines 2424-2649
2424 if (this.emit("beforeChange", e, t), e.defaultPrevented) return 2425 } 2426 if (this.transitionTo(t, i)) return; 2427 let d = r[n].pos; 2428 if (this.isInfinite) { 2429 const e = this.contentDim, 2430 i = l.target[s] * h; 2431 if (2 === c) d += e * Math.floor(parseFloat(t + "") / 2); 2432 else { 2433 d = [d, d - e, d + e].reduce((function(t, e) { 2434 return Math.abs(e - i) < Math.abs(t - i) ? e : t 2435 })) 2436 } 2437 } 2438 d *= h, Math.abs(l.target[s] - d) < 1 || (l.panTo({ 2439 x: o ? d : 0, 2440 y: o ? 0 : d, 2441 friction: e 2442 }), this.onChange(n)) 2443 } 2444 slideToClosest(t) { 2445 if (this.panzoom) { 2446 const { 2447 pageIndex: e 2448 } = this.getPageFromPosition(); 2449 this.slideTo(e, t) 2450 } 2451 } 2452 slideNext() { 2453 this.slideTo(this.page + 1) 2454 } 2455 slidePrev() { 2456 this.slideTo(this.page - 1) 2457 } 2458 clearTransitions() { 2459 this.inTransition.clear(), P(this.container, this.cn("inTransition")); 2460 const t = ["to-prev", "to-next", "from-prev", "from-next"]; 2461 for (const e of this.slides) { 2462 const i = e.el; 2463 if (i) { 2464 i.removeEventListener(K, this.onAnimationEnd), i.classList.remove(...t); 2465 const n = e.transition; 2466 n && i.classList.remove(`f-${n}Out`, `f-${n}In`) 2467 } 2468 } 2469 this.manageSlideVisiblity() 2470 } 2471 addSlide(t, e) { 2472 var i, n, s, o; 2473 const a = this.panzoom, 2474 r = (null === (i = this.pages[this.page]) || void 0 === i ? void 0 : i.pos) || 0, 2475 l = (null === (n = this.pages[this.page]) || void 0 === n ? void 0 : n.dim) || 0, 2476 c = this.contentDim < this.viewportDim; 2477 let h = Array.isArray(e) ? e : [e]; 2478 const d = []; 2479 for (const t of h) d.push(N(t)); 2480 this.slides.splice(t, 0, ...d); 2481 for (let t = 0; t < this.slides.length; t++) this.slides[t].index = t; 2482 for (const t of d) this.emit("beforeInitSlide", t, t.index); 2483 if (this.page >= t && (this.page += d.length), this.updateMetrics(), a) { 2484 const e = (null === (s = this.pages[this.page]) || void 0 === s ? void 0 : s.pos) || 0, 2485 i = (null === (o = this.pages[this.page]) || void 0 === o ? void 0 : o.dim) || 0, 2486 n = this.pages.length || 1, 2487 h = this.isRTL ? l - i : i - l, 2488 d = this.isRTL ? r - e : e - r; 2489 c && 1 === n ? (t <= this.page && (a.current[this.axis] -= h, a.target[this.axis] -= h), a.panTo({ 2490 [this.isHorizontal ? "x" : "y"]: -1 * e 2491 })) : d && t <= this.page && (a.target[this.axis] -= d, a.current[this.axis] -= d, a.requestTick()) 2492 } 2493 for (const t of d) this.emit("initSlide", t, t.index) 2494 } 2495 prependSlide(t) { 2496 this.addSlide(0, t) 2497 } 2498 appendSlide(t) { 2499 this.addSlide(this.slides.length, t) 2500 } 2501 removeSlide(t) { 2502 const e = this.slides.length; 2503 t = (t % e + e) % e; 2504 const i = this.slides[t]; 2505 if (i) { 2506 this.removeSlideEl(i, !0), this.slides.splice(t, 1); 2507 for (let t = 0; t < this.slides.length; t++) this.slides[t].index = t; 2508 this.updateMetrics(), this.slideTo(this.page, { 2509 friction: 0, 2510 transition: !1 2511 }), this.emit("destroySlide", i) 2512 } 2513 } 2514 updateMetrics() { 2515 const { 2516 panzoom: t, 2517 viewport: i, 2518 track: n, 2519 slides: s, 2520 isHorizontal: o, 2521 isInfinite: a 2522 } = this; 2523 if (!n) return; 2524 const r = o ? "width" : "height", 2525 l = o ? "offsetWidth" : "offsetHeight"; 2526 if (i) { 2527 let t = Math.max(i[l], e(i.getBoundingClientRect()[r], 1e3)), 2528 n = getComputedStyle(i), 2529 s = "padding", 2530 a = o ? "Right" : "Bottom"; 2531 t -= parseFloat(n[s + (o ? "Left" : "Top")]) + parseFloat(n[s + a]), this.viewportDim = t 2532 } 2533 let c, h = 0; 2534 for (const [t, i] of s.entries()) { 2535 let n = 0, 2536 o = 0; 2537 !i.el && c ? (n = c.dim, o = c.gap) : (({ 2538 dim: n, 2539 gap: o 2540 } = this.getSlideMetrics(i)), c = i), n = e(n, 1e3), o = e(o, 1e3), i.dim = n, i.gap = o, i.pos = h, h += n, (a || t < s.length - 1) && (h += o) 2541 } 2542 h = e(h, 1e3), this.contentDim = h, t && (t.contentRect[r] = h, t.contentRect[o ? "fullWidth" : "fullHeight"] = h), this.pages = this.createPages(), this.pages = this.processPages(), this.state === H.Init && this.setInitialPage(), this.page = Math.max(0, Math.min(this.page, this.pages.length - 1)), this.manageSlideVisiblity(), this.emit("refresh") 2543 } 2544 getProgress(t, i = !1, n = !1) { 2545 void 0 === t && (t = this.page); 2546 const s = this, 2547 o = s.panzoom, 2548 a = s.contentDim, 2549 r = s.pages[t] || 0; 2550 if (!r || !o) return t > this.page ? -1 : 1; 2551 let l = -1 * o.current.e, 2552 c = e((l - r.pos) / (1 * r.dim), 1e3), 2553 h = c, 2554 d = c; 2555 this.isInfinite && !0 !== n && (h = e((l - r.pos + a) / (1 * r.dim), 1e3), d = e((l - r.pos - a) / (1 * r.dim), 1e3)); 2556 let u = [c, h, d].reduce((function(t, e) { 2557 return Math.abs(e) < Math.abs(t) ? e : t 2558 })); 2559 return i ? u : u > 1 ? 1 : u < -1 ? -1 : u 2560 } 2561 setViewportHeight() { 2562 const { 2563 page: t, 2564 pages: e, 2565 viewport: i, 2566 isHorizontal: n 2567 } = this; 2568 if (!i || !e[t]) return; 2569 let s = 0; 2570 n && this.track && (this.track.style.height = "auto", e[t].slides.forEach((t => { 2571 t.el && (s = Math.max(s, t.el.offsetHeight)) 2572 }))), i.style.height = s ? `${s}px` : "" 2573 } 2574 getPageForSlide(t) { 2575 for (const e of this.pages) 2576 for (const i of e.slides) 2577 if (i.index === t) return e.index; 2578 return -1 2579 } 2580 getVisibleSlides(t = 0) { 2581 var e; 2582 const i = new Set; 2583 let { 2584 panzoom: n, 2585 contentDim: s, 2586 viewportDim: o, 2587 pages: a, 2588 page: r 2589 } = this; 2590 if (o) { 2591 s = s + (null === (e = this.slides[this.slides.length - 1]) || void 0 === e ? void 0 : e.gap) || 0; 2592 let l = 0; 2593 l = n && n.state !== v.Init && n.state !== v.Destroy ? -1 * n.current[this.axis] : a[r] && a[r].pos || 0, this.isInfinite && (l -= Math.floor(l / s) * s), this.isRTL && this.isHorizontal && (l *= -1); 2594 const c = l - o * t, 2595 h = l + o * (t + 1), 2596 d = this.isInfinite ? [-1, 0, 1] : [0]; 2597 for (const t of this.slides) 2598 for (const e of d) { 2599 const n = t.pos + e * s, 2600 o = n + t.dim + t.gap; 2601 n < h && o > c && i.add(t) 2602 } 2603 } 2604 return i 2605 } 2606 getPageFromPosition(t) { 2607 const { 2608 viewportDim: e, 2609 contentDim: i, 2610 slides: n, 2611 pages: s, 2612 panzoom: o 2613 } = this, a = s.length, r = n.length, l = n[0], c = n[r - 1], h = this.option("center"); 2614 let d = 0, 2615 u = 0, 2616 p = 0, 2617 f = void 0 === t ? -1 * ((null == o ? void 0 : o.target[this.axis]) || 0) : t; 2618 h && (f += .5 * e), this.isInfinite ? (f < l.pos - .5 * c.gap && (f -= i, p = -1), f > c.pos + c.dim + .5 * c.gap && (f -= i, p = 1)) : f = Math.max(l.pos || 0, Math.min(f, c.pos)); 2619 let g = c, 2620 m = n.find((t => { 2621 const e = t.pos - .5 * g.gap, 2622 i = t.pos + t.dim + .5 * t.gap; 2623 return g = t, f >= e && f < i 2624 })); 2625 return m || (m = c), u = this.getPageForSlide(m.index), d = u + p * a, { 2626 page: d, 2627 pageIndex: u 2628 } 2629 } 2630 setPageFromPosition() { 2631 const { 2632 pageIndex: t 2633 } = this.getPageFromPosition(); 2634 this.onChange(t) 2635 } 2636 destroy() { 2637 if ([H.Destroy].includes(this.state)) return; 2638 this.state = H.Destroy; 2639 const { 2640 container: t, 2641 viewport: e, 2642 track: i, 2643 slides: n, 2644 panzoom: s 2645 } = this, o = this.option("classes"); 2646 t.removeEventListener("click", this.onClick, { 2647 passive: !1, 2648 capture: !1 2649 }), t.removeEventListener("slideTo", this.onSlideTo), window.removeEventListener("resize", this.onResize), s && (s.destroy(), this.panzoom = null), n && n.forEac
vendor: 6,187 bytes, lines 2649-2796
2649h((t => { 2650 this.removeSlideEl(t) 2651 })), this.detachPlugins(), e && (e.removeEventListener("scroll", this.onScroll), e.offsetParent && i && i.offsetParent && e.replaceWith(...i.childNodes)); 2652 for (const [e, i] of Object.entries(o)) "container" !== e && i && t.classList.remove(i); 2653 this.track = null, this.viewport = null, this.page = 0, this.slides = []; 2654 const a = this.events.get("ready"); 2655 this.events = new Map, a && this.events.set("ready", a) 2656 } 2657 } 2658 Object.defineProperty(tt, "Panzoom", { 2659 enumerable: !0, 2660 configurable: !0, 2661 writable: !0, 2662 value: D 2663 }), Object.defineProperty(tt, "defaults", { 2664 enumerable: !0, 2665 configurable: !0, 2666 writable: !0, 2667 value: B 2668 }), Object.defineProperty(tt, "Plugins", { 2669 enumerable: !0, 2670 configurable: !0, 2671 writable: !0, 2672 value: G 2673 }); 2674 const et = function(t) { 2675 if (!S(t)) return 0; 2676 const e = window.scrollY, 2677 i = window.innerHeight, 2678 n = e + i, 2679 s = t.getBoundingClientRect(), 2680 o = s.y + e, 2681 a = s.height, 2682 r = o + a; 2683 if (e > r || n < o) return 0; 2684 if (e < o && n > r) return 100; 2685 if (o < e && r > n) return 100; 2686 let l = a; 2687 o < e && (l -= e - o), r > n && (l -= r - n); 2688 const c = l / i * 100; 2689 return Math.round(c) 2690 }, 2691 it = !("undefined" == typeof window || !window.document || !window.document.createElement); 2692 let nt; 2693 const st = ["a[href]", "area[href]", 'input:not([disabled]):not([type="hidden"]):not([aria-hidden])', "select:not([disabled]):not([aria-hidden])", "textarea:not([disabled]):not([aria-hidden])", "button:not([disabled]):not([aria-hidden]):not(.fancybox-focus-guard)", "iframe", "object", "embed", "video", "audio", "[contenteditable]", '[tabindex]:not([tabindex^="-"]):not([disabled]):not([aria-hidden])'].join(","), 2694 ot = t => { 2695 if (t && it) { 2696 void 0 === nt && document.createElement("div").focus({ 2697 get preventScroll() { 2698 return nt = !0, !1 2699 } 2700 }); 2701 try { 2702 if (nt) t.focus({ 2703 preventScroll: !0 2704 }); 2705 else { 2706 const e = window.scrollY || document.body.scrollTop, 2707 i = window.scrollX || document.body.scrollLeft; 2708 t.focus(), document.body.scrollTo({ 2709 top: e, 2710 left: i, 2711 behavior: "auto" 2712 }) 2713 } 2714 } catch (t) {} 2715 } 2716 }, 2717 at = () => { 2718 const t = document; 2719 let e, i = "", 2720 n = "", 2721 s = ""; 2722 return t.fullscreenEnabled ? (i = "requestFullscreen", n = "exitFullscreen", s = "fullscreenElement") : t.webkitFullscreenEnabled && (i = "webkitRequestFullscreen", n = "webkitExitFullscreen", s = "webkitFullscreenElement"), i && (e = { 2723 request: function(e = t.documentElement) { 2724 return "webkitRequestFullscreen" === i ? e[i](Element.ALLOW_KEYBOARD_INPUT) : e[i]() 2725 }, 2726 exit: function() { 2727 return t[s] && t[n]() 2728 }, 2729 isFullscreen: function() { 2730 return t[s] 2731 } 2732 }), e 2733 }, 2734 rt = { 2735 animated: !0, 2736 autoFocus: !0, 2737 backdropClick: "close", 2738 Carousel: { 2739 classes: { 2740 container: "fancybox__carousel", 2741 viewport: "fancybox__viewport", 2742 track: "fancybox__track", 2743 slide: "fancybox__slide" 2744 } 2745 }, 2746 closeButton: "auto", 2747 closeExisting: !1, 2748 commonCaption: !1, 2749 compact: () => window.matchMedia("(max-width: 578px), (max-height: 578px)").matches, 2750 contentClick: "toggleZoom", 2751 contentDblClick: !1, 2752 defaultType: "image", 2753 defaultDisplay: "flex", 2754 dragToClose: !0, 2755 Fullscreen: { 2756 autoStart: !1 2757 }, 2758 groupAll: !1, 2759 groupAttr: "data-fancybox", 2760 hideClass: "f-fadeOut", 2761 hideScrollbar: !0, 2762 idle: 3500, 2763 keyboard: { 2764 Escape: "close", 2765 Delete: "close", 2766 Backspace: "close", 2767 PageUp: "next", 2768 PageDown: "prev", 2769 ArrowUp: "prev", 2770 ArrowDown: "next", 2771 ArrowRight: "next", 2772 ArrowLeft: "prev" 2773 }, 2774 l10n: Object.assign(Object.assign({}, y), { 2775 CLOSE: "Close", 2776 NEXT: "Next", 2777 PREV: "Previous", 2778 MODAL: "You can close this modal content with the ESC key", 2779 ERROR: "Something Went Wrong, Please Try Again Later", 2780 IMAGE_ERROR: "Image Not Found", 2781 ELEMENT_NOT_FOUND: "HTML Element Not Found", 2782 AJAX_NOT_FOUND: "Error Loading AJAX : Not Found", 2783 AJAX_FORBIDDEN: "Error Loading AJAX : Forbidden", 2784 IFRAME_ERROR: "Error Loading Page", 2785 TOGGLE_ZOOM: "Toggle zoom level", 2786 TOGGLE_THUMBS: "Toggle thumbnails", 2787 TOGGLE_SLIDESHOW: "Toggle slideshow", 2788 TOGGLE_FULLSCREEN: "Toggle full-screen mode", 2789 DOWNLOAD: "Download" 2790 }), 2791 parentEl: null, 2792 placeFocusBack: !0, 2793 showClass: "f-zoomInUp", 2794 startIndex: 0, 2795 tpl: { 2796 closeButton: '<button data-fancybox-close class="f-button is-close-btn" title="{{CLOSE}}"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" tabindex="-1">
vendor: 13,973 bytes, lines 2796-3111
2796<path d="M20 20L4 4m16 0L4 20"/></svg></button>', 2797 main: '<div class="fancybox__container" role="dialog" aria-modal="true" aria-label="{{MODAL}}" tabindex="-1">\n <div class="fancybox__backdrop"></div>\n <div class="fancybox__carousel"></div>\n <div class="fancybox__footer"></div>\n </div>' 2798 }, 2799 trapFocus: !0, 2800 wheel: "zoom" 2801 }; 2802 var lt, ct; 2803 ! function(t) { 2804 t[t.Init = 0] = "Init", t[t.Ready = 1] = "Ready", t[t.Closing = 2] = "Closing", t[t.CustomClosing = 3] = "CustomClosing", t[t.Destroy = 4] = "Destroy" 2805 }(lt || (lt = {})), 2806 function(t) { 2807 t[t.Loading = 0] = "Loading", t[t.Opening = 1] = "Opening", t[t.Ready = 2] = "Ready", t[t.Closing = 3] = "Closing" 2808 }(ct || (ct = {})); 2809 let ht = "", 2810 dt = !1, 2811 ut = !1, 2812 pt = null; 2813 const ft = () => { 2814 let t = "", 2815 e = ""; 2816 const i = Ae.getInstance(); 2817 if (i) { 2818 const n = i.carousel, 2819 s = i.getSlide(); 2820 if (n && s) { 2821 let o = s.slug || void 0, 2822 a = s.triggerEl || void 0; 2823 e = o || (i.option("slug") || ""), !e && a && a.dataset && (e = a.dataset.fancybox || ""), e && "true" !== e && (t = "#" + e + (!o && n.slides.length > 1 ? "-" + (s.index + 1) : "")) 2824 } 2825 } 2826 return { 2827 hash: t, 2828 slug: e, 2829 index: 1 2830 } 2831 }, 2832 gt = () => { 2833 const t = new URL(document.URL).hash, 2834 e = t.slice(1).split("-"), 2835 i = e[e.length - 1], 2836 n = i && /^\+?\d+$/.test(i) && parseInt(e.pop() || "1", 10) || 1; 2837 return { 2838 hash: t, 2839 slug: e.join("-"), 2840 index: n 2841 } 2842 }, 2843 mt = () => { 2844 const { 2845 slug: t, 2846 index: e 2847 } = gt(); 2848 if (!t) return; 2849 let i = document.querySelector(`[data-slug="${t}"]`); 2850 if (i && i.dispatchEvent(new CustomEvent("click", { 2851 bubbles: !0, 2852 cancelable: !0 2853 })), Ae.getInstance()) return; 2854 const n = document.querySelectorAll(`[data-fancybox="${t}"]`); 2855 n.length && (i = n[e - 1], i && i.dispatchEvent(new CustomEvent("click", { 2856 bubbles: !0, 2857 cancelable: !0 2858 }))) 2859 }, 2860 vt = () => { 2861 if (!1 === Ae.defaults.Hash) return; 2862 const t = Ae.getInstance(); 2863 if (!1 === (null == t ? void 0 : t.options.Hash)) return; 2864 const { 2865 slug: e, 2866 index: i 2867 } = gt(), { 2868 slug: n 2869 } = ft(); 2870 t && (e === n ? t.jumpTo(i - 1) : (dt = !0, t.close())), mt() 2871 }, 2872 bt = () => { 2873 pt && clearTimeout(pt), queueMicrotask((() => { 2874 vt() 2875 })) 2876 }, 2877 yt = () => { 2878 window.addEventListener("hashchange", bt, !1), setTimeout((() => { 2879 vt() 2880 }), 500) 2881 }; 2882 it && (/complete|interactive|loaded/.test(document.readyState) ? yt() : document.addEventListener("DOMContentLoaded", yt)); 2883 const wt = "is-zooming-in"; 2884 class xt extends $ { 2885 onCreateSlide(t, e, i) { 2886 const n = this.instance.optionFor(i, "src") || ""; 2887 i.el && "image" === i.type && "string" == typeof n && this.setImage(i, n) 2888 } 2889 onRemoveSlide(t, e, i) { 2890 i.panzoom && i.panzoom.destroy(), i.panzoom = void 0, i.imageEl = void 0 2891 } 2892 onChange(t, e, i, n) { 2893 P(this.instance.container, wt); 2894 for (const t of e.slides) { 2895 const e = t.panzoom; 2896 e && t.index !== i && e.reset(.35) 2897 } 2898 } 2899 onClose() { 2900 var t; 2901 const e = this.instance, 2902 i = e.container, 2903 n = e.getSlide(); 2904 if (!i || !i.parentElement || !n) return; 2905 const { 2906 el: s, 2907 contentEl: o, 2908 panzoom: a, 2909 thumbElSrc: r 2910 } = n; 2911 if (!s || !r || !o || !a || a.isContentLoading || a.state === v.Init || a.state === v.Destroy) return; 2912 a.updateMetrics(); 2913 let l = this.getZoomInfo(n); 2914 if (!l) return; 2915 this.instance.state = lt.CustomClosing, i.classList.remove(wt), i.classList.add("is-zooming-out"), o.style.backgroundImage = `url('${r}')`; 2916 const c = i.getBoundingClientRect(); 2917 1 === ((null === (t = window.visualViewport) || void 0 === t ? void 0 : t.scale) || 1) && Object.assign(i.style, { 2918 position: "absolute", 2919 top: `${i.offsetTop+window.scrollY}px`, 2920 left: `${i.offsetLeft+window.scrollX}px`, 2921 bottom: "auto", 2922 right: "auto", 2923 width: `${c.width}px`, 2924 height: `${c.height}px`, 2925 overflow: "hidden" 2926 }); 2927 const { 2928 x: h, 2929 y: d, 2930 scale: u, 2931 opacity: p 2932 } = l; 2933 if (p) { 2934 const t = ((t, e, i, n) => { 2935 const s = e - t, 2936 o = n - i; 2937 return e => i + ((e - t) / s * o || 0) 2938 })(a.scale, u, 1, 0); 2939 a.on("afterTransform", (() => { 2940 o.style.opacity = t(a.scale) + "" 2941 })) 2942 } 2943 a.on("endAnimation", (() => { 2944 e.destroy() 2945 })), a.target.a = u, a.target.b = 0, a.target.c = 0, a.target.d = u, a.panTo({ 2946 x: h, 2947 y: d, 2948 scale: u, 2949 friction: p ? .2 : .33, 2950 ignoreBounds: !0 2951 }), a.isResting && e.destroy() 2952 } 2953 setImage(t, e) { 2954 const i = this.instance; 2955 t.src = e, this.process(t, e).then((e => { 2956 const { 2957 contentEl: n, 2958 imageEl: s, 2959 thumbElSrc: o, 2960 el: a 2961 } = t; 2962 if (i.isClosing() || !n || !s) return; 2963 n.offsetHeight; 2964 const r = !!i.isOpeningSlide(t) && this.getZoomInfo(t); 2965 if (this.option("protected") && a) { 2966 a.addEventListener("contextmenu", (t => { 2967 t.preventDefault() 2968 })); 2969 const t = document.createElement("div"); 2970 C(t, "fancybox-protected"), n.appendChild(t) 2971 } 2972 if (o && r) { 2973 const s = e.contentRect, 2974 a = Math.max(s.fullWidth, s.fullHeight); 2975 let c = null; 2976 !r.opacity && a > 1200 && (c = document.createElement("img"), C(c, "fancybox-ghost"), c.src = o, n.appendChild(c)); 2977 const h = () => { 2978 c && (C(c, "f-fadeFastOut"), setTimeout((() => { 2979 c && (c.remove(), c = null) 2980 }), 200)) 2981 }; 2982 (l = o, new Promise(((t, e) => { 2983 const i = new Image; 2984 i.onload = t, i.onerror = e, i.src = l 2985 }))).then((() => { 2986 i.hideLoading(t), t.state = ct.Opening, this.instance.emit("reveal", t), this.zoomIn(t).then((() => { 2987 h(), this.instance.done(t) 2988 }), (() => {})), c && setTimeout((() => { 2989 h() 2990 }), a > 2500 ? 800 : 200) 2991 }), (() => { 2992 i.hideLoading(t), i.revealContent(t) 2993 })) 2994 } else { 2995 const n = this.optionFor(t, "initialSize"), 2996 s = this.optionFor(t, "zoom"), 2997 o = { 2998 event: i.prevMouseMoveEvent || i.options.event, 2999 friction: s ? .12 : 0 3000 }; 3001 let a = i.optionFor(t, "showClass") || void 0, 3002 r = !0; 3003 i.isOpeningSlide(t) && ("full" === n ? e.zoomToFull(o) : "cover" === n ? e.zoomToCover(o) : "max" === n ? e.zoomToMax(o) : r = !1, e.stop("current")), r && a && (a = e.isDragging ? "f-fadeIn" : ""), i.hideLoading(t), i.revealContent(t, a) 3004 } 3005 var l 3006 }), (() => { 3007 i.setError(t, "{{IMAGE_ERROR}}") 3008 })) 3009 } 3010 process(t, e) { 3011 return new Promise(((i, n) => { 3012 var o; 3013 const a = this.instance, 3014 r = t.el; 3015 a.clearContent(t), a.showLoading(t); 3016 let l = this.optionFor(t, "content"); 3017 if ("string" == typeof l && (l = s(l)), !l || !S(l)) { 3018 if (l = document.createElement("img"), l instanceof HTMLImageElement) { 3019 let i = "", 3020 n = t.caption; 3021 i = "string" == typeof n && n ? n.replace(/<[^>]+>/gi, "").substring(0, 1e3) : `Image ${t.index+1} of ${(null===(o=a.carousel)||void 0===o?void 0:o.pages.length)||1}`, l.src = e || "", l.alt = i, l.draggable = !1, t.srcset && l.setAttribute("srcset", t.srcset), this.instance.isOpeningSlide(t) && (l.fetchPriority = "high") 3022 } 3023 t.sizes && l.setAttribute("sizes", t.sizes) 3024 } 3025 C(l, "fancybox-image"), t.imageEl = l, a.setContent(t, l, !1); 3026 t.panzoom = new D(r, p({ 3027 transformParent: !0 3028 }, this.option("Panzoom") || {}, { 3029 content: l, 3030 width: (e, i) => a.optionFor(t, "width", "auto", i) || "auto", 3031 height: (e, i) => a.optionFor(t, "height", "auto", i) || "auto", 3032 wheel: () => { 3033 const t = a.option("wheel"); 3034 return ("zoom" === t || "pan" == t) && t 3035 }, 3036 click: (e, i) => { 3037 var n, s; 3038 if (a.isCompact || a.isClosing()) return !1; 3039 if (t.index !== (null === (n = a.getSlide()) || void 0 === n ? void 0 : n.index)) return !1; 3040 if (i) { 3041 const t = i.composedPath()[0]; 3042 if (["A", "BUTTON", "TEXTAREA", "OPTION", "INPUT", "SELECT", "VIDEO"].includes(t.nodeName)) return !1 3043 } 3044 let o = !i || i.target && (null === (s = t.contentEl) || void 0 === s ? void 0 : s.contains(i.target)); 3045 return a.option(o ? "contentClick" : "backdropClick") || !1 3046 }, 3047 dblClick: () => a.isCompact ? "toggleZoom" : a.option("contentDblClick") || !1, 3048 spinner: !1, 3049 panOnlyZoomed: !0, 3050 wheelLimit: 1 / 0, 3051 on: { 3052 ready: t => { 3053 i(t) 3054 }, 3055 error: () => { 3056 n() 3057 }, 3058 destroy: () => { 3059 n() 3060 } 3061 } 3062 })) 3063 })) 3064 } 3065 zoomIn(t) { 3066 return new Promise(((e, i) => { 3067 const n = this.instance, 3068 s = n.container, 3069 { 3070 panzoom: o, 3071 contentEl: a, 3072 el: r 3073 } = t; 3074 o && o.updateMetrics(); 3075 const l = this.getZoomInfo(t); 3076 if (!(l && r && a && o && s)) return void i(); 3077 const { 3078 x: c, 3079 y: h, 3080 scale: d, 3081 opacity: u 3082 } = l, p = () => { 3083 t.state !== ct.Closing && (u && (a.style.opacity = Math.max(Math.min(1, 1 - (1 - o.scale) / (1 - d)), 0) + ""), o.scale >= 1 && o.scale > o.targetScale - .1 && e(o)) 3084 }, f = t => { 3085 (t.scale < .99 || t.scale > 1.01) && !t.isDragging || (P(s, wt), a.style.opacity = "", t.off("endAnimation", f), t.off("touchStart", f), t.off("afterTransform", p), e(t)) 3086 }; 3087 o.on("endAnimation", f), o.on("touchStart", f), o.on("afterTransform", p), o.on(["error", "destroy"], (() => { 3088 i() 3089 })), o.panTo({ 3090 x: c, 3091 y: h, 3092 scale: d, 3093 friction: 0, 3094 ignoreBounds: !0 3095 }), o.stop("current"); 3096 const g = { 3097 event: "mousemove" === o.panMode ? n.prevMouseMoveEvent || n.options.event : void 0 3098 }, 3099 m = this.optionFor(t, "initialSize"); 3100 C(s, wt), n.hideLoading(t), "full" === m ? o.zoomToFull(g) : "cover" === m ? o.zoomToCover(g) : "max" === m ? o.zoomToMax(g) : o.reset(.172) 3101 })) 3102 } 3103 getZoomInfo(t) { 3104 const { 3105 el: e, 3106 imageEl: i, 3107 thumbEl: n, 3108 panzoom: s 3109 } = t, o = this.instance, a = o.container; 3110 if (!e || !i || !n || !s || et(n) < 3 || !this.optionFor(t, "zoom") || !a || o.state === lt.Destroy) return !1; 3111 if ("0" === getComputedStyle(a).getPropertyValue("--f-images-zoom")) return !1;
vendor: 16,106 bytes, lines 3112-3445
3112 const r = window.visualViewport || null; 3113 if (1 !== (r ? r.scale : 1)) return !1; 3114 let { 3115 top: l, 3116 left: c, 3117 width: h, 3118 height: d 3119 } = n.getBoundingClientRect(), { 3120 top: u, 3121 left: p, 3122 fitWidth: f, 3123 fitHeight: g 3124 } = s.contentRect; 3125 if (!(h && d && f && g)) return !1; 3126 const m = s.container.getBoundingClientRect(); 3127 p += m.left, u += m.top; 3128 const v = -1 * (p + .5 * f - (c + .5 * h)), 3129 b = -1 * (u + .5 * g - (l + .5 * d)), 3130 y = h / f; 3131 let w = this.option("zoomOpacity") || !1; 3132 return "auto" === w && (w = Math.abs(h / d - f / g) > .1), { 3133 x: v, 3134 y: b, 3135 scale: y, 3136 opacity: w 3137 } 3138 } 3139 attach() { 3140 const t = this, 3141 e = t.instance; 3142 e.on("Carousel.change", t.onChange), e.on("Carousel.createSlide", t.onCreateSlide), e.on("Carousel.removeSlide", t.onRemoveSlide), e.on("close", t.onClose) 3143 } 3144 detach() { 3145 const t = this, 3146 e = t.instance; 3147 e.off("Carousel.change", t.onChange), e.off("Carousel.createSlide", t.onCreateSlide), e.off("Carousel.removeSlide", t.onRemoveSlide), e.off("close", t.onClose) 3148 } 3149 } 3150 Object.defineProperty(xt, "defaults", { 3151 enumerable: !0, 3152 configurable: !0, 3153 writable: !0, 3154 value: { 3155 initialSize: "fit", 3156 Panzoom: { 3157 maxScale: 1 3158 }, 3159 protected: !1, 3160 zoom: !0, 3161 zoomOpacity: "auto" 3162 } 3163 }), "function" == typeof SuppressedError && SuppressedError; 3164 const Et = "html", 3165 St = "image", 3166 Pt = "map", 3167 Ct = "youtube", 3168 Tt = "vimeo", 3169 Mt = "html5video", 3170 Ot = (t, e = {}) => { 3171 const i = new URL(t), 3172 n = new URLSearchParams(i.search), 3173 s = new URLSearchParams; 3174 for (const [t, i] of [...n, ...Object.entries(e)]) { 3175 let e = i + ""; 3176 if ("t" === t) { 3177 let t = e.match(/((\d*)m)?(\d*)s?/); 3178 t && s.set("start", 60 * parseInt(t[2] || "0") + parseInt(t[3] || "0") + "") 3179 } else s.set(t, e) 3180 } 3181 let o = s + "", 3182 a = t.match(/#t=((.*)?\d+s)/); 3183 return a && (o += `#t=${a[1]}`), o 3184 }, 3185 At = { 3186 ajax: null, 3187 autoSize: !0, 3188 iframeAttr: { 3189 allow: "autoplay; fullscreen", 3190 scrolling: "auto" 3191 }, 3192 preload: !0, 3193 videoAutoplay: !0, 3194 videoRatio: 16 / 9, 3195 videoTpl: '<video class="fancybox__html5video" playsinline controls controlsList="nodownload" poster="{{poster}}">\n <source src="{{src}}" type="{{format}}" />Sorry, your browser doesn\'t support embedded videos.</video>', 3196 videoFormat: "", 3197 vimeo: { 3198 byline: 1, 3199 color: "00adef", 3200 controls: 1, 3201 dnt: 1, 3202 muted: 0 3203 }, 3204 youtube: { 3205 controls: 1, 3206 enablejsapi: 1, 3207 nocookie: 1, 3208 rel: 0, 3209 fs: 1 3210 } 3211 }, 3212 Lt = ["image", "html", "ajax", "inline", "clone", "iframe", "map", "pdf", "html5video", "youtube", "vimeo"]; 3213 class zt extends $ { 3214 onBeforeInitSlide(t, e, i) { 3215 this.processType(i) 3216 } 3217 onCreateSlide(t, e, i) { 3218 this.setContent(i) 3219 } 3220 onClearContent(t, e) { 3221 e.xhr && (e.xhr.abort(), e.xhr = null); 3222 const i = e.iframeEl; 3223 i && (i.onload = i.onerror = null, i.src = "//about:blank", e.iframeEl = null); 3224 const n = e.contentEl, 3225 s = e.placeholderEl; 3226 if ("inline" === e.type && n && s) n.classList.remove("fancybox__content"), "none" !== getComputedStyle(n).getPropertyValue("display") && (n.style.display = "none"), setTimeout((() => { 3227 s && (n && s.parentNode && s.parentNode.insertBefore(n, s), s.remove()) 3228 }), 0), e.contentEl = void 0, e.placeholderEl = void 0; 3229 else 3230 for (; e.el && e.el.firstChild;) e.el.removeChild(e.el.firstChild) 3231 } 3232 onSelectSlide(t, e, i) { 3233 i.state === ct.Ready && this.playVideo() 3234 } 3235 onUnselectSlide(t, e, i) { 3236 var n, s; 3237 if (i.type === Mt) { 3238 try { 3239 null === (s = null === (n = i.el) || void 0 === n ? void 0 : n.querySelector("video")) || void 0 === s || s.pause() 3240 } catch (t) {} 3241 return 3242 } 3243 let o; 3244 i.type === Tt ? o = { 3245 method: "pause", 3246 value: "true" 3247 } : i.type === Ct && (o = { 3248 event: "command", 3249 func: "pauseVideo" 3250 }), o && i.iframeEl && i.iframeEl.contentWindow && i.iframeEl.contentWindow.postMessage(JSON.stringify(o), "*"), i.poller && clearTimeout(i.poller) 3251 } 3252 onDone(t, e) { 3253 t.isCurrentSlide(e) && !t.isClosing() && this.playVideo() 3254 } 3255 onRefresh(t, e) { 3256 e.slides.forEach((t => { 3257 t.el && (this.resizeIframe(t), this.setAspectRatio(t)) 3258 })) 3259 } 3260 onMessage(t) { 3261 try { 3262 let e = JSON.parse(t.data); 3263 if ("https://player.vimeo.com" === t.origin) { 3264 if ("ready" === e.event) 3265 for (let e of Array.from(document.getElementsByClassName("fancybox__iframe"))) e instanceof HTMLIFrameElement && e.contentWindow === t.source && (e.dataset.ready = "true") 3266 } else if (t.origin.match(/^https:\/\/(www.)?youtube(-nocookie)?.com$/) && "onReady" === e.event) { 3267 const t = document.getElementById(e.id); 3268 t && (t.dataset.ready = "true") 3269 } 3270 } catch (t) {} 3271 } 3272 loadAjaxContent(t) { 3273 const e = this.instance.optionFor(t, "src") || ""; 3274 this.instance.showLoading(t); 3275 const i = this.instance, 3276 n = new XMLHttpRequest; 3277 i.showLoading(t), n.onreadystatechange = function() { 3278 n.readyState === XMLHttpRequest.DONE && i.state === lt.Ready && (i.hideLoading(t), 200 === n.status ? i.setContent(t, n.responseText) : i.setError(t, 404 === n.status ? "{{AJAX_NOT_FOUND}}" : "{{AJAX_FORBIDDEN}}")) 3279 }; 3280 const s = t.ajax || null; 3281 n.open(s ? "POST" : "GET", e + ""), n.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"), n.setRequestHeader("X-Requested-With", "XMLHttpRequest"), n.send(s), t.xhr = n 3282 } 3283 setInlineContent(t) { 3284 let e = null; 3285 if (S(t.src)) e = t.src; 3286 else if ("string" == typeof t.src) { 3287 const i = t.src.split("#", 2).pop(); 3288 e = i ? document.getElementById(i) : null 3289 } 3290 if (e) { 3291 if ("clone" === t.type || e.closest(".fancybox__slide")) { 3292 e = e.cloneNode(!0); 3293 const i = e.dataset.animationName; 3294 i && (e.classList.remove(i), delete e.dataset.animationName); 3295 let n = e.getAttribute("id"); 3296 n = n ? `${n}--clone` : `clone-${this.instance.id}-${t.index}`, e.setAttribute("id", n) 3297 } else if (e.parentNode) { 3298 const i = document.createElement("div"); 3299 i.classList.add("fancybox-placeholder"), e.parentNode.insertBefore(i, e), t.placeholderEl = i 3300 } 3301 this.instance.setContent(t, e) 3302 } else this.instance.setError(t, "{{ELEMENT_NOT_FOUND}}") 3303 } 3304 setIframeContent(t) { 3305 const { 3306 src: e, 3307 el: i 3308 } = t; 3309 if (!e || "string" != typeof e || !i) return; 3310 i.classList.add("is-loading"); 3311 const n = this.instance, 3312 s = document.createElement("iframe"); 3313 s.className = "fancybox__iframe", s.setAttribute("id", `fancybox__iframe_${n.id}_${t.index}`); 3314 for (const [e, i] of Object.entries(this.optionFor(t, "iframeAttr") || {})) s.setAttribute(e, i); 3315 s.onerror = () => { 3316 n.setError(t, "{{IFRAME_ERROR}}") 3317 }, t.iframeEl = s; 3318 const o = this.optionFor(t, "preload"); 3319 if ("iframe" !== t.type || !1 === o) return s.setAttribute("src", t.src + ""), n.setContent(t, s, !1), this.resizeIframe(t), void n.revealContent(t); 3320 n.showLoading(t), s.onload = () => { 3321 if (!s.src.length) return; 3322 const e = "true" !== s.dataset.ready; 3323 s.dataset.ready = "true", this.resizeIframe(t), e ? n.revealContent(t) : n.hideLoading(t) 3324 }, s.setAttribute("src", e), n.setContent(t, s, !1) 3325 } 3326 resizeIframe(t) { 3327 const { 3328 type: e, 3329 iframeEl: i 3330 } = t; 3331 if (e === Ct || e === Tt) return; 3332 const n = null == i ? void 0 : i.parentElement; 3333 if (!i || !n) return; 3334 let s = t.autoSize; 3335 void 0 === s && (s = this.optionFor(t, "autoSize")); 3336 let o = t.width || 0, 3337 a = t.height || 0; 3338 o && a && (s = !1); 3339 const r = n && n.style; 3340 if (!1 !== t.preload && !1 !== s && r) try { 3341 const t = window.getComputedStyle(n), 3342 e = parseFloat(t.paddingLeft) + parseFloat(t.paddingRight), 3343 s = parseFloat(t.paddingTop) + parseFloat(t.paddingBottom), 3344 l = i.contentWindow; 3345 if (l) { 3346 const t = l.document, 3347 i = t.getElementsByTagName(Et)[0], 3348 n = t.body; 3349 r.width = "", n.style.overflow = "hidden", o = o || i.scrollWidth + e, r.width = `${o}px`, n.style.overflow = "", r.flex = "0 0 auto", r.height = `${n.scrollHeight}px`, a = i.scrollHeight + s 3350 } 3351 } catch (t) {} 3352 if (o || a) { 3353 const t = { 3354 flex: "0 1 auto", 3355 width: "", 3356 height: "" 3357 }; 3358 o && "auto" !== o && (t.width = `${o}px`), a && "auto" !== a && (t.height = `${a}px`), Object.assign(r, t) 3359 } 3360 } 3361 playVideo() { 3362 const t = this.instance.getSlide(); 3363 if (!t) return; 3364 const { 3365 el: e 3366 } = t; 3367 if (!e || !e.offsetParent) return; 3368 if (!this.optionFor(t, "videoAutoplay")) return; 3369 if (t.type === Mt) try { 3370 const t = e.querySelector("video"); 3371 if (t) { 3372 const e = t.play(); 3373 void 0 !== e && e.then((() => {})).catch((e => { 3374 t.muted = !0, t.play() 3375 })) 3376 } 3377 } catch (t) {} 3378 if (t.type !== Ct && t.type !== Tt) return; 3379 const i = () => { 3380 if (t.iframeEl && t.iframeEl.contentWindow) { 3381 let e; 3382 if ("true" === t.iframeEl.dataset.ready) return e = t.type === Ct ? { 3383 event: "command", 3384 func: "playVideo" 3385 } : { 3386 method: "play", 3387 value: "true" 3388 }, e && t.iframeEl.contentWindow.postMessage(JSON.stringify(e), "*"), void(t.poller = void 0); 3389 t.type === Ct && (e = { 3390 event: "listening", 3391 id: t.iframeEl.getAttribute("id") 3392 }, t.iframeEl.contentWindow.postMessage(JSON.stringify(e), "*")) 3393 } 3394 t.poller = setTimeout(i, 250) 3395 }; 3396 i() 3397 } 3398 processType(t) { 3399 if (t.html) return t.type = Et, t.src = t.html, void(t.html = ""); 3400 const e = this.instance.optionFor(t, "src", ""); 3401 if (!e || "string" != typeof e) return; 3402 let i = t.type, 3403 n = null; 3404 if (n = e.match(/(youtube\.com|youtu\.be|youtube\-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/|shorts\/|embed\/?)?(videoseries\?list=(?:.*)|[\w-]{11}|\?listType=(?:.*)&list=(?:.*))(?:.*)/i)) { 3405 const s = this.optionFor(t, Ct), 3406 { 3407 nocookie: o 3408 } = s, 3409 a = function(t, e) { 3410 var i = {}; 3411 for (var n in t) Object.prototype.hasOwnProperty.call(t, n) && e.indexOf(n) < 0 && (i[n] = t[n]); 3412 if (null != t && "function" == typeof Object.getOwnPropertySymbols) { 3413 var s = 0; 3414 for (n = Object.getOwnPropertySymbols(t); s < n.length; s++) e.indexOf(n[s]) < 0 && Object.prototype.propertyIsEnumerable.call(t, n[s]) && (i[n[s]] = t[n[s]]) 3415 } 3416 return i 3417 }(s, ["nocookie"]), 3418 r = `www.youtube${o?"-nocookie":""}.com`, 3419 l = Ot(e, a), 3420 c = encodeURIComponent(n[2]); 3421 t.videoId = c, t.src = `https://${r}/embed/${c}?${l}`, t.thumbSrc = t.thumbSrc || `https://i.ytimg.com/vi/${c}/mqdefault.jpg`, i = Ct 3422 } else if (n = e.match(/^.+vimeo.com\/(?:\/)?([\d]+)((\/|\?h=)([a-z0-9]+))?(.*)?/)) { 3423 const s = Ot(e, this.optionFor(t, Tt)), 3424 o = encodeURIComponent(n[1]), 3425 a = n[4] || ""; 3426 t.videoId = o, t.src = `https://player.vimeo.com/video/${o}?${a?`h=${a}${s?"&":""}`:""}${s}`, i = Tt 3427 } 3428 if (!i && t.triggerEl) { 3429 const e = t.triggerEl.dataset.type; 3430 Lt.includes(e) && (i = e) 3431 } 3432 i || "string" == typeof e && ("#" === e.charAt(0) ? i = "inline" : (n = e.match(/\.(mp4|mov|ogv|webm)((\?|#).*)?$/i)) ? (i = Mt, t.videoFormat = t.videoFormat || "video/" + ("ogv" === n[1] ? "ogg" : n[1])) : e.match(/(^data:image\/[a-z0-9+\/=]*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp|svg|ico)((\?|#).*)?$)/i) ? i = St : e.match(/\.(pdf)((\?|#).*)?$/i) && (i = "pdf")), (n = e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:(?:(?:maps\/(?:place\/(?:.*)\/)?\@(.*),(\d+.?\d+?)z))|(?:\?ll=))(.*)?/i)) ? (t.src = `https://maps.google.${n[1]}/?ll=${(n[2]?n[2]+"&z="+Math.floor(parseFloat(n[3]))+(n[4]?n[4].replace(/^\//,"&"):""):n[4]+"").replace(/\?/,"&")}&output=${n[4]&&n[4].indexOf("layer=c")>0?"svembed":"embed"}`, i = Pt) : (n = e.match(/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/search\/)(.*)/i)) && (t.src = `https://maps.google.${n[1]}/maps?q=${n[2].replace("query=","q=").replace("api=1","")}&output=embed`, i = Pt), i = i || this.instance.option("defaultType"), t.type = i, i === St && (t.thumbSrc = t.thumbSrc || t.src) 3433 } 3434 setContent(t) { 3435 const e = this.instance.optionFor(t, "src") || ""; 3436 if (t && t.type && e) { 3437 switch (t.type) { 3438 case Et: 3439 this.instance.setContent(t, e); 3440 break; 3441 case Mt: 3442 const i = this.option("videoTpl"); 3443 i && this.instance.setContent(t, i.replace(/\{\{src\}\}/gi, e + "").replace(/\{\{format\}\}/gi, this.optionFor(t, "videoFormat") || "").replace(/\{\{poster\}\}/gi, t.poster || t.thumbSrc || "")); 3444 break; 3445 case "inline":
vendor: 26,465 bytes, lines 3446-4098
3446 case "clone": 3447 this.setInlineContent(t); 3448 break; 3449 case "ajax": 3450 this.loadAjaxContent(t); 3451 break; 3452 case "pdf": 3453 case Pt: 3454 case Ct: 3455 case Tt: 3456 t.preload = !1; 3457 case "iframe": 3458 this.setIframeContent(t) 3459 } 3460 this.setAspectRatio(t) 3461 } 3462 } 3463 setAspectRatio(t) { 3464 const e = t.contentEl; 3465 if (!(t.el && e && t.type && [Ct, Tt, Mt].includes(t.type))) return; 3466 let i, n = t.width || "auto", 3467 s = t.height || "auto"; 3468 if ("auto" === n || "auto" === s) { 3469 i = this.optionFor(t, "videoRatio"); 3470 const e = (i + "").match(/(\d+)\s*\/\s?(\d+)/); 3471 i = e && e.length > 2 ? parseFloat(e[1]) / parseFloat(e[2]) : parseFloat(i + "") 3472 } else n && s && (i = n / s); 3473 if (!i) return; 3474 e.style.aspectRatio = "", e.style.width = "", e.style.height = "", e.offsetHeight; 3475 const o = e.getBoundingClientRect(), 3476 a = o.width || 1, 3477 r = o.height || 1; 3478 e.style.aspectRatio = i + "", i < a / r ? (s = "auto" === s ? r : Math.min(r, s), e.style.width = "auto", e.style.height = `${s}px`) : (n = "auto" === n ? a : Math.min(a, n), e.style.width = `${n}px`, e.style.height = "auto") 3479 } 3480 attach() { 3481 const t = this, 3482 e = t.instance; 3483 e.on("Carousel.beforeInitSlide", t.onBeforeInitSlide), e.on("Carousel.createSlide", t.onCreateSlide), e.on("Carousel.selectSlide", t.onSelectSlide), e.on("Carousel.unselectSlide", t.onUnselectSlide), e.on("Carousel.Panzoom.refresh", t.onRefresh), e.on("done", t.onDone), e.on("clearContent", t.onClearContent), window.addEventListener("message", t.onMessage) 3484 } 3485 detach() { 3486 const t = this, 3487 e = t.instance; 3488 e.off("Carousel.beforeInitSlide", t.onBeforeInitSlide), e.off("Carousel.createSlide", t.onCreateSlide), e.off("Carousel.selectSlide", t.onSelectSlide), e.off("Carousel.unselectSlide", t.onUnselectSlide), e.off("Carousel.Panzoom.refresh", t.onRefresh), e.off("done", t.onDone), e.off("clearContent", t.onClearContent), window.removeEventListener("message", t.onMessage) 3489 } 3490 } 3491 Object.defineProperty(zt, "defaults", { 3492 enumerable: !0, 3493 configurable: !0, 3494 writable: !0, 3495 value: At 3496 }); 3497 const Rt = "play", 3498 kt = "pause", 3499 It = "ready"; 3500 class Dt extends $ { 3501 constructor() { 3502 super(...arguments), Object.defineProperty(this, "state", { 3503 enumerable: !0, 3504 configurable: !0, 3505 writable: !0, 3506 value: It 3507 }), Object.defineProperty(this, "inHover", { 3508 enumerable: !0, 3509 configurable: !0, 3510 writable: !0, 3511 value: !1 3512 }), Object.defineProperty(this, "timer", { 3513 enumerable: !0, 3514 configurable: !0, 3515 writable: !0, 3516 value: null 3517 }), Object.defineProperty(this, "progressBar", { 3518 enumerable: !0, 3519 configurable: !0, 3520 writable: !0, 3521 value: null 3522 }) 3523 } 3524 get isActive() { 3525 return this.state !== It 3526 } 3527 onReady(t) { 3528 this.option("autoStart") && (t.isInfinite || t.page < t.pages.length - 1) && this.start() 3529 } 3530 onChange() { 3531 this.removeProgressBar(), this.pause() 3532 } 3533 onSettle() { 3534 this.resume() 3535 } 3536 onVisibilityChange() { 3537 "visible" === document.visibilityState ? this.resume() : this.pause() 3538 } 3539 onMouseEnter() { 3540 this.inHover = !0, this.pause() 3541 } 3542 onMouseLeave() { 3543 var t; 3544 this.inHover = !1, (null === (t = this.instance.panzoom) || void 0 === t ? void 0 : t.isResting) && this.resume() 3545 } 3546 onTimerEnd() { 3547 const t = this.instance; 3548 "play" === this.state && (t.isInfinite || t.page !== t.pages.length - 1 ? t.slideNext() : t.slideTo(0)) 3549 } 3550 removeProgressBar() { 3551 this.progressBar && (this.progressBar.remove(), this.progressBar = null) 3552 } 3553 createProgressBar() { 3554 var t; 3555 if (!this.option("showProgress")) return null; 3556 this.removeProgressBar(); 3557 const e = this.instance, 3558 i = (null === (t = e.pages[e.page]) || void 0 === t ? void 0 : t.slides) || []; 3559 let n = this.option("progressParentEl"); 3560 if (n || (n = (1 === i.length ? i[0].el : null) || e.viewport), !n) return null; 3561 const s = document.createElement("div"); 3562 return C(s, "f-progress"), n.prepend(s), this.progressBar = s, s.offsetHeight, s 3563 } 3564 set() { 3565 const t = this, 3566 e = t.instance; 3567 if (e.pages.length < 2) return; 3568 if (t.timer) return; 3569 const i = t.option("timeout"); 3570 t.state = Rt, C(e.container, "has-autoplay"); 3571 let n = t.createProgressBar(); 3572 n && (n.style.transitionDuration = `${i}ms`, n.style.transform = "scaleX(1)"), t.timer = setTimeout((() => { 3573 t.timer = null, t.inHover || t.onTimerEnd() 3574 }), i), t.emit("set") 3575 } 3576 clear() { 3577 const t = this; 3578 t.timer && (clearTimeout(t.timer), t.timer = null), t.removeProgressBar() 3579 } 3580 start() { 3581 const t = this; 3582 if (t.set(), t.state !== It) { 3583 if (t.option("pauseOnHover")) { 3584 const e = t.instance.container; 3585 e.addEventListener("mouseenter", t.onMouseEnter, !1), e.addEventListener("mouseleave", t.onMouseLeave, !1) 3586 } 3587 document.addEventListener("visibilitychange", t.onVisibilityChange, !1), t.emit("start") 3588 } 3589 } 3590 stop() { 3591 const t = this, 3592 e = t.state, 3593 i = t.instance.container; 3594 t.clear(), t.state = It, i.removeEventListener("mouseenter", t.onMouseEnter, !1), i.removeEventListener("mouseleave", t.onMouseLeave, !1), document.removeEventListener("visibilitychange", t.onVisibilityChange, !1), P(i, "has-autoplay"), e !== It && t.emit("stop") 3595 } 3596 pause() { 3597 const t = this; 3598 t.state === Rt && (t.state = kt, t.clear(), t.emit(kt)) 3599 } 3600 resume() { 3601 const t = this, 3602 e = t.instance; 3603 if (e.isInfinite || e.page !== e.pages.length - 1) 3604 if (t.state !== Rt) { 3605 if (t.state === kt && !t.inHover) { 3606 const e = new Event("resume", { 3607 bubbles: !0, 3608 cancelable: !0 3609 }); 3610 t.emit("resume", e), e.defaultPrevented || t.set() 3611 } 3612 } else t.set(); 3613 else t.stop() 3614 } 3615 toggle() { 3616 this.state === Rt || this.state === kt ? this.stop() : this.start() 3617 } 3618 attach() { 3619 const t = this, 3620 e = t.instance; 3621 e.on("ready", t.onReady), e.on("Panzoom.startAnimation", t.onChange), e.on("Panzoom.endAnimation", t.onSettle), e.on("Panzoom.touchMove", t.onChange) 3622 } 3623 detach() { 3624 const t = this, 3625 e = t.instance; 3626 e.off("ready", t.onReady), e.off("Panzoom.startAnimation", t.onChange), e.off("Panzoom.endAnimation", t.onSettle), e.off("Panzoom.touchMove", t.onChange), t.stop() 3627 } 3628 } 3629 Object.defineProperty(Dt, "defaults", { 3630 enumerable: !0, 3631 configurable: !0, 3632 writable: !0, 3633 value: { 3634 autoStart: !0, 3635 pauseOnHover: !0, 3636 progressParentEl: null, 3637 showProgress: !0, 3638 timeout: 3e3 3639 } 3640 }); 3641 class Ft extends $ { 3642 constructor() { 3643 super(...arguments), Object.defineProperty(this, "ref", { 3644 enumerable: !0, 3645 configurable: !0, 3646 writable: !0, 3647 value: null 3648 }) 3649 } 3650 onPrepare(t) { 3651 const e = t.carousel; 3652 if (!e) return; 3653 const i = t.container; 3654 i && (e.options.Autoplay = p({ 3655 autoStart: !1 3656 }, this.option("Autoplay") || {}, { 3657 pauseOnHover: !1, 3658 timeout: this.option("timeout"), 3659 progressParentEl: () => this.option("progressParentEl") || null, 3660 on: { 3661 start: () => { 3662 t.emit("startSlideshow") 3663 }, 3664 set: e => { 3665 var n; 3666 i.classList.add("has-slideshow"), (null === (n = t.getSlide()) || void 0 === n ? void 0 : n.state) !== ct.Ready && e.pause() 3667 }, 3668 stop: () => { 3669 i.classList.remove("has-slideshow"), t.isCompact || t.endIdle(), t.emit("endSlideshow") 3670 }, 3671 resume: (e, i) => { 3672 var n, s, o; 3673 !i || !i.cancelable || (null === (n = t.getSlide()) || void 0 === n ? void 0 : n.state) === ct.Ready && (null === (o = null === (s = t.carousel) || void 0 === s ? void 0 : s.panzoom) || void 0 === o ? void 0 : o.isResting) || i.preventDefault() 3674 } 3675 } 3676 }), e.attachPlugins({ 3677 Autoplay: Dt 3678 }), this.ref = e.plugins.Autoplay) 3679 } 3680 onReady(t) { 3681 const e = t.carousel, 3682 i = this.ref; 3683 i && e && this.option("playOnStart") && (e.isInfinite || e.page < e.pages.length - 1) && i.start() 3684 } 3685 onDone(t, e) { 3686 const i = this.ref, 3687 n = t.carousel; 3688 if (!i || !n) return; 3689 const s = e.panzoom; 3690 s && s.on("startAnimation", (() => { 3691 t.isCurrentSlide(e) && i.stop() 3692 })), t.isCurrentSlide(e) && i.resume() 3693 } 3694 onKeydown(t, e) { 3695 var i; 3696 const n = this.ref; 3697 n && e === this.option("key") && "BUTTON" !== (null === (i = document.activeElement) || void 0 === i ? void 0 : i.nodeName) && n.toggle() 3698 } 3699 attach() { 3700 const t = this, 3701 e = t.instance; 3702 e.on("Carousel.init", t.onPrepare), e.on("Carousel.ready", t.onReady), e.on("done", t.onDone), e.on("keydown", t.onKeydown) 3703 } 3704 detach() { 3705 const t = this, 3706 e = t.instance; 3707 e.off("Carousel.init", t.onPrepare), e.off("Carousel.ready", t.onReady), e.off("done", t.onDone), e.off("keydown", t.onKeydown) 3708 } 3709 } 3710 Object.defineProperty(Ft, "defaults", { 3711 enumerable: !0, 3712 configurable: !0, 3713 writable: !0, 3714 value: { 3715 key: " ", 3716 playOnStart: !1, 3717 progressParentEl: t => { 3718 var e; 3719 return (null === (e = t.instance.container) || void 0 === e ? void 0 : e.querySelector(".fancybox__toolbar [data-fancybox-toggle-slideshow]")) || t.instance.container 3720 }, 3721 timeout: 3e3 3722 } 3723 }); 3724 const jt = { 3725 classes: { 3726 container: "f-thumbs f-carousel__thumbs", 3727 viewport: "f-thumbs__viewport", 3728 track: "f-thumbs__track", 3729 slide: "f-thumbs__slide", 3730 isResting: "is-resting", 3731 isSelected: "is-selected", 3732 isLoading: "is-loading", 3733 hasThumbs: "has-thumbs" 3734 }, 3735 minCount: 2, 3736 parentEl: null, 3737 thumbTpl: '<button class="f-thumbs__slide__button" tabindex="0" type="button" aria-label="{{GOTO}}" data-carousel-index="%i"><img class="f-thumbs__slide__img" data-lazy-src="{{%s}}" alt="" /></button>', 3738 type: "modern" 3739 }; 3740 var Bt; 3741 ! function(t) { 3742 t[t.Init = 0] = "Init", t[t.Ready = 1] = "Ready", t[t.Hidden = 2] = "Hidden" 3743 }(Bt || (Bt = {})); 3744 const Ht = "isResting", 3745 Nt = "thumbWidth", 3746 _t = "thumbHeight", 3747 $t = "thumbClipWidth"; 3748 let Wt = class extends $ { 3749 constructor() { 3750 super(...arguments), Object.defineProperty(this, "type", { 3751 enumerable: !0, 3752 configurable: !0, 3753 writable: !0, 3754 value: "modern" 3755 }), Object.defineProperty(this, "container", { 3756 enumerable: !0, 3757 configurable: !0, 3758 writable: !0, 3759 value: null 3760 }), Object.defineProperty(this, "track", { 3761 enumerable: !0, 3762 configurable: !0, 3763 writable: !0, 3764 value: null 3765 }), Object.defineProperty(this, "carousel", { 3766 enumerable: !0, 3767 configurable: !0, 3768 writable: !0, 3769 value: null 3770 }), Object.defineProperty(this, "thumbWidth", { 3771 enumerable: !0, 3772 configurable: !0, 3773 writable: !0, 3774 value: 0 3775 }), Object.defineProperty(this, "thumbClipWidth", { 3776 enumerable: !0, 3777 configurable: !0, 3778 writable: !0, 3779 value: 0 3780 }), Object.defineProperty(this, "thumbHeight", { 3781 enumerable: !0, 3782 configurable: !0, 3783 writable: !0, 3784 value: 0 3785 }), Object.defineProperty(this, "thumbGap", { 3786 enumerable: !0, 3787 configurable: !0, 3788 writable: !0, 3789 value: 0 3790 }), Object.defineProperty(this, "thumbExtraGap", { 3791 enumerable: !0, 3792 configurable: !0, 3793 writable: !0, 3794 value: 0 3795 }), Object.defineProperty(this, "state", { 3796 enumerable: !0, 3797 configurable: !0, 3798 writable: !0, 3799 value: Bt.Init 3800 }) 3801 } 3802 get isModern() { 3803 return "modern" === this.type 3804 } 3805 onInitSlide(t, e) { 3806 const i = e.el ? e.el.dataset : void 0; 3807 i && (e.thumbSrc = i.thumbSrc || e.thumbSrc || "", e[$t] = parseFloat(i[$t] || "") || e[$t] || 0, e[_t] = parseFloat(i.thumbHeight || "") || e[_t] || 0), this.addSlide(e) 3808 } 3809 onInitSlides() { 3810 this.build() 3811 } 3812 onChange() { 3813 var t; 3814 if (!this.isModern) return; 3815 const e = this.container, 3816 i = this.instance, 3817 n = i.panzoom, 3818 s = this.carousel, 3819 o = s ? s.panzoom : null, 3820 r = i.page; 3821 if (n && s && o) { 3822 if (n.isDragging) { 3823 P(e, this.cn(Ht)); 3824 let n = (null === (t = s.pages[r]) || void 0 === t ? void 0 : t.pos) || 0; 3825 n += i.getProgress(r) * (this[$t] + this.thumbGap); 3826 let a = o.getBounds(); - 1 * n > a.x.min && -1 * n < a.x.max && o.panTo({ 3827 x: -1 * n, 3828 friction: .12 3829 }) 3830 } else a(e, this.cn(Ht), n.isResting); 3831 this.shiftModern() 3832 } 3833 } 3834 onRefresh() { 3835 this.updateProps(); 3836 for (const t of this.instance.slides || []) this.resizeModernSlide(t); 3837 this.shiftModern() 3838 } 3839 isDisabled() { 3840 const t = this.option("minCount") || 0; 3841 if (t) { 3842 const e = this.instance; 3843 let i = 0; 3844 for (const t of e.slides || []) t.thumbSrc && i++; 3845 if (i < t) return !0 3846 } 3847 const e = this.option("type"); 3848 return ["modern", "classic"].indexOf(e) < 0 3849 } 3850 getThumb(t) { 3851 const e = this.option("thumbTpl") || ""; 3852 return { 3853 html: this.instance.localize(e, [ 3854 ["%i", t.index], 3855 ["%d", t.index + 1], 3856 ["%s", t.thumbSrc || "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7"] 3857 ]) 3858 } 3859 } 3860 addSlide(t) { 3861 const e = this.carousel; 3862 e && e.addSlide(t.index, this.getThumb(t)) 3863 } 3864 getSlides() { 3865 const t = []; 3866 for (const e of this.instance.slides || []) t.push(this.getThumb(e)); 3867 return t 3868 } 3869 resizeModernSlide(t) { 3870 this.isModern && (t[Nt] = t[$t] && t[_t] ? Math.round(this[_t] * (t[$t] / t[_t])) : this[Nt]) 3871 } 3872 updateProps() { 3873 const t = this.container; 3874 if (!t) return; 3875 const e = e => parseFloat(getComputedStyle(t).getPropertyValue("--f-thumb-" + e)) || 0; 3876 this.thumbGap = e("gap"), this.thumbExtraGap = e("extra-gap"), this[Nt] = e("width") || 40, this[$t] = e("clip-width") || 40, this[_t] = e("height") || 40 3877 } 3878 build() { 3879 const t = this; 3880 if (t.state !== Bt.Init) return; 3881 if (t.isDisabled()) return void t.emit("disabled"); 3882 const e = t.instance, 3883 i = e.container, 3884 n = t.getSlides(), 3885 s = t.option("type"); 3886 t.type = s; 3887 const o = t.option("parentEl"), 3888 a = t.cn("container"), 3889 r = t.cn("track"); 3890 let l = null == o ? void 0 : o.querySelector("." + a); 3891 l || (l = document.createElement("div"), C(l, a), o ? o.appendChild(l) : i.after(l)), C(l, `is-${s}`), C(i, t.cn("hasThumbs")), t.container = l, t.updateProps(); 3892 let c = l.querySelector("." + r); 3893 c || (c = document.createElement("div"), C(c, t.cn("track")), l.appendChild(c)), t.track = c; 3894 const h = p({}, { 3895 track: c, 3896 infinite: !1, 3897 center: !0, 3898 fill: "classic" === s, 3899 dragFree: !0, 3900 slidesPerPage: 1, 3901 transition: !1, 3902 preload: .25, 3903 friction: .12, 3904 Panzoom: { 3905 maxVelocity: 0 3906 }, 3907 Dots: !1, 3908 Navigation: !1, 3909 classes: { 3910 container: "f-thumbs", 3911 viewport: "f-thumbs__viewport", 3912 track: "f-thumbs__track", 3913 slide: "f-thumbs__slide" 3914 } 3915 }, t.option("Carousel") || {}, { 3916 Sync: { 3917 target: e 3918 }, 3919 slides: n 3920 }), 3921 d = new e.constructor(l, h); 3922 d.on("createSlide", ((e, i) => { 3923 t.setProps(i.index), t.emit("createSlide", i, i.el) 3924 })), d.on("ready", (() => { 3925 t.shiftModern(), t.emit("ready") 3926 })), d.on("refresh", (() => { 3927 t.shiftModern() 3928 })), d.on("Panzoom.click", ((e, i, n) => { 3929 t.onClick(n) 3930 })), t.carousel = d, t.state = Bt.Ready 3931 } 3932 onClick(t) { 3933 t.preventDefault(), t.stopPropagation(); 3934 const e = this.instance, 3935 { 3936 pages: i, 3937 page: n 3938 } = e, 3939 s = t => { 3940 if (t) { 3941 const e = t.closest("[data-carousel-index]"); 3942 if (e) return [parseInt(e.dataset.carouselIndex || "", 10) || 0, e] 3943 } 3944 return [-1, void 0] 3945 }, 3946 o = (t, e) => { 3947 const i = document.elementFromPoint(t, e); 3948 return i ? s(i) : [-1, void 0] 3949 }; 3950 let [a, r] = s(t.target); 3951 if (a > -1) return; 3952 const l = this[$t], 3953 c = t.clientX, 3954 h = t.clientY; 3955 let [d, u] = o(c - l, h), [p, f] = o(c + l, h); 3956 u && f ? (a = Math.abs(c - u.getBoundingClientRect().right) < Math.abs(c - f.getBoundingClientRect().left) ? d : p, a === n && (a = a === d ? p : d)) : u ? a = d : f && (a = p), a > -1 && i[a] && e.slideTo(a) 3957 } 3958 getShift(t) { 3959 var e; 3960 const i = this, 3961 { 3962 instance: n 3963 } = i, 3964 s = i.carousel; 3965 if (!n || !s) return 0; 3966 const o = i[Nt], 3967 a = i[$t], 3968 r = i.thumbGap, 3969 l = i.thumbExtraGap; 3970 if (!(null === (e = s.slides[t]) || void 0 === e ? void 0 : e.el)) return 0; 3971 const c = .5 * (o - a), 3972 h = n.pages.length - 1; 3973 let d = n.getProgress(0), 3974 u = n.getProgress(h), 3975 p = n.getProgress(t, !1, !0), 3976 f = 0, 3977 g = c + l + r; 3978 const m = d < 0 && d > -1, 3979 v = u > 0 && u < 1; 3980 return 0 === t ? (f = g * Math.abs(d), v && 1 === d && (f -= g * Math.abs(u))) : t === h ? (f = g * Math.abs(u) * -1, m && -1 === u && (f += g * Math.abs(d))) : m || v ? (f = -1 * g, f += g * Math.abs(d), f += g * (1 - Math.abs(u))) : f = g * p, f 3981 } 3982 setProps(t) { 3983 var i; 3984 const n = this; 3985 if (!n.isModern) return; 3986 const { 3987 instance: s 3988 } = n, o = n.carousel; 3989 if (s && o) { 3990 const a = null === (i = o.slides[t]) || void 0 === i ? void 0 : i.el; 3991 if (a && a.childNodes.length) { 3992 let i = e(1 - Math.abs(s.getProgress(t))), 3993 o = e(n.getShift(t)); 3994 a.style.setProperty("--progress", i ? i + "" : ""), a.style.setProperty("--shift", o + "") 3995 } 3996 } 3997 } 3998 shiftModern() { 3999 const t = this; 4000 if (!t.isModern) return; 4001 const { 4002 instance: e, 4003 track: i 4004 } = t, n = e.panzoom, s = t.carousel; 4005 if (!(e && i && n && s)) return; 4006 if (n.state === v.Init || n.state === v.Destroy) return; 4007 for (const i of e.slides) t.setProps(i.index); 4008 let o = (t[$t] + t.thumbGap) * (s.slides.length || 0); 4009 i.style.setProperty("--width", o + "") 4010 } 4011 cleanup() { 4012 const t = this; 4013 t.carousel && t.carousel.destroy(), t.carousel = null, t.container && t.container.remove(), t.container = null, t.track && t.track.remove(), t.track = null, t.state = Bt.Init, P(t.instance.container, t.cn("hasThumbs")) 4014 } 4015 attach() { 4016 const t = this, 4017 e = t.instance; 4018 e.on("initSlide", t.onInitSlide), e.state === H.Init ? e.on("initSlides", t.onInitSlides) : t.onInitSlides(), e.on(["change", "Panzoom.afterTransform"], t.onChange), e.on("Panzoom.refresh", t.onRefresh) 4019 } 4020 detach() { 4021 const t = this, 4022 e = t.instance; 4023 e.off("initSlide", t.onInitSlide), e.off("initSlides", t.onInitSlides), e.off(["change", "Panzoom.afterTransform"], t.onChange), e.off("Panzoom.refresh", t.onRefresh), t.cleanup() 4024 } 4025 }; 4026 Object.defineProperty(Wt, "defaults", { 4027 enumerable: !0, 4028 configurable: !0, 4029 writable: !0, 4030 value: jt 4031 }); 4032 const Xt = Object.assign(Object.assign({}, jt), { 4033 key: "t", 4034 showOnStart: !0, 4035 parentEl: null 4036 }), 4037 qt = "is-masked", 4038 Yt = "aria-hidden"; 4039 class Vt extends $ { 4040 constructor() { 4041 super(...arguments), Object.defineProperty(this, "ref", { 4042 enumerable: !0, 4043 configurable: !0, 4044 writable: !0, 4045 value: null 4046 }), Object.defineProperty(this, "hidden", { 4047 enumerable: !0, 4048 configurable: !0, 4049 writable: !0, 4050 value: !1 4051 }) 4052 } 4053 get isEnabled() { 4054 const t = this.ref; 4055 return t && !t.isDisabled() 4056 } 4057 get isHidden() { 4058 return this.hidden 4059 } 4060 onClick(t, e) { 4061 e.stopPropagation() 4062 } 4063 onCreateSlide(t, e) { 4064 var i, n, s; 4065 const o = (null === (s = null === (n = null === (i = this.instance) || void 0 === i ? void 0 : i.carousel) || void 0 === n ? void 0 : n.slides[e.index]) || void 0 === s ? void 0 : s.type) || "", 4066 a = e.el; 4067 if (a && o) { 4068 let t = `for-${o}`; 4069 ["video", "youtube", "vimeo", "html5video"].includes(o) && (t += " for-video"), C(a, t) 4070 } 4071 } 4072 onInit() { 4073 var t; 4074 const e = this, 4075 i = e.instance, 4076 n = i.carousel; 4077 if (e.ref || !n) return; 4078 const s = e.option("parentEl") || i.footer || i.container; 4079 if (!s) return; 4080 const o = p({}, e.options, { 4081 parentEl: s, 4082 classes: { 4083 container: "f-thumbs fancybox__thumbs" 4084 }, 4085 Carousel: { 4086 Sync: { 4087 friction: i.option("Carousel.friction") || 0 4088 } 4089 }, 4090 on: { 4091 ready: t => { 4092 const i = t.container; 4093 i && this.hidden && (e.refresh(), i.style.transition = "none", e.hide(), i.offsetHeight, queueMicrotask((() => { 4094 i.style.transition = "", e.show() 4095 }))) 4096 } 4097 } 4098 });
vendor: 4,070 bytes, lines 4099-4197
4099 o.Carousel = o.Carousel || {}, o.Carousel.on = p((null === (t = e.options.Carousel) || void 0 === t ? void 0 : t.on) || {}, { 4100 click: this.onClick, 4101 createSlide: this.onCreateSlide 4102 }), n.options.Thumbs = o, n.attachPlugins({ 4103 Thumbs: Wt 4104 }), e.ref = n.plugins.Thumbs, e.option("showOnStart") || (e.ref.state = Bt.Hidden, e.hidden = !0) 4105 } 4106 onResize() { 4107 var t; 4108 const e = null === (t = this.ref) || void 0 === t ? void 0 : t.container; 4109 e && (e.style.maxHeight = "") 4110 } 4111 onKeydown(t, e) { 4112 const i = this.option("key"); 4113 i && i === e && this.toggle() 4114 } 4115 toggle() { 4116 const t = this.ref; 4117 if (t && !t.isDisabled()) return t.state === Bt.Hidden ? (t.state = Bt.Init, void t.build()) : void(this.hidden ? this.show() : this.hide()) 4118 } 4119 show() { 4120 const t = this.ref; 4121 if (!t || t.isDisabled()) return; 4122 const e = t.container; 4123 e && (this.refresh(), e.offsetHeight, e.removeAttribute(Yt), e.classList.remove(qt), this.hidden = !1) 4124 } 4125 hide() { 4126 const t = this.ref, 4127 e = t && t.container; 4128 e && (this.refresh(), e.offsetHeight, e.classList.add(qt), e.setAttribute(Yt, "true")), this.hidden = !0 4129 } 4130 refresh() { 4131 const t = this.ref; 4132 if (!t || !t.state) return; 4133 const e = t.container, 4134 i = (null == e ? void 0 : e.firstChild) || null; 4135 e && i && i.childNodes.length && (e.style.maxHeight = `${i.getBoundingClientRect().height}px`) 4136 } 4137 attach() { 4138 const t = this, 4139 e = t.instance; 4140 e.state === lt.Init ? e.on("Carousel.init", t.onInit) : t.onInit(), e.on("resize", t.onResize), e.on("keydown", t.onKeydown) 4141 } 4142 detach() { 4143 var t; 4144 const e = this, 4145 i = e.instance; 4146 i.off("Carousel.init", e.onInit), i.off("resize", e.onResize), i.off("keydown", e.onKeydown), null === (t = i.carousel) || void 0 === t || t.detachPlugins(["Thumbs"]), e.ref = null 4147 } 4148 } 4149 Object.defineProperty(Vt, "defaults", { 4150 enumerable: !0, 4151 configurable: !0, 4152 writable: !0, 4153 value: Xt 4154 }); 4155 const Zt = { 4156 panLeft: { 4157 icon: '<svg><path d="M5 12h14M5 12l6 6M5 12l6-6"/></svg>', 4158 change: { 4159 panX: -100 4160 } 4161 }, 4162 panRight: { 4163 icon: '<svg><path d="M5 12h14M13 18l6-6M13 6l6 6"/></svg>', 4164 change: { 4165 panX: 100 4166 } 4167 }, 4168 panUp: { 4169 icon: '<svg><path d="M12 5v14M18 11l-6-6M6 11l6-6"/></svg>', 4170 change: { 4171 panY: -100 4172 } 4173 }, 4174 panDown: { 4175 icon: '<svg><path d="M12 5v14M18 13l-6 6M6 13l6 6"/></svg>', 4176 change: { 4177 panY: 100 4178 } 4179 }, 4180 zoomIn: { 4181 icon: '<svg><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M11 8v6M8 11h6"/></svg>', 4182 action: "zoomIn" 4183 }, 4184 zoomOut: { 4185 icon: '<svg><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>', 4186 action: "zoomOut" 4187 }, 4188 toggle1to1: { 4189 icon: '<svg><path d="M3.51 3.07c5.74.02 11.48-.02 17.22.02 1.37.1 2.34 1.64 2.18 3.13 0 4.08.02 8.16 0 12.23-.1 1.54-1.47 2.64-2.79 2.46-5.61-.01-11.24.02-16.86-.01-1.36-.12-2.33-1.65-2.17-3.14 0-4.07-.02-8.16 0-12.23.1-1.36 1.22-2.48 2.42-2.46Z"/><path d="M5.65 8.54h1.49v6.92m8.94-6.92h1.49v6.92M11.5 9.4v.02m0 5.18v0"/></svg>', 4190 action: "toggleZoom" 4191 }, 4192 toggleZoom: { 4193 icon: '<svg><g><line x1="11" y1="8" x2="11" y2="14"></line></g><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>', 4194 action: "toggleZoom" 4195 }, 4196 iterateZoom: { 4197 icon: '<svg><g>
4197<line x1="11" y1="8" x2="11" y2="14"></line></g><circle cx="11" cy="11" r="7.5"/><path d="m21 21-4.35-4.35M8 11h6"/></svg>', 4198 action: "iterateZoom" 4199 }, 4200 rotateCCW: { 4201 icon: '<svg><path d="M15 4.55a8 8 0 0 0-6 14.9M9 15v5H4M18.37 7.16v.01M13 19.94v.01M16.84 18.37v.01M19.37 15.1v.01M19.94 11v.01"/></svg>', 4202 action: "rotateCCW" 4203 }, 4204 rotateCW: { 4205 icon: '<svg><path d="M9 4.55a8 8 0 0 1 6 14.9M15 15v5h5M5.63 7.16v.01M4.06 11v.01M4.63 15.1v.01M7.16 18.37v.01M11 19.94v.01"/></svg>', 4206 action: "rotateCW" 4207 }, 4208 flipX: { 4209 icon: '<svg style="stroke-width: 1.3"><path d="M12 3v18M16 7v10h5L16 7M8 7v10H3L8 7"/></svg>', 4210 action: "flipX" 4211 }, 4212 flipY: { 4213 icon: '<svg style="stroke-width: 1.3"><path d="M3 12h18M7 16h10L7 21v-5M7 8h10L7 3v5"/></svg>', 4214 action: "flipY" 4215 }, 4216 fitX: { 4217 icon: '<svg><path d="M4 12V6a2 2 0 0 1 2-2h12a2 2 0 0 1 2 2v6M10 18H3M21 18h-7M6 15l-3 3 3 3M18 15l3 3-3 3"/></svg>', 4218 action: "fitX" 4219 }, 4220 fitY: { 4221 icon: '<svg><path d="M12 20H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h6M18 14v7M18 3v7M15 18l3 3 3-3M15 6l3-3 3 3"/></svg>', 4222 action: "fitY" 4223 }, 4224 reset: { 4225 icon: '<svg><path d="M20 11A8.1 8.1 0 0 0 4.5 9M4 5v4h4M4 13a8.1 8.1 0 0 0 15.5 2m.5 4v-4h-4"/></svg>', 4226 action: "reset" 4227 }, 4228 toggleFS: { 4229 icon: '<svg><g><path d="M14.5 9.5 21 3m0 0h-6m6 0v6M3 21l6.5-6.5M3 21v-6m0 6h6"/></g><g><path d="m14 10 7-7m-7 7h6m-6 0V4M3 21l7-7m0 0v6m0-6H4"/></g></svg>', 4230 action: "toggleFS" 4231 } 4232 }; 4233 var Ut; 4234 ! function(t) { 4235 t[t.Init = 0] = "Init", t[t.Ready = 1] = "Ready", t[t.Disabled = 2] = "Disabled" 4236 }(Ut || (Ut = {})); 4237 const Gt = { 4238 absolute: "auto", 4239 display: { 4240 left: ["infobar"], 4241 middle: [], 4242 right: ["iterateZoom", "slideshow", "fullscreen", "thumbs", "close"] 4243 }, 4244 enabled: "auto", 4245 items: { 4246 infobar: { 4247 tpl: '<div class="fancybox__infobar" tabindex="-1"><span data-fancybox-current-index></span>/<span data-fancybox-count></span></div>' 4248 }, 4249 download: { 4250 tpl: '<a class="f-button" title="{{DOWNLOAD}}" data-fancybox-download href="javasript:;"><svg><path d="M4 17v2a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2M7 11l5 5 5-5M12 4v12"/></svg></a>' 4251 }, 4252 prev: { 4253 tpl: '<button class="f-button" title="{{PREV}}" data-fancybox-prev><svg><path d="m15 6-6 6 6 6"/></svg></button>' 4254 }, 4255 next: { 4256 tpl: '<button class="f-button" title="{{NEXT}}" data-fancybox-next><svg><path d="m9 6 6 6-6 6"/></svg></button>' 4257 }, 4258 slideshow: { 4259 tpl: '<button class="f-button" title="{{TOGGLE_SLIDESHOW}}" data-fancybox-toggle-slideshow><svg><g><path d="M8 4v16l13 -8z"></path></g><g><path d="M8 4v15M17 4v15"/></g></svg></button>' 4260 }, 4261 fullscreen: { 4262 tpl: '<button class="f-button" title="{{TOGGLE_FULLSCREEN}}" data-fancybox-toggle-fullscreen><svg><g><path d="M4 8V6a2 2 0 0 1 2-2h2M4 16v2a2 2 0 0 0 2 2h2M16 4h2a2 2 0 0 1 2 2v2M16 20h2a2 2 0 0 0 2-2v-2"/></g><g><path d="M15 19v-2a2 2 0 0 1 2-2h2M15 5v2a2 2 0 0 0 2 2h2M5 15h2a2 2 0 0 1 2 2v2M5 9h2a2 2 0 0 0 2-2V5"/></g></svg></button>' 4263 }, 4264 thumbs: { 4265 tpl: '<button class="f-button" title="{{TOGGLE_THUMBS}}" data-fancybox-toggle-thumbs><svg><circle cx="5.5" cy="5.5" r="1"/><circle cx="12" cy="5.5" r="1"/><circle cx="18.5" cy="5.5" r="1"/><circle cx="5.5" cy="12" r="1"/><circle cx="12" cy="12" r="1"/><circle cx="18.5" cy="12" r="1"/><circle cx="5.5" cy="18.5" r="1"/><circle cx="12" cy="18.5" r="1"/><circle cx="18.5" cy="18.5" r="1"/></svg></button>' 4266 }, 4267 close: { 4268 tpl: '<button class="f-button" title="{{CLOSE}}" data-fancybox-close><svg><path d="m19.5 4.5-15 15M4.5 4.5l15 15"/></svg></button>' 4269 } 4270 }, 4271 parentEl: null 4272 }, 4273 Kt = { 4274 tabindex: "-1", 4275 width: "24", 4276 height: "24",
vendor: 25,555 bytes, lines 4277-4809
4277 viewBox: "0 0 24 24", 4278 xmlns: "http://www.w3.org/2000/svg" 4279 }, 4280 Jt = "has-toolbar", 4281 Qt = "fancybox__toolbar"; 4282 class te extends $ { 4283 constructor() { 4284 super(...arguments), Object.defineProperty(this, "state", { 4285 enumerable: !0, 4286 configurable: !0, 4287 writable: !0, 4288 value: Ut.Init 4289 }), Object.defineProperty(this, "container", { 4290 enumerable: !0, 4291 configurable: !0, 4292 writable: !0, 4293 value: null 4294 }) 4295 } 4296 onReady(t) { 4297 var e; 4298 if (!t.carousel) return; 4299 let i = this.option("display"), 4300 n = this.option("absolute"), 4301 s = this.option("enabled"); 4302 if ("auto" === s) { 4303 const t = this.instance.carousel; 4304 let e = 0; 4305 if (t) 4306 for (const i of t.slides)(i.panzoom || "image" === i.type) && e++; 4307 e || (s = !1) 4308 } 4309 s || (i = void 0); 4310 let o = 0; 4311 const a = { 4312 left: [], 4313 middle: [], 4314 right: [] 4315 }; 4316 if (i) 4317 for (const t of ["left", "middle", "right"]) 4318 for (const n of i[t]) { 4319 const i = this.createEl(n); 4320 i && (null === (e = a[t]) || void 0 === e || e.push(i), o++) 4321 } 4322 let r = null; 4323 if (o && (r = this.createContainer()), r) { 4324 for (const [t, e] of Object.entries(a)) { 4325 const i = document.createElement("div"); 4326 C(i, Qt + "__column is-" + t); 4327 for (const t of e) i.appendChild(t); 4328 "auto" !== n || "middle" !== t || e.length || (n = !0), r.appendChild(i) 4329 }!0 === n && C(r, "is-absolute"), this.state = Ut.Ready, this.onRefresh() 4330 } else this.state = Ut.Disabled 4331 } 4332 onClick(t) { 4333 var e, i; 4334 const n = this.instance, 4335 s = n.getSlide(), 4336 o = null == s ? void 0 : s.panzoom, 4337 a = t.target, 4338 r = a && S(a) ? a.dataset : null; 4339 if (!r) return; 4340 if (void 0 !== r.fancyboxToggleThumbs) return t.preventDefault(), t.stopPropagation(), void(null === (e = n.plugins.Thumbs) || void 0 === e || e.toggle()); 4341 if (void 0 !== r.fancyboxToggleFullscreen) return t.preventDefault(), t.stopPropagation(), void this.instance.toggleFullscreen(); 4342 if (void 0 !== r.fancyboxToggleSlideshow) { 4343 t.preventDefault(), t.stopPropagation(); 4344 const e = null === (i = n.carousel) || void 0 === i ? void 0 : i.plugins.Autoplay; 4345 let s = e.isActive; 4346 return o && "mousemove" === o.panMode && !s && o.reset(), void(s ? e.stop() : e.start()) 4347 } 4348 const l = r.panzoomAction, 4349 c = r.panzoomChange; 4350 if ((c || l) && (t.preventDefault(), t.stopPropagation()), c) { 4351 let t = {}; 4352 try { 4353 t = JSON.parse(c) 4354 } catch (t) {} 4355 o && o.applyChange(t) 4356 } else l && o && o[l] && o[l]() 4357 } 4358 onChange() { 4359 this.onRefresh() 4360 } 4361 onRefresh() { 4362 if (this.instance.isClosing()) return; 4363 const t = this.container; 4364 if (!t) return; 4365 const e = this.instance.getSlide(); 4366 if (!e || e.state !== ct.Ready) return; 4367 const i = e && !e.error && e.panzoom; 4368 for (const e of t.querySelectorAll("[data-panzoom-action]")) i ? (e.removeAttribute("disabled"), e.removeAttribute("tabindex")) : (e.setAttribute("disabled", ""), e.setAttribute("tabindex", "-1")); 4369 let n = i && i.canZoomIn(), 4370 s = i && i.canZoomOut(); 4371 for (const e of t.querySelectorAll('[data-panzoom-action="zoomIn"]')) n ? (e.removeAttribute("disabled"), e.removeAttribute("tabindex")) : (e.setAttribute("disabled", ""), e.setAttribute("tabindex", "-1")); 4372 for (const e of t.querySelectorAll('[data-panzoom-action="zoomOut"]')) s ? (e.removeAttribute("disabled"), e.removeAttribute("tabindex")) : (e.setAttribute("disabled", ""), e.setAttribute("tabindex", "-1")); 4373 for (const e of t.querySelectorAll('[data-panzoom-action="toggleZoom"],[data-panzoom-action="iterateZoom"]')) { 4374 s || n ? (e.removeAttribute("disabled"), e.removeAttribute("tabindex")) : (e.setAttribute("disabled", ""), e.setAttribute("tabindex", "-1")); 4375 const t = e.querySelector("g"); 4376 t && (t.style.display = n ? "" : "none") 4377 } 4378 } 4379 onDone(t, e) { 4380 var i; 4381 null === (i = e.panzoom) || void 0 === i || i.on("afterTransform", (() => { 4382 this.instance.isCurrentSlide(e) && this.onRefresh() 4383 })), this.instance.isCurrentSlide(e) && this.onRefresh() 4384 } 4385 createContainer() { 4386 const t = this.instance.container; 4387 if (!t) return null; 4388 const e = this.option("parentEl") || t; 4389 let i = e.querySelector("." + Qt); 4390 return i || (i = document.createElement("div"), C(i, Qt), e.prepend(i)), i.addEventListener("click", this.onClick, { 4391 passive: !1, 4392 capture: !0 4393 }), t && C(t, Jt), this.container = i, i 4394 } 4395 createEl(t) { 4396 const e = this.instance, 4397 i = e.carousel; 4398 if (!i) return null; 4399 if ("toggleFS" === t) return null; 4400 if ("fullscreen" === t && !at()) return null; 4401 let n = null; 4402 const o = i.slides.length || 0; 4403 let a = 0, 4404 r = 0; 4405 for (const t of i.slides)(t.panzoom || "image" === t.type) && a++, ("image" === t.type || t.downloadSrc) && r++; 4406 if (o < 2 && ["infobar", "prev", "next"].includes(t)) return n; 4407 if (void 0 !== Zt[t] && !a) return null; 4408 if ("download" === t && !r) return null; 4409 if ("thumbs" === t) { 4410 const t = e.plugins.Thumbs; 4411 if (!t || !t.isEnabled) return null 4412 } 4413 if ("slideshow" === t) { 4414 if (!i.plugins.Autoplay || o < 2) return null 4415 } 4416 if (void 0 !== Zt[t]) { 4417 const e = Zt[t]; 4418 n = document.createElement("button"), n.setAttribute("title", this.instance.localize(`{{${t.toUpperCase()}}}`)), C(n, "f-button"), e.action && (n.dataset.panzoomAction = e.action), e.change && (n.dataset.panzoomChange = JSON.stringify(e.change)), n.appendChild(s(this.instance.localize(e.icon))) 4419 } else { 4420 const e = (this.option("items") || [])[t]; 4421 e && (n = s(this.instance.localize(e.tpl)), "function" == typeof e.click && n.addEventListener("click", (t => { 4422 t.preventDefault(), t.stopPropagation(), "function" == typeof e.click && e.click.call(this, this, t) 4423 }))) 4424 } 4425 const l = null == n ? void 0 : n.querySelector("svg"); 4426 if (l) 4427 for (const [t, e] of Object.entries(Kt)) l.getAttribute(t) || l.setAttribute(t, String(e)); 4428 return n 4429 } 4430 removeContainer() { 4431 const t = this.container; 4432 t && t.remove(), this.container = null, this.state = Ut.Disabled; 4433 const e = this.instance.container; 4434 e && P(e, Jt) 4435 } 4436 attach() { 4437 const t = this, 4438 e = t.instance; 4439 e.on("Carousel.initSlides", t.onReady), e.on("done", t.onDone), e.on(["reveal", "Carousel.change"], t.onChange), t.onReady(t.instance) 4440 } 4441 detach() { 4442 const t = this, 4443 e = t.instance; 4444 e.off("Carousel.initSlides", t.onReady), e.off("done", t.onDone), e.off(["reveal", "Carousel.change"], t.onChange), t.removeContainer() 4445 } 4446 } 4447 Object.defineProperty(te, "defaults", { 4448 enumerable: !0, 4449 configurable: !0, 4450 writable: !0, 4451 value: Gt 4452 }); 4453 const ee = { 4454 Hash: class extends $ { 4455 onReady() { 4456 dt = !1 4457 } 4458 onChange(t) { 4459 pt && clearTimeout(pt); 4460 const { 4461 hash: e 4462 } = ft(), { 4463 hash: i 4464 } = gt(), n = t.isOpeningSlide(t.getSlide()); 4465 n && (ht = i === e ? "" : i), e && e !== i && (pt = setTimeout((() => { 4466 try { 4467 if (t.state === lt.Ready) { 4468 let t = "replaceState"; 4469 n && !ut && (t = "pushState", ut = !0), window.history[t]({}, document.title, window.location.pathname + window.location.search + e) 4470 } 4471 } catch (t) {} 4472 }), 300)) 4473 } 4474 onClose(t) { 4475 if (pt && clearTimeout(pt), !dt && ut) return ut = !1, dt = !1, void window.history.back(); 4476 if (!dt) try { 4477 window.history.replaceState({}, document.title, window.location.pathname + window.location.search + (ht || "")) 4478 } catch (t) {} 4479 } 4480 attach() { 4481 const t = this.instance; 4482 t.on("ready", this.onReady), t.on(["Carousel.ready", "Carousel.change"], this.onChange), t.on("close", this.onClose) 4483 } 4484 detach() { 4485 const t = this.instance; 4486 t.off("ready", this.onReady), t.off(["Carousel.ready", "Carousel.change"], this.onChange), t.off("close", this.onClose) 4487 } 4488 static parseURL() { 4489 return gt() 4490 } 4491 static startFromUrl() { 4492 mt() 4493 } 4494 static destroy() { 4495 window.removeEventListener("hashchange", bt, !1) 4496 } 4497 }, 4498 Html: zt, 4499 Images: xt, 4500 Slideshow: Ft, 4501 Thumbs: Vt, 4502 Toolbar: te 4503 }, 4504 ie = "with-fancybox", 4505 ne = "hide-scrollbar", 4506 se = "--fancybox-scrollbar-compensate", 4507 oe = "--fancybox-body-margin", 4508 ae = "aria-hidden", 4509 re = "is-using-tab", 4510 le = "is-animated", 4511 ce = "is-compact", 4512 he = "is-loading", 4513 de = "is-opening", 4514 ue = "has-caption", 4515 pe = "disabled", 4516 fe = "tabindex", 4517 ge = "download", 4518 me = "href", 4519 ve = "src", 4520 be = t => "string" == typeof t, 4521 ye = function() { 4522 var t = window.getSelection(); 4523 return !!t && "Range" === t.type 4524 }; 4525 let we, xe = null, 4526 Ee = null, 4527 Se = 0, 4528 Pe = 0, 4529 Ce = 0, 4530 Te = 0; 4531 const Me = new Map; 4532 let Oe = 0; 4533 class Ae extends m { 4534 get isIdle() { 4535 return this.idle 4536 } 4537 get isCompact() { 4538 return this.option("compact") 4539 } 4540 constructor(t = [], e = {}, i = {}) { 4541 super(e), Object.defineProperty(this, "userSlides", { 4542 enumerable: !0, 4543 configurable: !0, 4544 writable: !0, 4545 value: [] 4546 }), Object.defineProperty(this, "userPlugins", { 4547 enumerable: !0, 4548 configurable: !0, 4549 writable: !0, 4550 value: {} 4551 }), Object.defineProperty(this, "idle", { 4552 enumerable: !0, 4553 configurable: !0, 4554 writable: !0, 4555 value: !1 4556 }), Object.defineProperty(this, "idleTimer", { 4557 enumerable: !0, 4558 configurable: !0, 4559 writable: !0, 4560 value: null 4561 }), Object.defineProperty(this, "clickTimer", { 4562 enumerable: !0, 4563 configurable: !0, 4564 writable: !0, 4565 value: null 4566 }), Object.defineProperty(this, "pwt", { 4567 enumerable: !0, 4568 configurable: !0, 4569 writable: !0, 4570 value: 0 4571 }), Object.defineProperty(this, "ignoreFocusChange", { 4572 enumerable: !0, 4573 configurable: !0, 4574 writable: !0, 4575 value: !1 4576 }), Object.defineProperty(this, "startedFs", { 4577 enumerable: !0, 4578 configurable: !0, 4579 writable: !0, 4580 value: !1 4581 }), Object.defineProperty(this, "state", { 4582 enumerable: !0, 4583 configurable: !0, 4584 writable: !0, 4585 value: lt.Init 4586 }), Object.defineProperty(this, "id", { 4587 enumerable: !0, 4588 configurable: !0, 4589 writable: !0, 4590 value: 0 4591 }), Object.defineProperty(this, "container", { 4592 enumerable: !0, 4593 configurable: !0, 4594 writable: !0, 4595 value: null 4596 }), Object.defineProperty(this, "caption", { 4597 enumerable: !0, 4598 configurable: !0, 4599 writable: !0, 4600 value: null 4601 }), Object.defineProperty(this, "footer", { 4602 enumerable: !0, 4603 configurable: !0, 4604 writable: !0, 4605 value: null 4606 }), Object.defineProperty(this, "carousel", { 4607 enumerable: !0, 4608 configurable: !0, 4609 writable: !0, 4610 value: null 4611 }), Object.defineProperty(this, "lastFocus", { 4612 enumerable: !0, 4613 configurable: !0, 4614 writable: !0, 4615 value: null 4616 }), Object.defineProperty(this, "prevMouseMoveEvent", { 4617 enumerable: !0, 4618 configurable: !0, 4619 writable: !0, 4620 value: void 0 4621 }), we || (we = at()), this.id = e.id || ++Oe, Me.set(this.id, this), this.userSlides = t, this.userPlugins = i, queueMicrotask((() => { 4622 this.init() 4623 })) 4624 } 4625 init() { 4626 if (this.state === lt.Destroy) return; 4627 this.state = lt.Init, this.attachPlugins(Object.assign(Object.assign({}, Ae.Plugins), this.userPlugins)), this.emit("init"), this.emit("attachPlugins"), !0 === this.option("hideScrollbar") && (() => { 4628 if (!it) return; 4629 const t = document, 4630 e = t.body, 4631 i = t.documentElement; 4632 if (e.classList.contains(ne)) return; 4633 let n = window.innerWidth - i.getBoundingClientRect().width; 4634 const s = parseFloat(window.getComputedStyle(e).marginRight); 4635 n < 0 && (n = 0), i.style.setProperty(se, `${n}px`), s && e.style.setProperty(oe, `${s}px`), e.classList.add(ne) 4636 })(), this.initLayout(), this.scale(); 4637 const t = () => { 4638 this.initCarousel(this.userSlides), this.state = lt.Ready, this.attachEvents(), this.emit("ready"), setTimeout((() => { 4639 this.container && this.container.setAttribute(ae, "false") 4640 }), 16) 4641 }; 4642 this.option("Fullscreen.autoStart") && we && !we.isFullscreen() ? we.request().then((() => { 4643 this.startedFs = !0, t() 4644 })).catch((() => t())) : t() 4645 } 4646 initLayout() { 4647 var t, e; 4648 const i = this.option("parentEl") || document.body, 4649 n = s(this.localize(this.option("tpl.main") || "")); 4650 if (n) { 4651 if (n.setAttribute("id", `fancybox-${this.id}`), n.setAttribute("aria-label", this.localize("{{MODAL}}")), n.classList.toggle(ce, this.isCompact), C(n, this.option("mainClass") || ""), C(n, de), this.container = n, this.footer = n.querySelector(".fancybox__footer"), i.appendChild(n), C(document.documentElement, ie), xe && Ee || (xe = document.createElement("span"), C(xe, "fancybox-focus-guard"), xe.setAttribute(fe, "0"), xe.setAttribute(ae, "true"), xe.setAttribute("aria-label", "Focus guard"), Ee = xe.cloneNode(), null === (t = n.parentElement) || void 0 === t || t.insertBefore(xe, n), null === (e = n.parentElement) || void 0 === e || e.append(Ee)), n.addEventListener("mousedown", (t => { 4652 Se = t.pageX, Pe = t.pageY, P(n, re) 4653 })), this.option("closeExisting")) 4654 for (const t of Me.values()) t.id !== this.id && t.close(); 4655 else this.option("animated") && (C(n, le), setTimeout((() => { 4656 this.isClosing() || P(n, le) 4657 }), 350)); 4658 this.emit("initLayout") 4659 } 4660 } 4661 initCarousel(t) { 4662 const e = this.container; 4663 if (!e) return; 4664 const n = e.querySelector(".fancybox__carousel"); 4665 if (!n) return; 4666 const s = this.carousel = new tt(n, p({}, { 4667 slides: t, 4668 transition: "fade", 4669 Panzoom: { 4670 lockAxis: this.option("dragToClose") ? "xy" : "x", 4671 infinite: !!this.option("dragToClose") && "y" 4672 }, 4673 Dots: !1, 4674 Navigation: { 4675 classes: { 4676 container: "fancybox__nav", 4677 button: "f-button", 4678 isNext: "is-next", 4679 isPrev: "is-prev" 4680 } 4681 }, 4682 initialPage: this.option("startIndex"), 4683 l10n: this.option("l10n") 4684 }, this.option("Carousel") || {})); 4685 s.on("*", ((t, e, ...i) => { 4686 this.emit(`Carousel.${e}`, t, ...i) 4687 })), s.on(["ready", "change"], (() => { 4688 this.manageCaption() 4689 })), this.on("Carousel.removeSlide", ((t, e, i) => { 4690 this.clearContent(i), i.state = void 0 4691 })), s.on("Panzoom.touchStart", (() => { 4692 var t, e; 4693 this.isCompact || this.endIdle(), (null === (t = document.activeElement) || void 0 === t ? void 0 : t.closest(".f-thumbs")) && (null === (e = this.container) || void 0 === e || e.focus()) 4694 })), s.on("settle", (() => { 4695 this.idleTimer || this.isCompact || !this.option("idle") || this.setIdle(), this.option("autoFocus") && !this.isClosing && this.checkFocus() 4696 })), this.option("dragToClose") && (s.on("Panzoom.afterTransform", ((t, e) => { 4697 const n = this.getSlide(); 4698 if (n && i(n.el)) return; 4699 const s = this.container; 4700 if (s) { 4701 const t = Math.abs(e.current.f), 4702 i = t < 1 ? "" : Math.max(.5, Math.min(1, 1 - t / e.contentRect.fitHeight * 1.5)); 4703 s.style.setProperty("--fancybox-ts", i ? "0s" : ""), s.style.setProperty("--fancybox-opacity", i + "") 4704 } 4705 })), s.on("Panzoom.touchEnd", ((t, e, n) => { 4706 var s; 4707 const o = this.getSlide(); 4708 if (o && i(o.el)) return; 4709 if (e.isMobile && document.activeElement && -1 !== ["TEXTAREA", "INPUT"].indexOf(null === (s = document.activeElement) || void 0 === s ? void 0 : s.nodeName)) return; 4710 const a = Math.abs(e.dragOffset.y); 4711 "y" === e.lockedAxis && (a >= 200 || a >= 50 && e.dragOffset.time < 300) && (n && n.cancelable && n.preventDefault(), this.close(n, "f-throwOut" + (e.current.f < 0 ? "Up" : "Down"))) 4712 }))), s.on("change", (t => { 4713 var e; 4714 let i = null === (e = this.getSlide()) || void 0 === e ? void 0 : e.triggerEl; 4715 if (i) { 4716 const e = new CustomEvent("slideTo", { 4717 bubbles: !0, 4718 cancelable: !0, 4719 detail: t.page 4720 }); 4721 i.dispatchEvent(e) 4722 } 4723 })), s.on(["refresh", "change"], (t => { 4724 const e = this.container; 4725 if (!e) return; 4726 for (const i of e.querySelectorAll("[data-fancybox-current-index]")) i.innerHTML = t.page + 1; 4727 for (const i of e.querySelectorAll("[data-fancybox-count]")) i.innerHTML = t.pages.length; 4728 if (!t.isInfinite) { 4729 for (const i of e.querySelectorAll("[data-fancybox-next]")) t.page < t.pages.length - 1 ? (i.removeAttribute(pe), i.removeAttribute(fe)) : (i.setAttribute(pe, ""), i.setAttribute(fe, "-1")); 4730 for (const i of e.querySelectorAll("[data-fancybox-prev]")) t.page > 0 ? (i.removeAttribute(pe), i.removeAttribute(fe)) : (i.setAttribute(pe, ""), i.setAttribute(fe, "-1")) 4731 } 4732 const i = this.getSlide(); 4733 if (!i) return; 4734 let n = i.downloadSrc || ""; 4735 n || "image" !== i.type || i.error || !be(i[ve]) || (n = i[ve]); 4736 for (const t of e.querySelectorAll("[data-fancybox-download]")) { 4737 const e = i.downloadFilename; 4738 n ? (t.removeAttribute(pe), t.removeAttribute(fe), t.setAttribute(me, n), t.setAttribute(ge, e || n), t.setAttribute("target", "_blank")) : (t.setAttribute(pe, ""), t.setAttribute(fe, "-1"), t.removeAttribute(me), t.removeAttribute(ge)) 4739 } 4740 })), this.emit("initCarousel") 4741 } 4742 attachEvents() { 4743 const t = this, 4744 e = t.container; 4745 if (!e) return; 4746 e.addEventListener("click", t.onClick, { 4747 passive: !1, 4748 capture: !1 4749 }), e.addEventListener("wheel", t.onWheel, { 4750 passive: !1, 4751 capture: !1 4752 }), document.addEventListener("keydown", t.onKeydown, { 4753 passive: !1, 4754 capture: !0 4755 }), document.addEventListener("visibilitychange", t.onVisibilityChange, !1), document.addEventListener("mousemove", t.onMousemove), t.option("trapFocus") && document.addEventListener("focus", t.onFocus, !0), window.addEventListener("resize", t.onResize); 4756 const i = window.visualViewport; 4757 i && (i.addEventListener("scroll", t.onResize), i.addEventListener("resize", t.onResize)) 4758 } 4759 detachEvents() { 4760 const t = this, 4761 e = t.container; 4762 if (!e) return; 4763 document.removeEventListener("keydown", t.onKeydown, { 4764 passive: !1, 4765 capture: !0 4766 }), e.removeEventListener("wheel", t.onWheel, { 4767 passive: !1, 4768 capture: !1 4769 }), e.removeEventListener("click", t.onClick, { 4770 passive: !1, 4771 capture: !1 4772 }), document.removeEventListener("mousemove", t.onMousemove), window.removeEventListener("resize", t.onResize); 4773 const i = window.visualViewport; 4774 i && (i.removeEventListener("resize", t.onResize), i.removeEventListener("scroll", t.onResize)), document.removeEventListener("visibilitychange", t.onVisibilityChange, !1), document.removeEventListener("focus", t.onFocus, !0) 4775 } 4776 scale() { 4777 const t = this.container; 4778 if (!t) return; 4779 const e = window.visualViewport, 4780 i = Math.max(1, (null == e ? void 0 : e.scale) || 1); 4781 let n = "", 4782 s = "", 4783 o = ""; 4784 if (e && i > 1) { 4785 let t = `${e.offsetLeft}px`, 4786 a = `${e.offsetTop}px`; 4787 n = e.width * i + "px", s = e.height * i + "px", o = `translate3d(${t}, ${a}, 0) scale(${1/i})` 4788 } 4789 t.style.transform = o, t.style.width = n, t.style.height = s 4790 } 4791 onClick(t) { 4792 var e; 4793 const { 4794 container: i, 4795 isCompact: n 4796 } = this; 4797 if (!i || this.isClosing()) return; 4798 !n && this.option("idle") && this.resetIdle(); 4799 const s = t.composedPath()[0]; 4800 if (s.closest(".fancybox-spinner") || s.closest("[data-fancybox-close]")) return t.preventDefault(), void this.close(t); 4801 if (s.closest("[data-fancybox-prev]")) return t.preventDefault(), void this.prev(); 4802 if (s.closest("[data-fancybox-next]")) return t.preventDefault(), void this.next(); 4803 if ("click" === t.type && 0 === t.detail) return; 4804 if (Math.abs(t.pageX - Se) > 30 || Math.abs(t.pageY - Pe) > 30) return; 4805 const o = document.activeElement; 4806 if (ye() && o && i.contains(o)) return; 4807 if (n && "image" === (null === (e = this.getSlide()) || void 0 === e ? void 0 : e.type)) return void(this.clickTimer ? (clearTimeout(this.clickTimer), this.clickTimer = null) : this.clickTimer = setTimeout((() => { 4808 this.toggleIdle(), this.clickTimer = null 4809 }), 350));
vendor: 9,567 bytes, lines 4810-4992
4810 if (this.emit("click", t), t.defaultPrevented) return; 4811 let a = !1; 4812 if (s.closest(".fancybox__content")) { 4813 if (o) { 4814 if (o.closest("[contenteditable]")) return; 4815 s.matches(st) || o.blur() 4816 } 4817 if (ye()) return; 4818 a = this.option("contentClick") 4819 } else s.closest(".fancybox__carousel") && !s.matches(st) && (a = this.option("backdropClick")); 4820 "close" === a ? (t.preventDefault(), this.close(t)) : "next" === a ? (t.preventDefault(), this.next()) : "prev" === a && (t.preventDefault(), this.prev()) 4821 } 4822 onWheel(t) { 4823 const e = t.target; 4824 let i = this.option("wheel", t); 4825 e.closest(".fancybox__thumbs") && (i = "slide"); 4826 const s = "slide" === i, 4827 o = [-t.deltaX || 0, -t.deltaY || 0, -t.detail || 0].reduce((function(t, e) { 4828 return Math.abs(e) > Math.abs(t) ? e : t 4829 })), 4830 a = Math.max(-1, Math.min(1, o)), 4831 r = Date.now(); 4832 this.pwt && r - this.pwt < 300 ? s && t.preventDefault() : (this.pwt = r, this.emit("wheel", t, a), t.defaultPrevented || ("close" === i ? (t.preventDefault(), this.close(t)) : "slide" === i && (n(e) || (t.preventDefault(), this[a > 0 ? "prev" : "next"]())))) 4833 } 4834 onScroll() { 4835 window.scrollTo(Ce, Te) 4836 } 4837 onKeydown(t) { 4838 if (!this.isTopmost()) return; 4839 this.isCompact || !this.option("idle") || this.isClosing() || this.resetIdle(); 4840 const e = t.key, 4841 i = this.option("keyboard"); 4842 if (!i) return; 4843 const n = t.composedPath()[0], 4844 s = document.activeElement && document.activeElement.classList, 4845 o = s && s.contains("f-button") || n.dataset.carouselPage || n.dataset.carouselIndex; 4846 if ("Escape" !== e && !o && S(n)) { 4847 if (n.isContentEditable || -1 !== ["TEXTAREA", "OPTION", "INPUT", "SELECT", "VIDEO"].indexOf(n.nodeName)) return 4848 } 4849 if ("Tab" === t.key ? C(this.container, re) : P(this.container, re), t.ctrlKey || t.altKey || t.shiftKey) return; 4850 this.emit("keydown", e, t); 4851 const a = i[e]; 4852 a && "function" == typeof this[a] && (t.preventDefault(), this[a]()) 4853 } 4854 onResize() { 4855 const t = this.container; 4856 if (!t) return; 4857 const e = this.isCompact; 4858 t.classList.toggle(ce, e), this.manageCaption(this.getSlide()), this.isCompact ? this.clearIdle() : this.endIdle(), this.scale(), this.emit("resize") 4859 } 4860 onFocus(t) { 4861 this.isTopmost() && this.checkFocus(t) 4862 } 4863 onMousemove(t) { 4864 this.prevMouseMoveEvent = t, !this.isCompact && this.option("idle") && this.resetIdle() 4865 } 4866 onVisibilityChange() { 4867 "visible" === document.visibilityState ? this.checkFocus() : this.endIdle() 4868 } 4869 manageCloseBtn(t) { 4870 const e = this.optionFor(t, "closeButton") || !1; 4871 if ("auto" === e) { 4872 const t = this.plugins.Toolbar; 4873 if (t && t.state === Ut.Ready) return 4874 } 4875 if (!e) return; 4876 if (!t.contentEl || t.closeBtnEl) return; 4877 const i = this.option("tpl.closeButton"); 4878 if (i) { 4879 const e = s(this.localize(i)); 4880 t.closeBtnEl = t.contentEl.appendChild(e), t.el && C(t.el, "has-close-btn") 4881 } 4882 } 4883 manageCaption(t = void 0) { 4884 var e, i; 4885 const n = "fancybox__caption", 4886 s = this.container; 4887 if (!s) return; 4888 P(s, ue); 4889 const o = this.isCompact || this.option("commonCaption"), 4890 a = !o; 4891 if (this.caption && this.stop(this.caption), a && this.caption && (this.caption.remove(), this.caption = null), o && !this.caption) 4892 for (const t of (null === (e = this.carousel) || void 0 === e ? void 0 : e.slides) || []) t.captionEl && (t.captionEl.remove(), t.captionEl = void 0, P(t.el, ue), null === (i = t.el) || void 0 === i || i.removeAttribute("aria-labelledby")); 4893 if (t || (t = this.getSlide()), !t || o && !this.isCurrentSlide(t)) return; 4894 const r = t.el; 4895 let l = this.optionFor(t, "caption", ""); 4896 if (!l) return void(o && this.caption && this.animate(this.caption, "f-fadeOut", (() => { 4897 this.caption && (this.caption.innerHTML = "") 4898 }))); 4899 let c = null; 4900 if (a) { 4901 if (c = t.captionEl || null, r && !c) { 4902 const e = n + `_${this.id}_${t.index}`; 4903 c = document.createElement("div"), C(c, n), c.setAttribute("id", e), t.captionEl = r.appendChild(c), C(r, ue), r.setAttribute("aria-labelledby", e) 4904 } 4905 } else { 4906 if (c = this.caption, c || (c = s.querySelector("." + n)), !c) { 4907 c = document.createElement("div"), c.dataset.fancyboxCaption = "", C(c, n); 4908 (this.footer || s).prepend(c) 4909 } 4910 C(s, ue), this.caption = c 4911 } 4912 c && (c.innerHTML = "", be(l) || "number" == typeof l ? c.innerHTML = l + "" : l instanceof HTMLElement && c.appendChild(l)) 4913 } 4914 checkFocus(t) { 4915 this.focus(t) 4916 } 4917 focus(t) { 4918 var e; 4919 if (this.ignoreFocusChange) return; 4920 const i = document.activeElement || null, 4921 n = (null == t ? void 0 : t.target) || null, 4922 s = this.container, 4923 o = null === (e = this.carousel) || void 0 === e ? void 0 : e.viewport; 4924 if (!s || !o) return; 4925 if (!t && i && s.contains(i)) return; 4926 const a = this.getSlide(), 4927 r = a && a.state === ct.Ready ? a.el : null; 4928 if (!r || r.contains(i) || s === i) return; 4929 t && t.cancelable && t.preventDefault(), this.ignoreFocusChange = !0; 4930 const l = Array.from(s.querySelectorAll(st)); 4931 let c = [], 4932 h = null; 4933 for (let t of l) { 4934 const e = !t.offsetParent || !!t.closest('[aria-hidden="true"]'), 4935 i = r && r.contains(t), 4936 n = !o.contains(t); 4937 if (t === s || (i || n) && !e) { 4938 c.push(t); 4939 const e = t.dataset.origTabindex; 4940 void 0 !== e && e && (t.tabIndex = parseFloat(e)), t.removeAttribute("data-orig-tabindex"), !t.hasAttribute("autoFocus") && h || (h = t) 4941 } else { 4942 const e = void 0 === t.dataset.origTabindex ? t.getAttribute("tabindex") || "" : t.dataset.origTabindex; 4943 e && (t.dataset.origTabindex = e), t.tabIndex = -1 4944 } 4945 } 4946 let d = null; 4947 t ? (!n || c.indexOf(n) < 0) && (d = h || s, c.length && (i === Ee ? d = c[0] : this.lastFocus !== s && i !== xe || (d = c[c.length - 1]))) : d = a && "image" === a.type ? s : h || s, d && ot(d), this.lastFocus = document.activeElement, this.ignoreFocusChange = !1 4948 } 4949 next() { 4950 const t = this.carousel; 4951 t && t.pages.length > 1 && t.slideNext() 4952 } 4953 prev() { 4954 const t = this.carousel; 4955 t && t.pages.length > 1 && t.slidePrev() 4956 } 4957 jumpTo(...t) { 4958 this.carousel && this.carousel.slideTo(...t) 4959 } 4960 isTopmost() { 4961 var t; 4962 return (null === (t = Ae.getInstance()) || void 0 === t ? void 0 : t.id) == this.id 4963 } 4964 animate(t = null, e = "", i) { 4965 if (!t || !e) return void(i && i()); 4966 this.stop(t); 4967 const n = s => { 4968 s.target === t && t.dataset.animationName && (t.removeEventListener("animationend", n), delete t.dataset.animationName, i && i(), P(t, e)) 4969 }; 4970 t.dataset.animationName = e, t.addEventListener("animationend", n), C(t, e) 4971 } 4972 stop(t) { 4973 t && t.dispatchEvent(new CustomEvent("animationend", { 4974 bubbles: !1, 4975 cancelable: !0, 4976 currentTarget: t 4977 })) 4978 } 4979 setContent(t, e = "", i = !0) { 4980 if (this.isClosing()) return; 4981 const n = t.el; 4982 if (!n) return; 4983 let o = null; 4984 if (S(e) ? o = e : (o = s(e + ""), S(o) || (o = document.createElement("div"), o.innerHTML = e + "")), ["img", "picture", "iframe", "video", "audio"].includes(o.nodeName.toLowerCase())) { 4985 const t = document.createElement("div"); 4986 t.appendChild(o), o = t 4987 } 4988 S(o) && t.filter && !t.error && (o = o.querySelector(t.filter)), o && S(o) ? (C(o, "fancybox__content"), t.id && o.setAttribute("id", t.id), n.classList.add(`has-${t.error?"error":t.type||"unknown"}`), n.prepend(o), "none" === o.style.display && (o.style.display = ""), "none" === getComputedStyle(o).getPropertyValue("display") && (o.style.display = t.display || this.option("defaultDisplay") || "flex"), t.contentEl = o, i && this.revealContent(t), this.manageCloseBtn(t), this.manageCaption(t)) : this.setError(t, "{{ELEMENT_NOT_FOUND}}") 4989 } 4990 revealContent(t, e) { 4991 const i = t.el, 4992 n = t.contentEl;
vendor: 13,037 bytes, lines 4993-5267
4993 i && n && (this.emit("reveal", t), this.hideLoading(t), t.state = ct.Opening, (e = this.isOpeningSlide(t) ? void 0 === e ? this.optionFor(t, "showClass") : e : "f-fadeIn") ? this.animate(n, e, (() => { 4994 this.done(t) 4995 })) : this.done(t)) 4996 } 4997 done(t) { 4998 this.isClosing() || (t.state = ct.Ready, this.emit("done", t), C(t.el, "is-done"), this.isCurrentSlide(t) && this.option("autoFocus") && queueMicrotask((() => { 4999 var e; 5000 null === (e = t.panzoom) || void 0 === e || e.updateControls(), this.option("autoFocus") && this.focus() 5001 })), this.isOpeningSlide(t) && (P(this.container, de), !this.isCompact && this.option("idle") && this.setIdle())) 5002 } 5003 isCurrentSlide(t) { 5004 const e = this.getSlide(); 5005 return !(!t || !e) && e.index === t.index 5006 } 5007 isOpeningSlide(t) { 5008 var e, i; 5009 return null === (null === (e = this.carousel) || void 0 === e ? void 0 : e.prevPage) && t && t.index === (null === (i = this.getSlide()) || void 0 === i ? void 0 : i.index) 5010 } 5011 showLoading(t) { 5012 t.state = ct.Loading; 5013 const e = t.el; 5014 if (!e) return; 5015 C(e, he), this.emit("loading", t), t.spinnerEl || setTimeout((() => { 5016 if (!this.isClosing() && !t.spinnerEl && t.state === ct.Loading) { 5017 let i = s(E); 5018 C(i, "fancybox-spinner"), t.spinnerEl = i, e.prepend(i), this.animate(i, "f-fadeIn") 5019 } 5020 }), 250) 5021 } 5022 hideLoading(t) { 5023 const e = t.el; 5024 if (!e) return; 5025 const i = t.spinnerEl; 5026 this.isClosing() ? null == i || i.remove() : (P(e, he), i && this.animate(i, "f-fadeOut", (() => { 5027 i.remove() 5028 })), t.state === ct.Loading && (this.emit("loaded", t), t.state = ct.Ready)) 5029 } 5030 setError(t, e) { 5031 if (this.isClosing()) return; 5032 const i = new Event("error", { 5033 bubbles: !0, 5034 cancelable: !0 5035 }); 5036 if (this.emit("error", i, t), i.defaultPrevented) return; 5037 t.error = e, this.hideLoading(t), this.clearContent(t); 5038 const n = document.createElement("div"); 5039 n.classList.add("fancybox-error"), n.innerHTML = this.localize(e || "<p>{{ERROR}}</p>"), this.setContent(t, n) 5040 } 5041 clearContent(t) { 5042 if (void 0 === t.state) return; 5043 this.emit("clearContent", t), t.contentEl && (t.contentEl.remove(), t.contentEl = void 0); 5044 const e = t.el; 5045 e && (P(e, "has-error"), P(e, "has-unknown"), P(e, `has-${t.type||"unknown"}`)), t.closeBtnEl && t.closeBtnEl.remove(), t.closeBtnEl = void 0, t.captionEl && t.captionEl.remove(), t.captionEl = void 0, t.spinnerEl && t.spinnerEl.remove(), t.spinnerEl = void 0 5046 } 5047 getSlide() { 5048 var t; 5049 const e = this.carousel; 5050 return (null === (t = null == e ? void 0 : e.pages[null == e ? void 0 : e.page]) || void 0 === t ? void 0 : t.slides[0]) || void 0 5051 } 5052 close(t, e) { 5053 if (this.isClosing()) return; 5054 const i = new Event("shouldClose", { 5055 bubbles: !0, 5056 cancelable: !0 5057 }); 5058 if (this.emit("shouldClose", i, t), i.defaultPrevented) return; 5059 t && t.cancelable && (t.preventDefault(), t.stopPropagation()); 5060 const n = () => { 5061 this.proceedClose(t, e) 5062 }; 5063 this.startedFs && we && we.isFullscreen() ? Promise.resolve(we.exit()).then((() => n())) : n() 5064 } 5065 clearIdle() { 5066 this.idleTimer && clearTimeout(this.idleTimer), this.idleTimer = null 5067 } 5068 setIdle(t = !1) { 5069 const e = () => { 5070 this.clearIdle(), this.idle = !0, C(this.container, "is-idle"), this.emit("setIdle") 5071 }; 5072 if (this.clearIdle(), !this.isClosing()) 5073 if (t) e(); 5074 else { 5075 const t = this.option("idle"); 5076 t && (this.idleTimer = setTimeout(e, t)) 5077 } 5078 } 5079 endIdle() { 5080 this.clearIdle(), this.idle && !this.isClosing() && (this.idle = !1, P(this.container, "is-idle"), this.emit("endIdle")) 5081 } 5082 resetIdle() { 5083 this.endIdle(), this.setIdle() 5084 } 5085 toggleIdle() { 5086 this.idle ? this.endIdle() : this.setIdle(!0) 5087 } 5088 toggleFullscreen() { 5089 we && (we.isFullscreen() ? we.exit() : we.request().then((() => { 5090 this.startedFs = !0 5091 }))) 5092 } 5093 isClosing() { 5094 return [lt.Closing, lt.CustomClosing, lt.Destroy].includes(this.state) 5095 } 5096 proceedClose(t, e) { 5097 var i, n; 5098 this.state = lt.Closing, this.clearIdle(), this.detachEvents(); 5099 const s = this.container, 5100 o = this.carousel, 5101 a = this.getSlide(), 5102 r = a && this.option("placeFocusBack") ? a.triggerEl || this.option("triggerEl") : null; 5103 if (r && (et(r) ? ot(r) : r.focus()), s && (P(s, de), C(s, "is-closing"), s.setAttribute(ae, "true"), this.option("animated") && C(s, le), s.style.pointerEvents = "none"), o) { 5104 o.clearTransitions(), null === (i = o.panzoom) || void 0 === i || i.destroy(), null === (n = o.plugins.Navigation) || void 0 === n || n.detach(); 5105 for (const t of o.slides) { 5106 t.state = ct.Closing, this.hideLoading(t); 5107 const e = t.contentEl; 5108 e && this.stop(e); 5109 const i = null == t ? void 0 : t.panzoom; 5110 i && (i.stop(), i.detachEvents(), i.detachObserver()), this.isCurrentSlide(t) || o.emit("removeSlide", t) 5111 } 5112 } 5113 Ce = window.scrollX, Te = window.scrollY, window.addEventListener("scroll", this.onScroll), this.emit("close", t), this.state !== lt.CustomClosing ? (void 0 === e && a && (e = this.optionFor(a, "hideClass")), e && a ? (this.animate(a.contentEl, e, (() => { 5114 o && o.emit("removeSlide", a) 5115 })), setTimeout((() => { 5116 this.destroy() 5117 }), 500)) : this.destroy()) : setTimeout((() => { 5118 this.destroy() 5119 }), 500) 5120 } 5121 destroy() { 5122 var t; 5123 if (this.state === lt.Destroy) return; 5124 window.removeEventListener("scroll", this.onScroll), this.state = lt.Destroy, null === (t = this.carousel) || void 0 === t || t.destroy(); 5125 const e = this.container; 5126 e && e.remove(), Me.delete(this.id); 5127 const i = Ae.getInstance(); 5128 i ? i.focus() : (xe && (xe.remove(), xe = null), Ee && (Ee.remove(), Ee = null), P(document.documentElement, ie), (() => { 5129 if (!it) return; 5130 const t = document, 5131 e = t.body; 5132 e.classList.remove(ne), e.style.setProperty(oe, ""), t.documentElement.style.setProperty(se, "") 5133 })(), this.emit("destroy")) 5134 } 5135 static bind(t, e, i) { 5136 if (!it) return; 5137 let n, s = "", 5138 o = {}; 5139 if (void 0 === t ? n = document.body : be(t) ? (n = document.body, s = t, "object" == typeof e && (o = e || {})) : (n = t, be(e) && (s = e), "object" == typeof i && (o = i || {})), !n || !S(n)) return; 5140 s = s || "[data-fancybox]"; 5141 const a = Ae.openers.get(n) || new Map; 5142 a.set(s, o), Ae.openers.set(n, a), 1 === a.size && n.addEventListener("click", Ae.fromEvent) 5143 } 5144 static unbind(t, e) { 5145 let i, n = ""; 5146 if (be(t) ? (i = document.body, n = t) : (i = t, be(e) && (n = e)), !i) return; 5147 const s = Ae.openers.get(i); 5148 s && n && s.delete(n), n && s || (Ae.openers.delete(i), i.removeEventListener("click", Ae.fromEvent)) 5149 } 5150 static destroy() { 5151 let t; 5152 for (; t = Ae.getInstance();) t.destroy(); 5153 for (const t of Ae.openers.keys()) t.removeEventListener("click", Ae.fromEvent); 5154 Ae.openers = new Map 5155 } 5156 static fromEvent(t) { 5157 if (t.defaultPrevented) return; 5158 if (t.button && 0 !== t.button) return; 5159 if (t.ctrlKey || t.metaKey || t.shiftKey) return; 5160 let e = t.composedPath()[0]; 5161 const i = e.closest("[data-fancybox-trigger]"); 5162 if (i) { 5163 const t = i.dataset.fancyboxTrigger || "", 5164 n = document.querySelectorAll(`[data-fancybox="${t}"]`), 5165 s = parseInt(i.dataset.fancyboxIndex || "", 10) || 0; 5166 e = n[s] || e 5167 } 5168 if (!(e && e instanceof Element)) return; 5169 let n, s, o, a; 5170 if ([...Ae.openers].reverse().find((([t, i]) => !(!t.contains(e) || ![...i].reverse().find((([i, r]) => { 5171 let l = e.closest(i); 5172 return !!l && (n = t, s = i, o = l, a = r, !0) 5173 }))))), !n || !s || !o) return; 5174 a = a || {}, t.preventDefault(), e = o; 5175 let r = [], 5176 l = p({}, rt, a); 5177 l.event = t, l.triggerEl = e, l.delegate = i; 5178 const c = l.groupAll, 5179 h = l.groupAttr, 5180 d = h && e ? e.getAttribute(`${h}`) : ""; 5181 if ((!e || d || c) && (r = [].slice.call(n.querySelectorAll(s))), e && !c && (r = d ? r.filter((t => t.getAttribute(`${h}`) === d)) : [e]), !r.length) return; 5182 const u = Ae.getInstance(); 5183 return u && u.options.triggerEl && r.indexOf(u.options.triggerEl) > -1 ? void 0 : (e && (l.startIndex = r.indexOf(e)), Ae.fromNodes(r, l)) 5184 } 5185 static fromSelector(t, e, i) { 5186 let n = null, 5187 s = "", 5188 o = {}; 5189 if (be(t) ? (n = document.body, s = t, "object" == typeof e && (o = e || {})) : t instanceof HTMLElement && be(e) && (n = t, s = e, "object" == typeof i && (o = i || {})), !n || !s) return !1; 5190 const a = Ae.openers.get(n); 5191 return !!a && (o = p({}, a.get(s) || {}, o), !!o && Ae.fromNodes(Array.from(n.querySelectorAll(s)), o)) 5192 } 5193 static fromNodes(t, e) { 5194 e = p({}, rt, e || {}); 5195 const i = []; 5196 for (const n of t) { 5197 const t = n.dataset || {}, 5198 s = t[ve] || n.getAttribute(me) || n.getAttribute("currentSrc") || n.getAttribute(ve) || void 0; 5199 let o; 5200 const a = e.delegate; 5201 let r; 5202 a && i.length === e.startIndex && (o = a instanceof HTMLImageElement ? a : a.querySelector("img:not([aria-hidden])")), o || (o = n instanceof HTMLImageElement ? n : n.querySelector("img:not([aria-hidden])")), o && (r = o.currentSrc || o[ve] || void 0, !r && o.dataset && (r = o.dataset.lazySrc || o.dataset[ve] || void 0)); 5203 const l = { 5204 src: s, 5205 triggerEl: n, 5206 thumbEl: o, 5207 thumbElSrc: r, 5208 thumbSrc: r 5209 }; 5210 for (const e in t) { 5211 let i = t[e] + ""; 5212 i = "false" !== i && ("true" === i || i), l[e] = i 5213 } 5214 i.push(l) 5215 } 5216 return new Ae(i, e) 5217 } 5218 static getInstance(t) { 5219 if (t) return Me.get(t); 5220 return Array.from(Me.values()).reverse().find((t => !t.isClosing() && t)) || null 5221 } 5222 static getSlide() { 5223 var t; 5224 return (null === (t = Ae.getInstance()) || void 0 === t ? void 0 : t.getSlide()) || null 5225 } 5226 static show(t = [], e = {}) { 5227 return new Ae(t, e) 5228 } 5229 static next() { 5230 const t = Ae.getInstance(); 5231 t && t.next() 5232 } 5233 static prev() { 5234 const t = Ae.getInstance(); 5235 t && t.prev() 5236 } 5237 static close(t = !0, ...e) { 5238 if (t) 5239 for (const t of Me.values()) t.close(...e); 5240 else { 5241 const t = Ae.getInstance(); 5242 t && t.close(...e) 5243 } 5244 } 5245 } 5246 Object.defineProperty(Ae, "version", { 5247 enumerable: !0, 5248 configurable: !0, 5249 writable: !0, 5250 value: "5.0.36" 5251 }), Object.defineProperty(Ae, "defaults", { 5252 enumerable: !0, 5253 configurable: !0, 5254 writable: !0, 5255 value: rt 5256 }), Object.defineProperty(Ae, "Plugins", { 5257 enumerable: !0, 5258 configurable: !0, 5259 writable: !0, 5260 value: ee 5261 }), Object.defineProperty(Ae, "openers", { 5262 enumerable: !0, 5263 configurable: !0, 5264 writable: !0, 5265 value: new Map 5266 }), t.Carousel = tt, t.ModulaFancybox = Ae, t.Panzoom = D 5267}));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.