@expofp/floorplan 3.0.0 → 3.0.2

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 (75) hide show
  1. package/dist/browser/CookieConsent-CXdWbmhr.js +7810 -0
  2. package/dist/browser/Debug-DoJ9mct3.js +51 -0
  3. package/dist/browser/Demo-BEQponkS.js +65 -0
  4. package/dist/browser/Free-UAsV9h8C.js +65 -0
  5. package/dist/browser/Gallery-BgXxqVXz.js +3257 -0
  6. package/dist/browser/GpsLoader-CgbTy8Hz.js +152 -0
  7. package/dist/browser/KioskStore-YLbphfOD.js +212 -0
  8. package/dist/browser/Mapbox-DpLJ3tpl.js +120 -0
  9. package/dist/browser/SetKioskMode-CN5fJClI.js +49 -0
  10. package/dist/browser/ShowKiosk-vj5-CuR5.js +25 -0
  11. package/dist/browser/ThreeComponent-jLYP_yNl.js +1493 -0
  12. package/dist/browser/TouchHand-BbwYQQhu.js +66 -0
  13. package/dist/browser/ViewerMenuPanel-4kghKIxV.js +106 -0
  14. package/dist/browser/add-debug-secret-listener-DM6KcZ0J.js +26 -0
  15. package/dist/browser/boolean-editor-BrtABJXb.js +206 -0
  16. package/dist/browser/bundle.json +70 -40
  17. package/dist/browser/chunk-CG6jx9YN.js +28 -0
  18. package/dist/browser/classnames-DeFT1CBt.js +39 -0
  19. package/dist/browser/client-B6hKytWh.js +7601 -0
  20. package/dist/browser/data-BsqGAaoU.js +27969 -0
  21. package/dist/browser/debug-overlay-Cb6jZH1M.js +3995 -0
  22. package/dist/browser/debug-ui-XBqahA1W.js +86 -0
  23. package/dist/browser/dist-BcuX1Cs2.js +2581 -0
  24. package/dist/browser/favicon-Caa4UHOv.js +12 -0
  25. package/dist/browser/fetch-retry.umd-D6o13_3S.js +78 -0
  26. package/dist/browser/flex-glIwYu7S.js +1045 -0
  27. package/dist/browser/floorplan.ready-Dkfm7Nqq.js +1310 -0
  28. package/dist/browser/fuse-CrFUY0W8.js +887 -0
  29. package/dist/browser/index.js +10626 -12438
  30. package/dist/browser/jsx-runtime-P5gPgaNY.js +30 -0
  31. package/dist/browser/lib-BGCrbI0c.js +1859 -0
  32. package/dist/browser/main-B7nu_ayH.js +289 -0
  33. package/dist/browser/mobx-BwL1_Ioa.js +23 -0
  34. package/dist/browser/particles.min-r4ucWEQe.js +133 -0
  35. package/dist/browser/prop-types-_4KGi_BP.js +57 -0
  36. package/dist/browser/react-dom-BeKu02fc.js +139 -0
  37. package/dist/browser/reset-all-settings-CH3gzkuQ.js +17 -0
  38. package/dist/browser/settings-D1gM4Wtx.js +69 -0
  39. package/dist/browser/src--OC9EQnB.js +19 -0
  40. package/dist/browser/store-BpwlrbtP.js +36100 -0
  41. package/dist/browser/ui-Cy6VKwPB.js +33 -0
  42. package/dist/esm/components/Map/traffic/useBuildRoute.js +2 -2
  43. package/dist/esm/components/Map/traffic/useManageTraffic.js +1 -1
  44. package/dist/esm/store/FuzzySearchEngineStore.js +1 -1
  45. package/dist/esm/store/RootStore.js +1 -1
  46. package/package.json +4 -4
  47. package/dist/browser/Debug-Yknbb09q.js +0 -40
  48. package/dist/browser/Demo-CaOFZa6L.js +0 -47
  49. package/dist/browser/Free-DTL80JI4.js +0 -51
  50. package/dist/browser/Gallery-Du04PQQo.js +0 -71
  51. package/dist/browser/GpsLoader-Cvn6RlOm.js +0 -140
  52. package/dist/browser/KioskStore-De5ViEMC.js +0 -225
  53. package/dist/browser/Mapbox-DwX3p3Kb.js +0 -118
  54. package/dist/browser/SetKioskMode-DY8Ihzh_.js +0 -249
  55. package/dist/browser/ShowKiosk-fqRB_BUN.js +0 -35
  56. package/dist/browser/ThreeComponent-CrAcuY6n.js +0 -1595
  57. package/dist/browser/ViewerMenuPanel-CdiEJm9h.js +0 -77
  58. package/dist/browser/boolean-editor-BCIboJVq.js +0 -157
  59. package/dist/browser/client-BU0UzF6H.js +0 -10011
  60. package/dist/browser/data-DU1RvfMj.js +0 -22125
  61. package/dist/browser/debug-overlay-DMGwYhOT.js +0 -3675
  62. package/dist/browser/debug-ui-BZSH53uY.js +0 -67
  63. package/dist/browser/favicon-ZTHZQvuM.js +0 -13
  64. package/dist/browser/fetch-retry.umd-CFhXCSM1.js +0 -123
  65. package/dist/browser/flex-D0XnC5Mw.js +0 -400
  66. package/dist/browser/floorplan.ready-DwzYk5s3.js +0 -57655
  67. package/dist/browser/index-BZDxL6gh.js +0 -161
  68. package/dist/browser/index-BpZSlPvc.js +0 -3244
  69. package/dist/browser/index-BxFqdKuM.js +0 -57
  70. package/dist/browser/index-fEI_0iId.js +0 -882
  71. package/dist/browser/index-h3LFHvKr.js +0 -92
  72. package/dist/browser/index-xQ7Ip4HB.js +0 -54
  73. package/dist/browser/jsx-runtime-SRODV826.js +0 -40
  74. package/dist/browser/main-CcaoXWR4.js +0 -359
  75. package/dist/browser/particles.min-Ds_4ex2r.js +0 -143
