UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

289 lines (288 loc) • 11.4 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.47.0" }; var t = new e.Error().stack; t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "1361d190-f333-4472-9de5-fd2db994fa07", e._sentryDebugIdIdentifier = "sentry-dbid-1361d190-f333-4472-9de5-fd2db994fa07"); } catch {} })(); import { r as e, t } from "./rolldown-runtime-5rOLGCTp.js"; import { h as n, l as r } from "./i18n-DlquqKCP.js"; import { a as i, o as a } from "./is-debug-IkNSAGo8.js"; import { i as o, u as s } from "./mobx.module-BTnTbXnp.js"; import { t as c } from "./loadImage-iqS2KHgN.js"; import { h as l } from "./UIState-Dd6fvko0.js"; import { I as u, Jt as d, M as f, N as p, in as m, j as h } from "./LayerStore-DCg-juRT.js"; import { t as g } from "./kiosk-mode-zD8K_fUT.js"; //#region src/utils/detectLimitedModeViaImage.ts var _ = l(), v = `${n}expofp-overlay.png`; async function y(e = v) { try { let t = await c(e), n = document.createElement("canvas"); n.width = 1, n.height = 1; let r = n.getContext("2d"); if (!r) return !0; try { return r.drawImage(t, 0, 0, 1, 1), r.getImageData(0, 0, 1, 1), !1; } catch { return !0; } } catch { return typeof location < "u" && location.protocol === "file:"; } } //#endregion //#region src/utils/lz-utils.ts var b = /* @__PURE__ */ e((/* @__PURE__ */ t(((e, t) => { var n = (function() { var e = String.fromCharCode, t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=", n = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+-$", r = {}; function i(e, t) { if (!r[e]) { r[e] = {}; for (var n = 0; n < e.length; n++) r[e][e.charAt(n)] = n; } return r[e][t]; } var a = { compressToBase64: function(e) { if (e == null) return ""; var n = a._compress(e, 6, function(e) { return t.charAt(e); }); switch (n.length % 4) { default: case 0: return n; case 1: return n + "==="; case 2: return n + "=="; case 3: return n + "="; } }, decompressFromBase64: function(e) { return e == null ? "" : e == "" ? null : a._decompress(e.length, 32, function(n) { return i(t, e.charAt(n)); }); }, compressToUTF16: function(t) { return t == null ? "" : a._compress(t, 15, function(t) { return e(t + 32); }) + " "; }, decompressFromUTF16: function(e) { return e == null ? "" : e == "" ? null : a._decompress(e.length, 16384, function(t) { return e.charCodeAt(t) - 32; }); }, compressToUint8Array: function(e) { for (var t = a.compress(e), n = new Uint8Array(t.length * 2), r = 0, i = t.length; r < i; r++) { var o = t.charCodeAt(r); n[r * 2] = o >>> 8, n[r * 2 + 1] = o % 256; } return n; }, decompressFromUint8Array: function(t) { if (t == null) return a.decompress(t); for (var n = Array(t.length / 2), r = 0, i = n.length; r < i; r++) n[r] = t[r * 2] * 256 + t[r * 2 + 1]; var o = []; return n.forEach(function(t) { o.push(e(t)); }), a.decompress(o.join("")); }, compressToEncodedURIComponent: function(e) { return e == null ? "" : a._compress(e, 6, function(e) { return n.charAt(e); }); }, decompressFromEncodedURIComponent: function(e) { return e == null ? "" : e == "" ? null : (e = e.replace(/ /g, "+"), a._decompress(e.length, 32, function(t) { return i(n, e.charAt(t)); })); }, compress: function(t) { return a._compress(t, 16, function(t) { return e(t); }); }, _compress: function(e, t, n) { if (e == null) return ""; var r, i, a = {}, o = {}, s = "", c = "", l = "", u = 2, d = 3, f = 2, p = [], m = 0, h = 0, g; for (g = 0; g < e.length; g += 1) if (s = e.charAt(g), Object.prototype.hasOwnProperty.call(a, s) || (a[s] = d++, o[s] = !0), c = l + s, Object.prototype.hasOwnProperty.call(a, c)) l = c; else { if (Object.prototype.hasOwnProperty.call(o, l)) { if (l.charCodeAt(0) < 256) { for (r = 0; r < f; r++) m <<= 1, h == t - 1 ? (h = 0, p.push(n(m)), m = 0) : h++; for (i = l.charCodeAt(0), r = 0; r < 8; r++) m = m << 1 | i & 1, h == t - 1 ? (h = 0, p.push(n(m)), m = 0) : h++, i >>= 1; } else { for (i = 1, r = 0; r < f; r++) m = m << 1 | i, h == t - 1 ? (h = 0, p.push(n(m)), m = 0) : h++, i = 0; for (i = l.charCodeAt(0), r = 0; r < 16; r++) m = m << 1 | i & 1, h == t - 1 ? (h = 0, p.push(n(m)), m = 0) : h++, i >>= 1; } u--, u == 0 && (u = 2 ** f, f++), delete o[l]; } else for (i = a[l], r = 0; r < f; r++) m = m << 1 | i & 1, h == t - 1 ? (h = 0, p.push(n(m)), m = 0) : h++, i >>= 1; u--, u == 0 && (u = 2 ** f, f++), a[c] = d++, l = String(s); } if (l !== "") { if (Object.prototype.hasOwnProperty.call(o, l)) { if (l.charCodeAt(0) < 256) { for (r = 0; r < f; r++) m <<= 1, h == t - 1 ? (h = 0, p.push(n(m)), m = 0) : h++; for (i = l.charCodeAt(0), r = 0; r < 8; r++) m = m << 1 | i & 1, h == t - 1 ? (h = 0, p.push(n(m)), m = 0) : h++, i >>= 1; } else { for (i = 1, r = 0; r < f; r++) m = m << 1 | i, h == t - 1 ? (h = 0, p.push(n(m)), m = 0) : h++, i = 0; for (i = l.charCodeAt(0), r = 0; r < 16; r++) m = m << 1 | i & 1, h == t - 1 ? (h = 0, p.push(n(m)), m = 0) : h++, i >>= 1; } u--, u == 0 && (u = 2 ** f, f++), delete o[l]; } else for (i = a[l], r = 0; r < f; r++) m = m << 1 | i & 1, h == t - 1 ? (h = 0, p.push(n(m)), m = 0) : h++, i >>= 1; u--, u == 0 && (u = 2 ** f, f++); } for (i = 2, r = 0; r < f; r++) m = m << 1 | i & 1, h == t - 1 ? (h = 0, p.push(n(m)), m = 0) : h++, i >>= 1; for (;;) if (m <<= 1, h == t - 1) { p.push(n(m)); break; } else h++; return p.join(""); }, decompress: function(e) { return e == null ? "" : e == "" ? null : a._decompress(e.length, 32768, function(t) { return e.charCodeAt(t); }); }, _decompress: function(t, n, r) { var i = [], a = 4, o = 4, s = 3, c = "", l = [], u, d, f, p, m, h, g, _ = { val: r(0), position: n, index: 1 }; for (u = 0; u < 3; u += 1) i[u] = u; for (f = 0, m = 2 ** 2, h = 1; h != m;) p = _.val & _.position, _.position >>= 1, _.position == 0 && (_.position = n, _.val = r(_.index++)), f |= +(p > 0) * h, h <<= 1; switch (f) { case 0: for (f = 0, m = 2 ** 8, h = 1; h != m;) p = _.val & _.position, _.position >>= 1, _.position == 0 && (_.position = n, _.val = r(_.index++)), f |= +(p > 0) * h, h <<= 1; g = e(f); break; case 1: for (f = 0, m = 2 ** 16, h = 1; h != m;) p = _.val & _.position, _.position >>= 1, _.position == 0 && (_.position = n, _.val = r(_.index++)), f |= +(p > 0) * h, h <<= 1; g = e(f); break; case 2: return ""; } for (i[3] = g, d = g, l.push(g);;) { if (_.index > t) return ""; for (f = 0, m = 2 ** s, h = 1; h != m;) p = _.val & _.position, _.position >>= 1, _.position == 0 && (_.position = n, _.val = r(_.index++)), f |= +(p > 0) * h, h <<= 1; switch (g = f) { case 0: for (f = 0, m = 2 ** 8, h = 1; h != m;) p = _.val & _.position, _.position >>= 1, _.position == 0 && (_.position = n, _.val = r(_.index++)), f |= +(p > 0) * h, h <<= 1; i[o++] = e(f), g = o - 1, a--; break; case 1: for (f = 0, m = 2 ** 16, h = 1; h != m;) p = _.val & _.position, _.position >>= 1, _.position == 0 && (_.position = n, _.val = r(_.index++)), f |= +(p > 0) * h, h <<= 1; i[o++] = e(f), g = o - 1, a--; break; case 2: return l.join(""); } if (a == 0 && (a = 2 ** s, s++), i[g]) c = i[g]; else if (g === o) c = d + d.charAt(0); else return null; l.push(c), i[o++] = d + c.charAt(0), a--, d = c, a == 0 && (a = 2 ** s, s++); } } }; return a; })(); typeof define == "function" && define.amd ? define(function() { return n; }) : t !== void 0 && t != null ? t.exports = n : typeof angular < "u" && angular != null && angular.module("LZString", []).factory("LZString", function() { return n; }); })))(), 1); function x(e) { let t = b.default.compressToUint8Array(e); return btoa(String.fromCharCode(...t)).replace(/\+/g, "-").replace(/\//g, "_").replace(/=/g, "."); } function S(e) { return e = e.replace(/-/g, "+").replace(/_/g, "/").replace(/\./g, "="), b.default.decompressFromBase64(e); } var C = { compress: x, decompress: S }; //#endregion //#region src/utils/preview-exhibitor.ts function w() { let e = new URL(window.location.href).searchParams, t = e.get("__data"); if (t) return JSON.parse(t).exhibitors[0]; let n = e.get("__lzdata"); return n ? JSON.parse(C.decompress(n)).exhibitors[0] : null; } //#endregion //#region src/store/init/init-ui.ts var T = null; function E(e) { let t = window.__efpElement; if (!t) return; let { uiState: n } = e; n.rootElement = t; let r = (e, t) => s("uiState.screenSize", () => { n.screenSize = new m(e, t); }); r(t.clientWidth, t.clientHeight), T == null || T.disconnect(), T = new _.ResizeObserver((e) => { e.forEach((e) => { r(e.contentRect.width, e.contentRect.height); }); }), T.observe(t); } function D(e) { let { uiState: t, exhibitorStore: n } = e; E(e), i(O); let s = w(); if (s) { let e = n.exhibitorById.get(s.id); e && (t.previewExhibitor = e); } let c = typeof matchMedia < "u" ? matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`) : null; if (c && c.addEventListener) { let e = () => { t.devicePixelRatio = window.devicePixelRatio; }; c.addEventListener("change", e), i(() => c.removeEventListener("change", e)); } let l = s || !u ? "full" : "medium"; d.isRebooking && t.list.type === "search" && !t.list.text && e.selectExhibitors(), t.desiredOverlaySize = l, h(() => { (t.searchFocused || t.menu) && t.overlayPosition !== "left" && (t.desiredOverlaySize = "full"); }), h(() => { t.overlaySize !== "full" && t.menu && (t.menu = !1); }), p(() => t.wsStarted || !t.wsShown, () => { t.wsStarted = !0; }), t.kiosk = r && localStorage.getItem("kiosk") === "1", window.__resett = v; function m() { e.reset(); } let _; i(() => clearTimeout(_)); function v() { !t.kiosk || t.setKioskModeEnabled || (a.log("zzz2", "reset timer"), clearTimeout(_), _ = setTimeout(m, 3e4), t.inIdle = !1); } if (h(() => { let e = t.list; e.type === "search" && (e.text === "kiosk=1" ? g(t, !0) : e.text === "kiosk=0" && g(t, !1)); }), f(() => [t.kiosk, t.setKioskModeEnabled], ([e, t]) => { e && !t ? v() : clearTimeout(_); }, { equals: o.structural }), r) { var y; t.setVisibility(JSON.parse((y = localStorage.getItem("___visibility")) == null ? "null" : y) || {}); } k(e); } function O() { T && (T.disconnect(), T = null); } async function k(e) { try { if (!await y()) return; e.uiState.setGlobalErrorMessage({ title: "Unsupported Environment Detected", body: "This application requires a proper server environment to function correctly.\n For full functionality, please ensure the application is served through an HTTP/HTTPS server.\n Some features may not work as expected in the current setup." }); } catch (e) { console.error(e); } } //#endregion export { D as n, w as r, E as t };