@deck.gl/widgets 9.1.12 → 9.2.0-alpha.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 (157) hide show
  1. package/dist/compass-widget.d.ts +11 -34
  2. package/dist/compass-widget.d.ts.map +1 -1
  3. package/dist/compass-widget.js +27 -62
  4. package/dist/compass-widget.js.map +1 -1
  5. package/dist/context-menu-widget.d.ts +37 -0
  6. package/dist/context-menu-widget.d.ts.map +1 -0
  7. package/dist/context-menu-widget.js +74 -0
  8. package/dist/context-menu-widget.js.map +1 -0
  9. package/dist/dist.dev.js +2271 -581
  10. package/dist/fps-widget.d.ts +29 -0
  11. package/dist/fps-widget.d.ts.map +1 -0
  12. package/dist/fps-widget.js +51 -0
  13. package/dist/fps-widget.js.map +1 -0
  14. package/dist/fullscreen-widget.d.ts +15 -33
  15. package/dist/fullscreen-widget.d.ts.map +1 -1
  16. package/dist/fullscreen-widget.js +20 -51
  17. package/dist/fullscreen-widget.js.map +1 -1
  18. package/dist/geocoder-widget.d.ts +51 -0
  19. package/dist/geocoder-widget.d.ts.map +1 -0
  20. package/dist/geocoder-widget.js +138 -0
  21. package/dist/geocoder-widget.js.map +1 -0
  22. package/dist/gimbal-widget.d.ts +33 -0
  23. package/dist/gimbal-widget.d.ts.map +1 -0
  24. package/dist/gimbal-widget.js +116 -0
  25. package/dist/gimbal-widget.js.map +1 -0
  26. package/dist/index.cjs +1587 -341
  27. package/dist/index.cjs.map +4 -4
  28. package/dist/index.d.ts +37 -8
  29. package/dist/index.d.ts.map +1 -1
  30. package/dist/index.js +27 -7
  31. package/dist/index.js.map +1 -1
  32. package/dist/info-widget.d.ts +37 -0
  33. package/dist/info-widget.d.ts.map +1 -0
  34. package/dist/info-widget.js +183 -0
  35. package/dist/info-widget.js.map +1 -0
  36. package/dist/lib/components/button-group.d.ts +8 -0
  37. package/dist/lib/components/button-group.d.ts.map +1 -0
  38. package/dist/lib/components/button-group.js +7 -0
  39. package/dist/lib/components/button-group.js.map +1 -0
  40. package/dist/lib/components/dropdown-menu.d.ts +8 -0
  41. package/dist/lib/components/dropdown-menu.d.ts.map +1 -0
  42. package/dist/lib/components/dropdown-menu.js +55 -0
  43. package/dist/lib/components/dropdown-menu.js.map +1 -0
  44. package/dist/lib/components/grouped-icon-button.d.ts +8 -0
  45. package/dist/lib/components/grouped-icon-button.d.ts.map +1 -0
  46. package/dist/lib/components/grouped-icon-button.js +7 -0
  47. package/dist/lib/components/grouped-icon-button.js.map +1 -0
  48. package/dist/lib/components/icon-button.d.ts +11 -0
  49. package/dist/lib/components/icon-button.d.ts.map +1 -0
  50. package/dist/lib/components/icon-button.js +7 -0
  51. package/dist/lib/components/icon-button.js.map +1 -0
  52. package/dist/lib/components/icon-menu.d.ts +16 -0
  53. package/dist/lib/components/icon-menu.d.ts.map +1 -0
  54. package/dist/lib/components/icon-menu.js +49 -0
  55. package/dist/lib/components/icon-menu.js.map +1 -0
  56. package/dist/lib/components/simple-menu.d.ts +16 -0
  57. package/dist/lib/components/simple-menu.d.ts.map +1 -0
  58. package/dist/lib/components/simple-menu.js +30 -0
  59. package/dist/lib/components/simple-menu.js.map +1 -0
  60. package/dist/lib/geocode/geocoder-history.d.ts +23 -0
  61. package/dist/lib/geocode/geocoder-history.d.ts.map +1 -0
  62. package/dist/lib/geocode/geocoder-history.js +64 -0
  63. package/dist/lib/geocode/geocoder-history.js.map +1 -0
  64. package/dist/lib/geocode/geocoder.d.ts +15 -0
  65. package/dist/lib/geocode/geocoder.d.ts.map +1 -0
  66. package/dist/lib/geocode/geocoder.js +5 -0
  67. package/dist/lib/geocode/geocoder.js.map +1 -0
  68. package/dist/lib/geocode/geocoders.d.ts +68 -0
  69. package/dist/lib/geocode/geocoders.d.ts.map +1 -0
  70. package/dist/lib/geocode/geocoders.js +182 -0
  71. package/dist/lib/geocode/geocoders.js.map +1 -0
  72. package/dist/loading-widget.d.ts +26 -0
  73. package/dist/loading-widget.d.ts.map +1 -0
  74. package/dist/loading-widget.js +41 -0
  75. package/dist/loading-widget.js.map +1 -0
  76. package/dist/reset-view-widget.d.ts +4 -4
  77. package/dist/reset-view-widget.d.ts.map +1 -1
  78. package/dist/reset-view-widget.js +7 -10
  79. package/dist/reset-view-widget.js.map +1 -1
  80. package/dist/scale-widget.d.ts +28 -0
  81. package/dist/scale-widget.d.ts.map +1 -0
  82. package/dist/scale-widget.js +111 -0
  83. package/dist/scale-widget.js.map +1 -0
  84. package/dist/screenshot-widget.d.ts +4 -4
  85. package/dist/screenshot-widget.d.ts.map +1 -1
  86. package/dist/screenshot-widget.js +7 -14
  87. package/dist/screenshot-widget.js.map +1 -1
  88. package/dist/splitter-widget.d.ts +32 -0
  89. package/dist/splitter-widget.d.ts.map +1 -0
  90. package/dist/splitter-widget.js +123 -0
  91. package/dist/splitter-widget.js.map +1 -0
  92. package/dist/stats-widget.d.ts +36 -0
  93. package/dist/stats-widget.d.ts.map +1 -0
  94. package/dist/stats-widget.js +115 -0
  95. package/dist/stats-widget.js.map +1 -0
  96. package/dist/stylesheet.css +121 -4
  97. package/dist/theme-widget.d.ts +31 -0
  98. package/dist/theme-widget.d.ts.map +1 -0
  99. package/dist/theme-widget.js +83 -0
  100. package/dist/theme-widget.js.map +1 -0
  101. package/dist/themes.d.ts +65 -36
  102. package/dist/themes.d.ts.map +1 -1
  103. package/dist/themes.js +20 -8
  104. package/dist/themes.js.map +1 -1
  105. package/dist/timeline-widget.d.ts +59 -0
  106. package/dist/timeline-widget.d.ts.map +1 -0
  107. package/dist/timeline-widget.js +83 -0
  108. package/dist/timeline-widget.js.map +1 -0
  109. package/dist/view-selector-widget.d.ts +33 -0
  110. package/dist/view-selector-widget.d.ts.map +1 -0
  111. package/dist/view-selector-widget.js +62 -0
  112. package/dist/view-selector-widget.js.map +1 -0
  113. package/dist/zoom-widget.d.ts +14 -43
  114. package/dist/zoom-widget.d.ts.map +1 -1
  115. package/dist/zoom-widget.js +14 -56
  116. package/dist/zoom-widget.js.map +1 -1
  117. package/dist.min.js +3 -1
  118. package/package.json +4 -3
  119. package/src/compass-widget.tsx +44 -106
  120. package/src/context-menu-widget.tsx +115 -0
  121. package/src/fps-widget.tsx +67 -0
  122. package/src/fullscreen-widget.tsx +33 -86
  123. package/src/geocoder-widget.tsx +209 -0
  124. package/src/gimbal-widget.tsx +188 -0
  125. package/src/index.ts +58 -8
  126. package/src/info-widget.tsx +225 -0
  127. package/src/lib/components/button-group.tsx +16 -0
  128. package/src/lib/components/dropdown-menu.tsx +98 -0
  129. package/src/lib/components/grouped-icon-button.tsx +24 -0
  130. package/src/lib/components/icon-button.tsx +30 -0
  131. package/src/lib/components/icon-menu.tsx +89 -0
  132. package/src/lib/components/simple-menu.tsx +52 -0
  133. package/src/lib/geocode/geocoder-history.ts +73 -0
  134. package/src/lib/geocode/geocoder.ts +15 -0
  135. package/src/lib/geocode/geocoders.ts +199 -0
  136. package/src/loading-widget.tsx +67 -0
  137. package/src/reset-view-widget.tsx +8 -11
  138. package/src/scale-widget.tsx +183 -0
  139. package/src/screenshot-widget.tsx +9 -11
  140. package/src/splitter-widget.tsx +179 -0
  141. package/src/stats-widget.tsx +166 -0
  142. package/src/stylesheet.css +121 -4
  143. package/src/theme-widget.tsx +120 -0
  144. package/src/themes.ts +45 -12
  145. package/src/timeline-widget.tsx +155 -0
  146. package/src/view-selector-widget.tsx +108 -0
  147. package/src/zoom-widget.tsx +39 -113
  148. package/dist/components.d.ts +0 -4
  149. package/dist/components.d.ts.map +0 -1
  150. package/dist/components.js +0 -17
  151. package/dist/components.js.map +0 -1
  152. package/dist/widget-impl.d.ts +0 -29
  153. package/dist/widget-impl.d.ts.map +0 -1
  154. package/dist/widget-impl.js +0 -60
  155. package/dist/widget-impl.js.map +0 -1
  156. package/src/components.tsx +0 -38
  157. package/src/widget-impl.ts +0 -88
package/dist/dist.dev.js CHANGED
@@ -45,6 +45,13 @@ var __exports__ = (() => {
45
45
  }
46
46
  });
47
47
 
48
+ // external-global-plugin:@luma.gl/core
49
+ var require_core2 = __commonJS({
50
+ "external-global-plugin:@luma.gl/core"(exports, module) {
51
+ module.exports = globalThis.luma;
52
+ }
53
+ });
54
+
48
55
  // bundle.ts
49
56
  var bundle_exports = {};
