@limrun/ui 0.13.3-rc.1 → 0.13.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 (54) hide show
  1. package/dist/app-store-relay/index.cjs +4 -4
  2. package/dist/app-store-relay/index.js +175 -119
  3. package/dist/app-store-relay/react.cjs +1 -1
  4. package/dist/app-store-relay/react.js +2 -2
  5. package/dist/{browser-storage-BJ__DGJ6.mjs → browser-storage-Cx9eW-bm.mjs} +48 -45
  6. package/dist/browser-storage-jJaIht4K.js +1 -0
  7. package/dist/{client-CnbCWvCs.js → client-ASLtHFLh.js} +1 -1
  8. package/dist/{client-Bk1N3XIF.mjs → client-CGdh8yoJ.mjs} +33 -27
  9. package/dist/components/remote-control.d.ts +144 -0
  10. package/dist/core/device-install/apple/provisioning.d.ts +4 -4
  11. package/dist/device-build/index.cjs +1 -1
  12. package/dist/device-build/index.js +5 -5
  13. package/dist/device-build/react.cjs +1 -1
  14. package/dist/device-build/react.js +15 -13
  15. package/dist/device-install/demo/demo.d.ts +0 -0
  16. package/dist/device-install/index.cjs +1 -1
  17. package/dist/device-install/index.d.ts +1 -1
  18. package/dist/device-install/index.js +134 -121
  19. package/dist/device-install/react.cjs +1 -1
  20. package/dist/device-install/react.js +55 -50
  21. package/dist/{index-BXg7HdIs.mjs → index-DFdCvi2_.mjs} +3 -7
  22. package/dist/index.cjs +1 -1
  23. package/dist/index.js +1336 -1089
  24. package/dist/limbuild-client-CgEncrgx.js +1 -0
  25. package/dist/{limbuild-client-CFJhYsRx.mjs → limbuild-client-D7U7w342.mjs} +4 -2
  26. package/dist/{provisioning-CdseoMJQ.mjs → provisioning-DKbkBO-p.mjs} +11 -11
  27. package/dist/{provisioning-D2ZZQeyX.js → provisioning-Va0PH4Kk.js} +1 -1
  28. package/package.json +1 -1
  29. package/src/app-store-relay/index.test.ts +1 -5
  30. package/src/app-store-relay/index.ts +109 -42
  31. package/src/app-store-relay/react.ts +6 -2
  32. package/src/components/remote-control.tsx +726 -0
  33. package/src/core/device-install/apple/client.ts +29 -22
  34. package/src/core/device-install/apple/crypto.ts +9 -6
  35. package/src/core/device-install/apple/gsa-srp.ts +3 -7
  36. package/src/core/device-install/apple/provisioning.ts +16 -18
  37. package/src/core/device-install/apple/relay.ts +5 -1
  38. package/src/core/device-install/operations/limbuild-client.ts +8 -1
  39. package/src/core/device-install/operations/operations.ts +3 -1
  40. package/src/core/device-install/operations/relay-client.ts +57 -27
  41. package/src/core/device-install/operations/usbmux.ts +3 -3
  42. package/src/core/device-install/operations/webusb.ts +9 -4
  43. package/src/core/device-install/storage/browser-storage.ts +20 -6
  44. package/src/core/device-install/types.ts +1 -7
  45. package/src/device-build/react.ts +4 -1
  46. package/src/device-install/README.md +423 -0
  47. package/src/device-install/demo/demo.css +493 -0
  48. package/src/device-install/demo/demo.tsx +1069 -0
  49. package/src/device-install/demo/index.html +12 -0
  50. package/src/device-install/index.ts +7 -7
  51. package/src/device-install/react.ts +26 -17
  52. package/src/index.ts +1 -1
  53. package/dist/browser-storage-C1jQLXat.js +0 -1
  54. package/dist/limbuild-client-C_CMNLYV.js +0 -1
@@ -1,5 +1,5 @@
1
1
  const v = "limbuild-device-pairing";
2
- const d = "pairRecords", m = "limbuild-device-signing";
2
+ const d = "pairRecords", w = "limbuild-device-signing";
3
3
  const c = "signingAssets";
