UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

134 lines (133 loc) 8.84 kB
(function() { try { var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {}; e.SENTRY_RELEASE = { id: "3.7.8" }; var t = new e.Error().stack; t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "22529f3a-43f5-40e1-b007-51e8c4daf2a8", e._sentryDebugIdIdentifier = "sentry-dbid-22529f3a-43f5-40e1-b007-51e8c4daf2a8"); } catch {} })(); import { t as e } from "./rolldown-runtime-YBAZwyzS.js"; //#region ../../node_modules/.pnpm/particlesjs@https+++codeload.github.com+evgenyt1+particles.js+tar.gz+bcda28ac7422659d702713184cf1171b1673c248/node_modules/particlesjs/dist/particles.min.js var t = /* @__PURE__ */ e(((e, t) => { var n = function(e, t) { var n, r = {}; function i(e, t) { return e.x < t.x ? -1 : e.x > t.x ? 1 : e.y < t.y ? -1 : +(e.y > t.y); } return (n = function() { var e = this; e.defaults = { responsive: null, selector: null, maxParticles: 100, sizeVariations: 3, showParticles: !0, speed: .5, color: "#000000", minDistance: 120, connectParticles: !1 }, e.element = null, e.context = null, e.ratio = null, e.breakpoints = [], e.activeBreakpoint = null, e.breakpointSettings = [], e.originalSettings = null, e.storage = [], e.usingPolyfill = !1; }).prototype.init = function(e) { var t = this; return t.options = t._extend(t.defaults, e), t.originalSettings = t.options, t._animate = t._animate.bind(t), t._initializeCanvas(), t._initializeEvents(), t._registerBreakpoints(), t._checkResponsive(), t._initializeStorage(), t._animate(), t; }, n.prototype.destroy = function() { var t = this; t.storage = [], t.element.remove(), e.removeEventListener("resize", t.listener, !1), e.clearTimeout(t._animation), cancelAnimationFrame(t._animation); }, n.prototype._initializeCanvas = function() { var n, r, i = this; if (!i.options.selector) return console.warn("particles.js: No selector specified! Check https://github.com/marcbruederlin/particles.js#options"), !1; i.element = i.options.selector.tagName ? i.options.selector : t.querySelector(i.options.selector), i.context = i.element.getContext("2d"), n = e.devicePixelRatio || 1, r = i.context.webkitBackingStorePixelRatio || i.context.mozBackingStorePixelRatio || i.context.msBackingStorePixelRatio || i.context.oBackingStorePixelRatio || i.context.backingStorePixelRatio || 1, i.ratio = n / r, i.element.width = i.element.offsetParent ? i.element.offsetParent.clientWidth * i.ratio : i.element.clientWidth * i.ratio, i.element.offsetParent && i.element.offsetParent.nodeName === "BODY" ? i.element.height = e.innerHeight * i.ratio : i.element.height = i.element.offsetParent ? i.element.offsetParent.clientHeight * i.ratio : i.element.clientHeight * i.ratio, i.element.style.width = "100%", i.element.style.height = "100%", i.context.scale(i.ratio, i.ratio); }, n.prototype._initializeEvents = function() { var t = this; t.listener = function() { t._resize(); }.bind(this), e.addEventListener("resize", t.listener, !1); }, n.prototype._initializeStorage = function() { var e = this; e.storage = []; for (var t = e.options.maxParticles; t--;) e.storage.push(new r(e.context, e.options)); }, n.prototype._registerBreakpoints = function() { var e, t, n, r = this, i = r.options.responsive || null; if (typeof i == "object" && i && i.length) { for (e in i) if (n = r.breakpoints.length - 1, t = i[e].breakpoint, i.hasOwnProperty(e)) { for (; 0 <= n;) r.breakpoints[n] && r.breakpoints[n] === t && r.breakpoints.splice(n, 1), n--; r.breakpoints.push(t), r.breakpointSettings[t] = i[e].options; } r.breakpoints.sort(function(e, t) { return t - e; }); } }, n.prototype._checkResponsive = function() { var t, n = this, r = !1, i = e.innerWidth; if (n.options.responsive && n.options.responsive.length && n.options.responsive !== null) { for (t in r = null, n.breakpoints) n.breakpoints.hasOwnProperty(t) && i <= n.breakpoints[t] && (r = n.breakpoints[t]); r === null ? n.activeBreakpoint !== null && (r = n.activeBreakpoint = null, n.options = n._extend(n.options, n.originalSettings)) : (n.activeBreakpoint = r, n.options = n._extend(n.options, n.breakpointSettings[r])); } }, n.prototype._refresh = function() { this._initializeStorage(), this._draw(); }, n.prototype._resize = function() { var t = this; t.element.width = t.element.offsetParent ? t.element.offsetParent.clientWidth * t.ratio : t.element.clientWidth * t.ratio, t.element.offsetParent && t.element.offsetParent.nodeName === "BODY" ? t.element.height = e.innerHeight * t.ratio : t.element.height = t.element.offsetParent ? t.element.offsetParent.clientHeight * t.ratio : t.element.clientHeight * t.ratio, t.context.scale(t.ratio, t.ratio), clearTimeout(t.windowDelay), t.windowDelay = e.setTimeout(function() { t._checkResponsive(), t._refresh(); }, 50); }, n.prototype._animate = function() { var t = this; t._draw(), t._animation = e.requestAnimFrame(t._animate); }, n.prototype.resumeAnimation = function() { this._animation || this._animate(); }, n.prototype.pauseAnimation = function() { var t = this; t._animation && (t.usingPolyfill ? e.clearTimeout(t._animation) : (e.cancelAnimationFrame || e.webkitCancelAnimationFrame || e.mozCancelAnimationFrame)(t._animation), t._animation = null); }, n.prototype._draw = function() { var t = this, n = t.element, r = n.offsetParent ? n.offsetParent.clientWidth : n.clientWidth, a = n.offsetParent ? n.offsetParent.clientHeight : n.clientHeight, o = t.options.showParticles, s = t.storage; n.offsetParent && n.offsetParent.nodeName === "BODY" && (a = e.innerHeight), t.context.clearRect(0, 0, n.width, n.height), t.context.beginPath(); for (var c = s.length; c--;) { var l = s[c]; o && l._draw(), l._updateCoordinates(r, a); } t.options.connectParticles && (s.sort(i), t._updateEdges()); }, n.prototype._updateEdges = function() { for (var e = this, t = e.options.minDistance, n = Math.sqrt, r = Math.abs, i = e.storage, a = i.length, o = 0; o < a; o++) for (var s = i[o], c = o + 1; c < a; c++) { var l, u = i[c], d = s.x - u.x, f = s.y - u.y; if (l = n(d * d + f * f), r(d) > t) break; l <= t && e._drawEdge(s, u, 1.2 - l / t); } }, n.prototype._drawEdge = function(e, t, n) { var r = this, i = r.context.createLinearGradient(e.x, e.y, t.x, t.y), a = this._hex2rgb(e.color), o = this._hex2rgb(t.color); i.addColorStop(0, "rgba(" + a.r + "," + a.g + "," + a.b + "," + n + ")"), i.addColorStop(1, "rgba(" + o.r + "," + o.g + "," + o.b + "," + n + ")"), r.context.beginPath(), r.context.strokeStyle = i, r.context.moveTo(e.x, e.y), r.context.lineTo(t.x, t.y), r.context.stroke(), r.context.fill(), r.context.closePath(); }, n.prototype._extend = function(e, t) { return Object.keys(t).forEach(function(n) { e[n] = t[n]; }), e; }, n.prototype._hex2rgb = function(e) { var t = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e); return t ? { r: parseInt(t[1], 16), g: parseInt(t[2], 16), b: parseInt(t[3], 16) } : null; }, (r = function(n, r) { var i = this, a = Math.random, o = r.speed, s = r.color instanceof Array ? r.color[Math.floor(Math.random() * r.color.length)] : r.color; i.context = n; var c = (i.options = r).selector.tagName ? r.selector : t.querySelector(r.selector); i.x = c.offsetParent ? a() * c.offsetParent.clientWidth : a() * c.clientWidth, c.offsetParent && c.offsetParent.nodeName === "BODY" ? i.y = a() * e.innerHeight : i.y = c.offsetParent ? a() * c.offsetParent.clientHeight : a() * c.clientHeight, i.vx = a() * o * 2 - o, i.vy = a() * o * 2 - o, i.radius = a() * a() * r.sizeVariations, i.color = s, i._draw(); }).prototype._draw = function() { var e = this; e.context.save(), e.context.translate(e.x, e.y), e.context.moveTo(0, 0), e.context.beginPath(), e.context.arc(0, 0, e.radius, 0, 2 * Math.PI, !1), e.context.fillStyle = e.color, e.context.fill(), e.context.restore(); }, r.prototype._updateCoordinates = function(e, t) { var n = this, r = n.x + this.vx, i = n.y + this.vy, a = n.radius; e < r + a ? r = a : r - a < 0 && (r = e - a), t < i + a ? i = a : i - a < 0 && (i = t - a), n.x = r, n.y = i; }, e.requestAnimFrame = function() { return e.requestAnimationFrame || e.webkitRequestAnimationFrame || e.mozRequestAnimationFrame || (this._usingPolyfill = !0, function(t) { return e.setTimeout(t, 1e3 / 60); }); }(), new n(); }(window, document); (function() { typeof define == "function" && define.amd ? define("Particles", function() { return n; }) : t !== void 0 && t.exports ? t.exports = n : window.Particles = n; })(); })); //#endregion export default t();