@apple-pie/slice 0.1.3 → 0.1.5

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 (126) hide show
  1. package/README.md +47 -77
  2. package/dist/cjs/chunks/{Button-hg5kGC1P.js → Button-Ck4syxwn.js} +4 -2
  3. package/dist/cjs/chunks/{ButtonBar-C9Nm9faU.js → ButtonBar-Cx9Xwddh.js} +1 -1
  4. package/dist/cjs/chunks/{Camera-Dx_PT3pS.js → Camera-BrLRwcw1.js} +1 -1
  5. package/dist/cjs/chunks/{Card-AgEMKJ4O.js → Card-CYDP4vAN.js} +1 -1
  6. package/dist/cjs/chunks/{CheckBox-CLMxlUff.js → CheckBox-DYG1fNWy.js} +1 -1
  7. package/dist/cjs/chunks/{Chip-CIy_Xe3i.js → Chip-CqOwsrmt.js} +1 -1
  8. package/dist/cjs/chunks/{DropDown-FZb52YxR.js → DropDown-Bo0bxkFk.js} +1 -1
  9. package/dist/cjs/chunks/{FileList-BQgcnKPP.js → FileList-bA8PoGOh.js} +1 -1
  10. package/dist/cjs/chunks/{Grouper-Bgc1wrQM.js → Grouper-BszVihfB.js} +1 -1
  11. package/dist/cjs/chunks/{IconButton-CBWmUZxR.js → IconButton-yWq-C437.js} +1 -1
  12. package/dist/cjs/chunks/{ProgressIndicator-qjya_Yb5.js → ProgressIndicator-Dvq4eIWW.js} +1 -1
  13. package/dist/cjs/chunks/{PromptInput-ZqHQUfXw.js → PromptInput-Hgh6995X.js} +1 -1
  14. package/dist/cjs/chunks/{RadioButton-Ce9uf54a.js → RadioButton-Cu-laBV5.js} +1 -1
  15. package/dist/cjs/chunks/{RadioButtonList-dhPr-Uhs.js → RadioButtonList-COS7jfsC.js} +1 -1
  16. package/dist/cjs/chunks/SSEConnection-B_yE8cXz.js +140 -0
  17. package/dist/cjs/chunks/{Slider-CrjpZooG.js → Slider-BeXrWjVx.js} +36 -36
  18. package/dist/cjs/chunks/{TabBar-DuwypMB6.js → TabBar-DCRr3l9L.js} +1 -1
  19. package/dist/cjs/chunks/{TextArea-BhzVGfKA.js → TextArea-DM0aHGGt.js} +1 -1
  20. package/dist/cjs/chunks/{TextField-hIjxrOG9.js → TextField-DQgpDpR1.js} +18 -16
  21. package/dist/cjs/chunks/{Toast-DMUM1wuL.js → Toast-D-Y1Ytnb.js} +1 -1
  22. package/dist/cjs/chunks/{UploadArea-B4GA06LW.js → UploadArea-Y_B35qjZ.js} +1 -1
  23. package/dist/cjs/chunks/WSConnection-DCBuJGmb.js +206 -0
  24. package/dist/cjs/chunks/{_types-C_zOsCbB.js → _types-NyUTfBLR.js} +25 -7
  25. package/dist/cjs/chunks/{sseStore-Dg0WuXsI.js → sseStore-CIIeshjm.js} +3 -3
  26. package/dist/cjs/chunks/windowStore-CCxCOUqa.js +156 -0
  27. package/dist/cjs/components/Button/index.js +3 -3
  28. package/dist/cjs/components/ButtonBar/index.js +3 -3
  29. package/dist/cjs/components/Camera/index.js +2 -2
  30. package/dist/cjs/components/Card/index.js +2 -2
  31. package/dist/cjs/components/CheckBox/index.js +2 -2
  32. package/dist/cjs/components/Chip/index.js +2 -2
  33. package/dist/cjs/components/DropDown/index.js +2 -2
  34. package/dist/cjs/components/FileList/index.js +3 -3
  35. package/dist/cjs/components/Grouper/index.js +2 -2
  36. package/dist/cjs/components/Icon/index.js +1 -1
  37. package/dist/cjs/components/IconButton/index.js +2 -2
  38. package/dist/cjs/components/Progress/index.js +2 -2
  39. package/dist/cjs/components/PromptInput/index.js +5 -5
  40. package/dist/cjs/components/RadioButton/index.js +2 -2
  41. package/dist/cjs/components/RadioButtonList/index.js +3 -3
  42. package/dist/cjs/components/Slider/index.js +1 -1
  43. package/dist/cjs/components/TabBar/index.js +3 -3
  44. package/dist/cjs/components/TextArea/index.js +4 -4
  45. package/dist/cjs/components/Textfield/index.js +5 -5
  46. package/dist/cjs/components/Toast/index.js +2 -2
  47. package/dist/cjs/components/UploadArea/index.js +4 -4
  48. package/dist/cjs/hooks/useWindow.js +46 -11
  49. package/dist/cjs/index.js +2 -2
  50. package/dist/cjs/stores/SSE.js +2 -2
  51. package/dist/cjs/stores/WS.js +62 -0
  52. package/dist/cjs/stores/window.js +14 -3
  53. package/dist/cjs/stores.js +15 -4
  54. package/dist/cjs/utils/index.js +2 -2
  55. package/dist/cjs/utils/objects/index.js +4 -138
  56. package/dist/esm/chunks/{Button-DJDS7Yad.mjs → Button-DexmN81C.mjs} +5 -3
  57. package/dist/esm/chunks/{ButtonBar-DIsqJmrS.mjs → ButtonBar-C-LwBxlY.mjs} +1 -1
  58. package/dist/esm/chunks/{Camera-BvJJ5cd-.mjs → Camera-DdUBZi52.mjs} +1 -1
  59. package/dist/esm/chunks/{Card-DjHdCav5.mjs → Card-DUfnTA5v.mjs} +1 -1
  60. package/dist/esm/chunks/{CheckBox-C1LPehvl.mjs → CheckBox-Bnd3UAt0.mjs} +1 -1
  61. package/dist/esm/chunks/{Chip-ByaaWpFx.mjs → Chip-BJS4oJBL.mjs} +1 -1
  62. package/dist/esm/chunks/{DropDown-CM01mO_W.mjs → DropDown-CbX16ETP.mjs} +1 -1
  63. package/dist/esm/chunks/{FileList-CmlXqPXl.mjs → FileList-E5uvcN2J.mjs} +2 -2
  64. package/dist/esm/chunks/{Grouper-DNmAYWdR.mjs → Grouper-X9OursiT.mjs} +1 -1
  65. package/dist/esm/chunks/{IconButton-C8RBNFzh.mjs → IconButton-B5WEf-v5.mjs} +1 -1
  66. package/dist/esm/chunks/{ProgressIndicator-h11R3FG1.mjs → ProgressIndicator-DeLwB3Rb.mjs} +1 -1
  67. package/dist/esm/chunks/{PromptInput-DSHVUuEf.mjs → PromptInput-BdMotrXA.mjs} +2 -2
  68. package/dist/esm/chunks/{RadioButton-_lo_FJ8g.mjs → RadioButton-D6kP8p0n.mjs} +1 -1
  69. package/dist/esm/chunks/{RadioButtonList-CLHJxrI_.mjs → RadioButtonList-guQECpwi.mjs} +1 -1
  70. package/dist/esm/chunks/SSEConnection-Dj9P0SWE.mjs +140 -0
  71. package/dist/esm/chunks/{Slider-Bih21QiT.mjs → Slider-ZuSvETfo.mjs} +37 -37
  72. package/dist/esm/chunks/{TabBar-CDDzA_m1.mjs → TabBar-BYtGaj_A.mjs} +2 -2
  73. package/dist/esm/chunks/{TextArea-CyVBzMoN.mjs → TextArea-D88dZrXm.mjs} +1 -1
  74. package/dist/esm/chunks/{TextField-CYI2vbvO.mjs → TextField-DvTB_JoS.mjs} +20 -18
  75. package/dist/esm/chunks/{Toast-ovxR12_-.mjs → Toast-BdlopzJ6.mjs} +1 -1
  76. package/dist/esm/chunks/{UploadArea-Kez3VD4d.mjs → UploadArea--i-bbRIJ.mjs} +3 -3
  77. package/dist/esm/chunks/WSConnection-DlYSitff.mjs +206 -0
  78. package/dist/esm/chunks/{_types-CTmvSEX0.mjs → _types-C8GP_aSD.mjs} +20 -2
  79. package/dist/esm/chunks/{sseStore-m3IPyLwJ.mjs → sseStore-DdqmnAAf.mjs} +2 -2
  80. package/dist/esm/chunks/windowStore-BOTh1g37.mjs +148 -0
  81. package/dist/esm/components/Button/index.mjs +3 -3
  82. package/dist/esm/components/ButtonBar/index.mjs +3 -3
  83. package/dist/esm/components/Camera/index.mjs +2 -2
  84. package/dist/esm/components/Card/index.mjs +2 -2
  85. package/dist/esm/components/CheckBox/index.mjs +2 -2
  86. package/dist/esm/components/Chip/index.mjs +2 -2
  87. package/dist/esm/components/DropDown/index.mjs +2 -2
  88. package/dist/esm/components/FileList/index.mjs +3 -3
  89. package/dist/esm/components/Grouper/index.mjs +2 -2
  90. package/dist/esm/components/Icon/index.mjs +1 -1
  91. package/dist/esm/components/IconButton/index.mjs +2 -2
  92. package/dist/esm/components/Progress/index.mjs +2 -2
  93. package/dist/esm/components/PromptInput/index.mjs +5 -5
  94. package/dist/esm/components/RadioButton/index.mjs +2 -2
  95. package/dist/esm/components/RadioButtonList/index.mjs +3 -3
  96. package/dist/esm/components/Slider/index.mjs +1 -1
  97. package/dist/esm/components/TabBar/index.mjs +3 -3
  98. package/dist/esm/components/TextArea/index.mjs +4 -4
  99. package/dist/esm/components/Textfield/index.mjs +5 -5
  100. package/dist/esm/components/Toast/index.mjs +2 -2
  101. package/dist/esm/components/UploadArea/index.mjs +4 -4
  102. package/dist/esm/hooks/useWindow.mjs +47 -11
  103. package/dist/esm/index.mjs +21 -21
  104. package/dist/esm/stores/SSE.mjs +2 -2
  105. package/dist/esm/stores/WS.mjs +59 -0
  106. package/dist/esm/stores/window.mjs +3 -1
  107. package/dist/esm/stores.mjs +5 -5
  108. package/dist/esm/utils/index.mjs +3 -1
  109. package/dist/esm/utils/objects/index.mjs +4 -139
  110. package/dist/types/components/Icon/_types.d.ts +1 -0
  111. package/dist/types/components/Slider/_types.d.ts +0 -2
  112. package/dist/types/hooks/index.d.ts +1 -1
  113. package/dist/types/hooks/useWindow/useWindow.d.ts +19 -0
  114. package/dist/types/index.d.ts +1 -1
  115. package/dist/types/stores/WS/_types.d.ts +17 -0
  116. package/dist/types/stores/WS/index.d.ts +2 -0
  117. package/dist/types/stores/WS/wsStore.d.ts +19 -0
  118. package/dist/types/stores/window/_types.d.ts +5 -0
  119. package/dist/types/stores/window/index.d.ts +3 -2
  120. package/dist/types/stores/window/windowStore.d.ts +8 -0
  121. package/dist/types/utils/index.d.ts +2 -2
  122. package/dist/types/utils/objects/WSConnection/WSConnection.d.ts +147 -0
  123. package/dist/types/utils/objects/index.d.ts +2 -0
  124. package/package.json +1 -1
  125. package/dist/cjs/chunks/windowStore-RaJswiHM.js +0 -70
  126. package/dist/esm/chunks/windowStore-CwW0i_le.mjs +0 -71