4
4
  function l(e) {
5
5
  return (e ?? "").replace(/-/g, "").replace(/[^a-fA-F0-9]/g, "");
@@ -10,8 +10,8 @@ function f(e) {
10
10
  async function R(e) {
11
11
  const n = l(e);
12
12
  if (!n) return;
13
- const r = await g(v, 1, d, "udid");
14
- return p(
13
+ const r = await p(v, 1, d, "udid");
14
+ return g(
15
15
  r.transaction(d, "readonly").objectStore(d).get(n)
16
16
  );
17
17
  }
@@ -23,8 +23,8 @@ async function G(e, n = {}) {
23
23
  udid: r,
24
24
  productName: n.productName,
25
25
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
26
- }, i = await g(v, 1, d, "udid");
27
- return await p(
26
+ }, i = await p(v, 1, d, "udid");
27
+ return await g(
28
28
  i.transaction(d, "readwrite").objectStore(d).put(t)
29
29
  ), t;
30
30
  }
@@ -35,41 +35,41 @@ async function O({
35
35
  }) {
36
36
  const t = f(n);
37
37
  if (!t) return;
38
- const i = l(e), s = await S(I("bundle", t, r));
38
+ const i = l(e), s = await S(D("bundle", t, r));
39
39
  if (s) return s;
40
40
  if (i) {
41
- const o = await S(I(i, t, r));
41
+ const o = await S(D(i, t, r));
42
42
  if (o) return o;
43
43
  }
44
- return (await B(t, r))[0];
44
+ return (await h(t, r))[0];
45
45
  }
46
- async function V(e = "development") {
47
- return (await w()).filter((r) => (r.signingMode ?? "development") === e).sort(
48
- (r, t) => new Date(t.updatedAt).getTime() - new Date(r.updatedAt).getTime()
49
- )[0];
46
+ async function T(e = "development") {
47
+ return (await m()).filter((r) => (r.signingMode ?? "development") === e).sort((r, t) => new Date(t.updatedAt).getTime() - new Date(r.updatedAt).getTime())[0];
50
48
  }
51
- async function z(e, n = "development") {
52
- return (await w()).filter((t) => !t.certificateID || !t.certificateP12Base64 || (t.signingMode ?? "development") !== n ? !1 : !e || !t.teamID || t.teamID === e).sort((t, i) => new Date(i.updatedAt).getTime() - new Date(t.updatedAt).getTime())[0];
49
+ async function V(e, n = "development") {
50
+ return (await m()).filter((t) => !t.certificateID || !t.certificateP12Base64 || (t.signingMode ?? "development") !== n ? !1 : !e || !t.teamID || t.teamID === e).sort((t, i) => new Date(i.updatedAt).getTime() - new Date(t.updatedAt).getTime())[0];
53
51
  }
54
- async function T(e) {
52
+ async function z(e) {
55
53
  const n = f(e.bundleID);
56
54
  if (!n)
57
55
  throw new Error("Cannot store signing assets without a bundle ID.");
58
- const r = l(e.deviceUDID), t = e.signingMode ?? "development", i = I("bundle", n, t), s = {
56
+ const r = l(e.deviceUDID), t = e.signingMode ?? "development", i = D("bundle", n, t), s = {
59
57
  ...e,
60
58
  id: i,
61
59
  deviceUDID: r || void 0,
62
60
  signingMode: t,
63
61
  bundleID: n,
64
62
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
65
- }, a = await g(m, 1, c, "id");
66
- return await p(
63
+ }, a = await p(w, 1, c, "id");
64
+ return await g(
67
65
  a.transaction(c, "readwrite").objectStore(c).put(s)
68
66
  ), s;
69
67
  }
70
- async function B(e, n = "development") {
68
+ async function h(e, n = "development") {
71
69
  const r = f(e);
72
- return r ? (await w()).filter((i) => i.bundleID === r && (i.signingMode ?? "development") === n) : [];
70
+ return r ? (await m()).filter(
71
+ (i) => i.bundleID === r && (i.signingMode ?? "development") === n
72
+ ) : [];
73
73
  }
74
74
  function U(e, n) {
75
75
  const r = l(n);
@@ -84,56 +84,59 @@ function j(e, n) {
84
84
  return r.startsWith(i);
85
85
  }
86
86
  async function M(e) {
87
- return P(new Uint8Array(await e.arrayBuffer()));
87
+ return E(new Uint8Array(await e.arrayBuffer()));
88
88
  }
89
89
  function C(e) {
90
90
  const n = atob(e), r = new Uint8Array(n.length);
91
91
  for (let t = 0; t < n.length; t += 1)
92
92
  r[t] = n.charCodeAt(t);
93
- return P(r);
93
+ return E(r);
94
94
  }
95
- function P(e) {
95
+ function E(e) {
96
96
  const n = new TextDecoder("latin1").decode(e), r = n.indexOf("<?xml"), t = n.indexOf("</plist>");
97
97
  if (r < 0 || t < r)
98
98
  throw new Error("Provisioning profile plist not found.");
99
- const i = n.slice(r, t + 8), s = new DOMParser().parseFromString(i, "application/xml");
99
+ const i = n.slice(r, t + 8);
100
+ if (/<!ENTITY/i.test(i))
101
+ throw new Error("Provisioning profile plist contains a disallowed ENTITY declaration.");
102
+ const s = new DOMParser().parseFromString(i, "application/xml");
100
103
  if (s.querySelector("parsererror"))
101
104
  throw new Error("Provisioning profile plist could not be parsed.");
102
105
  const a = s.querySelector("plist > dict");
103
106
  if (!a)
104
107
  throw new Error("Provisioning profile plist dictionary not found.");
105
108
  const o = A(a);
106
- if (!N(o))
109
+ if (!b(o))
107
110
  throw new Error("Provisioning profile plist has an unexpected shape.");
108
- const D = N(o.Entitlements) ? o.Entitlements : {}, y = u(D["application-identifier"]), h = E(y);
111
+ const I = b(o.Entitlements) ? o.Entitlements : {}, y = u(I["application-identifier"]), P = B(y);
109
112
  return {
110
113
  name: u(o.Name),
111
114
  uuid: u(o.UUID),
112
- teamID: u(D["com.apple.developer.team-identifier"]) ?? b(o.TeamIdentifier)[0],
115
+ teamID: u(I["com.apple.developer.team-identifier"]) ?? N(o.TeamIdentifier)[0],
113
116
  applicationIdentifier: y,
114
- bundleID: h,
115
- provisionedDevices: b(o.ProvisionedDevices),
116
- getTaskAllow: _(D["get-task-allow"]),
117
+ bundleID: P,
118
+ provisionedDevices: N(o.ProvisionedDevices),
119
+ getTaskAllow: _(I["get-task-allow"]),
117
120
  expirationDate: u(o.ExpirationDate)
118
121
  };
119
122
  }
120
123
  async function S(e) {
121
124
  if (!e) return;
122
- const n = await g(m, 1, c, "id");
123
- return p(
125
+ const n = await p(w, 1, c, "id");
126
+ return g(
124
127
  n.transaction(c, "readonly").objectStore(c).get(e)
125
128
  );
126
129
  }
127
- async function w() {
128
- const e = await g(m, 1, c, "id");
129
- return p(
130
+ async function m() {
131
+ const e = await p(w, 1, c, "id");
132
+ return g(
130
133
  e.transaction(c, "readonly").objectStore(c).getAll()
131
134
  );
132
135
  }
133
- function I(e, n, r) {
136
+ function D(e, n, r) {
134
137
  return `${r}:${e}:${n}`;
135
138
  }
136
- function E(e) {
139
+ function B(e) {
137
140
  if (!e) return;
138
141
  const n = e.indexOf(".");
139
142
  return n >= 0 ? e.slice(n + 1) : void 0;
@@ -162,16 +165,16 @@ function x(e) {
162
165
  function u(e) {
163
166
  return typeof e == "string" && e ? e : void 0;
164
167
  }
165
- function b(e) {
168
+ function N(e) {
166
169
  return Array.isArray(e) ? e.filter((n) => typeof n == "string") : [];
167
170
  }
168
171
  function _(e) {
169
172
  return typeof e == "boolean" ? e : void 0;
170
173
  }
171
- function N(e) {
174
+ function b(e) {
172
175
  return typeof e == "object" && e !== null && !Array.isArray(e);
173
176
  }
174
- function g(e, n, r, t) {
177
+ function p(e, n, r, t) {
175
178
  return new Promise((i, s) => {
176
179
  const a = indexedDB.open(e, n);
177
180
  a.onupgradeneeded = () => {
@@ -180,20 +183,20 @@ function g(e, n, r, t) {
180
183
  }, a.onsuccess = () => i(a.result), a.onerror = () => s(a.error ?? new Error("Open IndexedDB failed"));
181
184
  });
182
185
  }
183
- function p(e) {
186
+ function g(e) {
184
187
  return new Promise((n, r) => {
185
188
  e.onsuccess = () => n(e.result), e.onerror = () => r(e.error ?? new Error("IndexedDB request failed"));
186
189
  });
187
190
  }
188
191
  export {
189
- T as a,
192
+ z as a,
190
193
  j as b,
191
194
  U as c,
192
- z as d,
195
+ V as d,
193
196
  O as e,
194
197
  C as f,
195
- V as g,
196
- P as h,
198
+ T as g,
199
+ E as h,
197
200
  f as i,
198
201
  R as j,
199
202
  G as k,
@@ -0,0 +1 @@
1
+ "use strict";const b="limbuild-device-pairing";const l="pairRecords",w="limbuild-device-signing";const c="signingAssets";function d(e){return(e??"").replace(/-/g,"").replace(/[^a-fA-F0-9]/g,"")}function u(e){return(e??"").trim()}async function E(e){const n=d(e);if(!n)return;const r=await g(b,1,l,"udid");return p(r.transaction(l,"readonly").objectStore(l).get(n))}async function h(e,n={}){const r=d(e.udid);if(!r)throw new Error("Cannot store pair record without a UDID.");const t={...e,udid:r,productName:n.productName,updatedAt:new Date().toISOString()},i=await g(b,1,l,"udid");return await p(i.transaction(l,"readwrite").objectStore(l).put(t)),t}async function x({deviceUDID:e,bundleID:n,signingMode:r="development"}){const t=u(n);if(!t)return;const i=d(e),s=await v(I("bundle",t,r));if(s)return s;if(i){const o=await v(I(i,t,r));if(o)return o}return(await O(t,r))[0]}async function _(e="development"){return(await A()).filter(r=>(r.signingMode??"development")===e).sort((r,t)=>new Date(t.updatedAt).getTime()-new Date(r.updatedAt).getTime())[0]}async function R(e,n="development"){return(await A()).filter(t=>!t.certificateID||!t.certificateP12Base64||(t.signingMode??"development")!==n?!1:!e||!t.teamID||t.teamID===e).sort((t,i)=>new Date(i.updatedAt).getTime()-new Date(t.updatedAt).getTime())[0]}async function G(e){const n=u(e.bundleID);if(!n)throw new Error("Cannot store signing assets without a bundle ID.");const r=d(e.deviceUDID),t=e.signingMode??"development",i=I("bundle",n,t),s={...e,id:i,deviceUDID:r||void 0,signingMode:t,bundleID:n,updatedAt:new Date().toISOString()},a=await g(w,1,c,"id");return await p(a.transaction(c,"readwrite").objectStore(c).put(s)),s}async function O(e,n="development"){const r=u(e);return r?(await A()).filter(i=>i.bundleID===r&&(i.signingMode??"development")===n):[]}function T(e,n){const r=d(n);return!!r&&e.provisionedDevices.some(t=>d(t)===r)}function z(e,n){const r=u(n),t=u(e.bundleID);if(!r||!t)return!1;if(t===r||t==="*")return!0;if(!t.endsWith(".*"))return!1;const i=t.slice(0,-1);return r.startsWith(i)}async function U(e){return m(new Uint8Array(await e.arrayBuffer()))}function V(e){const n=atob(e),r=new Uint8Array(n.length);for(let t=0;t<n.length;t+=1)r[t]=n.charCodeAt(t);return m(r)}function m(e){const n=new TextDecoder("latin1").decode(e),r=n.indexOf("<?xml"),t=n.indexOf("</plist>");if(r<0||t<r)throw new Error("Provisioning profile plist not found.");const i=n.slice(r,t+8);if(/<!ENTITY/i.test(i))throw new Error("Provisioning profile plist contains a disallowed ENTITY declaration.");const s=new DOMParser().parseFromString(i,"application/xml");if(s.querySelector("parsererror"))throw new Error("Provisioning profile plist could not be parsed.");const a=s.querySelector("plist > dict");if(!a)throw new Error("Provisioning profile plist dictionary not found.");const o=S(a);if(!P(o))throw new Error("Provisioning profile plist has an unexpected shape.");const D=P(o.Entitlements)?o.Entitlements:{},y=f(D["application-identifier"]),B=C(y);return{name:f(o.Name),uuid:f(o.UUID),teamID:f(D["com.apple.developer.team-identifier"])??N(o.TeamIdentifier)[0],applicationIdentifier:y,bundleID:B,provisionedDevices:N(o.ProvisionedDevices),getTaskAllow:j(D["get-task-allow"]),expirationDate:f(o.ExpirationDate)}}async function v(e){if(!e)return;const n=await g(w,1,c,"id");return p(n.transaction(c,"readonly").objectStore(c).get(e))}async function A(){const e=await g(w,1,c,"id");return p(e.transaction(c,"readonly").objectStore(c).getAll())}function I(e,n,r){return`${r}:${e}:${n}`}function C(e){if(!e)return;const n=e.indexOf(".");return n>=0?e.slice(n+1):void 0}function S(e){switch(e.tagName){case"dict":return M(e);case"array":return Array.from(e.children).map(S);case"string":case"date":return e.textContent??"";default:return e.textContent??""}}function M(e){const n={},r=Array.from(e.children);for(let t=0;t<r.length;t+=2){const i=r[t],s=r[t+1];!i||i.tagName!=="key"||!s||(n[i.textContent??""]=S(s))}return n}function f(e){return typeof e=="string"&&e?e:void 0}function N(e){return Array.isArray(e)?e.filter(n=>typeof n=="string"):[]}function j(e){return typeof e=="boolean"?e:void 0}function P(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function g(e,n,r,t){return new Promise((i,s)=>{const a=indexedDB.open(e,n);a.onupgradeneeded=()=>{const o=a.result;o.objectStoreNames.contains(r)||o.createObjectStore(r,{keyPath:t})},a.onsuccess=()=>i(a.result),a.onerror=()=>s(a.error??new Error("Open IndexedDB failed"))})}function p(e){return new Promise((n,r)=>{e.onsuccess=()=>n(e.result),e.onerror=()=>r(e.error??new Error("IndexedDB request failed"))})}exports.getLatestSigningAssets=_;exports.getLatestSigningAssetsWithCertificate=R;exports.getPairRecord=E;exports.getSigningAssets=x;exports.normalizeBundleID=u;exports.normalizeUDID=d;exports.parseProvisioningProfile=U;exports.parseProvisioningProfileBase64=V;exports.parseProvisioningProfileBytes=m;exports.profileContainsDevice=T;exports.profileMatchesBundleID=z;exports.putPairRecord=h;exports.putSigningAssets=G;
@@ -1 +1 @@
1
- "use strict";const E=require("./index-CMeQfhYy.js");async function P(e,s){const r=await fetch(c(e,"/apple/auth/session",s),{method:"POST",headers:R(s)});if(!r.ok)throw new Error(`Apple relay session failed: HTTP ${r.status} ${await r.text()}`);return await r.json()}async function y(e,s,r){const t=await fetch(c(e,"/apple/auth/session/delete",r),{method:"POST",headers:u(r),body:JSON.stringify({appleSessionId:s})});if(!t.ok)throw new Error(`Apple relay session delete failed: HTTP ${t.status} ${await t.text()}`)}async function g(e,s,r,t){return N(e,"/apple/auth/srp/init",s,r,t)}async function m(e,s,r,t){return N(e,"/apple/auth/srp/complete",s,r,t)}async function S(e,s,r){const t=await fetch(c(e,"/apple/auth/2fa/trigger",r),{method:"POST",headers:u(r),body:JSON.stringify({appleSessionId:s})});if(!t.ok)throw new Error(`Apple 2FA trigger failed: HTTP ${t.status} ${await t.text()}`);return await t.json()}async function $(e,s,r,t="sms",o){const a=await fetch(c(e,"/apple/auth/2fa/phone/trigger",o),{method:"POST",headers:u(o),body:JSON.stringify({appleSessionId:s,phoneNumberId:r,mode:t})});if(!a.ok)throw new Error(`Apple phone 2FA trigger failed: HTTP ${a.status} ${await a.text()}`);return await a.json()}async function x(e,s,r,t){const o=await fetch(c(e,"/apple/auth/2fa",t),{method:"POST",headers:u(t),body:JSON.stringify({appleSessionId:s,code:r})});if(!o.ok)throw new Error(`Apple 2FA proxy failed: HTTP ${o.status} ${await o.text()}`);return await o.json()}async function A(e,s,r,t,o="sms",a){const n=await fetch(c(e,"/apple/auth/2fa/phone",a),{method:"POST",headers:u(a),body:JSON.stringify({appleSessionId:s,phoneNumberId:r,mode:o,code:t})});if(!n.ok)throw new Error(`Apple phone 2FA proxy failed: HTTP ${n.status} ${await n.text()}`);return await n.json()}async function O(e,s,r){const t=await fetch(c(e,"/apple/auth/finalize",r),{method:"POST",headers:u(r),body:JSON.stringify({appleSessionId:s})});if(!t.ok)throw new Error(`Apple session finalization failed: HTTP ${t.status} ${await t.text()}`);return await t.json()}async function H(e,s,r,t){const o=await fetch(c(e,"/apple/provisioning",t),{method:"POST",headers:u(t),body:JSON.stringify({appleSessionId:s,...r})});if(!o.ok)throw new Error(`Apple provisioning proxy failed: HTTP ${o.status} ${await o.text()}`);return F(await o.json())}async function N(e,s,r,t,o){const a=await fetch(c(e,s,o),{method:"POST",headers:u(o),body:JSON.stringify({appleSessionId:r,payload:t})});if(!a.ok)throw new Error(`Apple proxy ${s} failed: HTTP ${a.status} ${await a.text()}`);return F(await a.json())}function F(e){if(e.body!==void 0||!e.rawBody)return e;try{return{...e,body:JSON.parse(e.rawBody)}}catch{return e}}function c(e,s,r){const t=e.replace(/\/$/,""),o=s.startsWith("/")?s:`/${s}`,a=new URL(`${t}${o}`);return r&&a.searchParams.set("token",r),a}function u(e){return{"Content-Type":"application/json",...R(e)}}function R(e){return e?{Authorization:`Bearer ${e}`}:{}}async function v({limbuildApiUrl:e,accountName:s,password:r,token:t}){const{appleSessionId:o}=await P(e,t);try{const a=new E.AppleGsaSrpClient(s),n=await g(e,o,await a.init(),t);if(n.status<200||n.status>=300)throw new Error(`Apple SRP init failed: HTTP ${n.status} ${n.rawBody??""}`.trim());if(!n.body)throw new Error("Apple SRP init response did not include a body.");const b=await a.complete(r,n.body),f=await m(e,o,{...b,rememberMe:!1,trustTokens:[]},t),T=f.status===409;let i,d={type:"trustedDevice"};if(T){i=await S(e,o,t);const p=j(i.body);if(p&&(d={type:"phone",phoneNumberId:p.id,mode:p.pushMode??"sms"}),i.status===412){if(!p)throw new Error("Apple requested phone verification but did not include a trusted phone number.");i=await $(e,o,p.id,p.pushMode??"sms",t)}if(i.status<200||i.status>=300)throw new Error(`Apple two-factor challenge failed: HTTP ${i.status} ${i.rawBody??""}`.trim())}else if(f.status<200||f.status>=300)throw new Error(`Apple SRP complete failed: HTTP ${f.status} ${f.rawBody??""}`.trim());return{appleSessionId:o,completeResponse:f,twoFactorChallengeResponse:i,requiresTwoFactor:T,finishTwoFactor:async p=>{const w=d.type==="phone"?await A(e,o,d.phoneNumberId,p,d.mode,t):await x(e,o,p,t);if(w.status<200||w.status>=300)throw new Error(`Apple two-factor code failed: HTTP ${w.status} ${w.rawBody??""}`.trim());return w},finalize:async()=>O(e,o,t),close:()=>y(e,o,t)}}catch(a){throw await y(e,o,t).catch(()=>{}),a}}function j(e){if(!l(e))return;const s=l(e.phoneNumberVerification)?e.phoneNumberVerification:void 0,r=h(s?.trustedPhoneNumber)??h(e.trustedPhoneNumber)??h(e.phoneNumber);if(!r)return;const t=r.id;if(typeof t!="number")return;const o=typeof r.pushMode=="string"?r.pushMode:typeof e.mode=="string"?e.mode:void 0;return{id:t,pushMode:o}}function h(e){return l(e)?e:void 0}function l(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}exports.createAppleRelaySession=P;exports.deleteAppleRelaySession=y;exports.fetchAppleAccountSession=O;exports.proxyPhoneTwoFactorCode=A;exports.proxyProvisioningRequest=H;exports.proxySrpComplete=m;exports.proxySrpInit=g;exports.proxyTwoFactorCode=x;exports.startBrowserOwnedAppleIDLogin=v;exports.triggerPhoneTwoFactor=$;exports.triggerTrustedDeviceTwoFactor=S;
1
+ "use strict";const E=require("./index-CMeQfhYy.js");async function P(e,s){const r=await fetch(p(e,"/apple/auth/session",s),{method:"POST",headers:R(s)});if(!r.ok)throw new Error(`Apple relay session failed: HTTP ${r.status} ${await r.text()}`);return await r.json()}async function y(e,s,r){const t=await fetch(p(e,"/apple/auth/session/delete",r),{method:"POST",headers:u(r),body:JSON.stringify({appleSessionId:s})});if(!t.ok)throw new Error(`Apple relay session delete failed: HTTP ${t.status} ${await t.text()}`)}async function g(e,s,r,t){return N(e,"/apple/auth/srp/init",s,r,t)}async function m(e,s,r,t){return N(e,"/apple/auth/srp/complete",s,r,t)}async function S(e,s,r){const t=await fetch(p(e,"/apple/auth/2fa/trigger",r),{method:"POST",headers:u(r),body:JSON.stringify({appleSessionId:s})});if(!t.ok)throw new Error(`Apple 2FA trigger failed: HTTP ${t.status} ${await t.text()}`);return await t.json()}async function $(e,s,r,t="sms",o){const a=await fetch(p(e,"/apple/auth/2fa/phone/trigger",o),{method:"POST",headers:u(o),body:JSON.stringify({appleSessionId:s,phoneNumberId:r,mode:t})});if(!a.ok)throw new Error(`Apple phone 2FA trigger failed: HTTP ${a.status} ${await a.text()}`);return await a.json()}async function x(e,s,r,t){const o=await fetch(p(e,"/apple/auth/2fa",t),{method:"POST",headers:u(t),body:JSON.stringify({appleSessionId:s,code:r})});if(!o.ok)throw new Error(`Apple 2FA proxy failed: HTTP ${o.status} ${await o.text()}`);return await o.json()}async function A(e,s,r,t,o="sms",a){const n=await fetch(p(e,"/apple/auth/2fa/phone",a),{method:"POST",headers:u(a),body:JSON.stringify({appleSessionId:s,phoneNumberId:r,mode:o,code:t})});if(!n.ok)throw new Error(`Apple phone 2FA proxy failed: HTTP ${n.status} ${await n.text()}`);return await n.json()}async function O(e,s,r){const t=await fetch(p(e,"/apple/auth/finalize",r),{method:"POST",headers:u(r),body:JSON.stringify({appleSessionId:s})});if(!t.ok)throw new Error(`Apple session finalization failed: HTTP ${t.status} ${await t.text()}`);return await t.json()}async function H(e,s,r,t){const o=await fetch(p(e,"/apple/provisioning",t),{method:"POST",headers:u(t),body:JSON.stringify({appleSessionId:s,...r})});if(!o.ok)throw new Error(`Apple provisioning proxy failed: HTTP ${o.status} ${await o.text()}`);return F(await o.json())}async function N(e,s,r,t,o){const a=await fetch(p(e,s,o),{method:"POST",headers:u(o),body:JSON.stringify({appleSessionId:r,payload:t})});if(!a.ok)throw new Error(`Apple proxy ${s} failed: HTTP ${a.status} ${await a.text()}`);return F(await a.json())}function F(e){if(e.body!==void 0||!e.rawBody)return e;try{return{...e,body:JSON.parse(e.rawBody)}}catch{return e}}function p(e,s,r){const t=e.replace(/\/$/,""),o=s.startsWith("/")?s:`/${s}`,a=new URL(`${t}${o}`);return r&&a.searchParams.set("token",r),a}function u(e){return{"Content-Type":"application/json",...R(e)}}function R(e){return e?{Authorization:`Bearer ${e}`}:{}}async function v({limbuildApiUrl:e,accountName:s,password:r,token:t}){const{appleSessionId:o}=await P(e,t);try{const a=new E.AppleGsaSrpClient(s),n=await g(e,o,await a.init(),t);if(n.status<200||n.status>=300)throw new Error(`Apple SRP init failed: HTTP ${n.status} ${n.rawBody??""}`.trim());if(!n.body)throw new Error("Apple SRP init response did not include a body.");const b=await a.complete(r,n.body),f=await m(e,o,{...b,rememberMe:!1,trustTokens:[]},t),T=f.status===409;let i,d={type:"trustedDevice"};if(T){i=await S(e,o,t);const c=j(i.body);if(i.status===412){if(!c)throw new Error("Apple requested phone verification but did not include a trusted phone number.");d={type:"phone",phoneNumberId:c.id,mode:c.pushMode??"sms"},i=await $(e,o,c.id,c.pushMode??"sms",t)}if(i.status<200||i.status>=300)throw new Error(`Apple two-factor challenge failed: HTTP ${i.status} ${i.rawBody??""}`.trim())}else if(f.status<200||f.status>=300)throw new Error(`Apple SRP complete failed: HTTP ${f.status} ${f.rawBody??""}`.trim());return{appleSessionId:o,completeResponse:f,twoFactorChallengeResponse:i,requiresTwoFactor:T,finishTwoFactor:async c=>{const w=d.type==="phone"?await A(e,o,d.phoneNumberId,c,d.mode,t):await x(e,o,c,t);if(w.status<200||w.status>=300)throw new Error(`Apple two-factor code failed: HTTP ${w.status} ${w.rawBody??""}`.trim());return w},finalize:async()=>O(e,o,t),close:()=>y(e,o,t)}}catch(a){throw await y(e,o,t).catch(()=>{}),a}}function j(e){if(!l(e))return;const s=l(e.phoneNumberVerification)?e.phoneNumberVerification:void 0,r=h(s?.trustedPhoneNumber)??h(e.trustedPhoneNumber)??h(e.phoneNumber);if(!r)return;const t=r.id;if(typeof t!="number")return;const o=typeof r.pushMode=="string"?r.pushMode:typeof e.mode=="string"?e.mode:void 0;return{id:t,pushMode:o}}function h(e){return l(e)?e:void 0}function l(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}exports.createAppleRelaySession=P;exports.deleteAppleRelaySession=y;exports.fetchAppleAccountSession=O;exports.proxyPhoneTwoFactorCode=A;exports.proxyProvisioningRequest=H;exports.proxySrpComplete=m;exports.proxySrpInit=g;exports.proxyTwoFactorCode=x;exports.startBrowserOwnedAppleIDLogin=v;exports.triggerPhoneTwoFactor=$;exports.triggerTrustedDeviceTwoFactor=S;
@@ -1,6 +1,6 @@
1
- import { A as S } from "./index-BXg7HdIs.mjs";
1
+ import { A as S } from "./index-DFdCvi2_.mjs";
2
2
  async function x(t, a) {
3
- const r = await fetch(c(t, "/apple/auth/session", a), {
3
+ const r = await fetch(p(t, "/apple/auth/session", a), {
4
4
  method: "POST",
5
5
  headers: $(a)
6
6
  });
@@ -9,7 +9,7 @@ async function x(t, a) {
9
9
  return await r.json();
10
10
  }
11
11
  async function T(t, a, r) {
12
- const e = await fetch(c(t, "/apple/auth/session/delete", r), {
12
+ const e = await fetch(p(t, "/apple/auth/session/delete", r), {
13
13
  method: "POST",
14
14
  headers: u(r),
15
15
  body: JSON.stringify({ appleSessionId: a })
@@ -30,7 +30,7 @@ async function O(t, a, r, e) {
30
30
  return m(t, "/apple/auth/srp/complete", a, r, e);
31
31
  }
32
32
  async function N(t, a, r) {
33
- const e = await fetch(c(t, "/apple/auth/2fa/trigger", r), {
33
+ const e = await fetch(p(t, "/apple/auth/2fa/trigger", r), {
34
34
  method: "POST",
35
35
  headers: u(r),
36
36
  body: JSON.stringify({ appleSessionId: a })
@@ -40,7 +40,7 @@ async function N(t, a, r) {
40
40
  return await e.json();
41
41
  }
42
42
  async function b(t, a, r, e = "sms", o) {
43
- const s = await fetch(c(t, "/apple/auth/2fa/phone/trigger", o), {
43
+ const s = await fetch(p(t, "/apple/auth/2fa/phone/trigger", o), {
44
44
  method: "POST",
45
45
  headers: u(o),
46
46
  body: JSON.stringify({ appleSessionId: a, phoneNumberId: r, mode: e })
@@ -50,7 +50,7 @@ async function b(t, a, r, e = "sms", o) {
50
50
  return await s.json();
51
51
  }
52
52
  async function E(t, a, r, e) {
53
- const o = await fetch(c(t, "/apple/auth/2fa", e), {
53
+ const o = await fetch(p(t, "/apple/auth/2fa", e), {
54
54
  method: "POST",
55
55
  headers: u(e),
56
56
  body: JSON.stringify({ appleSessionId: a, code: r })
@@ -60,7 +60,7 @@ async function E(t, a, r, e) {
60
60
  return await o.json();
61
61
  }
62
62
  async function H(t, a, r, e, o = "sms", s) {
63
- const n = await fetch(c(t, "/apple/auth/2fa/phone", s), {
63
+ const n = await fetch(p(t, "/apple/auth/2fa/phone", s), {
64
64
  method: "POST",
65
65
  headers: u(s),
66
66
  body: JSON.stringify({ appleSessionId: a, phoneNumberId: r, mode: o, code: e })
@@ -70,7 +70,7 @@ async function H(t, a, r, e, o = "sms", s) {
70
70
  return await n.json();
71
71
  }
72
72
  async function F(t, a, r) {
73
- const e = await fetch(c(t, "/apple/auth/finalize", r), {
73
+ const e = await fetch(p(t, "/apple/auth/finalize", r), {
74
74
  method: "POST",
75
75
  headers: u(r),
76
76
  body: JSON.stringify({ appleSessionId: a })
@@ -80,7 +80,7 @@ async function F(t, a, r) {
80
80
  return await e.json();
81
81
  }
82
82
  async function j(t, a, r, e) {
83
- const o = await fetch(c(t, "/apple/provisioning", e), {
83
+ const o = await fetch(p(t, "/apple/provisioning", e), {
84
84
  method: "POST",
85
85
  headers: u(e),
86
86
  body: JSON.stringify({ appleSessionId: a, ...r })
@@ -90,7 +90,7 @@ async function j(t, a, r, e) {
90
90
  return P(await o.json());
91
91
  }
92
92
  async function m(t, a, r, e, o) {
93
- const s = await fetch(c(t, a, o), {
93
+ const s = await fetch(p(t, a, o), {
94
94
  method: "POST",
95
95
  headers: u(o),
96
96
  body: JSON.stringify({ appleSessionId: r, payload: e })
@@ -111,7 +111,7 @@ function P(t) {
111
111
  return t;
112
112
  }
113
113
  }
114
- function c(t, a, r) {
114
+ function p(t, a, r) {
115
115
  const e = t.replace(/\/$/, ""), o = a.startsWith("/") ? a : `/${a}`, s = new URL(`${e}${o}`);
116
116
  return r && s.searchParams.set("token", r), s;
117
117
  }
@@ -134,7 +134,9 @@ async function J({
134
134
  try {
135
135
  const s = new S(a), n = await A(t, o, await s.init(), e);
136
136
  if (n.status < 200 || n.status >= 300)
137
- throw new Error(`Apple SRP init failed: HTTP ${n.status} ${n.rawBody ?? ""}`.trim());
137
+ throw new Error(
138
+ `Apple SRP init failed: HTTP ${n.status} ${n.rawBody ?? ""}`.trim()
139
+ );
138
140
  if (!n.body)
139
141
  throw new Error("Apple SRP init response did not include a body.");
140
142
  const g = await s.complete(r, n.body), f = await O(
@@ -150,19 +152,19 @@ async function J({
150
152
  let i, d = { type: "trustedDevice" };
151
153
  if (l) {
152
154
  i = await N(t, o, e);
153
- const p = R(i.body);
154
- if (p && (d = {
155
- type: "phone",
156
- phoneNumberId: p.id,
157
- mode: p.pushMode ?? "sms"
158
- }), i.status === 412) {
159
- if (!p)
155
+ const c = R(i.body);
156
+ if (i.status === 412) {
157
+ if (!c)
160
158
  throw new Error("Apple requested phone verification but did not include a trusted phone number.");
161
- i = await b(
159
+ d = {
160
+ type: "phone",
161
+ phoneNumberId: c.id,
162
+ mode: c.pushMode ?? "sms"
163
+ }, i = await b(
162
164
  t,
163
165
  o,
164
- p.id,
165
- p.pushMode ?? "sms",
166
+ c.id,
167
+ c.pushMode ?? "sms",
166
168
  e
167
169
  );
168
170
  }
@@ -171,23 +173,27 @@ async function J({
171
173
  `Apple two-factor challenge failed: HTTP ${i.status} ${i.rawBody ?? ""}`.trim()
172
174
  );
173
175
  } else if (f.status < 200 || f.status >= 300)
174
- throw new Error(`Apple SRP complete failed: HTTP ${f.status} ${f.rawBody ?? ""}`.trim());
176
+ throw new Error(
177
+ `Apple SRP complete failed: HTTP ${f.status} ${f.rawBody ?? ""}`.trim()
178
+ );
175
179
  return {
176
180
  appleSessionId: o,
177
181
  completeResponse: f,
178
182
  twoFactorChallengeResponse: i,
179
183
  requiresTwoFactor: l,
180
- finishTwoFactor: async (p) => {
184
+ finishTwoFactor: async (c) => {
181
185
  const h = d.type === "phone" ? await H(
182
186
  t,
183
187
  o,
184
188
  d.phoneNumberId,
185
- p,
189
+ c,
186
190
  d.mode,
187
191
  e
188
- ) : await E(t, o, p, e);
192
+ ) : await E(t, o, c, e);
189
193
  if (h.status < 200 || h.status >= 300)
190
- throw new Error(`Apple two-factor code failed: HTTP ${h.status} ${h.rawBody ?? ""}`.trim());
194
+ throw new Error(
195
+ `Apple two-factor code failed: HTTP ${h.status} ${h.rawBody ?? ""}`.trim()
196
+ );
191
197
  return h;
192
198
  },
193
199
  finalize: async () => F(t, o, e),
@@ -93,6 +93,150 @@ interface RemoteControlProps {
93
93
  * @default 2000
94
94
  */
95
95
  axMaxBackoffMs?: number;
96
+ /**
97
+ * Fires whenever the iOS simulator's camera demand state changes —
98
+ * i.e. an app inside the sim called
99
+ * `[AVCaptureSession startRunning]` or `[stopRunning]`. The
100
+ * component handles the `navigator.mediaDevices.getUserMedia` prompt
101
+ * and SDP plumbing internally; this callback is purely so the host
102
+ * UI can render a status indicator ("simulator is using your
103
+ * camera", etc.).
104
+ *
105
+ * `active` reflects whether the sim is currently asking for
106
+ * frames. `granted` is set only on the call that follows a
107
+ * `getUserMedia` attempt: `true` when the user accepted the
108
+ * browser prompt, `false` when they denied or the call failed
109
+ * (in which case the limulator side switches to a black-frame
110
+ * fallback so the app keeps ticking).
111
+ *
112
+ * `camera` (optional, only meaningful when `granted === true`)
113
+ * carries what `MediaStreamTrack.getSettings()` reported for the
114
+ * active capture: resolution, framerate, device label, facing
115
+ * mode. Use it to render a richer status indicator (e.g.
116
+ * "Camera · 1920×1080 · 30 fps · FaceTime HD").
117
+ *
118
+ * Only iOS instances ever fire this callback; Android instances
119
+ * have no camera-injector path and stay silent.
120
+ */
121
+ onCameraDemandChange?: (active: boolean, granted?: boolean, camera?: CameraCaptureInfo) => void;
122
+ /**
123
+ * Periodically (~1Hz) fires with a snapshot of the outbound
124
+ * camera stream's live WebRTC stats — codec, encoder
125
+ * implementation, hardware acceleration, encoded fps, bitrate,
126
+ * round-trip-time, and the encoder's
127
+ * `qualityLimitationReason` (which is what Meet/Zoom use to
128
+ * decide whether to show "Bandwidth limited" or "CPU limited"
129
+ * banners).
130
+ *
131
+ * Only fires while the simulator is actively pulling the
132
+ * camera AND `getUserMedia` was granted. `null` is emitted
133
+ * once when the stream goes back to idle so consumers can
134
+ * clear their UI without having to maintain their own
135
+ * timeout. The host app does not need to poll `getStats()`
136
+ * itself — this is the canonical place.
137
+ */
138
+ onCameraStats?: (stats: CameraStreamStats | null) => void;
139
+ /**
140
+ * Optional resolution cap for outbound camera capture.
141
+ *
142
+ * - `'auto'` (default): no extra constraint. The browser captures
143
+ * at its webcam's native max; WebRTC's quality scaler may step
144
+ * down resolution on the encoder side under bandwidth pressure
145
+ * while still feeding the simulator at the pool's native size.
146
+ * - `'1080p'` / `'720p'` / `'480p'`: hard cap applied via
147
+ * `getUserMedia` constraints (for new captures) and
148
+ * `track.applyConstraints` (for the currently-active track),
149
+ * matching the way Meet/Zoom expose a "Send resolution" picker.
150
+ *
151
+ * Bumping or lowering the cap mid-stream is supported; the
152
+ * change takes effect within a frame or two as the webcam
153
+ * re-negotiates.
154
+ */
155
+ cameraResolutionCap?: CameraResolutionCap;
156
+ /**
157
+ * Aspect ratio the simulator's virtual camera should report to apps.
158
+ * Picking a value here triggers a `cameraAspect` WS message to the
159
+ * host, which rebuilds its IOSurface ring at the matching dimensions
160
+ * (16:9 → 1920×1080, 4:3 → 1440×1080, 1:1 → 1080×1080, 9:16 →
161
+ * 1080×1920) and signals the in-sim dylib to re-handshake. iOS apps
162
+ * see CMSampleBuffers at the new dimensions within a frame or two.
163
+ *
164
+ * The browser still captures whatever the webcam offers; the host
165
+ * aspect-fills (cover, center-crop) into the new pool. Switching
166
+ * aspect at runtime is intentionally cheap so users can A/B preview
167
+ * styles without restarting the simulator.
168
+ *
169
+ * `undefined` leaves the pool untouched (the host's boot default —
170
+ * 16:9 / 1920×1080 — applies).
171
+ */
172
+ cameraAspect?: CameraAspect;
173
+ }
174
+ /**
175
+ * Resolution caps a host app can request on the outbound camera.
176
+ * `'auto'` is "let the browser decide" (no constraints beyond the
177
+ * 30 fps ceiling); the other options clamp width/height to the
178
+ * named target. Aspect ratio is preserved.
179
+ */
180
+ export type CameraResolutionCap = 'auto' | '1080p' | '720p' | '480p';
181
+ /**
182
+ * Aspect ratios exposed to the operator for the simulated camera.
183
+ * The host maps each label to concrete IOSurface dimensions; values
184
+ * the host doesn't recognise are silently ignored.
185
+ */
186
+ export type CameraAspect = '16:9' | '4:3' | '1:1' | '9:16';
187
+ /**
188
+ * Snapshot of the browser's webcam capture, mirrored from
189
+ * `MediaStreamTrack.getSettings()`. Forwarded to the host alongside
190
+ * `cameraResult` and exposed to the host app via
191
+ * `onCameraDemandChange` so it can render a status indicator without
192
+ * having to call `getStats()` itself.
193
+ */
194
+ export interface CameraCaptureInfo {
195
+ width?: number;
196
+ height?: number;
197
+ frameRate?: number;
198
+ deviceId?: string;
199
+ label?: string;
200
+ facingMode?: string;
201
+ }
202
+ /**
203
+ * Live outbound-camera quality snapshot. Derived from
204
+ * `RTCPeerConnection.getStats()` and rate-derived deltas, sampled
205
+ * once per second while the camera is sending. All fields optional:
206
+ * some browsers omit fields (Safari rarely reports
207
+ * `encoderImplementation`), and the first sample after camera start
208
+ * has no delta-derived numbers yet.
209
+ */
210
+ export interface CameraStreamStats {
211
+ /** "H264", "HEVC"/"H265", "VP9", "VP8", "AV1", etc. (uppercased). */
212
+ codec?: string;
213
+ /** e.g. "VideoToolbox" (hw), "OpenH264" (sw), "ExternalEncoder". */
214
+ encoderImplementation?: string;
215
+ /**
216
+ * Browser-reported hardware-acceleration hint. Some Chromium
217
+ * versions expose this via `powerEfficientEncoder`; we mirror it
218
+ * here so consumers don't have to know the spec quirk.
219
+ */
220
+ hardwareAccelerated?: boolean;
221
+ /** Outbound encoded fps over the last sample window. */
222
+ framesPerSecond?: number;
223
+ /** Cumulative encoded frame count. */
224
+ framesEncoded?: number;
225
+ /** Outbound encoded bitrate (bits/s) over the last window. */
226
+ bitrateBps?: number;
227
+ /** Width/height the encoder is currently producing. */
228
+ width?: number;
229
+ height?: number;
230
+ /**
231
+ * One of `'none' | 'cpu' | 'bandwidth' | 'other'`. Mirrors
232
+ * Meet/Zoom's "limited by …" banners. Anything other than
233
+ * `'none'` means the encoder dropped resolution to keep up.
234
+ */
235
+ qualityLimitationReason?: string;
236
+ /** Round-trip time in milliseconds, from the matching RTCP. */
237
+ rttMs?: number;
238
+ /** Packet-loss percentage over the last sample window (0..100). */
239
+ packetsLostPct?: number;
96
240
  }
97
241
  interface ScreenshotData {
98
242
  dataUri: string;
@@ -64,12 +64,12 @@ export type PutAppleGeneratedSigningAssetsInput = {
64
64
  profile: ProvisioningProfileInfo;
65
65
  };
66
66
  export declare function listTeamsRequest(): AppleProvisioningRequest;
67
- export declare function findBundleIDRequest({ bundleID, teamID }: Pick<AppleProvisioningContext, 'bundleID' | 'teamID'>): {
67
+ export declare function findBundleIDRequest({ bundleID, teamID, }: Pick<AppleProvisioningContext, 'bundleID' | 'teamID'>): {
68
68
  method: "POST";
69
69
  path: string;
70
70
  payload: Record<string, unknown>;
71
71
  };
72
- export declare function findDeviceRequest({ deviceUDID, teamID }: Pick<AppleProvisioningContext, 'deviceUDID' | 'teamID'>): {
72
+ export declare function findDeviceRequest({ deviceUDID, teamID, }: Pick<AppleProvisioningContext, 'deviceUDID' | 'teamID'>): {
73
73
  method: "POST";
74
74
  path: string;
75
75
  payload: Record<string, unknown>;
@@ -119,7 +119,7 @@ export declare function createBundleIDRequest({ bundleID, teamID, name, }: Pick<
119
119
  type: string;
120
120
  };
121
121
  };
122
- export declare function submitDevelopmentCSRRequest({ csrPEM, teamID, }: {
122
+ export declare function submitDevelopmentCSRRequest({ csrPEM, teamID }: {
123
123
  csrPEM: string;
124
124
  teamID?: string;
125
125
  }): {
@@ -131,7 +131,7 @@ export declare function submitDevelopmentCSRRequest({ csrPEM, teamID, }: {
131
131
  csrContent: string;
132
132
  };
133
133
  };
134
- export declare function submitDistributionCSRRequest({ csrPEM, teamID, }: {
134
+ export declare function submitDistributionCSRRequest({ csrPEM, teamID }: {
135
135
  csrPEM: string;
136
136
  teamID?: string;
137
137
  }): {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../limbuild-client-C_CMNLYV.js");require("../index-CMeQfhYy.js");const c=require("../provisioning-D2ZZQeyX.js"),i=require("../browser-storage-C1jQLXat.js");async function v({certificateFile:t,provisioningProfileFile:e,certificatePassword:n,bundleId:s,deviceUDID:r,teamId:d,signingMode:f="development",certificateId:p}){const[u,A,o]=await Promise.all([l(t),l(e),i.parseProvisioningProfile(e)]);return g({profile:o,bundleId:s,deviceUDID:r,signingMode:f}),i.putSigningAssets({bundleID:s??o.bundleID??o.applicationIdentifier??e.name,deviceUDID:r,teamID:d??o.teamID,signingMode:f,certificateID:p,certificateP12Base64:u,certificateFileName:t.name,certificatePassword:n||void 0,provisioningProfileBase64:A,profileFileName:e.name,profile:o})}function S(t,e={}){g({profile:t.profile,bundleId:e.bundleId,deviceUDID:e.deviceUDID,signingMode:e.signingMode??t.signingMode})}function g({profile:t,bundleId:e,deviceUDID:n,signingMode:s}){if(e&&!i.profileMatchesBundleID(t,e))throw new Error(`Provisioning profile does not match bundle ID ${e}.`);if(n&&!i.profileContainsDevice(t,n))throw new Error("Provisioning profile does not include the selected iPhone.");if(s==="adhoc"&&t.getTaskAllow)throw new Error("Ad Hoc mode requires an Ad Hoc provisioning profile, not a development profile.")}async function l(t){const e=await t.arrayBuffer();let n="";const s=new Uint8Array(e);for(const r of s)n+=String.fromCharCode(r);return btoa(n)}exports.fetchLimbuildInfo=a.fetchLimbuildInfo;exports.getIOSOTAInstall=a.getIOSOTAInstall;exports.startSignedDeviceBuild=a.startSignedDeviceBuild;exports.watchBuildLogEvents=a.watchBuildLogEvents;exports.getReusableAppleSigningAssets=c.getReusableAppleSigningAssets;exports.putAppleGeneratedSigningAssets=c.putAppleGeneratedSigningAssets;exports.getLatestSigningAssets=i.getLatestSigningAssets;exports.getLatestSigningAssetsWithCertificate=i.getLatestSigningAssetsWithCertificate;exports.getSigningAssets=i.getSigningAssets;exports.parseProvisioningProfile=i.parseProvisioningProfile;exports.parseProvisioningProfileBase64=i.parseProvisioningProfileBase64;exports.parseProvisioningProfileBytes=i.parseProvisioningProfileBytes;exports.profileContainsDevice=i.profileContainsDevice;exports.profileMatchesBundleID=i.profileMatchesBundleID;exports.putSigningAssets=i.putSigningAssets;exports.fileToBase64=l;exports.importSigningAssetsFromFiles=v;exports.validateProvisioningProfileForInstall=g;exports.validateSigningAssetsForInstall=S;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../limbuild-client-CgEncrgx.js");require("../index-CMeQfhYy.js");const c=require("../provisioning-Va0PH4Kk.js"),i=require("../browser-storage-jJaIht4K.js");async function v({certificateFile:t,provisioningProfileFile:e,certificatePassword:n,bundleId:s,deviceUDID:r,teamId:d,signingMode:f="development",certificateId:p}){const[u,A,o]=await Promise.all([l(t),l(e),i.parseProvisioningProfile(e)]);return g({profile:o,bundleId:s,deviceUDID:r,signingMode:f}),i.putSigningAssets({bundleID:s??o.bundleID??o.applicationIdentifier??e.name,deviceUDID:r,teamID:d??o.teamID,signingMode:f,certificateID:p,certificateP12Base64:u,certificateFileName:t.name,certificatePassword:n||void 0,provisioningProfileBase64:A,profileFileName:e.name,profile:o})}function S(t,e={}){g({profile:t.profile,bundleId:e.bundleId,deviceUDID:e.deviceUDID,signingMode:e.signingMode??t.signingMode})}function g({profile:t,bundleId:e,deviceUDID:n,signingMode:s}){if(e&&!i.profileMatchesBundleID(t,e))throw new Error(`Provisioning profile does not match bundle ID ${e}.`);if(n&&!i.profileContainsDevice(t,n))throw new Error("Provisioning profile does not include the selected iPhone.");if(s==="adhoc"&&t.getTaskAllow)throw new Error("Ad Hoc mode requires an Ad Hoc provisioning profile, not a development profile.")}async function l(t){const e=await t.arrayBuffer();let n="";const s=new Uint8Array(e);for(const r of s)n+=String.fromCharCode(r);return btoa(n)}exports.fetchLimbuildInfo=a.fetchLimbuildInfo;exports.getIOSOTAInstall=a.getIOSOTAInstall;exports.startSignedDeviceBuild=a.startSignedDeviceBuild;exports.watchBuildLogEvents=a.watchBuildLogEvents;exports.getReusableAppleSigningAssets=c.getReusableAppleSigningAssets;exports.putAppleGeneratedSigningAssets=c.putAppleGeneratedSigningAssets;exports.getLatestSigningAssets=i.getLatestSigningAssets;exports.getLatestSigningAssetsWithCertificate=i.getLatestSigningAssetsWithCertificate;exports.getSigningAssets=i.getSigningAssets;exports.parseProvisioningProfile=i.parseProvisioningProfile;exports.parseProvisioningProfileBase64=i.parseProvisioningProfileBase64;exports.parseProvisioningProfileBytes=i.parseProvisioningProfileBytes;exports.profileContainsDevice=i.profileContainsDevice;exports.profileMatchesBundleID=i.profileMatchesBundleID;exports.putSigningAssets=i.putSigningAssets;exports.fileToBase64=l;exports.importSigningAssetsFromFiles=v;exports.validateProvisioningProfileForInstall=g;exports.validateSigningAssetsForInstall=S;
@@ -1,8 +1,8 @@
1
- import { f as b, g as B, s as D, w as y } from "../limbuild-client-CFJhYsRx.mjs";
2
- import "../index-BXg7HdIs.mjs";
3
- import { o as C, p as E } from "../provisioning-CdseoMJQ.mjs";
4
- import { p as d, a as m, b as u, c as A } from "../browser-storage-BJ__DGJ6.mjs";
5
- import { g as M, d as T, e as F, f as H, h as N } from "../browser-storage-BJ__DGJ6.mjs";
1
+ import { f as b, g as B, s as D, w as y } from "../limbuild-client-D7U7w342.mjs";
2
+ import "../index-DFdCvi2_.mjs";
3
+ import { o as C, p as E } from "../provisioning-DKbkBO-p.mjs";
4
+ import { p as d, a as m, b as u, c as A } from "../browser-storage-Cx9eW-bm.mjs";
5
+ import { g as M, d as T, e as F, f as H, h as N } from "../browser-storage-Cx9eW-bm.mjs";
6
6
  async function w({
7
7
  certificateFile: i,
8
8
  provisioningProfileFile: e,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),f=require("../limbuild-client-C_CMNLYV.js");require("../index-CMeQfhYy.js");function P({apiUrl:e,token:o,signingAssets:g,loadOTAInstall:I=!1}){const[b,n]=t.useState("idle"),[w,d]=t.useState([]),[B,a]=t.useState(),[h,l]=t.useState(),[x,c]=t.useState(),i=t.useRef(void 0);t.useEffect(()=>()=>{i.current?.(),i.current=void 0},[]);const E=t.useCallback(()=>{i.current?.(),i.current=void 0,n("idle"),d([]),a(void 0),l(void 0),c(void 0)},[]),m=t.useCallback(async(q={})=>{if(!e)throw new Error("apiUrl is required to start a device build.");const u=q.signingAssets??g;if(!u)throw new Error("Signing assets are required to start a device build.");i.current?.(),n("queued"),d([]),a(void 0),l(void 0),c(void 0);try{const r=await f.startSignedDeviceBuild({limbuildApiUrl:e,token:o,certificateP12Base64:u.certificateP12Base64,certificatePassword:u.certificatePassword,provisioningProfileBase64:u.provisioningProfileBase64});if(!r.execId)throw new Error("Build request did not return an exec ID.");return a(r.execId),i.current=f.watchBuildLogEvents({limbuildApiUrl:e,token:o,execId:r.execId,onLine:s=>d(v=>[...v,s]),onStatus:s=>{n(s),s==="succeeded"&&I&&f.getIOSOTAInstall({limbuildApiUrl:e,token:o,execId:r.execId}).then(l).catch(v=>c(S(v)))},onError:s=>c(s.message)}),r.execId}catch(r){n("failed"),c(S(r));return}},[e,I,g,o]);return{status:b,logs:w,execId:B,otaInstall:h,error:x,startBuild:m,reset:E}}function S(e){return e instanceof Error?e.message:String(e)}exports.useDeviceBuild=P;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),v=require("../limbuild-client-CgEncrgx.js");require("../index-CMeQfhYy.js");function P({apiUrl:e,token:n,signingAssets:g,loadOTAInstall:I=!1}){const[b,c]=t.useState("idle"),[w,d]=t.useState([]),[B,a]=t.useState(),[h,l]=t.useState(),[x,o]=t.useState(),i=t.useRef(void 0);t.useEffect(()=>()=>{i.current?.(),i.current=void 0},[]);const E=t.useCallback(()=>{i.current?.(),i.current=void 0,c("idle"),d([]),a(void 0),l(void 0),o(void 0)},[]),m=t.useCallback(async(q={})=>{if(!e)throw new Error("apiUrl is required to start a device build.");const u=q.signingAssets??g;if(!u)throw new Error("Signing assets are required to start a device build.");i.current?.(),c("queued"),d([]),a(void 0),l(void 0),o(void 0);try{const r=await v.startSignedDeviceBuild({limbuildApiUrl:e,token:n,certificateP12Base64:u.certificateP12Base64,certificatePassword:u.certificatePassword,provisioningProfileBase64:u.provisioningProfileBase64});if(!r.execId)throw new Error("Build request did not return an exec ID.");return a(r.execId),i.current=v.watchBuildLogEvents({limbuildApiUrl:e,token:n,execId:r.execId,onLine:s=>d(f=>[...f,s]),onStatus:s=>{c(s),s==="succeeded"&&I&&v.getIOSOTAInstall({limbuildApiUrl:e,token:n,execId:r.execId}).then(l).catch(f=>o(S(f)))},onError:s=>{c("failed"),o(s.message)}}),r.execId}catch(r){c("failed"),o(S(r));return}},[e,I,g,n]);return{status:b,logs:w,execId:B,otaInstall:h,error:x,startBuild:m,reset:E}}function S(e){return e instanceof Error?e.message:String(e)}exports.useDeviceBuild=P;