'use strict';

require('bs58');
var utils_types_bytes = require('../../utils/types/bytes.cjs');
require('multiformats/bases/base58');
require('varint');
var utils_encoding_ss58 = require('../../utils/encoding/ss-58.cjs');
var types_generic_typedEnum = require('../generic/typed-enum.cjs');
var types_generic_typedBytes = require('../generic/typed-bytes.cjs');
require('../generic/typed-string.cjs');
require('../generic/typed-array.cjs');
require('../generic/typed-tuple.cjs');
require('../generic/typed-null.cjs');
require('../../utils/types/array.cjs');
var types_generic_sized = require('../generic/sized.cjs');
require('../generic/typed-number.cjs');
require('../generic/typed-set.cjs');
require('../generic/typed-map.cjs');
require('../generic/typed-struct.cjs');
var types_generic_typedUuid = require('../generic/typed-uuid.cjs');
var types_generic_withQualifier = require('../generic/with-qualifier.cjs');
var types_generic_withFrom = require('../generic/with-from.cjs');
var types_generic_withFromDockId = require('../generic/with-from-dock-id.cjs');
var types_blob_const = require('./const.cjs');
require('../did/index.cjs');
var utils_mappings_dockDidById = require('../../utils/mappings/dock-did-by-id.cjs');
var types_did_onchain_typedDid_index = require('../did/onchain/typed-did/index.cjs');
var types_did_onchain_typedDid_cheqdDid = require('../did/onchain/typed-did/cheqd-did.cjs');
require('crypto');
require('../../utils/interfaces.cjs');
require('../../utils/assert.cjs');
require('../../utils/error.cjs');
require('../../utils/types/string.cjs');
require('../../utils/types/iterable.cjs');
require('../../utils/types/object.cjs');
require('../../utils/inheritance.cjs');
require('../../utils/types/set.cjs');
require('blake2b');
require('../generic/with-base.cjs');
require('../generic/with-catch-null.cjs');
require('../generic/with-eq.cjs');
require('../generic/any-of.cjs');
require('../generic/with-from-json-bytes.cjs');
require('../generic/create-placeholder.cjs');
require('../../utils/types/number.cjs');
require('uuid');
require('js-sha256');
require('../did/onchain/typed-did/did-method-key/did-method-key-public-key.cjs');
require('../../utils/encoding/base-58-btc.cjs');
require('../public-keys/public-key.cjs');
require('../public-keys/public-key-x25519-value.cjs');
require('../public-keys/public-key-ed25519-value.cjs');
require('../../vc/crypto/constants.cjs');
require('../public-keys/public-key-secp256k1-value.cjs');
require('../public-keys/public-key-sr25519-value.cjs');
require('../did/onchain/constants.cjs');
require('../did/onchain/typed-did/signature.cjs');
require('../did/onchain/typed-did/did-method-key/did-method-key-signature.cjs');
require('../signatures/signature-value.cjs');
require('../signatures/signature-ed25519-value.cjs');
require('../signatures/signature-secp256k1-value.cjs');
require('../signatures/signature.cjs');
require('../signatures/signature-sr25519-value.cjs');
require('../did/onchain/typed-did/dock-did-value.cjs');
require('../generic/utils.cjs');
require('../generic/typed-bytes-array.cjs');
require('../did/offchain/index.cjs');
require('../did/offchain/doc-ref.cjs');
require('../did/onchain/index.cjs');
require('../did/onchain/controllers.cjs');
require('../did/onchain/verification-relationship.cjs');
require('../did/onchain/did-key.cjs');
require('../offchain-signatures/params/index.cjs');
require('../offchain-signatures/params/value.cjs');
require('../generic/option.cjs');
require('../offchain-signatures/curve-type.cjs');
require('../offchain-signatures/params/id.cjs');
require('../offchain-signatures/public-keys/index.cjs');
require('../generic/with-prop.cjs');
require('../generic/with-props.cjs');
require('../../vc/crypto/Bls12381BBDT16KeyPairDock2024.cjs');
require('@docknetwork/crypto-wasm-ts');
require('../../vc/crypto/common/DockCryptoKeyPair.cjs');
require('../../vc/crypto/Bls12381BBDT16MACDock2024.cjs');
require('@docknetwork/crypto-wasm-ts/lib/index.js');
require('../../vc/crypto/common/DockCryptoSignature.cjs');
require('jsonld-signatures');
require('json-stringify-deterministic');
require('semver/preload.js');
require('../../vc/crypto/common/CustomLinkedDataSignature.cjs');
require('base64url');
require('jsonld');
require('../did/document/verification-method-ref.cjs');
require('../../vc/jws.cjs');
require('../../vc/crypto/Bls12381BBDT16MACProofDock2024.cjs');
require('../../vc/crypto/common/DockCryptoSignatureProof.cjs');
require('../../vc/crypto/Bls12381BBSKeyPairDock2023.cjs');
require('../../vc/crypto/Bls12381BBSSignatureDock2022.cjs');
require('../../vc/crypto/Bls12381G2KeyPairDock2022.cjs');
require('../../vc/crypto/Bls12381BBSSignatureDock2023.cjs');
require('../../vc/crypto/Bls12381BBSSignatureProofDock2022.cjs');
require('../../vc/crypto/Bls12381BBSSignatureProofDock2023.cjs');
require('../../vc/crypto/Bls12381BDDT16KeyPairDock2024.cjs');
require('../../vc/crypto/Bls12381BDDT16MACDock2024.cjs');
require('../../vc/crypto/Bls12381BDDT16MACProofDock2024.cjs');
require('../../vc/crypto/Bls12381PSKeyPairDock2023.cjs');
require('../../vc/crypto/Bls12381PSSignatureDock2023.cjs');
require('../../vc/crypto/Bls12381PSSignatureProofDock2023.cjs');
require('@juanelas/base64');
require('../../keypairs/keypair-secp256k1.cjs');
require('elliptic');
require('../../keypairs/dock-keypair.cjs');
require('@stablelib/ed25519');
require('@transmute/json-web-signature');
require('../offchain-signatures/public-keys/value.cjs');
require('../offchain-signatures/public-keys/ref.cjs');
require('../offchain-signatures/public-keys/id.cjs');
require('../did/onchain/verification-method-signature.cjs');
require('../../keypairs/did-keypair.cjs');
require('../did/document/verification-method-ref-or-ident-ref.cjs');
require('../did/document/ident-ref.cjs');
require('../did/document/index.cjs');
require('../did/document/service-endpoint.cjs');
require('../did/document/verification-method.cjs');
require('../../utils/encoding/base-58.cjs');
require('../generic/with-base58.cjs');
require('../generic/with-base58btc.cjs');
require('../generic/with-multibase.cjs');
require('../../utils/encoding/multibase.cjs');
require('../did/document/verification-method-type.cjs');
require('../did/document/verification-method-ref-or-cheqd-verification-method.cjs');
require('../did/document/const.cjs');