@@ -0,0 +1,206 @@
1
+ import { a as __awaiter } from "./tslib.es6-c-7TIv71.mjs";
2
+
3
+ class WSConnection {
4
+ get connected() {
5
+ var _a;
6
+ return (null === (_a = this.socket) || void 0 === _a ? void 0 : _a.readyState) === WebSocket.OPEN;
7
+ }
8
+ get connection() {
9
+ return this.socket;
10
+ }
11
+ constructor(options) {
12
+ var _a, _b, _c, _d, _e, _f, _g, _h;
13
+ if (this.socket = null, this.keepAliveTimer = null, this.reconnectIntervalTimer = null,
14
+ this.reconnectAttemptsCount = 0, this.manuallyClosed = !1,
15
+ /**
16
+ * Open handler
17
+ */
18
+ this.onOpen = event => __awaiter(this, void 0, void 0, function*() {
19
+ var _a;
20
+ if (this.clearReconnectTimer(), this.reconnectAttemptsCount = 0, this.manuallyClosed = !1,
21
+ null === (_a = this.onOpenCallback) || void 0 === _a || _a.call(this, event), this.emitUnifiedMessage({
22
+ type: "open",
23
+ event: event
24
+ }), this.token) try {
25
+ const token = "string" == typeof this.token ? this.token : yield this.token();
26
+ if (!token) return void this.closeSocket({
27
+ code: 1e3,
28
+ reason: "Access token not provided"
29
+ });
30
+ this.send({
31
+ token: token
32
+ });
33
+ } catch (error) {
34
+ const errorEvent = new ErrorEvent("token error", {
35
+ message: "Failed to resolve access token",
36
+ error: error
37
+ });
38
+ return this.emitErrorEvent(errorEvent), void this.closeSocket({
39
+ code: 1011,
40
+ reason: "Access token resolution failed"
41
+ });
42
+ }
43
+ this.keepAlive && this.setKeepAlive();
44
+ }),
45
+ /**
46
+ * Message handler
47
+ */
48
+ this.onMessage = event => {
49
+ const data = this.parseEventData(event.data);
50
+ void 0 !== data && (this.emitParsedMessage(data), this.emitUnifiedMessage({
51
+ type: "message",
52
+ data: data,
53
+ event: event
54
+ }));
55
+ },
56
+ /**
57
+ * Close handler with the reconnection logic as needed
58
+ */
59
+ this.onClose = event => {
60
+ var _a;
61
+ null === (_a = this.onCloseCallback) || void 0 === _a || _a.call(this, event), this.emitUnifiedMessage({
62
+ type: "close",
63
+ event: event
64
+ }), this.closeSocket(event), this.shouldReconnect(event) && this.reconnect();
65
+ },
66
+ /**
67
+ * Error handler
68
+ */
69
+ this.onError = event => {
70
+ const error = event instanceof ErrorEvent ? event : new ErrorEvent("websocket error", {
71
+ message: "WebSocket connection error"
72
+ });
73
+ this.emitErrorEvent(error);
74
+ }, this.url = options.url, this.autoReconnect = null === (_a = options.autoReconnect) || void 0 === _a || _a,
75
+ this.reconnectInterval = null !== (_b = options.reconnectInterval) && void 0 !== _b ? _b : 1e3,
76
+ this.reconnectAttempts = null !== (_c = options.reconnectAttempts) && void 0 !== _c ? _c : 5,
77
+ this.reconnectFalloff = null === (_d = options.reconnectFalloff) || void 0 === _d || _d,
78
+ this.keepAlive = null === (_e = options.keepAlive) || void 0 === _e || _e, this.keepAliveInterval = null !== (_f = options.keepAliveInterval) && void 0 !== _f ? _f : 3e4,
79
+ this.unifiedMessages = null !== (_g = options.unifiedMessages) && void 0 !== _g && _g,
80
+ this.token = null !== (_h = options.token) && void 0 !== _h ? _h : "", this.onMessageCallback = options.onMessageCallback,
81
+ this.onOpenCallback = options.onOpenCallback, this.onCloseCallback = options.onCloseCallback,
82
+ this.onErrorCallback = options.onErrorCallback, "undefined" == typeof WebSocket) throw new TypeError("WebSocket is not supported in this environment.");
83
+ this.connect();
84
+ }
85
+ /**
86
+ * Gracefully handle sending messages
87
+ */ send(message) {
88
+ var _a;
89
+ const data = "string" == typeof message ? message : JSON.stringify(message);
90
+ null === (_a = this.socket) || void 0 === _a || _a.send(data);
91
+ }
92
+ /**
93
+ * Gracefully expose socket close
94
+ */ close(closeEvent) {
95
+ this.manuallyClosed = !0, this.clearReconnectTimer(), this.reconnectAttemptsCount = 0,
96
+ this.closeSocket(closeEvent);
97
+ }
98
+ /**
99
+ * Emit the parsed message content for standard mode
100
+ */ emitParsedMessage(data) {
101
+ if (this.unifiedMessages) return;
102
+ const callback = this.onMessageCallback;
103
+ null == callback || callback(data);
104
+ }
105
+ /**
106
+ * Emit a unified message if the unified flag is on
107
+ */ emitUnifiedMessage(message) {
108
+ if (!this.unifiedMessages) return;
109
+ const callback = this.onMessageCallback;
110
+ null == callback || callback(message);
111
+ }
112
+ /**
113
+ * Emit error
114
+ */ emitErrorEvent(error) {
115
+ var _a;
116
+ null === (_a = this.onErrorCallback) || void 0 === _a || _a.call(this, error), this.emitUnifiedMessage({
117
+ type: "error",
118
+ event: error
119
+ });
120
+ }
121
+ /**
122
+ * Safe JSON parse message content
123
+ */ parseEventData(rawData) {
124
+ if (rawData instanceof Blob || rawData instanceof ArrayBuffer || "string" == typeof rawData) {
125
+ if ("string" != typeof rawData) return rawData;
126
+ try {
127
+ return JSON.parse(rawData);
128
+ } catch (_a) {
129
+ return rawData;
130
+ }
131
+ }
132
+ this.emitErrorEvent(new ErrorEvent("parse error", {
133
+ message: "Unsupported websocket message data format"
134
+ }));
135
+ }
136
+ /**
137
+ * Attach socket listeners
138
+ */ attachEventListeners() {
139
+ this.socket && (this.socket.addEventListener("open", this.onOpen), this.socket.addEventListener("message", this.onMessage),
140
+ this.socket.addEventListener("close", this.onClose), this.socket.addEventListener("error", this.onError));
141
+ }
142
+ /**
143
+ * set keep alive pings
144
+ */ setKeepAlive() {
145
+ this.socket && this.keepAlive && (this.keepAliveTimer && clearInterval(this.keepAliveTimer),
146
+ this.keepAliveTimer = setInterval(() => {
147
+ var _a;
148
+ (null === (_a = this.socket) || void 0 === _a ? void 0 : _a.readyState) === WebSocket.OPEN && this.socket.send("ping");
149
+ }, this.keepAliveInterval));
150
+ }
151
+ /**
152
+ * Clear keep alive pings
153
+ */ clearKeepAliveTimer() {
154
+ this.keepAliveTimer && (clearInterval(this.keepAliveTimer), this.keepAliveTimer = null);
155
+ }
156
+ /**
157
+ * Clear reconnect timer
158
+ */ clearReconnectTimer() {
159
+ this.reconnectIntervalTimer && (clearTimeout(this.reconnectIntervalTimer), this.reconnectIntervalTimer = null);
160
+ }
161
+ /**
162
+ * detach all event listeners
163
+ */ detachEventListeners() {
164
+ this.socket && (this.socket.removeEventListener("open", this.onOpen), this.socket.removeEventListener("message", this.onMessage),
165
+ this.socket.removeEventListener("close", this.onClose), this.socket.removeEventListener("error", this.onError));
166
+ }
167
+ /**
168
+ * Connect the socket
169
+ */ connect() {
170
+ var _a, _b;
171
+ (null === (_a = this.socket) || void 0 === _a ? void 0 : _a.readyState) !== WebSocket.OPEN && (null === (_b = this.socket) || void 0 === _b ? void 0 : _b.readyState) !== WebSocket.CONNECTING && (this.socket = new WebSocket(this.url),
172
+ this.attachEventListeners());
173
+ }
174
+ /**
175
+ * Reconnect logic
176
+ */ reconnect() {
177
+ if (!this.autoReconnect || this.manuallyClosed) return;
178
+ if (this.reconnectIntervalTimer) return;
179
+ const nextAttempt = this.reconnectAttemptsCount + 1;
180
+ if (nextAttempt > this.reconnectAttempts) return;
181
+ this.reconnectAttemptsCount = nextAttempt;
182
+ const delay = this.getReconnectDelay(nextAttempt);
183
+ this.reconnectIntervalTimer = setTimeout(() => {
184
+ this.reconnectIntervalTimer = null, this.manuallyClosed || this.connect();
185
+ }, delay);
186
+ }
187
+ /**
188
+ * Calculate reconnect delay with fall off
189
+ */ getReconnectDelay(attempt) {
190
+ return this.reconnectFalloff ? this.reconnectInterval * Math.pow(2, attempt - 1) : this.reconnectInterval;
191
+ }
192
+ /**
193
+ * Determine if should reconnect based on the close event and props
194
+ */ shouldReconnect(event) {
195
+ var _a, _b;
196
+ return (null === (_a = this.socket) || void 0 === _a ? void 0 : _a.readyState) !== WebSocket.CONNECTING && (null === (_b = this.socket) || void 0 === _b ? void 0 : _b.readyState) !== WebSocket.OPEN && (this.autoReconnect && !this.manuallyClosed && !event.wasClean);
197
+ }
198
+ /**
199
+ * Internal close socket - does not reset retry logic
200
+ */ closeSocket(closeEvent) {
201
+ this.socket && (this.clearKeepAliveTimer(), this.detachEventListeners(), this.socket.readyState !== WebSocket.CLOSED && this.socket.readyState !== WebSocket.CLOSING && this.socket.close(closeEvent.code || 1e3, closeEvent.reason || "Clean shutdown"),
202
+ this.socket = null, this.keepAliveTimer = null);
203
+ }
204
+ }
205
+
206
+ export { WSConnection as W };
@@ -22,7 +22,25 @@ styleInject(".Icon-module_icon__szG-X {\n\tcursor: var(--cursor);\n\tuser-select
22
22
  * Static icon registry created once at module load.
23
23
  * Each entry stores only icon line content renderers.
24
24
  */
25
- const STATIC_ICON_REGISTRY = new Map([ [ "video off", {
25
+ const STATIC_ICON_REGISTRY = new Map([ [ "target", {
26
+ line: ({strokeColor: strokeColor}) => jsxs(Fragment, {
27
+ children: [ jsx("circle", {
28
+ cx: "10",
29
+ cy: "10",
30
+ r: "3.25",
31
+ fill: strokeColor
32
+ }), jsx("path", {
33
+ d: "M10,7.5c1.38,0,2.5,1.12,2.5,2.5s-1.12,2.5-2.5,2.5-2.5-1.12-2.5-2.5,1.12-2.5,2.5-2.5M10,6c-2.21,0-4,1.79-4,4s1.79,4,4,4,4-1.79,4-4-1.79-4-4-4h0Z",
34
+ fill: strokeColor
35
+ }), jsx("path", {
36
+ d: "M10,18.25c-4.55,0-8.25-3.7-8.25-8.25S5.45,1.75,10,1.75s8.25,3.7,8.25,8.25-3.7,8.25-8.25,8.25ZM10,3.75c-3.45,0-6.25,2.8-6.25,6.25s2.8,6.25,6.25,6.25,6.25-2.8,6.25-6.25-2.8-6.25-6.25-6.25Z",
37
+ fill: strokeColor
38
+ }), jsx("path", {
39
+ d: "M10,2.5c4.14,0,7.5,3.36,7.5,7.5s-3.36,7.5-7.5,7.5-7.5-3.36-7.5-7.5,3.36-7.5,7.5-7.5M10,17c3.86,0,7-3.14,7-7s-3.14-7-7-7-7,3.14-7,7,3.14,7,7,7M10,1C5.03,1,1,5.03,1,10s4.03,9,9,9,9-4.03,9-9S14.97,1,10,1h0ZM10,15.5c-3.04,0-5.5-2.46-5.5-5.5s2.46-5.5,5.5-5.5,5.5,2.46,5.5,5.5-2.46,5.5-5.5,5.5h0Z",
40
+ fill: strokeColor
41
+ }) ]
42
+ })
43
+ } ], [ "video off", {
26
44
  line: ({strokeColor: strokeColor}) => jsxs(Fragment, {
27
45
  children: [ jsx("path", {
28
46
  d: "M10.97,14.75H3.04c-.16,0-.29-.11-.29-.25v-6.79l-1.5-1.29v8.08c0,.96.8,1.75,1.79,1.75h9.68l-1.75-1.5Z",
@@ -1046,7 +1064,7 @@ const STATIC_ICON_REGISTRY = new Map([ [ "video off", {
1046
1064
  var IconNames;
1047
1065
 
1048
1066
  Icon.displayName = "Icon", function(IconNames) {
1049
- IconNames.video = "video", IconNames.mic = "mic", IconNames.micMuted = "mic muted",
1067
+ IconNames.target = "target", IconNames.video = "video", IconNames.mic = "mic", IconNames.micMuted = "mic muted",
1050
1068
  IconNames.camera = "camera", IconNames.videoOff = "video off", IconNames.home = "home",
1051
1069
  IconNames.inbox = "inbox", IconNames.sparkle = "sparkle", IconNames.people = "people",
1052
1070
  IconNames.wallet = "wallet", IconNames.invoice = "invoice", IconNames.payment = "payment",
@@ -2,7 +2,7 @@ import { create } from "zustand";
2
2
 
3
3
  import "./tslib.es6-c-7TIv71.mjs";
4
4
 
5
- import { SSEConnection } from "../utils/objects/index.mjs";
5
+ import { S as SSEConnection } from "./SSEConnection-Dj9P0SWE.mjs";
6
6
 
7
7
  const useSSEStore = create((set, get) => ({
8
8
  connections: [],
@@ -47,7 +47,7 @@ const useSSEStore = create((set, get) => ({
47
47
  function useMessage(type, connection) {
48
48
  return useSSEStore(state => {
49
49
  const sourceMessage = connection && !state.connections.some(c => c.name === connection) ? null : state.message;
50
- return type ? sourceMessage && sourceMessage.type === type ? "open" === type || "error" === type || "close" === type ? "event" in sourceMessage ? sourceMessage.event : null : "data" in sourceMessage ? sourceMessage.data : null : null : sourceMessage;
50
+ return type ? (null == sourceMessage ? void 0 : sourceMessage.type) !== type ? null : "open" === type || "error" === type || "close" === type ? "event" in sourceMessage ? sourceMessage.event : null : "data" in sourceMessage ? sourceMessage.data : null : sourceMessage;
51
51
  });
52
52
  }
53
53
 
@@ -0,0 +1,148 @@
1
+ import { a as __awaiter } from "./tslib.es6-c-7TIv71.mjs";
2
+
3
+ import { create } from "zustand";
4
+
5
+ /**
6
+ * Form factor names
7
+ */ var FormFactor;
8
+
9
+ !function(FormFactor) {
10
+ FormFactor.Mobile = "mobile", FormFactor.Tablet = "tablet", FormFactor.Desktop = "desktop",
11
+ FormFactor.DesktopL = "desktopL", FormFactor.DesktopXL = "desktopXL";
12
+ }(FormFactor || (FormFactor = {}));
13
+
14
+ /**
15
+ * Use bootstrap breakpoints
16
+ */
17
+ const bootstrapBreakPoints = {
18
+ [FormFactor.Mobile]: 576,
19
+ [FormFactor.Tablet]: 768,
20
+ [FormFactor.Desktop]: 992,
21
+ [FormFactor.DesktopL]: 1200,
22
+ [FormFactor.DesktopXL]: 1400
23
+ }, orderedBps = Object.entries(bootstrapBreakPoints).sort((a, b) => -b[1] - a[1]), getFormFactor = width => {
24
+ if (!width || width <= 0) return FormFactor.Mobile;
25
+ for (const [formFactor, breakpoint] of orderedBps) if (width >= breakpoint) return formFactor;
26
+ return FormFactor.Mobile;
27
+ }, isBrowser = "undefined" != typeof globalThis && "undefined" != typeof navigator, initialSize = processWindowSize(), useWindowStore = create((set, get) => ({
28
+ formFactor: initialSize.formFactor,
29
+ viewportWidth: initialSize.viewportWidth,
30
+ viewportHeight: initialSize.viewportHeight,
31
+ height: initialSize.height,
32
+ isElectron: checkElectron(),
33
+ isAppleDevice: checkAppleDevice(),
34
+ isTouchDevice: checkTouchDevice(),
35
+ dpr: getDpr(),
36
+ locationError: null,
37
+ location: null,
38
+ gettingLocation: !1,
39
+ actions: {
40
+ initialize: () => {
41
+ if (!isBrowser) return () => {};
42
+ const win = getViewportWindow();
43
+ return null == win || win.addEventListener("resize", handleResize), handleResize(),
44
+ () => null == win ? void 0 : win.removeEventListener("resize", handleResize);
45
+ },
46
+ getLocation: () => __awaiter(void 0, void 0, void 0, function*() {
47
+ if (!isBrowser || !("geolocation" in navigator)) {
48
+ const error = createLocationError("Geolocation is not supported in this browser.", 0);
49
+ throw set({
50
+ locationError: error,
51
+ gettingLocation: !1
52
+ }), error;
53
+ }
54
+ return set({
55
+ gettingLocation: !0,
56
+ locationError: null
57
+ }), yield new Promise((resolve, reject) => {
58
+ navigator.geolocation.getCurrentPosition(position => {
59
+ const location = {
60
+ latitude: position.coords.latitude,
61
+ longitude: position.coords.longitude,
62
+ accuracy: position.coords.accuracy,
63
+ altitude: position.coords.altitude,
64
+ altitudeAccuracy: position.coords.altitudeAccuracy,
65
+ heading: position.coords.heading,
66
+ speed: position.coords.speed,
67
+ timestamp: position.timestamp
68
+ };
69
+ set({
70
+ location: location,
71
+ gettingLocation: !1,
72
+ locationError: null
73
+ }), resolve(location);
74
+ }, err => {
75
+ const error = createLocationError(err.message, err.code);
76
+ set({
77
+ locationError: error,
78
+ gettingLocation: !1,
79
+ location: null
80
+ }), reject(error);
81
+ });
82
+ });
83
+ })
84
+ }
85
+ }));
86
+
87
+ function checkElectron() {
88
+ if (!isBrowser) return !1;
89
+ return navigator.userAgent.toLowerCase().includes("electron/");
90
+ }
91
+
92
+ function checkAppleDevice() {
93
+ return !!isBrowser && (navigator.platform.startsWith("Mac") || "iPhone" === navigator.platform);
94
+ }
95
+
96
+ function checkTouchDevice() {
97
+ return !!isBrowser && ("ontouchstart" in globalThis || navigator.maxTouchPoints > 0);
98
+ }
99
+
100
+ function getDpr() {
101
+ var _a;
102
+ return isBrowser && null !== (_a = Math.min(Math.ceil(window.devicePixelRatio), 3)) && void 0 !== _a ? _a : 1;
103
+ }
104
+
105
+ function createLocationError(message, code) {
106
+ return new Error(message, {
107
+ cause: {
108
+ code: code
109
+ }
110
+ });
111
+ }
112
+
113
+ function getViewportWindow() {
114
+ var _a;
115
+ return isBrowser ? null !== (_a = window.top) && void 0 !== _a ? _a : globalThis : null;
116
+ }
117
+
118
+ function handleResize() {
119
+ if (!isBrowser) return;
120
+ const {formFactor: formFactor, viewportWidth: viewportWidth, viewportHeight: viewportHeight, height: height} = processWindowSize();
121
+ useWindowStore.setState({
122
+ formFactor: formFactor,
123
+ viewportWidth: viewportWidth,
124
+ viewportHeight: viewportHeight,
125
+ height: height
126
+ });
127
+ }
128
+
129
+ function processWindowSize(top = !0) {
130
+ var _a, _b;
131
+ if (!isBrowser) return {
132
+ formFactor: FormFactor.Mobile,
133
+ viewportWidth: -1,
134
+ viewportHeight: -1,
135
+ height: "100vh"
136
+ };
137
+ const viewport = top ? getViewportWindow() : globalThis, touch = checkTouchDevice(), windowWidth = null !== (_a = null == viewport ? void 0 : viewport.innerWidth) && void 0 !== _a ? _a : -1, windowHeight = null !== (_b = null == viewport ? void 0 : viewport.innerHeight) && void 0 !== _b ? _b : -1;
138
+ return {
139
+ formFactor: getFormFactor(windowWidth),
140
+ viewportWidth: windowWidth,
141
+ viewportHeight: windowHeight,
142
+ height: viewport && touch ? `${windowHeight}px` : "100vh"
143
+ };
144
+ }
145
+
146
+ const useFormFactor = () => useWindowStore(state => state.formFactor), useViewportWidth = () => useWindowStore(state => state.viewportWidth), useViewportHeight = () => useWindowStore(state => state.viewportHeight), useIsAppleDevice = () => useWindowStore(state => state.isAppleDevice), useIsTouchDevice = () => useWindowStore(state => state.isTouchDevice), useIsElectron = () => useWindowStore(state => state.isElectron), useDpr = () => useWindowStore(state => state.dpr), useLocation = () => useWindowStore(state => state.location), useLocationError = () => useWindowStore(state => state.locationError), useGettingLocation = () => useWindowStore(state => state.gettingLocation), useInitializeWindow = () => useWindowStore(state => state.actions.initialize), useGetLocation = () => useWindowStore(state => state.actions.getLocation), formFactor = () => useWindowStore.getState().formFactor, viewportWidth = () => useWindowStore.getState().viewportWidth, viewportHeight = () => useWindowStore.getState().viewportHeight, isAppleDevice = () => useWindowStore.getState().isAppleDevice, isTouchDevice = () => useWindowStore.getState().isTouchDevice, isElectron = () => useWindowStore.getState().isElectron, dpr = () => useWindowStore.getState().dpr, location = () => useWindowStore.getState().location, locationError = () => useWindowStore.getState().locationError, gettingLocation = () => useWindowStore.getState().gettingLocation;
147
+
148
+ export { FormFactor as F, isElectron as a, isTouchDevice as b, locationError as c, dpr as d, useFormFactor as e, formFactor as f, gettingLocation as g, useGetLocation as h, isAppleDevice as i, useGettingLocation as j, useInitializeWindow as k, location as l, useIsAppleDevice as m, useIsElectron as n, useIsTouchDevice as o, useLocation as p, useLocationError as q, useViewportHeight as r, useViewportWidth as s, useWindowStore as t, useDpr as u, viewportHeight as v, viewportWidth as w };
@@ -1,4 +1,4 @@
1
- export { B as Button } from "../../chunks/Button-DJDS7Yad.mjs";
1
+ export { B as Button } from "../../chunks/Button-DexmN81C.mjs";
2
2
 
3
3
  import "../../chunks/tslib.es6-c-7TIv71.mjs";
4
4
 
@@ -14,7 +14,7 @@ import "../../chunks/style-inject.es-D0BjEaN8.mjs";
14
14
 
15
15
  import "../../chunks/Dot-CLGwQu-i.mjs";
16
16
 
17
- import "../../chunks/_types-CTmvSEX0.mjs";
17
+ import "../../chunks/_types-C8GP_aSD.mjs";
18
18
 
19
19
  import "../../hooks/useTheme.mjs";
20
20
 
@@ -36,6 +36,6 @@ import "../../hooks/useWindow.mjs";
36
36
 
37
37
  import "../../chunks/misc-cg9I7drO.mjs";
38
38
 
39
- import "../../chunks/ProgressIndicator-h11R3FG1.mjs";
39
+ import "../../chunks/ProgressIndicator-DeLwB3Rb.mjs";
40
40
 
41
41
  import "../../chunks/sharedTypes-tn9-uJvb.mjs";
@@ -1,4 +1,4 @@
1
- export { B as ButtonBar } from "../../chunks/ButtonBar-DIsqJmrS.mjs";
1
+ export { B as ButtonBar } from "../../chunks/ButtonBar-C-LwBxlY.mjs";
2
2
 
3
3
  import "../../chunks/tslib.es6-c-7TIv71.mjs";
4
4
 
@@ -24,7 +24,7 @@ import "../../hooks/useObserveTheme.mjs";
24
24
 
25
25
  import "../../hooks/useWindow.mjs";
26
26
 
27
- import "../../chunks/IconButton-C8RBNFzh.mjs";
27
+ import "../../chunks/IconButton-B5WEf-v5.mjs";
28
28
 
29
29
  import "motion/react";
30
30
 
@@ -34,7 +34,7 @@ import "../../chunks/style-inject.es-D0BjEaN8.mjs";
34
34
 
35
35
  import "../../chunks/Dot-CLGwQu-i.mjs";
36
36
 
37
- import "../../chunks/_types-CTmvSEX0.mjs";
37
+ import "../../chunks/_types-C8GP_aSD.mjs";
38
38
 
39
39
  import "../../chunks/misc-cg9I7drO.mjs";
40
40
 
@@ -1,4 +1,4 @@
1
- export { C as Camera } from "../../chunks/Camera-BvJJ5cd-.mjs";
1
+ export { C as Camera } from "../../chunks/Camera-DdUBZi52.mjs";
2
2
 
3
3
  import "../../chunks/tslib.es6-c-7TIv71.mjs";
4
4
 
@@ -32,4 +32,4 @@ import "../../chunks/Avatar-CDMV6f9w.mjs";
32
32
 
33
33
  import "../../chunks/style-inject.es-D0BjEaN8.mjs";
34
34
 
35
- import "../../chunks/_types-CTmvSEX0.mjs";
35
+ import "../../chunks/_types-C8GP_aSD.mjs";
@@ -1,4 +1,4 @@
1
- export { C as Card } from "../../chunks/Card-DjHdCav5.mjs";
1
+ export { C as Card } from "../../chunks/Card-DUfnTA5v.mjs";
2
2
 
3
3
  import "../../chunks/tslib.es6-c-7TIv71.mjs";
4
4
 
@@ -6,7 +6,7 @@ import "react/jsx-runtime";
6
6
 
7
7
  import "react";
8
8
 
9
- import "../../chunks/_types-CTmvSEX0.mjs";
9
+ import "../../chunks/_types-C8GP_aSD.mjs";
10
10
 
11
11
  import "../../hooks/useTheme.mjs";
12
12
 
@@ -1,4 +1,4 @@
1
- export { C as CheckBox } from "../../chunks/CheckBox-C1LPehvl.mjs";
1
+ export { C as CheckBox } from "../../chunks/CheckBox-Bnd3UAt0.mjs";
2
2
 
3
3
  import "../../chunks/tslib.es6-c-7TIv71.mjs";
4
4
 
@@ -26,7 +26,7 @@ import "../../hooks/useObserveTheme.mjs";
26
26
 
27
27
  import "../../hooks/useWindow.mjs";
28
28
 
29
- import "../../chunks/_types-CTmvSEX0.mjs";
29
+ import "../../chunks/_types-C8GP_aSD.mjs";
30
30
 
31
31
  import "../../chunks/misc-cg9I7drO.mjs";
32
32
 
@@ -1,4 +1,4 @@
1
- export { C as Chip } from "../../chunks/Chip-ByaaWpFx.mjs";
1
+ export { C as Chip } from "../../chunks/Chip-BJS4oJBL.mjs";
2
2
 
3
3
  import "../../chunks/tslib.es6-c-7TIv71.mjs";
4
4
 
@@ -24,7 +24,7 @@ import "../../hooks/useObserveTheme.mjs";
24
24
 
25
25
  import "../../hooks/useWindow.mjs";
26
26
 
27
- import "../../chunks/_types-CTmvSEX0.mjs";
27
+ import "../../chunks/_types-C8GP_aSD.mjs";
28
28
 
29
29
  import "../../chunks/misc-cg9I7drO.mjs";
30
30
 
@@ -1,4 +1,4 @@
1
- export { D as DropDown } from "../../chunks/DropDown-CM01mO_W.mjs";
1
+ export { D as DropDown } from "../../chunks/DropDown-CbX16ETP.mjs";
2
2
 
3
3
  import "../../chunks/tslib.es6-c-7TIv71.mjs";
4
4
 
@@ -24,7 +24,7 @@ import "../../hooks/useObserveTheme.mjs";
24
24
 
25
25
  import "../../hooks/useWindow.mjs";
26
26
 
27
- import "../../chunks/_types-CTmvSEX0.mjs";
27
+ import "../../chunks/_types-C8GP_aSD.mjs";
28
28
 
29
29
  import "../../chunks/misc-cg9I7drO.mjs";
30
30
 
@@ -1,4 +1,4 @@
1
- export { F as FileList } from "../../chunks/FileList-CmlXqPXl.mjs";
1
+ export { F as FileList } from "../../chunks/FileList-E5uvcN2J.mjs";
2
2
 
3
3
  import "../../chunks/tslib.es6-c-7TIv71.mjs";
4
4
 
@@ -28,10 +28,10 @@ import "../../hooks/useObserveTheme.mjs";
28
28
 
29
29
  import "../../hooks/useWindow.mjs";
30
30
 
31
- import "../../chunks/_types-CTmvSEX0.mjs";
31
+ import "../../chunks/_types-C8GP_aSD.mjs";
32
32
 
33
33
  import "../../chunks/style-inject.es-D0BjEaN8.mjs";
34
34
 
35
- import "../../chunks/ProgressIndicator-h11R3FG1.mjs";
35
+ import "../../chunks/ProgressIndicator-DeLwB3Rb.mjs";
36
36
 
37
37
  import "motion/react";
@@ -1,4 +1,4 @@
1
- export { G as Grouper } from "../../chunks/Grouper-DNmAYWdR.mjs";
1
+ export { G as Grouper } from "../../chunks/Grouper-X9OursiT.mjs";
2
2
 
3
3
  import "../../chunks/tslib.es6-c-7TIv71.mjs";
4
4
 
@@ -30,6 +30,6 @@ import "../../chunks/Badge-DyICxZP2.mjs";
30
30
 
31
31
  import "../../chunks/style-inject.es-D0BjEaN8.mjs";
32
32
 
33
- import "../../chunks/_types-CTmvSEX0.mjs";
33
+ import "../../chunks/_types-C8GP_aSD.mjs";
34
34
 
35
35
  import "../../chunks/misc-cg9I7drO.mjs";
@@ -1,4 +1,4 @@
1
- export { I as Icon, a as IconNames } from "../../chunks/_types-CTmvSEX0.mjs";
1
+ export { I as Icon, a as IconNames } from "../../chunks/_types-C8GP_aSD.mjs";
2
2
 
3
3
  import "../../chunks/tslib.es6-c-7TIv71.mjs";
4
4
 
@@ -1,4 +1,4 @@
1
- export { I as IconButton } from "../../chunks/IconButton-C8RBNFzh.mjs";
1
+ export { I as IconButton } from "../../chunks/IconButton-B5WEf-v5.mjs";
2
2
 
3
3
  import "../../chunks/tslib.es6-c-7TIv71.mjs";
4
4
 
@@ -14,7 +14,7 @@ import "../../chunks/style-inject.es-D0BjEaN8.mjs";
14
14
 
15
15
  import "../../chunks/Dot-CLGwQu-i.mjs";
16
16
 
17
- import "../../chunks/_types-CTmvSEX0.mjs";
17
+ import "../../chunks/_types-C8GP_aSD.mjs";
18
18
 
19
19
  import "../../hooks/useTheme.mjs";
20
20
 
@@ -1,4 +1,4 @@
1
- export { D as DoneCheck, P as ProgressIndicator } from "../../chunks/ProgressIndicator-h11R3FG1.mjs";
1
+ export { D as DoneCheck, P as ProgressIndicator } from "../../chunks/ProgressIndicator-DeLwB3Rb.mjs";
2
2
 
3
3
  import "react/jsx-runtime";
4
4
 
@@ -24,7 +24,7 @@ import "../../hooks/useWindow.mjs";
24
24
 
25
25
  import "../../chunks/tslib.es6-c-7TIv71.mjs";
26
26
 
27
- import "../../chunks/_types-CTmvSEX0.mjs";
27
+ import "../../chunks/_types-C8GP_aSD.mjs";
28
28
 
29
29
  import "../../chunks/misc-cg9I7drO.mjs";
30
30
 
@@ -1,4 +1,4 @@
1
- export { P as PromptInput } from "../../chunks/PromptInput-DSHVUuEf.mjs";
1
+ export { P as PromptInput } from "../../chunks/PromptInput-BdMotrXA.mjs";
2
2
 
3
3
  import "react/jsx-runtime";
4
4
 
@@ -22,7 +22,7 @@ import "../../hooks/useObserveTheme.mjs";
22
22
 
23
23
  import "../../hooks/useWindow.mjs";
24
24
 
25
- import "../../chunks/Button-DJDS7Yad.mjs";
25
+ import "../../chunks/Button-DexmN81C.mjs";
26
26
 
27
27
  import "../../chunks/tslib.es6-c-7TIv71.mjs";
28
28
 
@@ -34,14 +34,14 @@ import "../../chunks/style-inject.es-D0BjEaN8.mjs";
34
34
 
35
35
  import "../../chunks/Dot-CLGwQu-i.mjs";
36
36
 
37
- import "../../chunks/_types-CTmvSEX0.mjs";
37
+ import "../../chunks/_types-C8GP_aSD.mjs";
38
38
 
39
39
  import "../../chunks/misc-cg9I7drO.mjs";
40
40
 
41
- import "../../chunks/ProgressIndicator-h11R3FG1.mjs";
41
+ import "../../chunks/ProgressIndicator-DeLwB3Rb.mjs";
42
42
 
43
43
  import "../../chunks/sharedTypes-tn9-uJvb.mjs";
44
44
 
45
- import "../../chunks/FileList-CmlXqPXl.mjs";
45
+ import "../../chunks/FileList-E5uvcN2J.mjs";
46
46
 
47
47
  import "../../chunks/FileIcon-CC_k5dUW.mjs";
@@ -1,4 +1,4 @@
1
- export { R as RadioButton } from "../../chunks/RadioButton-_lo_FJ8g.mjs";
1
+ export { R as RadioButton } from "../../chunks/RadioButton-D6kP8p0n.mjs";
2
2
 
3
3
  import "../../chunks/tslib.es6-c-7TIv71.mjs";
4
4
 
@@ -8,7 +8,7 @@ import "react";
8
8
 
9
9
  import "../../chunks/misc-cg9I7drO.mjs";
10
10
 
11
- import "../../chunks/_types-CTmvSEX0.mjs";
11
+ import "../../chunks/_types-C8GP_aSD.mjs";
12
12
 
13
13
  import "../../hooks/useTheme.mjs";
14
14