UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

171 lines (164 loc) • 7.24 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.39.1" }; var t = new e.Error().stack; t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "5c6de1a7-ca70-4663-ae99-241dda11bb8a", e._sentryDebugIdIdentifier = "sentry-dbid-5c6de1a7-ca70-4663-ae99-241dda11bb8a"); } catch {} })(); import { r as e } from "./rolldown-runtime-BOCG9HEF.js"; import { c as t, l as n, o as r, s as i, t as a } from "./floorplan.loader-DNLxyDic.js"; import { G as o, Vt as s, at as c, et as l, gt as u, l as d, nt as f, rt as p, yt as m } from "./i18n-BVE2kS7w.js"; import { o as h, s as g } from "./efp-debug-init-DfQX41Dz.js"; import { r as _ } from "./adopt-global-settings-BscL85ma.js"; import "./settings-BEwEIUKe.js"; import { n as v, t as y } from "./is-own-domain-B64uVROp.js"; import { n as b, t as x } from "./event-head-BXpNerID.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 S = /* @__PURE__ */ e(g(), 1); function C() { 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-DNdj7aFi.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); }), y && (!document.title || document.title === "Document") && (document.title = i(window.location.hostname, v)); } //#endregion //#region src/_misc_to_move/logBuildInfo.ts function w() { let e = { version: "3.39.1", commit: "f08d5d8e6", branch: "main", built: "2026-09-24T20:25:55.298Z" }; 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", T(t)); } } function T(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 E(e = d ? localStorage : void 0) { if (!e) return; e.getItem("___viewer_mode") === "1" && e.getItem("efp-viewerMode") === null && e.setItem(p, "true"), e.getItem("___preview_mode") === "1" && e.getItem("efp-previewMode") === null && e.setItem(l, "true"); let t = e.getItem(o); t !== null && e.getItem("efp-uiScale") === null && e.setItem(f, t); } //#endregion //#region src/load.ts var D = (0, S.default)("efp:load"); async function O(e, t = {}) { var i, o; C(), w(), (0, S.default)("efp:device").enabled && import("./logDeviceInfo-DLgu-6-l.js").then((e) => e.logDeviceInfo()).catch(() => {}); let l = t.element, u; if (typeof l == "string") { let e = document.querySelector(l); if (!e) throw Error(`Element not found for selector: ${l}`); u = e; } else l ? u = l : (u = document.getElementById("floorplan"), u || (u = document.createElement("div"), A(u), document.body.appendChild(u))); k(), u.setAttribute("data-efp-floorplan-defaults", ""), (i = document.documentElement.style).overscrollBehavior || (i.overscrollBehavior = "none"), (o = document.body.style).overscrollBehavior || (o.overscrollBehavior = "none"), requestAnimationFrame(() => { u.style.backgroundColor = "#ebebeb"; }), E(); let d; try { var f; if (d = await c(e, t, window.location.search, (f = h()) == null ? void 0 : f), !d.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-Bx82hQuX.js"); throw t(u), e; } if (D("config", d), s(d), y) { let e = r(d, v); e && (document.title = e), x(document, b(d), `${window.location.origin}/`); } let p = new a(t, u), m = window.___fpResolve; return window.___fp = p, m && (p.ready.then(() => m(p)).catch((e) => D("placeholder resolve skipped:", e)), delete window.___fpResolve), p.ready.then(() => { let e = new CustomEvent("expofp:ready", { detail: { floorplan: p } }); window.__expofpReady = e, window.dispatchEvent(e); }).catch((e) => D("ready event skipped:", e)), p.ready.then(() => n(p, d.intents)).catch((e) => D("config intents skipped:", e)), p; } function k() { 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 A(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 = [], _(m(u)); //#endregion export { O as load };