1!(function (t, n) { 2 'object' == typeof exports && 'undefined' != typeof module 3 ? (module.exports = n()) 4 : 'function' == typeof define && define.amd 5 ? define(n) 6 : (t.Macy = n()); 7})(this, function () { 8 'use strict'; 9 function t(t, n) { 10 var e = void 0; 11 return function () { 12 e && clearTimeout(e), (e = setTimeout(t, n)); 13 }; 14 } 15 function n(t, n) { 16 for (var e = t.length, r = e, o = []; e--; ) o.push(n(t[r - e - 1])); 17 return o; 18 } 19 function e(t, n) { 20 var e = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]; 21 if (window.Promise) return A(t, n, e); 22 t.recalculate(!0, !0); 23 } 24 function r(t) { 25 for (var n = t.options, e = t.responsiveOptions, r = t.keys, o = t.docWidth, i = void 0, s = 0; s < r.length; s++) { 26 var a = parseInt(r[s], 10); 27 o >= a && ((i = n.breakAt[a]), O(i, e)); 28 } 29 return e; 30 } 31 function o(t) { 32 for ( 33 var n = t.options, e = t.responsiveOptions, r = t.keys, o = t.docWidth, i = void 0, s = r.length - 1; 34 s >= 0; 35 s-- 36 ) { 37 var a = parseInt(r[s], 10); 38 o <= a && ((i = n.breakAt[a]), O(i, e)); 39 } 40 return e; 41 } 42 function i(t) { 43 var n = t.useContainerForBreakpoints ? t.container.clientWidth : window.innerWidth, 44 e = { columns: t.columns }; 45 b(t.margin) ? (e.margin = { x: t.margin.x, y: t.margin.y }) : (e.margin = { x: t.margin, y: t.margin }); 46 var i = Object.keys(t.breakAt); 47 return t.mobileFirst 48 ? r({ options: t, responsiveOptions: e, keys: i, docWidth: n }) 49 : o({ options: t, responsiveOptions: e, keys: i, docWidth: n }); 50 } 51 function s(t) { 52 return i(t).columns; 53 } 54 function a(t) { 55 return i(t).margin; 56 } 57 function c(t) { 58 var n = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1], 59 e = s(t), 60 r = a(t).x, 61 o = 100 / e; 62 if (!n) return o; 63 if (1 === e) return '100%'; 64 var i = 'px'; 65 if ('string' == typeof r) { 66 var c = parseFloat(r); 67 (i = r.replace(c, '')), (r = c); 68 } 69 return (r = ((e - 1) * r) / e), '%' === i ? o - r + '%' : 'calc(' + o + '% - ' + r + i + ')'; 70 } 71 function u(t, n) { 72 var e = s(t.options), 73 r = 0, 74 o = void 0, 75 i = void 0; 76 if (1 === ++n) return 0; 77 i = a(t.options).x; 78 var u = 'px'; 79 if ('string' == typeof i) { 80 var l = parseFloat(i, 10); 81 (u = i.replace(l, '')), (i = l); 82 } 83 return ( 84 (o = (i - ((e - 1) * i) / e) * (n - 1)), 85 (r += c(t.options, !1) * (n - 1)), 86 '%' === u ? r + o + '%' : 'calc(' + r + '% + ' + o + u + ')' 87 ); 88 } 89 function l(t) { 90 var n = 0, 91 e = t.container, 92 r = t.rows; 93 v(r, function (t) { 94 n = t > n ? t : n; 95 }), 96 (e.style.height = n + 'px'); 97 } 98 function p(t, n) { 99 var e = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], 100 r = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3], 101 o = s(t.options), 102 i = a(t.options).y; 103 M(t, o, e), 104 v(n, function (n) { 105 var e = 0, 106 o = parseInt(n.offsetHeight, 10); 107 isNaN(o) || 108 (t.rows.forEach(function (n, r) { 109 n < t.rows[e] && (e = r); 110 }), 111 (n.style.position = 'absolute'), 112 (n.style.top = t.rows[e] + 'px'), 113 (n.style.left = '' + t.cols[e]), 114 (t.rows[e] += isNaN(o) ? 0 : o + i), 115 r && (n.dataset.macyComplete = 1)); 116 }), 117 r && (t.tmpRows = null),
118 l(t); 119 } 120 function f(t, n) { 121 var e = arguments.length > 2 && void 0 !== arguments[2] && arguments[2], 122 r = !(arguments.length > 3 && void 0 !== arguments[3]) || arguments[3], 123 o = s(t.options), 124 i = a(t.options).y; 125 M(t, o, e), 126 v(n, function (n) { 127 t.lastcol === o && (t.lastcol = 0); 128 var e = C(n, 'height'); 129 (e = parseInt(n.offsetHeight, 10)), 130 isNaN(e) || 131 ((n.style.position = 'absolute'), 132 (n.style.top = t.rows[t.lastcol] + 'px'), 133 (n.style.left = '' + t.cols[t.lastcol]), 134 (t.rows[t.lastcol] += isNaN(e) ? 0 : e + i), 135 (t.lastcol += 1), 136 r && (n.dataset.macyComplete = 1)); 137 }), 138 r && (t.tmpRows = null), 139 l(t); 140 } 141 var h = function t(n, e) { 142 if (!(this instanceof t)) return new t(n, e); 143 if (n && n.nodeName) return n; 144 if (((n = n.replace(/^\s*/, '').replace(/\s*$/, '')), e)) return this.byCss(n, e); 145 for (var r in this.selectors) if (((e = r.split('/')), new RegExp(e[1], e[2]).test(n))) return this.selectors[r](n); 146 return this.byCss(n); 147 }; 148 (h.prototype.byCss = function (t, n) { 149 return (n || document).querySelectorAll(t); 150 }), 151 (h.prototype.selectors = {}), 152 (h.prototype.selectors[/^\.[\w\-]+$/] = function (t) { 153 return document.getElementsByClassName(t.substring(1)); 154 }), 155 (h.prototype.selectors[/^\w+$/] = function (t) { 156 return document.getElementsByTagName(t); 157 }), 158 (h.prototype.selectors[/^\#[\w\-]+$/] = function (t) { 159 return document.getElementById(t.substring(1)); 160 }); 161 var v = function (t, n) { 162 for (var e = t.length, r = e; e--; ) n(t[r - e - 1]); 163 }, 164 m = function () { 165 var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; 166 (this.running = !1), (this.events = []), this.add(t); 167 }; 168 (m.prototype.run = function () { 169 if (!this.running && this.events.length > 0) { 170 var t = this.events.shift(); 171 (this.running = !0), t(), (this.running = !1), this.run(); 172 } 173 }), 174 (m.prototype.add = function () { 175 var t = this, 176 n = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; 177 return ( 178 !!n && 179 (Array.isArray(n) 180 ? v(n, function (n) { 181 return t.add(n); 182 }) 183 : (this.events.push(n), void this.run())) 184 ); 185 }), 186 (m.prototype.clear = function () { 187 this.events = []; 188 }); 189 var d = function (t) { 190 var n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; 191 return (this.instance = t), (this.data = n), this; 192 }, 193 y = function () { 194 var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; 195 (this.events = {}), (this.instance = t); 196 }; 197 (y.prototype.on = function () { 198 var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], 199 n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1]; 200 return !(!t || !n) && (Array.isArray(this.events[t]) || (this.events[t] = []), this.events[t].push(n)); 201 }), 202 (y.prototype.emit = function () { 203 var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], 204 n = arguments.length > 1 && void 0 !== arguments[1] ? arguments[1] : {}; 205 if (!t || !Array.isArray(this.events[t])) return !1; 206 var e = new d(this.instance, n); 207 v(this.events[t], function (t) { 208 return t(e); 209 }); 210 }); 211 var g = function (t) { 212 return !('naturalHeight' in t && t.naturalHeight + t.naturalWidth === 0) || t.width + t.height !== 0; 213 }, 214 E = function (t, n) { 215 var e = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]; 216 return new Promise(function (t, e) { 217 if (n.complete) return g(n) ? t(n) : e(n); 218 n.addEventListener('load', function () { 219 return g(n) ? t(n) : e(n); 220 }), 221 n.addEventListener('error', function () { 222 return e(n); 223 }); 224 }) 225 .then(function (n) { 226 e && t.emit(t.constants.EVENT_IMAGE_LOAD, { img: n }); 227 }) 228 .catch(function (n) { 229 return t.emit(t.constants.EVENT_IMAGE_ERROR, { img: n }); 230 }); 231 }, 232 w = function (t, e) { 233 var r = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]; 234 return n(e, function (n) { 235 return E(t, n, r); 236 }); 237 }, 238 A = function (t, n) { 239 var e = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]; 240 return Promise.all(w(t, n, e)).then(function () { 241 t.emit(t.constants.EVENT_IMAGE_COMPLETE); 242 }); 243 }, 244 I = function (n) { 245 return t(function () { 246 n.emit(n.constants.EVENT_RESIZE), 247 n.queue.add(function () { 248 return n.recalculate(!0, !0); 249 }); 250 }, 100); 251 }, 252 N = function (t) { 253 if (((t.container = h(t.options.container)), t.container instanceof h || !t.container)) 254 return !!t.options.debug && console.error('Error: Container not found'); 255 t.container.length && (t.container = t.container[0]), 256 (t.options.container = t.container), 257 (t.container.style.position = 'relative'); 258 }, 259 T = function (t) { 260 (t.queue = new m()), (t.events = new y(t)), (t.rows = []), (t.resizer = I(t)); 261 }, 262 L = function (t) { 263 var n = h('img', t.container); 264 window.addEventListener('resize', t.resizer), 265 t.on(t.constants.EVENT_IMAGE_LOAD, function () { 266 return t.recalculate(!1, !1); 267 }), 268 t.on(t.constants.EVENT_IMAGE_COMPLETE, function () { 269 return t.recalculate(!0, !0); 270 }), 271 t.options.useOwnImageLoader || e(t, n, !t.options.waitForImages), 272 t.emit(t.constants.EVENT_INITIALIZED); 273 }, 274 _ = function (t) { 275 N(t), T(t), L(t); 276 }, 277 b = function (t) { 278 return t === Object(t) && '[object Array]' !== Object.prototype.toString.call(t); 279 }, 280 O = function (t, n) { 281 b(t) || (n.columns = t), 282 b(t) && t.columns && (n.columns = t.columns), 283 b(t) && t.margin && !b(t.margin) && (n.margin = { x: t.margin, y: t.margin }), 284 b(t) && t.margin && b(t.margin) && t.margin.x && (n.margin.x = t.margin.x), 285 b(t) && t.margin && b(t.margin) && t.margin.y && (n.margin.y = t.margin.y); 286 }, 287 C = function (t, n) { 288 return window.getComputedStyle(t, null).getPropertyValue(n); 289 }, 290 M = function (t, n) { 291 var e = arguments.length > 2 && void 0 !== arguments[2] && arguments[2]; 292 if ((t.lastcol || (t.lastcol = 0), t.rows.length < 1 && (e = !0), e)) { 293 (t.rows = []), (t.cols = []), (t.lastcol = 0); 294 for (var r = n - 1; r >= 0; r--) (t.rows[r] = 0), (t.cols[r] = u(t, r)); 295 } else if (t.tmpRows) { 296 t.rows = []; 297 for (var r = n - 1; r >= 0; r--) t.rows[r] = t.tmpRows[r]; 298 } else { 299 t.tmpRows = []; 300 for (var r = n - 1; r >= 0; r--) t.tmpRows[r] = t.rows[r]; 301 } 302 }, 303 V = function (t) { 304 var n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], 305 e = !(arguments.length > 2 && void 0 !== arguments[2]) || arguments[2], 306 r = n ? t.container.children : h(':scope > *:not([data-macy-complete="1"])', t.container); 307 r = Array.from(r).filter(function (t) { 308 return null !== t.offsetParent; 309 }); 310 var o = c(t.options); 311 return ( 312 v(r, function (t) { 313 n && (t.dataset.macyComplete = 0), (t.style.width = o); 314 }), 315 t.options.trueOrder 316 ? (f(t, r, n, e), t.emit(t.constants.EVENT_RECALCULATED)) 317 : (p(t, r, n, e), t.emit(t.constants.EVENT_RECALCULATED)) 318 ); 319 }, 320 R = function () { 321 return !!window.Promise; 322 }, 323 x = 324 Object.assign || 325 function (t) { 326 for (var n = 1; n < arguments.length; n++) { 327 var e = arguments[n]; 328 for (var r in e) Object.prototype.hasOwnProperty.call(e, r) && (t[r] = e[r]); 329 } 330 return t; 331 }; 332 Array.from || 333 (Array.from = function (t) { 334 for (var n = 0, e = []; n < t.length; ) e.push(t[n++]); 335 return e; 336 }); 337 var k = { 338 columns: 4, 339 margin: 2, 340 trueOrder: !1, 341 waitForImages: !1, 342 useImageLoader: !0, 343 breakAt: {}, 344 useOwnImageLoader: !1, 345 onInit: !1, 346 cancelLegacy: !1, 347 useContainerForBreakpoints: !1, 348 }; 349 !(function () { 350 try { 351 document.createElement('a').querySelector(':scope *'); 352 } catch (t) { 353 !(function () { 354 function t(t) { 355 return function (e) { 356 if (e && n.test(e)) { 357 var r = this.getAttribute('id'); 358 r || (this.id = 'q' + Math.floor(9e6 * Math.random()) + 1e6), 359 (arguments[0] = e.replace(n, '#' + this.id)); 360 var o = t.apply(this, arguments); 361 return null === r ? this.removeAttribute('id') : r || (this.id = r), o; 362 } 363 return t.apply(this, arguments); 364 }; 365 } 366 var n = /:scope\b/gi, 367 e = t(Element.prototype.querySelector); 368 Element.prototype.querySelector = function (t) { 369 return e.apply(this, arguments); 370 }; 371 var r = t(Element.prototype.querySelectorAll); 372 Element.prototype.querySelectorAll = function (t) { 373 return r.apply(this, arguments); 374 }; 375 })(); 376 } 377 })(); 378 var q = function t() { 379 var n = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : k; 380 if (!(this instanceof t)) return new t(n); 381 (this.options = {}), x(this.options, k, n), (this.options.cancelLegacy && !R()) || _(this); 382 }; 383 return ( 384 (q.init = function (t) { 385 return ( 386 console.warn( 387 'Depreciated: Macy.init will be removed in v3.0.0 opt to use Macy directly like so Macy({ /*options here*/ }) ' 388 ), 389 new q(t) 390 ); 391 }), 392 (q.prototype.recalculateOnImageLoad = function () { 393 var t = arguments.length > 0 && void 0 !== arguments[0] && arguments[0]; 394 return e(this, h('img', this.container), !t); 395 }), 396 (q.prototype.runOnImageLoad = function (t) { 397 var n = arguments.length > 1 && void 0 !== arguments[1] && arguments[1], 398 r = h('img', this.container); 399 return ( 400 this.on(this.constants.EVENT_IMAGE_COMPLETE, t), n && this.on(this.constants.EVENT_IMAGE_LOAD, t), e(this, r, n) 401 ); 402 }), 403 (q.prototype.recalculate = function () { 404 var t = this, 405 n = arguments.length > 0 && void 0 !== arguments[0] && arguments[0], 406 e = !(arguments.length > 1 && void 0 !== arguments[1]) || arguments[1]; 407 return ( 408 e && this.queue.clear(), 409 this.queue.add(function () { 410 return V(t, n, e); 411 }) 412 ); 413 }), 414 (q.prototype.remove = function () { 415 window.removeEventListener('resize', this.resizer), 416 v(this.container.children, function (t) { 417 t.removeAttribute('data-macy-complete'), t.removeAttribute('style'); 418 }), 419 this.container.removeAttribute('style'); 420 }), 421 (q.prototype.reInit = function () { 422 this.recalculate(!0, !0),
423 this.emit(this.constants.EVENT_INITIALIZED), 424 window.addEventListener('resize', this.resizer), 425 (this.container.style.position = 'relative'); 426 }), 427 (q.prototype.on = function (t, n) { 428 this.events.on(t, n); 429 }), 430 (q.prototype.emit = function (t, n) { 431 this.events.emit(t, n); 432 }), 433 (q.constants = { 434 EVENT_INITIALIZED: 'macy.initialized', 435 EVENT_RECALCULATED: 'macy.recalculated', 436 EVENT_IMAGE_LOAD: 'macy.image.load', 437 EVENT_IMAGE_ERROR: 'macy.image.error', 438 EVENT_IMAGE_COMPLETE: 'macy.images.complete', 439 EVENT_RESIZE: 'macy.resize', 440 }), 441 (q.prototype.constants = q.constants), 442 q 443 ); 444});
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.