@pickleball/expo-sdk 0.1.1 → 0.2.0

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 (74) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +69 -0
  3. package/dist/advanced-BXDrDl1h.d.ts +316 -0
  4. package/dist/advanced-BdAa2Erv.d.cts +316 -0
  5. package/dist/advanced.cjs +35 -0
  6. package/dist/advanced.d.cts +3 -0
  7. package/dist/advanced.d.ts +3 -0
  8. package/dist/advanced.js +35 -0
  9. package/dist/chunk-2JHULJZ7.js +265 -0
  10. package/dist/chunk-6JOMESNT.js +9 -0
  11. package/dist/chunk-7OX2DSKI.cjs +33 -0
  12. package/dist/chunk-DHDX3ZOO.js +800 -0
  13. package/dist/chunk-FODE2W2H.js +1953 -0
  14. package/dist/chunk-KFQGP6VL.js +33 -0
  15. package/dist/chunk-LCWGNGEN.cjs +265 -0
  16. package/dist/chunk-TBPR2QND.cjs +1953 -0
  17. package/dist/chunk-TRLASNPQ.cjs +9 -0
  18. package/dist/chunk-YGSQ25UA.cjs +800 -0
  19. package/dist/device-agent/index.cjs +498 -0
  20. package/dist/device-agent/index.d.cts +157 -0
  21. package/dist/device-agent/index.d.ts +157 -0
  22. package/dist/device-agent/index.js +498 -0
  23. package/dist/engine-CCSSqPbZ.d.cts +516 -0
  24. package/dist/engine-CCSSqPbZ.d.ts +516 -0
  25. package/dist/index.cjs +339 -5569
  26. package/dist/index.d.cts +22 -1406
  27. package/dist/index.d.ts +22 -1406
  28. package/dist/index.js +269 -5401
  29. package/dist/match/index.cjs +2456 -0
  30. package/dist/match/index.d.cts +253 -0
  31. package/dist/match/index.d.ts +253 -0
  32. package/dist/match/index.js +2456 -0
  33. package/dist/match/remote/index.cjs +21 -0
  34. package/dist/match/remote/index.d.cts +67 -0
  35. package/dist/match/remote/index.d.ts +67 -0
  36. package/dist/match/remote/index.js +21 -0
  37. package/dist/match/voice/index.cjs +23 -0
  38. package/dist/match/voice/index.d.cts +114 -0
  39. package/dist/match/voice/index.d.ts +114 -0
  40. package/dist/match/voice/index.js +23 -0
  41. package/dist/plugin.cjs +53 -70
  42. package/dist/plugin.d.cts +13 -0
  43. package/dist/plugin.d.ts +13 -0
  44. package/dist/plugin.js +20 -15
  45. package/dist/types-CrmcX408.d.cts +176 -0
  46. package/dist/types-CrmcX408.d.ts +176 -0
  47. package/dist/types-DiKWjwvN.d.cts +96 -0
  48. package/dist/types-DiKWjwvN.d.ts +96 -0
  49. package/dist/version.cjs +4 -32
  50. package/dist/version.js +2 -1
  51. package/package.json +68 -4
  52. package/src/advanced.ts +47 -0
  53. package/src/device-agent/agent.ts +443 -0
  54. package/src/device-agent/component.tsx +49 -0
  55. package/src/device-agent/convex-control-channel.ts +82 -0
  56. package/src/device-agent/http-transport.ts +143 -0
  57. package/src/device-agent/index.ts +4 -0
  58. package/src/engine.ts +21 -5
  59. package/src/errors.ts +16 -0
  60. package/src/http-session-provider.ts +19 -13
  61. package/src/index.ts +38 -14
  62. package/src/livekit-room-adapter.ts +39 -2
  63. package/src/livestream-screen.tsx +26 -4
  64. package/src/match/index.ts +29 -0
  65. package/src/match/provider.tsx +4 -2
  66. package/src/match/remote/hid-gesture.ts +10 -2
  67. package/src/match/remote/types.ts +6 -4
  68. package/src/match/voice/scheduler.ts +6 -1
  69. package/src/match/voice/service.ts +16 -4
  70. package/src/native-runtime.ts +54 -4
  71. package/src/plugin.ts +35 -14
  72. package/src/provider.tsx +35 -4
  73. package/src/rtmp-room-adapter.ts +196 -0
  74. package/dist/chunk-VHLUJQG5.js +0 -17
