@asymmetric-effort/specifyjs 0.2.110 → 0.2.113

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 (161) hide show
  1. package/dist/esm/chunks/chunk-2Y3QZBBL.js +221 -0
  2. package/dist/esm/chunks/{chunk-3SXNLMCH.js.map → chunk-2Y3QZBBL.js.map} +2 -2
  3. package/dist/esm/chunks/chunk-5OX5JKEY.js +174 -0
  4. package/dist/esm/chunks/{chunk-VAF4KNDP.js.map → chunk-5OX5JKEY.js.map} +2 -2
  5. package/dist/esm/chunks/chunk-AVA7QEGU.js +625 -0
  6. package/dist/esm/chunks/{chunk-A7AAS5ZR.js.map → chunk-AVA7QEGU.js.map} +2 -2
  7. package/dist/esm/chunks/chunk-BLIAKWAU.js +42 -0
  8. package/dist/esm/chunks/{chunk-TVDAY42P.js.map → chunk-BLIAKWAU.js.map} +2 -2
  9. package/dist/esm/chunks/chunk-CWCWXKVV.js +202 -0
  10. package/dist/esm/chunks/{chunk-MCXU6QF3.js.map → chunk-CWCWXKVV.js.map} +2 -2
  11. package/dist/esm/chunks/chunk-HINJXYXY.js +29 -0
  12. package/dist/esm/chunks/{chunk-3J4RXW7E.js.map → chunk-HINJXYXY.js.map} +2 -2
  13. package/dist/esm/chunks/chunk-MKUA6QTB.js +9 -0
  14. package/dist/esm/chunks/chunk-NF4555DU.js +58 -0
  15. package/dist/esm/chunks/{chunk-ODCBJ22O.js.map → chunk-NF4555DU.js.map} +2 -2
  16. package/dist/esm/chunks/chunk-RSL3RU56.js +14 -0
  17. package/dist/esm/chunks/{chunk-E43OK6IZ.js.map → chunk-RSL3RU56.js.map} +2 -2
  18. package/dist/esm/chunks/chunk-T7EHIXSF.js +17 -0
  19. package/dist/esm/chunks/{chunk-LWOMFZ4C.js.map → chunk-T7EHIXSF.js.map} +2 -2
  20. package/dist/esm/chunks/metrics-6LW2N3GU.js +16 -0
  21. package/dist/esm/client/index.js +670 -1
  22. package/dist/esm/components-barrel.js +25688 -3
  23. package/dist/esm/dom/index.js +1902 -1
  24. package/dist/esm/index.js +117 -1
  25. package/dist/esm/jsx-dev-runtime.js +12 -1
  26. package/dist/esm/jsx-runtime.js +13 -1
  27. package/dist/esm/server/index.js +381 -1
  28. package/dist/esm/telemetry/index.js +188 -1
  29. package/dist/specifyjs-client.esm.js +670 -1
  30. package/dist/specifyjs-client.esm.js.map +2 -2
  31. package/dist/specifyjs-components.cjs.js.map +1 -1
  32. package/dist/specifyjs-components.esm.js +25688 -3
  33. package/dist/specifyjs-components.esm.js.map +3 -3
  34. package/dist/specifyjs-dom.esm.js +1902 -1
  35. package/dist/specifyjs-dom.esm.js.map +2 -2
  36. package/dist/specifyjs-jsx-dev-runtime.esm.js +12 -1
  37. package/dist/specifyjs-jsx-runtime.esm.js +13 -1
  38. package/dist/specifyjs-server.esm.js +381 -1
  39. package/dist/specifyjs-server.esm.js.map +2 -2
  40. package/dist/specifyjs-telemetry.esm.js +188 -1
  41. package/dist/specifyjs-telemetry.esm.js.map +2 -2
  42. package/dist/specifyjs.esm.js +117 -1
  43. package/dist/types/components/ad/adsense/src/AdSense.d.ts +1 -1
  44. package/dist/types/components/data/analog-clock/src/AnalogClock.d.ts +1 -1
  45. package/dist/types/components/data/avatar/src/Avatar.d.ts +1 -1
  46. package/dist/types/components/data/badge/src/Badge.d.ts +1 -1
  47. package/dist/types/components/data/data-grid/src/DataGrid.d.ts +1 -1
  48. package/dist/types/components/data/digital-clock/src/DigitalClock.d.ts +1 -1
  49. package/dist/types/components/data/list-view/src/ListView.d.ts +1 -1
  50. package/dist/types/components/data/tag/src/Tag.d.ts +1 -1
  51. package/dist/types/components/data/virtual-scroll/src/VirtualScroll.d.ts +1 -1
  52. package/dist/types/components/feedback/alert/src/Alert.d.ts +1 -1
  53. package/dist/types/components/feedback/empty-state/src/EmptyState.d.ts +1 -1
  54. package/dist/types/components/feedback/progress-bar/src/ProgressBar.d.ts +1 -1
  55. package/dist/types/components/feedback/skeleton/src/Skeleton.d.ts +1 -1
  56. package/dist/types/components/feedback/spinner/src/Spinner.d.ts +1 -1
  57. package/dist/types/components/form/button/src/Button.d.ts +1 -1
  58. package/dist/types/components/form/checkbox/src/Checkbox.d.ts +1 -1
  59. package/dist/types/components/form/color-picker/src/ColorPicker.d.ts +1 -1
  60. package/dist/types/components/form/color-wheel/src/ColorWheel.d.ts +1 -1
  61. package/dist/types/components/form/datepicker/src/DatePicker.d.ts +1 -1
  62. package/dist/types/components/form/file-upload/src/FileUpload.d.ts +1 -1
  63. package/dist/types/components/form/multiline/src/MultilineField.d.ts +1 -1
  64. package/dist/types/components/form/number-spinner/src/NumberSpinner.d.ts +1 -1
  65. package/dist/types/components/form/radio/src/RadioGroup.d.ts +1 -1
  66. package/dist/types/components/form/select/src/Select.d.ts +1 -1
  67. package/dist/types/components/form/slider/src/Slider.d.ts +1 -1
  68. package/dist/types/components/form/texteditor/src/TextEditor.d.ts +1 -1
  69. package/dist/types/components/form/textfield/src/TextField.d.ts +1 -1
  70. package/dist/types/components/form/timepicker/src/TimePicker.d.ts +1 -1
  71. package/dist/types/components/form/toggle/src/Toggle.d.ts +1 -1
  72. package/dist/types/components/form/wrapper/src/FormFieldWrapper.d.ts +1 -1
  73. package/dist/types/components/layout/card/src/Card.d.ts +1 -1
  74. package/dist/types/components/layout/desktop-background/src/DesktopBackground.d.ts +1 -1
  75. package/dist/types/components/layout/flex-container/src/FlexContainer.d.ts +2 -2
  76. package/dist/types/components/layout/footer/src/Footer.d.ts +1 -1
  77. package/dist/types/components/layout/grid/src/Grid.d.ts +2 -2
  78. package/dist/types/components/layout/panel/src/Panel.d.ts +1 -1
  79. package/dist/types/components/layout/scroll-container/src/ScrollContainer.d.ts +1 -1
  80. package/dist/types/components/layout/splitter/src/Splitter.d.ts +1 -1
  81. package/dist/types/components/layout/tabs/src/Tabs.d.ts +1 -1
  82. package/dist/types/components/layout/window-manager/src/WindowManager.d.ts +1 -1
  83. package/dist/types/components/media/carousel/src/Carousel.d.ts +1 -1
  84. package/dist/types/components/media/image/src/Image.d.ts +1 -1
  85. package/dist/types/components/media/video-player/src/VideoPlayer.d.ts +1 -1
  86. package/dist/types/components/nav/accordion/src/Accordion.d.ts +1 -1
  87. package/dist/types/components/nav/breadcrumb/src/Breadcrumb.d.ts +1 -1
  88. package/dist/types/components/nav/dock/src/Dock.d.ts +1 -1
  89. package/dist/types/components/nav/dropdown/src/Dropdown.d.ts +1 -1
  90. package/dist/types/components/nav/menubar/src/Menubar.d.ts +1 -1
  91. package/dist/types/components/nav/pagination/src/Pagination.d.ts +1 -1
  92. package/dist/types/components/nav/sidebar/src/Sidebar.d.ts +1 -1
  93. package/dist/types/components/nav/stepper/src/Stepper.d.ts +1 -1
  94. package/dist/types/components/nav/system-tray/src/SystemTray.d.ts +1 -1
  95. package/dist/types/components/nav/toolbar/src/Toolbar.d.ts +1 -1
  96. package/dist/types/components/nav/treenav/src/TreeNav.d.ts +1 -1
  97. package/dist/types/components/nav/wrapper/src/NavWrapper.d.ts +1 -1
  98. package/dist/types/components/overlay/context-menu/src/ContextMenu.d.ts +1 -1
  99. package/dist/types/components/overlay/drawer/src/Drawer.d.ts +1 -1
  100. package/dist/types/components/overlay/modal/src/Modal.d.ts +1 -1
  101. package/dist/types/components/overlay/popover/src/Popover.d.ts +1 -1
  102. package/dist/types/components/overlay/toast/src/Toast.d.ts +2 -2
  103. package/dist/types/components/overlay/tooltip/src/Tooltip.d.ts +1 -1
  104. package/dist/types/components/page/ide/src/IDE.d.ts +1 -1
  105. package/dist/types/components/page/trading-dashboard/src/TradingDashboard.d.ts +1 -1
  106. package/dist/types/components/page/unity-desktop/src/UnityApp.d.ts +1 -1
  107. package/dist/types/components/page/unity-desktop/src/UnityDesktop.d.ts +1 -1
  108. package/dist/types/components/page/word-processor/src/WordProcessor.d.ts +1 -1
  109. package/dist/types/components/viz/2D-bar-graph/src/BarGraph.d.ts +1 -1
  110. package/dist/types/components/viz/2D-discrete-cartesian/src/DiscreteCartesian2D.d.ts +1 -1
  111. package/dist/types/components/viz/2D-line-graph/src/LineGraph.d.ts +1 -1
  112. package/dist/types/components/viz/2D-pie-graph/src/PieGraph.d.ts +1 -1
  113. package/dist/types/components/viz/3d-force-graph/src/ForceGraph3D.d.ts +27 -119
  114. package/dist/types/components/viz/3d-force-graph/src/force-sim.d.ts +49 -0
  115. package/dist/types/components/viz/3d-force-graph/src/index.d.ts +5 -1
  116. package/dist/types/components/viz/3d-force-graph/src/types.d.ts +88 -0
  117. package/dist/types/components/viz/3d-layers/src/ThreeDLayers.d.ts +1 -1
  118. package/dist/types/components/viz/3dSpace/src/Space3D.d.ts +1 -1
  119. package/dist/types/components/viz/3dSpace/src/geom-polyhedron.d.ts +49 -0
  120. package/dist/types/components/viz/3dSpace/src/geom-sphere.d.ts +27 -0
  121. package/dist/types/components/viz/3dSpace/src/index.d.ts +5 -0
  122. package/dist/types/components/viz/3dSpace/src/mesh.d.ts +22 -0
  123. package/dist/types/components/viz/3dSpace/src/scene-object.d.ts +4 -0
  124. package/dist/types/components/viz/big-number/src/BigNumber.d.ts +1 -1
  125. package/dist/types/components/viz/bloch-sphere/src/BlochSphere.d.ts +1 -1
  126. package/dist/types/components/viz/box-plot/src/BoxPlot.d.ts +1 -1
  127. package/dist/types/components/viz/bubble-chart/src/BubbleChart.d.ts +1 -1
  128. package/dist/types/components/viz/calendar-heat-map/src/CalendarHeatMap.d.ts +1 -1
  129. package/dist/types/components/viz/chord/src/ChordDiagram.d.ts +1 -1
  130. package/dist/types/components/viz/decomposition-tree/src/DecompositionTree.d.ts +1 -1
  131. package/dist/types/components/viz/funnel/src/FunnelChart.d.ts +1 -1
  132. package/dist/types/components/viz/gantt-chart/src/GanttChart.d.ts +1 -1
  133. package/dist/types/components/viz/gauge/src/Gauge.d.ts +1 -1
  134. package/dist/types/components/viz/graph/src/HypercubeGraph.d.ts +1 -1
  135. package/dist/types/components/viz/heat-map/src/HeatMap.d.ts +1 -1
  136. package/dist/types/components/viz/histogram/src/Histogram.d.ts +1 -1
  137. package/dist/types/components/viz/matrix/src/Matrix.d.ts +1 -1
  138. package/dist/types/components/viz/partition/src/Partition.d.ts +1 -1
  139. package/dist/types/components/viz/pivot-table/src/PivotTable.d.ts +1 -1
  140. package/dist/types/components/viz/radar-chart/src/RadarChart.d.ts +1 -1
  141. package/dist/types/components/viz/sankey/src/SankeyDiagram.d.ts +1 -1
  142. package/dist/types/components/viz/sunburst/src/Sunburst.d.ts +1 -1
  143. package/dist/types/components/viz/tree-map/src/TreeMap.d.ts +1 -1
  144. package/dist/types/components/viz/vector-field/src/VectorField.d.ts +1 -1
  145. package/dist/types/components/viz/waterfall/src/WaterfallChart.d.ts +1 -1
  146. package/dist/types/components/viz/word-cloud/src/WordCloud.d.ts +1 -1
  147. package/dist/types/components/viz/wrapper/src/VizWrapper.d.ts +1 -1
  148. package/package.json +1 -1
  149. package/dist/esm/chunks/chunk-3J4RXW7E.js +0 -3
  150. package/dist/esm/chunks/chunk-3SXNLMCH.js +0 -3
  151. package/dist/esm/chunks/chunk-A7AAS5ZR.js +0 -3
  152. package/dist/esm/chunks/chunk-E43OK6IZ.js +0 -3
  153. package/dist/esm/chunks/chunk-LWOMFZ4C.js +0 -3
  154. package/dist/esm/chunks/chunk-MCXU6QF3.js +0 -3
  155. package/dist/esm/chunks/chunk-ODCBJ22O.js +0 -3
  156. package/dist/esm/chunks/chunk-TVDAY42P.js +0 -3
  157. package/dist/esm/chunks/chunk-VAF4KNDP.js +0 -3
  158. package/dist/esm/chunks/chunk-ZDPD2MPQ.js +0 -3
  159. package/dist/esm/chunks/metrics-56RIK7JQ.js +0 -3
  160. /package/dist/esm/chunks/{chunk-ZDPD2MPQ.js.map → chunk-MKUA6QTB.js.map} +0 -0
  161. /package/dist/esm/chunks/{metrics-56RIK7JQ.js.map → metrics-6LW2N3GU.js.map} +0 -0
