9454 lines
314 KiB
HTML
9454 lines
314 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en" itemscope itemtype="http://schema.org/WebPage">
|
||
|
||
<head>
|
||
|
||
<meta charset="utf-8" />
|
||
<title>Lean and Local: DNS, VPN, IRC and Ad Blocking</title>
|
||
|
||
|
||
<meta
|
||
name="viewport"
|
||
content="width=device-width, initial-scale=1, maximum-scale=5" />
|
||
|
||
|
||
<meta name="theme-name" content="professors-hugo" />
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="shortcut icon" href="/images/favicon_hu_e23ec60231f79d1f.png" type="image/x-icon">
|
||
<link rel="icon" href="/images/favicon_hu_e23ec60231f79d1f.png" type="image/x-icon">
|
||
<link rel="icon" type="image/png" sizes="48x48" href="/images/favicon_hu_8fe24b8d7739e95a.png">
|
||
<link rel="icon" type="image/png" sizes="96x96" href="/images/favicon_hu_e23ec60231f79d1f.png">
|
||
<link rel="apple-touch-icon" sizes="144x144" href="/images/favicon_hu_a0382c90d2ab5755.png">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="manifest" href="/manifest.webmanifest" />
|
||
<meta
|
||
name="msapplication-TileColor"
|
||
content="#18b0a2" />
|
||
<meta
|
||
name="theme-color"
|
||
content="#0e1015" />
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<base href="https://joren.blog/project/project-3/" />
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<title>Lean and Local: DNS, VPN, IRC and Ad Blocking</title>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<meta
|
||
name="keywords"
|
||
content="Boilerplate, Hugo, Themefisher, GetHugoThemes" />
|
||
|
||
|
||
|
||
|
||
<meta
|
||
name="description"
|
||
content="A lightweight Alpine Linux system running DNS filtering, WireGuard VPN, and IRC on minimal hardware using a diskless setup." />
|
||
|
||
|
||
|
||
<meta name="author" content="Themefisher" />
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<meta property="og:image" content="https://joren.blog/images/project/project-3.jpg" />
|
||
<meta name="twitter:image" content="https://joren.blog/images/project/project-3.jpg" />
|
||
<meta
|
||
name="twitter:card"
|
||
content="summary_large_image" />
|
||
|
||
|
||
<meta property="og:image:width" content="1421" />
|
||
<meta property="og:image:height" content="1014" />
|
||
|
||
|
||
|
||
|
||
<meta
|
||
property="og:image:type"
|
||
content="image/.jpg" />
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<meta property="og:title" content="Lean and Local: DNS, VPN, IRC and Ad Blocking" />
|
||
<meta property="og:description" content="A lightweight Alpine Linux system running DNS filtering, WireGuard VPN, and IRC on minimal hardware using a diskless setup." />
|
||
<meta property="og:type" content="website" />
|
||
<meta property="og:url" content="https://joren.blog/project/project-3/" />
|
||
|
||
|
||
<meta name="twitter:title" content="Lean and Local: DNS, VPN, IRC and Ad Blocking" />
|
||
<meta name="twitter:description" content="A lightweight Alpine Linux system running DNS filtering, WireGuard VPN, and IRC on minimal hardware using a diskless setup." />
|
||
|
||
|
||
|
||
<meta name="twitter:creator" content="@Themefisher" />
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<meta http-equiv="x-dns-prefetch-control" content="on" />
|
||
<link rel="preconnect" href="//ajax.googleapis.com" />
|
||
<link
|
||
rel="preconnect"
|
||
href="https://fonts.gstatic.com"
|
||
crossorigin="anonymous" />
|
||
<link rel="preconnect" href="https://use.fontawesome.com" crossorigin />
|
||
<link rel="preconnect" href="//cdnjs.cloudflare.com" />
|
||
<link rel="preconnect" href="//www.googletagmanager.com" />
|
||
<link rel="preconnect" href="//www.google-analytics.com" />
|
||
<link rel="dns-prefetch" href="https://fonts.gstatic.com" />
|
||
<link rel="dns-prefetch" href="https://use.fontawesome.com" />
|
||
<link rel="dns-prefetch" href="//ajax.googleapis.com" />
|
||
<link rel="dns-prefetch" href="//cdnjs.cloudflare.com" />
|
||
<link rel="dns-prefetch" href="//www.googletagmanager.com" />
|
||
<link rel="dns-prefetch" href="//www.google-analytics.com" />
|
||
<link rel="dns-prefetch" href="//fonts.googleapis.com" />
|
||
<link rel="dns-prefetch" href="//connect.facebook.net" />
|
||
<link rel="dns-prefetch" href="//platform.linkedin.com" />
|
||
<link rel="dns-prefetch" href="//platform.twitter.com" />
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<link rel="stylesheet" href="/css/style.e0f0e604485dadc53beafefb6a6887ddbbfd8348186bc86d1fc9e99ad8162ccd.css" />
|
||
|
||
|
||
|
||
|
||
</head>
|
||
|
||
<body>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<button class="navbar-toggler d-block d-xl-none rounded" type="button" title="Expand & shrink sidebar">
|
||
<label class="position-relative">
|
||
<input class="d-none" type="checkbox" />
|
||
<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg">
|
||
<path class="line--1" d="M0 40h62c13 0 6 28-4 18L35 35" />
|
||
<path class="line--2" d="M0 50h70" />
|
||
<path class="line--3" d="M0 60h62c13 0 6-28-4-18L35 65" />
|
||
</svg>
|
||
</label>
|
||
</button>
|
||
|
||
<aside id="sidebarContent" class="position-fixed hidden d-lg-block top-0 w-100 vh-100">
|
||
<nav id="navbar" class="navigation d-flex flex-column justify-content-between h-100">
|
||
<ul class="navbar-nav mb-5">
|
||
|
||
|
||
<li class="nav-item d-block">
|
||
<a class="nav-link d-flex align-items-center" aria-current="page" href="/#banner"><i class="fa-solid fa-user me-3"></i><span>Introduction</span></a>
|
||
</li>
|
||
|
||
<li class="nav-item d-block">
|
||
<a class="nav-link d-flex align-items-center" aria-current="page" href="/#skill"><i class="fa-solid fa-list-check me-3"></i><span>My Skills</span></a>
|
||
</li>
|
||
|
||
<li class="nav-item d-block">
|
||
<a class="nav-link d-flex align-items-center" aria-current="page" href="/#resume"><i class="fa-solid fa-address-card me-3"></i><span>Resume</span></a>
|
||
</li>
|
||
|
||
<li class="nav-item d-block">
|
||
<a class="nav-link d-flex align-items-center" aria-current="page" href="/#portfolio"><i class="fa-solid fa-box me-3"></i><span>Portfolio</span></a>
|
||
</li>
|
||
|
||
<li class="nav-item d-block">
|
||
<a class="nav-link d-flex align-items-center" aria-current="page" href="/#blog"><i class="fa-solid fa-blog me-3"></i><span>Blog</span></a>
|
||
</li>
|
||
|
||
<li class="nav-item d-block">
|
||
<a class="nav-link d-flex align-items-center" aria-current="page" href="/#contact"><i class="fa-solid fa-paper-plane me-3"></i><span>Contact</span></a>
|
||
</li>
|
||
|
||
</ul>
|
||
|
||
|
||
|
||
<div class="pb-3 mt-auto">
|
||
<div class="mb-3">Social Links</div>
|
||
<ul class="list-inline social-links">
|
||
|
||
<li class="list-inline-item mb-2">
|
||
<a class="rounded-2 d-block position-relative text-white" target="_blank" href="https://github.com/jorensc">
|
||
<i class="fa-brands fa-github"></i>
|
||
</a>
|
||
</li>
|
||
|
||
<li class="list-inline-item mb-2">
|
||
<a class="rounded-2 d-block position-relative text-white" target="_blank" href="https://www.linkedin.com/in/jorenschipman/">
|
||
<i class="fa-brands fa-linkedin"></i>
|
||
</a>
|
||
</li>
|
||
|
||
</ul>
|
||
</div>
|
||
|
||
|
||
|
||
|
||
<div class="pb-5">
|
||
<label class="theme-switcher">
|
||
<input id="toggler" type="checkbox" checked>
|
||
<span></span>
|
||
</label>
|
||
|
||
|
||
</div>
|
||
|
||
</nav>
|
||
</aside>
|
||
|
||
<main class="px-2 px-lg-0 px-xl-4 overflow-hidden">
|
||
<div >
|
||
|
||
<section class="section bg-shape">
|
||
<div class="container">
|
||
<div class="row">
|
||
<div class="col-xxl-10 mx-auto" data-aos="fade-up" data-aos-delay="100">
|
||
<button class="text-primary mb-5 border-0 bg-transparent" onclick="history.back()"><i class="fa-solid fa-backward me-2"></i>Back</button>
|
||
<article>
|
||
<h1 class="text-capitalize h3 mb-4">Lean and Local: DNS, VPN, IRC and Ad Blocking</h1>
|
||
<div class="post-meta d-flex flex-wrap flex-lg-nowrap align-items-center mb-4">
|
||
<ul class="list-inline me-5">
|
||
<li class="list-inline-item">
|
||
<i class="fa-solid fa-calendar-days me-2"></i>30 May 2025
|
||
</li>
|
||
</ul>
|
||
<span>Last updated on May 30, 2025</span>
|
||
</div>
|
||
|
||
|
||
<div class="w-100">
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<picture>
|
||
<source
|
||
|
||
srcset="/images/project/project-3_hu_a2e987e158776bbc.webp"
|
||
|
||
media="(max-width: 575px)" />
|
||
<source
|
||
|
||
srcset="/images/project/project-3_hu_a68548c55de36b1f.webp"
|
||
|
||
media="(max-width: 767px)" />
|
||
<source
|
||
|
||
srcset="/images/project/project-3_hu_62a13caff8a630c2.webp"
|
||
|
||
media="(max-width: 991px)" />
|
||
<source
|
||
|
||
srcset="/images/project/project-3_hu_e67ec575b7f17bcf.webp"
|
||
/>
|
||
<img
|
||
|
||
loading="lazy" decoding="async"
|
||
src="/images/project/project-3_hu_9d6702f14e8f2c3b.jpg"
|
||
class=" featured-image lazy mb-5 rounded-3 img"
|
||
alt="Lean and Local: DNS, VPN, IRC and Ad Blocking"
|
||
width="1421"
|
||
height="1014" />
|
||
</picture>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</div>
|
||
|
||
|
||
<div class="content">
|
||
<p>Running a full-featured network stack on old hardware isn’t just possible, it’s efficient. This post covers how I configured Alpine Linux as a diskless system hosting DNS resolution, ad blocking, VPN access, and a local IRC server.</p>
|
||
<hr>
|
||
<h4 id="why-diskless">Why Diskless?</h4>
|
||
<p>The system boots entirely from RAM using Alpine’s <code>diskless</code> mode. This eliminates wear on flash storage, improves startup speed, and ensures a clean slate on each reboot. Changes are persisted manually using <code>lbu</code>, making the setup both robust and disposable, perfect for low-power hardware with limited write endurance.</p>
|
||
<hr>
|
||
<h4 id="base-setup">Base Setup</h4>
|
||
<p>The machine is an old D-Class thin client with 4 GB RAM and an AMD G-T48E CPU. Alpine Linux 3.21 is installed with only essential packages (229 total). Services are configured via <code>OpenRC</code> and restored from compressed overlays on boot.</p>
|
||
<hr>
|
||
<h4 id="dns-and-ad-blocking-blocky">DNS and Ad Blocking: Blocky</h4>
|
||
<p>Blocky handles all local DNS queries, with DoT upstreams, custom mappings, and deny lists per client.</p>
|
||
<p>Highlights:</p>
|
||
<ul>
|
||
<li>Local resolution for custom domains like <code>directme.in</code></li>
|
||
<li>Cloudflare, Google as upstream resolvers</li>
|
||
<li>Per-IP blocking rules</li>
|
||
<li>Prometheus metrics for monitoring</li>
|
||
</ul>
|
||
<p>Example config:</p>
|
||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-yaml" data-lang="yaml"><span style="display:flex;"><span><span style="color:#f92672">blocking</span>:
|
||
</span></span><span style="display:flex;"><span> <span style="color:#f92672">denylists</span>:
|
||
</span></span><span style="display:flex;"><span> <span style="color:#f92672">ads</span>:
|
||
</span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">https://big.oisd.nl/domainswild</span>
|
||
</span></span><span style="display:flex;"><span> <span style="color:#f92672">vtm</span>:
|
||
</span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">/home/joren/dns/vtmgo.txt</span>
|
||
</span></span><span style="display:flex;"><span> <span style="color:#f92672">clientGroupsBlock</span>:
|
||
</span></span><span style="display:flex;"><span> <span style="color:#f92672">default</span>:
|
||
</span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">ads</span>
|
||
</span></span><span style="display:flex;"><span> <span style="color:#f92672">192.168.178.123</span>:
|
||
</span></span><span style="display:flex;"><span> - <span style="color:#ae81ff">vtm</span>
|
||
</span></span></code></pre></div><hr>
|
||
<h4 id="vpn-wireguard-via-pivpn">VPN: WireGuard via PiVPN</h4>
|
||
<p>WireGuard provides encrypted access to the local network, and PiVPN makes managing it trivial. While WireGuard itself is minimal, PiVPN adds essential automation without requiring a full control panel or web UI.</p>
|
||
<p>Key benefits in this setup:</p>
|
||
<ul>
|
||
<li>
|
||
<p>Client management is simple and scriptable. Adding, disabling, or revoking peers takes seconds:</p>
|
||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-sh" data-lang="sh"><span style="display:flex;"><span>pivpn -a <span style="color:#75715e"># add client</span>
|
||
</span></span><span style="display:flex;"><span>pivpn -r <span style="color:#75715e"># remove client</span>
|
||
</span></span><span style="display:flex;"><span>pivpn -off <name> <span style="color:#75715e"># temporarily disable</span>
|
||
</span></span></code></pre></div></li>
|
||
<li>
|
||
<p>Mobile-friendly. Each config can be exported as a QR code with <code>pivpn -qr</code>, which is perfect for importing into the WireGuard mobile app.</p>
|
||
</li>
|
||
<li>
|
||
<p>Monitoring support. View live connections with <code>pivpn -c</code>, or audit all issued keys with <code>pivpn -l</code>.</p>
|
||
</li>
|
||
<li>
|
||
<p>Backups included. One command backs up all configs: <code>pivpn -bk</code>.</p>
|
||
</li>
|
||
</ul>
|
||
<p>Example output:</p>
|
||
<pre tabindex="0"><code>::: Connected Clients List :::
|
||
Name Remote IP Virtual IP Bytes Received Bytes Sent Last Seen
|
||
Phone 84.199.x.x:60042 10.60.150.2 439MiB 3.3GiB May 29 2025 - 22:39:56
|
||
</code></pre><p>In this context, PiVPN reduces the friction of managing WireGuard while remaining fully compatible with Alpine’s diskless, CLI-centric philosophy. No services are wasted, and all changes remain under user control.</p>
|
||
<hr>
|
||
<hr>
|
||
<h4 id="irc-ngircd">IRC: ngIRCd</h4>
|
||
<p>For real-time messaging, I run a public-facing <strong>ngIRCd</strong> instance accessible over both plaintext (port 6667) and encrypted TLS (ports 6697, 6698). Despite its modest footprint, <em>ngIRCd</em> is stable, portable, and well-suited for both LAN and internet-facing deployments.</p>
|
||
<p>The server is configured to:</p>
|
||
<ul>
|
||
<li>Autojoin clients to a default <code>#General</code> channel</li>
|
||
<li>Support cloaking for user privacy</li>
|
||
<li>Restrict joins per user/IP to prevent abuse</li>
|
||
<li>Provide operator access with predefined credentials</li>
|
||
<li>Disable DNS and Ident lookups for speed and reduced leakage</li>
|
||
</ul>
|
||
<p>Here’s a snapshot of the active configuration:</p>
|
||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-ini" data-lang="ini"><span style="display:flex;"><span><span style="color:#66d9ef">[Global]</span>
|
||
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">Name</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">irc.alpine4071</span>
|
||
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">Info</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">RAM-only IRC Server</span>
|
||
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">Listen</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">0.0.0.0</span>
|
||
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">Ports</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">6667</span>
|
||
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">MotdPhrase</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">"Welcome to our RAM-only IRC server!"</span>
|
||
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">AdminInfo1</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">IRC Server</span>
|
||
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">AdminInfo2</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">Anywhere On Earth</span>
|
||
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">AdminEMail</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">admin@irc.alpine4071</span>
|
||
</span></span><span style="display:flex;"><span>
|
||
</span></span><span style="display:flex;"><span><span style="color:#66d9ef">[SSL]</span>
|
||
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">CertFile</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">/home/joren/certs/fullchain1.pem</span>
|
||
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">KeyFile</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">/home/joren/certs/privkey1.pem</span>
|
||
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">Ports</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">6697, 6698</span>
|
||
</span></span></code></pre></div><p>Authentication and moderation are handled via the <code>[Operator]</code> block, and all users are dropped into a predefined channel:</p>
|
||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-ini" data-lang="ini"><span style="display:flex;"><span><span style="color:#66d9ef">[Channel]</span>
|
||
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">Name</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">#General</span>
|
||
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">Topic</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">General Channel</span>
|
||
</span></span><span style="display:flex;"><span><span style="color:#a6e22e">Autojoin</span> <span style="color:#f92672">=</span> <span style="color:#e6db74">yes</span>
|
||
</span></span></code></pre></div><p><strong>Why ngIRCd?</strong></p>
|
||
<ul>
|
||
<li>It works well on memory-constrained systems.</li>
|
||
<li>It doesn’t require database backends or scripting engines.</li>
|
||
<li>It supports modern essentials like TLS, cloaking, and structured limits.</li>
|
||
<li>It’s simple to secure and configure, even when exposed to the open internet.</li>
|
||
</ul>
|
||
<p>This makes ngIRCd a perfect fit for remote support, small private networks, or just having your own IRC node to tinker with, without touching a gigabyte of storage.</p>
|
||
<p>You can connect today via:</p>
|
||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-text" data-lang="text"><span style="display:flex;"><span>irc://alpine-4071.duckdns.org:6667 (plaintext)
|
||
</span></span><span style="display:flex;"><span>ircs://alpine-4071.duckdns.org:6697 (TLS)
|
||
</span></span></code></pre></div><hr>
|
||
<h4 id="making-it-stick-lbu">Making It Stick: LBU</h4>
|
||
<p>To persist changes in a stateless system, I use Alpine’s <code>lbu</code>:</p>
|
||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-sh" data-lang="sh"><span style="display:flex;"><span>lbu include /etc/blocky/config.yml
|
||
</span></span><span style="display:flex;"><span>lbu include /etc/ngircd/ngircd.conf
|
||
</span></span><span style="display:flex;"><span>lbu commit -d
|
||
</span></span></code></pre></div><p>This updates the overlay that Alpine loads at each boot. All runtime data stays in RAM.</p>
|
||
<hr>
|
||
<h4 id="runlevel-integration">Runlevel Integration</h4>
|
||
<p>All services are enabled through OpenRC:</p>
|
||
<div class="highlight"><pre tabindex="0" style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;"><code class="language-sh" data-lang="sh"><span style="display:flex;"><span>rc-update add blocky default
|
||
</span></span><span style="display:flex;"><span>rc-update add wg-quick default
|
||
</span></span><span style="display:flex;"><span>rc-update add ngircd default
|
||
</span></span><span style="display:flex;"><span>rc-update add iptables default
|
||
</span></span></code></pre></div><p>Boot time is under 10 seconds, with full network stack active by the time DHCP finishes.</p>
|
||
<hr>
|
||
<h4 id="final-thoughts">Final Thoughts</h4>
|
||
<p>Alpine’s diskless approach is perfect for resilient, low-maintenance edge systems. Combined with fast tools like Blocky and WireGuard, even minimal hardware becomes a capable, efficient network node, quietly resolving DNS, filtering traffic, handling VPN access, and hosting IRC.</p>
|
||
|
||
</div>
|
||
</article>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</section>
|
||
|
||
</div>
|
||
|
||
<footer class="text-center">
|
||
<div class="container">
|
||
<div class="row">
|
||
<div class="col-xxl-11 mx-auto">
|
||
<div class="copyright-info py-4 small">Copyright by Joren Schipman</div>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
</footer>
|
||
|
||
|
||
|
||
<button type="button" title="scroll to top of the website"
|
||
class="back-to-top d-flex justify-content-center align-items-center rounded-circle border-0">
|
||
<span class="progress-value d-flex justify-content-center align-items-center rounded-circle">
|
||
<i class="fa fa-angle-up" aria-hidden="true"></i>
|
||
</span>
|
||
</button>
|
||
|
||
|
||
</main>
|
||
|
||
|
||
|
||
|
||
|
||
<script>
|
||
let lightMode = false;
|
||
let systemIsDark = window.matchMedia("(prefers-color-scheme: dark)").matches;
|
||
let localStorageTheme = localStorage.getItem('theme');
|
||
let switcher = document.querySelector(".theme-switcher input");
|
||
|
||
if(localStorageTheme) {
|
||
if (localStorageTheme === null) {
|
||
lightMode = false;
|
||
}
|
||
else if (localStorageTheme === 'light') {
|
||
lightMode = true;
|
||
switcher.checked = false;
|
||
} else if (localStorageTheme === 'dark') {
|
||
lightMode = false;
|
||
switcher.checked = true;
|
||
}
|
||
}
|
||
|
||
document.addEventListener('DOMContentLoaded', () => {
|
||
if (localStorageTheme === null || !lightMode) {
|
||
document.documentElement.classList.add('dark');
|
||
} else if (lightMode) {
|
||
document.documentElement.classList.add('light');
|
||
}
|
||
|
||
switcher.addEventListener('change', (e) => {
|
||
if (e.currentTarget.checked === true) {
|
||
document.documentElement.classList.remove('light');
|
||
document.documentElement.classList.add('dark');
|
||
localStorage.setItem('theme', 'dark');
|
||
} else {
|
||
document.documentElement.classList.remove('dark');
|
||
document.documentElement.classList.add('light');
|
||
localStorage.setItem('theme', 'light');
|
||
}
|
||
});
|
||
});
|
||
</script>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<script crossorigin="anonymous" defer integrity="sha512-FWwN3dx8IPNKLzxb9ZhzR7qgnI+cJUFpc34CQ83kyCSwSqmjpTjIxWIAH4EHWK5FsZv62JH+R+GoPqDcst4v2g==" type="application/javascript">(() => {
|
||
var __create = Object.create;
|
||
var __defProp = Object.defineProperty;
|
||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||
var __getProtoOf = Object.getPrototypeOf;
|
||
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
||
var __commonJS = (cb, mod) => function __require() {
|
||
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
||
};
|
||
var __copyProps = (to, from, except, desc) => {
|
||
if (from && typeof from === "object" || typeof from === "function") {
|
||
for (let key of __getOwnPropNames(from))
|
||
if (!__hasOwnProp.call(to, key) && key !== except)
|
||
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
||
}
|
||
return to;
|
||
};
|
||
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
||
// If the importer is in node compatibility mode or this is not an ESM
|
||
// file that has been converted to a CommonJS file using a Babel-
|
||
// compatible transform (i.e. "__esModule" has not been set), then set
|
||
// "default" to the CommonJS "module.exports" for node compatibility.
|
||
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
||
mod
|
||
));
|
||
|
||
// ns-hugo-imp:/home/joren/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2@v2.21100.20000/package/dist/cjs/popper.js
|
||
var require_popper = __commonJS({
|
||
"ns-hugo-imp:/home/joren/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/gohugoio/hugo-mod-jslibs-dist/popperjs/v2@v2.21100.20000/package/dist/cjs/popper.js"(exports) {
|
||
"use strict";
|
||
Object.defineProperty(exports, "__esModule", { value: true });
|
||
function getWindow(node) {
|
||
if (node == null) {
|
||
return window;
|
||
}
|
||
if (node.toString() !== "[object Window]") {
|
||
var ownerDocument = node.ownerDocument;
|
||
return ownerDocument ? ownerDocument.defaultView || window : window;
|
||
}
|
||
return node;
|
||
}
|
||
function isElement2(node) {
|
||
var OwnElement = getWindow(node).Element;
|
||
return node instanceof OwnElement || node instanceof Element;
|
||
}
|
||
function isHTMLElement(node) {
|
||
var OwnElement = getWindow(node).HTMLElement;
|
||
return node instanceof OwnElement || node instanceof HTMLElement;
|
||
}
|
||
function isShadowRoot(node) {
|
||
if (typeof ShadowRoot === "undefined") {
|
||
return false;
|
||
}
|
||
var OwnElement = getWindow(node).ShadowRoot;
|
||
return node instanceof OwnElement || node instanceof ShadowRoot;
|
||
}
|
||
var max = Math.max;
|
||
var min = Math.min;
|
||
var round = Math.round;
|
||
function getBoundingClientRect(element, includeScale) {
|
||
if (includeScale === void 0) {
|
||
includeScale = false;
|
||
}
|
||
var rect = element.getBoundingClientRect();
|
||
var scaleX = 1;
|
||
var scaleY = 1;
|
||
if (isHTMLElement(element) && includeScale) {
|
||
var offsetHeight = element.offsetHeight;
|
||
var offsetWidth = element.offsetWidth;
|
||
if (offsetWidth > 0) {
|
||
scaleX = round(rect.width) / offsetWidth || 1;
|
||
}
|
||
if (offsetHeight > 0) {
|
||
scaleY = round(rect.height) / offsetHeight || 1;
|
||
}
|
||
}
|
||
return {
|
||
width: rect.width / scaleX,
|
||
height: rect.height / scaleY,
|
||
top: rect.top / scaleY,
|
||
right: rect.right / scaleX,
|
||
bottom: rect.bottom / scaleY,
|
||
left: rect.left / scaleX,
|
||
x: rect.left / scaleX,
|
||
y: rect.top / scaleY
|
||
};
|
||
}
|
||
function getWindowScroll(node) {
|
||
var win = getWindow(node);
|
||
var scrollLeft = win.pageXOffset;
|
||
var scrollTop = win.pageYOffset;
|
||
return {
|
||
scrollLeft,
|
||
scrollTop
|
||
};
|
||
}
|
||
function getHTMLElementScroll(element) {
|
||
return {
|
||
scrollLeft: element.scrollLeft,
|
||
scrollTop: element.scrollTop
|
||
};
|
||
}
|
||
function getNodeScroll(node) {
|
||
if (node === getWindow(node) || !isHTMLElement(node)) {
|
||
return getWindowScroll(node);
|
||
} else {
|
||
return getHTMLElementScroll(node);
|
||
}
|
||
}
|
||
function getNodeName(element) {
|
||
return element ? (element.nodeName || "").toLowerCase() : null;
|
||
}
|
||
function getDocumentElement(element) {
|
||
return ((isElement2(element) ? element.ownerDocument : (
|
||
// $FlowFixMe[prop-missing]
|
||
element.document
|
||
)) || window.document).documentElement;
|
||
}
|
||
function getWindowScrollBarX(element) {
|
||
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
||
}
|
||
function getComputedStyle2(element) {
|
||
return getWindow(element).getComputedStyle(element);
|
||
}
|
||
function isScrollParent(element) {
|
||
var _getComputedStyle = getComputedStyle2(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
|
||
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
||
}
|
||
function isElementScaled(element) {
|
||
var rect = element.getBoundingClientRect();
|
||
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
||
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
||
return scaleX !== 1 || scaleY !== 1;
|
||
}
|
||
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
||
if (isFixed === void 0) {
|
||
isFixed = false;
|
||
}
|
||
var isOffsetParentAnElement = isHTMLElement(offsetParent);
|
||
var offsetParentIsScaled = isHTMLElement(offsetParent) && isElementScaled(offsetParent);
|
||
var documentElement = getDocumentElement(offsetParent);
|
||
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled);
|
||
var scroll = {
|
||
scrollLeft: 0,
|
||
scrollTop: 0
|
||
};
|
||
var offsets = {
|
||
x: 0,
|
||
y: 0
|
||
};
|
||
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
||
if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
|
||
isScrollParent(documentElement)) {
|
||
scroll = getNodeScroll(offsetParent);
|
||
}
|
||
if (isHTMLElement(offsetParent)) {
|
||
offsets = getBoundingClientRect(offsetParent, true);
|
||
offsets.x += offsetParent.clientLeft;
|
||
offsets.y += offsetParent.clientTop;
|
||
} else if (documentElement) {
|
||
offsets.x = getWindowScrollBarX(documentElement);
|
||
}
|
||
}
|
||
return {
|
||
x: rect.left + scroll.scrollLeft - offsets.x,
|
||
y: rect.top + scroll.scrollTop - offsets.y,
|
||
width: rect.width,
|
||
height: rect.height
|
||
};
|
||
}
|
||
function getLayoutRect(element) {
|
||
var clientRect = getBoundingClientRect(element);
|
||
var width = element.offsetWidth;
|
||
var height = element.offsetHeight;
|
||
if (Math.abs(clientRect.width - width) <= 1) {
|
||
width = clientRect.width;
|
||
}
|
||
if (Math.abs(clientRect.height - height) <= 1) {
|
||
height = clientRect.height;
|
||
}
|
||
return {
|
||
x: element.offsetLeft,
|
||
y: element.offsetTop,
|
||
width,
|
||
height
|
||
};
|
||
}
|
||
function getParentNode(element) {
|
||
if (getNodeName(element) === "html") {
|
||
return element;
|
||
}
|
||
return (
|
||
// this is a quicker (but less type safe) way to save quite some bytes from the bundle
|
||
// $FlowFixMe[incompatible-return]
|
||
// $FlowFixMe[prop-missing]
|
||
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
||
element.parentNode || // DOM Element detected
|
||
(isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
|
||
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
|
||
getDocumentElement(element)
|
||
);
|
||
}
|
||
function getScrollParent(node) {
|
||
if (["html", "body", "#document"].indexOf(getNodeName(node)) >= 0) {
|
||
return node.ownerDocument.body;
|
||
}
|
||
if (isHTMLElement(node) && isScrollParent(node)) {
|
||
return node;
|
||
}
|
||
return getScrollParent(getParentNode(node));
|
||
}
|
||
function listScrollParents(element, list) {
|
||
var _element$ownerDocumen;
|
||
if (list === void 0) {
|
||
list = [];
|
||
}
|
||
var scrollParent = getScrollParent(element);
|
||
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
||
var win = getWindow(scrollParent);
|
||
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
||
var updatedList = list.concat(target);
|
||
return isBody ? updatedList : (
|
||
// $FlowFixMe[incompatible-call]: isBody tells us target will be an HTMLElement here
|
||
updatedList.concat(listScrollParents(getParentNode(target)))
|
||
);
|
||
}
|
||
function isTableElement(element) {
|
||
return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
|
||
}
|
||
function getTrueOffsetParent(element) {
|
||
if (!isHTMLElement(element) || // https://github.com/popperjs/popper-core/issues/837
|
||
getComputedStyle2(element).position === "fixed") {
|
||
return null;
|
||
}
|
||
return element.offsetParent;
|
||
}
|
||
function getContainingBlock(element) {
|
||
var isFirefox = navigator.userAgent.toLowerCase().indexOf("firefox") !== -1;
|
||
var isIE = navigator.userAgent.indexOf("Trident") !== -1;
|
||
if (isIE && isHTMLElement(element)) {
|
||
var elementCss = getComputedStyle2(element);
|
||
if (elementCss.position === "fixed") {
|
||
return null;
|
||
}
|
||
}
|
||
var currentNode = getParentNode(element);
|
||
while (isHTMLElement(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
|
||
var css = getComputedStyle2(currentNode);
|
||
if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
|
||
return currentNode;
|
||
} else {
|
||
currentNode = currentNode.parentNode;
|
||
}
|
||
}
|
||
return null;
|
||
}
|
||
function getOffsetParent(element) {
|
||
var window2 = getWindow(element);
|
||
var offsetParent = getTrueOffsetParent(element);
|
||
while (offsetParent && isTableElement(offsetParent) && getComputedStyle2(offsetParent).position === "static") {
|
||
offsetParent = getTrueOffsetParent(offsetParent);
|
||
}
|
||
if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle2(offsetParent).position === "static")) {
|
||
return window2;
|
||
}
|
||
return offsetParent || getContainingBlock(element) || window2;
|
||
}
|
||
var top = "top";
|
||
var bottom = "bottom";
|
||
var right = "right";
|
||
var left = "left";
|
||
var auto = "auto";
|
||
var basePlacements = [top, bottom, right, left];
|
||
var start = "start";
|
||
var end = "end";
|
||
var clippingParents = "clippingParents";
|
||
var viewport = "viewport";
|
||
var popper = "popper";
|
||
var reference = "reference";
|
||
var variationPlacements = /* @__PURE__ */ basePlacements.reduce(function(acc, placement) {
|
||
return acc.concat([placement + "-" + start, placement + "-" + end]);
|
||
}, []);
|
||
var placements = /* @__PURE__ */ [].concat(basePlacements, [auto]).reduce(function(acc, placement) {
|
||
return acc.concat([placement, placement + "-" + start, placement + "-" + end]);
|
||
}, []);
|
||
var beforeRead = "beforeRead";
|
||
var read = "read";
|
||
var afterRead = "afterRead";
|
||
var beforeMain = "beforeMain";
|
||
var main = "main";
|
||
var afterMain = "afterMain";
|
||
var beforeWrite = "beforeWrite";
|
||
var write = "write";
|
||
var afterWrite = "afterWrite";
|
||
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
||
function order(modifiers) {
|
||
var map = /* @__PURE__ */ new Map();
|
||
var visited = /* @__PURE__ */ new Set();
|
||
var result = [];
|
||
modifiers.forEach(function(modifier) {
|
||
map.set(modifier.name, modifier);
|
||
});
|
||
function sort(modifier) {
|
||
visited.add(modifier.name);
|
||
var requires = [].concat(modifier.requires || [], modifier.requiresIfExists || []);
|
||
requires.forEach(function(dep) {
|
||
if (!visited.has(dep)) {
|
||
var depModifier = map.get(dep);
|
||
if (depModifier) {
|
||
sort(depModifier);
|
||
}
|
||
}
|
||
});
|
||
result.push(modifier);
|
||
}
|
||
modifiers.forEach(function(modifier) {
|
||
if (!visited.has(modifier.name)) {
|
||
sort(modifier);
|
||
}
|
||
});
|
||
return result;
|
||
}
|
||
function orderModifiers(modifiers) {
|
||
var orderedModifiers = order(modifiers);
|
||
return modifierPhases.reduce(function(acc, phase) {
|
||
return acc.concat(orderedModifiers.filter(function(modifier) {
|
||
return modifier.phase === phase;
|
||
}));
|
||
}, []);
|
||
}
|
||
function debounce(fn) {
|
||
var pending;
|
||
return function() {
|
||
if (!pending) {
|
||
pending = new Promise(function(resolve) {
|
||
Promise.resolve().then(function() {
|
||
pending = void 0;
|
||
resolve(fn());
|
||
});
|
||
});
|
||
}
|
||
return pending;
|
||
};
|
||
}
|
||
function format(str) {
|
||
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
||
args[_key - 1] = arguments[_key];
|
||
}
|
||
return [].concat(args).reduce(function(p, c) {
|
||
return p.replace(/%s/, c);
|
||
}, str);
|
||
}
|
||
var INVALID_MODIFIER_ERROR = 'Popper: modifier "%s" provided an invalid %s property, expected %s but got %s';
|
||
var MISSING_DEPENDENCY_ERROR = 'Popper: modifier "%s" requires "%s", but "%s" modifier is not available';
|
||
var VALID_PROPERTIES = ["name", "enabled", "phase", "fn", "effect", "requires", "options"];
|
||
function validateModifiers(modifiers) {
|
||
modifiers.forEach(function(modifier) {
|
||
[].concat(Object.keys(modifier), VALID_PROPERTIES).filter(function(value, index, self) {
|
||
return self.indexOf(value) === index;
|
||
}).forEach(function(key) {
|
||
switch (key) {
|
||
case "name":
|
||
if (typeof modifier.name !== "string") {
|
||
console.error(format(INVALID_MODIFIER_ERROR, String(modifier.name), '"name"', '"string"', '"' + String(modifier.name) + '"'));
|
||
}
|
||
break;
|
||
case "enabled":
|
||
if (typeof modifier.enabled !== "boolean") {
|
||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"enabled"', '"boolean"', '"' + String(modifier.enabled) + '"'));
|
||
}
|
||
break;
|
||
case "phase":
|
||
if (modifierPhases.indexOf(modifier.phase) < 0) {
|
||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"phase"', "either " + modifierPhases.join(", "), '"' + String(modifier.phase) + '"'));
|
||
}
|
||
break;
|
||
case "fn":
|
||
if (typeof modifier.fn !== "function") {
|
||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"fn"', '"function"', '"' + String(modifier.fn) + '"'));
|
||
}
|
||
break;
|
||
case "effect":
|
||
if (modifier.effect != null && typeof modifier.effect !== "function") {
|
||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"effect"', '"function"', '"' + String(modifier.fn) + '"'));
|
||
}
|
||
break;
|
||
case "requires":
|
||
if (modifier.requires != null && !Array.isArray(modifier.requires)) {
|
||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requires"', '"array"', '"' + String(modifier.requires) + '"'));
|
||
}
|
||
break;
|
||
case "requiresIfExists":
|
||
if (!Array.isArray(modifier.requiresIfExists)) {
|
||
console.error(format(INVALID_MODIFIER_ERROR, modifier.name, '"requiresIfExists"', '"array"', '"' + String(modifier.requiresIfExists) + '"'));
|
||
}
|
||
break;
|
||
case "options":
|
||
case "data":
|
||
break;
|
||
default:
|
||
console.error('PopperJS: an invalid property has been provided to the "' + modifier.name + '" modifier, valid properties are ' + VALID_PROPERTIES.map(function(s) {
|
||
return '"' + s + '"';
|
||
}).join(", ") + '; but "' + key + '" was provided.');
|
||
}
|
||
modifier.requires && modifier.requires.forEach(function(requirement) {
|
||
if (modifiers.find(function(mod) {
|
||
return mod.name === requirement;
|
||
}) == null) {
|
||
console.error(format(MISSING_DEPENDENCY_ERROR, String(modifier.name), requirement, requirement));
|
||
}
|
||
});
|
||
});
|
||
});
|
||
}
|
||
function uniqueBy(arr, fn) {
|
||
var identifiers = /* @__PURE__ */ new Set();
|
||
return arr.filter(function(item) {
|
||
var identifier = fn(item);
|
||
if (!identifiers.has(identifier)) {
|
||
identifiers.add(identifier);
|
||
return true;
|
||
}
|
||
});
|
||
}
|
||
function getBasePlacement(placement) {
|
||
return placement.split("-")[0];
|
||
}
|
||
function mergeByName(modifiers) {
|
||
var merged = modifiers.reduce(function(merged2, current) {
|
||
var existing = merged2[current.name];
|
||
merged2[current.name] = existing ? Object.assign({}, existing, current, {
|
||
options: Object.assign({}, existing.options, current.options),
|
||
data: Object.assign({}, existing.data, current.data)
|
||
}) : current;
|
||
return merged2;
|
||
}, {});
|
||
return Object.keys(merged).map(function(key) {
|
||
return merged[key];
|
||
});
|
||
}
|
||
function getViewportRect(element) {
|
||
var win = getWindow(element);
|
||
var html = getDocumentElement(element);
|
||
var visualViewport = win.visualViewport;
|
||
var width = html.clientWidth;
|
||
var height = html.clientHeight;
|
||
var x = 0;
|
||
var y = 0;
|
||
if (visualViewport) {
|
||
width = visualViewport.width;
|
||
height = visualViewport.height;
|
||
if (!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)) {
|
||
x = visualViewport.offsetLeft;
|
||
y = visualViewport.offsetTop;
|
||
}
|
||
}
|
||
return {
|
||
width,
|
||
height,
|
||
x: x + getWindowScrollBarX(element),
|
||
y
|
||
};
|
||
}
|
||
function getDocumentRect(element) {
|
||
var _element$ownerDocumen;
|
||
var html = getDocumentElement(element);
|
||
var winScroll = getWindowScroll(element);
|
||
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
||
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
||
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
||
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
||
var y = -winScroll.scrollTop;
|
||
if (getComputedStyle2(body || html).direction === "rtl") {
|
||
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
||
}
|
||
return {
|
||
width,
|
||
height,
|
||
x,
|
||
y
|
||
};
|
||
}
|
||
function contains(parent, child) {
|
||
var rootNode = child.getRootNode && child.getRootNode();
|
||
if (parent.contains(child)) {
|
||
return true;
|
||
} else if (rootNode && isShadowRoot(rootNode)) {
|
||
var next = child;
|
||
do {
|
||
if (next && parent.isSameNode(next)) {
|
||
return true;
|
||
}
|
||
next = next.parentNode || next.host;
|
||
} while (next);
|
||
}
|
||
return false;
|
||
}
|
||
function rectToClientRect(rect) {
|
||
return Object.assign({}, rect, {
|
||
left: rect.x,
|
||
top: rect.y,
|
||
right: rect.x + rect.width,
|
||
bottom: rect.y + rect.height
|
||
});
|
||
}
|
||
function getInnerBoundingClientRect(element) {
|
||
var rect = getBoundingClientRect(element);
|
||
rect.top = rect.top + element.clientTop;
|
||
rect.left = rect.left + element.clientLeft;
|
||
rect.bottom = rect.top + element.clientHeight;
|
||
rect.right = rect.left + element.clientWidth;
|
||
rect.width = element.clientWidth;
|
||
rect.height = element.clientHeight;
|
||
rect.x = rect.left;
|
||
rect.y = rect.top;
|
||
return rect;
|
||
}
|
||
function getClientRectFromMixedType(element, clippingParent) {
|
||
return clippingParent === viewport ? rectToClientRect(getViewportRect(element)) : isElement2(clippingParent) ? getInnerBoundingClientRect(clippingParent) : rectToClientRect(getDocumentRect(getDocumentElement(element)));
|
||
}
|
||
function getClippingParents(element) {
|
||
var clippingParents2 = listScrollParents(getParentNode(element));
|
||
var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle2(element).position) >= 0;
|
||
var clipperElement = canEscapeClipping && isHTMLElement(element) ? getOffsetParent(element) : element;
|
||
if (!isElement2(clipperElement)) {
|
||
return [];
|
||
}
|
||
return clippingParents2.filter(function(clippingParent) {
|
||
return isElement2(clippingParent) && contains(clippingParent, clipperElement) && getNodeName(clippingParent) !== "body" && (canEscapeClipping ? getComputedStyle2(clippingParent).position !== "static" : true);
|
||
});
|
||
}
|
||
function getClippingRect(element, boundary, rootBoundary) {
|
||
var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
|
||
var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
|
||
var firstClippingParent = clippingParents2[0];
|
||
var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
|
||
var rect = getClientRectFromMixedType(element, clippingParent);
|
||
accRect.top = max(rect.top, accRect.top);
|
||
accRect.right = min(rect.right, accRect.right);
|
||
accRect.bottom = min(rect.bottom, accRect.bottom);
|
||
accRect.left = max(rect.left, accRect.left);
|
||
return accRect;
|
||
}, getClientRectFromMixedType(element, firstClippingParent));
|
||
clippingRect.width = clippingRect.right - clippingRect.left;
|
||
clippingRect.height = clippingRect.bottom - clippingRect.top;
|
||
clippingRect.x = clippingRect.left;
|
||
clippingRect.y = clippingRect.top;
|
||
return clippingRect;
|
||
}
|
||
function getVariation(placement) {
|
||
return placement.split("-")[1];
|
||
}
|
||
function getMainAxisFromPlacement(placement) {
|
||
return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
|
||
}
|
||
function computeOffsets(_ref) {
|
||
var reference2 = _ref.reference, element = _ref.element, placement = _ref.placement;
|
||
var basePlacement = placement ? getBasePlacement(placement) : null;
|
||
var variation = placement ? getVariation(placement) : null;
|
||
var commonX = reference2.x + reference2.width / 2 - element.width / 2;
|
||
var commonY = reference2.y + reference2.height / 2 - element.height / 2;
|
||
var offsets;
|
||
switch (basePlacement) {
|
||
case top:
|
||
offsets = {
|
||
x: commonX,
|
||
y: reference2.y - element.height
|
||
};
|
||
break;
|
||
case bottom:
|
||
offsets = {
|
||
x: commonX,
|
||
y: reference2.y + reference2.height
|
||
};
|
||
break;
|
||
case right:
|
||
offsets = {
|
||
x: reference2.x + reference2.width,
|
||
y: commonY
|
||
};
|
||
break;
|
||
case left:
|
||
offsets = {
|
||
x: reference2.x - element.width,
|
||
y: commonY
|
||
};
|
||
break;
|
||
default:
|
||
offsets = {
|
||
x: reference2.x,
|
||
y: reference2.y
|
||
};
|
||
}
|
||
var mainAxis = basePlacement ? getMainAxisFromPlacement(basePlacement) : null;
|
||
if (mainAxis != null) {
|
||
var len = mainAxis === "y" ? "height" : "width";
|
||
switch (variation) {
|
||
case start:
|
||
offsets[mainAxis] = offsets[mainAxis] - (reference2[len] / 2 - element[len] / 2);
|
||
break;
|
||
case end:
|
||
offsets[mainAxis] = offsets[mainAxis] + (reference2[len] / 2 - element[len] / 2);
|
||
break;
|
||
}
|
||
}
|
||
return offsets;
|
||
}
|
||
function getFreshSideObject() {
|
||
return {
|
||
top: 0,
|
||
right: 0,
|
||
bottom: 0,
|
||
left: 0
|
||
};
|
||
}
|
||
function mergePaddingObject(paddingObject) {
|
||
return Object.assign({}, getFreshSideObject(), paddingObject);
|
||
}
|
||
function expandToHashMap(value, keys) {
|
||
return keys.reduce(function(hashMap, key) {
|
||
hashMap[key] = value;
|
||
return hashMap;
|
||
}, {});
|
||
}
|
||
function detectOverflow(state, options) {
|
||
if (options === void 0) {
|
||
options = {};
|
||
}
|
||
var _options = options, _options$placement = _options.placement, placement = _options$placement === void 0 ? state.placement : _options$placement, _options$boundary = _options.boundary, boundary = _options$boundary === void 0 ? clippingParents : _options$boundary, _options$rootBoundary = _options.rootBoundary, rootBoundary = _options$rootBoundary === void 0 ? viewport : _options$rootBoundary, _options$elementConte = _options.elementContext, elementContext = _options$elementConte === void 0 ? popper : _options$elementConte, _options$altBoundary = _options.altBoundary, altBoundary = _options$altBoundary === void 0 ? false : _options$altBoundary, _options$padding = _options.padding, padding = _options$padding === void 0 ? 0 : _options$padding;
|
||
var paddingObject = mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
|
||
var altContext = elementContext === popper ? reference : popper;
|
||
var popperRect = state.rects.popper;
|
||
var element = state.elements[altBoundary ? altContext : elementContext];
|
||
var clippingClientRect = getClippingRect(isElement2(element) ? element : element.contextElement || getDocumentElement(state.elements.popper), boundary, rootBoundary);
|
||
var referenceClientRect = getBoundingClientRect(state.elements.reference);
|
||
var popperOffsets2 = computeOffsets({
|
||
reference: referenceClientRect,
|
||
element: popperRect,
|
||
strategy: "absolute",
|
||
placement
|
||
});
|
||
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
|
||
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
|
||
var overflowOffsets = {
|
||
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
||
bottom: elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom,
|
||
left: clippingClientRect.left - elementClientRect.left + paddingObject.left,
|
||
right: elementClientRect.right - clippingClientRect.right + paddingObject.right
|
||
};
|
||
var offsetData = state.modifiersData.offset;
|
||
if (elementContext === popper && offsetData) {
|
||
var offset2 = offsetData[placement];
|
||
Object.keys(overflowOffsets).forEach(function(key) {
|
||
var multiply = [right, bottom].indexOf(key) >= 0 ? 1 : -1;
|
||
var axis = [top, bottom].indexOf(key) >= 0 ? "y" : "x";
|
||
overflowOffsets[key] += offset2[axis] * multiply;
|
||
});
|
||
}
|
||
return overflowOffsets;
|
||
}
|
||
var INVALID_ELEMENT_ERROR = "Popper: Invalid reference or popper argument provided. They must be either a DOM element or virtual element.";
|
||
var INFINITE_LOOP_ERROR = "Popper: An infinite loop in the modifiers cycle has been detected! The cycle has been interrupted to prevent a browser crash.";
|
||
var DEFAULT_OPTIONS = {
|
||
placement: "bottom",
|
||
modifiers: [],
|
||
strategy: "absolute"
|
||
};
|
||
function areValidElements() {
|
||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
||
args[_key] = arguments[_key];
|
||
}
|
||
return !args.some(function(element) {
|
||
return !(element && typeof element.getBoundingClientRect === "function");
|
||
});
|
||
}
|
||
function popperGenerator(generatorOptions) {
|
||
if (generatorOptions === void 0) {
|
||
generatorOptions = {};
|
||
}
|
||
var _generatorOptions = generatorOptions, _generatorOptions$def = _generatorOptions.defaultModifiers, defaultModifiers2 = _generatorOptions$def === void 0 ? [] : _generatorOptions$def, _generatorOptions$def2 = _generatorOptions.defaultOptions, defaultOptions = _generatorOptions$def2 === void 0 ? DEFAULT_OPTIONS : _generatorOptions$def2;
|
||
return function createPopper3(reference2, popper2, options) {
|
||
if (options === void 0) {
|
||
options = defaultOptions;
|
||
}
|
||
var state = {
|
||
placement: "bottom",
|
||
orderedModifiers: [],
|
||
options: Object.assign({}, DEFAULT_OPTIONS, defaultOptions),
|
||
modifiersData: {},
|
||
elements: {
|
||
reference: reference2,
|
||
popper: popper2
|
||
},
|
||
attributes: {},
|
||
styles: {}
|
||
};
|
||
var effectCleanupFns = [];
|
||
var isDestroyed = false;
|
||
var instance = {
|
||
state,
|
||
setOptions: function setOptions(setOptionsAction) {
|
||
var options2 = typeof setOptionsAction === "function" ? setOptionsAction(state.options) : setOptionsAction;
|
||
cleanupModifierEffects();
|
||
state.options = Object.assign({}, defaultOptions, state.options, options2);
|
||
state.scrollParents = {
|
||
reference: isElement2(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
|
||
popper: listScrollParents(popper2)
|
||
};
|
||
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state.options.modifiers)));
|
||
state.orderedModifiers = orderedModifiers.filter(function(m) {
|
||
return m.enabled;
|
||
});
|
||
if (true) {
|
||
var modifiers = uniqueBy([].concat(orderedModifiers, state.options.modifiers), function(_ref) {
|
||
var name = _ref.name;
|
||
return name;
|
||
});
|
||
validateModifiers(modifiers);
|
||
if (getBasePlacement(state.options.placement) === auto) {
|
||
var flipModifier = state.orderedModifiers.find(function(_ref2) {
|
||
var name = _ref2.name;
|
||
return name === "flip";
|
||
});
|
||
if (!flipModifier) {
|
||
console.error(['Popper: "auto" placements require the "flip" modifier be', "present and enabled to work."].join(" "));
|
||
}
|
||
}
|
||
var _getComputedStyle = getComputedStyle2(popper2), marginTop = _getComputedStyle.marginTop, marginRight = _getComputedStyle.marginRight, marginBottom = _getComputedStyle.marginBottom, marginLeft = _getComputedStyle.marginLeft;
|
||
if ([marginTop, marginRight, marginBottom, marginLeft].some(function(margin) {
|
||
return parseFloat(margin);
|
||
})) {
|
||
console.warn(['Popper: CSS "margin" styles cannot be used to apply padding', "between the popper and its reference element or boundary.", "To replicate margin, use the `offset` modifier, as well as", "the `padding` option in the `preventOverflow` and `flip`", "modifiers."].join(" "));
|
||
}
|
||
}
|
||
runModifierEffects();
|
||
return instance.update();
|
||
},
|
||
// Sync update – it will always be executed, even if not necessary. This
|
||
// is useful for low frequency updates where sync behavior simplifies the
|
||
// logic.
|
||
// For high frequency updates (e.g. `resize` and `scroll` events), always
|
||
// prefer the async Popper#update method
|
||
forceUpdate: function forceUpdate() {
|
||
if (isDestroyed) {
|
||
return;
|
||
}
|
||
var _state$elements = state.elements, reference3 = _state$elements.reference, popper3 = _state$elements.popper;
|
||
if (!areValidElements(reference3, popper3)) {
|
||
if (true) {
|
||
console.error(INVALID_ELEMENT_ERROR);
|
||
}
|
||
return;
|
||
}
|
||
state.rects = {
|
||
reference: getCompositeRect(reference3, getOffsetParent(popper3), state.options.strategy === "fixed"),
|
||
popper: getLayoutRect(popper3)
|
||
};
|
||
state.reset = false;
|
||
state.placement = state.options.placement;
|
||
state.orderedModifiers.forEach(function(modifier) {
|
||
return state.modifiersData[modifier.name] = Object.assign({}, modifier.data);
|
||
});
|
||
var __debug_loops__ = 0;
|
||
for (var index = 0; index < state.orderedModifiers.length; index++) {
|
||
if (true) {
|
||
__debug_loops__ += 1;
|
||
if (__debug_loops__ > 100) {
|
||
console.error(INFINITE_LOOP_ERROR);
|
||
break;
|
||
}
|
||
}
|
||
if (state.reset === true) {
|
||
state.reset = false;
|
||
index = -1;
|
||
continue;
|
||
}
|
||
var _state$orderedModifie = state.orderedModifiers[index], fn = _state$orderedModifie.fn, _state$orderedModifie2 = _state$orderedModifie.options, _options = _state$orderedModifie2 === void 0 ? {} : _state$orderedModifie2, name = _state$orderedModifie.name;
|
||
if (typeof fn === "function") {
|
||
state = fn({
|
||
state,
|
||
options: _options,
|
||
name,
|
||
instance
|
||
}) || state;
|
||
}
|
||
}
|
||
},
|
||
// Async and optimistically optimized update – it will not be executed if
|
||
// not necessary (debounced to run at most once-per-tick)
|
||
update: debounce(function() {
|
||
return new Promise(function(resolve) {
|
||
instance.forceUpdate();
|
||
resolve(state);
|
||
});
|
||
}),
|
||
destroy: function destroy() {
|
||
cleanupModifierEffects();
|
||
isDestroyed = true;
|
||
}
|
||
};
|
||
if (!areValidElements(reference2, popper2)) {
|
||
if (true) {
|
||
console.error(INVALID_ELEMENT_ERROR);
|
||
}
|
||
return instance;
|
||
}
|
||
instance.setOptions(options).then(function(state2) {
|
||
if (!isDestroyed && options.onFirstUpdate) {
|
||
options.onFirstUpdate(state2);
|
||
}
|
||
});
|
||
function runModifierEffects() {
|
||
state.orderedModifiers.forEach(function(_ref3) {
|
||
var name = _ref3.name, _ref3$options = _ref3.options, options2 = _ref3$options === void 0 ? {} : _ref3$options, effect2 = _ref3.effect;
|
||
if (typeof effect2 === "function") {
|
||
var cleanupFn = effect2({
|
||
state,
|
||
name,
|
||
instance,
|
||
options: options2
|
||
});
|
||
var noopFn = function noopFn2() {
|
||
};
|
||
effectCleanupFns.push(cleanupFn || noopFn);
|
||
}
|
||
});
|
||
}
|
||
function cleanupModifierEffects() {
|
||
effectCleanupFns.forEach(function(fn) {
|
||
return fn();
|
||
});
|
||
effectCleanupFns = [];
|
||
}
|
||
return instance;
|
||
};
|
||
}
|
||
var passive = {
|
||
passive: true
|
||
};
|
||
function effect$2(_ref) {
|
||
var state = _ref.state, instance = _ref.instance, options = _ref.options;
|
||
var _options$scroll = options.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options.resize, resize = _options$resize === void 0 ? true : _options$resize;
|
||
var window2 = getWindow(state.elements.popper);
|
||
var scrollParents = [].concat(state.scrollParents.reference, state.scrollParents.popper);
|
||
if (scroll) {
|
||
scrollParents.forEach(function(scrollParent) {
|
||
scrollParent.addEventListener("scroll", instance.update, passive);
|
||
});
|
||
}
|
||
if (resize) {
|
||
window2.addEventListener("resize", instance.update, passive);
|
||
}
|
||
return function() {
|
||
if (scroll) {
|
||
scrollParents.forEach(function(scrollParent) {
|
||
scrollParent.removeEventListener("scroll", instance.update, passive);
|
||
});
|
||
}
|
||
if (resize) {
|
||
window2.removeEventListener("resize", instance.update, passive);
|
||
}
|
||
};
|
||
}
|
||
var eventListeners = {
|
||
name: "eventListeners",
|
||
enabled: true,
|
||
phase: "write",
|
||
fn: function fn() {
|
||
},
|
||
effect: effect$2,
|
||
data: {}
|
||
};
|
||
function popperOffsets(_ref) {
|
||
var state = _ref.state, name = _ref.name;
|
||
state.modifiersData[name] = computeOffsets({
|
||
reference: state.rects.reference,
|
||
element: state.rects.popper,
|
||
strategy: "absolute",
|
||
placement: state.placement
|
||
});
|
||
}
|
||
var popperOffsets$1 = {
|
||
name: "popperOffsets",
|
||
enabled: true,
|
||
phase: "read",
|
||
fn: popperOffsets,
|
||
data: {}
|
||
};
|
||
var unsetSides = {
|
||
top: "auto",
|
||
right: "auto",
|
||
bottom: "auto",
|
||
left: "auto"
|
||
};
|
||
function roundOffsetsByDPR(_ref) {
|
||
var x = _ref.x, y = _ref.y;
|
||
var win = window;
|
||
var dpr = win.devicePixelRatio || 1;
|
||
return {
|
||
x: round(x * dpr) / dpr || 0,
|
||
y: round(y * dpr) / dpr || 0
|
||
};
|
||
}
|
||
function mapToStyles(_ref2) {
|
||
var _Object$assign2;
|
||
var popper2 = _ref2.popper, popperRect = _ref2.popperRect, placement = _ref2.placement, variation = _ref2.variation, offsets = _ref2.offsets, position = _ref2.position, gpuAcceleration = _ref2.gpuAcceleration, adaptive = _ref2.adaptive, roundOffsets = _ref2.roundOffsets, isFixed = _ref2.isFixed;
|
||
var _ref3 = roundOffsets === true ? roundOffsetsByDPR(offsets) : typeof roundOffsets === "function" ? roundOffsets(offsets) : offsets, _ref3$x = _ref3.x, x = _ref3$x === void 0 ? 0 : _ref3$x, _ref3$y = _ref3.y, y = _ref3$y === void 0 ? 0 : _ref3$y;
|
||
var hasX = offsets.hasOwnProperty("x");
|
||
var hasY = offsets.hasOwnProperty("y");
|
||
var sideX = left;
|
||
var sideY = top;
|
||
var win = window;
|
||
if (adaptive) {
|
||
var offsetParent = getOffsetParent(popper2);
|
||
var heightProp = "clientHeight";
|
||
var widthProp = "clientWidth";
|
||
if (offsetParent === getWindow(popper2)) {
|
||
offsetParent = getDocumentElement(popper2);
|
||
if (getComputedStyle2(offsetParent).position !== "static" && position === "absolute") {
|
||
heightProp = "scrollHeight";
|
||
widthProp = "scrollWidth";
|
||
}
|
||
}
|
||
offsetParent = offsetParent;
|
||
if (placement === top || (placement === left || placement === right) && variation === end) {
|
||
sideY = bottom;
|
||
var offsetY = isFixed && win.visualViewport ? win.visualViewport.height : (
|
||
// $FlowFixMe[prop-missing]
|
||
offsetParent[heightProp]
|
||
);
|
||
y -= offsetY - popperRect.height;
|
||
y *= gpuAcceleration ? 1 : -1;
|
||
}
|
||
if (placement === left || (placement === top || placement === bottom) && variation === end) {
|
||
sideX = right;
|
||
var offsetX = isFixed && win.visualViewport ? win.visualViewport.width : (
|
||
// $FlowFixMe[prop-missing]
|
||
offsetParent[widthProp]
|
||
);
|
||
x -= offsetX - popperRect.width;
|
||
x *= gpuAcceleration ? 1 : -1;
|
||
}
|
||
}
|
||
var commonStyles = Object.assign({
|
||
position
|
||
}, adaptive && unsetSides);
|
||
if (gpuAcceleration) {
|
||
var _Object$assign;
|
||
return Object.assign({}, commonStyles, (_Object$assign = {}, _Object$assign[sideY] = hasY ? "0" : "", _Object$assign[sideX] = hasX ? "0" : "", _Object$assign.transform = (win.devicePixelRatio || 1) <= 1 ? "translate(" + x + "px, " + y + "px)" : "translate3d(" + x + "px, " + y + "px, 0)", _Object$assign));
|
||
}
|
||
return Object.assign({}, commonStyles, (_Object$assign2 = {}, _Object$assign2[sideY] = hasY ? y + "px" : "", _Object$assign2[sideX] = hasX ? x + "px" : "", _Object$assign2.transform = "", _Object$assign2));
|
||
}
|
||
function computeStyles(_ref4) {
|
||
var state = _ref4.state, options = _ref4.options;
|
||
var _options$gpuAccelerat = options.gpuAcceleration, gpuAcceleration = _options$gpuAccelerat === void 0 ? true : _options$gpuAccelerat, _options$adaptive = options.adaptive, adaptive = _options$adaptive === void 0 ? true : _options$adaptive, _options$roundOffsets = options.roundOffsets, roundOffsets = _options$roundOffsets === void 0 ? true : _options$roundOffsets;
|
||
if (true) {
|
||
var transitionProperty = getComputedStyle2(state.elements.popper).transitionProperty || "";
|
||
if (adaptive && ["transform", "top", "right", "bottom", "left"].some(function(property) {
|
||
return transitionProperty.indexOf(property) >= 0;
|
||
})) {
|
||
console.warn(["Popper: Detected CSS transitions on at least one of the following", 'CSS properties: "transform", "top", "right", "bottom", "left".', "\n\n", 'Disable the "computeStyles" modifier\'s `adaptive` option to allow', "for smooth transitions, or remove these properties from the CSS", "transition declaration on the popper element if only transitioning", "opacity or background-color for example.", "\n\n", "We recommend using the popper element as a wrapper around an inner", "element that can have any CSS property transitioned for animations."].join(" "));
|
||
}
|
||
}
|
||
var commonStyles = {
|
||
placement: getBasePlacement(state.placement),
|
||
variation: getVariation(state.placement),
|
||
popper: state.elements.popper,
|
||
popperRect: state.rects.popper,
|
||
gpuAcceleration,
|
||
isFixed: state.options.strategy === "fixed"
|
||
};
|
||
if (state.modifiersData.popperOffsets != null) {
|
||
state.styles.popper = Object.assign({}, state.styles.popper, mapToStyles(Object.assign({}, commonStyles, {
|
||
offsets: state.modifiersData.popperOffsets,
|
||
position: state.options.strategy,
|
||
adaptive,
|
||
roundOffsets
|
||
})));
|
||
}
|
||
if (state.modifiersData.arrow != null) {
|
||
state.styles.arrow = Object.assign({}, state.styles.arrow, mapToStyles(Object.assign({}, commonStyles, {
|
||
offsets: state.modifiersData.arrow,
|
||
position: "absolute",
|
||
adaptive: false,
|
||
roundOffsets
|
||
})));
|
||
}
|
||
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
||
"data-popper-placement": state.placement
|
||
});
|
||
}
|
||
var computeStyles$1 = {
|
||
name: "computeStyles",
|
||
enabled: true,
|
||
phase: "beforeWrite",
|
||
fn: computeStyles,
|
||
data: {}
|
||
};
|
||
function applyStyles(_ref) {
|
||
var state = _ref.state;
|
||
Object.keys(state.elements).forEach(function(name) {
|
||
var style = state.styles[name] || {};
|
||
var attributes = state.attributes[name] || {};
|
||
var element = state.elements[name];
|
||
if (!isHTMLElement(element) || !getNodeName(element)) {
|
||
return;
|
||
}
|
||
Object.assign(element.style, style);
|
||
Object.keys(attributes).forEach(function(name2) {
|
||
var value = attributes[name2];
|
||
if (value === false) {
|
||
element.removeAttribute(name2);
|
||
} else {
|
||
element.setAttribute(name2, value === true ? "" : value);
|
||
}
|
||
});
|
||
});
|
||
}
|
||
function effect$1(_ref2) {
|
||
var state = _ref2.state;
|
||
var initialStyles = {
|
||
popper: {
|
||
position: state.options.strategy,
|
||
left: "0",
|
||
top: "0",
|
||
margin: "0"
|
||
},
|
||
arrow: {
|
||
position: "absolute"
|
||
},
|
||
reference: {}
|
||
};
|
||
Object.assign(state.elements.popper.style, initialStyles.popper);
|
||
state.styles = initialStyles;
|
||
if (state.elements.arrow) {
|
||
Object.assign(state.elements.arrow.style, initialStyles.arrow);
|
||
}
|
||
return function() {
|
||
Object.keys(state.elements).forEach(function(name) {
|
||
var element = state.elements[name];
|
||
var attributes = state.attributes[name] || {};
|
||
var styleProperties = Object.keys(state.styles.hasOwnProperty(name) ? state.styles[name] : initialStyles[name]);
|
||
var style = styleProperties.reduce(function(style2, property) {
|
||
style2[property] = "";
|
||
return style2;
|
||
}, {});
|
||
if (!isHTMLElement(element) || !getNodeName(element)) {
|
||
return;
|
||
}
|
||
Object.assign(element.style, style);
|
||
Object.keys(attributes).forEach(function(attribute) {
|
||
element.removeAttribute(attribute);
|
||
});
|
||
});
|
||
};
|
||
}
|
||
var applyStyles$1 = {
|
||
name: "applyStyles",
|
||
enabled: true,
|
||
phase: "write",
|
||
fn: applyStyles,
|
||
effect: effect$1,
|
||
requires: ["computeStyles"]
|
||
};
|
||
function distanceAndSkiddingToXY(placement, rects, offset2) {
|
||
var basePlacement = getBasePlacement(placement);
|
||
var invertDistance = [left, top].indexOf(basePlacement) >= 0 ? -1 : 1;
|
||
var _ref = typeof offset2 === "function" ? offset2(Object.assign({}, rects, {
|
||
placement
|
||
})) : offset2, skidding = _ref[0], distance = _ref[1];
|
||
skidding = skidding || 0;
|
||
distance = (distance || 0) * invertDistance;
|
||
return [left, right].indexOf(basePlacement) >= 0 ? {
|
||
x: distance,
|
||
y: skidding
|
||
} : {
|
||
x: skidding,
|
||
y: distance
|
||
};
|
||
}
|
||
function offset(_ref2) {
|
||
var state = _ref2.state, options = _ref2.options, name = _ref2.name;
|
||
var _options$offset = options.offset, offset2 = _options$offset === void 0 ? [0, 0] : _options$offset;
|
||
var data = placements.reduce(function(acc, placement) {
|
||
acc[placement] = distanceAndSkiddingToXY(placement, state.rects, offset2);
|
||
return acc;
|
||
}, {});
|
||
var _data$state$placement = data[state.placement], x = _data$state$placement.x, y = _data$state$placement.y;
|
||
if (state.modifiersData.popperOffsets != null) {
|
||
state.modifiersData.popperOffsets.x += x;
|
||
state.modifiersData.popperOffsets.y += y;
|
||
}
|
||
state.modifiersData[name] = data;
|
||
}
|
||
var offset$1 = {
|
||
name: "offset",
|
||
enabled: true,
|
||
phase: "main",
|
||
requires: ["popperOffsets"],
|
||
fn: offset
|
||
};
|
||
var hash$1 = {
|
||
left: "right",
|
||
right: "left",
|
||
bottom: "top",
|
||
top: "bottom"
|
||
};
|
||
function getOppositePlacement(placement) {
|
||
return placement.replace(/left|right|bottom|top/g, function(matched) {
|
||
return hash$1[matched];
|
||
});
|
||
}
|
||
var hash = {
|
||
start: "end",
|
||
end: "start"
|
||
};
|
||
function getOppositeVariationPlacement(placement) {
|
||
return placement.replace(/start|end/g, function(matched) {
|
||
return hash[matched];
|
||
});
|
||
}
|
||
function computeAutoPlacement(state, options) {
|
||
if (options === void 0) {
|
||
options = {};
|
||
}
|
||
var _options = options, placement = _options.placement, boundary = _options.boundary, rootBoundary = _options.rootBoundary, padding = _options.padding, flipVariations = _options.flipVariations, _options$allowedAutoP = _options.allowedAutoPlacements, allowedAutoPlacements = _options$allowedAutoP === void 0 ? placements : _options$allowedAutoP;
|
||
var variation = getVariation(placement);
|
||
var placements$1 = variation ? flipVariations ? variationPlacements : variationPlacements.filter(function(placement2) {
|
||
return getVariation(placement2) === variation;
|
||
}) : basePlacements;
|
||
var allowedPlacements = placements$1.filter(function(placement2) {
|
||
return allowedAutoPlacements.indexOf(placement2) >= 0;
|
||
});
|
||
if (allowedPlacements.length === 0) {
|
||
allowedPlacements = placements$1;
|
||
if (true) {
|
||
console.error(["Popper: The `allowedAutoPlacements` option did not allow any", "placements. Ensure the `placement` option matches the variation", "of the allowed placements.", 'For example, "auto" cannot be used to allow "bottom-start".', 'Use "auto-start" instead.'].join(" "));
|
||
}
|
||
}
|
||
var overflows = allowedPlacements.reduce(function(acc, placement2) {
|
||
acc[placement2] = detectOverflow(state, {
|
||
placement: placement2,
|
||
boundary,
|
||
rootBoundary,
|
||
padding
|
||
})[getBasePlacement(placement2)];
|
||
return acc;
|
||
}, {});
|
||
return Object.keys(overflows).sort(function(a, b) {
|
||
return overflows[a] - overflows[b];
|
||
});
|
||
}
|
||
function getExpandedFallbackPlacements(placement) {
|
||
if (getBasePlacement(placement) === auto) {
|
||
return [];
|
||
}
|
||
var oppositePlacement = getOppositePlacement(placement);
|
||
return [getOppositeVariationPlacement(placement), oppositePlacement, getOppositeVariationPlacement(oppositePlacement)];
|
||
}
|
||
function flip(_ref) {
|
||
var state = _ref.state, options = _ref.options, name = _ref.name;
|
||
if (state.modifiersData[name]._skip) {
|
||
return;
|
||
}
|
||
var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? true : _options$altAxis, specifiedFallbackPlacements = options.fallbackPlacements, padding = options.padding, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, _options$flipVariatio = options.flipVariations, flipVariations = _options$flipVariatio === void 0 ? true : _options$flipVariatio, allowedAutoPlacements = options.allowedAutoPlacements;
|
||
var preferredPlacement = state.options.placement;
|
||
var basePlacement = getBasePlacement(preferredPlacement);
|
||
var isBasePlacement = basePlacement === preferredPlacement;
|
||
var fallbackPlacements = specifiedFallbackPlacements || (isBasePlacement || !flipVariations ? [getOppositePlacement(preferredPlacement)] : getExpandedFallbackPlacements(preferredPlacement));
|
||
var placements2 = [preferredPlacement].concat(fallbackPlacements).reduce(function(acc, placement2) {
|
||
return acc.concat(getBasePlacement(placement2) === auto ? computeAutoPlacement(state, {
|
||
placement: placement2,
|
||
boundary,
|
||
rootBoundary,
|
||
padding,
|
||
flipVariations,
|
||
allowedAutoPlacements
|
||
}) : placement2);
|
||
}, []);
|
||
var referenceRect = state.rects.reference;
|
||
var popperRect = state.rects.popper;
|
||
var checksMap = /* @__PURE__ */ new Map();
|
||
var makeFallbackChecks = true;
|
||
var firstFittingPlacement = placements2[0];
|
||
for (var i = 0; i < placements2.length; i++) {
|
||
var placement = placements2[i];
|
||
var _basePlacement = getBasePlacement(placement);
|
||
var isStartVariation = getVariation(placement) === start;
|
||
var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
|
||
var len = isVertical ? "width" : "height";
|
||
var overflow = detectOverflow(state, {
|
||
placement,
|
||
boundary,
|
||
rootBoundary,
|
||
altBoundary,
|
||
padding
|
||
});
|
||
var mainVariationSide = isVertical ? isStartVariation ? right : left : isStartVariation ? bottom : top;
|
||
if (referenceRect[len] > popperRect[len]) {
|
||
mainVariationSide = getOppositePlacement(mainVariationSide);
|
||
}
|
||
var altVariationSide = getOppositePlacement(mainVariationSide);
|
||
var checks = [];
|
||
if (checkMainAxis) {
|
||
checks.push(overflow[_basePlacement] <= 0);
|
||
}
|
||
if (checkAltAxis) {
|
||
checks.push(overflow[mainVariationSide] <= 0, overflow[altVariationSide] <= 0);
|
||
}
|
||
if (checks.every(function(check) {
|
||
return check;
|
||
})) {
|
||
firstFittingPlacement = placement;
|
||
makeFallbackChecks = false;
|
||
break;
|
||
}
|
||
checksMap.set(placement, checks);
|
||
}
|
||
if (makeFallbackChecks) {
|
||
var numberOfChecks = flipVariations ? 3 : 1;
|
||
var _loop = function _loop2(_i2) {
|
||
var fittingPlacement = placements2.find(function(placement2) {
|
||
var checks2 = checksMap.get(placement2);
|
||
if (checks2) {
|
||
return checks2.slice(0, _i2).every(function(check) {
|
||
return check;
|
||
});
|
||
}
|
||
});
|
||
if (fittingPlacement) {
|
||
firstFittingPlacement = fittingPlacement;
|
||
return "break";
|
||
}
|
||
};
|
||
for (var _i = numberOfChecks; _i > 0; _i--) {
|
||
var _ret = _loop(_i);
|
||
if (_ret === "break") break;
|
||
}
|
||
}
|
||
if (state.placement !== firstFittingPlacement) {
|
||
state.modifiersData[name]._skip = true;
|
||
state.placement = firstFittingPlacement;
|
||
state.reset = true;
|
||
}
|
||
}
|
||
var flip$1 = {
|
||
name: "flip",
|
||
enabled: true,
|
||
phase: "main",
|
||
fn: flip,
|
||
requiresIfExists: ["offset"],
|
||
data: {
|
||
_skip: false
|
||
}
|
||
};
|
||
function getAltAxis(axis) {
|
||
return axis === "x" ? "y" : "x";
|
||
}
|
||
function within(min$1, value, max$1) {
|
||
return max(min$1, min(value, max$1));
|
||
}
|
||
function withinMaxClamp(min2, value, max2) {
|
||
var v = within(min2, value, max2);
|
||
return v > max2 ? max2 : v;
|
||
}
|
||
function preventOverflow(_ref) {
|
||
var state = _ref.state, options = _ref.options, name = _ref.name;
|
||
var _options$mainAxis = options.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options.boundary, rootBoundary = options.rootBoundary, altBoundary = options.altBoundary, padding = options.padding, _options$tether = options.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
|
||
var overflow = detectOverflow(state, {
|
||
boundary,
|
||
rootBoundary,
|
||
padding,
|
||
altBoundary
|
||
});
|
||
var basePlacement = getBasePlacement(state.placement);
|
||
var variation = getVariation(state.placement);
|
||
var isBasePlacement = !variation;
|
||
var mainAxis = getMainAxisFromPlacement(basePlacement);
|
||
var altAxis = getAltAxis(mainAxis);
|
||
var popperOffsets2 = state.modifiersData.popperOffsets;
|
||
var referenceRect = state.rects.reference;
|
||
var popperRect = state.rects.popper;
|
||
var tetherOffsetValue = typeof tetherOffset === "function" ? tetherOffset(Object.assign({}, state.rects, {
|
||
placement: state.placement
|
||
})) : tetherOffset;
|
||
var normalizedTetherOffsetValue = typeof tetherOffsetValue === "number" ? {
|
||
mainAxis: tetherOffsetValue,
|
||
altAxis: tetherOffsetValue
|
||
} : Object.assign({
|
||
mainAxis: 0,
|
||
altAxis: 0
|
||
}, tetherOffsetValue);
|
||
var offsetModifierState = state.modifiersData.offset ? state.modifiersData.offset[state.placement] : null;
|
||
var data = {
|
||
x: 0,
|
||
y: 0
|
||
};
|
||
if (!popperOffsets2) {
|
||
return;
|
||
}
|
||
if (checkMainAxis) {
|
||
var _offsetModifierState$;
|
||
var mainSide = mainAxis === "y" ? top : left;
|
||
var altSide = mainAxis === "y" ? bottom : right;
|
||
var len = mainAxis === "y" ? "height" : "width";
|
||
var offset2 = popperOffsets2[mainAxis];
|
||
var min$1 = offset2 + overflow[mainSide];
|
||
var max$1 = offset2 - overflow[altSide];
|
||
var additive = tether ? -popperRect[len] / 2 : 0;
|
||
var minLen = variation === start ? referenceRect[len] : popperRect[len];
|
||
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
|
||
var arrowElement = state.elements.arrow;
|
||
var arrowRect = tether && arrowElement ? getLayoutRect(arrowElement) : {
|
||
width: 0,
|
||
height: 0
|
||
};
|
||
var arrowPaddingObject = state.modifiersData["arrow#persistent"] ? state.modifiersData["arrow#persistent"].padding : getFreshSideObject();
|
||
var arrowPaddingMin = arrowPaddingObject[mainSide];
|
||
var arrowPaddingMax = arrowPaddingObject[altSide];
|
||
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
||
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
|
||
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
|
||
var arrowOffsetParent = state.elements.arrow && getOffsetParent(state.elements.arrow);
|
||
var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
|
||
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
|
||
var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
|
||
var tetherMax = offset2 + maxOffset - offsetModifierValue;
|
||
var preventedOffset = within(tether ? min(min$1, tetherMin) : min$1, offset2, tether ? max(max$1, tetherMax) : max$1);
|
||
popperOffsets2[mainAxis] = preventedOffset;
|
||
data[mainAxis] = preventedOffset - offset2;
|
||
}
|
||
if (checkAltAxis) {
|
||
var _offsetModifierState$2;
|
||
var _mainSide = mainAxis === "x" ? top : left;
|
||
var _altSide = mainAxis === "x" ? bottom : right;
|
||
var _offset = popperOffsets2[altAxis];
|
||
var _len = altAxis === "y" ? "height" : "width";
|
||
var _min = _offset + overflow[_mainSide];
|
||
var _max = _offset - overflow[_altSide];
|
||
var isOriginSide = [top, left].indexOf(basePlacement) !== -1;
|
||
var _offsetModifierValue = (_offsetModifierState$2 = offsetModifierState == null ? void 0 : offsetModifierState[altAxis]) != null ? _offsetModifierState$2 : 0;
|
||
var _tetherMin = isOriginSide ? _min : _offset - referenceRect[_len] - popperRect[_len] - _offsetModifierValue + normalizedTetherOffsetValue.altAxis;
|
||
var _tetherMax = isOriginSide ? _offset + referenceRect[_len] + popperRect[_len] - _offsetModifierValue - normalizedTetherOffsetValue.altAxis : _max;
|
||
var _preventedOffset = tether && isOriginSide ? withinMaxClamp(_tetherMin, _offset, _tetherMax) : within(tether ? _tetherMin : _min, _offset, tether ? _tetherMax : _max);
|
||
popperOffsets2[altAxis] = _preventedOffset;
|
||
data[altAxis] = _preventedOffset - _offset;
|
||
}
|
||
state.modifiersData[name] = data;
|
||
}
|
||
var preventOverflow$1 = {
|
||
name: "preventOverflow",
|
||
enabled: true,
|
||
phase: "main",
|
||
fn: preventOverflow,
|
||
requiresIfExists: ["offset"]
|
||
};
|
||
var toPaddingObject = function toPaddingObject2(padding, state) {
|
||
padding = typeof padding === "function" ? padding(Object.assign({}, state.rects, {
|
||
placement: state.placement
|
||
})) : padding;
|
||
return mergePaddingObject(typeof padding !== "number" ? padding : expandToHashMap(padding, basePlacements));
|
||
};
|
||
function arrow(_ref) {
|
||
var _state$modifiersData$;
|
||
var state = _ref.state, name = _ref.name, options = _ref.options;
|
||
var arrowElement = state.elements.arrow;
|
||
var popperOffsets2 = state.modifiersData.popperOffsets;
|
||
var basePlacement = getBasePlacement(state.placement);
|
||
var axis = getMainAxisFromPlacement(basePlacement);
|
||
var isVertical = [left, right].indexOf(basePlacement) >= 0;
|
||
var len = isVertical ? "height" : "width";
|
||
if (!arrowElement || !popperOffsets2) {
|
||
return;
|
||
}
|
||
var paddingObject = toPaddingObject(options.padding, state);
|
||
var arrowRect = getLayoutRect(arrowElement);
|
||
var minProp = axis === "y" ? top : left;
|
||
var maxProp = axis === "y" ? bottom : right;
|
||
var endDiff = state.rects.reference[len] + state.rects.reference[axis] - popperOffsets2[axis] - state.rects.popper[len];
|
||
var startDiff = popperOffsets2[axis] - state.rects.reference[axis];
|
||
var arrowOffsetParent = getOffsetParent(arrowElement);
|
||
var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
|
||
var centerToReference = endDiff / 2 - startDiff / 2;
|
||
var min2 = paddingObject[minProp];
|
||
var max2 = clientSize - arrowRect[len] - paddingObject[maxProp];
|
||
var center = clientSize / 2 - arrowRect[len] / 2 + centerToReference;
|
||
var offset2 = within(min2, center, max2);
|
||
var axisProp = axis;
|
||
state.modifiersData[name] = (_state$modifiersData$ = {}, _state$modifiersData$[axisProp] = offset2, _state$modifiersData$.centerOffset = offset2 - center, _state$modifiersData$);
|
||
}
|
||
function effect(_ref2) {
|
||
var state = _ref2.state, options = _ref2.options;
|
||
var _options$element = options.element, arrowElement = _options$element === void 0 ? "[data-popper-arrow]" : _options$element;
|
||
if (arrowElement == null) {
|
||
return;
|
||
}
|
||
if (typeof arrowElement === "string") {
|
||
arrowElement = state.elements.popper.querySelector(arrowElement);
|
||
if (!arrowElement) {
|
||
return;
|
||
}
|
||
}
|
||
if (true) {
|
||
if (!isHTMLElement(arrowElement)) {
|
||
console.error(['Popper: "arrow" element must be an HTMLElement (not an SVGElement).', "To use an SVG arrow, wrap it in an HTMLElement that will be used as", "the arrow."].join(" "));
|
||
}
|
||
}
|
||
if (!contains(state.elements.popper, arrowElement)) {
|
||
if (true) {
|
||
console.error(['Popper: "arrow" modifier\'s `element` must be a child of the popper', "element."].join(" "));
|
||
}
|
||
return;
|
||
}
|
||
state.elements.arrow = arrowElement;
|
||
}
|
||
var arrow$1 = {
|
||
name: "arrow",
|
||
enabled: true,
|
||
phase: "main",
|
||
fn: arrow,
|
||
effect,
|
||
requires: ["popperOffsets"],
|
||
requiresIfExists: ["preventOverflow"]
|
||
};
|
||
function getSideOffsets(overflow, rect, preventedOffsets) {
|
||
if (preventedOffsets === void 0) {
|
||
preventedOffsets = {
|
||
x: 0,
|
||
y: 0
|
||
};
|
||
}
|
||
return {
|
||
top: overflow.top - rect.height - preventedOffsets.y,
|
||
right: overflow.right - rect.width + preventedOffsets.x,
|
||
bottom: overflow.bottom - rect.height + preventedOffsets.y,
|
||
left: overflow.left - rect.width - preventedOffsets.x
|
||
};
|
||
}
|
||
function isAnySideFullyClipped(overflow) {
|
||
return [top, right, bottom, left].some(function(side) {
|
||
return overflow[side] >= 0;
|
||
});
|
||
}
|
||
function hide(_ref) {
|
||
var state = _ref.state, name = _ref.name;
|
||
var referenceRect = state.rects.reference;
|
||
var popperRect = state.rects.popper;
|
||
var preventedOffsets = state.modifiersData.preventOverflow;
|
||
var referenceOverflow = detectOverflow(state, {
|
||
elementContext: "reference"
|
||
});
|
||
var popperAltOverflow = detectOverflow(state, {
|
||
altBoundary: true
|
||
});
|
||
var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
|
||
var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
|
||
var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
|
||
var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
|
||
state.modifiersData[name] = {
|
||
referenceClippingOffsets,
|
||
popperEscapeOffsets,
|
||
isReferenceHidden,
|
||
hasPopperEscaped
|
||
};
|
||
state.attributes.popper = Object.assign({}, state.attributes.popper, {
|
||
"data-popper-reference-hidden": isReferenceHidden,
|
||
"data-popper-escaped": hasPopperEscaped
|
||
});
|
||
}
|
||
var hide$1 = {
|
||
name: "hide",
|
||
enabled: true,
|
||
phase: "main",
|
||
requiresIfExists: ["preventOverflow"],
|
||
fn: hide
|
||
};
|
||
var defaultModifiers$1 = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1];
|
||
var createPopper$1 = /* @__PURE__ */ popperGenerator({
|
||
defaultModifiers: defaultModifiers$1
|
||
});
|
||
var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$1];
|
||
var createPopper2 = /* @__PURE__ */ popperGenerator({
|
||
defaultModifiers
|
||
});
|
||
exports.applyStyles = applyStyles$1;
|
||
exports.arrow = arrow$1;
|
||
exports.computeStyles = computeStyles$1;
|
||
exports.createPopper = createPopper2;
|
||
exports.createPopperLite = createPopper$1;
|
||
exports.defaultModifiers = defaultModifiers;
|
||
exports.detectOverflow = detectOverflow;
|
||
exports.eventListeners = eventListeners;
|
||
exports.flip = flip$1;
|
||
exports.hide = hide$1;
|
||
exports.offset = offset$1;
|
||
exports.popperGenerator = popperGenerator;
|
||
exports.popperOffsets = popperOffsets$1;
|
||
exports.preventOverflow = preventOverflow$1;
|
||
}
|
||
});
|
||
|
||
// ns-hugo-imp:/home/joren/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/bootstrap@v5.3.2+incompatible/js/src/dom/data.js
|
||
var elementMap = /* @__PURE__ */ new Map();
|
||
var data_default = {
|
||
set(element, key, instance) {
|
||
if (!elementMap.has(element)) {
|
||
elementMap.set(element, /* @__PURE__ */ new Map());
|
||
}
|
||
const instanceMap = elementMap.get(element);
|
||
if (!instanceMap.has(key) && instanceMap.size !== 0) {
|
||
console.error(`Bootstrap doesn't allow more than one instance per element. Bound instance: ${Array.from(instanceMap.keys())[0]}.`);
|
||
return;
|
||
}
|
||
instanceMap.set(key, instance);
|
||
},
|
||
get(element, key) {
|
||
if (elementMap.has(element)) {
|
||
return elementMap.get(element).get(key) || null;
|
||
}
|
||
return null;
|
||
},
|
||
remove(element, key) {
|
||
if (!elementMap.has(element)) {
|
||
return;
|
||
}
|
||
const instanceMap = elementMap.get(element);
|
||
instanceMap.delete(key);
|
||
if (instanceMap.size === 0) {
|
||
elementMap.delete(element);
|
||
}
|
||
}
|
||
};
|
||
|
||
// ns-hugo-imp:/home/joren/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/bootstrap@v5.3.2+incompatible/js/src/util/index.js
|
||
var MILLISECONDS_MULTIPLIER = 1e3;
|
||
var TRANSITION_END = "transitionend";
|
||
var parseSelector = (selector) => {
|
||
if (selector && window.CSS && window.CSS.escape) {
|
||
selector = selector.replace(/#([^\s"#']+)/g, (match, id) => `#${CSS.escape(id)}`);
|
||
}
|
||
return selector;
|
||
};
|
||
var toType = (object) => {
|
||
if (object === null || object === void 0) {
|
||
return `${object}`;
|
||
}
|
||
return Object.prototype.toString.call(object).match(/\s([a-z]+)/i)[1].toLowerCase();
|
||
};
|
||
var getTransitionDurationFromElement = (element) => {
|
||
if (!element) {
|
||
return 0;
|
||
}
|
||
let { transitionDuration, transitionDelay } = window.getComputedStyle(element);
|
||
const floatTransitionDuration = Number.parseFloat(transitionDuration);
|
||
const floatTransitionDelay = Number.parseFloat(transitionDelay);
|
||
if (!floatTransitionDuration && !floatTransitionDelay) {
|
||
return 0;
|
||
}
|
||
transitionDuration = transitionDuration.split(",")[0];
|
||
transitionDelay = transitionDelay.split(",")[0];
|
||
return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER;
|
||
};
|
||
var triggerTransitionEnd = (element) => {
|
||
element.dispatchEvent(new Event(TRANSITION_END));
|
||
};
|
||
var isElement = (object) => {
|
||
if (!object || typeof object !== "object") {
|
||
return false;
|
||
}
|
||
if (typeof object.jquery !== "undefined") {
|
||
object = object[0];
|
||
}
|
||
return typeof object.nodeType !== "undefined";
|
||
};
|
||
var getElement = (object) => {
|
||
if (isElement(object)) {
|
||
return object.jquery ? object[0] : object;
|
||
}
|
||
if (typeof object === "string" && object.length > 0) {
|
||
return document.querySelector(parseSelector(object));
|
||
}
|
||
return null;
|
||
};
|
||
var isVisible = (element) => {
|
||
if (!isElement(element) || element.getClientRects().length === 0) {
|
||
return false;
|
||
}
|
||
const elementIsVisible = getComputedStyle(element).getPropertyValue("visibility") === "visible";
|
||
const closedDetails = element.closest("details:not([open])");
|
||
if (!closedDetails) {
|
||
return elementIsVisible;
|
||
}
|
||
if (closedDetails !== element) {
|
||
const summary = element.closest("summary");
|
||
if (summary && summary.parentNode !== closedDetails) {
|
||
return false;
|
||
}
|
||
if (summary === null) {
|
||
return false;
|
||
}
|
||
}
|
||
return elementIsVisible;
|
||
};
|
||
var isDisabled = (element) => {
|
||
if (!element || element.nodeType !== Node.ELEMENT_NODE) {
|
||
return true;
|
||
}
|
||
if (element.classList.contains("disabled")) {
|
||
return true;
|
||
}
|
||
if (typeof element.disabled !== "undefined") {
|
||
return element.disabled;
|
||
}
|
||
return element.hasAttribute("disabled") && element.getAttribute("disabled") !== "false";
|
||
};
|
||
var noop = () => {
|
||
};
|
||
var reflow = (element) => {
|
||
element.offsetHeight;
|
||
};
|
||
var getjQuery = () => {
|
||
if (window.jQuery && !document.body.hasAttribute("data-bs-no-jquery")) {
|
||
return window.jQuery;
|
||
}
|
||
return null;
|
||
};
|
||
var DOMContentLoadedCallbacks = [];
|
||
var onDOMContentLoaded = (callback) => {
|
||
if (document.readyState === "loading") {
|
||
if (!DOMContentLoadedCallbacks.length) {
|
||
document.addEventListener("DOMContentLoaded", () => {
|
||
for (const callback2 of DOMContentLoadedCallbacks) {
|
||
callback2();
|
||
}
|
||
});
|
||
}
|
||
DOMContentLoadedCallbacks.push(callback);
|
||
} else {
|
||
callback();
|
||
}
|
||
};
|
||
var isRTL = () => document.documentElement.dir === "rtl";
|
||
var defineJQueryPlugin = (plugin) => {
|
||
onDOMContentLoaded(() => {
|
||
const $ = getjQuery();
|
||
if ($) {
|
||
const name = plugin.NAME;
|
||
const JQUERY_NO_CONFLICT = $.fn[name];
|
||
$.fn[name] = plugin.jQueryInterface;
|
||
$.fn[name].Constructor = plugin;
|
||
$.fn[name].noConflict = () => {
|
||
$.fn[name] = JQUERY_NO_CONFLICT;
|
||
return plugin.jQueryInterface;
|
||
};
|
||
}
|
||
});
|
||
};
|
||
var execute = (possibleCallback, args = [], defaultValue = possibleCallback) => {
|
||
return typeof possibleCallback === "function" ? possibleCallback(...args) : defaultValue;
|
||
};
|
||
var executeAfterTransition = (callback, transitionElement, waitForTransition = true) => {
|
||
if (!waitForTransition) {
|
||
execute(callback);
|
||
return;
|
||
}
|
||
const durationPadding = 5;
|
||
const emulatedDuration = getTransitionDurationFromElement(transitionElement) + durationPadding;
|
||
let called = false;
|
||
const handler = ({ target }) => {
|
||
if (target !== transitionElement) {
|
||
return;
|
||
}
|
||
called = true;
|
||
transitionElement.removeEventListener(TRANSITION_END, handler);
|
||
execute(callback);
|
||
};
|
||
transitionElement.addEventListener(TRANSITION_END, handler);
|
||
setTimeout(() => {
|
||
if (!called) {
|
||
triggerTransitionEnd(transitionElement);
|
||
}
|
||
}, emulatedDuration);
|
||
};
|
||
var getNextActiveElement = (list, activeElement, shouldGetNext, isCycleAllowed) => {
|
||
const listLength = list.length;
|
||
let index = list.indexOf(activeElement);
|
||
if (index === -1) {
|
||
return !shouldGetNext && isCycleAllowed ? list[listLength - 1] : list[0];
|
||
}
|
||
index += shouldGetNext ? 1 : -1;
|
||
if (isCycleAllowed) {
|
||
index = (index + listLength) % listLength;
|
||
}
|
||
return list[Math.max(0, Math.min(index, listLength - 1))];
|
||
};
|
||
|
||
// ns-hugo-imp:/home/joren/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/bootstrap@v5.3.2+incompatible/js/src/dom/event-handler.js
|
||
var namespaceRegex = /[^.]*(?=\..*)\.|.*/;
|
||
var stripNameRegex = /\..*/;
|
||
var stripUidRegex = /::\d+$/;
|
||
var eventRegistry = {};
|
||
var uidEvent = 1;
|
||
var customEvents = {
|
||
mouseenter: "mouseover",
|
||
mouseleave: "mouseout"
|
||
};
|
||
var nativeEvents = /* @__PURE__ */ new Set([
|
||
"click",
|
||
"dblclick",
|
||
"mouseup",
|
||
"mousedown",
|
||
"contextmenu",
|
||
"mousewheel",
|
||
"DOMMouseScroll",
|
||
"mouseover",
|
||
"mouseout",
|
||
"mousemove",
|
||
"selectstart",
|
||
"selectend",
|
||
"keydown",
|
||
"keypress",
|
||
"keyup",
|
||
"orientationchange",
|
||
"touchstart",
|
||
"touchmove",
|
||
"touchend",
|
||
"touchcancel",
|
||
"pointerdown",
|
||
"pointermove",
|
||
"pointerup",
|
||
"pointerleave",
|
||
"pointercancel",
|
||
"gesturestart",
|
||
"gesturechange",
|
||
"gestureend",
|
||
"focus",
|
||
"blur",
|
||
"change",
|
||
"reset",
|
||
"select",
|
||
"submit",
|
||
"focusin",
|
||
"focusout",
|
||
"load",
|
||
"unload",
|
||
"beforeunload",
|
||
"resize",
|
||
"move",
|
||
"DOMContentLoaded",
|
||
"readystatechange",
|
||
"error",
|
||
"abort",
|
||
"scroll"
|
||
]);
|
||
function makeEventUid(element, uid) {
|
||
return uid && `${uid}::${uidEvent++}` || element.uidEvent || uidEvent++;
|
||
}
|
||
function getElementEvents(element) {
|
||
const uid = makeEventUid(element);
|
||
element.uidEvent = uid;
|
||
eventRegistry[uid] = eventRegistry[uid] || {};
|
||
return eventRegistry[uid];
|
||
}
|
||
function bootstrapHandler(element, fn) {
|
||
return function handler(event) {
|
||
hydrateObj(event, { delegateTarget: element });
|
||
if (handler.oneOff) {
|
||
EventHandler.off(element, event.type, fn);
|
||
}
|
||
return fn.apply(element, [event]);
|
||
};
|
||
}
|
||
function bootstrapDelegationHandler(element, selector, fn) {
|
||
return function handler(event) {
|
||
const domElements = element.querySelectorAll(selector);
|
||
for (let { target } = event; target && target !== this; target = target.parentNode) {
|
||
for (const domElement of domElements) {
|
||
if (domElement !== target) {
|
||
continue;
|
||
}
|
||
hydrateObj(event, { delegateTarget: target });
|
||
if (handler.oneOff) {
|
||
EventHandler.off(element, event.type, selector, fn);
|
||
}
|
||
return fn.apply(target, [event]);
|
||
}
|
||
}
|
||
};
|
||
}
|
||
function findHandler(events, callable, delegationSelector = null) {
|
||
return Object.values(events).find((event) => event.callable === callable && event.delegationSelector === delegationSelector);
|
||
}
|
||
function normalizeParameters(originalTypeEvent, handler, delegationFunction) {
|
||
const isDelegated = typeof handler === "string";
|
||
const callable = isDelegated ? delegationFunction : handler || delegationFunction;
|
||
let typeEvent = getTypeEvent(originalTypeEvent);
|
||
if (!nativeEvents.has(typeEvent)) {
|
||
typeEvent = originalTypeEvent;
|
||
}
|
||
return [isDelegated, callable, typeEvent];
|
||
}
|
||
function addHandler(element, originalTypeEvent, handler, delegationFunction, oneOff) {
|
||
if (typeof originalTypeEvent !== "string" || !element) {
|
||
return;
|
||
}
|
||
let [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
|
||
if (originalTypeEvent in customEvents) {
|
||
const wrapFunction = (fn2) => {
|
||
return function(event) {
|
||
if (!event.relatedTarget || event.relatedTarget !== event.delegateTarget && !event.delegateTarget.contains(event.relatedTarget)) {
|
||
return fn2.call(this, event);
|
||
}
|
||
};
|
||
};
|
||
callable = wrapFunction(callable);
|
||
}
|
||
const events = getElementEvents(element);
|
||
const handlers = events[typeEvent] || (events[typeEvent] = {});
|
||
const previousFunction = findHandler(handlers, callable, isDelegated ? handler : null);
|
||
if (previousFunction) {
|
||
previousFunction.oneOff = previousFunction.oneOff && oneOff;
|
||
return;
|
||
}
|
||
const uid = makeEventUid(callable, originalTypeEvent.replace(namespaceRegex, ""));
|
||
const fn = isDelegated ? bootstrapDelegationHandler(element, handler, callable) : bootstrapHandler(element, callable);
|
||
fn.delegationSelector = isDelegated ? handler : null;
|
||
fn.callable = callable;
|
||
fn.oneOff = oneOff;
|
||
fn.uidEvent = uid;
|
||
handlers[uid] = fn;
|
||
element.addEventListener(typeEvent, fn, isDelegated);
|
||
}
|
||
function removeHandler(element, events, typeEvent, handler, delegationSelector) {
|
||
const fn = findHandler(events[typeEvent], handler, delegationSelector);
|
||
if (!fn) {
|
||
return;
|
||
}
|
||
element.removeEventListener(typeEvent, fn, Boolean(delegationSelector));
|
||
delete events[typeEvent][fn.uidEvent];
|
||
}
|
||
function removeNamespacedHandlers(element, events, typeEvent, namespace) {
|
||
const storeElementEvent = events[typeEvent] || {};
|
||
for (const [handlerKey, event] of Object.entries(storeElementEvent)) {
|
||
if (handlerKey.includes(namespace)) {
|
||
removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
|
||
}
|
||
}
|
||
}
|
||
function getTypeEvent(event) {
|
||
event = event.replace(stripNameRegex, "");
|
||
return customEvents[event] || event;
|
||
}
|
||
var EventHandler = {
|
||
on(element, event, handler, delegationFunction) {
|
||
addHandler(element, event, handler, delegationFunction, false);
|
||
},
|
||
one(element, event, handler, delegationFunction) {
|
||
addHandler(element, event, handler, delegationFunction, true);
|
||
},
|
||
off(element, originalTypeEvent, handler, delegationFunction) {
|
||
if (typeof originalTypeEvent !== "string" || !element) {
|
||
return;
|
||
}
|
||
const [isDelegated, callable, typeEvent] = normalizeParameters(originalTypeEvent, handler, delegationFunction);
|
||
const inNamespace = typeEvent !== originalTypeEvent;
|
||
const events = getElementEvents(element);
|
||
const storeElementEvent = events[typeEvent] || {};
|
||
const isNamespace = originalTypeEvent.startsWith(".");
|
||
if (typeof callable !== "undefined") {
|
||
if (!Object.keys(storeElementEvent).length) {
|
||
return;
|
||
}
|
||
removeHandler(element, events, typeEvent, callable, isDelegated ? handler : null);
|
||
return;
|
||
}
|
||
if (isNamespace) {
|
||
for (const elementEvent of Object.keys(events)) {
|
||
removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1));
|
||
}
|
||
}
|
||
for (const [keyHandlers, event] of Object.entries(storeElementEvent)) {
|
||
const handlerKey = keyHandlers.replace(stripUidRegex, "");
|
||
if (!inNamespace || originalTypeEvent.includes(handlerKey)) {
|
||
removeHandler(element, events, typeEvent, event.callable, event.delegationSelector);
|
||
}
|
||
}
|
||
},
|
||
trigger(element, event, args) {
|
||
if (typeof event !== "string" || !element) {
|
||
return null;
|
||
}
|
||
const $ = getjQuery();
|
||
const typeEvent = getTypeEvent(event);
|
||
const inNamespace = event !== typeEvent;
|
||
let jQueryEvent = null;
|
||
let bubbles = true;
|
||
let nativeDispatch = true;
|
||
let defaultPrevented = false;
|
||
if (inNamespace && $) {
|
||
jQueryEvent = $.Event(event, args);
|
||
$(element).trigger(jQueryEvent);
|
||
bubbles = !jQueryEvent.isPropagationStopped();
|
||
nativeDispatch = !jQueryEvent.isImmediatePropagationStopped();
|
||
defaultPrevented = jQueryEvent.isDefaultPrevented();
|
||
}
|
||
const evt = hydrateObj(new Event(event, { bubbles, cancelable: true }), args);
|
||
if (defaultPrevented) {
|
||
evt.preventDefault();
|
||
}
|
||
if (nativeDispatch) {
|
||
element.dispatchEvent(evt);
|
||
}
|
||
if (evt.defaultPrevented && jQueryEvent) {
|
||
jQueryEvent.preventDefault();
|
||
}
|
||
return evt;
|
||
}
|
||
};
|
||
function hydrateObj(obj, meta = {}) {
|
||
for (const [key, value] of Object.entries(meta)) {
|
||
try {
|
||
obj[key] = value;
|
||
} catch (e) {
|
||
Object.defineProperty(obj, key, {
|
||
configurable: true,
|
||
get() {
|
||
return value;
|
||
}
|
||
});
|
||
}
|
||
}
|
||
return obj;
|
||
}
|
||
var event_handler_default = EventHandler;
|
||
|
||
// ns-hugo-imp:/home/joren/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/bootstrap@v5.3.2+incompatible/js/src/dom/manipulator.js
|
||
function normalizeData(value) {
|
||
if (value === "true") {
|
||
return true;
|
||
}
|
||
if (value === "false") {
|
||
return false;
|
||
}
|
||
if (value === Number(value).toString()) {
|
||
return Number(value);
|
||
}
|
||
if (value === "" || value === "null") {
|
||
return null;
|
||
}
|
||
if (typeof value !== "string") {
|
||
return value;
|
||
}
|
||
try {
|
||
return JSON.parse(decodeURIComponent(value));
|
||
} catch (e) {
|
||
return value;
|
||
}
|
||
}
|
||
function normalizeDataKey(key) {
|
||
return key.replace(/[A-Z]/g, (chr) => `-${chr.toLowerCase()}`);
|
||
}
|
||
var Manipulator = {
|
||
setDataAttribute(element, key, value) {
|
||
element.setAttribute(`data-bs-${normalizeDataKey(key)}`, value);
|
||
},
|
||
removeDataAttribute(element, key) {
|
||
element.removeAttribute(`data-bs-${normalizeDataKey(key)}`);
|
||
},
|
||
getDataAttributes(element) {
|
||
if (!element) {
|
||
return {};
|
||
}
|
||
const attributes = {};
|
||
const bsKeys = Object.keys(element.dataset).filter((key) => key.startsWith("bs") && !key.startsWith("bsConfig"));
|
||
for (const key of bsKeys) {
|
||
let pureKey = key.replace(/^bs/, "");
|
||
pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length);
|
||
attributes[pureKey] = normalizeData(element.dataset[key]);
|
||
}
|
||
return attributes;
|
||
},
|
||
getDataAttribute(element, key) {
|
||
return normalizeData(element.getAttribute(`data-bs-${normalizeDataKey(key)}`));
|
||
}
|
||
};
|
||
var manipulator_default = Manipulator;
|
||
|
||
// ns-hugo-imp:/home/joren/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/bootstrap@v5.3.2+incompatible/js/src/util/config.js
|
||
var Config = class {
|
||
// Getters
|
||
static get Default() {
|
||
return {};
|
||
}
|
||
static get DefaultType() {
|
||
return {};
|
||
}
|
||
static get NAME() {
|
||
throw new Error('You have to implement the static method "NAME", for each component!');
|
||
}
|
||
_getConfig(config) {
|
||
config = this._mergeConfigObj(config);
|
||
config = this._configAfterMerge(config);
|
||
this._typeCheckConfig(config);
|
||
return config;
|
||
}
|
||
_configAfterMerge(config) {
|
||
return config;
|
||
}
|
||
_mergeConfigObj(config, element) {
|
||
const jsonConfig = isElement(element) ? manipulator_default.getDataAttribute(element, "config") : {};
|
||
return {
|
||
...this.constructor.Default,
|
||
...typeof jsonConfig === "object" ? jsonConfig : {},
|
||
...isElement(element) ? manipulator_default.getDataAttributes(element) : {},
|
||
...typeof config === "object" ? config : {}
|
||
};
|
||
}
|
||
_typeCheckConfig(config, configTypes = this.constructor.DefaultType) {
|
||
for (const [property, expectedTypes] of Object.entries(configTypes)) {
|
||
const value = config[property];
|
||
const valueType = isElement(value) ? "element" : toType(value);
|
||
if (!new RegExp(expectedTypes).test(valueType)) {
|
||
throw new TypeError(
|
||
`${this.constructor.NAME.toUpperCase()}: Option "${property}" provided type "${valueType}" but expected type "${expectedTypes}".`
|
||
);
|
||
}
|
||
}
|
||
}
|
||
};
|
||
var config_default = Config;
|
||
|
||
// ns-hugo-imp:/home/joren/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/bootstrap@v5.3.2+incompatible/js/src/base-component.js
|
||
var VERSION = "5.3.2";
|
||
var BaseComponent = class extends config_default {
|
||
constructor(element, config) {
|
||
super();
|
||
element = getElement(element);
|
||
if (!element) {
|
||
return;
|
||
}
|
||
this._element = element;
|
||
this._config = this._getConfig(config);
|
||
data_default.set(this._element, this.constructor.DATA_KEY, this);
|
||
}
|
||
// Public
|
||
dispose() {
|
||
data_default.remove(this._element, this.constructor.DATA_KEY);
|
||
event_handler_default.off(this._element, this.constructor.EVENT_KEY);
|
||
for (const propertyName of Object.getOwnPropertyNames(this)) {
|
||
this[propertyName] = null;
|
||
}
|
||
}
|
||
_queueCallback(callback, element, isAnimated = true) {
|
||
executeAfterTransition(callback, element, isAnimated);
|
||
}
|
||
_getConfig(config) {
|
||
config = this._mergeConfigObj(config, this._element);
|
||
config = this._configAfterMerge(config);
|
||
this._typeCheckConfig(config);
|
||
return config;
|
||
}
|
||
// Static
|
||
static getInstance(element) {
|
||
return data_default.get(getElement(element), this.DATA_KEY);
|
||
}
|
||
static getOrCreateInstance(element, config = {}) {
|
||
return this.getInstance(element) || new this(element, typeof config === "object" ? config : null);
|
||
}
|
||
static get VERSION() {
|
||
return VERSION;
|
||
}
|
||
static get DATA_KEY() {
|
||
return `bs.${this.NAME}`;
|
||
}
|
||
static get EVENT_KEY() {
|
||
return `.${this.DATA_KEY}`;
|
||
}
|
||
static eventName(name) {
|
||
return `${name}${this.EVENT_KEY}`;
|
||
}
|
||
};
|
||
var base_component_default = BaseComponent;
|
||
|
||
// ns-hugo-imp:/home/joren/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/bootstrap@v5.3.2+incompatible/js/src/dom/selector-engine.js
|
||
var getSelector = (element) => {
|
||
let selector = element.getAttribute("data-bs-target");
|
||
if (!selector || selector === "#") {
|
||
let hrefAttribute = element.getAttribute("href");
|
||
if (!hrefAttribute || !hrefAttribute.includes("#") && !hrefAttribute.startsWith(".")) {
|
||
return null;
|
||
}
|
||
if (hrefAttribute.includes("#") && !hrefAttribute.startsWith("#")) {
|
||
hrefAttribute = `#${hrefAttribute.split("#")[1]}`;
|
||
}
|
||
selector = hrefAttribute && hrefAttribute !== "#" ? parseSelector(hrefAttribute.trim()) : null;
|
||
}
|
||
return selector;
|
||
};
|
||
var SelectorEngine = {
|
||
find(selector, element = document.documentElement) {
|
||
return [].concat(...Element.prototype.querySelectorAll.call(element, selector));
|
||
},
|
||
findOne(selector, element = document.documentElement) {
|
||
return Element.prototype.querySelector.call(element, selector);
|
||
},
|
||
children(element, selector) {
|
||
return [].concat(...element.children).filter((child) => child.matches(selector));
|
||
},
|
||
parents(element, selector) {
|
||
const parents = [];
|
||
let ancestor = element.parentNode.closest(selector);
|
||
while (ancestor) {
|
||
parents.push(ancestor);
|
||
ancestor = ancestor.parentNode.closest(selector);
|
||
}
|
||
return parents;
|
||
},
|
||
prev(element, selector) {
|
||
let previous = element.previousElementSibling;
|
||
while (previous) {
|
||
if (previous.matches(selector)) {
|
||
return [previous];
|
||
}
|
||
previous = previous.previousElementSibling;
|
||
}
|
||
return [];
|
||
},
|
||
// TODO: this is now unused; remove later along with prev()
|
||
next(element, selector) {
|
||
let next = element.nextElementSibling;
|
||
while (next) {
|
||
if (next.matches(selector)) {
|
||
return [next];
|
||
}
|
||
next = next.nextElementSibling;
|
||
}
|
||
return [];
|
||
},
|
||
focusableChildren(element) {
|
||
const focusables = [
|
||
"a",
|
||
"button",
|
||
"input",
|
||
"textarea",
|
||
"select",
|
||
"details",
|
||
"[tabindex]",
|
||
'[contenteditable="true"]'
|
||
].map((selector) => `${selector}:not([tabindex^="-"])`).join(",");
|
||
return this.find(focusables, element).filter((el) => !isDisabled(el) && isVisible(el));
|
||
},
|
||
getSelectorFromElement(element) {
|
||
const selector = getSelector(element);
|
||
if (selector) {
|
||
return SelectorEngine.findOne(selector) ? selector : null;
|
||
}
|
||
return null;
|
||
},
|
||
getElementFromSelector(element) {
|
||
const selector = getSelector(element);
|
||
return selector ? SelectorEngine.findOne(selector) : null;
|
||
},
|
||
getMultipleElementsFromSelector(element) {
|
||
const selector = getSelector(element);
|
||
return selector ? SelectorEngine.find(selector) : [];
|
||
}
|
||
};
|
||
var selector_engine_default = SelectorEngine;
|
||
|
||
// ns-hugo-imp:/home/joren/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/bootstrap@v5.3.2+incompatible/js/src/collapse.js
|
||
var NAME = "collapse";
|
||
var DATA_KEY = "bs.collapse";
|
||
var EVENT_KEY = `.${DATA_KEY}`;
|
||
var DATA_API_KEY = ".data-api";
|
||
var EVENT_SHOW = `show${EVENT_KEY}`;
|
||
var EVENT_SHOWN = `shown${EVENT_KEY}`;
|
||
var EVENT_HIDE = `hide${EVENT_KEY}`;
|
||
var EVENT_HIDDEN = `hidden${EVENT_KEY}`;
|
||
var EVENT_CLICK_DATA_API = `click${EVENT_KEY}${DATA_API_KEY}`;
|
||
var CLASS_NAME_SHOW = "show";
|
||
var CLASS_NAME_COLLAPSE = "collapse";
|
||
var CLASS_NAME_COLLAPSING = "collapsing";
|
||
var CLASS_NAME_COLLAPSED = "collapsed";
|
||
var CLASS_NAME_DEEPER_CHILDREN = `:scope .${CLASS_NAME_COLLAPSE} .${CLASS_NAME_COLLAPSE}`;
|
||
var CLASS_NAME_HORIZONTAL = "collapse-horizontal";
|
||
var WIDTH = "width";
|
||
var HEIGHT = "height";
|
||
var SELECTOR_ACTIVES = ".collapse.show, .collapse.collapsing";
|
||
var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="collapse"]';
|
||
var Default = {
|
||
parent: null,
|
||
toggle: true
|
||
};
|
||
var DefaultType = {
|
||
parent: "(null|element)",
|
||
toggle: "boolean"
|
||
};
|
||
var Collapse = class _Collapse extends base_component_default {
|
||
constructor(element, config) {
|
||
super(element, config);
|
||
this._isTransitioning = false;
|
||
this._triggerArray = [];
|
||
const toggleList = selector_engine_default.find(SELECTOR_DATA_TOGGLE);
|
||
for (const elem of toggleList) {
|
||
const selector = selector_engine_default.getSelectorFromElement(elem);
|
||
const filterElement = selector_engine_default.find(selector).filter((foundElement) => foundElement === this._element);
|
||
if (selector !== null && filterElement.length) {
|
||
this._triggerArray.push(elem);
|
||
}
|
||
}
|
||
this._initializeChildren();
|
||
if (!this._config.parent) {
|
||
this._addAriaAndCollapsedClass(this._triggerArray, this._isShown());
|
||
}
|
||
if (this._config.toggle) {
|
||
this.toggle();
|
||
}
|
||
}
|
||
// Getters
|
||
static get Default() {
|
||
return Default;
|
||
}
|
||
static get DefaultType() {
|
||
return DefaultType;
|
||
}
|
||
static get NAME() {
|
||
return NAME;
|
||
}
|
||
// Public
|
||
toggle() {
|
||
if (this._isShown()) {
|
||
this.hide();
|
||
} else {
|
||
this.show();
|
||
}
|
||
}
|
||
show() {
|
||
if (this._isTransitioning || this._isShown()) {
|
||
return;
|
||
}
|
||
let activeChildren = [];
|
||
if (this._config.parent) {
|
||
activeChildren = this._getFirstLevelChildren(SELECTOR_ACTIVES).filter((element) => element !== this._element).map((element) => _Collapse.getOrCreateInstance(element, { toggle: false }));
|
||
}
|
||
if (activeChildren.length && activeChildren[0]._isTransitioning) {
|
||
return;
|
||
}
|
||
const startEvent = event_handler_default.trigger(this._element, EVENT_SHOW);
|
||
if (startEvent.defaultPrevented) {
|
||
return;
|
||
}
|
||
for (const activeInstance of activeChildren) {
|
||
activeInstance.hide();
|
||
}
|
||
const dimension = this._getDimension();
|
||
this._element.classList.remove(CLASS_NAME_COLLAPSE);
|
||
this._element.classList.add(CLASS_NAME_COLLAPSING);
|
||
this._element.style[dimension] = 0;
|
||
this._addAriaAndCollapsedClass(this._triggerArray, true);
|
||
this._isTransitioning = true;
|
||
const complete = () => {
|
||
this._isTransitioning = false;
|
||
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
||
this._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
||
this._element.style[dimension] = "";
|
||
event_handler_default.trigger(this._element, EVENT_SHOWN);
|
||
};
|
||
const capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1);
|
||
const scrollSize = `scroll${capitalizedDimension}`;
|
||
this._queueCallback(complete, this._element, true);
|
||
this._element.style[dimension] = `${this._element[scrollSize]}px`;
|
||
}
|
||
hide() {
|
||
if (this._isTransitioning || !this._isShown()) {
|
||
return;
|
||
}
|
||
const startEvent = event_handler_default.trigger(this._element, EVENT_HIDE);
|
||
if (startEvent.defaultPrevented) {
|
||
return;
|
||
}
|
||
const dimension = this._getDimension();
|
||
this._element.style[dimension] = `${this._element.getBoundingClientRect()[dimension]}px`;
|
||
reflow(this._element);
|
||
this._element.classList.add(CLASS_NAME_COLLAPSING);
|
||
this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW);
|
||
for (const trigger of this._triggerArray) {
|
||
const element = selector_engine_default.getElementFromSelector(trigger);
|
||
if (element && !this._isShown(element)) {
|
||
this._addAriaAndCollapsedClass([trigger], false);
|
||
}
|
||
}
|
||
this._isTransitioning = true;
|
||
const complete = () => {
|
||
this._isTransitioning = false;
|
||
this._element.classList.remove(CLASS_NAME_COLLAPSING);
|
||
this._element.classList.add(CLASS_NAME_COLLAPSE);
|
||
event_handler_default.trigger(this._element, EVENT_HIDDEN);
|
||
};
|
||
this._element.style[dimension] = "";
|
||
this._queueCallback(complete, this._element, true);
|
||
}
|
||
_isShown(element = this._element) {
|
||
return element.classList.contains(CLASS_NAME_SHOW);
|
||
}
|
||
// Private
|
||
_configAfterMerge(config) {
|
||
config.toggle = Boolean(config.toggle);
|
||
config.parent = getElement(config.parent);
|
||
return config;
|
||
}
|
||
_getDimension() {
|
||
return this._element.classList.contains(CLASS_NAME_HORIZONTAL) ? WIDTH : HEIGHT;
|
||
}
|
||
_initializeChildren() {
|
||
if (!this._config.parent) {
|
||
return;
|
||
}
|
||
const children = this._getFirstLevelChildren(SELECTOR_DATA_TOGGLE);
|
||
for (const element of children) {
|
||
const selected = selector_engine_default.getElementFromSelector(element);
|
||
if (selected) {
|
||
this._addAriaAndCollapsedClass([element], this._isShown(selected));
|
||
}
|
||
}
|
||
}
|
||
_getFirstLevelChildren(selector) {
|
||
const children = selector_engine_default.find(CLASS_NAME_DEEPER_CHILDREN, this._config.parent);
|
||
return selector_engine_default.find(selector, this._config.parent).filter((element) => !children.includes(element));
|
||
}
|
||
_addAriaAndCollapsedClass(triggerArray, isOpen) {
|
||
if (!triggerArray.length) {
|
||
return;
|
||
}
|
||
for (const element of triggerArray) {
|
||
element.classList.toggle(CLASS_NAME_COLLAPSED, !isOpen);
|
||
element.setAttribute("aria-expanded", isOpen);
|
||
}
|
||
}
|
||
// Static
|
||
static jQueryInterface(config) {
|
||
const _config = {};
|
||
if (typeof config === "string" && /show|hide/.test(config)) {
|
||
_config.toggle = false;
|
||
}
|
||
return this.each(function() {
|
||
const data = _Collapse.getOrCreateInstance(this, _config);
|
||
if (typeof config === "string") {
|
||
if (typeof data[config] === "undefined") {
|
||
throw new TypeError(`No method named "${config}"`);
|
||
}
|
||
data[config]();
|
||
}
|
||
});
|
||
}
|
||
};
|
||
event_handler_default.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function(event) {
|
||
if (event.target.tagName === "A" || event.delegateTarget && event.delegateTarget.tagName === "A") {
|
||
event.preventDefault();
|
||
}
|
||
for (const element of selector_engine_default.getMultipleElementsFromSelector(this)) {
|
||
Collapse.getOrCreateInstance(element, { toggle: false }).toggle();
|
||
}
|
||
});
|
||
defineJQueryPlugin(Collapse);
|
||
|
||
// ns-hugo-imp:/home/joren/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/bootstrap@v5.3.2+incompatible/js/src/dropdown.js
|
||
var Popper = __toESM(require_popper());
|
||
var NAME2 = "dropdown";
|
||
var DATA_KEY2 = "bs.dropdown";
|
||
var EVENT_KEY2 = `.${DATA_KEY2}`;
|
||
var DATA_API_KEY2 = ".data-api";
|
||
var ESCAPE_KEY = "Escape";
|
||
var TAB_KEY = "Tab";
|
||
var ARROW_UP_KEY = "ArrowUp";
|
||
var ARROW_DOWN_KEY = "ArrowDown";
|
||
var RIGHT_MOUSE_BUTTON = 2;
|
||
var EVENT_HIDE2 = `hide${EVENT_KEY2}`;
|
||
var EVENT_HIDDEN2 = `hidden${EVENT_KEY2}`;
|
||
var EVENT_SHOW2 = `show${EVENT_KEY2}`;
|
||
var EVENT_SHOWN2 = `shown${EVENT_KEY2}`;
|
||
var EVENT_CLICK_DATA_API2 = `click${EVENT_KEY2}${DATA_API_KEY2}`;
|
||
var EVENT_KEYDOWN_DATA_API = `keydown${EVENT_KEY2}${DATA_API_KEY2}`;
|
||
var EVENT_KEYUP_DATA_API = `keyup${EVENT_KEY2}${DATA_API_KEY2}`;
|
||
var CLASS_NAME_SHOW2 = "show";
|
||
var CLASS_NAME_DROPUP = "dropup";
|
||
var CLASS_NAME_DROPEND = "dropend";
|
||
var CLASS_NAME_DROPSTART = "dropstart";
|
||
var CLASS_NAME_DROPUP_CENTER = "dropup-center";
|
||
var CLASS_NAME_DROPDOWN_CENTER = "dropdown-center";
|
||
var SELECTOR_DATA_TOGGLE2 = '[data-bs-toggle="dropdown"]:not(.disabled):not(:disabled)';
|
||
var SELECTOR_DATA_TOGGLE_SHOWN = `${SELECTOR_DATA_TOGGLE2}.${CLASS_NAME_SHOW2}`;
|
||
var SELECTOR_MENU = ".dropdown-menu";
|
||
var SELECTOR_NAVBAR = ".navbar";
|
||
var SELECTOR_NAVBAR_NAV = ".navbar-nav";
|
||
var SELECTOR_VISIBLE_ITEMS = ".dropdown-menu .dropdown-item:not(.disabled):not(:disabled)";
|
||
var PLACEMENT_TOP = isRTL() ? "top-end" : "top-start";
|
||
var PLACEMENT_TOPEND = isRTL() ? "top-start" : "top-end";
|
||
var PLACEMENT_BOTTOM = isRTL() ? "bottom-end" : "bottom-start";
|
||
var PLACEMENT_BOTTOMEND = isRTL() ? "bottom-start" : "bottom-end";
|
||
var PLACEMENT_RIGHT = isRTL() ? "left-start" : "right-start";
|
||
var PLACEMENT_LEFT = isRTL() ? "right-start" : "left-start";
|
||
var PLACEMENT_TOPCENTER = "top";
|
||
var PLACEMENT_BOTTOMCENTER = "bottom";
|
||
var Default2 = {
|
||
autoClose: true,
|
||
boundary: "clippingParents",
|
||
display: "dynamic",
|
||
offset: [0, 2],
|
||
popperConfig: null,
|
||
reference: "toggle"
|
||
};
|
||
var DefaultType2 = {
|
||
autoClose: "(boolean|string)",
|
||
boundary: "(string|element)",
|
||
display: "string",
|
||
offset: "(array|string|function)",
|
||
popperConfig: "(null|object|function)",
|
||
reference: "(string|element|object)"
|
||
};
|
||
var Dropdown = class _Dropdown extends base_component_default {
|
||
constructor(element, config) {
|
||
super(element, config);
|
||
this._popper = null;
|
||
this._parent = this._element.parentNode;
|
||
this._menu = selector_engine_default.next(this._element, SELECTOR_MENU)[0] || selector_engine_default.prev(this._element, SELECTOR_MENU)[0] || selector_engine_default.findOne(SELECTOR_MENU, this._parent);
|
||
this._inNavbar = this._detectNavbar();
|
||
}
|
||
// Getters
|
||
static get Default() {
|
||
return Default2;
|
||
}
|
||
static get DefaultType() {
|
||
return DefaultType2;
|
||
}
|
||
static get NAME() {
|
||
return NAME2;
|
||
}
|
||
// Public
|
||
toggle() {
|
||
return this._isShown() ? this.hide() : this.show();
|
||
}
|
||
show() {
|
||
if (isDisabled(this._element) || this._isShown()) {
|
||
return;
|
||
}
|
||
const relatedTarget = {
|
||
relatedTarget: this._element
|
||
};
|
||
const showEvent = event_handler_default.trigger(this._element, EVENT_SHOW2, relatedTarget);
|
||
if (showEvent.defaultPrevented) {
|
||
return;
|
||
}
|
||
this._createPopper();
|
||
if ("ontouchstart" in document.documentElement && !this._parent.closest(SELECTOR_NAVBAR_NAV)) {
|
||
for (const element of [].concat(...document.body.children)) {
|
||
event_handler_default.on(element, "mouseover", noop);
|
||
}
|
||
}
|
||
this._element.focus();
|
||
this._element.setAttribute("aria-expanded", true);
|
||
this._menu.classList.add(CLASS_NAME_SHOW2);
|
||
this._element.classList.add(CLASS_NAME_SHOW2);
|
||
event_handler_default.trigger(this._element, EVENT_SHOWN2, relatedTarget);
|
||
}
|
||
hide() {
|
||
if (isDisabled(this._element) || !this._isShown()) {
|
||
return;
|
||
}
|
||
const relatedTarget = {
|
||
relatedTarget: this._element
|
||
};
|
||
this._completeHide(relatedTarget);
|
||
}
|
||
dispose() {
|
||
if (this._popper) {
|
||
this._popper.destroy();
|
||
}
|
||
super.dispose();
|
||
}
|
||
update() {
|
||
this._inNavbar = this._detectNavbar();
|
||
if (this._popper) {
|
||
this._popper.update();
|
||
}
|
||
}
|
||
// Private
|
||
_completeHide(relatedTarget) {
|
||
const hideEvent = event_handler_default.trigger(this._element, EVENT_HIDE2, relatedTarget);
|
||
if (hideEvent.defaultPrevented) {
|
||
return;
|
||
}
|
||
if ("ontouchstart" in document.documentElement) {
|
||
for (const element of [].concat(...document.body.children)) {
|
||
event_handler_default.off(element, "mouseover", noop);
|
||
}
|
||
}
|
||
if (this._popper) {
|
||
this._popper.destroy();
|
||
}
|
||
this._menu.classList.remove(CLASS_NAME_SHOW2);
|
||
this._element.classList.remove(CLASS_NAME_SHOW2);
|
||
this._element.setAttribute("aria-expanded", "false");
|
||
manipulator_default.removeDataAttribute(this._menu, "popper");
|
||
event_handler_default.trigger(this._element, EVENT_HIDDEN2, relatedTarget);
|
||
}
|
||
_getConfig(config) {
|
||
config = super._getConfig(config);
|
||
if (typeof config.reference === "object" && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== "function") {
|
||
throw new TypeError(`${NAME2.toUpperCase()}: Option "reference" provided type "object" without a required "getBoundingClientRect" method.`);
|
||
}
|
||
return config;
|
||
}
|
||
_createPopper() {
|
||
if (typeof Popper === "undefined") {
|
||
throw new TypeError("Bootstrap's dropdowns require Popper (https://popper.js.org)");
|
||
}
|
||
let referenceElement = this._element;
|
||
if (this._config.reference === "parent") {
|
||
referenceElement = this._parent;
|
||
} else if (isElement(this._config.reference)) {
|
||
referenceElement = getElement(this._config.reference);
|
||
} else if (typeof this._config.reference === "object") {
|
||
referenceElement = this._config.reference;
|
||
}
|
||
const popperConfig = this._getPopperConfig();
|
||
this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig);
|
||
}
|
||
_isShown() {
|
||
return this._menu.classList.contains(CLASS_NAME_SHOW2);
|
||
}
|
||
_getPlacement() {
|
||
const parentDropdown = this._parent;
|
||
if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) {
|
||
return PLACEMENT_RIGHT;
|
||
}
|
||
if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) {
|
||
return PLACEMENT_LEFT;
|
||
}
|
||
if (parentDropdown.classList.contains(CLASS_NAME_DROPUP_CENTER)) {
|
||
return PLACEMENT_TOPCENTER;
|
||
}
|
||
if (parentDropdown.classList.contains(CLASS_NAME_DROPDOWN_CENTER)) {
|
||
return PLACEMENT_BOTTOMCENTER;
|
||
}
|
||
const isEnd = getComputedStyle(this._menu).getPropertyValue("--bs-position").trim() === "end";
|
||
if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) {
|
||
return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP;
|
||
}
|
||
return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM;
|
||
}
|
||
_detectNavbar() {
|
||
return this._element.closest(SELECTOR_NAVBAR) !== null;
|
||
}
|
||
_getOffset() {
|
||
const { offset } = this._config;
|
||
if (typeof offset === "string") {
|
||
return offset.split(",").map((value) => Number.parseInt(value, 10));
|
||
}
|
||
if (typeof offset === "function") {
|
||
return (popperData) => offset(popperData, this._element);
|
||
}
|
||
return offset;
|
||
}
|
||
_getPopperConfig() {
|
||
const defaultBsPopperConfig = {
|
||
placement: this._getPlacement(),
|
||
modifiers: [
|
||
{
|
||
name: "preventOverflow",
|
||
options: {
|
||
boundary: this._config.boundary
|
||
}
|
||
},
|
||
{
|
||
name: "offset",
|
||
options: {
|
||
offset: this._getOffset()
|
||
}
|
||
}
|
||
]
|
||
};
|
||
if (this._inNavbar || this._config.display === "static") {
|
||
manipulator_default.setDataAttribute(this._menu, "popper", "static");
|
||
defaultBsPopperConfig.modifiers = [{
|
||
name: "applyStyles",
|
||
enabled: false
|
||
}];
|
||
}
|
||
return {
|
||
...defaultBsPopperConfig,
|
||
...execute(this._config.popperConfig, [defaultBsPopperConfig])
|
||
};
|
||
}
|
||
_selectMenuItem({ key, target }) {
|
||
const items = selector_engine_default.find(SELECTOR_VISIBLE_ITEMS, this._menu).filter((element) => isVisible(element));
|
||
if (!items.length) {
|
||
return;
|
||
}
|
||
getNextActiveElement(items, target, key === ARROW_DOWN_KEY, !items.includes(target)).focus();
|
||
}
|
||
// Static
|
||
static jQueryInterface(config) {
|
||
return this.each(function() {
|
||
const data = _Dropdown.getOrCreateInstance(this, config);
|
||
if (typeof config !== "string") {
|
||
return;
|
||
}
|
||
if (typeof data[config] === "undefined") {
|
||
throw new TypeError(`No method named "${config}"`);
|
||
}
|
||
data[config]();
|
||
});
|
||
}
|
||
static clearMenus(event) {
|
||
if (event.button === RIGHT_MOUSE_BUTTON || event.type === "keyup" && event.key !== TAB_KEY) {
|
||
return;
|
||
}
|
||
const openToggles = selector_engine_default.find(SELECTOR_DATA_TOGGLE_SHOWN);
|
||
for (const toggle of openToggles) {
|
||
const context = _Dropdown.getInstance(toggle);
|
||
if (!context || context._config.autoClose === false) {
|
||
continue;
|
||
}
|
||
const composedPath = event.composedPath();
|
||
const isMenuTarget = composedPath.includes(context._menu);
|
||
if (composedPath.includes(context._element) || context._config.autoClose === "inside" && !isMenuTarget || context._config.autoClose === "outside" && isMenuTarget) {
|
||
continue;
|
||
}
|
||
if (context._menu.contains(event.target) && (event.type === "keyup" && event.key === TAB_KEY || /input|select|option|textarea|form/i.test(event.target.tagName))) {
|
||
continue;
|
||
}
|
||
const relatedTarget = { relatedTarget: context._element };
|
||
if (event.type === "click") {
|
||
relatedTarget.clickEvent = event;
|
||
}
|
||
context._completeHide(relatedTarget);
|
||
}
|
||
}
|
||
static dataApiKeydownHandler(event) {
|
||
const isInput = /input|textarea/i.test(event.target.tagName);
|
||
const isEscapeEvent = event.key === ESCAPE_KEY;
|
||
const isUpOrDownEvent = [ARROW_UP_KEY, ARROW_DOWN_KEY].includes(event.key);
|
||
if (!isUpOrDownEvent && !isEscapeEvent) {
|
||
return;
|
||
}
|
||
if (isInput && !isEscapeEvent) {
|
||
return;
|
||
}
|
||
event.preventDefault();
|
||
const getToggleButton = this.matches(SELECTOR_DATA_TOGGLE2) ? this : selector_engine_default.prev(this, SELECTOR_DATA_TOGGLE2)[0] || selector_engine_default.next(this, SELECTOR_DATA_TOGGLE2)[0] || selector_engine_default.findOne(SELECTOR_DATA_TOGGLE2, event.delegateTarget.parentNode);
|
||
const instance = _Dropdown.getOrCreateInstance(getToggleButton);
|
||
if (isUpOrDownEvent) {
|
||
event.stopPropagation();
|
||
instance.show();
|
||
instance._selectMenuItem(event);
|
||
return;
|
||
}
|
||
if (instance._isShown()) {
|
||
event.stopPropagation();
|
||
instance.hide();
|
||
getToggleButton.focus();
|
||
}
|
||
}
|
||
};
|
||
event_handler_default.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE2, Dropdown.dataApiKeydownHandler);
|
||
event_handler_default.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler);
|
||
event_handler_default.on(document, EVENT_CLICK_DATA_API2, Dropdown.clearMenus);
|
||
event_handler_default.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus);
|
||
event_handler_default.on(document, EVENT_CLICK_DATA_API2, SELECTOR_DATA_TOGGLE2, function(event) {
|
||
event.preventDefault();
|
||
Dropdown.getOrCreateInstance(this).toggle();
|
||
});
|
||
defineJQueryPlugin(Dropdown);
|
||
|
||
// ns-hugo-imp:/home/joren/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/bootstrap@v5.3.2+incompatible/js/src/util/backdrop.js
|
||
var NAME3 = "backdrop";
|
||
var CLASS_NAME_FADE = "fade";
|
||
var CLASS_NAME_SHOW3 = "show";
|
||
var EVENT_MOUSEDOWN = `mousedown.bs.${NAME3}`;
|
||
var Default3 = {
|
||
className: "modal-backdrop",
|
||
clickCallback: null,
|
||
isAnimated: false,
|
||
isVisible: true,
|
||
// if false, we use the backdrop helper without adding any element to the dom
|
||
rootElement: "body"
|
||
// give the choice to place backdrop under different elements
|
||
};
|
||
var DefaultType3 = {
|
||
className: "string",
|
||
clickCallback: "(function|null)",
|
||
isAnimated: "boolean",
|
||
isVisible: "boolean",
|
||
rootElement: "(element|string)"
|
||
};
|
||
var Backdrop = class extends config_default {
|
||
constructor(config) {
|
||
super();
|
||
this._config = this._getConfig(config);
|
||
this._isAppended = false;
|
||
this._element = null;
|
||
}
|
||
// Getters
|
||
static get Default() {
|
||
return Default3;
|
||
}
|
||
static get DefaultType() {
|
||
return DefaultType3;
|
||
}
|
||
static get NAME() {
|
||
return NAME3;
|
||
}
|
||
// Public
|
||
show(callback) {
|
||
if (!this._config.isVisible) {
|
||
execute(callback);
|
||
return;
|
||
}
|
||
this._append();
|
||
const element = this._getElement();
|
||
if (this._config.isAnimated) {
|
||
reflow(element);
|
||
}
|
||
element.classList.add(CLASS_NAME_SHOW3);
|
||
this._emulateAnimation(() => {
|
||
execute(callback);
|
||
});
|
||
}
|
||
hide(callback) {
|
||
if (!this._config.isVisible) {
|
||
execute(callback);
|
||
return;
|
||
}
|
||
this._getElement().classList.remove(CLASS_NAME_SHOW3);
|
||
this._emulateAnimation(() => {
|
||
this.dispose();
|
||
execute(callback);
|
||
});
|
||
}
|
||
dispose() {
|
||
if (!this._isAppended) {
|
||
return;
|
||
}
|
||
event_handler_default.off(this._element, EVENT_MOUSEDOWN);
|
||
this._element.remove();
|
||
this._isAppended = false;
|
||
}
|
||
// Private
|
||
_getElement() {
|
||
if (!this._element) {
|
||
const backdrop = document.createElement("div");
|
||
backdrop.className = this._config.className;
|
||
if (this._config.isAnimated) {
|
||
backdrop.classList.add(CLASS_NAME_FADE);
|
||
}
|
||
this._element = backdrop;
|
||
}
|
||
return this._element;
|
||
}
|
||
_configAfterMerge(config) {
|
||
config.rootElement = getElement(config.rootElement);
|
||
return config;
|
||
}
|
||
_append() {
|
||
if (this._isAppended) {
|
||
return;
|
||
}
|
||
const element = this._getElement();
|
||
this._config.rootElement.append(element);
|
||
event_handler_default.on(element, EVENT_MOUSEDOWN, () => {
|
||
execute(this._config.clickCallback);
|
||
});
|
||
this._isAppended = true;
|
||
}
|
||
_emulateAnimation(callback) {
|
||
executeAfterTransition(callback, this._getElement(), this._config.isAnimated);
|
||
}
|
||
};
|
||
var backdrop_default = Backdrop;
|
||
|
||
// ns-hugo-imp:/home/joren/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/bootstrap@v5.3.2+incompatible/js/src/util/component-functions.js
|
||
var enableDismissTrigger = (component, method = "hide") => {
|
||
const clickEvent = `click.dismiss${component.EVENT_KEY}`;
|
||
const name = component.NAME;
|
||
event_handler_default.on(document, clickEvent, `[data-bs-dismiss="${name}"]`, function(event) {
|
||
if (["A", "AREA"].includes(this.tagName)) {
|
||
event.preventDefault();
|
||
}
|
||
if (isDisabled(this)) {
|
||
return;
|
||
}
|
||
const target = selector_engine_default.getElementFromSelector(this) || this.closest(`.${name}`);
|
||
const instance = component.getOrCreateInstance(target);
|
||
instance[method]();
|
||
});
|
||
};
|
||
|
||
// ns-hugo-imp:/home/joren/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/bootstrap@v5.3.2+incompatible/js/src/util/focustrap.js
|
||
var NAME4 = "focustrap";
|
||
var DATA_KEY3 = "bs.focustrap";
|
||
var EVENT_KEY3 = `.${DATA_KEY3}`;
|
||
var EVENT_FOCUSIN = `focusin${EVENT_KEY3}`;
|
||
var EVENT_KEYDOWN_TAB = `keydown.tab${EVENT_KEY3}`;
|
||
var TAB_KEY2 = "Tab";
|
||
var TAB_NAV_FORWARD = "forward";
|
||
var TAB_NAV_BACKWARD = "backward";
|
||
var Default4 = {
|
||
autofocus: true,
|
||
trapElement: null
|
||
// The element to trap focus inside of
|
||
};
|
||
var DefaultType4 = {
|
||
autofocus: "boolean",
|
||
trapElement: "element"
|
||
};
|
||
var FocusTrap = class extends config_default {
|
||
constructor(config) {
|
||
super();
|
||
this._config = this._getConfig(config);
|
||
this._isActive = false;
|
||
this._lastTabNavDirection = null;
|
||
}
|
||
// Getters
|
||
static get Default() {
|
||
return Default4;
|
||
}
|
||
static get DefaultType() {
|
||
return DefaultType4;
|
||
}
|
||
static get NAME() {
|
||
return NAME4;
|
||
}
|
||
// Public
|
||
activate() {
|
||
if (this._isActive) {
|
||
return;
|
||
}
|
||
if (this._config.autofocus) {
|
||
this._config.trapElement.focus();
|
||
}
|
||
event_handler_default.off(document, EVENT_KEY3);
|
||
event_handler_default.on(document, EVENT_FOCUSIN, (event) => this._handleFocusin(event));
|
||
event_handler_default.on(document, EVENT_KEYDOWN_TAB, (event) => this._handleKeydown(event));
|
||
this._isActive = true;
|
||
}
|
||
deactivate() {
|
||
if (!this._isActive) {
|
||
return;
|
||
}
|
||
this._isActive = false;
|
||
event_handler_default.off(document, EVENT_KEY3);
|
||
}
|
||
// Private
|
||
_handleFocusin(event) {
|
||
const { trapElement } = this._config;
|
||
if (event.target === document || event.target === trapElement || trapElement.contains(event.target)) {
|
||
return;
|
||
}
|
||
const elements = selector_engine_default.focusableChildren(trapElement);
|
||
if (elements.length === 0) {
|
||
trapElement.focus();
|
||
} else if (this._lastTabNavDirection === TAB_NAV_BACKWARD) {
|
||
elements[elements.length - 1].focus();
|
||
} else {
|
||
elements[0].focus();
|
||
}
|
||
}
|
||
_handleKeydown(event) {
|
||
if (event.key !== TAB_KEY2) {
|
||
return;
|
||
}
|
||
this._lastTabNavDirection = event.shiftKey ? TAB_NAV_BACKWARD : TAB_NAV_FORWARD;
|
||
}
|
||
};
|
||
var focustrap_default = FocusTrap;
|
||
|
||
// ns-hugo-imp:/home/joren/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/bootstrap@v5.3.2+incompatible/js/src/util/scrollbar.js
|
||
var SELECTOR_FIXED_CONTENT = ".fixed-top, .fixed-bottom, .is-fixed, .sticky-top";
|
||
var SELECTOR_STICKY_CONTENT = ".sticky-top";
|
||
var PROPERTY_PADDING = "padding-right";
|
||
var PROPERTY_MARGIN = "margin-right";
|
||
var ScrollBarHelper = class {
|
||
constructor() {
|
||
this._element = document.body;
|
||
}
|
||
// Public
|
||
getWidth() {
|
||
const documentWidth = document.documentElement.clientWidth;
|
||
return Math.abs(window.innerWidth - documentWidth);
|
||
}
|
||
hide() {
|
||
const width = this.getWidth();
|
||
this._disableOverFlow();
|
||
this._setElementAttributes(this._element, PROPERTY_PADDING, (calculatedValue) => calculatedValue + width);
|
||
this._setElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING, (calculatedValue) => calculatedValue + width);
|
||
this._setElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN, (calculatedValue) => calculatedValue - width);
|
||
}
|
||
reset() {
|
||
this._resetElementAttributes(this._element, "overflow");
|
||
this._resetElementAttributes(this._element, PROPERTY_PADDING);
|
||
this._resetElementAttributes(SELECTOR_FIXED_CONTENT, PROPERTY_PADDING);
|
||
this._resetElementAttributes(SELECTOR_STICKY_CONTENT, PROPERTY_MARGIN);
|
||
}
|
||
isOverflowing() {
|
||
return this.getWidth() > 0;
|
||
}
|
||
// Private
|
||
_disableOverFlow() {
|
||
this._saveInitialAttribute(this._element, "overflow");
|
||
this._element.style.overflow = "hidden";
|
||
}
|
||
_setElementAttributes(selector, styleProperty, callback) {
|
||
const scrollbarWidth = this.getWidth();
|
||
const manipulationCallBack = (element) => {
|
||
if (element !== this._element && window.innerWidth > element.clientWidth + scrollbarWidth) {
|
||
return;
|
||
}
|
||
this._saveInitialAttribute(element, styleProperty);
|
||
const calculatedValue = window.getComputedStyle(element).getPropertyValue(styleProperty);
|
||
element.style.setProperty(styleProperty, `${callback(Number.parseFloat(calculatedValue))}px`);
|
||
};
|
||
this._applyManipulationCallback(selector, manipulationCallBack);
|
||
}
|
||
_saveInitialAttribute(element, styleProperty) {
|
||
const actualValue = element.style.getPropertyValue(styleProperty);
|
||
if (actualValue) {
|
||
manipulator_default.setDataAttribute(element, styleProperty, actualValue);
|
||
}
|
||
}
|
||
_resetElementAttributes(selector, styleProperty) {
|
||
const manipulationCallBack = (element) => {
|
||
const value = manipulator_default.getDataAttribute(element, styleProperty);
|
||
if (value === null) {
|
||
element.style.removeProperty(styleProperty);
|
||
return;
|
||
}
|
||
manipulator_default.removeDataAttribute(element, styleProperty);
|
||
element.style.setProperty(styleProperty, value);
|
||
};
|
||
this._applyManipulationCallback(selector, manipulationCallBack);
|
||
}
|
||
_applyManipulationCallback(selector, callBack) {
|
||
if (isElement(selector)) {
|
||
callBack(selector);
|
||
return;
|
||
}
|
||
for (const sel of selector_engine_default.find(selector, this._element)) {
|
||
callBack(sel);
|
||
}
|
||
}
|
||
};
|
||
var scrollbar_default = ScrollBarHelper;
|
||
|
||
// ns-hugo-imp:/home/joren/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/bootstrap@v5.3.2+incompatible/js/src/modal.js
|
||
var NAME5 = "modal";
|
||
var DATA_KEY4 = "bs.modal";
|
||
var EVENT_KEY4 = `.${DATA_KEY4}`;
|
||
var DATA_API_KEY3 = ".data-api";
|
||
var ESCAPE_KEY2 = "Escape";
|
||
var EVENT_HIDE3 = `hide${EVENT_KEY4}`;
|
||
var EVENT_HIDE_PREVENTED = `hidePrevented${EVENT_KEY4}`;
|
||
var EVENT_HIDDEN3 = `hidden${EVENT_KEY4}`;
|
||
var EVENT_SHOW3 = `show${EVENT_KEY4}`;
|
||
var EVENT_SHOWN3 = `shown${EVENT_KEY4}`;
|
||
var EVENT_RESIZE = `resize${EVENT_KEY4}`;
|
||
var EVENT_CLICK_DISMISS = `click.dismiss${EVENT_KEY4}`;
|
||
var EVENT_MOUSEDOWN_DISMISS = `mousedown.dismiss${EVENT_KEY4}`;
|
||
var EVENT_KEYDOWN_DISMISS = `keydown.dismiss${EVENT_KEY4}`;
|
||
var EVENT_CLICK_DATA_API3 = `click${EVENT_KEY4}${DATA_API_KEY3}`;
|
||
var CLASS_NAME_OPEN = "modal-open";
|
||
var CLASS_NAME_FADE2 = "fade";
|
||
var CLASS_NAME_SHOW4 = "show";
|
||
var CLASS_NAME_STATIC = "modal-static";
|
||
var OPEN_SELECTOR = ".modal.show";
|
||
var SELECTOR_DIALOG = ".modal-dialog";
|
||
var SELECTOR_MODAL_BODY = ".modal-body";
|
||
var SELECTOR_DATA_TOGGLE3 = '[data-bs-toggle="modal"]';
|
||
var Default5 = {
|
||
backdrop: true,
|
||
focus: true,
|
||
keyboard: true
|
||
};
|
||
var DefaultType5 = {
|
||
backdrop: "(boolean|string)",
|
||
focus: "boolean",
|
||
keyboard: "boolean"
|
||
};
|
||
var Modal = class _Modal extends base_component_default {
|
||
constructor(element, config) {
|
||
super(element, config);
|
||
this._dialog = selector_engine_default.findOne(SELECTOR_DIALOG, this._element);
|
||
this._backdrop = this._initializeBackDrop();
|
||
this._focustrap = this._initializeFocusTrap();
|
||
this._isShown = false;
|
||
this._isTransitioning = false;
|
||
this._scrollBar = new scrollbar_default();
|
||
this._addEventListeners();
|
||
}
|
||
// Getters
|
||
static get Default() {
|
||
return Default5;
|
||
}
|
||
static get DefaultType() {
|
||
return DefaultType5;
|
||
}
|
||
static get NAME() {
|
||
return NAME5;
|
||
}
|
||
// Public
|
||
toggle(relatedTarget) {
|
||
return this._isShown ? this.hide() : this.show(relatedTarget);
|
||
}
|
||
show(relatedTarget) {
|
||
if (this._isShown || this._isTransitioning) {
|
||
return;
|
||
}
|
||
const showEvent = event_handler_default.trigger(this._element, EVENT_SHOW3, {
|
||
relatedTarget
|
||
});
|
||
if (showEvent.defaultPrevented) {
|
||
return;
|
||
}
|
||
this._isShown = true;
|
||
this._isTransitioning = true;
|
||
this._scrollBar.hide();
|
||
document.body.classList.add(CLASS_NAME_OPEN);
|
||
this._adjustDialog();
|
||
this._backdrop.show(() => this._showElement(relatedTarget));
|
||
}
|
||
hide() {
|
||
if (!this._isShown || this._isTransitioning) {
|
||
return;
|
||
}
|
||
const hideEvent = event_handler_default.trigger(this._element, EVENT_HIDE3);
|
||
if (hideEvent.defaultPrevented) {
|
||
return;
|
||
}
|
||
this._isShown = false;
|
||
this._isTransitioning = true;
|
||
this._focustrap.deactivate();
|
||
this._element.classList.remove(CLASS_NAME_SHOW4);
|
||
this._queueCallback(() => this._hideModal(), this._element, this._isAnimated());
|
||
}
|
||
dispose() {
|
||
event_handler_default.off(window, EVENT_KEY4);
|
||
event_handler_default.off(this._dialog, EVENT_KEY4);
|
||
this._backdrop.dispose();
|
||
this._focustrap.deactivate();
|
||
super.dispose();
|
||
}
|
||
handleUpdate() {
|
||
this._adjustDialog();
|
||
}
|
||
// Private
|
||
_initializeBackDrop() {
|
||
return new backdrop_default({
|
||
isVisible: Boolean(this._config.backdrop),
|
||
// 'static' option will be translated to true, and booleans will keep their value,
|
||
isAnimated: this._isAnimated()
|
||
});
|
||
}
|
||
_initializeFocusTrap() {
|
||
return new focustrap_default({
|
||
trapElement: this._element
|
||
});
|
||
}
|
||
_showElement(relatedTarget) {
|
||
if (!document.body.contains(this._element)) {
|
||
document.body.append(this._element);
|
||
}
|
||
this._element.style.display = "block";
|
||
this._element.removeAttribute("aria-hidden");
|
||
this._element.setAttribute("aria-modal", true);
|
||
this._element.setAttribute("role", "dialog");
|
||
this._element.scrollTop = 0;
|
||
const modalBody = selector_engine_default.findOne(SELECTOR_MODAL_BODY, this._dialog);
|
||
if (modalBody) {
|
||
modalBody.scrollTop = 0;
|
||
}
|
||
reflow(this._element);
|
||
this._element.classList.add(CLASS_NAME_SHOW4);
|
||
const transitionComplete = () => {
|
||
if (this._config.focus) {
|
||
this._focustrap.activate();
|
||
}
|
||
this._isTransitioning = false;
|
||
event_handler_default.trigger(this._element, EVENT_SHOWN3, {
|
||
relatedTarget
|
||
});
|
||
};
|
||
this._queueCallback(transitionComplete, this._dialog, this._isAnimated());
|
||
}
|
||
_addEventListeners() {
|
||
event_handler_default.on(this._element, EVENT_KEYDOWN_DISMISS, (event) => {
|
||
if (event.key !== ESCAPE_KEY2) {
|
||
return;
|
||
}
|
||
if (this._config.keyboard) {
|
||
this.hide();
|
||
return;
|
||
}
|
||
this._triggerBackdropTransition();
|
||
});
|
||
event_handler_default.on(window, EVENT_RESIZE, () => {
|
||
if (this._isShown && !this._isTransitioning) {
|
||
this._adjustDialog();
|
||
}
|
||
});
|
||
event_handler_default.on(this._element, EVENT_MOUSEDOWN_DISMISS, (event) => {
|
||
event_handler_default.one(this._element, EVENT_CLICK_DISMISS, (event2) => {
|
||
if (this._element !== event.target || this._element !== event2.target) {
|
||
return;
|
||
}
|
||
if (this._config.backdrop === "static") {
|
||
this._triggerBackdropTransition();
|
||
return;
|
||
}
|
||
if (this._config.backdrop) {
|
||
this.hide();
|
||
}
|
||
});
|
||
});
|
||
}
|
||
_hideModal() {
|
||
this._element.style.display = "none";
|
||
this._element.setAttribute("aria-hidden", true);
|
||
this._element.removeAttribute("aria-modal");
|
||
this._element.removeAttribute("role");
|
||
this._isTransitioning = false;
|
||
this._backdrop.hide(() => {
|
||
document.body.classList.remove(CLASS_NAME_OPEN);
|
||
this._resetAdjustments();
|
||
this._scrollBar.reset();
|
||
event_handler_default.trigger(this._element, EVENT_HIDDEN3);
|
||
});
|
||
}
|
||
_isAnimated() {
|
||
return this._element.classList.contains(CLASS_NAME_FADE2);
|
||
}
|
||
_triggerBackdropTransition() {
|
||
const hideEvent = event_handler_default.trigger(this._element, EVENT_HIDE_PREVENTED);
|
||
if (hideEvent.defaultPrevented) {
|
||
return;
|
||
}
|
||
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
||
const initialOverflowY = this._element.style.overflowY;
|
||
if (initialOverflowY === "hidden" || this._element.classList.contains(CLASS_NAME_STATIC)) {
|
||
return;
|
||
}
|
||
if (!isModalOverflowing) {
|
||
this._element.style.overflowY = "hidden";
|
||
}
|
||
this._element.classList.add(CLASS_NAME_STATIC);
|
||
this._queueCallback(() => {
|
||
this._element.classList.remove(CLASS_NAME_STATIC);
|
||
this._queueCallback(() => {
|
||
this._element.style.overflowY = initialOverflowY;
|
||
}, this._dialog);
|
||
}, this._dialog);
|
||
this._element.focus();
|
||
}
|
||
/**
|
||
* The following methods are used to handle overflowing modals
|
||
*/
|
||
_adjustDialog() {
|
||
const isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
|
||
const scrollbarWidth = this._scrollBar.getWidth();
|
||
const isBodyOverflowing = scrollbarWidth > 0;
|
||
if (isBodyOverflowing && !isModalOverflowing) {
|
||
const property = isRTL() ? "paddingLeft" : "paddingRight";
|
||
this._element.style[property] = `${scrollbarWidth}px`;
|
||
}
|
||
if (!isBodyOverflowing && isModalOverflowing) {
|
||
const property = isRTL() ? "paddingRight" : "paddingLeft";
|
||
this._element.style[property] = `${scrollbarWidth}px`;
|
||
}
|
||
}
|
||
_resetAdjustments() {
|
||
this._element.style.paddingLeft = "";
|
||
this._element.style.paddingRight = "";
|
||
}
|
||
// Static
|
||
static jQueryInterface(config, relatedTarget) {
|
||
return this.each(function() {
|
||
const data = _Modal.getOrCreateInstance(this, config);
|
||
if (typeof config !== "string") {
|
||
return;
|
||
}
|
||
if (typeof data[config] === "undefined") {
|
||
throw new TypeError(`No method named "${config}"`);
|
||
}
|
||
data[config](relatedTarget);
|
||
});
|
||
}
|
||
};
|
||
event_handler_default.on(document, EVENT_CLICK_DATA_API3, SELECTOR_DATA_TOGGLE3, function(event) {
|
||
const target = selector_engine_default.getElementFromSelector(this);
|
||
if (["A", "AREA"].includes(this.tagName)) {
|
||
event.preventDefault();
|
||
}
|
||
event_handler_default.one(target, EVENT_SHOW3, (showEvent) => {
|
||
if (showEvent.defaultPrevented) {
|
||
return;
|
||
}
|
||
event_handler_default.one(target, EVENT_HIDDEN3, () => {
|
||
if (isVisible(this)) {
|
||
this.focus();
|
||
}
|
||
});
|
||
});
|
||
const alreadyOpen = selector_engine_default.findOne(OPEN_SELECTOR);
|
||
if (alreadyOpen) {
|
||
Modal.getInstance(alreadyOpen).hide();
|
||
}
|
||
const data = Modal.getOrCreateInstance(target);
|
||
data.toggle(this);
|
||
});
|
||
enableDismissTrigger(Modal);
|
||
defineJQueryPlugin(Modal);
|
||
|
||
// ns-hugo-imp:/home/joren/.cache/hugo_cache/modules/filecache/modules/pkg/mod/github.com/twbs/bootstrap@v5.3.2+incompatible/js/src/scrollspy.js
|
||
var NAME6 = "scrollspy";
|
||
var DATA_KEY5 = "bs.scrollspy";
|
||
var EVENT_KEY5 = `.${DATA_KEY5}`;
|
||
var DATA_API_KEY4 = ".data-api";
|
||
var EVENT_ACTIVATE = `activate${EVENT_KEY5}`;
|
||
var EVENT_CLICK = `click${EVENT_KEY5}`;
|
||
var EVENT_LOAD_DATA_API = `load${EVENT_KEY5}${DATA_API_KEY4}`;
|
||
var CLASS_NAME_DROPDOWN_ITEM = "dropdown-item";
|
||
var CLASS_NAME_ACTIVE = "active";
|
||
var SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]';
|
||
var SELECTOR_TARGET_LINKS = "[href]";
|
||
var SELECTOR_NAV_LIST_GROUP = ".nav, .list-group";
|
||
var SELECTOR_NAV_LINKS = ".nav-link";
|
||
var SELECTOR_NAV_ITEMS = ".nav-item";
|
||
var SELECTOR_LIST_ITEMS = ".list-group-item";
|
||
var SELECTOR_LINK_ITEMS = `${SELECTOR_NAV_LINKS}, ${SELECTOR_NAV_ITEMS} > ${SELECTOR_NAV_LINKS}, ${SELECTOR_LIST_ITEMS}`;
|
||
var SELECTOR_DROPDOWN = ".dropdown";
|
||
var SELECTOR_DROPDOWN_TOGGLE = ".dropdown-toggle";
|
||
var Default6 = {
|
||
offset: null,
|
||
// TODO: v6 @deprecated, keep it for backwards compatibility reasons
|
||
rootMargin: "0px 0px -25%",
|
||
smoothScroll: false,
|
||
target: null,
|
||
threshold: [0.1, 0.5, 1]
|
||
};
|
||
var DefaultType6 = {
|
||
offset: "(number|null)",
|
||
// TODO v6 @deprecated, keep it for backwards compatibility reasons
|
||
rootMargin: "string",
|
||
smoothScroll: "boolean",
|
||
target: "element",
|
||
threshold: "array"
|
||
};
|
||
var ScrollSpy = class _ScrollSpy extends base_component_default {
|
||
constructor(element, config) {
|
||
super(element, config);
|
||
this._targetLinks = /* @__PURE__ */ new Map();
|
||
this._observableSections = /* @__PURE__ */ new Map();
|
||
this._rootElement = getComputedStyle(this._element).overflowY === "visible" ? null : this._element;
|
||
this._activeTarget = null;
|
||
this._observer = null;
|
||
this._previousScrollData = {
|
||
visibleEntryTop: 0,
|
||
parentScrollTop: 0
|
||
};
|
||
this.refresh();
|
||
}
|
||
// Getters
|
||
static get Default() {
|
||
return Default6;
|
||
}
|
||
static get DefaultType() {
|
||
return DefaultType6;
|
||
}
|
||
static get NAME() {
|
||
return NAME6;
|
||
}
|
||
// Public
|
||
refresh() {
|
||
this._initializeTargetsAndObservables();
|
||
this._maybeEnableSmoothScroll();
|
||
if (this._observer) {
|
||
this._observer.disconnect();
|
||
} else {
|
||
this._observer = this._getNewObserver();
|
||
}
|
||
for (const section of this._observableSections.values()) {
|
||
this._observer.observe(section);
|
||
}
|
||
}
|
||
dispose() {
|
||
this._observer.disconnect();
|
||
super.dispose();
|
||
}
|
||
// Private
|
||
_configAfterMerge(config) {
|
||
config.target = getElement(config.target) || document.body;
|
||
config.rootMargin = config.offset ? `${config.offset}px 0px -30%` : config.rootMargin;
|
||
if (typeof config.threshold === "string") {
|
||
config.threshold = config.threshold.split(",").map((value) => Number.parseFloat(value));
|
||
}
|
||
return config;
|
||
}
|
||
_maybeEnableSmoothScroll() {
|
||
if (!this._config.smoothScroll) {
|
||
return;
|
||
}
|
||
event_handler_default.off(this._config.target, EVENT_CLICK);
|
||
event_handler_default.on(this._config.target, EVENT_CLICK, SELECTOR_TARGET_LINKS, (event) => {
|
||
const observableSection = this._observableSections.get(event.target.hash);
|
||
if (observableSection) {
|
||
event.preventDefault();
|
||
const root = this._rootElement || window;
|
||
const height = observableSection.offsetTop - this._element.offsetTop;
|
||
if (root.scrollTo) {
|
||
root.scrollTo({ top: height, behavior: "smooth" });
|
||
return;
|
||
}
|
||
root.scrollTop = height;
|
||
}
|
||
});
|
||
}
|
||
_getNewObserver() {
|
||
const options = {
|
||
root: this._rootElement,
|
||
threshold: this._config.threshold,
|
||
rootMargin: this._config.rootMargin
|
||
};
|
||
return new IntersectionObserver((entries) => this._observerCallback(entries), options);
|
||
}
|
||
// The logic of selection
|
||
_observerCallback(entries) {
|
||
const targetElement = (entry) => this._targetLinks.get(`#${entry.target.id}`);
|
||
const activate = (entry) => {
|
||
this._previousScrollData.visibleEntryTop = entry.target.offsetTop;
|
||
this._process(targetElement(entry));
|
||
};
|
||
const parentScrollTop = (this._rootElement || document.documentElement).scrollTop;
|
||
const userScrollsDown = parentScrollTop >= this._previousScrollData.parentScrollTop;
|
||
this._previousScrollData.parentScrollTop = parentScrollTop;
|
||
for (const entry of entries) {
|
||
if (!entry.isIntersecting) {
|
||
this._activeTarget = null;
|
||
this._clearActiveClass(targetElement(entry));
|
||
continue;
|
||
}
|
||
const entryIsLowerThanPrevious = entry.target.offsetTop >= this._previousScrollData.visibleEntryTop;
|
||
if (userScrollsDown && entryIsLowerThanPrevious) {
|
||
activate(entry);
|
||
if (!parentScrollTop) {
|
||
return;
|
||
}
|
||
continue;
|
||
}
|
||
if (!userScrollsDown && !entryIsLowerThanPrevious) {
|
||
activate(entry);
|
||
}
|
||
}
|
||
}
|
||
_initializeTargetsAndObservables() {
|
||
this._targetLinks = /* @__PURE__ */ new Map();
|
||
this._observableSections = /* @__PURE__ */ new Map();
|
||
const targetLinks = selector_engine_default.find(SELECTOR_TARGET_LINKS, this._config.target);
|
||
for (const anchor of targetLinks) {
|
||
if (!anchor.hash || isDisabled(anchor)) {
|
||
continue;
|
||
}
|
||
const observableSection = selector_engine_default.findOne(decodeURI(anchor.hash), this._element);
|
||
if (isVisible(observableSection)) {
|
||
this._targetLinks.set(decodeURI(anchor.hash), anchor);
|
||
this._observableSections.set(anchor.hash, observableSection);
|
||
}
|
||
}
|
||
}
|
||
_process(target) {
|
||
if (this._activeTarget === target) {
|
||
return;
|
||
}
|
||
this._clearActiveClass(this._config.target);
|
||
this._activeTarget = target;
|
||
target.classList.add(CLASS_NAME_ACTIVE);
|
||
this._activateParents(target);
|
||
event_handler_default.trigger(this._element, EVENT_ACTIVATE, { relatedTarget: target });
|
||
}
|
||
_activateParents(target) {
|
||
if (target.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) {
|
||
selector_engine_default.findOne(SELECTOR_DROPDOWN_TOGGLE, target.closest(SELECTOR_DROPDOWN)).classList.add(CLASS_NAME_ACTIVE);
|
||
return;
|
||
}
|
||
for (const listGroup of selector_engine_default.parents(target, SELECTOR_NAV_LIST_GROUP)) {
|
||
for (const item of selector_engine_default.prev(listGroup, SELECTOR_LINK_ITEMS)) {
|
||
item.classList.add(CLASS_NAME_ACTIVE);
|
||
}
|
||
}
|
||
}
|
||
_clearActiveClass(parent) {
|
||
parent.classList.remove(CLASS_NAME_ACTIVE);
|
||
const activeNodes = selector_engine_default.find(`${SELECTOR_TARGET_LINKS}.${CLASS_NAME_ACTIVE}`, parent);
|
||
for (const node of activeNodes) {
|
||
node.classList.remove(CLASS_NAME_ACTIVE);
|
||
}
|
||
}
|
||
// Static
|
||
static jQueryInterface(config) {
|
||
return this.each(function() {
|
||
const data = _ScrollSpy.getOrCreateInstance(this, config);
|
||
if (typeof config !== "string") {
|
||
return;
|
||
}
|
||
if (data[config] === void 0 || config.startsWith("_") || config === "constructor") {
|
||
throw new TypeError(`No method named "${config}"`);
|
||
}
|
||
data[config]();
|
||
});
|
||
}
|
||
};
|
||
event_handler_default.on(window, EVENT_LOAD_DATA_API, () => {
|
||
for (const spy of selector_engine_default.find(SELECTOR_DATA_SPY)) {
|
||
ScrollSpy.getOrCreateInstance(spy);
|
||
}
|
||
});
|
||
defineJQueryPlugin(ScrollSpy);
|
||
})();
|
||
</script>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<script crossorigin="anonymous" defer integrity="sha512-VeA1KgdCWi9mS8EhvJ4yHcTCaJiV+//Xx1Y1p6cbkIyWnLNJDmVwbvLHybg2qGQ7bbW1lyt93rqiFuK3rsotyA==" type="application/javascript">/* Web Font Loader v1.6.28 - (c) Adobe Systems, Google. License: Apache 2.0 */
|
||
(function () {
|
||
function aa(a, b, c) {
|
||
return a.call.apply(a.bind, arguments)
|
||
}
|
||
|
||
function ba(a, b, c) {
|
||
if (!a) throw Error();
|
||
if (2 < arguments.length) {
|
||
var d = Array.prototype.slice.call(arguments, 2);
|
||
return function () {
|
||
var c = Array.prototype.slice.call(arguments);
|
||
Array.prototype.unshift.apply(c, d);
|
||
return a.apply(b, c)
|
||
}
|
||
}
|
||
return function () {
|
||
return a.apply(b, arguments)
|
||
}
|
||
}
|
||
|
||
function p(a, b, c) {
|
||
p = Function.prototype.bind && -1 != Function.prototype.bind.toString().indexOf("native code") ? aa : ba;
|
||
return p.apply(null, arguments)
|
||
}
|
||
var q = Date.now || function () {
|
||
return +new Date
|
||
};
|
||
|
||
function ca(a, b) {
|
||
this.a = a;
|
||
this.s = b || a;
|
||
this.c = this.s.document
|
||
}
|
||
var da = !!window.FontFace;
|
||
|
||
function t(a, b, c, d) {
|
||
b = a.c.createElement(b);
|
||
if (c)
|
||
for (var e in c) c.hasOwnProperty(e) && ("style" == e ? b.style.cssText = c[e] : b.setAttribute(e, c[e]));
|
||
d && b.appendChild(a.c.createTextNode(d));
|
||
return b
|
||
}
|
||
|
||
function u(a, b, c) {
|
||
a = a.c.getElementsByTagName(b)[0];
|
||
a || (a = document.documentElement);
|
||
a.insertBefore(c, a.lastChild)
|
||
}
|
||
|
||
function v(a) {
|
||
a.parentNode && a.parentNode.removeChild(a)
|
||
}
|
||
|
||
function w(a, b, c) {
|
||
b = b || [];
|
||
c = c || [];
|
||
for (var d = a.className.split(/\s+/), e = 0; e < b.length; e += 1) {
|
||
for (var f = !1, g = 0; g < d.length; g += 1)
|
||
if (b[e] === d[g]) {
|
||
f = !0;
|
||
break
|
||
} f || d.push(b[e])
|
||
}
|
||
b = [];
|
||
for (e = 0; e < d.length; e += 1) {
|
||
f = !1;
|
||
for (g = 0; g < c.length; g += 1)
|
||
if (d[e] === c[g]) {
|
||
f = !0;
|
||
break
|
||
} f || b.push(d[e])
|
||
}
|
||
a.className = b.join(" ").replace(/\s+/g, " ").replace(/^\s+|\s+$/, "")
|
||
}
|
||
|
||
function y(a, b) {
|
||
for (var c = a.className.split(/\s+/), d = 0, e = c.length; d < e; d++)
|
||
if (c[d] == b) return !0;
|
||
return !1
|
||
}
|
||
|
||
function ea(a) {
|
||
return a.s.location.hostname || a.a.location.hostname
|
||
}
|
||
|
||
function z(a, b, c) {
|
||
function d() {
|
||
m && e && f && (m(g), m = null)
|
||
}
|
||
b = t(a, "link", {
|
||
rel: "stylesheet",
|
||
href: b,
|
||
media: "all"
|
||
});
|
||
var e = !1,
|
||
f = !0,
|
||
g = null,
|
||
m = c || null;
|
||
da ? (b.onload = function () {
|
||
e = !0;
|
||
d()
|
||
}, b.onerror = function () {
|
||
e = !0;
|
||
g = Error("Stylesheet failed to load");
|
||
d()
|
||
}) : setTimeout(function () {
|
||
e = !0;
|
||
d()
|
||
}, 0);
|
||
u(a, "head", b)
|
||
}
|
||
|
||
function A(a, b, c, d) {
|
||
var e = a.c.getElementsByTagName("head")[0];
|
||
if (e) {
|
||
var f = t(a, "script", {
|
||
src: b
|
||
}),
|
||
g = !1;
|
||
f.onload = f.onreadystatechange = function () {
|
||
g || this.readyState && "loaded" != this.readyState && "complete" != this.readyState || (g = !0, c && c(null), f.onload = f.onreadystatechange = null, "HEAD" == f.parentNode.tagName && e.removeChild(f))
|
||
};
|
||
e.appendChild(f);
|
||
setTimeout(function () {
|
||
g || (g = !0, c && c(Error("Script load timeout")))
|
||
}, d || 5E3);
|
||
return f
|
||
}
|
||
return null
|
||
};
|
||
|
||
function B() {
|
||
this.a = 0;
|
||
this.c = null
|
||
}
|
||
|
||
function C(a) {
|
||
a.a++;
|
||
return function () {
|
||
a.a--;
|
||
D(a)
|
||
}
|
||
}
|
||
|
||
function E(a, b) {
|
||
a.c = b;
|
||
D(a)
|
||
}
|
||
|
||
function D(a) {
|
||
0 == a.a && a.c && (a.c(), a.c = null)
|
||
};
|
||
|
||
function F(a) {
|
||
this.a = a || "-"
|
||
}
|
||
F.prototype.c = function (a) {
|
||
for (var b = [], c = 0; c < arguments.length; c++) b.push(arguments[c].replace(/[\W_]+/g, "").toLowerCase());
|
||
return b.join(this.a)
|
||
};
|
||
|
||
function G(a, b) {
|
||
this.c = a;
|
||
this.f = 4;
|
||
this.a = "n";
|
||
var c = (b || "n4").match(/^([nio])([1-9])$/i);
|
||
c && (this.a = c[1], this.f = parseInt(c[2], 10))
|
||
}
|
||
|
||
function fa(a) {
|
||
return H(a) + " " + (a.f + "00") + " 300px " + I(a.c)
|
||
}
|
||
|
||
function I(a) {
|
||
var b = [];
|
||
a = a.split(/,\s*/);
|
||
for (var c = 0; c < a.length; c++) {
|
||
var d = a[c].replace(/['"]/g, ""); - 1 != d.indexOf(" ") || /^\d/.test(d) ? b.push("'" + d + "'") : b.push(d)
|
||
}
|
||
return b.join(",")
|
||
}
|
||
|
||
function J(a) {
|
||
return a.a + a.f
|
||
}
|
||
|
||
function H(a) {
|
||
var b = "normal";
|
||
"o" === a.a ? b = "oblique" : "i" === a.a && (b = "italic");
|
||
return b
|
||
}
|
||
|
||
function ga(a) {
|
||
var b = 4,
|
||
c = "n",
|
||
d = null;
|
||
a && ((d = a.match(/(normal|oblique|italic)/i)) && d[1] && (c = d[1].substr(0, 1).toLowerCase()), (d = a.match(/([1-9]00|normal|bold)/i)) && d[1] && (/bold/i.test(d[1]) ? b = 7 : /[1-9]00/.test(d[1]) && (b = parseInt(d[1].substr(0, 1), 10))));
|
||
return c + b
|
||
};
|
||
|
||
function ha(a, b) {
|
||
this.c = a;
|
||
this.f = a.s.document.documentElement;
|
||
this.h = b;
|
||
this.a = new F("-");
|
||
this.j = !1 !== b.events;
|
||
this.g = !1 !== b.classes
|
||
}
|
||
|
||
function ia(a) {
|
||
a.g && w(a.f, [a.a.c("wf", "loading")]);
|
||
K(a, "loading")
|
||
}
|
||
|
||
function L(a) {
|
||
if (a.g) {
|
||
var b = y(a.f, a.a.c("wf", "active")),
|
||
c = [],
|
||
d = [a.a.c("wf", "loading")];
|
||
b || c.push(a.a.c("wf", "inactive"));
|
||
w(a.f, c, d)
|
||
}
|
||
K(a, "inactive")
|
||
}
|
||
|
||
function K(a, b, c) {
|
||
if (a.j && a.h[b])
|
||
if (c) a.h[b](c.c, J(c));
|
||
else a.h[b]()
|
||
};
|
||
|
||
function ja() {
|
||
this.c = {}
|
||
}
|
||
|
||
function ka(a, b, c) {
|
||
var d = [],
|
||
e;
|
||
for (e in b)
|
||
if (b.hasOwnProperty(e)) {
|
||
var f = a.c[e];
|
||
f && d.push(f(b[e], c))
|
||
} return d
|
||
};
|
||
|
||
function M(a, b) {
|
||
this.c = a;
|
||
this.f = b;
|
||
this.a = t(this.c, "span", {
|
||
"aria-hidden": "true"
|
||
}, this.f)
|
||
}
|
||
|
||
function N(a) {
|
||
u(a.c, "body", a.a)
|
||
}
|
||
|
||
function O(a) {
|
||
return "display:block;position:absolute;top:-9999px;left:-9999px;font-size:300px;width:auto;height:auto;line-height:normal;margin:0;padding:0;font-variant:normal;white-space:nowrap;font-family:" + I(a.c) + ";" + ("font-style:" + H(a) + ";font-weight:" + (a.f + "00") + ";")
|
||
};
|
||
|
||
function P(a, b, c, d, e, f) {
|
||
this.g = a;
|
||
this.j = b;
|
||
this.a = d;
|
||
this.c = c;
|
||
this.f = e || 3E3;
|
||
this.h = f || void 0
|
||
}
|
||
P.prototype.start = function () {
|
||
var a = this.c.s.document,
|
||
b = this,
|
||
c = q(),
|
||
d = new Promise(function (d, e) {
|
||
function f() {
|
||
q() - c >= b.f ? e() : a.fonts.load(fa(b.a), b.h).then(function (a) {
|
||
1 <= a.length ? d() : setTimeout(f, 25)
|
||
}, function () {
|
||
e()
|
||
})
|
||
}
|
||
f()
|
||
}),
|
||
e = null,
|
||
f = new Promise(function (a, d) {
|
||
e = setTimeout(d, b.f)
|
||
});
|
||
Promise.race([f, d]).then(function () {
|
||
e && (clearTimeout(e), e = null);
|
||
b.g(b.a)
|
||
}, function () {
|
||
b.j(b.a)
|
||
})
|
||
};
|
||
|
||
function Q(a, b, c, d, e, f, g) {
|
||
this.v = a;
|
||
this.B = b;
|
||
this.c = c;
|
||
this.a = d;
|
||
this.o = g || "BESbswy";
|
||
this.f = {};
|
||
this.w = e || 3E3;
|
||
this.u = f || null;
|
||
this.m = this.j = this.h = this.g = null;
|
||
this.g = new M(this.c, this.o);
|
||
this.h = new M(this.c, this.o);
|
||
this.j = new M(this.c, this.o);
|
||
this.m = new M(this.c, this.o);
|
||
a = new G(this.a.c + ",serif", J(this.a));
|
||
a = O(a);
|
||
this.g.a.style.cssText = a;
|
||
a = new G(this.a.c + ",sans-serif", J(this.a));
|
||
a = O(a);
|
||
this.h.a.style.cssText = a;
|
||
a = new G("serif", J(this.a));
|
||
a = O(a);
|
||
this.j.a.style.cssText = a;
|
||
a = new G("sans-serif", J(this.a));
|
||
a =
|
||
O(a);
|
||
this.m.a.style.cssText = a;
|
||
N(this.g);
|
||
N(this.h);
|
||
N(this.j);
|
||
N(this.m)
|
||
}
|
||
var R = {
|
||
D: "serif",
|
||
C: "sans-serif"
|
||
},
|
||
S = null;
|
||
|
||
function T() {
|
||
if (null === S) {
|
||
var a = /AppleWebKit\/([0-9]+)(?:\.([0-9]+))/.exec(window.navigator.userAgentData);
|
||
S = !!a && (536 > parseInt(a[1], 10) || 536 === parseInt(a[1], 10) && 11 >= parseInt(a[2], 10))
|
||
}
|
||
return S
|
||
}
|
||
Q.prototype.start = function () {
|
||
this.f.serif = this.j.a.offsetWidth;
|
||
this.f["sans-serif"] = this.m.a.offsetWidth;
|
||
this.A = q();
|
||
U(this)
|
||
};
|
||
|
||
function la(a, b, c) {
|
||
for (var d in R)
|
||
if (R.hasOwnProperty(d) && b === a.f[R[d]] && c === a.f[R[d]]) return !0;
|
||
return !1
|
||
}
|
||
|
||
function U(a) {
|
||
var b = a.g.a.offsetWidth,
|
||
c = a.h.a.offsetWidth,
|
||
d;
|
||
(d = b === a.f.serif && c === a.f["sans-serif"]) || (d = T() && la(a, b, c));
|
||
d ? q() - a.A >= a.w ? T() && la(a, b, c) && (null === a.u || a.u.hasOwnProperty(a.a.c)) ? V(a, a.v) : V(a, a.B) : ma(a) : V(a, a.v)
|
||
}
|
||
|
||
function ma(a) {
|
||
setTimeout(p(function () {
|
||
U(this)
|
||
}, a), 50)
|
||
}
|
||
|
||
function V(a, b) {
|
||
setTimeout(p(function () {
|
||
v(this.g.a);
|
||
v(this.h.a);
|
||
v(this.j.a);
|
||
v(this.m.a);
|
||
b(this.a)
|
||
}, a), 0)
|
||
};
|
||
|
||
function W(a, b, c) {
|
||
this.c = a;
|
||
this.a = b;
|
||
this.f = 0;
|
||
this.m = this.j = !1;
|
||
this.o = c
|
||
}
|
||
var X = null;
|
||
W.prototype.g = function (a) {
|
||
var b = this.a;
|
||
b.g && w(b.f, [b.a.c("wf", a.c, J(a).toString(), "active")], [b.a.c("wf", a.c, J(a).toString(), "loading"), b.a.c("wf", a.c, J(a).toString(), "inactive")]);
|
||
K(b, "fontactive", a);
|
||
this.m = !0;
|
||
na(this)
|
||
};
|
||
W.prototype.h = function (a) {
|
||
var b = this.a;
|
||
if (b.g) {
|
||
var c = y(b.f, b.a.c("wf", a.c, J(a).toString(), "active")),
|
||
d = [],
|
||
e = [b.a.c("wf", a.c, J(a).toString(), "loading")];
|
||
c || d.push(b.a.c("wf", a.c, J(a).toString(), "inactive"));
|
||
w(b.f, d, e)
|
||
}
|
||
K(b, "fontinactive", a);
|
||
na(this)
|
||
};
|
||
|
||
function na(a) {
|
||
0 == --a.f && a.j && (a.m ? (a = a.a, a.g && w(a.f, [a.a.c("wf", "active")], [a.a.c("wf", "loading"), a.a.c("wf", "inactive")]), K(a, "active")) : L(a.a))
|
||
};
|
||
|
||
function oa(a) {
|
||
this.j = a;
|
||
this.a = new ja;
|
||
this.h = 0;
|
||
this.f = this.g = !0
|
||
}
|
||
oa.prototype.load = function (a) {
|
||
this.c = new ca(this.j, a.context || this.j);
|
||
this.g = !1 !== a.events;
|
||
this.f = !1 !== a.classes;
|
||
pa(this, new ha(this.c, a), a)
|
||
};
|
||
|
||
function qa(a, b, c, d, e) {
|
||
var f = 0 == --a.h;
|
||
(a.f || a.g) && setTimeout(function () {
|
||
var a = e || null,
|
||
m = d || null || {};
|
||
if (0 === c.length && f) L(b.a);
|
||
else {
|
||
b.f += c.length;
|
||
f && (b.j = f);
|
||
var h, l = [];
|
||
for (h = 0; h < c.length; h++) {
|
||
var k = c[h],
|
||
n = m[k.c],
|
||
r = b.a,
|
||
x = k;
|
||
r.g && w(r.f, [r.a.c("wf", x.c, J(x).toString(), "loading")]);
|
||
K(r, "fontloading", x);
|
||
r = null;
|
||
if (null === X)
|
||
if (window.FontFace) {
|
||
var x = /Gecko.*Firefox\/(\d+)/.exec(window.navigator.userAgentData),
|
||
xa = /OS X.*Version\/10\..*Safari/.exec(window.navigator.userAgentData) && /Apple/.exec(window.navigator.vendor);
|
||
X = x ? 42 < parseInt(x[1], 10) : xa ? !1 : !0
|
||
} else X = !1;
|
||
X ? r = new P(p(b.g, b), p(b.h, b), b.c, k, b.o, n) : r = new Q(p(b.g, b), p(b.h, b), b.c, k, b.o, a, n);
|
||
l.push(r)
|
||
}
|
||
for (h = 0; h < l.length; h++) l[h].start()
|
||
}
|
||
}, 0)
|
||
}
|
||
|
||
function pa(a, b, c) {
|
||
var d = [],
|
||
e = c.timeout;
|
||
ia(b);
|
||
var d = ka(a.a, c, a.c),
|
||
f = new W(a.c, b, e);
|
||
a.h = d.length;
|
||
b = 0;
|
||
for (c = d.length; b < c; b++) d[b].load(function (b, d, c) {
|
||
qa(a, f, b, d, c)
|
||
})
|
||
};
|
||
|
||
function ra(a, b) {
|
||
this.c = a;
|
||
this.a = b
|
||
}
|
||
ra.prototype.load = function (a) {
|
||
function b() {
|
||
if (f["__mti_fntLst" + d]) {
|
||
var c = f["__mti_fntLst" + d](),
|
||
e = [],
|
||
h;
|
||
if (c)
|
||
for (var l = 0; l < c.length; l++) {
|
||
var k = c[l].fontfamily;
|
||
void 0 != c[l].fontStyle && void 0 != c[l].fontWeight ? (h = c[l].fontStyle + c[l].fontWeight, e.push(new G(k, h))) : e.push(new G(k))
|
||
}
|
||
a(e)
|
||
} else setTimeout(function () {
|
||
b()
|
||
}, 50)
|
||
}
|
||
var c = this,
|
||
d = c.a.projectId,
|
||
e = c.a.version;
|
||
if (d) {
|
||
var f = c.c.s;
|
||
A(this.c, (c.a.api || "https://fast.fonts.net/jsapi") + "/" + d + ".js" + (e ? "?v=" + e : ""), function (e) {
|
||
e ? a([]) : (f["__MonotypeConfiguration__" +
|
||
d] = function () {
|
||
return c.a
|
||
}, b())
|
||
}).id = "__MonotypeAPIScript__" + d
|
||
} else a([])
|
||
};
|
||
|
||
function sa(a, b) {
|
||
this.c = a;
|
||
this.a = b
|
||
}
|
||
sa.prototype.load = function (a) {
|
||
var b, c, d = this.a.urls || [],
|
||
e = this.a.families || [],
|
||
f = this.a.testStrings || {},
|
||
g = new B;
|
||
b = 0;
|
||
for (c = d.length; b < c; b++) z(this.c, d[b], C(g));
|
||
var m = [];
|
||
b = 0;
|
||
for (c = e.length; b < c; b++)
|
||
if (d = e[b].split(":"), d[1])
|
||
for (var h = d[1].split(","), l = 0; l < h.length; l += 1) m.push(new G(d[0], h[l]));
|
||
else m.push(new G(d[0]));
|
||
E(g, function () {
|
||
a(m, f)
|
||
})
|
||
};
|
||
|
||
function ta(a, b, c, d, e) {
|
||
this.o = 2 === e ? 2 : 1;
|
||
e = ua[this.o - 1];
|
||
a ? this.c = a : this.c = e[0];
|
||
this.m = e[1];
|
||
this.a = [];
|
||
this.f = [];
|
||
this.j = b || "";
|
||
this.g = c || "";
|
||
this.h = d || ""
|
||
}
|
||
var ua = [
|
||
["https://fonts.googleapis.com/css", "%7C"],
|
||
["https://fonts.googleapis.com/css2", "&family="]
|
||
];
|
||
|
||
function va(a, b) {
|
||
for (var c = b.length, d = 0; d < c; d++) {
|
||
var e = b[d].split(":");
|
||
3 == e.length && a.f.push(e.pop());
|
||
var f = "";
|
||
2 == e.length && "" != e[1] && (f = ":");
|
||
a.a.push(e.join(f))
|
||
}
|
||
}
|
||
|
||
function wa(a) {
|
||
if (0 == a.a.length) throw Error("No fonts to load!");
|
||
if (-1 != a.c.indexOf("kit=")) return a.c;
|
||
for (var b = a.a.length, c = [], d = 0; d < b; d++) c.push(a.a[d].replace(/ /g, "+"));
|
||
b = a.c + "?family=" + c.join(a.m);
|
||
0 < a.f.length && (b += "&subset=" + a.f.join(","));
|
||
0 < a.j.length && (b += "&text=" + encodeURIComponent(a.j));
|
||
0 < a.g.length && (b += "&display=" + encodeURIComponent(a.g));
|
||
0 < a.h.length && (b += "&effect=" + encodeURIComponent(a.h));
|
||
return b
|
||
};
|
||
|
||
function ya(a) {
|
||
this.f = a;
|
||
this.a = [];
|
||
this.c = {}
|
||
}
|
||
var za = {
|
||
latin: "BESbswy",
|
||
"latin-ext": "\u00e7\u00f6\u00fc\u011f\u015f",
|
||
cyrillic: "\u0439\u044f\u0416",
|
||
greek: "\u03b1\u03b2\u03a3",
|
||
khmer: "\u1780\u1781\u1782",
|
||
Hanuman: "\u1780\u1781\u1782"
|
||
},
|
||
Aa = {
|
||
thin: "1",
|
||
extralight: "2",
|
||
"extra-light": "2",
|
||
ultralight: "2",
|
||
"ultra-light": "2",
|
||
light: "3",
|
||
regular: "4",
|
||
book: "4",
|
||
medium: "5",
|
||
"semi-bold": "6",
|
||
semibold: "6",
|
||
"demi-bold": "6",
|
||
demibold: "6",
|
||
bold: "7",
|
||
"extra-bold": "8",
|
||
extrabold: "8",
|
||
"ultra-bold": "8",
|
||
ultrabold: "8",
|
||
black: "9",
|
||
heavy: "9",
|
||
l: "3",
|
||
r: "4",
|
||
b: "7"
|
||
},
|
||
Ba = {
|
||
i: "i",
|
||
italic: "i",
|
||
n: "n",
|
||
normal: "n"
|
||
},
|
||
Ca = /^(thin|(?:(?:extra|ultra)-?)?light|regular|book|medium|(?:(?:semi|demi|extra|ultra)-?)?bold|black|heavy|l|r|b|[1-9]00)?(n|i|normal|italic)?$/;
|
||
|
||
function Da(a) {
|
||
for (var b = a.f.length, c = 0; c < b; c++) {
|
||
var d = a.f[c].split(":"),
|
||
e = d[0].replace(/\+/g, " "),
|
||
f = ["n4"];
|
||
if (2 <= d.length) {
|
||
var g;
|
||
var m = d[1];
|
||
g = [];
|
||
if (m)
|
||
for (var m = m.split(","), h = m.length, l = 0; l < h; l++) {
|
||
var k;
|
||
k = m[l];
|
||
if (k.match(/^[\w-]+$/)) {
|
||
var n = Ca.exec(k.toLowerCase());
|
||
if (null == n) k = "";
|
||
else {
|
||
k = n[2];
|
||
k = null == k || "" == k ? "n" : Ba[k];
|
||
n = n[1];
|
||
if (null == n || "" == n) n = "4";
|
||
else var r = Aa[n],
|
||
n = r ? r : isNaN(n) ? "4" : n.substr(0, 1);
|
||
k = [k, n].join("")
|
||
}
|
||
} else k = "";
|
||
k && g.push(k)
|
||
}
|
||
0 < g.length && (f = g);
|
||
3 == d.length && (d = d[2], g = [], d = d ? d.split(",") :
|
||
g, 0 < d.length && (d = za[d[0]]) && (a.c[e] = d))
|
||
}
|
||
a.c[e] || (d = za[e]) && (a.c[e] = d);
|
||
for (d = 0; d < f.length; d += 1) a.a.push(new G(e, f[d]))
|
||
}
|
||
};
|
||
|
||
function Ea(a, b) {
|
||
this.c = a;
|
||
this.a = b
|
||
}
|
||
var Fa = {
|
||
Arimo: !0,
|
||
Cousine: !0,
|
||
Tinos: !0
|
||
};
|
||
Ea.prototype.load = function (a) {
|
||
var b = new B,
|
||
c = this.c,
|
||
d = new ta(this.a.api, this.a.text, this.a.display, this.a.effect, this.a.version),
|
||
e = this.a.families;
|
||
va(d, e);
|
||
var f = new ya(e);
|
||
Da(f);
|
||
z(c, wa(d), C(b));
|
||
E(b, function () {
|
||
a(f.a, f.c, Fa)
|
||
})
|
||
};
|
||
|
||
function Ga(a, b) {
|
||
this.c = a;
|
||
this.a = b
|
||
}
|
||
Ga.prototype.load = function (a) {
|
||
var b = this.a.id,
|
||
c = this.c.s;
|
||
b ? A(this.c, (this.a.api || "https://use.typekit.net") + "/" + b + ".js", function (b) {
|
||
if (b) a([]);
|
||
else if (c.Typekit && c.Typekit.config && c.Typekit.config.fn) {
|
||
b = c.Typekit.config.fn;
|
||
for (var e = [], f = 0; f < b.length; f += 2)
|
||
for (var g = b[f], m = b[f + 1], h = 0; h < m.length; h++) e.push(new G(g, m[h]));
|
||
try {
|
||
c.Typekit.load({
|
||
events: !1,
|
||
classes: !1,
|
||
async: !0
|
||
})
|
||
} catch (l) {}
|
||
a(e)
|
||
}
|
||
}, 2E3) : a([])
|
||
};
|
||
|
||
function Ha(a, b) {
|
||
this.c = a;
|
||
this.f = b;
|
||
this.a = []
|
||
}
|
||
Ha.prototype.load = function (a) {
|
||
var b = this.f.id,
|
||
c = this.c.s,
|
||
d = this;
|
||
b ? (c.__webfontfontdeckmodule__ || (c.__webfontfontdeckmodule__ = {}), c.__webfontfontdeckmodule__[b] = function (b, c) {
|
||
for (var g = 0, m = c.fonts.length; g < m; ++g) {
|
||
var h = c.fonts[g];
|
||
d.a.push(new G(h.name, ga("font-weight:" + h.weight + ";font-style:" + h.style)))
|
||
}
|
||
a(d.a)
|
||
}, A(this.c, (this.f.api || "https://f.fontdeck.com/s/css/js/") + ea(this.c) + "/" + b + ".js", function (b) {
|
||
b && a([])
|
||
})) : a([])
|
||
};
|
||
var Y = new oa(window);
|
||
Y.a.c.custom = function (a, b) {
|
||
return new sa(b, a)
|
||
};
|
||
Y.a.c.fontdeck = function (a, b) {
|
||
return new Ha(b, a)
|
||
};
|
||
Y.a.c.monotype = function (a, b) {
|
||
return new ra(b, a)
|
||
};
|
||
Y.a.c.typekit = function (a, b) {
|
||
return new Ga(b, a)
|
||
};
|
||
Y.a.c.google = function (a, b) {
|
||
return new Ea(b, a)
|
||
};
|
||
var Z = {
|
||
load: p(Y.load, Y)
|
||
};
|
||
"function" === typeof define && define.amd ? define(function () {
|
||
return Z
|
||
}) : "undefined" !== typeof module && module.exports ? module.exports = Z : (window.WebFont = Z, window.WebFontConfig && Y.load(window.WebFontConfig));
|
||
}());
|
||
;
|
||
/*!
|
||
* Glightbox v3.1.0
|
||
* https://github.com/biati-digital/glightbox
|
||
* Released under the MIT license
|
||
*/
|
||
|
||
(function (global, factory) {
|
||
typeof exports === "object" && typeof module !== "undefined"
|
||
? (module.exports = factory())
|
||
: typeof define === "function" && define.amd
|
||
? define(factory)
|
||
: ((global = global || self), (global.GLightbox = factory()));
|
||
})(this, function () {
|
||
"use strict";
|
||
|
||
function _typeof(obj) {
|
||
"@babel/helpers - typeof";
|
||
|
||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") {
|
||
_typeof = function (obj) {
|
||
return typeof obj;
|
||
};
|
||
} else {
|
||
_typeof = function (obj) {
|
||
return obj &&
|
||
typeof Symbol === "function" &&
|
||
obj.constructor === Symbol &&
|
||
obj !== Symbol.prototype
|
||
? "symbol"
|
||
: typeof obj;
|
||
};
|
||
}
|
||
|
||
return _typeof(obj);
|
||
}
|
||
|
||
function _classCallCheck(instance, Constructor) {
|
||
if (!(instance instanceof Constructor)) {
|
||
throw new TypeError("Cannot call a class as a function");
|
||
}
|
||
}
|
||
|
||
function _defineProperties(target, props) {
|
||
for (var i = 0; i < props.length; i++) {
|
||
var descriptor = props[i];
|
||
descriptor.enumerable = descriptor.enumerable || false;
|
||
descriptor.configurable = true;
|
||
if ("value" in descriptor) descriptor.writable = true;
|
||
Object.defineProperty(target, descriptor.key, descriptor);
|
||
}
|
||
}
|
||
|
||
function _createClass(Constructor, protoProps, staticProps) {
|
||
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
||
if (staticProps) _defineProperties(Constructor, staticProps);
|
||
return Constructor;
|
||
}
|
||
|
||
var uid = Date.now();
|
||
function extend() {
|
||
var extended = {};
|
||
var deep = true;
|
||
var i = 0;
|
||
var length = arguments.length;
|
||
|
||
if (Object.prototype.toString.call(arguments[0]) === "[object Boolean]") {
|
||
deep = arguments[0];
|
||
i++;
|
||
}
|
||
|
||
var merge = function merge(obj) {
|
||
for (var prop in obj) {
|
||
if (Object.prototype.hasOwnProperty.call(obj, prop)) {
|
||
if (
|
||
deep &&
|
||
Object.prototype.toString.call(obj[prop]) === "[object Object]"
|
||
) {
|
||
extended[prop] = extend(true, extended[prop], obj[prop]);
|
||
} else {
|
||
extended[prop] = obj[prop];
|
||
}
|
||
}
|
||
}
|
||
};
|
||
|
||
for (; i < length; i++) {
|
||
var obj = arguments[i];
|
||
merge(obj);
|
||
}
|
||
|
||
return extended;
|
||
}
|
||
function each(collection, callback) {
|
||
if (
|
||
isNode(collection) ||
|
||
collection === window ||
|
||
collection === document
|
||
) {
|
||
collection = [collection];
|
||
}
|
||
|
||
if (!isArrayLike(collection) && !isObject(collection)) {
|
||
collection = [collection];
|
||
}
|
||
|
||
if (size(collection) == 0) {
|
||
return;
|
||
}
|
||
|
||
if (isArrayLike(collection) && !isObject(collection)) {
|
||
var l = collection.length,
|
||
i = 0;
|
||
|
||
for (; i < l; i++) {
|
||
if (
|
||
callback.call(collection[i], collection[i], i, collection) === false
|
||
) {
|
||
break;
|
||
}
|
||
}
|
||
} else if (isObject(collection)) {
|
||
for (var key in collection) {
|
||
if (has(collection, key)) {
|
||
if (
|
||
callback.call(collection[key], collection[key], key, collection) ===
|
||
false
|
||
) {
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
}
|
||
function getNodeEvents(node) {
|
||
var name =
|
||
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
||
var fn =
|
||
arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
||
var cache = (node[uid] = node[uid] || []);
|
||
var data = {
|
||
all: cache,
|
||
evt: null,
|
||
found: null,
|
||
};
|
||
|
||
if (name && fn && size(cache) > 0) {
|
||
each(cache, function (cl, i) {
|
||
if (cl.eventName == name && cl.fn.toString() == fn.toString()) {
|
||
data.found = true;
|
||
data.evt = i;
|
||
return false;
|
||
}
|
||
});
|
||
}
|
||
|
||
return data;
|
||
}
|
||
function addEvent(eventName) {
|
||
var _ref =
|
||
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
||
onElement = _ref.onElement,
|
||
withCallback = _ref.withCallback,
|
||
_ref$avoidDuplicate = _ref.avoidDuplicate,
|
||
avoidDuplicate =
|
||
_ref$avoidDuplicate === void 0 ? true : _ref$avoidDuplicate,
|
||
_ref$once = _ref.once,
|
||
once = _ref$once === void 0 ? false : _ref$once,
|
||
_ref$useCapture = _ref.useCapture,
|
||
useCapture = _ref$useCapture === void 0 ? false : _ref$useCapture;
|
||
|
||
var thisArg = arguments.length > 2 ? arguments[2] : undefined;
|
||
var element = onElement || [];
|
||
|
||
if (isString(element)) {
|
||
element = document.querySelectorAll(element);
|
||
}
|
||
|
||
function handler(event) {
|
||
if (isFunction(withCallback)) {
|
||
withCallback.call(thisArg, event, this);
|
||
}
|
||
|
||
if (once) {
|
||
handler.destroy();
|
||
}
|
||
}
|
||
|
||
handler.destroy = function () {
|
||
each(element, function (el) {
|
||
var events = getNodeEvents(el, eventName, handler);
|
||
|
||
if (events.found) {
|
||
events.all.splice(events.evt, 1);
|
||
}
|
||
|
||
if (el.removeEventListener) {
|
||
el.removeEventListener(eventName, handler, useCapture);
|
||
}
|
||
});
|
||
};
|
||
|
||
each(element, function (el) {
|
||
var events = getNodeEvents(el, eventName, handler);
|
||
|
||
if (
|
||
(el.addEventListener && avoidDuplicate && !events.found) ||
|
||
!avoidDuplicate
|
||
) {
|
||
el.addEventListener(eventName, handler, useCapture);
|
||
events.all.push({
|
||
eventName: eventName,
|
||
fn: handler,
|
||
});
|
||
}
|
||
});
|
||
return handler;
|
||
}
|
||
function addClass(node, name) {
|
||
each(name.split(" "), function (cl) {
|
||
return node.classList.add(cl);
|
||
});
|
||
}
|
||
function removeClass(node, name) {
|
||
each(name.split(" "), function (cl) {
|
||
return node.classList.remove(cl);
|
||
});
|
||
}
|
||
function hasClass(node, name) {
|
||
return node.classList.contains(name);
|
||
}
|
||
function closest(elem, selector) {
|
||
while (elem !== document.body) {
|
||
elem = elem.parentElement;
|
||
|
||
if (!elem) {
|
||
return false;
|
||
}
|
||
|
||
var matches =
|
||
typeof elem.matches == "function"
|
||
? elem.matches(selector)
|
||
: elem.msMatchesSelector(selector);
|
||
|
||
if (matches) {
|
||
return elem;
|
||
}
|
||
}
|
||
}
|
||
function animateElement(element) {
|
||
var animation =
|
||
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
||
var callback =
|
||
arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||
|
||
if (!element || animation === "") {
|
||
return false;
|
||
}
|
||
|
||
if (animation == "none") {
|
||
if (isFunction(callback)) {
|
||
callback();
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
var animationEnd = whichAnimationEvent();
|
||
var animationNames = animation.split(" ");
|
||
each(animationNames, function (name) {
|
||
addClass(element, "g" + name);
|
||
});
|
||
addEvent(animationEnd, {
|
||
onElement: element,
|
||
avoidDuplicate: false,
|
||
once: true,
|
||
withCallback: function withCallback(event, target) {
|
||
each(animationNames, function (name) {
|
||
removeClass(target, "g" + name);
|
||
});
|
||
|
||
if (isFunction(callback)) {
|
||
callback();
|
||
}
|
||
},
|
||
});
|
||
}
|
||
function cssTransform(node) {
|
||
var translate =
|
||
arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "";
|
||
|
||
if (translate == "") {
|
||
node.style.webkitTransform = "";
|
||
node.style.MozTransform = "";
|
||
node.style.msTransform = "";
|
||
node.style.OTransform = "";
|
||
node.style.transform = "";
|
||
return false;
|
||
}
|
||
|
||
node.style.webkitTransform = translate;
|
||
node.style.MozTransform = translate;
|
||
node.style.msTransform = translate;
|
||
node.style.OTransform = translate;
|
||
node.style.transform = translate;
|
||
}
|
||
function show(element) {
|
||
element.style.display = "block";
|
||
}
|
||
function hide(element) {
|
||
element.style.display = "none";
|
||
}
|
||
function createHTML(htmlStr) {
|
||
var frag = document.createDocumentFragment(),
|
||
temp = document.createElement("div");
|
||
temp.innerHTML = htmlStr;
|
||
|
||
while (temp.firstChild) {
|
||
frag.appendChild(temp.firstChild);
|
||
}
|
||
|
||
return frag;
|
||
}
|
||
function windowSize() {
|
||
return {
|
||
width:
|
||
window.innerWidth ||
|
||
document.documentElement.clientWidth ||
|
||
document.body.clientWidth,
|
||
height:
|
||
window.innerHeight ||
|
||
document.documentElement.clientHeight ||
|
||
document.body.clientHeight,
|
||
};
|
||
}
|
||
function whichAnimationEvent() {
|
||
var t,
|
||
el = document.createElement("fakeelement");
|
||
var animations = {
|
||
animation: "animationend",
|
||
OAnimation: "oAnimationEnd",
|
||
MozAnimation: "animationend",
|
||
WebkitAnimation: "webkitAnimationEnd",
|
||
};
|
||
|
||
for (t in animations) {
|
||
if (el.style[t] !== undefined) {
|
||
return animations[t];
|
||
}
|
||
}
|
||
}
|
||
function whichTransitionEvent() {
|
||
var t,
|
||
el = document.createElement("fakeelement");
|
||
var transitions = {
|
||
transition: "transitionend",
|
||
OTransition: "oTransitionEnd",
|
||
MozTransition: "transitionend",
|
||
WebkitTransition: "webkitTransitionEnd",
|
||
};
|
||
|
||
for (t in transitions) {
|
||
if (el.style[t] !== undefined) {
|
||
return transitions[t];
|
||
}
|
||
}
|
||
}
|
||
function createIframe(config) {
|
||
var url = config.url,
|
||
allow = config.allow,
|
||
callback = config.callback,
|
||
appendTo = config.appendTo;
|
||
var iframe = document.createElement("iframe");
|
||
iframe.className = "vimeo-video gvideo";
|
||
iframe.src = url;
|
||
iframe.style.width = "100%";
|
||
iframe.style.height = "100%";
|
||
|
||
if (allow) {
|
||
iframe.setAttribute("allow", allow);
|
||
}
|
||
|
||
iframe.onload = function () {
|
||
addClass(iframe, "node-ready");
|
||
|
||
if (isFunction(callback)) {
|
||
callback();
|
||
}
|
||
};
|
||
|
||
if (appendTo) {
|
||
appendTo.appendChild(iframe);
|
||
}
|
||
|
||
return iframe;
|
||
}
|
||
function waitUntil(check, onComplete, delay, timeout) {
|
||
if (check()) {
|
||
onComplete();
|
||
return;
|
||
}
|
||
|
||
if (!delay) {
|
||
delay = 100;
|
||
}
|
||
|
||
var timeoutPointer;
|
||
var intervalPointer = setInterval(function () {
|
||
if (!check()) {
|
||
return;
|
||
}
|
||
|
||
clearInterval(intervalPointer);
|
||
|
||
if (timeoutPointer) {
|
||
clearTimeout(timeoutPointer);
|
||
}
|
||
|
||
onComplete();
|
||
}, delay);
|
||
|
||
if (timeout) {
|
||
timeoutPointer = setTimeout(function () {
|
||
clearInterval(intervalPointer);
|
||
}, timeout);
|
||
}
|
||
}
|
||
function injectAssets(url, waitFor, callback) {
|
||
if (isNil(url)) {
|
||
console.error("Inject assets error");
|
||
return;
|
||
}
|
||
|
||
if (isFunction(waitFor)) {
|
||
callback = waitFor;
|
||
waitFor = false;
|
||
}
|
||
|
||
if (isString(waitFor) && waitFor in window) {
|
||
if (isFunction(callback)) {
|
||
callback();
|
||
}
|
||
|
||
return;
|
||
}
|
||
|
||
var found;
|
||
|
||
if (url.indexOf(".css") !== -1) {
|
||
found = document.querySelectorAll('link[href="' + url + '"]');
|
||
|
||
if (found && found.length > 0) {
|
||
if (isFunction(callback)) {
|
||
callback();
|
||
}
|
||
|
||
return;
|
||
}
|
||
|
||
var head = document.getElementsByTagName("head")[0];
|
||
var headStyles = head.querySelectorAll('link[rel="stylesheet"]');
|
||
var link = document.createElement("link");
|
||
link.rel = "stylesheet";
|
||
link.type = "text/css";
|
||
link.href = url;
|
||
link.media = "all";
|
||
|
||
if (headStyles) {
|
||
head.insertBefore(link, headStyles[0]);
|
||
} else {
|
||
head.appendChild(link);
|
||
}
|
||
|
||
if (isFunction(callback)) {
|
||
callback();
|
||
}
|
||
|
||
return;
|
||
}
|
||
|
||
found = document.querySelectorAll('script[src="' + url + '"]');
|
||
|
||
if (found && found.length > 0) {
|
||
if (isFunction(callback)) {
|
||
if (isString(waitFor)) {
|
||
waitUntil(
|
||
function () {
|
||
return typeof window[waitFor] !== "undefined";
|
||
},
|
||
function () {
|
||
callback();
|
||
}
|
||
);
|
||
return false;
|
||
}
|
||
|
||
callback();
|
||
}
|
||
|
||
return;
|
||
}
|
||
|
||
var script = document.createElement("script");
|
||
script.type = "text/javascript";
|
||
script.src = url;
|
||
|
||
script.onload = function () {
|
||
if (isFunction(callback)) {
|
||
if (isString(waitFor)) {
|
||
waitUntil(
|
||
function () {
|
||
return typeof window[waitFor] !== "undefined";
|
||
},
|
||
function () {
|
||
callback();
|
||
}
|
||
);
|
||
return false;
|
||
}
|
||
|
||
callback();
|
||
}
|
||
};
|
||
|
||
document.body.appendChild(script);
|
||
return;
|
||
}
|
||
function isMobile() {
|
||
return (
|
||
"navigator" in window &&
|
||
window.navigator.userAgent.match(
|
||
/(iPad)|(iPhone)|(iPod)|(Android)|(PlayBook)|(BB10)|(BlackBerry)|(Opera Mini)|(IEMobile)|(webOS)|(MeeGo)/i
|
||
)
|
||
);
|
||
}
|
||
function isTouch() {
|
||
return (
|
||
isMobile() !== null ||
|
||
document.createTouch !== undefined ||
|
||
"ontouchstart" in window ||
|
||
"onmsgesturechange" in window ||
|
||
navigator.msMaxTouchPoints
|
||
);
|
||
}
|
||
function isFunction(f) {
|
||
return typeof f === "function";
|
||
}
|
||
function isString(s) {
|
||
return typeof s === "string";
|
||
}
|
||
function isNode(el) {
|
||
return !!(el && el.nodeType && el.nodeType == 1);
|
||
}
|
||
function isArray(ar) {
|
||
return Array.isArray(ar);
|
||
}
|
||
function isArrayLike(ar) {
|
||
return ar && ar.length && isFinite(ar.length);
|
||
}
|
||
function isObject(o) {
|
||
var type = _typeof(o);
|
||
|
||
return type === "object" && o != null && !isFunction(o) && !isArray(o);
|
||
}
|
||
function isNil(o) {
|
||
return o == null;
|
||
}
|
||
function has(obj, key) {
|
||
return obj !== null && hasOwnProperty.call(obj, key);
|
||
}
|
||
function size(o) {
|
||
if (isObject(o)) {
|
||
if (o.keys) {
|
||
return o.keys().length;
|
||
}
|
||
|
||
var l = 0;
|
||
|
||
for (var k in o) {
|
||
if (has(o, k)) {
|
||
l++;
|
||
}
|
||
}
|
||
|
||
return l;
|
||
} else {
|
||
return o.length;
|
||
}
|
||
}
|
||
function isNumber(n) {
|
||
return !isNaN(parseFloat(n)) && isFinite(n);
|
||
}
|
||
|
||
function getNextFocusElement() {
|
||
var current =
|
||
arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : -1;
|
||
var btns = document.querySelectorAll(".gbtn[data-taborder]:not(.disabled)");
|
||
|
||
if (!btns.length) {
|
||
return false;
|
||
}
|
||
|
||
if (btns.length == 1) {
|
||
return btns[0];
|
||
}
|
||
|
||
if (typeof current == "string") {
|
||
current = parseInt(current);
|
||
}
|
||
|
||
var orders = [];
|
||
each(btns, function (btn) {
|
||
orders.push(btn.getAttribute("data-taborder"));
|
||
});
|
||
var highestOrder = Math.max.apply(
|
||
Math,
|
||
orders.map(function (order) {
|
||
return parseInt(order);
|
||
})
|
||
);
|
||
var newIndex = current < 0 ? 1 : current + 1;
|
||
|
||
if (newIndex > highestOrder) {
|
||
newIndex = "1";
|
||
}
|
||
|
||
var nextOrders = orders.filter(function (el) {
|
||
return el >= parseInt(newIndex);
|
||
});
|
||
var nextFocus = nextOrders.sort()[0];
|
||
return document.querySelector(
|
||
'.gbtn[data-taborder="'.concat(nextFocus, '"]')
|
||
);
|
||
}
|
||
|
||
function keyboardNavigation(instance) {
|
||
if (instance.events.hasOwnProperty("keyboard")) {
|
||
return false;
|
||
}
|
||
|
||
instance.events["keyboard"] = addEvent("keydown", {
|
||
onElement: window,
|
||
withCallback: function withCallback(event, target) {
|
||
event = event || window.event;
|
||
var key = event.keyCode;
|
||
|
||
if (key == 9) {
|
||
var focusedButton = document.querySelector(".gbtn.focused");
|
||
|
||
if (!focusedButton) {
|
||
var activeElement =
|
||
document.activeElement && document.activeElement.nodeName
|
||
? document.activeElement.nodeName.toLocaleLowerCase()
|
||
: false;
|
||
|
||
if (
|
||
activeElement == "input" ||
|
||
activeElement == "textarea" ||
|
||
activeElement == "button"
|
||
) {
|
||
return;
|
||
}
|
||
}
|
||
|
||
event.preventDefault();
|
||
var btns = document.querySelectorAll(".gbtn[data-taborder]");
|
||
|
||
if (!btns || btns.length <= 0) {
|
||
return;
|
||
}
|
||
|
||
if (!focusedButton) {
|
||
var first = getNextFocusElement();
|
||
|
||
if (first) {
|
||
first.focus();
|
||
addClass(first, "focused");
|
||
}
|
||
|
||
return;
|
||
}
|
||
|
||
var currentFocusOrder = focusedButton.getAttribute("data-taborder");
|
||
var nextFocus = getNextFocusElement(currentFocusOrder);
|
||
removeClass(focusedButton, "focused");
|
||
|
||
if (nextFocus) {
|
||
nextFocus.focus();
|
||
addClass(nextFocus, "focused");
|
||
}
|
||
}
|
||
|
||
if (key == 39) {
|
||
instance.nextSlide();
|
||
}
|
||
|
||
if (key == 37) {
|
||
instance.prevSlide();
|
||
}
|
||
|
||
if (key == 27) {
|
||
instance.close();
|
||
}
|
||
},
|
||
});
|
||
}
|
||
|
||
function getLen(v) {
|
||
return Math.sqrt(v.x * v.x + v.y * v.y);
|
||
}
|
||
|
||
function dot(v1, v2) {
|
||
return v1.x * v2.x + v1.y * v2.y;
|
||
}
|
||
|
||
function getAngle(v1, v2) {
|
||
var mr = getLen(v1) * getLen(v2);
|
||
|
||
if (mr === 0) {
|
||
return 0;
|
||
}
|
||
|
||
var r = dot(v1, v2) / mr;
|
||
|
||
if (r > 1) {
|
||
r = 1;
|
||
}
|
||
|
||
return Math.acos(r);
|
||
}
|
||
|
||
function cross(v1, v2) {
|
||
return v1.x * v2.y - v2.x * v1.y;
|
||
}
|
||
|
||
function getRotateAngle(v1, v2) {
|
||
var angle = getAngle(v1, v2);
|
||
|
||
if (cross(v1, v2) > 0) {
|
||
angle *= -1;
|
||
}
|
||
|
||
return (angle * 180) / Math.PI;
|
||
}
|
||
|
||
var EventsHandlerAdmin = (function () {
|
||
function EventsHandlerAdmin(el) {
|
||
_classCallCheck(this, EventsHandlerAdmin);
|
||
|
||
this.handlers = [];
|
||
this.el = el;
|
||
}
|
||
|
||
_createClass(EventsHandlerAdmin, [
|
||
{
|
||
key: "add",
|
||
value: function add(handler) {
|
||
this.handlers.push(handler);
|
||
},
|
||
},
|
||
{
|
||
key: "del",
|
||
value: function del(handler) {
|
||
if (!handler) {
|
||
this.handlers = [];
|
||
}
|
||
|
||
for (var i = this.handlers.length; i >= 0; i--) {
|
||
if (this.handlers[i] === handler) {
|
||
this.handlers.splice(i, 1);
|
||
}
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "dispatch",
|
||
value: function dispatch() {
|
||
for (var i = 0, len = this.handlers.length; i < len; i++) {
|
||
var handler = this.handlers[i];
|
||
|
||
if (typeof handler === "function") {
|
||
handler.apply(this.el, arguments);
|
||
}
|
||
}
|
||
},
|
||
},
|
||
]);
|
||
|
||
return EventsHandlerAdmin;
|
||
})();
|
||
|
||
function wrapFunc(el, handler) {
|
||
var EventshandlerAdmin = new EventsHandlerAdmin(el);
|
||
EventshandlerAdmin.add(handler);
|
||
return EventshandlerAdmin;
|
||
}
|
||
|
||
var TouchEvents = (function () {
|
||
function TouchEvents(el, option) {
|
||
_classCallCheck(this, TouchEvents);
|
||
|
||
this.element = typeof el == "string" ? document.querySelector(el) : el;
|
||
this.start = this.start.bind(this);
|
||
this.move = this.move.bind(this);
|
||
this.end = this.end.bind(this);
|
||
this.cancel = this.cancel.bind(this);
|
||
this.element.addEventListener("touchstart", this.start, false);
|
||
this.element.addEventListener("touchmove", this.move, false);
|
||
this.element.addEventListener("touchend", this.end, false);
|
||
this.element.addEventListener("touchcancel", this.cancel, false);
|
||
this.preV = {
|
||
x: null,
|
||
y: null,
|
||
};
|
||
this.pinchStartLen = null;
|
||
this.zoom = 1;
|
||
this.isDoubleTap = false;
|
||
|
||
var noop = function noop() {};
|
||
|
||
this.rotate = wrapFunc(this.element, option.rotate || noop);
|
||
this.touchStart = wrapFunc(this.element, option.touchStart || noop);
|
||
this.multipointStart = wrapFunc(
|
||
this.element,
|
||
option.multipointStart || noop
|
||
);
|
||
this.multipointEnd = wrapFunc(this.element, option.multipointEnd || noop);
|
||
this.pinch = wrapFunc(this.element, option.pinch || noop);
|
||
this.swipe = wrapFunc(this.element, option.swipe || noop);
|
||
this.tap = wrapFunc(this.element, option.tap || noop);
|
||
this.doubleTap = wrapFunc(this.element, option.doubleTap || noop);
|
||
this.longTap = wrapFunc(this.element, option.longTap || noop);
|
||
this.singleTap = wrapFunc(this.element, option.singleTap || noop);
|
||
this.pressMove = wrapFunc(this.element, option.pressMove || noop);
|
||
this.twoFingerPressMove = wrapFunc(
|
||
this.element,
|
||
option.twoFingerPressMove || noop
|
||
);
|
||
this.touchMove = wrapFunc(this.element, option.touchMove || noop);
|
||
this.touchEnd = wrapFunc(this.element, option.touchEnd || noop);
|
||
this.touchCancel = wrapFunc(this.element, option.touchCancel || noop);
|
||
this.translateContainer = this.element;
|
||
this._cancelAllHandler = this.cancelAll.bind(this);
|
||
window.addEventListener("scroll", this._cancelAllHandler);
|
||
this.delta = null;
|
||
this.last = null;
|
||
this.now = null;
|
||
this.tapTimeout = null;
|
||
this.singleTapTimeout = null;
|
||
this.longTapTimeout = null;
|
||
this.swipeTimeout = null;
|
||
this.x1 = this.x2 = this.y1 = this.y2 = null;
|
||
this.preTapPosition = {
|
||
x: null,
|
||
y: null,
|
||
};
|
||
}
|
||
|
||
_createClass(TouchEvents, [
|
||
{
|
||
key: "start",
|
||
value: function start(evt) {
|
||
if (!evt.touches) {
|
||
return;
|
||
}
|
||
|
||
var ignoreDragFor = ["a", "button", "input"];
|
||
|
||
if (
|
||
evt.target &&
|
||
evt.target.nodeName &&
|
||
ignoreDragFor.indexOf(evt.target.nodeName.toLowerCase()) >= 0
|
||
) {
|
||
console.log(
|
||
"ignore drag for this touched element",
|
||
evt.target.nodeName.toLowerCase()
|
||
);
|
||
return;
|
||
}
|
||
|
||
this.now = Date.now();
|
||
this.x1 = evt.touches[0].pageX;
|
||
this.y1 = evt.touches[0].pageY;
|
||
this.delta = this.now - (this.last || this.now);
|
||
this.touchStart.dispatch(evt, this.element);
|
||
|
||
if (this.preTapPosition.x !== null) {
|
||
this.isDoubleTap =
|
||
this.delta > 0 &&
|
||
this.delta <= 250 &&
|
||
Math.abs(this.preTapPosition.x - this.x1) < 30 &&
|
||
Math.abs(this.preTapPosition.y - this.y1) < 30;
|
||
|
||
if (this.isDoubleTap) {
|
||
clearTimeout(this.singleTapTimeout);
|
||
}
|
||
}
|
||
|
||
this.preTapPosition.x = this.x1;
|
||
this.preTapPosition.y = this.y1;
|
||
this.last = this.now;
|
||
var preV = this.preV,
|
||
len = evt.touches.length;
|
||
|
||
if (len > 1) {
|
||
this._cancelLongTap();
|
||
|
||
this._cancelSingleTap();
|
||
|
||
var v = {
|
||
x: evt.touches[1].pageX - this.x1,
|
||
y: evt.touches[1].pageY - this.y1,
|
||
};
|
||
preV.x = v.x;
|
||
preV.y = v.y;
|
||
this.pinchStartLen = getLen(preV);
|
||
this.multipointStart.dispatch(evt, this.element);
|
||
}
|
||
|
||
this._preventTap = false;
|
||
this.longTapTimeout = setTimeout(
|
||
function () {
|
||
this.longTap.dispatch(evt, this.element);
|
||
this._preventTap = true;
|
||
}.bind(this),
|
||
750
|
||
);
|
||
},
|
||
},
|
||
{
|
||
key: "move",
|
||
value: function move(evt) {
|
||
if (!evt.touches) {
|
||
return;
|
||
}
|
||
|
||
var preV = this.preV,
|
||
len = evt.touches.length,
|
||
currentX = evt.touches[0].pageX,
|
||
currentY = evt.touches[0].pageY;
|
||
this.isDoubleTap = false;
|
||
|
||
if (len > 1) {
|
||
var sCurrentX = evt.touches[1].pageX,
|
||
sCurrentY = evt.touches[1].pageY;
|
||
var v = {
|
||
x: evt.touches[1].pageX - currentX,
|
||
y: evt.touches[1].pageY - currentY,
|
||
};
|
||
|
||
if (preV.x !== null) {
|
||
if (this.pinchStartLen > 0) {
|
||
evt.zoom = getLen(v) / this.pinchStartLen;
|
||
this.pinch.dispatch(evt, this.element);
|
||
}
|
||
|
||
evt.angle = getRotateAngle(v, preV);
|
||
this.rotate.dispatch(evt, this.element);
|
||
}
|
||
|
||
preV.x = v.x;
|
||
preV.y = v.y;
|
||
|
||
if (this.x2 !== null && this.sx2 !== null) {
|
||
evt.deltaX = (currentX - this.x2 + sCurrentX - this.sx2) / 2;
|
||
evt.deltaY = (currentY - this.y2 + sCurrentY - this.sy2) / 2;
|
||
} else {
|
||
evt.deltaX = 0;
|
||
evt.deltaY = 0;
|
||
}
|
||
|
||
this.twoFingerPressMove.dispatch(evt, this.element);
|
||
this.sx2 = sCurrentX;
|
||
this.sy2 = sCurrentY;
|
||
} else {
|
||
if (this.x2 !== null) {
|
||
evt.deltaX = currentX - this.x2;
|
||
evt.deltaY = currentY - this.y2;
|
||
var movedX = Math.abs(this.x1 - this.x2),
|
||
movedY = Math.abs(this.y1 - this.y2);
|
||
|
||
if (movedX > 10 || movedY > 10) {
|
||
this._preventTap = true;
|
||
}
|
||
} else {
|
||
evt.deltaX = 0;
|
||
evt.deltaY = 0;
|
||
}
|
||
|
||
this.pressMove.dispatch(evt, this.element);
|
||
}
|
||
|
||
this.touchMove.dispatch(evt, this.element);
|
||
|
||
this._cancelLongTap();
|
||
|
||
this.x2 = currentX;
|
||
this.y2 = currentY;
|
||
|
||
if (len > 1) {
|
||
evt.preventDefault();
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "end",
|
||
value: function end(evt) {
|
||
if (!evt.changedTouches) {
|
||
return;
|
||
}
|
||
|
||
this._cancelLongTap();
|
||
|
||
var self = this;
|
||
|
||
if (evt.touches.length < 2) {
|
||
this.multipointEnd.dispatch(evt, this.element);
|
||
this.sx2 = this.sy2 = null;
|
||
}
|
||
|
||
if (
|
||
(this.x2 && Math.abs(this.x1 - this.x2) > 30) ||
|
||
(this.y2 && Math.abs(this.y1 - this.y2) > 30)
|
||
) {
|
||
evt.direction = this._swipeDirection(
|
||
this.x1,
|
||
this.x2,
|
||
this.y1,
|
||
this.y2
|
||
);
|
||
this.swipeTimeout = setTimeout(function () {
|
||
self.swipe.dispatch(evt, self.element);
|
||
}, 0);
|
||
} else {
|
||
this.tapTimeout = setTimeout(function () {
|
||
if (!self._preventTap) {
|
||
self.tap.dispatch(evt, self.element);
|
||
}
|
||
|
||
if (self.isDoubleTap) {
|
||
self.doubleTap.dispatch(evt, self.element);
|
||
self.isDoubleTap = false;
|
||
}
|
||
}, 0);
|
||
|
||
if (!self.isDoubleTap) {
|
||
self.singleTapTimeout = setTimeout(function () {
|
||
self.singleTap.dispatch(evt, self.element);
|
||
}, 250);
|
||
}
|
||
}
|
||
|
||
this.touchEnd.dispatch(evt, this.element);
|
||
this.preV.x = 0;
|
||
this.preV.y = 0;
|
||
this.zoom = 1;
|
||
this.pinchStartLen = null;
|
||
this.x1 = this.x2 = this.y1 = this.y2 = null;
|
||
},
|
||
},
|
||
{
|
||
key: "cancelAll",
|
||
value: function cancelAll() {
|
||
this._preventTap = true;
|
||
clearTimeout(this.singleTapTimeout);
|
||
clearTimeout(this.tapTimeout);
|
||
clearTimeout(this.longTapTimeout);
|
||
clearTimeout(this.swipeTimeout);
|
||
},
|
||
},
|
||
{
|
||
key: "cancel",
|
||
value: function cancel(evt) {
|
||
this.cancelAll();
|
||
this.touchCancel.dispatch(evt, this.element);
|
||
},
|
||
},
|
||
{
|
||
key: "_cancelLongTap",
|
||
value: function _cancelLongTap() {
|
||
clearTimeout(this.longTapTimeout);
|
||
},
|
||
},
|
||
{
|
||
key: "_cancelSingleTap",
|
||
value: function _cancelSingleTap() {
|
||
clearTimeout(this.singleTapTimeout);
|
||
},
|
||
},
|
||
{
|
||
key: "_swipeDirection",
|
||
value: function _swipeDirection(x1, x2, y1, y2) {
|
||
return Math.abs(x1 - x2) >= Math.abs(y1 - y2)
|
||
? x1 - x2 > 0
|
||
? "Left"
|
||
: "Right"
|
||
: y1 - y2 > 0
|
||
? "Up"
|
||
: "Down";
|
||
},
|
||
},
|
||
{
|
||
key: "on",
|
||
value: function on(evt, handler) {
|
||
if (this[evt]) {
|
||
this[evt].add(handler);
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "off",
|
||
value: function off(evt, handler) {
|
||
if (this[evt]) {
|
||
this[evt].del(handler);
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "destroy",
|
||
value: function destroy() {
|
||
if (this.singleTapTimeout) {
|
||
clearTimeout(this.singleTapTimeout);
|
||
}
|
||
|
||
if (this.tapTimeout) {
|
||
clearTimeout(this.tapTimeout);
|
||
}
|
||
|
||
if (this.longTapTimeout) {
|
||
clearTimeout(this.longTapTimeout);
|
||
}
|
||
|
||
if (this.swipeTimeout) {
|
||
clearTimeout(this.swipeTimeout);
|
||
}
|
||
|
||
this.element.removeEventListener("touchstart", this.start);
|
||
this.element.removeEventListener("touchmove", this.move);
|
||
this.element.removeEventListener("touchend", this.end);
|
||
this.element.removeEventListener("touchcancel", this.cancel);
|
||
this.rotate.del();
|
||
this.touchStart.del();
|
||
this.multipointStart.del();
|
||
this.multipointEnd.del();
|
||
this.pinch.del();
|
||
this.swipe.del();
|
||
this.tap.del();
|
||
this.doubleTap.del();
|
||
this.longTap.del();
|
||
this.singleTap.del();
|
||
this.pressMove.del();
|
||
this.twoFingerPressMove.del();
|
||
this.touchMove.del();
|
||
this.touchEnd.del();
|
||
this.touchCancel.del();
|
||
this.preV =
|
||
this.pinchStartLen =
|
||
this.zoom =
|
||
this.isDoubleTap =
|
||
this.delta =
|
||
this.last =
|
||
this.now =
|
||
this.tapTimeout =
|
||
this.singleTapTimeout =
|
||
this.longTapTimeout =
|
||
this.swipeTimeout =
|
||
this.x1 =
|
||
this.x2 =
|
||
this.y1 =
|
||
this.y2 =
|
||
this.preTapPosition =
|
||
this.rotate =
|
||
this.touchStart =
|
||
this.multipointStart =
|
||
this.multipointEnd =
|
||
this.pinch =
|
||
this.swipe =
|
||
this.tap =
|
||
this.doubleTap =
|
||
this.longTap =
|
||
this.singleTap =
|
||
this.pressMove =
|
||
this.touchMove =
|
||
this.touchEnd =
|
||
this.touchCancel =
|
||
this.twoFingerPressMove =
|
||
null;
|
||
window.removeEventListener("scroll", this._cancelAllHandler);
|
||
return null;
|
||
},
|
||
},
|
||
]);
|
||
|
||
return TouchEvents;
|
||
})();
|
||
|
||
function resetSlideMove(slide) {
|
||
var transitionEnd = whichTransitionEvent();
|
||
var windowWidth =
|
||
window.innerWidth ||
|
||
document.documentElement.clientWidth ||
|
||
document.body.clientWidth;
|
||
var media = hasClass(slide, "gslide-media")
|
||
? slide
|
||
: slide.querySelector(".gslide-media");
|
||
var container = closest(media, ".ginner-container");
|
||
var desc = slide.querySelector(".gslide-description");
|
||
|
||
if (windowWidth > 769) {
|
||
media = container;
|
||
}
|
||
|
||
addClass(media, "greset");
|
||
cssTransform(media, "translate3d(0, 0, 0)");
|
||
addEvent(transitionEnd, {
|
||
onElement: media,
|
||
once: true,
|
||
withCallback: function withCallback(event, target) {
|
||
removeClass(media, "greset");
|
||
},
|
||
});
|
||
media.style.opacity = "";
|
||
|
||
if (desc) {
|
||
desc.style.opacity = "";
|
||
}
|
||
}
|
||
|
||
function touchNavigation(instance) {
|
||
if (instance.events.hasOwnProperty("touch")) {
|
||
return false;
|
||
}
|
||
|
||
var winSize = windowSize();
|
||
var winWidth = winSize.width;
|
||
var winHeight = winSize.height;
|
||
var process = false;
|
||
var currentSlide = null;
|
||
var media = null;
|
||
var mediaImage = null;
|
||
var doingMove = false;
|
||
var initScale = 1;
|
||
var maxScale = 4.5;
|
||
var currentScale = 1;
|
||
var doingZoom = false;
|
||
var imageZoomed = false;
|
||
var zoomedPosX = null;
|
||
var zoomedPosY = null;
|
||
var lastZoomedPosX = null;
|
||
var lastZoomedPosY = null;
|
||
var hDistance;
|
||
var vDistance;
|
||
var hDistancePercent = 0;
|
||
var vDistancePercent = 0;
|
||
var vSwipe = false;
|
||
var hSwipe = false;
|
||
var startCoords = {};
|
||
var endCoords = {};
|
||
var xDown = 0;
|
||
var yDown = 0;
|
||
var isInlined;
|
||
var sliderWrapper = document.getElementById("glightbox-slider");
|
||
var overlay = document.querySelector(".goverlay");
|
||
var touchInstance = new TouchEvents(sliderWrapper, {
|
||
touchStart: function touchStart(e) {
|
||
process = true;
|
||
|
||
if (
|
||
hasClass(e.targetTouches[0].target, "ginner-container") ||
|
||
closest(e.targetTouches[0].target, ".gslide-desc") ||
|
||
e.targetTouches[0].target.nodeName.toLowerCase() == "a"
|
||
) {
|
||
process = false;
|
||
}
|
||
|
||
if (
|
||
closest(e.targetTouches[0].target, ".gslide-inline") &&
|
||
!hasClass(e.targetTouches[0].target.parentNode, "gslide-inline")
|
||
) {
|
||
process = false;
|
||
}
|
||
|
||
if (process) {
|
||
endCoords = e.targetTouches[0];
|
||
startCoords.pageX = e.targetTouches[0].pageX;
|
||
startCoords.pageY = e.targetTouches[0].pageY;
|
||
xDown = e.targetTouches[0].clientX;
|
||
yDown = e.targetTouches[0].clientY;
|
||
currentSlide = instance.activeSlide;
|
||
media = currentSlide.querySelector(".gslide-media");
|
||
isInlined = currentSlide.querySelector(".gslide-inline");
|
||
mediaImage = null;
|
||
|
||
if (hasClass(media, "gslide-image")) {
|
||
mediaImage = media.querySelector("img");
|
||
}
|
||
|
||
var windowWidth =
|
||
window.innerWidth ||
|
||
document.documentElement.clientWidth ||
|
||
document.body.clientWidth;
|
||
|
||
if (windowWidth > 769) {
|
||
media = currentSlide.querySelector(".ginner-container");
|
||
}
|
||
|
||
removeClass(overlay, "greset");
|
||
|
||
if (e.pageX > 20 && e.pageX < window.innerWidth - 20) {
|
||
return;
|
||
}
|
||
|
||
e.preventDefault();
|
||
}
|
||
},
|
||
touchMove: function touchMove(e) {
|
||
if (!process) {
|
||
return;
|
||
}
|
||
|
||
endCoords = e.targetTouches[0];
|
||
|
||
if (doingZoom || imageZoomed) {
|
||
return;
|
||
}
|
||
|
||
if (isInlined && isInlined.offsetHeight > winHeight) {
|
||
var moved = startCoords.pageX - endCoords.pageX;
|
||
|
||
if (Math.abs(moved) <= 13) {
|
||
return false;
|
||
}
|
||
}
|
||
|
||
doingMove = true;
|
||
var xUp = e.targetTouches[0].clientX;
|
||
var yUp = e.targetTouches[0].clientY;
|
||
var xDiff = xDown - xUp;
|
||
var yDiff = yDown - yUp;
|
||
|
||
if (Math.abs(xDiff) > Math.abs(yDiff)) {
|
||
vSwipe = false;
|
||
hSwipe = true;
|
||
} else {
|
||
hSwipe = false;
|
||
vSwipe = true;
|
||
}
|
||
|
||
hDistance = endCoords.pageX - startCoords.pageX;
|
||
hDistancePercent = (hDistance * 100) / winWidth;
|
||
vDistance = endCoords.pageY - startCoords.pageY;
|
||
vDistancePercent = (vDistance * 100) / winHeight;
|
||
var opacity;
|
||
|
||
if (vSwipe && mediaImage) {
|
||
opacity = 1 - Math.abs(vDistance) / winHeight;
|
||
overlay.style.opacity = opacity;
|
||
|
||
if (instance.settings.touchFollowAxis) {
|
||
hDistancePercent = 0;
|
||
}
|
||
}
|
||
|
||
if (hSwipe) {
|
||
opacity = 1 - Math.abs(hDistance) / winWidth;
|
||
media.style.opacity = opacity;
|
||
|
||
if (instance.settings.touchFollowAxis) {
|
||
vDistancePercent = 0;
|
||
}
|
||
}
|
||
|
||
if (!mediaImage) {
|
||
return cssTransform(
|
||
media,
|
||
"translate3d(".concat(hDistancePercent, "%, 0, 0)")
|
||
);
|
||
}
|
||
|
||
cssTransform(
|
||
media,
|
||
"translate3d("
|
||
.concat(hDistancePercent, "%, ")
|
||
.concat(vDistancePercent, "%, 0)")
|
||
);
|
||
},
|
||
touchEnd: function touchEnd() {
|
||
if (!process) {
|
||
return;
|
||
}
|
||
|
||
doingMove = false;
|
||
|
||
if (imageZoomed || doingZoom) {
|
||
lastZoomedPosX = zoomedPosX;
|
||
lastZoomedPosY = zoomedPosY;
|
||
return;
|
||
}
|
||
|
||
var v = Math.abs(parseInt(vDistancePercent));
|
||
var h = Math.abs(parseInt(hDistancePercent));
|
||
|
||
if (v > 29 && mediaImage) {
|
||
instance.close();
|
||
return;
|
||
}
|
||
|
||
if (v < 29 && h < 25) {
|
||
addClass(overlay, "greset");
|
||
overlay.style.opacity = 1;
|
||
return resetSlideMove(media);
|
||
}
|
||
},
|
||
multipointEnd: function multipointEnd() {
|
||
setTimeout(function () {
|
||
doingZoom = false;
|
||
}, 50);
|
||
},
|
||
multipointStart: function multipointStart() {
|
||
doingZoom = true;
|
||
initScale = currentScale ? currentScale : 1;
|
||
},
|
||
pinch: function pinch(evt) {
|
||
if (!mediaImage || doingMove) {
|
||
return false;
|
||
}
|
||
|
||
doingZoom = true;
|
||
mediaImage.scaleX = mediaImage.scaleY = initScale * evt.zoom;
|
||
var scale = initScale * evt.zoom;
|
||
imageZoomed = true;
|
||
|
||
if (scale <= 1) {
|
||
imageZoomed = false;
|
||
scale = 1;
|
||
lastZoomedPosY = null;
|
||
lastZoomedPosX = null;
|
||
zoomedPosX = null;
|
||
zoomedPosY = null;
|
||
mediaImage.setAttribute("style", "");
|
||
return;
|
||
}
|
||
|
||
if (scale > maxScale) {
|
||
scale = maxScale;
|
||
}
|
||
|
||
mediaImage.style.transform = "scale3d("
|
||
.concat(scale, ", ")
|
||
.concat(scale, ", 1)");
|
||
currentScale = scale;
|
||
},
|
||
pressMove: function pressMove(e) {
|
||
if (imageZoomed && !doingZoom) {
|
||
var mhDistance = endCoords.pageX - startCoords.pageX;
|
||
var mvDistance = endCoords.pageY - startCoords.pageY;
|
||
|
||
if (lastZoomedPosX) {
|
||
mhDistance = mhDistance + lastZoomedPosX;
|
||
}
|
||
|
||
if (lastZoomedPosY) {
|
||
mvDistance = mvDistance + lastZoomedPosY;
|
||
}
|
||
|
||
zoomedPosX = mhDistance;
|
||
zoomedPosY = mvDistance;
|
||
var style = "translate3d("
|
||
.concat(mhDistance, "px, ")
|
||
.concat(mvDistance, "px, 0)");
|
||
|
||
if (currentScale) {
|
||
style += " scale3d("
|
||
.concat(currentScale, ", ")
|
||
.concat(currentScale, ", 1)");
|
||
}
|
||
|
||
cssTransform(mediaImage, style);
|
||
}
|
||
},
|
||
swipe: function swipe(evt) {
|
||
if (imageZoomed) {
|
||
return;
|
||
}
|
||
|
||
if (doingZoom) {
|
||
doingZoom = false;
|
||
return;
|
||
}
|
||
|
||
if (evt.direction == "Left") {
|
||
if (instance.index == instance.elements.length - 1) {
|
||
return resetSlideMove(media);
|
||
}
|
||
|
||
instance.nextSlide();
|
||
}
|
||
|
||
if (evt.direction == "Right") {
|
||
if (instance.index == 0) {
|
||
return resetSlideMove(media);
|
||
}
|
||
|
||
instance.prevSlide();
|
||
}
|
||
},
|
||
});
|
||
instance.events["touch"] = touchInstance;
|
||
}
|
||
|
||
var ZoomImages = (function () {
|
||
function ZoomImages(el, slide) {
|
||
var _this = this;
|
||
|
||
var onclose =
|
||
arguments.length > 2 && arguments[2] !== undefined
|
||
? arguments[2]
|
||
: null;
|
||
|
||
_classCallCheck(this, ZoomImages);
|
||
|
||
this.img = el;
|
||
this.slide = slide;
|
||
this.onclose = onclose;
|
||
|
||
if (this.img.setZoomEvents) {
|
||
return false;
|
||
}
|
||
|
||
this.active = false;
|
||
this.zoomedIn = false;
|
||
this.dragging = false;
|
||
this.currentX = null;
|
||
this.currentY = null;
|
||
this.initialX = null;
|
||
this.initialY = null;
|
||
this.xOffset = 0;
|
||
this.yOffset = 0;
|
||
this.img.addEventListener(
|
||
"mousedown",
|
||
function (e) {
|
||
return _this.dragStart(e);
|
||
},
|
||
false
|
||
);
|
||
this.img.addEventListener(
|
||
"mouseup",
|
||
function (e) {
|
||
return _this.dragEnd(e);
|
||
},
|
||
false
|
||
);
|
||
this.img.addEventListener(
|
||
"mousemove",
|
||
function (e) {
|
||
return _this.drag(e);
|
||
},
|
||
false
|
||
);
|
||
this.img.addEventListener(
|
||
"click",
|
||
function (e) {
|
||
if (_this.slide.classList.contains("dragging-nav")) {
|
||
_this.zoomOut();
|
||
|
||
return false;
|
||
}
|
||
|
||
if (!_this.zoomedIn) {
|
||
return _this.zoomIn();
|
||
}
|
||
|
||
if (_this.zoomedIn && !_this.dragging) {
|
||
_this.zoomOut();
|
||
}
|
||
},
|
||
false
|
||
);
|
||
this.img.setZoomEvents = true;
|
||
}
|
||
|
||
_createClass(ZoomImages, [
|
||
{
|
||
key: "zoomIn",
|
||
value: function zoomIn() {
|
||
var winWidth = this.widowWidth();
|
||
|
||
if (this.zoomedIn || winWidth <= 768) {
|
||
return;
|
||
}
|
||
|
||
var img = this.img;
|
||
img.setAttribute("data-style", img.getAttribute("style"));
|
||
img.style.maxWidth = img.naturalWidth + "px";
|
||
img.style.maxHeight = img.naturalHeight + "px";
|
||
|
||
if (img.naturalWidth > winWidth) {
|
||
var centerX = winWidth / 2 - img.naturalWidth / 2;
|
||
this.setTranslate(this.img.parentNode, centerX, 0);
|
||
}
|
||
|
||
this.slide.classList.add("zoomed");
|
||
this.zoomedIn = true;
|
||
},
|
||
},
|
||
{
|
||
key: "zoomOut",
|
||
value: function zoomOut() {
|
||
this.img.parentNode.setAttribute("style", "");
|
||
this.img.setAttribute("style", this.img.getAttribute("data-style"));
|
||
this.slide.classList.remove("zoomed");
|
||
this.zoomedIn = false;
|
||
this.currentX = null;
|
||
this.currentY = null;
|
||
this.initialX = null;
|
||
this.initialY = null;
|
||
this.xOffset = 0;
|
||
this.yOffset = 0;
|
||
|
||
if (this.onclose && typeof this.onclose == "function") {
|
||
this.onclose();
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "dragStart",
|
||
value: function dragStart(e) {
|
||
e.preventDefault();
|
||
|
||
if (!this.zoomedIn) {
|
||
this.active = false;
|
||
return;
|
||
}
|
||
|
||
if (e.type === "touchstart") {
|
||
this.initialX = e.touches[0].clientX - this.xOffset;
|
||
this.initialY = e.touches[0].clientY - this.yOffset;
|
||
} else {
|
||
this.initialX = e.clientX - this.xOffset;
|
||
this.initialY = e.clientY - this.yOffset;
|
||
}
|
||
|
||
if (e.target === this.img) {
|
||
this.active = true;
|
||
this.img.classList.add("dragging");
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "dragEnd",
|
||
value: function dragEnd(e) {
|
||
var _this2 = this;
|
||
|
||
e.preventDefault();
|
||
this.initialX = this.currentX;
|
||
this.initialY = this.currentY;
|
||
this.active = false;
|
||
setTimeout(function () {
|
||
_this2.dragging = false;
|
||
_this2.img.isDragging = false;
|
||
|
||
_this2.img.classList.remove("dragging");
|
||
}, 100);
|
||
},
|
||
},
|
||
{
|
||
key: "drag",
|
||
value: function drag(e) {
|
||
if (this.active) {
|
||
e.preventDefault();
|
||
|
||
if (e.type === "touchmove") {
|
||
this.currentX = e.touches[0].clientX - this.initialX;
|
||
this.currentY = e.touches[0].clientY - this.initialY;
|
||
} else {
|
||
this.currentX = e.clientX - this.initialX;
|
||
this.currentY = e.clientY - this.initialY;
|
||
}
|
||
|
||
this.xOffset = this.currentX;
|
||
this.yOffset = this.currentY;
|
||
this.img.isDragging = true;
|
||
this.dragging = true;
|
||
this.setTranslate(this.img, this.currentX, this.currentY);
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "onMove",
|
||
value: function onMove(e) {
|
||
if (!this.zoomedIn) {
|
||
return;
|
||
}
|
||
|
||
var xOffset = e.clientX - this.img.naturalWidth / 2;
|
||
var yOffset = e.clientY - this.img.naturalHeight / 2;
|
||
this.setTranslate(this.img, xOffset, yOffset);
|
||
},
|
||
},
|
||
{
|
||
key: "setTranslate",
|
||
value: function setTranslate(node, xPos, yPos) {
|
||
node.style.transform =
|
||
"translate3d(" + xPos + "px, " + yPos + "px, 0)";
|
||
},
|
||
},
|
||
{
|
||
key: "widowWidth",
|
||
value: function widowWidth() {
|
||
return (
|
||
window.innerWidth ||
|
||
document.documentElement.clientWidth ||
|
||
document.body.clientWidth
|
||
);
|
||
},
|
||
},
|
||
]);
|
||
|
||
return ZoomImages;
|
||
})();
|
||
|
||
var DragSlides = (function () {
|
||
function DragSlides() {
|
||
var _this = this;
|
||
|
||
var config =
|
||
arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||
|
||
_classCallCheck(this, DragSlides);
|
||
|
||
var dragEl = config.dragEl,
|
||
_config$toleranceX = config.toleranceX,
|
||
toleranceX = _config$toleranceX === void 0 ? 40 : _config$toleranceX,
|
||
_config$toleranceY = config.toleranceY,
|
||
toleranceY = _config$toleranceY === void 0 ? 65 : _config$toleranceY,
|
||
_config$slide = config.slide,
|
||
slide = _config$slide === void 0 ? null : _config$slide,
|
||
_config$instance = config.instance,
|
||
instance = _config$instance === void 0 ? null : _config$instance;
|
||
this.el = dragEl;
|
||
this.active = false;
|
||
this.dragging = false;
|
||
this.currentX = null;
|
||
this.currentY = null;
|
||
this.initialX = null;
|
||
this.initialY = null;
|
||
this.xOffset = 0;
|
||
this.yOffset = 0;
|
||
this.direction = null;
|
||
this.lastDirection = null;
|
||
this.toleranceX = toleranceX;
|
||
this.toleranceY = toleranceY;
|
||
this.toleranceReached = false;
|
||
this.dragContainer = this.el;
|
||
this.slide = slide;
|
||
this.instance = instance;
|
||
this.el.addEventListener(
|
||
"mousedown",
|
||
function (e) {
|
||
return _this.dragStart(e);
|
||
},
|
||
false
|
||
);
|
||
this.el.addEventListener(
|
||
"mouseup",
|
||
function (e) {
|
||
return _this.dragEnd(e);
|
||
},
|
||
false
|
||
);
|
||
this.el.addEventListener(
|
||
"mousemove",
|
||
function (e) {
|
||
return _this.drag(e);
|
||
},
|
||
false
|
||
);
|
||
}
|
||
|
||
_createClass(DragSlides, [
|
||
{
|
||
key: "dragStart",
|
||
value: function dragStart(e) {
|
||
if (this.slide.classList.contains("zoomed")) {
|
||
this.active = false;
|
||
return;
|
||
}
|
||
|
||
if (e.type === "touchstart") {
|
||
this.initialX = e.touches[0].clientX - this.xOffset;
|
||
this.initialY = e.touches[0].clientY - this.yOffset;
|
||
} else {
|
||
this.initialX = e.clientX - this.xOffset;
|
||
this.initialY = e.clientY - this.yOffset;
|
||
}
|
||
|
||
var clicked = e.target.nodeName.toLowerCase();
|
||
var exludeClicks = ["input", "select", "textarea", "button", "a"];
|
||
|
||
if (
|
||
e.target.classList.contains("nodrag") ||
|
||
closest(e.target, ".nodrag") ||
|
||
exludeClicks.indexOf(clicked) !== -1
|
||
) {
|
||
this.active = false;
|
||
return;
|
||
}
|
||
|
||
e.preventDefault();
|
||
|
||
if (
|
||
e.target === this.el ||
|
||
(clicked !== "img" && closest(e.target, ".gslide-inline"))
|
||
) {
|
||
this.active = true;
|
||
this.el.classList.add("dragging");
|
||
this.dragContainer = closest(e.target, ".ginner-container");
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "dragEnd",
|
||
value: function dragEnd(e) {
|
||
var _this2 = this;
|
||
|
||
e && e.preventDefault();
|
||
this.initialX = 0;
|
||
this.initialY = 0;
|
||
this.currentX = null;
|
||
this.currentY = null;
|
||
this.initialX = null;
|
||
this.initialY = null;
|
||
this.xOffset = 0;
|
||
this.yOffset = 0;
|
||
this.active = false;
|
||
|
||
if (this.doSlideChange) {
|
||
this.instance.preventOutsideClick = true;
|
||
this.doSlideChange == "right" && this.instance.prevSlide();
|
||
this.doSlideChange == "left" && this.instance.nextSlide();
|
||
}
|
||
|
||
if (this.doSlideClose) {
|
||
this.instance.close();
|
||
}
|
||
|
||
if (!this.toleranceReached) {
|
||
this.setTranslate(this.dragContainer, 0, 0, true);
|
||
}
|
||
|
||
setTimeout(function () {
|
||
_this2.instance.preventOutsideClick = false;
|
||
_this2.toleranceReached = false;
|
||
_this2.lastDirection = null;
|
||
_this2.dragging = false;
|
||
_this2.el.isDragging = false;
|
||
|
||
_this2.el.classList.remove("dragging");
|
||
|
||
_this2.slide.classList.remove("dragging-nav");
|
||
|
||
_this2.dragContainer.style.transform = "";
|
||
_this2.dragContainer.style.transition = "";
|
||
}, 100);
|
||
},
|
||
},
|
||
{
|
||
key: "drag",
|
||
value: function drag(e) {
|
||
if (this.active) {
|
||
e.preventDefault();
|
||
this.slide.classList.add("dragging-nav");
|
||
|
||
if (e.type === "touchmove") {
|
||
this.currentX = e.touches[0].clientX - this.initialX;
|
||
this.currentY = e.touches[0].clientY - this.initialY;
|
||
} else {
|
||
this.currentX = e.clientX - this.initialX;
|
||
this.currentY = e.clientY - this.initialY;
|
||
}
|
||
|
||
this.xOffset = this.currentX;
|
||
this.yOffset = this.currentY;
|
||
this.el.isDragging = true;
|
||
this.dragging = true;
|
||
this.doSlideChange = false;
|
||
this.doSlideClose = false;
|
||
var currentXInt = Math.abs(this.currentX);
|
||
var currentYInt = Math.abs(this.currentY);
|
||
|
||
if (
|
||
currentXInt > 0 &&
|
||
currentXInt >= Math.abs(this.currentY) &&
|
||
(!this.lastDirection || this.lastDirection == "x")
|
||
) {
|
||
this.yOffset = 0;
|
||
this.lastDirection = "x";
|
||
this.setTranslate(this.dragContainer, this.currentX, 0);
|
||
var doChange = this.shouldChange();
|
||
|
||
if (!this.instance.settings.dragAutoSnap && doChange) {
|
||
this.doSlideChange = doChange;
|
||
}
|
||
|
||
if (this.instance.settings.dragAutoSnap && doChange) {
|
||
this.instance.preventOutsideClick = true;
|
||
this.toleranceReached = true;
|
||
this.active = false;
|
||
this.instance.preventOutsideClick = true;
|
||
this.dragEnd(null);
|
||
doChange == "right" && this.instance.prevSlide();
|
||
doChange == "left" && this.instance.nextSlide();
|
||
return;
|
||
}
|
||
}
|
||
|
||
if (
|
||
this.toleranceY > 0 &&
|
||
currentYInt > 0 &&
|
||
currentYInt >= currentXInt &&
|
||
(!this.lastDirection || this.lastDirection == "y")
|
||
) {
|
||
this.xOffset = 0;
|
||
this.lastDirection = "y";
|
||
this.setTranslate(this.dragContainer, 0, this.currentY);
|
||
var doClose = this.shouldClose();
|
||
|
||
if (!this.instance.settings.dragAutoSnap && doClose) {
|
||
this.doSlideClose = true;
|
||
}
|
||
|
||
if (this.instance.settings.dragAutoSnap && doClose) {
|
||
this.instance.close();
|
||
}
|
||
|
||
return;
|
||
}
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "shouldChange",
|
||
value: function shouldChange() {
|
||
var doChange = false;
|
||
var currentXInt = Math.abs(this.currentX);
|
||
|
||
if (currentXInt >= this.toleranceX) {
|
||
var dragDir = this.currentX > 0 ? "right" : "left";
|
||
|
||
if (
|
||
(dragDir == "left" &&
|
||
this.slide !== this.slide.parentNode.lastChild) ||
|
||
(dragDir == "right" &&
|
||
this.slide !== this.slide.parentNode.firstChild)
|
||
) {
|
||
doChange = dragDir;
|
||
}
|
||
}
|
||
|
||
return doChange;
|
||
},
|
||
},
|
||
{
|
||
key: "shouldClose",
|
||
value: function shouldClose() {
|
||
var doClose = false;
|
||
var currentYInt = Math.abs(this.currentY);
|
||
|
||
if (currentYInt >= this.toleranceY) {
|
||
doClose = true;
|
||
}
|
||
|
||
return doClose;
|
||
},
|
||
},
|
||
{
|
||
key: "setTranslate",
|
||
value: function setTranslate(node, xPos, yPos) {
|
||
var animated =
|
||
arguments.length > 3 && arguments[3] !== undefined
|
||
? arguments[3]
|
||
: false;
|
||
|
||
if (animated) {
|
||
node.style.transition = "all .2s ease";
|
||
} else {
|
||
node.style.transition = "";
|
||
}
|
||
|
||
node.style.transform = "translate3d("
|
||
.concat(xPos, "px, ")
|
||
.concat(yPos, "px, 0)");
|
||
},
|
||
},
|
||
]);
|
||
|
||
return DragSlides;
|
||
})();
|
||
|
||
function slideImage(slide, data, index, callback) {
|
||
var slideMedia = slide.querySelector(".gslide-media");
|
||
var img = new Image();
|
||
var titleID = "gSlideTitle_" + index;
|
||
var textID = "gSlideDesc_" + index;
|
||
img.addEventListener(
|
||
"load",
|
||
function () {
|
||
if (isFunction(callback)) {
|
||
callback();
|
||
}
|
||
},
|
||
false
|
||
);
|
||
img.src = data.href;
|
||
|
||
if (data.sizes != "" && data.srcset != "") {
|
||
img.sizes = data.sizes;
|
||
img.srcset = data.srcset;
|
||
}
|
||
|
||
img.alt = "";
|
||
|
||
if (!isNil(data.alt) && data.alt !== "") {
|
||
img.alt = data.alt;
|
||
}
|
||
|
||
if (data.title !== "") {
|
||
img.setAttribute("aria-labelledby", titleID);
|
||
}
|
||
|
||
if (data.description !== "") {
|
||
img.setAttribute("aria-describedby", textID);
|
||
}
|
||
|
||
if (data.hasOwnProperty("_hasCustomWidth") && data._hasCustomWidth) {
|
||
img.style.width = data.width;
|
||
}
|
||
|
||
if (data.hasOwnProperty("_hasCustomHeight") && data._hasCustomHeight) {
|
||
img.style.height = data.height;
|
||
}
|
||
|
||
slideMedia.insertBefore(img, slideMedia.firstChild);
|
||
return;
|
||
}
|
||
|
||
function slideVideo(slide, data, index, callback) {
|
||
var _this = this;
|
||
|
||
var slideContainer = slide.querySelector(".ginner-container");
|
||
var videoID = "gvideo" + index;
|
||
var slideMedia = slide.querySelector(".gslide-media");
|
||
var videoPlayers = this.getAllPlayers();
|
||
addClass(slideContainer, "gvideo-container");
|
||
slideMedia.insertBefore(
|
||
createHTML('<div class="gvideo-wrapper"></div>'),
|
||
slideMedia.firstChild
|
||
);
|
||
var videoWrapper = slide.querySelector(".gvideo-wrapper");
|
||
injectAssets(this.settings.plyr.css, "Plyr");
|
||
var url = data.href;
|
||
var protocol = location.protocol.replace(":", "");
|
||
var videoSource = "";
|
||
var embedID = "";
|
||
var customPlaceholder = false;
|
||
|
||
if (protocol == "file") {
|
||
protocol = "http";
|
||
}
|
||
|
||
slideMedia.style.maxWidth = data.width;
|
||
injectAssets(this.settings.plyr.js, "Plyr", function () {
|
||
if (url.match(/vimeo\.com\/([0-9]*)/)) {
|
||
var vimeoID = /vimeo.*\/(\d+)/i.exec(url);
|
||
videoSource = "vimeo";
|
||
embedID = vimeoID[1];
|
||
}
|
||
|
||
if (
|
||
url.match(
|
||
/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/
|
||
) ||
|
||
url.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/) ||
|
||
url.match(
|
||
/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/
|
||
)
|
||
) {
|
||
var youtubeID = getYoutubeID(url);
|
||
videoSource = "youtube";
|
||
embedID = youtubeID;
|
||
}
|
||
|
||
if (url.match(/\.(mp4|ogg|webm|mov)$/) !== null) {
|
||
videoSource = "local";
|
||
var html = '<video id="' + videoID + '" ';
|
||
html += 'style="background:#000; max-width: '.concat(data.width, ';" ');
|
||
html += 'preload="metadata" ';
|
||
html += 'x-webkit-airplay="allow" ';
|
||
html += "playsinline ";
|
||
html += "controls ";
|
||
html += 'class="gvideo-local">';
|
||
var format = url.toLowerCase().split(".").pop();
|
||
var sources = {
|
||
mp4: "",
|
||
ogg: "",
|
||
webm: "",
|
||
};
|
||
format = format == "mov" ? "mp4" : format;
|
||
sources[format] = url;
|
||
|
||
for (var key in sources) {
|
||
if (sources.hasOwnProperty(key)) {
|
||
var videoFile = sources[key];
|
||
|
||
if (data.hasOwnProperty(key)) {
|
||
videoFile = data[key];
|
||
}
|
||
|
||
if (videoFile !== "") {
|
||
html += '<source src="'
|
||
.concat(videoFile, '" type="video/')
|
||
.concat(key, '">');
|
||
}
|
||
}
|
||
}
|
||
|
||
html += "</video>";
|
||
customPlaceholder = createHTML(html);
|
||
}
|
||
|
||
var placeholder = customPlaceholder
|
||
? customPlaceholder
|
||
: createHTML(
|
||
'<div id="'
|
||
.concat(videoID, '" data-plyr-provider="')
|
||
.concat(videoSource, '" data-plyr-embed-id="')
|
||
.concat(embedID, '"></div>')
|
||
);
|
||
addClass(videoWrapper, "".concat(videoSource, "-video gvideo"));
|
||
videoWrapper.appendChild(placeholder);
|
||
videoWrapper.setAttribute("data-id", videoID);
|
||
videoWrapper.setAttribute("data-index", index);
|
||
var playerConfig = has(_this.settings.plyr, "config")
|
||
? _this.settings.plyr.config
|
||
: {};
|
||
var player = new Plyr("#" + videoID, playerConfig);
|
||
player.on("ready", function (event) {
|
||
var instance = event.detail.plyr;
|
||
videoPlayers[videoID] = instance;
|
||
|
||
if (isFunction(callback)) {
|
||
callback();
|
||
}
|
||
});
|
||
waitUntil(
|
||
function () {
|
||
return (
|
||
slide.querySelector("iframe") &&
|
||
slide.querySelector("iframe").dataset.ready == "true"
|
||
);
|
||
},
|
||
function () {
|
||
_this.resize(slide);
|
||
}
|
||
);
|
||
player.on("enterfullscreen", handleMediaFullScreen);
|
||
player.on("exitfullscreen", handleMediaFullScreen);
|
||
});
|
||
}
|
||
|
||
function getYoutubeID(url) {
|
||
var videoID = "";
|
||
url = url
|
||
.replace(/(>|<)/gi, "")
|
||
.split(/(vi\/|v=|\/v\/|youtu\.be\/|\/embed\/)/);
|
||
|
||
if (url[2] !== undefined) {
|
||
videoID = url[2].split(/[^0-9a-z_\-]/i);
|
||
videoID = videoID[0];
|
||
} else {
|
||
videoID = url;
|
||
}
|
||
|
||
return videoID;
|
||
}
|
||
|
||
function handleMediaFullScreen(event) {
|
||
var media = closest(event.target, ".gslide-media");
|
||
|
||
if (event.type == "enterfullscreen") {
|
||
addClass(media, "fullscreen");
|
||
}
|
||
|
||
if (event.type == "exitfullscreen") {
|
||
removeClass(media, "fullscreen");
|
||
}
|
||
}
|
||
|
||
function slideInline(slide, data, index, callback) {
|
||
var _this = this;
|
||
|
||
var slideMedia = slide.querySelector(".gslide-media");
|
||
var hash =
|
||
has(data, "href") && data.href
|
||
? data.href.split("#").pop().trim()
|
||
: false;
|
||
var content = has(data, "content") && data.content ? data.content : false;
|
||
var innerContent;
|
||
|
||
if (content) {
|
||
if (isString(content)) {
|
||
innerContent = createHTML(
|
||
'<div class="ginlined-content">'.concat(content, "</div>")
|
||
);
|
||
}
|
||
|
||
if (isNode(content)) {
|
||
if (content.style.display == "none") {
|
||
content.style.display = "block";
|
||
}
|
||
|
||
var container = document.createElement("div");
|
||
container.className = "ginlined-content";
|
||
container.appendChild(content);
|
||
innerContent = container;
|
||
}
|
||
}
|
||
|
||
if (hash) {
|
||
var div = document.getElementById(hash);
|
||
|
||
if (!div) {
|
||
return false;
|
||
}
|
||
|
||
var cloned = div.cloneNode(true);
|
||
cloned.style.height = data.height;
|
||
cloned.style.maxWidth = data.width;
|
||
addClass(cloned, "ginlined-content");
|
||
innerContent = cloned;
|
||
}
|
||
|
||
if (!innerContent) {
|
||
console.error("Unable to append inline slide content", data);
|
||
return false;
|
||
}
|
||
|
||
slideMedia.style.height = data.height;
|
||
slideMedia.style.width = data.width;
|
||
slideMedia.appendChild(innerContent);
|
||
this.events["inlineclose" + hash] = addEvent("click", {
|
||
onElement: slideMedia.querySelectorAll(".gtrigger-close"),
|
||
withCallback: function withCallback(e) {
|
||
e.preventDefault();
|
||
|
||
_this.close();
|
||
},
|
||
});
|
||
|
||
if (isFunction(callback)) {
|
||
callback();
|
||
}
|
||
|
||
return;
|
||
}
|
||
|
||
function slideIframe(slide, data, index, callback) {
|
||
var slideMedia = slide.querySelector(".gslide-media");
|
||
var iframe = createIframe({
|
||
url: data.href,
|
||
callback: callback,
|
||
});
|
||
slideMedia.parentNode.style.maxWidth = data.width;
|
||
slideMedia.parentNode.style.height = data.height;
|
||
slideMedia.appendChild(iframe);
|
||
return;
|
||
}
|
||
|
||
var SlideConfigParser = (function () {
|
||
function SlideConfigParser() {
|
||
var slideParamas =
|
||
arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||
|
||
_classCallCheck(this, SlideConfigParser);
|
||
|
||
this.defaults = {
|
||
href: "",
|
||
sizes: "",
|
||
srcset: "",
|
||
title: "",
|
||
type: "",
|
||
description: "",
|
||
alt: "",
|
||
descPosition: "bottom",
|
||
effect: "",
|
||
width: "",
|
||
height: "",
|
||
content: false,
|
||
zoomable: true,
|
||
draggable: true,
|
||
};
|
||
|
||
if (isObject(slideParamas)) {
|
||
this.defaults = extend(this.defaults, slideParamas);
|
||
}
|
||
}
|
||
|
||
_createClass(SlideConfigParser, [
|
||
{
|
||
key: "sourceType",
|
||
value: function sourceType(url) {
|
||
var origin = url;
|
||
url = url.toLowerCase();
|
||
|
||
if (
|
||
url.match(/\.(jpeg|jpg|jpe|gif|png|apn|webp|avif|svg)/) !== null
|
||
) {
|
||
return "image";
|
||
}
|
||
|
||
if (
|
||
url.match(
|
||
/(youtube\.com|youtube-nocookie\.com)\/watch\?v=([a-zA-Z0-9\-_]+)/
|
||
) ||
|
||
url.match(/youtu\.be\/([a-zA-Z0-9\-_]+)/) ||
|
||
url.match(
|
||
/(youtube\.com|youtube-nocookie\.com)\/embed\/([a-zA-Z0-9\-_]+)/
|
||
)
|
||
) {
|
||
return "video";
|
||
}
|
||
|
||
if (url.match(/vimeo\.com\/([0-9]*)/)) {
|
||
return "video";
|
||
}
|
||
|
||
if (url.match(/\.(mp4|ogg|webm|mov)/) !== null) {
|
||
return "video";
|
||
}
|
||
|
||
if (url.match(/\.(mp3|wav|wma|aac|ogg)/) !== null) {
|
||
return "audio";
|
||
}
|
||
|
||
if (url.indexOf("#") > -1) {
|
||
var hash = origin.split("#").pop();
|
||
|
||
if (hash.trim() !== "") {
|
||
return "inline";
|
||
}
|
||
}
|
||
|
||
if (url.indexOf("goajax=true") > -1) {
|
||
return "ajax";
|
||
}
|
||
|
||
return "external";
|
||
},
|
||
},
|
||
{
|
||
key: "parseConfig",
|
||
value: function parseConfig(element, settings) {
|
||
var _this = this;
|
||
|
||
var data = extend(
|
||
{
|
||
descPosition: settings.descPosition,
|
||
},
|
||
this.defaults
|
||
);
|
||
|
||
if (isObject(element) && !isNode(element)) {
|
||
if (!has(element, "type")) {
|
||
if (has(element, "content") && element.content) {
|
||
element.type = "inline";
|
||
} else if (has(element, "href")) {
|
||
element.type = this.sourceType(element.href);
|
||
}
|
||
}
|
||
|
||
var objectData = extend(data, element);
|
||
this.setSize(objectData, settings);
|
||
return objectData;
|
||
}
|
||
|
||
var url = "";
|
||
var config = element.getAttribute("data-glightbox");
|
||
var nodeType = element.nodeName.toLowerCase();
|
||
|
||
if (nodeType === "a") {
|
||
url = element.href;
|
||
}
|
||
|
||
if (nodeType === "img") {
|
||
url = element.src;
|
||
data.alt = element.alt;
|
||
}
|
||
|
||
data.href = url;
|
||
each(data, function (val, key) {
|
||
if (has(settings, key) && key !== "width") {
|
||
data[key] = settings[key];
|
||
}
|
||
|
||
var nodeData = element.dataset[key];
|
||
|
||
if (!isNil(nodeData)) {
|
||
data[key] = _this.sanitizeValue(nodeData);
|
||
}
|
||
});
|
||
|
||
if (data.content) {
|
||
data.type = "inline";
|
||
}
|
||
|
||
if (!data.type && url) {
|
||
data.type = this.sourceType(url);
|
||
}
|
||
|
||
if (!isNil(config)) {
|
||
var cleanKeys = [];
|
||
each(data, function (v, k) {
|
||
cleanKeys.push(";\\s?" + k);
|
||
});
|
||
cleanKeys = cleanKeys.join("\\s?:|");
|
||
|
||
if (config.trim() !== "") {
|
||
each(data, function (val, key) {
|
||
var str = config;
|
||
var match = "s?" + key + "s?:s?(.*?)(" + cleanKeys + "s?:|$)";
|
||
var regex = new RegExp(match);
|
||
var matches = str.match(regex);
|
||
|
||
if (matches && matches.length && matches[1]) {
|
||
var value = matches[1].trim().replace(/;\s*$/, "");
|
||
data[key] = _this.sanitizeValue(value);
|
||
}
|
||
});
|
||
}
|
||
} else {
|
||
if (!data.title && nodeType == "a") {
|
||
var title = element.title;
|
||
|
||
if (!isNil(title) && title !== "") {
|
||
data.title = title;
|
||
}
|
||
}
|
||
|
||
if (!data.title && nodeType == "img") {
|
||
var alt = element.alt;
|
||
|
||
if (!isNil(alt) && alt !== "") {
|
||
data.title = alt;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (data.description && data.description.substring(0, 1) === ".") {
|
||
var description;
|
||
|
||
try {
|
||
description = document.querySelector(data.description).innerHTML;
|
||
} catch (error) {
|
||
if (!(error instanceof DOMException)) {
|
||
throw error;
|
||
}
|
||
}
|
||
|
||
if (description) {
|
||
data.description = description;
|
||
}
|
||
}
|
||
|
||
if (!data.description) {
|
||
var nodeDesc = element.querySelector(".glightbox-desc");
|
||
|
||
if (nodeDesc) {
|
||
data.description = nodeDesc.innerHTML;
|
||
}
|
||
}
|
||
|
||
this.setSize(data, settings, element);
|
||
this.slideConfig = data;
|
||
return data;
|
||
},
|
||
},
|
||
{
|
||
key: "setSize",
|
||
value: function setSize(data, settings) {
|
||
var element =
|
||
arguments.length > 2 && arguments[2] !== undefined
|
||
? arguments[2]
|
||
: null;
|
||
var defaultWith =
|
||
data.type == "video"
|
||
? this.checkSize(settings.videosWidth)
|
||
: this.checkSize(settings.width);
|
||
var defaultHeight = this.checkSize(settings.height);
|
||
data.width =
|
||
has(data, "width") && data.width !== ""
|
||
? this.checkSize(data.width)
|
||
: defaultWith;
|
||
data.height =
|
||
has(data, "height") && data.height !== ""
|
||
? this.checkSize(data.height)
|
||
: defaultHeight;
|
||
|
||
if (element && data.type == "image") {
|
||
data._hasCustomWidth = element.dataset.width ? true : false;
|
||
data._hasCustomHeight = element.dataset.height ? true : false;
|
||
}
|
||
|
||
return data;
|
||
},
|
||
},
|
||
{
|
||
key: "checkSize",
|
||
value: function checkSize(size) {
|
||
return isNumber(size) ? "".concat(size, "px") : size;
|
||
},
|
||
},
|
||
{
|
||
key: "sanitizeValue",
|
||
value: function sanitizeValue(val) {
|
||
if (val !== "true" && val !== "false") {
|
||
return val;
|
||
}
|
||
|
||
return val === "true";
|
||
},
|
||
},
|
||
]);
|
||
|
||
return SlideConfigParser;
|
||
})();
|
||
|
||
var Slide = (function () {
|
||
function Slide(el, instance, index) {
|
||
_classCallCheck(this, Slide);
|
||
|
||
this.element = el;
|
||
this.instance = instance;
|
||
this.index = index;
|
||
}
|
||
|
||
_createClass(Slide, [
|
||
{
|
||
key: "setContent",
|
||
value: function setContent() {
|
||
var _this = this;
|
||
|
||
var slide =
|
||
arguments.length > 0 && arguments[0] !== undefined
|
||
? arguments[0]
|
||
: null;
|
||
var callback =
|
||
arguments.length > 1 && arguments[1] !== undefined
|
||
? arguments[1]
|
||
: false;
|
||
|
||
if (hasClass(slide, "loaded")) {
|
||
return false;
|
||
}
|
||
|
||
var settings = this.instance.settings;
|
||
var slideConfig = this.slideConfig;
|
||
var isMobileDevice = isMobile();
|
||
|
||
if (isFunction(settings.beforeSlideLoad)) {
|
||
settings.beforeSlideLoad({
|
||
index: this.index,
|
||
slide: slide,
|
||
player: false,
|
||
});
|
||
}
|
||
|
||
var type = slideConfig.type;
|
||
var position = slideConfig.descPosition;
|
||
var slideMedia = slide.querySelector(".gslide-media");
|
||
var slideTitle = slide.querySelector(".gslide-title");
|
||
var slideText = slide.querySelector(".gslide-desc");
|
||
var slideDesc = slide.querySelector(".gdesc-inner");
|
||
var finalCallback = callback;
|
||
var titleID = "gSlideTitle_" + this.index;
|
||
var textID = "gSlideDesc_" + this.index;
|
||
|
||
if (isFunction(settings.afterSlideLoad)) {
|
||
finalCallback = function finalCallback() {
|
||
if (isFunction(callback)) {
|
||
callback();
|
||
}
|
||
|
||
settings.afterSlideLoad({
|
||
index: _this.index,
|
||
slide: slide,
|
||
player: _this.instance.getSlidePlayerInstance(_this.index),
|
||
});
|
||
};
|
||
}
|
||
|
||
if (slideConfig.title == "" && slideConfig.description == "") {
|
||
if (slideDesc) {
|
||
slideDesc.parentNode.parentNode.removeChild(slideDesc.parentNode);
|
||
}
|
||
} else {
|
||
if (slideTitle && slideConfig.title !== "") {
|
||
slideTitle.id = titleID;
|
||
slideTitle.innerHTML = slideConfig.title;
|
||
} else {
|
||
slideTitle.parentNode.removeChild(slideTitle);
|
||
}
|
||
|
||
if (slideText && slideConfig.description !== "") {
|
||
slideText.id = textID;
|
||
|
||
if (isMobileDevice && settings.moreLength > 0) {
|
||
slideConfig.smallDescription = this.slideShortDesc(
|
||
slideConfig.description,
|
||
settings.moreLength,
|
||
settings.moreText
|
||
);
|
||
slideText.innerHTML = slideConfig.smallDescription;
|
||
this.descriptionEvents(slideText, slideConfig);
|
||
} else {
|
||
slideText.innerHTML = slideConfig.description;
|
||
}
|
||
} else {
|
||
slideText.parentNode.removeChild(slideText);
|
||
}
|
||
|
||
addClass(slideMedia.parentNode, "desc-".concat(position));
|
||
addClass(slideDesc.parentNode, "description-".concat(position));
|
||
}
|
||
|
||
addClass(slideMedia, "gslide-".concat(type));
|
||
addClass(slide, "loaded");
|
||
|
||
if (type === "video") {
|
||
slideVideo.apply(this.instance, [
|
||
slide,
|
||
slideConfig,
|
||
this.index,
|
||
finalCallback,
|
||
]);
|
||
return;
|
||
}
|
||
|
||
if (type === "external") {
|
||
slideIframe.apply(this, [
|
||
slide,
|
||
slideConfig,
|
||
this.index,
|
||
finalCallback,
|
||
]);
|
||
return;
|
||
}
|
||
|
||
if (type === "inline") {
|
||
slideInline.apply(this.instance, [
|
||
slide,
|
||
slideConfig,
|
||
this.index,
|
||
finalCallback,
|
||
]);
|
||
|
||
if (slideConfig.draggable) {
|
||
new DragSlides({
|
||
dragEl: slide.querySelector(".gslide-inline"),
|
||
toleranceX: settings.dragToleranceX,
|
||
toleranceY: settings.dragToleranceY,
|
||
slide: slide,
|
||
instance: this.instance,
|
||
});
|
||
}
|
||
|
||
return;
|
||
}
|
||
|
||
if (type === "image") {
|
||
slideImage(slide, slideConfig, this.index, function () {
|
||
var img = slide.querySelector("img");
|
||
|
||
if (slideConfig.draggable) {
|
||
new DragSlides({
|
||
dragEl: img,
|
||
toleranceX: settings.dragToleranceX,
|
||
toleranceY: settings.dragToleranceY,
|
||
slide: slide,
|
||
instance: _this.instance,
|
||
});
|
||
}
|
||
|
||
if (slideConfig.zoomable && img.naturalWidth > img.offsetWidth) {
|
||
addClass(img, "zoomable");
|
||
new ZoomImages(img, slide, function () {
|
||
_this.instance.resize();
|
||
});
|
||
}
|
||
|
||
if (isFunction(finalCallback)) {
|
||
finalCallback();
|
||
}
|
||
});
|
||
return;
|
||
}
|
||
|
||
if (isFunction(finalCallback)) {
|
||
finalCallback();
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "slideShortDesc",
|
||
value: function slideShortDesc(string) {
|
||
var n =
|
||
arguments.length > 1 && arguments[1] !== undefined
|
||
? arguments[1]
|
||
: 50;
|
||
var wordBoundary =
|
||
arguments.length > 2 && arguments[2] !== undefined
|
||
? arguments[2]
|
||
: false;
|
||
var div = document.createElement("div");
|
||
div.innerHTML = string;
|
||
var cleanedString = div.innerText;
|
||
var useWordBoundary = wordBoundary;
|
||
string = cleanedString.trim();
|
||
|
||
if (string.length <= n) {
|
||
return string;
|
||
}
|
||
|
||
var subString = string.substr(0, n - 1);
|
||
|
||
if (!useWordBoundary) {
|
||
return subString;
|
||
}
|
||
|
||
div = null;
|
||
return (
|
||
subString +
|
||
'... <a href="#" class="desc-more">' +
|
||
wordBoundary +
|
||
"</a>"
|
||
);
|
||
},
|
||
},
|
||
{
|
||
key: "descriptionEvents",
|
||
value: function descriptionEvents(desc, data) {
|
||
var _this2 = this;
|
||
|
||
var moreLink = desc.querySelector(".desc-more");
|
||
|
||
if (!moreLink) {
|
||
return false;
|
||
}
|
||
|
||
addEvent("click", {
|
||
onElement: moreLink,
|
||
withCallback: function withCallback(event, target) {
|
||
event.preventDefault();
|
||
var body = document.body;
|
||
var desc = closest(target, ".gslide-desc");
|
||
|
||
if (!desc) {
|
||
return false;
|
||
}
|
||
|
||
desc.innerHTML = data.description;
|
||
addClass(body, "gdesc-open");
|
||
var shortEvent = addEvent("click", {
|
||
onElement: [body, closest(desc, ".gslide-description")],
|
||
withCallback: function withCallback(event, target) {
|
||
if (event.target.nodeName.toLowerCase() !== "a") {
|
||
removeClass(body, "gdesc-open");
|
||
addClass(body, "gdesc-closed");
|
||
desc.innerHTML = data.smallDescription;
|
||
|
||
_this2.descriptionEvents(desc, data);
|
||
|
||
setTimeout(function () {
|
||
removeClass(body, "gdesc-closed");
|
||
}, 400);
|
||
shortEvent.destroy();
|
||
}
|
||
},
|
||
});
|
||
},
|
||
});
|
||
},
|
||
},
|
||
{
|
||
key: "create",
|
||
value: function create() {
|
||
return createHTML(this.instance.settings.slideHTML);
|
||
},
|
||
},
|
||
{
|
||
key: "getConfig",
|
||
value: function getConfig() {
|
||
if (
|
||
!isNode(this.element) &&
|
||
!this.element.hasOwnProperty("draggable")
|
||
) {
|
||
this.element.draggable = this.instance.settings.draggable;
|
||
}
|
||
|
||
var parser = new SlideConfigParser(
|
||
this.instance.settings.slideExtraAttributes
|
||
);
|
||
this.slideConfig = parser.parseConfig(
|
||
this.element,
|
||
this.instance.settings
|
||
);
|
||
return this.slideConfig;
|
||
},
|
||
},
|
||
]);
|
||
|
||
return Slide;
|
||
})();
|
||
|
||
var _version = "3.1.1";
|
||
|
||
var isMobile$1 = isMobile();
|
||
|
||
var isTouch$1 = isTouch();
|
||
|
||
var html = document.getElementsByTagName("html")[0];
|
||
var defaults = {
|
||
selector: ".glightbox",
|
||
elements: null,
|
||
skin: "clean",
|
||
theme: "clean",
|
||
closeButton: true,
|
||
startAt: null,
|
||
autoplayVideos: true,
|
||
autofocusVideos: true,
|
||
descPosition: "bottom",
|
||
width: "900px",
|
||
height: "506px",
|
||
videosWidth: "960px",
|
||
beforeSlideChange: null,
|
||
afterSlideChange: null,
|
||
beforeSlideLoad: null,
|
||
afterSlideLoad: null,
|
||
slideInserted: null,
|
||
slideRemoved: null,
|
||
slideExtraAttributes: null,
|
||
onOpen: null,
|
||
onClose: null,
|
||
loop: false,
|
||
zoomable: true,
|
||
draggable: true,
|
||
dragAutoSnap: false,
|
||
dragToleranceX: 40,
|
||
dragToleranceY: 65,
|
||
preload: true,
|
||
oneSlidePerOpen: false,
|
||
touchNavigation: true,
|
||
touchFollowAxis: true,
|
||
keyboardNavigation: true,
|
||
closeOnOutsideClick: true,
|
||
plugins: false,
|
||
plyr: {
|
||
css: "https://cdn.plyr.io/3.6.8/plyr.css",
|
||
js: "https://cdn.plyr.io/3.6.8/plyr.js",
|
||
config: {
|
||
ratio: "16:9",
|
||
fullscreen: {
|
||
enabled: true,
|
||
iosNative: true,
|
||
},
|
||
youtube: {
|
||
noCookie: true,
|
||
rel: 0,
|
||
showinfo: 0,
|
||
iv_load_policy: 3,
|
||
},
|
||
vimeo: {
|
||
byline: false,
|
||
portrait: false,
|
||
title: false,
|
||
transparent: false,
|
||
},
|
||
},
|
||
},
|
||
openEffect: "zoom",
|
||
closeEffect: "zoom",
|
||
slideEffect: "slide",
|
||
moreText: "See more",
|
||
moreLength: 60,
|
||
cssEfects: {
|
||
fade: {
|
||
in: "fadeIn",
|
||
out: "fadeOut",
|
||
},
|
||
zoom: {
|
||
in: "zoomIn",
|
||
out: "zoomOut",
|
||
},
|
||
slide: {
|
||
in: "slideInRight",
|
||
out: "slideOutLeft",
|
||
},
|
||
slideBack: {
|
||
in: "slideInLeft",
|
||
out: "slideOutRight",
|
||
},
|
||
none: {
|
||
in: "none",
|
||
out: "none",
|
||
},
|
||
},
|
||
svg: {
|
||
close:
|
||
'<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" xml:space="preserve"><g><g><path d="M505.943,6.058c-8.077-8.077-21.172-8.077-29.249,0L6.058,476.693c-8.077,8.077-8.077,21.172,0,29.249C10.096,509.982,15.39,512,20.683,512c5.293,0,10.586-2.019,14.625-6.059L505.943,35.306C514.019,27.23,514.019,14.135,505.943,6.058z"/></g></g><g><g><path d="M505.942,476.694L35.306,6.059c-8.076-8.077-21.172-8.077-29.248,0c-8.077,8.076-8.077,21.171,0,29.248l470.636,470.636c4.038,4.039,9.332,6.058,14.625,6.058c5.293,0,10.587-2.019,14.624-6.057C514.018,497.866,514.018,484.771,505.942,476.694z"/></g></g></svg>',
|
||
next: '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 477.175 477.175" xml:space="preserve"> <g><path d="M360.731,229.075l-225.1-225.1c-5.3-5.3-13.8-5.3-19.1,0s-5.3,13.8,0,19.1l215.5,215.5l-215.5,215.5c-5.3,5.3-5.3,13.8,0,19.1c2.6,2.6,6.1,4,9.5,4c3.4,0,6.9-1.3,9.5-4l225.1-225.1C365.931,242.875,365.931,234.275,360.731,229.075z"/></g></svg>',
|
||
prev: '<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 477.175 477.175" xml:space="preserve"><g><path d="M145.188,238.575l215.5-215.5c5.3-5.3,5.3-13.8,0-19.1s-13.8-5.3-19.1,0l-225.1,225.1c-5.3,5.3-5.3,13.8,0,19.1l225.1,225c2.6,2.6,6.1,4,9.5,4s6.9-1.3,9.5-4c5.3-5.3,5.3-13.8,0-19.1L145.188,238.575z"/></g></svg>',
|
||
},
|
||
};
|
||
defaults.slideHTML =
|
||
'<div class="gslide">\n <div class="gslide-inner-content">\n <div class="ginner-container">\n <div class="gslide-media">\n </div>\n <div class="gslide-description">\n <div class="gdesc-inner">\n <h4 class="gslide-title"></h4>\n <div class="gslide-desc"></div>\n </div>\n </div>\n </div>\n </div>\n</div>';
|
||
defaults.lightboxHTML =
|
||
'<div id="glightbox-body" class="glightbox-container" tabindex="-1" role="dialog" aria-hidden="false">\n <div class="gloader visible"></div>\n <div class="goverlay"></div>\n <div class="gcontainer">\n <div id="glightbox-slider" class="gslider"></div>\n <button class="gclose gbtn" aria-label="Close" data-taborder="3">{closeSVG}</button>\n <button class="gprev gbtn" aria-label="Previous" data-taborder="2">{prevSVG}</button>\n <button class="gnext gbtn" aria-label="Next" data-taborder="1">{nextSVG}</button>\n</div>\n</div>';
|
||
|
||
var GlightboxInit = (function () {
|
||
function GlightboxInit() {
|
||
var options =
|
||
arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||
|
||
_classCallCheck(this, GlightboxInit);
|
||
|
||
this.customOptions = options;
|
||
this.settings = extend(defaults, options);
|
||
this.effectsClasses = this.getAnimationClasses();
|
||
this.videoPlayers = {};
|
||
this.apiEvents = [];
|
||
this.fullElementsList = false;
|
||
}
|
||
|
||
_createClass(GlightboxInit, [
|
||
{
|
||
key: "init",
|
||
value: function init() {
|
||
var _this = this;
|
||
|
||
var selector = this.getSelector();
|
||
|
||
if (selector) {
|
||
this.baseEvents = addEvent("click", {
|
||
onElement: selector,
|
||
withCallback: function withCallback(e, target) {
|
||
e.preventDefault();
|
||
|
||
_this.open(target);
|
||
},
|
||
});
|
||
}
|
||
|
||
this.elements = this.getElements();
|
||
},
|
||
},
|
||
{
|
||
key: "open",
|
||
value: function open() {
|
||
var element =
|
||
arguments.length > 0 && arguments[0] !== undefined
|
||
? arguments[0]
|
||
: null;
|
||
var startAt =
|
||
arguments.length > 1 && arguments[1] !== undefined
|
||
? arguments[1]
|
||
: null;
|
||
|
||
if (this.elements.length == 0) {
|
||
return false;
|
||
}
|
||
|
||
this.activeSlide = null;
|
||
this.prevActiveSlideIndex = null;
|
||
this.prevActiveSlide = null;
|
||
var index = isNumber(startAt) ? startAt : this.settings.startAt;
|
||
|
||
if (isNode(element)) {
|
||
var gallery = element.getAttribute("data-gallery");
|
||
|
||
if (gallery) {
|
||
this.fullElementsList = this.elements;
|
||
this.elements = this.getGalleryElements(this.elements, gallery);
|
||
}
|
||
|
||
if (isNil(index)) {
|
||
index = this.getElementIndex(element);
|
||
|
||
if (index < 0) {
|
||
index = 0;
|
||
}
|
||
}
|
||
}
|
||
|
||
if (!isNumber(index)) {
|
||
index = 0;
|
||
}
|
||
|
||
this.build();
|
||
|
||
animateElement(
|
||
this.overlay,
|
||
this.settings.openEffect == "none"
|
||
? "none"
|
||
: this.settings.cssEfects.fade["in"]
|
||
);
|
||
|
||
var body = document.body;
|
||
var scrollBar =
|
||
window.innerWidth - document.documentElement.clientWidth;
|
||
|
||
if (scrollBar > 0) {
|
||
var styleSheet = document.createElement("style");
|
||
styleSheet.type = "text/css";
|
||
styleSheet.className = "gcss-styles";
|
||
styleSheet.innerText = ".gscrollbar-fixer {margin-right: ".concat(
|
||
scrollBar,
|
||
"px}"
|
||
);
|
||
document.head.appendChild(styleSheet);
|
||
|
||
addClass(body, "gscrollbar-fixer");
|
||
}
|
||
|
||
addClass(body, "glightbox-open");
|
||
|
||
addClass(html, "glightbox-open");
|
||
|
||
if (isMobile$1) {
|
||
addClass(document.body, "glightbox-mobile");
|
||
|
||
this.settings.slideEffect = "slide";
|
||
}
|
||
|
||
this.showSlide(index, true);
|
||
|
||
if (this.elements.length == 1) {
|
||
addClass(this.prevButton, "glightbox-button-hidden");
|
||
|
||
addClass(this.nextButton, "glightbox-button-hidden");
|
||
} else {
|
||
removeClass(this.prevButton, "glightbox-button-hidden");
|
||
|
||
removeClass(this.nextButton, "glightbox-button-hidden");
|
||
}
|
||
|
||
this.lightboxOpen = true;
|
||
this.trigger("open");
|
||
|
||
if (isFunction(this.settings.onOpen)) {
|
||
this.settings.onOpen();
|
||
}
|
||
|
||
if (isTouch$1 && this.settings.touchNavigation) {
|
||
touchNavigation(this);
|
||
}
|
||
|
||
if (this.settings.keyboardNavigation) {
|
||
keyboardNavigation(this);
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "openAt",
|
||
value: function openAt() {
|
||
var index =
|
||
arguments.length > 0 && arguments[0] !== undefined
|
||
? arguments[0]
|
||
: 0;
|
||
this.open(null, index);
|
||
},
|
||
},
|
||
{
|
||
key: "showSlide",
|
||
value: function showSlide() {
|
||
var _this2 = this;
|
||
|
||
var index =
|
||
arguments.length > 0 && arguments[0] !== undefined
|
||
? arguments[0]
|
||
: 0;
|
||
var first =
|
||
arguments.length > 1 && arguments[1] !== undefined
|
||
? arguments[1]
|
||
: false;
|
||
|
||
show(this.loader);
|
||
|
||
this.index = parseInt(index);
|
||
var current = this.slidesContainer.querySelector(".current");
|
||
|
||
if (current) {
|
||
removeClass(current, "current");
|
||
}
|
||
|
||
this.slideAnimateOut();
|
||
var slideNode =
|
||
this.slidesContainer.querySelectorAll(".gslide")[index];
|
||
|
||
if (hasClass(slideNode, "loaded")) {
|
||
this.slideAnimateIn(slideNode, first);
|
||
|
||
hide(this.loader);
|
||
} else {
|
||
show(this.loader);
|
||
|
||
var slide = this.elements[index];
|
||
var slideData = {
|
||
index: this.index,
|
||
slide: slideNode,
|
||
slideNode: slideNode,
|
||
slideConfig: slide.slideConfig,
|
||
slideIndex: this.index,
|
||
trigger: slide.node,
|
||
player: null,
|
||
};
|
||
this.trigger("slide_before_load", slideData);
|
||
slide.instance.setContent(slideNode, function () {
|
||
hide(_this2.loader);
|
||
|
||
_this2.resize();
|
||
|
||
_this2.slideAnimateIn(slideNode, first);
|
||
|
||
_this2.trigger("slide_after_load", slideData);
|
||
});
|
||
}
|
||
|
||
this.slideDescription = slideNode.querySelector(
|
||
".gslide-description"
|
||
);
|
||
this.slideDescriptionContained =
|
||
this.slideDescription &&
|
||
hasClass(this.slideDescription.parentNode, "gslide-media");
|
||
|
||
if (this.settings.preload) {
|
||
this.preloadSlide(index + 1);
|
||
this.preloadSlide(index - 1);
|
||
}
|
||
|
||
this.updateNavigationClasses();
|
||
this.activeSlide = slideNode;
|
||
},
|
||
},
|
||
{
|
||
key: "preloadSlide",
|
||
value: function preloadSlide(index) {
|
||
var _this3 = this;
|
||
|
||
if (index < 0 || index > this.elements.length - 1) {
|
||
return false;
|
||
}
|
||
|
||
if (isNil(this.elements[index])) {
|
||
return false;
|
||
}
|
||
|
||
var slideNode =
|
||
this.slidesContainer.querySelectorAll(".gslide")[index];
|
||
|
||
if (hasClass(slideNode, "loaded")) {
|
||
return false;
|
||
}
|
||
|
||
var slide = this.elements[index];
|
||
var type = slide.type;
|
||
var slideData = {
|
||
index: index,
|
||
slide: slideNode,
|
||
slideNode: slideNode,
|
||
slideConfig: slide.slideConfig,
|
||
slideIndex: index,
|
||
trigger: slide.node,
|
||
player: null,
|
||
};
|
||
this.trigger("slide_before_load", slideData);
|
||
|
||
if (type == "video" || type == "external") {
|
||
setTimeout(function () {
|
||
slide.instance.setContent(slideNode, function () {
|
||
_this3.trigger("slide_after_load", slideData);
|
||
});
|
||
}, 200);
|
||
} else {
|
||
slide.instance.setContent(slideNode, function () {
|
||
_this3.trigger("slide_after_load", slideData);
|
||
});
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "prevSlide",
|
||
value: function prevSlide() {
|
||
this.goToSlide(this.index - 1);
|
||
},
|
||
},
|
||
{
|
||
key: "nextSlide",
|
||
value: function nextSlide() {
|
||
this.goToSlide(this.index + 1);
|
||
},
|
||
},
|
||
{
|
||
key: "goToSlide",
|
||
value: function goToSlide() {
|
||
var index =
|
||
arguments.length > 0 && arguments[0] !== undefined
|
||
? arguments[0]
|
||
: false;
|
||
this.prevActiveSlide = this.activeSlide;
|
||
this.prevActiveSlideIndex = this.index;
|
||
|
||
if (!this.loop() && (index < 0 || index > this.elements.length - 1)) {
|
||
return false;
|
||
}
|
||
|
||
if (index < 0) {
|
||
index = this.elements.length - 1;
|
||
} else if (index >= this.elements.length) {
|
||
index = 0;
|
||
}
|
||
|
||
this.showSlide(index);
|
||
},
|
||
},
|
||
{
|
||
key: "insertSlide",
|
||
value: function insertSlide() {
|
||
var config =
|
||
arguments.length > 0 && arguments[0] !== undefined
|
||
? arguments[0]
|
||
: {};
|
||
var index =
|
||
arguments.length > 1 && arguments[1] !== undefined
|
||
? arguments[1]
|
||
: -1;
|
||
|
||
if (index < 0) {
|
||
index = this.elements.length;
|
||
}
|
||
|
||
var slide = new Slide(config, this, index);
|
||
var data = slide.getConfig();
|
||
|
||
var slideInfo = extend({}, data);
|
||
|
||
var newSlide = slide.create();
|
||
var totalSlides = this.elements.length - 1;
|
||
slideInfo.index = index;
|
||
slideInfo.node = false;
|
||
slideInfo.instance = slide;
|
||
slideInfo.slideConfig = data;
|
||
this.elements.splice(index, 0, slideInfo);
|
||
var addedSlideNode = null;
|
||
var addedSlidePlayer = null;
|
||
|
||
if (this.slidesContainer) {
|
||
if (index > totalSlides) {
|
||
this.slidesContainer.appendChild(newSlide);
|
||
} else {
|
||
var existingSlide =
|
||
this.slidesContainer.querySelectorAll(".gslide")[index];
|
||
this.slidesContainer.insertBefore(newSlide, existingSlide);
|
||
}
|
||
|
||
if (
|
||
(this.settings.preload && this.index == 0 && index == 0) ||
|
||
this.index - 1 == index ||
|
||
this.index + 1 == index
|
||
) {
|
||
this.preloadSlide(index);
|
||
}
|
||
|
||
if (this.index == 0 && index == 0) {
|
||
this.index = 1;
|
||
}
|
||
|
||
this.updateNavigationClasses();
|
||
addedSlideNode =
|
||
this.slidesContainer.querySelectorAll(".gslide")[index];
|
||
addedSlidePlayer = this.getSlidePlayerInstance(index);
|
||
slideInfo.slideNode = addedSlideNode;
|
||
}
|
||
|
||
this.trigger("slide_inserted", {
|
||
index: index,
|
||
slide: addedSlideNode,
|
||
slideNode: addedSlideNode,
|
||
slideConfig: data,
|
||
slideIndex: index,
|
||
trigger: null,
|
||
player: addedSlidePlayer,
|
||
});
|
||
|
||
if (isFunction(this.settings.slideInserted)) {
|
||
this.settings.slideInserted({
|
||
index: index,
|
||
slide: addedSlideNode,
|
||
player: addedSlidePlayer,
|
||
});
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "removeSlide",
|
||
value: function removeSlide() {
|
||
var index =
|
||
arguments.length > 0 && arguments[0] !== undefined
|
||
? arguments[0]
|
||
: -1;
|
||
|
||
if (index < 0 || index > this.elements.length - 1) {
|
||
return false;
|
||
}
|
||
|
||
var slide =
|
||
this.slidesContainer &&
|
||
this.slidesContainer.querySelectorAll(".gslide")[index];
|
||
|
||
if (slide) {
|
||
if (this.getActiveSlideIndex() == index) {
|
||
if (index == this.elements.length - 1) {
|
||
this.prevSlide();
|
||
} else {
|
||
this.nextSlide();
|
||
}
|
||
}
|
||
|
||
slide.parentNode.removeChild(slide);
|
||
}
|
||
|
||
this.elements.splice(index, 1);
|
||
this.trigger("slide_removed", index);
|
||
|
||
if (isFunction(this.settings.slideRemoved)) {
|
||
this.settings.slideRemoved(index);
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "slideAnimateIn",
|
||
value: function slideAnimateIn(slide, first) {
|
||
var _this4 = this;
|
||
|
||
var slideMedia = slide.querySelector(".gslide-media");
|
||
var slideDesc = slide.querySelector(".gslide-description");
|
||
var prevData = {
|
||
index: this.prevActiveSlideIndex,
|
||
slide: this.prevActiveSlide,
|
||
slideNode: this.prevActiveSlide,
|
||
slideIndex: this.prevActiveSlide,
|
||
slideConfig: isNil(this.prevActiveSlideIndex)
|
||
? null
|
||
: this.elements[this.prevActiveSlideIndex].slideConfig,
|
||
trigger: isNil(this.prevActiveSlideIndex)
|
||
? null
|
||
: this.elements[this.prevActiveSlideIndex].node,
|
||
player: this.getSlidePlayerInstance(this.prevActiveSlideIndex),
|
||
};
|
||
var nextData = {
|
||
index: this.index,
|
||
slide: this.activeSlide,
|
||
slideNode: this.activeSlide,
|
||
slideConfig: this.elements[this.index].slideConfig,
|
||
slideIndex: this.index,
|
||
trigger: this.elements[this.index].node,
|
||
player: this.getSlidePlayerInstance(this.index),
|
||
};
|
||
|
||
if (slideMedia.offsetWidth > 0 && slideDesc) {
|
||
hide(slideDesc);
|
||
|
||
slideDesc.style.display = "";
|
||
}
|
||
|
||
removeClass(slide, this.effectsClasses);
|
||
|
||
if (first) {
|
||
animateElement(
|
||
slide,
|
||
this.settings.cssEfects[this.settings.openEffect]["in"],
|
||
function () {
|
||
if (_this4.settings.autoplayVideos) {
|
||
_this4.slidePlayerPlay(slide);
|
||
}
|
||
|
||
_this4.trigger("slide_changed", {
|
||
prev: prevData,
|
||
current: nextData,
|
||
});
|
||
|
||
if (isFunction(_this4.settings.afterSlideChange)) {
|
||
_this4.settings.afterSlideChange.apply(_this4, [
|
||
prevData,
|
||
nextData,
|
||
]);
|
||
}
|
||
}
|
||
);
|
||
} else {
|
||
var effectName = this.settings.slideEffect;
|
||
var animIn =
|
||
effectName !== "none"
|
||
? this.settings.cssEfects[effectName]["in"]
|
||
: effectName;
|
||
|
||
if (this.prevActiveSlideIndex > this.index) {
|
||
if (this.settings.slideEffect == "slide") {
|
||
animIn = this.settings.cssEfects.slideBack["in"];
|
||
}
|
||
}
|
||
|
||
animateElement(slide, animIn, function () {
|
||
if (_this4.settings.autoplayVideos) {
|
||
_this4.slidePlayerPlay(slide);
|
||
}
|
||
|
||
_this4.trigger("slide_changed", {
|
||
prev: prevData,
|
||
current: nextData,
|
||
});
|
||
|
||
if (isFunction(_this4.settings.afterSlideChange)) {
|
||
_this4.settings.afterSlideChange.apply(_this4, [
|
||
prevData,
|
||
nextData,
|
||
]);
|
||
}
|
||
});
|
||
}
|
||
|
||
setTimeout(function () {
|
||
_this4.resize(slide);
|
||
}, 100);
|
||
|
||
addClass(slide, "current");
|
||
},
|
||
},
|
||
{
|
||
key: "slideAnimateOut",
|
||
value: function slideAnimateOut() {
|
||
if (!this.prevActiveSlide) {
|
||
return false;
|
||
}
|
||
|
||
var prevSlide = this.prevActiveSlide;
|
||
|
||
removeClass(prevSlide, this.effectsClasses);
|
||
|
||
addClass(prevSlide, "prev");
|
||
|
||
var animation = this.settings.slideEffect;
|
||
var animOut =
|
||
animation !== "none"
|
||
? this.settings.cssEfects[animation].out
|
||
: animation;
|
||
this.slidePlayerPause(prevSlide);
|
||
this.trigger("slide_before_change", {
|
||
prev: {
|
||
index: this.prevActiveSlideIndex,
|
||
slide: this.prevActiveSlide,
|
||
slideNode: this.prevActiveSlide,
|
||
slideIndex: this.prevActiveSlideIndex,
|
||
slideConfig: isNil(this.prevActiveSlideIndex)
|
||
? null
|
||
: this.elements[this.prevActiveSlideIndex].slideConfig,
|
||
trigger: isNil(this.prevActiveSlideIndex)
|
||
? null
|
||
: this.elements[this.prevActiveSlideIndex].node,
|
||
player: this.getSlidePlayerInstance(this.prevActiveSlideIndex),
|
||
},
|
||
current: {
|
||
index: this.index,
|
||
slide: this.activeSlide,
|
||
slideNode: this.activeSlide,
|
||
slideIndex: this.index,
|
||
slideConfig: this.elements[this.index].slideConfig,
|
||
trigger: this.elements[this.index].node,
|
||
player: this.getSlidePlayerInstance(this.index),
|
||
},
|
||
});
|
||
|
||
if (isFunction(this.settings.beforeSlideChange)) {
|
||
this.settings.beforeSlideChange.apply(this, [
|
||
{
|
||
index: this.prevActiveSlideIndex,
|
||
slide: this.prevActiveSlide,
|
||
player: this.getSlidePlayerInstance(this.prevActiveSlideIndex),
|
||
},
|
||
{
|
||
index: this.index,
|
||
slide: this.activeSlide,
|
||
player: this.getSlidePlayerInstance(this.index),
|
||
},
|
||
]);
|
||
}
|
||
|
||
if (
|
||
this.prevActiveSlideIndex > this.index &&
|
||
this.settings.slideEffect == "slide"
|
||
) {
|
||
animOut = this.settings.cssEfects.slideBack.out;
|
||
}
|
||
|
||
animateElement(prevSlide, animOut, function () {
|
||
var container = prevSlide.querySelector(".ginner-container");
|
||
var media = prevSlide.querySelector(".gslide-media");
|
||
var desc = prevSlide.querySelector(".gslide-description");
|
||
container.style.transform = "";
|
||
media.style.transform = "";
|
||
|
||
removeClass(media, "greset");
|
||
|
||
media.style.opacity = "";
|
||
|
||
if (desc) {
|
||
desc.style.opacity = "";
|
||
}
|
||
|
||
removeClass(prevSlide, "prev");
|
||
});
|
||
},
|
||
},
|
||
{
|
||
key: "getAllPlayers",
|
||
value: function getAllPlayers() {
|
||
return this.videoPlayers;
|
||
},
|
||
},
|
||
{
|
||
key: "getSlidePlayerInstance",
|
||
value: function getSlidePlayerInstance(index) {
|
||
var id = "gvideo" + index;
|
||
var videoPlayers = this.getAllPlayers();
|
||
|
||
if (has(videoPlayers, id) && videoPlayers[id]) {
|
||
return videoPlayers[id];
|
||
}
|
||
|
||
return false;
|
||
},
|
||
},
|
||
{
|
||
key: "stopSlideVideo",
|
||
value: function stopSlideVideo(slide) {
|
||
if (isNode(slide)) {
|
||
var node = slide.querySelector(".gvideo-wrapper");
|
||
|
||
if (node) {
|
||
slide = node.getAttribute("data-index");
|
||
}
|
||
}
|
||
|
||
console.log("stopSlideVideo is deprecated, use slidePlayerPause");
|
||
var player = this.getSlidePlayerInstance(slide);
|
||
|
||
if (player && player.playing) {
|
||
player.pause();
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "slidePlayerPause",
|
||
value: function slidePlayerPause(slide) {
|
||
if (isNode(slide)) {
|
||
var node = slide.querySelector(".gvideo-wrapper");
|
||
|
||
if (node) {
|
||
slide = node.getAttribute("data-index");
|
||
}
|
||
}
|
||
|
||
var player = this.getSlidePlayerInstance(slide);
|
||
|
||
if (player && player.playing) {
|
||
player.pause();
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "playSlideVideo",
|
||
value: function playSlideVideo(slide) {
|
||
if (isNode(slide)) {
|
||
var node = slide.querySelector(".gvideo-wrapper");
|
||
|
||
if (node) {
|
||
slide = node.getAttribute("data-index");
|
||
}
|
||
}
|
||
|
||
console.log("playSlideVideo is deprecated, use slidePlayerPlay");
|
||
var player = this.getSlidePlayerInstance(slide);
|
||
|
||
if (player && !player.playing) {
|
||
player.play();
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "slidePlayerPlay",
|
||
value: function slidePlayerPlay(slide) {
|
||
if (isNode(slide)) {
|
||
var node = slide.querySelector(".gvideo-wrapper");
|
||
|
||
if (node) {
|
||
slide = node.getAttribute("data-index");
|
||
}
|
||
}
|
||
|
||
var player = this.getSlidePlayerInstance(slide);
|
||
|
||
if (player && !player.playing) {
|
||
player.play();
|
||
|
||
if (this.settings.autofocusVideos) {
|
||
player.elements.container.focus();
|
||
}
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "setElements",
|
||
value: function setElements(elements) {
|
||
var _this5 = this;
|
||
|
||
this.settings.elements = false;
|
||
var newElements = [];
|
||
|
||
if (elements && elements.length) {
|
||
each(elements, function (el, i) {
|
||
var slide = new Slide(el, _this5, i);
|
||
var data = slide.getConfig();
|
||
|
||
var slideInfo = extend({}, data);
|
||
|
||
slideInfo.slideConfig = data;
|
||
slideInfo.instance = slide;
|
||
slideInfo.index = i;
|
||
newElements.push(slideInfo);
|
||
});
|
||
}
|
||
|
||
this.elements = newElements;
|
||
|
||
if (this.lightboxOpen) {
|
||
this.slidesContainer.innerHTML = "";
|
||
|
||
if (this.elements.length) {
|
||
each(this.elements, function () {
|
||
var slide = createHTML(_this5.settings.slideHTML);
|
||
|
||
_this5.slidesContainer.appendChild(slide);
|
||
});
|
||
|
||
this.showSlide(0, true);
|
||
}
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "getElementIndex",
|
||
value: function getElementIndex(node) {
|
||
var index = false;
|
||
|
||
each(this.elements, function (el, i) {
|
||
if (has(el, "node") && el.node == node) {
|
||
index = i;
|
||
return true;
|
||
}
|
||
});
|
||
|
||
return index;
|
||
},
|
||
},
|
||
{
|
||
key: "getElements",
|
||
value: function getElements() {
|
||
var _this6 = this;
|
||
|
||
var list = [];
|
||
this.elements = this.elements ? this.elements : [];
|
||
|
||
if (
|
||
!isNil(this.settings.elements) &&
|
||
isArray(this.settings.elements) &&
|
||
this.settings.elements.length
|
||
) {
|
||
each(this.settings.elements, function (el, i) {
|
||
var slide = new Slide(el, _this6, i);
|
||
var elData = slide.getConfig();
|
||
|
||
var slideInfo = extend({}, elData);
|
||
|
||
slideInfo.node = false;
|
||
slideInfo.index = i;
|
||
slideInfo.instance = slide;
|
||
slideInfo.slideConfig = elData;
|
||
list.push(slideInfo);
|
||
});
|
||
}
|
||
|
||
var nodes = false;
|
||
var selector = this.getSelector();
|
||
|
||
if (selector) {
|
||
nodes = document.querySelectorAll(this.getSelector());
|
||
}
|
||
|
||
if (!nodes) {
|
||
return list;
|
||
}
|
||
|
||
each(nodes, function (el, i) {
|
||
var slide = new Slide(el, _this6, i);
|
||
var elData = slide.getConfig();
|
||
|
||
var slideInfo = extend({}, elData);
|
||
|
||
slideInfo.node = el;
|
||
slideInfo.index = i;
|
||
slideInfo.instance = slide;
|
||
slideInfo.slideConfig = elData;
|
||
slideInfo.gallery = el.getAttribute("data-gallery");
|
||
list.push(slideInfo);
|
||
});
|
||
|
||
return list;
|
||
},
|
||
},
|
||
{
|
||
key: "getGalleryElements",
|
||
value: function getGalleryElements(list, gallery) {
|
||
return list.filter(function (el) {
|
||
return el.gallery == gallery;
|
||
});
|
||
},
|
||
},
|
||
{
|
||
key: "getSelector",
|
||
value: function getSelector() {
|
||
if (this.settings.elements) {
|
||
return false;
|
||
}
|
||
|
||
if (
|
||
this.settings.selector &&
|
||
this.settings.selector.substring(0, 5) == "data-"
|
||
) {
|
||
return "*[".concat(this.settings.selector, "]");
|
||
}
|
||
|
||
return this.settings.selector;
|
||
},
|
||
},
|
||
{
|
||
key: "getActiveSlide",
|
||
value: function getActiveSlide() {
|
||
return this.slidesContainer.querySelectorAll(".gslide")[this.index];
|
||
},
|
||
},
|
||
{
|
||
key: "getActiveSlideIndex",
|
||
value: function getActiveSlideIndex() {
|
||
return this.index;
|
||
},
|
||
},
|
||
{
|
||
key: "getAnimationClasses",
|
||
value: function getAnimationClasses() {
|
||
var effects = [];
|
||
|
||
for (var key in this.settings.cssEfects) {
|
||
if (this.settings.cssEfects.hasOwnProperty(key)) {
|
||
var effect = this.settings.cssEfects[key];
|
||
effects.push("g".concat(effect["in"]));
|
||
effects.push("g".concat(effect.out));
|
||
}
|
||
}
|
||
|
||
return effects.join(" ");
|
||
},
|
||
},
|
||
{
|
||
key: "build",
|
||
value: function build() {
|
||
var _this7 = this;
|
||
|
||
if (this.built) {
|
||
return false;
|
||
}
|
||
|
||
var children = document.body.childNodes;
|
||
var bodyChildElms = [];
|
||
|
||
each(children, function (el) {
|
||
if (
|
||
el.parentNode == document.body &&
|
||
el.nodeName.charAt(0) !== "#" &&
|
||
el.hasAttribute &&
|
||
!el.hasAttribute("aria-hidden")
|
||
) {
|
||
bodyChildElms.push(el);
|
||
el.setAttribute("aria-hidden", "true");
|
||
}
|
||
});
|
||
|
||
var nextSVG = has(this.settings.svg, "next")
|
||
? this.settings.svg.next
|
||
: "";
|
||
var prevSVG = has(this.settings.svg, "prev")
|
||
? this.settings.svg.prev
|
||
: "";
|
||
var closeSVG = has(this.settings.svg, "close")
|
||
? this.settings.svg.close
|
||
: "";
|
||
var lightboxHTML = this.settings.lightboxHTML;
|
||
lightboxHTML = lightboxHTML.replace(/{nextSVG}/g, nextSVG);
|
||
lightboxHTML = lightboxHTML.replace(/{prevSVG}/g, prevSVG);
|
||
lightboxHTML = lightboxHTML.replace(/{closeSVG}/g, closeSVG);
|
||
lightboxHTML = createHTML(lightboxHTML);
|
||
document.body.appendChild(lightboxHTML);
|
||
var modal = document.getElementById("glightbox-body");
|
||
this.modal = modal;
|
||
var closeButton = modal.querySelector(".gclose");
|
||
this.prevButton = modal.querySelector(".gprev");
|
||
this.nextButton = modal.querySelector(".gnext");
|
||
this.overlay = modal.querySelector(".goverlay");
|
||
this.loader = modal.querySelector(".gloader");
|
||
this.slidesContainer = document.getElementById("glightbox-slider");
|
||
this.bodyHiddenChildElms = bodyChildElms;
|
||
this.events = {};
|
||
|
||
addClass(this.modal, "glightbox-" + this.settings.skin);
|
||
|
||
if (this.settings.closeButton && closeButton) {
|
||
this.events["close"] = addEvent("click", {
|
||
onElement: closeButton,
|
||
withCallback: function withCallback(e, target) {
|
||
e.preventDefault();
|
||
|
||
_this7.close();
|
||
},
|
||
});
|
||
}
|
||
|
||
if (closeButton && !this.settings.closeButton) {
|
||
closeButton.parentNode.removeChild(closeButton);
|
||
}
|
||
|
||
if (this.nextButton) {
|
||
this.events["next"] = addEvent("click", {
|
||
onElement: this.nextButton,
|
||
withCallback: function withCallback(e, target) {
|
||
e.preventDefault();
|
||
|
||
_this7.nextSlide();
|
||
},
|
||
});
|
||
}
|
||
|
||
if (this.prevButton) {
|
||
this.events["prev"] = addEvent("click", {
|
||
onElement: this.prevButton,
|
||
withCallback: function withCallback(e, target) {
|
||
e.preventDefault();
|
||
|
||
_this7.prevSlide();
|
||
},
|
||
});
|
||
}
|
||
|
||
if (this.settings.closeOnOutsideClick) {
|
||
this.events["outClose"] = addEvent("click", {
|
||
onElement: modal,
|
||
withCallback: function withCallback(e, target) {
|
||
if (
|
||
!_this7.preventOutsideClick &&
|
||
!hasClass(document.body, "glightbox-mobile") &&
|
||
!closest(e.target, ".ginner-container")
|
||
) {
|
||
if (
|
||
!closest(e.target, ".gbtn") &&
|
||
!hasClass(e.target, "gnext") &&
|
||
!hasClass(e.target, "gprev")
|
||
) {
|
||
_this7.close();
|
||
}
|
||
}
|
||
},
|
||
});
|
||
}
|
||
|
||
each(this.elements, function (slide, i) {
|
||
_this7.slidesContainer.appendChild(slide.instance.create());
|
||
|
||
slide.slideNode =
|
||
_this7.slidesContainer.querySelectorAll(".gslide")[i];
|
||
});
|
||
|
||
if (isTouch$1) {
|
||
addClass(document.body, "glightbox-touch");
|
||
}
|
||
|
||
this.events["resize"] = addEvent("resize", {
|
||
onElement: window,
|
||
withCallback: function withCallback() {
|
||
_this7.resize();
|
||
},
|
||
});
|
||
this.built = true;
|
||
},
|
||
},
|
||
{
|
||
key: "resize",
|
||
value: function resize() {
|
||
var slide =
|
||
arguments.length > 0 && arguments[0] !== undefined
|
||
? arguments[0]
|
||
: null;
|
||
slide = !slide ? this.activeSlide : slide;
|
||
|
||
if (!slide || hasClass(slide, "zoomed")) {
|
||
return;
|
||
}
|
||
|
||
var winSize = windowSize();
|
||
|
||
var video = slide.querySelector(".gvideo-wrapper");
|
||
var image = slide.querySelector(".gslide-image");
|
||
var description = this.slideDescription;
|
||
var winWidth = winSize.width;
|
||
var winHeight = winSize.height;
|
||
|
||
if (winWidth <= 768) {
|
||
addClass(document.body, "glightbox-mobile");
|
||
} else {
|
||
removeClass(document.body, "glightbox-mobile");
|
||
}
|
||
|
||
if (!video && !image) {
|
||
return;
|
||
}
|
||
|
||
var descriptionResize = false;
|
||
|
||
if (
|
||
description &&
|
||
(hasClass(description, "description-bottom") ||
|
||
hasClass(description, "description-top")) &&
|
||
!hasClass(description, "gabsolute")
|
||
) {
|
||
descriptionResize = true;
|
||
}
|
||
|
||
if (image) {
|
||
if (winWidth <= 768) {
|
||
var imgNode = image.querySelector("img");
|
||
} else if (descriptionResize) {
|
||
var descHeight = description.offsetHeight;
|
||
|
||
var _imgNode = image.querySelector("img");
|
||
|
||
_imgNode.setAttribute(
|
||
"style",
|
||
"max-height: calc(100vh - ".concat(descHeight, "px)")
|
||
);
|
||
|
||
description.setAttribute(
|
||
"style",
|
||
"max-width: ".concat(_imgNode.offsetWidth, "px;")
|
||
);
|
||
}
|
||
}
|
||
|
||
if (video) {
|
||
var ratio = has(this.settings.plyr.config, "ratio")
|
||
? this.settings.plyr.config.ratio
|
||
: "";
|
||
|
||
if (!ratio) {
|
||
var containerWidth = video.clientWidth;
|
||
var containerHeight = video.clientHeight;
|
||
var divisor = containerWidth / containerHeight;
|
||
ratio = ""
|
||
.concat(containerWidth / divisor, ":")
|
||
.concat(containerHeight / divisor);
|
||
}
|
||
|
||
var videoRatio = ratio.split(":");
|
||
var videoWidth = this.settings.videosWidth;
|
||
var maxWidth = this.settings.videosWidth;
|
||
|
||
if (isNumber(videoWidth) || videoWidth.indexOf("px") !== -1) {
|
||
maxWidth = parseInt(videoWidth);
|
||
} else {
|
||
if (videoWidth.indexOf("vw") !== -1) {
|
||
maxWidth = (winWidth * parseInt(videoWidth)) / 100;
|
||
} else if (videoWidth.indexOf("vh") !== -1) {
|
||
maxWidth = (winHeight * parseInt(videoWidth)) / 100;
|
||
} else if (videoWidth.indexOf("%") !== -1) {
|
||
maxWidth = (winWidth * parseInt(videoWidth)) / 100;
|
||
} else {
|
||
maxWidth = parseInt(video.clientWidth);
|
||
}
|
||
}
|
||
|
||
var maxHeight =
|
||
maxWidth / (parseInt(videoRatio[0]) / parseInt(videoRatio[1]));
|
||
maxHeight = Math.floor(maxHeight);
|
||
|
||
if (descriptionResize) {
|
||
winHeight = winHeight - description.offsetHeight;
|
||
}
|
||
|
||
if (
|
||
maxWidth > winWidth ||
|
||
maxHeight > winHeight ||
|
||
(winHeight < maxHeight && winWidth > maxWidth)
|
||
) {
|
||
var vwidth = video.offsetWidth;
|
||
var vheight = video.offsetHeight;
|
||
|
||
var _ratio = winHeight / vheight;
|
||
|
||
var vsize = {
|
||
width: vwidth * _ratio,
|
||
height: vheight * _ratio,
|
||
};
|
||
video.parentNode.setAttribute(
|
||
"style",
|
||
"max-width: ".concat(vsize.width, "px")
|
||
);
|
||
|
||
if (descriptionResize) {
|
||
description.setAttribute(
|
||
"style",
|
||
"max-width: ".concat(vsize.width, "px;")
|
||
);
|
||
}
|
||
} else {
|
||
video.parentNode.style.maxWidth = "".concat(videoWidth);
|
||
|
||
if (descriptionResize) {
|
||
description.setAttribute(
|
||
"style",
|
||
"max-width: ".concat(videoWidth, ";")
|
||
);
|
||
}
|
||
}
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "reload",
|
||
value: function reload() {
|
||
this.init();
|
||
},
|
||
},
|
||
{
|
||
key: "updateNavigationClasses",
|
||
value: function updateNavigationClasses() {
|
||
var loop = this.loop();
|
||
|
||
removeClass(this.nextButton, "disabled");
|
||
|
||
removeClass(this.prevButton, "disabled");
|
||
|
||
if (this.index == 0 && this.elements.length - 1 == 0) {
|
||
addClass(this.prevButton, "disabled");
|
||
|
||
addClass(this.nextButton, "disabled");
|
||
} else if (this.index === 0 && !loop) {
|
||
addClass(this.prevButton, "disabled");
|
||
} else if (this.index === this.elements.length - 1 && !loop) {
|
||
addClass(this.nextButton, "disabled");
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "loop",
|
||
value: function loop() {
|
||
var loop = has(this.settings, "loopAtEnd")
|
||
? this.settings.loopAtEnd
|
||
: null;
|
||
loop = has(this.settings, "loop") ? this.settings.loop : loop;
|
||
return loop;
|
||
},
|
||
},
|
||
{
|
||
key: "close",
|
||
value: function close() {
|
||
var _this8 = this;
|
||
|
||
if (!this.lightboxOpen) {
|
||
if (this.events) {
|
||
for (var key in this.events) {
|
||
if (this.events.hasOwnProperty(key)) {
|
||
this.events[key].destroy();
|
||
}
|
||
}
|
||
|
||
this.events = null;
|
||
}
|
||
|
||
return false;
|
||
}
|
||
|
||
if (this.closing) {
|
||
return false;
|
||
}
|
||
|
||
this.closing = true;
|
||
this.slidePlayerPause(this.activeSlide);
|
||
|
||
if (this.fullElementsList) {
|
||
this.elements = this.fullElementsList;
|
||
}
|
||
|
||
if (this.bodyHiddenChildElms.length) {
|
||
each(this.bodyHiddenChildElms, function (el) {
|
||
el.removeAttribute("aria-hidden");
|
||
});
|
||
}
|
||
|
||
addClass(this.modal, "glightbox-closing");
|
||
|
||
animateElement(
|
||
this.overlay,
|
||
this.settings.openEffect == "none"
|
||
? "none"
|
||
: this.settings.cssEfects.fade.out
|
||
);
|
||
|
||
animateElement(
|
||
this.activeSlide,
|
||
this.settings.cssEfects[this.settings.closeEffect].out,
|
||
function () {
|
||
_this8.activeSlide = null;
|
||
_this8.prevActiveSlideIndex = null;
|
||
_this8.prevActiveSlide = null;
|
||
_this8.built = false;
|
||
|
||
if (_this8.events) {
|
||
for (var _key in _this8.events) {
|
||
if (_this8.events.hasOwnProperty(_key)) {
|
||
_this8.events[_key].destroy();
|
||
}
|
||
}
|
||
|
||
_this8.events = null;
|
||
}
|
||
|
||
var body = document.body;
|
||
|
||
removeClass(html, "glightbox-open");
|
||
|
||
removeClass(
|
||
body,
|
||
"glightbox-open touching gdesc-open glightbox-touch glightbox-mobile gscrollbar-fixer"
|
||
);
|
||
|
||
_this8.modal.parentNode.removeChild(_this8.modal);
|
||
|
||
_this8.trigger("close");
|
||
|
||
if (isFunction(_this8.settings.onClose)) {
|
||
_this8.settings.onClose();
|
||
}
|
||
|
||
var styles = document.querySelector(".gcss-styles");
|
||
|
||
if (styles) {
|
||
styles.parentNode.removeChild(styles);
|
||
}
|
||
|
||
_this8.lightboxOpen = false;
|
||
_this8.closing = null;
|
||
}
|
||
);
|
||
},
|
||
},
|
||
{
|
||
key: "destroy",
|
||
value: function destroy() {
|
||
this.close();
|
||
this.clearAllEvents();
|
||
|
||
if (this.baseEvents) {
|
||
this.baseEvents.destroy();
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "on",
|
||
value: function on(evt, callback) {
|
||
var once =
|
||
arguments.length > 2 && arguments[2] !== undefined
|
||
? arguments[2]
|
||
: false;
|
||
|
||
if (!evt || !isFunction(callback)) {
|
||
throw new TypeError("Event name and callback must be defined");
|
||
}
|
||
|
||
this.apiEvents.push({
|
||
evt: evt,
|
||
once: once,
|
||
callback: callback,
|
||
});
|
||
},
|
||
},
|
||
{
|
||
key: "once",
|
||
value: function once(evt, callback) {
|
||
this.on(evt, callback, true);
|
||
},
|
||
},
|
||
{
|
||
key: "trigger",
|
||
value: function trigger(eventName) {
|
||
var _this9 = this;
|
||
|
||
var data =
|
||
arguments.length > 1 && arguments[1] !== undefined
|
||
? arguments[1]
|
||
: null;
|
||
var onceTriggered = [];
|
||
|
||
each(this.apiEvents, function (event, i) {
|
||
var evt = event.evt,
|
||
once = event.once,
|
||
callback = event.callback;
|
||
|
||
if (evt == eventName) {
|
||
callback(data);
|
||
|
||
if (once) {
|
||
onceTriggered.push(i);
|
||
}
|
||
}
|
||
});
|
||
|
||
if (onceTriggered.length) {
|
||
each(onceTriggered, function (i) {
|
||
return _this9.apiEvents.splice(i, 1);
|
||
});
|
||
}
|
||
},
|
||
},
|
||
{
|
||
key: "clearAllEvents",
|
||
value: function clearAllEvents() {
|
||
this.apiEvents.splice(0, this.apiEvents.length);
|
||
},
|
||
},
|
||
{
|
||
key: "version",
|
||
value: function version() {
|
||
return _version;
|
||
},
|
||
},
|
||
]);
|
||
|
||
return GlightboxInit;
|
||
})();
|
||
|
||
function glightbox() {
|
||
var options =
|
||
arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||
var instance = new GlightboxInit(options);
|
||
instance.init();
|
||
return instance;
|
||
}
|
||
|
||
return glightbox;
|
||
});
|
||
|
||
;
|
||
(function () {
|
||
"use strict";
|
||
// gallery init
|
||
GLightbox();
|
||
|
||
const elementIsVisibleInViewport = (el, partiallyVisible = true) => {
|
||
const { top, left, bottom, right } = el.getBoundingClientRect();
|
||
const { innerHeight, innerWidth } = window;
|
||
return partiallyVisible
|
||
? ((top > 0 && top < innerHeight) ||
|
||
(bottom > 0 && bottom < innerHeight)) &&
|
||
((left > 0 && left < innerWidth) || (right > 0 && right < innerWidth))
|
||
: top >= 0 && left >= 0 && bottom <= innerHeight && right <= innerWidth;
|
||
};
|
||
|
||
const justify_scale = screen.height * 0.25;
|
||
const allGallery = document.querySelectorAll(".gallery");
|
||
const checkVisibility = () => {
|
||
allGallery.forEach((gallery) => {
|
||
const items = gallery.querySelectorAll(".gallery-item");
|
||
if (elementIsVisibleInViewport(gallery)) {
|
||
items.forEach((item) => {
|
||
let image = item.querySelector("img");
|
||
let ratio = image.naturalWidth / image.naturalHeight;
|
||
item.style.width = justify_scale * ratio + "px";
|
||
item.style.flexGrow = ratio;
|
||
image.style.opacity = 1;
|
||
});
|
||
}
|
||
});
|
||
}
|
||
window.addEventListener("scroll", checkVisibility);
|
||
window.addEventListener("load", checkVisibility);
|
||
|
||
// gallery slider
|
||
var isGallerySlider = document.getElementsByClassName("gallery-slider");
|
||
if (isGallerySlider.length > 0) {
|
||
new Swiper(".gallery-slider", {
|
||
slidesPerView: 1,
|
||
loop: true,
|
||
autoHeight: true,
|
||
spaceBetween: 0,
|
||
speed: 1500,
|
||
autoplay: {
|
||
delay: 5000,
|
||
},
|
||
navigation: {
|
||
nextEl: ".swiper-button-next",
|
||
prevEl: ".swiper-button-prev",
|
||
},
|
||
});
|
||
}
|
||
})();
|
||
|
||
;
|
||
!(function (e) {
|
||
var n;
|
||
if (
|
||
("function" == typeof define && define.amd && (define(e), (n = !0)),
|
||
"object" == typeof exports && ((module.exports = e()), (n = !0)),
|
||
!n)
|
||
) {
|
||
var t = window.Cookies,
|
||
o = (window.Cookies = e());
|
||
o.noConflict = function () {
|
||
return (window.Cookies = t), o;
|
||
};
|
||
}
|
||
})(function () {
|
||
function f() {
|
||
for (var e = 0, n = {}; e < arguments.length; e++) {
|
||
var t = arguments[e];
|
||
for (var o in t) n[o] = t[o];
|
||
}
|
||
return n;
|
||
}
|
||
function a(e) {
|
||
return e.replace(/(%[0-9A-Z]{2})+/g, decodeURIComponent);
|
||
}
|
||
return (function e(u) {
|
||
function c() {}
|
||
function t(e, n, t) {
|
||
if ("undefined" != typeof document) {
|
||
"number" == typeof (t = f({ path: "/" }, c.defaults, t)).expires &&
|
||
(t.expires = new Date(1 * new Date() + 864e5 * t.expires)),
|
||
(t.expires = t.expires ? t.expires.toUTCString() : "");
|
||
try {
|
||
var o = JSON.stringify(n);
|
||
/^[\{\[]/.test(o) && (n = o);
|
||
} catch (e) {}
|
||
(n = u.write
|
||
? u.write(n, e)
|
||
: encodeURIComponent(String(n)).replace(
|
||
/%(23|24|26|2B|3A|3C|3E|3D|2F|3F|40|5B|5D|5E|60|7B|7D|7C)/g,
|
||
decodeURIComponent
|
||
)),
|
||
(e = encodeURIComponent(String(e))
|
||
.replace(/%(23|24|26|2B|5E|60|7C)/g, decodeURIComponent)
|
||
.replace(/[\(\)]/g, escape));
|
||
var r = "";
|
||
for (var i in t)
|
||
t[i] &&
|
||
((r += "; " + i), !0 !== t[i] && (r += "=" + t[i].split(";")[0]));
|
||
return (document.cookie = e + "=" + n + r);
|
||
}
|
||
}
|
||
function n(e, n) {
|
||
if ("undefined" != typeof document) {
|
||
for (
|
||
var t = {},
|
||
o = document.cookie ? document.cookie.split("; ") : [],
|
||
r = 0;
|
||
r < o.length;
|
||
r++
|
||
) {
|
||
var i = o[r].split("="),
|
||
c = i.slice(1).join("=");
|
||
n || '"' !== c.charAt(0) || (c = c.slice(1, -1));
|
||
try {
|
||
var f = a(i[0]);
|
||
if (((c = (u.read || u)(c, f) || a(c)), n))
|
||
try {
|
||
c = JSON.parse(c);
|
||
} catch (e) {}
|
||
if (((t[f] = c), e === f)) break;
|
||
} catch (e) {}
|
||
}
|
||
return e ? t[e] : t;
|
||
}
|
||
}
|
||
return (
|
||
(c.set = t),
|
||
(c.get = function (e) {
|
||
return n(e, !1);
|
||
}),
|
||
(c.getJSON = function (e) {
|
||
return n(e, !0);
|
||
}),
|
||
(c.remove = function (e, n) {
|
||
t(e, "", f(n, { expires: -1 }));
|
||
}),
|
||
(c.defaults = {}),
|
||
(c.withConverter = e),
|
||
c
|
||
);
|
||
})(function () {});
|
||
});
|
||
|
||
;
|
||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.AOS=t():e.AOS=t()}(this,function(){return function(e){function t(o){if(n[o])return n[o].exports;var i=n[o]={exports:{},id:o,loaded:!1};return e[o].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var n={};return t.m=e,t.c=n,t.p="dist/",t(0)}([function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}var i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},r=n(1),a=(o(r),n(6)),u=o(a),c=n(7),f=o(c),s=n(8),d=o(s),l=n(9),p=o(l),m=n(10),b=o(m),v=n(11),y=o(v),g=n(14),h=o(g),w=[],k=!1,x=document.all&&!window.atob,j={offset:120,delay:0,easing:"ease",duration:400,disable:!1,once:!1,startEvent:"DOMContentLoaded",throttleDelay:99,debounceDelay:50,disableMutationObserver:!1},O=function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(e&&(k=!0),k)return w=(0,y.default)(w,j),(0,b.default)(w,j.once),w},_=function(){w=(0,h.default)(),O()},S=function(){w.forEach(function(e,t){e.node.removeAttribute("data-aos"),e.node.removeAttribute("data-aos-easing"),e.node.removeAttribute("data-aos-duration"),e.node.removeAttribute("data-aos-delay")})},z=function(e){return e===!0||"mobile"===e&&p.default.mobile()||"phone"===e&&p.default.phone()||"tablet"===e&&p.default.tablet()||"function"==typeof e&&e()===!0},A=function(e){return j=i(j,e),w=(0,h.default)(),z(j.disable)||x?S():(document.querySelector("body").setAttribute("data-aos-easing",j.easing),document.querySelector("body").setAttribute("data-aos-duration",j.duration),document.querySelector("body").setAttribute("data-aos-delay",j.delay),"DOMContentLoaded"===j.startEvent&&["complete","interactive"].indexOf(document.readyState)>-1?O(!0):"load"===j.startEvent?window.addEventListener(j.startEvent,function(){O(!0)}):document.addEventListener(j.startEvent,function(){O(!0)}),window.addEventListener("resize",(0,f.default)(O,j.debounceDelay,!0)),window.addEventListener("orientationchange",(0,f.default)(O,j.debounceDelay,!0)),window.addEventListener("scroll",(0,u.default)(function(){(0,b.default)(w,j.once)},j.throttleDelay)),j.disableMutationObserver||(0,d.default)("[data-aos]",_),w)};e.exports={init:A,refresh:O,refreshHard:_}},function(e,t){},,,,,function(e,t){(function(t){"use strict";function n(e,t,n){function o(t){var n=b,o=v;return b=v=void 0,k=t,g=e.apply(o,n)}function r(e){return k=e,h=setTimeout(s,t),_?o(e):g}function a(e){var n=e-w,o=e-k,i=t-n;return S?j(i,y-o):i}function c(e){var n=e-w,o=e-k;return void 0===w||n>=t||n<0||S&&o>=y}function s(){var e=O();return c(e)?d(e):void(h=setTimeout(s,a(e)))}function d(e){return h=void 0,z&&b?o(e):(b=v=void 0,g)}function l(){void 0!==h&&clearTimeout(h),k=0,b=w=v=h=void 0}function p(){return void 0===h?g:d(O())}function m(){var e=O(),n=c(e);if(b=arguments,v=this,w=e,n){if(void 0===h)return r(w);if(S)return h=setTimeout(s,t),o(w)}return void 0===h&&(h=setTimeout(s,t)),g}var b,v,y,g,h,w,k=0,_=!1,S=!1,z=!0;if("function"!=typeof e)throw new TypeError(f);return t=u(t)||0,i(n)&&(_=!!n.leading,S="maxWait"in n,y=S?x(u(n.maxWait)||0,t):y,z="trailing"in n?!!n.trailing:z),m.cancel=l,m.flush=p,m}function o(e,t,o){var r=!0,a=!0;if("function"!=typeof e)throw new TypeError(f);return i(o)&&(r="leading"in o?!!o.leading:r,a="trailing"in o?!!o.trailing:a),n(e,t,{leading:r,maxWait:t,trailing:a})}function i(e){var t="undefined"==typeof e?"undefined":c(e);return!!e&&("object"==t||"function"==t)}function r(e){return!!e&&"object"==("undefined"==typeof e?"undefined":c(e))}function a(e){return"symbol"==("undefined"==typeof e?"undefined":c(e))||r(e)&&k.call(e)==d}function u(e){if("number"==typeof e)return e;if(a(e))return s;if(i(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=i(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(l,"");var n=m.test(e);return n||b.test(e)?v(e.slice(2),n?2:8):p.test(e)?s:+e}var c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},f="Expected a function",s=NaN,d="[object Symbol]",l=/^\s+|\s+$/g,p=/^[-+]0x[0-9a-f]+$/i,m=/^0b[01]+$/i,b=/^0o[0-7]+$/i,v=parseInt,y="object"==("undefined"==typeof t?"undefined":c(t))&&t&&t.Object===Object&&t,g="object"==("undefined"==typeof self?"undefined":c(self))&&self&&self.Object===Object&&self,h=y||g||Function("return this")(),w=Object.prototype,k=w.toString,x=Math.max,j=Math.min,O=function(){return h.Date.now()};e.exports=o}).call(t,function(){return this}())},function(e,t){(function(t){"use strict";function n(e,t,n){function i(t){var n=b,o=v;return b=v=void 0,O=t,g=e.apply(o,n)}function r(e){return O=e,h=setTimeout(s,t),_?i(e):g}function u(e){var n=e-w,o=e-O,i=t-n;return S?x(i,y-o):i}function f(e){var n=e-w,o=e-O;return void 0===w||n>=t||n<0||S&&o>=y}function s(){var e=j();return f(e)?d(e):void(h=setTimeout(s,u(e)))}function d(e){return h=void 0,z&&b?i(e):(b=v=void 0,g)}function l(){void 0!==h&&clearTimeout(h),O=0,b=w=v=h=void 0}function p(){return void 0===h?g:d(j())}function m(){var e=j(),n=f(e);if(b=arguments,v=this,w=e,n){if(void 0===h)return r(w);if(S)return h=setTimeout(s,t),i(w)}return void 0===h&&(h=setTimeout(s,t)),g}var b,v,y,g,h,w,O=0,_=!1,S=!1,z=!0;if("function"!=typeof e)throw new TypeError(c);return t=a(t)||0,o(n)&&(_=!!n.leading,S="maxWait"in n,y=S?k(a(n.maxWait)||0,t):y,z="trailing"in n?!!n.trailing:z),m.cancel=l,m.flush=p,m}function o(e){var t="undefined"==typeof e?"undefined":u(e);return!!e&&("object"==t||"function"==t)}function i(e){return!!e&&"object"==("undefined"==typeof e?"undefined":u(e))}function r(e){return"symbol"==("undefined"==typeof e?"undefined":u(e))||i(e)&&w.call(e)==s}function a(e){if("number"==typeof e)return e;if(r(e))return f;if(o(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=o(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(d,"");var n=p.test(e);return n||m.test(e)?b(e.slice(2),n?2:8):l.test(e)?f:+e}var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c="Expected a function",f=NaN,s="[object Symbol]",d=/^\s+|\s+$/g,l=/^[-+]0x[0-9a-f]+$/i,p=/^0b[01]+$/i,m=/^0o[0-7]+$/i,b=parseInt,v="object"==("undefined"==typeof t?"undefined":u(t))&&t&&t.Object===Object&&t,y="object"==("undefined"==typeof self?"undefined":u(self))&&self&&self.Object===Object&&self,g=v||y||Function("return this")(),h=Object.prototype,w=h.toString,k=Math.max,x=Math.min,j=function(){return g.Date.now()};e.exports=n}).call(t,function(){return this}())},function(e,t){"use strict";function n(e,t){var n=new r(o);a=t,n.observe(i.documentElement,{childList:!0,subtree:!0,removedNodes:!0})}function o(e){e&&e.forEach(function(e){var t=Array.prototype.slice.call(e.addedNodes),n=Array.prototype.slice.call(e.removedNodes),o=t.concat(n).filter(function(e){return e.hasAttribute&&e.hasAttribute("data-aos")}).length;o&&a()})}Object.defineProperty(t,"__esModule",{value:!0});var i=window.document,r=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver,a=function(){};t.default=n},function(e,t){"use strict";function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function o(){return navigator.userAgent||navigator.vendor||window.opera||""}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,o.key,o)}}return function(t,n,o){return n&&e(t.prototype,n),o&&e(t,o),t}}(),r=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i,a=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,u=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i,c=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,f=function(){function e(){n(this,e)}return i(e,[{key:"phone",value:function(){var e=o();return!(!r.test(e)&&!a.test(e.substr(0,4)))}},{key:"mobile",value:function(){var e=o();return!(!u.test(e)&&!c.test(e.substr(0,4)))}},{key:"tablet",value:function(){return this.mobile()&&!this.phone()}}]),e}();t.default=new f},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e,t,n){var o=e.node.getAttribute("data-aos-once");t>e.position?e.node.classList.add("aos-animate"):"undefined"!=typeof o&&("false"===o||!n&&"true"!==o)&&e.node.classList.remove("aos-animate")},o=function(e,t){var o=window.pageYOffset,i=window.innerHeight;e.forEach(function(e,r){n(e,i+o,t)})};t.default=o},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(12),r=o(i),a=function(e,t){return e.forEach(function(e,n){e.node.classList.add("aos-init"),e.position=(0,r.default)(e.node,t.offset)}),e};t.default=a},function(e,t,n){"use strict";function o(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var i=n(13),r=o(i),a=function(e,t){var n=0,o=0,i=window.innerHeight,a={offset:e.getAttribute("data-aos-offset"),anchor:e.getAttribute("data-aos-anchor"),anchorPlacement:e.getAttribute("data-aos-anchor-placement")};switch(a.offset&&!isNaN(a.offset)&&(o=parseInt(a.offset)),a.anchor&&document.querySelectorAll(a.anchor)&&(e=document.querySelectorAll(a.anchor)[0]),n=(0,r.default)(e).top,a.anchorPlacement){case"top-bottom":break;case"center-bottom":n+=e.offsetHeight/2;break;case"bottom-bottom":n+=e.offsetHeight;break;case"top-center":n+=i/2;break;case"bottom-center":n+=i/2+e.offsetHeight;break;case"center-center":n+=i/2+e.offsetHeight/2;break;case"top-top":n+=i;break;case"bottom-top":n+=e.offsetHeight+i;break;case"center-top":n+=e.offsetHeight/2+i}return a.anchorPlacement||a.offset||isNaN(t)||(o=t),n+o};t.default=a},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){for(var t=0,n=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)t+=e.offsetLeft-("BODY"!=e.tagName?e.scrollLeft:0),n+=e.offsetTop-("BODY"!=e.tagName?e.scrollTop:0),e=e.offsetParent;return{top:n,left:t}};t.default=n},function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=function(e){return e=e||document.querySelectorAll("[data-aos]"),Array.prototype.map.call(e,function(e){return{node:e}})};t.default=n}])});
|
||
;
|
||
// main script
|
||
(function () {
|
||
"use strict";
|
||
|
||
AOS.init({
|
||
once: true,
|
||
});
|
||
|
||
// Back to Top
|
||
const bctBtn = document.querySelector(".back-to-top");
|
||
if (bctBtn) {
|
||
window.addEventListener("scroll", () => {
|
||
if (document.documentElement.scrollTop <= 100) {
|
||
bctBtn.classList.remove("active");
|
||
} else {
|
||
bctBtn.classList.add("active");
|
||
}
|
||
});
|
||
|
||
bctBtn.addEventListener("click", () => {
|
||
document.documentElement.scrollTop = 0;
|
||
});
|
||
}
|
||
|
||
// Sidebar in Mobile Devices Hide & Show
|
||
const sidebar = document.querySelector("#sidebarContent");
|
||
const navbarToggler = document.querySelector(".navbar-toggler");
|
||
navbarToggler.addEventListener("click", (e) => {
|
||
e.preventDefault();
|
||
|
||
function closeSidebar() {
|
||
navbarToggler.classList.remove("active");
|
||
sidebar.classList.remove("active");
|
||
|
||
// Prevent Body Scrolling
|
||
document.body.classList.remove("navbar-show");
|
||
document.body.style.removeProperty("padding-right");
|
||
|
||
// Remove Backdrop
|
||
if (document.querySelector(".tf-backdrop")) {
|
||
document.querySelector(".tf-backdrop").remove();
|
||
}
|
||
}
|
||
|
||
function showSidebar() {
|
||
navbarToggler.classList.add("active");
|
||
sidebar.classList.add("active");
|
||
|
||
// Close Sidebar If user click outside of sidebar element
|
||
const backdrop = document.createElement("div");
|
||
backdrop.setAttribute(
|
||
"style",
|
||
"width: 100vw;height: 100vh;background-color:#000000;opacity: 0.6;position:fixed;z-index:555;left:0;top:0;"
|
||
);
|
||
backdrop.setAttribute("class", "tf-backdrop");
|
||
if (!document.querySelector(".tf-backdrop")) {
|
||
document.body.insertBefore(backdrop, sidebar.children[-1]);
|
||
}
|
||
}
|
||
|
||
if (navbarToggler.classList.contains("active")) {
|
||
closeSidebar();
|
||
} else {
|
||
showSidebar();
|
||
document.querySelector(".tf-backdrop").addEventListener("click", () => {
|
||
closeSidebar();
|
||
});
|
||
}
|
||
|
||
window.addEventListener("resize", () => {
|
||
if (screen.width >= 1200) {
|
||
closeSidebar();
|
||
}
|
||
});
|
||
});
|
||
})();
|
||
</script>
|
||
|
||
|
||
|
||
|
||
<script type="application/javascript">
|
||
WebFont.load({
|
||
google: {
|
||
api: 'https://fonts.googleapis.com/css2',
|
||
families: ['Poppins:wght@200;300;400;500;600&display=swap'],
|
||
version: 2
|
||
},
|
||
active: () => {sessionStorage.fontsLoaded = true}
|
||
});
|
||
</script>
|
||
|
||
|
||
|
||
<script>
|
||
if ('serviceWorker' in navigator){navigator.serviceWorker.register("/service-worker.js");}
|
||
</script>
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
</body>
|
||
|
||
</html> |