buckyos 0.7.169 → 0.7.170

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 (75) hide show
  1. package/cli/dist/cli.mjs +1 -1
  2. package/cli/dist/cli.mjs.map +1 -1
  3. package/cli/version.ts +1 -1
  4. package/dist/app-frame.cjs +1 -1
  5. package/dist/app-frame.cjs.map +1 -1
  6. package/dist/app-frame.mjs +1 -0
  7. package/dist/app-frame.mjs.map +1 -1
  8. package/dist/browser.cjs +1 -1
  9. package/dist/browser.cjs.map +1 -1
  10. package/dist/browser.d.ts +1 -1
  11. package/dist/browser.d.ts.map +1 -1
  12. package/dist/browser.mjs +212 -211
  13. package/dist/browser.mjs.map +1 -1
  14. package/dist/content.cjs +1 -1
  15. package/dist/content.cjs.map +1 -1
  16. package/dist/content.d.ts +2 -1
  17. package/dist/content.d.ts.map +1 -1
  18. package/dist/content.mjs +32 -167
  19. package/dist/content.mjs.map +1 -1
  20. package/dist/content_mime-dc80d960.js +2 -0
  21. package/dist/content_mime-dc80d960.js.map +1 -0
  22. package/dist/content_mime-e42d5f8d.mjs +335 -0
  23. package/dist/content_mime-e42d5f8d.mjs.map +1 -0
  24. package/dist/content_mime.d.ts +18 -0
  25. package/dist/content_mime.d.ts.map +1 -1
  26. package/dist/executor_client-1ee523cf.js +13 -0
  27. package/dist/executor_client-1ee523cf.js.map +1 -0
  28. package/dist/{executor_client-a32bc377.mjs → executor_client-5f4d0468.mjs} +1751 -286
  29. package/dist/executor_client-5f4d0468.mjs.map +1 -0
  30. package/dist/file_meta.d.ts +26 -0
  31. package/dist/file_meta.d.ts.map +1 -0
  32. package/dist/index.cjs +1 -1
  33. package/dist/index.cjs.map +1 -1
  34. package/dist/index.d.ts +1 -1
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.mjs +217 -216
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/msg_center_client.d.ts +2 -1
  39. package/dist/msg_center_client.d.ts.map +1 -1
  40. package/dist/namelib.d.ts.map +1 -1
  41. package/dist/ndm_client.d.ts +7 -0
  42. package/dist/ndm_client.d.ts.map +1 -1
  43. package/dist/ndn.d.ts +3 -0
  44. package/dist/ndn.d.ts.map +1 -0
  45. package/dist/ndn_types-8c2696d5.js +2 -0
  46. package/dist/ndn_types-8c2696d5.js.map +1 -0
  47. package/dist/{namelib-b41b10cc.mjs → ndn_types-ab30fac0.mjs} +3077 -2697
  48. package/dist/ndn_types-ab30fac0.mjs.map +1 -0
  49. package/dist/ndn_types.d.ts +268 -16
  50. package/dist/ndn_types.d.ts.map +1 -1
  51. package/dist/node.cjs +1 -1
  52. package/dist/node.cjs.map +1 -1
  53. package/dist/node.d.ts +1 -1
  54. package/dist/node.d.ts.map +1 -1
  55. package/dist/node.mjs +212 -211
  56. package/dist/node.mjs.map +1 -1
  57. package/dist/provision.cjs +2 -2
  58. package/dist/provision.cjs.map +1 -1
  59. package/dist/provision.d.ts +1 -2
  60. package/dist/provision.d.ts.map +1 -1
  61. package/dist/provision.mjs +3 -31
  62. package/dist/provision.mjs.map +1 -1
  63. package/dist/repo_client.d.ts +2 -1
  64. package/dist/repo_client.d.ts.map +1 -1
  65. package/dist/{tus_client-4f7254e9.js → tus_client-b231b248.js} +2 -2
  66. package/dist/{tus_client-4f7254e9.js.map → tus_client-b231b248.js.map} +1 -1
  67. package/dist/{tus_client-04080b1e.mjs → tus_client-d1ffe2d6.mjs} +2 -2
  68. package/dist/{tus_client-04080b1e.mjs.map → tus_client-d1ffe2d6.mjs.map} +1 -1
  69. package/package.json +1 -1
  70. package/dist/executor_client-a32bc377.mjs.map +0 -1
  71. package/dist/executor_client-e026942b.js +0 -13
  72. package/dist/executor_client-e026942b.js.map +0 -1
  73. package/dist/namelib-b41b10cc.mjs.map +0 -1
  74. package/dist/namelib-f8ff0045.js +0 -2
  75. package/dist/namelib-f8ff0045.js.map +0 -1
@@ -34,8 +34,9 @@ var __privateMethod = (obj, member, method) => {
34
34
  __accessCheck(obj, member, "access private method");
35
35
  return method;
36
36
  };