@@ -0,0 +1,625 @@
1
+ /* (c) 2025-2026 Asymmetric Effort, LLC. MIT LICENSE */
2
+ import {
3
+ flushPendingTasks
4
+ } from "./chunk-5OX5JKEY.js";
5
+ import {
6
+ isValidElement
7
+ } from "./chunk-RSL3RU56.js";
8
+ import {
9
+ createElement
10
+ } from "./chunk-NF4555DU.js";
11
+ import {
12
+ SPEC_CONSUMER_TYPE,
13
+ SPEC_ELEMENT_TYPE,
14
+ SPEC_FORWARD_REF_TYPE,
15
+ SPEC_LAZY_TYPE,
16
+ SPEC_MEMO_TYPE,
17
+ SPEC_PROFILER_TYPE,
18
+ SPEC_PROVIDER_TYPE,
19
+ SPEC_STRICT_MODE_TYPE,
20
+ SPEC_SUSPENSE_TYPE
21
+ } from "./chunk-HINJXYXY.js";
22
+ import {
23
+ secureFetch
24
+ } from "./chunk-BLIAKWAU.js";
25
+ import {
26
+ useCallback,
27
+ useContext,
28
+ useEffect,
29
+ useMemo,
30
+ useState
31
+ } from "./chunk-CWCWXKVV.js";
32
+
33
+ // src/context/create-context.ts
34
+ function createContext(defaultValue) {
35
+ const context = {
36
+ $$typeof: Symbol.for("spec.context"),
37
+ Provider: null,
38
+ Consumer: null,
39
+ _currentValue: defaultValue,
40
+ _defaultValue: defaultValue
41
+ };
42
+ const provider = {
43
+ $$typeof: SPEC_PROVIDER_TYPE,
44
+ _context: context
45
+ };
46
+ const consumer = {
47
+ $$typeof: SPEC_CONSUMER_TYPE,
48
+ _context: context
49
+ };
50
+ context.Provider = provider;
51
+ context.Consumer = consumer;
52
+ return context;
53
+ }
54
+
55
+ // src/core/create-ref.ts
56
+ function createRef() {
57
+ return { current: null };
58
+ }
59
+
60
+ // src/core/forward-ref.ts
61
+ function forwardRef(render) {
62
+ return {
63
+ $$typeof: SPEC_FORWARD_REF_TYPE,
64
+ render,
65
+ displayName: render.displayName || render.name || "ForwardRef"
66
+ };
67
+ }
68
+
69
+ // src/core/memo.ts
70
+ function memo(component, compare) {
71
+ return {
72
+ $$typeof: SPEC_MEMO_TYPE,
73
+ type: component,
74
+ compare: compare || null,
75
+ displayName: component.displayName || component.name || "Memo"
76
+ };
77
+ }
78
+
79
+ // src/core/lazy.ts
80
+ function lazy(factory) {
81
+ const payload = {
82
+ _status: "pending",
83
+ _result: void 0
84
+ };
85
+ const init = () => {
86
+ if (payload._status === "resolved") {
87
+ return payload._result;
88
+ }
89
+ if (payload._status === "rejected") {
90
+ throw payload._result;
91
+ }
92
+ const promise = factory();
93
+ payload._status = "pending";
94
+ promise.then(
95
+ (module) => {
96
+ payload._status = "resolved";
97
+ payload._result = module.default;
98
+ },
99
+ (error) => {
100
+ payload._status = "rejected";
101
+ payload._result = error;
102
+ }
103
+ );
104
+ throw promise;
105
+ };
106
+ return {
107
+ $$typeof: SPEC_LAZY_TYPE,
108
+ _payload: payload,
109
+ _init: init,
110
+ displayName: "Lazy"
111
+ };
112
+ }
113
+
114
+ // src/core/clone-element.ts
115
+ function cloneElement(element, config, ...children) {
116
+ if (!isValidElement(element)) {
117
+ throw new Error("cloneElement: argument must be a valid SpecifyJS element");
118
+ }
119
+ let key = element.key;
120
+ let ref = element.ref;
121
+ const props = { ...element.props };
122
+ if (config != null) {
123
+ if (config.key !== void 0) {
124
+ key = "" + config.key;
125
+ }
126
+ if (config.ref !== void 0) {
127
+ ref = config.ref;
128
+ }
129
+ for (const propName in config) {
130
+ if (Object.prototype.hasOwnProperty.call(config, propName) && propName !== "key" && propName !== "ref" && propName !== "__proto__" && propName !== "constructor" && propName !== "prototype") {
131
+ props[propName] = config[propName];
132
+ }
133
+ }
134
+ }
135
+ if (children.length === 1) {
136
+ props.children = children[0];
137
+ } else if (children.length > 1) {
138
+ props.children = children;
139
+ }
140
+ return {
141
+ $$typeof: SPEC_ELEMENT_TYPE,
142
+ type: element.type,
143
+ props,
144
+ key,
145
+ ref
146
+ };
147
+ }
148
+
149
+ // src/core/children.ts
150
+ function flattenChildren(children) {
151
+ const result = [];
152
+ const stack = [children];
153
+ while (stack.length > 0) {
154
+ const node = stack.pop();
155
+ if (Array.isArray(node)) {
156
+ for (let i = node.length - 1; i >= 0; i--) {
157
+ stack.push(node[i]);
158
+ }
159
+ } else {
160
+ result.push(node);
161
+ }
162
+ }
163
+ return result;
164
+ }
165
+ function mapChildren(children, fn) {
166
+ const flat = flattenChildren(children);
167
+ const result = [];
168
+ for (let i = 0; i < flat.length; i++) {
169
+ const child = flat[i];
170
+ if (child == null || typeof child === "boolean") {
171
+ continue;
172
+ }
173
+ result.push(fn(child, i));
174
+ }
175
+ return result;
176
+ }
177
+ function forEachChildren(children, fn) {
178
+ const flat = flattenChildren(children);
179
+ let index = 0;
180
+ for (const child of flat) {
181
+ if (child == null || typeof child === "boolean") {
182
+ continue;
183
+ }
184
+ fn(child, index++);
185
+ }
186
+ }
187
+ function countChildren(children) {
188
+ const flat = flattenChildren(children);
189
+ let count = 0;
190
+ for (const child of flat) {
191
+ if (child != null && typeof child !== "boolean") {
192
+ count++;
193
+ }
194
+ }
195
+ return count;
196
+ }
197
+ function onlyChild(children) {
198
+ if (!isValidElement(children)) {
199
+ throw new Error("Children.only: expected a single SpecifyJS element child");
200
+ }
201
+ return children;
202
+ }
203
+ function toArray(children) {
204
+ const flat = flattenChildren(children);
205
+ return flat.filter((child) => child != null && typeof child !== "boolean");
206
+ }
207
+ var Children = {
208
+ map: mapChildren,
209
+ forEach: forEachChildren,
210
+ count: countChildren,
211
+ only: onlyChild,
212
+ toArray
213
+ };
214
+
215
+ // src/components/component.ts
216
+ var Component = class {
217
+ constructor(props) {
218
+ // Set by the reconciler
219
+ this._fiber = null;
220
+ this._pendingState = [];
221
+ this._forceUpdate = false;
222
+ this.props = props;
223
+ this.state = {};
224
+ this.context = void 0;
225
+ }
226
+ setState(updater, callback) {
227
+ this._pendingState.push(updater);
228
+ this._enqueueUpdate(callback);
229
+ }
230
+ forceUpdate(callback) {
231
+ this._forceUpdate = true;
232
+ this._enqueueUpdate(callback);
233
+ }
234
+ render() {
235
+ return null;
236
+ }
237
+ // Internal: replaced by the reconciler when the instance is mounted
238
+ _enqueueUpdate(_callback) {
239
+ }
240
+ };
241
+ Component.prototype.isSpecComponent = true;
242
+ var PureComponent = class extends Component {
243
+ shouldComponentUpdate(nextProps, nextState) {
244
+ return !shallowEqual(this.props, nextProps) || !shallowEqual(this.state, nextState);
245
+ }
246
+ };
247
+ PureComponent.prototype.isPureSpecComponent = true;
248
+ function shallowEqual(a, b) {
249
+ if (Object.is(a, b)) return true;
250
+ if (typeof a !== "object" || a === null || typeof b !== "object" || b === null) {
251
+ return false;
252
+ }
253
+ const keysA = Object.keys(a);
254
+ const keysB = Object.keys(b);
255
+ if (keysA.length !== keysB.length) return false;
256
+ const objA = a;
257
+ const objB = b;
258
+ for (const key of keysA) {
259
+ if (!Object.prototype.hasOwnProperty.call(objB, key) || !Object.is(objA[key], objB[key])) {
260
+ return false;
261
+ }
262
+ }
263
+ return true;
264
+ }
265
+
266
+ // src/components/error-boundary.ts
267
+ var ErrorBoundary = class extends Component {
268
+ static getDerivedStateFromError(error) {
269
+ return { hasError: true, error };
270
+ }
271
+ constructor(props) {
272
+ super(props);
273
+ this.state = { hasError: false, error: null };
274
+ }
275
+ componentDidCatch(error, info) {
276
+ this.props.onError?.(error, info);
277
+ }
278
+ render() {
279
+ if (this.state.hasError) {
280
+ return this.props.fallback ?? null;
281
+ }
282
+ return this.props.children ?? null;
283
+ }
284
+ };
285
+
286
+ // src/components/suspense.ts
287
+ var Suspense = SPEC_SUSPENSE_TYPE;
288
+
289
+ // src/components/strict-mode.ts
290
+ var StrictMode = SPEC_STRICT_MODE_TYPE;
291
+
292
+ // src/components/profiler.ts
293
+ var Profiler = SPEC_PROFILER_TYPE;
294
+
295
+ // src/router/router-context.ts
296
+ var RouterContext = createContext({
297
+ pathname: "/",
298
+ params: {},
299
+ /* v8 ignore next 3 */
300
+ navigate: () => {
301
+ throw new Error("useNavigate must be used inside a <Router> component.");
302
+ },
303
+ basePath: ""
304
+ });
305
+
306
+ // src/router/router-store.ts
307
+ function getHashPath() {
308
+ const hash = typeof window !== "undefined" ? window.location.hash : "";
309
+ const path = hash.replace(/^#\/?/, "/");
310
+ return path === "" ? "/" : path;
311
+ }
312
+ var currentSnapshot = {
313
+ pathname: getHashPath(),
314
+ /* v8 ignore next */
315
+ hash: typeof window !== "undefined" ? window.location.hash : ""
316
+ };
317
+ var listeners = /* @__PURE__ */ new Set();
318
+ function emitChange() {
319
+ currentSnapshot = {
320
+ pathname: getHashPath(),
321
+ /* v8 ignore next */
322
+ hash: typeof window !== "undefined" ? window.location.hash : ""
323
+ };
324
+ for (const listener of listeners) {
325
+ listener();
326
+ }
327
+ }
328
+ if (typeof window !== "undefined") {
329
+ window.addEventListener("hashchange", emitChange);
330
+ }
331
+ function subscribe(callback) {
332
+ listeners.add(callback);
333
+ return () => {
334
+ listeners.delete(callback);
335
+ };
336
+ }
337
+ function getSnapshot() {
338
+ return currentSnapshot;
339
+ }
340
+ function navigate(to, options) {
341
+ const hashPath = to.startsWith("#") ? to : "#" + to;
342
+ if (options?.replace) {
343
+ const url = window.location.pathname + window.location.search + hashPath;
344
+ window.history.replaceState(null, "", url);
345
+ } else {
346
+ window.location.hash = hashPath;
347
+ }
348
+ emitChange();
349
+ }
350
+
351
+ // src/router/router-component.ts
352
+ function Router(props) {
353
+ const [pathname, setPathname] = useState(() => getSnapshot().pathname);
354
+ useEffect(() => {
355
+ setPathname(getSnapshot().pathname);
356
+ const unsubscribe = subscribe(() => {
357
+ setPathname(getSnapshot().pathname);
358
+ });
359
+ return unsubscribe;
360
+ }, []);
361
+ const nav = useCallback((...args) => {
362
+ navigate(args[0], args[1]);
363
+ }, []);
364
+ const value = useMemo(
365
+ () => ({
366
+ pathname,
367
+ params: {},
368
+ navigate: nav,
369
+ basePath: ""
370
+ }),
371
+ [pathname, nav]
372
+ );
373
+ return createElement(RouterContext.Provider, { value }, props.children);
374
+ }
375
+
376
+ // src/router/match-path.ts
377
+ function stripTrailingSlashes(s) {
378
+ let end = s.length;
379
+ while (end > 1 && s.charCodeAt(end - 1) === 47) {
380
+ end--;
381
+ }
382
+ return end === s.length ? s : s.slice(0, end);
383
+ }
384
+ function matchPath(pattern, pathname, options) {
385
+ const exact = options?.exact ?? false;
386
+ const normalizedPattern = pattern === "/" ? "/" : stripTrailingSlashes(pattern);
387
+ const normalizedPath = pathname === "/" ? "/" : stripTrailingSlashes(pathname);
388
+ if (normalizedPattern === "/") {
389
+ const isExact2 = normalizedPath === "/";
390
+ if (exact && !isExact2) {
391
+ return null;
392
+ }
393
+ return {
394
+ params: {},
395
+ isExact: isExact2,
396
+ path: pattern,
397
+ url: "/"
398
+ };
399
+ }
400
+ const patternSegments = normalizedPattern.split("/").filter(Boolean);
401
+ const pathSegments = normalizedPath.split("/").filter(Boolean);
402
+ const hasWildcard = patternSegments[patternSegments.length - 1] === "*";
403
+ if (!hasWildcard && exact && pathSegments.length !== patternSegments.length) {
404
+ return null;
405
+ }
406
+ if (!hasWildcard && pathSegments.length < patternSegments.length) {
407
+ return null;
408
+ }
409
+ const params = {};
410
+ const matchedSegments = [];
411
+ for (let i = 0; i < patternSegments.length; i++) {
412
+ const patternSeg = patternSegments[i];
413
+ if (patternSeg === "*") {
414
+ const remaining = pathSegments.slice(i).join("/");
415
+ params["*"] = remaining;
416
+ return {
417
+ params,
418
+ isExact: true,
419
+ path: pattern,
420
+ url: "/" + pathSegments.join("/")
421
+ };
422
+ }
423
+ if (i >= pathSegments.length) {
424
+ return null;
425
+ }
426
+ const pathSeg = pathSegments[i];
427
+ if (patternSeg.startsWith(":")) {
428
+ const paramName = patternSeg.slice(1);
429
+ params[paramName] = decodeURIComponent(pathSeg);
430
+ matchedSegments.push(pathSeg);
431
+ continue;
432
+ }
433
+ if (patternSeg.toLowerCase() !== pathSeg.toLowerCase()) {
434
+ return null;
435
+ }
436
+ matchedSegments.push(pathSeg);
437
+ }
438
+ const matchedUrl = "/" + matchedSegments.join("/");
439
+ const isExact = pathSegments.length === patternSegments.length;
440
+ if (exact && !isExact) {
441
+ return null;
442
+ }
443
+ return {
444
+ params,
445
+ isExact,
446
+ path: pattern,
447
+ url: matchedUrl
448
+ };
449
+ }
450
+
451
+ // src/router/route-component.ts
452
+ function Route(props) {
453
+ const router = useContext(RouterContext);
454
+ const fullPattern = router.basePath + props.path;
455
+ const match = matchPath(fullPattern, router.pathname, {
456
+ exact: props.exact ?? false
457
+ });
458
+ const nestedValue = useMemo(
459
+ () => ({
460
+ pathname: router.pathname,
461
+ params: {
462
+ ...router.params,
463
+ ...match ? match.params : {}
464
+ },
465
+ navigate: router.navigate,
466
+ basePath: match ? match.url : router.basePath
467
+ }),
468
+ [router.pathname, router.navigate, router.params, router.basePath, match]
469
+ );
470
+ if (!match) return null;
471
+ for (const key of Object.keys(router.params)) {
472
+ if (!(key in nestedValue.params)) {
473
+ nestedValue.params[key] = router.params[key];
474
+ }
475
+ }
476
+ const content = props.component ? createElement(props.component, { ...nestedValue.params }) : props.children;
477
+ return createElement(RouterContext.Provider, { value: nestedValue }, content);
478
+ }
479
+
480
+ // src/router/link-component.ts
481
+ function Link(props) {
482
+ const { to, className, activeClassName, exact, children, ...rest } = props;
483
+ const router = useContext(RouterContext);
484
+ const isActive = matchPath(to, router.pathname, { exact: exact ?? false }) !== null;
485
+ const handleClick = useCallback(
486
+ ((...args) => {
487
+ const e = args[0];
488
+ e.preventDefault();
489
+ router.navigate(to);
490
+ }),
491
+ [to, router.navigate]
492
+ );
493
+ const cls = [className, isActive ? activeClassName : null].filter(Boolean).join(" ") || void 0;
494
+ return createElement(
495
+ "a",
496
+ {
497
+ ...rest,
498
+ href: "#" + to,
499
+ onClick: handleClick,
500
+ className: cls
501
+ },
502
+ children
503
+ );
504
+ }
505
+
506
+ // src/router/use-router.ts
507
+ function useRouter() {
508
+ return useContext(RouterContext);
509
+ }
510
+
511
+ // src/router/use-params.ts
512
+ function useParams() {
513
+ return useContext(RouterContext).params;
514
+ }
515
+
516
+ // src/router/use-navigate.ts
517
+ function useNavigate() {
518
+ return useContext(RouterContext).navigate;
519
+ }
520
+
521
+ // src/shared/act.ts
522
+ function act(callback) {
523
+ const result = callback();
524
+ flushPendingTasks();
525
+ if (result && typeof result.then === "function") {
526
+ result.then(() => {
527
+ flushPendingTasks();
528
+ });
529
+ }
530
+ }
531
+
532
+ // src/features/feature-flags.ts
533
+ var FeatureFlagContext = createContext({
534
+ flags: {},
535
+ isEnabled: () => false,
536
+ setFlag: () => {
537
+ },
538
+ loading: false
539
+ });
540
+ function FeatureFlagProvider(props) {
541
+ const [flags, setFlags] = useState(() => ({ ...props.defaults }));
542
+ const [loading, setLoading] = useState(!!props.url);
543
+ useEffect(() => {
544
+ if (!props.url) return;
545
+ let cancelled = false;
546
+ setLoading(true);
547
+ secureFetch(props.url).then((res) => {
548
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
549
+ return res.json();
550
+ }).then((json) => {
551
+ if (!cancelled && typeof json === "object" && json !== null) {
552
+ const safe = {};
553
+ for (const k of Object.keys(json)) {
554
+ if (k !== "__proto__" && k !== "constructor" && k !== "prototype") {
555
+ safe[k] = json[k] === true;
556
+ }
557
+ }
558
+ setFlags((prev) => ({ ...prev, ...safe }));
559
+ }
560
+ if (!cancelled) setLoading(false);
561
+ }).catch(() => {
562
+ if (!cancelled) setLoading(false);
563
+ });
564
+ return () => {
565
+ cancelled = true;
566
+ };
567
+ }, [props.url]);
568
+ const isEnabled = useCallback(
569
+ ((...args) => {
570
+ const flag = args[0];
571
+ return flags[flag] === true;
572
+ }),
573
+ [flags]
574
+ );
575
+ const setFlag = useCallback(
576
+ ((...args) => {
577
+ const flag = args[0];
578
+ const enabled = args[1];
579
+ setFlags((prev) => ({ ...prev, [flag]: enabled }));
580
+ }),
581
+ []
582
+ );
583
+ const value = {
584
+ flags,
585
+ isEnabled,
586
+ setFlag,
587
+ loading
588
+ };
589
+ return createElement(FeatureFlagContext.Provider, { value }, props.children);
590
+ }
591
+ function FeatureGate(props) {
592
+ const { isEnabled } = useContext(FeatureFlagContext);
593
+ return isEnabled(props.flag) ? props.children : props.fallback ?? null;
594
+ }
595
+ function useFeatureFlags() {
596
+ return useContext(FeatureFlagContext);
597
+ }
598
+
599
+ export {
600
+ createContext,
601
+ createRef,
602
+ forwardRef,
603
+ memo,
604
+ lazy,
605
+ cloneElement,
606
+ Children,
607
+ Component,
608
+ PureComponent,
609
+ ErrorBoundary,
610
+ Suspense,
611
+ StrictMode,
612
+ Profiler,
613
+ Router,
614
+ matchPath,
615
+ Route,
616
+ Link,
617
+ useRouter,
618
+ useParams,
619
+ useNavigate,
620
+ act,
621
+ FeatureFlagProvider,
622
+ FeatureGate,
623
+ useFeatureFlags
624
+ };
625
+ //# sourceMappingURL=chunk-AVA7QEGU.js.map