@expofp/floorplan 3.31.4 → 3.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (84) hide show
  1. package/dist/browser/{Button-DY6zD9Rk.js → Button-CNB2wS1D.js} +5 -5
  2. package/dist/browser/{CookieConsent-BDpDfPT3.js → CookieConsent-9-_4FEUc.js} +7 -7
  3. package/dist/browser/{Debug-CrJkx6Tf.js → Debug-BUelP3lh.js} +7 -7
  4. package/dist/browser/{DebugTools-BAZq8o4A.js → DebugTools-6RBk4RXs.js} +6 -6
  5. package/dist/browser/{Demo-DdWLZ2qx.js → Demo-B1Wq_-2I.js} +9 -9
  6. package/dist/browser/{Free-7_dnMQif.js → Free-Ce5a68cd.js} +9 -9
  7. package/dist/browser/{GalleryContainer-DWj18V5n.js → GalleryContainer-nNrPq8p3.js} +10 -10
  8. package/dist/browser/{GpsLoader-CXRQHRjg.js → GpsLoader-DJD8M21U.js} +10 -10
  9. package/dist/browser/{KioskStore-VTTOeXeu.js → KioskStore-DV6yg7gQ.js} +5 -5
  10. package/dist/browser/{MaplibreAdapter-DtBh3q_f.js → MaplibreAdapter-DG-IOwAR.js} +11 -11
  11. package/dist/browser/{ModalContainer-CLBUmAAD.js → ModalContainer-lWcPEqKF.js} +10 -10
  12. package/dist/browser/{PermissionNotice-Ce6yONr9.js → PermissionNotice-DzoxJYql.js} +6 -6
  13. package/dist/browser/{SetKioskMode-b0Kd0Q_K.js → SetKioskMode-D-drLiQS.js} +9 -9
  14. package/dist/browser/{ShowKiosk-DRRWT83C.js → ShowKiosk-CmQAm7lA.js} +10 -10
  15. package/dist/browser/{ViewerMenuPanel-Wnrbwe5h.js → ViewerMenuPanel-4K3IeFpI.js} +9 -9
  16. package/dist/browser/{add-debug-secret-listener-WhcgG7GC.js → add-debug-secret-listener-BCbwpSUA.js} +1 -1
  17. package/dist/browser/{adopt-global-settings--uzHm07K.js → adopt-global-settings-BCXdoUeA.js} +9 -9
  18. package/dist/browser/{boolean-editor-CC0r4Dt7.js → boolean-editor-Bq5ovuVU.js} +9 -9
  19. package/dist/browser/{bootIntercom-CKoX1zFG.js → bootIntercom-DJYZ3yyM.js} +2 -2
  20. package/dist/browser/bundle.json +69 -69
  21. package/dist/browser/{camera-events-Cm4_3lZE.js → camera-events-DumvNN3C.js} +1 -1
  22. package/dist/browser/{classnames-SVpBLYbY.js → classnames-XNi7nRCB.js} +2 -2
  23. package/dist/browser/{client-wCjB5vyj.js → client-CA8cGn8U.js} +5 -5
  24. package/dist/browser/{components-QmA1R6nP.js → components-MOPAfkCm.js} +37 -37
  25. package/dist/browser/{debug-context-BrxUqxef.js → debug-context-C73IpGRj.js} +5 -5
  26. package/dist/browser/{debug-overlay-1IKG3izM.js → debug-overlay-CIY57uQY.js} +10 -10
  27. package/dist/browser/{debug-ui-BVfBVFN5.js → debug-ui-D9GVgxaS.js} +6 -6
  28. package/dist/browser/{dimming-DIDB_Fhy.js → dimming-CXOoyeuK.js} +11 -11
  29. package/dist/browser/{dist-EaU_txHC.js → dist-CEbPeqIY.js} +6 -6
  30. package/dist/browser/{dist-CWNYRo3B.js → dist-CNBw7D1y.js} +5 -5
  31. package/dist/browser/{dist-DT5lrpvV.js → dist-Cuhm8hDS.js} +3 -3
  32. package/dist/browser/{efp-debug-init-Ce9vg6Tq.js → efp-debug-init-CF3R1rs1.js} +3 -3
  33. package/dist/browser/{enum-editor-BO48F5nG.js → enum-editor-Hfgu8R6H.js} +4 -4
  34. package/dist/browser/{es5-CDFVZlc4.js → es5-Ch3SnVpq.js} +2 -2
  35. package/dist/browser/{event-not-found-CljqcTHX.js → event-not-found-BBGk7sl1.js} +1 -1
  36. package/dist/browser/{exports-N7m3Sqif.js → exports-DdY5MNmH.js} +1 -1
  37. package/dist/browser/{favicon-Cd-lwAb6.js → favicon-D0_sCTFa.js} +1 -1
  38. package/dist/browser/{fetch-retry.umd-f3gOMjiD.js → fetch-retry.umd-DFU09v6m.js} +2 -2
  39. package/dist/browser/{flex-DpIfGOfP.js → flex-Dd9f0dfq.js} +5 -5
  40. package/dist/browser/{floorplan.loader-Dfbdv-o7.js → floorplan.loader-DxE6hohE.js} +237 -238
  41. package/dist/browser/{floorplan.ready-DKbBAbFS.js → floorplan.ready-Cysrjlb9.js} +19 -17
  42. package/dist/browser/{fuse-Dg9J4CBV.js → fuse-BHP4h5hM.js} +2 -2
  43. package/dist/browser/{i18n-CdlR_yif.js → i18n-3lyxjXox.js} +5 -5
  44. package/dist/browser/index.js +14 -14
  45. package/dist/browser/{index.module-m8gdUnww.js → index.module-C6SF1hwf.js} +4 -4
  46. package/dist/browser/{integrateKiosk-Bn_CLIEM.js → integrateKiosk-Dmtn4lIF.js} +4 -4
  47. package/dist/browser/{is-webview-C5WHhwMn.js → is-webview-DBk4rvr1.js} +1 -1
  48. package/dist/browser/{jsx-runtime-CynehOvT.js → jsx-runtime-DLehizIL.js} +2 -2
  49. package/dist/browser/{kiosk-record-9RRPsEyN.js → kiosk-record-CWJVbWhN.js} +1 -1
  50. package/dist/browser/{lib-D9Iv2vSf.js → lib-Cx0xfIyT.js} +3 -3
  51. package/dist/browser/{loadImage-BFhkQNt5.js → loadImage-BttawziQ.js} +4 -4
  52. package/dist/browser/{logDeviceInfo-CtU7Ml5Z.js → logDeviceInfo-DtOdua8y.js} +9 -9
  53. package/dist/browser/{mobx-C6SD9eIM.js → mobx-1TTEnMh_.js} +4 -4
  54. package/dist/browser/{optional-boolean-editor-B2jDylbI.js → optional-boolean-editor--Ll4y7L3.js} +3 -3
  55. package/dist/browser/{optional-enum-editor-Ca7UIvcI.js → optional-enum-editor-Diz4Gygu.js} +4 -4
  56. package/dist/browser/{optional-string-editor-Bhof-N0f.js → optional-string-editor-B_UUO3oV.js} +4 -4
  57. package/dist/browser/{particles.min-Dk8Zp6Xw.js → particles.min-IsQntJd_.js} +2 -2
  58. package/dist/browser/{react-Bg9SS9K3.js → react-DaVp-1nR.js} +2 -2
  59. package/dist/browser/{react-dom-CkvLw93N.js → react-dom-Cmin4STP.js} +3 -3
  60. package/dist/browser/{rolldown-runtime-CWbAMcOK.js → rolldown-runtime-Dl53HvP8.js} +1 -1
  61. package/dist/browser/{scheduler-DWQiq5yr.js → scheduler-CeO2Fq3-.js} +2 -2
  62. package/dist/browser/{select-DILrp4Xy.js → select-CcBpWf_u.js} +10 -10
  63. package/dist/browser/{settings-DZPzvL3g.js → settings-BnizsqhF.js} +2 -2
  64. package/dist/browser/{settings-item-CI4tQ7cI.js → settings-item-JOfQImsE.js} +6 -6
  65. package/dist/browser/{store-9H2zTJOB.js → store-BNPYvlw8.js} +212 -209
  66. package/dist/browser/{string-editor-CDVdYaGM.js → string-editor-BmF12fyT.js} +4 -4
  67. package/dist/browser/{text-field-CoMIE2tV.js → text-field-D4_C8M62.js} +5 -5
  68. package/dist/browser/{theme-DGSBFvlG.js → theme--BjIkuDi.js} +8 -8
  69. package/dist/browser/{ui-VhcgyDaO.js → ui-Bt8WOnfB.js} +8 -8
  70. package/dist/browser/{useRenderTarget-Dheg7zQ0.js → useRenderTarget-CKEW-h44.js} +4 -4
  71. package/dist/browser/{viewport-ChGNlxST.js → viewport-Ch_DyTlN.js} +2 -2
  72. package/dist/esm/components/Map/drawing/config/config-booth-badge.js +1 -1
  73. package/dist/esm/components/Map/drawing/config/config-booth-bookmark.d.ts +2 -2
  74. package/dist/esm/components/Map/drawing/config/config-booth-bookmark.js +1 -1
  75. package/dist/esm/components/Map/drawing/config/config-booth-labels-special.js +2 -2
  76. package/dist/esm/components/Map/drawing/config/config-booth-labels.js +1 -1
  77. package/dist/esm/engine/update-def.d.ts +19 -28
  78. package/dist/esm/engine/update-def.js +1 -1
  79. package/dist/esm/engine/utils/rotation.d.ts +9 -2
  80. package/dist/esm/engine/utils/rotation.js +1 -1
  81. package/dist/esm/floorplan.loader.js +1 -1
  82. package/dist/esm/floorplan.ready.js +1 -1
  83. package/dist/esm/wayfinding/createWayfinding.js +1 -1
  84. package/package.json +10 -10
@@ -1,14 +1,14 @@
1
1
  (function() {
2
2
  try {
3
3
  var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {};
4
- e.SENTRY_RELEASE = { id: "3.31.4" };
4
+ e.SENTRY_RELEASE = { id: "3.32.0" };
5
5
  var t = new e.Error().stack;
6
6
  t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "edf52ee9-f3a6-424f-a5ff-f0c8342333ab", e._sentryDebugIdIdentifier = "sentry-dbid-edf52ee9-f3a6-424f-a5ff-f0c8342333ab");
7
7
  } catch {}
8
8
  })();
9
- import { t as e } from "./jsx-runtime-CynehOvT.js";
10
- import { t } from "./settings-item-CI4tQ7cI.js";
11
- import { t as n } from "./text-field-CoMIE2tV.js";
9
+ import { t as e } from "./jsx-runtime-DLehizIL.js";
10
+ import { t } from "./settings-item-JOfQImsE.js";
11
+ import { t as n } from "./text-field-D4_C8M62.js";
12
12
  //#region ../debug/src/lib/ui/string-editor.tsx
13
13
  var r = e(), i = (e) => {
14
14
  var i;
@@ -1,15 +1,15 @@
1
1
  (function() {
2
2
  try {
3
3
  var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {};
4
- e.SENTRY_RELEASE = { id: "3.31.4" };
4
+ e.SENTRY_RELEASE = { id: "3.32.0" };
5
5
  var t = new e.Error().stack;
6
6
  t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "b57a1337-f6ba-488a-8e6f-60f9358b45a2", e._sentryDebugIdIdentifier = "sentry-dbid-b57a1337-f6ba-488a-8e6f-60f9358b45a2");
7
7
  } catch {}
8
8
  })();
9
- import { r as e } from "./rolldown-runtime-CWbAMcOK.js";
10
- import { t } from "./react-Bg9SS9K3.js";
11
- import { D as n, i as r, l as i, n as a, s as o, u as s, y as c } from "./flex-DpIfGOfP.js";
12
- import { t as l } from "./classnames-SVpBLYbY.js";
9
+ import { r as e } from "./rolldown-runtime-Dl53HvP8.js";
10
+ import { t } from "./react-DaVp-1nR.js";
11
+ import { D as n, i as r, l as i, n as a, s as o, u as s, y as c } from "./flex-Dd9f0dfq.js";
12
+ import { t as l } from "./classnames-XNi7nRCB.js";
13
13
  //#region ../../node_modules/.pnpm/@radix-ui+themes@3.3.0_@types+react-dom@19.2.3_@types+react@19.2.17__@types+react@19.2._5ea800d4e947acedb1fa1275f1697b17/node_modules/@radix-ui/themes/dist/esm/components/text-field.props.js
