@apple-pie/slice 0.1.2 → 0.1.4

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 (149) hide show
  1. package/README.md +89 -27
  2. package/dist/cjs/chunks/{Button-TfMwGVI5.js → Button-krf4dQeL.js} +4 -2
  3. package/dist/cjs/chunks/{ButtonBar-BqGC6sad.js → ButtonBar-C9Nm9faU.js} +1 -1
  4. package/dist/cjs/chunks/{Camera-om1AA2D0.js → Camera-Dx_PT3pS.js} +63 -46
  5. package/dist/cjs/chunks/{Card-Ctwbhu26.js → Card-AgEMKJ4O.js} +1 -1
  6. package/dist/cjs/chunks/{CheckBox-CeDIiSvi.js → CheckBox-CLMxlUff.js} +1 -1
  7. package/dist/cjs/chunks/{Chip-DdTtB57x.js → Chip-CIy_Xe3i.js} +1 -1
  8. package/dist/cjs/chunks/{DropDown-CC90XfyD.js → DropDown-FZb52YxR.js} +1 -1
  9. package/dist/cjs/chunks/{FileList-ClTfGKIL.js → FileList-CkpMj-os.js} +1 -1
  10. package/dist/cjs/chunks/{Grouper-jiYhVC82.js → Grouper-Bgc1wrQM.js} +1 -1
  11. package/dist/cjs/chunks/{IconButton-BiUfqoPb.js → IconButton-CBWmUZxR.js} +1 -1
  12. package/dist/cjs/chunks/{ProgressIndicator-B3-OxGYF.js → ProgressIndicator-DVD-gD3T.js} +1 -1
  13. package/dist/cjs/chunks/{PromptInput-Dsziepzs.js → PromptInput-DULf5ock.js} +1 -1
  14. package/dist/cjs/chunks/{RadioButton-i5n_nNV5.js → RadioButton-Ce9uf54a.js} +1 -1
  15. package/dist/cjs/chunks/{RadioButtonList-BCdk-5aD.js → RadioButtonList-dhPr-Uhs.js} +1 -1
  16. package/dist/cjs/chunks/SSEConnection-B_yE8cXz.js +140 -0
  17. package/dist/cjs/chunks/{TabBar-BF5CvZ-v.js → TabBar-DuwypMB6.js} +1 -1
  18. package/dist/cjs/chunks/{TextArea-BmOomEKp.js → TextArea-BJCjRUEG.js} +1 -1
  19. package/dist/cjs/chunks/{TextField-CXMyCClp.js → TextField-CjT26H_6.js} +18 -16
  20. package/dist/cjs/chunks/{Toast-CQ0-yuzl.js → Toast-DMUM1wuL.js} +1 -1
  21. package/dist/cjs/chunks/{UploadArea-B5Xvp0H4.js → UploadArea-BE6but3t.js} +1 -1
  22. package/dist/cjs/chunks/WSConnection-DCBuJGmb.js +206 -0
  23. package/dist/cjs/chunks/{_types-Cxk9tRiB.js → _types-C_zOsCbB.js} +57 -50
  24. package/dist/cjs/chunks/colors-uej0anrN.js +27 -0
  25. package/dist/cjs/chunks/sseStore-CIIeshjm.js +59 -0
  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 +4 -4
  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/TabBar/index.js +3 -3
  43. package/dist/cjs/components/TextArea/index.js +4 -4
  44. package/dist/cjs/components/Textfield/index.js +5 -5
  45. package/dist/cjs/components/Toast/index.js +2 -2
  46. package/dist/cjs/components/UploadArea/index.js +4 -4
  47. package/dist/cjs/hooks/useWindow.js +46 -11
  48. package/dist/cjs/index.js +2 -2
  49. package/dist/cjs/stores/SSE.js +9 -0
  50. package/dist/cjs/stores/WS.js +62 -0
  51. package/dist/cjs/stores/window.js +14 -3
  52. package/dist/cjs/stores.js +20 -5
  53. package/dist/cjs/utils/index.js +4 -26
  54. package/dist/cjs/utils/objects/index.js +6 -0
  55. package/dist/esm/chunks/{Avatar-BQT1r-Ge.mjs → Avatar-CDMV6f9w.mjs} +1 -1
  56. package/dist/esm/chunks/{AvatarGroup-B787aNtD.mjs → AvatarGroup-BZ18GwhK.mjs} +1 -1
  57. package/dist/esm/chunks/{Button-1MgE-kl9.mjs → Button-kXFJmcKv.mjs} +5 -3
  58. package/dist/esm/chunks/{ButtonBar-Eahfd-40.mjs → ButtonBar-DIsqJmrS.mjs} +1 -1
  59. package/dist/esm/chunks/{Camera-Bvoug1KF.mjs → Camera-BvJJ5cd-.mjs} +65 -48
  60. package/dist/esm/chunks/{Card-RSZhXncV.mjs → Card-DjHdCav5.mjs} +1 -1
  61. package/dist/esm/chunks/{CheckBox-CfLedK0e.mjs → CheckBox-C1LPehvl.mjs} +1 -1
  62. package/dist/esm/chunks/{Chip-Db4N0WVH.mjs → Chip-ByaaWpFx.mjs} +1 -1
  63. package/dist/esm/chunks/{DivInput-BEpjdfu4.mjs → DivInput-B7BliU1p.mjs} +1 -1
  64. package/dist/esm/chunks/{DrggablePanel-DJm1Mx5u.mjs → DrggablePanel-DvactFf5.mjs} +1 -1
  65. package/dist/esm/chunks/{DropDown-ryz3GK81.mjs → DropDown-CM01mO_W.mjs} +1 -1
  66. package/dist/esm/chunks/{FileIcon-_mK2EcB2.mjs → FileIcon-CC_k5dUW.mjs} +1 -1
  67. package/dist/esm/chunks/{FileList-hCMTALyN.mjs → FileList-Bon537-t.mjs} +4 -4
  68. package/dist/esm/chunks/{Grouper-B1gjd3Sx.mjs → Grouper-DNmAYWdR.mjs} +1 -1
  69. package/dist/esm/chunks/{IconButton-SyRu990z.mjs → IconButton-C8RBNFzh.mjs} +1 -1
  70. package/dist/esm/chunks/{Label-DGOkB_Px.mjs → Label-DOvquc82.mjs} +1 -1
  71. package/dist/esm/chunks/{Pager-BA0lD9mI.mjs → Pager-BX4TMwD_.mjs} +1 -1
  72. package/dist/esm/chunks/{ProgressIndicator-BayyosKr.mjs → ProgressIndicator-D2eairZl.mjs} +1 -1
  73. package/dist/esm/chunks/{PromptInput-CUXCuYVA.mjs → PromptInput-DXFAZspz.mjs} +2 -2
  74. package/dist/esm/chunks/{RadioButton-BRFSVtmm.mjs → RadioButton-_lo_FJ8g.mjs} +2 -2
  75. package/dist/esm/chunks/{RadioButtonList-D6a_EcB6.mjs → RadioButtonList-CLHJxrI_.mjs} +1 -1
  76. package/dist/esm/chunks/SSEConnection-Dj9P0SWE.mjs +140 -0
  77. package/dist/esm/chunks/{Slider-D2XVyi2g.mjs → Slider-Bih21QiT.mjs} +1 -1
  78. package/dist/esm/chunks/{TabBar-BqajqueL.mjs → TabBar-CDDzA_m1.mjs} +2 -2
  79. package/dist/esm/chunks/{TextArea-C5EbLAN1.mjs → TextArea-DBmM6aQm.mjs} +1 -1
  80. package/dist/esm/chunks/{TextField-DnQxDxus.mjs → TextField-DyUTMegV.mjs} +20 -18
  81. package/dist/esm/chunks/{Tip-B64Pa9eq.mjs → Tip-B-cDOFvV.mjs} +1 -1
  82. package/dist/esm/chunks/{Toast-B3GgzcTW.mjs → Toast-ovxR12_-.mjs} +2 -2
  83. package/dist/esm/chunks/{UploadArea-DpWT-5DA.mjs → UploadArea-tT5V8q23.mjs} +4 -4
  84. package/dist/esm/chunks/WSConnection-DlYSitff.mjs +206 -0
  85. package/dist/esm/chunks/{_types-DGDKmYIh.mjs → _types-CTmvSEX0.mjs} +36 -29
  86. package/dist/esm/chunks/colors-DR9fLI5X.mjs +30 -0
  87. package/dist/esm/chunks/{misc-Osk7tIah.mjs → misc-cg9I7drO.mjs} +1 -1
  88. package/dist/esm/chunks/sseStore-DdqmnAAf.mjs +56 -0
  89. package/dist/esm/chunks/windowStore-BOTh1g37.mjs +148 -0
  90. package/dist/esm/components/Avatar/index.mjs +2 -2
  91. package/dist/esm/components/AvatarGroup/index.mjs +3 -3
  92. package/dist/esm/components/Button/index.mjs +4 -4
  93. package/dist/esm/components/ButtonBar/index.mjs +4 -4
  94. package/dist/esm/components/Camera/index.mjs +5 -5
  95. package/dist/esm/components/Card/index.mjs +3 -3
  96. package/dist/esm/components/CheckBox/index.mjs +3 -3
  97. package/dist/esm/components/Chip/index.mjs +3 -3
  98. package/dist/esm/components/DivInput/index.mjs +2 -2
  99. package/dist/esm/components/DraggablePanel/index.mjs +2 -2
  100. package/dist/esm/components/DropDown/index.mjs +3 -3
  101. package/dist/esm/components/FileIcon/index.mjs +2 -2
  102. package/dist/esm/components/FileList/index.mjs +5 -5
  103. package/dist/esm/components/Grouper/index.mjs +3 -3
  104. package/dist/esm/components/Icon/index.mjs +2 -2
  105. package/dist/esm/components/IconButton/index.mjs +3 -3
  106. package/dist/esm/components/Label/index.mjs +2 -2
  107. package/dist/esm/components/Pager/index.mjs +2 -2
  108. package/dist/esm/components/Progress/index.mjs +3 -3
  109. package/dist/esm/components/PromptInput/index.mjs +7 -7
  110. package/dist/esm/components/RadioButton/index.mjs +3 -3
  111. package/dist/esm/components/RadioButtonList/index.mjs +4 -4
  112. package/dist/esm/components/Slider/index.mjs +2 -2
  113. package/dist/esm/components/TabBar/index.mjs +4 -4
  114. package/dist/esm/components/TextArea/index.mjs +5 -5
  115. package/dist/esm/components/Textfield/index.mjs +6 -6
  116. package/dist/esm/components/Tip/index.mjs +2 -2
  117. package/dist/esm/components/Toast/index.mjs +3 -3
  118. package/dist/esm/components/UploadArea/index.mjs +6 -6
  119. package/dist/esm/hooks/useTrackRenders.mjs +1 -1
  120. package/dist/esm/hooks/useWindow.mjs +47 -11
  121. package/dist/esm/index.mjs +31 -31
  122. package/dist/esm/stores/SSE.mjs +7 -0
  123. package/dist/esm/stores/WS.mjs +59 -0
  124. package/dist/esm/stores/window.mjs +3 -1
  125. package/dist/esm/stores.mjs +6 -2
  126. package/dist/esm/utils/index.mjs +6 -30
  127. package/dist/esm/utils/objects/index.mjs +5 -0
  128. package/dist/types/components/Camera/_types.d.ts +1 -0
  129. package/dist/types/components/Icon/_types.d.ts +1 -0
  130. package/dist/types/hooks/index.d.ts +1 -1
  131. package/dist/types/hooks/useWindow/useWindow.d.ts +19 -0
  132. package/dist/types/index.d.ts +1 -1
  133. package/dist/types/stores/SSE/_types.d.ts +17 -0
  134. package/dist/types/stores/SSE/index.d.ts +2 -0
  135. package/dist/types/stores/SSE/sseStore.d.ts +28 -0
  136. package/dist/types/stores/WS/_types.d.ts +17 -0
  137. package/dist/types/stores/WS/index.d.ts +2 -0
  138. package/dist/types/stores/WS/wsStore.d.ts +19 -0
  139. package/dist/types/stores/index.d.ts +1 -0
  140. package/dist/types/stores/window/_types.d.ts +5 -0
  141. package/dist/types/stores/window/index.d.ts +3 -2
  142. package/dist/types/stores/window/windowStore.d.ts +8 -0
  143. package/dist/types/utils/index.d.ts +2 -0
  144. package/dist/types/utils/objects/SSEConnection/SSEConnection.d.ts +166 -0
  145. package/dist/types/utils/objects/WSConnection/WSConnection.d.ts +147 -0
  146. package/dist/types/utils/objects/index.d.ts +4 -0
  147. package/package.json +6 -1
  148. package/dist/cjs/chunks/windowStore-RaJswiHM.js +0 -70
  149. package/dist/esm/chunks/windowStore-CwW0i_le.mjs +0 -71
