UNPKG

@expofp/floorplan

Version:

Interactive floor plan library for expos and events

1,318 lines (1,317 loc) 43.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.20.0" }; var t = new e.Error().stack; t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "a792c128-b517-473f-83bc-196dc1e04188", e._sentryDebugIdIdentifier = "sentry-dbid-a792c128-b517-473f-83bc-196dc1e04188"); } catch {} })(); import { r as e } from "./rolldown-runtime-7-Wh3Cc7.js"; import { a as t, i as n, n as r, o as i, r as a, s as o, t as s } from "./floorplan.loader-qT-UiIac.js"; import { $ as c, At as l, C as u, Ct as d, Dt as f, Et as ee, Ft as te, G as ne, H as re, It as p, Lt as m, Mt as ie, Nt as ae, Ot as oe, Pt as se, Rt as h, St as ce, Tt as le, U as ue, V as de, at as fe, bt as pe, dt as me, f as he, gt as ge, ht as _e, jt as ve, kt as ye, l as g, n as be, nt as xe, o as Se, ot as Ce, pt as _, r as we, ut as Te, v as Ee, vt as De, wt as Oe, xt as ke, y as Ae, yt as je } from "./i18n-B6dEf7vu.js"; import { s as Me } from "./efp-debug-init-CHsd9_cw.js"; import { t as Ne } from "./react-lDheuaid.js"; import { t as Pe } from "./jsx-runtime-BRhWrtmW.js"; import { r as v } from "./loadImage-DidrxJwE.js"; import { C as y, D as Fe, Q as Ie, ht as b, i as Le, n as Re, w as ze } from "./exports-BScyxu3S.js"; import { t as Be } from "./client-Dj9OWVha.js"; import { C as x, F as S, H as C, K as w, M as Ve, P as He, S as T, V as Ue, W as We, X as Ge, Z as Ke, Zt as E, at as qe, b as Je, c as D, cn as O, ct as Ye, dt as Xe, en as Ze, fn as k, ft as Qe, g as $e, it as A, lt as j, ot as et, q as tt, s as M, st as nt, x as rt, y as it, yn as at, z as N } from "./store-Dh-bVjb-.js"; import { n as ot, t as st } from "./integrateKiosk-Cd0gOtb9.js"; import { n as ct, t as lt } from "./components-dk3NcsBa.js"; //#region ../../node_modules/.pnpm/@sentry+browser@10.69.0/node_modules/@sentry/browser/build/npm/esm/prod/report-dialog.js function ut(e = {}) { let r = n.document, i = (r == null ? void 0 : r.head) || (r == null ? void 0 : r.body); if (!i) { a && b.error("[showReportDialog] Global document not defined"); return; } let o = ze(), s = y(), c = s == null ? void 0 : s.getDsn(); if (!c) { a && b.error("[showReportDialog] DSN not configured"); return; } let l = { ...e, user: { ...o.getUser(), ...e.user }, eventId: e.eventId || Le() }, u = n.document.createElement("script"); u.async = !0, u.crossOrigin = "anonymous", u.src = t(c, l); let { onLoad: d, onClose: f } = l; if (d && (u.onload = d), f) { let e = (t) => { if (t.data === "__sentry_reportdialog_closed__") try { f(); } finally { n.removeEventListener("message", e); } }; n.addEventListener("message", e); } i.appendChild(u); } //#endregion //#region ../../node_modules/.pnpm/@sentry+react@10.69.0_react@19.2.8/node_modules/@sentry/react/build/esm/error.js var P = /* @__PURE__ */ e(Ne()); function dt(e) { let t = e.match(/^([^.]+)/); return t !== null && parseInt(t[0]) >= 17; } function ft(e, t) { let n = /* @__PURE__ */ new WeakSet(); function r(e, t) { if (!n.has(e)) { if (e.cause) return n.add(e), r(e.cause, t); e.cause = t; } } r(e, t); } function pt(e, { componentStack: t }, n) { if (dt(P.version) && Ie(e) && t) { let n = Error(e.message); n.name = `React ErrorBoundary ${e.name}`, n.stack = t, ft(e, n); } return Re(e, n); } //#endregion //#region ../../node_modules/.pnpm/@sentry+react@10.69.0_react@19.2.8/node_modules/@sentry/react/build/esm/debug-build.js var mt = typeof __SENTRY_DEBUG__ > "u" || __SENTRY_DEBUG__, F = { componentStack: null, error: null, eventId: null }, ht = class extends P.Component { constructor(e) { super(e), this.state = F, this._openFallbackReportDialog = !0; let t = y(); t && e.showDialog && (this._openFallbackReportDialog = !1, this._cleanupHook = t.on("afterSendEvent", (t) => { !t.type && this._lastEventId && t.event_id === this._lastEventId && ut({ ...e.dialogOptions, eventId: this._lastEventId }); })); } componentDidCatch(e, t) { let { componentStack: n } = t, { beforeCapture: r, onError: i, showDialog: a, dialogOptions: o } = this.props; Fe((s) => { r && r(s, e, n); let c = pt(e, t, { mechanism: { handled: this.props.handled == null ? !!this.props.fallback : this.props.handled, type: "auto.function.react.error_boundary" } }); i && i(e, n, c), a && (this._lastEventId = c, this._openFallbackReportDialog && ut({ ...o, eventId: c })), this.setState({ error: e, componentStack: n, eventId: c }); }); } componentDidMount() { let { onMount: e } = this.props; e && e(); } componentWillUnmount() { let { error: e, componentStack: t, eventId: n } = this.state, { onUnmount: r } = this.props; r && (this.state === F ? r(null, null, null) : r(e, t, n)), this._cleanupHook && (this._cleanupHook(), this._cleanupHook = void 0); } resetErrorBoundary() { let { onReset: e } = this.props, { error: t, componentStack: n, eventId: r } = this.state; e && e(t, n, r), this.setState(F); } render() { let { fallback: e, children: t } = this.props, n = this.state; if (n.componentStack === null) return typeof t == "function" ? t() : t; let r = typeof e == "function" ? P.createElement(e, { error: n.error, componentStack: n.componentStack, resetError: () => this.resetErrorBoundary(), eventId: n.eventId }) : e; return P.isValidElement(r) ? r : (e && mt && b.warn("fallback did not produce a valid ReactElement"), null); } }, gt = /* @__PURE__ */ e(Me(), 1), _t = Be(), vt = Qe(); function yt(e) { var t; let n = new URLSearchParams(window.location.search).get(de), r = g ? window.localStorage.getItem(de) : null, i = n == null ? r : n; return i == null ? g && Ke() != null || Object.keys((t = e.kiosk) == null ? {} : t).length > 0 : i === "1"; } function bt() { let e = window.location.hostname.split("."); return e.length >= 3 && e[e.length - 2] === "expofp" && e[e.length - 1] === "com"; } function xt() { return bt() ? window.location.hostname.split(".")[0] : "main"; } function St(e) { if ((e == null ? void 0 : e.free) === !0) return "Free"; let t = e == null ? void 0 : e.trialExpiresAt; if (t) { let e = new Date(t).getTime(); if (!Number.isNaN(e)) return Date.now() < e ? "Trial Active" : "Trial Expired"; } return "Active"; } function Ct() { return !1; } function wt(e) { return e; } function Tt(e) { if (Ct() || !bt() || yt(e) || !window.navigator.onLine) return null; let t = wt({ subDomain: xt(), subscriptionStatus: St(e) }); return t.subDomain !== "demo" && t.subscriptionStatus !== "Free" && t.subscriptionStatus !== "Trial Expired" ? null : t; } //#endregion //#region ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/mini/schemas.js var I = /*@__PURE__*/ m("ZodMiniType", (e, t) => { if (!e._zod) throw Error("Uninitialized schema in ZodMiniType."); ye.init(e, t), e.def = t, e.type = t.type, e.parse = (t, n) => l(e, t, n, { callee: e.parse }), e.safeParse = (t, n) => ie(e, t, n), e.parseAsync = async (t, n) => ve(e, t, n, { callee: e.parseAsync }), e.safeParseAsync = async (t, n) => ae(e, t, n), e.check = (...n) => { var r; return e.clone({ ...t, checks: [...(r = t.checks) == null ? [] : r, ...n.map((e) => typeof e == "function" ? { _zod: { check: e, def: { check: "custom" }, onattach: [] } } : e)] }, { parent: !0 }); }, e.with = e.check, e.clone = (t, n) => se(e, t, n), e.brand = () => e, e.register = ((t, n) => (t.add(e, n), e)), e.apply = (t) => t(e); }), Et = /*@__PURE__*/ m("ZodMiniString", (e, t) => { oe.init(e, t), I.init(e, t); }); // @__NO_SIDE_EFFECTS__ function Dt(e) { return ke(Et, e); } var Ot = /*@__PURE__*/ m("ZodMiniNumber", (e, t) => { le.init(e, t), I.init(e, t); }); // @__NO_SIDE_EFFECTS__ function L(e) { return je(Ot, e); } var kt = /*@__PURE__*/ m("ZodMiniNever", (e, t) => { Oe.init(e, t), I.init(e, t); }); // @__NO_SIDE_EFFECTS__ function At(e) { return De(kt, e); } var jt = /*@__PURE__*/ m("ZodMiniArray", (e, t) => { ce.init(e, t), I.init(e, t); }); // @__NO_SIDE_EFFECTS__ function Mt(e, t) { return new jt({ type: "array", element: e, ...p(t) }); } var Nt = /*@__PURE__*/ m("ZodMiniObject", (e, t) => { ee.init(e, t), I.init(e, t), te(e, "shape", () => t.shape); }); // @__NO_SIDE_EFFECTS__ function R(e, t) { return new Nt({ type: "object", shape: e, catchall: /* @__PURE__ */ At(), ...p(t) }); } var Pt = /*@__PURE__*/ m("ZodMiniOptional", (e, t) => { f.init(e, t), I.init(e, t); }); // @__NO_SIDE_EFFECTS__ function z(e) { return new Pt({ type: "optional", innerType: e }); } var Ft = /*@__PURE__*/ m("ZodMiniCustom", (e, t) => { d.init(e, t), I.init(e, t); }); // @__NO_SIDE_EFFECTS__ function It(e, t = {}) { return pe(Ft, e, t); } //#endregion //#region src/schemas/sdk.schemas.ts var Lt = /* @__PURE__ */ R({ x: /* @__PURE__ */ L(), y: /* @__PURE__ */ L() }), Rt = /* @__PURE__ */ R({ leftTop: Lt, rightBottom: Lt }), zt = (/* @__PURE__ */ R({ name: /* @__PURE__ */ z(/* @__PURE__ */ Dt()), externalId: /* @__PURE__ */ z(/* @__PURE__ */ Dt()) })).check(/* @__PURE__ */ It((e) => !!(e.name || e.externalId), "Either name or externalId must be provided")), Bt = (/* @__PURE__ */ R({ booths: /* @__PURE__ */ z(/* @__PURE__ */ Mt(zt)), exhibitors: /* @__PURE__ */ z(/* @__PURE__ */ Mt(zt)) })).check(/* @__PURE__ */ It((e) => { var t, n; return !!((t = e.booths) != null && t.length || (n = e.exhibitors) != null && n.length); }, "Selector must contain booths or exhibitors")), Vt = /* @__PURE__ */ z(/* @__PURE__ */ R({ padding: /* @__PURE__ */ z(/* @__PURE__ */ L()) })); //#endregion //#region src/components/Kiosk/recoverKioskFromUrlPrams.ts function Ht(e) { let t = $e(e); Object.values(t).length && (st(t, !1), ot(t)); } //#endregion //#region src/utils/camera-map-settings.ts function B(e) { let t = {}; return e.x !== void 0 && e.y !== void 0 && (t.centerxy = `${e.x},${e.y}`), e.lat !== void 0 && e.lng !== void 0 && (t.center = `${e.lat},${e.lng}`), e.floor !== void 0 && (t.z = e.floor), e.bearing !== void 0 && (t.bearing = e.bearing), e.zoomTime !== void 0 && (t.zoomtime = e.zoomTime), t; } function Ut(e) { let t = {}, n = Wt(e.centerxy); n && ([t.x, t.y] = n); let r = Wt(e.center); return r && ([t.lat, t.lng] = r), e.z !== void 0 && (t.floor = e.z), e.bearing !== void 0 && (t.bearing = e.bearing), e.zoomtime !== void 0 && (t.zoomTime = e.zoomtime), t; } function Wt(e) { if (!e) return; let t = e.split(",").map(Number); if (!(t.length !== 2 || !t.every(Number.isFinite))) return [t[0], t[1]]; } //#endregion //#region src/utils/getMostFrequent.ts function Gt(e) { let t = {}, n = 0, r; return e.forEach((e) => { t[e] = (t[e] || 0) + 1, t[e] > n && (n = t[e], r = e); }), r; } //#endregion //#region src/services/multi-slug.ts function Kt(e, t) { if (!e.includes("&") && !e.includes("%26")) return null; let n = e.startsWith("?") ? e.slice(1) : e, r = n.includes("&") ? "&" : "%26", i = n.split(r), a = (e) => !!e && !_(e).includes("="); return i.filter(a).length < 2 ? null : "?" + i.map((e) => a(e) && t(e) || e).join("&"); } //#endregion //#region src/services/url-dispatch.ts var V = !1; function qt() { rn(h()), u(() => M.layerStore.layersLoaded, () => { let e = h().camera; Object.keys(e).length && G(B(e)); let t = h().visibility; Object.keys(t).length && D.setVisibility(t); }); } function Jt(e) { nt({ offHistory: e, onNavigate: U }), $t(), H(), u(() => M.layerStore.layersLoaded, () => { M.urlFilterManager && !M.urlFilterManager.isInitialized && M.urlFilterManager.initialize(), U(), he(W), he(ln), D.viewerMode && (D.menu = !0); }); } function Yt(e = "") { j("?" + _(e.toString())), M.layerStore.layersLoaded ? Xt(e) : (H(), u(() => M.layerStore.layersLoaded, () => Xt(e))); } function Xt(e) { var t; let n = "?" + _(e), r = an(n); rn(r), r.consent && tt(r.consent), r.camera && Object.keys(r.camera).length && G(B(r.camera)), r.visibility && Object.keys(r.visibility).length && D.setVisibility(r.visibility), $t(), U(); let i = [...(t = r.intents) == null ? [] : t, ...fe(n).intents]; i.length && o(M.fp, i); } function H() { let e = A(); return ct(e.length > 1 ? _(e.substring(1)) : ""); } function U() { V = !0; try { Ht(new URLSearchParams(_(window.location.search))); let { primary: e, oneShots: t } = Te(A()), n = t.find((e) => e.type === "camera"); if (n) { let e = n.roll; G({ ...B(n.camera), roll: e }); } let r = e.type === "select" && (!e.slug || /^t=[^&]*$/.test(e.slug)) && (D.heatmap || D.heatmapYah); !H() && !r && Zt(e); } finally { V = !1; } ln(), W(); } function Zt(e) { let t = M.fp; switch (e.type) { case "kiosk": e.enabled === !0 ? D.kiosk = !0 : e.enabled === !1 && (D.kiosk = !1, D.resetUIScale()); return; case "list": t.showList(e.list); return; case "tour": t.selectTour(e.tourId); return; case "planner": t.openPlanner({ items: e.items, from: e.from, fromBookmarks: e.fromBookmarks }); return; case "route": var n, r; M.routeStore.setOnlyAccessible(e.accessible), M.routeStore.selectRoute(rt((n = e.from) == null ? "" : n, (r = e.to) == null ? "" : r, e.waypoints)), M.uiState.setIsMultiPointRoute(e.waypoints.length > 0), e.title && M.uiState.setRouteTitle(e.title); return; case "language": we(e.langId) && Se(e.langId); return; case "printPdf": M.uiState.printingPdf = !0; return; case "visibility": M.uiState.setVisibility(e.hidden.reduce((e, t) => ({ ...e, [t]: !1 }), {})); return; case "buildRoute": t.startBuildRoute(); return; case "pathway": Qt(e); return; case "selectExhibitors": setTimeout(() => t.selectExhibitor(e.values), 250); return; case "ownedByFilters": v.log("Skipping filter parameters in dispatchFromUrl (owned by URLFilterManager)"); return; case "ownedByConfig": return; case "select": t.select(e.slug); return; } } function Qt(e) { let { pathwayId: t, boothIds: n, exhibitorIds: r, tourId: i } = e; if (i) { let e = M.toursStore.getTourById(i); e && Ae(() => { var t; M.uiState.setTourTitle(e.name), M.uiState.setTourDescription((t = e.description) == null ? "" : t), M.uiState.setIsMultiPointTour(!0), M.uiState.setMultiPointTourList(e.id); }); } let a = M.boothStore.booths.filter((e) => n.includes(e.externalId)), o = M.exhibitorStore.exhibitors.filter((e) => r.includes(e.externalId)).flatMap((e) => e.booths), s = [...a, ...o]; if (Ze()) { let e = Gt(s.map((e) => e.layer.name)); e && M.fp.activateFloor({ name: e }); } (n.length > 0 || r.length > 0) && M.fp.highlightEntities([...n, ...r]), M.layerStore.showPathWay(t), s.length > 0 && Ae(() => { M.uiState.moveToRect = k.fromUnion(...s.map((e) => e.rect).filter(Boolean)), M.uiState.rollReset = !0; }); } function $t() { let e = A(), { oneShots: t } = Te(e); for (let e of t) en(e); e.startsWith("?preview=") && j("?"), A().includes("copy_exh") && j("?"); let n = Ue(A()); n !== null && j("?" + n), D.previewExhibitor && j("?" + D.previewExhibitor.slug), nn(); } function en(e) { switch (e.type) { case "heatmap": tn(e.yah); return; case "blueDot": { var t, n; let r = new it(e.x, e.y, (t = M.layerStore.findLayer((n = e.layer) == null ? "" : n)) == null ? void 0 : t.name, void 0, e.lat, e.lng); u(() => M.layerStore.layersLoaded, () => M.routeStore.selectCurrentPosition(r, !0, 1)); return; } case "viewerMode": g && (e.enabled ? localStorage.setItem(xe, "true") : (localStorage.removeItem(xe), localStorage.removeItem(ne))); return; case "previewMode": g && (e.enabled ? localStorage.setItem(c, "true") : (localStorage.removeItem(c), localStorage.removeItem(ue))); return; case "uiScale": e.scale === null ? v.warn(`Invalid ui-scale parameter: ${e.raw}. Must be a number between 0.8 and 1.4.`) : M.uiState.setUIScale(e.scale, !0); return; case "resetUiScale": M.uiState.resetUIScale(); return; case "legacyBookmarks": { let t = e.appendExhibitorId === null ? void 0 : M.exhibitorStore.exhibitorById.get(e.appendExhibitorId); j(t ? "?" + t.slug : "?bookmarks"); return; } } } function tn(e) { et(), e ? (D.heatmapYah = !0, D.monochrome = !0, D.hideLogoInBooth = !0, D.hideHeaderLogo = !0, D.disableBookmarked = !0) : D.heatmap = !0; } function nn() { let e = Kt(A(), (e) => { let t = M.exhibitorStore.exhibitors.find((t) => t.slug === e || t.externalId === e); return t == null ? void 0 : t.name; }); e !== null && j(e); } function rn(e) { e.noOverlay !== void 0 && (D.hideOverlay = e.noOverlay), e.monochrome && (D.monochrome = !0), e.hideHeaderLogo && (D.hideHeaderLogo = !0), e.hideLogoInBooth && (D.hideLogoInBooth = !0), e.disableFeatured && M.exhibitorStore.exhibitors.forEach((e) => e.featured = !1), e.disableBookmarked && (D.disableBookmarked = !0), e.disableGps && M.routeStore.setGpsTrackingEnabled(!1), e.heatmap && r(e.heatmap) && tn(e.heatmap.variant === "yah"); } function an(e) { return Ce(_e, e).value; } var on = null, sn = null, cn = null; function ln() { let { selection: e, exhibitor: t, booth: n, eventItem: r } = un(), i = M.urlFilterManager.filterSearch(); if (V) return; let a = me(e) || i; A() !== a && (t !== on || n !== sn || r !== cn ? Ye(a) : j(a), on = t, sn = n, cn = r); } function un() { let e = D.selectedExhibitor, t = D.selectedBooth, n = D.selectedEventItem, r = D.selectedRoute, i = D.selectedSpeaker, a = D.setKioskModeEnabled, o = D.list, s; if (o.type === "route-planner" && !e && !t && !n) { var c; let e = M.routePlannerStore; s = { type: "planner", fromBookmarks: e.source === "bookmarks", items: e.items.map((e) => e.entity.slug).filter(Boolean), from: ((c = e.startPoint) == null ? void 0 : c.slug) || void 0 }; } else if (r && !D.isMultiPointRoute) { var l; s = { type: "route", to: r.to instanceof E ? r.to.slug : void 0, from: r.from instanceof E ? r.from.slug : void 0, accessible: M.routeStore.onlyAccessible, waypoints: (l = r.waypoints) == null ? void 0 : l.map((e) => e.slug) }; } else if (e) s = { type: "slug", slug: e.slug }; else if (t) s = { type: "slug", slug: t.slug }; else if (n) s = { type: "slug", slug: n.slug }; else if (i) s = { type: "slug", slug: i.slug }; else if (a) s = { type: "none" }; else switch (o.type) { case "bookmarks": case "visited": case "sessions": case "exhibitors": case "speakers": case "tours": case "language": s = { type: "list", list: o.type }; break; case "category": var u, d; s = { type: "slug", slug: (u = (d = D.selectedCategory) == null ? void 0 : d.slug) == null ? "" : u }; break; case "search": s = { type: "slug", slug: o.text || "" }; break; case "filter": s = { type: "filter", key: o.query.key, value: o.query.value }; break; case "multi-point-tour": s = { type: "tour", tourId: o.tourId }; break; default: throw Error("Unkown list.type"); } return { selection: s, exhibitor: e, booth: t, eventItem: n }; } function W() { let e = D.selectedExhibitor, t = D.selectedEventItem, n = D.selectedSpeaker, r = ""; e ? r = e.name : t ? r = t.name : n ? r = n.name : D.list.type === "search" && D.list.text ? r = "`" + (D.list.text || "") + "`" : D.list.type === "multi-point-tour" && D.tourTitle && (r = D.tourTitle), r.length && (r += " – "), r += O.title, O.subtitle && (r += " – " + O.subtitle), r += " – Expo Floor Plan by ExpoFP", document.title = r; } function G(e) { try { if (D.setMapSettings(e), e.z) { let t = M.layerStore.layers.find((t) => t.name === e.z); t && M.layerStore.updateVisibility(t, !0); } } catch (e) { console.error("Failed to process map settings.", e); } } //#endregion //#region src/tools/reset.ts function dn() { K("floorplan"), K("__searchi"), K("__mobxGlobals"), K("__store"), K("__mobxInstanceCount"); for (let e in window) e !== "__efpStyleElements" && (e.includes("__fp") || e.includes("__efp")) && K(e); } function K(e) { fn(e) ? delete window[e] : window[e] = void 0; } function fn(e) { let t = Object.getOwnPropertyDescriptor(window, e); return t && t.configurable; } //#endregion //#region src/utils/mapEntity.ts function q(e) { switch (e.entity.type) { case "booth": var t, n; return { id: e.id, name: Y(e.name), externalId: Y(e.externalId), isSpecial: e.entity.variant === "special", exhibitors: J(e.exhibitors), layer: { name: Y((t = e.layer) == null ? void 0 : t.name), description: Y((n = e.layer) == null ? void 0 : n.description) }, meta: e.meta, description: Y(e.description), entity: e.entity, title: Y(e.title) }; case "category": return { id: e.id, name: Y(e.name), exhibitors: J(e.exhibitors), entity: e.entity, slug: Y(e.slug) }; case "exhibitor": return { id: e.id, name: Y(e.name), externalId: Y(e.externalId), booths: J(e.booths), entity: e.entity, slug: Y(e.slug) }; case "schedule": return { id: e.id, externalId: Y(e.externalId), boothId: e.boothId, exhibitorId: e.exhibitorId, name: Y(e.name), description: Y(e.description), startDate: Y(e.startDate), endDate: Y(e.endDate), link: Y(e.link), entity: e.entity, isEnded: e.isEnded }; case re: return { id: e.id, name: Y(e.name), entity: e.entity }; case "heatmap-yah": return { id: Y(e.id), name: Y(e.name), viewCount: e.viewCount || 0, x: e.x || 0, y: e.y || 0, z: e.z, entity: e.entity }; default: return e; } } function J(e) { return Array.isArray(e) ? e.filter(Boolean).map((e) => e.id).filter(Boolean) : []; } function Y(e) { return typeof e == "string" ? e : ""; } //#endregion //#region src/floorplan.ready.tsx var X = Pe(), Z = (0, gt.default)("efp:api"); (0, vt.install)(); var pn = class extends s { constructor(...e) { super(...e), this.root = void 0; } init() { qt(), this.ignoreQuery || Jt(this.offHistory), Ge("load"), M.fp = this, tt(this.consent), w(C.Load, ""), this.root = (0, _t.createRoot)(this.renderTarget), this.root.render(/* @__PURE__ */ (0, X.jsx)(ht, { children: /* @__PURE__ */ (0, X.jsx)(lt, { offHistory: this.offHistory, consent: this.consent }) })), w(C.Rendered, ""), Ee(() => M.layerStore.layersLoaded, () => { if (this.resolveReady(), !M.initialized) { var e; (e = this.onInit) == null || e.call(this, this); } M.initialized = !0; }); let e = Tt(O); e && import("./bootIntercom-DgThK91j.js").then(({ bootIntercom: t }) => t(e)).catch(() => {}); } selectBooth(e) { if (typeof e != "string" && !Array.isArray(e)) { $("selectBooth", "Parameter must be a string or an array of strings.", "EFP000000"); return; } let t = M.boothStore.booths.filter((t) => typeof e == "string" ? t.name === e || t.externalId === e : e.includes(t.name) || e.includes(t.externalId)); M.selectBooth(t); } selectExhibitor(e) { if (typeof e != "string" && !Array.isArray(e)) { $("selectExhibitor", "Parameter must be a string or an array of strings.", "EFP000100"); return; } if (!(e != null && e.length)) { M.uiState.menu = !1, M.searchStore.resetSearchBox(), M.uiState.details = null; return; } let t = M.exhibitorStore.exhibitors.filter((t) => typeof e == "string" ? t.name === e || t.externalId === e : e.includes(t.name) || e.includes(t.externalId)); if (!(t != null && t.length)) return; if (typeof e == "string") { M.selectExhibitor(t[0]), M.moveToList([t[0]]); return; } let n = t.flatMap((e) => e.booths.map((e) => e.layer)), { description: r } = n.reduce((e, t) => (e.freq[t.description] = (e.freq[t.description] || 0) + 1, e.freq[t.description] > e.maxCount && (e.maxCount = e.freq[t.description], e.mostFrequent = t), e), { freq: {}, mostFrequent: n[0], maxCount: 0 }).mostFrequent; M.layerStore.updateVisibility(r, !0), M.uiState.menu = !1, M.searchStore.resetSearchBox(), M.uiState.details = null, M.uiState.list = { type: "filter", items: t, query: { key: "exhibitors", value: t.map((e) => e.externalId).join(",") } }, M.moveToList(); } highlightExhibitors(e) { Array.isArray(e) || $("highlightExhibitors", "Parameter must be an array of strings.", "EFP000200"), M.boothStore.highlightedByExternalIds = [], M.exhibitorStore.highlightedByExternalIds = [...e]; } highlightBooths(e) { Array.isArray(e) || $("highlightBooths", "Parameter must be an array of strings.", "EFP000300"), M.exhibitorStore.highlightedByExternalIds = [], M.boothStore.highlightedByExternalIds = [...e]; } highlightEntities(e) { Array.isArray(e) || $("highlightEntities", "Parameter must be an array of strings.", "EFP000400"); let { boothExternalIds: t, exhibitorExternalIds: n } = x(e); M.boothStore.highlightedByExternalIds = [...t], M.exhibitorStore.highlightedByExternalIds = [...n]; } selectRoute(e, t) { if (Array.isArray(e)) { let t = [...e], n = t.shift(), r = t.pop(); if (t.length > 8) throw Error("The maximum number of waypoints is 8."); if (!n || !r) { $("selectRoute", "Invalid route format: When providing an array, it must include at least two points: a start and a destination.", "EFP000401"); return; } M.routeStore.selectRoute(new Je(Q(n), Q(r), t.map(Q))); return; } e || $("selectRoute", "At a minimum, the starting point must be passed.", "EFP000402"), M.routeStore.selectRoute(new Je(Q(e), Q(t))); } getOptimizedRoutes(e) { if (!Array.isArray(e)) return $("getOptimizedRoutes", "Parameter must be an array.", "EFP000500"), []; if (e.length > 8) throw Error("The maximum number of waypoints is 8."); let t = e.map(Q).filter((e) => !!e); if (!t.length) throw Error("No booths found for the provided waypoints."); let n = /* @__PURE__ */ new Map(); for (let e of t) { var r, i; let t = (r = (i = e.layer) == null ? void 0 : i.name) == null ? "" : r, a = n.get(t); a ? a.push(e) : n.set(t, [e]); } return Array.from(n.values()).map((e) => ({ waypoints: Ve(e.map((e) => [e.name, { x: e.rect.center.x, y: e.rect.center.y }])) })); } selectCurrentPosition(e, t, n) { var r; let i = S(e.x) && S(e.y), a = S(e.lng) && S(e.lat); !i && !a && $("selectCurrentPosition", "A point must be passed. Either (x,y) or (lat,lng) are required.", "EFP000600"), M.routeStore.selectCurrentPosition(e, t, n), (r = this.onCurrentPositionChanged) == null || r.call(this, e); } setBookmarks(e) { (!Array.isArray(e) || !e.length) && $("setBookmarks", "Parameter must be an array.", "EFP000700"), e.forEach((e) => { let t = M.exhibitorStore.exhibitors.find((t) => t.name === e.name || t.externalId === e.externalId); t && (t.bookmarked = e.bookmarked); }); } setEntitiesBookmarks(e) { if (!Array.isArray(e) || !e.length) { $("setEntitiesBookmarks", "Parameter must be an array.", "EFP000701"); return; } let t = [ "exhibitor", "event", "speaker", "booth" ], n = e.find((e) => !e.type || !t.includes(e.type)); if (n) { $("setEntitiesBookmarks", `Invalid entity type: ${n.type}. Must be one of: ${t.join(", ")}.`, "EFP000702"); return; } let r = at("bookmarked"), i = { exhibitor: { existingIds: new Set(r.exhibitors || []), finder: (e) => M.exhibitorStore.findExhibitor(e), replacer: (e) => M.exhibitorStore.replaceBookmarked(e) }, event: { existingIds: new Set(r.events || []), finder: (e) => M.eventStore.findByNameOrSlug(e), replacer: (e) => M.eventStore.replaceBookmarked(e) }, speaker: { existingIds: new Set(r.speakers || []), finder: (e) => M.speakerStore.speakers.find((t) => t.name === e || t.externalId === e || t.slug === e), replacer: (e) => M.speakerStore.replaceBookmarked(e) }, booth: { existingIds: new Set(r.booths || []), finder: (e) => { let t = M.boothStore.findBooth(e); return (t == null ? void 0 : t.exhibitors.length) === 0 ? t : void 0; }, replacer: (e) => M.boothStore.replaceBookmarked(e) } }; e.forEach((e) => { let t = i[e.type], n = e.name || e.externalId || "", r = t.finder(n); r ? e.bookmarked ? t.existingIds.add(r.id) : t.existingIds.delete(r.id) : console.warn(`Entity not found: ${e.type} with query "${n}"`); }), Object.values(i).forEach((e) => { e.replacer(Array.from(e.existingIds)); }); } setEntitiesVisited(e) { if (!Array.isArray(e) || !e.length) { $("setEntitiesVisited", "Parameter must be an array.", "EFP000703"); return; } let t = ["exhibitor", "event"], n = e.find((e) => !e.type || !t.includes(e.type)); if (n) { $("setEntitiesVisited", `Invalid entity type: ${n.type}. Must be one of: ${t.join(", ")}.`, "EFP000704"); return; } let r = at("visited"), i = { exhibitor: { existingIds: new Set(r.exhibitors || []), finder: (e) => M.exhibitorStore.findExhibitor(e), replacer: (e) => M.exhibitorStore.replaceVisited(e) }, event: { existingIds: new Set(r.events || []), finder: (e) => M.eventStore.findByNameOrSlug(e), replacer: (e) => M.eventStore.replaceVisited(e) } }; e.forEach((e) => { let t = i[e.type], n = e.name || e.externalId || "", r = t.finder(n); r ? e.visited ? t.existingIds.add(r.id) : t.existingIds.delete(r.id) : console.warn(`Entity not found: ${e.type} with query "${n}"`); }), Object.values(i).forEach((e) => { e.replacer(Array.from(e.existingIds)); }); } setMarkers(e) { if (!e || !Array.isArray(e.icons) || !Array.isArray(e.markers)) { $("setMarkers", "Invalid input.", "EFP000800"); return; } M.routeStore.setMarkers(e); } selectMarker(e, t = !0) { return typeof e != "string" && $("selectMarker", "The identifier must be passed.", "EFP000900"), M.routeStore.selectMarker(e, t); } drawCircles(e) { Array.isArray(e) || $("drawCircles", "Invalid input.", "EFP000A00"), M.uiState.debugCircles = e; } checkRoutes() { M.routeStore.checkRoutes(); } updateLayerVisibility(e, t) { typeof e != "string" && $("updateLayerVisibility", "The layer name (string) must be passed.", "EFP000B00"), t || $("updateLayerVisibility", "Passing a false value to visible will have no effect.", "EFP000B01"), M.layerStore.updateVisibility(e, t); } getCenterCoordinates() { return M.fp.getCenterCoordinates(); } exhibitorsList() { return M.exhibitorStore.exhibitors.map((e) => q(e)); } boothsList() { return M.boothStore.booths.map((e) => q(e)); } categoriesList() { return M.categoryStore.categories.map((e) => q(e)); } selectCategory(e) { if (e == null || typeof e != "string") { M.searchStore.selectSearch(); return; } let t = e == null ? void 0 : e.toLowerCase(), n = M.categoryStore.categories.find(({ name: e, slug: n }) => (e == null ? void 0 : e.toLowerCase()) === t || (n == null ? void 0 : n.toLowerCase()) === t); if (!n) { $("selectCategory", `Category ${e} not found.`, "EFP000C01"); return; } M.selectCategory(n); } select(e) { if (typeof e != "string") { $("select", "Parameter must be a string.", "EFP001700"); return; } let t = e, n = t == null ? void 0 : t.toLowerCase(), r = M.boothStore.booths.find((e) => { var t, r, i; return ((t = e.slug) == null ? void 0 : t.toLowerCase()) === n || ((r = e.externalId) == null ? void 0 : r.toLowerCase()) === n || ((i = e.externalId) == null || (i = i.toLowerCase()) == null ? void 0 : i.replace(/\s+/g, "")) === n; }); if (r) { setTimeout(() => M.selectBooth(r), 250); return; } let i = M.eventStore.eventItems.find((e) => { var t, r; return ((t = e.slug) == null ? void 0 : t.toLowerCase()) === n || ((r = e.externalId) == null ? void 0 : r.toLowerCase()) === n; }); if (i) { M.selectEventItem(i, !0); return; } let a = M.exhibitorStore.exhibitors.find((e) => { var t, r; return ((t = e.slug) == null ? void 0 : t.toLowerCase()) === n || ((r = e.externalId) == null ? void 0 : r.toLowerCase()) === n; }); if (a) { setTimeout(() => M.clickExhibitor(a), 250); return; } let o = M.categoryStore.categories.find((e) => e.slug === t); if (o) { M.selectCategory(o); return; } let s = M.speakerStore.findBySlug(t); if (s) { M.selectSpeaker(s, !0); return; } t.includes("heatmap=true") || M.searchStore.selectSearch(t); } showList(e) { let t = { bookmarks: () => M.selectBookmarks(), visited: () => M.selectVisited(), sessions: () => M.selectSessions(), exhibitors: () => M.selectExhibitors(), speakers: () => M.selectSpeakers(), tours: () => M.selectTours(), language: () => M.selectLanguage() }, n = t[e]; if (!n) { $("showList", `Unknown list "${e}". Must be one of: ${Object.keys(t).join(", ")}.`, "EFP001800"); return; } n(); } selectTour(e) { if (typeof e != "string" || !e) { $("selectTour", "A tour id must be passed.", "EFP001900"); return; } let t = M.toursStore.getTourById(e); t ? M.toursStore.launchTour(t, t.name, t.description) : (console.warn(`Route with id "${e}" not found`), M.selectTours()); } openPlanner(e = {}) { if (typeof e != "object" || !e) { $("openPlanner", "An options object must be passed.", "EFP001A00"); return; } let t = e.from ? T(e.from) : null; if (e.fromBookmarks) M.routePlannerStore.launchFromBookmarks(t == null ? void 0 : t); else { var n; M.routePlannerStore.launchFromSlugs((n = e.items) == null ? [] : n, t == null ? void 0 : t); } } startBuildRoute() { M.uiState.startBuildRoute(); } applyParameters(e) { typeof e != "string" && $("applyParameters", "A query string must be passed.", "EFP000D00"), Yt(e); } getVisibility() { return M.uiState.visibility; } setVisibility(e) { (typeof e != "object" || !Object.keys(e).length) && $("setVisibility", "The parameter must be passed.", "EFP000E00"), M.uiState.setVisibility(e); } findLocation() { M.routeStore.findLocation(); } zoomIn() { M.uiState.zoomIn(); } zoomOut() { M.uiState.zoomOut(); } switchView() { M.maplibreStore.activateMaplibre(); } setCamera(e) { Z("setCamera called with camera=%O", e); let t = ge.safeParse(e); if (!t.success) { $("setCamera", t.error.message, "EFP001B00"); return; } M.uiState.setMapSettings(B(t.data)); } getCamera() { return Ut(M.uiState.mapSettings); } zoomTo(e, t) { Z("zoomTo called with selectors=%O options=%O", e, t); let n = Bt.safeParse(e); if (!n.success) { $("zoomTo", n.error.message, "EFP001600"); return; } let r = Vt.safeParse(t); if (!r.success) { $("zoomTo", r.error.message, "EFP001601"); return; } let i = this.getBounds(e); i && this.fitBounds(i, t); } getBounds(e) { var t, n; Z("getBounds called with selectors=%O", e); let r = Bt.safeParse(e); if (!r.success) { $("getBounds", r.error.message, "EFP001400"); return; } let i = []; if ((t = e.booths) == null || t.forEach((e) => { let t; e.externalId ? t = M.boothStore.boothByExternalId.get(e.externalId) : e.name && (t = M.boothStore.boothByName.get(e.name.toLowerCase())), t != null && t.rect && i.push(t.rect); }), (n = e.exhibitors) == null || n.forEach((e) => { var t; let n; e.externalId ? n = M.exhibitorStore.exhibitorByExternalId.get(e.externalId) : e.name && (n = M.exhibitorStore.exhibitorByName.get(e.name.toLowerCase())), n == null || (t = n.booths) == null || t.forEach((e) => { e.rect && i.push(e.rect); }); }), i.length === 0) return; let a = k.fromUnion(...i); return { leftTop: { x: a.min.x, y: a.min.y }, rightBottom: { x: a.max.x, y: a.max.y } }; } fitBounds(e, t) { if (Z("fitBounds called with bounds=%O options=%O", e, t), !e) { M.uiState.fitBounds(); return; } let n = Rt.safeParse(e); if (!n.success) { $("fitBounds", n.error.message, "EFP001500"); return; } let r = Vt.safeParse(t); if (!r.success) { $("fitBounds", r.error.message, "EFP001501"); return; } let i = k.fromMinMax({ x: e.leftTop.x, y: e.leftTop.y }, { x: e.rightBottom.x, y: e.rightBottom.y }); M.uiState.moveToRect = t != null && t.padding ? i.expand(t.padding) : i; } getBoothRect(e) { var t; typeof e != "string" && $("getBoothRect", "A booth name must be passed.", "EFP000F00"); let n = (t = T(e)) == null ? void 0 : t.rect; return n ? hn.fromBox(n) : void 0; } convertToGeo(e, t) { var n; if (!(!(N == null || (n = N.properties) == null) && n.config)) { $("convertToGeo", "The coordinates cannot be converted because the GPS configuration is not defined.", "EFP001000"); return; } if (!e || !t) { $("convertToGeo", "Both coordinates must be passed.", "EFP001001"); return; } return He(e, t, N.properties.config); } getGeoConfig() { var e, t; let n = N == null || (e = N.properties) == null ? void 0 : e.config; return n ? { bearing: (t = n.bearing) == null ? 0 : t, p0: n.p0, p1: n.p1, p2: n.p2 } : null; } unstable_destroy() { let e = window.__efpElement.firstChild; dn(), window.removeEventListener("__efpStyleLoad", this.efpStyleLoadHandler), window.removeEventListener("error", i), M.maplibreStore.dispose(), qe(), Xe(), We(), this.root.unmount(), e.remove(); } search(e) { return typeof e != "string" && $("search", "A search string must be passed.", "EFP001100"), M.fuzzySearchEngineStore.loadEngine().then(() => (M.searchStore.selectSearch(e), M.uiState.fuzzySearchItems.map((e) => ({ item: q(e.item), score: e.score })))); } getFloors() { return M.layerStore.floors.map((e) => ({ name: e.name, shortName: e.shortName, description: e.description, active: e.active, disabled: e.disabled, index: e.index })); } activateFloor(e) { if (!(e != null && e.name) && (e == null ? void 0 : e.index) == null) { $("activateFloor", "Invalid floorId. It must contain either a name or an index.", "EFP001200"); return; } let t = this.getFloors(); if (e.name) { let n = t.find((t) => t.name === e.name || t.shortName === e.name); if (!n) { $("activateFloor", `Floor with name "${e.name}" not found.`, "EFP001201"); return; } if (n.active) return; this.updateLayerVisibility(n.name, !0); return; } if (e.index !== null) { let n = t.find((t) => t.index === e.index), r = n == null ? void 0 : n.name; if (!r) { $("activateFloor", `Floor at index ${e.index} does not exist.`, "EFP001203"); return; } if (n.active) return; this.updateLayerVisibility(r, !0); return; } } showPathway(e, t) { let { boothExternalIds: n, exhibitorExternalIds: r } = t != null && t.length ? x(t) : { boothExternalIds: [], exhibitorExternalIds: [] }; Qt({ pathwayId: e, boothIds: n, exhibitorIds: r }); } showPathwayOnly(e, t) { this.activateFloor({ name: t }), M.layerStore.showPathWay(e), M.uiState.setPathwayOnlyMode(!0); let n = M.layerStore.findLayer(e), r = M.layerStore.findLayer(t), i = n != null && n.rect || n != null && n.viewbox ? n : r; if (i != null && i.rect || i != null && i.viewbox) { var a; let e = (a = i.viewbox) == null ? i.rect : a; M.uiState.moveToRect = e.clone(); } } hidePathways() { this.highlightBooths([]), M.layerStore.hidePathways(), M.uiState.setPathwayOnlyMode(!1); } showSearch() { M.selectSearch(""); } changeLanguage(e) { var t; let n = e == null || (t = e.toLowerCase) == null ? void 0 : t.call(e); if (!we(n)) { $("changeLanguage", `Language "${e}" was not found. Available languages: ${be().map((e) => e.id).join(",")}`, "EFP001300"); return; } Se(n); } isGpsTrackingEnabled() { return M.routeStore.gpsEnabled; } setGpsTrackingEnabled(e) { M.routeStore.setGpsTrackingEnabled(e); } deselectCurrentPosition() { M.routeStore.selectCurrentPosition(null, !1); } deselectRoute() { M.routeStore.selectRoute(null), M.routeStore.setOnlyAccessible(!1); } reset() { if (this.selectBooth(""), this.selectExhibitor(""), this.selectCategory(), this.deselectCurrentPosition(), this.deselectRoute(), this.highlightEntities([]), M.uiState.kioskData && M.resetCameraFn) { var e; (e = M.resetCameraFn) == null || e.call(M); } else this.fitBounds(); } selectAccessibleRoute(e) { M.routeStore.setOnlyAccessible(!0), this.selectRoute(e); } }; function Q(e) { return typeof e == "string" ? T(e) : M.routeStore.getNearestBooth(e); } var mn = 0; function $(e, t, n) { let r = `Error calling "${e}" SDK method.`, i = `${t.endsWith(".") ? t : t + "."} More information at`, a = "https://js-sdk.expofp.com/api/packages"; if (n && (a += `#error-${n}`), console.error(`${r} ${i} ${a}`), M.fp.disableRuntimeAlerts) return; M.uiState.setGlobalErrorMessage({ title: r, body: /* @__PURE__ */ (0, X.jsxs)(X.Fragment, { children: [ i, " ", /* @__PURE__ */ (0, X.jsx)("a", { href: a, target: "_blank", rel: "noreferrer", children: a }) ] }) }), clearTimeout(mn); let o = 8e3; mn = window.setTimeout(() => { let e = async () => { M.uiState.globalErrorMessages.length > 0 && (M.uiState.popGlobalErrorMessage(), await new Promise((e) => setTimeout(e, o / 2)), e()); }; e(); }, o); } var hn = class e { get h() { return Math.abs(this.y2 - this.y1); } get w() { return Math.abs(this.x2 - this.x1); } get cx() { return (this.x1 + this.x2) / 2; } get cy() { return (this.y1 + this.y2) / 2; } constructor(e, t, n, r) { if (this.x1 = void 0, this.y1 = void 0, this.x2 = void 0, this.y2 = void 0, e > n) { let t = e; e = n, n = t; } if (t > r) { let e = t; t = r, r = e; } this.x1 = e, this.y1 = t, this.x2 = n, this.y2 = r; } static fromBox(t) { return new e(t.min.x, t.min.y, t.max.x, t.max.y); } static fromCxcywh(t, n, r, i) { return new e(t - r / 2, n - i / 2, t + r / 2, n + i / 2); } contains(e) { return e.x1 >= this.x1 && e.x2 <= this.x2 && e.y1 >= this.y1 && e.y2 <= this.y2; } intersects(e) { let t = Math.max(this.x1, e.x1), n = Math.min(this.x2, e.x2), r = Math.max(this.y1, e.y1), i = Math.min(this.y2, e.y2); return n >= t && i >= r; } getIntersection(t) { let n = Math.max(this.x1, t.x1), r = Math.min(this.x2, t.x2), i = Math.max(this.y1, t.y1), a = Math.min(this.y2, t.y2); return r >= n && a >= i ? new e(n, i, r, a) : new e(0, 0, 0, 0); } getRotated90() { return e.fromCxcywh(this.cx, this.cy, this.h, this.w); } normalize(t, n) { return new e(this.x1 / t, this.y1 / n, this.x2 / t, this.y2 / n); } withPadding(t, n = t) { return this.w < t * 2 || this.h < n * 2 ? this : e.fromCxcywh(this.cx, this.cy, this.w - t * 2, this.h - n * 2); } scale(t) { return new e(this.x1 * t, this.y1 * t, this.x2 * t, this.y2 * t); } getArea() { return this.w * this.h; } clone() { return new e(this.x1, this.y1, this.x2, this.y2); } translate(e, t) { return this.x1 += e, this.x2 += e, this.y1 += t, this.y2 += t, this; } equals(e) { return e.x1 === this.x1 && e.x2 === this.x2 && e.y1 === this.y1 && e.y2 === this.y2; } toString() { return this.x1 + "," + this.y1 + "," + this.w + "," + this.h; } containsPoint(e, t) { return e >= this.x1 && e <= this.x2 && t >= this.y1 && t <= this.y2; } }; //#endregion export { pn as default };