50
57
  __export(bundle_exports, {
@@ -52,13 +59,34 @@ var __exports__ = (() => {
52
59
  DarkGlassTheme: () => DarkGlassTheme,
53
60
  DarkTheme: () => DarkTheme,
54
61
  FullscreenWidget: () => FullscreenWidget,
62
+ GimbalWidget: () => GimbalWidget,
55
63
  LightGlassTheme: () => LightGlassTheme,
56
64
  LightTheme: () => LightTheme,
57
65
  ResetViewWidget: () => ResetViewWidget,
58
66
  ScreenshotWidget: () => ScreenshotWidget,
59
67
  ZoomWidget: () => ZoomWidget,
60
- _WidgetImpl: () => WidgetImpl,
61
- _components: () => components_exports
68
+ _ButtonGroup: () => ButtonGroup,
69
+ _ContextMenuWidget: () => ContextMenuWidget,
70
+ _CoordinatesGeocoder: () => CoordinatesGeocoder,
71
+ _CurrentLocationGeocoder: () => CurrentLocationGeocoder,
72
+ _DropdownMenu: () => DropdownMenu,
73
+ _FpsWidget: () => FpsWidget,
74
+ _GeocoderWidget: () => GeocoderWidget,
75
+ _GoogleGeocoder: () => GoogleGeocoder,
76
+ _GroupedIconButton: () => GroupedIconButton,
77
+ _IconButton: () => IconButton,
78
+ _IconMenu: () => IconMenu,
79
+ _InfoWidget: () => InfoWidget,
80
+ _LoadingWidget: () => LoadingWidget,
81
+ _MapboxGeocoder: () => MapboxGeocoder,
82
+ _OpenCageGeocoder: () => OpenCageGeocoder,
83
+ _ScaleWidget: () => ScaleWidget,
84
+ _SimpleMenu: () => SimpleMenu,
85
+ _SplitterWidget: () => SplitterWidget,
86
+ _StatsWidget: () => StatsWidget,
87
+ _ThemeWidget: () => ThemeWidget,
88
+ _TimelineWidget: () => TimelineWidget,
89
+ _ViewSelectorWidget: () => ViewSelectorWidget
62
90
  });
63
91
 
64
92
  // ../core/bundle/peer-dependency.ts
@@ -72,7 +100,7 @@ var __exports__ = (() => {
72
100
  // bundle.ts
73
101
  __reExport(bundle_exports, peer_dependency_exports);
74
102
 
75
- // src/fullscreen-widget.tsx
103
+ // src/zoom-widget.tsx
76
104
  var import_core2 = __toESM(require_core(), 1);
77
105
 
78
106
  // ../../node_modules/preact/dist/preact.module.js
@@ -92,48 +120,48 @@ var __exports__ = (() => {
92
120
  var p = [];
93
121
  var v = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;
94
122
  var y = Array.isArray;
95
- function d(n2, l2) {
96
- for (var u3 in l2)
97
- n2[u3] = l2[u3];
123
+ function d(n2, l3) {
124
+ for (var u4 in l3)
125
+ n2[u4] = l3[u4];
98
126
  return n2;
99
127
  }
100
128
  function w(n2) {
101
- var l2 = n2.parentNode;
102
- l2 && l2.removeChild(n2);
103
- }
104
- function _(l2, u3, t2) {
105
- var i3, o2, r2, f3 = {};
106
- for (r2 in u3)
107
- "key" == r2 ? i3 = u3[r2] : "ref" == r2 ? o2 = u3[r2] : f3[r2] = u3[r2];
108
- if (arguments.length > 2 && (f3.children = arguments.length > 3 ? n.call(arguments, 2) : t2), "function" == typeof l2 && null != l2.defaultProps)
109
- for (r2 in l2.defaultProps)
110
- void 0 === f3[r2] && (f3[r2] = l2.defaultProps[r2]);
111
- return g(l2, f3, i3, o2, null);
112
- }
113
- function g(n2, t2, i3, o2, r2) {
114
- var f3 = { type: n2, props: t2, key: i3, ref: o2, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: null == r2 ? ++u : r2, __i: -1, __u: 0 };
115
- return null == r2 && null != l.vnode && l.vnode(f3), f3;
129
+ var l3 = n2.parentNode;
130
+ l3 && l3.removeChild(n2);
131
+ }
132
+ function _(l3, u4, t3) {
133
+ var i4, o3, r3, f4 = {};
134
+ for (r3 in u4)
135
+ "key" == r3 ? i4 = u4[r3] : "ref" == r3 ? o3 = u4[r3] : f4[r3] = u4[r3];
136
+ if (arguments.length > 2 && (f4.children = arguments.length > 3 ? n.call(arguments, 2) : t3), "function" == typeof l3 && null != l3.defaultProps)
137
+ for (r3 in l3.defaultProps)
138
+ void 0 === f4[r3] && (f4[r3] = l3.defaultProps[r3]);
139
+ return g(l3, f4, i4, o3, null);
140
+ }
141
+ function g(n2, t3, i4, o3, r3) {
142
+ var f4 = { type: n2, props: t3, key: i4, ref: o3, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: null == r3 ? ++u : r3, __i: -1, __u: 0 };
143
+ return null == r3 && null != l.vnode && l.vnode(f4), f4;
116
144
  }
117
145
  function k(n2) {
118
146
  return n2.children;
119
147
  }
120
- function b(n2, l2) {
121
- this.props = n2, this.context = l2;
148
+ function b(n2, l3) {
149
+ this.props = n2, this.context = l3;
122
150
  }
123
- function x(n2, l2) {
124
- if (null == l2)
151
+ function x(n2, l3) {
152
+ if (null == l3)
125
153
  return n2.__ ? x(n2.__, n2.__i + 1) : null;
126
- for (var u3; l2 < n2.__k.length; l2++)
127
- if (null != (u3 = n2.__k[l2]) && null != u3.__e)
128
- return u3.__e;
154
+ for (var u4; l3 < n2.__k.length; l3++)
155
+ if (null != (u4 = n2.__k[l3]) && null != u4.__e)
156
+ return u4.__e;
129
157
  return "function" == typeof n2.type ? x(n2) : null;
130
158
  }
131
159
  function C(n2) {
132
- var l2, u3;
160
+ var l3, u4;
133
161
  if (null != (n2 = n2.__) && null != n2.__c) {
134
- for (n2.__e = n2.__c.base = null, l2 = 0; l2 < n2.__k.length; l2++)
135
- if (null != (u3 = n2.__k[l2]) && null != u3.__e) {
136
- n2.__e = n2.__c.base = u3.__e;
162
+ for (n2.__e = n2.__c.base = null, l3 = 0; l3 < n2.__k.length; l3++)
163
+ if (null != (u4 = n2.__k[l3]) && null != u4.__e) {
164
+ n2.__e = n2.__c.base = u4.__e;
137
165
  break;
138
166
  }
139
167
  return C(n2);
@@ -143,303 +171,284 @@ var __exports__ = (() => {
143
171
  (!n2.__d && (n2.__d = true) && i.push(n2) && !P.__r++ || o !== l.debounceRendering) && ((o = l.debounceRendering) || r)(P);
144
172
  }
145
173
  function P() {
146
- var n2, u3, t2, o2, r2, e2, c2, s2;
174
+ var n2, u4, t3, o3, r3, e3, c3, s3;
147
175
  for (i.sort(f); n2 = i.shift(); )
148
- n2.__d && (u3 = i.length, o2 = void 0, e2 = (r2 = (t2 = n2).__v).__e, c2 = [], s2 = [], t2.__P && ((o2 = d({}, r2)).__v = r2.__v + 1, l.vnode && l.vnode(o2), O(t2.__P, o2, r2, t2.__n, t2.__P.namespaceURI, 32 & r2.__u ? [e2] : null, c2, null == e2 ? x(r2) : e2, !!(32 & r2.__u), s2), o2.__v = r2.__v, o2.__.__k[o2.__i] = o2, j(c2, o2, s2), o2.__e != e2 && C(o2)), i.length > u3 && i.sort(f));
176
+ n2.__d && (u4 = i.length, o3 = void 0, e3 = (r3 = (t3 = n2).__v).__e, c3 = [], s3 = [], t3.__P && ((o3 = d({}, r3)).__v = r3.__v + 1, l.vnode && l.vnode(o3), O(t3.__P, o3, r3, t3.__n, t3.__P.namespaceURI, 32 & r3.__u ? [e3] : null, c3, null == e3 ? x(r3) : e3, !!(32 & r3.__u), s3), o3.__v = r3.__v, o3.__.__k[o3.__i] = o3, j(c3, o3, s3), o3.__e != e3 && C(o3)), i.length > u4 && i.sort(f));
149
177
  P.__r = 0;
150
178
  }
151
- function S(n2, l2, u3, t2, i3, o2, r2, f3, e2, c2, s2) {
152
- var a2, v2, y2, d2, w2, _2 = t2 && t2.__k || p, g2 = l2.length;
153
- for (u3.__d = e2, $(u3, l2, _2), e2 = u3.__d, a2 = 0; a2 < g2; a2++)
154
- null != (y2 = u3.__k[a2]) && "boolean" != typeof y2 && "function" != typeof y2 && (v2 = -1 === y2.__i ? h : _2[y2.__i] || h, y2.__i = a2, O(n2, y2, v2, i3, o2, r2, f3, e2, c2, s2), d2 = y2.__e, y2.ref && v2.ref != y2.ref && (v2.ref && N(v2.ref, null, y2), s2.push(y2.ref, y2.__c || d2, y2)), null == w2 && null != d2 && (w2 = d2), 65536 & y2.__u || v2.__k === y2.__k ? e2 = I(y2, e2, n2) : "function" == typeof y2.type && void 0 !== y2.__d ? e2 = y2.__d : d2 && (e2 = d2.nextSibling), y2.__d = void 0, y2.__u &= -196609);
155
- u3.__d = e2, u3.__e = w2;
156
- }
157
- function $(n2, l2, u3) {
158
- var t2, i3, o2, r2, f3, e2 = l2.length, c2 = u3.length, s2 = c2, a2 = 0;
159
- for (n2.__k = [], t2 = 0; t2 < e2; t2++)
160
- r2 = t2 + a2, null != (i3 = n2.__k[t2] = null == (i3 = l2[t2]) || "boolean" == typeof i3 || "function" == typeof i3 ? null : "string" == typeof i3 || "number" == typeof i3 || "bigint" == typeof i3 || i3.constructor == String ? g(null, i3, null, null, null) : y(i3) ? g(k, { children: i3 }, null, null, null) : void 0 === i3.constructor && i3.__b > 0 ? g(i3.type, i3.props, i3.key, i3.ref ? i3.ref : null, i3.__v) : i3) ? (i3.__ = n2, i3.__b = n2.__b + 1, f3 = L(i3, u3, r2, s2), i3.__i = f3, o2 = null, -1 !== f3 && (s2--, (o2 = u3[f3]) && (o2.__u |= 131072)), null == o2 || null === o2.__v ? (-1 == f3 && a2--, "function" != typeof i3.type && (i3.__u |= 65536)) : f3 !== r2 && (f3 == r2 - 1 ? a2-- : f3 == r2 + 1 ? a2++ : f3 > r2 ? s2 > e2 - r2 ? a2 += f3 - r2 : a2-- : f3 < r2 && (f3 == r2 - a2 ? a2 -= f3 - r2 : a2++), f3 !== t2 + a2 && (i3.__u |= 65536))) : (o2 = u3[r2]) && null == o2.key && o2.__e && 0 == (131072 & o2.__u) && (o2.__e == n2.__d && (n2.__d = x(o2)), V(o2, o2, false), u3[r2] = null, s2--);
161
- if (s2)
162
- for (t2 = 0; t2 < c2; t2++)
163
- null != (o2 = u3[t2]) && 0 == (131072 & o2.__u) && (o2.__e == n2.__d && (n2.__d = x(o2)), V(o2, o2));
164
- }
165
- function I(n2, l2, u3) {
166
- var t2, i3;
179
+ function S(n2, l3, u4, t3, i4, o3, r3, f4, e3, c3, s3) {
180
+ var a3, v3, y3, d3, w3, _2 = t3 && t3.__k || p, g2 = l3.length;
181
+ for (u4.__d = e3, $(u4, l3, _2), e3 = u4.__d, a3 = 0; a3 < g2; a3++)
182
+ null != (y3 = u4.__k[a3]) && "boolean" != typeof y3 && "function" != typeof y3 && (v3 = -1 === y3.__i ? h : _2[y3.__i] || h, y3.__i = a3, O(n2, y3, v3, i4, o3, r3, f4, e3, c3, s3), d3 = y3.__e, y3.ref && v3.ref != y3.ref && (v3.ref && N(v3.ref, null, y3), s3.push(y3.ref, y3.__c || d3, y3)), null == w3 && null != d3 && (w3 = d3), 65536 & y3.__u || v3.__k === y3.__k ? e3 = I(y3, e3, n2) : "function" == typeof y3.type && void 0 !== y3.__d ? e3 = y3.__d : d3 && (e3 = d3.nextSibling), y3.__d = void 0, y3.__u &= -196609);
183
+ u4.__d = e3, u4.__e = w3;
184
+ }
185
+ function $(n2, l3, u4) {
186
+ var t3, i4, o3, r3, f4, e3 = l3.length, c3 = u4.length, s3 = c3, a3 = 0;
187
+ for (n2.__k = [], t3 = 0; t3 < e3; t3++)
188
+ r3 = t3 + a3, null != (i4 = n2.__k[t3] = null == (i4 = l3[t3]) || "boolean" == typeof i4 || "function" == typeof i4 ? null : "string" == typeof i4 || "number" == typeof i4 || "bigint" == typeof i4 || i4.constructor == String ? g(null, i4, null, null, null) : y(i4) ? g(k, { children: i4 }, null, null, null) : void 0 === i4.constructor && i4.__b > 0 ? g(i4.type, i4.props, i4.key, i4.ref ? i4.ref : null, i4.__v) : i4) ? (i4.__ = n2, i4.__b = n2.__b + 1, f4 = L(i4, u4, r3, s3), i4.__i = f4, o3 = null, -1 !== f4 && (s3--, (o3 = u4[f4]) && (o3.__u |= 131072)), null == o3 || null === o3.__v ? (-1 == f4 && a3--, "function" != typeof i4.type && (i4.__u |= 65536)) : f4 !== r3 && (f4 == r3 - 1 ? a3-- : f4 == r3 + 1 ? a3++ : f4 > r3 ? s3 > e3 - r3 ? a3 += f4 - r3 : a3-- : f4 < r3 && (f4 == r3 - a3 ? a3 -= f4 - r3 : a3++), f4 !== t3 + a3 && (i4.__u |= 65536))) : (o3 = u4[r3]) && null == o3.key && o3.__e && 0 == (131072 & o3.__u) && (o3.__e == n2.__d && (n2.__d = x(o3)), V(o3, o3, false), u4[r3] = null, s3--);
189
+ if (s3)
190
+ for (t3 = 0; t3 < c3; t3++)
191
+ null != (o3 = u4[t3]) && 0 == (131072 & o3.__u) && (o3.__e == n2.__d && (n2.__d = x(o3)), V(o3, o3));
192
+ }
193
+ function I(n2, l3, u4) {
194
+ var t3, i4;
167
195
  if ("function" == typeof n2.type) {
168
- for (t2 = n2.__k, i3 = 0; t2 && i3 < t2.length; i3++)
169
- t2[i3] && (t2[i3].__ = n2, l2 = I(t2[i3], l2, u3));
170
- return l2;
196
+ for (t3 = n2.__k, i4 = 0; t3 && i4 < t3.length; i4++)
197
+ t3[i4] && (t3[i4].__ = n2, l3 = I(t3[i4], l3, u4));
198
+ return l3;
171
199
  }
172
- n2.__e != l2 && (l2 && n2.type && !u3.contains(l2) && (l2 = x(n2)), u3.insertBefore(n2.__e, l2 || null), l2 = n2.__e);
200
+ n2.__e != l3 && (l3 && n2.type && !u4.contains(l3) && (l3 = x(n2)), u4.insertBefore(n2.__e, l3 || null), l3 = n2.__e);
173
201
  do {
174
- l2 = l2 && l2.nextSibling;
175
- } while (null != l2 && 8 === l2.nodeType);
176
- return l2;
177
- }
178
- function L(n2, l2, u3, t2) {
179
- var i3 = n2.key, o2 = n2.type, r2 = u3 - 1, f3 = u3 + 1, e2 = l2[u3];
180
- if (null === e2 || e2 && i3 == e2.key && o2 === e2.type && 0 == (131072 & e2.__u))
181
- return u3;
182
- if (t2 > (null != e2 && 0 == (131072 & e2.__u) ? 1 : 0))
183
- for (; r2 >= 0 || f3 < l2.length; ) {
184
- if (r2 >= 0) {
185
- if ((e2 = l2[r2]) && 0 == (131072 & e2.__u) && i3 == e2.key && o2 === e2.type)
186
- return r2;
187
- r2--;
202
+ l3 = l3 && l3.nextSibling;
203
+ } while (null != l3 && 8 === l3.nodeType);
204
+ return l3;
205
+ }
206
+ function L(n2, l3, u4, t3) {
207
+ var i4 = n2.key, o3 = n2.type, r3 = u4 - 1, f4 = u4 + 1, e3 = l3[u4];
208
+ if (null === e3 || e3 && i4 == e3.key && o3 === e3.type && 0 == (131072 & e3.__u))
209
+ return u4;
210
+ if (t3 > (null != e3 && 0 == (131072 & e3.__u) ? 1 : 0))
211
+ for (; r3 >= 0 || f4 < l3.length; ) {
212
+ if (r3 >= 0) {
213
+ if ((e3 = l3[r3]) && 0 == (131072 & e3.__u) && i4 == e3.key && o3 === e3.type)
214
+ return r3;
215
+ r3--;
188
216
  }
189
- if (f3 < l2.length) {
190
- if ((e2 = l2[f3]) && 0 == (131072 & e2.__u) && i3 == e2.key && o2 === e2.type)
191
- return f3;
192
- f3++;
217
+ if (f4 < l3.length) {
218
+ if ((e3 = l3[f4]) && 0 == (131072 & e3.__u) && i4 == e3.key && o3 === e3.type)
219
+ return f4;
220
+ f4++;
193
221
  }
194
222
  }
195
223
  return -1;
196
224
  }
197
- function T(n2, l2, u3) {
198
- "-" === l2[0] ? n2.setProperty(l2, null == u3 ? "" : u3) : n2[l2] = null == u3 ? "" : "number" != typeof u3 || v.test(l2) ? u3 : u3 + "px";
225
+ function T(n2, l3, u4) {
226
+ "-" === l3[0] ? n2.setProperty(l3, null == u4 ? "" : u4) : n2[l3] = null == u4 ? "" : "number" != typeof u4 || v.test(l3) ? u4 : u4 + "px";
199
227
  }
200
- function A(n2, l2, u3, t2, i3) {
201
- var o2;
228
+ function A(n2, l3, u4, t3, i4) {
229
+ var o3;
202
230
  n:
203
- if ("style" === l2)
204
- if ("string" == typeof u3)
205
- n2.style.cssText = u3;
231
+ if ("style" === l3)
232
+ if ("string" == typeof u4)
233
+ n2.style.cssText = u4;
206
234
  else {
207
- if ("string" == typeof t2 && (n2.style.cssText = t2 = ""), t2)
208
- for (l2 in t2)
209
- u3 && l2 in u3 || T(n2.style, l2, "");
210
- if (u3)
211
- for (l2 in u3)
212
- t2 && u3[l2] === t2[l2] || T(n2.style, l2, u3[l2]);
235
+ if ("string" == typeof t3 && (n2.style.cssText = t3 = ""), t3)
236
+ for (l3 in t3)
237
+ u4 && l3 in u4 || T(n2.style, l3, "");
238
+ if (u4)
239
+ for (l3 in u4)
240
+ t3 && u4[l3] === t3[l3] || T(n2.style, l3, u4[l3]);
213
241
  }
214
- else if ("o" === l2[0] && "n" === l2[1])
215
- o2 = l2 !== (l2 = l2.replace(/(PointerCapture)$|Capture$/i, "$1")), l2 = l2.toLowerCase() in n2 || "onFocusOut" === l2 || "onFocusIn" === l2 ? l2.toLowerCase().slice(2) : l2.slice(2), n2.l || (n2.l = {}), n2.l[l2 + o2] = u3, u3 ? t2 ? u3.u = t2.u : (u3.u = e, n2.addEventListener(l2, o2 ? s : c, o2)) : n2.removeEventListener(l2, o2 ? s : c, o2);
242
+ else if ("o" === l3[0] && "n" === l3[1])
243
+ o3 = l3 !== (l3 = l3.replace(/(PointerCapture)$|Capture$/i, "$1")), l3 = l3.toLowerCase() in n2 || "onFocusOut" === l3 || "onFocusIn" === l3 ? l3.toLowerCase().slice(2) : l3.slice(2), n2.l || (n2.l = {}), n2.l[l3 + o3] = u4, u4 ? t3 ? u4.u = t3.u : (u4.u = e, n2.addEventListener(l3, o3 ? s : c, o3)) : n2.removeEventListener(l3, o3 ? s : c, o3);
216
244
  else {
217
- if ("http://www.w3.org/2000/svg" == i3)
218
- l2 = l2.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
219
- else if ("width" != l2 && "height" != l2 && "href" != l2 && "list" != l2 && "form" != l2 && "tabIndex" != l2 && "download" != l2 && "rowSpan" != l2 && "colSpan" != l2 && "role" != l2 && "popover" != l2 && l2 in n2)
245
+ if ("http://www.w3.org/2000/svg" == i4)
246
+ l3 = l3.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");
247
+ else if ("width" != l3 && "height" != l3 && "href" != l3 && "list" != l3 && "form" != l3 && "tabIndex" != l3 && "download" != l3 && "rowSpan" != l3 && "colSpan" != l3 && "role" != l3 && "popover" != l3 && l3 in n2)
220
248
  try {
221
- n2[l2] = null == u3 ? "" : u3;
249
+ n2[l3] = null == u4 ? "" : u4;
222
250
  break n;
223
251
  } catch (n3) {
224
252
  }
225
- "function" == typeof u3 || (null == u3 || false === u3 && "-" !== l2[4] ? n2.removeAttribute(l2) : n2.setAttribute(l2, "popover" == l2 && 1 == u3 ? "" : u3));
253
+ "function" == typeof u4 || (null == u4 || false === u4 && "-" !== l3[4] ? n2.removeAttribute(l3) : n2.setAttribute(l3, "popover" == l3 && 1 == u4 ? "" : u4));
226
254
  }
227
255
  }
228
256
  function F(n2) {
229
- return function(u3) {
257
+ return function(u4) {
230
258
  if (this.l) {
231
- var t2 = this.l[u3.type + n2];
232
- if (null == u3.t)
233
- u3.t = e++;
234
- else if (u3.t < t2.u)
259
+ var t3 = this.l[u4.type + n2];
260
+ if (null == u4.t)
261
+ u4.t = e++;
262
+ else if (u4.t < t3.u)
235
263
  return;
236
- return t2(l.event ? l.event(u3) : u3);
264
+ return t3(l.event ? l.event(u4) : u4);
237
265
  }
238
266
  };
239
267
  }
240
- function O(n2, u3, t2, i3, o2, r2, f3, e2, c2, s2) {
241
- var a2, h3, p2, v2, w2, _2, g2, m, x2, C2, M2, P2, $2, I2, H, L2, T2 = u3.type;
242
- if (void 0 !== u3.constructor)
268
+ function O(n2, u4, t3, i4, o3, r3, f4, e3, c3, s3) {
269
+ var a3, h4, p3, v3, w3, _2, g2, m2, x2, C3, M2, P2, $2, I2, H, L2, T3 = u4.type;
270
+ if (void 0 !== u4.constructor)
243
271
  return null;
244
- 128 & t2.__u && (c2 = !!(32 & t2.__u), r2 = [e2 = u3.__e = t2.__e]), (a2 = l.__b) && a2(u3);
272
+ 128 & t3.__u && (c3 = !!(32 & t3.__u), r3 = [e3 = u4.__e = t3.__e]), (a3 = l.__b) && a3(u4);
245
273
  n:
246
- if ("function" == typeof T2)
274
+ if ("function" == typeof T3)
247
275
  try {
248
- if (m = u3.props, x2 = "prototype" in T2 && T2.prototype.render, C2 = (a2 = T2.contextType) && i3[a2.__c], M2 = a2 ? C2 ? C2.props.value : a2.__ : i3, t2.__c ? g2 = (h3 = u3.__c = t2.__c).__ = h3.__E : (x2 ? u3.__c = h3 = new T2(m, M2) : (u3.__c = h3 = new b(m, M2), h3.constructor = T2, h3.render = q), C2 && C2.sub(h3), h3.props = m, h3.state || (h3.state = {}), h3.context = M2, h3.__n = i3, p2 = h3.__d = true, h3.__h = [], h3._sb = []), x2 && null == h3.__s && (h3.__s = h3.state), x2 && null != T2.getDerivedStateFromProps && (h3.__s == h3.state && (h3.__s = d({}, h3.__s)), d(h3.__s, T2.getDerivedStateFromProps(m, h3.__s))), v2 = h3.props, w2 = h3.state, h3.__v = u3, p2)
249
- x2 && null == T2.getDerivedStateFromProps && null != h3.componentWillMount && h3.componentWillMount(), x2 && null != h3.componentDidMount && h3.__h.push(h3.componentDidMount);
276
+ if (m2 = u4.props, x2 = "prototype" in T3 && T3.prototype.render, C3 = (a3 = T3.contextType) && i4[a3.__c], M2 = a3 ? C3 ? C3.props.value : a3.__ : i4, t3.__c ? g2 = (h4 = u4.__c = t3.__c).__ = h4.__E : (x2 ? u4.__c = h4 = new T3(m2, M2) : (u4.__c = h4 = new b(m2, M2), h4.constructor = T3, h4.render = q), C3 && C3.sub(h4), h4.props = m2, h4.state || (h4.state = {}), h4.context = M2, h4.__n = i4, p3 = h4.__d = true, h4.__h = [], h4._sb = []), x2 && null == h4.__s && (h4.__s = h4.state), x2 && null != T3.getDerivedStateFromProps && (h4.__s == h4.state && (h4.__s = d({}, h4.__s)), d(h4.__s, T3.getDerivedStateFromProps(m2, h4.__s))), v3 = h4.props, w3 = h4.state, h4.__v = u4, p3)
277
+ x2 && null == T3.getDerivedStateFromProps && null != h4.componentWillMount && h4.componentWillMount(), x2 && null != h4.componentDidMount && h4.__h.push(h4.componentDidMount);
250
278
  else {
251
- if (x2 && null == T2.getDerivedStateFromProps && m !== v2 && null != h3.componentWillReceiveProps && h3.componentWillReceiveProps(m, M2), !h3.__e && (null != h3.shouldComponentUpdate && false === h3.shouldComponentUpdate(m, h3.__s, M2) || u3.__v === t2.__v)) {
252
- for (u3.__v !== t2.__v && (h3.props = m, h3.state = h3.__s, h3.__d = false), u3.__e = t2.__e, u3.__k = t2.__k, u3.__k.forEach(function(n3) {
253
- n3 && (n3.__ = u3);
254
- }), P2 = 0; P2 < h3._sb.length; P2++)
255
- h3.__h.push(h3._sb[P2]);
256
- h3._sb = [], h3.__h.length && f3.push(h3);
279
+ if (x2 && null == T3.getDerivedStateFromProps && m2 !== v3 && null != h4.componentWillReceiveProps && h4.componentWillReceiveProps(m2, M2), !h4.__e && (null != h4.shouldComponentUpdate && false === h4.shouldComponentUpdate(m2, h4.__s, M2) || u4.__v === t3.__v)) {
280
+ for (u4.__v !== t3.__v && (h4.props = m2, h4.state = h4.__s, h4.__d = false), u4.__e = t3.__e, u4.__k = t3.__k, u4.__k.forEach(function(n3) {
281
+ n3 && (n3.__ = u4);
282
+ }), P2 = 0; P2 < h4._sb.length; P2++)
283
+ h4.__h.push(h4._sb[P2]);
284
+ h4._sb = [], h4.__h.length && f4.push(h4);
257
285
  break n;
258
286
  }
259
- null != h3.componentWillUpdate && h3.componentWillUpdate(m, h3.__s, M2), x2 && null != h3.componentDidUpdate && h3.__h.push(function() {
260
- h3.componentDidUpdate(v2, w2, _2);
287
+ null != h4.componentWillUpdate && h4.componentWillUpdate(m2, h4.__s, M2), x2 && null != h4.componentDidUpdate && h4.__h.push(function() {
288
+ h4.componentDidUpdate(v3, w3, _2);
261
289
  });
262
290
  }
263
- if (h3.context = M2, h3.props = m, h3.__P = n2, h3.__e = false, $2 = l.__r, I2 = 0, x2) {
264
- for (h3.state = h3.__s, h3.__d = false, $2 && $2(u3), a2 = h3.render(h3.props, h3.state, h3.context), H = 0; H < h3._sb.length; H++)
265
- h3.__h.push(h3._sb[H]);
266
- h3._sb = [];
291
+ if (h4.context = M2, h4.props = m2, h4.__P = n2, h4.__e = false, $2 = l.__r, I2 = 0, x2) {
292
+ for (h4.state = h4.__s, h4.__d = false, $2 && $2(u4), a3 = h4.render(h4.props, h4.state, h4.context), H = 0; H < h4._sb.length; H++)
293
+ h4.__h.push(h4._sb[H]);
294
+ h4._sb = [];
267
295
  } else
268
296
  do {
269
- h3.__d = false, $2 && $2(u3), a2 = h3.render(h3.props, h3.state, h3.context), h3.state = h3.__s;
270
- } while (h3.__d && ++I2 < 25);
271
- h3.state = h3.__s, null != h3.getChildContext && (i3 = d(d({}, i3), h3.getChildContext())), x2 && !p2 && null != h3.getSnapshotBeforeUpdate && (_2 = h3.getSnapshotBeforeUpdate(v2, w2)), S(n2, y(L2 = null != a2 && a2.type === k && null == a2.key ? a2.props.children : a2) ? L2 : [L2], u3, t2, i3, o2, r2, f3, e2, c2, s2), h3.base = u3.__e, u3.__u &= -161, h3.__h.length && f3.push(h3), g2 && (h3.__E = h3.__ = null);
297
+ h4.__d = false, $2 && $2(u4), a3 = h4.render(h4.props, h4.state, h4.context), h4.state = h4.__s;
298
+ } while (h4.__d && ++I2 < 25);
299
+ h4.state = h4.__s, null != h4.getChildContext && (i4 = d(d({}, i4), h4.getChildContext())), x2 && !p3 && null != h4.getSnapshotBeforeUpdate && (_2 = h4.getSnapshotBeforeUpdate(v3, w3)), S(n2, y(L2 = null != a3 && a3.type === k && null == a3.key ? a3.props.children : a3) ? L2 : [L2], u4, t3, i4, o3, r3, f4, e3, c3, s3), h4.base = u4.__e, u4.__u &= -161, h4.__h.length && f4.push(h4), g2 && (h4.__E = h4.__ = null);
272
300
  } catch (n3) {
273
- if (u3.__v = null, c2 || null != r2) {
274
- for (u3.__u |= c2 ? 160 : 32; e2 && 8 === e2.nodeType && e2.nextSibling; )
275
- e2 = e2.nextSibling;
276
- r2[r2.indexOf(e2)] = null, u3.__e = e2;
301
+ if (u4.__v = null, c3 || null != r3) {
302
+ for (u4.__u |= c3 ? 160 : 32; e3 && 8 === e3.nodeType && e3.nextSibling; )
303
+ e3 = e3.nextSibling;
304
+ r3[r3.indexOf(e3)] = null, u4.__e = e3;
277
305
  } else
278
- u3.__e = t2.__e, u3.__k = t2.__k;
279
- l.__e(n3, u3, t2);
306
+ u4.__e = t3.__e, u4.__k = t3.__k;
307
+ l.__e(n3, u4, t3);
280
308
  }
281
309
  else
282
- null == r2 && u3.__v === t2.__v ? (u3.__k = t2.__k, u3.__e = t2.__e) : u3.__e = z(t2.__e, u3, t2, i3, o2, r2, f3, c2, s2);
283
- (a2 = l.diffed) && a2(u3);
284
- }
285
- function j(n2, u3, t2) {
286
- u3.__d = void 0;
287
- for (var i3 = 0; i3 < t2.length; i3++)
288
- N(t2[i3], t2[++i3], t2[++i3]);
289
- l.__c && l.__c(u3, n2), n2.some(function(u4) {
310
+ null == r3 && u4.__v === t3.__v ? (u4.__k = t3.__k, u4.__e = t3.__e) : u4.__e = z(t3.__e, u4, t3, i4, o3, r3, f4, c3, s3);
311
+ (a3 = l.diffed) && a3(u4);
312
+ }
313
+ function j(n2, u4, t3) {
314
+ u4.__d = void 0;
315
+ for (var i4 = 0; i4 < t3.length; i4++)
316
+ N(t3[i4], t3[++i4], t3[++i4]);
317
+ l.__c && l.__c(u4, n2), n2.some(function(u5) {
290
318
  try {
291
- n2 = u4.__h, u4.__h = [], n2.some(function(n3) {
292
- n3.call(u4);
319
+ n2 = u5.__h, u5.__h = [], n2.some(function(n3) {
320
+ n3.call(u5);
293
321
  });
294
322
  } catch (n3) {
295
- l.__e(n3, u4.__v);
323
+ l.__e(n3, u5.__v);
296
324
  }
297
325
  });
298
326
  }
299
- function z(l2, u3, t2, i3, o2, r2, f3, e2, c2) {
300
- var s2, a2, p2, v2, d2, _2, g2, m = t2.props, k2 = u3.props, b2 = u3.type;
301
- if ("svg" === b2 ? o2 = "http://www.w3.org/2000/svg" : "math" === b2 ? o2 = "http://www.w3.org/1998/Math/MathML" : o2 || (o2 = "http://www.w3.org/1999/xhtml"), null != r2) {
302
- for (s2 = 0; s2 < r2.length; s2++)
303
- if ((d2 = r2[s2]) && "setAttribute" in d2 == !!b2 && (b2 ? d2.localName === b2 : 3 === d2.nodeType)) {
304
- l2 = d2, r2[s2] = null;
327
+ function z(l3, u4, t3, i4, o3, r3, f4, e3, c3) {
328
+ var s3, a3, p3, v3, d3, _2, g2, m2 = t3.props, k3 = u4.props, b2 = u4.type;
329
+ if ("svg" === b2 ? o3 = "http://www.w3.org/2000/svg" : "math" === b2 ? o3 = "http://www.w3.org/1998/Math/MathML" : o3 || (o3 = "http://www.w3.org/1999/xhtml"), null != r3) {
330
+ for (s3 = 0; s3 < r3.length; s3++)
331
+ if ((d3 = r3[s3]) && "setAttribute" in d3 == !!b2 && (b2 ? d3.localName === b2 : 3 === d3.nodeType)) {
332
+ l3 = d3, r3[s3] = null;
305
333
  break;
306
334
  }
307
335
  }
308
- if (null == l2) {
336
+ if (null == l3) {
309
337
  if (null === b2)
310
- return document.createTextNode(k2);
311
- l2 = document.createElementNS(o2, b2, k2.is && k2), r2 = null, e2 = false;
338
+ return document.createTextNode(k3);
339
+ l3 = document.createElementNS(o3, b2, k3.is && k3), r3 = null, e3 = false;
312
340
  }
313
341
  if (null === b2)
314
- m === k2 || e2 && l2.data === k2 || (l2.data = k2);
342
+ m2 === k3 || e3 && l3.data === k3 || (l3.data = k3);
315
343
  else {
316
- if (r2 = r2 && n.call(l2.childNodes), m = t2.props || h, !e2 && null != r2)
317
- for (m = {}, s2 = 0; s2 < l2.attributes.length; s2++)
318
- m[(d2 = l2.attributes[s2]).name] = d2.value;
319
- for (s2 in m)
320
- if (d2 = m[s2], "children" == s2)
344
+ if (r3 = r3 && n.call(l3.childNodes), m2 = t3.props || h, !e3 && null != r3)
345
+ for (m2 = {}, s3 = 0; s3 < l3.attributes.length; s3++)
346
+ m2[(d3 = l3.attributes[s3]).name] = d3.value;
347
+ for (s3 in m2)
348
+ if (d3 = m2[s3], "children" == s3)
321
349
  ;
322
- else if ("dangerouslySetInnerHTML" == s2)
323
- p2 = d2;
324
- else if ("key" !== s2 && !(s2 in k2)) {
325
- if ("value" == s2 && "defaultValue" in k2 || "checked" == s2 && "defaultChecked" in k2)
350
+ else if ("dangerouslySetInnerHTML" == s3)
351
+ p3 = d3;
352
+ else if ("key" !== s3 && !(s3 in k3)) {
353
+ if ("value" == s3 && "defaultValue" in k3 || "checked" == s3 && "defaultChecked" in k3)
326
354
  continue;
327
- A(l2, s2, null, d2, o2);
355
+ A(l3, s3, null, d3, o3);
328
356
  }
329
- for (s2 in k2)
330
- d2 = k2[s2], "children" == s2 ? v2 = d2 : "dangerouslySetInnerHTML" == s2 ? a2 = d2 : "value" == s2 ? _2 = d2 : "checked" == s2 ? g2 = d2 : "key" === s2 || e2 && "function" != typeof d2 || m[s2] === d2 || A(l2, s2, d2, m[s2], o2);
331
- if (a2)
332
- e2 || p2 && (a2.__html === p2.__html || a2.__html === l2.innerHTML) || (l2.innerHTML = a2.__html), u3.__k = [];
333
- else if (p2 && (l2.innerHTML = ""), S(l2, y(v2) ? v2 : [v2], u3, t2, i3, "foreignObject" === b2 ? "http://www.w3.org/1999/xhtml" : o2, r2, f3, r2 ? r2[0] : t2.__k && x(t2, 0), e2, c2), null != r2)
334
- for (s2 = r2.length; s2--; )
335
- null != r2[s2] && w(r2[s2]);
336
- e2 || (s2 = "value", void 0 !== _2 && (_2 !== l2[s2] || "progress" === b2 && !_2 || "option" === b2 && _2 !== m[s2]) && A(l2, s2, _2, m[s2], o2), s2 = "checked", void 0 !== g2 && g2 !== l2[s2] && A(l2, s2, g2, m[s2], o2));
337
- }
338
- return l2;
339
- }
340
- function N(n2, u3, t2) {
357
+ for (s3 in k3)
358
+ d3 = k3[s3], "children" == s3 ? v3 = d3 : "dangerouslySetInnerHTML" == s3 ? a3 = d3 : "value" == s3 ? _2 = d3 : "checked" == s3 ? g2 = d3 : "key" === s3 || e3 && "function" != typeof d3 || m2[s3] === d3 || A(l3, s3, d3, m2[s3], o3);
359
+ if (a3)
360
+ e3 || p3 && (a3.__html === p3.__html || a3.__html === l3.innerHTML) || (l3.innerHTML = a3.__html), u4.__k = [];
361
+ else if (p3 && (l3.innerHTML = ""), S(l3, y(v3) ? v3 : [v3], u4, t3, i4, "foreignObject" === b2 ? "http://www.w3.org/1999/xhtml" : o3, r3, f4, r3 ? r3[0] : t3.__k && x(t3, 0), e3, c3), null != r3)
362
+ for (s3 = r3.length; s3--; )
363
+ null != r3[s3] && w(r3[s3]);
364
+ e3 || (s3 = "value", void 0 !== _2 && (_2 !== l3[s3] || "progress" === b2 && !_2 || "option" === b2 && _2 !== m2[s3]) && A(l3, s3, _2, m2[s3], o3), s3 = "checked", void 0 !== g2 && g2 !== l3[s3] && A(l3, s3, g2, m2[s3], o3));
365
+ }
366
+ return l3;
367
+ }
368
+ function N(n2, u4, t3) {
341
369
  try {
342
370
  if ("function" == typeof n2) {
343
- var i3 = "function" == typeof n2.__u;
344
- i3 && n2.__u(), i3 && null == u3 || (n2.__u = n2(u3));
371
+ var i4 = "function" == typeof n2.__u;
372
+ i4 && n2.__u(), i4 && null == u4 || (n2.__u = n2(u4));
345
373
  } else
346
- n2.current = u3;
374
+ n2.current = u4;
347
375
  } catch (n3) {
348
- l.__e(n3, t2);
376
+ l.__e(n3, t3);
349
377
  }
350
378
  }
351
- function V(n2, u3, t2) {
352
- var i3, o2;
353
- if (l.unmount && l.unmount(n2), (i3 = n2.ref) && (i3.current && i3.current !== n2.__e || N(i3, null, u3)), null != (i3 = n2.__c)) {
354
- if (i3.componentWillUnmount)
379
+ function V(n2, u4, t3) {
380
+ var i4, o3;
381
+ if (l.unmount && l.unmount(n2), (i4 = n2.ref) && (i4.current && i4.current !== n2.__e || N(i4, null, u4)), null != (i4 = n2.__c)) {
382
+ if (i4.componentWillUnmount)
355
383
  try {
356
- i3.componentWillUnmount();
384
+ i4.componentWillUnmount();
357
385
  } catch (n3) {
358
- l.__e(n3, u3);
386
+ l.__e(n3, u4);
359
387
  }
360
- i3.base = i3.__P = null;
388
+ i4.base = i4.__P = null;
361
389
  }
362
- if (i3 = n2.__k)
363
- for (o2 = 0; o2 < i3.length; o2++)
364
- i3[o2] && V(i3[o2], u3, t2 || "function" != typeof n2.type);
365
- t2 || null == n2.__e || w(n2.__e), n2.__c = n2.__ = n2.__e = n2.__d = void 0;
390
+ if (i4 = n2.__k)
391
+ for (o3 = 0; o3 < i4.length; o3++)
392
+ i4[o3] && V(i4[o3], u4, t3 || "function" != typeof n2.type);
393
+ t3 || null == n2.__e || w(n2.__e), n2.__c = n2.__ = n2.__e = n2.__d = void 0;
366
394
  }
367
- function q(n2, l2, u3) {
368
- return this.constructor(n2, u3);
395
+ function q(n2, l3, u4) {
396
+ return this.constructor(n2, u4);
369
397
  }
370
- function B(u3, t2, i3) {
371
- var o2, r2, f3, e2;
372
- l.__ && l.__(u3, t2), r2 = (o2 = "function" == typeof i3) ? null : i3 && i3.__k || t2.__k, f3 = [], e2 = [], O(t2, u3 = (!o2 && i3 || t2).__k = _(k, null, [u3]), r2 || h, h, t2.namespaceURI, !o2 && i3 ? [i3] : r2 ? null : t2.firstChild ? n.call(t2.childNodes) : null, f3, !o2 && i3 ? i3 : r2 ? r2.__e : t2.firstChild, o2, e2), j(f3, u3, e2);
398
+ function B(u4, t3, i4) {
399
+ var o3, r3, f4, e3;
400
+ l.__ && l.__(u4, t3), r3 = (o3 = "function" == typeof i4) ? null : i4 && i4.__k || t3.__k, f4 = [], e3 = [], O(t3, u4 = (!o3 && i4 || t3).__k = _(k, null, [u4]), r3 || h, h, t3.namespaceURI, !o3 && i4 ? [i4] : r3 ? null : t3.firstChild ? n.call(t3.childNodes) : null, f4, !o3 && i4 ? i4 : r3 ? r3.__e : t3.firstChild, o3, e3), j(f4, u4, e3);
373
401
  }
374
- n = p.slice, l = { __e: function(n2, l2, u3, t2) {
375
- for (var i3, o2, r2; l2 = l2.__; )
376
- if ((i3 = l2.__c) && !i3.__)
402
+ n = p.slice, l = { __e: function(n2, l3, u4, t3) {
403
+ for (var i4, o3, r3; l3 = l3.__; )
404
+ if ((i4 = l3.__c) && !i4.__)
377
405
  try {
378
- if ((o2 = i3.constructor) && null != o2.getDerivedStateFromError && (i3.setState(o2.getDerivedStateFromError(n2)), r2 = i3.__d), null != i3.componentDidCatch && (i3.componentDidCatch(n2, t2 || {}), r2 = i3.__d), r2)
379
- return i3.__E = i3;
380
- } catch (l3) {
381
- n2 = l3;
406
+ if ((o3 = i4.constructor) && null != o3.getDerivedStateFromError && (i4.setState(o3.getDerivedStateFromError(n2)), r3 = i4.__d), null != i4.componentDidCatch && (i4.componentDidCatch(n2, t3 || {}), r3 = i4.__d), r3)
407
+ return i4.__E = i4;
408
+ } catch (l4) {
409
+ n2 = l4;
382
410
  }
383
411
  throw n2;
384
412
  } }, u = 0, t = function(n2) {
385
413
  return null != n2 && null == n2.constructor;
386
- }, b.prototype.setState = function(n2, l2) {
387
- var u3;
388
- u3 = null != this.__s && this.__s !== this.state ? this.__s : this.__s = d({}, this.state), "function" == typeof n2 && (n2 = n2(d({}, u3), this.props)), n2 && d(u3, n2), null != n2 && this.__v && (l2 && this._sb.push(l2), M(this));
414
+ }, b.prototype.setState = function(n2, l3) {
415
+ var u4;
416
+ u4 = null != this.__s && this.__s !== this.state ? this.__s : this.__s = d({}, this.state), "function" == typeof n2 && (n2 = n2(d({}, u4), this.props)), n2 && d(u4, n2), null != n2 && this.__v && (l3 && this._sb.push(l3), M(this));
389
417
  }, b.prototype.forceUpdate = function(n2) {
390
418
  this.__v && (this.__e = true, n2 && this.__h.push(n2), M(this));
391
- }, b.prototype.render = k, i = [], r = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, f = function(n2, l2) {
392
- return n2.__v.__b - l2.__v.__b;
419
+ }, b.prototype.render = k, i = [], r = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, f = function(n2, l3) {
420
+ return n2.__v.__b - l3.__v.__b;
393
421
  }, P.__r = 0, e = 0, c = F(false), s = F(true), a = 0;
394
422
 
395
- // src/components.tsx
396
- var components_exports = {};
397
- __export(components_exports, {
398
- ButtonGroup: () => ButtonGroup,
399
- GroupedIconButton: () => GroupedIconButton,
400
- IconButton: () => IconButton
401
- });
402
-
403
423
  // ../../node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js
404
424
  var f2 = 0;
405
425
  var i2 = Array.isArray;
406
- function u2(e2, t2, n2, o2, i3, u3) {
407
- t2 || (t2 = {});
408
- var a2, c2, p2 = t2;
409
- if ("ref" in p2)
410
- for (c2 in p2 = {}, t2)
411
- "ref" == c2 ? a2 = t2[c2] : p2[c2] = t2[c2];
412
- var l2 = { type: e2, props: p2, key: n2, ref: a2, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --f2, __i: -1, __u: 0, __source: i3, __self: u3 };
413
- if ("function" == typeof e2 && (a2 = e2.defaultProps))
414
- for (c2 in a2)
415
- void 0 === p2[c2] && (p2[c2] = a2[c2]);
416
- return l.vnode && l.vnode(l2), l2;
417
- }
418
-
419
- // src/components.tsx
420
- var IconButton = (props) => {
421
- const { className, label, onClick } = props;
422
- return /* @__PURE__ */ u2("div", { className: "deck-widget-button", children: /* @__PURE__ */ u2(
423
- "button",
424
- {
425
- className: `deck-widget-icon-button ${className}`,
426
- type: "button",
427
- onClick,
428
- title: label,
429
- children: /* @__PURE__ */ u2("div", { className: "deck-widget-icon" })
430
- }
431
- ) });
432
- };
426
+ function u2(e3, t3, n2, o3, i4, u4) {
427
+ t3 || (t3 = {});
428
+ var a3, c3, p3 = t3;
429
+ if ("ref" in p3)
430
+ for (c3 in p3 = {}, t3)
431
+ "ref" == c3 ? a3 = t3[c3] : p3[c3] = t3[c3];
432
+ var l3 = { type: e3, props: p3, key: n2, ref: a3, __k: null, __: null, __b: 0, __e: null, __d: void 0, __c: null, constructor: void 0, __v: --f2, __i: -1, __u: 0, __source: i4, __self: u4 };
433
+ if ("function" == typeof e3 && (a3 = e3.defaultProps))
434
+ for (c3 in a3)
435
+ void 0 === p3[c3] && (p3[c3] = a3[c3]);
436
+ return l.vnode && l.vnode(l3), l3;
437
+ }
438
+
439
+ // src/lib/components/button-group.tsx
433
440
  var ButtonGroup = (props) => {
434
441
  const { children, orientation } = props;
435
442
  return /* @__PURE__ */ u2("div", { className: `deck-widget-button-group ${orientation}`, children });
436
443
  };
444
+
445
+ // src/lib/components/grouped-icon-button.tsx
437
446
  var GroupedIconButton = (props) => {
438
447
  const { className, label, onClick } = props;
439
448
  return /* @__PURE__ */ u2(
440
449
  "button",
441
450
  {
442
- className: `deck-widget-icon-button ${className}`,
451
+ className: `deck-widget-icon-button ${className || ""}`,
443
452
  type: "button",
444
453
  onClick,
445
454
  title: label,
@@ -448,192 +457,180 @@ var __exports__ = (() => {
448
457
  );
449
458
  };
450
459
 
451
- // src/fullscreen-widget.tsx
452
- var FullscreenWidget = class {
453
- constructor(props) {
454
- this.id = "fullscreen";
460
+ // src/zoom-widget.tsx
461
+ var _ZoomWidget = class extends import_core2.Widget {
462
+ constructor(props = {}) {
463
+ super(props, _ZoomWidget.defaultProps);
464
+ this.className = "deck-widget-zoom";
455
465
  this.placement = "top-left";
456
- this.fullscreen = false;
457
- this.id = props.id ?? this.id;
466
+ this.viewId = null;
467
+ this.viewports = {};
468
+ this.viewId = props.viewId ?? this.viewId;
458
469
  this.placement = props.placement ?? this.placement;
459
- this.props = {
460
- ...props,
461
- enterLabel: props.enterLabel ?? "Enter Fullscreen",
462
- exitLabel: props.exitLabel ?? "Exit Fullscreen",
463
- style: props.style ?? {}
464
- };
465
- }
466
- onAdd({ deck }) {
467
- const { style, className } = this.props;
468
- const el = document.createElement("div");
469
- el.classList.add("deck-widget", "deck-widget-fullscreen");
470
- if (className)
471
- el.classList.add(className);
472
- (0, import_core2._applyStyles)(el, style);
473
- this.deck = deck;
474
- this.element = el;
475
- this.update();
476
- document.addEventListener("fullscreenchange", this.onFullscreenChange.bind(this));
477
- return el;
478
- }
479
- onRemove() {
480
- this.deck = void 0;
481
- this.element = void 0;
482
- document.removeEventListener("fullscreenchange", this.onFullscreenChange.bind(this));
483
- }
484
- update() {
485
- const { enterLabel, exitLabel } = this.props;
486
- const element = this.element;
487
- if (!element) {
488
- return;
489
- }
490
- const ui = /* @__PURE__ */ u2(
491
- IconButton,
492
- {
493
- onClick: this.handleClick.bind(this),
494
- label: this.fullscreen ? exitLabel : enterLabel,
495
- className: this.fullscreen ? "deck-widget-fullscreen-exit" : "deck-widget-fullscreen-enter"
496
- }
497
- );
498
- B(ui, element);
499
470
  }
500
471
  setProps(props) {
501
472
  this.placement = props.placement ?? this.placement;
502
- const oldProps = this.props;
503
- const el = this.element;
504
- if (el) {
505
- if (oldProps.className !== props.className) {
506
- if (oldProps.className)
507
- el.classList.remove(oldProps.className);
508
- if (props.className)
509
- el.classList.add(props.className);
510
- }
511
- if (!(0, import_core2._deepEqual)(oldProps.style, props.style, 1)) {
512
- (0, import_core2._removeStyles)(el, oldProps.style);
513
- (0, import_core2._applyStyles)(el, props.style);
514
- }
515
- }
516
- Object.assign(this.props, props);
517
- this.update();
473
+ this.viewId = props.viewId ?? this.viewId;
474
+ super.setProps(props);
518
475
  }
519
- getContainer() {
520
- return this.props.container || this.deck?.getCanvas()?.parentElement;
476
+ onRenderHTML(rootElement) {
477
+ const ui = /* @__PURE__ */ u2(ButtonGroup, { orientation: this.props.orientation, children: [
478
+ /* @__PURE__ */ u2(
479
+ GroupedIconButton,
480
+ {
481
+ onClick: () => this.handleZoomIn(),
482
+ label: this.props.zoomInLabel,
483
+ className: "deck-widget-zoom-in"
484
+ }
485
+ ),
486
+ /* @__PURE__ */ u2(
487
+ GroupedIconButton,
488
+ {
489
+ onClick: () => this.handleZoomOut(),
490
+ label: this.props.zoomOutLabel,
491
+ className: "deck-widget-zoom-out"
492
+ }
493
+ )
494
+ ] });
495
+ B(ui, rootElement);
521
496
  }
522
- onFullscreenChange() {
523
- const prevFullscreen = this.fullscreen;
524
- const fullscreen = document.fullscreenElement === this.getContainer();
525
- if (prevFullscreen !== fullscreen) {
526
- this.fullscreen = !this.fullscreen;
527
- }
528
- this.update();
497
+ onViewportChange(viewport) {
498
+ this.viewports[viewport.id] = viewport;
529
499
  }
530
- async handleClick() {
531
- if (this.fullscreen) {
532
- await this.exitFullscreen();
533
- } else {
534
- await this.requestFullscreen();
500
+ handleZoom(viewport, nextZoom) {
501
+ const viewId = this.viewId || viewport?.id || "default-view";
502
+ const nextViewState = {
503
+ ...viewport,
504
+ zoom: nextZoom
505
+ };
506
+ if (this.props.transitionDuration > 0) {
507
+ nextViewState.transitionDuration = this.props.transitionDuration;
508
+ nextViewState.transitionInterpolator = "latitude" in nextViewState ? new import_core2.FlyToInterpolator() : new import_core2.LinearInterpolator();
535
509
  }
536
- this.update();
510
+ this.setViewState(viewId, nextViewState);
537
511
  }
538
- async requestFullscreen() {
539
- const container = this.getContainer();
540
- if (container?.requestFullscreen) {
541
- await container.requestFullscreen({ navigationUI: "hide" });
542
- } else {
543
- this.togglePseudoFullscreen();
512
+ handleZoomIn() {
513
+ for (const viewport of Object.values(this.viewports)) {
514
+ this.handleZoom(viewport, viewport.zoom + 1);
544
515
  }
545
516
  }
546
- async exitFullscreen() {
547
- if (document.exitFullscreen) {
548
- await document.exitFullscreen();
549
- } else {
550
- this.togglePseudoFullscreen();
517
+ handleZoomOut() {
518
+ for (const viewport of Object.values(this.viewports)) {
519
+ this.handleZoom(viewport, viewport.zoom - 1);
551
520
  }
552
521
  }
553
- togglePseudoFullscreen() {
554
- this.getContainer()?.classList.toggle("deck-pseudo-fullscreen");
522
+ /** @todo - move to deck or widget manager */
523
+ setViewState(viewId, viewState) {
524
+ this.deck._onViewStateChange({ viewId, viewState, interactionState: {} });
555
525
  }
556
526
  };
527
+ var ZoomWidget = _ZoomWidget;
528
+ ZoomWidget.defaultProps = {
529
+ ...import_core2.Widget.defaultProps,
530
+ id: "zoom",
531
+ placement: "top-left",
532
+ orientation: "vertical",
533
+ transitionDuration: 200,
534
+ zoomInLabel: "Zoom In",
535
+ zoomOutLabel: "Zoom Out",
536
+ viewId: void 0
537
+ };
557
538
 
558
- // src/compass-widget.tsx
539
+ // src/reset-view-widget.tsx
559
540
  var import_core3 = __toESM(require_core(), 1);
560
- var CompassWidget = class {
561
- constructor(props) {
562
- this.id = "compass";
541
+
542
+ // src/lib/components/icon-button.tsx
543
+ var IconButton = (props) => {
544
+ const { className, label, onClick, children } = props;
545
+ return /* @__PURE__ */ u2("div", { className: "deck-widget-button", children: /* @__PURE__ */ u2(
546
+ "button",
547
+ {
548
+ className: `deck-widget-icon-button ${className}`,
549
+ type: "button",
550
+ onClick,
551
+ title: label,
552
+ children: children ? children : /* @__PURE__ */ u2("div", { className: "deck-widget-icon" })
553
+ }
554
+ ) });
555
+ };
556
+
557
+ // src/reset-view-widget.tsx
558
+ var _ResetViewWidget = class extends import_core3.Widget {
559
+ constructor(props = {}) {
560
+ super(props, _ResetViewWidget.defaultProps);
561
+ this.className = "deck-widget-reset-view";
563
562
  this.placement = "top-left";
564
- this.viewId = null;
565
- this.viewports = {};
566
- this.id = props.id ?? this.id;
567
- this.viewId = props.viewId ?? this.viewId;
568
563
  this.placement = props.placement ?? this.placement;
569
- this.props = {
570
- ...props,
571
- transitionDuration: props.transitionDuration ?? 200,
572
- label: props.label ?? "Reset Compass",
573
- style: props.style ?? {}
574
- };
575
564
  }
576
565
  setProps(props) {
577
566
  this.placement = props.placement ?? this.placement;
578
- this.viewId = props.viewId ?? this.viewId;
579
- const oldProps = this.props;
580
- const el = this.element;
581
- if (el) {
582
- if (oldProps.className !== props.className) {
583
- if (oldProps.className)
584
- el.classList.remove(oldProps.className);
585
- if (props.className)
586
- el.classList.add(props.className);
587
- }
588
- if (!(0, import_core3._deepEqual)(oldProps.style, props.style, 1)) {
589
- (0, import_core3._removeStyles)(el, oldProps.style);
590
- (0, import_core3._applyStyles)(el, props.style);
591
- }
592
- }
593
- Object.assign(this.props, props);
594
- this.update();
567
+ super.setProps(props);
595
568
  }
596
- onViewportChange(viewport) {
597
- if (!viewport.equals(this.viewports[viewport.id])) {
598
- this.viewports[viewport.id] = viewport;
599
- this.update();
600
- }
569
+ onRenderHTML(rootElement) {
570
+ B(
571
+ /* @__PURE__ */ u2(
572
+ IconButton,
573
+ {
574
+ className: "deck-widget-reset-focus",
575
+ label: this.props.label,
576
+ onClick: this.handleClick.bind(this)
577
+ }
578
+ ),
579
+ rootElement
580
+ );
601
581
  }
602
- onAdd({ deck }) {
603
- const { style, className } = this.props;
604
- const element = document.createElement("div");
605
- element.classList.add("deck-widget", "deck-widget-compass");
606
- if (className)
607
- element.classList.add(className);
608
- (0, import_core3._applyStyles)(element, style);
609
- this.deck = deck;
610
- this.element = element;
611
- this.update();
612
- return element;
582
+ handleClick() {
583
+ const initialViewState = this.props.initialViewState || this.deck?.props.initialViewState;
584
+ this.setViewState(initialViewState);
613
585
  }
614
- getRotation(viewport) {
615
- if (viewport instanceof import_core3.WebMercatorViewport) {
616
- return [-viewport.bearing, viewport.pitch];
617
- } else if (viewport instanceof import_core3._GlobeViewport) {
618
- return [0, Math.max(-80, Math.min(80, viewport.latitude))];
619
- }
620
- return [0, 0];
586
+ setViewState(viewState) {
587
+ const viewId = this.props.viewId || viewState?.id || "default-view";
588
+ const nextViewState = {
589
+ ...viewState
590
+ // only works for geospatial?
591
+ // transitionDuration: this.props.transitionDuration,
592
+ // transitionInterpolator: new FlyToInterpolator()
593
+ };
594
+ this.deck._onViewStateChange({ viewId, viewState: nextViewState, interactionState: {} });
595
+ }
596
+ };
597
+ var ResetViewWidget = _ResetViewWidget;
598
+ ResetViewWidget.defaultProps = {
599
+ ...import_core3.Widget.defaultProps,
600
+ id: "reset-view",
601
+ placement: "top-left",
602
+ label: "Reset View",
603
+ initialViewState: void 0,
604
+ viewId: void 0
605
+ };
606
+
607
+ // src/compass-widget.tsx
608
+ var import_core4 = __toESM(require_core(), 1);
609
+ var _CompassWidget = class extends import_core4.Widget {
610
+ constructor(props = {}) {
611
+ super(props, _CompassWidget.defaultProps);
612
+ this.className = "deck-widget-compass";
613
+ this.placement = "top-left";
614
+ this.viewId = null;
615
+ this.viewports = {};
616
+ this.setProps(this.props);
617
+ }
618
+ setProps(props) {
619
+ this.placement = props.placement ?? this.placement;
620
+ this.viewId = props.viewId ?? this.viewId;
621
+ super.setProps(props);
621
622
  }
622
- update() {
623
+ onRenderHTML(rootElement) {
623
624
  const viewId = this.viewId || Object.values(this.viewports)[0]?.id || "default-view";
624
- const viewport = this.viewports[viewId];
625
- const [rz, rx] = this.getRotation(viewport);
626
- const element = this.element;
627
- if (!element) {
628
- return;
629
- }
625
+ const widgetViewport = this.viewports[viewId];
626
+ const [rz, rx] = this.getRotation(widgetViewport);
630
627
  const ui = /* @__PURE__ */ u2("div", { className: "deck-widget-button", style: { perspective: 100 }, children: /* @__PURE__ */ u2(
631
628
  "button",
632
629
  {
633
630
  type: "button",
634
631
  onClick: () => {
635
- for (const viewport2 of Object.values(this.viewports)) {
636
- this.handleCompassReset(viewport2);
632
+ for (const viewport of Object.values(this.viewports)) {
633
+ this.handleCompassReset(viewport);
637
634
  }
638
635
  },
639
636
  title: this.props.label,
@@ -643,221 +640,1022 @@ var __exports__ = (() => {
643
640
  "path",
644
641
  {
645
642
  d: "M10 13.0001L12.9999 5L15.9997 13.0001H10Z",
646
- fill: "var(--icon-compass-north-color, #F05C44)"
643
+ fill: "var(--icon-compass-north-color, rgb(240, 92, 68))"
647
644
  }
648
645
  ),
649
646
  /* @__PURE__ */ u2(
650
647
  "path",
651
648
  {
652
649
  d: "M16.0002 12.9999L13.0004 21L10.0005 12.9999H16.0002Z",
653
- fill: "var(--icon-compass-south-color, #C2C2CC)"
650
+ fill: "var(--icon-compass-south-color, rgb(204, 204, 204))"
654
651
  }
655
652
  )
656
653
  ] }) })
657
654
  }
658
655
  ) });
659
- B(ui, element);
656
+ B(ui, rootElement);
660
657
  }
661
- onRemove() {
662
- this.deck = void 0;
663
- this.element = void 0;
658
+ onViewportChange(viewport) {
659
+ if (!viewport.equals(this.viewports[viewport.id])) {
660
+ this.viewports[viewport.id] = viewport;
661
+ this.updateHTML();
662
+ }
663
+ }
664
+ getRotation(viewport) {
665
+ if (viewport instanceof import_core4.WebMercatorViewport) {
666
+ return [-viewport.bearing, viewport.pitch];
667
+ } else if (viewport instanceof import_core4._GlobeViewport) {
668
+ return [0, Math.max(-80, Math.min(80, viewport.latitude))];
669
+ }
670
+ return [0, 0];
664
671
  }
665
672
  handleCompassReset(viewport) {
666
673
  const viewId = this.viewId || viewport.id || "default-view";
667
- if (viewport instanceof import_core3.WebMercatorViewport) {
674
+ if (viewport instanceof import_core4.WebMercatorViewport) {
668
675
  const nextViewState = {
669
676
  ...viewport,
670
677
  bearing: 0,
671
678
  ...this.getRotation(viewport)[0] === 0 ? { pitch: 0 } : {},
672
679
  transitionDuration: this.props.transitionDuration,
673
- transitionInterpolator: new import_core3.FlyToInterpolator()
680
+ transitionInterpolator: new import_core4.FlyToInterpolator()
674
681
  };
675
682
  this.deck._onViewStateChange({ viewId, viewState: nextViewState, interactionState: {} });
676
683
  }
677
684
  }
678
685
  };
686
+ var CompassWidget = _CompassWidget;
687
+ CompassWidget.defaultProps = {
688
+ ...import_core4.Widget.defaultProps,
689
+ id: "compass",
690
+ placement: "top-left",
691
+ viewId: null,
692
+ label: "Reset Compass",
693
+ transitionDuration: 200
694
+ };
679
695
 
680
- // src/zoom-widget.tsx
681
- var import_core4 = __toESM(require_core(), 1);
682
- var _ZoomWidget = class {
696
+ // src/gimbal-widget.tsx
697
+ var import_core5 = __toESM(require_core(), 1);
698
+ var _GimbalWidget = class extends import_core5.Widget {
683
699
  constructor(props = {}) {
684
- this.id = "zoom";
700
+ super(props, _GimbalWidget.defaultProps);
701
+ this.className = "deck-widget-gimbal";
685
702
  this.placement = "top-left";
686
703
  this.viewId = null;
687
- this.viewports = {};
688
- this.id = props.id ?? this.id;
689
- this.viewId = props.viewId ?? this.viewId;
690
- this.placement = props.placement ?? this.placement;
691
- this.props = {
692
- ..._ZoomWidget.defaultProps,
693
- ...props
694
- };
695
- }
696
- onAdd({ deck }) {
697
- const { style, className } = this.props;
698
- const element = document.createElement("div");
699
- element.classList.add("deck-widget", "deck-widget-zoom");
700
- if (className)
701
- element.classList.add(className);
702
- (0, import_core4._applyStyles)(element, style);
703
- this.deck = deck;
704
- this.element = element;
705
- this.update();
706
- return element;
707
- }
708
- onRemove() {
709
- this.deck = void 0;
710
- this.element = void 0;
704
+ this.setProps(this.props);
711
705
  }
712
706
  setProps(props) {
713
707
  this.placement = props.placement ?? this.placement;
714
708
  this.viewId = props.viewId ?? this.viewId;
715
- const oldProps = this.props;
716
- const el = this.element;
717
- if (el) {
718
- if (oldProps.className !== props.className) {
719
- if (oldProps.className)
720
- el.classList.remove(oldProps.className);
721
- if (props.className)
722
- el.classList.add(props.className);
723
- }
724
- if (!(0, import_core4._deepEqual)(oldProps.style, props.style, 1)) {
725
- (0, import_core4._removeStyles)(el, oldProps.style);
726
- (0, import_core4._applyStyles)(el, props.style);
727
- }
728
- }
729
- Object.assign(this.props, props);
730
- this.update();
709
+ super.setProps(props);
731
710
  }
732
- onViewportChange(viewport) {
733
- this.viewports[viewport.id] = viewport;
711
+ onRenderHTML(rootElement) {
712
+ const { rotationOrbit, rotationX } = this.getNormalizedRotation();
713
+ const ui = /* @__PURE__ */ u2("div", { className: "deck-widget-button", style: { perspective: 100, pointerEvents: "auto" }, children: /* @__PURE__ */ u2(
714
+ "button",
715
+ {
716
+ type: "button",
717
+ onClick: () => {
718
+ this.resetOrbitView();
719
+ },
720
+ title: this.props.label,
721
+ style: { position: "relative", width: 26, height: 26 },
722
+ children: [
723
+ /* @__PURE__ */ u2(
724
+ "svg",
725
+ {
726
+ className: "gimbal-outer-ring",
727
+ width: "100%",
728
+ height: "100%",
729
+ viewBox: "0 0 26 26",
730
+ style: {
731
+ position: "absolute",
732
+ top: 0,
733
+ left: 0,
734
+ transform: `rotateY(${rotationOrbit}deg)`
735
+ },
736
+ children: /* @__PURE__ */ u2(
737
+ "circle",
738
+ {
739
+ cx: "13",
740
+ cy: "13",
741
+ r: "10",
742
+ stroke: "var(--icon-gimbal-outer-color, rgb(68, 92, 204))",
743
+ strokeWidth: this.props.strokeWidth,
744
+ fill: "none"
745
+ }
746
+ )
747
+ }
748
+ ),
749
+ /* @__PURE__ */ u2(
750
+ "svg",
751
+ {
752
+ className: "gimbal-inner-ring",
753
+ width: "100%",
754
+ height: "100%",
755
+ viewBox: "0 0 26 26",
756
+ style: {
757
+ position: "absolute",
758
+ top: 0,
759
+ left: 0,
760
+ transform: `rotateX(${rotationX}deg)`
761
+ },
762
+ children: /* @__PURE__ */ u2(
763
+ "circle",
764
+ {
765
+ cx: "13",
766
+ cy: "13",
767
+ r: "7",
768
+ stroke: "var(--icon-gimbal-inner-color, rgb(240, 92, 68))",
769
+ strokeWidth: this.props.strokeWidth,
770
+ fill: "none"
771
+ }
772
+ )
773
+ }
774
+ )
775
+ ]
776
+ }
777
+ ) });
778
+ B(ui, rootElement);
734
779
  }
735
- handleZoom(viewport, nextZoom) {
736
- const viewId = this.viewId || viewport?.id || "default-view";
737
- const nextViewState = {
738
- ...viewport,
739
- zoom: nextZoom
740
- };
741
- if (this.props.transitionDuration > 0) {
742
- nextViewState.transitionDuration = this.props.transitionDuration;
743
- nextViewState.transitionInterpolator = "latitude" in nextViewState ? new import_core4.FlyToInterpolator() : new import_core4.LinearInterpolator();
744
- }
745
- this.setViewState(viewId, nextViewState);
780
+ onViewportChange(viewport) {
781
+ this.updateHTML();
746
782
  }
747
- handleZoomIn() {
748
- for (const viewport of Object.values(this.viewports)) {
749
- this.handleZoom(viewport, viewport.zoom + 1);
783
+ resetOrbitView() {
784
+ const viewId = this.getViewId();
785
+ const viewState = this.getViewState(viewId);
786
+ if ("rotationOrbit" in viewState || "rotationX" in viewState) {
787
+ const nextViewState = {
788
+ ...viewState,
789
+ rotationOrbit: 0,
790
+ rotationX: 0,
791
+ transitionDuration: this.props.transitionDuration,
792
+ transitionInterpolator: new import_core5.LinearInterpolator({
793
+ transitionProps: ["rotationOrbit", "rotationX"]
794
+ })
795
+ };
796
+ this.deck._onViewStateChange({ viewId, viewState: nextViewState, interactionState: {} });
750
797
  }
751
798
  }
752
- handleZoomOut() {
753
- for (const viewport of Object.values(this.viewports)) {
754
- this.handleZoom(viewport, viewport.zoom - 1);
799
+ getNormalizedRotation() {
800
+ const viewState = this.getViewState(this.getViewId());
801
+ const [rz, rx] = this.getRotation(viewState);
802
+ const rotationOrbit = normalizeAndClampAngle(rz);
803
+ const rotationX = normalizeAndClampAngle(rx);
804
+ return { rotationOrbit, rotationX };
805
+ }
806
+ getRotation(viewState) {
807
+ if (viewState && ("rotationOrbit" in viewState || "rotationX" in viewState)) {
808
+ return [-(viewState.rotationOrbit || 0), viewState.rotationX || 0];
755
809
  }
810
+ return [0, 0];
756
811
  }
757
- /**
758
- * @todo - move to deck or widget manager
759
- */
760
- setViewState(viewId, viewState) {
761
- this.deck._onViewStateChange({ viewId, viewState, interactionState: {} });
812
+ // Move to Widget/WidgetManager?
813
+ getViewId() {
814
+ const viewId = this.viewId || "OrbitView";
815
+ return viewId;
762
816
  }
763
- update() {
764
- const element = this.element;
765
- if (!element) {
766
- return;
817
+ getViewState(viewId) {
818
+ const viewManager = this.getViewManager();
819
+ const viewState = viewId && viewManager.getViewState(viewId) || viewManager.viewState;
820
+ return viewState;
821
+ }
822
+ getViewManager() {
823
+ const viewManager = this.deck?.viewManager;
824
+ if (!viewManager) {
825
+ throw new Error("wigdet must be added to a deck instance");
767
826
  }
768
- const ui = /* @__PURE__ */ u2(ButtonGroup, { orientation: this.props.orientation, children: [
827
+ return viewManager;
828
+ }
829
+ };
830
+ var GimbalWidget = _GimbalWidget;
831
+ GimbalWidget.defaultProps = {
832
+ ...import_core5.Widget.defaultProps,
833
+ id: "gimbal",
834
+ placement: "top-left",
835
+ viewId: void 0,
836
+ label: "Gimbal",
837
+ strokeWidth: 1.5,
838
+ transitionDuration: 200
839
+ };
840
+ function normalizeAndClampAngle(angle) {
841
+ let normalized = ((angle + 180) % 360 + 360) % 360 - 180;
842
+ const AVOID_ANGLE_DELTA = 10;
843
+ const distanceFrom90 = normalized - 90;
844
+ if (Math.abs(distanceFrom90) < AVOID_ANGLE_DELTA) {
845
+ if (distanceFrom90 < AVOID_ANGLE_DELTA) {
846
+ normalized = 90 + AVOID_ANGLE_DELTA;
847
+ } else if (distanceFrom90 > -AVOID_ANGLE_DELTA) {
848
+ normalized = 90 - AVOID_ANGLE_DELTA;
849
+ }
850
+ }
851
+ return normalized;
852
+ }
853
+
854
+ // src/scale-widget.tsx
855
+ var import_core6 = __toESM(require_core(), 1);
856
+ var _ScaleWidget = class extends import_core6.Widget {
857
+ constructor(props = {}) {
858
+ super(props, _ScaleWidget.defaultProps);
859
+ this.className = "deck-widget-scale";
860
+ this.placement = "bottom-left";
861
+ // The pixel width of the scale line (computed from a candidate distance)
862
+ this.scaleWidth = 10;
863
+ // The candidate distance (in meters) corresponding to the scale line length.
864
+ this.scaleValue = 0;
865
+ // The formatted distance label (e.g. "200 m" or "1.0 km")
866
+ this.scaleText = "";
867
+ this.placement = props.placement ?? this.placement;
868
+ }
869
+ setProps(props) {
870
+ this.placement = props.placement ?? this.placement;
871
+ super.setProps(props);
872
+ }
873
+ onRenderHTML(rootElement) {
874
+ const lineOffsetX = 50;
875
+ const svgWidth = lineOffsetX + this.scaleWidth;
876
+ const tickHeight = 10;
877
+ B(
769
878
  /* @__PURE__ */ u2(
770
- GroupedIconButton,
879
+ "svg",
771
880
  {
772
- onClick: () => this.handleZoomIn(),
773
- label: this.props.zoomInLabel,
774
- className: "deck-widget-zoom-in"
881
+ className: "deck-widget-scale",
882
+ width: svgWidth,
883
+ height: 30,
884
+ style: { overflow: "visible", background: "transparent" },
885
+ onClick: this.handleClick.bind(this),
886
+ children: [
887
+ /* @__PURE__ */ u2(
888
+ "text",
889
+ {
890
+ x: lineOffsetX + 5,
891
+ y: "10",
892
+ textAnchor: "end",
893
+ alignmentBaseline: "middle",
894
+ style: { fontSize: "16px", fill: "black", fontWeight: "bold", fontFamily: "sans-serif" },
895
+ children: this.scaleText
896
+ }
897
+ ),
898
+ /* @__PURE__ */ u2(
899
+ "line",
900
+ {
901
+ x1: lineOffsetX,
902
+ y1: "15",
903
+ x2: lineOffsetX + this.scaleWidth,
904
+ y2: "15",
905
+ stroke: "black",
906
+ strokeWidth: "6"
907
+ }
908
+ ),
909
+ /* @__PURE__ */ u2(
910
+ "line",
911
+ {
912
+ x1: lineOffsetX,
913
+ y1: "15",
914
+ x2: lineOffsetX,
915
+ y2: 15 - tickHeight,
916
+ stroke: "black",
917
+ strokeWidth: "6"
918
+ }
919
+ ),
920
+ /* @__PURE__ */ u2(
921
+ "line",
922
+ {
923
+ x1: lineOffsetX + this.scaleWidth,
924
+ y1: "15",
925
+ x2: lineOffsetX + this.scaleWidth,
926
+ y2: 15 - tickHeight,
927
+ stroke: "black",
928
+ strokeWidth: "6"
929
+ }
930
+ )
931
+ ]
775
932
  }
776
933
  ),
934
+ rootElement
935
+ );
936
+ }
937
+ onViewportChange(viewport) {
938
+ if (!("latitude" in viewport))
939
+ return;
940
+ const { latitude, zoom } = viewport;
941
+ const metersPerPixel = getMetersPerPixel(latitude, zoom);
942
+ const { candidate, candidatePixels } = computeScaleCandidate(metersPerPixel);
943
+ this.scaleValue = candidate;
944
+ this.scaleWidth = candidatePixels;
945
+ if (candidate >= 1e3) {
946
+ this.scaleText = `${(candidate / 1e3).toFixed(1)} km`;
947
+ } else {
948
+ this.scaleText = `${candidate} m`;
949
+ }
950
+ this.updateHTML();
951
+ }
952
+ handleClick() {
953
+ }
954
+ };
955
+ var ScaleWidget = _ScaleWidget;
956
+ ScaleWidget.defaultProps = {
957
+ ...import_core6.Widget.defaultProps,
958
+ id: "scale",
959
+ placement: "bottom-left",
960
+ label: "Scale",
961
+ onCapture: void 0
962
+ };
963
+ function getMetersPerPixel(latitude, zoom) {
964
+ const earthCircumference = 40075016686e-3;
965
+ return earthCircumference * Math.cos(latitude * Math.PI / 180) / Math.pow(2, zoom + 8);
966
+ }
967
+ function computeScaleCandidate(metersPerPixel) {
968
+ const minPixels = 100;
969
+ const maxPixels = 200;
970
+ const targetPixels = (minPixels + maxPixels) / 2;
971
+ const targetDistance = targetPixels * metersPerPixel;
972
+ const exponent = Math.floor(Math.log10(targetDistance));
973
+ const base = Math.pow(10, exponent);
974
+ const multipliers = [1, 2, 5];
975
+ let candidate = multipliers[0] * base;
976
+ let candidatePixels = candidate / metersPerPixel;
977
+ for (let i4 = 0; i4 < multipliers.length; i4++) {
978
+ const currentCandidate = multipliers[i4] * base;
979
+ const currentPixels = currentCandidate / metersPerPixel;
980
+ if (currentPixels >= minPixels && currentPixels <= maxPixels) {
981
+ candidate = currentCandidate;
982
+ candidatePixels = currentPixels;
983
+ break;
984
+ }
985
+ if (currentPixels > maxPixels) {
986
+ candidate = i4 > 0 ? multipliers[i4 - 1] * base : currentCandidate;
987
+ candidatePixels = candidate / metersPerPixel;
988
+ break;
989
+ }
990
+ if (i4 === multipliers.length - 1 && currentPixels < minPixels) {
991
+ candidate = multipliers[0] * base * 10;
992
+ candidatePixels = candidate / metersPerPixel;
993
+ }
994
+ }
995
+ return { candidate, candidatePixels };
996
+ }
997
+
998
+ // src/geocoder-widget.tsx
999
+ var import_core7 = __toESM(require_core(), 1);
1000
+ var import_core8 = __toESM(require_core(), 1);
1001
+
1002
+ // ../../node_modules/preact/hooks/dist/hooks.module.js
1003
+ var t2;
1004
+ var r2;
1005
+ var u3;
1006
+ var i3;
1007
+ var o2 = 0;
1008
+ var f3 = [];
1009
+ var c2 = l;
1010
+ var e2 = c2.__b;
1011
+ var a2 = c2.__r;
1012
+ var v2 = c2.diffed;
1013
+ var l2 = c2.__c;
1014
+ var m = c2.unmount;
1015
+ var s2 = c2.__;
1016
+ function d2(n2, t3) {
1017
+ c2.__h && c2.__h(r2, n2, o2 || t3), o2 = 0;
1018
+ var u4 = r2.__H || (r2.__H = { __: [], __h: [] });
1019
+ return n2 >= u4.__.length && u4.__.push({}), u4.__[n2];
1020
+ }
1021
+ function h2(n2) {
1022
+ return o2 = 1, p2(D, n2);
1023
+ }
1024
+ function p2(n2, u4, i4) {
1025
+ var o3 = d2(t2++, 2);
1026
+ if (o3.t = n2, !o3.__c && (o3.__ = [i4 ? i4(u4) : D(void 0, u4), function(n3) {
1027
+ var t3 = o3.__N ? o3.__N[0] : o3.__[0], r3 = o3.t(t3, n3);
1028
+ t3 !== r3 && (o3.__N = [r3, o3.__[1]], o3.__c.setState({}));
1029
+ }], o3.__c = r2, !r2.u)) {
1030
+ var f4 = function(n3, t3, r3) {
1031
+ if (!o3.__c.__H)
1032
+ return true;
1033
+ var u5 = o3.__c.__H.__.filter(function(n4) {
1034
+ return !!n4.__c;
1035
+ });
1036
+ if (u5.every(function(n4) {
1037
+ return !n4.__N;
1038
+ }))
1039
+ return !c3 || c3.call(this, n3, t3, r3);
1040
+ var i5 = false;
1041
+ return u5.forEach(function(n4) {
1042
+ if (n4.__N) {
1043
+ var t4 = n4.__[0];
1044
+ n4.__ = n4.__N, n4.__N = void 0, t4 !== n4.__[0] && (i5 = true);
1045
+ }
1046
+ }), !(!i5 && o3.__c.props === n3) && (!c3 || c3.call(this, n3, t3, r3));
1047
+ };
1048
+ r2.u = true;
1049
+ var c3 = r2.shouldComponentUpdate, e3 = r2.componentWillUpdate;
1050
+ r2.componentWillUpdate = function(n3, t3, r3) {
1051
+ if (this.__e) {
1052
+ var u5 = c3;
1053
+ c3 = void 0, f4(n3, t3, r3), c3 = u5;
1054
+ }
1055
+ e3 && e3.call(this, n3, t3, r3);
1056
+ }, r2.shouldComponentUpdate = f4;
1057
+ }
1058
+ return o3.__N || o3.__;
1059
+ }
1060
+ function y2(n2, u4) {
1061
+ var i4 = d2(t2++, 3);
1062
+ !c2.__s && C2(i4.__H, u4) && (i4.__ = n2, i4.i = u4, r2.__H.__h.push(i4));
1063
+ }
1064
+ function A2(n2) {
1065
+ return o2 = 5, T2(function() {
1066
+ return { current: n2 };
1067
+ }, []);
1068
+ }
1069
+ function T2(n2, r3) {
1070
+ var u4 = d2(t2++, 7);
1071
+ return C2(u4.__H, r3) && (u4.__ = n2(), u4.__H = r3, u4.__h = n2), u4.__;
1072
+ }
1073
+ function j2() {
1074
+ for (var n2; n2 = f3.shift(); )
1075
+ if (n2.__P && n2.__H)
1076
+ try {
1077
+ n2.__H.__h.forEach(z2), n2.__H.__h.forEach(B2), n2.__H.__h = [];
1078
+ } catch (t3) {
1079
+ n2.__H.__h = [], c2.__e(t3, n2.__v);
1080
+ }
1081
+ }
1082
+ c2.__b = function(n2) {
1083
+ r2 = null, e2 && e2(n2);
1084
+ }, c2.__ = function(n2, t3) {
1085
+ n2 && t3.__k && t3.__k.__m && (n2.__m = t3.__k.__m), s2 && s2(n2, t3);
1086
+ }, c2.__r = function(n2) {
1087
+ a2 && a2(n2), t2 = 0;
1088
+ var i4 = (r2 = n2.__c).__H;
1089
+ i4 && (u3 === r2 ? (i4.__h = [], r2.__h = [], i4.__.forEach(function(n3) {
1090
+ n3.__N && (n3.__ = n3.__N), n3.i = n3.__N = void 0;
1091
+ })) : (i4.__h.forEach(z2), i4.__h.forEach(B2), i4.__h = [], t2 = 0)), u3 = r2;
1092
+ }, c2.diffed = function(n2) {
1093
+ v2 && v2(n2);
1094
+ var t3 = n2.__c;
1095
+ t3 && t3.__H && (t3.__H.__h.length && (1 !== f3.push(t3) && i3 === c2.requestAnimationFrame || ((i3 = c2.requestAnimationFrame) || w2)(j2)), t3.__H.__.forEach(function(n3) {
1096
+ n3.i && (n3.__H = n3.i), n3.i = void 0;
1097
+ })), u3 = r2 = null;
1098
+ }, c2.__c = function(n2, t3) {
1099
+ t3.some(function(n3) {
1100
+ try {
1101
+ n3.__h.forEach(z2), n3.__h = n3.__h.filter(function(n4) {
1102
+ return !n4.__ || B2(n4);
1103
+ });
1104
+ } catch (r3) {
1105
+ t3.some(function(n4) {
1106
+ n4.__h && (n4.__h = []);
1107
+ }), t3 = [], c2.__e(r3, n3.__v);
1108
+ }
1109
+ }), l2 && l2(n2, t3);
1110
+ }, c2.unmount = function(n2) {
1111
+ m && m(n2);
1112
+ var t3, r3 = n2.__c;
1113
+ r3 && r3.__H && (r3.__H.__.forEach(function(n3) {
1114
+ try {
1115
+ z2(n3);
1116
+ } catch (n4) {
1117
+ t3 = n4;
1118
+ }
1119
+ }), r3.__H = void 0, t3 && c2.__e(t3, r3.__v));
1120
+ };
1121
+ var k2 = "function" == typeof requestAnimationFrame;
1122
+ function w2(n2) {
1123
+ var t3, r3 = function() {
1124
+ clearTimeout(u4), k2 && cancelAnimationFrame(t3), setTimeout(n2);
1125
+ }, u4 = setTimeout(r3, 100);
1126
+ k2 && (t3 = requestAnimationFrame(r3));
1127
+ }
1128
+ function z2(n2) {
1129
+ var t3 = r2, u4 = n2.__c;
1130
+ "function" == typeof u4 && (n2.__c = void 0, u4()), r2 = t3;
1131
+ }
1132
+ function B2(n2) {
1133
+ var t3 = r2;
1134
+ n2.__c = n2.__(), r2 = t3;
1135
+ }
1136
+ function C2(n2, t3) {
1137
+ return !n2 || n2.length !== t3.length || t3.some(function(t4, r3) {
1138
+ return t4 !== n2[r3];
1139
+ });
1140
+ }
1141
+ function D(n2, t3) {
1142
+ return "function" == typeof t3 ? t3(n2) : t3;
1143
+ }
1144
+
1145
+ // src/lib/components/dropdown-menu.tsx
1146
+ var DropdownMenu = (props) => {
1147
+ const [isOpen, setIsOpen] = h2(false);
1148
+ const dropdownRef = A2(null);
1149
+ const toggleDropdown = () => setIsOpen(!isOpen);
1150
+ const handleClickOutside = (event) => {
1151
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
1152
+ setIsOpen(false);
1153
+ }
1154
+ };
1155
+ y2(() => {
1156
+ document.addEventListener("mousedown", handleClickOutside);
1157
+ return () => {
1158
+ document.removeEventListener("mousedown", handleClickOutside);
1159
+ };
1160
+ }, []);
1161
+ const handleSelect = (value) => {
1162
+ props.onSelect(value);
1163
+ setIsOpen(false);
1164
+ };
1165
+ return /* @__PURE__ */ u2(
1166
+ "div",
1167
+ {
1168
+ className: "dropdown-container",
1169
+ ref: dropdownRef,
1170
+ style: {
1171
+ position: "relative",
1172
+ display: "inline-block",
1173
+ ...props.style
1174
+ },
1175
+ children: [
1176
+ /* @__PURE__ */ u2(
1177
+ "button",
1178
+ {
1179
+ onClick: toggleDropdown,
1180
+ style: {
1181
+ width: "30px",
1182
+ height: "30px",
1183
+ display: "flex",
1184
+ alignItems: "center",
1185
+ justifyContent: "center",
1186
+ border: "1px solid #ccc",
1187
+ borderRadius: "4px",
1188
+ background: "#fff",
1189
+ cursor: "pointer",
1190
+ padding: 0
1191
+ },
1192
+ children: "\u25BC"
1193
+ }
1194
+ ),
1195
+ isOpen && /* @__PURE__ */ u2(
1196
+ "ul",
1197
+ {
1198
+ style: {
1199
+ position: "absolute",
1200
+ top: "100%",
1201
+ right: "100%",
1202
+ background: "#fff",
1203
+ border: "1px solid #ccc",
1204
+ borderRadius: "4px",
1205
+ listStyle: "none",
1206
+ padding: "4px 0",
1207
+ margin: 0,
1208
+ zIndex: 1e3,
1209
+ minWidth: "200px"
1210
+ },
1211
+ children: props.menuItems.map((item) => /* @__PURE__ */ u2(
1212
+ "li",
1213
+ {
1214
+ onClick: () => handleSelect(item),
1215
+ style: {
1216
+ padding: "4px 8px",
1217
+ cursor: "pointer",
1218
+ whiteSpace: "nowrap"
1219
+ },
1220
+ children: item
1221
+ },
1222
+ item
1223
+ ))
1224
+ }
1225
+ )
1226
+ ]
1227
+ }
1228
+ );
1229
+ };
1230
+
1231
+ // src/lib/geocode/geocoder-history.ts
1232
+ var CURRENT_LOCATION = "current";
1233
+ var LOCAL_STORAGE_KEY = "deck-geocoder-history";
1234
+ var GeocoderHistory = class {
1235
+ constructor(props) {
1236
+ this.addressText = "";
1237
+ this.errorText = "";
1238
+ this.addressHistory = [];
1239
+ this.props = { maxEntries: 5, ...props };
1240
+ this.addressHistory = this.loadPreviousAddresses();
1241
+ }
1242
+ /** PErform geocoding */
1243
+ async geocode(geocoder, address, apiKey) {
1244
+ this.errorText = "";
1245
+ this.addressText = address;
1246
+ try {
1247
+ const coordinates = await geocoder.geocode(address, apiKey);
1248
+ if (coordinates) {
1249
+ this.storeAddress(this.addressText);
1250
+ return coordinates;
1251
+ }
1252
+ this.errorText = "Invalid address";
1253
+ } catch (error) {
1254
+ this.errorText = `${error.message}`;
1255
+ }
1256
+ return null;
1257
+ }
1258
+ loadPreviousAddresses() {
1259
+ try {
1260
+ const stored = window.localStorage.getItem(LOCAL_STORAGE_KEY);
1261
+ const list = stored && JSON.parse(stored);
1262
+ const addresses = Array.isArray(list) ? list.filter((v3) => typeof v3 === "string") : [];
1263
+ return addresses;
1264
+ } catch {
1265
+ }
1266
+ return [];
1267
+ }
1268
+ storeAddress(address) {
1269
+ const cleaned = address.trim();
1270
+ if (!cleaned || cleaned === CURRENT_LOCATION) {
1271
+ return;
1272
+ }
1273
+ const deduped = [cleaned, ...this.addressHistory.filter((a3) => a3 !== cleaned)];
1274
+ this.addressHistory = deduped.slice(0, this.props.maxEntries);
1275
+ try {
1276
+ window.localStorage.setItem(LOCAL_STORAGE_KEY, JSON.stringify(this.addressHistory));
1277
+ } catch {
1278
+ }
1279
+ }
1280
+ };
1281
+
1282
+ // src/lib/geocode/geocoders.ts
1283
+ var GOOGLE_URL = "https://maps.googleapis.com/maps/api/geocode/json";
1284
+ var MAPBOX_URL = "https://api.mapbox.com/geocoding/v5/mapbox.places";
1285
+ var OPENCAGE_API_URL = "https://api.opencagedata.com/geocode/v1/json";
1286
+ var GoogleGeocoder = {
1287
+ name: "google",
1288
+ requiresApiKey: true,
1289
+ async geocode(address, apiKey) {
1290
+ const encodedAddress = encodeURIComponent(address);
1291
+ const json = await fetchJson(`${GOOGLE_URL}?address=${encodedAddress}&key=${apiKey}`);
1292
+ switch (json.status) {
1293
+ case "OK":
1294
+ const loc = json.results.length > 0 && json.results[0].geometry.location;
1295
+ return loc ? { longitude: loc.lng, latitude: loc.lat } : null;
1296
+ default:
1297
+ throw new Error(`Google Geocoder failed: ${json.status}`);
1298
+ }
1299
+ }
1300
+ };
1301
+ var MapboxGeocoder = {
1302
+ name: "google",
1303
+ requiresApiKey: true,
1304
+ async geocode(address, apiKey) {
1305
+ const encodedAddress = encodeURIComponent(address);
1306
+ const json = await fetchJson(`${MAPBOX_URL}/${encodedAddress}.json?access_token=${apiKey}`);
1307
+ if (Array.isArray(json.features) && json.features.length > 0) {
1308
+ const center = json.features[0].center;
1309
+ if (Array.isArray(center) && center.length >= 2) {
1310
+ return { longitude: center[0], latitude: center[1] };
1311
+ }
1312
+ }
1313
+ return null;
1314
+ }
1315
+ };
1316
+ var OpenCageGeocoder = {
1317
+ name: "opencage",
1318
+ requiresApiKey: true,
1319
+ async geocode(address, key) {
1320
+ const encodedAddress = encodeURIComponent(address);
1321
+ const data = await fetchJson(`${OPENCAGE_API_URL}?q=${encodedAddress}&key=${key}`);
1322
+ if (Array.isArray(data.results) && data.results.length > 0) {
1323
+ const geometry = data.results[0].geometry;
1324
+ return { longitude: geometry.lng, latitude: geometry.lat };
1325
+ }
1326
+ return null;
1327
+ }
1328
+ };
1329
+ var CurrentLocationGeocoder = {
1330
+ name: "current",
1331
+ requiresApiKey: false,
1332
+ /** Attempt to call browsers geolocation API */
1333
+ async geocode() {
1334
+ if (!navigator.geolocation) {
1335
+ throw new Error("Geolocation not supported");
1336
+ }
1337
+ return new Promise((resolve, reject) => {
1338
+ navigator.geolocation.getCurrentPosition(
1339
+ /** @see https://developer.mozilla.org/docs/Web/API/GeolocationPosition */
1340
+ (position) => {
1341
+ const { longitude, latitude } = position.coords;
1342
+ resolve({ longitude, latitude });
1343
+ },
1344
+ /** @see https://developer.mozilla.org/docs/Web/API/GeolocationPositionError */
1345
+ (error) => reject(new Error(error.message))
1346
+ );
1347
+ });
1348
+ }
1349
+ };
1350
+ async function fetchJson(url) {
1351
+ let response;
1352
+ try {
1353
+ response = await fetch(url);
1354
+ } catch (error) {
1355
+ throw new Error(`CORS error? ${error}. ${url}: `);
1356
+ }
1357
+ if (!response.ok) {
1358
+ throw new Error(`${response.statusText}. ${url}: `);
1359
+ }
1360
+ const data = await response.json();
1361
+ if (!data) {
1362
+ throw new Error(`No data returned. ${url}`);
1363
+ }
1364
+ return data;
1365
+ }
1366
+ var CoordinatesGeocoder = {
1367
+ name: "coordinates",
1368
+ requiresApiKey: false,
1369
+ placeholderLocation: `-122.45, 37.8 or 37\xB048'N, 122\xB027'W`,
1370
+ async geocode(address) {
1371
+ return parseCoordinates(address) || null;
1372
+ }
1373
+ };
1374
+ function parseCoordinates(input) {
1375
+ input = input.trim();
1376
+ const parts = input.split(/[,;]/).map((p3) => p3.trim());
1377
+ if (parts.length < 2)
1378
+ return null;
1379
+ const first = parseCoordinatePart(parts[0]);
1380
+ const second = parseCoordinatePart(parts[1]);
1381
+ if (first === null || second === null)
1382
+ return null;
1383
+ if (Math.abs(first) > 90 && Math.abs(second) <= 90) {
1384
+ return { longitude: first, latitude: second };
1385
+ } else if (Math.abs(second) > 90 && Math.abs(first) <= 90) {
1386
+ return { longitude: second, latitude: first };
1387
+ }
1388
+ return { latitude: first, longitude: second };
1389
+ }
1390
+ function parseCoordinatePart(s3) {
1391
+ s3 = s3.trim();
1392
+ if (s3.includes("\xB0") || s3.includes("'") || s3.includes('"')) {
1393
+ const value2 = dmsToDecimal(s3);
1394
+ return isNaN(value2) ? null : value2;
1395
+ }
1396
+ let sign = 1;
1397
+ if (/[SW]/i.test(s3))
1398
+ sign = -1;
1399
+ s3 = s3.replace(/[NSEW]/gi, "");
1400
+ const value = parseFloat(s3);
1401
+ return isNaN(value) ? null : sign * value;
1402
+ }
1403
+ function dmsToDecimal(s3) {
1404
+ const regex = /(\d+)[°d]\s*(\d+)?['′m]?\s*(\d+(?:\.\d+)?)?[\"″s]?\s*([NSEW])?/i;
1405
+ const match = s3.match(regex);
1406
+ if (!match)
1407
+ return NaN;
1408
+ const degrees = parseFloat(match[1]) || 0;
1409
+ const minutes = parseFloat(match[2]) || 0;
1410
+ const seconds = parseFloat(match[3]) || 0;
1411
+ const direction = match[4] || "";
1412
+ let dec = degrees + minutes / 60 + seconds / 3600;
1413
+ if (/[SW]/i.test(direction)) {
1414
+ dec = -dec;
1415
+ }
1416
+ return dec;
1417
+ }
1418
+
1419
+ // src/geocoder-widget.tsx
1420
+ var CURRENT_LOCATION2 = "current";
1421
+ var _GeocoderWidget = class extends import_core7.Widget {
1422
+ constructor(props = {}) {
1423
+ super(props, _GeocoderWidget.defaultProps);
1424
+ this.className = "deck-widget-geocoder";
1425
+ this.placement = "top-left";
1426
+ this.geocodeHistory = new GeocoderHistory({});
1427
+ this.addressText = "";
1428
+ this.geocoder = CoordinatesGeocoder;
1429
+ this.setInput = (text) => {
1430
+ this.addressText = text;
1431
+ };
1432
+ this.handleKeyPress = (e3) => {
1433
+ if (e3.key === "Enter") {
1434
+ this.handleSubmit();
1435
+ }
1436
+ };
1437
+ this.handleSelect = (address) => {
1438
+ this.setInput(address);
1439
+ this.handleSubmit();
1440
+ };
1441
+ /** Sync wrapper for async geocode() */
1442
+ this.handleSubmit = () => {
1443
+ this.geocode(this.addressText);
1444
+ };
1445
+ /** Perform geocoding */
1446
+ this.geocode = async (address) => {
1447
+ const useGeolocation = this.props._geolocation && address === CURRENT_LOCATION2;
1448
+ const geocoder = useGeolocation ? CurrentLocationGeocoder : this.geocoder;
1449
+ const coordinates = await this.geocodeHistory.geocode(
1450
+ geocoder,
1451
+ this.addressText,
1452
+ this.props.apiKey
1453
+ );
1454
+ if (coordinates) {
1455
+ this.setViewState(coordinates);
1456
+ }
1457
+ };
1458
+ this.viewports = {};
1459
+ this.placement = props.placement ?? this.placement;
1460
+ this.setProps(props);
1461
+ this.geocoder = getGeocoder(props);
1462
+ }
1463
+ setProps(props) {
1464
+ super.setProps(props);
1465
+ this.placement = props.placement ?? this.placement;
1466
+ this.geocoder = getGeocoder(this.props);
1467
+ if (this.geocoder.requiresApiKey && !this.props.apiKey) {
1468
+ throw new Error(`API key is required for the ${this.geocoder.name} geocoder`);
1469
+ }
1470
+ }
1471
+ onRenderHTML(rootElement) {
1472
+ const menuItems = this.props._geolocation ? [CURRENT_LOCATION2, ...this.geocodeHistory.addressHistory] : [...this.geocodeHistory.addressHistory];
1473
+ B(
777
1474
  /* @__PURE__ */ u2(
778
- GroupedIconButton,
1475
+ "div",
779
1476
  {
780
- onClick: () => this.handleZoomOut(),
781
- label: this.props.zoomOutLabel,
782
- className: "deck-widget-zoom-out"
1477
+ className: "deck-widget-geocoder",
1478
+ style: {
1479
+ pointerEvents: "auto",
1480
+ display: "flex",
1481
+ alignItems: "center",
1482
+ flexWrap: "wrap"
1483
+ // Allows wrapping on smaller screens
1484
+ },
1485
+ children: [
1486
+ /* @__PURE__ */ u2(
1487
+ "input",
1488
+ {
1489
+ type: "text",
1490
+ placeholder: this.geocoder.placeholderLocation ?? "Enter address or location",
1491
+ value: this.geocodeHistory.addressText,
1492
+ onInput: (e3) => this.setInput(e3.target?.value || ""),
1493
+ onKeyPress: this.handleKeyPress,
1494
+ style: {
1495
+ flex: "1 1 auto",
1496
+ minWidth: "200px",
1497
+ margin: 0,
1498
+ padding: "8px",
1499
+ boxSizing: "border-box"
1500
+ }
1501
+ }
1502
+ ),
1503
+ /* @__PURE__ */ u2(
1504
+ DropdownMenu,
1505
+ {
1506
+ menuItems,
1507
+ onSelect: this.handleSelect,
1508
+ style: {
1509
+ margin: 2,
1510
+ padding: "4px 2px",
1511
+ boxSizing: "border-box"
1512
+ }
1513
+ }
1514
+ ),
1515
+ this.geocodeHistory.errorText && /* @__PURE__ */ u2("div", { className: "error", children: this.geocodeHistory.errorText })
1516
+ ]
783
1517
  }
784
- )
785
- ] });
786
- B(ui, element);
1518
+ ),
1519
+ rootElement
1520
+ );
1521
+ }
1522
+ // TODO - MOVE TO WIDGETIMPL?
1523
+ setViewState(viewState) {
1524
+ const viewId = this.props.viewId || viewState?.id || "default-view";
1525
+ const viewport = this.viewports[viewId] || {};
1526
+ const nextViewState = {
1527
+ ...viewport,
1528
+ ...viewState
1529
+ };
1530
+ if (this.props.transitionDuration > 0) {
1531
+ nextViewState.transitionDuration = this.props.transitionDuration;
1532
+ nextViewState.transitionInterpolator = "latitude" in nextViewState ? new import_core8.FlyToInterpolator() : new import_core8.LinearInterpolator();
1533
+ }
1534
+ this.deck._onViewStateChange({ viewId, viewState: nextViewState, interactionState: {} });
1535
+ }
1536
+ onViewportChange(viewport) {
1537
+ this.viewports[viewport.id] = viewport;
787
1538
  }
788
1539
  };
789
- var ZoomWidget = _ZoomWidget;
790
- ZoomWidget.defaultProps = {
791
- id: "zoom-widget",
792
- style: {},
1540
+ var GeocoderWidget = _GeocoderWidget;
1541
+ GeocoderWidget.defaultProps = {
1542
+ ...import_core7.Widget.defaultProps,
1543
+ id: "geolocate",
1544
+ viewId: void 0,
793
1545
  placement: "top-left",
794
- className: void 0,
795
- orientation: "vertical",
1546
+ label: "Geolocate",
796
1547
  transitionDuration: 200,
797
- zoomInLabel: "Zoom In",
798
- zoomOutLabel: "Zoom Out",
799
- viewId: void 0
1548
+ geocoder: "coordinates",
1549
+ customGeocoder: CoordinatesGeocoder,
1550
+ apiKey: "",
1551
+ _geolocation: false
800
1552
  };
1553
+ function getGeocoder(props) {
1554
+ switch (props.geocoder) {
1555
+ case "google":
1556
+ return GoogleGeocoder;
1557
+ case "mapbox":
1558
+ return MapboxGeocoder;
1559
+ case "opencage":
1560
+ return OpenCageGeocoder;
1561
+ case "coordinates":
1562
+ return CoordinatesGeocoder;
1563
+ case "custom":
1564
+ if (!props.customGeocoder) {
1565
+ throw new Error("Custom geocoder is not defined");
1566
+ }
1567
+ return props.customGeocoder;
1568
+ default:
1569
+ throw new Error(`Unknown geocoder: ${props.geocoder}`);
1570
+ }
1571
+ }
801
1572
 
802
- // src/widget-impl.ts
803
- var import_core5 = __toESM(require_core(), 1);
804
- var WidgetImpl = class {
805
- constructor(props) {
806
- this.id = props.id || "widget";
807
- this.props = props;
1573
+ // src/fullscreen-widget.tsx
1574
+ var import_core9 = __toESM(require_core(), 1);
1575
+ var _FullscreenWidget = class extends import_core9.Widget {
1576
+ constructor(props = {}) {
1577
+ super(props, _FullscreenWidget.defaultProps);
1578
+ this.className = "deck-widget-fullscreen";
1579
+ this.placement = "top-left";
1580
+ this.fullscreen = false;
1581
+ this.placement = props.placement ?? this.placement;
808
1582
  }
809
- onAdd({ deck }) {
810
- this.deck = deck;
811
- const { style, className } = this.props;
812
- const el = this._createRootElement({
813
- widgetClassName: this.className,
814
- className,
815
- style
816
- });
817
- this.element = el;
818
- this.onRenderHTML();
819
- return this.element;
1583
+ onAdd() {
1584
+ document.addEventListener("fullscreenchange", this.onFullscreenChange.bind(this));
820
1585
  }
821
1586
  onRemove() {
822
- this.deck = void 0;
823
- this.element = void 0;
1587
+ document.removeEventListener("fullscreenchange", this.onFullscreenChange.bind(this));
1588
+ }
1589
+ onRenderHTML(rootElement) {
1590
+ B(
1591
+ /* @__PURE__ */ u2(
1592
+ IconButton,
1593
+ {
1594
+ onClick: this.handleClick.bind(this),
1595
+ label: this.fullscreen ? this.props.exitLabel : this.props.enterLabel,
1596
+ className: this.fullscreen ? "deck-widget-fullscreen-exit" : "deck-widget-fullscreen-enter"
1597
+ }
1598
+ ),
1599
+ rootElement
1600
+ );
824
1601
  }
825
1602
  setProps(props) {
826
- const oldProps = this.props;
827
- const el = this.element;
828
- if (el) {
829
- if (oldProps.className !== props.className) {
830
- if (oldProps.className)
831
- el.classList.remove(oldProps.className);
832
- if (props.className)
833
- el.classList.add(props.className);
834
- }
835
- if (!(0, import_core5._deepEqual)(oldProps.style, props.style, 1)) {
836
- (0, import_core5._removeStyles)(el, oldProps.style);
837
- (0, import_core5._applyStyles)(el, props.style);
838
- }
1603
+ this.placement = props.placement ?? this.placement;
1604
+ super.setProps(props);
1605
+ }
1606
+ getContainer() {
1607
+ return this.props.container || this.deck?.getCanvas()?.parentElement;
1608
+ }
1609
+ onFullscreenChange() {
1610
+ const prevFullscreen = this.fullscreen;
1611
+ const fullscreen = document.fullscreenElement === this.getContainer();
1612
+ if (prevFullscreen !== fullscreen) {
1613
+ this.fullscreen = !this.fullscreen;
839
1614
  }
840
- Object.assign(this.props, props);
841
- this.onRenderHTML();
1615
+ this.updateHTML();
842
1616
  }
843
- _createRootElement(props) {
844
- const { widgetClassName, className, style } = props;
845
- const element = document.createElement("div");
846
- ["deck-widget", widgetClassName, className].filter((cls) => typeof cls === "string" && cls.length > 0).forEach((className2) => element.classList.add(className2));
847
- (0, import_core5._applyStyles)(element, style);
848
- return element;
1617
+ async handleClick() {
1618
+ if (this.fullscreen) {
1619
+ await this.exitFullscreen();
1620
+ } else {
1621
+ await this.requestFullscreen();
1622
+ }
1623
+ this.updateHTML();
1624
+ }
1625
+ async requestFullscreen() {
1626
+ const container = this.getContainer();
1627
+ if (container?.requestFullscreen) {
1628
+ await container.requestFullscreen({ navigationUI: "hide" });
1629
+ } else {
1630
+ this.togglePseudoFullscreen();
1631
+ }
1632
+ }
1633
+ async exitFullscreen() {
1634
+ if (document.exitFullscreen) {
1635
+ await document.exitFullscreen();
1636
+ } else {
1637
+ this.togglePseudoFullscreen();
1638
+ }
1639
+ }
1640
+ togglePseudoFullscreen() {
1641
+ this.getContainer()?.classList.toggle("deck-pseudo-fullscreen");
849
1642
  }
850
1643
  };
851
- WidgetImpl.defaultProps = {
852
- id: "widget",
853
- style: {},
854
- className: ""
1644
+ var FullscreenWidget = _FullscreenWidget;
1645
+ FullscreenWidget.defaultProps = {
1646
+ ...import_core9.Widget.defaultProps,
1647
+ id: "fullscreen",
1648
+ placement: "top-left",
1649
+ enterLabel: "Enter Fullscreen",
1650
+ exitLabel: "Exit Fullscreen",
1651
+ container: void 0
855
1652
  };
856
1653
 
857
1654
  // src/screenshot-widget.tsx
858
- var _ScreenshotWidget = class extends WidgetImpl {
1655
+ var import_core10 = __toESM(require_core(), 1);
1656
+ var _ScreenshotWidget = class extends import_core10.Widget {
859
1657
  constructor(props = {}) {
860
- super({ ..._ScreenshotWidget.defaultProps, ...props });
1658
+ super(props, _ScreenshotWidget.defaultProps);
861
1659
  this.className = "deck-widget-screenshot";
862
1660
  this.placement = "top-left";
863
1661
  this.placement = props.placement ?? this.placement;
@@ -866,10 +1664,7 @@ var __exports__ = (() => {
866
1664
  this.placement = props.placement ?? this.placement;
867
1665
  super.setProps(props);
868
1666
  }
869
- onRenderHTML() {
870
- const element = this.element;
871
- if (!element)
872
- return;
1667
+ onRenderHTML(rootElement) {
873
1668
  B(
874
1669
  /* @__PURE__ */ u2(
875
1670
  IconButton,
@@ -879,7 +1674,7 @@ var __exports__ = (() => {
879
1674
  onClick: this.handleClick.bind(this)
880
1675
  }
881
1676
  ),
882
- element
1677
+ rootElement
883
1678
  );
884
1679
  }
885
1680
  handleClick() {
@@ -907,7 +1702,7 @@ var __exports__ = (() => {
907
1702
  };
908
1703
  var ScreenshotWidget = _ScreenshotWidget;
909
1704
  ScreenshotWidget.defaultProps = {
910
- ...WidgetImpl.defaultProps,
1705
+ ...import_core10.Widget.defaultProps,
911
1706
  id: "screenshot",
912
1707
  placement: "top-left",
913
1708
  label: "Screenshot",
@@ -916,61 +1711,109 @@ var __exports__ = (() => {
916
1711
  onCapture: void 0
917
1712
  };
918
1713
 
919
- // src/reset-view-widget.tsx
920
- var _ResetViewWidget = class extends WidgetImpl {
1714
+ // src/loading-widget.tsx
1715
+ var import_core11 = __toESM(require_core(), 1);
1716
+ var _LoadingWidget = class extends import_core11.Widget {
921
1717
  constructor(props = {}) {
922
- super({ ..._ResetViewWidget.defaultProps, ...props });
923
- this.className = "deck-widget-reset-view";
1718
+ super(props, _LoadingWidget.defaultProps);
1719
+ this.className = "deck-widget-loading";
924
1720
  this.placement = "top-left";
1721
+ this.loading = true;
925
1722
  this.placement = props.placement ?? this.placement;
926
1723
  }
927
1724
  setProps(props) {
928
1725
  this.placement = props.placement ?? this.placement;
929
1726
  super.setProps(props);
930
1727
  }
931
- onRenderHTML() {
932
- const element = this.element;
933
- if (!element)
934
- return;
1728
+ onRenderHTML(rootElement) {
935
1729
  B(
936
- /* @__PURE__ */ u2(
1730
+ // TODO(ibgreen) - this should not be a button, but styling is so nested that it is easier to reuse this component.
1731
+ this.loading && /* @__PURE__ */ u2(
937
1732
  IconButton,
938
1733
  {
939
- className: "deck-widget-reset-focus",
1734
+ className: "deck-widget-spinner-icon",
940
1735
  label: this.props.label,
941
1736
  onClick: this.handleClick.bind(this)
942
1737
  }
943
1738
  ),
944
- element
1739
+ rootElement
945
1740
  );
946
1741
  }
947
- handleClick() {
948
- const initialViewState = this.props.initialViewState || this.deck?.props.initialViewState;
949
- this.setViewState(initialViewState);
1742
+ onRedraw({ layers }) {
1743
+ const loading = !layers.some((layer) => !layer.isLoaded);
1744
+ if (loading !== this.loading) {
1745
+ this.loading = loading;
1746
+ this.updateHTML();
1747
+ }
950
1748
  }
951
- setViewState(viewState) {
952
- const viewId = this.props.viewId || viewState?.id || "default-view";
953
- const nextViewState = {
954
- ...viewState
955
- // only works for geospatial?
956
- // transitionDuration: this.props.transitionDuration,
957
- // transitionInterpolator: new FlyToInterpolator()
958
- };
959
- this.deck._onViewStateChange({ viewId, viewState: nextViewState, interactionState: {} });
1749
+ // TODO(ibgreen) - this should not be a button, see above.
1750
+ handleClick() {
960
1751
  }
961
1752
  };
962
- var ResetViewWidget = _ResetViewWidget;
963
- ResetViewWidget.defaultProps = {
964
- ...WidgetImpl.defaultProps,
965
- id: "reset-view",
1753
+ var LoadingWidget = _LoadingWidget;
1754
+ LoadingWidget.defaultProps = {
1755
+ ...import_core11.Widget.defaultProps,
1756
+ id: "loading",
966
1757
  placement: "top-left",
967
- label: "Reset View",
968
- initialViewState: void 0,
969
- viewId: void 0
1758
+ label: "Loading layer data"
1759
+ };
1760
+
1761
+ // src/fps-widget.tsx
1762
+ var import_core12 = __toESM(require_core(), 1);
1763
+ var _FpsWidget = class extends import_core12.Widget {
1764
+ constructor(props = {}) {
1765
+ super(props, _FpsWidget.defaultProps);
1766
+ this.className = "deck-widget-fps";
1767
+ this.placement = "top-left";
1768
+ this._lastFps = -1;
1769
+ this.placement = props.placement ?? this.placement;
1770
+ }
1771
+ setProps(props) {
1772
+ if (props.placement) {
1773
+ this.placement = props.placement;
1774
+ }
1775
+ super.setProps(props);
1776
+ }
1777
+ onRenderHTML(rootElement) {
1778
+ const fps = this._getFps();
1779
+ rootElement.innerText = `FPS:
1780
+ ${fps}`;
1781
+ rootElement.style.backgroundColor = "white";
1782
+ rootElement.style.fontFamily = "monospace";
1783
+ rootElement.style.fontSize = "8px";
1784
+ rootElement.style.fontWeight = "700";
1785
+ }
1786
+ onRedraw({}) {
1787
+ const fps = this._getFps();
1788
+ if (fps !== this._lastFps) {
1789
+ this._lastFps = fps;
1790
+ this.updateHTML();
1791
+ }
1792
+ }
1793
+ onAdd({}) {
1794
+ this._lastFps = this._getFps();
1795
+ this.updateHTML();
1796
+ }
1797
+ _getFps() {
1798
+ return Math.round(this.deck.metrics.fps ?? 0);
1799
+ }
970
1800
  };
1801
+ var FpsWidget = _FpsWidget;
1802
+ FpsWidget.defaultProps = {
1803
+ ...import_core12.Widget.defaultProps,
1804
+ id: "fps",
1805
+ placement: "top-left"
1806
+ };
1807
+
1808
+ // src/theme-widget.tsx
1809
+ var import_core13 = __toESM(require_core(), 1);
1810
+ var import_core14 = __toESM(require_core(), 1);
971
1811
 
972
1812
  // src/themes.ts
973
1813
  var LightTheme = {
1814
+ "--widget-margin": "12px",
1815
+ "--button-size": "28px",
1816
+ "--button-corner-radius": "8px",
974
1817
  "--button-background": "#fff",
975
1818
  "--button-stroke": "rgba(255, 255, 255, 0.3)",
976
1819
  "--button-inner-stroke": "unset",
@@ -978,10 +1821,13 @@ var __exports__ = (() => {
978
1821
  "--button-backdrop-filter": "unset",
979
1822
  "--button-icon-idle": "rgba(97, 97, 102, 1)",
980
1823
  "--button-icon-hover": "rgba(24, 24, 26, 1)",
981
- "--icon-compass-north-color": "#F05C44",
982
- "--icon-compass-south-color": "#C2C2CC"
1824
+ "--icon-compass-north-color": "rgb(240, 92, 68)",
1825
+ "--icon-compass-south-color": "rgb(204, 204, 204)"
983
1826
  };
984
1827
  var DarkTheme = {
1828
+ "--widget-margin": "12px",
1829
+ "--button-size": "28px",
1830
+ "--button-corner-radius": "8px",
985
1831
  "--button-background": "rgba(18, 18, 20, 1)",
986
1832
  "--button-stroke": "rgba(18, 18, 20, 0.30)",
987
1833
  "--button-inner-stroke": "unset",
@@ -989,10 +1835,13 @@ var __exports__ = (() => {
989
1835
  "--button-backdrop-filter": "unset",
990
1836
  "--button-icon-idle": "rgba(158, 157, 168, 1)",
991
1837
  "--button-icon-hover": "rgba(215, 214, 229, 1)",
992
- "--icon-compass-north-color": "#F05C44",
993
- "--icon-compass-south-color": "#C2C2CC"
1838
+ "--icon-compass-north-color": "rgb(240, 92, 68)",
1839
+ "--icon-compass-south-color": "rgb(200, 199, 209)"
994
1840
  };
995
1841
  var LightGlassTheme = {
1842
+ "--widget-margin": "12px",
1843
+ "--button-size": "28px",
1844
+ "--button-corner-radius": "8px",
996
1845
  "--button-background": "rgba(255, 255, 255, 0.6)",
997
1846
  "--button-stroke": "rgba(255, 255, 255, 0.3)",
998
1847
  "--button-inner-stroke": "1px solid rgba(255, 255, 255, 0.6)",
@@ -1000,10 +1849,13 @@ var __exports__ = (() => {
1000
1849
  "--button-backdrop-filter": "blur(4px)",
1001
1850
  "--button-icon-idle": "rgba(97, 97, 102, 1)",
1002
1851
  "--button-icon-hover": "rgba(24, 24, 26, 1)",
1003
- "--icon-compass-north-color": "#F05C44",
1004
- "--icon-compass-south-color": "#C2C2CC"
1852
+ "--icon-compass-north-color": "rgb(240, 92, 68)",
1853
+ "--icon-compass-south-color": "rgb(204, 204, 204)"
1005
1854
  };
1006
1855
  var DarkGlassTheme = {
1856
+ "--widget-margin": "12px",
1857
+ "--button-size": "28px",
1858
+ "--button-corner-radius": "8px",
1007
1859
  "--button-background": "rgba(18, 18, 20, 0.75)",
1008
1860
  "--button-stroke": "rgba(18, 18, 20, 0.30)",
1009
1861
  "--button-inner-stroke": "1px solid rgba(18, 18, 20, 0.75)",
@@ -1011,9 +1863,847 @@ var __exports__ = (() => {
1011
1863
  "--button-backdrop-filter": "blur(4px)",
1012
1864
  "--button-icon-idle": "rgba(158, 157, 168, 1)",
1013
1865
  "--button-icon-hover": "rgba(215, 214, 229, 1)",
1014
- "--icon-compass-north-color": "#F05C44",
1015
- "--icon-compass-south-color": "#C2C2CC"
1866
+ "--icon-compass-north-color": "rgb(240, 92, 68)",
1867
+ "--icon-compass-south-color": "rgb(200, 199, 209)"
1868
+ };
1869
+
1870
+ // src/theme-widget.tsx
1871
+ var _ThemeWidget = class extends import_core14.Widget {
1872
+ constructor(props = {}) {
1873
+ super(props, _ThemeWidget.defaultProps);
1874
+ this.className = "deck-widget-theme";
1875
+ this.placement = "top-left";
1876
+ this.themeMode = "dark";
1877
+ this.placement = props.placement ?? this.placement;
1878
+ this.themeMode = this._getInitialThemeMode();
1879
+ }
1880
+ // eslint-disable-next-line complexity
1881
+ setProps(props) {
1882
+ const { lightModeTheme, darkModeTheme } = this.props;
1883
+ this.placement = props.placement ?? this.placement;
1884
+ super.setProps(props);
1885
+ switch (this.themeMode) {
1886
+ case "light":
1887
+ if (props.lightModeTheme && !(0, import_core13._deepEqual)(props.lightModeTheme, lightModeTheme, 1)) {
1888
+ this._setThemeMode("light");
1889
+ }
1890
+ break;
1891
+ case "dark":
1892
+ if (props.darkModeTheme && !(0, import_core13._deepEqual)(props.darkModeTheme, darkModeTheme, 1)) {
1893
+ this._setThemeMode("dark");
1894
+ }
1895
+ break;
1896
+ }
1897
+ }
1898
+ onRenderHTML(rootElement) {
1899
+ const { lightModeLabel, darkModeLabel } = this.props;
1900
+ B(
1901
+ /* @__PURE__ */ u2(
1902
+ IconButton,
1903
+ {
1904
+ onClick: this._handleClick.bind(this),
1905
+ label: this.themeMode === "dark" ? darkModeLabel : lightModeLabel,
1906
+ className: this.themeMode === "dark" ? "deck-widget-moon" : "deck-widget-sun"
1907
+ }
1908
+ ),
1909
+ rootElement
1910
+ );
1911
+ }
1912
+ onAdd() {
1913
+ this._setThemeMode(this.themeMode);
1914
+ }
1915
+ _handleClick() {
1916
+ const newThemeMode = this.themeMode === "dark" ? "light" : "dark";
1917
+ this._setThemeMode(newThemeMode);
1918
+ }
1919
+ _setThemeMode(themeMode) {
1920
+ this.themeMode = themeMode;
1921
+ const container = this.rootElement?.closest(".deck-widget-container");
1922
+ if (container) {
1923
+ const themeStyle = themeMode === "dark" ? this.props.darkModeTheme : this.props.lightModeTheme;
1924
+ (0, import_core13._applyStyles)(container, themeStyle);
1925
+ const label = this.themeMode === "dark" ? this.props.darkModeLabel : this.props.lightModeLabel;
1926
+ import_core13.log.log(1, `Switched theme to ${label}`, themeStyle);
1927
+ this.updateHTML();
1928
+ }
1929
+ }
1930
+ /** Read browser preference */
1931
+ _getInitialThemeMode() {
1932
+ const { initialThemeMode } = this.props;
1933
+ return initialThemeMode === "auto" ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : initialThemeMode;
1934
+ }
1935
+ };
1936
+ var ThemeWidget = _ThemeWidget;
1937
+ ThemeWidget.defaultProps = {
1938
+ ...import_core14.Widget.defaultProps,
1939
+ id: "theme",
1940
+ placement: "top-left",
1941
+ lightModeLabel: "Light Mode",
1942
+ lightModeTheme: LightGlassTheme,
1943
+ darkModeLabel: "Dark Mode",
1944
+ darkModeTheme: DarkGlassTheme,
1945
+ initialThemeMode: "auto"
1946
+ };
1947
+
1948
+ // src/info-widget.tsx
1949
+ var import_core15 = __toESM(require_core(), 1);
1950
+ var _InfoWidget = class extends import_core15.Widget {
1951
+ constructor(props) {
1952
+ super(props, _InfoWidget.defaultProps);
1953
+ this.className = "deck-widget-info";
1954
+ this.placement = "fill";
1955
+ this.viewId = null;
1956
+ props.position = props.position || [0, 0];
1957
+ props.text = props.text || "";
1958
+ props.visible = props.visible || false;
1959
+ props.minOffset = props.minOffset ?? 0;
1960
+ }
1961
+ setProps(props) {
1962
+ super.setProps(props);
1963
+ }
1964
+ onViewportChange(viewport) {
1965
+ this.viewport = viewport;
1966
+ this.updateHTML();
1967
+ }
1968
+ onHover(info) {
1969
+ if (this.props.mode === "hover" && this.props.getTooltip) {
1970
+ const tooltip = this.props.getTooltip(info, this);
1971
+ this.setProps({
1972
+ visible: tooltip !== null,
1973
+ ...tooltip,
1974
+ style: { zIndex: 1, ...tooltip?.style }
1975
+ });
1976
+ }
1977
+ }
1978
+ onClick(info) {
1979
+ if (this.props.mode === "click" && this.props.getTooltip) {
1980
+ const tooltip = this.props.getTooltip(info, this);
1981
+ this.setProps({
1982
+ visible: tooltip !== null,
1983
+ ...tooltip
1984
+ });
1985
+ return tooltip !== null;
1986
+ }
1987
+ return this.props.onClick?.(this, info) || false;
1988
+ }
1989
+ // TODO - Align with onCreateRootElement
1990
+ onAdd({ deck, viewId }) {
1991
+ const { className } = this.props;
1992
+ const element = document.createElement("div");
1993
+ element.classList.add("deck-widget", "deck-widget-info");
1994
+ if (className)
1995
+ element.classList.add(className);
1996
+ const style = { margin: "0px", top: "0px", left: "0px", position: "absolute" };
1997
+ Object.entries(style).forEach(([key, value]) => element.style.setProperty(key, value));
1998
+ this.deck = deck;
1999
+ if (!viewId) {
2000
+ this.viewport = deck.getViewports()[0];
2001
+ } else {
2002
+ this.viewport = deck.getViewports().find((viewport) => viewport.id === viewId);
2003
+ }
2004
+ this.rootElement = element;
2005
+ this.updateHTML();
2006
+ return element;
2007
+ }
2008
+ onRenderHTML(rootElement) {
2009
+ if (!this.viewport) {
2010
+ return;
2011
+ }
2012
+ const [longitude, latitude] = this.props.position;
2013
+ const [x2, y3] = this.viewport.project([longitude, latitude]);
2014
+ const minOffset = this.props.minOffset || 0;
2015
+ const gap = 10;
2016
+ const arrowHeight = 8;
2017
+ const arrowWidth = 16;
2018
+ const isAbove = y3 > this.viewport.height / 2;
2019
+ const background = this.props.style && this.props.style.background || "rgba(255,255,255,0.9)";
2020
+ const ui = this.props.visible ? /* @__PURE__ */ u2("div", { className: "popup-container", style: { position: "absolute", left: 0, top: 0 }, children: [
2021
+ /* @__PURE__ */ u2(
2022
+ "div",
2023
+ {
2024
+ className: "popup-content",
2025
+ style: {
2026
+ background,
2027
+ padding: "10px",
2028
+ position: "relative",
2029
+ // Include any additional styles
2030
+ ...this.props.style
2031
+ },
2032
+ children: this.props.text
2033
+ }
2034
+ ),
2035
+ /* @__PURE__ */ u2("div", { className: "popup-arrow", style: { position: "absolute", width: "0px", height: "0px" } })
2036
+ ] }) : null;
2037
+ B(ui, rootElement);
2038
+ requestAnimationFrame(() => {
2039
+ if (!this.props.visible || !rootElement.firstChild || !this.viewport)
2040
+ return;
2041
+ const container = rootElement.firstChild;
2042
+ const contentEl = container.querySelector(".popup-content");
2043
+ const arrowEl = container.querySelector(".popup-arrow");
2044
+ if (!contentEl || !arrowEl)
2045
+ return;
2046
+ const contentRect = contentEl.getBoundingClientRect();
2047
+ const popupWidth = contentRect.width;
2048
+ const popupHeight = contentRect.height;
2049
+ let computedLeft = x2 - popupWidth / 2;
2050
+ let computedTop;
2051
+ if (isAbove) {
2052
+ computedTop = y3 - gap - arrowHeight - popupHeight;
2053
+ } else {
2054
+ computedTop = y3 + gap + arrowHeight;
2055
+ }
2056
+ if (computedLeft < minOffset) {
2057
+ computedLeft = minOffset;
2058
+ }
2059
+ if (computedLeft + popupWidth > this.viewport.width - minOffset) {
2060
+ computedLeft = this.viewport.width - minOffset - popupWidth;
2061
+ }
2062
+ if (isAbove) {
2063
+ if (computedTop < minOffset) {
2064
+ computedTop = minOffset;
2065
+ }
2066
+ } else if (computedTop + popupHeight + arrowHeight > this.viewport.height - minOffset) {
2067
+ computedTop = this.viewport.height - minOffset - popupHeight - arrowHeight;
2068
+ }
2069
+ container.style.left = `${computedLeft}px`;
2070
+ container.style.top = `${computedTop}px`;
2071
+ container.style.transform = "";
2072
+ let arrowLeft = x2 - computedLeft - arrowWidth / 2;
2073
+ arrowLeft = Math.max(arrowLeft, 0);
2074
+ arrowLeft = Math.min(arrowLeft, popupWidth - arrowWidth);
2075
+ if (isAbove) {
2076
+ arrowEl.style.left = `${arrowLeft}px`;
2077
+ arrowEl.style.bottom = `-${arrowHeight}px`;
2078
+ arrowEl.style.top = "";
2079
+ arrowEl.style.borderLeft = `${arrowWidth / 2}px solid transparent`;
2080
+ arrowEl.style.borderRight = `${arrowWidth / 2}px solid transparent`;
2081
+ arrowEl.style.borderTop = `${arrowHeight}px solid ${background}`;
2082
+ arrowEl.style.borderBottom = "";
2083
+ } else {
2084
+ arrowEl.style.left = `${arrowLeft}px`;
2085
+ arrowEl.style.top = `-${arrowHeight}px`;
2086
+ arrowEl.style.bottom = "";
2087
+ arrowEl.style.borderLeft = `${arrowWidth / 2}px solid transparent`;
2088
+ arrowEl.style.borderRight = `${arrowWidth / 2}px solid transparent`;
2089
+ arrowEl.style.borderBottom = `${arrowHeight}px solid ${background}`;
2090
+ arrowEl.style.borderTop = "";
2091
+ }
2092
+ });
2093
+ }
2094
+ };
2095
+ var InfoWidget = _InfoWidget;
2096
+ InfoWidget.defaultProps = {
2097
+ ...import_core15.Widget.defaultProps,
2098
+ position: [0, 0],
2099
+ text: "",
2100
+ visible: false,
2101
+ // Set default minOffset if not provided
2102
+ minOffset: 0,
2103
+ viewId: null,
2104
+ mode: "hover",
2105
+ getTooltip: void 0,
2106
+ onClick: void 0
2107
+ };
2108
+
2109
+ // src/stats-widget.tsx
2110
+ var import_core16 = __toESM(require_core(), 1);
2111
+ var import_core17 = __toESM(require_core2(), 1);
2112
+ var RIGHT_ARROW = "\u25B6";
2113
+ var DOWN_ARROW = "\u2B07";
2114
+ var DEFAULT_COUNT_FORMATTER = (stat) => `${stat.name}: ${stat.count}`;
2115
+ function formatTime(time) {
2116
+ return time < 1e3 ? `${time.toFixed(2)}ms` : `${(time / 1e3).toFixed(2)}s`;
2117
+ }
2118
+ function formatMemory(bytes) {
2119
+ const mb = bytes / 1e6;
2120
+ return `${mb.toFixed(1)} MB`;
2121
+ }
2122
+ var DEFAULT_FORMATTERS = {
2123
+ count: DEFAULT_COUNT_FORMATTER,
2124
+ averageTime: (stat) => `${stat.name}: ${formatTime(stat.getAverageTime())}`,
2125
+ totalTime: (stat) => `${stat.name}: ${formatTime(stat.time)}`,
2126
+ fps: (stat) => `${stat.name}: ${Math.round(stat.getHz())}fps`,
2127
+ memory: (stat) => `${stat.name}: ${formatMemory(stat.count)}`
2128
+ };
2129
+ var _StatsWidget = class extends import_core16.Widget {
2130
+ constructor(props = {}) {
2131
+ super(props, _StatsWidget.defaultProps);
2132
+ this.className = "deck-widget-stats";
2133
+ this.placement = "top-left";
2134
+ this._counter = 0;
2135
+ this.collapsed = true;
2136
+ this._toggleCollapsed = () => {
2137
+ this.collapsed = !this.collapsed;
2138
+ this.updateHTML();
2139
+ };
2140
+ this._formatters = { ...DEFAULT_FORMATTERS };
2141
+ this.setProps(props);
2142
+ this._resetOnUpdate = { ...this.props.resetOnUpdate };
2143
+ this._stats = this.props.stats;
2144
+ }
2145
+ setProps(props) {
2146
+ super.setProps(props);
2147
+ this._stats = this._getStats();
2148
+ if (props.formatters) {
2149
+ for (const name in props.formatters) {
2150
+ const f4 = props.formatters[name];
2151
+ this._formatters[name] = typeof f4 === "string" ? DEFAULT_FORMATTERS[f4] || DEFAULT_COUNT_FORMATTER : f4;
2152
+ }
2153
+ }
2154
+ if (props.resetOnUpdate) {
2155
+ this._resetOnUpdate = { ...props.resetOnUpdate };
2156
+ }
2157
+ }
2158
+ onAdd() {
2159
+ this._stats = this._getStats();
2160
+ this.updateHTML();
2161
+ }
2162
+ onRenderHTML(rootElement) {
2163
+ const stats = this._stats;
2164
+ const collapsed = this.collapsed;
2165
+ const title = this.props.title || stats?.id || "Stats";
2166
+ const items = [];
2167
+ if (!collapsed && stats) {
2168
+ stats.forEach((stat) => {
2169
+ const lines = this._getLines(stat);
2170
+ if (this._resetOnUpdate && this._resetOnUpdate[stat.name]) {
2171
+ stat.reset();
2172
+ }
2173
+ lines.forEach((line, i4) => {
2174
+ items.push(
2175
+ /* @__PURE__ */ u2("div", { style: { whiteSpace: "pre" }, children: line }, `${stat.name}-${i4}`)
2176
+ );
2177
+ });
2178
+ });
2179
+ }
2180
+ B(
2181
+ /* @__PURE__ */ u2("div", { className: "deck-widget-stats-container", style: { cursor: "default" }, children: [
2182
+ /* @__PURE__ */ u2(
2183
+ "div",
2184
+ {
2185
+ className: "deck-widget-stats-header",
2186
+ style: { cursor: "pointer", pointerEvents: "auto" },
2187
+ onClick: this._toggleCollapsed,
2188
+ children: [
2189
+ collapsed ? RIGHT_ARROW : DOWN_ARROW,
2190
+ " ",
2191
+ title
2192
+ ]
2193
+ }
2194
+ ),
2195
+ !collapsed && /* @__PURE__ */ u2("div", { className: "deck-widget-stats-content deck-widget-common", children: items })
2196
+ ] }),
2197
+ rootElement
2198
+ );
2199
+ }
2200
+ onRedraw() {
2201
+ const framesPerUpdate = Math.max(1, this.props.framesPerUpdate || 1);
2202
+ if (this._counter++ % framesPerUpdate === 0) {
2203
+ console.log("Redrawing stats widget");
2204
+ this.updateHTML();
2205
+ }
2206
+ }
2207
+ _getStats() {
2208
+ switch (this.props.type) {
2209
+ case "deck":
2210
+ return this.deck?.stats;
2211
+ case "luma":
2212
+ return Array.from(import_core17.luma.stats.stats.values())[0];
2213
+ case "device":
2214
+ const device = this.deck?.device;
2215
+ const stats = device?.statsManager.stats.values();
2216
+ return stats ? Array.from(stats)[0] : void 0;
2217
+ case "custom":
2218
+ return this.props.stats;
2219
+ default:
2220
+ throw new Error(`Unknown stats type: ${this.props.type}`);
2221
+ }
2222
+ }
2223
+ _getLines(stat) {
2224
+ const formatter = this._formatters[stat.name] || this._formatters[stat.type || ""] || DEFAULT_COUNT_FORMATTER;
2225
+ return formatter(stat).split("\n");
2226
+ }
2227
+ };
2228
+ var StatsWidget = _StatsWidget;
2229
+ StatsWidget.defaultProps = {
2230
+ ...import_core16.Widget.defaultProps,
2231
+ type: "deck",
2232
+ stats: void 0,
2233
+ title: "Stats",
2234
+ framesPerUpdate: 1,
2235
+ formatters: {},
2236
+ resetOnUpdate: {},
2237
+ id: "stats"
2238
+ };
2239
+
2240
+ // src/context-menu-widget.tsx
2241
+ var import_core18 = __toESM(require_core(), 1);
2242
+
2243
+ // src/lib/components/simple-menu.tsx
2244
+ var MENU_STYLE = {
2245
+ position: "absolute",
2246
+ top: "100%",
2247
+ left: 0,
2248
+ background: "white",
2249
+ border: "1px solid #ccc",
2250
+ borderRadius: "4px",
2251
+ marginTop: "4px",
2252
+ zIndex: 100
2253
+ };
2254
+ var MENU_ITEM_STYLE = {
2255
+ background: "white",
2256
+ border: "none",
2257
+ padding: "4px",
2258
+ cursor: "pointer",
2259
+ pointerEvents: "auto"
2260
+ };
2261
+ var SimpleMenu = (props) => {
2262
+ const { menuItems, onItemSelected, position, style } = props;
2263
+ const styleOverride = {
2264
+ ...MENU_STYLE,
2265
+ ...style,
2266
+ left: `${position.x}px`,
2267
+ top: `${position.y}px`
2268
+ };
2269
+ return /* @__PURE__ */ u2("div", { style: styleOverride, children: menuItems.map(({ key, label }) => /* @__PURE__ */ u2(
2270
+ "button",
2271
+ {
2272
+ style: { ...MENU_ITEM_STYLE, display: "block" },
2273
+ onClick: (_2) => onItemSelected(key),
2274
+ children: label
2275
+ },
2276
+ key
2277
+ )) });
2278
+ };
2279
+
2280
+ // src/context-menu-widget.tsx
2281
+ var MOUSE_BUTTON_RIGHT = 2;
2282
+ var MOUSE_WHICH_RIGHT = 3;
2283
+ var _ContextMenuWidget = class extends import_core18.Widget {
2284
+ constructor(props) {
2285
+ super(props, _ContextMenuWidget.defaultProps);
2286
+ this.className = "deck-widget-context-menu";
2287
+ this.placement = "fill";
2288
+ this.pickInfo = null;
2289
+ this.pickInfo = null;
2290
+ this.setProps(props);
2291
+ }
2292
+ onAdd({ deck }) {
2293
+ const element = document.createElement("div");
2294
+ element.classList.add("deck-widget", "deck-widget-context-menu");
2295
+ const style = {
2296
+ margin: "0px",
2297
+ top: "0px",
2298
+ left: "0px",
2299
+ position: "absolute",
2300
+ pointerEvents: "auto"
2301
+ };
2302
+ Object.entries(style).forEach(([key, value]) => element.style.setProperty(key, value));
2303
+ deck.getCanvas()?.addEventListener("click", () => this.hide());
2304
+ deck.getCanvas()?.addEventListener("contextmenu", (event) => this.handleContextMenu(event));
2305
+ return element;
2306
+ }
2307
+ onRenderHTML(rootElement) {
2308
+ const { visible, position, menuItems } = this.props;
2309
+ const ui = visible && menuItems.length ? /* @__PURE__ */ u2(
2310
+ SimpleMenu,
2311
+ {
2312
+ menuItems,
2313
+ onItemSelected: (key) => this.props.onMenuItemSelected(key, this.pickInfo),
2314
+ position,
2315
+ style: { pointerEvents: "auto" }
2316
+ }
2317
+ ) : null;
2318
+ B(ui, rootElement);
2319
+ }
2320
+ handleContextMenu(srcEvent) {
2321
+ if (srcEvent && (srcEvent.button === MOUSE_BUTTON_RIGHT || srcEvent.which === MOUSE_WHICH_RIGHT)) {
2322
+ this.pickInfo = this.deck?.pickObject({
2323
+ x: srcEvent.clientX,
2324
+ y: srcEvent.clientY
2325
+ }) || null;
2326
+ const menuItems = this.pickInfo && this.props.getMenuItems?.(this.pickInfo, this) || [];
2327
+ const visible = menuItems.length > 0;
2328
+ this.setProps({
2329
+ visible,
2330
+ position: { x: srcEvent.clientX, y: srcEvent.clientY },
2331
+ menuItems
2332
+ });
2333
+ this.updateHTML();
2334
+ srcEvent.preventDefault();
2335
+ return visible;
2336
+ }
2337
+ return false;
2338
+ }
2339
+ hide() {
2340
+ this.setProps({ visible: false });
2341
+ }
2342
+ };
2343
+ var ContextMenuWidget = _ContextMenuWidget;
2344
+ ContextMenuWidget.defaultProps = {
2345
+ ...import_core18.Widget.defaultProps,
2346
+ viewId: null,
2347
+ visible: false,
2348
+ position: { x: 0, y: 0 },
2349
+ getMenuItems: void 0,
2350
+ menuItems: [],
2351
+ // eslint-disable-next-line no-console
2352
+ onMenuItemSelected: (key, pickInfo) => console.log("Context menu item selected:", key, pickInfo)
2353
+ };
2354
+
2355
+ // src/splitter-widget.tsx
2356
+ var import_core19 = __toESM(require_core(), 1);
2357
+ var _SplitterWidget = class extends import_core19.Widget {
2358
+ constructor(props) {
2359
+ super(props, _SplitterWidget.defaultProps);
2360
+ this.className = "deck-widget-splitter";
2361
+ this.placement = "fill";
2362
+ }
2363
+ setProps(props) {
2364
+ super.setProps(props);
2365
+ }
2366
+ onRenderHTML(rootElement) {
2367
+ rootElement.style.position = "absolute";
2368
+ rootElement.style.top = "0";
2369
+ rootElement.style.left = "0";
2370
+ rootElement.style.width = "100%";
2371
+ rootElement.style.height = "100%";
2372
+ rootElement.style.margin = "0px";
2373
+ B(
2374
+ /* @__PURE__ */ u2(
2375
+ Splitter,
2376
+ {
2377
+ orientation: this.props.orientation,
2378
+ initialSplit: this.props.initialSplit,
2379
+ onChange: this.props.onChange,
2380
+ onDragStart: this.props.onDragStart,
2381
+ onDragEnd: this.props.onDragEnd
2382
+ }
2383
+ ),
2384
+ rootElement
2385
+ );
2386
+ }
2387
+ };
2388
+ var SplitterWidget = _SplitterWidget;
2389
+ SplitterWidget.defaultProps = {
2390
+ ...import_core19.Widget.defaultProps,
2391
+ id: "splitter-widget",
2392
+ viewId1: "",
2393
+ viewId2: "",
2394
+ orientation: "vertical",
2395
+ initialSplit: 0.5,
2396
+ onChange: () => {
2397
+ },
2398
+ onDragStart: () => {
2399
+ },
2400
+ onDragEnd: () => {
2401
+ }
2402
+ };
2403
+ function Splitter({
2404
+ orientation,
2405
+ initialSplit,
2406
+ onChange,
2407
+ onDragStart,
2408
+ onDragEnd
2409
+ }) {
2410
+ const [split, setSplit] = h2(initialSplit);
2411
+ const dragging = A2(false);
2412
+ const containerRef = A2(null);
2413
+ const handleDragStart = (event) => {
2414
+ dragging.current = true;
2415
+ onDragStart?.();
2416
+ document.addEventListener("mousemove", handleDragging);
2417
+ document.addEventListener("mouseup", handleDragEnd);
2418
+ event.preventDefault();
2419
+ };
2420
+ const handleDragging = (event) => {
2421
+ if (!dragging.current || !containerRef.current)
2422
+ return;
2423
+ const rect = containerRef.current.getBoundingClientRect();
2424
+ let newSplit;
2425
+ if (orientation === "vertical") {
2426
+ newSplit = (event.clientX - rect.left) / rect.width;
2427
+ } else {
2428
+ newSplit = (event.clientY - rect.top) / rect.height;
2429
+ }
2430
+ newSplit = Math.min(Math.max(newSplit, 0.05), 0.95);
2431
+ setSplit(newSplit);
2432
+ onChange?.(newSplit);
2433
+ };
2434
+ const handleDragEnd = (event) => {
2435
+ if (!dragging.current)
2436
+ return;
2437
+ dragging.current = false;
2438
+ onDragEnd?.();
2439
+ document.removeEventListener("mousemove", handleDragging);
2440
+ document.removeEventListener("mouseup", handleDragEnd);
2441
+ };
2442
+ const splitterStyle = orientation === "vertical" ? {
2443
+ position: "absolute",
2444
+ top: 0,
2445
+ bottom: 0,
2446
+ left: `${split * 100}%`,
2447
+ width: "4px",
2448
+ cursor: "col-resize",
2449
+ background: "#ccc",
2450
+ zIndex: 10,
2451
+ pointerEvents: "auto",
2452
+ boxShadow: "inset -1px 0 0 white, inset 1px 0 0 white"
2453
+ } : {
2454
+ position: "absolute",
2455
+ left: 0,
2456
+ right: 0,
2457
+ top: `${split * 100}%`,
2458
+ height: "4px",
2459
+ cursor: "row-resize",
2460
+ background: "#ccc",
2461
+ zIndex: 10,
2462
+ pointerEvents: "auto",
2463
+ boxShadow: "inset -1px 0 0 white, inset 1px 0 0 white"
2464
+ };
2465
+ const containerStyle = {
2466
+ position: "absolute",
2467
+ top: 0,
2468
+ left: 0,
2469
+ right: 0,
2470
+ bottom: 0
2471
+ };
2472
+ return /* @__PURE__ */ u2("div", { ref: containerRef, style: containerStyle, children: /* @__PURE__ */ u2(
2473
+ "div",
2474
+ {
2475
+ style: splitterStyle,
2476
+ onMouseDown: handleDragStart
2477
+ }
2478
+ ) });
2479
+ }
2480
+
2481
+ // src/timeline-widget.tsx
2482
+ var import_core20 = __toESM(require_core(), 1);
2483
+ var _TimelineWidget = class extends import_core20.Widget {
2484
+ constructor(props = {}) {
2485
+ super(props, _TimelineWidget.defaultProps);
2486
+ this.id = "timeline";
2487
+ this.className = "deck-widget-timeline";
2488
+ this.placement = "bottom-left";
2489
+ this.playing = false;
2490
+ this.timerId = null;
2491
+ this.handlePlayPause = () => {
2492
+ if (this.playing) {
2493
+ this.stop();
2494
+ } else {
2495
+ this.start();
2496
+ }
2497
+ };
2498
+ this.handleSliderChange = (e3) => {
2499
+ const input = e3.target;
2500
+ const val = Number(input.value);
2501
+ this.currentTime = val;
2502
+ this.props.onTimeChange(val);
2503
+ this.updateHTML();
2504
+ };
2505
+ this.tick = () => {
2506
+ const [min, max] = this.props.timeRange;
2507
+ let next = this.currentTime + this.props.step;
2508
+ if (next > max) {
2509
+ next = min;
2510
+ }
2511
+ this.currentTime = next;
2512
+ this.props.onTimeChange(next);
2513
+ this.updateHTML();
2514
+ if (this.playing) {
2515
+ this.timerId = window.setTimeout(this.tick, this.props.playInterval);
2516
+ }
2517
+ };
2518
+ this.currentTime = this.props.initialTime ?? this.props.timeRange[0];
2519
+ }
2520
+ setProps(props) {
2521
+ this.placement = props.placement || this.placement;
2522
+ super.setProps(props);
2523
+ }
2524
+ onAdd() {
2525
+ this.playing = false;
2526
+ this.timerId = null;
2527
+ }
2528
+ onRemove() {
2529
+ this.stop();
2530
+ }
2531
+ onRenderHTML(rootElement) {
2532
+ B(
2533
+ /* @__PURE__ */ u2("div", { style: { display: "flex", alignItems: "center", pointerEvents: "auto" }, children: [
2534
+ /* @__PURE__ */ u2(
2535
+ "button",
2536
+ {
2537
+ type: "button",
2538
+ className: "timeline-play-pause",
2539
+ title: this.playing ? "Pause" : "Play",
2540
+ onClick: this.handlePlayPause,
2541
+ children: this.playing ? "\u23F8" : "\u25B6"
2542
+ }
2543
+ ),
2544
+ /* @__PURE__ */ u2(
2545
+ "input",
2546
+ {
2547
+ type: "range",
2548
+ className: "timeline-slider",
2549
+ min: this.props.timeRange[0],
2550
+ max: this.props.timeRange[1],
2551
+ step: this.props.step,
2552
+ value: this.currentTime,
2553
+ onInput: this.handleSliderChange
2554
+ }
2555
+ )
2556
+ ] }),
2557
+ rootElement
2558
+ );
2559
+ }
2560
+ start() {
2561
+ this.playing = true;
2562
+ this.updateHTML();
2563
+ this.tick();
2564
+ }
2565
+ stop() {
2566
+ this.playing = false;
2567
+ if (this.timerId !== null) {
2568
+ window.clearTimeout(this.timerId);
2569
+ this.timerId = null;
2570
+ }
2571
+ this.updateHTML();
2572
+ }
2573
+ };
2574
+ var TimelineWidget = _TimelineWidget;
2575
+ TimelineWidget.defaultProps = {
2576
+ ...import_core20.Widget.defaultProps,
2577
+ id: "timeline",
2578
+ placement: "bottom-left",
2579
+ timeRange: [0, 100],
2580
+ step: 1,
2581
+ initialTime: void 0,
2582
+ onTimeChange: () => {
2583
+ },
2584
+ playInterval: 1e3
2585
+ };
2586
+
2587
+ // src/view-selector-widget.tsx
2588
+ var import_core21 = __toESM(require_core(), 1);
2589
+
2590
+ // src/lib/components/icon-menu.tsx
2591
+ var MENU_STYLE2 = {
2592
+ position: "absolute",
2593
+ top: "100%",
2594
+ left: 0,
2595
+ background: "white",
2596
+ border: "1px solid #ccc",
2597
+ borderRadius: "4px",
2598
+ marginTop: "4px",
2599
+ zIndex: 100
2600
+ };
2601
+ var MENU_ITEM_STYLE2 = {
2602
+ background: "white",
2603
+ border: "none",
2604
+ padding: "4px",
2605
+ cursor: "pointer",
2606
+ pointerEvents: "auto"
2607
+ };
2608
+ function IconMenu(props) {
2609
+ const [menuOpen, setMenuOpen] = h2(false);
2610
+ const containerRef = A2(null);
2611
+ const handleClickOutside = (event) => {
2612
+ if (containerRef.current && !containerRef.current.contains(event.target)) {
2613
+ setMenuOpen(false);
2614
+ }
2615
+ };
2616
+ y2(() => {
2617
+ document.addEventListener("mousedown", handleClickOutside);
2618
+ return () => {
2619
+ document.removeEventListener("mousedown", handleClickOutside);
2620
+ };
2621
+ }, [containerRef]);
2622
+ const [selectedItem, setSelectedItem] = h2(props.initialItem);
2623
+ const handleSelectItem = (item) => {
2624
+ setSelectedItem(item);
2625
+ setMenuOpen(false);
2626
+ props.onItemSelected(item);
2627
+ };
2628
+ const handleButtonClick = () => setMenuOpen(!menuOpen);
2629
+ const selectedMenuItem = props.menuItems.find((item) => item.value === selectedItem);
2630
+ const label = props.label || selectedMenuItem?.label || "";
2631
+ const Icon = props.icon || selectedMenuItem?.icon;
2632
+ return /* @__PURE__ */ u2("div", { style: { position: "relative", display: "inline-block" }, ref: containerRef, children: [
2633
+ /* @__PURE__ */ u2(IconButton, { className: props.className, label, onClick: handleButtonClick, children: /* @__PURE__ */ u2(Icon, {}) }),
2634
+ menuOpen && /* @__PURE__ */ u2("div", { style: MENU_STYLE2, children: /* @__PURE__ */ u2("div", { style: { display: "flex", flexDirection: "column" }, children: props.menuItems.map((item) => /* @__PURE__ */ u2(
2635
+ "button",
2636
+ {
2637
+ style: MENU_ITEM_STYLE2,
2638
+ title: item.label,
2639
+ onClick: () => handleSelectItem(item.value),
2640
+ children: item.icon
2641
+ },
2642
+ item.value
2643
+ )) }) })
2644
+ ] });
2645
+ }
2646
+
2647
+ // src/view-selector-widget.tsx
2648
+ var _ViewSelectorWidget = class extends import_core21.Widget {
2649
+ constructor(props = {}) {
2650
+ super(props, _ViewSelectorWidget.defaultProps);
2651
+ this.className = "deck-widget-view-selector";
2652
+ this.placement = "top-left";
2653
+ this.handleSelectMode = (viewMode) => {
2654
+ this.viewMode = viewMode;
2655
+ this.updateHTML();
2656
+ };
2657
+ this.placement = this.props.placement;
2658
+ this.viewMode = this.props.initialViewMode;
2659
+ }
2660
+ setProps(props) {
2661
+ super.setProps(props);
2662
+ this.placement = props.placement ?? this.placement;
2663
+ }
2664
+ onRenderHTML(rootElement) {
2665
+ B(
2666
+ /* @__PURE__ */ u2(
2667
+ IconMenu,
2668
+ {
2669
+ className: "deck-widget-view-selector",
2670
+ menuItems: MENU_ITEMS,
2671
+ initialItem: this.props.initialViewMode,
2672
+ onItemSelected: this.handleSelectMode
2673
+ }
2674
+ ),
2675
+ rootElement
2676
+ );
2677
+ }
2678
+ };
2679
+ var ViewSelectorWidget = _ViewSelectorWidget;
2680
+ ViewSelectorWidget.defaultProps = {
2681
+ ...import_core21.Widget.defaultProps,
2682
+ id: "view-selector-widget",
2683
+ placement: "top-left",
2684
+ label: "Split View",
2685
+ initialViewMode: "single",
2686
+ onViewModeChange: (viewMode) => {
2687
+ console.log(viewMode);
2688
+ }
2689
+ };
2690
+ var ICON_STYLE = { width: "24px", height: "24px" };
2691
+ var ICONS = {
2692
+ single: () => /* @__PURE__ */ u2("svg", { width: "24", height: "24", style: ICON_STYLE, children: /* @__PURE__ */ u2("rect", { x: "4", y: "4", width: "16", height: "16", stroke: "black", fill: "none", strokeWidth: "2" }) }),
2693
+ "split-horizontal": () => /* @__PURE__ */ u2("svg", { width: "24", height: "24", style: ICON_STYLE, children: [
2694
+ /* @__PURE__ */ u2("rect", { x: "4", y: "4", width: "16", height: "7", stroke: "black", fill: "none", strokeWidth: "2" }),
2695
+ /* @__PURE__ */ u2("rect", { x: "4", y: "13", width: "16", height: "7", stroke: "black", fill: "none", strokeWidth: "2" })
2696
+ ] }),
2697
+ "split-vertical": () => /* @__PURE__ */ u2("svg", { width: "24", height: "24", style: ICON_STYLE, children: [
2698
+ /* @__PURE__ */ u2("rect", { x: "4", y: "4", width: "7", height: "16", stroke: "black", fill: "none", strokeWidth: "2" }),
2699
+ /* @__PURE__ */ u2("rect", { x: "13", y: "4", width: "7", height: "16", stroke: "black", fill: "none", strokeWidth: "2" })
2700
+ ] })
1016
2701
  };
2702
+ var MENU_ITEMS = [
2703
+ { value: "single", icon: ICONS.single, label: "Single View" },
2704
+ { value: "split-horizontal", icon: ICONS["split-horizontal"], label: "Split Horizontal" },
2705
+ { value: "split-vertical", icon: ICONS["split-vertical"], label: "Split Vertical" }
2706
+ ];
1017
2707
  return __toCommonJS(bundle_exports);
1018
2708
  })();
1019
2709
  return __exports__;