@@ -1,92 +0,0 @@
1
- import { r as E, o as L } from "./index.js";
2
- import { j as _ } from "./jsx-runtime-SRODV826.js";
3
- (function() {
4
- try {
5
- var e = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {};
6
- e.SENTRY_RELEASE = { id: "3.0.0" };
7
- var t = new e.Error().stack;
8
- t && (e._sentryDebugIds = e._sentryDebugIds || {}, e._sentryDebugIds[t] = "fccd4ed1-9465-42f2-b700-f750be28f973", e._sentryDebugIdIdentifier = "sentry-dbid-fccd4ed1-9465-42f2-b700-f750be28f973");
9
- } catch {
10
- }
11
- })();
12
- let m = !1;
13
- function I() {
14
- m || (m = !0, !(typeof window > "u" && typeof document > "u") && import("./index-BxFqdKuM.js").then((e) => e.i).then(({
15
- renderDebugUi: e
16
- }) => {
17
- e();
18
- }).catch(() => {
19
- }));
20
- }
21
- const x = [], b = [], u = "efp-local-storage";
22
- function h(e, t, r, v) {
23
- const n = `efp-debug-setting-"${e}"`, s = () => D(localStorage.getItem(n), t), c = (o) => {
24
- localStorage.setItem(n, JSON.stringify(o)), w(n);
25
- }, f = () => {
26
- localStorage.removeItem(n), w(n);
27
- };
28
- b.push(f);
29
- function l() {
30
- const [o, i] = E.useState(s());
31
- return E.useEffect(() => {
32
- const p = () => i(s()), y = (a) => {
33
- a.key === n && p();
34
- }, S = (a) => {
35
- const {
36
- detail: d
37
- } = a;
38
- (d == null ? void 0 : d.key) === n && p();
39
- };
40
- return window.addEventListener("storage", y), window.addEventListener(u, S), () => {
41
- window.removeEventListener("storage", y), window.removeEventListener(u, S);
42
- };
43
- }, []), [o, c];
44
- }
45
- const g = () => {
46
- const [o, i] = l();
47
- return /* @__PURE__ */ _.jsx(r, { label: e, value: o, context: v, onChange: i });
48
- };
49
- return g.displayName = `DebugSetting(${e})`, x.push(g), {
50
- get: s,
51
- set: c,
52
- reset: f,
53
- useState: l
54
- };
55
- }
56
- function D(e, t) {
57
- if (e === null) return t;
58
- try {
59
- return JSON.parse(e);
60
- } catch {
61
- return t;
62
- }
63
- }
64
- function w(e) {
65
- window.dispatchEvent(new CustomEvent(u, {
66
- detail: {
67
- key: e
68
- }
69
- }));
70
- }
71
- function O(e) {
72
- const t = L.lazy(() => import("./boolean-editor-BCIboJVq.js").then((r) => ({
73
- default: r.BooleanEditor
74
- })));
75
- return h(e, !1, t);
76
- }
77
- function T() {
78
- b.forEach((e) => e());
79
- }
80
- const z = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
81
- __proto__: null,
82
- initDebug: I,
83
- registerBooleanSetting: O,
84
- registerSetting: h,
85
- resetAllSettings: T
86
- }, Symbol.toStringTag, { value: "Module" }));
87
- export {
88
- T as a,
89
- x as e,
90
- z as i,
91
- O as r
92
- };
@@ -1,54 +0,0 @@
1
- import { k as u } from "./index.js";
2
- import { r as p } from "./index-BZDxL6gh.js";
3
- (function() {
4
- try {
5
- var t = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {};
6
- t.SENTRY_RELEASE = { id: "3.0.0" };
7
- var o = new t.Error().stack;
8
- o && (t._sentryDebugIds = t._sentryDebugIds || {}, t._sentryDebugIds[o] = "07b1170b-4055-482f-9eec-cdae396360ab", t._sentryDebugIdIdentifier = "sentry-dbid-07b1170b-4055-482f-9eec-cdae396360ab");
9
- } catch {
10
- }
11
- })();
12
- var i = { exports: {} };
13
- var f;
14
- function d() {
15
- return f || (f = 1, (function(t) {
16
- (function() {
17
- var o = {}.hasOwnProperty;
18
- function n() {
19
- for (var e = "", r = 0; r < arguments.length; r++) {
20
- var s = arguments[r];
21
- s && (e = a(e, c(s)));
22
- }
23
- return e;
24
- }
25
- function c(e) {
26
- if (typeof e == "string" || typeof e == "number")
27
- return e;
28
- if (typeof e != "object")
29
- return "";
30
- if (Array.isArray(e))
31
- return n.apply(null, e);
32
- if (e.toString !== Object.prototype.toString && !e.toString.toString().includes("[native code]"))
33
- return e.toString();
34
- var r = "";
35
- for (var s in e)
36
- o.call(e, s) && e[s] && (r = a(r, s));
37
- return r;
38
- }
39
- function a(e, r) {
40
- return r ? e ? e + " " + r : e + r : e;
41
- }
42
- t.exports ? (n.default = n, t.exports = n) : window.classNames = n;
43
- })();
44
- })(i)), i.exports;
45
- }
46
- var l = d();
47
- const v = /* @__PURE__ */ u(l);
48
- var b = p();
49
- const x = /* @__PURE__ */ u(b);
50
- export {
51
- x as R,
52
- b as r,
53
- v as y
54
- };
@@ -1,40 +0,0 @@
1
- (function() {
2
- try {
3
- var r = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {};
4
- r.SENTRY_RELEASE = { id: "3.0.0" };
5
- var a = new r.Error().stack;
6
- a && (r._sentryDebugIds = r._sentryDebugIds || {}, r._sentryDebugIds[a] = "6aa5acce-bbae-4352-a6aa-9212ad4bd577", r._sentryDebugIdIdentifier = "sentry-dbid-6aa5acce-bbae-4352-a6aa-9212ad4bd577");
7
- } catch {
8
- }
9
- })();
10
- var d = { exports: {} }, n = {};
11
- var o;
12
- function x() {
13
- if (o) return n;
14
- o = 1;
15
- var r = /* @__PURE__ */ Symbol.for("react.transitional.element"), a = /* @__PURE__ */ Symbol.for("react.fragment");
16
- function s(f, e, t) {
17
- var u = null;
18
- if (t !== void 0 && (u = "" + t), e.key !== void 0 && (u = "" + e.key), "key" in e) {
19
- t = {};
20
- for (var i in e)
21
- i !== "key" && (t[i] = e[i]);
22
- } else t = e;
23
- return e = t.ref, {
24
- $$typeof: r,
25
- type: f,
26
- key: u,
27
- ref: e !== void 0 ? e : null,
28
- props: t
29
- };
30
- }
31
- return n.Fragment = a, n.jsx = s, n.jsxs = s, n;
32
- }
33
- var l;
34
- function R() {
35
- return l || (l = 1, d.exports = x()), d.exports;
36
- }
37
- var E = R();
38
- export {
39
- E as j
40
- };
@@ -1,359 +0,0 @@
1
- (function() {
2
- try {
3
- var o = typeof window < "u" ? window : typeof global < "u" ? global : typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : {};
4
- o.SENTRY_RELEASE = { id: "3.0.0" };
5
- var t = new o.Error().stack;
6
- t && (o._sentryDebugIds = o._sentryDebugIds || {}, o._sentryDebugIds[t] = "7bb9c1f4-826f-44b2-80a8-3d0519897683", o._sentryDebugIdIdentifier = "sentry-dbid-7bb9c1f4-826f-44b2-80a8-3d0519897683");
7
- } catch {
8
- }
9
- })();
10
- class u {
11
- constructor(t, e, i) {
12
- this.id = 0, this.name = t, this.fg = e, this.bg = i, this.gradient = null, this.PR = Math.round(window.devicePixelRatio || 1), this.WIDTH = 90 * this.PR, this.HEIGHT = 48 * this.PR, this.TEXT_X = 3 * this.PR, this.TEXT_Y = 2 * this.PR, this.GRAPH_X = 3 * this.PR, this.GRAPH_Y = 15 * this.PR, this.GRAPH_WIDTH = 84 * this.PR, this.GRAPH_HEIGHT = 30 * this.PR, this.canvas = document.createElement("canvas"), this.canvas.width = this.WIDTH, this.canvas.height = this.HEIGHT, this.canvas.style.width = "90px", this.canvas.style.height = "48px", this.canvas.style.position = "absolute", this.canvas.style.cssText = "width:90px;height:48px;background-color: transparent !important;", this.context = this.canvas.getContext("2d"), this.initializeCanvas();
13
- }
14
- createGradient() {
15
- if (!this.context)
16
- throw new Error("No context");
17
- const t = this.context.createLinearGradient(
18
- 0,
19
- this.GRAPH_Y,
20
- 0,
21
- this.GRAPH_Y + this.GRAPH_HEIGHT
22
- );
23
- let e;
24
- const i = this.fg;
25
- switch (this.fg.toLowerCase()) {
26
- case "#0ff":
27
- e = "#006666";
28
- break;
29
- case "#0f0":
30
- e = "#006600";
31
- break;
32
- case "#ff0":
33
- e = "#666600";
34
- break;
35
- case "#e1e1e1":
36
- e = "#666666";
37
- break;
38
- default:
39
- e = this.bg;
40
- break;
41
- }
42
- return t.addColorStop(0, e), t.addColorStop(1, i), t;
43
- }
44
- initializeCanvas() {
45
- this.context && (this.context.imageSmoothingEnabled = !1, this.context.font = "bold " + 9 * this.PR + "px Helvetica,Arial,sans-serif", this.context.textBaseline = "top", this.gradient = this.createGradient(), this.context.fillStyle = this.bg, this.context.fillRect(0, 0, this.WIDTH, this.HEIGHT), this.context.fillStyle = this.fg, this.context.fillText(this.name, this.TEXT_X, this.TEXT_Y), this.context.fillStyle = this.bg, this.context.globalAlpha = 0.9, this.context.fillRect(this.GRAPH_X, this.GRAPH_Y, this.GRAPH_WIDTH, this.GRAPH_HEIGHT));
46
- }
47
- // Update only text portion
48
- update(t, e, i = 0) {
49
- if (!this.context || !this.gradient)
50
- return;
51
- const s = Math.min(1 / 0, t), h = Math.max(e, t);
52
- this.context.globalAlpha = 1, this.context.fillStyle = this.bg, this.context.fillRect(0, 0, this.WIDTH, this.GRAPH_Y), this.context.fillStyle = this.fg, this.context.fillText(
53
- `${t.toFixed(i)} ${this.name} (${s.toFixed(i)}-${parseFloat(h.toFixed(i))})`,
54
- this.TEXT_X,
55
- this.TEXT_Y
56
- );
57
- }
58
- // Update only graph portion
59
- updateGraph(t, e) {
60
- if (!this.context || !this.gradient)
61
- return;
62
- t === 0 && e === 0 && (e = 1), e = Math.max(e, t, 0.1), t = Math.max(t, 0);
63
- const i = Math.round(this.GRAPH_X), s = Math.round(this.GRAPH_Y), h = Math.round(this.GRAPH_WIDTH), a = Math.round(this.GRAPH_HEIGHT), n = Math.round(this.PR);
64
- this.context.drawImage(
65
- this.canvas,
66
- i + n,
67
- s,
68
- h - n,
69
- a,
70
- i,
71
- s,
72
- h - n,
73
- a
74
- ), this.context.fillStyle = this.bg, this.context.fillRect(
75
- i + h - n,
76
- s,
77
- n,
78
- a
79
- );
80
- const r = Math.min(
81
- a,
82
- Math.round(t / e * a)
83
- );
84
- r > 0 && (this.context.globalAlpha = 0.9, this.context.fillStyle = this.gradient, this.context.fillRect(
85
- i + h - n,
86
- s + (a - r),
87
- n,
88
- r
89
- )), this.context.globalAlpha = 1;
90
- }
91
- }
92
- class T extends u {
93
- constructor(t, e, i) {
94
- super(t, e, i), this.vsyncValue = 0, this.SMALL_HEIGHT = 9 * this.PR, this.HEIGHT = this.SMALL_HEIGHT, this.WIDTH = 35 * this.PR, this.TEXT_Y = 0 * this.PR, this.canvas.height = this.HEIGHT, this.canvas.width = this.WIDTH, this.canvas.style.height = "9px", this.canvas.style.width = "35px", this.canvas.style.cssText = `
95
- width: 35px;
96
- height: 9px;
97
- position: absolute;
98
- top: 0;
99
- left: 0;
100
- background-color: transparent !important;
101
- pointer-events: none;
102
- `, this.initializeCanvas();
103
- }
104
- initializeCanvas() {
105
- this.context && (this.context.imageSmoothingEnabled = !1, this.context.font = "bold " + 9 * this.PR + "px Helvetica,Arial,sans-serif", this.context.textBaseline = "top", this.context.globalAlpha = 1);
106
- }
107
- // Override update for VSync-specific display
108
- update(t, e, i = 0) {
109
- this.context && (this.vsyncValue = t, this.context.clearRect(0, 0, this.WIDTH, this.HEIGHT), this.context.globalAlpha = 1, this.context.fillStyle = this.bg, this.context.fillText(
110
- `${t.toFixed(0)}Hz`,
111
- this.TEXT_X,
112
- this.TEXT_Y
113
- ));
114
- }
115
- // Override updateGraph to do nothing (we don't need a graph for VSync)
116
- updateGraph(t, e) {
117
- }
118
- // Method to set the offset position relative to parent panel
119
- setOffset(t, e) {
120
- this.canvas.style.transform = `translate(${t}px, ${e}px)`;
121
- }
122
- }
123
- const f = class c {
124
- constructor({
125
- trackGPU: t = !1,
126
- trackCPT: e = !1,
127
- trackHz: i = !1,
128
- trackFPS: s = !0,
129
- logsPerSecond: h = 4,
130
- graphsPerSecond: a = 30,
131
- samplesLog: n = 40,
132
- samplesGraph: r = 10,
133
- precision: l = 2,
134
- minimal: d = !1,
135
- horizontal: m = !0,
136
- mode: p = 0
137
- } = {}) {
138
- this.gl = null, this.ext = null, this.activeQuery = null, this.gpuQueries = [], this.threeRendererPatched = !1, this.frameTimes = [], this.renderCount = 0, this.totalCpuDuration = 0, this.totalGpuDuration = 0, this.totalGpuDurationCompute = 0, this.fpsPanel = null, this.msPanel = null, this.gpuPanel = null, this.gpuPanelCompute = null, this.vsyncPanel = null, this.averageFps = { logs: [], graph: [] }, this.averageCpu = { logs: [], graph: [] }, this.averageGpu = { logs: [], graph: [] }, this.averageGpuCompute = { logs: [], graph: [] }, this.updateCounter = 0, this.lastMin = {}, this.lastMax = {}, this.lastValue = {}, this.VSYNC_RATES = [
139
- { refreshRate: 60, frameTime: 16.67 },
140
- { refreshRate: 75, frameTime: 13.33 },
141
- { refreshRate: 90, frameTime: 11.11 },
142
- { refreshRate: 120, frameTime: 8.33 },
143
- { refreshRate: 144, frameTime: 6.94 },
144
- { refreshRate: 165, frameTime: 6.06 },
145
- { refreshRate: 240, frameTime: 4.17 }
146
- ], this.detectedVSync = null, this.frameTimeHistory = [], this.HISTORY_SIZE = 120, this.VSYNC_THRESHOLD = 0.05, this.lastFrameTime = 0, this.handleClick = (P) => {
147
- P.preventDefault(), this.showPanel(++this.mode % this.dom.children.length);
148
- }, this.handleResize = () => {
149
- this.fpsPanel && this.resizePanel(this.fpsPanel), this.msPanel && this.resizePanel(this.msPanel), this.gpuPanel && this.resizePanel(this.gpuPanel), this.gpuPanelCompute && this.resizePanel(this.gpuPanelCompute);
150
- }, this.mode = p, this.horizontal = m, this.minimal = d, this.trackGPU = t, this.trackCPT = e, this.trackHz = i, this.trackFPS = s, this.samplesLog = n, this.samplesGraph = r, this.precision = l, this.logsPerSecond = h, this.graphsPerSecond = a;
151
- const g = performance.now();
152
- this.prevGraphTime = g, this.dom = document.createElement("div"), this.initializeDOM(), this.beginTime = performance.now(), this.prevTextTime = this.beginTime, this.prevCpuTime = this.beginTime, this._panelId = 0, this.trackFPS && (this.fpsPanel = this.addPanel(new c.Panel("FPS", "#0ff", "#002")), this.msPanel = this.addPanel(new c.Panel("CPU", "#0f0", "#020"))), this.trackHz === !0 && (this.vsyncPanel = new T("", "#f0f", "#202"), this.dom.appendChild(this.vsyncPanel.canvas), this.vsyncPanel.setOffset(56, 35)), this.setupEventListeners();
153
- }
154
- initializeDOM() {
155
- this.dom.style.cssText = `
156
- position: fixed;
157
- top: 0;
158
- left: 0;
159
- opacity: 0.9;
160
- z-index: 10000;
161
- ${this.minimal ? "cursor: pointer;" : ""}
162
- `;
163
- }
164
- setupEventListeners() {
165
- this.minimal ? (this.dom.addEventListener("click", this.handleClick), this.showPanel(this.mode)) : window.addEventListener("resize", this.handleResize);
166
- }
167
- async init(t) {
168
- if (!t) {
169
- console.error('Stats: The "canvas" parameter is undefined.');
170
- return;
171
- }
172
- if (!this.handleThreeRenderer(t) && !await this.handleWebGPURenderer(t))
173
- if (this.initializeWebGL(t)) {
174
- this.trackGPU && this.initializeGPUTracking();
175
- return;
176
- } else
177
- console.error("Stats-gl: Failed to initialize WebGL context");
178
- }
179
- handleThreeRenderer(t) {
180
- return t.isWebGLRenderer && !this.threeRendererPatched ? (this.patchThreeRenderer(t), this.gl = t.getContext(), this.trackGPU && this.initializeGPUTracking(), !0) : !1;
181
- }
182
- async handleWebGPURenderer(t) {
183
- return t.isWebGPURenderer ? ((this.trackGPU || this.trackCPT) && (t.backend.trackTimestamp = !0, t._initialized || await t.init(), t.hasFeature("timestamp-query") && this.initializeWebGPUPanels()), this.info = t.info, this.patchThreeWebGPU(t), !0) : !1;
184
- }
185
- initializeWebGPUPanels() {
186
- this.trackGPU && (this.gpuPanel = this.addPanel(new c.Panel("GPU", "#ff0", "#220"))), this.trackCPT && (this.gpuPanelCompute = this.addPanel(new c.Panel("CPT", "#e1e1e1", "#212121")));
187
- }
188
- initializeWebGL(t) {
189
- if (t instanceof WebGL2RenderingContext)
190
- this.gl = t;
191
- else if (t instanceof HTMLCanvasElement || t instanceof OffscreenCanvas) {
192
- if (this.gl = t.getContext("webgl2"), !this.gl)
193
- return console.error("Stats: Unable to obtain WebGL2 context."), !1;
194
- } else
195
- return console.error(
196
- "Stats: Invalid input type. Expected WebGL2RenderingContext, HTMLCanvasElement, or OffscreenCanvas."
197
- ), !1;
198
- return !0;
199
- }
200
- initializeGPUTracking() {
201
- this.gl && (this.ext = this.gl.getExtension("EXT_disjoint_timer_query_webgl2"), this.ext && (this.gpuPanel = this.addPanel(new c.Panel("GPU", "#ff0", "#220"))));
202
- }
203
- begin() {
204
- this.beginProfiling("cpu-started"), !(!this.gl || !this.ext) && (this.activeQuery && this.gl.endQuery(this.ext.TIME_ELAPSED_EXT), this.activeQuery = this.gl.createQuery(), this.activeQuery && this.gl.beginQuery(this.ext.TIME_ELAPSED_EXT, this.activeQuery));
205
- }
206
- end() {
207
- this.renderCount++, this.gl && this.ext && this.activeQuery && (this.gl.endQuery(this.ext.TIME_ELAPSED_EXT), this.gpuQueries.push({ query: this.activeQuery }), this.activeQuery = null), this.endProfiling("cpu-started", "cpu-finished", "cpu-duration");
208
- }
209
- update() {
210
- this.endProfiling("cpu-started", "cpu-finished", "cpu-duration"), this.info ? this.processWebGPUTimestamps() : this.processGpuQueries(), this.updateAverages(), this.resetCounters();
211
- }
212
- processWebGPUTimestamps() {
213
- this.totalGpuDuration = this.info.render.timestamp, this.totalGpuDurationCompute = this.info.compute.timestamp;
214
- }
215
- resetCounters() {
216
- this.renderCount = 0, this.totalCpuDuration = 0, this.beginTime = this.endInternal();
217
- }
218
- resizePanel(t) {
219
- t.canvas.style.position = "absolute", this.minimal ? t.canvas.style.display = "none" : (t.canvas.style.display = "block", this.horizontal ? (t.canvas.style.top = "0px", t.canvas.style.left = t.id * t.WIDTH / t.PR + "px") : (t.canvas.style.left = "0px", t.canvas.style.top = t.id * t.HEIGHT / t.PR + "px"));
220
- }
221
- addPanel(t) {
222
- return t.canvas && (this.dom.appendChild(t.canvas), t.id = this._panelId, this.resizePanel(t), this._panelId++), t;
223
- }
224
- showPanel(t) {
225
- for (let e = 0; e < this.dom.children.length; e++) {
226
- const i = this.dom.children[e];
227
- i.style.display = e === t ? "block" : "none";
228
- }
229
- this.mode = t;
230
- }
231
- processGpuQueries() {
232
- !this.gl || !this.ext || (this.totalGpuDuration = 0, this.gpuQueries.forEach((t, e) => {
233
- if (this.gl) {
234
- const i = this.gl.getQueryParameter(t.query, this.gl.QUERY_RESULT_AVAILABLE), s = this.gl.getParameter(this.ext.GPU_DISJOINT_EXT);
235
- if (i && !s) {
236
- const a = this.gl.getQueryParameter(t.query, this.gl.QUERY_RESULT) * 1e-6;
237
- this.totalGpuDuration += a, this.gl.deleteQuery(t.query), this.gpuQueries.splice(e, 1);
238
- }
239
- }
240
- }));
241
- }
242
- detectVSync(t) {
243
- if (this.lastFrameTime === 0) {
244
- this.lastFrameTime = t;
245
- return;
246
- }
247
- const e = t - this.lastFrameTime;
248
- if (this.lastFrameTime = t, this.frameTimeHistory.push(e), this.frameTimeHistory.length > this.HISTORY_SIZE && this.frameTimeHistory.shift(), this.frameTimeHistory.length < 60)
249
- return;
250
- const i = this.frameTimeHistory.reduce((r, l) => r + l) / this.frameTimeHistory.length, s = this.frameTimeHistory.reduce((r, l) => r + Math.pow(l - i, 2), 0) / this.frameTimeHistory.length;
251
- if (Math.sqrt(s) > 2) {
252
- this.detectedVSync = null;
253
- return;
254
- }
255
- let a = null, n = 1 / 0;
256
- for (const r of this.VSYNC_RATES) {
257
- const l = Math.abs(i - r.frameTime);
258
- l < n && (n = l, a = r);
259
- }
260
- a && n / a.frameTime <= this.VSYNC_THRESHOLD ? this.detectedVSync = a : this.detectedVSync = null;
261
- }
262
- endInternal() {
263
- var t;
264
- const e = performance.now();
265
- for (this.frameTimes.push(e); this.frameTimes.length > 0 && this.frameTimes[0] <= e - 1e3; )
266
- this.frameTimes.shift();
267
- const i = Math.round(this.frameTimes.length);
268
- this.addToAverage(i, this.averageFps);
269
- const s = e >= this.prevTextTime + 1e3 / this.logsPerSecond, h = e >= this.prevGraphTime + 1e3 / this.graphsPerSecond;
270
- if (this.updatePanelComponents(this.fpsPanel, this.averageFps, 0, s, h), this.updatePanelComponents(this.msPanel, this.averageCpu, this.precision, s, h), this.gpuPanel && this.updatePanelComponents(this.gpuPanel, this.averageGpu, this.precision, s, h), this.trackCPT && this.gpuPanelCompute && this.updatePanelComponents(this.gpuPanelCompute, this.averageGpuCompute, this.precision, s, h), s && (this.prevTextTime = e), h && (this.prevGraphTime = e), this.vsyncPanel !== null) {
271
- this.detectVSync(e);
272
- const a = ((t = this.detectedVSync) == null ? void 0 : t.refreshRate) || 0;
273
- s && a > 0 && this.vsyncPanel.update(a, a);
274
- }
275
- return e;
276
- }
277
- updatePanelComponents(t, e, i, s, h) {
278
- if (!t || e.logs.length === 0)
279
- return;
280
- t.name in this.lastMin || (this.lastMin[t.name] = 1 / 0, this.lastMax[t.name] = 0, this.lastValue[t.name] = 0);
281
- const a = e.logs[e.logs.length - 1];
282
- this.lastMax[t.name] = Math.max(...e.logs), this.lastMin[t.name] = Math.min(this.lastMin[t.name], a), this.lastValue[t.name] = this.lastValue[t.name] * 0.7 + a * 0.3;
283
- const n = Math.max(
284
- Math.max(...e.logs),
285
- ...e.graph.slice(-this.samplesGraph)
286
- );
287
- this.updateCounter++, s && t.update(
288
- this.lastValue[t.name],
289
- this.lastMax[t.name],
290
- i
291
- ), h && t.updateGraph(
292
- a,
293
- n
294
- );
295
- }
296
- beginProfiling(t) {
297
- if (window.performance)
298
- try {
299
- window.performance.clearMarks(t), window.performance.mark(t);
300
- } catch (e) {
301
- console.debug("Stats: Performance marking failed:", e);
302
- }
303
- }
304
- endProfiling(t, e, i) {
305
- if (!(!window.performance || !e || !t))
306
- try {
307
- window.performance.getEntriesByName(t, "mark").length === 0 && this.beginProfiling(t), window.performance.clearMarks(e), window.performance.mark(e), window.performance.clearMeasures(i);
308
- const h = performance.measure(i, t, e);
309
- this.totalCpuDuration += h.duration, window.performance.clearMarks(t), window.performance.clearMarks(e), window.performance.clearMeasures(i);
310
- } catch (s) {
311
- console.debug("Stats: Performance measurement failed:", s);
312
- }
313
- }
314
- updatePanel(t, e, i = 2) {
315
- if (!t || e.logs.length === 0)
316
- return;
317
- const s = performance.now();
318
- t.name in this.lastMin || (this.lastMin[t.name] = 1 / 0, this.lastMax[t.name] = 0, this.lastValue[t.name] = 0);
319
- const h = e.logs[e.logs.length - 1], a = Math.max(...e.logs.slice(-30));
320
- this.lastMin[t.name] = Math.min(this.lastMin[t.name], h), this.lastMax[t.name] = Math.max(this.lastMax[t.name], h), this.lastValue[t.name] = this.lastValue[t.name] * 0.7 + h * 0.3;
321
- const n = Math.max(a, ...e.graph.slice(-this.samplesGraph));
322
- this.updateCounter++, this.updateCounter % (this.logsPerSecond * 2) === 0 && (this.lastMax[t.name] = a, this.lastMin[t.name] = h), t.update && (s >= this.prevCpuTime + 1e3 / this.logsPerSecond && t.update(
323
- this.lastValue[t.name],
324
- h,
325
- this.lastMax[t.name],
326
- n,
327
- i
328
- ), s >= this.prevGraphTime + 1e3 / this.graphsPerSecond && (t.updateGraph(
329
- h,
330
- n
331
- ), this.prevGraphTime = s));
332
- }
333
- updateAverages() {
334
- this.addToAverage(this.totalCpuDuration, this.averageCpu), this.addToAverage(this.totalGpuDuration, this.averageGpu), this.info && this.totalGpuDurationCompute !== void 0 && this.addToAverage(this.totalGpuDurationCompute, this.averageGpuCompute);
335
- }
336
- addToAverage(t, e) {
337
- e.logs.push(t), e.logs.length > this.samplesLog && (e.logs = e.logs.slice(-this.samplesLog)), e.graph.push(t), e.graph.length > this.samplesGraph && (e.graph = e.graph.slice(-this.samplesGraph));
338
- }
339
- get domElement() {
340
- return this.dom;
341
- }
342
- patchThreeWebGPU(t) {
343
- const e = t.info.reset, i = this;
344
- t.info.reset = function() {
345
- i.beginProfiling("cpu-started"), e.call(this);
346
- };
347
- }
348
- patchThreeRenderer(t) {
349
- const e = t.render, i = this;
350
- t.render = function(s, h) {
351
- i.begin(), e.call(this, s, h), i.end();
352
- }, this.threeRendererPatched = !0;
353
- }
354
- };
355
- f.Panel = u;
356
- let x = f;
357
- export {
358
- x as default
359
- };