@@ -0,0 +1,33 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
6
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
7
+ }) : x)(function(x) {
8
+ if (typeof require !== "undefined") return require.apply(this, arguments);
9
+ throw Error('Dynamic require of "' + x + '" is not supported');
10
+ });
11
+ var __esm = (fn, res) => function __init() {
12
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
13
+ };
14
+ var __export = (target, all) => {
15
+ for (var name in all)
16
+ __defProp(target, name, { get: all[name], enumerable: true });
17
+ };
18
+ var __copyProps = (to, from, except, desc) => {
19
+ if (from && typeof from === "object" || typeof from === "function") {
20
+ for (let key of __getOwnPropNames(from))
21
+ if (!__hasOwnProp.call(to, key) && key !== except)
22
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
23
+ }
24
+ return to;
25
+ };
26
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
27
+
28
+ export {
29
+ __require,
30
+ __esm,
31
+ __export,
32
+ __toCommonJS
33
+ };
@@ -0,0 +1,265 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4;// src/match/remote/deduplicator.ts
2
+ var BTHomeRemoteDeduplicator = (_class = class {
3
+ __init() {this.devices = /* @__PURE__ */ new Map()}
4
+
5
+ constructor(options = {}) {;_class.prototype.__init.call(this);
6
+ this.fingerprintWindowMs = _nullishCoalesce(options.fingerprintWindowMs, () => ( 300));
7
+ }
8
+ get trackedDeviceCount() {
9
+ return this.devices.size;
10
+ }
11
+ accept(deviceId, key, now = Date.now()) {
12
+ const previous = this.devices.get(deviceId);
13
+ if (key.packetId !== void 0) {
14
+ if (_optionalChain([previous, 'optionalAccess', _ => _.packetId]) === key.packetId) return false;
15
+ this.devices.set(deviceId, { packetId: key.packetId });
16
+ return true;
17
+ }
18
+ if (_optionalChain([previous, 'optionalAccess', _2 => _2.fingerprint]) === key.fingerprint && previous.fingerprintSeenAt !== void 0 && now - previous.fingerprintSeenAt <= this.fingerprintWindowMs) {
19
+ return false;
20
+ }
21
+ this.devices.set(deviceId, { fingerprint: key.fingerprint, fingerprintSeenAt: now });
22
+ return true;
23
+ }
24
+ forget(deviceId) {
25
+ this.devices.delete(deviceId);
26
+ }
27
+ clear() {
28
+ this.devices.clear();
29
+ }
30
+ }, _class);
31
+
32
+ // src/match/remote/encoding.ts
33
+ function decodeBase64Bytes(value) {
34
+ if (typeof globalThis.atob !== "function") {
35
+ throw new Error("Base64 decoding is unavailable in this runtime");
36
+ }
37
+ const binary = globalThis.atob(value);
38
+ const bytes = new Uint8Array(binary.length);
39
+ for (let index = 0; index < binary.length; index += 1) {
40
+ bytes[index] = binary.charCodeAt(index);
41
+ }
42
+ return bytes;
43
+ }
44
+
45
+ // src/match/remote/hid-gesture.ts
46
+ var HidVolumeGestureRecognizer = (_class2 = class {
47
+ constructor(options) {;_class2.prototype.__init2.call(this);_class2.prototype.__init3.call(this);_class2.prototype.__init4.call(this);_class2.prototype.__init5.call(this);
48
+ this.options = options;
49
+ }
50
+ __init2() {this.count = 0}
51
+ __init3() {this.resolved = false}
52
+ __init4() {this.lastTimestamp = null}
53
+ __init5() {this.timer = null}
54
+ push(event) {
55
+ if (this.options.direction !== "any" && event.direction !== this.options.direction) return;
56
+ if (this.lastTimestamp !== null && event.timestamp - this.lastTimestamp > this.options.settleMs) {
57
+ this.finishBurst();
58
+ }
59
+ this.lastTimestamp = event.timestamp;
60
+ this.clearTimer();
61
+ if (!this.resolved) {
62
+ this.count += 1;
63
+ if (event.longPress || this.count >= this.options.holdEventCount) {
64
+ this.resolved = true;
65
+ this.options.onGesture("hold");
66
+ }
67
+ }
68
+ this.timer = setTimeout(() => this.finishBurst(), this.options.settleMs);
69
+ }
70
+ dispose() {
71
+ this.clearTimer();
72
+ this.reset();
73
+ }
74
+ finishBurst() {
75
+ this.clearTimer();
76
+ if (!this.resolved && this.count > 0) {
77
+ this.options.onGesture(
78
+ this.count === 1 ? "single" : this.count === 2 ? "double" : this.count === 3 ? "triple" : "quadruple"
79
+ );
80
+ }
81
+ this.reset();
82
+ }
83
+ clearTimer() {
84
+ if (this.timer) clearTimeout(this.timer);
85
+ this.timer = null;
86
+ }
87
+ reset() {
88
+ this.count = 0;
89
+ this.resolved = false;
90
+ this.lastTimestamp = null;
91
+ }
92
+ }, _class2);
93
+
94
+ // src/match/remote/types.ts
95
+ var BTHOME_SERVICE_UUID = "FCD2";
96
+ var DEFAULT_REMOTE_ACTION_MAPPING = {
97
+ volumeUp: "left",
98
+ volumeDown: "right",
99
+ longPress: "undo"
100
+ };
101
+ var RemoteError = (_class3 = class extends Error {
102
+ constructor(code, message, options) {
103
+ super(message, options);_class3.prototype.__init6.call(this);;
104
+ this.code = code;
105
+ }
106
+ __init6() {this.name = "RemoteError"}
107
+ }, _class3);
108
+
109
+ // src/match/remote/parser.ts
110
+ var BTHomeRemoteParseError = (_class4 = class extends Error {
111
+ constructor(code, message) {
112
+ super(message);_class4.prototype.__init7.call(this);;
113
+ this.code = code;
114
+ }
115
+ __init7() {this.name = "BTHomeRemoteParseError"}
116
+ }, _class4);
117
+ var OBJECT_LENGTHS = Object.freeze({
118
+ 0: 1,
119
+ 1: 1,
120
+ 2: 2,
121
+ 3: 2,
122
+ 4: 3,
123
+ 5: 3,
124
+ 6: 2,
125
+ 7: 2,
126
+ 8: 2,
127
+ 9: 1,
128
+ 10: 3,
129
+ 11: 3,
130
+ 12: 2,
131
+ 13: 2,
132
+ 14: 2,
133
+ 15: 1,
134
+ 16: 1,
135
+ 17: 1,
136
+ 18: 2,
137
+ 19: 2,
138
+ 20: 2,
139
+ 21: 1,
140
+ 22: 1,
141
+ 23: 1,
142
+ 24: 1,
143
+ 25: 1,
144
+ 26: 1,
145
+ 27: 1,
146
+ 28: 1,
147
+ 29: 1,
148
+ 30: 1,
149
+ 31: 1,
150
+ 32: 1,
151
+ 33: 1,
152
+ 34: 1,
153
+ 35: 1,
154
+ 36: 1,
155
+ 37: 1,
156
+ 38: 1,
157
+ 39: 1,
158
+ 40: 1,
159
+ 41: 1,
160
+ 42: 1,
161
+ 43: 1,
162
+ 44: 1,
163
+ 45: 1,
164
+ 46: 1,
165
+ 47: 1,
166
+ 58: 1,
167
+ 60: 2,
168
+ 61: 2,
169
+ 62: 4,
170
+ 63: 2,
171
+ 64: 1,
172
+ 65: 1,
173
+ 66: 1,
174
+ 67: 1,
175
+ 68: 2,
176
+ 69: 2,
177
+ 70: 4,
178
+ 71: 4,
179
+ 72: 4,
180
+ 73: 2,
181
+ 74: 2,
182
+ 75: 2,
183
+ 76: 4,
184
+ 77: 4,
185
+ 78: 4,
186
+ 79: 4
187
+ });
188
+ function isBTHomeUuid(uuid) {
189
+ const normalized = uuid.toLowerCase().replaceAll("-", "");
190
+ return normalized === "fcd2" || normalized === "0000fcd200001000800000805f9b34fb";
191
+ }
192
+ function fingerprint(bytes) {
193
+ return Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");
194
+ }
195
+ function mapButtonEvent(value) {
196
+ if (value === 1) return "single";
197
+ if (value === 2) return "double";
198
+ if (value === 4 || value === 128) return "long";
199
+ if (value === 0 || value === 3 || value === 5 || value === 6) return null;
200
+ return void 0;
201
+ }
202
+ function parseBTHomeV2Advertisement(input) {
203
+ if (!isBTHomeUuid(input.serviceUuid)) {
204
+ throw new BTHomeRemoteParseError("wrong_uuid", `Expected ${BTHOME_SERVICE_UUID} service data`);
205
+ }
206
+ if (input.serviceData.length < 1) {
207
+ throw new BTHomeRemoteParseError("truncated", "BTHome device-info byte is missing");
208
+ }
209
+ const info = input.serviceData[0];
210
+ const version = info >> 5 & 7;
211
+ if (version !== 2) {
212
+ throw new BTHomeRemoteParseError("unsupported_version", `Unsupported BTHome version ${version}`);
213
+ }
214
+ if ((info & 1) !== 0) {
215
+ throw new BTHomeRemoteParseError("encrypted", "Encrypted BTHome advertisements are unsupported");
216
+ }
217
+ let offset = 1;
218
+ let objectIndex = 0;
219
+ let packetId;
220
+ let button;
221
+ while (offset < input.serviceData.length) {
222
+ const objectId = input.serviceData[offset++];
223
+ const length = OBJECT_LENGTHS[objectId];
224
+ if (length === void 0) {
225
+ throw new BTHomeRemoteParseError("unknown_object", `Unknown BTHome object 0x${objectId.toString(16)}`);
226
+ }
227
+ if (offset + length > input.serviceData.length) {
228
+ throw new BTHomeRemoteParseError("truncated", `BTHome object 0x${objectId.toString(16)} is truncated`);
229
+ }
230
+ if (objectId === 0 && packetId === void 0) packetId = input.serviceData[offset];
231
+ if (objectId === 58 && !button) {
232
+ const rawEvent = input.serviceData[offset];
233
+ const action = mapButtonEvent(rawEvent);
234
+ if (action === void 0) {
235
+ throw new BTHomeRemoteParseError("invalid_button_event", `Reserved button event 0x${rawEvent.toString(16)}`);
236
+ }
237
+ if (action) button = { action, objectIndex, rawEvent };
238
+ }
239
+ offset += length;
240
+ objectIndex += 1;
241
+ }
242
+ if (!button) {
243
+ throw new BTHomeRemoteParseError("no_button", "No actionable BTHome button event was found");
244
+ }
245
+ return {
246
+ deviceId: input.deviceId,
247
+ version: 2,
248
+ encrypted: false,
249
+ triggerBased: (info & 4) !== 0,
250
+ packetId,
251
+ button,
252
+ fingerprint: fingerprint(input.serviceData)
253
+ };
254
+ }
255
+
256
+
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+ exports.BTHomeRemoteDeduplicator = BTHomeRemoteDeduplicator; exports.decodeBase64Bytes = decodeBase64Bytes; exports.HidVolumeGestureRecognizer = HidVolumeGestureRecognizer; exports.BTHOME_SERVICE_UUID = BTHOME_SERVICE_UUID; exports.DEFAULT_REMOTE_ACTION_MAPPING = DEFAULT_REMOTE_ACTION_MAPPING; exports.RemoteError = RemoteError; exports.BTHomeRemoteParseError = BTHomeRemoteParseError; exports.parseBTHomeV2Advertisement = parseBTHomeV2Advertisement;