@peerbit/any-store-opfs 1.1.3-e38a67b → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8023,8 +8023,11 @@
8023
8023
 
8024
8024
  // ../../crypto/dist/src/utils.js
8025
8025
  var import_libsodium_wrappers = __toESM(require_libsodium_wrappers(), 1);
8026
+ var asU8 = (bytes) => {
8027
+ return bytes instanceof Uint8Array ? bytes : new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength);
8028
+ };
8026
8029
  var toBase64URL = (arr) => {
8027
- return import_libsodium_wrappers.default.to_base64(arr, import_libsodium_wrappers.default.base64_variants.URLSAFE);
8030
+ return import_libsodium_wrappers.default.to_base64(asU8(arr), import_libsodium_wrappers.default.base64_variants.URLSAFE);
8028
8031
  };
8029
8032
  var fromBase64URL = (base64) => {
8030
8033
  return import_libsodium_wrappers.default.from_base64(base64, import_libsodium_wrappers.default.base64_variants.URLSAFE);
@@ -8040,12 +8043,21 @@
8040
8043
  };
8041
8044
  var delay = async (ms, options) => {
8042
8045
  return new Promise((resolve, reject) => {
8046
+ let timer;
8043
8047
  const handleAbort = () => {
8044
- clearTimeout(timer);
8048
+ options?.signal?.removeEventListener("abort", handleAbort);
8049
+ if (timer)
8050
+ clearTimeout(timer);
8045
8051
  reject(new AbortError());
8046
8052
  };
8047
- options?.signal?.addEventListener("abort", handleAbort);
8048
- const timer = setTimeout(() => {
8053
+ if (options?.signal) {
8054
+ if (options.signal.aborted) {
8055
+ handleAbort();
8056
+ return;
8057
+ }
8058
+ options.signal.addEventListener("abort", handleAbort, { once: true });
8059
+ }
8060
+ timer = setTimeout(() => {
8049
8061
  options?.signal?.removeEventListener("abort", handleAbort);
8050
8062
  resolve();
8051
8063
  }, ms);