1/*! 2 * Lightbox for Bootstrap 5 v1.8.2 (https://trvswgnr.github.io/bs5-lightbox/) 3 * Copyright 2022 Travis Aaron Wagner (https://github.com/trvswgnr/) 4 * Licensed under MIT (https://github.com/trvswgnr/bs5-lightbox/blob/main/LICENSE) 5 */ !(function () { 6 "use strict"; 7 var t = { 8 d: function (e, s) { 9 for (var a in s) t.o(s, a) && !t.o(e, a) && Object.defineProperty(e, a, { enumerable: !0, get: s[a] }); 10 }, 11 o: function (t, e) { 12 return Object.prototype.hasOwnProperty.call(t, e); 13 }, 14 }, 15 e = {}; 16 t.d(e, { 17 default: function () { 18 return i; 19 }, 20 }); 21 var s = window.bootstrap; 22 const a = { Modal: s.Modal, Carousel: s.Carousel }; 23 class o { 24 constructor(t) { 25 let e = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; 26 (this.hash = this.randomHash()), 27 (this.settings = Object.assign(Object.assign(Object.assign({}, a.Modal.Default), a.Carousel.Default), { interval: !1, target: '[data-toggle="lightbox"]', gallery: "", size: "xl", constrain: !0 })), 28 (this.modalOptions = (() => this.setOptionsFromSettings(a.Modal.Default))()), 29 (this.carouselOptions = (() => this.setOptionsFromSettings(a.Carousel.Default))()), 30 "string" == typeof t && ((this.settings.target = t), (t = document.querySelector(this.settings.target))), 31 (this.settings = Object.assign(Object.assign({}, this.settings), e)), 32 (this.el = t), 33 (this.type = t.dataset.type || ""), 34 (this.src = this.getSrc(t)), 35 (this.sources = this.getGalleryItems()), 36 this.createCarousel(), 37 this.createModal(); 38 } 39 show() { 40 document.body.appendChild(this.modalElement), this.modal.show(); 41 } 42 hide() { 43 this.modal.hide(); 44 } 45 setOptionsFromSettings(t) { 46 return Object.keys(t).reduce((t, e) => Object.assign(t, { [e]: this.settings[e] }), {}); 47 } 48 getSrc(t) { 49 let e = t.dataset.src || t.dataset.remote || t.href || "http://via.placeholder.com/1600x900"; 50 if ("html" === t.dataset.type) return e; 51 /\:\/\//.test(e) || (e = window.location.origin + e); 52 const s = new URL(e); 53 return (t.dataset.footer || t.dataset.caption) && s.searchParams.set("caption", t.dataset.footer || t.dataset.caption), s.toString(); 54 } 55 getGalleryItems() { 56 let t; 57 if (this.settings.gallery) { 58 if (Array.isArray(this.settings.gallery)) return this.settings.gallery; 59 t = this.settings.gallery; 60 } else this.el.dataset.gallery && (t = this.el.dataset.gallery); 61 return t 62 ? [...new Set(Array.from(document.querySelectorAll('[data-gallery="'.concat(t, '"]')), (t) => "".concat(t.dataset.type ? t.dataset.type : "").concat(this.getSrc(t))))] 63 : ["".concat(this.type ? this.type : "").concat(this.src)]; 64 } 65 getYoutubeId(t) { 66 if (!t) return !1; 67 const e = t.match(/^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|&v=)([^#&?]*).*/); 68 return !(!e || 11 !== e[2].length) && e[2]; 69 } 70 getYoutubeLink(t) { 71 const e = this.getYoutubeId(t); 72 if (!e) return !1; 73 const s = t.split("?"); 74 let a = s.length > 1 ? "?" + s[1] : ""; 75 return "https://www.youtube.com/embed/".concat(e).concat(a); 76 } 77 getInstagramEmbed(t) { 78 if (/instagram/.test(t)) 79 return (t += /\/embed$/.test(t) ? "" : "/embed"), '<iframe src="'.concat(t, '" class="start-50 translate-middle-x" style="max-width: 500px" frameborder="0" scrolling="no" allowtransparency="true"></iframe>'); 80 } 81 isEmbed(t) { 82 const e = new RegExp("(" + o.allowedEmbedTypes.join("|") + ")").test(t), 83 s = /\.(png|jpe?g|gif|svg|webp)/i.test(t) || "image" === this.el.dataset.type; 84 return e || !s; 85 } 86 createCarousel() { 87 const t = document.createElement("template"), 88 e = o.allowedMediaTypes.join("|"), 89 s = this.sources 90 .map((t, s) => { 91 t = t.replace(/\/$/, ""); 92 const a = new RegExp("^(".concat(e, ")"), "i"), 93 o = /^html/.test(t), 94 i = /^image/.test(t); 95 a.test(t) && (t = t.replace(a, "")); 96 const n = this.settings.constrain ? "mw-100 mh-100 h-auto w-auto m-auto top-0 end-0 bottom-0 start-0" : "h-100 w-100", 97 l = new URLSearchParams(t.split("?")[1]); 98 let r = "", 99 c = t; 100 if (l.get("caption")) { 101 try { 102 (c = new URL(t)), c.searchParams.delete("caption"), (c = c.toString()); 103 } catch (e) { 104 c = t; 105 } 106 r = '<p class="lightbox-caption m-0 p-2 text-center text-white small"><em>'.concat(l.get("caption"), "</em></p>"); 107 } 108 let d = '<img src="'.concat(c, '" class="d-block ').concat(n, ' img-fluid" style="z-index: 1; object-fit: contain;" />'), 109 h = ""; 110 const u = this.getInstagramEmbed(t), 111 m = this.getYoutubeLink(t); 112 this.isEmbed(t) && 113 !i && 114 (m && ((t = m), (h = 'title="YouTube video player" frameborder="0" allow="autoplay"')), 115 (d = u || '<iframe src="'.concat(t, '" ').concat(h, "autoplay allowfullscreen></iframe>"))), 116 o && (d = t); 117 return '\n\t\t\t\t<div class="carousel-item ' 118 .concat(s ? "" : "active", '" style="min-height: 100px">\n\t\t\t\t\t') 119 .concat( 120 '<div class="position-absolute top-50 start-50 translate-middle text-white"><div class="spinner-border" style="width: 3rem height: 3rem" role="status"></div></div>', 121 '\n\t\t\t\t\t<div class="ratio ratio-16x9" style="background-color: #000;">' 122 ) 123 .concat(d, "</div>\n\t\t\t\t\t") 124 .concat(r, "\n\t\t\t\t</div>"); 125 }) 126 .join(""), 127 i = 128 this.sources.length < 2 129 ? "" 130 : '\n\t\t\t<button id="#lightboxCarousel-' 131 .concat(this.hash, '-prev" class="carousel-control carousel-control-prev h-75 m-auto" type="button" data-bs-target="#lightboxCarousel-') 132 .concat( 133 this.hash, 134 '" data-bs-slide="prev">\n\t\t\t\t<span class="carousel-control-prev-icon" aria-hidden="true"></span>\n\t\t\t\t<span class="visually-hidden">Previous</span>\n\t\t\t</button>\n\t\t\t<button id="#lightboxCarousel-' 135 ) 136 .concat(this.hash, '-next" class="carousel-control carousel-control-next h-75 m-auto" type="button" data-bs-target="#lightboxCarousel-') 137 .concat(this.hash, '" data-bs-slide="next">\n\t\t\t\t<span class="carousel-control-next-icon" aria-hidden="true"></span>\n\t\t\t\t<span class="visually-hidden">Next</span>\n\t\t\t</button>'); 138 let n = "lightbox-carousel carousel slide"; 139 "fullscreen" === this.settings.size && (n += " position-absolute w-100 translate-middle top-50 start-50"); 140 const l = '\n\t\t\t<div id="lightboxCarousel-' 141 .concat(this.hash, '" class="') 142 .concat(n, '" data-bs-ride="carousel" data-bs-interval="') 143 .concat(this.carouselOptions.interval, '">\n\t\t\t\t<div class="carousel-inner">\n\t\t\t\t\t') 144 .concat(s, "\n\t\t\t\t</div>\n\t\t\t\t") 145 .concat(i, "\n\t\t\t</div>"); 146 (t.innerHTML = l.trim()), (this.carouselElement = t.content.firstChild); 147 const r = Object.assign(Object.assign({}, this.carouselOptions), { keyboard: !1 }); 148 this.carousel = new a.Carousel(this.carouselElement, r); 149 const c = this.type && "image" !== this.type ? this.type + this.src : this.src; 150 return ( 151 this.carousel.to(this.findGalleryItemIndex(this.sources, c)), 152 !0 === this.carouselOptions.keyboard && 153 document.addEventListener("keydown", (t) => { 154 if ("ArrowLeft" === t.code) { 155 const t = document.getElementById("#lightboxCarousel-".concat(this.hash, "-prev")); 156 return t && t.click(), !1; 157 } 158 if ("ArrowRight" === t.code) { 159 const t = document.getElementById("#lightboxCarousel-".concat(this.hash, "-next")); 160 return t && t.click(), !1; 161 } 162 }), 163 this.carousel
164 ); 165 } 166 findGalleryItemIndex(t, e) { 167 let s = 0; 168 for (const a of t) { 169 if (a.includes(e)) return s; 170 s++; 171 } 172 return 0; 173 } 174 createModal() { 175 const t = document.createElement("template"), 176 e = '\n\t\t\t<div class="modal lightbox fade" id="lightboxModal-' 177 .concat(this.hash, '" tabindex="-1" aria-hidden="true">\n\t\t\t\t<div class="modal-dialog modal-dialog-centered modal-') 178 .concat( 179 this.settings.size, 180 '">\n\t\t\t\t\t<div class="modal-content border-0 bg-transparent">\n\t\t\t\t\t\t<div class="modal-body p-0">\n\t\t\t\t\t\t\t<button type="button" class="btn-close position-absolute top-0 end-0 p-3" data-bs-dismiss="modal" aria-label="Close" style="z-index: 2; background: none;">' 181 ) 182 .concat( 183 '<svg xmlns="http://www.w3.org/2000/svg" style="position: relative; top: -5px;" viewBox="0 0 16 16" fill="#fff"><path d="M.293.293a1 1 0 011.414 0L8 6.586 14.293.293a1 1 0 111.414 1.414L9.414 8l6.293 6.293a1 1 0 01-1.414 1.414L8 9.414l-6.293 6.293a1 1 0 01-1.414-1.414L6.586 8 .293 1.707a1 1 0 010-1.414z"/></svg>', 184 "</button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\t\t\t\t</div>\n\t\t\t</div>" 185 ); 186 return ( 187 (t.innerHTML = e.trim()), 188 (this.modalElement = t.content.firstChild), 189 this.modalElement.querySelector(".modal-body").appendChild(this.carouselElement), 190 this.modalElement.addEventListener("hidden.bs.modal", () => this.modalElement.remove()), 191 this.modalElement.querySelector("[data-bs-dismiss]").addEventListener("click", () => this.modal.hide()), 192 (this.modal = new a.Modal(this.modalElement, this.modalOptions)), 193 this.modal 194 ); 195 } 196 randomHash() { 197 let t = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 8; 198 return Array.from({ length: t }, () => Math.floor(36 * Math.random()).toString(36)).join(""); 199 } 200 } 201 (o.allowedEmbedTypes = ["embed", "youtube", "vimeo", "instagram", "url"]), 202 (o.allowedMediaTypes = [...o.allowedEmbedTypes, "image", "html"]), 203 (o.defaultSelector = '[data-toggle="lightbox"]'), 204 (o.initialize = function (t) { 205 t.preventDefault(); 206 new o(this).show(); 207 }), 208 document.querySelectorAll(o.defaultSelector).forEach((t) => t.addEventListener("click", o.initialize)), 209 "undefined" != typeof window && window.bootstrap && (window.bootstrap.Lightbox = o); 210 var i = o; 211 window.Lightbox = e.default; 212})();
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.