class BlobId extends types_generic_withFrom(
  types_generic_withQualifier(types_generic_typedEnum, true),
  (value, from) => {
    try {
      // eslint-disable-next-line no-use-before-define
      return DockBlobId.from(value);
    } catch {
      return from(value);
    }
  },
) {
  static Qualifier = 'blob:';

  toJSON() {
    return String(this);
  }
}

class DockBlobIdValue extends types_generic_sized(types_generic_withQualifier(types_generic_typedBytes)) {
  static Qualifier = types_blob_const.DockBlobQualifier;

  static Size = 32;

  static fromUnqualifiedString(bytes) {
    return new this(utils_types_bytes.isHex(bytes) ? bytes : utils_encoding_ss58.decodeFromSS58(bytes));
  }

  toEncodedString() {
    return utils_encoding_ss58.encodeAsSS58(this.value);
  }
}

class DockBlobId extends BlobId {
  static Qualifier = types_blob_const.DockBlobQualifier;

  static Class = DockBlobIdValue;

  static Type = 'dock';

  static random() {
    return new this(this.Class.random());
  }
}

class CheqdBlobIdValue extends types_did_onchain_typedDid_index.CheqdDidRef {
  static Qualifier = types_blob_const.CheqdBlobQualifier;

  static Ident = types_generic_withFromDockId.default(types_generic_typedUuid, DockBlobId, 'blob:cheqd:');
}

class CheqdTestnetBlobIdValue extends CheqdBlobIdValue {
  static Did = types_did_onchain_typedDid_cheqdDid.CheqdTestnetDid;
}

class CheqdMainnetBlobIdValue extends CheqdBlobIdValue {
  static Did = types_did_onchain_typedDid_cheqdDid.CheqdMainnetDid;
}

class CheqdBlobId extends BlobId {
  static Qualifier = types_blob_const.CheqdBlobQualifier;

  static Class = CheqdBlobIdValue;

  static Type = 'cheqd';

  static random(did) {
    return new this(this.Class.random(did));
  }
}

class CheqdTestnetBlobId extends CheqdBlobId {
  static Class = CheqdTestnetBlobIdValue;
}

class CheqdMainnetBlobId extends CheqdBlobId {
  static Class = CheqdMainnetBlobIdValue;
}

BlobId.bindVariants(CheqdBlobId, DockBlobId);

types_generic_withFromDockId.patchWithFromDock(CheqdBlobId, DockBlobId, utils_mappings_dockDidById.blobs);

exports.BlobId = BlobId;
exports.CheqdBlobId = CheqdBlobId;
exports.CheqdBlobIdValue = CheqdBlobIdValue;
exports.CheqdMainnetBlobId = CheqdMainnetBlobId;
exports.CheqdMainnetBlobIdValue = CheqdMainnetBlobIdValue;
exports.CheqdTestnetBlobId = CheqdTestnetBlobId;
exports.CheqdTestnetBlobIdValue = CheqdTestnetBlobIdValue;
exports.DockBlobId = DockBlobId;
exports.DockBlobIdValue = DockBlobIdValue;
//# sourceMappingURL=id.cjs.map
