@aippy/runtime 0.2.6 → 0.2.7-dev.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.
@@ -1,4 +1,5 @@
1
- import { a as v, A as d, C as u, E as A, R as _, b as m, c as R, p as g } from "../runtime-DjBdOttl.js";
1
+ import { A as v, E as d, c as u } from "../errors-CDEBaBxB.js";
2
+ import { A as m, C as _, R, a as g, p as I } from "../runtime-CmoG3v2m.js";
2
3
  const s = {
3
4
  mode: "development",
4
5
  debug: !1,
@@ -9,7 +10,7 @@ function o() {
9
10
  const e = {};
10
11
  return typeof process < "u" && process.env && (process.env.NODE_ENV && (e.mode = process.env.NODE_ENV), process.env.AIPPY_DEBUG && (e.debug = process.env.AIPPY_DEBUG === "true"), process.env.AIPPY_API_BASE_URL && (e.apiBaseUrl = process.env.AIPPY_API_BASE_URL)), e;
11
12
  }
12
- function c(e) {
13
+ function p(e) {
13
14
  const n = o();
14
15
  return {
15
16
  ...s,
@@ -22,10 +23,10 @@ function c(e) {
22
23
  }
23
24
  };
24
25
  }
25
- const r = "0.2.6", a = {
26
+ const r = "0.2.7-dev.0", a = {
26
27
  version: r
27
28
  }, i = a.version, t = "@aippy/runtime";
28
- function p() {
29
+ function c() {
29
30
  return {
30
31
  name: t,
31
32
  version: i,
@@ -33,18 +34,18 @@ function p() {
33
34
  };
34
35
  }
35
36
  export {
36
- v as AippyRuntime,
37
- d as AippyRuntimeError,
38
- u as Cancellable,
37
+ m as AippyRuntime,
38
+ v as AippyRuntimeError,
39
+ _ as Cancellable,
39
40
  s as DEFAULT_CONFIG,
40
- A as ERROR_CODES,
41
- _ as ReceiveChannel,
41
+ d as ERROR_CODES,
42
+ R as ReceiveChannel,
42
43
  t as SDK_NAME,
43
44
  i as VERSION,
44
- m as aippyRuntime,
45
- R as createError,
45
+ g as aippyRuntime,
46
+ u as createError,
46
47
  o as getConfigFromEnv,
47
- p as getVersionInfo,
48
- c as mergeConfig,
49
- g as processMotionData
48
+ c as getVersionInfo,
49
+ p as mergeConfig,
50
+ I as processMotionData
50
51
  };
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Native Bridge Detection
3
+ * Shared utility for detecting iOS native bridge availability
4
+ */
5
+ /**
6
+ * Check if native bridge is available (iOS WebView)
7
+ * Used by both device and user modules
8
+ */
9
+ export declare function hasNativeBridge(): boolean;
@@ -1,10 +1,12 @@
1
1
  var D = Object.defineProperty;
2
2
  var U = (n, e, t) => e in n ? D(n, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : n[e] = t;
3
- var N = (n, e, t) => U(n, typeof e != "symbol" ? e + "" : e, t);
4
- import { c as s, b as L } from "../runtime-DjBdOttl.js";
5
- class T {
3
+ var I = (n, e, t) => U(n, typeof e != "symbol" ? e + "" : e, t);
4
+ import { c as s } from "../errors-CDEBaBxB.js";
5
+ import { a as T } from "../runtime-CmoG3v2m.js";
6
+ import { h as N } from "../native-bridge-JAmH-zTN.js";
7
+ class L {
6
8
  constructor() {
7
- N(this, "stream", null);
9
+ I(this, "stream", null);
8
10
  }
9
11
  /**
10
12
  * Check if camera is supported
@@ -43,20 +45,20 @@ class T {
43
45
  try {
44
46
  const t = document.createElement("video");
45
47
  t.srcObject = this.stream, t.play();
46
- const i = document.createElement("canvas"), o = i.getContext("2d");
47
- if (!o)
48
+ const o = document.createElement("canvas"), i = o.getContext("2d");
49
+ if (!i)
48
50
  throw s("Failed to get canvas context", "UNKNOWN_ERROR");
49
- i.width = e.width || t.videoWidth, i.height = e.height || t.videoHeight, o.drawImage(t, 0, 0, i.width, i.height);
51
+ o.width = e.width || t.videoWidth, o.height = e.height || t.videoHeight, i.drawImage(t, 0, 0, o.width, o.height);
50
52
  const r = e.format || "jpeg", c = e.quality === "high" ? 0.9 : e.quality === "medium" ? 0.7 : 0.5, a = await new Promise((u, m) => {
51
- i.toBlob((l) => {
53
+ o.toBlob((l) => {
52
54
  l ? u(l) : m(new Error("Failed to create blob"));
53
55
  }, `image/${r}`, c);
54
- }), d = i.toDataURL(`image/${r}`, c);
56
+ }), d = o.toDataURL(`image/${r}`, c);
55
57
  return {
56
58
  blob: a,
57
59
  dataUrl: d,
58
- width: i.width,
59
- height: i.height
60
+ width: o.width,
61
+ height: o.height
60
62
  };
61
63
  } catch (t) {
62
64
  throw s(
@@ -72,7 +74,7 @@ class T {
72
74
  this.stream && (this.stream.getTracks().forEach((e) => e.stop()), this.stream = null);
73
75
  }
74
76
  }
75
- const C = new T();
77
+ const X = new L();
76
78
  class k {
77
79
  /**
78
80
  * Check if geolocation is supported
@@ -86,8 +88,8 @@ class k {
86
88
  async getCurrentPosition(e = {}) {
87
89
  if (!this.isSupported())
88
90
  throw s("Geolocation API is not supported", "NOT_SUPPORTED");
89
- return new Promise((t, i) => {
90
- const o = {
91
+ return new Promise((t, o) => {
92
+ const i = {
91
93
  enableHighAccuracy: e.enableHighAccuracy ?? !0,
92
94
  timeout: e.timeout ?? 1e4,
93
95
  maximumAge: e.maximumAge ?? 6e4
@@ -119,9 +121,9 @@ class k {
119
121
  a = "Geolocation timeout";
120
122
  break;
121
123
  }
122
- i(s(a, c));
124
+ o(s(a, c));
123
125
  },
124
- o
126
+ i
125
127
  );
126
128
  });
127
129
  }
@@ -131,29 +133,29 @@ class k {
131
133
  watchPosition(e, t = {}) {
132
134
  if (!this.isSupported())
133
135
  throw s("Geolocation API is not supported", "NOT_SUPPORTED");
134
- const i = {
136
+ const o = {
135
137
  enableHighAccuracy: t.enableHighAccuracy ?? !0,
136
138
  timeout: t.timeout ?? 1e4,
137
139
  maximumAge: t.maximumAge ?? 6e4
138
140
  };
139
141
  return navigator.geolocation.watchPosition(
140
- (o) => {
142
+ (i) => {
141
143
  const r = {
142
- latitude: o.coords.latitude,
143
- longitude: o.coords.longitude,
144
- accuracy: o.coords.accuracy,
145
- altitude: o.coords.altitude ?? void 0,
146
- altitudeAccuracy: o.coords.altitudeAccuracy ?? void 0,
147
- heading: o.coords.heading ?? void 0,
148
- speed: o.coords.speed ?? void 0,
149
- timestamp: o.timestamp
144
+ latitude: i.coords.latitude,
145
+ longitude: i.coords.longitude,
146
+ accuracy: i.coords.accuracy,
147
+ altitude: i.coords.altitude ?? void 0,
148
+ altitudeAccuracy: i.coords.altitudeAccuracy ?? void 0,
149
+ heading: i.coords.heading ?? void 0,
150
+ speed: i.coords.speed ?? void 0,
151
+ timestamp: i.timestamp
150
152
  };
151
153
  e(r);
152
154
  },
153
- (o) => {
154
- console.error("Geolocation watch error:", o);
155
+ (i) => {
156
+ console.error("Geolocation watch error:", i);
155
157
  },
156
- i
158
+ o
157
159
  );
158
160
  }
159
161
  /**
@@ -163,24 +165,14 @@ class k {
163
165
  navigator.geolocation.clearWatch(e);
164
166
  }
165
167
  }
166
- const K = new k();
168
+ const Y = new k();
167
169
  function E() {
168
170
  return "DeviceMotionEvent" in window;
169
171
  }
170
- function I() {
171
- return "DeviceOrientationEvent" in window;
172
- }
173
172
  function R() {
174
- const n = typeof window < "u", e = n && !!window.webkit, t = e && !!window.webkit?.messageHandlers, i = t && !!window.webkit?.messageHandlers?.aippyListener;
175
- return console.log("🔍 [Aippy Sensors] hasNativeBridge check:", {
176
- hasWindow: n,
177
- hasWebkit: e,
178
- hasMessageHandlers: t,
179
- hasAippyListener: i,
180
- result: i
181
- }), i;
173
+ return "DeviceOrientationEvent" in window;
182
174
  }
183
- function b() {
175
+ function M() {
184
176
  return typeof window < "u" && typeof window.orientation < "u" ? window.orientation : typeof window < "u" && window.screen?.orientation?.angle !== void 0 ? window.screen.orientation.angle : 0;
185
177
  }
186
178
  function P(n, e, t) {
@@ -198,7 +190,7 @@ function P(n, e, t) {
198
190
  }
199
191
  }
200
192
  async function x() {
201
- if (console.log("🔐 [Aippy Sensors] requestMotionPermission called"), R())
193
+ if (console.log("🔐 [Aippy Sensors] requestMotionPermission called"), N())
202
194
  return console.log("✅ [Aippy Sensors] Native bridge available, skipping permission request"), !0;
203
195
  if (!E())
204
196
  return console.warn("❌ [Aippy Sensors] Device motion not supported"), !1;
@@ -215,24 +207,24 @@ async function x() {
215
207
  }
216
208
  function F(n) {
217
209
  console.log("🔧 [Aippy Sensors] watchMotionNative - Setting up native bridge listener");
218
- const e = L.addMotionListener((t) => {
219
- const i = b(), o = t.gravity?.x ?? 0, r = t.gravity?.y ?? 0, c = t.gravity?.z ?? 0, a = t.userAcceleration?.x ?? 0, d = t.userAcceleration?.y ?? 0, u = t.userAcceleration?.z ?? 0, [m, l] = P(o, r, i), [y, f] = P(a, d, i), g = t.attitude && typeof t.attitude.yaw == "number" && typeof t.attitude.pitch == "number" && typeof t.attitude.roll == "number";
210
+ const e = T.addMotionListener((t) => {
211
+ const o = M(), i = t.gravity?.x ?? 0, r = t.gravity?.y ?? 0, c = t.gravity?.z ?? 0, a = t.userAcceleration?.x ?? 0, d = t.userAcceleration?.y ?? 0, u = t.userAcceleration?.z ?? 0, [m, l] = P(i, r, o), [g, f] = P(a, d, o), y = t.attitude && typeof t.attitude.yaw == "number" && typeof t.attitude.pitch == "number" && typeof t.attitude.roll == "number";
220
212
  let p = 0;
221
- g && (p = t.attitude.yaw * (180 / Math.PI), p < 0 && (p += 360));
213
+ y && (p = t.attitude.yaw * (180 / Math.PI), p < 0 && (p += 360));
222
214
  const v = {
223
215
  gravity: { x: m, y: l, z: c },
224
- acceleration: { x: y, y: f, z: u },
216
+ acceleration: { x: g, y: f, z: u },
225
217
  accelerationIncludingGravity: {
226
- x: m + y,
218
+ x: m + g,
227
219
  y: l + f,
228
220
  z: c + u
229
221
  },
230
222
  rotation: {
231
- alpha: g ? p : (t.rotationRate?.z ?? 0) * (180 / Math.PI),
223
+ alpha: y ? p : (t.rotationRate?.z ?? 0) * (180 / Math.PI),
232
224
  beta: (t.rotationRate?.x ?? 0) * (180 / Math.PI),
233
225
  gamma: (t.rotationRate?.y ?? 0) * (180 / Math.PI)
234
226
  },
235
- attitude: g ? {
227
+ attitude: y ? {
236
228
  yaw: p,
237
229
  pitch: t.attitude.pitch * (180 / Math.PI),
238
230
  roll: t.attitude.roll * (180 / Math.PI),
@@ -265,10 +257,10 @@ async function _() {
265
257
  function A(n, e = !0) {
266
258
  if (!E())
267
259
  throw s("Device motion API is not supported", "NOT_SUPPORTED");
268
- let t = !1, i = null;
269
- const o = (a) => {
260
+ let t = !1, o = null;
261
+ const i = (a) => {
270
262
  if (!t) return;
271
- const d = b();
263
+ const d = M();
272
264
  let u, m, l;
273
265
  if (a.acceleration) {
274
266
  const w = a.accelerationIncludingGravity, h = a.acceleration;
@@ -277,13 +269,13 @@ function A(n, e = !0) {
277
269
  const w = a.accelerationIncludingGravity, h = 9.8;
278
270
  u = (w?.x ?? 0) / h, m = (w?.y ?? 0) / h, l = (w?.z ?? 0) / h;
279
271
  }
280
- const y = a.acceleration?.x ?? 0, f = a.acceleration?.y ?? 0, g = a.acceleration?.z ?? 0, [p, v] = P(u, m, d), [O, S] = P(y, f, d), M = {
272
+ const g = a.acceleration?.x ?? 0, f = a.acceleration?.y ?? 0, y = a.acceleration?.z ?? 0, [p, v] = P(u, m, d), [O, S] = P(g, f, d), b = {
281
273
  gravity: { x: p, y: v, z: l },
282
- acceleration: { x: O, y: S, z: g },
274
+ acceleration: { x: O, y: S, z: y },
283
275
  accelerationIncludingGravity: {
284
276
  x: p + O,
285
277
  y: v + S,
286
- z: l + g
278
+ z: l + y
287
279
  },
288
280
  rotation: {
289
281
  alpha: a.rotationRate?.alpha ?? 0,
@@ -292,51 +284,51 @@ function A(n, e = !0) {
292
284
  },
293
285
  timestamp: Date.now()
294
286
  };
295
- n(M);
287
+ n(b);
296
288
  }, r = async () => {
297
- e && !await _() || (t = !0, window.addEventListener("devicemotion", o));
289
+ e && !await _() || (t = !0, window.addEventListener("devicemotion", i));
298
290
  };
299
291
  return (async () => {
300
292
  if (typeof DeviceMotionEvent < "u" && typeof DeviceMotionEvent.requestPermission == "function" && e) {
301
293
  const d = async () => {
302
- i = null, await r();
294
+ o = null, await r();
303
295
  };
304
- window.addEventListener("click", d, { once: !0 }), window.addEventListener("touchstart", d, { once: !0 }), i = () => {
296
+ window.addEventListener("click", d, { once: !0 }), window.addEventListener("touchstart", d, { once: !0 }), o = () => {
305
297
  window.removeEventListener("click", d), window.removeEventListener("touchstart", d);
306
298
  };
307
299
  } else
308
300
  await r();
309
301
  })(), () => {
310
- t = !1, window.removeEventListener("devicemotion", o), i && (i(), i = null);
302
+ t = !1, window.removeEventListener("devicemotion", i), o && (o(), o = null);
311
303
  };
312
304
  }
313
305
  function q(n, e, t = 500) {
314
- let i = !1, o = null;
306
+ let o = !1, i = null;
315
307
  const r = F((a) => {
316
- i || (i = !0, clearTimeout(c)), n(a);
308
+ o || (o = !0, clearTimeout(c)), n(a);
317
309
  }), c = setTimeout(async () => {
318
- if (!i) {
310
+ if (!o) {
319
311
  if (console.warn("[Aippy Sensors] No native data, falling back to Web API"), r(), typeof DeviceMotionEvent < "u" && typeof DeviceMotionEvent.requestPermission == "function" && e)
320
312
  try {
321
313
  if (console.log("[Aippy Sensors] Trying direct permission request..."), await DeviceMotionEvent.requestPermission() === "granted") {
322
- console.log("[Aippy Sensors] Permission granted via fallback"), o = A(n, !1);
314
+ console.log("[Aippy Sensors] Permission granted via fallback"), i = A(n, !1);
323
315
  return;
324
316
  }
325
317
  } catch {
326
318
  console.log("[Aippy Sensors] Direct permission failed, waiting for user interaction");
327
319
  }
328
- o = A(n, e);
320
+ i = A(n, e);
329
321
  }
330
322
  }, t);
331
323
  return () => {
332
- clearTimeout(c), r(), o?.();
324
+ clearTimeout(c), r(), i?.();
333
325
  };
334
326
  }
335
- function X(n, e = !0) {
336
- return R() ? q(n, e) : A(n, e);
327
+ function j(n, e = !0) {
328
+ return N() ? q(n, e) : A(n, e);
337
329
  }
338
- function Y(n) {
339
- if (!I())
330
+ function $(n) {
331
+ if (!R())
340
332
  throw s("Device orientation API is not supported", "NOT_SUPPORTED");
341
333
  const e = (t) => {
342
334
  n({
@@ -352,7 +344,7 @@ function Y(n) {
352
344
  }
353
345
  class z {
354
346
  isOrientationSupported() {
355
- return I();
347
+ return R();
356
348
  }
357
349
  isMotionSupported() {
358
350
  return E();
@@ -361,16 +353,16 @@ class z {
361
353
  if (!this.isOrientationSupported())
362
354
  throw s("Device orientation API is not supported", "NOT_SUPPORTED");
363
355
  return new Promise((e, t) => {
364
- const i = (o) => {
365
- window.removeEventListener("deviceorientation", i), e({
366
- x: o.alpha ?? 0,
367
- y: o.beta ?? 0,
368
- z: o.gamma ?? 0,
356
+ const o = (i) => {
357
+ window.removeEventListener("deviceorientation", o), e({
358
+ x: i.alpha ?? 0,
359
+ y: i.beta ?? 0,
360
+ z: i.gamma ?? 0,
369
361
  timestamp: Date.now()
370
362
  });
371
363
  };
372
- window.addEventListener("deviceorientation", i), setTimeout(() => {
373
- window.removeEventListener("deviceorientation", i), t(s("Device orientation timeout", "UNKNOWN_ERROR"));
364
+ window.addEventListener("deviceorientation", o), setTimeout(() => {
365
+ window.removeEventListener("deviceorientation", o), t(s("Device orientation timeout", "UNKNOWN_ERROR"));
374
366
  }, 5e3);
375
367
  });
376
368
  }
@@ -378,11 +370,11 @@ class z {
378
370
  watchOrientation(e) {
379
371
  if (!this.isOrientationSupported())
380
372
  throw s("Device orientation API is not supported", "NOT_SUPPORTED");
381
- const t = (i) => {
373
+ const t = (o) => {
382
374
  e({
383
- x: i.alpha ?? 0,
384
- y: i.beta ?? 0,
385
- z: i.gamma ?? 0,
375
+ x: o.alpha ?? 0,
376
+ y: o.beta ?? 0,
377
+ z: o.gamma ?? 0,
386
378
  timestamp: Date.now()
387
379
  });
388
380
  };
@@ -394,16 +386,16 @@ class z {
394
386
  if (!this.isMotionSupported())
395
387
  throw s("Device motion API is not supported", "NOT_SUPPORTED");
396
388
  return new Promise((e, t) => {
397
- const i = (o) => {
398
- window.removeEventListener("devicemotion", i), e({
399
- x: o.acceleration?.x ?? 0,
400
- y: o.acceleration?.y ?? 0,
401
- z: o.acceleration?.z ?? 0,
389
+ const o = (i) => {
390
+ window.removeEventListener("devicemotion", o), e({
391
+ x: i.acceleration?.x ?? 0,
392
+ y: i.acceleration?.y ?? 0,
393
+ z: i.acceleration?.z ?? 0,
402
394
  timestamp: Date.now()
403
395
  });
404
396
  };
405
- window.addEventListener("devicemotion", i), setTimeout(() => {
406
- window.removeEventListener("devicemotion", i), t(s("Device motion timeout", "UNKNOWN_ERROR"));
397
+ window.addEventListener("devicemotion", o), setTimeout(() => {
398
+ window.removeEventListener("devicemotion", o), t(s("Device motion timeout", "UNKNOWN_ERROR"));
407
399
  }, 5e3);
408
400
  });
409
401
  }
@@ -411,11 +403,11 @@ class z {
411
403
  watchMotion(e) {
412
404
  if (!this.isMotionSupported())
413
405
  throw s("Device motion API is not supported", "NOT_SUPPORTED");
414
- const t = (i) => {
406
+ const t = (o) => {
415
407
  e({
416
- x: i.acceleration?.x ?? 0,
417
- y: i.acceleration?.y ?? 0,
418
- z: i.acceleration?.z ?? 0,
408
+ x: o.acceleration?.x ?? 0,
409
+ y: o.acceleration?.y ?? 0,
410
+ z: o.acceleration?.z ?? 0,
419
411
  timestamp: Date.now()
420
412
  });
421
413
  };
@@ -427,8 +419,8 @@ class z {
427
419
  return x();
428
420
  }
429
421
  }
430
- const j = new z();
431
- class W {
422
+ const B = new z();
423
+ class G {
432
424
  /**
433
425
  * Check if file system access is supported
434
426
  */
@@ -456,12 +448,12 @@ class W {
456
448
  )
457
449
  }] : void 0,
458
450
  multiple: e.multiple ?? !1
459
- }, i = await window.showOpenFilePicker(t), o = await Promise.all(
460
- i.map(async (r) => r.getFile())
451
+ }, o = await window.showOpenFilePicker(t), i = await Promise.all(
452
+ o.map(async (r) => r.getFile())
461
453
  );
462
454
  return {
463
- files: o,
464
- paths: o.map((r) => r.name)
455
+ files: i,
456
+ paths: i.map((r) => r.name)
465
457
  };
466
458
  } catch (t) {
467
459
  throw t instanceof Error && t.name === "AbortError" ? s("File picker was cancelled", "PERMISSION_DENIED") : s(
@@ -476,17 +468,17 @@ class W {
476
468
  async openFilePickerLegacy(e = {}) {
477
469
  if (!this.isLegacySupported())
478
470
  throw s("File input is not supported", "NOT_SUPPORTED");
479
- return new Promise((t, i) => {
480
- const o = document.createElement("input");
481
- o.type = "file", o.multiple = e.multiple ?? !1, o.accept = e.accept?.join(",") ?? "", o.onchange = (r) => {
471
+ return new Promise((t, o) => {
472
+ const i = document.createElement("input");
473
+ i.type = "file", i.multiple = e.multiple ?? !1, i.accept = e.accept?.join(",") ?? "", i.onchange = (r) => {
482
474
  const c = r.target, a = Array.from(c.files || []);
483
475
  t({
484
476
  files: a,
485
477
  paths: a.map((d) => d.name)
486
478
  });
487
- }, o.oncancel = () => {
488
- i(s("File picker was cancelled", "PERMISSION_DENIED"));
489
- }, o.click();
479
+ }, i.oncancel = () => {
480
+ o(s("File picker was cancelled", "PERMISSION_DENIED"));
481
+ }, i.click();
490
482
  });
491
483
  }
492
484
  /**
@@ -500,11 +492,11 @@ class W {
500
492
  */
501
493
  async saveFile(e, t) {
502
494
  try {
503
- const i = URL.createObjectURL(e), o = document.createElement("a");
504
- o.href = i, o.download = t, document.body.appendChild(o), o.click(), document.body.removeChild(o), URL.revokeObjectURL(i);
505
- } catch (i) {
495
+ const o = URL.createObjectURL(e), i = document.createElement("a");
496
+ i.href = o, i.download = t, document.body.appendChild(i), i.click(), document.body.removeChild(i), URL.revokeObjectURL(o);
497
+ } catch (o) {
506
498
  throw s(
507
- `Failed to save file: ${i instanceof Error ? i.message : "Unknown error"}`,
499
+ `Failed to save file: ${o instanceof Error ? o.message : "Unknown error"}`,
508
500
  "UNKNOWN_ERROR"
509
501
  );
510
502
  }
@@ -513,23 +505,23 @@ class W {
513
505
  * Read file as text
514
506
  */
515
507
  async readAsText(e) {
516
- return new Promise((t, i) => {
517
- const o = new FileReader();
518
- o.onload = () => t(o.result), o.onerror = () => i(s("Failed to read file", "UNKNOWN_ERROR")), o.readAsText(e);
508
+ return new Promise((t, o) => {
509
+ const i = new FileReader();
510
+ i.onload = () => t(i.result), i.onerror = () => o(s("Failed to read file", "UNKNOWN_ERROR")), i.readAsText(e);
519
511
  });
520
512
  }
521
513
  /**
522
514
  * Read file as data URL
523
515
  */
524
516
  async readAsDataURL(e) {
525
- return new Promise((t, i) => {
526
- const o = new FileReader();
527
- o.onload = () => t(o.result), o.onerror = () => i(s("Failed to read file", "UNKNOWN_ERROR")), o.readAsDataURL(e);
517
+ return new Promise((t, o) => {
518
+ const i = new FileReader();
519
+ i.onload = () => t(i.result), i.onerror = () => o(s("Failed to read file", "UNKNOWN_ERROR")), i.readAsDataURL(e);
528
520
  });
529
521
  }
530
522
  }
531
- const $ = new W();
532
- function B(n) {
523
+ const Z = new G();
524
+ function V(n) {
533
525
  return new Promise((e) => {
534
526
  if ("vibrate" in navigator)
535
527
  navigator.vibrate(n), e();
@@ -544,19 +536,19 @@ function B(n) {
544
536
  });
545
537
  }
546
538
  export {
547
- T as CameraAPI,
548
- W as FileSystemAPI,
539
+ L as CameraAPI,
540
+ G as FileSystemAPI,
549
541
  k as GeolocationAPI,
550
542
  z as SensorsAPI,
551
- C as camera,
552
- $ as fileSystem,
553
- K as geolocation,
554
- R as hasNativeBridge,
543
+ X as camera,
544
+ Z as fileSystem,
545
+ Y as geolocation,
546
+ N as hasNativeBridge,
555
547
  E as isMotionSupported,
556
- I as isOrientationSupported,
548
+ R as isOrientationSupported,
557
549
  x as requestMotionPermission,
558
- j as sensors,
559
- B as vibrate,
560
- X as watchMotion,
561
- Y as watchOrientation
550
+ B as sensors,
551
+ V as vibrate,
552
+ j as watchMotion,
553
+ $ as watchOrientation
562
554
  };
@@ -1,7 +1,11 @@
1
+ import { hasNativeBridge } from '../core/native-bridge';
1
2
  import { SensorData, MotionData, OrientationData } from './types';
3
+ export { hasNativeBridge };
4
+ /**
5
+ * Check if device motion is supported
6
+ */
2
7
  export declare function isMotionSupported(): boolean;
3
8
  export declare function isOrientationSupported(): boolean;
4
- export declare function hasNativeBridge(): boolean;
5
9
  /** Request motion sensor permission (iOS 13+) */
6
10
  export declare function requestMotionPermission(): Promise<boolean>;
7
11
  /** Watch device motion (auto selects native bridge or Web API) */
@@ -0,0 +1,26 @@
1
+ var e = Object.defineProperty;
2
+ var o = (E, R, N) => R in E ? e(E, R, { enumerable: !0, configurable: !0, writable: !0, value: N }) : E[R] = N;
3
+ var O = (E, R, N) => o(E, typeof R != "symbol" ? R + "" : R, N);
4
+ class I extends Error {
5
+ constructor(N, r = "AIPPY_ERROR", t) {
6
+ super(N);
7
+ O(this, "code");
8
+ O(this, "context");
9
+ this.name = "AippyRuntimeError", this.code = r, this.context = t;
10
+ }
11
+ }
12
+ const _ = {
13
+ NOT_SUPPORTED: "NOT_SUPPORTED",
14
+ PERMISSION_DENIED: "PERMISSION_DENIED",
15
+ INVALID_CONFIG: "INVALID_CONFIG",
16
+ NETWORK_ERROR: "NETWORK_ERROR",
17
+ UNKNOWN_ERROR: "UNKNOWN_ERROR"
18
+ };
19
+ function s(E, R = "UNKNOWN_ERROR", N) {
20
+ return new I(E, _[R], N);
21
+ }
22
+ export {
23
+ I as A,
24
+ _ as E,
25
+ s as c
26
+ };