14
14
  var u = /* @__PURE__ */ e(t()), d = /* @__PURE__ */ e(l()), f = {
15
15
  size: {
@@ -1,18 +1,18 @@
1
1
  (function() {
2
2
  try {
3
3
  var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {};
4
- e.SENTRY_RELEASE = { id: "3.31.4" };
4
+ e.SENTRY_RELEASE = { id: "3.32.0" };
5
5
  var t = new e.Error().stack;
6
6
  t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "f5429b84-6f5b-4b20-898f-e5345902ef44", e._sentryDebugIdIdentifier = "sentry-dbid-f5429b84-6f5b-4b20-898f-e5345902ef44");
7
7
  } catch {}
8
8
  })();
9
- import { r as e } from "./rolldown-runtime-CWbAMcOK.js";
10
- import { t } from "./react-Bg9SS9K3.js";
11
- import { t as n } from "./jsx-runtime-CynehOvT.js";
12
- import { t as r } from "./react-dom-CkvLw93N.js";
13
- import { C as i, E as a, O as o, T as s, _ as c, o as l, v as u, w as d } from "./flex-DpIfGOfP.js";
14
- import { c as f, i as p, n as m, o as h, r as g, s as _, t as v } from "./dist-EaU_txHC.js";
15
- import { t as y } from "./classnames-SVpBLYbY.js";
9
+ import { r as e } from "./rolldown-runtime-Dl53HvP8.js";
10
+ import { t } from "./react-DaVp-1nR.js";
11
+ import { t as n } from "./jsx-runtime-DLehizIL.js";
12
+ import { t as r } from "./react-dom-Cmin4STP.js";
13
+ import { C as i, E as a, O as o, T as s, _ as c, o as l, v as u, w as d } from "./flex-Dd9f0dfq.js";
14
+ import { c as f, i as p, n as m, o as h, r as g, s as _, t as v } from "./dist-CEbPeqIY.js";
15
+ import { t as y } from "./classnames-XNi7nRCB.js";
16
16
  //#region ../../node_modules/.pnpm/@radix-ui+react-visually-hidden@1.2.3_@types+react-dom@19.2.3_@types+react@19.2.17__@ty_cffccd7838985066e8e1d993b5cb6017/node_modules/@radix-ui/react-visually-hidden/dist/index.mjs
17
17
  var b = /* @__PURE__ */ e(r(), 1), x = /* @__PURE__ */ e(t(), 1), S = n(), C = Object.freeze({
18
18
  position: "absolute",
@@ -1,17 +1,17 @@
1
1
  (function() {
2
2
  try {
3
3
  var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {};
4
- e.SENTRY_RELEASE = { id: "3.31.4" };
4
+ e.SENTRY_RELEASE = { id: "3.32.0" };
5
5
  var t = new e.Error().stack;
6
6
  t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "cbb5c555-77ff-4375-8420-80c8ae476dcf", e._sentryDebugIdIdentifier = "sentry-dbid-cbb5c555-77ff-4375-8420-80c8ae476dcf");
7
7
  } catch {}
8
8
  })();
9
- import { r as e } from "./rolldown-runtime-CWbAMcOK.js";
10
- import { a as t, i as n, s as r } from "./efp-debug-init-Ce9vg6Tq.js";
11
- import { a as i, i as a } from "./adopt-global-settings--uzHm07K.js";
12
- import { t as o } from "./jsx-runtime-CynehOvT.js";
13
- import "./settings-DZPzvL3g.js";
14
- import { t as s } from "./add-debug-secret-listener-WhcgG7GC.js";
9
+ import { r as e } from "./rolldown-runtime-Dl53HvP8.js";
10
+ import { a as t, i as n, s as r } from "./efp-debug-init-CF3R1rs1.js";
11
+ import { a as i, i as a } from "./adopt-global-settings-BCXdoUeA.js";
12
+ import { t as o } from "./jsx-runtime-DLehizIL.js";
13
+ import "./settings-BnizsqhF.js";
14
+ import { t as s } from "./add-debug-secret-listener-BCbwpSUA.js";
15
15
  //#region ../debug/src/lib/ui/render-debug-ui.tsx
16
16
  var c = /* @__PURE__ */ e(r(), 1), l = o(), u = !1;
17
17
  function d() {
@@ -26,7 +26,7 @@ function d() {
26
26
  }
27
27
  });
28
28
  let o = async (t) => {
29
- let { DebugUi: n } = await import("./debug-ui-BVfBVFN5.js"), { createRoot: i } = await import("./client-wCjB5vyj.js").then((t) => /* @__PURE__ */ e(t.t(), 1)), a = document.createElement("div");
29
+ let { DebugUi: n } = await import("./debug-ui-D9GVgxaS.js"), { createRoot: i } = await import("./client-CA8cGn8U.js").then((t) => /* @__PURE__ */ e(t.t(), 1)), a = document.createElement("div");
30
30
  document.body.appendChild(a), i(a).render(/* @__PURE__ */ (0, l.jsx)(n, {
31
31
  useDebugButtonState: r.useState,
32
32
  open: t
@@ -1,14 +1,14 @@
1
1
  (function() {
2
2
  try {
3
3
  var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {};
4
- e.SENTRY_RELEASE = { id: "3.31.4" };
4
+ e.SENTRY_RELEASE = { id: "3.32.0" };
5
5
  var t = new e.Error().stack;
6
6
  t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "7407e64e-4c4e-4bfb-b2ef-80063ad22998", e._sentryDebugIdIdentifier = "sentry-dbid-7407e64e-4c4e-4bfb-b2ef-80063ad22998");
7
7
  } catch {}
8
8
  })();
9
- import { r as e } from "./rolldown-runtime-CWbAMcOK.js";
10
- import { t } from "./react-Bg9SS9K3.js";
11
- import { l as n } from "./store-9H2zTJOB.js";
9
+ import { r as e } from "./rolldown-runtime-Dl53HvP8.js";
10
+ import { t } from "./react-DaVp-1nR.js";
11
+ import { l as n } from "./store-BNPYvlw8.js";
12
12
  //#region ../ui/src/shared/activeElement.ts
13
13
  var r = (e) => !!e && "activeElement" in e;
14
14
  function i(e) {
@@ -1,12 +1,12 @@
1
1
  (function() {
2
2
  try {
3
3
  var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {};
4
- e.SENTRY_RELEASE = { id: "3.31.4" };
4
+ e.SENTRY_RELEASE = { id: "3.32.0" };
5
5
  var t = new e.Error().stack;
6
6
  t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "30d5a1aa-2d79-4710-91d1-937109f43b1a", e._sentryDebugIdIdentifier = "sentry-dbid-30d5a1aa-2d79-4710-91d1-937109f43b1a");
7
7
  } catch {}
8
8
  })();
9
- import { c as e, vt as t } from "./store-9H2zTJOB.js";
9
+ import { c as e, vt as t } from "./store-BNPYvlw8.js";
10
10
  //#region src/components/Map/viewport.ts
11
11
  function n(e) {
12
12
  return {
@@ -1 +1 @@
1
- import{Box as J,pointRotate as R,Polygon as K,Rect as v}from"@expofp/geometry";import{update as L}from"@expofp/renderer";import Q from"color";import{reaction as P}from"mobx";import{SEPARATOR as G}from"../../../../constants";import U from"../../../../data";import{getTrianglesFromFpPaths as Y}from"../../../../data/svg";import{createShapeDef as tt,createTextDef as et,createTextDefLines as nt}from"../../../../engine/defs";import{loadCustomFontsUrls as ot}from"../../../../engine/fonts";import{getRollValue as rt,getRotation as st}from"../../../../engine/update-def";import{boothStore as it,uiState as N}from"../../../../store";import{RegularBooth as ct}from"../../../../store/BoothStore";import k from"../../../../tools/settings";import{getContrastTextColor as at}from"../../../../utils/getContrastTextColor";import{getFont as lt}from"./canvases";import{isBoothBadgeEligible as dt}from"./config-booth-badge-eligibility";import{getBadgeFontWeight as ht,getFontUrlByWeight as ut}from"./config-booth-labels";const ft=.5,gt=.3,z=15,mt=24,X=30,xt=12,pt=12,Z=.8,V=document.createElement("canvas").getContext("2d");function yt(t){return t.length<=z?t:t.slice(0,z-1)+"\u2026"}function j(t){if(!t.paths?.length)return[];const n=t.layer?.name||"",e=[];for(const o of t.paths)for(const r of Y(o.index,n))e.push(r);return e}function Bt(t){const n=j(t);return n.length?J.fromPoints(n.flat().map(([e,o])=>({x:e,y:o}))):null}function St(t){const n=[],e=[];for(const o of t){const r=n.length;n.push({x:o[0][0],y:o[0][1]}),n.push({x:o[1][0],y:o[1][1]}),n.push({x:o[2][0],y:o[2][1]}),e.push([r,r+1,r+2])}return new K(n,e)}function H(t,n,e){return e.containsPoint({x:t,y:n})}function At(t,n,e,o,r,d,i,c){if(!t.length||!H(e,o,n))return i;const h={x:e,y:o};let a=0,f=i;const A=10;for(let y=0;y<A;y++){const m=(a+f)/2,I=r*m,g=d*m;[R({x:e+I,y:o},c,h),R({x:e,y:o+g},c,h),R({x:e+I,y:o+g},c,h)].every(l=>H(l.x,l.y,n))?a=m:f=m}return a}function Et(t){return Bt(t)??t.rect}function Tt(t,n,e,o,r,d){if(n.length){const a=Et(t),f={x:r>0?a.min.x:a.max.x,y:d>0?a.min.y:a.max.y},A=new Set;let y=null,m=1/0;for(const I of n)for(const g of I){const _=`${g[0]},${g[1]}`;if(A.has(_))continue;A.add(_);const u=g[0]+o*r,l=g[1]+o*d;if(H(u,l,e)){const B=Math.abs(u-f.x)+Math.abs(l-f.y);B<m&&(m=B,y={x:u,y:l})}}if(y)return y}const i=r>0?t.rect.min.x+o:t.rect.max.x-o,c=d>0?t.rect.min.y+o:t.rect.max.y-o,h=t.rotate??0;return h?R({x:i,y:c},h,t.rect.center):{x:i,y:c}}function W(t){return t&&t!=="none"?t:void 0}function It(t){const n=W(t.borderColor)||W(k.boothBorderColor)||k.colors.booths.default;return t.paths?.length>1&&W(t.paths[t.paths.length-1].color)||n}export function createBoothBadge(t){const n=yt(t.title||t.name),e=It(t),o=at(Q(e).hex()),r=ht(),d=lt(X,r);V.font=d;const i=V.measureText(n).width,c=Math.ceil(i+xt*2),h=X+pt*2,a=(t.borderWidth||it.borderWidth)/2,f=c*Z,A=h*Z,y=t.rect.size.width,m=t.rect.size.height,I=s=>{const E=s?m:y,p=s?y:m;return Math.min(E>0?E*ft/f:1/0,p>0?p*gt/A:1/0)},g=j(t),_=St(g);let u=t.rotate??0,l=0,B=0,D=0,O=0;const w=()=>{const p=Tt(t,g,_,a,l===0||l===3?1:-1,l===0||l===1?1:-1);B=p.x,D=p.y;const T=I(l===1||l===3);O=At(g,_,B,D,f,A,T,u)};w();const F=(s,E)=>{const p=s/2,T=E/2,q=R({x:B+p,y:D+T},u,{x:B,y:D});return new v(q,{x:s,y:E},u,t.elevation)},$=ut(r,ot()),x=tt(F(1,1),e);x.hidden=!0,x.dim=t.skipDim?0:void 0;const S=et(nt([[n],[]],o,0,[$,$]),F(1,1),[0,0],{horizontal:"center",vertical:"center"});S.hidden=!0,S.dim=t.skipDim?0:void 0;const C={booth:t,anchor:{x:B,y:D},source:{x:f,y:A},rotation:u,maxScale:O,bg:x,text:S},M=new BoothBadgeDrawer(C);x.onScale=({pixelSize:s})=>M.layOutBg(s),S.onScale=({pixelSize:s})=>M.layOutText(s);const b=[];return b.push(P(()=>t.skipDim,s=>{x.dim=s?0:void 0,S.dim=s?0:void 0,L(x,S)})),b.push(P(()=>t.layer?.visible??!0,s=>{x.hidden=!s,S.hidden=!s,L(x,S)})),b.push(P(()=>N.mapSettings,({roll:s})=>{rt(s??0)&&(x.onRoll=({roll:E,pixelSize:p})=>{const T=st(E,u);if(T!==void 0)return u+=T,l=(l+(T>0?1:3))%4,w(),C.anchor.x=B,C.anchor.y=D,C.rotation=u,C.maxScale=O,[...M.layOutBg(p),...M.layOutText(p)]})},{fireImmediately:!0})),{bg:x,text:S,dispose:()=>{b.forEach(s=>s()),b.length=0}}}export class BoothBadgeDrawer{constructor(n){this.placement=n}layOutBg(n){const{bg:e}=this.placement;return e.shape=this.rectScaled(n),e.hidden=this.isHidden(),e.hidden?[]:[e]}layOutText(n){const{text:e,maxScale:o}=this.placement;return e.lines[0].fontSize=mt*Math.min(n,o),e.bounds=this.rectScaled(n),e.hidden=this.isHidden(),e.hidden?[]:[e]}rectScaled(n){const{anchor:e,booth:o,source:r,rotation:d,maxScale:i}=this.placement,c=Math.min(n,i),h=r.x*c,a=r.y*c,f=R({x:e.x+h/2,y:e.y+a/2},d,e);return new v(f,{x:h,y:a},d,o.elevation)}isHidden(){const{booth:n}=this.placement;return!!(n.layer&&!n.layer.visible)}}export function configBoothsBadges(t,n){const e=[],o=[],r=[];for(const i of n)if(i instanceof ct&&dt({hideExhibitorBoothNumber:U.hideExhibitorBoothNumber,hideBoothBadges:U.hideBoothBadges,hideLogoInBooth:N.hideLogoInBooth,noLabels:i.noLabels,hasExhibitors:i.exhibitors.length>0,hasLogoInBooth:i.exhibitors.some(c=>c.logoInBooth&&c.logo)})){const{bg:c,text:h,dispose:a}=createBoothBadge(i);e.push(c),o.push(h),r.push(a)}const d=()=>{r.forEach(i=>i()),r.length=0};return e.length?{layer:{name:`${t}${G}badges`,children:[{name:`${t}${G}badgeBgs`,children:e},{name:`${t}${G}badgeTexts`,children:o}]},cleanup:d}:{layer:null,cleanup:d}}
1
+ import{Box as q,pointRotate as R,Polygon as J,Rect as v}from"@expofp/geometry";import{update as L}from"@expofp/renderer";import K from"color";import{reaction as P}from"mobx";import{SEPARATOR as G}from"../../../../constants";import U from"../../../../data";import{getTrianglesFromFpPaths as Y}from"../../../../data/svg";import{createShapeDef as tt,createTextDef as et,createTextDefLines as nt}from"../../../../engine/defs";import{loadCustomFontsUrls as ot}from"../../../../engine/fonts";import{getQuarterTurns as rt,getRollValue as st}from"../../../../engine/update-def";import{boothStore as it,uiState as N}from"../../../../store";import{RegularBooth as ct}from"../../../../store/BoothStore";import k from"../../../../tools/settings";import{getContrastTextColor as at}from"../../../../utils/getContrastTextColor";import{getFont as lt}from"./canvases";import{isBoothBadgeEligible as ht}from"./config-booth-badge-eligibility";import{getBadgeFontWeight as dt,getFontUrlByWeight as ut}from"./config-booth-labels";const ft=.5,gt=.3,z=15,mt=24,X=30,xt=12,pt=12,Z=.8,Q=document.createElement("canvas").getContext("2d");function yt(t){return t.length<=z?t:t.slice(0,z-1)+"\u2026"}function V(t){if(!t.paths?.length)return[];const n=t.layer?.name||"",e=[];for(const o of t.paths)for(const r of Y(o.index,n))e.push(r);return e}function Bt(t){const n=V(t);return n.length?q.fromPoints(n.flat().map(([e,o])=>({x:e,y:o}))):null}function St(t){const n=[],e=[];for(const o of t){const r=n.length;n.push({x:o[0][0],y:o[0][1]}),n.push({x:o[1][0],y:o[1][1]}),n.push({x:o[2][0],y:o[2][1]}),e.push([r,r+1,r+2])}return new J(n,e)}function H(t,n,e){return e.containsPoint({x:t,y:n})}function At(t,n,e,o,r,h,i,c){if(!t.length||!H(e,o,n))return i;const d={x:e,y:o};let a=0,f=i;const A=10;for(let y=0;y<A;y++){const m=(a+f)/2,I=r*m,g=h*m;[R({x:e+I,y:o},c,d),R({x:e,y:o+g},c,d),R({x:e+I,y:o+g},c,d)].every(l=>H(l.x,l.y,n))?a=m:f=m}return a}function Et(t){return Bt(t)??t.rect}function Tt(t,n,e,o,r,h){if(n.length){const a=Et(t),f={x:r>0?a.min.x:a.max.x,y:h>0?a.min.y:a.max.y},A=new Set;let y=null,m=1/0;for(const I of n)for(const g of I){const _=`${g[0]},${g[1]}`;if(A.has(_))continue;A.add(_);const u=g[0]+o*r,l=g[1]+o*h;if(H(u,l,e)){const B=Math.abs(u-f.x)+Math.abs(l-f.y);B<m&&(m=B,y={x:u,y:l})}}if(y)return y}const i=r>0?t.rect.min.x+o:t.rect.max.x-o,c=h>0?t.rect.min.y+o:t.rect.max.y-o,d=t.rotate??0;return d?R({x:i,y:c},d,t.rect.center):{x:i,y:c}}function W(t){return t&&t!=="none"?t:void 0}function It(t){const n=W(t.borderColor)||W(k.boothBorderColor)||k.colors.booths.default;return t.paths?.length>1&&W(t.paths[t.paths.length-1].color)||n}export function createBoothBadge(t){const n=yt(t.title||t.name),e=It(t),o=at(K(e).hex()),r=dt(),h=lt(X,r);Q.font=h;const i=Q.measureText(n).width,c=Math.ceil(i+xt*2),d=X+pt*2,a=(t.borderWidth||it.borderWidth)/2,f=c*Z,A=d*Z,y=t.rect.size.width,m=t.rect.size.height,I=s=>{const E=s?m:y,p=s?y:m;return Math.min(E>0?E*ft/f:1/0,p>0?p*gt/A:1/0)},g=V(t),_=St(g);let u=t.rotate??0,l=0,B=0,D=0,O=0;const w=()=>{const p=Tt(t,g,_,a,l===0||l===3?1:-1,l===0||l===1?1:-1);B=p.x,D=p.y;const T=I(l===1||l===3);O=At(g,_,B,D,f,A,T,u)};w();const F=(s,E)=>{const p=s/2,T=E/2,j=R({x:B+p,y:D+T},u,{x:B,y:D});return new v(j,{x:s,y:E},u,t.elevation)},$=ut(r,ot()),x=tt(F(1,1),e);x.hidden=!0,x.dim=t.skipDim?0:void 0;const S=et(nt([[n],[]],o,0,[$,$]),F(1,1),[0,0],{horizontal:"center",vertical:"center"});S.hidden=!0,S.dim=t.skipDim?0:void 0;const C={booth:t,anchor:{x:B,y:D},source:{x:f,y:A},rotation:u,maxScale:O,bg:x,text:S},b=new BoothBadgeDrawer(C);x.onScale=({pixelSize:s})=>b.layOutBg(s),S.onScale=({pixelSize:s})=>b.layOutText(s);const M=[];return M.push(P(()=>t.skipDim,s=>{x.dim=s?0:void 0,S.dim=s?0:void 0,L(x,S)})),M.push(P(()=>t.layer?.visible??!0,s=>{x.hidden=!s,S.hidden=!s,L(x,S)})),M.push(P(()=>N.mapSettings,({roll:s})=>{st(s??0)&&(x.onRoll=({roll:E,pixelSize:p})=>{const T=rt(E,u);if(T!==0)return u+=T*Math.PI/2,l=((l+T)%4+4)%4,w(),C.anchor.x=B,C.anchor.y=D,C.rotation=u,C.maxScale=O,[...b.layOutBg(p),...b.layOutText(p)]})},{fireImmediately:!0})),{bg:x,text:S,dispose:()=>{M.forEach(s=>s()),M.length=0}}}export class BoothBadgeDrawer{constructor(n){this.placement=n}layOutBg(n){const{bg:e}=this.placement;return e.shape=this.rectScaled(n),e.hidden=this.isHidden(),e.hidden?[]:[e]}layOutText(n){const{text:e,maxScale:o}=this.placement;return e.lines[0].fontSize=mt*Math.min(n,o),e.bounds=this.rectScaled(n),e.hidden=this.isHidden(),e.hidden?[]:[e]}rectScaled(n){const{anchor:e,booth:o,source:r,rotation:h,maxScale:i}=this.placement,c=Math.min(n,i),d=r.x*c,a=r.y*c,f=R({x:e.x+d/2,y:e.y+a/2},h,e);return new v(f,{x:d,y:a},h,o.elevation)}isHidden(){const{booth:n}=this.placement;return!!(n.layer&&!n.layer.visible)}}export function configBoothsBadges(t,n){const e=[],o=[],r=[];for(const i of n)if(i instanceof ct&&ht({hideExhibitorBoothNumber:U.hideExhibitorBoothNumber,hideBoothBadges:U.hideBoothBadges,hideLogoInBooth:N.hideLogoInBooth,noLabels:i.noLabels,hasExhibitors:i.exhibitors.length>0,hasLogoInBooth:i.exhibitors.some(c=>c.logoInBooth&&c.logo)})){const{bg:c,text:d,dispose:a}=createBoothBadge(i);e.push(c),o.push(d),r.push(a)}const h=()=>{r.forEach(i=>i()),r.length=0};return e.length?{layer:{name:`${t}${G}badges`,children:[{name:`${t}${G}badgeBgs`,children:e},{name:`${t}${G}badgeTexts`,children:o}]},cleanup:h}:{layer:null,cleanup:h}}
@@ -1,6 +1,6 @@
1
1
  import { Rect } from '@expofp/geometry';
2
- import { ImageDef } from '@expofp/renderer';
3
- import { Booth } from '../../../../store/BoothStore';
2
+ import { type ImageDef } from '@expofp/renderer';
3
+ import type { Booth } from '../../../../store/BoothStore';
4
4
  import { BoothDrawerBaseWithoutPainter } from './BoothDrawerBase';
5
5
  export default function configBoothBookmarkImage(booth: Booth): BoothBookmarkDrawer | undefined;
6
6
  export declare class BoothBookmarkDrawer extends BoothDrawerBaseWithoutPainter {
@@ -1 +1 @@
1
- import{Rect as r}from"@expofp/geometry";import{update as m}from"@expofp/renderer";import{reaction as s}from"mobx";import{createBookmarkCanvas as p}from"../../../../engine/canvases";import{createImageDef as c}from"../../../../engine/defs";import{getClampedBoundsCanvas as k,getRollValue as u,getRotation as l}from"../../../../engine/update-def";import{layersStore as a,uiState as h}from"../../../../store";import{BoothDrawerBaseWithoutPainter as f}from"./BoothDrawerBase";export default function b(i){if(!h.kiosk)return new BoothBookmarkDrawer(i)}export class BoothBookmarkDrawer extends f{constructor(t){super(t),this.getShape=()=>this.shape,this.padding=this.booth.borderWidth/2,this.rect=new r(this.booth.rect.center,this.booth.rect.size,this.booth.rotate,this.booth.elevation),this.canvas=p(11,devicePixelRatio),this.bookmarkId=`bookmark-${this.booth.id}`,this.shape=c(this.canvas,this.rect,{hidden:!t.bookmarked}),this.shape.onScale=({pixelSize:e})=>this.layOutBookmark(e),s(()=>[t.bookmarked,a.layersLoaded,this.booth.skipDim],()=>this.update(t.bookmarked),{fireImmediately:t.bookmarked}),s(()=>h.mapSettings,({roll:e})=>{u(e)&&(this.shape.onRoll=({roll:n,pixelSize:d})=>{const o=l(n,this.rect.rotation);if(o!==void 0)return this.rect=new r(this.rect.center,{x:this.rect.size.y,y:this.rect.size.x},this.rect.rotation+o,this.rect.elevation),this.layOutBookmark(d),[this.shape]})},{fireImmediately:!0})}update(t){a.layersLoaded&&(this.shape.hidden=!t,this.shape.dim=this.booth.skipDim?0:void 0,m(this.shape))}layOutBookmark(t){return this.shape.bounds=k(this.rect,this.canvas,this.padding,t),this.shape.hidden?[]:[this.shape]}}
1
+ import{Rect as m}from"@expofp/geometry";import{update as d}from"@expofp/renderer";import{reaction as i}from"mobx";import{createBookmarkCanvas as p}from"../../../../engine/canvases";import{createImageDef as u}from"../../../../engine/defs";import{getClampedBoundsCanvas as k,getQuarterTurns as c,getRollValue as l,rotateRectByQuarters as f}from"../../../../engine/update-def";import{layersStore as a,uiState as s}from"../../../../store";import{BoothDrawerBaseWithoutPainter as b}from"./BoothDrawerBase";export default function B(r){if(!s.kiosk)return new BoothBookmarkDrawer(r)}export class BoothBookmarkDrawer extends b{constructor(t){super(t),this.getShape=()=>this.shape,this.padding=this.booth.borderWidth/2,this.rect=new m(this.booth.rect.center,this.booth.rect.size,this.booth.rotate,this.booth.elevation),this.canvas=p(11,devicePixelRatio),this.bookmarkId=`bookmark-${this.booth.id}`,this.shape=u(this.canvas,this.rect,{hidden:!t.bookmarked}),this.shape.onScale=({pixelSize:e})=>this.layOutBookmark(e),i(()=>[t.bookmarked,a.layersLoaded,this.booth.skipDim],()=>this.update(t.bookmarked),{fireImmediately:t.bookmarked}),i(()=>s.mapSettings,({roll:e})=>{l(e??0)&&(this.shape.onRoll=({roll:h,pixelSize:n})=>{const o=c(h,this.rect.rotation);if(o!==0)return this.rect=f(this.rect,o),this.layOutBookmark(n),[this.shape]})},{fireImmediately:!0})}update(t){a.layersLoaded&&(this.shape.hidden=!t,this.shape.dim=this.booth.skipDim?0:void 0,d(this.shape))}layOutBookmark(t){return this.shape.bounds=k(this.rect,this.canvas,this.padding,t),this.shape.hidden?[]:[this.shape]}}
@@ -1,2 +1,2 @@
1
- import{Rect as m}from"@expofp/geometry";import{update as L}from"@expofp/renderer";import{reaction as f}from"mobx";import{FONT_WEIGHT_PRIMARY_BOOTH as g,FONT_WEIGHT_PRIMARY_SPECIAL as D}from"../../../../constants";import{createTextDef as y}from"../../../../engine/defs";import{loadCustomFontsUrls as F}from"../../../../engine/fonts";import{getRollValue as R,getRotation as x,shouldFlip as S,updateRectRotation as T,updateTextDefRotation as v}from"../../../../engine/update-def";import{heatmapStore as I,layersStore as w,uiState as l}from"../../../../store";import{SpecialBooth as z}from"../../../../store/BoothStore";import M from"../../../../tools/settings";import{getFont as O}from"./canvases";import{BoothLabelDrawer as k,getFontUrlByWeight as B,getMinZoomFactorForDot as C,isDirectionsMode as P}from"./config-booth-labels";import{LABEL_MARGIN_FRACTION as b}from"./label-inset.js";import _ from"./TextFitter";const c=new Map;function A(i){let t=c.get(i);if(!t){const s=[18,16,14,12,10,7].map(a=>a*i),e=14*i;t=new _(O,s,e),c.set(i,t),setTimeout(()=>c.delete(i),5e3)}return t}export default function N(i){if(!(!(i instanceof z)||i.noLabels))return new V(i)}class V extends k{constructor(t){super(t),this.steps=[],this.text="";const s=this.booth.rect,e=Number(getComputedStyle(document.body).getPropertyValue(D))||Number(getComputedStyle(document.body).getPropertyValue(g))||500,a=B(e,F()),h=s.expand({x:-(s.size.width*b+this.padding),y:-(s.size.height*b+this.padding)});this.setText(),this.canvasRect=new m(h.center,h.size,t.rotate,t.elevation),this.setFactors(this.text),this.labelIsVertical=Math.abs(Math.abs(t.rotate)-Math.PI/2)<.01,this.fontSizes=[this.steps,[]],this.minZoomDotVisible=C(this.steps.map(o=>o.scaleFactor)),this.shapeLabel=y([{text:this.text,color:t.labelColor||M.boothLabelColor,fontUrl:a,fontSize:0}],new m(h.center,h.size,t.rotate,t.elevation),[this.padding,this.padding],{horizontal:"center",text:"center",vertical:"center"}),this.shapeLabel.onScale=({pixelSize:o})=>this.layOutLabel(o),this.getShapeDot(),f(()=>[this.booth.skipDim,l.selectedRoute,w.layersLoaded],()=>{const o=P();this.shapeLabel.dim=o||this.booth.skipDim?!1:void 0,this.shapeDot.dim=o||this.booth.skipDim?!1:void 0,L(this.shapeLabel,this.shapeDot)}),f(()=>l.mapSettings,({roll:o})=>{R(o??0)&&(this.shapeLabel.onRoll=({roll:p,pixelSize:d})=>{const n=this.shapeLabel.bounds.rotation;if(this.labelIsVertical)return S(p,n)?(this.shapeLabel.bounds.rotate(-2*n,this.shapeLabel.bounds),[this.shapeLabel,this.shapeDot]):void 0;const r=x(p,n);if(r===void 0)return;const{size:u}=this.canvasRect;return this.shapeLabel=v(this.shapeLabel,r),u.x!==u.y&&!this.shapeLabel.hidden&&(this.canvasRect=T(this.canvasRect,r),this.setFactors(this.text),this.layOutLabel(d),this.layOutDot(d)),[this.shapeLabel,this.shapeDot]})},{fireImmediately:!0})}getShape(){return[this.shapeLabel,this.shapeDot]}layOutLabel(t){const s=this.steps.find(e=>e.scaleFactor<1/t);return s?(this.shapeLabel.lines[0].fontSize=s.value*t,this.shapeLabel.lines[0].text=s.lines.join(`
2
- `),this.shapeLabel.padding=[this.paddingScaled[0]*t+this.padding,this.paddingScaled[1]*t+this.padding],[this.shapeLabel]):(this.shapeLabel.lines[0].fontSize=0,[this.shapeLabel])}layOutDot(t){const s=this.steps.find(a=>a.scaleFactor<1/t),e=this.shapeDot.bounds;return e.scale({x:this.shapeDot.source.width*t/e.size.x,y:this.shapeDot.source.height*t/e.size.y},e.center,e),this.shapeDot.hidden=!!s,[this.shapeDot]}setFactors(t){this.steps=A(devicePixelRatio).getStepsForRect(t,this.canvasRect.size.x,this.canvasRect.size.y)}setText(){const t=this.booth.title||this.booth.name,e=`Clicks: ${I.getTotalClicksByBooth(this.booth)}`;this.text=l.heatmap?`${t} - ${e}`:t}}
1
+ import{Rect as m}from"@expofp/geometry";import{update as L}from"@expofp/renderer";import{reaction as b}from"mobx";import{FONT_WEIGHT_PRIMARY_BOOTH as g,FONT_WEIGHT_PRIMARY_SPECIAL as D}from"../../../../constants";import{createTextDef as y}from"../../../../engine/defs";import{loadCustomFontsUrls as F}from"../../../../engine/fonts";import{getQuarterTurns as x,getRollValue as R,rotateRectByQuarters as S,rotateTextDefByQuarters as T,shouldFlip as v}from"../../../../engine/update-def";import{heatmapStore as B,layersStore as I,uiState as l}from"../../../../store";import{SpecialBooth as w}from"../../../../store/BoothStore";import z from"../../../../tools/settings";import{getFont as M}from"./canvases";import{BoothLabelDrawer as O,getFontUrlByWeight as k,getMinZoomFactorForDot as C,isDirectionsMode as P}from"./config-booth-labels";import{LABEL_MARGIN_FRACTION as f}from"./label-inset.js";import _ from"./TextFitter";const c=new Map;function A(i){let t=c.get(i);if(!t){const s=[18,16,14,12,10,7].map(o=>o*i),e=14*i;t=new _(M,s,e),c.set(i,t),setTimeout(()=>c.delete(i),5e3)}return t}export default function N(i){if(!(!(i instanceof w)||i.noLabels))return new V(i)}class V extends O{constructor(t){super(t),this.steps=[],this.text="";const s=this.booth.rect,e=Number(getComputedStyle(document.body).getPropertyValue(D))||Number(getComputedStyle(document.body).getPropertyValue(g))||500,o=k(e,F()),h=s.expand({x:-(s.size.width*f+this.padding),y:-(s.size.height*f+this.padding)});this.setText(),this.canvasRect=new m(h.center,h.size,t.rotate,t.elevation),this.setFactors(this.text),this.labelIsVertical=Math.abs(Math.abs(t.rotate)-Math.PI/2)<.01,this.fontSizes=[this.steps,[]],this.minZoomDotVisible=C(this.steps.map(a=>a.scaleFactor)),this.shapeLabel=y([{text:this.text,color:t.labelColor||z.boothLabelColor,fontUrl:o,fontSize:0}],new m(h.center,h.size,t.rotate,t.elevation),[this.padding,this.padding],{horizontal:"center",text:"center",vertical:"center"}),this.shapeLabel.onScale=({pixelSize:a})=>this.layOutLabel(a),this.getShapeDot(),b(()=>[this.booth.skipDim,l.selectedRoute,I.layersLoaded],()=>{const a=P();this.shapeLabel.dim=a||this.booth.skipDim?0:void 0,this.shapeDot.dim=a||this.booth.skipDim?0:void 0,L(this.shapeLabel,this.shapeDot)}),b(()=>l.mapSettings,({roll:a})=>{R(a??0)&&(this.shapeLabel.onRoll=({roll:p,pixelSize:d})=>{const r=this.shapeLabel.bounds.rotation;if(this.labelIsVertical)return v(p,r)?(this.shapeLabel.bounds.rotate(-2*r,this.shapeLabel.bounds),[this.shapeLabel,this.shapeDot]):void 0;const n=x(p,r);if(n===0)return;const{size:u}=this.canvasRect;return this.shapeLabel=T(this.shapeLabel,n),u.x!==u.y&&!this.shapeLabel.hidden&&(this.canvasRect=S(this.canvasRect,n),this.setFactors(this.text),this.layOutLabel(d),this.layOutDot(d)),[this.shapeLabel,this.shapeDot]})},{fireImmediately:!0})}getShape(){return[this.shapeLabel,this.shapeDot]}layOutLabel(t){const s=this.steps.find(e=>e.scaleFactor<1/t);return s?(this.shapeLabel.lines[0].fontSize=s.value*t,this.shapeLabel.lines[0].text=s.lines.join(`
2
+ `),this.shapeLabel.padding=[this.paddingScaled[0]*t+this.padding,this.paddingScaled[1]*t+this.padding],[this.shapeLabel]):(this.shapeLabel.lines[0].fontSize=0,[this.shapeLabel])}layOutDot(t){const s=this.steps.find(o=>o.scaleFactor<1/t),e=this.shapeDot.bounds;return e.scale({x:this.shapeDot.source.width*t/e.size.x,y:this.shapeDot.source.height*t/e.size.y},e.center,e),this.shapeDot.hidden=!!s,[this.shapeDot]}setFactors(t){this.steps=A(devicePixelRatio).getStepsForRect(t,this.canvasRect.size.x,this.canvasRect.size.y)}setText(){const t=this.booth.title||this.booth.name,e=`Clicks: ${B.getTotalClicksByBooth(this.booth)}`;this.text=l.heatmap?`${t} - ${e}`:t}}
@@ -1 +1 @@
1
- import{Rect as M}from"@expofp/geometry";import{update as U}from"@expofp/renderer";import{reaction as W}from"mobx";import{FONT_WEIGHT_PRIMARY_BOOTH as V,FONT_WEIGHT_PRIMARY_EXHIBITOR as Z,FONT_WEIGHT_SECONDARY_BOOTH as X,FONT_WEIGHT_SECONDARY_EXHIBITOR as G}from"../../../../constants";import c from"../../../../data";import{createShapeDot as k,createTextDef as Y,createTextDefLines as $}from"../../../../engine/defs";import{DEFAULT_FONT_LIGHT_URL as q,DEFAULT_FONT_URL as B,loadCustomFontsUrls as j}from"../../../../engine/fonts";import{getRollValue as J,getRotation as K,updateLinesScale as Q,updateRectRotation as tt,updateTextDefRotation as et}from"../../../../engine/update-def";import{boothStore as it,layersStore as _,uiState as m}from"../../../../store";import{RegularBooth as st,SpecialBooth as ot}from"../../../../store/BoothStore";import v from"../../../../tools/settings";import{t as S}from"../../../../utils/i18n";import nt from"../../../../utils/is-mobile";import at from"../../../../utils/is-webview";import{isArabicText as ht}from"../../../../utils/rtl";import{BoothDrawerBaseWithoutPainter as rt}from"./BoothDrawerBase";import{getFont as I}from"./canvases";import{getLabelBorderInset as lt}from"./label-inset.js";let z=v.boothLabelColor;v.EXPO==="tqs2021"&&(z="#000");const x=nt||at,F=n=>n.replace(" ","").substring(0,4).replace(/[0-9]/g,"3").replace(/[A-Z]/gi,"A"),P=document.createElement("canvas").getContext("2d");export default function ct(n){if(!(!(n instanceof st)||n.noLabels))return new BoothLabelDrawer(n)}export function getMinZoomFactorForDot(n){return Array.isArray(n)&&n.length>0?Math.max(...n.map(t=>t)):typeof n=="number"?n:-0}export const isDirectionsMode=()=>!!(m.selectedRoute?.from&&m.selectedRoute?.to);export function getFontUrlByWeight(n,t=[],e="normal"){return[...t,{weight:500,url:B,style:"normal"},{weight:300,url:q,style:"normal"}].find(s=>+s.weight===n&&s.style===e)?.url||B}function b(n,t){return Number(getComputedStyle(document.body).getPropertyValue(n))||t}export function getBoothLabelWeights(){return{main:b(V,500),details:b(X,300)}}export function getExhibitorLabelWeights(){return{main:b(Z,500),details:b(G,300)}}export function getBadgeFontWeight(){return getExhibitorLabelWeights().details}const R="Details";export class BoothLabelDrawer extends rt{constructor(t){super(t),this.minZoomDotVisible=0,this.maxZoomDotVisible=0,this.exh=[],this.shapeLabel=void 0,this.shapeDot=void 0,this.fontSizes=[[],[]],this.lines=[[],[]],this.fontUrls=["",""],this.canvasRect=new M(t.rect.center,t.rect.size,t.rotate,t.elevation),this.paddingScaled=[4,4],this.padding=lt(t.borderWidth||it.borderWidth,t.rect.size),this.topLeftAlignment={horizontal:m.rtl?"right":"left",vertical:"top"},this.centerAlignment={horizontal:"center",vertical:"center"},this.prefixes=x?[{fontSize:7,name:"XS",short:!0},{fontSize:10,name:"S",short:!0},{fontSize:16,name:R,short:!1}]:[{fontSize:7,name:"XS",short:!0},{fontSize:10,name:"S",short:!0},{fontSize:12,name:"M",short:!0},{fontSize:14,name:"L",short:!0},{fontSize:18,name:R,short:!1}],!(t instanceof ot)&&(this.exh=c.hideExhibitors?[]:c.onlyFeaturedExhibitors?t.exhibitors.filter(e=>e.featured):t.exhibitors,x&&this.optimizationLevel()>=3&&(this.prefixes=this.prefixes.filter(e=>e.name!=="S")),this.createLines(),this.calculateFontSizeFactors(),this.shapeLabel=Y($(this.lines,this.booth.labelColor||z,0,this.fontUrls),new M(this.booth.rect.center,this.booth.rect.size,this.booth.rotate,this.booth.elevation),[...this.paddingScaled],{horizontal:"left",vertical:"top"}),this.shapeLabel.onScale=({pixelSize:e})=>this.layOutLabel(e),this.getShapeDot(),W(()=>[this.booth.skipDim,m.selectedRoute,_.layersLoaded],()=>{if(!_.layersLoaded)return;const e=isDirectionsMode();this.shapeLabel.dim=e||this.booth.skipDim?0:void 0,this.shapeDot.dim=e||this.booth.skipDim?0:void 0,U(this.shapeLabel,this.shapeDot)}),W(()=>m.mapSettings,({roll:e})=>{J(e??0)&&(this.shapeLabel.onRoll=({roll:i,pixelSize:h})=>{const s=K(i,this.shapeLabel.bounds.rotation);if(s===void 0)return;const{size:a}=this.canvasRect;return this.shapeLabel=et(this.shapeLabel,s),!this.shapeLabel.hidden&&!this.exh.length&&a.x!==a.y&&(this.canvasRect=tt(this.canvasRect,s),this.calculateFontSizeFactors(),this.layOutLabel(h),this.layOutDot(h)),[this.shapeLabel,this.shapeDot]})},{fireImmediately:!0}))}getShape(){return[this.shapeLabel,this.shapeDot]}layOutLabel(t){const e=this.lines[1]??[],i=this.fontSizes[1]??[];if(v.EXPO!=="wineparis2026"){const s=this.exh.length?this.topLeftAlignment:e.length?t<i[i.length-1].scaleFactor?this.topLeftAlignment:this.centerAlignment:this.topLeftAlignment;this.shapeLabel.alignment=s}return Q(this.shapeLabel.lines,t,this.fontSizes)?(this.shapeLabel.padding[0]=this.paddingScaled[0]*t+this.padding,this.shapeLabel.padding[1]=this.paddingScaled[1]*t+this.padding,[this.shapeLabel]):[]}layOutDot(t){const e=t>=this.minZoomDotVisible&&t<=this.maxZoomDotVisible;if(!e&&this.shapeDot.hidden)return[];const i=this.shapeDot.bounds;return i.scale({x:this.shapeDot.source.width*t/i.size.x,y:this.shapeDot.source.height*t/i.size.y},i.center,i),this.shapeDot.hidden=!e,[this.shapeDot]}getShapeDot(){this.shapeDot=k(this.canvasRect,this.booth.labelColor||z),this.shapeDot.hidden=!0,this.shapeDot.onScale=({pixelSize:t})=>this.layOutDot(t),this.maxZoomDotVisible=Math.min(this.canvasRect.size.x/this.shapeDot.source.width,this.canvasRect.size.y/this.shapeDot.source.height)}createLines(){const t=this.booth,e=[],i=[],h=x&&this.optimizationLevel()>=3?1:3;if(this.exh.length){const s=t.exhibitors.filter(o=>o.order===0),a=t.exhibitors.filter(o=>o.order);if(s.length>0)e.push(...s.map(o=>o.name));else if(c.onlyFeaturedExhibitors)e.push(...t.exhibitors.filter(o=>o.featured).map(o=>o.name));else if(a.length>0){e.push(...a.map(p=>p.name));const o=t.exhibitors.filter(p=>p.order===void 0);o.length>0&&e.push(S("and {{moreCount}} more",{moreCount:o.length}))}else t.exhibitors.length>h?e.push(`${t.exhibitors.length} ${c.exhibitorTermPlural}`):e.push(...t.exhibitors.map(o=>o.name));i.push(t.title||t.name)}else{const s=!!t.exhibitors.length;e.push(t.title||t.name),t.onHold?i.push(S("On Hold")):t.reserved?i.push(S("Reserved")):s||i.push(...t.exhibitors.map(a=>a.name).sort((a,o)=>a>o?1:-1)),t.size&&i.push(t.size.indexOf("/")>-1?t.size.substring(0,t.size.indexOf("/")).trim():t.size),t.price&&t.price!=="0"&&!m.previewMode&&i.push(t.price)}m.rtl&&e.forEach((s,a)=>{(s.endsWith(".")||s.endsWith("!")||s.endsWith("?"))&&(e[a]=e[a]+"\u200F"),ht(s)&&(e[a]=e[a]+" ")}),this.lines=[e,i]}calculateFontSizeFactors(){const t=this.lines[0];let e;const i=this.canvasRect,h=[],s=[],a=this.prefixes.slice(0,this.exh.length?this.prefixes.length:this.prefixes.length-1),{main:o,details:p}=this.exh.length?getExhibitorLabelWeights():getBoothLabelWeights();for(const{fontSize:l,short:u}of a){const d=l*devicePixelRatio,L=.9*l*devicePixelRatio,f=I(d,o),T=I(L,p),O=c.hideExhibitorBoothNumber||u;let w,A,D,g;if(this.exh.length)e=u?[]:this.lines[1],D=Math.max(...t.map(r=>this.measureText(r,f).width),...e.map(r=>this.measureText(r,T).width)),w=Math.max(...t.map(r=>this.exh.length?this.measureText(F(r),f).width:this.measureText(F(r),f).width+3+3),...e.map(r=>this.measureText(F(r),T).width)),g=d*t.length+L*e.length+devicePixelRatio*(t.length+e.length)+3,A=O?g/t.length:null;else{const r=t[0].replace(/[0-9]/g,"3").replace(/[A-Z]/g,"A"),H=4;D=this.measureText(r,f).width+3+3,g=d+H}const C=i.size.x/(w||D),N=i.size.y/(A||g),E=Math.min(C,N);h.push({scaleFactor:E,value:d,lines:[]}),O||s.push({scaleFactor:E,value:L,lines:[]})}if(!this.exh.length){const l=h[h.length-1],u=this.prefixes.find(d=>d.name===R);u&&(h.push({scaleFactor:l.scaleFactor/1.8,value:u.fontSize*devicePixelRatio,lines:[]}),s.push({scaleFactor:l.scaleFactor/1.8,value:u.fontSize*(x?1:.9)*devicePixelRatio,lines:[]}))}const y=j();this.fontUrls=[getFontUrlByWeight(o,y),getFontUrlByWeight(p,y)],this.minZoomDotVisible=getMinZoomFactorForDot(h.map(l=>l.scaleFactor)),this.fontSizes=[h,s]}calcArea(t,e){return Math.floor(Math.max(0,t)*Math.max(0,e)/1e3)}optimizationLevel(){return Math.min(c.viewOptimizationLevel?c.viewOptimizationLevel:Math.floor(this.calcArea(this.canvasRect.size.x,this.canvasRect.size.y)/5e3),3)}measureText(t,e){return P.font=e,P.measureText(t)}}
1
+ import{Rect as B}from"@expofp/geometry";import{update as U}from"@expofp/renderer";import{reaction as M}from"mobx";import{FONT_WEIGHT_PRIMARY_BOOTH as V,FONT_WEIGHT_PRIMARY_EXHIBITOR as Z,FONT_WEIGHT_SECONDARY_BOOTH as X,FONT_WEIGHT_SECONDARY_EXHIBITOR as G}from"../../../../constants";import c from"../../../../data";import{createShapeDot as k,createTextDef as Y,createTextDefLines as Q}from"../../../../engine/defs";import{DEFAULT_FONT_LIGHT_URL as $,DEFAULT_FONT_URL as W,loadCustomFontsUrls as q}from"../../../../engine/fonts";import{getQuarterTurns as j,getRollValue as J,rotateRectByQuarters as K,rotateTextDefByQuarters as tt,updateLinesScale as et}from"../../../../engine/update-def";import{boothStore as it,layersStore as _,uiState as m}from"../../../../store";import{RegularBooth as st,SpecialBooth as ot}from"../../../../store/BoothStore";import v from"../../../../tools/settings";import{t as S}from"../../../../utils/i18n";import nt from"../../../../utils/is-mobile";import at from"../../../../utils/is-webview";import{isArabicText as ht}from"../../../../utils/rtl";import{BoothDrawerBaseWithoutPainter as rt}from"./BoothDrawerBase";import{getFont as I}from"./canvases";import{getLabelBorderInset as lt}from"./label-inset.js";let z=v.boothLabelColor;v.EXPO==="tqs2021"&&(z="#000");const x=nt||at,F=n=>n.replace(" ","").substring(0,4).replace(/[0-9]/g,"3").replace(/[A-Z]/gi,"A"),P=document.createElement("canvas").getContext("2d");export default function ct(n){if(!(!(n instanceof st)||n.noLabels))return new BoothLabelDrawer(n)}export function getMinZoomFactorForDot(n){return Array.isArray(n)&&n.length>0?Math.max(...n.map(t=>t)):typeof n=="number"?n:-0}export const isDirectionsMode=()=>!!(m.selectedRoute?.from&&m.selectedRoute?.to);export function getFontUrlByWeight(n,t=[],e="normal"){return[...t,{weight:500,url:W,style:"normal"},{weight:300,url:$,style:"normal"}].find(s=>+s.weight===n&&s.style===e)?.url||W}function b(n,t){return Number(getComputedStyle(document.body).getPropertyValue(n))||t}export function getBoothLabelWeights(){return{main:b(V,500),details:b(X,300)}}export function getExhibitorLabelWeights(){return{main:b(Z,500),details:b(G,300)}}export function getBadgeFontWeight(){return getExhibitorLabelWeights().details}const y="Details";export class BoothLabelDrawer extends rt{constructor(t){super(t),this.minZoomDotVisible=0,this.maxZoomDotVisible=0,this.exh=[],this.shapeLabel=void 0,this.shapeDot=void 0,this.fontSizes=[[],[]],this.lines=[[],[]],this.fontUrls=["",""],this.canvasRect=new B(t.rect.center,t.rect.size,t.rotate,t.elevation),this.paddingScaled=[4,4],this.padding=lt(t.borderWidth||it.borderWidth,t.rect.size),this.topLeftAlignment={horizontal:m.rtl?"right":"left",vertical:"top"},this.centerAlignment={horizontal:"center",vertical:"center"},this.prefixes=x?[{fontSize:7,name:"XS",short:!0},{fontSize:10,name:"S",short:!0},{fontSize:16,name:y,short:!1}]:[{fontSize:7,name:"XS",short:!0},{fontSize:10,name:"S",short:!0},{fontSize:12,name:"M",short:!0},{fontSize:14,name:"L",short:!0},{fontSize:18,name:y,short:!1}],!(t instanceof ot)&&(this.exh=c.hideExhibitors?[]:c.onlyFeaturedExhibitors?t.exhibitors.filter(e=>e.featured):t.exhibitors,x&&this.optimizationLevel()>=3&&(this.prefixes=this.prefixes.filter(e=>e.name!=="S")),this.createLines(),this.calculateFontSizeFactors(),this.shapeLabel=Y(Q(this.lines,this.booth.labelColor||z,0,this.fontUrls),new B(this.booth.rect.center,this.booth.rect.size,this.booth.rotate,this.booth.elevation),[...this.paddingScaled],{horizontal:"left",vertical:"top"}),this.shapeLabel.onScale=({pixelSize:e})=>this.layOutLabel(e),this.getShapeDot(),M(()=>[this.booth.skipDim,m.selectedRoute,_.layersLoaded],()=>{if(!_.layersLoaded)return;const e=isDirectionsMode();this.shapeLabel.dim=e||this.booth.skipDim?0:void 0,this.shapeDot.dim=e||this.booth.skipDim?0:void 0,U(this.shapeLabel,this.shapeDot)}),M(()=>m.mapSettings,({roll:e})=>{J(e??0)&&(this.shapeLabel.onRoll=({roll:i,pixelSize:h})=>{const s=j(i,this.shapeLabel.bounds.rotation);if(s===0)return;const{size:a}=this.canvasRect;return this.shapeLabel=tt(this.shapeLabel,s),!this.shapeLabel.hidden&&!this.exh.length&&a.x!==a.y&&(this.canvasRect=K(this.canvasRect,s),this.calculateFontSizeFactors(),this.layOutLabel(h),this.layOutDot(h)),[this.shapeLabel,this.shapeDot]})},{fireImmediately:!0}))}getShape(){return[this.shapeLabel,this.shapeDot]}layOutLabel(t){const e=this.lines[1]??[],i=this.fontSizes[1]??[];if(v.EXPO!=="wineparis2026"){const s=this.exh.length?this.topLeftAlignment:e.length?t<i[i.length-1].scaleFactor?this.topLeftAlignment:this.centerAlignment:this.topLeftAlignment;this.shapeLabel.alignment=s}return et(this.shapeLabel.lines,t,this.fontSizes)?(this.shapeLabel.padding[0]=this.paddingScaled[0]*t+this.padding,this.shapeLabel.padding[1]=this.paddingScaled[1]*t+this.padding,[this.shapeLabel]):[]}layOutDot(t){const e=t>=this.minZoomDotVisible&&t<=this.maxZoomDotVisible;if(!e&&this.shapeDot.hidden)return[];const i=this.shapeDot.bounds;return i.scale({x:this.shapeDot.source.width*t/i.size.x,y:this.shapeDot.source.height*t/i.size.y},i.center,i),this.shapeDot.hidden=!e,[this.shapeDot]}getShapeDot(){this.shapeDot=k(this.canvasRect,this.booth.labelColor||z),this.shapeDot.hidden=!0,this.shapeDot.onScale=({pixelSize:t})=>this.layOutDot(t),this.maxZoomDotVisible=Math.min(this.canvasRect.size.x/this.shapeDot.source.width,this.canvasRect.size.y/this.shapeDot.source.height)}createLines(){const t=this.booth,e=[],i=[],h=x&&this.optimizationLevel()>=3?1:3;if(this.exh.length){const s=t.exhibitors.filter(o=>o.order===0),a=t.exhibitors.filter(o=>o.order);if(s.length>0)e.push(...s.map(o=>o.name));else if(c.onlyFeaturedExhibitors)e.push(...t.exhibitors.filter(o=>o.featured).map(o=>o.name));else if(a.length>0){e.push(...a.map(u=>u.name));const o=t.exhibitors.filter(u=>u.order===void 0);o.length>0&&e.push(S("and {{moreCount}} more",{moreCount:o.length}))}else t.exhibitors.length>h?e.push(`${t.exhibitors.length} ${c.exhibitorTermPlural}`):e.push(...t.exhibitors.map(o=>o.name));i.push(t.title||t.name)}else{const s=!!t.exhibitors.length;e.push(t.title||t.name),t.onHold?i.push(S("On Hold")):t.reserved?i.push(S("Reserved")):s||i.push(...t.exhibitors.map(a=>a.name).sort((a,o)=>a>o?1:-1)),t.size&&i.push(t.size.indexOf("/")>-1?t.size.substring(0,t.size.indexOf("/")).trim():t.size),t.price&&t.price!=="0"&&!m.previewMode&&i.push(t.price)}m.rtl&&e.forEach((s,a)=>{(s.endsWith(".")||s.endsWith("!")||s.endsWith("?"))&&(e[a]=e[a]+"\u200F"),ht(s)&&(e[a]=e[a]+" ")}),this.lines=[e,i]}calculateFontSizeFactors(){const t=this.lines[0];let e;const i=this.canvasRect,h=[],s=[],a=this.prefixes.slice(0,this.exh.length?this.prefixes.length:this.prefixes.length-1),{main:o,details:u}=this.exh.length?getExhibitorLabelWeights():getBoothLabelWeights();for(const{fontSize:l,short:p}of a){const d=l*devicePixelRatio,L=.9*l*devicePixelRatio,f=I(d,o),T=I(L,u),O=c.hideExhibitorBoothNumber||p;let w,A,D,g;if(this.exh.length)e=p?[]:this.lines[1],D=Math.max(...t.map(r=>this.measureText(r,f).width),...e.map(r=>this.measureText(r,T).width)),w=Math.max(...t.map(r=>this.exh.length?this.measureText(F(r),f).width:this.measureText(F(r),f).width+3+3),...e.map(r=>this.measureText(F(r),T).width)),g=d*t.length+L*e.length+devicePixelRatio*(t.length+e.length)+3,A=O?g/t.length:null;else{const r=t[0].replace(/[0-9]/g,"3").replace(/[A-Z]/g,"A"),H=4;D=this.measureText(r,f).width+3+3,g=d+H}const C=i.size.x/(w||D),N=i.size.y/(A||g),E=Math.min(C,N);h.push({scaleFactor:E,value:d,lines:[]}),O||s.push({scaleFactor:E,value:L,lines:[]})}if(!this.exh.length){const l=h[h.length-1],p=this.prefixes.find(d=>d.name===y);p&&(h.push({scaleFactor:l.scaleFactor/1.8,value:p.fontSize*devicePixelRatio,lines:[]}),s.push({scaleFactor:l.scaleFactor/1.8,value:p.fontSize*(x?1:.9)*devicePixelRatio,lines:[]}))}const R=q();this.fontUrls=[getFontUrlByWeight(o,R),getFontUrlByWeight(u,R)],this.minZoomDotVisible=getMinZoomFactorForDot(h.map(l=>l.scaleFactor)),this.fontSizes=[h,s]}calcArea(t,e){return Math.floor(Math.max(0,t)*Math.max(0,e)/1e3)}optimizationLevel(){return Math.min(c.viewOptimizationLevel?c.viewOptimizationLevel:Math.floor(this.calcArea(this.canvasRect.size.x,this.canvasRect.size.y)/5e3),3)}measureText(t,e){return P.font=e,P.measureText(t)}}
@@ -3,44 +3,35 @@ import { type TextDef, type TextLineDef } from '@expofp/renderer';
3
3
  import { type FontSizeFactor } from './defs';
4
4
  export declare function updateLinesScale(lines: TextLineDef[], scale: number, fontSizes: [FontSizeFactor[], FontSizeFactor[]]): boolean;
5
5
  /**
6
- * Turns a text def's own bounds: the axis-aligned 90° footprint swap (width ↔ height) plus the
7
- * rotation delta.
6
+ * Turns a text def's bounds by whole quarter turns, in one write.
8
7
  *
9
- * **In place**, where {@link updateRectRotation} returns a new rect, and the difference is
10
- * ownership rather than taste. These bounds belong to a def the renderer already holds, and the
11
- * drawers capture them into locals to write through (`layOutDot` resizes `shapeDot.bounds` that
12
- * way) — so replacing the object would strand every reference to it. `Rect.set` is geometry's
13
- * escape hatch for exactly this. A drawer's own `canvasRect` has no such holders, which is why the
14
- * other one is free to hand back a fresh value.
15
- * @param textDef - The def to turn; its bounds are written through.
16
- * @param rotation - The rotation delta, in radians.
17
- * @returns The same def, for callers that read as if it were a value.
8
+ * Each quarter turn swaps width and height, and two swaps cancel out. So turning by `turns`
9
+ * quarters one at a time lands on the same rect as adding `turns · π/2` once and swapping only
10
+ * when `turns` is odd — no loop needed.
11
+ *
12
+ * The bounds are written in place, not replaced: the drawers keep references to them.
13
+ * @param textDef - The def to turn.
14
+ * @param turns - Signed number of quarter turns, as {@link getQuarterTurns} returns.
15
+ * @returns The same def.
18
16
  */
19
- export declare function updateTextDefRotation(textDef: TextDef, rotation: number): TextDef;
17
+ export declare function rotateTextDefByQuarters(textDef: TextDef, turns: number): TextDef;
20
18
  /**
21
- * Turns a plain rect: the same transform {@link updateTextDefRotation} applies, on a rect no def
22
- * holds — a drawer's `canvasRect`, which every caller reassigns — so this one is free to return a
23
- * new value instead of writing through.
24
- *
25
- * Rebuilt from scalars, so the elevation is carried across explicitly; a rect that dropped it would
26
- * take whatever is rebuilt from it down to the floor on the first roll.
19
+ * Turns a plain rect by whole quarter turns: the transform {@link rotateTextDefByQuarters} applies,
20
+ * where the swap-on-odd rule is explained. Returns a new rect, since nothing else holds this one.
27
21
  * @param rect - The rect to turn.
28
- * @param angle - The rotation delta, in radians.
22
+ * @param turns - Signed number of quarter turns, as {@link getQuarterTurns} returns.
29
23
  * @returns The turned rect.
30
24
  */
31
- export declare function updateRectRotation(rect: Rect, angle: number): Rect;
32
- export declare function getRotation(newAngle: number, currentRotation: number): number | undefined;
33
- export declare function shouldFlip(newAngle: number, currentRotation: number): boolean;
25
+ export declare function rotateRectByQuarters(rect: Rect, turns: number): Rect;
34
26
  /**
35
- * The signed shortest angle from `currentRotation` to `newAngle`, wrapped into `(-π, π]`.
36
- *
37
- * Always a number: the `| undefined` this used to be declared with described no path through the
38
- * body, and its two callers already read the result as a plain angle.
27
+ * How many 90° steps a def is behind the camera, signed: the whole distance, so a camera that
28
+ * jumped is caught up with in one write.
39
29
  * @param newAngle - The angle turned to, in radians.
40
30
  * @param currentRotation - The angle turned from, in radians.
41
- * @returns The difference in radians.
31
+ * @returns The signed number of quarters; `0` within 45° and for a non-finite angle.
42
32
  */
43
- export declare function getAngleDiff(newAngle: number, currentRotation: number): number;
33
+ export declare function getQuarterTurns(newAngle: number, currentRotation: number): number;
34
+ export declare function shouldFlip(newAngle: number, currentRotation: number): boolean;
44
35
  export declare function flipAngle(angle: number): number;
45
36
  export declare function getClampedBoundsCanvas(rect: Rect, canvas: HTMLCanvasElement, padding: number, scale: number): Rect;
46
37
  /**
@@ -1 +1 @@
1
- import{Rect as X}from"@expofp/geometry";import{getBounds as Y}from"./canvases";export function updateLinesScale(o,n,t){let e=!1;return o.forEach((i,c)=>{let s=0;t[c].forEach(({value:a,scaleFactor:r})=>{n<r&&(s=a)}),i.fontSize!==s*n&&(e=!0),i.fontSize=s*n}),e}export function updateTextDefRotation(o,n){const t=o.bounds;return t.set(t.center.x,t.center.y,t.size.y,t.size.x,t.rotation+n,t.elevation),o}export function updateRectRotation(o,n){const{size:t,center:e,rotation:i,elevation:c}=o;return new X(e,{x:t.y,y:t.x},i+n,c)}export function getRotation(o,n){const t=getAngleDiff(o,n);if(Math.abs(t)>Math.PI/4)return Math.sign(t)*Math.PI/2}export function shouldFlip(o,n){const t=getAngleDiff(o,n),e=Math.PI/2;return Math.abs(t)>e+.1}export function getAngleDiff(o,n){const t=Math.PI,e=2*t;return((c,s)=>((c-s+t)%e+e)%e-t)(o,n)}export function flipAngle(o){return(o+Math.PI+Math.PI)%(2*Math.PI)-Math.PI}export function getClampedBoundsCanvas(o,n,t,e){const i=n.width,c=n.height,s=o.size,a=o.center,r=o.rotation,d=s.x/i,m=s.x-t*2,g=(s.y-t*2)*.8,M=0,b=m/i,I=g/c,y=Math.min(b,I,d);e=Math.min(Math.max(e,M),y);const P=i*e,R=c*e,h=Math.sin(r),f=Math.cos(r),u=s.x/2-t,x=-s.y/2+t,S=a.x+u*f-x*h,z=a.y+u*h+x*f,p=P/2,l=-R/2,B=p*f-l*h,W=p*h+l*f,w=S-B,H=z-W;return Y(w,H,i,c,e,r)}export function getRollValue(o){if(!o)return!1;if(!Number.isInteger(+o)||+o!=1&&+o!=0)throw new Error("Map roll: setting value is incorrect");return!!+o}
1
+ import{angleDiff as l,Rect as k}from"@expofp/geometry";import{getBounds as w}from"./canvases";export function updateLinesScale(t,o,n){let e=!1;return t.forEach((r,i)=>{let s=0;n[i].forEach(({value:a,scaleFactor:c})=>{o<c&&(s=a)}),r.fontSize!==s*o&&(e=!0),r.fontSize=s*o}),e}export function rotateTextDefByQuarters(t,o){const{center:n,size:e,rotation:r,elevation:i}=t.bounds,s=o%2!==0;return t.bounds.set(n.x,n.y,s?e.y:e.x,s?e.x:e.y,r+o*Math.PI/2,i),t}export function rotateRectByQuarters(t,o){const{size:n,center:e,rotation:r,elevation:i}=t,s=o%2!==0?{x:n.y,y:n.x}:n;return new k(e,s,r+o*Math.PI/2,i)}export function getQuarterTurns(t,o){if(!Number.isFinite(t)||!Number.isFinite(o))return 0;const n=l(t,o);return Math.abs(n)<=Math.PI/4?0:Math.round(n/(Math.PI/2))}export function shouldFlip(t,o){const n=l(t,o),e=Math.PI/2;return Math.abs(n)>e+.1}export function flipAngle(t){return(t+Math.PI+Math.PI)%(2*Math.PI)-Math.PI}export function getClampedBoundsCanvas(t,o,n,e){const r=o.width,i=o.height,s=t.size,a=t.center,c=t.rotation,d=s.x/r,M=s.x-n*2,b=(s.y-n*2)*.8,y=0,g=M/r,I=b/i,S=Math.min(g,I,d);e=Math.min(Math.max(e,y),S);const P=r*e,z=i*e,h=Math.sin(c),f=Math.cos(c),u=s.x/2-n,x=-s.y/2+n,B=a.x+u*f-x*h,R=a.y+u*h+x*f,m=P/2,p=-z/2,W=m*f-p*h,H=m*h+p*f,X=B-W,Y=R-H;return w(X,Y,r,i,e,c)}export function getRollValue(t){if(!t)return!1;if(!Number.isInteger(+t)||+t!=1&&+t!=0)throw new Error("Map roll: setting value is incorrect");return!!+t}
@@ -1,6 +1,13 @@
1
- import { Rect, RectLike } from '@expofp/geometry';
2
- import { ImageDef } from '@expofp/renderer';
1
+ import type { Rect, RectLike } from '@expofp/geometry';
2
+ import type { ImageDef } from '@expofp/renderer';
3
3
  export declare function isInnerInsideOuter(inner: Rect, outer?: RectLike): boolean;
4
4
  export declare function flipImageDef(imageDef: ImageDef, angle: number): boolean;
5
+ /**
6
+ * Declares the camera-roll rule on a def that has to stay readable: it follows the plan in quarter
7
+ * turns, the same way the plan's own labels do.
8
+ * @param imageDef - The def to keep upright.
9
+ * @returns The same def.
10
+ */
11
+ export declare function attachCardinalSnap(imageDef: ImageDef): ImageDef;
5
12
  export declare function rotateImageDef(imageDef: ImageDef, angle: number): boolean;
6
13
  //# sourceMappingURL=rotation.d.ts.map
@@ -1 +1 @@
1
- import{flipAngle as h,getRotation as y,shouldFlip as u}from"../update-def";export function isInnerInsideOuter(o,n){if(!n)return!1;const t=Math.cos(n.rotation??0),e=Math.sin(n.rotation??0),c=n.size.x/2,a=n.size.y/2;return d(o,o.rotation+Math.PI/2).every(r=>{const i=r.x-n.center.x,f=r.y-n.center.y,s=i*t+f*e,x=f*t-i*e;return Math.abs(s)<=c&&Math.abs(x)<=a})}function d(o,n=o.rotation){const t=o.size.x/2,e=o.size.y/2,c=Math.sin(n),a=Math.cos(n),r=o.center.x,i=o.center.y;return[{x:-t,y:-e},{x:t,y:-e},{x:t,y:e},{x:-t,y:e}].map(s=>({x:r+s.x*a-s.y*c,y:i+s.x*c+s.y*a}))}export function flipImageDef(o,n){const t=o.bounds;return u(n,t.rotation)?(t.rotate(h(t.rotation)-t.rotation,t),!0):!1}export function rotateImageDef(o,n){const t=o.bounds,e=y(n,t.rotation);return e===void 0?!1:(t.rotate(e,t),!0)}
1
+ import{flipAngle as h,getQuarterTurns as f,shouldFlip as y}from"../update-def";export function isInnerInsideOuter(t,o){if(!o)return!1;const n=Math.cos(o.rotation??0),s=Math.sin(o.rotation??0),r=o.size.x/2,c=o.size.y/2;return l(t,t.rotation+Math.PI/2).every(a=>{const i=a.x-o.center.x,u=a.y-o.center.y,e=i*n+u*s,x=u*n-i*s;return Math.abs(e)<=r&&Math.abs(x)<=c})}function l(t,o=t.rotation){const n=t.size.x/2,s=t.size.y/2,r=Math.sin(o),c=Math.cos(o),a=t.center.x,i=t.center.y;return[{x:-n,y:-s},{x:n,y:-s},{x:n,y:s},{x:-n,y:s}].map(e=>({x:a+e.x*c-e.y*r,y:i+e.x*r+e.y*c}))}export function flipImageDef(t,o){const n=t.bounds;return y(o,n.rotation)?(n.rotate(h(n.rotation)-n.rotation,n),!0):!1}export function attachCardinalSnap(t){return t.onRoll=({roll:o})=>rotateImageDef(t,o)?[t]:void 0,t}export function rotateImageDef(t,o){const n=t.bounds,s=f(o,n.rotation);return s===0?!1:(n.rotate(s*Math.PI/2,n),!0)}
@@ -1 +1 @@
1
- import{getConfig as b}from"@expofp/config";import{PREVIEW_MODE_ATTRIBUTE as F}from"./constants";import{toInternalSettings as M}from"./internal-settings.js";import d from"./tools/base-runtime-url";import{loadCss as P,loadFont as w}from"./tools/loaders";import S from"./tools/logger";import{resetGlobalVariables as T}from"./tools/reset";import{initSentry as A}from"./tools/sentry";import{heatmapEnabled as V}from"./utils/heatmap-enabled";import{initI18n as H}from"./utils/i18n";import z from"./utils/is-debug";import G from"./utils/is-localhost";import x from"./utils/is-webview";import{loadCustomCss as N}from"./utils/loadCustomCss";import{loadIcons as Y}from"./utils/loadIcons";import E from"./utils/use-shadow";function e(){throw new Error("FloorPlan not ready")}export const DESTROYED_BEFORE_READY="FloorPlan destroyed before it finished loading";export default class Q{get ready(){return this._ready}get previewMode(){return b().previewMode||this.element.hasAttribute(F)}get allowConsent(){return this.consent==="ask"?void 0:this.consent==="granted"}getInternalSettings(){return M(b())}selectBooth(t){e()}selectExhibitor(t){e()}selectRoute(t,i){e()}getOptimizedRoutes(t){e()}selectCurrentPosition(t,i,a){e()}setBookmarks(t){e()}setEntitiesBookmarks(t){e()}setEntitiesVisited(t){e()}setMarkers(t){e()}updateLayerVisibility(t,i){e()}getCenterCoordinates(){e()}applyParameters(t){e()}exhibitorsList(){e()}boothsList(){e()}categoriesList(){e()}selectCategory(t){e()}select(t){e()}showList(t){e()}selectTour(t){e()}openPlanner(t){e()}startBuildRoute(){e()}getVisibility(){e()}setVisibility(t){e()}findLocation(){e()}zoomIn(){e()}zoomOut(){e()}zoomTo(t,i){e()}switchView(){e()}setCamera(t){e()}getCamera(){e()}fitBounds(){e()}getBounds(t){e()}getBoothRect(t){e()}convertToGeo(t,i){e()}getGeoConfig(){e()}destroy(){this.destroyed||(this.destroyed=!0,this.rejectReady(new Error(DESTROYED_BEFORE_READY)),this.releaseResources())}unstable_destroy(){this.destroy()}releaseResources(){for(window.removeEventListener("__efpStyleLoad",this.efpStyleLoadHandler);this.element.firstChild;)this.element.removeChild(this.element.firstChild);delete this.element.__expofp,T()}highlightExhibitors(t){e()}highlightBooths(t){e()}onCurrentPositionChanged(t){e()}search(t){e()}getFloors(){e()}onFloorActivated(t){e()}activateFloor(t){e()}showPathway(t,i){e()}showPathwayOnly(t,i){e()}hidePathways(){e()}showSearch(){e()}changeLanguage(t){e()}isGpsTrackingEnabled(){e()}setGpsTrackingEnabled(t){e()}deselectCurrentPosition(){e()}deselectRoute(){e()}reset(){e()}selectAccessibleRoute(t){e()}constructor(t,i){this.resolveReady=()=>{},this.rejectReady=()=>{},this.icons=new Map,this.enableRotation=!0,this.alwaysShowSidebar=!1,this.destroyed=!1;const a=b();this.noOverlay=!!a.noOverlay,this.offHistory=!!a.offHistory,this.ignoreQuery=a.ignoreQuery,this.consent=a.consent,this.consent==="ask"&&(x?this.consent="granted":G&&!z&&(this.consent="denied")),this.onBoothClick=t.onBoothClick,this.onBookmarkClick=t.onBookmarkClick,this.onVisitedClick=t.onVisitedClick,this.onCategoryClick=t.onCategoryClick,this.onDetails=t.onDetails,this.onExhibitorCustomButtonClick=t.onExhibitorCustomButtonClick,this.onGetCoordsClick=t.onGetCoordsClick,this.onMarkerClick=t.onMarkerClick,this.onFpConfigured=t.onFpConfigured,this.onDirection=t.onDirection,this.onInit=t.onInit,this.onCurrentPositionChanged=t.onCurrentPositionChanged,this.onFloorActivated=t.onFloorActivated,this.onLeaveEvent=t.onLeaveEvent,this.viewerMode=!!a.viewerMode,this.disableRuntimeAlerts=a.disableRuntimeAlerts,this.maplibre=a.maplibre,window.__efpMaplibre=a.maplibre,this._ready=new Promise((c,r)=>{this.resolveReady=c,this.rejectReady=r}),this._ready.catch(()=>{}),this.element=i;const I=i;if(I.__expofp)throw new Error("Element already in use");I.__expofp=this;const g=a.expo;A({eventId:g||"",isWebview:x}),this.eventId=g,window.__efpEvent=g,window.__efpElement=i;const m=document.createElement("div");m.style.height="100%",m.style.width="100%",i.appendChild(m);let n;if(E){n=m.attachShadow({mode:"open"});const c=n,r=document;c.createElement=(...s)=>r.createElement(...s),c.createElementNS=(...s)=>r.createElementNS(...s),c.createTextNode=(...s)=>r.createTextNode(...s)}else n=m;const y=document.createElement("div");y.style.height="100%",y.style.width="100%",n.appendChild(y),E&&Object.defineProperty(y,"ownerDocument",{value:n}),window.__efpShadowDOMStyleParent=E?n:void 0,this.renderTarget=y,S.log("Instantiating ExpoFP floorplan",i,g);let k=0;this.efpStyleLoadHandler=function(c){const r=window.__efpStyleElements??[];for(;k<r.length;){const s=r[k];n.appendChild(s),k++}},window.addEventListener("__efpStyleLoad",this.efpStyleLoadHandler),this.efpStyleLoadHandler();const h=this;(async function(){const r=b();if(await H(),h.destroyed)return;const s=new URLSearchParams(window.location.search);let f,p;if(r?.trackerUrl)try{f=new URL(r.trackerUrl),p=f.searchParams.get("expoId")}catch(o){console.error(o)}const R=async o=>{if(!f||!p)return Promise.reject(new Error("trackerUrl or expoId is missing"));const l=new URL(o.dataUrl,f.origin),u=await fetch(l.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expoId:p,token:decodeURIComponent(s.get("t")??"")})});let C=[];u.ok&&(C=(await u.json()).map(o.dataMapper)),window.__heatmapDataYah={yah:C}},v=r?.heatmap??{},L=V(v)||s.get("heatmap")==="true",O=v.variant==="yah"||s.get("type")==="yah",U=v.kiosk===!0||s.get("subtype")==="kiosk";if(L)try{if(O)U?await R({dataUrl:"/api/kiosks/list/viewer",dataMapper:o=>({...o,id:o.key,name:`Kiosk ${o.key}`})}):await R({dataUrl:"/api/v1/you-are-here/qr-code/list/viewer",dataMapper:(o,l)=>({...o,name:`QR Code #${l+1}`})});else{if(!f||!p)throw new Error("trackerUrl or expoId is missing");const o=new URL("/api/fp-stats/get",f.origin);o.searchParams.set("expoId",p),o.searchParams.set("type","booview"),o.searchParams.set("t",decodeURIComponent(s.get("t")??""));const l=new URL("api/fp-stats/get",f.origin);l.searchParams.set("expoId",p),l.searchParams.set("type","exview"),l.searchParams.set("t",decodeURIComponent(s.get("t")??""));const[u,C]=await Promise.all([fetch(o.toString()),fetch(l.toString())]),[_,j]=await Promise.all([u.json(),C.json()]);window.__heatmapData={booths:_,exhibitors:j}}}catch(o){console.error("Heatmap: Initialization error",o)}const B=[P(d+"vendor/sanitize-css/sanitize.css",n),P(d+"vendor/perfect-scrollbar/css/perfect-scrollbar.css",n),w("Oswald",d+"fonts/oswald-v17-cyrillic_latin-300.woff",{weight:300}),w("Oswald",d+"fonts/oswald-v17-cyrillic_latin-500.woff",{weight:500}),w("Inter",d+"fonts/inter-400.woff2",{weight:400}),w("Inter",d+"fonts/inter-500.woff2",{weight:500}),w("Inter",d+"fonts/inter-600.woff2",{weight:600}),w("efp-symbols",d+"fonts/efp-symbols.woff",{weight:400}),N(r,n),Y(h.icons)];if(await Promise.all(B),h.destroyed)return;h.enableRotation=r?.enableRotation??!1,h.alwaysShowSidebar=r?.alwaysShowSidebar??!1,S.log("Data loaded"),window.__storeInitAllowed=!0;const{default:D}=await import("./floorplan.ready");for(document.querySelectorAll(".expofp-floorplan-loader").forEach(o=>o.remove());i.firstChild&&i.firstChild!==m;)i.removeChild(i.firstChild);if(h.destroyed)return;Object.setPrototypeOf(h,D.prototype).init()})()}}
1
+ import{getConfig as C}from"@expofp/config";import{PREVIEW_MODE_ATTRIBUTE as F}from"./constants";import{toInternalSettings as M}from"./internal-settings.js";import d from"./tools/base-runtime-url";import{loadCss as P,loadFont as p}from"./tools/loaders";import S from"./tools/logger";import{resetGlobalVariables as T}from"./tools/reset";import{initSentry as A}from"./tools/sentry";import{heatmapEnabled as V}from"./utils/heatmap-enabled";import{initI18n as H}from"./utils/i18n";import z from"./utils/is-debug";import G from"./utils/is-localhost";import x from"./utils/is-webview";import{loadCustomCss as N}from"./utils/loadCustomCss";import{loadIcons as Y}from"./utils/loadIcons";import v from"./utils/use-shadow";function e(){throw new Error("FloorPlan not ready")}export const DESTROYED_BEFORE_READY="FloorPlan destroyed before it finished loading";export default class Q{get ready(){return this._ready}get previewMode(){return C().previewMode||this.element.hasAttribute(F)}get allowConsent(){return this.consent==="ask"?void 0:this.consent==="granted"}getInternalSettings(){return M(C())}selectBooth(t){e()}selectExhibitor(t){e()}selectRoute(t,s){e()}getOptimizedRoutes(t){e()}selectCurrentPosition(t,s,a){e()}setBookmarks(t){e()}setEntitiesBookmarks(t){e()}setEntitiesVisited(t){e()}setMarkers(t){e()}updateLayerVisibility(t,s){e()}getCenterCoordinates(){e()}applyParameters(t){e()}exhibitorsList(){e()}boothsList(){e()}categoriesList(){e()}selectCategory(t){e()}select(t){e()}showList(t){e()}selectTour(t){e()}openPlanner(t){e()}startBuildRoute(){e()}getVisibility(){e()}setVisibility(t){e()}findLocation(){e()}zoomIn(){e()}zoomOut(){e()}zoomTo(t,s){e()}switchView(){e()}setCamera(t){e()}getCamera(){e()}fitBounds(){e()}getBounds(t){e()}getBoothRect(t){e()}convertToGeo(t,s){e()}getGeoConfig(){e()}destroy(){this.destroyed||(this.destroyed=!0,this.rejectReady(new Error(DESTROYED_BEFORE_READY)),this.releaseResources())}unstable_destroy(){this.destroy()}releaseResources(){for(window.removeEventListener("__efpStyleLoad",this.efpStyleLoadHandler);this.element.firstChild;)this.element.removeChild(this.element.firstChild);delete this.element.__expofp,T()}highlightExhibitors(t){e()}highlightBooths(t){e()}onCurrentPositionChanged(t){e()}search(t){e()}getFloors(){e()}onFloorActivated(t){e()}activateFloor(t){e()}showPathway(t,s){e()}showPathwayOnly(t,s){e()}hidePathways(){e()}showSearch(){e()}changeLanguage(t){e()}isGpsTrackingEnabled(){e()}setGpsTrackingEnabled(t){e()}deselectCurrentPosition(){e()}deselectRoute(){e()}reset(){e()}selectAccessibleRoute(t){e()}constructor(t,s){this.resolveReady=()=>{},this.rejectReady=()=>{},this.icons=new Map,this.enableRotation=!0,this.alwaysShowSidebar=!1,this.destroyed=!1;const a=C();this.noOverlay=!!a.noOverlay,this.offHistory=!!a.offHistory,this.ignoreQuery=a.ignoreQuery,this.consent=a.consent,this.consent==="ask"&&(x?this.consent="granted":G&&!z&&(this.consent="denied")),this.onBoothClick=t.onBoothClick,this.onBookmarkClick=t.onBookmarkClick,this.onVisitedClick=t.onVisitedClick,this.onCategoryClick=t.onCategoryClick,this.onDetails=t.onDetails,this.onExhibitorCustomButtonClick=t.onExhibitorCustomButtonClick,this.onGetCoordsClick=t.onGetCoordsClick,this.onMarkerClick=t.onMarkerClick,this.onFpConfigured=t.onFpConfigured,this.onDirection=t.onDirection,this.onInit=t.onInit,this.onCurrentPositionChanged=t.onCurrentPositionChanged,this.onFloorActivated=t.onFloorActivated,this.onLeaveEvent=t.onLeaveEvent,this.viewerMode=!!a.viewerMode,this.disableRuntimeAlerts=a.disableRuntimeAlerts,this.maplibre=a.maplibre,window.__efpMaplibre=a.maplibre,this._ready=new Promise((c,i)=>{this.resolveReady=c,this.rejectReady=i}),this._ready.catch(()=>{}),this.element=s;const I=s;if(I.__expofp)throw new Error("Element already in use");I.__expofp=this;const g=a.expo;A({eventId:g||"",isWebview:x}),this.eventId=g,window.__efpEvent=g,window.__efpElement=s;const w=document.createElement("div");w.style.height="100%",w.style.width="100%",s.appendChild(w);let n;if(v){n=w.attachShadow({mode:"open"});const c=n,i=document;c.createElement=(...r)=>i.createElement(...r),c.createElementNS=(...r)=>i.createElementNS(...r),c.createTextNode=(...r)=>i.createTextNode(...r)}else n=w;const y=document.createElement("div");y.style.height="100%",y.style.width="100%",n.appendChild(y),v&&Object.defineProperty(y,"ownerDocument",{value:n}),window.__efpShadowDOMStyleParent=v?n:void 0,this.renderTarget=y,S.log("Instantiating ExpoFP floorplan",s,g);let k=0;this.efpStyleLoadHandler=function(c){const i=window.__efpStyleElements??[];for(;k<i.length;){const r=i[k];n.appendChild(r),k++}},window.addEventListener("__efpStyleLoad",this.efpStyleLoadHandler),this.efpStyleLoadHandler();const h=this;(async function(){const i=C();if(await H(),h.destroyed)return;const r=new URLSearchParams(window.location.search);let m,f;if(i?.trackerUrl)try{m=new URL(i.trackerUrl),f=m.searchParams.get("expoId")}catch(o){console.error(o)}const R=async o=>{if(!m||!f)return Promise.reject(new Error("trackerUrl or expoId is missing"));const l=new URL(o.dataUrl,m.origin),u=await fetch(l.toString(),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({expoId:f,token:decodeURIComponent(r.get("t")??"")})});let b=[];u.ok&&(b=(await u.json()).map(o.dataMapper)),window.__heatmapDataYah={yah:b}},E=i?.heatmap??{},L=V(E)||r.get("heatmap")==="true",O=E.variant==="yah"||r.get("type")==="yah",U=E.kiosk===!0||r.get("subtype")==="kiosk";if(L)try{if(O)U?await R({dataUrl:"/api/kiosks/list/viewer",dataMapper:o=>({...o,id:o.key,name:`Kiosk ${o.key}`})}):await R({dataUrl:"/api/v1/you-are-here/qr-code/list/viewer",dataMapper:(o,l)=>({...o,name:`QR Code #${l+1}`})});else{if(!m||!f)throw new Error("trackerUrl or expoId is missing");const o=new URL("/api/fp-stats/get",m.origin);o.searchParams.set("expoId",f),o.searchParams.set("type","booview"),o.searchParams.set("t",decodeURIComponent(r.get("t")??""));const l=new URL("api/fp-stats/get",m.origin);l.searchParams.set("expoId",f),l.searchParams.set("type","exview"),l.searchParams.set("t",decodeURIComponent(r.get("t")??""));const[u,b]=await Promise.all([fetch(o.toString()),fetch(l.toString())]),[_,j]=await Promise.all([u.json(),b.json()]);window.__heatmapData={booths:_,exhibitors:j}}}catch(o){console.error("Heatmap: Initialization error",o)}const B=[P(d+"vendor/sanitize-css/sanitize.css",n),P(d+"vendor/perfect-scrollbar/css/perfect-scrollbar.css",n),p("Oswald",d+"fonts/oswald-v17-cyrillic_latin-300.woff",{weight:300}),p("Oswald",d+"fonts/oswald-v17-cyrillic_latin-500.woff",{weight:500}),p("Inter",d+"fonts/inter-400.woff2",{weight:400}),p("Inter",d+"fonts/inter-500.woff2",{weight:500}),p("Inter",d+"fonts/inter-600.woff2",{weight:600}),p("efp-symbols",d+"fonts/efp-symbols.woff",{weight:400}),N(i,n),Y(h.icons)];if(await Promise.all(B),h.destroyed)return;h.enableRotation=i?.enableRotation??!1,h.alwaysShowSidebar=i?.alwaysShowSidebar??!1,S.log("Data loaded"),window.__storeInitAllowed=!0;const{default:D}=await import("./floorplan.ready");if(h.destroyed)return;Object.setPrototypeOf(h,D.prototype).init()})()}}
@@ -1 +1 @@
1
- import{Fragment as A,jsx as x,jsxs as T}from"react/jsx-runtime";import{Box as E}from"@expofp/geometry";import{CameraSchema as I}from"@expofp/schema";import{optimizeWaypointOrder as M}from"@expofp/wayfinding";import{ErrorBoundary as R}from"@sentry/react";import $ from"debug";import{reaction as V}from"mobx";import{createRoot as z}from"react-dom/client";import{install as j}from"resize-observer";import G from"./components/Layout";import{bindBoothHitTest as N}from"./components/Map/booth-by-xy";import{MAX_ROUTE_WAYPOINTS as d}from"./constants";import D from"./data";import{fpGeo as b}from"./data/fpGeo";import H from"./floorplan.loader";import{shouldLoadIntercom as q}from"./intercom";import{BoundsSchema as O,POISelectorsSchema as P,ZoomToOptionsSchema as w}from"./schemas/sdk.schemas";import{applyDeclarativeConfig as U,applyParameters as Y,applyPathway as W,initUrlRouting as X}from"./services/url-dispatch";import{destroyUrlSync as K}from"./services/url-sync";import r from"./store";import{bindDetailsEvents as Q}from"./store/details-events";import{bindRootElement as Z,destroyUiHandlers as J}from"./store/init/init-ui";import{findBooth as S,Route as B,separateExternalIds as v}from"./store/RouteStore";import{destroyGtag as _,GaEventActions as k,sendEventToGa as F,setConsentSettings as ee}from"./tools/gtag";import te from"./tools/report-error";import re,{resetTelemetry as ie}from"./tools/track-event";import{cameraToMapSettings as oe,mapSettingsToCamera as se}from"./utils/camera-map-settings";import{getStorage as C}from"./utils/entity-storage";import{getMostFrequent as ne}from"./utils/getMostFrequent";import{convertLocalToGps as ae,isValidPointCoords as y}from"./utils/gps";import{getLocales as he,hasLocale as ce,setLocale as le}from"./utils/i18n";import{mapEntity as g}from"./utils/mapEntity";const p=$("efp:api");j();export default class ue extends H{init(){U(),this.ignoreQuery||X(this.offHistory),re("load"),Z(r),r.fp=this,this.disposeDetailsEvents=Q(),this.disposeBoothHitTest=N(),ee(this.consent),F(k.Load,""),this.root=z(this.renderTarget),this.root.render(x(R,{children:x(G,{offHistory:this.offHistory,consent:this.consent})})),F(k.Rendered,""),V(()=>r.layerStore.layersLoaded,()=>{this.resolveReady(),r.initialized||this.onInit?.(this),r.initialized=!0});const e=q(D);e&&import("./intercom/bootIntercom").then(({bootIntercom:t})=>t(e)).catch(()=>{})}selectBooth(e){if(typeof e!="string"&&!Array.isArray(e)){a("selectBooth","Parameter must be a string or an array of strings.","EFP000000");return}const t=r.boothStore.booths.filter(i=>typeof e=="string"?i.name===e||i.externalId===e:e.includes(i.name)||e.includes(i.externalId));r.selectBooth(t)}selectExhibitor(e){if(typeof e!="string"&&!Array.isArray(e)){a("selectExhibitor","Parameter must be a string or an array of strings.","EFP000100");return}if(!e?.length){r.uiState.menu=!1,r.searchStore.resetSearchBox(),r.uiState.details=null;return}const t=r.exhibitorStore.exhibitors.filter(s=>typeof e=="string"?s.name===e||s.externalId===e:e.includes(s.name)||e.includes(s.externalId));if(!t?.length)return;if(typeof e=="string"){r.selectExhibitor(t[0]),r.moveToList([t[0]]);return}const i=t.flatMap(s=>s.booths.map(o=>o.layer)),n=ne(i.map(s=>s.description));n&&r.layerStore.updateVisibility(n,!0),r.uiState.menu=!1,r.searchStore.resetSearchBox(),r.uiState.details=null,r.uiState.list={type:"filter",items:t,query:{key:"exhibitors",value:t.map(s=>s.name).join(",")}},r.moveToList()}highlightExhibitors(e){Array.isArray(e)||a("highlightExhibitors","Parameter must be an array of strings.","EFP000200"),r.boothStore.highlightedByExternalIds=[],r.exhibitorStore.highlightedByExternalIds=[...e]}highlightBooths(e){Array.isArray(e)||a("highlightBooths","Parameter must be an array of strings.","EFP000300"),r.exhibitorStore.highlightedByExternalIds=[],r.boothStore.highlightedByExternalIds=[...e]}highlightEntities(e){Array.isArray(e)||a("highlightEntities","Parameter must be an array of strings.","EFP000400");const{boothExternalIds:t,exhibitorExternalIds:i}=v(e);r.boothStore.highlightedByExternalIds=[...t],r.exhibitorStore.highlightedByExternalIds=[...i]}selectRoute(e,t){if(Array.isArray(e)){let i=[...e];const n=i.shift(),s=i.pop();if(i.length>d)throw new Error(`The maximum number of waypoints is ${d}.`);if(!n||!s){a("selectRoute","Invalid route format: When providing an array, it must include at least two points: a start and a destination.","EFP000401");return}r.routeStore.selectRoute(new B(m(n),m(s),i.map(m)));return}e||a("selectRoute","At a minimum, the starting point must be passed.","EFP000402"),r.routeStore.selectRoute(new B(m(e),m(t)))}getOptimizedRoutes(e){if(!Array.isArray(e))return a("getOptimizedRoutes","Parameter must be an array.","EFP000500"),[];if(e.length>d)throw new Error(`The maximum number of waypoints is ${d}.`);const t=e.map(m).filter(n=>!!n);if(!t.length)throw new Error("No booths found for the provided waypoints.");const i=new Map;for(const n of t){const s=n.layer?.name??"",o=i.get(s);o?o.push(n):i.set(s,[n])}return Array.from(i.values()).map(n=>({waypoints:M(n.map(s=>[s.name,{x:s.rect.center.x,y:s.rect.center.y}]))}))}selectCurrentPosition(e,t,i){const n=y(e.x)&&y(e.y),s=y(e.lng)&&y(e.lat);!n&&!s&&a("selectCurrentPosition","A point must be passed. Either (x,y) or (lat,lng) are required.","EFP000600"),r.routeStore.selectCurrentPosition(e,t,i),this.onCurrentPositionChanged?.(e)}setBookmarks(e){(!Array.isArray(e)||!e.length)&&a("setBookmarks","Parameter must be an array.","EFP000700"),e.forEach(t=>{const i=r.exhibitorStore.exhibitors.find(n=>n.name===t.name||n.externalId===t.externalId);i&&(i.bookmarked=t.bookmarked)})}setEntitiesBookmarks(e){if(!Array.isArray(e)||!e.length){a("setEntitiesBookmarks","Parameter must be an array.","EFP000701");return}const t=["exhibitor","event","speaker","booth"],i=e.find(o=>!o.type||!t.includes(o.type));if(i){a("setEntitiesBookmarks",`Invalid entity type: ${i.type}. Must be one of: ${t.join(", ")}.`,"EFP000702");return}const n=C("bookmarked"),s={exhibitor:{existingIds:new Set(n.exhibitors||[]),finder:o=>r.exhibitorStore.findExhibitor(o),replacer:o=>r.exhibitorStore.replaceBookmarked(o)},event:{existingIds:new Set(n.events||[]),finder:o=>r.eventStore.findByNameOrSlug(o),replacer:o=>r.eventStore.replaceBookmarked(o)},speaker:{existingIds:new Set(n.speakers||[]),finder:o=>r.speakerStore.speakers.find(h=>h.name===o||h.externalId===o||h.slug===o),replacer:o=>r.speakerStore.replaceBookmarked(o)},booth:{existingIds:new Set(n.booths||[]),finder:o=>{const h=r.boothStore.findBooth(o);return h?.exhibitors.length===0?h:void 0},replacer:o=>r.boothStore.replaceBookmarked(o)}};e.forEach(o=>{const h=s[o.type],u=o.name||o.externalId||"",c=h.finder(u);c?o.bookmarked?h.existingIds.add(c.id):h.existingIds.delete(c.id):console.warn(`Entity not found: ${o.type} with query "${u}"`)}),Object.values(s).forEach(o=>{o.replacer(Array.from(o.existingIds))})}setEntitiesVisited(e){if(!Array.isArray(e)||!e.length){a("setEntitiesVisited","Parameter must be an array.","EFP000703");return}const t=["exhibitor","event"],i=e.find(o=>!o.type||!t.includes(o.type));if(i){a("setEntitiesVisited",`Invalid entity type: ${i.type}. Must be one of: ${t.join(", ")}.`,"EFP000704");return}const n=C("visited"),s={exhibitor:{existingIds:new Set(n.exhibitors||[]),finder:o=>r.exhibitorStore.findExhibitor(o),replacer:o=>r.exhibitorStore.replaceVisited(o)},event:{existingIds:new Set(n.events||[]),finder:o=>r.eventStore.findByNameOrSlug(o),replacer:o=>r.eventStore.replaceVisited(o)}};e.forEach(o=>{const h=s[o.type],u=o.name||o.externalId||"",c=h.finder(u);c?o.visited?h.existingIds.add(c.id):h.existingIds.delete(c.id):console.warn(`Entity not found: ${o.type} with query "${u}"`)}),Object.values(s).forEach(o=>{o.replacer(Array.from(o.existingIds))})}setMarkers(e){if(!e||!Array.isArray(e.icons)||!Array.isArray(e.markers)){a("setMarkers","Invalid input.","EFP000800");return}r.routeStore.setMarkers(e)}selectMarker(e,t=!0){return typeof e!="string"&&a("selectMarker","The identifier must be passed.","EFP000900"),r.routeStore.selectMarker(e,t)}drawCircles(e){Array.isArray(e)||a("drawCircles","Invalid input.","EFP000A00"),r.uiState.debugCircles=e}checkRoutes(){r.routeStore.checkRoutes()}updateLayerVisibility(e,t){typeof e!="string"&&a("updateLayerVisibility","The layer name (string) must be passed.","EFP000B00"),t||a("updateLayerVisibility","Passing a false value to visible will have no effect.","EFP000B01"),r.layerStore.updateVisibility(e,t)}getCenterCoordinates(){return r.fp.getCenterCoordinates()}exhibitorsList(){return r.exhibitorStore.exhibitors.map(e=>g(e))}boothsList(){return r.boothStore.booths.map(e=>g(e))}categoriesList(){return r.categoryStore.categories.map(e=>g(e))}selectCategory(e){if(e==null||typeof e!="string"){r.searchStore.selectSearch();return}const t=e?.toLowerCase(),i=r.categoryStore.categories.find(({name:n,slug:s})=>n?.toLowerCase()===t||s?.toLowerCase()===t);if(!i){a("selectCategory",`Category ${e} not found.`,"EFP000C01");return}r.selectCategory(i)}select(e){if(typeof e!="string"){a("select","Parameter must be a string.","EFP001700");return}const t=e,i=t?.toLowerCase(),n=r.boothStore.booths.find(c=>c.slug?.toLowerCase()===i||c.externalId?.toLowerCase()===i||c.externalId?.toLowerCase()?.replace(/\s+/g,"")===i);if(n){setTimeout(()=>r.selectBooth(n),250);return}const s=r.eventStore.eventItems.find(c=>c.slug?.toLowerCase()===i||c.externalId?.toLowerCase()===i);if(s){r.selectEventItem(s,!0);return}const o=r.exhibitorStore.exhibitors.find(c=>c.slug?.toLowerCase()===i||c.externalId?.toLowerCase()===i);if(o){setTimeout(()=>r.clickExhibitor(o),250);return}const h=r.categoryStore.categories.find(c=>c.slug===t);if(h){r.selectCategory(h);return}const u=r.speakerStore.findBySlug(t);if(u){r.selectSpeaker(u,!0);return}t.includes("heatmap=true")||r.searchStore.selectSearch(t)}showList(e){const t={bookmarks:()=>r.selectBookmarks(),visited:()=>r.selectVisited(),sessions:()=>r.selectSessions(),exhibitors:()=>r.selectExhibitors(),speakers:()=>r.selectSpeakers(),tours:()=>r.selectTours(),language:()=>r.selectLanguage()},i=t[e];if(!i){a("showList",`Unknown list "${e}". Must be one of: ${Object.keys(t).join(", ")}.`,"EFP001800");return}i()}selectTour(e){if(typeof e!="string"||!e){a("selectTour","A tour id must be passed.","EFP001900");return}const t=r.toursStore.getTourById(e);t?r.toursStore.launchTour(t,t.name,t.description):(console.warn(`Route with id "${e}" not found`),r.selectTours())}openPlanner(e={}){if(typeof e!="object"||e===null){a("openPlanner","An options object must be passed.","EFP001A00");return}const t=e.from?S(e.from):null;e.fromBookmarks?r.routePlannerStore.launchFromBookmarks(t??void 0):r.routePlannerStore.launchFromSlugs(e.items??[],t??void 0)}startBuildRoute(){r.uiState.startBuildRoute()}applyParameters(e){typeof e!="string"&&a("applyParameters","A query string must be passed.","EFP000D00"),Y(e)}getVisibility(){return r.uiState.visibility}setVisibility(e){(typeof e!="object"||!Object.keys(e).length)&&a("setVisibility","The parameter must be passed.","EFP000E00"),r.uiState.setVisibility(e)}findLocation(){r.routeStore.findLocation()}zoomIn(){r.uiState.zoomIn()}zoomOut(){r.uiState.zoomOut()}switchView(){r.maplibreStore.activateMaplibre()}setCamera(e){p("setCamera called with camera=%O",e);const t=I.safeParse(e);if(!t.success){a("setCamera",t.error.message,"EFP001B00");return}r.uiState.setMapSettings(oe(t.data))}getCamera(){return se(r.uiState.mapSettings)}zoomTo(e,t){p("zoomTo called with selectors=%O options=%O",e,t);const i=P.safeParse(e);if(!i.success){a("zoomTo",i.error.message,"EFP001600");return}const n=w.safeParse(t);if(!n.success){a("zoomTo",n.error.message,"EFP001601");return}const s=this.getBounds(e);s&&this.fitBounds(s,t)}getBounds(e){p("getBounds called with selectors=%O",e);const t=P.safeParse(e);if(!t.success){a("getBounds",t.error.message,"EFP001400");return}const i=[];if(e.booths?.forEach(s=>{let o;s.externalId?o=r.boothStore.boothByExternalId.get(s.externalId):s.name&&(o=r.boothStore.boothByName.get(s.name.toLowerCase())),o?.rect&&i.push(o.rect)}),e.exhibitors?.forEach(s=>{let o;s.externalId?o=r.exhibitorStore.exhibitorByExternalId.get(s.externalId):s.name&&(o=r.exhibitorStore.exhibitorByName.get(s.name.toLowerCase())),o?.booths?.forEach(h=>{h.rect&&i.push(h.rect)})}),i.length===0)return;const n=E.fromUnion(...i);return{leftTop:{x:n.min.x,y:n.min.y},rightBottom:{x:n.max.x,y:n.max.y}}}fitBounds(e,t){if(p("fitBounds called with bounds=%O options=%O",e,t),!e){r.uiState.fitBounds();return}const i=O.safeParse(e);if(!i.success){a("fitBounds",i.error.message,"EFP001500");return}const n=w.safeParse(t);if(!n.success){a("fitBounds",n.error.message,"EFP001501");return}const s=E.fromMinMax({x:e.leftTop.x,y:e.leftTop.y},{x:e.rightBottom.x,y:e.rightBottom.y});r.uiState.moveToRect=t?.padding?s.expand(t.padding):s}getBoothRect(e){typeof e!="string"&&a("getBoothRect","A booth name must be passed.","EFP000F00");const t=S(e)?.rect;return t?l.fromBox(t):void 0}convertToGeo(e,t){if(!b?.properties?.config){a("convertToGeo","The coordinates cannot be converted because the GPS configuration is not defined.","EFP001000");return}if(!e||!t){a("convertToGeo","Both coordinates must be passed.","EFP001001");return}return ae(e,t,b.properties.config)}getGeoConfig(){const e=b?.properties?.config;return e?{bearing:e.bearing??0,p0:e.p0,p1:e.p1,p2:e.p2}:null}releaseResources(){window.removeEventListener("error",te),this.disposeDetailsEvents?.(),this.disposeDetailsEvents=void 0,this.disposeBoothHitTest?.(),this.disposeBoothHitTest=void 0,r.maplibreStore.dispose(),K(),J(),_(),ie(),this.root.unmount(),super.releaseResources()}search(e){return typeof e!="string"&&a("search","A search string must be passed.","EFP001100"),r.fuzzySearchEngineStore.loadEngine().then(()=>(r.searchStore.selectSearch(e),r.uiState.fuzzySearchItems.map(t=>({item:g(t.item),score:t.score}))))}getFloors(){return r.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?.name&&e?.index==null){a("activateFloor","Invalid floorId. It must contain either a name or an index.","EFP001200");return}const t=this.getFloors();if(e.name){const i=t.find(n=>n.name===e.name||n.shortName===e.name);if(!i){a("activateFloor",`Floor with name "${e.name}" not found.`,"EFP001201");return}if(i.active)return;this.updateLayerVisibility(i.name,!0);return}if(e.index!==null){const i=t.find(s=>s.index===e.index),n=i?.name;if(!n){a("activateFloor",`Floor at index ${e.index} does not exist.`,"EFP001203");return}if(i.active)return;this.updateLayerVisibility(n,!0);return}}showPathway(e,t){const{boothExternalIds:i,exhibitorExternalIds:n}=t?.length?v(t):{boothExternalIds:[],exhibitorExternalIds:[]};W({pathwayId:e,boothIds:i,exhibitorIds:n})}showPathwayOnly(e,t){this.activateFloor({name:t}),r.layerStore.showPathWay(e),r.uiState.setPathwayOnlyMode(!0);const i=r.layerStore.findLayer(e),n=r.layerStore.findLayer(t),s=i?.rect||i?.viewbox?i:n;if(s?.rect||s?.viewbox){const o=s.viewbox??s.rect;r.uiState.moveToRect=o.clone()}}hidePathways(){this.highlightBooths([]),r.layerStore.hidePathways(),r.uiState.setPathwayOnlyMode(!1)}showSearch(){r.selectSearch("")}changeLanguage(e){const t=e?.toLowerCase?.();if(!ce(t)){a("changeLanguage",`Language "${e}" was not found. Available languages: ${he().map(i=>i.id).join(",")}`,"EFP001300");return}le(t)}isGpsTrackingEnabled(){return r.routeStore.gpsEnabled}setGpsTrackingEnabled(e){r.routeStore.setGpsTrackingEnabled(e)}deselectCurrentPosition(){r.routeStore.selectCurrentPosition(null,!1)}deselectRoute(){r.routeStore.selectRoute(null),r.routeStore.setOnlyAccessible(!1)}reset(){this.selectBooth(""),this.selectExhibitor(""),this.selectCategory(),this.deselectCurrentPosition(),this.deselectRoute(),this.highlightEntities([]),r.uiState.kioskData&&r.resetCameraFn?r.resetCameraFn?.():this.fitBounds()}selectAccessibleRoute(e){r.routeStore.setOnlyAccessible(!0),this.selectRoute(e)}}function m(f){return typeof f=="string"?S(f):r.routeStore.getNearestBooth(f)}let L=0;function a(f,e,t){const i=`Error calling "${f}" SDK method.`,n=`${e.endsWith(".")?e:e+"."} More information at`;let s="https://js-sdk.expofp.com/api/packages";if(t&&(s+=`#error-${t}`),console.error(`${i} ${n} ${s}`),r.fp.disableRuntimeAlerts)return;r.uiState.setGlobalErrorMessage({title:i,body:T(A,{children:[n," ",x("a",{href:s,target:"_blank",rel:"noreferrer",children:s})]})}),clearTimeout(L);const o=8e3;L=window.setTimeout(()=>{const h=async()=>{r.uiState.globalErrorMessages.length>0&&(r.uiState.popGlobalErrorMessage(),await new Promise(u=>setTimeout(u,o/2)),h())};h()},o)}class l{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,i,n){if(e>i){const s=e;e=i,i=s}if(t>n){const s=t;t=n,n=s}this.x1=e,this.y1=t,this.x2=i,this.y2=n}static fromBox(e){return new l(e.min.x,e.min.y,e.max.x,e.max.y)}static fromCxcywh(e,t,i,n){return new l(e-i/2,t-n/2,e+i/2,t+n/2)}contains(e){return e.x1>=this.x1&&e.x2<=this.x2&&e.y1>=this.y1&&e.y2<=this.y2}intersects(e){const t=Math.max(this.x1,e.x1),i=Math.min(this.x2,e.x2),n=Math.max(this.y1,e.y1),s=Math.min(this.y2,e.y2);return i>=t&&s>=n}getIntersection(e){const t=Math.max(this.x1,e.x1),i=Math.min(this.x2,e.x2),n=Math.max(this.y1,e.y1),s=Math.min(this.y2,e.y2);return i>=t&&s>=n?new l(t,n,i,s):new l(0,0,0,0)}getRotated90(){return l.fromCxcywh(this.cx,this.cy,this.h,this.w)}normalize(e,t){return new l(this.x1/e,this.y1/t,this.x2/e,this.y2/t)}withPadding(e,t=e){return this.w<e*2||this.h<t*2?this:l.fromCxcywh(this.cx,this.cy,this.w-e*2,this.h-t*2)}scale(e){return new l(this.x1*e,this.y1*e,this.x2*e,this.y2*e)}getArea(){return this.w*this.h}clone(){return new l(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}}
1
+ import{Fragment as T,jsx as x,jsxs as A}from"react/jsx-runtime";import{Box as E}from"@expofp/geometry";import{CameraSchema as I}from"@expofp/schema";import{optimizeWaypointOrder as M}from"@expofp/wayfinding";import{ErrorBoundary as R}from"@sentry/react";import $ from"debug";import{reaction as V}from"mobx";import{createRoot as z}from"react-dom/client";import{install as j}from"resize-observer";import G from"./components/Layout";import{bindBoothHitTest as N}from"./components/Map/booth-by-xy";import{MAX_ROUTE_WAYPOINTS as d}from"./constants";import q from"./data";import{fpGeo as b}from"./data/fpGeo";import D from"./floorplan.loader";import{shouldLoadIntercom as H}from"./intercom";import{BoundsSchema as O,POISelectorsSchema as w,ZoomToOptionsSchema as P}from"./schemas/sdk.schemas";import{applyDeclarativeConfig as U,applyParameters as Y,applyPathway as W,initUrlRouting as X}from"./services/url-dispatch";import{destroyUrlSync as K}from"./services/url-sync";import r from"./store";import{bindDetailsEvents as Q}from"./store/details-events";import{bindRootElement as Z,destroyUiHandlers as J}from"./store/init/init-ui";import{findBooth as S,Route as v,separateExternalIds as B}from"./store/RouteStore";import{destroyGtag as _,GaEventActions as k,sendEventToGa as F,setConsentSettings as ee}from"./tools/gtag";import te from"./tools/report-error";import re,{resetTelemetry as oe}from"./tools/track-event";import{cameraToMapSettings as ie,mapSettingsToCamera as se}from"./utils/camera-map-settings";import{getStorage as C}from"./utils/entity-storage";import{getMostFrequent as ne}from"./utils/getMostFrequent";import{convertLocalToGps as ae,isValidPointCoords as y}from"./utils/gps";import{getLocales as he,hasLocale as le,setLocale as ce}from"./utils/i18n";import{mapEntity as g}from"./utils/mapEntity";const p=$("efp:api");j();export default class ue extends D{init(){U(),this.ignoreQuery||X(this.offHistory),re("load"),Z(r),r.fp=this,this.disposeDetailsEvents=Q(),this.disposeBoothHitTest=N(),ee(this.consent),F(k.Load,""),this.root=z(this.renderTarget),this.root.render(x(R,{children:x(G,{offHistory:this.offHistory,consent:this.consent})})),F(k.Rendered,""),V(()=>r.layerStore.layersLoaded,()=>{const t=this.renderTarget.getRootNode(),o=t instanceof ShadowRoot?t.host:this.renderTarget.parentElement;for(document.querySelectorAll(".expofp-floorplan-loader").forEach(s=>s.remove());o&&this.element.firstChild&&this.element.firstChild!==o;)this.element.removeChild(this.element.firstChild);this.resolveReady(),r.initialized||this.onInit?.(this),r.initialized=!0});const e=H(q);e&&import("./intercom/bootIntercom").then(({bootIntercom:t})=>t(e)).catch(()=>{})}selectBooth(e){if(typeof e!="string"&&!Array.isArray(e)){a("selectBooth","Parameter must be a string or an array of strings.","EFP000000");return}const t=r.boothStore.booths.filter(o=>typeof e=="string"?o.name===e||o.externalId===e:e.includes(o.name)||e.includes(o.externalId));r.selectBooth(t)}selectExhibitor(e){if(typeof e!="string"&&!Array.isArray(e)){a("selectExhibitor","Parameter must be a string or an array of strings.","EFP000100");return}if(!e?.length){r.uiState.menu=!1,r.searchStore.resetSearchBox(),r.uiState.details=null;return}const t=r.exhibitorStore.exhibitors.filter(n=>typeof e=="string"?n.name===e||n.externalId===e:e.includes(n.name)||e.includes(n.externalId));if(!t?.length)return;if(typeof e=="string"){r.selectExhibitor(t[0]),r.moveToList([t[0]]);return}const o=t.flatMap(n=>n.booths.map(i=>i.layer)),s=ne(o.map(n=>n.description));s&&r.layerStore.updateVisibility(s,!0),r.uiState.menu=!1,r.searchStore.resetSearchBox(),r.uiState.details=null,r.uiState.list={type:"filter",items:t,query:{key:"exhibitors",value:t.map(n=>n.name).join(",")}},r.moveToList()}highlightExhibitors(e){Array.isArray(e)||a("highlightExhibitors","Parameter must be an array of strings.","EFP000200"),r.boothStore.highlightedByExternalIds=[],r.exhibitorStore.highlightedByExternalIds=[...e]}highlightBooths(e){Array.isArray(e)||a("highlightBooths","Parameter must be an array of strings.","EFP000300"),r.exhibitorStore.highlightedByExternalIds=[],r.boothStore.highlightedByExternalIds=[...e]}highlightEntities(e){Array.isArray(e)||a("highlightEntities","Parameter must be an array of strings.","EFP000400");const{boothExternalIds:t,exhibitorExternalIds:o}=B(e);r.boothStore.highlightedByExternalIds=[...t],r.exhibitorStore.highlightedByExternalIds=[...o]}selectRoute(e,t){if(Array.isArray(e)){let o=[...e];const s=o.shift(),n=o.pop();if(o.length>d)throw new Error(`The maximum number of waypoints is ${d}.`);if(!s||!n){a("selectRoute","Invalid route format: When providing an array, it must include at least two points: a start and a destination.","EFP000401");return}r.routeStore.selectRoute(new v(m(s),m(n),o.map(m)));return}e||a("selectRoute","At a minimum, the starting point must be passed.","EFP000402"),r.routeStore.selectRoute(new v(m(e),m(t)))}getOptimizedRoutes(e){if(!Array.isArray(e))return a("getOptimizedRoutes","Parameter must be an array.","EFP000500"),[];if(e.length>d)throw new Error(`The maximum number of waypoints is ${d}.`);const t=e.map(m).filter(s=>!!s);if(!t.length)throw new Error("No booths found for the provided waypoints.");const o=new Map;for(const s of t){const n=s.layer?.name??"",i=o.get(n);i?i.push(s):o.set(n,[s])}return Array.from(o.values()).map(s=>({waypoints:M(s.map(n=>[n.name,{x:n.rect.center.x,y:n.rect.center.y}]))}))}selectCurrentPosition(e,t,o){const s=y(e.x)&&y(e.y),n=y(e.lng)&&y(e.lat);!s&&!n&&a("selectCurrentPosition","A point must be passed. Either (x,y) or (lat,lng) are required.","EFP000600"),r.routeStore.selectCurrentPosition(e,t,o),this.onCurrentPositionChanged?.(e)}setBookmarks(e){(!Array.isArray(e)||!e.length)&&a("setBookmarks","Parameter must be an array.","EFP000700"),e.forEach(t=>{const o=r.exhibitorStore.exhibitors.find(s=>s.name===t.name||s.externalId===t.externalId);o&&(o.bookmarked=t.bookmarked)})}setEntitiesBookmarks(e){if(!Array.isArray(e)||!e.length){a("setEntitiesBookmarks","Parameter must be an array.","EFP000701");return}const t=["exhibitor","event","speaker","booth"],o=e.find(i=>!i.type||!t.includes(i.type));if(o){a("setEntitiesBookmarks",`Invalid entity type: ${o.type}. Must be one of: ${t.join(", ")}.`,"EFP000702");return}const s=C("bookmarked"),n={exhibitor:{existingIds:new Set(s.exhibitors||[]),finder:i=>r.exhibitorStore.findExhibitor(i),replacer:i=>r.exhibitorStore.replaceBookmarked(i)},event:{existingIds:new Set(s.events||[]),finder:i=>r.eventStore.findByNameOrSlug(i),replacer:i=>r.eventStore.replaceBookmarked(i)},speaker:{existingIds:new Set(s.speakers||[]),finder:i=>r.speakerStore.speakers.find(h=>h.name===i||h.externalId===i||h.slug===i),replacer:i=>r.speakerStore.replaceBookmarked(i)},booth:{existingIds:new Set(s.booths||[]),finder:i=>{const h=r.boothStore.findBooth(i);return h?.exhibitors.length===0?h:void 0},replacer:i=>r.boothStore.replaceBookmarked(i)}};e.forEach(i=>{const h=n[i.type],u=i.name||i.externalId||"",l=h.finder(u);l?i.bookmarked?h.existingIds.add(l.id):h.existingIds.delete(l.id):console.warn(`Entity not found: ${i.type} with query "${u}"`)}),Object.values(n).forEach(i=>{i.replacer(Array.from(i.existingIds))})}setEntitiesVisited(e){if(!Array.isArray(e)||!e.length){a("setEntitiesVisited","Parameter must be an array.","EFP000703");return}const t=["exhibitor","event"],o=e.find(i=>!i.type||!t.includes(i.type));if(o){a("setEntitiesVisited",`Invalid entity type: ${o.type}. Must be one of: ${t.join(", ")}.`,"EFP000704");return}const s=C("visited"),n={exhibitor:{existingIds:new Set(s.exhibitors||[]),finder:i=>r.exhibitorStore.findExhibitor(i),replacer:i=>r.exhibitorStore.replaceVisited(i)},event:{existingIds:new Set(s.events||[]),finder:i=>r.eventStore.findByNameOrSlug(i),replacer:i=>r.eventStore.replaceVisited(i)}};e.forEach(i=>{const h=n[i.type],u=i.name||i.externalId||"",l=h.finder(u);l?i.visited?h.existingIds.add(l.id):h.existingIds.delete(l.id):console.warn(`Entity not found: ${i.type} with query "${u}"`)}),Object.values(n).forEach(i=>{i.replacer(Array.from(i.existingIds))})}setMarkers(e){if(!e||!Array.isArray(e.icons)||!Array.isArray(e.markers)){a("setMarkers","Invalid input.","EFP000800");return}r.routeStore.setMarkers(e)}selectMarker(e,t=!0){return typeof e!="string"&&a("selectMarker","The identifier must be passed.","EFP000900"),r.routeStore.selectMarker(e,t)}drawCircles(e){Array.isArray(e)||a("drawCircles","Invalid input.","EFP000A00"),r.uiState.debugCircles=e}checkRoutes(){r.routeStore.checkRoutes()}updateLayerVisibility(e,t){typeof e!="string"&&a("updateLayerVisibility","The layer name (string) must be passed.","EFP000B00"),t||a("updateLayerVisibility","Passing a false value to visible will have no effect.","EFP000B01"),r.layerStore.updateVisibility(e,t)}getCenterCoordinates(){return r.fp.getCenterCoordinates()}exhibitorsList(){return r.exhibitorStore.exhibitors.map(e=>g(e))}boothsList(){return r.boothStore.booths.map(e=>g(e))}categoriesList(){return r.categoryStore.categories.map(e=>g(e))}selectCategory(e){if(e==null||typeof e!="string"){r.searchStore.selectSearch();return}const t=e?.toLowerCase(),o=r.categoryStore.categories.find(({name:s,slug:n})=>s?.toLowerCase()===t||n?.toLowerCase()===t);if(!o){a("selectCategory",`Category ${e} not found.`,"EFP000C01");return}r.selectCategory(o)}select(e){if(typeof e!="string"){a("select","Parameter must be a string.","EFP001700");return}const t=e,o=t?.toLowerCase(),s=r.boothStore.booths.find(l=>l.slug?.toLowerCase()===o||l.externalId?.toLowerCase()===o||l.externalId?.toLowerCase()?.replace(/\s+/g,"")===o);if(s){setTimeout(()=>r.selectBooth(s),250);return}const n=r.eventStore.eventItems.find(l=>l.slug?.toLowerCase()===o||l.externalId?.toLowerCase()===o);if(n){r.selectEventItem(n,!0);return}const i=r.exhibitorStore.exhibitors.find(l=>l.slug?.toLowerCase()===o||l.externalId?.toLowerCase()===o);if(i){setTimeout(()=>r.clickExhibitor(i),250);return}const h=r.categoryStore.categories.find(l=>l.slug===t);if(h){r.selectCategory(h);return}const u=r.speakerStore.findBySlug(t);if(u){r.selectSpeaker(u,!0);return}t.includes("heatmap=true")||r.searchStore.selectSearch(t)}showList(e){const t={bookmarks:()=>r.selectBookmarks(),visited:()=>r.selectVisited(),sessions:()=>r.selectSessions(),exhibitors:()=>r.selectExhibitors(),speakers:()=>r.selectSpeakers(),tours:()=>r.selectTours(),language:()=>r.selectLanguage()},o=t[e];if(!o){a("showList",`Unknown list "${e}". Must be one of: ${Object.keys(t).join(", ")}.`,"EFP001800");return}o()}selectTour(e){if(typeof e!="string"||!e){a("selectTour","A tour id must be passed.","EFP001900");return}const t=r.toursStore.getTourById(e);t?r.toursStore.launchTour(t,t.name,t.description):(console.warn(`Route with id "${e}" not found`),r.selectTours())}openPlanner(e={}){if(typeof e!="object"||e===null){a("openPlanner","An options object must be passed.","EFP001A00");return}const t=e.from?S(e.from):null;e.fromBookmarks?r.routePlannerStore.launchFromBookmarks(t??void 0):r.routePlannerStore.launchFromSlugs(e.items??[],t??void 0)}startBuildRoute(){r.uiState.startBuildRoute()}applyParameters(e){typeof e!="string"&&a("applyParameters","A query string must be passed.","EFP000D00"),Y(e)}getVisibility(){return r.uiState.visibility}setVisibility(e){(typeof e!="object"||!Object.keys(e).length)&&a("setVisibility","The parameter must be passed.","EFP000E00"),r.uiState.setVisibility(e)}findLocation(){r.routeStore.findLocation()}zoomIn(){r.uiState.zoomIn()}zoomOut(){r.uiState.zoomOut()}switchView(){r.maplibreStore.activateMaplibre()}setCamera(e){p("setCamera called with camera=%O",e);const t=I.safeParse(e);if(!t.success){a("setCamera",t.error.message,"EFP001B00");return}r.uiState.setMapSettings(ie(t.data))}getCamera(){return se(r.uiState.mapSettings)}zoomTo(e,t){p("zoomTo called with selectors=%O options=%O",e,t);const o=w.safeParse(e);if(!o.success){a("zoomTo",o.error.message,"EFP001600");return}const s=P.safeParse(t);if(!s.success){a("zoomTo",s.error.message,"EFP001601");return}const n=this.getBounds(e);n&&this.fitBounds(n,t)}getBounds(e){p("getBounds called with selectors=%O",e);const t=w.safeParse(e);if(!t.success){a("getBounds",t.error.message,"EFP001400");return}const o=[];if(e.booths?.forEach(n=>{let i;n.externalId?i=r.boothStore.boothByExternalId.get(n.externalId):n.name&&(i=r.boothStore.boothByName.get(n.name.toLowerCase())),i?.rect&&o.push(i.rect)}),e.exhibitors?.forEach(n=>{let i;n.externalId?i=r.exhibitorStore.exhibitorByExternalId.get(n.externalId):n.name&&(i=r.exhibitorStore.exhibitorByName.get(n.name.toLowerCase())),i?.booths?.forEach(h=>{h.rect&&o.push(h.rect)})}),o.length===0)return;const s=E.fromUnion(...o);return{leftTop:{x:s.min.x,y:s.min.y},rightBottom:{x:s.max.x,y:s.max.y}}}fitBounds(e,t){if(p("fitBounds called with bounds=%O options=%O",e,t),!e){r.uiState.fitBounds();return}const o=O.safeParse(e);if(!o.success){a("fitBounds",o.error.message,"EFP001500");return}const s=P.safeParse(t);if(!s.success){a("fitBounds",s.error.message,"EFP001501");return}const n=E.fromMinMax({x:e.leftTop.x,y:e.leftTop.y},{x:e.rightBottom.x,y:e.rightBottom.y});r.uiState.moveToRect=t?.padding?n.expand(t.padding):n}getBoothRect(e){typeof e!="string"&&a("getBoothRect","A booth name must be passed.","EFP000F00");const t=S(e)?.rect;return t?c.fromBox(t):void 0}convertToGeo(e,t){if(!b?.properties?.config){a("convertToGeo","The coordinates cannot be converted because the GPS configuration is not defined.","EFP001000");return}if(!e||!t){a("convertToGeo","Both coordinates must be passed.","EFP001001");return}return ae(e,t,b.properties.config)}getGeoConfig(){const e=b?.properties?.config;return e?{bearing:e.bearing??0,p0:e.p0,p1:e.p1,p2:e.p2}:null}releaseResources(){window.removeEventListener("error",te),this.disposeDetailsEvents?.(),this.disposeDetailsEvents=void 0,this.disposeBoothHitTest?.(),this.disposeBoothHitTest=void 0,r.maplibreStore.dispose(),K(),J(),_(),oe(),this.root.unmount(),super.releaseResources()}search(e){return typeof e!="string"&&a("search","A search string must be passed.","EFP001100"),r.fuzzySearchEngineStore.loadEngine().then(()=>(r.searchStore.selectSearch(e),r.uiState.fuzzySearchItems.map(t=>({item:g(t.item),score:t.score}))))}getFloors(){return r.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?.name&&e?.index==null){a("activateFloor","Invalid floorId. It must contain either a name or an index.","EFP001200");return}const t=this.getFloors();if(e.name){const o=t.find(s=>s.name===e.name||s.shortName===e.name);if(!o){a("activateFloor",`Floor with name "${e.name}" not found.`,"EFP001201");return}if(o.active)return;this.updateLayerVisibility(o.name,!0);return}if(e.index!==null){const o=t.find(n=>n.index===e.index),s=o?.name;if(!s){a("activateFloor",`Floor at index ${e.index} does not exist.`,"EFP001203");return}if(o.active)return;this.updateLayerVisibility(s,!0);return}}showPathway(e,t){const{boothExternalIds:o,exhibitorExternalIds:s}=t?.length?B(t):{boothExternalIds:[],exhibitorExternalIds:[]};W({pathwayId:e,boothIds:o,exhibitorIds:s})}showPathwayOnly(e,t){this.activateFloor({name:t}),r.layerStore.showPathWay(e),r.uiState.setPathwayOnlyMode(!0);const o=r.layerStore.findLayer(e),s=r.layerStore.findLayer(t),n=o?.rect||o?.viewbox?o:s;if(n?.rect||n?.viewbox){const i=n.viewbox??n.rect;r.uiState.moveToRect=i.clone()}}hidePathways(){this.highlightBooths([]),r.layerStore.hidePathways(),r.uiState.setPathwayOnlyMode(!1)}showSearch(){r.selectSearch("")}changeLanguage(e){const t=e?.toLowerCase?.();if(!le(t)){a("changeLanguage",`Language "${e}" was not found. Available languages: ${he().map(o=>o.id).join(",")}`,"EFP001300");return}ce(t)}isGpsTrackingEnabled(){return r.routeStore.gpsEnabled}setGpsTrackingEnabled(e){r.routeStore.setGpsTrackingEnabled(e)}deselectCurrentPosition(){r.routeStore.selectCurrentPosition(null,!1)}deselectRoute(){r.routeStore.selectRoute(null),r.routeStore.setOnlyAccessible(!1)}reset(){this.selectBooth(""),this.selectExhibitor(""),this.selectCategory(),this.deselectCurrentPosition(),this.deselectRoute(),this.highlightEntities([]),r.uiState.kioskData&&r.resetCameraFn?r.resetCameraFn?.():this.fitBounds()}selectAccessibleRoute(e){r.routeStore.setOnlyAccessible(!0),this.selectRoute(e)}}function m(f){return typeof f=="string"?S(f):r.routeStore.getNearestBooth(f)}let L=0;function a(f,e,t){const o=`Error calling "${f}" SDK method.`,s=`${e.endsWith(".")?e:e+"."} More information at`;let n="https://js-sdk.expofp.com/api/packages";if(t&&(n+=`#error-${t}`),console.error(`${o} ${s} ${n}`),r.fp.disableRuntimeAlerts)return;r.uiState.setGlobalErrorMessage({title:o,body:A(T,{children:[s," ",x("a",{href:n,target:"_blank",rel:"noreferrer",children:n})]})}),clearTimeout(L);const i=8e3;L=window.setTimeout(()=>{const h=async()=>{r.uiState.globalErrorMessages.length>0&&(r.uiState.popGlobalErrorMessage(),await new Promise(u=>setTimeout(u,i/2)),h())};h()},i)}class c{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,o,s){if(e>o){const n=e;e=o,o=n}if(t>s){const n=t;t=s,s=n}this.x1=e,this.y1=t,this.x2=o,this.y2=s}static fromBox(e){return new c(e.min.x,e.min.y,e.max.x,e.max.y)}static fromCxcywh(e,t,o,s){return new c(e-o/2,t-s/2,e+o/2,t+s/2)}contains(e){return e.x1>=this.x1&&e.x2<=this.x2&&e.y1>=this.y1&&e.y2<=this.y2}intersects(e){const t=Math.max(this.x1,e.x1),o=Math.min(this.x2,e.x2),s=Math.max(this.y1,e.y1),n=Math.min(this.y2,e.y2);return o>=t&&n>=s}getIntersection(e){const t=Math.max(this.x1,e.x1),o=Math.min(this.x2,e.x2),s=Math.max(this.y1,e.y1),n=Math.min(this.y2,e.y2);return o>=t&&n>=s?new c(t,s,o,n):new c(0,0,0,0)}getRotated90(){return c.fromCxcywh(this.cx,this.cy,this.h,this.w)}normalize(e,t){return new c(this.x1/e,this.y1/t,this.x2/e,this.y2/t)}withPadding(e,t=e){return this.w<e*2||this.h<t*2?this:c.fromCxcywh(this.cx,this.cy,this.w-e*2,this.h-t*2)}scale(e){return new c(this.x1*e,this.y1*e,this.x2*e,this.y2*e)}getArea(){return this.w*this.h}clone(){return new c(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}}
@@ -1 +1 @@
1
- import{update as l}from"@expofp/renderer";import{createWayfinding as S}from"@expofp/wayfinding";import{fpGeo as g}from"../data/fpGeo";import{createImageDef as A,createLineDef as E}from"../engine/defs";import{getRotation as _}from"../engine/update-def";import{createCanvasIconProvider as L,createFloorContext as h,createGraphDataSource as v}from"./adapters";import{bindMobxReactions as W}from"./bindMobxReactions";import{createKioskHandler as I}from"./handlers/kioskHandler";import{createYahHandler as M}from"./handlers/yahHandler";import{WF_CURRENT_POSITION_LAYER_NAME as P,WF_LINES_ANIMATED_LAYER_NAME as x,WF_LINES_LAYER_NAME as N,WF_POINTS_LAYER_NAME as y,WF_TRAIL_LAYER_NAME as k}from"./layers";let u=null;export function isWayfindingReady(){return u!==null}function C(){if(!u)throw new Error("Wayfinding is not initialized \u2014 call createWayfinding() first.");return u}export function buildRoute(e,n,o){return C().wayfinding.buildRoute(e,n,o)}export function createWayfinding(e){const{scene:n,store:o,canvas:t}=e,c=n.rootLayer.children,{wayfinding:s,dispose:r}=w(o,{createImageDef:A,createLineDef:E,getRotation:_,layers:c,update:l}),i=T(c,y);return i.onClick=f=>D(s,f),i.onPointerMove=f=>m(s,t,f),i.onPointerOut=()=>m(s,t),l(i),()=>{i.onClick=void 0,i.onPointerMove=void 0,i.onPointerOut=void 0,t.current&&(t.current.style.cursor=""),l(i),r()}}function w(e,n){const o=v(),t=L({iconMap:e.fp.icons,pixelRatio:devicePixelRatio}),c=h(e.layerStore,e.routeStore),s={points:y,trail:k,lines:N,linesAnimated:x,currentPosition:P},r=S({dataSource:o,renderer:n,iconProvider:t,floorContext:c,layers:s,gpsConfig:g?.properties?.config,onTransitionClick:a=>{a.role==="exit"&&e.layerStore.updateVisibility(a.targetLayer,!0)},onRouteUpdate:(a,p)=>{e.routeStore.updateRoute([...a]),p.isEmpty()||(e.uiState.moveToRect=p)},onRouteDistance:a=>e.routeStore.updateRouteDistance(a)}),i=I({wayfinding:r,kioskIconMap:e.fp.icons,layer:s.points}),f=M({wayfinding:r,iconMap:e.fp.icons,pixelRatio:devicePixelRatio,floorContext:c,layer:s.points}),R=W({wayfinding:r,kioskHandler:i,yahHandler:f,stores:{routeStore:e.routeStore,uiState:e.uiState,layerStore:e.layerStore}});e.routeStore.showAccessible=o.getLines().some(a=>a.unaccessible);const d={wayfinding:r};return u=d,r.flush(),{wayfinding:r,dispose(){b(d)&&(u=null,e.routeStore.showAccessible=!1),R(),r.destroy()}}}function b(e){return u===e}function T(e,n){const o=e.find(t=>t.name===n);if(!o)throw new Error(`renderer: layer "${n}" not found in scene`);return o}function D(e,n){e.handleClick([n.def])&&n.stopPropagation()}function m(e,n,o){const t=n.current;if(!t)return;const c=o?e.handleHover([o.def]):!1;t.style.cursor=c?"pointer":""}
1
+ import{update as y}from"@expofp/renderer";import{createWayfinding as g}from"@expofp/wayfinding";import{fpGeo as A}from"../data/fpGeo";import{createImageDef as E,createLineDef as _}from"../engine/defs";import{attachCardinalSnap as h}from"../engine/utils/rotation";import{createCanvasIconProvider as L,createFloorContext as v,createGraphDataSource as I}from"./adapters";import{bindMobxReactions as W}from"./bindMobxReactions";import{createKioskHandler as M}from"./handlers/kioskHandler";import{createYahHandler as P}from"./handlers/yahHandler";import{WF_CURRENT_POSITION_LAYER_NAME as x,WF_LINES_ANIMATED_LAYER_NAME as C,WF_LINES_LAYER_NAME as N,WF_POINTS_LAYER_NAME as R,WF_TRAIL_LAYER_NAME as k}from"./layers";let f=null;export function isWayfindingReady(){return f!==null}function w(){if(!f)throw new Error("Wayfinding is not initialized \u2014 call createWayfinding() first.");return f}export function buildRoute(e,n,t){return w().wayfinding.buildRoute(e,n,t)}export function createWayfinding(e){const{scene:n,store:t,canvas:o}=e,c=n.rootLayer.children,{wayfinding:s,dispose:a}=b(t,{createImageDef:(u,p,l)=>{const{cardinalSnap:i,...d}=l??{},m=E(u,p,d);return i?h(m):m},createLineDef:_,layers:c,update:y}),r=T(c,R);return r.onClick=u=>F(s,u),r.onPointerMove=u=>S(s,o,u),r.onPointerOut=()=>S(s,o),y(r),()=>{r.onClick=void 0,r.onPointerMove=void 0,r.onPointerOut=void 0,o.current&&(o.current.style.cursor=""),y(r),a()}}function b(e,n){const t=I(),o=L({iconMap:e.fp.icons,pixelRatio:devicePixelRatio}),c=v(e.layerStore,e.routeStore),s={points:R,trail:k,lines:N,linesAnimated:C,currentPosition:x},a=g({dataSource:t,renderer:n,iconProvider:o,floorContext:c,layers:s,gpsConfig:A?.properties?.config,onTransitionClick:i=>{i.role==="exit"&&e.layerStore.updateVisibility(i.targetLayer,!0)},onRouteUpdate:(i,d)=>{e.routeStore.updateRoute([...i]),d.isEmpty()||(e.uiState.moveToRect=d)},onRouteDistance:i=>e.routeStore.updateRouteDistance(i)}),r=M({wayfinding:a,kioskIconMap:e.fp.icons,layer:s.points}),u=P({wayfinding:a,iconMap:e.fp.icons,pixelRatio:devicePixelRatio,floorContext:c,layer:s.points}),p=W({wayfinding:a,kioskHandler:r,yahHandler:u,stores:{routeStore:e.routeStore,uiState:e.uiState,layerStore:e.layerStore}});e.routeStore.showAccessible=t.getLines().some(i=>i.unaccessible);const l={wayfinding:a};return f=l,a.flush(),{wayfinding:a,dispose(){D(l)&&(f=null,e.routeStore.showAccessible=!1),p(),a.destroy()}}}function D(e){return f===e}function T(e,n){const t=e.find(o=>o.name===n);if(!t)throw new Error(`renderer: layer "${n}" not found in scene`);return t}function F(e,n){e.handleClick([n.def])&&n.stopPropagation()}function S(e,n,t){const o=n.current;if(!o)return;const c=t?e.handleHover([t.def]):!1;o.style.cursor=c?"pointer":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expofp/floorplan",
3
- "version": "3.31.4",
3
+ "version": "3.32.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/expofp/efp-app.git",
@@ -69,15 +69,15 @@
69
69
  "tslib": "^2.3.0",
70
70
  "uuid": "^9.0.1",
71
71
  "zod": "4.4.3",
72
- "@expofp/config": "3.31.4",
73
- "@expofp/debug": "3.31.4",
74
- "@expofp/geometry": "3.31.4",
75
- "@expofp/renderer": "3.31.4",
76
- "@expofp/resolve": "3.31.4",
77
- "@expofp/schema": "3.31.4",
78
- "@expofp/ui": "3.31.4",
79
- "@expofp/utils": "3.31.4",
80
- "@expofp/wayfinding": "3.31.4"
72
+ "@expofp/config": "3.32.0",
73
+ "@expofp/debug": "3.32.0",
74
+ "@expofp/geometry": "3.32.0",
75
+ "@expofp/renderer": "3.32.0",
76
+ "@expofp/resolve": "3.32.0",
77
+ "@expofp/schema": "3.32.0",
78
+ "@expofp/ui": "3.32.0",
79
+ "@expofp/utils": "3.32.0",
80
+ "@expofp/wayfinding": "3.32.0"
81
81
  },
82
82
  "devDependencies": {
83
83
  "@babel/plugin-proposal-decorators": "^8.0.2",