@expofp/floorplan
Version:
Interactive floor plan library for expos and events
166 lines (159 loc) • 6.88 kB
JavaScript
(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.20.0" };
var t = new e.Error().stack;
t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "f9925581-0431-473e-b388-d0da4f893085", e._sentryDebugIdIdentifier = "sentry-dbid-f9925581-0431-473e-b388-d0da4f893085");
} catch {}
})();
import { r as e } from "./rolldown-runtime-7-Wh3Cc7.js";
import { o as t, s as n, t as r } from "./floorplan.loader-qT-UiIac.js";
import { $ as i, W as a, _t as o, it as s, l as c, mt as l, nt as u, tt as d, zt as f } from "./i18n-B6dEf7vu.js";
import { o as p, s as m } from "./efp-debug-init-CHsd9_cw.js";
import { r as h } from "./adopt-global-settings-BcaNagH6.js";
import "./settings-D-p69PHO.js";
//#region src/utils/silence-mobx-react-lite-warning.ts
if (typeof console < "u" && typeof console.error == "function") {
let e = console.error.bind(console);
console.error = (...t) => {
typeof t[0] == "string" && t[0].includes("Can't perform a React state update on a component that hasn't mounted yet") || e(...t);
};
}
//#endregion
//#region src/_misc_to_move/initHtmlHead.ts
var g = /* @__PURE__ */ e(m(), 1);
function _() {
if (typeof window > "u" || typeof document > "u") return;
if (!document.querySelector("meta[name=\"viewport\"]")) {
let e = document.createElement("meta");
e.name = "viewport", e.content = "width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no", document.head.appendChild(e);
}
let e = () => !!document.querySelector("link[rel=\"icon\"]");
e() || import("./favicon-Dz0iIR93.js").then(({ default: t }) => {
if (e()) return;
let n = document.createElement("link");
n.rel = "icon", n.type = "image/png", n.href = t, document.head.appendChild(n);
}), (!document.title || document.title === "Document") && (document.title = "Floor Plan by ExpoFP");
}
//#endregion
//#region src/_misc_to_move/logBuildInfo.ts
function v() {
let e = {
version: "3.20.0",
commit: "96f5ec772",
branch: "main",
built: "2026-08-10T14:22:11.035Z"
};
if (e) {
let t = new Date(e.built);
console.info("%c⚡️[efp-runtime]%c v%c%s%c commit=%c%s%c branch=%c%s%c built=%c%s%c (%s)", "color:#2382f4;font-weight:600", "color:inherit", "color:#dcdcaa;font-weight:600", e.version, "color:inherit", "color:#9cdcfe", e.commit, "color:inherit", "color:#ce9178", e.branch, "color:inherit", "color:#b5cea8", e.built, "color:inherit", y(t));
}
}
function y(e) {
let t = (/* @__PURE__ */ new Date()).getTime() - e.getTime(), n = Math.floor(t / (1e3 * 60 * 60 * 24)), r = Math.floor(t / (1e3 * 60 * 60) % 24), i = Math.floor(t / (1e3 * 60) % 60), a = [];
return n > 0 && a.push(`${n} day${n === 1 ? "" : "s"}`), r > 0 && a.push(`${r} hour${r === 1 ? "" : "s"}`), i > 0 && a.push(`${i} minute${i === 1 ? "" : "s"}`), a.length === 0 ? "just now" : a.join(" ") + " ago";
}
//#endregion
//#region src/utils/legacy-storage-keys.ts
function b(e = c ? localStorage : void 0) {
if (!e) return;
e.getItem("___viewer_mode") === "1" && e.getItem("efp-viewerMode") === null && e.setItem(u, "true"), e.getItem("___preview_mode") === "1" && e.getItem("efp-previewMode") === null && e.setItem(i, "true");
let t = e.getItem(a);
t !== null && e.getItem("efp-uiScale") === null && e.setItem(d, t);
}
//#endregion
//#region src/load.ts
var x = (0, g.default)("efp:load");
async function S(e, t = {}) {
var i, a;
_(), v(), (0, g.default)("efp:device").enabled && import("./logDeviceInfo-BAhvfe0n.js").then((e) => e.logDeviceInfo()).catch(() => {});
let o = t.element, c;
if (typeof o == "string") {
let e = document.querySelector(o);
if (!e) throw Error(`Element not found for selector: ${o}`);
c = e;
} else o ? c = o : (c = document.getElementById("floorplan"), c || (c = document.createElement("div"), w(c), document.body.appendChild(c)));
C(), c.setAttribute("data-efp-floorplan-defaults", ""), (i = document.documentElement.style).overscrollBehavior || (i.overscrollBehavior = "none"), (a = document.body.style).overscrollBehavior || (a.overscrollBehavior = "none"), requestAnimationFrame(() => {
c.style.backgroundColor = "#ebebeb";
}), b();
let l;
try {
var u;
if (l = await s(e, t, window.location.search, (u = p()) == null ? void 0 : u), !l.fpSvgJsRef) throw Error("No floor plan drawing: the manifest must set `legacyDataUrlBase` (live event) or `fpSvgJsRef` (offline copy)");
} catch (e) {
let { showEventNotFound: t } = await import("./event-not-found-B7qN6S0M.js");
throw t(c), e;
}
x("config", l), f(l);
let d = new r(t, c), m = window.___fpResolve;
return window.___fp = d, m && (d.ready.then(() => m(d)), delete window.___fpResolve), d.ready.then(() => {
let e = new CustomEvent("expofp:ready", { detail: { floorplan: d } });
window.__expofpReady = e, window.dispatchEvent(e);
}), d.ready.then(() => n(d, l.intents)).catch((e) => x("config intents skipped:", e)), d;
}
function C() {
let e = "efp-floorplan-defaults";
if (document.getElementById(e)) return;
let t = document.createElement("style");
t.id = e, t.textContent = "\n[data-efp-floorplan-defaults] {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n overflow: hidden;\n touch-action: none;\n overscroll-behavior: none;\n background: #fff;\n transition: background-color 2s ease;\n}", document.head.prepend(t);
}
function w(e) {
if (!document.adoptedStyleSheets) return;
let t = "efp-runtime-loader-spinner", n = `
.${t} {
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
opacity: 0;
z-index: 5;
display: flex;
align-items: center;
justify-content: center;
pointer-events: none;
transition: all 1s ease;
}
.${t} > svg {
width: 60px;
transform-origin: center;
animation: ${t}-rotate 2s linear infinite;
}
.${t} > svg > circle {
fill: none;
stroke: var(--color-primary, #2382f4);
stroke-dasharray: 1, 200;
stroke-dashoffset: 0;
stroke-linecap: round;
stroke-width: 2;
animation: ${t}-dash 1.5s ease-in-out infinite;
}
@keyframes ${t}-rotate {
100% {
transform: rotate(360deg);
}
}
@keyframes ${t}-dash {
0% {
stroke-dasharray: 1, 200;
stroke-dashoffset: 0;
}
50% {
stroke-dasharray: 90, 200;
stroke-dashoffset: -35px;
}
100% {
stroke-dashoffset: -125px;
}
}`, r = new CSSStyleSheet();
r.replaceSync(n), document.adoptedStyleSheets = [...document.adoptedStyleSheets, r], e.innerHTML = `<div class="${t}">
<svg viewBox="25 25 50 50">
<circle r="20" cy="50" cx="50"></circle>
</svg>
</div>`, requestAnimationFrame(() => {
let n = e.querySelector(`.${t}`);
n == null || n.style.setProperty("opacity", "1");
});
}
window.addEventListener("error", t), window.__efpStyleElements = [], h(o(l));
//#endregion
export { S as load };