@@ -0,0 +1,206 @@
1
+ "use strict";
2
+
3
+ var tslib_es6 = require("./tslib.es6-C8dZW5nY.js");
4
+
5
+ exports.WSConnection = class {
6
+ get connected() {
7
+ var _a;
8
+ return (null === (_a = this.socket) || void 0 === _a ? void 0 : _a.readyState) === WebSocket.OPEN;
9
+ }
10
+ get connection() {
11
+ return this.socket;
12
+ }
13
+ constructor(options) {
14
+ var _a, _b, _c, _d, _e, _f, _g, _h;
15
+ if (this.socket = null, this.keepAliveTimer = null, this.reconnectIntervalTimer = null,
16
+ this.reconnectAttemptsCount = 0, this.manuallyClosed = !1,
17
+ /**
18
+ * Open handler
19
+ */
20
+ this.onOpen = event => tslib_es6.__awaiter(this, void 0, void 0, function*() {
21
+ var _a;
22
+ if (this.clearReconnectTimer(), this.reconnectAttemptsCount = 0, this.manuallyClosed = !1,
23
+ null === (_a = this.onOpenCallback) || void 0 === _a || _a.call(this, event), this.emitUnifiedMessage({
24
+ type: "open",
25
+ event: event
26
+ }), this.token) try {
27
+ const token = "string" == typeof this.token ? this.token : yield this.token();
28
+ if (!token) return void this.closeSocket({
29
+ code: 1e3,
30
+ reason: "Access token not provided"
31
+ });
32
+ this.send({
33
+ token: token
34
+ });
35
+ } catch (error) {
36
+ const errorEvent = new ErrorEvent("token error", {
37
+ message: "Failed to resolve access token",
38
+ error: error
39
+ });
40
+ return this.emitErrorEvent(errorEvent), void this.closeSocket({
41
+ code: 1011,
42
+ reason: "Access token resolution failed"
43
+ });
44
+ }
45
+ this.keepAlive && this.setKeepAlive();
46
+ }),
47
+ /**
48
+ * Message handler
49
+ */
50
+ this.onMessage = event => {
51
+ const data = this.parseEventData(event.data);
52
+ void 0 !== data && (this.emitParsedMessage(data), this.emitUnifiedMessage({
53
+ type: "message",
54
+ data: data,
55
+ event: event
56
+ }));
57
+ },
58
+ /**
59
+ * Close handler with the reconnection logic as needed
60
+ */
61
+ this.onClose = event => {
62
+ var _a;
63
+ null === (_a = this.onCloseCallback) || void 0 === _a || _a.call(this, event), this.emitUnifiedMessage({
64
+ type: "close",
65
+ event: event
66
+ }), this.closeSocket(event), this.shouldReconnect(event) && this.reconnect();
67
+ },
68
+ /**
69
+ * Error handler
70
+ */
71
+ this.onError = event => {
72
+ const error = event instanceof ErrorEvent ? event : new ErrorEvent("websocket error", {
73
+ message: "WebSocket connection error"
74
+ });
75
+ this.emitErrorEvent(error);
76
+ }, this.url = options.url, this.autoReconnect = null === (_a = options.autoReconnect) || void 0 === _a || _a,
77
+ this.reconnectInterval = null !== (_b = options.reconnectInterval) && void 0 !== _b ? _b : 1e3,
78
+ this.reconnectAttempts = null !== (_c = options.reconnectAttempts) && void 0 !== _c ? _c : 5,
79
+ this.reconnectFalloff = null === (_d = options.reconnectFalloff) || void 0 === _d || _d,
80
+ this.keepAlive = null === (_e = options.keepAlive) || void 0 === _e || _e, this.keepAliveInterval = null !== (_f = options.keepAliveInterval) && void 0 !== _f ? _f : 3e4,
81
+ this.unifiedMessages = null !== (_g = options.unifiedMessages) && void 0 !== _g && _g,
82
+ this.token = null !== (_h = options.token) && void 0 !== _h ? _h : "", this.onMessageCallback = options.onMessageCallback,
83
+ this.onOpenCallback = options.onOpenCallback, this.onCloseCallback = options.onCloseCallback,
84
+ this.onErrorCallback = options.onErrorCallback, "undefined" == typeof WebSocket) throw new TypeError("WebSocket is not supported in this environment.");
85
+ this.connect();
86
+ }
87
+ /**
88
+ * Gracefully handle sending messages
89
+ */ send(message) {
90
+ var _a;
91
+ const data = "string" == typeof message ? message : JSON.stringify(message);
92
+ null === (_a = this.socket) || void 0 === _a || _a.send(data);
93
+ }
94
+ /**
95
+ * Gracefully expose socket close
96
+ */ close(closeEvent) {
97
+ this.manuallyClosed = !0, this.clearReconnectTimer(), this.reconnectAttemptsCount = 0,
98
+ this.closeSocket(closeEvent);
99
+ }
100
+ /**
101
+ * Emit the parsed message content for standard mode
102
+ */ emitParsedMessage(data) {
103
+ if (this.unifiedMessages) return;
104
+ const callback = this.onMessageCallback;
105
+ null == callback || callback(data);
106
+ }
107
+ /**
108
+ * Emit a unified message if the unified flag is on
109
+ */ emitUnifiedMessage(message) {
110
+ if (!this.unifiedMessages) return;
111
+ const callback = this.onMessageCallback;
112
+ null == callback || callback(message);
113
+ }
114
+ /**
115
+ * Emit error
116
+ */ emitErrorEvent(error) {
117
+ var _a;
118
+ null === (_a = this.onErrorCallback) || void 0 === _a || _a.call(this, error), this.emitUnifiedMessage({
119
+ type: "error",
120
+ event: error
121
+ });
122
+ }
123
+ /**
124
+ * Safe JSON parse message content
125
+ */ parseEventData(rawData) {
126
+ if (rawData instanceof Blob || rawData instanceof ArrayBuffer || "string" == typeof rawData) {
127
+ if ("string" != typeof rawData) return rawData;
128
+ try {
129
+ return JSON.parse(rawData);
130
+ } catch (_a) {
131
+ return rawData;
132
+ }
133
+ }
134
+ this.emitErrorEvent(new ErrorEvent("parse error", {
135
+ message: "Unsupported websocket message data format"
136
+ }));
137
+ }
138
+ /**
139
+ * Attach socket listeners
140
+ */ attachEventListeners() {
141
+ this.socket && (this.socket.addEventListener("open", this.onOpen), this.socket.addEventListener("message", this.onMessage),
142
+ this.socket.addEventListener("close", this.onClose), this.socket.addEventListener("error", this.onError));
143
+ }
144
+ /**
145
+ * set keep alive pings
146
+ */ setKeepAlive() {
147
+ this.socket && this.keepAlive && (this.keepAliveTimer && clearInterval(this.keepAliveTimer),
148
+ this.keepAliveTimer = setInterval(() => {
149
+ var _a;
150
+ (null === (_a = this.socket) || void 0 === _a ? void 0 : _a.readyState) === WebSocket.OPEN && this.socket.send("ping");
151
+ }, this.keepAliveInterval));
152
+ }
153
+ /**
154
+ * Clear keep alive pings
155
+ */ clearKeepAliveTimer() {
156
+ this.keepAliveTimer && (clearInterval(this.keepAliveTimer), this.keepAliveTimer = null);
157
+ }
158
+ /**
159
+ * Clear reconnect timer
160
+ */ clearReconnectTimer() {
161
+ this.reconnectIntervalTimer && (clearTimeout(this.reconnectIntervalTimer), this.reconnectIntervalTimer = null);
162
+ }
163
+ /**
164
+ * detach all event listeners
165
+ */ detachEventListeners() {
166
+ this.socket && (this.socket.removeEventListener("open", this.onOpen), this.socket.removeEventListener("message", this.onMessage),
167
+ this.socket.removeEventListener("close", this.onClose), this.socket.removeEventListener("error", this.onError));
168
+ }
169
+ /**
170
+ * Connect the socket
171
+ */ connect() {
172
+ var _a, _b;
173
+ (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),
174
+ this.attachEventListeners());
175
+ }
176
+ /**
177
+ * Reconnect logic
178
+ */ reconnect() {
179
+ if (!this.autoReconnect || this.manuallyClosed) return;
180
+ if (this.reconnectIntervalTimer) return;
181
+ const nextAttempt = this.reconnectAttemptsCount + 1;
182
+ if (nextAttempt > this.reconnectAttempts) return;
183
+ this.reconnectAttemptsCount = nextAttempt;
184
+ const delay = this.getReconnectDelay(nextAttempt);
185
+ this.reconnectIntervalTimer = setTimeout(() => {
186
+ this.reconnectIntervalTimer = null, this.manuallyClosed || this.connect();
187
+ }, delay);
188
+ }
189
+ /**
190
+ * Calculate reconnect delay with fall off
191
+ */ getReconnectDelay(attempt) {
192
+ return this.reconnectFalloff ? this.reconnectInterval * Math.pow(2, attempt - 1) : this.reconnectInterval;
193
+ }
194
+ /**
195
+ * Determine if should reconnect based on the close event and props
196
+ */ shouldReconnect(event) {
197
+ var _a, _b;
198
+ 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);
199
+ }
200
+ /**
201
+ * Internal close socket - does not reset retry logic
202
+ */ closeSocket(closeEvent) {
203
+ 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"),
204
+ this.socket = null, this.keepAliveTimer = null);
205
+ }
206
+ };
@@ -12,14 +12,27 @@ styleInject_es.styleInject(".Icon-module_icon__szG-X {\n\tcursor: var(--cursor);
12
12
  * Static icon registry created once at module load.
13
13
  * Each entry stores only icon line content renderers.
14
14
  */
15
- const STATIC_ICON_REGISTRY = new Map([ [ "video", {
15
+ const STATIC_ICON_REGISTRY = new Map([ [ "video off", {
16
16
  line: ({strokeColor: strokeColor}) => jsxRuntime.jsxs(jsxRuntime.Fragment, {
17
17
  children: [ jsxRuntime.jsx("path", {
18
- d: "M17.47,5.52c-.23,0-.46.07-.66.21l-2.82,2.07v-2.68c0-.89-.72-1.62-1.62-1.62H3.12c-.89,0-1.62.72-1.62,1.62v9.77c0,.89.72,1.62,1.62,1.62h9.27c.89,0,1.62-.72,1.62-1.62v-2.68l2.82,2.07c.2.15.43.21.66.21.53,0,1.03-.35,1.03-.88v-7.2c0-.52-.5-.88-1.03-.88ZM12.5,14.88c0,.06-.05.12-.12.12H3.12c-.06,0-.12-.05-.12-.12V5.12c0-.06.05-.12.12-.12h9.27c.06,0,.12.05.12.12v9.77ZM17,12.54l-2.25-1.65v-1.78l2.25-1.65v5.08Z",
18
+ 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",
19
+ fill: strokeColor
20
+ }), jsxRuntime.jsx("path", {
21
+ d: "M18.39,5.86c-.23-.13-.51-.14-.74-.02l-2.9,1.55v-1.38c0-.97-.81-1.76-1.8-1.76H4.87l1.75,1.5h6.33c.17,0,.3.12.3.26v5.43l2.7,2.32,1.69.91c.11.06.23.09.35.09.13,0,.27-.04.39-.11.23-.14.36-.38.36-.64v-7.5c0-.26-.14-.51-.36-.64ZM17.25,12.75l-2.5-1.34v-2.32l2.5-1.34v4.99Z",
22
+ fill: strokeColor
23
+ }), jsxRuntime.jsx("path", {
24
+ d: "M15.21,16.5c-.17,0-.35-.06-.49-.18L1.3,4.82c-.31-.27-.35-.74-.08-1.06.27-.31.74-.35,1.06-.08l13.42,11.5c.31.27.35.74.08,1.06-.15.17-.36.26-.57.26Z",
25
+ fill: strokeColor
26
+ }) ]
27
+ })
28
+ } ], [ "video", {
29
+ line: ({strokeColor: strokeColor}) => jsxRuntime.jsxs(jsxRuntime.Fragment, {
30
+ children: [ jsxRuntime.jsx("path", {
31
+ d: "M18.39,5.86c-.23-.13-.51-.14-.74-.02l-2.9,1.55v-1.38c0-.97-.81-1.76-1.8-1.76H3.04c-.99,0-1.79.79-1.79,1.75v8.5c0,.96.8,1.75,1.79,1.75h9.91c.99,0,1.79-.79,1.79-1.75v-1.39l2.9,1.55c.11.06.23.09.35.09.13,0,.27-.04.39-.11.23-.14.36-.38.36-.64v-7.5c0-.26-.14-.51-.36-.64ZM13.25,14.5c0,.14-.13.25-.29.25H3.04c-.16,0-.29-.11-.29-.25V6c0-.14.13-.25.29-.25h9.91c.17,0,.3.12.3.26v8.49ZM17.25,12.75l-2.5-1.34v-2.32l2.5-1.34v4.99Z",
19
32
  fill: strokeColor
20
33
  }), jsxRuntime.jsx("circle", {
21
- cx: "9",
22
- cy: "8",
34
+ cx: "8",
35
+ cy: "10.25",
23
36
  r: "1",
24
37
  fill: strokeColor
25
38
  }) ]
@@ -27,49 +40,43 @@ const STATIC_ICON_REGISTRY = new Map([ [ "video", {
27
40
  } ], [ "mic", {
28
41
  line: ({strokeColor: strokeColor}) => jsxRuntime.jsxs(jsxRuntime.Fragment, {
29
42
  children: [ jsxRuntime.jsx("path", {
30
- d: "M11,11.75h-1.5c-1.24,0-2.25-1.01-2.25-2.25V3.5c0-1.24,1.01-2.25,2.25-2.25h1.5c1.24,0,2.25,1.01,2.25,2.25v6c0,1.24-1.01,2.25-2.25,2.25ZM9.5,2.75c-.41,0-.75.34-.75.75v6c0,.41.34.75.75.75h1.5c.41,0,.75-.34.75-.75V3.5c0-.41-.34-.75-.75-.75h-1.5Z",
43
+ d: "M10.25,11.75c1.65,0,3-1.35,3-3v-4.5c0-1.65-1.35-3-3-3s-3,1.35-3,3v4.5c0,1.65,1.35,3,3,3ZM8.75,4.25c0-.83.67-1.5,1.5-1.5s1.5.67,1.5,1.5v4.5c0,.83-.67,1.5-1.5,1.5s-1.5-.67-1.5-1.5v-4.5Z",
31
44
  fill: strokeColor
32
45
  }), jsxRuntime.jsx("path", {
33
- d: "M12,14.5c2.34,0,4.25-1.91,4.25-4.25v-3c0-.41-.34-.75-.75-.75s-.75.34-.75.75v3c0,1.52-1.23,2.75-2.75,2.75h-3.5c-1.52,0-2.75-1.23-2.75-2.75v-3c0-.41-.34-.75-.75-.75s-.75.34-.75.75v3c0,2.34,1.91,4.25,4.25,4.25h1.06v2.75h-3.59c-.41,0-.75.34-.75.75s.34.75.75.75h8.48c.41,0,.75-.34.75-.75s-.34-.75-.75-.75h-3.39v-2.75h.94Z",
46
+ d: "M14.75,7.25v1.25c0,2.48-2.02,4.5-4.5,4.5s-4.5-2.02-4.5-4.5v-1.25h-1.5v1.25c0,3.08,2.33,5.62,5.31,5.96v2.79h-3.59v1.5h8.48v-1.5h-3.39v-2.81c2.92-.4,5.19-2.91,5.19-5.94v-1.25h-1.5Z",
34
47
  fill: strokeColor
35
48
  }) ]
36
49
  })
37
50
  } ], [ "mic muted", {
38
- line: ({strokeColor: strokeColor, stroke: stroke}) => jsxRuntime.jsxs(jsxRuntime.Fragment, {
51
+ line: ({strokeColor: strokeColor}) => jsxRuntime.jsxs(jsxRuntime.Fragment, {
39
52
  children: [ jsxRuntime.jsx("path", {
40
- d: "M14.46,17.25h-3.39v-2.75h.94c.42,0,.81-.08,1.19-.19l-1.31-1.31h-3.38c-1.52,0-2.75-1.23-2.75-2.75v-3c0-.41-.34-.75-.75-.75s-.75.34-.75.75v3c0,2.34,1.91,4.25,4.25,4.25h1.06v2.75h-3.59c-.41,0-.75.34-.75.75s.34.75.75.75h8.48c.41,0,.75-.34.75-.75s-.34-.75-.75-.75Z",
53
+ d: "M8.78,3.95c.14-.68.74-1.2,1.47-1.2.83,0,1.5.67,1.5,1.5v2.67l1.5,1.5v-4.17c0-1.65-1.35-3-3-3-1.13,0-2.1.63-2.61,1.56l1.14,1.14Z",
41
54
  fill: strokeColor
42
55
  }), jsxRuntime.jsx("path", {
43
- d: "M15.6,12.48c.4-.65.65-1.41.65-2.23v-3c0-.41-.34-.75-.75-.75s-.75.34-.75.75v3c0,.4-.09.78-.25,1.13l1.1,1.1Z",
56
+ d: "M7.25,8.08v.67c0,1.65,1.35,3,3,3,.21,0,.41-.02.61-.06l-3.61-3.61Z",
44
57
  fill: strokeColor
45
58
  }), jsxRuntime.jsx("path", {
46
- d: "M8.75,5.63v-2.13c0-.41.34-.75.75-.75h1.5c.41,0,.75.34.75.75v5.13l1.42,1.42c.05-.18.08-.36.08-.55V3.5c0-1.24-1.01-2.25-2.25-2.25h-1.5c-1.24,0-2.25,1.01-2.25,2.25v.63l1.5,1.5Z",
59
+ d: "M14.75,7.25v1.25c0,.43-.08.84-.19,1.23l1.17,1.17c.33-.74.52-1.54.52-2.4v-1.25h-1.5Z",
47
60
  fill: strokeColor
48
61
  }), jsxRuntime.jsx("path", {
49
- d: "M7.25,8.37v1.13c0,1.24,1.01,2.25,2.25,2.25h1.13l-3.38-3.38Z",
62
+ d: "M11.06,14.44c.69-.09,1.33-.31,1.93-.62l-1.13-1.13c-.5.19-1.04.31-1.61.31-2.48,0-4.5-2.02-4.5-4.5v-1.25h-1.5v1.25c0,3.08,2.33,5.62,5.31,5.96v2.79h-3.59v1.5h8.48v-1.5h-3.39v-2.81Z",
63
+ fill: strokeColor
64
+ }), jsxRuntime.jsx("path", {
65
+ d: "M16.75,15.5c-.19,0-.38-.07-.53-.22L3.72,2.78c-.29-.29-.29-.77,0-1.06s.77-.29,1.06,0l12.5,12.5c.29.29.29.77,0,1.06-.15.15-.34.22-.53.22Z",
50
66
  fill: strokeColor
51
- }), jsxRuntime.jsx("line", {
52
- x1: "3.5",
53
- y1: "2.5",
54
- x2: "16",
55
- y2: "15",
56
- stroke: strokeColor,
57
- strokeLinecap: "round",
58
- strokeLinejoin: "round",
59
- strokeWidth: stroke
60
67
  }) ]
61
68
  })
62
69
  } ], [ "camera", {
63
70
  line: ({strokeColor: strokeColor}) => jsxRuntime.jsxs(jsxRuntime.Fragment, {
64
71
  children: [ jsxRuntime.jsx("path", {
65
- d: "M16.85,4c.35,0,.65.31.65.68v10.68c0,.36-.28.65-.62.65H3.13c-.34,0-.62-.29-.62-.64V4.65c0-.24.11-.39.18-.46.07-.07.21-.18.43-.18h13.73M16.85,2.5H3.12c-1.17,0-2.12.96-2.12,2.15v10.71c0,1.18.96,2.14,2.13,2.14h13.75c1.17,0,2.12-.96,2.12-2.15V4.68c0-1.2-.97-2.18-2.15-2.18h0Z",
72
+ d: "M16.75,16.25H3.25c-.96,0-1.75-.79-1.75-1.75V5.5c0-.96.79-1.75,1.75-1.75h13.5c.96,0,1.75.79,1.75,1.75v9c0,.96-.79,1.75-1.75,1.75ZM3.25,5.25c-.14,0-.25.11-.25.25v9c0,.14.11.25.25.25h13.5c.14,0,.25-.11.25-.25V5.5c0-.14-.11-.25-.25-.25H3.25Z",
66
73
  fill: strokeColor
67
74
  }), jsxRuntime.jsx("path", {
68
- d: "M10,8c1.52,0,2.75,1.23,2.75,2.75s-1.23,2.75-2.75,2.75-2.75-1.23-2.75-2.75,1.23-2.75,2.75-2.75M10,7c-2.07,0-3.75,1.68-3.75,3.75s1.68,3.75,3.75,3.75,3.75-1.68,3.75-3.75-1.68-3.75-3.75-3.75h0Z",
75
+ d: "M11.94,13.75c-2.03,0-3.69-1.65-3.69-3.69s1.65-3.69,3.69-3.69,3.69,1.65,3.69,3.69-1.65,3.69-3.69,3.69ZM11.94,7.88c-1.21,0-2.19.98-2.19,2.19s.98,2.19,2.19,2.19,2.19-.98,2.19-2.19-.98-2.19-2.19-2.19Z",
69
76
  fill: strokeColor
70
77
  }), jsxRuntime.jsx("circle", {
71
- cx: "15",
72
- cy: "6.5",
78
+ cx: "6",
79
+ cy: "8",
73
80
  r: "1",
74
81
  fill: strokeColor
75
82
  }) ]
@@ -1030,29 +1037,29 @@ var IconNames;
1030
1037
 
1031
1038
  Icon.displayName = "Icon", exports.IconNames = void 0, (IconNames = exports.IconNames || (exports.IconNames = {})).video = "video",
1032
1039
  IconNames.mic = "mic", IconNames.micMuted = "mic muted", IconNames.camera = "camera",
1033
- IconNames.home = "home", IconNames.inbox = "inbox", IconNames.sparkle = "sparkle",
1034
- IconNames.people = "people", IconNames.wallet = "wallet", IconNames.invoice = "invoice",
1035
- IconNames.payment = "payment", IconNames.heart = "heart", IconNames.clock = "clock",
1036
- IconNames.book = "book", IconNames.search = "search", IconNames.filter = "filter",
1037
- IconNames.more = "more", IconNames.checkbox = "checkbox", IconNames.checkboxChecked = "checkbox checked",
1038
- IconNames.checkboxPartial = "checkbox partial", IconNames.chevronDown = "chevron down",
1039
- IconNames.chevronUp = "chevron up", IconNames.plus = "plus", IconNames.plusCircle = "plus circle",
1040
- IconNames.x = "x", IconNames.upload = "upload", IconNames.download = "download",
1041
- IconNames.share = "share", IconNames.checkCircle = "check circle", IconNames.circle = "circle",
1042
- IconNames.circleFill = "circle fill", IconNames.person = "person", IconNames.attach = "attach",
1043
- IconNames.menu = "menu", IconNames.help = "help", IconNames.blank = "blank", IconNames.check = "check",
1044
- IconNames.message = "message", IconNames.info = "info", IconNames.alert = "alert",
1045
- IconNames.notification = "notification", IconNames.arrowUp = "arrow up", IconNames.arrowLeft = "arrow left",
1046
- IconNames.arrowRight = "arrow right", IconNames.navigate = "navigate", IconNames.document = "document",
1047
- IconNames.refresh = "refresh", IconNames.recentChats = "recent chats", IconNames.trashBin = "trash bin",
1048
- IconNames.dollar = "dollar", IconNames.apple = "apple", IconNames.view = "view",
1049
- IconNames.openCircle = "open circle", IconNames.expanded = "expanded", IconNames.concise = "concise",
1050
- IconNames.moderate = "moderate", IconNames.mail = "mail", IconNames.textDocument = "text document",
1051
- IconNames.edit = "edit", IconNames.characterBeam = "character beam", IconNames.undo = "undo",
1052
- IconNames.chat = "chat", IconNames.exclamation = "exclamation", IconNames.chart = "chart",
1053
- IconNames.lightBulb = "light bulb", IconNames.settings = "settings", IconNames.documentEditor = "document editor",
1054
- IconNames.chartArrow = "chart arrow", IconNames.focus = "focus", IconNames.briefcase = "briefcase",
1055
- IconNames.globeLocation = "globe location", IconNames.barChart = "bar chart", IconNames.fontSmaller = "font smaller",
1056
- IconNames.fontLarger = "font larger", IconNames.copy = "copy", IconNames.stop = "stop",
1057
- IconNames.like = "like", IconNames.unlike = "unlike", IconNames.highlight = "highlight",
1058
- exports.Icon = Icon;
1040
+ IconNames.videoOff = "video off", IconNames.home = "home", IconNames.inbox = "inbox",
1041
+ IconNames.sparkle = "sparkle", IconNames.people = "people", IconNames.wallet = "wallet",
1042
+ IconNames.invoice = "invoice", IconNames.payment = "payment", IconNames.heart = "heart",
1043
+ IconNames.clock = "clock", IconNames.book = "book", IconNames.search = "search",
1044
+ IconNames.filter = "filter", IconNames.more = "more", IconNames.checkbox = "checkbox",
1045
+ IconNames.checkboxChecked = "checkbox checked", IconNames.checkboxPartial = "checkbox partial",
1046
+ IconNames.chevronDown = "chevron down", IconNames.chevronUp = "chevron up", IconNames.plus = "plus",
1047
+ IconNames.plusCircle = "plus circle", IconNames.x = "x", IconNames.upload = "upload",
1048
+ IconNames.download = "download", IconNames.share = "share", IconNames.checkCircle = "check circle",
1049
+ IconNames.circle = "circle", IconNames.circleFill = "circle fill", IconNames.person = "person",
1050
+ IconNames.attach = "attach", IconNames.menu = "menu", IconNames.help = "help", IconNames.blank = "blank",
1051
+ IconNames.check = "check", IconNames.message = "message", IconNames.info = "info",
1052
+ IconNames.alert = "alert", IconNames.notification = "notification", IconNames.arrowUp = "arrow up",
1053
+ IconNames.arrowLeft = "arrow left", IconNames.arrowRight = "arrow right", IconNames.navigate = "navigate",
1054
+ IconNames.document = "document", IconNames.refresh = "refresh", IconNames.recentChats = "recent chats",
1055
+ IconNames.trashBin = "trash bin", IconNames.dollar = "dollar", IconNames.apple = "apple",
1056
+ IconNames.view = "view", IconNames.openCircle = "open circle", IconNames.expanded = "expanded",
1057
+ IconNames.concise = "concise", IconNames.moderate = "moderate", IconNames.mail = "mail",
1058
+ IconNames.textDocument = "text document", IconNames.edit = "edit", IconNames.characterBeam = "character beam",
1059
+ IconNames.undo = "undo", IconNames.chat = "chat", IconNames.exclamation = "exclamation",
1060
+ IconNames.chart = "chart", IconNames.lightBulb = "light bulb", IconNames.settings = "settings",
1061
+ IconNames.documentEditor = "document editor", IconNames.chartArrow = "chart arrow",
1062
+ IconNames.focus = "focus", IconNames.briefcase = "briefcase", IconNames.globeLocation = "globe location",
1063
+ IconNames.barChart = "bar chart", IconNames.fontSmaller = "font smaller", IconNames.fontLarger = "font larger",
1064
+ IconNames.copy = "copy", IconNames.stop = "stop", IconNames.like = "like", IconNames.unlike = "unlike",
1065
+ IconNames.highlight = "highlight", exports.Icon = Icon;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ /**
4
+ * Create a tint value from a hex color
5
+ */ exports.addOpacity = (color, opacity) => {
6
+ if (!color) return "";
7
+ const alpha = Number.isFinite(opacity) ? Math.max(0, Math.min(1, opacity)) : 1, trimmed = color.trim();
8
+ if (trimmed.startsWith("#")) {
9
+ const normalized = trimmed.slice(1), fullHex = 3 === normalized.length ? normalized.split("").map(char => `${char}${char}`).join("") : normalized;
10
+ if (!/^[0-9a-fA-F]{6}$/.test(fullHex)) return color;
11
+ return `rgba(${Number.parseInt(fullHex.slice(0, 2), 16)}, ${Number.parseInt(fullHex.slice(2, 4), 16)}, ${Number.parseInt(fullHex.slice(4, 6), 16)}, ${alpha})`;
12
+ }
13
+ const rgbMatch = trimmed.match(/^rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})(?:\s*,\s*[\d.]+\s*)?\)$/);
14
+ if (rgbMatch) {
15
+ const [, r, g, b] = rgbMatch;
16
+ return `rgba(${r}, ${g}, ${b}, ${alpha})`;
17
+ }
18
+ return color;
19
+ }, exports.tintFromColor = (hex, percent) => {
20
+ const normalizedHex = hex.trim().replace("#", "");
21
+ if (!(3 === normalizedHex.length || 6 === normalizedHex.length) || !/^[0-9a-fA-F]+$/.test(normalizedHex)) return hex;
22
+ const fullHex = 3 === normalizedHex.length ? normalizedHex.split("").map(char => `${char}${char}`).join("") : normalizedHex, ratio = Math.max(-1, Math.min(1, Math.abs(percent) > 1 ? percent / 100 : percent)), mixTo = ratio >= 0 ? 255 : 0, mix = Math.abs(ratio);
23
+ return `#${[ 0, 2, 4 ].map(start => Number.parseInt(fullHex.slice(start, start + 2), 16)).map(channel => {
24
+ const next = Math.round(channel + (mixTo - channel) * mix);
25
+ return Math.max(0, Math.min(255, next));
26
+ }).map(channel => channel.toString(16).padStart(2, "0")).join("")}`;
27
+ };
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+
3
+ var zustand = require("zustand");
4
+
5
+ require("./tslib.es6-C8dZW5nY.js");
6
+
7
+ var SSEConnection = require("./SSEConnection-B_yE8cXz.js");
8
+
9
+ const useSSEStore = zustand.create((set, get) => ({
10
+ connections: [],
11
+ message: null,
12
+ closedConnection: null,
13
+ actions: {
14
+ addConnection: (name, options) => {
15
+ const existingConnection = get().connections.find(c => c.name === name);
16
+ null == existingConnection || existingConnection.connection.close();
17
+ const userOnMessageCallback = options.onMessageCallback, connection = new SSEConnection.SSEConnection(Object.assign(Object.assign({}, options), {
18
+ unifiedOnMessage: !0,
19
+ onMessageCallback: message => {
20
+ set({
21
+ message: message
22
+ }), null == userOnMessageCallback || userOnMessageCallback(message), "close" === message.type && (set({
23
+ closedConnection: name
24
+ }), get().actions.removeConnection(name));
25
+ }
26
+ }));
27
+ return set(state => ({
28
+ connections: [ ...state.connections.filter(connection => connection.name !== name), {
29
+ name: name,
30
+ connection: connection
31
+ } ]
32
+ })), {
33
+ name: name,
34
+ connection: connection
35
+ };
36
+ },
37
+ removeConnection: name => {
38
+ const existingConnection = get().connections.find(c => c.name === name);
39
+ existingConnection && (existingConnection.connection.close(), set(state => ({
40
+ connections: state.connections.filter(connection => connection.name !== name)
41
+ })));
42
+ }
43
+ }
44
+ }));
45
+
46
+ const useSSEActions = useSSEStore.getState().actions;
47
+
48
+ exports.useConnectionClose = () => useSSEStore(state => state.closedConnection),
49
+ exports.useConnectionMessage = connection => useSSEStore(state => state.connections.some(entry => entry.name === connection) ? state.message : null),
50
+ exports.useIsConnected = connection => useSSEStore(state => {
51
+ var _a, _b;
52
+ return connection ? null !== (_b = null === (_a = state.connections.find(entry => entry.name === connection)) || void 0 === _a ? void 0 : _a.connection.connected) && void 0 !== _b && _b : state.connections.some(entry => entry.connection.connected);
53
+ }), exports.useLastSSEMessage = () => useSSEStore.getState().message, exports.useMessage = function(type, connection) {
54
+ return useSSEStore(state => {
55
+ const sourceMessage = connection && !state.connections.some(c => c.name === connection) ? null : state.message;
56
+ 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;
57
+ });
58
+ }, exports.useSSE = () => useSSEStore(state => state.actions), exports.useSSEActions = useSSEActions,
59
+ exports.useSSEStore = useSSEStore;
@@ -0,0 +1,156 @@
1
+ "use strict";
2
+
3
+ var FormFactor, tslib_es6 = require("./tslib.es6-C8dZW5nY.js"), zustand = require("zustand");
4
+
5
+ /**
6
+ * Form factor names
7
+ */
8
+ exports.FormFactor = void 0, (FormFactor = exports.FormFactor || (exports.FormFactor = {})).Mobile = "mobile",
9
+ FormFactor.Tablet = "tablet", FormFactor.Desktop = "desktop", FormFactor.DesktopL = "desktopL",
10
+ FormFactor.DesktopXL = "desktopXL";
11
+
12
+ /**
13
+ * Use bootstrap breakpoints
14
+ */
15
+ const bootstrapBreakPoints = {
16
+ [exports.FormFactor.Mobile]: 576,
17
+ [exports.FormFactor.Tablet]: 768,
18
+ [exports.FormFactor.Desktop]: 992,
19
+ [exports.FormFactor.DesktopL]: 1200,
20
+ [exports.FormFactor.DesktopXL]: 1400
21
+ }, orderedBps = Object.entries(bootstrapBreakPoints).sort((a, b) => -b[1] - a[1]), getFormFactor = width => {
22
+ if (!width || width <= 0) return exports.FormFactor.Mobile;
23
+ for (const [formFactor, breakpoint] of orderedBps) if (width >= breakpoint) return formFactor;
24
+ return exports.FormFactor.Mobile;
25
+ }, isBrowser = "undefined" != typeof globalThis && "undefined" != typeof navigator, initialSize = processWindowSize(), useWindowStore = zustand.create((set, get) => ({
26
+ formFactor: initialSize.formFactor,
27
+ viewportWidth: initialSize.viewportWidth,
28
+ viewportHeight: initialSize.viewportHeight,
29
+ height: initialSize.height,
30
+ isElectron: checkElectron(),
31
+ isAppleDevice: checkAppleDevice(),
32
+ isTouchDevice: checkTouchDevice(),
33
+ dpr: getDpr(),
34
+ locationError: null,
35
+ location: null,
36
+ gettingLocation: !1,
37
+ actions: {
38
+ initialize: () => {
39
+ if (!isBrowser) return () => {};
40
+ const win = getViewportWindow();
41
+ return null == win || win.addEventListener("resize", handleResize), handleResize(),
42
+ () => null == win ? void 0 : win.removeEventListener("resize", handleResize);
43
+ },
44
+ getLocation: () => tslib_es6.__awaiter(void 0, void 0, void 0, function*() {
45
+ if (!isBrowser || !("geolocation" in navigator)) {
46
+ const error = createLocationError("Geolocation is not supported in this browser.", 0);
47
+ throw set({
48
+ locationError: error,
49
+ gettingLocation: !1
50
+ }), error;
51
+ }
52
+ return set({
53
+ gettingLocation: !0,
54
+ locationError: null
55
+ }), yield new Promise((resolve, reject) => {
56
+ navigator.geolocation.getCurrentPosition(position => {
57
+ const location = {
58
+ latitude: position.coords.latitude,
59
+ longitude: position.coords.longitude,
60
+ accuracy: position.coords.accuracy,
61
+ altitude: position.coords.altitude,
62
+ altitudeAccuracy: position.coords.altitudeAccuracy,
63
+ heading: position.coords.heading,
64
+ speed: position.coords.speed,
65
+ timestamp: position.timestamp
66
+ };
67
+ set({
68
+ location: location,
69
+ gettingLocation: !1,
70
+ locationError: null
71
+ }), resolve(location);
72
+ }, err => {
73
+ const error = createLocationError(err.message, err.code);
74
+ set({
75
+ locationError: error,
76
+ gettingLocation: !1,
77
+ location: null
78
+ }), reject(error);
79
+ });
80
+ });
81
+ })
82
+ }
83
+ }));
84
+
85
+ function checkElectron() {
86
+ if (!isBrowser) return !1;
87
+ return navigator.userAgent.toLowerCase().includes("electron/");
88
+ }
89
+
90
+ function checkAppleDevice() {
91
+ return !!isBrowser && (navigator.platform.startsWith("Mac") || "iPhone" === navigator.platform);
92
+ }
93
+
94
+ function checkTouchDevice() {
95
+ return !!isBrowser && ("ontouchstart" in globalThis || navigator.maxTouchPoints > 0);
96
+ }
97
+
98
+ function getDpr() {
99
+ var _a;
100
+ return isBrowser && null !== (_a = Math.min(Math.ceil(window.devicePixelRatio), 3)) && void 0 !== _a ? _a : 1;
101
+ }
102
+
103
+ function createLocationError(message, code) {
104
+ return new Error(message, {
105
+ cause: {
106
+ code: code
107
+ }
108
+ });
109
+ }
110
+
111
+ function getViewportWindow() {
112
+ var _a;
113
+ return isBrowser ? null !== (_a = window.top) && void 0 !== _a ? _a : globalThis : null;
114
+ }
115
+
116
+ function handleResize() {
117
+ if (!isBrowser) return;
118
+ const {formFactor: formFactor, viewportWidth: viewportWidth, viewportHeight: viewportHeight, height: height} = processWindowSize();
119
+ useWindowStore.setState({
120
+ formFactor: formFactor,
121
+ viewportWidth: viewportWidth,
122
+ viewportHeight: viewportHeight,
123
+ height: height
124
+ });
125
+ }
126
+
127
+ function processWindowSize(top = !0) {
128
+ var _a, _b;
129
+ if (!isBrowser) return {
130
+ formFactor: exports.FormFactor.Mobile,
131
+ viewportWidth: -1,
132
+ viewportHeight: -1,
133
+ height: "100vh"
134
+ };
135
+ 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;
136
+ return {
137
+ formFactor: getFormFactor(windowWidth),
138
+ viewportWidth: windowWidth,
139
+ viewportHeight: windowHeight,
140
+ height: viewport && touch ? `${windowHeight}px` : "100vh"
141
+ };
142
+ }
143
+
144
+ exports.dpr = () => useWindowStore.getState().dpr, exports.formFactor = () => useWindowStore.getState().formFactor,
145
+ exports.gettingLocation = () => useWindowStore.getState().gettingLocation, exports.isAppleDevice = () => useWindowStore.getState().isAppleDevice,
146
+ exports.isElectron = () => useWindowStore.getState().isElectron, exports.isTouchDevice = () => useWindowStore.getState().isTouchDevice,
147
+ exports.location = () => useWindowStore.getState().location, exports.locationError = () => useWindowStore.getState().locationError,
148
+ exports.useDpr = () => useWindowStore(state => state.dpr), exports.useFormFactor = () => useWindowStore(state => state.formFactor),
149
+ exports.useGetLocation = () => useWindowStore(state => state.actions.getLocation),
150
+ exports.useGettingLocation = () => useWindowStore(state => state.gettingLocation),
151
+ exports.useInitializeWindow = () => useWindowStore(state => state.actions.initialize),
152
+ exports.useIsAppleDevice = () => useWindowStore(state => state.isAppleDevice), exports.useIsElectron = () => useWindowStore(state => state.isElectron),
153
+ exports.useIsTouchDevice = () => useWindowStore(state => state.isTouchDevice), exports.useLocation = () => useWindowStore(state => state.location),
154
+ exports.useLocationError = () => useWindowStore(state => state.locationError), exports.useViewportHeight = () => useWindowStore(state => state.viewportHeight),
155
+ exports.useViewportWidth = () => useWindowStore(state => state.viewportWidth), exports.useWindowStore = useWindowStore,
156
+ exports.viewportHeight = () => useWindowStore.getState().viewportHeight, exports.viewportWidth = () => useWindowStore.getState().viewportWidth;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
 
3
- var Button = require("../../chunks/Button-TfMwGVI5.js");
3
+ var Button = require("../../chunks/Button-krf4dQeL.js");
4
4
 
5
5
  require("../../chunks/tslib.es6-C8dZW5nY.js"), require("react/jsx-runtime"), require("motion/react"),
6
6
  require("react"), require("../../chunks/Badge-CY_DG6cD.js"), require("../../chunks/style-inject.es-CMuL-BfJ.js"),
7
- require("../../chunks/Dot-_HCJ3qxd.js"), require("../../chunks/_types-Cxk9tRiB.js"),
7
+ require("../../chunks/Dot-_HCJ3qxd.js"), require("../../chunks/_types-C_zOsCbB.js"),
8
8
  require("../../hooks/useTheme.js"), require("../../theme/themes.js"), require("../../theme/colors.js"),
9
9
  require("../../theme/corners.js"), require("../../theme/elevations.js"), require("../../theme/motion.js"),
10
10
  require("../../theme/type.js"), require("../../hooks/useObserveTheme.js"), require("../../hooks/useWindow.js"),
11
- require("../../chunks/misc-C-M6KKsH.js"), require("../../chunks/ProgressIndicator-B3-OxGYF.js"),
11
+ require("../../chunks/misc-C-M6KKsH.js"), require("../../chunks/ProgressIndicator-DVD-gD3T.js"),
12
12
  require("../../chunks/sharedTypes-gCECyn2N.js"), exports.Button = Button.Button;