37
- var _listener, _listeners, _cancelled, _allowInsecure, _gzip, _headers, _method, _timeout, _url, _body, _bodyType, _creds, _preflight, _process, _retry, _signal, _throttle, _getUrlFunc, _send, send_fn, _statusCode, _statusMessage, _headers2, _body2, _request, _error, _names, _data, _dataLength, _writeData, writeData_fn, _data2, _offset, _bytesRead, _parent, _maxInflation, _incrementBytesRead, incrementBytesRead_fn, _peekBytes, peekBytes_fn, _r, _s, _v, _networkV, _privateKey, _options, _type, _to, _data3, _nonce, _gasLimit, _gasPrice, _maxPriorityFeePerGas, _maxFeePerGas, _value, _chainId, _sig, _accessList, _maxFeePerBlobGas, _blobVersionedHashes, _kzg, _blobs, _auths, _blobWrapperVersion, _getSerialized, getSerialized_fn, _types, _fullTypes, _encoderCache, _getEncoder, getEncoder_fn, _offset2, _tokens, _subTokenString, subTokenString_fn, _walkAsync, walkAsync_fn, _getCoder, getCoder_fn, _errors, _events, _functions, _abiCoder, _getFunction, getFunction_fn, _getEvent, getEvent_fn, _transactions, _logs, _startBlock, _iface, _iface2, _filter, _a, _supports2544, _resolver, _fetch, fetch_fn, _getResolver, getResolver_fn, _url2, _processFunc, _name, _chainId2, _plugins, _provider, _poller, _interval, _blockNumber, _poll, poll_fn, _provider2, _poll2, _running, _tag, _lastBlock, _filter2, _hash, _provider3, _filter3, _poller2, _running2, _blockNumber2, _poll3, poll_fn2, _subs, _plugins2, _pausedState, _destroyed, _networkPromise, _anyNetwork, _performCache, _lastBlockNumber, _nextTimer, _timers, _disableCcipRead, _requestRate, _requestTimes, _options2, _getDelay, getDelay_fn, _perform, perform_fn, _call, call_fn, _checkNetwork, checkNetwork_fn, _getAccountValue, getAccountValue_fn, _getBlock, getBlock_fn, _hasSub, hasSub_fn, _getSub, getSub_fn, _throwUnsupported, throwUnsupported_fn, _provider4, _filterIdPromise, _poller3, _running3, _network, _hault, _poll4, poll_fn3, _teardown, teardown_fn, _event, _options3, _nextId, _payloads, _drainTimer, _notReady, _network2, _pendingDetectNetwork, _scheduleDrain, scheduleDrain_fn, _pollingInterval, _connect, _signingKey, _data4, _checksum, _words, _loadWords, loadWords_fn, _account, account_fn, _fromSeed, fromSeed_fn, _fromAccount, fromAccount_fn;
38
- import { O as ObjId, u as DID, v as getBrowserIdentityRaw, w as clearBrowserUserInfo, x as saveBrowserIdentity, y as saveBrowserUserInfo, z as getBrowserUserInfo, A as clearBrowserIdentity, N as NODE_IDENTITY_SCHEMA_V2, f as isBuckyOSLocalNodeIdentityConfig, o as parseBuckyOSOwnerDocument, h as hashPassword, B as saveLocalAccountInfo, C as cleanLocalAccountInfo, E as canonicalize, F as signJwtEdDSA, G as ChunkId, H as sha256Bytes, I as FileObject, J as DirObject, S as SimpleChunkList } from "./namelib-b41b10cc.mjs";
37
+ var _listener, _listeners, _cancelled, _allowInsecure, _gzip, _headers, _method, _timeout, _url, _body, _bodyType, _creds, _preflight, _process, _retry, _signal, _throttle, _getUrlFunc, _send, send_fn, _statusCode, _statusMessage, _headers2, _body2, _request, _error, _names, _data, _dataLength, _writeData, writeData_fn, _data2, _offset, _bytesRead, _parent, _maxInflation, _incrementBytesRead, incrementBytesRead_fn, _peekBytes, peekBytes_fn, _a, _r, _s, _v, _networkV, _privateKey, _options, _type, _to, _data3, _nonce, _gasLimit, _gasPrice, _maxPriorityFeePerGas, _maxFeePerGas, _value, _chainId, _sig, _accessList, _maxFeePerBlobGas, _blobVersionedHashes, _kzg, _blobs, _auths, _blobWrapperVersion, _getSerialized, getSerialized_fn, _types, _fullTypes, _encoderCache, _getEncoder, getEncoder_fn, _offset2, _tokens, _subTokenString, subTokenString_fn, _walkAsync, walkAsync_fn, _getCoder, getCoder_fn, _errors, _events, _functions, _abiCoder, _getFunction, getFunction_fn, _getEvent, getEvent_fn, _transactions, _logs, _startBlock, _iface, _iface2, _filter, _b, _supports2544, _resolver, _fetch, fetch_fn, _getResolver, getResolver_fn, _url2, _processFunc, _name, _chainId2, _plugins, _provider, _poller, _interval, _blockNumber, _poll, poll_fn, _provider2, _poll2, _running, _tag, _lastBlock, _filter2, _hash, _provider3, _filter3, _poller2, _running2, _blockNumber2, _poll3, poll_fn2, _subs, _plugins2, _pausedState, _destroyed, _networkPromise, _anyNetwork, _performCache, _lastBlockNumber, _nextTimer, _timers, _disableCcipRead, _requestRate, _requestTimes, _options2, _getDelay, getDelay_fn, _perform, perform_fn, _call, call_fn, _checkNetwork, checkNetwork_fn, _getAccountValue, getAccountValue_fn, _getBlock, getBlock_fn, _hasSub, hasSub_fn, _getSub, getSub_fn, _throwUnsupported, throwUnsupported_fn, _provider4, _filterIdPromise, _poller3, _running3, _network, _hault, _poll4, poll_fn3, _teardown, teardown_fn, _event, _options3, _nextId, _payloads, _drainTimer, _notReady, _network2, _pendingDetectNetwork, _scheduleDrain, scheduleDrain_fn, _pollingInterval, _connect, _signingKey, _data4, _checksum, _words, _loadWords, loadWords_fn, _account, account_fn, _fromSeed, fromSeed_fn, _fromAccount, fromAccount_fn;
38
+ import { O as ObjId, t as DID, u as getBrowserIdentityRaw, v as clearBrowserUserInfo, w as saveBrowserIdentity, x as saveBrowserUserInfo, y as getBrowserUserInfo, z as clearBrowserIdentity, N as NODE_IDENTITY_SCHEMA_V2, e as isBuckyOSLocalNodeIdentityConfig, m as parseBuckyOSOwnerDocument, h as hashPassword, A as saveLocalAccountInfo, B as cleanLocalAccountInfo, C as canonicalize, E as signJwtEdDSA, F as FileObject, G as ACTION_TYPE_DOWNLOAD, H as ACTION_TYPE_INSTALLED, I as ACTION_TYPE_LIKED, J as ACTION_TYPE_PURCHASED, K as ACTION_TYPE_SHARED, L as ACTION_TYPE_UNLIKED, M as ACTION_TYPE_VIEWED, P as BaseContentObject, Q as CYFS_CONTENT_TYPE_NAMED_OBJECT_JSON, R as CYFS_CONTENT_TYPE_NAMED_OBJECT_JWT, S as ChunkId, T as ChunkType, U as DEFAULT_HASH_METHOD, V as DirObject, W as HashMethod, X as InclusionProof, Y as KnownStandardObject, Z as MSG_OBJECT_RESERVED_KEYS, _ as MSG_REACTION_KEY_MAX_BYTES, $ as MSG_SESSION_ID_MAX_CHARS, a0 as NamedObjectBase, a1 as NdnError, a2 as OBJ_TYPE_ACTION, a3 as OBJ_TYPE_CHUNK_LIST, a4 as OBJ_TYPE_DIR, a5 as OBJ_TYPE_FILE, a6 as OBJ_TYPE_INCLUSION_PROOF, a7 as OBJ_TYPE_LIST, a8 as OBJ_TYPE_MSG, a9 as OBJ_TYPE_OBJMAP, aa as OBJ_TYPE_PACK, ab as OBJ_TYPE_PATH, ac as OBJ_TYPE_PKG, ad as OBJ_TYPE_RECEIPT, ae as OBJ_TYPE_RELATION, af as PathObject, ag as RELATION_TYPE_PART_OF, ah as RELATION_TYPE_SAME, ai as RelationObject, aj as SimpleChunkList, ak as SimpleMapItem, al as SimpleObjectMap, am as actionObjectFromJson, an as base32Decode, ao as base32Encode, ap as buildNamedObjectByJson, aq as buildNamedObjectByJwt, ar as buildObjId, as as bytesToHex$2, at as calcPkgMetaObjId, au as canonicalizeJson, av as decodeMsgObjectJwt, aw as extractObjIdByPath, ax as hexToBytes$1, ay as isCyfsNamedObjectContentType, az as isValidMsgSessionId, aA as loadNamedObj, aB as loadNamedObjAndVerify, aC as loadNamedObjectFromObjStr, aD as msgJwtKidDid, aE as msgObjectFromJsonChecked, aF as namedObjectEncodingFromContentType, aG as normalizePackageMetaForObjId, aH as randomMsgNonce, aI as receiptObjFromJson, aJ as sha256Bytes, aK as sha256Utf8, aL as toCanonicalJsonString, aM as validateMsgObject, aN as varintDecode, aO as varintEncode, aP as verifyMsgObjectJwt, aQ as verifyNamedObject, aR as verifyNamedObjectFromJwt, aS as verifyNamedObjectFromStr } from "./ndn_types-ab30fac0.mjs";
39
+ import { s as sniffMagic, m as mediaTypeFromExtension, e as extensionOf, a as stripMediaTypeParams, h as heifImageSize, i as isoBoxes } from "./content_mime-e42d5f8d.mjs";
39
40
  class RPCError extends Error {
40
41
  constructor(message, code, data) {
41
42
  super(message);
@@ -901,8 +902,8 @@ class AiWorkspaceClient {
901
902
  runClaim(workspace_id, run_id, claim_token, executor) {
902
903
  return this.call("proc.claim", { workspace_id, run_id, claim_token, ...executor ? { executor } : {} });
903
904
  }
904
- runHeartbeat(workspace_id, run_id, attempt, progress) {
905
- return this.call("proc.heartbeat", { workspace_id, run_id, attempt, ...progress ? { progress } : {} });
905
+ runHeartbeat(workspace_id, run_id, attempt2, progress) {
906
+ return this.call("proc.heartbeat", { workspace_id, run_id, attempt: attempt2, ...progress ? { progress } : {} });
906
907
  }
907
908
  runReport(workspace_id, report) {
908
909
  return this.call("proc.report", { workspace_id, ...report });
@@ -1657,16 +1658,16 @@ class TaskManagerClient {
1657
1658
  }
1658
1659
  async runnerStart(taskId) {
1659
1660
  const task = await this.getTask(taskId);
1660
- let attempt;
1661
+ let attempt2;
1661
1662
  if (task.phase === "Accepted") {
1662
- attempt = this.reportStarted(this.snapshotEnvelope(task));
1663
+ attempt2 = this.reportStarted(this.snapshotEnvelope(task));
1663
1664
  } else if (task.phase === "Waiting") {
1664
- attempt = this.reportRunning(this.snapshotEnvelope(task));
1665
+ attempt2 = this.reportRunning(this.snapshotEnvelope(task));
1665
1666
  } else {
1666
1667
  return task;
1667
1668
  }
1668
1669
  try {
1669
- return await attempt;
1670
+ return await attempt2;
1670
1671
  } catch (error) {
1671
1672
  const code = taskMgrErrorCode(error);
1672
1673
  if (code === TASK_ERR_REVISION_CONFLICT || code === TASK_ERR_INVALID_PHASE) {
@@ -2763,8 +2764,8 @@ function aspectRatio(value) {
2763
2764
  return width >= 1 && width <= 100 && height >= 1 && height <= 100 ? [width, height] : void 0;
2764
2765
  }
2765
2766
  function reducedRatio(width, height) {
2766
- const gcd = (a, b2) => b2 === 0 ? a : gcd(b2, a % b2);
2767
- const divisor = Math.max(gcd(width, height), 1);
2767
+ const gcd2 = (a, b2) => b2 === 0 ? a : gcd2(b2, a % b2);
2768
+ const divisor = Math.max(gcd2(width, height), 1);
2768
2769
  return `${width / divisor}:${height / divisor}`;
2769
2770
  }
2770
2771
  function validateResourceRef(value, field) {
@@ -2872,7 +2873,7 @@ function validateVideoEdit(request) {
2872
2873
  validateVideoOutput(request.output);
2873
2874
  }
2874
2875
  function videoGenerationRequirement(request) {
2875
- var _a2, _b;
2876
+ var _a2, _b2;
2876
2877
  const conditions = request.conditions ?? [];
2877
2878
  const count = (type) => conditions.filter((condition) => condition.type === type).length;
2878
2879
  const declared = ((_a2 = request.requirements) == null ? void 0 : _a2.video) ?? {};
@@ -2881,7 +2882,7 @@ function videoGenerationRequirement(request) {
2881
2882
  if (value || declared[key])
2882
2883
  requirement[key] = true;
2883
2884
  };
2884
- flag("prompt", !!((_b = request.prompt) == null ? void 0 : _b.trim()));
2885
+ flag("prompt", !!((_b2 = request.prompt) == null ? void 0 : _b2.trim()));
2885
2886
  flag("negative_prompt", request.negative_prompt !== void 0);
2886
2887
  flag("seed", request.seed !== void 0);
2887
2888
  for (const [key, type] of [["reference_images", "reference_image"], ["reference_videos", "reference_video"], ["reference_audios", "reference_audio"]]) {
@@ -3567,10 +3568,8 @@ function notifyUrl(zoneHost, notifyId) {
3567
3568
  return host ? `https://${host}${path}` : path;
3568
3569
  }
3569
3570
  function msgMachineData(msg, intent) {
3570
- const content = msg == null ? void 0 : msg.content;
3571
- if (!content || typeof content !== "object")
3572
- return null;
3573
- const machine = content.machine;
3571
+ var _a2;
3572
+ const machine = (_a2 = msg == null ? void 0 : msg.content) == null ? void 0 : _a2.machine;
3574
3573
  if (!machine || typeof machine !== "object" || machine.intent !== intent)
3575
3574
  return null;
3576
3575
  const data = machine.data;
@@ -3581,7 +3580,7 @@ function notifyMessageData(msg) {
3581
3580
  return data && typeof data.notify_id === "string" ? data : null;
3582
3581
  }
3583
3582
  async function commitNotifyAnswer(tasks, taskId, answer, submittedBy, nowMs = Date.now()) {
3584
- for (let attempt = 0; attempt < 3; attempt += 1) {
3583
+ for (let attempt2 = 0; attempt2 < 3; attempt2 += 1) {
3585
3584
  const task2 = await tasks.getTask(taskId);
3586
3585
  if (isTerminalTaskPhase(task2.phase) || task2.result != null) {
3587
3586
  return { kind: "already_closed", task: task2 };
@@ -6083,7 +6082,7 @@ class BuckyOSSDK {
6083
6082
  return this.currentAccountInfo;
6084
6083
  }
6085
6084
  async loginByPassword(username, password, target) {
6086
- var _a2, _b, _c;
6085
+ var _a2, _b2, _c;
6087
6086
  const appId = this.getAppId();
6088
6087
  if (appId == null) {
6089
6088
  console.error("BuckyOS WebSDK is not initialized,call initBuckyOS first");
@@ -6129,7 +6128,7 @@ class BuckyOSSDK {
6129
6128
  });
6130
6129
  }
6131
6130
  this.currentAccountInfo = accountInfo;
6132
- (_b = this.currentRuntime) == null ? void 0 : _b.setSessionToken(accountInfo.session_token);
6131
+ (_b2 = this.currentRuntime) == null ? void 0 : _b2.setSessionToken(accountInfo.session_token);
6133
6132
  (_c = this.currentRuntime) == null ? void 0 : _c.setRefreshToken(accountInfo.refresh_token ?? null);
6134
6133
  return accountInfo;
6135
6134
  } catch (error) {
@@ -6237,12 +6236,12 @@ class BuckyOSSDK {
6237
6236
  throw new Error("BuckyApi is only available in browser runtime");
6238
6237
  }
6239
6238
  return (async () => {
6240
- var _a2, _b;
6239
+ var _a2, _b2;
6241
6240
  const result = await window.BuckyApi.signJsonWithActiveDid(payloads);
6242
6241
  if (result.code === 0) {
6243
6242
  return {
6244
6243
  signatures: Array.isArray((_a2 = result.data) == null ? void 0 : _a2.signatures) ? result.data.signatures : [],
6245
- pwd_hash: typeof ((_b = result.data) == null ? void 0 : _b.pwd_hash) === "string" ? result.data.pwd_hash : null
6244
+ pwd_hash: typeof ((_b2 = result.data) == null ? void 0 : _b2.pwd_hash) === "string" ? result.data.pwd_hash : null
6246
6245
  };
6247
6246
  }
6248
6247
  console.error("BuckyApi.signWithActiveDid failed: ", result.message);
@@ -6446,7 +6445,7 @@ class BuckyOSSDK {
6446
6445
  return runtimeType === RuntimeType.AppClient || runtimeType === RuntimeType.AppService;
6447
6446
  }
6448
6447
  detectEnvironmentRuntimeType() {
6449
- var _a2, _b;
6448
+ var _a2, _b2;
6450
6449
  if (this.target === "browser") {
6451
6450
  if (typeof window !== "undefined" && window.BuckyApi) {
6452
6451
  return RuntimeType.AppRuntime;
@@ -6467,7 +6466,7 @@ class BuckyOSSDK {
6467
6466
  return RuntimeType.Browser;
6468
6467
  }
6469
6468
  const runtimeProcess = globalThis.process;
6470
- if ((_b = runtimeProcess == null ? void 0 : runtimeProcess.versions) == null ? void 0 : _b.node) {
6469
+ if ((_b2 = runtimeProcess == null ? void 0 : runtimeProcess.versions) == null ? void 0 : _b2.node) {
6471
6470
  return RuntimeType.NodeJS;
6472
6471
  }
6473
6472
  return RuntimeType.Unknown;
@@ -8503,9 +8502,9 @@ _signal = new WeakMap();
8503
8502
  _throttle = new WeakMap();
8504
8503
  _getUrlFunc = new WeakMap();
8505
8504
  _send = new WeakSet();
8506
- send_fn = async function(attempt, expires, delay2, _request2, _response) {
8507
- var _a2, _b, _c;
8508
- if (attempt >= __privateGet(this, _throttle).maxAttempts) {
8505
+ send_fn = async function(attempt2, expires, delay2, _request2, _response) {
8506
+ var _a2, _b2, _c;
8507
+ if (attempt2 >= __privateGet(this, _throttle).maxAttempts) {
8509
8508
  return _response.makeServerError("exceeded maximum retry limit");
8510
8509
  }
8511
8510
  assert(getTime$1() <= expires, "timeout", "TIMEOUT", {
@@ -8544,18 +8543,18 @@ send_fn = async function(attempt, expires, delay2, _request2, _response) {
8544
8543
  if ([301, 302, 307, 308].indexOf(response.statusCode) >= 0) {
8545
8544
  try {
8546
8545
  const location = response.headers.location || "";
8547
- return __privateMethod(_a2 = req.redirect(location), _send, send_fn).call(_a2, attempt + 1, expires, 0, _request2, response);
8546
+ return __privateMethod(_a2 = req.redirect(location), _send, send_fn).call(_a2, attempt2 + 1, expires, 0, _request2, response);
8548
8547
  } catch (error) {
8549
8548
  }
8550
8549
  return response;
8551
8550
  } else if (response.statusCode === 429) {
8552
- if (this.retryFunc == null || await this.retryFunc(req, response, attempt)) {
8551
+ if (this.retryFunc == null || await this.retryFunc(req, response, attempt2)) {
8553
8552
  const retryAfter = response.headers["retry-after"];
8554
- let delay3 = __privateGet(this, _throttle).slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt));
8553
+ let delay3 = __privateGet(this, _throttle).slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt2));
8555
8554
  if (typeof retryAfter === "string" && retryAfter.match(/^[1-9][0-9]*$/)) {
8556
8555
  delay3 = parseInt(retryAfter);
8557
8556
  }
8558
- return __privateMethod(_b = req.clone(), _send, send_fn).call(_b, attempt + 1, expires, delay3, _request2, response);
8557
+ return __privateMethod(_b2 = req.clone(), _send, send_fn).call(_b2, attempt2 + 1, expires, delay3, _request2, response);
8559
8558
  }
8560
8559
  }
8561
8560
  if (this.processFunc) {
@@ -8566,11 +8565,11 @@ send_fn = async function(attempt, expires, delay2, _request2, _response) {
8566
8565
  if (error.throttle == null || typeof error.stall !== "number") {
8567
8566
  response.makeServerError("error in post-processing function", error).assertOk();
8568
8567
  }
8569
- let delay3 = __privateGet(this, _throttle).slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt));
8568
+ let delay3 = __privateGet(this, _throttle).slotInterval * Math.trunc(Math.random() * Math.pow(2, attempt2));
8570
8569
  if (error.stall >= 0) {
8571
8570
  delay3 = error.stall;
8572
8571
  }
8573
- return __privateMethod(_c = req.clone(), _send, send_fn).call(_c, attempt + 1, expires, delay3, _request2, response);
8572
+ return __privateMethod(_c = req.clone(), _send, send_fn).call(_c, attempt2 + 1, expires, delay3, _request2, response);
8574
8573
  }
8575
8574
  }
8576
8575
  return response;
@@ -9231,7 +9230,7 @@ writeData_fn = function(data) {
9231
9230
  __privateSet(this, _dataLength, __privateGet(this, _dataLength) + data.length);
9232
9231
  return data.length;
9233
9232
  };
9234
- const _Reader = class _Reader {
9233
+ let Reader$1 = (_a = class {
9235
9234
  constructor(data, allowLoose, maxInflation) {
9236
9235
  __privateAdd(this, _incrementBytesRead);
9237
9236
  __privateAdd(this, _peekBytes);
@@ -9266,7 +9265,7 @@ const _Reader = class _Reader {
9266
9265
  }
9267
9266
  // Create a sub-reader with the same underlying data, but offset
9268
9267
  subReader(offset) {
9269
- const reader = new _Reader(__privateGet(this, _data2).slice(__privateGet(this, _offset) + offset), this.allowLoose, __privateGet(this, _maxInflation));
9268
+ const reader = new _a(__privateGet(this, _data2).slice(__privateGet(this, _offset) + offset), this.allowLoose, __privateGet(this, _maxInflation));
9270
9269
  __privateSet(reader, _parent, this);
9271
9270
  return reader;
9272
9271
  }
@@ -9284,14 +9283,7 @@ const _Reader = class _Reader {
9284
9283
  readIndex() {
9285
9284
  return toNumber(this.readBytes(WordSize));
9286
9285
  }
9287
- };
9288
- _data2 = new WeakMap();
9289
- _offset = new WeakMap();
9290
- _bytesRead = new WeakMap();
9291
- _parent = new WeakMap();
9292
- _maxInflation = new WeakMap();
9293
- _incrementBytesRead = new WeakSet();
9294
- incrementBytesRead_fn = function(count) {
9286
+ }, _data2 = new WeakMap(), _offset = new WeakMap(), _bytesRead = new WeakMap(), _parent = new WeakMap(), _maxInflation = new WeakMap(), _incrementBytesRead = new WeakSet(), incrementBytesRead_fn = function(count) {
9295
9287
  var _a2;
9296
9288
  if (__privateGet(this, _parent)) {
9297
9289
  return __privateMethod(_a2 = __privateGet(this, _parent), _incrementBytesRead, incrementBytesRead_fn).call(_a2, count);
@@ -9306,9 +9298,7 @@ incrementBytesRead_fn = function(count) {
9306
9298
  dataLength: this.dataLength
9307
9299
  }
9308
9300
  });
9309
- };
9310
- _peekBytes = new WeakSet();
9311
- peekBytes_fn = function(offset, length, loose) {
9301
+ }, _peekBytes = new WeakSet(), peekBytes_fn = function(offset, length, loose) {
9312
9302
  let alignedLength = Math.ceil(length / WordSize) * WordSize;
9313
9303
  if (__privateGet(this, _offset) + alignedLength > __privateGet(this, _data2).length) {
9314
9304
  if (this.allowLoose && loose && __privateGet(this, _offset) + length <= __privateGet(this, _data2).length) {
@@ -9322,8 +9312,7 @@ peekBytes_fn = function(offset, length, loose) {
9322
9312
  }
9323
9313
  }
9324
9314
  return __privateGet(this, _data2).slice(__privateGet(this, _offset), __privateGet(this, _offset) + alignedLength);
9325
- };
9326
- let Reader = _Reader;
9315
+ }, _a);
9327
9316
  function number(n2) {
9328
9317
  if (!Number.isSafeInteger(n2) || n2 < 0)
9329
9318
  throw new Error(`Wrong positive integer: ${n2}`);
@@ -10940,8 +10929,8 @@ function invert(number2, modulo) {
10940
10929
  const m = x - u * q;
10941
10930
  b2 = a, a = r, x = u, u = m;
10942
10931
  }
10943
- const gcd = b2;
10944
- if (gcd !== _1n$3)
10932
+ const gcd2 = b2;
10933
+ if (gcd2 !== _1n$3)
10945
10934
  throw new Error("invert: does not exist");
10946
10935
  return mod(x, modulo);
10947
10936
  }
@@ -17902,7 +17891,7 @@ const _AbiCoder = class _AbiCoder {
17902
17891
  decode(types, data, loose) {
17903
17892
  const coders = types.map((type) => __privateMethod(this, _getCoder, getCoder_fn).call(this, ParamType.from(type)));
17904
17893
  const coder = new TupleCoder(coders, "_");
17905
- return coder.decode(new Reader(data, loose, defaultMaxInflation));
17894
+ return coder.decode(new Reader$1(data, loose, defaultMaxInflation));
17906
17895
  }
17907
17896
  static _setDefaultMaxInflation(value) {
17908
17897
  assertArgument(typeof value === "number" && Number.isInteger(value), "invalid defaultMaxInflation factor", "value", value);
@@ -20919,7 +20908,7 @@ const _BaseContract = class _BaseContract {
20919
20908
  /**
20920
20909
  * @_ignore:
20921
20910
  */
20922
- __publicField(this, _a);
20911
+ __publicField(this, _b);
20923
20912
  /**
20924
20913
  * The fallback or receive function if any.
20925
20914
  */
@@ -21310,7 +21299,7 @@ const _BaseContract = class _BaseContract {
21310
21299
  return contract;
21311
21300
  }
21312
21301
  };
21313
- _a = internal;
21302
+ _b = internal;
21314
21303
  let BaseContract = _BaseContract;
21315
21304
  function _ContractBase() {
21316
21305
  return BaseContract;
@@ -23977,8 +23966,8 @@ perform_fn = async function(req) {
23977
23966
  return await perform;
23978
23967
  };
23979
23968
  _call = new WeakSet();
23980
- call_fn = async function(tx, blockTag, attempt) {
23981
- assert(attempt < MAX_CCIP_REDIRECTS, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", {
23969
+ call_fn = async function(tx, blockTag, attempt2) {
23970
+ assert(attempt2 < MAX_CCIP_REDIRECTS, "CCIP read exceeded maximum redirections", "OFFCHAIN_FAULT", {
23982
23971
  reason: "TOO_MANY_REDIRECTS",
23983
23972
  transaction: Object.assign({}, tx, { blockTag, enableCcipRead: true })
23984
23973
  });
@@ -23990,7 +23979,7 @@ call_fn = async function(tx, blockTag, attempt) {
23990
23979
  }
23991
23980
  return hexlify(await this._perform({ method: "call", transaction, blockTag }));
23992
23981
  } catch (error) {
23993
- if (!this.disableCcipRead && isCallException(error) && error.data && attempt >= 0 && blockTag === "latest" && transaction.to != null && dataSlice(error.data, 0, 4) === "0x556f1830") {
23982
+ if (!this.disableCcipRead && isCallException(error) && error.data && attempt2 >= 0 && blockTag === "latest" && transaction.to != null && dataSlice(error.data, 0, 4) === "0x556f1830") {
23994
23983
  const data = error.data;
23995
23984
  const txSender = await resolveAddress(transaction.to, this);
23996
23985
  let ccipArgs;
@@ -24027,7 +24016,7 @@ call_fn = async function(tx, blockTag, attempt) {
24027
24016
  };
24028
24017
  this.emit("debug", { action: "sendCcipReadCall", transaction: tx2 });
24029
24018
  try {
24030
- const result = await __privateMethod(this, _call, call_fn).call(this, tx2, blockTag, attempt + 1);
24019
+ const result = await __privateMethod(this, _call, call_fn).call(this, tx2, blockTag, attempt2 + 1);
24031
24020
  this.emit("debug", { action: "receiveCcipReadCallResult", transaction: Object.assign({}, tx2), result });
24032
24021
  return result;
24033
24022
  } catch (error2) {
@@ -26143,7 +26132,7 @@ class CTR extends ModeOfOperation {
26143
26132
  }
26144
26133
  }
26145
26134
  encrypt(plaintext) {
26146
- var _a2, _b;
26135
+ var _a2, _b2;
26147
26136
  const crypttext = new Uint8Array(plaintext);
26148
26137
  for (let i = 0; i < crypttext.length; i++) {
26149
26138
  if (__classPrivateFieldGet(this, _CTR_remainingIndex, "f") === 16) {
@@ -26151,7 +26140,7 @@ class CTR extends ModeOfOperation {
26151
26140
  __classPrivateFieldSet(this, _CTR_remainingIndex, 0, "f");
26152
26141
  this.increment();
26153
26142
  }
26154
- crypttext[i] ^= __classPrivateFieldGet(this, _CTR_remaining, "f")[__classPrivateFieldSet(this, _CTR_remainingIndex, (_b = __classPrivateFieldGet(this, _CTR_remainingIndex, "f"), _a2 = _b++, _b), "f"), _a2];
26143
+ crypttext[i] ^= __classPrivateFieldGet(this, _CTR_remaining, "f")[__classPrivateFieldSet(this, _CTR_remainingIndex, (_b2 = __classPrivateFieldGet(this, _CTR_remainingIndex, "f"), _a2 = _b2++, _b2), "f"), _a2];
26155
26144
  }
26156
26145
  return crypttext;
26157
26146
  }
@@ -27111,7 +27100,7 @@ function canonicalJsonBytes(value) {
27111
27100
  }
27112
27101
  return bytes2;
27113
27102
  }
27114
- function decodeUtf8(bytes2) {
27103
+ function decodeUtf8$1(bytes2) {
27115
27104
  if (typeof TextDecoder !== "undefined") {
27116
27105
  return new TextDecoder().decode(new Uint8Array(bytes2));
27117
27106
  }
@@ -27225,7 +27214,7 @@ class BnsEvmTxBuilder {
27225
27214
  }
27226
27215
  let parsed;
27227
27216
  try {
27228
- parsed = JSON.parse(decodeUtf8(current.document_state.document.inline_document));
27217
+ parsed = JSON.parse(decodeUtf8$1(current.document_state.document.inline_document));
27229
27218
  } catch (error) {
27230
27219
  throw new BnsEvmTxError(
27231
27220
  "INVALID_DOCUMENT",
@@ -28468,6 +28457,1473 @@ const sn_client = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePro
28468
28457
  parseSnRegionProbeConfig,
28469
28458
  validateSnRegionProbeConfig
28470
28459
  }, Symbol.toStringTag, { value: "Module" }));
28460
+ const FILE_META_READ_LIMIT = 8 * 1024 * 1024;
28461
+ const READ_WINDOW = 64 * 1024;
28462
+ const SNIFF_BYTES = 4096;
28463
+ const MAX_TEXT_BYTES = 4096;
28464
+ const MAX_TEXT_CHARS = 128;
28465
+ const MAX_JPEG_SEGMENTS = 1024;
28466
+ const MAX_PNG_CHUNKS = 1024;
28467
+ const MAX_RIFF_CHUNKS = 64;
28468
+ const MAX_ISO_BOXES = 4096;
28469
+ const MAX_ID3_FRAMES = 1024;
28470
+ const MP4_EPOCH_TO_UNIX_SECS = 2082844800;
28471
+ const MAX_UNIX_SECS = 253402300799;
28472
+ const MEDIA_ELEMENT_TIMEOUT_MS = 5e3;
28473
+ function isBlob(source) {
28474
+ return typeof Blob !== "undefined" && source instanceof Blob;
28475
+ }
28476
+ function blobSource(blob) {
28477
+ return {
28478
+ size: blob.size,
28479
+ readAt: async (offset, length) => new Uint8Array(await blob.slice(offset, offset + length).arrayBuffer())
28480
+ };
28481
+ }
28482
+ function isMediaType(mime) {
28483
+ return mime.startsWith("image/") || mime.startsWith("video/") || mime.startsWith("audio/");
28484
+ }
28485
+ function declaredMediaType(declared) {
28486
+ const mime = stripMediaTypeParams(declared);
28487
+ if (mime === "application/octet-stream" || mime === "binary/octet-stream")
28488
+ return void 0;
28489
+ return /^[\w.+-]+\/[\w.+-]+$/.test(mime) ? mime : void 0;
28490
+ }
28491
+ function resolveMime(magic, name, declared) {
28492
+ if (magic && isMediaType(magic))
28493
+ return magic;
28494
+ return declaredMediaType(declared) ?? mediaTypeFromExtension(extensionOf(name)) ?? magic ?? void 0;
28495
+ }
28496
+ class Reader {
28497
+ constructor(source) {
28498
+ this.source = source;
28499
+ this.remaining = FILE_META_READ_LIMIT;
28500
+ this.windowStart = 0;
28501
+ this.window = new Uint8Array(0);
28502
+ this.size = source.size;
28503
+ }
28504
+ async read(offset, length) {
28505
+ const end = offset + length;
28506
+ if (!Number.isSafeInteger(end) || end > this.size)
28507
+ throw STOP;
28508
+ if (length === 0)
28509
+ return new Uint8Array(0);
28510
+ const windowEnd = this.windowStart + this.window.length;
28511
+ if (offset >= this.windowStart && end <= windowEnd) {
28512
+ const from = offset - this.windowStart;
28513
+ return this.window.subarray(from, from + length);
28514
+ }
28515
+ const fetch2 = Math.min(Math.max(length, READ_WINDOW), this.size - offset);
28516
+ if (fetch2 > this.remaining)
28517
+ throw STOP;
28518
+ this.remaining -= fetch2;
28519
+ const bytes2 = await this.source.readAt(offset, fetch2);
28520
+ if (bytes2.length !== fetch2)
28521
+ throw STOP;
28522
+ this.windowStart = offset;
28523
+ this.window = bytes2;
28524
+ return bytes2.subarray(0, length);
28525
+ }
28526
+ }
28527
+ const STOP = new Error("stop parsing");
28528
+ async function attempt(run) {
28529
+ try {
28530
+ return await run();
28531
+ } catch {
28532
+ return void 0;
28533
+ }
28534
+ }
28535
+ function attemptSync(run) {
28536
+ try {
28537
+ return run();
28538
+ } catch {
28539
+ return void 0;
28540
+ }
28541
+ }
28542
+ function be16(b2, at) {
28543
+ if (at + 2 > b2.length)
28544
+ throw STOP;
28545
+ return b2[at] * 256 + b2[at + 1];
28546
+ }
28547
+ function be32(b2, at) {
28548
+ if (at + 4 > b2.length)
28549
+ throw STOP;
28550
+ return b2[at] * 16777216 + b2[at + 1] * 65536 + b2[at + 2] * 256 + b2[at + 3];
28551
+ }
28552
+ function be64(b2, at) {
28553
+ const value = be32(b2, at) * 4294967296 + be32(b2, at + 4);
28554
+ if (!Number.isSafeInteger(value))
28555
+ throw STOP;
28556
+ return value;
28557
+ }
28558
+ function beUint(b2, at, bytes2) {
28559
+ switch (bytes2) {
28560
+ case 0:
28561
+ return 0;
28562
+ case 2:
28563
+ return be16(b2, at);
28564
+ case 4:
28565
+ return be32(b2, at);
28566
+ case 8:
28567
+ return be64(b2, at);
28568
+ default:
28569
+ throw STOP;
28570
+ }
28571
+ }
28572
+ function le16(b2, at) {
28573
+ if (at + 2 > b2.length)
28574
+ throw STOP;
28575
+ return b2[at] + b2[at + 1] * 256;
28576
+ }
28577
+ function le24(b2, at) {
28578
+ if (at + 3 > b2.length)
28579
+ throw STOP;
28580
+ return b2[at] + b2[at + 1] * 256 + b2[at + 2] * 65536;
28581
+ }
28582
+ function le32(b2, at) {
28583
+ if (at + 4 > b2.length)
28584
+ throw STOP;
28585
+ return b2[at] + b2[at + 1] * 256 + b2[at + 2] * 65536 + b2[at + 3] * 16777216;
28586
+ }
28587
+ function asciiAt(b2, at, expected) {
28588
+ if (at + expected.length > b2.length)
28589
+ return false;
28590
+ for (let i = 0; i < expected.length; i += 1) {
28591
+ if (b2[at + i] !== expected.charCodeAt(i))
28592
+ return false;
28593
+ }
28594
+ return true;
28595
+ }
28596
+ function fourCC(b2, at) {
28597
+ return String.fromCharCode(b2[at], b2[at + 1], b2[at + 2], b2[at + 3]);
28598
+ }
28599
+ function roundTo(value, scale) {
28600
+ if (!Number.isFinite(value))
28601
+ return void 0;
28602
+ const rounded = Math.round(Math.abs(value) * scale) / scale;
28603
+ const signed2 = value < 0 ? -rounded : rounded;
28604
+ return signed2 === 0 ? 0 : signed2;
28605
+ }
28606
+ function millis(amount, perSecond) {
28607
+ if (amount === 0 || perSecond === 0)
28608
+ return void 0;
28609
+ const ms = Math.round(amount * 1e3 / perSecond);
28610
+ return ms >= 1 && Number.isSafeInteger(ms) ? ms : void 0;
28611
+ }
28612
+ const WHITESPACE = "\\u0009-\\u000d\\u0020\\u0085\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000";
28613
+ const LEADING_WHITESPACE = new RegExp(`^[${WHITESPACE}]+`);
28614
+ const TRAILING_WHITESPACE = new RegExp(`[${WHITESPACE}]+$`);
28615
+ function trimEnd(text) {
28616
+ return text.replace(TRAILING_WHITESPACE, "");
28617
+ }
28618
+ function trim(text) {
28619
+ return trimEnd(text.replace(LEADING_WHITESPACE, ""));
28620
+ }
28621
+ function firstValue(text) {
28622
+ const start = text.replace(/^\0+/, "");
28623
+ const end = start.indexOf("\0");
28624
+ return end < 0 ? start : start.slice(0, end);
28625
+ }
28626
+ function cleanText(text) {
28627
+ const visible = firstValue(text).replace(/[\u0000-\u001f\u007f-\u009f]/g, "");
28628
+ const out = trimEnd(Array.from(trim(visible)).slice(0, MAX_TEXT_CHARS).join(""));
28629
+ return out.length > 0 ? out : void 0;
28630
+ }
28631
+ const utf8Decoder = new TextDecoder("utf-8", { ignoreBOM: true });
28632
+ function decodeUtf8(bytes2) {
28633
+ return utf8Decoder.decode(bytes2);
28634
+ }
28635
+ function cleanBytes(bytes2) {
28636
+ return cleanText(decodeUtf8(bytes2));
28637
+ }
28638
+ function digits(text) {
28639
+ return /^[0-9]+$/.test(text) ? Number(text) : void 0;
28640
+ }
28641
+ function daysInMonth(year, month) {
28642
+ switch (month) {
28643
+ case 1:
28644
+ case 3:
28645
+ case 5:
28646
+ case 7:
28647
+ case 8:
28648
+ case 10:
28649
+ case 12:
28650
+ return 31;
28651
+ case 4:
28652
+ case 6:
28653
+ case 9:
28654
+ case 11:
28655
+ return 30;
28656
+ case 2:
28657
+ return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0) ? 29 : 28;
28658
+ default:
28659
+ return 0;
28660
+ }
28661
+ }
28662
+ function parseDateTime(text, dateSep, timeSep) {
28663
+ if (text.length !== 19 || text[4] !== dateSep || text[7] !== dateSep || text[10] !== timeSep || text[13] !== ":" || text[16] !== ":")
28664
+ return void 0;
28665
+ const year = digits(text.slice(0, 4));
28666
+ const month = digits(text.slice(5, 7));
28667
+ const day = digits(text.slice(8, 10));
28668
+ const hour = digits(text.slice(11, 13));
28669
+ const minute = digits(text.slice(14, 16));
28670
+ const second = digits(text.slice(17, 19));
28671
+ if (year === void 0 || month === void 0 || day === void 0 || hour === void 0 || minute === void 0 || second === void 0)
28672
+ return void 0;
28673
+ if (year === 0 || day === 0 || day > daysInMonth(year, month) || hour > 23 || minute > 59 || second > 59)
28674
+ return void 0;
28675
+ return `${text.slice(0, 4)}-${text.slice(5, 7)}-${text.slice(8, 10)}T${text.slice(11, 13)}:${text.slice(14, 16)}:${text.slice(17, 19)}`;
28676
+ }
28677
+ function parseFraction(text) {
28678
+ const value = trim(text);
28679
+ return /^[0-9]+$/.test(value) ? `.${value.slice(0, 9)}` : void 0;
28680
+ }
28681
+ function parseOffset(text) {
28682
+ const value = trim(text);
28683
+ if (value === "Z")
28684
+ return "Z";
28685
+ const match = /^([+-])([0-9]{2})(?::?([0-9]{2}))?$/.exec(value);
28686
+ if (!match)
28687
+ return void 0;
28688
+ const hours = Number(match[2]);
28689
+ const minutes = Number(match[3] ?? "00");
28690
+ if (hours > 14 || minutes > 59)
28691
+ return void 0;
28692
+ return `${match[1]}${match[2]}:${match[3] ?? "00"}`;
28693
+ }
28694
+ function parseIsoDateTime(text) {
28695
+ if (text.length < 19 || !/^[\x00-\x7f]*$/.test(text))
28696
+ return void 0;
28697
+ const base = parseDateTime(text.slice(0, 19), "-", "T");
28698
+ if (base === void 0)
28699
+ return void 0;
28700
+ let rest = text.slice(19);
28701
+ let out = base;
28702
+ if (rest.startsWith(".")) {
28703
+ const fraction = /^[0-9]*/.exec(rest.slice(1))[0];
28704
+ const parsed = parseFraction(fraction);
28705
+ if (parsed === void 0)
28706
+ return void 0;
28707
+ out += parsed;
28708
+ rest = rest.slice(1 + fraction.length);
28709
+ }
28710
+ if (rest.length > 0) {
28711
+ const offset = parseOffset(rest);
28712
+ if (offset === void 0)
28713
+ return void 0;
28714
+ out += offset;
28715
+ }
28716
+ return out;
28717
+ }
28718
+ function utcFromMp4Time(seconds) {
28719
+ if (seconds <= MP4_EPOCH_TO_UNIX_SECS)
28720
+ return void 0;
28721
+ const unix = seconds - MP4_EPOCH_TO_UNIX_SECS;
28722
+ if (unix > MAX_UNIX_SECS)
28723
+ return void 0;
28724
+ return new Date(unix * 1e3).toISOString().replace(".000Z", "Z");
28725
+ }
28726
+ function gcd(a, b2) {
28727
+ while (b2 !== 0) {
28728
+ const next = a % b2;
28729
+ a = b2;
28730
+ b2 = next;
28731
+ }
28732
+ return a;
28733
+ }
28734
+ function someIfAny(value) {
28735
+ const entries = Object.entries(value).filter(([, item]) => item !== void 0);
28736
+ return entries.length > 0 ? Object.fromEntries(entries) : void 0;
28737
+ }
28738
+ const TAG_MAKE = 271;
28739
+ const TAG_MODEL = 272;
28740
+ const TAG_ORIENTATION = 274;
28741
+ const TAG_EXIF_IFD = 34665;
28742
+ const TAG_GPS_IFD = 34853;
28743
+ const TAG_EXPOSURE_TIME = 33434;
28744
+ const TAG_F_NUMBER = 33437;
28745
+ const TAG_ISO = 34855;
28746
+ const TAG_DATE_TIME_ORIGINAL = 36867;
28747
+ const TAG_DATE_TIME_DIGITIZED = 36868;
28748
+ const TAG_OFFSET_TIME_ORIGINAL = 36881;
28749
+ const TAG_OFFSET_TIME_DIGITIZED = 36882;
28750
+ const TAG_FOCAL_LENGTH = 37386;
28751
+ const TAG_SUB_SEC_ORIGINAL = 37521;
28752
+ const TAG_SUB_SEC_DIGITIZED = 37522;
28753
+ const TAG_FOCAL_LENGTH_35MM = 41989;
28754
+ const TAG_LENS_MODEL = 42036;
28755
+ const TAG_GPS_LAT_REF = 1;
28756
+ const TAG_GPS_LAT = 2;
28757
+ const TAG_GPS_LON_REF = 3;
28758
+ const TAG_GPS_LON = 4;
28759
+ const TAG_GPS_ALT_REF = 5;
28760
+ const TAG_GPS_ALT = 6;
28761
+ const TAG_GPS_IMG_DIRECTION = 17;
28762
+ const TAG_GPS_H_ERROR = 31;
28763
+ function exifTypeSize(kind) {
28764
+ switch (kind) {
28765
+ case 1:
28766
+ case 2:
28767
+ case 6:
28768
+ case 7:
28769
+ case 129:
28770
+ return 1;
28771
+ case 3:
28772
+ case 8:
28773
+ return 2;
28774
+ case 4:
28775
+ case 9:
28776
+ case 11:
28777
+ case 13:
28778
+ return 4;
28779
+ case 5:
28780
+ case 10:
28781
+ case 12:
28782
+ return 8;
28783
+ default:
28784
+ return void 0;
28785
+ }
28786
+ }
28787
+ class Tiff {
28788
+ constructor(reader, base, limit, littleEndian) {
28789
+ this.reader = reader;
28790
+ this.base = base;
28791
+ this.limit = limit;
28792
+ this.littleEndian = littleEndian;
28793
+ }
28794
+ u16At(b2, at) {
28795
+ return this.littleEndian ? le16(b2, at) : be16(b2, at);
28796
+ }
28797
+ u32At(b2, at) {
28798
+ return this.littleEndian ? le32(b2, at) : be32(b2, at);
28799
+ }
28800
+ async readIfd(offset) {
28801
+ if (offset + 2 > this.limit)
28802
+ throw STOP;
28803
+ const head = await this.reader.read(this.base + offset, 2);
28804
+ const count = this.u16At(head, 0);
28805
+ if (offset + 2 + count * 12 > this.limit)
28806
+ throw STOP;
28807
+ const first = this.base + offset + 2;
28808
+ const bytes2 = await this.reader.read(first, count * 12);
28809
+ const ifd = /* @__PURE__ */ new Map();
28810
+ for (let i = 0; i < count; i += 1) {
28811
+ const at = i * 12;
28812
+ const tag = this.u16At(bytes2, at);
28813
+ if (!ifd.has(tag)) {
28814
+ ifd.set(tag, { kind: this.u16At(bytes2, at + 2), count: this.u32At(bytes2, at + 4), valueAt: first + at + 8 });
28815
+ }
28816
+ }
28817
+ return ifd;
28818
+ }
28819
+ async value(entry, maxBytes) {
28820
+ const unit = exifTypeSize(entry.kind);
28821
+ if (unit === void 0)
28822
+ throw STOP;
28823
+ const total = unit * entry.count;
28824
+ const wanted = Math.min(total, maxBytes);
28825
+ if (total <= 4)
28826
+ return this.reader.read(entry.valueAt, wanted);
28827
+ const field = await this.reader.read(entry.valueAt, 4);
28828
+ const offset = this.u32At(field, 0);
28829
+ if (offset + total > this.limit)
28830
+ throw STOP;
28831
+ return this.reader.read(this.base + offset, wanted);
28832
+ }
28833
+ async text(ifd, tag) {
28834
+ const entry = ifd.get(tag);
28835
+ if (!entry || entry.kind !== 2 && entry.kind !== 129)
28836
+ return void 0;
28837
+ const bytes2 = await attempt(() => this.value(entry, MAX_TEXT_BYTES));
28838
+ return bytes2 ? cleanBytes(bytes2) : void 0;
28839
+ }
28840
+ async uint(ifd, tag) {
28841
+ const entry = ifd.get(tag);
28842
+ if (!entry || entry.count === 0)
28843
+ return void 0;
28844
+ switch (entry.kind) {
28845
+ case 1: {
28846
+ const bytes2 = await attempt(() => this.value(entry, 1));
28847
+ return bytes2 == null ? void 0 : bytes2[0];
28848
+ }
28849
+ case 3: {
28850
+ const bytes2 = await attempt(() => this.value(entry, 2));
28851
+ return bytes2 ? attemptSync(() => this.u16At(bytes2, 0)) : void 0;
28852
+ }
28853
+ case 4:
28854
+ case 13: {
28855
+ const bytes2 = await attempt(() => this.value(entry, 4));
28856
+ return bytes2 ? attemptSync(() => this.u32At(bytes2, 0)) : void 0;
28857
+ }
28858
+ default:
28859
+ return void 0;
28860
+ }
28861
+ }
28862
+ // `count` (numerator, denominator) pairs, none with a zero denominator.
28863
+ async rationals(ifd, tag, count) {
28864
+ const entry = ifd.get(tag);
28865
+ if (!entry || entry.kind !== 5 && entry.kind !== 10 || entry.count < count)
28866
+ return void 0;
28867
+ const bytes2 = await attempt(() => this.value(entry, count * 8));
28868
+ if (!bytes2 || bytes2.length < count * 8)
28869
+ return void 0;
28870
+ const out = [];
28871
+ for (let i = 0; i < count; i += 1) {
28872
+ const rawNum = this.u32At(bytes2, i * 8);
28873
+ const rawDen = this.u32At(bytes2, i * 8 + 4);
28874
+ const num = entry.kind === 10 ? rawNum | 0 : rawNum;
28875
+ const den = entry.kind === 10 ? rawDen | 0 : rawDen;
28876
+ if (den === 0)
28877
+ return void 0;
28878
+ out.push([num, den]);
28879
+ }
28880
+ return out;
28881
+ }
28882
+ async rational(ifd, tag) {
28883
+ const values = await this.rationals(ifd, tag, 1);
28884
+ return values ? values[0][0] / values[0][1] : void 0;
28885
+ }
28886
+ async subIfd(ifd, tag) {
28887
+ const offset = await this.uint(ifd, tag);
28888
+ if (offset === void 0)
28889
+ return void 0;
28890
+ return attempt(() => this.readIfd(offset));
28891
+ }
28892
+ async degrees(ifd, tag, refTag, negative) {
28893
+ const parts = await this.rationals(ifd, tag, 3);
28894
+ if (!parts)
28895
+ return void 0;
28896
+ const reference = await this.text(ifd, refTag);
28897
+ if (reference === void 0)
28898
+ return void 0;
28899
+ const first = /^[a-z]/.test(reference) ? reference[0].toUpperCase() : reference[0];
28900
+ const value = parts[0][0] / parts[0][1] + parts[1][0] / parts[1][1] / 60 + parts[2][0] / parts[2][1] / 3600;
28901
+ if (!Number.isFinite(value) || value < 0)
28902
+ return void 0;
28903
+ const positive = negative === "S" ? "N" : "E";
28904
+ if (first === negative)
28905
+ return -value;
28906
+ return first === positive ? value : void 0;
28907
+ }
28908
+ }
28909
+ function validGeo(lat, lon) {
28910
+ const roundedLat = roundTo(lat, 1e6);
28911
+ const roundedLon = roundTo(lon, 1e6);
28912
+ if (roundedLat === void 0 || roundedLon === void 0)
28913
+ return void 0;
28914
+ if (roundedLat < -90 || roundedLat > 90 || roundedLon < -180 || roundedLon > 180 || roundedLat === 0 && roundedLon === 0)
28915
+ return void 0;
28916
+ return [roundedLat, roundedLon];
28917
+ }
28918
+ async function readCapturedAt(tiff, exif) {
28919
+ const date = async (tag) => {
28920
+ const text = await tiff.text(exif, tag);
28921
+ return text === void 0 ? void 0 : parseDateTime(text, ":", " ");
28922
+ };
28923
+ let base = await date(TAG_DATE_TIME_ORIGINAL);
28924
+ const digitized = base === void 0;
28925
+ if (digitized)
28926
+ base = await date(TAG_DATE_TIME_DIGITIZED);
28927
+ if (base === void 0)
28928
+ return void 0;
28929
+ let fraction = await tiff.text(exif, TAG_SUB_SEC_ORIGINAL);
28930
+ let offset = await tiff.text(exif, TAG_OFFSET_TIME_ORIGINAL);
28931
+ if (digitized) {
28932
+ if (fraction === void 0)
28933
+ fraction = await tiff.text(exif, TAG_SUB_SEC_DIGITIZED);
28934
+ if (offset === void 0)
28935
+ offset = await tiff.text(exif, TAG_OFFSET_TIME_DIGITIZED);
28936
+ }
28937
+ let out = base;
28938
+ if (fraction !== void 0)
28939
+ out += parseFraction(fraction) ?? "";
28940
+ if (offset !== void 0)
28941
+ out += parseOffset(offset) ?? "";
28942
+ return out;
28943
+ }
28944
+ async function readGeo(tiff, gps) {
28945
+ const lat = await tiff.degrees(gps, TAG_GPS_LAT, TAG_GPS_LAT_REF, "S");
28946
+ if (lat === void 0)
28947
+ return void 0;
28948
+ const lon = await tiff.degrees(gps, TAG_GPS_LON, TAG_GPS_LON_REF, "W");
28949
+ if (lon === void 0)
28950
+ return void 0;
28951
+ const valid = validGeo(lat, lon);
28952
+ if (!valid)
28953
+ return void 0;
28954
+ const geo = { lat: valid[0], lon: valid[1] };
28955
+ const alt = await tiff.rational(gps, TAG_GPS_ALT);
28956
+ if (alt !== void 0) {
28957
+ const below = await tiff.uint(gps, TAG_GPS_ALT_REF) === 1;
28958
+ const rounded = roundTo(below ? -Math.abs(alt) : alt, 10);
28959
+ if (rounded !== void 0)
28960
+ geo.alt = rounded;
28961
+ }
28962
+ const heading = await tiff.rational(gps, TAG_GPS_IMG_DIRECTION);
28963
+ if (heading !== void 0 && heading >= 0 && heading <= 360) {
28964
+ const rounded = roundTo(heading, 10);
28965
+ if (rounded !== void 0)
28966
+ geo.heading = rounded;
28967
+ }
28968
+ const accuracy = await tiff.rational(gps, TAG_GPS_H_ERROR);
28969
+ if (accuracy !== void 0 && accuracy >= 0) {
28970
+ const rounded = roundTo(accuracy, 10);
28971
+ if (rounded !== void 0)
28972
+ geo.accuracy_m = rounded;
28973
+ }
28974
+ return geo;
28975
+ }
28976
+ async function readExposure(tiff, exif) {
28977
+ const positive = (value, scale) => value !== void 0 && value > 0 ? roundTo(value, scale) : void 0;
28978
+ const positiveUint = (value) => value !== void 0 && value > 0 ? value : void 0;
28979
+ const exposure = {
28980
+ iso: positiveUint(await tiff.uint(exif, TAG_ISO)),
28981
+ f_number: positive(await tiff.rational(exif, TAG_F_NUMBER), 100),
28982
+ focal_length_mm: positive(await tiff.rational(exif, TAG_FOCAL_LENGTH), 100),
28983
+ focal_length_35mm: positiveUint(await tiff.uint(exif, TAG_FOCAL_LENGTH_35MM))
28984
+ };
28985
+ const parts = await tiff.rationals(exif, TAG_EXPOSURE_TIME, 1);
28986
+ if (parts) {
28987
+ const [num, den] = parts[0];
28988
+ if (num > 0 && den > 0) {
28989
+ const divisor = gcd(num, den);
28990
+ const reducedDen = den / divisor;
28991
+ exposure.exposure_time = reducedDen === 1 ? String(num / divisor) : `${num / divisor}/${reducedDen}`;
28992
+ }
28993
+ }
28994
+ return someIfAny(exposure);
28995
+ }
28996
+ async function readExif(reader, base, limit) {
28997
+ if (limit < 8)
28998
+ return void 0;
28999
+ const head = await attempt(() => reader.read(base, 8));
29000
+ if (!head)
29001
+ return void 0;
29002
+ let littleEndian;
29003
+ if (head[0] === 73 && head[1] === 73)
29004
+ littleEndian = true;
29005
+ else if (head[0] === 77 && head[1] === 77)
29006
+ littleEndian = false;
29007
+ else
29008
+ return void 0;
29009
+ const tiff = new Tiff(reader, base, limit, littleEndian);
29010
+ if (tiff.u16At(head, 2) !== 42)
29011
+ return void 0;
29012
+ const first = tiff.u32At(head, 4);
29013
+ const ifd0 = await attempt(() => tiff.readIfd(first));
29014
+ if (!ifd0)
29015
+ return void 0;
29016
+ const fields = { orientation: await tiff.uint(ifd0, TAG_ORIENTATION) };
29017
+ const exif = await tiff.subIfd(ifd0, TAG_EXIF_IFD) ?? /* @__PURE__ */ new Map();
29018
+ fields.camera = someIfAny({
29019
+ make: await tiff.text(ifd0, TAG_MAKE),
29020
+ model: await tiff.text(ifd0, TAG_MODEL),
29021
+ lens: await tiff.text(exif, TAG_LENS_MODEL)
29022
+ });
29023
+ fields.captured_at = await readCapturedAt(tiff, exif);
29024
+ fields.exposure = await readExposure(tiff, exif);
29025
+ const gps = await tiff.subIfd(ifd0, TAG_GPS_IFD);
29026
+ if (gps)
29027
+ fields.geo = await readGeo(tiff, gps);
29028
+ return fields;
29029
+ }
29030
+ function applyExif(meta, fields) {
29031
+ meta.captured_at = fields.captured_at;
29032
+ meta.geo = fields.geo;
29033
+ meta.camera = fields.camera;
29034
+ meta.exposure = fields.exposure;
29035
+ }
29036
+ function setSize(meta, width, height) {
29037
+ if (width > 0 && height > 0) {
29038
+ meta.width = width;
29039
+ meta.height = height;
29040
+ }
29041
+ }
29042
+ async function probeJpeg(reader, meta) {
29043
+ let exifAt;
29044
+ let frame;
29045
+ let at = 2;
29046
+ for (let i = 0; i < MAX_JPEG_SEGMENTS; i += 1) {
29047
+ const head = await attempt(() => reader.read(at, 2));
29048
+ if (!head || head[0] !== 255)
29049
+ break;
29050
+ const marker = head[1];
29051
+ if (marker === 255) {
29052
+ at += 1;
29053
+ continue;
29054
+ }
29055
+ if (marker === 1 || marker >= 208 && marker <= 216) {
29056
+ at += 2;
29057
+ continue;
29058
+ }
29059
+ if (marker === 217 || marker === 218)
29060
+ break;
29061
+ const length = await attempt(async () => be16(await reader.read(at + 2, 2), 0));
29062
+ if (length === void 0 || length < 2)
29063
+ break;
29064
+ if (marker === 225 && !exifAt && length >= 8) {
29065
+ const prefix = await attempt(() => reader.read(at + 4, 6));
29066
+ if (prefix && asciiAt(prefix, 0, "Exif\0\0"))
29067
+ exifAt = [at + 10, length - 8];
29068
+ }
29069
+ if (marker >= 192 && marker <= 207 && marker !== 196 && marker !== 200 && marker !== 204) {
29070
+ const sof = await attempt(() => reader.read(at + 4, 5));
29071
+ if (sof)
29072
+ frame = [be16(sof, 3), be16(sof, 1)];
29073
+ break;
29074
+ }
29075
+ at += 2 + length;
29076
+ }
29077
+ let orientation;
29078
+ if (exifAt) {
29079
+ const fields = await readExif(reader, exifAt[0], exifAt[1]);
29080
+ if (fields) {
29081
+ orientation = fields.orientation;
29082
+ applyExif(meta, fields);
29083
+ }
29084
+ }
29085
+ if (frame) {
29086
+ if (orientation !== void 0 && orientation >= 5 && orientation <= 8)
29087
+ setSize(meta, frame[1], frame[0]);
29088
+ else
29089
+ setSize(meta, frame[0], frame[1]);
29090
+ }
29091
+ }
29092
+ async function probePng(reader, meta) {
29093
+ const head = await attempt(() => reader.read(8, 16));
29094
+ if (head && asciiAt(head, 4, "IHDR"))
29095
+ setSize(meta, be32(head, 8), be32(head, 12));
29096
+ let at = 8;
29097
+ for (let i = 0; i < MAX_PNG_CHUNKS; i += 1) {
29098
+ const chunk = await attempt(() => reader.read(at, 8));
29099
+ if (!chunk)
29100
+ return;
29101
+ const length = be32(chunk, 0);
29102
+ const kind = fourCC(chunk, 4);
29103
+ if (kind === "IDAT" || kind === "IEND")
29104
+ return;
29105
+ if (kind === "eXIf") {
29106
+ const fields = await readExif(reader, at + 8, length);
29107
+ if (fields)
29108
+ applyExif(meta, fields);
29109
+ return;
29110
+ }
29111
+ at += 12 + length;
29112
+ }
29113
+ }
29114
+ async function probeGif(reader, meta) {
29115
+ const head = await attempt(() => reader.read(6, 4));
29116
+ if (head)
29117
+ setSize(meta, le16(head, 0), le16(head, 2));
29118
+ }
29119
+ async function probeWebp(reader, meta) {
29120
+ const riff = await attempt(() => reader.read(0, 12));
29121
+ if (!riff)
29122
+ return;
29123
+ const end = Math.min(reader.size, 8 + le32(riff, 4));
29124
+ let extended = false;
29125
+ let at = 12;
29126
+ for (let i = 0; i < MAX_RIFF_CHUNKS; i += 1) {
29127
+ if (at + 8 > end)
29128
+ return;
29129
+ const head = await attempt(() => reader.read(at, 8));
29130
+ if (!head)
29131
+ return;
29132
+ const size = le32(head, 4);
29133
+ const data = at + 8;
29134
+ const kind = fourCC(head, 0);
29135
+ if (kind === "VP8 " && !extended) {
29136
+ const frame = await attempt(() => reader.read(data, 10));
29137
+ if (frame && frame[3] === 157 && frame[4] === 1 && frame[5] === 42) {
29138
+ setSize(meta, le16(frame, 6) & 16383, le16(frame, 8) & 16383);
29139
+ }
29140
+ return;
29141
+ }
29142
+ if (kind === "VP8L" && !extended) {
29143
+ const frame = await attempt(() => reader.read(data, 5));
29144
+ if (frame && frame[0] === 47) {
29145
+ const width = 1 + (frame[1] + (frame[2] & 63) * 256);
29146
+ const height = 1 + ((frame[2] >> 6) + frame[3] * 4 + (frame[4] & 15) * 1024);
29147
+ setSize(meta, width, height);
29148
+ }
29149
+ return;
29150
+ }
29151
+ if (kind === "VP8X") {
29152
+ const header = await attempt(() => reader.read(data, 10));
29153
+ if (!header)
29154
+ return;
29155
+ setSize(meta, le24(header, 4) + 1, le24(header, 7) + 1);
29156
+ if ((header[0] & 8) === 0)
29157
+ return;
29158
+ extended = true;
29159
+ } else if (kind === "EXIF") {
29160
+ const prefix = await attempt(() => reader.read(data, Math.min(size, 6)));
29161
+ if (!prefix)
29162
+ return;
29163
+ const skip = asciiAt(prefix, 0, "Exif\0\0") ? 6 : 0;
29164
+ const fields = await readExif(reader, data + skip, size - skip);
29165
+ if (fields)
29166
+ applyExif(meta, fields);
29167
+ return;
29168
+ }
29169
+ at = data + size + (size & 1);
29170
+ }
29171
+ }
29172
+ async function probeTiff(reader, meta) {
29173
+ const fields = await readExif(reader, 0, reader.size);
29174
+ if (fields)
29175
+ applyExif(meta, fields);
29176
+ }
29177
+ async function readIsoBox(reader, at, end) {
29178
+ if (at + 8 > end)
29179
+ return void 0;
29180
+ const head = await reader.read(at, 8);
29181
+ let size = be32(head, 0);
29182
+ const kind = fourCC(head, 4);
29183
+ let header = 8;
29184
+ if (size === 1) {
29185
+ if (at + 16 > end)
29186
+ return void 0;
29187
+ size = be64(await reader.read(at + 8, 8), 0);
29188
+ header = 16;
29189
+ } else if (size === 0) {
29190
+ size = end - at;
29191
+ }
29192
+ if (size < header)
29193
+ return void 0;
29194
+ return { kind, at, start: at + header, end: Math.min(end, at + size), next: at + size };
29195
+ }
29196
+ async function readChildren(reader, start, end) {
29197
+ const boxes = [];
29198
+ let at = start;
29199
+ while (boxes.length < MAX_ISO_BOXES) {
29200
+ const found = await readIsoBox(reader, at, end);
29201
+ if (!found)
29202
+ break;
29203
+ at = found.next;
29204
+ boxes.push(found);
29205
+ }
29206
+ return boxes;
29207
+ }
29208
+ function heifExifExtent(b2) {
29209
+ return attemptSync(() => {
29210
+ const view = new DataView(b2.buffer, b2.byteOffset, b2.byteLength);
29211
+ const meta = isoBoxes(view, 0, b2.length).find((box) => box.type === "meta");
29212
+ if (!meta)
29213
+ return void 0;
29214
+ const children = isoBoxes(view, meta.start + 4, meta.end);
29215
+ const iinf = children.find((box) => box.type === "iinf");
29216
+ const iloc = children.find((box) => box.type === "iloc");
29217
+ if (!iinf || !iloc)
29218
+ return void 0;
29219
+ if (iinf.start >= b2.length)
29220
+ throw STOP;
29221
+ const first = iinf.start + (b2[iinf.start] === 0 ? 6 : 8);
29222
+ let wanted;
29223
+ for (const infe of isoBoxes(view, first, iinf.end)) {
29224
+ if (infe.type !== "infe")
29225
+ continue;
29226
+ if (infe.start >= b2.length)
29227
+ throw STOP;
29228
+ const version22 = b2[infe.start];
29229
+ let item;
29230
+ let kindAt;
29231
+ if (version22 === 2) {
29232
+ item = be16(b2, infe.start + 4);
29233
+ kindAt = infe.start + 8;
29234
+ } else if (version22 === 3) {
29235
+ item = be32(b2, infe.start + 4);
29236
+ kindAt = infe.start + 10;
29237
+ } else {
29238
+ continue;
29239
+ }
29240
+ if (asciiAt(b2, kindAt, "Exif")) {
29241
+ wanted = item;
29242
+ break;
29243
+ }
29244
+ }
29245
+ if (wanted === void 0)
29246
+ return void 0;
29247
+ let at = iloc.start;
29248
+ if (at + 6 > b2.length)
29249
+ throw STOP;
29250
+ const version2 = b2[at];
29251
+ if (version2 > 2)
29252
+ return void 0;
29253
+ const offsetSize = b2[at + 4] >> 4;
29254
+ const lengthSize = b2[at + 4] & 15;
29255
+ const baseSize = b2[at + 5] >> 4;
29256
+ const indexSize = version2 >= 1 ? b2[at + 5] & 15 : 0;
29257
+ at += 6;
29258
+ const count = version2 < 2 ? be16(b2, at) : be32(b2, at);
29259
+ at += version2 < 2 ? 2 : 4;
29260
+ for (let i = 0; i < count; i += 1) {
29261
+ const item = version2 < 2 ? be16(b2, at) : be32(b2, at);
29262
+ at += version2 < 2 ? 2 : 4;
29263
+ let method = 0;
29264
+ if (version2 >= 1) {
29265
+ method = be16(b2, at) & 15;
29266
+ at += 2;
29267
+ }
29268
+ at += 2;
29269
+ const base = beUint(b2, at, baseSize);
29270
+ at += baseSize;
29271
+ const extents = be16(b2, at);
29272
+ at += 2;
29273
+ let extent;
29274
+ for (let j = 0; j < extents; j += 1) {
29275
+ at += indexSize;
29276
+ const offset = beUint(b2, at, offsetSize);
29277
+ at += offsetSize;
29278
+ const length = beUint(b2, at, lengthSize);
29279
+ at += lengthSize;
29280
+ extent = [base + offset, length];
29281
+ }
29282
+ if (item === wanted)
29283
+ return method === 0 && extents === 1 ? extent : void 0;
29284
+ }
29285
+ return void 0;
29286
+ });
29287
+ }
29288
+ async function findTopLevelBox(reader, kind) {
29289
+ let at = 0;
29290
+ for (let i = 0; i < MAX_ISO_BOXES; i += 1) {
29291
+ const found = await readIsoBox(reader, at, reader.size);
29292
+ if (!found)
29293
+ break;
29294
+ if (found.kind === kind)
29295
+ return found;
29296
+ at = found.next;
29297
+ }
29298
+ return void 0;
29299
+ }
29300
+ async function probeHeif(reader, meta) {
29301
+ const metaBox = await attempt(() => findTopLevelBox(reader, "meta"));
29302
+ if (!metaBox)
29303
+ return;
29304
+ const bytes2 = await attempt(() => reader.read(metaBox.at, metaBox.end - metaBox.at));
29305
+ if (!bytes2)
29306
+ return;
29307
+ const size = heifImageSize(bytes2);
29308
+ if (size)
29309
+ setSize(meta, size.width, size.height);
29310
+ const extent = heifExifExtent(bytes2);
29311
+ if (!extent)
29312
+ return;
29313
+ const [offset, length] = extent;
29314
+ if (length < 4)
29315
+ return;
29316
+ const prefix = await attempt(() => reader.read(offset, 4));
29317
+ if (!prefix)
29318
+ return;
29319
+ const tiffOffset = be32(prefix, 0);
29320
+ if (tiffOffset + 4 > length)
29321
+ return;
29322
+ const fields = await readExif(reader, offset + 4 + tiffOffset, length - 4 - tiffOffset);
29323
+ if (fields)
29324
+ applyExif(meta, fields);
29325
+ }
29326
+ function codecName(format) {
29327
+ switch (format) {
29328
+ case "avc1":
29329
+ case "avc3":
29330
+ return "h264";
29331
+ case "hvc1":
29332
+ case "hev1":
29333
+ return "hevc";
29334
+ case "av01":
29335
+ return "av1";
29336
+ case "vp09":
29337
+ return "vp9";
29338
+ case "mp4a":
29339
+ return "aac";
29340
+ default:
29341
+ return void 0;
29342
+ }
29343
+ }
29344
+ function parseIso6709(text) {
29345
+ const body = text.endsWith("/") ? text.slice(0, -1) : text;
29346
+ const parts = [];
29347
+ let start = -1;
29348
+ for (let index = 0; index < body.length; index += 1) {
29349
+ const c = body[index];
29350
+ if (c === "+" || c === "-") {
29351
+ if (start >= 0) {
29352
+ const value = parseCoordinate(body.slice(start, index));
29353
+ if (value === void 0)
29354
+ return void 0;
29355
+ parts.push(value);
29356
+ }
29357
+ start = index;
29358
+ } else if (start < 0 || !/[0-9.]/.test(c)) {
29359
+ return void 0;
29360
+ }
29361
+ }
29362
+ if (start < 0)
29363
+ return void 0;
29364
+ const last = parseCoordinate(body.slice(start));
29365
+ if (last === void 0)
29366
+ return void 0;
29367
+ parts.push(last);
29368
+ if (parts.length < 2 || parts.length > 3)
29369
+ return void 0;
29370
+ const valid = validGeo(parts[0], parts[1]);
29371
+ if (!valid)
29372
+ return void 0;
29373
+ const geo = { lat: valid[0], lon: valid[1] };
29374
+ if (parts.length === 3) {
29375
+ const alt = roundTo(parts[2], 10);
29376
+ if (alt !== void 0)
29377
+ geo.alt = alt;
29378
+ }
29379
+ return geo;
29380
+ }
29381
+ function parseCoordinate(text) {
29382
+ return /^[+-][0-9]+(\.[0-9]+)?$/.test(text) ? Number(text) : void 0;
29383
+ }
29384
+ function parseDecimal(text) {
29385
+ return /^[+-]?([0-9]+\.?[0-9]*|\.[0-9]+)([eE][+-]?[0-9]+)?$/.test(text) ? Number(text) : void 0;
29386
+ }
29387
+ function applyItem(media, key, text) {
29388
+ const clean = cleanText(text);
29389
+ switch (key) {
29390
+ case "com.apple.quicktime.creationdate":
29391
+ if (media.creationDate === void 0 && clean !== void 0)
29392
+ media.creationDate = parseIsoDateTime(clean);
29393
+ break;
29394
+ case "com.apple.quicktime.location.ISO6709":
29395
+ if (media.location === void 0 && clean !== void 0)
29396
+ media.location = parseIso6709(clean);
29397
+ break;
29398
+ case "com.apple.quicktime.location.accuracy.horizontal": {
29399
+ const value = clean === void 0 ? void 0 : parseDecimal(clean);
29400
+ media.accuracy = value !== void 0 && Number.isFinite(value) && value >= 0 ? roundTo(value, 10) : void 0;
29401
+ break;
29402
+ }
29403
+ case "com.apple.quicktime.make":
29404
+ media.make = clean;
29405
+ break;
29406
+ case "com.apple.quicktime.model":
29407
+ media.model = clean;
29408
+ break;
29409
+ }
29410
+ }
29411
+ async function readItemText(reader, item) {
29412
+ for (const child of await readChildren(reader, item.start, item.end)) {
29413
+ if (child.kind !== "data" || child.end < child.start + 8)
29414
+ continue;
29415
+ const head = await reader.read(child.start, 4);
29416
+ if (be32(head, 0) % 16777216 !== 1)
29417
+ return void 0;
29418
+ const length = Math.min(child.end - child.start - 8, MAX_TEXT_BYTES);
29419
+ return decodeUtf8(await reader.read(child.start + 8, length));
29420
+ }
29421
+ return void 0;
29422
+ }
29423
+ async function readMetaBox(reader, meta, media) {
29424
+ if (meta.end < meta.start + 8)
29425
+ return;
29426
+ const probe = await reader.read(meta.start + 4, 4);
29427
+ const first = asciiAt(probe, 0, "hdlr") ? meta.start : meta.start + 4;
29428
+ const children = await readChildren(reader, first, meta.end);
29429
+ const keys = [];
29430
+ const keysBox = children.find((box) => box.kind === "keys");
29431
+ if (keysBox) {
29432
+ const head = await reader.read(keysBox.start, 8);
29433
+ const count = be32(head, 4);
29434
+ let at = keysBox.start + 8;
29435
+ for (let i = 0; i < Math.min(count, MAX_ISO_BOXES); i += 1) {
29436
+ const entry = await readIsoBox(reader, at, keysBox.end);
29437
+ if (!entry)
29438
+ break;
29439
+ const length = Math.min(entry.end - entry.start, MAX_TEXT_BYTES);
29440
+ keys.push(decodeUtf8(await reader.read(entry.start, length)));
29441
+ at = entry.next;
29442
+ }
29443
+ }
29444
+ const ilst = children.find((box) => box.kind === "ilst");
29445
+ if (!ilst)
29446
+ return;
29447
+ for (const item of await readChildren(reader, ilst.start, ilst.end)) {
29448
+ const index = item.kind.charCodeAt(0) * 16777216 + item.kind.charCodeAt(1) * 65536 + item.kind.charCodeAt(2) * 256 + item.kind.charCodeAt(3);
29449
+ if (index >= 1 && index <= keys.length) {
29450
+ const text2 = await readItemText(reader, item);
29451
+ if (text2 !== void 0)
29452
+ applyItem(media, keys[index - 1], text2);
29453
+ continue;
29454
+ }
29455
+ if (item.kind !== "©nam" && item.kind !== "©ART" && item.kind !== "©alb")
29456
+ continue;
29457
+ const text = await readItemText(reader, item);
29458
+ if (text === void 0)
29459
+ continue;
29460
+ const value = cleanText(text);
29461
+ if (item.kind === "©nam")
29462
+ media.title = value;
29463
+ else if (item.kind === "©ART")
29464
+ media.artist = value;
29465
+ else
29466
+ media.album = value;
29467
+ }
29468
+ }
29469
+ async function readUdta(reader, udta, media) {
29470
+ for (const child of await readChildren(reader, udta.start, udta.end)) {
29471
+ if (child.kind === "©xyz" && child.end >= child.start + 4) {
29472
+ const head = await reader.read(child.start, 2);
29473
+ const length = Math.min(be16(head, 0), child.end - child.start - 4, MAX_TEXT_BYTES);
29474
+ const bytes2 = await reader.read(child.start + 4, length);
29475
+ if (media.location === void 0) {
29476
+ const text = cleanBytes(bytes2);
29477
+ media.location = text === void 0 ? void 0 : parseIso6709(text);
29478
+ }
29479
+ } else if (child.kind === "meta") {
29480
+ await readMetaBox(reader, child, media);
29481
+ }
29482
+ }
29483
+ }
29484
+ async function readMvhd(reader, mvhd, media) {
29485
+ const bytes2 = await reader.read(mvhd.start, Math.min(mvhd.end - mvhd.start, 32));
29486
+ if (bytes2.length === 0)
29487
+ throw STOP;
29488
+ const version2 = bytes2[0];
29489
+ const created = attemptSync(() => version2 === 1 ? be64(bytes2, 4) : be32(bytes2, 4));
29490
+ const timescale = version2 === 1 ? be32(bytes2, 20) : be32(bytes2, 12);
29491
+ const duration = attemptSync(() => version2 === 1 ? be64(bytes2, 24) : be32(bytes2, 16));
29492
+ media.mvhdTime = created === void 0 ? void 0 : utcFromMp4Time(created);
29493
+ media.durationMs = duration === void 0 || version2 !== 1 && duration === 4294967295 ? void 0 : millis(duration, timescale);
29494
+ }
29495
+ async function readTrak(reader, trak, media) {
29496
+ const children = await readChildren(reader, trak.start, trak.end);
29497
+ const mdia = children.find((box) => box.kind === "mdia");
29498
+ if (!mdia)
29499
+ return;
29500
+ const mdiaChildren = await readChildren(reader, mdia.start, mdia.end);
29501
+ const hdlr = mdiaChildren.find((box) => box.kind === "hdlr");
29502
+ if (!hdlr)
29503
+ return;
29504
+ const handler = fourCC(await reader.read(hdlr.start + 8, 4), 0);
29505
+ const isVideo = handler === "vide";
29506
+ const isAudio = handler === "soun";
29507
+ if (!isVideo && !isAudio)
29508
+ return;
29509
+ if (isAudio)
29510
+ media.hasAudio = true;
29511
+ else
29512
+ media.hasVideo = true;
29513
+ let format;
29514
+ const minf = mdiaChildren.find((box) => box.kind === "minf");
29515
+ if (minf) {
29516
+ const minfChildren = await readChildren(reader, minf.start, minf.end);
29517
+ const stbl = minfChildren.find((box) => box.kind === "stbl");
29518
+ if (stbl) {
29519
+ const stblChildren = await readChildren(reader, stbl.start, stbl.end);
29520
+ const stsd = stblChildren.find((box) => box.kind === "stsd");
29521
+ if (stsd && stsd.end >= stsd.start + 16)
29522
+ format = fourCC(await reader.read(stsd.start + 12, 4), 0);
29523
+ }
29524
+ }
29525
+ const codec = format === void 0 ? void 0 : codecName(format);
29526
+ if (isAudio) {
29527
+ if (media.audioCodec === void 0)
29528
+ media.audioCodec = codec;
29529
+ return;
29530
+ }
29531
+ if (media.width > 0)
29532
+ return;
29533
+ const tkhd = children.find((box) => box.kind === "tkhd");
29534
+ if (!tkhd)
29535
+ return;
29536
+ const bytes2 = await reader.read(tkhd.start, Math.min(tkhd.end - tkhd.start, 96));
29537
+ if (bytes2.length === 0)
29538
+ throw STOP;
29539
+ const matrix = bytes2[0] === 1 ? 52 : 40;
29540
+ const fixed = (at) => Math.floor((be32(bytes2, at) + 32768) / 65536);
29541
+ const width = fixed(matrix + 36);
29542
+ const height = fixed(matrix + 40);
29543
+ if (width === 0 || height === 0)
29544
+ return;
29545
+ const a = be32(bytes2, matrix);
29546
+ const b2 = be32(bytes2, matrix + 4);
29547
+ const c = be32(bytes2, matrix + 12);
29548
+ const d = be32(bytes2, matrix + 16);
29549
+ const quarterTurn = a === 0 && d === 0 && b2 !== 0 && c !== 0;
29550
+ media.width = quarterTurn ? height : width;
29551
+ media.height = quarterTurn ? width : height;
29552
+ media.videoCodec = codec;
29553
+ }
29554
+ async function readMoov(reader, media) {
29555
+ const moov = await findTopLevelBox(reader, "moov");
29556
+ if (!moov)
29557
+ return;
29558
+ for (const child of await readChildren(reader, moov.start, moov.end)) {
29559
+ switch (child.kind) {
29560
+ case "mvhd":
29561
+ await readMvhd(reader, child, media);
29562
+ break;
29563
+ case "trak":
29564
+ await readTrak(reader, child, media);
29565
+ break;
29566
+ case "udta":
29567
+ await readUdta(reader, child, media);
29568
+ break;
29569
+ case "meta":
29570
+ await readMetaBox(reader, child, media);
29571
+ break;
29572
+ }
29573
+ }
29574
+ }
29575
+ async function probeIsoMedia(reader, meta) {
29576
+ var _a2;
29577
+ const media = { hasVideo: false, hasAudio: false, width: 0, height: 0 };
29578
+ await attempt(() => readMoov(reader, media));
29579
+ if (meta.mime === "video/mp4" && !media.hasVideo && media.hasAudio)
29580
+ meta.mime = "audio/mp4";
29581
+ meta.duration_ms = media.durationMs;
29582
+ meta.audio_codec = media.audioCodec;
29583
+ if ((_a2 = meta.mime) == null ? void 0 : _a2.startsWith("audio/")) {
29584
+ meta.title = media.title;
29585
+ meta.artist = media.artist;
29586
+ meta.album = media.album;
29587
+ return;
29588
+ }
29589
+ setSize(meta, media.width, media.height);
29590
+ meta.video_codec = media.videoCodec;
29591
+ meta.captured_at = media.creationDate ?? media.mvhdTime;
29592
+ meta.geo = media.location && someIfAny({ ...media.location, accuracy_m: media.accuracy });
29593
+ meta.camera = someIfAny({ make: media.make, model: media.model });
29594
+ }
29595
+ async function probeFlac(reader, meta) {
29596
+ const head = await attempt(() => reader.read(4, 22));
29597
+ if (!head || (head[0] & 127) !== 0)
29598
+ return;
29599
+ const info = head.subarray(4);
29600
+ const rate = info[10] * 4096 + info[11] * 16 + (info[12] >> 4);
29601
+ const samples = (info[13] & 15) * 4294967296 + be32(info, 14);
29602
+ meta.duration_ms = millis(samples, rate);
29603
+ }
29604
+ async function probeWav(reader, meta) {
29605
+ const riff = await attempt(() => reader.read(0, 12));
29606
+ if (!riff)
29607
+ return;
29608
+ const end = Math.min(reader.size, 8 + le32(riff, 4));
29609
+ let byteRate;
29610
+ let dataSize;
29611
+ let at = 12;
29612
+ for (let i = 0; i < MAX_RIFF_CHUNKS; i += 1) {
29613
+ if (at + 8 > end)
29614
+ break;
29615
+ const head = await attempt(() => reader.read(at, 8));
29616
+ if (!head)
29617
+ break;
29618
+ const size = le32(head, 4);
29619
+ const data = at + 8;
29620
+ const kind = fourCC(head, 0);
29621
+ if (kind === "fmt ") {
29622
+ const format = await attempt(() => reader.read(data, 12));
29623
+ if (!format)
29624
+ break;
29625
+ byteRate = le32(format, 8);
29626
+ } else if (kind === "data") {
29627
+ dataSize = Math.min(size, reader.size - data);
29628
+ }
29629
+ if (byteRate !== void 0 && dataSize !== void 0)
29630
+ break;
29631
+ at = data + size + (size & 1);
29632
+ }
29633
+ if (byteRate !== void 0 && dataSize !== void 0)
29634
+ meta.duration_ms = millis(dataSize, byteRate);
29635
+ }
29636
+ function syncsafe(b2, at) {
29637
+ if (at + 4 > b2.length)
29638
+ throw STOP;
29639
+ if ((b2[at] | b2[at + 1] | b2[at + 2] | b2[at + 3]) & 128)
29640
+ throw STOP;
29641
+ return b2[at] * 2097152 + b2[at + 1] * 16384 + b2[at + 2] * 128 + b2[at + 3];
29642
+ }
29643
+ function decodeUtf16(bytes2, bigEndian) {
29644
+ const units = [];
29645
+ for (let at = 0; at + 2 <= bytes2.length; at += 2) {
29646
+ units.push(bigEndian ? be16(bytes2, at) : le16(bytes2, at));
29647
+ }
29648
+ let out = "";
29649
+ for (let i = 0; i < units.length; i += 1) {
29650
+ const unit = units[i];
29651
+ if (unit >= 55296 && unit <= 56319 && i + 1 < units.length && units[i + 1] >= 56320 && units[i + 1] <= 57343) {
29652
+ out += String.fromCharCode(unit, units[i + 1]);
29653
+ i += 1;
29654
+ } else if (unit >= 55296 && unit <= 57343) {
29655
+ out += "�";
29656
+ } else {
29657
+ out += String.fromCharCode(unit);
29658
+ }
29659
+ }
29660
+ return out;
29661
+ }
29662
+ function decodeId3Text(b2) {
29663
+ if (b2.length === 0)
29664
+ return void 0;
29665
+ const encoding = b2[0];
29666
+ const payload = b2.subarray(1);
29667
+ let text;
29668
+ switch (encoding) {
29669
+ case 0:
29670
+ text = Array.from(payload, (c) => String.fromCharCode(c)).join("");
29671
+ break;
29672
+ case 1:
29673
+ if (payload[0] === 254 && payload[1] === 255)
29674
+ text = decodeUtf16(payload.subarray(2), true);
29675
+ else if (payload[0] === 255 && payload[1] === 254)
29676
+ text = decodeUtf16(payload.subarray(2), false);
29677
+ else
29678
+ text = decodeUtf16(payload, false);
29679
+ break;
29680
+ case 2:
29681
+ text = decodeUtf16(payload, true);
29682
+ break;
29683
+ case 3:
29684
+ text = decodeUtf8(payload);
29685
+ break;
29686
+ default:
29687
+ return void 0;
29688
+ }
29689
+ return cleanText(text);
29690
+ }
29691
+ async function readId3(reader, meta) {
29692
+ const header = await reader.read(0, 10);
29693
+ const version2 = header[3];
29694
+ if (!asciiAt(header, 0, "ID3") || version2 < 2 || version2 > 4 || (header[5] & 128) !== 0)
29695
+ return;
29696
+ const end = Math.min(10 + syncsafe(header, 6), reader.size);
29697
+ let at = 10;
29698
+ if ((header[5] & 64) !== 0) {
29699
+ if (version2 === 3)
29700
+ at += 4 + be32(await reader.read(at, 4), 0);
29701
+ else if (version2 === 4)
29702
+ at += syncsafe(await reader.read(at, 4), 0);
29703
+ else
29704
+ return;
29705
+ }
29706
+ const headerSize = version2 === 2 ? 6 : 10;
29707
+ for (let i = 0; i < MAX_ID3_FRAMES; i += 1) {
29708
+ if (at + headerSize > end)
29709
+ break;
29710
+ const frame = await reader.read(at, headerSize);
29711
+ if (frame[0] === 0)
29712
+ break;
29713
+ let id2;
29714
+ let size;
29715
+ let skip;
29716
+ if (version2 === 2) {
29717
+ id2 = String.fromCharCode(frame[0], frame[1], frame[2]);
29718
+ size = frame[3] * 65536 + frame[4] * 256 + frame[5];
29719
+ skip = false;
29720
+ } else if (version2 === 3) {
29721
+ id2 = fourCC(frame, 0);
29722
+ size = be32(frame, 4);
29723
+ skip = (frame[9] & 224) !== 0;
29724
+ } else {
29725
+ id2 = fourCC(frame, 0);
29726
+ size = syncsafe(frame, 4);
29727
+ skip = (frame[9] & 79) !== 0;
29728
+ }
29729
+ const key = id2 === "TIT2" || id2 === "TT2" ? "title" : id2 === "TPE1" || id2 === "TP1" ? "artist" : id2 === "TALB" || id2 === "TAL" ? "album" : void 0;
29730
+ if (key && !skip && size > 0) {
29731
+ const length = Math.min(size, MAX_TEXT_BYTES, end - (at + headerSize));
29732
+ const bytes2 = await reader.read(at + headerSize, length);
29733
+ if (meta[key] === void 0)
29734
+ meta[key] = decodeId3Text(bytes2);
29735
+ if (meta.title !== void 0 && meta.artist !== void 0 && meta.album !== void 0)
29736
+ break;
29737
+ }
29738
+ at += headerSize + size;
29739
+ }
29740
+ }
29741
+ function withoutUndefined(meta) {
29742
+ return Object.fromEntries(Object.entries(meta).filter(([, value]) => value !== void 0));
29743
+ }
29744
+ function loadMedia(blob, tag, read) {
29745
+ const url = URL.createObjectURL(blob);
29746
+ return new Promise((resolve) => {
29747
+ const element = document.createElement(tag);
29748
+ const done = (value) => {
29749
+ clearTimeout(timer);
29750
+ URL.revokeObjectURL(url);
29751
+ resolve(value);
29752
+ };
29753
+ const timer = setTimeout(() => done(void 0), MEDIA_ELEMENT_TIMEOUT_MS);
29754
+ element.addEventListener(tag === "img" ? "load" : "loadedmetadata", () => done(read(element)));
29755
+ element.addEventListener("error", () => done(void 0));
29756
+ if (element instanceof HTMLMediaElement)
29757
+ element.preload = "metadata";
29758
+ element.src = url;
29759
+ });
29760
+ }
29761
+ function durationOf(element) {
29762
+ const ms = Math.round(element.duration * 1e3);
29763
+ return Number.isSafeInteger(ms) && ms >= 1 ? ms : void 0;
29764
+ }
29765
+ async function fillFromMediaElement(blob, meta) {
29766
+ if (typeof document === "undefined" || !meta.mime || typeof URL === "undefined" || !URL.createObjectURL)
29767
+ return;
29768
+ if (meta.mime.startsWith("image/") && meta.width === void 0) {
29769
+ const size = await loadMedia(blob, "img", (element) => {
29770
+ const image = element;
29771
+ return { width: image.naturalWidth, height: image.naturalHeight };
29772
+ });
29773
+ if (size)
29774
+ setSize(meta, size.width, size.height);
29775
+ } else if (meta.mime.startsWith("video/") && (meta.width === void 0 || meta.duration_ms === void 0)) {
29776
+ const info = await loadMedia(blob, "video", (element) => {
29777
+ const video = element;
29778
+ return { width: video.videoWidth, height: video.videoHeight, duration: durationOf(video) };
29779
+ });
29780
+ if (info) {
29781
+ if (meta.width === void 0)
29782
+ setSize(meta, info.width, info.height);
29783
+ if (meta.duration_ms === void 0)
29784
+ meta.duration_ms = info.duration;
29785
+ }
29786
+ } else if (meta.mime.startsWith("audio/") && meta.duration_ms === void 0) {
29787
+ meta.duration_ms = await loadMedia(blob, "audio", (element) => durationOf(element));
29788
+ }
29789
+ }
29790
+ async function probeFileMeta(source, options = {}) {
29791
+ const blob = isBlob(source) ? source : void 0;
29792
+ const name = options.name ?? (blob && "name" in blob ? String(blob.name) : "");
29793
+ const declaredMime = options.declaredMime ?? (blob == null ? void 0 : blob.type);
29794
+ const reader = new Reader(blob ? blobSource(blob) : source);
29795
+ const head = await attempt(() => reader.read(0, Math.min(reader.size, SNIFF_BYTES)));
29796
+ const meta = { mime: resolveMime(sniffMagic(head), name, declaredMime) };
29797
+ await attempt(async () => {
29798
+ switch (meta.mime) {
29799
+ case "image/jpeg":
29800
+ await probeJpeg(reader, meta);
29801
+ break;
29802
+ case "image/png":
29803
+ await probePng(reader, meta);
29804
+ break;
29805
+ case "image/gif":
29806
+ await probeGif(reader, meta);
29807
+ break;
29808
+ case "image/webp":
29809
+ await probeWebp(reader, meta);
29810
+ break;
29811
+ case "image/heic":
29812
+ case "image/heif":
29813
+ case "image/avif":
29814
+ await probeHeif(reader, meta);
29815
+ break;
29816
+ case "image/tiff":
29817
+ await probeTiff(reader, meta);
29818
+ break;
29819
+ case "video/mp4":
29820
+ case "video/quicktime":
29821
+ case "audio/mp4":
29822
+ await probeIsoMedia(reader, meta);
29823
+ break;
29824
+ case "audio/flac":
29825
+ await probeFlac(reader, meta);
29826
+ break;
29827
+ case "audio/wav":
29828
+ await probeWav(reader, meta);
29829
+ break;
29830
+ case "audio/mpeg":
29831
+ await readId3(reader, meta);
29832
+ break;
29833
+ }
29834
+ });
29835
+ if (blob)
29836
+ await attempt(() => fillFromMediaElement(blob, meta));
29837
+ return withoutUndefined(meta);
29838
+ }
29839
+ function buildFileObject(name, size, content, meta = {}) {
29840
+ const file = new FileObject(name, size, content);
29841
+ file.meta = withoutUndefined(meta);
29842
+ return file;
29843
+ }
29844
+ const ndn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
29845
+ __proto__: null,
29846
+ ACTION_TYPE_DOWNLOAD,
29847
+ ACTION_TYPE_INSTALLED,
29848
+ ACTION_TYPE_LIKED,
29849
+ ACTION_TYPE_PURCHASED,
29850
+ ACTION_TYPE_SHARED,
29851
+ ACTION_TYPE_UNLIKED,
29852
+ ACTION_TYPE_VIEWED,
29853
+ BaseContentObject,
29854
+ CYFS_CONTENT_TYPE_NAMED_OBJECT_JSON,
29855
+ CYFS_CONTENT_TYPE_NAMED_OBJECT_JWT,
29856
+ ChunkId,
29857
+ ChunkType,
29858
+ DEFAULT_HASH_METHOD,
29859
+ DirObject,
29860
+ FILE_META_READ_LIMIT,
29861
+ FileObject,
29862
+ HashMethod,
29863
+ InclusionProof,
29864
+ KnownStandardObject,
29865
+ MSG_OBJECT_RESERVED_KEYS,
29866
+ MSG_REACTION_KEY_MAX_BYTES,
29867
+ MSG_SESSION_ID_MAX_CHARS,
29868
+ NamedObjectBase,
29869
+ NdnError,
29870
+ OBJ_TYPE_ACTION,
29871
+ OBJ_TYPE_CHUNK_LIST,
29872
+ OBJ_TYPE_DIR,
29873
+ OBJ_TYPE_FILE,
29874
+ OBJ_TYPE_INCLUSION_PROOF,
29875
+ OBJ_TYPE_LIST,
29876
+ OBJ_TYPE_MSG,
29877
+ OBJ_TYPE_OBJMAP,
29878
+ OBJ_TYPE_PACK,
29879
+ OBJ_TYPE_PATH,
29880
+ OBJ_TYPE_PKG,
29881
+ OBJ_TYPE_RECEIPT,
29882
+ OBJ_TYPE_RELATION,
29883
+ ObjId,
29884
+ PathObject,
29885
+ RELATION_TYPE_PART_OF,
29886
+ RELATION_TYPE_SAME,
29887
+ RelationObject,
29888
+ SimpleChunkList,
29889
+ SimpleMapItem,
29890
+ SimpleObjectMap,
29891
+ actionObjectFromJson,
29892
+ base32Decode,
29893
+ base32Encode,
29894
+ buildFileObject,
29895
+ buildNamedObjectByJson,
29896
+ buildNamedObjectByJwt,
29897
+ buildObjId,
29898
+ bytesToHex: bytesToHex$2,
29899
+ calcPkgMetaObjId,
29900
+ canonicalizeJson,
29901
+ decodeMsgObjectJwt,
29902
+ extractObjIdByPath,
29903
+ hexToBytes: hexToBytes$1,
29904
+ isCyfsNamedObjectContentType,
29905
+ isValidMsgSessionId,
29906
+ loadNamedObj,
29907
+ loadNamedObjAndVerify,
29908
+ loadNamedObjectFromObjStr,
29909
+ msgJwtKidDid,
29910
+ msgObjectFromJsonChecked,
29911
+ namedObjectEncodingFromContentType,
29912
+ normalizePackageMetaForObjId,
29913
+ probeFileMeta,
29914
+ randomMsgNonce,
29915
+ receiptObjFromJson,
29916
+ sha256Bytes,
29917
+ sha256Utf8,
29918
+ toCanonicalJsonString,
29919
+ validateMsgObject,
29920
+ varintDecode,
29921
+ varintEncode,
29922
+ verifyMsgObjectJwt,
29923
+ verifyNamedObject,
29924
+ verifyNamedObjectFromJwt,
29925
+ verifyNamedObjectFromStr
29926
+ }, Symbol.toStringTag, { value: "Module" }));
28471
29927
  const WORKER_SOURCE = (
28472
29928
  /* js */
28473
29929
  `
@@ -28608,7 +30064,7 @@ const browserProvider = {
28608
30064
  },
28609
30065
  pickFiles(options) {
28610
30066
  return new Promise((resolve, reject) => {
28611
- var _a2, _b;
30067
+ var _a2, _b2;
28612
30068
  const input = document.createElement("input");
28613
30069
  input.type = "file";
28614
30070
  if (options.mode === "single_dir") {
@@ -28657,7 +30113,7 @@ const browserProvider = {
28657
30113
  onAbort();
28658
30114
  return;
28659
30115
  }
28660
- (_b = options.signal) == null ? void 0 : _b.addEventListener("abort", onAbort, { once: true });
30116
+ (_b2 = options.signal) == null ? void 0 : _b2.addEventListener("abort", onAbort, { once: true });
28661
30117
  input.click();
28662
30118
  });
28663
30119
  }
@@ -28871,7 +30327,7 @@ async function debugDumpExpandState$1(request, options) {
28871
30327
  async function anchorState$1(request, options) {
28872
30328
  return callStoreApi("anchor_state", request, options);
28873
30329
  }
28874
- async function materializeFile(file, chunkSize = DEFAULT_CHUNK_SIZE, signal) {
30330
+ async function materializeFile(file, meta, chunkSize = DEFAULT_CHUNK_SIZE, signal) {
28875
30331
  throwIfCancelled(signal);
28876
30332
  const fileSize = file.size;
28877
30333
  const chunks = [];
@@ -28881,7 +30337,7 @@ async function materializeFile(file, chunkSize = DEFAULT_CHUNK_SIZE, signal) {
28881
30337
  const chunkId = ChunkId.fromMix256Result(buf.length, hash2);
28882
30338
  const chunkIdStr = chunkId.toString();
28883
30339
  chunks.push({ chunkId: chunkIdStr, offset: 0, length: buf.length, uploaded: false });
28884
- const fileObj2 = new FileObject(file.name, fileSize, chunkIdStr);
30340
+ const fileObj2 = buildFileObject(file.name, fileSize, chunkIdStr, meta);
28885
30341
  const [objId2, objData2] = fileObj2.genObjId();
28886
30342
  throwIfCancelled(signal);
28887
30343
  return { objectId: objId2.toString(), chunks, fileObject: fileObj2.toJSON(), objects: [{ obj_id: objId2.toString(), obj_data: objData2 }] };
@@ -28899,7 +30355,7 @@ async function materializeFile(file, chunkSize = DEFAULT_CHUNK_SIZE, signal) {
28899
30355
  offset = end;
28900
30356
  }
28901
30357
  const [chunkListObjId, chunkListData] = chunkList.genObjId();
28902
- const fileObj = new FileObject(file.name, fileSize, chunkListObjId.toString());
30358
+ const fileObj = buildFileObject(file.name, fileSize, chunkListObjId.toString(), meta);
28903
30359
  const [objId, objData] = fileObj.genObjId();
28904
30360
  throwIfCancelled(signal);
28905
30361
  return { objectId: objId.toString(), chunks, fileObject: fileObj.toJSON(), objects: [
@@ -28907,9 +30363,9 @@ async function materializeFile(file, chunkSize = DEFAULT_CHUNK_SIZE, signal) {
28907
30363
  { obj_id: objId.toString(), obj_data: objData }
28908
30364
  ] };
28909
30365
  }
28910
- async function materializeFileViaWorker(file, onHashProgress, chunkSize = DEFAULT_CHUNK_SIZE, signal) {
30366
+ async function materializeFileViaWorker(file, meta, onHashProgress, chunkSize = DEFAULT_CHUNK_SIZE, signal) {
28911
30367
  if (!isHashWorkerAvailable() || file.size === 0) {
28912
- const result = await materializeFile(file, chunkSize, signal);
30368
+ const result = await materializeFile(file, meta, chunkSize, signal);
28913
30369
  onHashProgress == null ? void 0 : onHashProgress(file.size);
28914
30370
  return result;
28915
30371
  }
@@ -28928,7 +30384,7 @@ async function materializeFileViaWorker(file, onHashProgress, chunkSize = DEFAUL
28928
30384
  hashResults = await Promise.race([worker.result, timeout]);
28929
30385
  } catch {
28930
30386
  throwIfCancelled(signal);
28931
- return materializeFile(file, chunkSize, signal);
30387
+ return materializeFile(file, meta, chunkSize, signal);
28932
30388
  } finally {
28933
30389
  if (timer)
28934
30390
  clearTimeout(timer);
@@ -28941,7 +30397,7 @@ async function materializeFileViaWorker(file, onHashProgress, chunkSize = DEFAUL
28941
30397
  const chunkId = ChunkId.fromMix256Result(r.length, r.hash);
28942
30398
  const chunkIdStr = chunkId.toString();
28943
30399
  chunks.push({ chunkId: chunkIdStr, offset: 0, length: r.length, uploaded: false });
28944
- const fileObj2 = new FileObject(file.name, fileSize, chunkIdStr);
30400
+ const fileObj2 = buildFileObject(file.name, fileSize, chunkIdStr, meta);
28945
30401
  const [objId2, objData2] = fileObj2.genObjId();
28946
30402
  throwIfCancelled(signal);
28947
30403
  return { objectId: objId2.toString(), chunks, fileObject: fileObj2.toJSON(), objects: [{ obj_id: objId2.toString(), obj_data: objData2 }] };
@@ -28953,7 +30409,7 @@ async function materializeFileViaWorker(file, onHashProgress, chunkSize = DEFAUL
28953
30409
  chunks.push({ chunkId: chunkId.toString(), offset: r.offset, length: r.length, uploaded: false });
28954
30410
  }
28955
30411
  const [chunkListObjId, chunkListData] = chunkList.genObjId();
28956
- const fileObj = new FileObject(file.name, fileSize, chunkListObjId.toString());
30412
+ const fileObj = buildFileObject(file.name, fileSize, chunkListObjId.toString(), meta);
28957
30413
  const [objId, objData] = fileObj.genObjId();
28958
30414
  throwIfCancelled(signal);
28959
30415
  return { objectId: objId.toString(), chunks, fileObject: fileObj.toJSON(), objects: [
@@ -28961,14 +30417,21 @@ async function materializeFileViaWorker(file, onHashProgress, chunkSize = DEFAUL
28961
30417
  { obj_id: objId.toString(), obj_data: objData }
28962
30418
  ] };
28963
30419
  }
28964
- function buildFileObjectFromContentId(name, size, contentId) {
28965
- const fileObj = new FileObject(name, size, contentId);
28966
- const [objId] = fileObj.genObjId();
30420
+ function buildFileObjectFromContentId(name, size, contentId, meta) {
30421
+ const fileObj = buildFileObject(name, size, contentId, meta);
30422
+ const [objId, objData] = fileObj.genObjId();
28967
30423
  return {
28968
30424
  objectId: objId.toString(),
30425
+ objData,
28969
30426
  fileObject: fileObj.toJSON()
28970
30427
  };
28971
30428
  }
30429
+ async function resolveFileMeta(file, known) {
30430
+ if (known == null ? void 0 : known.mime)
30431
+ return known;
30432
+ const probed = await probeFileMeta(file, { name: file.name, declaredMime: file.type });
30433
+ return { ...probed, ...known };
30434
+ }
28972
30435
  function resolveImportLookupEndpoint() {
28973
30436
  var _a2;
28974
30437
  const activeOrigin = getActiveZoneGatewayOrigin();
@@ -29021,7 +30484,7 @@ function extractLookupContentId(response, quickHash) {
29021
30484
  }
29022
30485
  return void 0;
29023
30486
  }
29024
- async function lookupFileByQcid(file, options, warnings) {
30487
+ async function lookupFileByQcid(file, meta, options, warnings) {
29025
30488
  const endpoint = options.endpoint ?? resolveImportLookupEndpoint();
29026
30489
  if (!endpoint)
29027
30490
  return null;
@@ -29038,7 +30501,7 @@ async function lookupFileByQcid(file, options, warnings) {
29038
30501
  const contentId = extractLookupContentId(response, qcid);
29039
30502
  if (!contentId || !(ObjId.fromString(contentId).isChunk() || ObjId.fromString(contentId).isChunkList()) || contentId.startsWith("qcid:"))
29040
30503
  return null;
29041
- return { ...buildFileObjectFromContentId(file.name, file.size, contentId), locality: "store", qcid };
30504
+ return { ...buildFileObjectFromContentId(file.name, file.size, contentId, meta), locality: "store", qcid };
29042
30505
  } catch (error) {
29043
30506
  throwIfCancelled(options.signal);
29044
30507
  if (!(error instanceof NdmStoreApiError && error.status === 404)) {
@@ -29212,7 +30675,7 @@ async function importDirectory(tree, options = {}) {
29212
30675
  return importSelectedFiles([], { ...options, mode: "single_dir" }, tree);
29213
30676
  }
29214
30677
  async function importSelectedFiles(selectedFiles, options, tree) {
29215
- var _a2;
30678
+ var _a2, _b2;
29216
30679
  throwIfCancelled(options.signal);
29217
30680
  const files = [...selectedFiles];
29218
30681
  const treePaths = [];
@@ -29261,10 +30724,12 @@ async function importSelectedFiles(selectedFiles, options, tree) {
29261
30724
  const file = files[fi];
29262
30725
  throwIfCancelled(options.signal);
29263
30726
  const relativePath = treePaths[fi] || file.webkitRelativePath || void 0;
30727
+ const fileMeta = await resolveFileMeta(file, (_a2 = options.fileMeta) == null ? void 0 : _a2.call(options, file));
30728
+ throwIfCancelled(options.signal);
29264
30729
  if (onProgress) {
29265
30730
  onProgress({ phase: "qcid_lookup", fileIndex: fi, fileCount, fileName: file.name, fileTotalBytes: file.size });
29266
30731
  }
29267
- const lookupHit = await lookupFileByQcid(file, requestOptions, warnings);
30732
+ const lookupHit = await lookupFileByQcid(file, fileMeta, requestOptions, warnings);
29268
30733
  let materialized = null;
29269
30734
  if (!lookupHit) {
29270
30735
  if (onProgress) {
@@ -29272,6 +30737,7 @@ async function importSelectedFiles(selectedFiles, options, tree) {
29272
30737
  }
29273
30738
  materialized = await materializeFileViaWorker(
29274
30739
  file,
30740
+ fileMeta,
29275
30741
  onProgress ? (bytesHashed) => {
29276
30742
  onProgress({ phase: "materializing", fileIndex: fi, fileCount, fileName: file.name, bytesProcessed: bytesHashed, fileTotalBytes: file.size });
29277
30743
  } : void 0,
@@ -29285,10 +30751,8 @@ async function importSelectedFiles(selectedFiles, options, tree) {
29285
30751
  if (materialized)
29286
30752
  for (const object2 of materialized.objects)
29287
30753
  manifest.set(object2.obj_id, object2);
29288
- else {
29289
- const [, objData] = new FileObject(file.name, file.size, fileObject.content).genObjId();
29290
- manifest.set(objectId, { obj_id: objectId, obj_data: objData });
29291
- }
30754
+ else
30755
+ manifest.set(objectId, { obj_id: objectId, obj_data: lookupHit.objData });
29292
30756
  const qcid = (lookupHit == null ? void 0 : lookupHit.qcid) ?? await tryCalculateQcidFromFile(file);
29293
30757
  if (qcid)
29294
30758
  qcidLinks.push({ qcid, content_id: fileObject.content, size: file.size });
@@ -29298,7 +30762,7 @@ async function importSelectedFiles(selectedFiles, options, tree) {
29298
30762
  objectId,
29299
30763
  name: file.name,
29300
30764
  size: file.size,
29301
- mimeType: file.type || void 0,
30765
+ mimeType: fileMeta.mime,
29302
30766
  relativePath,
29303
30767
  locality: (lookupHit == null ? void 0 : lookupHit.locality) ?? "local_only",
29304
30768
  _file: file,
@@ -29308,7 +30772,7 @@ async function importSelectedFiles(selectedFiles, options, tree) {
29308
30772
  if (onProgress) {
29309
30773
  onProgress({ phase: "thumbnail", fileIndex: fi, fileCount, fileName: file.name, fileTotalBytes: file.size });
29310
30774
  }
29311
- const eager = ((_a2 = options.thumbnails) == null ? void 0 : _a2.eager) !== false;
30775
+ const eager = ((_b2 = options.thumbnails) == null ? void 0 : _b2.eager) !== false;
29312
30776
  if (eager) {
29313
30777
  imported.thumbnail = await generateThumbnail(file, options.thumbnails);
29314
30778
  } else {
@@ -29457,7 +30921,7 @@ async function uploadChunkViaTus(endpoint, file, chunkInfo, chunkIndex, fileHash
29457
30921
  const logicalPath = chunkInfo.chunkId;
29458
30922
  let tusModule;
29459
30923
  try {
29460
- tusModule = await import("./tus_client-04080b1e.mjs");
30924
+ tusModule = await import("./tus_client-d1ffe2d6.mjs");
29461
30925
  } catch (error) {
29462
30926
  const message = error instanceof Error ? error.message : String(error);
29463
30927
  throw new NdmError("UPLOAD_FAILED", `Failed to load tus-js-client: ${message}`);
@@ -29611,7 +31075,7 @@ async function doUpload(session, concurrency) {
29611
31075
  let index = 0;
29612
31076
  let failure;
29613
31077
  const workers = Array.from({ length: Math.min(concurrency, states.length) }, async () => {
29614
- var _a3, _b;
31078
+ var _a3, _b2;
29615
31079
  while (index < states.length && !failure) {
29616
31080
  const state = states[index++];
29617
31081
  try {
@@ -29620,7 +31084,7 @@ async function doUpload(session, concurrency) {
29620
31084
  continue;
29621
31085
  state.state = "uploading";
29622
31086
  for (const [chunkIndex, chunk] of state.chunks.entries()) {
29623
- throwIfCancelled((_b = session.abortController) == null ? void 0 : _b.signal);
31087
+ throwIfCancelled((_b2 = session.abortController) == null ? void 0 : _b2.signal);
29624
31088
  if (chunk.uploaded)
29625
31089
  continue;
29626
31090
  let task = chunkTasks.get(chunk.chunkId);
@@ -29699,7 +31163,7 @@ function autoBindBody(bind) {
29699
31163
  return body;
29700
31164
  }
29701
31165
  async function uploadMissingChunk(session, state, chunk, chunkIndex) {
29702
- var _a2, _b;
31166
+ var _a2, _b2;
29703
31167
  try {
29704
31168
  const found = await lookupObject({ scope: "app", quick_hash: chunk.chunkId }, session.requestOptions);
29705
31169
  if (found.reusable === true && "state" in found && ["completed", "same_as", "local_link"].includes(found.state) && found.chunk_size === chunk.length)
@@ -29722,7 +31186,7 @@ async function uploadMissingChunk(session, state, chunk, chunkIndex) {
29722
31186
  state.uploadedBytes = state.chunks.filter((c) => c.uploaded).reduce((sum, c) => sum + c.length, 0) + uploaded;
29723
31187
  emitProgress(session);
29724
31188
  },
29725
- (_b = session.abortController) == null ? void 0 : _b.signal
31189
+ (_b2 = session.abortController) == null ? void 0 : _b2.signal
29726
31190
  );
29727
31191
  session.transmittedBytes += chunk.length;
29728
31192
  }
@@ -30592,218 +32056,219 @@ class ExecutorCommandStream {
30592
32056
  }
30593
32057
  }
30594
32058
  export {
30595
- CONTACT_TAG_ZONE_USER as $,
30596
- NOTIFY_TEXT_CONTROL_ID as A,
32059
+ FRIEND_INTENT as $,
32060
+ NOTIFY_CHOICE_CONTROL_ID as A,
30597
32061
  BS_SERVICE_VERIFY_HUB as B,
30598
- NOTIFY_ACTION_ANSWER as C,
30599
- NOTIFY_ACTION_DISMISS as D,
32062
+ NOTIFY_TEXT_CONTROL_ID as C,
32063
+ NOTIFY_ACTION_ANSWER as D,
30600
32064
  EXTERNAL_PRINCIPAL_CLAIM as E,
30601
- NOTIFY_LINK_PATH as F,
30602
- isNotifyClosed as G,
30603
- notifyCategorySessionId as H,
30604
- notifyCategoryFromSessionId as I,
30605
- inputPrompt as J,
30606
- promptOptions as K,
30607
- notifyAnswerToTaskResult as L,
32065
+ NOTIFY_ACTION_DISMISS as F,
32066
+ NOTIFY_LINK_PATH as G,
32067
+ isNotifyClosed as H,
32068
+ notifyCategorySessionId as I,
32069
+ notifyCategoryFromSessionId as J,
32070
+ inputPrompt as K,
32071
+ promptOptions as L,
30608
32072
  MsgQueueClient as M,
30609
32073
  NOTIFY_INTENT as N,
30610
- validateNotifyAnswer as O,
30611
- notifyUrl as P,
30612
- msgMachineData as Q,
32074
+ notifyAnswerToTaskResult as O,
32075
+ validateNotifyAnswer as P,
32076
+ notifyUrl as Q,
30613
32077
  RuntimeType as R,
30614
32078
  SystemConfigClient as S,
30615
- notifyMessageData as T,
30616
- commitNotifyAnswer as U,
32079
+ msgMachineData as T,
32080
+ notifyMessageData as U,
30617
32081
  VerifyHubClient as V,
30618
32082
  WEB3_BRIDGE_HOST as W,
30619
- answerNotify as X,
30620
- waitNotify as Y,
32083
+ commitNotifyAnswer as X,
32084
+ answerNotify as Y,
30621
32085
  ZONE_USER_TYPES as Z,
30622
- FRIEND_INTENT as _,
30623
- ndm_proxy as a,
30624
- TASK_ERR_INVALID_PHASE as a$,
30625
- CONTACT_TAG_ZONE_AGENT as a0,
30626
- CONTACT_TAG_HOMESTATION_FOLLOWING as a1,
30627
- CONTACT_CHANGED_EVENT_PATTERN as a2,
30628
- WELL_KNOWN_CONTACT_TAGS as a3,
30629
- USER_TYPE_GROUP_REF_PREFIX as a4,
30630
- USER_GROUP_REF_PREFIX as a5,
30631
- contactTagApp as a6,
30632
- contactTagKind as a7,
30633
- isUserGroupRefTag as a8,
30634
- DENY_REASONS as a9,
30635
- RAW_TASK_SCHEMA_ID as aA,
30636
- HUMAN_APPROVAL_SCHEMA_ID as aB,
30637
- DOWNLOAD_TASK_SCHEMA_ID as aC,
30638
- SCHEDULER_DISPATCH_THUNK_TASK_SCHEMA_ID as aD,
30639
- WORKFLOW_RUN_TREE_TASK_SCHEMA_ID as aE,
30640
- WORKFLOW_STEP_TASK_SCHEMA_ID as aF,
30641
- WORKFLOW_MAP_SHARD_TASK_SCHEMA_ID as aG,
30642
- WORKFLOW_THUNK_TASK_SCHEMA_ID as aH,
30643
- WORKFLOW_SCHEDULE_TASK_SCHEMA_ID as aI,
30644
- WORKFLOW_SEND_MESSAGE_TASK_SCHEMA_ID as aJ,
30645
- WORKFLOW_EXECUTE_RPC_TASK_SCHEMA_ID as aK,
30646
- WORKFLOW_RUN_TARGET_TASK_SCHEMA_ID as aL,
30647
- AGENT_DELEGATE_TASK_SCHEMA_ID as aM,
30648
- HUMAN_INPUT_TASK_SCHEMA_ID as aN,
30649
- OPENDAN_ASYNC_TOOL_TASK_SCHEMA_ID as aO,
30650
- OPENDAN_COMMAND_TASK_SCHEMA_ID as aP,
30651
- TOOL_EXEC_BASH_TASK_SCHEMA_ID as aQ,
30652
- AICC_COMPUTE_TASK_SCHEMA_ID as aR,
30653
- APP_INSTALL_TASK_SCHEMA_ID as aS,
30654
- APP_UNINSTALL_TASK_SCHEMA_ID as aT,
30655
- APP_START_TASK_SCHEMA_ID as aU,
30656
- APP_UPDATE_TASK_SCHEMA_ID as aV,
30657
- APP_UPDATE_BATCH_TASK_SCHEMA_ID as aW,
30658
- TASK_ERR_NOT_FOUND as aX,
30659
- TASK_ERR_PERMISSION_DENIED as aY,
30660
- TASK_ERR_REVISION_CONFLICT as aZ,
30661
- TASK_ERR_STALE_RUNNER_EPOCH as a_,
30662
- ACCESS_DENIED_ERROR_CODE as aa,
30663
- parseAccessDenial as ab,
30664
- accessDenialOf as ac,
30665
- ANONYMOUS_IDENTITY as ad,
30666
- parseCurrentIdentity as ae,
30667
- identityKey as af,
30668
- identityAllows as ag,
30669
- DEFAULT_JUMP_BASE_URL as ah,
30670
- JUMP_ACTION_PATHS as ai,
30671
- normalizeZoneHostname as aj,
30672
- zoneActionUrl as ak,
30673
- buildJumpUrl as al,
30674
- APP_LOGIN_ISSUE_METHOD as am,
30675
- APP_LOGIN_EXCHANGE_METHOD as an,
30676
- APP_LOGIN_SETTINGS_GET_METHOD as ao,
30677
- APP_LOGIN_SETTINGS_SET_METHOD as ap,
30678
- issueAppLoginCode as aq,
30679
- issueAppCustomerLink as ar,
30680
- parseAppLoginExchangeResult as as,
30681
- randomAppLoginNonce as at,
30682
- loginByAppAccessToken as au,
30683
- completeAppAccessTokenLogin as av,
30684
- TASK_MANAGER_SERVICE_UNIQUE_ID as aw,
30685
- TASK_MANAGER_SERVICE_NAME as ax,
30686
- TASK_MANAGER_SERVICE_PORT as ay,
30687
- TASK_POLICY_PRESET_COLLABORATIVE_TREE_V1 as az,
32086
+ waitNotify as _,
32087
+ ndm_client as a,
32088
+ TASK_ERR_STALE_RUNNER_EPOCH as a$,
32089
+ CONTACT_TAG_ZONE_USER as a0,
32090
+ CONTACT_TAG_ZONE_AGENT as a1,
32091
+ CONTACT_TAG_HOMESTATION_FOLLOWING as a2,
32092
+ CONTACT_CHANGED_EVENT_PATTERN as a3,
32093
+ WELL_KNOWN_CONTACT_TAGS as a4,
32094
+ USER_TYPE_GROUP_REF_PREFIX as a5,
32095
+ USER_GROUP_REF_PREFIX as a6,
32096
+ contactTagApp as a7,
32097
+ contactTagKind as a8,
32098
+ isUserGroupRefTag as a9,
32099
+ TASK_POLICY_PRESET_COLLABORATIVE_TREE_V1 as aA,
32100
+ RAW_TASK_SCHEMA_ID as aB,
32101
+ HUMAN_APPROVAL_SCHEMA_ID as aC,
32102
+ DOWNLOAD_TASK_SCHEMA_ID as aD,
32103
+ SCHEDULER_DISPATCH_THUNK_TASK_SCHEMA_ID as aE,
32104
+ WORKFLOW_RUN_TREE_TASK_SCHEMA_ID as aF,
32105
+ WORKFLOW_STEP_TASK_SCHEMA_ID as aG,
32106
+ WORKFLOW_MAP_SHARD_TASK_SCHEMA_ID as aH,
32107
+ WORKFLOW_THUNK_TASK_SCHEMA_ID as aI,
32108
+ WORKFLOW_SCHEDULE_TASK_SCHEMA_ID as aJ,
32109
+ WORKFLOW_SEND_MESSAGE_TASK_SCHEMA_ID as aK,
32110
+ WORKFLOW_EXECUTE_RPC_TASK_SCHEMA_ID as aL,
32111
+ WORKFLOW_RUN_TARGET_TASK_SCHEMA_ID as aM,
32112
+ AGENT_DELEGATE_TASK_SCHEMA_ID as aN,
32113
+ HUMAN_INPUT_TASK_SCHEMA_ID as aO,
32114
+ OPENDAN_ASYNC_TOOL_TASK_SCHEMA_ID as aP,
32115
+ OPENDAN_COMMAND_TASK_SCHEMA_ID as aQ,
32116
+ TOOL_EXEC_BASH_TASK_SCHEMA_ID as aR,
32117
+ AICC_COMPUTE_TASK_SCHEMA_ID as aS,
32118
+ APP_INSTALL_TASK_SCHEMA_ID as aT,
32119
+ APP_UNINSTALL_TASK_SCHEMA_ID as aU,
32120
+ APP_START_TASK_SCHEMA_ID as aV,
32121
+ APP_UPDATE_TASK_SCHEMA_ID as aW,
32122
+ APP_UPDATE_BATCH_TASK_SCHEMA_ID as aX,
32123
+ TASK_ERR_NOT_FOUND as aY,
32124
+ TASK_ERR_PERMISSION_DENIED as aZ,
32125
+ TASK_ERR_REVISION_CONFLICT as a_,
32126
+ DENY_REASONS as aa,
32127
+ ACCESS_DENIED_ERROR_CODE as ab,
32128
+ parseAccessDenial as ac,
32129
+ accessDenialOf as ad,
32130
+ ANONYMOUS_IDENTITY as ae,
32131
+ parseCurrentIdentity as af,
32132
+ identityKey as ag,
32133
+ identityAllows as ah,
32134
+ DEFAULT_JUMP_BASE_URL as ai,
32135
+ JUMP_ACTION_PATHS as aj,
32136
+ normalizeZoneHostname as ak,
32137
+ zoneActionUrl as al,
32138
+ buildJumpUrl as am,
32139
+ APP_LOGIN_ISSUE_METHOD as an,
32140
+ APP_LOGIN_EXCHANGE_METHOD as ao,
32141
+ APP_LOGIN_SETTINGS_GET_METHOD as ap,
32142
+ APP_LOGIN_SETTINGS_SET_METHOD as aq,
32143
+ issueAppLoginCode as ar,
32144
+ issueAppCustomerLink as as,
32145
+ parseAppLoginExchangeResult as at,
32146
+ randomAppLoginNonce as au,
32147
+ loginByAppAccessToken as av,
32148
+ completeAppAccessTokenLogin as aw,
32149
+ TASK_MANAGER_SERVICE_UNIQUE_ID as ax,
32150
+ TASK_MANAGER_SERVICE_NAME as ay,
32151
+ TASK_MANAGER_SERVICE_PORT as az,
30688
32152
  bns_client as b,
30689
- validateVideoGeneration as b$,
30690
- TASK_ERR_CONTROL_NOT_AVAILABLE as b0,
30691
- TASK_ERR_CONTROL_ALREADY_PENDING as b1,
30692
- TASK_ERR_ALREADY_COMPLETED as b2,
30693
- TASK_ERR_INPUT_SCHEMA_MISMATCH as b3,
30694
- TASK_ERR_RESULT_SCHEMA_MISMATCH as b4,
30695
- TASK_ERR_IDEMPOTENCY_CONFLICT as b5,
30696
- TASK_ERR_SCHEMA_NOT_FOUND as b6,
30697
- TASK_MGR_ERROR_CODES as b7,
30698
- taskMgrTaskEventPath as b8,
30699
- taskMgrTreeEventPath as b9,
30700
- WorkflowScheduledTaskStatus as bA,
30701
- WorkflowScheduledTaskMisfirePolicy as bB,
30702
- WorkflowScheduledTaskFireStatus as bC,
30703
- WorkflowClient as bD,
30704
- AICC_SERVICE_UNIQUE_ID as bE,
30705
- AICC_SERVICE_SERVICE_NAME as bF,
30706
- AICC_SERVICE_SERVICE_PORT as bG,
30707
- AICC_AI_METHODS as bH,
30708
- AICC_CORE_METHODS as bI,
30709
- AICC_MANAGEMENT_METHODS as bJ,
30710
- AICC_QUOTA_METHODS as bK,
30711
- AICC_METHODS as bL,
30712
- AICC_FEATURES as bM,
30713
- AICC_EXECUTION_MODES as bN,
30714
- AICC_POLICY_REFUSAL_CODES as bO,
30715
- aiccRefusalOf as bP,
30716
- isAiccAiMethod as bQ,
30717
- aiccTextMessage as bR,
30718
- aiccMessageTextContent as bS,
30719
- aiccMessageFirstText as bT,
30720
- validateAiccMessage as bU,
30721
- AiccClient as bV,
30722
- decisionRequirements as bW,
30723
- validateDecisionRequest as bX,
30724
- validateDecisionAnswers as bY,
30725
- parseVideoPrompt as bZ,
30726
- validateVideoOutput as b_,
30727
- taskMgrErrorCode as ba,
30728
- TaskExecutorKind as bb,
30729
- TaskPhase as bc,
30730
- isTerminalTaskPhase as bd,
30731
- TaskWaitReasonKind as be,
30732
- TaskOutcome as bf,
30733
- TaskControlAction as bg,
30734
- baselineTaskControlProfile as bh,
30735
- DEFAULT_CHILD_CONTROL_POLICY as bi,
30736
- TaskAction as bj,
30737
- TaskGrantScope as bk,
30738
- TaskDataScope as bl,
30739
- StorageDomain as bm,
30740
- TaskEventType as bn,
30741
- TaskManagerClient as bo,
30742
- WORKFLOW_SERVICE_NAME as bp,
30743
- WorkflowErrorCode as bq,
30744
- WorkflowRequestError as br,
30745
- WorkflowStepType as bs,
30746
- WorkflowOutputMode as bt,
30747
- WorkflowJoinMode as bu,
30748
- WorkflowRetryFallback as bv,
30749
- WorkflowDefinitionStatus as bw,
30750
- WorkflowRunStatus as bx,
30751
- WorkflowNodeRunState as by,
30752
- WorkflowHumanActionKind as bz,
32153
+ validateVideoOutput as b$,
32154
+ TASK_ERR_INVALID_PHASE as b0,
32155
+ TASK_ERR_CONTROL_NOT_AVAILABLE as b1,
32156
+ TASK_ERR_CONTROL_ALREADY_PENDING as b2,
32157
+ TASK_ERR_ALREADY_COMPLETED as b3,
32158
+ TASK_ERR_INPUT_SCHEMA_MISMATCH as b4,
32159
+ TASK_ERR_RESULT_SCHEMA_MISMATCH as b5,
32160
+ TASK_ERR_IDEMPOTENCY_CONFLICT as b6,
32161
+ TASK_ERR_SCHEMA_NOT_FOUND as b7,
32162
+ TASK_MGR_ERROR_CODES as b8,
32163
+ taskMgrTaskEventPath as b9,
32164
+ WorkflowHumanActionKind as bA,
32165
+ WorkflowScheduledTaskStatus as bB,
32166
+ WorkflowScheduledTaskMisfirePolicy as bC,
32167
+ WorkflowScheduledTaskFireStatus as bD,
32168
+ WorkflowClient as bE,
32169
+ AICC_SERVICE_UNIQUE_ID as bF,
32170
+ AICC_SERVICE_SERVICE_NAME as bG,
32171
+ AICC_SERVICE_SERVICE_PORT as bH,
32172
+ AICC_AI_METHODS as bI,
32173
+ AICC_CORE_METHODS as bJ,
32174
+ AICC_MANAGEMENT_METHODS as bK,
32175
+ AICC_QUOTA_METHODS as bL,
32176
+ AICC_METHODS as bM,
32177
+ AICC_FEATURES as bN,
32178
+ AICC_EXECUTION_MODES as bO,
32179
+ AICC_POLICY_REFUSAL_CODES as bP,
32180
+ aiccRefusalOf as bQ,
32181
+ isAiccAiMethod as bR,
32182
+ aiccTextMessage as bS,
32183
+ aiccMessageTextContent as bT,
32184
+ aiccMessageFirstText as bU,
32185
+ validateAiccMessage as bV,
32186
+ AiccClient as bW,
32187
+ decisionRequirements as bX,
32188
+ validateDecisionRequest as bY,
32189
+ validateDecisionAnswers as bZ,
32190
+ parseVideoPrompt as b_,
32191
+ taskMgrTreeEventPath as ba,
32192
+ taskMgrErrorCode as bb,
32193
+ TaskExecutorKind as bc,
32194
+ TaskPhase as bd,
32195
+ isTerminalTaskPhase as be,
32196
+ TaskWaitReasonKind as bf,
32197
+ TaskOutcome as bg,
32198
+ TaskControlAction as bh,
32199
+ baselineTaskControlProfile as bi,
32200
+ DEFAULT_CHILD_CONTROL_POLICY as bj,
32201
+ TaskAction as bk,
32202
+ TaskGrantScope as bl,
32203
+ TaskDataScope as bm,
32204
+ StorageDomain as bn,
32205
+ TaskEventType as bo,
32206
+ TaskManagerClient as bp,
32207
+ WORKFLOW_SERVICE_NAME as bq,
32208
+ WorkflowErrorCode as br,
32209
+ WorkflowRequestError as bs,
32210
+ WorkflowStepType as bt,
32211
+ WorkflowOutputMode as bu,
32212
+ WorkflowJoinMode as bv,
32213
+ WorkflowRetryFallback as bw,
32214
+ WorkflowDefinitionStatus as bx,
32215
+ WorkflowRunStatus as by,
32216
+ WorkflowNodeRunState as bz,
30753
32217
  createSDKModule as c,
30754
- validateVideoEdit as c0,
30755
- videoGenerationRequirement as c1,
30756
- KEventReader as c2,
30757
- KEventClient as c3,
30758
- appIdFromDid as c4,
30759
- parseAppId as c5,
30760
- appDidFromId as c6,
30761
- createAppInstanceId as c7,
30762
- parseAppInstanceId as c8,
30763
- BNS_EVM_DEFAULT_GAS_LIMIT as c9,
30764
- BNS_EVM_DEFAULT_MAX_FEE_PER_GAS as ca,
30765
- BNS_EVM_DEFAULT_MAX_PRIORITY_FEE_PER_GAS as cb,
30766
- BNS_MAX_INLINE_DOCUMENT_BYTES as cc,
30767
- BNS_DNS_TXT_DEFAULT_TTL as cd,
30768
- BNS_DNS_TXT_DOC_TYPE as ce,
30769
- BNS_PUBLISH_DOCUMENT_ABI as cf,
30770
- BnsEvmTxError as cg,
30771
- BnsEvmTxBuilder as ch,
30772
- decodeBnsPublishDocumentCalldata as ci,
30773
- BnsTxExecutorError as cj,
30774
- walletUserHasSnAccount as ck,
30775
- BnsTxExecutor as cl,
30776
- ExecutorClient as cm,
30777
- ExecutorStreamError as cn,
30778
- encodeExecutorControl as co,
30779
- ExecutorCommandStream as cp,
30780
- AIWORKSPACE_SERVICE_NAME as cq,
30781
- AiwsFailure as cr,
30782
- aiwsReferenceUrl as cs,
30783
- parseAiwsReferenceUrl as ct,
30784
- AiWorkspaceClient as cu,
30785
- bucket_client as d,
30786
- BS_SERVICE_TASK_MANAGER as e,
30787
- getActiveRuntimeType as f,
32218
+ validateVideoGeneration as c0,
32219
+ validateVideoEdit as c1,
32220
+ videoGenerationRequirement as c2,
32221
+ KEventReader as c3,
32222
+ KEventClient as c4,
32223
+ appIdFromDid as c5,
32224
+ parseAppId as c6,
32225
+ appDidFromId as c7,
32226
+ createAppInstanceId as c8,
32227
+ parseAppInstanceId as c9,
32228
+ BNS_EVM_DEFAULT_GAS_LIMIT as ca,
32229
+ BNS_EVM_DEFAULT_MAX_FEE_PER_GAS as cb,
32230
+ BNS_EVM_DEFAULT_MAX_PRIORITY_FEE_PER_GAS as cc,
32231
+ BNS_MAX_INLINE_DOCUMENT_BYTES as cd,
32232
+ BNS_DNS_TXT_DEFAULT_TTL as ce,
32233
+ BNS_DNS_TXT_DOC_TYPE as cf,
32234
+ BNS_PUBLISH_DOCUMENT_ABI as cg,
32235
+ BnsEvmTxError as ch,
32236
+ BnsEvmTxBuilder as ci,
32237
+ decodeBnsPublishDocumentCalldata as cj,
32238
+ BnsTxExecutorError as ck,
32239
+ walletUserHasSnAccount as cl,
32240
+ BnsTxExecutor as cm,
32241
+ ExecutorClient as cn,
32242
+ ExecutorStreamError as co,
32243
+ encodeExecutorControl as cp,
32244
+ ExecutorCommandStream as cq,
32245
+ AIWORKSPACE_SERVICE_NAME as cr,
32246
+ AiwsFailure as cs,
32247
+ aiwsReferenceUrl as ct,
32248
+ parseAiwsReferenceUrl as cu,
32249
+ AiWorkspaceClient as cv,
32250
+ ndm_proxy as d,
32251
+ bucket_client as e,
32252
+ BS_SERVICE_TASK_MANAGER as f,
30788
32253
  getCurrentWalletUserFromHost as g,
30789
- getActiveZoneGatewayOrigin as h,
30790
- getActiveSessionToken as i,
30791
- BuckyOSSDK as j,
30792
- RepoClient as k,
30793
- parseZoneUserType as l,
30794
- isExternalPrincipal as m,
30795
- ndm_client as n,
32254
+ getActiveRuntimeType as h,
32255
+ getActiveZoneGatewayOrigin as i,
32256
+ getActiveSessionToken as j,
32257
+ BuckyOSSDK as k,
32258
+ RepoClient as l,
32259
+ parseZoneUserType as m,
32260
+ ndn as n,
30796
32261
  object_url as o,
30797
32262
  parseSessionTokenClaims as p,
30798
- RPCError as q,
32263
+ isExternalPrincipal as q,
30799
32264
  resolveDidFromHost as r,
30800
32265
  sn_client as s,
30801
- MsgCenterClient as t,
30802
- mailboxAddress as u,
30803
- mailboxResource as v,
30804
- NOTIFY_DELIVERED_INTENT as w,
30805
- NOTIFY_DATA_VERSION as x,
30806
- NOTIFY_SESSION_PREFIX as y,
30807
- NOTIFY_CHOICE_CONTROL_ID as z
32266
+ RPCError as t,
32267
+ MsgCenterClient as u,
32268
+ mailboxAddress as v,
32269
+ mailboxResource as w,
32270
+ NOTIFY_DELIVERED_INTENT as x,
32271
+ NOTIFY_DATA_VERSION as y,
32272
+ NOTIFY_SESSION_PREFIX as z
30808
32273
  };
30809
- //# sourceMappingURL=executor_client-a32bc377.mjs.map
32274
+ //# sourceMappingURL=executor_client-5f4d0468.mjs.map